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