mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-14 02:29:33 +01:00
style(local-model): white for the feature, built like the primary launcher
The violet button was the one thing on the start screen outside the app's blue, and it carried white text and a see-through disc where its neighbour has dark ink and a solid disc. It is now white with dark ink and a solid disc, the same on the Install button, and the chooser's selected row, tile and model bar follow. Light skins turn it over to dark, since a white button vanishes on a pale page. The context takes the app's blue. The tokens are named for what they mean now (--lm-brand, --lm-context). Brings test/local-model-ui.browser.test.ts up to the redesign it had fallen behind: it is outside the gate, so the button's 46 px, the 12 px bar and the memory panel's edges had gone unnoticed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
aa76b1b304
commit
be8fc2980a
3 files changed
+85
-61
No files matched your search
@@ -7,9 +7,9 @@
|
||||
* same edge, under their captions, and every tag starts on the same edge;
|
||||
* - a row is one line on a desktop and two lines under 560px, where nothing runs off the
|
||||
* side and the buttons take the full width;
|
||||
* - the memory bar is 10px high and filled to the selected model's share of its track, and
|
||||
* - the memory bar is 12px high and filled to the selected model's share of its track, and
|
||||
* the fill follows the selection;
|
||||
* - the selected row carries the accent on its reading edge;
|
||||
* - the selected row carries the feature's colour on its reading edge;
|
||||
* - the welcome button is really gone while it is `hidden`, and the window paints above App
|
||||
* Settings.
|
||||
*
|
||||
@@ -218,8 +218,8 @@ describe('the local model window (real Chromium)', () => {
|
||||
await load(1440);
|
||||
const [button] = await boxes('#welcomeLocalModelBtn');
|
||||
expect(button.width).toBeGreaterThan(100);
|
||||
// One more chip of the launcher family: the same height as the chips above it would have.
|
||||
expect(Math.round(button.height)).toBe(30);
|
||||
// The first thing on the start screen, in the size of the primary launcher below it.
|
||||
expect(Math.round(button.height)).toBe(46);
|
||||
expect(await p.textContent('#welcomeLocalModelLabel')).toBe('Run a local model');
|
||||
});
|
||||
|
||||
@@ -250,12 +250,14 @@ describe('the local model window (real Chromium)', () => {
|
||||
expect(names[i].right).toBeLessThanOrEqual(tags[i].left + 0.6);
|
||||
expect(speeds[i].right).toBeLessThanOrEqual(sizes[i].left + 0.6);
|
||||
}
|
||||
// What is in a row lines up with the rest of the window on both edges.
|
||||
// The memory panel lines up with the rows on both edges, and the bar with its figure.
|
||||
const [figure] = await boxes('.lm-figure');
|
||||
const [radio] = await boxes('.lm-radio');
|
||||
const [bar] = await boxes('.lm-bar');
|
||||
expect(same([figure.left, radio.left, bar.left])).toBe(true);
|
||||
expect(same([bar.right, sizes[0].right])).toBe(true);
|
||||
const [meter] = await boxes('.lm-meter');
|
||||
expect(same([figure.left, bar.left])).toBe(true);
|
||||
expect(same([meter.left, radio.left])).toBe(true);
|
||||
expect(same([meter.right, sizes[0].right])).toBe(true);
|
||||
});
|
||||
|
||||
it('fills the bar to the selected model, and the fill follows the selection', async () => {
|
||||
@@ -264,8 +266,8 @@ describe('the local model window (real Chromium)', () => {
|
||||
const share = async () => {
|
||||
const [track] = await boxes('.lm-bar');
|
||||
const [fill] = await boxes('.lm-bar-fill');
|
||||
expect(Math.round(track.height)).toBe(10);
|
||||
expect(Math.round(fill.height)).toBe(10);
|
||||
expect(Math.round(track.height)).toBe(12);
|
||||
expect(Math.round(fill.height)).toBe(12);
|
||||
expect(same([track.left, fill.left])).toBe(true);
|
||||
return fill.width / track.width;
|
||||
};
|
||||
@@ -287,9 +289,14 @@ describe('the local model window (real Chromium)', () => {
|
||||
// The track is not the window's own colour, or the free part could not be seen.
|
||||
const paint = await p.evaluate(() => {
|
||||
const css = (sel: string, prop: string) => getComputedStyle(document.querySelector(sel)!).getPropertyValue(prop);
|
||||
// The feature's colour as the browser paints it: a custom property reads back unresolved.
|
||||
const probe = document.body.appendChild(document.createElement('i'));
|
||||
probe.style.color = 'var(--lm-brand)';
|
||||
const brand = getComputedStyle(probe).color;
|
||||
probe.remove();
|
||||
return {
|
||||
brand,
|
||||
track: css('.lm-bar', 'background-color'),
|
||||
fill: css('.lm-bar-fill', 'background-color'),
|
||||
fillImage: css('.lm-bar-fill', 'background-image'),
|
||||
window: css('.local-model-window', 'background-color'),
|
||||
edge: css('.lm-model-on', 'border-left-color'),
|
||||
@@ -297,11 +304,12 @@ describe('the local model window (real Chromium)', () => {
|
||||
};
|
||||
});
|
||||
expect(paint.track).not.toBe(paint.window);
|
||||
expect(paint.track).not.toBe(paint.fill);
|
||||
expect(paint.fillImage).toBe('none');
|
||||
// The selected row carries the accent (the fill's colour) on its reading edge.
|
||||
expect(paint.edge).toBe(paint.fill);
|
||||
expect(paint.idleEdge).not.toBe(paint.fill);
|
||||
expect(paint.track).not.toBe(paint.brand);
|
||||
// Without a memory map the one fill runs from the feature's colour to the context's.
|
||||
expect(paint.fillImage).toContain('linear-gradient');
|
||||
// The selected row carries the feature's colour on its reading edge.
|
||||
expect(paint.edge).toBe(paint.brand);
|
||||
expect(paint.idleEdge).not.toBe(paint.brand);
|
||||
});
|
||||
|
||||
it('stacks two lines a row under 560px, with nothing running off the side', async () => {
|
||||
@@ -323,10 +331,10 @@ describe('the local model window (real Chromium)', () => {
|
||||
const [win] = await boxes('.local-model-window');
|
||||
expect(Math.round(win.width)).toBe(390);
|
||||
expect(Math.round(win.height)).toBe(844);
|
||||
const [bar] = await boxes('.lm-bar');
|
||||
const [meter] = await boxes('.lm-meter');
|
||||
const [button] = await boxes('.lm-buttons button');
|
||||
expect(same([bar.left, button.left])).toBe(true);
|
||||
expect(same([bar.right, button.right])).toBe(true);
|
||||
expect(same([meter.left, button.left])).toBe(true);
|
||||
expect(same([meter.right, button.right])).toBe(true);
|
||||
expect(button.height).toBeGreaterThanOrEqual(44);
|
||||
const overflow = await p.evaluate(() => {
|
||||
const body = document.getElementById('localModelWindowBody')!;
|
||||
|
||||
Reference in new issue
Block a user