@vizel/react 1.0.0 → 1.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 +38 -14
- package/dist/index.d.ts +225 -1
- package/dist/index.js +59 -51
- package/dist/index10.js +42 -40
- package/dist/index13.js +1 -1
- package/dist/index14.js +4 -4
- package/dist/index16.js +1 -1
- package/dist/index19.js +1 -1
- package/dist/index2.js +1 -1
- package/dist/index20.js +152 -8
- package/dist/index21.js +8 -10
- package/dist/index22.js +10 -78
- package/dist/index23.js +75 -112
- package/dist/index24.js +112 -32
- package/dist/index25.js +35 -5
- package/dist/index26.js +5 -68
- package/dist/index27.js +65 -88
- package/dist/index28.js +91 -4
- package/dist/index29.js +4 -36
- package/dist/index30.js +34 -51
- package/dist/index31.js +52 -11
- package/dist/index32.js +11 -24
- package/dist/index33.js +24 -29
- package/dist/index34.js +30 -4
- package/dist/index35.js +4 -33
- package/dist/index36.js +31 -48
- package/dist/index37.js +50 -37
- package/dist/index38.js +48 -7
- package/dist/index39.js +69 -50
- package/dist/index40.js +45 -11
- package/dist/index41.js +8 -15
- package/dist/index42.js +53 -3
- package/dist/index43.js +11 -20
- package/dist/index44.js +54 -2
- package/dist/index45.js +15 -9742
- package/dist/index46.js +3 -17016
- package/dist/index47.js +21 -2
- package/dist/index48.js +2 -8
- package/dist/index49.js +9742 -2
- package/dist/index50.js +17016 -2
- package/dist/index51.js +2 -222
- package/dist/index52.js +7 -224
- package/dist/index53.js +2 -2
- package/dist/index54.js +2 -2
- package/dist/index55.js +224 -0
- package/dist/index56.js +227 -0
- package/dist/index57.js +4 -0
- package/dist/index58.js +4 -0
- package/package.json +12 -12
package/dist/index25.js
CHANGED
|
@@ -1,8 +1,38 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { getVizelPortalContainer as s, VIZEL_PORTAL_Z_INDEX as f } from "@vizel/core";
|
|
3
|
+
import { useState as m, useEffect as p } from "react";
|
|
4
|
+
import { createPortal as u } from "react-dom";
|
|
5
|
+
function d({
|
|
6
|
+
children: t,
|
|
7
|
+
layer: o = "dropdown",
|
|
8
|
+
className: e,
|
|
9
|
+
disabled: r = !1
|
|
10
|
+
}) {
|
|
11
|
+
const [a, i] = m(!1);
|
|
12
|
+
if (p(() => {
|
|
13
|
+
i(!0);
|
|
14
|
+
}, []), !a || r)
|
|
15
|
+
return t;
|
|
16
|
+
const l = s();
|
|
17
|
+
return u(
|
|
18
|
+
/* @__PURE__ */ n(
|
|
19
|
+
"div",
|
|
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
|
+
);
|
|
5
34
|
}
|
|
35
|
+
d.displayName = "VizelPortal";
|
|
6
36
|
export {
|
|
7
|
-
|
|
37
|
+
d as VizelPortal
|
|
8
38
|
};
|
package/dist/index26.js
CHANGED
|
@@ -1,71 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function I({
|
|
6
|
-
status: r,
|
|
7
|
-
lastSaved: a,
|
|
8
|
-
showTimestamp: c = !0,
|
|
9
|
-
className: o
|
|
10
|
-
}) {
|
|
11
|
-
const [n, t] = h("");
|
|
12
|
-
f(() => {
|
|
13
|
-
if (!a) {
|
|
14
|
-
t("");
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
const s = () => {
|
|
18
|
-
t(p(a));
|
|
19
|
-
};
|
|
20
|
-
s();
|
|
21
|
-
const u = setInterval(s, 1e4);
|
|
22
|
-
return () => clearInterval(u);
|
|
23
|
-
}, [a]);
|
|
24
|
-
const l = () => {
|
|
25
|
-
switch (r) {
|
|
26
|
-
case "saved":
|
|
27
|
-
return /* @__PURE__ */ e(i, { name: "check" });
|
|
28
|
-
case "saving":
|
|
29
|
-
return /* @__PURE__ */ e("span", { className: "vizel-save-indicator-spinner", "aria-hidden": "true", children: /* @__PURE__ */ e(i, { name: "loader" }) });
|
|
30
|
-
case "unsaved":
|
|
31
|
-
return /* @__PURE__ */ e(i, { name: "circle" });
|
|
32
|
-
case "error":
|
|
33
|
-
return /* @__PURE__ */ e(i, { name: "warning" });
|
|
34
|
-
default:
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
}, v = () => {
|
|
38
|
-
switch (r) {
|
|
39
|
-
case "saved":
|
|
40
|
-
return "Saved";
|
|
41
|
-
case "saving":
|
|
42
|
-
return "Saving...";
|
|
43
|
-
case "unsaved":
|
|
44
|
-
return "Unsaved";
|
|
45
|
-
case "error":
|
|
46
|
-
return "Error saving";
|
|
47
|
-
default:
|
|
48
|
-
return "";
|
|
49
|
-
}
|
|
50
|
-
}, d = c && a && n && r === "saved";
|
|
51
|
-
return (
|
|
52
|
-
// biome-ignore lint/a11y/useSemanticElements: role="status" is appropriate for non-form status announcements
|
|
53
|
-
/* @__PURE__ */ m(
|
|
54
|
-
"div",
|
|
55
|
-
{
|
|
56
|
-
className: `vizel-save-indicator vizel-save-indicator--${r} ${o ?? ""}`,
|
|
57
|
-
role: "status",
|
|
58
|
-
"aria-live": "polite",
|
|
59
|
-
"data-vizel-save-indicator": !0,
|
|
60
|
-
children: [
|
|
61
|
-
/* @__PURE__ */ e("span", { className: "vizel-save-indicator-icon", "aria-hidden": "true", children: l() }),
|
|
62
|
-
/* @__PURE__ */ e("span", { className: "vizel-save-indicator-text", children: v() }),
|
|
63
|
-
d && /* @__PURE__ */ e("span", { className: "vizel-save-indicator-timestamp", children: n })
|
|
64
|
-
]
|
|
65
|
-
}
|
|
66
|
-
)
|
|
67
|
-
);
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { VizelInternalProvider as t } from "./index17.js";
|
|
3
|
+
function l({ editor: i, children: o, className: e }) {
|
|
4
|
+
return /* @__PURE__ */ r(t, { editor: i, children: /* @__PURE__ */ r("div", { className: e, "data-vizel-root": "", children: o }) });
|
|
68
5
|
}
|
|
69
6
|
export {
|
|
70
|
-
|
|
7
|
+
l as VizelProvider
|
|
71
8
|
};
|
package/dist/index27.js
CHANGED
|
@@ -1,94 +1,71 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { useState as
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
className: x,
|
|
11
|
-
showGroups: z = !0,
|
|
12
|
-
renderItem: I,
|
|
13
|
-
renderEmpty: y,
|
|
14
|
-
groupOrder: k
|
|
1
|
+
import { jsxs as m, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { formatVizelRelativeTime as p } from "@vizel/core";
|
|
3
|
+
import { useState as h, useEffect as f } from "react";
|
|
4
|
+
import { VizelIcon as i } from "./index21.js";
|
|
5
|
+
function I({
|
|
6
|
+
status: r,
|
|
7
|
+
lastSaved: a,
|
|
8
|
+
showTimestamp: c = !0,
|
|
9
|
+
className: o
|
|
15
10
|
}) {
|
|
16
|
-
const [
|
|
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
|
-
if (i < s + l.items.length) {
|
|
42
|
-
e = n;
|
|
43
|
-
break;
|
|
44
|
-
}
|
|
45
|
-
s += l.items.length;
|
|
46
|
-
}
|
|
11
|
+
const [n, t] = h("");
|
|
12
|
+
f(() => {
|
|
13
|
+
if (!a) {
|
|
14
|
+
t("");
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const s = () => {
|
|
18
|
+
t(p(a));
|
|
19
|
+
};
|
|
20
|
+
s();
|
|
21
|
+
const u = setInterval(s, 1e4);
|
|
22
|
+
return () => clearInterval(u);
|
|
23
|
+
}, [a]);
|
|
24
|
+
const l = () => {
|
|
25
|
+
switch (r) {
|
|
26
|
+
case "saved":
|
|
27
|
+
return /* @__PURE__ */ e(i, { name: "check" });
|
|
28
|
+
case "saving":
|
|
29
|
+
return /* @__PURE__ */ e("span", { className: "vizel-save-indicator-spinner", "aria-hidden": "true", children: /* @__PURE__ */ e(i, { name: "loader" }) });
|
|
30
|
+
case "unsaved":
|
|
31
|
+
return /* @__PURE__ */ e(i, { name: "circle" });
|
|
32
|
+
case "error":
|
|
33
|
+
return /* @__PURE__ */ e(i, { name: "warning" });
|
|
34
|
+
default:
|
|
35
|
+
return null;
|
|
47
36
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
37
|
+
}, v = () => {
|
|
38
|
+
switch (r) {
|
|
39
|
+
case "saved":
|
|
40
|
+
return "Saved";
|
|
41
|
+
case "saving":
|
|
42
|
+
return "Saving...";
|
|
43
|
+
case "unsaved":
|
|
44
|
+
return "Unsaved";
|
|
45
|
+
case "error":
|
|
46
|
+
return "Error saving";
|
|
47
|
+
default:
|
|
48
|
+
return "";
|
|
53
49
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
children: I({ item: a, isSelected: n, onClick: l })
|
|
73
|
-
},
|
|
74
|
-
a.title
|
|
75
|
-
) : /* @__PURE__ */ u(
|
|
76
|
-
"div",
|
|
77
|
-
{
|
|
78
|
-
ref: (g) => {
|
|
79
|
-
c.current[o] = g;
|
|
80
|
-
},
|
|
81
|
-
children: /* @__PURE__ */ u($, { item: a, isSelected: n, onClick: l })
|
|
82
|
-
},
|
|
83
|
-
a.title
|
|
84
|
-
);
|
|
85
|
-
});
|
|
86
|
-
return e.name ? /* @__PURE__ */ E("div", { className: "vizel-slash-menu-group", "data-vizel-slash-menu-group": !0, children: [
|
|
87
|
-
/* @__PURE__ */ u("div", { className: "vizel-slash-menu-group-header", children: e.name }),
|
|
88
|
-
s
|
|
89
|
-
] }, e.name) : s;
|
|
90
|
-
}) });
|
|
50
|
+
}, d = c && a && n && r === "saved";
|
|
51
|
+
return (
|
|
52
|
+
// biome-ignore lint/a11y/useSemanticElements: role="status" is appropriate for non-form status announcements
|
|
53
|
+
/* @__PURE__ */ m(
|
|
54
|
+
"div",
|
|
55
|
+
{
|
|
56
|
+
className: `vizel-save-indicator vizel-save-indicator--${r} ${o ?? ""}`,
|
|
57
|
+
role: "status",
|
|
58
|
+
"aria-live": "polite",
|
|
59
|
+
"data-vizel-save-indicator": !0,
|
|
60
|
+
children: [
|
|
61
|
+
/* @__PURE__ */ e("span", { className: "vizel-save-indicator-icon", "aria-hidden": "true", children: l() }),
|
|
62
|
+
/* @__PURE__ */ e("span", { className: "vizel-save-indicator-text", children: v() }),
|
|
63
|
+
d && /* @__PURE__ */ e("span", { className: "vizel-save-indicator-timestamp", children: n })
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
)
|
|
67
|
+
);
|
|
91
68
|
}
|
|
92
69
|
export {
|
|
93
|
-
|
|
70
|
+
I as VizelSaveIndicator
|
|
94
71
|
};
|
package/dist/index28.js
CHANGED
|
@@ -1,7 +1,94 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { jsx as u, jsxs as E } from "react/jsx-runtime";
|
|
2
|
+
import { groupVizelSlashCommands as D } from "@vizel/core";
|
|
3
|
+
import { useState as N, useRef as j, useMemo as b, useEffect as p, useCallback as h, useImperativeHandle as A } from "react";
|
|
4
|
+
import { VizelSlashMenuEmpty as R } from "./index29.js";
|
|
5
|
+
import { VizelSlashMenuItem as $ } from "./index30.js";
|
|
6
|
+
function B({
|
|
7
|
+
ref: S,
|
|
8
|
+
items: m,
|
|
9
|
+
command: v,
|
|
10
|
+
className: x,
|
|
11
|
+
showGroups: z = !0,
|
|
12
|
+
renderItem: I,
|
|
13
|
+
renderEmpty: y,
|
|
14
|
+
groupOrder: k
|
|
15
|
+
}) {
|
|
16
|
+
const [i, f] = N(0), c = j([]), r = b(() => !z || m.length <= 5 ? [{ name: "", items: m }] : D(m, k), [m, z, k]), t = b(() => r.flatMap((e) => e.items), [r]);
|
|
17
|
+
p(() => {
|
|
18
|
+
c.current.length > t.length && (c.current.length = t.length);
|
|
19
|
+
}, [t.length]), p(() => {
|
|
20
|
+
const e = c.current[i];
|
|
21
|
+
e && e.scrollIntoView({ block: "nearest", behavior: "smooth" });
|
|
22
|
+
}, [i]);
|
|
23
|
+
const d = h(
|
|
24
|
+
(e) => {
|
|
25
|
+
const s = t[e];
|
|
26
|
+
s && v(s);
|
|
27
|
+
},
|
|
28
|
+
[t, v]
|
|
29
|
+
), w = h(() => {
|
|
30
|
+
f((e) => (e + t.length - 1) % t.length);
|
|
31
|
+
}, [t.length]), H = h(() => {
|
|
32
|
+
f((e) => (e + 1) % t.length);
|
|
33
|
+
}, [t.length]), M = h(() => {
|
|
34
|
+
d(i);
|
|
35
|
+
}, [d, i]), V = h(() => {
|
|
36
|
+
if (r.length <= 1) return;
|
|
37
|
+
let e = 0, s = 0;
|
|
38
|
+
for (let n = 0; n < r.length; n++) {
|
|
39
|
+
const l = r[n];
|
|
40
|
+
if (l) {
|
|
41
|
+
if (i < s + l.items.length) {
|
|
42
|
+
e = n;
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
s += l.items.length;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const a = (e + 1) % r.length;
|
|
49
|
+
let o = 0;
|
|
50
|
+
for (let n = 0; n < a; n++) {
|
|
51
|
+
const l = r[n];
|
|
52
|
+
l && (o += l.items.length);
|
|
53
|
+
}
|
|
54
|
+
f(o);
|
|
55
|
+
}, [r, i]);
|
|
56
|
+
if (p(() => {
|
|
57
|
+
f(0);
|
|
58
|
+
}, [r]), A(S, () => ({
|
|
59
|
+
onKeyDown: ({ event: e }) => e.key === "ArrowUp" ? (w(), !0) : e.key === "ArrowDown" ? (H(), !0) : e.key === "Enter" ? (M(), !0) : e.key === "Tab" ? (e.preventDefault(), V(), !0) : !1
|
|
60
|
+
})), t.length === 0)
|
|
61
|
+
return /* @__PURE__ */ u("div", { className: `vizel-slash-menu ${x ?? ""}`, "data-vizel-slash-menu": "", children: y?.() ?? /* @__PURE__ */ u(R, {}) });
|
|
62
|
+
let C = 0;
|
|
63
|
+
return /* @__PURE__ */ u("div", { className: `vizel-slash-menu ${x ?? ""}`, "data-vizel-slash-menu": "", children: r.map((e) => {
|
|
64
|
+
const s = e.items.map((a) => {
|
|
65
|
+
const o = C++, n = o === i, l = () => d(o);
|
|
66
|
+
return I ? /* @__PURE__ */ u(
|
|
67
|
+
"div",
|
|
68
|
+
{
|
|
69
|
+
ref: (g) => {
|
|
70
|
+
c.current[o] = g;
|
|
71
|
+
},
|
|
72
|
+
children: I({ item: a, isSelected: n, onClick: l })
|
|
73
|
+
},
|
|
74
|
+
a.title
|
|
75
|
+
) : /* @__PURE__ */ u(
|
|
76
|
+
"div",
|
|
77
|
+
{
|
|
78
|
+
ref: (g) => {
|
|
79
|
+
c.current[o] = g;
|
|
80
|
+
},
|
|
81
|
+
children: /* @__PURE__ */ u($, { item: a, isSelected: n, onClick: l })
|
|
82
|
+
},
|
|
83
|
+
a.title
|
|
84
|
+
);
|
|
85
|
+
});
|
|
86
|
+
return e.name ? /* @__PURE__ */ E("div", { className: "vizel-slash-menu-group", "data-vizel-slash-menu-group": !0, children: [
|
|
87
|
+
/* @__PURE__ */ u("div", { className: "vizel-slash-menu-group-header", children: e.name }),
|
|
88
|
+
s
|
|
89
|
+
] }, e.name) : s;
|
|
90
|
+
}) });
|
|
4
91
|
}
|
|
5
92
|
export {
|
|
6
|
-
|
|
93
|
+
B as VizelSlashMenu
|
|
7
94
|
};
|
package/dist/index29.js
CHANGED
|
@@ -1,39 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const o = (e, t) => {
|
|
5
|
-
const a = c(e, t);
|
|
6
|
-
let i = 0;
|
|
7
|
-
return a.map((s) => {
|
|
8
|
-
const h = `${i}-${s.highlight}`;
|
|
9
|
-
return i += s.text.length, s.highlight ? /* @__PURE__ */ l("mark", { className: "vizel-slash-menu-highlight", children: s.text }, h) : s.text;
|
|
10
|
-
});
|
|
11
|
-
};
|
|
12
|
-
function p({
|
|
13
|
-
item: e,
|
|
14
|
-
isSelected: t = !1,
|
|
15
|
-
onClick: a,
|
|
16
|
-
className: i,
|
|
17
|
-
titleMatches: s
|
|
18
|
-
}) {
|
|
19
|
-
return /* @__PURE__ */ n(
|
|
20
|
-
"button",
|
|
21
|
-
{
|
|
22
|
-
type: "button",
|
|
23
|
-
className: `vizel-slash-menu-item ${t ? "is-selected" : ""} ${i ?? ""}`,
|
|
24
|
-
onClick: a,
|
|
25
|
-
"data-selected": t || void 0,
|
|
26
|
-
children: [
|
|
27
|
-
/* @__PURE__ */ l("span", { className: "vizel-slash-menu-icon", children: /* @__PURE__ */ l(r, { name: e.icon }) }),
|
|
28
|
-
/* @__PURE__ */ n("div", { className: "vizel-slash-menu-text", children: [
|
|
29
|
-
/* @__PURE__ */ l("span", { className: "vizel-slash-menu-title", children: o(e.title, s) }),
|
|
30
|
-
/* @__PURE__ */ l("span", { className: "vizel-slash-menu-description", children: e.description })
|
|
31
|
-
] }),
|
|
32
|
-
e.shortcut && /* @__PURE__ */ l("span", { className: "vizel-slash-menu-shortcut", children: e.shortcut })
|
|
33
|
-
]
|
|
34
|
-
}
|
|
35
|
-
);
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
+
function m({ children: e, className: s }) {
|
|
3
|
+
return /* @__PURE__ */ l("div", { className: `vizel-slash-menu-empty ${s ?? ""}`, "data-vizel-slash-menu-empty": "", children: e ?? "No results" });
|
|
36
4
|
}
|
|
37
5
|
export {
|
|
38
|
-
|
|
6
|
+
m as VizelSlashMenuEmpty
|
|
39
7
|
};
|
package/dist/index30.js
CHANGED
|
@@ -1,56 +1,39 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { jsxs as n, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { splitVizelTextByMatches as c } from "@vizel/core";
|
|
3
|
+
import { VizelIcon as r } from "./index21.js";
|
|
4
|
+
const o = (e, t) => {
|
|
5
|
+
const a = c(e, t);
|
|
6
|
+
let i = 0;
|
|
7
|
+
return a.map((s) => {
|
|
8
|
+
const h = `${i}-${s.highlight}`;
|
|
9
|
+
return i += s.text.length, s.highlight ? /* @__PURE__ */ l("mark", { className: "vizel-slash-menu-highlight", children: s.text }, h) : s.text;
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
function p({
|
|
13
|
+
item: e,
|
|
14
|
+
isSelected: t = !1,
|
|
15
|
+
onClick: a,
|
|
16
|
+
className: i,
|
|
17
|
+
titleMatches: s
|
|
11
18
|
}) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
theme: r,
|
|
29
|
-
resolvedTheme: m,
|
|
30
|
-
systemTheme: o,
|
|
31
|
-
setTheme: u
|
|
32
|
-
}),
|
|
33
|
-
[r, m, o, u]
|
|
19
|
+
return /* @__PURE__ */ n(
|
|
20
|
+
"button",
|
|
21
|
+
{
|
|
22
|
+
type: "button",
|
|
23
|
+
className: `vizel-slash-menu-item ${t ? "is-selected" : ""} ${i ?? ""}`,
|
|
24
|
+
onClick: a,
|
|
25
|
+
"data-selected": t || void 0,
|
|
26
|
+
children: [
|
|
27
|
+
/* @__PURE__ */ l("span", { className: "vizel-slash-menu-icon", children: /* @__PURE__ */ l(r, { name: e.icon }) }),
|
|
28
|
+
/* @__PURE__ */ n("div", { className: "vizel-slash-menu-text", children: [
|
|
29
|
+
/* @__PURE__ */ l("span", { className: "vizel-slash-menu-title", children: o(e.title, s) }),
|
|
30
|
+
/* @__PURE__ */ l("span", { className: "vizel-slash-menu-description", children: e.description })
|
|
31
|
+
] }),
|
|
32
|
+
e.shortcut && /* @__PURE__ */ l("span", { className: "vizel-slash-menu-shortcut", children: e.shortcut })
|
|
33
|
+
]
|
|
34
|
+
}
|
|
34
35
|
);
|
|
35
|
-
return /* @__PURE__ */ d(s.Provider, { value: p, children: t });
|
|
36
|
-
}
|
|
37
|
-
function I() {
|
|
38
|
-
const t = V(s);
|
|
39
|
-
if (!t)
|
|
40
|
-
throw new Error(
|
|
41
|
-
`[Vizel] useVizelTheme must be used within a VizelThemeProvider.
|
|
42
|
-
Example:
|
|
43
|
-
<VizelThemeProvider>
|
|
44
|
-
<YourComponent />
|
|
45
|
-
</VizelThemeProvider>`
|
|
46
|
-
);
|
|
47
|
-
return t;
|
|
48
|
-
}
|
|
49
|
-
function U() {
|
|
50
|
-
return V(s);
|
|
51
36
|
}
|
|
52
37
|
export {
|
|
53
|
-
|
|
54
|
-
I as useVizelTheme,
|
|
55
|
-
U as useVizelThemeSafe
|
|
38
|
+
p as VizelSlashMenuItem
|
|
56
39
|
};
|
package/dist/index31.js
CHANGED
|
@@ -1,15 +1,56 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import { getStoredVizelTheme as v, VIZEL_DEFAULT_THEME_STORAGE_KEY as x, VIZEL_DEFAULT_THEME as S, getVizelSystemTheme as _, resolveVizelTheme as L, applyVizelTheme as P, createVizelSystemThemeListener as C, storeVizelTheme as y } from "@vizel/core";
|
|
3
|
+
import { createContext as A, useContext as V, useState as T, useMemo as h, useEffect as c, useCallback as M } from "react";
|
|
4
|
+
const s = A(null);
|
|
5
|
+
function H({
|
|
6
|
+
children: t,
|
|
7
|
+
defaultTheme: z = S,
|
|
8
|
+
storageKey: n = x,
|
|
9
|
+
targetSelector: i,
|
|
10
|
+
disableTransitionOnChange: l = !1
|
|
9
11
|
}) {
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
+
const [r, E] = T(() => {
|
|
13
|
+
const e = v(n);
|
|
14
|
+
return e || z;
|
|
15
|
+
}), [o, f] = T(() => _()), m = h(() => L(r, o), [r, o]);
|
|
16
|
+
c(() => {
|
|
17
|
+
P(m, i, l);
|
|
18
|
+
}, [m, i, l]), c(() => C((a) => {
|
|
19
|
+
f(a);
|
|
20
|
+
}), []);
|
|
21
|
+
const u = M(
|
|
22
|
+
(e) => {
|
|
23
|
+
E(e), y(n, e);
|
|
24
|
+
},
|
|
25
|
+
[n]
|
|
26
|
+
), p = h(
|
|
27
|
+
() => ({
|
|
28
|
+
theme: r,
|
|
29
|
+
resolvedTheme: m,
|
|
30
|
+
systemTheme: o,
|
|
31
|
+
setTheme: u
|
|
32
|
+
}),
|
|
33
|
+
[r, m, o, u]
|
|
34
|
+
);
|
|
35
|
+
return /* @__PURE__ */ d(s.Provider, { value: p, children: t });
|
|
36
|
+
}
|
|
37
|
+
function I() {
|
|
38
|
+
const t = V(s);
|
|
39
|
+
if (!t)
|
|
40
|
+
throw new Error(
|
|
41
|
+
`[Vizel] useVizelTheme must be used within a VizelThemeProvider.
|
|
42
|
+
Example:
|
|
43
|
+
<VizelThemeProvider>
|
|
44
|
+
<YourComponent />
|
|
45
|
+
</VizelThemeProvider>`
|
|
46
|
+
);
|
|
47
|
+
return t;
|
|
48
|
+
}
|
|
49
|
+
function U() {
|
|
50
|
+
return V(s);
|
|
12
51
|
}
|
|
13
52
|
export {
|
|
14
|
-
|
|
53
|
+
H as VizelThemeProvider,
|
|
54
|
+
I as useVizelTheme,
|
|
55
|
+
U as useVizelThemeSafe
|
|
15
56
|
};
|
package/dist/index32.js
CHANGED
|
@@ -1,28 +1,15 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
action: l
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useVizelContextSafe as n } from "./index17.js";
|
|
3
|
+
import { VizelToolbarDefault as m } from "./index34.js";
|
|
4
|
+
function s({
|
|
5
|
+
editor: t,
|
|
6
|
+
className: e,
|
|
7
|
+
showDefaultToolbar: l = !0,
|
|
8
|
+
children: i
|
|
10
9
|
}) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
{
|
|
14
|
-
type: "button",
|
|
15
|
-
onClick: a,
|
|
16
|
-
disabled: o,
|
|
17
|
-
"aria-pressed": t,
|
|
18
|
-
className: `vizel-toolbar-button ${t ? "is-active" : ""} ${n ?? ""}`,
|
|
19
|
-
title: r,
|
|
20
|
-
"data-active": t || void 0,
|
|
21
|
-
"data-action": l,
|
|
22
|
-
children: e
|
|
23
|
-
}
|
|
24
|
-
);
|
|
10
|
+
const a = n(), o = t ?? a?.editor ?? null;
|
|
11
|
+
return o ? /* @__PURE__ */ r("div", { className: `vizel-toolbar ${e ?? ""}`, role: "toolbar", "aria-label": "Formatting", children: i ?? (l && /* @__PURE__ */ r(m, { editor: o })) }) : null;
|
|
25
12
|
}
|
|
26
13
|
export {
|
|
27
|
-
|
|
14
|
+
s as VizelToolbar
|
|
28
15
|
};
|