@berenjena/react-dev-panel 1.0.4 → 2.1.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.
Files changed (139) hide show
  1. package/README.md +75 -52
  2. package/dist/assets/index.css +1 -1
  3. package/dist/assets/index10.css +1 -0
  4. package/dist/assets/index11.css +1 -0
  5. package/dist/assets/index12.css +1 -0
  6. package/dist/assets/index13.css +1 -0
  7. package/dist/assets/index2.css +1 -1
  8. package/dist/assets/index3.css +1 -0
  9. package/dist/assets/index4.css +1 -0
  10. package/dist/assets/index5.css +1 -0
  11. package/dist/assets/index6.css +1 -0
  12. package/dist/assets/index7.css +1 -0
  13. package/dist/assets/index8.css +1 -0
  14. package/dist/assets/index9.css +1 -0
  15. package/dist/components/ControlRenderer/controls/BooleanControl/index.d.ts +32 -1
  16. package/dist/components/ControlRenderer/controls/BooleanControl/index.js +24 -2
  17. package/dist/components/ControlRenderer/controls/ButtonControl/index.d.ts +33 -1
  18. package/dist/components/ControlRenderer/controls/ButtonControl/index.js +8 -2
  19. package/dist/components/ControlRenderer/controls/ButtonGroupControl/index.d.ts +37 -1
  20. package/dist/components/ControlRenderer/controls/ButtonGroupControl/index.js +20 -2
  21. package/dist/components/ControlRenderer/controls/ColorControl/index.d.ts +23 -1
  22. package/dist/components/ControlRenderer/controls/ColorControl/index.js +67 -2
  23. package/dist/components/ControlRenderer/controls/ColorControl/types.d.ts +14 -0
  24. package/dist/components/ControlRenderer/controls/DateControl/index.d.ts +41 -1
  25. package/dist/components/ControlRenderer/controls/DateControl/index.js +29 -2
  26. package/dist/components/ControlRenderer/controls/MultiSelectControl/index.d.ts +28 -0
  27. package/dist/components/ControlRenderer/controls/MultiSelectControl/index.js +18 -0
  28. package/dist/components/ControlRenderer/controls/MultiSelectControl/types.d.ts +11 -0
  29. package/dist/components/ControlRenderer/controls/NumberControl/index.d.ts +45 -1
  30. package/dist/components/ControlRenderer/controls/NumberControl/index.js +30 -2
  31. package/dist/components/ControlRenderer/controls/RangeControl/index.d.ts +46 -1
  32. package/dist/components/ControlRenderer/controls/RangeControl/index.js +38 -2
  33. package/dist/components/ControlRenderer/controls/SelectControl/index.d.ts +39 -1
  34. package/dist/components/ControlRenderer/controls/SelectControl/index.js +6 -2
  35. package/dist/components/ControlRenderer/controls/SeparatorControl/index.d.ts +39 -1
  36. package/dist/components/ControlRenderer/controls/SeparatorControl/index.js +12 -2
  37. package/dist/components/ControlRenderer/controls/TextControl/index.d.ts +40 -1
  38. package/dist/components/ControlRenderer/controls/TextControl/index.js +28 -2
  39. package/dist/components/ControlRenderer/controls/index.d.ts +2 -0
  40. package/dist/components/ControlRenderer/controls/index.js +1 -0
  41. package/dist/components/ControlRenderer/controls/types.d.ts +2 -0
  42. package/dist/components/ControlRenderer/index.d.ts +6 -1
  43. package/dist/components/ControlRenderer/index.js +50 -2
  44. package/dist/components/DevPanel/index.d.ts +11 -1
  45. package/dist/components/DevPanel/index.js +69 -2
  46. package/dist/components/DevPanel/types.d.ts +36 -5
  47. package/dist/components/DevPanelPortal/index.d.ts +9 -0
  48. package/dist/components/DevPanelPortal/index.js +17 -0
  49. package/dist/components/EmptyContent/index.d.ts +1 -1
  50. package/dist/components/EmptyContent/index.js +17 -2
  51. package/dist/components/Icon/index.d.ts +16 -0
  52. package/dist/components/Icon/index.js +31 -0
  53. package/dist/components/Input/index.d.ts +1 -1
  54. package/dist/components/Input/index.js +8 -2
  55. package/dist/components/Section/index.d.ts +7 -1
  56. package/dist/components/Section/index.js +23 -2
  57. package/dist/components/Select/index.d.ts +15 -1
  58. package/dist/components/Select/index.js +176 -2
  59. package/dist/components/index.d.ts +3 -2
  60. package/dist/components/index.js +8 -6
  61. package/dist/hooks/useDebounceCallback/index.d.ts +8 -1
  62. package/dist/hooks/useDebounceCallback/index.js +15 -2
  63. package/dist/hooks/useDevPanel/index.d.ts +29 -1
  64. package/dist/hooks/useDevPanel/index.js +22 -2
  65. package/dist/hooks/useDragAndDrop/index.d.ts +20 -1
  66. package/dist/hooks/useDragAndDrop/index.js +53 -2
  67. package/dist/hooks/{useHotkeys/useHotkey.d.ts → useHotKey/index.d.ts} +1 -1
  68. package/dist/hooks/{useHotkeys/useHotkey.js → useHotKey/index.js} +1 -1
  69. package/dist/hooks/useHotkeys/index.d.ts +37 -2
  70. package/dist/hooks/useHotkeys/index.js +29 -4
  71. package/dist/index.d.ts +0 -1
  72. package/dist/index.js +2 -8
  73. package/dist/managers/DevPanelManager.d.ts +85 -0
  74. package/dist/managers/DevPanelManager.js +119 -0
  75. package/dist/store/SectionsStore.js +112 -5
  76. package/dist/store/UIStore.d.ts +78 -2
  77. package/dist/store/UIStore.js +176 -9
  78. package/dist/utils/getPositionAdjustment/getPositionAdjustment.d.ts +3 -2
  79. package/dist/utils/getPositionAdjustment/getPositionAdjustment.js +1 -4
  80. package/package.json +53 -30
  81. package/dist/UIStore-CQdr4U-2.js +0 -227
  82. package/dist/assets/BooleanControl.css +0 -1
  83. package/dist/assets/ButtonControl.css +0 -1
  84. package/dist/assets/ButtonGroupControl.css +0 -1
  85. package/dist/assets/ColorControl.css +0 -1
  86. package/dist/assets/ControlRenderer.css +0 -1
  87. package/dist/assets/DevPanel.css +0 -1
  88. package/dist/assets/EmptyContent.css +0 -1
  89. package/dist/assets/Input.css +0 -1
  90. package/dist/assets/RangeControl.css +0 -1
  91. package/dist/assets/Section.css +0 -1
  92. package/dist/assets/Select.css +0 -1
  93. package/dist/assets/SeparatorControl.css +0 -1
  94. package/dist/components/ControlRenderer/ControlRenderer.d.ts +0 -6
  95. package/dist/components/ControlRenderer/ControlRenderer.js +0 -32
  96. package/dist/components/ControlRenderer/controls/BooleanControl/BooleanControl.d.ts +0 -16
  97. package/dist/components/ControlRenderer/controls/BooleanControl/BooleanControl.js +0 -24
  98. package/dist/components/ControlRenderer/controls/ButtonControl/ButtonControl.d.ts +0 -16
  99. package/dist/components/ControlRenderer/controls/ButtonControl/ButtonControl.js +0 -10
  100. package/dist/components/ControlRenderer/controls/ButtonGroupControl/ButtonGroupControl.d.ts +0 -2
  101. package/dist/components/ControlRenderer/controls/ButtonGroupControl/ButtonGroupControl.js +0 -22
  102. package/dist/components/ControlRenderer/controls/ColorControl/ColorControl.d.ts +0 -16
  103. package/dist/components/ControlRenderer/controls/ColorControl/ColorControl.js +0 -27
  104. package/dist/components/ControlRenderer/controls/DateControl/DateControl.d.ts +0 -29
  105. package/dist/components/ControlRenderer/controls/DateControl/DateControl.js +0 -31
  106. package/dist/components/ControlRenderer/controls/NumberControl/NumberControl.d.ts +0 -30
  107. package/dist/components/ControlRenderer/controls/NumberControl/NumberControl.js +0 -32
  108. package/dist/components/ControlRenderer/controls/RangeControl/RangeControl.d.ts +0 -30
  109. package/dist/components/ControlRenderer/controls/RangeControl/RangeControl.js +0 -40
  110. package/dist/components/ControlRenderer/controls/SelectControl/SelectControl.d.ts +0 -15
  111. package/dist/components/ControlRenderer/controls/SelectControl/SelectControl.js +0 -11
  112. package/dist/components/ControlRenderer/controls/SeparatorControl/SeparatorControl.d.ts +0 -30
  113. package/dist/components/ControlRenderer/controls/SeparatorControl/SeparatorControl.js +0 -14
  114. package/dist/components/ControlRenderer/controls/TextControl/TextControl.d.ts +0 -29
  115. package/dist/components/ControlRenderer/controls/TextControl/TextControl.js +0 -30
  116. package/dist/components/DevPanel/DevPanel.d.ts +0 -11
  117. package/dist/components/DevPanel/DevPanel.js +0 -67
  118. package/dist/components/EmptyContent/EmptyContent.d.ts +0 -1
  119. package/dist/components/EmptyContent/EmptyContent.js +0 -18
  120. package/dist/components/Input/Input.d.ts +0 -1
  121. package/dist/components/Input/Input.js +0 -10
  122. package/dist/components/Logger/index.d.ts +0 -20
  123. package/dist/components/Logger/index.js +0 -85
  124. package/dist/components/Section/Section.d.ts +0 -7
  125. package/dist/components/Section/Section.js +0 -24
  126. package/dist/components/Select/Select.d.ts +0 -1
  127. package/dist/components/Select/Select.js +0 -10
  128. package/dist/hooks/useDebounceCallback/useDebounceCallback.d.ts +0 -8
  129. package/dist/hooks/useDebounceCallback/useDebounceCallback.js +0 -17
  130. package/dist/hooks/useDevPanel/useDevPanel.d.ts +0 -24
  131. package/dist/hooks/useDevPanel/useDevPanel.js +0 -15
  132. package/dist/hooks/useDragAndDrop/useDragAndDrop.d.ts +0 -16
  133. package/dist/hooks/useDragAndDrop/useDragAndDrop.js +0 -55
  134. package/dist/hooks/useHotkeys/useHotkeys.d.ts +0 -37
  135. package/dist/hooks/useHotkeys/useHotkeys.js +0 -31
  136. package/dist/store/index.d.ts +0 -3
  137. package/dist/store/index.js +0 -13
  138. package/dist/utils/index.d.ts +0 -9
  139. package/dist/utils/index.js +0 -20
@@ -1,67 +0,0 @@
1
- import { jsxs as c, jsx as e } from "react/jsx-runtime";
2
- import { useCallback as C } from "react";
3
- import { useDragAndDrop as w } from "../../hooks/useDragAndDrop/useDragAndDrop.js";
4
- import { useHotkey as b } from "../../hooks/useHotkeys/useHotkey.js";
5
- import { b as y, u as D } from "../../UIStore-CQdr4U-2.js";
6
- import { className as P } from "../../utils/className/className.js";
7
- import { EmptyContent as x } from "../EmptyContent/EmptyContent.js";
8
- import { Section as K } from "../Section/Section.js";
9
- import '../../assets/DevPanel.css';const N = "_devPanelContainer_1vath_1", k = "_header_1vath_12", A = "_title_1vath_21", j = "_button_1vath_31", E = "_collapsed_1vath_53", H = "_content_1vath_60", t = {
10
- devPanelContainer: N,
11
- header: k,
12
- title: A,
13
- button: j,
14
- collapsed: E,
15
- content: H
16
- }, M = {
17
- ctrlKey: !0,
18
- shiftKey: !0,
19
- key: "a",
20
- altKey: !1,
21
- metaKey: !1
22
- };
23
- function U({ panelTitle: d = "Dev panel", ...h }) {
24
- const { isVisible: s, isCollapsed: n, position: l, setVisible: a, setCollapsed: m, setPosition: i } = y(), p = D(), v = C(
25
- (o) => {
26
- i(o);
27
- },
28
- [i]
29
- ), { isDragging: u, elementRef: f, handleMouseDown: g } = w({
30
- onPositionChange: v
31
- });
32
- if (b({
33
- description: "Show Dev Panel",
34
- preventDefault: !0,
35
- action: () => a(!s),
36
- ...M,
37
- ...h.hotKeyConfig,
38
- target: window
39
- }), !s)
40
- return null;
41
- const r = Object.entries(p);
42
- return /* @__PURE__ */ c(
43
- "div",
44
- {
45
- ref: f,
46
- ...P(t.devPanelContainer, {
47
- [t.dragging]: u
48
- }),
49
- style: {
50
- left: l.x,
51
- top: l.y,
52
- height: n ? "auto" : void 0
53
- },
54
- children: [
55
- /* @__PURE__ */ c("div", { className: t.header, onMouseDown: g, children: [
56
- /* @__PURE__ */ e("button", { className: t.button, onClick: () => m(!n), title: n ? "Expand" : "Collapse", children: /* @__PURE__ */ e("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", className: n ? 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: d }),
58
- /* @__PURE__ */ e("button", { className: t.button, onClick: () => a(!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" }) }) })
59
- ] }),
60
- !n && /* @__PURE__ */ e("div", { className: t.content, children: r.length ? r.map(([o, _]) => /* @__PURE__ */ e(K, { sectionName: o, section: _ }, `section-${o}`)) : /* @__PURE__ */ e(x, {}) })
61
- ]
62
- }
63
- );
64
- }
65
- export {
66
- U as DevPanel
67
- };
@@ -1 +0,0 @@
1
- export declare function EmptyContent(): import("react/jsx-runtime").JSX.Element;
@@ -1,18 +0,0 @@
1
- import { jsxs as t, jsx as e } from "react/jsx-runtime";
2
- import '../../assets/EmptyContent.css';const o = "_empty_1xo8g_1", s = {
3
- empty: o
4
- };
5
- function n() {
6
- return /* @__PURE__ */ t("div", { className: s.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
- };
@@ -1 +0,0 @@
1
- export declare function Input(props: React.InputHTMLAttributes<HTMLInputElement>): import("react/jsx-runtime").JSX.Element;
@@ -1,10 +0,0 @@
1
- import { jsx as n } from "react/jsx-runtime";
2
- import '../../assets/Input.css';const p = "_input_161wd_1", u = {
3
- input: p
4
- };
5
- function s(t) {
6
- return /* @__PURE__ */ n("input", { ...t, className: u.input });
7
- }
8
- export {
9
- s as Input
10
- };
@@ -1,20 +0,0 @@
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 {};
@@ -1,85 +0,0 @@
1
- import { jsxs as r, jsx as e } from "react/jsx-runtime";
2
- import { useState as l, useRef as D, useEffect as h } from "react";
3
- import { className as I } from "../../utils/className/className.js";
4
- import '../../assets/index2.css';const O = "_logger_t8a3p_1", L = "_dark_t8a3p_17", S = "_collapsed_t8a3p_22", J = "_header_t8a3p_27", $ = "_title_t8a3p_49", A = "_controls_t8a3p_62", z = "_toggleButton_t8a3p_68", H = "_closeButton_t8a3p_104", M = "_content_t8a3p_129", R = "_jsonDisplay_t8a3p_139", T = "_empty_t8a3p_152", U = "_badge_t8a3p_162", V = "_updated_t8a3p_175", t = {
5
- logger: O,
6
- dark: L,
7
- collapsed: S,
8
- header: J,
9
- title: $,
10
- controls: A,
11
- toggleButton: z,
12
- closeButton: H,
13
- content: M,
14
- jsonDisplay: R,
15
- empty: T,
16
- badge: U,
17
- updated: V
18
- };
19
- function F({ items: s, title: m = "Logger", theme: c = "auto", defaultCollapsed: f = !0, defaultVisible: y = !0, onClose: p }) {
20
- const [a, v] = l(f), [N, b] = l(y), [C, d] = l(!1), [k, g] = l(!1), [u, w] = l(0), i = D("");
21
- function _() {
22
- v(!a);
23
- }
24
- function B() {
25
- b(!1), p?.();
26
- }
27
- function x(o) {
28
- try {
29
- return JSON.stringify(o, null, 2);
30
- } catch (n) {
31
- return `Error formatting JSON: ${n}`;
32
- }
33
- }
34
- if (h(() => {
35
- if (c === "auto") {
36
- const o = window.matchMedia("(prefers-color-scheme: dark)");
37
- d(o.matches);
38
- const n = (E) => d(E.matches);
39
- return o.addEventListener("change", n), () => o.removeEventListener("change", n);
40
- } else
41
- d(c === "dark");
42
- }, [c]), h(() => {
43
- const o = JSON.stringify(s), n = Object.keys(s).length;
44
- i.current && i.current !== o && (g(!0), setTimeout(() => g(!1), 600)), w(n), i.current = o;
45
- }, [s]), !N) return null;
46
- const j = !s || Object.keys(s).length === 0;
47
- return /* @__PURE__ */ r("div", { className: `${t.logger} ${C ? t.dark : ""} ${a ? t.collapsed : ""}`, children: [
48
- /* @__PURE__ */ r("div", { className: t.header, onClick: _, children: [
49
- /* @__PURE__ */ r("h3", { className: t.title, children: [
50
- m,
51
- u > 0 && /* @__PURE__ */ e("span", { ...I(t.badge, { [t.updated]: k }), children: u })
52
- ] }),
53
- /* @__PURE__ */ r("div", { className: t.controls, children: [
54
- /* @__PURE__ */ e(
55
- "button",
56
- {
57
- className: t.toggleButton,
58
- onClick: _,
59
- type: "button",
60
- "aria-label": a ? "Expand logger" : "Collapse logger",
61
- title: a ? "Expand" : "Collapse",
62
- children: /* @__PURE__ */ e("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", className: a ? 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" }) })
63
- }
64
- ),
65
- p && /* @__PURE__ */ e(
66
- "button",
67
- {
68
- className: t.closeButton,
69
- type: "button",
70
- "aria-label": "Close logger",
71
- title: "Close",
72
- onClick: (o) => {
73
- o.stopPropagation(), B();
74
- },
75
- 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" }) })
76
- }
77
- )
78
- ] })
79
- ] }),
80
- !a && /* @__PURE__ */ e("div", { className: t.content, children: j ? /* @__PURE__ */ e("div", { className: t.empty, children: "No data to display" }) : /* @__PURE__ */ e("pre", { className: t.jsonDisplay, children: /* @__PURE__ */ e("code", { children: x(s) }) }) })
81
- ] });
82
- }
83
- export {
84
- F as Logger
85
- };
@@ -1,7 +0,0 @@
1
- import { DevPanelSection } from '../DevPanel/types';
2
- type SectionProps = {
3
- sectionName: string;
4
- section: DevPanelSection;
5
- };
6
- export declare function Section({ sectionName, section }: SectionProps): import("react/jsx-runtime").JSX.Element;
7
- export {};
@@ -1,24 +0,0 @@
1
- import { jsxs as o, jsx as e } from "react/jsx-runtime";
2
- import { ControlRenderer as i } from "../ControlRenderer/ControlRenderer.js";
3
- import { a as r } from "../../UIStore-CQdr4U-2.js";
4
- import '../../assets/Section.css';const d = "_section_1vgul_1", g = "_header_1vgul_8", _ = "_title_1vgul_15", p = "_toggle_1vgul_20", m = "_collapsed_1vgul_29", v = "_content_1vgul_35", l = {
5
- section: d,
6
- header: g,
7
- title: _,
8
- toggle: p,
9
- collapsed: m,
10
- content: v
11
- };
12
- function x({ sectionName: n, section: t }) {
13
- const { toggleSectionCollapse: c } = r();
14
- return /* @__PURE__ */ o("div", { className: l.section, children: [
15
- /* @__PURE__ */ o("div", { className: l.header, onClick: () => c(n), children: [
16
- /* @__PURE__ */ e("span", { className: l.title, children: t.name }),
17
- /* @__PURE__ */ e("span", { className: l.toggle, children: /* @__PURE__ */ e("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", className: t.isCollapsed ? l.collapsed : void 0, children: /* @__PURE__ */ e("path", { d: "M10.211 7.155A.75.75 0 0 0 9 7.747v8.501a.75.75 0 0 0 1.212.591l5.498-4.258a.746.746 0 0 0-.001-1.183l-5.498-4.243z" }) }) })
18
- ] }),
19
- !t.isCollapsed && /* @__PURE__ */ e("div", { className: l.content, children: Object.entries(t.controls).map(([s, a]) => /* @__PURE__ */ e(i, { name: s, control: a }, s)) })
20
- ] });
21
- }
22
- export {
23
- x as Section
24
- };
@@ -1 +0,0 @@
1
- export declare function Select(props: React.SelectHTMLAttributes<HTMLSelectElement>): import("react/jsx-runtime").JSX.Element;
@@ -1,10 +0,0 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
- import '../../assets/Select.css';const s = "_select_12f91_1", c = {
3
- select: s
4
- };
5
- function o(e) {
6
- return /* @__PURE__ */ t("select", { ...e, className: c.select });
7
- }
8
- export {
9
- o as Select
10
- };
@@ -1,8 +0,0 @@
1
- /**
2
- * Creates a debounced version of a callback.
3
- *
4
- * @param callback - Function to debounce
5
- * @param delay - Delay in ms before calling the callback
6
- * @returns A debounced version of the callback
7
- */
8
- export declare function useDebouncedCallback<T extends (...args: Parameters<T>) => void>(callback: T, delay: number): (...args: Parameters<T>) => void;
@@ -1,17 +0,0 @@
1
- import { useRef as n, useEffect as c, useCallback as o } from "react";
2
- function f(r, t) {
3
- const e = n(null);
4
- return c(() => () => {
5
- e.current && clearTimeout(e.current);
6
- }, []), o(
7
- (...u) => {
8
- e.current && clearTimeout(e.current), e.current = window.setTimeout(() => {
9
- r(...u);
10
- }, t);
11
- },
12
- [r, t]
13
- );
14
- }
15
- export {
16
- f as useDebouncedCallback
17
- };
@@ -1,24 +0,0 @@
1
- import { ControlsGroup } from '../../components/ControlRenderer/controls/types';
2
- /**
3
- * Hook to register controls in the dev panel
4
- * @param sectionName - Section name (e.g: 'Global', 'HomePage')
5
- * @param controls - Controls configuration
6
- *
7
- * @example
8
- * ```typescript
9
- * useDevPanel('Global', {
10
- * theme: {
11
- * type: 'select',
12
- * value: 'light',
13
- * options: ['light', 'dark'],
14
- * onChange: (value) => setTheme(value)
15
- * },
16
- * debugMode: {
17
- * type: 'boolean',
18
- * value: false,
19
- * onChange: (value) => setDebugMode(value)
20
- * }
21
- * });
22
- * ```
23
- */
24
- export declare function useDevPanel(sectionName: string, controls: ControlsGroup): void;
@@ -1,15 +0,0 @@
1
- import { useRef as f, useEffect as i } from "react";
2
- import { u as c, a as v } from "../../UIStore-CQdr4U-2.js";
3
- import { hasControlsChanged as p } from "../../utils/hasControlChanged/hasControlChanged.js";
4
- function g(e, t) {
5
- const r = c(), { registerSection: s, unregisterSection: n } = v(), o = f(void 0);
6
- i(() => {
7
- const u = r[e] !== void 0;
8
- (p(t, o.current) || !u) && (s(e, t), o.current = t);
9
- }, [e, t, r, s]), i(() => () => {
10
- n(e);
11
- }, [e, n]);
12
- }
13
- export {
14
- g as useDevPanel
15
- };
@@ -1,16 +0,0 @@
1
- import { Position } from '../../components/DevPanel/types';
2
- export interface UseDragAndDropProps {
3
- onPositionChange: (position: Position) => void;
4
- }
5
- /**
6
- * Custom hook to handle drag and drop functionality
7
- * Separates the drag logic from the main component
8
- * Includes boundary constraints and window resize handling
9
- */
10
- export declare function useDragAndDrop({ onPositionChange }: UseDragAndDropProps): {
11
- isDragging: boolean;
12
- elementRef: import('react').RefObject<HTMLDivElement | null>;
13
- handleMouseDown: (e: React.MouseEvent) => void;
14
- stopDragging: () => void;
15
- adjustPositionForResize: () => void;
16
- };
@@ -1,55 +0,0 @@
1
- import { useRef as p, useState as l, useCallback as c, useEffect as f } from "react";
2
- import { debounce as E } from "../../utils/debounce/debounce.js";
3
- import { getConstrainedPosition as D } from "../../utils/getConstrainedPosition/getConstrainedPosition.js";
4
- import { getPositionAdjustment as L } from "../../utils/getPositionAdjustment/getPositionAdjustment.js";
5
- function z({ onPositionChange: i }) {
6
- const o = p(null), [t, a] = l(!1), [u, v] = l({ x: 0, y: 0 }), m = c(() => {
7
- const e = o.current;
8
- if (!e) return;
9
- const { constrainedPosition: n, needsAdjustment: d } = L(e);
10
- d && i(n);
11
- }, [i]), s = c(
12
- (e) => {
13
- if (!t || !o.current) return;
14
- const n = {
15
- x: e.clientX - u.x,
16
- y: e.clientY - u.y
17
- }, d = D(n, o.current);
18
- i(d);
19
- },
20
- [t, u.x, u.y, i]
21
- ), r = c(() => {
22
- a(!1);
23
- }, []), g = c((e) => {
24
- if (e.target !== e.currentTarget) return;
25
- e.preventDefault(), a(!0);
26
- const n = o.current?.getBoundingClientRect();
27
- n && v({
28
- x: e.clientX - n.left,
29
- y: e.clientY - n.top
30
- });
31
- }, []);
32
- return f(() => {
33
- if (!t) return;
34
- const e = { passive: !0 };
35
- return document.addEventListener("mousemove", s, e), document.addEventListener("mouseup", r, e), () => {
36
- document.removeEventListener("mousemove", s), document.removeEventListener("mouseup", r);
37
- };
38
- }, [t, s, r]), f(() => {
39
- const e = E(m, 100);
40
- return window.addEventListener("resize", e), () => {
41
- window.removeEventListener("resize", e);
42
- };
43
- }, [m]), f(() => () => {
44
- t && (document.removeEventListener("mousemove", s), document.removeEventListener("mouseup", r));
45
- }, [t, s, r]), {
46
- isDragging: t,
47
- elementRef: o,
48
- handleMouseDown: g,
49
- stopDragging: r,
50
- adjustPositionForResize: m
51
- };
52
- }
53
- export {
54
- z as useDragAndDrop
55
- };
@@ -1,37 +0,0 @@
1
- import { HotkeyConfig, UseHotkeysOptions } from './types';
2
- /**
3
- * Hook for handling keyboard shortcuts (hotkeys) with support for modifier keys
4
- * and multiple key combinations.
5
- *
6
- * @param hotkeys - Array of hotkey configurations
7
- * @param options - Global options for all hotkeys
8
- *
9
- * @example
10
- * // Basic usage
11
- * useHotkeys([
12
- * { key: 'Enter', action: handleSubmit },
13
- * { key: 'Escape', action: handleCancel }
14
- * ]);
15
- *
16
- * @example
17
- * // With modifier keys
18
- * useHotkeys([
19
- * { key: 's', ctrlKey: true, action: handleSave, description: 'Save' },
20
- * { key: 'k', metaKey: true, action: handleSearch, description: 'Search' },
21
- * { key: 'z', ctrlKey: true, action: handleUndo, description: 'Undo' },
22
- * { key: 'z', ctrlKey: true, shiftKey: true, action: handleRedo, description: 'Redo' }
23
- * ]);
24
- *
25
- * @example
26
- * // With individual configuration
27
- * useHotkeys([
28
- * {
29
- * key: 'Delete',
30
- * action: handleDelete,
31
- * preventDefault: true,
32
- * enabled: canDelete,
33
- * description: 'Delete item'
34
- * }
35
- * ]);
36
- */
37
- export declare function useHotkeys(hotkeys: HotkeyConfig[], options?: UseHotkeysOptions): void;
@@ -1,31 +0,0 @@
1
- import { useRef as K, useCallback as y, useEffect as w } from "react";
2
- function M(h, p = {}) {
3
- const { enabled: a = !0, target: c = window, preventDefault: f = !1, stopPropagation: l = !1 } = p, u = K([]);
4
- u.current = h;
5
- const i = y((t, e) => {
6
- const o = t.key.toLowerCase() === e.key.toLowerCase(), n = !!e.ctrlKey === t.ctrlKey, s = !!e.shiftKey === t.shiftKey, d = !!e.altKey === t.altKey, k = !!e.metaKey === t.metaKey;
7
- return o && n && s && d && k;
8
- }, []), r = y(
9
- (t) => {
10
- if (!a) return;
11
- const e = t;
12
- for (const o of u.current)
13
- if (o.enabled !== !1 && i(e, o)) {
14
- const n = o.preventDefault ?? f, s = o.stopPropagation ?? l;
15
- n && t.preventDefault(), s && t.stopPropagation(), o.action(e);
16
- break;
17
- }
18
- },
19
- [a, f, l, i]
20
- );
21
- w(() => {
22
- const t = c;
23
- if (!(!t || !a))
24
- return t.addEventListener("keydown", r), () => {
25
- t.removeEventListener("keydown", r);
26
- };
27
- }, [c, a, r]);
28
- }
29
- export {
30
- M as useHotkeys
31
- };
@@ -1,3 +0,0 @@
1
- export * from './BaseStoreService';
2
- export * from './SectionsStore';
3
- export * from './UIStore';
@@ -1,13 +0,0 @@
1
- import { BaseStoreService as a } from "./BaseStoreService.js";
2
- import { d as o, e as l, a as i, u as t, g as u, b as v, f as P, c as D } from "../UIStore-CQdr4U-2.js";
3
- export {
4
- a as BaseStoreService,
5
- o as useDevPanelCollapsed,
6
- l as useDevPanelPosition,
7
- i as useDevPanelSectionActions,
8
- t as useDevPanelSections,
9
- u as useDevPanelStore,
10
- v as useDevPanelUI,
11
- P as useDevPanelUIActions,
12
- D as useDevPanelVisible
13
- };
@@ -1,9 +0,0 @@
1
- export * from './className';
2
- export * from './createHotkey';
3
- export * from './debounce';
4
- export * from './formatHotkey';
5
- export * from './getConstrainedPosition';
6
- export * from './getCurrentElementPosition';
7
- export * from './getPositionAdjustment';
8
- export * from './hasControlChanged';
9
- export * from './isMacOS';
@@ -1,20 +0,0 @@
1
- import { className as t } from "./className/className.js";
2
- import { createHotkey as m } from "./createHotkey/createHotkey.js";
3
- import { debounce as f } from "./debounce/debounce.js";
4
- import { formatHotkey as p } from "./formatHotkey/formatHotkey.js";
5
- import { getConstrainedPosition as a } from "./getConstrainedPosition/getConstrainedPosition.js";
6
- import { getCurrentElementPosition as c } from "./getCurrentElementPosition/getCurrentElementPosition.js";
7
- import { getPositionAdjustment as g } from "./getPositionAdjustment/getPositionAdjustment.js";
8
- import { hasControlsChanged as l } from "./hasControlChanged/hasControlChanged.js";
9
- import { isMacOS as P } from "./isMacOS/isMacOS.js";
10
- export {
11
- t as className,
12
- m as createHotkey,
13
- f as debounce,
14
- p as formatHotkey,
15
- a as getConstrainedPosition,
16
- c as getCurrentElementPosition,
17
- g as getPositionAdjustment,
18
- l as hasControlsChanged,
19
- P as isMacOS
20
- };