@stll/folio-react 0.6.0 → 0.8.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 (30) hide show
  1. package/dist/{CommentsSidebar-_utmEkA9.js → CommentsSidebar-Byn5lyrt.js} +127 -130
  2. package/dist/{FindReplaceDialog-DLdBekSR.js → FindReplaceDialog-CqKK82nE.js} +23 -18
  3. package/dist/FootnotePropertiesDialog-CixRdIiT.js +822 -0
  4. package/dist/ImagePositionDialog-DNodkoI2.js +1065 -0
  5. package/dist/ImagePropertiesDialog-CLsDIUWb.js +613 -0
  6. package/dist/InsertSymbolDialog-DCFLmfzn.js +376 -0
  7. package/dist/PageSetupDialog-COkgeOQn.js +820 -0
  8. package/dist/TablePropertiesDialog-B_AGrPR8.js +434 -0
  9. package/dist/{TextContextMenu-CG0V37wi.js → TextContextMenu-Ci7-M4oU.js} +199 -79
  10. package/dist/compat/eigenpal.d.ts +1 -1
  11. package/dist/compat/eigenpal.js +89 -17
  12. package/dist/dialogChrome-BoGYPgeu.js +26 -0
  13. package/dist/{dialogs-CzvXYJyG.js → dialogs-Bj2PdycR.js} +608 -352
  14. package/dist/{dialogs-j7qyw17x.d.ts → dialogs-DK8OVUT_.d.ts} +13 -1
  15. package/dist/dialogs.d.ts +2 -2
  16. package/dist/dialogs.js +9 -8
  17. package/dist/editor.css +1 -1
  18. package/dist/folio-ui-BgDDRsUX.js +1013 -0
  19. package/dist/index.d.ts +5 -4
  20. package/dist/index.js +12 -11
  21. package/dist/{renderAsync-B7UJsZye.d.ts → renderAsync-BmxQE7iO.d.ts} +12 -3
  22. package/dist/{renderAsync-CwHTsxBN.js → renderAsync-BtWYvQMT.js} +5717 -3275
  23. package/dist/standalone.css +1 -1
  24. package/package.json +8 -6
  25. package/dist/FootnotePropertiesDialog-CUjq9c6H.js +0 -267
  26. package/dist/ImagePositionDialog-BMuO9rLT.js +0 -395
  27. package/dist/ImagePropertiesDialog-C8iEgdmN.js +0 -198
  28. package/dist/PageSetupDialog-BKsSMCGb.js +0 -312
  29. package/dist/TablePropertiesDialog-Dw8gvL78.js +0 -159
  30. package/dist/useFindReplace-BPBpMWS9.js +0 -842
@@ -0,0 +1,376 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-BBjsoOtd.js";
2
+ import { r as useFolioUI } from "./folio-ui-BgDDRsUX.js";
3
+ import { c as DIALOG_SECONDARY_BUTTON_CLASS, i as DIALOG_INPUT_CLASS, l as DIALOG_TITLE_CLASS, n as DIALOG_BODY_CLASS, o as DIALOG_POPUP_CLASS, r as DIALOG_FOOTER_CLASS, s as DIALOG_PRIMARY_BUTTON_CLASS, t as DIALOG_BACKDROP_CLASS, u as useCloseOnDialogOpenChange } from "./dialogChrome-BoGYPgeu.js";
4
+ import { c } from "react-compiler-runtime";
5
+ import { useState } from "react";
6
+ import { useTranslations } from "use-intl";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ import { SYMBOL_CATEGORIES, filterSymbols } from "@stll/folio-core/symbols";
9
+ //#region src/components/dialogs/InsertSymbolDialog.tsx
10
+ var InsertSymbolDialog_exports = /* @__PURE__ */ __exportAll({ InsertSymbolDialog: () => InsertSymbolDialog });
11
+ const RECENT_LIMIT = 10;
12
+ /** Format a character as its `U+XXXX` code point label. */
13
+ function codePointLabel(char) {
14
+ return `U+${(char.codePointAt(0) ?? 0).toString(16).toUpperCase().padStart(4, "0")}`;
15
+ }
16
+ function InsertSymbolDialog(t0) {
17
+ const $ = c(108);
18
+ const { isOpen, onClose, onInsert } = t0;
19
+ const { Root: Dialog, Portal: DialogPortal, Backdrop: DialogBackdrop, Popup: DialogPopup, Title: DialogTitle } = useFolioUI().Dialog;
20
+ const handleOpenChange = useCloseOnDialogOpenChange(onClose);
21
+ const t = useTranslations("folio");
22
+ const [search, setSearch] = useState("");
23
+ const [activeCategory, setActiveCategory] = useState("Common");
24
+ const [selectedSymbol, setSelectedSymbol] = useState("");
25
+ let t1;
26
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
27
+ t1 = [];
28
+ $[0] = t1;
29
+ } else t1 = $[0];
30
+ const [recentSymbols, setRecentSymbols] = useState(t1);
31
+ let T0;
32
+ let T1;
33
+ let T2;
34
+ let activeSymbols;
35
+ let insertSymbol;
36
+ let t10;
37
+ let t11;
38
+ let t2;
39
+ let t3;
40
+ let t4;
41
+ let t5;
42
+ let t6;
43
+ let t7;
44
+ let t8;
45
+ let t9;
46
+ if ($[1] !== Dialog || $[2] !== DialogBackdrop || $[3] !== DialogPopup || $[4] !== DialogPortal || $[5] !== DialogTitle || $[6] !== activeCategory || $[7] !== handleOpenChange || $[8] !== isOpen || $[9] !== onClose || $[10] !== onInsert || $[11] !== search || $[12] !== selectedSymbol || $[13] !== t) {
47
+ activeSymbols = search ? filterSymbols(search) : SYMBOL_CATEGORIES.find((category) => category.name === activeCategory)?.symbols.map((symbol) => Object.assign({}, symbol, { category: activeCategory })) ?? [];
48
+ let t12;
49
+ if ($[29] !== onInsert) {
50
+ t12 = (symbol_0) => {
51
+ if (!symbol_0) return;
52
+ setRecentSymbols((prev) => [symbol_0, ...prev.filter((s) => s !== symbol_0)].slice(0, RECENT_LIMIT));
53
+ onInsert(symbol_0);
54
+ };
55
+ $[29] = onInsert;
56
+ $[30] = t12;
57
+ } else t12 = $[30];
58
+ insertSymbol = t12;
59
+ T2 = Dialog;
60
+ t10 = isOpen;
61
+ t11 = handleOpenChange;
62
+ T1 = DialogPortal;
63
+ if ($[31] !== DialogBackdrop) {
64
+ t9 = /* @__PURE__ */ jsx(DialogBackdrop, { className: DIALOG_BACKDROP_CLASS });
65
+ $[31] = DialogBackdrop;
66
+ $[32] = t9;
67
+ } else t9 = $[32];
68
+ T0 = DialogPopup;
69
+ t7 = DIALOG_POPUP_CLASS;
70
+ let t13;
71
+ if ($[33] !== t) {
72
+ t13 = t("dialogs.insertSymbol.title");
73
+ $[33] = t;
74
+ $[34] = t13;
75
+ } else t13 = $[34];
76
+ if ($[35] !== DialogTitle || $[36] !== t13) {
77
+ t8 = /* @__PURE__ */ jsx(DialogTitle, {
78
+ className: DIALOG_TITLE_CLASS,
79
+ children: t13
80
+ });
81
+ $[35] = DialogTitle;
82
+ $[36] = t13;
83
+ $[37] = t8;
84
+ } else t8 = $[37];
85
+ t4 = DIALOG_BODY_CLASS;
86
+ let t14;
87
+ if ($[38] === Symbol.for("react.memo_cache_sentinel")) {
88
+ t14 = (event) => setSearch(event.target.value);
89
+ $[38] = t14;
90
+ } else t14 = $[38];
91
+ let t15;
92
+ if ($[39] !== onClose) {
93
+ t15 = (event_0) => {
94
+ if (event_0.key === "Escape") onClose();
95
+ };
96
+ $[39] = onClose;
97
+ $[40] = t15;
98
+ } else t15 = $[40];
99
+ let t16;
100
+ if ($[41] !== t) {
101
+ t16 = t("dialogs.insertSymbol.searchPlaceholder");
102
+ $[41] = t;
103
+ $[42] = t16;
104
+ } else t16 = $[42];
105
+ if ($[43] !== search || $[44] !== t15 || $[45] !== t16) {
106
+ t5 = /* @__PURE__ */ jsx("input", {
107
+ autoFocus: true,
108
+ value: search,
109
+ onChange: t14,
110
+ onKeyDown: t15,
111
+ placeholder: t16,
112
+ className: `${DIALOG_INPUT_CLASS} focus:border-primary w-full`
113
+ });
114
+ $[43] = search;
115
+ $[44] = t15;
116
+ $[45] = t16;
117
+ $[46] = t5;
118
+ } else t5 = $[46];
119
+ if ($[47] !== activeCategory || $[48] !== search || $[49] !== t) {
120
+ t6 = !search && /* @__PURE__ */ jsx("div", {
121
+ className: "flex flex-wrap gap-0.5",
122
+ children: SYMBOL_CATEGORIES.map((category_0) => {
123
+ return /* @__PURE__ */ jsx("button", {
124
+ type: "button",
125
+ onClick: () => setActiveCategory(category_0.name),
126
+ className: `rounded px-2 py-1 text-[11px] ${activeCategory === category_0.name ? "bg-accent text-accent-foreground font-semibold" : "text-muted-foreground hover:bg-muted"}`,
127
+ children: t(category_0.nameKey)
128
+ }, category_0.name);
129
+ })
130
+ });
131
+ $[47] = activeCategory;
132
+ $[48] = search;
133
+ $[49] = t;
134
+ $[50] = t6;
135
+ } else t6 = $[50];
136
+ t2 = "grid max-h-60 grid-cols-[repeat(auto-fill,minmax(2.25rem,1fr))] gap-0.5 overflow-y-auto rounded border p-1";
137
+ let t17;
138
+ if ($[51] !== insertSymbol || $[52] !== selectedSymbol) {
139
+ t17 = (symbol_1) => {
140
+ const selected = selectedSymbol === symbol_1.char;
141
+ return /* @__PURE__ */ jsx("button", {
142
+ type: "button",
143
+ title: symbol_1.name,
144
+ onClick: () => setSelectedSymbol(symbol_1.char),
145
+ onDoubleClick: () => insertSymbol(symbol_1.char),
146
+ className: `flex h-9 w-9 items-center justify-center rounded border text-lg ${selected ? "border-primary bg-primary/20" : "hover:bg-muted border-transparent"}`,
147
+ children: symbol_1.char
148
+ }, symbol_1.char);
149
+ };
150
+ $[51] = insertSymbol;
151
+ $[52] = selectedSymbol;
152
+ $[53] = t17;
153
+ } else t17 = $[53];
154
+ t3 = activeSymbols.map(t17);
155
+ $[1] = Dialog;
156
+ $[2] = DialogBackdrop;
157
+ $[3] = DialogPopup;
158
+ $[4] = DialogPortal;
159
+ $[5] = DialogTitle;
160
+ $[6] = activeCategory;
161
+ $[7] = handleOpenChange;
162
+ $[8] = isOpen;
163
+ $[9] = onClose;
164
+ $[10] = onInsert;
165
+ $[11] = search;
166
+ $[12] = selectedSymbol;
167
+ $[13] = t;
168
+ $[14] = T0;
169
+ $[15] = T1;
170
+ $[16] = T2;
171
+ $[17] = activeSymbols;
172
+ $[18] = insertSymbol;
173
+ $[19] = t10;
174
+ $[20] = t11;
175
+ $[21] = t2;
176
+ $[22] = t3;
177
+ $[23] = t4;
178
+ $[24] = t5;
179
+ $[25] = t6;
180
+ $[26] = t7;
181
+ $[27] = t8;
182
+ $[28] = t9;
183
+ } else {
184
+ T0 = $[14];
185
+ T1 = $[15];
186
+ T2 = $[16];
187
+ activeSymbols = $[17];
188
+ insertSymbol = $[18];
189
+ t10 = $[19];
190
+ t11 = $[20];
191
+ t2 = $[21];
192
+ t3 = $[22];
193
+ t4 = $[23];
194
+ t5 = $[24];
195
+ t6 = $[25];
196
+ t7 = $[26];
197
+ t8 = $[27];
198
+ t9 = $[28];
199
+ }
200
+ let t12;
201
+ if ($[54] !== activeSymbols.length || $[55] !== search || $[56] !== t) {
202
+ t12 = activeSymbols.length === 0 && /* @__PURE__ */ jsx("div", {
203
+ className: "text-muted-foreground col-span-full p-6 text-center text-[13px]",
204
+ children: search ? t("dialogs.insertSymbol.noResults", { query: search }) : t("dialogs.insertSymbol.noResultsEmpty")
205
+ });
206
+ $[54] = activeSymbols.length;
207
+ $[55] = search;
208
+ $[56] = t;
209
+ $[57] = t12;
210
+ } else t12 = $[57];
211
+ let t13;
212
+ if ($[58] !== t12 || $[59] !== t2 || $[60] !== t3) {
213
+ t13 = /* @__PURE__ */ jsxs("div", {
214
+ className: t2,
215
+ children: [t3, t12]
216
+ });
217
+ $[58] = t12;
218
+ $[59] = t2;
219
+ $[60] = t3;
220
+ $[61] = t13;
221
+ } else t13 = $[61];
222
+ let t14;
223
+ if ($[62] !== selectedSymbol) {
224
+ t14 = selectedSymbol && /* @__PURE__ */ jsxs("div", {
225
+ className: "bg-muted flex items-center gap-3 rounded px-3 py-2",
226
+ children: [/* @__PURE__ */ jsx("span", {
227
+ className: "text-3xl leading-none",
228
+ children: selectedSymbol
229
+ }), /* @__PURE__ */ jsx("span", {
230
+ className: "text-muted-foreground font-mono text-xs",
231
+ children: codePointLabel(selectedSymbol)
232
+ })]
233
+ });
234
+ $[62] = selectedSymbol;
235
+ $[63] = t14;
236
+ } else t14 = $[63];
237
+ let t15;
238
+ if ($[64] !== insertSymbol || $[65] !== recentSymbols || $[66] !== search || $[67] !== t) {
239
+ t15 = recentSymbols.length > 0 && !search && /* @__PURE__ */ jsxs("div", {
240
+ className: "flex flex-wrap items-center gap-1",
241
+ children: [/* @__PURE__ */ jsx("span", {
242
+ className: "text-muted-foreground mr-1 text-[11px]",
243
+ children: t("dialogs.insertSymbol.recent")
244
+ }), recentSymbols.map((symbol_2) => /* @__PURE__ */ jsx("button", {
245
+ type: "button",
246
+ title: codePointLabel(symbol_2),
247
+ onClick: () => setSelectedSymbol(symbol_2),
248
+ onDoubleClick: () => insertSymbol(symbol_2),
249
+ className: "hover:bg-muted flex h-7 w-7 items-center justify-center rounded border border-transparent text-sm",
250
+ children: symbol_2
251
+ }, symbol_2))]
252
+ });
253
+ $[64] = insertSymbol;
254
+ $[65] = recentSymbols;
255
+ $[66] = search;
256
+ $[67] = t;
257
+ $[68] = t15;
258
+ } else t15 = $[68];
259
+ let t16;
260
+ if ($[69] !== t13 || $[70] !== t14 || $[71] !== t15 || $[72] !== t4 || $[73] !== t5 || $[74] !== t6) {
261
+ t16 = /* @__PURE__ */ jsxs("div", {
262
+ className: t4,
263
+ children: [
264
+ t5,
265
+ t6,
266
+ t13,
267
+ t14,
268
+ t15
269
+ ]
270
+ });
271
+ $[69] = t13;
272
+ $[70] = t14;
273
+ $[71] = t15;
274
+ $[72] = t4;
275
+ $[73] = t5;
276
+ $[74] = t6;
277
+ $[75] = t16;
278
+ } else t16 = $[75];
279
+ let t17;
280
+ if ($[76] !== t) {
281
+ t17 = t("common.cancel");
282
+ $[76] = t;
283
+ $[77] = t17;
284
+ } else t17 = $[77];
285
+ let t18;
286
+ if ($[78] !== onClose || $[79] !== t17) {
287
+ t18 = /* @__PURE__ */ jsx("button", {
288
+ type: "button",
289
+ className: DIALOG_SECONDARY_BUTTON_CLASS,
290
+ onClick: onClose,
291
+ children: t17
292
+ });
293
+ $[78] = onClose;
294
+ $[79] = t17;
295
+ $[80] = t18;
296
+ } else t18 = $[80];
297
+ const t19 = !selectedSymbol;
298
+ let t20;
299
+ if ($[81] !== insertSymbol || $[82] !== selectedSymbol) {
300
+ t20 = () => insertSymbol(selectedSymbol);
301
+ $[81] = insertSymbol;
302
+ $[82] = selectedSymbol;
303
+ $[83] = t20;
304
+ } else t20 = $[83];
305
+ let t21;
306
+ if ($[84] !== t) {
307
+ t21 = t("common.insert");
308
+ $[84] = t;
309
+ $[85] = t21;
310
+ } else t21 = $[85];
311
+ let t22;
312
+ if ($[86] !== t19 || $[87] !== t20 || $[88] !== t21) {
313
+ t22 = /* @__PURE__ */ jsx("button", {
314
+ type: "button",
315
+ className: DIALOG_PRIMARY_BUTTON_CLASS,
316
+ disabled: t19,
317
+ onClick: t20,
318
+ children: t21
319
+ });
320
+ $[86] = t19;
321
+ $[87] = t20;
322
+ $[88] = t21;
323
+ $[89] = t22;
324
+ } else t22 = $[89];
325
+ let t23;
326
+ if ($[90] !== t18 || $[91] !== t22) {
327
+ t23 = /* @__PURE__ */ jsxs("div", {
328
+ className: DIALOG_FOOTER_CLASS,
329
+ children: [t18, t22]
330
+ });
331
+ $[90] = t18;
332
+ $[91] = t22;
333
+ $[92] = t23;
334
+ } else t23 = $[92];
335
+ let t24;
336
+ if ($[93] !== T0 || $[94] !== t16 || $[95] !== t23 || $[96] !== t7 || $[97] !== t8) {
337
+ t24 = /* @__PURE__ */ jsxs(T0, {
338
+ className: t7,
339
+ children: [
340
+ t8,
341
+ t16,
342
+ t23
343
+ ]
344
+ });
345
+ $[93] = T0;
346
+ $[94] = t16;
347
+ $[95] = t23;
348
+ $[96] = t7;
349
+ $[97] = t8;
350
+ $[98] = t24;
351
+ } else t24 = $[98];
352
+ let t25;
353
+ if ($[99] !== T1 || $[100] !== t24 || $[101] !== t9) {
354
+ t25 = /* @__PURE__ */ jsxs(T1, { children: [t9, t24] });
355
+ $[99] = T1;
356
+ $[100] = t24;
357
+ $[101] = t9;
358
+ $[102] = t25;
359
+ } else t25 = $[102];
360
+ let t26;
361
+ if ($[103] !== T2 || $[104] !== t10 || $[105] !== t11 || $[106] !== t25) {
362
+ t26 = /* @__PURE__ */ jsx(T2, {
363
+ open: t10,
364
+ onOpenChange: t11,
365
+ children: t25
366
+ });
367
+ $[103] = T2;
368
+ $[104] = t10;
369
+ $[105] = t11;
370
+ $[106] = t25;
371
+ $[107] = t26;
372
+ } else t26 = $[107];
373
+ return t26;
374
+ }
375
+ //#endregion
376
+ export { InsertSymbolDialog_exports as n, InsertSymbolDialog as t };