eddyter 1.4.12 → 1.4.13
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 +3 -2
- package/dist/CommentBubblePlugin-DDCERFQO.js +29 -0
- package/dist/{LazyCodeMirror-CcceEUqu.js → LazyCodeMirror-C1bW4mVF.js} +941 -1484
- package/dist/{LazySignatureCanvas-Cck44R9l.js → LazySignatureCanvas-D5P1189T.js} +21 -38
- package/dist/Provider/EditorProvider.d.ts +2 -0
- package/dist/api/auth.d.ts +4 -0
- package/dist/assets/style.css +1 -1
- package/dist/{babel-CCPWkrf4.js → babel-B9hn44Wo.js} +726 -1302
- package/dist/components/ColorPicker/LazyHexColorPicker.d.ts +2 -0
- package/dist/components/CommentToggle/CommentToggle.d.ts +2 -2
- package/dist/components/ConfigurableEditorWithAuth.d.ts +2 -2
- package/dist/components/EmojiPickerWidget/LazyEmojiPicker.d.ts +4 -0
- package/dist/components/LockedFeature/FeatureLockCard.d.ts +22 -0
- package/dist/components/LockedFeature/FeatureLockTooltipContent.d.ts +12 -0
- package/dist/components/LockedFeature/LockedFeature.d.ts +6 -1
- package/dist/components/LockedFeature/lockedFeatureMetadata.d.ts +7 -0
- package/dist/components/Toolbar/styles.d.ts +5 -5
- package/dist/components/ui/tooltip.d.ts +2 -1
- package/dist/{estree-CxUPh9wa.js → estree-CocPn_Md.js} +529 -917
- package/dist/{generateDocxThumbnail-DGj_L73_.js → generateDocxThumbnail-BVFpoKUP.js} +762 -1118
- package/dist/{generatePdfThumbnail-D1ui86rp.js → generatePdfThumbnail-Pvt57kGy.js} +13 -19
- package/dist/{generateXlsxThumbnail-CbJOr-_6.js → generateXlsxThumbnail-DRggrLYK.js} +3322 -3508
- package/dist/{html-CmniStvG.js → html-CxCicOef.js} +350 -589
- package/dist/{html2canvas.esm-C2wu93Kq.js → html2canvas.esm-BD_Vwvv8.js} +139 -204
- package/dist/{html2pdf.bundle.min-CN_w9Sxu.js → html2pdf.bundle.min-DElEIEzd.js} +3405 -5221
- package/dist/{index-DiSjJC3k.js → index-C9Dld3-L.js} +13 -13
- package/dist/{index-CuwrKBfY.js → index-Cojy1w7r.js} +194 -217
- package/dist/index-D11sRTul.js +147 -0
- package/dist/{index-Dh0oRk6u.js → index-DFEFJp4J.js} +37294 -41489
- package/dist/index-D_izLqTY.js +552 -0
- package/dist/{index-hrDzgkRb.js → index-ZBDns08-.js} +81 -80
- package/dist/index-rm00T8b9.js +166 -0
- package/dist/index.js +2 -2
- package/dist/{markdown-B0mEGGfQ.js → markdown-BUjgWFLu.js} +578 -1015
- package/dist/{objectWithoutPropertiesLoose-DO0w4vQT.js → objectWithoutPropertiesLoose-DiWPeE4c.js} +6 -10
- package/dist/pages/ConfigurableEditor/ConfigurableEditor.d.ts +1 -1
- package/dist/plugins/LocalStoragePlugin.d.ts +0 -2
- package/dist/{postcss-B0bxXf7u.js → postcss-CGIcwj_g.js} +615 -1065
- package/dist/{standalone-DmuJV5rn.js → standalone-C0qguT38.js} +350 -596
- package/dist/{typescript-DZlC_9M8.js → typescript-BM7wk6k-.js} +1114 -1806
- package/package.json +8 -1
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as N, Fragment as rt, jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import { I as it } from "./ImageResizer-BVwxL4Eh.js";
|
|
3
|
-
import {
|
|
4
|
-
import { LinkNode as
|
|
5
|
-
import { AutoFocusPlugin as
|
|
6
|
-
import { useLexicalComposerContext as
|
|
7
|
-
import { ContentEditable as
|
|
8
|
-
import { LexicalErrorBoundary as
|
|
9
|
-
import { HistoryPlugin as
|
|
10
|
-
import { LexicalNestedComposer as
|
|
11
|
-
import { OnChangePlugin as
|
|
12
|
-
import { RichTextPlugin as
|
|
13
|
-
import { useLexicalEditable as
|
|
14
|
-
import { useLexicalNodeSelection as
|
|
15
|
-
import { mergeRegister as
|
|
16
|
-
import { $getSelection as
|
|
17
|
-
import { useRef as
|
|
18
|
-
|
|
3
|
+
import { CodeNode as ot } from "@lexical/code";
|
|
4
|
+
import { LinkNode as nt } from "@lexical/link";
|
|
5
|
+
import { AutoFocusPlugin as ct } from "@lexical/react/LexicalAutoFocusPlugin";
|
|
6
|
+
import { useLexicalComposerContext as lt } from "@lexical/react/LexicalComposerContext";
|
|
7
|
+
import { ContentEditable as at } from "@lexical/react/LexicalContentEditable";
|
|
8
|
+
import { LexicalErrorBoundary as dt } from "@lexical/react/LexicalErrorBoundary";
|
|
9
|
+
import { HistoryPlugin as st } from "@lexical/react/LexicalHistoryPlugin";
|
|
10
|
+
import { LexicalNestedComposer as ut } from "@lexical/react/LexicalNestedComposer";
|
|
11
|
+
import { OnChangePlugin as ft } from "@lexical/react/LexicalOnChangePlugin";
|
|
12
|
+
import { RichTextPlugin as gt } from "@lexical/react/LexicalRichTextPlugin";
|
|
13
|
+
import { useLexicalEditable as mt } from "@lexical/react/useLexicalEditable";
|
|
14
|
+
import { useLexicalNodeSelection as pt } from "@lexical/react/useLexicalNodeSelection";
|
|
15
|
+
import { mergeRegister as ht } from "@lexical/utils";
|
|
16
|
+
import { $getSelection as P, $isNodeSelection as p, $setSelection as W, SELECTION_CHANGE_COMMAND as bt, COMMAND_PRIORITY_LOW as f, CLICK_COMMAND as Ct, DRAGSTART_COMMAND as Nt, KEY_DELETE_COMMAND as xt, KEY_BACKSPACE_COMMAND as vt, KEY_ENTER_COMMAND as Et, KEY_ESCAPE_COMMAND as yt, RootNode as Rt, TextNode as At, LineBreakNode as kt, ParagraphNode as St, $getNodeByKey as A, $isParagraphNode as T } from "lexical";
|
|
17
|
+
import { useRef as L, useState as w, useCallback as x, useEffect as Dt } from "react";
|
|
18
|
+
import { U as v, W as Pt, b as Lt, A as Mt, d as _t, e as $t, H as zt, T as It, N as Ot, O as Wt } from "./index-DFEFJp4J.js";
|
|
19
|
+
function ie({
|
|
19
20
|
src: j,
|
|
20
21
|
nodeKey: g,
|
|
21
22
|
width: h,
|
|
@@ -28,36 +29,36 @@ function re({
|
|
|
28
29
|
controls: V = !0,
|
|
29
30
|
position: n = "none"
|
|
30
31
|
}) {
|
|
31
|
-
const a =
|
|
32
|
+
const a = L(null), S = L(null), [l, d, C] = pt(g), [s, M] = w(!1), [o] = lt(), [y, H] = w(null), _ = L(null), K = mt(), D = x(
|
|
32
33
|
(t) => {
|
|
33
|
-
const r =
|
|
34
|
+
const r = P();
|
|
34
35
|
return l && p(r) && (t.preventDefault(), o.update(() => {
|
|
35
36
|
r.getNodes().forEach((c) => {
|
|
36
|
-
|
|
37
|
+
v(c) && c.remove();
|
|
37
38
|
});
|
|
38
39
|
})), !1;
|
|
39
40
|
},
|
|
40
41
|
[o, l]
|
|
41
|
-
), $ =
|
|
42
|
+
), $ = x(
|
|
42
43
|
(t) => {
|
|
43
|
-
const r =
|
|
44
|
+
const r = P(), e = S.current;
|
|
44
45
|
if (l && p(r) && r.getNodes().length === 1) {
|
|
45
46
|
if (E)
|
|
46
|
-
return
|
|
47
|
+
return W(null), t.preventDefault(), b.focus(), !0;
|
|
47
48
|
if (e !== null && e !== document.activeElement)
|
|
48
49
|
return t.preventDefault(), e.focus(), !0;
|
|
49
50
|
}
|
|
50
51
|
return !1;
|
|
51
52
|
},
|
|
52
53
|
[b, l, E]
|
|
53
|
-
), z =
|
|
54
|
-
(t) => _.current === b || S.current === t.target ? (
|
|
54
|
+
), z = x(
|
|
55
|
+
(t) => _.current === b || S.current === t.target ? (W(null), o.update(() => {
|
|
55
56
|
d(!0);
|
|
56
57
|
const r = o.getRootElement();
|
|
57
58
|
r !== null && r.focus();
|
|
58
59
|
}), !0) : !1,
|
|
59
60
|
[b, o, d]
|
|
60
|
-
), I =
|
|
61
|
+
), I = x(
|
|
61
62
|
(t) => {
|
|
62
63
|
const r = t;
|
|
63
64
|
if (s)
|
|
@@ -75,40 +76,40 @@ function re({
|
|
|
75
76
|
},
|
|
76
77
|
[s, l, d, C]
|
|
77
78
|
);
|
|
78
|
-
|
|
79
|
+
Dt(() => {
|
|
79
80
|
let t = !0;
|
|
80
|
-
const r =
|
|
81
|
+
const r = ht(
|
|
81
82
|
o.registerUpdateListener(({ editorState: e }) => {
|
|
82
|
-
t && H(e.read(() =>
|
|
83
|
+
t && H(e.read(() => P()));
|
|
83
84
|
}),
|
|
84
85
|
o.registerCommand(
|
|
85
|
-
|
|
86
|
+
bt,
|
|
86
87
|
(e, c) => (_.current = c, !1),
|
|
87
88
|
f
|
|
88
89
|
),
|
|
89
90
|
o.registerCommand(
|
|
90
|
-
|
|
91
|
+
Ct,
|
|
91
92
|
I,
|
|
92
93
|
f
|
|
93
94
|
),
|
|
94
95
|
o.registerCommand(
|
|
95
|
-
|
|
96
|
+
Nt,
|
|
96
97
|
(e) => e.target === a.current ? (e.preventDefault(), !0) : !1,
|
|
97
98
|
f
|
|
98
99
|
),
|
|
99
100
|
o.registerCommand(
|
|
100
|
-
|
|
101
|
+
xt,
|
|
101
102
|
D,
|
|
102
103
|
f
|
|
103
104
|
),
|
|
104
105
|
o.registerCommand(
|
|
105
|
-
|
|
106
|
+
vt,
|
|
106
107
|
D,
|
|
107
108
|
f
|
|
108
109
|
),
|
|
109
|
-
o.registerCommand(
|
|
110
|
+
o.registerCommand(Et, $, f),
|
|
110
111
|
o.registerCommand(
|
|
111
|
-
|
|
112
|
+
yt,
|
|
112
113
|
z,
|
|
113
114
|
f
|
|
114
115
|
)
|
|
@@ -131,21 +132,21 @@ function re({
|
|
|
131
132
|
const X = () => {
|
|
132
133
|
o.update(() => {
|
|
133
134
|
const t = A(g);
|
|
134
|
-
|
|
135
|
+
v(t) && t.setShowCaption(!0);
|
|
135
136
|
});
|
|
136
137
|
}, G = (t, r) => {
|
|
137
138
|
setTimeout(() => {
|
|
138
|
-
|
|
139
|
+
M(!1);
|
|
139
140
|
}, 200), o.update(() => {
|
|
140
141
|
const e = A(g);
|
|
141
|
-
|
|
142
|
+
v(e) && e.setWidthAndHeight(t, r);
|
|
142
143
|
});
|
|
143
|
-
},
|
|
144
|
-
|
|
145
|
-
},
|
|
144
|
+
}, U = () => {
|
|
145
|
+
M(!0);
|
|
146
|
+
}, q = (t) => {
|
|
146
147
|
t.preventDefault(), t.stopPropagation(), o.update(() => {
|
|
147
148
|
const r = A(g);
|
|
148
|
-
if (
|
|
149
|
+
if (v(r)) {
|
|
149
150
|
const e = r.getParent();
|
|
150
151
|
r.remove(), e && T(e) && e.getChildrenSize() === 0 && e.setFormat("left");
|
|
151
152
|
}
|
|
@@ -153,13 +154,13 @@ function re({
|
|
|
153
154
|
}, m = (t, r) => {
|
|
154
155
|
t.preventDefault(), t.stopPropagation(), o.update(() => {
|
|
155
156
|
const e = A(g);
|
|
156
|
-
if (
|
|
157
|
+
if (v(e)) {
|
|
157
158
|
e.setPosition(r);
|
|
158
159
|
const c = e.getParent();
|
|
159
160
|
c && T(c) && (r === "left" ? c.setFormat("left") : r === "right" ? c.setFormat("right") : c.setFormat(""));
|
|
160
161
|
}
|
|
161
162
|
});
|
|
162
|
-
},
|
|
163
|
+
}, J = x(
|
|
163
164
|
(t) => {
|
|
164
165
|
if (s || t.target.closest("button"))
|
|
165
166
|
return;
|
|
@@ -172,13 +173,13 @@ function re({
|
|
|
172
173
|
!e && !c || (t.stopPropagation(), t.shiftKey ? d(!l) : (C(), d(!0)));
|
|
173
174
|
},
|
|
174
175
|
[s, l, d, C]
|
|
175
|
-
), Q = l && p(y) && !s,
|
|
176
|
-
return /* @__PURE__ */
|
|
177
|
-
/* @__PURE__ */
|
|
176
|
+
), Q = l && p(y) && !s, O = (l || s) && K, Z = typeof h == "number" && typeof k == "number", tt = typeof h == "number" ? h : "auto", et = typeof k == "number" ? k : "auto";
|
|
177
|
+
return /* @__PURE__ */ N(rt, { children: [
|
|
178
|
+
/* @__PURE__ */ N(
|
|
178
179
|
"div",
|
|
179
180
|
{
|
|
180
181
|
draggable: Q,
|
|
181
|
-
style:
|
|
182
|
+
style: n === "left" || n === "right" ? {
|
|
182
183
|
position: "relative",
|
|
183
184
|
display: "block",
|
|
184
185
|
width: "100%"
|
|
@@ -205,8 +206,8 @@ function re({
|
|
|
205
206
|
} : {
|
|
206
207
|
position: "relative",
|
|
207
208
|
display: "inline-block"
|
|
208
|
-
}
|
|
209
|
-
onClick:
|
|
209
|
+
},
|
|
210
|
+
onClick: J,
|
|
210
211
|
children: [
|
|
211
212
|
/* @__PURE__ */ i(
|
|
212
213
|
"video",
|
|
@@ -215,7 +216,7 @@ function re({
|
|
|
215
216
|
src: j,
|
|
216
217
|
controls: V,
|
|
217
218
|
preload: "metadata",
|
|
218
|
-
className:
|
|
219
|
+
className: O ? `focused ${p(y) ? "draggable" : ""}` : void 0,
|
|
219
220
|
style: Z ? {
|
|
220
221
|
width: tt,
|
|
221
222
|
height: et,
|
|
@@ -227,8 +228,8 @@ function re({
|
|
|
227
228
|
draggable: "false"
|
|
228
229
|
}
|
|
229
230
|
),
|
|
230
|
-
l && p(y) && /* @__PURE__ */
|
|
231
|
-
/* @__PURE__ */
|
|
231
|
+
l && p(y) && /* @__PURE__ */ N("div", { className: "cteditor-absolute cteditor-top-2 cteditor-right-2 cteditor-flex cteditor-gap-1 cteditor-z-10", children: [
|
|
232
|
+
/* @__PURE__ */ N("div", { className: "cteditor-flex cteditor-items-center cteditor-gap-0.5 cteditor-bg-background/80 cteditor-rounded-md cteditor-shadow-md cteditor-border cteditor-border-border cteditor-p-0.5", children: [
|
|
232
233
|
/* @__PURE__ */ i(
|
|
233
234
|
"button",
|
|
234
235
|
{
|
|
@@ -237,7 +238,7 @@ function re({
|
|
|
237
238
|
className: `cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-accent cteditor-transition-colors ${n === "left" ? "cteditor-bg-accent" : ""}`,
|
|
238
239
|
"aria-label": "Wrap text left",
|
|
239
240
|
title: "Wrap text left",
|
|
240
|
-
children: /* @__PURE__ */ i(
|
|
241
|
+
children: /* @__PURE__ */ i(Pt, {})
|
|
241
242
|
}
|
|
242
243
|
),
|
|
243
244
|
/* @__PURE__ */ i(
|
|
@@ -248,7 +249,7 @@ function re({
|
|
|
248
249
|
className: `cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-accent cteditor-transition-colors ${n === "right" ? "cteditor-bg-accent" : ""}`,
|
|
249
250
|
"aria-label": "Wrap text right",
|
|
250
251
|
title: "Wrap text right",
|
|
251
|
-
children: /* @__PURE__ */ i(
|
|
252
|
+
children: /* @__PURE__ */ i(Lt, {})
|
|
252
253
|
}
|
|
253
254
|
),
|
|
254
255
|
/* @__PURE__ */ i("div", { className: "cteditor-w-px cteditor-h-5 cteditor-bg-border cteditor-mx-0.5" }),
|
|
@@ -260,7 +261,7 @@ function re({
|
|
|
260
261
|
className: `cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-accent cteditor-transition-colors ${n === "inline-left" ? "cteditor-bg-accent" : ""}`,
|
|
261
262
|
"aria-label": "Align left",
|
|
262
263
|
title: "Align left (no text wrap)",
|
|
263
|
-
children: /* @__PURE__ */ i(
|
|
264
|
+
children: /* @__PURE__ */ i(Mt, {})
|
|
264
265
|
}
|
|
265
266
|
),
|
|
266
267
|
/* @__PURE__ */ i(
|
|
@@ -271,7 +272,7 @@ function re({
|
|
|
271
272
|
className: `cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-accent cteditor-transition-colors ${n === "inline-center" || n === "full" ? "cteditor-bg-accent" : ""}`,
|
|
272
273
|
"aria-label": "Align center",
|
|
273
274
|
title: "Align center (no text wrap)",
|
|
274
|
-
children: /* @__PURE__ */ i(
|
|
275
|
+
children: /* @__PURE__ */ i(_t, {})
|
|
275
276
|
}
|
|
276
277
|
),
|
|
277
278
|
/* @__PURE__ */ i(
|
|
@@ -282,7 +283,7 @@ function re({
|
|
|
282
283
|
className: `cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-accent cteditor-transition-colors ${n === "inline-right" ? "cteditor-bg-accent" : ""}`,
|
|
283
284
|
"aria-label": "Align right",
|
|
284
285
|
title: "Align right (no text wrap)",
|
|
285
|
-
children: /* @__PURE__ */ i(
|
|
286
|
+
children: /* @__PURE__ */ i($t, {})
|
|
286
287
|
}
|
|
287
288
|
),
|
|
288
289
|
/* @__PURE__ */ i("div", { className: "cteditor-w-px cteditor-h-5 cteditor-bg-border cteditor-mx-0.5" }),
|
|
@@ -294,7 +295,7 @@ function re({
|
|
|
294
295
|
className: `cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-accent cteditor-transition-colors ${n === "none" ? "cteditor-bg-accent" : ""}`,
|
|
295
296
|
"aria-label": "Inline",
|
|
296
297
|
title: "Inline with text",
|
|
297
|
-
children: /* @__PURE__ */ i(
|
|
298
|
+
children: /* @__PURE__ */ i(zt, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-foreground" })
|
|
298
299
|
}
|
|
299
300
|
)
|
|
300
301
|
] }),
|
|
@@ -303,16 +304,16 @@ function re({
|
|
|
303
304
|
{
|
|
304
305
|
type: "button",
|
|
305
306
|
onClick: (t) => {
|
|
306
|
-
t.stopPropagation(),
|
|
307
|
+
t.stopPropagation(), q(t);
|
|
307
308
|
},
|
|
308
309
|
className: "cteditor-size-8 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded-md cteditor-bg-background/80 hover:cteditor-bg-destructive hover:cteditor-text-destructive-foreground cteditor-transition-colors cteditor-shadow-md cteditor-border cteditor-border-border",
|
|
309
310
|
"aria-label": "Delete video",
|
|
310
311
|
title: "Delete video",
|
|
311
|
-
children: /* @__PURE__ */ i(
|
|
312
|
+
children: /* @__PURE__ */ i(It, { className: "cteditor-w-4 cteditor-h-4" })
|
|
312
313
|
}
|
|
313
314
|
)
|
|
314
315
|
] }),
|
|
315
|
-
Y && p(y) &&
|
|
316
|
+
Y && p(y) && O && /* @__PURE__ */ i(
|
|
316
317
|
it,
|
|
317
318
|
{
|
|
318
319
|
showCaption: E,
|
|
@@ -321,7 +322,7 @@ function re({
|
|
|
321
322
|
buttonRef: S,
|
|
322
323
|
imageRef: a,
|
|
323
324
|
maxWidth: B,
|
|
324
|
-
onResizeStart:
|
|
325
|
+
onResizeStart: U,
|
|
325
326
|
onResizeEnd: G,
|
|
326
327
|
captionsEnabled: F
|
|
327
328
|
}
|
|
@@ -338,43 +339,43 @@ function re({
|
|
|
338
339
|
maxWidth: "100%",
|
|
339
340
|
...n === "inline-center" || n === "full" ? { margin: "0 auto" } : n === "inline-right" ? { marginLeft: "auto" } : n === "left" ? { float: "left", clear: "left" } : n === "right" ? { float: "right", clear: "right" } : {}
|
|
340
341
|
},
|
|
341
|
-
children: /* @__PURE__ */
|
|
342
|
-
|
|
342
|
+
children: /* @__PURE__ */ N(
|
|
343
|
+
ut,
|
|
343
344
|
{
|
|
344
345
|
initialEditor: b,
|
|
345
346
|
initialNodes: [
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
347
|
+
Rt,
|
|
348
|
+
At,
|
|
349
|
+
kt,
|
|
350
|
+
St,
|
|
351
|
+
nt,
|
|
352
|
+
ot
|
|
352
353
|
],
|
|
353
354
|
children: [
|
|
354
|
-
/* @__PURE__ */ i(
|
|
355
|
+
/* @__PURE__ */ i(ct, {}),
|
|
355
356
|
/* @__PURE__ */ i(
|
|
356
|
-
|
|
357
|
+
gt,
|
|
357
358
|
{
|
|
358
359
|
contentEditable: /* @__PURE__ */ i(
|
|
359
|
-
|
|
360
|
+
at,
|
|
360
361
|
{
|
|
361
362
|
"aria-placeholder": "Enter a caption...",
|
|
362
363
|
placeholder: () => /* @__PURE__ */ i("span", { className: "cteditor-text-xs", children: "Enter a caption..." }),
|
|
363
364
|
className: "ImageNode__contentEditable"
|
|
364
365
|
}
|
|
365
366
|
),
|
|
366
|
-
ErrorBoundary:
|
|
367
|
+
ErrorBoundary: dt
|
|
367
368
|
}
|
|
368
369
|
),
|
|
369
370
|
/* @__PURE__ */ i(
|
|
370
|
-
|
|
371
|
+
ft,
|
|
371
372
|
{
|
|
372
373
|
onChange: () => {
|
|
373
374
|
}
|
|
374
375
|
}
|
|
375
376
|
),
|
|
376
|
-
/* @__PURE__ */ i(
|
|
377
|
-
/* @__PURE__ */ i(
|
|
377
|
+
/* @__PURE__ */ i(st, {}),
|
|
378
|
+
/* @__PURE__ */ i(Ot, { namespace: Wt.namespace })
|
|
378
379
|
]
|
|
379
380
|
}
|
|
380
381
|
)
|
|
@@ -383,5 +384,5 @@ function re({
|
|
|
383
384
|
] });
|
|
384
385
|
}
|
|
385
386
|
export {
|
|
386
|
-
|
|
387
|
+
ie as default
|
|
387
388
|
};
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import s, { useRef as g, useState as Y, useEffect as y, useCallback as P, useLayoutEffect as V, useMemo as A } from "react";
|
|
2
|
+
function C() {
|
|
3
|
+
return (C = Object.assign || function(r) {
|
|
4
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
5
|
+
var t = arguments[e];
|
|
6
|
+
for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && (r[n] = t[n]);
|
|
7
|
+
}
|
|
8
|
+
return r;
|
|
9
|
+
}).apply(this, arguments);
|
|
10
|
+
}
|
|
11
|
+
function K(r, e) {
|
|
12
|
+
if (r == null) return {};
|
|
13
|
+
var t, n, o = {}, a = Object.keys(r);
|
|
14
|
+
for (n = 0; n < a.length; n++) e.indexOf(t = a[n]) >= 0 || (o[t] = r[t]);
|
|
15
|
+
return o;
|
|
16
|
+
}
|
|
17
|
+
function M(r) {
|
|
18
|
+
var e = g(r), t = g(function(n) {
|
|
19
|
+
e.current && e.current(n);
|
|
20
|
+
});
|
|
21
|
+
return e.current = r, t.current;
|
|
22
|
+
}
|
|
23
|
+
var b = function(r, e, t) {
|
|
24
|
+
return e === void 0 && (e = 0), t === void 0 && (t = 1), r > t ? t : r < e ? e : r;
|
|
25
|
+
}, _ = function(r) {
|
|
26
|
+
return "touches" in r;
|
|
27
|
+
}, k = function(r) {
|
|
28
|
+
return r && r.ownerDocument.defaultView || self;
|
|
29
|
+
}, z = function(r, e, t) {
|
|
30
|
+
var n = r.getBoundingClientRect(), o = _(e) ? (function(a, c) {
|
|
31
|
+
for (var u = 0; u < a.length; u++) if (a[u].identifier === c) return a[u];
|
|
32
|
+
return a[0];
|
|
33
|
+
})(e.touches, t) : e;
|
|
34
|
+
return { left: b((o.pageX - (n.left + k(r).pageXOffset)) / n.width), top: b((o.pageY - (n.top + k(r).pageYOffset)) / n.height) };
|
|
35
|
+
}, D = function(r) {
|
|
36
|
+
!_(r) && r.preventDefault();
|
|
37
|
+
}, j = s.memo(function(r) {
|
|
38
|
+
var e = r.onMove, t = r.onKey, n = K(r, ["onMove", "onKey"]), o = g(null), a = M(e), c = M(t), u = g(null), h = g(!1), l = A(function() {
|
|
39
|
+
var T = function(v) {
|
|
40
|
+
D(v), (_(v) ? v.touches.length > 0 : v.buttons > 0) && o.current ? a(z(o.current, v, u.current)) : x(!1);
|
|
41
|
+
}, B = function() {
|
|
42
|
+
return x(!1);
|
|
43
|
+
};
|
|
44
|
+
function x(v) {
|
|
45
|
+
var f = h.current, p = k(o.current), m = v ? p.addEventListener : p.removeEventListener;
|
|
46
|
+
m(f ? "touchmove" : "mousemove", T), m(f ? "touchend" : "mouseup", B);
|
|
47
|
+
}
|
|
48
|
+
return [function(v) {
|
|
49
|
+
var f = v.nativeEvent, p = o.current;
|
|
50
|
+
if (p && (D(f), !(function(R, X) {
|
|
51
|
+
return X && !_(R);
|
|
52
|
+
})(f, h.current) && p)) {
|
|
53
|
+
if (_(f)) {
|
|
54
|
+
h.current = !0;
|
|
55
|
+
var m = f.changedTouches || [];
|
|
56
|
+
m.length && (u.current = m[0].identifier);
|
|
57
|
+
}
|
|
58
|
+
p.focus(), a(z(p, f, u.current)), x(!0);
|
|
59
|
+
}
|
|
60
|
+
}, function(v) {
|
|
61
|
+
var f = v.which || v.keyCode;
|
|
62
|
+
f < 37 || f > 40 || (v.preventDefault(), c({ left: f === 39 ? 0.05 : f === 37 ? -0.05 : 0, top: f === 40 ? 0.05 : f === 38 ? -0.05 : 0 }));
|
|
63
|
+
}, x];
|
|
64
|
+
}, [c, a]), d = l[0], E = l[1], O = l[2];
|
|
65
|
+
return y(function() {
|
|
66
|
+
return O;
|
|
67
|
+
}, [O]), s.createElement("div", C({}, n, { onTouchStart: d, onMouseDown: d, className: "react-colorful__interactive", ref: o, onKeyDown: E, tabIndex: 0, role: "slider" }));
|
|
68
|
+
}), I = function(r) {
|
|
69
|
+
return r.filter(Boolean).join(" ");
|
|
70
|
+
}, S = function(r) {
|
|
71
|
+
var e = r.color, t = r.left, n = r.top, o = n === void 0 ? 0.5 : n, a = I(["react-colorful__pointer", r.className]);
|
|
72
|
+
return s.createElement("div", { className: a, style: { top: 100 * o + "%", left: 100 * t + "%" } }, s.createElement("div", { className: "react-colorful__pointer-fill", style: { backgroundColor: e } }));
|
|
73
|
+
}, i = function(r, e, t) {
|
|
74
|
+
return e === void 0 && (e = 0), t === void 0 && (t = Math.pow(10, e)), Math.round(t * r) / t;
|
|
75
|
+
}, F = function(r) {
|
|
76
|
+
return Z(N(r));
|
|
77
|
+
}, N = function(r) {
|
|
78
|
+
return r[0] === "#" && (r = r.substring(1)), r.length < 6 ? { r: parseInt(r[0] + r[0], 16), g: parseInt(r[1] + r[1], 16), b: parseInt(r[2] + r[2], 16), a: r.length === 4 ? i(parseInt(r[3] + r[3], 16) / 255, 2) : 1 } : { r: parseInt(r.substring(0, 2), 16), g: parseInt(r.substring(2, 4), 16), b: parseInt(r.substring(4, 6), 16), a: r.length === 8 ? i(parseInt(r.substring(6, 8), 16) / 255, 2) : 1 };
|
|
79
|
+
}, J = function(r) {
|
|
80
|
+
return W(U(r));
|
|
81
|
+
}, Q = function(r) {
|
|
82
|
+
var e = r.s, t = r.v, n = r.a, o = (200 - e) * t / 100;
|
|
83
|
+
return { h: i(r.h), s: i(o > 0 && o < 200 ? e * t / 100 / (o <= 100 ? o : 200 - o) * 100 : 0), l: i(o / 2), a: i(n, 2) };
|
|
84
|
+
}, H = function(r) {
|
|
85
|
+
var e = Q(r);
|
|
86
|
+
return "hsl(" + e.h + ", " + e.s + "%, " + e.l + "%)";
|
|
87
|
+
}, U = function(r) {
|
|
88
|
+
var e = r.h, t = r.s, n = r.v, o = r.a;
|
|
89
|
+
e = e / 360 * 6, t /= 100, n /= 100;
|
|
90
|
+
var a = Math.floor(e), c = n * (1 - t), u = n * (1 - (e - a) * t), h = n * (1 - (1 - e + a) * t), l = a % 6;
|
|
91
|
+
return { r: i(255 * [n, u, c, c, h, n][l]), g: i(255 * [h, n, n, u, c, c][l]), b: i(255 * [c, c, h, n, n, u][l]), a: i(o, 2) };
|
|
92
|
+
}, w = function(r) {
|
|
93
|
+
var e = r.toString(16);
|
|
94
|
+
return e.length < 2 ? "0" + e : e;
|
|
95
|
+
}, W = function(r) {
|
|
96
|
+
var e = r.r, t = r.g, n = r.b, o = r.a, a = o < 1 ? w(i(255 * o)) : "";
|
|
97
|
+
return "#" + w(e) + w(t) + w(n) + a;
|
|
98
|
+
}, Z = function(r) {
|
|
99
|
+
var e = r.r, t = r.g, n = r.b, o = r.a, a = Math.max(e, t, n), c = a - Math.min(e, t, n), u = c ? a === e ? (t - n) / c : a === t ? 2 + (n - e) / c : 4 + (e - t) / c : 0;
|
|
100
|
+
return { h: i(60 * (u < 0 ? u + 6 : u)), s: i(a ? c / a * 100 : 0), v: i(a / 255 * 100), a: o };
|
|
101
|
+
}, $ = s.memo(function(r) {
|
|
102
|
+
var e = r.hue, t = r.onChange, n = I(["react-colorful__hue", r.className]);
|
|
103
|
+
return s.createElement("div", { className: n }, s.createElement(j, { onMove: function(o) {
|
|
104
|
+
t({ h: 360 * o.left });
|
|
105
|
+
}, onKey: function(o) {
|
|
106
|
+
t({ h: b(e + 360 * o.left, 0, 360) });
|
|
107
|
+
}, "aria-label": "Hue", "aria-valuenow": i(e), "aria-valuemax": "360", "aria-valuemin": "0" }, s.createElement(S, { className: "react-colorful__hue-pointer", left: e / 360, color: H({ h: e, s: 100, v: 100, a: 1 }) })));
|
|
108
|
+
}), G = s.memo(function(r) {
|
|
109
|
+
var e = r.hsva, t = r.onChange, n = { backgroundColor: H({ h: e.h, s: 100, v: 100, a: 1 }) };
|
|
110
|
+
return s.createElement("div", { className: "react-colorful__saturation", style: n }, s.createElement(j, { onMove: function(o) {
|
|
111
|
+
t({ s: 100 * o.left, v: 100 - 100 * o.top });
|
|
112
|
+
}, onKey: function(o) {
|
|
113
|
+
t({ s: b(e.s + 100 * o.left, 0, 100), v: b(e.v - 100 * o.top, 0, 100) });
|
|
114
|
+
}, "aria-label": "Color", "aria-valuetext": "Saturation " + i(e.s) + "%, Brightness " + i(e.v) + "%" }, s.createElement(S, { className: "react-colorful__saturation-pointer", top: 1 - e.v / 100, left: e.s / 100, color: H(e) })));
|
|
115
|
+
}), q = function(r, e) {
|
|
116
|
+
if (r === e) return !0;
|
|
117
|
+
for (var t in r) if (r[t] !== e[t]) return !1;
|
|
118
|
+
return !0;
|
|
119
|
+
}, rr = function(r, e) {
|
|
120
|
+
return r.toLowerCase() === e.toLowerCase() || q(N(r), N(e));
|
|
121
|
+
};
|
|
122
|
+
function er(r, e, t) {
|
|
123
|
+
var n = M(t), o = Y(function() {
|
|
124
|
+
return r.toHsva(e);
|
|
125
|
+
}), a = o[0], c = o[1], u = g({ color: e, hsva: a });
|
|
126
|
+
y(function() {
|
|
127
|
+
if (!r.equal(e, u.current.color)) {
|
|
128
|
+
var l = r.toHsva(e);
|
|
129
|
+
u.current = { hsva: l, color: e }, c(l);
|
|
130
|
+
}
|
|
131
|
+
}, [e, r]), y(function() {
|
|
132
|
+
var l;
|
|
133
|
+
q(a, u.current.hsva) || r.equal(l = r.fromHsva(a), u.current.color) || (u.current = { hsva: a, color: l }, n(l));
|
|
134
|
+
}, [a, r, n]);
|
|
135
|
+
var h = P(function(l) {
|
|
136
|
+
c(function(d) {
|
|
137
|
+
return Object.assign({}, d, l);
|
|
138
|
+
});
|
|
139
|
+
}, []);
|
|
140
|
+
return [a, h];
|
|
141
|
+
}
|
|
142
|
+
var tr = typeof window < "u" ? V : y, nr = function() {
|
|
143
|
+
return typeof __webpack_nonce__ < "u" ? __webpack_nonce__ : void 0;
|
|
144
|
+
}, L = /* @__PURE__ */ new Map(), or = function(r) {
|
|
145
|
+
tr(function() {
|
|
146
|
+
var e = r.current ? r.current.ownerDocument : document;
|
|
147
|
+
if (e !== void 0 && !L.has(e)) {
|
|
148
|
+
var t = e.createElement("style");
|
|
149
|
+
t.innerHTML = `.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`, L.set(e, t);
|
|
150
|
+
var n = nr();
|
|
151
|
+
n && t.setAttribute("nonce", n), e.head.appendChild(t);
|
|
152
|
+
}
|
|
153
|
+
}, []);
|
|
154
|
+
}, ar = function(r) {
|
|
155
|
+
var e = r.className, t = r.colorModel, n = r.color, o = n === void 0 ? t.defaultColor : n, a = r.onChange, c = K(r, ["className", "colorModel", "color", "onChange"]), u = g(null);
|
|
156
|
+
or(u);
|
|
157
|
+
var h = er(t, o, a), l = h[0], d = h[1], E = I(["react-colorful", e]);
|
|
158
|
+
return s.createElement("div", C({}, c, { ref: u, className: E }), s.createElement(G, { hsva: l, onChange: d }), s.createElement($, { hue: l.h, onChange: d, className: "react-colorful__last-control" }));
|
|
159
|
+
}, ur = { defaultColor: "000", toHsva: F, fromHsva: function(r) {
|
|
160
|
+
return J({ h: r.h, s: r.s, v: r.v, a: 1 });
|
|
161
|
+
}, equal: rr }, lr = function(r) {
|
|
162
|
+
return s.createElement(ar, C({}, r, { colorModel: ur }));
|
|
163
|
+
};
|
|
164
|
+
export {
|
|
165
|
+
lr as HexColorPicker
|
|
166
|
+
};
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Y as i, Z as r, _ as t, a0 as s, a1 as o, a2 as d, a3 as v, a4 as u, a5 as f, a6 as n, a7 as l, a8 as w } from "./index-DFEFJp4J.js";
|
|
2
2
|
export {
|
|
3
|
-
|
|
3
|
+
i as ConfigurableEditor,
|
|
4
4
|
r as ConfigurableEditorWithAuth,
|
|
5
5
|
t as ContentPreview,
|
|
6
6
|
s as EditorProvider,
|