@clevertask/scribe 0.0.14 → 0.1.0
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 +26 -25
- package/dist/BarMenu-BDtEfu-R.js +327 -0
- package/dist/assets/index.css +1 -1
- package/dist/components/Menu/BarMenu.d.ts +0 -1
- package/dist/components/Menu/BarMenu.d.ts.map +1 -1
- package/dist/components/Menu/BarMenu.js +8 -119
- package/dist/components/Menu/BubbleMenu.d.ts.map +1 -1
- package/dist/components/Menu/BubbleMenu.js +2070 -159
- package/dist/components/Menu/Mobile/ListOptionBar.d.ts.map +1 -1
- package/dist/components/Menu/Mobile/ListOptionBar.js +42 -34
- package/dist/components/Scribe/extension/emoji/EmojiList.d.ts +19 -1
- package/dist/components/Scribe/extension/emoji/EmojiList.d.ts.map +1 -1
- package/dist/components/Scribe/extension/emoji/EmojiList.js +38 -27
- package/dist/components/Scribe/extension/emoji/suggest.d.ts +2 -4
- package/dist/components/Scribe/extension/emoji/suggest.d.ts.map +1 -1
- package/dist/components/Scribe/extension/emoji/suggest.js +20 -15
- package/dist/components/Scribe/extension/extension-link.d.ts.map +1 -1
- package/dist/components/Scribe/extension/extension-link.js +2 -986
- package/dist/components/Scribe/extension/extension-markdown-paste.d.ts +4 -0
- package/dist/components/Scribe/extension/extension-markdown-paste.d.ts.map +1 -0
- package/dist/components/Scribe/extension/extension-markdown-paste.js +46 -0
- package/dist/components/Scribe/extension/extension-selectedText.js +1 -1
- package/dist/components/Scribe/extension/getPopupMountTarget.d.ts +3 -0
- package/dist/components/Scribe/extension/getPopupMountTarget.d.ts.map +1 -0
- package/dist/components/Scribe/extension/getPopupMountTarget.js +16 -0
- package/dist/components/Scribe/extension/index.d.ts +1 -1
- package/dist/components/Scribe/extension/index.d.ts.map +1 -1
- package/dist/components/Scribe/extension/index.js +37047 -32
- package/dist/components/Scribe/extension/slashCommand/SlashCommandList.d.ts +4 -1
- package/dist/components/Scribe/extension/slashCommand/SlashCommandList.d.ts.map +1 -1
- package/dist/components/Scribe/extension/slashCommand/SlashCommandList.js +3732 -13
- package/dist/components/Scribe/extension/slashCommand/index.js +2 -2
- package/dist/components/Scribe/extension/slashCommand/items.d.ts.map +1 -1
- package/dist/components/Scribe/extension/slashCommand/renderItems.d.ts +1 -1
- package/dist/components/Scribe/extension/slashCommand/renderItems.d.ts.map +1 -1
- package/dist/components/Scribe/extension/slashCommand/renderItems.js +21 -16
- package/dist/components/Scribe/index.d.ts +0 -1
- package/dist/components/Scribe/index.d.ts.map +1 -1
- package/dist/components/Scribe/index.js +83 -90
- package/dist/extension-link-D3eyOFkn.js +1030 -0
- package/dist/icons/ToolbarIcons.d.ts +19 -0
- package/dist/icons/ToolbarIcons.d.ts.map +1 -0
- package/dist/icons/ToolbarIcons.js +135 -0
- package/dist/index-DZylq4Bc.js +232 -0
- package/dist/index-FY_iYS6i.js +1410 -0
- package/dist/index-PJNQPLn5.js +841 -0
- package/dist/{index-flsxByQS.js → index-hHvpW2H6.js} +6552 -5417
- package/dist/main.css +200 -1120
- package/dist/main.js +1 -1
- package/dist/markdown-to-html-BwS08CTi.js +1135 -0
- package/dist/{purify.es-BRDuGiV2.js → purify.es-BPDBzHtc.js} +1 -1
- package/dist/tippy.esm-DLHdsnfG.js +1711 -0
- package/dist/utils/convert-legacy-math-delimiters.d.ts.map +1 -1
- package/dist/utils/create-scribe-editor.d.ts +3 -3
- package/dist/utils/create-scribe-editor.d.ts.map +1 -1
- package/dist/utils/create-scribe-editor.js +8 -4
- package/dist/utils/html-to-markdown.d.ts.map +1 -1
- package/dist/utils/html-to-markdown.js +663 -18
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +3 -3
- package/dist/utils/markdown-to-html.js +3 -4
- package/package.json +59 -62
- package/dist/clsx-OuTLNxxd.js +0 -16
- package/dist/index-BfaHEr44.js +0 -159
- package/dist/index-Bvgjhwaj.js +0 -2349
- package/dist/index-DAuPG8ME.js +0 -50919
- package/dist/marked.esm-H7n4rMcO.js +0 -1554
- package/dist/turndown.browser.es-RmA_HBaI.js +0 -649
|
@@ -1,176 +1,2087 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
import { jsx as E } from "react/jsx-runtime";
|
|
2
|
+
import { Flex as ve, IconButton as ye } from "@radix-ui/themes";
|
|
3
|
+
import { a as Bt, u as be } from "../../index-PJNQPLn5.js";
|
|
4
|
+
import { b as zt, P as vt, p as xe, q as Vt, N as Oe, a as Nt, r as Se, s as Ce } from "../../index-hHvpW2H6.js";
|
|
5
|
+
import { C as Te } from "../../index-FY_iYS6i.js";
|
|
6
|
+
import _t, { useRef as k, useState as Wt, useEffect as it, useLayoutEffect as Ee, useCallback as Re } from "react";
|
|
7
|
+
import { createPortal as kt } from "react-dom";
|
|
8
|
+
import { getPopupMountTarget as Ie } from "../Scribe/extension/getPopupMountTarget.js";
|
|
9
|
+
const Ft = ["top", "right", "bottom", "left"], Ct = ["start", "end"], Tt = /* @__PURE__ */ Ft.reduce((t, e) => t.concat(e, e + "-" + Ct[0], e + "-" + Ct[1]), []), K = Math.min, D = Math.max, st = Math.round, $ = (t) => ({
|
|
10
|
+
x: t,
|
|
11
|
+
y: t
|
|
12
|
+
}), Le = {
|
|
13
|
+
left: "right",
|
|
14
|
+
right: "left",
|
|
15
|
+
bottom: "top",
|
|
16
|
+
top: "bottom"
|
|
17
|
+
};
|
|
18
|
+
function gt(t, e, n) {
|
|
19
|
+
return D(t, K(e, n));
|
|
20
|
+
}
|
|
21
|
+
function j(t, e) {
|
|
22
|
+
return typeof t == "function" ? t(e) : t;
|
|
23
|
+
}
|
|
24
|
+
function z(t) {
|
|
25
|
+
return t.split("-")[0];
|
|
26
|
+
}
|
|
27
|
+
function N(t) {
|
|
28
|
+
return t.split("-")[1];
|
|
29
|
+
}
|
|
30
|
+
function $t(t) {
|
|
31
|
+
return t === "x" ? "y" : "x";
|
|
32
|
+
}
|
|
33
|
+
function yt(t) {
|
|
34
|
+
return t === "y" ? "height" : "width";
|
|
35
|
+
}
|
|
36
|
+
function F(t) {
|
|
37
|
+
const e = t[0];
|
|
38
|
+
return e === "t" || e === "b" ? "y" : "x";
|
|
39
|
+
}
|
|
40
|
+
function bt(t) {
|
|
41
|
+
return $t(F(t));
|
|
42
|
+
}
|
|
43
|
+
function Kt(t, e, n) {
|
|
44
|
+
n === void 0 && (n = !1);
|
|
45
|
+
const o = N(t), i = bt(t), s = yt(i);
|
|
46
|
+
let r = i === "x" ? o === (n ? "end" : "start") ? "right" : "left" : o === "start" ? "bottom" : "top";
|
|
47
|
+
return e.reference[s] > e.floating[s] && (r = lt(r)), [r, lt(r)];
|
|
48
|
+
}
|
|
49
|
+
function De(t) {
|
|
50
|
+
const e = lt(t);
|
|
51
|
+
return [rt(t), e, rt(e)];
|
|
52
|
+
}
|
|
53
|
+
function rt(t) {
|
|
54
|
+
return t.includes("start") ? t.replace("start", "end") : t.replace("end", "start");
|
|
55
|
+
}
|
|
56
|
+
const Et = ["left", "right"], Rt = ["right", "left"], He = ["top", "bottom"], Ae = ["bottom", "top"];
|
|
57
|
+
function Me(t, e, n) {
|
|
58
|
+
switch (t) {
|
|
59
|
+
case "top":
|
|
60
|
+
case "bottom":
|
|
61
|
+
return n ? e ? Rt : Et : e ? Et : Rt;
|
|
62
|
+
case "left":
|
|
63
|
+
case "right":
|
|
64
|
+
return e ? He : Ae;
|
|
65
|
+
default:
|
|
66
|
+
return [];
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
function Pe(t, e, n, o) {
|
|
70
|
+
const i = N(t);
|
|
71
|
+
let s = Me(z(t), n === "start", o);
|
|
72
|
+
return i && (s = s.map((r) => r + "-" + i), e && (s = s.concat(s.map(rt)))), s;
|
|
73
|
+
}
|
|
74
|
+
function lt(t) {
|
|
75
|
+
const e = z(t);
|
|
76
|
+
return Le[e] + t.slice(e.length);
|
|
77
|
+
}
|
|
78
|
+
function Ue(t) {
|
|
79
|
+
return {
|
|
80
|
+
top: 0,
|
|
81
|
+
right: 0,
|
|
82
|
+
bottom: 0,
|
|
83
|
+
left: 0,
|
|
84
|
+
...t
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
function xt(t) {
|
|
88
|
+
return typeof t != "number" ? Ue(t) : {
|
|
89
|
+
top: t,
|
|
90
|
+
right: t,
|
|
91
|
+
bottom: t,
|
|
92
|
+
left: t
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
function Q(t) {
|
|
96
|
+
const {
|
|
97
|
+
x: e,
|
|
98
|
+
y: n,
|
|
99
|
+
width: o,
|
|
100
|
+
height: i
|
|
101
|
+
} = t;
|
|
102
|
+
return {
|
|
103
|
+
width: o,
|
|
104
|
+
height: i,
|
|
105
|
+
top: n,
|
|
106
|
+
left: e,
|
|
107
|
+
right: e + o,
|
|
108
|
+
bottom: n + i,
|
|
109
|
+
x: e,
|
|
110
|
+
y: n
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function It(t, e, n) {
|
|
114
|
+
let {
|
|
115
|
+
reference: o,
|
|
116
|
+
floating: i
|
|
117
|
+
} = t;
|
|
118
|
+
const s = F(e), r = bt(e), l = yt(r), c = z(e), p = s === "y", f = o.x + o.width / 2 - i.width / 2, a = o.y + o.height / 2 - i.height / 2, d = o[l] / 2 - i[l] / 2;
|
|
119
|
+
let u;
|
|
120
|
+
switch (c) {
|
|
121
|
+
case "top":
|
|
122
|
+
u = {
|
|
123
|
+
x: f,
|
|
124
|
+
y: o.y - i.height
|
|
125
|
+
};
|
|
126
|
+
break;
|
|
127
|
+
case "bottom":
|
|
128
|
+
u = {
|
|
129
|
+
x: f,
|
|
130
|
+
y: o.y + o.height
|
|
131
|
+
};
|
|
132
|
+
break;
|
|
133
|
+
case "right":
|
|
134
|
+
u = {
|
|
135
|
+
x: o.x + o.width,
|
|
136
|
+
y: a
|
|
137
|
+
};
|
|
138
|
+
break;
|
|
139
|
+
case "left":
|
|
140
|
+
u = {
|
|
141
|
+
x: o.x - i.width,
|
|
142
|
+
y: a
|
|
143
|
+
};
|
|
144
|
+
break;
|
|
145
|
+
default:
|
|
146
|
+
u = {
|
|
147
|
+
x: o.x,
|
|
148
|
+
y: o.y
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
switch (N(e)) {
|
|
152
|
+
case "start":
|
|
153
|
+
u[r] -= d * (n && p ? -1 : 1);
|
|
154
|
+
break;
|
|
155
|
+
case "end":
|
|
156
|
+
u[r] += d * (n && p ? -1 : 1);
|
|
157
|
+
break;
|
|
158
|
+
}
|
|
159
|
+
return u;
|
|
160
|
+
}
|
|
161
|
+
async function Be(t, e) {
|
|
162
|
+
var n;
|
|
163
|
+
e === void 0 && (e = {});
|
|
164
|
+
const {
|
|
165
|
+
x: o,
|
|
166
|
+
y: i,
|
|
167
|
+
platform: s,
|
|
168
|
+
rects: r,
|
|
169
|
+
elements: l,
|
|
170
|
+
strategy: c
|
|
171
|
+
} = t, {
|
|
172
|
+
boundary: p = "clippingAncestors",
|
|
173
|
+
rootBoundary: f = "viewport",
|
|
174
|
+
elementContext: a = "floating",
|
|
175
|
+
altBoundary: d = !1,
|
|
176
|
+
padding: u = 0
|
|
177
|
+
} = j(e, t), h = xt(u), m = l[d ? a === "floating" ? "reference" : "floating" : a], v = Q(await s.getClippingRect({
|
|
178
|
+
element: (n = await (s.isElement == null ? void 0 : s.isElement(m))) == null || n ? m : m.contextElement || await (s.getDocumentElement == null ? void 0 : s.getDocumentElement(l.floating)),
|
|
179
|
+
boundary: p,
|
|
180
|
+
rootBoundary: f,
|
|
181
|
+
strategy: c
|
|
182
|
+
})), y = a === "floating" ? {
|
|
183
|
+
x: o,
|
|
184
|
+
y: i,
|
|
185
|
+
width: r.floating.width,
|
|
186
|
+
height: r.floating.height
|
|
187
|
+
} : r.reference, w = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(l.floating)), b = await (s.isElement == null ? void 0 : s.isElement(w)) ? await (s.getScale == null ? void 0 : s.getScale(w)) || {
|
|
188
|
+
x: 1,
|
|
189
|
+
y: 1
|
|
190
|
+
} : {
|
|
191
|
+
x: 1,
|
|
192
|
+
y: 1
|
|
193
|
+
}, S = Q(s.convertOffsetParentRelativeRectToViewportRelativeRect ? await s.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
194
|
+
elements: l,
|
|
195
|
+
rect: y,
|
|
196
|
+
offsetParent: w,
|
|
197
|
+
strategy: c
|
|
198
|
+
}) : y);
|
|
199
|
+
return {
|
|
200
|
+
top: (v.top - S.top + h.top) / b.y,
|
|
201
|
+
bottom: (S.bottom - v.bottom + h.bottom) / b.y,
|
|
202
|
+
left: (v.left - S.left + h.left) / b.x,
|
|
203
|
+
right: (S.right - v.right + h.right) / b.x
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
const ze = 50, Ve = async (t, e, n) => {
|
|
207
|
+
const {
|
|
208
|
+
placement: o = "bottom",
|
|
209
|
+
strategy: i = "absolute",
|
|
210
|
+
middleware: s = [],
|
|
211
|
+
platform: r
|
|
212
|
+
} = n, l = r.detectOverflow ? r : {
|
|
213
|
+
...r,
|
|
214
|
+
detectOverflow: Be
|
|
215
|
+
}, c = await (r.isRTL == null ? void 0 : r.isRTL(e));
|
|
216
|
+
let p = await r.getElementRects({
|
|
217
|
+
reference: t,
|
|
218
|
+
floating: e,
|
|
219
|
+
strategy: i
|
|
220
|
+
}), {
|
|
221
|
+
x: f,
|
|
222
|
+
y: a
|
|
223
|
+
} = It(p, o, c), d = o, u = 0;
|
|
224
|
+
const h = {};
|
|
225
|
+
for (let g = 0; g < s.length; g++) {
|
|
226
|
+
const m = s[g];
|
|
227
|
+
if (!m)
|
|
228
|
+
continue;
|
|
229
|
+
const {
|
|
230
|
+
name: v,
|
|
231
|
+
fn: y
|
|
232
|
+
} = m, {
|
|
233
|
+
x: w,
|
|
234
|
+
y: b,
|
|
235
|
+
data: S,
|
|
236
|
+
reset: O
|
|
237
|
+
} = await y({
|
|
238
|
+
x: f,
|
|
239
|
+
y: a,
|
|
240
|
+
initialPlacement: o,
|
|
241
|
+
placement: d,
|
|
242
|
+
strategy: i,
|
|
243
|
+
middlewareData: h,
|
|
244
|
+
rects: p,
|
|
245
|
+
platform: l,
|
|
246
|
+
elements: {
|
|
247
|
+
reference: t,
|
|
248
|
+
floating: e
|
|
24
249
|
}
|
|
25
|
-
)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
250
|
+
});
|
|
251
|
+
f = w ?? f, a = b ?? a, h[v] = {
|
|
252
|
+
...h[v],
|
|
253
|
+
...S
|
|
254
|
+
}, O && u < ze && (u++, typeof O == "object" && (O.placement && (d = O.placement), O.rects && (p = O.rects === !0 ? await r.getElementRects({
|
|
255
|
+
reference: t,
|
|
256
|
+
floating: e,
|
|
257
|
+
strategy: i
|
|
258
|
+
}) : O.rects), {
|
|
259
|
+
x: f,
|
|
260
|
+
y: a
|
|
261
|
+
} = It(p, d, c)), g = -1);
|
|
262
|
+
}
|
|
263
|
+
return {
|
|
264
|
+
x: f,
|
|
265
|
+
y: a,
|
|
266
|
+
placement: d,
|
|
267
|
+
strategy: i,
|
|
268
|
+
middlewareData: h
|
|
269
|
+
};
|
|
270
|
+
}, Ne = (t) => ({
|
|
271
|
+
name: "arrow",
|
|
272
|
+
options: t,
|
|
273
|
+
async fn(e) {
|
|
274
|
+
const {
|
|
275
|
+
x: n,
|
|
276
|
+
y: o,
|
|
277
|
+
placement: i,
|
|
278
|
+
rects: s,
|
|
279
|
+
platform: r,
|
|
280
|
+
elements: l,
|
|
281
|
+
middlewareData: c
|
|
282
|
+
} = e, {
|
|
283
|
+
element: p,
|
|
284
|
+
padding: f = 0
|
|
285
|
+
} = j(t, e) || {};
|
|
286
|
+
if (p == null)
|
|
287
|
+
return {};
|
|
288
|
+
const a = xt(f), d = {
|
|
289
|
+
x: n,
|
|
290
|
+
y: o
|
|
291
|
+
}, u = bt(i), h = yt(u), g = await r.getDimensions(p), m = u === "y", v = m ? "top" : "left", y = m ? "bottom" : "right", w = m ? "clientHeight" : "clientWidth", b = s.reference[h] + s.reference[u] - d[u] - s.floating[h], S = d[u] - s.reference[u], O = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(p));
|
|
292
|
+
let R = O ? O[w] : 0;
|
|
293
|
+
(!R || !await (r.isElement == null ? void 0 : r.isElement(O))) && (R = l.floating[w] || s.floating[h]);
|
|
294
|
+
const U = b / 2 - S / 2, I = R / 2 - g[h] / 2 - 1, x = K(a[v], I), C = K(a[y], I), L = x, H = R - g[h] - C, T = R / 2 - g[h] / 2 + U, V = gt(L, T, H), B = !c.arrow && N(i) != null && T !== V && s.reference[h] / 2 - (T < L ? x : C) - g[h] / 2 < 0, A = B ? T < L ? T - L : T - H : 0;
|
|
295
|
+
return {
|
|
296
|
+
[u]: d[u] + A,
|
|
297
|
+
data: {
|
|
298
|
+
[u]: V,
|
|
299
|
+
centerOffset: T - V - A,
|
|
300
|
+
...B && {
|
|
301
|
+
alignmentOffset: A
|
|
302
|
+
}
|
|
303
|
+
},
|
|
304
|
+
reset: B
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
function _e(t, e, n) {
|
|
309
|
+
return (t ? [...n.filter((i) => N(i) === t), ...n.filter((i) => N(i) !== t)] : n.filter((i) => z(i) === i)).filter((i) => t ? N(i) === t || (e ? rt(i) !== i : !1) : !0);
|
|
310
|
+
}
|
|
311
|
+
const We = function(t) {
|
|
312
|
+
return t === void 0 && (t = {}), {
|
|
313
|
+
name: "autoPlacement",
|
|
314
|
+
options: t,
|
|
315
|
+
async fn(e) {
|
|
316
|
+
var n, o, i;
|
|
317
|
+
const {
|
|
318
|
+
rects: s,
|
|
319
|
+
middlewareData: r,
|
|
320
|
+
placement: l,
|
|
321
|
+
platform: c,
|
|
322
|
+
elements: p
|
|
323
|
+
} = e, {
|
|
324
|
+
crossAxis: f = !1,
|
|
325
|
+
alignment: a,
|
|
326
|
+
allowedPlacements: d = Tt,
|
|
327
|
+
autoAlignment: u = !0,
|
|
328
|
+
...h
|
|
329
|
+
} = j(t, e), g = a !== void 0 || d === Tt ? _e(a || null, u, d) : d, m = await c.detectOverflow(e, h), v = ((n = r.autoPlacement) == null ? void 0 : n.index) || 0, y = g[v];
|
|
330
|
+
if (y == null)
|
|
331
|
+
return {};
|
|
332
|
+
const w = Kt(y, s, await (c.isRTL == null ? void 0 : c.isRTL(p.floating)));
|
|
333
|
+
if (l !== y)
|
|
334
|
+
return {
|
|
335
|
+
reset: {
|
|
336
|
+
placement: g[0]
|
|
45
337
|
}
|
|
46
|
-
|
|
338
|
+
};
|
|
339
|
+
const b = [m[z(y)], m[w[0]], m[w[1]]], S = [...((o = r.autoPlacement) == null ? void 0 : o.overflows) || [], {
|
|
340
|
+
placement: y,
|
|
341
|
+
overflows: b
|
|
342
|
+
}], O = g[v + 1];
|
|
343
|
+
if (O)
|
|
344
|
+
return {
|
|
345
|
+
data: {
|
|
346
|
+
index: v + 1,
|
|
347
|
+
overflows: S
|
|
348
|
+
},
|
|
349
|
+
reset: {
|
|
350
|
+
placement: O
|
|
351
|
+
}
|
|
352
|
+
};
|
|
353
|
+
const R = S.map((x) => {
|
|
354
|
+
const C = N(x.placement);
|
|
355
|
+
return [x.placement, C && f ? (
|
|
356
|
+
// Check along the mainAxis and main crossAxis side.
|
|
357
|
+
x.overflows.slice(0, 2).reduce((L, H) => L + H, 0)
|
|
358
|
+
) : (
|
|
359
|
+
// Check only the mainAxis.
|
|
360
|
+
x.overflows[0]
|
|
361
|
+
), x.overflows];
|
|
362
|
+
}).sort((x, C) => x[1] - C[1]), I = ((i = R.filter((x) => x[2].slice(
|
|
363
|
+
0,
|
|
364
|
+
// Aligned placements should not check their opposite crossAxis
|
|
365
|
+
// side.
|
|
366
|
+
N(x[0]) ? 2 : 3
|
|
367
|
+
).every((C) => C <= 0))[0]) == null ? void 0 : i[0]) || R[0][0];
|
|
368
|
+
return I !== l ? {
|
|
369
|
+
data: {
|
|
370
|
+
index: v + 1,
|
|
371
|
+
overflows: S
|
|
372
|
+
},
|
|
373
|
+
reset: {
|
|
374
|
+
placement: I
|
|
375
|
+
}
|
|
376
|
+
} : {};
|
|
377
|
+
}
|
|
378
|
+
};
|
|
379
|
+
}, ke = function(t) {
|
|
380
|
+
return t === void 0 && (t = {}), {
|
|
381
|
+
name: "flip",
|
|
382
|
+
options: t,
|
|
383
|
+
async fn(e) {
|
|
384
|
+
var n, o;
|
|
385
|
+
const {
|
|
386
|
+
placement: i,
|
|
387
|
+
middlewareData: s,
|
|
388
|
+
rects: r,
|
|
389
|
+
initialPlacement: l,
|
|
390
|
+
platform: c,
|
|
391
|
+
elements: p
|
|
392
|
+
} = e, {
|
|
393
|
+
mainAxis: f = !0,
|
|
394
|
+
crossAxis: a = !0,
|
|
395
|
+
fallbackPlacements: d,
|
|
396
|
+
fallbackStrategy: u = "bestFit",
|
|
397
|
+
fallbackAxisSideDirection: h = "none",
|
|
398
|
+
flipAlignment: g = !0,
|
|
399
|
+
...m
|
|
400
|
+
} = j(t, e);
|
|
401
|
+
if ((n = s.arrow) != null && n.alignmentOffset)
|
|
402
|
+
return {};
|
|
403
|
+
const v = z(i), y = F(l), w = z(l) === l, b = await (c.isRTL == null ? void 0 : c.isRTL(p.floating)), S = d || (w || !g ? [lt(l)] : De(l)), O = h !== "none";
|
|
404
|
+
!d && O && S.push(...Pe(l, g, h, b));
|
|
405
|
+
const R = [l, ...S], U = await c.detectOverflow(e, m), I = [];
|
|
406
|
+
let x = ((o = s.flip) == null ? void 0 : o.overflows) || [];
|
|
407
|
+
if (f && I.push(U[v]), a) {
|
|
408
|
+
const T = Kt(i, r, b);
|
|
409
|
+
I.push(U[T[0]], U[T[1]]);
|
|
47
410
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
411
|
+
if (x = [...x, {
|
|
412
|
+
placement: i,
|
|
413
|
+
overflows: I
|
|
414
|
+
}], !I.every((T) => T <= 0)) {
|
|
415
|
+
var C, L;
|
|
416
|
+
const T = (((C = s.flip) == null ? void 0 : C.index) || 0) + 1, V = R[T];
|
|
417
|
+
if (V && (!(a === "alignment" ? y !== F(V) : !1) || // We leave the current main axis only if every placement on that axis
|
|
418
|
+
// overflows the main axis.
|
|
419
|
+
x.every((M) => F(M.placement) === y ? M.overflows[0] > 0 : !0)))
|
|
420
|
+
return {
|
|
421
|
+
data: {
|
|
422
|
+
index: T,
|
|
423
|
+
overflows: x
|
|
424
|
+
},
|
|
425
|
+
reset: {
|
|
426
|
+
placement: V
|
|
427
|
+
}
|
|
428
|
+
};
|
|
429
|
+
let B = (L = x.filter((A) => A.overflows[0] <= 0).sort((A, M) => A.overflows[1] - M.overflows[1])[0]) == null ? void 0 : L.placement;
|
|
430
|
+
if (!B)
|
|
431
|
+
switch (u) {
|
|
432
|
+
case "bestFit": {
|
|
433
|
+
var H;
|
|
434
|
+
const A = (H = x.filter((M) => {
|
|
435
|
+
if (O) {
|
|
436
|
+
const q = F(M.placement);
|
|
437
|
+
return q === y || // Create a bias to the `y` side axis due to horizontal
|
|
438
|
+
// reading directions favoring greater width.
|
|
439
|
+
q === "y";
|
|
440
|
+
}
|
|
441
|
+
return !0;
|
|
442
|
+
}).map((M) => [M.placement, M.overflows.filter((q) => q > 0).reduce((q, we) => q + we, 0)]).sort((M, q) => M[1] - q[1])[0]) == null ? void 0 : H[0];
|
|
443
|
+
A && (B = A);
|
|
444
|
+
break;
|
|
445
|
+
}
|
|
446
|
+
case "initialPlacement":
|
|
447
|
+
B = l;
|
|
448
|
+
break;
|
|
68
449
|
}
|
|
69
|
-
)
|
|
450
|
+
if (i !== B)
|
|
451
|
+
return {
|
|
452
|
+
reset: {
|
|
453
|
+
placement: B
|
|
454
|
+
}
|
|
455
|
+
};
|
|
70
456
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
457
|
+
return {};
|
|
458
|
+
}
|
|
459
|
+
};
|
|
460
|
+
};
|
|
461
|
+
function Lt(t, e) {
|
|
462
|
+
return {
|
|
463
|
+
top: t.top - e.height,
|
|
464
|
+
right: t.right - e.width,
|
|
465
|
+
bottom: t.bottom - e.height,
|
|
466
|
+
left: t.left - e.width
|
|
467
|
+
};
|
|
468
|
+
}
|
|
469
|
+
function Dt(t) {
|
|
470
|
+
return Ft.some((e) => t[e] >= 0);
|
|
471
|
+
}
|
|
472
|
+
const Fe = function(t) {
|
|
473
|
+
return t === void 0 && (t = {}), {
|
|
474
|
+
name: "hide",
|
|
475
|
+
options: t,
|
|
476
|
+
async fn(e) {
|
|
477
|
+
const {
|
|
478
|
+
rects: n,
|
|
479
|
+
platform: o
|
|
480
|
+
} = e, {
|
|
481
|
+
strategy: i = "referenceHidden",
|
|
482
|
+
...s
|
|
483
|
+
} = j(t, e);
|
|
484
|
+
switch (i) {
|
|
485
|
+
case "referenceHidden": {
|
|
486
|
+
const r = await o.detectOverflow(e, {
|
|
487
|
+
...s,
|
|
488
|
+
elementContext: "reference"
|
|
489
|
+
}), l = Lt(r, n.reference);
|
|
490
|
+
return {
|
|
491
|
+
data: {
|
|
492
|
+
referenceHiddenOffsets: l,
|
|
493
|
+
referenceHidden: Dt(l)
|
|
494
|
+
}
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
case "escaped": {
|
|
498
|
+
const r = await o.detectOverflow(e, {
|
|
499
|
+
...s,
|
|
500
|
+
altBoundary: !0
|
|
501
|
+
}), l = Lt(r, n.floating);
|
|
502
|
+
return {
|
|
503
|
+
data: {
|
|
504
|
+
escapedOffsets: l,
|
|
505
|
+
escaped: Dt(l)
|
|
506
|
+
}
|
|
507
|
+
};
|
|
508
|
+
}
|
|
509
|
+
default:
|
|
510
|
+
return {};
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
};
|
|
514
|
+
};
|
|
515
|
+
function jt(t) {
|
|
516
|
+
const e = K(...t.map((s) => s.left)), n = K(...t.map((s) => s.top)), o = D(...t.map((s) => s.right)), i = D(...t.map((s) => s.bottom));
|
|
517
|
+
return {
|
|
518
|
+
x: e,
|
|
519
|
+
y: n,
|
|
520
|
+
width: o - e,
|
|
521
|
+
height: i - n
|
|
522
|
+
};
|
|
523
|
+
}
|
|
524
|
+
function $e(t) {
|
|
525
|
+
const e = t.slice().sort((i, s) => i.y - s.y), n = [];
|
|
526
|
+
let o = null;
|
|
527
|
+
for (let i = 0; i < e.length; i++) {
|
|
528
|
+
const s = e[i];
|
|
529
|
+
!o || s.y - o.y > o.height / 2 ? n.push([s]) : n[n.length - 1].push(s), o = s;
|
|
530
|
+
}
|
|
531
|
+
return n.map((i) => Q(jt(i)));
|
|
532
|
+
}
|
|
533
|
+
const Ke = function(t) {
|
|
534
|
+
return t === void 0 && (t = {}), {
|
|
535
|
+
name: "inline",
|
|
536
|
+
options: t,
|
|
537
|
+
async fn(e) {
|
|
538
|
+
const {
|
|
539
|
+
placement: n,
|
|
540
|
+
elements: o,
|
|
541
|
+
rects: i,
|
|
542
|
+
platform: s,
|
|
543
|
+
strategy: r
|
|
544
|
+
} = e, {
|
|
545
|
+
padding: l = 2,
|
|
546
|
+
x: c,
|
|
547
|
+
y: p
|
|
548
|
+
} = j(t, e), f = Array.from(await (s.getClientRects == null ? void 0 : s.getClientRects(o.reference)) || []), a = $e(f), d = Q(jt(f)), u = xt(l);
|
|
549
|
+
function h() {
|
|
550
|
+
if (a.length === 2 && a[0].left > a[1].right && c != null && p != null)
|
|
551
|
+
return a.find((m) => c > m.left - u.left && c < m.right + u.right && p > m.top - u.top && p < m.bottom + u.bottom) || d;
|
|
552
|
+
if (a.length >= 2) {
|
|
553
|
+
if (F(n) === "y") {
|
|
554
|
+
const x = a[0], C = a[a.length - 1], L = z(n) === "top", H = x.top, T = C.bottom, V = L ? x.left : C.left, B = L ? x.right : C.right, A = B - V, M = T - H;
|
|
555
|
+
return {
|
|
556
|
+
top: H,
|
|
557
|
+
bottom: T,
|
|
558
|
+
left: V,
|
|
559
|
+
right: B,
|
|
560
|
+
width: A,
|
|
561
|
+
height: M,
|
|
562
|
+
x: V,
|
|
563
|
+
y: H
|
|
564
|
+
};
|
|
91
565
|
}
|
|
92
|
-
|
|
566
|
+
const m = z(n) === "left", v = D(...a.map((x) => x.right)), y = K(...a.map((x) => x.left)), w = a.filter((x) => m ? x.left === y : x.right === v), b = w[0].top, S = w[w.length - 1].bottom, O = y, R = v, U = R - O, I = S - b;
|
|
567
|
+
return {
|
|
568
|
+
top: b,
|
|
569
|
+
bottom: S,
|
|
570
|
+
left: O,
|
|
571
|
+
right: R,
|
|
572
|
+
width: U,
|
|
573
|
+
height: I,
|
|
574
|
+
x: O,
|
|
575
|
+
y: b
|
|
576
|
+
};
|
|
577
|
+
}
|
|
578
|
+
return d;
|
|
93
579
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
580
|
+
const g = await s.getElementRects({
|
|
581
|
+
reference: {
|
|
582
|
+
getBoundingClientRect: h
|
|
583
|
+
},
|
|
584
|
+
floating: o.floating,
|
|
585
|
+
strategy: r
|
|
586
|
+
});
|
|
587
|
+
return i.reference.x !== g.reference.x || i.reference.y !== g.reference.y || i.reference.width !== g.reference.width || i.reference.height !== g.reference.height ? {
|
|
588
|
+
reset: {
|
|
589
|
+
rects: g
|
|
590
|
+
}
|
|
591
|
+
} : {};
|
|
592
|
+
}
|
|
593
|
+
};
|
|
594
|
+
}, je = /* @__PURE__ */ new Set(["left", "top"]);
|
|
595
|
+
async function Ye(t, e) {
|
|
596
|
+
const {
|
|
597
|
+
placement: n,
|
|
598
|
+
platform: o,
|
|
599
|
+
elements: i
|
|
600
|
+
} = t, s = await (o.isRTL == null ? void 0 : o.isRTL(i.floating)), r = z(n), l = N(n), c = F(n) === "y", p = je.has(r) ? -1 : 1, f = s && c ? -1 : 1, a = j(e, t);
|
|
601
|
+
let {
|
|
602
|
+
mainAxis: d,
|
|
603
|
+
crossAxis: u,
|
|
604
|
+
alignmentAxis: h
|
|
605
|
+
} = typeof a == "number" ? {
|
|
606
|
+
mainAxis: a,
|
|
607
|
+
crossAxis: 0,
|
|
608
|
+
alignmentAxis: null
|
|
609
|
+
} : {
|
|
610
|
+
mainAxis: a.mainAxis || 0,
|
|
611
|
+
crossAxis: a.crossAxis || 0,
|
|
612
|
+
alignmentAxis: a.alignmentAxis
|
|
613
|
+
};
|
|
614
|
+
return l && typeof h == "number" && (u = l === "end" ? h * -1 : h), c ? {
|
|
615
|
+
x: u * f,
|
|
616
|
+
y: d * p
|
|
617
|
+
} : {
|
|
618
|
+
x: d * p,
|
|
619
|
+
y: u * f
|
|
620
|
+
};
|
|
621
|
+
}
|
|
622
|
+
const Xe = function(t) {
|
|
623
|
+
return t === void 0 && (t = 0), {
|
|
624
|
+
name: "offset",
|
|
625
|
+
options: t,
|
|
626
|
+
async fn(e) {
|
|
627
|
+
var n, o;
|
|
628
|
+
const {
|
|
629
|
+
x: i,
|
|
630
|
+
y: s,
|
|
631
|
+
placement: r,
|
|
632
|
+
middlewareData: l
|
|
633
|
+
} = e, c = await Ye(e, t);
|
|
634
|
+
return r === ((n = l.offset) == null ? void 0 : n.placement) && (o = l.arrow) != null && o.alignmentOffset ? {} : {
|
|
635
|
+
x: i + c.x,
|
|
636
|
+
y: s + c.y,
|
|
637
|
+
data: {
|
|
638
|
+
...c,
|
|
639
|
+
placement: r
|
|
640
|
+
}
|
|
641
|
+
};
|
|
642
|
+
}
|
|
643
|
+
};
|
|
644
|
+
}, qe = function(t) {
|
|
645
|
+
return t === void 0 && (t = {}), {
|
|
646
|
+
name: "shift",
|
|
647
|
+
options: t,
|
|
648
|
+
async fn(e) {
|
|
649
|
+
const {
|
|
650
|
+
x: n,
|
|
651
|
+
y: o,
|
|
652
|
+
placement: i,
|
|
653
|
+
platform: s
|
|
654
|
+
} = e, {
|
|
655
|
+
mainAxis: r = !0,
|
|
656
|
+
crossAxis: l = !1,
|
|
657
|
+
limiter: c = {
|
|
658
|
+
fn: (v) => {
|
|
659
|
+
let {
|
|
660
|
+
x: y,
|
|
661
|
+
y: w
|
|
662
|
+
} = v;
|
|
663
|
+
return {
|
|
664
|
+
x: y,
|
|
665
|
+
y: w
|
|
666
|
+
};
|
|
114
667
|
}
|
|
115
|
-
|
|
668
|
+
},
|
|
669
|
+
...p
|
|
670
|
+
} = j(t, e), f = {
|
|
671
|
+
x: n,
|
|
672
|
+
y: o
|
|
673
|
+
}, a = await s.detectOverflow(e, p), d = F(z(i)), u = $t(d);
|
|
674
|
+
let h = f[u], g = f[d];
|
|
675
|
+
if (r) {
|
|
676
|
+
const v = u === "y" ? "top" : "left", y = u === "y" ? "bottom" : "right", w = h + a[v], b = h - a[y];
|
|
677
|
+
h = gt(w, h, b);
|
|
116
678
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
d:
|
|
134
|
-
strokeWidth: "1.5",
|
|
135
|
-
strokeLinecap: "round",
|
|
136
|
-
strokeLinejoin: "round"
|
|
679
|
+
if (l) {
|
|
680
|
+
const v = d === "y" ? "top" : "left", y = d === "y" ? "bottom" : "right", w = g + a[v], b = g - a[y];
|
|
681
|
+
g = gt(w, g, b);
|
|
682
|
+
}
|
|
683
|
+
const m = c.fn({
|
|
684
|
+
...e,
|
|
685
|
+
[u]: h,
|
|
686
|
+
[d]: g
|
|
687
|
+
});
|
|
688
|
+
return {
|
|
689
|
+
...m,
|
|
690
|
+
data: {
|
|
691
|
+
x: m.x - n,
|
|
692
|
+
y: m.y - o,
|
|
693
|
+
enabled: {
|
|
694
|
+
[u]: r,
|
|
695
|
+
[d]: l
|
|
137
696
|
}
|
|
138
|
-
|
|
697
|
+
}
|
|
698
|
+
};
|
|
699
|
+
}
|
|
700
|
+
};
|
|
701
|
+
}, Ge = function(t) {
|
|
702
|
+
return t === void 0 && (t = {}), {
|
|
703
|
+
name: "size",
|
|
704
|
+
options: t,
|
|
705
|
+
async fn(e) {
|
|
706
|
+
var n, o;
|
|
707
|
+
const {
|
|
708
|
+
placement: i,
|
|
709
|
+
rects: s,
|
|
710
|
+
platform: r,
|
|
711
|
+
elements: l
|
|
712
|
+
} = e, {
|
|
713
|
+
apply: c = () => {
|
|
714
|
+
},
|
|
715
|
+
...p
|
|
716
|
+
} = j(t, e), f = await r.detectOverflow(e, p), a = z(i), d = N(i), u = F(i) === "y", {
|
|
717
|
+
width: h,
|
|
718
|
+
height: g
|
|
719
|
+
} = s.floating;
|
|
720
|
+
let m, v;
|
|
721
|
+
a === "top" || a === "bottom" ? (m = a, v = d === (await (r.isRTL == null ? void 0 : r.isRTL(l.floating)) ? "start" : "end") ? "left" : "right") : (v = a, m = d === "end" ? "top" : "bottom");
|
|
722
|
+
const y = g - f.top - f.bottom, w = h - f.left - f.right, b = K(g - f[m], y), S = K(h - f[v], w), O = !e.middlewareData.shift;
|
|
723
|
+
let R = b, U = S;
|
|
724
|
+
if ((n = e.middlewareData.shift) != null && n.enabled.x && (U = w), (o = e.middlewareData.shift) != null && o.enabled.y && (R = y), O && !d) {
|
|
725
|
+
const x = D(f.left, 0), C = D(f.right, 0), L = D(f.top, 0), H = D(f.bottom, 0);
|
|
726
|
+
u ? U = h - 2 * (x !== 0 || C !== 0 ? x + C : D(f.left, f.right)) : R = g - 2 * (L !== 0 || H !== 0 ? L + H : D(f.top, f.bottom));
|
|
727
|
+
}
|
|
728
|
+
await c({
|
|
729
|
+
...e,
|
|
730
|
+
availableWidth: U,
|
|
731
|
+
availableHeight: R
|
|
732
|
+
});
|
|
733
|
+
const I = await r.getDimensions(l.floating);
|
|
734
|
+
return h !== I.width || g !== I.height ? {
|
|
735
|
+
reset: {
|
|
736
|
+
rects: !0
|
|
737
|
+
}
|
|
738
|
+
} : {};
|
|
739
|
+
}
|
|
740
|
+
};
|
|
741
|
+
};
|
|
742
|
+
function at() {
|
|
743
|
+
return typeof window < "u";
|
|
744
|
+
}
|
|
745
|
+
function et(t) {
|
|
746
|
+
return Yt(t) ? (t.nodeName || "").toLowerCase() : "#document";
|
|
747
|
+
}
|
|
748
|
+
function P(t) {
|
|
749
|
+
var e;
|
|
750
|
+
return (t == null || (e = t.ownerDocument) == null ? void 0 : e.defaultView) || window;
|
|
751
|
+
}
|
|
752
|
+
function Y(t) {
|
|
753
|
+
var e;
|
|
754
|
+
return (e = (Yt(t) ? t.ownerDocument : t.document) || window.document) == null ? void 0 : e.documentElement;
|
|
755
|
+
}
|
|
756
|
+
function Yt(t) {
|
|
757
|
+
return at() ? t instanceof Node || t instanceof P(t).Node : !1;
|
|
758
|
+
}
|
|
759
|
+
function _(t) {
|
|
760
|
+
return at() ? t instanceof Element || t instanceof P(t).Element : !1;
|
|
761
|
+
}
|
|
762
|
+
function X(t) {
|
|
763
|
+
return at() ? t instanceof HTMLElement || t instanceof P(t).HTMLElement : !1;
|
|
764
|
+
}
|
|
765
|
+
function Ht(t) {
|
|
766
|
+
return !at() || typeof ShadowRoot > "u" ? !1 : t instanceof ShadowRoot || t instanceof P(t).ShadowRoot;
|
|
767
|
+
}
|
|
768
|
+
function ot(t) {
|
|
769
|
+
const {
|
|
770
|
+
overflow: e,
|
|
771
|
+
overflowX: n,
|
|
772
|
+
overflowY: o,
|
|
773
|
+
display: i
|
|
774
|
+
} = W(t);
|
|
775
|
+
return /auto|scroll|overlay|hidden|clip/.test(e + o + n) && i !== "inline" && i !== "contents";
|
|
776
|
+
}
|
|
777
|
+
function Ze(t) {
|
|
778
|
+
return /^(table|td|th)$/.test(et(t));
|
|
779
|
+
}
|
|
780
|
+
function ct(t) {
|
|
781
|
+
try {
|
|
782
|
+
if (t.matches(":popover-open"))
|
|
783
|
+
return !0;
|
|
784
|
+
} catch {
|
|
785
|
+
}
|
|
786
|
+
try {
|
|
787
|
+
return t.matches(":modal");
|
|
788
|
+
} catch {
|
|
789
|
+
return !1;
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
const Je = /transform|translate|scale|rotate|perspective|filter/, Qe = /paint|layout|strict|content/, Z = (t) => !!t && t !== "none";
|
|
793
|
+
let dt;
|
|
794
|
+
function Ot(t) {
|
|
795
|
+
const e = _(t) ? W(t) : t;
|
|
796
|
+
return Z(e.transform) || Z(e.translate) || Z(e.scale) || Z(e.rotate) || Z(e.perspective) || !St() && (Z(e.backdropFilter) || Z(e.filter)) || Je.test(e.willChange || "") || Qe.test(e.contain || "");
|
|
797
|
+
}
|
|
798
|
+
function ti(t) {
|
|
799
|
+
let e = G(t);
|
|
800
|
+
for (; X(e) && !tt(e); ) {
|
|
801
|
+
if (Ot(e))
|
|
802
|
+
return e;
|
|
803
|
+
if (ct(e))
|
|
804
|
+
return null;
|
|
805
|
+
e = G(e);
|
|
806
|
+
}
|
|
807
|
+
return null;
|
|
808
|
+
}
|
|
809
|
+
function St() {
|
|
810
|
+
return dt == null && (dt = typeof CSS < "u" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none")), dt;
|
|
811
|
+
}
|
|
812
|
+
function tt(t) {
|
|
813
|
+
return /^(html|body|#document)$/.test(et(t));
|
|
814
|
+
}
|
|
815
|
+
function W(t) {
|
|
816
|
+
return P(t).getComputedStyle(t);
|
|
817
|
+
}
|
|
818
|
+
function ut(t) {
|
|
819
|
+
return _(t) ? {
|
|
820
|
+
scrollLeft: t.scrollLeft,
|
|
821
|
+
scrollTop: t.scrollTop
|
|
822
|
+
} : {
|
|
823
|
+
scrollLeft: t.scrollX,
|
|
824
|
+
scrollTop: t.scrollY
|
|
825
|
+
};
|
|
826
|
+
}
|
|
827
|
+
function G(t) {
|
|
828
|
+
if (et(t) === "html")
|
|
829
|
+
return t;
|
|
830
|
+
const e = (
|
|
831
|
+
// Step into the shadow DOM of the parent of a slotted node.
|
|
832
|
+
t.assignedSlot || // DOM Element detected.
|
|
833
|
+
t.parentNode || // ShadowRoot detected.
|
|
834
|
+
Ht(t) && t.host || // Fallback.
|
|
835
|
+
Y(t)
|
|
836
|
+
);
|
|
837
|
+
return Ht(e) ? e.host : e;
|
|
838
|
+
}
|
|
839
|
+
function Xt(t) {
|
|
840
|
+
const e = G(t);
|
|
841
|
+
return tt(e) ? t.ownerDocument ? t.ownerDocument.body : t.body : X(e) && ot(e) ? e : Xt(e);
|
|
842
|
+
}
|
|
843
|
+
function qt(t, e, n) {
|
|
844
|
+
var o;
|
|
845
|
+
e === void 0 && (e = []);
|
|
846
|
+
const i = Xt(t), s = i === ((o = t.ownerDocument) == null ? void 0 : o.body), r = P(i);
|
|
847
|
+
return s ? (mt(r), e.concat(r, r.visualViewport || [], ot(i) ? i : [], [])) : e.concat(i, qt(i, []));
|
|
848
|
+
}
|
|
849
|
+
function mt(t) {
|
|
850
|
+
return t.parent && Object.getPrototypeOf(t.parent) ? t.frameElement : null;
|
|
851
|
+
}
|
|
852
|
+
function Gt(t) {
|
|
853
|
+
const e = W(t);
|
|
854
|
+
let n = parseFloat(e.width) || 0, o = parseFloat(e.height) || 0;
|
|
855
|
+
const i = X(t), s = i ? t.offsetWidth : n, r = i ? t.offsetHeight : o, l = st(n) !== s || st(o) !== r;
|
|
856
|
+
return l && (n = s, o = r), {
|
|
857
|
+
width: n,
|
|
858
|
+
height: o,
|
|
859
|
+
$: l
|
|
860
|
+
};
|
|
861
|
+
}
|
|
862
|
+
function Zt(t) {
|
|
863
|
+
return _(t) ? t : t.contextElement;
|
|
864
|
+
}
|
|
865
|
+
function J(t) {
|
|
866
|
+
const e = Zt(t);
|
|
867
|
+
if (!X(e))
|
|
868
|
+
return $(1);
|
|
869
|
+
const n = e.getBoundingClientRect(), {
|
|
870
|
+
width: o,
|
|
871
|
+
height: i,
|
|
872
|
+
$: s
|
|
873
|
+
} = Gt(e);
|
|
874
|
+
let r = (s ? st(n.width) : n.width) / o, l = (s ? st(n.height) : n.height) / i;
|
|
875
|
+
return (!r || !Number.isFinite(r)) && (r = 1), (!l || !Number.isFinite(l)) && (l = 1), {
|
|
876
|
+
x: r,
|
|
877
|
+
y: l
|
|
878
|
+
};
|
|
879
|
+
}
|
|
880
|
+
const ei = /* @__PURE__ */ $(0);
|
|
881
|
+
function Jt(t) {
|
|
882
|
+
const e = P(t);
|
|
883
|
+
return !St() || !e.visualViewport ? ei : {
|
|
884
|
+
x: e.visualViewport.offsetLeft,
|
|
885
|
+
y: e.visualViewport.offsetTop
|
|
886
|
+
};
|
|
887
|
+
}
|
|
888
|
+
function ii(t, e, n) {
|
|
889
|
+
return e === void 0 && (e = !1), !n || e && n !== P(t) ? !1 : e;
|
|
890
|
+
}
|
|
891
|
+
function nt(t, e, n, o) {
|
|
892
|
+
e === void 0 && (e = !1), n === void 0 && (n = !1);
|
|
893
|
+
const i = t.getBoundingClientRect(), s = Zt(t);
|
|
894
|
+
let r = $(1);
|
|
895
|
+
e && (o ? _(o) && (r = J(o)) : r = J(t));
|
|
896
|
+
const l = ii(s, n, o) ? Jt(s) : $(0);
|
|
897
|
+
let c = (i.left + l.x) / r.x, p = (i.top + l.y) / r.y, f = i.width / r.x, a = i.height / r.y;
|
|
898
|
+
if (s) {
|
|
899
|
+
const d = P(s), u = o && _(o) ? P(o) : o;
|
|
900
|
+
let h = d, g = mt(h);
|
|
901
|
+
for (; g && o && u !== h; ) {
|
|
902
|
+
const m = J(g), v = g.getBoundingClientRect(), y = W(g), w = v.left + (g.clientLeft + parseFloat(y.paddingLeft)) * m.x, b = v.top + (g.clientTop + parseFloat(y.paddingTop)) * m.y;
|
|
903
|
+
c *= m.x, p *= m.y, f *= m.x, a *= m.y, c += w, p += b, h = P(g), g = mt(h);
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
return Q({
|
|
907
|
+
width: f,
|
|
908
|
+
height: a,
|
|
909
|
+
x: c,
|
|
910
|
+
y: p
|
|
911
|
+
});
|
|
912
|
+
}
|
|
913
|
+
function ft(t, e) {
|
|
914
|
+
const n = ut(t).scrollLeft;
|
|
915
|
+
return e ? e.left + n : nt(Y(t)).left + n;
|
|
916
|
+
}
|
|
917
|
+
function Qt(t, e) {
|
|
918
|
+
const n = t.getBoundingClientRect(), o = n.left + e.scrollLeft - ft(t, n), i = n.top + e.scrollTop;
|
|
919
|
+
return {
|
|
920
|
+
x: o,
|
|
921
|
+
y: i
|
|
922
|
+
};
|
|
923
|
+
}
|
|
924
|
+
function ni(t) {
|
|
925
|
+
let {
|
|
926
|
+
elements: e,
|
|
927
|
+
rect: n,
|
|
928
|
+
offsetParent: o,
|
|
929
|
+
strategy: i
|
|
930
|
+
} = t;
|
|
931
|
+
const s = i === "fixed", r = Y(o), l = e ? ct(e.floating) : !1;
|
|
932
|
+
if (o === r || l && s)
|
|
933
|
+
return n;
|
|
934
|
+
let c = {
|
|
935
|
+
scrollLeft: 0,
|
|
936
|
+
scrollTop: 0
|
|
937
|
+
}, p = $(1);
|
|
938
|
+
const f = $(0), a = X(o);
|
|
939
|
+
if ((a || !a && !s) && ((et(o) !== "body" || ot(r)) && (c = ut(o)), a)) {
|
|
940
|
+
const u = nt(o);
|
|
941
|
+
p = J(o), f.x = u.x + o.clientLeft, f.y = u.y + o.clientTop;
|
|
942
|
+
}
|
|
943
|
+
const d = r && !a && !s ? Qt(r, c) : $(0);
|
|
944
|
+
return {
|
|
945
|
+
width: n.width * p.x,
|
|
946
|
+
height: n.height * p.y,
|
|
947
|
+
x: n.x * p.x - c.scrollLeft * p.x + f.x + d.x,
|
|
948
|
+
y: n.y * p.y - c.scrollTop * p.y + f.y + d.y
|
|
949
|
+
};
|
|
950
|
+
}
|
|
951
|
+
function oi(t) {
|
|
952
|
+
return Array.from(t.getClientRects());
|
|
953
|
+
}
|
|
954
|
+
function si(t) {
|
|
955
|
+
const e = Y(t), n = ut(t), o = t.ownerDocument.body, i = D(e.scrollWidth, e.clientWidth, o.scrollWidth, o.clientWidth), s = D(e.scrollHeight, e.clientHeight, o.scrollHeight, o.clientHeight);
|
|
956
|
+
let r = -n.scrollLeft + ft(t);
|
|
957
|
+
const l = -n.scrollTop;
|
|
958
|
+
return W(o).direction === "rtl" && (r += D(e.clientWidth, o.clientWidth) - i), {
|
|
959
|
+
width: i,
|
|
960
|
+
height: s,
|
|
961
|
+
x: r,
|
|
962
|
+
y: l
|
|
963
|
+
};
|
|
964
|
+
}
|
|
965
|
+
const At = 25;
|
|
966
|
+
function ri(t, e) {
|
|
967
|
+
const n = P(t), o = Y(t), i = n.visualViewport;
|
|
968
|
+
let s = o.clientWidth, r = o.clientHeight, l = 0, c = 0;
|
|
969
|
+
if (i) {
|
|
970
|
+
s = i.width, r = i.height;
|
|
971
|
+
const f = St();
|
|
972
|
+
(!f || f && e === "fixed") && (l = i.offsetLeft, c = i.offsetTop);
|
|
973
|
+
}
|
|
974
|
+
const p = ft(o);
|
|
975
|
+
if (p <= 0) {
|
|
976
|
+
const f = o.ownerDocument, a = f.body, d = getComputedStyle(a), u = f.compatMode === "CSS1Compat" && parseFloat(d.marginLeft) + parseFloat(d.marginRight) || 0, h = Math.abs(o.clientWidth - a.clientWidth - u);
|
|
977
|
+
h <= At && (s -= h);
|
|
978
|
+
} else p <= At && (s += p);
|
|
979
|
+
return {
|
|
980
|
+
width: s,
|
|
981
|
+
height: r,
|
|
982
|
+
x: l,
|
|
983
|
+
y: c
|
|
984
|
+
};
|
|
985
|
+
}
|
|
986
|
+
function li(t, e) {
|
|
987
|
+
const n = nt(t, !0, e === "fixed"), o = n.top + t.clientTop, i = n.left + t.clientLeft, s = X(t) ? J(t) : $(1), r = t.clientWidth * s.x, l = t.clientHeight * s.y, c = i * s.x, p = o * s.y;
|
|
988
|
+
return {
|
|
989
|
+
width: r,
|
|
990
|
+
height: l,
|
|
991
|
+
x: c,
|
|
992
|
+
y: p
|
|
993
|
+
};
|
|
994
|
+
}
|
|
995
|
+
function Mt(t, e, n) {
|
|
996
|
+
let o;
|
|
997
|
+
if (e === "viewport")
|
|
998
|
+
o = ri(t, n);
|
|
999
|
+
else if (e === "document")
|
|
1000
|
+
o = si(Y(t));
|
|
1001
|
+
else if (_(e))
|
|
1002
|
+
o = li(e, n);
|
|
1003
|
+
else {
|
|
1004
|
+
const i = Jt(t);
|
|
1005
|
+
o = {
|
|
1006
|
+
x: e.x - i.x,
|
|
1007
|
+
y: e.y - i.y,
|
|
1008
|
+
width: e.width,
|
|
1009
|
+
height: e.height
|
|
1010
|
+
};
|
|
1011
|
+
}
|
|
1012
|
+
return Q(o);
|
|
1013
|
+
}
|
|
1014
|
+
function te(t, e) {
|
|
1015
|
+
const n = G(t);
|
|
1016
|
+
return n === e || !_(n) || tt(n) ? !1 : W(n).position === "fixed" || te(n, e);
|
|
1017
|
+
}
|
|
1018
|
+
function ai(t, e) {
|
|
1019
|
+
const n = e.get(t);
|
|
1020
|
+
if (n)
|
|
1021
|
+
return n;
|
|
1022
|
+
let o = qt(t, []).filter((l) => _(l) && et(l) !== "body"), i = null;
|
|
1023
|
+
const s = W(t).position === "fixed";
|
|
1024
|
+
let r = s ? G(t) : t;
|
|
1025
|
+
for (; _(r) && !tt(r); ) {
|
|
1026
|
+
const l = W(r), c = Ot(r);
|
|
1027
|
+
!c && l.position === "fixed" && (i = null), (s ? !c && !i : !c && l.position === "static" && !!i && (i.position === "absolute" || i.position === "fixed") || ot(r) && !c && te(t, r)) ? o = o.filter((f) => f !== r) : i = l, r = G(r);
|
|
1028
|
+
}
|
|
1029
|
+
return e.set(t, o), o;
|
|
1030
|
+
}
|
|
1031
|
+
function ci(t) {
|
|
1032
|
+
let {
|
|
1033
|
+
element: e,
|
|
1034
|
+
boundary: n,
|
|
1035
|
+
rootBoundary: o,
|
|
1036
|
+
strategy: i
|
|
1037
|
+
} = t;
|
|
1038
|
+
const r = [...n === "clippingAncestors" ? ct(e) ? [] : ai(e, this._c) : [].concat(n), o], l = Mt(e, r[0], i);
|
|
1039
|
+
let c = l.top, p = l.right, f = l.bottom, a = l.left;
|
|
1040
|
+
for (let d = 1; d < r.length; d++) {
|
|
1041
|
+
const u = Mt(e, r[d], i);
|
|
1042
|
+
c = D(u.top, c), p = K(u.right, p), f = K(u.bottom, f), a = D(u.left, a);
|
|
1043
|
+
}
|
|
1044
|
+
return {
|
|
1045
|
+
width: p - a,
|
|
1046
|
+
height: f - c,
|
|
1047
|
+
x: a,
|
|
1048
|
+
y: c
|
|
1049
|
+
};
|
|
1050
|
+
}
|
|
1051
|
+
function ui(t) {
|
|
1052
|
+
const {
|
|
1053
|
+
width: e,
|
|
1054
|
+
height: n
|
|
1055
|
+
} = Gt(t);
|
|
1056
|
+
return {
|
|
1057
|
+
width: e,
|
|
1058
|
+
height: n
|
|
1059
|
+
};
|
|
1060
|
+
}
|
|
1061
|
+
function fi(t, e, n) {
|
|
1062
|
+
const o = X(e), i = Y(e), s = n === "fixed", r = nt(t, !0, s, e);
|
|
1063
|
+
let l = {
|
|
1064
|
+
scrollLeft: 0,
|
|
1065
|
+
scrollTop: 0
|
|
1066
|
+
};
|
|
1067
|
+
const c = $(0);
|
|
1068
|
+
function p() {
|
|
1069
|
+
c.x = ft(i);
|
|
1070
|
+
}
|
|
1071
|
+
if (o || !o && !s)
|
|
1072
|
+
if ((et(e) !== "body" || ot(i)) && (l = ut(e)), o) {
|
|
1073
|
+
const u = nt(e, !0, s, e);
|
|
1074
|
+
c.x = u.x + e.clientLeft, c.y = u.y + e.clientTop;
|
|
1075
|
+
} else i && p();
|
|
1076
|
+
s && !o && i && p();
|
|
1077
|
+
const f = i && !o && !s ? Qt(i, l) : $(0), a = r.left + l.scrollLeft - c.x - f.x, d = r.top + l.scrollTop - c.y - f.y;
|
|
1078
|
+
return {
|
|
1079
|
+
x: a,
|
|
1080
|
+
y: d,
|
|
1081
|
+
width: r.width,
|
|
1082
|
+
height: r.height
|
|
1083
|
+
};
|
|
1084
|
+
}
|
|
1085
|
+
function ht(t) {
|
|
1086
|
+
return W(t).position === "static";
|
|
1087
|
+
}
|
|
1088
|
+
function Pt(t, e) {
|
|
1089
|
+
if (!X(t) || W(t).position === "fixed")
|
|
1090
|
+
return null;
|
|
1091
|
+
if (e)
|
|
1092
|
+
return e(t);
|
|
1093
|
+
let n = t.offsetParent;
|
|
1094
|
+
return Y(t) === n && (n = n.ownerDocument.body), n;
|
|
1095
|
+
}
|
|
1096
|
+
function ee(t, e) {
|
|
1097
|
+
const n = P(t);
|
|
1098
|
+
if (ct(t))
|
|
1099
|
+
return n;
|
|
1100
|
+
if (!X(t)) {
|
|
1101
|
+
let i = G(t);
|
|
1102
|
+
for (; i && !tt(i); ) {
|
|
1103
|
+
if (_(i) && !ht(i))
|
|
1104
|
+
return i;
|
|
1105
|
+
i = G(i);
|
|
1106
|
+
}
|
|
1107
|
+
return n;
|
|
1108
|
+
}
|
|
1109
|
+
let o = Pt(t, e);
|
|
1110
|
+
for (; o && Ze(o) && ht(o); )
|
|
1111
|
+
o = Pt(o, e);
|
|
1112
|
+
return o && tt(o) && ht(o) && !Ot(o) ? n : o || ti(t) || n;
|
|
1113
|
+
}
|
|
1114
|
+
const di = async function(t) {
|
|
1115
|
+
const e = this.getOffsetParent || ee, n = this.getDimensions, o = await n(t.floating);
|
|
1116
|
+
return {
|
|
1117
|
+
reference: fi(t.reference, await e(t.floating), t.strategy),
|
|
1118
|
+
floating: {
|
|
1119
|
+
x: 0,
|
|
1120
|
+
y: 0,
|
|
1121
|
+
width: o.width,
|
|
1122
|
+
height: o.height
|
|
1123
|
+
}
|
|
1124
|
+
};
|
|
1125
|
+
};
|
|
1126
|
+
function hi(t) {
|
|
1127
|
+
return W(t).direction === "rtl";
|
|
1128
|
+
}
|
|
1129
|
+
const pi = {
|
|
1130
|
+
convertOffsetParentRelativeRectToViewportRelativeRect: ni,
|
|
1131
|
+
getDocumentElement: Y,
|
|
1132
|
+
getClippingRect: ci,
|
|
1133
|
+
getOffsetParent: ee,
|
|
1134
|
+
getElementRects: di,
|
|
1135
|
+
getClientRects: oi,
|
|
1136
|
+
getDimensions: ui,
|
|
1137
|
+
getScale: J,
|
|
1138
|
+
isElement: _,
|
|
1139
|
+
isRTL: hi
|
|
1140
|
+
}, ie = Xe, ne = We, oe = qe, se = ke, re = Ge, le = Fe, ae = Ne, ce = Ke, ue = (t, e, n) => {
|
|
1141
|
+
const o = /* @__PURE__ */ new Map(), i = {
|
|
1142
|
+
platform: pi,
|
|
1143
|
+
...n
|
|
1144
|
+
}, s = {
|
|
1145
|
+
...i.platform,
|
|
1146
|
+
_c: o
|
|
1147
|
+
};
|
|
1148
|
+
return Ve(t, e, {
|
|
1149
|
+
...i,
|
|
1150
|
+
platform: s
|
|
1151
|
+
});
|
|
1152
|
+
};
|
|
1153
|
+
function gi(t, e) {
|
|
1154
|
+
const n = Math.min(t.top, e.top), o = Math.max(t.bottom, e.bottom), i = Math.min(t.left, e.left), r = Math.max(t.right, e.right) - i, l = o - n, c = i, p = n;
|
|
1155
|
+
return new DOMRect(c, p, r, l);
|
|
1156
|
+
}
|
|
1157
|
+
var mi = class {
|
|
1158
|
+
constructor({
|
|
1159
|
+
editor: t,
|
|
1160
|
+
element: e,
|
|
1161
|
+
view: n,
|
|
1162
|
+
pluginKey: o = "bubbleMenu",
|
|
1163
|
+
updateDelay: i = 250,
|
|
1164
|
+
resizeDelay: s = 60,
|
|
1165
|
+
shouldShow: r,
|
|
1166
|
+
appendTo: l,
|
|
1167
|
+
getReferencedVirtualElement: c,
|
|
1168
|
+
options: p
|
|
1169
|
+
}) {
|
|
1170
|
+
this.preventHide = !1, this.isVisible = !1, this.scrollTarget = window, this.floatingUIOptions = {
|
|
1171
|
+
strategy: "absolute",
|
|
1172
|
+
placement: "top",
|
|
1173
|
+
offset: 8,
|
|
1174
|
+
flip: {},
|
|
1175
|
+
shift: {},
|
|
1176
|
+
arrow: !1,
|
|
1177
|
+
size: !1,
|
|
1178
|
+
autoPlacement: !1,
|
|
1179
|
+
hide: !1,
|
|
1180
|
+
inline: !1,
|
|
1181
|
+
onShow: void 0,
|
|
1182
|
+
onHide: void 0,
|
|
1183
|
+
onUpdate: void 0,
|
|
1184
|
+
onDestroy: void 0
|
|
1185
|
+
}, this.shouldShow = ({ view: a, state: d, from: u, to: h }) => {
|
|
1186
|
+
const { doc: g, selection: m } = d, { empty: v } = m, y = !g.textBetween(u, h).length && xe(d.selection), w = this.element.contains(document.activeElement);
|
|
1187
|
+
return !(!(a.hasFocus() || w) || v || y || !this.editor.isEditable);
|
|
1188
|
+
}, this.mousedownHandler = () => {
|
|
1189
|
+
this.preventHide = !0;
|
|
1190
|
+
}, this.dragstartHandler = () => {
|
|
1191
|
+
this.hide();
|
|
1192
|
+
}, this.resizeHandler = () => {
|
|
1193
|
+
this.resizeDebounceTimer && clearTimeout(this.resizeDebounceTimer), this.resizeDebounceTimer = window.setTimeout(() => {
|
|
1194
|
+
this.updatePosition();
|
|
1195
|
+
}, this.resizeDelay);
|
|
1196
|
+
}, this.focusHandler = () => {
|
|
1197
|
+
setTimeout(() => this.update(this.editor.view));
|
|
1198
|
+
}, this.blurHandler = ({ event: a }) => {
|
|
1199
|
+
var d;
|
|
1200
|
+
if (this.editor.isDestroyed) {
|
|
1201
|
+
this.destroy();
|
|
1202
|
+
return;
|
|
1203
|
+
}
|
|
1204
|
+
if (this.preventHide) {
|
|
1205
|
+
this.preventHide = !1;
|
|
1206
|
+
return;
|
|
1207
|
+
}
|
|
1208
|
+
a?.relatedTarget && ((d = this.element.parentNode) != null && d.contains(a.relatedTarget)) || a?.relatedTarget !== this.editor.view.dom && this.hide();
|
|
1209
|
+
}, this.handleDebouncedUpdate = (a, d) => {
|
|
1210
|
+
const u = !d?.selection.eq(a.state.selection), h = !d?.doc.eq(a.state.doc);
|
|
1211
|
+
!u && !h || (this.updateDebounceTimer && clearTimeout(this.updateDebounceTimer), this.updateDebounceTimer = window.setTimeout(() => {
|
|
1212
|
+
this.updateHandler(a, u, h, d);
|
|
1213
|
+
}, this.updateDelay));
|
|
1214
|
+
}, this.updateHandler = (a, d, u, h) => {
|
|
1215
|
+
const { composing: g } = a;
|
|
1216
|
+
if (g || !d && !u)
|
|
1217
|
+
return;
|
|
1218
|
+
if (!this.getShouldShow(h)) {
|
|
1219
|
+
this.hide();
|
|
1220
|
+
return;
|
|
1221
|
+
}
|
|
1222
|
+
this.updatePosition(), this.show();
|
|
1223
|
+
}, this.transactionHandler = ({ transaction: a }) => {
|
|
1224
|
+
const d = a.getMeta(this.pluginKey);
|
|
1225
|
+
d === "updatePosition" ? this.updatePosition() : d && typeof d == "object" && d.type === "updateOptions" && this.updateOptions(d.options);
|
|
1226
|
+
};
|
|
1227
|
+
var f;
|
|
1228
|
+
this.editor = t, this.element = e, this.view = n, this.pluginKey = o, this.updateDelay = i, this.resizeDelay = s, this.appendTo = l, this.scrollTarget = (f = p?.scrollTarget) != null ? f : window, this.getReferencedVirtualElement = c, this.floatingUIOptions = {
|
|
1229
|
+
...this.floatingUIOptions,
|
|
1230
|
+
...p
|
|
1231
|
+
}, this.element.tabIndex = 0, r && (this.shouldShow = r), this.element.addEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.view.dom.addEventListener("dragstart", this.dragstartHandler), this.editor.on("focus", this.focusHandler), this.editor.on("blur", this.blurHandler), this.editor.on("transaction", this.transactionHandler), window.addEventListener("resize", this.resizeHandler), this.scrollTarget.addEventListener("scroll", this.resizeHandler), this.update(n, n.state), this.getShouldShow() && (this.show(), this.updatePosition());
|
|
1232
|
+
}
|
|
1233
|
+
get middlewares() {
|
|
1234
|
+
const t = [];
|
|
1235
|
+
return this.floatingUIOptions.flip && t.push(se(typeof this.floatingUIOptions.flip != "boolean" ? this.floatingUIOptions.flip : void 0)), this.floatingUIOptions.shift && t.push(
|
|
1236
|
+
oe(typeof this.floatingUIOptions.shift != "boolean" ? this.floatingUIOptions.shift : void 0)
|
|
1237
|
+
), this.floatingUIOptions.offset && t.push(
|
|
1238
|
+
ie(typeof this.floatingUIOptions.offset != "boolean" ? this.floatingUIOptions.offset : void 0)
|
|
1239
|
+
), this.floatingUIOptions.arrow && t.push(ae(this.floatingUIOptions.arrow)), this.floatingUIOptions.size && t.push(re(typeof this.floatingUIOptions.size != "boolean" ? this.floatingUIOptions.size : void 0)), this.floatingUIOptions.autoPlacement && t.push(
|
|
1240
|
+
ne(
|
|
1241
|
+
typeof this.floatingUIOptions.autoPlacement != "boolean" ? this.floatingUIOptions.autoPlacement : void 0
|
|
1242
|
+
)
|
|
1243
|
+
), this.floatingUIOptions.hide && t.push(le(typeof this.floatingUIOptions.hide != "boolean" ? this.floatingUIOptions.hide : void 0)), this.floatingUIOptions.inline && t.push(
|
|
1244
|
+
ce(typeof this.floatingUIOptions.inline != "boolean" ? this.floatingUIOptions.inline : void 0)
|
|
1245
|
+
), t;
|
|
1246
|
+
}
|
|
1247
|
+
get virtualElement() {
|
|
1248
|
+
var t, e, n;
|
|
1249
|
+
const { selection: o } = this.editor.state, i = (t = this.getReferencedVirtualElement) == null ? void 0 : t.call(this);
|
|
1250
|
+
if (i)
|
|
1251
|
+
return i;
|
|
1252
|
+
if (!((n = (e = this.view) == null ? void 0 : e.dom) != null && n.parentNode))
|
|
1253
|
+
return;
|
|
1254
|
+
const s = Vt(this.view, o.from, o.to);
|
|
1255
|
+
let r = {
|
|
1256
|
+
getBoundingClientRect: () => s,
|
|
1257
|
+
getClientRects: () => [s]
|
|
1258
|
+
};
|
|
1259
|
+
if (o instanceof Oe) {
|
|
1260
|
+
let l = this.view.nodeDOM(o.from);
|
|
1261
|
+
const c = l.dataset.nodeViewWrapper ? l : l.querySelector("[data-node-view-wrapper]");
|
|
1262
|
+
c && (l = c), l && (r = {
|
|
1263
|
+
getBoundingClientRect: () => l.getBoundingClientRect(),
|
|
1264
|
+
getClientRects: () => [l.getBoundingClientRect()]
|
|
1265
|
+
});
|
|
1266
|
+
}
|
|
1267
|
+
if (o instanceof Te) {
|
|
1268
|
+
const { $anchorCell: l, $headCell: c } = o, p = l ? l.pos : c.pos, f = c ? c.pos : l.pos, a = this.view.nodeDOM(p), d = this.view.nodeDOM(f);
|
|
1269
|
+
if (!a || !d)
|
|
1270
|
+
return;
|
|
1271
|
+
const u = a === d ? a.getBoundingClientRect() : gi(
|
|
1272
|
+
a.getBoundingClientRect(),
|
|
1273
|
+
d.getBoundingClientRect()
|
|
1274
|
+
);
|
|
1275
|
+
r = {
|
|
1276
|
+
getBoundingClientRect: () => u,
|
|
1277
|
+
getClientRects: () => [u]
|
|
1278
|
+
};
|
|
1279
|
+
}
|
|
1280
|
+
return r;
|
|
1281
|
+
}
|
|
1282
|
+
updatePosition() {
|
|
1283
|
+
const t = this.virtualElement;
|
|
1284
|
+
t && ue(t, this.element, {
|
|
1285
|
+
placement: this.floatingUIOptions.placement,
|
|
1286
|
+
strategy: this.floatingUIOptions.strategy,
|
|
1287
|
+
middleware: this.middlewares
|
|
1288
|
+
}).then(({ x: e, y: n, strategy: o, middlewareData: i }) => {
|
|
1289
|
+
var s, r;
|
|
1290
|
+
if ((s = i.hide) != null && s.referenceHidden || (r = i.hide) != null && r.escaped) {
|
|
1291
|
+
this.element.style.visibility = "hidden";
|
|
1292
|
+
return;
|
|
139
1293
|
}
|
|
140
|
-
|
|
1294
|
+
this.element.style.visibility = "visible", this.element.style.width = "max-content", this.element.style.position = o, this.element.style.left = `${e}px`, this.element.style.top = `${n}px`, this.isVisible && this.floatingUIOptions.onUpdate && this.floatingUIOptions.onUpdate();
|
|
1295
|
+
});
|
|
1296
|
+
}
|
|
1297
|
+
update(t, e) {
|
|
1298
|
+
const { state: n } = t, o = n.selection.from !== n.selection.to;
|
|
1299
|
+
if (this.updateDelay > 0 && o) {
|
|
1300
|
+
this.handleDebouncedUpdate(t, e);
|
|
1301
|
+
return;
|
|
1302
|
+
}
|
|
1303
|
+
const i = !e?.selection.eq(t.state.selection), s = !e?.doc.eq(t.state.doc);
|
|
1304
|
+
this.updateHandler(t, i, s, e);
|
|
1305
|
+
}
|
|
1306
|
+
getShouldShow(t) {
|
|
1307
|
+
var e;
|
|
1308
|
+
const { state: n } = this.view, { selection: o } = n, { ranges: i } = o, s = Math.min(...i.map((c) => c.$from.pos)), r = Math.max(...i.map((c) => c.$to.pos));
|
|
1309
|
+
return ((e = this.shouldShow) == null ? void 0 : e.call(this, {
|
|
1310
|
+
editor: this.editor,
|
|
1311
|
+
element: this.element,
|
|
1312
|
+
view: this.view,
|
|
1313
|
+
state: n,
|
|
1314
|
+
oldState: t,
|
|
1315
|
+
from: s,
|
|
1316
|
+
to: r
|
|
1317
|
+
})) || !1;
|
|
1318
|
+
}
|
|
1319
|
+
show() {
|
|
1320
|
+
var t;
|
|
1321
|
+
if (this.isVisible)
|
|
1322
|
+
return;
|
|
1323
|
+
this.element.style.visibility = "visible", this.element.style.opacity = "1";
|
|
1324
|
+
const e = typeof this.appendTo == "function" ? this.appendTo() : this.appendTo;
|
|
1325
|
+
(t = e ?? this.view.dom.parentElement) == null || t.appendChild(this.element), this.floatingUIOptions.onShow && this.floatingUIOptions.onShow(), this.isVisible = !0;
|
|
1326
|
+
}
|
|
1327
|
+
hide() {
|
|
1328
|
+
this.isVisible && (this.element.style.visibility = "hidden", this.element.style.opacity = "0", this.element.remove(), this.floatingUIOptions.onHide && this.floatingUIOptions.onHide(), this.isVisible = !1);
|
|
1329
|
+
}
|
|
1330
|
+
updateOptions(t) {
|
|
1331
|
+
var e;
|
|
1332
|
+
if (t.updateDelay !== void 0 && (this.updateDelay = t.updateDelay), t.resizeDelay !== void 0 && (this.resizeDelay = t.resizeDelay), t.appendTo !== void 0 && (this.appendTo = t.appendTo), t.getReferencedVirtualElement !== void 0 && (this.getReferencedVirtualElement = t.getReferencedVirtualElement), t.shouldShow !== void 0 && t.shouldShow && (this.shouldShow = t.shouldShow), t.options !== void 0) {
|
|
1333
|
+
const n = (e = t.options.scrollTarget) != null ? e : window;
|
|
1334
|
+
n !== this.scrollTarget && (this.scrollTarget.removeEventListener("scroll", this.resizeHandler), this.scrollTarget = n, this.scrollTarget.addEventListener("scroll", this.resizeHandler)), this.floatingUIOptions = {
|
|
1335
|
+
...this.floatingUIOptions,
|
|
1336
|
+
...t.options
|
|
1337
|
+
};
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
destroy() {
|
|
1341
|
+
this.hide(), this.element.removeEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.view.dom.removeEventListener("dragstart", this.dragstartHandler), window.removeEventListener("resize", this.resizeHandler), this.scrollTarget.removeEventListener("scroll", this.resizeHandler), this.editor.off("focus", this.focusHandler), this.editor.off("blur", this.blurHandler), this.editor.off("transaction", this.transactionHandler), this.floatingUIOptions.onDestroy && this.floatingUIOptions.onDestroy();
|
|
1342
|
+
}
|
|
1343
|
+
}, fe = (t) => new zt({
|
|
1344
|
+
key: typeof t.pluginKey == "string" ? new vt(t.pluginKey) : t.pluginKey,
|
|
1345
|
+
view: (e) => new mi({ view: e, ...t })
|
|
1346
|
+
});
|
|
1347
|
+
Nt.create({
|
|
1348
|
+
name: "bubbleMenu",
|
|
1349
|
+
addOptions() {
|
|
1350
|
+
return {
|
|
1351
|
+
element: null,
|
|
1352
|
+
pluginKey: "bubbleMenu",
|
|
1353
|
+
updateDelay: void 0,
|
|
1354
|
+
appendTo: void 0,
|
|
1355
|
+
shouldShow: null
|
|
1356
|
+
};
|
|
141
1357
|
},
|
|
142
|
-
{
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
1358
|
+
addProseMirrorPlugins() {
|
|
1359
|
+
return this.options.element ? [
|
|
1360
|
+
fe({
|
|
1361
|
+
pluginKey: this.options.pluginKey,
|
|
1362
|
+
editor: this.editor,
|
|
1363
|
+
element: this.options.element,
|
|
1364
|
+
updateDelay: this.options.updateDelay,
|
|
1365
|
+
options: this.options.options,
|
|
1366
|
+
appendTo: this.options.appendTo,
|
|
1367
|
+
getReferencedVirtualElement: this.options.getReferencedVirtualElement,
|
|
1368
|
+
shouldShow: this.options.shouldShow
|
|
1369
|
+
})
|
|
1370
|
+
] : [];
|
|
1371
|
+
}
|
|
1372
|
+
});
|
|
1373
|
+
var wi = class {
|
|
1374
|
+
constructor({
|
|
1375
|
+
editor: t,
|
|
1376
|
+
element: e,
|
|
1377
|
+
view: n,
|
|
1378
|
+
pluginKey: o = "floatingMenu",
|
|
1379
|
+
updateDelay: i = 250,
|
|
1380
|
+
resizeDelay: s = 60,
|
|
1381
|
+
options: r,
|
|
1382
|
+
appendTo: l,
|
|
1383
|
+
shouldShow: c
|
|
1384
|
+
}) {
|
|
1385
|
+
this.preventHide = !1, this.isVisible = !1, this.scrollTarget = window, this.shouldShow = ({ view: f, state: a }) => {
|
|
1386
|
+
const { selection: d } = a, { $anchor: u, empty: h } = d, g = u.depth === 1, m = u.parent.isTextblock && !u.parent.type.spec.code && !u.parent.textContent && u.parent.childCount === 0 && !this.getTextContent(u.parent);
|
|
1387
|
+
return !(!f.hasFocus() || !h || !g || !m || !this.editor.isEditable);
|
|
1388
|
+
}, this.floatingUIOptions = {
|
|
1389
|
+
strategy: "absolute",
|
|
1390
|
+
placement: "right",
|
|
1391
|
+
offset: 8,
|
|
1392
|
+
flip: {},
|
|
1393
|
+
shift: {},
|
|
1394
|
+
arrow: !1,
|
|
1395
|
+
size: !1,
|
|
1396
|
+
autoPlacement: !1,
|
|
1397
|
+
hide: !1,
|
|
1398
|
+
inline: !1
|
|
1399
|
+
}, this.updateHandler = (f, a, d, u) => {
|
|
1400
|
+
const { composing: h } = f;
|
|
1401
|
+
if (h || !a && !d)
|
|
1402
|
+
return;
|
|
1403
|
+
if (!this.getShouldShow(u)) {
|
|
1404
|
+
this.hide();
|
|
1405
|
+
return;
|
|
1406
|
+
}
|
|
1407
|
+
this.updatePosition(), this.show();
|
|
1408
|
+
}, this.mousedownHandler = () => {
|
|
1409
|
+
this.preventHide = !0;
|
|
1410
|
+
}, this.focusHandler = () => {
|
|
1411
|
+
setTimeout(() => this.update(this.editor.view));
|
|
1412
|
+
}, this.blurHandler = ({ event: f }) => {
|
|
1413
|
+
var a;
|
|
1414
|
+
if (this.preventHide) {
|
|
1415
|
+
this.preventHide = !1;
|
|
1416
|
+
return;
|
|
162
1417
|
}
|
|
163
|
-
|
|
1418
|
+
f?.relatedTarget && ((a = this.element.parentNode) != null && a.contains(f.relatedTarget)) || f?.relatedTarget !== this.editor.view.dom && this.hide();
|
|
1419
|
+
}, this.transactionHandler = ({ transaction: f }) => {
|
|
1420
|
+
const a = f.getMeta(this.pluginKey);
|
|
1421
|
+
a === "updatePosition" ? this.updatePosition() : a && typeof a == "object" && a.type === "updateOptions" && this.updateOptions(a.options);
|
|
1422
|
+
}, this.resizeHandler = () => {
|
|
1423
|
+
this.resizeDebounceTimer && clearTimeout(this.resizeDebounceTimer), this.resizeDebounceTimer = window.setTimeout(() => {
|
|
1424
|
+
this.updatePosition();
|
|
1425
|
+
}, this.resizeDelay);
|
|
1426
|
+
};
|
|
1427
|
+
var p;
|
|
1428
|
+
this.editor = t, this.element = e, this.view = n, this.pluginKey = o, this.updateDelay = i, this.resizeDelay = s, this.appendTo = l, this.scrollTarget = (p = r?.scrollTarget) != null ? p : window, this.floatingUIOptions = {
|
|
1429
|
+
...this.floatingUIOptions,
|
|
1430
|
+
...r
|
|
1431
|
+
}, this.element.tabIndex = 0, c && (this.shouldShow = c), this.element.addEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.editor.on("focus", this.focusHandler), this.editor.on("blur", this.blurHandler), this.editor.on("transaction", this.transactionHandler), window.addEventListener("resize", this.resizeHandler), this.scrollTarget.addEventListener("scroll", this.resizeHandler), this.update(n, n.state), this.getShouldShow() && (this.show(), this.updatePosition());
|
|
1432
|
+
}
|
|
1433
|
+
getTextContent(t) {
|
|
1434
|
+
return Se(t, { textSerializers: Ce(this.editor.schema) });
|
|
1435
|
+
}
|
|
1436
|
+
get middlewares() {
|
|
1437
|
+
const t = [];
|
|
1438
|
+
return this.floatingUIOptions.flip && t.push(se(typeof this.floatingUIOptions.flip != "boolean" ? this.floatingUIOptions.flip : void 0)), this.floatingUIOptions.shift && t.push(
|
|
1439
|
+
oe(typeof this.floatingUIOptions.shift != "boolean" ? this.floatingUIOptions.shift : void 0)
|
|
1440
|
+
), this.floatingUIOptions.offset && t.push(
|
|
1441
|
+
ie(typeof this.floatingUIOptions.offset != "boolean" ? this.floatingUIOptions.offset : void 0)
|
|
1442
|
+
), this.floatingUIOptions.arrow && t.push(ae(this.floatingUIOptions.arrow)), this.floatingUIOptions.size && t.push(re(typeof this.floatingUIOptions.size != "boolean" ? this.floatingUIOptions.size : void 0)), this.floatingUIOptions.autoPlacement && t.push(
|
|
1443
|
+
ne(
|
|
1444
|
+
typeof this.floatingUIOptions.autoPlacement != "boolean" ? this.floatingUIOptions.autoPlacement : void 0
|
|
1445
|
+
)
|
|
1446
|
+
), this.floatingUIOptions.hide && t.push(le(typeof this.floatingUIOptions.hide != "boolean" ? this.floatingUIOptions.hide : void 0)), this.floatingUIOptions.inline && t.push(
|
|
1447
|
+
ce(typeof this.floatingUIOptions.inline != "boolean" ? this.floatingUIOptions.inline : void 0)
|
|
1448
|
+
), t;
|
|
1449
|
+
}
|
|
1450
|
+
getShouldShow(t) {
|
|
1451
|
+
var e;
|
|
1452
|
+
const { state: n } = this.view, { selection: o } = n, { ranges: i } = o, s = Math.min(...i.map((c) => c.$from.pos)), r = Math.max(...i.map((c) => c.$to.pos));
|
|
1453
|
+
return (e = this.shouldShow) == null ? void 0 : e.call(this, {
|
|
1454
|
+
editor: this.editor,
|
|
1455
|
+
view: this.view,
|
|
1456
|
+
state: n,
|
|
1457
|
+
oldState: t,
|
|
1458
|
+
from: s,
|
|
1459
|
+
to: r
|
|
1460
|
+
});
|
|
1461
|
+
}
|
|
1462
|
+
updateOptions(t) {
|
|
1463
|
+
var e;
|
|
1464
|
+
if (t.updateDelay !== void 0 && (this.updateDelay = t.updateDelay), t.resizeDelay !== void 0 && (this.resizeDelay = t.resizeDelay), t.appendTo !== void 0 && (this.appendTo = t.appendTo), t.shouldShow !== void 0 && t.shouldShow && (this.shouldShow = t.shouldShow), t.options !== void 0) {
|
|
1465
|
+
const n = (e = t.options.scrollTarget) != null ? e : window;
|
|
1466
|
+
n !== this.scrollTarget && (this.scrollTarget.removeEventListener("scroll", this.resizeHandler), this.scrollTarget = n, this.scrollTarget.addEventListener("scroll", this.resizeHandler)), this.floatingUIOptions = {
|
|
1467
|
+
...this.floatingUIOptions,
|
|
1468
|
+
...t.options
|
|
1469
|
+
};
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
updatePosition() {
|
|
1473
|
+
const { selection: t } = this.editor.state, e = Vt(this.view, t.from, t.to);
|
|
1474
|
+
ue({
|
|
1475
|
+
getBoundingClientRect: () => e,
|
|
1476
|
+
getClientRects: () => [e]
|
|
1477
|
+
}, this.element, {
|
|
1478
|
+
placement: this.floatingUIOptions.placement,
|
|
1479
|
+
strategy: this.floatingUIOptions.strategy,
|
|
1480
|
+
middleware: this.middlewares
|
|
1481
|
+
}).then(({ x: o, y: i, strategy: s, middlewareData: r }) => {
|
|
1482
|
+
var l, c;
|
|
1483
|
+
if ((l = r.hide) != null && l.referenceHidden || (c = r.hide) != null && c.escaped) {
|
|
1484
|
+
this.element.style.visibility = "hidden";
|
|
1485
|
+
return;
|
|
1486
|
+
}
|
|
1487
|
+
this.element.style.visibility = "visible", this.element.style.width = "max-content", this.element.style.position = s, this.element.style.left = `${o}px`, this.element.style.top = `${i}px`, this.isVisible && this.floatingUIOptions.onUpdate && this.floatingUIOptions.onUpdate();
|
|
1488
|
+
});
|
|
1489
|
+
}
|
|
1490
|
+
update(t, e) {
|
|
1491
|
+
const n = !e?.selection.eq(t.state.selection), o = !e?.doc.eq(t.state.doc);
|
|
1492
|
+
this.updateHandler(t, n, o, e);
|
|
1493
|
+
}
|
|
1494
|
+
show() {
|
|
1495
|
+
var t;
|
|
1496
|
+
if (this.isVisible)
|
|
1497
|
+
return;
|
|
1498
|
+
this.element.style.visibility = "visible", this.element.style.opacity = "1";
|
|
1499
|
+
const e = typeof this.appendTo == "function" ? this.appendTo() : this.appendTo;
|
|
1500
|
+
(t = e ?? this.view.dom.parentElement) == null || t.appendChild(this.element), this.floatingUIOptions.onShow && this.floatingUIOptions.onShow(), this.isVisible = !0;
|
|
1501
|
+
}
|
|
1502
|
+
hide() {
|
|
1503
|
+
this.isVisible && (this.element.style.visibility = "hidden", this.element.style.opacity = "0", this.element.remove(), this.floatingUIOptions.onHide && this.floatingUIOptions.onHide(), this.isVisible = !1);
|
|
164
1504
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
1505
|
+
destroy() {
|
|
1506
|
+
this.hide(), this.element.removeEventListener("mousedown", this.mousedownHandler, { capture: !0 }), window.removeEventListener("resize", this.resizeHandler), this.scrollTarget.removeEventListener("scroll", this.resizeHandler), this.editor.off("focus", this.focusHandler), this.editor.off("blur", this.blurHandler), this.editor.off("transaction", this.transactionHandler), this.floatingUIOptions.onDestroy && this.floatingUIOptions.onDestroy();
|
|
1507
|
+
}
|
|
1508
|
+
}, de = (t) => new zt({
|
|
1509
|
+
key: typeof t.pluginKey == "string" ? new vt(t.pluginKey) : t.pluginKey,
|
|
1510
|
+
view: (e) => new wi({ view: e, ...t })
|
|
1511
|
+
});
|
|
1512
|
+
Nt.create({
|
|
1513
|
+
name: "floatingMenu",
|
|
1514
|
+
addOptions() {
|
|
1515
|
+
return {
|
|
1516
|
+
element: null,
|
|
1517
|
+
options: {},
|
|
1518
|
+
pluginKey: "floatingMenu",
|
|
1519
|
+
updateDelay: void 0,
|
|
1520
|
+
resizeDelay: void 0,
|
|
1521
|
+
appendTo: void 0,
|
|
1522
|
+
shouldShow: null
|
|
1523
|
+
};
|
|
1524
|
+
},
|
|
1525
|
+
addCommands() {
|
|
1526
|
+
return {
|
|
1527
|
+
updateFloatingMenuPosition: () => ({ tr: t, dispatch: e }) => (e && t.setMeta(this.options.pluginKey, "updatePosition"), !0)
|
|
1528
|
+
};
|
|
171
1529
|
},
|
|
172
|
-
|
|
173
|
-
|
|
1530
|
+
addProseMirrorPlugins() {
|
|
1531
|
+
return this.options.element ? [
|
|
1532
|
+
de({
|
|
1533
|
+
pluginKey: this.options.pluginKey,
|
|
1534
|
+
editor: this.editor,
|
|
1535
|
+
element: this.options.element,
|
|
1536
|
+
updateDelay: this.options.updateDelay,
|
|
1537
|
+
resizeDelay: this.options.resizeDelay,
|
|
1538
|
+
options: this.options.options,
|
|
1539
|
+
appendTo: this.options.appendTo,
|
|
1540
|
+
shouldShow: this.options.shouldShow
|
|
1541
|
+
})
|
|
1542
|
+
] : [];
|
|
1543
|
+
}
|
|
1544
|
+
});
|
|
1545
|
+
function he(t, e) {
|
|
1546
|
+
return t ?? new vt(e);
|
|
1547
|
+
}
|
|
1548
|
+
var vi = typeof window < "u" ? Ee : it, pe = /* @__PURE__ */ new Set(["left", "opacity", "position", "top", "visibility", "width"]), yi = /* @__PURE__ */ new Set([
|
|
1549
|
+
"animationIterationCount",
|
|
1550
|
+
"aspectRatio",
|
|
1551
|
+
"borderImageOutset",
|
|
1552
|
+
"borderImageSlice",
|
|
1553
|
+
"borderImageWidth",
|
|
1554
|
+
"columnCount",
|
|
1555
|
+
"columns",
|
|
1556
|
+
"fillOpacity",
|
|
1557
|
+
"flex",
|
|
1558
|
+
"flexGrow",
|
|
1559
|
+
"flexShrink",
|
|
1560
|
+
"fontWeight",
|
|
1561
|
+
"gridArea",
|
|
1562
|
+
"gridColumn",
|
|
1563
|
+
"gridColumnEnd",
|
|
1564
|
+
"gridColumnStart",
|
|
1565
|
+
"gridRow",
|
|
1566
|
+
"gridRowEnd",
|
|
1567
|
+
"gridRowStart",
|
|
1568
|
+
"lineClamp",
|
|
1569
|
+
"lineHeight",
|
|
1570
|
+
"opacity",
|
|
1571
|
+
"order",
|
|
1572
|
+
"orphans",
|
|
1573
|
+
"scale",
|
|
1574
|
+
"stopOpacity",
|
|
1575
|
+
"strokeDasharray",
|
|
1576
|
+
"strokeDashoffset",
|
|
1577
|
+
"strokeMiterlimit",
|
|
1578
|
+
"strokeOpacity",
|
|
1579
|
+
"strokeWidth",
|
|
1580
|
+
"tabSize",
|
|
1581
|
+
"widows",
|
|
1582
|
+
"zIndex",
|
|
1583
|
+
"zoom"
|
|
1584
|
+
]), bi = /* @__PURE__ */ new Set(["children", "className", "style"]), xi = /* @__PURE__ */ new Set(["tabIndex"]), Oi = /* @__PURE__ */ new Set([
|
|
1585
|
+
"accessKey",
|
|
1586
|
+
"autoCapitalize",
|
|
1587
|
+
"contentEditable",
|
|
1588
|
+
"contextMenu",
|
|
1589
|
+
"dir",
|
|
1590
|
+
"draggable",
|
|
1591
|
+
"enterKeyHint",
|
|
1592
|
+
"hidden",
|
|
1593
|
+
"id",
|
|
1594
|
+
"lang",
|
|
1595
|
+
"nonce",
|
|
1596
|
+
"role",
|
|
1597
|
+
"slot",
|
|
1598
|
+
"spellCheck",
|
|
1599
|
+
"tabIndex",
|
|
1600
|
+
"title",
|
|
1601
|
+
"translate"
|
|
1602
|
+
]), Si = {
|
|
1603
|
+
Blur: "focusout",
|
|
1604
|
+
DoubleClick: "dblclick",
|
|
1605
|
+
Focus: "focusin",
|
|
1606
|
+
MouseEnter: "mouseenter",
|
|
1607
|
+
MouseLeave: "mouseleave"
|
|
1608
|
+
};
|
|
1609
|
+
function wt(t, e) {
|
|
1610
|
+
return /^on[A-Z]/.test(t) && typeof e == "function";
|
|
1611
|
+
}
|
|
1612
|
+
function Ci(t) {
|
|
1613
|
+
return t.startsWith("aria-") || t.startsWith("data-"), t;
|
|
1614
|
+
}
|
|
1615
|
+
function Ti(t) {
|
|
1616
|
+
return t.startsWith("aria-") || t.startsWith("data-") || Oi.has(t);
|
|
1617
|
+
}
|
|
1618
|
+
function ge(t) {
|
|
1619
|
+
return t.startsWith("--") ? t : t.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`);
|
|
1620
|
+
}
|
|
1621
|
+
function Ei(t) {
|
|
1622
|
+
var e;
|
|
1623
|
+
const n = t.endsWith("Capture"), i = (n ? t.slice(0, -7) : t).slice(2);
|
|
1624
|
+
return {
|
|
1625
|
+
eventName: (e = Si[i]) != null ? e : i.toLowerCase(),
|
|
1626
|
+
options: n ? { capture: !0 } : void 0
|
|
1627
|
+
};
|
|
1628
|
+
}
|
|
1629
|
+
function Ri(t, e) {
|
|
1630
|
+
let n = e.defaultPrevented, o = !1;
|
|
1631
|
+
const i = Object.create(e);
|
|
1632
|
+
return Object.defineProperties(i, {
|
|
1633
|
+
nativeEvent: { value: e },
|
|
1634
|
+
currentTarget: { value: t },
|
|
1635
|
+
target: { value: e.target },
|
|
1636
|
+
persist: { value: () => {
|
|
1637
|
+
} },
|
|
1638
|
+
isDefaultPrevented: { value: () => n },
|
|
1639
|
+
isPropagationStopped: { value: () => o },
|
|
1640
|
+
preventDefault: {
|
|
1641
|
+
value: () => {
|
|
1642
|
+
n = !0, e.preventDefault();
|
|
1643
|
+
}
|
|
1644
|
+
},
|
|
1645
|
+
stopPropagation: {
|
|
1646
|
+
value: () => {
|
|
1647
|
+
o = !0, e.stopPropagation();
|
|
1648
|
+
}
|
|
1649
|
+
}
|
|
1650
|
+
}), i;
|
|
1651
|
+
}
|
|
1652
|
+
function pt(t) {
|
|
1653
|
+
return xi.has(t);
|
|
1654
|
+
}
|
|
1655
|
+
function Ut(t, e, n) {
|
|
1656
|
+
if (e === "tabIndex") {
|
|
1657
|
+
t.tabIndex = Number(n);
|
|
1658
|
+
return;
|
|
1659
|
+
}
|
|
1660
|
+
t[e] = n;
|
|
1661
|
+
}
|
|
1662
|
+
function Ii(t, e) {
|
|
1663
|
+
if (e === "tabIndex") {
|
|
1664
|
+
t.removeAttribute("tabindex");
|
|
1665
|
+
return;
|
|
1666
|
+
}
|
|
1667
|
+
const n = t[e];
|
|
1668
|
+
if (typeof n == "boolean") {
|
|
1669
|
+
t[e] = !1;
|
|
1670
|
+
return;
|
|
1671
|
+
}
|
|
1672
|
+
if (typeof n == "number") {
|
|
1673
|
+
t[e] = 0;
|
|
1674
|
+
return;
|
|
1675
|
+
}
|
|
1676
|
+
t[e] = "";
|
|
1677
|
+
}
|
|
1678
|
+
function Li(t, e) {
|
|
1679
|
+
return typeof e != "number" || e === 0 || t.startsWith("--") || yi.has(t) ? String(e) : `${e}px`;
|
|
1680
|
+
}
|
|
1681
|
+
function Di(t, e) {
|
|
1682
|
+
pe.has(e) || t.style.removeProperty(ge(e));
|
|
1683
|
+
}
|
|
1684
|
+
function Hi(t, e, n) {
|
|
1685
|
+
pe.has(e) || t.style.setProperty(ge(e), Li(e, n));
|
|
1686
|
+
}
|
|
1687
|
+
function Ai(t, e, n) {
|
|
1688
|
+
(/* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(n)])).forEach((i) => {
|
|
1689
|
+
if (bi.has(i) || !Ti(i) || wt(i, e[i]) || wt(i, n[i]))
|
|
1690
|
+
return;
|
|
1691
|
+
const s = e[i], r = n[i];
|
|
1692
|
+
if (s === r)
|
|
1693
|
+
return;
|
|
1694
|
+
const l = Ci(i);
|
|
1695
|
+
if (r == null || r === !1) {
|
|
1696
|
+
pt(i) && Ii(t, i), t.removeAttribute(l);
|
|
1697
|
+
return;
|
|
1698
|
+
}
|
|
1699
|
+
if (r === !0) {
|
|
1700
|
+
pt(i) && Ut(t, i, !0), t.setAttribute(l, "");
|
|
1701
|
+
return;
|
|
1702
|
+
}
|
|
1703
|
+
if (pt(i)) {
|
|
1704
|
+
Ut(t, i, r);
|
|
1705
|
+
return;
|
|
1706
|
+
}
|
|
1707
|
+
t.setAttribute(l, String(r));
|
|
1708
|
+
});
|
|
1709
|
+
}
|
|
1710
|
+
function Mi(t, e, n) {
|
|
1711
|
+
if (e !== n) {
|
|
1712
|
+
if (n) {
|
|
1713
|
+
t.className = n;
|
|
1714
|
+
return;
|
|
1715
|
+
}
|
|
1716
|
+
t.removeAttribute("class");
|
|
1717
|
+
}
|
|
1718
|
+
}
|
|
1719
|
+
function Pi(t, e, n) {
|
|
1720
|
+
const o = e ?? {}, i = n ?? {};
|
|
1721
|
+
(/* @__PURE__ */ new Set([...Object.keys(o), ...Object.keys(i)])).forEach((r) => {
|
|
1722
|
+
const l = o[r], c = i[r];
|
|
1723
|
+
if (l !== c) {
|
|
1724
|
+
if (c == null) {
|
|
1725
|
+
Di(t, r);
|
|
1726
|
+
return;
|
|
1727
|
+
}
|
|
1728
|
+
Hi(t, r, c);
|
|
1729
|
+
}
|
|
1730
|
+
});
|
|
1731
|
+
}
|
|
1732
|
+
function Ui(t, e, n) {
|
|
1733
|
+
e.forEach(({ eventName: i, listener: s, options: r }) => {
|
|
1734
|
+
t.removeEventListener(i, s, r);
|
|
1735
|
+
});
|
|
1736
|
+
const o = [];
|
|
1737
|
+
return Object.entries(n).forEach(([i, s]) => {
|
|
1738
|
+
if (!wt(i, s))
|
|
1739
|
+
return;
|
|
1740
|
+
const { eventName: r, options: l } = Ei(i), c = (p) => {
|
|
1741
|
+
s(Ri(t, p));
|
|
1742
|
+
};
|
|
1743
|
+
t.addEventListener(r, c, l), o.push({ eventName: r, listener: c, options: l });
|
|
1744
|
+
}), o;
|
|
1745
|
+
}
|
|
1746
|
+
function me(t, e) {
|
|
1747
|
+
const n = k({}), o = k([]);
|
|
1748
|
+
vi(() => {
|
|
1749
|
+
const i = n.current;
|
|
1750
|
+
return Mi(t, i.className, e.className), Pi(t, i.style, e.style), Ai(t, i, e), o.current = Ui(t, o.current, e), n.current = e, () => {
|
|
1751
|
+
o.current.forEach(({ eventName: s, listener: r, options: l }) => {
|
|
1752
|
+
t.removeEventListener(s, r, l);
|
|
1753
|
+
}), o.current = [];
|
|
1754
|
+
};
|
|
1755
|
+
}, [t, e]);
|
|
1756
|
+
}
|
|
1757
|
+
var Bi = _t.forwardRef(
|
|
1758
|
+
({
|
|
1759
|
+
pluginKey: t,
|
|
1760
|
+
editor: e,
|
|
1761
|
+
updateDelay: n,
|
|
1762
|
+
resizeDelay: o,
|
|
1763
|
+
appendTo: i,
|
|
1764
|
+
shouldShow: s = null,
|
|
1765
|
+
getReferencedVirtualElement: r,
|
|
1766
|
+
options: l,
|
|
1767
|
+
children: c,
|
|
1768
|
+
...p
|
|
1769
|
+
}, f) => {
|
|
1770
|
+
const a = k(document.createElement("div")), d = k(he(t, "bubbleMenu")).current;
|
|
1771
|
+
me(a.current, p), typeof f == "function" ? f(a.current) : f && (f.current = a.current);
|
|
1772
|
+
const { editor: u } = Bt(), h = e || u, g = {
|
|
1773
|
+
updateDelay: n,
|
|
1774
|
+
resizeDelay: o,
|
|
1775
|
+
appendTo: i,
|
|
1776
|
+
pluginKey: d,
|
|
1777
|
+
shouldShow: s,
|
|
1778
|
+
getReferencedVirtualElement: r,
|
|
1779
|
+
options: l
|
|
1780
|
+
}, m = k(g);
|
|
1781
|
+
m.current = g;
|
|
1782
|
+
const [v, y] = Wt(!1), w = k(!0);
|
|
1783
|
+
return it(() => {
|
|
1784
|
+
if (h?.isDestroyed)
|
|
1785
|
+
return;
|
|
1786
|
+
if (!h) {
|
|
1787
|
+
console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");
|
|
1788
|
+
return;
|
|
1789
|
+
}
|
|
1790
|
+
const b = a.current;
|
|
1791
|
+
b.style.visibility = "hidden", b.style.position = "absolute";
|
|
1792
|
+
const S = fe({
|
|
1793
|
+
...m.current,
|
|
1794
|
+
editor: h,
|
|
1795
|
+
element: b
|
|
1796
|
+
});
|
|
1797
|
+
h.registerPlugin(S);
|
|
1798
|
+
const O = m.current.pluginKey;
|
|
1799
|
+
return w.current = !0, y(!0), () => {
|
|
1800
|
+
y(!1), h.unregisterPlugin(O), window.requestAnimationFrame(() => {
|
|
1801
|
+
b.parentNode && b.parentNode.removeChild(b);
|
|
1802
|
+
});
|
|
1803
|
+
};
|
|
1804
|
+
}, [h]), it(() => {
|
|
1805
|
+
if (!(!v || !h || h.isDestroyed)) {
|
|
1806
|
+
if (w.current) {
|
|
1807
|
+
w.current = !1;
|
|
1808
|
+
return;
|
|
1809
|
+
}
|
|
1810
|
+
h.view.dispatch(
|
|
1811
|
+
h.state.tr.setMeta(d, {
|
|
1812
|
+
type: "updateOptions",
|
|
1813
|
+
options: m.current
|
|
1814
|
+
})
|
|
1815
|
+
);
|
|
1816
|
+
}
|
|
1817
|
+
}, [
|
|
1818
|
+
v,
|
|
1819
|
+
h,
|
|
1820
|
+
n,
|
|
1821
|
+
o,
|
|
1822
|
+
s,
|
|
1823
|
+
l,
|
|
1824
|
+
i,
|
|
1825
|
+
r,
|
|
1826
|
+
d
|
|
1827
|
+
]), kt(c, a.current);
|
|
1828
|
+
}
|
|
1829
|
+
);
|
|
1830
|
+
_t.forwardRef(
|
|
1831
|
+
({ pluginKey: t, editor: e, updateDelay: n, resizeDelay: o, appendTo: i, shouldShow: s = null, options: r, children: l, ...c }, p) => {
|
|
1832
|
+
const f = k(document.createElement("div")), a = k(he(t, "floatingMenu")).current;
|
|
1833
|
+
me(f.current, c), typeof p == "function" ? p(f.current) : p && (p.current = f.current);
|
|
1834
|
+
const { editor: d } = Bt(), u = e || d, h = {
|
|
1835
|
+
updateDelay: n,
|
|
1836
|
+
resizeDelay: o,
|
|
1837
|
+
appendTo: i,
|
|
1838
|
+
pluginKey: a,
|
|
1839
|
+
shouldShow: s,
|
|
1840
|
+
options: r
|
|
1841
|
+
}, g = k(h);
|
|
1842
|
+
g.current = h;
|
|
1843
|
+
const [m, v] = Wt(!1), y = k(!0);
|
|
1844
|
+
return it(() => {
|
|
1845
|
+
if (u?.isDestroyed)
|
|
1846
|
+
return;
|
|
1847
|
+
if (!u) {
|
|
1848
|
+
console.warn(
|
|
1849
|
+
"FloatingMenu component is not rendered inside of an editor component or does not have editor prop."
|
|
1850
|
+
);
|
|
1851
|
+
return;
|
|
1852
|
+
}
|
|
1853
|
+
const w = f.current;
|
|
1854
|
+
w.style.visibility = "hidden", w.style.position = "absolute";
|
|
1855
|
+
const b = de({
|
|
1856
|
+
...g.current,
|
|
1857
|
+
editor: u,
|
|
1858
|
+
element: w
|
|
1859
|
+
});
|
|
1860
|
+
u.registerPlugin(b);
|
|
1861
|
+
const S = g.current.pluginKey;
|
|
1862
|
+
return y.current = !0, v(!0), () => {
|
|
1863
|
+
v(!1), u.unregisterPlugin(S), window.requestAnimationFrame(() => {
|
|
1864
|
+
w.parentNode && w.parentNode.removeChild(w);
|
|
1865
|
+
});
|
|
1866
|
+
};
|
|
1867
|
+
}, [u]), it(() => {
|
|
1868
|
+
if (!(!m || !u || u.isDestroyed)) {
|
|
1869
|
+
if (y.current) {
|
|
1870
|
+
y.current = !1;
|
|
1871
|
+
return;
|
|
1872
|
+
}
|
|
1873
|
+
u.view.dispatch(
|
|
1874
|
+
u.state.tr.setMeta(a, {
|
|
1875
|
+
type: "updateOptions",
|
|
1876
|
+
options: g.current
|
|
1877
|
+
})
|
|
1878
|
+
);
|
|
1879
|
+
}
|
|
1880
|
+
}, [m, u, n, o, s, r, i, a]), kt(l, f.current);
|
|
1881
|
+
}
|
|
1882
|
+
);
|
|
1883
|
+
const Ki = ({ editor: t }) => {
|
|
1884
|
+
const e = be({
|
|
1885
|
+
editor: t,
|
|
1886
|
+
selector: ({ editor: i }) => i ? {
|
|
1887
|
+
isHeading1: i.isActive("heading", { level: 1 }),
|
|
1888
|
+
isHeading2: i.isActive("heading", { level: 2 }),
|
|
1889
|
+
isHeading3: i.isActive("heading", { level: 3 }),
|
|
1890
|
+
isBold: i.isActive("bold"),
|
|
1891
|
+
isItalic: i.isActive("italic"),
|
|
1892
|
+
isStrike: i.isActive("strike"),
|
|
1893
|
+
isCode: i.isActive("code")
|
|
1894
|
+
} : null
|
|
1895
|
+
}), n = Re(
|
|
1896
|
+
(i, s) => {
|
|
1897
|
+
i.preventDefault(), s();
|
|
1898
|
+
},
|
|
1899
|
+
[]
|
|
1900
|
+
), o = [
|
|
1901
|
+
{
|
|
1902
|
+
ariaLabel: "Heading 1",
|
|
1903
|
+
command: () => t.chain().focus().toggleHeading({ level: 1 }).run(),
|
|
1904
|
+
isActive: () => !!e?.isHeading1,
|
|
1905
|
+
icon: /* @__PURE__ */ E(
|
|
1906
|
+
"svg",
|
|
1907
|
+
{
|
|
1908
|
+
className: "scribe-inline-menu-icon",
|
|
1909
|
+
viewBox: "0 0 24 24",
|
|
1910
|
+
fill: "none",
|
|
1911
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1912
|
+
children: /* @__PURE__ */ E(
|
|
1913
|
+
"path",
|
|
1914
|
+
{
|
|
1915
|
+
d: "M4.00023 5L4 17M13 5L12.9998 17M4 11H12.9998M19.875 19V10L17.625 12.25",
|
|
1916
|
+
strokeWidth: "1.5",
|
|
1917
|
+
strokeLinecap: "round",
|
|
1918
|
+
strokeLinejoin: "round"
|
|
1919
|
+
}
|
|
1920
|
+
)
|
|
1921
|
+
}
|
|
1922
|
+
)
|
|
1923
|
+
},
|
|
1924
|
+
{
|
|
1925
|
+
ariaLabel: "Heading 2",
|
|
1926
|
+
command: () => t.chain().focus().toggleHeading({ level: 2 }).run(),
|
|
1927
|
+
isActive: () => !!e?.isHeading2,
|
|
1928
|
+
icon: /* @__PURE__ */ E(
|
|
1929
|
+
"svg",
|
|
1930
|
+
{
|
|
1931
|
+
fill: "none",
|
|
1932
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1933
|
+
className: "scribe-inline-menu-icon",
|
|
1934
|
+
viewBox: "0 0 24 24",
|
|
1935
|
+
children: /* @__PURE__ */ E(
|
|
1936
|
+
"path",
|
|
1937
|
+
{
|
|
1938
|
+
d: "M3.37402 5V17M12.374 5V17M3.37402 11H12.374M16.302 11.373C16.5035 10.8941 16.8644 10.4997 17.3236 10.2566C17.7829 10.0136 18.312 9.93705 18.8213 10.0399C19.3306 10.1427 19.7886 10.4186 20.1175 10.8207C20.4465 11.2229 20.6262 11.7265 20.626 12.246C20.628 12.694 20.494 13.132 20.242 13.503L16.123 19H20.626",
|
|
1939
|
+
strokeWidth: "1.5",
|
|
1940
|
+
strokeLinecap: "round",
|
|
1941
|
+
strokeLinejoin: "round"
|
|
1942
|
+
}
|
|
1943
|
+
)
|
|
1944
|
+
}
|
|
1945
|
+
)
|
|
1946
|
+
},
|
|
1947
|
+
{
|
|
1948
|
+
ariaLabel: "Heading 3",
|
|
1949
|
+
command: () => t.chain().focus().toggleHeading({ level: 3 }).run(),
|
|
1950
|
+
isActive: () => !!e?.isHeading3,
|
|
1951
|
+
icon: /* @__PURE__ */ E(
|
|
1952
|
+
"svg",
|
|
1953
|
+
{
|
|
1954
|
+
className: "scribe-inline-menu-icon",
|
|
1955
|
+
viewBox: "0 0 24 24",
|
|
1956
|
+
fill: "none",
|
|
1957
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1958
|
+
children: /* @__PURE__ */ E(
|
|
1959
|
+
"path",
|
|
1960
|
+
{
|
|
1961
|
+
d: "M3.375 5V17M12.375 5V17M3.375 11H12.375M16.125 10H20.625L18 13.75C18.4317 13.7499 18.8568 13.8564 19.2375 14.0598C19.6183 14.2633 19.943 14.5575 20.1828 14.9165C20.4227 15.2754 20.5703 15.688 20.6127 16.1176C20.655 16.5472 20.5907 16.9807 20.4255 17.3795C20.2603 17.7783 19.9993 18.1303 19.6656 18.4042C19.3319 18.678 18.9358 18.8654 18.5123 18.9496C18.0889 19.0338 17.6513 19.0123 17.2382 18.8869C16.8251 18.7616 16.4492 18.5363 16.144 18.231",
|
|
1962
|
+
strokeWidth: "1.5",
|
|
1963
|
+
strokeLinecap: "round",
|
|
1964
|
+
strokeLinejoin: "round"
|
|
1965
|
+
}
|
|
1966
|
+
)
|
|
1967
|
+
}
|
|
1968
|
+
)
|
|
1969
|
+
},
|
|
1970
|
+
{
|
|
1971
|
+
ariaLabel: "Bold",
|
|
1972
|
+
command: () => t.chain().focus().toggleBold().run(),
|
|
1973
|
+
isActive: () => !!e?.isBold,
|
|
1974
|
+
icon: /* @__PURE__ */ E(
|
|
1975
|
+
"svg",
|
|
1976
|
+
{
|
|
1977
|
+
className: "scribe-inline-menu-icon",
|
|
1978
|
+
viewBox: "0 0 24 24",
|
|
1979
|
+
fill: "none",
|
|
1980
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1981
|
+
children: /* @__PURE__ */ E(
|
|
1982
|
+
"path",
|
|
1983
|
+
{
|
|
1984
|
+
d: "M12.8571 12C13.918 12 14.9354 11.5786 15.6856 10.8284C16.4357 10.0783 16.8571 9.06087 16.8571 8C16.8571 6.93913 16.4357 5.92172 15.6856 5.17157C14.9354 4.42143 13.918 4 12.8571 4H6V12M12.8571 12H6M12.8571 12H14C15.0609 12 16.0783 12.4214 16.8284 13.1716C17.5786 13.9217 18 14.9391 18 16C18 17.0609 17.5786 18.0783 16.8284 18.8284C16.0783 19.5786 15.0609 20 14 20H6V12",
|
|
1985
|
+
strokeWidth: "1.5",
|
|
1986
|
+
strokeLinecap: "round",
|
|
1987
|
+
strokeLinejoin: "round"
|
|
1988
|
+
}
|
|
1989
|
+
)
|
|
1990
|
+
}
|
|
1991
|
+
)
|
|
1992
|
+
},
|
|
1993
|
+
{
|
|
1994
|
+
ariaLabel: "Italic",
|
|
1995
|
+
command: () => t.chain().focus().toggleItalic().run(),
|
|
1996
|
+
isActive: () => !!e?.isItalic,
|
|
1997
|
+
icon: /* @__PURE__ */ E(
|
|
1998
|
+
"svg",
|
|
1999
|
+
{
|
|
2000
|
+
className: "scribe-inline-menu-icon",
|
|
2001
|
+
viewBox: "0 0 24 24",
|
|
2002
|
+
fill: "none",
|
|
2003
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2004
|
+
children: /* @__PURE__ */ E(
|
|
2005
|
+
"path",
|
|
2006
|
+
{
|
|
2007
|
+
d: "M10.8571 4H17.7142M6.28564 20H13.1428M14.2856 4L9.71422 20",
|
|
2008
|
+
strokeWidth: "1.5",
|
|
2009
|
+
strokeLinecap: "round",
|
|
2010
|
+
strokeLinejoin: "round"
|
|
2011
|
+
}
|
|
2012
|
+
)
|
|
2013
|
+
}
|
|
2014
|
+
)
|
|
2015
|
+
},
|
|
2016
|
+
{
|
|
2017
|
+
ariaLabel: "Strike",
|
|
2018
|
+
command: () => t.chain().focus().toggleStrike().run(),
|
|
2019
|
+
isActive: () => !!e?.isStrike,
|
|
2020
|
+
icon: /* @__PURE__ */ E(
|
|
2021
|
+
"svg",
|
|
2022
|
+
{
|
|
2023
|
+
className: "scribe-inline-menu-icon",
|
|
2024
|
+
viewBox: "0 0 24 24",
|
|
2025
|
+
fill: "none",
|
|
2026
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2027
|
+
children: /* @__PURE__ */ E(
|
|
2028
|
+
"path",
|
|
2029
|
+
{
|
|
2030
|
+
d: "M11.0121 12H12.9874C15.1693 12 16.938 13.7909 16.938 16C16.938 18.2091 15.1693 20 12.9874 20H11.0121C8.83024 20 7.06149 18.2091 7.06149 16M16.938 8C16.938 5.79086 15.1693 4 12.9874 4H11.0121C8.83024 4 7.06149 5.79086 7.06149 8C7.06149 8.3453 7.1047 8.68038 7.18595 9M4 12H20",
|
|
2031
|
+
strokeWidth: "1.5",
|
|
2032
|
+
strokeLinecap: "round",
|
|
2033
|
+
strokeLinejoin: "round"
|
|
2034
|
+
}
|
|
2035
|
+
)
|
|
2036
|
+
}
|
|
2037
|
+
)
|
|
2038
|
+
},
|
|
2039
|
+
{
|
|
2040
|
+
ariaLabel: "Inline code",
|
|
2041
|
+
command: () => t.chain().focus().toggleCode().run(),
|
|
2042
|
+
isActive: () => !!e?.isCode,
|
|
2043
|
+
icon: /* @__PURE__ */ E(
|
|
2044
|
+
"svg",
|
|
2045
|
+
{
|
|
2046
|
+
className: "scribe-inline-menu-icon",
|
|
2047
|
+
viewBox: "0 0 24 24",
|
|
2048
|
+
fill: "none",
|
|
2049
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2050
|
+
children: /* @__PURE__ */ E(
|
|
2051
|
+
"path",
|
|
2052
|
+
{
|
|
2053
|
+
d: "M16.5 16.5L21 12L16.5 7.50002M7.5 7.50002L3 12L7.5 16.5M13.8 3.90002L10.2 20.1",
|
|
2054
|
+
strokeWidth: "1.5",
|
|
2055
|
+
strokeLinecap: "round",
|
|
2056
|
+
strokeLinejoin: "round"
|
|
2057
|
+
}
|
|
2058
|
+
)
|
|
2059
|
+
}
|
|
2060
|
+
)
|
|
2061
|
+
}
|
|
2062
|
+
];
|
|
2063
|
+
return /* @__PURE__ */ E(
|
|
2064
|
+
Bi,
|
|
2065
|
+
{
|
|
2066
|
+
editor: t,
|
|
2067
|
+
appendTo: Ie(t),
|
|
2068
|
+
options: { strategy: "fixed" },
|
|
2069
|
+
children: /* @__PURE__ */ E("div", { className: "scribe-bubble-menu", children: /* @__PURE__ */ E(ve, { align: "center", gap: "2", children: o.map((i) => /* @__PURE__ */ E(
|
|
2070
|
+
ye,
|
|
2071
|
+
{
|
|
2072
|
+
type: "button",
|
|
2073
|
+
size: "1",
|
|
2074
|
+
radius: "medium",
|
|
2075
|
+
color: "gray",
|
|
2076
|
+
variant: i.isActive() ? "soft" : "ghost",
|
|
2077
|
+
onMouseDown: (s) => n(s, i.command),
|
|
2078
|
+
children: i.icon
|
|
2079
|
+
},
|
|
2080
|
+
i.ariaLabel
|
|
2081
|
+
)) }) })
|
|
2082
|
+
}
|
|
2083
|
+
);
|
|
2084
|
+
};
|
|
174
2085
|
export {
|
|
175
|
-
|
|
2086
|
+
Ki as default
|
|
176
2087
|
};
|