@stll/folio-vue 0.28.0 → 0.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/README.md +5 -0
  2. package/dist/{SplitCellDialog-Dge_CE-B.cjs → SplitCellDialog-Bc2TjxMb.cjs} +1 -1
  3. package/dist/{SplitCellDialog-Vl4gq22E.js → SplitCellDialog-DULmbU_P.js} +6 -6
  4. package/dist/StylePicker-CD28Jh8D.cjs +4 -0
  5. package/dist/{StylePicker-CfC5Ef1i.js → StylePicker-D8VHvoMT.js} +664 -591
  6. package/dist/components/AnonymizationRectsOverlay.vue.d.ts +7 -4
  7. package/dist/components/AutocompleteSuggestionOverlay.vue.d.ts +5 -0
  8. package/dist/components/ContentControlWidgetsOverlay.vue.d.ts +5 -1
  9. package/dist/components/DocumentOutline.vue.d.ts +2 -0
  10. package/dist/components/DocxEditor/DocxEditorDialogs.vue.d.ts +3 -2
  11. package/dist/components/DocxEditor/pagedEditorRef.d.ts +11 -9
  12. package/dist/components/DocxEditor/types.d.ts +81 -18
  13. package/dist/components/DocxEditor.vue.d.ts +1 -1
  14. package/dist/components/FormattingBar.types.d.ts +2 -1
  15. package/dist/components/ReviewControls.vue.d.ts +2 -2
  16. package/dist/components/Toolbar.vue.d.ts +6 -5
  17. package/dist/components/UnifiedSidebar.vue.d.ts +3 -0
  18. package/dist/components/dialogs/FootnotePropertiesDialog.vue.d.ts +2 -2
  19. package/dist/components/dialogs/ImagePositionDialog.vue.d.ts +2 -2
  20. package/dist/components/dialogs/PageSetupDialog.vue.d.ts +4 -3
  21. package/dist/components/dialogs/SetNumberingValueDialog.vue.d.ts +2 -2
  22. package/dist/components/dialogs/TablePropertiesDialog.vue.d.ts +2 -2
  23. package/dist/components/dialogs/WatermarkDialog.vue.d.ts +4 -3
  24. package/dist/components/sidebar/CommentCard.vue.d.ts +2 -2
  25. package/dist/components/ui/ColorPicker.vue.d.ts +2 -1
  26. package/dist/components/ui/HorizontalRuler.vue.d.ts +4 -3
  27. package/dist/components/ui/TableBorderColorPicker.vue.d.ts +2 -1
  28. package/dist/components/ui/TableCellFillPicker.vue.d.ts +2 -1
  29. package/dist/components/ui/TableToolbar.vue.d.ts +2 -1
  30. package/dist/components/ui/VerticalRuler.vue.d.ts +3 -2
  31. package/dist/composables/commentMarks.d.ts +5 -14
  32. package/dist/composables/documentChrome.d.ts +14 -0
  33. package/dist/composables/useCommentLifecycle.d.ts +0 -2
  34. package/dist/composables/useCommentManagement.d.ts +5 -0
  35. package/dist/composables/useDocxEditor.d.ts +59 -15
  36. package/dist/composables/useDocxEditorRefApi.d.ts +20 -15
  37. package/dist/composables/useFontLifecycle.d.ts +2 -3
  38. package/dist/composables/useOutlineDrawerFocus.d.ts +1 -1
  39. package/dist/composables/usePageSetupControls.d.ts +2 -2
  40. package/dist/composables/usePagesPointer.d.ts +3 -2
  41. package/dist/composables/useParagraphStyleOptions.d.ts +2 -1
  42. package/dist/composables/useTableResize.d.ts +6 -1
  43. package/dist/composables.cjs +1 -1
  44. package/dist/composables.js +1 -1
  45. package/dist/dialogs.cjs +1 -1
  46. package/dist/dialogs.js +1 -1
  47. package/dist/folio-vue.css +1 -1
  48. package/dist/index.cjs +1 -1
  49. package/dist/index.d.ts +4 -4
  50. package/dist/index.js +2355 -2262
  51. package/dist/ui.cjs +1 -1
  52. package/dist/ui.js +28 -28
  53. package/dist/useZoom-BGTTHZwV.js +1119 -0
  54. package/dist/useZoom-u9lZMwJR.cjs +1 -0
  55. package/dist/utils/listItems.d.ts +7 -0
  56. package/dist/utils/rawDocument.d.ts +13 -0
  57. package/dist/utils/stylePreview.d.ts +2 -1
  58. package/package.json +9 -9
  59. package/dist/StylePicker-Bgu0Slqa.cjs +0 -4
  60. package/dist/useZoom-CKHgvyHZ.js +0 -1014
  61. package/dist/useZoom-Db3Q3xP7.cjs +0 -1
@@ -1,1014 +0,0 @@
1
- import { computed as e, inject as t, onBeforeUnmount as n, onMounted as r, onScopeDispose as i, provide as a, reactive as o, ref as s, shallowRef as c, toValue as l, watch as u, watchEffect as d } from "vue";
2
- import { CanonicalSessionRefusalError as f, collectRemoteSelections as ee, createHiddenEditorManager as p, createHiddenEditorState as te } from "@stll/folio-core/controller/hiddenEditorManager";
3
- import { cloneDocumentWithParagraphPropertySources as m } from "@stll/folio-core/docx/document-clone";
4
- import { withHostCommentThreads as h } from "@stll/folio-core/docx/hostCommentThreads";
5
- import { getEditorReadOnlyReason as g } from "@stll/folio-core/managers/EditorModeManager";
6
- import { getEditorScrollRoot as _, scrollEditorBy as v } from "@stll/folio-core/paged-layout/editorScrollRoot";
7
- import { getMargins as y, getPageSize as b, twipsToPixels as x } from "@stll/folio-core/paged-layout/sectionGeometry";
8
- import { CANONICAL_GAP as S, canonicalRefusalMessage as ne, usesCanonicalSession as re } from "@stll/folio-core/types/canonicalCapabilities";
9
- import { lockHeldRevisions as C, trackedChangeEntryRevisionIds as w } from "@stll/folio-core/prosemirror/commands/comments";
10
- import { createSuggestionModePlugin as ie, setSuggestionMode as ae } from "@stll/folio-core/prosemirror/plugins/suggestionMode";
11
- import { loadCollaborationModules as oe } from "@stll/folio-core/controller/collaborationModules";
12
- import { FOLIO_DOCX_SERIALIZATION_MODE as T, createFolioEditor as se } from "@stll/folio-core/controller/folioEditor";
13
- import { createFolioEditorEmitter as ce } from "@stll/folio-core/controller/folioEditorEvents";
14
- import { readFontSetSignature as le, waitForInitialLayoutFonts as ue, watchLayoutFontLoads as de } from "@stll/folio-core/controller/fontReadiness";
15
- import { createHeaderFooterEditorManager as E } from "@stll/folio-core/controller/headerFooterEditorManager";
16
- import { createHyphenationReadiness as fe } from "@stll/folio-core/controller/hyphenationReadiness";
17
- import { runLayoutPipeline as pe } from "@stll/folio-core/controller/layoutPipeline";
18
- import { TRANSACTION_LAYOUT_TIMING as me, browserClock as he, createLayoutScheduler as ge } from "@stll/folio-core/controller/layoutScheduler";
19
- import { createLayoutSession as _e } from "@stll/folio-core/controller/layoutSession";
20
- import { createNoteEditorManager as ve } from "@stll/folio-core/controller/noteEditorManager";
21
- import { CanonicalSaveDiagnosticError as ye, serializeCanonicalSave as be } from "@stll/folio-core/docx/canonicalSave";
22
- import { prepareCanonicalDocxInput as xe } from "@stll/folio-core/docx/canonicalSessionInput";
23
- import { parseDocx as Se } from "@stll/folio-core/docx/parser";
24
- import { getFootnoteText as Ce } from "@stll/folio-core/docx/storyPlainText";
25
- import { convertHeaderFooterPmDocToContent as we, convertHeaderFooterToContent as Te } from "@stll/folio-core/layout-bridge/convert/headerFooterLayout";
26
- import { resolveSectionHeaderFooterRefs as Ee } from "@stll/folio-core/layout-engine";
27
- import { LayoutPainter as De, releaseDisplayPageResources as Oe } from "@stll/folio-core/layout-painter";
28
- import { LayoutSelectionGate as ke } from "@stll/folio-core/paged-layout/LayoutSelectionGate";
29
- import { fromProseDoc as Ae } from "@stll/folio-core/prosemirror/conversion/fromProseDoc";
30
- import { ExtensionManager as je } from "@stll/folio-core/prosemirror/extensions/ExtensionManager";
31
- import { getChangedParagraphIds as Me, hasStructuralChanges as Ne, hasUntrackedChanges as Pe, repackWithEditorSectionRemovals as Fe } from "@stll/folio-core/prosemirror/extensions/features/ParagraphChangeTrackerExtension";
32
- import { createStarterKit as Ie } from "@stll/folio-core/prosemirror/extensions/StarterKit";
33
- import { createNoteReferenceFollower as Le, withoutUnreferencedNotes as Re } from "@stll/folio-core/prosemirror/noteReferenceReview";
34
- import { createAnonymizationDecorationsPlugin as ze } from "@stll/folio-core/prosemirror/plugins/anonymizationDecorations";
35
- import { autocompleteSuggestionPlugin as Be } from "@stll/folio-core/prosemirror/plugins/autocompleteSuggestion";
36
- import { createTemplateDirectivesPlugin as Ve } from "@stll/folio-core/prosemirror/plugins/templateDirectives";
37
- import { createTemplatePreviewValuesPlugin as He } from "@stll/folio-core/prosemirror/plugins/templatePreviewValues";
38
- import { templateSlashMenuPlugin as Ue } from "@stll/folio-core/prosemirror/plugins/templateSlashMenu";
39
- import { resolveHeaderFooterContent as We } from "@stll/folio-core/utils/headerFooter";
40
- import { FindReplaceManager as Ge } from "@stll/folio-core/managers/FindReplaceManager";
41
- import { findInDisplayedDocument as Ke, resolveFindMatchRange as qe } from "@stll/folio-core/prosemirror/findReplaceSelection";
42
- import { createFindMatchView as Je, getRenderedSearchStories as D } from "@stll/folio-core/utils/findMatchView";
43
- import { createDefaultFindOptions as Ye, replaceEligibility as Xe } from "@stll/folio-core/utils/findReplace";
44
- import { createFindSearchKey as Ze, sameFindSearchKey as Qe } from "@stll/folio-core/utils/findSearchKey";
45
- import { MIN_CELL_WIDTH_TWIPS as $e, MIN_ROW_HEIGHT_TWIPS as O, TWIPS_PER_PIXEL as k, clampRowResizeDelta as et, commitColumnResize as tt, commitRightEdgeResize as nt, commitRowResize as rt, readColumnWidthAt as it, readColumnWidths as at, readRowHeight as ot } from "@stll/folio-core/prosemirror/tableResize";
46
- import { extractTrackedChanges as st } from "@stll/folio-core/prosemirror/utils/extractTrackedChanges";
47
- import { ZOOM_MAX as ct, ZOOM_MIN as A, ZOOM_STEP as j } from "@stll/folio-core/utils/zoom";
48
- // src/utils/colorMode.ts
49
- var lt = "(prefers-color-scheme: dark)";
50
- function M() {
51
- return typeof window < "u" && typeof window.matchMedia == "function";
52
- }
53
- function N(e, t) {
54
- return e === "dark" || e === "system" && t;
55
- }
56
- function P(e) {
57
- if (!M()) return () => {};
58
- let t = window.matchMedia(lt);
59
- e(t.matches);
60
- let n = (t) => e(t.matches);
61
- return t.addEventListener("change", n), () => t.removeEventListener("change", n);
62
- }
63
- // src/composables/useColorMode.ts
64
- var F = "light", I = Symbol("folioColorMode"), L = (t = F) => {
65
- a(I, e(() => l(t)));
66
- }, ut = { install(t, n = F) {
67
- t.provide(I, e(() => l(n)));
68
- } };
69
- function R() {
70
- let n = t(I, e(() => F)), i = s(!1), a = s(!1);
71
- return r(() => {
72
- i.value = !0;
73
- }), d((e) => {
74
- i.value && n.value === "system" && e(P((e) => {
75
- a.value = e;
76
- }));
77
- }), e(() => N(n.value, i.value && a.value));
78
- }
79
- // src/composables/useDocxEditor.ts
80
- var dt = 24, ft = "User", pt = 250, mt = [], ht = [];
81
- function gt(e) {
82
- let t = e?.columnCount ?? 1;
83
- if (t <= 1) return;
84
- let n = {
85
- count: t,
86
- gap: x(e?.columnSpace ?? 720),
87
- equalWidth: e?.equalWidth ?? !0
88
- };
89
- return e?.separator !== void 0 && (n.separator = e.separator), n;
90
- }
91
- function _t(e, t, n, r, i, a) {
92
- if (!e) return;
93
- let o = t ? {
94
- ...a,
95
- rId: t
96
- } : a, s = t ? n?.getView(t) : null;
97
- return s ? we(s.state.doc, r, i, o) : Te(e, r, i, o);
98
- }
99
- function vt(e, t, n, r, i) {
100
- if (!e || e.size === 0) return;
101
- let a = /* @__PURE__ */ new Map();
102
- for (let [o, s] of e) {
103
- let e = _t(s, o, t, n, r, i);
104
- e && a.set(o, e);
105
- }
106
- return a.size > 0 ? a : void 0;
107
- }
108
- function yt(e, t, n) {
109
- let r = /* @__PURE__ */ new Map();
110
- if (!n || !n.package.footnotes) return r;
111
- let i = /* @__PURE__ */ new Map();
112
- for (let e of n.package.footnotes) e.noteType && e.noteType !== "normal" || i.set(e.id, e);
113
- for (let [n, a] of e) {
114
- let e = [];
115
- for (let n of a) {
116
- let r = i.get(n);
117
- if (!r) continue;
118
- let a = t.get(n), o = a?.displayNumber ?? 0;
119
- e.push({
120
- displayNumber: String(o),
121
- noteId: n,
122
- text: Ce(r),
123
- ...a ? { content: {
124
- blocks: a.blocks,
125
- measures: a.measures,
126
- height: a.height
127
- } } : {}
128
- });
129
- }
130
- e.length > 0 && r.set(n, e);
131
- }
132
- return r;
133
- }
134
- var z = /* @__PURE__ */ new Set([
135
- "black",
136
- "blue",
137
- "cyan",
138
- "darkBlue",
139
- "darkCyan",
140
- "darkGray",
141
- "darkGreen",
142
- "darkMagenta",
143
- "darkRed",
144
- "darkYellow",
145
- "green",
146
- "lightGray",
147
- "magenta",
148
- "none",
149
- "red",
150
- "white",
151
- "yellow"
152
- ]);
153
- function bt(e) {
154
- let t = [], n = (e, r) => {
155
- for (let [n, i] of e.marks.entries()) i.type.name === "highlight" && !z.has(String(i.attrs.color)) && t.push(`${r}.marks[${n}]=${JSON.stringify(i.attrs)}`);
156
- e.forEach((e, t, i) => {
157
- n(e, `${r}.content[${i}]`);
158
- });
159
- };
160
- return n(e, "doc"), t.join("; ");
161
- }
162
- function xt(e) {
163
- let { comments: t, hiddenContainer: n, hiddenHeaderFooterContainer: r, noteEditorContainer: a, pagesContainer: o, readOnly: d = !1, experimentalSession: g, pageGap: _ = dt, pageRenderer: v, markupView: x = "all-markup", showCommentHighlights: C = !0, altChunkMarkerText: w, showMarginGuides: Ce, marginGuideColor: we, password: Te, editorMode: Ge, author: Ke, externalPlugins: qe = [], historyShortcuts: Je = "editor", collaboration: D, onAnonymizationMatchesChange: Ye, showTemplateDirectives: Xe, onSlashMenuChange: Ze, onSlashMenuKeyAction: Qe, onChange: $e, onError: O, onSelectionUpdate: k, onEditorViewReady: et, onCopy: tt, onCut: nt, onPaste: rt, onReadOnlyEditAttempt: it, featureFlags: at, onSelectiveSaveTripwire: ot } = e, st = r ?? n, ct = () => l(Ke) ?? ft, A = c(null), j = 0, lt = !1, M = 0, N = !1, P = c(null), F = c(null), I = c(null), L = c([]), ut = c(null), R = c(null), z = c(null), xt = c([]), St = c([]), B = s(!1), V = s(null), H = s(!1), U = () => re(l(g), S.authorityRouting), W = (e) => U() ? m(e) : e, Ct = (e, t) => {
164
- if (!U()) return !1;
165
- let n = new f({
166
- ground: { gap: e },
167
- message: ne(e, t)
168
- });
169
- return O?.(n), !0;
170
- }, G = new je(Ie({ historyShortcuts: Je }));
171
- G.buildSchema(), G.initializeRuntime();
172
- let wt = ie(!1), Tt = [wt], Et = Be({ keymap: !0 }), Dt = ze({ onMatchesChange: (e) => Ye?.(e) }), Ot = Ve(), kt = Ue({
173
- onChange: (e) => Ze?.(e),
174
- onKeyAction: (e) => Qe?.(e) ?? !1
175
- }), At = He(), jt = () => l(Xe) === !0;
176
- function Mt() {
177
- return [
178
- Et,
179
- wt,
180
- ...qe,
181
- ...l(D)?.plugins ?? [],
182
- Dt,
183
- ...jt() ? [Ot, kt] : [],
184
- At
185
- ];
186
- }
187
- let K = ce(), q = new ke(), Nt = _e(), Pt = fe({
188
- relayout: () => {
189
- let e = P.value?.state ?? Nt.lastEditorState;
190
- e && Z(e, { reason: "hyphenation-ready" });
191
- },
192
- onError: (e) => O?.(e)
193
- });
194
- i(Pt.cancel), i(de({
195
- measuredFontSet: () => Nt.lastMeasureInputs?.fontSet ?? null,
196
- relayout: () => {
197
- if (N) return;
198
- let e = P.value?.state ?? Nt.lastEditorState;
199
- e && Z(e, { reason: "font-ready" });
200
- }
201
- }));
202
- let Ft = new De({
203
- pageGap: _,
204
- showShadow: !0
205
- }), J = E({
206
- getHost: () => st.value,
207
- getReadOnly: () => l(d),
208
- getDocument: () => $.api.getCanonicalDocument() ?? A.value,
209
- getCanonicalApi: () => $.api,
210
- getExperimentalSession: () => l(g),
211
- onSessionRefusal: (e, t, n) => {
212
- V.value = e, O?.(n ?? new f({
213
- ground: t,
214
- message: e
215
- }));
216
- },
217
- getStyles: () => A.value?.package.styles ?? null,
218
- getTheme: () => A.value?.package.theme ?? null,
219
- onTransaction: ({ rId: e, kind: t, view: n, docChanged: r, selectionChanged: i }) => {
220
- if (r && (H.value = !0, Rt.schedule()), r || i) {
221
- let { from: r, to: i } = n.state.selection;
222
- ut.value = {
223
- from: r,
224
- kind: t,
225
- rId: e,
226
- to: i
227
- }, k?.(n.state), K.emit("selectionChange", {
228
- from: r,
229
- to: i
230
- });
231
- }
232
- q.requestRender();
233
- }
234
- }), It = { current: null }, Y = ve({
235
- getHost: () => a?.value ?? null,
236
- getPlugins: () => Tt,
237
- getDocument: () => $.api.getCanonicalDocument() ?? A.value,
238
- getCanonicalApi: () => $.api,
239
- getExperimentalSession: () => l(g),
240
- onSessionRefusal: (e, t, n) => {
241
- V.value = e, O?.(n ?? new f({
242
- ground: t,
243
- message: e
244
- }));
245
- },
246
- getStyles: () => A.value?.package.styles ?? null,
247
- getTheme: () => A.value?.package.theme ?? null,
248
- onTransaction: ({ docChanged: e, selectionChanged: t, view: n }) => {
249
- if (e) {
250
- H.value = !0;
251
- let e = A.value;
252
- if (e) {
253
- let t = $.api.getCanonicalDocument() ?? It.current?.snapshotDocument(e) ?? e;
254
- A.value = t, $e?.(W(t)), K.emit("docChange", W(t));
255
- }
256
- Rt.schedule();
257
- }
258
- if (e || t) {
259
- k?.(n.state);
260
- let { from: e, to: t } = n.state.selection;
261
- K.emit("selectionChange", {
262
- from: e,
263
- to: t
264
- });
265
- }
266
- }
267
- });
268
- It.current = Y;
269
- let X = () => {
270
- J.sync(), Y.sync();
271
- };
272
- u(() => l(g), X);
273
- function Lt(e) {
274
- e.layout && (z.value = e.layout), e.blocks && (xt.value = e.blocks), e.measures && (St.value = e.measures), e.blockLookup && Ft.setBlockLookup(e.blockLookup), e.layout && K.emit("layoutComplete", e.layout);
275
- }
276
- function Z(e, t = {}) {
277
- if (N) return;
278
- let n = o.value, r = n instanceof HTMLDivElement ? n : null, i = A.value, a = i?.package.document, s = a?.sections?.[0]?.properties ?? a?.finalSectionProperties ?? null, c = b(s), u = y(s), d = gt(s), f = c.w - u.left - u.right, ee = i?.package.styles ?? null, p = i?.package.theme ?? null, te = i?.package.settings?.defaultTabStop, m = i?.package.settings?.mirrorMargins === !0, h = We(i?.package);
279
- try {
280
- Lt(pe({
281
- contentWidth: f,
282
- columns: d,
283
- pageSize: c,
284
- margins: u,
285
- pageGap: _,
286
- showMarginGuides: l(Ce) === !0,
287
- marginGuideColor: l(we),
288
- ...(() => {
289
- let e = l(v);
290
- return e === void 0 ? {} : { pageRenderer: e };
291
- })(),
292
- syncCoordinator: q,
293
- headerContent: h.headerContent,
294
- footerContent: h.footerContent,
295
- firstPageHeaderContent: h.firstPageHeaderContent,
296
- firstPageFooterContent: h.firstPageFooterContent,
297
- headerContentRId: h.activeHeaderRId,
298
- footerContentRId: h.activeFooterRId,
299
- firstPageHeaderContentRId: h.activeFirstHeaderRId,
300
- firstPageFooterContentRId: h.activeFirstFooterRId,
301
- sectionHeaderFooterRefs: Ee(i),
302
- theme: p,
303
- sectionProperties: s,
304
- document: i,
305
- defaultTabStop: te,
306
- mirrorMargins: m,
307
- styles: ee,
308
- layout: z.value,
309
- hfPMs: J,
310
- painter: Ft,
311
- pagesContainer: r,
312
- session: Nt,
313
- renderHfFromContentOrPm: _t,
314
- renderHeaderFooterContentByRId: vt,
315
- readFontSetSignature: le,
316
- buildFootnoteRenderItems: yt,
317
- describeInvalidHighlightMarks: bt,
318
- emptyTemplatePreviewEntries: mt,
319
- emptyTemplatePreviewHidden: ht,
320
- hyphenationReadiness: Pt,
321
- markupView: l(x),
322
- showCommentHighlights: l(C),
323
- ...w === void 0 ? {} : { altChunkMarkerText: l(w) }
324
- }, e, t));
325
- } catch (e) {
326
- let t = e instanceof Error ? e : Error(String(e));
327
- O?.(t);
328
- }
329
- }
330
- let Rt = ge({
331
- readState: () => P.value?.state ?? null,
332
- runLayout: (e, t) => Z(e, t),
333
- ...me,
334
- clock: he
335
- }), Q = null, zt = Le();
336
- function Bt() {
337
- Q !== null && (window.clearTimeout(Q), Q = null);
338
- let e = P.value, t = A.value;
339
- if (e && t) try {
340
- let n = $.api.getCanonicalDocument();
341
- if (!n && U()) return;
342
- let r = n ?? zt.reconcile(Ae(e.state.doc, t, { stylesheetSource: { type: "package" } }), e.state.doc);
343
- A.value = r, X(), $e?.(W(r)), K.emit("docChange", W(r));
344
- } catch (e) {
345
- O?.(e instanceof Error ? e : Error(String(e)));
346
- }
347
- }
348
- function Vt() {
349
- Q !== null && window.clearTimeout(Q), Q = window.setTimeout(() => {
350
- Q = null, Bt();
351
- }, pt);
352
- }
353
- let $ = p({
354
- getHost: () => n.value,
355
- getDocument: () => A.value,
356
- getStyles: () => A.value?.package.styles ?? null,
357
- getExtensionManager: () => G,
358
- getExternalPlugins: Mt,
359
- getCollaboration: () => l(D),
360
- getCollaborationModules: () => I.value,
361
- getPrecomputedInitialState: () => null,
362
- getReadOnly: () => l(d),
363
- getExperimentalSession: () => l(g),
364
- getEditingMode: () => l(Ge) ?? "editing",
365
- getSuggestionAuthor: ct,
366
- onSessionRefusal: (e, t, n) => {
367
- O?.(n ?? new f({
368
- ground: t,
369
- message: e
370
- }));
371
- },
372
- getDocumentIdentity: () => String(j),
373
- getDocumentContext: () => A.value,
374
- onTransaction: Ut,
375
- onCanonicalCompositionEnd: () => Rt.schedule(),
376
- onSelectionChange: (e) => {
377
- F.value = e, k?.(e), K.emit("selectionChange", {
378
- from: e.selection.from,
379
- to: e.selection.to
380
- });
381
- },
382
- onKeyDown: () => !1,
383
- onCopy: () => tt?.(),
384
- onCut: () => nt?.(),
385
- onPaste: () => rt?.(),
386
- onReadOnlyEditAttempt: () => it?.(),
387
- onEditorViewReady: Wt,
388
- onEditorViewDestroy: () => {
389
- P.value = null, B.value = !1, et?.(null);
390
- },
391
- onRemoteSelectionsChange: (e) => {
392
- L.value = e;
393
- }
394
- }), Ht = () => {
395
- let e = l(D)?.awareness, t = I.value, n = $.getView();
396
- L.value = e && t && n ? ee(n.state, e, t) : [];
397
- };
398
- u(() => l(D), (e, t, n) => {
399
- if (L.value = [], !e) {
400
- I.value = null, $.retryViewCreation(), $.syncExternalDocument();
401
- return;
402
- }
403
- let r = !1;
404
- n(() => {
405
- r = !0;
406
- }), I.value = null, oe().then((e) => {
407
- r || (I.value = e, $.retryViewCreation(), $.syncExternalDocument(), Ht());
408
- }, (e) => {
409
- r || (I.value = null, O?.(e instanceof Error ? e : Error(String(e))));
410
- });
411
- }, { immediate: !0 }), u(() => ({
412
- awareness: l(D)?.awareness,
413
- modules: I.value,
414
- view: P.value
415
- }), ({ awareness: e, modules: t, view: n }, r, i) => {
416
- !e || !t || !n ? L.value = [] : (e.on("change", Ht), Ht(), i(() => {
417
- e.off("change", Ht), L.value = [];
418
- }));
419
- }, { flush: "post" });
420
- function Ut({ newState: e, docChanged: t, transactions: n }) {
421
- F.value = e;
422
- let r = n[0]?.before;
423
- if (t && r && zt.noteBase(r), t) {
424
- let e = $.api.getCanonicalDocument();
425
- e && (A.value = e, X()), H.value = !0, q.incrementStateSeq(), Rt.schedule(), Vt();
426
- }
427
- q.requestRender();
428
- }
429
- function Wt(e) {
430
- P.value = e, F.value = e.state, B.value = !0;
431
- let t = A.value, n = j, r = ++M;
432
- N = !0;
433
- let i = () => {
434
- M === r && (N = !1, !(lt || j !== n || $.getView() !== e) && (Z(e.state, { reason: "initial" }), q.requestRender()));
435
- };
436
- ue(t, e.state.doc).then(i, i), qt(e), et?.(e), l(d) || requestAnimationFrame(() => {
437
- P.value === e && e.focus();
438
- });
439
- }
440
- let Gt = {
441
- getDocx: async (e) => (await en(e))?.buffer ?? null,
442
- loadDocument: $t,
443
- loadDocx: Qt
444
- }, Kt = se({
445
- getEditorApi: () => $.api,
446
- getLayout: () => z.value,
447
- runLayout: (e, t) => Z(e, t),
448
- getDocumentIO: () => Gt,
449
- emitter: K
450
- });
451
- function qt(e) {
452
- let t = l(Ge) === "suggesting";
453
- ae(t, e.state, e.dispatch, ct());
454
- }
455
- u([() => l(Ge), ct], () => {
456
- Kt.setCanonicalMode(l(Ge) === "suggesting" ? {
457
- type: "suggesting",
458
- author: ct()
459
- } : { type: "editing" });
460
- let e = P.value;
461
- e && qt(e);
462
- for (let e of Y.listStories()) {
463
- let t = Y.getView(e);
464
- t && qt(t);
465
- }
466
- }), u(() => l(d), (e) => {
467
- $.syncEditable(), e && cn(), J.sync();
468
- });
469
- function Jt(e) {
470
- let t = jt();
471
- if (t === e.state.plugins.includes(Ot)) return;
472
- let n = e.state.plugins.filter((e) => e !== Ot && e !== kt);
473
- if (t) {
474
- let e = n.indexOf(At), t = e === -1 ? n.length : e;
475
- n.splice(t, 0, Ot, kt);
476
- }
477
- e.updateState(e.state.reconfigure({ plugins: n }));
478
- }
479
- u(() => jt(), () => {
480
- let e = P.value;
481
- e && Jt(e);
482
- });
483
- function Yt() {
484
- $.ensureView();
485
- }
486
- function Xt() {
487
- j += 1, H.value = !1, ut.value = null, R.value = null, Y.activate(null), Rt.dispose(), $.destroyView(), U() && $.ensureView(), X(), $.ensureView(), $.getView() || Zt();
488
- }
489
- function Zt() {
490
- let e = A.value;
491
- if (e && !l(D)) try {
492
- let t = te({
493
- document: e,
494
- styles: e.package.styles ?? null,
495
- manager: G,
496
- externalPlugins: Mt(),
497
- collaborationModules: null,
498
- reason: "mount"
499
- });
500
- F.value = t;
501
- let n = j, r = ++M;
502
- N = !0;
503
- let i = () => {
504
- M === r && (N = !1, !(lt || j !== n || A.value !== e || $.getView()) && Z(t, { reason: "initial" }));
505
- };
506
- ue(e, t.doc).then(i, i);
507
- } catch (e) {
508
- O?.(e instanceof Error ? e : Error(String(e)));
509
- }
510
- }
511
- u([
512
- n,
513
- o,
514
- st,
515
- ...a ? [a] : []
516
- ], () => {
517
- n.value && A.value && !$.getView() && Yt(), X();
518
- }, { flush: "post" });
519
- async function Qt(e) {
520
- V.value = null, B.value = !1;
521
- try {
522
- let t = e;
523
- if (U()) {
524
- let n = await xe(e);
525
- if (n.isErr()) throw n.error;
526
- t = n.value;
527
- }
528
- let n = await Se(t, { password: l(Te) });
529
- A.value = n, Xt();
530
- } catch (e) {
531
- let t = e instanceof Error ? e : Error(String(e));
532
- V.value = t.message, O?.(t);
533
- }
534
- }
535
- function $t(e) {
536
- V.value = null, A.value = e, zt.reset(), Xt();
537
- }
538
- async function en(e) {
539
- let n = P.value, r = A.value;
540
- if (!n || !r) return null;
541
- try {
542
- let t = $.api.captureCanonicalSave();
543
- if (t) {
544
- let n = await be({
545
- snapshot: t,
546
- options: e,
547
- featureFlags: l(at)
548
- });
549
- for (let t of n.diagnostics) e?.onDiagnostic || O?.(new ye({
550
- gap: S.save,
551
- diagnostic: t,
552
- message: `Canonical save used a fidelity fallback: ${t.type} (${t.part}).`
553
- }));
554
- return n.tripwireResult && ot?.(n.tripwireResult), n;
555
- }
556
- } catch (e) {
557
- return O?.(e instanceof Error ? e : Error(String(e))), null;
558
- }
559
- if (U()) return null;
560
- Q !== null && Bt();
561
- let i = Y.snapshotDocument(J.snapshotDocument(r)), a = n.state, o = Ae(a.doc, i, { stylesheetSource: { type: "package" } }), s = Re(t ? h(o, t()) : o), { resolveSelectiveSaveFlags: c } = await import("@stll/folio-core/docx/selectiveSaveFlags"), u = c(l(at)), d = s.originalBuffer ?? null, f = u.selectiveSave && e?.mode !== T.full, ee = f || u.selectiveSaveTripwire, { repackDocx: p, createDocx: te } = await import("@stll/folio-core/docx/rezip"), m = null;
562
- if (ee && d) {
563
- let { attemptSelectiveSave: e } = await import("@stll/folio-core/docx/selectiveSave");
564
- m = await e(s, d, {
565
- changedParaIds: Me(a),
566
- structuralChange: Ne(a),
567
- hasUntrackedChanges: Pe(a),
568
- maxBytes: u.selectiveSaveMaxBytes
569
- });
570
- }
571
- let g = f ? m : null, _ = null, v = () => Fe({
572
- state: a,
573
- document: s,
574
- repack: () => p(s)
575
- });
576
- if (!g) _ = d ? await v() : await te(s), g = _;
577
- else if (u.selectiveSaveTripwire) try {
578
- _ = await v();
579
- } catch {}
580
- if (u.selectiveSaveTripwire && _ && ot) try {
581
- let { compareSelectiveVsFull: e } = await import("@stll/folio-core/docx/selectiveSaveTripwire");
582
- ot(await e(m, _));
583
- } catch {}
584
- return {
585
- buffer: g,
586
- document: s
587
- };
588
- }
589
- async function tn(e) {
590
- let t = P.value, n = t?.state, r = await en({ mode: e?.selective === !1 ? T.full : T.preferSelective });
591
- return r ? (P.value === t && t?.state.doc === n?.doc && (r.version === void 0 || $.api.isCanonicalSaveCurrent(r.version)) && (A.value = r.document, X(), H.value = !1), new Blob([r.buffer], { type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" })) : null;
592
- }
593
- function nn() {
594
- let e = $.api.getCanonicalDocument();
595
- if (e) return e;
596
- if (U()) return null;
597
- let t = A.value;
598
- if (!t) return null;
599
- let n = $.api.getDocument() ?? t;
600
- return W(Y.snapshotDocument(J.snapshotDocument(n)));
601
- }
602
- function rn(e) {
603
- Ct(S.modelEdits, "Direct document model changes are unavailable in this session.") || (A.value = e, X(), R.value && !Y.getView(R.value) && (R.value = null));
604
- }
605
- function an(e) {
606
- return J.getView(e);
607
- }
608
- function on() {
609
- X();
610
- }
611
- function sn(e) {
612
- let t = Y.activate(e);
613
- t && (qt(t), R.value = e, requestAnimationFrame(() => t.focus()));
614
- }
615
- function cn() {
616
- Y.activate(null), R.value = null;
617
- }
618
- function ln() {
619
- let e = R.value;
620
- return e ? Y.getView(e) : null;
621
- }
622
- function un() {
623
- return G.getCommands();
624
- }
625
- function dn() {
626
- let e = ln();
627
- e ? e.focus() : P.value?.focus();
628
- }
629
- function fn() {
630
- let e = P.value;
631
- e && Z(e.state, { reason: "manual" });
632
- }
633
- u([
634
- () => l(Ce),
635
- () => l(we),
636
- () => l(v),
637
- () => l(x),
638
- () => l(C),
639
- () => l(w)
640
- ], () => fn());
641
- function pn() {
642
- lt = !0, o.value && Oe(o.value), M += 1, N = !1, Rt.dispose(), Q !== null && (window.clearTimeout(Q), Q = null), $.destroyView(), L.value = [], J.destroy(), Y.destroy(), G.destroy(), F.value = null, z.value = null, A.value = null, B.value = !1;
643
- }
644
- return i(pn), {
645
- setEmbeddedFontFamilies: (e) => {
646
- e ? Nt.embeddedFontFamilyMap = new Map(e) : delete Nt.embeddedFontFamilyMap;
647
- },
648
- editor: Kt,
649
- editorView: P,
650
- editorState: F,
651
- remoteSelections: L,
652
- headerFooterSelection: ut,
653
- activeNoteStory: R,
654
- isReady: B,
655
- isDirty: H,
656
- parseError: V,
657
- layout: z,
658
- blocks: xt,
659
- measures: St,
660
- syncCoordinator: q,
661
- loadBuffer: Qt,
662
- loadDocument: $t,
663
- save: tn,
664
- getDocument: nn,
665
- setDocument: rn,
666
- getHeaderFooterView: an,
667
- syncHeaderFooterViews: on,
668
- openNoteStory: sn,
669
- closeNoteStory: cn,
670
- getActiveNoteView: ln,
671
- getCommands: un,
672
- focus: dn,
673
- reLayout: fn,
674
- destroy: pn
675
- };
676
- }
677
- // src/composables/useFindReplace.ts
678
- function St({ editorView: t, pagesRef: n, getDocument: r, layout: a, commentRoot: l, revealComment: d, displayMode: f, readOnly: ee, onReadonlyEditAttempt: p, onResultChange: te }) {
679
- let m = new Ge(), h = s(""), _ = s(""), v = o(Ye()), y = c([]), b = s(-1), x = e(() => y.value.at(b.value) ?? null), S = () => g({
680
- editingMode: t.value?.editable === !1 ? "viewing" : "editing",
681
- readOnlyProp: ee.value,
682
- displayMode: f.value
683
- }), ne = e(S), re = e(() => {
684
- let e = x.value;
685
- return S() === null && !!t.value && !!e && oe() && Xe(e).status === "allowed";
686
- }), C = null, w, ie = null, ae = (e) => {
687
- let n = t.value?.state.doc;
688
- return {
689
- query: h.value,
690
- options: {
691
- ...v,
692
- displayMode: f.value,
693
- includeComments: !!l
694
- },
695
- document: e,
696
- ...n ? { bodyVersion: n } : {},
697
- context: { renderedStories: D(a.value) }
698
- };
699
- }, oe = () => {
700
- let e = r();
701
- return !!e && Qe(ie, Ze(ae(e)));
702
- }, T = () => m.getResult(), se = () => te(T()), ce = () => {
703
- clearTimeout(w), w = void 0;
704
- }, le = () => {
705
- ce(), m.clear(), C?.destroy(), C = null, y.value = [], ie = null, b.value = -1;
706
- }, ue = () => {
707
- le(), h.value = "", se();
708
- }, de = (e) => (b.value = e, C?.navigate(e, d), se(), !0), E = (e = "query") => {
709
- ce();
710
- let i = r(), o = n.value, s = t.value?.state.doc;
711
- if (!i || !h.value.trim()) return ue(), [];
712
- let c = ae(i), u = Ke({
713
- document: c.document,
714
- state: t.value?.state ?? null,
715
- searchText: c.query,
716
- options: c.options,
717
- context: c.context
718
- });
719
- if (u === null) return le(), se(), [];
720
- let d = Ze(c), f = e === "refresh" && ie?.query === d.query, ee = m.setMatches(u, f ? m.getResult()?.currentIndex ?? 0 : 0);
721
- return ie = d, y.value = u, b.value = u.length > 0 ? ee.currentIndex : -1, C?.destroy(), C = o ? Je({
722
- container: o,
723
- document: i,
724
- bodyDoc: s,
725
- matches: u,
726
- commentRoot: l?.value ?? void 0,
727
- layout: a.value
728
- }) : null, C?.paint(b.value), u.at(0) && !f ? de(0) : se(), u;
729
- }, fe = () => {
730
- ce(), w = setTimeout(() => E("refresh"), 120);
731
- }, pe = (e, t) => (h.value = e, Object.assign(v, Ye(), t), E(), T()), me = (e) => {
732
- let t = m.goTo(e);
733
- return t ? de(t.index) : !1;
734
- }, he = (e) => {
735
- let t = m.navigate(e);
736
- return t ? (de(t.index), t.match) : null;
737
- }, ge = () => !oe() && (E("refresh"), !0), _e = () => {
738
- let e = S();
739
- return e !== null && (p?.(e), !0);
740
- };
741
- return u(f, () => {
742
- h.value.trim() && E();
743
- }), i(() => {
744
- ce(), C?.destroy();
745
- }), {
746
- searchText: h,
747
- replaceText: _,
748
- options: v,
749
- matches: y,
750
- currentIndex: b,
751
- currentMatch: x,
752
- canReplaceCurrent: re,
753
- replacementRefusal: ne,
754
- performSearch: E,
755
- scheduleSearch: fe,
756
- find: pe,
757
- getFindResult: T,
758
- goToMatch: me,
759
- findNext: () => he("next"),
760
- findPrevious: () => he("previous"),
761
- replaceCurrent: () => {
762
- let e = t.value;
763
- if (!e || _e() || ge()) return !1;
764
- let n = x.value;
765
- if (!re.value || !e || !n) return !1;
766
- if (n.text === _.value) return !0;
767
- let r = qe(e.state.doc, n);
768
- return r ? (e.dispatch(e.state.tr.insertText(_.value, r.from, r.to)), E("refresh"), !0) : !1;
769
- },
770
- replaceAll: () => {
771
- let e = t.value, n = y.value.length;
772
- if (!e || _e() || ge()) return {
773
- replacedCount: 0,
774
- skippedCount: n
775
- };
776
- let r = y.value.filter((e) => Xe(e).status === "allowed"), i = r.filter((e) => e.text === _.value).length, a = r.filter((e) => e.text !== _.value).flatMap((t) => {
777
- let n = qe(e.state.doc, t);
778
- return n ? [n] : [];
779
- }).toSorted((e, t) => t.from - e.from), o = a.length + i, s = {
780
- replacedCount: o,
781
- skippedCount: n - o
782
- };
783
- if (!a.length) return s;
784
- let c = e.state.tr;
785
- for (let e of a) c = c.insertText(_.value, e.from, e.to);
786
- return e.dispatch(c), E(), s;
787
- },
788
- clear: ue
789
- };
790
- }
791
- function B(e, t) {
792
- if (t < e.top + 40) {
793
- let n = Math.max(0, e.top + 40 - t);
794
- return -Math.min(12, n / 40 * 12);
795
- }
796
- if (t > e.bottom - 40) {
797
- let n = Math.max(0, t - (e.bottom - 40));
798
- return Math.min(12, n / 40 * 12);
799
- }
800
- return 0;
801
- }
802
- // src/composables/useDragAutoScroll.ts
803
- function V({ pagesContainer: e, onScrollExtendSelection: t }) {
804
- let n = null, r = 0, a = 0, o = !1;
805
- function s() {
806
- return _(e.value);
807
- }
808
- function c() {
809
- o = !1, n !== null && (cancelAnimationFrame(n), n = null);
810
- }
811
- function l() {
812
- if (!o) return;
813
- let e = s();
814
- if (!e) return;
815
- let i = B(e.getBoundingClientRect(), a);
816
- i !== 0 && (v(e, i), t(r, a)), n = requestAnimationFrame(l);
817
- }
818
- function u() {
819
- o || (o = !0, n = requestAnimationFrame(l));
820
- }
821
- function d(e, t) {
822
- if (r = e, a = t, !o) {
823
- let e = s();
824
- if (!e) return;
825
- let n = e.getBoundingClientRect();
826
- (t < n.top + 40 || t > n.bottom - 40) && u();
827
- }
828
- }
829
- return i(() => c()), {
830
- updateMousePosition: d,
831
- stopAutoScroll: c
832
- };
833
- }
834
- // src/composables/useTableResize.ts
835
- function H() {
836
- let e = {
837
- active: !1,
838
- startX: 0,
839
- handle: null,
840
- columnIndex: 0,
841
- tablePmStart: 0,
842
- origWidths: {
843
- left: 0,
844
- right: 0
845
- }
846
- }, t = {
847
- active: !1,
848
- startY: 0,
849
- handle: null,
850
- rowIndex: 0,
851
- isEdge: !1,
852
- tablePmStart: 0,
853
- origHeight: 0,
854
- minimumHeight: O
855
- }, n = {
856
- active: !1,
857
- startX: 0,
858
- handle: null,
859
- columnIndex: 0,
860
- tablePmStart: 0,
861
- origWidth: 0
862
- }, r = null;
863
- function i() {
864
- return e.active || t.active || n.active;
865
- }
866
- function a(i, a) {
867
- let o = i.target;
868
- 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), U(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), W(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), Ct(a, n), !0) : !1 : !1;
869
- }
870
- function o(r) {
871
- if (e.active && e.handle) {
872
- r.preventDefault();
873
- let t = r.clientX - e.startX, n = parseFloat(e.handle.style.left);
874
- e.handle.style.left = `${n + t}px`, e.startX = r.clientX;
875
- let i = Math.round(t * k), a = e.origWidths.left + i, o = e.origWidths.right - i;
876
- a >= $e && o >= $e && (e.origWidths = {
877
- left: a,
878
- right: o
879
- });
880
- } else if (t.active && t.handle) {
881
- r.preventDefault();
882
- let e = r.clientY - t.startY, n = parseFloat(t.handle.style.top);
883
- t.startY = r.clientY;
884
- let i = Math.round(e * k), a = et({
885
- currentHeight: t.origHeight,
886
- delta: i,
887
- minimumHeight: t.minimumHeight
888
- });
889
- t.handle.style.top = `${n + a / k}px`, t.origHeight += a;
890
- } else if (n.active && n.handle) {
891
- r.preventDefault();
892
- let e = r.clientX - n.startX, t = parseFloat(n.handle.style.left);
893
- n.handle.style.left = `${t + e}px`, n.startX = r.clientX;
894
- let i = Math.round(e * k), a = n.origWidth + i;
895
- a >= $e && (n.origWidth = a);
896
- }
897
- }
898
- function s(i) {
899
- e.active ? (e.active = !1, e.handle?.classList.remove("dragging"), r && tt(r, {
900
- pmStart: e.tablePmStart,
901
- colIdx: e.columnIndex,
902
- newLeft: e.origWidths.left,
903
- newRight: e.origWidths.right
904
- }), e.handle = null) : t.active ? (t.active = !1, t.handle?.classList.remove("dragging"), r && rt(r, {
905
- pmStart: t.tablePmStart,
906
- rowIdx: t.rowIndex,
907
- newHeight: t.origHeight
908
- }), t.handle = null) : n.active && (n.active = !1, n.handle?.classList.remove("dragging"), r && nt(r, {
909
- pmStart: n.tablePmStart,
910
- colIdx: n.columnIndex,
911
- newWidth: n.origWidth
912
- }), n.handle = null);
913
- }
914
- function c() {
915
- return document.addEventListener("mousemove", o), document.addEventListener("mouseup", s), () => {
916
- document.removeEventListener("mousemove", o), document.removeEventListener("mouseup", s);
917
- };
918
- }
919
- return {
920
- tryStartResize: a,
921
- install: c,
922
- isResizing: i
923
- };
924
- }
925
- function U(e, t) {
926
- let n = at(e, t.tablePmStart, t.columnIndex);
927
- n && (t.origWidths = n);
928
- }
929
- function W(e, t, n) {
930
- let r = ot(e, t.tablePmStart, t.rowIndex);
931
- if (r != null) t.origHeight = r;
932
- else {
933
- let e = n.closest(".layout-table")?.querySelector(`[data-row-index="${t.rowIndex}"]`), r = e ? e.getBoundingClientRect().height : 30;
934
- t.origHeight = Math.round(r * k);
935
- }
936
- t.minimumHeight = Math.min(O, t.origHeight);
937
- }
938
- function Ct(e, t) {
939
- let n = it(e, t.tablePmStart, t.columnIndex);
940
- n != null && (t.origWidth = n);
941
- }
942
- // src/composables/useTrackedChanges.ts
943
- function G(t, n) {
944
- return e(() => {
945
- n.value;
946
- let e = t.value?.state ?? null, r = st(e);
947
- if (e === null) return r;
948
- let i = {
949
- accept: C(e, "accept"),
950
- reject: C(e, "reject")
951
- };
952
- if (i.accept.size === 0 && i.reject.size === 0) return r;
953
- let a = r.entries;
954
- for (let e of a) {
955
- let t = w(e);
956
- e.heldByLock = {
957
- accept: t.some((e) => i.accept.has(e)),
958
- reject: t.some((e) => i.reject.has(e))
959
- };
960
- }
961
- return {
962
- ...r,
963
- entries: a
964
- };
965
- });
966
- }
967
- // src/composables/useZoom.ts
968
- var wt = A, Tt = ct, Et = [
969
- .5,
970
- .75,
971
- 1,
972
- 1.25,
973
- 1.5,
974
- 2
975
- ];
976
- function Dt(t = 1) {
977
- let i = s(Math.max(wt, Math.min(Tt, t))), a = e(() => Math.round(i.value * 100)), o = e(() => i.value <= wt), c = e(() => i.value >= Tt);
978
- function l(e) {
979
- i.value = Math.max(wt, Math.min(Tt, Math.round(e * 100) / 100));
980
- }
981
- function u() {
982
- l(i.value + j);
983
- }
984
- function d() {
985
- l(i.value - j);
986
- }
987
- function f() {
988
- l(1);
989
- }
990
- function ee(e) {
991
- (e.ctrlKey || e.metaKey) && (e.preventDefault(), e.deltaY < 0 ? u() : d());
992
- }
993
- function p(e) {
994
- (e.ctrlKey || e.metaKey) && (e.shiftKey || e.altKey || (e.key === "=" || e.key === "+" ? (e.preventDefault(), u()) : e.key === "-" ? (e.preventDefault(), d()) : e.key === "0" && (e.preventDefault(), f())));
995
- }
996
- function te() {
997
- r(() => document.addEventListener("keydown", p)), n(() => document.removeEventListener("keydown", p));
998
- }
999
- return {
1000
- zoom: i,
1001
- zoomPercent: a,
1002
- isMinZoom: o,
1003
- isMaxZoom: c,
1004
- setZoom: l,
1005
- zoomIn: u,
1006
- zoomOut: d,
1007
- resetZoom: f,
1008
- handleWheel: ee,
1009
- handleKeyDown: p,
1010
- installShortcuts: te,
1011
- ZOOM_PRESETS: Et
1012
- };
1013
- }
1014
- export { V as a, ut as c, R as d, H as i, F as l, st as n, St as o, G as r, xt as s, Dt as t, L as u };