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