@stll/folio-vue 0.32.1 → 0.34.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 (69) hide show
  1. package/dist/FindReplaceDialog-CfcTl2Ra.cjs +1 -0
  2. package/dist/FindReplaceDialog-DEWjhuOw.js +168 -0
  3. package/dist/HorizontalRuler-Cuk0l4Us.cjs +1 -0
  4. package/dist/HorizontalRuler-TM9dg--R.js +341 -0
  5. package/dist/HyperlinkDialog-BEse_y7R.js +175 -0
  6. package/dist/HyperlinkDialog-Cs1y6aol.cjs +1 -0
  7. package/dist/ImagePropertiesDialog-CTbX2GrE.cjs +1 -0
  8. package/dist/ImagePropertiesDialog-mrJ8S3sl.js +186 -0
  9. package/dist/ImageSelectionOverlay-DULrvfOJ.js +386 -0
  10. package/dist/ImageSelectionOverlay-Dr0lg9WZ.cjs +1 -0
  11. package/dist/InsertSymbolDialog-BjB-Q9EO.js +93 -0
  12. package/dist/InsertSymbolDialog-BsjgPYM-.cjs +1 -0
  13. package/dist/PageSetupDialog-CZ5fE9rz.cjs +1 -0
  14. package/dist/PageSetupDialog-DNNSezj3.js +208 -0
  15. package/dist/SetNumberingValueDialog-ClCYr37D.cjs +1 -0
  16. package/dist/SetNumberingValueDialog-CwLHfO7f.js +54 -0
  17. package/dist/SplitCellDialog-Bfuo5WCO.cjs +1 -0
  18. package/dist/SplitCellDialog-HIg4ZEqt.js +1031 -0
  19. package/dist/StylePicker-BnGGlXOX.cjs +4 -0
  20. package/dist/{StylePicker-DmTN56Yg.js → StylePicker-F3cLPvRE.js} +593 -1100
  21. package/dist/TablePropertiesDialog-CRX9Xgdr.js +102 -0
  22. package/dist/TablePropertiesDialog-ClJSuB0F.cjs +1 -0
  23. package/dist/VerticalRuler-D973NTMv.js +178 -0
  24. package/dist/VerticalRuler-DVi2P_TO.cjs +1 -0
  25. package/dist/WatermarkDialog-BYyBTlDK.cjs +1 -0
  26. package/dist/WatermarkDialog-BoAdQ-qK.js +161 -0
  27. package/dist/components/DocxEditor/types.d.ts +1 -1
  28. package/dist/components/dialogs/recentSymbols.d.ts +7 -0
  29. package/dist/composables/useDocxEditor.d.ts +4 -1
  30. package/dist/composables/useTrackedChanges.d.ts +5 -2
  31. package/dist/composables.cjs +1 -1
  32. package/dist/composables.js +1 -1
  33. package/dist/dialogs.cjs +1 -1
  34. package/dist/dialogs.js +9 -1
  35. package/dist/{SplitCellDialog-BczVYfpm.js → folio-ui-ctJdVP-s.js} +678 -2753
  36. package/dist/folio-ui-u7h3WXUO.cjs +15 -0
  37. package/dist/folio-vue.css +1 -1
  38. package/dist/index.cjs +1 -1
  39. package/dist/index.d.ts +1 -2
  40. package/dist/index.js +1666 -2064
  41. package/dist/messages/ar.cjs +1 -1
  42. package/dist/messages/cs.cjs +1 -1
  43. package/dist/messages/de.cjs +1 -1
  44. package/dist/messages/en.cjs +1 -1
  45. package/dist/messages/es.cjs +1 -1
  46. package/dist/messages/et.cjs +1 -1
  47. package/dist/messages/fr.cjs +1 -1
  48. package/dist/messages/he.cjs +1 -1
  49. package/dist/messages/hi.cjs +1 -1
  50. package/dist/messages/hu.cjs +1 -1
  51. package/dist/messages/lt.cjs +1 -1
  52. package/dist/messages/lv.cjs +1 -1
  53. package/dist/messages/pl.cjs +1 -1
  54. package/dist/messages/pt-BR.cjs +1 -1
  55. package/dist/messages/sk.cjs +1 -1
  56. package/dist/messages/tr.cjs +1 -1
  57. package/dist/messages/zh-CN.cjs +1 -1
  58. package/dist/rolldown-runtime-DbbDpzbe.cjs +1 -0
  59. package/dist/ui.cjs +1 -1
  60. package/dist/ui.js +28 -18
  61. package/dist/useZoom-BKM59EqE.js +1013 -0
  62. package/dist/useZoom-C0dkG1Q4.cjs +1 -0
  63. package/dist/utils/comments.d.ts +1 -1
  64. package/package.json +2 -2
  65. package/dist/SplitCellDialog-CrLHwVLc.cjs +0 -15
  66. package/dist/StylePicker-C0iEQnw6.cjs +0 -4
  67. package/dist/rolldown-runtime-5iZMYShA.cjs +0 -1
  68. package/dist/useZoom-1kmdkmJ4.js +0 -1006
  69. package/dist/useZoom-Bj5B9uT1.cjs +0 -1
@@ -0,0 +1,102 @@
1
+ import { C as e, S as t, a as n, g as r } from "./folio-ui-ctJdVP-s.js";
2
+ import { Fragment as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, defineComponent as l, openBlock as u, ref as d, renderList as f, toDisplayString as p, unref as m, vModelSelect as h, vModelText as g, watch as _, withCtx as v, withDirectives as y, withKeys as b } from "vue";
3
+ import { TABLE_PROPERTY_JUSTIFICATIONS as x, toTablePropertyJustification as S } from "@stll/folio-core/utils/tableOperations";
4
+ // src/components/dialogs/TablePropertiesDialog.vue?vue&type=script&setup=true&lang.ts
5
+ var C = { class: "tpd-dialog__header" }, w = { class: "tpd-dialog__body" }, T = { class: "tpd-row" }, E = { class: "tpd-label" }, D = { value: "auto" }, O = { value: "dxa" }, k = { value: "pct" }, A = {
6
+ key: 0,
7
+ class: "tpd-row"
8
+ }, j = { class: "tpd-label" }, M = ["step"], N = { class: "tpd-unit" }, P = { class: "tpd-row" }, F = { class: "tpd-label" }, I = ["value"], L = { class: "tpd-dialog__footer" }, R = /*@__PURE__*/ l({
9
+ __name: "TablePropertiesDialog",
10
+ props: {
11
+ isOpen: { type: Boolean },
12
+ currentProps: {}
13
+ },
14
+ emits: ["close", "apply"],
15
+ setup(e, { emit: r }) {
16
+ let { t: l } = t(), { Dialog: R } = n(), z = {
17
+ center: "dialogs.tableProperties.alignOptions.center",
18
+ end: "dialogs.tableProperties.alignOptions.end",
19
+ left: "dialogs.tableProperties.alignOptions.left",
20
+ right: "dialogs.tableProperties.alignOptions.right",
21
+ start: "dialogs.tableProperties.alignOptions.start"
22
+ }, B = e, V = r, H = d(0), U = (e) => {
23
+ switch (e) {
24
+ case "dxa":
25
+ case "pct": return e;
26
+ default: return "auto";
27
+ }
28
+ }, W = d(U(B.currentProps?.widthType ?? "auto")), G = d(S(B.currentProps?.justification));
29
+ _(() => B.isOpen, (e) => {
30
+ e && (H.value = B.currentProps?.width ?? 0, W.value = U(B.currentProps?.widthType ?? "auto"), G.value = S(B.currentProps?.justification));
31
+ }, { immediate: !0 });
32
+ function K() {
33
+ let e = W.value === "auto" ? {
34
+ justification: G.value,
35
+ width: null,
36
+ widthType: "auto"
37
+ } : {
38
+ justification: G.value,
39
+ width: H.value,
40
+ widthType: W.value
41
+ };
42
+ V("apply", e), V("close");
43
+ }
44
+ return (t, n) => (u(), a(m(R), {
45
+ open: e.isOpen,
46
+ "aria-label": m(l)("dialogs.tableProperties.title"),
47
+ style: {
48
+ minWidth: "360px",
49
+ maxWidth: "440px",
50
+ width: "100%"
51
+ },
52
+ onClose: n[4] ||= (e) => t.$emit("close"),
53
+ onKeydown: b(K, ["enter"])
54
+ }, {
55
+ default: v(() => [
56
+ c("div", C, p(m(l)("dialogs.tableProperties.title")), 1),
57
+ c("div", w, [
58
+ c("div", T, [c("label", E, p(m(l)("dialogs.tableProperties.widthType")), 1), y(c("select", {
59
+ "onUpdate:modelValue": n[0] ||= (e) => W.value = e,
60
+ class: "tpd-select"
61
+ }, [
62
+ c("option", D, p(m(l)("dialogs.tableProperties.widthTypes.auto")), 1),
63
+ c("option", O, p(m(l)("dialogs.tableProperties.widthTypes.fixed")), 1),
64
+ c("option", k, p(m(l)("dialogs.tableProperties.widthTypes.percentage")), 1)
65
+ ], 512), [[h, W.value]])]),
66
+ W.value === "auto" ? o("", !0) : (u(), s("div", A, [
67
+ c("label", j, p(m(l)("dialogs.tableProperties.widthLabel")), 1),
68
+ y(c("input", {
69
+ "onUpdate:modelValue": n[1] ||= (e) => H.value = e,
70
+ type: "number",
71
+ class: "tpd-input",
72
+ min: 0,
73
+ step: W.value === "pct" ? 5 : 100
74
+ }, null, 8, M), [[
75
+ g,
76
+ H.value,
77
+ void 0,
78
+ { number: !0 }
79
+ ]]),
80
+ c("span", N, p(W.value === "pct" ? m(l)("dialogs.tableProperties.units.fiftiethsPercent") : m(l)("dialogs.tableProperties.units.twips")), 1)
81
+ ])),
82
+ c("div", P, [c("label", F, p(m(l)("dialogs.tableProperties.alignmentLabel")), 1), y(c("select", {
83
+ "onUpdate:modelValue": n[2] ||= (e) => G.value = e,
84
+ class: "tpd-select"
85
+ }, [(u(!0), s(i, null, f(m(x), (e) => (u(), s("option", {
86
+ key: e,
87
+ value: e
88
+ }, p(m(l)(z[e])), 9, I))), 128))], 512), [[h, G.value]])])
89
+ ]),
90
+ c("div", L, [c("button", {
91
+ class: "tpd-btn",
92
+ onClick: n[3] ||= (e) => t.$emit("close")
93
+ }, p(m(l)("common.cancel")), 1), c("button", {
94
+ class: "tpd-btn tpd-btn--primary",
95
+ onClick: K
96
+ }, p(m(l)("common.apply")), 1)])
97
+ ]),
98
+ _: 1
99
+ }, 8, ["open", "aria-label"]));
100
+ }
101
+ }), z = /* @__PURE__ */ e({ default: () => B }), B = /*#__PURE__*/ r(R, [["__scopeId", "data-v-020c0455"]]);
102
+ export { z as n, B as t };
@@ -0,0 +1 @@
1
+ const e=require("./rolldown-runtime-DbbDpzbe.cjs"),t=require("./folio-ui-u7h3WXUO.cjs");let n=require("vue"),r=require("@stll/folio-core/utils/tableOperations");var i={class:`tpd-dialog__header`},a={class:`tpd-dialog__body`},o={class:`tpd-row`},s={class:`tpd-label`},c={value:`auto`},l={value:`dxa`},u={value:`pct`},d={key:0,class:`tpd-row`},f={class:`tpd-label`},p=[`step`],m={class:`tpd-unit`},h={class:`tpd-row`},g={class:`tpd-label`},_=[`value`],v={class:`tpd-dialog__footer`},y=(0,n.defineComponent)({__name:`TablePropertiesDialog`,props:{isOpen:{type:Boolean},currentProps:{}},emits:[`close`,`apply`],setup(e,{emit:y}){let{t:b}=t.S(),{Dialog:x}=t.a(),S={center:`dialogs.tableProperties.alignOptions.center`,end:`dialogs.tableProperties.alignOptions.end`,left:`dialogs.tableProperties.alignOptions.left`,right:`dialogs.tableProperties.alignOptions.right`,start:`dialogs.tableProperties.alignOptions.start`},C=e,w=y,T=(0,n.ref)(0),E=e=>{switch(e){case`dxa`:case`pct`:return e;default:return`auto`}},D=(0,n.ref)(E(C.currentProps?.widthType??`auto`)),O=(0,n.ref)((0,r.toTablePropertyJustification)(C.currentProps?.justification));(0,n.watch)(()=>C.isOpen,e=>{e&&(T.value=C.currentProps?.width??0,D.value=E(C.currentProps?.widthType??`auto`),O.value=(0,r.toTablePropertyJustification)(C.currentProps?.justification))},{immediate:!0});function k(){let e=D.value===`auto`?{justification:O.value,width:null,widthType:`auto`}:{justification:O.value,width:T.value,widthType:D.value};w(`apply`,e),w(`close`)}return(t,y)=>((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(x),{open:e.isOpen,"aria-label":(0,n.unref)(b)(`dialogs.tableProperties.title`),style:{minWidth:`360px`,maxWidth:`440px`,width:`100%`},onClose:y[4]||=e=>t.$emit(`close`),onKeydown:(0,n.withKeys)(k,[`enter`])},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)(`div`,i,(0,n.toDisplayString)((0,n.unref)(b)(`dialogs.tableProperties.title`)),1),(0,n.createElementVNode)(`div`,a,[(0,n.createElementVNode)(`div`,o,[(0,n.createElementVNode)(`label`,s,(0,n.toDisplayString)((0,n.unref)(b)(`dialogs.tableProperties.widthType`)),1),(0,n.withDirectives)((0,n.createElementVNode)(`select`,{"onUpdate:modelValue":y[0]||=e=>D.value=e,class:`tpd-select`},[(0,n.createElementVNode)(`option`,c,(0,n.toDisplayString)((0,n.unref)(b)(`dialogs.tableProperties.widthTypes.auto`)),1),(0,n.createElementVNode)(`option`,l,(0,n.toDisplayString)((0,n.unref)(b)(`dialogs.tableProperties.widthTypes.fixed`)),1),(0,n.createElementVNode)(`option`,u,(0,n.toDisplayString)((0,n.unref)(b)(`dialogs.tableProperties.widthTypes.percentage`)),1)],512),[[n.vModelSelect,D.value]])]),D.value===`auto`?(0,n.createCommentVNode)(``,!0):((0,n.openBlock)(),(0,n.createElementBlock)(`div`,d,[(0,n.createElementVNode)(`label`,f,(0,n.toDisplayString)((0,n.unref)(b)(`dialogs.tableProperties.widthLabel`)),1),(0,n.withDirectives)((0,n.createElementVNode)(`input`,{"onUpdate:modelValue":y[1]||=e=>T.value=e,type:`number`,class:`tpd-input`,min:0,step:D.value===`pct`?5:100},null,8,p),[[n.vModelText,T.value,void 0,{number:!0}]]),(0,n.createElementVNode)(`span`,m,(0,n.toDisplayString)(D.value===`pct`?(0,n.unref)(b)(`dialogs.tableProperties.units.fiftiethsPercent`):(0,n.unref)(b)(`dialogs.tableProperties.units.twips`)),1)])),(0,n.createElementVNode)(`div`,h,[(0,n.createElementVNode)(`label`,g,(0,n.toDisplayString)((0,n.unref)(b)(`dialogs.tableProperties.alignmentLabel`)),1),(0,n.withDirectives)((0,n.createElementVNode)(`select`,{"onUpdate:modelValue":y[2]||=e=>O.value=e,class:`tpd-select`},[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)((0,n.unref)(r.TABLE_PROPERTY_JUSTIFICATIONS),e=>((0,n.openBlock)(),(0,n.createElementBlock)(`option`,{key:e,value:e},(0,n.toDisplayString)((0,n.unref)(b)(S[e])),9,_))),128))],512),[[n.vModelSelect,O.value]])])]),(0,n.createElementVNode)(`div`,v,[(0,n.createElementVNode)(`button`,{class:`tpd-btn`,onClick:y[3]||=e=>t.$emit(`close`)},(0,n.toDisplayString)((0,n.unref)(b)(`common.cancel`)),1),(0,n.createElementVNode)(`button`,{class:`tpd-btn tpd-btn--primary`,onClick:k},(0,n.toDisplayString)((0,n.unref)(b)(`common.apply`)),1)])]),_:1},8,[`open`,`aria-label`]))}}),b=e.n({default:()=>x}),x=t.g(y,[[`__scopeId`,`data-v-020c0455`]]);Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return x}});
@@ -0,0 +1,178 @@
1
+ import { C as e, S as t, g as n } from "./folio-ui-ctJdVP-s.js";
2
+ import { Fragment as r, computed as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, defineComponent as c, mergeProps as l, normalizeStyle as u, onBeforeUnmount as d, openBlock as f, ref as p, renderList as m, toDisplayString as h, unref as g, withModifiers as _ } from "vue";
3
+ import { clampRulerValue as v, createRulerControl as y, getVerticalRulerBounds as b } from "@stll/folio-core/utils/rulerControl";
4
+ import { pixelsToTwips as x, twipsToPixels as S } from "@stll/folio-core/utils/units";
5
+ // src/components/ui/VerticalRuler.vue?vue&type=script&setup=true&lang.ts
6
+ var C = ["aria-label"], w = { class: "docx-vertical-ruler__ticks" }, T = ["aria-label", "aria-orientation"], E = ["aria-label", "aria-orientation"], D = 15840, O = 1440, k = 1440, A = 567, j = /*@__PURE__*/ c({
7
+ __name: "VerticalRuler",
8
+ props: {
9
+ sectionProps: {},
10
+ zoom: { default: 1 },
11
+ editable: {
12
+ type: Boolean,
13
+ default: !0
14
+ },
15
+ unit: { default: "inch" }
16
+ },
17
+ emits: ["top-margin-change", "bottom-margin-change"],
18
+ setup(e, { emit: n }) {
19
+ let c = e, { t: j } = t(), M = n, N = p(null), P = p(null);
20
+ function F(e) {
21
+ return S(e) * c.zoom;
22
+ }
23
+ function I(e) {
24
+ return Math.round(x(e / c.zoom));
25
+ }
26
+ let L = i(() => c.sectionProps?.pageHeight ?? D), R = i(() => c.sectionProps?.marginTop ?? O), z = i(() => c.sectionProps?.marginBottom ?? O), B = i(() => F(L.value)), V = i(() => F(R.value)), H = i(() => F(z.value)), U = i(() => ({
27
+ position: "relative",
28
+ width: "20px",
29
+ height: B.value + "px",
30
+ backgroundColor: "transparent",
31
+ overflow: "visible",
32
+ userSelect: "none",
33
+ cursor: N.value ? "ns-resize" : "default"
34
+ })), W = i(() => b({
35
+ pageHeight: L.value,
36
+ topMargin: R.value,
37
+ bottomMargin: z.value
38
+ })), G = i(() => ({
39
+ topMargin: y({
40
+ value: R.value,
41
+ ...W.value.topMargin,
42
+ unit: c.unit,
43
+ onChange: c.editable ? (e) => M("top-margin-change", e) : void 0
44
+ }),
45
+ bottomMargin: y({
46
+ value: z.value,
47
+ ...W.value.bottomMargin,
48
+ unit: c.unit,
49
+ onChange: c.editable ? (e) => M("bottom-margin-change", e) : void 0
50
+ })
51
+ })), K = i(() => {
52
+ let e = [];
53
+ if (c.unit === "inch") {
54
+ let t = k / 8, n = Math.ceil(L.value / t);
55
+ for (let r = 0; r <= n; r++) {
56
+ let n = r * t;
57
+ if (n > L.value) break;
58
+ let i = F(n);
59
+ r % 8 == 0 ? e.push({
60
+ position: i,
61
+ width: 10,
62
+ label: r / 8 > 0 ? String(r / 8) : void 0
63
+ }) : r % 4 == 0 ? e.push({
64
+ position: i,
65
+ width: 6
66
+ }) : r % 2 == 0 ? e.push({
67
+ position: i,
68
+ width: 4
69
+ }) : e.push({
70
+ position: i,
71
+ width: 2
72
+ });
73
+ }
74
+ } else {
75
+ let t = A / 10, n = Math.ceil(L.value / t);
76
+ for (let r = 0; r <= n; r++) {
77
+ let n = r * t;
78
+ if (n > L.value) break;
79
+ let i = F(n);
80
+ r % 10 == 0 ? e.push({
81
+ position: i,
82
+ width: 10,
83
+ label: r / 10 > 0 ? String(r / 10) : void 0
84
+ }) : r % 5 == 0 ? e.push({
85
+ position: i,
86
+ width: 6
87
+ }) : e.push({
88
+ position: i,
89
+ width: 3
90
+ });
91
+ }
92
+ }
93
+ return e;
94
+ });
95
+ function q(e) {
96
+ return {
97
+ position: "absolute",
98
+ top: e - 5 + "px",
99
+ right: 0,
100
+ width: "20px",
101
+ height: "10px",
102
+ cursor: c.editable ? "ns-resize" : "default",
103
+ zIndex: N.value === null ? 1 : 10
104
+ };
105
+ }
106
+ function J(e) {
107
+ let t = N.value === e, n = P.value === e, r = "var(--doc-primary)";
108
+ return t ? r = "var(--doc-primary-hover)" : n && (r = "var(--doc-primary)"), {
109
+ position: "absolute",
110
+ top: "0px",
111
+ right: "2px",
112
+ width: "0",
113
+ height: "0",
114
+ borderTop: "5px solid transparent",
115
+ borderBottom: "5px solid transparent",
116
+ borderRight: `8px solid ${r}`,
117
+ transition: "border-right-color 0.1s"
118
+ };
119
+ }
120
+ let Y = 0, X = 0;
121
+ function Z(e, t) {
122
+ c.editable && (N.value = e, Y = t.clientY, X = e === "topMargin" ? R.value : z.value, document.addEventListener("mousemove", Q), document.addEventListener("mouseup", $));
123
+ }
124
+ function Q(e) {
125
+ if (!N.value) return;
126
+ let t = e.clientY - Y, n = I(N.value === "topMargin" ? t : -t), r = v(X + n, W.value[N.value]);
127
+ N.value === "topMargin" ? M("top-margin-change", r) : M("bottom-margin-change", r);
128
+ }
129
+ function $() {
130
+ N.value = null, document.removeEventListener("mousemove", Q), document.removeEventListener("mouseup", $);
131
+ }
132
+ return d(() => {
133
+ document.removeEventListener("mousemove", Q), document.removeEventListener("mouseup", $);
134
+ }), (t, n) => (f(), o("div", {
135
+ class: "docx-vertical-ruler",
136
+ style: u(U.value),
137
+ role: "group",
138
+ "aria-label": g(j)("ruler.vertical")
139
+ }, [
140
+ s("div", w, [(f(!0), o(r, null, m(K.value, (e, t) => (f(), o(r, { key: t }, [s("div", {
141
+ class: "docx-vertical-ruler__tick-line",
142
+ style: u({
143
+ top: e.position + "px",
144
+ width: e.width + "px"
145
+ })
146
+ }, null, 4), e.label ? (f(), o("div", {
147
+ key: 0,
148
+ class: "docx-vertical-ruler__tick-label",
149
+ style: u({ top: e.position + "px" })
150
+ }, h(e.label), 5)) : a("", !0)], 64))), 128))]),
151
+ e.editable ? (f(), o("div", l({
152
+ key: 0,
153
+ class: "docx-vertical-ruler__marker",
154
+ style: q(V.value),
155
+ onMousedown: n[0] ||= _((e) => Z("topMargin", e), ["prevent"]),
156
+ onMouseenter: n[1] ||= (e) => P.value = "topMargin"
157
+ }, G.value.topMargin.attributes, {
158
+ "aria-label": G.value.topMargin.attributes.role ? g(j)("ruler.topMargin") : void 0,
159
+ "aria-orientation": G.value.topMargin.attributes.role ? "vertical" : void 0,
160
+ onKeydown: n[2] ||= (...e) => G.value.topMargin.onKeyDown && G.value.topMargin.onKeyDown(...e),
161
+ onMouseleave: n[3] ||= (e) => P.value = null
162
+ }), [s("div", { style: u(J("topMargin")) }, null, 4)], 16, T)) : a("", !0),
163
+ e.editable ? (f(), o("div", l({
164
+ key: 1,
165
+ class: "docx-vertical-ruler__marker",
166
+ style: q(B.value - H.value),
167
+ onMousedown: n[4] ||= _((e) => Z("bottomMargin", e), ["prevent"]),
168
+ onMouseenter: n[5] ||= (e) => P.value = "bottomMargin"
169
+ }, G.value.bottomMargin.attributes, {
170
+ "aria-label": G.value.bottomMargin.attributes.role ? g(j)("ruler.bottomMargin") : void 0,
171
+ "aria-orientation": G.value.bottomMargin.attributes.role ? "vertical" : void 0,
172
+ onKeydown: n[6] ||= (...e) => G.value.bottomMargin.onKeyDown && G.value.bottomMargin.onKeyDown(...e),
173
+ onMouseleave: n[7] ||= (e) => P.value = null
174
+ }), [s("div", { style: u(J("bottomMargin")) }, null, 4)], 16, E)) : a("", !0)
175
+ ], 12, C));
176
+ }
177
+ }), M = /* @__PURE__ */ e({ default: () => N }), N = /*#__PURE__*/ n(j, [["__scopeId", "data-v-95933a7a"]]);
178
+ export { M as n, N as t };
@@ -0,0 +1 @@
1
+ const e=require("./rolldown-runtime-DbbDpzbe.cjs"),t=require("./folio-ui-u7h3WXUO.cjs");let n=require("vue"),r=require("@stll/folio-core/utils/rulerControl"),i=require("@stll/folio-core/utils/units");var a=[`aria-label`],o={class:`docx-vertical-ruler__ticks`},s=[`aria-label`,`aria-orientation`],c=[`aria-label`,`aria-orientation`],l=15840,u=1440,d=1440,f=567,p=(0,n.defineComponent)({__name:`VerticalRuler`,props:{sectionProps:{},zoom:{default:1},editable:{type:Boolean,default:!0},unit:{default:`inch`}},emits:[`top-margin-change`,`bottom-margin-change`],setup(e,{emit:p}){let m=e,{t:h}=t.S(),g=p,_=(0,n.ref)(null),v=(0,n.ref)(null);function y(e){return(0,i.twipsToPixels)(e)*m.zoom}function b(e){return Math.round((0,i.pixelsToTwips)(e/m.zoom))}let x=(0,n.computed)(()=>m.sectionProps?.pageHeight??l),S=(0,n.computed)(()=>m.sectionProps?.marginTop??u),C=(0,n.computed)(()=>m.sectionProps?.marginBottom??u),w=(0,n.computed)(()=>y(x.value)),T=(0,n.computed)(()=>y(S.value)),E=(0,n.computed)(()=>y(C.value)),D=(0,n.computed)(()=>({position:`relative`,width:`20px`,height:w.value+`px`,backgroundColor:`transparent`,overflow:`visible`,userSelect:`none`,cursor:_.value?`ns-resize`:`default`})),O=(0,n.computed)(()=>(0,r.getVerticalRulerBounds)({pageHeight:x.value,topMargin:S.value,bottomMargin:C.value})),k=(0,n.computed)(()=>({topMargin:(0,r.createRulerControl)({value:S.value,...O.value.topMargin,unit:m.unit,onChange:m.editable?e=>g(`top-margin-change`,e):void 0}),bottomMargin:(0,r.createRulerControl)({value:C.value,...O.value.bottomMargin,unit:m.unit,onChange:m.editable?e=>g(`bottom-margin-change`,e):void 0})})),A=(0,n.computed)(()=>{let e=[];if(m.unit===`inch`){let t=d/8,n=Math.ceil(x.value/t);for(let r=0;r<=n;r++){let n=r*t;if(n>x.value)break;let i=y(n);r%8==0?e.push({position:i,width:10,label:r/8>0?String(r/8):void 0}):r%4==0?e.push({position:i,width:6}):r%2==0?e.push({position:i,width:4}):e.push({position:i,width:2})}}else{let t=f/10,n=Math.ceil(x.value/t);for(let r=0;r<=n;r++){let n=r*t;if(n>x.value)break;let i=y(n);r%10==0?e.push({position:i,width:10,label:r/10>0?String(r/10):void 0}):r%5==0?e.push({position:i,width:6}):e.push({position:i,width:3})}}return e});function j(e){return{position:`absolute`,top:e-5+`px`,right:0,width:`20px`,height:`10px`,cursor:m.editable?`ns-resize`:`default`,zIndex:_.value===null?1:10}}function M(e){let t=_.value===e,n=v.value===e,r=`var(--doc-primary)`;return t?r=`var(--doc-primary-hover)`:n&&(r=`var(--doc-primary)`),{position:`absolute`,top:`0px`,right:`2px`,width:`0`,height:`0`,borderTop:`5px solid transparent`,borderBottom:`5px solid transparent`,borderRight:`8px solid ${r}`,transition:`border-right-color 0.1s`}}let N=0,P=0;function F(e,t){m.editable&&(_.value=e,N=t.clientY,P=e===`topMargin`?S.value:C.value,document.addEventListener(`mousemove`,I),document.addEventListener(`mouseup`,L))}function I(e){if(!_.value)return;let t=e.clientY-N,n=b(_.value===`topMargin`?t:-t),i=(0,r.clampRulerValue)(P+n,O.value[_.value]);_.value===`topMargin`?g(`top-margin-change`,i):g(`bottom-margin-change`,i)}function L(){_.value=null,document.removeEventListener(`mousemove`,I),document.removeEventListener(`mouseup`,L)}return(0,n.onBeforeUnmount)(()=>{document.removeEventListener(`mousemove`,I),document.removeEventListener(`mouseup`,L)}),(t,r)=>((0,n.openBlock)(),(0,n.createElementBlock)(`div`,{class:`docx-vertical-ruler`,style:(0,n.normalizeStyle)(D.value),role:`group`,"aria-label":(0,n.unref)(h)(`ruler.vertical`)},[(0,n.createElementVNode)(`div`,o,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(A.value,(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:t},[(0,n.createElementVNode)(`div`,{class:`docx-vertical-ruler__tick-line`,style:(0,n.normalizeStyle)({top:e.position+`px`,width:e.width+`px`})},null,4),e.label?((0,n.openBlock)(),(0,n.createElementBlock)(`div`,{key:0,class:`docx-vertical-ruler__tick-label`,style:(0,n.normalizeStyle)({top:e.position+`px`})},(0,n.toDisplayString)(e.label),5)):(0,n.createCommentVNode)(``,!0)],64))),128))]),e.editable?((0,n.openBlock)(),(0,n.createElementBlock)(`div`,(0,n.mergeProps)({key:0,class:`docx-vertical-ruler__marker`,style:j(T.value),onMousedown:r[0]||=(0,n.withModifiers)(e=>F(`topMargin`,e),[`prevent`]),onMouseenter:r[1]||=e=>v.value=`topMargin`},k.value.topMargin.attributes,{"aria-label":k.value.topMargin.attributes.role?(0,n.unref)(h)(`ruler.topMargin`):void 0,"aria-orientation":k.value.topMargin.attributes.role?`vertical`:void 0,onKeydown:r[2]||=(...e)=>k.value.topMargin.onKeyDown&&k.value.topMargin.onKeyDown(...e),onMouseleave:r[3]||=e=>v.value=null}),[(0,n.createElementVNode)(`div`,{style:(0,n.normalizeStyle)(M(`topMargin`))},null,4)],16,s)):(0,n.createCommentVNode)(``,!0),e.editable?((0,n.openBlock)(),(0,n.createElementBlock)(`div`,(0,n.mergeProps)({key:1,class:`docx-vertical-ruler__marker`,style:j(w.value-E.value),onMousedown:r[4]||=(0,n.withModifiers)(e=>F(`bottomMargin`,e),[`prevent`]),onMouseenter:r[5]||=e=>v.value=`bottomMargin`},k.value.bottomMargin.attributes,{"aria-label":k.value.bottomMargin.attributes.role?(0,n.unref)(h)(`ruler.bottomMargin`):void 0,"aria-orientation":k.value.bottomMargin.attributes.role?`vertical`:void 0,onKeydown:r[6]||=(...e)=>k.value.bottomMargin.onKeyDown&&k.value.bottomMargin.onKeyDown(...e),onMouseleave:r[7]||=e=>v.value=null}),[(0,n.createElementVNode)(`div`,{style:(0,n.normalizeStyle)(M(`bottomMargin`))},null,4)],16,c)):(0,n.createCommentVNode)(``,!0)],12,a))}}),m=e.n({default:()=>h}),h=t.g(p,[[`__scopeId`,`data-v-95933a7a`]]);Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return h}});
@@ -0,0 +1 @@
1
+ const e=require("./rolldown-runtime-DbbDpzbe.cjs"),t=require("./folio-ui-u7h3WXUO.cjs");let n=require("vue"),r=require("@stll/folio-core/watermark");var i={class:`dialog__body`},a={class:`field`},o={key:0,class:`grid`},s={class:`field field--wide`},c={class:`field`},l={class:`field`},u={class:`field`},d={class:`check`},f={key:1,class:`grid`},p={class:`field field--wide`},m={class:`field field--wide`},h=[`aria-invalid`],g={key:0,class:`field__error`},_={class:`field`},v={class:`check`},y={class:`check field--wide`},b={class:`dialog__footer`},x=[`disabled`],S=`#C0C0C0`,C=(0,n.defineComponent)({__name:`WatermarkDialog`,props:{isOpen:{type:Boolean},currentWatermark:{}},emits:[`close`,`apply`],setup(e,{emit:C}){let{Dialog:w}=t.a(),T=e,E=C,D=(0,n.ref)(`text`),O=(0,n.ref)(`CONFIDENTIAL`),k=(0,n.ref)(`Calibri`),A=(0,n.ref)(S),j=(0,n.ref)(!0),M=(0,n.ref)(50),N=(0,n.ref)(``),P=(0,n.ref)(``),F=(0,n.ref)(!1),I=(0,n.ref)(100),L=(0,n.ref)(!0),R=(0,n.computed)(()=>D.value===`picture`&&F.value&&P.value.trim().length>0?W(P.value.trim()):``),z=(0,n.computed)(()=>D.value===`none`||D.value===`text`&&O.value.trim().length>0||D.value===`picture`&&N.value.trim().length>0&&R.value.length===0);(0,n.watch)([()=>T.isOpen,()=>T.currentWatermark],([e,t])=>{e&&(t?(D.value=t.kind,t.kind===`text`?(O.value=t.text,k.value=t.font??`Calibri`,A.value=G(t.color),j.value=t.diagonal??!0,M.value=Math.round((t.opacity??.5)*100)):(N.value=t.imageRId,P.value=t.imageTarget??``,F.value=t.imageTargetExternal??!1,I.value=Math.round((t.scale??1)*100),L.value=t.washout??!0)):(D.value=`text`,O.value=`CONFIDENTIAL`,k.value=`Calibri`,A.value=S,j.value=!0,M.value=50,N.value=``,P.value=``,F.value=!1,I.value=100,L.value=!0))},{immediate:!0});function B(){z.value&&(D.value===`none`?(E(`apply`,void 0),E(`close`)):D.value===`text`?(E(`apply`,{kind:`text`,text:O.value.trim(),...k.value.trim()?{font:k.value.trim()}:{},color:U(A.value),diagonal:j.value,opacity:V(M.value)/100}),E(`close`)):(E(`apply`,{kind:`picture`,imageRId:N.value.trim(),...P.value.trim()?{imageTarget:P.value.trim()}:{},...P.value.trim()?{imageTargetExternal:F.value}:{},scale:H(I.value)/100,washout:L.value}),E(`close`)))}function V(e){return Math.min(100,Math.max(0,e))}function H(e){return Math.min(300,Math.max(1,e))}function U(e){return e.startsWith(`#`)?e.slice(1):e}function W(e){return(0,r.isAllowedExternalWatermarkImageUrl)(e)?``:`Use a web address (http/https).`}function G(e){return!e||e===`auto`?S:e.startsWith(`#`)?e:`#${e}`}return(t,r)=>((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(w),{open:e.isOpen,"aria-label":`Watermark`,style:{minWidth:`360px`,maxWidth:`520px`,width:`100%`},onClose:r[12]||=e=>t.$emit(`close`)},{default:(0,n.withCtx)(()=>[r[25]||=(0,n.createElementVNode)(`div`,{class:`dialog__header`},`Watermark`,-1),(0,n.createElementVNode)(`div`,i,[(0,n.createElementVNode)(`label`,a,[r[14]||=(0,n.createElementVNode)(`span`,{class:`field__label`},`Type`,-1),(0,n.withDirectives)((0,n.createElementVNode)(`select`,{"onUpdate:modelValue":r[0]||=e=>D.value=e,class:`field__input`},[...r[13]||=[(0,n.createElementVNode)(`option`,{value:`text`},`Text watermark`,-1),(0,n.createElementVNode)(`option`,{value:`picture`},`Picture watermark`,-1),(0,n.createElementVNode)(`option`,{value:`none`},`No watermark`,-1)]],512),[[n.vModelSelect,D.value]])]),D.value===`text`?((0,n.openBlock)(),(0,n.createElementBlock)(`div`,o,[(0,n.createElementVNode)(`label`,s,[r[15]||=(0,n.createElementVNode)(`span`,{class:`field__label`},`Text`,-1),(0,n.withDirectives)((0,n.createElementVNode)(`input`,{"onUpdate:modelValue":r[1]||=e=>O.value=e,class:`field__input`},null,512),[[n.vModelText,O.value]])]),(0,n.createElementVNode)(`label`,c,[r[16]||=(0,n.createElementVNode)(`span`,{class:`field__label`},`Font`,-1),(0,n.withDirectives)((0,n.createElementVNode)(`input`,{"onUpdate:modelValue":r[2]||=e=>k.value=e,class:`field__input`},null,512),[[n.vModelText,k.value]])]),(0,n.createElementVNode)(`label`,l,[r[17]||=(0,n.createElementVNode)(`span`,{class:`field__label`},`Color`,-1),(0,n.withDirectives)((0,n.createElementVNode)(`input`,{"onUpdate:modelValue":r[3]||=e=>A.value=e,class:`field__input field__input--color`,type:`color`},null,512),[[n.vModelText,A.value]])]),(0,n.createElementVNode)(`label`,u,[r[18]||=(0,n.createElementVNode)(`span`,{class:`field__label`},`Opacity`,-1),(0,n.withDirectives)((0,n.createElementVNode)(`input`,{"onUpdate:modelValue":r[4]||=e=>M.value=e,class:`field__input`,max:`100`,min:`0`,type:`number`},null,512),[[n.vModelText,M.value,void 0,{number:!0}]])]),(0,n.createElementVNode)(`label`,d,[(0,n.withDirectives)((0,n.createElementVNode)(`input`,{"onUpdate:modelValue":r[5]||=e=>j.value=e,type:`checkbox`},null,512),[[n.vModelCheckbox,j.value]]),r[19]||=(0,n.createElementVNode)(`span`,null,`Diagonal`,-1)])])):(0,n.createCommentVNode)(``,!0),D.value===`picture`?((0,n.openBlock)(),(0,n.createElementBlock)(`div`,f,[(0,n.createElementVNode)(`label`,p,[r[20]||=(0,n.createElementVNode)(`span`,{class:`field__label`},`Header image relationship id`,-1),(0,n.withDirectives)((0,n.createElementVNode)(`input`,{"onUpdate:modelValue":r[6]||=e=>N.value=e,class:`field__input`,placeholder:`rId12`},null,512),[[n.vModelText,N.value]])]),(0,n.createElementVNode)(`label`,m,[r[21]||=(0,n.createElementVNode)(`span`,{class:`field__label`},`Image target`,-1),(0,n.withDirectives)((0,n.createElementVNode)(`input`,{"onUpdate:modelValue":r[7]||=e=>P.value=e,"aria-invalid":R.value.length>0,class:`field__input`,placeholder:`word/media/image1.png`},null,8,h),[[n.vModelText,P.value]]),R.value.length>0?((0,n.openBlock)(),(0,n.createElementBlock)(`span`,g,(0,n.toDisplayString)(R.value),1)):(0,n.createCommentVNode)(``,!0)]),(0,n.createElementVNode)(`label`,_,[r[22]||=(0,n.createElementVNode)(`span`,{class:`field__label`},`Scale`,-1),(0,n.withDirectives)((0,n.createElementVNode)(`input`,{"onUpdate:modelValue":r[8]||=e=>I.value=e,class:`field__input`,max:`300`,min:`1`,type:`number`},null,512),[[n.vModelText,I.value,void 0,{number:!0}]])]),(0,n.createElementVNode)(`label`,v,[(0,n.withDirectives)((0,n.createElementVNode)(`input`,{"onUpdate:modelValue":r[9]||=e=>L.value=e,type:`checkbox`},null,512),[[n.vModelCheckbox,L.value]]),r[23]||=(0,n.createElementVNode)(`span`,null,`Washout`,-1)]),(0,n.createElementVNode)(`label`,y,[(0,n.withDirectives)((0,n.createElementVNode)(`input`,{"onUpdate:modelValue":r[10]||=e=>F.value=e,type:`checkbox`},null,512),[[n.vModelCheckbox,F.value]]),r[24]||=(0,n.createElementVNode)(`span`,null,`Target is an external URL`,-1)])])):(0,n.createCommentVNode)(``,!0)]),(0,n.createElementVNode)(`div`,b,[(0,n.createElementVNode)(`button`,{class:`dialog__btn`,onClick:r[11]||=e=>t.$emit(`close`)},`Cancel`),(0,n.createElementVNode)(`button`,{class:`dialog__btn dialog__btn--primary`,disabled:!z.value,onClick:B},` Apply `,8,x)])]),_:1},8,[`open`]))}}),w=e.n({default:()=>T}),T=t.g(C,[[`__scopeId`,`data-v-a51a359f`]]);Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return T}});
@@ -0,0 +1,161 @@
1
+ import { C as e, a as t, g as n } from "./folio-ui-ctJdVP-s.js";
2
+ import { computed as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, defineComponent as c, openBlock as l, ref as u, toDisplayString as d, unref as f, vModelCheckbox as p, vModelSelect as m, vModelText as h, watch as g, withCtx as _, withDirectives as v } from "vue";
3
+ import { isAllowedExternalWatermarkImageUrl as y } from "@stll/folio-core/watermark";
4
+ // src/components/dialogs/WatermarkDialog.vue?vue&type=script&setup=true&lang.ts
5
+ var b = { class: "dialog__body" }, x = { class: "field" }, S = {
6
+ key: 0,
7
+ class: "grid"
8
+ }, C = { class: "field field--wide" }, w = { class: "field" }, T = { class: "field" }, E = { class: "field" }, D = { class: "check" }, O = {
9
+ key: 1,
10
+ class: "grid"
11
+ }, k = { class: "field field--wide" }, A = { class: "field field--wide" }, j = ["aria-invalid"], M = {
12
+ key: 0,
13
+ class: "field__error"
14
+ }, N = { class: "field" }, P = { class: "check" }, F = { class: "check field--wide" }, I = { class: "dialog__footer" }, L = ["disabled"], R = "#C0C0C0", z = /*@__PURE__*/ c({
15
+ __name: "WatermarkDialog",
16
+ props: {
17
+ isOpen: { type: Boolean },
18
+ currentWatermark: {}
19
+ },
20
+ emits: ["close", "apply"],
21
+ setup(e, { emit: n }) {
22
+ let { Dialog: c } = t(), z = e, B = n, V = u("text"), H = u("CONFIDENTIAL"), U = u("Calibri"), W = u(R), G = u(!0), K = u(50), q = u(""), J = u(""), Y = u(!1), X = u(100), Z = u(!0), Q = r(() => V.value === "picture" && Y.value && J.value.trim().length > 0 ? ie(J.value.trim()) : ""), $ = r(() => V.value === "none" || V.value === "text" && H.value.trim().length > 0 || V.value === "picture" && q.value.trim().length > 0 && Q.value.length === 0);
23
+ g([() => z.isOpen, () => z.currentWatermark], ([e, t]) => {
24
+ e && (t ? (V.value = t.kind, t.kind === "text" ? (H.value = t.text, U.value = t.font ?? "Calibri", W.value = ae(t.color), G.value = t.diagonal ?? !0, K.value = Math.round((t.opacity ?? .5) * 100)) : (q.value = t.imageRId, J.value = t.imageTarget ?? "", Y.value = t.imageTargetExternal ?? !1, X.value = Math.round((t.scale ?? 1) * 100), Z.value = t.washout ?? !0)) : (V.value = "text", H.value = "CONFIDENTIAL", U.value = "Calibri", W.value = R, G.value = !0, K.value = 50, q.value = "", J.value = "", Y.value = !1, X.value = 100, Z.value = !0));
25
+ }, { immediate: !0 });
26
+ function ee() {
27
+ $.value && (V.value === "none" ? (B("apply", void 0), B("close")) : V.value === "text" ? (B("apply", {
28
+ kind: "text",
29
+ text: H.value.trim(),
30
+ ...U.value.trim() ? { font: U.value.trim() } : {},
31
+ color: re(W.value),
32
+ diagonal: G.value,
33
+ opacity: te(K.value) / 100
34
+ }), B("close")) : (B("apply", {
35
+ kind: "picture",
36
+ imageRId: q.value.trim(),
37
+ ...J.value.trim() ? { imageTarget: J.value.trim() } : {},
38
+ ...J.value.trim() ? { imageTargetExternal: Y.value } : {},
39
+ scale: ne(X.value) / 100,
40
+ washout: Z.value
41
+ }), B("close")));
42
+ }
43
+ function te(e) {
44
+ return Math.min(100, Math.max(0, e));
45
+ }
46
+ function ne(e) {
47
+ return Math.min(300, Math.max(1, e));
48
+ }
49
+ function re(e) {
50
+ return e.startsWith("#") ? e.slice(1) : e;
51
+ }
52
+ function ie(e) {
53
+ return y(e) ? "" : "Use a web address (http/https).";
54
+ }
55
+ function ae(e) {
56
+ return !e || e === "auto" ? R : e.startsWith("#") ? e : `#${e}`;
57
+ }
58
+ return (t, n) => (l(), i(f(c), {
59
+ open: e.isOpen,
60
+ "aria-label": "Watermark",
61
+ style: {
62
+ minWidth: "360px",
63
+ maxWidth: "520px",
64
+ width: "100%"
65
+ },
66
+ onClose: n[12] ||= (e) => t.$emit("close")
67
+ }, {
68
+ default: _(() => [
69
+ n[25] ||= s("div", { class: "dialog__header" }, "Watermark", -1),
70
+ s("div", b, [
71
+ s("label", x, [n[14] ||= s("span", { class: "field__label" }, "Type", -1), v(s("select", {
72
+ "onUpdate:modelValue": n[0] ||= (e) => V.value = e,
73
+ class: "field__input"
74
+ }, [...n[13] ||= [
75
+ s("option", { value: "text" }, "Text watermark", -1),
76
+ s("option", { value: "picture" }, "Picture watermark", -1),
77
+ s("option", { value: "none" }, "No watermark", -1)
78
+ ]], 512), [[m, V.value]])]),
79
+ V.value === "text" ? (l(), o("div", S, [
80
+ s("label", C, [n[15] ||= s("span", { class: "field__label" }, "Text", -1), v(s("input", {
81
+ "onUpdate:modelValue": n[1] ||= (e) => H.value = e,
82
+ class: "field__input"
83
+ }, null, 512), [[h, H.value]])]),
84
+ s("label", w, [n[16] ||= s("span", { class: "field__label" }, "Font", -1), v(s("input", {
85
+ "onUpdate:modelValue": n[2] ||= (e) => U.value = e,
86
+ class: "field__input"
87
+ }, null, 512), [[h, U.value]])]),
88
+ s("label", T, [n[17] ||= s("span", { class: "field__label" }, "Color", -1), v(s("input", {
89
+ "onUpdate:modelValue": n[3] ||= (e) => W.value = e,
90
+ class: "field__input field__input--color",
91
+ type: "color"
92
+ }, null, 512), [[h, W.value]])]),
93
+ s("label", E, [n[18] ||= s("span", { class: "field__label" }, "Opacity", -1), v(s("input", {
94
+ "onUpdate:modelValue": n[4] ||= (e) => K.value = e,
95
+ class: "field__input",
96
+ max: "100",
97
+ min: "0",
98
+ type: "number"
99
+ }, null, 512), [[
100
+ h,
101
+ K.value,
102
+ void 0,
103
+ { number: !0 }
104
+ ]])]),
105
+ s("label", D, [v(s("input", {
106
+ "onUpdate:modelValue": n[5] ||= (e) => G.value = e,
107
+ type: "checkbox"
108
+ }, null, 512), [[p, G.value]]), n[19] ||= s("span", null, "Diagonal", -1)])
109
+ ])) : a("", !0),
110
+ V.value === "picture" ? (l(), o("div", O, [
111
+ s("label", k, [n[20] ||= s("span", { class: "field__label" }, "Header image relationship id", -1), v(s("input", {
112
+ "onUpdate:modelValue": n[6] ||= (e) => q.value = e,
113
+ class: "field__input",
114
+ placeholder: "rId12"
115
+ }, null, 512), [[h, q.value]])]),
116
+ s("label", A, [
117
+ n[21] ||= s("span", { class: "field__label" }, "Image target", -1),
118
+ v(s("input", {
119
+ "onUpdate:modelValue": n[7] ||= (e) => J.value = e,
120
+ "aria-invalid": Q.value.length > 0,
121
+ class: "field__input",
122
+ placeholder: "word/media/image1.png"
123
+ }, null, 8, j), [[h, J.value]]),
124
+ Q.value.length > 0 ? (l(), o("span", M, d(Q.value), 1)) : a("", !0)
125
+ ]),
126
+ s("label", N, [n[22] ||= s("span", { class: "field__label" }, "Scale", -1), v(s("input", {
127
+ "onUpdate:modelValue": n[8] ||= (e) => X.value = e,
128
+ class: "field__input",
129
+ max: "300",
130
+ min: "1",
131
+ type: "number"
132
+ }, null, 512), [[
133
+ h,
134
+ X.value,
135
+ void 0,
136
+ { number: !0 }
137
+ ]])]),
138
+ s("label", P, [v(s("input", {
139
+ "onUpdate:modelValue": n[9] ||= (e) => Z.value = e,
140
+ type: "checkbox"
141
+ }, null, 512), [[p, Z.value]]), n[23] ||= s("span", null, "Washout", -1)]),
142
+ s("label", F, [v(s("input", {
143
+ "onUpdate:modelValue": n[10] ||= (e) => Y.value = e,
144
+ type: "checkbox"
145
+ }, null, 512), [[p, Y.value]]), n[24] ||= s("span", null, "Target is an external URL", -1)])
146
+ ])) : a("", !0)
147
+ ]),
148
+ s("div", I, [s("button", {
149
+ class: "dialog__btn",
150
+ onClick: n[11] ||= (e) => t.$emit("close")
151
+ }, "Cancel"), s("button", {
152
+ class: "dialog__btn dialog__btn--primary",
153
+ disabled: !$.value,
154
+ onClick: ee
155
+ }, " Apply ", 8, L)])
156
+ ]),
157
+ _: 1
158
+ }, 8, ["open"]));
159
+ }
160
+ }), B = /* @__PURE__ */ e({ default: () => V }), V = /*#__PURE__*/ n(z, [["__scopeId", "data-v-a51a359f"]]);
161
+ export { B as n, V as t };
@@ -18,8 +18,8 @@ import { ReviewDisplayMode } from '@stll/folio-core/managers/reviewDisplayMode';
18
18
  import { BlockRect } from '@stll/folio-core/paged-layout/blockGeometry';
19
19
  import { ScrollToParaIdOptions } from '@stll/folio-core/paged-layout/paragraphFlash';
20
20
  import { ListState, SelectionState, TableContextInfo } from '@stll/folio-core/prosemirror';
21
- import { FolioSuggestion, SuggestionAppliedAs } from '@stll/folio-core/prosemirror/commands/comments';
22
21
  import { TemplateSlashMenuKeyAction, TemplateSlashMenuState } from '@stll/folio-core/prosemirror/plugins/templateSlashMenu';
22
+ import { FolioSuggestion, SuggestionAppliedAs } from '@stll/folio-core/prosemirror/suggestionQueries';
23
23
  import { Comment } from '@stll/folio-core/types/content';
24
24
  import { Document, ParagraphAlignment, SdtProperties, TabStop, Theme } from '@stll/folio-core/types/document';
25
25
  import { FolioDerivedFields, FolioFieldInsertion } from '@stll/folio-core/types/fields';
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Symbols inserted through the Insert Symbol dialog, newest first. The editor
3
+ * mounts the dialog only while it is open, so the list lives here and persists
4
+ * across openings.
5
+ */
6
+ export declare const recentSymbols: import('vue').Ref<readonly string[], readonly string[]>;
7
+ export declare const rememberRecentSymbol: (symbol: string) => void;
@@ -196,7 +196,10 @@ export type UseDocxEditorReturn = {
196
196
  * it, never write it or hand it on.
197
197
  */
198
198
  readDocument: () => ReadonlyDocument | null;
199
- /** Publish a fresh Document object (e.g. after HF materialisation). */
199
+ /**
200
+ * Replace the document with `doc`, as `loadDocument` does: the editor opens
201
+ * it in a new session, so its undo history starts over.
202
+ */
200
203
  setDocument: (doc: Document) => void;
201
204
  /** Resolve a persistent header/footer EditorView by relationship id. */
202
205
  getHeaderFooterView: (rId: string) => EditorView | null;
@@ -1,5 +1,6 @@
1
1
  import { EditorView } from 'prosemirror-view';
2
2
  import { Ref } from 'vue';
3
+ import { CanonicalReviewEditor } from '@stll/folio-core/controller/canonicalReview';
3
4
  import { extractTrackedChanges, TrackedChangesResult } from '@stll/folio-core/prosemirror/utils/extractTrackedChanges';
4
5
  import { TrackedChangeEntry } from '../utils/comments';
5
6
  export type { TrackedChangesResult };
@@ -8,8 +9,10 @@ export type { TrackedChangeEntry } from '../utils/comments';
8
9
  /**
9
10
  * Pass the editor view ref + a stateTick that bumps on every PM
10
11
  * transaction (the same tick the Toolbar listens to). The computed
11
- * re-runs whenever the tick advances.
12
+ * re-runs whenever the tick advances. Lock verdicts require the canonical
13
+ * editor as the third argument. Two-argument calls return the change list
14
+ * without lock verdicts.
12
15
  */
13
- export declare function useTrackedChanges(view: Ref<EditorView | null>, stateTick: Ref<number>): import('vue').ComputedRef<TrackedChangesResult & {
16
+ export declare function useTrackedChanges(view: Ref<EditorView | null>, stateTick: Ref<number>, editor?: CanonicalReviewEditor): import('vue').ComputedRef<TrackedChangesResult & {
14
17
  entries: TrackedChangeEntry[];
15
18
  }>;
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./useZoom-Bj5B9uT1.cjs");let t=require("vue"),n=require("@stll/folio-core/utils/textEncoding"),r=require("prosemirror-history"),i=require("@stll/folio-core/utils/documentPointerDown"),a=require("@stll/folio-core/managers/ClipboardManager"),o=require("@stll/folio-core/utils/clipboard"),s=require("@stll/folio-core/managers/TableSelectionManager"),c=require("@stll/folio-core/prosemirror/utils/visualLineNavigation"),l=require("@stll/folio-core/prosemirror/utils/extractTrackedChanges");function u(e={}){let{onCopy:r,onCut:i,onPaste:a,cleanWordFormatting:s=!0,editable:c=!0,onError:l}=e,u=(0,t.ref)(!1),d=(0,t.ref)(null),f=l?{onError:l}:{};async function p(e){if(u.value)return!1;u.value=!0;try{let t=await(0,o.copyRuns)(e.runs,f);return t&&r?.(e),t}finally{u.value=!1}}async function m(e){if(u.value||!c)return!1;u.value=!0;try{let t=await(0,o.copyRuns)(e.runs,f);return t&&i?.(e),t}finally{u.value=!1}}async function h(e=!1){if(u.value||!c)return null;u.value=!0;try{if(navigator.clipboard&&navigator.clipboard.read){let t=await navigator.clipboard.read(),r=``,i=``;for(let e of t)e.types.includes(`text/html`)&&(r=await(0,n.readBlobText)(await e.getType(`text/html`))),e.types.includes(`text/plain`)&&(i=await(0,n.readBlobText)(await e.getType(`text/plain`)));e&&(r=``);let c=(0,o.parseClipboardHtml)(r,i,s);return d.value=c,a?.(c,e),c}return null}catch(e){return l?.(e instanceof Error?e:Error(String(e))),null}finally{u.value=!1}}return{copy:p,cut:m,paste:h,isProcessing:u,lastPastedContent:d}}function d({isOpen:e,onClose:n,align:r=`left`}){let a=(0,t.ref)(null),o=(0,t.ref)(null),s=(0,t.ref)({position:`fixed`,top:`0px`,left:`0px`,zIndex:1e4});function c(e,t){s.value={position:`fixed`,top:e+`px`,left:t+`px`,zIndex:1e4}}function l(e){let t=e.target;t instanceof Node&&a.value&&!a.value.contains(t)&&o.value&&!o.value.contains(t)&&n()}function u(e){e.key===`Escape`&&n()}function d(e){let t=e.target;t instanceof Node&&o.value&&o.value.contains(t)||n()}let f;function p(){f=(0,i.onDocumentPointerDown)(document,l),document.addEventListener(`keydown`,u),window.addEventListener(`scroll`,d,!0)}function m(){f?.(),f=void 0,document.removeEventListener(`keydown`,u),window.removeEventListener(`scroll`,d,!0)}(0,t.watch)(e,e=>{if(!e){m();return}let t=a.value;if(!t)return;let n=t.getBoundingClientRect();r===`right`?requestAnimationFrame(()=>{let e=o.value;if(e){let t=e.getBoundingClientRect();c(n.bottom+4,n.right-t.width)}else c(n.bottom+4,n.left)}):c(n.bottom+4,n.left),p()}),(0,t.onScopeDispose)(m);function h(e){e.preventDefault(),e.stopPropagation()}return{containerRef:a,dropdownRef:o,dropdownStyle:s,handleMouseDown:h}}function f(e,n){let i=(0,t.computed)(()=>{n.value;let t=e.value;return t?(0,r.undoDepth)(t.state)>0:!1}),a=(0,t.computed)(()=>{n.value;let t=e.value;return t?(0,r.redoDepth)(t.state)>0:!1});function o(){let t=e.value;return t?(0,r.undo)(t.state,t.dispatch):!1}function s(){let t=e.value;return t?(0,r.redo)(t.state,t.dispatch):!1}return{canUndo:i,canRedo:a,undo:o,redo:s}}var p={backgroundColor:`rgba(26, 115, 232, 0.3)`,borderRadius:0,zIndex:0,opacity:1,mixBlendMode:`multiply`};function m(e){let t=window.getSelection();if(!t||t.rangeCount===0||t.isCollapsed)return[];let n=t.getRangeAt(0);if(e&&!e.contains(n.commonAncestorContainer))return[];let r=0,i=0;if(e){let t=e.getBoundingClientRect();r=t.left+e.scrollLeft,i=t.top+e.scrollTop}let a=[];for(let e of n.getClientRects())(e.width!==0||e.height!==0)&&a.push({left:e.left-r,top:e.top-i,width:e.width,height:e.height});return a}function h(e,t=2){if(e.length<=1)return e;let n=[...e].sort((e,n)=>Math.abs(e.top-n.top)<t?e.left-n.left:e.top-n.top),r=n[0];if(!r)return e;let i=[],a={...r};for(let e=1;e<n.length;e++){let r=n[e];if(!r)continue;let o=Math.abs(r.top-a.top)<t,s=r.left<=a.left+a.width+t;if(o&&s){let e=Math.max(a.left+a.width,r.left+r.width);a.width=e-a.left,a.height=Math.max(a.height,r.height)}else i.push(a),a={...r}}return i.push(a),i}function g(e){return h(m(e))}function _(){let e=window.getSelection();return e!==null&&!e.isCollapsed&&e.rangeCount>0}function v(e){let t=window.getSelection();return!t||t.rangeCount===0?!1:e.contains(t.getRangeAt(0).commonAncestorContainer)}var y=`docx-selection-styles`,b=null;function x(){b&&=(b.remove(),null),document.getElementById(y)?.remove()}function S(e=p){x();let t=`
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./useZoom-C0dkG1Q4.cjs");let t=require("vue"),n=require("@stll/folio-core/utils/textEncoding"),r=require("prosemirror-history"),i=require("@stll/folio-core/utils/documentPointerDown"),a=require("@stll/folio-core/managers/ClipboardManager"),o=require("@stll/folio-core/utils/clipboard"),s=require("@stll/folio-core/managers/TableSelectionManager"),c=require("@stll/folio-core/prosemirror/utils/visualLineNavigation"),l=require("@stll/folio-core/prosemirror/utils/extractTrackedChanges");function u(e={}){let{onCopy:r,onCut:i,onPaste:a,cleanWordFormatting:s=!0,editable:c=!0,onError:l}=e,u=(0,t.ref)(!1),d=(0,t.ref)(null),f=l?{onError:l}:{};async function p(e){if(u.value)return!1;u.value=!0;try{let t=await(0,o.copyRuns)(e.runs,f);return t&&r?.(e),t}finally{u.value=!1}}async function m(e){if(u.value||!c)return!1;u.value=!0;try{let t=await(0,o.copyRuns)(e.runs,f);return t&&i?.(e),t}finally{u.value=!1}}async function h(e=!1){if(u.value||!c)return null;u.value=!0;try{if(navigator.clipboard&&navigator.clipboard.read){let t=await navigator.clipboard.read(),r=``,i=``;for(let e of t)e.types.includes(`text/html`)&&(r=await(0,n.readBlobText)(await e.getType(`text/html`))),e.types.includes(`text/plain`)&&(i=await(0,n.readBlobText)(await e.getType(`text/plain`)));e&&(r=``);let c=(0,o.parseClipboardHtml)(r,i,s);return d.value=c,a?.(c,e),c}return null}catch(e){return l?.(e instanceof Error?e:Error(String(e))),null}finally{u.value=!1}}return{copy:p,cut:m,paste:h,isProcessing:u,lastPastedContent:d}}function d({isOpen:e,onClose:n,align:r=`left`}){let a=(0,t.ref)(null),o=(0,t.ref)(null),s=(0,t.ref)({position:`fixed`,top:`0px`,left:`0px`,zIndex:1e4});function c(e,t){s.value={position:`fixed`,top:e+`px`,left:t+`px`,zIndex:1e4}}function l(e){let t=e.target;t instanceof Node&&a.value&&!a.value.contains(t)&&o.value&&!o.value.contains(t)&&n()}function u(e){e.key===`Escape`&&n()}function d(e){let t=e.target;t instanceof Node&&o.value&&o.value.contains(t)||n()}let f;function p(){f=(0,i.onDocumentPointerDown)(document,l),document.addEventListener(`keydown`,u),window.addEventListener(`scroll`,d,!0)}function m(){f?.(),f=void 0,document.removeEventListener(`keydown`,u),window.removeEventListener(`scroll`,d,!0)}(0,t.watch)(e,e=>{if(!e){m();return}let t=a.value;if(!t)return;let n=t.getBoundingClientRect();r===`right`?requestAnimationFrame(()=>{let e=o.value;if(e){let t=e.getBoundingClientRect();c(n.bottom+4,n.right-t.width)}else c(n.bottom+4,n.left)}):c(n.bottom+4,n.left),p()}),(0,t.onScopeDispose)(m);function h(e){e.preventDefault(),e.stopPropagation()}return{containerRef:a,dropdownRef:o,dropdownStyle:s,handleMouseDown:h}}function f(e,n){let i=(0,t.computed)(()=>{n.value;let t=e.value;return t?(0,r.undoDepth)(t.state)>0:!1}),a=(0,t.computed)(()=>{n.value;let t=e.value;return t?(0,r.redoDepth)(t.state)>0:!1});function o(){let t=e.value;return t?(0,r.undo)(t.state,t.dispatch):!1}function s(){let t=e.value;return t?(0,r.redo)(t.state,t.dispatch):!1}return{canUndo:i,canRedo:a,undo:o,redo:s}}var p={backgroundColor:`rgba(26, 115, 232, 0.3)`,borderRadius:0,zIndex:0,opacity:1,mixBlendMode:`multiply`};function m(e){let t=window.getSelection();if(!t||t.rangeCount===0||t.isCollapsed)return[];let n=t.getRangeAt(0);if(e&&!e.contains(n.commonAncestorContainer))return[];let r=0,i=0;if(e){let t=e.getBoundingClientRect();r=t.left+e.scrollLeft,i=t.top+e.scrollTop}let a=[];for(let e of n.getClientRects())(e.width!==0||e.height!==0)&&a.push({left:e.left-r,top:e.top-i,width:e.width,height:e.height});return a}function h(e,t=2){if(e.length<=1)return e;let n=[...e].sort((e,n)=>Math.abs(e.top-n.top)<t?e.left-n.left:e.top-n.top),r=n[0];if(!r)return e;let i=[],a={...r};for(let e=1;e<n.length;e++){let r=n[e];if(!r)continue;let o=Math.abs(r.top-a.top)<t,s=r.left<=a.left+a.width+t;if(o&&s){let e=Math.max(a.left+a.width,r.left+r.width);a.width=e-a.left,a.height=Math.max(a.height,r.height)}else i.push(a),a={...r}}return i.push(a),i}function g(e){return h(m(e))}function _(){let e=window.getSelection();return e!==null&&!e.isCollapsed&&e.rangeCount>0}function v(e){let t=window.getSelection();return!t||t.rangeCount===0?!1:e.contains(t.getRangeAt(0).commonAncestorContainer)}var y=`docx-selection-styles`,b=null;function x(){b&&=(b.remove(),null),document.getElementById(y)?.remove()}function S(e=p){x();let t=`
2
2
  /* DOCX Editor Selection Highlighting */
3
3
 
4
4
  .docx-editor [contenteditable="true"]::selection,
@@ -1,4 +1,4 @@
1
- import { a as e, c as t, d as n, i as r, l as i, n as a, o, r as s, s as c, t as l, u } from "./useZoom-1kmdkmJ4.js";
1
+ import { a as e, c as t, d as n, i as r, l as i, n as a, o, r as s, s as c, t as l, u } from "./useZoom-BKM59EqE.js";
2
2
  import { computed as d, onBeforeUnmount as f, onMounted as p, onScopeDispose as m, ref as h, watch as g } from "vue";
3
3
  import { readBlobText as _ } from "@stll/folio-core/utils/textEncoding";
4
4
  import { redo as v, redoDepth as y, undo as b, undoDepth as x } from "prosemirror-history";
package/dist/dialogs.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./SplitCellDialog-CrLHwVLc.cjs");exports.FindReplaceDialog=e.m,exports.FootnotePropertiesDialog=e.s,exports.HyperlinkDialog=e.p,exports.ImagePositionDialog=e.o,exports.ImagePropertiesDialog=e.f,exports.InsertImageDialog=e.a,exports.InsertSymbolDialog=e.d,exports.InsertTableDialog=e.r,exports.PageSetupDialog=e.u,exports.PasteSpecialDialog=e.n,exports.SplitCellDialog=e.t,exports.TablePropertiesDialog=e.l,exports.WatermarkDialog=e.c;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./FindReplaceDialog-CfcTl2Ra.cjs"),t=require("./SplitCellDialog-Bfuo5WCO.cjs"),n=require("./HyperlinkDialog-Cs1y6aol.cjs"),r=require("./ImagePropertiesDialog-CTbX2GrE.cjs"),i=require("./InsertSymbolDialog-BsjgPYM-.cjs"),a=require("./PageSetupDialog-CZ5fE9rz.cjs"),o=require("./TablePropertiesDialog-ClJSuB0F.cjs"),s=require("./WatermarkDialog-BYyBTlDK.cjs");exports.FindReplaceDialog=e.t,exports.FootnotePropertiesDialog=t.o,exports.HyperlinkDialog=n.t,exports.ImagePositionDialog=t.i,exports.ImagePropertiesDialog=r.t,exports.InsertImageDialog=t.a,exports.InsertSymbolDialog=i.t,exports.InsertTableDialog=t.r,exports.PageSetupDialog=a.t,exports.PasteSpecialDialog=t.n,exports.SplitCellDialog=t.t,exports.TablePropertiesDialog=o.t,exports.WatermarkDialog=s.t;
package/dist/dialogs.js CHANGED
@@ -1 +1,9 @@
1
- export { m as FindReplaceDialog, s as FootnotePropertiesDialog, p as HyperlinkDialog, o as ImagePositionDialog, f as ImagePropertiesDialog, a as InsertImageDialog, d as InsertSymbolDialog, r as InsertTableDialog, u as PageSetupDialog, n as PasteSpecialDialog, t as SplitCellDialog, l as TablePropertiesDialog, c as WatermarkDialog } from "./SplitCellDialog-BczVYfpm.js";
1
+ import { t as e } from "./FindReplaceDialog-DEWjhuOw.js";
2
+ import { a as t, i as n, n as r, o as i, r as a, t as o } from "./SplitCellDialog-HIg4ZEqt.js";
3
+ import { t as s } from "./HyperlinkDialog-BEse_y7R.js";
4
+ import { t as c } from "./ImagePropertiesDialog-mrJ8S3sl.js";
5
+ import { t as l } from "./InsertSymbolDialog-BjB-Q9EO.js";
6
+ import { t as u } from "./PageSetupDialog-DNNSezj3.js";
7
+ import { t as d } from "./TablePropertiesDialog-CRX9Xgdr.js";
8
+ import { t as f } from "./WatermarkDialog-BoAdQ-qK.js";
9
+ export { e as FindReplaceDialog, i as FootnotePropertiesDialog, s as HyperlinkDialog, n as ImagePositionDialog, c as ImagePropertiesDialog, t as InsertImageDialog, l as InsertSymbolDialog, a as InsertTableDialog, u as PageSetupDialog, r as PasteSpecialDialog, o as SplitCellDialog, d as TablePropertiesDialog, f as WatermarkDialog };