@logora/debate 0.3.108 → 0.3.110

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.
@@ -1,10 +1,6 @@
1
- import { jsxs as l, jsx as e } from "react/jsx-runtime";
1
+ import { jsx as e } from "react/jsx-runtime";
2
2
  import "react";
3
- const h = (i) => /* @__PURE__ */ l("svg", { ...i, viewBox: "0 0 34 35", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
4
- /* @__PURE__ */ e("rect", { width: "34", height: "35", rx: "17", fill: "white" }),
5
- /* @__PURE__ */ e("rect", { width: "34", height: "35", rx: "17", fill: "#D70026" }),
6
- /* @__PURE__ */ e("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M22.923 11.3652L9.0284 16.537L13.6573 19.295L17.739 15.0921C17.946 14.8791 18.2268 14.7595 18.5195 14.7596C18.8122 14.7598 19.0929 14.8796 19.2998 15.0927C19.5067 15.3058 19.6229 15.5949 19.6228 15.8962C19.6227 16.1975 19.5063 16.4864 19.2993 16.6994L15.2165 20.9022L17.8979 25.6662L22.923 11.3652ZM23.2794 8.81629C24.598 8.32445 25.8758 9.63982 25.398 10.9972L19.5696 27.587C19.0907 28.9478 17.2855 29.1137 16.5804 27.8608L13.0306 21.5474L6.89765 17.8933C5.68055 17.1674 5.84165 15.3091 7.16358 14.8161L23.2794 8.81629Z", fill: "white" })
7
- ] });
3
+ const L = (l) => /* @__PURE__ */ e("svg", { ...l, viewBox: "0 0 34 35", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ e("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M22.923 11.3652L9.0284 16.537L13.6573 19.295L17.739 15.0921C17.946 14.8791 18.2268 14.7595 18.5195 14.7596C18.8122 14.7598 19.0929 14.8796 19.2998 15.0927C19.5067 15.3058 19.6229 15.5949 19.6228 15.8962C19.6227 16.1975 19.5063 16.4864 19.2993 16.6994L15.2165 20.9022L17.8979 25.6662L22.923 11.3652ZM23.2794 8.81629C24.598 8.32445 25.8758 9.63982 25.398 10.9972L19.5696 27.587C19.0907 28.9478 17.2855 29.1137 16.5804 27.8608L13.0306 21.5474L6.89765 17.8933C5.68055 17.1674 5.84165 15.3091 7.16358 14.8161L23.2794 8.81629Z", fill: "currentColor" }) });
8
4
  export {
9
- h as Send
5
+ L as Send
10
6
  };
@@ -1,86 +1,96 @@
1
1
  import { jsxs as y, jsx as o } from "react/jsx-runtime";
2
- import { $isListNode as B, ListNode as $, INSERT_ORDERED_LIST_COMMAND as q, REMOVE_LIST_COMMAND as K } from "@lexical/list";
3
- import { useLexicalComposerContext as F } from "@lexical/react/LexicalComposerContext";
4
- import { $isHeadingNode as U, $createQuoteNode as T } from "@lexical/rich-text";
2
+ import { $isListNode as q, ListNode as $, INSERT_ORDERED_LIST_COMMAND as K, REMOVE_LIST_COMMAND as F } from "@lexical/list";
3
+ import { useLexicalComposerContext as U } from "@lexical/react/LexicalComposerContext";
4
+ import { $isHeadingNode as P, $createQuoteNode as k } from "@lexical/rich-text";
5
5
  import { $setBlocksType as C } from "@lexical/selection";
6
- import { $getNearestNodeOfType as P, mergeRegister as j } from "@lexical/utils";
6
+ import { $getNearestNodeOfType as j, mergeRegister as H } from "@lexical/utils";
7
7
  import a from "classnames";
8
- import { $getSelection as f, $isRangeSelection as p, SELECTION_CHANGE_COMMAND as H, FORMAT_TEXT_COMMAND as N, $createParagraphNode as Q } from "lexical";
9
- import { useRef as G, useState as u, useCallback as V, useEffect as X } from "react";
10
- import { useIntl as z } from "react-intl";
8
+ import { $getSelection as N, $isRangeSelection as M, SELECTION_CHANGE_COMMAND as Q, FORMAT_TEXT_COMMAND as G, $createParagraphNode as V } from "lexical";
9
+ import { useRef as X, useState as u, useCallback as z, useEffect as J } from "react";
10
+ import { useIntl as W } from "react-intl";
11
11
  import e from "./ToolbarPlugin.module.scss.js";
12
12
  import { Icon as r } from "../../../icons/icon/Icon.js";
13
- import { Button as J } from "../../../action/button/Button.js";
14
- const ue = (l) => {
15
- const s = z(), k = 1, [i] = F(), I = G(null), [b, _] = u("paragraph"), [W, x] = u(null), [E, A] = u(!1), [S, v] = u(!1), [w, L] = u(!1), M = l.hideSubmit && l.hideSourceAction && l.disableRichText, h = V(() => {
16
- const t = f();
17
- if (p(t)) {
18
- const d = t.anchor.getNode(), n = d.getKey() === "root" ? d : d.getTopLevelElementOrThrow(), m = n.getKey();
19
- if (i.getElementByKey(m) !== null)
20
- if (x(m), B(n)) {
21
- const g = P(d, $), R = g ? g.getTag() : n.getTag();
22
- _(R);
13
+ import { Button as Y } from "../../../action/button/Button.js";
14
+ const ge = (i) => {
15
+ const s = W(), x = 1, [l] = U(), E = X(null), [b, _] = u("paragraph"), [Z, I] = u(null), [A, S] = u(!1), [v, w] = u(!1), [L, D] = u(!1), T = i.hideSubmit && i.hideSourceAction && i.disableRichText, g = z(() => {
16
+ const t = N();
17
+ if (M(t)) {
18
+ const c = t.anchor.getNode(), n = c.getKey() === "root" ? c : c.getTopLevelElementOrThrow(), m = n.getKey();
19
+ if (l.getElementByKey(m) !== null)
20
+ if (I(m), q(n)) {
21
+ const f = j(c, $), B = f ? f.getTag() : n.getTag();
22
+ _(B);
23
23
  } else {
24
- const g = U(n) ? n.getTag() : n.getType();
25
- _(g);
24
+ const f = P(n) ? n.getTag() : n.getType();
25
+ _(f);
26
26
  }
27
- A(t.hasFormat("bold")), v(t.hasFormat("italic")), L(t.hasFormat("underline"));
27
+ S(t.hasFormat("bold")), w(t.hasFormat("italic")), D(t.hasFormat("underline"));
28
28
  }
29
- }, [i]);
30
- X(() => j(
31
- i.registerUpdateListener(({ editorState: t }) => {
29
+ }, [l]);
30
+ J(() => H(
31
+ l.registerUpdateListener(({ editorState: t }) => {
32
32
  t.read(() => {
33
- h();
33
+ g();
34
34
  });
35
35
  }),
36
- i.registerCommand(
37
- H,
38
- (t, d) => (h(), !1),
39
- k
36
+ l.registerCommand(
37
+ Q,
38
+ (t, c) => (g(), !1),
39
+ x
40
40
  )
41
- ), [i, h]);
42
- const c = (t) => {
41
+ ), [l, g]);
42
+ const d = (t) => {
43
43
  t.preventDefault();
44
- }, D = () => {
45
- b !== "ol" ? i.dispatchCommand(q) : i.dispatchCommand(K);
44
+ }, h = () => {
45
+ queueMicrotask(() => {
46
+ requestAnimationFrame(() => {
47
+ l.getEditorState().read(() => {
48
+ g();
49
+ });
50
+ });
51
+ });
52
+ }, p = (t) => {
53
+ l.dispatchCommand(G, t), h();
46
54
  }, O = () => {
47
- b !== "quote" ? i.update(() => {
48
- const t = f();
49
- if (p(t))
55
+ b !== "ol" ? l.dispatchCommand(K) : l.dispatchCommand(F), h();
56
+ }, R = () => {
57
+ b !== "quote" ? l.update(() => {
58
+ const t = N();
59
+ if (M(t))
50
60
  if (t.isCollapsed()) {
51
- const n = t.anchor.getNode().getTopLevelElementOrThrow(), m = T();
61
+ const n = t.anchor.getNode().getTopLevelElementOrThrow(), m = k();
52
62
  n.insertAfter(m), m.selectEnd();
53
63
  } else
54
- C(t, () => T());
55
- }) : i.update(() => {
56
- const t = f();
57
- p(t) && C(t, () => Q());
58
- });
64
+ C(t, () => k());
65
+ }) : l.update(() => {
66
+ const t = N();
67
+ M(t) && C(t, () => V());
68
+ }), h();
59
69
  };
60
- return M ? null : /* @__PURE__ */ y(
70
+ return T ? null : /* @__PURE__ */ y(
61
71
  "div",
62
72
  {
63
73
  className: a(e.toolbar, {
64
- [e.toolbarIsActive]: M ? !1 : l.isActive
74
+ [e.toolbarIsActive]: T ? !1 : i.isActive
65
75
  }),
66
- ref: I,
76
+ ref: E,
67
77
  children: [
68
- l.isActive ? !l.disableRichText && /* @__PURE__ */ y(
78
+ i.isActive ? !i.disableRichText && /* @__PURE__ */ y(
69
79
  "div",
70
80
  {
71
81
  className: a(e.iconToolbar, {
72
- [e.shortBar]: l.shortBar
82
+ [e.shortBar]: i.shortBar
73
83
  }),
74
84
  children: [
75
85
  /* @__PURE__ */ o(
76
86
  "button",
77
87
  {
78
- onMouseDown: c,
88
+ onMouseDown: d,
79
89
  onClick: () => {
80
- i.dispatchCommand(N, "bold");
90
+ p("bold");
81
91
  },
82
92
  type: "button",
83
- className: a(e.toolbarItem, { [e.active]: E }),
93
+ className: a(e.toolbarItem, { [e.active]: A }),
84
94
  "data-testid": "format-bold",
85
95
  "aria-label": s.formatMessage({
86
96
  id: "input.text_editor.plugins.toolbar_plugin.bold.aria_label",
@@ -100,13 +110,13 @@ const ue = (l) => {
100
110
  /* @__PURE__ */ o(
101
111
  "button",
102
112
  {
103
- onMouseDown: c,
113
+ onMouseDown: d,
104
114
  onClick: () => {
105
- i.dispatchCommand(N, "italic");
115
+ p("italic");
106
116
  },
107
117
  type: "button",
108
118
  className: a(e.toolbarItem, {
109
- [e.active]: S
119
+ [e.active]: v
110
120
  }),
111
121
  "aria-label": s.formatMessage({
112
122
  id: "input.text_editor.plugins.toolbar_plugin.italic.aria_label",
@@ -126,13 +136,13 @@ const ue = (l) => {
126
136
  /* @__PURE__ */ o(
127
137
  "button",
128
138
  {
129
- onMouseDown: c,
139
+ onMouseDown: d,
130
140
  onClick: () => {
131
- i.dispatchCommand(N, "underline");
141
+ p("underline");
132
142
  },
133
143
  type: "button",
134
144
  className: a(e.toolbarItem, {
135
- [e.active]: w
145
+ [e.active]: L
136
146
  }),
137
147
  "aria-label": s.formatMessage({
138
148
  id: "input.text_editor.plugins.toolbar_plugin.underline.aria_label",
@@ -152,8 +162,8 @@ const ue = (l) => {
152
162
  /* @__PURE__ */ o(
153
163
  "button",
154
164
  {
155
- onMouseDown: c,
156
- onClick: () => O(),
165
+ onMouseDown: d,
166
+ onClick: () => R(),
157
167
  type: "button",
158
168
  className: a(e.toolbarItem, { [e.active]: b === "quote" }),
159
169
  "aria-label": s.formatMessage({
@@ -174,8 +184,8 @@ const ue = (l) => {
174
184
  /* @__PURE__ */ o(
175
185
  "button",
176
186
  {
177
- onMouseDown: c,
178
- onClick: () => D(),
187
+ onMouseDown: d,
188
+ onClick: () => O(),
179
189
  type: "button",
180
190
  className: a(e.toolbarItem, { [e.active]: b === "ol" }),
181
191
  "aria-label": s.formatMessage({
@@ -193,10 +203,10 @@ const ue = (l) => {
193
203
  )
194
204
  }
195
205
  ),
196
- !l.hideSourceAction && /* @__PURE__ */ o(
206
+ !i.hideSourceAction && /* @__PURE__ */ o(
197
207
  "button",
198
208
  {
199
- onClick: l.onAddSource,
209
+ onClick: i.onAddSource,
200
210
  type: "button",
201
211
  className: e.toolbarItem,
202
212
  "aria-label": s.formatMessage({
@@ -217,12 +227,12 @@ const ue = (l) => {
217
227
  ]
218
228
  }
219
229
  ) : null,
220
- /* @__PURE__ */ o("div", { className: e.actionButton, children: l.hideSubmit ? null : /* @__PURE__ */ o(
221
- J,
230
+ /* @__PURE__ */ o("div", { className: e.actionButton, children: i.hideSubmit ? null : /* @__PURE__ */ o(
231
+ Y,
222
232
  {
223
233
  type: "button",
224
234
  "data-testid": "submit-button",
225
- handleClick: l.onSubmit,
235
+ handleClick: i.onSubmit,
226
236
  className: a(e.inputSubmitActionButton, e.submitAction),
227
237
  "aria-label": s.formatMessage({
228
238
  id: "input.text_editor.plugins.toolbar_plugin.submit_button.aria_label",
@@ -236,5 +246,5 @@ const ue = (l) => {
236
246
  );
237
247
  };
238
248
  export {
239
- ue as ToolbarPlugin
249
+ ge as ToolbarPlugin
240
250
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logora/debate",
3
- "version": "0.3.108",
3
+ "version": "0.3.110",
4
4
  "type": "module",
5
5
  "license": "AGPL-3.0",
6
6
  "description": "Design system of @Logora made with React",