@w100n/documents 0.13.0 → 0.15.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.
Files changed (53) hide show
  1. package/dist/{SheetView-3XTEV2VT.css → SheetView-43MPR64N.css} +5 -4
  2. package/dist/{SheetView-3XTEV2VT.css.map → SheetView-43MPR64N.css.map} +1 -1
  3. package/dist/{SheetView-3UAFXGZS.js → SheetView-72KXS4DM.js} +51 -10
  4. package/dist/SheetView-72KXS4DM.js.map +1 -0
  5. package/dist/TextEditor-NSICFE6U.js +1562 -0
  6. package/dist/TextEditor-NSICFE6U.js.map +1 -0
  7. package/dist/{chunk-L765DZPO.js → chunk-2CA3HQTI.js} +3 -3
  8. package/dist/{chunk-L765DZPO.js.map → chunk-2CA3HQTI.js.map} +1 -1
  9. package/dist/{chunk-WR3MT7KP.js → chunk-M4OQG3EN.js} +754 -57
  10. package/dist/chunk-M4OQG3EN.js.map +1 -0
  11. package/dist/{chunk-T7XCGDE5.js → chunk-OXC4PUOC.js} +2 -2
  12. package/dist/{chunk-MRP3EURG.js → chunk-Z7UNJ4ND.js} +194 -25
  13. package/dist/chunk-Z7UNJ4ND.js.map +1 -0
  14. package/dist/collab.cjs +927 -80
  15. package/dist/collab.cjs.map +1 -1
  16. package/dist/collab.d.cts +2 -2
  17. package/dist/collab.d.ts +2 -2
  18. package/dist/collab.js +2 -2
  19. package/dist/{grid-EI5JNZAA.js → grid-Q4XBPQFY.js} +3 -3
  20. package/dist/grid-Q4XBPQFY.js.map +1 -0
  21. package/dist/index.cjs +2136 -420
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.css +1047 -171
  24. package/dist/index.css.map +1 -1
  25. package/dist/index.d.cts +9 -4
  26. package/dist/index.d.ts +9 -4
  27. package/dist/index.js +283 -33
  28. package/dist/index.js.map +1 -1
  29. package/dist/kinds.cjs +2 -2
  30. package/dist/kinds.cjs.map +1 -1
  31. package/dist/kinds.d.cts +2 -2
  32. package/dist/kinds.d.ts +2 -2
  33. package/dist/kinds.js +1 -1
  34. package/dist/memory.cjs +3 -0
  35. package/dist/memory.cjs.map +1 -1
  36. package/dist/memory.d.cts +1 -1
  37. package/dist/memory.d.ts +1 -1
  38. package/dist/memory.js +4 -1
  39. package/dist/memory.js.map +1 -1
  40. package/dist/{types-Er60M5kL.d.ts → types-BTsVooZw.d.cts} +2 -1
  41. package/dist/{types-Er60M5kL.d.cts → types-BTsVooZw.d.ts} +2 -1
  42. package/dist/write-BCI8yool.d.cts +16 -0
  43. package/dist/write-BCI8yool.d.ts +16 -0
  44. package/package.json +1 -1
  45. package/dist/SheetView-3UAFXGZS.js.map +0 -1
  46. package/dist/TextEditor-OLBLWC6F.js +0 -983
  47. package/dist/TextEditor-OLBLWC6F.js.map +0 -1
  48. package/dist/chunk-MRP3EURG.js.map +0 -1
  49. package/dist/chunk-WR3MT7KP.js.map +0 -1
  50. package/dist/grid-EI5JNZAA.js.map +0 -1
  51. package/dist/write-DaVtTJCS.d.cts +0 -6
  52. package/dist/write-DaVtTJCS.d.ts +0 -6
  53. /package/dist/{chunk-T7XCGDE5.js.map → chunk-OXC4PUOC.js.map} +0 -0
@@ -5,7 +5,7 @@ import {
5
5
  pending,
6
6
  save,
7
7
  seed
8
- } from "./chunk-MRP3EURG.js";
8
+ } from "./chunk-Z7UNJ4ND.js";
9
9
 
10
10
  // src/editor/live.ts
11
11
  import { HocuspocusProvider } from "@hocuspocus/provider";
@@ -193,4 +193,4 @@ ${id}`, id, kind, doc, host2, { id: me.id, name: me.name, language }, edit) : ne
193
193
  export {
194
194
  useLive
195
195
  };
196
- //# sourceMappingURL=chunk-T7XCGDE5.js.map
196
+ //# sourceMappingURL=chunk-OXC4PUOC.js.map
@@ -5,6 +5,7 @@ import {
5
5
  entry,
6
6
  escape,
7
7
  inflate,
8
+ mathml,
8
9
  parse,
9
10
  readDocx,
10
11
  texts,
@@ -12,7 +13,7 @@ import {
12
13
  unzip,
13
14
  writeDocx,
14
15
  zip
15
- } from "./chunk-WR3MT7KP.js";
16
+ } from "./chunk-M4OQG3EN.js";
16
17
  import {
17
18
  a1,
18
19
  box,
@@ -35,7 +36,7 @@ import { prosemirrorJSONToYXmlFragment, updateYFragment, yXmlFragmentToProseMirr
35
36
  import * as Y2 from "yjs";
36
37
 
37
38
  // package.json
38
- var version = "0.13.0";
39
+ var version = "0.15.0";
39
40
 
40
41
  // src/editor/extensions.ts
41
42
  import { Extension as Extension2, Mark, Node } from "@tiptap/core";
@@ -66,6 +67,10 @@ function measure(view) {
66
67
  const room = page.height - top - bottom;
67
68
  const els = [...view.dom.children];
68
69
  const gaps = [];
70
+ const line = page.width - page.margins[1] - page.margins[3];
71
+ const area = (list) => list.length ? 14 + list.reduce((h, text) => h + 15 * Math.max(1, Math.ceil(text.length * 5.6 / line)), 0) : 0;
72
+ let notes2 = [];
73
+ let count = 0;
69
74
  let i = 0;
70
75
  let shift = 0;
71
76
  let start = 0;
@@ -79,17 +84,25 @@ function measure(view) {
79
84
  if (!el) return;
80
85
  const y = el.offsetTop - shift;
81
86
  const end = y + el.offsetHeight;
87
+ const mine = [];
88
+ node.descendants((d) => {
89
+ if (d.type.name === "footnote") mine.push(`${count + mine.length + 1} ${d.attrs.text}`);
90
+ });
82
91
  if (node.type.name === "pageBreak") {
83
- gaps.push({ pos: offset + node.nodeSize, height: start + room - end + bottom + 24 + top, page: gaps.length + 1 });
92
+ gaps.push({ pos: offset + node.nodeSize, height: start + room - end + bottom + 24 + top, page: gaps.length + 1, notes: notes2 });
93
+ notes2 = [];
84
94
  start = end;
85
- } else if (end > start + room && y > start) {
86
- gaps.push({ pos: offset, height: start + room - y + bottom + 24 + top, page: gaps.length + 1 });
95
+ } else if (end > start + room - area([...notes2, ...mine]) && y > start) {
96
+ gaps.push({ pos: offset, height: start + room - y + bottom + 24 + top, page: gaps.length + 1, notes: notes2 });
97
+ notes2 = [];
87
98
  start = y;
88
99
  }
100
+ notes2.push(...mine);
101
+ count += mine.length;
89
102
  while (end > start + room) start += room;
90
103
  last = end;
91
104
  });
92
- gaps.push({ pos: view.state.doc.content.size, height: Math.max(0, start + room - last), page: gaps.length + 1, end: true });
105
+ gaps.push({ pos: view.state.doc.content.size, height: Math.max(0, start + room - last), page: gaps.length + 1, end: true, notes: notes2 });
93
106
  return gaps.map((g) => ({ ...g, height: Math.max(0, Math.round(g.height)) }));
94
107
  }
95
108
  var Pager = Extension.create({
@@ -97,10 +110,10 @@ var Pager = Extension.create({
97
110
  addProseMirrorPlugins: () => [new Plugin({
98
111
  key: paging,
99
112
  state: {
100
- init: () => ({ set: DecorationSet.empty, page: a4 }),
113
+ init: () => ({ set: DecorationSet.empty, page: a4, marks: { header: "", footer: "" } }),
101
114
  apply(tr, value2) {
102
115
  const next = tr.getMeta(paging);
103
- return { set: next?.set ?? value2.set.map(tr.mapping, tr.doc), page: next?.page ?? value2.page };
116
+ return { set: next?.set ?? value2.set.map(tr.mapping, tr.doc), page: next?.page ?? value2.page, marks: next?.marks ?? value2.marks };
104
117
  }
105
118
  },
106
119
  props: { decorations: (state) => paging.getState(state).set },
@@ -110,17 +123,46 @@ var Pager = Extension.create({
110
123
  const run = () => {
111
124
  if (!view.dom.isConnected) return;
112
125
  const gaps = measure(view);
113
- const next = gaps.map((g) => `${g.pos}:${g.height}`).join();
126
+ const { marks } = paging.getState(view.state);
127
+ const next = gaps.map((g) => `${g.pos}:${g.height}:${g.notes.join("\n")}`).join() + `|${marks.header}|${marks.footer}`;
114
128
  if (next === sig) return;
115
129
  sig = next;
116
- const set = DecorationSet.create(view.state.doc, gaps.map((g) => Decoration.widget(g.pos, () => {
130
+ const line = (parent, cls, text) => {
131
+ if (!text) return;
132
+ const span2 = document.createElement("span");
133
+ span2.className = cls;
134
+ span2.textContent = text;
135
+ parent.append(span2);
136
+ };
137
+ const first = Decoration.widget(0, () => {
138
+ const el = document.createElement("div");
139
+ el.className = "w100n-text-first";
140
+ el.contentEditable = "false";
141
+ line(el, "w100n-text-head", marks.header);
142
+ return el;
143
+ }, { key: `first:${marks.header}`, side: -1, ignoreSelection: true });
144
+ const set = DecorationSet.create(view.state.doc, [first, ...gaps.map((g) => Decoration.widget(g.pos, () => {
117
145
  const el = document.createElement("div");
118
146
  el.className = g.end ? "w100n-text-gap is-end" : "w100n-text-gap";
119
147
  el.style.height = `${g.height}px`;
120
148
  el.dataset.page = String(g.page);
121
149
  el.contentEditable = "false";
150
+ line(el, "w100n-text-foot", marks.footer);
151
+ if (!g.end) line(el, "w100n-text-head", marks.header);
152
+ if (g.notes.length) {
153
+ const list = document.createElement("div");
154
+ list.className = "w100n-text-footnotes";
155
+ for (const note of g.notes) {
156
+ const p = document.createElement("p");
157
+ const n = document.createElement("sup");
158
+ n.textContent = note.slice(0, note.indexOf(" "));
159
+ p.append(n, note.slice(note.indexOf(" ")));
160
+ list.append(p);
161
+ }
162
+ el.append(list);
163
+ }
122
164
  return el;
123
- }, { key: `${g.pos}:${g.height}:${g.page}`, side: -1, ignoreSelection: true })));
165
+ }, { key: `${g.pos}:${g.height}:${g.page}:${marks.header}:${marks.footer}:${g.notes.join("\n")}`, side: -1, ignoreSelection: true }))]);
124
166
  view.dispatch(view.state.tr.setMeta(paging, { set }).setMeta("addToHistory", false));
125
167
  };
126
168
  const later = (ms) => {
@@ -132,7 +174,7 @@ var Pager = Extension.create({
132
174
  later(0);
133
175
  return {
134
176
  update: (next, prev) => {
135
- if (paging.getState(next.state).page !== paging.getState(prev).page) later(0);
177
+ if (paging.getState(next.state).page !== paging.getState(prev).page || paging.getState(next.state).marks !== paging.getState(prev).marks) later(0);
136
178
  else if (next.state.doc !== prev.doc) later(400);
137
179
  },
138
180
  destroy: () => {
@@ -175,6 +217,63 @@ var changed = (trs) => {
175
217
  }));
176
218
  return ranges;
177
219
  };
220
+ var Cells = Extension2.create({
221
+ name: "cells",
222
+ addGlobalAttributes: () => [
223
+ { types: ["tableCell", "tableHeader"], attributes: { background: { default: null, parseHTML: (el) => el.dataset.fill ?? null, renderHTML: (attrs2) => attrs2.background ? { "data-fill": attrs2.background, style: `background-color: ${attrs2.background}` } : {} } } },
224
+ { types: ["table"], attributes: { borders: { default: null, parseHTML: (el) => el.dataset.borders ?? null, renderHTML: (attrs2) => attrs2.borders ? { "data-borders": attrs2.borders } : {} } } }
225
+ ]
226
+ });
227
+ var searching = new PluginKey2("w100n-search");
228
+ var lookup = (doc, query, matchCase) => {
229
+ const hits = [];
230
+ if (!query) return hits;
231
+ const needle = matchCase ? query : query.toLowerCase();
232
+ doc.descendants((node, pos) => {
233
+ if (!node.isTextblock) return true;
234
+ let text = "";
235
+ const at = [];
236
+ node.forEach((child, offset) => {
237
+ const part = child.isText ? child.text : "\uFFFC";
238
+ for (let i = 0; i < part.length; i++) at.push(pos + 1 + offset + i);
239
+ text += part;
240
+ });
241
+ const hay = matchCase ? text : text.toLowerCase();
242
+ for (let i = hay.indexOf(needle); i >= 0; i = hay.indexOf(needle, i + needle.length)) hits.push({ from: at[i], to: at[i + needle.length - 1] + 1 });
243
+ return false;
244
+ });
245
+ return hits;
246
+ };
247
+ var Search = Extension2.create({
248
+ name: "search",
249
+ addProseMirrorPlugins: () => [new Plugin2({
250
+ key: searching,
251
+ state: {
252
+ init: () => ({ query: "", matchCase: false, hits: [], at: 0, set: DecorationSet2.empty }),
253
+ apply(tr, value2) {
254
+ const meta = tr.getMeta(searching);
255
+ if (!meta && !tr.docChanged) return value2;
256
+ const next = { ...value2, ...meta };
257
+ const hits = lookup(tr.doc, next.query, next.matchCase);
258
+ const at = hits.length ? (next.at % hits.length + hits.length) % hits.length : 0;
259
+ return { ...next, hits, at, set: DecorationSet2.create(tr.doc, hits.map((h, i) => Decoration2.inline(h.from, h.to, { class: i === at ? "w100n-found is-current" : "w100n-found" }))) };
260
+ }
261
+ },
262
+ props: { decorations: (state) => searching.getState(state).set }
263
+ })]
264
+ });
265
+ var replace = (editor, text, all) => {
266
+ const { hits, at } = searching.getState(editor.state);
267
+ if (!hits.length) return 0;
268
+ const tr = editor.state.tr;
269
+ for (const hit of all ? [...hits].reverse() : [hits[at]]) tr.insertText(text, hit.from, hit.to);
270
+ editor.view.dispatch(tr);
271
+ return all ? hits.length : 1;
272
+ };
273
+ var cleanPaste = (html) => html.replace(/<!--\[if[\s\S]*?<!\[endif\]-->/g, "").replace(/<o:p>[\s\S]*?<\/o:p>/g, "").replace(/\sclass=("|')?Mso[^"'\s>]*\1?/g, "").replace(/<img\b[^>]*\ssrc=("|')file:[^"']*\1[^>]*>/gi, "").replace(/\sstyle=("|')([^"']*)\1/g, (_, q, css) => {
274
+ const kept = css.split(";").map((x) => x.trim()).filter((x) => x && !/^mso-|^tab-stops|^font-family:\s*["']?(Symbol|Wingdings)/i.test(x)).join("; ");
275
+ return kept ? ` style=${q}${kept}${q}` : "";
276
+ });
178
277
  var Blocks = Extension2.create({
179
278
  name: "blocks",
180
279
  addGlobalAttributes: () => [{
@@ -182,6 +281,8 @@ var Blocks = Extension2.create({
182
281
  attributes: {
183
282
  align: { default: null, parseHTML: (el) => el.style.textAlign || null, renderHTML: (attrs2) => attrs2.align ? { style: `text-align: ${attrs2.align}` } : {} },
184
283
  indent: { default: 0, parseHTML: (el) => Number(el.dataset.indent) || 0, renderHTML: (attrs2) => attrs2.indent ? { "data-indent": attrs2.indent, style: `margin-left: ${attrs2.indent * 0.5}in` } : {} },
284
+ line: { default: null, parseHTML: (el) => Number(el.dataset.line) || null, renderHTML: (attrs2) => attrs2.line ? { "data-line": attrs2.line, style: `line-height: ${attrs2.line * 1.15}` } : {} },
285
+ after: { default: null, parseHTML: (el) => el.dataset.after ? Number(el.dataset.after) : null, renderHTML: (attrs2) => attrs2.after === null || attrs2.after === void 0 ? {} : { "data-after": attrs2.after, style: `margin-bottom: ${attrs2.after}pt` } },
185
286
  ref: { default: null, rendered: false, keepOnSplit: false }
186
287
  }
187
288
  }],
@@ -233,6 +334,37 @@ var PageBreak = Node.create({
233
334
  return ["div", { "data-page-break": "", "data-label": this.options.label, class: "w100n-text-break", contenteditable: "false" }];
234
335
  }
235
336
  });
337
+ var Formula = Node.create({
338
+ name: "math",
339
+ group: "inline",
340
+ inline: true,
341
+ atom: true,
342
+ selectable: true,
343
+ addAttributes: () => ({ latex: { default: "", parseHTML: (el) => el.getAttribute("data-math") ?? "" } }),
344
+ parseHTML: () => [{ tag: "span[data-math]" }],
345
+ renderHTML: ({ node }) => ["span", { "data-math": node.attrs.latex, class: "w100n-math" }],
346
+ addNodeView: () => ({ node }) => {
347
+ const dom = document.createElement("span");
348
+ dom.className = "w100n-math";
349
+ dom.dataset.math = node.attrs.latex;
350
+ dom.contentEditable = "false";
351
+ dom.innerHTML = mathml(node.attrs.latex);
352
+ return { dom };
353
+ }
354
+ });
355
+ var Footnote = Node.create({
356
+ name: "footnote",
357
+ group: "inline",
358
+ inline: true,
359
+ atom: true,
360
+ selectable: true,
361
+ addAttributes: () => ({
362
+ id: { default: null, parseHTML: (el) => el.getAttribute("data-note-id") },
363
+ text: { default: "", parseHTML: (el) => el.getAttribute("title") ?? "" }
364
+ }),
365
+ parseHTML: () => [{ tag: "sup[data-footnote]" }],
366
+ renderHTML: ({ node }) => ["sup", { "data-footnote": "", "data-note-id": node.attrs.id ?? void 0, title: node.attrs.text, class: "w100n-fn", contenteditable: "false" }]
367
+ });
236
368
  var headings = (doc, after) => {
237
369
  const found = [];
238
370
  doc.descendants((node, pos) => {
@@ -521,24 +653,41 @@ var Notes = Extension2.create({
521
653
  props: { decorations: (state) => notes.getState(state).set }
522
654
  })]
523
655
  });
656
+ var script = (name, tag, other) => Mark.create({
657
+ name,
658
+ excludes: other,
659
+ parseHTML: () => [{ tag }, { style: `vertical-align=${name === "superscript" ? "super" : "sub"}` }],
660
+ renderHTML: () => [tag, 0],
661
+ addKeyboardShortcuts() {
662
+ return { [name === "superscript" ? "Mod-." : "Mod-,"]: () => this.editor.commands.toggleMark(name) };
663
+ }
664
+ });
524
665
  function kit(kind, t, live) {
525
666
  return [
526
667
  StarterKit.configure({ trailingNode: false, link: { openOnClick: false, autolink: true, defaultProtocol: "https" }, dropcursor: { color: "#8b5cf6", width: 2 }, ...live ? { undoRedo: false } : {} }),
527
668
  TaskList,
528
669
  TaskItem.configure({ nested: true, a11y: { checkboxLabel: (node) => node.textContent || t.tasks } }),
529
- TableKit.configure({ table: { resizable: false } }),
530
- Image.configure({ inline: true, allowBase64: true }),
670
+ TableKit.configure({ table: { resizable: true, cellMinWidth: 32 } }),
671
+ Cells,
672
+ Search,
673
+ Image.extend({
674
+ addAttributes() {
675
+ return { ...this.parent?.(), wrap: { default: null, parseHTML: (el) => el.dataset.wrap ?? null, renderHTML: (attrs2) => attrs2.wrap ? { "data-wrap": attrs2.wrap } : {} } };
676
+ }
677
+ }).configure({ inline: true, allowBase64: true, resize: { enabled: true, directions: ["top-left", "top-right", "bottom-left", "bottom-right"], minWidth: 24, minHeight: 24, alwaysPreserveAspectRatio: true } }),
531
678
  Highlight.configure({ multicolor: true }),
532
679
  TextStyle,
533
680
  Color,
534
681
  FontSize,
535
682
  FontFamily,
683
+ script("superscript", "sup", "subscript"),
684
+ script("subscript", "sub", "superscript"),
536
685
  Blocks,
537
686
  PageBreak.configure({ label: t.pageBreak }),
538
687
  Toc.configure({ relative: kind === "markdown", label: t.toc, empty: t.tocEmpty }),
539
688
  Note,
540
689
  Notes,
541
- ...kind === "docx" ? [Pager, Locks.configure({ label: t.locked }), revision("insertion", "ins"), revision("deletion", "del"), Suggest] : [],
690
+ ...kind === "docx" ? [Formula, Footnote, Pager, Locks.configure({ label: t.locked }), revision("insertion", "ins"), revision("deletion", "del"), Suggest] : [],
542
691
  ...live ? [Collaboration.configure({ document: live.doc }), CollaborationCaret.configure({ provider: live.link, user: live.user })] : []
543
692
  ];
544
693
  }
@@ -551,6 +700,7 @@ var textblocks = (editor, change) => editor.chain().focus().command(({ tr, state
551
700
  return true;
552
701
  }).run();
553
702
  var align = (editor, value2) => textblocks(editor, () => ({ align: value2 === "left" ? null : value2 }));
703
+ var spacing = (editor, change) => textblocks(editor, () => change);
554
704
  var indent = (editor, step) => {
555
705
  const type = editor.isActive("taskItem") ? "taskItem" : editor.isActive("listItem") ? "listItem" : null;
556
706
  if (type) return step > 0 ? editor.chain().focus().sinkListItem(type).run() : editor.chain().focus().liftListItem(type).run();
@@ -2172,7 +2322,7 @@ function equalValue(a, b) {
2172
2322
  if (typeof a === "number" && typeof b === "number") return a === b || Math.abs(a - b) <= 1e-9 * Math.max(1, Math.abs(a), Math.abs(b));
2173
2323
  return a === b;
2174
2324
  }
2175
- function lookup(book, s) {
2325
+ function lookup2(book, s) {
2176
2326
  if (!s) return {};
2177
2327
  return (typeof s === "string" ? book.styles[s] : s) ?? {};
2178
2328
  }
@@ -2330,7 +2480,7 @@ function writeXlsx(original, model) {
2330
2480
  const id = typeof s === "string" ? (bk === cur ? "c" : "b") + s : "";
2331
2481
  const known = id && seen2.get(id);
2332
2482
  if (known) return known;
2333
- const look = norm({ ...defaults, ...lookup(bk, s) });
2483
+ const look = norm({ ...defaults, ...lookup2(bk, s) });
2334
2484
  const made2 = { look, json: JSON.stringify(look) };
2335
2485
  if (id) seen2.set(id, made2);
2336
2486
  return made2;
@@ -2371,8 +2521,8 @@ function writeXlsx(original, model) {
2371
2521
  changed2 = true;
2372
2522
  tag = setAttr(tag, "hidden", hidden ? "1" : null);
2373
2523
  }
2374
- const look = rd.s ? norm({ ...defaults, ...lookup(cur, rd.s) }) : null;
2375
- const was = od.s ? norm({ ...defaults, ...lookup(base.book, od.s) }) : null;
2524
+ const look = rd.s ? norm({ ...defaults, ...lookup2(cur, rd.s) }) : null;
2525
+ const was = od.s ? norm({ ...defaults, ...lookup2(base.book, od.s) }) : null;
2376
2526
  if (!same(look, was)) {
2377
2527
  changed2 = true;
2378
2528
  tag = setAttr(setAttr(tag, "s", look ? String(xfFor(look, xfOf(od.s))) : null), "customFormat", look ? "1" : null);
@@ -2663,7 +2813,7 @@ function cellXml(p, ref, xf, x, f, v) {
2663
2813
  function columns(p, rec, sheet, old, cols, defaults, cur, baseBook, xfFor, xfOf) {
2664
2814
  const now = sheet.columnData ?? {}, was = old.columnData ?? {};
2665
2815
  const count = sheet.columnCount ?? 26;
2666
- const look = (bk, s) => s ? norm({ ...defaults, ...lookup(bk, s) }) : null;
2816
+ const look = (bk, s) => s ? norm({ ...defaults, ...lookup2(bk, s) }) : null;
2667
2817
  let differs = cols.moved;
2668
2818
  for (let c = 0; c < count && !differs; c++) {
2669
2819
  const c0 = cols.from(c);
@@ -3052,6 +3202,11 @@ function applyCells(doc, list, origin) {
3052
3202
 
3053
3203
  // src/sheets/text.ts
3054
3204
  var en = {
3205
+ asCurrency: "Format as euro",
3206
+ asPercent: "Format as percent",
3207
+ fewerDecimals: "Fewer decimal places",
3208
+ moreDecimals: "More decimal places",
3209
+ sum: "Sum",
3055
3210
  tools: "Sheet tools",
3056
3211
  loading: "Opening the sheet",
3057
3212
  failed: "This sheet could not be opened",
@@ -3120,6 +3275,11 @@ var en = {
3120
3275
  }
3121
3276
  };
3122
3277
  var pl = {
3278
+ asCurrency: "Formatuj jako euro",
3279
+ asPercent: "Formatuj jako procent",
3280
+ fewerDecimals: "Mniej miejsc po przecinku",
3281
+ moreDecimals: "Wi\u0119cej miejsc po przecinku",
3282
+ sum: "Suma",
3123
3283
  tools: "Narz\u0119dzia arkusza",
3124
3284
  loading: "Otwieranie arkusza",
3125
3285
  failed: "Nie uda\u0142o si\u0119 otworzy\u0107 tego arkusza",
@@ -3188,6 +3348,11 @@ var pl = {
3188
3348
  }
3189
3349
  };
3190
3350
  var uk = {
3351
+ asCurrency: "\u0424\u043E\u0440\u043C\u0430\u0442 \u0454\u0432\u0440\u043E",
3352
+ asPercent: "\u0424\u043E\u0440\u043C\u0430\u0442 \u0432\u0456\u0434\u0441\u043E\u0442\u043A\u0456\u0432",
3353
+ fewerDecimals: "\u041C\u0435\u043D\u0448\u0435 \u0437\u043D\u0430\u043A\u0456\u0432 \u043F\u0456\u0441\u043B\u044F \u043A\u043E\u043C\u0438",
3354
+ moreDecimals: "\u0411\u0456\u043B\u044C\u0448\u0435 \u0437\u043D\u0430\u043A\u0456\u0432 \u043F\u0456\u0441\u043B\u044F \u043A\u043E\u043C\u0438",
3355
+ sum: "\u0421\u0443\u043C\u0430",
3191
3356
  tools: "\u0406\u043D\u0441\u0442\u0440\u0443\u043C\u0435\u043D\u0442\u0438 \u0442\u0430\u0431\u043B\u0438\u0446\u0456",
3192
3357
  loading: "\u0412\u0456\u0434\u043A\u0440\u0438\u0432\u0430\u0454\u043C\u043E \u0442\u0430\u0431\u043B\u0438\u0446\u044E",
3193
3358
  failed: "\u041D\u0435 \u0432\u0434\u0430\u043B\u043E\u0441\u044F \u0432\u0456\u0434\u043A\u0440\u0438\u0442\u0438 \u0446\u044E \u0442\u0430\u0431\u043B\u0438\u0446\u044E",
@@ -3262,7 +3427,7 @@ var ours = "w100n-collab";
3262
3427
  var schemas = /* @__PURE__ */ new Map();
3263
3428
  var schemaOf = (kind) => schemas.get(kind) ?? schemas.set(kind, getSchema(kit(kind, texts.en))).get(kind);
3264
3429
  var parse2 = async (kind, bytes) => kind === "docx" ? (await readDocx(bytes)).doc : fromMarkdown(new TextDecoder().decode(bytes)).doc;
3265
- var edits = (tr) => tr.changedParentTypes.has(tr.doc.get("default")) || tr.changedParentTypes.has(tr.doc.get("book"));
3430
+ var edits = (tr) => tr.changedParentTypes.has(tr.doc.get("default")) || tr.changedParentTypes.has(tr.doc.get("book")) || tr.changedParentTypes.has(tr.doc.get("setup"));
3266
3431
  var filled = (doc) => doc.getXmlFragment("default").length > 0 || doc.getMap("book").size > 0;
3267
3432
  function seed(doc, kind, bytes, json) {
3268
3433
  if (filled(doc)) return false;
@@ -3310,8 +3475,8 @@ function applyText(doc, kind, changes2, origin) {
3310
3475
  updateYFragment({ transact: (run) => doc.transact(run, origin) }, fragment, step.doc, { mapping: /* @__PURE__ */ new Map(), isOMark: /* @__PURE__ */ new Map() });
3311
3476
  return changes2.length;
3312
3477
  }
3313
- async function write(kind, base, node, load2) {
3314
- if (kind === "docx") return writeDocx(base, node.toJSON(), load2);
3478
+ async function write(kind, base, node, load2, setup) {
3479
+ if (kind === "docx") return writeDocx(base, node.toJSON(), load2, setup);
3315
3480
  const parsed = fromMarkdown(new TextDecoder().decode(base));
3316
3481
  return new TextEncoder().encode(toMarkdown(node, track(parsed, node.type.schema.nodeFromJSON(parsed.doc))).text).buffer;
3317
3482
  }
@@ -3348,7 +3513,7 @@ async function save(doc, kind, base, put, load2, note) {
3348
3513
  };
3349
3514
  doc.on("afterTransaction", watch);
3350
3515
  try {
3351
- const bytes = await write(kind, base, node, load2);
3516
+ const bytes = await write(kind, base, node, load2, doc.getMap("setup").size ? doc.getMap("setup").toJSON() : void 0);
3352
3517
  const changed2 = !same2(bytes, base);
3353
3518
  const id = changed2 ? await put(bytes, note ?? named((texts[who[0].language] ?? texts.en).editedNote, who)) : null;
3354
3519
  const refs = [];
@@ -3398,12 +3563,16 @@ export {
3398
3563
  letter,
3399
3564
  paging,
3400
3565
  notes,
3566
+ searching,
3567
+ replace,
3568
+ cleanPaste,
3401
3569
  entries,
3402
3570
  changes,
3403
3571
  decide,
3404
3572
  suggesting,
3405
3573
  kit,
3406
3574
  align,
3575
+ spacing,
3407
3576
  indent,
3408
3577
  clear,
3409
3578
  locate,
@@ -3444,4 +3613,4 @@ export {
3444
3613
  applyText,
3445
3614
  save
3446
3615
  };
3447
- //# sourceMappingURL=chunk-MRP3EURG.js.map
3616
+ //# sourceMappingURL=chunk-Z7UNJ4ND.js.map