@berenjena/react-dev-panel 2.4.2 → 2.5.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 +43 -1
- package/dist/assets/index.css +1 -1
- package/dist/assets/index10.css +1 -1
- package/dist/assets/index11.css +1 -1
- package/dist/assets/index12.css +1 -1
- package/dist/assets/index13.css +1 -1
- package/dist/assets/index14.css +1 -1
- package/dist/assets/index15.css +1 -1
- package/dist/assets/index2.css +1 -1
- package/dist/assets/index3.css +1 -1
- package/dist/assets/index4.css +1 -1
- package/dist/assets/index5.css +1 -1
- package/dist/assets/index6.css +1 -1
- package/dist/assets/index7.css +1 -1
- package/dist/assets/index8.css +1 -1
- package/dist/assets/index9.css +1 -1
- package/dist/components/ControlErrorBoundary/index.d.ts +24 -0
- package/dist/components/ControlErrorBoundary/index.js +17 -0
- package/dist/components/ControlRenderer/controls/BooleanControl/index.js +10 -9
- package/dist/components/ControlRenderer/controls/ButtonControl/index.js +4 -3
- package/dist/components/ControlRenderer/controls/ButtonGroupControl/index.js +6 -5
- package/dist/components/ControlRenderer/controls/ColorControl/index.js +2 -1
- package/dist/components/ControlRenderer/controls/DateControl/index.js +8 -7
- package/dist/components/ControlRenderer/controls/DragAndDropControl/index.js +15 -14
- package/dist/components/ControlRenderer/controls/LocalStorageControl/index.js +111 -110
- package/dist/components/ControlRenderer/controls/MultiSelectControl/index.d.ts +2 -0
- package/dist/components/ControlRenderer/controls/MultiSelectControl/index.js +8 -5
- package/dist/components/ControlRenderer/controls/MultiSelectControl/types.d.ts +2 -0
- package/dist/components/ControlRenderer/controls/NumberControl/index.js +10 -9
- package/dist/components/ControlRenderer/controls/RangeControl/index.js +6 -5
- package/dist/components/ControlRenderer/controls/SelectControl/index.js +5 -4
- package/dist/components/ControlRenderer/controls/SeparatorControl/index.js +2 -1
- package/dist/components/ControlRenderer/controls/TextControl/index.js +7 -6
- package/dist/components/ControlRenderer/controls/index.js +1 -0
- package/dist/components/ControlRenderer/index.js +28 -26
- package/dist/components/DevPanel/index.js +12 -11
- package/dist/components/DevPanel/types.d.ts +17 -0
- package/dist/components/DevPanelPortal/index.js +5 -4
- package/dist/components/EmptyContent/index.js +2 -1
- package/dist/components/Icon/index.js +11 -10
- package/dist/components/Input/index.js +2 -1
- package/dist/components/Section/index.js +2 -1
- package/dist/components/Select/index.js +11 -10
- package/dist/components/Textarea/index.js +5 -4
- package/dist/components/index.js +3 -2
- package/dist/hooks/useDebounceCallback/index.js +1 -0
- package/dist/hooks/useDevPanel/consoleApi.d.ts +37 -0
- package/dist/hooks/useDevPanel/consoleApi.js +16 -0
- package/dist/hooks/useDevPanel/index.d.ts +5 -1
- package/dist/hooks/useDevPanel/index.js +50 -41
- package/dist/hooks/useDevPanel/mountDevPanelPortal.d.ts +18 -0
- package/dist/hooks/useDevPanel/mountDevPanelPortal.js +20 -0
- package/dist/hooks/useDragAndDrop/index.js +1 -0
- package/dist/hooks/useHotKey/index.js +4 -3
- package/dist/hooks/useHotkeys/index.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4 -3
- package/dist/managers/DevPanelManager.js +1 -0
- package/dist/store/BaseStoreService.d.ts +2 -7
- package/dist/store/BaseStoreService.js +14 -7
- package/dist/store/ControlPersistenceService.d.ts +2 -0
- package/dist/store/ControlPersistenceService.js +34 -26
- package/dist/store/SectionsStore.js +3 -2
- package/dist/store/UIStore.d.ts +14 -0
- package/dist/store/UIStore.js +37 -22
- package/dist/utils/className/className.js +6 -5
- package/dist/utils/className/index.js +3 -2
- package/dist/utils/copyToClipboard/copyToClipboard.js +1 -0
- package/dist/utils/copyToClipboard/index.js +3 -2
- package/dist/utils/createHotkey/createHotkey.js +4 -3
- package/dist/utils/createHotkey/index.js +3 -2
- package/dist/utils/debounce/debounce.js +4 -3
- package/dist/utils/debounce/index.js +3 -2
- package/dist/utils/deepEqual/deepEqual.d.ts +19 -0
- package/dist/utils/deepEqual/deepEqual.js +22 -0
- package/dist/utils/formatHotkey/formatHotkey.js +1 -0
- package/dist/utils/formatHotkey/index.js +1 -0
- package/dist/utils/getConstrainedPosition/getConstrainedPosition.js +6 -5
- package/dist/utils/getConstrainedPosition/index.js +3 -2
- package/dist/utils/getCurrentElementPosition/getCurrentElementPosition.js +1 -0
- package/dist/utils/getCurrentElementPosition/index.js +3 -2
- package/dist/utils/getPositionAdjustment/getPositionAdjustment.js +6 -5
- package/dist/utils/getPositionAdjustment/index.js +3 -2
- package/dist/utils/getStringPreview/getStringPreview.js +3 -2
- package/dist/utils/getStringPreview/index.js +1 -0
- package/dist/utils/hasControlChanged/hasControlChanged.js +7 -5
- package/dist/utils/hasControlChanged/index.js +3 -2
- package/dist/utils/isMacOS/index.js +3 -2
- package/dist/utils/isMacOS/isMacOS.js +3 -2
- package/dist/utils/isValidPersistedValue/isValidPersistedValue.d.ts +13 -0
- package/dist/utils/isValidPersistedValue/isValidPersistedValue.js +22 -0
- package/dist/utils/prettifyJson/index.js +3 -2
- package/dist/utils/prettifyJson/prettifyJson.js +5 -4
- package/package.json +7 -3
- package/dist/assets/index16.css +0 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
3
|
import { Select as i } from "../../../Select/index.js";
|
|
3
|
-
function
|
|
4
|
-
return /* @__PURE__ */
|
|
4
|
+
function t({ control: e }) {
|
|
5
|
+
return /* @__PURE__ */ l(
|
|
5
6
|
i,
|
|
6
7
|
{
|
|
7
8
|
multiple: !0,
|
|
@@ -9,10 +10,12 @@ function p({ control: e }) {
|
|
|
9
10
|
options: e.options,
|
|
10
11
|
disabled: e.disabled,
|
|
11
12
|
placeholder: "Select options...",
|
|
12
|
-
|
|
13
|
+
searchable: e.searchable,
|
|
14
|
+
searchPlaceholder: e.searchPlaceholder,
|
|
15
|
+
onChange: (a) => e.onChange(a)
|
|
13
16
|
}
|
|
14
17
|
);
|
|
15
18
|
}
|
|
16
19
|
export {
|
|
17
|
-
|
|
20
|
+
t as MultiSelectControl
|
|
18
21
|
};
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx as s } from "react/jsx-runtime";
|
|
2
3
|
import { useState as r, useEffect as f } from "react";
|
|
3
4
|
import { Input as p } from "../../../Input/index.js";
|
|
4
5
|
function v({ control: e }) {
|
|
5
|
-
const
|
|
6
|
-
function
|
|
7
|
-
const
|
|
8
|
-
t(
|
|
6
|
+
const a = e.event || "onChange", [l, t] = r(e.value);
|
|
7
|
+
function m(u) {
|
|
8
|
+
const n = Number(u.target.value);
|
|
9
|
+
t(n), a === "onChange" && e.onChange(n);
|
|
9
10
|
}
|
|
10
11
|
function i(u) {
|
|
11
|
-
const
|
|
12
|
-
|
|
12
|
+
const n = Number(u.target.value);
|
|
13
|
+
a === "onBlur" && e.onChange(n);
|
|
13
14
|
}
|
|
14
15
|
return f(() => {
|
|
15
16
|
t(e.value);
|
|
@@ -17,13 +18,13 @@ function v({ control: e }) {
|
|
|
17
18
|
p,
|
|
18
19
|
{
|
|
19
20
|
type: "number",
|
|
20
|
-
value:
|
|
21
|
+
value: l,
|
|
21
22
|
min: e.min,
|
|
22
23
|
max: e.max,
|
|
23
24
|
step: e.step,
|
|
24
25
|
disabled: e.disabled,
|
|
25
|
-
onChange:
|
|
26
|
-
...
|
|
26
|
+
onChange: m,
|
|
27
|
+
...a === "onBlur" && { onBlur: i }
|
|
27
28
|
}
|
|
28
29
|
);
|
|
29
30
|
}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsxs as g, jsx as i } from "react/jsx-runtime";
|
|
2
3
|
import { useState as o, useEffect as m } from "react";
|
|
3
|
-
import '../../../../assets/
|
|
4
|
+
import '../../../../assets/index8.css';const v = "_container_1a1cs_1", h = "_range_1a1cs_9", d = "_value_1a1cs_115", u = {
|
|
4
5
|
container: v,
|
|
5
6
|
range: h,
|
|
6
7
|
value: d
|
|
7
8
|
};
|
|
8
9
|
function _({ control: e }) {
|
|
9
10
|
const n = e.event || "onChange", [t, l] = o(e.value);
|
|
10
|
-
function
|
|
11
|
+
function c(s) {
|
|
11
12
|
const a = Number(s.target.value);
|
|
12
13
|
l(a), n === "onChange" && e.onChange(a);
|
|
13
14
|
}
|
|
14
|
-
function
|
|
15
|
+
function r(s) {
|
|
15
16
|
const a = Number(s.target.value);
|
|
16
17
|
n === "onBlur" && e.onChange(a);
|
|
17
18
|
}
|
|
@@ -27,8 +28,8 @@ function _({ control: e }) {
|
|
|
27
28
|
max: e.max,
|
|
28
29
|
step: e.step,
|
|
29
30
|
disabled: e.disabled,
|
|
30
|
-
onChange:
|
|
31
|
-
...n === "onBlur" && { onBlur:
|
|
31
|
+
onChange: c,
|
|
32
|
+
...n === "onBlur" && { onBlur: r },
|
|
32
33
|
className: u.range
|
|
33
34
|
}
|
|
34
35
|
),
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
3
|
+
import { Select as l } from "../../../Select/index.js";
|
|
3
4
|
function i({ control: e }) {
|
|
4
|
-
return /* @__PURE__ */
|
|
5
|
-
|
|
5
|
+
return /* @__PURE__ */ s(
|
|
6
|
+
l,
|
|
6
7
|
{
|
|
7
8
|
value: e.value,
|
|
8
9
|
options: e.options,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import '../../../../assets/
|
|
3
|
+
import '../../../../assets/index7.css';const s = "_line_174q4_1", t = "_space_174q4_9", i = "_labelContainer_174q4_14", c = "_label_174q4_14", l = {
|
|
3
4
|
line: s,
|
|
4
5
|
space: t,
|
|
5
6
|
labelContainer: i,
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
3
|
+
import { useState as d, useEffect as r } from "react";
|
|
3
4
|
import { Textarea as f } from "../../../Textarea/index.js";
|
|
4
5
|
function v({ control: e }) {
|
|
5
|
-
const n = e.event || "onChange", [t, l] =
|
|
6
|
+
const n = e.event || "onChange", [t, l] = d(e.value);
|
|
6
7
|
function o(u) {
|
|
7
8
|
const a = u.target.value;
|
|
8
9
|
l(a), n === "onChange" && e.onChange(a);
|
|
9
10
|
}
|
|
10
|
-
function
|
|
11
|
+
function i(u) {
|
|
11
12
|
const a = u.target.value;
|
|
12
13
|
n === "onBlur" && e.onChange(a);
|
|
13
14
|
}
|
|
14
15
|
return r(() => {
|
|
15
16
|
l(e.value);
|
|
16
|
-
}, [e.value]), /* @__PURE__ */
|
|
17
|
+
}, [e.value]), /* @__PURE__ */ s(
|
|
17
18
|
f,
|
|
18
19
|
{
|
|
19
20
|
value: t,
|
|
@@ -21,7 +22,7 @@ function v({ control: e }) {
|
|
|
21
22
|
disabled: e.disabled,
|
|
22
23
|
onChange: o,
|
|
23
24
|
disableAutoExpand: e.disableAutoExpand,
|
|
24
|
-
...n === "onBlur" && { onBlur:
|
|
25
|
+
...n === "onBlur" && { onBlur: i }
|
|
25
26
|
}
|
|
26
27
|
);
|
|
27
28
|
}
|
|
@@ -1,41 +1,43 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as l, jsx as o } from "react/jsx-runtime";
|
|
2
3
|
import { Suspense as c } from "react";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
4
|
+
import { ControlErrorBoundary as d } from "../ControlErrorBoundary/index.js";
|
|
5
|
+
import { className as a } from "../../utils/className/className.js";
|
|
6
|
+
import { controls as p } from "./controls/index.js";
|
|
7
|
+
import '../../assets/index3.css';const u = "_controlRendererContainer_jru2l_1", _ = "_controlContainer_jru2l_5", f = "_hoverable_jru2l_15", h = "_fullWidth_jru2l_18", b = "_label_jru2l_21", m = "_controlWrapper_jru2l_24", C = "_justifyStart_jru2l_30", j = "_description_jru2l_46", y = "_loading_jru2l_55", v = "_error_jru2l_74", e = {
|
|
8
|
+
controlRendererContainer: u,
|
|
9
|
+
controlContainer: _,
|
|
10
|
+
hoverable: f,
|
|
11
|
+
fullWidth: h,
|
|
12
|
+
label: b,
|
|
13
|
+
controlWrapper: m,
|
|
14
|
+
justifyStart: C,
|
|
15
|
+
description: j,
|
|
16
|
+
loading: y,
|
|
17
|
+
error: v
|
|
18
|
+
}, g = ["button", "buttonGroup", "separator", "dragAndDrop", "localStorage"], S = ["separator", "dragAndDrop", "localStorage"], W = ["button", "separator", "dragAndDrop", "localStorage"];
|
|
19
|
+
function D({ name: n, control: r }) {
|
|
20
|
+
const i = r?.label || n;
|
|
19
21
|
function s() {
|
|
20
22
|
if (!r || !r.type)
|
|
21
23
|
return /* @__PURE__ */ o("div", { className: e.error, children: "Control type is not defined" });
|
|
22
|
-
const
|
|
23
|
-
return
|
|
24
|
+
const t = p[r.type];
|
|
25
|
+
return t ? /* @__PURE__ */ o(d, { name: n, fallback: /* @__PURE__ */ o("div", { className: e.error, children: "Failed to render control" }), children: /* @__PURE__ */ o(c, { fallback: /* @__PURE__ */ o("div", { className: e.loading, children: "Loading control..." }), children: /* @__PURE__ */ o(t, { control: r }) }) }) : /* @__PURE__ */ o("div", { children: "Unknown control type" });
|
|
24
26
|
}
|
|
25
|
-
return /* @__PURE__ */
|
|
26
|
-
/* @__PURE__ */
|
|
27
|
+
return /* @__PURE__ */ l("div", { className: e.controlRendererContainer, children: [
|
|
28
|
+
/* @__PURE__ */ l(
|
|
27
29
|
"div",
|
|
28
30
|
{
|
|
29
|
-
...
|
|
31
|
+
...a(e.controlContainer, {
|
|
30
32
|
[e.fullWidth]: g.includes(r.type),
|
|
31
|
-
[e.hoverable]: !
|
|
33
|
+
[e.hoverable]: !S.includes(r.type)
|
|
32
34
|
}),
|
|
33
35
|
children: [
|
|
34
|
-
!
|
|
36
|
+
!W.includes(r.type) && /* @__PURE__ */ o("label", { className: e.label, children: i }),
|
|
35
37
|
/* @__PURE__ */ o(
|
|
36
38
|
"div",
|
|
37
39
|
{
|
|
38
|
-
...
|
|
40
|
+
...a(e.controlWrapper, {
|
|
39
41
|
[e.justifyStart]: r.type === "separator"
|
|
40
42
|
}),
|
|
41
43
|
children: s()
|
|
@@ -48,5 +50,5 @@ function A({ name: a, control: r }) {
|
|
|
48
50
|
] });
|
|
49
51
|
}
|
|
50
52
|
export {
|
|
51
|
-
|
|
53
|
+
D as ControlRenderer
|
|
52
54
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as d, jsx as e } from "react/jsx-runtime";
|
|
2
3
|
import { useCallback as y, useEffect as D } from "react";
|
|
3
4
|
import { useDragAndDrop as b } from "../../hooks/useDragAndDrop/index.js";
|
|
4
5
|
import { useHotkey as g } from "../../hooks/useHotKey/index.js";
|
|
@@ -8,7 +9,7 @@ import { className as k } from "../../utils/className/className.js";
|
|
|
8
9
|
import { EmptyContent as x } from "../EmptyContent/index.js";
|
|
9
10
|
import { Icon as f } from "../Icon/index.js";
|
|
10
11
|
import { Section as E } from "../Section/index.js";
|
|
11
|
-
import '../../assets/
|
|
12
|
+
import '../../assets/index15.css';const j = "_devPanelContainer_19e5a_1", A = "_header_19e5a_40", S = "_title_19e5a_55", H = "_button_19e5a_67", I = "_collapsed_19e5a_103", T = "_content_19e5a_110", t = {
|
|
12
13
|
devPanelContainer: j,
|
|
13
14
|
header: A,
|
|
14
15
|
title: S,
|
|
@@ -23,11 +24,11 @@ import '../../assets/index2.css';const j = "_devPanelContainer_11dce_217", A = "
|
|
|
23
24
|
metaKey: !1
|
|
24
25
|
};
|
|
25
26
|
function L({ panelTitle: h = "Dev panel", ...o }) {
|
|
26
|
-
const { isVisible: i, isCollapsed: n, position: l, setVisible: a, setCollapsed: u, setPosition:
|
|
27
|
+
const { isVisible: i, isCollapsed: n, position: l, setVisible: a, setCollapsed: u, setPosition: r } = K(), { setTheme: c } = N(), p = w(), _ = y(
|
|
27
28
|
(s) => {
|
|
28
|
-
|
|
29
|
+
r(s);
|
|
29
30
|
},
|
|
30
|
-
[
|
|
31
|
+
[r]
|
|
31
32
|
), { elementRef: v, handlePointerDown: C } = b({
|
|
32
33
|
onPositionChange: _
|
|
33
34
|
});
|
|
@@ -39,11 +40,11 @@ function L({ panelTitle: h = "Dev panel", ...o }) {
|
|
|
39
40
|
...o.hotKeyConfig,
|
|
40
41
|
target: window
|
|
41
42
|
}), D(() => {
|
|
42
|
-
o.theme &&
|
|
43
|
-
}, [o.theme,
|
|
43
|
+
o.theme && c(o.theme);
|
|
44
|
+
}, [o.theme, c]), !i)
|
|
44
45
|
return null;
|
|
45
|
-
const
|
|
46
|
-
return /* @__PURE__ */
|
|
46
|
+
const m = Object.entries(p);
|
|
47
|
+
return /* @__PURE__ */ d(
|
|
47
48
|
"div",
|
|
48
49
|
{
|
|
49
50
|
ref: v,
|
|
@@ -54,12 +55,12 @@ function L({ panelTitle: h = "Dev panel", ...o }) {
|
|
|
54
55
|
height: n ? "auto" : void 0
|
|
55
56
|
},
|
|
56
57
|
children: [
|
|
57
|
-
/* @__PURE__ */
|
|
58
|
+
/* @__PURE__ */ d("div", { className: t.header, onPointerDown: C, children: [
|
|
58
59
|
/* @__PURE__ */ e("button", { className: t.button, onClick: () => u(!n), title: n ? "Expand" : "Collapse", children: /* @__PURE__ */ e(f, { name: "ArrowDown", className: n ? t.collapsed : void 0 }) }),
|
|
59
60
|
/* @__PURE__ */ e("div", { className: t.title, children: h }),
|
|
60
61
|
/* @__PURE__ */ e("button", { className: t.button, onClick: () => a(!1), title: "Close", children: /* @__PURE__ */ e(f, { name: "Close" }) })
|
|
61
62
|
] }),
|
|
62
|
-
!n && /* @__PURE__ */ e("div", { className: t.content, children:
|
|
63
|
+
!n && /* @__PURE__ */ e("div", { className: t.content, children: m.length ? m.map(([s, P]) => /* @__PURE__ */ e(E, { sectionName: s, section: P }, `section-${s}`)) : /* @__PURE__ */ e(x, {}) })
|
|
63
64
|
]
|
|
64
65
|
}
|
|
65
66
|
);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ControlsGroup } from '../ControlRenderer/controls/types';
|
|
2
|
+
import { HotkeyConfig } from '../../hooks/useHotkeys/types';
|
|
2
3
|
export type DevPanelHotkeyConfig = Pick<HotkeyConfig, "key" | "shiftKey" | "altKey" | "ctrlKey" | "metaKey">;
|
|
3
4
|
export type BuiltInTheme =
|
|
4
5
|
| "auto"
|
|
@@ -47,6 +48,22 @@ export interface DevPanelProps {
|
|
|
47
48
|
* If not provided, defaults to "auto"
|
|
48
49
|
*/
|
|
49
50
|
theme?: BuiltInTheme;
|
|
51
|
+
/**
|
|
52
|
+
* Whether this `useDevPanel` call is active.
|
|
53
|
+
*
|
|
54
|
+
* When `false`, the call becomes a no-op: its section is not registered
|
|
55
|
+
* (and is removed if it had been registered), persisted values are not
|
|
56
|
+
* restored, and the panel is not auto-mounted by this call. The panel still
|
|
57
|
+
* renders as long as at least one other call is enabled.
|
|
58
|
+
*
|
|
59
|
+
* Defaults to `true`. Typical use is to strip the panel from production at
|
|
60
|
+
* runtime, e.g. `enabled: import.meta.env.DEV` or
|
|
61
|
+
* `enabled: process.env.NODE_ENV !== "production"`.
|
|
62
|
+
*
|
|
63
|
+
* Note: this gates runtime behaviour, not bundling — the panel code is still
|
|
64
|
+
* included in the consumer's bundle.
|
|
65
|
+
*/
|
|
66
|
+
enabled?: boolean;
|
|
50
67
|
}
|
|
51
68
|
|
|
52
69
|
export interface DevPanelSection {
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
-
import { useState as n, useEffect as
|
|
3
|
-
import { createPortal as
|
|
3
|
+
import { useState as n, useEffect as c } from "react";
|
|
4
|
+
import { createPortal as d } from "react-dom";
|
|
4
5
|
import { DevPanelManager as m } from "../../managers/DevPanelManager.js";
|
|
5
6
|
import { DevPanel as p } from "../DevPanel/index.js";
|
|
6
7
|
function v() {
|
|
7
8
|
const [t, r] = n({}), [s, o] = n(!1);
|
|
8
|
-
return
|
|
9
|
+
return c(() => {
|
|
9
10
|
const e = m.getInstance(), l = e.getAllProps(), u = e.shouldRender();
|
|
10
11
|
return r(l), o(u), e.onPropsChange((a) => {
|
|
11
12
|
r(a), o(e.shouldRender());
|
|
12
13
|
});
|
|
13
|
-
}, []), s ?
|
|
14
|
+
}, []), s ? d(/* @__PURE__ */ i(p, { ...t }), document.body) : null;
|
|
14
15
|
}
|
|
15
16
|
export {
|
|
16
17
|
v as DevPanelPortal
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
3
|
const t = {
|
|
3
|
-
ArrowDown: (
|
|
4
|
-
Close: (
|
|
5
|
-
Check: (
|
|
4
|
+
ArrowDown: (l) => /* @__PURE__ */ o("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", ...l, children: /* @__PURE__ */ o("path", { d: "M16.843 10.211A.75.75 0 0 0 16.251 9H7.75a.75.75 0 0 0-.591 1.212l4.258 5.498a.746.746 0 0 0 1.183-.001l4.243-5.498z" }) }),
|
|
5
|
+
Close: (l) => /* @__PURE__ */ o("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", ...l, children: /* @__PURE__ */ o("path", { d: "m12 10.93 5.719-5.72a.749.749 0 1 1 1.062 1.062l-5.72 5.719 5.719 5.719a.75.75 0 1 1-1.061 1.062L12 13.053l-5.719 5.719A.75.75 0 0 1 5.22 17.71l5.719-5.719-5.72-5.719A.752.752 0 0 1 6.281 5.21z" }) }),
|
|
6
|
+
Check: (l) => /* @__PURE__ */ o(
|
|
6
7
|
"svg",
|
|
7
8
|
{
|
|
8
9
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -11,8 +12,8 @@ const t = {
|
|
|
11
12
|
fillRule: "evenodd",
|
|
12
13
|
strokeLinejoin: "round",
|
|
13
14
|
strokeMiterlimit: "2",
|
|
14
|
-
...
|
|
15
|
-
children: /* @__PURE__ */
|
|
15
|
+
...l,
|
|
16
|
+
children: /* @__PURE__ */ o(
|
|
16
17
|
"path",
|
|
17
18
|
{
|
|
18
19
|
d: "m21 4.009c0-.478-.379-1-1-1h-16c-.62 0-1 .519-1 1v16c0 .621.52 1 1 1h16c.478 0 1-.379 1-1zm-14.051 8.382c-.165-.148-.249-.352-.249-.557 0-.411.333-.746.748-.746.178 0 .355.063.499.19l3.298 2.938 5.453-5.962c.149-.161.35-.243.554-.243.417 0 .748.337.748.747 0 .179-.065.359-.196.502l-5.953 6.509c-.147.161-.35.242-.552.242-.178 0-.357-.062-.499-.19z",
|
|
@@ -22,10 +23,10 @@ const t = {
|
|
|
22
23
|
}
|
|
23
24
|
)
|
|
24
25
|
};
|
|
25
|
-
function
|
|
26
|
-
const
|
|
27
|
-
return
|
|
26
|
+
function i({ name: l, ...n }) {
|
|
27
|
+
const e = t[l];
|
|
28
|
+
return e ? /* @__PURE__ */ o(e, { ...n }) : null;
|
|
28
29
|
}
|
|
29
30
|
export {
|
|
30
|
-
|
|
31
|
+
i as Icon
|
|
31
32
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsxs as n, jsx as o } from "react/jsx-runtime";
|
|
2
3
|
import { ControlRenderer as i } from "../ControlRenderer/index.js";
|
|
3
4
|
import { useDevPanelSectionActions as r } from "../../store/SectionsStore.js";
|
|
4
5
|
import { Icon as p } from "../Icon/index.js";
|
|
5
|
-
import '../../assets/
|
|
6
|
+
import '../../assets/index2.css';const d = "_section_plx7y_1", _ = "_header_plx7y_9", m = "_title_plx7y_28", g = "_toggle_plx7y_35", h = "_collapsed_plx7y_45", x = "_content_plx7y_54", e = {
|
|
6
7
|
section: d,
|
|
7
8
|
header: _,
|
|
8
9
|
title: m,
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsxs as x, Fragment as W, jsx as i } from "react/jsx-runtime";
|
|
2
3
|
import { useRef as P, useState as N, useMemo as U, useCallback as G, useEffect as R } from "react";
|
|
3
4
|
import { createPortal as J } from "react-dom";
|
|
4
5
|
import { Icon as K } from "../Icon/index.js";
|
|
5
6
|
import { useDevPanelPosition as X } from "../../store/UIStore.js";
|
|
6
7
|
import { className as Y } from "../../utils/className/className.js";
|
|
7
|
-
import '../../assets/
|
|
8
|
+
import '../../assets/index5.css';const Z = "_select_1st6e_1", ee = "_trigger_1st6e_6", te = "_open_1st6e_55", ne = "_value_1st6e_59", oe = "_placeholder_1st6e_68", re = "_arrow_1st6e_72", se = "_dropdownPortal_1st6e_87", ce = "_dropdown_1st6e_87", ie = "_searchContainer_1st6e_107", le = "_searchInput_1st6e_113", ae = "_optionsList_1st6e_155", de = "_noResults_1st6e_181", ue = "_option_1st6e_155", pe = "_selected_1st6e_207", he = "_checkbox_1st6e_216", fe = "_label_1st6e_237", r = {
|
|
8
9
|
select: Z,
|
|
9
10
|
trigger: ee,
|
|
10
11
|
open: te,
|
|
@@ -26,10 +27,10 @@ function ye({
|
|
|
26
27
|
value: f,
|
|
27
28
|
options: h,
|
|
28
29
|
onChange: k,
|
|
29
|
-
disabled:
|
|
30
|
+
disabled: w = !1,
|
|
30
31
|
multiple: u = !1,
|
|
31
32
|
placeholder: I = "Select...",
|
|
32
|
-
searchable:
|
|
33
|
+
searchable: g = !1,
|
|
33
34
|
searchPlaceholder: V = "Search..."
|
|
34
35
|
}) {
|
|
35
36
|
const m = X(), _ = P(null), p = P(null), O = P(null), E = P(null), [l, v] = N(!1), [b, L] = N(""), [y, S] = N({
|
|
@@ -38,11 +39,11 @@ function ye({
|
|
|
38
39
|
width: 0,
|
|
39
40
|
maxHeight: 200
|
|
40
41
|
}), d = u ? Array.isArray(f) ? f : [] : typeof f == "string" ? f : "", $ = T(), q = u ? d.length === 0 : !d, H = U(() => {
|
|
41
|
-
if (!
|
|
42
|
+
if (!g || !b)
|
|
42
43
|
return h;
|
|
43
44
|
const e = b.toLowerCase();
|
|
44
45
|
return h.filter((t) => (typeof t == "string" ? t : t.label).toLowerCase().includes(e));
|
|
45
|
-
}, [h,
|
|
46
|
+
}, [h, g, b]), c = G(() => {
|
|
46
47
|
l && S(D());
|
|
47
48
|
}, [l]);
|
|
48
49
|
function D() {
|
|
@@ -87,7 +88,7 @@ function ye({
|
|
|
87
88
|
}
|
|
88
89
|
}
|
|
89
90
|
function z() {
|
|
90
|
-
|
|
91
|
+
w || (l ? (v(!1), L("")) : (S(D()), v(!0), L(""), g && setTimeout(() => O.current?.focus(), 0)));
|
|
91
92
|
}
|
|
92
93
|
function j(e) {
|
|
93
94
|
L(e.target.value);
|
|
@@ -142,17 +143,17 @@ function ye({
|
|
|
142
143
|
{
|
|
143
144
|
ref: _,
|
|
144
145
|
...Y(r.select, {
|
|
145
|
-
[r.disabled]:
|
|
146
|
+
[r.disabled]: w,
|
|
146
147
|
[r.open]: l
|
|
147
148
|
}),
|
|
148
|
-
children: /* @__PURE__ */ x("button", { ref: p, type: "button", className: r.trigger, onClick: z, disabled:
|
|
149
|
+
children: /* @__PURE__ */ x("button", { ref: p, type: "button", className: r.trigger, onClick: z, disabled: w, children: [
|
|
149
150
|
/* @__PURE__ */ i("span", { className: `${r.value} ${q ? r.placeholder : ""}`, children: $ }),
|
|
150
151
|
/* @__PURE__ */ i(K, { name: "ArrowDown", className: r.arrow })
|
|
151
152
|
] })
|
|
152
153
|
}
|
|
153
154
|
),
|
|
154
155
|
typeof window < "u" && J(
|
|
155
|
-
l && !
|
|
156
|
+
l && !w && /* @__PURE__ */ i(
|
|
156
157
|
"div",
|
|
157
158
|
{
|
|
158
159
|
className: r.dropdownPortal,
|
|
@@ -165,7 +166,7 @@ function ye({
|
|
|
165
166
|
zIndex: 9999
|
|
166
167
|
},
|
|
167
168
|
children: /* @__PURE__ */ x("div", { className: r.dropdown, children: [
|
|
168
|
-
|
|
169
|
+
g && /* @__PURE__ */ i("div", { className: r.searchContainer, children: /* @__PURE__ */ i(
|
|
169
170
|
"input",
|
|
170
171
|
{
|
|
171
172
|
ref: O,
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
-
import '../../assets/
|
|
3
|
+
import '../../assets/index4.css';const h = "_textarea_fwls2_1", i = {
|
|
3
4
|
textarea: h
|
|
4
5
|
}, a = 240;
|
|
5
6
|
function g(r) {
|
|
6
|
-
const { disableAutoExpand: o, onChange:
|
|
7
|
+
const { disableAutoExpand: o, onChange: s, ...n } = r;
|
|
7
8
|
function l(e) {
|
|
8
9
|
if (!o && e.currentTarget) {
|
|
9
10
|
const t = e.currentTarget;
|
|
10
11
|
t.style.height = "auto", t.style.height = `${t.scrollHeight}px`, t.scrollHeight > a ? t.style.overflowY = "auto" : t.style.overflowY = "hidden";
|
|
11
12
|
}
|
|
12
|
-
|
|
13
|
+
s?.(e);
|
|
13
14
|
}
|
|
14
|
-
return /* @__PURE__ */ c("textarea", { ...
|
|
15
|
+
return /* @__PURE__ */ c("textarea", { ...n, className: i.textarea, onChange: l, style: { maxHeight: `${a}px` } });
|
|
15
16
|
}
|
|
16
17
|
export {
|
|
17
18
|
g as Textarea
|
package/dist/components/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { DevPanel as r } from "./DevPanel/index.js";
|
|
2
3
|
import { DevPanelPortal as l } from "./DevPanelPortal/index.js";
|
|
3
4
|
import { ControlRenderer as f } from "./ControlRenderer/index.js";
|
|
4
5
|
import { controls as p } from "./ControlRenderer/controls/index.js";
|
|
5
6
|
export {
|
|
6
7
|
f as ControlRenderer,
|
|
7
|
-
|
|
8
|
+
r as DevPanel,
|
|
8
9
|
l as DevPanelPortal,
|
|
9
10
|
p as controls
|
|
10
11
|
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Imperative API exposed on `window.devPanel` so developers can drive the panel
|
|
3
|
+
* from the browser console, in addition to the keyboard hotkey.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```js
|
|
7
|
+
* devPanel.open(); // show the panel
|
|
8
|
+
* devPanel.close(); // hide it
|
|
9
|
+
* devPanel.toggle(); // flip visibility (same as the hotkey)
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export interface DevPanelConsoleApi {
|
|
13
|
+
/** Shows the panel (no-op visually if no sections are registered yet). */
|
|
14
|
+
open: () => void;
|
|
15
|
+
/** Hides the panel. */
|
|
16
|
+
close: () => void;
|
|
17
|
+
/** Toggles visibility — mirrors the keyboard hotkey. */
|
|
18
|
+
toggle: () => void;
|
|
19
|
+
}
|
|
20
|
+
declare global {
|
|
21
|
+
interface Window {
|
|
22
|
+
devPanel?: DevPanelConsoleApi;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Registers `window.devPanel` and prints a one-line discovery hint.
|
|
27
|
+
*
|
|
28
|
+
* SSR-safe (no-op when `window` is undefined) and idempotent in practice: it is
|
|
29
|
+
* called from `mountDevPanelPortal`, which only runs once, so the hint logs a
|
|
30
|
+
* single time.
|
|
31
|
+
*/
|
|
32
|
+
export declare function registerDevPanelConsoleApi(): void;
|
|
33
|
+
/**
|
|
34
|
+
* Removes `window.devPanel`. Mirrors `unmountDevPanelPortal` for clean teardown
|
|
35
|
+
* (HMR, tests).
|
|
36
|
+
*/
|
|
37
|
+
export declare function unregisterDevPanelConsoleApi(): void;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { toggleDevPanel as e, hideDevPanel as n, showDevPanel as o } from "../../store/UIStore.js";
|
|
3
|
+
function l() {
|
|
4
|
+
typeof window > "u" || (window.devPanel = {
|
|
5
|
+
open: o,
|
|
6
|
+
close: n,
|
|
7
|
+
toggle: e
|
|
8
|
+
}, console.info("[DevPanel] ready — type `devPanel.toggle()` in the console to open it."));
|
|
9
|
+
}
|
|
10
|
+
function t() {
|
|
11
|
+
typeof window > "u" || delete window.devPanel;
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
l as registerDevPanelConsoleApi,
|
|
15
|
+
t as unregisterDevPanelConsoleApi
|
|
16
|
+
};
|
|
@@ -4,7 +4,11 @@ import { DevPanelProps } from '../../components/DevPanel/types';
|
|
|
4
4
|
* Hook to register controls in the dev panel with auto-mounting
|
|
5
5
|
* @param sectionName - Section name (e.g: 'Global', 'HomePage')
|
|
6
6
|
* @param controls - Controls configuration object
|
|
7
|
-
* @param devPanelProps - Optional DevPanel configuration (title, hotkey, theme)
|
|
7
|
+
* @param devPanelProps - Optional DevPanel configuration (title, hotkey, theme, enabled)
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* Pass `devPanelProps.enabled = false` to make this call a no-op (e.g.
|
|
11
|
+
* `enabled: import.meta.env.DEV` to disable the panel in production).
|
|
8
12
|
*
|
|
9
13
|
* @example
|
|
10
14
|
* ```typescript
|