@berenjena/react-dev-panel 0.0.1-beta.1
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 +1 -0
- package/dist/assets/BooleanControl.css +1 -0
- package/dist/assets/ButtonControl.css +1 -0
- package/dist/assets/ColorControl.css +1 -0
- package/dist/assets/DevPanel.css +1 -0
- package/dist/assets/EmptyContent.css +1 -0
- package/dist/assets/NumberControl.css +1 -0
- package/dist/assets/Section.css +1 -0
- package/dist/assets/SelectControl.css +1 -0
- package/dist/assets/TextControl.css +1 -0
- package/dist/assets/index.css +1 -0
- package/dist/components/ControlRenderer/ControlRenderer.d.ts +6 -0
- package/dist/components/ControlRenderer/ControlRenderer.js +8 -0
- package/dist/components/ControlRenderer/controls/BooleanControl/BooleanControl.d.ts +16 -0
- package/dist/components/ControlRenderer/controls/BooleanControl/BooleanControl.js +24 -0
- package/dist/components/ControlRenderer/controls/BooleanControl/index.d.ts +1 -0
- package/dist/components/ControlRenderer/controls/BooleanControl/index.js +4 -0
- package/dist/components/ControlRenderer/controls/ButtonControl/ButtonControl.d.ts +16 -0
- package/dist/components/ControlRenderer/controls/ButtonControl/ButtonControl.js +10 -0
- package/dist/components/ControlRenderer/controls/ButtonControl/index.d.ts +1 -0
- package/dist/components/ControlRenderer/controls/ButtonControl/index.js +4 -0
- package/dist/components/ControlRenderer/controls/ColorControl/ColorControl.d.ts +16 -0
- package/dist/components/ControlRenderer/controls/ColorControl/ColorControl.js +19 -0
- package/dist/components/ControlRenderer/controls/ColorControl/index.d.ts +1 -0
- package/dist/components/ControlRenderer/controls/ColorControl/index.js +4 -0
- package/dist/components/ControlRenderer/controls/NumberControl/NumberControl.d.ts +16 -0
- package/dist/components/ControlRenderer/controls/NumberControl/NumberControl.js +22 -0
- package/dist/components/ControlRenderer/controls/NumberControl/index.d.ts +1 -0
- package/dist/components/ControlRenderer/controls/NumberControl/index.js +4 -0
- package/dist/components/ControlRenderer/controls/SelectControl/SelectControl.d.ts +15 -0
- package/dist/components/ControlRenderer/controls/SelectControl/SelectControl.js +13 -0
- package/dist/components/ControlRenderer/controls/SelectControl/index.d.ts +1 -0
- package/dist/components/ControlRenderer/controls/SelectControl/index.js +4 -0
- package/dist/components/ControlRenderer/controls/TextControl/TextControl.d.ts +17 -0
- package/dist/components/ControlRenderer/controls/TextControl/TextControl.js +20 -0
- package/dist/components/ControlRenderer/controls/TextControl/index.d.ts +1 -0
- package/dist/components/ControlRenderer/controls/TextControl/index.js +4 -0
- package/dist/components/ControlRenderer/controls/index.d.ts +13 -0
- package/dist/components/ControlRenderer/controls/index.js +37 -0
- package/dist/components/ControlRenderer/index.d.ts +1 -0
- package/dist/components/ControlRenderer/index.js +4 -0
- package/dist/components/DevPanel/DevPanel.d.ts +11 -0
- package/dist/components/DevPanel/DevPanel.js +74 -0
- package/dist/components/DevPanel/index.d.ts +1 -0
- package/dist/components/DevPanel/index.js +4 -0
- package/dist/components/EmptyContent/EmptyContent.d.ts +1 -0
- package/dist/components/EmptyContent/EmptyContent.js +18 -0
- package/dist/components/EmptyContent/index.d.ts +1 -0
- package/dist/components/EmptyContent/index.js +4 -0
- package/dist/components/Section/Section.d.ts +7 -0
- package/dist/components/Section/Section.js +23 -0
- package/dist/components/Section/index.d.ts +1 -0
- package/dist/components/Section/index.js +4 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +7 -0
- package/dist/components/logger.d.ts +5 -0
- package/dist/components/logger.js +7 -0
- package/dist/hooks/useDevPanel/index.d.ts +1 -0
- package/dist/hooks/useDevPanel/index.js +4 -0
- package/dist/hooks/useDevPanel/useDevPanel.d.ts +24 -0
- package/dist/hooks/useDevPanel/useDevPanel.js +15 -0
- package/dist/hooks/useDragAndDrop/index.d.ts +1 -0
- package/dist/hooks/useDragAndDrop/index.js +4 -0
- package/dist/hooks/useDragAndDrop/useDragAndDrop.d.ts +16 -0
- package/dist/hooks/useDragAndDrop/useDragAndDrop.js +55 -0
- package/dist/hooks/useHotkeys/example.d.ts +5 -0
- package/dist/hooks/useHotkeys/example.js +266 -0
- package/dist/hooks/useHotkeys/index.d.ts +2 -0
- package/dist/hooks/useHotkeys/index.js +6 -0
- package/dist/hooks/useHotkeys/useHotkey.d.ts +17 -0
- package/dist/hooks/useHotkeys/useHotkey.js +7 -0
- package/dist/hooks/useHotkeys/useHotkeys.d.ts +38 -0
- package/dist/hooks/useHotkeys/useHotkeys.js +31 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +7 -0
- package/dist/utils/className/className.d.ts +14 -0
- package/dist/utils/className/className.js +15 -0
- package/dist/utils/className/index.d.ts +1 -0
- package/dist/utils/className/index.js +4 -0
- package/dist/utils/createHotkey/createHotkey.d.ts +19 -0
- package/dist/utils/createHotkey/createHotkey.js +14 -0
- package/dist/utils/createHotkey/index.d.ts +1 -0
- package/dist/utils/createHotkey/index.js +4 -0
- package/dist/utils/debounce/debounce.d.ts +7 -0
- package/dist/utils/debounce/debounce.js +9 -0
- package/dist/utils/debounce/index.d.ts +1 -0
- package/dist/utils/debounce/index.js +4 -0
- package/dist/utils/formatHotkey/formatHotkey.d.ts +12 -0
- package/dist/utils/formatHotkey/formatHotkey.js +8 -0
- package/dist/utils/formatHotkey/index.d.ts +1 -0
- package/dist/utils/formatHotkey/index.js +4 -0
- package/dist/utils/getConstrainedPosition/getConstrainedPosition.d.ts +8 -0
- package/dist/utils/getConstrainedPosition/getConstrainedPosition.js +10 -0
- package/dist/utils/getConstrainedPosition/index.d.ts +1 -0
- package/dist/utils/getConstrainedPosition/index.js +4 -0
- package/dist/utils/getCurrentElementPosition/getCurrentElementPosition.d.ts +7 -0
- package/dist/utils/getCurrentElementPosition/getCurrentElementPosition.js +10 -0
- package/dist/utils/getCurrentElementPosition/index.d.ts +1 -0
- package/dist/utils/getCurrentElementPosition/index.js +4 -0
- package/dist/utils/getPositionAdjustment/getPositionAdjustment.d.ts +10 -0
- package/dist/utils/getPositionAdjustment/getPositionAdjustment.js +16 -0
- package/dist/utils/getPositionAdjustment/index.d.ts +1 -0
- package/dist/utils/getPositionAdjustment/index.js +4 -0
- package/dist/utils/hasControlChanged/hasControlChanged.d.ts +5 -0
- package/dist/utils/hasControlChanged/hasControlChanged.js +14 -0
- package/dist/utils/hasControlChanged/index.d.ts +1 -0
- package/dist/utils/hasControlChanged/index.js +4 -0
- package/dist/utils/index.d.ts +10 -0
- package/dist/utils/index.js +27 -0
- package/dist/utils/isMacOS/index.d.ts +1 -0
- package/dist/utils/isMacOS/index.js +4 -0
- package/dist/utils/isMacOS/isMacOS.d.ts +5 -0
- package/dist/utils/isMacOS/isMacOS.js +6 -0
- package/dist/utils/store/index.d.ts +1 -0
- package/dist/utils/store/index.js +9 -0
- package/dist/utils/store/store.d.ts +40 -0
- package/dist/utils/store/store.js +103 -0
- package/package.json +97 -0
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# React dev panel
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._checkboxLabel_1m9o5_1{display:inline-flex;align-items:center;cursor:pointer;position:relative}._checkbox_1m9o5_1{opacity:0;position:absolute;width:0;height:0}._checkboxCustom_1m9o5_15{width:18px;height:18px;border:2px solid #ddd;border-radius:3px;background-color:#fff;display:inline-block;position:relative;transition:all .2s ease}._checkboxCustom_1m9o5_15:after{content:"";position:absolute;display:none;left:4px;top:1px;width:6px;height:10px;border:solid white;border-width:0 2px 2px 0;transform:rotate(45deg)}._checkbox_1m9o5_1:checked+._checkboxCustom_1m9o5_15{background-color:#4caf50;border-color:#4caf50}._checkbox_1m9o5_1:checked+._checkboxCustom_1m9o5_15:after{display:block}._checkbox_1m9o5_1:disabled+._checkboxCustom_1m9o5_15{background-color:#f5f5f5;cursor:not-allowed}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._button_vlxsf_1{width:100%;padding:8px 16px;border:none;border-radius:4px;font-size:14px;font-weight:500;background-color:#4caf50;color:#fff;cursor:pointer;transition:background-color .2s ease}._button_vlxsf_1:hover:not(:disabled){background-color:#45a049}._button_vlxsf_1:active:not(:disabled){background-color:#3e8e41}._button_vlxsf_1:disabled{background-color:#ccc;cursor:not-allowed}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._colorInput_5ww2_1{width:100%;height:40px;border:1px solid #ddd;border-radius:4px;cursor:pointer;padding:0}._colorInput_5ww2_1:focus{outline:none;border-color:#4caf50;box-shadow:0 0 0 2px #4caf5033}._colorInput_5ww2_1:disabled{cursor:not-allowed;opacity:.6}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:root{--dev-panel-font-family: Helvetica, Arial, Sans-Serif;--dev-panel-primary-color: #0070f3;--dev-panel-secondary-color: #1c1c1c;--dev-panel-background-color: #f8f9fa;--dev-panel-border-color: #e9ecef;--dev-panel-text-color: #333;--dev-panel-shadow: 0 8px 24px rgba(0, 0, 0, .2);--dev-panel-max-width: 320px;--dev-panel-max-height: 80vh}@media (prefers-color-scheme: dark){:root{--dev-panel-background-color: #2a2a2a;--dev-panel-border-color: #555;--dev-panel-text-color: #e0e0e0;--dev-panel-shadow: 0 8px 24px rgba(0, 0, 0, .5)}}._devPanelContainer_k5g13_21{position:fixed;z-index:9998;border:1px solid #ccc;border-radius:8px;box-shadow:0 8px 24px #0003;width:var(--dev-panel-max-width);max-height:var(--dev-panel-max-height);overflow:hidden;-webkit-user-select:none;user-select:none;font-family:var(--dev-panel-font-family)}._header_k5g13_34{display:flex;align-items:center;justify-content:space-between;padding:4px;background:#1e2233;border-bottom:1px solid #e9ecef;cursor:move}._header_k5g13_34:hover{background:#e9ecef}._title_k5g13_47{font-size:12px;font-weight:600;color:#333;display:flex;align-items:center;gap:8px}._headerButton_k5g13_56{background:none;border:none;color:#666;font-size:12px;cursor:pointer;padding:4px 8px;border-radius:4px;transition:all .2s ease}._headerButton_k5g13_56:hover{background:#dee2e6;color:#333}._headerButton_k5g13_56:active{transform:scale(.95)}._content_k5g13_74{max-height:calc(80vh - 48px);overflow-y:auto}._actions_k5g13_79{display:flex;justify-content:center;padding-top:12px;margin-top:12px;border-top:1px solid #e9ecef}._actions_k5g13_79:last-child{border:none}._resetButton_k5g13_90{background:#dc3545;color:#fff;border:none;padding:6px 12px;border-radius:4px;font-size:12px;cursor:pointer;transition:background .2s ease}._resetButton_k5g13_90:hover{background:#c82333}._resetButton_k5g13_90:active{background:#bd2130}._content_k5g13_74::-webkit-scrollbar{width:6px}._content_k5g13_74::-webkit-scrollbar-track{background:#f1f1f1}._content_k5g13_74::-webkit-scrollbar-thumb{background:#c1c1c1;border-radius:3px}._content_k5g13_74::-webkit-scrollbar-thumb:hover{background:#a8a8a8}@media (prefers-color-scheme: dark){._devPanelContainer_k5g13_21{background:#2a2a2a;border-color:#555}._header_k5g13_34{background:#1e2233;border-color:#555}._header_k5g13_34:hover{background:#444}._title_k5g13_47{color:#e0e0e0}._headerButton_k5g13_56{color:#b0b0b0}._headerButton_k5g13_56:hover{background:#555;color:#e0e0e0}._actions_k5g13_79{border-color:#555}._resetButton_k5g13_90{background:#dc3545}._resetButton_k5g13_90:hover{background:#c82333}._content_k5g13_74::-webkit-scrollbar-track{background:#333}._content_k5g13_74::-webkit-scrollbar-thumb{background:#666}._content_k5g13_74::-webkit-scrollbar-thumb:hover{background:#777}}._dragging_k5g13_168{opacity:.9;cursor:grabbing!important;transition:opacity .2s ease}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._empty_1re8c_1{text-align:center;color:#888;font-size:12px;padding:30px 0}._empty_1re8c_1 code{background:#f8f9fa;padding:2px 4px;border-radius:3px;font-family:Monaco,Menlo,Ubuntu Mono,monospace}@media (prefers-color-scheme: dark){._empty_1re8c_1{color:#b0b0b0}._empty_1re8c_1 code{background:#333;color:#e0e0e0}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._numberInput_pm0en_1{width:100%;padding:8px 12px;border:1px solid #ddd;border-radius:4px;font-size:14px;background-color:#fff}._numberInput_pm0en_1:focus{outline:none;border-color:#4caf50;box-shadow:0 0 0 2px #4caf5033}._numberInput_pm0en_1:disabled{background-color:#f5f5f5;cursor:not-allowed}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._section_1av28_1{padding-top:6px;padding-left:10px;padding-right:10px;overflow:hidden}._section_1av28_1:last-child{margin-bottom:0}._section_1av28_1:not(:first-of-type){border-top:1px solid #222;margin-top:8px}._section_1av28_1:last-of-type{padding-bottom:6px}._section_1av28_1 ._header_1av28_17{display:flex;align-items:center;justify-content:space-between;cursor:pointer;transition:background .2s ease}._section_1av28_1 ._header_1av28_17 ._title_1av28_27{font-size:11px;font-weight:600;color:#333}._section_1av28_1 ._header_1av28_17 ._toggle_1av28_32{font-size:10px;color:#666;transition:transform .2s ease}._section_1av28_1 ._content_1av28_37{padding-left:10px;position:relative;display:grid;grid-template-columns:100%;row-gap:6px;transition:opacity .25s}._section_1av28_1 ._content_1av28_37:after{content:"";position:absolute;left:0;top:0;width:2px;height:100%;background-color:green;opacity:.4;transform:translate(-50%)}@media (prefers-color-scheme: dark){._section_1av28_1,._section_1av28_1 ._header_1av28_17{border-color:#555}._section_1av28_1 ._header_1av28_17 ._title_1av28_27{color:#e0e0e0}._section_1av28_1 ._toggle_1av28_32{color:#b0b0b0}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._select_1w3k9_1{background-color:#1e2233;border:none;color:#fff;padding:4px}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._textInput_w4cvv_1{width:100%;padding:8px 12px;border:1px solid #ddd;border-radius:4px;font-size:14px;background-color:#fff}._textInput_w4cvv_1:focus{outline:none;border-color:#4caf50;box-shadow:0 0 0 2px #4caf5033}._textInput_w4cvv_1:disabled{background-color:#f5f5f5;cursor:not-allowed}._textInput_w4cvv_1::placeholder{color:#999}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._controlContainer_xw58o_1{grid-template-columns:auto 160px;column-gap:7px;display:grid;align-items:center;height:100%;overflow:hidden}._label_xw58o_10{font-weight:500;font-size:12px;color:#333;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._description_xw58o_24{font-size:10px;font-weight:400;color:#666;opacity:.8}@media (prefers-color-scheme: dark){._label_xw58o_10{color:#e0e0e0}._description_xw58o_24{color:#b0b0b0}}
|
|
@@ -0,0 +1,6 @@
|
|
|
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>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BooleanControlProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Component that renders a boolean control
|
|
4
|
+
* @param control - The control to render
|
|
5
|
+
* @returns The boolean control component
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* <BooleanControl control={{
|
|
10
|
+
* type: 'boolean',
|
|
11
|
+
* value: true,
|
|
12
|
+
* onChange: (value) => setValue(value)
|
|
13
|
+
* }} />
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare function BooleanControl({ control }: BooleanControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsxs as b, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import '../../../../assets/BooleanControl.css';const a = "_checkboxLabel_1m9o5_1", h = "_checkbox_1m9o5_1", t = "_checkboxCustom_1m9o5_15", e = {
|
|
3
|
+
checkboxLabel: a,
|
|
4
|
+
checkbox: h,
|
|
5
|
+
checkboxCustom: t
|
|
6
|
+
};
|
|
7
|
+
function k({ control: c }) {
|
|
8
|
+
return /* @__PURE__ */ b("label", { className: e.checkboxLabel, children: [
|
|
9
|
+
/* @__PURE__ */ o(
|
|
10
|
+
"input",
|
|
11
|
+
{
|
|
12
|
+
type: "checkbox",
|
|
13
|
+
checked: c.value,
|
|
14
|
+
disabled: c.disabled,
|
|
15
|
+
onChange: (s) => c.onChange(s.target.checked),
|
|
16
|
+
className: e.checkbox
|
|
17
|
+
}
|
|
18
|
+
),
|
|
19
|
+
/* @__PURE__ */ o("span", { className: e.checkboxCustom })
|
|
20
|
+
] });
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
k as BooleanControl
|
|
24
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './BooleanControl';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ButtonControlProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Component that renders a button control
|
|
4
|
+
* @param control - The control to render
|
|
5
|
+
* @returns The button control component
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* <ButtonControl control={{
|
|
10
|
+
* type: 'button',
|
|
11
|
+
* label: 'Click me',
|
|
12
|
+
* onClick: () => console.log('Button clicked')
|
|
13
|
+
* }} />
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare function ButtonControl({ control }: ButtonControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import '../../../../assets/ButtonControl.css';const o = "_button_vlxsf_1", s = {
|
|
3
|
+
button: o
|
|
4
|
+
};
|
|
5
|
+
function b({ control: t }) {
|
|
6
|
+
return /* @__PURE__ */ n("button", { onClick: t.onClick, disabled: t.disabled, className: s.button, children: t.label });
|
|
7
|
+
}
|
|
8
|
+
export {
|
|
9
|
+
b as ButtonControl
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ButtonControl';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ColorControlProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Component that renders a color control
|
|
4
|
+
* @param control - The control to render
|
|
5
|
+
* @returns The color control component
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* <ColorControl control={{
|
|
10
|
+
* type: 'color',
|
|
11
|
+
* value: '#000000',
|
|
12
|
+
* onChange: (value) => setValue(value)
|
|
13
|
+
* }} />
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare function ColorControl({ control }: ColorControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import '../../../../assets/ColorControl.css';const n = "_colorInput_5ww2_1", l = {
|
|
3
|
+
colorInput: n
|
|
4
|
+
};
|
|
5
|
+
function a({ control: o }) {
|
|
6
|
+
return /* @__PURE__ */ e(
|
|
7
|
+
"input",
|
|
8
|
+
{
|
|
9
|
+
type: "color",
|
|
10
|
+
value: o.value,
|
|
11
|
+
disabled: o.disabled,
|
|
12
|
+
onChange: (t) => o.onChange(t.target.value),
|
|
13
|
+
className: l.colorInput
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
a as ColorControl
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ColorControl';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { NumberControlProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Component that renders a number control
|
|
4
|
+
* @param control - The control to render
|
|
5
|
+
* @returns The number control component
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* <NumberControl control={{
|
|
10
|
+
* type: 'number',
|
|
11
|
+
* value: 10,
|
|
12
|
+
* onChange: (value) => setValue(value)
|
|
13
|
+
* }} />
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare function NumberControl({ control }: NumberControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
2
|
+
import '../../../../assets/NumberControl.css';const m = "_numberInput_pm0en_1", t = {
|
|
3
|
+
numberInput: m
|
|
4
|
+
};
|
|
5
|
+
function p({ control: e }) {
|
|
6
|
+
return /* @__PURE__ */ u(
|
|
7
|
+
"input",
|
|
8
|
+
{
|
|
9
|
+
type: "number",
|
|
10
|
+
value: e.value,
|
|
11
|
+
min: e.min,
|
|
12
|
+
max: e.max,
|
|
13
|
+
step: e.step,
|
|
14
|
+
disabled: e.disabled,
|
|
15
|
+
onChange: (n) => e.onChange(Number(n.target.value)),
|
|
16
|
+
className: t.numberInput
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
p as NumberControl
|
|
22
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './NumberControl';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SelectControlProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Component that renders a select control
|
|
4
|
+
* @param control - The control to render
|
|
5
|
+
* @returns The select control component
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* <SelectControl control={{
|
|
10
|
+
* type: 'select',
|
|
11
|
+
* value: 'option1',
|
|
12
|
+
* options: ['option1', 'option2', 'option3'],
|
|
13
|
+
* }} />
|
|
14
|
+
*/
|
|
15
|
+
export declare function SelectControl({ control }: SelectControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import '../../../../assets/SelectControl.css';const n = "_select_1w3k9_1", c = {
|
|
3
|
+
select: n
|
|
4
|
+
};
|
|
5
|
+
function u({ control: l }) {
|
|
6
|
+
return /* @__PURE__ */ t("select", { value: l.value, disabled: l.disabled, onChange: (e) => l.onChange(e.target.value), className: c.select, children: l.options.map((e) => {
|
|
7
|
+
const s = typeof e == "string" ? e : e.value, a = typeof e == "string" ? e : e.label;
|
|
8
|
+
return /* @__PURE__ */ t("option", { value: s, children: a }, s);
|
|
9
|
+
}) });
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
u as SelectControl
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './SelectControl';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { TextControlProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Component that renders a text control
|
|
4
|
+
* @param control - The control to render
|
|
5
|
+
* @returns The text control component
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* <TextControl control={{
|
|
10
|
+
* type: 'text',
|
|
11
|
+
* value: 'Hello',
|
|
12
|
+
* placeholder: 'Enter your name',
|
|
13
|
+
* onChange: (value) => setValue(value)
|
|
14
|
+
* }} />
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare function TextControl({ control }: TextControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import '../../../../assets/TextControl.css';const n = "_textInput_w4cvv_1", p = {
|
|
3
|
+
textInput: n
|
|
4
|
+
};
|
|
5
|
+
function l({ control: t }) {
|
|
6
|
+
return /* @__PURE__ */ a(
|
|
7
|
+
"input",
|
|
8
|
+
{
|
|
9
|
+
type: "text",
|
|
10
|
+
value: t.value,
|
|
11
|
+
placeholder: t.placeholder,
|
|
12
|
+
disabled: t.disabled,
|
|
13
|
+
onChange: (e) => t.onChange(e.target.value),
|
|
14
|
+
className: p.textInput
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
l as TextControl
|
|
20
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './TextControl';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exports all control components as a frozen object.
|
|
3
|
+
* **Note:** This allows components to be loaded lazily.
|
|
4
|
+
*/
|
|
5
|
+
export declare const controls: Readonly<{
|
|
6
|
+
boolean: import('react').LazyExoticComponent<typeof import('./BooleanControl').BooleanControl>;
|
|
7
|
+
button: import('react').LazyExoticComponent<typeof import('./ButtonControl').ButtonControl>;
|
|
8
|
+
color: import('react').LazyExoticComponent<typeof import('./ColorControl').ColorControl>;
|
|
9
|
+
number: import('react').LazyExoticComponent<typeof import('./NumberControl').NumberControl>;
|
|
10
|
+
select: import('react').LazyExoticComponent<typeof import('./SelectControl').SelectControl>;
|
|
11
|
+
text: import('react').LazyExoticComponent<typeof import('./TextControl').TextControl>;
|
|
12
|
+
}>;
|
|
13
|
+
export { ControlRenderer } from '..';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Suspense as c, lazy as o } from "react";
|
|
2
|
+
import { jsxs as i, jsx as n } from "react/jsx-runtime";
|
|
3
|
+
import { className as d } from "../../../utils/className/className.js";
|
|
4
|
+
import "../../../utils/store/store.js";
|
|
5
|
+
import '../../../assets/index.css';const p = "_controlContainer_xw58o_1", m = "_label_xw58o_10", u = "_description_xw58o_24", r = {
|
|
6
|
+
controlContainer: p,
|
|
7
|
+
label: m,
|
|
8
|
+
description: u
|
|
9
|
+
};
|
|
10
|
+
function x({ name: e, control: t }) {
|
|
11
|
+
const s = t?.label || e;
|
|
12
|
+
function a() {
|
|
13
|
+
if (!t || !t.type)
|
|
14
|
+
return /* @__PURE__ */ n("div", { className: r.error, children: "Control type is not defined" });
|
|
15
|
+
const l = f[t.type];
|
|
16
|
+
return l ? /* @__PURE__ */ n(c, { fallback: /* @__PURE__ */ n("div", { children: "Loading control..." }), children: /* @__PURE__ */ n(l, { control: t }) }) : /* @__PURE__ */ n("div", { children: "Unknown control type" });
|
|
17
|
+
}
|
|
18
|
+
return /* @__PURE__ */ i("div", { ...d(r.controlContainer), children: [
|
|
19
|
+
t?.type !== "button" && /* @__PURE__ */ i("label", { className: r.label, children: [
|
|
20
|
+
s,
|
|
21
|
+
t?.description && /* @__PURE__ */ n("span", { className: r.description, children: t.description })
|
|
22
|
+
] }),
|
|
23
|
+
a()
|
|
24
|
+
] });
|
|
25
|
+
}
|
|
26
|
+
const f = Object.freeze({
|
|
27
|
+
boolean: o(() => import("./BooleanControl/index.js").then((e) => ({ default: e.BooleanControl }))),
|
|
28
|
+
button: o(() => import("./ButtonControl/index.js").then((e) => ({ default: e.ButtonControl }))),
|
|
29
|
+
color: o(() => import("./ColorControl/index.js").then((e) => ({ default: e.ColorControl }))),
|
|
30
|
+
number: o(() => import("./NumberControl/index.js").then((e) => ({ default: e.NumberControl }))),
|
|
31
|
+
select: o(() => import("./SelectControl/index.js").then((e) => ({ default: e.SelectControl }))),
|
|
32
|
+
text: o(() => import("./TextControl/index.js").then((e) => ({ default: e.TextControl })))
|
|
33
|
+
});
|
|
34
|
+
export {
|
|
35
|
+
x as ControlRenderer,
|
|
36
|
+
f as controls
|
|
37
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ControlRenderer';
|
|
@@ -0,0 +1,11 @@
|
|
|
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): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { jsxs as r, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback as v } from "react";
|
|
3
|
+
import { useDragAndDrop as _ } from "../../hooks/useDragAndDrop/useDragAndDrop.js";
|
|
4
|
+
import { useHotkey as C } from "../../hooks/useHotkeys/useHotkey.js";
|
|
5
|
+
import { className as D } from "../../utils/className/className.js";
|
|
6
|
+
import { useDevPanelVisible as P, useDevPanelCollapsed as y, useDevPanelPosition as k, useDevPanelSections as b, useDevPanelActions as N } 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 B = "_devPanelContainer_k5g13_21", E = "_header_k5g13_34", V = "_title_k5g13_47", j = "_headerButton_k5g13_56", w = "_content_k5g13_74", S = "_dragging_k5g13_168", e = {
|
|
10
|
+
devPanelContainer: B,
|
|
11
|
+
header: E,
|
|
12
|
+
title: V,
|
|
13
|
+
headerButton: j,
|
|
14
|
+
content: w,
|
|
15
|
+
dragging: S
|
|
16
|
+
}, A = {
|
|
17
|
+
key: "f",
|
|
18
|
+
shiftKey: !0,
|
|
19
|
+
altKey: !0,
|
|
20
|
+
ctrlKey: !1,
|
|
21
|
+
metaKey: !1
|
|
22
|
+
};
|
|
23
|
+
function G({ panelTitle: c = "Dev panel", ...d }) {
|
|
24
|
+
const i = P(), n = y(), a = k(), g = b(), o = N(), u = v(
|
|
25
|
+
(s) => {
|
|
26
|
+
o.setPosition(s);
|
|
27
|
+
},
|
|
28
|
+
[o]
|
|
29
|
+
), { isDragging: m, elementRef: h, handleMouseDown: p } = _({
|
|
30
|
+
onPositionChange: u
|
|
31
|
+
});
|
|
32
|
+
if (C({
|
|
33
|
+
description: "Show Dev Panel",
|
|
34
|
+
preventDefault: !0,
|
|
35
|
+
action: () => o.setVisible(!i),
|
|
36
|
+
...A,
|
|
37
|
+
...d.hotKeyConfig
|
|
38
|
+
}), process.env.NODE_ENV !== "development" || !i)
|
|
39
|
+
return null;
|
|
40
|
+
const l = Object.entries(g);
|
|
41
|
+
return /* @__PURE__ */ r(
|
|
42
|
+
"div",
|
|
43
|
+
{
|
|
44
|
+
ref: h,
|
|
45
|
+
...D(e.devPanelContainer, {
|
|
46
|
+
[e.dragging]: m
|
|
47
|
+
}),
|
|
48
|
+
style: {
|
|
49
|
+
left: a.x,
|
|
50
|
+
top: a.y,
|
|
51
|
+
height: n ? "auto" : void 0
|
|
52
|
+
},
|
|
53
|
+
children: [
|
|
54
|
+
/* @__PURE__ */ r("div", { className: e.header, onMouseDown: p, children: [
|
|
55
|
+
/* @__PURE__ */ t(
|
|
56
|
+
"button",
|
|
57
|
+
{
|
|
58
|
+
className: e.headerButton,
|
|
59
|
+
onClick: () => o.setCollapsed(!n),
|
|
60
|
+
title: n ? "Expand" : "Collapse",
|
|
61
|
+
children: n ? "▼" : "▲"
|
|
62
|
+
}
|
|
63
|
+
),
|
|
64
|
+
/* @__PURE__ */ t("div", { className: e.title, children: c }),
|
|
65
|
+
/* @__PURE__ */ t("button", { className: e.headerButton, onClick: () => o.setVisible(!1), title: "Close", children: "✕" })
|
|
66
|
+
] }),
|
|
67
|
+
!n && /* @__PURE__ */ t("div", { className: e.content, children: l.length ? l.map(([s, f]) => /* @__PURE__ */ t(x, { sectionName: s, section: f }, `section-${s}`)) : /* @__PURE__ */ t(K, {}) })
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
export {
|
|
73
|
+
G as DevPanel
|
|
74
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './DevPanel';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function EmptyContent(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsxs as t, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import '../../assets/EmptyContent.css';const o = "_empty_1re8c_1", r = {
|
|
3
|
+
empty: o
|
|
4
|
+
};
|
|
5
|
+
function n() {
|
|
6
|
+
return /* @__PURE__ */ t("div", { className: r.empty, children: [
|
|
7
|
+
"No controls registered yet.",
|
|
8
|
+
/* @__PURE__ */ e("br", {}),
|
|
9
|
+
" ",
|
|
10
|
+
/* @__PURE__ */ e("br", {}),
|
|
11
|
+
"Use ",
|
|
12
|
+
/* @__PURE__ */ e("code", { children: "useDevPanel()" }),
|
|
13
|
+
" to add controls."
|
|
14
|
+
] });
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
n as EmptyContent
|
|
18
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './EmptyContent';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsxs as s, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { ControlRenderer as i } from "../ControlRenderer/controls/index.js";
|
|
3
|
+
import { useDevPanelActions as r } from "../../utils/store/store.js";
|
|
4
|
+
import '../../assets/Section.css';const d = "_section_1av28_1", _ = "_header_1av28_17", m = "_title_1av28_27", g = "_toggle_1av28_32", p = "_content_1av28_37", e = {
|
|
5
|
+
section: d,
|
|
6
|
+
header: _,
|
|
7
|
+
title: m,
|
|
8
|
+
toggle: g,
|
|
9
|
+
content: p
|
|
10
|
+
};
|
|
11
|
+
function f({ sectionName: c, section: t }) {
|
|
12
|
+
const l = r();
|
|
13
|
+
return /* @__PURE__ */ s("div", { className: e.section, children: [
|
|
14
|
+
/* @__PURE__ */ s("div", { className: e.header, onClick: () => l.toggleSectionCollapse(c), children: [
|
|
15
|
+
/* @__PURE__ */ n("span", { className: e.title, children: t.name }),
|
|
16
|
+
/* @__PURE__ */ n("span", { className: e.toggle, children: t.isCollapsed ? "▶" : "▼" })
|
|
17
|
+
] }),
|
|
18
|
+
!t.isCollapsed && /* @__PURE__ */ n("div", { className: e.content, children: Object.entries(t.controls).map(([o, a]) => /* @__PURE__ */ n(i, { name: o, control: a }, o)) })
|
|
19
|
+
] });
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
f as Section
|
|
23
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Section';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useDevPanel';
|