laif-ds 0.1.75 → 0.1.79

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 (82) hide show
  1. package/dist/_virtual/prism-cpp.js +3 -0
  2. package/dist/_virtual/prism-cpp2.js +5 -0
  3. package/dist/_virtual/prism-java.js +3 -0
  4. package/dist/_virtual/prism-java2.js +5 -0
  5. package/dist/_virtual/prism-python.js +3 -0
  6. package/dist/_virtual/prism-python2.js +5 -0
  7. package/dist/_virtual/prism-rust.js +3 -0
  8. package/dist/_virtual/prism-rust2.js +5 -0
  9. package/dist/_virtual/prism-typescript.js +3 -0
  10. package/dist/_virtual/prism-typescript2.js +5 -0
  11. package/dist/_virtual/prism.js +3 -0
  12. package/dist/_virtual/prism2.js +5 -0
  13. package/dist/components/editor/context/toolbar-context.js +42 -0
  14. package/dist/components/editor/editor-hooks/use-modal.js +30 -0
  15. package/dist/components/editor/editor-hooks/use-update-toolbar.js +24 -0
  16. package/dist/components/editor/editor-ui/content-editable.js +26 -0
  17. package/dist/components/editor/plugins/actions/actions-plugin.js +7 -0
  18. package/dist/components/editor/plugins/actions/clear-editor-plugin.js +39 -0
  19. package/dist/components/editor/plugins/actions/counter-character-plugin.js +53 -0
  20. package/dist/components/editor/plugins/toolbar/block-format/block-format-data.js +52 -0
  21. package/dist/components/editor/plugins/toolbar/block-format/format-bulleted-list.js +26 -0
  22. package/dist/components/editor/plugins/toolbar/block-format/format-check-list.js +26 -0
  23. package/dist/components/editor/plugins/toolbar/block-format/format-heading.js +31 -0
  24. package/dist/components/editor/plugins/toolbar/block-format/format-numbered-list.js +26 -0
  25. package/dist/components/editor/plugins/toolbar/block-format/format-paragraph.js +23 -0
  26. package/dist/components/editor/plugins/toolbar/block-format/format-quote.js +24 -0
  27. package/dist/components/editor/plugins/toolbar/block-format-toolbar-plugin.js +56 -0
  28. package/dist/components/editor/plugins/toolbar/font-format-toolbar-plugin.js +50 -0
  29. package/dist/components/editor/plugins/toolbar/history-toolbar-plugin.js +69 -0
  30. package/dist/components/editor/plugins/toolbar/toolbar-plugin.js +34 -0
  31. package/dist/components/editor/themes/editor-theme.js +112 -0
  32. package/dist/components/ui/app-editor.js +150 -0
  33. package/dist/components/ui/app-multiple-select-dropdown.js +2 -2
  34. package/dist/components/ui/button.js +25 -24
  35. package/dist/components/ui/calendar.js +9 -9
  36. package/dist/components/ui/dialog.js +43 -37
  37. package/dist/index.d.ts +23 -1
  38. package/dist/index.js +48 -44
  39. package/dist/laif-ds.css +1 -0
  40. package/dist/node_modules/@lexical/clipboard/LexicalClipboard.prod.js +159 -0
  41. package/dist/node_modules/@lexical/code/LexicalCode.prod.js +236 -0
  42. package/dist/node_modules/@lexical/dragon/LexicalDragon.prod.js +46 -0
  43. package/dist/node_modules/@lexical/history/LexicalHistory.prod.js +89 -0
  44. package/dist/node_modules/@lexical/html/LexicalHtml.prod.js +108 -0
  45. package/dist/node_modules/@lexical/link/LexicalLink.prod.js +187 -0
  46. package/dist/node_modules/@lexical/list/LexicalList.prod.js +729 -0
  47. package/dist/node_modules/@lexical/markdown/LexicalMarkdown.prod.js +367 -0
  48. package/dist/node_modules/@lexical/react/LexicalCheckListPlugin.prod.js +11 -0
  49. package/dist/node_modules/@lexical/react/LexicalClearEditorPlugin.prod.js +17 -0
  50. package/dist/node_modules/@lexical/react/LexicalComposer.prod.js +45 -0
  51. package/dist/node_modules/@lexical/react/LexicalComposerContext.prod.js +22 -0
  52. package/dist/node_modules/@lexical/react/LexicalContentEditable.prod.js +55 -0
  53. package/dist/node_modules/@lexical/react/LexicalErrorBoundary.prod.js +49 -0
  54. package/dist/node_modules/@lexical/react/LexicalHistoryPlugin.prod.js +15 -0
  55. package/dist/node_modules/@lexical/react/LexicalListPlugin.prod.js +17 -0
  56. package/dist/node_modules/@lexical/react/LexicalOnChangePlugin.prod.js +16 -0
  57. package/dist/node_modules/@lexical/react/LexicalRichTextPlugin.prod.js +56 -0
  58. package/dist/node_modules/@lexical/react/useLexicalEditable.prod.js +21 -0
  59. package/dist/node_modules/@lexical/rich-text/LexicalRichText.prod.js +376 -0
  60. package/dist/node_modules/@lexical/selection/LexicalSelection.prod.js +107 -0
  61. package/dist/node_modules/@lexical/table/LexicalTable.prod.js +661 -0
  62. package/dist/node_modules/@lexical/text/LexicalText.prod.js +37 -0
  63. package/dist/node_modules/@lexical/utils/LexicalUtils.prod.js +102 -0
  64. package/dist/node_modules/lexical/Lexical.prod.js +4901 -0
  65. package/dist/node_modules/prismjs/components/prism-c.js +77 -0
  66. package/dist/node_modules/prismjs/components/prism-clike.js +32 -0
  67. package/dist/node_modules/prismjs/components/prism-cpp.js +93 -0
  68. package/dist/node_modules/prismjs/components/prism-css.js +56 -0
  69. package/dist/node_modules/prismjs/components/prism-java.js +122 -0
  70. package/dist/node_modules/prismjs/components/prism-javascript.js +138 -0
  71. package/dist/node_modules/prismjs/components/prism-markdown.js +301 -0
  72. package/dist/node_modules/prismjs/components/prism-markup.js +174 -0
  73. package/dist/node_modules/prismjs/components/prism-objectivec.js +11 -0
  74. package/dist/node_modules/prismjs/components/prism-powershell.js +56 -0
  75. package/dist/node_modules/prismjs/components/prism-python.js +69 -0
  76. package/dist/node_modules/prismjs/components/prism-rust.js +124 -0
  77. package/dist/node_modules/prismjs/components/prism-sql.js +34 -0
  78. package/dist/node_modules/prismjs/components/prism-swift.js +114 -0
  79. package/dist/node_modules/prismjs/components/prism-typescript.js +53 -0
  80. package/dist/node_modules/prismjs/prism.js +1165 -0
  81. package/dist/styles.v3.css +1 -1
  82. package/package.json +12 -1
@@ -0,0 +1,236 @@
1
+ "use client";
2
+ import { addClassNamesToElement as d, $getAdjacentCaret as D, removeClassNamesFromElement as I } from "../utils/LexicalUtils.prod.js";
3
+ import { ElementNode as R, $createParagraphNode as T, $isTextNode as W, $isTabNode as $, $createTabNode as j, $createLineBreakNode as b, $applyNodeReplacement as A, isHTMLElement as B, $getSiblingCaret as q, TextNode as z } from "../../lexical/Lexical.prod.js";
4
+ import "../../../_virtual/prism.js";
5
+ import "../../prismjs/components/prism-clike.js";
6
+ import "../../prismjs/components/prism-javascript.js";
7
+ import "../../prismjs/components/prism-markup.js";
8
+ import "../../prismjs/components/prism-markdown.js";
9
+ import "../../prismjs/components/prism-c.js";
10
+ import "../../prismjs/components/prism-css.js";
11
+ import "../../prismjs/components/prism-objectivec.js";
12
+ import "../../prismjs/components/prism-sql.js";
13
+ import "../../prismjs/components/prism-powershell.js";
14
+ import "../../../_virtual/prism-python.js";
15
+ import "../../../_virtual/prism-rust.js";
16
+ import "../../prismjs/components/prism-swift.js";
17
+ import "../../../_virtual/prism-typescript.js";
18
+ import "../../../_virtual/prism-java.js";
19
+ import "../../../_virtual/prism-cpp.js";
20
+ const Q = globalThis.Prism || window.Prism, O = (n) => {
21
+ try {
22
+ return !!n && Q.languages.hasOwnProperty(n);
23
+ } catch {
24
+ return !1;
25
+ }
26
+ };
27
+ function J(n, e) {
28
+ for (const t of n.childNodes) {
29
+ if (B(t) && t.tagName === e) return !0;
30
+ J(t, e);
31
+ }
32
+ return !1;
33
+ }
34
+ const c = "data-language", p = "data-highlight-language";
35
+ class f extends R {
36
+ static getType() {
37
+ return "code";
38
+ }
39
+ static clone(e) {
40
+ return new f(e.__language, e.__key);
41
+ }
42
+ constructor(e, t) {
43
+ super(t), this.__language = e || void 0, this.__isSyntaxHighlightSupported = O(e);
44
+ }
45
+ createDOM(e) {
46
+ const t = document.createElement("code");
47
+ d(t, e.theme.code), t.setAttribute("spellcheck", "false");
48
+ const r = this.getLanguage();
49
+ return r && (t.setAttribute(c, r), this.getIsSyntaxHighlightSupported() && t.setAttribute(p, r)), t;
50
+ }
51
+ updateDOM(e, t, r) {
52
+ const i = this.__language, s = e.__language;
53
+ return i ? i !== s && (t.setAttribute(c, i), this.__isSyntaxHighlightSupported && t.setAttribute(p, i)) : s && (t.removeAttribute(c), e.__isSyntaxHighlightSupported && t.removeAttribute(p)), !1;
54
+ }
55
+ exportDOM(e) {
56
+ const t = document.createElement("pre");
57
+ d(t, e._config.theme.code), t.setAttribute("spellcheck", "false");
58
+ const r = this.getLanguage();
59
+ return r && (t.setAttribute(c, r), this.getIsSyntaxHighlightSupported() && t.setAttribute(p, r)), { element: t };
60
+ }
61
+ static importDOM() {
62
+ return { code: (e) => e.textContent != null && (/\r?\n/.test(e.textContent) || J(e, "BR")) ? { conversion: C, priority: 1 } : null, div: () => ({ conversion: X, priority: 1 }), pre: () => ({ conversion: C, priority: 0 }), table: (e) => y(e) ? { conversion: G, priority: 3 } : null, td: (e) => {
63
+ const t = e, r = t.closest("table");
64
+ return t.classList.contains("js-file-line") || r && y(r) ? { conversion: v, priority: 3 } : null;
65
+ }, tr: (e) => {
66
+ const t = e.closest("table");
67
+ return t && y(t) ? { conversion: v, priority: 3 } : null;
68
+ } };
69
+ }
70
+ static importJSON(e) {
71
+ return h().updateFromJSON(e);
72
+ }
73
+ updateFromJSON(e) {
74
+ return super.updateFromJSON(e).setLanguage(e.language);
75
+ }
76
+ exportJSON() {
77
+ return { ...super.exportJSON(), language: this.getLanguage() };
78
+ }
79
+ insertNewAfter(e, t = !0) {
80
+ const r = this.getChildren(), i = r.length;
81
+ if (i >= 2 && r[i - 1].getTextContent() === `
82
+ ` && r[i - 2].getTextContent() === `
83
+ ` && e.isCollapsed() && e.anchor.key === this.__key && e.anchor.offset === i) {
84
+ r[i - 1].remove(), r[i - 2].remove();
85
+ const o = T();
86
+ return this.insertAfter(o, t), o;
87
+ }
88
+ const { anchor: s, focus: u } = e, a = (s.isBefore(u) ? s : u).getNode();
89
+ if (W(a)) {
90
+ let o = V(a);
91
+ const g = [];
92
+ for (; ; ) if ($(o)) g.push(j()), o = o.getNextSibling();
93
+ else {
94
+ if (!F(o)) break;
95
+ {
96
+ let l = 0;
97
+ const w = o.getTextContent(), x = o.getTextContentSize();
98
+ for (; l < x && w[l] === " "; ) l++;
99
+ if (l !== 0 && g.push(L(" ".repeat(l))), l !== x) break;
100
+ o = o.getNextSibling();
101
+ }
102
+ }
103
+ const _ = a.splitText(s.offset)[0], E = s.offset === 0 ? 0 : 1, P = _.getIndexWithinParent() + E, M = a.getParentOrThrow(), k = [b(), ...g];
104
+ M.splice(P, 0, k);
105
+ const S = g[g.length - 1];
106
+ S ? S.select() : s.offset === 0 ? _.selectPrevious() : _.getNextSibling().selectNext(0, 0);
107
+ }
108
+ if (U(a)) {
109
+ const { offset: o } = e.anchor;
110
+ a.splice(o, 0, [b()]), a.select(o + 1, o + 1);
111
+ }
112
+ return null;
113
+ }
114
+ canIndent() {
115
+ return !1;
116
+ }
117
+ collapseAtStart() {
118
+ const e = T();
119
+ return this.getChildren().forEach((t) => e.append(t)), this.replace(e), !0;
120
+ }
121
+ setLanguage(e) {
122
+ const t = this.getWritable();
123
+ return t.__language = e || void 0, t.__isSyntaxHighlightSupported = O(e), t;
124
+ }
125
+ getLanguage() {
126
+ return this.getLatest().__language;
127
+ }
128
+ getIsSyntaxHighlightSupported() {
129
+ return this.getLatest().__isSyntaxHighlightSupported;
130
+ }
131
+ }
132
+ function h(n) {
133
+ return A(new f(n));
134
+ }
135
+ function U(n) {
136
+ return n instanceof f;
137
+ }
138
+ function C(n) {
139
+ return { node: h(n.getAttribute(c)) };
140
+ }
141
+ function X(n) {
142
+ const e = n, t = H(e);
143
+ return t || function(r) {
144
+ let i = r.parentElement;
145
+ for (; i !== null; ) {
146
+ if (H(i)) return !0;
147
+ i = i.parentElement;
148
+ }
149
+ return !1;
150
+ }(e) ? { node: t ? h() : null } : { node: null };
151
+ }
152
+ function G() {
153
+ return { node: h() };
154
+ }
155
+ function v() {
156
+ return { node: null };
157
+ }
158
+ function H(n) {
159
+ return n.style.fontFamily.match("monospace") !== null;
160
+ }
161
+ function y(n) {
162
+ return n.classList.contains("js-file-line-container");
163
+ }
164
+ class m extends z {
165
+ constructor(e = "", t, r) {
166
+ super(e, r), this.__highlightType = t;
167
+ }
168
+ static getType() {
169
+ return "code-highlight";
170
+ }
171
+ static clone(e) {
172
+ return new m(e.__text, e.__highlightType || void 0, e.__key);
173
+ }
174
+ getHighlightType() {
175
+ return this.getLatest().__highlightType;
176
+ }
177
+ setHighlightType(e) {
178
+ const t = this.getWritable();
179
+ return t.__highlightType = e || void 0, t;
180
+ }
181
+ canHaveFormat() {
182
+ return !1;
183
+ }
184
+ createDOM(e) {
185
+ const t = super.createDOM(e), r = N(e.theme, this.__highlightType);
186
+ return d(t, r), t;
187
+ }
188
+ updateDOM(e, t, r) {
189
+ const i = super.updateDOM(e, t, r), s = N(r.theme, e.__highlightType), u = N(r.theme, this.__highlightType);
190
+ return s !== u && (s && I(t, s), u && d(t, u)), i;
191
+ }
192
+ static importJSON(e) {
193
+ return L().updateFromJSON(e);
194
+ }
195
+ updateFromJSON(e) {
196
+ return super.updateFromJSON(e).setHighlightType(e.highlightType);
197
+ }
198
+ exportJSON() {
199
+ return { ...super.exportJSON(), highlightType: this.getHighlightType() };
200
+ }
201
+ setFormat(e) {
202
+ return this;
203
+ }
204
+ isParentRequired() {
205
+ return !0;
206
+ }
207
+ createParentElementNode() {
208
+ return h();
209
+ }
210
+ }
211
+ function N(n, e) {
212
+ return e && n && n.codeHighlight && n.codeHighlight[e];
213
+ }
214
+ function L(n = "", e) {
215
+ return A(new m(n, e));
216
+ }
217
+ function F(n) {
218
+ return n instanceof m;
219
+ }
220
+ function K(n, e) {
221
+ let t = n;
222
+ for (let r = q(n, e); r && (F(r.origin) || $(r.origin)); r = D(r)) t = r.origin;
223
+ return t;
224
+ }
225
+ function V(n) {
226
+ return K(n, "previous");
227
+ }
228
+ export {
229
+ L as $createCodeHighlightNode,
230
+ h as $createCodeNode,
231
+ V as $getFirstCodeNodeOfLine,
232
+ F as $isCodeHighlightNode,
233
+ U as $isCodeNode,
234
+ m as CodeHighlightNode,
235
+ f as CodeNode
236
+ };
@@ -0,0 +1,46 @@
1
+ "use client";
2
+ import { $getSelection as T, $isRangeSelection as v, $isTextNode as N } from "../../lexical/Lexical.prod.js";
3
+ function h(g) {
4
+ const x = window.location.origin, d = (a) => {
5
+ if (a.origin !== x) return;
6
+ const R = g.getRootElement();
7
+ if (document.activeElement !== R) return;
8
+ const f = a.data;
9
+ if (typeof f == "string") {
10
+ let o;
11
+ try {
12
+ o = JSON.parse(f);
13
+ } catch {
14
+ return;
15
+ }
16
+ if (o && o.protocol === "nuanria_messaging" && o.type === "request") {
17
+ const r = o.payload;
18
+ if (r && r.functionId === "makeChanges") {
19
+ const u = r.args;
20
+ if (u) {
21
+ const [c, m, p, l, S, y] = u;
22
+ g.update(() => {
23
+ const i = T();
24
+ if (v(i)) {
25
+ const w = i.anchor;
26
+ let e = w.getNode(), t = 0, n = 0;
27
+ if (N(e) && c >= 0 && m >= 0 && (t = c, n = c + m, i.setTextNodeRange(e, t, e, n)), t === n && p === "" || (i.insertRawText(p), e = w.getNode()), N(e)) {
28
+ t = l, n = l + S;
29
+ const s = e.getTextContentSize();
30
+ t = t > s ? s : t, n = n > s ? s : n, i.setTextNodeRange(e, t, e, n);
31
+ }
32
+ a.stopImmediatePropagation();
33
+ }
34
+ });
35
+ }
36
+ }
37
+ }
38
+ }
39
+ };
40
+ return window.addEventListener("message", d, !0), () => {
41
+ window.removeEventListener("message", d, !0);
42
+ };
43
+ }
44
+ export {
45
+ h as registerDragonSupport
46
+ };
@@ -0,0 +1,89 @@
1
+ "use client";
2
+ import { mergeRegister as G } from "../utils/LexicalUtils.prod.js";
3
+ import { CAN_REDO_COMMAND as A, CAN_UNDO_COMMAND as D, CLEAR_HISTORY_COMMAND as J, COMMAND_PRIORITY_EDITOR as x, CLEAR_EDITOR_COMMAND as U, REDO_COMMAND as $, HISTORIC_TAG as H, UNDO_COMMAND as j, HISTORY_PUSH_TAG as w, HISTORY_MERGE_TAG as P, $isRangeSelection as T, $isTextNode as N, $isRootNode as Q } from "../../lexical/Lexical.prod.js";
4
+ const E = 0, z = 1, v = 2, c = 0, V = 1, L = 2, b = 3, q = 4;
5
+ function B(t, s, d, f, m) {
6
+ if (t === null || d.size === 0 && f.size === 0 && !m) return c;
7
+ const n = s._selection, r = t._selection;
8
+ if (m) return V;
9
+ if (!(T(n) && T(r) && r.isCollapsed() && n.isCollapsed())) return c;
10
+ const o = function(p, u, C) {
11
+ const O = p._nodeMap, S = [];
12
+ for (const M of u) {
13
+ const R = O.get(M);
14
+ R !== void 0 && S.push(R);
15
+ }
16
+ for (const [M, R] of C) {
17
+ if (!R) continue;
18
+ const I = O.get(M);
19
+ I === void 0 || Q(I) || S.push(I);
20
+ }
21
+ return S;
22
+ }(s, d, f);
23
+ if (o.length === 0) return c;
24
+ if (o.length > 1) {
25
+ const p = s._nodeMap, u = p.get(n.anchor.key), C = p.get(r.anchor.key);
26
+ return u && C && !t._nodeMap.has(u.__key) && N(u) && u.__text.length === 1 && n.anchor.offset === 1 ? L : c;
27
+ }
28
+ const a = o[0], i = t._nodeMap.get(a.__key);
29
+ if (!N(i) || !N(a) || i.__mode !== a.__mode) return c;
30
+ const e = i.__text, _ = a.__text;
31
+ if (e === _) return c;
32
+ const h = n.anchor, g = r.anchor;
33
+ if (h.key !== g.key || h.type !== "text") return c;
34
+ const l = h.offset, k = g.offset, y = _.length - e.length;
35
+ return y === 1 && k === l - 1 ? L : y === -1 && k === l + 1 ? b : y === -1 && k === l ? q : c;
36
+ }
37
+ function F(t, s) {
38
+ let d = Date.now(), f = c;
39
+ return (m, n, r, o, a, i) => {
40
+ const e = Date.now();
41
+ if (i.has(H)) return f = c, d = e, v;
42
+ const _ = B(m, n, o, a, t.isComposing()), h = (() => {
43
+ const g = r === null || r.editor === t, l = i.has(w);
44
+ if (!l && g && i.has(P)) return E;
45
+ if (m === null) return z;
46
+ const k = n._selection;
47
+ return o.size > 0 || a.size > 0 ? l === !1 && _ !== c && _ === f && e < d + s && g || o.size === 1 && function(y, p, u) {
48
+ const C = p._nodeMap.get(y), O = u._nodeMap.get(y), S = p._selection, M = u._selection;
49
+ return !(T(S) && T(M) && S.anchor.type === "element" && S.focus.type === "element" && M.anchor.type === "text" && M.focus.type === "text" || !N(C) || !N(O) || C.__parent !== O.__parent) && JSON.stringify(p.read(() => C.exportJSON())) === JSON.stringify(u.read(() => O.exportJSON()));
50
+ }(Array.from(o)[0], m, n) ? E : z : k !== null ? E : v;
51
+ })();
52
+ return d = e, f = _, h;
53
+ };
54
+ }
55
+ function Y(t) {
56
+ t.undoStack = [], t.redoStack = [], t.current = null;
57
+ }
58
+ function X(t, s, d) {
59
+ const f = F(t, d);
60
+ return G(t.registerCommand(j, () => (function(n, r) {
61
+ const o = r.redoStack, a = r.undoStack;
62
+ if (a.length !== 0) {
63
+ const i = r.current, e = a.pop();
64
+ i !== null && (o.push(i), n.dispatchCommand(A, !0)), a.length === 0 && n.dispatchCommand(D, !1), r.current = e || null, e && e.editor.setEditorState(e.editorState, { tag: H });
65
+ }
66
+ }(t, s), !0), x), t.registerCommand($, () => (function(n, r) {
67
+ const o = r.redoStack, a = r.undoStack;
68
+ if (o.length !== 0) {
69
+ const i = r.current;
70
+ i !== null && (a.push(i), n.dispatchCommand(D, !0));
71
+ const e = o.pop();
72
+ o.length === 0 && n.dispatchCommand(A, !1), r.current = e || null, e && e.editor.setEditorState(e.editorState, { tag: H });
73
+ }
74
+ }(t, s), !0), x), t.registerCommand(U, () => (Y(s), !1), x), t.registerCommand(J, () => (Y(s), t.dispatchCommand(A, !1), t.dispatchCommand(D, !1), !0), x), t.registerUpdateListener(({ editorState: n, prevEditorState: r, dirtyLeaves: o, dirtyElements: a, tags: i }) => {
75
+ const e = s.current, _ = s.redoStack, h = s.undoStack, g = e === null ? null : e.editorState;
76
+ if (e !== null && n === g) return;
77
+ const l = f(r, n, e, o, a, i);
78
+ if (l === z) _.length !== 0 && (s.redoStack = [], t.dispatchCommand(A, !1)), e !== null && (h.push({ ...e }), t.dispatchCommand(D, !0));
79
+ else if (l === v) return;
80
+ s.current = { editor: t, editorState: n };
81
+ }));
82
+ }
83
+ function Z() {
84
+ return { current: null, redoStack: [], undoStack: [] };
85
+ }
86
+ export {
87
+ Z as createEmptyHistoryState,
88
+ X as registerHistory
89
+ };
@@ -0,0 +1,108 @@
1
+ "use client";
2
+ import { $sliceSelectedTextNodeContent as E } from "../selection/LexicalSelection.prod.js";
3
+ import { ArtificialNode__DO_NOT_USE as $, $createLineBreakNode as v, $isRootOrShadowRoot as O, $isBlockElementNode as y, isBlockDomNode as C, isInlineDomNode as S, $isElementNode as N, $getRoot as _, $cloneWithProperties as k, $isTextNode as L, isHTMLElement as P, isDocumentFragment as b, $createParagraphNode as B } from "../../lexical/Lexical.prod.js";
4
+ function I(l, o) {
5
+ const c = o.body ? o.body.childNodes : [];
6
+ let r = [];
7
+ const s = [];
8
+ for (let a = 0; a < c.length; a++) {
9
+ const e = c[a];
10
+ if (!F.has(e.nodeName)) {
11
+ const n = T(e, l, s, !1);
12
+ n !== null && (r = r.concat(n));
13
+ }
14
+ }
15
+ return function(a) {
16
+ for (const e of a) e.getNextSibling() instanceof $ && e.insertAfter(v());
17
+ for (const e of a) {
18
+ const n = e.getChildren();
19
+ for (const f of n) e.insertBefore(f);
20
+ e.remove();
21
+ }
22
+ }(s), r;
23
+ }
24
+ function z(l, o) {
25
+ if (typeof document > "u" || typeof window > "u" && global.window === void 0) throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");
26
+ const c = document.createElement("div"), r = _().getChildren();
27
+ for (let s = 0; s < r.length; s++)
28
+ D(l, r[s], c, o);
29
+ return c.innerHTML;
30
+ }
31
+ function D(l, o, c, r = null) {
32
+ let s = r === null || o.isSelected(r);
33
+ const a = N(o) && o.excludeFromCopy("html");
34
+ let e = o;
35
+ if (r !== null) {
36
+ let i = k(o);
37
+ i = L(i) && r !== null ? E(r, i) : i, e = i;
38
+ }
39
+ const n = N(e) ? e.getChildren() : [], f = l._nodes.get(e.getType());
40
+ let h;
41
+ h = f && f.exportDOM !== void 0 ? f.exportDOM(l, e) : e.exportDOM(l);
42
+ const { element: d, after: m } = h;
43
+ if (!d) return !1;
44
+ const u = document.createDocumentFragment();
45
+ for (let i = 0; i < n.length; i++) {
46
+ const t = n[i], p = D(l, t, u, r);
47
+ !s && N(o) && p && o.extractWithChild(t, r, "html") && (s = !0);
48
+ }
49
+ if (s && !a) {
50
+ if ((P(d) || b(d)) && d.append(u), c.append(d), m) {
51
+ const i = m.call(e, d);
52
+ i && (b(d) ? d.replaceChildren(i) : d.replaceWith(i));
53
+ }
54
+ } else c.append(u);
55
+ return s;
56
+ }
57
+ const F = /* @__PURE__ */ new Set(["STYLE", "SCRIPT"]);
58
+ function T(l, o, c, r, s = /* @__PURE__ */ new Map(), a) {
59
+ let e = [];
60
+ if (F.has(l.nodeName)) return e;
61
+ let n = null;
62
+ const f = function(t, p) {
63
+ const { nodeName: A } = t, x = p._htmlConversions.get(A.toLowerCase());
64
+ let g = null;
65
+ if (x !== void 0) for (const M of x) {
66
+ const w = M(t);
67
+ w !== null && (g === null || (g.priority || 0) <= (w.priority || 0)) && (g = w);
68
+ }
69
+ return g !== null ? g.conversion : null;
70
+ }(l, o), h = f ? f(l) : null;
71
+ let d = null;
72
+ if (h !== null) {
73
+ d = h.after;
74
+ const t = h.node;
75
+ if (n = Array.isArray(t) ? t[t.length - 1] : t, n !== null) {
76
+ for (const [, p] of s) if (n = p(n, a), !n) break;
77
+ n && e.push(...Array.isArray(t) ? t : [n]);
78
+ }
79
+ h.forChild != null && s.set(l.nodeName, h.forChild);
80
+ }
81
+ const m = l.childNodes;
82
+ let u = [];
83
+ const i = (n == null || !O(n)) && (n != null && y(n) || r);
84
+ for (let t = 0; t < m.length; t++) u.push(...T(m[t], o, c, i, new Map(s), n));
85
+ return d != null && (u = d(u)), C(l) && (u = H(l, u, i ? () => {
86
+ const t = new $();
87
+ return c.push(t), t;
88
+ } : B)), n == null ? u.length > 0 ? e = e.concat(u) : C(l) && function(t) {
89
+ return t.nextSibling == null || t.previousSibling == null ? !1 : S(t.nextSibling) && S(t.previousSibling);
90
+ }(l) && (e = e.concat(v())) : N(n) && n.append(...u), e;
91
+ }
92
+ function H(l, o, c) {
93
+ const r = l.style.textAlign, s = [];
94
+ let a = [];
95
+ for (let e = 0; e < o.length; e++) {
96
+ const n = o[e];
97
+ if (y(n)) r && !n.getFormat() && n.setFormat(r), s.push(n);
98
+ else if (a.push(n), e === o.length - 1 || e < o.length - 1 && y(o[e + 1])) {
99
+ const f = c();
100
+ f.setFormat(r), f.append(...a), s.push(f), a = [];
101
+ }
102
+ }
103
+ return s;
104
+ }
105
+ export {
106
+ z as $generateHtmlFromNodes,
107
+ I as $generateNodesFromDOM
108
+ };
@@ -0,0 +1,187 @@
1
+ "use client";
2
+ import { addClassNamesToElement as g } from "../utils/LexicalUtils.prod.js";
3
+ import { ElementNode as p, isHTMLAnchorElement as h, $isRangeSelection as f, $applyNodeReplacement as d, $isElementNode as m } from "../../lexical/Lexical.prod.js";
4
+ const k = /* @__PURE__ */ new Set(["http:", "https:", "mailto:", "sms:", "tel:"]);
5
+ class u extends p {
6
+ static getType() {
7
+ return "link";
8
+ }
9
+ static clone(t) {
10
+ return new u(t.__url, { rel: t.__rel, target: t.__target, title: t.__title }, t.__key);
11
+ }
12
+ constructor(t = "", e = {}, n) {
13
+ super(n);
14
+ const { target: i = null, rel: s = null, title: l = null } = e;
15
+ this.__url = t, this.__target = i, this.__rel = s, this.__title = l;
16
+ }
17
+ createDOM(t) {
18
+ const e = document.createElement("a");
19
+ return this.updateLinkDOM(null, e, t), g(e, t.theme.link), e;
20
+ }
21
+ updateLinkDOM(t, e, n) {
22
+ if (h(e)) {
23
+ t && t.__url === this.__url || (e.href = this.sanitizeUrl(this.__url));
24
+ for (const i of ["target", "rel", "title"]) {
25
+ const s = `__${i}`, l = this[s];
26
+ t && t[s] === l || (l ? e[i] = l : e.removeAttribute(i));
27
+ }
28
+ }
29
+ }
30
+ updateDOM(t, e, n) {
31
+ return this.updateLinkDOM(t, e, n), !1;
32
+ }
33
+ static importDOM() {
34
+ return { a: (t) => ({ conversion: U, priority: 1 }) };
35
+ }
36
+ static importJSON(t) {
37
+ return o().updateFromJSON(t);
38
+ }
39
+ updateFromJSON(t) {
40
+ return super.updateFromJSON(t).setURL(t.url).setRel(t.rel || null).setTarget(t.target || null).setTitle(t.title || null);
41
+ }
42
+ sanitizeUrl(t) {
43
+ t = c(t);
44
+ try {
45
+ const e = new URL(c(t));
46
+ if (!k.has(e.protocol)) return "about:blank";
47
+ } catch {
48
+ return t;
49
+ }
50
+ return t;
51
+ }
52
+ exportJSON() {
53
+ return { ...super.exportJSON(), rel: this.getRel(), target: this.getTarget(), title: this.getTitle(), url: this.getURL() };
54
+ }
55
+ getURL() {
56
+ return this.getLatest().__url;
57
+ }
58
+ setURL(t) {
59
+ const e = this.getWritable();
60
+ return e.__url = t, e;
61
+ }
62
+ getTarget() {
63
+ return this.getLatest().__target;
64
+ }
65
+ setTarget(t) {
66
+ const e = this.getWritable();
67
+ return e.__target = t, e;
68
+ }
69
+ getRel() {
70
+ return this.getLatest().__rel;
71
+ }
72
+ setRel(t) {
73
+ const e = this.getWritable();
74
+ return e.__rel = t, e;
75
+ }
76
+ getTitle() {
77
+ return this.getLatest().__title;
78
+ }
79
+ setTitle(t) {
80
+ const e = this.getWritable();
81
+ return e.__title = t, e;
82
+ }
83
+ insertNewAfter(t, e = !0) {
84
+ const n = o(this.__url, { rel: this.__rel, target: this.__target, title: this.__title });
85
+ return this.insertAfter(n, e), n;
86
+ }
87
+ canInsertTextBefore() {
88
+ return !1;
89
+ }
90
+ canInsertTextAfter() {
91
+ return !1;
92
+ }
93
+ canBeEmpty() {
94
+ return !1;
95
+ }
96
+ isInline() {
97
+ return !0;
98
+ }
99
+ extractWithChild(t, e, n) {
100
+ if (!f(e)) return !1;
101
+ const i = e.anchor.getNode(), s = e.focus.getNode();
102
+ return this.isParentOf(i) && this.isParentOf(s) && e.getTextContent().length > 0;
103
+ }
104
+ isEmailURI() {
105
+ return this.__url.startsWith("mailto:");
106
+ }
107
+ isWebSiteURI() {
108
+ return this.__url.startsWith("https://") || this.__url.startsWith("http://");
109
+ }
110
+ }
111
+ function U(r) {
112
+ let t = null;
113
+ if (h(r)) {
114
+ const e = r.textContent;
115
+ (e !== null && e !== "" || r.children.length > 0) && (t = o(r.getAttribute("href") || "", { rel: r.getAttribute("rel"), target: r.getAttribute("target"), title: r.getAttribute("title") }));
116
+ }
117
+ return { node: t };
118
+ }
119
+ function o(r = "", t) {
120
+ return d(new u(r, t));
121
+ }
122
+ function S(r) {
123
+ return r instanceof u;
124
+ }
125
+ class a extends u {
126
+ constructor(t = "", e = {}, n) {
127
+ super(t, e, n), this.__isUnlinked = e.isUnlinked !== void 0 && e.isUnlinked !== null && e.isUnlinked;
128
+ }
129
+ static getType() {
130
+ return "autolink";
131
+ }
132
+ static clone(t) {
133
+ return new a(t.__url, { isUnlinked: t.__isUnlinked, rel: t.__rel, target: t.__target, title: t.__title }, t.__key);
134
+ }
135
+ getIsUnlinked() {
136
+ return this.__isUnlinked;
137
+ }
138
+ setIsUnlinked(t) {
139
+ const e = this.getWritable();
140
+ return e.__isUnlinked = t, e;
141
+ }
142
+ createDOM(t) {
143
+ return this.__isUnlinked ? document.createElement("span") : super.createDOM(t);
144
+ }
145
+ updateDOM(t, e, n) {
146
+ return super.updateDOM(t, e, n) || t.__isUnlinked !== this.__isUnlinked;
147
+ }
148
+ static importJSON(t) {
149
+ return _().updateFromJSON(t);
150
+ }
151
+ updateFromJSON(t) {
152
+ return super.updateFromJSON(t).setIsUnlinked(t.isUnlinked || !1);
153
+ }
154
+ static importDOM() {
155
+ return null;
156
+ }
157
+ exportJSON() {
158
+ return { ...super.exportJSON(), isUnlinked: this.__isUnlinked };
159
+ }
160
+ insertNewAfter(t, e = !0) {
161
+ const n = this.getParentOrThrow().insertNewAfter(t, e);
162
+ if (m(n)) {
163
+ const i = _(this.__url, { isUnlinked: this.__isUnlinked, rel: this.__rel, target: this.__target, title: this.__title });
164
+ return n.append(i), i;
165
+ }
166
+ return null;
167
+ }
168
+ }
169
+ function _(r = "", t) {
170
+ return d(new a(r, t));
171
+ }
172
+ function T(r) {
173
+ return r instanceof a;
174
+ }
175
+ const N = /^\+?[0-9\s()-]{5,}$/;
176
+ function c(r) {
177
+ return r.match(/^[a-z][a-z0-9+.-]*:/i) || r.match(/^[/#.]/) ? r : r.includes("@") ? `mailto:${r}` : N.test(r) ? `tel:${r}` : `https://${r}`;
178
+ }
179
+ export {
180
+ _ as $createAutoLinkNode,
181
+ o as $createLinkNode,
182
+ T as $isAutoLinkNode,
183
+ S as $isLinkNode,
184
+ a as AutoLinkNode,
185
+ u as LinkNode,
186
+ c as formatUrl
187
+ };