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.
- package/README.md +11 -81
- package/dist/CHANGELOG.md +13 -0
- package/dist/_virtual/index6.js +2 -2
- package/dist/_virtual/index7.js +2 -2
- package/dist/agent-docs/adoption-report.json +2 -2
- package/dist/agent-docs/manifest.json +3 -3
- package/dist/components/editor/editor-hooks/use-update-toolbar.js +6 -6
- package/dist/components/editor/editor-ui/content-editable.js +1 -1
- package/dist/components/editor/nodes/mention-node.js +2 -2
- package/dist/components/editor/plugins/actions/clear-editor-plugin.js +2 -2
- package/dist/components/editor/plugins/actions/counter-character-plugin.js +2 -2
- package/dist/components/editor/plugins/mention-plugin.js +21 -21
- package/dist/components/editor/plugins/toolbar/block-format/format-bulleted-list.js +10 -10
- package/dist/components/editor/plugins/toolbar/block-format/format-check-list.js +5 -5
- package/dist/components/editor/plugins/toolbar/block-format/format-heading.js +5 -5
- package/dist/components/editor/plugins/toolbar/block-format/format-numbered-list.js +5 -5
- package/dist/components/editor/plugins/toolbar/block-format/format-paragraph.js +9 -9
- package/dist/components/editor/plugins/toolbar/block-format/format-quote.js +3 -3
- package/dist/components/editor/plugins/toolbar/block-format-toolbar-plugin.js +13 -13
- package/dist/components/editor/plugins/toolbar/font-format-toolbar-plugin.js +2 -2
- package/dist/components/editor/plugins/toolbar/history-toolbar-plugin.js +18 -19
- package/dist/components/editor/plugins/toolbar/mention-insert-toolbar-plugin.js +1 -1
- package/dist/components/editor/plugins/toolbar/toolbar-plugin.js +3 -3
- package/dist/components/ui/app-editor.js +51 -51
- package/dist/components/ui/markdown-renderer.js +33 -32
- package/dist/lib/utils.js +35 -34
- package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +1 -1
- package/dist/node_modules/@floating-ui/{utils → core/node_modules/@floating-ui/utils}/dist/floating-ui.utils.js +33 -39
- package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +20 -19
- package/dist/node_modules/@floating-ui/dom/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +12 -0
- package/dist/node_modules/@lexical/clipboard/dist/LexicalClipboard.prod.js +354 -0
- package/dist/node_modules/@lexical/code-core/dist/LexicalCodeCore.prod.js +298 -0
- package/dist/node_modules/@lexical/dragon/dist/LexicalDragon.prod.js +89 -0
- package/dist/node_modules/@lexical/extension/dist/LexicalExtension.prod.js +611 -0
- package/dist/node_modules/@lexical/history/dist/LexicalHistory.prod.js +96 -0
- package/dist/node_modules/@lexical/html/dist/LexicalHtml.prod.js +604 -0
- package/dist/node_modules/@lexical/link/dist/LexicalLink.prod.js +201 -0
- package/dist/node_modules/@lexical/list/dist/LexicalList.prod.js +843 -0
- package/dist/node_modules/@lexical/markdown/dist/LexicalMarkdown.prod.js +555 -0
- package/dist/node_modules/@lexical/react/dist/LexicalCheckListPlugin.prod.js +11 -0
- package/dist/node_modules/@lexical/react/dist/LexicalClearEditorPlugin.prod.js +13 -0
- package/dist/node_modules/@lexical/react/dist/LexicalComposer.prod.js +45 -0
- package/dist/node_modules/@lexical/react/{LexicalComposerContext.prod.js → dist/LexicalComposerContext.prod.js} +1 -1
- package/dist/node_modules/@lexical/react/dist/LexicalContentEditable.prod.js +53 -0
- package/dist/node_modules/@lexical/react/dist/LexicalErrorBoundary.prod.js +21 -0
- package/dist/node_modules/@lexical/react/{LexicalHistoryPlugin.prod.js → dist/LexicalHistoryPlugin.prod.js} +3 -3
- package/dist/node_modules/@lexical/react/dist/LexicalListPlugin.prod.js +17 -0
- package/dist/node_modules/@lexical/react/dist/LexicalOnChangePlugin.prod.js +16 -0
- package/dist/node_modules/@lexical/react/dist/LexicalReactProviderExtension.prod.js +6 -0
- package/dist/node_modules/@lexical/react/dist/LexicalRichTextPlugin.prod.js +77 -0
- package/dist/node_modules/@lexical/react/dist/LexicalTypeaheadMenuPlugin.prod.js +245 -0
- package/dist/node_modules/@lexical/react/dist/useLexicalEditable.prod.js +22 -0
- package/dist/node_modules/@lexical/rich-text/dist/LexicalRichText.prod.js +567 -0
- package/dist/node_modules/@lexical/selection/dist/LexicalSelection.prod.js +123 -0
- package/dist/node_modules/@lexical/table/dist/LexicalTable.prod.js +929 -0
- package/dist/node_modules/@lexical/text/{LexicalText.prod.js → dist/LexicalText.prod.js} +6 -6
- package/dist/node_modules/@lexical/utils/dist/LexicalUtils.prod.js +111 -0
- package/dist/node_modules/eventemitter3/index2.js +1 -1
- package/dist/node_modules/lexical/dist/Lexical.prod.js +6731 -0
- package/dist/node_modules/style-to-object/cjs/index.js +1 -1
- package/package.json +17 -15
- package/dist/_virtual/prism-cpp.js +0 -3
- package/dist/_virtual/prism-cpp2.js +0 -5
- package/dist/_virtual/prism-java.js +0 -3
- package/dist/_virtual/prism-java2.js +0 -5
- package/dist/_virtual/prism-python.js +0 -3
- package/dist/_virtual/prism-python2.js +0 -5
- package/dist/_virtual/prism-rust.js +0 -3
- package/dist/_virtual/prism-rust2.js +0 -5
- package/dist/_virtual/prism-typescript.js +0 -3
- package/dist/_virtual/prism-typescript2.js +0 -5
- package/dist/_virtual/prism.js +0 -3
- package/dist/_virtual/prism2.js +0 -5
- package/dist/node_modules/@lexical/clipboard/LexicalClipboard.prod.js +0 -159
- package/dist/node_modules/@lexical/code/LexicalCode.prod.js +0 -236
- package/dist/node_modules/@lexical/dragon/LexicalDragon.prod.js +0 -46
- package/dist/node_modules/@lexical/history/LexicalHistory.prod.js +0 -89
- package/dist/node_modules/@lexical/html/LexicalHtml.prod.js +0 -108
- package/dist/node_modules/@lexical/link/LexicalLink.prod.js +0 -187
- package/dist/node_modules/@lexical/list/LexicalList.prod.js +0 -729
- package/dist/node_modules/@lexical/markdown/LexicalMarkdown.prod.js +0 -367
- package/dist/node_modules/@lexical/react/LexicalCheckListPlugin.prod.js +0 -11
- package/dist/node_modules/@lexical/react/LexicalClearEditorPlugin.prod.js +0 -17
- package/dist/node_modules/@lexical/react/LexicalComposer.prod.js +0 -45
- package/dist/node_modules/@lexical/react/LexicalContentEditable.prod.js +0 -55
- package/dist/node_modules/@lexical/react/LexicalErrorBoundary.prod.js +0 -49
- package/dist/node_modules/@lexical/react/LexicalListPlugin.prod.js +0 -17
- package/dist/node_modules/@lexical/react/LexicalOnChangePlugin.prod.js +0 -16
- package/dist/node_modules/@lexical/react/LexicalRichTextPlugin.prod.js +0 -56
- package/dist/node_modules/@lexical/react/LexicalTypeaheadMenuPlugin.prod.js +0 -220
- package/dist/node_modules/@lexical/react/useLexicalEditable.prod.js +0 -21
- package/dist/node_modules/@lexical/rich-text/LexicalRichText.prod.js +0 -376
- package/dist/node_modules/@lexical/selection/LexicalSelection.prod.js +0 -107
- package/dist/node_modules/@lexical/table/LexicalTable.prod.js +0 -661
- package/dist/node_modules/@lexical/utils/LexicalUtils.prod.js +0 -102
- package/dist/node_modules/lexical/Lexical.prod.js +0 -4912
- package/dist/node_modules/prismjs/components/prism-c.js +0 -77
- package/dist/node_modules/prismjs/components/prism-clike.js +0 -32
- package/dist/node_modules/prismjs/components/prism-cpp.js +0 -93
- package/dist/node_modules/prismjs/components/prism-css.js +0 -56
- package/dist/node_modules/prismjs/components/prism-java.js +0 -122
- package/dist/node_modules/prismjs/components/prism-javascript.js +0 -138
- package/dist/node_modules/prismjs/components/prism-markdown.js +0 -301
- package/dist/node_modules/prismjs/components/prism-markup.js +0 -174
- package/dist/node_modules/prismjs/components/prism-objectivec.js +0 -11
- package/dist/node_modules/prismjs/components/prism-powershell.js +0 -56
- package/dist/node_modules/prismjs/components/prism-python.js +0 -69
- package/dist/node_modules/prismjs/components/prism-rust.js +0 -124
- package/dist/node_modules/prismjs/components/prism-sql.js +0 -34
- package/dist/node_modules/prismjs/components/prism-swift.js +0 -114
- package/dist/node_modules/prismjs/components/prism-typescript.js +0 -53
- package/dist/node_modules/prismjs/prism.js +0 -1165
- /package/dist/node_modules/@floating-ui/{utils → dom/node_modules/@floating-ui/utils}/dist/floating-ui.utils.dom.js +0 -0
|
@@ -1,29 +1,26 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const j = ["top", "right", "bottom", "left"],
|
|
3
|
-
x: t,
|
|
4
|
-
y: t
|
|
5
|
-
}), h = {
|
|
2
|
+
const j = ["top", "right", "bottom", "left"], a = Math.min, p = Math.max, h = {
|
|
6
3
|
left: "right",
|
|
7
4
|
right: "left",
|
|
8
5
|
bottom: "top",
|
|
9
6
|
top: "bottom"
|
|
10
|
-
},
|
|
7
|
+
}, b = {
|
|
11
8
|
start: "end",
|
|
12
9
|
end: "start"
|
|
13
10
|
};
|
|
14
|
-
function
|
|
15
|
-
return p(t,
|
|
11
|
+
function L(t, e, n) {
|
|
12
|
+
return p(t, a(e, n));
|
|
16
13
|
}
|
|
17
|
-
function
|
|
14
|
+
function C(t, e) {
|
|
18
15
|
return typeof t == "function" ? t(e) : t;
|
|
19
16
|
}
|
|
20
17
|
function g(t) {
|
|
21
18
|
return t.split("-")[0];
|
|
22
19
|
}
|
|
23
|
-
function
|
|
20
|
+
function m(t) {
|
|
24
21
|
return t.split("-")[1];
|
|
25
22
|
}
|
|
26
|
-
function
|
|
23
|
+
function x(t) {
|
|
27
24
|
return t === "x" ? "y" : "x";
|
|
28
25
|
}
|
|
29
26
|
function d(t) {
|
|
@@ -34,43 +31,43 @@ function P(t) {
|
|
|
34
31
|
return A.has(g(t)) ? "y" : "x";
|
|
35
32
|
}
|
|
36
33
|
function y(t) {
|
|
37
|
-
return
|
|
34
|
+
return x(P(t));
|
|
38
35
|
}
|
|
39
|
-
function
|
|
36
|
+
function E(t, e, n) {
|
|
40
37
|
n === void 0 && (n = !1);
|
|
41
|
-
const r =
|
|
38
|
+
const r = m(t), i = y(t), o = d(i);
|
|
42
39
|
let c = i === "x" ? r === (n ? "end" : "start") ? "right" : "left" : r === "start" ? "bottom" : "top";
|
|
43
40
|
return e.reference[o] > e.floating[o] && (c = f(c)), [c, f(c)];
|
|
44
41
|
}
|
|
45
|
-
function
|
|
42
|
+
function R(t) {
|
|
46
43
|
const e = f(t);
|
|
47
44
|
return [s(t), e, s(e)];
|
|
48
45
|
}
|
|
49
46
|
function s(t) {
|
|
50
|
-
return t.replace(/start|end/g, (e) =>
|
|
47
|
+
return t.replace(/start|end/g, (e) => b[e]);
|
|
51
48
|
}
|
|
52
|
-
const u = ["left", "right"], l = ["right", "left"],
|
|
53
|
-
function
|
|
49
|
+
const u = ["left", "right"], l = ["right", "left"], O = ["top", "bottom"], S = ["bottom", "top"];
|
|
50
|
+
function w(t, e, n) {
|
|
54
51
|
switch (t) {
|
|
55
52
|
case "top":
|
|
56
53
|
case "bottom":
|
|
57
54
|
return n ? e ? l : u : e ? u : l;
|
|
58
55
|
case "left":
|
|
59
56
|
case "right":
|
|
60
|
-
return e ?
|
|
57
|
+
return e ? O : S;
|
|
61
58
|
default:
|
|
62
59
|
return [];
|
|
63
60
|
}
|
|
64
61
|
}
|
|
65
|
-
function
|
|
66
|
-
const i =
|
|
67
|
-
let o =
|
|
62
|
+
function T(t, e, n, r) {
|
|
63
|
+
const i = m(t);
|
|
64
|
+
let o = w(g(t), n === "start", r);
|
|
68
65
|
return i && (o = o.map((c) => c + "-" + i), e && (o = o.concat(o.map(s)))), o;
|
|
69
66
|
}
|
|
70
67
|
function f(t) {
|
|
71
68
|
return t.replace(/left|right|bottom|top/g, (e) => h[e]);
|
|
72
69
|
}
|
|
73
|
-
function
|
|
70
|
+
function M(t) {
|
|
74
71
|
return {
|
|
75
72
|
top: 0,
|
|
76
73
|
right: 0,
|
|
@@ -79,15 +76,15 @@ function w(t) {
|
|
|
79
76
|
...t
|
|
80
77
|
};
|
|
81
78
|
}
|
|
82
|
-
function
|
|
83
|
-
return typeof t != "number" ?
|
|
79
|
+
function k(t) {
|
|
80
|
+
return typeof t != "number" ? M(t) : {
|
|
84
81
|
top: t,
|
|
85
82
|
right: t,
|
|
86
83
|
bottom: t,
|
|
87
84
|
left: t
|
|
88
85
|
};
|
|
89
86
|
}
|
|
90
|
-
function
|
|
87
|
+
function q(t) {
|
|
91
88
|
const {
|
|
92
89
|
x: e,
|
|
93
90
|
y: n,
|
|
@@ -106,26 +103,23 @@ function D(t) {
|
|
|
106
103
|
};
|
|
107
104
|
}
|
|
108
105
|
export {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
L as floor,
|
|
114
|
-
a as getAlignment,
|
|
106
|
+
L as clamp,
|
|
107
|
+
C as evaluate,
|
|
108
|
+
M as expandPaddingObject,
|
|
109
|
+
m as getAlignment,
|
|
115
110
|
y as getAlignmentAxis,
|
|
116
|
-
|
|
111
|
+
E as getAlignmentSides,
|
|
117
112
|
d as getAxisLength,
|
|
118
|
-
|
|
113
|
+
R as getExpandedPlacements,
|
|
119
114
|
s as getOppositeAlignmentPlacement,
|
|
120
|
-
|
|
121
|
-
|
|
115
|
+
x as getOppositeAxis,
|
|
116
|
+
T as getOppositeAxisPlacements,
|
|
122
117
|
f as getOppositePlacement,
|
|
123
|
-
|
|
118
|
+
k as getPaddingObject,
|
|
124
119
|
g as getSide,
|
|
125
120
|
P as getSideAxis,
|
|
126
121
|
p as max,
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
C as round,
|
|
122
|
+
a as min,
|
|
123
|
+
q as rectToClientRect,
|
|
130
124
|
j as sides
|
|
131
125
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { offset as st, shift as rt, flip as ct, size as lt, hide as ft, limitShift as ut, computePosition as ht, arrow as at } from "../../core/dist/floating-ui.core.js";
|
|
3
|
-
import { createCoords as y, round as D, max as E, min as N,
|
|
4
|
-
import { isElement as v, getDocumentElement as R, getOverflowAncestors as $, getComputedStyle as b, isHTMLElement as C, getWindow as L, isTopLayer as V, getParentNode as S, isLastTraversableNode as z, isTableElement as dt, isContainingBlock as
|
|
3
|
+
import { createCoords as y, round as D, max as E, min as N, floor as A } from "../node_modules/@floating-ui/utils/dist/floating-ui.utils.js";
|
|
4
|
+
import { isElement as v, getDocumentElement as R, getOverflowAncestors as $, getComputedStyle as b, isHTMLElement as C, getWindow as L, isTopLayer as V, getParentNode as S, isLastTraversableNode as z, isTableElement as dt, isContainingBlock as J, getContainingBlock as gt, getNodeName as _, isOverflowElement as q, getNodeScroll as H, getFrameElement as U, isWebKit as Q } from "../node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js";
|
|
5
|
+
import { rectToClientRect as Y } from "../../core/node_modules/@floating-ui/utils/dist/floating-ui.utils.js";
|
|
5
6
|
function Z(t) {
|
|
6
7
|
const e = b(t);
|
|
7
8
|
let o = parseFloat(e.width) || 0, i = parseFloat(e.height) || 0;
|
|
@@ -33,7 +34,7 @@ function F(t) {
|
|
|
33
34
|
const pt = /* @__PURE__ */ y(0);
|
|
34
35
|
function tt(t) {
|
|
35
36
|
const e = L(t);
|
|
36
|
-
return !
|
|
37
|
+
return !Q() || !e.visualViewport ? pt : {
|
|
37
38
|
x: e.visualViewport.offsetLeft,
|
|
38
39
|
y: e.visualViewport.offsetTop
|
|
39
40
|
};
|
|
@@ -56,7 +57,7 @@ function T(t, e, o, i) {
|
|
|
56
57
|
f *= w.x, l *= w.y, u *= w.x, h *= w.y, f += O, l += W, m = L(p), p = U(m);
|
|
57
58
|
}
|
|
58
59
|
}
|
|
59
|
-
return
|
|
60
|
+
return Y({
|
|
60
61
|
width: u,
|
|
61
62
|
height: h,
|
|
62
63
|
x: f,
|
|
@@ -121,7 +122,7 @@ function vt(t, e) {
|
|
|
121
122
|
let r = i.clientWidth, s = i.clientHeight, c = 0, f = 0;
|
|
122
123
|
if (n) {
|
|
123
124
|
r = n.width, s = n.height;
|
|
124
|
-
const u =
|
|
125
|
+
const u = Q();
|
|
125
126
|
(!u || u && e === "fixed") && (c = n.offsetLeft, f = n.offsetTop);
|
|
126
127
|
}
|
|
127
128
|
const l = I(i);
|
|
@@ -163,7 +164,7 @@ function j(t, e, o) {
|
|
|
163
164
|
height: e.height
|
|
164
165
|
};
|
|
165
166
|
}
|
|
166
|
-
return
|
|
167
|
+
return Y(i);
|
|
167
168
|
}
|
|
168
169
|
function it(t, e) {
|
|
169
170
|
const o = S(t);
|
|
@@ -177,7 +178,7 @@ function Ct(t, e) {
|
|
|
177
178
|
const r = b(t).position === "fixed";
|
|
178
179
|
let s = r ? S(t) : t;
|
|
179
180
|
for (; v(s) && !z(s); ) {
|
|
180
|
-
const c = b(s), f =
|
|
181
|
+
const c = b(s), f = J(s);
|
|
181
182
|
!f && c.position === "fixed" && (n = null), (r ? !f && !n : !f && c.position === "static" && !!n && bt.has(n.position) || q(s) && !f && it(t, s)) ? i = i.filter((u) => u !== s) : n = c, s = S(s);
|
|
182
183
|
}
|
|
183
184
|
return e.set(t, i), i;
|
|
@@ -261,7 +262,7 @@ function ot(t, e) {
|
|
|
261
262
|
let i = G(t, e);
|
|
262
263
|
for (; i && dt(i) && M(i); )
|
|
263
264
|
i = G(i, e);
|
|
264
|
-
return i && z(i) && M(i) && !
|
|
265
|
+
return i && z(i) && M(i) && !J(i) ? o : i || gt(t) || o;
|
|
265
266
|
}
|
|
266
267
|
const Et = async function(t) {
|
|
267
268
|
const e = this.getOffsetParent || ot, o = this.getDimensions, i = await o(t.floating);
|
|
@@ -339,7 +340,7 @@ function Wt(t, e) {
|
|
|
339
340
|
}
|
|
340
341
|
return s(!0), r;
|
|
341
342
|
}
|
|
342
|
-
function
|
|
343
|
+
function Ht(t, e, o, i) {
|
|
343
344
|
i === void 0 && (i = {});
|
|
344
345
|
const {
|
|
345
346
|
ancestorScroll: n = !0,
|
|
@@ -375,7 +376,7 @@ function zt(t, e, o, i) {
|
|
|
375
376
|
}), h?.(), (g = a) == null || g.disconnect(), a = null, f && cancelAnimationFrame(m);
|
|
376
377
|
};
|
|
377
378
|
}
|
|
378
|
-
const
|
|
379
|
+
const It = st, Mt = rt, Nt = ct, $t = lt, Vt = ft, _t = at, qt = ut, Xt = (t, e, o) => {
|
|
379
380
|
const i = /* @__PURE__ */ new Map(), n = {
|
|
380
381
|
platform: St,
|
|
381
382
|
...o
|
|
@@ -389,15 +390,15 @@ const Ht = st, It = rt, Mt = ct, Nt = lt, $t = ft, Vt = at, _t = ut, qt = (t, e,
|
|
|
389
390
|
});
|
|
390
391
|
};
|
|
391
392
|
export {
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
393
|
+
_t as arrow,
|
|
394
|
+
Ht as autoUpdate,
|
|
395
|
+
Xt as computePosition,
|
|
396
|
+
Nt as flip,
|
|
396
397
|
$ as getOverflowAncestors,
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
398
|
+
Vt as hide,
|
|
399
|
+
qt as limitShift,
|
|
400
|
+
It as offset,
|
|
400
401
|
St as platform,
|
|
401
|
-
|
|
402
|
-
|
|
402
|
+
Mt as shift,
|
|
403
|
+
$t as size
|
|
403
404
|
};
|
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { $getSelection as C, defineExtension as Y, getDOMSelection as J, COPY_COMMAND as V, COMMAND_PRIORITY_CRITICAL as tt, $getEditor as P, getRootOwnerDocument as et, getDOMShadowRoots as nt, getParentElement as ot, isDOMShadowRoot as rt, safeCast as W, shallowMergeConfig as X, $isRangeSelection as T, tokenizeRawText as it, getDOMSelectionPoints as st, isSelectionWithinEditor as lt, $getNearestNodeFromDOMNode as at, $isTextNode as S, $getTextPointCaret as ct, $isElementNode as y, $getChildCaretAtIndex as A, $splitAtPointCaretNext as ut, $getCaretRangeInDirection as ft, $caretRangeFromSelection as pt, $comparePointCaretNext as K, $setSelectionFromCaretRange as dt, $getCollapsedCaretRange as mt, findAllLexicalElementsDeep as gt, getEditorPropertyFromDOMNode as yt, isLexicalEditor as xt, isHTMLElement as Tt, SELECTION_INSERT_CLIPBOARD_NODES_COMMAND as ht, $caretFromPoint as $t, $isTextPointCaret as Ct, $getCaretRange as Nt, $getChildCaret as Mt, $getRoot as z, $parseSerializedNode as Dt, $isNodeSelection as G, $getSlotFrame as Pt, $getSlotNames as St, $getSlot as Rt, $createTabNode as Et } from "../../../lexical/dist/Lexical.prod.js";
|
|
3
|
+
import { $getPeerDependency as Ot, getPeerDependencyFromEditor as bt } from "../../extension/dist/LexicalExtension.prod.js";
|
|
4
|
+
import { $generateNodesFromDOM as wt, $generateHtmlFromNodes as Ft } from "../../html/dist/LexicalHtml.prod.js";
|
|
5
|
+
import { $sliceSelectedTextNodeContent as vt } from "../../selection/dist/LexicalSelection.prod.js";
|
|
6
|
+
import { objectKlassEquals as It } from "../../utils/dist/LexicalUtils.prod.js";
|
|
7
|
+
function Lt(e, t, o = null) {
|
|
8
|
+
const n = et(o), i = o ? nt(o) : [], s = o !== null && i.length > 0;
|
|
9
|
+
if (s && typeof n.caretPositionFromPoint == "function") {
|
|
10
|
+
const r = n.caretPositionFromPoint(e, t, { shadowRoots: i });
|
|
11
|
+
if (r !== null && (function(l, a) {
|
|
12
|
+
for (let u = l; u !== null; ) {
|
|
13
|
+
if (u === a) return !0;
|
|
14
|
+
u = ot(u);
|
|
15
|
+
}
|
|
16
|
+
return !1;
|
|
17
|
+
})(r.offsetNode, o)) return { node: r.offsetNode, offset: r.offset };
|
|
18
|
+
}
|
|
19
|
+
if (s) {
|
|
20
|
+
const r = o.getRootNode();
|
|
21
|
+
if (rt(r)) {
|
|
22
|
+
const l = r.elementFromPoint(e, t);
|
|
23
|
+
if (l !== null && o.contains(l)) {
|
|
24
|
+
const a = (function(u, f, p, c) {
|
|
25
|
+
const m = c.createRange(), g = (d) => f < d.top ? d.top - f : f > d.bottom ? f - d.bottom : 0, R = (d) => u < d.left ? d.left - u : u > d.right ? u - d.right : 0, v = c.createTreeWalker(p, NodeFilter.SHOW_TEXT);
|
|
26
|
+
let N = null, E = 1 / 0, I = 1 / 0;
|
|
27
|
+
for (let d = v.nextNode(); d; d = v.nextNode()) {
|
|
28
|
+
m.selectNodeContents(d);
|
|
29
|
+
for (const M of m.getClientRects()) {
|
|
30
|
+
const x = g(M), D = R(M);
|
|
31
|
+
(x < E || x === E && D < I) && (E = x, I = D, N = d);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (N === null) return null;
|
|
35
|
+
let L = 0, O = 1 / 0, _ = 1 / 0;
|
|
36
|
+
for (let d = 0; d <= N.length; d++) {
|
|
37
|
+
m.setStart(N, d), m.collapse(!0);
|
|
38
|
+
const M = m.getBoundingClientRect(), x = g(M), D = Math.abs(u - M.left);
|
|
39
|
+
(x < O || x === O && D < _) && (O = x, _ = D, L = d);
|
|
40
|
+
}
|
|
41
|
+
return { node: N, offset: L };
|
|
42
|
+
})(e, t, l, n);
|
|
43
|
+
if (a !== null) return a;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (typeof n.caretRangeFromPoint == "function") {
|
|
48
|
+
const r = n.caretRangeFromPoint(e, t);
|
|
49
|
+
return r === null ? null : { node: r.startContainer, offset: r.startOffset };
|
|
50
|
+
}
|
|
51
|
+
if (typeof n.caretPositionFromPoint == "function") {
|
|
52
|
+
const r = n.caretPositionFromPoint(e, t);
|
|
53
|
+
return r === null ? null : { node: r.offsetNode, offset: r.offset };
|
|
54
|
+
}
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
function $(e, ...t) {
|
|
58
|
+
const o = new URL("https://lexical.dev/docs/error"), n = new URLSearchParams();
|
|
59
|
+
n.append("code", e);
|
|
60
|
+
for (const i of t) n.append("v", i);
|
|
61
|
+
throw o.search = n.toString(), Error(`Minified Lexical error #${e}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
|
|
62
|
+
}
|
|
63
|
+
const b = { "application/x-lexical-editor": 0, "text/html": 10, "text/plain": 20, "text/uri-list": 30 };
|
|
64
|
+
function _t(e) {
|
|
65
|
+
return window.trustedTypes && window.trustedTypes.createPolicy ? window.trustedTypes.createPolicy("lexical", { createHTML: (t) => t }).createHTML(e) : e;
|
|
66
|
+
}
|
|
67
|
+
const j = (e, t) => {
|
|
68
|
+
if (!T(t)) return t.insertRawText(e), !0;
|
|
69
|
+
const o = (n) => {
|
|
70
|
+
const i = C();
|
|
71
|
+
T(i) && n(i);
|
|
72
|
+
};
|
|
73
|
+
return it(e, { linebreak: () => o((n) => n.insertParagraph()), tab: () => o((n) => n.insertNodes([Et()])), text: (n) => o((i) => i.insertText(n)) }), !0;
|
|
74
|
+
}, w = { "application/x-lexical-editor": [(e, t, o) => {
|
|
75
|
+
try {
|
|
76
|
+
const n = P(), i = JSON.parse(e);
|
|
77
|
+
if (i && i.namespace === n._config.namespace && Array.isArray(i.nodes))
|
|
78
|
+
return H(n, Jt(i.nodes), t), !0;
|
|
79
|
+
} catch (n) {
|
|
80
|
+
console.error(n);
|
|
81
|
+
}
|
|
82
|
+
return o();
|
|
83
|
+
}], "text/html": [(e, t, o) => {
|
|
84
|
+
try {
|
|
85
|
+
const n = P(), i = new DOMParser().parseFromString(_t(e), "text/html");
|
|
86
|
+
return H(n, wt(n, i), t), !0;
|
|
87
|
+
} catch (n) {
|
|
88
|
+
return console.error(n), o();
|
|
89
|
+
}
|
|
90
|
+
}], "text/plain": [j], "text/uri-list": [j] };
|
|
91
|
+
function At(e, t, o, n) {
|
|
92
|
+
if (!e) return !1;
|
|
93
|
+
const i = (s) => !!e[s] && e[s](t, o, i.bind(null, s - 1), n);
|
|
94
|
+
return i(e.length - 1);
|
|
95
|
+
}
|
|
96
|
+
function U(e, t, o) {
|
|
97
|
+
const n = t.getData("text/plain");
|
|
98
|
+
for (const i of (function(s) {
|
|
99
|
+
return Object.keys(s.$importMimeType).filter((r) => s.$importMimeType[r] !== void 0).sort((r, l) => {
|
|
100
|
+
const a = s.priority[r], u = s.priority[l];
|
|
101
|
+
return a === void 0 && u === void 0 ? r < l ? -1 : r > l ? 1 : 0 : a === void 0 ? 1 : u === void 0 ? -1 : a - u;
|
|
102
|
+
});
|
|
103
|
+
})(e)) {
|
|
104
|
+
const s = t.getData(i);
|
|
105
|
+
if (s && (i !== "text/html" || s !== n) && At(e.$importMimeType[i], s, o, t)) return !0;
|
|
106
|
+
}
|
|
107
|
+
return !1;
|
|
108
|
+
}
|
|
109
|
+
const Kt = { $importMimeType: w, $insertDataTransfer: (e, t) => U({ $importMimeType: w, priority: b }, e, t), priority: b }, jt = /* @__PURE__ */ Y({ build: (e, t) => ({ $importMimeType: t.$importMimeType, $insertDataTransfer: (o, n) => U(t, o, n), priority: t.priority }), config: /* @__PURE__ */ W({ $importMimeType: w, priority: b }), mergeConfig(e, t) {
|
|
110
|
+
const o = X(e, t);
|
|
111
|
+
if (t.$importMimeType) {
|
|
112
|
+
const n = { ...e.$importMimeType };
|
|
113
|
+
for (const [i, s] of Object.entries(t.$importMimeType)) if (s) {
|
|
114
|
+
const r = n[i];
|
|
115
|
+
n[i] = r ? [...r, ...s] : s;
|
|
116
|
+
}
|
|
117
|
+
o.$importMimeType = n;
|
|
118
|
+
}
|
|
119
|
+
return t.priority && (o.priority = { ...e.priority, ...t.priority }), o;
|
|
120
|
+
}, name: "@lexical/clipboard/Import" });
|
|
121
|
+
function B(e, t = C()) {
|
|
122
|
+
return t == null && $(166), T(t) && t.isCollapsed() || t.getNodes().length === 0 ? "" : Ft(e, t);
|
|
123
|
+
}
|
|
124
|
+
function q(e, t = C()) {
|
|
125
|
+
return t == null && $(166), T(t) && t.isCollapsed() || t.getNodes().length === 0 ? null : JSON.stringify(Yt(e, t));
|
|
126
|
+
}
|
|
127
|
+
function Ht(e, t, o) {
|
|
128
|
+
(function() {
|
|
129
|
+
const n = Ot(jt.name);
|
|
130
|
+
return n ? n.output : Kt;
|
|
131
|
+
})().$insertDataTransfer(e, t);
|
|
132
|
+
}
|
|
133
|
+
const Z = "application/x-lexical-drag";
|
|
134
|
+
function ee(e, t) {
|
|
135
|
+
const o = { editorKey: t.getKey() };
|
|
136
|
+
e.setData(Z, JSON.stringify(o));
|
|
137
|
+
}
|
|
138
|
+
function kt(e, t, o) {
|
|
139
|
+
const n = e.dataTransfer;
|
|
140
|
+
if (n === null) return !1;
|
|
141
|
+
const i = (function(u) {
|
|
142
|
+
const f = u.getData(Z);
|
|
143
|
+
if (!f) return null;
|
|
144
|
+
let p;
|
|
145
|
+
try {
|
|
146
|
+
p = JSON.parse(f);
|
|
147
|
+
} catch {
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
150
|
+
return (c = p) !== null && typeof c == "object" && "editorKey" in c && typeof c.editorKey == "string" ? p : null;
|
|
151
|
+
var c;
|
|
152
|
+
})(n);
|
|
153
|
+
if (i === null) return !1;
|
|
154
|
+
const s = (function(u, f) {
|
|
155
|
+
const p = Lt(u.clientX, u.clientY, f.getRootElement());
|
|
156
|
+
if (p === null) return null;
|
|
157
|
+
const c = at(p.node);
|
|
158
|
+
if (c === null) return null;
|
|
159
|
+
if (S(c)) return ct(c, "next", p.offset);
|
|
160
|
+
if (y(c)) return A(c, p.offset, "next");
|
|
161
|
+
const m = c.getParent();
|
|
162
|
+
return m === null ? null : A(m, c.getIndexWithinParent() + 1, "next");
|
|
163
|
+
})(e, t);
|
|
164
|
+
if (s === null) return !1;
|
|
165
|
+
const r = ut(s);
|
|
166
|
+
if (r === null) return !1;
|
|
167
|
+
const l = i.editorKey === t.getKey(), a = C();
|
|
168
|
+
if (l) {
|
|
169
|
+
if (!T(a) || a.isCollapsed()) return !1;
|
|
170
|
+
if ((function(u, f) {
|
|
171
|
+
const { anchor: p, focus: c } = ft(pt(f), "next");
|
|
172
|
+
return K(p, u) < 0 && K(u, c) < 0;
|
|
173
|
+
})(s, a)) return e.preventDefault(), !0;
|
|
174
|
+
a.removeText();
|
|
175
|
+
}
|
|
176
|
+
if (!r.origin.isAttached()) return e.preventDefault(), !0;
|
|
177
|
+
if (o(n, dt(mt(r)), t), !l) {
|
|
178
|
+
const u = t.getRootElement(), f = u ? u.ownerDocument : null, p = f ? (function(c, m) {
|
|
179
|
+
for (const g of gt(m)) {
|
|
180
|
+
const R = yt(g);
|
|
181
|
+
if (xt(R) && R.getKey() === c && Tt(g)) return g;
|
|
182
|
+
}
|
|
183
|
+
return null;
|
|
184
|
+
})(i.editorKey, f) : null;
|
|
185
|
+
p !== null && p.dispatchEvent(new InputEvent("beforeinput", { bubbles: !0, cancelable: !0, inputType: "deleteByDrag" }));
|
|
186
|
+
}
|
|
187
|
+
return e.preventDefault(), !0;
|
|
188
|
+
}
|
|
189
|
+
function ne(e, t) {
|
|
190
|
+
return kt(e, t, Ht);
|
|
191
|
+
}
|
|
192
|
+
function H(e, t, o) {
|
|
193
|
+
e.dispatchCommand(ht, { nodes: t, selection: o }) || (o.insertNodes(t), (function(n) {
|
|
194
|
+
if (T(n) && n.isCollapsed()) {
|
|
195
|
+
const i = n.anchor;
|
|
196
|
+
let s = null;
|
|
197
|
+
const r = $t(i, "previous");
|
|
198
|
+
if (r) if (Ct(r)) s = r.origin;
|
|
199
|
+
else {
|
|
200
|
+
const l = Nt(r, Mt(z(), "next").getFlipped());
|
|
201
|
+
for (const a of l) {
|
|
202
|
+
if (S(a.origin)) {
|
|
203
|
+
s = a.origin;
|
|
204
|
+
break;
|
|
205
|
+
}
|
|
206
|
+
if (y(a.origin) && !a.origin.isInline()) break;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
if (s && S(s)) {
|
|
210
|
+
const l = s.getFormat(), a = s.getStyle();
|
|
211
|
+
n.format === l && n.style === a || (n.format = l, n.style = a, n.dirty = !0);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
})(o));
|
|
215
|
+
}
|
|
216
|
+
function F(e, t, o, n = []) {
|
|
217
|
+
let i = t === null || o.isSelected(t);
|
|
218
|
+
const s = y(o) && o.excludeFromCopy("html");
|
|
219
|
+
let r = o;
|
|
220
|
+
t !== null && S(r) && (r = vt(t, r, "clone"));
|
|
221
|
+
const l = y(r) ? r.getChildren() : [], a = (function(f) {
|
|
222
|
+
const p = f.exportJSON(), c = f.constructor;
|
|
223
|
+
if (p.type !== c.getType() && $(58, c.name), y(f)) {
|
|
224
|
+
const m = p.children;
|
|
225
|
+
Array.isArray(m) || $(59, c.name);
|
|
226
|
+
}
|
|
227
|
+
return p;
|
|
228
|
+
})(r);
|
|
229
|
+
S(r) && r.getTextContentSize() === 0 && (i = !1);
|
|
230
|
+
const u = i && G(t) && y(o) ? null : t;
|
|
231
|
+
for (let f = 0; f < l.length; f++) {
|
|
232
|
+
const p = l[f], c = F(e, u, p, a.children);
|
|
233
|
+
!i && y(o) && c && o.extractWithChild(p, t, "clone") && (i = !0);
|
|
234
|
+
}
|
|
235
|
+
if (i && !s) {
|
|
236
|
+
const f = St(r);
|
|
237
|
+
if (f.length > 0) {
|
|
238
|
+
const p = {};
|
|
239
|
+
for (const c of f) {
|
|
240
|
+
const m = Rt(r, c);
|
|
241
|
+
m === null && $(366, r.constructor.name, c);
|
|
242
|
+
const g = [];
|
|
243
|
+
F(e, null, m, g), g.length === 1 && g[0].type === m.getType() || $(385, c, r.constructor.name, String(g.length), String(g.length > 0 ? g[0].type : "none")), p[c] = g[0];
|
|
244
|
+
}
|
|
245
|
+
a.$slots = p;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
if (i && !s) n.push(a);
|
|
249
|
+
else if (Array.isArray(a.children)) for (let f = 0; f < a.children.length; f++) {
|
|
250
|
+
const p = a.children[f];
|
|
251
|
+
n.push(p);
|
|
252
|
+
}
|
|
253
|
+
return i;
|
|
254
|
+
}
|
|
255
|
+
function Yt(e, t) {
|
|
256
|
+
const o = [], n = z(), i = T(t) ? t.anchor.getNode() : G(t) ? t.getNodes()[0] ?? null : null, s = i !== null ? Pt(i) : null, r = (y(s) ? s : n).getChildren();
|
|
257
|
+
for (let l = 0; l < r.length; l++)
|
|
258
|
+
F(e, t, r[l], o);
|
|
259
|
+
return { namespace: e._config.namespace, nodes: o };
|
|
260
|
+
}
|
|
261
|
+
function Jt(e) {
|
|
262
|
+
const t = [];
|
|
263
|
+
for (const o of e) t.push(Dt(o));
|
|
264
|
+
return t;
|
|
265
|
+
}
|
|
266
|
+
let h = null;
|
|
267
|
+
async function oe(e, t, o) {
|
|
268
|
+
if (h !== null) return !1;
|
|
269
|
+
if (t !== null) return new Promise((u, f) => {
|
|
270
|
+
e.update(() => {
|
|
271
|
+
u(k(e, t, o));
|
|
272
|
+
});
|
|
273
|
+
});
|
|
274
|
+
const n = e.getRootElement(), i = e._window || window, s = i.document, r = J(i);
|
|
275
|
+
if (n === null || r === null) return !1;
|
|
276
|
+
const l = s.createElement("span");
|
|
277
|
+
l.style.position = "fixed", l.style.top = "-1000px", l.append(s.createTextNode("#")), n.append(l);
|
|
278
|
+
const a = s.createRange();
|
|
279
|
+
return a.setStart(l, 0), a.setEnd(l, 1), r.removeAllRanges(), r.addRange(a), new Promise((u, f) => {
|
|
280
|
+
const p = e.registerCommand(V, (c) => (It(c, ClipboardEvent) && (p(), h !== null && (i.clearTimeout(h), h = null), u(k(e, c, o))), !0), tt);
|
|
281
|
+
h = i.setTimeout(() => {
|
|
282
|
+
p(), h = null, u(!1);
|
|
283
|
+
}, 50), s.execCommand("copy"), l.remove();
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
function k(e, t, o) {
|
|
287
|
+
if (o === void 0) {
|
|
288
|
+
const i = J(e._window), s = C();
|
|
289
|
+
if (!s || s.isCollapsed() || !i) return !1;
|
|
290
|
+
const r = st(i, e.getRootElement()), l = r.anchorNode, a = r.focusNode;
|
|
291
|
+
if (l !== null && a !== null && !lt(e, l, a)) return !1;
|
|
292
|
+
o = Xt(s);
|
|
293
|
+
}
|
|
294
|
+
t.preventDefault();
|
|
295
|
+
const n = t.clipboardData;
|
|
296
|
+
return n !== null && (zt(n, o), !0);
|
|
297
|
+
}
|
|
298
|
+
const Wt = [["text/html", B], ["application/x-lexical-editor", q]];
|
|
299
|
+
function Xt(e = C()) {
|
|
300
|
+
return (function(t, o) {
|
|
301
|
+
const n = { "text/plain": "" };
|
|
302
|
+
for (const [i, s] of Object.entries(t)) if (s) {
|
|
303
|
+
const r = Ut(s, o);
|
|
304
|
+
r !== null && (n[i] = r);
|
|
305
|
+
}
|
|
306
|
+
return n;
|
|
307
|
+
})(Gt(), e);
|
|
308
|
+
}
|
|
309
|
+
function zt(e, t) {
|
|
310
|
+
for (const [o] of Wt) t[o] === void 0 && e.setData(o, "");
|
|
311
|
+
for (const o in t) {
|
|
312
|
+
const n = t[o];
|
|
313
|
+
n !== void 0 && e.setData(o, n);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
function Gt(e = P()) {
|
|
317
|
+
const t = bt(e, Bt.name);
|
|
318
|
+
return t ? t.output : Q;
|
|
319
|
+
}
|
|
320
|
+
const Q = { "application/x-lexical-editor": [(e, t) => e ? q(P(), e) : t()], "text/html": [(e, t) => e ? B(P(), e) : t()], "text/plain": [(e, t) => e ? e.getTextContent() : t()] };
|
|
321
|
+
function Ut(e, t) {
|
|
322
|
+
const o = (n) => e[n] ? e[n](t, o.bind(null, n - 1)) : null;
|
|
323
|
+
return o(e.length - 1);
|
|
324
|
+
}
|
|
325
|
+
const Bt = /* @__PURE__ */ Y({ build: (e, t, o) => t.$exportMimeType, config: /* @__PURE__ */ W({ $exportMimeType: Q }), mergeConfig(e, t) {
|
|
326
|
+
const o = X(e, t);
|
|
327
|
+
if (t.$exportMimeType) {
|
|
328
|
+
const n = { ...e.$exportMimeType };
|
|
329
|
+
for (const [i, s] of Object.entries(t.$exportMimeType)) if (s) {
|
|
330
|
+
const r = n[i];
|
|
331
|
+
n[i] = r ? [...r, ...s] : s;
|
|
332
|
+
}
|
|
333
|
+
o.$exportMimeType = n;
|
|
334
|
+
}
|
|
335
|
+
return o;
|
|
336
|
+
}, name: "@lexical/clipboard/GetClipboardData" });
|
|
337
|
+
export {
|
|
338
|
+
Yt as $generateJSONFromSelectedNodes,
|
|
339
|
+
Jt as $generateNodesFromSerializedNodes,
|
|
340
|
+
Xt as $getClipboardDataFromSelection,
|
|
341
|
+
B as $getHtmlContent,
|
|
342
|
+
q as $getLexicalContent,
|
|
343
|
+
ne as $handleRichTextDrop,
|
|
344
|
+
Ht as $insertDataTransferForRichText,
|
|
345
|
+
H as $insertGeneratedNodes,
|
|
346
|
+
ee as $writeDragSourceToDataTransfer,
|
|
347
|
+
jt as ClipboardImportExtension,
|
|
348
|
+
w as DEFAULT_IMPORT_MIME_TYPE,
|
|
349
|
+
b as DEFAULT_IMPORT_MIME_TYPE_PRIORITY,
|
|
350
|
+
Bt as GetClipboardDataExtension,
|
|
351
|
+
Lt as caretFromPoint,
|
|
352
|
+
oe as copyToClipboard,
|
|
353
|
+
zt as setLexicalClipboardDataTransfer
|
|
354
|
+
};
|