Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 18 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,25 @@ variables), the agent client the dashboard frames (the T3 Code fork's variables)
else (`dist/tokens.json`).

**[See it](https://spin-stack.github.io/brand/)**: `index.html` is the laboratory.
It draws the site's landing and a docs page, the dashboard's workspaces with their states, a
dialog and a toast; where the app as it is is shown; the mark's guide -
sizes, clear space, the lockup, the grounds it goes on and what it is not; the type scale in both
faces and the three weights; the palette by what each color is for; and the same page at a
phone's and a tablet's width - in dark or light and through protanopia, deuteranopia or
tritanopia, with every pair the palette is held to.

Two pages beside it are tests a team runs by opening them, with nothing to install and nothing
sent anywhere: each counts its answers in the browser it is opened in.
It draws the site's landing and a docs page; the console's Workspaces and Inbox; where the app as
it is is shown; the mark's guide - sizes, clear space, the lockup, the grounds it goes on and what
it is not; the type scale in both faces, a dashboard page's ranks and the three weights; the
console's buttons in each state, its states, rows and cards; the palette by what each color is
for; and the same page at a phone's and a tablet's width - in dark or light and through
protanopia, deuteranopia or tritanopia, with every pair the palette is held to.

[`target.html`](https://spin-stack.github.io/brand/target.html) is the console's destination:
six screens every migration of the dashboard is measured against (`target/README.md`). Two pages
beside it are tests a team runs by opening them, with nothing to install and nothing sent
anywhere: each counts its answers in the browser it is opened in.
[`five-seconds.html`](https://spin-stack.github.io/brand/five-seconds.html) is the check
`palette.toml` names for dark's cyan fill: the workspace list or a settings page for five
seconds, with one filled button or with three, then "what did you see first?".
[`recognition.html`](https://spin-stack.github.io/brand/recognition.html) shows three screens
with the mark and the name taken out, in the brand and in the grey of the same lightness with a
system font, and asks whose product it is and which you would work in all day. `lab.css` and
`lab.js` are the components and the screens the three pages share.
`palette.toml` names for a page's verdict: the destination's Workspaces for five seconds, in dark
or in light, then "what did you see first?" - the panel with its verdict, or its one filled
button. [`recognition.html`](https://spin-stack.github.io/brand/recognition.html) shows the
destination's Inbox, Workspaces and Overview with the mark and the name taken out, in the brand
and in the grey of the same lightness with a system font, and asks whose product it is and which
you would work in all day. `lab.css` and `lab.js` are the console every one of these pages draws:
its components, inside an element of class `app`, and its screens.

| Source | What it makes |
|---|---|
Expand Down
4 changes: 2 additions & 2 deletions cmd/palette/outputs.go
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ func hsl(c rgb) string {
return fmt.Sprintf("%.1f %.1f%% %.1f%%", h, s*100, l*100)
}

// perceptionJS is every pair and how it held, for preview.html's table.
// perceptionJS is every pair and how it held, for index.html's table.
func perceptionJS(results []result) string {
type row struct {
Mode, Kind, What string
Expand All @@ -774,7 +774,7 @@ func perceptionJS(results []result) string {
return "// Written by `task palette`: every pair palette.toml is held to, and how it held.\nexport const perception = " + string(b) + ";\n"
}

// simulateSVG is each deficiency's matrix as an SVG filter, for preview.html's "See as": the
// simulateSVG is each deficiency's matrix as an SVG filter, for index.html's "See as": the
// same matrices the checks use, applied in linear RGB as the model is.
func simulateSVG() string {
var b strings.Builder
Expand Down
145 changes: 67 additions & 78 deletions five-seconds.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,147 +9,136 @@
<link rel="stylesheet" href="dist/tokens.css">
<link rel="stylesheet" href="lab.css">
<style>
/* The five-second test (spin-stack/brand#45): the check palette.toml names for dark's cyan fill.
Dark only: it is dark's accent that can out-rank a page's title. The screens and every control
are lab.css's; a color here that is not a token is a bug. */
/* The five-second test (spin-stack/brand#45): the check palette.toml names for a page's verdict and
its one fill. The screen is lab.js's, in lab.css's components; a colour here that is not a token
is a bug. */
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--spin-page); color: var(--spin-text); font: var(--spin-text-reading)/var(--spin-line-height) var(--spin-font-sans); }
a { color: var(--spin-accent-text); text-underline-offset: .2em; }
:focus-visible { outline: 2px solid var(--spin-accent-text); outline-offset: 2px; }
code { font-family: var(--spin-font-mono); font-size: .9em; }
[hidden] { display: none !important; }
/* A screen being looked at does not answer the pointer, which is still where the button that
showed it was: a row under it would be drawn hovered, with its actions, and be the first thing
seen. */
showed it was: a row under it would be drawn hovered and be the first thing seen. */
.stage.timed { cursor: none; }
.stage.timed .view { pointer-events: none; }
</style>
</head>
<body>
<main class="sheet" id="sheet" aria-live="polite"></main>
<div class="stage" id="stage" hidden><div class="view" id="view"></div><div class="hud" id="hud" hidden><span>Not counted: a look at one of the four screens.</span><span class="grow"></span><a href="five-seconds.html">Back to the test</a></div></div>
<div class="stage" id="stage" hidden><div class="view" id="view"></div><div class="hud" id="hud" hidden><span>Not counted: a look at the screen.</span><span class="grow"></span><a href="five-seconds.html">Back to the test</a></div></div>

<script type="module">
import { app, screens, store } from './lab.js';
import { screens, shell, store } from './lab.js';

// The four screens: two pages, each with the one filled action the palette allows and with three.
const variants = {
'list-one': { screen: 'list', fills: 1, name: 'The list, one filled' },
'list-three': { screen: 'list', fills: 3, name: 'The list, three filled' },
'settings-one': { screen: 'settings', fills: 1, name: 'Settings, one filled' },
'settings-three': { screen: 'settings', fills: 3, name: 'Settings, three filled' },
};
// What a person sees, in order: each page once, in one version of each, so nobody's first look at
// a page is spent twice and nobody answers for both versions of one page. Over four people every
// screen is seen first once and second once.
const plans = [
['list-one', 'settings-three'],
['settings-one', 'list-three'],
['list-three', 'settings-one'],
['settings-three', 'list-one'],
];
// The screen: Workspaces as the target draws it, its verdict on the spot and its one fill, New
// workspace, in the bar over it. Each person sees it once, in one theme: the spot is a dark plane
// in either, on a navy page in dark and on a grey one in light, and the fill is the cyan in both.
const themes = { dark: 'In dark', light: 'In light' };
const answers = {
title: () => "The page's title",
button: () => 'A button',
row: (v) => (v.screen === 'list' ? 'A row of the list' : 'A row of settings'),
sidebar: () => 'The sidebar',
other: () => 'Something else',
verdict: 'The panel with a sentence and figures',
button: 'A button',
title: "The page's title",
card: 'One of the cards',
row: 'A row of the table',
sidebar: 'The sidebar',
other: 'Something else',
};
const shown = 5000, blank = 600; // ms: the look, and an empty page before it so the eye leaves the button it pressed

// people counts who has finished the test in this browser, and person is the one taking it now:
// their plan, what they saw and what they answered. The first person's plan is drawn by chance and
// each person after them gets the next one: on a shared laptop the plans go round in order, and
// across browsers chance spreads them.
const saved = store('spinbox-lab-five-seconds', null);
// the theme they see, whether they have seen it, and their answer. The first person's theme is
// drawn by chance and each person after them gets the other: on a shared laptop the themes take
// turns, and across browsers chance spreads them.
const saved = store('spinbox-lab-five-seconds-spot', null);
const q = new URLSearchParams(location.search);
const state = saved.value ?? { people: 0, tally: {}, person: null };
const save = () => saved.save(state);
function begin() {
// ?plan=1 to 4 is for whoever runs the test and hands out links in turn.
const asked = Number(q.get('plan'));
const plan = asked >= 1 && asked <= plans.length ? asked - 1 : state.person ? (state.person.plan + 1) % plans.length : Math.floor(Math.random() * plans.length);
state.person = { plan, seen: [], answered: {} };
// ?theme=dark or light is for whoever runs the test and hands out links in turn.
const other = state.person?.theme === 'dark' ? 'light' : 'dark';
const theme = q.get('theme') in themes ? q.get('theme') : state.person ? other : Math.random() < 0.5 ? 'dark' : 'light';
state.person = { theme, seen: false, answer: null };
save();
}
if (!state.person) begin();
const plan = () => plans[state.person.plan];
const pending = () => plan().find((id) => !(id in state.person.answered));

const sheet = document.getElementById('sheet'), stage = document.getElementById('stage'), view = document.getElementById('view');
const draw = (id) => { view.innerHTML = app(screens[variants[id].screen]({ fills: variants[id].fills })); };
function draw(theme) {
document.documentElement.dataset.theme = theme;
view.innerHTML = `<div class="app">${shell(screens.workspaces, screens.workspaces.draw(), theme)}</div>`;
}

function look(id) {
function look() {
// Seen from the moment it is asked for: a reload in the middle goes to the question, not to a
// second look.
state.person.seen.push(id);
state.person.seen = true;
save();
sheet.hidden = true;
view.innerHTML = '';
stage.classList.add('timed');
stage.hidden = false;
setTimeout(() => draw(id), blank);
setTimeout(() => { stage.hidden = true; stage.classList.remove('timed'); view.innerHTML = ''; sheet.hidden = false; render(); }, blank + shown);
setTimeout(() => draw(state.person.theme), blank);
setTimeout(() => {
stage.hidden = true;
stage.classList.remove('timed');
view.innerHTML = '';
document.documentElement.dataset.theme = 'dark';
sheet.hidden = false;
render();
}, blank + shown);
}

function tallyTable() {
const ids = Object.keys(variants), count = (id, a) => state.tally[id]?.[a] ?? 0;
const total = (id) => Object.keys(answers).reduce((n, a) => n + count(id, a), 0);
const count = (t, a) => state.tally[t]?.[a] ?? 0;
const cell = (n) => `<td${n ? '' : ' class="zero"'}>${n}</td>`;
return '<div class="tally-wrap"><table class="tally"><thead><tr><th>Seen first</th>' + ids.map((id) => `<th>${variants[id].name.replace('The list', 'List').replace(', ', '<br>')}</th>`).join('') + '</tr></thead><tbody>' +
Object.keys(answers).map((a) => `<tr><td>${answers[a]({ screen: 'list' }).replace(' of the list', '')}</td>${ids.map((id) => cell(count(id, a))).join('')}</tr>`).join('') +
`<tr><td class="muted">Answers</td>${ids.map((id) => cell(total(id))).join('')}</tr></tbody></table></div>`;
}
function tallyText() {
const lines = Object.keys(variants).map((id) => `${variants[id].name}: ` + Object.keys(answers).map((a) => `${a} ${state.tally[id]?.[a] ?? 0}`).join(', '));
return `Five-second test, ${state.people} ${state.people === 1 ? 'person' : 'people'} in this browser\n` + lines.join('\n');
return '<div class="tally-wrap"><table class="tally"><thead><tr><th>Seen first</th>' + Object.values(themes).map((name) => `<th>${name}</th>`).join('') + '</tr></thead><tbody>' +
Object.entries(answers).map(([a, words]) => `<tr><td>${words}</td>${Object.keys(themes).map((t) => cell(count(t, a))).join('')}</tr>`).join('') +
`<tr><td class="muted">Answers</td>${Object.keys(themes).map((t) => cell(Object.keys(answers).reduce((n, a) => n + count(t, a), 0))).join('')}</tr></tbody></table></div>`;
}
const tallyText = () => `Five-second test, ${state.people} ${state.people === 1 ? 'person' : 'people'} in this browser\n` +
Object.entries(themes).map(([t, name]) => `${name}: ` + Object.keys(answers).map((a) => `${a} ${state.tally[t]?.[a] ?? 0}`).join(', ')).join('\n');

const head = '<a class="back" href="./">← The laboratory</a>';
const how = `<details><summary>How this works</summary>
<p>Two pages of the product in dark, the workspace list and a settings page, each drawn twice: with one filled button, as the palette allows, and with three. The filled button is the mark's cyan, the brightest thing on a navy page; the test asks whether a page's title is still what a person reads first.</p>
<p>Each person sees each page once, in one version of each: the list with one and settings with three, or the other way round, in either order. That makes four plans. This browser draws the first person's by chance and gives each person after them the next one, so four people on one laptop cover all four, and the answers are offered in a new order each time; someone running the test can hand out <code>?plan=1</code> to <code>?plan=4</code> in turn. Nobody answers for both versions of a page, because the second look at a page is not a first look.</p>
<p>One page of the product, the list of workspaces, as the console's destination draws it: its verdict on a panel of its own at the head of the page, the one plane that is not the page's, and its one filled button, the mark's cyan. The test asks which of the two a person reads first, and whether the answer changes with the theme: the panel is dark in either, on a navy page in dark and on a grey one in light.</p>
<p>Each person sees the page once, in one theme. This browser draws the first person's theme by chance and gives each person after them the other, and the answers are offered in a new order each time; someone running the test can hand out <code>?theme=dark</code> and <code>?theme=light</code> in turn. Nobody sees both, because the second look at a page is not a first look.</p>
<p>The screen is drawn for five seconds after a short empty page. Answers are counted in this browser's storage and nowhere else: nothing is sent, so a team adds its tallies up by hand, or pastes them into the issue with the copy button.</p>
</details>`;

function render() {
const next = pending();
if (!next) return done();
const v = variants[next], nth = plan().indexOf(next);
if (state.person.seen.includes(next)) {
const p = state.person;
if (p.answer) return done();
if (p.seen) {
// In a new order each time, the last one apart: the pointer is still where the button that
// showed the screen was, and an answer that was always under it would be the easy one.
const [last, ...rest] = Object.keys(answers).reverse(), order = rest.map((a) => [Math.random(), a]).sort().map(([, a]) => a).concat(last);
const [last, ...others] = Object.keys(answers).reverse(), order = others.map((a) => [Math.random(), a]).sort().map(([, a]) => a).concat(last);
sheet.innerHTML = `${head}<h1>What did you see first?</h1><p class="muted">The first thing your eye went to, not the most important thing.</p><div class="answers">` +
order.map((a) => `<button class="btn secondary" data-answer="${a}">${answers[a](v)}</button>`).join('') + '</div>';
order.map((a) => `<button class="btn" data-answer="${a}">${answers[a]}</button>`).join('') + '</div>';
return;
}
sheet.innerHTML = head + (nth === 0
? `<h1>What do you see first?</h1><p>You will be shown a screen for five seconds. Then it goes away and you are asked one question about it.</p><p class="muted">Don't study it. Look at it the way you would on any morning.</p>`
: `<h1>One more screen</h1><p>Another page, five seconds again, and the same question.</p>`) +
`<div class="go"><button class="btn lg secondary" data-look="${next}">Show me the screen</button></div>` +
(saved.persists ? '' : '<p class="note">This browser refuses to store anything, so the tally lasts until this tab is closed.</p>') + (nth === 0 ? how : '');
sheet.innerHTML = `${head}<h1>What do you see first?</h1><p>You will be shown a screen for five seconds. Then it goes away and you are asked one question about it.</p><p class="muted">Don't study it. Look at it the way you would on any morning.</p>` +
'<div class="go"><button class="btn lg" data-look>Show me the screen</button></div>' +
(saved.persists ? '' : '<p class="note">This browser refuses to store anything, so the tally lasts until this tab is closed.</p>') + how;
}

function done() {
sheet.innerHTML = `${head}<h1>That is both screens</h1><p>Thank you. This is what has been answered <strong>in this browser only</strong>: nothing left this page, so nobody else's answers are here.</p>
sheet.innerHTML = `${head}<h1>That is the screen</h1><p>Thank you. This is what has been answered <strong>in this browser only</strong>: nothing left this page, so nobody else's answers are here.</p>
${tallyTable()}
<p class="note">${state.people} ${state.people === 1 ? 'person has' : 'people have'} taken it here. The comparison is between the two versions of one page: how often the title is seen first with one filled button, and with three.</p>
<div class="go"><button class="btn secondary" data-next>Next person on this browser</button><button class="btn secondary" data-copy>Copy the tally</button><button class="btn ghost" data-clear>Clear this browser's tally</button></div>
<h2>The four screens</h2><p class="note">A look at any of them, not counted and not timed.</p>
<div class="go">${Object.keys(variants).map((id) => `<a class="btn sm secondary" href="?show=${id}">${variants[id].name}</a>`).join('')}</div>${how}`;
<p class="note">${state.people} ${state.people === 1 ? 'person has' : 'people have'} taken it here. What it answers: how often the panel is seen before the button, in each theme.</p>
<div class="go"><button class="btn" data-next>Next person on this browser</button><button class="btn" data-copy>Copy the tally</button><button class="btn ghost" data-clear>Clear this browser's tally</button></div>
<h2>The screen</h2><p class="note">A look at it in either theme, not counted and not timed.</p>
<div class="go">${Object.entries(themes).map(([t, name]) => `<a class="btn sm" href="?show=${t}">${name}</a>`).join('')}</div>${how}`;
}

sheet.addEventListener('click', async (e) => {
const b = e.target.closest('button');
if (!b) return;
if (b.dataset.look) return look(b.dataset.look);
if ('look' in b.dataset) return look();
if (b.dataset.answer) {
const id = pending();
state.person.answered[id] = b.dataset.answer;
(state.tally[id] ??= {})[b.dataset.answer] = (state.tally[id][b.dataset.answer] ?? 0) + 1;
if (!pending()) state.people++;
const p = state.person;
p.answer = b.dataset.answer;
(state.tally[p.theme] ??= {})[p.answer] = (state.tally[p.theme][p.answer] ?? 0) + 1;
state.people++;
save();
return render();
}
Expand All @@ -161,7 +150,7 @@ <h2>The four screens</h2><p class="note">A look at any of them, not counted and
if ('clear' in b.dataset && confirm("Clear every answer counted in this browser?")) { saved.clear(); location.href = 'five-seconds.html'; }
});

if (variants[q.get('show')]) {
if (q.get('show') in themes) {
sheet.hidden = true; stage.hidden = false; document.getElementById('hud').hidden = false;
draw(q.get('show'));
} else render();
Expand Down
Loading