@stll/folio-vue 0.23.0 → 0.24.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.
@@ -34,40 +34,40 @@ import { createStarterKit as We } from "@stll/folio-core/prosemirror/extensions/
34
34
  import { createTemplatePreviewValuesPlugin as Ge } from "@stll/folio-core/prosemirror/plugins/templatePreviewValues";
35
35
  import { templateSlashMenuPlugin as Ke } from "@stll/folio-core/prosemirror/plugins/templateSlashMenu";
36
36
  import { resolveHeaderFooterContent as qe } from "@stll/folio-core/utils/headerFooter";
37
- import { MIN_CELL_WIDTH_TWIPS as v, MIN_ROW_HEIGHT_TWIPS as y, TWIPS_PER_PIXEL as b, commitColumnResize as Je, commitRightEdgeResize as Ye, commitRowResize as x, readColumnWidthAt as Xe, readColumnWidths as Ze, readRowHeight as Qe } from "@stll/folio-core/prosemirror/tableResize";
38
- import { extractTrackedChanges as $e } from "@stll/folio-core/prosemirror/utils/extractTrackedChanges";
39
- import { ZOOM_MAX as et, ZOOM_MIN as S, ZOOM_STEP as C } from "@stll/folio-core/utils/zoom";
37
+ import { MIN_CELL_WIDTH_TWIPS as Je, MIN_ROW_HEIGHT_TWIPS as v, TWIPS_PER_PIXEL as y, commitColumnResize as Ye, commitRightEdgeResize as Xe, commitRowResize as b, readColumnWidthAt as Ze, readColumnWidths as Qe, readRowHeight as $e } from "@stll/folio-core/prosemirror/tableResize";
38
+ import { extractTrackedChanges as et } from "@stll/folio-core/prosemirror/utils/extractTrackedChanges";
39
+ import { ZOOM_MAX as tt, ZOOM_MIN as x, ZOOM_STEP as S } from "@stll/folio-core/utils/zoom";
40
40
  //#region src/utils/colorMode.ts
41
- var tt = "(prefers-color-scheme: dark)";
42
- function nt() {
41
+ var nt = "(prefers-color-scheme: dark)";
42
+ function rt() {
43
43
  return typeof window < "u" && typeof window.matchMedia == "function";
44
44
  }
45
- function rt(e, t) {
45
+ function it(e, t) {
46
46
  return e === "dark" || e === "system" && t;
47
47
  }
48
- function it(e) {
49
- if (!nt()) return () => {};
50
- let t = window.matchMedia(tt);
48
+ function at(e) {
49
+ if (!rt()) return () => {};
50
+ let t = window.matchMedia(nt);
51
51
  e(t.matches);
52
52
  let n = (t) => e(t.matches);
53
53
  return t.addEventListener("change", n), () => t.removeEventListener("change", n);
54
54
  }
55
55
  //#endregion
56
56
  //#region src/composables/useColorMode.ts
57
- var w = "light", T = Symbol("folioColorMode"), at = (t = w) => {
58
- a(T, e(() => c(t)));
59
- }, ot = { install(t, n = w) {
60
- t.provide(T, e(() => c(n)));
57
+ var C = "light", w = Symbol("folioColorMode"), T = (t = C) => {
58
+ a(w, e(() => c(t)));
59
+ }, ot = { install(t, n = C) {
60
+ t.provide(w, e(() => c(n)));
61
61
  } };
62
62
  function E() {
63
- let n = t(T, e(() => w)), i = o(!1), a = o(!1);
63
+ let n = t(w, e(() => C)), i = o(!1), a = o(!1);
64
64
  return r(() => {
65
65
  i.value = !0;
66
66
  }), u((e) => {
67
- !i.value || n.value !== "system" || e(it((e) => {
67
+ !i.value || n.value !== "system" || e(at((e) => {
68
68
  a.value = e;
69
69
  }));
70
- }), e(() => rt(n.value, i.value && a.value));
70
+ }), e(() => it(n.value, i.value && a.value));
71
71
  }
72
72
  //#endregion
73
73
  //#region src/composables/useDocxEditor.ts
@@ -154,55 +154,55 @@ function gt(e) {
154
154
  return n(e, "doc"), t.join("; ");
155
155
  }
156
156
  function O(e) {
157
- let { hiddenContainer: t, hiddenHeaderFooterContainer: n, noteEditorContainer: r, pagesContainer: a, readOnly: u = !1, experimentalSession: _, pageGap: se = st, pageRenderer: ce, markupView: me = "all-markup", showMarginGuides: je, marginGuideColor: Me, password: v, editorMode: y, author: b, externalPlugins: Je = [], historyShortcuts: Ye = "editor", collaboration: x, onAnonymizationMatchesChange: Xe, showTemplateDirectives: Ze, onSlashMenuChange: Qe, onSlashMenuKeyAction: $e, onChange: et, onError: S, onSelectionUpdate: C, onEditorViewReady: tt, onCopy: nt, onCut: rt, onPaste: it, onReadOnlyEditAttempt: w, featureFlags: T, onSelectiveSaveTripwire: at } = e, ot = n ?? t, E = () => c(b) ?? ct, D = s(null), O = 0, _t = !1, k = 0, A = !1, j = s(null), M = s(null), N = s(null), P = s([]), F = s(null), I = s(null), L = s(null), vt = s([]), yt = s([]), R = o(!1), z = o(null), B = o(!1), V = () => ee(c(_), d.authorityRouting), H = (e) => V() ? ie(e) : e, bt = (e, t) => {
157
+ let { hiddenContainer: t, hiddenHeaderFooterContainer: n, noteEditorContainer: r, pagesContainer: a, readOnly: u = !1, experimentalSession: _, pageGap: se = st, pageRenderer: ce, markupView: me = "all-markup", showMarginGuides: je, marginGuideColor: Me, password: Je, editorMode: v, author: y, externalPlugins: Ye = [], historyShortcuts: Xe = "editor", collaboration: b, onAnonymizationMatchesChange: Ze, showTemplateDirectives: Qe, onSlashMenuChange: $e, onSlashMenuKeyAction: et, onChange: tt, onError: x, onSelectionUpdate: S, onEditorViewReady: nt, onCopy: rt, onCut: it, onPaste: at, onReadOnlyEditAttempt: C, featureFlags: w, onSelectiveSaveTripwire: T } = e, ot = n ?? t, E = () => c(y) ?? ct, D = s(null), O = 0, _t = !1, k = 0, A = !1, j = s(null), M = s(null), N = s(null), P = s([]), F = s(null), I = s(null), L = s(null), vt = s([]), yt = s([]), R = o(!1), z = o(null), B = o(!1), V = () => ee(c(_), d.authorityRouting), H = (e) => V() ? ie(e) : e, bt = (e, t) => {
158
158
  if (!V()) return !1;
159
159
  let n = new g({
160
160
  gap: e,
161
161
  message: f(e, t)
162
162
  });
163
- return S?.(n), !0;
164
- }, U = new ze(We({ historyShortcuts: Ye }));
163
+ return x?.(n), !0;
164
+ }, U = new ze(We({ historyShortcuts: Xe }));
165
165
  U.buildSchema(), U.initializeRuntime();
166
- let xt = fe(!1), St = [xt], Ct = ue({ keymap: !0 }), wt = le({ onMatchesChange: (e) => Xe?.(e) }), Tt = de(), Et = Ke({
167
- onChange: (e) => Qe?.(e),
168
- onKeyAction: (e) => $e?.(e) ?? !1
169
- }), Dt = Ge(), Ot = () => c(Ze) === !0;
166
+ let xt = fe(!1), St = [xt], Ct = ue({ keymap: !0 }), wt = le({ onMatchesChange: (e) => Ze?.(e) }), Tt = de(), Et = Ke({
167
+ onChange: (e) => $e?.(e),
168
+ onKeyAction: (e) => et?.(e) ?? !1
169
+ }), Dt = Ge(), Ot = () => c(Qe) === !0;
170
170
  function kt() {
171
171
  return [
172
172
  Ct,
173
173
  xt,
174
- ...Je,
175
- ...c(x)?.plugins ?? [],
174
+ ...Ye,
175
+ ...c(b)?.plugins ?? [],
176
176
  wt,
177
177
  ...Ot() ? [Tt, Et] : [],
178
178
  Dt
179
179
  ];
180
180
  }
181
- let W = _e(), G = new Fe(), At = ke(), jt = Te({
181
+ let W = _e(), G = new Fe(), K = ke(), At = Te({
182
182
  relayout: () => {
183
- let e = j.value?.state ?? At.lastEditorState;
184
- e && Y(e, { reason: "hyphenation-ready" });
183
+ let e = j.value?.state ?? K.lastEditorState;
184
+ e && X(e, { reason: "hyphenation-ready" });
185
185
  },
186
- onError: (e) => S?.(e)
186
+ onError: (e) => x?.(e)
187
187
  });
188
- i(jt.cancel), i(Oe({
189
- measuredFontSet: () => At.lastMeasureInputs?.fontSet ?? null,
188
+ i(At.cancel), i(Oe({
189
+ measuredFontSet: () => K.lastMeasureInputs?.fontSet ?? null,
190
190
  relayout: () => {
191
191
  if (A) return;
192
- let e = j.value?.state ?? At.lastEditorState;
193
- e && Y(e, { reason: "font-ready" });
192
+ let e = j.value?.state ?? K.lastEditorState;
193
+ e && X(e, { reason: "font-ready" });
194
194
  }
195
195
  }));
196
- let Mt = new Pe({
196
+ let jt = new Pe({
197
197
  pageGap: se,
198
198
  showShadow: !0
199
- }), K = Se({
199
+ }), q = Se({
200
200
  getHost: () => ot.value,
201
- getDocument: () => Q.api.getCanonicalDocument() ?? D.value,
202
- getCanonicalApi: () => Q.api,
201
+ getDocument: () => $.api.getCanonicalDocument() ?? D.value,
202
+ getCanonicalApi: () => $.api,
203
203
  getExperimentalSession: () => c(_),
204
204
  onSessionRefusal: (e, t, n) => {
205
- z.value = e, S?.(n ?? new g({
205
+ z.value = e, x?.(n ?? new g({
206
206
  gap: t,
207
207
  message: e
208
208
  }));
@@ -210,28 +210,28 @@ function O(e) {
210
210
  getStyles: () => D.value?.package.styles ?? null,
211
211
  getTheme: () => D.value?.package.theme ?? null,
212
212
  onTransaction: ({ rId: e, kind: t, view: n, docChanged: r, selectionChanged: i }) => {
213
- if (r && (B.value = !0, X.schedule()), r || i) {
213
+ if (r && (B.value = !0, Z.schedule()), r || i) {
214
214
  let { from: r, to: i } = n.state.selection;
215
215
  F.value = {
216
216
  from: r,
217
217
  kind: t,
218
218
  rId: e,
219
219
  to: i
220
- }, C?.(n.state), W.emit("selectionChange", {
220
+ }, S?.(n.state), W.emit("selectionChange", {
221
221
  from: r,
222
222
  to: i
223
223
  });
224
224
  }
225
225
  G.requestRender();
226
226
  }
227
- }), Nt = { current: null }, q = Ce({
227
+ }), Mt = { current: null }, J = Ce({
228
228
  getHost: () => r?.value ?? null,
229
229
  getPlugins: () => St,
230
- getDocument: () => Q.api.getCanonicalDocument() ?? D.value,
231
- getCanonicalApi: () => Q.api,
230
+ getDocument: () => $.api.getCanonicalDocument() ?? D.value,
231
+ getCanonicalApi: () => $.api,
232
232
  getExperimentalSession: () => c(_),
233
233
  onSessionRefusal: (e, t, n) => {
234
- z.value = e, S?.(n ?? new g({
234
+ z.value = e, x?.(n ?? new g({
235
235
  gap: t,
236
236
  message: e
237
237
  }));
@@ -243,13 +243,13 @@ function O(e) {
243
243
  B.value = !0;
244
244
  let e = D.value;
245
245
  if (e) {
246
- let t = Q.api.getCanonicalDocument() ?? Nt.current?.snapshotDocument(e) ?? e;
247
- D.value = t, et?.(H(t)), W.emit("docChange", H(t));
246
+ let t = $.api.getCanonicalDocument() ?? Mt.current?.snapshotDocument(e) ?? e;
247
+ D.value = t, tt?.(H(t)), W.emit("docChange", H(t));
248
248
  }
249
- X.schedule();
249
+ Z.schedule();
250
250
  }
251
251
  if (e || t) {
252
- C?.(n.state);
252
+ S?.(n.state);
253
253
  let { from: e, to: t } = n.state.selection;
254
254
  W.emit("selectionChange", {
255
255
  from: e,
@@ -258,19 +258,19 @@ function O(e) {
258
258
  }
259
259
  }
260
260
  });
261
- Nt.current = q;
262
- let J = () => {
263
- K.sync(), q.sync();
261
+ Mt.current = J;
262
+ let Y = () => {
263
+ q.sync(), J.sync();
264
264
  };
265
- l(() => c(_), J);
266
- function Pt(e) {
267
- e.layout && (L.value = e.layout), e.blocks && (vt.value = e.blocks), e.measures && (yt.value = e.measures), e.blockLookup && Mt.setBlockLookup(e.blockLookup), e.layout && W.emit("layoutComplete", e.layout);
265
+ l(() => c(_), Y);
266
+ function Nt(e) {
267
+ e.layout && (L.value = e.layout), e.blocks && (vt.value = e.blocks), e.measures && (yt.value = e.measures), e.blockLookup && jt.setBlockLookup(e.blockLookup), e.layout && W.emit("layoutComplete", e.layout);
268
268
  }
269
- function Y(e, t = {}) {
269
+ function X(e, t = {}) {
270
270
  if (A) return;
271
271
  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 = oe(s), u = ae(s), d = ft(s), f = l.w - u.left - u.right, ee = i?.package.styles ?? null, p = i?.package.theme ?? null, m = i?.package.settings?.defaultTabStop, h = i?.package.settings?.mirrorMargins === !0, g = qe(i?.package);
272
272
  try {
273
- Pt(we({
273
+ Nt(we({
274
274
  contentWidth: f,
275
275
  columns: d,
276
276
  pageSize: l,
@@ -299,10 +299,10 @@ function O(e) {
299
299
  mirrorMargins: h,
300
300
  styles: ee,
301
301
  layout: L.value,
302
- hfPMs: K,
303
- painter: Mt,
302
+ hfPMs: q,
303
+ painter: jt,
304
304
  pagesContainer: r,
305
- session: At,
305
+ session: K,
306
306
  renderHfFromContentOrPm: pt,
307
307
  renderHeaderFooterContentByRId: mt,
308
308
  readFontSetSignature: Ee,
@@ -310,96 +310,96 @@ function O(e) {
310
310
  describeInvalidHighlightMarks: gt,
311
311
  emptyTemplatePreviewEntries: ut,
312
312
  emptyTemplatePreviewHidden: dt,
313
- hyphenationReadiness: jt,
313
+ hyphenationReadiness: At,
314
314
  markupView: c(me)
315
315
  }, e, t));
316
316
  } catch (e) {
317
317
  let t = e instanceof Error ? e : Error(String(e));
318
- S?.(t);
318
+ x?.(t);
319
319
  }
320
320
  }
321
- let X = h({
321
+ let Z = h({
322
322
  readState: () => j.value?.state ?? null,
323
- runLayout: (e, t) => Y(e, t),
323
+ runLayout: (e, t) => X(e, t),
324
324
  ...p,
325
325
  clock: m
326
- }), Z = null, Ft = Le();
327
- function It() {
328
- Z !== null && (window.clearTimeout(Z), Z = null);
326
+ }), Q = null, Pt = Le();
327
+ function Ft() {
328
+ Q !== null && (window.clearTimeout(Q), Q = null);
329
329
  let e = j.value, t = D.value;
330
330
  if (!(!e || !t)) try {
331
- let n = Q.api.getCanonicalDocument();
331
+ let n = $.api.getCanonicalDocument();
332
332
  if (!n && V()) return;
333
- let r = n ?? Ft.reconcile(Ie(e.state.doc, t, { stylesheetSource: { type: "package" } }), e.state.doc);
334
- D.value = r, J(), et?.(H(r)), W.emit("docChange", H(r));
333
+ let r = n ?? Pt.reconcile(Ie(e.state.doc, t, { stylesheetSource: { type: "package" } }), e.state.doc);
334
+ D.value = r, Y(), tt?.(H(r)), W.emit("docChange", H(r));
335
335
  } catch (e) {
336
- S?.(e instanceof Error ? e : Error(String(e)));
336
+ x?.(e instanceof Error ? e : Error(String(e)));
337
337
  }
338
338
  }
339
- function Lt() {
340
- Z !== null && window.clearTimeout(Z), Z = window.setTimeout(() => {
341
- Z = null, It();
339
+ function It() {
340
+ Q !== null && window.clearTimeout(Q), Q = window.setTimeout(() => {
341
+ Q = null, Ft();
342
342
  }, lt);
343
343
  }
344
- let Q = ne({
344
+ let $ = ne({
345
345
  getHost: () => t.value,
346
346
  getDocument: () => D.value,
347
347
  getStyles: () => D.value?.package.styles ?? null,
348
348
  getExtensionManager: () => U,
349
349
  getExternalPlugins: kt,
350
- getCollaboration: () => c(x),
350
+ getCollaboration: () => c(b),
351
351
  getCollaborationModules: () => N.value,
352
352
  getPrecomputedInitialState: () => null,
353
353
  getReadOnly: () => c(u),
354
354
  getExperimentalSession: () => c(_),
355
- getEditingMode: () => c(y) ?? "editing",
355
+ getEditingMode: () => c(v) ?? "editing",
356
356
  getSuggestionAuthor: E,
357
357
  onSessionRefusal: (e, t, n) => {
358
- S?.(n ?? new g({
358
+ x?.(n ?? new g({
359
359
  gap: t,
360
360
  message: e
361
361
  }));
362
362
  },
363
363
  getDocumentIdentity: () => String(O),
364
364
  getDocumentContext: () => D.value,
365
- onTransaction: zt,
365
+ onTransaction: Rt,
366
366
  onSelectionChange: (e) => {
367
- M.value = e, C?.(e), W.emit("selectionChange", {
367
+ M.value = e, S?.(e), W.emit("selectionChange", {
368
368
  from: e.selection.from,
369
369
  to: e.selection.to
370
370
  });
371
371
  },
372
372
  onKeyDown: () => !1,
373
- onCopy: () => nt?.(),
374
- onCut: () => rt?.(),
375
- onPaste: () => it?.(),
376
- onReadOnlyEditAttempt: () => w?.(),
377
- onEditorViewReady: Bt,
373
+ onCopy: () => rt?.(),
374
+ onCut: () => it?.(),
375
+ onPaste: () => at?.(),
376
+ onReadOnlyEditAttempt: () => C?.(),
377
+ onEditorViewReady: zt,
378
378
  onEditorViewDestroy: () => {
379
- j.value = null, R.value = !1, tt?.(null);
379
+ j.value = null, R.value = !1, nt?.(null);
380
380
  },
381
381
  onRemoteSelectionsChange: (e) => {
382
382
  P.value = e;
383
383
  }
384
- }), Rt = () => {
385
- let e = c(x)?.awareness, t = N.value, n = Q.getView();
384
+ }), Lt = () => {
385
+ let e = c(b)?.awareness, t = N.value, n = $.getView();
386
386
  P.value = e && t && n ? te(n.state, e, t) : [];
387
387
  };
388
- l(() => c(x), (e, t, n) => {
388
+ l(() => c(b), (e, t, n) => {
389
389
  if (P.value = [], !e) {
390
- N.value = null, Q.retryViewCreation(), Q.syncExternalDocument();
390
+ N.value = null, $.retryViewCreation(), $.syncExternalDocument();
391
391
  return;
392
392
  }
393
393
  let r = !1;
394
394
  n(() => {
395
395
  r = !0;
396
396
  }), N.value = null, xe().then((e) => {
397
- r || (N.value = e, Q.retryViewCreation(), Q.syncExternalDocument(), Rt());
397
+ r || (N.value = e, $.retryViewCreation(), $.syncExternalDocument(), Lt());
398
398
  }, (e) => {
399
- r || (N.value = null, S?.(e instanceof Error ? e : Error(String(e))));
399
+ r || (N.value = null, x?.(e instanceof Error ? e : Error(String(e))));
400
400
  });
401
401
  }, { immediate: !0 }), l(() => ({
402
- awareness: c(x)?.awareness,
402
+ awareness: c(b)?.awareness,
403
403
  modules: N.value,
404
404
  view: j.value
405
405
  }), ({ awareness: e, modules: t, view: n }, r, i) => {
@@ -407,57 +407,57 @@ function O(e) {
407
407
  P.value = [];
408
408
  return;
409
409
  }
410
- e.on("change", Rt), Rt(), i(() => {
411
- e.off("change", Rt), P.value = [];
410
+ e.on("change", Lt), Lt(), i(() => {
411
+ e.off("change", Lt), P.value = [];
412
412
  });
413
413
  }, { flush: "post" });
414
- function zt({ newState: e, docChanged: t, transactions: n }) {
414
+ function Rt({ newState: e, docChanged: t, transactions: n }) {
415
415
  M.value = e;
416
416
  let r = n[0]?.before;
417
- if (t && r && Ft.noteBase(r), t) {
418
- let e = Q.api.getCanonicalDocument();
419
- e && (D.value = e, J()), B.value = !0, G.incrementStateSeq(), X.schedule(), Lt();
417
+ if (t && r && Pt.noteBase(r), t) {
418
+ let e = $.api.getCanonicalDocument();
419
+ e && (D.value = e, Y()), B.value = !0, G.incrementStateSeq(), Z.schedule(), It();
420
420
  }
421
421
  G.requestRender();
422
422
  }
423
- function Bt(e) {
423
+ function zt(e) {
424
424
  j.value = e, M.value = e.state, R.value = !0;
425
425
  let t = D.value, n = O, r = ++k;
426
426
  A = !0;
427
427
  let i = () => {
428
- k === r && (A = !1, !(_t || O !== n || Q.getView() !== e) && (Y(e.state, { reason: "initial" }), G.requestRender()));
428
+ k === r && (A = !1, !(_t || O !== n || $.getView() !== e) && (X(e.state, { reason: "initial" }), G.requestRender()));
429
429
  };
430
- De(t, e.state.doc).then(i, i), $(e), tt?.(e), c(u) || requestAnimationFrame(() => {
430
+ De(t, e.state.doc).then(i, i), Ht(e), nt?.(e), c(u) || requestAnimationFrame(() => {
431
431
  j.value === e && e.focus();
432
432
  });
433
433
  }
434
- let Vt = {
434
+ let Bt = {
435
435
  getDocx: async (e) => (await Yt(e))?.buffer ?? null,
436
436
  loadDocument: Jt,
437
437
  loadDocx: qt
438
- }, Ht = ge({
439
- getEditorApi: () => Q.api,
438
+ }, Vt = ge({
439
+ getEditorApi: () => $.api,
440
440
  getLayout: () => L.value,
441
- runLayout: (e, t) => Y(e, t),
442
- getDocumentIO: () => Vt,
441
+ runLayout: (e, t) => X(e, t),
442
+ getDocumentIO: () => Bt,
443
443
  emitter: W
444
444
  });
445
- function $(e) {
446
- pe(c(y) === "suggesting", e.state, e.dispatch, E());
445
+ function Ht(e) {
446
+ pe(c(v) === "suggesting", e.state, e.dispatch, E());
447
447
  }
448
- l([() => c(y), E], () => {
449
- Ht.setCanonicalMode(c(y) === "suggesting" ? {
448
+ l([() => c(v), E], () => {
449
+ Vt.setCanonicalMode(c(v) === "suggesting" ? {
450
450
  type: "suggesting",
451
451
  author: E()
452
452
  } : { type: "editing" });
453
453
  let e = j.value;
454
- e && $(e);
455
- for (let e of q.listStories()) {
456
- let t = q.getView(e);
457
- t && $(t);
454
+ e && Ht(e);
455
+ for (let e of J.listStories()) {
456
+ let t = J.getView(e);
457
+ t && Ht(t);
458
458
  }
459
459
  }), l(() => c(u), (e) => {
460
- Q.syncEditable(), e && nn();
460
+ $.syncEditable(), e && nn();
461
461
  });
462
462
  function Ut(e) {
463
463
  let t = Ot();
@@ -474,14 +474,14 @@ function O(e) {
474
474
  e && Ut(e);
475
475
  });
476
476
  function Wt() {
477
- Q.ensureView();
477
+ $.ensureView();
478
478
  }
479
479
  function Gt() {
480
- O += 1, B.value = !1, F.value = null, I.value = null, q.activate(null), X.dispose(), Q.destroyView(), V() && Q.ensureView(), J(), Q.ensureView(), Q.getView() || Kt();
480
+ O += 1, B.value = !1, F.value = null, I.value = null, J.activate(null), Z.dispose(), $.destroyView(), V() && $.ensureView(), Y(), $.ensureView(), $.getView() || Kt();
481
481
  }
482
482
  function Kt() {
483
483
  let e = D.value;
484
- if (!(!e || c(x))) try {
484
+ if (!(!e || c(b))) try {
485
485
  let t = re({
486
486
  document: e,
487
487
  styles: e.package.styles ?? null,
@@ -494,11 +494,11 @@ function O(e) {
494
494
  let n = O, r = ++k;
495
495
  A = !0;
496
496
  let i = () => {
497
- k === r && (A = !1, !(_t || O !== n || D.value !== e || Q.getView()) && Y(t, { reason: "initial" }));
497
+ k === r && (A = !1, !(_t || O !== n || D.value !== e || $.getView()) && X(t, { reason: "initial" }));
498
498
  };
499
499
  De(e, t.doc).then(i, i);
500
500
  } catch (e) {
501
- S?.(e instanceof Error ? e : Error(String(e)));
501
+ x?.(e instanceof Error ? e : Error(String(e)));
502
502
  }
503
503
  }
504
504
  l([
@@ -507,7 +507,7 @@ function O(e) {
507
507
  ot,
508
508
  ...r ? [r] : []
509
509
  ], () => {
510
- t.value && D.value && !Q.getView() && Wt(), J();
510
+ t.value && D.value && !$.getView() && Wt(), Y();
511
511
  }, { flush: "post" });
512
512
  async function qt(e) {
513
513
  z.value = null, R.value = !1;
@@ -518,40 +518,40 @@ function O(e) {
518
518
  if (n.isErr()) throw n.error;
519
519
  t = n.value;
520
520
  }
521
- let n = await Ae(t, { password: c(v) });
521
+ let n = await Ae(t, { password: c(Je) });
522
522
  D.value = n, Gt();
523
523
  } catch (e) {
524
524
  let t = e instanceof Error ? e : Error(String(e));
525
- z.value = t.message, S?.(t);
525
+ z.value = t.message, x?.(t);
526
526
  }
527
527
  }
528
528
  function Jt(e) {
529
- z.value = null, D.value = e, Ft.reset(), Gt();
529
+ z.value = null, D.value = e, Pt.reset(), Gt();
530
530
  }
531
531
  async function Yt(e) {
532
532
  let t = j.value, n = D.value;
533
533
  if (!t || !n) return null;
534
534
  try {
535
- let t = Q.api.captureCanonicalSave();
535
+ let t = $.api.captureCanonicalSave();
536
536
  if (t) {
537
537
  let n = await be({
538
538
  snapshot: t,
539
539
  options: e,
540
- featureFlags: c(T)
540
+ featureFlags: c(w)
541
541
  });
542
- for (let t of n.diagnostics) e?.onDiagnostic || S?.(new ye({
542
+ for (let t of n.diagnostics) e?.onDiagnostic || x?.(new ye({
543
543
  gap: d.save,
544
544
  diagnostic: t,
545
545
  message: `Canonical save used a fidelity fallback: ${t.type} (${t.part}).`
546
546
  }));
547
- return n.tripwireResult && at?.(n.tripwireResult), n;
547
+ return n.tripwireResult && T?.(n.tripwireResult), n;
548
548
  }
549
549
  } catch (e) {
550
- return S?.(e instanceof Error ? e : Error(String(e))), null;
550
+ return x?.(e instanceof Error ? e : Error(String(e))), null;
551
551
  }
552
552
  if (V()) return null;
553
- Z !== null && It();
554
- let r = q.snapshotDocument(K.snapshotDocument(n)), i = t.state, a = Re(Ie(i.doc, r, { stylesheetSource: { type: "package" } })), { resolveSelectiveSaveFlags: o } = await import("@stll/folio-core/docx/selectiveSaveFlags"), s = o(c(T)), l = a.originalBuffer ?? null, u = s.selectiveSave && e?.mode !== he.full, f = u || s.selectiveSaveTripwire, { repackDocx: ee, createDocx: p } = await import("@stll/folio-core/docx/rezip"), m = null;
553
+ Q !== null && Ft();
554
+ let r = J.snapshotDocument(q.snapshotDocument(n)), i = t.state, a = Re(Ie(i.doc, r, { stylesheetSource: { type: "package" } })), { resolveSelectiveSaveFlags: o } = await import("@stll/folio-core/docx/selectiveSaveFlags"), s = o(c(w)), l = a.originalBuffer ?? null, u = s.selectiveSave && e?.mode !== he.full, f = u || s.selectiveSaveTripwire, { repackDocx: ee, createDocx: p } = await import("@stll/folio-core/docx/rezip"), m = null;
555
555
  if (f && l) {
556
556
  let { attemptSelectiveSave: e } = await import("@stll/folio-core/docx/selectiveSave");
557
557
  m = await e(a, l, {
@@ -570,9 +570,9 @@ function O(e) {
570
570
  else if (s.selectiveSaveTripwire) try {
571
571
  g = await te();
572
572
  } catch {}
573
- if (s.selectiveSaveTripwire && g && at) try {
573
+ if (s.selectiveSaveTripwire && g && T) try {
574
574
  let { compareSelectiveVsFull: e } = await import("@stll/folio-core/docx/selectiveSaveTripwire");
575
- at(await e(m, g));
575
+ T(await e(m, g));
576
576
  } catch {}
577
577
  return {
578
578
  buffer: h,
@@ -581,34 +581,34 @@ function O(e) {
581
581
  }
582
582
  async function Xt(e) {
583
583
  let t = j.value, n = t?.state, r = await Yt({ mode: e?.selective === !1 ? he.full : he.preferSelective });
584
- return r ? (j.value === t && t?.state.doc === n?.doc && (r.version === void 0 || Q.api.isCanonicalSaveCurrent(r.version)) && (D.value = r.document, J(), B.value = !1), new Blob([r.buffer], { type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" })) : null;
584
+ return r ? (j.value === t && t?.state.doc === n?.doc && (r.version === void 0 || $.api.isCanonicalSaveCurrent(r.version)) && (D.value = r.document, Y(), B.value = !1), new Blob([r.buffer], { type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" })) : null;
585
585
  }
586
586
  function Zt() {
587
- let e = Q.api.getCanonicalDocument();
587
+ let e = $.api.getCanonicalDocument();
588
588
  if (e) return e;
589
589
  if (V()) return null;
590
590
  let t = D.value;
591
- return t ? H(q.snapshotDocument(K.snapshotDocument(t))) : null;
591
+ return t ? H(J.snapshotDocument(q.snapshotDocument(t))) : null;
592
592
  }
593
593
  function Qt(e) {
594
- bt(d.modelEdits, "Direct document model changes are unavailable in this session.") || (D.value = e, J(), I.value && !q.getView(I.value) && (I.value = null));
594
+ bt(d.modelEdits, "Direct document model changes are unavailable in this session.") || (D.value = e, Y(), I.value && !J.getView(I.value) && (I.value = null));
595
595
  }
596
596
  function $t(e) {
597
- return K.getView(e);
597
+ return q.getView(e);
598
598
  }
599
599
  function en() {
600
- J();
600
+ Y();
601
601
  }
602
602
  function tn(e) {
603
- let t = q.activate(e);
604
- t && ($(t), I.value = e, requestAnimationFrame(() => t.focus()));
603
+ let t = J.activate(e);
604
+ t && (Ht(t), I.value = e, requestAnimationFrame(() => t.focus()));
605
605
  }
606
606
  function nn() {
607
- q.activate(null), I.value = null;
607
+ J.activate(null), I.value = null;
608
608
  }
609
609
  function rn() {
610
610
  let e = I.value;
611
- return e ? q.getView(e) : null;
611
+ return e ? J.getView(e) : null;
612
612
  }
613
613
  function an() {
614
614
  return U.getCommands();
@@ -619,7 +619,7 @@ function O(e) {
619
619
  }
620
620
  function sn() {
621
621
  let e = j.value;
622
- e && Y(e.state, { reason: "manual" });
622
+ e && X(e.state, { reason: "manual" });
623
623
  }
624
624
  l([
625
625
  () => c(je),
@@ -628,10 +628,17 @@ function O(e) {
628
628
  () => c(me)
629
629
  ], () => sn());
630
630
  function cn() {
631
- _t = !0, k += 1, A = !1, X.dispose(), Z !== null && (window.clearTimeout(Z), Z = null), Q.destroyView(), P.value = [], K.destroy(), q.destroy(), U.destroy(), M.value = null, L.value = null, D.value = null, R.value = !1;
631
+ _t = !0, k += 1, A = !1, Z.dispose(), Q !== null && (window.clearTimeout(Q), Q = null), $.destroyView(), P.value = [], q.destroy(), J.destroy(), U.destroy(), M.value = null, L.value = null, D.value = null, R.value = !1;
632
632
  }
633
633
  return i(cn), {
634
- editor: Ht,
634
+ setEmbeddedFontFamilies: (e) => {
635
+ if (e) {
636
+ K.embeddedFontFamilyMap = new Map(e);
637
+ return;
638
+ }
639
+ delete K.embeddedFontFamilyMap;
640
+ },
641
+ editor: Vt,
635
642
  editorView: j,
636
643
  editorState: M,
637
644
  remoteSelections: P,
@@ -745,8 +752,8 @@ function A() {
745
752
  r.preventDefault();
746
753
  let t = r.clientX - e.startX, n = parseFloat(e.handle.style.left);
747
754
  e.handle.style.left = `${n + t}px`, e.startX = r.clientX;
748
- let i = Math.round(t * b), a = e.origWidths.left + i, o = e.origWidths.right - i;
749
- a >= v && o >= v && (e.origWidths = {
755
+ let i = Math.round(t * y), a = e.origWidths.left + i, o = e.origWidths.right - i;
756
+ a >= Je && o >= Je && (e.origWidths = {
750
757
  left: a,
751
758
  right: o
752
759
  });
@@ -756,21 +763,21 @@ function A() {
756
763
  r.preventDefault();
757
764
  let e = r.clientY - t.startY, n = parseFloat(t.handle.style.top);
758
765
  t.handle.style.top = `${n + e}px`, t.startY = r.clientY;
759
- let i = Math.round(e * b), a = t.origHeight + i;
760
- a >= y && (t.origHeight = a);
766
+ let i = Math.round(e * y), a = t.origHeight + i;
767
+ a >= v && (t.origHeight = a);
761
768
  return;
762
769
  }
763
770
  if (n.active && n.handle) {
764
771
  r.preventDefault();
765
772
  let e = r.clientX - n.startX, t = parseFloat(n.handle.style.left);
766
773
  n.handle.style.left = `${t + e}px`, n.startX = r.clientX;
767
- let i = Math.round(e * b), a = n.origWidth + i;
768
- a >= v && (n.origWidth = a);
774
+ let i = Math.round(e * y), a = n.origWidth + i;
775
+ a >= Je && (n.origWidth = a);
769
776
  }
770
777
  }
771
778
  function s(i) {
772
779
  if (e.active) {
773
- e.active = !1, e.handle?.classList.remove("dragging"), r && Je(r, {
780
+ e.active = !1, e.handle?.classList.remove("dragging"), r && Ye(r, {
774
781
  pmStart: e.tablePmStart,
775
782
  colIdx: e.columnIndex,
776
783
  newLeft: e.origWidths.left,
@@ -779,14 +786,14 @@ function A() {
779
786
  return;
780
787
  }
781
788
  if (t.active) {
782
- t.active = !1, t.handle?.classList.remove("dragging"), r && x(r, {
789
+ t.active = !1, t.handle?.classList.remove("dragging"), r && b(r, {
783
790
  pmStart: t.tablePmStart,
784
791
  rowIdx: t.rowIndex,
785
792
  newHeight: t.origHeight
786
793
  }), t.handle = null;
787
794
  return;
788
795
  }
789
- n.active && (n.active = !1, n.handle?.classList.remove("dragging"), r && Ye(r, {
796
+ n.active && (n.active = !1, n.handle?.classList.remove("dragging"), r && Xe(r, {
790
797
  pmStart: n.tablePmStart,
791
798
  colIdx: n.columnIndex,
792
799
  newWidth: n.origWidth
@@ -804,30 +811,30 @@ function A() {
804
811
  };
805
812
  }
806
813
  function j(e, t) {
807
- let n = Ze(e, t.tablePmStart, t.columnIndex);
814
+ let n = Qe(e, t.tablePmStart, t.columnIndex);
808
815
  n && (t.origWidths = n);
809
816
  }
810
817
  function M(e, t, n) {
811
- let r = Qe(e, t.tablePmStart, t.rowIndex);
818
+ let r = $e(e, t.tablePmStart, t.rowIndex);
812
819
  if (r != null) {
813
820
  t.origHeight = r;
814
821
  return;
815
822
  }
816
823
  let i = n.closest(".layout-table")?.querySelector(`[data-row-index="${t.rowIndex}"]`), a = i ? i.getBoundingClientRect().height : 30;
817
- t.origHeight = Math.round(a * b);
824
+ t.origHeight = Math.round(a * y);
818
825
  }
819
826
  function N(e, t) {
820
- let n = Xe(e, t.tablePmStart, t.columnIndex);
827
+ let n = Ze(e, t.tablePmStart, t.columnIndex);
821
828
  n != null && (t.origWidth = n);
822
829
  }
823
830
  //#endregion
824
831
  //#region src/composables/useTrackedChanges.ts
825
832
  function P(t, n) {
826
- return e(() => (n.value, $e(t.value?.state ?? null)));
833
+ return e(() => (n.value, et(t.value?.state ?? null)));
827
834
  }
828
835
  //#endregion
829
836
  //#region src/composables/useZoom.ts
830
- var F = S, I = et, L = [
837
+ var F = x, I = tt, L = [
831
838
  .5,
832
839
  .75,
833
840
  1,
@@ -841,10 +848,10 @@ function vt(t = 1) {
841
848
  i.value = Math.max(F, Math.min(I, Math.round(e * 100) / 100));
842
849
  }
843
850
  function u() {
844
- l(i.value + C);
851
+ l(i.value + S);
845
852
  }
846
853
  function d() {
847
- l(i.value - C);
854
+ l(i.value - S);
848
855
  }
849
856
  function f() {
850
857
  l(1);
@@ -874,4 +881,4 @@ function vt(t = 1) {
874
881
  };
875
882
  }
876
883
  //#endregion
877
- export { k as a, w as c, A as i, at as l, $e as n, O as o, P as r, ot as s, vt as t, E as u };
884
+ export { k as a, C as c, A as i, T as l, et as n, O as o, P as r, ot as s, vt as t, E as u };