@dashfoo/react 0.6.2 → 0.6.4

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/dist/index.js CHANGED
@@ -269,7 +269,7 @@ const usePersistence = (config, defaultModel) => {
269
269
  const loadedKey = useRef(config?.key);
270
270
  useEffect(() => {
271
271
  if (config !== null && config.key !== loadedKey.current) {
272
- console.warn("[dashfoo] persist key changed for a mounted layout; the displayed layout still reflects the previous key — remount (key={persistKey}) to load the new key");
272
+ console.warn("[dashfoo] persist key changed for a mounted layout; the displayed layout still reflects the previous key; remount (key={persistKey}) to load the new key");
273
273
  loadedKey.current = config.key;
274
274
  }
275
275
  }, [config]);
@@ -352,7 +352,7 @@ const useContainerWidth = () => {
352
352
  observerRef.current?.disconnect();
353
353
  if (!element) return;
354
354
  const observer = new ResizeObserver((entries) => {
355
- const entry = entries[0];
355
+ const entry = entries.at(0);
356
356
  if (entry) setWidth(entry.contentRect.width);
357
357
  });
358
358
  observer.observe(element);
@@ -591,7 +591,9 @@ const DragPreviewOverlay = ({ manager }) => {
591
591
  y: PREVIEW_OFFSET.y + (rect ? point.y - rect.top : 0)
592
592
  });
593
593
  });
594
- const offEnd = manager.monitor.addEventListener("dragend", () => setChip(null));
594
+ const offEnd = manager.monitor.addEventListener("dragend", () => {
595
+ setChip(null);
596
+ });
595
597
  return () => {
596
598
  offStart();
597
599
  offEnd();
@@ -621,7 +623,9 @@ const DragPreviewOverlay = ({ manager }) => {
621
623
  //#region src/components/drag-root.tsx
622
624
  const DashfooDragProvider = ({ children }) => {
623
625
  const [manager] = useState(createDragManager);
624
- useInsertionEffect(() => () => manager.destroy(), [manager]);
626
+ useInsertionEffect(() => () => {
627
+ manager.destroy();
628
+ }, [manager]);
625
629
  const [subjectStore] = useState(createDragSubjectStore);
626
630
  return /* @__PURE__ */ jsx(SharedDragManagerContext.Provider, {
627
631
  value: manager,
@@ -803,8 +807,12 @@ const DragProvider = ({ children, onCommit, splitDock }) => {
803
807
  type: "OVER"
804
808
  });
805
809
  };
806
- const handleMove = () => syncIntent();
807
- const handleCollision = () => syncIntent();
810
+ const handleMove = () => {
811
+ syncIntent();
812
+ };
813
+ const handleCollision = () => {
814
+ syncIntent();
815
+ };
808
816
  const handleEnd = (event) => {
809
817
  if (event.canceled) {
810
818
  actorRef.send({ type: "CANCEL" });
@@ -854,6 +862,39 @@ const DragProvider = ({ children, onCommit, splitDock }) => {
854
862
  const FloatLayerContext = createContext(false);
855
863
  const useHasFloatLayer = () => useContext(FloatLayerContext);
856
864
 
865
+ //#endregion
866
+ //#region src/hooks/use-inline-rename.ts
867
+ const useInlineRename = ({ currentName, inputRef, onCommit, onDone }) => {
868
+ const done = useRef(false);
869
+ useEffect(() => {
870
+ inputRef.current?.focus();
871
+ inputRef.current?.select();
872
+ }, [inputRef]);
873
+ const commit = (value) => {
874
+ const trimmed = value.trim();
875
+ if (trimmed && trimmed !== currentName) onCommit(trimmed);
876
+ onDone();
877
+ };
878
+ const handleKeyDown = (event) => {
879
+ if (event.key === "Enter") {
880
+ done.current = true;
881
+ commit(event.currentTarget.value);
882
+ } else if (event.key === "Escape") {
883
+ done.current = true;
884
+ onDone();
885
+ }
886
+ };
887
+ const handleBlur = (event) => {
888
+ if (done.current) return;
889
+ done.current = true;
890
+ commit(event.currentTarget.value);
891
+ };
892
+ return {
893
+ handleBlur,
894
+ handleKeyDown
895
+ };
896
+ };
897
+
857
898
  //#endregion
858
899
  //#region src/lib/float-geometry.ts
859
900
  const MIN_WIDTH = 200;
@@ -1085,7 +1126,9 @@ const panelDomId = (tabsetId) => `dashfoo-panel-${tabsetId}`;
1085
1126
  const tabButtonIn = (scope, tabsetId, tabId) => scope?.querySelector(`#${CSS.escape(tabDomId(tabsetId, tabId))}`) ?? null;
1086
1127
  const createTabsetStore = (initial) => createStore((set, get) => ({
1087
1128
  ...initial,
1088
- cancelRename: () => set({ editingTabId: null }),
1129
+ cancelRename: () => {
1130
+ set({ editingTabId: null });
1131
+ },
1089
1132
  closeTab: (tabId) => {
1090
1133
  set({ restoreFocus: true });
1091
1134
  get().dispatch({
@@ -1104,7 +1147,9 @@ const createTabsetStore = (initial) => createStore((set, get) => ({
1104
1147
  overflowItems: [],
1105
1148
  registerRenameInput: () => {
1106
1149
  set((state) => ({ renameInputCount: state.renameInputCount + 1 }));
1107
- return () => set((state) => ({ renameInputCount: state.renameInputCount - 1 }));
1150
+ return () => {
1151
+ set((state) => ({ renameInputCount: state.renameInputCount - 1 }));
1152
+ };
1108
1153
  },
1109
1154
  registerTablist: (element) => {
1110
1155
  if (element) {
@@ -1116,11 +1161,13 @@ const createTabsetStore = (initial) => createStore((set, get) => ({
1116
1161
  set({ tablistElement: null });
1117
1162
  },
1118
1163
  renameInputCount: 0,
1119
- renameTab: (tabId, name) => get().dispatch({
1120
- name,
1121
- tabId,
1122
- type: "renameTab"
1123
- }),
1164
+ renameTab: (tabId, name) => {
1165
+ get().dispatch({
1166
+ name,
1167
+ tabId,
1168
+ type: "renameTab"
1169
+ });
1170
+ },
1124
1171
  restoreFocus: false,
1125
1172
  selectOverflowTab: (tabId) => {
1126
1173
  const { dispatch, node, tablistElement } = get();
@@ -1143,7 +1190,7 @@ const createTabsetStore = (initial) => createStore((set, get) => ({
1143
1190
  tabsetId: node.id,
1144
1191
  type: "selectTab"
1145
1192
  });
1146
- if (options?.focus) {
1193
+ if (options?.focus === true) {
1147
1194
  const tabId = node.children[index]?.id;
1148
1195
  if (tabId) tabButtonIn(tablistElement, node.id, tabId)?.focus();
1149
1196
  }
@@ -1275,7 +1322,7 @@ const TabOverflowMenu = ({ items, onSelect }) => {
1275
1322
  useEffect(() => {
1276
1323
  if (!open) return;
1277
1324
  const handlePointerDown = (event) => {
1278
- if (event.target instanceof Node && !rootRef.current?.contains(event.target)) setOpen(false);
1325
+ if (event.target instanceof Node && rootRef.current?.contains(event.target) !== true) setOpen(false);
1279
1326
  };
1280
1327
  document.addEventListener("pointerdown", handlePointerDown);
1281
1328
  return () => {
@@ -1328,7 +1375,7 @@ const TabOverflowMenu = ({ items, onSelect }) => {
1328
1375
  }
1329
1376
  };
1330
1377
  const handleFocusOut = (event) => {
1331
- if (event.relatedTarget instanceof Node && rootRef.current?.contains(event.relatedTarget)) return;
1378
+ if (event.relatedTarget instanceof Node && rootRef.current?.contains(event.relatedTarget) === true) return;
1332
1379
  setOpen(false);
1333
1380
  };
1334
1381
  return /* @__PURE__ */ jsxs("div", {
@@ -1354,7 +1401,9 @@ const TabOverflowMenu = ({ items, onSelect }) => {
1354
1401
  tabIndex: -1,
1355
1402
  children: items.map((item, index) => /* @__PURE__ */ jsx("button", {
1356
1403
  "data-dashfoo": "tab-overflow-item",
1357
- onClick: () => handleSelect(item.id),
1404
+ onClick: () => {
1405
+ handleSelect(item.id);
1406
+ },
1358
1407
  ref: (node) => {
1359
1408
  itemRefs.current[index] = node;
1360
1409
  },
@@ -1385,7 +1434,9 @@ const overflowingIds = (tablist) => {
1385
1434
  const box = tablist.getBoundingClientRect();
1386
1435
  return [...tablist.querySelectorAll("[data-dashfoo=\"tab\"]")].flatMap((tab) => {
1387
1436
  const rect = tab.getBoundingClientRect();
1388
- return (rect.right > box.right + 1 || rect.left < box.left - 1) && tab.dataset.tabId ? [tab.dataset.tabId] : [];
1437
+ const clipped = rect.right > box.right + 1 || rect.left < box.left - 1;
1438
+ const tabId = tab.dataset.tabId;
1439
+ return clipped && tabId !== void 0 && tabId !== "" ? [tabId] : [];
1389
1440
  });
1390
1441
  };
1391
1442
  const useTabOverflow = (tablist, signature) => {
@@ -1686,28 +1737,23 @@ const RenameEditor = ({ defaultValue, onBlur, onKeyDown, ref: userRef, ...props
1686
1737
  const { tab } = useTab();
1687
1738
  const cancelRename = useTabset((state) => state.cancelRename);
1688
1739
  const commitRename = useTabset((state) => state.commitRename);
1689
- const ref = useRef(null);
1690
- const done = useRef(false);
1691
- const refCallback = useMemo(() => mergeRefs(ref, userRef), [userRef]);
1692
- useEffect(() => {
1693
- ref.current?.focus();
1694
- ref.current?.select();
1695
- }, []);
1740
+ const inputRef = useRef(null);
1741
+ const rename = useInlineRename({
1742
+ currentName: tab.name,
1743
+ inputRef,
1744
+ onCommit: (name) => {
1745
+ commitRename(tab.id, name);
1746
+ },
1747
+ onDone: cancelRename
1748
+ });
1749
+ const refCallback = useMemo(() => mergeRefs(inputRef, userRef), [userRef]);
1696
1750
  const handleKeyDown = (event) => {
1697
1751
  onKeyDown?.(event);
1698
- if (event.key === "Enter") {
1699
- done.current = true;
1700
- commitRename(tab.id, event.currentTarget.value);
1701
- } else if (event.key === "Escape") {
1702
- done.current = true;
1703
- cancelRename();
1704
- }
1752
+ rename.handleKeyDown(event);
1705
1753
  };
1706
1754
  const handleCommitOnBlur = (event) => {
1707
1755
  onBlur?.(event);
1708
- if (done.current) return;
1709
- done.current = true;
1710
- commitRename(tab.id, event.currentTarget.value);
1756
+ rename.handleBlur(event);
1711
1757
  };
1712
1758
  return /* @__PURE__ */ jsx("input", {
1713
1759
  "aria-label": `Rename ${tab.name}`,
@@ -1977,7 +2023,6 @@ const RowView = ({ node, renderTabset }) => {
1977
2023
  const orientation = node.orientation === "row" ? "horizontal" : "vertical";
1978
2024
  const total = node.children.reduce((sum, child) => sum + (child.weight ?? 1), 0);
1979
2025
  const desiredLayout = useMemo(() => layoutFromWeights(node.children, total), [node.children, total]);
1980
- const measured = useRef(false);
1981
2026
  const groupRef = useRef(null);
1982
2027
  const groupElement = useRef(null);
1983
2028
  const syncing = useRef(false);
@@ -2031,11 +2076,8 @@ const RowView = ({ node, renderTabset }) => {
2031
2076
  group.setLayout(target);
2032
2077
  snapping.current = false;
2033
2078
  };
2034
- const handleLayoutChanged = (layout) => {
2035
- if (!measured.current) {
2036
- measured.current = true;
2037
- return;
2038
- }
2079
+ const handleLayoutChanged = (layout, meta) => {
2080
+ if (!meta.isUserInteraction) return;
2039
2081
  if (syncing.current) return;
2040
2082
  const boundary = activeBoundary.current;
2041
2083
  activeBoundary.current = null;
@@ -2123,43 +2165,29 @@ const CHIP_SIZE = {
2123
2165
  };
2124
2166
  const TAP_SLOP = 4;
2125
2167
  const FloatTitleEditor = ({ dispatch, node, onDone }) => {
2126
- const ref = useRef(null);
2127
- const done = useRef(false);
2128
- useEffect(() => {
2129
- ref.current?.focus();
2130
- ref.current?.select();
2131
- }, []);
2132
- const commit = (value) => {
2133
- const trimmed = value.trim();
2134
- if (trimmed && trimmed !== floatTitle(node)) dispatch({
2135
- floatId: node.id,
2136
- name: trimmed,
2137
- type: "renameFloat"
2138
- });
2139
- onDone();
2140
- };
2141
- const handleKeyDown = (event) => {
2142
- if (event.key === "Enter") {
2143
- done.current = true;
2144
- commit(event.currentTarget.value);
2145
- } else if (event.key === "Escape") {
2146
- done.current = true;
2147
- onDone();
2148
- }
2149
- };
2150
- const handleBlur = (event) => {
2151
- if (done.current) return;
2152
- done.current = true;
2153
- commit(event.currentTarget.value);
2154
- };
2168
+ const inputRef = useRef(null);
2169
+ const { handleBlur, handleKeyDown } = useInlineRename({
2170
+ currentName: floatTitle(node),
2171
+ inputRef,
2172
+ onCommit: (name) => {
2173
+ dispatch({
2174
+ floatId: node.id,
2175
+ name,
2176
+ type: "renameFloat"
2177
+ });
2178
+ },
2179
+ onDone
2180
+ });
2155
2181
  return /* @__PURE__ */ jsx("input", {
2156
2182
  "aria-label": `Rename ${floatTitle(node)}`,
2157
2183
  "data-dashfoo": "float-rename",
2158
2184
  defaultValue: floatTitle(node),
2159
2185
  onBlur: handleBlur,
2160
2186
  onKeyDown: handleKeyDown,
2161
- onPointerDown: (event) => event.stopPropagation(),
2162
- ref,
2187
+ onPointerDown: (event) => {
2188
+ event.stopPropagation();
2189
+ },
2190
+ ref: inputRef,
2163
2191
  style: titleStyle,
2164
2192
  type: "text"
2165
2193
  });
@@ -2169,11 +2197,15 @@ const FloatTitle = ({ dispatch, node, renamable }) => {
2169
2197
  if (renamable && editing) return /* @__PURE__ */ jsx(FloatTitleEditor, {
2170
2198
  dispatch,
2171
2199
  node,
2172
- onDone: () => setEditing(false)
2200
+ onDone: () => {
2201
+ setEditing(false);
2202
+ }
2173
2203
  });
2174
2204
  return /* @__PURE__ */ jsx("span", {
2175
2205
  "data-dashfoo": "float-title",
2176
- onDoubleClick: renamable ? () => setEditing(true) : void 0,
2206
+ onDoubleClick: renamable ? () => {
2207
+ setEditing(true);
2208
+ } : void 0,
2177
2209
  style: titleStyle,
2178
2210
  title: renamable ? "Double-click to rename" : void 0,
2179
2211
  children: floatTitle(node)
@@ -2213,13 +2245,13 @@ const FloatPanel = ({ global, node, onFocus, zIndex }) => {
2213
2245
  if (prior && panel.hasPointerCapture?.(prior.pointerId)) panel.releasePointerCapture(prior.pointerId);
2214
2246
  movedRef.current = false;
2215
2247
  const edgeKey = event.currentTarget.dataset.edge;
2216
- const parent = panel.offsetParent;
2248
+ const parent = panel.offsetParent instanceof HTMLElement ? panel.offsetParent : null;
2217
2249
  const gesture = {
2218
2250
  bounds: {
2219
2251
  height: parent?.clientHeight ?? 0,
2220
2252
  width: parent?.clientWidth ?? 0
2221
2253
  },
2222
- edges: edgeKey ? EDGE_BY_KEY.get(edgeKey) ?? null : null,
2254
+ edges: edgeKey === void 0 ? null : EDGE_BY_KEY.get(edgeKey) ?? null,
2223
2255
  pointerId: event.pointerId,
2224
2256
  start: node.geometry,
2225
2257
  startX: event.clientX,
@@ -2234,9 +2266,9 @@ const FloatPanel = ({ global, node, onFocus, zIndex }) => {
2234
2266
  if (!gesture || event.pointerId !== gesture.pointerId) return;
2235
2267
  gestureRef.current = null;
2236
2268
  const panel = panelRef.current;
2237
- if (panel?.hasPointerCapture?.(event.pointerId)) panel.releasePointerCapture(event.pointerId);
2269
+ if (panel?.hasPointerCapture?.(event.pointerId) === true) panel.releasePointerCapture(event.pointerId);
2238
2270
  if (!movedRef.current) {
2239
- if (node.minimized) restore();
2271
+ if (node.minimized === true) restore();
2240
2272
  return;
2241
2273
  }
2242
2274
  dispatch({
@@ -2264,11 +2296,11 @@ const FloatPanel = ({ global, node, onFocus, zIndex }) => {
2264
2296
  ...gesture.start,
2265
2297
  left: gesture.start.left + dx,
2266
2298
  top: gesture.start.top + dy
2267
- }, gesture.bounds, node.minimized ? CHIP_SIZE : void 0);
2299
+ }, gesture.bounds, node.minimized === true ? CHIP_SIZE : void 0);
2268
2300
  latestRef.current = next;
2269
2301
  panel.style.left = `${next.left}px`;
2270
2302
  panel.style.top = `${next.top}px`;
2271
- if (!node.minimized) {
2303
+ if (node.minimized !== true) {
2272
2304
  panel.style.width = `${next.width}px`;
2273
2305
  panel.style.height = `${next.height}px`;
2274
2306
  }
@@ -2282,12 +2314,12 @@ const FloatPanel = ({ global, node, onFocus, zIndex }) => {
2282
2314
  if (!movedRef.current) return;
2283
2315
  panel.style.left = `${gesture.start.left}px`;
2284
2316
  panel.style.top = `${gesture.start.top}px`;
2285
- if (!node.minimized) {
2317
+ if (node.minimized !== true) {
2286
2318
  panel.style.width = `${gesture.start.width}px`;
2287
2319
  panel.style.height = `${gesture.start.height}px`;
2288
2320
  }
2289
2321
  };
2290
- if (node.minimized) return /* @__PURE__ */ jsxs("button", {
2322
+ if (node.minimized === true) return /* @__PURE__ */ jsxs("button", {
2291
2323
  "aria-label": `Restore ${floatTitle(node)} panel`,
2292
2324
  "data-dashfoo": "float-chip",
2293
2325
  onKeyDown: (event) => {
@@ -2359,12 +2391,16 @@ const FloatPanel = ({ global, node, onFocus, zIndex }) => {
2359
2391
  editable && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("button", {
2360
2392
  "aria-label": "Minimize panel",
2361
2393
  "data-dashfoo": "float-minimize",
2362
- onClick: () => dispatch({
2363
- floatId: node.id,
2364
- minimized: true,
2365
- type: "setFloatMinimized"
2366
- }),
2367
- onPointerDown: (event) => event.stopPropagation(),
2394
+ onClick: () => {
2395
+ dispatch({
2396
+ floatId: node.id,
2397
+ minimized: true,
2398
+ type: "setFloatMinimized"
2399
+ });
2400
+ },
2401
+ onPointerDown: (event) => {
2402
+ event.stopPropagation();
2403
+ },
2368
2404
  style: dockButtonStyle,
2369
2405
  title: "Minimize panel",
2370
2406
  type: "button",
@@ -2372,11 +2408,15 @@ const FloatPanel = ({ global, node, onFocus, zIndex }) => {
2372
2408
  }), /* @__PURE__ */ jsx("button", {
2373
2409
  "aria-label": "Dock panel back into the main layout",
2374
2410
  "data-dashfoo": "float-dock",
2375
- onClick: () => dispatch({
2376
- floatId: node.id,
2377
- type: "dockFloat"
2378
- }),
2379
- onPointerDown: (event) => event.stopPropagation(),
2411
+ onClick: () => {
2412
+ dispatch({
2413
+ floatId: node.id,
2414
+ type: "dockFloat"
2415
+ });
2416
+ },
2417
+ onPointerDown: (event) => {
2418
+ event.stopPropagation();
2419
+ },
2380
2420
  style: dockButtonStyle,
2381
2421
  title: "Dock panel back",
2382
2422
  type: "button",
@@ -2438,7 +2478,9 @@ const FloatOverlay = ({ floats, global }) => {
2438
2478
  children: floats.map((node) => /* @__PURE__ */ jsx(FloatPanel, {
2439
2479
  global,
2440
2480
  node,
2441
- onFocus: () => setTopId(node.id),
2481
+ onFocus: () => {
2482
+ setTopId(node.id);
2483
+ },
2442
2484
  zIndex: node.id === topId ? 2 : 1
2443
2485
  }, node.id))
2444
2486
  });
@@ -2495,48 +2537,62 @@ const DashfooLayout = forwardRef((props, ref) => {
2495
2537
  });
2496
2538
  const hasSharedManager = useContext(SharedDragManagerContext) !== null;
2497
2539
  useImperativeHandle(ref, () => ({
2498
- addTab: (tab, target) => store.dispatch({
2499
- index: target.index,
2500
- location: target.location ?? "center",
2501
- tab,
2502
- targetId: target.targetId,
2503
- type: "addNode"
2504
- }),
2540
+ addTab: (tab, target) => {
2541
+ store.dispatch({
2542
+ index: target.index,
2543
+ location: target.location ?? "center",
2544
+ tab,
2545
+ targetId: target.targetId,
2546
+ type: "addNode"
2547
+ });
2548
+ },
2505
2549
  canRedo: store.canRedo,
2506
2550
  canUndo: store.canUndo,
2507
- closeTab: (tabId) => store.dispatch({
2508
- tabId,
2509
- type: "deleteTab"
2510
- }),
2551
+ closeTab: (tabId) => {
2552
+ store.dispatch({
2553
+ tabId,
2554
+ type: "deleteTab"
2555
+ });
2556
+ },
2511
2557
  dispatch: store.dispatch,
2512
- dockFloat: (floatId) => store.dispatch({
2513
- floatId,
2514
- type: "dockFloat"
2515
- }),
2516
- floatTab: (tabId) => store.dispatch({
2517
- tabId,
2518
- type: "floatTab"
2519
- }),
2558
+ dockFloat: (floatId) => {
2559
+ store.dispatch({
2560
+ floatId,
2561
+ type: "dockFloat"
2562
+ });
2563
+ },
2564
+ floatTab: (tabId) => {
2565
+ store.dispatch({
2566
+ tabId,
2567
+ type: "floatTab"
2568
+ });
2569
+ },
2520
2570
  getModel: () => store.model,
2521
- maximizeTabset: (tabsetId) => store.dispatch({
2522
- tabsetId,
2523
- type: "setMaximizedTabset"
2524
- }),
2571
+ maximizeTabset: (tabsetId) => {
2572
+ store.dispatch({
2573
+ tabsetId,
2574
+ type: "setMaximizedTabset"
2575
+ });
2576
+ },
2525
2577
  redo: store.redo,
2526
- renameTab: (tabId, name) => store.dispatch({
2527
- name,
2528
- tabId,
2529
- type: "renameTab"
2530
- }),
2578
+ renameTab: (tabId, name) => {
2579
+ store.dispatch({
2580
+ name,
2581
+ tabId,
2582
+ type: "renameTab"
2583
+ });
2584
+ },
2531
2585
  resetLayout: () => {
2532
2586
  persistence.clear();
2533
2587
  if (defaultModel !== void 0) store.setModel(defaultModel);
2534
2588
  },
2535
- selectTab: (tabsetId, index) => store.dispatch({
2536
- index,
2537
- tabsetId,
2538
- type: "selectTab"
2539
- }),
2589
+ selectTab: (tabsetId, index) => {
2590
+ store.dispatch({
2591
+ index,
2592
+ tabsetId,
2593
+ type: "selectTab"
2594
+ });
2595
+ },
2540
2596
  undo: store.undo
2541
2597
  }), [
2542
2598
  defaultModel,
@@ -2562,13 +2618,12 @@ const DashfooLayout = forwardRef((props, ref) => {
2562
2618
  responsive?.orientation,
2563
2619
  store.model
2564
2620
  ]);
2565
- const isCompactRef = useRef(isCompact);
2566
- isCompactRef.current = isCompact;
2621
+ const storeDispatch = store.dispatch;
2567
2622
  const dispatch = useCallback((action) => {
2568
- if (isCompactRef.current && action.type === "adjustSplit") return;
2569
- store.dispatch(action);
2570
- }, [store]);
2571
- const maximized = view.maximizedTabsetId ? findTabset(view, view.maximizedTabsetId) : void 0;
2623
+ if (isCompact && action.type === "adjustSplit") return;
2624
+ storeDispatch(action);
2625
+ }, [isCompact, storeDispatch]);
2626
+ const maximized = view.maximizedTabsetId === void 0 ? void 0 : findTabset(view, view.maximizedTabsetId);
2572
2627
  const tree = /* @__PURE__ */ jsx(Layout.FloatLayer, {
2573
2628
  floats: store.model.floats ?? [],
2574
2629
  global: store.model.global,