@berenjena/react-dev-panel 0.0.1-beta.1 → 0.0.1-beta.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.
@@ -0,0 +1,10 @@
1
+ import { BaseControl } from '../types';
2
+ export interface BooleanControl extends BaseControl {
3
+ type: "boolean";
4
+ value: boolean;
5
+ onChange: (value: boolean) => void;
6
+ }
7
+
8
+ export interface BooleanControlProps {
9
+ control: BooleanControl;
10
+ }
@@ -0,0 +1,10 @@
1
+ import { BaseControl } from '../types';
2
+ export interface ButtonControl extends BaseControl {
3
+ type: "button";
4
+ label: string;
5
+ onClick: () => void;
6
+ }
7
+
8
+ export interface ButtonControlProps {
9
+ control: ButtonControl;
10
+ }
@@ -0,0 +1,10 @@
1
+ import { BaseControl } from '../types';
2
+ export interface ColorControl extends BaseControl {
3
+ type: "color";
4
+ value: string;
5
+ onChange: (value: string) => void;
6
+ }
7
+
8
+ export interface ColorControlProps {
9
+ control: ColorControl;
10
+ }
@@ -0,0 +1,13 @@
1
+ import { BaseControl } from '../types';
2
+ export interface NumberControl extends BaseControl {
3
+ type: "number";
4
+ value: number;
5
+ min?: number;
6
+ max?: number;
7
+ step?: number;
8
+ onChange: (value: number) => void;
9
+ }
10
+
11
+ export interface NumberControlProps {
12
+ control: NumberControl;
13
+ }
@@ -0,0 +1,11 @@
1
+ import { BaseControl } from '../types';
2
+ export interface SelectControl extends BaseControl {
3
+ type: "select";
4
+ value: string;
5
+ options: string[] | { label: string; value: string }[];
6
+ onChange: (value: string) => void;
7
+ }
8
+
9
+ export interface SelectControlProps {
10
+ control: SelectControl;
11
+ }
@@ -0,0 +1,11 @@
1
+ import { BaseControl } from '../types';
2
+ export interface TextControl extends BaseControl {
3
+ type: "text";
4
+ value: string;
5
+ placeholder?: string;
6
+ onChange: (value: string) => void;
7
+ }
8
+
9
+ export interface TextControlProps {
10
+ control: TextControl;
11
+ }
@@ -0,0 +1,26 @@
1
+ import { BooleanControl } from './BooleanControl/types';
2
+ import { ButtonControl } from './ButtonControl/types';
3
+ import { ColorControl } from './ColorControl/types';
4
+ import { NumberControl } from './NumberControl/types';
5
+ import { SelectControl } from './SelectControl/types';
6
+ import { TextControl } from './TextControl/types';
7
+ export interface BaseControl {
8
+ label?: string;
9
+ description?: string;
10
+ disabled?: boolean;
11
+ }
12
+
13
+ export type Controls = {
14
+ color: ColorControl;
15
+ boolean: BooleanControl;
16
+ select: SelectControl;
17
+ text: TextControl;
18
+ button: ButtonControl;
19
+ number: NumberControl;
20
+ };
21
+
22
+ export type ControlsNames = keyof Controls;
23
+
24
+ export type Control<Name extends ControlsNames> = Controls[Name];
25
+
26
+ export type ControlsGroup = Record<string, Control<ControlsNames>>;
@@ -0,0 +1,5 @@
1
+ import { Control, ControlsNames } from './controls/types';
2
+ export interface ControlRendererProps<Name extends ControlsNames> {
3
+ name: string;
4
+ control: Control<Name>;
5
+ }
@@ -0,0 +1,47 @@
1
+ import { ControlsGroup } from '../ControlRenderer/controls/types';
2
+ import { HotkeyConfig, Position } from '../../types';
3
+ export type DevPanelHoyKeyConfig = Pick<HotkeyConfig, "key" | "shiftKey" | "altKey" | "ctrlKey" | "metaKey">;
4
+
5
+ export interface DevPanelProps {
6
+ theme?: "light" | "dark";
7
+ panelTitle?: string;
8
+ /**
9
+ * Hotkey configuration for toggling the DevPanel visibility.
10
+ * If not provided, defaults to
11
+ * ```json
12
+ * {
13
+ * key: "f",
14
+ * shiftKey: true,
15
+ * altKey: true,
16
+ * ctrlKey: false,
17
+ * metaKey: false,
18
+ * }
19
+ * ```
20
+ */
21
+ hotKeyConfig?: DevPanelHoyKeyConfig;
22
+ }
23
+
24
+ export interface DevPanelSection {
25
+ name: string;
26
+ controls: ControlsGroup;
27
+ isCollapsed?: boolean;
28
+ }
29
+
30
+ export interface DevPanelState {
31
+ isVisible: boolean;
32
+ isCollapsed: boolean;
33
+ sections: Record<string, DevPanelSection>;
34
+ position: Position;
35
+ }
36
+
37
+ export interface DevPanelActions {
38
+ setVisible: (visible: boolean) => void;
39
+ setCollapsed: (collapsed: boolean) => void;
40
+ setPosition: (position: Position) => void;
41
+ registerSection: (name: string, controls: ControlsGroup) => void;
42
+ unregisterSection: (name: string) => void;
43
+ toggleSectionCollapse: (name: string) => void;
44
+ reset: () => void;
45
+ }
46
+
47
+ export type DevPanelStore = DevPanelState & DevPanelActions;
@@ -0,0 +1,6 @@
1
+ export interface UseHotkeysOptions {
2
+ enabled?: boolean;
3
+ target?: HTMLElement | Window | Document;
4
+ preventDefault?: boolean;
5
+ stopPropagation?: boolean;
6
+ }
@@ -0,0 +1,18 @@
1
+ export interface Position {
2
+ x: number;
3
+ y: number;
4
+ }
5
+
6
+ export interface HotkeyConfig {
7
+ key: string;
8
+ description?: string;
9
+ ctrlKey?: boolean;
10
+ shiftKey?: boolean;
11
+ altKey?: boolean;
12
+ metaKey?: boolean;
13
+ preventDefault?: boolean;
14
+ stopPropagation?: boolean;
15
+ enabled?: boolean;
16
+ target?: HTMLElement | Window | Document;
17
+ action: (event: KeyboardEvent) => void;
18
+ }
@@ -0,0 +1 @@
1
+ /// <reference types="vite/client" />
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "url": "git+https://github.com/Berenjenas/react-dev-panel.git"
16
16
  },
17
17
  "private": false,
18
- "version": "0.0.1-beta.1",
18
+ "version": "0.0.1-beta.3",
19
19
  "type": "module",
20
20
  "files": [
21
21
  "dist"