@stll/folio-vue 0.21.0 → 0.21.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.
@@ -22,36 +22,37 @@ import { resolveSectionHeaderFooterRefs as xe } from "@stll/folio-core/layout-en
22
22
  import { LayoutPainter as Se } from "@stll/folio-core/layout-painter";
23
23
  import { LayoutSelectionGate as Ce } from "@stll/folio-core/paged-layout/LayoutSelectionGate";
24
24
  import { fromProseDoc as we } from "@stll/folio-core/prosemirror/conversion/fromProseDoc";
25
- import { ExtensionManager as Te } from "@stll/folio-core/prosemirror/extensions/ExtensionManager";
26
- import { getChangedParagraphIds as Ee, hasStructuralChanges as De, hasUntrackedChanges as Oe, repackWithEditorSectionRemovals as ke } from "@stll/folio-core/prosemirror/extensions/features/ParagraphChangeTrackerExtension";
27
- import { createStarterKit as Ae } from "@stll/folio-core/prosemirror/extensions/StarterKit";
28
- import { createTemplatePreviewValuesPlugin as je } from "@stll/folio-core/prosemirror/plugins/templatePreviewValues";
29
- import { templateSlashMenuPlugin as Me } from "@stll/folio-core/prosemirror/plugins/templateSlashMenu";
30
- import { resolveHeaderFooterContent as Ne } from "@stll/folio-core/utils/headerFooter";
31
- import { findVerticalScrollParent as Pe } from "@stll/folio-core/utils/findVerticalScrollParent";
32
- import { MIN_CELL_WIDTH_TWIPS as b, MIN_ROW_HEIGHT_TWIPS as Fe, TWIPS_PER_PIXEL as x, commitColumnResize as Ie, commitRightEdgeResize as Le, commitRowResize as S, readColumnWidthAt as Re, readColumnWidths as ze, readRowHeight as Be } from "@stll/folio-core/prosemirror/tableResize";
33
- import { extractTrackedChanges as Ve } from "@stll/folio-core/prosemirror/utils/extractTrackedChanges";
34
- import { ZOOM_MAX as He, ZOOM_MIN as C, ZOOM_STEP as w } from "@stll/folio-core/utils/zoom";
25
+ import { createNoteReferenceFollower as Te, withoutUnreferencedNotes as Ee } from "@stll/folio-core/prosemirror/noteReferenceReview";
26
+ import { ExtensionManager as De } from "@stll/folio-core/prosemirror/extensions/ExtensionManager";
27
+ import { getChangedParagraphIds as Oe, hasStructuralChanges as ke, hasUntrackedChanges as Ae, repackWithEditorSectionRemovals as je } from "@stll/folio-core/prosemirror/extensions/features/ParagraphChangeTrackerExtension";
28
+ import { createStarterKit as Me } from "@stll/folio-core/prosemirror/extensions/StarterKit";
29
+ import { createTemplatePreviewValuesPlugin as Ne } from "@stll/folio-core/prosemirror/plugins/templatePreviewValues";
30
+ import { templateSlashMenuPlugin as Pe } from "@stll/folio-core/prosemirror/plugins/templateSlashMenu";
31
+ import { resolveHeaderFooterContent as Fe } from "@stll/folio-core/utils/headerFooter";
32
+ import { findVerticalScrollParent as Ie } from "@stll/folio-core/utils/findVerticalScrollParent";
33
+ import { MIN_CELL_WIDTH_TWIPS as b, MIN_ROW_HEIGHT_TWIPS as Le, TWIPS_PER_PIXEL as x, commitColumnResize as Re, commitRightEdgeResize as ze, commitRowResize as S, readColumnWidthAt as Be, readColumnWidths as Ve, readRowHeight as He } from "@stll/folio-core/prosemirror/tableResize";
34
+ import { extractTrackedChanges as Ue } from "@stll/folio-core/prosemirror/utils/extractTrackedChanges";
35
+ import { ZOOM_MAX as We, ZOOM_MIN as C, ZOOM_STEP as w } from "@stll/folio-core/utils/zoom";
35
36
  //#region src/utils/colorMode.ts
36
- var Ue = "(prefers-color-scheme: dark)";
37
- function We() {
37
+ var Ge = "(prefers-color-scheme: dark)";
38
+ function Ke() {
38
39
  return typeof window < "u" && typeof window.matchMedia == "function";
39
40
  }
40
- function Ge(e, t) {
41
+ function qe(e, t) {
41
42
  return e === "dark" || e === "system" && t;
42
43
  }
43
- function Ke(e) {
44
- if (!We()) return () => {};
45
- let t = window.matchMedia(Ue);
44
+ function Je(e) {
45
+ if (!Ke()) return () => {};
46
+ let t = window.matchMedia(Ge);
46
47
  e(t.matches);
47
48
  let n = (t) => e(t.matches);
48
49
  return t.addEventListener("change", n), () => t.removeEventListener("change", n);
49
50
  }
50
51
  //#endregion
51
52
  //#region src/composables/useColorMode.ts
52
- var T = "light", E = Symbol("folioColorMode"), qe = (t = T) => {
53
+ var T = "light", E = Symbol("folioColorMode"), Ye = (t = T) => {
53
54
  a(E, e(() => c(t)));
54
- }, Je = { install(t, n = T) {
55
+ }, Xe = { install(t, n = T) {
55
56
  t.provide(E, e(() => c(n)));
56
57
  } };
57
58
  function D() {
@@ -59,15 +60,15 @@ function D() {
59
60
  return r(() => {
60
61
  i.value = !0;
61
62
  }), u((e) => {
62
- !i.value || n.value !== "system" || e(Ke((e) => {
63
+ !i.value || n.value !== "system" || e(Je((e) => {
63
64
  a.value = e;
64
65
  }));
65
- }), e(() => Ge(n.value, i.value && a.value));
66
+ }), e(() => qe(n.value, i.value && a.value));
66
67
  }
67
68
  //#endregion
68
69
  //#region src/composables/useDocxEditor.ts
69
- var Ye = 24, Xe = 250, Ze = [], Qe = [];
70
- function $e(e) {
70
+ var Ze = 24, Qe = 250, $e = [], et = [];
71
+ function tt(e) {
71
72
  let t = e?.columnCount ?? 1;
72
73
  if (t <= 1) return;
73
74
  let n = {
@@ -77,7 +78,7 @@ function $e(e) {
77
78
  };
78
79
  return e?.separator !== void 0 && (n.separator = e.separator), n;
79
80
  }
80
- function et(e, t, n, r, i, a) {
81
+ function nt(e, t, n, r, i, a) {
81
82
  if (!e) return;
82
83
  let o = t ? {
83
84
  ...a,
@@ -85,16 +86,16 @@ function et(e, t, n, r, i, a) {
85
86
  } : a, s = t ? n?.getView(t) : null;
86
87
  return s ? ye(s.state.doc, r, i, o) : be(e, r, i, o);
87
88
  }
88
- function tt(e, t, n, r, i) {
89
+ function rt(e, t, n, r, i) {
89
90
  if (!e || e.size === 0) return;
90
91
  let a = /* @__PURE__ */ new Map();
91
92
  for (let [o, s] of e) {
92
- let e = et(s, o, t, n, r, i);
93
+ let e = nt(s, o, t, n, r, i);
93
94
  e && a.set(o, e);
94
95
  }
95
96
  return a.size > 0 ? a : void 0;
96
97
  }
97
- function nt(e, t, n) {
98
+ function it(e, t, n) {
98
99
  let r = /* @__PURE__ */ new Map();
99
100
  if (!n || !n.package.footnotes) return r;
100
101
  let i = /* @__PURE__ */ new Map();
@@ -139,7 +140,7 @@ var O = /* @__PURE__ */ new Set([
139
140
  "white",
140
141
  "yellow"
141
142
  ]);
142
- function rt(e) {
143
+ function at(e) {
143
144
  let t = [], n = (e, r) => {
144
145
  for (let [n, i] of e.marks.entries()) i.type.name === "highlight" && !O.has(String(i.attrs.color)) && t.push(`${r}.marks[${n}]=${JSON.stringify(i.attrs)}`);
145
146
  e.forEach((e, t, i) => {
@@ -149,31 +150,31 @@ function rt(e) {
149
150
  return n(e, "doc"), t.join("; ");
150
151
  }
151
152
  function k(e) {
152
- let { hiddenContainer: t, hiddenHeaderFooterContainer: n, noteEditorContainer: r, pagesContainer: a, readOnly: u = !1, pageGap: p = Ye, pageRenderer: ve, markupView: ye = "all-markup", showMarginGuides: be, marginGuideColor: Pe, password: b, editorMode: Fe, author: x, externalPlugins: Ie = [], historyShortcuts: Le = "editor", collaboration: S, onAnonymizationMatchesChange: Re, showTemplateDirectives: ze, onSlashMenuChange: Be, onSlashMenuKeyAction: Ve, onChange: He, onError: C, onSelectionUpdate: w, onEditorViewReady: Ue, onCopy: We, onCut: Ge, onPaste: Ke, onReadOnlyEditAttempt: T, featureFlags: E, onSelectiveSaveTripwire: qe } = e, Je = n ?? t, D = s(null), O = 0, k = !1, A = 0, j = !1, M = s(null), N = s(null), P = s(null), F = s([]), I = s(null), L = s(null), R = s(null), it = s([]), at = s([]), z = o(!1), B = o(null), V = o(!1), H = new Te(Ae({ historyShortcuts: Le }));
153
+ let { hiddenContainer: t, hiddenHeaderFooterContainer: n, noteEditorContainer: r, pagesContainer: a, readOnly: u = !1, pageGap: p = Ze, pageRenderer: ve, markupView: ye = "all-markup", showMarginGuides: be, marginGuideColor: Ie, password: b, editorMode: Le, author: x, externalPlugins: Re = [], historyShortcuts: ze = "editor", collaboration: S, onAnonymizationMatchesChange: Be, showTemplateDirectives: Ve, onSlashMenuChange: He, onSlashMenuKeyAction: Ue, onChange: We, onError: C, onSelectionUpdate: w, onEditorViewReady: Ge, onCopy: Ke, onCut: qe, onPaste: Je, onReadOnlyEditAttempt: T, featureFlags: E, onSelectiveSaveTripwire: Ye } = e, Xe = n ?? t, D = s(null), O = 0, k = !1, A = 0, j = !1, M = s(null), N = s(null), P = s(null), F = s([]), I = s(null), L = s(null), R = s(null), ot = s([]), st = s([]), z = o(!1), B = o(null), V = o(!1), H = new De(Me({ historyShortcuts: ze }));
153
154
  H.buildSchema(), H.initializeRuntime();
154
- let ot = _(!1), st = [ot], ct = h({ keymap: !0 }), lt = m({ onMatchesChange: (e) => Re?.(e) }), U = g(), ut = Me({
155
- onChange: (e) => Be?.(e),
156
- onKeyAction: (e) => Ve?.(e) ?? !1
157
- }), dt = je(), ft = () => c(ze) === !0;
158
- function pt() {
155
+ let ct = _(!1), lt = [ct], ut = h({ keymap: !0 }), dt = m({ onMatchesChange: (e) => Be?.(e) }), U = g(), ft = Pe({
156
+ onChange: (e) => He?.(e),
157
+ onKeyAction: (e) => Ue?.(e) ?? !1
158
+ }), pt = Ne(), mt = () => c(Ve) === !0;
159
+ function ht() {
159
160
  return [
161
+ ut,
160
162
  ct,
161
- ot,
162
- ...Ie,
163
+ ...Re,
163
164
  ...c(S)?.plugins ?? [],
164
- lt,
165
- ...ft() ? [U, ut] : [],
166
- dt
165
+ dt,
166
+ ...mt() ? [U, ft] : [],
167
+ pt
167
168
  ];
168
169
  }
169
- let W = te(), G = new Ce(), K = ge(), mt = le({
170
+ let W = te(), G = new Ce(), K = ge(), gt = le({
170
171
  relayout: () => {
171
172
  let e = M.value?.state ?? K.lastEditorState;
172
173
  e && Y(e, { reason: "hyphenation-ready" });
173
174
  },
174
175
  onError: (e) => C?.(e)
175
176
  });
176
- i(mt.cancel), i(fe({
177
+ i(gt.cancel), i(fe({
177
178
  measuredFontSet: () => K.lastMeasureInputs?.fontSet ?? null,
178
179
  relayout: () => {
179
180
  if (j) return;
@@ -181,11 +182,11 @@ function k(e) {
181
182
  e && Y(e, { reason: "font-ready" });
182
183
  }
183
184
  }));
184
- let ht = new Se({
185
+ let _t = new Se({
185
186
  pageGap: p,
186
187
  showShadow: !0
187
188
  }), q = re({
188
- getHost: () => Je.value,
189
+ getHost: () => Xe.value,
189
190
  getDocument: () => D.value,
190
191
  getStyles: () => D.value?.package.styles ?? null,
191
192
  getTheme: () => D.value?.package.theme ?? null,
@@ -204,9 +205,9 @@ function k(e) {
204
205
  }
205
206
  G.requestRender();
206
207
  }
207
- }), gt = { current: null }, J = ie({
208
+ }), vt = { current: null }, J = ie({
208
209
  getHost: () => r?.value ?? null,
209
- getPlugins: () => st,
210
+ getPlugins: () => lt,
210
211
  getDocument: () => D.value,
211
212
  getStyles: () => D.value?.package.styles ?? null,
212
213
  getTheme: () => D.value?.package.theme ?? null,
@@ -215,8 +216,8 @@ function k(e) {
215
216
  V.value = !0;
216
217
  let e = D.value;
217
218
  if (e) {
218
- let t = gt.current?.snapshotDocument(e) ?? e;
219
- D.value = t, He?.(t), W.emit("docChange", t);
219
+ let t = vt.current?.snapshotDocument(e) ?? e;
220
+ D.value = t, We?.(t), W.emit("docChange", t);
220
221
  }
221
222
  X.schedule();
222
223
  }
@@ -230,22 +231,22 @@ function k(e) {
230
231
  }
231
232
  }
232
233
  });
233
- gt.current = J;
234
- function _t(e) {
235
- e.layout && (R.value = e.layout), e.blocks && (it.value = e.blocks), e.measures && (at.value = e.measures), e.blockLookup && ht.setBlockLookup(e.blockLookup), e.layout && W.emit("layoutComplete", e.layout);
234
+ vt.current = J;
235
+ function yt(e) {
236
+ e.layout && (R.value = e.layout), e.blocks && (ot.value = e.blocks), e.measures && (st.value = e.measures), e.blockLookup && _t.setBlockLookup(e.blockLookup), e.layout && W.emit("layoutComplete", e.layout);
236
237
  }
237
238
  function Y(e, t = {}) {
238
239
  if (j) return;
239
- let n = a.value, r = n instanceof HTMLDivElement ? n : null, i = D.value, o = i?.package.document, s = o?.sections?.[0]?.properties ?? o?.finalSectionProperties ?? null, l = f(s), u = d(s), m = $e(s), h = l.w - u.left - u.right, g = i?.package.styles ?? null, _ = i?.package.theme ?? null, ee = i?.package.settings?.defaultTabStop, v = i?.package.settings?.mirrorMargins === !0, y = Ne(i?.package);
240
+ let n = a.value, r = n instanceof HTMLDivElement ? n : null, i = D.value, o = i?.package.document, s = o?.sections?.[0]?.properties ?? o?.finalSectionProperties ?? null, l = f(s), u = d(s), m = tt(s), h = l.w - u.left - u.right, g = i?.package.styles ?? null, _ = i?.package.theme ?? null, ee = i?.package.settings?.defaultTabStop, v = i?.package.settings?.mirrorMargins === !0, y = Fe(i?.package);
240
241
  try {
241
- _t(ce({
242
+ yt(ce({
242
243
  contentWidth: h,
243
244
  columns: m,
244
245
  pageSize: l,
245
246
  margins: u,
246
247
  pageGap: p,
247
248
  showMarginGuides: c(be) === !0,
248
- marginGuideColor: c(Pe),
249
+ marginGuideColor: c(Ie),
249
250
  ...(() => {
250
251
  let e = c(ve);
251
252
  return e === void 0 ? {} : { pageRenderer: e };
@@ -268,17 +269,17 @@ function k(e) {
268
269
  styles: g,
269
270
  layout: R.value,
270
271
  hfPMs: q,
271
- painter: ht,
272
+ painter: _t,
272
273
  pagesContainer: r,
273
274
  session: K,
274
- renderHfFromContentOrPm: et,
275
- renderHeaderFooterContentByRId: tt,
275
+ renderHfFromContentOrPm: nt,
276
+ renderHeaderFooterContentByRId: rt,
276
277
  readFontSetSignature: ue,
277
- buildFootnoteRenderItems: nt,
278
- describeInvalidHighlightMarks: rt,
279
- emptyTemplatePreviewEntries: Ze,
280
- emptyTemplatePreviewHidden: Qe,
281
- hyphenationReadiness: mt,
278
+ buildFootnoteRenderItems: it,
279
+ describeInvalidHighlightMarks: at,
280
+ emptyTemplatePreviewEntries: $e,
281
+ emptyTemplatePreviewHidden: et,
282
+ hyphenationReadiness: gt,
282
283
  markupView: c(ye)
283
284
  }, e, t));
284
285
  } catch (e) {
@@ -291,35 +292,35 @@ function k(e) {
291
292
  runLayout: (e, t) => Y(e, t),
292
293
  ...pe,
293
294
  clock: me
294
- }), Z = null;
295
- function vt() {
295
+ }), Z = null, bt = Te();
296
+ function xt() {
296
297
  Z !== null && (window.clearTimeout(Z), Z = null);
297
298
  let e = M.value, t = D.value;
298
299
  if (!(!e || !t)) try {
299
- let n = we(e.state.doc, t);
300
- D.value = n, q.sync(), J.sync(), He?.(n), W.emit("docChange", n);
300
+ let n = bt.reconcile(we(e.state.doc, t), e.state.doc);
301
+ D.value = n, q.sync(), J.sync(), We?.(n), W.emit("docChange", n);
301
302
  } catch (e) {
302
303
  C?.(e instanceof Error ? e : Error(String(e)));
303
304
  }
304
305
  }
305
- function yt() {
306
+ function St() {
306
307
  Z !== null && window.clearTimeout(Z), Z = window.setTimeout(() => {
307
- Z = null, vt();
308
- }, Xe);
308
+ Z = null, xt();
309
+ }, Qe);
309
310
  }
310
311
  let Q = oe({
311
312
  getHost: () => t.value,
312
313
  getDocument: () => D.value,
313
314
  getStyles: () => D.value?.package.styles ?? null,
314
315
  getExtensionManager: () => H,
315
- getExternalPlugins: pt,
316
+ getExternalPlugins: ht,
316
317
  getCollaboration: () => c(S),
317
318
  getCollaborationModules: () => P.value,
318
319
  getPrecomputedInitialState: () => null,
319
320
  getReadOnly: () => c(u),
320
321
  getDocumentIdentity: () => String(O),
321
322
  getDocumentContext: () => D.value,
322
- onTransaction: bt,
323
+ onTransaction: Ct,
323
324
  onSelectionChange: (e) => {
324
325
  N.value = e, w?.(e), W.emit("selectionChange", {
325
326
  from: e.selection.from,
@@ -327,13 +328,13 @@ function k(e) {
327
328
  });
328
329
  },
329
330
  onKeyDown: () => !1,
330
- onCopy: () => We?.(),
331
- onCut: () => Ge?.(),
332
- onPaste: () => Ke?.(),
331
+ onCopy: () => Ke?.(),
332
+ onCut: () => qe?.(),
333
+ onPaste: () => Je?.(),
333
334
  onReadOnlyEditAttempt: () => T?.(),
334
- onEditorViewReady: xt,
335
+ onEditorViewReady: wt,
335
336
  onEditorViewDestroy: () => {
336
- M.value = null, z.value = !1, Ue?.(null);
337
+ M.value = null, z.value = !1, Ge?.(null);
337
338
  },
338
339
  onRemoteSelectionsChange: (e) => {
339
340
  F.value = e;
@@ -368,72 +369,74 @@ function k(e) {
368
369
  e.off("change", $), F.value = [];
369
370
  });
370
371
  }, { flush: "post" });
371
- function bt({ newState: e, docChanged: t }) {
372
- N.value = e, t && (V.value = !0, G.incrementStateSeq(), X.schedule(), yt()), G.requestRender();
372
+ function Ct({ newState: e, docChanged: t, transactions: n }) {
373
+ N.value = e;
374
+ let r = n[0]?.before;
375
+ t && r && bt.noteBase(r), t && (V.value = !0, G.incrementStateSeq(), X.schedule(), St()), G.requestRender();
373
376
  }
374
- function xt(e) {
377
+ function wt(e) {
375
378
  M.value = e, N.value = e.state, z.value = !0;
376
379
  let t = D.value, n = O, r = ++A;
377
380
  j = !0;
378
381
  let i = () => {
379
382
  A === r && (j = !1, !(k || O !== n || Q.getView() !== e) && (Y(e.state, { reason: "initial" }), G.requestRender()));
380
383
  };
381
- de(t, e.state.doc).then(i, i), wt(e), Ue?.(e), c(u) || requestAnimationFrame(() => {
384
+ de(t, e.state.doc).then(i, i), Dt(e), Ge?.(e), c(u) || requestAnimationFrame(() => {
382
385
  M.value === e && e.focus();
383
386
  });
384
387
  }
385
- let St = {
386
- getDocx: async (e) => (await jt(e))?.buffer ?? null,
387
- loadDocument: At,
388
- loadDocx: kt
389
- }, Ct = y({
388
+ let Tt = {
389
+ getDocx: async (e) => (await Pt(e))?.buffer ?? null,
390
+ loadDocument: Nt,
391
+ loadDocx: Mt
392
+ }, Et = y({
390
393
  getEditorApi: () => Q.api,
391
394
  getLayout: () => R.value,
392
395
  runLayout: (e, t) => Y(e, t),
393
- getDocumentIO: () => St,
396
+ getDocumentIO: () => Tt,
394
397
  emitter: W
395
398
  });
396
- function wt(e) {
397
- ee(c(Fe) === "suggesting", e.state, e.dispatch, c(x));
399
+ function Dt(e) {
400
+ ee(c(Le) === "suggesting", e.state, e.dispatch, c(x));
398
401
  }
399
- l([() => c(Fe), () => c(x)], () => {
402
+ l([() => c(Le), () => c(x)], () => {
400
403
  let e = M.value;
401
- e && wt(e);
404
+ e && Dt(e);
402
405
  for (let e of J.listStories()) {
403
406
  let t = J.getView(e);
404
- t && wt(t);
407
+ t && Dt(t);
405
408
  }
406
409
  }), l(() => c(u), (e) => {
407
- Q.syncEditable(), e && Rt();
410
+ Q.syncEditable(), e && Vt();
408
411
  });
409
- function Tt(e) {
410
- let t = ft();
412
+ function Ot(e) {
413
+ let t = mt();
411
414
  if (t === e.state.plugins.includes(U)) return;
412
- let n = e.state.plugins.filter((e) => e !== U && e !== ut);
415
+ let n = e.state.plugins.filter((e) => e !== U && e !== ft);
413
416
  if (t) {
414
- let e = n.indexOf(dt), t = e === -1 ? n.length : e;
415
- n.splice(t, 0, U, ut);
417
+ let e = n.indexOf(pt), t = e === -1 ? n.length : e;
418
+ n.splice(t, 0, U, ft);
416
419
  }
417
420
  e.updateState(e.state.reconfigure({ plugins: n }));
418
421
  }
419
- l(() => ft(), () => {
422
+ l(() => mt(), () => {
420
423
  let e = M.value;
421
- e && Tt(e);
424
+ e && Ot(e);
422
425
  });
423
- function Et() {
426
+ function kt() {
424
427
  Q.ensureView();
425
428
  }
426
- function Dt() {
427
- O += 1, V.value = !1, I.value = null, L.value = null, J.activate(null), X.dispose(), Q.destroyView(), q.sync(), J.sync(), Q.ensureView(), Q.getView() || Ot();
429
+ function At() {
430
+ O += 1, V.value = !1, I.value = null, L.value = null, J.activate(null), X.dispose(), Q.destroyView(), q.sync(), J.sync(), Q.ensureView(), Q.getView() || jt();
428
431
  }
429
- function Ot() {
432
+ function jt() {
430
433
  let e = D.value;
431
434
  if (!(!e || c(S))) try {
432
435
  let t = se({
433
436
  document: e,
434
437
  styles: e.package.styles ?? null,
435
438
  manager: H,
436
- externalPlugins: pt(),
439
+ externalPlugins: ht(),
437
440
  collaborationModules: null,
438
441
  reason: "mount"
439
442
  });
@@ -451,38 +454,39 @@ function k(e) {
451
454
  l([
452
455
  t,
453
456
  a,
454
- Je,
457
+ Xe,
455
458
  ...r ? [r] : []
456
459
  ], () => {
457
- t.value && D.value && !Q.getView() && Et(), q.sync(), J.sync();
460
+ t.value && D.value && !Q.getView() && kt(), q.sync(), J.sync();
458
461
  }, { flush: "post" });
459
- async function kt(e) {
462
+ async function Mt(e) {
460
463
  B.value = null, z.value = !1;
461
464
  try {
462
465
  let t = await _e(e, { password: c(b) });
463
- D.value = t, Dt();
466
+ D.value = t, At();
464
467
  } catch (e) {
465
468
  let t = e instanceof Error ? e : Error(String(e));
466
469
  B.value = t.message, C?.(t);
467
470
  }
468
471
  }
469
- function At(e) {
470
- B.value = null, D.value = e, Dt();
472
+ function Nt(e) {
473
+ B.value = null, D.value = e, bt.reset(), At();
471
474
  }
472
- async function jt(e) {
475
+ async function Pt(e) {
476
+ Z !== null && xt();
473
477
  let t = M.value, n = D.value;
474
478
  if (!t || !n) return null;
475
- let r = J.snapshotDocument(q.snapshotDocument(n)), i = t.state, { resolveSelectiveSaveFlags: a } = await import("@stll/folio-core/docx/selectiveSaveFlags"), o = a(c(E)), s = we(i.doc, r), l = s.originalBuffer ?? null, u = o.selectiveSave && e?.mode !== v.full, d = u || o.selectiveSaveTripwire, { repackDocx: f, createDocx: p } = await import("@stll/folio-core/docx/rezip"), m = null;
479
+ let r = J.snapshotDocument(q.snapshotDocument(n)), i = t.state, { resolveSelectiveSaveFlags: a } = await import("@stll/folio-core/docx/selectiveSaveFlags"), o = a(c(E)), s = Ee(we(i.doc, r)), l = s.originalBuffer ?? null, u = o.selectiveSave && e?.mode !== v.full, d = u || o.selectiveSaveTripwire, { repackDocx: f, createDocx: p } = await import("@stll/folio-core/docx/rezip"), m = null;
476
480
  if (d && l) {
477
481
  let { attemptSelectiveSave: e } = await import("@stll/folio-core/docx/selectiveSave");
478
482
  m = await e(s, l, {
479
- changedParaIds: Ee(i),
480
- structuralChange: De(i),
481
- hasUntrackedChanges: Oe(i),
483
+ changedParaIds: Oe(i),
484
+ structuralChange: ke(i),
485
+ hasUntrackedChanges: Ae(i),
482
486
  maxBytes: o.selectiveSaveMaxBytes
483
487
  });
484
488
  }
485
- let h = u ? m : null, g = null, _ = () => ke({
489
+ let h = u ? m : null, g = null, _ = () => je({
486
490
  state: i,
487
491
  document: s,
488
492
  repack: () => f(s)
@@ -491,65 +495,65 @@ function k(e) {
491
495
  else if (o.selectiveSaveTripwire) try {
492
496
  g = await _();
493
497
  } catch {}
494
- if (o.selectiveSaveTripwire && g && qe) try {
498
+ if (o.selectiveSaveTripwire && g && Ye) try {
495
499
  let { compareSelectiveVsFull: e } = await import("@stll/folio-core/docx/selectiveSaveTripwire");
496
- qe(await e(m, g));
500
+ Ye(await e(m, g));
497
501
  } catch {}
498
502
  return {
499
503
  buffer: h,
500
504
  document: s
501
505
  };
502
506
  }
503
- async function Mt(e) {
504
- let t = await jt({ mode: e?.selective === !1 ? v.full : v.preferSelective });
507
+ async function Ft(e) {
508
+ let t = await Pt({ mode: e?.selective === !1 ? v.full : v.preferSelective });
505
509
  return t ? (D.value = t.document, q.sync(), J.sync(), V.value = !1, new Blob([t.buffer], { type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" })) : null;
506
510
  }
507
- function Nt() {
511
+ function It() {
508
512
  let e = D.value;
509
513
  return e ? J.snapshotDocument(q.snapshotDocument(e)) : null;
510
514
  }
511
- function Pt(e) {
515
+ function Lt(e) {
512
516
  D.value = e, q.sync(), J.sync(), L.value && !J.getView(L.value) && (L.value = null);
513
517
  }
514
- function Ft(e) {
518
+ function Rt(e) {
515
519
  return q.getView(e);
516
520
  }
517
- function It() {
521
+ function zt() {
518
522
  q.sync();
519
523
  }
520
- function Lt(e) {
524
+ function Bt(e) {
521
525
  let t = J.activate(e);
522
- t && (wt(t), L.value = e, requestAnimationFrame(() => t.focus()));
526
+ t && (Dt(t), L.value = e, requestAnimationFrame(() => t.focus()));
523
527
  }
524
- function Rt() {
528
+ function Vt() {
525
529
  J.activate(null), L.value = null;
526
530
  }
527
- function zt() {
531
+ function Ht() {
528
532
  let e = L.value;
529
533
  return e ? J.getView(e) : null;
530
534
  }
531
- function Bt() {
535
+ function Ut() {
532
536
  return H.getCommands();
533
537
  }
534
- function Vt() {
535
- let e = zt();
538
+ function Wt() {
539
+ let e = Ht();
536
540
  e ? e.focus() : M.value?.focus();
537
541
  }
538
- function Ht() {
542
+ function Gt() {
539
543
  let e = M.value;
540
544
  e && Y(e.state, { reason: "manual" });
541
545
  }
542
546
  l([
543
547
  () => c(be),
544
- () => c(Pe),
548
+ () => c(Ie),
545
549
  () => c(ve),
546
550
  () => c(ye)
547
- ], () => Ht());
548
- function Ut() {
551
+ ], () => Gt());
552
+ function Kt() {
549
553
  k = !0, A += 1, j = !1, X.dispose(), Z !== null && (window.clearTimeout(Z), Z = null), Q.destroyView(), F.value = [], q.destroy(), J.destroy(), H.destroy(), N.value = null, R.value = null, D.value = null, z.value = !1;
550
554
  }
551
- return i(Ut), {
552
- editor: Ct,
555
+ return i(Kt), {
556
+ editor: Et,
553
557
  editorView: M,
554
558
  editorState: N,
555
559
  remoteSelections: F,
@@ -559,23 +563,23 @@ function k(e) {
559
563
  isDirty: V,
560
564
  parseError: B,
561
565
  layout: R,
562
- blocks: it,
563
- measures: at,
566
+ blocks: ot,
567
+ measures: st,
564
568
  syncCoordinator: G,
565
- loadBuffer: kt,
566
- loadDocument: At,
567
- save: Mt,
568
- getDocument: Nt,
569
- setDocument: Pt,
570
- getHeaderFooterView: Ft,
571
- syncHeaderFooterViews: It,
572
- openNoteStory: Lt,
573
- closeNoteStory: Rt,
574
- getActiveNoteView: zt,
575
- getCommands: Bt,
576
- focus: Vt,
577
- reLayout: Ht,
578
- destroy: Ut
569
+ loadBuffer: Mt,
570
+ loadDocument: Nt,
571
+ save: Ft,
572
+ getDocument: It,
573
+ setDocument: Lt,
574
+ getHeaderFooterView: Rt,
575
+ syncHeaderFooterViews: zt,
576
+ openNoteStory: Bt,
577
+ closeNoteStory: Vt,
578
+ getActiveNoteView: Ht,
579
+ getCommands: Ut,
580
+ focus: Wt,
581
+ reLayout: Gt,
582
+ destroy: Kt
579
583
  };
580
584
  }
581
585
  function A(e, t) {
@@ -596,7 +600,7 @@ function j({ pagesContainer: e, onScrollExtendSelection: t }) {
596
600
  function c() {
597
601
  if (s) return s;
598
602
  let t = e.value;
599
- return t ? (s = Pe(t), s) : null;
603
+ return t ? (s = Ie(t), s) : null;
600
604
  }
601
605
  function l() {
602
606
  o = !1, n !== null && (cancelAnimationFrame(n), n = null);
@@ -677,7 +681,7 @@ function M() {
677
681
  let e = r.clientY - t.startY, n = parseFloat(t.handle.style.top);
678
682
  t.handle.style.top = `${n + e}px`, t.startY = r.clientY;
679
683
  let i = Math.round(e * x), a = t.origHeight + i;
680
- a >= Fe && (t.origHeight = a);
684
+ a >= Le && (t.origHeight = a);
681
685
  return;
682
686
  }
683
687
  if (n.active && n.handle) {
@@ -690,7 +694,7 @@ function M() {
690
694
  }
691
695
  function s(i) {
692
696
  if (e.active) {
693
- e.active = !1, e.handle?.classList.remove("dragging"), r && Ie(r, {
697
+ e.active = !1, e.handle?.classList.remove("dragging"), r && Re(r, {
694
698
  pmStart: e.tablePmStart,
695
699
  colIdx: e.columnIndex,
696
700
  newLeft: e.origWidths.left,
@@ -706,7 +710,7 @@ function M() {
706
710
  }), t.handle = null;
707
711
  return;
708
712
  }
709
- n.active && (n.active = !1, n.handle?.classList.remove("dragging"), r && Le(r, {
713
+ n.active && (n.active = !1, n.handle?.classList.remove("dragging"), r && ze(r, {
710
714
  pmStart: n.tablePmStart,
711
715
  colIdx: n.columnIndex,
712
716
  newWidth: n.origWidth
@@ -724,11 +728,11 @@ function M() {
724
728
  };
725
729
  }
726
730
  function N(e, t) {
727
- let n = ze(e, t.tablePmStart, t.columnIndex);
731
+ let n = Ve(e, t.tablePmStart, t.columnIndex);
728
732
  n && (t.origWidths = n);
729
733
  }
730
734
  function P(e, t, n) {
731
- let r = Be(e, t.tablePmStart, t.rowIndex);
735
+ let r = He(e, t.tablePmStart, t.rowIndex);
732
736
  if (r != null) {
733
737
  t.origHeight = r;
734
738
  return;
@@ -737,17 +741,17 @@ function P(e, t, n) {
737
741
  t.origHeight = Math.round(a * x);
738
742
  }
739
743
  function F(e, t) {
740
- let n = Re(e, t.tablePmStart, t.columnIndex);
744
+ let n = Be(e, t.tablePmStart, t.columnIndex);
741
745
  n != null && (t.origWidth = n);
742
746
  }
743
747
  //#endregion
744
748
  //#region src/composables/useTrackedChanges.ts
745
749
  function I(t, n) {
746
- return e(() => (n.value, Ve(t.value?.state ?? null)));
750
+ return e(() => (n.value, Ue(t.value?.state ?? null)));
747
751
  }
748
752
  //#endregion
749
753
  //#region src/composables/useZoom.ts
750
- var L = C, R = He, it = [
754
+ var L = C, R = We, ot = [
751
755
  .5,
752
756
  .75,
753
757
  1,
@@ -755,7 +759,7 @@ var L = C, R = He, it = [
755
759
  1.5,
756
760
  2
757
761
  ];
758
- function at(t = 1) {
762
+ function st(t = 1) {
759
763
  let i = o(Math.max(L, Math.min(R, t))), a = e(() => Math.round(i.value * 100)), s = e(() => i.value <= L), c = e(() => i.value >= R);
760
764
  function l(e) {
761
765
  i.value = Math.max(L, Math.min(R, Math.round(e * 100) / 100));
@@ -790,8 +794,8 @@ function at(t = 1) {
790
794
  handleWheel: p,
791
795
  handleKeyDown: m,
792
796
  installShortcuts: h,
793
- ZOOM_PRESETS: it
797
+ ZOOM_PRESETS: ot
794
798
  };
795
799
  }
796
800
  //#endregion
797
- export { j as a, T as c, M as i, qe as l, Ve as n, k as o, I as r, Je as s, at as t, D as u };
801
+ export { j as a, T as c, M as i, Ye as l, Ue as n, k as o, I as r, Xe as s, st as t, D as u };