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,220 +0,0 @@
1
- "use client";
2
- import { useLexicalComposerContext as $ } from "./LexicalComposerContext.prod.js";
3
- import { $getSelection as Y, $isRangeSelection as F, $isTextNode as te, getDOMSelection as ne, COMMAND_PRIORITY_LOW as J, createCommand as oe, KEY_ENTER_COMMAND as re, KEY_TAB_COMMAND as le, KEY_ESCAPE_COMMAND as ie, KEY_ARROW_UP_COMMAND as se, KEY_ARROW_DOWN_COMMAND as ue } from "../../lexical/Lexical.prod.js";
4
- import Q, { useCallback as P, useState as Z, useRef as ce, useEffect as I, useLayoutEffect as ae, useMemo as de } from "react";
5
- import { mergeRegister as V } from "../utils/LexicalUtils.prod.js";
6
- import { jsx as fe } from "react/jsx-runtime";
7
- const z = "startTransition", k = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, ge = k ? ae : I;
8
- class Ce {
9
- constructor(e) {
10
- this.key = e, this.ref = { current: null }, this.setRefElement = this.setRefElement.bind(this);
11
- }
12
- setRefElement(e) {
13
- this.ref = { current: e };
14
- }
15
- }
16
- const X = (i) => {
17
- const e = document.getElementById("typeahead-menu");
18
- if (!e) return;
19
- const a = e.getBoundingClientRect();
20
- a.top + a.height > window.innerHeight && e.scrollIntoView({ block: "center" }), a.top < 0 && e.scrollIntoView({ block: "center" }), i.scrollIntoView({ block: "nearest" });
21
- };
22
- function j(i, e) {
23
- const a = i.getBoundingClientRect(), s = e.getBoundingClientRect();
24
- return a.top > s.top && a.top < s.bottom;
25
- }
26
- function pe(i, e, a, s) {
27
- const [t] = $();
28
- I((() => {
29
- if (e != null && i != null) {
30
- const T = t.getRootElement(), w = T != null ? (function(y, m) {
31
- let c = getComputedStyle(y);
32
- const O = c.position === "absolute", r = /(auto|scroll)/;
33
- if (c.position === "fixed") return document.body;
34
- for (let o = y; o = o.parentElement; ) if (c = getComputedStyle(o), (!O || c.position !== "static") && r.test(c.overflow + c.overflowY + c.overflowX)) return o;
35
- return document.body;
36
- })(T) : document.body;
37
- let x = !1, g = j(e, w);
38
- const A = function() {
39
- x || (window.requestAnimationFrame((function() {
40
- a(), x = !1;
41
- })), x = !0);
42
- const y = j(e, w);
43
- y !== g && (g = y, s?.(y));
44
- }, u = new ResizeObserver(a);
45
- return window.addEventListener("resize", a), document.addEventListener("scroll", A, { capture: !0, passive: !0 }), u.observe(e), () => {
46
- u.unobserve(e), window.removeEventListener("resize", a), document.removeEventListener("scroll", A, !0);
47
- };
48
- }
49
- }), [e, t, s, a, i]);
50
- }
51
- const q = oe("SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND");
52
- function me({ close: i, editor: e, anchorElementRef: a, resolution: s, options: t, menuRenderFn: T, onSelectOption: w, shouldSplitNodeWithQuery: x = !1, commandPriority: g = J, preselectFirstItem: A = !0 }) {
53
- const [u, y] = Z(null), m = s.match && s.match.matchingString;
54
- I((() => {
55
- A && y(0);
56
- }), [m, A]);
57
- const c = P(((r) => {
58
- e.update((() => {
59
- const o = s.match != null && x ? (function(C) {
60
- const l = Y();
61
- if (!F(l) || !l.isCollapsed()) return null;
62
- const N = l.anchor;
63
- if (N.type !== "text") return null;
64
- const v = N.getNode();
65
- if (!v.isSimpleText()) return null;
66
- const E = N.offset, M = v.getTextContent().slice(0, E), R = C.replaceableString.length, d = E - (function(S, h, f) {
67
- let n = f;
68
- for (let p = n; p <= h.length; p++) S.slice(-p) === h.substring(0, p) && (n = p);
69
- return n;
70
- })(M, C.matchingString, R);
71
- if (d < 0) return null;
72
- let b;
73
- return d === 0 ? [b] = v.splitText(E) : [, b] = v.splitText(d, E), b;
74
- })(s.match) : null;
75
- w(r, o, i, s.match ? s.match.matchingString : "");
76
- }));
77
- }), [e, x, s.match, w, i]), O = P(((r) => {
78
- const o = e.getRootElement();
79
- o !== null && (o.setAttribute("aria-activedescendant", "typeahead-item-" + r), y(r));
80
- }), [e]);
81
- return I((() => () => {
82
- const r = e.getRootElement();
83
- r !== null && r.removeAttribute("aria-activedescendant");
84
- }), [e]), ge((() => {
85
- t === null ? y(null) : u === null && A && O(0);
86
- }), [t, u, O, A]), I((() => V(e.registerCommand(q, (({ option: r }) => !(!r.ref || r.ref.current == null) && (X(r.ref.current), !0)), g))), [e, O, g]), I((() => V(e.registerCommand(ue, ((r) => {
87
- const o = r;
88
- if (t !== null && t.length) {
89
- const C = u === null ? 0 : u !== t.length - 1 ? u + 1 : 0;
90
- O(C);
91
- const l = t[C];
92
- l.ref != null && l.ref.current && e.dispatchCommand(q, { index: C, option: l }), o.preventDefault(), o.stopImmediatePropagation();
93
- }
94
- return !0;
95
- }), g), e.registerCommand(se, ((r) => {
96
- const o = r;
97
- if (t !== null && t.length) {
98
- const C = u === null ? t.length - 1 : u !== 0 ? u - 1 : t.length - 1;
99
- O(C);
100
- const l = t[C];
101
- l.ref != null && l.ref.current && X(l.ref.current), o.preventDefault(), o.stopImmediatePropagation();
102
- }
103
- return !0;
104
- }), g), e.registerCommand(ie, ((r) => {
105
- const o = r;
106
- return o.preventDefault(), o.stopImmediatePropagation(), i(), !0;
107
- }), g), e.registerCommand(le, ((r) => {
108
- const o = r;
109
- return t !== null && u !== null && t[u] != null && (o.preventDefault(), o.stopImmediatePropagation(), c(t[u]), !0);
110
- }), g), e.registerCommand(re, ((r) => t !== null && u !== null && t[u] != null && (r !== null && (r.preventDefault(), r.stopImmediatePropagation()), c(t[u]), !0)), g))), [c, i, e, t, u, O, g]), T(a, de((() => ({ options: t, selectOptionAndCleanUp: c, selectedIndex: u, setHighlightedIndex: y })), [c, u, t]), s.match ? s.match.matchingString : "");
111
- }
112
- function G(i, e) {
113
- e != null && (i.className = e), i.setAttribute("aria-label", "Typeahead menu"), i.setAttribute("role", "listbox"), i.style.display = "block", i.style.position = "absolute";
114
- }
115
- const he = `\\.,\\+\\*\\?\\$\\@\\|#{}\\(\\)\\^\\-\\[\\]\\\\/!%'"~=<>_:;`;
116
- function ve(i, { minLength: e = 1, maxLength: a = 75, punctuation: s = he, allowWhitespace: t = !1 }) {
117
- return P(((T) => {
118
- const w = new RegExp("(^|\\s|\\()([" + i + "]((?:" + ("[^" + i + s + (t ? "" : "\\s") + "]") + "){0," + a + "}))$").exec(T);
119
- if (w !== null) {
120
- const x = w[1], g = w[3];
121
- if (g.length >= e) return { leadOffset: w.index + x.length, matchingString: g, replaceableString: w[2] };
122
- }
123
- return null;
124
- }), [t, i, s, a, e]);
125
- }
126
- function be({ options: i, onQueryChange: e, onSelectOption: a, onOpen: s, onClose: t, menuRenderFn: T, triggerFn: w, anchorClassName: x, commandPriority: g = J, parent: A, preselectFirstItem: u = !0, ignoreEntityBoundary: y = !1 }) {
127
- const [m] = $(), [c, O] = Z(null), r = (function(l, N, v, E = k ? document.body : void 0, M = !0) {
128
- const [R] = $(), d = ce(k ? document.createElement("div") : null), b = P((() => {
129
- if (d.current === null || E === void 0) return;
130
- d.current.style.top = d.current.style.bottom;
131
- const f = R.getRootElement(), n = d.current, p = n.firstChild;
132
- if (f !== null && l !== null) {
133
- const { left: D, top: _, width: H, height: W } = l.getRect(), ee = d.current.offsetHeight;
134
- if (n.style.top = `${_ + ee + 3 + (M ? window.pageYOffset : 0)}px`, n.style.left = `${D + window.pageXOffset}px`, n.style.height = `${W}px`, n.style.width = `${H}px`, p !== null) {
135
- p.style.top = `${_}`;
136
- const K = p.getBoundingClientRect(), L = K.height, U = K.width, B = f.getBoundingClientRect();
137
- D + U > B.right && (n.style.left = `${B.right - U + window.pageXOffset}px`), (_ + L > window.innerHeight || _ + L > B.bottom) && _ - B.top > L + W && (n.style.top = `${_ - L - W + (M ? window.pageYOffset : 0)}px`);
138
- }
139
- n.isConnected || (G(n, v), E.append(n)), n.setAttribute("id", "typeahead-menu"), d.current = n, f.setAttribute("aria-controls", "typeahead-menu");
140
- }
141
- }), [R, l, M, v, E]);
142
- I((() => {
143
- const f = R.getRootElement();
144
- return l !== null && b(), () => {
145
- f !== null && f.removeAttribute("aria-controls");
146
- const n = d.current;
147
- n !== null && n.isConnected && (n.remove(), n.removeAttribute("id"));
148
- };
149
- }), [R, b, l]);
150
- const S = P(((f) => {
151
- l !== null && (f || N(null));
152
- }), [l, N]);
153
- pe(l, d.current, b, S);
154
- const h = d.current;
155
- return h != null && (G(h, v), E?.append(h)), d;
156
- })(c, O, x, A), o = P((() => {
157
- O(null), t != null && c !== null && t();
158
- }), [t, c]), C = P(((l) => {
159
- O(l), s != null && c === null && s(l);
160
- }), [s, c]);
161
- return I((() => {
162
- const l = m.registerUpdateListener((() => {
163
- m.getEditorState().read((() => {
164
- if (!m.isEditable()) return void o();
165
- const N = m._window || window, v = N.document.createRange(), E = Y(), M = (function(b) {
166
- let S = null;
167
- return b.getEditorState().read((() => {
168
- const h = Y();
169
- F(h) && (S = (function(f) {
170
- const n = f.anchor;
171
- if (n.type !== "text") return null;
172
- const p = n.getNode();
173
- if (!p.isSimpleText()) return null;
174
- const D = n.offset;
175
- return p.getTextContent().slice(0, D);
176
- })(h));
177
- })), S;
178
- })(m);
179
- if (!F(E) || !E.isCollapsed() || M === null || v === null) return void o();
180
- const R = w(M, m);
181
- if (e(R ? R.matchingString : null), R !== null && (y || !(function(b, S) {
182
- return S === 0 && b.getEditorState().read((() => {
183
- const h = Y();
184
- if (F(h)) {
185
- const f = h.anchor.getNode().getPreviousSibling();
186
- return te(f) && f.isTextEntity();
187
- }
188
- return !1;
189
- }));
190
- })(m, R.leadOffset)) && (function(S, h, f) {
191
- const n = ne(f);
192
- if (n === null || !n.isCollapsed) return !1;
193
- const p = n.anchorNode, D = S, _ = n.anchorOffset;
194
- if (p == null || _ == null) return !1;
195
- try {
196
- h.setStart(p, D), h.setEnd(p, _);
197
- } catch {
198
- return !1;
199
- }
200
- return !0;
201
- })(R.leadOffset, v, N) !== null)
202
- return d = () => C({ getRect: () => v.getBoundingClientRect(), match: R }), void (z in Q ? Q[z](d) : d());
203
- var d;
204
- o();
205
- }));
206
- }));
207
- return () => {
208
- l();
209
- };
210
- }), [m, w, e, c, o, C, y]), I((() => m.registerEditableListener(((l) => {
211
- l || o();
212
- }))), [m, o]), c === null || m === null || r.current === null ? null : fe(me, { close: o, resolution: c, editor: m, anchorElementRef: r, options: i, menuRenderFn: T, shouldSplitNodeWithQuery: !0, onSelectOption: a, commandPriority: g, preselectFirstItem: u });
213
- }
214
- export {
215
- be as LexicalTypeaheadMenuPlugin,
216
- Ce as MenuOption,
217
- he as PUNCTUATION,
218
- ve as useBasicTypeaheadTriggerMatch,
219
- pe as useDynamicPositioning
220
- };
@@ -1,21 +0,0 @@
1
- "use client";
2
- import { useLexicalComposerContext as l } from "./LexicalComposerContext.prod.js";
3
- import { useMemo as d, useState as f, useRef as m, useLayoutEffect as b, useEffect as w } from "react";
4
- const E = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? b : w;
5
- function p(e) {
6
- return { initialValueFn: () => e.isEditable(), subscribe: (t) => e.registerEditableListener(t) };
7
- }
8
- function F() {
9
- return (function(e) {
10
- const [t] = l(), n = d((() => e(t)), [t, e]), [r, o] = f((() => n.initialValueFn())), i = m(r);
11
- return E((() => {
12
- const { initialValueFn: c, subscribe: a } = n, u = c();
13
- return i.current !== u && (i.current = u, o(u)), a(((s) => {
14
- i.current = s, o(s);
15
- }));
16
- }), [n, e]), r;
17
- })(p);
18
- }
19
- export {
20
- F as useLexicalEditable
21
- };
@@ -1,376 +0,0 @@
1
- "use client";
2
- import { $insertDataTransferForRichText as R, copyToClipboard as S } from "../clipboard/LexicalClipboard.prod.js";
3
- import { $shouldOverrideDefaultCharacterSelection as I, $moveCharacter as P } from "../selection/LexicalSelection.prod.js";
4
- import { addClassNamesToElement as k, mergeRegister as U, objectKlassEquals as g, $getNearestBlockElementAncestorOrThrow as j, $findMatchingParent as B } from "../utils/LexicalUtils.prod.js";
5
- import { ElementNode as z, isHTMLElement as G, $createParagraphNode as h, $applyNodeReplacement as H, setNodeIndentFromDOM as X, KEY_TAB_COMMAND as V, $getSelection as i, $isRangeSelection as u, COMMAND_PRIORITY_EDITOR as a, KEY_SPACE_COMMAND as Z, PASTE_COMMAND as ee, createCommand as te, isDOMNode as ne, isSelectionCapturedInDecoratorInput as re, PASTE_TAG as se, CUT_COMMAND as ae, $isNodeSelection as d, COPY_COMMAND as oe, SELECT_ALL_COMMAND as ie, $selectAll as ue, DRAGOVER_COMMAND as ce, $getNearestNodeFromDOMNode as T, $isDecoratorNode as E, DRAGSTART_COMMAND as le, DROP_COMMAND as de, $createRangeSelection as fe, $isTextNode as me, $normalizeSelection__EXPERIMENTAL as ge, $setSelection as pe, KEY_ESCAPE_COMMAND as Ce, KEY_ENTER_COMMAND as he, INSERT_LINE_BREAK_COMMAND as x, INSERT_PARAGRAPH_COMMAND as $, KEY_DELETE_COMMAND as Ne, DELETE_CHARACTER_COMMAND as A, KEY_BACKSPACE_COMMAND as De, $isRootNode as Ee, OUTDENT_CONTENT_COMMAND as w, KEY_ARROW_RIGHT_COMMAND as Me, KEY_ARROW_LEFT_COMMAND as _e, KEY_ARROW_DOWN_COMMAND as Ae, $getRoot as Oe, $getAdjacentNode as F, KEY_ARROW_UP_COMMAND as Te, INDENT_CONTENT_COMMAND as ve, INSERT_TAB_COMMAND as ye, $insertNodes as Re, $createTabNode as Se, FORMAT_ELEMENT_COMMAND as Ie, FORMAT_TEXT_COMMAND as Pe, REMOVE_TEXT_COMMAND as xe, CONTROLLED_TEXT_INSERTION_COMMAND as $e, DELETE_LINE_COMMAND as we, DELETE_WORD_COMMAND as Fe, CLICK_COMMAND as Ke, $isElementNode as q } from "../../lexical/Lexical.prod.js";
6
- function K(n, e) {
7
- if (document.caretRangeFromPoint !== void 0) {
8
- const t = document.caretRangeFromPoint(n, e);
9
- return t === null ? null : { node: t.startContainer, offset: t.startOffset };
10
- }
11
- if (document.caretPositionFromPoint !== "undefined") {
12
- const t = document.caretPositionFromPoint(n, e);
13
- return t === null ? null : { node: t.offsetNode, offset: t.offset };
14
- }
15
- return null;
16
- }
17
- const p = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, Le = p && "documentMode" in document ? document.documentMode : null, be = !(!p || !("InputEvent" in window) || Le) && "getTargetRanges" in new window.InputEvent("input"), Ye = p && /Version\/[\d.]+.*Safari/.test(navigator.userAgent), L = p && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream, We = p && /^(?=.*Chrome).*/i.test(navigator.userAgent), Je = p && /AppleWebKit\/[\d.]+/.test(navigator.userAgent) && !We, b = te("DRAG_DROP_PASTE_FILE");
18
- class M extends z {
19
- static getType() {
20
- return "quote";
21
- }
22
- static clone(e) {
23
- return new M(e.__key);
24
- }
25
- createDOM(e) {
26
- const t = document.createElement("blockquote");
27
- return k(t, e.theme.quote), t;
28
- }
29
- updateDOM(e, t) {
30
- return !1;
31
- }
32
- static importDOM() {
33
- return { blockquote: (e) => ({ conversion: ke, priority: 0 }) };
34
- }
35
- exportDOM(e) {
36
- const { element: t } = super.exportDOM(e);
37
- if (G(t)) {
38
- this.isEmpty() && t.append(document.createElement("br"));
39
- const r = this.getFormatType();
40
- r && (t.style.textAlign = r);
41
- const s = this.getDirection();
42
- s && (t.dir = s);
43
- }
44
- return { element: t };
45
- }
46
- static importJSON(e) {
47
- return Q().updateFromJSON(e);
48
- }
49
- insertNewAfter(e, t) {
50
- const r = h(), s = this.getDirection();
51
- return r.setDirection(s), this.insertAfter(r, t), r;
52
- }
53
- collapseAtStart() {
54
- const e = h();
55
- return this.getChildren().forEach(((t) => e.append(t))), this.replace(e), !0;
56
- }
57
- canMergeWhenEmpty() {
58
- return !0;
59
- }
60
- }
61
- function Q() {
62
- return H(new M());
63
- }
64
- function Xe(n) {
65
- return n instanceof M;
66
- }
67
- class _ extends z {
68
- static getType() {
69
- return "heading";
70
- }
71
- static clone(e) {
72
- return new _(e.__tag, e.__key);
73
- }
74
- constructor(e, t) {
75
- super(t), this.__tag = e;
76
- }
77
- getTag() {
78
- return this.__tag;
79
- }
80
- setTag(e) {
81
- const t = this.getWritable();
82
- return this.__tag = e, t;
83
- }
84
- createDOM(e) {
85
- const t = this.__tag, r = document.createElement(t), s = e.theme.heading;
86
- if (s !== void 0) {
87
- const o = s[t];
88
- k(r, o);
89
- }
90
- return r;
91
- }
92
- updateDOM(e, t, r) {
93
- return e.__tag !== this.__tag;
94
- }
95
- static importDOM() {
96
- return { h1: (e) => ({ conversion: m, priority: 0 }), h2: (e) => ({ conversion: m, priority: 0 }), h3: (e) => ({ conversion: m, priority: 0 }), h4: (e) => ({ conversion: m, priority: 0 }), h5: (e) => ({ conversion: m, priority: 0 }), h6: (e) => ({ conversion: m, priority: 0 }), p: (e) => {
97
- const t = e.firstChild;
98
- return t !== null && Y(t) ? { conversion: () => ({ node: null }), priority: 3 } : null;
99
- }, span: (e) => Y(e) ? { conversion: (t) => ({ node: C("h1") }), priority: 3 } : null };
100
- }
101
- exportDOM(e) {
102
- const { element: t } = super.exportDOM(e);
103
- if (G(t)) {
104
- this.isEmpty() && t.append(document.createElement("br"));
105
- const r = this.getFormatType();
106
- r && (t.style.textAlign = r);
107
- const s = this.getDirection();
108
- s && (t.dir = s);
109
- }
110
- return { element: t };
111
- }
112
- static importJSON(e) {
113
- return C(e.tag).updateFromJSON(e);
114
- }
115
- updateFromJSON(e) {
116
- return super.updateFromJSON(e).setTag(e.tag);
117
- }
118
- exportJSON() {
119
- return { ...super.exportJSON(), tag: this.getTag() };
120
- }
121
- insertNewAfter(e, t = !0) {
122
- const r = e ? e.anchor.offset : 0, s = this.getLastDescendant(), o = !s || e && e.anchor.key === s.getKey() && r === s.getTextContentSize() || !e ? h() : C(this.getTag()), l = this.getDirection();
123
- if (o.setDirection(l), this.insertAfter(o, t), r === 0 && !this.isEmpty() && e) {
124
- const c = h();
125
- c.select(), this.replace(c, !0);
126
- }
127
- return o;
128
- }
129
- collapseAtStart() {
130
- const e = this.isEmpty() ? h() : C(this.getTag());
131
- return this.getChildren().forEach(((t) => e.append(t))), this.replace(e), !0;
132
- }
133
- extractWithChild() {
134
- return !0;
135
- }
136
- }
137
- function Y(n) {
138
- return n.nodeName.toLowerCase() === "span" && n.style.fontSize === "26pt";
139
- }
140
- function m(n) {
141
- const e = n.nodeName.toLowerCase();
142
- let t = null;
143
- return e !== "h1" && e !== "h2" && e !== "h3" && e !== "h4" && e !== "h5" && e !== "h6" || (t = C(e), n.style !== null && (X(n, t), t.setFormat(n.style.textAlign))), { node: t };
144
- }
145
- function ke(n) {
146
- const e = Q();
147
- return n.style !== null && (e.setFormat(n.style.textAlign), X(n, e)), { node: e };
148
- }
149
- function C(n = "h1") {
150
- return H(new _(n));
151
- }
152
- function qe(n) {
153
- return n instanceof _;
154
- }
155
- function D(n) {
156
- let e = null;
157
- if (g(n, DragEvent) ? e = n.dataTransfer : g(n, ClipboardEvent) && (e = n.clipboardData), e === null) return [!1, [], !1];
158
- const t = e.types, r = t.includes("Files"), s = t.includes("text/html") || t.includes("text/plain");
159
- return [r, Array.from(e.files), s];
160
- }
161
- function W(n) {
162
- const e = i();
163
- if (!u(e)) return !1;
164
- const t = /* @__PURE__ */ new Set(), r = e.getNodes();
165
- for (let s = 0; s < r.length; s++) {
166
- const o = r[s], l = o.getKey();
167
- if (t.has(l)) continue;
168
- const c = B(o, ((N) => q(N) && !N.isInline()));
169
- if (c === null) continue;
170
- const f = c.getKey();
171
- c.canIndent() && !t.has(f) && (t.add(f), n(c));
172
- }
173
- return t.size > 0;
174
- }
175
- function J(n) {
176
- const e = T(n);
177
- return E(e);
178
- }
179
- function O(n) {
180
- for (const e of ["lowercase", "uppercase", "capitalize"]) n.hasFormat(e) && n.toggleFormat(e);
181
- }
182
- function Qe(n) {
183
- return U(n.registerCommand(Ke, ((e) => {
184
- const t = i();
185
- return !!d(t) && (t.clear(), !0);
186
- }), a), n.registerCommand(A, ((e) => {
187
- const t = i();
188
- return u(t) ? (t.deleteCharacter(e), !0) : !!d(t) && (t.deleteNodes(), !0);
189
- }), a), n.registerCommand(Fe, ((e) => {
190
- const t = i();
191
- return !!u(t) && (t.deleteWord(e), !0);
192
- }), a), n.registerCommand(we, ((e) => {
193
- const t = i();
194
- return !!u(t) && (t.deleteLine(e), !0);
195
- }), a), n.registerCommand($e, ((e) => {
196
- const t = i();
197
- if (typeof e == "string") t !== null && t.insertText(e);
198
- else {
199
- if (t === null) return !1;
200
- const r = e.dataTransfer;
201
- if (r != null) R(r, t, n);
202
- else if (u(t)) {
203
- const s = e.data;
204
- return s && t.insertText(s), !0;
205
- }
206
- }
207
- return !0;
208
- }), a), n.registerCommand(xe, (() => {
209
- const e = i();
210
- return !!u(e) && (e.removeText(), !0);
211
- }), a), n.registerCommand(Pe, ((e) => {
212
- const t = i();
213
- return !!u(t) && (t.formatText(e), !0);
214
- }), a), n.registerCommand(Ie, ((e) => {
215
- const t = i();
216
- if (!u(t) && !d(t)) return !1;
217
- const r = t.getNodes();
218
- for (const s of r) {
219
- const o = B(s, ((l) => q(l) && !l.isInline()));
220
- o !== null && o.setFormat(e);
221
- }
222
- return !0;
223
- }), a), n.registerCommand(x, ((e) => {
224
- const t = i();
225
- return !!u(t) && (t.insertLineBreak(e), !0);
226
- }), a), n.registerCommand($, (() => {
227
- const e = i();
228
- return !!u(e) && (e.insertParagraph(), !0);
229
- }), a), n.registerCommand(ye, (() => (Re([Se()]), !0)), a), n.registerCommand(ve, (() => W(((e) => {
230
- const t = e.getIndent();
231
- e.setIndent(t + 1);
232
- }))), a), n.registerCommand(w, (() => W(((e) => {
233
- const t = e.getIndent();
234
- t > 0 && e.setIndent(Math.max(0, t - 1));
235
- }))), a), n.registerCommand(Te, ((e) => {
236
- const t = i();
237
- if (d(t)) {
238
- const r = t.getNodes();
239
- if (r.length > 0) return r[0].selectPrevious(), !0;
240
- } else if (u(t)) {
241
- const r = F(t.focus, !0);
242
- if (!e.shiftKey && E(r) && !r.isIsolated() && !r.isInline()) return r.selectPrevious(), e.preventDefault(), !0;
243
- }
244
- return !1;
245
- }), a), n.registerCommand(Ae, ((e) => {
246
- const t = i();
247
- if (d(t)) {
248
- const r = t.getNodes();
249
- if (r.length > 0) return r[0].selectNext(0, 0), !0;
250
- } else if (u(t)) {
251
- if ((function(s) {
252
- const o = s.focus;
253
- return o.key === "root" && o.offset === Oe().getChildrenSize();
254
- })(t)) return e.preventDefault(), !0;
255
- const r = F(t.focus, !1);
256
- if (!e.shiftKey && E(r) && !r.isIsolated() && !r.isInline()) return r.selectNext(), e.preventDefault(), !0;
257
- }
258
- return !1;
259
- }), a), n.registerCommand(_e, ((e) => {
260
- const t = i();
261
- if (d(t)) {
262
- const r = t.getNodes();
263
- if (r.length > 0) return e.preventDefault(), r[0].selectPrevious(), !0;
264
- }
265
- if (!u(t)) return !1;
266
- if (I(t, !0)) {
267
- const r = e.shiftKey;
268
- return e.preventDefault(), P(t, r, !0), !0;
269
- }
270
- return !1;
271
- }), a), n.registerCommand(Me, ((e) => {
272
- const t = i();
273
- if (d(t)) {
274
- const s = t.getNodes();
275
- if (s.length > 0) return e.preventDefault(), s[0].selectNext(0, 0), !0;
276
- }
277
- if (!u(t)) return !1;
278
- const r = e.shiftKey;
279
- return !!I(t, !1) && (e.preventDefault(), P(t, r, !1), !0);
280
- }), a), n.registerCommand(De, ((e) => {
281
- if (J(e.target)) return !1;
282
- const t = i();
283
- if (u(t)) {
284
- if ((function(r) {
285
- if (!r.isCollapsed()) return !1;
286
- const { anchor: s } = r;
287
- if (s.offset !== 0) return !1;
288
- const o = s.getNode();
289
- if (Ee(o)) return !1;
290
- const l = j(o);
291
- return l.getIndent() > 0 && (l.is(o) || o.is(l.getFirstDescendant()));
292
- })(t)) return e.preventDefault(), n.dispatchCommand(w, void 0);
293
- if (L && navigator.language === "ko-KR") return !1;
294
- } else if (!d(t)) return !1;
295
- return e.preventDefault(), n.dispatchCommand(A, !0);
296
- }), a), n.registerCommand(Ne, ((e) => {
297
- if (J(e.target)) return !1;
298
- const t = i();
299
- return !(!u(t) && !d(t)) && (e.preventDefault(), n.dispatchCommand(A, !1));
300
- }), a), n.registerCommand(he, ((e) => {
301
- const t = i();
302
- if (!u(t)) return !1;
303
- if (O(t), e !== null) {
304
- if ((L || Ye || Je) && be) return !1;
305
- if (e.preventDefault(), e.shiftKey) return n.dispatchCommand(x, !1);
306
- }
307
- return n.dispatchCommand($, void 0);
308
- }), a), n.registerCommand(Ce, (() => {
309
- const e = i();
310
- return !!u(e) && (n.blur(), !0);
311
- }), a), n.registerCommand(de, ((e) => {
312
- const [, t] = D(e);
313
- if (t.length > 0) {
314
- const s = K(e.clientX, e.clientY);
315
- if (s !== null) {
316
- const { offset: o, node: l } = s, c = T(l);
317
- if (c !== null) {
318
- const f = fe();
319
- if (me(c)) f.anchor.set(c.getKey(), o, "text"), f.focus.set(c.getKey(), o, "text");
320
- else {
321
- const v = c.getParentOrThrow().getKey(), y = c.getIndexWithinParent() + 1;
322
- f.anchor.set(v, y, "element"), f.focus.set(v, y, "element");
323
- }
324
- const N = ge(f);
325
- pe(N);
326
- }
327
- n.dispatchCommand(b, t);
328
- }
329
- return e.preventDefault(), !0;
330
- }
331
- const r = i();
332
- return !!u(r);
333
- }), a), n.registerCommand(le, ((e) => {
334
- const [t] = D(e), r = i();
335
- return !(t && !u(r));
336
- }), a), n.registerCommand(ce, ((e) => {
337
- const [t] = D(e), r = i();
338
- if (t && !u(r)) return !1;
339
- const s = K(e.clientX, e.clientY);
340
- if (s !== null) {
341
- const o = T(s.node);
342
- E(o) && e.preventDefault();
343
- }
344
- return !0;
345
- }), a), n.registerCommand(ie, (() => (ue(), !0)), a), n.registerCommand(oe, ((e) => (S(n, g(e, ClipboardEvent) ? e : null), !0)), a), n.registerCommand(ae, ((e) => ((async function(t, r) {
346
- await S(r, g(t, ClipboardEvent) ? t : null), r.update((() => {
347
- const s = i();
348
- u(s) ? s.removeText() : d(s) && s.getNodes().forEach(((o) => o.remove()));
349
- }));
350
- })(e, n), !0)), a), n.registerCommand(ee, ((e) => {
351
- const [, t, r] = D(e);
352
- return t.length > 0 && !r ? (n.dispatchCommand(b, t), !0) : ne(e.target) && re(e.target) ? !1 : i() !== null && ((function(s, o) {
353
- s.preventDefault(), o.update((() => {
354
- const l = i(), c = g(s, InputEvent) || g(s, KeyboardEvent) ? null : s.clipboardData;
355
- c != null && l !== null && R(c, l, o);
356
- }), { tag: se });
357
- })(e, n), !0);
358
- }), a), n.registerCommand(Z, ((e) => {
359
- const t = i();
360
- return u(t) && O(t), !1;
361
- }), a), n.registerCommand(V, ((e) => {
362
- const t = i();
363
- return u(t) && O(t), !1;
364
- }), a));
365
- }
366
- export {
367
- C as $createHeadingNode,
368
- Q as $createQuoteNode,
369
- qe as $isHeadingNode,
370
- Xe as $isQuoteNode,
371
- b as DRAG_DROP_PASTE,
372
- _ as HeadingNode,
373
- M as QuoteNode,
374
- D as eventFiles,
375
- Qe as registerRichText
376
- };