@stll/folio-react 0.6.0 → 0.7.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/{CommentsSidebar-_utmEkA9.js → CommentsSidebar-B8X5a8JW.js} +126 -129
- package/dist/{FindReplaceDialog-DLdBekSR.js → FindReplaceDialog-Bx7QaFQ_.js} +23 -18
- package/dist/FootnotePropertiesDialog-2lmpg9m8.js +646 -0
- package/dist/ImagePositionDialog-D3MileYL.js +842 -0
- package/dist/ImagePropertiesDialog-CzK8HCaW.js +465 -0
- package/dist/InsertSymbolDialog-Df9dyLvn.js +376 -0
- package/dist/PageSetupDialog-PSs9YdPb.js +684 -0
- package/dist/TablePropertiesDialog-PQxKKM0Y.js +344 -0
- package/dist/{TextContextMenu-CG0V37wi.js → TextContextMenu-Ci7-M4oU.js} +199 -79
- package/dist/compat/eigenpal.d.ts +1 -1
- package/dist/compat/eigenpal.js +89 -17
- package/dist/dialogChrome-BoGYPgeu.js +26 -0
- package/dist/{dialogs-j7qyw17x.d.ts → dialogs-DK8OVUT_.d.ts} +13 -1
- package/dist/{dialogs-CzvXYJyG.js → dialogs-DsHnfN0g.js} +508 -316
- package/dist/dialogs.d.ts +2 -2
- package/dist/dialogs.js +9 -8
- package/dist/editor.css +1 -1
- package/dist/folio-ui-C-85DSuK.js +1011 -0
- package/dist/index.d.ts +5 -4
- package/dist/index.js +12 -11
- package/dist/{renderAsync-B7UJsZye.d.ts → renderAsync-ChQI9UJG.d.ts} +11 -3
- package/dist/{renderAsync-CwHTsxBN.js → renderAsync-evdyE_GW.js} +5593 -3256
- package/dist/standalone.css +1 -1
- package/package.json +8 -6
- package/dist/FootnotePropertiesDialog-CUjq9c6H.js +0 -267
- package/dist/ImagePositionDialog-BMuO9rLT.js +0 -395
- package/dist/ImagePropertiesDialog-C8iEgdmN.js +0 -198
- package/dist/PageSetupDialog-BKsSMCGb.js +0 -312
- package/dist/TablePropertiesDialog-Dw8gvL78.js +0 -159
- package/dist/useFindReplace-BPBpMWS9.js +0 -842
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-BBjsoOtd.js";
|
|
2
|
+
import { r as useFolioUI } from "./folio-ui-C-85DSuK.js";
|
|
3
|
+
import { u as useCloseOnDialogOpenChange } from "./dialogChrome-BoGYPgeu.js";
|
|
4
|
+
import { c } from "react-compiler-runtime";
|
|
5
|
+
import { useEffect, useId, useState } from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/dialogs/TablePropertiesDialog.tsx
|
|
8
|
+
/**
|
|
9
|
+
* Table Properties Dialog — width type, width value, alignment.
|
|
10
|
+
*/
|
|
11
|
+
var TablePropertiesDialog_exports = /* @__PURE__ */ __exportAll({ TablePropertiesDialog: () => TablePropertiesDialog });
|
|
12
|
+
function TablePropertiesDialog(t0) {
|
|
13
|
+
const $ = c(75);
|
|
14
|
+
const { isOpen, onClose, onApply, currentProps } = t0;
|
|
15
|
+
const { Root: Dialog, Portal: DialogPortal, Backdrop: DialogBackdrop, Popup: DialogPopup, Title: DialogTitle, Close: DialogClose } = useFolioUI().Dialog;
|
|
16
|
+
const handleOpenChange = useCloseOnDialogOpenChange(onClose);
|
|
17
|
+
const id = useId();
|
|
18
|
+
const [width, setWidth] = useState(currentProps?.width ?? 0);
|
|
19
|
+
const [widthType, setWidthType] = useState(currentProps?.widthType ?? "auto");
|
|
20
|
+
const [justification, setJustification] = useState(currentProps?.justification ?? "left");
|
|
21
|
+
let t1;
|
|
22
|
+
if ($[0] !== currentProps?.justification || $[1] !== currentProps?.width || $[2] !== currentProps?.widthType || $[3] !== isOpen) {
|
|
23
|
+
t1 = () => {
|
|
24
|
+
if (isOpen) {
|
|
25
|
+
setWidth(currentProps?.width ?? 0);
|
|
26
|
+
setWidthType(currentProps?.widthType ?? "auto");
|
|
27
|
+
setJustification(currentProps?.justification ?? "left");
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
$[0] = currentProps?.justification;
|
|
31
|
+
$[1] = currentProps?.width;
|
|
32
|
+
$[2] = currentProps?.widthType;
|
|
33
|
+
$[3] = isOpen;
|
|
34
|
+
$[4] = t1;
|
|
35
|
+
} else t1 = $[4];
|
|
36
|
+
let t2;
|
|
37
|
+
if ($[5] !== currentProps || $[6] !== isOpen) {
|
|
38
|
+
t2 = [isOpen, currentProps];
|
|
39
|
+
$[5] = currentProps;
|
|
40
|
+
$[6] = isOpen;
|
|
41
|
+
$[7] = t2;
|
|
42
|
+
} else t2 = $[7];
|
|
43
|
+
useEffect(t1, t2);
|
|
44
|
+
let t3;
|
|
45
|
+
if ($[8] !== justification || $[9] !== onApply || $[10] !== onClose || $[11] !== width || $[12] !== widthType) {
|
|
46
|
+
t3 = () => {
|
|
47
|
+
const props = { justification: justification === "left" || justification === "center" || justification === "right" ? justification : "left" };
|
|
48
|
+
if (widthType === "auto") {
|
|
49
|
+
props.width = null;
|
|
50
|
+
props.widthType = "auto";
|
|
51
|
+
} else {
|
|
52
|
+
props.width = width;
|
|
53
|
+
props.widthType = widthType;
|
|
54
|
+
}
|
|
55
|
+
onApply(props);
|
|
56
|
+
onClose();
|
|
57
|
+
};
|
|
58
|
+
$[8] = justification;
|
|
59
|
+
$[9] = onApply;
|
|
60
|
+
$[10] = onClose;
|
|
61
|
+
$[11] = width;
|
|
62
|
+
$[12] = widthType;
|
|
63
|
+
$[13] = t3;
|
|
64
|
+
} else t3 = $[13];
|
|
65
|
+
const handleApply = t3;
|
|
66
|
+
const t4 = `${id}-tp-width-type`;
|
|
67
|
+
const t5 = `${id}-tp-width`;
|
|
68
|
+
const t6 = `${id}-tp-align`;
|
|
69
|
+
let t7;
|
|
70
|
+
if ($[14] !== t4 || $[15] !== t5 || $[16] !== t6) {
|
|
71
|
+
t7 = {
|
|
72
|
+
widthType: t4,
|
|
73
|
+
width: t5,
|
|
74
|
+
align: t6
|
|
75
|
+
};
|
|
76
|
+
$[14] = t4;
|
|
77
|
+
$[15] = t5;
|
|
78
|
+
$[16] = t6;
|
|
79
|
+
$[17] = t7;
|
|
80
|
+
} else t7 = $[17];
|
|
81
|
+
const fieldIds = t7;
|
|
82
|
+
let t8;
|
|
83
|
+
if ($[18] !== DialogBackdrop) {
|
|
84
|
+
t8 = /* @__PURE__ */ jsx(DialogBackdrop, { className: "fixed inset-0 z-[10000] bg-black/50" });
|
|
85
|
+
$[18] = DialogBackdrop;
|
|
86
|
+
$[19] = t8;
|
|
87
|
+
} else t8 = $[19];
|
|
88
|
+
let t9;
|
|
89
|
+
if ($[20] !== DialogTitle) {
|
|
90
|
+
t9 = /* @__PURE__ */ jsx(DialogTitle, {
|
|
91
|
+
className: "border-b px-5 py-3 text-base font-semibold",
|
|
92
|
+
children: "Table Properties"
|
|
93
|
+
});
|
|
94
|
+
$[20] = DialogTitle;
|
|
95
|
+
$[21] = t9;
|
|
96
|
+
} else t9 = $[21];
|
|
97
|
+
let t10;
|
|
98
|
+
if ($[22] !== fieldIds.widthType) {
|
|
99
|
+
t10 = /* @__PURE__ */ jsx("label", {
|
|
100
|
+
className: "w-20 text-muted-foreground text-[13px]",
|
|
101
|
+
htmlFor: fieldIds.widthType,
|
|
102
|
+
children: "Width type"
|
|
103
|
+
});
|
|
104
|
+
$[22] = fieldIds.widthType;
|
|
105
|
+
$[23] = t10;
|
|
106
|
+
} else t10 = $[23];
|
|
107
|
+
let t11;
|
|
108
|
+
if ($[24] === Symbol.for("react.memo_cache_sentinel")) {
|
|
109
|
+
t11 = (e) => setWidthType(e.target.value);
|
|
110
|
+
$[24] = t11;
|
|
111
|
+
} else t11 = $[24];
|
|
112
|
+
let t12;
|
|
113
|
+
let t13;
|
|
114
|
+
let t14;
|
|
115
|
+
if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
|
|
116
|
+
t12 = /* @__PURE__ */ jsx("option", {
|
|
117
|
+
value: "auto",
|
|
118
|
+
children: "Auto"
|
|
119
|
+
});
|
|
120
|
+
t13 = /* @__PURE__ */ jsx("option", {
|
|
121
|
+
value: "dxa",
|
|
122
|
+
children: "Fixed (twips)"
|
|
123
|
+
});
|
|
124
|
+
t14 = /* @__PURE__ */ jsx("option", {
|
|
125
|
+
value: "pct",
|
|
126
|
+
children: "Percentage"
|
|
127
|
+
});
|
|
128
|
+
$[25] = t12;
|
|
129
|
+
$[26] = t13;
|
|
130
|
+
$[27] = t14;
|
|
131
|
+
} else {
|
|
132
|
+
t12 = $[25];
|
|
133
|
+
t13 = $[26];
|
|
134
|
+
t14 = $[27];
|
|
135
|
+
}
|
|
136
|
+
let t15;
|
|
137
|
+
if ($[28] !== fieldIds.widthType || $[29] !== widthType) {
|
|
138
|
+
t15 = /* @__PURE__ */ jsxs("select", {
|
|
139
|
+
className: "border-input bg-background text-foreground flex-1 rounded border px-2 py-1.5 text-[13px] outline-none",
|
|
140
|
+
id: fieldIds.widthType,
|
|
141
|
+
onChange: t11,
|
|
142
|
+
value: widthType,
|
|
143
|
+
children: [
|
|
144
|
+
t12,
|
|
145
|
+
t13,
|
|
146
|
+
t14
|
|
147
|
+
]
|
|
148
|
+
});
|
|
149
|
+
$[28] = fieldIds.widthType;
|
|
150
|
+
$[29] = widthType;
|
|
151
|
+
$[30] = t15;
|
|
152
|
+
} else t15 = $[30];
|
|
153
|
+
let t16;
|
|
154
|
+
if ($[31] !== t10 || $[32] !== t15) {
|
|
155
|
+
t16 = /* @__PURE__ */ jsxs("div", {
|
|
156
|
+
className: "flex items-center gap-3",
|
|
157
|
+
children: [t10, t15]
|
|
158
|
+
});
|
|
159
|
+
$[31] = t10;
|
|
160
|
+
$[32] = t15;
|
|
161
|
+
$[33] = t16;
|
|
162
|
+
} else t16 = $[33];
|
|
163
|
+
let t17;
|
|
164
|
+
if ($[34] !== fieldIds.width || $[35] !== width || $[36] !== widthType) {
|
|
165
|
+
t17 = widthType !== "auto" && /* @__PURE__ */ jsxs("div", {
|
|
166
|
+
className: "flex items-center gap-3",
|
|
167
|
+
children: [
|
|
168
|
+
/* @__PURE__ */ jsx("label", {
|
|
169
|
+
className: "w-20 text-muted-foreground text-[13px]",
|
|
170
|
+
htmlFor: fieldIds.width,
|
|
171
|
+
children: "Width"
|
|
172
|
+
}),
|
|
173
|
+
/* @__PURE__ */ jsx("input", {
|
|
174
|
+
className: "border-input bg-background text-foreground flex-1 rounded border px-2 py-1.5 text-[13px] outline-none",
|
|
175
|
+
id: fieldIds.width,
|
|
176
|
+
min: 0,
|
|
177
|
+
onChange: (e_0) => setWidth(Number(e_0.target.value) || 0),
|
|
178
|
+
step: widthType === "pct" ? 5 : 100,
|
|
179
|
+
type: "number",
|
|
180
|
+
value: width
|
|
181
|
+
}),
|
|
182
|
+
/* @__PURE__ */ jsx("span", {
|
|
183
|
+
className: "text-muted-foreground text-[11px]",
|
|
184
|
+
children: widthType === "pct" ? "(50ths of %)" : "tw"
|
|
185
|
+
})
|
|
186
|
+
]
|
|
187
|
+
});
|
|
188
|
+
$[34] = fieldIds.width;
|
|
189
|
+
$[35] = width;
|
|
190
|
+
$[36] = widthType;
|
|
191
|
+
$[37] = t17;
|
|
192
|
+
} else t17 = $[37];
|
|
193
|
+
let t18;
|
|
194
|
+
if ($[38] !== fieldIds.align) {
|
|
195
|
+
t18 = /* @__PURE__ */ jsx("label", {
|
|
196
|
+
className: "w-20 text-muted-foreground text-[13px]",
|
|
197
|
+
htmlFor: fieldIds.align,
|
|
198
|
+
children: "Alignment"
|
|
199
|
+
});
|
|
200
|
+
$[38] = fieldIds.align;
|
|
201
|
+
$[39] = t18;
|
|
202
|
+
} else t18 = $[39];
|
|
203
|
+
let t19;
|
|
204
|
+
if ($[40] === Symbol.for("react.memo_cache_sentinel")) {
|
|
205
|
+
t19 = (e_1) => setJustification(e_1.target.value);
|
|
206
|
+
$[40] = t19;
|
|
207
|
+
} else t19 = $[40];
|
|
208
|
+
let t20;
|
|
209
|
+
let t21;
|
|
210
|
+
let t22;
|
|
211
|
+
if ($[41] === Symbol.for("react.memo_cache_sentinel")) {
|
|
212
|
+
t20 = /* @__PURE__ */ jsx("option", {
|
|
213
|
+
value: "left",
|
|
214
|
+
children: "Left"
|
|
215
|
+
});
|
|
216
|
+
t21 = /* @__PURE__ */ jsx("option", {
|
|
217
|
+
value: "center",
|
|
218
|
+
children: "Center"
|
|
219
|
+
});
|
|
220
|
+
t22 = /* @__PURE__ */ jsx("option", {
|
|
221
|
+
value: "right",
|
|
222
|
+
children: "Right"
|
|
223
|
+
});
|
|
224
|
+
$[41] = t20;
|
|
225
|
+
$[42] = t21;
|
|
226
|
+
$[43] = t22;
|
|
227
|
+
} else {
|
|
228
|
+
t20 = $[41];
|
|
229
|
+
t21 = $[42];
|
|
230
|
+
t22 = $[43];
|
|
231
|
+
}
|
|
232
|
+
let t23;
|
|
233
|
+
if ($[44] !== fieldIds.align || $[45] !== justification) {
|
|
234
|
+
t23 = /* @__PURE__ */ jsxs("select", {
|
|
235
|
+
className: "border-input bg-background text-foreground flex-1 rounded border px-2 py-1.5 text-[13px] outline-none",
|
|
236
|
+
id: fieldIds.align,
|
|
237
|
+
onChange: t19,
|
|
238
|
+
value: justification,
|
|
239
|
+
children: [
|
|
240
|
+
t20,
|
|
241
|
+
t21,
|
|
242
|
+
t22
|
|
243
|
+
]
|
|
244
|
+
});
|
|
245
|
+
$[44] = fieldIds.align;
|
|
246
|
+
$[45] = justification;
|
|
247
|
+
$[46] = t23;
|
|
248
|
+
} else t23 = $[46];
|
|
249
|
+
let t24;
|
|
250
|
+
if ($[47] !== t18 || $[48] !== t23) {
|
|
251
|
+
t24 = /* @__PURE__ */ jsxs("div", {
|
|
252
|
+
className: "flex items-center gap-3",
|
|
253
|
+
children: [t18, t23]
|
|
254
|
+
});
|
|
255
|
+
$[47] = t18;
|
|
256
|
+
$[48] = t23;
|
|
257
|
+
$[49] = t24;
|
|
258
|
+
} else t24 = $[49];
|
|
259
|
+
let t25;
|
|
260
|
+
if ($[50] !== t16 || $[51] !== t17 || $[52] !== t24) {
|
|
261
|
+
t25 = /* @__PURE__ */ jsxs("div", {
|
|
262
|
+
className: "flex flex-col gap-3 px-5 py-4",
|
|
263
|
+
children: [
|
|
264
|
+
t16,
|
|
265
|
+
t17,
|
|
266
|
+
t24
|
|
267
|
+
]
|
|
268
|
+
});
|
|
269
|
+
$[50] = t16;
|
|
270
|
+
$[51] = t17;
|
|
271
|
+
$[52] = t24;
|
|
272
|
+
$[53] = t25;
|
|
273
|
+
} else t25 = $[53];
|
|
274
|
+
let t26;
|
|
275
|
+
if ($[54] !== DialogClose) {
|
|
276
|
+
t26 = /* @__PURE__ */ jsx(DialogClose, {
|
|
277
|
+
className: "border-input rounded border px-4 py-1.5 text-[13px]",
|
|
278
|
+
children: "Cancel"
|
|
279
|
+
});
|
|
280
|
+
$[54] = DialogClose;
|
|
281
|
+
$[55] = t26;
|
|
282
|
+
} else t26 = $[55];
|
|
283
|
+
let t27;
|
|
284
|
+
if ($[56] !== handleApply) {
|
|
285
|
+
t27 = /* @__PURE__ */ jsx("button", {
|
|
286
|
+
className: "bg-primary text-primary-foreground rounded px-4 py-1.5 text-[13px] font-medium",
|
|
287
|
+
onClick: handleApply,
|
|
288
|
+
type: "button",
|
|
289
|
+
children: "Apply"
|
|
290
|
+
});
|
|
291
|
+
$[56] = handleApply;
|
|
292
|
+
$[57] = t27;
|
|
293
|
+
} else t27 = $[57];
|
|
294
|
+
let t28;
|
|
295
|
+
if ($[58] !== t26 || $[59] !== t27) {
|
|
296
|
+
t28 = /* @__PURE__ */ jsxs("div", {
|
|
297
|
+
className: "flex justify-end gap-2 border-t px-5 py-3",
|
|
298
|
+
children: [t26, t27]
|
|
299
|
+
});
|
|
300
|
+
$[58] = t26;
|
|
301
|
+
$[59] = t27;
|
|
302
|
+
$[60] = t28;
|
|
303
|
+
} else t28 = $[60];
|
|
304
|
+
let t29;
|
|
305
|
+
if ($[61] !== DialogPopup || $[62] !== t25 || $[63] !== t28 || $[64] !== t9) {
|
|
306
|
+
t29 = /* @__PURE__ */ jsxs(DialogPopup, {
|
|
307
|
+
className: "bg-popover fixed start-1/2 top-1/2 z-[10001] w-full max-w-[440px] min-w-[360px] -translate-x-1/2 -translate-y-1/2 rounded-lg border shadow-xl",
|
|
308
|
+
children: [
|
|
309
|
+
t9,
|
|
310
|
+
t25,
|
|
311
|
+
t28
|
|
312
|
+
]
|
|
313
|
+
});
|
|
314
|
+
$[61] = DialogPopup;
|
|
315
|
+
$[62] = t25;
|
|
316
|
+
$[63] = t28;
|
|
317
|
+
$[64] = t9;
|
|
318
|
+
$[65] = t29;
|
|
319
|
+
} else t29 = $[65];
|
|
320
|
+
let t30;
|
|
321
|
+
if ($[66] !== DialogPortal || $[67] !== t29 || $[68] !== t8) {
|
|
322
|
+
t30 = /* @__PURE__ */ jsxs(DialogPortal, { children: [t8, t29] });
|
|
323
|
+
$[66] = DialogPortal;
|
|
324
|
+
$[67] = t29;
|
|
325
|
+
$[68] = t8;
|
|
326
|
+
$[69] = t30;
|
|
327
|
+
} else t30 = $[69];
|
|
328
|
+
let t31;
|
|
329
|
+
if ($[70] !== Dialog || $[71] !== handleOpenChange || $[72] !== isOpen || $[73] !== t30) {
|
|
330
|
+
t31 = /* @__PURE__ */ jsx(Dialog, {
|
|
331
|
+
open: isOpen,
|
|
332
|
+
onOpenChange: handleOpenChange,
|
|
333
|
+
children: t30
|
|
334
|
+
});
|
|
335
|
+
$[70] = Dialog;
|
|
336
|
+
$[71] = handleOpenChange;
|
|
337
|
+
$[72] = isOpen;
|
|
338
|
+
$[73] = t30;
|
|
339
|
+
$[74] = t31;
|
|
340
|
+
} else t31 = $[74];
|
|
341
|
+
return t31;
|
|
342
|
+
}
|
|
343
|
+
//#endregion
|
|
344
|
+
export { TablePropertiesDialog_exports as n, TablePropertiesDialog as t };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { c } from "react-compiler-runtime";
|
|
1
2
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
2
3
|
import { ArrowDownToLine, ArrowLeftToLine, ArrowRightToLine, ArrowUpToLine, ClipboardPaste, Copy, Grid3x3, MessageSquarePlus, Scissors, SquareDashed, TextSelect, Trash2 } from "lucide-react";
|
|
3
4
|
import { createPortal } from "react-dom";
|
|
@@ -94,67 +95,187 @@ function itemIconColor(item) {
|
|
|
94
95
|
if (item.emphasis) return EMPHASIS_COLOR;
|
|
95
96
|
return "var(--muted-foreground, var(--doc-text-muted, #737373))";
|
|
96
97
|
}
|
|
97
|
-
const MenuItemComponent = (
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
98
|
+
const MenuItemComponent = (t0) => {
|
|
99
|
+
const $ = c(45);
|
|
100
|
+
const { item, isHighlighted, navigableIndex, onItemClick, onItemEnter } = t0;
|
|
101
|
+
let t1;
|
|
102
|
+
if ($[0] !== item || $[1] !== onItemClick) {
|
|
103
|
+
t1 = () => onItemClick(item);
|
|
104
|
+
$[0] = item;
|
|
105
|
+
$[1] = onItemClick;
|
|
106
|
+
$[2] = t1;
|
|
107
|
+
} else t1 = $[2];
|
|
108
|
+
const handleClick = t1;
|
|
109
|
+
let t2;
|
|
110
|
+
if ($[3] !== item.disabled || $[4] !== navigableIndex || $[5] !== onItemEnter) {
|
|
111
|
+
t2 = () => {
|
|
112
|
+
if (navigableIndex !== -1 && !item.disabled) onItemEnter(navigableIndex);
|
|
113
|
+
};
|
|
114
|
+
$[3] = item.disabled;
|
|
115
|
+
$[4] = navigableIndex;
|
|
116
|
+
$[5] = onItemEnter;
|
|
117
|
+
$[6] = t2;
|
|
118
|
+
} else t2 = $[6];
|
|
119
|
+
const handleMouseEnter = t2;
|
|
120
|
+
if (item.action === "separator") {
|
|
121
|
+
let t3;
|
|
122
|
+
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
123
|
+
t3 = /* @__PURE__ */ jsx("div", {
|
|
124
|
+
className: "docx-text-context-menu-separator",
|
|
125
|
+
style: {
|
|
126
|
+
height: "1px",
|
|
127
|
+
backgroundColor: "var(--border, var(--doc-border, #e5e7eb))",
|
|
128
|
+
margin: "4px 12px"
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
$[7] = t3;
|
|
132
|
+
} else t3 = $[7];
|
|
133
|
+
return t3;
|
|
134
|
+
}
|
|
135
|
+
const t3 = `docx-text-context-menu-item ${isHighlighted ? "docx-text-context-menu-item-highlighted" : ""} ${item.disabled ? "docx-text-context-menu-item-disabled" : ""}`;
|
|
136
|
+
const t4 = item.disabled;
|
|
137
|
+
const t5 = item.disabled;
|
|
138
|
+
const t6 = isHighlighted && !item.disabled ? "var(--accent, var(--doc-primary-light, #f3f4f6))" : "transparent";
|
|
139
|
+
const t7 = item.disabled ? "not-allowed" : "pointer";
|
|
140
|
+
let t8;
|
|
141
|
+
if ($[8] !== item) {
|
|
142
|
+
t8 = itemTextColor(item);
|
|
143
|
+
$[8] = item;
|
|
144
|
+
$[9] = t8;
|
|
145
|
+
} else t8 = $[9];
|
|
146
|
+
const t9 = item.emphasis ? 500 : 400;
|
|
147
|
+
const t10 = item.disabled ? .6 : 1;
|
|
148
|
+
let t11;
|
|
149
|
+
if ($[10] !== t10 || $[11] !== t6 || $[12] !== t7 || $[13] !== t8 || $[14] !== t9) {
|
|
150
|
+
t11 = {
|
|
115
151
|
display: "flex",
|
|
116
152
|
alignItems: "center",
|
|
117
153
|
gap: "10px",
|
|
118
154
|
width: "100%",
|
|
119
155
|
padding: "8px 12px",
|
|
120
156
|
border: "none",
|
|
121
|
-
background:
|
|
122
|
-
cursor:
|
|
157
|
+
background: t6,
|
|
158
|
+
cursor: t7,
|
|
123
159
|
fontSize: "13px",
|
|
124
|
-
color:
|
|
125
|
-
fontWeight:
|
|
160
|
+
color: t8,
|
|
161
|
+
fontWeight: t9,
|
|
126
162
|
textAlign: "left",
|
|
127
|
-
opacity:
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
]
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
}
|
|
163
|
+
opacity: t10
|
|
164
|
+
};
|
|
165
|
+
$[10] = t10;
|
|
166
|
+
$[11] = t6;
|
|
167
|
+
$[12] = t7;
|
|
168
|
+
$[13] = t8;
|
|
169
|
+
$[14] = t9;
|
|
170
|
+
$[15] = t11;
|
|
171
|
+
} else t11 = $[15];
|
|
172
|
+
let t12;
|
|
173
|
+
if ($[16] !== item) {
|
|
174
|
+
t12 = itemIconColor(item);
|
|
175
|
+
$[16] = item;
|
|
176
|
+
$[17] = t12;
|
|
177
|
+
} else t12 = $[17];
|
|
178
|
+
let t13;
|
|
179
|
+
if ($[18] !== t12) {
|
|
180
|
+
t13 = {
|
|
181
|
+
display: "flex",
|
|
182
|
+
color: t12
|
|
183
|
+
};
|
|
184
|
+
$[18] = t12;
|
|
185
|
+
$[19] = t13;
|
|
186
|
+
} else t13 = $[19];
|
|
187
|
+
let t14;
|
|
188
|
+
if ($[20] !== item.action || $[21] !== item.icon) {
|
|
189
|
+
t14 = item.icon ?? getActionIcon(item.action);
|
|
190
|
+
$[20] = item.action;
|
|
191
|
+
$[21] = item.icon;
|
|
192
|
+
$[22] = t14;
|
|
193
|
+
} else t14 = $[22];
|
|
194
|
+
let t15;
|
|
195
|
+
if ($[23] !== t13 || $[24] !== t14) {
|
|
196
|
+
t15 = /* @__PURE__ */ jsx("span", {
|
|
197
|
+
style: t13,
|
|
198
|
+
children: t14
|
|
199
|
+
});
|
|
200
|
+
$[23] = t13;
|
|
201
|
+
$[24] = t14;
|
|
202
|
+
$[25] = t15;
|
|
203
|
+
} else t15 = $[25];
|
|
204
|
+
let t16;
|
|
205
|
+
if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
|
|
206
|
+
t16 = { flex: 1 };
|
|
207
|
+
$[26] = t16;
|
|
208
|
+
} else t16 = $[26];
|
|
209
|
+
let t17;
|
|
210
|
+
if ($[27] !== item.label) {
|
|
211
|
+
t17 = /* @__PURE__ */ jsx("span", {
|
|
212
|
+
style: t16,
|
|
213
|
+
children: item.label
|
|
214
|
+
});
|
|
215
|
+
$[27] = item.label;
|
|
216
|
+
$[28] = t17;
|
|
217
|
+
} else t17 = $[28];
|
|
218
|
+
let t18;
|
|
219
|
+
if ($[29] !== item.shortcut) {
|
|
220
|
+
t18 = item.shortcut && /* @__PURE__ */ jsx("span", {
|
|
221
|
+
style: {
|
|
222
|
+
fontSize: "11px",
|
|
223
|
+
color: "var(--muted-foreground, var(--doc-text-subtle, #737373))",
|
|
224
|
+
fontFamily: "monospace"
|
|
225
|
+
},
|
|
226
|
+
children: item.shortcut
|
|
227
|
+
});
|
|
228
|
+
$[29] = item.shortcut;
|
|
229
|
+
$[30] = t18;
|
|
230
|
+
} else t18 = $[30];
|
|
231
|
+
let t19;
|
|
232
|
+
if ($[31] !== handleClick || $[32] !== handleMouseEnter || $[33] !== item.disabled || $[34] !== t11 || $[35] !== t15 || $[36] !== t17 || $[37] !== t18 || $[38] !== t3) {
|
|
233
|
+
t19 = /* @__PURE__ */ jsxs("button", {
|
|
234
|
+
type: "button",
|
|
235
|
+
className: t3,
|
|
236
|
+
onClick: handleClick,
|
|
237
|
+
onMouseEnter: handleMouseEnter,
|
|
238
|
+
disabled: t4,
|
|
239
|
+
role: "menuitem",
|
|
240
|
+
"aria-disabled": t5,
|
|
241
|
+
style: t11,
|
|
242
|
+
children: [
|
|
243
|
+
t15,
|
|
244
|
+
t17,
|
|
245
|
+
t18
|
|
246
|
+
]
|
|
247
|
+
});
|
|
248
|
+
$[31] = handleClick;
|
|
249
|
+
$[32] = handleMouseEnter;
|
|
250
|
+
$[33] = item.disabled;
|
|
251
|
+
$[34] = t11;
|
|
252
|
+
$[35] = t15;
|
|
253
|
+
$[36] = t17;
|
|
254
|
+
$[37] = t18;
|
|
255
|
+
$[38] = t3;
|
|
256
|
+
$[39] = t19;
|
|
257
|
+
} else t19 = $[39];
|
|
258
|
+
let t20;
|
|
259
|
+
if ($[40] !== item.dividerAfter) {
|
|
260
|
+
t20 = item.dividerAfter && /* @__PURE__ */ jsx("div", {
|
|
261
|
+
className: "docx-text-context-menu-separator",
|
|
262
|
+
style: {
|
|
263
|
+
height: "1px",
|
|
264
|
+
backgroundColor: "var(--border, var(--doc-border, #e5e7eb))",
|
|
265
|
+
margin: "4px 12px"
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
$[40] = item.dividerAfter;
|
|
269
|
+
$[41] = t20;
|
|
270
|
+
} else t20 = $[41];
|
|
271
|
+
let t21;
|
|
272
|
+
if ($[42] !== t19 || $[43] !== t20) {
|
|
273
|
+
t21 = /* @__PURE__ */ jsxs(Fragment, { children: [t19, t20] });
|
|
274
|
+
$[42] = t19;
|
|
275
|
+
$[43] = t20;
|
|
276
|
+
$[44] = t21;
|
|
277
|
+
} else t21 = $[44];
|
|
278
|
+
return t21;
|
|
158
279
|
};
|
|
159
280
|
const TextContextMenu = ({ isOpen, position, hasSelection, isEditable, hasClipboardContent = true, onAction, onClose, items, className = "" }) => {
|
|
160
281
|
const menuRef = useRef(null);
|
|
@@ -193,7 +314,7 @@ const TextContextMenu = ({ isOpen, position, hasSelection, isEditable, hasClipbo
|
|
|
193
314
|
if (item.dividerAfter !== void 0) menuItem.dividerAfter = item.dividerAfter;
|
|
194
315
|
return menuItem;
|
|
195
316
|
});
|
|
196
|
-
const navigableItems = menuItems.filter((
|
|
317
|
+
const navigableItems = menuItems.filter((item_0) => item_0.action !== "separator");
|
|
197
318
|
useEffect(() => {
|
|
198
319
|
if (!isOpen) return;
|
|
199
320
|
const handleClickOutside = (e) => {
|
|
@@ -209,22 +330,22 @@ const TextContextMenu = ({ isOpen, position, hasSelection, isEditable, hasClipbo
|
|
|
209
330
|
}, [isOpen, onClose]);
|
|
210
331
|
useEffect(() => {
|
|
211
332
|
if (!isOpen) return;
|
|
212
|
-
const handleKeyDown = (
|
|
213
|
-
switch (
|
|
333
|
+
const handleKeyDown = (e_0) => {
|
|
334
|
+
switch (e_0.key) {
|
|
214
335
|
case "Escape":
|
|
215
|
-
|
|
336
|
+
e_0.preventDefault();
|
|
216
337
|
onClose();
|
|
217
338
|
break;
|
|
218
339
|
case "ArrowDown":
|
|
219
|
-
|
|
220
|
-
setHighlightedIndex((
|
|
221
|
-
let
|
|
222
|
-
while (navigableItems[
|
|
223
|
-
return
|
|
340
|
+
e_0.preventDefault();
|
|
341
|
+
setHighlightedIndex((prev_0) => {
|
|
342
|
+
let next_0 = (prev_0 + 1) % navigableItems.length;
|
|
343
|
+
while (navigableItems[next_0]?.disabled && next_0 !== prev_0) next_0 = (next_0 + 1) % navigableItems.length;
|
|
344
|
+
return next_0;
|
|
224
345
|
});
|
|
225
346
|
break;
|
|
226
347
|
case "ArrowUp":
|
|
227
|
-
|
|
348
|
+
e_0.preventDefault();
|
|
228
349
|
setHighlightedIndex((prev) => {
|
|
229
350
|
let next = (prev - 1 + navigableItems.length) % navigableItems.length;
|
|
230
351
|
while (navigableItems[next]?.disabled && next !== prev) next = (next - 1 + navigableItems.length) % navigableItems.length;
|
|
@@ -232,10 +353,10 @@ const TextContextMenu = ({ isOpen, position, hasSelection, isEditable, hasClipbo
|
|
|
232
353
|
});
|
|
233
354
|
break;
|
|
234
355
|
case "Enter": {
|
|
235
|
-
|
|
236
|
-
const
|
|
237
|
-
if (
|
|
238
|
-
onAction(
|
|
356
|
+
e_0.preventDefault();
|
|
357
|
+
const item_1 = navigableItems[highlightedIndex];
|
|
358
|
+
if (item_1 && !item_1.disabled) {
|
|
359
|
+
onAction(item_1.action);
|
|
239
360
|
onClose();
|
|
240
361
|
}
|
|
241
362
|
break;
|
|
@@ -282,11 +403,11 @@ const TextContextMenu = ({ isOpen, position, hasSelection, isEditable, hasClipbo
|
|
|
282
403
|
position,
|
|
283
404
|
menuItems.length
|
|
284
405
|
]);
|
|
285
|
-
const handleItemClick = (
|
|
286
|
-
if (
|
|
287
|
-
onAction(
|
|
406
|
+
const handleItemClick = useCallback((item_2) => {
|
|
407
|
+
if (item_2.disabled) return;
|
|
408
|
+
onAction(item_2.action);
|
|
288
409
|
onClose();
|
|
289
|
-
};
|
|
410
|
+
}, [onAction, onClose]);
|
|
290
411
|
if (!isOpen) return null;
|
|
291
412
|
const menu = /* @__PURE__ */ jsx("div", {
|
|
292
413
|
ref: menuRef,
|
|
@@ -294,16 +415,15 @@ const TextContextMenu = ({ isOpen, position, hasSelection, isEditable, hasClipbo
|
|
|
294
415
|
style: getMenuStyle(),
|
|
295
416
|
role: "menu",
|
|
296
417
|
"aria-label": "Text editing menu",
|
|
297
|
-
children: menuItems.map((
|
|
298
|
-
const navigableIndex = navigableItems.indexOf(
|
|
418
|
+
children: menuItems.map((item_3, index) => {
|
|
419
|
+
const navigableIndex = navigableItems.indexOf(item_3);
|
|
299
420
|
return /* @__PURE__ */ jsx(MenuItemComponent, {
|
|
300
|
-
item,
|
|
301
|
-
onClick: () => handleItemClick(item),
|
|
421
|
+
item: item_3,
|
|
302
422
|
isHighlighted: navigableIndex === highlightedIndex,
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
}, `${
|
|
423
|
+
navigableIndex,
|
|
424
|
+
onItemClick: handleItemClick,
|
|
425
|
+
onItemEnter: setHighlightedIndex
|
|
426
|
+
}, `${item_3.action}-${index}`);
|
|
307
427
|
})
|
|
308
428
|
});
|
|
309
429
|
if (typeof document === "undefined") return menu;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as DocxEditorRef, i as renderAsync, n as EditorHandle, r as RenderAsyncOptions, s as DocxEditorProps, t as DocxEditorHandle } from "../renderAsync-ChQI9UJG.js";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
3
|
import { CreateEmptyDocumentOptions, createDocumentWithText, createEmptyDocument } from "@stll/folio-core/utils/createDocument";
|
|
4
4
|
|