feat(webui): add reading text size preferences (#6325)

* feat(webui): add reading text size preferences

* fix(webui): align loading skeletons with reading typography
This commit is contained in:
chengyongru authored and GitHub committed 2026-10-20 16:33:05 +08:00
1 parent 816c9221a0
commit 282839cc65
48 files changed
+662 -120

No files matched your search

+5 -5
View File
@@ -10,7 +10,7 @@ import { Input } from "@/components/ui/input";
import { Textarea } from "@/components/ui/textarea";
describe("touch form typography", () => {
it("keeps the touch baseline on compact shared fields without changing desktop classes", () => {
it("keeps the touch baseline and desktop text roles on compact shared fields", () => {
render(<>
<Input aria-label="Name" />
<Input aria-label="Address" className="text-[13px]" />
@@ -19,7 +19,7 @@ describe("touch form typography", () => {
for (const field of screen.getAllByRole("textbox")) {
expect(field).toHaveClass("touch-text-input");
}
expect(screen.getByLabelText("Name")).toHaveClass("text-sm");
expect(screen.getByLabelText("Name")).toHaveClass("text-ui-body");
expect(screen.getByLabelText("Address")).toHaveClass("text-[13px]");
expect(screen.getByLabelText("Pairing code")).toHaveClass("text-xs", "font-mono");
});
@@ -28,20 +28,20 @@ describe("touch form typography", () => {
const config = loadConfig(resolve(process.cwd(), "tailwind.config.js"));
const source = readFileSync(resolve(process.cwd(), "src/globals.css"), "utf8");
const result = await postcss([tailwindcss({ ...config, content: [{
raw: 'class="touch-text-input text-xs text-sm text-[13px] text-[19px]"',
raw: 'class="touch-text-input text-xs text-sm text-ui-body text-[13px] text-[19px]"',
}] })]).process(source, { from: undefined });
let baseline = -1;
let index = 0;
const compact: number[] = [];
result.root.walkRules((rule) => {
index++;
if ([".text-xs", ".text-sm", ".text-\\[13px\\]"].includes(rule.selector)) compact.push(index);
if ([".text-xs", ".text-sm", ".text-ui-body", ".text-\\[13px\\]"].includes(rule.selector)) compact.push(index);
if (rule.selector !== ".touch-text-input") return;
baseline = index;
expect(rule.parent).toMatchObject({ type: "atrule", name: "media", params: "(pointer: coarse)" });
expect(rule.nodes).toContainEqual(expect.objectContaining({ prop: "font-size", value: "max(16px, 1rem)" }));
});
expect(compact).toHaveLength(3);
expect(compact).toHaveLength(4);
expect(baseline).toBeGreaterThan(Math.max(...compact));
});
});