@berenjena/react-dev-panel 1.0.3 → 2.0.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 +32 -171
- package/dist/assets/BooleanControl.css +1 -1
- package/dist/assets/ButtonControl.css +1 -1
- package/dist/assets/ButtonGroupControl.css +1 -1
- package/dist/assets/ColorControl.css +1 -1
- package/dist/assets/ControlRenderer.css +1 -1
- package/dist/assets/DevPanel.css +1 -1
- package/dist/assets/EmptyContent.css +1 -1
- package/dist/assets/Input.css +1 -1
- package/dist/assets/MultiSelectControl.css +1 -0
- package/dist/assets/RangeControl.css +1 -1
- package/dist/assets/Section.css +1 -1
- package/dist/assets/Select.css +1 -1
- package/dist/assets/SeparatorControl.css +1 -1
- package/dist/assets/index.css +1 -1
- package/dist/components/ControlRenderer/ControlRenderer.js +38 -18
- package/dist/components/ControlRenderer/controls/BooleanControl/BooleanControl.d.ts +20 -4
- package/dist/components/ControlRenderer/controls/BooleanControl/BooleanControl.js +16 -14
- package/dist/components/ControlRenderer/controls/ButtonControl/ButtonControl.d.ts +22 -5
- package/dist/components/ControlRenderer/controls/ButtonControl/ButtonControl.js +2 -2
- package/dist/components/ControlRenderer/controls/ButtonGroupControl/ButtonGroupControl.d.ts +35 -0
- package/dist/components/ControlRenderer/controls/ButtonGroupControl/ButtonGroupControl.js +2 -2
- package/dist/components/ControlRenderer/controls/ColorControl/ColorControl.d.ts +13 -6
- package/dist/components/ControlRenderer/controls/ColorControl/ColorControl.js +61 -15
- package/dist/components/ControlRenderer/controls/ColorControl/types.d.ts +14 -0
- package/dist/components/ControlRenderer/controls/DateControl/DateControl.d.ts +17 -5
- package/dist/components/ControlRenderer/controls/DateControl/DateControl.js +12 -12
- package/dist/components/ControlRenderer/controls/MultiSelectControl/MultiSelectControl.d.ts +28 -0
- package/dist/components/ControlRenderer/controls/MultiSelectControl/MultiSelectControl.js +131 -0
- package/dist/components/ControlRenderer/controls/MultiSelectControl/index.d.ts +1 -0
- package/dist/components/ControlRenderer/controls/MultiSelectControl/index.js +4 -0
- package/dist/components/ControlRenderer/controls/MultiSelectControl/types.d.ts +11 -0
- package/dist/components/ControlRenderer/controls/NumberControl/NumberControl.d.ts +26 -11
- package/dist/components/ControlRenderer/controls/NumberControl/NumberControl.js +14 -14
- package/dist/components/ControlRenderer/controls/RangeControl/RangeControl.d.ts +27 -11
- package/dist/components/ControlRenderer/controls/RangeControl/RangeControl.js +19 -19
- package/dist/components/ControlRenderer/controls/SelectControl/SelectControl.d.ts +29 -5
- package/dist/components/ControlRenderer/controls/SeparatorControl/SeparatorControl.d.ts +16 -7
- package/dist/components/ControlRenderer/controls/SeparatorControl/SeparatorControl.js +6 -6
- package/dist/components/ControlRenderer/controls/TextControl/TextControl.d.ts +24 -13
- package/dist/components/ControlRenderer/controls/TextControl/TextControl.js +15 -15
- package/dist/components/ControlRenderer/controls/index.d.ts +2 -0
- package/dist/components/ControlRenderer/controls/index.js +1 -0
- package/dist/components/ControlRenderer/controls/types.d.ts +2 -0
- package/dist/components/DevPanel/DevPanel.js +45 -40
- package/dist/components/DevPanel/types.d.ts +26 -0
- package/dist/components/DevPanelPortal/DevPanelPortal.d.ts +8 -0
- package/dist/components/DevPanelPortal/DevPanelPortal.js +17 -0
- package/dist/components/DevPanelPortal/index.d.ts +1 -0
- package/dist/components/DevPanelPortal/index.js +4 -0
- package/dist/components/EmptyContent/EmptyContent.js +5 -5
- package/dist/components/Icon/index.d.ts +16 -0
- package/dist/components/Icon/index.js +31 -0
- package/dist/components/Input/Input.js +4 -4
- package/dist/components/Section/Section.js +17 -16
- package/dist/components/Select/Select.js +1 -1
- package/dist/components/index.d.ts +3 -2
- package/dist/components/index.js +8 -6
- package/dist/hooks/useDebounceCallback/index.d.ts +1 -0
- package/dist/hooks/useDebounceCallback/index.js +4 -0
- package/dist/hooks/useDebounceCallback/useDebounceCallback.d.ts +8 -0
- package/dist/hooks/useDebounceCallback/useDebounceCallback.js +17 -0
- package/dist/hooks/useDevPanel/useDevPanel.d.ts +10 -5
- package/dist/hooks/useDevPanel/useDevPanel.js +25215 -12
- package/dist/hooks/useDragAndDrop/useDragAndDrop.d.ts +5 -1
- package/dist/hooks/useDragAndDrop/useDragAndDrop.js +24 -24
- package/dist/index.d.ts +0 -1
- package/dist/index.js +2 -8
- package/dist/managers/DevPanelManager.d.ts +85 -0
- package/dist/managers/DevPanelManager.js +119 -0
- package/dist/managers/index.d.ts +1 -0
- package/dist/managers/index.js +4 -0
- package/dist/store/BaseStoreService.d.ts +90 -0
- package/dist/store/BaseStoreService.js +90 -0
- package/dist/store/SectionsStore.d.ts +40 -0
- package/dist/store/SectionsStore.js +114 -0
- package/dist/store/ThemeStore.d.ts +68 -0
- package/dist/store/ThemeStore.js +102 -0
- package/dist/store/{store.d.ts → UIStore.d.ts} +17 -35
- package/dist/store/UIStore.js +117 -0
- package/dist/store/index.d.ts +4 -1
- package/dist/store/index.js +16 -7
- package/package.json +12 -3
- package/dist/assets/index2.css +0 -1
- package/dist/components/Logger/index.d.ts +0 -20
- package/dist/components/Logger/index.js +0 -85
- package/dist/store/store.js +0 -239
|
@@ -1,67 +1,72 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useCallback as
|
|
3
|
-
import { useDragAndDrop as
|
|
4
|
-
import { useHotkey as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { jsxs as d, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback as D, useEffect as y } from "react";
|
|
3
|
+
import { useDragAndDrop as b } from "../../hooks/useDragAndDrop/useDragAndDrop.js";
|
|
4
|
+
import { useHotkey as w } from "../../hooks/useHotkeys/useHotkey.js";
|
|
5
|
+
import { useDevPanelSections as K } from "../../store/SectionsStore.js";
|
|
6
|
+
import { useDevPanelThemeActions as N } from "../../store/ThemeStore.js";
|
|
7
|
+
import { useDevPanelUI as k } from "../../store/UIStore.js";
|
|
8
|
+
import { className as x } from "../../utils/className/className.js";
|
|
9
|
+
import { EmptyContent as E } from "../EmptyContent/EmptyContent.js";
|
|
10
|
+
import { Icon as f } from "../Icon/index.js";
|
|
11
|
+
import { Section as j } from "../Section/Section.js";
|
|
12
|
+
import '../../assets/DevPanel.css';const A = "_devPanelContainer_vacct_132", S = "_header_vacct_171", H = "_title_vacct_186", I = "_button_vacct_197", T = "_collapsed_vacct_233", V = "_content_vacct_240", t = {
|
|
13
|
+
devPanelContainer: A,
|
|
14
|
+
header: S,
|
|
15
|
+
title: H,
|
|
16
|
+
button: I,
|
|
17
|
+
collapsed: T,
|
|
18
|
+
content: V
|
|
19
|
+
}, O = {
|
|
17
20
|
ctrlKey: !0,
|
|
18
21
|
shiftKey: !0,
|
|
19
22
|
key: "a",
|
|
20
23
|
altKey: !1,
|
|
21
24
|
metaKey: !1
|
|
22
25
|
};
|
|
23
|
-
function
|
|
24
|
-
const { isVisible:
|
|
25
|
-
(
|
|
26
|
-
|
|
26
|
+
function Q({ panelTitle: h = "Dev panel", ...o }) {
|
|
27
|
+
const { isVisible: s, isCollapsed: n, position: a, setVisible: l, setCollapsed: u, setPosition: c } = k(), { setTheme: r } = N(), v = K(), p = D(
|
|
28
|
+
(i) => {
|
|
29
|
+
c(i);
|
|
27
30
|
},
|
|
28
|
-
[
|
|
29
|
-
), { isDragging:
|
|
30
|
-
onPositionChange:
|
|
31
|
+
[c]
|
|
32
|
+
), { isDragging: _, elementRef: C, handlePointerDown: g } = b({
|
|
33
|
+
onPositionChange: p
|
|
31
34
|
});
|
|
32
|
-
if (
|
|
35
|
+
if (w({
|
|
33
36
|
description: "Show Dev Panel",
|
|
34
37
|
preventDefault: !0,
|
|
35
|
-
action: () =>
|
|
36
|
-
...
|
|
37
|
-
...
|
|
38
|
+
action: () => l(!s),
|
|
39
|
+
...O,
|
|
40
|
+
...o.hotKeyConfig,
|
|
38
41
|
target: window
|
|
39
|
-
}),
|
|
42
|
+
}), y(() => {
|
|
43
|
+
o.theme && r(o.theme);
|
|
44
|
+
}, [o.theme, r]), !s)
|
|
40
45
|
return null;
|
|
41
|
-
const
|
|
42
|
-
return /* @__PURE__ */
|
|
46
|
+
const m = Object.entries(v);
|
|
47
|
+
return /* @__PURE__ */ d(
|
|
43
48
|
"div",
|
|
44
49
|
{
|
|
45
|
-
ref:
|
|
46
|
-
...
|
|
47
|
-
[t.dragging]:
|
|
50
|
+
ref: C,
|
|
51
|
+
...x(t.devPanelContainer, {
|
|
52
|
+
[t.dragging]: _
|
|
48
53
|
}),
|
|
49
54
|
style: {
|
|
50
55
|
left: a.x,
|
|
51
56
|
top: a.y,
|
|
52
|
-
height:
|
|
57
|
+
height: n ? "auto" : void 0
|
|
53
58
|
},
|
|
54
59
|
children: [
|
|
55
|
-
/* @__PURE__ */
|
|
56
|
-
/* @__PURE__ */ e("button", { className: t.button, onClick: () =>
|
|
57
|
-
/* @__PURE__ */ e("div", { className: t.title, children:
|
|
58
|
-
/* @__PURE__ */ e("button", { className: t.button, onClick: () =>
|
|
60
|
+
/* @__PURE__ */ d("div", { className: t.header, onPointerDown: g, children: [
|
|
61
|
+
/* @__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 }) }),
|
|
62
|
+
/* @__PURE__ */ e("div", { className: t.title, children: h }),
|
|
63
|
+
/* @__PURE__ */ e("button", { className: t.button, onClick: () => l(!1), title: "Close", children: /* @__PURE__ */ e(f, { name: "Close" }) })
|
|
59
64
|
] }),
|
|
60
|
-
!
|
|
65
|
+
!n && /* @__PURE__ */ e("div", { className: t.content, children: m.length ? m.map(([i, P]) => /* @__PURE__ */ e(j, { sectionName: i, section: P }, `section-${i}`)) : /* @__PURE__ */ e(E, {}) })
|
|
61
66
|
]
|
|
62
67
|
}
|
|
63
68
|
);
|
|
64
69
|
}
|
|
65
70
|
export {
|
|
66
|
-
|
|
71
|
+
Q as DevPanel
|
|
67
72
|
};
|
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
import { ControlsGroup } from '../ControlRenderer/controls/types';
|
|
2
2
|
export type DevPanelHotkeyConfig = Pick<HotkeyConfig, "key" | "shiftKey" | "altKey" | "ctrlKey" | "metaKey">;
|
|
3
|
+
export type BuiltInTheme =
|
|
4
|
+
| "auto"
|
|
5
|
+
| "dark"
|
|
6
|
+
| "light"
|
|
7
|
+
| "orange"
|
|
8
|
+
| "purple"
|
|
9
|
+
| "green"
|
|
10
|
+
| "neon"
|
|
11
|
+
| "corporate"
|
|
12
|
+
| "highContrast"
|
|
13
|
+
| "sunset"
|
|
14
|
+
| "ocean"
|
|
15
|
+
| "forest"
|
|
16
|
+
| "midnight"
|
|
17
|
+
| "cherry"
|
|
18
|
+
| "gold"
|
|
19
|
+
| "retro"
|
|
20
|
+
| "pastel"
|
|
21
|
+
| "cyberpunk"
|
|
22
|
+
| "autumn"
|
|
23
|
+
| "arctic"
|
|
24
|
+
| "volcano";
|
|
3
25
|
|
|
4
26
|
export interface DevPanelProps {
|
|
5
27
|
panelTitle?: string;
|
|
@@ -17,6 +39,8 @@ export interface DevPanelProps {
|
|
|
17
39
|
* ```
|
|
18
40
|
*/
|
|
19
41
|
hotKeyConfig?: DevPanelHotkeyConfig;
|
|
42
|
+
|
|
43
|
+
theme?: BuiltInTheme;
|
|
20
44
|
}
|
|
21
45
|
|
|
22
46
|
export interface DevPanelSection {
|
|
@@ -32,6 +56,8 @@ export interface DevPanelState {
|
|
|
32
56
|
position: Position;
|
|
33
57
|
}
|
|
34
58
|
|
|
59
|
+
export type DevPanelUIState = Omit<DevPanelState, "sections">;
|
|
60
|
+
|
|
35
61
|
export interface DevPanelActions {
|
|
36
62
|
setVisible: (visible: boolean) => void;
|
|
37
63
|
setCollapsed: (collapsed: boolean) => void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Portal component that renders DevPanel using React's createPortal.
|
|
3
|
+
* Automatically subscribes to DevPanelManager prop changes and renders
|
|
4
|
+
* the DevPanel with merged props into document.body.
|
|
5
|
+
*
|
|
6
|
+
* @returns DevPanel rendered as a portal in document.body
|
|
7
|
+
*/
|
|
8
|
+
export declare const DevPanelPortal: () => import('react').ReactPortal;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { useState as a, useEffect as m } from "react";
|
|
3
|
+
import { createPortal as c } from "react-dom";
|
|
4
|
+
import { DevPanelManager as r } from "../../managers/DevPanelManager.js";
|
|
5
|
+
import { DevPanel as p } from "../DevPanel/DevPanel.js";
|
|
6
|
+
const b = () => {
|
|
7
|
+
const [t, e] = a({});
|
|
8
|
+
return m(() => {
|
|
9
|
+
const o = r.getInstance().getAllProps();
|
|
10
|
+
return e(o), r.getInstance().onPropsChange((n) => {
|
|
11
|
+
e(n);
|
|
12
|
+
});
|
|
13
|
+
}, []), c(/* @__PURE__ */ s(p, { ...t }), document.body);
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
b as DevPanelPortal
|
|
17
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DevPanelPortal } from './DevPanelPortal';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsxs as t, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import '../../assets/EmptyContent.css';const
|
|
3
|
-
empty:
|
|
2
|
+
import '../../assets/EmptyContent.css';const s = "_empty_1bkns_1", o = {
|
|
3
|
+
empty: s
|
|
4
4
|
};
|
|
5
|
-
function
|
|
6
|
-
return /* @__PURE__ */ t("div", { className:
|
|
5
|
+
function r() {
|
|
6
|
+
return /* @__PURE__ */ t("div", { className: o.empty, children: [
|
|
7
7
|
"No controls registered yet.",
|
|
8
8
|
/* @__PURE__ */ e("br", {}),
|
|
9
9
|
" ",
|
|
@@ -14,5 +14,5 @@ function n() {
|
|
|
14
14
|
] });
|
|
15
15
|
}
|
|
16
16
|
export {
|
|
17
|
-
|
|
17
|
+
r as EmptyContent
|
|
18
18
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare const availableIcons: {
|
|
2
|
+
ArrowDown: (props: React.SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
Close: (props: React.SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
Check: (props: React.SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
};
|
|
6
|
+
interface IconProps extends React.SVGProps<SVGSVGElement> {
|
|
7
|
+
/** The name of the icon to render */
|
|
8
|
+
name: keyof typeof availableIcons;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Icon component for rendering SVG icons.
|
|
12
|
+
* @param props - The properties for the icon component.
|
|
13
|
+
* @returns The SVG element for the specified icon, or null if the icon is not found.
|
|
14
|
+
*/
|
|
15
|
+
export declare function Icon({ name, ...props }: IconProps): React.ReactNode;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
+
const t = {
|
|
3
|
+
ArrowDown: (o) => /* @__PURE__ */ l("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", ...o, children: /* @__PURE__ */ l("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" }) }),
|
|
4
|
+
Close: (o) => /* @__PURE__ */ l("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", ...o, children: /* @__PURE__ */ l("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" }) }),
|
|
5
|
+
Check: (o) => /* @__PURE__ */ l(
|
|
6
|
+
"svg",
|
|
7
|
+
{
|
|
8
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
9
|
+
viewBox: "0 0 24 24",
|
|
10
|
+
clipRule: "evenodd",
|
|
11
|
+
fillRule: "evenodd",
|
|
12
|
+
strokeLinejoin: "round",
|
|
13
|
+
strokeMiterlimit: "2",
|
|
14
|
+
...o,
|
|
15
|
+
children: /* @__PURE__ */ l(
|
|
16
|
+
"path",
|
|
17
|
+
{
|
|
18
|
+
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",
|
|
19
|
+
fillRule: "nonzero"
|
|
20
|
+
}
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
)
|
|
24
|
+
};
|
|
25
|
+
function r({ name: o, ...e }) {
|
|
26
|
+
const n = t[o];
|
|
27
|
+
return n ? /* @__PURE__ */ l(n, { ...e }) : null;
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
r as Icon
|
|
31
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import '../../assets/Input.css';const p = "
|
|
2
|
+
import '../../assets/Input.css';const p = "_input_pspvf_132", s = {
|
|
3
3
|
input: p
|
|
4
4
|
};
|
|
5
|
-
function
|
|
6
|
-
return /* @__PURE__ */ n("input", { ...t, className:
|
|
5
|
+
function i(t) {
|
|
6
|
+
return /* @__PURE__ */ n("input", { ...t, className: s.input });
|
|
7
7
|
}
|
|
8
8
|
export {
|
|
9
|
-
|
|
9
|
+
i as Input
|
|
10
10
|
};
|
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as n, jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import { ControlRenderer as i } from "../ControlRenderer/ControlRenderer.js";
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
3
|
+
import { useDevPanelSectionActions as r } from "../../store/SectionsStore.js";
|
|
4
|
+
import { Icon as p } from "../Icon/index.js";
|
|
5
|
+
import '../../assets/Section.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 = {
|
|
5
6
|
section: d,
|
|
6
|
-
header:
|
|
7
|
-
title:
|
|
8
|
-
toggle:
|
|
9
|
-
collapsed:
|
|
10
|
-
content:
|
|
7
|
+
header: _,
|
|
8
|
+
title: m,
|
|
9
|
+
toggle: g,
|
|
10
|
+
collapsed: h,
|
|
11
|
+
content: x
|
|
11
12
|
};
|
|
12
|
-
function
|
|
13
|
-
const c = r();
|
|
14
|
-
return /* @__PURE__ */
|
|
15
|
-
/* @__PURE__ */
|
|
16
|
-
/* @__PURE__ */
|
|
17
|
-
/* @__PURE__ */
|
|
13
|
+
function N({ sectionName: s, section: t }) {
|
|
14
|
+
const { toggleSectionCollapse: c } = r();
|
|
15
|
+
return /* @__PURE__ */ n("div", { className: e.section, children: [
|
|
16
|
+
/* @__PURE__ */ n("div", { className: e.header, onClick: () => c(s), children: [
|
|
17
|
+
/* @__PURE__ */ o("span", { className: e.title, children: t.name }),
|
|
18
|
+
/* @__PURE__ */ o("span", { className: e.toggle, children: /* @__PURE__ */ o(p, { name: "ArrowDown", className: t.isCollapsed ? e.collapsed : void 0 }) })
|
|
18
19
|
] }),
|
|
19
|
-
!t.isCollapsed && /* @__PURE__ */
|
|
20
|
+
!t.isCollapsed && /* @__PURE__ */ o("div", { className: e.content, children: Object.entries(t.controls).map(([l, a]) => /* @__PURE__ */ o(i, { name: l, control: a }, l)) })
|
|
20
21
|
] });
|
|
21
22
|
}
|
|
22
23
|
export {
|
|
23
|
-
|
|
24
|
+
N as Section
|
|
24
25
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export { DevPanel } from './DevPanel';
|
|
2
|
+
export { DevPanelPortal } from './DevPanelPortal';
|
|
3
3
|
export { ControlRenderer } from './ControlRenderer';
|
|
4
|
+
export { controls } from './ControlRenderer/controls';
|
package/dist/components/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { ControlRenderer as
|
|
1
|
+
import { DevPanel as e } from "./DevPanel/DevPanel.js";
|
|
2
|
+
import { DevPanelPortal as l } from "./DevPanelPortal/DevPanelPortal.js";
|
|
3
|
+
import { ControlRenderer as f } from "./ControlRenderer/ControlRenderer.js";
|
|
4
|
+
import { controls as p } from "./ControlRenderer/controls/index.js";
|
|
4
5
|
export {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
f as ControlRenderer,
|
|
7
|
+
e as DevPanel,
|
|
8
|
+
l as DevPanelPortal,
|
|
9
|
+
p as controls
|
|
8
10
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useDebounceCallback';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a debounced version of a callback.
|
|
3
|
+
*
|
|
4
|
+
* @param callback - Function to debounce
|
|
5
|
+
* @param delay - Delay in ms before calling the callback
|
|
6
|
+
* @returns A debounced version of the callback
|
|
7
|
+
*/
|
|
8
|
+
export declare function useDebouncedCallback<T extends (...args: Parameters<T>) => void>(callback: T, delay: number): (...args: Parameters<T>) => void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useRef as n, useEffect as c, useCallback as o } from "react";
|
|
2
|
+
function f(r, t) {
|
|
3
|
+
const e = n(null);
|
|
4
|
+
return c(() => () => {
|
|
5
|
+
e.current && clearTimeout(e.current);
|
|
6
|
+
}, []), o(
|
|
7
|
+
(...u) => {
|
|
8
|
+
e.current && clearTimeout(e.current), e.current = window.setTimeout(() => {
|
|
9
|
+
r(...u);
|
|
10
|
+
}, t);
|
|
11
|
+
},
|
|
12
|
+
[r, t]
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
f as useDebouncedCallback
|
|
17
|
+
};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { ControlsGroup } from '../../components/ControlRenderer/controls/types';
|
|
2
|
+
import { DevPanelProps } from '../../components/DevPanel/types';
|
|
2
3
|
/**
|
|
3
|
-
* Hook to register controls in the dev panel
|
|
4
|
+
* Hook to register controls in the dev panel with auto-mounting
|
|
4
5
|
* @param sectionName - Section name (e.g: 'Global', 'HomePage')
|
|
5
|
-
* @param controls - Controls configuration
|
|
6
|
+
* @param controls - Controls configuration object
|
|
7
|
+
* @param devPanelProps - Optional DevPanel configuration (title, hotkey, theme)
|
|
6
8
|
*
|
|
7
9
|
* @example
|
|
8
10
|
* ```typescript
|
|
@@ -11,14 +13,17 @@ import { ControlsGroup } from '../../components/ControlRenderer/controls/types';
|
|
|
11
13
|
* type: 'select',
|
|
12
14
|
* value: 'light',
|
|
13
15
|
* options: ['light', 'dark'],
|
|
14
|
-
* onChange:
|
|
16
|
+
* onChange: setTheme
|
|
15
17
|
* },
|
|
16
18
|
* debugMode: {
|
|
17
19
|
* type: 'boolean',
|
|
18
20
|
* value: false,
|
|
19
|
-
* onChange:
|
|
21
|
+
* onChange: setDebugMode
|
|
20
22
|
* }
|
|
23
|
+
* }, {
|
|
24
|
+
* panelTitle: 'My App Controls',
|
|
25
|
+
* theme: 'dark'
|
|
21
26
|
* });
|
|
22
27
|
* ```
|
|
23
28
|
*/
|
|
24
|
-
export declare function useDevPanel(sectionName: string, controls: ControlsGroup): void;
|
|
29
|
+
export declare function useDevPanel(sectionName: string, controls: ControlsGroup, devPanelProps?: DevPanelProps): void;
|