@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.
@@ -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
- [null, "dock-top", null],
476
- ["dock-left", null, "dock-right"],
477
- [null, "dock-bottom", null]
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.flat().map((pos) => {
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
- }, "center-empty", false, undefined, this);
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: isDock ? isTopBottom ? "9px" : "3px" : "7px",
631
- height: isDock ? isTopBottom ? "3px" : "9px" : "7px",
632
- borderRadius: isDock ? "1px" : "50%",
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
- }, pos, false, undefined, this);
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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nice-code/state",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "exports": {