@stll/folio-vue 0.15.0 → 0.15.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/composables/usePagesPointer.d.ts +15 -0
- package/dist/composables.cjs +1 -1
- package/dist/composables.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +81 -60
- package/dist/useZoom-CH3LBMBt.cjs +1 -0
- package/dist/{useZoom-Cj-YPUlw.js → useZoom-KiURxHZu.js} +3 -3
- package/package.json +2 -2
- package/dist/useZoom-5vePhZ_w.cjs +0 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { A as e, F as t, M as n, N as r, P as i, _ as a, c as o, d as s, f as c, g as l, j as u, l as d, m as f, p, u as m, y as h } from "./SplitCellDialog-D2wgbGwH.js";
|
|
2
2
|
import { D as g, E as _, d as v, f as y, i as b, n as x, r as ee, t as te, v as ne, w as re, y as ie } from "./ListButtons-BlOX6_s_.js";
|
|
3
3
|
import { t as ae } from "./zIndex-Ei9BbHSW.js";
|
|
4
|
-
import { a as S, c as C, i as oe, l as w, o as se, r as ce, s as T, t as le, u as ue } from "./useZoom-
|
|
4
|
+
import { a as S, c as C, i as oe, l as w, o as se, r as ce, s as T, t as le, u as ue } from "./useZoom-KiURxHZu.js";
|
|
5
5
|
import { FindReplaceDialog as de, FootnotePropertiesDialog as fe, HyperlinkDialog as pe, ImagePositionDialog as me, ImagePropertiesDialog as E, InsertImageDialog as he, InsertSymbolDialog as D, InsertTableDialog as ge, PageSetupDialog as _e, PasteSpecialDialog as ve, SplitCellDialog as ye, TablePropertiesDialog as be, WatermarkDialog as xe } from "./dialogs.js";
|
|
6
6
|
import { Fragment as O, Teleport as k, computed as A, createApp as Se, createBlock as j, createCommentVNode as M, createElementBlock as N, createElementVNode as P, createSlots as Ce, createStaticVNode as we, createTextVNode as Te, createVNode as F, defineComponent as I, h as Ee, inject as De, mergeProps as Oe, nextTick as L, normalizeClass as R, normalizeStyle as z, onBeforeUnmount as B, onMounted as ke, onScopeDispose as Ae, openBlock as V, provide as je, ref as H, renderList as U, renderSlot as Me, shallowRef as Ne, toDisplayString as W, unref as G, vModelText as Pe, vShow as Fe, watch as K, withCtx as Ie, withDirectives as Le, withKeys as Re, withModifiers as q } from "vue";
|
|
7
7
|
import { createStyleResolver as ze, extractSelectionState as Be, getSelectedText as Ve, insertImageFromFile as He, insertImageFromFile as Ue, insertPageBreakInView as We, insertPageBreakInView as Ge, insertTableInView as Ke, insertTableInView as qe, insertTableOfContentsInView as Je, insertTableOfContentsInView as Ye, schema as Xe } from "@stll/folio-core/prosemirror";
|
|
@@ -3420,8 +3420,32 @@ function zo(e, t, n, r) {
|
|
|
3420
3420
|
}
|
|
3421
3421
|
//#endregion
|
|
3422
3422
|
//#region src/composables/usePagesPointer.ts
|
|
3423
|
-
var Bo = 500
|
|
3424
|
-
|
|
3423
|
+
var Bo = 500, Vo = ({ editState: e, getDocument: t, getHfPmView: n, onDocumentChange: r, reLayout: i, setDocument: a, syncHfPMs: o }) => {
|
|
3424
|
+
let s = e.value, c = t();
|
|
3425
|
+
if (!c?.package || !s?.rId) {
|
|
3426
|
+
e.value = null;
|
|
3427
|
+
return;
|
|
3428
|
+
}
|
|
3429
|
+
let l = n(s.rId);
|
|
3430
|
+
if (!l) {
|
|
3431
|
+
e.value = null;
|
|
3432
|
+
return;
|
|
3433
|
+
}
|
|
3434
|
+
let u = s.position === "header" ? c.package.headers?.get(s.rId) : c.package.footers?.get(s.rId);
|
|
3435
|
+
if (!u) {
|
|
3436
|
+
e.value = null;
|
|
3437
|
+
return;
|
|
3438
|
+
}
|
|
3439
|
+
let d = Mn({
|
|
3440
|
+
document: c,
|
|
3441
|
+
position: s.position,
|
|
3442
|
+
isFirstPage: s.isFirstPage,
|
|
3443
|
+
activeRId: s.rId,
|
|
3444
|
+
blocks: xn(l.state.doc, u.content)
|
|
3445
|
+
});
|
|
3446
|
+
e.value = null, d && (a(d), o(), i(), r(d));
|
|
3447
|
+
};
|
|
3448
|
+
function Ho(e) {
|
|
3425
3449
|
let t = H(null), n = null;
|
|
3426
3450
|
function r() {
|
|
3427
3451
|
n !== null && (clearTimeout(n), n = null);
|
|
@@ -3604,18 +3628,15 @@ function Vo(e) {
|
|
|
3604
3628
|
});
|
|
3605
3629
|
}
|
|
3606
3630
|
function ie() {
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
activeRId: n.rId,
|
|
3616
|
-
blocks: xn(r.state.doc)
|
|
3631
|
+
Vo({
|
|
3632
|
+
editState: i,
|
|
3633
|
+
getDocument: e.getDocument,
|
|
3634
|
+
getHfPmView: e.getHfPmView,
|
|
3635
|
+
onDocumentChange: e.onDocumentChange,
|
|
3636
|
+
reLayout: e.reLayout,
|
|
3637
|
+
setDocument: e.setDocument,
|
|
3638
|
+
syncHfPMs: e.syncHfPMs
|
|
3617
3639
|
});
|
|
3618
|
-
a && (i.value = null, e.setDocument(a), e.syncHfPMs(), e.reLayout(), e.onDocumentChange(a));
|
|
3619
3640
|
}
|
|
3620
3641
|
function ae() {
|
|
3621
3642
|
let t = e.getDocument(), n = i.value;
|
|
@@ -3757,7 +3778,7 @@ function Vo(e) {
|
|
|
3757
3778
|
}
|
|
3758
3779
|
//#endregion
|
|
3759
3780
|
//#region src/composables/useRemoteSelectionSync.ts
|
|
3760
|
-
var
|
|
3781
|
+
var Uo = (e) => {
|
|
3761
3782
|
let t = new Ir(), n = null, r = () => {
|
|
3762
3783
|
n !== null && (cancelAnimationFrame(n), n = null);
|
|
3763
3784
|
let r = e.pagesRef.value;
|
|
@@ -3781,7 +3802,7 @@ var Ho = (e) => {
|
|
|
3781
3802
|
], i, { flush: "post" }), Ae(() => {
|
|
3782
3803
|
a(), r();
|
|
3783
3804
|
});
|
|
3784
|
-
},
|
|
3805
|
+
}, Wo = (e) => {
|
|
3785
3806
|
let t = new Lr(), n = null, r = () => {
|
|
3786
3807
|
n !== null && (cancelAnimationFrame(n), n = null);
|
|
3787
3808
|
let r = e.pagesRef.value;
|
|
@@ -3833,22 +3854,22 @@ var Ho = (e) => {
|
|
|
3833
3854
|
clearOverlay: r,
|
|
3834
3855
|
updateSelectionOverlay: i
|
|
3835
3856
|
};
|
|
3836
|
-
},
|
|
3857
|
+
}, Go = { class: "docx-editor-vue__toolbar-shell" }, Ko = {
|
|
3837
3858
|
key: 0,
|
|
3838
3859
|
class: "docx-editor-vue__error"
|
|
3839
|
-
},
|
|
3860
|
+
}, qo = {
|
|
3840
3861
|
key: 1,
|
|
3841
3862
|
class: "docx-editor-vue__loading"
|
|
3842
|
-
},
|
|
3863
|
+
}, Jo = {
|
|
3843
3864
|
key: 2,
|
|
3844
3865
|
class: "docx-editor-vue__placeholder"
|
|
3845
|
-
},
|
|
3866
|
+
}, Yo = { class: "docx-editor-vue__editor-area" }, Xo = {
|
|
3846
3867
|
key: 0,
|
|
3847
3868
|
class: "docx-editor-vue__ruler-h"
|
|
3848
|
-
},
|
|
3869
|
+
}, Zo = {
|
|
3849
3870
|
key: 1,
|
|
3850
3871
|
class: "docx-editor-vue__ruler-v"
|
|
3851
|
-
},
|
|
3872
|
+
}, Qo = {
|
|
3852
3873
|
class: "docx-editor-vue__editor-content-wrapper",
|
|
3853
3874
|
style: {
|
|
3854
3875
|
position: "relative",
|
|
@@ -3856,11 +3877,11 @@ var Ho = (e) => {
|
|
|
3856
3877
|
flexDirection: "column",
|
|
3857
3878
|
minHeight: "100%"
|
|
3858
3879
|
}
|
|
3859
|
-
},
|
|
3880
|
+
}, $o = {
|
|
3860
3881
|
"data-testid": "selection-overlay",
|
|
3861
3882
|
class: "docx-editor-vue__decoration-origin",
|
|
3862
3883
|
"aria-hidden": "true"
|
|
3863
|
-
},
|
|
3884
|
+
}, es = ["aria-label"], ts = { class: "docx-editor-vue__note-editor-header" }, ns = ["aria-label"], rs = ["aria-label"], is = /*#__PURE__*/ t(/* @__PURE__ */ I({
|
|
3864
3885
|
__name: "DocxEditor",
|
|
3865
3886
|
props: {
|
|
3866
3887
|
documentBuffer: { default: null },
|
|
@@ -4079,7 +4100,7 @@ var Ho = (e) => {
|
|
|
4079
4100
|
zoom: L,
|
|
4080
4101
|
stateTick: E,
|
|
4081
4102
|
getCommands: Ot
|
|
4082
|
-
}), Lt =
|
|
4103
|
+
}), Lt = Wo({
|
|
4083
4104
|
editorView: J,
|
|
4084
4105
|
hiddenContainer: C,
|
|
4085
4106
|
pagesRef: T,
|
|
@@ -4088,7 +4109,7 @@ var Ho = (e) => {
|
|
|
4088
4109
|
syncCoordinator: vt,
|
|
4089
4110
|
imageInteracting: Nt
|
|
4090
4111
|
});
|
|
4091
|
-
|
|
4112
|
+
Uo({
|
|
4092
4113
|
pagesRef: T,
|
|
4093
4114
|
remoteSelections: lt,
|
|
4094
4115
|
syncCoordinator: vt,
|
|
@@ -4097,7 +4118,7 @@ var Ho = (e) => {
|
|
|
4097
4118
|
let { hyperlinkPopupData: Rt, handleHyperlinkSubmit: Vt, handleHyperlinkRemove: Ht, handleHyperlinkPopupNavigate: Ut, handleHyperlinkPopupEdit: Wt, handleHyperlinkPopupRemove: Gt } = To({
|
|
4098
4119
|
editorView: X,
|
|
4099
4120
|
getCommands: Ot
|
|
4100
|
-
}), Kt = oe(), { tableInsertButton: qt, hfEdit: Jt, scrollPageInfo: Yt, resolvePos: Xt, setPmSelection: Zt, scrollVisiblePositionIntoView: Qt, handlePagesMouseDown: $t, handlePagesMouseMove: en, handlePagesClick: tn, handlePagesDoubleClick: nn, handleTableInsertClick: rn, handleHfSave: an, handleHfRemove: on } =
|
|
4121
|
+
}), Kt = oe(), { tableInsertButton: qt, hfEdit: Jt, scrollPageInfo: Yt, resolvePos: Xt, setPmSelection: Zt, scrollVisiblePositionIntoView: Qt, handlePagesMouseDown: $t, handlePagesMouseMove: en, handlePagesClick: tn, handlePagesDoubleClick: nn, handleTableInsertClick: rn, handleHfSave: an, handleHfRemove: on } = Ho({
|
|
4101
4122
|
editorView: J,
|
|
4102
4123
|
pagesRef: T,
|
|
4103
4124
|
pagesViewportRef: de,
|
|
@@ -4423,7 +4444,7 @@ var Ho = (e) => {
|
|
|
4423
4444
|
]),
|
|
4424
4445
|
style: z(e.style)
|
|
4425
4446
|
}, [
|
|
4426
|
-
P("div",
|
|
4447
|
+
P("div", Go, [F(Ii, {
|
|
4427
4448
|
"show-table-insert": o.showTableInsert !== !1,
|
|
4428
4449
|
onRename: n[0] ||= (e) => s("rename", e),
|
|
4429
4450
|
onMenuAction: Jn,
|
|
@@ -4562,10 +4583,10 @@ var Ho = (e) => {
|
|
|
4562
4583
|
"onHyperlinkRemove",
|
|
4563
4584
|
"onPageSetupApply"
|
|
4564
4585
|
]),
|
|
4565
|
-
G(mt) ? (V(), N("div",
|
|
4586
|
+
G(mt) ? (V(), N("div", Ko, W(G(mt)), 1)) : jt.value ? (V(), N("div", qo, [Me(t.$slots, "loading-indicator", {}, () => [e.loadingIndicator ? (V(), j(te, {
|
|
4566
4587
|
key: 0,
|
|
4567
4588
|
node: e.loadingIndicator
|
|
4568
|
-
}, null, 8, ["node"])) : (V(), N(O, { key: 1 }, [Te(W(G(ee)("loadingDocument")), 1)], 64))], !0)])) : !G(ft) && !re.value ? (V(), N("div",
|
|
4589
|
+
}, null, 8, ["node"])) : (V(), N(O, { key: 1 }, [Te(W(G(ee)("loadingDocument")), 1)], 64))], !0)])) : !G(ft) && !re.value ? (V(), N("div", Jo, [Me(t.$slots, "placeholder", {}, () => [e.placeholder ? (V(), j(te, {
|
|
4569
4590
|
key: 0,
|
|
4570
4591
|
node: e.placeholder
|
|
4571
4592
|
}, null, 8, ["node"])) : (V(), N(O, { key: 1 }, [Te("No document loaded")], 64))], !0)])) : M("", !0),
|
|
@@ -4584,8 +4605,8 @@ var Ho = (e) => {
|
|
|
4584
4605
|
ref: fe,
|
|
4585
4606
|
class: "docx-editor-vue__editor-scroll",
|
|
4586
4607
|
onScroll: er
|
|
4587
|
-
}, [P("div",
|
|
4588
|
-
me.value && !d.value ? (V(), N("div",
|
|
4608
|
+
}, [P("div", Yo, [
|
|
4609
|
+
me.value && !d.value ? (V(), N("div", Xo, [F(ne, {
|
|
4589
4610
|
"section-props": Sn.value,
|
|
4590
4611
|
zoom: G(L),
|
|
4591
4612
|
unit: e.rulerUnit ?? "inch",
|
|
@@ -4619,7 +4640,7 @@ var Ho = (e) => {
|
|
|
4619
4640
|
"onFirstLineIndentChange",
|
|
4620
4641
|
"onTabStopRemove"
|
|
4621
4642
|
])])) : M("", !0),
|
|
4622
|
-
me.value && !d.value ? (V(), N("div",
|
|
4643
|
+
me.value && !d.value ? (V(), N("div", Zo, [F(v, {
|
|
4623
4644
|
"section-props": Sn.value,
|
|
4624
4645
|
zoom: G(L),
|
|
4625
4646
|
unit: e.rulerUnit ?? "inch",
|
|
@@ -4645,7 +4666,7 @@ var Ho = (e) => {
|
|
|
4645
4666
|
onDblclick: n[28] ||= (...e) => G(nn) && G(nn)(...e),
|
|
4646
4667
|
onContextmenu: n[29] ||= q((...e) => G(mn) && G(mn)(...e), ["prevent"])
|
|
4647
4668
|
}, [
|
|
4648
|
-
P("div",
|
|
4669
|
+
P("div", Qo, [
|
|
4649
4670
|
P("div", {
|
|
4650
4671
|
ref_key: "pagesRef",
|
|
4651
4672
|
ref: T,
|
|
@@ -4665,7 +4686,7 @@ var Ho = (e) => {
|
|
|
4665
4686
|
"selection",
|
|
4666
4687
|
"zoom"
|
|
4667
4688
|
]),
|
|
4668
|
-
P("div",
|
|
4689
|
+
P("div", $o, [
|
|
4669
4690
|
F(fi, {
|
|
4670
4691
|
"get-view": () => G(J),
|
|
4671
4692
|
"get-pages-container": () => T.value,
|
|
@@ -4763,15 +4784,15 @@ var Ho = (e) => {
|
|
|
4763
4784
|
class: "docx-editor-vue__note-editor",
|
|
4764
4785
|
"aria-label": At.value,
|
|
4765
4786
|
onKeydown: n[16] ||= Re(q((...e) => G(Et) && G(Et)(...e), ["stop", "prevent"]), ["esc"])
|
|
4766
|
-
}, [P("header",
|
|
4787
|
+
}, [P("header", ts, [P("span", null, W(At.value), 1), P("button", {
|
|
4767
4788
|
type: "button",
|
|
4768
4789
|
"aria-label": G(ee)("common.closeDialog"),
|
|
4769
4790
|
onClick: n[15] ||= (...e) => G(Et) && G(Et)(...e)
|
|
4770
|
-
}, " × ", 8,
|
|
4791
|
+
}, " × ", 8, ns)]), P("div", {
|
|
4771
4792
|
ref_key: "notePmRef",
|
|
4772
4793
|
ref: I,
|
|
4773
4794
|
class: "docx-editor-vue__note-editor-host"
|
|
4774
|
-
}, null, 512)], 40,
|
|
4795
|
+
}, null, 512)], 40, es), [[Fe, G(dt)]]),
|
|
4775
4796
|
F(_a, {
|
|
4776
4797
|
"image-info": G(Mt),
|
|
4777
4798
|
zoom: G(L),
|
|
@@ -4811,7 +4832,7 @@ var Ho = (e) => {
|
|
|
4811
4832
|
}),
|
|
4812
4833
|
"aria-label": G(qt).type === "row" ? "Insert row" : "Insert column",
|
|
4813
4834
|
onMousedown: n[21] ||= (...e) => G(rn) && G(rn)(...e)
|
|
4814
|
-
}, " + ", 44,
|
|
4835
|
+
}, " + ", 44, rs)) : M("", !0),
|
|
4815
4836
|
F(g, {
|
|
4816
4837
|
comments: G(bn),
|
|
4817
4838
|
"pages-container": T.value,
|
|
@@ -4949,7 +4970,7 @@ var Ho = (e) => {
|
|
|
4949
4970
|
}), [["__scopeId", "data-v-a5e2281b"]]);
|
|
4950
4971
|
//#endregion
|
|
4951
4972
|
//#region src/utils/listState.ts
|
|
4952
|
-
function
|
|
4973
|
+
function as() {
|
|
4953
4974
|
return {
|
|
4954
4975
|
type: "none",
|
|
4955
4976
|
level: 0,
|
|
@@ -4958,30 +4979,30 @@ function is() {
|
|
|
4958
4979
|
}
|
|
4959
4980
|
//#endregion
|
|
4960
4981
|
//#region src/components/FormattingBar.vue?vue&type=script&setup=true&lang.ts
|
|
4961
|
-
var
|
|
4982
|
+
var os = ["aria-label"], ss = ["aria-label"], cs = [
|
|
4962
4983
|
"disabled",
|
|
4963
4984
|
"title",
|
|
4964
4985
|
"aria-label"
|
|
4965
|
-
],
|
|
4986
|
+
], ls = [
|
|
4966
4987
|
"disabled",
|
|
4967
4988
|
"title",
|
|
4968
4989
|
"aria-label"
|
|
4969
|
-
],
|
|
4990
|
+
], us = ["aria-label"], ds = [
|
|
4970
4991
|
"disabled",
|
|
4971
4992
|
"title",
|
|
4972
4993
|
"aria-label",
|
|
4973
4994
|
"aria-pressed"
|
|
4974
|
-
],
|
|
4995
|
+
], fs = [
|
|
4975
4996
|
"disabled",
|
|
4976
4997
|
"title",
|
|
4977
4998
|
"aria-label",
|
|
4978
4999
|
"aria-pressed"
|
|
4979
|
-
],
|
|
5000
|
+
], ps = [
|
|
4980
5001
|
"disabled",
|
|
4981
5002
|
"title",
|
|
4982
5003
|
"aria-label",
|
|
4983
5004
|
"aria-pressed"
|
|
4984
|
-
],
|
|
5005
|
+
], ms = /*#__PURE__*/ t(/* @__PURE__ */ I({
|
|
4985
5006
|
__name: "FormattingBar",
|
|
4986
5007
|
props: {
|
|
4987
5008
|
currentFormatting: {},
|
|
@@ -5023,7 +5044,7 @@ var as = ["aria-label"], os = ["aria-label"], ss = [
|
|
|
5023
5044
|
"redo"
|
|
5024
5045
|
],
|
|
5025
5046
|
setup(e, { emit: t }) {
|
|
5026
|
-
let { ColorPicker: n } = h(), a = e, o = t, { t: s } = r(), c = A(() => a.currentFormatting ?? {}), l = A(() => a.documentStyles ? { styles: a.documentStyles } : {}), u = A(() => c.value.listState ??
|
|
5047
|
+
let { ColorPicker: n } = h(), a = e, o = t, { t: s } = r(), c = A(() => a.currentFormatting ?? {}), l = A(() => a.documentStyles ? { styles: a.documentStyles } : {}), u = A(() => c.value.listState ?? as()), d = A(() => {
|
|
5027
5048
|
let e = c.value.color;
|
|
5028
5049
|
return e ? e.replace(/^#/, "").toUpperCase() : void 0;
|
|
5029
5050
|
}), f = A(() => {
|
|
@@ -5056,7 +5077,7 @@ var as = ["aria-label"], os = ["aria-label"], ss = [
|
|
|
5056
5077
|
}, [F(i, {
|
|
5057
5078
|
name: "undo",
|
|
5058
5079
|
size: 18
|
|
5059
|
-
})], 40,
|
|
5080
|
+
})], 40, cs), P("button", {
|
|
5060
5081
|
type: "button",
|
|
5061
5082
|
class: "docx-formatting-bar__btn",
|
|
5062
5083
|
disabled: e.disabled || !e.canRedo,
|
|
@@ -5066,7 +5087,7 @@ var as = ["aria-label"], os = ["aria-label"], ss = [
|
|
|
5066
5087
|
}, [F(i, {
|
|
5067
5088
|
name: "redo",
|
|
5068
5089
|
size: 18
|
|
5069
|
-
})], 40,
|
|
5090
|
+
})], 40, ls)], 8, ss),
|
|
5070
5091
|
r[13] ||= P("span", {
|
|
5071
5092
|
class: "docx-formatting-bar__divider",
|
|
5072
5093
|
role: "separator"
|
|
@@ -5097,7 +5118,7 @@ var as = ["aria-label"], os = ["aria-label"], ss = [
|
|
|
5097
5118
|
}, [F(i, {
|
|
5098
5119
|
name: "format_bold",
|
|
5099
5120
|
size: 18
|
|
5100
|
-
})], 42,
|
|
5121
|
+
})], 42, ds),
|
|
5101
5122
|
P("button", {
|
|
5102
5123
|
type: "button",
|
|
5103
5124
|
class: R(["docx-formatting-bar__btn", { "docx-formatting-bar__btn--active": c.value.italic }]),
|
|
@@ -5109,7 +5130,7 @@ var as = ["aria-label"], os = ["aria-label"], ss = [
|
|
|
5109
5130
|
}, [F(i, {
|
|
5110
5131
|
name: "format_italic",
|
|
5111
5132
|
size: 18
|
|
5112
|
-
})], 42,
|
|
5133
|
+
})], 42, fs),
|
|
5113
5134
|
P("button", {
|
|
5114
5135
|
type: "button",
|
|
5115
5136
|
class: R(["docx-formatting-bar__btn", { "docx-formatting-bar__btn--active": c.value.underline }]),
|
|
@@ -5121,8 +5142,8 @@ var as = ["aria-label"], os = ["aria-label"], ss = [
|
|
|
5121
5142
|
}, [F(i, {
|
|
5122
5143
|
name: "format_underlined",
|
|
5123
5144
|
size: 18
|
|
5124
|
-
})], 42,
|
|
5125
|
-
], 8,
|
|
5145
|
+
})], 42, ps)
|
|
5146
|
+
], 8, us),
|
|
5126
5147
|
e.showTextColorPicker ? (V(), N(O, { key: 1 }, [r[12] ||= P("span", {
|
|
5127
5148
|
class: "docx-formatting-bar__divider",
|
|
5128
5149
|
role: "separator"
|
|
@@ -5164,9 +5185,9 @@ var as = ["aria-label"], os = ["aria-label"], ss = [
|
|
|
5164
5185
|
"disabled",
|
|
5165
5186
|
"can-outdent"
|
|
5166
5187
|
])) : M("", !0)
|
|
5167
|
-
], 10,
|
|
5188
|
+
], 10, os));
|
|
5168
5189
|
}
|
|
5169
|
-
}), [["__scopeId", "data-v-fc03de2e"]]),
|
|
5190
|
+
}), [["__scopeId", "data-v-fc03de2e"]]), hs = [
|
|
5170
5191
|
{
|
|
5171
5192
|
value: .5,
|
|
5172
5193
|
label: "50%"
|
|
@@ -5191,7 +5212,7 @@ var as = ["aria-label"], os = ["aria-label"], ss = [
|
|
|
5191
5212
|
value: 2,
|
|
5192
5213
|
label: "200%"
|
|
5193
5214
|
}
|
|
5194
|
-
],
|
|
5215
|
+
], gs = /*#__PURE__*/ t(/* @__PURE__ */ I({
|
|
5195
5216
|
__name: "ZoomControl",
|
|
5196
5217
|
props: {
|
|
5197
5218
|
value: { default: 1 },
|
|
@@ -5208,7 +5229,7 @@ var as = ["aria-label"], os = ["aria-label"], ss = [
|
|
|
5208
5229
|
},
|
|
5209
5230
|
emits: ["change"],
|
|
5210
5231
|
setup(e, { emit: t }) {
|
|
5211
|
-
let { Select: n } = h(), r = e, i = t, a = A(() => r.levels ??
|
|
5232
|
+
let { Select: n } = h(), r = e, i = t, a = A(() => r.levels ?? hs), o = A(() => a.value.find((e) => Math.abs(e.value - r.value) < .001)), s = A(() => o.value ? o.value.label : `${Math.round(r.value * 100)}%`), c = A(() => o.value ? String(o.value.value) : String(r.value)), l = A(() => {
|
|
5212
5233
|
let e = a.value.map((e) => ({
|
|
5213
5234
|
value: String(e.value),
|
|
5214
5235
|
label: e.label
|
|
@@ -5236,7 +5257,7 @@ var as = ["aria-label"], os = ["aria-label"], ss = [
|
|
|
5236
5257
|
"disabled"
|
|
5237
5258
|
]));
|
|
5238
5259
|
}
|
|
5239
|
-
}), [["__scopeId", "data-v-8079e07f"]]),
|
|
5260
|
+
}), [["__scopeId", "data-v-8079e07f"]]), _s = (e, t, n = {}) => {
|
|
5240
5261
|
let { colorMode: r = C, locale: i = "en", ...a } = n;
|
|
5241
5262
|
return new Promise((n, o) => {
|
|
5242
5263
|
let s = H(null), c = null, l = !1, d = {
|
|
@@ -5262,7 +5283,7 @@ var as = ["aria-label"], os = ["aria-label"], ss = [
|
|
|
5262
5283
|
}
|
|
5263
5284
|
};
|
|
5264
5285
|
c = Se({ setup() {
|
|
5265
|
-
return () => Ee(
|
|
5286
|
+
return () => Ee(is, {
|
|
5266
5287
|
...a,
|
|
5267
5288
|
documentBuffer: e,
|
|
5268
5289
|
ref: s,
|
|
@@ -5277,4 +5298,4 @@ var as = ["aria-label"], os = ["aria-label"], ss = [
|
|
|
5277
5298
|
});
|
|
5278
5299
|
};
|
|
5279
5300
|
//#endregion
|
|
5280
|
-
export { gi as AutocompleteCaretOverlay, Yr as DEFAULT_AI_SUGGESTION_PRESETS, vt as DEFAULT_AUTOCOMPLETE_DEAD_ZONE_NODES, Kr as DOCUMENT_PRESET_VERSION, qr as DOCUMENT_STYLE_SET_VERSION,
|
|
5301
|
+
export { gi as AutocompleteCaretOverlay, Yr as DEFAULT_AI_SUGGESTION_PRESETS, vt as DEFAULT_AUTOCOMPLETE_DEAD_ZONE_NODES, Kr as DOCUMENT_PRESET_VERSION, qr as DOCUMENT_STYLE_SET_VERSION, is as DocxEditor, de as FindReplaceDialog, l as FolioUIProvider, fe as FootnotePropertiesDialog, ms as FormattingBar, pe as HyperlinkDialog, me as ImagePositionDialog, E as ImagePropertiesDialog, he as InsertImageDialog, D as InsertSymbolDialog, ge as InsertTableDialog, _e as PageSetupDialog, ve as PasteSpecialDialog, Ur as STELLA_STYLE_SET_NAME, ye as SplitCellDialog, be as TablePropertiesDialog, xe as WatermarkDialog, gs as ZoomControl, yt as acceptAutocompleteSuggestion, bt as acceptAutocompleteWord, pt as anonymizationDecorationsKey, xt as appendAutocompleteToken, Pn as applyFolioAIEditOperations, Xr as applySuggestions, Y as autocompleteSuggestionKey, St as autocompleteSuggestionPlugin, $r as buildPositionalText, Ct as clearAutocompleteSuggestion, Cn as clearTemplateSlashMenu, T as colorModePlugin, wn as consumeTemplateSlashQuery, ai as createAICitationDecorationsPlugin, Jr as createDocx, Rr as createEmptyDocument, Rn as createFolioAIEditSnapshot, Wr as createStellaStyleDocumentPreset, Gr as createStellaStyleSet, C as defaultColorMode, e as defaultLocale, sr as deriveBlockId, Bn as diffWordSegments, zr as extractDocumentStyleSet, Br as extractDocumentStyleSetFromDocx, wt as finishAutocompleteSuggestion, ci as fromMarkdown, mt as getAnonymizationMatches, Tt as getAutocompleteSuggestion, J as getDocumentWatermark, ri as getFolioCaretViewportRect, cr as getFolioParaIdFromBlockId, ii as getFolioSelectionViewportRect, en as getTemplateDirectives, Tn as getTemplateSlashMenu, Wn as hashFolioAIBlockText, u as i18nPlugin, He as insertImageFromFile, We as insertPageBreakInView, Ke as insertTableInView, Je as insertTableOfContentsInView, Vr as inspectDocumentStyles, Hr as inspectDocumentStylesFromDocx, ur as isFolioBlockId, dr as isSequentialFolioBlockId, Zr as isSuggestionStale, Gn as normalizeFolioAIBlockText, w as provideColorMode, n as provideLocale, _s as renderAsync, En as resetTemplateSlashQuery, Qr as resolveSuggestionAnchor, nn as scanDirectives, ni as scrollFolioPositionIntoView, oi as setAICitationsMeta, ei as setAISuggestionsMeta, si as setActiveCitationMeta, gt as setAnonymizationTermsMeta, st as setDocumentWatermark, ti as setFocusedSuggestionMeta, Sn as setTemplatePreviewValues, Dt as shouldTriggerAutocomplete, Ot as startAutocompleteSuggestion, Dn as templateSlashMenuKey, li as toMarkdown, ui as toMarkdownResult, ue as useColorMode, r as useTranslation, le as useWheelZoom };
|
|
@@ -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/autocompleteSuggestion"),i=require("@stll/folio-core/prosemirror/plugins/templateDirectives"),a=require("@stll/folio-core/prosemirror/plugins/suggestionMode"),o=require("@stll/folio-core/controller/folioEditor"),s=require("@stll/folio-core/controller/folioEditorEvents"),c=require("@stll/folio-core/controller/collaborationModules"),l=require("@stll/folio-core/controller/headerFooterEditorManager"),u=require("@stll/folio-core/controller/noteEditorManager"),d=require("@stll/folio-core/controller/hiddenEditorManager"),f=require("@stll/folio-core/controller/layoutPipeline"),p=require("@stll/folio-core/controller/layoutScheduler"),m=require("@stll/folio-core/controller/layoutSession"),h=require("@stll/folio-core/docx/parser"),g=require("@stll/folio-core/docx/footnoteParser"),_=require("@stll/folio-core/layout-bridge/convert/headerFooterLayout"),ee=require("@stll/folio-core/layout-engine"),te=require("@stll/folio-core/layout-painter"),v=require("@stll/folio-core/paged-layout/LayoutSelectionGate"),ne=require("@stll/folio-core/paged-layout/transactionDirtyRange"),re=require("@stll/folio-core/prosemirror/conversion/fromProseDoc"),ie=require("@stll/folio-core/prosemirror/extensions/ExtensionManager"),ae=require("@stll/folio-core/prosemirror/extensions/features/ParagraphChangeTrackerExtension"),oe=require("@stll/folio-core/prosemirror/extensions/StarterKit"),se=require("@stll/folio-core/prosemirror/plugins/templatePreviewValues"),ce=require("@stll/folio-core/prosemirror/plugins/templateSlashMenu"),le=require("@stll/folio-core/utils/headerFooter"),ue=require("@stll/folio-core/utils/findVerticalScrollParent"),y=require("@stll/folio-core/prosemirror/tableResize"),b=require("@stll/folio-core/prosemirror/utils/extractTrackedChanges"),x=require("@stll/folio-core/utils/zoom");var de=`(prefers-color-scheme: dark)`;function fe(){return typeof window<`u`&&typeof window.matchMedia==`function`}function pe(e,t){return e===`dark`||e===`system`&&t}function me(e){if(!fe())return()=>{};let t=window.matchMedia(de);e(t.matches);let n=t=>e(t.matches);return t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)}var S=`light`,C=Symbol(`folioColorMode`),w=(t=S)=>{(0,e.provide)(C,(0,e.computed)(()=>(0,e.toValue)(t)))},he={install(t,n=S){t.provide(C,(0,e.computed)(()=>(0,e.toValue)(n)))}};function T(){let t=(0,e.inject)(C,(0,e.computed)(()=>S)),n=(0,e.ref)(!1),r=(0,e.ref)(!1);return(0,e.onMounted)(()=>{n.value=!0}),(0,e.watchEffect)(e=>{!n.value||t.value!==`system`||e(me(e=>{r.value=e}))}),(0,e.computed)(()=>pe(t.value,n.value&&r.value))}var ge=24,_e=32,ve=96,ye=250,be=[];function xe(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 Se(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,_.convertHeaderFooterPmDocToContent)(s.state.doc,r,i,o):(0,_.convertHeaderFooterToContent)(e,r,i,o)}function Ce(e,t,n,r,i){if(!e||e.size===0)return;let a=new Map;for(let[o,s]of e){let e=Se(s,o,t,n,r,i);e&&a.set(o,e)}return a.size>0?a:void 0}function we(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),noteId:n,text:(0,g.getFootnoteText)(r),...a?{content:{blocks:a.blocks,measures:a.measures,height:a.height}}:{}})}e.length>0&&r.set(n,e)}return r}var Te=new Set([`black`,`blue`,`cyan`,`darkBlue`,`darkCyan`,`darkGray`,`darkGreen`,`darkMagenta`,`darkRed`,`darkYellow`,`green`,`lightGray`,`magenta`,`none`,`red`,`white`,`yellow`]);function Ee(e){let t=[],n=(e,r)=>{for(let[n,i]of e.marks.entries())i.type.name===`highlight`&&!Te.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 De(){return typeof document>`u`||!(`fonts`in document)||document.fonts.status===`loaded`}function Oe(g){let{hiddenContainer:_,hiddenHeaderFooterContainer:ue,noteEditorContainer:y,pagesContainer:b,readOnly:x=!1,pageGap:de=ge,pageRenderer:fe,showMarginGuides:pe,marginGuideColor:me,password:S,editorMode:C,author:w,externalPlugins:he=[],collaboration:T,onAnonymizationMatchesChange:Te,showTemplateDirectives:Oe,onSlashMenuChange:ke,onSlashMenuKeyAction:Ae,onChange:E,onError:D,onSelectionUpdate:O,onEditorViewReady:k,onCopy:je,onCut:A,onPaste:j,onReadOnlyEditAttempt:Me,featureFlags:Ne,onSelectiveSaveTripwire:Pe}=g,Fe=ue??_,M=(0,e.shallowRef)(null),Ie=0,N=(0,e.shallowRef)(null),P=(0,e.shallowRef)(null),F=(0,e.shallowRef)(null),I=(0,e.shallowRef)([]),Le=(0,e.shallowRef)(null),L=(0,e.shallowRef)(null),R=(0,e.shallowRef)(null),Re=(0,e.shallowRef)([]),ze=(0,e.shallowRef)([]),z=(0,e.ref)(!1),B=(0,e.ref)(null),V=(0,e.ref)(!1),H=new ie.ExtensionManager((0,oe.createStarterKit)());H.buildSchema(),H.initializeRuntime();let Be=(0,a.createSuggestionModePlugin)(!1),Ve=[Be],He=(0,r.autocompleteSuggestionPlugin)({keymap:!0}),Ue=(0,n.createAnonymizationDecorationsPlugin)({onMatchesChange:e=>Te?.(e)}),U=(0,i.createTemplateDirectivesPlugin)(),We=(0,ce.templateSlashMenuPlugin)({onChange:e=>ke?.(e),onKeyAction:e=>Ae?.(e)??!1}),Ge=(0,se.createTemplatePreviewValuesPlugin)(),Ke=()=>(0,e.toValue)(Oe)===!0;function qe(){return[He,Be,...he,...(0,e.toValue)(T)?.plugins??[],Ue,...Ke()?[U,We]:[],Ge]}let W=(0,s.createFolioEditorEmitter)(),G=new v.LayoutSelectionGate,Je=(0,m.createLayoutSession)(),Ye=new te.LayoutPainter({pageGap:de,showShadow:!0}),K=(0,l.createHeaderFooterEditorManager)({getHost:()=>Fe.value,getDocument:()=>M.value,getStyles:()=>M.value?.package.styles??null,getTheme:()=>M.value?.package.theme??null,onTransaction:({rId:e,kind:t,view:n,docChanged:r,selectionChanged:i})=>{if(r){V.value=!0;let e=N.value;e&&Y.schedule(e.state,null)}if(r||i){let{from:r,to:i}=n.state.selection;Le.value={from:r,kind:t,rId:e,to:i},O?.(n.state),W.emit(`selectionChange`,{from:r,to:i})}G.requestRender()}}),Xe={current:null},q=(0,u.createNoteEditorManager)({getHost:()=>y?.value??null,getPlugins:()=>Ve,getDocument:()=>M.value,getStyles:()=>M.value?.package.styles??null,getTheme:()=>M.value?.package.theme??null,onTransaction:({docChanged:e,selectionChanged:t,view:n})=>{if(e){V.value=!0;let e=M.value;if(e){let t=Xe.current?.snapshotDocument(e)??e;M.value=t,E?.(t),W.emit(`docChange`,t)}let t=N.value;t&&Y.schedule(t.state,null)}if(e||t){O?.(n.state);let{from:e,to:t}=n.state.selection;W.emit(`selectionChange`,{from:e,to:t})}}});Xe.current=q;function Ze(e){e.layout&&(R.value=e.layout),e.blocks&&(Re.value=e.blocks),e.measures&&(ze.value=e.measures),e.blockLookup&&Ye.setBlockLookup(e.blockLookup),e.layout&&W.emit(`layoutComplete`,e.layout)}function J(n,r={}){let i=b.value,a=i instanceof HTMLDivElement?i:null,o=M.value,s=o?.package.document,c=s?.sections?.[0]?.properties??s?.finalSectionProperties??null,l=(0,t.getPageSize)(c),u=(0,t.getMargins)(c),d=xe(c),p=l.w-u.left-u.right,m=o?.package.styles??null,h=o?.package.theme??null,g=o?.package.settings?.defaultTabStop,_=o?.package.settings,te=_!==void 0&&`mirrorMargins`in _&&_.mirrorMargins===!0,v=(0,le.resolveHeaderFooterContent)(o?.package);try{Ze((0,f.runLayoutPipeline)({contentWidth:p,columns:d,pageSize:l,margins:u,pageGap:de,showMarginGuides:(0,e.toValue)(pe)===!0,marginGuideColor:(0,e.toValue)(me),...(()=>{let t=(0,e.toValue)(fe);return t===void 0?{}:{pageRenderer:t}})(),syncCoordinator:G,headerContent:v.headerContent,footerContent:v.footerContent,firstPageHeaderContent:v.firstPageHeaderContent,firstPageFooterContent:v.firstPageFooterContent,headerContentRId:v.activeHeaderRId,footerContentRId:v.activeFooterRId,firstPageHeaderContentRId:v.activeFirstHeaderRId,firstPageFooterContentRId:v.activeFirstFooterRId,sectionHeaderFooterRefs:(0,ee.resolveSectionHeaderFooterRefs)(o),theme:h,sectionProperties:c,document:o,defaultTabStop:g,mirrorMargins:te,styles:m,layout:R.value,hfPMs:K,painter:Ye,pagesContainer:a,session:Je,renderHfFromContentOrPm:Se,renderHeaderFooterContentByRId:Ce,documentFontsAreLoaded:De,buildFootnoteRenderItems:we,describeInvalidHighlightMarks:Ee,emptyTemplatePreviewEntries:be},n,r))}catch(e){let t=e instanceof Error?e:Error(String(e));D?.(t)}}let Y=(0,p.createLayoutScheduler)({runLayout:(e,t)=>J(e,t),debounceMs:_e,maxDelayMs:ve,clock:p.browserClock}),X=null;function Qe(){X!==null&&(window.clearTimeout(X),X=null);let e=N.value,t=M.value;if(!(!e||!t))try{let n=(0,re.fromProseDoc)(e.state.doc,t);M.value=n,K.sync(),q.sync(),E?.(n),W.emit(`docChange`,n)}catch(e){D?.(e instanceof Error?e:Error(String(e)))}}function $e(){X!==null&&window.clearTimeout(X),X=window.setTimeout(()=>{X=null,Qe()},ye)}let Z=(0,d.createHiddenEditorManager)({getHost:()=>_.value,getDocument:()=>M.value,getStyles:()=>M.value?.package.styles??null,getExtensionManager:()=>H,getExternalPlugins:qe,getCollaboration:()=>(0,e.toValue)(T),getCollaborationModules:()=>F.value,getPrecomputedInitialState:()=>null,getReadOnly:()=>(0,e.toValue)(x),getDocumentIdentity:()=>String(Ie),getDocumentContext:()=>M.value,onTransaction:et,onSelectionChange:e=>{P.value=e,O?.(e),W.emit(`selectionChange`,{from:e.selection.from,to:e.selection.to})},onKeyDown:()=>!1,onCopy:()=>je?.(),onCut:()=>A?.(),onPaste:()=>j?.(),onReadOnlyEditAttempt:()=>Me?.(),onEditorViewReady:tt,onEditorViewDestroy:()=>{N.value=null,z.value=!1,k?.(null)},onRemoteSelectionsChange:e=>{I.value=e}}),Q=()=>{let t=(0,e.toValue)(T)?.awareness,n=F.value,r=Z.getView();I.value=t&&n&&r?(0,d.collectRemoteSelections)(r.state,t,n):[]};(0,e.watch)(()=>(0,e.toValue)(T),(e,t,n)=>{if(I.value=[],!e){F.value=null,Z.retryViewCreation(),Z.syncExternalDocument();return}let r=!1;n(()=>{r=!0}),F.value=null,(0,c.loadCollaborationModules)().then(e=>{r||(F.value=e,Z.retryViewCreation(),Z.syncExternalDocument(),Q())},e=>{r||(F.value=null,D?.(e instanceof Error?e:Error(String(e))))})},{immediate:!0}),(0,e.watch)(()=>({awareness:(0,e.toValue)(T)?.awareness,modules:F.value,view:N.value}),({awareness:e,modules:t,view:n},r,i)=>{if(!e||!t||!n){I.value=[];return}e.on(`change`,Q),Q(),i(()=>{e.off(`change`,Q),I.value=[]})},{flush:`post`});function et({transactions:e,newState:t,docChanged:n}){P.value=t,n&&(V.value=!0,G.incrementStateSeq(),Y.schedule(t,(0,ne.getTransactionsDirtyRange)(e)),$e()),G.requestRender()}function tt(t){N.value=t,P.value=t.state,z.value=!0,J(t.state,{reason:`initial`}),G.requestRender(),$(t),k?.(t),(0,e.toValue)(x)||requestAnimationFrame(()=>{N.value===t&&t.focus()})}let nt={getDocx:async e=>(await ut(e))?.buffer??null,loadDocument:lt,loadDocx:ct},rt=(0,o.createFolioEditor)({getEditorApi:()=>Z.api,getLayout:()=>R.value,runLayout:(e,t)=>J(e,t),getDocumentIO:()=>nt,emitter:W});function $(t){(0,a.setSuggestionMode)((0,e.toValue)(C)===`suggesting`,t.state,t.dispatch,(0,e.toValue)(w))}(0,e.watch)([()=>(0,e.toValue)(C),()=>(0,e.toValue)(w)],()=>{let e=N.value;e&&$(e);for(let e of q.listStories()){let t=q.getView(e);t&&$(t)}}),(0,e.watch)(()=>(0,e.toValue)(x),e=>{Z.syncEditable(),e&&_t()});function it(e){let t=Ke();if(t===e.state.plugins.includes(U))return;let n=e.state.plugins.filter(e=>e!==U&&e!==We);if(t){let e=n.indexOf(Ge),t=e===-1?n.length:e;n.splice(t,0,U,We)}e.updateState(e.state.reconfigure({plugins:n}))}(0,e.watch)(()=>Ke(),()=>{let e=N.value;e&&it(e)});function at(){Z.ensureView()}function ot(){Ie+=1,V.value=!1,Le.value=null,L.value=null,q.activate(null),Y.dispose(),Z.destroyView(),K.sync(),q.sync(),Z.ensureView(),Z.getView()||st()}function st(){let t=M.value;if(!(!t||(0,e.toValue)(T)))try{let e=(0,d.createHiddenEditorState)({document:t,styles:t.package.styles??null,manager:H,externalPlugins:qe(),collaborationModules:null,reason:`mount`});P.value=e,J(e,{reason:`initial`})}catch(e){D?.(e instanceof Error?e:Error(String(e)))}}(0,e.watch)([_,b,Fe,...y?[y]:[]],()=>{_.value&&M.value&&!Z.getView()&&at(),K.sync(),q.sync()},{flush:`post`});async function ct(t){B.value=null,z.value=!1;try{let n=await(0,h.parseDocx)(t,{password:(0,e.toValue)(S)});M.value=n,ot()}catch(e){let t=e instanceof Error?e:Error(String(e));B.value=t.message,D?.(t)}}function lt(e){B.value=null,M.value=e,ot()}async function ut(t){let n=N.value,r=M.value;if(!n||!r)return null;let i=q.snapshotDocument(K.snapshotDocument(r)),a=n.state,{resolveSelectiveSaveFlags:s}=await import(`@stll/folio-core/docx/selectiveSaveFlags`),c=s((0,e.toValue)(Ne)),l=(0,re.fromProseDoc)(a.doc,i),u=l.originalBuffer??null,d=c.selectiveSave&&t?.mode!==o.FOLIO_DOCX_SERIALIZATION_MODE.full,f=d||c.selectiveSaveTripwire,{repackDocx:p,createDocx:m}=await import(`@stll/folio-core/docx/rezip`),h=null;if(f&&u){let{attemptSelectiveSave:e}=await import(`@stll/folio-core/docx/selectiveSave`);h=await e(l,u,{changedParaIds:(0,ae.getChangedParagraphIds)(a),structuralChange:(0,ae.hasStructuralChanges)(a),hasUntrackedChanges:(0,ae.hasUntrackedChanges)(a),maxBytes:c.selectiveSaveMaxBytes})}let g=d?h:null,_=null;if(!g)_=u?await p(l):await m(l),g=_;else if(c.selectiveSaveTripwire)try{_=await p(l)}catch{}if(c.selectiveSaveTripwire&&_&&Pe)try{let{compareSelectiveVsFull:e}=await import(`@stll/folio-core/docx/selectiveSaveTripwire`);Pe(await e(h,_))}catch{}return{buffer:g,document:l}}async function dt(e){let t=await ut({mode:e?.selective===!1?o.FOLIO_DOCX_SERIALIZATION_MODE.full:o.FOLIO_DOCX_SERIALIZATION_MODE.preferSelective});return t?(M.value=t.document,K.sync(),q.sync(),V.value=!1,new Blob([t.buffer],{type:`application/vnd.openxmlformats-officedocument.wordprocessingml.document`})):null}function ft(){let e=M.value;return e?q.snapshotDocument(K.snapshotDocument(e)):null}function pt(e){M.value=e,K.sync(),q.sync(),L.value&&!q.getView(L.value)&&(L.value=null)}function mt(e){return K.getView(e)}function ht(){K.sync()}function gt(e){let t=q.activate(e);t&&($(t),L.value=e,requestAnimationFrame(()=>t.focus()))}function _t(){q.activate(null),L.value=null}function vt(){let e=L.value;return e?q.getView(e):null}function yt(){return H.getCommands()}function bt(){let e=vt();e?e.focus():N.value?.focus()}function xt(){let e=N.value;e&&J(e.state,{reason:`manual`})}(0,e.watch)([()=>(0,e.toValue)(pe),()=>(0,e.toValue)(me),()=>(0,e.toValue)(fe)],()=>xt());function St(){Y.dispose(),X!==null&&(window.clearTimeout(X),X=null),Z.destroyView(),I.value=[],K.destroy(),q.destroy(),H.destroy(),P.value=null,R.value=null,M.value=null,z.value=!1}return(0,e.onScopeDispose)(St),{editor:rt,editorView:N,editorState:P,remoteSelections:I,headerFooterSelection:Le,activeNoteStory:L,isReady:z,isDirty:V,parseError:B,layout:R,blocks:Re,measures:ze,syncCoordinator:G,loadBuffer:ct,loadDocument:lt,save:dt,getDocument:ft,setDocument:pt,getHeaderFooterView:mt,syncHeaderFooterViews:ht,openNoteStory:gt,closeNoteStory:_t,getActiveNoteView:vt,getCommands:yt,focus:bt,reLayout:xt,destroy:St}}function ke(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 Ae({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,ue.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=ke(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 E(){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),D(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),O(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),k(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*y.TWIPS_PER_PIXEL),a=e.origWidths.left+i,o=e.origWidths.right-i;a>=y.MIN_CELL_WIDTH_TWIPS&&o>=y.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*y.TWIPS_PER_PIXEL),a=t.origHeight+i;a>=y.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*y.TWIPS_PER_PIXEL),a=n.origWidth+i;a>=y.MIN_CELL_WIDTH_TWIPS&&(n.origWidth=a)}}function s(i){if(e.active){e.active=!1,e.handle?.classList.remove(`dragging`),r&&(0,y.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,y.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,y.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 D(e,t){let n=(0,y.readColumnWidths)(e,t.tablePmStart,t.columnIndex);n&&(t.origWidths=n)}function O(e,t,n){let r=(0,y.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*y.TWIPS_PER_PIXEL)}function k(e,t){let n=(0,y.readColumnWidthAt)(e,t.tablePmStart,t.columnIndex);n!=null&&(t.origWidth=n)}function je(t,n){return(0,e.computed)(()=>(n.value,(0,b.extractTrackedChanges)(t.value?.state??null)))}var A=x.ZOOM_MIN,j=x.ZOOM_MAX,Me=[.5,.75,1,1.25,1.5,2];function Ne(t=1){let n=(0,e.ref)(Math.max(A,Math.min(j,t))),r=(0,e.computed)(()=>Math.round(n.value*100)),i=(0,e.computed)(()=>n.value<=A),a=(0,e.computed)(()=>n.value>=j);function o(e){n.value=Math.max(A,Math.min(j,Math.round(e*100)/100))}function s(){o(n.value+x.ZOOM_STEP)}function c(){o(n.value-x.ZOOM_STEP)}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:Me}}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return je}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return he}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return Ne}});
|
|
@@ -19,7 +19,7 @@ import { convertHeaderFooterPmDocToContent as b, convertHeaderFooterToContent as
|
|
|
19
19
|
import { resolveSectionHeaderFooterRefs as me } from "@stll/folio-core/layout-engine";
|
|
20
20
|
import { LayoutPainter as he } from "@stll/folio-core/layout-painter";
|
|
21
21
|
import { LayoutSelectionGate as ge } from "@stll/folio-core/paged-layout/LayoutSelectionGate";
|
|
22
|
-
import {
|
|
22
|
+
import { getTransactionsDirtyRange as _e } from "@stll/folio-core/paged-layout/transactionDirtyRange";
|
|
23
23
|
import { fromProseDoc as ve } from "@stll/folio-core/prosemirror/conversion/fromProseDoc";
|
|
24
24
|
import { ExtensionManager as ye } from "@stll/folio-core/prosemirror/extensions/ExtensionManager";
|
|
25
25
|
import { getChangedParagraphIds as be, hasStructuralChanges as xe, hasUntrackedChanges as Se } from "@stll/folio-core/prosemirror/extensions/features/ParagraphChangeTrackerExtension";
|
|
@@ -357,8 +357,8 @@ function P(e) {
|
|
|
357
357
|
e.off("change", Q), F.value = [];
|
|
358
358
|
});
|
|
359
359
|
}, { flush: "post" });
|
|
360
|
-
function ft(e, t) {
|
|
361
|
-
N.value = t,
|
|
360
|
+
function ft({ transactions: e, newState: t, docChanged: n }) {
|
|
361
|
+
N.value = t, n && (V.value = !0, G.incrementStateSeq(), Y.schedule(t, _e(e)), dt()), G.requestRender();
|
|
362
362
|
}
|
|
363
363
|
function pt(e) {
|
|
364
364
|
M.value = e, N.value = e.state, z.value = !0, J(e.state, { reason: "initial" }), G.requestRender(), $(e), Pe?.(e), c(u) || requestAnimationFrame(() => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stll/folio-vue",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.2",
|
|
4
4
|
"description": "Vue 3 editor for folio: a Word-document (.docx) editor for the browser, built on @stll/folio-core and ProseMirror.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"document-editor",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"test": "bun test src"
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
|
-
"@stll/folio-core": "^0.
|
|
77
|
+
"@stll/folio-core": "^0.37.0",
|
|
78
78
|
"better-result": "3.0.1",
|
|
79
79
|
"use-intl": "^4.13.0",
|
|
80
80
|
"yjs": "^13.6.31"
|
|
@@ -1 +0,0 @@
|
|
|
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/autocompleteSuggestion"),i=require("@stll/folio-core/prosemirror/plugins/templateDirectives"),a=require("@stll/folio-core/prosemirror/plugins/suggestionMode"),o=require("@stll/folio-core/controller/folioEditor"),s=require("@stll/folio-core/controller/folioEditorEvents"),c=require("@stll/folio-core/controller/collaborationModules"),l=require("@stll/folio-core/controller/headerFooterEditorManager"),u=require("@stll/folio-core/controller/noteEditorManager"),d=require("@stll/folio-core/controller/hiddenEditorManager"),f=require("@stll/folio-core/controller/layoutPipeline"),p=require("@stll/folio-core/controller/layoutScheduler"),m=require("@stll/folio-core/controller/layoutSession"),h=require("@stll/folio-core/docx/parser"),g=require("@stll/folio-core/docx/footnoteParser"),_=require("@stll/folio-core/layout-bridge/convert/headerFooterLayout"),ee=require("@stll/folio-core/layout-engine"),te=require("@stll/folio-core/layout-painter"),v=require("@stll/folio-core/paged-layout/LayoutSelectionGate"),ne=require("@stll/folio-core/paged-layout/transactionDirtyRange"),re=require("@stll/folio-core/prosemirror/conversion/fromProseDoc"),ie=require("@stll/folio-core/prosemirror/extensions/ExtensionManager"),ae=require("@stll/folio-core/prosemirror/extensions/features/ParagraphChangeTrackerExtension"),oe=require("@stll/folio-core/prosemirror/extensions/StarterKit"),se=require("@stll/folio-core/prosemirror/plugins/templatePreviewValues"),ce=require("@stll/folio-core/prosemirror/plugins/templateSlashMenu"),le=require("@stll/folio-core/utils/headerFooter"),ue=require("@stll/folio-core/utils/findVerticalScrollParent"),y=require("@stll/folio-core/prosemirror/tableResize"),b=require("@stll/folio-core/prosemirror/utils/extractTrackedChanges"),x=require("@stll/folio-core/utils/zoom");var de=`(prefers-color-scheme: dark)`;function fe(){return typeof window<`u`&&typeof window.matchMedia==`function`}function pe(e,t){return e===`dark`||e===`system`&&t}function me(e){if(!fe())return()=>{};let t=window.matchMedia(de);e(t.matches);let n=t=>e(t.matches);return t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)}var S=`light`,C=Symbol(`folioColorMode`),w=(t=S)=>{(0,e.provide)(C,(0,e.computed)(()=>(0,e.toValue)(t)))},he={install(t,n=S){t.provide(C,(0,e.computed)(()=>(0,e.toValue)(n)))}};function T(){let t=(0,e.inject)(C,(0,e.computed)(()=>S)),n=(0,e.ref)(!1),r=(0,e.ref)(!1);return(0,e.onMounted)(()=>{n.value=!0}),(0,e.watchEffect)(e=>{!n.value||t.value!==`system`||e(me(e=>{r.value=e}))}),(0,e.computed)(()=>pe(t.value,n.value&&r.value))}var ge=24,_e=32,ve=96,ye=250,be=[];function xe(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 Se(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,_.convertHeaderFooterPmDocToContent)(s.state.doc,r,i,o):(0,_.convertHeaderFooterToContent)(e,r,i,o)}function Ce(e,t,n,r,i){if(!e||e.size===0)return;let a=new Map;for(let[o,s]of e){let e=Se(s,o,t,n,r,i);e&&a.set(o,e)}return a.size>0?a:void 0}function we(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),noteId:n,text:(0,g.getFootnoteText)(r),...a?{content:{blocks:a.blocks,measures:a.measures,height:a.height}}:{}})}e.length>0&&r.set(n,e)}return r}var Te=new Set([`black`,`blue`,`cyan`,`darkBlue`,`darkCyan`,`darkGray`,`darkGreen`,`darkMagenta`,`darkRed`,`darkYellow`,`green`,`lightGray`,`magenta`,`none`,`red`,`white`,`yellow`]);function Ee(e){let t=[],n=(e,r)=>{for(let[n,i]of e.marks.entries())i.type.name===`highlight`&&!Te.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 De(){return typeof document>`u`||!(`fonts`in document)||document.fonts.status===`loaded`}function Oe(g){let{hiddenContainer:_,hiddenHeaderFooterContainer:ue,noteEditorContainer:y,pagesContainer:b,readOnly:x=!1,pageGap:de=ge,pageRenderer:fe,showMarginGuides:pe,marginGuideColor:me,password:S,editorMode:C,author:w,externalPlugins:he=[],collaboration:T,onAnonymizationMatchesChange:Te,showTemplateDirectives:Oe,onSlashMenuChange:ke,onSlashMenuKeyAction:Ae,onChange:E,onError:D,onSelectionUpdate:O,onEditorViewReady:k,onCopy:je,onCut:A,onPaste:j,onReadOnlyEditAttempt:Me,featureFlags:Ne,onSelectiveSaveTripwire:Pe}=g,Fe=ue??_,M=(0,e.shallowRef)(null),Ie=0,N=(0,e.shallowRef)(null),P=(0,e.shallowRef)(null),F=(0,e.shallowRef)(null),I=(0,e.shallowRef)([]),Le=(0,e.shallowRef)(null),L=(0,e.shallowRef)(null),R=(0,e.shallowRef)(null),Re=(0,e.shallowRef)([]),ze=(0,e.shallowRef)([]),z=(0,e.ref)(!1),B=(0,e.ref)(null),V=(0,e.ref)(!1),H=new ie.ExtensionManager((0,oe.createStarterKit)());H.buildSchema(),H.initializeRuntime();let Be=(0,a.createSuggestionModePlugin)(!1),Ve=[Be],He=(0,r.autocompleteSuggestionPlugin)({keymap:!0}),Ue=(0,n.createAnonymizationDecorationsPlugin)({onMatchesChange:e=>Te?.(e)}),U=(0,i.createTemplateDirectivesPlugin)(),We=(0,ce.templateSlashMenuPlugin)({onChange:e=>ke?.(e),onKeyAction:e=>Ae?.(e)??!1}),Ge=(0,se.createTemplatePreviewValuesPlugin)(),Ke=()=>(0,e.toValue)(Oe)===!0;function qe(){return[He,Be,...he,...(0,e.toValue)(T)?.plugins??[],Ue,...Ke()?[U,We]:[],Ge]}let W=(0,s.createFolioEditorEmitter)(),G=new v.LayoutSelectionGate,Je=(0,m.createLayoutSession)(),Ye=new te.LayoutPainter({pageGap:de,showShadow:!0}),K=(0,l.createHeaderFooterEditorManager)({getHost:()=>Fe.value,getDocument:()=>M.value,getStyles:()=>M.value?.package.styles??null,getTheme:()=>M.value?.package.theme??null,onTransaction:({rId:e,kind:t,view:n,docChanged:r,selectionChanged:i})=>{if(r){V.value=!0;let e=N.value;e&&Y.schedule(e.state,null)}if(r||i){let{from:r,to:i}=n.state.selection;Le.value={from:r,kind:t,rId:e,to:i},O?.(n.state),W.emit(`selectionChange`,{from:r,to:i})}G.requestRender()}}),Xe={current:null},q=(0,u.createNoteEditorManager)({getHost:()=>y?.value??null,getPlugins:()=>Ve,getDocument:()=>M.value,getStyles:()=>M.value?.package.styles??null,getTheme:()=>M.value?.package.theme??null,onTransaction:({docChanged:e,selectionChanged:t,view:n})=>{if(e){V.value=!0;let e=M.value;if(e){let t=Xe.current?.snapshotDocument(e)??e;M.value=t,E?.(t),W.emit(`docChange`,t)}let t=N.value;t&&Y.schedule(t.state,null)}if(e||t){O?.(n.state);let{from:e,to:t}=n.state.selection;W.emit(`selectionChange`,{from:e,to:t})}}});Xe.current=q;function Ze(e){e.layout&&(R.value=e.layout),e.blocks&&(Re.value=e.blocks),e.measures&&(ze.value=e.measures),e.blockLookup&&Ye.setBlockLookup(e.blockLookup),e.layout&&W.emit(`layoutComplete`,e.layout)}function J(n,r={}){let i=b.value,a=i instanceof HTMLDivElement?i:null,o=M.value,s=o?.package.document,c=s?.sections?.[0]?.properties??s?.finalSectionProperties??null,l=(0,t.getPageSize)(c),u=(0,t.getMargins)(c),d=xe(c),p=l.w-u.left-u.right,m=o?.package.styles??null,h=o?.package.theme??null,g=o?.package.settings?.defaultTabStop,_=o?.package.settings,te=_!==void 0&&`mirrorMargins`in _&&_.mirrorMargins===!0,v=(0,le.resolveHeaderFooterContent)(o?.package);try{Ze((0,f.runLayoutPipeline)({contentWidth:p,columns:d,pageSize:l,margins:u,pageGap:de,showMarginGuides:(0,e.toValue)(pe)===!0,marginGuideColor:(0,e.toValue)(me),...(()=>{let t=(0,e.toValue)(fe);return t===void 0?{}:{pageRenderer:t}})(),syncCoordinator:G,headerContent:v.headerContent,footerContent:v.footerContent,firstPageHeaderContent:v.firstPageHeaderContent,firstPageFooterContent:v.firstPageFooterContent,headerContentRId:v.activeHeaderRId,footerContentRId:v.activeFooterRId,firstPageHeaderContentRId:v.activeFirstHeaderRId,firstPageFooterContentRId:v.activeFirstFooterRId,sectionHeaderFooterRefs:(0,ee.resolveSectionHeaderFooterRefs)(o),theme:h,sectionProperties:c,document:o,defaultTabStop:g,mirrorMargins:te,styles:m,layout:R.value,hfPMs:K,painter:Ye,pagesContainer:a,session:Je,renderHfFromContentOrPm:Se,renderHeaderFooterContentByRId:Ce,documentFontsAreLoaded:De,buildFootnoteRenderItems:we,describeInvalidHighlightMarks:Ee,emptyTemplatePreviewEntries:be},n,r))}catch(e){let t=e instanceof Error?e:Error(String(e));D?.(t)}}let Y=(0,p.createLayoutScheduler)({runLayout:(e,t)=>J(e,t),debounceMs:_e,maxDelayMs:ve,clock:p.browserClock}),X=null;function Qe(){X!==null&&(window.clearTimeout(X),X=null);let e=N.value,t=M.value;if(!(!e||!t))try{let n=(0,re.fromProseDoc)(e.state.doc,t);M.value=n,K.sync(),q.sync(),E?.(n),W.emit(`docChange`,n)}catch(e){D?.(e instanceof Error?e:Error(String(e)))}}function $e(){X!==null&&window.clearTimeout(X),X=window.setTimeout(()=>{X=null,Qe()},ye)}let Z=(0,d.createHiddenEditorManager)({getHost:()=>_.value,getDocument:()=>M.value,getStyles:()=>M.value?.package.styles??null,getExtensionManager:()=>H,getExternalPlugins:qe,getCollaboration:()=>(0,e.toValue)(T),getCollaborationModules:()=>F.value,getPrecomputedInitialState:()=>null,getReadOnly:()=>(0,e.toValue)(x),getDocumentIdentity:()=>String(Ie),getDocumentContext:()=>M.value,onTransaction:et,onSelectionChange:e=>{P.value=e,O?.(e),W.emit(`selectionChange`,{from:e.selection.from,to:e.selection.to})},onKeyDown:()=>!1,onCopy:()=>je?.(),onCut:()=>A?.(),onPaste:()=>j?.(),onReadOnlyEditAttempt:()=>Me?.(),onEditorViewReady:tt,onEditorViewDestroy:()=>{N.value=null,z.value=!1,k?.(null)},onRemoteSelectionsChange:e=>{I.value=e}}),Q=()=>{let t=(0,e.toValue)(T)?.awareness,n=F.value,r=Z.getView();I.value=t&&n&&r?(0,d.collectRemoteSelections)(r.state,t,n):[]};(0,e.watch)(()=>(0,e.toValue)(T),(e,t,n)=>{if(I.value=[],!e){F.value=null,Z.retryViewCreation(),Z.syncExternalDocument();return}let r=!1;n(()=>{r=!0}),F.value=null,(0,c.loadCollaborationModules)().then(e=>{r||(F.value=e,Z.retryViewCreation(),Z.syncExternalDocument(),Q())},e=>{r||(F.value=null,D?.(e instanceof Error?e:Error(String(e))))})},{immediate:!0}),(0,e.watch)(()=>({awareness:(0,e.toValue)(T)?.awareness,modules:F.value,view:N.value}),({awareness:e,modules:t,view:n},r,i)=>{if(!e||!t||!n){I.value=[];return}e.on(`change`,Q),Q(),i(()=>{e.off(`change`,Q),I.value=[]})},{flush:`post`});function et(e,t){P.value=t,e.docChanged&&(V.value=!0,G.incrementStateSeq(),Y.schedule(t,(0,ne.getTransactionDirtyRange)(e)),$e()),G.requestRender()}function tt(t){N.value=t,P.value=t.state,z.value=!0,J(t.state,{reason:`initial`}),G.requestRender(),$(t),k?.(t),(0,e.toValue)(x)||requestAnimationFrame(()=>{N.value===t&&t.focus()})}let nt={getDocx:async e=>(await ut(e))?.buffer??null,loadDocument:lt,loadDocx:ct},rt=(0,o.createFolioEditor)({getEditorApi:()=>Z.api,getLayout:()=>R.value,runLayout:(e,t)=>J(e,t),getDocumentIO:()=>nt,emitter:W});function $(t){(0,a.setSuggestionMode)((0,e.toValue)(C)===`suggesting`,t.state,t.dispatch,(0,e.toValue)(w))}(0,e.watch)([()=>(0,e.toValue)(C),()=>(0,e.toValue)(w)],()=>{let e=N.value;e&&$(e);for(let e of q.listStories()){let t=q.getView(e);t&&$(t)}}),(0,e.watch)(()=>(0,e.toValue)(x),e=>{Z.syncEditable(),e&&_t()});function it(e){let t=Ke();if(t===e.state.plugins.includes(U))return;let n=e.state.plugins.filter(e=>e!==U&&e!==We);if(t){let e=n.indexOf(Ge),t=e===-1?n.length:e;n.splice(t,0,U,We)}e.updateState(e.state.reconfigure({plugins:n}))}(0,e.watch)(()=>Ke(),()=>{let e=N.value;e&&it(e)});function at(){Z.ensureView()}function ot(){Ie+=1,V.value=!1,Le.value=null,L.value=null,q.activate(null),Y.dispose(),Z.destroyView(),K.sync(),q.sync(),Z.ensureView(),Z.getView()||st()}function st(){let t=M.value;if(!(!t||(0,e.toValue)(T)))try{let e=(0,d.createHiddenEditorState)({document:t,styles:t.package.styles??null,manager:H,externalPlugins:qe(),collaborationModules:null,reason:`mount`});P.value=e,J(e,{reason:`initial`})}catch(e){D?.(e instanceof Error?e:Error(String(e)))}}(0,e.watch)([_,b,Fe,...y?[y]:[]],()=>{_.value&&M.value&&!Z.getView()&&at(),K.sync(),q.sync()},{flush:`post`});async function ct(t){B.value=null,z.value=!1;try{let n=await(0,h.parseDocx)(t,{password:(0,e.toValue)(S)});M.value=n,ot()}catch(e){let t=e instanceof Error?e:Error(String(e));B.value=t.message,D?.(t)}}function lt(e){B.value=null,M.value=e,ot()}async function ut(t){let n=N.value,r=M.value;if(!n||!r)return null;let i=q.snapshotDocument(K.snapshotDocument(r)),a=n.state,{resolveSelectiveSaveFlags:s}=await import(`@stll/folio-core/docx/selectiveSaveFlags`),c=s((0,e.toValue)(Ne)),l=(0,re.fromProseDoc)(a.doc,i),u=l.originalBuffer??null,d=c.selectiveSave&&t?.mode!==o.FOLIO_DOCX_SERIALIZATION_MODE.full,f=d||c.selectiveSaveTripwire,{repackDocx:p,createDocx:m}=await import(`@stll/folio-core/docx/rezip`),h=null;if(f&&u){let{attemptSelectiveSave:e}=await import(`@stll/folio-core/docx/selectiveSave`);h=await e(l,u,{changedParaIds:(0,ae.getChangedParagraphIds)(a),structuralChange:(0,ae.hasStructuralChanges)(a),hasUntrackedChanges:(0,ae.hasUntrackedChanges)(a),maxBytes:c.selectiveSaveMaxBytes})}let g=d?h:null,_=null;if(!g)_=u?await p(l):await m(l),g=_;else if(c.selectiveSaveTripwire)try{_=await p(l)}catch{}if(c.selectiveSaveTripwire&&_&&Pe)try{let{compareSelectiveVsFull:e}=await import(`@stll/folio-core/docx/selectiveSaveTripwire`);Pe(await e(h,_))}catch{}return{buffer:g,document:l}}async function dt(e){let t=await ut({mode:e?.selective===!1?o.FOLIO_DOCX_SERIALIZATION_MODE.full:o.FOLIO_DOCX_SERIALIZATION_MODE.preferSelective});return t?(M.value=t.document,K.sync(),q.sync(),V.value=!1,new Blob([t.buffer],{type:`application/vnd.openxmlformats-officedocument.wordprocessingml.document`})):null}function ft(){let e=M.value;return e?q.snapshotDocument(K.snapshotDocument(e)):null}function pt(e){M.value=e,K.sync(),q.sync(),L.value&&!q.getView(L.value)&&(L.value=null)}function mt(e){return K.getView(e)}function ht(){K.sync()}function gt(e){let t=q.activate(e);t&&($(t),L.value=e,requestAnimationFrame(()=>t.focus()))}function _t(){q.activate(null),L.value=null}function vt(){let e=L.value;return e?q.getView(e):null}function yt(){return H.getCommands()}function bt(){let e=vt();e?e.focus():N.value?.focus()}function xt(){let e=N.value;e&&J(e.state,{reason:`manual`})}(0,e.watch)([()=>(0,e.toValue)(pe),()=>(0,e.toValue)(me),()=>(0,e.toValue)(fe)],()=>xt());function St(){Y.dispose(),X!==null&&(window.clearTimeout(X),X=null),Z.destroyView(),I.value=[],K.destroy(),q.destroy(),H.destroy(),P.value=null,R.value=null,M.value=null,z.value=!1}return(0,e.onScopeDispose)(St),{editor:rt,editorView:N,editorState:P,remoteSelections:I,headerFooterSelection:Le,activeNoteStory:L,isReady:z,isDirty:V,parseError:B,layout:R,blocks:Re,measures:ze,syncCoordinator:G,loadBuffer:ct,loadDocument:lt,save:dt,getDocument:ft,setDocument:pt,getHeaderFooterView:mt,syncHeaderFooterViews:ht,openNoteStory:gt,closeNoteStory:_t,getActiveNoteView:vt,getCommands:yt,focus:bt,reLayout:xt,destroy:St}}function ke(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 Ae({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,ue.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=ke(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 E(){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),D(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),O(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),k(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*y.TWIPS_PER_PIXEL),a=e.origWidths.left+i,o=e.origWidths.right-i;a>=y.MIN_CELL_WIDTH_TWIPS&&o>=y.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*y.TWIPS_PER_PIXEL),a=t.origHeight+i;a>=y.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*y.TWIPS_PER_PIXEL),a=n.origWidth+i;a>=y.MIN_CELL_WIDTH_TWIPS&&(n.origWidth=a)}}function s(i){if(e.active){e.active=!1,e.handle?.classList.remove(`dragging`),r&&(0,y.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,y.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,y.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 D(e,t){let n=(0,y.readColumnWidths)(e,t.tablePmStart,t.columnIndex);n&&(t.origWidths=n)}function O(e,t,n){let r=(0,y.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*y.TWIPS_PER_PIXEL)}function k(e,t){let n=(0,y.readColumnWidthAt)(e,t.tablePmStart,t.columnIndex);n!=null&&(t.origWidth=n)}function je(t,n){return(0,e.computed)(()=>(n.value,(0,b.extractTrackedChanges)(t.value?.state??null)))}var A=x.ZOOM_MIN,j=x.ZOOM_MAX,Me=[.5,.75,1,1.25,1.5,2];function Ne(t=1){let n=(0,e.ref)(Math.max(A,Math.min(j,t))),r=(0,e.computed)(()=>Math.round(n.value*100)),i=(0,e.computed)(()=>n.value<=A),a=(0,e.computed)(()=>n.value>=j);function o(e){n.value=Math.max(A,Math.min(j,Math.round(e*100)/100))}function s(){o(n.value+x.ZOOM_STEP)}function c(){o(n.value-x.ZOOM_STEP)}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:Me}}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return je}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return he}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return Ne}});
|