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