@w100n/documents 0.14.0 → 0.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{SheetView-4TPL7DES.js → SheetView-RPQS43XY.js} +4 -4
- package/dist/{TextEditor-VBHWUOZR.js → TextEditor-D6QH2B7O.js} +173 -5
- package/dist/TextEditor-D6QH2B7O.js.map +1 -0
- package/dist/{chunk-5MH4WDW4.js → chunk-BGH36LAR.js} +66 -10
- package/dist/chunk-BGH36LAR.js.map +1 -0
- package/dist/{chunk-DR3TTJWZ.js → chunk-CAPICJ6B.js} +390 -36
- package/dist/chunk-CAPICJ6B.js.map +1 -0
- package/dist/{chunk-RCQODE2Z.js → chunk-XR42B3F5.js} +2 -2
- package/dist/collab.cjs +452 -44
- package/dist/collab.cjs.map +1 -1
- package/dist/collab.js +2 -2
- package/dist/index.cjs +714 -131
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +159 -0
- package/dist/index.css.map +1 -1
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/TextEditor-VBHWUOZR.js.map +0 -1
- package/dist/chunk-5MH4WDW4.js.map +0 -1
- package/dist/chunk-DR3TTJWZ.js.map +0 -1
- /package/dist/{SheetView-4TPL7DES.js.map → SheetView-RPQS43XY.js.map} +0 -0
- /package/dist/{chunk-RCQODE2Z.js.map → chunk-XR42B3F5.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import {
|
|
3
3
|
useLive
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-XR42B3F5.js";
|
|
5
5
|
import {
|
|
6
6
|
SheetRefusal,
|
|
7
7
|
build,
|
|
@@ -25,12 +25,12 @@ import {
|
|
|
25
25
|
strip,
|
|
26
26
|
worksheets,
|
|
27
27
|
writeSheet
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-BGH36LAR.js";
|
|
29
29
|
import {
|
|
30
30
|
rove,
|
|
31
31
|
useRestore
|
|
32
32
|
} from "./chunk-TDP6OJET.js";
|
|
33
|
-
import "./chunk-
|
|
33
|
+
import "./chunk-CAPICJ6B.js";
|
|
34
34
|
import {
|
|
35
35
|
span
|
|
36
36
|
} from "./chunk-ISOOUYLI.js";
|
|
@@ -966,4 +966,4 @@ export {
|
|
|
966
966
|
readSheet,
|
|
967
967
|
writeSheet
|
|
968
968
|
};
|
|
969
|
-
//# sourceMappingURL=SheetView-
|
|
969
|
+
//# sourceMappingURL=SheetView-RPQS43XY.js.map
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-QDH7EZAF.js";
|
|
5
5
|
import {
|
|
6
6
|
useLive
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-XR42B3F5.js";
|
|
8
8
|
import {
|
|
9
9
|
a4,
|
|
10
10
|
align,
|
|
@@ -26,15 +26,16 @@ import {
|
|
|
26
26
|
suggesting,
|
|
27
27
|
toMarkdown,
|
|
28
28
|
track
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-BGH36LAR.js";
|
|
30
30
|
import {
|
|
31
31
|
rove,
|
|
32
32
|
useRestore
|
|
33
33
|
} from "./chunk-TDP6OJET.js";
|
|
34
34
|
import {
|
|
35
|
+
mathml,
|
|
35
36
|
readDocx,
|
|
36
37
|
writeDocx
|
|
37
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-CAPICJ6B.js";
|
|
38
39
|
import "./chunk-ISOOUYLI.js";
|
|
39
40
|
|
|
40
41
|
// src/editor/TextEditor.tsx
|
|
@@ -74,6 +75,7 @@ import {
|
|
|
74
75
|
PaintBucket,
|
|
75
76
|
PaintRoller,
|
|
76
77
|
Search,
|
|
78
|
+
Omega,
|
|
77
79
|
PanelLeft,
|
|
78
80
|
PanelRight,
|
|
79
81
|
Ruler,
|
|
@@ -86,6 +88,7 @@ import {
|
|
|
86
88
|
Reply,
|
|
87
89
|
RotateCcw,
|
|
88
90
|
Save,
|
|
91
|
+
Sigma,
|
|
89
92
|
Strikethrough,
|
|
90
93
|
Table,
|
|
91
94
|
Subscript,
|
|
@@ -156,6 +159,59 @@ function DocxView({ bytes, onOutline, failed }) {
|
|
|
156
159
|
// src/editor/TextEditor.tsx
|
|
157
160
|
import { Fragment as Fragment3, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
158
161
|
var legal = { width: 816, height: 1344 };
|
|
162
|
+
var symbols = [
|
|
163
|
+
["\xA9", "copyright"],
|
|
164
|
+
["\xAE", "registered"],
|
|
165
|
+
["\u2122", "trademark"],
|
|
166
|
+
["\xA7", "section"],
|
|
167
|
+
["\xB6", "paragraph"],
|
|
168
|
+
["\u2020", "dagger"],
|
|
169
|
+
["\u2021", "double dagger"],
|
|
170
|
+
["\u2022", "bullet"],
|
|
171
|
+
["\u2026", "ellipsis"],
|
|
172
|
+
["\u2030", "per mille"],
|
|
173
|
+
["\u20AC", "euro"],
|
|
174
|
+
["\xA3", "pound"],
|
|
175
|
+
["\xA5", "yen"],
|
|
176
|
+
["\u20B4", "hryvnia"],
|
|
177
|
+
["z\u0142", "zloty"],
|
|
178
|
+
["\xB0", "degree"],
|
|
179
|
+
["\xB1", "plus minus"],
|
|
180
|
+
["\xD7", "times multiply"],
|
|
181
|
+
["\xF7", "divide"],
|
|
182
|
+
["\u2248", "approximately"],
|
|
183
|
+
["\u2260", "not equal"],
|
|
184
|
+
["\u2264", "less or equal"],
|
|
185
|
+
["\u2265", "greater or equal"],
|
|
186
|
+
["\u221E", "infinity"],
|
|
187
|
+
["\u221A", "square root"],
|
|
188
|
+
["\u2211", "sum"],
|
|
189
|
+
["\u03C0", "pi"],
|
|
190
|
+
["\u03A9", "omega"],
|
|
191
|
+
["\xB5", "micro"],
|
|
192
|
+
["\u03B1", "alpha"],
|
|
193
|
+
["\u03B2", "beta"],
|
|
194
|
+
["\u03B3", "gamma"],
|
|
195
|
+
["\u0394", "delta"],
|
|
196
|
+
["\u03BB", "lambda"],
|
|
197
|
+
["\u2192", "arrow right"],
|
|
198
|
+
["\u2190", "arrow left"],
|
|
199
|
+
["\u2191", "arrow up"],
|
|
200
|
+
["\u2193", "arrow down"],
|
|
201
|
+
["\u21D2", "arrow implies"],
|
|
202
|
+
["\u2713", "check tick"],
|
|
203
|
+
["\u2014", "em dash"],
|
|
204
|
+
["\u2013", "en dash"],
|
|
205
|
+
["\xAB", "quote left"],
|
|
206
|
+
["\xBB", "quote right"],
|
|
207
|
+
["\u201E", "quote low"],
|
|
208
|
+
["\u2116", "number"],
|
|
209
|
+
["\xBD", "half"],
|
|
210
|
+
["\xBC", "quarter"],
|
|
211
|
+
["\xB2", "squared"],
|
|
212
|
+
["\xB3", "cubed"]
|
|
213
|
+
];
|
|
214
|
+
var helpers = [["x\xB2", "^{2}"], ["x\u2099", "_{n}"], ["\u221Ax", "\\sqrt{}"], ["a/b", "\\frac{}{}"], ["\u2211", "\\sum_{}^{}"], ["\u222B", "\\int "], ["\u03C0", "\\pi "], ["\u2264", "\\le "], ["\u2265", "\\ge "], ["\u2260", "\\ne "], ["\xB1", "\\pm "], ["\xB7", "\\cdot "]];
|
|
159
215
|
var cm = (px) => Math.round(px / 96 * 254) / 100;
|
|
160
216
|
var inks = ["#0f172a", "#475569", "#dc2626", "#ea580c", "#ca8a04", "#16a34a", "#0891b2", "#2563eb", "#7c3aed", "#db2777"];
|
|
161
217
|
var glows = ["#fef08a", "#bbf7d0", "#bfdbfe", "#fbcfe8", "#fed7aa", "#ddd6fe"];
|
|
@@ -178,6 +234,8 @@ function TextEditor({ kind, bytes, t, language, rights, host, together, document
|
|
|
178
234
|
const scroller = useRef2(null);
|
|
179
235
|
const root = useRef2(null);
|
|
180
236
|
const [pop, setPop] = useState2(null);
|
|
237
|
+
const [dialog, setDialog] = useState2(null);
|
|
238
|
+
const field = useRef2(null);
|
|
181
239
|
const [more, setMore] = useState2(() => typeof localStorage !== "undefined" && localStorage.getItem("w100n-docs-more") === "1");
|
|
182
240
|
const [zoom, setZoom] = useState2(null);
|
|
183
241
|
const [layout, setLayout] = useState2(null);
|
|
@@ -746,7 +804,11 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
746
804
|
item(t.rule, () => editor.chain().focus().setHorizontalRule().run()),
|
|
747
805
|
"-",
|
|
748
806
|
state.toc < 0 ? item(t.tocInsert, insertToc) : item(t.tocRemove, () => editor.chain().focus().deleteRange({ from: state.toc, to: state.toc + editor.state.doc.nodeAt(state.toc).nodeSize }).run()),
|
|
749
|
-
can.comment && item(t.addComment, begin, { off: state.empty, keys: `${mod}\u2325M` })
|
|
807
|
+
can.comment && item(t.addComment, begin, { off: state.empty, keys: `${mod}\u2325M` }),
|
|
808
|
+
"-",
|
|
809
|
+
item(t.symbols, () => setDialog({ kind: "symbol", query: "" })),
|
|
810
|
+
docx && item(t.formula, () => setDialog({ kind: "formula", latex: "", at: null })),
|
|
811
|
+
docx && item(t.footnote, () => setDialog({ kind: "note", text: "", at: null }))
|
|
750
812
|
] : []],
|
|
751
813
|
["format", t.menuFormat, can.edit ? [
|
|
752
814
|
...styles.map(([key, label, run]) => item(label, run, { on: state.style === key })),
|
|
@@ -1184,6 +1246,14 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
1184
1246
|
status
|
|
1185
1247
|
] }),
|
|
1186
1248
|
/* @__PURE__ */ jsx2("div", { ref: scroller, className: "w100n-text-scroll", "data-paint": !!paint, onMouseUp: lay, onClick: (e) => {
|
|
1249
|
+
const atom = can.edit ? e.target.closest(".w100n-math, sup[data-footnote]") : null;
|
|
1250
|
+
if (atom) {
|
|
1251
|
+
const at = editor.view.posAtDOM(atom, 0);
|
|
1252
|
+
const node = editor.state.doc.nodeAt(at);
|
|
1253
|
+
if (node?.type.name === "math") setDialog({ kind: "formula", latex: node.attrs.latex, at });
|
|
1254
|
+
if (node?.type.name === "footnote") setDialog({ kind: "note", text: node.attrs.text, at });
|
|
1255
|
+
return;
|
|
1256
|
+
}
|
|
1187
1257
|
const id = e.target.closest("[data-note]")?.getAttribute("data-note");
|
|
1188
1258
|
if (!id) return;
|
|
1189
1259
|
setActive(id);
|
|
@@ -1207,6 +1277,104 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
1207
1277
|
] }),
|
|
1208
1278
|
finder
|
|
1209
1279
|
] }) }),
|
|
1280
|
+
dialog && /* @__PURE__ */ jsx2("div", { className: "w100n-pdf-back", onKeyDown: (e) => {
|
|
1281
|
+
if (e.key === "Escape") {
|
|
1282
|
+
e.stopPropagation();
|
|
1283
|
+
setDialog(null);
|
|
1284
|
+
}
|
|
1285
|
+
}, children: dialog.kind === "symbol" ? /* @__PURE__ */ jsxs2("div", { className: "w100n-pdf-dialog w100n-insert", role: "dialog", "aria-modal": true, "aria-label": t.symbols, children: [
|
|
1286
|
+
/* @__PURE__ */ jsxs2("div", { className: "w100n-new-head", children: [
|
|
1287
|
+
/* @__PURE__ */ jsx2("span", { className: "w100n-new-tile", "data-tone": "pink", children: /* @__PURE__ */ jsx2(Omega, { "aria-hidden": true }) }),
|
|
1288
|
+
/* @__PURE__ */ jsx2("b", { className: "w100n-pdf-dialog-title", children: t.symbols }),
|
|
1289
|
+
/* @__PURE__ */ jsx2("button", { type: "button", className: "w100n-docs-close", onClick: () => setDialog(null), "aria-label": t.close, title: t.close, children: /* @__PURE__ */ jsx2(X, { "aria-hidden": true }) })
|
|
1290
|
+
] }),
|
|
1291
|
+
/* @__PURE__ */ jsxs2("label", { className: "w100n-docs-field w100n-docs-search", children: [
|
|
1292
|
+
/* @__PURE__ */ jsx2(Search, { "aria-hidden": true }),
|
|
1293
|
+
/* @__PURE__ */ jsx2("input", { autoFocus: true, value: dialog.query, placeholder: t.symbolSearch, "aria-label": t.symbolSearch, onChange: (e) => setDialog({ kind: "symbol", query: e.target.value }) })
|
|
1294
|
+
] }),
|
|
1295
|
+
/* @__PURE__ */ jsx2("div", { className: "w100n-insert-grid", role: "group", "aria-label": t.symbols, children: symbols.filter(([ch, name]) => !dialog.query.trim() || name.includes(dialog.query.trim().toLowerCase()) || ch === dialog.query.trim()).map(([ch, name]) => /* @__PURE__ */ jsx2("button", { type: "button", "aria-label": name, title: name, onClick: () => {
|
|
1296
|
+
editor.chain().focus().insertContent(ch).run();
|
|
1297
|
+
setDialog(null);
|
|
1298
|
+
}, children: ch }, ch)) })
|
|
1299
|
+
] }) : dialog.kind === "formula" ? /* @__PURE__ */ jsxs2("form", { className: "w100n-pdf-dialog w100n-insert", role: "dialog", "aria-modal": true, "aria-label": t.formula, onSubmit: (e) => {
|
|
1300
|
+
e.preventDefault();
|
|
1301
|
+
const latex = dialog.latex.trim();
|
|
1302
|
+
if (!latex) return;
|
|
1303
|
+
if (dialog.at !== null) editor.chain().focus().command(({ tr }) => {
|
|
1304
|
+
tr.setNodeMarkup(dialog.at, void 0, { latex });
|
|
1305
|
+
return true;
|
|
1306
|
+
}).run();
|
|
1307
|
+
else editor.chain().focus().insertContent({ type: "math", attrs: { latex } }).run();
|
|
1308
|
+
setDialog(null);
|
|
1309
|
+
}, children: [
|
|
1310
|
+
/* @__PURE__ */ jsxs2("div", { className: "w100n-new-head", children: [
|
|
1311
|
+
/* @__PURE__ */ jsx2("span", { className: "w100n-new-tile", "data-tone": "blue", children: /* @__PURE__ */ jsx2(Sigma, { "aria-hidden": true }) }),
|
|
1312
|
+
/* @__PURE__ */ jsx2("b", { className: "w100n-pdf-dialog-title", children: t.formula }),
|
|
1313
|
+
/* @__PURE__ */ jsx2("span", { className: "w100n-docs-badge", children: t.formulaHint }),
|
|
1314
|
+
/* @__PURE__ */ jsx2("button", { type: "button", className: "w100n-docs-close", onClick: () => setDialog(null), "aria-label": t.close, title: t.close, children: /* @__PURE__ */ jsx2(X, { "aria-hidden": true }) })
|
|
1315
|
+
] }),
|
|
1316
|
+
/* @__PURE__ */ jsx2("input", { ref: field, autoFocus: true, className: "w100n-insert-latex", value: dialog.latex, "aria-label": t.formula, placeholder: "F = 900 + 12 \\\\cdot n", onChange: (e) => setDialog({ ...dialog, latex: e.target.value }) }),
|
|
1317
|
+
/* @__PURE__ */ jsx2("div", { className: "w100n-insert-tools", role: "group", "aria-label": t.formula, children: helpers.map(([label, code]) => /* @__PURE__ */ jsx2("button", { type: "button", onClick: () => {
|
|
1318
|
+
const el = field.current;
|
|
1319
|
+
const at = el.selectionStart ?? dialog.latex.length;
|
|
1320
|
+
const latex = dialog.latex.slice(0, at) + code + dialog.latex.slice(el.selectionEnd ?? at);
|
|
1321
|
+
setDialog({ ...dialog, latex });
|
|
1322
|
+
const caret = at + (code.indexOf("{}") >= 0 ? code.indexOf("{}") + 1 : code.length);
|
|
1323
|
+
requestAnimationFrame(() => {
|
|
1324
|
+
el.focus();
|
|
1325
|
+
el.setSelectionRange(caret, caret);
|
|
1326
|
+
});
|
|
1327
|
+
}, children: label }, label)) }),
|
|
1328
|
+
/* @__PURE__ */ jsx2("div", { className: "w100n-insert-preview", "aria-live": "polite", dangerouslySetInnerHTML: { __html: dialog.latex.trim() ? mathml(dialog.latex) : "" } }),
|
|
1329
|
+
/* @__PURE__ */ jsxs2("span", { className: "w100n-pdf-dialog-end", children: [
|
|
1330
|
+
/* @__PURE__ */ jsx2("button", { type: "button", className: "w100n-pdf-link", onClick: () => setDialog(null), children: t.cancel }),
|
|
1331
|
+
/* @__PURE__ */ jsxs2("button", { type: "submit", className: "w100n-docs-action", disabled: !dialog.latex.trim(), children: [
|
|
1332
|
+
/* @__PURE__ */ jsx2(Check, { "aria-hidden": true }),
|
|
1333
|
+
dialog.at !== null ? t.update : t.put
|
|
1334
|
+
] })
|
|
1335
|
+
] })
|
|
1336
|
+
] }) : /* @__PURE__ */ jsxs2("form", { className: "w100n-pdf-dialog w100n-insert", role: "dialog", "aria-modal": true, "aria-label": t.footnote, onSubmit: (e) => {
|
|
1337
|
+
e.preventDefault();
|
|
1338
|
+
const text = dialog.text.trim();
|
|
1339
|
+
if (!text) return;
|
|
1340
|
+
if (dialog.at !== null) editor.chain().focus().command(({ tr }) => {
|
|
1341
|
+
tr.setNodeAttribute(dialog.at, "text", text);
|
|
1342
|
+
return true;
|
|
1343
|
+
}).run();
|
|
1344
|
+
else editor.chain().focus().insertContent({ type: "footnote", attrs: { id: null, text } }).run();
|
|
1345
|
+
setDialog(null);
|
|
1346
|
+
}, children: [
|
|
1347
|
+
/* @__PURE__ */ jsxs2("div", { className: "w100n-new-head", children: [
|
|
1348
|
+
/* @__PURE__ */ jsx2("span", { className: "w100n-new-tile", "data-tone": "violet", children: /* @__PURE__ */ jsx2(Superscript, { "aria-hidden": true }) }),
|
|
1349
|
+
/* @__PURE__ */ jsx2("b", { className: "w100n-pdf-dialog-title", children: t.footnote }),
|
|
1350
|
+
/* @__PURE__ */ jsx2("button", { type: "button", className: "w100n-docs-close", onClick: () => setDialog(null), "aria-label": t.close, title: t.close, children: /* @__PURE__ */ jsx2(X, { "aria-hidden": true }) })
|
|
1351
|
+
] }),
|
|
1352
|
+
/* @__PURE__ */ jsx2(
|
|
1353
|
+
"textarea",
|
|
1354
|
+
{
|
|
1355
|
+
autoFocus: true,
|
|
1356
|
+
className: "w100n-insert-note",
|
|
1357
|
+
value: dialog.text,
|
|
1358
|
+
"aria-label": t.footnoteText,
|
|
1359
|
+
placeholder: t.footnoteText,
|
|
1360
|
+
onChange: (e) => setDialog({ ...dialog, text: e.target.value }),
|
|
1361
|
+
onKeyDown: (e) => {
|
|
1362
|
+
if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) e.currentTarget.form?.requestSubmit();
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
),
|
|
1366
|
+
/* @__PURE__ */ jsxs2("span", { className: "w100n-pdf-dialog-end", children: [
|
|
1367
|
+
dialog.at !== null && /* @__PURE__ */ jsx2("button", { type: "button", className: "w100n-pdf-link", onClick: () => {
|
|
1368
|
+
editor.chain().focus().deleteRange({ from: dialog.at, to: dialog.at + 1 }).run();
|
|
1369
|
+
setDialog(null);
|
|
1370
|
+
}, children: t.removeFootnote }),
|
|
1371
|
+
/* @__PURE__ */ jsx2("button", { type: "button", className: "w100n-pdf-link", onClick: () => setDialog(null), children: t.cancel }),
|
|
1372
|
+
/* @__PURE__ */ jsxs2("button", { type: "submit", className: "w100n-docs-action", disabled: !dialog.text.trim(), children: [
|
|
1373
|
+
/* @__PURE__ */ jsx2(Check, { "aria-hidden": true }),
|
|
1374
|
+
dialog.at !== null ? t.update : t.put
|
|
1375
|
+
] })
|
|
1376
|
+
] })
|
|
1377
|
+
] }) }),
|
|
1210
1378
|
draft2 && /* @__PURE__ */ jsx2("div", { className: "w100n-pdf-back", onKeyDown: (e) => {
|
|
1211
1379
|
if (e.key === "Escape") {
|
|
1212
1380
|
e.stopPropagation();
|
|
@@ -1391,4 +1559,4 @@ img { max-width: 100%; } img[data-wrap='left'] { float: left; margin: 0 12pt 6pt
|
|
|
1391
1559
|
export {
|
|
1392
1560
|
TextEditor as default
|
|
1393
1561
|
};
|
|
1394
|
-
//# sourceMappingURL=TextEditor-
|
|
1562
|
+
//# sourceMappingURL=TextEditor-D6QH2B7O.js.map
|