@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.
Files changed (73) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +444 -1
  3. package/dist/assets/ButtonControl.css +1 -1
  4. package/dist/assets/ControlRenderer.css +1 -0
  5. package/dist/assets/DevPanel.css +1 -1
  6. package/dist/assets/EmptyContent.css +1 -1
  7. package/dist/assets/Input.css +1 -1
  8. package/dist/assets/RangeControl.css +1 -0
  9. package/dist/assets/Section.css +1 -1
  10. package/dist/assets/SeparatorControl.css +1 -0
  11. package/dist/assets/index.css +1 -1
  12. package/dist/assets/index2.css +1 -0
  13. package/dist/components/ControlRenderer/ControlRenderer.js +30 -6
  14. package/dist/components/ControlRenderer/controls/BooleanControl/BooleanControl.js +9 -10
  15. package/dist/components/ControlRenderer/controls/ButtonControl/ButtonControl.js +3 -3
  16. package/dist/components/ControlRenderer/controls/DateControl/DateControl.d.ts +29 -0
  17. package/dist/components/ControlRenderer/controls/DateControl/DateControl.js +31 -0
  18. package/dist/components/ControlRenderer/controls/DateControl/index.d.ts +1 -0
  19. package/dist/components/ControlRenderer/controls/DateControl/index.js +4 -0
  20. package/dist/components/ControlRenderer/controls/DateControl/types.d.ts +12 -0
  21. package/dist/components/ControlRenderer/controls/NumberControl/NumberControl.js +8 -8
  22. package/dist/components/ControlRenderer/controls/RangeControl/RangeControl.d.ts +30 -0
  23. package/dist/components/ControlRenderer/controls/RangeControl/RangeControl.js +40 -0
  24. package/dist/components/ControlRenderer/controls/RangeControl/index.d.ts +1 -0
  25. package/dist/components/ControlRenderer/controls/RangeControl/index.js +4 -0
  26. package/dist/components/ControlRenderer/controls/RangeControl/types.d.ts +13 -0
  27. package/dist/components/ControlRenderer/controls/SelectControl/SelectControl.js +6 -9
  28. package/dist/components/ControlRenderer/controls/SeparatorControl/SeparatorControl.d.ts +30 -0
  29. package/dist/components/ControlRenderer/controls/SeparatorControl/SeparatorControl.js +14 -0
  30. package/dist/components/ControlRenderer/controls/SeparatorControl/index.d.ts +1 -0
  31. package/dist/components/ControlRenderer/controls/SeparatorControl/index.js +4 -0
  32. package/dist/components/ControlRenderer/controls/SeparatorControl/types.d.ts +10 -0
  33. package/dist/components/ControlRenderer/controls/TextControl/TextControl.js +7 -7
  34. package/dist/components/ControlRenderer/controls/index.d.ts +3 -1
  35. package/dist/components/ControlRenderer/controls/index.js +13 -38
  36. package/dist/components/ControlRenderer/controls/types.d.ts +6 -0
  37. package/dist/components/ControlRenderer/index.js +1 -1
  38. package/dist/components/DevPanel/DevPanel.js +43 -41
  39. package/dist/components/DevPanel/types.d.ts +7 -4
  40. package/dist/components/EmptyContent/EmptyContent.js +2 -2
  41. package/dist/components/Input/Input.js +3 -3
  42. package/dist/components/Logger/index.d.ts +20 -0
  43. package/dist/components/Logger/index.js +85 -0
  44. package/dist/components/Section/Section.js +17 -16
  45. package/dist/components/index.d.ts +1 -0
  46. package/dist/components/index.js +6 -5
  47. package/dist/hooks/useDevPanel/useDevPanel.js +10 -10
  48. package/dist/hooks/useDragAndDrop/useDragAndDrop.d.ts +1 -1
  49. package/dist/hooks/useHotkeys/types.d.ts +14 -0
  50. package/dist/hooks/useHotkeys/useHotkey.d.ts +1 -2
  51. package/dist/hooks/useHotkeys/useHotkeys.d.ts +1 -2
  52. package/dist/index.d.ts +2 -0
  53. package/dist/index.js +9 -8
  54. package/dist/store/store.d.ts +106 -0
  55. package/dist/store/store.js +239 -0
  56. package/dist/utils/createHotkey/createHotkey.d.ts +1 -1
  57. package/dist/utils/formatHotkey/formatHotkey.d.ts +1 -1
  58. package/dist/utils/getConstrainedPosition/getConstrainedPosition.d.ts +1 -1
  59. package/dist/utils/getCurrentElementPosition/getCurrentElementPosition.d.ts +1 -1
  60. package/dist/utils/getPositionAdjustment/getPositionAdjustment.d.ts +2 -2
  61. package/dist/utils/hasControlChanged/hasControlChanged.js +5 -5
  62. package/dist/utils/index.d.ts +0 -1
  63. package/dist/utils/index.js +16 -23
  64. package/package.json +27 -21
  65. package/dist/assets/SelectControl.css +0 -1
  66. package/dist/components/logger.d.ts +0 -5
  67. package/dist/components/logger.js +0 -7
  68. package/dist/types.d.ts +0 -18
  69. package/dist/utils/store/store.d.ts +0 -40
  70. package/dist/utils/store/store.js +0 -103
  71. package/dist/vite-env.d.ts +0 -1
  72. /package/dist/{utils/store → store}/index.d.ts +0 -0
  73. /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,4 @@
1
+ import { DateControl as t } from "./DateControl.js";
2
+ export {
3
+ t as DateControl
4
+ };
@@ -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 h({ control: e }) {
5
- const n = e.event || "onBlur", [l, t] = i(e.value);
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 m = (u) => {
9
+ const s = (u) => {
10
10
  const a = Number(u.target.value);
11
11
  t(a), n === "onChange" && e.onChange(a);
12
- }, s = (u) => {
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: l,
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: m,
26
- ...n === "onBlur" && { onBlur: s }
25
+ onChange: s,
26
+ ...n === "onBlur" && { onBlur: l }
27
27
  }
28
28
  );
29
29
  }
30
30
  export {
31
- h as NumberControl
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,4 @@
1
+ import { RangeControl as e } from "./RangeControl.js";
2
+ export {
3
+ e as RangeControl
4
+ };
@@ -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 s } from "react/jsx-runtime";
1
+ import { jsx as t } from "react/jsx-runtime";
2
2
  import { Select as n } from "../../../Select/Select.js";
3
- import '../../../../assets/SelectControl.css';const r = "_select_1w3k9_1", c = {
4
- select: r
5
- };
6
- function o({ control: t }) {
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
- o as SelectControl
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,4 @@
1
+ import { SeparatorControl as t } from "./SeparatorControl.js";
2
+ export {
3
+ t as SeparatorControl
4
+ };
@@ -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 s } from "react/jsx-runtime";
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 g({ control: e }) {
5
- const n = e.event || "onBlur", [u, l] = h(e.value);
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
- }, r = (t) => {
12
+ }, s = (t) => {
13
13
  const a = t.target.value;
14
14
  n === "onBlur" && e.onChange(a);
15
15
  };
16
- return /* @__PURE__ */ s(
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: r }
24
+ ...n === "onBlur" && { onBlur: s }
25
25
  }
26
26
  );
27
27
  }
28
28
  export {
29
- g as TextControl
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 { Suspense as c, lazy as e } from "react";
2
- import { jsxs as i, Fragment as s, jsx as n } from "react/jsx-runtime";
3
- import { className as p } from "../../../utils/className/className.js";
4
- import "../../../utils/store/store.js";
5
- import '../../../assets/index.css';const u = "_controlContainer_5dtr1_1", m = "_fullWidth_5dtr1_9", f = "_controlWrapper_5dtr1_12", h = "_label_5dtr1_16", C = "_description_5dtr1_25", _ = "_loading_5dtr1_26", r = {
6
- controlContainer: u,
7
- fullWidth: m,
8
- controlWrapper: f,
9
- label: h,
10
- description: C,
11
- loading: _
12
- }, b = ["button", "buttonGroup"];
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
- x as ControlRenderer,
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,4 +1,4 @@
1
- import { ControlRenderer as o } from "./controls/index.js";
1
+ import { ControlRenderer as o } from "./ControlRenderer.js";
2
2
  export {
3
3
  o as ControlRenderer
4
4
  };
@@ -1,65 +1,67 @@
1
- import { jsxs as r, jsx as t } from "react/jsx-runtime";
2
- import { useCallback as C } from "react";
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 D } from "../../hooks/useHotkeys/useHotkey.js";
5
- import { className as P } from "../../utils/className/className.js";
6
- import { useDevPanelVisible as b, useDevPanelCollapsed as g, useDevPanelPosition as y, useDevPanelSections as N, useDevPanelActions as K } from "../../utils/store/store.js";
7
- import { EmptyContent as k } from "../EmptyContent/EmptyContent.js";
8
- import { Section as x } from "../Section/Section.js";
9
- import '../../assets/DevPanel.css';const z = "_devPanelContainer_12zm6_30", E = "_header_12zm6_41", V = "_title_12zm6_50", j = "_button_12zm6_60", w = "_content_12zm6_78", e = {
10
- devPanelContainer: z,
11
- header: E,
12
- title: V,
13
- button: j,
14
- content: w
15
- }, S = {
16
- key: "f",
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
- altKey: !0,
19
- ctrlKey: !1,
19
+ key: "a",
20
+ altKey: !1,
20
21
  metaKey: !1
21
22
  };
22
- function F({ panelTitle: c = "Dev panel", ...m }) {
23
- const i = b(), n = g(), l = y(), d = N(), o = K(), u = C(
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
- o.setPosition(s);
26
+ n.setPosition(s);
26
27
  },
27
- [o]
28
- ), { isDragging: p, elementRef: f, handleMouseDown: h } = _({
29
- onPositionChange: u
28
+ [n]
29
+ ), { isDragging: p, elementRef: v, handleMouseDown: u } = _({
30
+ onPositionChange: m
30
31
  });
31
- if (D({
32
+ if (C({
32
33
  description: "Show Dev Panel",
33
34
  preventDefault: !0,
34
- action: () => o.setVisible(!i),
35
- ...S,
36
- ...m.hotKeyConfig
37
- }), process.env.NODE_ENV !== "development" || !i)
35
+ action: () => n.setVisible(!l),
36
+ ...j,
37
+ ...d.hotKeyConfig,
38
+ target: window
39
+ }), !l)
38
40
  return null;
39
- const a = Object.entries(d);
41
+ const i = Object.entries(h);
40
42
  return /* @__PURE__ */ r(
41
43
  "div",
42
44
  {
43
- ref: f,
44
- ...P(e.devPanelContainer, {
45
- [e.dragging]: p
45
+ ref: v,
46
+ ...b(t.devPanelContainer, {
47
+ [t.dragging]: p
46
48
  }),
47
49
  style: {
48
- left: l.x,
49
- top: l.y,
50
- height: n ? "auto" : void 0
50
+ left: a.x,
51
+ top: a.y,
52
+ height: o ? "auto" : void 0
51
53
  },
52
54
  children: [
53
- /* @__PURE__ */ r("div", { className: e.header, onMouseDown: h, children: [
54
- /* @__PURE__ */ t("button", { className: e.button, onClick: () => o.setCollapsed(!n), title: n ? "Expand" : "Collapse", children: n ? "" : "" }),
55
- /* @__PURE__ */ t("div", { className: e.title, children: c }),
56
- /* @__PURE__ */ t("button", { className: e.button, onClick: () => o.setVisible(!1), title: "Close", children: "" })
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
- !n && /* @__PURE__ */ t("div", { className: e.content, children: a.length ? a.map(([s, v]) => /* @__PURE__ */ t(x, { sectionName: s, section: v }, `section-${s}`)) : /* @__PURE__ */ t(k, {}) })
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
- F as DevPanel
66
+ O as DevPanel
65
67
  };
@@ -1,9 +1,7 @@
1
1
  import { ControlsGroup } from '../ControlRenderer/controls/types';
2
- import { HotkeyConfig, Position } from '../../types';
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?: DevPanelHoyKeyConfig;
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 = "_empty_1re8c_1", r = {
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: r.empty, children: [
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 i = "_input_w2bi0_1", p = {
3
- input: i
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: p.input });
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 {};