@baishuyun/ui-base 2.1.0 → 2.2.2

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 (95) hide show
  1. package/dist/Card/{Card-CXULQNHa.js → Card-DHOMkrEE.js} +2 -2
  2. package/dist/Card/index.js +1 -1
  3. package/dist/CheckBox/{CheckBox-Bu40TO29.js → CheckBox-VlP6u_-s.js} +2 -2
  4. package/dist/CheckBox/index.js +19 -17
  5. package/dist/ColorPicker/ColorPicker-049kyJn6.js +205 -0
  6. package/dist/ColorPicker/index.js +1 -1
  7. package/dist/DropDown/DropDown-BkTY-3y0.js +166 -0
  8. package/dist/DropDown/index.js +4 -0
  9. package/dist/Editor/ToolbarPlugin/Buttons/index.js +4 -0
  10. package/dist/Editor/constants/index.js +20 -0
  11. package/dist/Editor/index-C0MY9j94.js +832 -0
  12. package/dist/Editor/index.js +581 -0
  13. package/dist/Icon/Icon-CkHAU1fA.js +24 -0
  14. package/dist/Icon/index.js +1 -1
  15. package/dist/InputTag/InputTag-S9hHXsyQ.js +137 -0
  16. package/dist/InputTag/index.js +2 -135
  17. package/dist/Loading/Loading-CEB4PLUE.js +9 -0
  18. package/dist/Loading/index.js +4 -0
  19. package/dist/Modal/{Modal-BZTEGGa0.js → Modal-oRJ-Almn.js} +1 -1
  20. package/dist/Modal/index.js +1 -1
  21. package/dist/Radio/index.js +1 -1
  22. package/dist/Select/Select-7KGHOKs6.js +820 -0
  23. package/dist/Select/SelectInputSearch-DigfTvpo.js +34 -0
  24. package/dist/Select/index.js +1 -1
  25. package/dist/Tabs/TabSelect-bKB0Qe9F.js +445 -0
  26. package/dist/Tabs/index.js +7 -0
  27. package/dist/Tree/index.js +1 -1
  28. package/dist/Tree/utils/index.js +1 -1
  29. package/dist/components/CheckBox/Group.d.ts +4 -0
  30. package/dist/components/DropDown/DropDown.d.ts +3 -0
  31. package/dist/components/DropDown/MenuItem/MenuItem.d.ts +8 -0
  32. package/dist/components/DropDown/MenuList/MenuList.d.ts +9 -0
  33. package/dist/components/DropDown/index.d.ts +1 -0
  34. package/dist/components/Editor/Editor.d.ts +4 -0
  35. package/dist/components/Editor/EditorCore.d.ts +4 -0
  36. package/dist/components/Editor/ToolbarPlugin/BaseButton/BaseButton.d.ts +29 -0
  37. package/dist/components/Editor/ToolbarPlugin/Buttons/AlignButton.d.ts +2 -0
  38. package/dist/components/Editor/ToolbarPlugin/Buttons/BoldButton.d.ts +2 -0
  39. package/dist/components/Editor/ToolbarPlugin/Buttons/FillButton.d.ts +2 -0
  40. package/dist/components/Editor/ToolbarPlugin/Buttons/FontColorButton.d.ts +2 -0
  41. package/dist/components/Editor/ToolbarPlugin/Buttons/FontSizeButton.d.ts +2 -0
  42. package/dist/components/Editor/ToolbarPlugin/Buttons/ItalicButton.d.ts +2 -0
  43. package/dist/components/Editor/ToolbarPlugin/Buttons/LinkButton.d.ts +2 -0
  44. package/dist/components/Editor/ToolbarPlugin/Buttons/PictureButton/LinkInput.d.ts +5 -0
  45. package/dist/components/Editor/ToolbarPlugin/Buttons/PictureButton/PictureButton.d.ts +2 -0
  46. package/dist/components/Editor/ToolbarPlugin/Buttons/PictureButton/UploadImage.d.ts +8 -0
  47. package/dist/components/Editor/ToolbarPlugin/Buttons/UnLinkButton.d.ts +2 -0
  48. package/dist/components/Editor/ToolbarPlugin/Buttons/UnderLineButton.d.ts +2 -0
  49. package/dist/components/Editor/ToolbarPlugin/Buttons/index.d.ts +14 -0
  50. package/dist/components/Editor/ToolbarPlugin/ToolbarPlugin.d.ts +3 -0
  51. package/dist/components/Editor/ToolbarPlugin/context/TextFormatProvider.d.ts +3 -0
  52. package/dist/components/Editor/ToolbarPlugin/context/TextFormatsContext.d.ts +17 -0
  53. package/dist/components/Editor/ToolbarPlugin/context/useTextFormatsContext.d.ts +1 -0
  54. package/dist/components/Editor/ToolbarPlugin/interface.d.ts +32 -0
  55. package/dist/components/Editor/commands/ImageCommands.d.ts +8 -0
  56. package/dist/components/Editor/constants/index.d.ts +41 -0
  57. package/dist/components/Editor/hooks/useTextFormatsState.d.ts +2 -0
  58. package/dist/components/Editor/index.d.ts +2 -0
  59. package/dist/components/Editor/interface.d.ts +62 -0
  60. package/dist/components/Editor/nodes/ExtendedTextNode.d.ts +11 -0
  61. package/dist/components/Editor/nodes/ImageComponent.d.ts +11 -0
  62. package/dist/components/Editor/nodes/ImageNode.d.ts +50 -0
  63. package/dist/components/Editor/plugins/EnterKeyPlugin.d.ts +1 -0
  64. package/dist/components/Editor/plugins/ImagePlugin.d.ts +1 -0
  65. package/dist/components/Loading/Loading.d.ts +5 -0
  66. package/dist/components/Loading/index.d.ts +1 -0
  67. package/dist/components/Select/context/SelectContext.d.ts +12 -0
  68. package/dist/components/Tabs/Tab/Tab.d.ts +10 -0
  69. package/dist/components/Tabs/TabList/TabList.d.ts +4 -0
  70. package/dist/components/Tabs/TabList/useTabIndicator.d.ts +19 -0
  71. package/dist/components/Tabs/TabList/useTabScroll.d.ts +16 -0
  72. package/dist/components/Tabs/TabPanel/TabPanel.d.ts +9 -0
  73. package/dist/components/Tabs/TabSelect/TabSelect.d.ts +3 -0
  74. package/dist/components/Tabs/TabSelect/interface.d.ts +26 -0
  75. package/dist/components/Tabs/Tabs.d.ts +3 -0
  76. package/dist/components/Tabs/constants.d.ts +9 -0
  77. package/dist/components/Tabs/context/TabContext.d.ts +7 -0
  78. package/dist/components/Tabs/index.d.ts +4 -0
  79. package/dist/components/Tabs/interface.d.ts +61 -0
  80. package/dist/components/index.d.ts +6 -0
  81. package/dist/index.js +41 -30
  82. package/dist/style.css +1 -1
  83. package/dist/vendors/{Tree-CCY2gtpG.js → Tree-C-8x1jXV.js} +4 -4
  84. package/dist/vendors/color-VzwvCPhF.js +21 -0
  85. package/dist/vendors/index-MTmG1Ezy.js +15 -0
  86. package/dist/vendors/lexical-DdSmj_Kv.js +5891 -0
  87. package/dist/vendors/{lodash-es-CZfJRWhO.js → lodash-es-DFpaJB4Y.js} +2 -2
  88. package/dist/vendors/{simplebar-react-Bf9Zq-21.js → simplebar-react-D68KzE44.js} +1 -1
  89. package/dist/vendors/useFloatingPortal-9VUFOAOG.js +45 -0
  90. package/dist/vendors/{index-ByQkttKA.js → useLocale-DgqW9M3h.js} +35 -47
  91. package/package.json +9 -7
  92. package/dist/ColorPicker/ColorPicker-CwFsihkL.js +0 -207
  93. package/dist/Icon/Icon-BlkVlKDd.js +0 -24
  94. package/dist/Select/Select-C3abXG27.js +0 -855
  95. package/dist/vendors/lexical-Bz4mqKs6.js +0 -3
@@ -0,0 +1,581 @@
1
+ import { jsx as u, jsxs as W, Fragment as et } from "react/jsx-runtime";
2
+ import { o as N, P as F, _ as M, Y as $, w as U, f as nt, x as G, j as it, C as ot, L as rt, $ as z, S as st, a as at, W as V, J as lt, F as ct, B as ut, M as dt, b as J, g as ht, m as gt, h as mt, c as _t, d as ft, e as pt, n as bt, q as O, s as yt, i as xt, k as vt } from "../vendors/lexical-DdSmj_Kv.js";
3
+ import wt, { useState as S, useEffect as x, useRef as A, useCallback as E, useMemo as Ct } from "react";
4
+ import { p as Tt, T as Et, B as Lt, g as Z, k as X, v as H, I as Nt, m as kt } from "./index-C0MY9j94.js";
5
+ import { DEFAULT_BACKGROUND_COLOR as j, DEFAULT_FONT_COLOR as K, DEFAULT_FONT_SIZE as Y } from "./constants/index.js";
6
+ import { c as D } from "../vendors/clsx-OuTLNxxd.js";
7
+ const I = {
8
+ "bsy-lexical__toolbar": "_bsy-lexical__toolbar_n60av_1",
9
+ "bsy-lexical__toolbar-group": "_bsy-lexical__toolbar-group_n60av_9",
10
+ "bsy-lexical__toolbar-divider": "_bsy-lexical__toolbar-divider_n60av_15"
11
+ };
12
+ function Dt() {
13
+ const [i] = N(), [t, o] = S({
14
+ bold: !1,
15
+ italic: !1,
16
+ underline: !1,
17
+ fontSize: Y,
18
+ fontColor: K,
19
+ backgroundColor: j,
20
+ align: "left",
21
+ link: void 0
22
+ });
23
+ return x(() => i.registerUpdateListener(({ editorState: e }) => {
24
+ e.read(() => {
25
+ const n = F();
26
+ if (M(n)) {
27
+ const s = $(
28
+ n,
29
+ "font-size",
30
+ Y
31
+ ), a = $(
32
+ n,
33
+ "color",
34
+ K
35
+ ), l = $(
36
+ n,
37
+ "background-color",
38
+ j
39
+ ), r = n.anchor.getNode();
40
+ let m = r.getKey() === "root" ? r : U(r, (f) => {
41
+ const h = f.getParent();
42
+ return h !== null && nt(h);
43
+ });
44
+ m === null && (m = r.getTopLevelElementOrThrow());
45
+ const d = {}, _ = U(r, Tt);
46
+ _ ? (d.link = _.getURL(), d.linkText = _.getTextContent(), d.newBlank = _.getTarget() === "_blank") : d.linkText = n.getTextContent(), o({
47
+ bold: n.hasFormat("bold"),
48
+ italic: n.hasFormat("italic"),
49
+ underline: n.hasFormat("underline"),
50
+ fontSize: s,
51
+ fontColor: a,
52
+ backgroundColor: l,
53
+ align: G(m) ? m.getFormatType() : "left",
54
+ link: d
55
+ });
56
+ }
57
+ });
58
+ }), [i]), t;
59
+ }
60
+ const Rt = (i) => {
61
+ const t = Dt();
62
+ return /* @__PURE__ */ u(Et.Provider, { value: t, children: i.children });
63
+ }, St = (i) => {
64
+ const { config: t = [], style: o } = i, e = (n, s) => {
65
+ const a = typeof n == "string" ? n : n.name, l = Lt[a];
66
+ return typeof n == "string" ? /* @__PURE__ */ u(l, {}, `${a}-${s}`) : /* @__PURE__ */ u(l, { ...n.props }, `${a}-${s}`);
67
+ };
68
+ return /* @__PURE__ */ u(Rt, { children: /* @__PURE__ */ u("div", { className: I["bsy-lexical__toolbar"], style: o, children: t.map((n, s) => /* @__PURE__ */ W(
69
+ "div",
70
+ {
71
+ className: I["bsy-lexical__toolbar-group"],
72
+ "data-group": n.key,
73
+ children: [
74
+ n.buttons.map((a, l) => e(a, l)),
75
+ s < t.length - 1 && /* @__PURE__ */ u("div", { className: I["bsy-lexical__toolbar-divider"] })
76
+ ]
77
+ },
78
+ n.key + s
79
+ )) }) });
80
+ }, q = {
81
+ "bsy-lexical-editor": "_bsy-lexical-editor_19ssw_1",
82
+ "bsy-lexical-editor__content-editable": "_bsy-lexical-editor__content-editable_19ssw_6"
83
+ };
84
+ function Wt({ validateUrl: i, attributes: t }) {
85
+ const [o] = N();
86
+ return x((() => {
87
+ if (!o.hasNodes([Z])) throw new Error("LinkPlugin: LinkNode not registered on editor");
88
+ return it(o.registerCommand(X, ((e) => {
89
+ if (e === null) return H(e), !0;
90
+ if (typeof e == "string") return !(i !== void 0 && !i(e)) && (H(e, t), !0);
91
+ {
92
+ const { url: n, target: s, rel: a, title: l } = e;
93
+ return H(n, { ...t, rel: a, target: s, title: l }), !0;
94
+ }
95
+ }), z), i !== void 0 ? o.registerCommand(ot, ((e) => {
96
+ const n = F();
97
+ if (!M(n) || n.isCollapsed() || !rt(e, ClipboardEvent) || e.clipboardData === null) return !1;
98
+ const s = e.clipboardData.getData("text");
99
+ return !!i(s) && !n.getNodes().some(((a) => G(a))) && (o.dispatchCommand(X, { ...t, url: s }), e.preventDefault(), !0);
100
+ }), z) : () => {
101
+ });
102
+ }), [o, i, t]), null;
103
+ }
104
+ const Ft = "_imageWrapper_y06h3_1", Mt = "_selected_y06h3_8", $t = "_resizing_y06h3_12", Ht = "_image_y06h3_1", It = "_resizeHandle_y06h3_30", zt = "_topLeft_y06h3_44", Ot = "_topRight_y06h3_49", At = "_bottomLeft_y06h3_54", Pt = "_bottomRight_y06h3_59", y = {
105
+ imageWrapper: Ft,
106
+ selected: Mt,
107
+ resizing: $t,
108
+ image: Ht,
109
+ resizeHandle: It,
110
+ topLeft: zt,
111
+ topRight: Ot,
112
+ bottomLeft: At,
113
+ bottomRight: Pt
114
+ }, Bt = ({
115
+ src: i,
116
+ altText: t,
117
+ width: o,
118
+ height: e,
119
+ nodeKey: n
120
+ }) => {
121
+ const [s] = N(), [a, l] = S(!1), [r, m] = S(null), d = A(null), [g, _] = S({
122
+ width: o || void 0,
123
+ height: e || void 0
124
+ }), f = E(() => {
125
+ o && e && _({ width: o, height: e });
126
+ }, [o, e]), h = E(
127
+ (c, p) => {
128
+ if (c.preventDefault(), c.stopPropagation(), !d.current) return;
129
+ const b = g.width || d.current.offsetWidth, C = g.height || d.current.offsetHeight, k = b / C;
130
+ (!g.width || !g.height) && _({ width: b, height: C }), m({
131
+ isResizing: !0,
132
+ startX: c.clientX,
133
+ startY: c.clientY,
134
+ startWidth: b,
135
+ startHeight: C,
136
+ aspectRatio: k,
137
+ direction: p
138
+ });
139
+ },
140
+ [g]
141
+ ), v = E(
142
+ (c) => {
143
+ if (!(r != null && r.isResizing)) return;
144
+ const p = c.clientX - r.startX;
145
+ let b;
146
+ switch (r.direction) {
147
+ case "bottom-right":
148
+ b = Math.max(50, r.startWidth + p);
149
+ break;
150
+ case "bottom-left":
151
+ b = Math.max(50, r.startWidth - p);
152
+ break;
153
+ case "top-right":
154
+ b = Math.max(50, r.startWidth + p);
155
+ break;
156
+ case "top-left":
157
+ b = Math.max(50, r.startWidth - p);
158
+ break;
159
+ default:
160
+ b = Math.max(50, r.startWidth + p);
161
+ }
162
+ const C = b / r.aspectRatio;
163
+ _({ width: b, height: C });
164
+ },
165
+ [r]
166
+ ), w = E(() => {
167
+ r != null && r.isResizing && (s.update(() => {
168
+ const c = st(n);
169
+ Ut(c) && c.setWidthAndHeight(g.width, g.height);
170
+ }), m(null));
171
+ }, [s, n, g, r]);
172
+ wt.useEffect(() => {
173
+ if (r != null && r.isResizing)
174
+ return document.addEventListener("mousemove", v), document.addEventListener("mouseup", w), () => {
175
+ document.removeEventListener("mousemove", v), document.removeEventListener("mouseup", w);
176
+ };
177
+ }, [r, v, w]);
178
+ const tt = E(() => {
179
+ l(!0);
180
+ }, []);
181
+ return x(() => s.registerUpdateListener(({ editorState: c }) => {
182
+ c.read(() => {
183
+ const p = F();
184
+ M(p) && !p.getNodes().some((k) => {
185
+ var B;
186
+ return k.getKey() === n || k.getParent() && ((B = k.getParent()) == null ? void 0 : B.getKey()) === n;
187
+ }) && a && l(!1);
188
+ });
189
+ }), [s, n, a]), x(() => {
190
+ const c = (p) => {
191
+ a && d.current && !d.current.contains(p.target) && l(!1);
192
+ };
193
+ if (a)
194
+ return document.addEventListener("mousedown", c), () => {
195
+ document.removeEventListener("mousedown", c);
196
+ };
197
+ }, [a]), /* @__PURE__ */ W(
198
+ "div",
199
+ {
200
+ className: D(y.imageWrapper, {
201
+ [y.selected]: a,
202
+ [y.resizing]: r == null ? void 0 : r.isResizing
203
+ }),
204
+ children: [
205
+ /* @__PURE__ */ u(
206
+ "img",
207
+ {
208
+ ref: d,
209
+ src: i,
210
+ alt: t,
211
+ className: y.image,
212
+ style: {
213
+ width: g.width,
214
+ height: g.height
215
+ },
216
+ onLoad: f,
217
+ onClick: tt,
218
+ draggable: !1
219
+ }
220
+ ),
221
+ a && /* @__PURE__ */ W(et, { children: [
222
+ /* @__PURE__ */ u(
223
+ "div",
224
+ {
225
+ className: D(y.resizeHandle, y.bottomRight),
226
+ onMouseDown: (c) => h(c, "bottom-right")
227
+ }
228
+ ),
229
+ /* @__PURE__ */ u(
230
+ "div",
231
+ {
232
+ className: D(y.resizeHandle, y.bottomLeft),
233
+ onMouseDown: (c) => h(c, "bottom-left")
234
+ }
235
+ ),
236
+ /* @__PURE__ */ u(
237
+ "div",
238
+ {
239
+ className: D(y.resizeHandle, y.topRight),
240
+ onMouseDown: (c) => h(c, "top-right")
241
+ }
242
+ ),
243
+ /* @__PURE__ */ u(
244
+ "div",
245
+ {
246
+ className: D(y.resizeHandle, y.topLeft),
247
+ onMouseDown: (c) => h(c, "top-left")
248
+ }
249
+ )
250
+ ] })
251
+ ]
252
+ }
253
+ );
254
+ };
255
+ class R extends at {
256
+ static getType() {
257
+ return "image";
258
+ }
259
+ static clone(t) {
260
+ return new R(t.__src, t.__altText, t.__width, t.__height, t.__key);
261
+ }
262
+ constructor(t, o, e, n, s) {
263
+ super(s), this.__src = t, this.__altText = o || "", this.__width = e, this.__height = n;
264
+ }
265
+ createDOM() {
266
+ const t = document.createElement("div");
267
+ return t.style.display = "inline-block", t;
268
+ }
269
+ updateDOM() {
270
+ return !1;
271
+ }
272
+ exportDOM() {
273
+ const t = document.createElement("img");
274
+ return t.setAttribute("src", this.__src), t.setAttribute("alt", this.__altText), t.style.maxWidth = "100%", t.style.display = "inline", t.style.verticalAlign = "baseline", this.__width && t.setAttribute("width", this.__width.toString()), this.__height && t.setAttribute("height", this.__height.toString()), { element: t };
275
+ }
276
+ getSrc() {
277
+ return this.__src;
278
+ }
279
+ getAltText() {
280
+ return this.__altText;
281
+ }
282
+ getWidth() {
283
+ return this.__width;
284
+ }
285
+ getHeight() {
286
+ return this.__height;
287
+ }
288
+ setSrc(t) {
289
+ const o = this.getWritable();
290
+ o.__src = t;
291
+ }
292
+ setAltText(t) {
293
+ const o = this.getWritable();
294
+ o.__altText = t;
295
+ }
296
+ setWidthAndHeight(t, o) {
297
+ const e = this.getWritable();
298
+ e.__width = t, e.__height = o;
299
+ }
300
+ decorate() {
301
+ return /* @__PURE__ */ u(
302
+ Bt,
303
+ {
304
+ src: this.__src,
305
+ altText: this.__altText,
306
+ width: this.__width,
307
+ height: this.__height,
308
+ nodeKey: this.getKey()
309
+ }
310
+ );
311
+ }
312
+ static importDOM() {
313
+ return {
314
+ img: () => ({
315
+ conversion: Jt,
316
+ priority: 0
317
+ })
318
+ };
319
+ }
320
+ static importJSON(t) {
321
+ const { src: o, altText: e, width: n, height: s } = t;
322
+ return P({ src: o, altText: e, width: n, height: s });
323
+ }
324
+ exportJSON() {
325
+ return {
326
+ src: this.getSrc(),
327
+ altText: this.getAltText(),
328
+ width: this.getWidth(),
329
+ height: this.getHeight(),
330
+ type: "image",
331
+ version: 1
332
+ };
333
+ }
334
+ isInline() {
335
+ return !0;
336
+ }
337
+ }
338
+ function P({ src: i, altText: t, width: o, height: e, key: n }) {
339
+ return new R(i, t, o, e, n);
340
+ }
341
+ function Ut(i) {
342
+ return i instanceof R;
343
+ }
344
+ function Jt(i) {
345
+ if (i instanceof HTMLImageElement) {
346
+ const { src: t, alt: o, style: e } = i;
347
+ let n, s;
348
+ if (e.width) {
349
+ const l = parseInt(e.width, 10);
350
+ isNaN(l) || (n = l);
351
+ }
352
+ if (e.height) {
353
+ const l = parseInt(e.height, 10);
354
+ isNaN(l) || (s = l);
355
+ }
356
+ return n === void 0 && i.width && (n = i.width), s === void 0 && i.height && (s = i.height), { node: P({
357
+ src: t,
358
+ altText: o,
359
+ width: n,
360
+ height: s
361
+ }) };
362
+ }
363
+ return null;
364
+ }
365
+ function Xt() {
366
+ const [i] = N();
367
+ return x(() => i.registerCommand(
368
+ Nt,
369
+ (t) => {
370
+ const o = P(t);
371
+ return V([o]), !0;
372
+ },
373
+ lt
374
+ ), [i]), null;
375
+ }
376
+ function jt() {
377
+ const [i] = N(), t = A(0), o = 250;
378
+ return x(() => i.registerCommand(
379
+ ct,
380
+ (e) => {
381
+ const n = Date.now(), s = n - t.current;
382
+ return t.current = n, s < o && s > 0 ? (i.update(() => {
383
+ const a = F();
384
+ if (M(a)) {
385
+ const r = a.anchor.getNode().getTopLevelElement();
386
+ if (r && r.getTextContent().trim() === "") {
387
+ const m = ut();
388
+ dt(a, {
389
+ "background-color": "",
390
+ color: "",
391
+ "font-size": "",
392
+ "font-weight": "",
393
+ "font-style": "",
394
+ "text-decoration": ""
395
+ }), r.replace(m), m.select();
396
+ const d = m.getPreviousSibling();
397
+ d && d.getTextContent().trim() === "" && d.remove();
398
+ }
399
+ }
400
+ }), e == null || e.preventDefault(), !0) : !1;
401
+ },
402
+ z
403
+ ), [i]), null;
404
+ }
405
+ const Q = (i) => {
406
+ var d;
407
+ const { height: t = 126, onChange: o, toolbar: e } = i, [n] = N(), s = A(null), a = E(
408
+ (g) => {
409
+ g.read(() => {
410
+ const f = J().getTextContent(), h = ht(n, null), w = !f.trim() && (h === "<p><br></p>" || h === "<p></p>" || h === "" || /^<p>\s*<br>\s*<\/p>$/.test(h)) ? null : h;
411
+ s.current = w, o(
412
+ {
413
+ text: f,
414
+ html: w
415
+ },
416
+ g
417
+ );
418
+ });
419
+ },
420
+ [o, n]
421
+ );
422
+ x(() => {
423
+ i.value !== void 0 && i.value !== s.current && n.update(() => {
424
+ if (J().clear(), i.value && i.value.trim()) {
425
+ const _ = new DOMParser().parseFromString(i.value, "text/html"), f = gt(n, _);
426
+ V(f);
427
+ }
428
+ });
429
+ }, [i.value, n]);
430
+ const l = (d = e == null ? void 0 : e.config) != null && d.length ? e == null ? void 0 : e.config : [], r = n.isEditable(), m = () => {
431
+ r || (n.setEditable(!0), n.focus(() => {
432
+ }, { defaultSelection: "rootEnd" }));
433
+ };
434
+ return /* @__PURE__ */ W("div", { className: q["bsy-lexical-editor"], onClick: m, children: [
435
+ l.length > 0 && /* @__PURE__ */ u(
436
+ St,
437
+ {
438
+ config: l,
439
+ style: {
440
+ ...e == null ? void 0 : e.style
441
+ }
442
+ }
443
+ ),
444
+ /* @__PURE__ */ u(
445
+ mt,
446
+ {
447
+ contentEditable: /* @__PURE__ */ u(
448
+ ft,
449
+ {
450
+ className: q["bsy-lexical-editor__content-editable"],
451
+ style: {
452
+ height: t,
453
+ cursor: r ? "auto" : "text"
454
+ }
455
+ }
456
+ ),
457
+ ErrorBoundary: _t
458
+ }
459
+ ),
460
+ /* @__PURE__ */ u(Wt, {}),
461
+ /* @__PURE__ */ u(Xt, {}),
462
+ /* @__PURE__ */ u(jt, {}),
463
+ /* @__PURE__ */ u(pt, {}),
464
+ /* @__PURE__ */ u(bt, { onChange: a })
465
+ ] });
466
+ };
467
+ Q.displayName = "BsyLexicalEditorCore";
468
+ class L extends O {
469
+ constructor(t, o) {
470
+ super(t, o);
471
+ }
472
+ static getType() {
473
+ return "extended-text";
474
+ }
475
+ static clone(t) {
476
+ return new L(t.__text, t.__key);
477
+ }
478
+ static importDOM() {
479
+ const t = O.importDOM();
480
+ return {
481
+ ...t,
482
+ code: () => ({
483
+ conversion: T(t == null ? void 0 : t.code),
484
+ priority: 1
485
+ }),
486
+ em: () => ({
487
+ conversion: T(t == null ? void 0 : t.em),
488
+ priority: 1
489
+ }),
490
+ span: () => ({
491
+ conversion: T(t == null ? void 0 : t.span),
492
+ priority: 1
493
+ }),
494
+ strong: () => ({
495
+ conversion: T(t == null ? void 0 : t.strong),
496
+ priority: 1
497
+ }),
498
+ sub: () => ({
499
+ conversion: T(t == null ? void 0 : t.sub),
500
+ priority: 1
501
+ }),
502
+ sup: () => ({
503
+ conversion: T(t == null ? void 0 : t.sup),
504
+ priority: 1
505
+ })
506
+ };
507
+ }
508
+ static importJSON(t) {
509
+ return Kt().updateFromJSON(t);
510
+ }
511
+ isSimpleText() {
512
+ return this.__type === "extended-text" && this.__mode === 0;
513
+ }
514
+ // no need to add exportJSON here, since we are not adding any new properties
515
+ }
516
+ function Kt(i = "") {
517
+ return xt(new L(i));
518
+ }
519
+ function T(i) {
520
+ return (t) => {
521
+ const o = i == null ? void 0 : i(t);
522
+ if (!o)
523
+ return null;
524
+ const e = o.conversion(t);
525
+ if (!e)
526
+ return e;
527
+ const n = t.style.backgroundColor, s = t.style.color, a = t.style.fontFamily, l = t.style.fontWeight, r = t.style.fontSize, m = t.style.textDecoration;
528
+ return {
529
+ ...e,
530
+ forChild: (d, g) => {
531
+ const f = ((e == null ? void 0 : e.forChild) ?? ((h) => h))(d, g);
532
+ if (yt(f)) {
533
+ const h = [
534
+ n ? `background-color: ${n}` : null,
535
+ s ? `color: ${s}` : null,
536
+ a ? `font-family: ${a}` : null,
537
+ l ? `font-weight: ${l}` : null,
538
+ r ? `font-size: ${r}` : null,
539
+ m ? `text-decoration: ${m}` : null
540
+ ].filter((v) => v !== null).join("; ");
541
+ if (h.length)
542
+ return f.setStyle(h);
543
+ }
544
+ return f;
545
+ }
546
+ };
547
+ };
548
+ }
549
+ const Yt = (i) => {
550
+ const { autoFocus: t = !1 } = i, o = Ct(() => ({
551
+ namespace: "bsyLexicalEditor",
552
+ onError: (e) => {
553
+ console.error("Lexical error", e);
554
+ },
555
+ editable: t,
556
+ theme: {
557
+ text: {
558
+ bold: "editor-text-bold",
559
+ italic: "editor-text-italic",
560
+ underline: "editor-text-underline"
561
+ },
562
+ link: "editor-link"
563
+ },
564
+ nodes: [
565
+ Z,
566
+ kt,
567
+ R,
568
+ L,
569
+ {
570
+ replace: O,
571
+ with: (e) => new L(e.__text),
572
+ withKlass: L
573
+ }
574
+ ]
575
+ }), [t]);
576
+ return /* @__PURE__ */ u(vt, { initialConfig: o, children: /* @__PURE__ */ u(Q, { ...i }) });
577
+ };
578
+ Yt.displayName = "BsyLexicalEditor";
579
+ export {
580
+ Yt as default
581
+ };
@@ -0,0 +1,24 @@
1
+ import { jsx as p } from "react/jsx-runtime";
2
+ import { createFromIconfontCN as e } from "@ant-design/icons";
3
+ import { b as f } from "../vendors/lodash-es-DFpaJB4Y.js";
4
+ const a = e({
5
+ scriptUrl: "https://at.alicdn.com/t/c/font_4786625_c3hfvyi874p.js"
6
+ }), I = ({ name: o, style: c, className: n, onClick: r, color: s, size: t = 16 }) => {
7
+ const m = {
8
+ color: s,
9
+ fontSize: f(t) ? `${t}px` : t,
10
+ ...c
11
+ };
12
+ return /* @__PURE__ */ p(
13
+ a,
14
+ {
15
+ onClick: r,
16
+ type: `icon-${o}`,
17
+ style: m,
18
+ className: `${n || ""}`
19
+ }
20
+ );
21
+ };
22
+ export {
23
+ I
24
+ };
@@ -1,4 +1,4 @@
1
- import { I as f } from "./Icon-BlkVlKDd.js";
1
+ import { I as f } from "./Icon-CkHAU1fA.js";
2
2
  export {
3
3
  f as default
4
4
  };