@stll/folio-vue 0.18.0 → 0.19.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.
@@ -11,11 +11,12 @@ import { createHeaderFooterEditorManager as ie } from "@stll/folio-core/controll
11
11
  import { createNoteEditorManager as ae } from "@stll/folio-core/controller/noteEditorManager";
12
12
  import { collectRemoteSelections as oe, createHiddenEditorManager as se, createHiddenEditorState as ce } from "@stll/folio-core/controller/hiddenEditorManager";
13
13
  import { runLayoutPipeline as le } from "@stll/folio-core/controller/layoutPipeline";
14
- import { browserClock as ue, createLayoutScheduler as de } from "@stll/folio-core/controller/layoutScheduler";
15
- import { createLayoutSession as fe } from "@stll/folio-core/controller/layoutSession";
16
- import { parseDocx as pe } from "@stll/folio-core/docx/parser";
17
- import { getFootnoteText as me } from "@stll/folio-core/docx/footnoteParser";
18
- import { convertHeaderFooterPmDocToContent as he, convertHeaderFooterToContent as ge } from "@stll/folio-core/layout-bridge/convert/headerFooterLayout";
14
+ import { createHyphenationReadiness as ue } from "@stll/folio-core/controller/hyphenationReadiness";
15
+ import { browserClock as de, createLayoutScheduler as fe } from "@stll/folio-core/controller/layoutScheduler";
16
+ import { createLayoutSession as pe } from "@stll/folio-core/controller/layoutSession";
17
+ import { parseDocx as me } from "@stll/folio-core/docx/parser";
18
+ import { getFootnoteText as he } from "@stll/folio-core/docx/footnoteParser";
19
+ import { convertHeaderFooterPmDocToContent as y, convertHeaderFooterToContent as ge } from "@stll/folio-core/layout-bridge/convert/headerFooterLayout";
19
20
  import { resolveSectionHeaderFooterRefs as _e } from "@stll/folio-core/layout-engine";
20
21
  import { LayoutPainter as ve } from "@stll/folio-core/layout-painter";
21
22
  import { LayoutSelectionGate as ye } from "@stll/folio-core/paged-layout/LayoutSelectionGate";
@@ -28,20 +29,20 @@ import { createTemplatePreviewValuesPlugin as De } from "@stll/folio-core/prosem
28
29
  import { templateSlashMenuPlugin as Oe } from "@stll/folio-core/prosemirror/plugins/templateSlashMenu";
29
30
  import { resolveHeaderFooterContent as ke } from "@stll/folio-core/utils/headerFooter";
30
31
  import { findVerticalScrollParent as Ae } from "@stll/folio-core/utils/findVerticalScrollParent";
31
- import { MIN_CELL_WIDTH_TWIPS as y, MIN_ROW_HEIGHT_TWIPS as b, TWIPS_PER_PIXEL as x, commitColumnResize as S, commitRightEdgeResize as je, commitRowResize as Me, readColumnWidthAt as Ne, readColumnWidths as Pe, readRowHeight as C } from "@stll/folio-core/prosemirror/tableResize";
32
+ import { MIN_CELL_WIDTH_TWIPS as b, MIN_ROW_HEIGHT_TWIPS as je, TWIPS_PER_PIXEL as x, commitColumnResize as S, commitRightEdgeResize as Me, commitRowResize as Ne, readColumnWidthAt as Pe, readColumnWidths as Fe, readRowHeight as C } from "@stll/folio-core/prosemirror/tableResize";
32
33
  import { extractTrackedChanges as w } from "@stll/folio-core/prosemirror/utils/extractTrackedChanges";
33
- import { ZOOM_MAX as T, ZOOM_MIN as Fe, ZOOM_STEP as Ie } from "@stll/folio-core/utils/zoom";
34
+ import { ZOOM_MAX as T, ZOOM_MIN as Ie, ZOOM_STEP as Le } from "@stll/folio-core/utils/zoom";
34
35
  //#region src/utils/colorMode.ts
35
- var Le = "(prefers-color-scheme: dark)";
36
- function Re() {
36
+ var Re = "(prefers-color-scheme: dark)";
37
+ function ze() {
37
38
  return typeof window < "u" && typeof window.matchMedia == "function";
38
39
  }
39
- function ze(e, t) {
40
+ function Be(e, t) {
40
41
  return e === "dark" || e === "system" && t;
41
42
  }
42
- function Be(e) {
43
- if (!Re()) return () => {};
44
- let t = window.matchMedia(Le);
43
+ function Ve(e) {
44
+ if (!ze()) return () => {};
45
+ let t = window.matchMedia(Re);
45
46
  e(t.matches);
46
47
  let n = (t) => e(t.matches);
47
48
  return t.addEventListener("change", n), () => t.removeEventListener("change", n);
@@ -50,23 +51,23 @@ function Be(e) {
50
51
  //#region src/composables/useColorMode.ts
51
52
  var E = "light", D = Symbol("folioColorMode"), O = (t = E) => {
52
53
  a(D, e(() => c(t)));
53
- }, k = { install(t, n = E) {
54
+ }, He = { install(t, n = E) {
54
55
  t.provide(D, e(() => c(n)));
55
56
  } };
56
- function A() {
57
+ function k() {
57
58
  let n = t(D, e(() => E)), i = o(!1), a = o(!1);
58
59
  return r(() => {
59
60
  i.value = !0;
60
61
  }), u((e) => {
61
- !i.value || n.value !== "system" || e(Be((e) => {
62
+ !i.value || n.value !== "system" || e(Ve((e) => {
62
63
  a.value = e;
63
64
  }));
64
- }), e(() => ze(n.value, i.value && a.value));
65
+ }), e(() => Be(n.value, i.value && a.value));
65
66
  }
66
67
  //#endregion
67
68
  //#region src/composables/useDocxEditor.ts
68
- var Ve = 24, He = 32, Ue = 96, We = 250, Ge = [], Ke = [];
69
- function qe(e) {
69
+ var Ue = 24, We = 32, Ge = 96, Ke = 250, qe = [], Je = [];
70
+ function Ye(e) {
70
71
  let t = e?.columnCount ?? 1;
71
72
  if (t <= 1) return;
72
73
  let n = {
@@ -76,24 +77,24 @@ function qe(e) {
76
77
  };
77
78
  return e?.separator !== void 0 && (n.separator = e.separator), n;
78
79
  }
79
- function Je(e, t, n, r, i, a) {
80
+ function Xe(e, t, n, r, i, a) {
80
81
  if (!e) return;
81
82
  let o = t ? {
82
83
  ...a,
83
84
  rId: t
84
85
  } : a, s = t ? n?.getView(t) : null;
85
- return s ? he(s.state.doc, r, i, o) : ge(e, r, i, o);
86
+ return s ? y(s.state.doc, r, i, o) : ge(e, r, i, o);
86
87
  }
87
- function Ye(e, t, n, r, i) {
88
+ function Ze(e, t, n, r, i) {
88
89
  if (!e || e.size === 0) return;
89
90
  let a = /* @__PURE__ */ new Map();
90
91
  for (let [o, s] of e) {
91
- let e = Je(s, o, t, n, r, i);
92
+ let e = Xe(s, o, t, n, r, i);
92
93
  e && a.set(o, e);
93
94
  }
94
95
  return a.size > 0 ? a : void 0;
95
96
  }
96
- function Xe(e, t, n) {
97
+ function Qe(e, t, n) {
97
98
  let r = /* @__PURE__ */ new Map();
98
99
  if (!n || !n.package.footnotes) return r;
99
100
  let i = /* @__PURE__ */ new Map();
@@ -107,7 +108,7 @@ function Xe(e, t, n) {
107
108
  e.push({
108
109
  displayNumber: String(o),
109
110
  noteId: n,
110
- text: me(r),
111
+ text: he(r),
111
112
  ...a ? { content: {
112
113
  blocks: a.blocks,
113
114
  measures: a.measures,
@@ -119,7 +120,7 @@ function Xe(e, t, n) {
119
120
  }
120
121
  return r;
121
122
  }
122
- var j = /* @__PURE__ */ new Set([
123
+ var A = /* @__PURE__ */ new Set([
123
124
  "black",
124
125
  "blue",
125
126
  "cyan",
@@ -138,37 +139,45 @@ var j = /* @__PURE__ */ new Set([
138
139
  "white",
139
140
  "yellow"
140
141
  ]);
141
- function Ze(e) {
142
+ function $e(e) {
142
143
  let t = [], n = (e, r) => {
143
- for (let [n, i] of e.marks.entries()) i.type.name === "highlight" && !j.has(String(i.attrs.color)) && t.push(`${r}.marks[${n}]=${JSON.stringify(i.attrs)}`);
144
+ 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)}`);
144
145
  e.forEach((e, t, i) => {
145
146
  n(e, `${r}.content[${i}]`);
146
147
  });
147
148
  };
148
149
  return n(e, "doc"), t.join("; ");
149
150
  }
150
- function Qe() {
151
+ function et() {
151
152
  return typeof document > "u" || !("fonts" in document) || document.fonts.status === "loaded";
152
153
  }
153
- function M(e) {
154
- let { hiddenContainer: t, hiddenHeaderFooterContainer: n, noteEditorContainer: r, pagesContainer: a, readOnly: u = !1, pageGap: p = Ve, pageRenderer: me, showMarginGuides: he, marginGuideColor: ge, password: Ae, editorMode: y, author: b, externalPlugins: x = [], collaboration: S, onAnonymizationMatchesChange: je, showTemplateDirectives: Me, onSlashMenuChange: Ne, onSlashMenuKeyAction: Pe, onChange: C, onError: w, onSelectionUpdate: T, onEditorViewReady: Fe, onCopy: Ie, onCut: Le, onPaste: Re, onReadOnlyEditAttempt: ze, featureFlags: Be, onSelectiveSaveTripwire: E } = e, D = n ?? t, O = s(null), k = 0, A = s(null), j = s(null), M = s(null), N = s([]), P = s(null), F = s(null), I = s(null), L = s([]), R = s([]), z = o(!1), B = o(null), V = o(!1), H = new Se(Ee());
155
- H.buildSchema(), H.initializeRuntime();
156
- let $e = ee(!1), et = [$e], tt = h({ keymap: !0 }), nt = m({ onMatchesChange: (e) => je?.(e) }), U = g(), rt = Oe({
157
- onChange: (e) => Ne?.(e),
158
- onKeyAction: (e) => Pe?.(e) ?? !1
159
- }), it = De(), at = () => c(Me) === !0;
160
- function ot() {
154
+ function j(e) {
155
+ let { hiddenContainer: t, hiddenHeaderFooterContainer: n, noteEditorContainer: r, pagesContainer: a, readOnly: u = !1, pageGap: p = Ue, pageRenderer: he, showMarginGuides: y, marginGuideColor: ge, password: Ae, editorMode: b, author: je, externalPlugins: x = [], collaboration: S, onAnonymizationMatchesChange: Me, showTemplateDirectives: Ne, onSlashMenuChange: Pe, onSlashMenuKeyAction: Fe, onChange: C, onError: w, onSelectionUpdate: T, onEditorViewReady: Ie, onCopy: Le, onCut: Re, onPaste: ze, onReadOnlyEditAttempt: Be, featureFlags: Ve, onSelectiveSaveTripwire: E } = e, D = n ?? t, O = s(null), He = 0, k = s(null), A = s(null), j = s(null), M = s([]), N = s(null), P = s(null), F = s(null), I = s([]), L = s([]), R = o(!1), z = o(null), B = o(!1), V = new Se(Ee());
156
+ V.buildSchema(), V.initializeRuntime();
157
+ let tt = ee(!1), nt = [tt], rt = h({ keymap: !0 }), it = m({ onMatchesChange: (e) => Me?.(e) }), H = g(), U = Oe({
158
+ onChange: (e) => Pe?.(e),
159
+ onKeyAction: (e) => Fe?.(e) ?? !1
160
+ }), at = De(), ot = () => c(Ne) === !0;
161
+ function st() {
161
162
  return [
163
+ rt,
162
164
  tt,
163
- $e,
164
165
  ...x,
165
166
  ...c(S)?.plugins ?? [],
166
- nt,
167
- ...at() ? [U, rt] : [],
168
- it
167
+ it,
168
+ ...ot() ? [H, U] : [],
169
+ at
169
170
  ];
170
171
  }
171
- let W = ne(), G = new ye(), st = fe(), ct = new ve({
172
+ let W = ne(), G = new ye(), ct = pe(), lt = ue({
173
+ relayout: () => {
174
+ let e = k.value?.state ?? ct.lastEditorState;
175
+ e && J(e, { reason: "hyphenation-ready" });
176
+ },
177
+ onError: (e) => w?.(e)
178
+ });
179
+ i(lt.cancel);
180
+ let ut = new ve({
172
181
  pageGap: p,
173
182
  showShadow: !0
174
183
  }), K = ie({
@@ -178,13 +187,13 @@ function M(e) {
178
187
  getTheme: () => O.value?.package.theme ?? null,
179
188
  onTransaction: ({ rId: e, kind: t, view: n, docChanged: r, selectionChanged: i }) => {
180
189
  if (r) {
181
- V.value = !0;
182
- let e = A.value;
190
+ B.value = !0;
191
+ let e = k.value;
183
192
  e && Y.schedule(e.state, null);
184
193
  }
185
194
  if (r || i) {
186
195
  let { from: r, to: i } = n.state.selection;
187
- P.value = {
196
+ N.value = {
188
197
  from: r,
189
198
  kind: t,
190
199
  rId: e,
@@ -196,21 +205,21 @@ function M(e) {
196
205
  }
197
206
  G.requestRender();
198
207
  }
199
- }), lt = { current: null }, q = ae({
208
+ }), dt = { current: null }, q = ae({
200
209
  getHost: () => r?.value ?? null,
201
- getPlugins: () => et,
210
+ getPlugins: () => nt,
202
211
  getDocument: () => O.value,
203
212
  getStyles: () => O.value?.package.styles ?? null,
204
213
  getTheme: () => O.value?.package.theme ?? null,
205
214
  onTransaction: ({ docChanged: e, selectionChanged: t, view: n }) => {
206
215
  if (e) {
207
- V.value = !0;
216
+ B.value = !0;
208
217
  let e = O.value;
209
218
  if (e) {
210
- let t = lt.current?.snapshotDocument(e) ?? e;
219
+ let t = dt.current?.snapshotDocument(e) ?? e;
211
220
  O.value = t, C?.(t), W.emit("docChange", t);
212
221
  }
213
- let t = A.value;
222
+ let t = k.value;
214
223
  t && Y.schedule(t.state, null);
215
224
  }
216
225
  if (e || t) {
@@ -223,23 +232,23 @@ function M(e) {
223
232
  }
224
233
  }
225
234
  });
226
- lt.current = q;
227
- function ut(e) {
228
- e.layout && (I.value = e.layout), e.blocks && (L.value = e.blocks), e.measures && (R.value = e.measures), e.blockLookup && ct.setBlockLookup(e.blockLookup), e.layout && W.emit("layoutComplete", e.layout);
235
+ dt.current = q;
236
+ function ft(e) {
237
+ e.layout && (F.value = e.layout), e.blocks && (I.value = e.blocks), e.measures && (L.value = e.measures), e.blockLookup && ut.setBlockLookup(e.blockLookup), e.layout && W.emit("layoutComplete", e.layout);
229
238
  }
230
239
  function J(e, t = {}) {
231
- let n = a.value, r = n instanceof HTMLDivElement ? n : null, i = O.value, o = i?.package.document, s = o?.sections?.[0]?.properties ?? o?.finalSectionProperties ?? null, l = f(s), u = d(s), m = qe(s), h = l.w - u.left - u.right, g = i?.package.styles ?? null, ee = i?.package.theme ?? null, te = i?.package.settings?.defaultTabStop, _ = i?.package.settings?.mirrorMargins === !0, v = ke(i?.package);
240
+ let n = a.value, r = n instanceof HTMLDivElement ? n : null, i = O.value, o = i?.package.document, s = o?.sections?.[0]?.properties ?? o?.finalSectionProperties ?? null, l = f(s), u = d(s), m = Ye(s), h = l.w - u.left - u.right, g = i?.package.styles ?? null, ee = i?.package.theme ?? null, te = i?.package.settings?.defaultTabStop, _ = i?.package.settings?.mirrorMargins === !0, v = ke(i?.package);
232
241
  try {
233
- ut(le({
242
+ ft(le({
234
243
  contentWidth: h,
235
244
  columns: m,
236
245
  pageSize: l,
237
246
  margins: u,
238
247
  pageGap: p,
239
- showMarginGuides: c(he) === !0,
248
+ showMarginGuides: c(y) === !0,
240
249
  marginGuideColor: c(ge),
241
250
  ...(() => {
242
- let e = c(me);
251
+ let e = c(he);
243
252
  return e === void 0 ? {} : { pageRenderer: e };
244
253
  })(),
245
254
  syncCoordinator: G,
@@ -258,33 +267,34 @@ function M(e) {
258
267
  defaultTabStop: te,
259
268
  mirrorMargins: _,
260
269
  styles: g,
261
- layout: I.value,
270
+ layout: F.value,
262
271
  hfPMs: K,
263
- painter: ct,
272
+ painter: ut,
264
273
  pagesContainer: r,
265
- session: st,
266
- renderHfFromContentOrPm: Je,
267
- renderHeaderFooterContentByRId: Ye,
268
- documentFontsAreLoaded: Qe,
269
- buildFootnoteRenderItems: Xe,
270
- describeInvalidHighlightMarks: Ze,
271
- emptyTemplatePreviewEntries: Ge,
272
- emptyTemplatePreviewHidden: Ke
274
+ session: ct,
275
+ renderHfFromContentOrPm: Xe,
276
+ renderHeaderFooterContentByRId: Ze,
277
+ documentFontsAreLoaded: et,
278
+ buildFootnoteRenderItems: Qe,
279
+ describeInvalidHighlightMarks: $e,
280
+ emptyTemplatePreviewEntries: qe,
281
+ emptyTemplatePreviewHidden: Je,
282
+ hyphenationReadiness: lt
273
283
  }, e, t));
274
284
  } catch (e) {
275
285
  let t = e instanceof Error ? e : Error(String(e));
276
286
  w?.(t);
277
287
  }
278
288
  }
279
- let Y = de({
289
+ let Y = fe({
280
290
  runLayout: (e, t) => J(e, t),
281
- debounceMs: He,
282
- maxDelayMs: Ue,
283
- clock: ue
291
+ debounceMs: We,
292
+ maxDelayMs: Ge,
293
+ clock: de
284
294
  }), X = null;
285
- function dt() {
295
+ function pt() {
286
296
  X !== null && (window.clearTimeout(X), X = null);
287
- let e = A.value, t = O.value;
297
+ let e = k.value, t = O.value;
288
298
  if (!(!e || !t)) try {
289
299
  let n = xe(e.state.doc, t);
290
300
  O.value = n, K.sync(), q.sync(), C?.(n), W.emit("docChange", n);
@@ -292,136 +302,136 @@ function M(e) {
292
302
  w?.(e instanceof Error ? e : Error(String(e)));
293
303
  }
294
304
  }
295
- function ft() {
305
+ function mt() {
296
306
  X !== null && window.clearTimeout(X), X = window.setTimeout(() => {
297
- X = null, dt();
298
- }, We);
307
+ X = null, pt();
308
+ }, Ke);
299
309
  }
300
310
  let Z = se({
301
311
  getHost: () => t.value,
302
312
  getDocument: () => O.value,
303
313
  getStyles: () => O.value?.package.styles ?? null,
304
- getExtensionManager: () => H,
305
- getExternalPlugins: ot,
314
+ getExtensionManager: () => V,
315
+ getExternalPlugins: st,
306
316
  getCollaboration: () => c(S),
307
- getCollaborationModules: () => M.value,
317
+ getCollaborationModules: () => j.value,
308
318
  getPrecomputedInitialState: () => null,
309
319
  getReadOnly: () => c(u),
310
- getDocumentIdentity: () => String(k),
320
+ getDocumentIdentity: () => String(He),
311
321
  getDocumentContext: () => O.value,
312
- onTransaction: pt,
322
+ onTransaction: ht,
313
323
  onSelectionChange: (e) => {
314
- j.value = e, T?.(e), W.emit("selectionChange", {
324
+ A.value = e, T?.(e), W.emit("selectionChange", {
315
325
  from: e.selection.from,
316
326
  to: e.selection.to
317
327
  });
318
328
  },
319
329
  onKeyDown: () => !1,
320
- onCopy: () => Ie?.(),
321
- onCut: () => Le?.(),
322
- onPaste: () => Re?.(),
323
- onReadOnlyEditAttempt: () => ze?.(),
324
- onEditorViewReady: mt,
330
+ onCopy: () => Le?.(),
331
+ onCut: () => Re?.(),
332
+ onPaste: () => ze?.(),
333
+ onReadOnlyEditAttempt: () => Be?.(),
334
+ onEditorViewReady: gt,
325
335
  onEditorViewDestroy: () => {
326
- A.value = null, z.value = !1, Fe?.(null);
336
+ k.value = null, R.value = !1, Ie?.(null);
327
337
  },
328
338
  onRemoteSelectionsChange: (e) => {
329
- N.value = e;
339
+ M.value = e;
330
340
  }
331
341
  }), Q = () => {
332
- let e = c(S)?.awareness, t = M.value, n = Z.getView();
333
- N.value = e && t && n ? oe(n.state, e, t) : [];
342
+ let e = c(S)?.awareness, t = j.value, n = Z.getView();
343
+ M.value = e && t && n ? oe(n.state, e, t) : [];
334
344
  };
335
345
  l(() => c(S), (e, t, n) => {
336
- if (N.value = [], !e) {
337
- M.value = null, Z.retryViewCreation(), Z.syncExternalDocument();
346
+ if (M.value = [], !e) {
347
+ j.value = null, Z.retryViewCreation(), Z.syncExternalDocument();
338
348
  return;
339
349
  }
340
350
  let r = !1;
341
351
  n(() => {
342
352
  r = !0;
343
- }), M.value = null, re().then((e) => {
344
- r || (M.value = e, Z.retryViewCreation(), Z.syncExternalDocument(), Q());
353
+ }), j.value = null, re().then((e) => {
354
+ r || (j.value = e, Z.retryViewCreation(), Z.syncExternalDocument(), Q());
345
355
  }, (e) => {
346
- r || (M.value = null, w?.(e instanceof Error ? e : Error(String(e))));
356
+ r || (j.value = null, w?.(e instanceof Error ? e : Error(String(e))));
347
357
  });
348
358
  }, { immediate: !0 }), l(() => ({
349
359
  awareness: c(S)?.awareness,
350
- modules: M.value,
351
- view: A.value
360
+ modules: j.value,
361
+ view: k.value
352
362
  }), ({ awareness: e, modules: t, view: n }, r, i) => {
353
363
  if (!e || !t || !n) {
354
- N.value = [];
364
+ M.value = [];
355
365
  return;
356
366
  }
357
367
  e.on("change", Q), Q(), i(() => {
358
- e.off("change", Q), N.value = [];
368
+ e.off("change", Q), M.value = [];
359
369
  });
360
370
  }, { flush: "post" });
361
- function pt({ transactions: e, newState: t, docChanged: n }) {
362
- j.value = t, n && (V.value = !0, G.incrementStateSeq(), Y.schedule(t, be(e)), ft()), G.requestRender();
371
+ function ht({ transactions: e, newState: t, docChanged: n }) {
372
+ A.value = t, n && (B.value = !0, G.incrementStateSeq(), Y.schedule(t, be(e)), mt()), G.requestRender();
363
373
  }
364
- function mt(e) {
365
- A.value = e, j.value = e.state, z.value = !0, J(e.state, { reason: "initial" }), G.requestRender(), $(e), Fe?.(e), c(u) || requestAnimationFrame(() => {
366
- A.value === e && e.focus();
374
+ function gt(e) {
375
+ k.value = e, A.value = e.state, R.value = !0, J(e.state, { reason: "initial" }), G.requestRender(), $(e), Ie?.(e), c(u) || requestAnimationFrame(() => {
376
+ k.value === e && e.focus();
367
377
  });
368
378
  }
369
- let ht = {
370
- getDocx: async (e) => (await Ct(e))?.buffer ?? null,
371
- loadDocument: St,
372
- loadDocx: xt
373
- }, gt = v({
379
+ let _t = {
380
+ getDocx: async (e) => (await Tt(e))?.buffer ?? null,
381
+ loadDocument: wt,
382
+ loadDocx: Ct
383
+ }, vt = v({
374
384
  getEditorApi: () => Z.api,
375
- getLayout: () => I.value,
385
+ getLayout: () => F.value,
376
386
  runLayout: (e, t) => J(e, t),
377
- getDocumentIO: () => ht,
387
+ getDocumentIO: () => _t,
378
388
  emitter: W
379
389
  });
380
390
  function $(e) {
381
- te(c(y) === "suggesting", e.state, e.dispatch, c(b));
391
+ te(c(b) === "suggesting", e.state, e.dispatch, c(je));
382
392
  }
383
- l([() => c(y), () => c(b)], () => {
384
- let e = A.value;
393
+ l([() => c(b), () => c(je)], () => {
394
+ let e = k.value;
385
395
  e && $(e);
386
396
  for (let e of q.listStories()) {
387
397
  let t = q.getView(e);
388
398
  t && $(t);
389
399
  }
390
400
  }), l(() => c(u), (e) => {
391
- Z.syncEditable(), e && At();
401
+ Z.syncEditable(), e && Mt();
392
402
  });
393
- function _t(e) {
394
- let t = at();
395
- if (t === e.state.plugins.includes(U)) return;
396
- let n = e.state.plugins.filter((e) => e !== U && e !== rt);
403
+ function yt(e) {
404
+ let t = ot();
405
+ if (t === e.state.plugins.includes(H)) return;
406
+ let n = e.state.plugins.filter((e) => e !== H && e !== U);
397
407
  if (t) {
398
- let e = n.indexOf(it), t = e === -1 ? n.length : e;
399
- n.splice(t, 0, U, rt);
408
+ let e = n.indexOf(at), t = e === -1 ? n.length : e;
409
+ n.splice(t, 0, H, U);
400
410
  }
401
411
  e.updateState(e.state.reconfigure({ plugins: n }));
402
412
  }
403
- l(() => at(), () => {
404
- let e = A.value;
405
- e && _t(e);
413
+ l(() => ot(), () => {
414
+ let e = k.value;
415
+ e && yt(e);
406
416
  });
407
- function vt() {
417
+ function bt() {
408
418
  Z.ensureView();
409
419
  }
410
- function yt() {
411
- k += 1, V.value = !1, P.value = null, F.value = null, q.activate(null), Y.dispose(), Z.destroyView(), K.sync(), q.sync(), Z.ensureView(), Z.getView() || bt();
420
+ function xt() {
421
+ He += 1, B.value = !1, N.value = null, P.value = null, q.activate(null), Y.dispose(), Z.destroyView(), K.sync(), q.sync(), Z.ensureView(), Z.getView() || St();
412
422
  }
413
- function bt() {
423
+ function St() {
414
424
  let e = O.value;
415
425
  if (!(!e || c(S))) try {
416
426
  let t = ce({
417
427
  document: e,
418
428
  styles: e.package.styles ?? null,
419
- manager: H,
420
- externalPlugins: ot(),
429
+ manager: V,
430
+ externalPlugins: st(),
421
431
  collaborationModules: null,
422
432
  reason: "mount"
423
433
  });
424
- j.value = t, J(t, { reason: "initial" });
434
+ A.value = t, J(t, { reason: "initial" });
425
435
  } catch (e) {
426
436
  w?.(e instanceof Error ? e : Error(String(e)));
427
437
  }
@@ -432,25 +442,25 @@ function M(e) {
432
442
  D,
433
443
  ...r ? [r] : []
434
444
  ], () => {
435
- t.value && O.value && !Z.getView() && vt(), K.sync(), q.sync();
445
+ t.value && O.value && !Z.getView() && bt(), K.sync(), q.sync();
436
446
  }, { flush: "post" });
437
- async function xt(e) {
438
- B.value = null, z.value = !1;
447
+ async function Ct(e) {
448
+ z.value = null, R.value = !1;
439
449
  try {
440
- let t = await pe(e, { password: c(Ae) });
441
- O.value = t, yt();
450
+ let t = await me(e, { password: c(Ae) });
451
+ O.value = t, xt();
442
452
  } catch (e) {
443
453
  let t = e instanceof Error ? e : Error(String(e));
444
- B.value = t.message, w?.(t);
454
+ z.value = t.message, w?.(t);
445
455
  }
446
456
  }
447
- function St(e) {
448
- B.value = null, O.value = e, yt();
457
+ function wt(e) {
458
+ z.value = null, O.value = e, xt();
449
459
  }
450
- async function Ct(e) {
451
- let t = A.value, n = O.value;
460
+ async function Tt(e) {
461
+ let t = k.value, n = O.value;
452
462
  if (!t || !n) return null;
453
- let r = q.snapshotDocument(K.snapshotDocument(n)), i = t.state, { resolveSelectiveSaveFlags: a } = await import("@stll/folio-core/docx/selectiveSaveFlags"), o = a(c(Be)), s = xe(i.doc, r), l = s.originalBuffer ?? null, u = o.selectiveSave && e?.mode !== _.full, d = u || o.selectiveSaveTripwire, { repackDocx: f, createDocx: p } = await import("@stll/folio-core/docx/rezip"), m = null;
463
+ let r = q.snapshotDocument(K.snapshotDocument(n)), i = t.state, { resolveSelectiveSaveFlags: a } = await import("@stll/folio-core/docx/selectiveSaveFlags"), o = a(c(Ve)), s = xe(i.doc, r), l = s.originalBuffer ?? null, u = o.selectiveSave && e?.mode !== _.full, d = u || o.selectiveSaveTripwire, { repackDocx: f, createDocx: p } = await import("@stll/folio-core/docx/rezip"), m = null;
454
464
  if (d && l) {
455
465
  let { attemptSelectiveSave: e } = await import("@stll/folio-core/docx/selectiveSave");
456
466
  m = await e(s, l, {
@@ -474,84 +484,84 @@ function M(e) {
474
484
  document: s
475
485
  };
476
486
  }
477
- async function wt(e) {
478
- let t = await Ct({ mode: e?.selective === !1 ? _.full : _.preferSelective });
479
- return t ? (O.value = t.document, K.sync(), q.sync(), V.value = !1, new Blob([t.buffer], { type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" })) : null;
487
+ async function Et(e) {
488
+ let t = await Tt({ mode: e?.selective === !1 ? _.full : _.preferSelective });
489
+ return t ? (O.value = t.document, K.sync(), q.sync(), B.value = !1, new Blob([t.buffer], { type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" })) : null;
480
490
  }
481
- function Tt() {
491
+ function Dt() {
482
492
  let e = O.value;
483
493
  return e ? q.snapshotDocument(K.snapshotDocument(e)) : null;
484
494
  }
485
- function Et(e) {
486
- O.value = e, K.sync(), q.sync(), F.value && !q.getView(F.value) && (F.value = null);
495
+ function Ot(e) {
496
+ O.value = e, K.sync(), q.sync(), P.value && !q.getView(P.value) && (P.value = null);
487
497
  }
488
- function Dt(e) {
498
+ function kt(e) {
489
499
  return K.getView(e);
490
500
  }
491
- function Ot() {
501
+ function At() {
492
502
  K.sync();
493
503
  }
494
- function kt(e) {
504
+ function jt(e) {
495
505
  let t = q.activate(e);
496
- t && ($(t), F.value = e, requestAnimationFrame(() => t.focus()));
497
- }
498
- function At() {
499
- q.activate(null), F.value = null;
500
- }
501
- function jt() {
502
- let e = F.value;
503
- return e ? q.getView(e) : null;
506
+ t && ($(t), P.value = e, requestAnimationFrame(() => t.focus()));
504
507
  }
505
508
  function Mt() {
506
- return H.getCommands();
509
+ q.activate(null), P.value = null;
507
510
  }
508
511
  function Nt() {
509
- let e = jt();
510
- e ? e.focus() : A.value?.focus();
512
+ let e = P.value;
513
+ return e ? q.getView(e) : null;
511
514
  }
512
515
  function Pt() {
513
- let e = A.value;
516
+ return V.getCommands();
517
+ }
518
+ function Ft() {
519
+ let e = Nt();
520
+ e ? e.focus() : k.value?.focus();
521
+ }
522
+ function It() {
523
+ let e = k.value;
514
524
  e && J(e.state, { reason: "manual" });
515
525
  }
516
526
  l([
517
- () => c(he),
527
+ () => c(y),
518
528
  () => c(ge),
519
- () => c(me)
520
- ], () => Pt());
521
- function Ft() {
522
- Y.dispose(), X !== null && (window.clearTimeout(X), X = null), Z.destroyView(), N.value = [], K.destroy(), q.destroy(), H.destroy(), j.value = null, I.value = null, O.value = null, z.value = !1;
523
- }
524
- return i(Ft), {
525
- editor: gt,
526
- editorView: A,
527
- editorState: j,
528
- remoteSelections: N,
529
- headerFooterSelection: P,
530
- activeNoteStory: F,
531
- isReady: z,
532
- isDirty: V,
533
- parseError: B,
534
- layout: I,
535
- blocks: L,
536
- measures: R,
529
+ () => c(he)
530
+ ], () => It());
531
+ function Lt() {
532
+ Y.dispose(), X !== null && (window.clearTimeout(X), X = null), Z.destroyView(), M.value = [], K.destroy(), q.destroy(), V.destroy(), A.value = null, F.value = null, O.value = null, R.value = !1;
533
+ }
534
+ return i(Lt), {
535
+ editor: vt,
536
+ editorView: k,
537
+ editorState: A,
538
+ remoteSelections: M,
539
+ headerFooterSelection: N,
540
+ activeNoteStory: P,
541
+ isReady: R,
542
+ isDirty: B,
543
+ parseError: z,
544
+ layout: F,
545
+ blocks: I,
546
+ measures: L,
537
547
  syncCoordinator: G,
538
- loadBuffer: xt,
539
- loadDocument: St,
540
- save: wt,
541
- getDocument: Tt,
542
- setDocument: Et,
543
- getHeaderFooterView: Dt,
544
- syncHeaderFooterViews: Ot,
545
- openNoteStory: kt,
546
- closeNoteStory: At,
547
- getActiveNoteView: jt,
548
- getCommands: Mt,
549
- focus: Nt,
550
- reLayout: Pt,
551
- destroy: Ft
548
+ loadBuffer: Ct,
549
+ loadDocument: wt,
550
+ save: Et,
551
+ getDocument: Dt,
552
+ setDocument: Ot,
553
+ getHeaderFooterView: kt,
554
+ syncHeaderFooterViews: At,
555
+ openNoteStory: jt,
556
+ closeNoteStory: Mt,
557
+ getActiveNoteView: Nt,
558
+ getCommands: Pt,
559
+ focus: Ft,
560
+ reLayout: It,
561
+ destroy: Lt
552
562
  };
553
563
  }
554
- function N(e, t) {
564
+ function M(e, t) {
555
565
  if (t < e.top + 40) {
556
566
  let n = Math.max(0, e.top + 40 - t);
557
567
  return -Math.min(12, n / 40 * 12);
@@ -564,7 +574,7 @@ function N(e, t) {
564
574
  }
565
575
  //#endregion
566
576
  //#region src/composables/useDragAutoScroll.ts
567
- function P({ pagesContainer: e, onScrollExtendSelection: t }) {
577
+ function N({ pagesContainer: e, onScrollExtendSelection: t }) {
568
578
  let n = null, r = 0, a = 0, o = !1, s = null;
569
579
  function c() {
570
580
  if (s) return s;
@@ -578,7 +588,7 @@ function P({ pagesContainer: e, onScrollExtendSelection: t }) {
578
588
  if (!o) return;
579
589
  let e = c();
580
590
  if (!e) return;
581
- let i = N(e.getBoundingClientRect(), a);
591
+ let i = M(e.getBoundingClientRect(), a);
582
592
  i !== 0 && (e.scrollTop += i, t(r, a)), n = requestAnimationFrame(u);
583
593
  }
584
594
  function d() {
@@ -599,7 +609,7 @@ function P({ pagesContainer: e, onScrollExtendSelection: t }) {
599
609
  }
600
610
  //#endregion
601
611
  //#region src/composables/useTableResize.ts
602
- function F() {
612
+ function P() {
603
613
  let e = {
604
614
  active: !1,
605
615
  startX: 0,
@@ -631,7 +641,7 @@ function F() {
631
641
  }
632
642
  function a(i, a) {
633
643
  let o = i.target;
634
- 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), I(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), L(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), R(a, n), !0) : !1 : !1;
644
+ 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;
635
645
  }
636
646
  function o(r) {
637
647
  if (e.active && e.handle) {
@@ -639,7 +649,7 @@ function F() {
639
649
  let t = r.clientX - e.startX, n = parseFloat(e.handle.style.left);
640
650
  e.handle.style.left = `${n + t}px`, e.startX = r.clientX;
641
651
  let i = Math.round(t * x), a = e.origWidths.left + i, o = e.origWidths.right - i;
642
- a >= y && o >= y && (e.origWidths = {
652
+ a >= b && o >= b && (e.origWidths = {
643
653
  left: a,
644
654
  right: o
645
655
  });
@@ -650,7 +660,7 @@ function F() {
650
660
  let e = r.clientY - t.startY, n = parseFloat(t.handle.style.top);
651
661
  t.handle.style.top = `${n + e}px`, t.startY = r.clientY;
652
662
  let i = Math.round(e * x), a = t.origHeight + i;
653
- a >= b && (t.origHeight = a);
663
+ a >= je && (t.origHeight = a);
654
664
  return;
655
665
  }
656
666
  if (n.active && n.handle) {
@@ -658,7 +668,7 @@ function F() {
658
668
  let e = r.clientX - n.startX, t = parseFloat(n.handle.style.left);
659
669
  n.handle.style.left = `${t + e}px`, n.startX = r.clientX;
660
670
  let i = Math.round(e * x), a = n.origWidth + i;
661
- a >= y && (n.origWidth = a);
671
+ a >= b && (n.origWidth = a);
662
672
  }
663
673
  }
664
674
  function s(i) {
@@ -672,14 +682,14 @@ function F() {
672
682
  return;
673
683
  }
674
684
  if (t.active) {
675
- t.active = !1, t.handle?.classList.remove("dragging"), r && Me(r, {
685
+ t.active = !1, t.handle?.classList.remove("dragging"), r && Ne(r, {
676
686
  pmStart: t.tablePmStart,
677
687
  rowIdx: t.rowIndex,
678
688
  newHeight: t.origHeight
679
689
  }), t.handle = null;
680
690
  return;
681
691
  }
682
- n.active && (n.active = !1, n.handle?.classList.remove("dragging"), r && je(r, {
692
+ n.active && (n.active = !1, n.handle?.classList.remove("dragging"), r && Me(r, {
683
693
  pmStart: n.tablePmStart,
684
694
  colIdx: n.columnIndex,
685
695
  newWidth: n.origWidth
@@ -696,11 +706,11 @@ function F() {
696
706
  isResizing: i
697
707
  };
698
708
  }
699
- function I(e, t) {
700
- let n = Pe(e, t.tablePmStart, t.columnIndex);
709
+ function F(e, t) {
710
+ let n = Fe(e, t.tablePmStart, t.columnIndex);
701
711
  n && (t.origWidths = n);
702
712
  }
703
- function L(e, t, n) {
713
+ function I(e, t, n) {
704
714
  let r = C(e, t.tablePmStart, t.rowIndex);
705
715
  if (r != null) {
706
716
  t.origHeight = r;
@@ -709,18 +719,18 @@ function L(e, t, n) {
709
719
  let i = n.closest(".layout-table")?.querySelector(`[data-row-index="${t.rowIndex}"]`), a = i ? i.getBoundingClientRect().height : 30;
710
720
  t.origHeight = Math.round(a * x);
711
721
  }
712
- function R(e, t) {
713
- let n = Ne(e, t.tablePmStart, t.columnIndex);
722
+ function L(e, t) {
723
+ let n = Pe(e, t.tablePmStart, t.columnIndex);
714
724
  n != null && (t.origWidth = n);
715
725
  }
716
726
  //#endregion
717
727
  //#region src/composables/useTrackedChanges.ts
718
- function z(t, n) {
728
+ function R(t, n) {
719
729
  return e(() => (n.value, w(t.value?.state ?? null)));
720
730
  }
721
731
  //#endregion
722
732
  //#region src/composables/useZoom.ts
723
- var B = Fe, V = T, H = [
733
+ var z = Ie, B = T, V = [
724
734
  .5,
725
735
  .75,
726
736
  1,
@@ -728,16 +738,16 @@ var B = Fe, V = T, H = [
728
738
  1.5,
729
739
  2
730
740
  ];
731
- function $e(t = 1) {
732
- let i = o(Math.max(B, Math.min(V, t))), a = e(() => Math.round(i.value * 100)), s = e(() => i.value <= B), c = e(() => i.value >= V);
741
+ function tt(t = 1) {
742
+ let i = o(Math.max(z, Math.min(B, t))), a = e(() => Math.round(i.value * 100)), s = e(() => i.value <= z), c = e(() => i.value >= B);
733
743
  function l(e) {
734
- i.value = Math.max(B, Math.min(V, Math.round(e * 100) / 100));
744
+ i.value = Math.max(z, Math.min(B, Math.round(e * 100) / 100));
735
745
  }
736
746
  function u() {
737
- l(i.value + Ie);
747
+ l(i.value + Le);
738
748
  }
739
749
  function d() {
740
- l(i.value - Ie);
750
+ l(i.value - Le);
741
751
  }
742
752
  function f() {
743
753
  l(1);
@@ -763,8 +773,8 @@ function $e(t = 1) {
763
773
  handleWheel: p,
764
774
  handleKeyDown: m,
765
775
  installShortcuts: h,
766
- ZOOM_PRESETS: H
776
+ ZOOM_PRESETS: V
767
777
  };
768
778
  }
769
779
  //#endregion
770
- export { P as a, E as c, F as i, O as l, w as n, M as o, z as r, k as s, $e as t, A as u };
780
+ export { N as a, E as c, P as i, O as l, w as n, j as o, R as r, He as s, tt as t, k as u };