@remarkablejames/editor 0.0.2 → 0.0.4
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/lib/{ActionMenuButton-Bmn3RME4.js → ActionMenuButton-BUtJUsfO.js} +9 -10
- package/lib/ActionMenuButton-M55VtCZ5.cjs +1 -0
- package/lib/Attachment.cjs +2 -2
- package/lib/Attachment.js +166 -133
- package/lib/Blockquote.cjs +2 -2
- package/lib/Blockquote.js +13 -12
- package/lib/Bold.cjs +1 -1
- package/lib/Bold.js +11 -10
- package/lib/BulletList.cjs +1 -1
- package/lib/BulletList.js +9 -8
- package/lib/Callout.cjs +1 -1
- package/lib/Callout.js +42 -46
- package/lib/Clear.cjs +1 -1
- package/lib/Clear.js +13 -14
- package/lib/Code.cjs +1 -1
- package/lib/Code.js +6 -5
- package/lib/CodeBlock.cjs +1 -1
- package/lib/CodeBlock.js +30 -31
- package/lib/CodeView.cjs +1 -1
- package/lib/CodeView.js +9 -8
- package/lib/Color.cjs +1 -1
- package/lib/Color.js +18 -19
- package/lib/Column.cjs +1 -1
- package/lib/Column.js +9 -8
- package/lib/Drawer-CdQBnwUs.cjs +2 -0
- package/lib/{Drawer-DvGh9aXG.js → Drawer-mlmJ2nCT.js} +41 -47
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.js +3 -3
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.js +15 -16
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.js +24 -28
- package/lib/ExportPdf.cjs +3 -3
- package/lib/ExportPdf.js +14 -13
- package/lib/ExportWord.cjs +1 -1
- package/lib/ExportWord.js +6 -6
- package/lib/FontFamily.cjs +1 -1
- package/lib/FontFamily.js +8 -7
- package/lib/FontSize.cjs +1 -1
- package/lib/FontSize.js +16 -15
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.js +27 -27
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.js +22 -23
- package/lib/History.cjs +1 -1
- package/lib/History.js +11 -11
- package/lib/HorizontalRule.cjs +1 -1
- package/lib/HorizontalRule.js +10 -9
- package/lib/Iframe-B_a_AoZc.cjs +1 -0
- package/lib/{Iframe-CnnvV6cK.js → Iframe-CYgR99Ny.js} +11 -13
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.js +2 -2
- package/lib/Image.cjs +1 -1
- package/lib/Image.js +4 -5
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.js +79 -82
- package/lib/ImportWord.cjs +1 -1
- package/lib/ImportWord.js +26 -27
- package/lib/Indent-BAcoFdaq.cjs +1 -0
- package/lib/{Indent-Bsj8gKvT.js → Indent-BMz2ILRl.js} +31 -30
- package/lib/Indent.cjs +1 -1
- package/lib/Indent.js +2 -2
- package/lib/Italic.cjs +1 -1
- package/lib/Italic.js +12 -11
- package/lib/{Katex-CilGTz7u.js → Katex-DOlb4iTP.js} +19 -22
- package/lib/Katex-bIhj82VV.cjs +4 -0
- package/lib/Katex.cjs +1 -1
- package/lib/Katex.js +2 -2
- package/lib/LineHeight.cjs +1 -1
- package/lib/LineHeight.js +19 -20
- package/lib/Link.cjs +1 -1
- package/lib/Link.js +2 -2
- package/lib/LinkEditBlock-Cqs5RxjV.cjs +5 -0
- package/lib/{LinkEditBlock-BD_WvA3r.js → LinkEditBlock-xnokk4G7.js} +19 -24
- package/lib/Mention.js +3 -3
- package/lib/{Mermaid-BrjU75Bs.js → Mermaid-Bs3pIGc6.js} +45 -48
- package/lib/Mermaid-DiOdgQv1.cjs +2 -0
- package/lib/Mermaid.cjs +1 -1
- package/lib/Mermaid.js +2 -2
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.js +26 -28
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.js +11 -10
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.js +37 -42
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.js +6 -6
- package/lib/SlashCommandNodeView-CLimjqhb.cjs +1 -0
- package/lib/{SlashCommandNodeView-COx5qZ2y.js → SlashCommandNodeView-CYcf7mVz.js} +67 -79
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.js +12 -11
- package/lib/{Table-BlM8yMhr.js → Table-bz1Wcojf.js} +47 -47
- package/lib/Table-dlXTKKwJ.cjs +5 -0
- package/lib/Table.cjs +1 -1
- package/lib/Table.js +1 -1
- package/lib/TaskList.cjs +1 -1
- package/lib/TaskList.js +12 -11
- package/lib/TextAlign.cjs +1 -1
- package/lib/TextAlign.js +26 -27
- package/lib/TextDirection.cjs +1 -1
- package/lib/TextDirection.js +18 -19
- package/lib/TextUnderline.cjs +1 -1
- package/lib/TextUnderline.js +9 -8
- package/lib/{Twitter-BP8sYXX7.js → Twitter-CNTXzgt0.js} +18 -22
- package/lib/Twitter-DhEnGg6P.cjs +1 -0
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.js +2 -2
- package/lib/Video.cjs +1 -1
- package/lib/Video.js +5 -6
- package/lib/bubble.cjs +3 -3
- package/lib/bubble.js +78 -87
- package/lib/{clsx-m_C5j3RU.js → clsx-CDyrfCnw.js} +24 -24
- package/lib/{dropdown-menu-C1hdPLCZ.js → dropdown-menu-BuSlU2uN.js} +1 -1
- package/lib/{dropdown-menu-CkHN04Mx.cjs → dropdown-menu-CfWNst4v.cjs} +1 -1
- package/lib/extensions/Attachment/Attachment.d.ts +22 -2
- package/lib/extensions/Image/Image.d.ts +11 -0
- package/lib/extensions/Image/components/ImageCropper.d.ts +1 -1
- package/lib/index-8B00E8e4.js +5055 -0
- package/lib/index-BrxL7y9p.cjs +1 -0
- package/lib/index-Bt9LiArC.cjs +10 -0
- package/lib/{index-B3Ijnbxs.js → index-C-tDsIKJ.js} +1 -1
- package/lib/{index-C1KQsOcg.js → index-C1WCZhyA.js} +1 -1
- package/lib/{index-C8FjP66D.js → index-CsSfYR30.js} +1 -1
- package/lib/{index-4Q5IhypJ.js → index-DZfkCNKr.js} +15 -9
- package/lib/{index-s3l5RdyW.js → index-DjDf4BK8.js} +1 -1
- package/lib/index.cjs +4 -4
- package/lib/index.js +147 -392
- package/lib/locale-bundle.cjs +1 -1
- package/lib/locale-bundle.js +1 -1
- package/lib/locales/en.d.ts +189 -188
- package/lib/locales/fi.d.ts +189 -188
- package/lib/locales/hu.d.ts +189 -188
- package/lib/locales/index.d.ts +1134 -1128
- package/lib/locales/pt-br.d.ts +189 -188
- package/lib/locales/vi.d.ts +189 -188
- package/lib/locales/zh-cn.d.ts +189 -188
- package/lib/{popover-B05Fd8lC.cjs → popover-51mwx3UY.cjs} +1 -1
- package/lib/{popover-CsSXh7w6.js → popover-DMPRgXD3.js} +1 -1
- package/lib/{renderNodeView-C_hPIdEs.js → renderNodeView-BJSrgyGj.js} +2 -2
- package/lib/{select-7ubC1NF0.cjs → select-B7v1Scb-.cjs} +1 -1
- package/lib/{select-B3-5wTqn.js → select-BxFDMaZi.js} +1 -1
- package/lib/{separator-CYCA8tSn.js → separator-CpqX9KQC.js} +12 -13
- package/lib/separator-kB9YUfeO.cjs +1 -0
- package/lib/style.css +1 -1
- package/lib/{textarea-1FhpmBkP.js → textarea-C5DsgzSy.js} +1 -1
- package/lib/{textarea-Bjhcpp76.cjs → textarea-bQSzjqg3.cjs} +1 -1
- package/lib/theme/theme.d.ts +1 -1
- package/lib/{updatePosition-DvfTZHcH.js → updatePosition-e90ZrFWW.js} +2 -2
- package/package.json +1 -1
- package/lib/ActionMenuButton-C5P0Kzrb.cjs +0 -1
- package/lib/Drawer-gz9U5ArC.cjs +0 -2
- package/lib/Icon-CKM0tYbW.js +0 -15
- package/lib/Icon-CQyFgXeo.cjs +0 -1
- package/lib/Iframe-Ds6gG2YO.cjs +0 -1
- package/lib/ImageCropper-BKhXlnXN.cjs +0 -1
- package/lib/ImageCropper-DUzu_9-6.js +0 -896
- package/lib/Indent-D_7HOYYd.cjs +0 -1
- package/lib/Katex-lL3bHXJd.cjs +0 -4
- package/lib/LinkEditBlock-D3HSHmsU.cjs +0 -5
- package/lib/Mermaid-BfeLPzoS.cjs +0 -2
- package/lib/SlashCommandNodeView-DD-nlhM-.cjs +0 -1
- package/lib/Table-C21AlUrh.cjs +0 -5
- package/lib/Twitter-D46MnvPr.cjs +0 -1
- package/lib/Video-Bpd8W8l6.js +0 -231
- package/lib/Video-BwrHx6B1.cjs +0 -1
- package/lib/button-BmTP96NR.cjs +0 -1
- package/lib/button-CDIxPURh.js +0 -35
- package/lib/checkbox-7sfSdzy9.js +0 -29
- package/lib/checkbox-DyVlLWHv.cjs +0 -1
- package/lib/dialog-B-jOQ5i3.cjs +0 -1
- package/lib/dialog-QWWUWOGP.js +0 -95
- package/lib/events.constant-Bh2uzJud.js +0 -71
- package/lib/events.constant-ELn21EzG.cjs +0 -1
- package/lib/file-BLas99n7.js +0 -43
- package/lib/file-i7e4nQY2.cjs +0 -1
- package/lib/index-CAiZY1nx.js +0 -2741
- package/lib/index-DWSAk_9a.cjs +0 -1
- package/lib/index-bVGIXhRg.cjs +0 -1
- package/lib/input-qvpuOf-3.js +0 -21
- package/lib/input-s0JD5kf2.cjs +0 -1
- package/lib/isNumber-BTYSVlKo.cjs +0 -1
- package/lib/isNumber-WaBzl_0s.js +0 -15
- package/lib/label-CFax-gzo.cjs +0 -1
- package/lib/label-DC37f2RQ.js +0 -11
- package/lib/separator-ncbdw4oq.cjs +0 -1
- package/lib/tabs-BeHxylKH.js +0 -46
- package/lib/tabs-DBqNpGAq.cjs +0 -1
- package/lib/throttle-CRNq0z-O.js +0 -249
- package/lib/throttle-gTTvqDTW.cjs +0 -1
- package/lib/toggle-DoJTBdvy.js +0 -89
- package/lib/toggle-oFwBZC4x.cjs +0 -1
- package/lib/useButtonProps-BE10eHkG.js +0 -165
- package/lib/useButtonProps-CFu0GHzW.cjs +0 -1
package/lib/throttle-CRNq0z-O.js
DELETED
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
import { N as C, n as L, a2 as W, m as z } from "./clsx-m_C5j3RU.js";
|
|
2
|
-
var B = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/, H = C.create({
|
|
3
|
-
name: "image",
|
|
4
|
-
addOptions() {
|
|
5
|
-
return {
|
|
6
|
-
inline: !1,
|
|
7
|
-
allowBase64: !1,
|
|
8
|
-
HTMLAttributes: {},
|
|
9
|
-
resize: !1
|
|
10
|
-
};
|
|
11
|
-
},
|
|
12
|
-
inline() {
|
|
13
|
-
return this.options.inline;
|
|
14
|
-
},
|
|
15
|
-
group() {
|
|
16
|
-
return this.options.inline ? "inline" : "block";
|
|
17
|
-
},
|
|
18
|
-
draggable: !0,
|
|
19
|
-
addAttributes() {
|
|
20
|
-
return {
|
|
21
|
-
src: {
|
|
22
|
-
default: null
|
|
23
|
-
},
|
|
24
|
-
alt: {
|
|
25
|
-
default: null
|
|
26
|
-
},
|
|
27
|
-
title: {
|
|
28
|
-
default: null
|
|
29
|
-
},
|
|
30
|
-
width: {
|
|
31
|
-
default: null
|
|
32
|
-
},
|
|
33
|
-
height: {
|
|
34
|
-
default: null
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
},
|
|
38
|
-
parseHTML() {
|
|
39
|
-
return [
|
|
40
|
-
{
|
|
41
|
-
tag: this.options.allowBase64 ? "img[src]" : 'img[src]:not([src^="data:"])'
|
|
42
|
-
}
|
|
43
|
-
];
|
|
44
|
-
},
|
|
45
|
-
renderHTML({ HTMLAttributes: e }) {
|
|
46
|
-
return ["img", z(this.options.HTMLAttributes, e)];
|
|
47
|
-
},
|
|
48
|
-
parseMarkdown: (e, t) => t.createNode("image", {
|
|
49
|
-
src: e.href,
|
|
50
|
-
title: e.title,
|
|
51
|
-
alt: e.text
|
|
52
|
-
}),
|
|
53
|
-
renderMarkdown: (e) => {
|
|
54
|
-
var t, n, r, a, c, u;
|
|
55
|
-
const o = (n = (t = e.attrs) == null ? void 0 : t.src) != null ? n : "", s = (a = (r = e.attrs) == null ? void 0 : r.alt) != null ? a : "", d = (u = (c = e.attrs) == null ? void 0 : c.title) != null ? u : "";
|
|
56
|
-
return d ? `` : ``;
|
|
57
|
-
},
|
|
58
|
-
addNodeView() {
|
|
59
|
-
if (!this.options.resize || !this.options.resize.enabled || typeof document > "u")
|
|
60
|
-
return null;
|
|
61
|
-
const { directions: e, minWidth: t, minHeight: n, alwaysPreserveAspectRatio: r } = this.options.resize;
|
|
62
|
-
return ({ node: a, getPos: c, HTMLAttributes: u, editor: o }) => {
|
|
63
|
-
const s = document.createElement("img");
|
|
64
|
-
Object.entries(u).forEach(([l, f]) => {
|
|
65
|
-
if (f != null)
|
|
66
|
-
switch (l) {
|
|
67
|
-
case "width":
|
|
68
|
-
case "height":
|
|
69
|
-
break;
|
|
70
|
-
default:
|
|
71
|
-
s.setAttribute(l, f);
|
|
72
|
-
break;
|
|
73
|
-
}
|
|
74
|
-
}), s.src = u.src;
|
|
75
|
-
const d = new W({
|
|
76
|
-
element: s,
|
|
77
|
-
editor: o,
|
|
78
|
-
node: a,
|
|
79
|
-
getPos: c,
|
|
80
|
-
onResize: (l, f) => {
|
|
81
|
-
s.style.width = `${l}px`, s.style.height = `${f}px`;
|
|
82
|
-
},
|
|
83
|
-
onCommit: (l, f) => {
|
|
84
|
-
const b = c();
|
|
85
|
-
b !== void 0 && this.editor.chain().setNodeSelection(b).updateAttributes(this.name, {
|
|
86
|
-
width: l,
|
|
87
|
-
height: f
|
|
88
|
-
}).run();
|
|
89
|
-
},
|
|
90
|
-
onUpdate: (l, f, b) => l.type === a.type,
|
|
91
|
-
options: {
|
|
92
|
-
directions: e,
|
|
93
|
-
min: {
|
|
94
|
-
width: t,
|
|
95
|
-
height: n
|
|
96
|
-
},
|
|
97
|
-
preserveAspectRatio: r === !0
|
|
98
|
-
}
|
|
99
|
-
}), m = d.dom;
|
|
100
|
-
return m.style.visibility = "hidden", m.style.pointerEvents = "none", s.onload = () => {
|
|
101
|
-
m.style.visibility = "", m.style.pointerEvents = "";
|
|
102
|
-
}, d;
|
|
103
|
-
};
|
|
104
|
-
},
|
|
105
|
-
addCommands() {
|
|
106
|
-
return {
|
|
107
|
-
setImage: (e) => ({ commands: t }) => t.insertContent({
|
|
108
|
-
type: this.name,
|
|
109
|
-
attrs: e
|
|
110
|
-
})
|
|
111
|
-
};
|
|
112
|
-
},
|
|
113
|
-
addInputRules() {
|
|
114
|
-
return [
|
|
115
|
-
L({
|
|
116
|
-
find: B,
|
|
117
|
-
type: this.type,
|
|
118
|
-
getAttributes: (e) => {
|
|
119
|
-
const [, , t, n, r] = e;
|
|
120
|
-
return { src: n, alt: t, title: r };
|
|
121
|
-
}
|
|
122
|
-
})
|
|
123
|
-
];
|
|
124
|
-
}
|
|
125
|
-
}), be = H, P = typeof global == "object" && global && global.Object === Object && global, F = typeof self == "object" && self && self.Object === Object && self, R = P || F || Function("return this")(), T = R.Symbol, _ = Object.prototype, U = _.hasOwnProperty, V = _.toString, h = T ? T.toStringTag : void 0;
|
|
126
|
-
function D(e) {
|
|
127
|
-
var t = U.call(e, h), n = e[h];
|
|
128
|
-
try {
|
|
129
|
-
e[h] = void 0;
|
|
130
|
-
var r = !0;
|
|
131
|
-
} catch {
|
|
132
|
-
}
|
|
133
|
-
var a = V.call(e);
|
|
134
|
-
return r && (t ? e[h] = n : delete e[h]), a;
|
|
135
|
-
}
|
|
136
|
-
var G = Object.prototype, X = G.toString;
|
|
137
|
-
function q(e) {
|
|
138
|
-
return X.call(e);
|
|
139
|
-
}
|
|
140
|
-
var J = "[object Null]", K = "[object Undefined]", E = T ? T.toStringTag : void 0;
|
|
141
|
-
function Q(e) {
|
|
142
|
-
return e == null ? e === void 0 ? K : J : E && E in Object(e) ? D(e) : q(e);
|
|
143
|
-
}
|
|
144
|
-
function Y(e) {
|
|
145
|
-
return e != null && typeof e == "object";
|
|
146
|
-
}
|
|
147
|
-
var Z = "[object Symbol]";
|
|
148
|
-
function ee(e) {
|
|
149
|
-
return typeof e == "symbol" || Y(e) && Q(e) == Z;
|
|
150
|
-
}
|
|
151
|
-
var te = /\s/;
|
|
152
|
-
function ne(e) {
|
|
153
|
-
for (var t = e.length; t-- && te.test(e.charAt(t)); )
|
|
154
|
-
;
|
|
155
|
-
return t;
|
|
156
|
-
}
|
|
157
|
-
var re = /^\s+/;
|
|
158
|
-
function ie(e) {
|
|
159
|
-
return e && e.slice(0, ne(e) + 1).replace(re, "");
|
|
160
|
-
}
|
|
161
|
-
function v(e) {
|
|
162
|
-
var t = typeof e;
|
|
163
|
-
return e != null && (t == "object" || t == "function");
|
|
164
|
-
}
|
|
165
|
-
var I = NaN, ae = /^[-+]0x[0-9a-f]+$/i, oe = /^0b[01]+$/i, se = /^0o[0-7]+$/i, le = parseInt;
|
|
166
|
-
function $(e) {
|
|
167
|
-
if (typeof e == "number")
|
|
168
|
-
return e;
|
|
169
|
-
if (ee(e))
|
|
170
|
-
return I;
|
|
171
|
-
if (v(e)) {
|
|
172
|
-
var t = typeof e.valueOf == "function" ? e.valueOf() : e;
|
|
173
|
-
e = v(t) ? t + "" : t;
|
|
174
|
-
}
|
|
175
|
-
if (typeof e != "string")
|
|
176
|
-
return e === 0 ? e : +e;
|
|
177
|
-
e = ie(e);
|
|
178
|
-
var n = oe.test(e);
|
|
179
|
-
return n || se.test(e) ? le(e.slice(2), n ? 2 : 8) : ae.test(e) ? I : +e;
|
|
180
|
-
}
|
|
181
|
-
var S = function() {
|
|
182
|
-
return R.Date.now();
|
|
183
|
-
}, ue = "Expected a function", ce = Math.max, de = Math.min;
|
|
184
|
-
function fe(e, t, n) {
|
|
185
|
-
var r, a, c, u, o, s, d = 0, m = !1, l = !1, f = !0;
|
|
186
|
-
if (typeof e != "function")
|
|
187
|
-
throw new TypeError(ue);
|
|
188
|
-
t = $(t) || 0, v(n) && (m = !!n.leading, l = "maxWait" in n, c = l ? ce($(n.maxWait) || 0, t) : c, f = "trailing" in n ? !!n.trailing : f);
|
|
189
|
-
function b(i) {
|
|
190
|
-
var g = r, p = a;
|
|
191
|
-
return r = a = void 0, d = i, u = e.apply(p, g), u;
|
|
192
|
-
}
|
|
193
|
-
function A(i) {
|
|
194
|
-
return d = i, o = setTimeout(y, t), m ? b(i) : u;
|
|
195
|
-
}
|
|
196
|
-
function N(i) {
|
|
197
|
-
var g = i - s, p = i - d, w = t - g;
|
|
198
|
-
return l ? de(w, c - p) : w;
|
|
199
|
-
}
|
|
200
|
-
function O(i) {
|
|
201
|
-
var g = i - s, p = i - d;
|
|
202
|
-
return s === void 0 || g >= t || g < 0 || l && p >= c;
|
|
203
|
-
}
|
|
204
|
-
function y() {
|
|
205
|
-
var i = S();
|
|
206
|
-
if (O(i))
|
|
207
|
-
return x(i);
|
|
208
|
-
o = setTimeout(y, N(i));
|
|
209
|
-
}
|
|
210
|
-
function x(i) {
|
|
211
|
-
return o = void 0, f && r ? b(i) : (r = a = void 0, u);
|
|
212
|
-
}
|
|
213
|
-
function k() {
|
|
214
|
-
o !== void 0 && clearTimeout(o), d = 0, r = s = a = o = void 0;
|
|
215
|
-
}
|
|
216
|
-
function M() {
|
|
217
|
-
return o === void 0 ? u : x(S());
|
|
218
|
-
}
|
|
219
|
-
function j() {
|
|
220
|
-
var i = S(), g = O(i);
|
|
221
|
-
if (r = arguments, a = this, s = i, g) {
|
|
222
|
-
if (o === void 0)
|
|
223
|
-
return A(s);
|
|
224
|
-
if (l)
|
|
225
|
-
return clearTimeout(o), o = setTimeout(y, t), b(s);
|
|
226
|
-
}
|
|
227
|
-
return o === void 0 && (o = setTimeout(y, t)), u;
|
|
228
|
-
}
|
|
229
|
-
return j.cancel = k, j.flush = M, j;
|
|
230
|
-
}
|
|
231
|
-
var ge = "Expected a function";
|
|
232
|
-
function pe(e, t, n) {
|
|
233
|
-
var r = !0, a = !0;
|
|
234
|
-
if (typeof e != "function")
|
|
235
|
-
throw new TypeError(ge);
|
|
236
|
-
return v(n) && (r = "leading" in n ? !!n.leading : r, a = "trailing" in n ? !!n.trailing : a), fe(e, t, {
|
|
237
|
-
leading: r,
|
|
238
|
-
maxWait: t,
|
|
239
|
-
trailing: a
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
export {
|
|
243
|
-
pe as a,
|
|
244
|
-
Q as b,
|
|
245
|
-
be as c,
|
|
246
|
-
fe as d,
|
|
247
|
-
Y as i,
|
|
248
|
-
$ as t
|
|
249
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const T=require("./clsx-CXbNJWDD.cjs");var B=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,H=T.Node3.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:e}){return["img",T.mergeAttributes(this.options.HTMLAttributes,e)]},parseMarkdown:(e,t)=>t.createNode("image",{src:e.href,title:e.title,alt:e.text}),renderMarkdown:e=>{var t,n,r,a,c,u;const o=(n=(t=e.attrs)==null?void 0:t.src)!=null?n:"",s=(a=(r=e.attrs)==null?void 0:r.alt)!=null?a:"",d=(u=(c=e.attrs)==null?void 0:c.title)!=null?u:"";return d?``:``},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:e,minWidth:t,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize;return({node:a,getPos:c,HTMLAttributes:u,editor:o})=>{const s=document.createElement("img");Object.entries(u).forEach(([l,f])=>{if(f!=null)switch(l){case"width":case"height":break;default:s.setAttribute(l,f);break}}),s.src=u.src;const d=new T.ResizableNodeView({element:s,editor:o,node:a,getPos:c,onResize:(l,f)=>{s.style.width=`${l}px`,s.style.height=`${f}px`},onCommit:(l,f)=>{const b=c();b!==void 0&&this.editor.chain().setNodeSelection(b).updateAttributes(this.name,{width:l,height:f}).run()},onUpdate:(l,f,b)=>l.type===a.type,options:{directions:e,min:{width:t,height:n},preserveAspectRatio:r===!0}}),m=d.dom;return m.style.visibility="hidden",m.style.pointerEvents="none",s.onload=()=>{m.style.visibility="",m.style.pointerEvents=""},d}},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[T.nodeInputRule({find:B,type:this.type,getAttributes:e=>{const[,,t,n,r]=e;return{src:n,alt:t,title:r}}})]}}),P=H,F=typeof global=="object"&&global&&global.Object===Object&&global,U=typeof self=="object"&&self&&self.Object===Object&&self,_=F||U||Function("return this")(),v=_.Symbol,A=Object.prototype,G=A.hasOwnProperty,V=A.toString,h=v?v.toStringTag:void 0;function D(e){var t=G.call(e,h),n=e[h];try{e[h]=void 0;var r=!0}catch{}var a=V.call(e);return r&&(t?e[h]=n:delete e[h]),a}var X=Object.prototype,q=X.toString;function J(e){return q.call(e)}var K="[object Null]",Q="[object Undefined]",$=v?v.toStringTag:void 0;function N(e){return e==null?e===void 0?Q:K:$&&$ in Object(e)?D(e):J(e)}function k(e){return e!=null&&typeof e=="object"}var Y="[object Symbol]";function Z(e){return typeof e=="symbol"||k(e)&&N(e)==Y}var ee=/\s/;function te(e){for(var t=e.length;t--&&ee.test(e.charAt(t)););return t}var ne=/^\s+/;function re(e){return e&&e.slice(0,te(e)+1).replace(ne,"")}function j(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var R=NaN,ie=/^[-+]0x[0-9a-f]+$/i,ae=/^0b[01]+$/i,oe=/^0o[0-7]+$/i,se=parseInt;function x(e){if(typeof e=="number")return e;if(Z(e))return R;if(j(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=j(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=re(e);var n=ae.test(e);return n||oe.test(e)?se(e.slice(2),n?2:8):ie.test(e)?R:+e}var S=function(){return _.Date.now()},le="Expected a function",ue=Math.max,ce=Math.min;function L(e,t,n){var r,a,c,u,o,s,d=0,m=!1,l=!1,f=!0;if(typeof e!="function")throw new TypeError(le);t=x(t)||0,j(n)&&(m=!!n.leading,l="maxWait"in n,c=l?ue(x(n.maxWait)||0,t):c,f="trailing"in n?!!n.trailing:f);function b(i){var g=r,p=a;return r=a=void 0,d=i,u=e.apply(p,g),u}function M(i){return d=i,o=setTimeout(y,t),m?b(i):u}function C(i){var g=i-s,p=i-d,I=t-g;return l?ce(I,c-p):I}function w(i){var g=i-s,p=i-d;return s===void 0||g>=t||g<0||l&&p>=c}function y(){var i=S();if(w(i))return E(i);o=setTimeout(y,C(i))}function E(i){return o=void 0,f&&r?b(i):(r=a=void 0,u)}function W(){o!==void 0&&clearTimeout(o),d=0,r=s=a=o=void 0}function z(){return o===void 0?u:E(S())}function O(){var i=S(),g=w(i);if(r=arguments,a=this,s=i,g){if(o===void 0)return M(s);if(l)return clearTimeout(o),o=setTimeout(y,t),b(s)}return o===void 0&&(o=setTimeout(y,t)),u}return O.cancel=W,O.flush=z,O}var de="Expected a function";function fe(e,t,n){var r=!0,a=!0;if(typeof e!="function")throw new TypeError(de);return j(n)&&(r="leading"in n?!!n.leading:r,a="trailing"in n?!!n.trailing:a),L(e,t,{leading:r,maxWait:t,trailing:a})}exports.baseGetTag=N;exports.debounce=L;exports.index_default=P;exports.isObjectLike=k;exports.throttle=fe;exports.toNumber=x;
|
package/lib/toggle-DoJTBdvy.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { jsxs as n, jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { Slot as N } from "@radix-ui/react-slot";
|
|
3
|
-
import * as R from "react";
|
|
4
|
-
import y from "react";
|
|
5
|
-
import { i as w, c as x, a as z } from "./index-CAiZY1nx.js";
|
|
6
|
-
import { T as j, a as k, b as A, g as S } from "./useButtonProps-BE10eHkG.js";
|
|
7
|
-
import * as d from "@radix-ui/react-toggle";
|
|
8
|
-
const F = y.forwardRef(
|
|
9
|
-
(o, c) => {
|
|
10
|
-
const {
|
|
11
|
-
icon: a = void 0,
|
|
12
|
-
// title = undefined,
|
|
13
|
-
tooltip: e = void 0,
|
|
14
|
-
disabled: i = !1,
|
|
15
|
-
customClass: m = "",
|
|
16
|
-
// color = undefined,
|
|
17
|
-
loading: V = void 0,
|
|
18
|
-
shortcutKeys: r = void 0,
|
|
19
|
-
tooltipOptions: p = {},
|
|
20
|
-
action: s = void 0,
|
|
21
|
-
isActive: _ = void 0,
|
|
22
|
-
children: u,
|
|
23
|
-
asChild: g = !1,
|
|
24
|
-
upload: B = !1,
|
|
25
|
-
initialDisplayedColor: H = void 0,
|
|
26
|
-
dataState: v = !1,
|
|
27
|
-
...b
|
|
28
|
-
} = o, l = w[a], C = g ? N : f, T = (h) => {
|
|
29
|
-
if (i) {
|
|
30
|
-
h.preventDefault();
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
s == null || s(h);
|
|
34
|
-
};
|
|
35
|
-
return /* @__PURE__ */ n(j, { children: [
|
|
36
|
-
/* @__PURE__ */ t(k, { asChild: !0, children: /* @__PURE__ */ n(
|
|
37
|
-
C,
|
|
38
|
-
{
|
|
39
|
-
className: x("richtext-h-[32px] richtext-w-[32px]", m),
|
|
40
|
-
"data-state": v ? "on" : "off",
|
|
41
|
-
disabled: i,
|
|
42
|
-
onClick: T,
|
|
43
|
-
ref: c,
|
|
44
|
-
size: "sm",
|
|
45
|
-
...b,
|
|
46
|
-
children: [
|
|
47
|
-
l && /* @__PURE__ */ t(l, { className: "richtext-size-4" }),
|
|
48
|
-
u
|
|
49
|
-
]
|
|
50
|
-
}
|
|
51
|
-
) }),
|
|
52
|
-
e && /* @__PURE__ */ t(A, { ...p, className: "richtext-tooltip", children: /* @__PURE__ */ n("div", { className: "richtext-flex richtext-max-w-24 richtext-flex-col richtext-items-center richtext-text-center", children: [
|
|
53
|
-
/* @__PURE__ */ t("div", { children: e }),
|
|
54
|
-
!!(r != null && r.length) && /* @__PURE__ */ t("span", { children: S(r) })
|
|
55
|
-
] }) })
|
|
56
|
-
] });
|
|
57
|
-
}
|
|
58
|
-
), D = z(
|
|
59
|
-
"richtext-inline-flex richtext-items-center richtext-justify-center richtext-rounded-md richtext-text-sm richtext-font-medium richtext-ring-offset-background richtext-transition-colors hover:richtext-bg-muted hover:richtext-text-muted-foreground focus-visible:richtext-outline-none focus-visible:richtext-ring-2 focus-visible:richtext-ring-ring focus-visible:richtext-ring-offset-1 disabled:richtext-pointer-events-none disabled:richtext-opacity-50 data-[state=on]:richtext-bg-accent data-[state=on]:richtext-text-accent-foreground",
|
|
60
|
-
{
|
|
61
|
-
variants: {
|
|
62
|
-
variant: {
|
|
63
|
-
default: "richtext-bg-transparent",
|
|
64
|
-
outline: "richtext-border richtext-border-input richtext-bg-transparent hover:richtext-bg-accent hover:richtext-text-accent-foreground"
|
|
65
|
-
},
|
|
66
|
-
size: {
|
|
67
|
-
default: "richtext-h-10 richtext-px-3",
|
|
68
|
-
sm: "richtext-h-9 richtext-px-2",
|
|
69
|
-
lg: "richtext-h-11 richtext-px-5"
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
defaultVariants: {
|
|
73
|
-
variant: "default",
|
|
74
|
-
size: "default"
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
), f = R.forwardRef(({ className: o, variant: c, size: a, ...e }, i) => /* @__PURE__ */ t(
|
|
78
|
-
d.Root,
|
|
79
|
-
{
|
|
80
|
-
ref: i,
|
|
81
|
-
className: x(D({ variant: c, size: a, className: o })),
|
|
82
|
-
...e
|
|
83
|
-
}
|
|
84
|
-
));
|
|
85
|
-
f.displayName = d.Root.displayName;
|
|
86
|
-
export {
|
|
87
|
-
F as A,
|
|
88
|
-
f as T
|
|
89
|
-
};
|
package/lib/toggle-oFwBZC4x.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("react/jsx-runtime"),N=require("@radix-ui/react-slot"),u=require("react"),a=require("./index-DWSAk_9a.cjs"),s=require("./useButtonProps-CFu0GHzW.cjs"),R=require("@radix-ui/react-toggle");function f(t){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const c=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(r,i,c.get?c:{enumerable:!0,get:()=>t[i]})}}return r.default=t,Object.freeze(r)}const q=f(u),g=f(R),O=u.forwardRef((t,r)=>{const{icon:i=void 0,tooltip:c=void 0,disabled:o=!1,customClass:p="",loading:w=void 0,shortcutKeys:n=void 0,tooltipOptions:m={},action:l=void 0,isActive:z=void 0,children:v,asChild:b=!1,upload:P=!1,initialDisplayedColor:_=void 0,dataState:j=!1,...T}=t,d=a.icons[i],y=b?N.Slot:x,C=h=>{if(o){h.preventDefault();return}l==null||l(h)};return e.jsxs(s.Tooltip,{children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsxs(y,{className:a.cn("richtext-h-[32px] richtext-w-[32px]",p),"data-state":j?"on":"off",disabled:o,onClick:C,ref:r,size:"sm",...T,children:[d&&e.jsx(d,{className:"richtext-size-4"}),v]})}),c&&e.jsx(s.TooltipContent,{...m,className:"richtext-tooltip",children:e.jsxs("div",{className:"richtext-flex richtext-max-w-24 richtext-flex-col richtext-items-center richtext-text-center",children:[e.jsx("div",{children:c}),!!(n!=null&&n.length)&&e.jsx("span",{children:s.getShortcutKeys(n)})]})})]})}),S=a.cva("richtext-inline-flex richtext-items-center richtext-justify-center richtext-rounded-md richtext-text-sm richtext-font-medium richtext-ring-offset-background richtext-transition-colors hover:richtext-bg-muted hover:richtext-text-muted-foreground focus-visible:richtext-outline-none focus-visible:richtext-ring-2 focus-visible:richtext-ring-ring focus-visible:richtext-ring-offset-1 disabled:richtext-pointer-events-none disabled:richtext-opacity-50 data-[state=on]:richtext-bg-accent data-[state=on]:richtext-text-accent-foreground",{variants:{variant:{default:"richtext-bg-transparent",outline:"richtext-border richtext-border-input richtext-bg-transparent hover:richtext-bg-accent hover:richtext-text-accent-foreground"},size:{default:"richtext-h-10 richtext-px-3",sm:"richtext-h-9 richtext-px-2",lg:"richtext-h-11 richtext-px-5"}},defaultVariants:{variant:"default",size:"default"}}),x=q.forwardRef(({className:t,variant:r,size:i,...c},o)=>e.jsx(g.Root,{ref:o,className:a.cn(S({variant:r,size:i,className:t})),...c}));x.displayName=g.Root.displayName;exports.ActionButton=O;exports.Toggle=x;
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
import { jsx as y } from "react/jsx-runtime";
|
|
2
|
-
import * as d from "@radix-ui/react-tooltip";
|
|
3
|
-
import * as x from "react";
|
|
4
|
-
import { useState as h, useEffect as b, useMemo as u } from "react";
|
|
5
|
-
import { c as C } from "./index-CAiZY1nx.js";
|
|
6
|
-
import { y as T, b as M, S as N } from "./index-BG0kQamI.js";
|
|
7
|
-
import { $ as w, a0 as D } from "./clsx-m_C5j3RU.js";
|
|
8
|
-
import { u as P } from "./index-4Q5IhypJ.js";
|
|
9
|
-
let m;
|
|
10
|
-
function p() {
|
|
11
|
-
return m === void 0 && (m = navigator.platform.includes("Mac")), m;
|
|
12
|
-
}
|
|
13
|
-
function U(t) {
|
|
14
|
-
return `${t}`.toLowerCase() === "mod" ? p() ? "⌘" : "Ctrl" : `${t}`.toLowerCase() === "alt" ? p() ? "⌥" : "Alt" : `${t}`.toLowerCase() === "shift" ? p() ? "⇧" : "Shift" : t;
|
|
15
|
-
}
|
|
16
|
-
function q(t) {
|
|
17
|
-
return t.map(U).join(" ");
|
|
18
|
-
}
|
|
19
|
-
const v = d.Provider, G = d.Root, H = d.Trigger, $ = x.forwardRef(({ className: t, sideOffset: e = 4, ...n }, o) => /* @__PURE__ */ y(
|
|
20
|
-
d.Content,
|
|
21
|
-
{
|
|
22
|
-
"data-richtext-portal": !0,
|
|
23
|
-
ref: o,
|
|
24
|
-
sideOffset: e,
|
|
25
|
-
className: C(
|
|
26
|
-
"richtext-z-50 richtext-overflow-hidden richtext-rounded-md !richtext-border-none richtext-bg-primary richtext-px-3 richtext-py-1.5 richtext-text-sm richtext-text-primary-foreground richtext-shadow-md richtext-animate-in richtext-fade-in-0 richtext-zoom-in-95 data-[side=bottom]:richtext-slide-in-from-top-2 data-[side=left]:richtext-slide-in-from-right-2 data-[side=right]:richtext-slide-in-from-left-2 data-[side=top]:richtext-slide-in-from-bottom-2",
|
|
27
|
-
t
|
|
28
|
-
),
|
|
29
|
-
...n
|
|
30
|
-
}
|
|
31
|
-
));
|
|
32
|
-
$.displayName = d.Content.displayName;
|
|
33
|
-
function L(t) {
|
|
34
|
-
const { editor: e } = w(), n = x.useMemo(
|
|
35
|
-
() => e,
|
|
36
|
-
[t, e]
|
|
37
|
-
);
|
|
38
|
-
return D({
|
|
39
|
-
editor: n,
|
|
40
|
-
selector(r) {
|
|
41
|
-
return r.editor ? {
|
|
42
|
-
editor: r.editor,
|
|
43
|
-
editorState: r.editor.state,
|
|
44
|
-
canCommand: r.editor.can
|
|
45
|
-
} : {
|
|
46
|
-
editor: null,
|
|
47
|
-
editorState: void 0,
|
|
48
|
-
canCommand: void 0
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
}) || { editor: null };
|
|
52
|
-
}
|
|
53
|
-
function f() {
|
|
54
|
-
return L().editor;
|
|
55
|
-
}
|
|
56
|
-
const g = T(!1);
|
|
57
|
-
function S() {
|
|
58
|
-
return M(g);
|
|
59
|
-
}
|
|
60
|
-
function J() {
|
|
61
|
-
return N(g);
|
|
62
|
-
}
|
|
63
|
-
const E = () => !1;
|
|
64
|
-
function Q(t = E) {
|
|
65
|
-
const e = S(), [n, o] = h(() => {
|
|
66
|
-
const i = t();
|
|
67
|
-
return typeof i == "boolean" ? !i : i;
|
|
68
|
-
}), r = f();
|
|
69
|
-
b(() => {
|
|
70
|
-
if (!r || !t) return;
|
|
71
|
-
const i = () => {
|
|
72
|
-
const c = t();
|
|
73
|
-
o(typeof c == "boolean" ? !c : c);
|
|
74
|
-
};
|
|
75
|
-
return i(), r.on("selectionUpdate", i), r.on("transaction", i), () => {
|
|
76
|
-
r.off("selectionUpdate", i), r.off("transaction", i);
|
|
77
|
-
};
|
|
78
|
-
}, [r, t]);
|
|
79
|
-
const a = u(() => !e || !r ? !0 : typeof n == "boolean" ? n : !1, [e, r, n]), s = u(() => !e || !r, [e, r]);
|
|
80
|
-
return {
|
|
81
|
-
disabled: a,
|
|
82
|
-
// can not action, opacity < 1
|
|
83
|
-
dataState: n,
|
|
84
|
-
// true => show background, false => no background
|
|
85
|
-
editorDisabled: s
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
function X(t = E) {
|
|
89
|
-
const e = S(), [n, o] = h({}), [r, a] = h(t()), s = f();
|
|
90
|
-
b(() => {
|
|
91
|
-
if (!s || !t) return;
|
|
92
|
-
const l = () => {
|
|
93
|
-
a(t());
|
|
94
|
-
};
|
|
95
|
-
return l(), s.on("selectionUpdate", l), () => {
|
|
96
|
-
s.off("selectionUpdate", l);
|
|
97
|
-
};
|
|
98
|
-
}, [n, s, t]);
|
|
99
|
-
const i = u(() => !e || !s, [e, s]), c = u(() => !e || !s, [e, s]);
|
|
100
|
-
return {
|
|
101
|
-
disabled: i,
|
|
102
|
-
// can not action, opacity < 1
|
|
103
|
-
dataState: r,
|
|
104
|
-
// true => show background, false => no background
|
|
105
|
-
editorDisabled: c,
|
|
106
|
-
update: () => o({})
|
|
107
|
-
// force update
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
function R(t) {
|
|
111
|
-
const e = f();
|
|
112
|
-
return u(() => e ? e.extensionManager.extensions.find(
|
|
113
|
-
(o) => o.name === t
|
|
114
|
-
) : null, [e, t]);
|
|
115
|
-
}
|
|
116
|
-
function Y(t, e, n) {
|
|
117
|
-
return t < e ? e : t > n ? n : t;
|
|
118
|
-
}
|
|
119
|
-
const j = (t) => typeof t == "number", z = (t) => typeof t == "string", F = (t) => typeof t == "function";
|
|
120
|
-
function Z(t, e = "px") {
|
|
121
|
-
if (!t) return t;
|
|
122
|
-
const n = j(t) ? String(t) : t, o = Number.parseFloat(n), r = n.match(/[%a-z]+$/i), a = r ? r[0] : e;
|
|
123
|
-
return Number.isNaN(o) ? t : o + a;
|
|
124
|
-
}
|
|
125
|
-
function _(t, e) {
|
|
126
|
-
if (!t)
|
|
127
|
-
return !1;
|
|
128
|
-
const { extensions: n = [] } = (t == null ? void 0 : t.extensionManager) ?? {};
|
|
129
|
-
return !!n.find((r) => r.name === e);
|
|
130
|
-
}
|
|
131
|
-
function k(t) {
|
|
132
|
-
return t.map((e) => z(e) ? { value: e, name: e } : e);
|
|
133
|
-
}
|
|
134
|
-
function A(t) {
|
|
135
|
-
const e = f(), n = R(t), { t: o } = P();
|
|
136
|
-
return u(() => {
|
|
137
|
-
if (!e || !n || !o)
|
|
138
|
-
return null;
|
|
139
|
-
const { button: r } = n.options;
|
|
140
|
-
return !r || !F(r) ? null : r({
|
|
141
|
-
editor: e,
|
|
142
|
-
extension: n,
|
|
143
|
-
t: o
|
|
144
|
-
});
|
|
145
|
-
}, [e, n, o]);
|
|
146
|
-
}
|
|
147
|
-
export {
|
|
148
|
-
G as T,
|
|
149
|
-
H as a,
|
|
150
|
-
$ as b,
|
|
151
|
-
X as c,
|
|
152
|
-
Q as d,
|
|
153
|
-
k as e,
|
|
154
|
-
f,
|
|
155
|
-
q as g,
|
|
156
|
-
U as h,
|
|
157
|
-
R as i,
|
|
158
|
-
_ as j,
|
|
159
|
-
Z as k,
|
|
160
|
-
S as l,
|
|
161
|
-
Y as m,
|
|
162
|
-
J as n,
|
|
163
|
-
v as o,
|
|
164
|
-
A as u
|
|
165
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const P=require("react/jsx-runtime"),N=require("@radix-ui/react-tooltip"),i=require("react"),D=require("./index-DWSAk_9a.cjs"),h=require("./index-NsYff_Ni.cjs"),g=require("./clsx-CXbNJWDD.cjs"),j=require("./index-bVGIXhRg.cjs");function b(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,o.get?o:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const d=b(N),S=b(i);let p;function m(){return p===void 0&&(p=navigator.platform.includes("Mac")),p}function E(t){return`${t}`.toLowerCase()==="mod"?m()?"⌘":"Ctrl":`${t}`.toLowerCase()==="alt"?m()?"⌥":"Alt":`${t}`.toLowerCase()==="shift"?m()?"⇧":"Shift":t}function q(t){return t.map(E).join(" ")}const w=d.Provider,O=d.Root,U=d.Trigger,T=S.forwardRef(({className:t,sideOffset:e=4,...n},o)=>P.jsx(d.Content,{"data-richtext-portal":!0,ref:o,sideOffset:e,className:D.cn("richtext-z-50 richtext-overflow-hidden richtext-rounded-md !richtext-border-none richtext-bg-primary richtext-px-3 richtext-py-1.5 richtext-text-sm richtext-text-primary-foreground richtext-shadow-md richtext-animate-in richtext-fade-in-0 richtext-zoom-in-95 data-[side=bottom]:richtext-slide-in-from-top-2 data-[side=left]:richtext-slide-in-from-right-2 data-[side=right]:richtext-slide-in-from-left-2 data-[side=top]:richtext-slide-in-from-bottom-2",t),...n}));T.displayName=d.Content.displayName;function R(t){const{editor:e}=g.useCurrentEditor(),n=S.useMemo(()=>e,[t,e]);return g.useEditorState({editor:n,selector(r){return r.editor?{editor:r.editor,editorState:r.editor.state,canCommand:r.editor.can}:{editor:null,editorState:void 0,canCommand:void 0}}})||{editor:null}}function f(){return R().editor}const y=h.y(!1);function x(){return h.b(y)}function $(){return h.S(y)}const M=()=>!1;function v(t=M){const e=x(),[n,o]=i.useState(()=>{const s=t();return typeof s=="boolean"?!s:s}),r=f();i.useEffect(()=>{if(!r||!t)return;const s=()=>{const c=t();o(typeof c=="boolean"?!c:c)};return s(),r.on("selectionUpdate",s),r.on("transaction",s),()=>{r.off("selectionUpdate",s),r.off("transaction",s)}},[r,t]);const a=i.useMemo(()=>!e||!r?!0:typeof n=="boolean"?n:!1,[e,r,n]),u=i.useMemo(()=>!e||!r,[e,r]);return{disabled:a,dataState:n,editorDisabled:u}}function _(t=M){const e=x(),[n,o]=i.useState({}),[r,a]=i.useState(t()),u=f();i.useEffect(()=>{if(!u||!t)return;const l=()=>{a(t())};return l(),u.on("selectionUpdate",l),()=>{u.off("selectionUpdate",l)}},[n,u,t]);const s=i.useMemo(()=>!e||!u,[e,u]),c=i.useMemo(()=>!e||!u,[e,u]);return{disabled:s,dataState:r,editorDisabled:c,update:()=>o({})}}function C(t){const e=f();return i.useMemo(()=>e?e.extensionManager.extensions.find(o=>o.name===t):null,[e,t])}function z(t,e,n){return t<e?e:t>n?n:t}const K=t=>typeof t=="number",L=t=>typeof t=="string",V=t=>typeof t=="function";function B(t,e="px"){if(!t)return t;const n=K(t)?String(t):t,o=Number.parseFloat(n),r=n.match(/[%a-z]+$/i),a=r?r[0]:e;return Number.isNaN(o)?t:o+a}function F(t,e){if(!t)return!1;const{extensions:n=[]}=(t==null?void 0:t.extensionManager)??{};return!!n.find(r=>r.name===e)}function I(t){return t.map(e=>L(e)?{value:e,name:e}:e)}function W(t){const e=f(),n=C(t),{t:o}=j.useLocale();return i.useMemo(()=>{if(!e||!n||!o)return null;const{button:r}=n.options;return!r||!V(r)?null:r({editor:e,extension:n,t:o})},[e,n,o])}exports.Tooltip=O;exports.TooltipContent=T;exports.TooltipProvider=w;exports.TooltipTrigger=U;exports.clamp=z;exports.ensureNameValueOptions=I;exports.getCssUnitWithDefault=B;exports.getShortcutKey=E;exports.getShortcutKeys=q;exports.hasExtension=F;exports.useActive=v;exports.useButtonProps=W;exports.useEditableEditor=x;exports.useEditorInstance=f;exports.useExtension=C;exports.useStoreEditableEditor=$;exports.useToggleActive=_;
|