@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.
Files changed (109) hide show
  1. package/dist/ListButtons-B498PX1d.js +4256 -0
  2. package/dist/ListButtons-D-zMJ7rl.cjs +4 -0
  3. package/dist/PageSetupDialog-CGBaBVzo.cjs +15 -0
  4. package/dist/PageSetupDialog-DsjAfJy0.js +4873 -0
  5. package/dist/TablePropertiesDialog-A-1Pm1f9.cjs +1 -0
  6. package/dist/TablePropertiesDialog-PyXEJC_o.js +887 -0
  7. package/dist/components/DocxEditor/pagedEditorRef.d.ts +75 -0
  8. package/dist/components/DocxEditor/types.d.ts +528 -0
  9. package/dist/components/EditorToolbarContext.d.ts +9 -0
  10. package/dist/components/FormattingBar.types.d.ts +67 -0
  11. package/dist/components/Toolbar/presets.d.ts +25 -0
  12. package/dist/components/dialogs/index.d.ts +24 -0
  13. package/dist/components/imageContextMenuTypes.d.ts +30 -0
  14. package/dist/components/imageSelectionTypes.d.ts +13 -0
  15. package/dist/components/insertTableState.d.ts +9 -0
  16. package/dist/components/sidebar/cardStyles.d.ts +1 -0
  17. package/dist/components/sidebar/cardUtils.d.ts +1 -0
  18. package/dist/components/sidebar/resolveItemPositions.d.ts +22 -0
  19. package/dist/components/sidebar/sidebarUtils.d.ts +4 -0
  20. package/dist/components/tableStylePresets.d.ts +60 -0
  21. package/dist/components/toolbarUtils.d.ts +3 -0
  22. package/dist/components/ui/AlignmentButtons.types.d.ts +13 -0
  23. package/dist/components/ui/StylePicker.types.d.ts +16 -0
  24. package/dist/components/ui/ZoomControl.types.d.ts +21 -0
  25. package/dist/components/ui/fontPickerValue.d.ts +1 -0
  26. package/dist/components/ui/hyperlinkPopupTypes.d.ts +20 -0
  27. package/dist/composables/commentMarks.d.ts +32 -0
  28. package/dist/composables/imageOverlayRect.d.ts +44 -0
  29. package/dist/composables/index.d.ts +30 -0
  30. package/dist/composables/useAutoSave.d.ts +39 -0
  31. package/dist/composables/useClipboard.d.ts +21 -0
  32. package/dist/composables/useColorMode.d.ts +8 -0
  33. package/dist/composables/useCommentLifecycle.d.ts +39 -0
  34. package/dist/composables/useCommentManagement.d.ts +47 -0
  35. package/dist/composables/useCommentSidebarItems.d.ts +24 -0
  36. package/dist/composables/useContextMenus.d.ts +64 -0
  37. package/dist/composables/useControllableBoolean.d.ts +16 -0
  38. package/dist/composables/useDocumentLifecycle.d.ts +11 -0
  39. package/dist/composables/useDocxEditor.d.ts +123 -0
  40. package/dist/composables/useDocxEditorRefApi.d.ts +68 -0
  41. package/dist/composables/useDragAutoScroll.d.ts +11 -0
  42. package/dist/composables/useFileIO.d.ts +43 -0
  43. package/dist/composables/useFindReplace.d.ts +22 -0
  44. package/dist/composables/useFixedDropdown.d.ts +14 -0
  45. package/dist/composables/useFormattingActions.d.ts +21 -0
  46. package/dist/composables/useHistory.d.ts +9 -0
  47. package/dist/composables/useHostCallbacks.d.ts +24 -0
  48. package/dist/composables/useHyperlinkManagement.d.ts +40 -0
  49. package/dist/composables/useImageActions.d.ts +25 -0
  50. package/dist/composables/useKeyboardShortcuts.d.ts +25 -0
  51. package/dist/composables/useMenuActions.d.ts +36 -0
  52. package/dist/composables/useOutlineSidebar.d.ts +24 -0
  53. package/dist/composables/usePageSetupControls.d.ts +28 -0
  54. package/dist/composables/usePagesPointer.d.ts +87 -0
  55. package/dist/composables/useParagraphStyleOptions.d.ts +18 -0
  56. package/dist/composables/usePortalClass.d.ts +8 -0
  57. package/dist/composables/useSelectionHighlight.d.ts +19 -0
  58. package/dist/composables/useSelectionSync.d.ts +30 -0
  59. package/dist/composables/useTableResize.d.ts +7 -0
  60. package/dist/composables/useTableSelection.d.ts +10 -0
  61. package/dist/composables/useToolbarDropdowns.d.ts +15 -0
  62. package/dist/composables/useToolbarFontSize.d.ts +15 -0
  63. package/dist/composables/useTrackedChanges.d.ts +12 -0
  64. package/dist/composables/useVisualLineNavigation.d.ts +11 -0
  65. package/dist/composables/useWheelZoom.d.ts +10 -0
  66. package/dist/composables/useZoom.d.ts +16 -0
  67. package/dist/composables.cjs +61 -0
  68. package/dist/composables.js +378 -0
  69. package/dist/dialogs.cjs +1 -0
  70. package/dist/dialogs.js +3 -0
  71. package/dist/folio-vue.css +2 -0
  72. package/dist/i18n/index.d.ts +36 -0
  73. package/dist/i18n/messages.d.ts +1 -0
  74. package/dist/index.cjs +1 -0
  75. package/dist/index.d.ts +50 -0
  76. package/dist/index.js +4088 -0
  77. package/dist/messages.cjs +1 -0
  78. package/dist/messages.js +1 -0
  79. package/dist/renderAsync.d.ts +35 -0
  80. package/dist/styles/index.d.ts +12 -0
  81. package/dist/styles/zIndex.d.ts +18 -0
  82. package/dist/styles.cjs +1 -0
  83. package/dist/styles.js +5 -0
  84. package/dist/ui/folio-ui.d.ts +139 -0
  85. package/dist/ui.cjs +1 -0
  86. package/dist/ui.d.ts +67 -0
  87. package/dist/ui.js +446 -0
  88. package/dist/useZoom-BryUw3Cu.cjs +1 -0
  89. package/dist/useZoom-CIIRid8U.js +626 -0
  90. package/dist/utils/aiEditRange.d.ts +26 -0
  91. package/dist/utils/autoScroll.d.ts +22 -0
  92. package/dist/utils/cardStyles.d.ts +3 -0
  93. package/dist/utils/colorMode.d.ts +32 -0
  94. package/dist/utils/comments.d.ts +20 -0
  95. package/dist/utils/cssTypes.d.ts +7 -0
  96. package/dist/utils/domQueries.d.ts +39 -0
  97. package/dist/utils/fontOptions.d.ts +26 -0
  98. package/dist/utils/hostFonts.d.ts +25 -0
  99. package/dist/utils/imageClipboard.d.ts +9 -0
  100. package/dist/utils/index.d.ts +13 -0
  101. package/dist/utils/listState.d.ts +22 -0
  102. package/dist/utils/reportIssue.d.ts +18 -0
  103. package/dist/utils/selectionHighlight.d.ts +44 -0
  104. package/dist/utils/sidebarConstants.d.ts +8 -0
  105. package/dist/utils/stylePreview.d.ts +53 -0
  106. package/dist/utils/textSelection.d.ts +40 -0
  107. package/dist/zIndex-BY0qa8Au.js +12 -0
  108. package/dist/zIndex-dFsQbASx.cjs +1 -0
  109. package/package.json +99 -0
@@ -0,0 +1,626 @@
1
+ import { computed as e, onBeforeUnmount as t, onMounted as n, onScopeDispose as r, ref as i, shallowRef as a, toValue as o, watch as s } from "vue";
2
+ import { getMargins as c, getPageSize as l, twipsToPixels as u } from "@stll/folio-core/paged-layout/sectionGeometry";
3
+ import { createAnonymizationDecorationsPlugin as d } from "@stll/folio-core/prosemirror/plugins/anonymizationDecorations";
4
+ import { createTemplateDirectivesPlugin as f } from "@stll/folio-core/prosemirror/plugins/templateDirectives";
5
+ import { createSuggestionModePlugin as p, setSuggestionMode as m } from "@stll/folio-core/prosemirror/plugins/suggestionMode";
6
+ import { createFolioEditor as h } from "@stll/folio-core/controller/folioEditor";
7
+ import { createFolioEditorEmitter as ee } from "@stll/folio-core/controller/folioEditorEvents";
8
+ import { createHiddenEditorManager as g, createHiddenEditorState as te } from "@stll/folio-core/controller/hiddenEditorManager";
9
+ import { runLayoutPipeline as ne } from "@stll/folio-core/controller/layoutPipeline";
10
+ import { browserClock as re, createLayoutScheduler as ie } from "@stll/folio-core/controller/layoutScheduler";
11
+ import { createLayoutSession as ae } from "@stll/folio-core/controller/layoutSession";
12
+ import { parseDocx as oe } from "@stll/folio-core/docx/parser";
13
+ import { getFootnoteText as _ } from "@stll/folio-core/docx/footnoteParser";
14
+ import { convertHeaderFooterPmDocToContent as v, convertHeaderFooterToContent as y } from "@stll/folio-core/layout-bridge/convert/headerFooterLayout";
15
+ import { LayoutPainter as se } from "@stll/folio-core/layout-painter";
16
+ import { LayoutSelectionGate as ce } from "@stll/folio-core/paged-layout/LayoutSelectionGate";
17
+ import { getTransactionDirtyRange as le } from "@stll/folio-core/paged-layout/transactionDirtyRange";
18
+ import { fromProseDoc as b } from "@stll/folio-core/prosemirror/conversion/fromProseDoc";
19
+ import { ExtensionManager as ue } from "@stll/folio-core/prosemirror/extensions/ExtensionManager";
20
+ import { getChangedParagraphIds as de, hasStructuralChanges as fe, hasUntrackedChanges as pe } from "@stll/folio-core/prosemirror/extensions/features/ParagraphChangeTrackerExtension";
21
+ import { createStarterKit as me } from "@stll/folio-core/prosemirror/extensions/StarterKit";
22
+ import { createTemplatePreviewValuesPlugin as he } from "@stll/folio-core/prosemirror/plugins/templatePreviewValues";
23
+ import { templateSlashMenuPlugin as ge } from "@stll/folio-core/prosemirror/plugins/templateSlashMenu";
24
+ import { findVerticalScrollParent as x } from "@stll/folio-core/utils/findVerticalScrollParent";
25
+ import { MIN_CELL_WIDTH_TWIPS as S, MIN_ROW_HEIGHT_TWIPS as _e, TWIPS_PER_PIXEL as C, commitColumnResize as ve, commitRightEdgeResize as ye, commitRowResize as be, readColumnWidthAt as w, readColumnWidths as xe, readRowHeight as T } from "@stll/folio-core/prosemirror/tableResize";
26
+ import { extractTrackedChanges as E } from "@stll/folio-core/prosemirror/utils/extractTrackedChanges";
27
+ //#region src/composables/useDocxEditor.ts
28
+ var Se = 24, Ce = 32, we = 96, Te = 250, Ee = [];
29
+ function De(e) {
30
+ let t = e?.columnCount ?? 1;
31
+ if (t <= 1) return;
32
+ let n = {
33
+ count: t,
34
+ gap: u(e?.columnSpace ?? 720),
35
+ equalWidth: e?.equalWidth ?? !0
36
+ };
37
+ return e?.separator !== void 0 && (n.separator = e.separator), n;
38
+ }
39
+ function D(e) {
40
+ let t = {};
41
+ e.titlePg !== void 0 && (t.titlePg = e.titlePg);
42
+ for (let n of e.headerReferences ?? []) n.type === "default" ? t.headerDefault = n.rId : n.type === "first" ? t.headerFirst = n.rId : t.headerEven = n.rId;
43
+ for (let n of e.footerReferences ?? []) n.type === "default" ? t.footerDefault = n.rId : n.type === "first" ? t.footerFirst = n.rId : t.footerEven = n.rId;
44
+ return t;
45
+ }
46
+ function Oe(e) {
47
+ let t = e?.package.document;
48
+ if (!t) return;
49
+ let n = t.sections;
50
+ if (n && n.length > 0) return n.map((e) => D(e.properties));
51
+ let r = t.finalSectionProperties;
52
+ if (r) return [D(r)];
53
+ }
54
+ var O = {
55
+ hf: null,
56
+ rId: null
57
+ };
58
+ function ke(e, t) {
59
+ let n = e?.package;
60
+ if (!n || !t) return {
61
+ header: O,
62
+ footer: O,
63
+ firstHeader: O,
64
+ firstFooter: O
65
+ };
66
+ 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;
67
+ for (let e of t.headerReferences ?? []) e.type === "default" ? s = e.rId : e.type === "first" && (c = e.rId);
68
+ let l = null, u = null;
69
+ for (let e of t.footerReferences ?? []) e.type === "default" ? l = e.rId : e.type === "first" && (u = e.rId);
70
+ return {
71
+ header: {
72
+ hf: a(s),
73
+ rId: s
74
+ },
75
+ footer: {
76
+ hf: o(l),
77
+ rId: l
78
+ },
79
+ firstHeader: {
80
+ hf: a(c),
81
+ rId: c
82
+ },
83
+ firstFooter: {
84
+ hf: o(u),
85
+ rId: u
86
+ }
87
+ };
88
+ }
89
+ function k(e, t, n, r, i, a) {
90
+ if (!e) return;
91
+ let o = t ? {
92
+ ...a,
93
+ rId: t
94
+ } : a, s = t ? n?.getView(t) : null;
95
+ return s ? v(s.state.doc, r, i, o) : y(e, r, i, o);
96
+ }
97
+ function Ae(e, t, n, r, i) {
98
+ if (!e || e.size === 0) return;
99
+ let a = /* @__PURE__ */ new Map();
100
+ for (let [o, s] of e) {
101
+ let e = k(s, o, t, n, r, i);
102
+ e && a.set(o, e);
103
+ }
104
+ return a.size > 0 ? a : void 0;
105
+ }
106
+ function je(e, t, n) {
107
+ let r = /* @__PURE__ */ new Map();
108
+ if (!n || !n.package.footnotes) return r;
109
+ let i = /* @__PURE__ */ new Map();
110
+ for (let e of n.package.footnotes) e.noteType && e.noteType !== "normal" || i.set(e.id, e);
111
+ for (let [n, a] of e) {
112
+ let e = [];
113
+ for (let n of a) {
114
+ let r = i.get(n);
115
+ if (!r) continue;
116
+ let a = t.get(n), o = a?.displayNumber ?? 0;
117
+ e.push({
118
+ displayNumber: String(o),
119
+ text: _(r),
120
+ ...a ? { content: {
121
+ blocks: a.blocks,
122
+ measures: a.measures,
123
+ height: a.height
124
+ } } : {}
125
+ });
126
+ }
127
+ e.length > 0 && r.set(n, e);
128
+ }
129
+ return r;
130
+ }
131
+ var A = new Set([
132
+ "black",
133
+ "blue",
134
+ "cyan",
135
+ "darkBlue",
136
+ "darkCyan",
137
+ "darkGray",
138
+ "darkGreen",
139
+ "darkMagenta",
140
+ "darkRed",
141
+ "darkYellow",
142
+ "green",
143
+ "lightGray",
144
+ "magenta",
145
+ "none",
146
+ "red",
147
+ "white",
148
+ "yellow"
149
+ ]);
150
+ function Me(e) {
151
+ let t = [], n = (e, r) => {
152
+ for (let [n, i] of e.marks.entries()) i.type.name === "highlight" && !A.has(String(i.attrs.color)) && t.push(`${r}.marks[${n}]=${JSON.stringify(i.attrs)}`);
153
+ e.forEach((e, t, i) => {
154
+ n(e, `${r}.content[${i}]`);
155
+ });
156
+ };
157
+ return n(e, "doc"), t.join("; ");
158
+ }
159
+ function Ne() {
160
+ return typeof document > "u" || !("fonts" in document) ? !0 : document.fonts.status === "loaded";
161
+ }
162
+ function j(e) {
163
+ let { hiddenContainer: t, pagesContainer: n, readOnly: u = !1, pageGap: _ = Se, documentKey: v, editorMode: y, author: x, externalPlugins: S = [], onAnonymizationMatchesChange: _e, showTemplateDirectives: C, onSlashMenuChange: ve, onSlashMenuKeyAction: ye, onChange: be, onError: w, onSelectionUpdate: xe, onEditorViewReady: T, onReadOnlyEditAttempt: E, featureFlags: D, onSelectiveSaveTripwire: O } = e, A = a(null), j = a(null), M = a(null), N = a(null), P = a([]), F = a([]), I = i(!1), L = i(null), R = i(!1), z = new ue(me());
164
+ z.buildSchema(), z.initializeRuntime();
165
+ let B = p(!1), V = d({ onMatchesChange: (e) => _e?.(e) }), H = f(), U = ge({
166
+ onChange: (e) => ve?.(e),
167
+ onKeyAction: (e) => ye?.(e) ?? !1
168
+ }), W = he(), G = () => o(C) === !0;
169
+ function Pe() {
170
+ return [
171
+ B,
172
+ ...S,
173
+ V,
174
+ ...G() ? [H, U] : [],
175
+ W
176
+ ];
177
+ }
178
+ let K = ee(), q = new ce(), Fe = ae(), Ie = new se({
179
+ pageGap: _,
180
+ showShadow: !0
181
+ });
182
+ function Le(e) {
183
+ e.layout && (N.value = e.layout), e.blocks && (P.value = e.blocks), e.measures && (F.value = e.measures), e.blockLookup && Ie.setBlockLookup(e.blockLookup), e.layout && K.emit("layoutComplete", e.layout);
184
+ }
185
+ function J(e, t = {}) {
186
+ let r = n.value, i = r instanceof HTMLDivElement ? r : null, a = A.value, o = a?.package.document, s = o?.sections?.[0]?.properties ?? o?.finalSectionProperties ?? null, u = l(s), d = c(s), f = De(s), p = u.w - d.left - d.right, m = a?.package.styles ?? null, h = a?.package.theme ?? null, ee = a?.package.settings?.defaultTabStop, g = ke(a, s);
187
+ try {
188
+ Le(ne({
189
+ contentWidth: p,
190
+ columns: f,
191
+ pageSize: u,
192
+ margins: d,
193
+ pageGap: _,
194
+ syncCoordinator: q,
195
+ headerContent: g.header.hf,
196
+ footerContent: g.footer.hf,
197
+ firstPageHeaderContent: g.firstHeader.hf,
198
+ firstPageFooterContent: g.firstFooter.hf,
199
+ headerContentRId: g.header.rId,
200
+ footerContentRId: g.footer.rId,
201
+ firstPageHeaderContentRId: g.firstHeader.rId,
202
+ firstPageFooterContentRId: g.firstFooter.rId,
203
+ sectionHeaderFooterRefs: Oe(a),
204
+ theme: h,
205
+ sectionProperties: s,
206
+ document: a,
207
+ defaultTabStop: ee,
208
+ styles: m,
209
+ layout: N.value,
210
+ hfPMs: null,
211
+ painter: Ie,
212
+ pagesContainer: i,
213
+ session: Fe,
214
+ renderHfFromContentOrPm: k,
215
+ renderHeaderFooterContentByRId: Ae,
216
+ documentFontsAreLoaded: Ne,
217
+ buildFootnoteRenderItems: je,
218
+ describeInvalidHighlightMarks: Me,
219
+ emptyTemplatePreviewEntries: Ee
220
+ }, e, t));
221
+ } catch (e) {
222
+ let t = e instanceof Error ? e : Error(String(e));
223
+ w?.(t);
224
+ }
225
+ }
226
+ let Y = ie({
227
+ runLayout: (e, t) => J(e, t),
228
+ debounceMs: Ce,
229
+ maxDelayMs: we,
230
+ clock: re
231
+ }), X = null;
232
+ function Re() {
233
+ X !== null && (window.clearTimeout(X), X = null);
234
+ let e = j.value, t = A.value;
235
+ if (!(!e || !t)) try {
236
+ let n = b(e.state.doc, t);
237
+ A.value = n, be?.(n), K.emit("docChange", n);
238
+ } catch (e) {
239
+ w?.(e instanceof Error ? e : Error(String(e)));
240
+ }
241
+ }
242
+ function ze() {
243
+ X !== null && window.clearTimeout(X), X = window.setTimeout(() => {
244
+ X = null, Re();
245
+ }, Te);
246
+ }
247
+ let Z = g({
248
+ getHost: () => t.value,
249
+ getDocument: () => A.value,
250
+ getStyles: () => A.value?.package.styles ?? null,
251
+ getExtensionManager: () => z,
252
+ getExternalPlugins: Pe,
253
+ getCollaboration: () => void 0,
254
+ getCollaborationModules: () => null,
255
+ getPrecomputedInitialState: () => null,
256
+ getReadOnly: () => o(u),
257
+ getDocumentKey: () => o(v),
258
+ getDocumentContext: () => A.value,
259
+ onTransaction: Be,
260
+ onSelectionChange: (e) => {
261
+ M.value = e, xe?.(e), K.emit("selectionChange", {
262
+ from: e.selection.from,
263
+ to: e.selection.to
264
+ });
265
+ },
266
+ onKeyDown: () => !1,
267
+ onReadOnlyEditAttempt: () => E?.(),
268
+ onEditorViewReady: Ve,
269
+ onEditorViewDestroy: () => {
270
+ j.value = null, I.value = !1, T?.(null);
271
+ },
272
+ onRemoteSelectionsChange: () => {}
273
+ });
274
+ function Be(e, t) {
275
+ M.value = t, e.docChanged && (R.value = !0, q.incrementStateSeq(), Y.schedule(t, le(e)), ze()), q.requestRender();
276
+ }
277
+ function Ve(e) {
278
+ j.value = e, M.value = e.state, I.value = !0, J(e.state, { reason: "initial" }), q.requestRender(), Ue(e), T?.(e), o(u) || requestAnimationFrame(() => {
279
+ j.value === e && e.focus();
280
+ });
281
+ }
282
+ let He = h({
283
+ getEditorApi: () => Z.api,
284
+ getLayout: () => N.value,
285
+ runLayout: (e, t) => J(e, t),
286
+ emitter: K
287
+ });
288
+ function Ue(e) {
289
+ m(o(y) === "suggesting", e.state, e.dispatch, o(x));
290
+ }
291
+ s([() => o(y), () => o(x)], () => {
292
+ let e = j.value;
293
+ e && Ue(e);
294
+ }), s(() => o(u), () => Z.syncEditable());
295
+ function We(e) {
296
+ let t = G();
297
+ if (t === e.state.plugins.includes(H)) return;
298
+ let n = e.state.plugins.filter((e) => e !== H && e !== U);
299
+ if (t) {
300
+ let e = n.indexOf(W), t = e === -1 ? n.length : e;
301
+ n.splice(t, 0, H, U);
302
+ }
303
+ e.updateState(e.state.reconfigure({ plugins: n }));
304
+ }
305
+ s(() => G(), () => {
306
+ let e = j.value;
307
+ e && We(e);
308
+ });
309
+ function Ge() {
310
+ Z.ensureView();
311
+ }
312
+ function Q() {
313
+ R.value = !1, Y.dispose(), Z.destroyView(), Z.ensureView(), Z.getView() || Ke();
314
+ }
315
+ function Ke() {
316
+ let e = A.value;
317
+ if (e) try {
318
+ let t = te({
319
+ document: e,
320
+ styles: e.package.styles ?? null,
321
+ manager: z,
322
+ externalPlugins: Pe(),
323
+ collaborationModules: null,
324
+ reason: "mount"
325
+ });
326
+ M.value = t, J(t, { reason: "initial" });
327
+ } catch (e) {
328
+ w?.(e instanceof Error ? e : Error(String(e)));
329
+ }
330
+ }
331
+ s([t, n], () => {
332
+ t.value && A.value && !Z.getView() && Ge();
333
+ }, { flush: "post" });
334
+ async function qe(e) {
335
+ L.value = null, I.value = !1;
336
+ try {
337
+ A.value = await oe(e), Q();
338
+ } catch (e) {
339
+ let t = e instanceof Error ? e : Error(String(e));
340
+ L.value = t.message, w?.(t);
341
+ }
342
+ }
343
+ function Je(e) {
344
+ L.value = null, A.value = e, Q();
345
+ }
346
+ async function Ye(e) {
347
+ let t = j.value, n = A.value;
348
+ if (!t || !n) return null;
349
+ let r = t.state, { resolveSelectiveSaveFlags: i } = await import("@stll/folio-core/docx/selectiveSaveFlags"), a = i(o(D)), s = b(r.doc, n), c = s.originalBuffer ?? null, l = a.selectiveSave && e?.selective !== !1, u = l || a.selectiveSaveTripwire, { repackDocx: d, createDocx: f } = await import("@stll/folio-core/docx/rezip"), p = null;
350
+ if (u && c) {
351
+ let { attemptSelectiveSave: e } = await import("@stll/folio-core/docx/selectiveSave");
352
+ p = await e(s, c, {
353
+ changedParaIds: de(r),
354
+ structuralChange: fe(r),
355
+ hasUntrackedChanges: pe(r),
356
+ maxBytes: a.selectiveSaveMaxBytes
357
+ });
358
+ }
359
+ let m = l ? p : null, h = null;
360
+ if (!m) h = c ? await d(s) : await f(s), m = h;
361
+ else if (a.selectiveSaveTripwire) try {
362
+ h = await d(s);
363
+ } catch {}
364
+ if (a.selectiveSaveTripwire && h && O) try {
365
+ let { compareSelectiveVsFull: e } = await import("@stll/folio-core/docx/selectiveSaveTripwire");
366
+ O(await e(p, h));
367
+ } catch {}
368
+ return R.value = !1, new Blob([m], { type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" });
369
+ }
370
+ function Xe() {
371
+ return A.value;
372
+ }
373
+ function Ze(e) {
374
+ A.value = e;
375
+ }
376
+ function Qe() {
377
+ return z.getCommands();
378
+ }
379
+ function $e() {
380
+ j.value?.focus();
381
+ }
382
+ function et() {
383
+ let e = j.value;
384
+ e && J(e.state, { reason: "manual" });
385
+ }
386
+ function $() {
387
+ Y.dispose(), X !== null && (window.clearTimeout(X), X = null), Z.destroyView(), z.destroy(), M.value = null, N.value = null, A.value = null, I.value = !1;
388
+ }
389
+ return r($), {
390
+ editor: He,
391
+ editorView: j,
392
+ editorState: M,
393
+ isReady: I,
394
+ isDirty: R,
395
+ parseError: L,
396
+ layout: N,
397
+ blocks: P,
398
+ measures: F,
399
+ loadBuffer: qe,
400
+ loadDocument: Je,
401
+ save: Ye,
402
+ getDocument: Xe,
403
+ setDocument: Ze,
404
+ getCommands: Qe,
405
+ focus: $e,
406
+ reLayout: et,
407
+ destroy: $
408
+ };
409
+ }
410
+ function M(e, t) {
411
+ if (t < e.top + 40) {
412
+ let n = Math.max(0, e.top + 40 - t);
413
+ return -Math.min(12, n / 40 * 12);
414
+ }
415
+ if (t > e.bottom - 40) {
416
+ let n = Math.max(0, t - (e.bottom - 40));
417
+ return Math.min(12, n / 40 * 12);
418
+ }
419
+ return 0;
420
+ }
421
+ //#endregion
422
+ //#region src/composables/useDragAutoScroll.ts
423
+ function N({ pagesContainer: e, onScrollExtendSelection: t }) {
424
+ let n = null, i = 0, a = 0, o = !1, s = null;
425
+ function c() {
426
+ if (s) return s;
427
+ let t = e.value;
428
+ return t ? (s = x(t), s) : null;
429
+ }
430
+ function l() {
431
+ o = !1, n !== null && (cancelAnimationFrame(n), n = null);
432
+ }
433
+ function u() {
434
+ if (!o) return;
435
+ let e = c();
436
+ if (!e) return;
437
+ let r = M(e.getBoundingClientRect(), a);
438
+ r !== 0 && (e.scrollTop += r, t(i, a)), n = requestAnimationFrame(u);
439
+ }
440
+ function d() {
441
+ o || (o = !0, n = requestAnimationFrame(u));
442
+ }
443
+ function f(e, t) {
444
+ if (i = e, a = t, !o) {
445
+ let e = c();
446
+ if (!e) return;
447
+ let n = e.getBoundingClientRect();
448
+ (t < n.top + 40 || t > n.bottom - 40) && d();
449
+ }
450
+ }
451
+ return r(() => l()), {
452
+ updateMousePosition: f,
453
+ stopAutoScroll: l
454
+ };
455
+ }
456
+ //#endregion
457
+ //#region src/composables/useTableResize.ts
458
+ function P() {
459
+ let e = {
460
+ active: !1,
461
+ startX: 0,
462
+ handle: null,
463
+ columnIndex: 0,
464
+ tablePmStart: 0,
465
+ origWidths: {
466
+ left: 0,
467
+ right: 0
468
+ }
469
+ }, t = {
470
+ active: !1,
471
+ startY: 0,
472
+ handle: null,
473
+ rowIndex: 0,
474
+ isEdge: !1,
475
+ tablePmStart: 0,
476
+ origHeight: 0
477
+ }, n = {
478
+ active: !1,
479
+ startX: 0,
480
+ handle: null,
481
+ columnIndex: 0,
482
+ tablePmStart: 0,
483
+ origWidth: 0
484
+ }, r = null;
485
+ function i() {
486
+ return e.active || t.active || n.active;
487
+ }
488
+ function a(i, a) {
489
+ let o = i.target;
490
+ 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), F(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), I(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), L(a, n), !0) : !1 : !1;
491
+ }
492
+ function o(r) {
493
+ if (e.active && e.handle) {
494
+ r.preventDefault();
495
+ let t = r.clientX - e.startX, n = parseFloat(e.handle.style.left);
496
+ e.handle.style.left = `${n + t}px`, e.startX = r.clientX;
497
+ let i = Math.round(t * C), a = e.origWidths.left + i, o = e.origWidths.right - i;
498
+ a >= S && o >= S && (e.origWidths = {
499
+ left: a,
500
+ right: o
501
+ });
502
+ return;
503
+ }
504
+ if (t.active && t.handle) {
505
+ r.preventDefault();
506
+ let e = r.clientY - t.startY, n = parseFloat(t.handle.style.top);
507
+ t.handle.style.top = `${n + e}px`, t.startY = r.clientY;
508
+ let i = Math.round(e * C), a = t.origHeight + i;
509
+ a >= _e && (t.origHeight = a);
510
+ return;
511
+ }
512
+ if (n.active && n.handle) {
513
+ r.preventDefault();
514
+ let e = r.clientX - n.startX, t = parseFloat(n.handle.style.left);
515
+ n.handle.style.left = `${t + e}px`, n.startX = r.clientX;
516
+ let i = Math.round(e * C), a = n.origWidth + i;
517
+ a >= S && (n.origWidth = a);
518
+ }
519
+ }
520
+ function s(i) {
521
+ if (e.active) {
522
+ e.active = !1, e.handle?.classList.remove("dragging"), r && ve(r, {
523
+ pmStart: e.tablePmStart,
524
+ colIdx: e.columnIndex,
525
+ newLeft: e.origWidths.left,
526
+ newRight: e.origWidths.right
527
+ }), e.handle = null;
528
+ return;
529
+ }
530
+ if (t.active) {
531
+ t.active = !1, t.handle?.classList.remove("dragging"), r && be(r, {
532
+ pmStart: t.tablePmStart,
533
+ rowIdx: t.rowIndex,
534
+ newHeight: t.origHeight
535
+ }), t.handle = null;
536
+ return;
537
+ }
538
+ n.active && (n.active = !1, n.handle?.classList.remove("dragging"), r && ye(r, {
539
+ pmStart: n.tablePmStart,
540
+ colIdx: n.columnIndex,
541
+ newWidth: n.origWidth
542
+ }), n.handle = null);
543
+ }
544
+ function c() {
545
+ return document.addEventListener("mousemove", o), document.addEventListener("mouseup", s), () => {
546
+ document.removeEventListener("mousemove", o), document.removeEventListener("mouseup", s);
547
+ };
548
+ }
549
+ return {
550
+ tryStartResize: a,
551
+ install: c,
552
+ isResizing: i
553
+ };
554
+ }
555
+ function F(e, t) {
556
+ let n = xe(e, t.tablePmStart, t.columnIndex);
557
+ n && (t.origWidths = n);
558
+ }
559
+ function I(e, t, n) {
560
+ let r = T(e, t.tablePmStart, t.rowIndex);
561
+ if (r != null) {
562
+ t.origHeight = r;
563
+ return;
564
+ }
565
+ let i = n.closest(".layout-table")?.querySelector(`[data-row-index="${t.rowIndex}"]`), a = i ? i.getBoundingClientRect().height : 30;
566
+ t.origHeight = Math.round(a * C);
567
+ }
568
+ function L(e, t) {
569
+ let n = w(e, t.tablePmStart, t.columnIndex);
570
+ n != null && (t.origWidth = n);
571
+ }
572
+ //#endregion
573
+ //#region src/composables/useTrackedChanges.ts
574
+ function R(t, n) {
575
+ return e(() => (n.value, E(t.value?.state ?? null)));
576
+ }
577
+ //#endregion
578
+ //#region src/composables/useZoom.ts
579
+ var z = .5, B = 2, V = .1, H = [
580
+ .5,
581
+ .75,
582
+ 1,
583
+ 1.25,
584
+ 1.5,
585
+ 2
586
+ ];
587
+ function U(r = 1) {
588
+ let a = i(Math.max(z, Math.min(B, r))), o = e(() => Math.round(a.value * 100)), s = e(() => a.value <= z), c = e(() => a.value >= B);
589
+ function l(e) {
590
+ a.value = Math.max(z, Math.min(B, Math.round(e * 100) / 100));
591
+ }
592
+ function u() {
593
+ l(a.value + V);
594
+ }
595
+ function d() {
596
+ l(a.value - V);
597
+ }
598
+ function f() {
599
+ l(1);
600
+ }
601
+ function p(e) {
602
+ (e.ctrlKey || e.metaKey) && (e.preventDefault(), e.deltaY < 0 ? u() : d());
603
+ }
604
+ function m(e) {
605
+ (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())));
606
+ }
607
+ function h() {
608
+ n(() => document.addEventListener("keydown", m)), t(() => document.removeEventListener("keydown", m));
609
+ }
610
+ return {
611
+ zoom: a,
612
+ zoomPercent: o,
613
+ isMinZoom: s,
614
+ isMaxZoom: c,
615
+ setZoom: l,
616
+ zoomIn: u,
617
+ zoomOut: d,
618
+ resetZoom: f,
619
+ handleWheel: p,
620
+ handleKeyDown: m,
621
+ installShortcuts: h,
622
+ ZOOM_PRESETS: H
623
+ };
624
+ }
625
+ //#endregion
626
+ export { N as a, P as i, E as n, j as o, R as r, U as t };
@@ -0,0 +1,26 @@
1
+ import { Node as PMNode } from 'prosemirror-model';
2
+ import { FolioAIEditSnapshot } from '@stll/folio-core/ai-edits/types';
3
+ export type DocPositionRange = {
4
+ from: number;
5
+ to: number;
6
+ };
7
+ type ResolveFolioAIBlockRangeOptions = {
8
+ blockId: string;
9
+ doc: PMNode;
10
+ snapshot?: FolioAIEditSnapshot | null | undefined;
11
+ };
12
+ export declare const resolveFolioAIBlockRange: ({ blockId, doc, snapshot, }: ResolveFolioAIBlockRangeOptions) => DocPositionRange | null;
13
+ /**
14
+ * Clamp a `{from, to}` pair so both endpoints fit inside a document of
15
+ * `docSize` (in PM content positions). Block-boundary snapshots and stale
16
+ * range data sometimes produce a `to` one past the last inline position;
17
+ * `view.state.doc.resolve(...)` rejects that with
18
+ * "Position … out of range", and `TextSelection.between` doesn't help — it
19
+ * needs *valid* resolved positions. Clamping before resolution is the cheap
20
+ * defensive step.
21
+ *
22
+ * Order is preserved: if both endpoints exceed `docSize`, the returned
23
+ * `from` may equal `to`, yielding a cursor selection at the doc end.
24
+ */
25
+ export declare function clampRangeToDocSize(docSize: number, range: DocPositionRange): DocPositionRange;
26
+ export {};
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Drag auto-scroll geometry.
3
+ *
4
+ * When the user drag-selects and the pointer nears the top/bottom edge of the
5
+ * scroll container, the container should auto-scroll at a speed proportional to
6
+ * how deep into the edge zone the pointer is. The per-frame loop and the
7
+ * framework wiring stay in each adapter's hook; this is just the pure delta.
8
+ */
9
+ /** Pixel distance from the container edge where auto-scroll activates. */
10
+ export declare const AUTO_SCROLL_EDGE_ZONE = 40;
11
+ /** Maximum scroll speed in pixels per frame (~60fps). */
12
+ export declare const AUTO_SCROLL_MAX_SPEED = 12;
13
+ /**
14
+ * Vertical scroll delta (px/frame) for a pointer at `mouseY` over a container
15
+ * whose viewport spans `rect.top`..`rect.bottom`. Negative scrolls up, positive
16
+ * down, 0 when the pointer is outside both edge zones. Speed ramps linearly
17
+ * from 0 at the edge-zone boundary to `AUTO_SCROLL_MAX_SPEED` at the edge.
18
+ */
19
+ export declare function computeAutoScrollDelta(rect: {
20
+ top: number;
21
+ bottom: number;
22
+ }, mouseY: number): number;
@@ -0,0 +1,3 @@
1
+ import { CSSProperties } from './cssTypes';
2
+ export declare const CARD_STYLE_COLLAPSED: CSSProperties;
3
+ export declare const CARD_STYLE_EXPANDED: CSSProperties;