@stll/ui 0.77.0 → 0.78.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.
@@ -22,6 +22,13 @@ const ComposerPlaceholder = ({ children, stature }) => /* @__PURE__ */ jsx(Trunc
22
22
  children
23
23
  });
24
24
  /**
25
+ * The rendered status row is the `composer-status` container: the same row
26
+ * renders under the wide main chat and in a narrow side pane, so a control
27
+ * that compacts itself queries the row's width (`@max-xl/composer-status:`),
28
+ * not the viewport's. A loading view's row draws no such control.
29
+ */
30
+ const COMPOSER_STATUS_CONTAINER_CLASS = "@container/composer-status";
31
+ /**
25
32
  * The slim status row rendered beneath a composer box: a `text-xs` row with
26
33
  * a start cluster and an end slot pinned to the far edge. Shared by every
27
34
  * surface so the shell can never drift. Renders nothing when both slots are
@@ -30,7 +37,7 @@ const ComposerPlaceholder = ({ children, stature }) => /* @__PURE__ */ jsx(Trunc
30
37
  const ComposerStatusRow = ({ start, end, center, className }) => {
31
38
  if (start === void 0 && end === void 0 && center === void 0) return null;
32
39
  if (center !== void 0) return /* @__PURE__ */ jsxs("div", {
33
- className: cn(COMPOSER_STATUS_ROW_CENTERED_CLASS, className),
40
+ className: cn(COMPOSER_STATUS_ROW_CENTERED_CLASS, COMPOSER_STATUS_CONTAINER_CLASS, className),
34
41
  children: [
35
42
  /* @__PURE__ */ jsx("div", {
36
43
  className: "flex min-w-0 items-center",
@@ -47,9 +54,9 @@ const ComposerStatusRow = ({ start, end, center, className }) => {
47
54
  ]
48
55
  });
49
56
  return /* @__PURE__ */ jsxs("div", {
50
- className: cn(COMPOSER_STATUS_ROW_CLASS, className),
57
+ className: cn(COMPOSER_STATUS_ROW_CLASS, COMPOSER_STATUS_CONTAINER_CLASS, className),
51
58
  children: [start, end !== void 0 && /* @__PURE__ */ jsx("div", {
52
- className: "ms-auto",
59
+ className: "ms-auto min-w-0",
53
60
  children: end
54
61
  })]
55
62
  });
@@ -75,6 +75,13 @@ export declare const resolveInspectorPaneMaxWidth: ({ sidebarWidth, viewportWidt
75
75
  export declare const clampInspectorPaneWidth: (width: number) => number;
76
76
  /** Width the pane renders at, given the width the user asked for. */
77
77
  export declare const resolveInspectorPaneWidth: ({ desiredWidth, sidebarWidth, viewportWidth }: InspectorPaneWidthInput) => number;
78
+ /**
79
+ * `resolveInspectorPaneWidth` as CSS, for a frame drawn before the viewport
80
+ * is known (a server's paint, and the hydration of it): the same bounds and
81
+ * ceilings with `100vw` for the viewport's width, so the pane the frame
82
+ * reserves is the width the measured pane takes at any viewport.
83
+ */
84
+ export declare const inspectorPaneWidthCss: ({ desiredWidth, sidebarWidth }: Omit<InspectorPaneWidthInput, "viewportWidth">) => string;
78
85
  /**
79
86
  * Width the dock reserves in the layout: the full pane while content is
80
87
  * shown, the bare rail while it is collapsed or minimized.
@@ -42,6 +42,14 @@ const INSPECTOR_RAIL_WIDTH = 48;
42
42
  */
43
43
  const shouldForceSidebarCollapsed = ({ expandedSidebarWidth, inspectorPaneOpen, viewportWidth }) => inspectorPaneOpen && viewportWidth > 0 && viewportWidth < expandedSidebarWidth + 400 + 320;
44
44
  /**
45
+ * The pane's two viewport-relative ceilings, as what each leaves out of the
46
+ * viewport's width. Both bind. The readable one ignores the sidebar, which
47
+ * yields its width before the pane has to (see `shouldForceSidebarCollapsed`);
48
+ * the available one is what is actually left in the row once the sidebar has
49
+ * taken its share.
50
+ */
51
+ const paneCeilingOffsets = (sidebarWidth) => [560, sidebarWidth + 400];
52
+ /**
45
53
  * Largest width the pane may take without starving the content column.
46
54
  * Never returns less than {@link INSPECTOR_PANE_MIN_WIDTH}: a pane too
47
55
  * narrow to read is no better than a content column too narrow to read,
@@ -50,9 +58,7 @@ const shouldForceSidebarCollapsed = ({ expandedSidebarWidth, inspectorPaneOpen,
50
58
  */
51
59
  const resolveInspectorPaneMaxWidth = ({ sidebarWidth, viewportWidth }) => {
52
60
  if (viewportWidth <= 0) return 320;
53
- const readable = viewportWidth - 560;
54
- const available = viewportWidth - sidebarWidth - 400;
55
- return Math.max(320, Math.min(INSPECTOR_PANE_MAX_WIDTH, readable, available));
61
+ return Math.max(320, Math.min(INSPECTOR_PANE_MAX_WIDTH, ...paneCeilingOffsets(sidebarWidth).map((offset) => viewportWidth - offset)));
56
62
  };
57
63
  /**
58
64
  * A width inside the pane's own bounds, independent of any viewport.
@@ -70,8 +76,18 @@ const resolveInspectorPaneWidth = ({ desiredWidth, sidebarWidth, viewportWidth }
70
76
  viewportWidth
71
77
  }));
72
78
  /**
79
+ * `resolveInspectorPaneWidth` as CSS, for a frame drawn before the viewport
80
+ * is known (a server's paint, and the hydration of it): the same bounds and
81
+ * ceilings with `100vw` for the viewport's width, so the pane the frame
82
+ * reserves is the width the measured pane takes at any viewport.
83
+ */
84
+ const inspectorPaneWidthCss = ({ desiredWidth, sidebarWidth }) => {
85
+ const ceilings = paneCeilingOffsets(sidebarWidth).map((offset) => `100vw - ${String(offset)}px`).join(", ");
86
+ return `min(${String(clampInspectorPaneWidth(desiredWidth))}px, max(${String(320)}px, min(${String(INSPECTOR_PANE_MAX_WIDTH)}px, ${ceilings})))`;
87
+ };
88
+ /**
73
89
  * Width the dock reserves in the layout: the full pane while content is
74
90
  * shown, the bare rail while it is collapsed or minimized.
75
91
  */
76
92
  const resolveInspectorDockWidth = ({ paneWidth, showPaneContent }) => showPaneContent ? paneWidth : 48;
77
- export { INSPECTOR_CONTENT_MIN_WIDTH, INSPECTOR_EDITOR_MIN_WIDTH, INSPECTOR_PANE_DEFAULT_WIDTH, INSPECTOR_PANE_MAX_WIDTH, INSPECTOR_PANE_MIN_WIDTH, INSPECTOR_RAIL_WIDTH, clampInspectorPaneWidth, resolveInspectorDockWidth, resolveInspectorPaneMaxWidth, resolveInspectorPaneWidth, shouldForceSidebarCollapsed };
93
+ export { INSPECTOR_CONTENT_MIN_WIDTH, INSPECTOR_EDITOR_MIN_WIDTH, INSPECTOR_PANE_DEFAULT_WIDTH, INSPECTOR_PANE_MAX_WIDTH, INSPECTOR_PANE_MIN_WIDTH, INSPECTOR_RAIL_WIDTH, clampInspectorPaneWidth, inspectorPaneWidthCss, resolveInspectorDockWidth, resolveInspectorPaneMaxWidth, resolveInspectorPaneWidth, shouldForceSidebarCollapsed };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stll/ui",
3
- "version": "0.77.0",
3
+ "version": "0.78.0",
4
4
  "description": "Stella's design system: bidi-aware React primitives built on Base UI, the dockable inspector pane, and the Tailwind v4 theme they are styled with.",
5
5
  "keywords": [
6
6
  "base-ui",