@logora/debate 0.4.23 → 0.4.25

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.
@@ -0,0 +1 @@
1
+ ._toolbar_13b6u_3{display:flex!important;justify-content:space-between!important;flex-wrap:wrap;background:var(--background-color-primary, white);padding-top:var(--spacer-md, calc(var(--space-unit, 1em) * .75))!important;vertical-align:middle;align-items:flex-start;gap:var(--space-unit, 1em)}._toolbar_13b6u_3._toolbarIsActive_13b6u_13{border-top:1px solid var(--text-tertiary, #fafafa)}._iconToolbar_13b6u_17{display:flex!important;gap:var(--spacer-lg, calc(var(--space-unit, 1em) * 1.5))}._iconToolbar_13b6u_17._shortBar_13b6u_21{gap:var(--spacer-md, calc(var(--space-unit, 1em) * .75))}._toolbarItem_13b6u_25{border:0;background:none;padding:0!important;cursor:pointer;vertical-align:middle;touch-action:manipulation;display:flex;align-items:center;justify-content:center}@media(max-width:576px){._toolbarItem_13b6u_25{min-width:44px;min-height:44px}}._toolbarItem_13b6u_25._disabled_13b6u_42{cursor:not-allowed}._toolbarItem_13b6u_25._active_13b6u_45{background-color:#bababa66;border-radius:50%}._toolbarItem_13b6u_25 ._format_13b6u_49{background-size:contain;display:inline-block;vertical-align:-.25em;display:flex!important}._actionButton_13b6u_56{display:flex!important;gap:var(--space-unit, 1em);margin-left:auto}._inputSubmitActionButton_13b6u_62{width:100%;height:35px;display:flex!important;justify-content:center!important;align-items:center!important;background-color:var(--call-primary-color, #434343)!important}._inputSubmitActionButton_13b6u_62._submitAction_13b6u_70 svg{fill:var(--text-light, white)!important}._inputSubmitActionButton_13b6u_62 ._inputSourceText_13b6u_73{display:none!important;margin-left:var(--spacer-sm, calc(var(--space-unit, 1em) * .5))!important;font-size:var(--font-size-small, 16px)}@container (min-width: 576px){._inputSubmitActionButton_13b6u_62 ._inputSourceText_13b6u_73{display:block!important}}._tooltip_13b6u_84{width:230px!important;margin-left:-117px!important}
@@ -1,129 +1,130 @@
1
- import { jsxs as L, jsx as i } from "react/jsx-runtime";
2
- import { $isListNode as k, ListNode as z, INSERT_ORDERED_LIST_COMMAND as G, $isListItemNode as w, $createListNode as X } from "@lexical/list";
1
+ import { jsxs as w, jsx as i } from "react/jsx-runtime";
2
+ import { $isListNode as A, ListNode as z, INSERT_ORDERED_LIST_COMMAND as G, $isListItemNode as E, $createListNode as X } from "@lexical/list";
3
3
  import { useLexicalComposerContext as J } from "@lexical/react/LexicalComposerContext";
4
- import { $isHeadingNode as W, $createQuoteNode as A } from "@lexical/rich-text";
5
- import { $setBlocksType as v } from "@lexical/selection";
4
+ import { $isHeadingNode as W, $createQuoteNode as D } from "@lexical/rich-text";
5
+ import { $setBlocksType as O } from "@lexical/selection";
6
6
  import { $getNearestNodeOfType as Y, mergeRegister as Z } from "@lexical/utils";
7
7
  import a from "classnames";
8
- import { $getSelection as N, $isRangeSelection as _, SELECTION_CHANGE_COMMAND as ee, FORMAT_TEXT_COMMAND as te, $createParagraphNode as E } from "lexical";
8
+ import { $getSelection as N, $isRangeSelection as T, SELECTION_CHANGE_COMMAND as ee, FORMAT_TEXT_COMMAND as te, $createParagraphNode as B } from "lexical";
9
9
  import { useRef as oe, useState as g, useCallback as ie, useEffect as ae } from "react";
10
10
  import { useIntl as ne } from "react-intl";
11
11
  import e from "./ToolbarPlugin.module.scss.js";
12
- import { Icon as u } from "../../../icons/icon/Icon.js";
12
+ import { Icon as b } from "../../../icons/icon/Icon.js";
13
13
  import { Button as le } from "../../../action/button/Button.js";
14
- const ye = (n) => {
15
- const r = ne(), D = 1, [l] = J(), O = oe(null), [h, I] = g("paragraph"), [se, P] = g(null), [B, R] = g(!1), [$, q] = g(!1), [K, F] = g(!1), S = n.hideSubmit && n.hideSourceAction && n.disableRichText, p = ie(() => {
14
+ const _e = (s) => {
15
+ const d = ne(), R = 1, [r] = J(), $ = oe(null), [h, I] = g("paragraph"), [se, q] = g(null), [K, x] = g(!1), [P, C] = g(!1), [F, L] = g(!1), k = s.hideSubmit && s.hideSourceAction && s.disableRichText, p = ie(() => {
16
16
  const t = N();
17
- if (_(t)) {
18
- const c = t.anchor.getNode(), s = c.getKey() === "root" ? c : c.getTopLevelElementOrThrow(), d = s.getKey();
19
- if (l.getElementByKey(d) !== null)
20
- if (P(d), k(s)) {
21
- const o = Y(c, z), f = o ? o.getTag() : s.getTag();
17
+ if (T(t)) {
18
+ const n = t.anchor.getNode(), c = n.getKey() === "root" ? n : n.getTopLevelElementOrThrow(), u = c.getKey();
19
+ if (r.getElementByKey(u) !== null)
20
+ if (q(u), A(c)) {
21
+ const o = Y(n, z), f = o ? o.getTag() : c.getTag();
22
22
  I(f);
23
23
  } else {
24
- const o = W(s) ? s.getTag() : s.getType();
24
+ const o = W(c) ? c.getTag() : c.getType();
25
25
  I(o);
26
26
  }
27
- R(t.hasFormat("bold")), q(t.hasFormat("italic")), F(t.hasFormat("underline"));
27
+ x(t.hasFormat("bold")), C(t.hasFormat("italic")), L(t.hasFormat("underline"));
28
28
  }
29
- }, [l]);
29
+ }, [r]);
30
30
  ae(() => Z(
31
- l.registerUpdateListener(({ editorState: t }) => {
31
+ r.registerUpdateListener(({ editorState: t }) => {
32
32
  t.read(() => {
33
33
  p();
34
34
  });
35
35
  }),
36
- l.registerCommand(
36
+ r.registerCommand(
37
37
  ee,
38
38
  () => (p(), !1),
39
- D
39
+ R
40
40
  )
41
- ), [l, p]);
42
- const b = (t) => {
43
- t.pointerType !== "touch" && t.pointerType !== "pen" && t.preventDefault();
44
- }, x = () => {
41
+ ), [r, p]);
42
+ const l = (t) => {
43
+ t.preventDefault();
44
+ }, M = () => {
45
45
  setTimeout(() => {
46
- l.getEditorState().read(() => {
46
+ r.getEditorState().read(() => {
47
47
  p();
48
48
  });
49
49
  }, 0);
50
- }, T = (t) => {
51
- l.dispatchCommand(te, t);
50
+ }, _ = (t) => {
51
+ r.dispatchCommand(te, t), t === "bold" && x((n) => !n), t === "italic" && C((n) => !n), t === "underline" && L((n) => !n), M();
52
52
  }, U = () => {
53
- l.update(() => {
53
+ r.update(() => {
54
54
  const t = N();
55
- if (!_(t))
55
+ if (!T(t))
56
56
  return;
57
- const c = t.getNodes(), s = /* @__PURE__ */ new Set();
58
- for (const m of c) {
57
+ const n = t.getNodes(), c = /* @__PURE__ */ new Set();
58
+ for (const m of n) {
59
59
  let o = m;
60
- for (; o !== null && !w(o); )
60
+ for (; o !== null && !E(o); )
61
61
  o = o.getParent();
62
- w(o) && s.add(o);
62
+ E(o) && c.add(o);
63
63
  }
64
- const d = Array.from(s).reverse();
65
- for (const m of d) {
64
+ const u = Array.from(c).reverse();
65
+ for (const m of u) {
66
66
  const o = m.getParent();
67
- if (!k(o))
67
+ if (!A(o))
68
68
  continue;
69
- const f = E(), Q = m.getChildren();
70
- for (const M of Q)
71
- f.append(M);
72
- const y = m.getNextSiblings();
73
- if (o.insertAfter(f), y.length > 0) {
74
- const M = y[0].getValue(), C = X(o.getListType(), M);
75
- for (const V of y)
76
- C.append(V);
77
- f.insertAfter(C);
69
+ const f = B(), Q = m.getChildren();
70
+ for (const y of Q)
71
+ f.append(y);
72
+ const S = m.getNextSiblings();
73
+ if (o.insertAfter(f), S.length > 0) {
74
+ const y = S[0].getValue(), v = X(o.getListType(), y);
75
+ for (const V of S)
76
+ v.append(V);
77
+ f.insertAfter(v);
78
78
  }
79
79
  m.remove(), o.getChildrenSize() === 0 && o.remove();
80
80
  }
81
81
  });
82
82
  }, j = () => {
83
- h !== "ol" ? l.dispatchCommand(G) : U(), x();
83
+ h !== "ol" ? r.dispatchCommand(G) : U(), M();
84
84
  }, H = () => {
85
- h !== "quote" ? l.update(() => {
85
+ h !== "quote" ? r.update(() => {
86
86
  const t = N();
87
- if (_(t))
87
+ if (T(t))
88
88
  if (t.isCollapsed()) {
89
- const s = t.anchor.getNode().getTopLevelElementOrThrow(), d = A();
90
- s.insertAfter(d), d.selectEnd();
89
+ const c = t.anchor.getNode().getTopLevelElementOrThrow(), u = D();
90
+ c.insertAfter(u), u.selectEnd();
91
91
  } else
92
- v(t, () => A());
93
- }) : l.update(() => {
92
+ O(t, () => D());
93
+ }) : r.update(() => {
94
94
  const t = N();
95
- _(t) && v(t, () => E());
96
- }), x();
95
+ T(t) && O(t, () => B());
96
+ }), M();
97
97
  };
98
- return S ? null : /* @__PURE__ */ L(
98
+ return k ? null : /* @__PURE__ */ w(
99
99
  "div",
100
100
  {
101
101
  className: a(e.toolbar, {
102
- [e.toolbarIsActive]: S ? !1 : n.isActive
102
+ [e.toolbarIsActive]: k ? !1 : s.isActive
103
103
  }),
104
- ref: O,
104
+ ref: $,
105
105
  children: [
106
- n.isActive ? !n.disableRichText && /* @__PURE__ */ L(
106
+ s.isActive ? !s.disableRichText && /* @__PURE__ */ w(
107
107
  "div",
108
108
  {
109
109
  className: a(e.iconToolbar, {
110
- [e.shortBar]: n.shortBar
110
+ [e.shortBar]: s.shortBar
111
111
  }),
112
112
  children: [
113
113
  /* @__PURE__ */ i(
114
114
  "button",
115
115
  {
116
- onPointerDown: b,
117
- onClick: () => T("bold"),
116
+ onTouchStart: l,
117
+ onMouseDown: l,
118
+ onClick: () => _("bold"),
118
119
  type: "button",
119
- className: a(e.toolbarItem, { [e.active]: B }),
120
+ className: a(e.toolbarItem, { [e.active]: K }),
120
121
  "data-testid": "format-bold",
121
- "aria-label": r.formatMessage({
122
+ "aria-label": d.formatMessage({
122
123
  id: "input.text_editor.plugins.toolbar_plugin.bold.aria_label",
123
124
  defaultMessage: "Make text bold"
124
125
  }),
125
126
  children: /* @__PURE__ */ i(
126
- u,
127
+ b,
127
128
  {
128
129
  name: "bold",
129
130
  width: 24,
@@ -136,18 +137,19 @@ const ye = (n) => {
136
137
  /* @__PURE__ */ i(
137
138
  "button",
138
139
  {
139
- onPointerDown: b,
140
- onClick: () => T("italic"),
140
+ onTouchStart: l,
141
+ onMouseDown: l,
142
+ onClick: () => _("italic"),
141
143
  type: "button",
142
144
  className: a(e.toolbarItem, {
143
- [e.active]: $
145
+ [e.active]: P
144
146
  }),
145
- "aria-label": r.formatMessage({
147
+ "aria-label": d.formatMessage({
146
148
  id: "input.text_editor.plugins.toolbar_plugin.italic.aria_label",
147
149
  defaultMessage: "Make text italic"
148
150
  }),
149
151
  children: /* @__PURE__ */ i(
150
- u,
152
+ b,
151
153
  {
152
154
  name: "italic",
153
155
  width: 24,
@@ -160,18 +162,19 @@ const ye = (n) => {
160
162
  /* @__PURE__ */ i(
161
163
  "button",
162
164
  {
163
- onPointerDown: b,
164
- onClick: () => T("underline"),
165
+ onTouchStart: l,
166
+ onMouseDown: l,
167
+ onClick: () => _("underline"),
165
168
  type: "button",
166
169
  className: a(e.toolbarItem, {
167
- [e.active]: K
170
+ [e.active]: F
168
171
  }),
169
- "aria-label": r.formatMessage({
172
+ "aria-label": d.formatMessage({
170
173
  id: "input.text_editor.plugins.toolbar_plugin.underline.aria_label",
171
174
  defaultMessage: "Underline text"
172
175
  }),
173
176
  children: /* @__PURE__ */ i(
174
- u,
177
+ b,
175
178
  {
176
179
  name: "underline",
177
180
  width: 24,
@@ -184,18 +187,19 @@ const ye = (n) => {
184
187
  /* @__PURE__ */ i(
185
188
  "button",
186
189
  {
187
- onPointerDown: b,
190
+ onTouchStart: l,
191
+ onMouseDown: l,
188
192
  onClick: () => H(),
189
193
  type: "button",
190
194
  className: a(e.toolbarItem, {
191
195
  [e.active]: h === "quote"
192
196
  }),
193
- "aria-label": r.formatMessage({
197
+ "aria-label": d.formatMessage({
194
198
  id: "input.text_editor.plugins.toolbar_plugin.blockquote.aria_label",
195
199
  defaultMessage: "Add a blockquote"
196
200
  }),
197
201
  children: /* @__PURE__ */ i(
198
- u,
202
+ b,
199
203
  {
200
204
  name: "blockquote",
201
205
  width: 24,
@@ -208,18 +212,19 @@ const ye = (n) => {
208
212
  /* @__PURE__ */ i(
209
213
  "button",
210
214
  {
211
- onPointerDown: b,
215
+ onTouchStart: l,
216
+ onMouseDown: l,
212
217
  onClick: () => j(),
213
218
  type: "button",
214
219
  className: a(e.toolbarItem, {
215
220
  [e.active]: h === "ol"
216
221
  }),
217
- "aria-label": r.formatMessage({
222
+ "aria-label": d.formatMessage({
218
223
  id: "input.text_editor.plugins.toolbar_plugin.numbered_list.aria_label",
219
224
  defaultMessage: "Insert a numbered list"
220
225
  }),
221
226
  children: /* @__PURE__ */ i(
222
- u,
227
+ b,
223
228
  {
224
229
  name: "orderedList",
225
230
  width: 24,
@@ -229,19 +234,20 @@ const ye = (n) => {
229
234
  )
230
235
  }
231
236
  ),
232
- !n.hideSourceAction && /* @__PURE__ */ i(
237
+ !s.hideSourceAction && /* @__PURE__ */ i(
233
238
  "button",
234
239
  {
235
- onPointerDown: b,
236
- onClick: n.onAddSource,
240
+ onTouchStart: l,
241
+ onMouseDown: l,
242
+ onClick: s.onAddSource,
237
243
  type: "button",
238
244
  className: e.toolbarItem,
239
- "aria-label": r.formatMessage({
245
+ "aria-label": d.formatMessage({
240
246
  id: "input.text_editor.plugins.toolbar_plugin.add_link.aria_label",
241
247
  defaultMessage: "Add hyperlink"
242
248
  }),
243
249
  children: /* @__PURE__ */ i(
244
- u,
250
+ b,
245
251
  {
246
252
  name: "link",
247
253
  width: 20,
@@ -254,18 +260,18 @@ const ye = (n) => {
254
260
  ]
255
261
  }
256
262
  ) : null,
257
- /* @__PURE__ */ i("div", { className: e.actionButton, children: n.hideSubmit ? null : /* @__PURE__ */ i(
263
+ /* @__PURE__ */ i("div", { className: e.actionButton, children: s.hideSubmit ? null : /* @__PURE__ */ i(
258
264
  le,
259
265
  {
260
266
  type: "button",
261
267
  "data-testid": "submit-button",
262
- handleClick: n.onSubmit,
268
+ handleClick: s.onSubmit,
263
269
  className: a(e.inputSubmitActionButton, e.submitAction),
264
- "aria-label": r.formatMessage({
270
+ "aria-label": d.formatMessage({
265
271
  id: "input.text_editor.plugins.toolbar_plugin.submit_button.aria_label",
266
272
  defaultMessage: "Send message"
267
273
  }),
268
- children: /* @__PURE__ */ i(u, { name: "send", width: 20, height: 20 })
274
+ children: /* @__PURE__ */ i(b, { name: "send", width: 20, height: 20 })
269
275
  }
270
276
  ) })
271
277
  ]
@@ -273,5 +279,5 @@ const ye = (n) => {
273
279
  );
274
280
  };
275
281
  export {
276
- ye as ToolbarPlugin
282
+ _e as ToolbarPlugin
277
283
  };
@@ -1,25 +1,25 @@
1
- import '../../../../assets/components/input/text_editor/plugins/ToolbarPlugin.module-C3yG2biv.css';const t = "_toolbar_awaxp_3", o = "_toolbarIsActive_awaxp_13", a = "_iconToolbar_awaxp_17", n = "_shortBar_awaxp_21", _ = "_toolbarItem_awaxp_25", c = "_active_awaxp_45", i = "_format_awaxp_49", s = "_actionButton_awaxp_56", r = "_inputSubmitActionButton_awaxp_62", b = "_submitAction_awaxp_70", u = {
1
+ import '../../../../assets/components/input/text_editor/plugins/ToolbarPlugin.module-CjkE3oe-.css';const t = "_toolbar_13b6u_3", o = "_toolbarIsActive_13b6u_13", n = "_iconToolbar_13b6u_17", _ = "_shortBar_13b6u_21", c = "_toolbarItem_13b6u_25", b = "_active_13b6u_45", i = "_format_13b6u_49", a = "_actionButton_13b6u_56", u = "_inputSubmitActionButton_13b6u_62", s = "_submitAction_13b6u_70", r = {
2
2
  toolbar: t,
3
3
  toolbarIsActive: o,
4
- iconToolbar: a,
5
- shortBar: n,
6
- toolbarItem: _,
7
- active: c,
4
+ iconToolbar: n,
5
+ shortBar: _,
6
+ toolbarItem: c,
7
+ active: b,
8
8
  format: i,
9
- actionButton: s,
10
- inputSubmitActionButton: r,
11
- submitAction: b
9
+ actionButton: a,
10
+ inputSubmitActionButton: u,
11
+ submitAction: s
12
12
  };
13
13
  export {
14
- s as actionButton,
15
- c as active,
16
- u as default,
14
+ a as actionButton,
15
+ b as active,
16
+ r as default,
17
17
  i as format,
18
- a as iconToolbar,
19
- r as inputSubmitActionButton,
20
- n as shortBar,
21
- b as submitAction,
18
+ n as iconToolbar,
19
+ u as inputSubmitActionButton,
20
+ _ as shortBar,
21
+ s as submitAction,
22
22
  t as toolbar,
23
23
  o as toolbarIsActive,
24
- _ as toolbarItem
24
+ c as toolbarItem
25
25
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logora/debate",
3
- "version": "0.4.23",
3
+ "version": "0.4.25",
4
4
  "type": "module",
5
5
  "license": "AGPL-3.0",
6
6
  "description": "Design system of @Logora made with React",
@@ -1 +0,0 @@
1
- ._toolbar_awaxp_3{display:flex!important;justify-content:space-between!important;flex-wrap:wrap;background:var(--background-color-primary, white);padding-top:var(--spacer-md, calc(var(--space-unit, 1em) * .75))!important;vertical-align:middle;align-items:flex-start;gap:var(--space-unit, 1em)}._toolbar_awaxp_3._toolbarIsActive_awaxp_13{border-top:1px solid var(--text-tertiary, #fafafa)}._iconToolbar_awaxp_17{display:flex!important;gap:var(--spacer-lg, calc(var(--space-unit, 1em) * 1.5))}._iconToolbar_awaxp_17._shortBar_awaxp_21{gap:var(--spacer-md, calc(var(--space-unit, 1em) * .75))}._toolbarItem_awaxp_25{border:0;background:none;padding:0!important;cursor:pointer;vertical-align:middle;touch-action:manipulation;display:flex;align-items:center;justify-content:center}@container (max-width: 575.98px){._toolbarItem_awaxp_25{min-width:44px;min-height:44px}}._toolbarItem_awaxp_25._disabled_awaxp_42{cursor:not-allowed}._toolbarItem_awaxp_25._active_awaxp_45{background-color:#bababa66;border-radius:50%}._toolbarItem_awaxp_25 ._format_awaxp_49{background-size:contain;display:inline-block;vertical-align:-.25em;display:flex!important}._actionButton_awaxp_56{display:flex!important;gap:var(--space-unit, 1em);margin-left:auto}._inputSubmitActionButton_awaxp_62{width:100%;height:35px;display:flex!important;justify-content:center!important;align-items:center!important;background-color:var(--call-primary-color, #434343)!important}._inputSubmitActionButton_awaxp_62._submitAction_awaxp_70 svg{fill:var(--text-light, white)!important}._inputSubmitActionButton_awaxp_62 ._inputSourceText_awaxp_73{display:none!important;margin-left:var(--spacer-sm, calc(var(--space-unit, 1em) * .5))!important;font-size:var(--font-size-small, 16px)}@container (min-width: 576px){._inputSubmitActionButton_awaxp_62 ._inputSourceText_awaxp_73{display:block!important}}._tooltip_awaxp_84{width:230px!important;margin-left:-117px!important}