@berenjena/react-dev-panel 1.0.4 → 2.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 +75 -52
- package/dist/assets/index.css +1 -1
- package/dist/assets/index10.css +1 -0
- package/dist/assets/index11.css +1 -0
- package/dist/assets/index12.css +1 -0
- package/dist/assets/index13.css +1 -0
- package/dist/assets/index2.css +1 -1
- package/dist/assets/index3.css +1 -0
- package/dist/assets/index4.css +1 -0
- package/dist/assets/index5.css +1 -0
- package/dist/assets/index6.css +1 -0
- package/dist/assets/index7.css +1 -0
- package/dist/assets/index8.css +1 -0
- package/dist/assets/index9.css +1 -0
- package/dist/components/ControlRenderer/controls/BooleanControl/index.d.ts +32 -1
- package/dist/components/ControlRenderer/controls/BooleanControl/index.js +24 -2
- package/dist/components/ControlRenderer/controls/ButtonControl/index.d.ts +33 -1
- package/dist/components/ControlRenderer/controls/ButtonControl/index.js +8 -2
- package/dist/components/ControlRenderer/controls/ButtonGroupControl/index.d.ts +37 -1
- package/dist/components/ControlRenderer/controls/ButtonGroupControl/index.js +20 -2
- package/dist/components/ControlRenderer/controls/ColorControl/index.d.ts +23 -1
- package/dist/components/ControlRenderer/controls/ColorControl/index.js +67 -2
- package/dist/components/ControlRenderer/controls/ColorControl/types.d.ts +14 -0
- package/dist/components/ControlRenderer/controls/DateControl/index.d.ts +41 -1
- package/dist/components/ControlRenderer/controls/DateControl/index.js +29 -2
- package/dist/components/ControlRenderer/controls/MultiSelectControl/index.d.ts +28 -0
- package/dist/components/ControlRenderer/controls/MultiSelectControl/index.js +18 -0
- package/dist/components/ControlRenderer/controls/MultiSelectControl/types.d.ts +11 -0
- package/dist/components/ControlRenderer/controls/NumberControl/index.d.ts +45 -1
- package/dist/components/ControlRenderer/controls/NumberControl/index.js +30 -2
- package/dist/components/ControlRenderer/controls/RangeControl/index.d.ts +46 -1
- package/dist/components/ControlRenderer/controls/RangeControl/index.js +38 -2
- package/dist/components/ControlRenderer/controls/SelectControl/index.d.ts +39 -1
- package/dist/components/ControlRenderer/controls/SelectControl/index.js +6 -2
- package/dist/components/ControlRenderer/controls/SeparatorControl/index.d.ts +39 -1
- package/dist/components/ControlRenderer/controls/SeparatorControl/index.js +12 -2
- package/dist/components/ControlRenderer/controls/TextControl/index.d.ts +40 -1
- package/dist/components/ControlRenderer/controls/TextControl/index.js +28 -2
- 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/ControlRenderer/index.d.ts +6 -1
- package/dist/components/ControlRenderer/index.js +50 -2
- package/dist/components/DevPanel/index.d.ts +11 -1
- package/dist/components/DevPanel/index.js +69 -2
- package/dist/components/DevPanel/types.d.ts +36 -5
- package/dist/components/DevPanelPortal/index.d.ts +9 -0
- package/dist/components/DevPanelPortal/index.js +17 -0
- package/dist/components/EmptyContent/index.d.ts +1 -1
- package/dist/components/EmptyContent/index.js +17 -2
- package/dist/components/Icon/index.d.ts +16 -0
- package/dist/components/Icon/index.js +31 -0
- package/dist/components/Input/index.d.ts +1 -1
- package/dist/components/Input/index.js +8 -2
- package/dist/components/Section/index.d.ts +7 -1
- package/dist/components/Section/index.js +23 -2
- package/dist/components/Select/index.d.ts +15 -1
- package/dist/components/Select/index.js +176 -2
- package/dist/components/index.d.ts +3 -2
- package/dist/components/index.js +8 -6
- package/dist/hooks/useDebounceCallback/index.d.ts +8 -1
- package/dist/hooks/useDebounceCallback/index.js +15 -2
- package/dist/hooks/useDevPanel/index.d.ts +29 -1
- package/dist/hooks/useDevPanel/index.js +22 -2
- package/dist/hooks/useDragAndDrop/index.d.ts +20 -1
- package/dist/hooks/useDragAndDrop/index.js +53 -2
- package/dist/hooks/{useHotkeys/useHotkey.d.ts → useHotKey/index.d.ts} +1 -1
- package/dist/hooks/{useHotkeys/useHotkey.js → useHotKey/index.js} +1 -1
- package/dist/hooks/useHotkeys/index.d.ts +37 -2
- package/dist/hooks/useHotkeys/index.js +29 -4
- 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/store/SectionsStore.js +112 -5
- package/dist/store/UIStore.d.ts +78 -2
- package/dist/store/UIStore.js +176 -9
- package/dist/utils/getPositionAdjustment/getPositionAdjustment.d.ts +3 -2
- package/dist/utils/getPositionAdjustment/getPositionAdjustment.js +1 -4
- package/package.json +53 -30
- package/dist/UIStore-CQdr4U-2.js +0 -227
- package/dist/assets/BooleanControl.css +0 -1
- package/dist/assets/ButtonControl.css +0 -1
- package/dist/assets/ButtonGroupControl.css +0 -1
- package/dist/assets/ColorControl.css +0 -1
- package/dist/assets/ControlRenderer.css +0 -1
- package/dist/assets/DevPanel.css +0 -1
- package/dist/assets/EmptyContent.css +0 -1
- package/dist/assets/Input.css +0 -1
- package/dist/assets/RangeControl.css +0 -1
- package/dist/assets/Section.css +0 -1
- package/dist/assets/Select.css +0 -1
- package/dist/assets/SeparatorControl.css +0 -1
- package/dist/components/ControlRenderer/ControlRenderer.d.ts +0 -6
- package/dist/components/ControlRenderer/ControlRenderer.js +0 -32
- package/dist/components/ControlRenderer/controls/BooleanControl/BooleanControl.d.ts +0 -16
- package/dist/components/ControlRenderer/controls/BooleanControl/BooleanControl.js +0 -24
- package/dist/components/ControlRenderer/controls/ButtonControl/ButtonControl.d.ts +0 -16
- package/dist/components/ControlRenderer/controls/ButtonControl/ButtonControl.js +0 -10
- package/dist/components/ControlRenderer/controls/ButtonGroupControl/ButtonGroupControl.d.ts +0 -2
- package/dist/components/ControlRenderer/controls/ButtonGroupControl/ButtonGroupControl.js +0 -22
- package/dist/components/ControlRenderer/controls/ColorControl/ColorControl.d.ts +0 -16
- package/dist/components/ControlRenderer/controls/ColorControl/ColorControl.js +0 -27
- package/dist/components/ControlRenderer/controls/DateControl/DateControl.d.ts +0 -29
- package/dist/components/ControlRenderer/controls/DateControl/DateControl.js +0 -31
- package/dist/components/ControlRenderer/controls/NumberControl/NumberControl.d.ts +0 -30
- package/dist/components/ControlRenderer/controls/NumberControl/NumberControl.js +0 -32
- package/dist/components/ControlRenderer/controls/RangeControl/RangeControl.d.ts +0 -30
- package/dist/components/ControlRenderer/controls/RangeControl/RangeControl.js +0 -40
- package/dist/components/ControlRenderer/controls/SelectControl/SelectControl.d.ts +0 -15
- package/dist/components/ControlRenderer/controls/SelectControl/SelectControl.js +0 -11
- package/dist/components/ControlRenderer/controls/SeparatorControl/SeparatorControl.d.ts +0 -30
- package/dist/components/ControlRenderer/controls/SeparatorControl/SeparatorControl.js +0 -14
- package/dist/components/ControlRenderer/controls/TextControl/TextControl.d.ts +0 -29
- package/dist/components/ControlRenderer/controls/TextControl/TextControl.js +0 -30
- package/dist/components/DevPanel/DevPanel.d.ts +0 -11
- package/dist/components/DevPanel/DevPanel.js +0 -67
- package/dist/components/EmptyContent/EmptyContent.d.ts +0 -1
- package/dist/components/EmptyContent/EmptyContent.js +0 -18
- package/dist/components/Input/Input.d.ts +0 -1
- package/dist/components/Input/Input.js +0 -10
- package/dist/components/Logger/index.d.ts +0 -20
- package/dist/components/Logger/index.js +0 -85
- package/dist/components/Section/Section.d.ts +0 -7
- package/dist/components/Section/Section.js +0 -24
- package/dist/components/Select/Select.d.ts +0 -1
- package/dist/components/Select/Select.js +0 -10
- package/dist/hooks/useDebounceCallback/useDebounceCallback.d.ts +0 -8
- package/dist/hooks/useDebounceCallback/useDebounceCallback.js +0 -17
- package/dist/hooks/useDevPanel/useDevPanel.d.ts +0 -24
- package/dist/hooks/useDevPanel/useDevPanel.js +0 -15
- package/dist/hooks/useDragAndDrop/useDragAndDrop.d.ts +0 -16
- package/dist/hooks/useDragAndDrop/useDragAndDrop.js +0 -55
- package/dist/hooks/useHotkeys/useHotkeys.d.ts +0 -37
- package/dist/hooks/useHotkeys/useHotkeys.js +0 -31
- package/dist/store/index.d.ts +0 -3
- package/dist/store/index.js +0 -13
- package/dist/utils/index.d.ts +0 -9
- package/dist/utils/index.js +0 -20
|
@@ -1,4 +1,30 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
2
|
+
import { useState as h, useEffect as i } from "react";
|
|
3
|
+
import { Input as s } from "../../../Input/index.js";
|
|
4
|
+
function v({ control: e }) {
|
|
5
|
+
const n = e.event || "onChange", [l, u] = h(e.value);
|
|
6
|
+
function o(t) {
|
|
7
|
+
const a = t.target.value;
|
|
8
|
+
u(a), n === "onChange" && e.onChange(a);
|
|
9
|
+
}
|
|
10
|
+
function r(t) {
|
|
11
|
+
const a = t.target.value;
|
|
12
|
+
n === "onBlur" && e.onChange(a);
|
|
13
|
+
}
|
|
14
|
+
return i(() => {
|
|
15
|
+
u(e.value);
|
|
16
|
+
}, [e.value]), /* @__PURE__ */ f(
|
|
17
|
+
s,
|
|
18
|
+
{
|
|
19
|
+
type: "text",
|
|
20
|
+
value: l,
|
|
21
|
+
placeholder: e.placeholder,
|
|
22
|
+
disabled: e.disabled,
|
|
23
|
+
onChange: o,
|
|
24
|
+
...n === "onBlur" && { onBlur: r }
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
}
|
|
2
28
|
export {
|
|
3
|
-
|
|
29
|
+
v as TextControl
|
|
4
30
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Exports all control components as a frozen object.
|
|
3
|
+
*
|
|
3
4
|
* **Note:** This allows components to be loaded lazily.
|
|
4
5
|
*/
|
|
5
6
|
export declare const controls: Readonly<{
|
|
@@ -10,6 +11,7 @@ export declare const controls: Readonly<{
|
|
|
10
11
|
number: import('react').LazyExoticComponent<typeof import('./NumberControl').NumberControl>;
|
|
11
12
|
range: import('react').LazyExoticComponent<typeof import('./RangeControl').RangeControl>;
|
|
12
13
|
select: import('react').LazyExoticComponent<typeof import('./SelectControl').SelectControl>;
|
|
14
|
+
multiselect: import('react').LazyExoticComponent<typeof import('./MultiSelectControl').MultiSelectControl>;
|
|
13
15
|
separator: import('react').LazyExoticComponent<typeof import('./SeparatorControl').SeparatorControl>;
|
|
14
16
|
text: import('react').LazyExoticComponent<typeof import('./TextControl').TextControl>;
|
|
15
17
|
buttonGroup: import('react').LazyExoticComponent<typeof import('./ButtonGroupControl').ButtonGroupControl>;
|
|
@@ -7,6 +7,7 @@ const r = Object.freeze({
|
|
|
7
7
|
number: o(() => import("./NumberControl/index.js").then((t) => ({ default: t.NumberControl }))),
|
|
8
8
|
range: o(() => import("./RangeControl/index.js").then((t) => ({ default: t.RangeControl }))),
|
|
9
9
|
select: o(() => import("./SelectControl/index.js").then((t) => ({ default: t.SelectControl }))),
|
|
10
|
+
multiselect: o(() => import("./MultiSelectControl/index.js").then((t) => ({ default: t.MultiSelectControl }))),
|
|
10
11
|
separator: o(() => import("./SeparatorControl/index.js").then((t) => ({ default: t.SeparatorControl }))),
|
|
11
12
|
text: o(() => import("./TextControl/index.js").then((t) => ({ default: t.TextControl }))),
|
|
12
13
|
buttonGroup: o(() => import("./ButtonGroupControl/index.js").then((t) => ({ default: t.ButtonGroupControl })))
|
|
@@ -3,6 +3,7 @@ import { ButtonControl } from './ButtonControl/types';
|
|
|
3
3
|
import { ButtonGroupControl } from './ButtonGroupControl/types';
|
|
4
4
|
import { ColorControl } from './ColorControl/types';
|
|
5
5
|
import { DateControl } from './DateControl/types';
|
|
6
|
+
import { MultiSelectControl } from './MultiSelectControl/types';
|
|
6
7
|
import { NumberControl } from './NumberControl/types';
|
|
7
8
|
import { RangeControl } from './RangeControl/types';
|
|
8
9
|
import { SelectControl } from './SelectControl/types';
|
|
@@ -23,6 +24,7 @@ export type Controls = {
|
|
|
23
24
|
color: ColorControl;
|
|
24
25
|
boolean: BooleanControl;
|
|
25
26
|
select: SelectControl;
|
|
27
|
+
multiselect: MultiSelectControl;
|
|
26
28
|
text: TextControl;
|
|
27
29
|
button: ButtonControl;
|
|
28
30
|
number: NumberControl;
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { ControlsNames } from './controls/types';
|
|
2
|
+
import { ControlRendererProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Component that renders different types of controls based on the control type
|
|
5
|
+
*/
|
|
6
|
+
export declare function ControlRenderer<Name extends ControlsNames>({ name, control }: ControlRendererProps<Name>): React.ReactNode;
|
|
@@ -1,4 +1,52 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs as t, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { Suspense as c } from "react";
|
|
3
|
+
import { className as s } from "../../utils/className/className.js";
|
|
4
|
+
import { controls as d } from "./controls/index.js";
|
|
5
|
+
import '../../assets/index5.css';const p = "_controlRendererContainer_1s60v_1", _ = "_controlContainer_1s60v_4", u = "_hoverable_1s60v_13", v = "_fullWidth_1s60v_16", f = "_label_1s60v_19", h = "_controlWrapper_1s60v_22", b = "_justifyStart_1s60v_26", C = "_description_1s60v_42", m = "_loading_1s60v_51", y = "_error_1s60v_70", r = {
|
|
6
|
+
controlRendererContainer: p,
|
|
7
|
+
controlContainer: _,
|
|
8
|
+
hoverable: u,
|
|
9
|
+
fullWidth: v,
|
|
10
|
+
label: f,
|
|
11
|
+
controlWrapper: h,
|
|
12
|
+
justifyStart: b,
|
|
13
|
+
description: C,
|
|
14
|
+
loading: m,
|
|
15
|
+
error: y
|
|
16
|
+
}, W = ["button", "buttonGroup", "separator"], j = ["separator"], N = ["button", "separator"];
|
|
17
|
+
function L({ name: l, control: e }) {
|
|
18
|
+
const i = e?.label || l;
|
|
19
|
+
function a() {
|
|
20
|
+
if (!e || !e.type)
|
|
21
|
+
return /* @__PURE__ */ n("div", { className: r.error, children: "Control type is not defined" });
|
|
22
|
+
const o = d[e.type];
|
|
23
|
+
return o ? /* @__PURE__ */ n(c, { fallback: /* @__PURE__ */ n("div", { className: r.loading, children: "Loading control..." }), children: /* @__PURE__ */ n(o, { control: e }) }) : /* @__PURE__ */ n("div", { children: "Unknown control type" });
|
|
24
|
+
}
|
|
25
|
+
return /* @__PURE__ */ t("div", { className: r.controlRendererContainer, children: [
|
|
26
|
+
/* @__PURE__ */ t(
|
|
27
|
+
"div",
|
|
28
|
+
{
|
|
29
|
+
...s(r.controlContainer, {
|
|
30
|
+
[r.fullWidth]: W.includes(e.type),
|
|
31
|
+
[r.hoverable]: !j.includes(e.type)
|
|
32
|
+
}),
|
|
33
|
+
children: [
|
|
34
|
+
!N.includes(e.type) && /* @__PURE__ */ n("label", { className: r.label, children: i }),
|
|
35
|
+
/* @__PURE__ */ n(
|
|
36
|
+
"div",
|
|
37
|
+
{
|
|
38
|
+
...s(r.controlWrapper, {
|
|
39
|
+
[r.justifyStart]: e.type === "separator"
|
|
40
|
+
}),
|
|
41
|
+
children: a()
|
|
42
|
+
}
|
|
43
|
+
)
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
),
|
|
47
|
+
e?.description && /* @__PURE__ */ n("span", { className: r.description, children: e.description })
|
|
48
|
+
] });
|
|
49
|
+
}
|
|
2
50
|
export {
|
|
3
|
-
|
|
51
|
+
L as ControlRenderer
|
|
4
52
|
};
|
|
@@ -1 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import { DevPanelProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Development panel component
|
|
4
|
+
* @returns The development panel component, if the environment is not development, it will return null
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* <DevPanel />
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
export declare function DevPanel({ panelTitle, ...props }: DevPanelProps): React.ReactNode;
|
|
@@ -1,4 +1,71 @@
|
|
|
1
|
-
import {
|
|
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/index.js";
|
|
4
|
+
import { useHotkey as w } from "../../hooks/useHotKey/index.js";
|
|
5
|
+
import { useDevPanelSections as K } from "../../store/SectionsStore.js";
|
|
6
|
+
import { useDevPanelUI as N, useDevPanelThemeActions as k } from "../../store/UIStore.js";
|
|
7
|
+
import { className as x } from "../../utils/className/className.js";
|
|
8
|
+
import { EmptyContent as E } from "../EmptyContent/index.js";
|
|
9
|
+
import { Icon as f } from "../Icon/index.js";
|
|
10
|
+
import { Section as j } from "../Section/index.js";
|
|
11
|
+
import '../../assets/index2.css';const A = "_devPanelContainer_1089m_217", S = "_header_1089m_256", H = "_title_1089m_271", I = "_button_1089m_282", T = "_collapsed_1089m_318", V = "_content_1089m_325", t = {
|
|
12
|
+
devPanelContainer: A,
|
|
13
|
+
header: S,
|
|
14
|
+
title: H,
|
|
15
|
+
button: I,
|
|
16
|
+
collapsed: T,
|
|
17
|
+
content: V
|
|
18
|
+
}, O = {
|
|
19
|
+
ctrlKey: !0,
|
|
20
|
+
shiftKey: !0,
|
|
21
|
+
key: "a",
|
|
22
|
+
altKey: !1,
|
|
23
|
+
metaKey: !1
|
|
24
|
+
};
|
|
25
|
+
function M({ panelTitle: h = "Dev panel", ...o }) {
|
|
26
|
+
const { isVisible: i, isCollapsed: n, position: l, setVisible: a, setCollapsed: u, setPosition: r } = N(), { setTheme: c } = k(), p = K(), _ = D(
|
|
27
|
+
(s) => {
|
|
28
|
+
r(s);
|
|
29
|
+
},
|
|
30
|
+
[r]
|
|
31
|
+
), { isDragging: v, elementRef: C, handlePointerDown: g } = b({
|
|
32
|
+
onPositionChange: _
|
|
33
|
+
});
|
|
34
|
+
if (w({
|
|
35
|
+
description: "Show Dev Panel",
|
|
36
|
+
preventDefault: !0,
|
|
37
|
+
action: () => a(!i),
|
|
38
|
+
...O,
|
|
39
|
+
...o.hotKeyConfig,
|
|
40
|
+
target: window
|
|
41
|
+
}), y(() => {
|
|
42
|
+
o.theme && c(o.theme);
|
|
43
|
+
}, [o.theme, c]), !i)
|
|
44
|
+
return null;
|
|
45
|
+
const m = Object.entries(p);
|
|
46
|
+
return /* @__PURE__ */ d(
|
|
47
|
+
"div",
|
|
48
|
+
{
|
|
49
|
+
ref: C,
|
|
50
|
+
...x(t.devPanelContainer, {
|
|
51
|
+
[t.dragging]: v
|
|
52
|
+
}),
|
|
53
|
+
style: {
|
|
54
|
+
left: l.x,
|
|
55
|
+
top: l.y,
|
|
56
|
+
height: n ? "auto" : void 0
|
|
57
|
+
},
|
|
58
|
+
children: [
|
|
59
|
+
/* @__PURE__ */ d("div", { className: t.header, onPointerDown: g, children: [
|
|
60
|
+
/* @__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 }) }),
|
|
61
|
+
/* @__PURE__ */ e("div", { className: t.title, children: h }),
|
|
62
|
+
/* @__PURE__ */ e("button", { className: t.button, onClick: () => a(!1), title: "Close", children: /* @__PURE__ */ e(f, { name: "Close" }) })
|
|
63
|
+
] }),
|
|
64
|
+
!n && /* @__PURE__ */ e("div", { className: t.content, children: m.length ? m.map(([s, P]) => /* @__PURE__ */ e(j, { sectionName: s, section: P }, `section-${s}`)) : /* @__PURE__ */ e(E, {}) })
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
}
|
|
2
69
|
export {
|
|
3
|
-
|
|
70
|
+
M as DevPanel
|
|
4
71
|
};
|
|
@@ -1,22 +1,52 @@
|
|
|
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 {
|
|
27
|
+
/**
|
|
28
|
+
* Title of the DevPanel, displayed at the top.
|
|
29
|
+
*/
|
|
5
30
|
panelTitle?: string;
|
|
6
31
|
/**
|
|
7
32
|
* Hotkey configuration for toggling the DevPanel visibility.
|
|
8
33
|
* If not provided, defaults to
|
|
9
34
|
* ```json
|
|
10
35
|
* {
|
|
11
|
-
* key: "f",
|
|
12
|
-
* shiftKey: true,
|
|
13
|
-
* altKey: true,
|
|
14
|
-
* ctrlKey: false,
|
|
15
|
-
* metaKey: false,
|
|
36
|
+
* "key": "f",
|
|
37
|
+
* "shiftKey": true,
|
|
38
|
+
* "altKey": true,
|
|
39
|
+
* "ctrlKey": false,
|
|
40
|
+
* "metaKey": false,
|
|
16
41
|
* }
|
|
17
42
|
* ```
|
|
18
43
|
*/
|
|
19
44
|
hotKeyConfig?: DevPanelHotkeyConfig;
|
|
45
|
+
/**
|
|
46
|
+
* Theme for the DevPanel.
|
|
47
|
+
* If not provided, defaults to "auto"
|
|
48
|
+
*/
|
|
49
|
+
theme?: BuiltInTheme;
|
|
20
50
|
}
|
|
21
51
|
|
|
22
52
|
export interface DevPanelSection {
|
|
@@ -30,6 +60,7 @@ export interface DevPanelState {
|
|
|
30
60
|
isCollapsed: boolean;
|
|
31
61
|
sections: Record<string, DevPanelSection>;
|
|
32
62
|
position: Position;
|
|
63
|
+
currentTheme: string;
|
|
33
64
|
}
|
|
34
65
|
|
|
35
66
|
export type DevPanelUIState = Omit<DevPanelState, "sections">;
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
* Dismounts the portal when no sections are active.
|
|
6
|
+
*
|
|
7
|
+
* @returns DevPanel rendered as a portal in document.body or null if no sections
|
|
8
|
+
*/
|
|
9
|
+
export declare function DevPanelPortal(): React.ReactNode;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { useState as n, useEffect as d } from "react";
|
|
3
|
+
import { createPortal as c } from "react-dom";
|
|
4
|
+
import { DevPanelManager as m } from "../../managers/DevPanelManager.js";
|
|
5
|
+
import { DevPanel as p } from "../DevPanel/index.js";
|
|
6
|
+
function v() {
|
|
7
|
+
const [t, r] = n({}), [s, o] = n(!1);
|
|
8
|
+
return d(() => {
|
|
9
|
+
const e = m.getInstance(), l = e.getAllProps(), u = e.shouldRender();
|
|
10
|
+
return r(l), o(u), e.onPropsChange((a) => {
|
|
11
|
+
r(a), o(e.shouldRender());
|
|
12
|
+
});
|
|
13
|
+
}, []), s ? c(/* @__PURE__ */ i(p, { ...t }), document.body) : null;
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
v as DevPanelPortal
|
|
17
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export declare function EmptyContent(): React.ReactNode;
|
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs as t, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import '../../assets/index3.css';const n = "_empty_1bkns_1", s = {
|
|
3
|
+
empty: n
|
|
4
|
+
};
|
|
5
|
+
function o() {
|
|
6
|
+
return /* @__PURE__ */ t("div", { className: s.empty, children: [
|
|
7
|
+
/* @__PURE__ */ e("span", { children: "No controls registered yet." }),
|
|
8
|
+
/* @__PURE__ */ e("br", {}),
|
|
9
|
+
/* @__PURE__ */ e("br", {}),
|
|
10
|
+
/* @__PURE__ */ t("span", { children: [
|
|
11
|
+
"Use ",
|
|
12
|
+
/* @__PURE__ */ e("code", { children: "useDevPanel()" }),
|
|
13
|
+
" to add controls."
|
|
14
|
+
] })
|
|
15
|
+
] });
|
|
16
|
+
}
|
|
2
17
|
export {
|
|
3
|
-
|
|
18
|
+
o as EmptyContent
|
|
4
19
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare const availableIcons: {
|
|
2
|
+
ArrowDown: (props: React.SVGProps<SVGSVGElement>) => React.ReactNode;
|
|
3
|
+
Close: (props: React.SVGProps<SVGSVGElement>) => React.ReactNode;
|
|
4
|
+
Check: (props: React.SVGProps<SVGSVGElement>) => React.ReactNode;
|
|
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 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export declare function Input(props: React.InputHTMLAttributes<HTMLInputElement>): React.ReactNode;
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import '../../assets/index7.css';const u = "_input_icuc6_217", i = {
|
|
3
|
+
input: u
|
|
4
|
+
};
|
|
5
|
+
function s(t) {
|
|
6
|
+
return /* @__PURE__ */ n("input", { ...t, className: i.input });
|
|
7
|
+
}
|
|
2
8
|
export {
|
|
3
|
-
|
|
9
|
+
s as Input
|
|
4
10
|
};
|
|
@@ -1,4 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs as n, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { ControlRenderer as i } from "../ControlRenderer/index.js";
|
|
3
|
+
import { useDevPanelSectionActions as r } from "../../store/SectionsStore.js";
|
|
4
|
+
import { Icon as p } from "../Icon/index.js";
|
|
5
|
+
import '../../assets/index4.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
|
+
section: d,
|
|
7
|
+
header: _,
|
|
8
|
+
title: m,
|
|
9
|
+
toggle: g,
|
|
10
|
+
collapsed: h,
|
|
11
|
+
content: x
|
|
12
|
+
};
|
|
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 }) })
|
|
19
|
+
] }),
|
|
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)) })
|
|
21
|
+
] });
|
|
22
|
+
}
|
|
2
23
|
export {
|
|
3
|
-
|
|
24
|
+
N as Section
|
|
4
25
|
};
|
|
@@ -1 +1,15 @@
|
|
|
1
|
-
export
|
|
1
|
+
export interface SelectProps {
|
|
2
|
+
value?: string | string[];
|
|
3
|
+
options: string[] | {
|
|
4
|
+
label: string;
|
|
5
|
+
value: string;
|
|
6
|
+
}[];
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
multiple?: boolean;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
onChange: (value: string | string[]) => void;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Unified Select component that can handle both single and multiple selection
|
|
14
|
+
*/
|
|
15
|
+
export declare function Select({ value, options, onChange, disabled, multiple, placeholder }: SelectProps): React.ReactNode;
|
|
@@ -1,4 +1,178 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs as y, Fragment as M, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as x, useState as H, useCallback as q, useEffect as P } from "react";
|
|
3
|
+
import { createPortal as T } from "react-dom";
|
|
4
|
+
import { Icon as j } from "../Icon/index.js";
|
|
5
|
+
import { useDevPanelPosition as B } from "../../store/UIStore.js";
|
|
6
|
+
import { className as F } from "../../utils/className/className.js";
|
|
7
|
+
import '../../assets/index6.css';const W = "_select_1hbiz_217", U = "_trigger_1hbiz_222", G = "_open_1hbiz_271", J = "_value_1hbiz_275", K = "_placeholder_1hbiz_284", Q = "_arrow_1hbiz_288", X = "_dropdownPortal_1hbiz_303", Y = "_dropdown_1hbiz_303", Z = "_option_1hbiz_342", ee = "_selected_1hbiz_360", te = "_checkbox_1hbiz_369", ne = "_label_1hbiz_390", r = {
|
|
8
|
+
select: W,
|
|
9
|
+
trigger: U,
|
|
10
|
+
open: G,
|
|
11
|
+
value: J,
|
|
12
|
+
placeholder: K,
|
|
13
|
+
arrow: Q,
|
|
14
|
+
dropdownPortal: X,
|
|
15
|
+
dropdown: Y,
|
|
16
|
+
option: Z,
|
|
17
|
+
selected: ee,
|
|
18
|
+
checkbox: te,
|
|
19
|
+
label: ne
|
|
20
|
+
};
|
|
21
|
+
function ae({ value: p, options: _, onChange: z, disabled: f = !1, multiple: u = !1, placeholder: L = "Select..." }) {
|
|
22
|
+
const w = B(), g = x(null), h = x(null), k = x(null), [c, m] = H(!1), [b, E] = H({
|
|
23
|
+
top: 0,
|
|
24
|
+
left: 0,
|
|
25
|
+
width: 0,
|
|
26
|
+
maxHeight: 200
|
|
27
|
+
}), d = u ? Array.isArray(p) ? p : [] : typeof p == "string" ? p : "", C = S(), D = u ? d.length === 0 : !d, s = q(() => {
|
|
28
|
+
c && E(N());
|
|
29
|
+
}, [c]);
|
|
30
|
+
function N() {
|
|
31
|
+
if (!h.current)
|
|
32
|
+
return {
|
|
33
|
+
top: 0,
|
|
34
|
+
left: 0,
|
|
35
|
+
width: 0,
|
|
36
|
+
maxHeight: 200
|
|
37
|
+
};
|
|
38
|
+
const e = h.current.getBoundingClientRect(), t = window.innerHeight, n = window.innerWidth, o = 200, l = 4, i = t - e.bottom - l, v = e.top - l, R = i < o && v > i, V = R ? e.top - Math.min(o, v) : e.bottom + l, $ = Math.max(8, Math.min(e.left, n - e.width - 8)), I = R ? Math.min(o, v) : Math.min(o, i);
|
|
39
|
+
return {
|
|
40
|
+
top: V,
|
|
41
|
+
left: $,
|
|
42
|
+
width: e.width,
|
|
43
|
+
maxHeight: I
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function O(e) {
|
|
47
|
+
if (u) {
|
|
48
|
+
const t = d, n = t.includes(e) ? t.filter((o) => o !== e) : [...t, e];
|
|
49
|
+
z(n);
|
|
50
|
+
} else
|
|
51
|
+
z(e), m(!1);
|
|
52
|
+
}
|
|
53
|
+
function S() {
|
|
54
|
+
if (u) {
|
|
55
|
+
const e = d;
|
|
56
|
+
if (e.length === 0)
|
|
57
|
+
return L;
|
|
58
|
+
if (e.length === 1) {
|
|
59
|
+
const t = _.find((o) => (typeof o == "string" ? o : o.value) === e[0]);
|
|
60
|
+
return (typeof t == "string" ? t : t?.label) || e[0];
|
|
61
|
+
}
|
|
62
|
+
return `${e.length} selected`;
|
|
63
|
+
} else {
|
|
64
|
+
const e = d;
|
|
65
|
+
if (!e)
|
|
66
|
+
return L;
|
|
67
|
+
const t = _.find((o) => (typeof o == "string" ? o : o.value) === e);
|
|
68
|
+
return (typeof t == "string" ? t : t?.label) || e;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function A() {
|
|
72
|
+
f || (c ? m(!1) : (E(N()), m(!0)));
|
|
73
|
+
}
|
|
74
|
+
return P(() => {
|
|
75
|
+
if (!c) return;
|
|
76
|
+
s(), window.addEventListener("resize", s), window.addEventListener("scroll", s, !0);
|
|
77
|
+
const e = g.current?.closest("[data-dev-panel]") || document.querySelector("[data-dev-panel]");
|
|
78
|
+
e && e.addEventListener("scroll", s, !0);
|
|
79
|
+
let t = null;
|
|
80
|
+
if (h.current && "IntersectionObserver" in window) {
|
|
81
|
+
const n = {
|
|
82
|
+
top: 0,
|
|
83
|
+
left: 0,
|
|
84
|
+
width: 0,
|
|
85
|
+
height: 0
|
|
86
|
+
};
|
|
87
|
+
t = new IntersectionObserver(
|
|
88
|
+
(o) => {
|
|
89
|
+
const l = o[0];
|
|
90
|
+
if (l && l.target === h.current) {
|
|
91
|
+
const i = l.boundingClientRect;
|
|
92
|
+
(i.top !== n.top || i.left !== n.left || i.width !== n.width || i.height !== n.height) && (n.top = i.top, n.left = i.left, n.width = i.width, n.height = i.height, s());
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
threshold: [0, 0.1, 0.5, 1]
|
|
97
|
+
}
|
|
98
|
+
), t.observe(h.current);
|
|
99
|
+
}
|
|
100
|
+
return () => {
|
|
101
|
+
window.removeEventListener("resize", s), window.removeEventListener("scroll", s, !0), e && e.removeEventListener("scroll", s, !0), t && t.disconnect();
|
|
102
|
+
};
|
|
103
|
+
}, [c, s]), P(() => {
|
|
104
|
+
const e = k.current;
|
|
105
|
+
(!e || e.x !== w.x || e.y !== w.y) && (k.current = w, c && requestAnimationFrame(s));
|
|
106
|
+
}, [c, w, s]), P(() => {
|
|
107
|
+
function e(t) {
|
|
108
|
+
if (g.current && !g.current.contains(t.target)) {
|
|
109
|
+
const n = document.querySelector(`.${r.dropdownPortal}`);
|
|
110
|
+
if (n && n.contains(t.target))
|
|
111
|
+
return;
|
|
112
|
+
m(!1);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return document.addEventListener("mousedown", e), () => {
|
|
116
|
+
document.removeEventListener("mousedown", e);
|
|
117
|
+
};
|
|
118
|
+
}, []), /* @__PURE__ */ y(M, { children: [
|
|
119
|
+
/* @__PURE__ */ a(
|
|
120
|
+
"div",
|
|
121
|
+
{
|
|
122
|
+
ref: g,
|
|
123
|
+
...F(r.select, {
|
|
124
|
+
[r.disabled]: f,
|
|
125
|
+
[r.open]: c
|
|
126
|
+
}),
|
|
127
|
+
children: /* @__PURE__ */ y("button", { ref: h, type: "button", className: r.trigger, onClick: A, disabled: f, children: [
|
|
128
|
+
/* @__PURE__ */ a("span", { className: `${r.value} ${D ? r.placeholder : ""}`, children: C }),
|
|
129
|
+
/* @__PURE__ */ a(j, { name: "ArrowDown", className: r.arrow })
|
|
130
|
+
] })
|
|
131
|
+
}
|
|
132
|
+
),
|
|
133
|
+
typeof window < "u" && T(
|
|
134
|
+
c && !f && /* @__PURE__ */ a(
|
|
135
|
+
"div",
|
|
136
|
+
{
|
|
137
|
+
className: r.dropdownPortal,
|
|
138
|
+
style: {
|
|
139
|
+
position: "fixed",
|
|
140
|
+
top: b.top,
|
|
141
|
+
left: b.left,
|
|
142
|
+
width: b.width,
|
|
143
|
+
maxHeight: b.maxHeight,
|
|
144
|
+
zIndex: 9999
|
|
145
|
+
},
|
|
146
|
+
children: /* @__PURE__ */ a("div", { className: r.dropdown, children: _.map((e) => {
|
|
147
|
+
const t = typeof e == "string" ? e : e.value, n = typeof e == "string" ? e : e.label, o = u ? d.includes(t) : d === t;
|
|
148
|
+
return u ? /* @__PURE__ */ y("label", { className: r.option, children: [
|
|
149
|
+
/* @__PURE__ */ a(
|
|
150
|
+
"input",
|
|
151
|
+
{
|
|
152
|
+
type: "checkbox",
|
|
153
|
+
checked: o,
|
|
154
|
+
onChange: () => O(t),
|
|
155
|
+
className: r.checkbox
|
|
156
|
+
}
|
|
157
|
+
),
|
|
158
|
+
/* @__PURE__ */ a("span", { className: r.label, children: n })
|
|
159
|
+
] }, t) : /* @__PURE__ */ a(
|
|
160
|
+
"button",
|
|
161
|
+
{
|
|
162
|
+
type: "button",
|
|
163
|
+
className: `${r.option} ${o ? r.selected : ""}`,
|
|
164
|
+
onClick: () => O(t),
|
|
165
|
+
children: n
|
|
166
|
+
},
|
|
167
|
+
t
|
|
168
|
+
);
|
|
169
|
+
}) })
|
|
170
|
+
}
|
|
171
|
+
),
|
|
172
|
+
document.body
|
|
173
|
+
)
|
|
174
|
+
] });
|
|
175
|
+
}
|
|
2
176
|
export {
|
|
3
|
-
|
|
177
|
+
ae as Select
|
|
4
178
|
};
|
|
@@ -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';
|