@levo-so/site-runtime 0.3.8 → 0.3.10

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 (33) hide show
  1. package/{DateTimeWidget-hFjcn3o6.js → DateTimeWidget-U3lD0q1q.js} +1 -1
  2. package/{KBChatWidget-ClHFDgJ5.js → KBChatWidget-ByOwQQNg.js} +404 -397
  3. package/PopupBody-BI-MJqmd-DW3qWKam.js +159 -0
  4. package/PopupRenderer-D66Gx63H-BnOmWsyj.js +388 -0
  5. package/RichTextWidget-DfakML79.js +749 -0
  6. package/RteThemeProvider-BQmfSXSl.js +20 -0
  7. package/{nodeAlignment-BnJljFlw.js → content.cssm-XdMsTGIB.js} +24 -32
  8. package/{dist-CRDgdAkQ.js → dist-BdNHqoWi.js} +498 -466
  9. package/{dist-DPmVG7VB.js → dist-Cl_sKk9y.js} +3 -3
  10. package/index.d.ts +539 -9
  11. package/index.js +998 -798
  12. package/inlineRteTheme-CRPtkNXy.js +10 -0
  13. package/{kbChat-C00LVlxP.js → kbChat-GBcfFoss.js} +15 -15
  14. package/package.json +41 -27
  15. package/pillChrome-_hpGdrBS.js +50 -0
  16. package/popups.js +1 -1
  17. package/{PopupBody-DZVwDLkg-Cfy3lWGs.js → react-Cj_U6VZQ.js} +816 -850
  18. package/rich-text.d.ts +25 -0
  19. package/rich-text.js +1644 -0
  20. package/routes-CyKmkoRM.js +316 -0
  21. package/start.d.ts +38 -0
  22. package/start.js +19 -0
  23. package/styles.css +1 -1
  24. package/{usePopupRedirect-BThP_YPW-COUseDik.js → usePopupRedirect-CAAdcpaW-Ddjyf4KK.js} +15 -13
  25. package/PopupRenderer-BjW1jg70-W2y-PEPH.js +0 -387
  26. package/RichTextWidget-DkKHEq4j.js +0 -759
  27. package/pillChrome-BAu5AfCT.js +0 -30
  28. /package/{PhoneWidget-BmBO-kvA.js → PhoneWidget-DQQa4bL6.js} +0 -0
  29. /package/{Popover-3N88sRp4.js → Popover-C29yJ7rz.js} +0 -0
  30. /package/{es-CztjLuNy.js → es-ByBbirnH.js} +0 -0
  31. /package/{popupState-JmpeKzgM-qhNTV79U.js → popupState-JmpeKzgM-D_77LiAa.js} +0 -0
  32. /package/{react-CV3jf2mc.js → react-B9yvlbH0.js} +0 -0
  33. /package/{rteTheme.cssm-xg0gJ28J.js → rteTheme.cssm-W4gTOijw.js} +0 -0
@@ -1,759 +0,0 @@
1
- "use client";
2
- import { n as e, r as t, t as n } from "./CollectionField-C-6a1ud4.js";
3
- import { n as r, r as i } from "./ThemeProvider-DutrjSTF.js";
4
- import { i as a, n as o, r as s, t as c } from "./Tooltip-CQB0LyxK.js";
5
- import { t as l } from "./theme.cssm-DUzmx76l.js";
6
- import { n as u, r as d, t as f } from "./nodeAlignment-BnJljFlw.js";
7
- import { t as p } from "./rteTheme.cssm-xg0gJ28J.js";
8
- import { a as m, i as h, n as g, o as _, r as v } from "./Popover-3N88sRp4.js";
9
- import { useController as y } from "react-hook-form";
10
- import { c as b } from "react/compiler-runtime";
11
- import x from "clsx";
12
- import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
13
- import { forwardRef as T, useEffect as ee, useState as te } from "react";
14
- import { IconAlignCenter as ne, IconAlignJustified as re, IconAlignLeft as E, IconAlignRight as D, IconArrowBackUp as O, IconArrowForwardUp as k, IconBold as A, IconChevronDown as j, IconCode as M, IconCornerDownLeft as ie, IconExternalLink as ae, IconH1 as N, IconH2 as P, IconH3 as F, IconH4 as I, IconH5 as L, IconH6 as R, IconItalic as z, IconLink as oe, IconList as B, IconListNumbers as se, IconPencil as V, IconPilcrow as H, IconRotate2 as U, IconStrikethrough as W, IconSubscript as G, IconSuperscript as K, IconTrash as ce, IconUnderline as q } from "@tabler/icons-react";
15
- import { Subscript as J } from "@tiptap/extension-subscript";
16
- import { Superscript as Y } from "@tiptap/extension-superscript";
17
- import { Typography as X } from "@tiptap/extension-typography";
18
- import { UniqueID as Z } from "@tiptap/extension-unique-id";
19
- import { AllSelection as le, NodeSelection as ue, TextSelection as de } from "@tiptap/pm/state";
20
- import { Placeholder as fe, Selection as pe } from "@tiptap/extensions";
21
- import { StarterKit as me } from "@tiptap/starter-kit";
22
- import { EditorContent as he, EditorContext as ge, useCurrentEditor as _e, useEditor as ve, useEditorState as Q } from "@tiptap/react";
23
- //#region ../../libraries/editor-core/dist/theme/RteThemeProvider.js
24
- var ye = (e) => {
25
- let t = b(7), { children: n, theme: i } = e, a = i?.className, o;
26
- t[0] === a ? o = t[1] : (o = x(l, p, a), t[0] = a, t[1] = o);
27
- let s = i?.style, c = i?.portalToThemeRoot, u;
28
- return t[2] !== n || t[3] !== o || t[4] !== s || t[5] !== c ? (u = /* @__PURE__ */ C(r, {
29
- className: o,
30
- style: s,
31
- portalToThemeRoot: c,
32
- children: n
33
- }), t[2] = n, t[3] = o, t[4] = s, t[5] = c, t[6] = u) : u = t[6], u;
34
- }, be = (e = { placeholder: "Write something ..." }) => [
35
- me.configure({
36
- blockquote: !1,
37
- codeBlock: !1,
38
- horizontalRule: !1,
39
- dropcursor: { width: 2 },
40
- link: {
41
- openOnClick: !1,
42
- HTMLAttributes: { target: "_blank" }
43
- }
44
- }),
45
- fe.configure({ placeholder: e?.placeholder }),
46
- X,
47
- pe,
48
- Y,
49
- J,
50
- f,
51
- Z.configure({ types: [
52
- "paragraph",
53
- "heading",
54
- "bulletList",
55
- "orderedList"
56
- ] })
57
- ], xe = "_261ja30", Se = "_261ja31", $ = T((e, t) => {
58
- let n = b(27), r, a, l, u, d, f, p;
59
- n[0] === e ? (r = n[1], a = n[2], l = n[3], u = n[4], d = n[5], f = n[6], p = n[7]) : ({label: u, Icon: r, isActive: l, iconSize: f, trailing: p, className: a, ...d} = e, n[0] = e, n[1] = r, n[2] = a, n[3] = l, n[4] = u, n[5] = d, n[6] = f, n[7] = p);
60
- let m = f === void 0 ? 16 : f, h = l || void 0, g = l && "_1vaxhty0", _;
61
- n[8] !== a || n[9] !== g ? (_ = x(g, a), n[8] = a, n[9] = g, n[10] = _) : _ = n[10];
62
- let v;
63
- n[11] !== r || n[12] !== m ? (v = /* @__PURE__ */ C(r, { size: m }), n[11] = r, n[12] = m, n[13] = v) : v = n[13];
64
- let y;
65
- n[14] !== u || n[15] !== d || n[16] !== t || n[17] !== h || n[18] !== _ || n[19] !== v || n[20] !== p ? (y = /* @__PURE__ */ C(o, {
66
- onPointerDown: Ce,
67
- render: /* @__PURE__ */ w(i, {
68
- ref: t,
69
- type: "button",
70
- variant: "ghost",
71
- size: "sm",
72
- tabIndex: -1,
73
- "aria-label": u,
74
- "aria-pressed": h,
75
- className: _,
76
- ...d,
77
- children: [v, p]
78
- })
79
- }), n[14] = u, n[15] = d, n[16] = t, n[17] = h, n[18] = _, n[19] = v, n[20] = p, n[21] = y) : y = n[21];
80
- let S;
81
- n[22] === u ? S = n[23] : (S = /* @__PURE__ */ C(s, { children: u }), n[22] = u, n[23] = S);
82
- let T;
83
- return n[24] !== y || n[25] !== S ? (T = /* @__PURE__ */ w(c, { children: [y, S] }), n[24] = y, n[25] = S, n[26] = T) : T = n[26], T;
84
- });
85
- $.displayName = "ToolbarButton";
86
- function Ce(e) {
87
- return e.preventDefault();
88
- }
89
- //#endregion
90
- //#region ../../libraries/react-collection/dist/components/editor/utils.js
91
- var we = [
92
- "paragraph",
93
- "heading",
94
- "bulletList",
95
- "orderedList",
96
- "taskList",
97
- "codeBlock"
98
- ], Te = [
99
- "tableCell",
100
- "tableHeader",
101
- "quoteCaption",
102
- "detailsSummary"
103
- ], Ee = (e) => {
104
- if (!e) return !1;
105
- let { $from: t } = e.state.selection;
106
- for (let e = t.depth; e > 0; e--) if (Te.includes(t.node(e).type.name)) return !0;
107
- return !1;
108
- }, De = (e, t) => {
109
- if (!e || t.length === 0) return !1;
110
- let { selection: n } = e.state, r = new Set(t);
111
- if (n instanceof ue) {
112
- let e = n.node?.type?.name;
113
- return !!e && r.has(e);
114
- }
115
- if (n instanceof de || n instanceof le) {
116
- let t = !0;
117
- return e.state.doc.nodesBetween(n.from, n.to, (e) => e.isTextblock && !r.has(e.type.name) ? (t = !1, !1) : t), t;
118
- }
119
- return !1;
120
- }, Oe = /[\0-\x20\xA0\u1680\u180E\u2000-\u2029\u205F\u3000]/g, ke = [
121
- "http",
122
- "https",
123
- "ftp",
124
- "ftps",
125
- "mailto",
126
- "tel",
127
- "callto",
128
- "sms"
129
- ], Ae = (e, t) => {
130
- try {
131
- let n = new URL(e, t), r = n.href.replace(Oe, ""), i = RegExp(`^(?:(?:${ke.join("|")}):|[^a-z]|[a-z0-9+.\\-]+(?:[^a-z+.\\-:]|$))`, "i");
132
- if (r.match(i)) return n.href;
133
- } catch {}
134
- return "#";
135
- }, je = (e, t = []) => {
136
- let { tr: n } = e.state, { selection: r } = n;
137
- return r.empty ? !1 : (r.ranges.forEach((e) => {
138
- n.doc.nodesBetween(e.$from.pos, e.$to.pos, (e, r) => (e.isInline && e.marks.forEach((i) => {
139
- t.includes(i.type.name) || n.removeMark(r, r + e.nodeSize, i.type);
140
- }), !0));
141
- }), e.view.dispatch(n), e.commands.focus(), !0);
142
- }, Me = (e) => {
143
- let { selection: t } = e.state;
144
- if (t.empty) return !1;
145
- for (let n of t.ranges) {
146
- let t = !1;
147
- if (e.state.doc.nodesBetween(n.$from.pos, n.$to.pos, (e) => e.isInline && e.marks.length > 0 ? (t = !0, !1) : !0), t) return !0;
148
- }
149
- return !1;
150
- }, Ne = "j67x6z0", Pe = "j67x6z1", Fe = "_5pk5r80", Ie = (e) => {
151
- let t = b(50), { editor: n } = e, [r, i] = te(!1), { isActive: a, currentUrl: l } = Q({
152
- editor: n,
153
- selector: Le
154
- }) ?? {
155
- isActive: !1,
156
- currentUrl: ""
157
- }, [u, d] = te(l), f, p;
158
- t[0] !== l || t[1] !== r ? (f = () => {
159
- r && d(l);
160
- }, p = [r, l], t[0] = l, t[1] = r, t[2] = f, t[3] = p) : (f = t[2], p = t[3]), ee(f, p);
161
- let y;
162
- t[4] !== n || t[5] !== u ? (y = () => {
163
- u && (n.chain().focus().extendMarkRange("link").setLink({ href: u }).run(), i(!1));
164
- }, t[4] = n, t[5] = u, t[6] = y) : y = t[6];
165
- let x = y, S;
166
- t[7] === n ? S = t[8] : (S = () => {
167
- n.chain().focus().extendMarkRange("link").unsetLink().run(), d(""), i(!1);
168
- }, t[7] = n, t[8] = S);
169
- let T = S, ne;
170
- t[9] === u ? ne = t[10] : (ne = () => {
171
- let e = Ae(u, window.location.href);
172
- e !== "#" && window.open(e, "_blank", "noopener,noreferrer");
173
- }, t[9] = u, t[10] = ne);
174
- let re = ne, E;
175
- t[11] === Symbol.for("react.memo_cache_sentinel") ? (E = (e) => {
176
- e.preventDefault(), i(!0);
177
- }, t[11] = E) : E = t[11];
178
- let D;
179
- t[12] === a ? D = t[13] : (D = /* @__PURE__ */ C(_, {
180
- onPointerDown: Re,
181
- render: /* @__PURE__ */ C($, {
182
- label: "Link",
183
- Icon: oe,
184
- isActive: a,
185
- onClick: E
186
- })
187
- }), t[12] = a, t[13] = D);
188
- let O;
189
- t[14] === Symbol.for("react.memo_cache_sentinel") ? (O = (e) => d(e.target.value), t[14] = O) : O = t[14];
190
- let k;
191
- t[15] === x ? k = t[16] : (k = (e) => {
192
- e.key === "Enter" && (e.preventDefault(), x());
193
- }, t[15] = x, t[16] = k);
194
- let A;
195
- t[17] !== k || t[18] !== u ? (A = /* @__PURE__ */ C("input", {
196
- className: Pe,
197
- value: u,
198
- onChange: O,
199
- onKeyDown: k,
200
- placeholder: "Paste a link..."
201
- }), t[17] = k, t[18] = u, t[19] = A) : A = t[19];
202
- let j = !u && !a, M;
203
- t[20] === Symbol.for("react.memo_cache_sentinel") ? (M = /* @__PURE__ */ C(ie, { size: 16 }), t[20] = M) : M = t[20];
204
- let N;
205
- t[21] !== x || t[22] !== j ? (N = /* @__PURE__ */ C(o, { render: /* @__PURE__ */ C("button", {
206
- type: "button",
207
- className: Fe,
208
- onClick: x,
209
- disabled: j,
210
- "aria-label": "Apply link",
211
- children: M
212
- }) }), t[21] = x, t[22] = j, t[23] = N) : N = t[23];
213
- let P;
214
- t[24] === Symbol.for("react.memo_cache_sentinel") ? (P = /* @__PURE__ */ C(s, { children: "Apply link" }), t[24] = P) : P = t[24];
215
- let F;
216
- t[25] === N ? F = t[26] : (F = /* @__PURE__ */ w(c, { children: [N, P] }), t[25] = N, t[26] = F);
217
- let I = !u && !a, L;
218
- t[27] === Symbol.for("react.memo_cache_sentinel") ? (L = /* @__PURE__ */ C(ae, { size: 16 }), t[27] = L) : L = t[27];
219
- let R;
220
- t[28] !== re || t[29] !== I ? (R = /* @__PURE__ */ C(o, { render: /* @__PURE__ */ C("button", {
221
- type: "button",
222
- className: Fe,
223
- onClick: re,
224
- disabled: I,
225
- "aria-label": "Open in new window",
226
- children: L
227
- }) }), t[28] = re, t[29] = I, t[30] = R) : R = t[30];
228
- let z;
229
- t[31] === Symbol.for("react.memo_cache_sentinel") ? (z = /* @__PURE__ */ C(s, { children: "Open in new window" }), t[31] = z) : z = t[31];
230
- let B;
231
- t[32] === R ? B = t[33] : (B = /* @__PURE__ */ w(c, { children: [R, z] }), t[32] = R, t[33] = B);
232
- let se = !u && !a, V;
233
- t[34] === Symbol.for("react.memo_cache_sentinel") ? (V = /* @__PURE__ */ C(ce, { size: 16 }), t[34] = V) : V = t[34];
234
- let H;
235
- t[35] !== T || t[36] !== se ? (H = /* @__PURE__ */ C(o, { render: /* @__PURE__ */ C("button", {
236
- type: "button",
237
- className: Fe,
238
- onClick: T,
239
- disabled: se,
240
- "aria-label": "Remove link",
241
- children: V
242
- }) }), t[35] = T, t[36] = se, t[37] = H) : H = t[37];
243
- let U;
244
- t[38] === Symbol.for("react.memo_cache_sentinel") ? (U = /* @__PURE__ */ C(s, { children: "Remove link" }), t[38] = U) : U = t[38];
245
- let W;
246
- t[39] === H ? W = t[40] : (W = /* @__PURE__ */ w(c, { children: [H, U] }), t[39] = H, t[40] = W);
247
- let G;
248
- t[41] !== A || t[42] !== F || t[43] !== B || t[44] !== W ? (G = /* @__PURE__ */ C(h, { children: /* @__PURE__ */ C(v, {
249
- side: "bottom",
250
- align: "center",
251
- children: /* @__PURE__ */ w(m.Popup, {
252
- className: Ne,
253
- children: [
254
- A,
255
- F,
256
- B,
257
- W
258
- ]
259
- })
260
- }) }), t[41] = A, t[42] = F, t[43] = B, t[44] = W, t[45] = G) : G = t[45];
261
- let K;
262
- return t[46] !== r || t[47] !== G || t[48] !== D ? (K = /* @__PURE__ */ w(g, {
263
- open: r,
264
- onOpenChange: i,
265
- children: [D, G]
266
- }), t[46] = r, t[47] = G, t[48] = D, t[49] = K) : K = t[49], K;
267
- };
268
- function Le(e) {
269
- let { editor: t } = e;
270
- return {
271
- isActive: t.isActive("link"),
272
- currentUrl: t.getAttributes("link")?.href ?? ""
273
- };
274
- }
275
- function Re(e) {
276
- return e.preventDefault();
277
- }
278
- //#endregion
279
- //#region ../../libraries/react-collection/dist/components/editor/menus/TurnIntoMenu.cssm.js
280
- var ze = "_1keigwl0", Be = "_1keigwl1 _5pk5r80", Ve = (e) => (t) => t.chain().focus().setHeading({ level: e }).run(), He = [
281
- {
282
- type: "paragraph",
283
- label: "Text",
284
- Icon: H,
285
- isActive: (e) => e.isActive("paragraph"),
286
- canApply: (e) => e.can().setParagraph() || e.can().clearNodes(),
287
- apply: (e) => e.chain().focus().setParagraph().run()
288
- },
289
- {
290
- type: "heading_1",
291
- label: "Heading 1",
292
- Icon: N,
293
- isActive: (e) => e.isActive("heading", { level: 1 }),
294
- canApply: (e) => e.can().setHeading({ level: 1 }) || e.can().clearNodes(),
295
- apply: Ve(1)
296
- },
297
- {
298
- type: "heading_2",
299
- label: "Heading 2",
300
- Icon: P,
301
- isActive: (e) => e.isActive("heading", { level: 2 }),
302
- canApply: (e) => e.can().setHeading({ level: 2 }) || e.can().clearNodes(),
303
- apply: Ve(2)
304
- },
305
- {
306
- type: "heading_3",
307
- label: "Heading 3",
308
- Icon: F,
309
- isActive: (e) => e.isActive("heading", { level: 3 }),
310
- canApply: (e) => e.can().setHeading({ level: 3 }) || e.can().clearNodes(),
311
- apply: Ve(3)
312
- },
313
- {
314
- type: "heading_4",
315
- label: "Heading 4",
316
- Icon: I,
317
- isActive: (e) => e.isActive("heading", { level: 4 }),
318
- canApply: (e) => e.can().setHeading({ level: 4 }) || e.can().clearNodes(),
319
- apply: Ve(4)
320
- },
321
- {
322
- type: "heading_5",
323
- label: "Heading 5",
324
- Icon: L,
325
- isActive: (e) => e.isActive("heading", { level: 5 }),
326
- canApply: (e) => e.can().setHeading({ level: 5 }) || e.can().clearNodes(),
327
- apply: Ve(5)
328
- },
329
- {
330
- type: "heading_6",
331
- label: "Heading 6",
332
- Icon: R,
333
- isActive: (e) => e.isActive("heading", { level: 6 }),
334
- canApply: (e) => e.can().setHeading({ level: 6 }) || e.can().clearNodes(),
335
- apply: Ve(6)
336
- },
337
- {
338
- type: "bulletList",
339
- label: "Bullet List",
340
- Icon: B,
341
- isActive: (e) => e.isActive("bulletList"),
342
- canApply: (e) => e.can().toggleBulletList() || e.can().clearNodes(),
343
- apply: (e) => e.chain().focus().toggleBulletList().run()
344
- },
345
- {
346
- type: "orderedList",
347
- label: "Ordered List",
348
- Icon: se,
349
- isActive: (e) => e.isActive("orderedList"),
350
- canApply: (e) => e.can().toggleOrderedList() || e.can().clearNodes(),
351
- apply: (e) => e.chain().focus().toggleOrderedList().run()
352
- }
353
- ], Ue = (e) => {
354
- let t = b(19), { editor: n } = e, [r, i] = te(!1), { activeBlock: a, canConvert: o, structural: s } = Q({
355
- editor: n,
356
- selector: We
357
- }) ?? {
358
- activeBlock: null,
359
- canConvert: !1,
360
- structural: !1
361
- }, c = a?.Icon ?? V, l = a?.label ?? "Turn Into", u = s || !o, d, f;
362
- t[0] === Symbol.for("react.memo_cache_sentinel") ? (d = /* @__PURE__ */ C(j, { size: 12 }), f = (e) => {
363
- e.preventDefault(), i(!0);
364
- }, t[0] = d, t[1] = f) : (d = t[0], f = t[1]);
365
- let p;
366
- t[2] !== c || t[3] !== u || t[4] !== l ? (p = /* @__PURE__ */ C(_, {
367
- onPointerDown: Ge,
368
- render: /* @__PURE__ */ C($, {
369
- label: l,
370
- Icon: c,
371
- disabled: u,
372
- trailing: d,
373
- onClick: f
374
- })
375
- }), t[2] = c, t[3] = u, t[4] = l, t[5] = p) : p = t[5];
376
- let y;
377
- if (t[6] !== a?.type || t[7] !== n) {
378
- let e;
379
- t[9] === a?.type ? e = t[10] : (e = (e) => a?.type !== e.type, t[9] = a?.type, t[10] = e);
380
- let r;
381
- t[11] === n ? r = t[12] : (r = (e) => /* @__PURE__ */ w("button", {
382
- type: "button",
383
- className: Be,
384
- disabled: !e.canApply(n),
385
- onClick: () => {
386
- e.apply(n), i(!1);
387
- },
388
- children: [/* @__PURE__ */ C(e.Icon, { size: 16 }), /* @__PURE__ */ C("span", { children: e.label })]
389
- }, e.type), t[11] = n, t[12] = r), y = He.filter(e).map(r), t[6] = a?.type, t[7] = n, t[8] = y;
390
- } else y = t[8];
391
- let x;
392
- t[13] === y ? x = t[14] : (x = /* @__PURE__ */ C(h, { children: /* @__PURE__ */ C(v, {
393
- side: "bottom",
394
- align: "start",
395
- children: /* @__PURE__ */ C(m.Popup, {
396
- className: ze,
397
- children: y
398
- })
399
- }) }), t[13] = y, t[14] = x);
400
- let S;
401
- return t[15] !== r || t[16] !== p || t[17] !== x ? (S = /* @__PURE__ */ w(g, {
402
- open: r,
403
- onOpenChange: i,
404
- children: [p, x]
405
- }), t[15] = r, t[16] = p, t[17] = x, t[18] = S) : S = t[18], S;
406
- };
407
- function We(e) {
408
- let { editor: t } = e;
409
- return {
410
- activeBlock: He.find((e) => e.isActive(t)) ?? null,
411
- canConvert: De(t, we),
412
- structural: Ee(t)
413
- };
414
- }
415
- function Ge(e) {
416
- return e.preventDefault();
417
- }
418
- //#endregion
419
- //#region ../../libraries/react-collection/dist/components/editor/Toolbar.js
420
- var Ke = [
421
- {
422
- mark: "bold",
423
- label: "Bold",
424
- Icon: A
425
- },
426
- {
427
- mark: "italic",
428
- label: "Italic",
429
- Icon: z
430
- },
431
- {
432
- mark: "underline",
433
- label: "Underline",
434
- Icon: q
435
- },
436
- {
437
- mark: "strike",
438
- label: "Strike",
439
- Icon: W
440
- },
441
- {
442
- mark: "code",
443
- label: "Code",
444
- Icon: M
445
- }
446
- ], qe = [{
447
- mark: "superscript",
448
- label: "Superscript",
449
- Icon: K
450
- }, {
451
- mark: "subscript",
452
- label: "Subscript",
453
- Icon: G
454
- }], Je = [
455
- {
456
- align: "left",
457
- label: "Align left",
458
- Icon: E
459
- },
460
- {
461
- align: "center",
462
- label: "Align center",
463
- Icon: ne
464
- },
465
- {
466
- align: "right",
467
- label: "Align right",
468
- Icon: D
469
- },
470
- {
471
- align: "justify",
472
- label: "Align justify",
473
- Icon: re
474
- }
475
- ], Ye = (e) => {
476
- let t = b(9), { editor: n, mark: r, label: i, Icon: a } = e, { isActive: o, canExecute: s } = Q({
477
- editor: n,
478
- selector: (e) => {
479
- let { editor: t } = e;
480
- return {
481
- isActive: t.isActive(r),
482
- canExecute: t.isEditable && t.can().toggleMark(r)
483
- };
484
- }
485
- }) ?? {
486
- isActive: !1,
487
- canExecute: !1
488
- }, c = !s, l;
489
- t[0] !== n || t[1] !== r ? (l = () => n.chain().focus().toggleMark(r).run(), t[0] = n, t[1] = r, t[2] = l) : l = t[2];
490
- let u;
491
- return t[3] !== a || t[4] !== o || t[5] !== i || t[6] !== c || t[7] !== l ? (u = /* @__PURE__ */ C($, {
492
- label: i,
493
- Icon: a,
494
- isActive: o,
495
- disabled: c,
496
- onClick: l
497
- }), t[3] = a, t[4] = o, t[5] = i, t[6] = c, t[7] = l, t[8] = u) : u = t[8], u;
498
- }, Xe = (e) => {
499
- let t = b(9), { editor: n, align: r, label: i, Icon: a } = e, { isActive: o, canExecute: s } = Q({
500
- editor: n,
501
- selector: (e) => {
502
- let { editor: t } = e;
503
- return {
504
- isActive: t.isActive({ textAlign: r }),
505
- canExecute: t.isEditable && t.can().setNodeTextAlign(r)
506
- };
507
- }
508
- }) ?? {
509
- isActive: !1,
510
- canExecute: !1
511
- }, c = !s, l;
512
- t[0] !== r || t[1] !== n ? (l = () => n.chain().focus().setNodeTextAlign(r).run(), t[0] = r, t[1] = n, t[2] = l) : l = t[2];
513
- let u;
514
- return t[3] !== a || t[4] !== o || t[5] !== i || t[6] !== c || t[7] !== l ? (u = /* @__PURE__ */ C($, {
515
- label: i,
516
- Icon: a,
517
- isActive: o,
518
- disabled: c,
519
- onClick: l
520
- }), t[3] = a, t[4] = o, t[5] = i, t[6] = c, t[7] = l, t[8] = u) : u = t[8], u;
521
- }, Ze = (e) => {
522
- let t = b(5), { editor: n } = e, r = !(Q({
523
- editor: n,
524
- selector: tt
525
- }) ?? !1), i;
526
- t[0] === n ? i = t[1] : (i = () => n.chain().focus().undo().run(), t[0] = n, t[1] = i);
527
- let a;
528
- return t[2] !== r || t[3] !== i ? (a = /* @__PURE__ */ C($, {
529
- label: "Undo",
530
- Icon: O,
531
- disabled: r,
532
- onClick: i
533
- }), t[2] = r, t[3] = i, t[4] = a) : a = t[4], a;
534
- }, Qe = (e) => {
535
- let t = b(5), { editor: n } = e, r = !(Q({
536
- editor: n,
537
- selector: nt
538
- }) ?? !1), i;
539
- t[0] === n ? i = t[1] : (i = () => n.chain().focus().redo().run(), t[0] = n, t[1] = i);
540
- let a;
541
- return t[2] !== r || t[3] !== i ? (a = /* @__PURE__ */ C($, {
542
- label: "Redo",
543
- Icon: k,
544
- disabled: r,
545
- onClick: i
546
- }), t[2] = r, t[3] = i, t[4] = a) : a = t[4], a;
547
- }, $e = (e) => {
548
- let t = b(5), { editor: n } = e, r = !(Q({
549
- editor: n,
550
- selector: rt
551
- }) ?? !1), i;
552
- t[0] === n ? i = t[1] : (i = () => je(n), t[0] = n, t[1] = i);
553
- let a;
554
- return t[2] !== r || t[3] !== i ? (a = /* @__PURE__ */ C($, {
555
- label: "Reset formatting",
556
- Icon: U,
557
- disabled: r,
558
- onClick: i
559
- }), t[2] = r, t[3] = i, t[4] = a) : a = t[4], a;
560
- }, et = (t) => {
561
- let n = b(33), { children: r } = t, { editor: i } = _e();
562
- if (!i) return null;
563
- let a;
564
- n[0] === i ? a = n[1] : (a = /* @__PURE__ */ C("div", {
565
- className: Se,
566
- children: /* @__PURE__ */ C(Ue, { editor: i })
567
- }), n[0] = i, n[1] = a);
568
- let o;
569
- n[2] === Symbol.for("react.memo_cache_sentinel") ? (o = /* @__PURE__ */ C(e, { orientation: "vertical" }), n[2] = o) : o = n[2];
570
- let s;
571
- n[3] === i ? s = n[4] : (s = Ke.map((e) => /* @__PURE__ */ C(Ye, {
572
- editor: i,
573
- ...e
574
- }, e.mark)), n[3] = i, n[4] = s);
575
- let c;
576
- n[5] === s ? c = n[6] : (c = /* @__PURE__ */ C("div", {
577
- className: Se,
578
- children: s
579
- }), n[5] = s, n[6] = c);
580
- let l;
581
- n[7] === Symbol.for("react.memo_cache_sentinel") ? (l = /* @__PURE__ */ C(e, { orientation: "vertical" }), n[7] = l) : l = n[7];
582
- let u;
583
- n[8] === i ? u = n[9] : (u = /* @__PURE__ */ C("div", {
584
- className: Se,
585
- children: /* @__PURE__ */ C(Ie, { editor: i })
586
- }), n[8] = i, n[9] = u);
587
- let d;
588
- n[10] === Symbol.for("react.memo_cache_sentinel") ? (d = /* @__PURE__ */ C(e, { orientation: "vertical" }), n[10] = d) : d = n[10];
589
- let f;
590
- n[11] === i ? f = n[12] : (f = Je.map((e) => /* @__PURE__ */ C(Xe, {
591
- editor: i,
592
- ...e
593
- }, e.align)), n[11] = i, n[12] = f);
594
- let p;
595
- n[13] === f ? p = n[14] : (p = /* @__PURE__ */ C("div", {
596
- className: Se,
597
- children: f
598
- }), n[13] = f, n[14] = p);
599
- let m;
600
- n[15] === Symbol.for("react.memo_cache_sentinel") ? (m = /* @__PURE__ */ C(e, { orientation: "vertical" }), n[15] = m) : m = n[15];
601
- let h;
602
- n[16] === i ? h = n[17] : (h = qe.map((e) => /* @__PURE__ */ C(Ye, {
603
- editor: i,
604
- ...e
605
- }, e.mark)), n[16] = i, n[17] = h);
606
- let g;
607
- n[18] === h ? g = n[19] : (g = /* @__PURE__ */ C("div", {
608
- className: Se,
609
- children: h
610
- }), n[18] = h, n[19] = g);
611
- let _;
612
- n[20] === Symbol.for("react.memo_cache_sentinel") ? (_ = /* @__PURE__ */ C(e, { orientation: "vertical" }), n[20] = _) : _ = n[20];
613
- let v;
614
- n[21] === i ? v = n[22] : (v = /* @__PURE__ */ w("div", {
615
- className: Se,
616
- children: [
617
- /* @__PURE__ */ C($e, { editor: i }),
618
- /* @__PURE__ */ C(Ze, { editor: i }),
619
- /* @__PURE__ */ C(Qe, { editor: i })
620
- ]
621
- }), n[21] = i, n[22] = v);
622
- let y;
623
- n[23] === r ? y = n[24] : (y = r && /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C(e, { orientation: "vertical" }), /* @__PURE__ */ C("div", {
624
- className: "_261ja31",
625
- children: r
626
- })] }), n[23] = r, n[24] = y);
627
- let x;
628
- return n[25] !== a || n[26] !== g || n[27] !== v || n[28] !== y || n[29] !== c || n[30] !== u || n[31] !== p ? (x = /* @__PURE__ */ w("div", {
629
- className: xe,
630
- children: [
631
- a,
632
- o,
633
- c,
634
- l,
635
- u,
636
- d,
637
- p,
638
- m,
639
- g,
640
- _,
641
- v,
642
- y
643
- ]
644
- }), n[25] = a, n[26] = g, n[27] = v, n[28] = y, n[29] = c, n[30] = u, n[31] = p, n[32] = x) : x = n[32], x;
645
- };
646
- function tt(e) {
647
- let { editor: t } = e;
648
- return t.isEditable && t.can().undo();
649
- }
650
- function nt(e) {
651
- let { editor: t } = e;
652
- return t.isEditable && t.can().redo();
653
- }
654
- function rt(e) {
655
- let { editor: t } = e;
656
- return t.isEditable && Me(t);
657
- }
658
- //#endregion
659
- //#region ../../libraries/react-collection/dist/widgets/richTextWidget/RichTextWidget.cssm.js
660
- var it = "_1vx76w30", at = "_1vx76w33", ot = "_1vx76w34", st = { style: u({ baseSpacing: ".875rem" }) }, ct = (r) => {
661
- let i = b(58), { field: o } = r, [s, c] = te(!1), { key: l, label: u, helper_text: f, readonly: p, placeholder: m } = o, h = l === void 0 ? "" : l, g = u === void 0 ? "" : u, _ = f === void 0 ? "" : f, v = p === void 0 ? !1 : p, S;
662
- i[0] === o ? S = i[1] : (S = t(o), i[0] = o, i[1] = S);
663
- let T;
664
- i[2] !== h || i[3] !== S ? (T = {
665
- name: h,
666
- rules: S
667
- }, i[2] = h, i[3] = S, i[4] = T) : T = i[4];
668
- let { field: ne, fieldState: re } = y(T), { value: E, onBlur: D, onChange: O, disabled: k } = ne, A = m || "Write something ...", j;
669
- i[5] === A ? j = i[6] : (j = be({ placeholder: A }), i[5] = A, i[6] = j);
670
- let M = E || "", ie = !k && !v, ae;
671
- i[7] === Symbol.for("react.memo_cache_sentinel") ? (ae = { attributes: {
672
- autocomplete: "off",
673
- autocorrect: "off",
674
- autocapitalize: "off",
675
- class: d
676
- } }, i[7] = ae) : ae = i[7];
677
- let N;
678
- i[8] === O ? N = i[9] : (N = (e) => {
679
- let { editor: t } = e;
680
- return O(t.getHTML());
681
- }, i[8] = O, i[9] = N);
682
- let P;
683
- i[10] !== M || i[11] !== ie || i[12] !== N || i[13] !== j ? (P = {
684
- extensions: j,
685
- content: M,
686
- editable: ie,
687
- editorProps: ae,
688
- onUpdate: N,
689
- immediatelyRender: !1
690
- }, i[10] = M, i[11] = ie, i[12] = N, i[13] = j, i[14] = P) : P = i[14];
691
- let F = ve(P), I;
692
- i[15] !== F || i[16] !== s || i[17] !== E ? (I = () => {
693
- F?.commands && !s && (F.commands.setContent(E || "", { emitUpdate: !1 }), c(!0));
694
- }, i[15] = F, i[16] = s, i[17] = E, i[18] = I) : I = i[18];
695
- let L;
696
- i[19] === E ? L = i[20] : (L = [E], i[19] = E, i[20] = L), ee(I, L);
697
- let R, z;
698
- i[21] !== k || i[22] !== F || i[23] !== v ? (R = () => {
699
- F && F.setEditable(!k && !v, !1);
700
- }, z = [
701
- F,
702
- k,
703
- v
704
- ], i[21] = k, i[22] = F, i[23] = v, i[24] = R, i[25] = z) : (R = i[24], z = i[25]), ee(R, z);
705
- let oe, B;
706
- i[26] !== F || i[27] !== D ? (oe = () => {
707
- if (F) return F.on("blur", D), () => {
708
- F.off("blur", D);
709
- };
710
- }, B = [F, D], i[26] = F, i[27] = D, i[28] = oe, i[29] = B) : (oe = i[28], B = i[29]), ee(oe, B);
711
- let se = re?.error?.message, V = !!o?.required, H = k && "_1vx76w31", U = v && "_1vx76w32", W;
712
- i[30] !== H || i[31] !== U ? (W = x(it, H, U), i[30] = H, i[31] = U, i[32] = W) : W = i[32];
713
- let G;
714
- i[33] === F ? G = i[34] : (G = { editor: F }, i[33] = F, i[34] = G);
715
- let K, ce;
716
- i[35] === Symbol.for("react.memo_cache_sentinel") ? (K = /* @__PURE__ */ C(et, {}), ce = /* @__PURE__ */ C(e, { orientation: "horizontal" }), i[35] = K, i[36] = ce) : (K = i[35], ce = i[36]);
717
- let q;
718
- i[37] === F?.commands ? q = i[38] : (q = () => F?.commands.focus(), i[37] = F?.commands, i[38] = q);
719
- let J;
720
- i[39] === F ? J = i[40] : (J = /* @__PURE__ */ C(he, { editor: F }), i[39] = F, i[40] = J);
721
- let Y;
722
- i[41] !== q || i[42] !== J ? (Y = /* @__PURE__ */ w("div", {
723
- className: at,
724
- children: [
725
- K,
726
- ce,
727
- /* @__PURE__ */ C("div", {
728
- className: ot,
729
- onClick: q,
730
- children: J
731
- })
732
- ]
733
- }), i[41] = q, i[42] = J, i[43] = Y) : Y = i[43];
734
- let X;
735
- i[44] !== G || i[45] !== Y ? (X = /* @__PURE__ */ C(ye, {
736
- theme: st,
737
- children: /* @__PURE__ */ C(a, { children: /* @__PURE__ */ C(ge.Provider, {
738
- value: G,
739
- children: Y
740
- }) })
741
- }), i[44] = G, i[45] = Y, i[46] = X) : X = i[46];
742
- let Z;
743
- i[47] !== W || i[48] !== X ? (Z = /* @__PURE__ */ C("div", {
744
- className: W,
745
- children: X
746
- }), i[47] = W, i[48] = X, i[49] = Z) : Z = i[49];
747
- let le;
748
- return i[50] !== _ || i[51] !== h || i[52] !== g || i[53] !== v || i[54] !== se || i[55] !== V || i[56] !== Z ? (le = /* @__PURE__ */ C(n, {
749
- error: se,
750
- helperText: _,
751
- readOnly: v,
752
- label: g,
753
- htmlFor: h,
754
- isRequired: V,
755
- children: Z
756
- }), i[50] = _, i[51] = h, i[52] = g, i[53] = v, i[54] = se, i[55] = V, i[56] = Z, i[57] = le) : le = i[57], le;
757
- };
758
- //#endregion
759
- export { ct as RichTextWidget, ct as default };