@vizel/react 0.0.1-alpha.1 → 0.0.1-alpha.6
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/dist/index.js +66 -58
- package/dist/index10.js +54 -4
- package/dist/index11.js +44 -171
- package/dist/index12.js +25 -21
- package/dist/index13.js +58 -74
- package/dist/index14.js +88 -8
- package/dist/index15.js +4 -78
- package/dist/index16.js +168 -107
- package/dist/index17.js +23 -35
- package/dist/index18.js +21 -5
- package/dist/index19.js +73 -65
- package/dist/index2.js +77 -24
- package/dist/index20.js +8 -91
- package/dist/index21.js +10 -4
- package/dist/index22.js +77 -35
- package/dist/index23.js +113 -31
- package/dist/index24.js +32 -47
- package/dist/index25.js +5 -29
- package/dist/index26.js +68 -7
- package/dist/index27.js +89 -50
- package/dist/index28.js +4 -11
- package/dist/index29.js +37 -3
- package/dist/index3.js +52 -11
- package/dist/index30.js +53 -20
- package/dist/index31.js +34 -2
- package/dist/index32.js +47 -9738
- package/dist/index33.js +29 -17015
- package/dist/index34.js +8 -2
- package/dist/index35.js +52 -7
- package/dist/index36.js +12 -2
- package/dist/index37.js +15 -2
- package/dist/index38.js +3 -222
- package/dist/index39.js +20 -224
- package/dist/index4.js +238 -54
- package/dist/index40.js +2 -2
- package/dist/index41.js +9742 -2
- package/dist/index42.js +17018 -0
- package/dist/index43.js +4 -0
- package/dist/index44.js +10 -0
- package/dist/index45.js +4 -0
- package/dist/index46.js +4 -0
- package/dist/index47.js +224 -0
- package/dist/index48.js +227 -0
- package/dist/index49.js +4 -0
- package/dist/index5.js +82 -55
- package/dist/index50.js +4 -0
- package/dist/index6.js +71 -46
- package/dist/index7.js +64 -26
- package/dist/index8.js +58 -59
- package/dist/index9.js +2 -91
- package/package.json +25 -31
package/dist/index14.js
CHANGED
|
@@ -1,11 +1,91 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { jsx as e, jsxs as u } from "react/jsx-runtime";
|
|
2
|
+
import { useState as a } from "react";
|
|
3
|
+
import { useVizelState as m } from "./index36.js";
|
|
4
|
+
import { VizelBubbleMenuButton as t } from "./index12.js";
|
|
5
|
+
import { VizelBubbleMenuColorPicker as o } from "./index13.js";
|
|
6
|
+
import { VizelIcon as l } from "./index20.js";
|
|
7
|
+
import { VizelLinkEditor as h } from "./index22.js";
|
|
8
|
+
import { VizelNodeSelector as k } from "./index23.js";
|
|
9
|
+
function z({
|
|
10
|
+
editor: i,
|
|
11
|
+
className: r,
|
|
12
|
+
enableEmbed: n
|
|
13
|
+
}) {
|
|
14
|
+
m(() => i);
|
|
15
|
+
const [s, c] = a(!1);
|
|
16
|
+
return s ? /* @__PURE__ */ e(
|
|
17
|
+
h,
|
|
18
|
+
{
|
|
19
|
+
editor: i,
|
|
20
|
+
onClose: () => c(!1),
|
|
21
|
+
...n ? { enableEmbed: n } : {}
|
|
22
|
+
}
|
|
23
|
+
) : /* @__PURE__ */ u("div", { className: `vizel-bubble-menu-toolbar ${r ?? ""}`, children: [
|
|
24
|
+
/* @__PURE__ */ e(k, { editor: i }),
|
|
25
|
+
/* @__PURE__ */ e(
|
|
26
|
+
t,
|
|
27
|
+
{
|
|
28
|
+
action: "bold",
|
|
29
|
+
onClick: () => i.chain().focus().toggleBold().run(),
|
|
30
|
+
isActive: i.isActive("bold"),
|
|
31
|
+
title: "Bold (Cmd+B)",
|
|
32
|
+
children: /* @__PURE__ */ e(l, { name: "bold" })
|
|
33
|
+
}
|
|
34
|
+
),
|
|
35
|
+
/* @__PURE__ */ e(
|
|
36
|
+
t,
|
|
37
|
+
{
|
|
38
|
+
action: "italic",
|
|
39
|
+
onClick: () => i.chain().focus().toggleItalic().run(),
|
|
40
|
+
isActive: i.isActive("italic"),
|
|
41
|
+
title: "Italic (Cmd+I)",
|
|
42
|
+
children: /* @__PURE__ */ e(l, { name: "italic" })
|
|
43
|
+
}
|
|
44
|
+
),
|
|
45
|
+
/* @__PURE__ */ e(
|
|
46
|
+
t,
|
|
47
|
+
{
|
|
48
|
+
action: "strike",
|
|
49
|
+
onClick: () => i.chain().focus().toggleStrike().run(),
|
|
50
|
+
isActive: i.isActive("strike"),
|
|
51
|
+
title: "Strikethrough",
|
|
52
|
+
children: /* @__PURE__ */ e(l, { name: "strikethrough" })
|
|
53
|
+
}
|
|
54
|
+
),
|
|
55
|
+
/* @__PURE__ */ e(
|
|
56
|
+
t,
|
|
57
|
+
{
|
|
58
|
+
action: "underline",
|
|
59
|
+
onClick: () => i.chain().focus().toggleUnderline().run(),
|
|
60
|
+
isActive: i.isActive("underline"),
|
|
61
|
+
title: "Underline (Cmd+U)",
|
|
62
|
+
children: /* @__PURE__ */ e(l, { name: "underline" })
|
|
63
|
+
}
|
|
64
|
+
),
|
|
65
|
+
/* @__PURE__ */ e(
|
|
66
|
+
t,
|
|
67
|
+
{
|
|
68
|
+
action: "code",
|
|
69
|
+
onClick: () => i.chain().focus().toggleCode().run(),
|
|
70
|
+
isActive: i.isActive("code"),
|
|
71
|
+
title: "Code (Cmd+E)",
|
|
72
|
+
children: /* @__PURE__ */ e(l, { name: "code" })
|
|
73
|
+
}
|
|
74
|
+
),
|
|
75
|
+
/* @__PURE__ */ e(
|
|
76
|
+
t,
|
|
77
|
+
{
|
|
78
|
+
action: "link",
|
|
79
|
+
onClick: () => c(!0),
|
|
80
|
+
isActive: i.isActive("link"),
|
|
81
|
+
title: "Link (Cmd+K)",
|
|
82
|
+
children: /* @__PURE__ */ e(l, { name: "link" })
|
|
83
|
+
}
|
|
84
|
+
),
|
|
85
|
+
/* @__PURE__ */ e(o, { editor: i, type: "textColor" }),
|
|
86
|
+
/* @__PURE__ */ e(o, { editor: i, type: "highlight" })
|
|
87
|
+
] });
|
|
8
88
|
}
|
|
9
89
|
export {
|
|
10
|
-
|
|
90
|
+
z as VizelBubbleMenuDefault
|
|
11
91
|
};
|
package/dist/index15.js
CHANGED
|
@@ -1,81 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { VizelIcon as g } from "./index14.js";
|
|
5
|
-
function P({
|
|
6
|
-
editor: e,
|
|
7
|
-
onClose: n,
|
|
8
|
-
className: E,
|
|
9
|
-
enableEmbed: m = !1
|
|
10
|
-
}) {
|
|
11
|
-
const d = e.getAttributes("link").href || "", [s, z] = h(d), [l, L] = h(!1), u = k(null), f = k(null), o = v(() => m ? e.extensionManager.extensions.some((r) => r.name === "embed") : !1, [e, m]), x = v(() => s.trim() ? R(s.trim()) !== null : !1, [s]);
|
|
12
|
-
b(() => {
|
|
13
|
-
f.current?.focus();
|
|
14
|
-
}, []), b(() => {
|
|
15
|
-
const t = (c) => {
|
|
16
|
-
u.current && !u.current.contains(c.target) && n();
|
|
17
|
-
}, r = (c) => {
|
|
18
|
-
c.key === "Escape" && (c.preventDefault(), c.stopImmediatePropagation(), n());
|
|
19
|
-
}, N = setTimeout(() => {
|
|
20
|
-
document.addEventListener("mousedown", t);
|
|
21
|
-
}, 0);
|
|
22
|
-
return document.addEventListener("keydown", r, !0), () => {
|
|
23
|
-
clearTimeout(N), document.removeEventListener("mousedown", t), document.removeEventListener("keydown", r, !0);
|
|
24
|
-
};
|
|
25
|
-
}, [n]);
|
|
26
|
-
const y = p(
|
|
27
|
-
(t) => {
|
|
28
|
-
t.preventDefault();
|
|
29
|
-
const r = s.trim();
|
|
30
|
-
if (!r) {
|
|
31
|
-
e.chain().focus().unsetLink().run(), n();
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
l && o ? e.chain().focus().unsetLink().setEmbed({ url: r }).run() : e.chain().focus().setLink({ href: r }).run(), n();
|
|
35
|
-
},
|
|
36
|
-
[e, s, l, o, n]
|
|
37
|
-
), w = p(() => {
|
|
38
|
-
e.chain().focus().unsetLink().run(), n();
|
|
39
|
-
}, [e, n]);
|
|
40
|
-
return /* @__PURE__ */ a("form", { ref: u, onSubmit: y, className: `vizel-link-editor ${E ?? ""}`, children: [
|
|
41
|
-
/* @__PURE__ */ a("div", { className: "vizel-link-editor-row", children: [
|
|
42
|
-
/* @__PURE__ */ i(
|
|
43
|
-
"input",
|
|
44
|
-
{
|
|
45
|
-
ref: f,
|
|
46
|
-
type: "url",
|
|
47
|
-
value: s,
|
|
48
|
-
onChange: (t) => z(t.target.value),
|
|
49
|
-
placeholder: "Enter URL...",
|
|
50
|
-
className: "vizel-link-input"
|
|
51
|
-
}
|
|
52
|
-
),
|
|
53
|
-
/* @__PURE__ */ i("button", { type: "submit", className: "vizel-link-button", title: "Apply", children: /* @__PURE__ */ i(g, { name: "check" }) }),
|
|
54
|
-
d && /* @__PURE__ */ i(
|
|
55
|
-
"button",
|
|
56
|
-
{
|
|
57
|
-
type: "button",
|
|
58
|
-
onClick: w,
|
|
59
|
-
className: "vizel-link-button vizel-link-remove",
|
|
60
|
-
title: "Remove link",
|
|
61
|
-
children: /* @__PURE__ */ i(g, { name: "x" })
|
|
62
|
-
}
|
|
63
|
-
)
|
|
64
|
-
] }),
|
|
65
|
-
o && x && /* @__PURE__ */ a("div", { className: "vizel-link-editor-embed-toggle", children: [
|
|
66
|
-
/* @__PURE__ */ i(
|
|
67
|
-
"input",
|
|
68
|
-
{
|
|
69
|
-
type: "checkbox",
|
|
70
|
-
id: "vizel-embed-toggle",
|
|
71
|
-
checked: l,
|
|
72
|
-
onChange: (t) => L(t.target.checked)
|
|
73
|
-
}
|
|
74
|
-
),
|
|
75
|
-
/* @__PURE__ */ i("label", { htmlFor: "vizel-embed-toggle", children: "Embed as rich content" })
|
|
76
|
-
] })
|
|
77
|
-
] });
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
function n({ className: e }) {
|
|
3
|
+
return /* @__PURE__ */ i("span", { className: `vizel-bubble-menu-divider ${e ?? ""}` });
|
|
78
4
|
}
|
|
79
5
|
export {
|
|
80
|
-
|
|
6
|
+
n as VizelBubbleMenuDivider
|
|
81
7
|
};
|
package/dist/index16.js
CHANGED
|
@@ -1,118 +1,179 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import {
|
|
3
|
-
import { useState as
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
function
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { jsxs as z, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { normalizeVizelHexColor as N, isVizelValidHexColor as I } from "@vizel/core";
|
|
3
|
+
import { useState as K, useRef as L, useMemo as $, useEffect as y, useCallback as b } from "react";
|
|
4
|
+
import { VizelIcon as w } from "./index20.js";
|
|
5
|
+
const S = 4, j = ["transparent", "inherit"];
|
|
6
|
+
function q({
|
|
7
|
+
colors: f,
|
|
8
|
+
value: a,
|
|
9
|
+
onChange: m,
|
|
10
|
+
label: M = "Color palette",
|
|
11
|
+
className: O,
|
|
12
|
+
allowCustomColor: U = !0,
|
|
13
|
+
recentColors: s = [],
|
|
14
|
+
showRecentColors: h = !0,
|
|
15
|
+
noneValues: g = j
|
|
10
16
|
}) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
17
|
+
const [p, d] = K(""), [x, v] = K(-1), u = L([]), D = L(null), i = $(
|
|
18
|
+
() => [...h ? s : [], ...f.map((e) => e.color)],
|
|
19
|
+
[h, s, f]
|
|
20
|
+
);
|
|
21
|
+
y(() => {
|
|
22
|
+
u.current.length > i.length && (u.current.length = i.length);
|
|
23
|
+
}, [i.length]);
|
|
24
|
+
const H = h ? s.length : 0, o = b(
|
|
25
|
+
(e) => g.includes(e),
|
|
26
|
+
[g]
|
|
27
|
+
), k = b(
|
|
28
|
+
(e) => {
|
|
29
|
+
m(e), d("");
|
|
30
|
+
},
|
|
31
|
+
[m]
|
|
32
|
+
), V = b(() => {
|
|
33
|
+
const e = N(p);
|
|
34
|
+
I(e) && (m(e), d(""));
|
|
35
|
+
}, [p, m]), R = (e) => {
|
|
36
|
+
e.key === "Enter" && (e.preventDefault(), V());
|
|
37
|
+
}, A = b(
|
|
38
|
+
(e, r) => {
|
|
39
|
+
const t = i.length;
|
|
40
|
+
if (t === 0) return;
|
|
41
|
+
let n = r, c = !1;
|
|
42
|
+
switch (e.key) {
|
|
43
|
+
case "ArrowRight":
|
|
44
|
+
n = (r + 1) % t, c = !0;
|
|
45
|
+
break;
|
|
46
|
+
case "ArrowLeft":
|
|
47
|
+
n = (r - 1 + t) % t, c = !0;
|
|
48
|
+
break;
|
|
49
|
+
case "ArrowDown":
|
|
50
|
+
n = Math.min(r + S, t - 1), c = !0;
|
|
51
|
+
break;
|
|
52
|
+
case "ArrowUp":
|
|
53
|
+
n = Math.max(r - S, 0), c = !0;
|
|
54
|
+
break;
|
|
55
|
+
case "Home":
|
|
56
|
+
n = 0, c = !0;
|
|
57
|
+
break;
|
|
58
|
+
case "End":
|
|
59
|
+
n = t - 1, c = !0;
|
|
60
|
+
break;
|
|
61
|
+
case "Enter":
|
|
62
|
+
case " ": {
|
|
63
|
+
e.preventDefault();
|
|
64
|
+
const E = i[r];
|
|
65
|
+
E && k(E);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
43
68
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
e
|
|
53
|
-
};
|
|
54
|
-
|
|
69
|
+
c && (e.preventDefault(), v(n), u.current[n]?.focus());
|
|
70
|
+
},
|
|
71
|
+
[i, k]
|
|
72
|
+
);
|
|
73
|
+
y(() => {
|
|
74
|
+
a && !o(a) ? d(a) : d("");
|
|
75
|
+
}, [a, o]), y(() => {
|
|
76
|
+
const e = a ? i.indexOf(a) : -1;
|
|
77
|
+
e >= 0 ? v(e) : i.length > 0 && v(0);
|
|
78
|
+
}, [i, a]);
|
|
79
|
+
const C = I(N(p)), _ = C ? N(p) : void 0;
|
|
80
|
+
return /* @__PURE__ */ z(
|
|
55
81
|
"div",
|
|
56
82
|
{
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
"
|
|
83
|
+
className: `vizel-color-picker-content ${O ?? ""}`,
|
|
84
|
+
role: "listbox",
|
|
85
|
+
"aria-label": M,
|
|
60
86
|
children: [
|
|
61
|
-
/* @__PURE__ */
|
|
62
|
-
"
|
|
63
|
-
{
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
87
|
+
h && s.length > 0 && /* @__PURE__ */ z("div", { className: "vizel-color-picker-section", children: [
|
|
88
|
+
/* @__PURE__ */ l("div", { className: "vizel-color-picker-label", children: "Recent" }),
|
|
89
|
+
/* @__PURE__ */ l("div", { className: "vizel-color-picker-recent", children: s.map((e, r) => /* @__PURE__ */ l(
|
|
90
|
+
"button",
|
|
91
|
+
{
|
|
92
|
+
ref: (t) => {
|
|
93
|
+
u.current[r] = t;
|
|
94
|
+
},
|
|
95
|
+
type: "button",
|
|
96
|
+
role: "option",
|
|
97
|
+
"aria-selected": a === e,
|
|
98
|
+
"aria-label": e,
|
|
99
|
+
tabIndex: x === r ? 0 : -1,
|
|
100
|
+
className: `vizel-color-picker-swatch ${a === e ? "is-active" : ""}`,
|
|
101
|
+
onClick: () => k(e),
|
|
102
|
+
onKeyDown: (t) => A(t, r),
|
|
103
|
+
style: {
|
|
104
|
+
backgroundColor: o(e) ? "transparent" : e
|
|
105
|
+
},
|
|
106
|
+
"data-color": e,
|
|
107
|
+
children: o(e) ? /* @__PURE__ */ l("span", { className: "vizel-color-picker-none", children: /* @__PURE__ */ l(w, { name: "x" }) }) : null
|
|
108
|
+
},
|
|
109
|
+
e
|
|
110
|
+
)) })
|
|
111
|
+
] }),
|
|
112
|
+
/* @__PURE__ */ l("div", { className: "vizel-color-picker-section", children: /* @__PURE__ */ l("div", { className: "vizel-color-picker-grid", children: f.map((e, r) => {
|
|
113
|
+
const t = H + r;
|
|
114
|
+
return /* @__PURE__ */ l(
|
|
115
|
+
"button",
|
|
116
|
+
{
|
|
117
|
+
ref: (n) => {
|
|
118
|
+
u.current[t] = n;
|
|
119
|
+
},
|
|
120
|
+
type: "button",
|
|
121
|
+
role: "option",
|
|
122
|
+
"aria-selected": a === e.color,
|
|
123
|
+
"aria-label": e.name,
|
|
124
|
+
tabIndex: x === t ? 0 : -1,
|
|
125
|
+
className: `vizel-color-picker-swatch ${a === e.color ? "is-active" : ""}`,
|
|
126
|
+
onClick: () => k(e.color),
|
|
127
|
+
onKeyDown: (n) => A(n, t),
|
|
128
|
+
style: {
|
|
129
|
+
backgroundColor: o(e.color) ? "transparent" : e.color
|
|
130
|
+
},
|
|
131
|
+
"data-color": e.color,
|
|
132
|
+
children: o(e.color) ? /* @__PURE__ */ l("span", { className: "vizel-color-picker-none", children: /* @__PURE__ */ l(w, { name: "x" }) }) : null
|
|
133
|
+
},
|
|
134
|
+
e.color
|
|
135
|
+
);
|
|
136
|
+
}) }) }),
|
|
137
|
+
U && /* @__PURE__ */ z("div", { className: "vizel-color-picker-input-row", children: [
|
|
138
|
+
/* @__PURE__ */ l(
|
|
139
|
+
"span",
|
|
140
|
+
{
|
|
141
|
+
className: "vizel-color-picker-preview",
|
|
142
|
+
style: { backgroundColor: _ || "transparent" },
|
|
143
|
+
"aria-hidden": "true"
|
|
144
|
+
}
|
|
145
|
+
),
|
|
146
|
+
/* @__PURE__ */ l(
|
|
147
|
+
"input",
|
|
148
|
+
{
|
|
149
|
+
ref: D,
|
|
150
|
+
type: "text",
|
|
151
|
+
className: "vizel-color-picker-input",
|
|
152
|
+
placeholder: "#000000",
|
|
153
|
+
value: p,
|
|
154
|
+
onChange: (e) => d(e.target.value),
|
|
155
|
+
onKeyDown: R,
|
|
156
|
+
maxLength: 7,
|
|
157
|
+
"aria-label": "Custom color hex value"
|
|
158
|
+
}
|
|
159
|
+
),
|
|
160
|
+
/* @__PURE__ */ l(
|
|
161
|
+
"button",
|
|
162
|
+
{
|
|
163
|
+
type: "button",
|
|
164
|
+
className: "vizel-color-picker-apply",
|
|
165
|
+
onClick: V,
|
|
166
|
+
disabled: !C,
|
|
167
|
+
title: "Apply",
|
|
168
|
+
"aria-label": "Apply custom color",
|
|
169
|
+
children: /* @__PURE__ */ l(w, { name: "check" })
|
|
170
|
+
}
|
|
171
|
+
)
|
|
172
|
+
] })
|
|
112
173
|
]
|
|
113
174
|
}
|
|
114
175
|
);
|
|
115
176
|
}
|
|
116
177
|
export {
|
|
117
|
-
|
|
178
|
+
q as VizelColorPicker
|
|
118
179
|
};
|
package/dist/index17.js
CHANGED
|
@@ -1,38 +1,26 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"data-vizel-portal-layer": o,
|
|
22
|
-
className: e,
|
|
23
|
-
style: {
|
|
24
|
-
position: "absolute",
|
|
25
|
-
top: 0,
|
|
26
|
-
left: 0,
|
|
27
|
-
zIndex: f[o]
|
|
28
|
-
},
|
|
29
|
-
children: t
|
|
30
|
-
}
|
|
31
|
-
),
|
|
32
|
-
l
|
|
33
|
-
);
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as i, useContext as r } from "react";
|
|
3
|
+
const t = i(null);
|
|
4
|
+
function x({ editor: e, children: n }) {
|
|
5
|
+
return /* @__PURE__ */ o(t.Provider, { value: { editor: e }, children: n });
|
|
6
|
+
}
|
|
7
|
+
function z() {
|
|
8
|
+
const e = r(t);
|
|
9
|
+
if (e === null)
|
|
10
|
+
throw new Error(
|
|
11
|
+
`[Vizel] useVizelContext must be used within <VizelProvider> or <Vizel>.
|
|
12
|
+
Example:
|
|
13
|
+
<VizelProvider editor={editor}>
|
|
14
|
+
<YourComponent />
|
|
15
|
+
</VizelProvider>`
|
|
16
|
+
);
|
|
17
|
+
return e;
|
|
18
|
+
}
|
|
19
|
+
function V() {
|
|
20
|
+
return r(t);
|
|
34
21
|
}
|
|
35
|
-
d.displayName = "VizelPortal";
|
|
36
22
|
export {
|
|
37
|
-
|
|
23
|
+
x as VizelInternalProvider,
|
|
24
|
+
z as useVizelContext,
|
|
25
|
+
V as useVizelContextSafe
|
|
38
26
|
};
|
package/dist/index18.js
CHANGED
|
@@ -1,8 +1,24 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as a, useImperativeHandle as c, useEffect as l } from "react";
|
|
3
|
+
import { useVizelContextSafe as s } from "./index17.js";
|
|
4
|
+
function v({ ref: i, editor: o, className: n }) {
|
|
5
|
+
const d = s(), e = o ?? d?.editor, r = a(null);
|
|
6
|
+
return c(
|
|
7
|
+
i,
|
|
8
|
+
() => ({
|
|
9
|
+
container: r.current
|
|
10
|
+
}),
|
|
11
|
+
[]
|
|
12
|
+
), l(() => {
|
|
13
|
+
const t = r.current;
|
|
14
|
+
if (e && t)
|
|
15
|
+
return t.appendChild(e.view.dom), e.view.setProps({
|
|
16
|
+
editable: () => e?.isEditable ?? !1
|
|
17
|
+
}), () => {
|
|
18
|
+
e.view.dom.parentNode === t && t.removeChild(e.view.dom);
|
|
19
|
+
};
|
|
20
|
+
}, [e]), e ? /* @__PURE__ */ f("div", { ref: r, className: n, "data-vizel-content": "" }) : null;
|
|
5
21
|
}
|
|
6
22
|
export {
|
|
7
|
-
|
|
23
|
+
v as VizelEditor
|
|
8
24
|
};
|