laif-ds 0.2.85 → 0.2.87

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 (113) hide show
  1. package/README.md +11 -81
  2. package/dist/CHANGELOG.md +13 -0
  3. package/dist/_virtual/index6.js +2 -2
  4. package/dist/_virtual/index7.js +2 -2
  5. package/dist/agent-docs/adoption-report.json +2 -2
  6. package/dist/agent-docs/manifest.json +3 -3
  7. package/dist/components/editor/editor-hooks/use-update-toolbar.js +6 -6
  8. package/dist/components/editor/editor-ui/content-editable.js +1 -1
  9. package/dist/components/editor/nodes/mention-node.js +2 -2
  10. package/dist/components/editor/plugins/actions/clear-editor-plugin.js +2 -2
  11. package/dist/components/editor/plugins/actions/counter-character-plugin.js +2 -2
  12. package/dist/components/editor/plugins/mention-plugin.js +21 -21
  13. package/dist/components/editor/plugins/toolbar/block-format/format-bulleted-list.js +10 -10
  14. package/dist/components/editor/plugins/toolbar/block-format/format-check-list.js +5 -5
  15. package/dist/components/editor/plugins/toolbar/block-format/format-heading.js +5 -5
  16. package/dist/components/editor/plugins/toolbar/block-format/format-numbered-list.js +5 -5
  17. package/dist/components/editor/plugins/toolbar/block-format/format-paragraph.js +9 -9
  18. package/dist/components/editor/plugins/toolbar/block-format/format-quote.js +3 -3
  19. package/dist/components/editor/plugins/toolbar/block-format-toolbar-plugin.js +13 -13
  20. package/dist/components/editor/plugins/toolbar/font-format-toolbar-plugin.js +2 -2
  21. package/dist/components/editor/plugins/toolbar/history-toolbar-plugin.js +18 -19
  22. package/dist/components/editor/plugins/toolbar/mention-insert-toolbar-plugin.js +1 -1
  23. package/dist/components/editor/plugins/toolbar/toolbar-plugin.js +3 -3
  24. package/dist/components/ui/app-editor.js +51 -51
  25. package/dist/components/ui/markdown-renderer.js +33 -32
  26. package/dist/lib/utils.js +35 -34
  27. package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +1 -1
  28. package/dist/node_modules/@floating-ui/{utils → core/node_modules/@floating-ui/utils}/dist/floating-ui.utils.js +33 -39
  29. package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +20 -19
  30. package/dist/node_modules/@floating-ui/dom/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +12 -0
  31. package/dist/node_modules/@lexical/clipboard/dist/LexicalClipboard.prod.js +354 -0
  32. package/dist/node_modules/@lexical/code-core/dist/LexicalCodeCore.prod.js +298 -0
  33. package/dist/node_modules/@lexical/dragon/dist/LexicalDragon.prod.js +89 -0
  34. package/dist/node_modules/@lexical/extension/dist/LexicalExtension.prod.js +611 -0
  35. package/dist/node_modules/@lexical/history/dist/LexicalHistory.prod.js +96 -0
  36. package/dist/node_modules/@lexical/html/dist/LexicalHtml.prod.js +604 -0
  37. package/dist/node_modules/@lexical/link/dist/LexicalLink.prod.js +201 -0
  38. package/dist/node_modules/@lexical/list/dist/LexicalList.prod.js +843 -0
  39. package/dist/node_modules/@lexical/markdown/dist/LexicalMarkdown.prod.js +555 -0
  40. package/dist/node_modules/@lexical/react/dist/LexicalCheckListPlugin.prod.js +11 -0
  41. package/dist/node_modules/@lexical/react/dist/LexicalClearEditorPlugin.prod.js +13 -0
  42. package/dist/node_modules/@lexical/react/dist/LexicalComposer.prod.js +45 -0
  43. package/dist/node_modules/@lexical/react/{LexicalComposerContext.prod.js → dist/LexicalComposerContext.prod.js} +1 -1
  44. package/dist/node_modules/@lexical/react/dist/LexicalContentEditable.prod.js +53 -0
  45. package/dist/node_modules/@lexical/react/dist/LexicalErrorBoundary.prod.js +21 -0
  46. package/dist/node_modules/@lexical/react/{LexicalHistoryPlugin.prod.js → dist/LexicalHistoryPlugin.prod.js} +3 -3
  47. package/dist/node_modules/@lexical/react/dist/LexicalListPlugin.prod.js +17 -0
  48. package/dist/node_modules/@lexical/react/dist/LexicalOnChangePlugin.prod.js +16 -0
  49. package/dist/node_modules/@lexical/react/dist/LexicalReactProviderExtension.prod.js +6 -0
  50. package/dist/node_modules/@lexical/react/dist/LexicalRichTextPlugin.prod.js +77 -0
  51. package/dist/node_modules/@lexical/react/dist/LexicalTypeaheadMenuPlugin.prod.js +245 -0
  52. package/dist/node_modules/@lexical/react/dist/useLexicalEditable.prod.js +22 -0
  53. package/dist/node_modules/@lexical/rich-text/dist/LexicalRichText.prod.js +567 -0
  54. package/dist/node_modules/@lexical/selection/dist/LexicalSelection.prod.js +123 -0
  55. package/dist/node_modules/@lexical/table/dist/LexicalTable.prod.js +929 -0
  56. package/dist/node_modules/@lexical/text/{LexicalText.prod.js → dist/LexicalText.prod.js} +6 -6
  57. package/dist/node_modules/@lexical/utils/dist/LexicalUtils.prod.js +111 -0
  58. package/dist/node_modules/eventemitter3/index2.js +1 -1
  59. package/dist/node_modules/lexical/dist/Lexical.prod.js +6731 -0
  60. package/dist/node_modules/style-to-object/cjs/index.js +1 -1
  61. package/package.json +17 -15
  62. package/dist/_virtual/prism-cpp.js +0 -3
  63. package/dist/_virtual/prism-cpp2.js +0 -5
  64. package/dist/_virtual/prism-java.js +0 -3
  65. package/dist/_virtual/prism-java2.js +0 -5
  66. package/dist/_virtual/prism-python.js +0 -3
  67. package/dist/_virtual/prism-python2.js +0 -5
  68. package/dist/_virtual/prism-rust.js +0 -3
  69. package/dist/_virtual/prism-rust2.js +0 -5
  70. package/dist/_virtual/prism-typescript.js +0 -3
  71. package/dist/_virtual/prism-typescript2.js +0 -5
  72. package/dist/_virtual/prism.js +0 -3
  73. package/dist/_virtual/prism2.js +0 -5
  74. package/dist/node_modules/@lexical/clipboard/LexicalClipboard.prod.js +0 -159
  75. package/dist/node_modules/@lexical/code/LexicalCode.prod.js +0 -236
  76. package/dist/node_modules/@lexical/dragon/LexicalDragon.prod.js +0 -46
  77. package/dist/node_modules/@lexical/history/LexicalHistory.prod.js +0 -89
  78. package/dist/node_modules/@lexical/html/LexicalHtml.prod.js +0 -108
  79. package/dist/node_modules/@lexical/link/LexicalLink.prod.js +0 -187
  80. package/dist/node_modules/@lexical/list/LexicalList.prod.js +0 -729
  81. package/dist/node_modules/@lexical/markdown/LexicalMarkdown.prod.js +0 -367
  82. package/dist/node_modules/@lexical/react/LexicalCheckListPlugin.prod.js +0 -11
  83. package/dist/node_modules/@lexical/react/LexicalClearEditorPlugin.prod.js +0 -17
  84. package/dist/node_modules/@lexical/react/LexicalComposer.prod.js +0 -45
  85. package/dist/node_modules/@lexical/react/LexicalContentEditable.prod.js +0 -55
  86. package/dist/node_modules/@lexical/react/LexicalErrorBoundary.prod.js +0 -49
  87. package/dist/node_modules/@lexical/react/LexicalListPlugin.prod.js +0 -17
  88. package/dist/node_modules/@lexical/react/LexicalOnChangePlugin.prod.js +0 -16
  89. package/dist/node_modules/@lexical/react/LexicalRichTextPlugin.prod.js +0 -56
  90. package/dist/node_modules/@lexical/react/LexicalTypeaheadMenuPlugin.prod.js +0 -220
  91. package/dist/node_modules/@lexical/react/useLexicalEditable.prod.js +0 -21
  92. package/dist/node_modules/@lexical/rich-text/LexicalRichText.prod.js +0 -376
  93. package/dist/node_modules/@lexical/selection/LexicalSelection.prod.js +0 -107
  94. package/dist/node_modules/@lexical/table/LexicalTable.prod.js +0 -661
  95. package/dist/node_modules/@lexical/utils/LexicalUtils.prod.js +0 -102
  96. package/dist/node_modules/lexical/Lexical.prod.js +0 -4912
  97. package/dist/node_modules/prismjs/components/prism-c.js +0 -77
  98. package/dist/node_modules/prismjs/components/prism-clike.js +0 -32
  99. package/dist/node_modules/prismjs/components/prism-cpp.js +0 -93
  100. package/dist/node_modules/prismjs/components/prism-css.js +0 -56
  101. package/dist/node_modules/prismjs/components/prism-java.js +0 -122
  102. package/dist/node_modules/prismjs/components/prism-javascript.js +0 -138
  103. package/dist/node_modules/prismjs/components/prism-markdown.js +0 -301
  104. package/dist/node_modules/prismjs/components/prism-markup.js +0 -174
  105. package/dist/node_modules/prismjs/components/prism-objectivec.js +0 -11
  106. package/dist/node_modules/prismjs/components/prism-powershell.js +0 -56
  107. package/dist/node_modules/prismjs/components/prism-python.js +0 -69
  108. package/dist/node_modules/prismjs/components/prism-rust.js +0 -124
  109. package/dist/node_modules/prismjs/components/prism-sql.js +0 -34
  110. package/dist/node_modules/prismjs/components/prism-swift.js +0 -114
  111. package/dist/node_modules/prismjs/components/prism-typescript.js +0 -53
  112. package/dist/node_modules/prismjs/prism.js +0 -1165
  113. /package/dist/node_modules/@floating-ui/{utils → dom/node_modules/@floating-ui/utils}/dist/floating-ui.utils.dom.js +0 -0
@@ -1,729 +0,0 @@
1
- "use client";
2
- import { removeClassNamesFromElement as ee, addClassNamesToElement as te, mergeRegister as re, $findMatchingParent as ne, $getNearestNodeOfType as ue, calculateZoomLevel as ge } from "../utils/LexicalUtils.prod.js";
3
- import { ElementNode as se, isHTMLElement as S, $createTextNode as de, $isElementNode as v, $createParagraphNode as M, $isParagraphNode as he, $isRangeSelection as L, $applyNodeReplacement as ie, createCommand as D, TextNode as fe, $isTextNode as pe, $getSelection as P, INSERT_PARAGRAPH_COMMAND as me, COMMAND_PRIORITY_LOW as C, KEY_ARROW_LEFT_COMMAND as _e, KEY_SPACE_COMMAND as Ce, $getNearestNodeFromDOMNode as W, KEY_ESCAPE_COMMAND as ye, KEY_ARROW_UP_COMMAND as Te, KEY_ARROW_DOWN_COMMAND as Ne, $isRootOrShadowRoot as A, $isLeafNode as oe, $setPointFromCaret as B, $normalizeCaret as U, $getChildCaret as V, getNearestEditorFromDOMNode as Se } from "../../lexical/Lexical.prod.js";
4
- import { getStyleObjectFromCSS as z } from "../selection/LexicalSelection.prod.js";
5
- function y(n, ...e) {
6
- const t = new URL("https://lexical.dev/docs/error"), r = new URLSearchParams();
7
- r.append("code", n);
8
- for (const s of e) r.append("v", s);
9
- throw t.search = r.toString(), Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
10
- }
11
- function R(n) {
12
- let e = 1, t = n.getParent();
13
- for (; t != null; ) {
14
- if (g(t)) {
15
- const r = t.getParent();
16
- if (u(r)) {
17
- e++, t = r.getParent();
18
- continue;
19
- }
20
- y(40);
21
- }
22
- return e;
23
- }
24
- return e;
25
- }
26
- function w(n) {
27
- let e = n.getParent();
28
- u(e) || y(40);
29
- let t = e;
30
- for (; t !== null; ) t = t.getParent(), u(t) && (e = t);
31
- return e;
32
- }
33
- function le(n) {
34
- let e = [];
35
- const t = n.getChildren().filter(g);
36
- for (let r = 0; r < t.length; r++) {
37
- const s = t[r], i = s.getFirstChild();
38
- u(i) ? e = e.concat(le(i)) : e.push(s);
39
- }
40
- return e;
41
- }
42
- function T(n) {
43
- return g(n) && u(n.getFirstChild());
44
- }
45
- function Y(n) {
46
- return m().append(n);
47
- }
48
- function ae(n, e) {
49
- return g(n) && (e.length === 0 || e.length === 1 && n.is(e[0]) && n.getChildrenSize() === 0);
50
- }
51
- function $(n) {
52
- const e = P();
53
- if (e !== null) {
54
- let t = e.getNodes();
55
- if (L(e)) {
56
- const s = e.getStartEndPoints();
57
- s === null && y(143);
58
- const [i] = s, o = i.getNode(), a = o.getParent();
59
- if (A(o)) {
60
- const l = o.getFirstChild();
61
- if (l) t = l.selectStart().getNodes();
62
- else {
63
- const c = M();
64
- o.append(c), t = c.select().getNodes();
65
- }
66
- } else if (ae(o, t)) {
67
- const l = p(n);
68
- if (A(a)) {
69
- o.replace(l);
70
- const c = m();
71
- v(o) && (c.setFormat(o.getFormatType()), c.setIndent(o.getIndent())), l.append(c);
72
- } else if (g(o)) {
73
- const c = o.getParentOrThrow();
74
- N(l, c.getChildren()), c.replace(l);
75
- }
76
- return;
77
- }
78
- }
79
- const r = /* @__PURE__ */ new Set();
80
- for (let s = 0; s < t.length; s++) {
81
- const i = t[s];
82
- if (v(i) && i.isEmpty() && !g(i) && !r.has(i.getKey())) {
83
- H(i, n);
84
- continue;
85
- }
86
- let o = oe(i) ? i.getParent() : g(i) && i.isEmpty() ? i : null;
87
- for (; o != null; ) {
88
- const a = o.getKey();
89
- if (u(o)) {
90
- if (!r.has(a)) {
91
- const l = p(n);
92
- N(l, o.getChildren()), o.replace(l), r.add(a);
93
- }
94
- break;
95
- }
96
- {
97
- const l = o.getParent();
98
- if (A(l) && !r.has(a)) {
99
- r.add(a), H(o, n);
100
- break;
101
- }
102
- o = l;
103
- }
104
- }
105
- }
106
- }
107
- }
108
- function N(n, e) {
109
- n.splice(n.getChildrenSize(), 0, e);
110
- }
111
- function H(n, e) {
112
- if (u(n)) return n;
113
- const t = n.getPreviousSibling(), r = n.getNextSibling(), s = m();
114
- let i;
115
- if (N(s, n.getChildren()), u(t) && e === t.getListType()) t.append(s), u(r) && e === r.getListType() && (N(t, r.getChildren()), r.remove()), i = t;
116
- else if (u(r) && e === r.getListType()) r.getFirstChildOrThrow().insertBefore(s), i = r;
117
- else {
118
- const o = p(e);
119
- o.append(s), n.replace(o), i = o;
120
- }
121
- return s.setFormat(n.getFormatType()), s.setIndent(n.getIndent()), n.remove(), i;
122
- }
123
- function J(n, e) {
124
- const t = n.getLastChild(), r = e.getFirstChild();
125
- t && r && T(t) && T(r) && (J(t.getFirstChild(), r.getFirstChild()), r.remove());
126
- const s = e.getChildren();
127
- s.length > 0 && n.append(...s), e.remove();
128
- }
129
- function ve() {
130
- const n = P();
131
- if (L(n)) {
132
- const e = /* @__PURE__ */ new Set(), t = n.getNodes(), r = n.anchor.getNode();
133
- if (ae(r, t)) e.add(w(r));
134
- else for (let s = 0; s < t.length; s++) {
135
- const i = t[s];
136
- if (oe(i)) {
137
- const o = ue(i, O);
138
- o != null && e.add(w(o));
139
- }
140
- }
141
- for (const s of e) {
142
- let i = s;
143
- const o = le(s);
144
- for (const a of o) {
145
- const l = M().setTextStyle(n.style).setTextFormat(n.format);
146
- N(l, a.getChildren()), i.insertAfter(l), i = l, a.__key === n.anchor.key && B(n.anchor, U(V(l, "next"))), a.__key === n.focus.key && B(n.focus, U(V(l, "next"))), a.remove();
147
- }
148
- s.remove();
149
- }
150
- }
151
- }
152
- function Le(n) {
153
- const e = /* @__PURE__ */ new Set();
154
- if (T(n) || e.has(n.getKey())) return;
155
- const t = n.getParent(), r = n.getNextSibling(), s = n.getPreviousSibling();
156
- if (T(r) && T(s)) {
157
- const i = s.getFirstChild();
158
- if (u(i)) {
159
- i.append(n);
160
- const o = r.getFirstChild();
161
- u(o) && (N(i, o.getChildren()), r.remove(), e.add(r.getKey()));
162
- }
163
- } else if (T(r)) {
164
- const i = r.getFirstChild();
165
- if (u(i)) {
166
- const o = i.getFirstChild();
167
- o !== null && o.insertBefore(n);
168
- }
169
- } else if (T(s)) {
170
- const i = s.getFirstChild();
171
- u(i) && i.append(n);
172
- } else if (u(t)) {
173
- const i = m().setTextFormat(n.getTextFormat()).setTextStyle(n.getTextStyle()), o = p(t.getListType()).setTextFormat(t.getTextFormat()).setTextStyle(t.getTextStyle());
174
- i.append(o), o.append(n), s ? s.insertAfter(i) : r ? r.insertBefore(i) : t.append(i);
175
- }
176
- }
177
- function Oe(n) {
178
- if (T(n)) return;
179
- const e = n.getParent(), t = e ? e.getParent() : void 0;
180
- if (u(t ? t.getParent() : void 0) && g(t) && u(e)) {
181
- const r = e ? e.getFirstChild() : void 0, s = e ? e.getLastChild() : void 0;
182
- if (n.is(r)) t.insertBefore(n), e.isEmpty() && t.remove();
183
- else if (n.is(s)) t.insertAfter(n), e.isEmpty() && t.remove();
184
- else {
185
- const i = e.getListType(), o = m(), a = p(i);
186
- o.append(a), n.getPreviousSiblings().forEach(((d) => a.append(d)));
187
- const l = m(), c = p(i);
188
- l.append(c), N(c, n.getNextSiblings()), t.insertBefore(o), t.insertAfter(l), t.replace(n);
189
- }
190
- }
191
- }
192
- function xe() {
193
- const n = P();
194
- if (!L(n) || !n.isCollapsed()) return !1;
195
- const e = n.anchor.getNode();
196
- if (!g(e) || e.getChildrenSize() !== 0) return !1;
197
- const t = w(e), r = e.getParent();
198
- u(r) || y(40);
199
- const s = r.getParent();
200
- let i;
201
- if (A(s)) i = M(), t.insertAfter(i);
202
- else {
203
- if (!g(s)) return !1;
204
- i = m(), s.insertAfter(i);
205
- }
206
- i.setTextStyle(n.style).setTextFormat(n.format).select();
207
- const o = e.getNextSiblings();
208
- if (o.length > 0) {
209
- const a = p(r.getListType());
210
- if (g(i)) {
211
- const l = m();
212
- l.append(a), i.insertAfter(l);
213
- } else i.insertAfter(a);
214
- a.append(...o);
215
- }
216
- return (function(a) {
217
- let l = a;
218
- for (; l.getNextSibling() == null && l.getPreviousSibling() == null; ) {
219
- const c = l.getParent();
220
- if (c == null || !g(c) && !u(c)) break;
221
- l = c;
222
- }
223
- l.remove();
224
- })(e), !0;
225
- }
226
- function F(...n) {
227
- const e = [];
228
- for (const t of n) if (t && typeof t == "string") for (const [r] of t.matchAll(/\S+/g)) e.push(r);
229
- return e;
230
- }
231
- class O extends se {
232
- static getType() {
233
- return "listitem";
234
- }
235
- static clone(e) {
236
- return new O(e.__value, e.__checked, e.__key);
237
- }
238
- constructor(e, t, r) {
239
- super(r), this.__value = e === void 0 ? 1 : e, this.__checked = t;
240
- }
241
- createDOM(e) {
242
- const t = document.createElement("li");
243
- return this.updateListItemDOM(null, t, e), t;
244
- }
245
- updateListItemDOM(e, t, r) {
246
- const s = this.getParent();
247
- u(s) && s.getListType() === "check" && (function(a, l, c, d) {
248
- u(l.getFirstChild()) ? (a.removeAttribute("role"), a.removeAttribute("tabIndex"), a.removeAttribute("aria-checked")) : (a.setAttribute("role", "checkbox"), a.setAttribute("tabIndex", "-1"), c && l.__checked === c.__checked || a.setAttribute("aria-checked", l.getChecked() ? "true" : "false"));
249
- })(t, this, e), t.value = this.__value, (function(a, l, c) {
250
- const d = [], h = [], f = l.list, x = f ? f.listitem : void 0;
251
- let _;
252
- if (f && f.nested && (_ = f.nested.listitem), x !== void 0 && d.push(...F(x)), f) {
253
- const k = c.getParent(), b = u(k) && k.getListType() === "check", I = c.getChecked();
254
- b && !I || h.push(f.listitemUnchecked), b && I || h.push(f.listitemChecked), b && d.push(I ? f.listitemChecked : f.listitemUnchecked);
255
- }
256
- if (_ !== void 0) {
257
- const k = F(_);
258
- c.getChildren().some(((b) => u(b))) ? d.push(...k) : h.push(...k);
259
- }
260
- h.length > 0 && ee(a, ...h), d.length > 0 && te(a, ...d);
261
- })(t, r.theme, this);
262
- const i = e ? e.__style : "", o = this.__style;
263
- i !== o && (o === "" ? t.removeAttribute("style") : t.style.cssText = o), (function(a, l, c) {
264
- const d = z(l.__textStyle);
265
- for (const h in d) a.style.setProperty(`--listitem-marker-${h}`, d[h]);
266
- if (c) for (const h in z(c.__textStyle)) h in d || a.style.removeProperty(`--listitem-marker-${h}`);
267
- })(t, this, e);
268
- }
269
- updateDOM(e, t, r) {
270
- const s = t;
271
- return this.updateListItemDOM(e, s, r), !1;
272
- }
273
- static transform() {
274
- return (e) => {
275
- if (g(e) || y(144), e.__checked == null) return;
276
- const t = e.getParent();
277
- u(t) && t.getListType() !== "check" && e.getChecked() != null && e.setChecked(void 0);
278
- };
279
- }
280
- static importDOM() {
281
- return { li: () => ({ conversion: ke, priority: 0 }) };
282
- }
283
- static importJSON(e) {
284
- return m().updateFromJSON(e);
285
- }
286
- updateFromJSON(e) {
287
- return super.updateFromJSON(e).setValue(e.value).setChecked(e.checked);
288
- }
289
- exportDOM(e) {
290
- const t = this.createDOM(e._config), r = this.getFormatType();
291
- r && (t.style.textAlign = r);
292
- const s = this.getDirection();
293
- return s && (t.dir = s), { element: t };
294
- }
295
- exportJSON() {
296
- return { ...super.exportJSON(), checked: this.getChecked(), value: this.getValue() };
297
- }
298
- append(...e) {
299
- for (let t = 0; t < e.length; t++) {
300
- const r = e[t];
301
- if (v(r) && this.canMergeWith(r)) {
302
- const s = r.getChildren();
303
- this.append(...s), r.remove();
304
- } else super.append(r);
305
- }
306
- return this;
307
- }
308
- replace(e, t) {
309
- if (g(e)) return super.replace(e);
310
- this.setIndent(0);
311
- const r = this.getParentOrThrow();
312
- if (!u(r)) return e;
313
- if (r.__first === this.getKey()) r.insertBefore(e);
314
- else if (r.__last === this.getKey()) r.insertAfter(e);
315
- else {
316
- const s = p(r.getListType());
317
- let i = this.getNextSibling();
318
- for (; i; ) {
319
- const o = i;
320
- i = i.getNextSibling(), s.append(o);
321
- }
322
- r.insertAfter(e), e.insertAfter(s);
323
- }
324
- return t && (v(e) || y(139), this.getChildren().forEach(((s) => {
325
- e.append(s);
326
- }))), this.remove(), r.getChildrenSize() === 0 && r.remove(), e;
327
- }
328
- insertAfter(e, t = !0) {
329
- const r = this.getParentOrThrow();
330
- if (u(r) || y(39), g(e)) return super.insertAfter(e, t);
331
- const s = this.getNextSiblings();
332
- if (r.insertAfter(e, t), s.length !== 0) {
333
- const i = p(r.getListType());
334
- s.forEach(((o) => i.append(o))), e.insertAfter(i, t);
335
- }
336
- return e;
337
- }
338
- remove(e) {
339
- const t = this.getPreviousSibling(), r = this.getNextSibling();
340
- super.remove(e), t && r && T(t) && T(r) && (J(t.getFirstChild(), r.getFirstChild()), r.remove());
341
- }
342
- insertNewAfter(e, t = !0) {
343
- const r = m().updateFromJSON(this.exportJSON()).setChecked(!this.getChecked() && void 0);
344
- return this.insertAfter(r, t), r;
345
- }
346
- collapseAtStart(e) {
347
- const t = M();
348
- this.getChildren().forEach(((o) => t.append(o)));
349
- const r = this.getParentOrThrow(), s = r.getParentOrThrow(), i = g(s);
350
- if (r.getChildrenSize() === 1) if (i) r.remove(), s.select();
351
- else {
352
- r.insertBefore(t), r.remove();
353
- const o = e.anchor, a = e.focus, l = t.getKey();
354
- o.type === "element" && o.getNode().is(this) && o.set(l, o.offset, "element"), a.type === "element" && a.getNode().is(this) && a.set(l, a.offset, "element");
355
- }
356
- else r.insertBefore(t), this.remove();
357
- return !0;
358
- }
359
- getValue() {
360
- return this.getLatest().__value;
361
- }
362
- setValue(e) {
363
- const t = this.getWritable();
364
- return t.__value = e, t;
365
- }
366
- getChecked() {
367
- const e = this.getLatest();
368
- let t;
369
- const r = this.getParent();
370
- return u(r) && (t = r.getListType()), t === "check" ? !!e.__checked : void 0;
371
- }
372
- setChecked(e) {
373
- const t = this.getWritable();
374
- return t.__checked = e, t;
375
- }
376
- toggleChecked() {
377
- const e = this.getWritable();
378
- return e.setChecked(!e.__checked);
379
- }
380
- getIndent() {
381
- const e = this.getParent();
382
- if (e === null || !this.isAttached()) return this.getLatest().__indent;
383
- let t = e.getParentOrThrow(), r = 0;
384
- for (; g(t); ) t = t.getParentOrThrow().getParentOrThrow(), r++;
385
- return r;
386
- }
387
- setIndent(e) {
388
- typeof e != "number" && y(117), (e = Math.floor(e)) >= 0 || y(199);
389
- let t = this.getIndent();
390
- for (; t !== e; ) t < e ? (Le(this), t++) : (Oe(this), t--);
391
- return this;
392
- }
393
- canInsertAfter(e) {
394
- return g(e);
395
- }
396
- canReplaceWith(e) {
397
- return g(e);
398
- }
399
- canMergeWith(e) {
400
- return g(e) || he(e);
401
- }
402
- extractWithChild(e, t) {
403
- if (!L(t)) return !1;
404
- const r = t.anchor.getNode(), s = t.focus.getNode();
405
- return this.isParentOf(r) && this.isParentOf(s) && this.getTextContent().length === t.getTextContent().length;
406
- }
407
- isParentRequired() {
408
- return !0;
409
- }
410
- createParentElementNode() {
411
- return p("bullet");
412
- }
413
- canMergeWhenEmpty() {
414
- return !0;
415
- }
416
- }
417
- function ke(n) {
418
- if (n.classList.contains("task-list-item")) {
419
- for (const t of n.children) if (t.tagName === "INPUT") return be(t);
420
- }
421
- const e = n.getAttribute("aria-checked");
422
- return { node: m(e === "true" || e !== "false" && void 0) };
423
- }
424
- function be(n) {
425
- return n.getAttribute("type") !== "checkbox" ? { node: null } : { node: m(n.hasAttribute("checked")) };
426
- }
427
- function m(n) {
428
- return ie(new O(void 0, n));
429
- }
430
- function g(n) {
431
- return n instanceof O;
432
- }
433
- class E extends se {
434
- static getType() {
435
- return "list";
436
- }
437
- static clone(e) {
438
- const t = e.__listType || j[e.__tag];
439
- return new E(t, e.__start, e.__key);
440
- }
441
- constructor(e = "number", t = 1, r) {
442
- super(r);
443
- const s = j[e] || e;
444
- this.__listType = s, this.__tag = s === "number" ? "ol" : "ul", this.__start = t;
445
- }
446
- getTag() {
447
- return this.__tag;
448
- }
449
- setListType(e) {
450
- const t = this.getWritable();
451
- return t.__listType = e, t.__tag = e === "number" ? "ol" : "ul", t;
452
- }
453
- getListType() {
454
- return this.__listType;
455
- }
456
- getStart() {
457
- return this.__start;
458
- }
459
- setStart(e) {
460
- const t = this.getWritable();
461
- return t.__start = e, t;
462
- }
463
- createDOM(e, t) {
464
- const r = this.__tag, s = document.createElement(r);
465
- return this.__start !== 1 && s.setAttribute("start", String(this.__start)), s.__lexicalListType = this.__listType, G(s, e.theme, this), s;
466
- }
467
- updateDOM(e, t, r) {
468
- return e.__tag !== this.__tag || (G(t, r.theme, this), !1);
469
- }
470
- static transform() {
471
- return (e) => {
472
- u(e) || y(163), (function(t) {
473
- const r = t.getNextSibling();
474
- u(r) && t.getListType() === r.getListType() && J(t, r);
475
- })(e), (function(t) {
476
- const r = t.getListType() !== "check";
477
- let s = t.getStart();
478
- for (const i of t.getChildren()) g(i) && (i.getValue() !== s && i.setValue(s), r && i.getLatest().__checked != null && i.setChecked(void 0), u(i.getFirstChild()) || s++);
479
- })(e);
480
- };
481
- }
482
- static importDOM() {
483
- return { ol: () => ({ conversion: X, priority: 0 }), ul: () => ({ conversion: X, priority: 0 }) };
484
- }
485
- static importJSON(e) {
486
- return p().updateFromJSON(e);
487
- }
488
- updateFromJSON(e) {
489
- return super.updateFromJSON(e).setListType(e.listType).setStart(e.start);
490
- }
491
- exportDOM(e) {
492
- const t = this.createDOM(e._config, e);
493
- return S(t) && (this.__start !== 1 && t.setAttribute("start", String(this.__start)), this.__listType === "check" && t.setAttribute("__lexicalListType", "check")), { element: t };
494
- }
495
- exportJSON() {
496
- return { ...super.exportJSON(), listType: this.getListType(), start: this.getStart(), tag: this.getTag() };
497
- }
498
- canBeEmpty() {
499
- return !1;
500
- }
501
- canIndent() {
502
- return !1;
503
- }
504
- splice(e, t, r) {
505
- let s = r;
506
- for (let i = 0; i < r.length; i++) {
507
- const o = r[i];
508
- g(o) || (s === r && (s = [...r]), s[i] = m().append(!v(o) || u(o) || o.isInline() ? o : de(o.getTextContent())));
509
- }
510
- return super.splice(e, t, s);
511
- }
512
- extractWithChild(e) {
513
- return g(e);
514
- }
515
- }
516
- function G(n, e, t) {
517
- const r = [], s = [], i = e.list;
518
- if (i !== void 0) {
519
- const o = i[`${t.__tag}Depth`] || [], a = R(t) - 1, l = a % o.length, c = o[l], d = i[t.__tag];
520
- let h;
521
- const f = i.nested, x = i.checklist;
522
- if (f !== void 0 && f.list && (h = f.list), d !== void 0 && r.push(d), x !== void 0 && t.__listType === "check" && r.push(x), c !== void 0) {
523
- r.push(...F(c));
524
- for (let _ = 0; _ < o.length; _++) _ !== l && s.push(t.__tag + _);
525
- }
526
- if (h !== void 0) {
527
- const _ = F(h);
528
- a > 1 ? r.push(..._) : s.push(..._);
529
- }
530
- }
531
- s.length > 0 && ee(n, ...s), r.length > 0 && te(n, ...r);
532
- }
533
- function Pe(n) {
534
- const e = [];
535
- for (let t = 0; t < n.length; t++) {
536
- const r = n[t];
537
- if (g(r)) {
538
- e.push(r);
539
- const s = r.getChildren();
540
- s.length > 1 && s.forEach(((i) => {
541
- u(i) && e.push(Y(i));
542
- }));
543
- } else e.push(Y(r));
544
- }
545
- return e;
546
- }
547
- function X(n) {
548
- const e = n.nodeName.toLowerCase();
549
- let t = null;
550
- return e === "ol" ? t = p("number", n.start) : e === "ul" && (t = (function(r) {
551
- if (r.getAttribute("__lexicallisttype") === "check" || r.classList.contains("contains-task-list")) return !0;
552
- for (const s of r.childNodes) if (S(s) && s.hasAttribute("aria-checked")) return !0;
553
- return !1;
554
- })(n) ? p("check") : p("bullet")), { after: Pe, node: t };
555
- }
556
- const j = { ol: "number", ul: "bullet" };
557
- function p(n = "number", e = 1) {
558
- return ie(new E(n, e));
559
- }
560
- function u(n) {
561
- return n instanceof E;
562
- }
563
- const Ee = D("INSERT_CHECK_LIST_COMMAND");
564
- function we(n) {
565
- return re(n.registerCommand(Ee, (() => ($("check"), !0)), C), n.registerCommand(Ne, ((e) => Z(e, n, !1)), C), n.registerCommand(Te, ((e) => Z(e, n, !0)), C), n.registerCommand(ye, (() => {
566
- if (K() != null) {
567
- const e = n.getRootElement();
568
- return e?.focus(), !0;
569
- }
570
- return !1;
571
- }), C), n.registerCommand(Ce, ((e) => {
572
- const t = K();
573
- return !(t == null || !n.isEditable()) && (n.update((() => {
574
- const r = W(t);
575
- g(r) && (e.preventDefault(), r.toggleChecked());
576
- })), !0);
577
- }), C), n.registerCommand(_e, ((e) => n.getEditorState().read((() => {
578
- const t = P();
579
- if (L(t) && t.isCollapsed()) {
580
- const { anchor: r } = t, s = r.type === "element";
581
- if (s || r.offset === 0) {
582
- const i = r.getNode(), o = ne(i, ((a) => v(a) && !a.isInline()));
583
- if (g(o)) {
584
- const a = o.getParent();
585
- if (u(a) && a.getListType() === "check" && (s || o.getFirstDescendant() === i)) {
586
- const l = n.getElementByKey(o.__key);
587
- if (l != null && document.activeElement !== l) return l.focus(), e.preventDefault(), !0;
588
- }
589
- }
590
- }
591
- }
592
- return !1;
593
- }))), C), n.registerRootListener(((e, t) => {
594
- e !== null && (e.addEventListener("click", q), e.addEventListener("pointerdown", Q)), t !== null && (t.removeEventListener("click", q), t.removeEventListener("pointerdown", Q));
595
- })));
596
- }
597
- function ce(n, e) {
598
- const t = n.target;
599
- if (!S(t)) return;
600
- const r = t.firstChild;
601
- if (S(r) && (r.tagName === "UL" || r.tagName === "OL")) return;
602
- const s = t.parentNode;
603
- if (!s || s.__lexicalListType !== "check") return;
604
- const i = t.getBoundingClientRect(), o = n.pageX / ge(t), a = window.getComputedStyle ? window.getComputedStyle(t, "::before") : { width: "0px" }, l = parseFloat(a.width);
605
- (t.dir === "rtl" ? o < i.right && o > i.right - l : o > i.left && o < i.left + l) && e();
606
- }
607
- function q(n) {
608
- ce(n, (() => {
609
- if (S(n.target)) {
610
- const e = n.target, t = Se(e);
611
- t != null && t.isEditable() && t.update((() => {
612
- const r = W(e);
613
- g(r) && (e.focus(), r.toggleChecked());
614
- }));
615
- }
616
- }));
617
- }
618
- function Q(n) {
619
- ce(n, (() => {
620
- n.preventDefault();
621
- }));
622
- }
623
- function K() {
624
- const n = document.activeElement;
625
- return S(n) && n.tagName === "LI" && n.parentNode != null && n.parentNode.__lexicalListType === "check" ? n : null;
626
- }
627
- function Z(n, e, t) {
628
- const r = K();
629
- return r != null && e.update((() => {
630
- const s = W(r);
631
- if (!g(s)) return;
632
- const i = (function(o, a) {
633
- let l = a ? o.getPreviousSibling() : o.getNextSibling(), c = o;
634
- for (; l == null && g(c); ) c = c.getParentOrThrow().getParent(), c != null && (l = a ? c.getPreviousSibling() : c.getNextSibling());
635
- for (; g(l); ) {
636
- const d = a ? l.getLastChild() : l.getFirstChild();
637
- if (!u(d)) return l;
638
- l = a ? d.getLastChild() : d.getFirstChild();
639
- }
640
- return null;
641
- })(s, t);
642
- if (i != null) {
643
- i.selectStart();
644
- const o = e.getElementByKey(i.__key);
645
- o != null && (n.preventDefault(), setTimeout((() => {
646
- o.focus();
647
- }), 0));
648
- }
649
- })), !1;
650
- }
651
- const Ae = D("INSERT_UNORDERED_LIST_COMMAND"), Fe = D("INSERT_ORDERED_LIST_COMMAND"), Me = D("REMOVE_LIST_COMMAND");
652
- function $e(n) {
653
- return re(n.registerCommand(Fe, (() => ($("number"), !0)), C), n.registerCommand(Ae, (() => ($("bullet"), !0)), C), n.registerCommand(Me, (() => (ve(), !0)), C), n.registerCommand(me, (() => xe()), C), n.registerNodeTransform(O, ((e) => {
654
- const t = e.getFirstChild();
655
- if (t) {
656
- if (pe(t)) {
657
- const r = t.getStyle(), s = t.getFormat();
658
- e.getTextStyle() !== r && e.setTextStyle(r), e.getTextFormat() !== s && e.setTextFormat(s);
659
- }
660
- } else {
661
- const r = P();
662
- L(r) && (r.style !== e.getTextStyle() || r.format !== e.getTextFormat()) && r.isCollapsed() && e.is(r.anchor.getNode()) && e.setTextStyle(r.style).setTextFormat(r.format);
663
- }
664
- })), n.registerNodeTransform(fe, ((e) => {
665
- const t = e.getParent();
666
- if (g(t) && e.is(t.getFirstChild())) {
667
- const r = e.getStyle(), s = e.getFormat();
668
- r === t.getTextStyle() && s === t.getTextFormat() || t.setTextStyle(r).setTextFormat(s);
669
- }
670
- })));
671
- }
672
- function Ke(n) {
673
- const e = (t) => {
674
- const r = t.getParent();
675
- if (u(t.getFirstChild()) || !u(r)) return;
676
- const s = ne(t, ((i) => g(i) && u(i.getParent()) && g(i.getPreviousSibling())));
677
- if (s === null && t.getIndent() > 0) t.setIndent(0);
678
- else if (g(s)) {
679
- const i = s.getPreviousSibling();
680
- if (g(i)) {
681
- const o = (function(l) {
682
- let c = l, d = c.getFirstChild();
683
- for (; u(d); ) {
684
- const h = d.getLastChild();
685
- if (!g(h)) break;
686
- c = h, d = c.getFirstChild();
687
- }
688
- return c;
689
- })(i), a = o.getParent();
690
- if (u(a)) {
691
- const l = R(a);
692
- l + 1 < R(r) && t.setIndent(l);
693
- }
694
- }
695
- }
696
- };
697
- return n.registerNodeTransform(E, ((t) => {
698
- const r = [t];
699
- for (; r.length > 0; ) {
700
- const s = r.shift();
701
- if (u(s)) {
702
- for (const i of s.getChildren()) if (g(i)) {
703
- e(i);
704
- const o = i.getFirstChild();
705
- u(o) && r.push(o);
706
- }
707
- }
708
- }
709
- }));
710
- }
711
- export {
712
- m as $createListItemNode,
713
- p as $createListNode,
714
- R as $getListDepth,
715
- xe as $handleListInsertParagraph,
716
- $ as $insertList,
717
- g as $isListItemNode,
718
- u as $isListNode,
719
- ve as $removeList,
720
- Ee as INSERT_CHECK_LIST_COMMAND,
721
- Fe as INSERT_ORDERED_LIST_COMMAND,
722
- Ae as INSERT_UNORDERED_LIST_COMMAND,
723
- O as ListItemNode,
724
- E as ListNode,
725
- Me as REMOVE_LIST_COMMAND,
726
- we as registerCheckList,
727
- $e as registerList,
728
- Ke as registerListStrictIndentTransform
729
- };