@tangle-network/ui 11.16.6 → 11.16.7

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @tangle-network/ui
2
2
 
3
+ ## 11.16.7
4
+
5
+ ### Patch Changes
6
+
7
+ - 083c632: A closed terminal command has no border, so it reads as the same kind of row as the other tool calls beside it. On a phone its exit badge takes its own line under the command, so the command keeps the row's width. A tool error with nothing recorded about the command reads "tool reported error", which states what is known.
8
+
3
9
  ## 11.16.6
4
10
 
5
11
  ### Patch Changes
@@ -126,7 +126,7 @@ function ExitBadge({ output, status }) {
126
126
  label = `exit ${exitCode}`;
127
127
  tone = "danger";
128
128
  } else if (status === "error") {
129
- label = exitCode === 0 ? "exit 0 · tool error" : "tool error";
129
+ label = exitCode === 0 ? "exit 0 · tool reported error" : "tool reported error";
130
130
  tone = "neutral";
131
131
  } else {
132
132
  label = exitCode === 0 ? "exit 0" : null;
@@ -185,22 +185,25 @@ const CommandPreview = memo(({ part, defaultExpanded = false, className }) => {
185
185
  all: expanded
186
186
  })
187
187
  }),
188
- /* @__PURE__ */ jsx(ExitBadge, {
189
- output,
190
- status
188
+ /* @__PURE__ */ jsx("span", {
189
+ className: "flex shrink-0 max-sm:order-last max-sm:basis-full max-sm:pl-4",
190
+ children: /* @__PURE__ */ jsx(ExitBadge, {
191
+ output,
192
+ status
193
+ })
191
194
  })
192
195
  ] });
193
196
  return /* @__PURE__ */ jsxs("div", {
194
197
  "data-theme": expanded ? "dark" : void 0,
195
198
  "data-testid": "command-preview",
196
199
  "data-expanded": expanded,
197
- className: cn("overflow-hidden rounded-[var(--radius-md)] border font-mono text-xs text-foreground", expanded ? "border-[var(--md3-surface-container-lowest)] bg-[var(--md3-surface-container-lowest)]" : "border-border bg-transparent", className),
200
+ className: cn("overflow-hidden rounded-[var(--radius-md)] border font-mono text-xs text-foreground", expanded ? "border-[var(--md3-surface-container-lowest)] bg-[var(--md3-surface-container-lowest)]" : "border-transparent bg-transparent", className),
198
201
  children: [hasBody ? /* @__PURE__ */ jsxs("button", {
199
202
  type: "button",
200
203
  onClick: () => setExpanded((value) => !value),
201
204
  "aria-expanded": expanded,
202
205
  "aria-controls": bodyId,
203
- className: cn("flex w-full items-start gap-2 px-3 py-2 text-left transition-colors", expanded ? "hover:bg-white/5" : "hover:bg-muted", focusRing),
206
+ className: cn("flex w-full flex-wrap items-start gap-x-2 gap-y-1 px-3 py-2 text-left transition-colors sm:flex-nowrap", expanded ? "hover:bg-white/5" : "hover:bg-muted", focusRing),
204
207
  children: [promptLine, expanded ? /* @__PURE__ */ jsx(ChevronDown, {
205
208
  className: "mt-px h-3.5 w-3.5 shrink-0 text-muted-foreground",
206
209
  "aria-hidden": "true"
@@ -209,7 +212,7 @@ const CommandPreview = memo(({ part, defaultExpanded = false, className }) => {
209
212
  "aria-hidden": "true"
210
213
  })]
211
214
  }) : /* @__PURE__ */ jsx("div", {
212
- className: "flex w-full items-start gap-2 px-3 py-2",
215
+ className: "flex w-full flex-wrap items-start gap-x-2 gap-y-1 px-3 py-2 sm:flex-nowrap",
213
216
  children: promptLine
214
217
  }), expanded && hasBody ? /* @__PURE__ */ jsxs("div", {
215
218
  id: bodyId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/ui",
3
- "version": "11.16.6",
3
+ "version": "11.16.7",
4
4
  "description": "Generic React UI components for Tangle products — primitives, chat, run, files, editor, markdown.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -15,7 +15,7 @@ function part(state: Partial<ToolPart["state"]>): ToolPart {
15
15
  describe("CommandPreview", () => {
16
16
  it("shows a neutral badge, not a red exit, when a tool errored without an exit code", () => {
17
17
  render(<CommandPreview part={part({ status: "error", output: "warning: x" })} />);
18
- const badge = screen.getByText("tool error");
18
+ const badge = screen.getByText("tool reported error");
19
19
  expect(badge.className).toContain("surface-neutral");
20
20
  expect(badge.className).not.toContain("surface-danger");
21
21
  expect(screen.queryByText("error")).toBeNull();
@@ -58,7 +58,7 @@ describe("CommandPreview", () => {
58
58
  part={part({ status: "error", output: { stdout: "ok", stderr: "", exitCode: 0 } })}
59
59
  />,
60
60
  );
61
- expect(screen.getByText("exit 0 · tool error").className).toContain("surface-neutral");
61
+ expect(screen.getByText("exit 0 · tool reported error").className).toContain("surface-neutral");
62
62
  });
63
63
 
64
64
  it("is a quiet row until opened, then a dark terminal", () => {
@@ -158,7 +158,9 @@ function ExitBadge({
158
158
  label = `exit ${exitCode}`;
159
159
  tone = "danger";
160
160
  } else if (status === "error") {
161
- label = exitCode === 0 ? "exit 0 · tool error" : "tool error";
161
+ // Say what is known: the tool reported an error. Nothing recorded says
162
+ // the command itself failed.
163
+ label = exitCode === 0 ? "exit 0 · tool reported error" : "tool reported error";
162
164
  tone = "neutral";
163
165
  } else {
164
166
  label = exitCode === 0 ? "exit 0" : null;
@@ -259,7 +261,11 @@ export const CommandPreview = memo(
259
261
  >
260
262
  <CommandText command={command} all={expanded} />
261
263
  </code>
262
- <ExitBadge output={output} status={status} />
264
+ {/* On a phone the badge takes its own line under the command, so the
265
+ command keeps the row's width. */}
266
+ <span className="flex shrink-0 max-sm:order-last max-sm:basis-full max-sm:pl-4">
267
+ <ExitBadge output={output} status={status} />
268
+ </span>
263
269
  </>
264
270
  );
265
271
 
@@ -274,7 +280,7 @@ export const CommandPreview = memo(
274
280
  "overflow-hidden rounded-[var(--radius-md)] border font-mono text-xs text-foreground",
275
281
  expanded
276
282
  ? "border-[var(--md3-surface-container-lowest)] bg-[var(--md3-surface-container-lowest)]"
277
- : "border-border bg-transparent",
283
+ : "border-transparent bg-transparent",
278
284
  className,
279
285
  )}
280
286
  >
@@ -285,7 +291,7 @@ export const CommandPreview = memo(
285
291
  aria-expanded={expanded}
286
292
  aria-controls={bodyId}
287
293
  className={cn(
288
- "flex w-full items-start gap-2 px-3 py-2 text-left transition-colors",
294
+ "flex w-full flex-wrap items-start gap-x-2 gap-y-1 px-3 py-2 text-left transition-colors sm:flex-nowrap",
289
295
  expanded ? "hover:bg-white/5" : "hover:bg-muted",
290
296
  focusRing,
291
297
  )}
@@ -298,7 +304,9 @@ export const CommandPreview = memo(
298
304
  )}
299
305
  </button>
300
306
  ) : (
301
- <div className="flex w-full items-start gap-2 px-3 py-2">{promptLine}</div>
307
+ <div className="flex w-full flex-wrap items-start gap-x-2 gap-y-1 px-3 py-2 sm:flex-nowrap">
308
+ {promptLine}
309
+ </div>
302
310
  )}
303
311
 
304
312
  {expanded && hasBody ? (