Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Chat and composer finish: composer lift, bubble sheen and tails, press feedback (#6731)

Milind Soni613aff9d6715
diff --git a/DESIGN.md b/DESIGN.md
index 07f6f5fc1f..409245ccf8 100644
--- a/DESIGN.md
+++ b/DESIGN.md
@@ -157,7 +157,7 @@ element's job and never a pixel value:
| Fields, controls | 8px | `rounded-lg` |
| Cards, menus, popovers, sidebar rows and pinned bots | 12px | `rounded-xl` |
| Dialogs | 14px | `.ui-modal` |
-| Bubbles, cards in the transcript | 18px | `rounded-4xl` |
+| Bubbles, cards in the transcript | 18px; a bubble in a run of its sender's bubbles keeps a 6px tail at its bottom corner on its own side (`joinedCorners`) | `rounded-4xl` |
| Composer | 22px (18px once it wraps, and always in Advanced mode, whose field sits above a footer row) | set by the composer |
| Window panes | 0 | |
@@ -222,10 +222,18 @@ element's job and never a pixel value:
- **Only floating things cast shadows:** menus, popovers and dialogs. Use
`menu-surface` or `popover-surface`, which carry each skin's shadow. Cards
- in the page are flat, with a `hairline` border or a tint.
+ in the page are flat, with a `hairline` border or a tint. Two things in the
+ chat also float, over the scrolling transcript: the chat header's pill and
+ controls (`shadow-(--shadow-float)`, through `ELEVATED_FLOAT`) and the
+ composer (`shadow-(--shadow-composer)`, through `ELEVATED_COMPOSER`). The
+ lift shows on light grounds only; in Daylight the composer drops its 0.5px
+ ring at rest and gets it back on hover and focus.
- **Borders are 1px `hairline`.** Panes meet on a 0.5px `edge`. An element in
the page gets a border or a tint, not both, and no shadow. Floating surfaces
- take their surface class, which already balances all three.
+ take their surface class, which already balances all three. One exception:
+ a bot's bubble is a tint finished with a faint top-lit sheen and a 0.5px
+ inset line of ink at 6% (`BOT_BUBBLE_FINISH`), on light grounds only; a
+ dark ground keeps the flat tint.
- **Rich content in a reply stays in the bubble.** Tables, code and quotes are
drawn alike: no fill of their own, a 1px hairline and a faint tint. One
reply is one bubble.
@@ -263,7 +271,10 @@ Motion explains a change. It never decorates.
- **300ms ceiling.** Only first-run onboarding may run longer.
- **Nothing scales in from zero.** Things grow from about 96% and fade.
- **Hover and press transitions are 120ms** on colour and opacity only. Don't
- animate layout.
+ animate layout. One exception: buttons (`.ui-button`, `.ui-icon-button`)
+ and the sidebar's bot rows and pinned bots shrink to 98% while pressed, over
+ 50ms, and not at all with reduced motion. The stylesheet does this; don't
+ add your own press scale.
- **No loops** except a live status that is really live (a bot working).
Never animate something just to draw the eye.
- **Mascots hold still at rest.** A mascot moves while its bot is doing
diff --git a/src/components/ChatView.controls.test.ts b/src/components/ChatView.controls.test.ts
index efbcfcaf74..dab7cfcd2f 100644
--- a/src/components/ChatView.controls.test.ts
+++ b/src/components/ChatView.controls.test.ts
@@ -81,7 +81,7 @@ describe("the header's right side", () => {
expect(controls).toContain("data-test-model-control");
expect(fixture.model).toMatchObject({ threadId: "selected" });
const computer = controls.match(/<button[^>]*data-tour="computer"[^>]*>/)?.[0] ?? "";
- expect(computer.split(" ")).toEqual(expect.arrayContaining(["rounded-full", "size-9"]));
+ expect(computer.split(" ")).toEqual(expect.arrayContaining(["rounded-full", "size-9", "shadow-(--shadow-float)"]));
expect(markup).not.toContain('data-testid="chat-more"');
expect(fixture.menus.find((menu) => menu.ariaLabel === "More")).toBeUndefined();
expect(markup).toContain("data-chathead-pill");
@@ -154,7 +154,7 @@ describe("the Simple header", () => {
expect(identity.replace(pill[0], "").replace(/<span role="status"[^>]*>[^<]*<\/span>/, "")).not.toMatch(/<(button|a|span)[\s>]/);
expect(pill[1]).toContain(">Pepper</span>");
expect(pill[1]).toContain('data-chathead-elsewhere="true"');
- expect(pill[0].match(/class="([^"]*)"/)![1]!.split(" ")).toEqual(expect.arrayContaining(["rounded-full", "bg-composer", "ring-[0.5px]", "py-[7.5px]", "pr-[13.5px]"]));
+ expect(pill[0].match(/class="([^"]*)"/)![1]!.split(" ")).toEqual(expect.arrayContaining(["rounded-full", "bg-composer", "ring-[0.5px]", "shadow-(--shadow-float)", "py-[7.5px]", "pr-[13.5px]"]));
// Away from the bot's main conversation, the pill names the one on screen.
expect(pill[1]).toContain("data-chathead-conversation");
for (const gone of ["data-chathead-role", "data-background-activity", "data-chathead-back", 'data-testid="chat-more"']) {
diff --git a/src/components/ChatView.conversational.test.ts b/src/components/ChatView.conversational.test.ts
index 77a16d747f..405af7d8dc 100644
--- a/src/components/ChatView.conversational.test.ts
+++ b/src/components/ChatView.conversational.test.ts
@@ -76,10 +76,12 @@ describe("conversational replies", () => {
expect(bubbles).toHaveLength(3);
expect(bubbles.every((el) => !el.classList.contains("reply-bubble-in"))).toBe(true);
for (const el of bubbles) expect([...el.classList]).toEqual(expect.arrayContaining(["bg-card", "rounded-[18px]", "px-3", "text-[15px]", "leading-[22px]", "min-w-9"]));
- expect([...bubbles[0]!.classList]).toContain("rounded-es-[6px]");
- expect([...bubbles[1]!.classList]).toEqual(expect.arrayContaining(["rounded-ss-[6px]", "rounded-es-[6px]"]));
- expect([...bubbles[2]!.classList]).toContain("rounded-ss-[6px]");
- expect([...bubbles[2]!.classList]).not.toContain("rounded-es-[6px]");
+ // Each bubble in the run keeps a 6px tail at its bottom start corner; the top corners stay round.
+ for (const el of bubbles) {
+ expect([...el.classList]).toContain("rounded-es-[6px]");
+ expect([...el.classList]).not.toContain("rounded-ss-[6px]");
+ expect([...el.classList]).toContain("bubble-finish");
+ }
expect(document.querySelector("[data-conversational-reply]")!.classList).toContain("gap-1");
});
diff --git a/src/components/ChatView.tsx b/src/components/ChatView.tsx
index bcbe875065..059978ef60 100644
--- a/src/components/ChatView.tsx
+++ b/src/components/ChatView.tsx
@@ -135,7 +135,7 @@ import { latestFailure, latestReply, type TranscriptSnapshot } from "@/lib/trans
import { pendingApprovals } from "./PendingApproval";
import { TranscriptAnnouncer } from "./TranscriptAnnouncer";
import { JumpToLatestButton } from "./JumpToLatestButton";
-import { isBotTextRow, joinedCorners, needsStamp, quietRow, simpleRowLayout, SIMPLE_BOT_BUBBLE, SIMPLE_BUBBLE_MAX, SIMPLE_BUBBLE_TEXT, SIMPLE_STACKED, SIMPLE_USER_BUBBLE, type BubbleJoin } from "./chat-bubble";
+import { BOT_BUBBLE_FINISH, isBotTextRow, joinedCorners, needsStamp, quietRow, simpleRowLayout, SIMPLE_BOT_BUBBLE, SIMPLE_BUBBLE_MAX, SIMPLE_BUBBLE_TEXT, SIMPLE_STACKED, SIMPLE_USER_BUBBLE, type BubbleJoin } from "./chat-bubble";
const USER_COLLAPSE_CHARS = 600;
const USER_COLLAPSE_LINES = 8;
@@ -458,7 +458,7 @@ const Bubble = memo(function Bubble({
? cn("whitespace-pre-wrap [overflow-wrap:anywhere] text-ink", simple ? SIMPLE_USER_BUBBLE : "bg-bubble-user px-4 py-2.5", ownBubbleStyle && "user-bubble-colored", simple && ownBubbleStyle && "antialiased")
: formatted
? cn(formattedReplyWidth(text), "px-1 text-ink")
- : simple ? SIMPLE_BOT_BUBBLE : "bg-card px-4 py-2.5 text-ink",
+ : simple ? SIMPLE_BOT_BUBBLE : cn("bg-card px-4 py-2.5 text-ink", BOT_BUBBLE_FINISH),
simple && join && !split && !attachmentsOnly && !tabled && joinedCorners(user ? "end" : "start", join),
)}
style={user && !webhookView && !attachmentsOnly ? ownBubbleStyle : undefined}
diff --git a/src/components/ChatView.user-bubble.test.ts b/src/components/ChatView.user-bubble.test.ts
index ff6075f00b..381a37bd25 100644
--- a/src/components/ChatView.user-bubble.test.ts
+++ b/src/components/ChatView.user-bubble.test.ts
@@ -3,7 +3,7 @@ import { renderToStaticMarkup } from "react-dom/server";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import type { Bot, InstanceInfo } from "@/state/store";
-const fixture = vi.hoisted(() => ({ colorMine: false }));
+const fixture = vi.hoisted(() => ({ colorMine: false, advanced: false }));
vi.mock("@/state/store", async (importOriginal) => {
const original = await importOriginal<typeof import("@/state/store")>();
@@ -15,7 +15,7 @@ vi.mock("./DesktopCapabilities", () => ({
}));
vi.mock("@/lib/analytics", () => ({ track: vi.fn() }));
vi.mock("@/lib/thread-preferences", () => ({ useShowThreads: () => false, useShowThreadsChoice: () => false, setShowThreads: vi.fn() }));
-vi.mock("@/lib/interface-mode", () => ({ useAdvancedMode: () => false, setAdvancedMode: vi.fn() }));
+vi.mock("@/lib/interface-mode", () => ({ useAdvancedMode: () => fixture.advanced, setAdvancedMode: vi.fn() }));
vi.mock("@/lib/cloud-guest", () => ({ useCanWriteIn: () => true, useReactor: () => "user" }));
vi.mock("./CitationUI", () => ({ CitationSelectionToolbar: () => null, SentCitations: () => null }));
vi.mock("./ModelPicker", () => ({ ModelPicker: () => null }));
@@ -35,7 +35,7 @@ const bot: Bot = {
tasks: [{ threadId: "selected", title: "Selected", createdAt: 1, busy: false, activity: "idle", modelSelection: { instanceId: "test", model: "thread-model" }, approvalMode: "ask" }],
};
-afterEach(() => { fixture.colorMine = false; vi.unstubAllGlobals(); });
+afterEach(() => { fixture.colorMine = false; fixture.advanced = false; vi.unstubAllGlobals(); });
beforeEach(() => {
vi.stubGlobal("window", {});
@@ -76,3 +76,11 @@ it("marks a steered message as sent mid-turn without claiming the bot read it",
expect(html).toContain(">sent mid-turn</div>");
expect(html).not.toContain("It saw this before its next step");
});
+
+it.each([["Simple", false], ["Advanced", true]] as const)("finishes the bot's bubble with the sheen and inset line in %s mode, and not the person's", (_mode, advanced) => {
+ fixture.advanced = advanced;
+ const html = renderToStaticMarkup(createElement(ChatView, { bot }));
+ const classOf = (look: string) => html.match(new RegExp(`<div[^>]*data-look="${look}"[^>]*>`))?.[0].match(/class="([^"]*)"/)?.[1]?.split(" ") ?? [];
+ expect(classOf("bot-bubble")).toEqual(expect.arrayContaining(["bg-card", "bubble-finish"]));
+ expect(classOf("user-bubble")).not.toContain("bubble-finish");
+});
diff --git a/src/components/Composer.advanced.test.ts b/src/components/Composer.advanced.test.ts
index c7789c068a..c83e37b8d5 100644
--- a/src/components/Composer.advanced.test.ts
+++ b/src/components/Composer.advanced.test.ts
@@ -112,7 +112,8 @@ afterEach(() => {
describe("the Advanced composer in a bot chat", () => {
it("puts the field on its own line above one footer row, on the floating surface", () => {
render({ bot });
- expect(classes('[data-tour="composer"]')).toEqual(expect.arrayContaining(["rounded-[18px]", "bg-composer", "ring-[0.5px]", "shadow-(--shadow-float)"]));
+ expect(classes('[data-tour="composer"]')).toEqual(expect.arrayContaining(["rounded-[18px]", "bg-composer", "ring-[0.5px]", "composer-shell", "shadow-(--shadow-composer)"]));
+ expect(classes('[data-tour="composer"]')).not.toContain("shadow-(--shadow-float)");
expect(classes(".mention-editor")).toContain("basis-full");
expect(container.querySelector("[data-composer-row] > .mention-editor + [data-composer-tools]")).not.toBeNull();
expect(classes("[data-composer-row]")).toContain("flex-wrap");
diff --git a/src/components/Composer.simple.test.ts b/src/components/Composer.simple.test.ts
index c12a1d4bcf..4a840bbdc8 100644
--- a/src/components/Composer.simple.test.ts
+++ b/src/components/Composer.simple.test.ts
@@ -117,10 +117,11 @@ describe("the Simple composer in a bot chat", () => {
const pill = container.querySelector('[data-tour="composer"]')!.className.split(" ");
expect(pill).toEqual(expect.arrayContaining(["rounded-[22px]", "bg-composer", "p-2", "ring-[0.5px]", "hover:ring-ink/[0.22]", "focus-within:ring-ink/[0.22]",
"[transition:border-radius_300ms,box-shadow_150ms]"]));
- expect(pill.filter((name) => name.startsWith("shadow"))).toEqual(["shadow-[0_2px_8px_-1px_rgb(0_0_0/0.05),0_1px_2px_rgb(0_0_0/0.03),0_0_0_1px_rgb(228_228_228/0.04)]"]);
+ expect(pill.filter((name) => name.startsWith("shadow"))).toEqual(["shadow-(--shadow-composer)"]);
+ expect(pill).toContain("composer-shell");
expect(container.querySelector("[data-composer-row]")!.className).not.toContain("flex-wrap");
expect(container.querySelector("[data-composer-actions]")!.className.split(" ")).toContain("gap-2");
- expect(container.querySelector("[data-composer-plus]")!.className.split(" ")).toEqual(expect.arrayContaining(["size-7", "bg-ink/[0.05]", "ring-inset", "text-ink-tertiary"]));
+ expect(container.querySelector("[data-composer-plus]")!.className.split(" ")).toEqual(expect.arrayContaining(["size-7", "bg-ink/[0.06]", "inset-ring-[0.5px]", "inset-ring-ink/[0.08]", "text-ink-tertiary"]));
expect(container.querySelector('button[aria-label="Attach a file"]')).toBeNull();
expect(container.querySelector("[data-goal-chip]")).toBeNull();
expect(container.querySelector("[data-approval-chip]")).toBeNull();
diff --git a/src/components/Composer.tsx b/src/components/Composer.tsx
index 93af70336b..32e983246b 100644
--- a/src/components/Composer.tsx
+++ b/src/components/Composer.tsx
@@ -8,7 +8,7 @@ import { visibleMessages, currentTaskBot, type Bot, type Group, type InstanceInf
import { cn } from "@/lib/cn";
import { PHONE_LAYOUT, useMediaQuery } from "@/lib/use-media-query";
import { useMenuMotion } from "./MenuMotion";
-import { ELEVATED_CARD, ELEVATED_FLOAT } from "./elevated";
+import { ELEVATED_CARD, ELEVATED_COMPOSER, ELEVATED_FLOAT } from "./elevated";
import { uploadDraftImage } from "@/lib/composer-uploads";
import { intakeFilesWithNotice } from "@/lib/attach-notice";
import { activeLocale, t } from "@/lib/i18n";
@@ -778,7 +778,7 @@ export function Composer({
data-composer-backdrop
className={cn("pointer-events-none absolute -left-4 -right-4 bg-app", advanced ? "-bottom-3 top-1/2" : cn("top-0", simpleDock ? "-bottom-4" : "-bottom-3"))}
/>
- <div ref={shellRef} data-tour="composer" data-look="composer" data-multiline={multiline ? "" : undefined} className={cn("@container/composer relative z-[1]", singleRow ? "flex items-end gap-2" : simpleDock ? cn(SIMPLE_COMPOSER, multiline ? "rounded-[18px]" : "rounded-[22px]") : cn("rounded-[18px] px-2 pb-2 pt-2.5", ELEVATED_FLOAT))}>
+ <div ref={shellRef} data-tour="composer" data-look="composer" data-multiline={multiline ? "" : undefined} className={cn("@container/composer relative z-[1]", singleRow ? "flex items-end gap-2" : simpleDock ? cn(SIMPLE_COMPOSER, multiline ? "rounded-[18px]" : "rounded-[22px]") : cn("rounded-[18px] px-2 pb-2 pt-2.5", ELEVATED_COMPOSER))}>
{singleRow && !locked && (
<div className="flex shrink-0 items-center">
<PhonePlus
diff --git a/src/components/RoomTextMessage.tsx b/src/components/RoomTextMessage.tsx
index 81a8a3d91d..065de544da 100644
--- a/src/components/RoomTextMessage.tsx
+++ b/src/components/RoomTextMessage.tsx
@@ -20,7 +20,7 @@ import { ThreadRefText } from "./ThreadRefs";
import { BugReportNote } from "./BugReportNote";
import { ChatMarkdown } from "./ChatMarkdown";
import { MessageBoundary } from "./ChatView";
-import { SIMPLE_BOT_BUBBLE, SIMPLE_BUBBLE_MAX, SIMPLE_BUBBLE_TEXT, SIMPLE_USER_BUBBLE } from "./chat-bubble";
+import { BOT_BUBBLE_FINISH, SIMPLE_BOT_BUBBLE, SIMPLE_BUBBLE_MAX, SIMPLE_BUBBLE_TEXT, SIMPLE_USER_BUBBLE } from "./chat-bubble";
import { ReplyBlocks } from "./ReplyBlocks";
import { CopyButton, MESSAGE_ROW, MessageActions, messageActionClass, ReplyAction } from "./MessageActions";
import { ReactAction, ReactionChips } from "./Reactions";
@@ -159,7 +159,7 @@ export const RoomTextMessage = memo(function RoomTextMessage({
? cn(formattedReplyWidth(m.text ?? ""), "px-1 text-ink")
: user
? cn("chat-text whitespace-pre-wrap [overflow-wrap:anywhere] text-ink", simple ? SIMPLE_USER_BUBBLE : "bg-bubble-user px-4 py-2.5")
- : simple ? SIMPLE_BOT_BUBBLE : "bg-card px-4 py-2.5 text-ink",
+ : simple ? SIMPLE_BOT_BUBBLE : cn("bg-card px-4 py-2.5 text-ink", BOT_BUBBLE_FINISH),
)}
title={new Date(m.at).toLocaleString(intlLocale())}
>
diff --git a/src/components/chat-bubble.test.ts b/src/components/chat-bubble.test.ts
new file mode 100644
index 0000000000..68924ecd91
--- /dev/null
+++ b/src/components/chat-bubble.test.ts
@@ -0,0 +1,30 @@
+import { describe, expect, it } from "vitest";
+import { BOT_BUBBLE_FINISH, joinedCorners, plainBotBubble, SIMPLE_BOT_BUBBLE, SIMPLE_STACKED, SIMPLE_USER_BUBBLE } from "./chat-bubble";
+
+describe("a run of one sender's bubbles", () => {
+ it("gives each bubble in the run a 6px tail at its bottom corner on its own side, and keeps the top corners round", () => {
+ for (const join of [{ above: false, below: true }, { above: true, below: true }, { above: true, below: false }]) {
+ expect(joinedCorners("start", join)).toBe("rounded-es-[6px]");
+ expect(joinedCorners("end", join)).toBe("rounded-ee-[6px]");
+ }
+ });
+
+ it("leaves a lone bubble round all over", () => {
+ expect(joinedCorners("start", { above: false, below: false })).toBe("");
+ expect(joinedCorners("end", { above: false, below: false })).toBe("");
+ });
+
+ it("pulls a bubble in the same run up from the 16px between senders to 4px", () => {
+ expect(SIMPLE_STACKED).toBe("-mt-3");
+ });
+});
+
+describe("a bot's bubble finish", () => {
+ it("finishes every bot bubble recipe, in both modes, and never the person's own", () => {
+ expect(BOT_BUBBLE_FINISH).toBe("bubble-finish");
+ expect(SIMPLE_BOT_BUBBLE.split(" ")).toEqual(expect.arrayContaining(["bg-card", BOT_BUBBLE_FINISH]));
+ expect(plainBotBubble(true).split(" ")).toContain(BOT_BUBBLE_FINISH);
+ expect(plainBotBubble(false).split(" ")).toEqual(expect.arrayContaining(["bg-card", BOT_BUBBLE_FINISH]));
+ expect(SIMPLE_USER_BUBBLE.split(" ")).not.toContain(BOT_BUBBLE_FINISH);
+ });
+});
diff --git a/src/components/chat-bubble.ts b/src/components/chat-bubble.ts
index 3bb617ce01..3ef6dbdfe9 100644
--- a/src/components/chat-bubble.ts
+++ b/src/components/chat-bubble.ts
@@ -13,8 +13,11 @@ export const SIMPLE_BUBBLE_TEXT = "text-[15px] leading-[22px]";
const SIMPLE_BUBBLE_SHAPE = `min-w-9 rounded-[18px] px-3 py-[7px] ${SIMPLE_BUBBLE_TEXT}`;
-/** Simple mode's bot bubble: the one surface tone. */
-export const SIMPLE_BOT_BUBBLE = `${SIMPLE_BUBBLE_SHAPE} bg-card text-ink`;
+/** A bot's bubble finish on a light ground: a top-lit sheen and a 0.5px inset line of ink (styles.css, DESIGN §8). */
+export const BOT_BUBBLE_FINISH = "bubble-finish";
+
+/** Simple mode's bot bubble: the one surface tone, finished. */
+export const SIMPLE_BOT_BUBBLE = `${SIMPLE_BUBBLE_SHAPE} bg-card ${BOT_BUBBLE_FINISH} text-ink`;
/** Simple mode's own bubble; the bot's colour, when on, comes from its inline style. */
export const SIMPLE_USER_BUBBLE = `${SIMPLE_BUBBLE_SHAPE} bg-bubble-user font-normal`;
@@ -26,23 +29,22 @@ export const SIMPLE_BUBBLE_MAX = "max-w-[min(var(--chat-bubble-max),var(--chat-b
export function plainBotBubble(simple: boolean): string {
return simple
? cn("chat-text w-fit whitespace-pre-wrap", SIMPLE_BUBBLE_MAX, SIMPLE_BOT_BUBBLE)
- : "chat-text w-fit max-w-[min(var(--chat-bubble-max),var(--chat-bubble-pct))] rounded-2xl bg-card px-4 py-2.5 text-[15px] leading-relaxed whitespace-pre-wrap text-ink";
+ : `chat-text w-fit max-w-[min(var(--chat-bubble-max),var(--chat-bubble-pct))] rounded-2xl bg-card ${BOT_BUBBLE_FINISH} px-4 py-2.5 text-[15px] leading-relaxed whitespace-pre-wrap text-ink`;
}
/** Simple mode's transcript spaces rows 16px apart (ChatView's data-simple-rows); a row in the same group pulls up 12px, to 4px. */
export const SIMPLE_STACKED = "-mt-3";
-/** Where a Simple bubble meets its group's neighbours: those corners tighten to 6px on the bubble's own side. */
+/** Where a Simple bubble meets its group's neighbours. */
export interface BubbleJoin {
above: boolean;
below: boolean;
}
+/** A bubble in a run of its sender's bubbles keeps a tail: its bottom corner on its own side tightens to 6px
+ * (18 18 18 6 for a bot, mirrored for the person), and its top corners stay round. A lone bubble stays round. */
export function joinedCorners(side: "start" | "end", join: BubbleJoin): string {
- return cn(
- join.above && (side === "start" ? "rounded-ss-[6px]" : "rounded-se-[6px]"),
- join.below && (side === "start" ? "rounded-es-[6px]" : "rounded-ee-[6px]"),
- );
+ return cn((join.above || join.below) && (side === "start" ? "rounded-es-[6px]" : "rounded-ee-[6px]"));
}
/** Which bubble group a transcript row belongs to in Simple mode: this bot's words, the person's own words, or none. */
diff --git a/src/components/composer-simple.ts b/src/components/composer-simple.ts
index f9468ae1c6..9e1fa9fa26 100644
--- a/src/components/composer-simple.ts
+++ b/src/components/composer-simple.ts
@@ -2,12 +2,13 @@ import type { Bot, Group } from "@/state/store";
import { effectiveDefaultResponder, groupComposerHint } from "@/lib/group-routing";
import { t } from "@/lib/i18n";
import { BOT_BUTTON, botButtonStyle, botButtonTone, type BotButton } from "@/lib/bot-button";
+import { ELEVATED_COMPOSER } from "./elevated";
/** Simple mode's composer pill on a wider screen: the field, the mic and the round button in one shell. */
-export const SIMPLE_COMPOSER = "bg-composer p-2 ring-[0.5px] ring-ink/10 hover:ring-ink/[0.22] focus-within:ring-ink/[0.22] shadow-[0_2px_8px_-1px_rgb(0_0_0/0.05),0_1px_2px_rgb(0_0_0/0.03),0_0_0_1px_rgb(228_228_228/0.04)] [transition:border-radius_300ms,box-shadow_150ms]";
+export const SIMPLE_COMPOSER = `${ELEVATED_COMPOSER} p-2 hover:ring-ink/[0.22] focus-within:ring-ink/[0.22] [transition:border-radius_300ms,box-shadow_150ms]`;
/** Simple mode's small round controls in the composer: the +, the mic and Stop beside the round button. */
-export const SIMPLE_CONTROL = "size-7 rounded-full bg-ink/[0.05] ring-[0.5px] ring-inset ring-ink/[0.07] text-ink-tertiary hover:bg-ink/[0.09] hover:text-ink";
+export const SIMPLE_CONTROL = "size-7 rounded-full bg-ink/[0.06] inset-ring-[0.5px] inset-ring-ink/[0.08] text-ink-tertiary hover:bg-ink/[0.09] hover:text-ink";
const ROOM_FILL = { fill: "var(--color-accent)", ink: "var(--color-accent-ink)" };
diff --git a/src/components/elevated.ts b/src/components/elevated.ts
index 805bdf45f2..ba229da154 100644
--- a/src/components/elevated.ts
+++ b/src/components/elevated.ts
@@ -2,6 +2,8 @@ export const ELEVATED_CONTROL = "bg-composer ring-1 ring-inset ring-ink/[0.07]";
/** A card in the conversation, a question or an approval: the floating surface, resting on the page without a shadow. */
export const ELEVATED_CARD = "bg-composer ring-[0.5px] ring-ink/10";
export const ELEVATED_FLOAT = `${ELEVATED_CARD} shadow-(--shadow-float)`;
+/** The composer: the floating surface on its own softer lift. Daylight drops the 0.5px ring at rest (styles.css). */
+export const ELEVATED_COMPOSER = `${ELEVATED_CARD} composer-shell shadow-(--shadow-composer)`;
/** The hover tint alone, for a control whose aria-expanded is not a menu of its own. */
export const ELEVATED_TINT = "transition-colors duration-[120ms] hover:bg-[color-mix(in_srgb,var(--color-composer),var(--color-ink)_7%)]";
export const ELEVATED_HOVER = `${ELEVATED_TINT} aria-expanded:bg-[color-mix(in_srgb,var(--color-composer),var(--color-ink)_7%)]`;
diff --git a/src/lib/chat-finish-styles.test.ts b/src/lib/chat-finish-styles.test.ts
new file mode 100644
index 0000000000..d2dfd4f331
--- /dev/null
+++ b/src/lib/chat-finish-styles.test.ts
@@ -0,0 +1,68 @@
+// The chat and composer finish: the composer's lift, the bot bubble's sheen and the press feedback, read from the
+// stylesheet so a skin block never has to repeat them (skins.test.ts keeps every skin's token set equal).
+import { readFileSync } from "node:fs";
+import { fileURLToPath } from "node:url";
+import { dirname, join } from "node:path";
+import { describe, expect, it } from "vitest";
+import { ELEVATED_COMPOSER, ELEVATED_FLOAT } from "@/components/elevated";
+import { SIMPLE_COMPOSER, SIMPLE_CONTROL } from "@/components/composer-simple";
+
+const css = readFileSync(join(dirname(fileURLToPath(import.meta.url)), "../styles.css"), "utf8");
+const squash = (text: string) => text.replace(/\s+/g, " ");
+const flat = squash(css);
+const skinBlocks = [...css.matchAll(/\[data-skin="[a-z-]+"\]\s*\{([^}]*)\}/g)].map(([, body]) => body!);
+
+describe("the composer's lift", () => {
+ it("defines --shadow-composer once, on :root, and in no skin block", () => {
+ expect(flat).toContain("--shadow-composer: 0 2px 8px -1px rgb(0 0 0 / 0.05), 0 1px 2px rgb(0 0 0 / 0.03), 0 0 0 1px rgb(28 28 28 / 0.04);");
+ expect(css.match(/--shadow-composer:/g)).toHaveLength(1);
+ for (const body of skinBlocks) expect(body).not.toContain("--shadow-composer");
+ });
+
+ it("puts both modes' composer on it, with the ring kept for hover and focus", () => {
+ expect(ELEVATED_COMPOSER.split(" ")).toEqual(expect.arrayContaining(["bg-composer", "ring-[0.5px]", "ring-ink/10", "composer-shell", "shadow-(--shadow-composer)"]));
+ expect(SIMPLE_COMPOSER.split(" ")).toEqual(expect.arrayContaining([...ELEVATED_COMPOSER.split(" "), "hover:ring-ink/[0.22]", "focus-within:ring-ink/[0.22]"]));
+ expect(SIMPLE_COMPOSER).not.toContain("228_228_228");
+ });
+
+ it("drops the resting ring in Daylight only", () => {
+ expect(flat).toContain(':root[data-skin="daylight"] .composer-shell:not(:hover, :focus-within) { --tw-ring-color: transparent; }');
+ expect(flat.match(/\.composer-shell[^{]*\{/g)).toHaveLength(1);
+ });
+});
+
+describe("the chat header's pill and controls", () => {
+ it("float on --shadow-float, which only Daylight fills in", () => {
+ expect(ELEVATED_FLOAT.split(" ")).toContain("shadow-(--shadow-float)");
+ expect(flat).toContain("--shadow-float: 0 4px 12px -1px rgb(28 28 28 / 0.08), 0 2px 4px -2px rgb(28 28 28 / 0.06);");
+ });
+});
+
+describe("the composer's round controls", () => {
+ it("sit on ink at 6% with an inset 0.5px line of ink at 8%, and keep the tertiary ink", () => {
+ expect(SIMPLE_CONTROL.split(" ")).toEqual(expect.arrayContaining(["bg-ink/[0.06]", "inset-ring-[0.5px]", "inset-ring-ink/[0.08]", "text-ink-tertiary"]));
+ // `ring-inset` would also read as a ring in the `inset` colour token and hide the ink line, so the inset-ring
+ // utilities draw it.
+ expect(SIMPLE_CONTROL.split(" ")).not.toContain("ring-inset");
+ });
+});
+
+describe("a bot's bubble finish", () => {
+ it("is a top-lit sheen and three inset half-pixel lines, off on a dark ground", () => {
+ expect(flat).toContain(".bubble-finish { background-image: linear-gradient(rgb(255 255 255 / 0.16), transparent); box-shadow: inset 0 0.5px 0 rgb(255 255 255 / 0.16), inset 0 -0.5px 0 rgb(255 255 255 / 0.16), inset 0 0 0 0.5px color-mix(in srgb, var(--color-ink) 6%, transparent); }");
+ expect(flat).toContain("@container style(--code-color-scheme: dark) { .bubble-finish { background-image: none; box-shadow: none; } }");
+ });
+});
+
+describe("press feedback", () => {
+ it("shrinks buttons to 98% over 50ms, only when motion is allowed", () => {
+ expect(flat).toContain("transition: background-color 120ms ease, color 120ms ease, transform 50ms cubic-bezier(0.165, 0.84, 0.44, 1);");
+ expect(flat).toContain('@media (prefers-reduced-motion: no-preference) { :root:not([data-reduced-motion="true"]) :is(.ui-button, .ui-icon-button):not(:disabled):active { transform: scale(0.98); } }');
+ });
+
+ it("shrinks the sidebar's bot rows the same way, but not when a button inside the row is pressed", () => {
+ expect(flat).toContain('@media (prefers-reduced-motion: no-preference) { :root:not([data-reduced-motion="true"]) [data-sidebar-bot-row]:active:not(:has(button:active)) { scale: 0.98; } }');
+ expect(flat).toMatch(/\[data-sidebar-bot-row\] \{ transition-property: [^;]*scale; transition-duration: [^;]*50ms;/);
+ expect(flat).toContain(":root[data-reduced-motion=\"true\"] [data-sidebar-bot-row] { transition: none; }");
+ });
+});
diff --git a/src/styles.css b/src/styles.css
index 3464b82d5f..ab840b5fc6 100644
--- a/src/styles.css
+++ b/src/styles.css
@@ -257,6 +257,14 @@
/* second speed line of the mascot — contrasts against the app ground */
--color-maus-line: #f5f5f5;
--shadow-float: 0 0 #0000;
+ /* The composer floats over the scrolling transcript: a soft lift with a 1px line of ink at 4%. One value for every
+ skin; on a dark ground it reads as nothing, so the dark skins keep their 0.5px ring alone. */
+ --shadow-composer: 0 2px 8px -1px rgb(0 0 0 / 0.05), 0 1px 2px rgb(0 0 0 / 0.03), 0 0 0 1px rgb(28 28 28 / 0.04);
+}
+/* Daylight's composer rests on that lift alone; its 0.5px ring comes back on hover and while it holds focus.
+ Unlayered, so it wins over the ring utility the shell carries. */
+:root[data-skin="daylight"] .composer-shell:not(:hover, :focus-within) {
+ --tw-ring-color: transparent;
}
/* ── Midnight ──────────────────────────────────────────────────────────────
@@ -1423,7 +1431,8 @@ body {
font-size: 13px;
font-weight: 500;
line-height: 1.25rem;
- transition: background-color 120ms ease, color 120ms ease;
+ /* transform: the press feedback below */
+ transition: background-color 120ms ease, color 120ms ease, transform 50ms cubic-bezier(0.165, 0.84, 0.44, 1);
}
.ui-button {
/* 4px + 20px line + 4px + a 1px border each side = 30px, so the 32px
@@ -1618,7 +1627,46 @@ body {
.ui-icon-button,
.ui-pill { transition: none; }
}
+ /* Press feedback: a button gives a little under the pointer, 98% over 50ms, and not at all with reduced motion
+ (DESIGN §10). Layered, so Pop's own sticker press still wins on its buttons. */
+ @media (prefers-reduced-motion: no-preference) {
+ :root:not([data-reduced-motion="true"]) :is(.ui-button, .ui-icon-button):not(:disabled):active {
+ transform: scale(0.98);
+ }
+ }
+ /* A bot's bubble on a light ground: its tint, a top-lit sheen and a 0.5px inset line of ink at 6% (DESIGN §8).
+ A dark ground keeps the flat tint: there the sheen would lift the bubble's top edge out of its tone. Layered, so
+ Pop's sticker outline on .bg-card still wins. */
+ .bubble-finish {
+ background-image: linear-gradient(rgb(255 255 255 / 0.16), transparent);
+ box-shadow:
+ inset 0 0.5px 0 rgb(255 255 255 / 0.16),
+ inset 0 -0.5px 0 rgb(255 255 255 / 0.16),
+ inset 0 0 0 0.5px color-mix(in srgb, var(--color-ink) 6%, transparent);
+ }
+ @container style(--code-color-scheme: dark) {
+ .bubble-finish { background-image: none; box-shadow: none; }
+ }
+}
+
+/* The sidebar's bot rows and pinned bots give under the pointer like a button (98% over 50ms), but not while a
+ button inside the row is the one pressed. The colour fade the rows already had is repeated here, because this
+ transition replaces theirs. */
+[data-sidebar-bot-row] {
+ transition-property: color, background-color, border-color, outline-color, fill, stroke, scale;
+ transition-duration: 150ms, 150ms, 150ms, 150ms, 150ms, 150ms, 50ms;
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1), cubic-bezier(0.4, 0, 0.2, 1), cubic-bezier(0.4, 0, 0.2, 1),
+ cubic-bezier(0.4, 0, 0.2, 1), cubic-bezier(0.4, 0, 0.2, 1), cubic-bezier(0.4, 0, 0.2, 1), cubic-bezier(0.165, 0.84, 0.44, 1);
+}
+@media (prefers-reduced-motion: no-preference) {
+ :root:not([data-reduced-motion="true"]) [data-sidebar-bot-row]:active:not(:has(button:active)) {
+ scale: 0.98;
+ }
+}
+@media (prefers-reduced-motion: reduce) {
+ [data-sidebar-bot-row] { transition: none; }
}
+:root[data-reduced-motion="true"] [data-sidebar-bot-row] { transition: none; }
/* Liquid glass: the surface for centred pop-ups (Settings, Apps, Triggers).
Every value is derived from the active skin's own tokens, so each of the