@stll/folio-vue 0.4.0 → 0.5.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.
@@ -5,28 +5,29 @@ import { createTemplateDirectivesPlugin as f } from "@stll/folio-core/prosemirro
5
5
  import { createSuggestionModePlugin as p, setSuggestionMode as m } from "@stll/folio-core/prosemirror/plugins/suggestionMode";
6
6
  import { createFolioEditor as h } from "@stll/folio-core/controller/folioEditor";
7
7
  import { createFolioEditorEmitter as ee } from "@stll/folio-core/controller/folioEditorEvents";
8
- import { createHiddenEditorManager as g, createHiddenEditorState as te } from "@stll/folio-core/controller/hiddenEditorManager";
9
- import { runLayoutPipeline as ne } from "@stll/folio-core/controller/layoutPipeline";
10
- import { browserClock as re, createLayoutScheduler as ie } from "@stll/folio-core/controller/layoutScheduler";
11
- import { createLayoutSession as ae } from "@stll/folio-core/controller/layoutSession";
12
- import { parseDocx as oe } from "@stll/folio-core/docx/parser";
13
- import { getFootnoteText as _ } from "@stll/folio-core/docx/footnoteParser";
14
- import { convertHeaderFooterPmDocToContent as se, convertHeaderFooterToContent as ce } from "@stll/folio-core/layout-bridge/convert/headerFooterLayout";
15
- import { LayoutPainter as le } from "@stll/folio-core/layout-painter";
16
- import { LayoutSelectionGate as ue } from "@stll/folio-core/paged-layout/LayoutSelectionGate";
17
- import { getTransactionDirtyRange as de } from "@stll/folio-core/paged-layout/transactionDirtyRange";
18
- import { fromProseDoc as v } from "@stll/folio-core/prosemirror/conversion/fromProseDoc";
19
- import { ExtensionManager as fe } from "@stll/folio-core/prosemirror/extensions/ExtensionManager";
20
- import { getChangedParagraphIds as pe, hasStructuralChanges as me, hasUntrackedChanges as he } from "@stll/folio-core/prosemirror/extensions/features/ParagraphChangeTrackerExtension";
21
- import { createStarterKit as ge } from "@stll/folio-core/prosemirror/extensions/StarterKit";
22
- import { createTemplatePreviewValuesPlugin as _e } from "@stll/folio-core/prosemirror/plugins/templatePreviewValues";
23
- import { templateSlashMenuPlugin as ve } from "@stll/folio-core/prosemirror/plugins/templateSlashMenu";
24
- import { findVerticalScrollParent as y } from "@stll/folio-core/utils/findVerticalScrollParent";
25
- import { MIN_CELL_WIDTH_TWIPS as b, MIN_ROW_HEIGHT_TWIPS as ye, TWIPS_PER_PIXEL as x, commitColumnResize as be, commitRightEdgeResize as S, commitRowResize as C, readColumnWidthAt as w, readColumnWidths as T, readRowHeight as xe } from "@stll/folio-core/prosemirror/tableResize";
26
- import { extractTrackedChanges as E } from "@stll/folio-core/prosemirror/utils/extractTrackedChanges";
8
+ import { createHiddenEditorManager as g, createHiddenEditorState as _ } from "@stll/folio-core/controller/hiddenEditorManager";
9
+ import { runLayoutPipeline as te } from "@stll/folio-core/controller/layoutPipeline";
10
+ import { browserClock as v, createLayoutScheduler as ne } from "@stll/folio-core/controller/layoutScheduler";
11
+ import { createLayoutSession as re } from "@stll/folio-core/controller/layoutSession";
12
+ import { parseDocx as ie } from "@stll/folio-core/docx/parser";
13
+ import { getFootnoteText as y } from "@stll/folio-core/docx/footnoteParser";
14
+ import { convertHeaderFooterPmDocToContent as ae, convertHeaderFooterToContent as b } from "@stll/folio-core/layout-bridge/convert/headerFooterLayout";
15
+ import { LayoutPainter as oe } from "@stll/folio-core/layout-painter";
16
+ import { LayoutSelectionGate as se } from "@stll/folio-core/paged-layout/LayoutSelectionGate";
17
+ import { getTransactionDirtyRange as ce } from "@stll/folio-core/paged-layout/transactionDirtyRange";
18
+ import { fromProseDoc as x } from "@stll/folio-core/prosemirror/conversion/fromProseDoc";
19
+ import { ExtensionManager as le } from "@stll/folio-core/prosemirror/extensions/ExtensionManager";
20
+ import { getChangedParagraphIds as ue, hasStructuralChanges as de, hasUntrackedChanges as fe } from "@stll/folio-core/prosemirror/extensions/features/ParagraphChangeTrackerExtension";
21
+ import { createStarterKit as pe } from "@stll/folio-core/prosemirror/extensions/StarterKit";
22
+ import { createTemplatePreviewValuesPlugin as me } from "@stll/folio-core/prosemirror/plugins/templatePreviewValues";
23
+ import { templateSlashMenuPlugin as he } from "@stll/folio-core/prosemirror/plugins/templateSlashMenu";
24
+ import { findVerticalScrollParent as S } from "@stll/folio-core/utils/findVerticalScrollParent";
25
+ import { MIN_CELL_WIDTH_TWIPS as C, MIN_ROW_HEIGHT_TWIPS as w, TWIPS_PER_PIXEL as T, commitColumnResize as E, commitRightEdgeResize as ge, commitRowResize as _e, readColumnWidthAt as ve, readColumnWidths as D, readRowHeight as ye } from "@stll/folio-core/prosemirror/tableResize";
26
+ import { extractTrackedChanges as O } from "@stll/folio-core/prosemirror/utils/extractTrackedChanges";
27
+ import { ZOOM_MAX as k, ZOOM_MIN as A, ZOOM_STEP as j } from "@stll/folio-core/utils/zoom";
27
28
  //#region src/composables/useDocxEditor.ts
28
- var Se = 24, Ce = 32, we = 96, Te = 250, Ee = [];
29
- function De(e) {
29
+ var be = 24, xe = 32, Se = 96, Ce = 250, we = [];
30
+ function Te(e) {
30
31
  let t = e?.columnCount ?? 1;
31
32
  if (t <= 1) return;
32
33
  let n = {
@@ -36,32 +37,32 @@ function De(e) {
36
37
  };
37
38
  return e?.separator !== void 0 && (n.separator = e.separator), n;
38
39
  }
39
- function D(e) {
40
+ function M(e) {
40
41
  let t = {};
41
42
  e.titlePg !== void 0 && (t.titlePg = e.titlePg);
42
43
  for (let n of e.headerReferences ?? []) n.type === "default" ? t.headerDefault = n.rId : n.type === "first" ? t.headerFirst = n.rId : t.headerEven = n.rId;
43
44
  for (let n of e.footerReferences ?? []) n.type === "default" ? t.footerDefault = n.rId : n.type === "first" ? t.footerFirst = n.rId : t.footerEven = n.rId;
44
45
  return t;
45
46
  }
46
- function Oe(e) {
47
+ function Ee(e) {
47
48
  let t = e?.package.document;
48
49
  if (!t) return;
49
50
  let n = t.sections;
50
- if (n && n.length > 0) return n.map((e) => D(e.properties));
51
+ if (n && n.length > 0) return n.map((e) => M(e.properties));
51
52
  let r = t.finalSectionProperties;
52
- if (r) return [D(r)];
53
+ if (r) return [M(r)];
53
54
  }
54
- var O = {
55
+ var N = {
55
56
  hf: null,
56
57
  rId: null
57
58
  };
58
- function ke(e, t) {
59
+ function De(e, t) {
59
60
  let n = e?.package;
60
61
  if (!n || !t) return {
61
- header: O,
62
- footer: O,
63
- firstHeader: O,
64
- firstFooter: O
62
+ header: N,
63
+ footer: N,
64
+ firstHeader: N,
65
+ firstFooter: N
65
66
  };
66
67
  let r = n.headers, i = n.footers, a = (e) => e ? r?.get(e) ?? null : null, o = (e) => e ? i?.get(e) ?? null : null, s = null, c = null;
67
68
  for (let e of t.headerReferences ?? []) e.type === "default" ? s = e.rId : e.type === "first" && (c = e.rId);
@@ -86,24 +87,24 @@ function ke(e, t) {
86
87
  }
87
88
  };
88
89
  }
89
- function k(e, t, n, r, i, a) {
90
+ function Oe(e, t, n, r, i, a) {
90
91
  if (!e) return;
91
92
  let o = t ? {
92
93
  ...a,
93
94
  rId: t
94
95
  } : a, s = t ? n?.getView(t) : null;
95
- return s ? se(s.state.doc, r, i, o) : ce(e, r, i, o);
96
+ return s ? ae(s.state.doc, r, i, o) : b(e, r, i, o);
96
97
  }
97
- function Ae(e, t, n, r, i) {
98
+ function ke(e, t, n, r, i) {
98
99
  if (!e || e.size === 0) return;
99
100
  let a = /* @__PURE__ */ new Map();
100
101
  for (let [o, s] of e) {
101
- let e = k(s, o, t, n, r, i);
102
+ let e = Oe(s, o, t, n, r, i);
102
103
  e && a.set(o, e);
103
104
  }
104
105
  return a.size > 0 ? a : void 0;
105
106
  }
106
- function je(e, t, n) {
107
+ function Ae(e, t, n) {
107
108
  let r = /* @__PURE__ */ new Map();
108
109
  if (!n || !n.package.footnotes) return r;
109
110
  let i = /* @__PURE__ */ new Map();
@@ -116,7 +117,7 @@ function je(e, t, n) {
116
117
  let a = t.get(n), o = a?.displayNumber ?? 0;
117
118
  e.push({
118
119
  displayNumber: String(o),
119
- text: _(r),
120
+ text: y(r),
120
121
  ...a ? { content: {
121
122
  blocks: a.blocks,
122
123
  measures: a.measures,
@@ -128,7 +129,7 @@ function je(e, t, n) {
128
129
  }
129
130
  return r;
130
131
  }
131
- var A = new Set([
132
+ var P = /* @__PURE__ */ new Set([
132
133
  "black",
133
134
  "blue",
134
135
  "cyan",
@@ -147,212 +148,214 @@ var A = new Set([
147
148
  "white",
148
149
  "yellow"
149
150
  ]);
150
- function Me(e) {
151
+ function je(e) {
151
152
  let t = [], n = (e, r) => {
152
- for (let [n, i] of e.marks.entries()) i.type.name === "highlight" && !A.has(String(i.attrs.color)) && t.push(`${r}.marks[${n}]=${JSON.stringify(i.attrs)}`);
153
+ for (let [n, i] of e.marks.entries()) i.type.name === "highlight" && !P.has(String(i.attrs.color)) && t.push(`${r}.marks[${n}]=${JSON.stringify(i.attrs)}`);
153
154
  e.forEach((e, t, i) => {
154
155
  n(e, `${r}.content[${i}]`);
155
156
  });
156
157
  };
157
158
  return n(e, "doc"), t.join("; ");
158
159
  }
159
- function Ne() {
160
- return typeof document > "u" || !("fonts" in document) ? !0 : document.fonts.status === "loaded";
160
+ function Me() {
161
+ return typeof document > "u" || !("fonts" in document) || document.fonts.status === "loaded";
161
162
  }
162
- function j(e) {
163
- let { hiddenContainer: t, pagesContainer: n, readOnly: u = !1, pageGap: _ = Se, documentKey: se, password: ce, editorMode: y, author: b, externalPlugins: ye = [], onAnonymizationMatchesChange: x, showTemplateDirectives: be, onSlashMenuChange: S, onSlashMenuKeyAction: C, onChange: w, onError: T, onSelectionUpdate: xe, onEditorViewReady: E, onReadOnlyEditAttempt: D, featureFlags: O, onSelectiveSaveTripwire: A } = e, j = a(null), M = a(null), N = a(null), P = a(null), F = a([]), I = a([]), L = i(!1), R = i(null), z = i(!1), B = new fe(ge());
164
- B.buildSchema(), B.initializeRuntime();
165
- let V = p(!1), H = d({ onMatchesChange: (e) => x?.(e) }), U = f(), W = ve({
166
- onChange: (e) => S?.(e),
167
- onKeyAction: (e) => C?.(e) ?? !1
168
- }), G = _e(), K = () => o(be) === !0;
169
- function q() {
163
+ function F(e) {
164
+ let { hiddenContainer: t, pagesContainer: n, readOnly: u = !1, pageGap: y = be, documentKey: ae, password: b, editorMode: S, author: C, externalPlugins: w = [], onAnonymizationMatchesChange: T, showTemplateDirectives: E, onSlashMenuChange: ge, onSlashMenuKeyAction: _e, onChange: ve, onError: D, onSelectionUpdate: ye, onEditorViewReady: O, onReadOnlyEditAttempt: k, featureFlags: A, onSelectiveSaveTripwire: j } = e, M = a(null), N = a(null), P = a(null), F = a(null), I = a([]), L = a([]), R = i(!1), z = i(null), B = i(!1), V = new le(pe());
165
+ V.buildSchema(), V.initializeRuntime();
166
+ let H = p(!1), U = d({ onMatchesChange: (e) => T?.(e) }), W = f(), G = he({
167
+ onChange: (e) => ge?.(e),
168
+ onKeyAction: (e) => _e?.(e) ?? !1
169
+ }), K = me(), q = () => o(E) === !0;
170
+ function Ne() {
170
171
  return [
171
- V,
172
- ...ye,
173
172
  H,
174
- ...K() ? [U, W] : [],
175
- G
173
+ ...w,
174
+ U,
175
+ ...q() ? [W, G] : [],
176
+ K
176
177
  ];
177
178
  }
178
- let J = ee(), Y = new ue(), Pe = ae(), Fe = new le({
179
- pageGap: _,
179
+ let J = ee(), Y = new se(), Pe = re(), Fe = new oe({
180
+ pageGap: y,
180
181
  showShadow: !0
181
182
  });
182
183
  function Ie(e) {
183
- e.layout && (P.value = e.layout), e.blocks && (F.value = e.blocks), e.measures && (I.value = e.measures), e.blockLookup && Fe.setBlockLookup(e.blockLookup), e.layout && J.emit("layoutComplete", e.layout);
184
+ e.layout && (F.value = e.layout), e.blocks && (I.value = e.blocks), e.measures && (L.value = e.measures), e.blockLookup && Fe.setBlockLookup(e.blockLookup), e.layout && J.emit("layoutComplete", e.layout);
184
185
  }
185
186
  function X(e, t = {}) {
186
- let r = n.value, i = r instanceof HTMLDivElement ? r : null, a = j.value, o = a?.package.document, s = o?.sections?.[0]?.properties ?? o?.finalSectionProperties ?? null, u = l(s), d = c(s), f = De(s), p = u.w - d.left - d.right, m = a?.package.styles ?? null, h = a?.package.theme ?? null, ee = a?.package.settings?.defaultTabStop, g = ke(a, s);
187
+ let r = n.value, i = r instanceof HTMLDivElement ? r : null, a = M.value, o = a?.package.document, s = o?.sections?.[0]?.properties ?? o?.finalSectionProperties ?? null, u = l(s), d = c(s), f = Te(s), p = u.w - d.left - d.right, m = a?.package.styles ?? null, h = a?.package.theme ?? null, ee = a?.package.settings?.defaultTabStop, g = a?.package.settings, _ = g !== void 0 && "mirrorMargins" in g && g.mirrorMargins === !0, v = De(a, s);
187
188
  try {
188
- Ie(ne({
189
+ Ie(te({
189
190
  contentWidth: p,
190
191
  columns: f,
191
192
  pageSize: u,
192
193
  margins: d,
193
- pageGap: _,
194
+ pageGap: y,
194
195
  syncCoordinator: Y,
195
- headerContent: g.header.hf,
196
- footerContent: g.footer.hf,
197
- firstPageHeaderContent: g.firstHeader.hf,
198
- firstPageFooterContent: g.firstFooter.hf,
199
- headerContentRId: g.header.rId,
200
- footerContentRId: g.footer.rId,
201
- firstPageHeaderContentRId: g.firstHeader.rId,
202
- firstPageFooterContentRId: g.firstFooter.rId,
203
- sectionHeaderFooterRefs: Oe(a),
196
+ headerContent: v.header.hf,
197
+ footerContent: v.footer.hf,
198
+ firstPageHeaderContent: v.firstHeader.hf,
199
+ firstPageFooterContent: v.firstFooter.hf,
200
+ headerContentRId: v.header.rId,
201
+ footerContentRId: v.footer.rId,
202
+ firstPageHeaderContentRId: v.firstHeader.rId,
203
+ firstPageFooterContentRId: v.firstFooter.rId,
204
+ sectionHeaderFooterRefs: Ee(a),
204
205
  theme: h,
205
206
  sectionProperties: s,
206
207
  document: a,
207
208
  defaultTabStop: ee,
209
+ mirrorMargins: _,
208
210
  styles: m,
209
- layout: P.value,
211
+ layout: F.value,
210
212
  hfPMs: null,
211
213
  painter: Fe,
212
214
  pagesContainer: i,
213
215
  session: Pe,
214
- renderHfFromContentOrPm: k,
215
- renderHeaderFooterContentByRId: Ae,
216
- documentFontsAreLoaded: Ne,
217
- buildFootnoteRenderItems: je,
218
- describeInvalidHighlightMarks: Me,
219
- emptyTemplatePreviewEntries: Ee
216
+ renderHfFromContentOrPm: Oe,
217
+ renderHeaderFooterContentByRId: ke,
218
+ documentFontsAreLoaded: Me,
219
+ buildFootnoteRenderItems: Ae,
220
+ describeInvalidHighlightMarks: je,
221
+ emptyTemplatePreviewEntries: we
220
222
  }, e, t));
221
223
  } catch (e) {
222
224
  let t = e instanceof Error ? e : Error(String(e));
223
- T?.(t);
225
+ D?.(t);
224
226
  }
225
227
  }
226
- let Z = ie({
228
+ let Z = ne({
227
229
  runLayout: (e, t) => X(e, t),
228
- debounceMs: Ce,
229
- maxDelayMs: we,
230
- clock: re
230
+ debounceMs: xe,
231
+ maxDelayMs: Se,
232
+ clock: v
231
233
  }), Q = null;
232
234
  function Le() {
233
235
  Q !== null && (window.clearTimeout(Q), Q = null);
234
- let e = M.value, t = j.value;
236
+ let e = N.value, t = M.value;
235
237
  if (!(!e || !t)) try {
236
- let n = v(e.state.doc, t);
237
- j.value = n, w?.(n), J.emit("docChange", n);
238
+ let n = x(e.state.doc, t);
239
+ M.value = n, ve?.(n), J.emit("docChange", n);
238
240
  } catch (e) {
239
- T?.(e instanceof Error ? e : Error(String(e)));
241
+ D?.(e instanceof Error ? e : Error(String(e)));
240
242
  }
241
243
  }
242
244
  function Re() {
243
245
  Q !== null && window.clearTimeout(Q), Q = window.setTimeout(() => {
244
246
  Q = null, Le();
245
- }, Te);
247
+ }, Ce);
246
248
  }
247
249
  let $ = g({
248
250
  getHost: () => t.value,
249
- getDocument: () => j.value,
250
- getStyles: () => j.value?.package.styles ?? null,
251
- getExtensionManager: () => B,
252
- getExternalPlugins: q,
251
+ getDocument: () => M.value,
252
+ getStyles: () => M.value?.package.styles ?? null,
253
+ getExtensionManager: () => V,
254
+ getExternalPlugins: Ne,
253
255
  getCollaboration: () => void 0,
254
256
  getCollaborationModules: () => null,
255
257
  getPrecomputedInitialState: () => null,
256
258
  getReadOnly: () => o(u),
257
- getDocumentKey: () => o(se),
258
- getDocumentContext: () => j.value,
259
+ getDocumentKey: () => o(ae),
260
+ getDocumentContext: () => M.value,
259
261
  onTransaction: ze,
260
262
  onSelectionChange: (e) => {
261
- N.value = e, xe?.(e), J.emit("selectionChange", {
263
+ P.value = e, ye?.(e), J.emit("selectionChange", {
262
264
  from: e.selection.from,
263
265
  to: e.selection.to
264
266
  });
265
267
  },
266
268
  onKeyDown: () => !1,
267
- onReadOnlyEditAttempt: () => D?.(),
269
+ onReadOnlyEditAttempt: () => k?.(),
268
270
  onEditorViewReady: Be,
269
271
  onEditorViewDestroy: () => {
270
- M.value = null, L.value = !1, E?.(null);
272
+ N.value = null, R.value = !1, O?.(null);
271
273
  },
272
274
  onRemoteSelectionsChange: () => {}
273
275
  });
274
276
  function ze(e, t) {
275
- N.value = t, e.docChanged && (z.value = !0, Y.incrementStateSeq(), Z.schedule(t, de(e)), Re()), Y.requestRender();
277
+ P.value = t, e.docChanged && (B.value = !0, Y.incrementStateSeq(), Z.schedule(t, ce(e)), Re()), Y.requestRender();
276
278
  }
277
279
  function Be(e) {
278
- M.value = e, N.value = e.state, L.value = !0, X(e.state, { reason: "initial" }), Y.requestRender(), He(e), E?.(e), o(u) || requestAnimationFrame(() => {
279
- M.value === e && e.focus();
280
+ N.value = e, P.value = e.state, R.value = !0, X(e.state, { reason: "initial" }), Y.requestRender(), He(e), O?.(e), o(u) || requestAnimationFrame(() => {
281
+ N.value === e && e.focus();
280
282
  });
281
283
  }
282
284
  let Ve = h({
283
285
  getEditorApi: () => $.api,
284
- getLayout: () => P.value,
286
+ getLayout: () => F.value,
285
287
  runLayout: (e, t) => X(e, t),
286
288
  emitter: J
287
289
  });
288
290
  function He(e) {
289
- m(o(y) === "suggesting", e.state, e.dispatch, o(b));
291
+ m(o(S) === "suggesting", e.state, e.dispatch, o(C));
290
292
  }
291
- s([() => o(y), () => o(b)], () => {
292
- let e = M.value;
293
+ s([() => o(S), () => o(C)], () => {
294
+ let e = N.value;
293
295
  e && He(e);
294
296
  }), s(() => o(u), () => $.syncEditable());
295
297
  function Ue(e) {
296
- let t = K();
297
- if (t === e.state.plugins.includes(U)) return;
298
- let n = e.state.plugins.filter((e) => e !== U && e !== W);
298
+ let t = q();
299
+ if (t === e.state.plugins.includes(W)) return;
300
+ let n = e.state.plugins.filter((e) => e !== W && e !== G);
299
301
  if (t) {
300
- let e = n.indexOf(G), t = e === -1 ? n.length : e;
301
- n.splice(t, 0, U, W);
302
+ let e = n.indexOf(K), t = e === -1 ? n.length : e;
303
+ n.splice(t, 0, W, G);
302
304
  }
303
305
  e.updateState(e.state.reconfigure({ plugins: n }));
304
306
  }
305
- s(() => K(), () => {
306
- let e = M.value;
307
+ s(() => q(), () => {
308
+ let e = N.value;
307
309
  e && Ue(e);
308
310
  });
309
311
  function We() {
310
312
  $.ensureView();
311
313
  }
312
314
  function Ge() {
313
- z.value = !1, Z.dispose(), $.destroyView(), $.ensureView(), $.getView() || Ke();
315
+ B.value = !1, Z.dispose(), $.destroyView(), $.ensureView(), $.getView() || Ke();
314
316
  }
315
317
  function Ke() {
316
- let e = j.value;
318
+ let e = M.value;
317
319
  if (e) try {
318
- let t = te({
320
+ let t = _({
319
321
  document: e,
320
322
  styles: e.package.styles ?? null,
321
- manager: B,
322
- externalPlugins: q(),
323
+ manager: V,
324
+ externalPlugins: Ne(),
323
325
  collaborationModules: null,
324
326
  reason: "mount"
325
327
  });
326
- N.value = t, X(t, { reason: "initial" });
328
+ P.value = t, X(t, { reason: "initial" });
327
329
  } catch (e) {
328
- T?.(e instanceof Error ? e : Error(String(e)));
330
+ D?.(e instanceof Error ? e : Error(String(e)));
329
331
  }
330
332
  }
331
333
  s([t, n], () => {
332
- t.value && j.value && !$.getView() && We();
334
+ t.value && M.value && !$.getView() && We();
333
335
  }, { flush: "post" });
334
336
  async function qe(e) {
335
- R.value = null, L.value = !1;
337
+ z.value = null, R.value = !1;
336
338
  try {
337
- j.value = await oe(e, { password: o(ce) }), Ge();
339
+ let t = await ie(e, { password: o(b) });
340
+ M.value = t, Ge();
338
341
  } catch (e) {
339
342
  let t = e instanceof Error ? e : Error(String(e));
340
- R.value = t.message, T?.(t);
343
+ z.value = t.message, D?.(t);
341
344
  }
342
345
  }
343
346
  function Je(e) {
344
- R.value = null, j.value = e, Ge();
347
+ z.value = null, M.value = e, Ge();
345
348
  }
346
349
  async function Ye(e) {
347
- let t = M.value, n = j.value;
350
+ let t = N.value, n = M.value;
348
351
  if (!t || !n) return null;
349
- let r = t.state, { resolveSelectiveSaveFlags: i } = await import("@stll/folio-core/docx/selectiveSaveFlags"), a = i(o(O)), s = v(r.doc, n), c = s.originalBuffer ?? null, l = a.selectiveSave && e?.selective !== !1, u = l || a.selectiveSaveTripwire, { repackDocx: d, createDocx: f } = await import("@stll/folio-core/docx/rezip"), p = null;
352
+ let r = t.state, { resolveSelectiveSaveFlags: i } = await import("@stll/folio-core/docx/selectiveSaveFlags"), a = i(o(A)), s = x(r.doc, n), c = s.originalBuffer ?? null, l = a.selectiveSave && e?.selective !== !1, u = l || a.selectiveSaveTripwire, { repackDocx: d, createDocx: f } = await import("@stll/folio-core/docx/rezip"), p = null;
350
353
  if (u && c) {
351
354
  let { attemptSelectiveSave: e } = await import("@stll/folio-core/docx/selectiveSave");
352
355
  p = await e(s, c, {
353
- changedParaIds: pe(r),
354
- structuralChange: me(r),
355
- hasUntrackedChanges: he(r),
356
+ changedParaIds: ue(r),
357
+ structuralChange: de(r),
358
+ hasUntrackedChanges: fe(r),
356
359
  maxBytes: a.selectiveSaveMaxBytes
357
360
  });
358
361
  }
@@ -361,41 +364,41 @@ function j(e) {
361
364
  else if (a.selectiveSaveTripwire) try {
362
365
  h = await d(s);
363
366
  } catch {}
364
- if (a.selectiveSaveTripwire && h && A) try {
367
+ if (a.selectiveSaveTripwire && h && j) try {
365
368
  let { compareSelectiveVsFull: e } = await import("@stll/folio-core/docx/selectiveSaveTripwire");
366
- A(await e(p, h));
369
+ j(await e(p, h));
367
370
  } catch {}
368
- return z.value = !1, new Blob([m], { type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" });
371
+ return B.value = !1, new Blob([m], { type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" });
369
372
  }
370
373
  function Xe() {
371
- return j.value;
374
+ return M.value;
372
375
  }
373
376
  function Ze(e) {
374
- j.value = e;
377
+ M.value = e;
375
378
  }
376
379
  function Qe() {
377
- return B.getCommands();
380
+ return V.getCommands();
378
381
  }
379
382
  function $e() {
380
- M.value?.focus();
383
+ N.value?.focus();
381
384
  }
382
385
  function et() {
383
- let e = M.value;
386
+ let e = N.value;
384
387
  e && X(e.state, { reason: "manual" });
385
388
  }
386
389
  function tt() {
387
- Z.dispose(), Q !== null && (window.clearTimeout(Q), Q = null), $.destroyView(), B.destroy(), N.value = null, P.value = null, j.value = null, L.value = !1;
390
+ Z.dispose(), Q !== null && (window.clearTimeout(Q), Q = null), $.destroyView(), V.destroy(), P.value = null, F.value = null, M.value = null, R.value = !1;
388
391
  }
389
392
  return r(tt), {
390
393
  editor: Ve,
391
- editorView: M,
392
- editorState: N,
393
- isReady: L,
394
- isDirty: z,
395
- parseError: R,
396
- layout: P,
397
- blocks: F,
398
- measures: I,
394
+ editorView: N,
395
+ editorState: P,
396
+ isReady: R,
397
+ isDirty: B,
398
+ parseError: z,
399
+ layout: F,
400
+ blocks: I,
401
+ measures: L,
399
402
  loadBuffer: qe,
400
403
  loadDocument: Je,
401
404
  save: Ye,
@@ -407,7 +410,7 @@ function j(e) {
407
410
  destroy: tt
408
411
  };
409
412
  }
410
- function M(e, t) {
413
+ function I(e, t) {
411
414
  if (t < e.top + 40) {
412
415
  let n = Math.max(0, e.top + 40 - t);
413
416
  return -Math.min(12, n / 40 * 12);
@@ -420,12 +423,12 @@ function M(e, t) {
420
423
  }
421
424
  //#endregion
422
425
  //#region src/composables/useDragAutoScroll.ts
423
- function N({ pagesContainer: e, onScrollExtendSelection: t }) {
426
+ function L({ pagesContainer: e, onScrollExtendSelection: t }) {
424
427
  let n = null, i = 0, a = 0, o = !1, s = null;
425
428
  function c() {
426
429
  if (s) return s;
427
430
  let t = e.value;
428
- return t ? (s = y(t), s) : null;
431
+ return t ? (s = S(t), s) : null;
429
432
  }
430
433
  function l() {
431
434
  o = !1, n !== null && (cancelAnimationFrame(n), n = null);
@@ -434,7 +437,7 @@ function N({ pagesContainer: e, onScrollExtendSelection: t }) {
434
437
  if (!o) return;
435
438
  let e = c();
436
439
  if (!e) return;
437
- let r = M(e.getBoundingClientRect(), a);
440
+ let r = I(e.getBoundingClientRect(), a);
438
441
  r !== 0 && (e.scrollTop += r, t(i, a)), n = requestAnimationFrame(u);
439
442
  }
440
443
  function d() {
@@ -455,7 +458,7 @@ function N({ pagesContainer: e, onScrollExtendSelection: t }) {
455
458
  }
456
459
  //#endregion
457
460
  //#region src/composables/useTableResize.ts
458
- function P() {
461
+ function R() {
459
462
  let e = {
460
463
  active: !1,
461
464
  startX: 0,
@@ -487,15 +490,15 @@ function P() {
487
490
  }
488
491
  function a(i, a) {
489
492
  let o = i.target;
490
- return o instanceof HTMLElement ? o.classList.contains("layout-table-resize-handle") ? (i.preventDefault(), i.stopPropagation(), r = a, e.active = !0, e.startX = i.clientX, e.handle = o, o.classList.add("dragging"), e.columnIndex = parseInt(o.dataset.columnIndex ?? "0", 10), e.tablePmStart = parseInt(o.dataset.tablePmStart ?? "0", 10), F(a, e), !0) : o.classList.contains("layout-table-row-resize-handle") || o.classList.contains("layout-table-edge-handle-bottom") ? (i.preventDefault(), i.stopPropagation(), r = a, t.active = !0, t.startY = i.clientY, t.handle = o, t.isEdge = o.dataset.isEdge === "bottom", o.classList.add("dragging"), t.rowIndex = parseInt(o.dataset.rowIndex ?? "0", 10), t.tablePmStart = parseInt(o.dataset.tablePmStart ?? "0", 10), I(a, t, o), !0) : o.classList.contains("layout-table-edge-handle-right") ? (i.preventDefault(), i.stopPropagation(), r = a, n.active = !0, n.startX = i.clientX, n.handle = o, o.classList.add("dragging"), n.columnIndex = parseInt(o.dataset.columnIndex ?? "0", 10), n.tablePmStart = parseInt(o.dataset.tablePmStart ?? "0", 10), L(a, n), !0) : !1 : !1;
493
+ return o instanceof HTMLElement ? o.classList.contains("layout-table-resize-handle") ? (i.preventDefault(), i.stopPropagation(), r = a, e.active = !0, e.startX = i.clientX, e.handle = o, o.classList.add("dragging"), e.columnIndex = parseInt(o.dataset.columnIndex ?? "0", 10), e.tablePmStart = parseInt(o.dataset.tablePmStart ?? "0", 10), z(a, e), !0) : o.classList.contains("layout-table-row-resize-handle") || o.classList.contains("layout-table-edge-handle-bottom") ? (i.preventDefault(), i.stopPropagation(), r = a, t.active = !0, t.startY = i.clientY, t.handle = o, t.isEdge = o.dataset.isEdge === "bottom", o.classList.add("dragging"), t.rowIndex = parseInt(o.dataset.rowIndex ?? "0", 10), t.tablePmStart = parseInt(o.dataset.tablePmStart ?? "0", 10), B(a, t, o), !0) : o.classList.contains("layout-table-edge-handle-right") ? (i.preventDefault(), i.stopPropagation(), r = a, n.active = !0, n.startX = i.clientX, n.handle = o, o.classList.add("dragging"), n.columnIndex = parseInt(o.dataset.columnIndex ?? "0", 10), n.tablePmStart = parseInt(o.dataset.tablePmStart ?? "0", 10), V(a, n), !0) : !1 : !1;
491
494
  }
492
495
  function o(r) {
493
496
  if (e.active && e.handle) {
494
497
  r.preventDefault();
495
498
  let t = r.clientX - e.startX, n = parseFloat(e.handle.style.left);
496
499
  e.handle.style.left = `${n + t}px`, e.startX = r.clientX;
497
- let i = Math.round(t * x), a = e.origWidths.left + i, o = e.origWidths.right - i;
498
- a >= b && o >= b && (e.origWidths = {
500
+ let i = Math.round(t * T), a = e.origWidths.left + i, o = e.origWidths.right - i;
501
+ a >= C && o >= C && (e.origWidths = {
499
502
  left: a,
500
503
  right: o
501
504
  });
@@ -505,21 +508,21 @@ function P() {
505
508
  r.preventDefault();
506
509
  let e = r.clientY - t.startY, n = parseFloat(t.handle.style.top);
507
510
  t.handle.style.top = `${n + e}px`, t.startY = r.clientY;
508
- let i = Math.round(e * x), a = t.origHeight + i;
509
- a >= ye && (t.origHeight = a);
511
+ let i = Math.round(e * T), a = t.origHeight + i;
512
+ a >= w && (t.origHeight = a);
510
513
  return;
511
514
  }
512
515
  if (n.active && n.handle) {
513
516
  r.preventDefault();
514
517
  let e = r.clientX - n.startX, t = parseFloat(n.handle.style.left);
515
518
  n.handle.style.left = `${t + e}px`, n.startX = r.clientX;
516
- let i = Math.round(e * x), a = n.origWidth + i;
517
- a >= b && (n.origWidth = a);
519
+ let i = Math.round(e * T), a = n.origWidth + i;
520
+ a >= C && (n.origWidth = a);
518
521
  }
519
522
  }
520
523
  function s(i) {
521
524
  if (e.active) {
522
- e.active = !1, e.handle?.classList.remove("dragging"), r && be(r, {
525
+ e.active = !1, e.handle?.classList.remove("dragging"), r && E(r, {
523
526
  pmStart: e.tablePmStart,
524
527
  colIdx: e.columnIndex,
525
528
  newLeft: e.origWidths.left,
@@ -528,14 +531,14 @@ function P() {
528
531
  return;
529
532
  }
530
533
  if (t.active) {
531
- t.active = !1, t.handle?.classList.remove("dragging"), r && C(r, {
534
+ t.active = !1, t.handle?.classList.remove("dragging"), r && _e(r, {
532
535
  pmStart: t.tablePmStart,
533
536
  rowIdx: t.rowIndex,
534
537
  newHeight: t.origHeight
535
538
  }), t.handle = null;
536
539
  return;
537
540
  }
538
- n.active && (n.active = !1, n.handle?.classList.remove("dragging"), r && S(r, {
541
+ n.active && (n.active = !1, n.handle?.classList.remove("dragging"), r && ge(r, {
539
542
  pmStart: n.tablePmStart,
540
543
  colIdx: n.columnIndex,
541
544
  newWidth: n.origWidth
@@ -552,31 +555,31 @@ function P() {
552
555
  isResizing: i
553
556
  };
554
557
  }
555
- function F(e, t) {
556
- let n = T(e, t.tablePmStart, t.columnIndex);
558
+ function z(e, t) {
559
+ let n = D(e, t.tablePmStart, t.columnIndex);
557
560
  n && (t.origWidths = n);
558
561
  }
559
- function I(e, t, n) {
560
- let r = xe(e, t.tablePmStart, t.rowIndex);
562
+ function B(e, t, n) {
563
+ let r = ye(e, t.tablePmStart, t.rowIndex);
561
564
  if (r != null) {
562
565
  t.origHeight = r;
563
566
  return;
564
567
  }
565
568
  let i = n.closest(".layout-table")?.querySelector(`[data-row-index="${t.rowIndex}"]`), a = i ? i.getBoundingClientRect().height : 30;
566
- t.origHeight = Math.round(a * x);
569
+ t.origHeight = Math.round(a * T);
567
570
  }
568
- function L(e, t) {
569
- let n = w(e, t.tablePmStart, t.columnIndex);
571
+ function V(e, t) {
572
+ let n = ve(e, t.tablePmStart, t.columnIndex);
570
573
  n != null && (t.origWidth = n);
571
574
  }
572
575
  //#endregion
573
576
  //#region src/composables/useTrackedChanges.ts
574
- function R(t, n) {
575
- return e(() => (n.value, E(t.value?.state ?? null)));
577
+ function H(t, n) {
578
+ return e(() => (n.value, O(t.value?.state ?? null)));
576
579
  }
577
580
  //#endregion
578
581
  //#region src/composables/useZoom.ts
579
- var z = .5, B = 2, V = .1, H = [
582
+ var U = A, W = k, G = [
580
583
  .5,
581
584
  .75,
582
585
  1,
@@ -584,16 +587,16 @@ var z = .5, B = 2, V = .1, H = [
584
587
  1.5,
585
588
  2
586
589
  ];
587
- function U(r = 1) {
588
- let a = i(Math.max(z, Math.min(B, r))), o = e(() => Math.round(a.value * 100)), s = e(() => a.value <= z), c = e(() => a.value >= B);
590
+ function K(r = 1) {
591
+ let a = i(Math.max(U, Math.min(W, r))), o = e(() => Math.round(a.value * 100)), s = e(() => a.value <= U), c = e(() => a.value >= W);
589
592
  function l(e) {
590
- a.value = Math.max(z, Math.min(B, Math.round(e * 100) / 100));
593
+ a.value = Math.max(U, Math.min(W, Math.round(e * 100) / 100));
591
594
  }
592
595
  function u() {
593
- l(a.value + V);
596
+ l(a.value + j);
594
597
  }
595
598
  function d() {
596
- l(a.value - V);
599
+ l(a.value - j);
597
600
  }
598
601
  function f() {
599
602
  l(1);
@@ -619,8 +622,8 @@ function U(r = 1) {
619
622
  handleWheel: p,
620
623
  handleKeyDown: m,
621
624
  installShortcuts: h,
622
- ZOOM_PRESETS: H
625
+ ZOOM_PRESETS: G
623
626
  };
624
627
  }
625
628
  //#endregion
626
- export { N as a, P as i, E as n, j as o, R as r, U as t };
629
+ export { L as a, R as i, O as n, F as o, H as r, K as t };