@baishuyun/ui-base 6.8.2 → 6.9.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 (65) hide show
  1. package/dist/Amap/AmapCircle/index.js +1 -1
  2. package/dist/Amap/AmapMarker/index.js +1 -1
  3. package/dist/Amap/AmapMarkerCluster/index.js +1 -1
  4. package/dist/Amap/AmapProvider/index.js +1 -1
  5. package/dist/Amap/hooks/index.js +1 -1
  6. package/dist/Amap/index.js +1 -1
  7. package/dist/Calendar/{Calendar-DnQrN8KB.js → Calendar-MghsGFZ0.js} +1 -1
  8. package/dist/Calendar/context/index.js +1 -1
  9. package/dist/Calendar/index.js +3 -3
  10. package/dist/Calendar/subcomponents/AllDaySection/index.js +1 -1
  11. package/dist/Calendar/subcomponents/CurrentTimeIndicator/index.js +1 -1
  12. package/dist/Calendar/subcomponents/EventCard/index.js +1 -1
  13. package/dist/Calendar/subcomponents/TimeAxis/index.js +1 -1
  14. package/dist/Calendar/subcomponents/TimeGrid/index.js +1 -1
  15. package/dist/Calendar/utils/index.js +1 -1
  16. package/dist/Calendar/utils/layout/index.js +1 -1
  17. package/dist/Calendar/utils/theme/index.js +1 -1
  18. package/dist/Card/index.js +1 -1
  19. package/dist/CheckBox/index.js +1 -1
  20. package/dist/ColorPicker/{ColorPicker-CL57cSDG.js → ColorPicker-t1uBeATW.js} +14 -12
  21. package/dist/ColorPicker/index.js +2 -2
  22. package/dist/ConfigProvider/index.js +1 -1
  23. package/dist/DatePicker/{DatePicker-C0XbZmrZ.js → DatePicker-uizefM92.js} +1 -1
  24. package/dist/DatePicker/{DatePickerPanel-BEn16cat.js → DatePickerPanel-bbGVwlo7.js} +1 -1
  25. package/dist/DatePicker/index.js +2 -2
  26. package/dist/DatePicker/style/index.js +1 -1
  27. package/dist/DropDown/index.js +1 -1
  28. package/dist/DropDown/style/index.js +1 -1
  29. package/dist/Editor/{Buttons-BivKInBV.js → Buttons-BhStZyIa.js} +2 -2
  30. package/dist/Editor/ToolbarPlugin/Buttons/index.js +3 -3
  31. package/dist/Editor/constants/index.js +1 -1
  32. package/dist/Editor/index.js +215 -187
  33. package/dist/Gantt/GanttChart/index.js +1 -1
  34. package/dist/Gantt/GanttTable/index.js +1 -1
  35. package/dist/Gantt/GanttToolBar/index.js +1 -1
  36. package/dist/Gantt/index.js +1 -1
  37. package/dist/Gantt/utils/index.js +1 -1
  38. package/dist/Gantt/utils/theme/index.js +1 -1
  39. package/dist/Icon/index.js +1 -1
  40. package/dist/InputTag/index.js +1 -1
  41. package/dist/Loading/index.js +1 -1
  42. package/dist/Modal/index.js +1 -1
  43. package/dist/NotFoundContent/index.js +1 -1
  44. package/dist/Radio/index.js +1 -1
  45. package/dist/ScrollBar/index.js +1 -1
  46. package/dist/Segmented/index.js +1 -1
  47. package/dist/Select/index.js +1 -1
  48. package/dist/Table/hooks/index.js +1 -1
  49. package/dist/Table/index.js +1 -1
  50. package/dist/Table/style/index.js +1 -1
  51. package/dist/Table/utils/index.js +1 -1
  52. package/dist/Tabs/index.js +1 -1
  53. package/dist/Tooltip/index.js +1 -1
  54. package/dist/Tree/index.js +1 -1
  55. package/dist/Tree/utils/index.js +1 -1
  56. package/dist/components/ColorPicker/ColorPicker.type.d.ts +1 -1
  57. package/dist/components/Editor/ToolbarPlugin/ToolbarPlugin.d.ts +2 -3
  58. package/dist/components/Editor/context/EditorContainerContext.d.ts +1 -0
  59. package/dist/components/Editor/index.d.ts +1 -1
  60. package/dist/components/Editor/interface.d.ts +26 -8
  61. package/dist/components/Editor/utils/resolveFloatingToolbarStyle.d.ts +3 -0
  62. package/dist/index.js +4 -4
  63. package/dist/style.css +1 -1
  64. package/dist/vendors/{version-4HBYLKDL.js → version-D76DufO-.js} +1 -1
  65. package/package.json +1 -1
@@ -1,9 +1,9 @@
1
- import "../vendors/version-4HBYLKDL.js";
1
+ import "../vendors/version-D76DufO-.js";
2
2
  import "../ScrollBar/style-D26azwz6.js";
3
3
  import "../Icon/Icon-BBDcb-yw.js";
4
4
  import "../vendors/LocaleContext-Dcw6C1LX.js";
5
5
  import "../Modal/Modal-LiztSF7x.js";
6
- import "../ColorPicker/ColorPicker-CL57cSDG.js";
6
+ import "../ColorPicker/ColorPicker-t1uBeATW.js";
7
7
  import "../vendors/useFloatingOverlay-BApqkHSu.js";
8
8
  import "../vendors/useLocale-BKZX2_zw.js";
9
9
  import "../vendors/color-D6XBXROa.js";
@@ -17,67 +17,79 @@ import "../ScrollBar/ScrollBar-QhXVe8zd.js";
17
17
  import "../vendors/useFloatingPortal-CmVJbuRm.js";
18
18
  import "../DropDown/DropDown-yDH9V_9Y.js";
19
19
  import "../DropDown/style-Fdp-U4md.js";
20
- import { a as t, c as n, i as r, l as i, n as a, o, r as s, s as c, u as l } from "./Buttons-BivKInBV.js";
21
- import { DEFAULT_BACKGROUND_COLOR as u, DEFAULT_FONT_COLOR as d, DEFAULT_FONT_SIZE as f } from "./constants/index.js";
22
- import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
23
- import g, { useCallback as _, useEffect as v, useMemo as y, useRef as b, useState as x } from "react";
24
- import S from "clsx";
25
- import { LexicalComposer as C } from "@lexical/react/LexicalComposer";
26
- import { RichTextPlugin as w } from "@lexical/react/LexicalRichTextPlugin";
27
- import { ContentEditable as T } from "@lexical/react/LexicalContentEditable";
28
- import { HistoryPlugin as E } from "@lexical/react/LexicalHistoryPlugin";
29
- import { OnChangePlugin as ee } from "@lexical/react/LexicalOnChangePlugin";
30
- import { LexicalErrorBoundary as te } from "@lexical/react/LexicalErrorBoundary";
31
- import { $generateHtmlFromNodes as ne, $generateNodesFromDOM as re } from "@lexical/html";
32
- import { $applyNodeReplacement as D, $createParagraphNode as O, $getNodeByKey as k, $getRoot as ie, $getRoot as A, $getSelection as j, $insertNodes as M, $isElementNode as ae, $isRangeSelection as N, $isRootOrShadowRoot as oe, $isTextNode as se, COMMAND_PRIORITY_EDITOR as ce, COMMAND_PRIORITY_LOW as le, DecoratorNode as ue, KEY_ENTER_COMMAND as P, RootNode as F, TextNode as I } from "lexical";
33
- import { useLexicalComposerContext as de, useLexicalComposerContext as L } from "@lexical/react/LexicalComposerContext";
34
- import { $getSelectionStyleValueForProperty as R, $patchStyleText as fe, $trimTextContentFromAnchor as z } from "@lexical/selection";
35
- import { $findMatchingParent as B, $restoreEditorState as V } from "@lexical/utils";
36
- import { $isLinkNode as pe, AutoLinkNode as me, LinkNode as he } from "@lexical/link";
37
- import { useLexicalEditable as ge } from "@lexical/react/useLexicalEditable";
38
- import { LinkPlugin as _e } from "@lexical/react/LexicalLinkPlugin";
20
+ import { a as t, c as n, d as r, i, l as a, n as o, o as s, r as c, s as l, u } from "./Buttons-BhStZyIa.js";
21
+ import { DEFAULT_BACKGROUND_COLOR as d, DEFAULT_FONT_COLOR as f, DEFAULT_FONT_SIZE as p } from "./constants/index.js";
22
+ import { omit as m } from "lodash-es";
23
+ import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
24
+ import v, { useCallback as y, useEffect as b, useMemo as x, useRef as S, useState as C } from "react";
25
+ import w from "clsx";
26
+ import { LexicalComposer as T } from "@lexical/react/LexicalComposer";
27
+ import { RichTextPlugin as E } from "@lexical/react/LexicalRichTextPlugin";
28
+ import { ContentEditable as ee } from "@lexical/react/LexicalContentEditable";
29
+ import { HistoryPlugin as te } from "@lexical/react/LexicalHistoryPlugin";
30
+ import { OnChangePlugin as ne } from "@lexical/react/LexicalOnChangePlugin";
31
+ import { LexicalErrorBoundary as D } from "@lexical/react/LexicalErrorBoundary";
32
+ import { $generateHtmlFromNodes as re, $generateNodesFromDOM as ie } from "@lexical/html";
33
+ import { $applyNodeReplacement as O, $createParagraphNode as k, $getNodeByKey as A, $getRoot as j, $getRoot as M, $getSelection as N, $insertNodes as P, $isElementNode as ae, $isRangeSelection as F, $isRootOrShadowRoot as oe, $isTextNode as se, COMMAND_PRIORITY_EDITOR as ce, COMMAND_PRIORITY_LOW as le, DecoratorNode as ue, KEY_ENTER_COMMAND as de, RootNode as fe, TextNode as I } from "lexical";
34
+ import { useLexicalComposerContext as pe, useLexicalComposerContext as L } from "@lexical/react/LexicalComposerContext";
35
+ import { $getSelectionStyleValueForProperty as R, $patchStyleText as z, $trimTextContentFromAnchor as B } from "@lexical/selection";
36
+ import { $findMatchingParent as V, $restoreEditorState as me } from "@lexical/utils";
37
+ import { $isLinkNode as he, AutoLinkNode as ge, LinkNode as _e } from "@lexical/link";
38
+ import { useLexicalEditable as ve } from "@lexical/react/useLexicalEditable";
39
+ import { LinkPlugin as ye } from "@lexical/react/LexicalLinkPlugin";
39
40
  //#region src/components/Editor/utils/resolveEditorToolbarThemeVars.ts
40
41
  var H = (e) => {
41
42
  if (!(e === void 0 || e === "")) return typeof e == "number" ? `${e}px` : e;
42
- }, ve = (t) => {
43
+ }, be = (t) => {
43
44
  if (!t) return {};
44
45
  let n = {};
45
46
  return e(n, "--bsy-editor-toolbar-bg", t.bg), e(n, "--bsy-editor-toolbar-border-color", t.borderColor), e(n, "--bsy-editor-toolbar-padding", t.padding), e(n, "--bsy-editor-toolbar-gap", H(t.gap)), e(n, "--bsy-editor-toolbar-group-gap", H(t.groupGap)), e(n, "--bsy-editor-toolbar-divider-color", t.dividerColor), e(n, "--bsy-editor-toolbar-divider-size", H(t.dividerSize)), e(n, "--bsy-editor-toolbar-divider-margin", H(t.dividerMargin)), e(n, "--bsy-editor-toolbar-color-icon", t.colorIcon), e(n, "--bsy-editor-toolbar-item-hover-bg", t.itemHoverBg), e(n, "--bsy-editor-toolbar-item-hover-color", t.itemHoverColor), e(n, "--bsy-editor-toolbar-item-active-bg", t.itemActiveBg), e(n, "--bsy-editor-toolbar-item-active-color", t.itemActiveColor), e(n, "--bsy-editor-toolbar-item-padding", H(t.itemPadding)), e(n, "--bsy-editor-toolbar-item-border-radius", H(t.itemBorderRadius)), e(n, "--bsy-editor-toolbar-icon-size", H(t.iconSize)), n;
46
- }, U = (e) => {
47
+ }, xe = (e) => {
47
48
  if (typeof e == "number" && Number.isFinite(e)) return e;
48
49
  if (typeof e == "string") {
49
50
  let t = Number.parseFloat(e);
50
51
  if (Number.isFinite(t)) return t;
51
52
  }
52
53
  return 14;
53
- }, W = {
54
- "bsy-lexical__toolbar": "_bsy-lexical__toolbar_1tygc_1",
55
- "bsy-lexical__toolbar-group": "_bsy-lexical__toolbar-group_1tygc_10",
56
- "bsy-lexical__toolbar-divider": "_bsy-lexical__toolbar-divider_1tygc_16"
54
+ }, Se = (e) => {
55
+ let t = e?.placement ?? "top", n = e?.offset, r = typeof n == "number" ? 0 : n?.x ?? 0, i = typeof n == "number" ? n : n?.y ?? 0, a = t === "top", o = {
56
+ position: "absolute",
57
+ [a ? "bottom" : "top"]: "100%",
58
+ [a ? "marginBottom" : "marginTop"]: i,
59
+ left: 0,
60
+ right: 0,
61
+ width: "100%"
62
+ };
63
+ return r && (o.transform = `translateX(${r}px)`), o;
64
+ }, U = {
65
+ "bsy-lexical__toolbar": "_bsy-lexical__toolbar_3xekt_1",
66
+ "bsy-lexical__toolbar--floating": "_bsy-lexical__toolbar--floating_3xekt_10",
67
+ "bsy-lexical__toolbar-group": "_bsy-lexical__toolbar-group_3xekt_16",
68
+ "bsy-lexical__toolbar-divider": "_bsy-lexical__toolbar-divider_3xekt_22"
57
69
  };
58
70
  //#endregion
59
71
  //#region src/components/Editor/hooks/useTextFormatsState.ts
60
- function ye() {
61
- let [e] = L(), [t, n] = x({
72
+ function Ce() {
73
+ let [e] = L(), [t, n] = C({
62
74
  bold: !1,
63
75
  italic: !1,
64
76
  underline: !1,
65
- fontSize: f,
66
- fontColor: d,
67
- backgroundColor: u,
77
+ fontSize: p,
78
+ fontColor: f,
79
+ backgroundColor: d,
68
80
  align: "left",
69
81
  link: void 0
70
82
  });
71
- return v(() => e.registerUpdateListener(({ editorState: e }) => {
83
+ return b(() => e.registerUpdateListener(({ editorState: e }) => {
72
84
  e.read(() => {
73
- let e = j();
74
- if (N(e)) {
75
- let t = R(e, "font-size", f), r = R(e, "color", d), i = R(e, "background-color", u), a = e.anchor.getNode(), o = a.getKey() === "root" ? a : B(a, (e) => {
85
+ let e = N();
86
+ if (F(e)) {
87
+ let t = R(e, "font-size", p), r = R(e, "color", f), i = R(e, "background-color", d), a = e.anchor.getNode(), o = a.getKey() === "root" ? a : V(a, (e) => {
76
88
  let t = e.getParent();
77
89
  return t !== null && oe(t);
78
90
  });
79
91
  o === null && (o = a.getTopLevelElementOrThrow());
80
- let s = {}, c = B(a, pe);
92
+ let s = {}, c = V(a, he);
81
93
  c ? (s.link = c.getURL(), s.linkText = c.getTextContent(), s.newBlank = c.getTarget() === "_blank") : s.linkText = e.getTextContent(), n({
82
94
  bold: e.hasFormat("bold"),
83
95
  italic: e.hasFormat("italic"),
@@ -94,39 +106,52 @@ function ye() {
94
106
  }
95
107
  //#endregion
96
108
  //#region src/components/Editor/ToolbarPlugin/context/TextFormatProvider.tsx
97
- var be = (e) => {
98
- let t = ye();
99
- return /* @__PURE__ */ m(l.Provider, {
109
+ var we = (e) => {
110
+ let t = Ce();
111
+ return /* @__PURE__ */ g(r.Provider, {
100
112
  value: t,
101
113
  children: e.children
102
114
  });
103
- }, xe = (e) => {
104
- let { config: t = [], style: n, theme: r } = e, o = y(() => ve(r), [r]), s = y(() => ({ iconSize: U(r?.iconSize) }), [r?.iconSize]), c = (e, t) => {
105
- let n = typeof e == "string" ? e : e.name, r = a(n);
106
- return r ? typeof e == "string" ? /* @__PURE__ */ m(r, {}, `${n}-${t}`) : /* @__PURE__ */ m(r, { ...e.props }, `${n}-${t}`) : (console.warn(`[ToolbarPlugin] Button "${n}" is not registered.`), null);
115
+ }, Te = (e) => {
116
+ let { config: t = [], style: r, theme: i, mode: a, floating: s } = e, { toolbarRef: c } = n(), l = a === "floating", d = x(() => be(i), [i]), f = x(() => ({ iconSize: xe(i?.iconSize) }), [i?.iconSize]), p = l ? Se(s) : void 0, h = l ? m(r, [
117
+ "position",
118
+ "left",
119
+ "top",
120
+ "right",
121
+ "bottom",
122
+ "inset",
123
+ "transform",
124
+ "marginTop",
125
+ "marginBottom"
126
+ ]) : r, v = (e, t) => {
127
+ let n = typeof e == "string" ? e : e.name, r = o(n);
128
+ return r ? typeof e == "string" ? /* @__PURE__ */ g(r, {}, `${n}-${t}`) : /* @__PURE__ */ g(r, { ...e.props }, `${n}-${t}`) : (console.warn(`[ToolbarPlugin] Button "${n}" is not registered.`), null);
107
129
  };
108
- return /* @__PURE__ */ m(i, {
109
- value: s,
110
- children: /* @__PURE__ */ m(be, { children: /* @__PURE__ */ m("div", {
111
- className: W["bsy-lexical__toolbar"],
130
+ return /* @__PURE__ */ g(u, {
131
+ value: f,
132
+ children: /* @__PURE__ */ g(we, { children: /* @__PURE__ */ g("div", {
133
+ ref: c,
134
+ className: w(U["bsy-lexical__toolbar"], l && U["bsy-lexical__toolbar--floating"]),
112
135
  style: {
113
- ...o,
114
- ...n
136
+ ...d,
137
+ ...p,
138
+ ...h
115
139
  },
116
- children: t.map((e, n) => /* @__PURE__ */ h("div", {
117
- className: W["bsy-lexical__toolbar-group"],
140
+ children: t.map((e, n) => /* @__PURE__ */ _("div", {
141
+ className: U["bsy-lexical__toolbar-group"],
118
142
  "data-group": e.key,
119
- children: [e.buttons.map((e, t) => c(e, t)), n < t.length - 1 && /* @__PURE__ */ m("div", { className: W["bsy-lexical__toolbar-divider"] })]
143
+ children: [e.buttons.map((e, t) => v(e, t)), n < t.length - 1 && /* @__PURE__ */ g("div", { className: U["bsy-lexical__toolbar-divider"] })]
120
144
  }, e.key + n))
121
145
  }) })
122
146
  });
147
+ }, W = {
148
+ "bsy-lexical-editor": "_bsy-lexical-editor_jbc8k_1",
149
+ "bsy-lexical-editor--floating": "_bsy-lexical-editor--floating_jbc8k_7",
150
+ "bsy-lexical-editor__content-editable": "_bsy-lexical-editor__content-editable_jbc8k_10",
151
+ "bsy-lexical-editor__content-editable--with-length-badge": "_bsy-lexical-editor__content-editable--with-length-badge_jbc8k_17",
152
+ "bsy-lexical-editor__length-badge": "_bsy-lexical-editor__length-badge_jbc8k_20",
153
+ "bsy-lexical-editor__length-badge--exceeded": "_bsy-lexical-editor__length-badge--exceeded_jbc8k_36"
123
154
  }, G = {
124
- "bsy-lexical-editor": "_bsy-lexical-editor_tsu2x_1",
125
- "bsy-lexical-editor__content-editable": "_bsy-lexical-editor__content-editable_tsu2x_7",
126
- "bsy-lexical-editor__content-editable--with-length-badge": "_bsy-lexical-editor__content-editable--with-length-badge_tsu2x_14",
127
- "bsy-lexical-editor__length-badge": "_bsy-lexical-editor__length-badge_tsu2x_17",
128
- "bsy-lexical-editor__length-badge--exceeded": "_bsy-lexical-editor__length-badge--exceeded_tsu2x_33"
129
- }, K = {
130
155
  imageWrapper: "_imageWrapper_y06h3_1",
131
156
  selected: "_selected_y06h3_8",
132
157
  resizing: "_resizing_y06h3_12",
@@ -136,16 +161,16 @@ var be = (e) => {
136
161
  topRight: "_topRight_y06h3_49",
137
162
  bottomLeft: "_bottomLeft_y06h3_54",
138
163
  bottomRight: "_bottomRight_y06h3_59"
139
- }, Se = ({ src: e, altText: t, width: n, height: r, nodeKey: i }) => {
140
- let [a] = L(), [o, s] = x(!1), [c, l] = x(null), u = b(null), [d, f] = x({
164
+ }, Ee = ({ src: e, altText: t, width: n, height: r, nodeKey: i }) => {
165
+ let [a] = L(), [o, s] = C(!1), [c, l] = C(null), u = S(null), [d, f] = C({
141
166
  width: n || void 0,
142
167
  height: r || void 0
143
- }), y = _(() => {
168
+ }), p = y(() => {
144
169
  n && r && f({
145
170
  width: n,
146
171
  height: r
147
172
  });
148
- }, [n, r]), C = _((e, t) => {
173
+ }, [n, r]), m = y((e, t) => {
149
174
  if (e.preventDefault(), e.stopPropagation(), !u.current) return;
150
175
  let n = d.width || u.current.offsetWidth, r = d.height || u.current.offsetHeight, i = n / r;
151
176
  (!d.width || !d.height) && f({
@@ -160,7 +185,7 @@ var be = (e) => {
160
185
  aspectRatio: i,
161
186
  direction: t
162
187
  });
163
- }, [d]), w = _((e) => {
188
+ }, [d]), x = y((e) => {
164
189
  if (!c?.isResizing) return;
165
190
  let t = e.clientX - c.startX, n;
166
191
  switch (c.direction) {
@@ -183,10 +208,10 @@ var be = (e) => {
183
208
  width: n,
184
209
  height: r
185
210
  });
186
- }, [c]), T = _(() => {
211
+ }, [c]), T = y(() => {
187
212
  c?.isResizing && (a.update(() => {
188
- let e = k(i);
189
- Ce(e) && e.setWidthAndHeight(d.width, d.height);
213
+ let e = A(i);
214
+ De(e) && e.setWidthAndHeight(d.width, d.height);
190
215
  }), l(null));
191
216
  }, [
192
217
  a,
@@ -194,71 +219,71 @@ var be = (e) => {
194
219
  d,
195
220
  c
196
221
  ]);
197
- g.useEffect(() => {
198
- if (c?.isResizing) return document.addEventListener("mousemove", w), document.addEventListener("mouseup", T), () => {
199
- document.removeEventListener("mousemove", w), document.removeEventListener("mouseup", T);
222
+ v.useEffect(() => {
223
+ if (c?.isResizing) return document.addEventListener("mousemove", x), document.addEventListener("mouseup", T), () => {
224
+ document.removeEventListener("mousemove", x), document.removeEventListener("mouseup", T);
200
225
  };
201
226
  }, [
202
227
  c,
203
- w,
228
+ x,
204
229
  T
205
230
  ]);
206
- let E = _(() => {
231
+ let E = y(() => {
207
232
  s(!0);
208
233
  }, []);
209
- return v(() => a.registerUpdateListener(({ editorState: e }) => {
234
+ return b(() => a.registerUpdateListener(({ editorState: e }) => {
210
235
  e.read(() => {
211
- let e = j();
212
- N(e) && !e.getNodes().some((e) => e.getKey() === i || e.getParent() && e.getParent()?.getKey() === i) && o && s(!1);
236
+ let e = N();
237
+ F(e) && !e.getNodes().some((e) => e.getKey() === i || e.getParent() && e.getParent()?.getKey() === i) && o && s(!1);
213
238
  });
214
239
  }), [
215
240
  a,
216
241
  i,
217
242
  o
218
- ]), v(() => {
243
+ ]), b(() => {
219
244
  let e = (e) => {
220
245
  o && u.current && !u.current.contains(e.target) && s(!1);
221
246
  };
222
247
  if (o) return document.addEventListener("mousedown", e), () => {
223
248
  document.removeEventListener("mousedown", e);
224
249
  };
225
- }, [o]), /* @__PURE__ */ h("div", {
226
- className: S(K.imageWrapper, {
227
- [K.selected]: o,
228
- [K.resizing]: c?.isResizing
250
+ }, [o]), /* @__PURE__ */ _("div", {
251
+ className: w(G.imageWrapper, {
252
+ [G.selected]: o,
253
+ [G.resizing]: c?.isResizing
229
254
  }),
230
- children: [/* @__PURE__ */ m("img", {
255
+ children: [/* @__PURE__ */ g("img", {
231
256
  ref: u,
232
257
  src: e,
233
258
  alt: t,
234
- className: K.image,
259
+ className: G.image,
235
260
  style: {
236
261
  width: d.width,
237
262
  height: d.height
238
263
  },
239
- onLoad: y,
264
+ onLoad: p,
240
265
  onClick: E,
241
266
  draggable: !1
242
- }), o && /* @__PURE__ */ h(p, { children: [
243
- /* @__PURE__ */ m("div", {
244
- className: S(K.resizeHandle, K.bottomRight),
245
- onMouseDown: (e) => C(e, "bottom-right")
267
+ }), o && /* @__PURE__ */ _(h, { children: [
268
+ /* @__PURE__ */ g("div", {
269
+ className: w(G.resizeHandle, G.bottomRight),
270
+ onMouseDown: (e) => m(e, "bottom-right")
246
271
  }),
247
- /* @__PURE__ */ m("div", {
248
- className: S(K.resizeHandle, K.bottomLeft),
249
- onMouseDown: (e) => C(e, "bottom-left")
272
+ /* @__PURE__ */ g("div", {
273
+ className: w(G.resizeHandle, G.bottomLeft),
274
+ onMouseDown: (e) => m(e, "bottom-left")
250
275
  }),
251
- /* @__PURE__ */ m("div", {
252
- className: S(K.resizeHandle, K.topRight),
253
- onMouseDown: (e) => C(e, "top-right")
276
+ /* @__PURE__ */ g("div", {
277
+ className: w(G.resizeHandle, G.topRight),
278
+ onMouseDown: (e) => m(e, "top-right")
254
279
  }),
255
- /* @__PURE__ */ m("div", {
256
- className: S(K.resizeHandle, K.topLeft),
257
- onMouseDown: (e) => C(e, "top-left")
280
+ /* @__PURE__ */ g("div", {
281
+ className: w(G.resizeHandle, G.topLeft),
282
+ onMouseDown: (e) => m(e, "top-left")
258
283
  })
259
284
  ] })]
260
285
  });
261
- }, q = class e extends ue {
286
+ }, K = class e extends ue {
262
287
  static getType() {
263
288
  return "image";
264
289
  }
@@ -304,7 +329,7 @@ var be = (e) => {
304
329
  n.__width = e, n.__height = t;
305
330
  }
306
331
  decorate() {
307
- return /* @__PURE__ */ m(Se, {
332
+ return /* @__PURE__ */ g(Ee, {
308
333
  src: this.__src,
309
334
  altText: this.__altText,
310
335
  width: this.__width,
@@ -314,13 +339,13 @@ var be = (e) => {
314
339
  }
315
340
  static importDOM() {
316
341
  return { img: () => ({
317
- conversion: we,
342
+ conversion: Oe,
318
343
  priority: 0
319
344
  }) };
320
345
  }
321
346
  static importJSON(e) {
322
347
  let { src: t, altText: n, width: r, height: i } = e;
323
- return J({
348
+ return q({
324
349
  src: t,
325
350
  altText: n,
326
351
  width: r,
@@ -341,13 +366,13 @@ var be = (e) => {
341
366
  return !0;
342
367
  }
343
368
  };
344
- function J({ src: e, altText: t, width: n, height: r, key: i }) {
345
- return new q(e, t, n, r, i);
369
+ function q({ src: e, altText: t, width: n, height: r, key: i }) {
370
+ return new K(e, t, n, r, i);
346
371
  }
347
- function Ce(e) {
348
- return e instanceof q;
372
+ function De(e) {
373
+ return e instanceof K;
349
374
  }
350
- function we(e) {
375
+ function Oe(e) {
351
376
  if (e instanceof HTMLImageElement) {
352
377
  let { src: t, alt: n, style: r } = e, i, a;
353
378
  if (r.width) {
@@ -358,7 +383,7 @@ function we(e) {
358
383
  let e = parseInt(r.height, 10);
359
384
  isNaN(e) || (a = e);
360
385
  }
361
- return i === void 0 && e.width && (i = e.width), a === void 0 && e.height && (a = e.height), { node: J({
386
+ return i === void 0 && e.width && (i = e.width), a === void 0 && e.height && (a = e.height), { node: q({
362
387
  src: t,
363
388
  altText: n,
364
389
  width: i,
@@ -369,23 +394,23 @@ function we(e) {
369
394
  }
370
395
  //#endregion
371
396
  //#region src/components/Editor/plugins/ImagePlugin.tsx
372
- function Te() {
397
+ function ke() {
373
398
  let [e] = L();
374
- return v(() => e.registerCommand(o, (e) => (M([J(e)]), !0), ce), [e]), null;
399
+ return b(() => e.registerCommand(s, (e) => (P([q(e)]), !0), ce), [e]), null;
375
400
  }
376
401
  //#endregion
377
402
  //#region src/components/Editor/plugins/EnterKeyPlugin.tsx
378
- function Ee() {
379
- let [e] = L(), t = b(0);
380
- return v(() => e.registerCommand(P, (n) => {
403
+ function Ae() {
404
+ let [e] = L(), t = S(0);
405
+ return b(() => e.registerCommand(de, (n) => {
381
406
  let r = Date.now(), i = r - t.current;
382
407
  return t.current = r, i < 250 && i > 0 ? (e.update(() => {
383
- let e = j();
384
- if (N(e)) {
408
+ let e = N();
409
+ if (F(e)) {
385
410
  let t = e.anchor.getNode().getTopLevelElement();
386
411
  if (t && t.getTextContent().trim() === "") {
387
- let n = O();
388
- fe(e, {
412
+ let n = k();
413
+ z(e, {
389
414
  "background-color": "",
390
415
  color: "",
391
416
  "font-size": "",
@@ -402,34 +427,34 @@ function Ee() {
402
427
  }
403
428
  //#endregion
404
429
  //#region src/components/Editor/plugins/MaxLengthPlugin.tsx
405
- function De({ maxLength: e, onMaxLengthExceed: t }) {
406
- let [n] = L(), r = b(t);
407
- return r.current = t, v(() => {
430
+ function je({ maxLength: e, onMaxLengthExceed: t }) {
431
+ let [n] = L(), r = S(t);
432
+ return r.current = t, b(() => {
408
433
  let t = null;
409
- return n.registerNodeTransform(F, (i) => {
434
+ return n.registerNodeTransform(fe, (i) => {
410
435
  let a = i.getTextContentSize();
411
436
  if (a <= e) return;
412
- let o = n.getEditorState(), s = o.read(() => i.getTextContentSize()), c = a - e, l = j();
437
+ let o = n.getEditorState(), s = o.read(() => i.getTextContentSize()), c = a - e, l = N();
413
438
  if (s === e && t !== o) {
414
- t = o, V(n, o), r.current?.();
439
+ t = o, me(n, o), r.current?.();
415
440
  return;
416
441
  }
417
- if (N(l) && l.isCollapsed()) {
418
- z(n, l.anchor, c), r.current?.();
442
+ if (F(l) && l.isCollapsed()) {
443
+ B(n, l.anchor, c), r.current?.();
419
444
  return;
420
445
  }
421
446
  i.selectEnd();
422
- let u = j();
423
- N(u) && (z(n, u.anchor, c), r.current?.());
447
+ let u = N();
448
+ F(u) && (B(n, u.anchor, c), r.current?.());
424
449
  });
425
450
  }, [n, e]), null;
426
451
  }
427
452
  //#endregion
428
453
  //#region src/components/Editor/LengthBadge.tsx
429
- var Y = ({ current: e, maxLength: t }) => {
454
+ var J = ({ current: e, maxLength: t }) => {
430
455
  let n = e > t;
431
- return /* @__PURE__ */ h("div", {
432
- className: S(G["bsy-lexical-editor__length-badge"], n && G["bsy-lexical-editor__length-badge--exceeded"]),
456
+ return /* @__PURE__ */ _("div", {
457
+ className: w(W["bsy-lexical-editor__length-badge"], n && W["bsy-lexical-editor__length-badge--exceeded"]),
433
458
  "aria-live": "polite",
434
459
  children: [
435
460
  e,
@@ -438,22 +463,22 @@ var Y = ({ current: e, maxLength: t }) => {
438
463
  ]
439
464
  });
440
465
  };
441
- Y.displayName = "BsyLexicalEditorLengthBadge";
466
+ J.displayName = "BsyLexicalEditorLengthBadge";
442
467
  //#endregion
443
468
  //#region src/components/Editor/utils/textLength.ts
444
- function Oe(e) {
469
+ function Y(e) {
445
470
  return typeof e == "number" && Number.isFinite(e) && e > 0;
446
471
  }
447
- function ke(e, t) {
448
- let n = A(), r = n.getTextContentSize();
472
+ function Me(e, t) {
473
+ let n = M(), r = n.getTextContentSize();
449
474
  if (r <= t) return !1;
450
475
  let i = r - t;
451
476
  n.selectEnd();
452
- let a = j();
453
- return N(a) ? z(e, a.anchor, i) : Ae(i), !0;
477
+ let a = N();
478
+ return F(a) ? B(e, a.anchor, i) : Ne(i), !0;
454
479
  }
455
- function Ae(e) {
456
- let t = e, n = A().getAllTextNodes();
480
+ function Ne(e) {
481
+ let t = e, n = M().getAllTextNodes();
457
482
  for (let e = n.length - 1; e >= 0 && t > 0; e--) {
458
483
  let r = n[e], i = r.getTextContent();
459
484
  i.length !== 0 && (i.length <= t ? (t -= i.length, r.remove()) : (r.setTextContent(i.slice(0, i.length - t)), t = 0));
@@ -462,15 +487,16 @@ function Ae(e) {
462
487
  //#endregion
463
488
  //#region src/components/Editor/EditorCore.tsx
464
489
  var X = (e) => {
465
- let { height: t = 126, onChange: n, toolbar: r, theme: i, maxLength: a, onMaxLengthExceed: o } = e, [s] = L(), l = b(null), u = b(null), d = b(o);
466
- d.current = o;
467
- let f = Oe(a) ? a : void 0, [p, g] = x(0), C = y(() => ({
468
- containerRef: l,
469
- getPopupContainer: () => l.current || document.body
470
- }), []), D = _((e) => {
490
+ let { height: t = 126, onChange: n, toolbar: r, theme: i, maxLength: a, onMaxLengthExceed: o } = e, [s] = L(), c = S(null), u = S(null), d = S(null), f = S(o);
491
+ f.current = o;
492
+ let p = Y(a) ? a : void 0, [m, h] = C(0), v = r?.mode === "floating", T = x(() => ({
493
+ containerRef: c,
494
+ toolbarRef: u,
495
+ getPopupContainer: () => v && u.current ? u.current : c.current || document.body
496
+ }), [v]), O = y((e) => {
471
497
  e.read(() => {
472
- let t = A().getTextContent(), r = ne(s, null), i = !t.trim() && (r === "<p><br></p>" || r === "<p></p>" || r === "" || /^<p>\s*<br>\s*<\/p>$/.test(r)) ? null : r;
473
- u.current = i, f !== void 0 && g(t.length), n({
498
+ let t = M().getTextContent(), r = re(s, null), i = !t.trim() && (r === "<p><br></p>" || r === "<p></p>" || r === "" || /^<p>\s*<br>\s*<\/p>$/.test(r)) ? null : r;
499
+ d.current = i, p !== void 0 && h(t.length), n({
474
500
  text: t,
475
501
  html: i
476
502
  }, e);
@@ -478,62 +504,64 @@ var X = (e) => {
478
504
  }, [
479
505
  n,
480
506
  s,
481
- f
507
+ p
482
508
  ]);
483
- v(() => {
484
- f !== void 0 && s.getEditorState().read(() => {
485
- g(A().getTextContentSize());
509
+ b(() => {
510
+ p !== void 0 && s.getEditorState().read(() => {
511
+ h(M().getTextContentSize());
486
512
  }, { editor: s });
487
- }, [s, f]), v(() => {
488
- if (e.value !== void 0 && e.value !== u.current) {
513
+ }, [s, p]), b(() => {
514
+ if (e.value !== void 0 && e.value !== d.current) {
489
515
  let t = !1;
490
516
  s.update(() => {
491
- A().clear(), e.value && e.value.trim() && (M(re(s, new DOMParser().parseFromString(e.value, "text/html"))), f !== void 0 && (t = ke(s, f)));
492
- }), t && d.current?.();
517
+ M().clear(), e.value && e.value.trim() && (P(ie(s, new DOMParser().parseFromString(e.value, "text/html"))), p !== void 0 && (t = Me(s, p)));
518
+ }), t && f.current?.();
493
519
  }
494
520
  }, [
495
521
  e.value,
496
522
  s,
497
- f
523
+ p
498
524
  ]);
499
- let O = r?.config?.length ? r?.config : [], k = ge();
500
- return /* @__PURE__ */ m(c.Provider, {
501
- value: C,
502
- children: /* @__PURE__ */ h("div", {
503
- ref: l,
504
- className: G["bsy-lexical-editor"],
525
+ let k = r?.config?.length ? r?.config : [], A = ve();
526
+ return /* @__PURE__ */ g(l.Provider, {
527
+ value: T,
528
+ children: /* @__PURE__ */ _("div", {
529
+ ref: c,
530
+ className: w(W["bsy-lexical-editor"], v && W["bsy-lexical-editor--floating"]),
505
531
  onClick: (e) => {
506
532
  let t = s.getRootElement(), n = e.target;
507
533
  !t || !n || !t.contains(n) || s.isEditable() || s.setEditable(!0);
508
534
  },
509
535
  children: [
510
- O.length > 0 && /* @__PURE__ */ m(xe, {
511
- config: O,
536
+ k.length > 0 && /* @__PURE__ */ g(Te, {
537
+ config: k,
512
538
  theme: i?.toolbar,
513
- style: r?.style
539
+ style: r?.style,
540
+ mode: r?.mode,
541
+ floating: r?.floating
514
542
  }),
515
- /* @__PURE__ */ m(w, {
516
- contentEditable: /* @__PURE__ */ m(T, {
517
- className: S(G["bsy-lexical-editor__content-editable"], f !== void 0 && G["bsy-lexical-editor__content-editable--with-length-badge"]),
543
+ /* @__PURE__ */ g(E, {
544
+ contentEditable: /* @__PURE__ */ g(ee, {
545
+ className: w(W["bsy-lexical-editor__content-editable"], p !== void 0 && W["bsy-lexical-editor__content-editable--with-length-badge"]),
518
546
  style: {
519
547
  height: t,
520
- cursor: k ? "auto" : "text"
548
+ cursor: A ? "auto" : "text"
521
549
  }
522
550
  }),
523
- ErrorBoundary: te
551
+ ErrorBoundary: D
524
552
  }),
525
- /* @__PURE__ */ m(_e, {}),
526
- /* @__PURE__ */ m(Te, {}),
527
- /* @__PURE__ */ m(Ee, {}),
528
- f !== void 0 && /* @__PURE__ */ m(De, {
529
- maxLength: f,
553
+ /* @__PURE__ */ g(ye, {}),
554
+ /* @__PURE__ */ g(ke, {}),
555
+ /* @__PURE__ */ g(Ae, {}),
556
+ p !== void 0 && /* @__PURE__ */ g(je, {
557
+ maxLength: p,
530
558
  onMaxLengthExceed: o
531
559
  }),
532
- /* @__PURE__ */ m(E, {}),
533
- /* @__PURE__ */ m(ee, { onChange: D }),
534
- f !== void 0 && /* @__PURE__ */ m(Y, {
535
- current: p,
536
- maxLength: f
560
+ /* @__PURE__ */ g(te, {}),
561
+ /* @__PURE__ */ g(ne, { onChange: O }),
562
+ p !== void 0 && /* @__PURE__ */ g(J, {
563
+ current: m,
564
+ maxLength: p
537
565
  })
538
566
  ]
539
567
  })
@@ -583,14 +611,14 @@ var Z = class e extends I {
583
611
  };
584
612
  }
585
613
  static importJSON(e) {
586
- return je().updateFromJSON(e);
614
+ return Pe().updateFromJSON(e);
587
615
  }
588
616
  isSimpleText() {
589
617
  return this.__type === "extended-text" && this.__mode === 0;
590
618
  }
591
619
  };
592
- function je(e = "") {
593
- return D(new Z(e));
620
+ function Pe(e = "") {
621
+ return O(new Z(e));
594
622
  }
595
623
  function Q(e) {
596
624
  return (t) => {
@@ -623,8 +651,8 @@ function Q(e) {
623
651
  //#region src/components/Editor/Editor.tsx
624
652
  var $ = (e) => {
625
653
  let { autoFocus: t = !1 } = e;
626
- return /* @__PURE__ */ m(C, {
627
- initialConfig: y(() => ({
654
+ return /* @__PURE__ */ g(T, {
655
+ initialConfig: x(() => ({
628
656
  namespace: "bsyLexicalEditor",
629
657
  onError: (e) => {
630
658
  console.error("Lexical error", e);
@@ -639,9 +667,9 @@ var $ = (e) => {
639
667
  link: "editor-link"
640
668
  },
641
669
  nodes: [
642
- he,
643
- me,
644
- q,
670
+ _e,
671
+ ge,
672
+ K,
645
673
  Z,
646
674
  {
647
675
  replace: I,
@@ -650,9 +678,9 @@ var $ = (e) => {
650
678
  }
651
679
  ]
652
680
  }), [t]),
653
- children: /* @__PURE__ */ m(X, { ...e })
681
+ children: /* @__PURE__ */ g(X, { ...e })
654
682
  });
655
683
  };
656
684
  $.displayName = "BsyLexicalEditor";
657
685
  //#endregion
658
- export { ie as $getRoot, n as BaseButton, $ as default, s as listRegisteredToolbarButtons, r as registerToolbarButton, t as unregisterToolbarButton, de as useLexicalComposerContext };
686
+ export { j as $getRoot, a as BaseButton, $ as default, c as listRegisteredToolbarButtons, i as registerToolbarButton, t as unregisterToolbarButton, pe as useLexicalComposerContext };