@berenjena/react-dev-panel 2.0.0 → 2.2.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/{RangeControl.css → index10.css} +1 -1
- package/dist/assets/index11.css +1 -0
- package/dist/assets/index13.css +1 -0
- package/dist/assets/index14.css +1 -0
- package/dist/assets/index15.css +1 -0
- package/dist/assets/index2.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/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/DateControl/index.d.ts +41 -1
- package/dist/components/ControlRenderer/controls/DateControl/index.js +29 -2
- package/dist/components/ControlRenderer/controls/DragAndDropControl/index.d.ts +2 -0
- package/dist/components/ControlRenderer/controls/DragAndDropControl/index.js +117 -0
- package/dist/components/ControlRenderer/controls/DragAndDropControl/types.d.ts +20 -0
- package/dist/components/ControlRenderer/controls/MultiSelectControl/index.d.ts +28 -1
- package/dist/components/ControlRenderer/controls/MultiSelectControl/index.js +16 -2
- 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/TextControl/types.d.ts +1 -0
- package/dist/components/ControlRenderer/controls/index.d.ts +1 -0
- package/dist/components/ControlRenderer/controls/index.js +2 -1
- 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 +67 -2
- package/dist/components/DevPanel/types.d.ts +13 -6
- package/dist/components/DevPanelPortal/index.d.ts +9 -1
- package/dist/components/DevPanelPortal/index.js +15 -2
- package/dist/components/EmptyContent/index.d.ts +1 -1
- package/dist/components/EmptyContent/index.js +17 -2
- package/dist/components/Icon/index.d.ts +3 -3
- 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/Textarea/index.d.ts +5 -0
- package/dist/components/Textarea/index.js +18 -0
- package/dist/components/index.js +3 -3
- 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.js +1 -1
- package/dist/store/UIStore.d.ts +78 -2
- package/dist/store/UIStore.js +95 -34
- package/dist/utils/getPositionAdjustment/getPositionAdjustment.d.ts +3 -2
- package/dist/utils/getPositionAdjustment/getPositionAdjustment.js +1 -4
- package/package.json +43 -29
- package/dist/assets/BooleanControl.css +0 -1
- package/dist/assets/ButtonControl.css +0 -1
- package/dist/assets/ButtonGroupControl.css +0 -1
- package/dist/assets/DevPanel.css +0 -1
- package/dist/assets/Input.css +0 -1
- package/dist/assets/MultiSelectControl.css +0 -1
- package/dist/assets/Select.css +0 -1
- package/dist/components/ControlRenderer/ControlRenderer.d.ts +0 -6
- package/dist/components/ControlRenderer/ControlRenderer.js +0 -52
- package/dist/components/ControlRenderer/controls/BooleanControl/BooleanControl.d.ts +0 -32
- package/dist/components/ControlRenderer/controls/BooleanControl/BooleanControl.js +0 -26
- package/dist/components/ControlRenderer/controls/ButtonControl/ButtonControl.d.ts +0 -33
- package/dist/components/ControlRenderer/controls/ButtonControl/ButtonControl.js +0 -10
- package/dist/components/ControlRenderer/controls/ButtonGroupControl/ButtonGroupControl.d.ts +0 -37
- package/dist/components/ControlRenderer/controls/ButtonGroupControl/ButtonGroupControl.js +0 -22
- package/dist/components/ControlRenderer/controls/ColorControl/ColorControl.d.ts +0 -23
- package/dist/components/ControlRenderer/controls/ColorControl/ColorControl.js +0 -69
- package/dist/components/ControlRenderer/controls/DateControl/DateControl.d.ts +0 -41
- package/dist/components/ControlRenderer/controls/DateControl/DateControl.js +0 -31
- package/dist/components/ControlRenderer/controls/MultiSelectControl/MultiSelectControl.d.ts +0 -28
- package/dist/components/ControlRenderer/controls/MultiSelectControl/MultiSelectControl.js +0 -131
- package/dist/components/ControlRenderer/controls/NumberControl/NumberControl.d.ts +0 -45
- package/dist/components/ControlRenderer/controls/NumberControl/NumberControl.js +0 -32
- package/dist/components/ControlRenderer/controls/RangeControl/RangeControl.d.ts +0 -46
- package/dist/components/ControlRenderer/controls/RangeControl/RangeControl.js +0 -40
- package/dist/components/ControlRenderer/controls/SelectControl/SelectControl.d.ts +0 -39
- package/dist/components/ControlRenderer/controls/SelectControl/SelectControl.js +0 -11
- package/dist/components/ControlRenderer/controls/SeparatorControl/SeparatorControl.d.ts +0 -39
- package/dist/components/ControlRenderer/controls/SeparatorControl/SeparatorControl.js +0 -14
- package/dist/components/ControlRenderer/controls/TextControl/TextControl.d.ts +0 -40
- 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 -72
- package/dist/components/DevPanelPortal/DevPanelPortal.d.ts +0 -8
- package/dist/components/DevPanelPortal/DevPanelPortal.js +0 -17
- 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/Section/Section.d.ts +0 -7
- package/dist/components/Section/Section.js +0 -25
- 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 -29
- package/dist/hooks/useDevPanel/useDevPanel.js +0 -25218
- package/dist/hooks/useDragAndDrop/useDragAndDrop.d.ts +0 -20
- 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/managers/index.d.ts +0 -1
- package/dist/managers/index.js +0 -4
- package/dist/store/ThemeStore.d.ts +0 -68
- package/dist/store/ThemeStore.js +0 -102
- package/dist/store/index.d.ts +0 -4
- package/dist/store/index.js +0 -18
- package/dist/utils/index.d.ts +0 -9
- package/dist/utils/index.js +0 -20
- /package/dist/assets/{ColorControl.css → index12.css} +0 -0
- /package/dist/assets/{EmptyContent.css → index3.css} +0 -0
- /package/dist/assets/{Section.css → index4.css} +0 -0
- /package/dist/assets/{ControlRenderer.css → index5.css} +0 -0
- /package/dist/assets/{SeparatorControl.css → index9.css} +0 -0
|
@@ -1 +1,46 @@
|
|
|
1
|
-
|
|
1
|
+
import { RangeControlProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Component that renders a range/slider control with configurable event handling and visual value display
|
|
4
|
+
*
|
|
5
|
+
* @param props - The component props
|
|
6
|
+
* @param props.control - The range control configuration object
|
|
7
|
+
* @param props.control.type - The control type, must be 'range'
|
|
8
|
+
* @param props.control.value - The current numeric value of the slider
|
|
9
|
+
* @param props.control.min - Optional minimum allowed value (defaults to 0)
|
|
10
|
+
* @param props.control.max - Optional maximum allowed value (defaults to 100)
|
|
11
|
+
* @param props.control.step - Optional step increment for the slider (defaults to 1)
|
|
12
|
+
* @param props.control.event - When to trigger onChange: "onChange" (real-time) or "onBlur" (on focus loss). Defaults to "onChange"
|
|
13
|
+
* @param props.control.onChange - Callback function triggered when slider value changes
|
|
14
|
+
* @param props.control.disabled - Optional flag to disable the control
|
|
15
|
+
* @returns JSX element representing the range slider control with value display
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* // Real-time updates with custom range (default behavior)
|
|
20
|
+
* <RangeControl control={{
|
|
21
|
+
* type: 'range',
|
|
22
|
+
* value: 75,
|
|
23
|
+
* min: 0,
|
|
24
|
+
* max: 100,
|
|
25
|
+
* step: 5,
|
|
26
|
+
* event: 'onChange',
|
|
27
|
+
* onChange: (value) => setVolume(value),
|
|
28
|
+
* disabled: false
|
|
29
|
+
* }} />
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* // Updates only when losing focus with decimal steps
|
|
35
|
+
* <RangeControl control={{
|
|
36
|
+
* type: 'range',
|
|
37
|
+
* value: 2.5,
|
|
38
|
+
* min: 0,
|
|
39
|
+
* max: 5,
|
|
40
|
+
* step: 0.1,
|
|
41
|
+
* event: 'onBlur',
|
|
42
|
+
* onChange: (value) => console.log('Rating changed:', value)
|
|
43
|
+
* }} />
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export declare function RangeControl({ control }: RangeControlProps): React.ReactNode;
|
|
@@ -1,4 +1,40 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs as g, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { useState as o, useEffect as m } from "react";
|
|
3
|
+
import '../../../../assets/index10.css';const v = "_container_1a1cs_1", h = "_range_1a1cs_9", d = "_value_1a1cs_115", u = {
|
|
4
|
+
container: v,
|
|
5
|
+
range: h,
|
|
6
|
+
value: d
|
|
7
|
+
};
|
|
8
|
+
function _({ control: e }) {
|
|
9
|
+
const n = e.event || "onChange", [t, l] = o(e.value);
|
|
10
|
+
function r(s) {
|
|
11
|
+
const a = Number(s.target.value);
|
|
12
|
+
l(a), n === "onChange" && e.onChange(a);
|
|
13
|
+
}
|
|
14
|
+
function c(s) {
|
|
15
|
+
const a = Number(s.target.value);
|
|
16
|
+
n === "onBlur" && e.onChange(a);
|
|
17
|
+
}
|
|
18
|
+
return m(() => {
|
|
19
|
+
l(e.value);
|
|
20
|
+
}, [e.value]), /* @__PURE__ */ g("div", { className: u.container, children: [
|
|
21
|
+
/* @__PURE__ */ i(
|
|
22
|
+
"input",
|
|
23
|
+
{
|
|
24
|
+
type: "range",
|
|
25
|
+
value: t,
|
|
26
|
+
min: e.min,
|
|
27
|
+
max: e.max,
|
|
28
|
+
step: e.step,
|
|
29
|
+
disabled: e.disabled,
|
|
30
|
+
onChange: r,
|
|
31
|
+
...n === "onBlur" && { onBlur: c },
|
|
32
|
+
className: u.range
|
|
33
|
+
}
|
|
34
|
+
),
|
|
35
|
+
/* @__PURE__ */ i("span", { className: u.value, children: t })
|
|
36
|
+
] });
|
|
37
|
+
}
|
|
2
38
|
export {
|
|
3
|
-
|
|
39
|
+
_ as RangeControl
|
|
4
40
|
};
|
|
@@ -1 +1,39 @@
|
|
|
1
|
-
|
|
1
|
+
import { SelectControlProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Component that renders a dropdown select control with single selection
|
|
4
|
+
*
|
|
5
|
+
* @param props - The component props
|
|
6
|
+
* @param props.control - The select control configuration object
|
|
7
|
+
* @param props.control.type - The control type, must be 'select'
|
|
8
|
+
* @param props.control.value - The currently selected option value
|
|
9
|
+
* @param props.control.options - Array of available options (strings or objects with label/value)
|
|
10
|
+
* @param props.control.onChange - Callback function triggered when selection changes
|
|
11
|
+
* @param props.control.disabled - Optional flag to disable the control
|
|
12
|
+
* @returns JSX element representing a dropdown select control
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* <SelectControl control={{
|
|
17
|
+
* type: 'select',
|
|
18
|
+
* value: 'medium',
|
|
19
|
+
* options: ['small', 'medium', 'large'],
|
|
20
|
+
* onChange: (value) => setSize(value),
|
|
21
|
+
* disabled: false
|
|
22
|
+
* }} />
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* <SelectControl control={{
|
|
28
|
+
* type: 'select',
|
|
29
|
+
* value: 'red',
|
|
30
|
+
* options: [
|
|
31
|
+
* { label: 'Red Color', value: 'red' },
|
|
32
|
+
* { label: 'Blue Color', value: 'blue' },
|
|
33
|
+
* { label: 'Green Color', value: 'green' }
|
|
34
|
+
* ],
|
|
35
|
+
* onChange: (value) => console.log('Selected:', value)
|
|
36
|
+
* }} />
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare function SelectControl({ control }: SelectControlProps): React.ReactNode;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { Select as n } from "../../../Select/index.js";
|
|
3
|
+
function p({ control: e }) {
|
|
4
|
+
return /* @__PURE__ */ i(n, { value: e.value, options: e.options, disabled: e.disabled, onChange: (o) => e.onChange(o) });
|
|
5
|
+
}
|
|
2
6
|
export {
|
|
3
|
-
|
|
7
|
+
p as SelectControl
|
|
4
8
|
};
|
|
@@ -1 +1,39 @@
|
|
|
1
|
-
|
|
1
|
+
import { SeparatorControlProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Component that renders a visual separator to organize control groups
|
|
4
|
+
*
|
|
5
|
+
* @param props - The component props
|
|
6
|
+
* @param props.control - The separator control configuration object
|
|
7
|
+
* @param props.control.type - The control type, must be 'separator'
|
|
8
|
+
* @param props.control.style - The style of separator: "line" (default), "space", or "label"
|
|
9
|
+
* @param props.control.label - Optional label text (only displayed when style is "label")
|
|
10
|
+
* @returns JSX element representing a visual separator
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* // Simple line separator (default)
|
|
15
|
+
* <SeparatorControl control={{
|
|
16
|
+
* type: 'separator'
|
|
17
|
+
* }} />
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* // Separator with label text
|
|
23
|
+
* <SeparatorControl control={{
|
|
24
|
+
* type: 'separator',
|
|
25
|
+
* style: 'label',
|
|
26
|
+
* label: 'Advanced Settings'
|
|
27
|
+
* }} />
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* // Space separator for extra spacing
|
|
33
|
+
* <SeparatorControl control={{
|
|
34
|
+
* type: 'separator',
|
|
35
|
+
* style: 'space'
|
|
36
|
+
* }} />
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare function SeparatorControl({ control }: SeparatorControlProps): React.ReactNode;
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import '../../../../assets/index9.css';const s = "_line_174q4_1", t = "_space_174q4_9", i = "_labelContainer_174q4_14", c = "_label_174q4_14", l = {
|
|
3
|
+
line: s,
|
|
4
|
+
space: t,
|
|
5
|
+
labelContainer: i,
|
|
6
|
+
label: c
|
|
7
|
+
};
|
|
8
|
+
function o({ 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
|
+
}
|
|
2
12
|
export {
|
|
3
|
-
|
|
13
|
+
o as SeparatorControl
|
|
4
14
|
};
|
|
@@ -1 +1,40 @@
|
|
|
1
|
-
|
|
1
|
+
import { TextControlProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Component that renders a text input control with configurable event handling
|
|
4
|
+
*
|
|
5
|
+
* @param props - The component props
|
|
6
|
+
* @param props.control - The text control configuration object
|
|
7
|
+
* @param props.control.type - The control type, must be 'text'
|
|
8
|
+
* @param props.control.value - The current string value of the text input
|
|
9
|
+
* @param props.control.placeholder - Optional placeholder text displayed when input is empty
|
|
10
|
+
* @param props.control.event - When to trigger onChange: "onChange" (real-time) or "onBlur" (on focus loss). Defaults to "onChange"
|
|
11
|
+
* @param props.control.onChange - Callback function triggered when text value changes
|
|
12
|
+
* @param props.control.disabled - Optional flag to disable the control
|
|
13
|
+
* @returns JSX element representing the text input control
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* // Real-time updates (default behavior)
|
|
18
|
+
* <TextControl control={{
|
|
19
|
+
* type: 'text',
|
|
20
|
+
* value: 'John Doe',
|
|
21
|
+
* placeholder: 'Enter your full name',
|
|
22
|
+
* event: 'onChange',
|
|
23
|
+
* onChange: (value) => setUserName(value),
|
|
24
|
+
* disabled: false
|
|
25
|
+
* }} />
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* // Updates only when losing focus
|
|
31
|
+
* <TextControl control={{
|
|
32
|
+
* type: 'text',
|
|
33
|
+
* value: 'search query',
|
|
34
|
+
* placeholder: 'Type to search...',
|
|
35
|
+
* event: 'onBlur',
|
|
36
|
+
* onChange: (value) => console.log('Search term:', value)
|
|
37
|
+
* }} />
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare function TextControl({ control }: TextControlProps): React.ReactNode;
|
|
@@ -1,4 +1,30 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { useState as s, useEffect as r } from "react";
|
|
3
|
+
import { Textarea as f } from "../../../Textarea/index.js";
|
|
4
|
+
function v({ control: e }) {
|
|
5
|
+
const n = e.event || "onChange", [t, l] = s(e.value);
|
|
6
|
+
function o(u) {
|
|
7
|
+
const a = u.target.value;
|
|
8
|
+
l(a), n === "onChange" && e.onChange(a);
|
|
9
|
+
}
|
|
10
|
+
function d(u) {
|
|
11
|
+
const a = u.target.value;
|
|
12
|
+
n === "onBlur" && e.onChange(a);
|
|
13
|
+
}
|
|
14
|
+
return r(() => {
|
|
15
|
+
l(e.value);
|
|
16
|
+
}, [e.value]), /* @__PURE__ */ i(
|
|
17
|
+
f,
|
|
18
|
+
{
|
|
19
|
+
value: t,
|
|
20
|
+
placeholder: e.placeholder,
|
|
21
|
+
disabled: e.disabled,
|
|
22
|
+
onChange: o,
|
|
23
|
+
disableAutoExpand: e.disableAutoExpand,
|
|
24
|
+
...n === "onBlur" && { onBlur: d }
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
}
|
|
2
28
|
export {
|
|
3
|
-
|
|
29
|
+
v as TextControl
|
|
4
30
|
};
|
|
@@ -15,4 +15,5 @@ export declare const controls: Readonly<{
|
|
|
15
15
|
separator: import('react').LazyExoticComponent<typeof import('./SeparatorControl').SeparatorControl>;
|
|
16
16
|
text: import('react').LazyExoticComponent<typeof import('./TextControl').TextControl>;
|
|
17
17
|
buttonGroup: import('react').LazyExoticComponent<typeof import('./ButtonGroupControl').ButtonGroupControl>;
|
|
18
|
+
dragAndDrop: import('react').LazyExoticComponent<typeof import('./DragAndDropControl').DragAndDropControl>;
|
|
18
19
|
}>;
|
|
@@ -10,7 +10,8 @@ const r = Object.freeze({
|
|
|
10
10
|
multiselect: o(() => import("./MultiSelectControl/index.js").then((t) => ({ default: t.MultiSelectControl }))),
|
|
11
11
|
separator: o(() => import("./SeparatorControl/index.js").then((t) => ({ default: t.SeparatorControl }))),
|
|
12
12
|
text: o(() => import("./TextControl/index.js").then((t) => ({ default: t.TextControl }))),
|
|
13
|
-
buttonGroup: o(() => import("./ButtonGroupControl/index.js").then((t) => ({ default: t.ButtonGroupControl })))
|
|
13
|
+
buttonGroup: o(() => import("./ButtonGroupControl/index.js").then((t) => ({ default: t.ButtonGroupControl }))),
|
|
14
|
+
dragAndDrop: o(() => import("./DragAndDropControl/index.js").then((t) => ({ default: t.DragAndDropControl })))
|
|
14
15
|
});
|
|
15
16
|
export {
|
|
16
17
|
r as controls
|
|
@@ -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 { DragAndDropControl } from './DragAndDropControl/types';
|
|
6
7
|
import { MultiSelectControl } from './MultiSelectControl/types';
|
|
7
8
|
import { NumberControl } from './NumberControl/types';
|
|
8
9
|
import { RangeControl } from './RangeControl/types';
|
|
@@ -32,6 +33,7 @@ export type Controls = {
|
|
|
32
33
|
date: DateControl;
|
|
33
34
|
separator: SeparatorControl;
|
|
34
35
|
buttonGroup: ButtonGroupControl;
|
|
36
|
+
dragAndDrop: DragAndDropControl;
|
|
35
37
|
};
|
|
36
38
|
|
|
37
39
|
export type ControlsNames = keyof Controls;
|
|
@@ -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", e = {
|
|
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
|
+
}, g = ["button", "buttonGroup", "separator", "dragAndDrop"], W = ["separator", "dragAndDrop"], j = ["button", "separator", "dragAndDrop"];
|
|
17
|
+
function A({ name: l, control: r }) {
|
|
18
|
+
const i = r?.label || l;
|
|
19
|
+
function a() {
|
|
20
|
+
if (!r || !r.type)
|
|
21
|
+
return /* @__PURE__ */ n("div", { className: e.error, children: "Control type is not defined" });
|
|
22
|
+
const o = d[r.type];
|
|
23
|
+
return o ? /* @__PURE__ */ n(c, { fallback: /* @__PURE__ */ n("div", { className: e.loading, children: "Loading control..." }), children: /* @__PURE__ */ n(o, { control: r }) }) : /* @__PURE__ */ n("div", { children: "Unknown control type" });
|
|
24
|
+
}
|
|
25
|
+
return /* @__PURE__ */ t("div", { className: e.controlRendererContainer, children: [
|
|
26
|
+
/* @__PURE__ */ t(
|
|
27
|
+
"div",
|
|
28
|
+
{
|
|
29
|
+
...s(e.controlContainer, {
|
|
30
|
+
[e.fullWidth]: g.includes(r.type),
|
|
31
|
+
[e.hoverable]: !W.includes(r.type)
|
|
32
|
+
}),
|
|
33
|
+
children: [
|
|
34
|
+
!j.includes(r.type) && /* @__PURE__ */ n("label", { className: e.label, children: i }),
|
|
35
|
+
/* @__PURE__ */ n(
|
|
36
|
+
"div",
|
|
37
|
+
{
|
|
38
|
+
...s(e.controlWrapper, {
|
|
39
|
+
[e.justifyStart]: r.type === "separator"
|
|
40
|
+
}),
|
|
41
|
+
children: a()
|
|
42
|
+
}
|
|
43
|
+
)
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
),
|
|
47
|
+
r?.description && /* @__PURE__ */ n("span", { className: e.description, children: r.description })
|
|
48
|
+
] });
|
|
49
|
+
}
|
|
2
50
|
export {
|
|
3
|
-
|
|
51
|
+
A 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,69 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs as m, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback as y, useEffect as D } from "react";
|
|
3
|
+
import { useDragAndDrop as b } from "../../hooks/useDragAndDrop/index.js";
|
|
4
|
+
import { useHotkey as g } from "../../hooks/useHotKey/index.js";
|
|
5
|
+
import { useDevPanelSections as w } from "../../store/SectionsStore.js";
|
|
6
|
+
import { useDevPanelUI as K, useDevPanelThemeActions as N } from "../../store/UIStore.js";
|
|
7
|
+
import { className as k } from "../../utils/className/className.js";
|
|
8
|
+
import { EmptyContent as x } from "../EmptyContent/index.js";
|
|
9
|
+
import { Icon as f } from "../Icon/index.js";
|
|
10
|
+
import { Section as E } from "../Section/index.js";
|
|
11
|
+
import '../../assets/index2.css';const j = "_devPanelContainer_11dce_217", A = "_header_11dce_256", S = "_title_11dce_271", H = "_button_11dce_283", I = "_collapsed_11dce_319", T = "_content_11dce_326", t = {
|
|
12
|
+
devPanelContainer: j,
|
|
13
|
+
header: A,
|
|
14
|
+
title: S,
|
|
15
|
+
button: H,
|
|
16
|
+
collapsed: I,
|
|
17
|
+
content: T
|
|
18
|
+
}, V = {
|
|
19
|
+
ctrlKey: !0,
|
|
20
|
+
shiftKey: !0,
|
|
21
|
+
key: "a",
|
|
22
|
+
altKey: !1,
|
|
23
|
+
metaKey: !1
|
|
24
|
+
};
|
|
25
|
+
function L({ panelTitle: h = "Dev panel", ...o }) {
|
|
26
|
+
const { isVisible: i, isCollapsed: n, position: l, setVisible: a, setCollapsed: u, setPosition: c } = K(), { setTheme: r } = N(), p = w(), _ = y(
|
|
27
|
+
(s) => {
|
|
28
|
+
c(s);
|
|
29
|
+
},
|
|
30
|
+
[c]
|
|
31
|
+
), { elementRef: v, handlePointerDown: C } = b({
|
|
32
|
+
onPositionChange: _
|
|
33
|
+
});
|
|
34
|
+
if (g({
|
|
35
|
+
description: "Show Dev Panel",
|
|
36
|
+
preventDefault: !0,
|
|
37
|
+
action: () => a(!i),
|
|
38
|
+
...V,
|
|
39
|
+
...o.hotKeyConfig,
|
|
40
|
+
target: window
|
|
41
|
+
}), D(() => {
|
|
42
|
+
o.theme && r(o.theme);
|
|
43
|
+
}, [o.theme, r]), !i)
|
|
44
|
+
return null;
|
|
45
|
+
const d = Object.entries(p);
|
|
46
|
+
return /* @__PURE__ */ m(
|
|
47
|
+
"div",
|
|
48
|
+
{
|
|
49
|
+
ref: v,
|
|
50
|
+
...k(t.devPanelContainer),
|
|
51
|
+
style: {
|
|
52
|
+
left: l.x,
|
|
53
|
+
top: l.y,
|
|
54
|
+
height: n ? "auto" : void 0
|
|
55
|
+
},
|
|
56
|
+
children: [
|
|
57
|
+
/* @__PURE__ */ m("div", { className: t.header, onPointerDown: C, children: [
|
|
58
|
+
/* @__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 }) }),
|
|
59
|
+
/* @__PURE__ */ e("div", { className: t.title, children: h }),
|
|
60
|
+
/* @__PURE__ */ e("button", { className: t.button, onClick: () => a(!1), title: "Close", children: /* @__PURE__ */ e(f, { name: "Close" }) })
|
|
61
|
+
] }),
|
|
62
|
+
!n && /* @__PURE__ */ e("div", { className: t.content, children: d.length ? d.map(([s, P]) => /* @__PURE__ */ e(E, { sectionName: s, section: P }, `section-${s}`)) : /* @__PURE__ */ e(x, {}) })
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
}
|
|
2
67
|
export {
|
|
3
|
-
|
|
68
|
+
L as DevPanel
|
|
4
69
|
};
|
|
@@ -24,22 +24,28 @@ export type BuiltInTheme =
|
|
|
24
24
|
| "volcano";
|
|
25
25
|
|
|
26
26
|
export interface DevPanelProps {
|
|
27
|
+
/**
|
|
28
|
+
* Title of the DevPanel, displayed at the top.
|
|
29
|
+
*/
|
|
27
30
|
panelTitle?: string;
|
|
28
31
|
/**
|
|
29
32
|
* Hotkey configuration for toggling the DevPanel visibility.
|
|
30
33
|
* If not provided, defaults to
|
|
31
34
|
* ```json
|
|
32
35
|
* {
|
|
33
|
-
* key: "f",
|
|
34
|
-
* shiftKey: true,
|
|
35
|
-
* altKey: true,
|
|
36
|
-
* ctrlKey: false,
|
|
37
|
-
* metaKey: false,
|
|
36
|
+
* "key": "f",
|
|
37
|
+
* "shiftKey": true,
|
|
38
|
+
* "altKey": true,
|
|
39
|
+
* "ctrlKey": false,
|
|
40
|
+
* "metaKey": false,
|
|
38
41
|
* }
|
|
39
42
|
* ```
|
|
40
43
|
*/
|
|
41
44
|
hotKeyConfig?: DevPanelHotkeyConfig;
|
|
42
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Theme for the DevPanel.
|
|
47
|
+
* If not provided, defaults to "auto"
|
|
48
|
+
*/
|
|
43
49
|
theme?: BuiltInTheme;
|
|
44
50
|
}
|
|
45
51
|
|
|
@@ -54,6 +60,7 @@ export interface DevPanelState {
|
|
|
54
60
|
isCollapsed: boolean;
|
|
55
61
|
sections: Record<string, DevPanelSection>;
|
|
56
62
|
position: Position;
|
|
63
|
+
currentTheme: string;
|
|
57
64
|
}
|
|
58
65
|
|
|
59
66
|
export type DevPanelUIState = Omit<DevPanelState, "sections">;
|
|
@@ -1 +1,9 @@
|
|
|
1
|
-
|
|
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;
|
|
@@ -1,4 +1,17 @@
|
|
|
1
|
-
import {
|
|
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
|
+
}
|
|
2
15
|
export {
|
|
3
|
-
|
|
16
|
+
v as DevPanelPortal
|
|
4
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
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
declare const availableIcons: {
|
|
2
|
-
ArrowDown: (props: React.SVGProps<SVGSVGElement>) =>
|
|
3
|
-
Close: (props: React.SVGProps<SVGSVGElement>) =>
|
|
4
|
-
Check: (props: React.SVGProps<SVGSVGElement>) =>
|
|
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
5
|
};
|
|
6
6
|
interface IconProps extends React.SVGProps<SVGSVGElement> {
|
|
7
7
|
/** The name of the icon to render */
|
|
@@ -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/index8.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
|
};
|