@nice-code/state 0.4.1 → 0.4.2
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/build/devtools/browser/index.js +20 -15
- package/package.json +1 -1
|
@@ -472,9 +472,15 @@ import {
|
|
|
472
472
|
import { jsxDEV as jsxDEV3 } from "react/jsx-dev-runtime";
|
|
473
473
|
var DOCKED_SIZE_MIN = 160;
|
|
474
474
|
var POSITION_GRID = [
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
475
|
+
{ key: "tl", pos: null },
|
|
476
|
+
{ key: "tc", pos: "dock-top" },
|
|
477
|
+
{ key: "tr", pos: null },
|
|
478
|
+
{ key: "ml", pos: "dock-left" },
|
|
479
|
+
{ key: "mc", pos: null },
|
|
480
|
+
{ key: "mr", pos: "dock-right" },
|
|
481
|
+
{ key: "bl", pos: null },
|
|
482
|
+
{ key: "bc", pos: "dock-bottom" },
|
|
483
|
+
{ key: "br", pos: null }
|
|
478
484
|
];
|
|
479
485
|
function getDockSide(pos) {
|
|
480
486
|
switch (pos) {
|
|
@@ -606,12 +612,11 @@ function PositionPicker({
|
|
|
606
612
|
return /* @__PURE__ */ jsxDEV3("div", {
|
|
607
613
|
title: "Move / dock panel",
|
|
608
614
|
style: { display: "grid", gridTemplateColumns: "repeat(3, 9px)", gap: "2px", padding: "2px" },
|
|
609
|
-
children: POSITION_GRID.
|
|
615
|
+
children: POSITION_GRID.map(({ key, pos }) => {
|
|
610
616
|
if (pos == null)
|
|
611
617
|
return /* @__PURE__ */ jsxDEV3("div", {
|
|
612
618
|
style: { width: "9px", height: "9px" }
|
|
613
|
-
},
|
|
614
|
-
const isDock = pos.startsWith("dock-");
|
|
619
|
+
}, key, false, undefined, this);
|
|
615
620
|
const isTopBottom = pos === "dock-top" || pos === "dock-bottom";
|
|
616
621
|
const isActive = pos === position;
|
|
617
622
|
return /* @__PURE__ */ jsxDEV3("div", {
|
|
@@ -627,13 +632,13 @@ function PositionPicker({
|
|
|
627
632
|
},
|
|
628
633
|
children: /* @__PURE__ */ jsxDEV3("div", {
|
|
629
634
|
style: {
|
|
630
|
-
width:
|
|
631
|
-
height:
|
|
632
|
-
borderRadius:
|
|
635
|
+
width: isTopBottom ? "9px" : "3px",
|
|
636
|
+
height: isTopBottom ? "3px" : "9px",
|
|
637
|
+
borderRadius: "1px",
|
|
633
638
|
background: isActive ? DEVTOOL_COLOR_SEMANTIC_SYSTEM : DEVTOOL_COLOR_TEXT_FAINT
|
|
634
639
|
}
|
|
635
640
|
}, undefined, false, undefined, this)
|
|
636
|
-
},
|
|
641
|
+
}, key, false, undefined, this);
|
|
637
642
|
})
|
|
638
643
|
}, undefined, false, undefined, this);
|
|
639
644
|
}
|
|
@@ -1467,12 +1472,12 @@ function NiceStateDevtools_Panel({
|
|
|
1467
1472
|
const [selectedChangeCuid, setSelectedChangeCuid] = useState4(null);
|
|
1468
1473
|
useEffect2(() => core.subscribe(setSnapshot), [core]);
|
|
1469
1474
|
const setPrefs = (update) => {
|
|
1470
|
-
setPrefsRaw((prev) => {
|
|
1471
|
-
const next = { ...prev, ...update };
|
|
1472
|
-
writePrefs(next);
|
|
1473
|
-
return next;
|
|
1474
|
-
});
|
|
1475
|
+
setPrefsRaw((prev) => ({ ...prev, ...update }));
|
|
1475
1476
|
};
|
|
1477
|
+
useEffect2(() => {
|
|
1478
|
+
const timer = setTimeout(() => writePrefs(prefs), 250);
|
|
1479
|
+
return () => clearTimeout(timer);
|
|
1480
|
+
}, [prefs]);
|
|
1476
1481
|
const { stores, changes, paused } = snapshot;
|
|
1477
1482
|
const { position, isOpen, dockedHeight, dockedWidth, detailRatio } = prefs;
|
|
1478
1483
|
const dockSide = getDockSide(position);
|