@tangle-network/ui 9.1.1 → 9.1.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @tangle-network/ui
2
2
 
3
+ ## 9.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - d50f746: Give run/timeline tool rows a proper elevation ladder. Rows read as the same value as the canvas: `InlineToolItem` used `bg-card/40` (near-transparent) and RunGroup's OpenUI/running blocks used `bg-[var(--bg-root)]` (literally the page background). Both now use `--md3-surface-container` — one clear step above the `--bg-root` canvas — with hover/open stepping to `--md3-surface-container-high`. Rows now separate from the background instead of blending into it.
8
+ - d50f746: One user-message bubble. There were two: the exported `UserMessage` (a loud filled purple bubble with an uppercase "You" label + shadow, used by the run/message list) and a separate cleaner inline bubble inside `AgentTimeline`. Unify on the clean one — `UserMessage` is now a quiet right-aligned bordered bubble on the muted surface (no fill, no uppercase label), and `AgentTimeline` renders through it instead of its own copy. `UserMessage` accepts either session-model `parts` or a direct `content`/`timestamp`, so both call sites share it.
9
+
3
10
  ## 9.1.1
4
11
 
5
12
  ### Patch Changes
package/dist/chat.d.ts CHANGED
@@ -75,15 +75,20 @@ interface MessageListProps {
75
75
  declare const MessageList: React.MemoExoticComponent<({ groups, partMap, isCollapsed, onToggleCollapse, branding, renderToolDetail, renderRunActions, renderUserMessageActions, renderToolActions, }: MessageListProps) => react_jsx_runtime.JSX.Element>;
76
76
 
77
77
  interface UserMessageProps {
78
- message: SessionMessage;
79
- parts: SessionPart[];
78
+ /** Session-model input: text is derived from these parts. */
79
+ message?: SessionMessage;
80
+ parts?: SessionPart[];
81
+ /** Direct-content input (e.g. AgentTimeline): explicit text + timestamp. */
82
+ content?: string;
83
+ timestamp?: Date;
80
84
  actions?: ReactNode;
81
85
  }
82
86
  /**
83
- * Simple user message bubble.
84
- * Renders text parts from the user's message.
87
+ * The single user message bubble — a quiet, right-aligned bordered bubble on the
88
+ * muted surface (no loud fill, no uppercase label). Used by both the run/message
89
+ * list (session-model `parts`) and AgentTimeline (direct `content`/`timestamp`).
85
90
  */
86
- declare const UserMessage: React.MemoExoticComponent<({ message, parts, actions }: UserMessageProps) => react_jsx_runtime.JSX.Element | null>;
91
+ declare const UserMessage: React.MemoExoticComponent<({ message: _message, parts, content, timestamp, actions }: UserMessageProps) => react_jsx_runtime.JSX.Element | null>;
87
92
 
88
93
  type MessageRole = "user" | "assistant" | "system";
89
94
  interface ChatMessageProps {
package/dist/chat.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  MessageList,
6
6
  ThinkingIndicator,
7
7
  UserMessage
8
- } from "./chunk-YUY6D62P.js";
8
+ } from "./chunk-BQVQGDDV.js";
9
9
  import "./chunk-AZWDI2JG.js";
10
10
  import "./chunk-KWRLQ3MR.js";
11
11
  import "./chunk-WVW4KHEH.js";
@@ -38,17 +38,22 @@ import { memo as memo2 } from "react";
38
38
  // src/chat/user-message.tsx
39
39
  import { memo } from "react";
40
40
  import { jsx, jsxs } from "react/jsx-runtime";
41
- var UserMessage = memo(({ message, parts, actions }) => {
42
- const textContent = parts.filter((p) => p.type === "text").map((p) => p.text).join("\n");
43
- if (!textContent.trim()) return null;
44
- return /* @__PURE__ */ jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxs("div", { className: "flex max-w-[78%] flex-col items-end gap-2", children: [
45
- /* @__PURE__ */ jsxs("div", { className: "w-full rounded-[26px] rounded-br-[12px] bg-[var(--brand-primary)] px-4 py-3 text-white shadow-[0_8px_20px_rgba(15,23,42,0.12)]", children: [
46
- /* @__PURE__ */ jsx("div", { className: "mb-1 text-[10px] font-semibold uppercase tracking-[0.14em] text-white/60", children: "You" }),
47
- /* @__PURE__ */ jsx("div", { className: "whitespace-pre-wrap text-[15px] leading-6.5 text-white", children: textContent })
48
- ] }),
49
- actions ? /* @__PURE__ */ jsx("div", { className: "flex flex-wrap items-center justify-end gap-1.5 text-xs text-muted-foreground", children: actions }) : null
50
- ] }) });
51
- });
41
+ function formatTime(date) {
42
+ return date.toLocaleTimeString(void 0, { hour: "numeric", minute: "2-digit" });
43
+ }
44
+ var UserMessage = memo(
45
+ ({ message: _message, parts, content, timestamp, actions }) => {
46
+ const text = content ?? (parts ?? []).filter((p) => p.type === "text").map((p) => p.text).join("\n");
47
+ if (!text.trim()) return null;
48
+ return /* @__PURE__ */ jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxs("div", { className: "flex max-w-[78%] flex-col items-end gap-2", children: [
49
+ /* @__PURE__ */ jsxs("div", { className: "w-full rounded-2xl border border-border bg-muted/50 px-4 py-3", children: [
50
+ timestamp ? /* @__PURE__ */ jsx("div", { className: "mb-1.5 text-right text-[var(--font-size-xs)] text-muted-foreground", children: formatTime(timestamp) }) : null,
51
+ /* @__PURE__ */ jsx("div", { className: "whitespace-pre-wrap text-[var(--font-size-base)] leading-[var(--line-height-base)] text-foreground", children: text })
52
+ ] }),
53
+ actions ? /* @__PURE__ */ jsx("div", { className: "flex flex-wrap items-center justify-end gap-1.5 text-xs text-muted-foreground", children: actions }) : null
54
+ ] }) });
55
+ }
56
+ );
52
57
  UserMessage.displayName = "UserMessage";
53
58
 
54
59
  // src/chat/message-list.tsx
@@ -162,7 +167,7 @@ var TONE_STYLES = {
162
167
  icon: AlertTriangle
163
168
  }
164
169
  };
165
- function formatTime(date) {
170
+ function formatTime2(date) {
166
171
  return date.toLocaleTimeString(void 0, { hour: "numeric", minute: "2-digit" });
167
172
  }
168
173
  function AgentTimelineRow({ isLast, accentClassName, children }) {
@@ -174,15 +179,9 @@ function AgentTimelineRow({ isLast, accentClassName, children }) {
174
179
  /* @__PURE__ */ jsx4("div", { className: "min-w-0 pb-3", children })
175
180
  ] });
176
181
  }
177
- function UserMessage2({ item }) {
178
- return /* @__PURE__ */ jsx4("div", { className: "mb-3 flex justify-end", children: /* @__PURE__ */ jsx4("div", { className: "max-w-[72%]", children: /* @__PURE__ */ jsxs3("div", { className: "rounded-2xl border border-border bg-muted/50 px-4 py-3", children: [
179
- item.timestamp && /* @__PURE__ */ jsx4("div", { className: "mb-1.5 text-right text-[var(--font-size-xs)] text-muted-foreground", children: formatTime(item.timestamp) }),
180
- /* @__PURE__ */ jsx4("div", { className: "whitespace-pre-wrap text-[var(--font-size-base)] leading-[var(--line-height-base)] text-foreground", children: item.content })
181
- ] }) }) });
182
- }
183
182
  function AssistantMessage({ item }) {
184
183
  return /* @__PURE__ */ jsxs3("div", { className: "-mt-0.5", children: [
185
- item.timestamp && /* @__PURE__ */ jsx4("div", { className: "mb-2 text-[var(--font-size-xs)] text-muted-foreground", children: formatTime(item.timestamp) }),
184
+ item.timestamp && /* @__PURE__ */ jsx4("div", { className: "mb-2 text-[var(--font-size-xs)] text-muted-foreground", children: formatTime2(item.timestamp) }),
186
185
  item.content && /* @__PURE__ */ jsx4(Markdown, { className: "tangle-prose text-[var(--font-size-base)] leading-[var(--line-height-base)]", children: item.content }),
187
186
  item.isStreaming && /* @__PURE__ */ jsx4("span", { className: "ml-0.5 inline-block h-4 w-2 animate-pulse rounded-sm bg-primary align-text-bottom" }),
188
187
  item.toolCalls && /* @__PURE__ */ jsx4("div", { className: "mt-3", children: item.toolCalls }),
@@ -243,7 +242,7 @@ function AgentTimeline({
243
242
  const timelineItems = renderedItems.filter((item) => !(item.kind === "message" && item.role === "user"));
244
243
  return /* @__PURE__ */ jsx4("div", { className: cn("mx-auto w-full max-w-5xl px-4 py-4", className), children: renderedItems.map((item, index) => {
245
244
  if (item.kind === "message" && item.role === "user") {
246
- return /* @__PURE__ */ jsx4(UserMessage2, { item }, item.id);
245
+ return /* @__PURE__ */ jsx4(UserMessage, { content: item.content, timestamp: item.timestamp }, item.id);
247
246
  }
248
247
  const timelineIndex = timelineItems.indexOf(item);
249
248
  const isLast = timelineIndex === timelineItems.length - 1;
@@ -643,7 +642,7 @@ function ChatMessage({
643
642
  children: [
644
643
  !hideRoleLabel && /* @__PURE__ */ jsxs5("div", { className: cn("flex items-center gap-2 px-1", isUser && "flex-row-reverse"), children: [
645
644
  /* @__PURE__ */ jsx6("span", { className: "font-medium text-foreground text-xs", children: isUser ? userLabel : assistantLabel }),
646
- timestamp && /* @__PURE__ */ jsx6("span", { className: "text-muted-foreground text-xs", children: formatTime2(timestamp) })
645
+ timestamp && /* @__PURE__ */ jsx6("span", { className: "text-muted-foreground text-xs", children: formatTime3(timestamp) })
647
646
  ] }),
648
647
  /* @__PURE__ */ jsxs5(
649
648
  "div",
@@ -666,7 +665,7 @@ function ChatMessage({
666
665
  }
667
666
  );
668
667
  }
669
- function formatTime2(date) {
668
+ function formatTime3(date) {
670
669
  return date.toLocaleTimeString(void 0, {
671
670
  hour: "numeric",
672
671
  minute: "2-digit"
package/dist/index.js CHANGED
@@ -137,7 +137,7 @@ import {
137
137
  MessageList,
138
138
  ThinkingIndicator,
139
139
  UserMessage
140
- } from "./chunk-YUY6D62P.js";
140
+ } from "./chunk-BQVQGDDV.js";
141
141
  import {
142
142
  useAutoScroll,
143
143
  useRunCollapseState,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/ui",
3
- "version": "9.1.1",
3
+ "version": "9.1.2",
4
4
  "description": "Generic React UI components for Tangle products — primitives, chat, run, files, editor, markdown.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -8,6 +8,7 @@ import {
8
8
  } from "lucide-react";
9
9
  import { cn } from "../lib/utils";
10
10
  import { type MessageRole } from "./chat-message";
11
+ import { UserMessage } from "./user-message";
11
12
  import { Markdown } from "../markdown/markdown";
12
13
  import { ThinkingIndicator } from "./thinking-indicator";
13
14
  import { type ToolCallData } from "../run/tool-call-feed";
@@ -146,25 +147,6 @@ function AgentTimelineRow({ isLast, accentClassName, children }: AgentTimelineRo
146
147
  );
147
148
  }
148
149
 
149
- function UserMessage({ item }: { item: AgentTimelineMessageItem }) {
150
- return (
151
- <div className="mb-3 flex justify-end">
152
- <div className="max-w-[72%]">
153
- <div className="rounded-2xl border border-border bg-muted/50 px-4 py-3">
154
- {item.timestamp && (
155
- <div className="mb-1.5 text-right text-[var(--font-size-xs)] text-muted-foreground">
156
- {formatTime(item.timestamp)}
157
- </div>
158
- )}
159
- <div className="whitespace-pre-wrap text-[var(--font-size-base)] leading-[var(--line-height-base)] text-foreground">
160
- {item.content}
161
- </div>
162
- </div>
163
- </div>
164
- </div>
165
- );
166
- }
167
-
168
150
  function AssistantMessage({ item }: { item: AgentTimelineMessageItem }) {
169
151
  return (
170
152
  <div className="-mt-0.5">
@@ -285,7 +267,7 @@ export function AgentTimeline({
285
267
  {renderedItems.map((item, index) => {
286
268
  // User messages: right-aligned bubble, no connector
287
269
  if (item.kind === "message" && item.role === "user") {
288
- return <UserMessage key={item.id} item={item} />;
270
+ return <UserMessage key={item.id} content={item.content} timestamp={item.timestamp} />;
289
271
  }
290
272
 
291
273
  const timelineIndex = timelineItems.indexOf(item);
@@ -3,41 +3,56 @@ import type { SessionMessage } from "../types/message";
3
3
  import type { SessionPart } from "../types/parts";
4
4
 
5
5
  export interface UserMessageProps {
6
- message: SessionMessage;
7
- parts: SessionPart[];
6
+ /** Session-model input: text is derived from these parts. */
7
+ message?: SessionMessage;
8
+ parts?: SessionPart[];
9
+ /** Direct-content input (e.g. AgentTimeline): explicit text + timestamp. */
10
+ content?: string;
11
+ timestamp?: Date;
8
12
  actions?: ReactNode;
9
13
  }
10
14
 
15
+ function formatTime(date: Date): string {
16
+ return date.toLocaleTimeString(undefined, { hour: "numeric", minute: "2-digit" });
17
+ }
18
+
11
19
  /**
12
- * Simple user message bubble.
13
- * Renders text parts from the user's message.
20
+ * The single user message bubble — a quiet, right-aligned bordered bubble on the
21
+ * muted surface (no loud fill, no uppercase label). Used by both the run/message
22
+ * list (session-model `parts`) and AgentTimeline (direct `content`/`timestamp`).
14
23
  */
15
- export const UserMessage = memo(({ message, parts, actions }: UserMessageProps) => {
16
- const textContent = parts
17
- .filter((p) => p.type === "text")
18
- .map((p) => (p as { text: string }).text)
19
- .join("\n");
24
+ export const UserMessage = memo(
25
+ ({ message: _message, parts, content, timestamp, actions }: UserMessageProps) => {
26
+ const text =
27
+ content ??
28
+ (parts ?? [])
29
+ .filter((p) => p.type === "text")
30
+ .map((p) => (p as { text: string }).text)
31
+ .join("\n");
20
32
 
21
- if (!textContent.trim()) return null;
33
+ if (!text.trim()) return null;
22
34
 
23
- return (
24
- <div className="flex justify-end">
25
- <div className="flex max-w-[78%] flex-col items-end gap-2">
26
- <div className="w-full rounded-[26px] rounded-br-[12px] bg-[var(--brand-primary)] px-4 py-3 text-white shadow-[0_8px_20px_rgba(15,23,42,0.12)]">
27
- <div className="mb-1 text-[10px] font-semibold uppercase tracking-[0.14em] text-white/60">
28
- You
29
- </div>
30
- <div className="whitespace-pre-wrap text-[15px] leading-6.5 text-white">
31
- {textContent}
35
+ return (
36
+ <div className="flex justify-end">
37
+ <div className="flex max-w-[78%] flex-col items-end gap-2">
38
+ <div className="w-full rounded-2xl border border-border bg-muted/50 px-4 py-3">
39
+ {timestamp ? (
40
+ <div className="mb-1.5 text-right text-[var(--font-size-xs)] text-muted-foreground">
41
+ {formatTime(timestamp)}
42
+ </div>
43
+ ) : null}
44
+ <div className="whitespace-pre-wrap text-[var(--font-size-base)] leading-[var(--line-height-base)] text-foreground">
45
+ {text}
46
+ </div>
32
47
  </div>
48
+ {actions ? (
49
+ <div className="flex flex-wrap items-center justify-end gap-1.5 text-xs text-muted-foreground">
50
+ {actions}
51
+ </div>
52
+ ) : null}
33
53
  </div>
34
- {actions ? (
35
- <div className="flex flex-wrap items-center justify-end gap-1.5 text-xs text-muted-foreground">
36
- {actions}
37
- </div>
38
- ) : null}
39
54
  </div>
40
- </div>
41
- );
42
- });
55
+ );
56
+ },
57
+ );
43
58
  UserMessage.displayName = "UserMessage";