@stll/folio-vue 0.32.1 → 0.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/FindReplaceDialog-CfcTl2Ra.cjs +1 -0
- package/dist/FindReplaceDialog-DEWjhuOw.js +168 -0
- package/dist/HorizontalRuler-Cuk0l4Us.cjs +1 -0
- package/dist/HorizontalRuler-TM9dg--R.js +341 -0
- package/dist/HyperlinkDialog-BEse_y7R.js +175 -0
- package/dist/HyperlinkDialog-Cs1y6aol.cjs +1 -0
- package/dist/ImagePropertiesDialog-CTbX2GrE.cjs +1 -0
- package/dist/ImagePropertiesDialog-mrJ8S3sl.js +186 -0
- package/dist/ImageSelectionOverlay-DULrvfOJ.js +386 -0
- package/dist/ImageSelectionOverlay-Dr0lg9WZ.cjs +1 -0
- package/dist/InsertSymbolDialog-BjB-Q9EO.js +93 -0
- package/dist/InsertSymbolDialog-BsjgPYM-.cjs +1 -0
- package/dist/PageSetupDialog-CZ5fE9rz.cjs +1 -0
- package/dist/PageSetupDialog-DNNSezj3.js +208 -0
- package/dist/SetNumberingValueDialog-ClCYr37D.cjs +1 -0
- package/dist/SetNumberingValueDialog-CwLHfO7f.js +54 -0
- package/dist/SplitCellDialog-Bfuo5WCO.cjs +1 -0
- package/dist/SplitCellDialog-HIg4ZEqt.js +1031 -0
- package/dist/StylePicker-BnGGlXOX.cjs +4 -0
- package/dist/{StylePicker-DmTN56Yg.js → StylePicker-F3cLPvRE.js} +593 -1100
- package/dist/TablePropertiesDialog-CRX9Xgdr.js +102 -0
- package/dist/TablePropertiesDialog-ClJSuB0F.cjs +1 -0
- package/dist/VerticalRuler-D973NTMv.js +178 -0
- package/dist/VerticalRuler-DVi2P_TO.cjs +1 -0
- package/dist/WatermarkDialog-BYyBTlDK.cjs +1 -0
- package/dist/WatermarkDialog-BoAdQ-qK.js +161 -0
- package/dist/components/dialogs/recentSymbols.d.ts +7 -0
- package/dist/composables/useDocxEditor.d.ts +4 -1
- package/dist/composables.cjs +1 -1
- package/dist/composables.js +1 -1
- package/dist/dialogs.cjs +1 -1
- package/dist/dialogs.js +9 -1
- package/dist/{SplitCellDialog-BczVYfpm.js → folio-ui-ctJdVP-s.js} +678 -2753
- package/dist/folio-ui-u7h3WXUO.cjs +15 -0
- package/dist/folio-vue.css +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +1665 -2064
- package/dist/messages/ar.cjs +1 -1
- package/dist/messages/cs.cjs +1 -1
- package/dist/messages/de.cjs +1 -1
- package/dist/messages/en.cjs +1 -1
- package/dist/messages/es.cjs +1 -1
- package/dist/messages/et.cjs +1 -1
- package/dist/messages/fr.cjs +1 -1
- package/dist/messages/he.cjs +1 -1
- package/dist/messages/hi.cjs +1 -1
- package/dist/messages/hu.cjs +1 -1
- package/dist/messages/lt.cjs +1 -1
- package/dist/messages/lv.cjs +1 -1
- package/dist/messages/pl.cjs +1 -1
- package/dist/messages/pt-BR.cjs +1 -1
- package/dist/messages/sk.cjs +1 -1
- package/dist/messages/tr.cjs +1 -1
- package/dist/messages/zh-CN.cjs +1 -1
- package/dist/rolldown-runtime-DbbDpzbe.cjs +1 -0
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +28 -18
- package/dist/{useZoom-1kmdkmJ4.js → useZoom-CX69Me_z.js} +289 -285
- package/dist/useZoom-QSSrGY_r.cjs +1 -0
- package/package.json +2 -2
- package/dist/SplitCellDialog-CrLHwVLc.cjs +0 -15
- package/dist/StylePicker-C0iEQnw6.cjs +0 -4
- package/dist/rolldown-runtime-5iZMYShA.cjs +0 -1
- package/dist/useZoom-Bj5B9uT1.cjs +0 -1
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
import { S as e, g as t } from "./folio-ui-ctJdVP-s.js";
|
|
2
|
+
import { t as n } from "./zIndex-FOGfTBdc.js";
|
|
3
|
+
import { Fragment as r, computed as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, defineComponent as c, nextTick as l, normalizeStyle as u, onBeforeUnmount as ee, openBlock as d, ref as f, renderList as te, toDisplayString as p, unref as ne, watch as m, withModifiers as h } from "vue";
|
|
4
|
+
import { findBodyPmAnchor as re } from "@stll/folio-core/layout-bridge/dom/findBodyPmSpans";
|
|
5
|
+
import { NodeSelection as ie } from "prosemirror-state";
|
|
6
|
+
import { findImageElement as ae } from "@stll/folio-core/layout-painter/imageLayout";
|
|
7
|
+
import { clickToPositionDom as oe } from "@stll/folio-core/layout-bridge/dom/clickToPositionDom";
|
|
8
|
+
import { pixelsToEmu as se } from "@stll/folio-core/utils/units";
|
|
9
|
+
import { commitImageFloatMove as ce, commitImageInlineMove as le, commitImageResize as ue, isFloatingImage as de } from "@stll/folio-core/prosemirror/imageCommit";
|
|
10
|
+
import { calculateResizedImageDimensions as fe } from "@stll/folio-core/utils/imageResize";
|
|
11
|
+
// src/composables/imageOverlayRect.ts
|
|
12
|
+
function pe(e) {
|
|
13
|
+
let t = Math.max(0, e.parentOffsetWidth - e.parentClientWidth) / 2, n = e.zoom || 1;
|
|
14
|
+
return {
|
|
15
|
+
left: (e.imageRect.left - e.parentRect.left - t + e.scrollLeft) / n,
|
|
16
|
+
top: (e.imageRect.top - e.parentRect.top + e.scrollTop) / n,
|
|
17
|
+
width: e.imageRect.width / n,
|
|
18
|
+
height: e.imageRect.height / n
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
// src/components/ImageSelectionOverlay.vue?vue&type=script&setup=true&lang.ts
|
|
22
|
+
var me = ["data-handle", "onMousedown"], he = ["title"], ge = {
|
|
23
|
+
key: 0,
|
|
24
|
+
class: "image-overlay__dim"
|
|
25
|
+
}, _e = {
|
|
26
|
+
key: 1,
|
|
27
|
+
class: "image-overlay__dim image-overlay__dim--rotate"
|
|
28
|
+
}, ve = 4, g = 15, _ = 250, ye = 700, be = /*#__PURE__*/ t(/* @__PURE__ */ c({
|
|
29
|
+
__name: "ImageSelectionOverlay",
|
|
30
|
+
props: {
|
|
31
|
+
imageInfo: {},
|
|
32
|
+
zoom: {},
|
|
33
|
+
view: {}
|
|
34
|
+
},
|
|
35
|
+
emits: [
|
|
36
|
+
"deselect",
|
|
37
|
+
"interact-start",
|
|
38
|
+
"interact-end",
|
|
39
|
+
"context-menu"
|
|
40
|
+
],
|
|
41
|
+
setup(t, { emit: c }) {
|
|
42
|
+
let { t: be } = e(), v = t, y = c, b = f(null), x = f(!1), S = f(!1), C = f(!1), w = f(0), T = f(0), E = f(0), D = f(null), O = "se", k = 0, A = 0, j = 0, M = 0, N = null, P = null, F = null, I = null;
|
|
43
|
+
function L(e, t) {
|
|
44
|
+
if (!e) return null;
|
|
45
|
+
try {
|
|
46
|
+
let n = e.state.doc.nodeAt(t);
|
|
47
|
+
return n && n.type.name === "image" ? n : null;
|
|
48
|
+
} catch {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function R(e) {
|
|
53
|
+
if (!e) return null;
|
|
54
|
+
let t = e.attrs.transform;
|
|
55
|
+
return typeof t == "string" ? t : null;
|
|
56
|
+
}
|
|
57
|
+
function z() {
|
|
58
|
+
return b.value?.closest(".docx-editor-vue__pages-viewport")?.querySelector(".docx-editor-vue__pages") ?? null;
|
|
59
|
+
}
|
|
60
|
+
function xe() {
|
|
61
|
+
let e = v.imageInfo;
|
|
62
|
+
if (!e) return null;
|
|
63
|
+
if (e.element.isConnected) return e.element;
|
|
64
|
+
let t = z();
|
|
65
|
+
if (!t) return null;
|
|
66
|
+
let n = re(t, e.pmPos);
|
|
67
|
+
return n ? ae(n) : null;
|
|
68
|
+
}
|
|
69
|
+
function B() {
|
|
70
|
+
let e = xe();
|
|
71
|
+
if (!e || !b.value) {
|
|
72
|
+
D.value = null;
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
let t = b.value.offsetParent;
|
|
76
|
+
if (!(t instanceof HTMLElement)) {
|
|
77
|
+
D.value = null;
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
let n = t.getBoundingClientRect(), r = e.getBoundingClientRect();
|
|
81
|
+
D.value = pe({
|
|
82
|
+
imageRect: r,
|
|
83
|
+
parentRect: n,
|
|
84
|
+
scrollLeft: t.scrollLeft,
|
|
85
|
+
scrollTop: t.scrollTop,
|
|
86
|
+
parentOffsetWidth: t.offsetWidth,
|
|
87
|
+
parentClientWidth: t.clientWidth,
|
|
88
|
+
zoom: v.zoom
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
let V = null;
|
|
92
|
+
function H() {
|
|
93
|
+
V?.();
|
|
94
|
+
let e = 0, t = "", n = 0, r = 0, i = (a) => {
|
|
95
|
+
r === 0 && (r = a);
|
|
96
|
+
let o = a - r;
|
|
97
|
+
B();
|
|
98
|
+
let s = D.value, c = s ? `${s.left}|${s.top}|${s.width}|${s.height}` : "";
|
|
99
|
+
n = c === t ? n + 1 : 0, t = c, !(o >= _ && n >= 2) && o < ye && (e = requestAnimationFrame(i));
|
|
100
|
+
};
|
|
101
|
+
e = requestAnimationFrame(i);
|
|
102
|
+
let a = setTimeout(B, _);
|
|
103
|
+
V = () => {
|
|
104
|
+
cancelAnimationFrame(e), clearTimeout(a);
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
m(() => v.imageInfo, (e, t, n) => {
|
|
108
|
+
v.imageInfo ? (H(), n(() => V?.())) : D.value = null;
|
|
109
|
+
}, { immediate: !0 }), m(() => v.zoom, () => {
|
|
110
|
+
v.imageInfo && H();
|
|
111
|
+
}), m(() => v.imageInfo, (e, t, n) => {
|
|
112
|
+
if (!v.imageInfo) return;
|
|
113
|
+
let r = () => {
|
|
114
|
+
P && cancelAnimationFrame(P), P = requestAnimationFrame(B);
|
|
115
|
+
}, i = b.value?.closest(".docx-editor-vue__pages-viewport");
|
|
116
|
+
i?.addEventListener("scroll", r, { passive: !0 }), window.addEventListener("resize", r, { passive: !0 });
|
|
117
|
+
let a = null, o = !1;
|
|
118
|
+
l(() => {
|
|
119
|
+
if (o || !v.imageInfo) return;
|
|
120
|
+
let e = z();
|
|
121
|
+
e && (a = new MutationObserver(() => H()), a.observe(e, {
|
|
122
|
+
attributes: !0,
|
|
123
|
+
attributeFilter: ["style"]
|
|
124
|
+
}));
|
|
125
|
+
}), n(() => {
|
|
126
|
+
o = !0, i?.removeEventListener("scroll", r), window.removeEventListener("resize", r), a?.disconnect(), P && cancelAnimationFrame(P);
|
|
127
|
+
});
|
|
128
|
+
}, { immediate: !0 });
|
|
129
|
+
let Se = i(() => x.value ? w.value : D.value?.width || 0), Ce = i(() => x.value ? T.value : D.value?.height || 0), we = i(() => {
|
|
130
|
+
let e = D.value;
|
|
131
|
+
if (!e) return {
|
|
132
|
+
position: "absolute",
|
|
133
|
+
top: "0px",
|
|
134
|
+
left: "0px",
|
|
135
|
+
visibility: "hidden",
|
|
136
|
+
pointerEvents: "none"
|
|
137
|
+
};
|
|
138
|
+
let t = x.value ? w.value : e.width, r = x.value ? T.value : e.height, i = v.zoom || 1;
|
|
139
|
+
return {
|
|
140
|
+
position: "absolute",
|
|
141
|
+
left: `${e.left * i}px`,
|
|
142
|
+
top: `${e.top * i}px`,
|
|
143
|
+
width: `${t}px`,
|
|
144
|
+
height: `${r}px`,
|
|
145
|
+
transform: i === 1 ? void 0 : `scale(${i})`,
|
|
146
|
+
transformOrigin: "top left",
|
|
147
|
+
zIndex: n.imageOverlay,
|
|
148
|
+
pointerEvents: "auto"
|
|
149
|
+
};
|
|
150
|
+
}), Te = i(() => {
|
|
151
|
+
let e = Se.value, t = Ce.value, n = `${e / 2 - 5}px`, r = `${t / 2 - 5}px`, i = `${e - 5}px`, a = `${t - 5}px`, o = "-5px";
|
|
152
|
+
return [
|
|
153
|
+
{
|
|
154
|
+
pos: "nw",
|
|
155
|
+
style: {
|
|
156
|
+
left: o,
|
|
157
|
+
top: o,
|
|
158
|
+
cursor: "nwse-resize"
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
pos: "n",
|
|
163
|
+
style: {
|
|
164
|
+
left: n,
|
|
165
|
+
top: o,
|
|
166
|
+
cursor: "ns-resize"
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
pos: "ne",
|
|
171
|
+
style: {
|
|
172
|
+
left: i,
|
|
173
|
+
top: o,
|
|
174
|
+
cursor: "nesw-resize"
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
pos: "e",
|
|
179
|
+
style: {
|
|
180
|
+
left: i,
|
|
181
|
+
top: r,
|
|
182
|
+
cursor: "ew-resize"
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
pos: "se",
|
|
187
|
+
style: {
|
|
188
|
+
left: i,
|
|
189
|
+
top: a,
|
|
190
|
+
cursor: "nwse-resize"
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
pos: "s",
|
|
195
|
+
style: {
|
|
196
|
+
left: n,
|
|
197
|
+
top: a,
|
|
198
|
+
cursor: "ns-resize"
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
pos: "sw",
|
|
203
|
+
style: {
|
|
204
|
+
left: o,
|
|
205
|
+
top: a,
|
|
206
|
+
cursor: "nesw-resize"
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
pos: "w",
|
|
211
|
+
style: {
|
|
212
|
+
left: o,
|
|
213
|
+
top: r,
|
|
214
|
+
cursor: "ew-resize"
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
];
|
|
218
|
+
});
|
|
219
|
+
function Ee(e, t) {
|
|
220
|
+
v.imageInfo && D.value && (O = t, k = e.clientX, A = e.clientY, j = D.value.width, M = D.value.height, N = { ...D.value }, w.value = Math.round(j), T.value = Math.round(M), x.value = !0, y("interact-start"), document.addEventListener("mousemove", U), document.addEventListener("mouseup", W));
|
|
221
|
+
}
|
|
222
|
+
function U(e) {
|
|
223
|
+
let t = v.zoom, n = (e.clientX - k) / t, r = (e.clientY - A) / t, i = fe({
|
|
224
|
+
handle: O,
|
|
225
|
+
deltaX: n,
|
|
226
|
+
deltaY: r,
|
|
227
|
+
startWidth: j,
|
|
228
|
+
startHeight: M,
|
|
229
|
+
aspect: e.shiftKey ? "free" : "locked"
|
|
230
|
+
});
|
|
231
|
+
w.value = Math.round(i.width), T.value = Math.round(i.height);
|
|
232
|
+
let a = N;
|
|
233
|
+
if (a) {
|
|
234
|
+
let e = O.includes("w") ? a.left + (a.width - i.width) : a.left, t = O.includes("n") ? a.top + (a.height - i.height) : a.top;
|
|
235
|
+
D.value = {
|
|
236
|
+
left: e,
|
|
237
|
+
top: t,
|
|
238
|
+
width: a.width,
|
|
239
|
+
height: a.height
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
function W() {
|
|
244
|
+
document.removeEventListener("mousemove", U), document.removeEventListener("mouseup", W), x.value = !1, N = null, y("interact-end");
|
|
245
|
+
let e = v.view, t = v.imageInfo;
|
|
246
|
+
if (!e || !t) {
|
|
247
|
+
B();
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
let n = ue(e, t.pmPos, w.value, T.value);
|
|
251
|
+
n !== null && $(n), l(() => B());
|
|
252
|
+
}
|
|
253
|
+
let De = 0, Oe = 0, ke = 0, G = 0, K = null, q = null;
|
|
254
|
+
function Ae(e) {
|
|
255
|
+
if (!e) return 0;
|
|
256
|
+
let t = e.match(/rotate\((-?\d+(?:\.\d+)?)deg\)/)?.[1];
|
|
257
|
+
return t ? parseFloat(t) : 0;
|
|
258
|
+
}
|
|
259
|
+
function J(e, t) {
|
|
260
|
+
let n = /scaleX\(-1\)/.test(e || ""), r = /scaleY\(-1\)/.test(e || ""), i = [], a = (t % 360 + 360) % 360;
|
|
261
|
+
return a !== 0 && i.push(`rotate(${a}deg)`), n && i.push("scaleX(-1)"), r && i.push("scaleY(-1)"), i.length > 0 ? i.join(" ") : null;
|
|
262
|
+
}
|
|
263
|
+
function Y(e, t) {
|
|
264
|
+
return Math.atan2(e - De, -(t - Oe)) * 180 / Math.PI;
|
|
265
|
+
}
|
|
266
|
+
function je(e) {
|
|
267
|
+
if (!v.imageInfo) return;
|
|
268
|
+
let t = v.imageInfo.element.getBoundingClientRect();
|
|
269
|
+
De = t.left + t.width / 2, Oe = t.top + t.height / 2, K = R(L(v.view, v.imageInfo.pmPos)), G = Ae(K), q = v.imageInfo.element.querySelector("img"), ke = Y(e.clientX, e.clientY), E.value = G, C.value = !0, y("interact-start"), document.addEventListener("mousemove", X), document.addEventListener("mouseup", Z);
|
|
270
|
+
}
|
|
271
|
+
function X(e) {
|
|
272
|
+
let t = Y(e.clientX, e.clientY) - ke, n = G + t;
|
|
273
|
+
e.shiftKey || (n = Math.round(n / g) * g), E.value = (n % 360 + 360) % 360, q && (q.style.transform = J(K, E.value) || "");
|
|
274
|
+
}
|
|
275
|
+
function Z() {
|
|
276
|
+
document.removeEventListener("mousemove", X), document.removeEventListener("mouseup", Z), C.value = !1, y("interact-end");
|
|
277
|
+
let e = v.view, t = v.imageInfo;
|
|
278
|
+
try {
|
|
279
|
+
let n = e && t ? L(e, t.pmPos) : null;
|
|
280
|
+
e && t && n && (e.dispatch(e.state.tr.setNodeMarkup(t.pmPos, void 0, {
|
|
281
|
+
...n.attrs,
|
|
282
|
+
transform: J(R(n), E.value)
|
|
283
|
+
})), $(t.pmPos));
|
|
284
|
+
} catch {} finally {
|
|
285
|
+
q && (q.style.transform = ""), q = null, K = null;
|
|
286
|
+
}
|
|
287
|
+
l(() => B());
|
|
288
|
+
}
|
|
289
|
+
let Q = null;
|
|
290
|
+
function Me(e) {
|
|
291
|
+
if (!v.imageInfo || !D.value) return;
|
|
292
|
+
let t = e.clientX, n = e.clientY, r = D.value, i = !1, a = (e) => {
|
|
293
|
+
let a = e.clientX - t, o = e.clientY - n;
|
|
294
|
+
if (!(!i && Math.sqrt(a * a + o * o) < ve)) {
|
|
295
|
+
if (!i) {
|
|
296
|
+
i = !0, S.value = !0, y("interact-start"), Q = document.createElement("div"), Q.style.cssText = "position: fixed; pointer-events: none; z-index: 10000; opacity: 0.5; border: 2px dashed #2563eb; border-radius: 4px; background: rgba(37, 99, 235, 0.1);";
|
|
297
|
+
let e = v.zoom;
|
|
298
|
+
Q.style.width = `${r.width * e}px`, Q.style.height = `${r.height * e}px`, document.body.appendChild(Q);
|
|
299
|
+
}
|
|
300
|
+
if (Q) {
|
|
301
|
+
let t = v.zoom;
|
|
302
|
+
Q.style.left = `${e.clientX - r.width * t / 2}px`, Q.style.top = `${e.clientY - r.height * t / 2}px`;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}, o = (e) => {
|
|
306
|
+
document.removeEventListener("mousemove", a), document.removeEventListener("mouseup", o), F = null, I = null, Q &&= (Q.remove(), null), S.value = !1, i && (y("interact-end"), Ne(e.clientX, e.clientY));
|
|
307
|
+
};
|
|
308
|
+
F = a, I = o, document.addEventListener("mousemove", a), document.addEventListener("mouseup", o);
|
|
309
|
+
}
|
|
310
|
+
function Ne(e, t) {
|
|
311
|
+
let n = v.view, r = v.imageInfo;
|
|
312
|
+
if (!n || !r) return;
|
|
313
|
+
let i = L(n, r.pmPos);
|
|
314
|
+
if (!i) return;
|
|
315
|
+
let a;
|
|
316
|
+
if (de(i)) {
|
|
317
|
+
let i = (b.value?.closest(".docx-editor-vue__pages-viewport"))?.querySelectorAll(".layout-page");
|
|
318
|
+
if (!i || i.length === 0) return;
|
|
319
|
+
let o = null;
|
|
320
|
+
for (let e of i) {
|
|
321
|
+
let n = e.getBoundingClientRect();
|
|
322
|
+
if (t >= n.top && t <= n.bottom) {
|
|
323
|
+
o = e.querySelector(".layout-page-content");
|
|
324
|
+
break;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
if (!o) {
|
|
328
|
+
let e = i.item(i.length - 1);
|
|
329
|
+
o = e ? e.querySelector(".layout-page-content") : null;
|
|
330
|
+
}
|
|
331
|
+
if (!o) return;
|
|
332
|
+
let s = o.getBoundingClientRect(), c = v.zoom, l = se((e - s.left) / c), u = se((t - s.top) / c);
|
|
333
|
+
a = ce(n, r.pmPos, l, u);
|
|
334
|
+
} else {
|
|
335
|
+
let i = z();
|
|
336
|
+
if (!i) return;
|
|
337
|
+
let o = oe(i, e, t, 1);
|
|
338
|
+
if (o == null || o < 0) return;
|
|
339
|
+
a = le(n, r.pmPos, o);
|
|
340
|
+
}
|
|
341
|
+
a !== null && $(a), l(() => B());
|
|
342
|
+
}
|
|
343
|
+
function $(e) {
|
|
344
|
+
let t = v.view;
|
|
345
|
+
if (t) try {
|
|
346
|
+
let n = ie.create(t.state.doc, e);
|
|
347
|
+
t.dispatch(t.state.tr.setSelection(n));
|
|
348
|
+
} catch {}
|
|
349
|
+
}
|
|
350
|
+
return ee(() => {
|
|
351
|
+
document.removeEventListener("mousemove", U), document.removeEventListener("mouseup", W), document.removeEventListener("mousemove", X), document.removeEventListener("mouseup", Z), F && document.removeEventListener("mousemove", F), I && document.removeEventListener("mouseup", I), Q &&= (Q.remove(), null), P && cancelAnimationFrame(P), V?.();
|
|
352
|
+
}), (e, n) => t.imageInfo ? (d(), o("div", {
|
|
353
|
+
key: 0,
|
|
354
|
+
ref_key: "overlayRootRef",
|
|
355
|
+
ref: b,
|
|
356
|
+
class: "image-overlay",
|
|
357
|
+
style: u(we.value),
|
|
358
|
+
onMousedown: n[3] ||= h(() => {}, ["stop"])
|
|
359
|
+
}, [
|
|
360
|
+
n[4] ||= s("div", { class: "image-overlay__border" }, null, -1),
|
|
361
|
+
s("div", {
|
|
362
|
+
class: "image-overlay__body",
|
|
363
|
+
style: u({ cursor: S.value ? "grabbing" : "grab" }),
|
|
364
|
+
onMousedown: n[0] ||= h((e) => Me(e), ["prevent", "stop"]),
|
|
365
|
+
onContextmenu: n[1] ||= h((t) => e.$emit("context-menu", t), ["prevent", "stop"])
|
|
366
|
+
}, null, 36),
|
|
367
|
+
(d(!0), o(r, null, te(Te.value, (e) => (d(), o("div", {
|
|
368
|
+
key: e.pos,
|
|
369
|
+
class: "image-overlay__handle",
|
|
370
|
+
style: u(e.style),
|
|
371
|
+
"data-handle": e.pos,
|
|
372
|
+
onMousedown: h((t) => Ee(t, e.pos), ["prevent", "stop"])
|
|
373
|
+
}, null, 44, me))), 128)),
|
|
374
|
+
n[5] ||= s("div", { class: "image-overlay__rotate-line" }, null, -1),
|
|
375
|
+
s("div", {
|
|
376
|
+
class: "image-overlay__rotate-handle",
|
|
377
|
+
style: u({ left: `${Se.value / 2 - 7}px` }),
|
|
378
|
+
title: ne(be)("imageOverlay.rotate"),
|
|
379
|
+
onMousedown: n[2] ||= h((e) => je(e), ["prevent", "stop"])
|
|
380
|
+
}, null, 44, he),
|
|
381
|
+
x.value ? (d(), o("div", ge, p(Math.round(w.value)) + " × " + p(Math.round(T.value)), 1)) : a("", !0),
|
|
382
|
+
C.value ? (d(), o("div", _e, p(Math.round(E.value)) + "° ", 1)) : a("", !0)
|
|
383
|
+
], 36)) : a("", !0);
|
|
384
|
+
}
|
|
385
|
+
}), [["__scopeId", "data-v-cfd964ef"]]);
|
|
386
|
+
export { be as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./folio-ui-u7h3WXUO.cjs"),t=require("./zIndex-CYoLNG_N.cjs");let n=require("vue"),r=require("@stll/folio-core/layout-bridge/dom/findBodyPmSpans"),i=require("prosemirror-state"),a=require("@stll/folio-core/layout-painter/imageLayout"),o=require("@stll/folio-core/layout-bridge/dom/clickToPositionDom"),s=require("@stll/folio-core/utils/units"),c=require("@stll/folio-core/prosemirror/imageCommit"),l=require("@stll/folio-core/utils/imageResize");function u(e){let t=Math.max(0,e.parentOffsetWidth-e.parentClientWidth)/2,n=e.zoom||1;return{left:(e.imageRect.left-e.parentRect.left-t+e.scrollLeft)/n,top:(e.imageRect.top-e.parentRect.top+e.scrollTop)/n,width:e.imageRect.width/n,height:e.imageRect.height/n}}var d=[`data-handle`,`onMousedown`],f=[`title`],ee={key:0,class:`image-overlay__dim`},te={key:1,class:`image-overlay__dim image-overlay__dim--rotate`},ne=4,re=15,ie=250,ae=700,p=(0,n.defineComponent)({__name:`ImageSelectionOverlay`,props:{imageInfo:{},zoom:{},view:{}},emits:[`deselect`,`interact-start`,`interact-end`,`context-menu`],setup(p,{emit:m}){let{t:oe}=e.S(),h=p,g=m,_=(0,n.ref)(null),v=(0,n.ref)(!1),y=(0,n.ref)(!1),b=(0,n.ref)(!1),x=(0,n.ref)(0),S=(0,n.ref)(0),C=(0,n.ref)(0),w=(0,n.ref)(null),T=`se`,E=0,D=0,O=0,k=0,A=null,j=null,M=null,N=null;function P(e,t){if(!e)return null;try{let n=e.state.doc.nodeAt(t);return n&&n.type.name===`image`?n:null}catch{return null}}function se(e){if(!e)return null;let t=e.attrs.transform;return typeof t==`string`?t:null}function F(){return _.value?.closest(`.docx-editor-vue__pages-viewport`)?.querySelector(`.docx-editor-vue__pages`)??null}function ce(){let e=h.imageInfo;if(!e)return null;if(e.element.isConnected)return e.element;let t=F();if(!t)return null;let n=(0,r.findBodyPmAnchor)(t,e.pmPos);return n?(0,a.findImageElement)(n):null}function I(){let e=ce();if(!e||!_.value){w.value=null;return}let t=_.value.offsetParent;if(!(t instanceof HTMLElement)){w.value=null;return}let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();w.value=u({imageRect:r,parentRect:n,scrollLeft:t.scrollLeft,scrollTop:t.scrollTop,parentOffsetWidth:t.offsetWidth,parentClientWidth:t.clientWidth,zoom:h.zoom})}let L=null;function R(){L?.();let e=0,t=``,n=0,r=0,i=a=>{r===0&&(r=a);let o=a-r;I();let s=w.value,c=s?`${s.left}|${s.top}|${s.width}|${s.height}`:``;n=c===t?n+1:0,t=c,!(o>=ie&&n>=2)&&o<ae&&(e=requestAnimationFrame(i))};e=requestAnimationFrame(i);let a=setTimeout(I,ie);L=()=>{cancelAnimationFrame(e),clearTimeout(a)}}(0,n.watch)(()=>h.imageInfo,(e,t,n)=>{h.imageInfo?(R(),n(()=>L?.())):w.value=null},{immediate:!0}),(0,n.watch)(()=>h.zoom,()=>{h.imageInfo&&R()}),(0,n.watch)(()=>h.imageInfo,(e,t,r)=>{if(!h.imageInfo)return;let i=()=>{j&&cancelAnimationFrame(j),j=requestAnimationFrame(I)},a=_.value?.closest(`.docx-editor-vue__pages-viewport`);a?.addEventListener(`scroll`,i,{passive:!0}),window.addEventListener(`resize`,i,{passive:!0});let o=null,s=!1;(0,n.nextTick)(()=>{if(s||!h.imageInfo)return;let e=F();e&&(o=new MutationObserver(()=>R()),o.observe(e,{attributes:!0,attributeFilter:[`style`]}))}),r(()=>{s=!0,a?.removeEventListener(`scroll`,i),window.removeEventListener(`resize`,i),o?.disconnect(),j&&cancelAnimationFrame(j)})},{immediate:!0});let z=(0,n.computed)(()=>v.value?x.value:w.value?.width||0),le=(0,n.computed)(()=>v.value?S.value:w.value?.height||0),ue=(0,n.computed)(()=>{let e=w.value;if(!e)return{position:`absolute`,top:`0px`,left:`0px`,visibility:`hidden`,pointerEvents:`none`};let n=v.value?x.value:e.width,r=v.value?S.value:e.height,i=h.zoom||1;return{position:`absolute`,left:`${e.left*i}px`,top:`${e.top*i}px`,width:`${n}px`,height:`${r}px`,transform:i===1?void 0:`scale(${i})`,transformOrigin:`top left`,zIndex:t.t.imageOverlay,pointerEvents:`auto`}}),de=(0,n.computed)(()=>{let e=z.value,t=le.value,n=`${e/2-5}px`,r=`${t/2-5}px`,i=`${e-5}px`,a=`${t-5}px`,o=`-5px`;return[{pos:`nw`,style:{left:o,top:o,cursor:`nwse-resize`}},{pos:`n`,style:{left:n,top:o,cursor:`ns-resize`}},{pos:`ne`,style:{left:i,top:o,cursor:`nesw-resize`}},{pos:`e`,style:{left:i,top:r,cursor:`ew-resize`}},{pos:`se`,style:{left:i,top:a,cursor:`nwse-resize`}},{pos:`s`,style:{left:n,top:a,cursor:`ns-resize`}},{pos:`sw`,style:{left:o,top:a,cursor:`nesw-resize`}},{pos:`w`,style:{left:o,top:r,cursor:`ew-resize`}}]});function fe(e,t){h.imageInfo&&w.value&&(T=t,E=e.clientX,D=e.clientY,O=w.value.width,k=w.value.height,A={...w.value},x.value=Math.round(O),S.value=Math.round(k),v.value=!0,g(`interact-start`),document.addEventListener(`mousemove`,B),document.addEventListener(`mouseup`,V))}function B(e){let t=h.zoom,n=(e.clientX-E)/t,r=(e.clientY-D)/t,i=(0,l.calculateResizedImageDimensions)({handle:T,deltaX:n,deltaY:r,startWidth:O,startHeight:k,aspect:e.shiftKey?`free`:`locked`});x.value=Math.round(i.width),S.value=Math.round(i.height);let a=A;if(a){let e=T.includes(`w`)?a.left+(a.width-i.width):a.left,t=T.includes(`n`)?a.top+(a.height-i.height):a.top;w.value={left:e,top:t,width:a.width,height:a.height}}}function V(){document.removeEventListener(`mousemove`,B),document.removeEventListener(`mouseup`,V),v.value=!1,A=null,g(`interact-end`);let e=h.view,t=h.imageInfo;if(!e||!t){I();return}let r=(0,c.commitImageResize)(e,t.pmPos,x.value,S.value);r!==null&&$(r),(0,n.nextTick)(()=>I())}let H=0,U=0,W=0,G=0,K=null,q=null;function pe(e){if(!e)return 0;let t=e.match(/rotate\((-?\d+(?:\.\d+)?)deg\)/)?.[1];return t?parseFloat(t):0}function J(e,t){let n=/scaleX\(-1\)/.test(e||``),r=/scaleY\(-1\)/.test(e||``),i=[],a=(t%360+360)%360;return a!==0&&i.push(`rotate(${a}deg)`),n&&i.push(`scaleX(-1)`),r&&i.push(`scaleY(-1)`),i.length>0?i.join(` `):null}function Y(e,t){return Math.atan2(e-H,-(t-U))*180/Math.PI}function me(e){if(!h.imageInfo)return;let t=h.imageInfo.element.getBoundingClientRect();H=t.left+t.width/2,U=t.top+t.height/2,K=se(P(h.view,h.imageInfo.pmPos)),G=pe(K),q=h.imageInfo.element.querySelector(`img`),W=Y(e.clientX,e.clientY),C.value=G,b.value=!0,g(`interact-start`),document.addEventListener(`mousemove`,X),document.addEventListener(`mouseup`,Z)}function X(e){let t=Y(e.clientX,e.clientY)-W,n=G+t;e.shiftKey||(n=Math.round(n/re)*re),C.value=(n%360+360)%360,q&&(q.style.transform=J(K,C.value)||``)}function Z(){document.removeEventListener(`mousemove`,X),document.removeEventListener(`mouseup`,Z),b.value=!1,g(`interact-end`);let e=h.view,t=h.imageInfo;try{let n=e&&t?P(e,t.pmPos):null;e&&t&&n&&(e.dispatch(e.state.tr.setNodeMarkup(t.pmPos,void 0,{...n.attrs,transform:J(se(n),C.value)})),$(t.pmPos))}catch{}finally{q&&(q.style.transform=``),q=null,K=null}(0,n.nextTick)(()=>I())}let Q=null;function he(e){if(!h.imageInfo||!w.value)return;let t=e.clientX,n=e.clientY,r=w.value,i=!1,a=e=>{let a=e.clientX-t,o=e.clientY-n;if(!(!i&&Math.sqrt(a*a+o*o)<ne)){if(!i){i=!0,y.value=!0,g(`interact-start`),Q=document.createElement(`div`),Q.style.cssText=`position: fixed; pointer-events: none; z-index: 10000; opacity: 0.5; border: 2px dashed #2563eb; border-radius: 4px; background: rgba(37, 99, 235, 0.1);`;let e=h.zoom;Q.style.width=`${r.width*e}px`,Q.style.height=`${r.height*e}px`,document.body.appendChild(Q)}if(Q){let t=h.zoom;Q.style.left=`${e.clientX-r.width*t/2}px`,Q.style.top=`${e.clientY-r.height*t/2}px`}}},o=e=>{document.removeEventListener(`mousemove`,a),document.removeEventListener(`mouseup`,o),M=null,N=null,Q&&=(Q.remove(),null),y.value=!1,i&&(g(`interact-end`),ge(e.clientX,e.clientY))};M=a,N=o,document.addEventListener(`mousemove`,a),document.addEventListener(`mouseup`,o)}function ge(e,t){let r=h.view,i=h.imageInfo;if(!r||!i)return;let a=P(r,i.pmPos);if(!a)return;let l;if((0,c.isFloatingImage)(a)){let n=(_.value?.closest(`.docx-editor-vue__pages-viewport`))?.querySelectorAll(`.layout-page`);if(!n||n.length===0)return;let a=null;for(let e of n){let n=e.getBoundingClientRect();if(t>=n.top&&t<=n.bottom){a=e.querySelector(`.layout-page-content`);break}}if(!a){let e=n.item(n.length-1);a=e?e.querySelector(`.layout-page-content`):null}if(!a)return;let o=a.getBoundingClientRect(),u=h.zoom,d=(0,s.pixelsToEmu)((e-o.left)/u),f=(0,s.pixelsToEmu)((t-o.top)/u);l=(0,c.commitImageFloatMove)(r,i.pmPos,d,f)}else{let n=F();if(!n)return;let a=(0,o.clickToPositionDom)(n,e,t,1);if(a==null||a<0)return;l=(0,c.commitImageInlineMove)(r,i.pmPos,a)}l!==null&&$(l),(0,n.nextTick)(()=>I())}function $(e){let t=h.view;if(t)try{let n=i.NodeSelection.create(t.state.doc,e);t.dispatch(t.state.tr.setSelection(n))}catch{}}return(0,n.onBeforeUnmount)(()=>{document.removeEventListener(`mousemove`,B),document.removeEventListener(`mouseup`,V),document.removeEventListener(`mousemove`,X),document.removeEventListener(`mouseup`,Z),M&&document.removeEventListener(`mousemove`,M),N&&document.removeEventListener(`mouseup`,N),Q&&=(Q.remove(),null),j&&cancelAnimationFrame(j),L?.()}),(e,t)=>p.imageInfo?((0,n.openBlock)(),(0,n.createElementBlock)(`div`,{key:0,ref_key:`overlayRootRef`,ref:_,class:`image-overlay`,style:(0,n.normalizeStyle)(ue.value),onMousedown:t[3]||=(0,n.withModifiers)(()=>{},[`stop`])},[t[4]||=(0,n.createElementVNode)(`div`,{class:`image-overlay__border`},null,-1),(0,n.createElementVNode)(`div`,{class:`image-overlay__body`,style:(0,n.normalizeStyle)({cursor:y.value?`grabbing`:`grab`}),onMousedown:t[0]||=(0,n.withModifiers)(e=>he(e),[`prevent`,`stop`]),onContextmenu:t[1]||=(0,n.withModifiers)(t=>e.$emit(`context-menu`,t),[`prevent`,`stop`])},null,36),((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(de.value,e=>((0,n.openBlock)(),(0,n.createElementBlock)(`div`,{key:e.pos,class:`image-overlay__handle`,style:(0,n.normalizeStyle)(e.style),"data-handle":e.pos,onMousedown:(0,n.withModifiers)(t=>fe(t,e.pos),[`prevent`,`stop`])},null,44,d))),128)),t[5]||=(0,n.createElementVNode)(`div`,{class:`image-overlay__rotate-line`},null,-1),(0,n.createElementVNode)(`div`,{class:`image-overlay__rotate-handle`,style:(0,n.normalizeStyle)({left:`${z.value/2-7}px`}),title:(0,n.unref)(oe)(`imageOverlay.rotate`),onMousedown:t[2]||=(0,n.withModifiers)(e=>me(e),[`prevent`,`stop`])},null,44,f),v.value?((0,n.openBlock)(),(0,n.createElementBlock)(`div`,ee,(0,n.toDisplayString)(Math.round(x.value))+` × `+(0,n.toDisplayString)(Math.round(S.value)),1)):(0,n.createCommentVNode)(``,!0),b.value?((0,n.openBlock)(),(0,n.createElementBlock)(`div`,te,(0,n.toDisplayString)(Math.round(C.value))+`° `,1)):(0,n.createCommentVNode)(``,!0)],36)):(0,n.createCommentVNode)(``,!0)}}),m=e.g(p,[[`__scopeId`,`data-v-cfd964ef`]]);exports.default=m;
|
|
@@ -0,0 +1,93 @@
|
|
|
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, nextTick as l, normalizeClass as u, openBlock as d, ref as f, renderList as p, toDisplayString as m, unref as h, vModelText as g, watch as _, withDirectives as v, withKeys as y, withModifiers as b } from "vue";
|
|
3
|
+
import { SYMBOL_CATEGORIES as x, filterSymbols as S } from "@stll/folio-core/symbols";
|
|
4
|
+
// src/components/dialogs/recentSymbols.ts
|
|
5
|
+
var C = 10, w = f([]), T = (e) => {
|
|
6
|
+
w.value = [e, ...w.value.filter((t) => t !== e)].slice(0, C);
|
|
7
|
+
}, E = { class: "dialog__header" }, D = { class: "dialog__title" }, O = ["title"], k = { class: "dialog__body" }, A = ["placeholder"], j = {
|
|
8
|
+
key: 0,
|
|
9
|
+
class: "symbol-tabs"
|
|
10
|
+
}, M = ["onMousedown"], N = { class: "symbol-grid" }, P = [
|
|
11
|
+
"title",
|
|
12
|
+
"onClick",
|
|
13
|
+
"onDblclick"
|
|
14
|
+
], F = {
|
|
15
|
+
key: 0,
|
|
16
|
+
class: "symbol-empty"
|
|
17
|
+
}, I = {
|
|
18
|
+
key: 1,
|
|
19
|
+
class: "symbol-preview"
|
|
20
|
+
}, L = { class: "symbol-preview__char" }, R = { class: "symbol-preview__info" }, z = {
|
|
21
|
+
key: 2,
|
|
22
|
+
class: "symbol-recent"
|
|
23
|
+
}, B = { class: "symbol-recent__label" }, V = ["onDblclick", "onClick"], H = { class: "dialog__actions" }, U = ["disabled"], W = /*@__PURE__*/ c({
|
|
24
|
+
__name: "InsertSymbolDialog",
|
|
25
|
+
props: { isOpen: { type: Boolean } },
|
|
26
|
+
emits: ["close", "insert"],
|
|
27
|
+
setup(e, { emit: n }) {
|
|
28
|
+
let { t: c } = t(), C = e, W = n, G = f(null), K = f(""), q = f("Common"), J = f(""), Y = x, X = i(() => {
|
|
29
|
+
if (K.value) return S(K.value);
|
|
30
|
+
let e = Y.find((e) => e.name === q.value);
|
|
31
|
+
return e ? e.symbols.map((t) => Object.assign({}, t, { category: e.name })) : [];
|
|
32
|
+
});
|
|
33
|
+
_(() => C.isOpen, async (e) => {
|
|
34
|
+
e && (await l(), G.value?.focus());
|
|
35
|
+
}, { immediate: !0 });
|
|
36
|
+
function Z() {
|
|
37
|
+
W("close");
|
|
38
|
+
}
|
|
39
|
+
function Q(e) {
|
|
40
|
+
e && (T(e), W("insert", e));
|
|
41
|
+
}
|
|
42
|
+
return (t, n) => e.isOpen ? (d(), o("div", {
|
|
43
|
+
key: 0,
|
|
44
|
+
class: "dialog-overlay",
|
|
45
|
+
onMousedown: b(Z, ["self"])
|
|
46
|
+
}, [s("div", {
|
|
47
|
+
class: "dialog symbol-dialog",
|
|
48
|
+
onMousedown: n[2] ||= b(() => {}, ["stop"]),
|
|
49
|
+
onKeydown: n[3] ||= b(() => {}, ["stop"])
|
|
50
|
+
}, [s("div", E, [s("span", D, m(h(c)("dialogs.insertSymbol.title")), 1), s("button", {
|
|
51
|
+
class: "dialog__close",
|
|
52
|
+
title: h(c)("common.closeDialog"),
|
|
53
|
+
onClick: Z
|
|
54
|
+
}, " ✕ ", 8, O)]), s("div", k, [
|
|
55
|
+
v(s("input", {
|
|
56
|
+
ref_key: "searchRef",
|
|
57
|
+
ref: G,
|
|
58
|
+
"onUpdate:modelValue": n[0] ||= (e) => K.value = e,
|
|
59
|
+
class: "symbol-search",
|
|
60
|
+
placeholder: h(c)("dialogs.insertSymbol.searchPlaceholder"),
|
|
61
|
+
onKeydown: y(Z, ["escape"])
|
|
62
|
+
}, null, 40, A), [[g, K.value]]),
|
|
63
|
+
K.value ? a("", !0) : (d(), o("div", j, [(d(!0), o(r, null, p(h(Y), (e) => (d(), o("button", {
|
|
64
|
+
key: e.name,
|
|
65
|
+
class: u(["symbol-tab", { active: q.value === e.name }]),
|
|
66
|
+
onMousedown: b((t) => q.value = e.name, ["prevent"])
|
|
67
|
+
}, m(h(c)(e.nameKey)), 43, M))), 128))])),
|
|
68
|
+
s("div", N, [(d(!0), o(r, null, p(X.value, (e) => (d(), o("button", {
|
|
69
|
+
key: e.char,
|
|
70
|
+
class: u(["symbol-cell", { selected: J.value === e.char }]),
|
|
71
|
+
title: e.name,
|
|
72
|
+
onClick: (t) => J.value = e.char,
|
|
73
|
+
onDblclick: (t) => Q(e.char)
|
|
74
|
+
}, m(e.char), 43, P))), 128)), X.value.length === 0 ? (d(), o("div", F, m(K.value ? h(c)("dialogs.insertSymbol.noResults", { query: K.value }) : h(c)("dialogs.insertSymbol.noResultsEmpty")), 1)) : a("", !0)]),
|
|
75
|
+
J.value ? (d(), o("div", I, [s("span", L, m(J.value), 1), s("span", R, "U+" + m(J.value.codePointAt(0)?.toString(16).toUpperCase().padStart(4, "0")), 1)])) : a("", !0),
|
|
76
|
+
h(w).length > 0 && !K.value ? (d(), o("div", z, [s("div", B, m(h(c)("dialogs.insertSymbol.recent")), 1), (d(!0), o(r, null, p(h(w), (e) => (d(), o("button", {
|
|
77
|
+
key: e,
|
|
78
|
+
class: "symbol-cell symbol-cell--small",
|
|
79
|
+
onDblclick: (t) => Q(e),
|
|
80
|
+
onClick: (t) => J.value = e
|
|
81
|
+
}, m(e), 41, V))), 128))])) : a("", !0),
|
|
82
|
+
s("div", H, [s("button", {
|
|
83
|
+
class: "dialog__btn",
|
|
84
|
+
onClick: Z
|
|
85
|
+
}, m(h(c)("common.cancel")), 1), s("button", {
|
|
86
|
+
class: "dialog__btn dialog__btn--primary",
|
|
87
|
+
onMousedown: n[1] ||= b((e) => Q(J.value), ["prevent"]),
|
|
88
|
+
disabled: !J.value
|
|
89
|
+
}, m(h(c)("common.insert")), 41, U)])
|
|
90
|
+
])], 32)], 32)) : a("", !0);
|
|
91
|
+
}
|
|
92
|
+
}), G = /* @__PURE__ */ e({ default: () => K }), K = /*#__PURE__*/ n(W, [["__scopeId", "data-v-972ef272"]]);
|
|
93
|
+
export { G as n, K 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/symbols");var i=10,a=(0,n.ref)([]),o=e=>{a.value=[e,...a.value.filter(t=>t!==e)].slice(0,i)},s={class:`dialog__header`},c={class:`dialog__title`},l=[`title`],u={class:`dialog__body`},d=[`placeholder`],f={key:0,class:`symbol-tabs`},p=[`onMousedown`],m={class:`symbol-grid`},h=[`title`,`onClick`,`onDblclick`],g={key:0,class:`symbol-empty`},_={key:1,class:`symbol-preview`},v={class:`symbol-preview__char`},y={class:`symbol-preview__info`},b={key:2,class:`symbol-recent`},x={class:`symbol-recent__label`},S=[`onDblclick`,`onClick`],C={class:`dialog__actions`},w=[`disabled`],T=(0,n.defineComponent)({__name:`InsertSymbolDialog`,props:{isOpen:{type:Boolean}},emits:[`close`,`insert`],setup(e,{emit:i}){let{t:T}=t.S(),E=e,D=i,O=(0,n.ref)(null),k=(0,n.ref)(``),A=(0,n.ref)(`Common`),j=(0,n.ref)(``),M=r.SYMBOL_CATEGORIES,N=(0,n.computed)(()=>{if(k.value)return(0,r.filterSymbols)(k.value);let e=M.find(e=>e.name===A.value);return e?e.symbols.map(t=>Object.assign({},t,{category:e.name})):[]});(0,n.watch)(()=>E.isOpen,async e=>{e&&(await(0,n.nextTick)(),O.value?.focus())},{immediate:!0});function P(){D(`close`)}function F(e){e&&(o(e),D(`insert`,e))}return(t,r)=>e.isOpen?((0,n.openBlock)(),(0,n.createElementBlock)(`div`,{key:0,class:`dialog-overlay`,onMousedown:(0,n.withModifiers)(P,[`self`])},[(0,n.createElementVNode)(`div`,{class:`dialog symbol-dialog`,onMousedown:r[2]||=(0,n.withModifiers)(()=>{},[`stop`]),onKeydown:r[3]||=(0,n.withModifiers)(()=>{},[`stop`])},[(0,n.createElementVNode)(`div`,s,[(0,n.createElementVNode)(`span`,c,(0,n.toDisplayString)((0,n.unref)(T)(`dialogs.insertSymbol.title`)),1),(0,n.createElementVNode)(`button`,{class:`dialog__close`,title:(0,n.unref)(T)(`common.closeDialog`),onClick:P},` ✕ `,8,l)]),(0,n.createElementVNode)(`div`,u,[(0,n.withDirectives)((0,n.createElementVNode)(`input`,{ref_key:`searchRef`,ref:O,"onUpdate:modelValue":r[0]||=e=>k.value=e,class:`symbol-search`,placeholder:(0,n.unref)(T)(`dialogs.insertSymbol.searchPlaceholder`),onKeydown:(0,n.withKeys)(P,[`escape`])},null,40,d),[[n.vModelText,k.value]]),k.value?(0,n.createCommentVNode)(``,!0):((0,n.openBlock)(),(0,n.createElementBlock)(`div`,f,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)((0,n.unref)(M),e=>((0,n.openBlock)(),(0,n.createElementBlock)(`button`,{key:e.name,class:(0,n.normalizeClass)([`symbol-tab`,{active:A.value===e.name}]),onMousedown:(0,n.withModifiers)(t=>A.value=e.name,[`prevent`])},(0,n.toDisplayString)((0,n.unref)(T)(e.nameKey)),43,p))),128))])),(0,n.createElementVNode)(`div`,m,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(N.value,e=>((0,n.openBlock)(),(0,n.createElementBlock)(`button`,{key:e.char,class:(0,n.normalizeClass)([`symbol-cell`,{selected:j.value===e.char}]),title:e.name,onClick:t=>j.value=e.char,onDblclick:t=>F(e.char)},(0,n.toDisplayString)(e.char),43,h))),128)),N.value.length===0?((0,n.openBlock)(),(0,n.createElementBlock)(`div`,g,(0,n.toDisplayString)(k.value?(0,n.unref)(T)(`dialogs.insertSymbol.noResults`,{query:k.value}):(0,n.unref)(T)(`dialogs.insertSymbol.noResultsEmpty`)),1)):(0,n.createCommentVNode)(``,!0)]),j.value?((0,n.openBlock)(),(0,n.createElementBlock)(`div`,_,[(0,n.createElementVNode)(`span`,v,(0,n.toDisplayString)(j.value),1),(0,n.createElementVNode)(`span`,y,`U+`+(0,n.toDisplayString)(j.value.codePointAt(0)?.toString(16).toUpperCase().padStart(4,`0`)),1)])):(0,n.createCommentVNode)(``,!0),(0,n.unref)(a).length>0&&!k.value?((0,n.openBlock)(),(0,n.createElementBlock)(`div`,b,[(0,n.createElementVNode)(`div`,x,(0,n.toDisplayString)((0,n.unref)(T)(`dialogs.insertSymbol.recent`)),1),((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)((0,n.unref)(a),e=>((0,n.openBlock)(),(0,n.createElementBlock)(`button`,{key:e,class:`symbol-cell symbol-cell--small`,onDblclick:t=>F(e),onClick:t=>j.value=e},(0,n.toDisplayString)(e),41,S))),128))])):(0,n.createCommentVNode)(``,!0),(0,n.createElementVNode)(`div`,C,[(0,n.createElementVNode)(`button`,{class:`dialog__btn`,onClick:P},(0,n.toDisplayString)((0,n.unref)(T)(`common.cancel`)),1),(0,n.createElementVNode)(`button`,{class:`dialog__btn dialog__btn--primary`,onMousedown:r[1]||=(0,n.withModifiers)(e=>F(j.value),[`prevent`]),disabled:!j.value},(0,n.toDisplayString)((0,n.unref)(T)(`common.insert`)),41,w)])])],32)],32)):(0,n.createCommentVNode)(``,!0)}}),E=e.n({default:()=>D}),D=t.g(T,[[`__scopeId`,`data-v-972ef272`]]);Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return D}});
|
|
@@ -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/units");var i={class:`ps-header`},a={class:`ps-body`},o={class:`ps-section-label`},s={class:`ps-row`},c={class:`ps-label`},l=[`value`],u=[`value`],d={key:0,value:-1},f={class:`ps-row`},p={class:`ps-label`},m=[`value`],h={value:`portrait`},g={value:`landscape`},_={class:`ps-section-label ps-section-label--spaced`},v={class:`ps-row`},y={class:`ps-label`},b={class:`ps-row`},x={class:`ps-label`},S={class:`ps-row`},C={class:`ps-label`},w={class:`ps-row`},T={class:`ps-label`},E={class:`ps-footer`},D=12240,O=15840,k=1440,A=(0,n.defineComponent)({__name:`PageSetupDialog`,props:{isOpen:{type:Boolean},sectionProperties:{}},emits:[`close`,`apply`],setup(e,{emit:A}){let{t:j}=t.S(),{Dialog:M}=t.a(),N=[{labelKey:`dialogs.pageSetup.pageSizes.letter`,width:12240,height:15840},{labelKey:`dialogs.pageSetup.pageSizes.a4`,width:11906,height:16838},{labelKey:`dialogs.pageSetup.pageSizes.legal`,width:12240,height:20160},{labelKey:`dialogs.pageSetup.pageSizes.a3`,width:16838,height:23811},{labelKey:`dialogs.pageSetup.pageSizes.a5`,width:8391,height:11906},{labelKey:`dialogs.pageSetup.pageSizes.b5`,width:9979,height:14175},{labelKey:`dialogs.pageSetup.pageSizes.executive`,width:10440,height:15120}],P=e,F=A,I=(0,n.ref)(D),L=(0,n.ref)(O),R=(0,n.ref)(`portrait`),z=(0,n.ref)(1),B=(0,n.ref)(1),V=(0,n.ref)(1),H=(0,n.ref)(1);function U(e){return Math.round(e/r.TWIPS_PER_INCH*100)/100}function W(e){return Math.round((Number(e)||0)*r.TWIPS_PER_INCH)}let G=(0,n.computed)(()=>{let e=Math.min(I.value,L.value),t=Math.max(I.value,L.value);return N.findIndex(n=>Math.abs(n.width-e)<20&&Math.abs(n.height-t)<20)});(0,n.watch)(()=>P.isOpen,e=>{if(!e)return;let t=P.sectionProperties,n=t?.pageWidth||D,r=t?.pageHeight||O;I.value=n,L.value=r,R.value=t?.orientation||(n>r?`landscape`:`portrait`),z.value=U(t?.marginTop??k),B.value=U(t?.marginBottom??k),V.value=U(t?.marginLeft??k),H.value=U(t?.marginRight??k)},{immediate:!0});function K(e){if(!(e.target instanceof HTMLSelectElement))return;let t=Number(e.target.value),n=N.at(t);t<0||!n||(R.value===`landscape`?(I.value=n.height,L.value=n.width):(I.value=n.width,L.value=n.height))}function q(e){if(!(e.target instanceof HTMLSelectElement))return;let t=e.target.value===`landscape`?`landscape`:`portrait`;if(t===R.value)return;R.value=t;let n=I.value;I.value=L.value,L.value=n}function J(){F(`close`)}function Y(){F(`apply`,{pageWidth:I.value,pageHeight:L.value,orientation:R.value,marginTop:W(z.value),marginBottom:W(B.value),marginLeft:W(V.value),marginRight:W(H.value)}),J()}return(t,r)=>((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(M),{open:e.isOpen,"aria-label":(0,n.unref)(j)(`dialogs.pageSetup.title`),style:{minWidth:`400px`,maxWidth:`480px`,width:`100%`,margin:`20px`},onClose:J,onKeydown:(0,n.withKeys)(Y,[`enter`])},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)(`div`,i,(0,n.toDisplayString)((0,n.unref)(j)(`dialogs.pageSetup.title`)),1),(0,n.createElementVNode)(`div`,a,[(0,n.createElementVNode)(`div`,o,(0,n.toDisplayString)((0,n.unref)(j)(`dialogs.pageSetup.pageSize`)),1),(0,n.createElementVNode)(`div`,s,[(0,n.createElementVNode)(`label`,c,(0,n.toDisplayString)((0,n.unref)(j)(`dialogs.pageSetup.sizeLabel`)),1),(0,n.createElementVNode)(`select`,{class:`ps-input`,value:G.value,onChange:K},[((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(N,(e,t)=>(0,n.createElementVNode)(`option`,{key:e.labelKey,value:t},(0,n.toDisplayString)((0,n.unref)(j)(e.labelKey)),9,u)),64)),G.value<0?((0,n.openBlock)(),(0,n.createElementBlock)(`option`,d,(0,n.toDisplayString)((0,n.unref)(j)(`dialogs.pageSetup.custom`)),1)):(0,n.createCommentVNode)(``,!0)],40,l)]),(0,n.createElementVNode)(`div`,f,[(0,n.createElementVNode)(`label`,p,(0,n.toDisplayString)((0,n.unref)(j)(`dialogs.pageSetup.orientation`)),1),(0,n.createElementVNode)(`select`,{class:`ps-input`,value:R.value,onChange:q},[(0,n.createElementVNode)(`option`,h,(0,n.toDisplayString)((0,n.unref)(j)(`dialogs.pageSetup.portrait`)),1),(0,n.createElementVNode)(`option`,g,(0,n.toDisplayString)((0,n.unref)(j)(`dialogs.pageSetup.landscape`)),1)],40,m)]),(0,n.createElementVNode)(`div`,_,(0,n.toDisplayString)((0,n.unref)(j)(`dialogs.pageSetup.margins`)),1),(0,n.createElementVNode)(`div`,v,[(0,n.createElementVNode)(`label`,y,(0,n.toDisplayString)((0,n.unref)(j)(`dialogs.pageSetup.top`)),1),(0,n.withDirectives)((0,n.createElementVNode)(`input`,{class:`ps-input`,type:`number`,min:`0`,max:`10`,step:`0.1`,"onUpdate:modelValue":r[0]||=e=>z.value=e},null,512),[[n.vModelText,z.value,void 0,{number:!0}]]),r[4]||=(0,n.createElementVNode)(`span`,{class:`ps-unit`},`in`,-1)]),(0,n.createElementVNode)(`div`,b,[(0,n.createElementVNode)(`label`,x,(0,n.toDisplayString)((0,n.unref)(j)(`dialogs.pageSetup.bottom`)),1),(0,n.withDirectives)((0,n.createElementVNode)(`input`,{class:`ps-input`,type:`number`,min:`0`,max:`10`,step:`0.1`,"onUpdate:modelValue":r[1]||=e=>B.value=e},null,512),[[n.vModelText,B.value,void 0,{number:!0}]]),r[5]||=(0,n.createElementVNode)(`span`,{class:`ps-unit`},`in`,-1)]),(0,n.createElementVNode)(`div`,S,[(0,n.createElementVNode)(`label`,C,(0,n.toDisplayString)((0,n.unref)(j)(`dialogs.pageSetup.left`)),1),(0,n.withDirectives)((0,n.createElementVNode)(`input`,{class:`ps-input`,type:`number`,min:`0`,max:`10`,step:`0.1`,"onUpdate:modelValue":r[2]||=e=>V.value=e},null,512),[[n.vModelText,V.value,void 0,{number:!0}]]),r[6]||=(0,n.createElementVNode)(`span`,{class:`ps-unit`},`in`,-1)]),(0,n.createElementVNode)(`div`,w,[(0,n.createElementVNode)(`label`,T,(0,n.toDisplayString)((0,n.unref)(j)(`dialogs.pageSetup.right`)),1),(0,n.withDirectives)((0,n.createElementVNode)(`input`,{class:`ps-input`,type:`number`,min:`0`,max:`10`,step:`0.1`,"onUpdate:modelValue":r[3]||=e=>H.value=e},null,512),[[n.vModelText,H.value,void 0,{number:!0}]]),r[7]||=(0,n.createElementVNode)(`span`,{class:`ps-unit`},`in`,-1)])]),(0,n.createElementVNode)(`div`,E,[(0,n.createElementVNode)(`button`,{type:`button`,class:`ps-btn`,onClick:J},(0,n.toDisplayString)((0,n.unref)(j)(`common.cancel`)),1),(0,n.createElementVNode)(`button`,{type:`button`,class:`ps-btn ps-btn--primary`,onClick:Y},(0,n.toDisplayString)((0,n.unref)(j)(`common.apply`)),1)])]),_:1},8,[`open`,`aria-label`]))}}),j=e.n({default:()=>M}),M=t.g(A,[[`__scopeId`,`data-v-757aa5a3`]]);Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return M}});
|