laif-ds 0.1.76 → 0.1.80

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 (96) hide show
  1. package/dist/_virtual/index.js +5 -3
  2. package/dist/_virtual/index2.js +5 -2
  3. package/dist/_virtual/index3.js +5 -5
  4. package/dist/_virtual/index4.js +2 -5
  5. package/dist/_virtual/index5.js +2 -5
  6. package/dist/_virtual/index7.js +3 -2
  7. package/dist/_virtual/prism-cpp.js +3 -0
  8. package/dist/_virtual/prism-cpp2.js +5 -0
  9. package/dist/_virtual/prism-java.js +3 -0
  10. package/dist/_virtual/prism-java2.js +5 -0
  11. package/dist/_virtual/prism-python.js +3 -0
  12. package/dist/_virtual/prism-python2.js +5 -0
  13. package/dist/_virtual/prism-rust.js +3 -0
  14. package/dist/_virtual/prism-rust2.js +5 -0
  15. package/dist/_virtual/prism-typescript.js +3 -0
  16. package/dist/_virtual/prism-typescript2.js +5 -0
  17. package/dist/_virtual/prism.js +3 -0
  18. package/dist/_virtual/prism2.js +5 -0
  19. package/dist/components/editor/context/toolbar-context.js +42 -0
  20. package/dist/components/editor/editor-hooks/use-modal.js +30 -0
  21. package/dist/components/editor/editor-hooks/use-update-toolbar.js +24 -0
  22. package/dist/components/editor/editor-ui/content-editable.js +26 -0
  23. package/dist/components/editor/plugins/actions/actions-plugin.js +7 -0
  24. package/dist/components/editor/plugins/actions/clear-editor-plugin.js +39 -0
  25. package/dist/components/editor/plugins/actions/counter-character-plugin.js +53 -0
  26. package/dist/components/editor/plugins/toolbar/block-format/block-format-data.js +52 -0
  27. package/dist/components/editor/plugins/toolbar/block-format/format-bulleted-list.js +26 -0
  28. package/dist/components/editor/plugins/toolbar/block-format/format-check-list.js +26 -0
  29. package/dist/components/editor/plugins/toolbar/block-format/format-heading.js +31 -0
  30. package/dist/components/editor/plugins/toolbar/block-format/format-numbered-list.js +26 -0
  31. package/dist/components/editor/plugins/toolbar/block-format/format-paragraph.js +23 -0
  32. package/dist/components/editor/plugins/toolbar/block-format/format-quote.js +24 -0
  33. package/dist/components/editor/plugins/toolbar/block-format-toolbar-plugin.js +56 -0
  34. package/dist/components/editor/plugins/toolbar/font-format-toolbar-plugin.js +50 -0
  35. package/dist/components/editor/plugins/toolbar/history-toolbar-plugin.js +69 -0
  36. package/dist/components/editor/plugins/toolbar/toolbar-plugin.js +34 -0
  37. package/dist/components/editor/themes/editor-theme.js +112 -0
  38. package/dist/components/ui/app-editor.js +150 -0
  39. package/dist/components/ui/app-multiple-select-dropdown.js +2 -2
  40. package/dist/components/ui/button.js +25 -24
  41. package/dist/components/ui/calendar.js +9 -9
  42. package/dist/components/ui/dialog.js +43 -37
  43. package/dist/components/ui/sidebar.js +20 -19
  44. package/dist/index.d.ts +23 -1
  45. package/dist/index.js +48 -44
  46. package/dist/laif-ds.css +1 -0
  47. package/dist/node_modules/@lexical/clipboard/LexicalClipboard.prod.js +159 -0
  48. package/dist/node_modules/@lexical/code/LexicalCode.prod.js +236 -0
  49. package/dist/node_modules/@lexical/dragon/LexicalDragon.prod.js +46 -0
  50. package/dist/node_modules/@lexical/history/LexicalHistory.prod.js +89 -0
  51. package/dist/node_modules/@lexical/html/LexicalHtml.prod.js +108 -0
  52. package/dist/node_modules/@lexical/link/LexicalLink.prod.js +187 -0
  53. package/dist/node_modules/@lexical/list/LexicalList.prod.js +729 -0
  54. package/dist/node_modules/@lexical/markdown/LexicalMarkdown.prod.js +367 -0
  55. package/dist/node_modules/@lexical/react/LexicalCheckListPlugin.prod.js +11 -0
  56. package/dist/node_modules/@lexical/react/LexicalClearEditorPlugin.prod.js +17 -0
  57. package/dist/node_modules/@lexical/react/LexicalComposer.prod.js +45 -0
  58. package/dist/node_modules/@lexical/react/LexicalComposerContext.prod.js +22 -0
  59. package/dist/node_modules/@lexical/react/LexicalContentEditable.prod.js +55 -0
  60. package/dist/node_modules/@lexical/react/LexicalErrorBoundary.prod.js +49 -0
  61. package/dist/node_modules/@lexical/react/LexicalHistoryPlugin.prod.js +15 -0
  62. package/dist/node_modules/@lexical/react/LexicalListPlugin.prod.js +17 -0
  63. package/dist/node_modules/@lexical/react/LexicalOnChangePlugin.prod.js +16 -0
  64. package/dist/node_modules/@lexical/react/LexicalRichTextPlugin.prod.js +56 -0
  65. package/dist/node_modules/@lexical/react/useLexicalEditable.prod.js +21 -0
  66. package/dist/node_modules/@lexical/rich-text/LexicalRichText.prod.js +376 -0
  67. package/dist/node_modules/@lexical/selection/LexicalSelection.prod.js +107 -0
  68. package/dist/node_modules/@lexical/table/LexicalTable.prod.js +661 -0
  69. package/dist/node_modules/@lexical/text/LexicalText.prod.js +37 -0
  70. package/dist/node_modules/@lexical/utils/LexicalUtils.prod.js +102 -0
  71. package/dist/node_modules/@radix-ui/react-use-is-hydrated/dist/index.js +1 -1
  72. package/dist/node_modules/eventemitter3/index.js +1 -1
  73. package/dist/node_modules/eventemitter3/index2.js +1 -1
  74. package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.js +1 -1
  75. package/dist/node_modules/lexical/Lexical.prod.js +4901 -0
  76. package/dist/node_modules/prismjs/components/prism-c.js +77 -0
  77. package/dist/node_modules/prismjs/components/prism-clike.js +32 -0
  78. package/dist/node_modules/prismjs/components/prism-cpp.js +93 -0
  79. package/dist/node_modules/prismjs/components/prism-css.js +56 -0
  80. package/dist/node_modules/prismjs/components/prism-java.js +122 -0
  81. package/dist/node_modules/prismjs/components/prism-javascript.js +138 -0
  82. package/dist/node_modules/prismjs/components/prism-markdown.js +301 -0
  83. package/dist/node_modules/prismjs/components/prism-markup.js +174 -0
  84. package/dist/node_modules/prismjs/components/prism-objectivec.js +11 -0
  85. package/dist/node_modules/prismjs/components/prism-powershell.js +56 -0
  86. package/dist/node_modules/prismjs/components/prism-python.js +69 -0
  87. package/dist/node_modules/prismjs/components/prism-rust.js +124 -0
  88. package/dist/node_modules/prismjs/components/prism-sql.js +34 -0
  89. package/dist/node_modules/prismjs/components/prism-swift.js +114 -0
  90. package/dist/node_modules/prismjs/components/prism-typescript.js +53 -0
  91. package/dist/node_modules/prismjs/prism.js +1165 -0
  92. package/dist/node_modules/recharts/es6/util/Events.js +1 -1
  93. package/dist/node_modules/unified/lib/index.js +1 -1
  94. package/dist/node_modules/use-sync-external-store/shim/index.js +1 -1
  95. package/dist/styles.v3.css +1 -1
  96. package/package.json +12 -1
@@ -0,0 +1,159 @@
1
+ "use client";
2
+ import { $generateNodesFromDOM as y, $generateHtmlFromNodes as $ } from "../html/LexicalHtml.prod.js";
3
+ import { $addNodeStyle as D, $sliceSelectedTextNodeContent as O } from "../selection/LexicalSelection.prod.js";
4
+ import { objectKlassEquals as R } from "../utils/LexicalUtils.prod.js";
5
+ import { $isRangeSelection as h, $getSelection as p, $createTabNode as E, getDOMSelection as T, COPY_COMMAND as _, COMMAND_PRIORITY_CRITICAL as A, SELECTION_INSERT_CLIPBOARD_NODES_COMMAND as M, $parseSerializedNode as v, $isTextNode as N, isSelectionWithinEditor as L, $getEditor as P, $getRoot as b, $isElementNode as g, $cloneWithProperties as F } from "../../lexical/Lexical.prod.js";
6
+ function x(t, ...e) {
7
+ const n = new URL("https://lexical.dev/docs/error"), i = new URLSearchParams();
8
+ i.append("code", t);
9
+ for (const r of e) i.append("v", r);
10
+ throw n.search = i.toString(), Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
11
+ }
12
+ function I(t, e = p()) {
13
+ return e == null && x(166), h(e) && e.isCollapsed() || e.getNodes().length === 0 ? "" : $(t, e);
14
+ }
15
+ function H(t, e = p()) {
16
+ return e == null && x(166), h(e) && e.isCollapsed() || e.getNodes().length === 0 ? null : JSON.stringify(J(t, e));
17
+ }
18
+ function G(t, e, n) {
19
+ const i = t.getData("application/x-lexical-editor");
20
+ if (i) try {
21
+ const s = JSON.parse(i);
22
+ if (s.namespace === n._config.namespace && Array.isArray(s.nodes))
23
+ return w(n, z(s.nodes), e);
24
+ } catch {
25
+ }
26
+ const r = t.getData("text/html"), d = t.getData("text/plain");
27
+ if (r && d !== r) try {
28
+ const s = new DOMParser().parseFromString(function(l) {
29
+ return window.trustedTypes && window.trustedTypes.createPolicy ? window.trustedTypes.createPolicy("lexical", { createHTML: (o) => o }).createHTML(l) : l;
30
+ }(r), "text/html");
31
+ return w(n, y(n, s), e);
32
+ } catch {
33
+ }
34
+ const a = d || t.getData("text/uri-list");
35
+ if (a != null) if (h(e)) {
36
+ const s = a.split(/(\r?\n|\t)/);
37
+ s[s.length - 1] === "" && s.pop();
38
+ for (let l = 0; l < s.length; l++) {
39
+ const o = p();
40
+ if (h(o)) {
41
+ const c = s[l];
42
+ c === `
43
+ ` || c === `\r
44
+ ` ? o.insertParagraph() : c === " " ? o.insertNodes([E()]) : o.insertText(c);
45
+ }
46
+ }
47
+ } else e.insertRawText(a);
48
+ }
49
+ function w(t, e, n) {
50
+ t.dispatchCommand(M, { nodes: e, selection: n }) || n.insertNodes(e);
51
+ }
52
+ function S(t, e, n, i = []) {
53
+ let r = e === null || n.isSelected(e);
54
+ const d = g(n) && n.excludeFromCopy("html");
55
+ let a = n;
56
+ if (e !== null) {
57
+ let o = F(n);
58
+ o = N(o) && e !== null ? O(e, o) : o, a = o;
59
+ }
60
+ const s = g(a) ? a.getChildren() : [], l = function(o) {
61
+ const c = o.exportJSON(), u = o.constructor;
62
+ if (c.type !== u.getType() && x(58, u.name), g(o)) {
63
+ const m = c.children;
64
+ Array.isArray(m) || x(59, u.name);
65
+ }
66
+ return c;
67
+ }(a);
68
+ if (N(a)) {
69
+ const o = a.__text;
70
+ o.length > 0 ? l.text = o : r = !1;
71
+ }
72
+ for (let o = 0; o < s.length; o++) {
73
+ const c = s[o], u = S(t, e, c, l.children);
74
+ !r && g(n) && u && n.extractWithChild(c, e, "clone") && (r = !0);
75
+ }
76
+ if (r && !d) i.push(l);
77
+ else if (Array.isArray(l.children)) for (let o = 0; o < l.children.length; o++) {
78
+ const c = l.children[o];
79
+ i.push(c);
80
+ }
81
+ return r;
82
+ }
83
+ function J(t, e) {
84
+ const n = [], i = b().getChildren();
85
+ for (let r = 0; r < i.length; r++)
86
+ S(t, e, i[r], n);
87
+ return { namespace: t._config.namespace, nodes: n };
88
+ }
89
+ function z(t) {
90
+ const e = [];
91
+ for (let n = 0; n < t.length; n++) {
92
+ const i = t[n], r = v(i);
93
+ N(r) && D(r), e.push(r);
94
+ }
95
+ return e;
96
+ }
97
+ let f = null;
98
+ async function K(t, e, n) {
99
+ if (f !== null) return !1;
100
+ if (e !== null) return new Promise((o, c) => {
101
+ t.update(() => {
102
+ o(C(t, e, n));
103
+ });
104
+ });
105
+ const i = t.getRootElement(), r = t._window || window, d = window.document, a = T(r);
106
+ if (i === null || a === null) return !1;
107
+ const s = d.createElement("span");
108
+ s.style.cssText = "position: fixed; top: -1000px;", s.append(d.createTextNode("#")), i.append(s);
109
+ const l = new Range();
110
+ return l.setStart(s, 0), l.setEnd(s, 1), a.removeAllRanges(), a.addRange(l), new Promise((o, c) => {
111
+ const u = t.registerCommand(_, (m) => (R(m, ClipboardEvent) && (u(), f !== null && (window.clearTimeout(f), f = null), o(C(t, m, n))), !0), A);
112
+ f = window.setTimeout(() => {
113
+ u(), f = null, o(!1);
114
+ }, 50), d.execCommand("copy"), s.remove();
115
+ });
116
+ }
117
+ function C(t, e, n) {
118
+ if (n === void 0) {
119
+ const r = T(t._window);
120
+ if (!r) return !1;
121
+ const d = r.anchorNode, a = r.focusNode;
122
+ if (d !== null && a !== null && !L(t, d, a)) return !1;
123
+ const s = p();
124
+ if (s === null) return !1;
125
+ n = B(s);
126
+ }
127
+ e.preventDefault();
128
+ const i = e.clipboardData;
129
+ return i !== null && (U(i, n), !0);
130
+ }
131
+ const W = [["text/html", I], ["application/x-lexical-editor", H]];
132
+ function B(t = p()) {
133
+ const e = { "text/plain": t ? t.getTextContent() : "" };
134
+ if (t) {
135
+ const n = P();
136
+ for (const [i, r] of W) {
137
+ const d = r(n, t);
138
+ d !== null && (e[i] = d);
139
+ }
140
+ }
141
+ return e;
142
+ }
143
+ function U(t, e) {
144
+ for (const n in e) {
145
+ const i = e[n];
146
+ i !== void 0 && t.setData(n, i);
147
+ }
148
+ }
149
+ export {
150
+ J as $generateJSONFromSelectedNodes,
151
+ z as $generateNodesFromSerializedNodes,
152
+ B as $getClipboardDataFromSelection,
153
+ I as $getHtmlContent,
154
+ H as $getLexicalContent,
155
+ G as $insertDataTransferForRichText,
156
+ w as $insertGeneratedNodes,
157
+ K as copyToClipboard,
158
+ U as setLexicalClipboardDataTransfer
159
+ };
@@ -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
+ };