@tangle-network/sandbox-ui 0.113.2 → 0.113.3

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.
@@ -6,13 +6,7 @@ import {
6
6
  } from "./chunk-EI44GEQ5.js";
7
7
 
8
8
  // src/workspace/workspace-layout.tsx
9
- import {
10
- useCallback,
11
- useEffect,
12
- useMemo,
13
- useRef,
14
- useState
15
- } from "react";
9
+ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
16
10
  import {
17
11
  PanelBottomClose,
18
12
  PanelBottomOpen,
@@ -215,6 +209,7 @@ function WorkspaceLayout({
215
209
  maxLeftWidth = 420,
216
210
  minRightWidth = 320,
217
211
  maxRightWidth = 720,
212
+ minCenterWidth = 400,
218
213
  minBottomHeight = 100,
219
214
  maxBottomHeight = 500,
220
215
  persistenceKey,
@@ -332,8 +327,35 @@ function WorkspaceLayout({
332
327
  window.removeEventListener("pointercancel", handlePointerUp);
333
328
  };
334
329
  }, [desktop, maxBottomHeight, maxLeftWidth, maxRightWidth, minBottomHeight, minLeftWidth, minRightWidth]);
335
- const leftStyle = useMemo(() => ({ width: `${leftWidth}px` }), [leftWidth]);
336
- const rightStyle = useMemo(() => ({ width: `${rightWidth}px` }), [rightWidth]);
330
+ const shellRef = useRef(null);
331
+ const [shellWidth, setShellWidth] = useState(null);
332
+ useEffect(() => {
333
+ const shell = shellRef.current;
334
+ if (!shell || typeof ResizeObserver === "undefined") return;
335
+ const observer = new ResizeObserver((entries) => {
336
+ const width = entries[0]?.contentRect.width;
337
+ if (typeof width === "number") setShellWidth(width);
338
+ });
339
+ observer.observe(shell);
340
+ return () => observer.disconnect();
341
+ }, []);
342
+ const { leftPx, rightPx } = useMemo(() => {
343
+ const leftShown = desktop && hasLeft && leftOpen;
344
+ const rightShown = desktop && hasRight && rightOpen;
345
+ let leftPx2 = leftWidth;
346
+ let rightPx2 = rightWidth;
347
+ if (shellWidth === null) return { leftPx: leftPx2, rightPx: rightPx2 };
348
+ const room = () => shellWidth - (leftShown ? leftPx2 : 0) - (rightShown ? rightPx2 : 0);
349
+ if (rightShown && room() < minCenterWidth) {
350
+ rightPx2 = Math.max(minRightWidth, rightPx2 - (minCenterWidth - room()));
351
+ }
352
+ if (leftShown && room() < minCenterWidth) {
353
+ leftPx2 = Math.max(minLeftWidth, leftPx2 - (minCenterWidth - room()));
354
+ }
355
+ return { leftPx: leftPx2, rightPx: rightPx2 };
356
+ }, [desktop, hasLeft, hasRight, leftOpen, leftWidth, minCenterWidth, minLeftWidth, minRightWidth, rightOpen, rightWidth, shellWidth]);
357
+ const leftStyle = useMemo(() => ({ width: `${leftPx}px` }), [leftPx]);
358
+ const rightStyle = useMemo(() => ({ width: `${rightPx}px` }), [rightPx]);
337
359
  const startResize = (side, pointerStartX) => {
338
360
  dragStateRef.current = {
339
361
  side,
@@ -371,7 +393,7 @@ function WorkspaceLayout({
371
393
  className
372
394
  ),
373
395
  children: [
374
- /* @__PURE__ */ jsxs("div", { className: "flex min-h-0 flex-1", children: [
396
+ /* @__PURE__ */ jsxs("div", { ref: shellRef, className: "flex min-h-0 flex-1", children: [
375
397
  desktop && left && leftOpen && /* @__PURE__ */ jsxs(Fragment, { children: [
376
398
  /* @__PURE__ */ jsxs(
377
399
  "aside",
package/dist/index.js CHANGED
@@ -133,7 +133,7 @@ import {
133
133
  formatRelativeAge,
134
134
  shellShouldRevalidate,
135
135
  useOptimisticSessionItems
136
- } from "./chunk-OUHP3YN4.js";
136
+ } from "./chunk-JZCRK2BJ.js";
137
137
  import {
138
138
  BRAND_PRISM_THEME,
139
139
  ChangesPane,
@@ -46,6 +46,12 @@ interface WorkspaceLayoutProps {
46
46
  minRightWidth?: number;
47
47
  /** Maximum right panel width in px */
48
48
  maxRightWidth?: number;
49
+ /**
50
+ * Width in px the center column keeps on desktop. When the shell is too
51
+ * narrow for the stored pane widths, the right pane yields down to its
52
+ * minimum first, then the left; the stored widths return when room does.
53
+ */
54
+ minCenterWidth?: number;
49
55
  /** Minimum bottom panel height in px */
50
56
  minBottomHeight?: number;
51
57
  /** Maximum bottom panel height in px */
@@ -99,7 +105,7 @@ interface WorkspaceLayoutProps {
99
105
  centerHeaderVisibility?: "always" | "auto";
100
106
  className?: string;
101
107
  }
102
- declare function WorkspaceLayout({ left, leftHeader, center, centerHeader, centerFooter, right, rightHeader, bottom, bottomHeader, defaultLeftOpen, defaultRightOpen, defaultBottomOpen, defaultLeftWidth, defaultRightWidth, defaultBottomHeight, minLeftWidth, maxLeftWidth, minRightWidth, maxRightWidth, minBottomHeight, maxBottomHeight, persistenceKey, resizable, theme, density, leftLabel, rightLabel, bottomLabel, leftOpen: leftOpenProp, onLeftOpenChange, rightOpen: rightOpenProp, onRightOpenChange, keyboardShortcuts, leftCollapsedControl, leftContentClassName, rightContentClassName, centerHeaderVisibility, className, }: WorkspaceLayoutProps): React$1.JSX.Element;
108
+ declare function WorkspaceLayout({ left, leftHeader, center, centerHeader, centerFooter, right, rightHeader, bottom, bottomHeader, defaultLeftOpen, defaultRightOpen, defaultBottomOpen, defaultLeftWidth, defaultRightWidth, defaultBottomHeight, minLeftWidth, maxLeftWidth, minRightWidth, maxRightWidth, minCenterWidth, minBottomHeight, maxBottomHeight, persistenceKey, resizable, theme, density, leftLabel, rightLabel, bottomLabel, leftOpen: leftOpenProp, onLeftOpenChange, rightOpen: rightOpenProp, onRightOpenChange, keyboardShortcuts, leftCollapsedControl, leftContentClassName, rightContentClassName, centerHeaderVisibility, className, }: WorkspaceLayoutProps): React$1.JSX.Element;
103
109
 
104
110
  type WorkspacePaneHeaderProps = HTMLAttributes<HTMLDivElement>;
105
111
  /**
package/dist/workspace.js CHANGED
@@ -21,7 +21,7 @@ import {
21
21
  formatRelativeAge,
22
22
  shellShouldRevalidate,
23
23
  useOptimisticSessionItems
24
- } from "./chunk-OUHP3YN4.js";
24
+ } from "./chunk-JZCRK2BJ.js";
25
25
  import "./chunk-BGVEHENC.js";
26
26
  import "./chunk-EI44GEQ5.js";
27
27
  import "./chunk-CZ7CSFO4.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/sandbox-ui",
3
- "version": "0.113.2",
3
+ "version": "0.113.3",
4
4
  "description": "Unified UI component library for Tangle Sandbox — primitives, chat, dashboard, terminal, editor, and workspace components",
5
5
  "repository": {
6
6
  "type": "git",