mirror of
https://github.com/bitbaum/chatkit.git
synced 2026-12-04 01:07:20 +01:00
* fix(styles): starters are one column at every width (0.31.3) The empty chat's starters wrapped into a row of pills. A row of choices is never wrapping pills (fleet AGENTS.md, "One shape per kind"; OrangeCat UX audit 2026-11-12, auth-firstrun#5). .ck-starters-list is now a column and each .ck-starter a full-width, left-aligned, 44px row. Checked in test/styles.test.js and test/browser-app.mjs at 390px and 1440px. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvT2nQyPBK4EfWf3Rn * fix(messenger): a message's actions by keyboard; alone with an agent every message is for it, and its answer reads it - The actions button of a message was display:none until hovered, so Tab never reached it and Edit and Delete had no way in without a mouse. It is hidden by opacity now, takes focus, is 44px, and stays on the screen on a phone. Long press and right click are unchanged. - soleAgent(): one person and one agent. There the empty conversation says the agent answers every message, Ask <agent> is not offered, and a message starts the wait for a named agent without naming it. - receiptOf(): where only agents could read a message, it is read once an agent's own read mark is past it. A conversation with only an agent stayed at Sent for ever. - An awaited agent is not also shown typing. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvT2nQyPBK4EfWf3Rn * chore(release): 0.35.0 Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvT2nQyPBK4EfWf3Rn * test(app): a 44px control measured mid-slide is not a small target Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvT2nQyPBK4EfWf3Rn --------- Co-authored-by: Claude <noreply@anthropic.com>
100 lines
4.3 KiB
JavaScript
100 lines
4.3 KiB
JavaScript
import assert from "node:assert/strict";
|
|
import { readFileSync } from "node:fs";
|
|
import { gzipSync } from "node:zlib";
|
|
import { test } from "node:test";
|
|
|
|
const source = readFileSync(new URL("../styles.css", import.meta.url), "utf8");
|
|
const embedded = readFileSync(new URL("../styles/chat.css", import.meta.url), "utf8");
|
|
const messenger = readFileSync(new URL("../styles/messenger.css", import.meta.url), "utf8");
|
|
const appMarker = "/* ── ChatApp: the whole app";
|
|
const appBoundary = source.indexOf(appMarker);
|
|
const messengerMarker = "/* ── Messenger: people talking to people";
|
|
const messengerBoundary = source.indexOf(messengerMarker);
|
|
|
|
test("embedded stylesheet is generated from the shared chat styles", () => {
|
|
assert.notEqual(appBoundary, -1, "the full stylesheet marks ChatApp-only styles");
|
|
assert.equal(embedded, source.slice(0, appBoundary).trimEnd() + "\n");
|
|
});
|
|
|
|
test("embedded stylesheet includes shared chat surfaces and excludes ChatApp chrome", () => {
|
|
for (const selector of [".ck-composer", ".ck-thread", ".ck-rich", ".ck-choice"]) {
|
|
assert.ok(embedded.includes(selector), `${selector} remains styled`);
|
|
}
|
|
assert.ok(!embedded.includes(".ck-app-rail"), "the full app's history rail is not embedded");
|
|
assert.ok(
|
|
!embedded.includes(".ck-field-wrap"),
|
|
"DictationField is not a chat surface: not embedded",
|
|
);
|
|
assert.ok(
|
|
!embedded.includes(".ck-comments"),
|
|
"CommentThread is not a chat surface: not embedded",
|
|
);
|
|
for (const selector of [
|
|
".ck-field-wrap",
|
|
".ck-field-input",
|
|
".ck-comments",
|
|
".ck-comment-body",
|
|
]) {
|
|
assert.ok(
|
|
source.slice(appBoundary).includes(selector),
|
|
`${selector} is styled in the full sheet`,
|
|
);
|
|
}
|
|
assert.ok(source.slice(appBoundary).includes(".ck-app-rail"), "full ChatApp styling remains");
|
|
});
|
|
|
|
test("embedded stylesheet stays within its compressed transfer budget", () => {
|
|
assert.ok(
|
|
gzipSync(embedded).byteLength <= 11_000,
|
|
`embedded stylesheet is ${gzipSync(embedded).byteLength} bytes gzipped (budget 11,000)`,
|
|
);
|
|
});
|
|
|
|
test("the Messenger's sheet is the embedded sheet plus its own section, and nothing of ChatApp", () => {
|
|
assert.ok(
|
|
messengerBoundary > appBoundary,
|
|
"the Messenger section sits after the ChatApp boundary",
|
|
);
|
|
assert.equal(messenger, embedded + "\n" + source.slice(messengerBoundary).trimEnd() + "\n");
|
|
for (const selector of [".ck-msgr", ".ck-msgr-bubble", ".ck-composer-inline", ".ck-sheet"]) {
|
|
assert.ok(messenger.includes(selector), `${selector} is styled in the Messenger's sheet`);
|
|
}
|
|
assert.ok(
|
|
!messenger.includes(".ck-app-rail"),
|
|
"ChatApp's chat list is not in the Messenger's sheet",
|
|
);
|
|
assert.ok(!embedded.includes(".ck-msgr"), "the Messenger is not in the embedded chat sheet");
|
|
assert.ok(
|
|
embedded.includes(".ck-composer-inline"),
|
|
"the one-row composer is a composer: embedded",
|
|
);
|
|
});
|
|
|
|
test("message text is 16px and wraps a long address without widening the thread", () => {
|
|
assert.match(source, /\.ck-msgr-bubble\s*\{[^}]*font-size:\s*max\(16px/);
|
|
assert.match(source, /\.ck-msgr-bubble\s*\{[^}]*overflow-wrap:\s*break-word/);
|
|
assert.match(source, /\.ck-msgr-search > input\s*\{[^}]*font-size:\s*max\(16px/);
|
|
});
|
|
|
|
test("starters are one column at every width, never wrapping pills", () => {
|
|
assert.match(source, /\.ck-starters-list\s*\{[^}]*flex-direction:\s*column/);
|
|
assert.doesNotMatch(source, /\.ck-starters-list\s*\{[^}]*flex-wrap:\s*wrap/);
|
|
assert.match(source, /\.ck-starter\s*\{[^}]*width:\s*100%/);
|
|
assert.match(source, /\.ck-starter\s*\{[^}]*min-height:\s*var\(--ck-target\)/);
|
|
assert.match(source, /\.ck-starter\s*\{[^}]*text-align:\s*left/);
|
|
});
|
|
|
|
test("a message's actions button can take focus: hidden by opacity, never by display", () => {
|
|
const rule = (css, selector) => {
|
|
const at = css.indexOf(`\n${selector} {`);
|
|
assert.notEqual(at, -1, `${selector} is styled`);
|
|
return css.slice(at, css.indexOf("}", at));
|
|
};
|
|
const act = rule(messenger, ".ck-msgr-act");
|
|
assert.doesNotMatch(act, /display:\s*none/, "a button that is not drawn cannot be tabbed to");
|
|
assert.match(act, /opacity:\s*0/);
|
|
assert.match(act, /width:\s*2\.75rem/, "a 44px target");
|
|
assert.match(act, /height:\s*2\.75rem/);
|
|
assert.match(rule(messenger, ".ck-msgr-act:focus-visible"), /opacity:\s*1/);
|
|
});
|