@stll/folio-vue 0.2.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-B498PX1d.js +4256 -0
- package/dist/ListButtons-D-zMJ7rl.cjs +4 -0
- package/dist/PageSetupDialog-CGBaBVzo.cjs +15 -0
- package/dist/PageSetupDialog-DsjAfJy0.js +4873 -0
- package/dist/TablePropertiesDialog-A-1Pm1f9.cjs +1 -0
- package/dist/TablePropertiesDialog-PyXEJC_o.js +887 -0
- package/dist/components/DocxEditor/pagedEditorRef.d.ts +75 -0
- package/dist/components/DocxEditor/types.d.ts +528 -0
- package/dist/components/EditorToolbarContext.d.ts +9 -0
- package/dist/components/FormattingBar.types.d.ts +67 -0
- package/dist/components/Toolbar/presets.d.ts +25 -0
- package/dist/components/dialogs/index.d.ts +24 -0
- package/dist/components/imageContextMenuTypes.d.ts +30 -0
- package/dist/components/imageSelectionTypes.d.ts +13 -0
- package/dist/components/insertTableState.d.ts +9 -0
- package/dist/components/sidebar/cardStyles.d.ts +1 -0
- package/dist/components/sidebar/cardUtils.d.ts +1 -0
- package/dist/components/sidebar/resolveItemPositions.d.ts +22 -0
- package/dist/components/sidebar/sidebarUtils.d.ts +4 -0
- package/dist/components/tableStylePresets.d.ts +60 -0
- package/dist/components/toolbarUtils.d.ts +3 -0
- package/dist/components/ui/AlignmentButtons.types.d.ts +13 -0
- package/dist/components/ui/StylePicker.types.d.ts +16 -0
- package/dist/components/ui/ZoomControl.types.d.ts +21 -0
- package/dist/components/ui/fontPickerValue.d.ts +1 -0
- package/dist/components/ui/hyperlinkPopupTypes.d.ts +20 -0
- package/dist/composables/commentMarks.d.ts +32 -0
- package/dist/composables/imageOverlayRect.d.ts +44 -0
- package/dist/composables/index.d.ts +30 -0
- package/dist/composables/useAutoSave.d.ts +39 -0
- package/dist/composables/useClipboard.d.ts +21 -0
- package/dist/composables/useColorMode.d.ts +8 -0
- package/dist/composables/useCommentLifecycle.d.ts +39 -0
- package/dist/composables/useCommentManagement.d.ts +47 -0
- package/dist/composables/useCommentSidebarItems.d.ts +24 -0
- package/dist/composables/useContextMenus.d.ts +64 -0
- package/dist/composables/useControllableBoolean.d.ts +16 -0
- package/dist/composables/useDocumentLifecycle.d.ts +11 -0
- package/dist/composables/useDocxEditor.d.ts +123 -0
- package/dist/composables/useDocxEditorRefApi.d.ts +68 -0
- package/dist/composables/useDragAutoScroll.d.ts +11 -0
- package/dist/composables/useFileIO.d.ts +43 -0
- package/dist/composables/useFindReplace.d.ts +22 -0
- package/dist/composables/useFixedDropdown.d.ts +14 -0
- package/dist/composables/useFormattingActions.d.ts +21 -0
- package/dist/composables/useHistory.d.ts +9 -0
- package/dist/composables/useHostCallbacks.d.ts +24 -0
- package/dist/composables/useHyperlinkManagement.d.ts +40 -0
- package/dist/composables/useImageActions.d.ts +25 -0
- package/dist/composables/useKeyboardShortcuts.d.ts +25 -0
- package/dist/composables/useMenuActions.d.ts +36 -0
- package/dist/composables/useOutlineSidebar.d.ts +24 -0
- package/dist/composables/usePageSetupControls.d.ts +28 -0
- package/dist/composables/usePagesPointer.d.ts +87 -0
- package/dist/composables/useParagraphStyleOptions.d.ts +18 -0
- package/dist/composables/usePortalClass.d.ts +8 -0
- package/dist/composables/useSelectionHighlight.d.ts +19 -0
- package/dist/composables/useSelectionSync.d.ts +30 -0
- package/dist/composables/useTableResize.d.ts +7 -0
- package/dist/composables/useTableSelection.d.ts +10 -0
- package/dist/composables/useToolbarDropdowns.d.ts +15 -0
- package/dist/composables/useToolbarFontSize.d.ts +15 -0
- package/dist/composables/useTrackedChanges.d.ts +12 -0
- package/dist/composables/useVisualLineNavigation.d.ts +11 -0
- package/dist/composables/useWheelZoom.d.ts +10 -0
- package/dist/composables/useZoom.d.ts +16 -0
- package/dist/composables.cjs +61 -0
- package/dist/composables.js +378 -0
- package/dist/dialogs.cjs +1 -0
- package/dist/dialogs.js +3 -0
- package/dist/folio-vue.css +2 -0
- package/dist/i18n/index.d.ts +36 -0
- package/dist/i18n/messages.d.ts +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.js +4088 -0
- package/dist/messages.cjs +1 -0
- package/dist/messages.js +1 -0
- package/dist/renderAsync.d.ts +35 -0
- package/dist/styles/index.d.ts +12 -0
- package/dist/styles/zIndex.d.ts +18 -0
- package/dist/styles.cjs +1 -0
- package/dist/styles.js +5 -0
- package/dist/ui/folio-ui.d.ts +139 -0
- package/dist/ui.cjs +1 -0
- package/dist/ui.d.ts +67 -0
- package/dist/ui.js +446 -0
- package/dist/useZoom-BryUw3Cu.cjs +1 -0
- package/dist/useZoom-CIIRid8U.js +626 -0
- package/dist/utils/aiEditRange.d.ts +26 -0
- package/dist/utils/autoScroll.d.ts +22 -0
- package/dist/utils/cardStyles.d.ts +3 -0
- package/dist/utils/colorMode.d.ts +32 -0
- package/dist/utils/comments.d.ts +20 -0
- package/dist/utils/cssTypes.d.ts +7 -0
- package/dist/utils/domQueries.d.ts +39 -0
- package/dist/utils/fontOptions.d.ts +26 -0
- package/dist/utils/hostFonts.d.ts +25 -0
- package/dist/utils/imageClipboard.d.ts +9 -0
- package/dist/utils/index.d.ts +13 -0
- package/dist/utils/listState.d.ts +22 -0
- package/dist/utils/reportIssue.d.ts +18 -0
- package/dist/utils/selectionHighlight.d.ts +44 -0
- package/dist/utils/sidebarConstants.d.ts +8 -0
- package/dist/utils/stylePreview.d.ts +53 -0
- package/dist/utils/textSelection.d.ts +40 -0
- package/dist/zIndex-BY0qa8Au.js +12 -0
- package/dist/zIndex-dFsQbASx.cjs +1 -0
- package/package.json +99 -0
package/dist/ui.js
ADDED
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
import { a as e, i as t, n, r, t as i, u as a } from "./PageSetupDialog-DsjAfJy0.js";
|
|
2
|
+
import { A as o, D as s, E as c, F as l, I as u, M as d, N as f, O as ee, P as p, T as m, _ as h, a as g, b as _, c as v, d as y, f as b, g as x, h as S, i as te, j as ne, k as re, l as ie, m as ae, o as oe, p as se, r as ce, s as le, t as ue, u as de, v as C, w, y as T } from "./ListButtons-B498PX1d.js";
|
|
3
|
+
import { a as E, i as D, n as O, r as k, t as A } from "./TablePropertiesDialog-PyXEJC_o.js";
|
|
4
|
+
import { Fragment as j, computed as M, createBlock as N, createCommentVNode as P, createElementBlock as F, createElementVNode as I, createTextVNode as L, createVNode as R, defineComponent as z, guardReactiveProps as B, normalizeClass as V, normalizeProps as H, normalizeStyle as U, openBlock as W, ref as G, renderList as K, renderSlot as q, toDisplayString as J, withCtx as Y, withKeys as X, withModifiers as Z } from "vue";
|
|
5
|
+
import "@stll/folio-core/utils/units";
|
|
6
|
+
//#region src/components/EditorToolbar.vue?vue&type=script&setup=true&lang.ts
|
|
7
|
+
var fe = { class: "docx-editor-toolbar" }, pe = { class: "docx-editor-toolbar__title-row" }, me = { class: "docx-editor-toolbar__title-left" }, he = { class: "docx-editor-toolbar__title-center" }, ge = { class: "docx-editor-toolbar__title-right" }, _e = /*#__PURE__*/ a(/* @__PURE__ */ z({
|
|
8
|
+
inheritAttrs: !1,
|
|
9
|
+
__name: "EditorToolbar",
|
|
10
|
+
props: { showMenuBar: {
|
|
11
|
+
type: Boolean,
|
|
12
|
+
default: !0
|
|
13
|
+
} },
|
|
14
|
+
emits: ["menu-action"],
|
|
15
|
+
setup(e) {
|
|
16
|
+
return (t, n) => (W(), F("div", fe, [q(t.$slots, "title-bar", {}, () => [I("div", pe, [
|
|
17
|
+
I("div", me, [q(t.$slots, "title-bar-left", {}, void 0, !0)]),
|
|
18
|
+
I("div", he, [q(t.$slots, "document-name", {}, void 0, !0), e.showMenuBar ? (W(), N(o, {
|
|
19
|
+
key: 0,
|
|
20
|
+
onAction: n[0] ||= (e) => t.$emit("menu-action", e)
|
|
21
|
+
})) : P("", !0)]),
|
|
22
|
+
I("div", ge, [q(t.$slots, "title-bar-right", {}, void 0, !0)])
|
|
23
|
+
])], !0), q(t.$slots, "toolbar", {}, () => [R(_, H(B(t.$attrs)), null, 16)], !0)]));
|
|
24
|
+
}
|
|
25
|
+
}), [["__scopeId", "data-v-f2023632"]]), ve = {}, ye = { class: "docx-title-bar" }, be = { class: "docx-title-bar__left" }, xe = { class: "docx-title-bar__center" }, Se = { class: "docx-title-bar__right" };
|
|
26
|
+
function Ce(e, t) {
|
|
27
|
+
return W(), F("div", ye, [
|
|
28
|
+
I("div", be, [q(e.$slots, "left", {}, void 0, !0)]),
|
|
29
|
+
I("div", xe, [q(e.$slots, "default", {}, void 0, !0)]),
|
|
30
|
+
I("div", Se, [q(e.$slots, "right", {}, void 0, !0)])
|
|
31
|
+
]);
|
|
32
|
+
}
|
|
33
|
+
var we = /*#__PURE__*/ a(ve, [["render", Ce], ["__scopeId", "data-v-ae11d49f"]]);
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/components/ui/fontPickerValue.ts
|
|
36
|
+
function Q(e) {
|
|
37
|
+
let t = e.trim();
|
|
38
|
+
if (!t) return "";
|
|
39
|
+
let n = null, r = "";
|
|
40
|
+
for (let e of t) {
|
|
41
|
+
if ((e === "\"" || e === "'") && n === null) {
|
|
42
|
+
n = e, r += e;
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
if (e === n) {
|
|
46
|
+
n = null, r += e;
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
if (e === "," && n === null) break;
|
|
50
|
+
r += e;
|
|
51
|
+
}
|
|
52
|
+
return r.trim().replace(/^['"]|['"]$/g, "");
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/components/ui/FontPicker.vue?vue&type=script&setup=true&lang.ts
|
|
56
|
+
var Te = ["value", "disabled"], Ee = {
|
|
57
|
+
key: 0,
|
|
58
|
+
label: "Sans-serif"
|
|
59
|
+
}, De = ["value"], Oe = {
|
|
60
|
+
key: 1,
|
|
61
|
+
label: "Serif"
|
|
62
|
+
}, ke = ["value"], Ae = {
|
|
63
|
+
key: 2,
|
|
64
|
+
label: "Monospace"
|
|
65
|
+
}, je = ["value"], Me = {
|
|
66
|
+
key: 3,
|
|
67
|
+
label: "Other"
|
|
68
|
+
}, Ne = ["value"], Pe = /*#__PURE__*/ a(/* @__PURE__ */ z({
|
|
69
|
+
__name: "FontPicker",
|
|
70
|
+
props: {
|
|
71
|
+
value: {},
|
|
72
|
+
fonts: {},
|
|
73
|
+
disabled: {
|
|
74
|
+
type: Boolean,
|
|
75
|
+
default: !1
|
|
76
|
+
},
|
|
77
|
+
className: {},
|
|
78
|
+
placeholder: { default: "Font" },
|
|
79
|
+
showPreview: {
|
|
80
|
+
type: Boolean,
|
|
81
|
+
default: !0
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
emits: ["change"],
|
|
85
|
+
setup(e, { emit: t }) {
|
|
86
|
+
let n = e, r = t, i = [
|
|
87
|
+
{
|
|
88
|
+
name: "Arial",
|
|
89
|
+
fontFamily: "Arial, Helvetica, sans-serif",
|
|
90
|
+
category: "sans-serif"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name: "Calibri",
|
|
94
|
+
fontFamily: "\"Calibri\", Arial, sans-serif",
|
|
95
|
+
category: "sans-serif"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
name: "Helvetica",
|
|
99
|
+
fontFamily: "Helvetica, Arial, sans-serif",
|
|
100
|
+
category: "sans-serif"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
name: "Verdana",
|
|
104
|
+
fontFamily: "Verdana, Geneva, sans-serif",
|
|
105
|
+
category: "sans-serif"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
name: "Open Sans",
|
|
109
|
+
fontFamily: "\"Open Sans\", sans-serif",
|
|
110
|
+
category: "sans-serif"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: "Roboto",
|
|
114
|
+
fontFamily: "Roboto, sans-serif",
|
|
115
|
+
category: "sans-serif"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
name: "Times New Roman",
|
|
119
|
+
fontFamily: "\"Times New Roman\", Times, serif",
|
|
120
|
+
category: "serif"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
name: "Georgia",
|
|
124
|
+
fontFamily: "Georgia, serif",
|
|
125
|
+
category: "serif"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
name: "Cambria",
|
|
129
|
+
fontFamily: "Cambria, Georgia, serif",
|
|
130
|
+
category: "serif"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
name: "Garamond",
|
|
134
|
+
fontFamily: "Garamond, serif",
|
|
135
|
+
category: "serif"
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
name: "Courier New",
|
|
139
|
+
fontFamily: "\"Courier New\", monospace",
|
|
140
|
+
category: "monospace"
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
name: "Consolas",
|
|
144
|
+
fontFamily: "Consolas, monospace",
|
|
145
|
+
category: "monospace"
|
|
146
|
+
}
|
|
147
|
+
], a = M(() => n.fonts ?? i), o = M(() => {
|
|
148
|
+
let e = {
|
|
149
|
+
"sans-serif": [],
|
|
150
|
+
serif: [],
|
|
151
|
+
monospace: [],
|
|
152
|
+
other: []
|
|
153
|
+
};
|
|
154
|
+
for (let t of a.value) e[t.category ?? "other"].push(t);
|
|
155
|
+
return e;
|
|
156
|
+
}), s = M(() => {
|
|
157
|
+
let e = n.value;
|
|
158
|
+
if (!e) return n.placeholder;
|
|
159
|
+
let t = e.toLowerCase();
|
|
160
|
+
return a.value.find((n) => n.fontFamily === e || n.name.toLowerCase() === t || Q(n.fontFamily).toLowerCase() === t)?.name ?? e;
|
|
161
|
+
});
|
|
162
|
+
function c(e) {
|
|
163
|
+
if (!(e.target instanceof HTMLSelectElement)) return;
|
|
164
|
+
let t = e.target.value, n = a.value.find((e) => e.name === t);
|
|
165
|
+
r("change", n ? Q(n.fontFamily) || n.name : t);
|
|
166
|
+
}
|
|
167
|
+
return (t, n) => (W(), F("select", {
|
|
168
|
+
class: V(["docx-font-picker", e.className]),
|
|
169
|
+
value: s.value,
|
|
170
|
+
disabled: e.disabled,
|
|
171
|
+
"aria-label": "Font family",
|
|
172
|
+
onChange: c
|
|
173
|
+
}, [
|
|
174
|
+
o.value["sans-serif"].length ? (W(), F("optgroup", Ee, [(W(!0), F(j, null, K(o.value["sans-serif"], (t) => (W(), F("option", {
|
|
175
|
+
key: t.name,
|
|
176
|
+
value: t.name,
|
|
177
|
+
style: U(e.showPreview ? { fontFamily: t.fontFamily } : void 0)
|
|
178
|
+
}, J(t.name), 13, De))), 128))])) : P("", !0),
|
|
179
|
+
o.value.serif.length ? (W(), F("optgroup", Oe, [(W(!0), F(j, null, K(o.value.serif, (t) => (W(), F("option", {
|
|
180
|
+
key: t.name,
|
|
181
|
+
value: t.name,
|
|
182
|
+
style: U(e.showPreview ? { fontFamily: t.fontFamily } : void 0)
|
|
183
|
+
}, J(t.name), 13, ke))), 128))])) : P("", !0),
|
|
184
|
+
o.value.monospace.length ? (W(), F("optgroup", Ae, [(W(!0), F(j, null, K(o.value.monospace, (t) => (W(), F("option", {
|
|
185
|
+
key: t.name,
|
|
186
|
+
value: t.name,
|
|
187
|
+
style: U(e.showPreview ? { fontFamily: t.fontFamily } : void 0)
|
|
188
|
+
}, J(t.name), 13, je))), 128))])) : P("", !0),
|
|
189
|
+
o.value.other.length ? (W(), F("optgroup", Me, [(W(!0), F(j, null, K(o.value.other, (t) => (W(), F("option", {
|
|
190
|
+
key: t.name,
|
|
191
|
+
value: t.name,
|
|
192
|
+
style: U(e.showPreview ? { fontFamily: t.fontFamily } : void 0)
|
|
193
|
+
}, J(t.name), 13, Ne))), 128))])) : P("", !0)
|
|
194
|
+
], 42, Te));
|
|
195
|
+
}
|
|
196
|
+
}), [["__scopeId", "data-v-1a9a9f88"]]), Fe = { class: "docx-font-size" }, Ie = ["disabled"], Le = [
|
|
197
|
+
"value",
|
|
198
|
+
"disabled",
|
|
199
|
+
"placeholder"
|
|
200
|
+
], Re = ["disabled"], ze = /*#__PURE__*/ a(/* @__PURE__ */ z({
|
|
201
|
+
__name: "FontSizePicker",
|
|
202
|
+
props: {
|
|
203
|
+
value: {},
|
|
204
|
+
sizes: {},
|
|
205
|
+
disabled: {
|
|
206
|
+
type: Boolean,
|
|
207
|
+
default: !1
|
|
208
|
+
},
|
|
209
|
+
minSize: { default: 1 },
|
|
210
|
+
maxSize: { default: 1638 },
|
|
211
|
+
placeholder: { default: "11" }
|
|
212
|
+
},
|
|
213
|
+
emits: ["change"],
|
|
214
|
+
setup(e, { emit: t }) {
|
|
215
|
+
let n = e, r = t, i = [
|
|
216
|
+
8,
|
|
217
|
+
9,
|
|
218
|
+
10,
|
|
219
|
+
11,
|
|
220
|
+
12,
|
|
221
|
+
14,
|
|
222
|
+
16,
|
|
223
|
+
18,
|
|
224
|
+
20,
|
|
225
|
+
24,
|
|
226
|
+
28,
|
|
227
|
+
36,
|
|
228
|
+
48,
|
|
229
|
+
72
|
|
230
|
+
], a = M(() => n.sizes ?? i), o = M(() => n.value ?? parseInt(n.placeholder, 10) ?? 11), s = M(() => n.value === void 0 ? n.placeholder : String(n.value));
|
|
231
|
+
function c(e) {
|
|
232
|
+
return a.value.find((t) => t > e) ?? Math.min(e + 1, n.maxSize);
|
|
233
|
+
}
|
|
234
|
+
function l(e) {
|
|
235
|
+
return [...a.value].reverse().find((t) => t < e) ?? Math.max(e - 1, n.minSize);
|
|
236
|
+
}
|
|
237
|
+
function u() {
|
|
238
|
+
n.disabled || r("change", l(o.value));
|
|
239
|
+
}
|
|
240
|
+
function d() {
|
|
241
|
+
n.disabled || r("change", c(o.value));
|
|
242
|
+
}
|
|
243
|
+
function f(e) {
|
|
244
|
+
if (!(e.target instanceof HTMLInputElement)) return;
|
|
245
|
+
let t = parseFloat(e.target.value);
|
|
246
|
+
!isNaN(t) && t >= n.minSize && t <= n.maxSize && r("change", Math.round(t * 2) / 2);
|
|
247
|
+
}
|
|
248
|
+
return (t, n) => (W(), F("div", Fe, [
|
|
249
|
+
I("button", {
|
|
250
|
+
type: "button",
|
|
251
|
+
class: "docx-font-size__btn",
|
|
252
|
+
disabled: e.disabled || o.value <= e.minSize,
|
|
253
|
+
title: "Decrease font size",
|
|
254
|
+
onClick: Z(u, ["prevent"])
|
|
255
|
+
}, "−", 8, Ie),
|
|
256
|
+
I("input", {
|
|
257
|
+
class: "docx-font-size__input",
|
|
258
|
+
type: "text",
|
|
259
|
+
value: s.value,
|
|
260
|
+
disabled: e.disabled,
|
|
261
|
+
placeholder: e.placeholder,
|
|
262
|
+
onKeydown: [
|
|
263
|
+
n[0] ||= X(Z((e) => {
|
|
264
|
+
u(), e.stopPropagation();
|
|
265
|
+
}, ["prevent"]), ["up"]),
|
|
266
|
+
n[1] ||= X(Z((e) => {
|
|
267
|
+
d(), e.stopPropagation();
|
|
268
|
+
}, ["prevent"]), ["down"]),
|
|
269
|
+
n[2] ||= X(Z((e) => f(e), ["prevent"]), ["enter"])
|
|
270
|
+
],
|
|
271
|
+
onBlur: n[3] ||= (e) => f(e)
|
|
272
|
+
}, null, 40, Le),
|
|
273
|
+
I("button", {
|
|
274
|
+
type: "button",
|
|
275
|
+
class: "docx-font-size__btn",
|
|
276
|
+
disabled: e.disabled || o.value >= e.maxSize,
|
|
277
|
+
title: "Increase font size",
|
|
278
|
+
onClick: Z(d, ["prevent"])
|
|
279
|
+
}, "+", 8, Re)
|
|
280
|
+
]));
|
|
281
|
+
}
|
|
282
|
+
}), [["__scopeId", "data-v-4e8ada55"]]), $ = ["value", "disabled"], Be = ["value"], Ve = /*#__PURE__*/ a(/* @__PURE__ */ z({
|
|
283
|
+
__name: "LineSpacingPicker",
|
|
284
|
+
props: {
|
|
285
|
+
value: {},
|
|
286
|
+
options: {},
|
|
287
|
+
disabled: {
|
|
288
|
+
type: Boolean,
|
|
289
|
+
default: !1
|
|
290
|
+
},
|
|
291
|
+
className: {}
|
|
292
|
+
},
|
|
293
|
+
emits: ["change"],
|
|
294
|
+
setup(e, { emit: t }) {
|
|
295
|
+
let n = e, r = t, i = [
|
|
296
|
+
{
|
|
297
|
+
label: "Single",
|
|
298
|
+
value: 1,
|
|
299
|
+
twipsValue: 240
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
label: "1.15",
|
|
303
|
+
value: 1.15,
|
|
304
|
+
twipsValue: 276
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
label: "1.5",
|
|
308
|
+
value: 1.5,
|
|
309
|
+
twipsValue: 360
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
label: "Double",
|
|
313
|
+
value: 2,
|
|
314
|
+
twipsValue: 480
|
|
315
|
+
}
|
|
316
|
+
], a = M(() => n.options ?? i), o = M(() => n.value ?? a.value[0]?.twipsValue ?? 240);
|
|
317
|
+
function s(e) {
|
|
318
|
+
if (!(e.target instanceof HTMLSelectElement)) return;
|
|
319
|
+
let t = parseInt(e.target.value, 10);
|
|
320
|
+
isNaN(t) || r("change", t);
|
|
321
|
+
}
|
|
322
|
+
return (t, n) => (W(), F("select", {
|
|
323
|
+
class: V(["docx-line-spacing", e.className]),
|
|
324
|
+
value: String(o.value),
|
|
325
|
+
disabled: e.disabled,
|
|
326
|
+
"aria-label": "Line spacing",
|
|
327
|
+
onChange: s
|
|
328
|
+
}, [(W(!0), F(j, null, K(a.value, (e) => (W(), F("option", {
|
|
329
|
+
key: e.twipsValue,
|
|
330
|
+
value: String(e.twipsValue)
|
|
331
|
+
}, J(e.label), 9, Be))), 128))], 42, $));
|
|
332
|
+
}
|
|
333
|
+
}), [["__scopeId", "data-v-fcda8ecc"]]), He = [
|
|
334
|
+
"disabled",
|
|
335
|
+
"aria-expanded",
|
|
336
|
+
"title",
|
|
337
|
+
"onClick"
|
|
338
|
+
], Ue = { class: "docx-table-grid__panel" }, We = { class: "docx-table-grid__label" }, Ge = ["onMouseenter", "onClick"], Ke = /*#__PURE__*/ a(/* @__PURE__ */ z({
|
|
339
|
+
__name: "TableGridPicker",
|
|
340
|
+
props: {
|
|
341
|
+
disabled: {
|
|
342
|
+
type: Boolean,
|
|
343
|
+
default: !1
|
|
344
|
+
},
|
|
345
|
+
gridRows: { default: 5 },
|
|
346
|
+
gridColumns: { default: 5 },
|
|
347
|
+
tooltip: { default: "Insert table" }
|
|
348
|
+
},
|
|
349
|
+
emits: ["insert"],
|
|
350
|
+
setup(e, { emit: t }) {
|
|
351
|
+
let n = e, r = t, i = G(!1), a = G({
|
|
352
|
+
rows: 1,
|
|
353
|
+
cols: 1
|
|
354
|
+
}), o = M(() => {
|
|
355
|
+
let e = [];
|
|
356
|
+
for (let t = 1; t <= n.gridRows; t++) for (let r = 1; r <= n.gridColumns; r++) e.push({
|
|
357
|
+
r: t,
|
|
358
|
+
c: r
|
|
359
|
+
});
|
|
360
|
+
return e;
|
|
361
|
+
});
|
|
362
|
+
function s(e, t) {
|
|
363
|
+
r("insert", e, t), i.value = !1;
|
|
364
|
+
}
|
|
365
|
+
function c() {
|
|
366
|
+
i.value = !1, a.value = {
|
|
367
|
+
rows: 1,
|
|
368
|
+
cols: 1
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
return (t, n) => (W(), N(f, {
|
|
372
|
+
open: i.value,
|
|
373
|
+
"onUpdate:open": n[0] ||= (e) => i.value = e,
|
|
374
|
+
onClose: c
|
|
375
|
+
}, {
|
|
376
|
+
trigger: Y(({ toggle: t }) => [I("button", {
|
|
377
|
+
type: "button",
|
|
378
|
+
class: "docx-table-grid__btn",
|
|
379
|
+
disabled: e.disabled,
|
|
380
|
+
"aria-expanded": i.value,
|
|
381
|
+
"aria-haspopup": "grid",
|
|
382
|
+
title: e.tooltip,
|
|
383
|
+
onClick: Z(t, ["prevent"])
|
|
384
|
+
}, [R(u, {
|
|
385
|
+
name: "grid_on",
|
|
386
|
+
size: 20
|
|
387
|
+
})], 8, He)]),
|
|
388
|
+
panel: Y(() => [I("div", Ue, [I("div", We, J(a.value.rows) + " × " + J(a.value.cols), 1), I("div", {
|
|
389
|
+
class: "docx-table-grid__grid",
|
|
390
|
+
style: U({ gridTemplateColumns: `repeat(${e.gridColumns}, 18px)` })
|
|
391
|
+
}, [(W(!0), F(j, null, K(o.value, (e) => (W(), F("button", {
|
|
392
|
+
key: `${e.r}-${e.c}`,
|
|
393
|
+
class: V(["docx-table-grid__cell", { "docx-table-grid__cell--active": e.r <= a.value.rows && e.c <= a.value.cols }]),
|
|
394
|
+
onMouseenter: (t) => a.value = {
|
|
395
|
+
rows: e.r,
|
|
396
|
+
cols: e.c
|
|
397
|
+
},
|
|
398
|
+
onClick: Z((t) => s(e.r, e.c), ["prevent"])
|
|
399
|
+
}, null, 42, Ge))), 128))], 4)])]),
|
|
400
|
+
_: 1
|
|
401
|
+
}, 8, ["open"]));
|
|
402
|
+
}
|
|
403
|
+
}), [["__scopeId", "data-v-34f6875c"]]), qe = ["disabled", "title"], Je = {
|
|
404
|
+
key: 0,
|
|
405
|
+
class: "print-btn__icon"
|
|
406
|
+
}, Ye = /*#__PURE__*/ a(/* @__PURE__ */ z({
|
|
407
|
+
__name: "PrintButton",
|
|
408
|
+
props: {
|
|
409
|
+
disabled: {
|
|
410
|
+
type: Boolean,
|
|
411
|
+
default: !1
|
|
412
|
+
},
|
|
413
|
+
label: { default: "Print" },
|
|
414
|
+
compact: {
|
|
415
|
+
type: Boolean,
|
|
416
|
+
default: !1
|
|
417
|
+
}
|
|
418
|
+
},
|
|
419
|
+
emits: ["print"],
|
|
420
|
+
setup(e, { emit: t }) {
|
|
421
|
+
let n = e, r = t;
|
|
422
|
+
function i() {
|
|
423
|
+
n.disabled || (r("print"), window.print());
|
|
424
|
+
}
|
|
425
|
+
return (t, n) => (W(), F("button", {
|
|
426
|
+
class: "print-btn",
|
|
427
|
+
disabled: e.disabled,
|
|
428
|
+
title: e.label,
|
|
429
|
+
onMousedown: Z(i, ["prevent"])
|
|
430
|
+
}, [L(J(e.compact ? "" : e.label) + " ", 1), e.compact ? (W(), F("span", Je, "🖨")) : P("", !0)], 40, qe));
|
|
431
|
+
}
|
|
432
|
+
}), [["__scopeId", "data-v-3e413c06"]]), Xe = {
|
|
433
|
+
padding: "8px 10px",
|
|
434
|
+
borderRadius: 8,
|
|
435
|
+
backgroundColor: "var(--doc-card)",
|
|
436
|
+
cursor: "pointer",
|
|
437
|
+
boxShadow: "var(--doc-card-shadow)"
|
|
438
|
+
}, Ze = {
|
|
439
|
+
padding: "10px 12px",
|
|
440
|
+
borderRadius: 8,
|
|
441
|
+
backgroundColor: "var(--doc-surface)",
|
|
442
|
+
cursor: "pointer",
|
|
443
|
+
boxShadow: "var(--doc-card-shadow-strong)"
|
|
444
|
+
};
|
|
445
|
+
//#endregion
|
|
446
|
+
export { oe as AddCommentCard, ce as AlignmentButtons, m as Button, Xe as CARD_STYLE_COLLAPSED, Ze as CARD_STYLE_EXPANDED, w as ColorPicker, ie as CommentCard, l as CommentMarginMarkers, p as DocumentName, c as EditingModeDropdown, _e as EditorToolbar, e as FindReplaceDialog, Pe as FontPicker, ze as FontSizePicker, D as FootnotePropertiesDialog, T as HorizontalRuler, t as HyperlinkDialog, re as IconGridDropdown, k as ImagePositionDialog, r as ImagePropertiesDialog, s as ImageTransformDropdown, ee as ImageWrapDropdown, n as InsertSymbolDialog, O as InsertTableDialog, Ve as LineSpacingPicker, ue as ListButtons, o as MenuBar, d as MenuDropdown, i as PageSetupDialog, f as Popover, Ye as PrintButton, de as ReplyInput, y as ReplyThread, v as ResolvedCommentMarker, te as StylePicker, h as TableBorderColorPicker, C as TableBorderPicker, x as TableBorderWidthPicker, S as TableCellFillPicker, ne as TableGridInline, Ke as TableGridPicker, ae as TableMoreDropdown, A as TablePropertiesDialog, E as TableStyleGallery, se as TableToolbar, we as TitleBar, _ as Toolbar, le as TrackedChangeCard, g as UnifiedSidebar, b as VerticalRuler };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let e=require("vue"),t=require("@stll/folio-core/paged-layout/sectionGeometry"),n=require("@stll/folio-core/prosemirror/plugins/anonymizationDecorations"),r=require("@stll/folio-core/prosemirror/plugins/templateDirectives"),i=require("@stll/folio-core/prosemirror/plugins/suggestionMode"),a=require("@stll/folio-core/controller/folioEditor"),o=require("@stll/folio-core/controller/folioEditorEvents"),s=require("@stll/folio-core/controller/hiddenEditorManager"),c=require("@stll/folio-core/controller/layoutPipeline"),l=require("@stll/folio-core/controller/layoutScheduler"),u=require("@stll/folio-core/controller/layoutSession"),d=require("@stll/folio-core/docx/parser"),f=require("@stll/folio-core/docx/footnoteParser"),p=require("@stll/folio-core/layout-bridge/convert/headerFooterLayout"),m=require("@stll/folio-core/layout-painter"),h=require("@stll/folio-core/paged-layout/LayoutSelectionGate"),g=require("@stll/folio-core/paged-layout/transactionDirtyRange"),_=require("@stll/folio-core/prosemirror/conversion/fromProseDoc"),ee=require("@stll/folio-core/prosemirror/extensions/ExtensionManager"),v=require("@stll/folio-core/prosemirror/extensions/features/ParagraphChangeTrackerExtension"),te=require("@stll/folio-core/prosemirror/extensions/StarterKit"),ne=require("@stll/folio-core/prosemirror/plugins/templatePreviewValues"),re=require("@stll/folio-core/prosemirror/plugins/templateSlashMenu"),y=require("@stll/folio-core/utils/findVerticalScrollParent"),b=require("@stll/folio-core/prosemirror/tableResize"),x=require("@stll/folio-core/prosemirror/utils/extractTrackedChanges");var ie=24,ae=32,oe=96,se=250,ce=[];function le(e){let n=e?.columnCount??1;if(n<=1)return;let r={count:n,gap:(0,t.twipsToPixels)(e?.columnSpace??720),equalWidth:e?.equalWidth??!0};return e?.separator!==void 0&&(r.separator=e.separator),r}function S(e){let t={};e.titlePg!==void 0&&(t.titlePg=e.titlePg);for(let n of e.headerReferences??[])n.type==="default"?t.headerDefault=n.rId:n.type===`first`?t.headerFirst=n.rId:t.headerEven=n.rId;for(let n of e.footerReferences??[])n.type==="default"?t.footerDefault=n.rId:n.type===`first`?t.footerFirst=n.rId:t.footerEven=n.rId;return t}function ue(e){let t=e?.package.document;if(!t)return;let n=t.sections;if(n&&n.length>0)return n.map(e=>S(e.properties));let r=t.finalSectionProperties;if(r)return[S(r)]}var C={hf:null,rId:null};function de(e,t){let n=e?.package;if(!n||!t)return{header:C,footer:C,firstHeader:C,firstFooter:C};let r=n.headers,i=n.footers,a=e=>e?r?.get(e)??null:null,o=e=>e?i?.get(e)??null:null,s=null,c=null;for(let e of t.headerReferences??[])e.type==="default"?s=e.rId:e.type===`first`&&(c=e.rId);let l=null,u=null;for(let e of t.footerReferences??[])e.type==="default"?l=e.rId:e.type===`first`&&(u=e.rId);return{header:{hf:a(s),rId:s},footer:{hf:o(l),rId:l},firstHeader:{hf:a(c),rId:c},firstFooter:{hf:o(u),rId:u}}}function w(e,t,n,r,i,a){if(!e)return;let o=t?{...a,rId:t}:a,s=t?n?.getView(t):null;return s?(0,p.convertHeaderFooterPmDocToContent)(s.state.doc,r,i,o):(0,p.convertHeaderFooterToContent)(e,r,i,o)}function fe(e,t,n,r,i){if(!e||e.size===0)return;let a=new Map;for(let[o,s]of e){let e=w(s,o,t,n,r,i);e&&a.set(o,e)}return a.size>0?a:void 0}function pe(e,t,n){let r=new Map;if(!n||!n.package.footnotes)return r;let i=new Map;for(let e of n.package.footnotes)e.noteType&&e.noteType!==`normal`||i.set(e.id,e);for(let[n,a]of e){let e=[];for(let n of a){let r=i.get(n);if(!r)continue;let a=t.get(n),o=a?.displayNumber??0;e.push({displayNumber:String(o),text:(0,f.getFootnoteText)(r),...a?{content:{blocks:a.blocks,measures:a.measures,height:a.height}}:{}})}e.length>0&&r.set(n,e)}return r}var T=new Set([`black`,`blue`,`cyan`,`darkBlue`,`darkCyan`,`darkGray`,`darkGreen`,`darkMagenta`,`darkRed`,`darkYellow`,`green`,`lightGray`,`magenta`,`none`,`red`,`white`,`yellow`]);function me(e){let t=[],n=(e,r)=>{for(let[n,i]of e.marks.entries())i.type.name===`highlight`&&!T.has(String(i.attrs.color))&&t.push(`${r}.marks[${n}]=${JSON.stringify(i.attrs)}`);e.forEach((e,t,i)=>{n(e,`${r}.content[${i}]`)})};return n(e,`doc`),t.join(`; `)}function he(){return typeof document>`u`||!(`fonts`in document)?!0:document.fonts.status===`loaded`}function ge(f){let{hiddenContainer:p,pagesContainer:y,readOnly:b=!1,pageGap:x=ie,documentKey:S,editorMode:C,author:T,externalPlugins:ge=[],onAnonymizationMatchesChange:_e,showTemplateDirectives:ve,onSlashMenuChange:ye,onSlashMenuKeyAction:be,onChange:xe,onError:E,onSelectionUpdate:D,onEditorViewReady:O,onReadOnlyEditAttempt:k,featureFlags:A,onSelectiveSaveTripwire:j}=f,M=(0,e.shallowRef)(null),N=(0,e.shallowRef)(null),P=(0,e.shallowRef)(null),F=(0,e.shallowRef)(null),I=(0,e.shallowRef)([]),L=(0,e.shallowRef)([]),R=(0,e.ref)(!1),z=(0,e.ref)(null),B=(0,e.ref)(!1),V=new ee.ExtensionManager((0,te.createStarterKit)());V.buildSchema(),V.initializeRuntime();let Se=(0,i.createSuggestionModePlugin)(!1),Ce=(0,n.createAnonymizationDecorationsPlugin)({onMatchesChange:e=>_e?.(e)}),H=(0,r.createTemplateDirectivesPlugin)(),U=(0,re.templateSlashMenuPlugin)({onChange:e=>ye?.(e),onKeyAction:e=>be?.(e)??!1}),W=(0,ne.createTemplatePreviewValuesPlugin)(),G=()=>(0,e.toValue)(ve)===!0;function K(){return[Se,...ge,Ce,...G()?[H,U]:[],W]}let q=(0,o.createFolioEditorEmitter)(),J=new h.LayoutSelectionGate,we=(0,u.createLayoutSession)(),Te=new m.LayoutPainter({pageGap:x,showShadow:!0});function Ee(e){e.layout&&(F.value=e.layout),e.blocks&&(I.value=e.blocks),e.measures&&(L.value=e.measures),e.blockLookup&&Te.setBlockLookup(e.blockLookup),e.layout&&q.emit(`layoutComplete`,e.layout)}function Y(e,n={}){let r=y.value,i=r instanceof HTMLDivElement?r:null,a=M.value,o=a?.package.document,s=o?.sections?.[0]?.properties??o?.finalSectionProperties??null,l=(0,t.getPageSize)(s),u=(0,t.getMargins)(s),d=le(s),f=l.w-u.left-u.right,p=a?.package.styles??null,m=a?.package.theme??null,h=a?.package.settings?.defaultTabStop,g=de(a,s);try{Ee((0,c.runLayoutPipeline)({contentWidth:f,columns:d,pageSize:l,margins:u,pageGap:x,syncCoordinator:J,headerContent:g.header.hf,footerContent:g.footer.hf,firstPageHeaderContent:g.firstHeader.hf,firstPageFooterContent:g.firstFooter.hf,headerContentRId:g.header.rId,footerContentRId:g.footer.rId,firstPageHeaderContentRId:g.firstHeader.rId,firstPageFooterContentRId:g.firstFooter.rId,sectionHeaderFooterRefs:ue(a),theme:m,sectionProperties:s,document:a,defaultTabStop:h,styles:p,layout:F.value,hfPMs:null,painter:Te,pagesContainer:i,session:we,renderHfFromContentOrPm:w,renderHeaderFooterContentByRId:fe,documentFontsAreLoaded:he,buildFootnoteRenderItems:pe,describeInvalidHighlightMarks:me,emptyTemplatePreviewEntries:ce},e,n))}catch(e){let t=e instanceof Error?e:Error(String(e));E?.(t)}}let X=(0,l.createLayoutScheduler)({runLayout:(e,t)=>Y(e,t),debounceMs:ae,maxDelayMs:oe,clock:l.browserClock}),Z=null;function De(){Z!==null&&(window.clearTimeout(Z),Z=null);let e=N.value,t=M.value;if(!(!e||!t))try{let n=(0,_.fromProseDoc)(e.state.doc,t);M.value=n,xe?.(n),q.emit(`docChange`,n)}catch(e){E?.(e instanceof Error?e:Error(String(e)))}}function Oe(){Z!==null&&window.clearTimeout(Z),Z=window.setTimeout(()=>{Z=null,De()},se)}let Q=(0,s.createHiddenEditorManager)({getHost:()=>p.value,getDocument:()=>M.value,getStyles:()=>M.value?.package.styles??null,getExtensionManager:()=>V,getExternalPlugins:K,getCollaboration:()=>void 0,getCollaborationModules:()=>null,getPrecomputedInitialState:()=>null,getReadOnly:()=>(0,e.toValue)(b),getDocumentKey:()=>(0,e.toValue)(S),getDocumentContext:()=>M.value,onTransaction:ke,onSelectionChange:e=>{P.value=e,D?.(e),q.emit(`selectionChange`,{from:e.selection.from,to:e.selection.to})},onKeyDown:()=>!1,onReadOnlyEditAttempt:()=>k?.(),onEditorViewReady:Ae,onEditorViewDestroy:()=>{N.value=null,R.value=!1,O?.(null)},onRemoteSelectionsChange:()=>{}});function ke(e,t){P.value=t,e.docChanged&&(B.value=!0,J.incrementStateSeq(),X.schedule(t,(0,g.getTransactionDirtyRange)(e)),Oe()),J.requestRender()}function Ae(t){N.value=t,P.value=t.state,R.value=!0,Y(t.state,{reason:`initial`}),J.requestRender(),Me(t),O?.(t),(0,e.toValue)(b)||requestAnimationFrame(()=>{N.value===t&&t.focus()})}let je=(0,a.createFolioEditor)({getEditorApi:()=>Q.api,getLayout:()=>F.value,runLayout:(e,t)=>Y(e,t),emitter:q});function Me(t){(0,i.setSuggestionMode)((0,e.toValue)(C)===`suggesting`,t.state,t.dispatch,(0,e.toValue)(T))}(0,e.watch)([()=>(0,e.toValue)(C),()=>(0,e.toValue)(T)],()=>{let e=N.value;e&&Me(e)}),(0,e.watch)(()=>(0,e.toValue)(b),()=>Q.syncEditable());function Ne(e){let t=G();if(t===e.state.plugins.includes(H))return;let n=e.state.plugins.filter(e=>e!==H&&e!==U);if(t){let e=n.indexOf(W),t=e===-1?n.length:e;n.splice(t,0,H,U)}e.updateState(e.state.reconfigure({plugins:n}))}(0,e.watch)(()=>G(),()=>{let e=N.value;e&&Ne(e)});function Pe(){Q.ensureView()}function Fe(){B.value=!1,X.dispose(),Q.destroyView(),Q.ensureView(),Q.getView()||Ie()}function Ie(){let e=M.value;if(e)try{let t=(0,s.createHiddenEditorState)({document:e,styles:e.package.styles??null,manager:V,externalPlugins:K(),collaborationModules:null,reason:`mount`});P.value=t,Y(t,{reason:`initial`})}catch(e){E?.(e instanceof Error?e:Error(String(e)))}}(0,e.watch)([p,y],()=>{p.value&&M.value&&!Q.getView()&&Pe()},{flush:`post`});async function Le(e){z.value=null,R.value=!1;try{M.value=await(0,d.parseDocx)(e),Fe()}catch(e){let t=e instanceof Error?e:Error(String(e));z.value=t.message,E?.(t)}}function Re(e){z.value=null,M.value=e,Fe()}async function ze(t){let n=N.value,r=M.value;if(!n||!r)return null;let i=n.state,{resolveSelectiveSaveFlags:a}=await import(`@stll/folio-core/docx/selectiveSaveFlags`),o=a((0,e.toValue)(A)),s=(0,_.fromProseDoc)(i.doc,r),c=s.originalBuffer??null,l=o.selectiveSave&&t?.selective!==!1,u=l||o.selectiveSaveTripwire,{repackDocx:d,createDocx:f}=await import(`@stll/folio-core/docx/rezip`),p=null;if(u&&c){let{attemptSelectiveSave:e}=await import(`@stll/folio-core/docx/selectiveSave`);p=await e(s,c,{changedParaIds:(0,v.getChangedParagraphIds)(i),structuralChange:(0,v.hasStructuralChanges)(i),hasUntrackedChanges:(0,v.hasUntrackedChanges)(i),maxBytes:o.selectiveSaveMaxBytes})}let m=l?p:null,h=null;if(!m)h=c?await d(s):await f(s),m=h;else if(o.selectiveSaveTripwire)try{h=await d(s)}catch{}if(o.selectiveSaveTripwire&&h&&j)try{let{compareSelectiveVsFull:e}=await import(`@stll/folio-core/docx/selectiveSaveTripwire`);j(await e(p,h))}catch{}return B.value=!1,new Blob([m],{type:`application/vnd.openxmlformats-officedocument.wordprocessingml.document`})}function Be(){return M.value}function Ve(e){M.value=e}function He(){return V.getCommands()}function Ue(){N.value?.focus()}function We(){let e=N.value;e&&Y(e.state,{reason:`manual`})}function $(){X.dispose(),Z!==null&&(window.clearTimeout(Z),Z=null),Q.destroyView(),V.destroy(),P.value=null,F.value=null,M.value=null,R.value=!1}return(0,e.onScopeDispose)($),{editor:je,editorView:N,editorState:P,isReady:R,isDirty:B,parseError:z,layout:F,blocks:I,measures:L,loadBuffer:Le,loadDocument:Re,save:ze,getDocument:Be,setDocument:Ve,getCommands:He,focus:Ue,reLayout:We,destroy:$}}function _e(e,t){if(t<e.top+40){let n=Math.max(0,e.top+40-t);return-Math.min(12,n/40*12)}if(t>e.bottom-40){let n=Math.max(0,t-(e.bottom-40));return Math.min(12,n/40*12)}return 0}function ve({pagesContainer:t,onScrollExtendSelection:n}){let r=null,i=0,a=0,o=!1,s=null;function c(){if(s)return s;let e=t.value;return e?(s=(0,y.findVerticalScrollParent)(e),s):null}function l(){o=!1,r!==null&&(cancelAnimationFrame(r),r=null)}function u(){if(!o)return;let e=c();if(!e)return;let t=_e(e.getBoundingClientRect(),a);t!==0&&(e.scrollTop+=t,n(i,a)),r=requestAnimationFrame(u)}function d(){o||(o=!0,r=requestAnimationFrame(u))}function f(e,t){if(i=e,a=t,!o){let e=c();if(!e)return;let n=e.getBoundingClientRect();(t<n.top+40||t>n.bottom-40)&&d()}}return(0,e.onScopeDispose)(()=>l()),{updateMousePosition:f,stopAutoScroll:l}}function ye(){let e={active:!1,startX:0,handle:null,columnIndex:0,tablePmStart:0,origWidths:{left:0,right:0}},t={active:!1,startY:0,handle:null,rowIndex:0,isEdge:!1,tablePmStart:0,origHeight:0},n={active:!1,startX:0,handle:null,columnIndex:0,tablePmStart:0,origWidth:0},r=null;function i(){return e.active||t.active||n.active}function a(i,a){let o=i.target;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),be(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),xe(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),E(a,n),!0):!1:!1}function o(r){if(e.active&&e.handle){r.preventDefault();let t=r.clientX-e.startX,n=parseFloat(e.handle.style.left);e.handle.style.left=`${n+t}px`,e.startX=r.clientX;let i=Math.round(t*b.TWIPS_PER_PIXEL),a=e.origWidths.left+i,o=e.origWidths.right-i;a>=b.MIN_CELL_WIDTH_TWIPS&&o>=b.MIN_CELL_WIDTH_TWIPS&&(e.origWidths={left:a,right:o});return}if(t.active&&t.handle){r.preventDefault();let e=r.clientY-t.startY,n=parseFloat(t.handle.style.top);t.handle.style.top=`${n+e}px`,t.startY=r.clientY;let i=Math.round(e*b.TWIPS_PER_PIXEL),a=t.origHeight+i;a>=b.MIN_ROW_HEIGHT_TWIPS&&(t.origHeight=a);return}if(n.active&&n.handle){r.preventDefault();let e=r.clientX-n.startX,t=parseFloat(n.handle.style.left);n.handle.style.left=`${t+e}px`,n.startX=r.clientX;let i=Math.round(e*b.TWIPS_PER_PIXEL),a=n.origWidth+i;a>=b.MIN_CELL_WIDTH_TWIPS&&(n.origWidth=a)}}function s(i){if(e.active){e.active=!1,e.handle?.classList.remove(`dragging`),r&&(0,b.commitColumnResize)(r,{pmStart:e.tablePmStart,colIdx:e.columnIndex,newLeft:e.origWidths.left,newRight:e.origWidths.right}),e.handle=null;return}if(t.active){t.active=!1,t.handle?.classList.remove(`dragging`),r&&(0,b.commitRowResize)(r,{pmStart:t.tablePmStart,rowIdx:t.rowIndex,newHeight:t.origHeight}),t.handle=null;return}n.active&&(n.active=!1,n.handle?.classList.remove(`dragging`),r&&(0,b.commitRightEdgeResize)(r,{pmStart:n.tablePmStart,colIdx:n.columnIndex,newWidth:n.origWidth}),n.handle=null)}function c(){return document.addEventListener(`mousemove`,o),document.addEventListener(`mouseup`,s),()=>{document.removeEventListener(`mousemove`,o),document.removeEventListener(`mouseup`,s)}}return{tryStartResize:a,install:c,isResizing:i}}function be(e,t){let n=(0,b.readColumnWidths)(e,t.tablePmStart,t.columnIndex);n&&(t.origWidths=n)}function xe(e,t,n){let r=(0,b.readRowHeight)(e,t.tablePmStart,t.rowIndex);if(r!=null){t.origHeight=r;return}let i=n.closest(`.layout-table`)?.querySelector(`[data-row-index="${t.rowIndex}"]`),a=i?i.getBoundingClientRect().height:30;t.origHeight=Math.round(a*b.TWIPS_PER_PIXEL)}function E(e,t){let n=(0,b.readColumnWidthAt)(e,t.tablePmStart,t.columnIndex);n!=null&&(t.origWidth=n)}function D(t,n){return(0,e.computed)(()=>(n.value,(0,x.extractTrackedChanges)(t.value?.state??null)))}var O=.5,k=2,A=.1,j=[.5,.75,1,1.25,1.5,2];function M(t=1){let n=(0,e.ref)(Math.max(O,Math.min(k,t))),r=(0,e.computed)(()=>Math.round(n.value*100)),i=(0,e.computed)(()=>n.value<=O),a=(0,e.computed)(()=>n.value>=k);function o(e){n.value=Math.max(O,Math.min(k,Math.round(e*100)/100))}function s(){o(n.value+A)}function c(){o(n.value-A)}function l(){o(1)}function u(e){(e.ctrlKey||e.metaKey)&&(e.preventDefault(),e.deltaY<0?s():c())}function d(e){(e.ctrlKey||e.metaKey)&&(e.shiftKey||e.altKey||(e.key===`=`||e.key===`+`?(e.preventDefault(),s()):e.key===`-`?(e.preventDefault(),c()):e.key===`0`&&(e.preventDefault(),l())))}function f(){(0,e.onMounted)(()=>document.addEventListener(`keydown`,d)),(0,e.onBeforeUnmount)(()=>document.removeEventListener(`keydown`,d))}return{zoom:n,zoomPercent:r,isMinZoom:i,isMaxZoom:a,setZoom:o,zoomIn:s,zoomOut:c,resetZoom:l,handleWheel:u,handleKeyDown:d,installShortcuts:f,ZOOM_PRESETS:j}}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return M}});
|