@berenjena/react-dev-panel 1.0.0 → 1.0.3
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/LICENSE +21 -0
- package/README.md +444 -1
- package/dist/assets/ButtonControl.css +1 -1
- package/dist/assets/ControlRenderer.css +1 -0
- package/dist/assets/DevPanel.css +1 -1
- package/dist/assets/EmptyContent.css +1 -1
- package/dist/assets/Input.css +1 -1
- package/dist/assets/RangeControl.css +1 -0
- package/dist/assets/Section.css +1 -1
- package/dist/assets/SeparatorControl.css +1 -0
- package/dist/assets/index.css +1 -1
- package/dist/assets/index2.css +1 -0
- package/dist/components/ControlRenderer/ControlRenderer.js +30 -6
- package/dist/components/ControlRenderer/controls/BooleanControl/BooleanControl.js +9 -10
- package/dist/components/ControlRenderer/controls/ButtonControl/ButtonControl.js +3 -3
- package/dist/components/ControlRenderer/controls/DateControl/DateControl.d.ts +29 -0
- package/dist/components/ControlRenderer/controls/DateControl/DateControl.js +31 -0
- package/dist/components/ControlRenderer/controls/DateControl/index.d.ts +1 -0
- package/dist/components/ControlRenderer/controls/DateControl/index.js +4 -0
- package/dist/components/ControlRenderer/controls/DateControl/types.d.ts +12 -0
- package/dist/components/ControlRenderer/controls/NumberControl/NumberControl.js +8 -8
- package/dist/components/ControlRenderer/controls/RangeControl/RangeControl.d.ts +30 -0
- package/dist/components/ControlRenderer/controls/RangeControl/RangeControl.js +40 -0
- package/dist/components/ControlRenderer/controls/RangeControl/index.d.ts +1 -0
- package/dist/components/ControlRenderer/controls/RangeControl/index.js +4 -0
- package/dist/components/ControlRenderer/controls/RangeControl/types.d.ts +13 -0
- package/dist/components/ControlRenderer/controls/SelectControl/SelectControl.js +6 -9
- package/dist/components/ControlRenderer/controls/SeparatorControl/SeparatorControl.d.ts +30 -0
- package/dist/components/ControlRenderer/controls/SeparatorControl/SeparatorControl.js +14 -0
- package/dist/components/ControlRenderer/controls/SeparatorControl/index.d.ts +1 -0
- package/dist/components/ControlRenderer/controls/SeparatorControl/index.js +4 -0
- package/dist/components/ControlRenderer/controls/SeparatorControl/types.d.ts +10 -0
- package/dist/components/ControlRenderer/controls/TextControl/TextControl.js +7 -7
- package/dist/components/ControlRenderer/controls/index.d.ts +3 -1
- package/dist/components/ControlRenderer/controls/index.js +13 -38
- package/dist/components/ControlRenderer/controls/types.d.ts +6 -0
- package/dist/components/ControlRenderer/index.js +1 -1
- package/dist/components/DevPanel/DevPanel.js +43 -41
- package/dist/components/DevPanel/types.d.ts +7 -4
- package/dist/components/EmptyContent/EmptyContent.js +2 -2
- package/dist/components/Input/Input.js +3 -3
- package/dist/components/Logger/index.d.ts +20 -0
- package/dist/components/Logger/index.js +85 -0
- package/dist/components/Section/Section.js +17 -16
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +6 -5
- package/dist/hooks/useDevPanel/useDevPanel.js +10 -10
- package/dist/hooks/useDragAndDrop/useDragAndDrop.d.ts +1 -1
- package/dist/hooks/useHotkeys/types.d.ts +14 -0
- package/dist/hooks/useHotkeys/useHotkey.d.ts +1 -2
- package/dist/hooks/useHotkeys/useHotkeys.d.ts +1 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.js +9 -8
- package/dist/store/store.d.ts +106 -0
- package/dist/store/store.js +239 -0
- package/dist/utils/createHotkey/createHotkey.d.ts +1 -1
- package/dist/utils/formatHotkey/formatHotkey.d.ts +1 -1
- package/dist/utils/getConstrainedPosition/getConstrainedPosition.d.ts +1 -1
- package/dist/utils/getCurrentElementPosition/getCurrentElementPosition.d.ts +1 -1
- package/dist/utils/getPositionAdjustment/getPositionAdjustment.d.ts +2 -2
- package/dist/utils/hasControlChanged/hasControlChanged.js +5 -5
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.js +16 -23
- package/package.json +27 -21
- package/dist/assets/SelectControl.css +0 -1
- package/dist/components/logger.d.ts +0 -5
- package/dist/components/logger.js +0 -7
- package/dist/types.d.ts +0 -18
- package/dist/utils/store/store.d.ts +0 -40
- package/dist/utils/store/store.js +0 -103
- package/dist/vite-env.d.ts +0 -1
- /package/dist/{utils/store → store}/index.d.ts +0 -0
- /package/dist/{utils/store → store}/index.js +0 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { useState as o, useEffect as r } from "react";
|
|
3
|
+
import { Input as f } from "../../../Input/Input.js";
|
|
4
|
+
function h({ control: e }) {
|
|
5
|
+
const n = e.event || "onBlur", [l, t] = o(e.value);
|
|
6
|
+
r(() => {
|
|
7
|
+
t(e.value);
|
|
8
|
+
}, [e.value]);
|
|
9
|
+
const s = (u) => {
|
|
10
|
+
const a = u.target.value;
|
|
11
|
+
t(a), n === "onChange" && e.onChange(a);
|
|
12
|
+
}, i = (u) => {
|
|
13
|
+
const a = u.target.value;
|
|
14
|
+
n === "onBlur" && e.onChange(a);
|
|
15
|
+
};
|
|
16
|
+
return /* @__PURE__ */ m(
|
|
17
|
+
f,
|
|
18
|
+
{
|
|
19
|
+
type: "date",
|
|
20
|
+
value: l,
|
|
21
|
+
min: e.min,
|
|
22
|
+
max: e.max,
|
|
23
|
+
disabled: e.disabled,
|
|
24
|
+
onChange: s,
|
|
25
|
+
...n === "onBlur" && { onBlur: i }
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
h as DateControl
|
|
31
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './DateControl';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BaseInputControl } from '../types';
|
|
2
|
+
export interface DateControl extends BaseInputControl {
|
|
3
|
+
type: "date";
|
|
4
|
+
value: string; // ISO date string (YYYY-MM-DD)
|
|
5
|
+
min?: string; // ISO date string
|
|
6
|
+
max?: string; // ISO date string
|
|
7
|
+
onChange: (value: string) => void;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface DateControlProps {
|
|
11
|
+
control: DateControl;
|
|
12
|
+
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import { useState as i, useEffect as p } from "react";
|
|
3
3
|
import { Input as f } from "../../../Input/Input.js";
|
|
4
|
-
function
|
|
5
|
-
const n = e.event || "
|
|
4
|
+
function v({ control: e }) {
|
|
5
|
+
const n = e.event || "onChange", [m, t] = i(e.value);
|
|
6
6
|
p(() => {
|
|
7
7
|
t(e.value);
|
|
8
8
|
}, [e.value]);
|
|
9
|
-
const
|
|
9
|
+
const s = (u) => {
|
|
10
10
|
const a = Number(u.target.value);
|
|
11
11
|
t(a), n === "onChange" && e.onChange(a);
|
|
12
|
-
},
|
|
12
|
+
}, l = (u) => {
|
|
13
13
|
const a = Number(u.target.value);
|
|
14
14
|
n === "onBlur" && e.onChange(a);
|
|
15
15
|
};
|
|
@@ -17,16 +17,16 @@ function h({ control: e }) {
|
|
|
17
17
|
f,
|
|
18
18
|
{
|
|
19
19
|
type: "number",
|
|
20
|
-
value:
|
|
20
|
+
value: m,
|
|
21
21
|
min: e.min,
|
|
22
22
|
max: e.max,
|
|
23
23
|
step: e.step,
|
|
24
24
|
disabled: e.disabled,
|
|
25
|
-
onChange:
|
|
26
|
-
...n === "onBlur" && { onBlur:
|
|
25
|
+
onChange: s,
|
|
26
|
+
...n === "onBlur" && { onBlur: l }
|
|
27
27
|
}
|
|
28
28
|
);
|
|
29
29
|
}
|
|
30
30
|
export {
|
|
31
|
-
|
|
31
|
+
v as NumberControl
|
|
32
32
|
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { RangeControlProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Component that renders a range/slider control with configurable event handling
|
|
4
|
+
* @param control - The control to render
|
|
5
|
+
* @param control.event - When to trigger onChange: "onChange" (real-time) or "onBlur" (on focus loss). Defaults to "onChange"
|
|
6
|
+
* @returns The range control component
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* // Real-time updates (default)
|
|
11
|
+
* <RangeControl control={{
|
|
12
|
+
* type: 'range',
|
|
13
|
+
* value: 50,
|
|
14
|
+
* min: 0,
|
|
15
|
+
* max: 100,
|
|
16
|
+
* step: 1,
|
|
17
|
+
* event: 'onChange',
|
|
18
|
+
* onChange: (value) => setValue(value)
|
|
19
|
+
* }} />
|
|
20
|
+
*
|
|
21
|
+
* // Updates only when losing focus
|
|
22
|
+
* <RangeControl control={{
|
|
23
|
+
* type: 'range',
|
|
24
|
+
* value: 50,
|
|
25
|
+
* event: 'onBlur',
|
|
26
|
+
* onChange: (value) => setValue(value)
|
|
27
|
+
* }} />
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare function RangeControl({ control }: RangeControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsxs as g, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useState as o, useEffect as m } from "react";
|
|
3
|
+
import '../../../../assets/RangeControl.css';const v = "_container_1ewrb_1", h = "_range_1ewrb_9", d = "_value_1ewrb_116", t = {
|
|
4
|
+
container: v,
|
|
5
|
+
range: h,
|
|
6
|
+
value: d
|
|
7
|
+
};
|
|
8
|
+
function b({ control: e }) {
|
|
9
|
+
const n = e.event || "onChange", [u, l] = o(e.value);
|
|
10
|
+
m(() => {
|
|
11
|
+
l(e.value);
|
|
12
|
+
}, [e.value]);
|
|
13
|
+
const i = (s) => {
|
|
14
|
+
const a = Number(s.target.value);
|
|
15
|
+
l(a), n === "onChange" && e.onChange(a);
|
|
16
|
+
}, c = (s) => {
|
|
17
|
+
const a = Number(s.target.value);
|
|
18
|
+
n === "onBlur" && e.onChange(a);
|
|
19
|
+
};
|
|
20
|
+
return /* @__PURE__ */ g("div", { className: t.container, children: [
|
|
21
|
+
/* @__PURE__ */ r(
|
|
22
|
+
"input",
|
|
23
|
+
{
|
|
24
|
+
type: "range",
|
|
25
|
+
value: u,
|
|
26
|
+
min: e.min,
|
|
27
|
+
max: e.max,
|
|
28
|
+
step: e.step,
|
|
29
|
+
disabled: e.disabled,
|
|
30
|
+
onChange: i,
|
|
31
|
+
...n === "onBlur" && { onBlur: c },
|
|
32
|
+
className: t.range
|
|
33
|
+
}
|
|
34
|
+
),
|
|
35
|
+
/* @__PURE__ */ r("span", { className: t.value, children: u })
|
|
36
|
+
] });
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
b as RangeControl
|
|
40
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './RangeControl';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseInputControl } from '../types';
|
|
2
|
+
export interface RangeControl extends BaseInputControl {
|
|
3
|
+
type: "range";
|
|
4
|
+
value: number;
|
|
5
|
+
min?: number;
|
|
6
|
+
max?: number;
|
|
7
|
+
step?: number;
|
|
8
|
+
onChange: (value: number) => void;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface RangeControlProps {
|
|
12
|
+
control: RangeControl;
|
|
13
|
+
}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import { Select as n } from "../../../Select/Select.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return /* @__PURE__ */ s(n, { value: t.value, disabled: t.disabled, onChange: (e) => t.onChange(e.target.value), className: c.select, children: t.options.map((e) => {
|
|
8
|
-
const l = typeof e == "string" ? e : e.value, a = typeof e == "string" ? e : e.label;
|
|
9
|
-
return /* @__PURE__ */ s("option", { value: l, children: a }, l);
|
|
3
|
+
function s({ control: a }) {
|
|
4
|
+
return /* @__PURE__ */ t(n, { value: a.value, disabled: a.disabled, onChange: (e) => a.onChange(e.target.value), children: a.options.map((e) => {
|
|
5
|
+
const l = typeof e == "string" ? e : e.value, r = typeof e == "string" ? e : e.label;
|
|
6
|
+
return /* @__PURE__ */ t("option", { value: l, children: r }, l);
|
|
10
7
|
}) });
|
|
11
8
|
}
|
|
12
9
|
export {
|
|
13
|
-
|
|
10
|
+
s as SelectControl
|
|
14
11
|
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { SeparatorControlProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Component that renders a visual separator to organize control groups
|
|
4
|
+
* @param control - The control to render
|
|
5
|
+
* @param control.style - The style of separator: "line" (default), "space", or "label"
|
|
6
|
+
* @param control.label - Optional label text (only shown when style is "label")
|
|
7
|
+
* @returns The separator control component
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* // Simple line separator
|
|
12
|
+
* <SeparatorControl control={{
|
|
13
|
+
* type: 'separator'
|
|
14
|
+
* }} />
|
|
15
|
+
*
|
|
16
|
+
* // Separator with label
|
|
17
|
+
* <SeparatorControl control={{
|
|
18
|
+
* type: 'separator',
|
|
19
|
+
* style: 'label',
|
|
20
|
+
* label: 'Advanced Settings'
|
|
21
|
+
* }} />
|
|
22
|
+
*
|
|
23
|
+
* // Space separator
|
|
24
|
+
* <SeparatorControl control={{
|
|
25
|
+
* type: 'separator',
|
|
26
|
+
* style: 'space'
|
|
27
|
+
* }} />
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare function SeparatorControl({ control }: SeparatorControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import '../../../../assets/SeparatorControl.css';const s = "_line_12cvo_1", c = "_space_12cvo_9", t = "_labelContainer_12cvo_14", i = "_label_12cvo_14", l = {
|
|
3
|
+
line: s,
|
|
4
|
+
space: c,
|
|
5
|
+
labelContainer: t,
|
|
6
|
+
label: i
|
|
7
|
+
};
|
|
8
|
+
function r({ control: a }) {
|
|
9
|
+
const n = a.style || "line";
|
|
10
|
+
return n === "space" ? /* @__PURE__ */ e("div", { className: l.space }) : n === "label" && a.label ? /* @__PURE__ */ e("div", { className: l.labelContainer, children: /* @__PURE__ */ e("span", { className: l.label, children: a.label }) }) : /* @__PURE__ */ e("div", { className: l.line });
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
r as SeparatorControl
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './SeparatorControl';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BaseControl } from '../types';
|
|
2
|
+
export interface SeparatorControl extends BaseControl {
|
|
3
|
+
type: "separator";
|
|
4
|
+
style?: "line" | "space" | "label";
|
|
5
|
+
// Note: SeparatorControl doesn't need onChange or value as it's purely visual
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface SeparatorControlProps {
|
|
9
|
+
control: SeparatorControl;
|
|
10
|
+
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import { useState as h, useEffect as p } from "react";
|
|
3
3
|
import { Input as d } from "../../../Input/Input.js";
|
|
4
|
-
function
|
|
5
|
-
const n = e.event || "
|
|
4
|
+
function v({ control: e }) {
|
|
5
|
+
const n = e.event || "onChange", [u, l] = h(e.value);
|
|
6
6
|
p(() => {
|
|
7
7
|
l(e.value);
|
|
8
8
|
}, [e.value]);
|
|
9
9
|
const o = (t) => {
|
|
10
10
|
const a = t.target.value;
|
|
11
11
|
l(a), n === "onChange" && e.onChange(a);
|
|
12
|
-
},
|
|
12
|
+
}, s = (t) => {
|
|
13
13
|
const a = t.target.value;
|
|
14
14
|
n === "onBlur" && e.onChange(a);
|
|
15
15
|
};
|
|
16
|
-
return /* @__PURE__ */
|
|
16
|
+
return /* @__PURE__ */ r(
|
|
17
17
|
d,
|
|
18
18
|
{
|
|
19
19
|
type: "text",
|
|
@@ -21,10 +21,10 @@ function g({ control: e }) {
|
|
|
21
21
|
placeholder: e.placeholder,
|
|
22
22
|
disabled: e.disabled,
|
|
23
23
|
onChange: o,
|
|
24
|
-
...n === "onBlur" && { onBlur:
|
|
24
|
+
...n === "onBlur" && { onBlur: s }
|
|
25
25
|
}
|
|
26
26
|
);
|
|
27
27
|
}
|
|
28
28
|
export {
|
|
29
|
-
|
|
29
|
+
v as TextControl
|
|
30
30
|
};
|
|
@@ -6,9 +6,11 @@ export declare const controls: Readonly<{
|
|
|
6
6
|
boolean: import('react').LazyExoticComponent<typeof import('./BooleanControl').BooleanControl>;
|
|
7
7
|
button: import('react').LazyExoticComponent<typeof import('./ButtonControl').ButtonControl>;
|
|
8
8
|
color: import('react').LazyExoticComponent<typeof import('./ColorControl').ColorControl>;
|
|
9
|
+
date: import('react').LazyExoticComponent<typeof import('./DateControl').DateControl>;
|
|
9
10
|
number: import('react').LazyExoticComponent<typeof import('./NumberControl').NumberControl>;
|
|
11
|
+
range: import('react').LazyExoticComponent<typeof import('./RangeControl').RangeControl>;
|
|
10
12
|
select: import('react').LazyExoticComponent<typeof import('./SelectControl').SelectControl>;
|
|
13
|
+
separator: import('react').LazyExoticComponent<typeof import('./SeparatorControl').SeparatorControl>;
|
|
11
14
|
text: import('react').LazyExoticComponent<typeof import('./TextControl').TextControl>;
|
|
12
15
|
buttonGroup: import('react').LazyExoticComponent<typeof import('./ButtonGroupControl').ButtonGroupControl>;
|
|
13
16
|
}>;
|
|
14
|
-
export { ControlRenderer } from '..';
|
|
@@ -1,41 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
function x({ name: t, control: o }) {
|
|
14
|
-
const d = o?.label || t;
|
|
15
|
-
function a() {
|
|
16
|
-
if (!o || !o.type)
|
|
17
|
-
return /* @__PURE__ */ n("div", { className: r.error, children: "Control type is not defined" });
|
|
18
|
-
const l = y[o.type];
|
|
19
|
-
return l ? /* @__PURE__ */ n(c, { fallback: /* @__PURE__ */ n("div", { className: r.loading, children: "Loading control..." }), children: /* @__PURE__ */ n(l, { control: o }) }) : /* @__PURE__ */ n("div", { children: "Unknown control type" });
|
|
20
|
-
}
|
|
21
|
-
return /* @__PURE__ */ i(s, { children: [
|
|
22
|
-
/* @__PURE__ */ i("div", { ...p(r.controlContainer, { [r.fullWidth]: b.includes(o.type) }), children: [
|
|
23
|
-
o?.type !== "button" && /* @__PURE__ */ n("label", { className: r.label, children: d }),
|
|
24
|
-
/* @__PURE__ */ n("div", { className: r.controlWrapper, children: a() })
|
|
25
|
-
] }),
|
|
26
|
-
o?.description && /* @__PURE__ */ n("span", { className: r.description, children: o.description })
|
|
27
|
-
] });
|
|
28
|
-
}
|
|
29
|
-
const y = Object.freeze({
|
|
30
|
-
boolean: e(() => import("./BooleanControl/index.js").then((t) => ({ default: t.BooleanControl }))),
|
|
31
|
-
button: e(() => import("./ButtonControl/index.js").then((t) => ({ default: t.ButtonControl }))),
|
|
32
|
-
color: e(() => import("./ColorControl/index.js").then((t) => ({ default: t.ColorControl }))),
|
|
33
|
-
number: e(() => import("./NumberControl/index.js").then((t) => ({ default: t.NumberControl }))),
|
|
34
|
-
select: e(() => import("./SelectControl/index.js").then((t) => ({ default: t.SelectControl }))),
|
|
35
|
-
text: e(() => import("./TextControl/index.js").then((t) => ({ default: t.TextControl }))),
|
|
36
|
-
buttonGroup: e(() => import("./ButtonGroupControl/index.js").then((t) => ({ default: t.ButtonGroupControl })))
|
|
1
|
+
import { lazy as o } from "react";
|
|
2
|
+
const r = Object.freeze({
|
|
3
|
+
boolean: o(() => import("./BooleanControl/index.js").then((t) => ({ default: t.BooleanControl }))),
|
|
4
|
+
button: o(() => import("./ButtonControl/index.js").then((t) => ({ default: t.ButtonControl }))),
|
|
5
|
+
color: o(() => import("./ColorControl/index.js").then((t) => ({ default: t.ColorControl }))),
|
|
6
|
+
date: o(() => import("./DateControl/index.js").then((t) => ({ default: t.DateControl }))),
|
|
7
|
+
number: o(() => import("./NumberControl/index.js").then((t) => ({ default: t.NumberControl }))),
|
|
8
|
+
range: o(() => import("./RangeControl/index.js").then((t) => ({ default: t.RangeControl }))),
|
|
9
|
+
select: o(() => import("./SelectControl/index.js").then((t) => ({ default: t.SelectControl }))),
|
|
10
|
+
separator: o(() => import("./SeparatorControl/index.js").then((t) => ({ default: t.SeparatorControl }))),
|
|
11
|
+
text: o(() => import("./TextControl/index.js").then((t) => ({ default: t.TextControl }))),
|
|
12
|
+
buttonGroup: o(() => import("./ButtonGroupControl/index.js").then((t) => ({ default: t.ButtonGroupControl })))
|
|
37
13
|
});
|
|
38
14
|
export {
|
|
39
|
-
|
|
40
|
-
y as controls
|
|
15
|
+
r as controls
|
|
41
16
|
};
|
|
@@ -2,8 +2,11 @@ import { BooleanControl } from './BooleanControl/types';
|
|
|
2
2
|
import { ButtonControl } from './ButtonControl/types';
|
|
3
3
|
import { ButtonGroupControl } from './ButtonGroupControl/types';
|
|
4
4
|
import { ColorControl } from './ColorControl/types';
|
|
5
|
+
import { DateControl } from './DateControl/types';
|
|
5
6
|
import { NumberControl } from './NumberControl/types';
|
|
7
|
+
import { RangeControl } from './RangeControl/types';
|
|
6
8
|
import { SelectControl } from './SelectControl/types';
|
|
9
|
+
import { SeparatorControl } from './SeparatorControl/types';
|
|
7
10
|
import { TextControl } from './TextControl/types';
|
|
8
11
|
export interface BaseControl {
|
|
9
12
|
label?: string;
|
|
@@ -23,6 +26,9 @@ export type Controls = {
|
|
|
23
26
|
text: TextControl;
|
|
24
27
|
button: ButtonControl;
|
|
25
28
|
number: NumberControl;
|
|
29
|
+
range: RangeControl;
|
|
30
|
+
date: DateControl;
|
|
31
|
+
separator: SeparatorControl;
|
|
26
32
|
buttonGroup: ButtonGroupControl;
|
|
27
33
|
};
|
|
28
34
|
|
|
@@ -1,65 +1,67 @@
|
|
|
1
|
-
import { jsxs as r, jsx as
|
|
2
|
-
import { useCallback as
|
|
1
|
+
import { jsxs as r, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback as g } from "react";
|
|
3
3
|
import { useDragAndDrop as _ } from "../../hooks/useDragAndDrop/useDragAndDrop.js";
|
|
4
|
-
import { useHotkey as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { EmptyContent as
|
|
8
|
-
import { Section as
|
|
9
|
-
import '../../assets/DevPanel.css';const
|
|
10
|
-
devPanelContainer:
|
|
11
|
-
header:
|
|
12
|
-
title:
|
|
13
|
-
button:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
4
|
+
import { useHotkey as C } from "../../hooks/useHotkeys/useHotkey.js";
|
|
5
|
+
import { useDevPanelStore as w } from "../../store/store.js";
|
|
6
|
+
import { className as b } from "../../utils/className/className.js";
|
|
7
|
+
import { EmptyContent as y } from "../EmptyContent/EmptyContent.js";
|
|
8
|
+
import { Section as D } from "../Section/Section.js";
|
|
9
|
+
import '../../assets/DevPanel.css';const P = "_devPanelContainer_1vath_1", x = "_header_1vath_12", K = "_title_1vath_21", N = "_button_1vath_31", k = "_collapsed_1vath_53", A = "_content_1vath_60", t = {
|
|
10
|
+
devPanelContainer: P,
|
|
11
|
+
header: x,
|
|
12
|
+
title: K,
|
|
13
|
+
button: N,
|
|
14
|
+
collapsed: k,
|
|
15
|
+
content: A
|
|
16
|
+
}, j = {
|
|
17
|
+
ctrlKey: !0,
|
|
17
18
|
shiftKey: !0,
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
key: "a",
|
|
20
|
+
altKey: !1,
|
|
20
21
|
metaKey: !1
|
|
21
22
|
};
|
|
22
|
-
function
|
|
23
|
-
const
|
|
23
|
+
function O({ panelTitle: c = "Dev panel", ...d }) {
|
|
24
|
+
const { isVisible: l, isCollapsed: o, position: a, sections: h, ...n } = w(), m = g(
|
|
24
25
|
(s) => {
|
|
25
|
-
|
|
26
|
+
n.setPosition(s);
|
|
26
27
|
},
|
|
27
|
-
[
|
|
28
|
-
), { isDragging: p, elementRef:
|
|
29
|
-
onPositionChange:
|
|
28
|
+
[n]
|
|
29
|
+
), { isDragging: p, elementRef: v, handleMouseDown: u } = _({
|
|
30
|
+
onPositionChange: m
|
|
30
31
|
});
|
|
31
|
-
if (
|
|
32
|
+
if (C({
|
|
32
33
|
description: "Show Dev Panel",
|
|
33
34
|
preventDefault: !0,
|
|
34
|
-
action: () =>
|
|
35
|
-
...
|
|
36
|
-
...
|
|
37
|
-
|
|
35
|
+
action: () => n.setVisible(!l),
|
|
36
|
+
...j,
|
|
37
|
+
...d.hotKeyConfig,
|
|
38
|
+
target: window
|
|
39
|
+
}), !l)
|
|
38
40
|
return null;
|
|
39
|
-
const
|
|
41
|
+
const i = Object.entries(h);
|
|
40
42
|
return /* @__PURE__ */ r(
|
|
41
43
|
"div",
|
|
42
44
|
{
|
|
43
|
-
ref:
|
|
44
|
-
...
|
|
45
|
-
[
|
|
45
|
+
ref: v,
|
|
46
|
+
...b(t.devPanelContainer, {
|
|
47
|
+
[t.dragging]: p
|
|
46
48
|
}),
|
|
47
49
|
style: {
|
|
48
|
-
left:
|
|
49
|
-
top:
|
|
50
|
-
height:
|
|
50
|
+
left: a.x,
|
|
51
|
+
top: a.y,
|
|
52
|
+
height: o ? "auto" : void 0
|
|
51
53
|
},
|
|
52
54
|
children: [
|
|
53
|
-
/* @__PURE__ */ r("div", { className:
|
|
54
|
-
/* @__PURE__ */
|
|
55
|
-
/* @__PURE__ */
|
|
56
|
-
/* @__PURE__ */
|
|
55
|
+
/* @__PURE__ */ r("div", { className: t.header, onMouseDown: u, children: [
|
|
56
|
+
/* @__PURE__ */ e("button", { className: t.button, onClick: () => n.setCollapsed(!o), title: o ? "Expand" : "Collapse", children: /* @__PURE__ */ e("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", className: o ? t.collapsed : void 0, children: /* @__PURE__ */ e("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" }) }) }),
|
|
57
|
+
/* @__PURE__ */ e("div", { className: t.title, children: c }),
|
|
58
|
+
/* @__PURE__ */ e("button", { className: t.button, onClick: () => n.setVisible(!1), title: "Close", children: /* @__PURE__ */ e("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ e("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" }) }) })
|
|
57
59
|
] }),
|
|
58
|
-
!
|
|
60
|
+
!o && /* @__PURE__ */ e("div", { className: t.content, children: i.length ? i.map(([s, f]) => /* @__PURE__ */ e(D, { sectionName: s, section: f }, `section-${s}`)) : /* @__PURE__ */ e(y, {}) })
|
|
59
61
|
]
|
|
60
62
|
}
|
|
61
63
|
);
|
|
62
64
|
}
|
|
63
65
|
export {
|
|
64
|
-
|
|
66
|
+
O as DevPanel
|
|
65
67
|
};
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { ControlsGroup } from '../ControlRenderer/controls/types';
|
|
2
|
-
|
|
3
|
-
export type DevPanelHoyKeyConfig = Pick<HotkeyConfig, "key" | "shiftKey" | "altKey" | "ctrlKey" | "metaKey">;
|
|
2
|
+
export type DevPanelHotkeyConfig = Pick<HotkeyConfig, "key" | "shiftKey" | "altKey" | "ctrlKey" | "metaKey">;
|
|
4
3
|
|
|
5
4
|
export interface DevPanelProps {
|
|
6
|
-
theme?: "light" | "dark";
|
|
7
5
|
panelTitle?: string;
|
|
8
6
|
/**
|
|
9
7
|
* Hotkey configuration for toggling the DevPanel visibility.
|
|
@@ -18,7 +16,7 @@ export interface DevPanelProps {
|
|
|
18
16
|
* }
|
|
19
17
|
* ```
|
|
20
18
|
*/
|
|
21
|
-
hotKeyConfig?:
|
|
19
|
+
hotKeyConfig?: DevPanelHotkeyConfig;
|
|
22
20
|
}
|
|
23
21
|
|
|
24
22
|
export interface DevPanelSection {
|
|
@@ -45,3 +43,8 @@ export interface DevPanelActions {
|
|
|
45
43
|
}
|
|
46
44
|
|
|
47
45
|
export type DevPanelStore = DevPanelState & DevPanelActions;
|
|
46
|
+
|
|
47
|
+
export interface Position {
|
|
48
|
+
x: number;
|
|
49
|
+
y: number;
|
|
50
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsxs as t, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import '../../assets/EmptyContent.css';const o = "
|
|
2
|
+
import '../../assets/EmptyContent.css';const o = "_empty_1xo8g_1", s = {
|
|
3
3
|
empty: o
|
|
4
4
|
};
|
|
5
5
|
function n() {
|
|
6
|
-
return /* @__PURE__ */ t("div", { className:
|
|
6
|
+
return /* @__PURE__ */ t("div", { className: s.empty, children: [
|
|
7
7
|
"No controls registered yet.",
|
|
8
8
|
/* @__PURE__ */ e("br", {}),
|
|
9
9
|
" ",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import '../../assets/Input.css';const
|
|
3
|
-
input:
|
|
2
|
+
import '../../assets/Input.css';const p = "_input_161wd_1", u = {
|
|
3
|
+
input: p
|
|
4
4
|
};
|
|
5
5
|
function s(t) {
|
|
6
|
-
return /* @__PURE__ */ n("input", { ...t, className:
|
|
6
|
+
return /* @__PURE__ */ n("input", { ...t, className: u.input });
|
|
7
7
|
}
|
|
8
8
|
export {
|
|
9
9
|
s as Input
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
type LoggerProps = {
|
|
2
|
+
/** The data object to display in JSON format */
|
|
3
|
+
items: object;
|
|
4
|
+
/** Optional title for the logger panel */
|
|
5
|
+
title?: string;
|
|
6
|
+
/** Theme preference - 'auto' detects system preference */
|
|
7
|
+
theme?: "light" | "dark" | "auto";
|
|
8
|
+
/** Whether the logger should start collapsed */
|
|
9
|
+
defaultCollapsed?: boolean;
|
|
10
|
+
/** Whether the logger should be visible by default */
|
|
11
|
+
defaultVisible?: boolean;
|
|
12
|
+
/** Callback function called when the logger is closed */
|
|
13
|
+
onClose?: () => void;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* A floating, collapsible logger component that displays object data in JSON format.
|
|
17
|
+
* @returns JSX element or null if not visible
|
|
18
|
+
*/
|
|
19
|
+
export declare function Logger({ items, title, theme, defaultCollapsed, defaultVisible, onClose }: LoggerProps): import("react/jsx-runtime").JSX.Element | null;
|
|
20
|
+
export {};
|