ceulen-dsh 0.2.12 → 0.2.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +176 -13
- package/lib/core/upstream.d.ts.map +1 -1
- package/lib/core/upstream.js +26 -5
- package/lib/core/upstream.js.map +1 -1
- package/lib/core/user-words.d.ts +6 -2
- package/lib/core/user-words.d.ts.map +1 -1
- package/lib/core/user-words.js +28 -6
- package/lib/core/user-words.js.map +1 -1
- package/lib/modules/classifier/index.js +1 -1
- package/lib/modules/classifier/index.js.map +1 -1
- package/lib/modules/status/index.d.ts.map +1 -1
- package/lib/modules/status/index.js +4 -2
- package/lib/modules/status/index.js.map +1 -1
- package/lib/modules/steering/index.js +1 -1
- package/lib/modules/steering/index.js.map +1 -1
- package/lib/modules/subagent/index.d.ts.map +1 -1
- package/lib/modules/subagent/index.js +5 -0
- package/lib/modules/subagent/index.js.map +1 -1
- package/lib/modules/ux/auto.d.ts +27 -4
- package/lib/modules/ux/auto.d.ts.map +1 -1
- package/lib/modules/ux/auto.js +70 -11
- package/lib/modules/ux/auto.js.map +1 -1
- package/lib/modules/ux/index.d.ts +5 -0
- package/lib/modules/ux/index.d.ts.map +1 -1
- package/lib/modules/ux/index.js +60 -10
- package/lib/modules/ux/index.js.map +1 -1
- package/lib/modules/ux/kit.d.ts +79 -0
- package/lib/modules/ux/kit.d.ts.map +1 -0
- package/lib/modules/ux/kit.js +449 -0
- package/lib/modules/ux/kit.js.map +1 -0
- package/lib/modules/ux/review.d.ts.map +1 -1
- package/lib/modules/ux/review.js +30 -4
- package/lib/modules/ux/review.js.map +1 -1
- package/package.json +2 -2
- package/scripts/pack-contract.mjs +9 -0
- package/scripts/tui-plan-patch.mjs +138 -1
- package/scripts/tui-question-fit-smoke.mjs +161 -0
- package/skills/dsh-update/SKILL.md +29 -4
- package/skills/ux-design/SKILL.md +6 -4
- package/skills/ux-design/kit/base.css +49 -0
- package/skills/ux-design/kit/diagram.js +598 -0
- package/skills/ux-design/kit/motion.js +2 -1
- package/skills/ux-design/references/diagram.md +79 -0
- package/skills/ux-design/references/motion.md +10 -5
- package/skills/ux-presets/SKILL.md +18 -3
- package/skills/ux-presets/presets/bento/DESIGN.md +3 -0
- package/skills/ux-presets/presets/bento/example.html +1 -1
- package/skills/ux-presets/presets/care/DESIGN.md +3 -0
- package/skills/ux-presets/presets/care/example.html +1 -1
- package/skills/ux-presets/presets/civic/DESIGN.md +3 -0
- package/skills/ux-presets/presets/civic/example.html +1 -1
- package/skills/ux-presets/presets/explainer/DESIGN.md +119 -0
- package/skills/ux-presets/presets/explainer/example.html +238 -0
- package/skills/ux-presets/presets/instrument-panel/DESIGN.md +3 -1
- package/skills/ux-presets/presets/instrument-panel/example.html +1 -1
- package/skills/ux-presets/presets/ledger/DESIGN.md +3 -1
- package/skills/ux-presets/presets/ledger/example.html +1 -1
- package/skills/ux-presets/presets/pipeline-desk/DESIGN.md +3 -1
- package/skills/ux-presets/presets/pipeline-desk/example.html +1 -1
- package/skills/ux-presets/presets.json +645 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Headless layout smoke for the two question cards (behaviour 5 of
|
|
4
|
+
* tui-plan-patch.mjs). `check` there only proves the anchors are in place;
|
|
5
|
+
* this renders the installed PlanReviewPanel and AskUserQuestionPanel inside a
|
|
6
|
+
* Chat-like fullscreen stack (a growing transcript, a band of rows standing in
|
|
7
|
+
* for the goal/todo panel, the card, then a usage band) into a headless
|
|
8
|
+
* terminal, and asserts that every control the user needs is on screen.
|
|
9
|
+
*
|
|
10
|
+
* A stock dsh-tui fails the band cases: "Keep planning", the feedback row and
|
|
11
|
+
* the hint fall off the bottom, and a short plan leaves a blank block.
|
|
12
|
+
*
|
|
13
|
+
* Usage: node scripts/tui-question-fit-smoke.mjs [--tui <dir>]
|
|
14
|
+
* Exit 0 when every case passes, 1 when one fails, 2 when it cannot run.
|
|
15
|
+
* The stack is a stand-in, not the real Chat screen: a live check after a
|
|
16
|
+
* restart is still the final word.
|
|
17
|
+
*/
|
|
18
|
+
import { execFileSync } from 'node:child_process'
|
|
19
|
+
import { existsSync } from 'node:fs'
|
|
20
|
+
import { createRequire } from 'node:module'
|
|
21
|
+
import { homedir } from 'node:os'
|
|
22
|
+
import { join } from 'node:path'
|
|
23
|
+
import { PassThrough, Writable } from 'node:stream'
|
|
24
|
+
import { pathToFileURL } from 'node:url'
|
|
25
|
+
|
|
26
|
+
const args = process.argv.slice(2)
|
|
27
|
+
const tuiFlag = args.indexOf('--tui')
|
|
28
|
+
const home = process.env.DSH_HOME?.trim() || join(homedir(), '.dsh')
|
|
29
|
+
const root = tuiFlag >= 0 && args[tuiFlag + 1] !== undefined
|
|
30
|
+
? args[tuiFlag + 1]
|
|
31
|
+
: join(home, 'profiles', 'tui', 'node_modules', '@deepseek-harness-tui', 'dsh-tui')
|
|
32
|
+
const types = join(root, 'lib', 'types')
|
|
33
|
+
if (!existsSync(join(types, 'components', 'questions', 'PlanReviewPanel.js'))) {
|
|
34
|
+
console.error(`dsh-tui not found at ${root}\nPass --tui <path-to-@deepseek-harness-tui/dsh-tui>.`)
|
|
35
|
+
process.exit(2)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// The headless terminal ships with the global dsh core.
|
|
39
|
+
let Terminal
|
|
40
|
+
try {
|
|
41
|
+
const globalRoot = execFileSync(process.platform === 'win32' ? 'npm.cmd' : 'npm', ['root', '-g'], { encoding: 'utf8' }).trim()
|
|
42
|
+
Terminal = createRequire(join(globalRoot, '@deepseek-ai', 'dsh', 'package.json'))('@xterm/headless').Terminal
|
|
43
|
+
} catch (error) {
|
|
44
|
+
console.error(`@xterm/headless not found next to the global @deepseek-ai/dsh: ${error instanceof Error ? error.message : error}`)
|
|
45
|
+
process.exit(2)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const requireTui = createRequire(join(types, 'ui.js'))
|
|
49
|
+
const { jsx, jsxs } = requireTui('react/jsx-runtime')
|
|
50
|
+
const load = rel => import(pathToFileURL(join(types, rel)).href)
|
|
51
|
+
const { Box, Text, ThemeProvider } = await load('ui.js')
|
|
52
|
+
const { renderSync } = await load('ink/root.js')
|
|
53
|
+
const { PlanReviewPanel } = await load('components/questions/PlanReviewPanel.js')
|
|
54
|
+
const { AskUserQuestionPanel } = await load('components/questions/AskUserQuestionPanel.js')
|
|
55
|
+
|
|
56
|
+
const COLUMNS = 160
|
|
57
|
+
|
|
58
|
+
/** Render one card under `band` filler rows on a `rows`-high screen; the visible lines. */
|
|
59
|
+
async function screen({ rows, band, card }) {
|
|
60
|
+
const term = new Terminal({ cols: COLUMNS, rows, allowProposedApi: true })
|
|
61
|
+
const stdout = new Writable({ write(chunk, _encoding, done) { term.write(chunk.toString(), done) } })
|
|
62
|
+
Object.assign(stdout, { columns: COLUMNS, rows, isTTY: true })
|
|
63
|
+
const stdin = new PassThrough()
|
|
64
|
+
Object.assign(stdin, { isTTY: true, setRawMode() {}, ref() {}, unref() {} })
|
|
65
|
+
const tree = jsx(ThemeProvider, {
|
|
66
|
+
children: jsxs(Box, {
|
|
67
|
+
flexDirection: 'column', height: rows, width: '100%', flexShrink: 0, children: [
|
|
68
|
+
jsx(Box, { flexDirection: 'column', flexGrow: 1, flexShrink: 1, overflow: 'hidden', children: jsx(Text, { children: 'transcript' }) }),
|
|
69
|
+
jsxs(Box, {
|
|
70
|
+
flexDirection: 'column', flexShrink: 0, children: [
|
|
71
|
+
...Array.from({ length: band }, (_, index) => jsx(Text, { children: `band row ${index + 1}` }, `band${index}`)),
|
|
72
|
+
jsxs(Box, { flexDirection: 'column', flexShrink: 0, children: [card, jsx(Text, { children: 'USAGE-BAND' })] }),
|
|
73
|
+
],
|
|
74
|
+
}),
|
|
75
|
+
],
|
|
76
|
+
}),
|
|
77
|
+
})
|
|
78
|
+
const instance = renderSync(tree, { stdout, stdin, stderr: process.stderr, patchConsole: false, exitOnCtrlC: false, terminalImages: false })
|
|
79
|
+
// Layout effects measure, set state and lay out again: give it a few frames.
|
|
80
|
+
await new Promise(resolve => setTimeout(resolve, 600))
|
|
81
|
+
const buffer = term.buffer.active
|
|
82
|
+
const lines = []
|
|
83
|
+
for (let y = 0; y < rows; y++) lines.push(buffer.getLine(buffer.baseY + y)?.translateToString(true) ?? '')
|
|
84
|
+
// Unmount restores terminal modes with writeSync on a TTY stream's fd (1 for
|
|
85
|
+
// this fake one): keep those bytes out of the report.
|
|
86
|
+
stdout.isTTY = false
|
|
87
|
+
instance.unmount()
|
|
88
|
+
instance.cleanup?.()
|
|
89
|
+
return lines
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const noop = () => {}
|
|
93
|
+
const planCard = planLines => jsx(PlanReviewPanel, {
|
|
94
|
+
question: {
|
|
95
|
+
id: 'plan-review',
|
|
96
|
+
header: 'Plan change',
|
|
97
|
+
question: 'The lead changed the plan you approved (adds T4). Approve the new plan?',
|
|
98
|
+
detail: Array.from({ length: planLines }, (_, index) => `- plan line ${index + 1}`).join('\n'),
|
|
99
|
+
options: [
|
|
100
|
+
{ label: 'Approve', description: 'The lead dispatches the team on this plan.' },
|
|
101
|
+
{ label: 'Keep planning', description: 'Nothing is dispatched; your feedback goes back to the lead.' },
|
|
102
|
+
],
|
|
103
|
+
intent: { kind: 'plan-review', approve: 'Approve' },
|
|
104
|
+
},
|
|
105
|
+
onAnswer: noop,
|
|
106
|
+
onCancel: noop,
|
|
107
|
+
})
|
|
108
|
+
const askCard = count => jsx(AskUserQuestionPanel, {
|
|
109
|
+
question: {
|
|
110
|
+
id: 'pick',
|
|
111
|
+
header: 'Route',
|
|
112
|
+
question: 'Which route should the lead use for the follow-up task?',
|
|
113
|
+
detail: 'Pick one. The lead keeps the plan otherwise.',
|
|
114
|
+
options: Array.from({ length: count }, (_, index) => ({ label: `Option ${index + 1}`, description: `What option ${index + 1} means` })),
|
|
115
|
+
},
|
|
116
|
+
position: 0,
|
|
117
|
+
total: 1,
|
|
118
|
+
answered: [],
|
|
119
|
+
onAnswer: noop,
|
|
120
|
+
onCancel: noop,
|
|
121
|
+
fullscreen: true,
|
|
122
|
+
})
|
|
123
|
+
|
|
124
|
+
const has = (lines, pattern) => lines.some(line => pattern.test(line))
|
|
125
|
+
const index = (lines, pattern) => lines.findIndex(line => pattern.test(line))
|
|
126
|
+
const planChecks = planLines => lines => {
|
|
127
|
+
const failures = []
|
|
128
|
+
if (!has(lines, /2\. Keep planning/)) failures.push('"Keep planning" is off screen')
|
|
129
|
+
if (!has(lines, /✎/)) failures.push('the feedback row is off screen')
|
|
130
|
+
if (!has(lines, /Esc/)) failures.push('the key hint is off screen')
|
|
131
|
+
if (!has(lines, /USAGE-BAND/)) failures.push('the band under the card is off screen')
|
|
132
|
+
const last = index(lines, new RegExp(`plan line ${planLines}$`))
|
|
133
|
+
const approve = index(lines, /1\. Approve/)
|
|
134
|
+
if (last >= 0 && approve >= 0 && approve - last > 4) failures.push(`${approve - last - 1} rows between the plan and the options`)
|
|
135
|
+
return failures
|
|
136
|
+
}
|
|
137
|
+
const askChecks = count => lines => {
|
|
138
|
+
const failures = []
|
|
139
|
+
if (!has(lines, /✎/)) failures.push('the answer row is off screen')
|
|
140
|
+
if (!has(lines, /Esc/)) failures.push('the key hint is off screen')
|
|
141
|
+
if (!has(lines, /USAGE-BAND/)) failures.push('the band under the card is off screen')
|
|
142
|
+
if (count <= 3 && lines.filter(line => /Option \d+\s*$/.test(line)).length !== count) failures.push('a short option list lost an option')
|
|
143
|
+
return failures
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const cases = [
|
|
147
|
+
{ name: 'plan card, short plan, todo band up (the reported bug)', rows: 98, band: 10, card: planCard(56), check: planChecks(56) },
|
|
148
|
+
{ name: 'plan card, short plan, no band (first plan)', rows: 98, band: 0, card: planCard(56), check: planChecks(56) },
|
|
149
|
+
{ name: 'plan card, long plan scrolls, todo band up', rows: 60, band: 8, card: planCard(80), check: planChecks(80) },
|
|
150
|
+
{ name: 'question card, 15 options, todo band up', rows: 40, band: 8, card: askCard(15), check: askChecks(15) },
|
|
151
|
+
{ name: 'question card, 3 options, todo band up', rows: 40, band: 8, card: askCard(3), check: askChecks(3) },
|
|
152
|
+
]
|
|
153
|
+
|
|
154
|
+
let failed = 0
|
|
155
|
+
for (const entry of cases) {
|
|
156
|
+
const failures = entry.check(await screen(entry))
|
|
157
|
+
if (failures.length > 0) failed += 1
|
|
158
|
+
console.log(`${failures.length === 0 ? 'ok ' : 'FAIL'} ${entry.name}${failures.length === 0 ? '' : `: ${failures.join('; ')}`}`)
|
|
159
|
+
}
|
|
160
|
+
console.log(failed === 0 ? 'question cards fit the screen.' : `${failed} case${failed === 1 ? '' : 's'} failed: run scripts/tui-plan-patch.mjs apply, or the anchors moved.`)
|
|
161
|
+
process.exit(failed === 0 ? 0 : 1)
|
|
@@ -105,10 +105,12 @@ node -p "require(process.env.HOME+'/.dsh/profiles/tui/node_modules/@deepseek-har
|
|
|
105
105
|
# an add/remove/reinstall wipes every one of them.
|
|
106
106
|
for p in advisor context toolname plan effort style panel; do node scripts/tui-$p-patch.mjs apply || exit 1; done
|
|
107
107
|
for p in advisor context toolname plan effort style panel; do node scripts/tui-$p-patch.mjs check || exit 1; done
|
|
108
|
+
# `check` proves anchors, not behaviour: render the question cards headless.
|
|
109
|
+
node scripts/tui-question-fit-smoke.mjs || exit 1
|
|
108
110
|
```
|
|
109
111
|
|
|
110
112
|
Repeat for every profile with an installed TUI, passing `--tui <resolved-dir>`
|
|
111
|
-
to every patch script. Finish all profile package changes before applying
|
|
113
|
+
to every patch script and to the smoke. Finish all profile package changes before applying
|
|
112
114
|
patches: another add/remove can rewrite the dependency tree again.
|
|
113
115
|
|
|
114
116
|
Preserve the existing `~/.dsh-tui/effort-by-model.json` (resolved from the
|
|
@@ -142,8 +144,8 @@ not replace a literal old version that becomes a no-op after an upgrade.
|
|
|
142
144
|
- Seven patches ride the installed dsh-tui tree, and a missed one breaks silently:
|
|
143
145
|
`advisor` (reviewer notes in the transcript), `context` (`/context` opens the
|
|
144
146
|
dashboard instead of the loaded-context text dump), `toolname` (grep tool
|
|
145
|
-
renders as `fff`, not `Fff_grep`), `plan` (bare `/plan` toggles
|
|
146
|
-
names plan mode), `effort` (per-model reasoning effort). `apply` fails loudly when an anchor moves; `check` exits 1
|
|
147
|
+
renders as `fff`, not `Fff_grep`), `plan` (bare `/plan` toggles, the footer
|
|
148
|
+
names plan mode, and both question cards fit the screen), `effort` (per-model reasoning effort). `apply` fails loudly when an anchor moves; `check` exits 1
|
|
147
149
|
when not applied.
|
|
148
150
|
- `style` adds live `/theme style dsh|pi|omp` layout selection without changing
|
|
149
151
|
the color theme; `ui-style.json` shares the effort preference directory.
|
|
@@ -157,6 +159,23 @@ not replace a literal old version that becomes a no-op after an upgrade.
|
|
|
157
159
|
anchors (the class `open(id)` head and its `request('open', …)` line, the
|
|
158
160
|
bridge `request.kind === 'open'` branch and its `openPanel(…, { focus: true })`)
|
|
159
161
|
before extending the gate.
|
|
162
|
+
- `plan` also patches `components/questions/PlanReviewPanel.js` and
|
|
163
|
+
`AskUserQuestionPanel.js`. Stock sizes the plan body and the option list
|
|
164
|
+
as the terminal height minus a fixed 12 rows, ignoring the goal/todo band,
|
|
165
|
+
spinner and status views stacked above. With a board up (e.g. the second
|
|
166
|
+
`/orchestrator` plan, a "Plan change" card) "Keep planning", the feedback/
|
|
167
|
+
answer row and the hint fell off the bottom, and a short plan left a blank
|
|
168
|
+
block (fixed 2026-11-25). The patch measures after layout (the card's yoga
|
|
169
|
+
position, the plan's natural height in a wrapper box) with a shrink-only
|
|
170
|
+
limit. Anchors: `detailMax`/`detailScrollRef`, the detail `ScrollBox` with its
|
|
171
|
+
`Markdown`, both panels' root `Box`, and the `optionBudget` line. If upstream
|
|
172
|
+
now sizes the cards from real layout, drop these edges instead of porting
|
|
173
|
+
them, and keep `scripts/tui-question-fit-smoke.mjs` as the proof. The smoke
|
|
174
|
+
must pass on the patched tree and fail on a reverted copy. It is a stand-in
|
|
175
|
+
stack (not the real Chat), so the live card check after restart stays.
|
|
176
|
+
Exit 1 is a card that does not fit (patch lost or anchors moved). Exit 2
|
|
177
|
+
means the smoke could not run: TUI not found, or `@xterm/headless` missing
|
|
178
|
+
from the global core. Fix the harness and do not count that as a patch result.
|
|
160
179
|
- dsh-tui 0.19.0 dropped the context patch with no warning (2026-11-06):
|
|
161
180
|
`/context` still answered, it just dumped the stock report again. That is why
|
|
162
181
|
the loop now covers all seven, not the two this section used to list.
|
|
@@ -211,7 +230,8 @@ Run one read-only independent review of the compatibility delta, distinguishing
|
|
|
211
230
|
pre-existing user edits; fix blockers and rerun affected checks before reporting.
|
|
212
231
|
|
|
213
232
|
After review and any resulting fixes/package operations, run all seven patch
|
|
214
|
-
`check` commands
|
|
233
|
+
`check` commands and `node scripts/tui-question-fit-smoke.mjs` again for every
|
|
234
|
+
installed TUI profile. This is the final gate,
|
|
215
235
|
not just a step-4 check: bundle installs or reinstalls later in the task can
|
|
216
236
|
replace patched files even when the TUI version is unchanged. If any check
|
|
217
237
|
fails, reapply the compatible patches and recheck before declaring success.
|
|
@@ -252,6 +272,10 @@ Verify after restart:
|
|
|
252
272
|
segment means that patch is missing — run its script and restart again.
|
|
253
273
|
- `/context` renders the colour dashboard (that is `context-redirect applied`
|
|
254
274
|
proving itself).
|
|
275
|
+
- With a todo/goal band up, a plan-review card (or `/orchestrator`'s "Plan
|
|
276
|
+
change") shows Approve, Keep planning, the ✎ feedback row and the key hint,
|
|
277
|
+
with no blank block under a short plan. Leave it pending if no plan is due;
|
|
278
|
+
do not start a paid run only to see it.
|
|
255
279
|
- Switch model A → B → A using existing per-model preferences: reasoning must
|
|
256
280
|
return to A's saved level, not the global `max`; the model picker must preview
|
|
257
281
|
that level too. Do not overwrite user preferences to test this. Resumed
|
|
@@ -272,6 +296,7 @@ npm i -g --allow-scripts=@deepseek-ai/dsh-subprocess-local,koffi,node-pty,@googl
|
|
|
272
296
|
dsh plugin --profile tui add @deepseek-harness-tui/dsh-tui@<exact-old-tui>
|
|
273
297
|
for p in advisor context toolname plan effort style panel; do node scripts/tui-$p-patch.mjs apply || exit 1; done
|
|
274
298
|
for p in advisor context toolname plan effort style panel; do node scripts/tui-$p-patch.mjs check || exit 1; done
|
|
299
|
+
node scripts/tui-question-fit-smoke.mjs || exit 1
|
|
275
300
|
```
|
|
276
301
|
|
|
277
302
|
Restore only update-owned compatibility hunks (including `dshTui` and release
|
|
@@ -40,7 +40,7 @@ never invented per screen. **Resolution order (stop at the first that holds):**
|
|
|
40
40
|
1. **`DESIGN.md` exists** → read all of it; use its tokens verbatim. That holds for a concept, an exploration, or a redesign inside the product: a new look comes from layout, hierarchy, and motion, and a colorful page uses the accent and status colours the file already lists. "Premium", "colors", and "attractive" change nothing. Only the words `new identity`, `rebrand`, or `ignore DESIGN.md` in the request lift this. Never add a second `DESIGN.md` beside a concept. `ux_audit` reports colours outside the project's file as `off-palette`, and work does not finish with that finding open.
|
|
41
41
|
2. **A system is already wired in** (shadcn/MUI/Radix theme, Tailwind config) → reuse it. With no `DESIGN.md`, record that system's real tokens in one before any markup; never invent new ones.
|
|
42
42
|
3. **A reference site exists** → `web_extract` it, distill its DNA (4–6 hex, type roles, rhythm) into a DESIGN.md starter, then work inside it.
|
|
43
|
-
4. **Nothing exists** → do NOT block.
|
|
43
|
+
4. **Nothing exists** → do NOT block. Call `ux_kit` with the user's request: it picks the preset from the words in the request (the `ux-presets` table) and writes that preset's `DESIGN.md`, `tokens.css` and the kit files into the working directory before any markup. The preset gives the palette, type and motion; your subject gives the content and the signature element.
|
|
44
44
|
|
|
45
45
|
`DESIGN.md` is the contract, so it is written even when the request names only other files, and it is never a thing to offer or to skip. Keep it short: the direction line first, then the tokens this page uses, in the starter's format. When a token changes, change it here in the same edit: `ux_audit` reports colours this file lists that the stylesheet does not have.
|
|
46
46
|
|
|
@@ -84,9 +84,11 @@ or palette; the direction line is the required output.
|
|
|
84
84
|
|
|
85
85
|
**Motion is part of the design.** Every page ships a load moment, items that
|
|
86
86
|
arrive as they scroll in, soft state changes, a response to the pointer, and a
|
|
87
|
-
reduced-motion fallback.
|
|
88
|
-
|
|
89
|
-
Read all of it before writing CSS.
|
|
87
|
+
reduced-motion fallback. `ux_kit` copies the kit (`motion.js`, `motion.css`,
|
|
88
|
+
`base.css`) next to the page; mark the page up with its attributes: see
|
|
89
|
+
[references/motion.md](references/motion.md). Read all of it before writing CSS.
|
|
90
|
+
A block or flow diagram is written as lines for `kit/diagram.js`, never placed
|
|
91
|
+
by hand: see [references/diagram.md](references/diagram.md).
|
|
90
92
|
|
|
91
93
|
### Step 2 — Generate fast, converge early
|
|
92
94
|
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/* ceulen-ux kit: base.css. Copy this file next to the page, do not retype it.
|
|
2
|
+
Link it BEFORE your own stylesheet: every rule here has zero specificity
|
|
3
|
+
(:where), so anything you write wins. It supplies the parts a page is
|
|
4
|
+
audited on and that are easy to forget: a focus ring, disabled controls,
|
|
5
|
+
44px touch targets, the reduced-motion fallback, and media that fits.
|
|
6
|
+
Colours come from tokens.css (--k-*), with system colours as the fallback. */
|
|
7
|
+
|
|
8
|
+
:where(*, *::before, *::after) { box-sizing: border-box; }
|
|
9
|
+
:where(html) { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
|
|
10
|
+
:where(body) { margin: 0; overflow-wrap: break-word; }
|
|
11
|
+
:where([hidden]) { display: none !important; }
|
|
12
|
+
|
|
13
|
+
/* media never pushes the page wider than the screen */
|
|
14
|
+
:where(img, video, canvas, iframe) { max-width: 100%; }
|
|
15
|
+
:where(img, video) { height: auto; }
|
|
16
|
+
:where(pre) { max-width: 100%; overflow-x: auto; }
|
|
17
|
+
:where(h1, h2, h3) { text-wrap: balance; }
|
|
18
|
+
/* wrap a wide table or figure in <div class="scroll-x"> instead of letting the page scroll sideways */
|
|
19
|
+
:where(.scroll-x) { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
|
|
20
|
+
|
|
21
|
+
/* controls take the page's type, and say what they are */
|
|
22
|
+
:where(button, input, select, textarea) { font: inherit; color: inherit; }
|
|
23
|
+
:where(button, [role="button"], summary, select, label[for], input[type="checkbox"], input[type="radio"]) { cursor: pointer; }
|
|
24
|
+
:where(button, [role="button"]) { touch-action: manipulation; }
|
|
25
|
+
|
|
26
|
+
/* states every interactive element needs */
|
|
27
|
+
:where(:focus-visible) { outline: 2px solid var(--k-focus, var(--k-link, var(--k-accent, currentColor))); outline-offset: 2px; }
|
|
28
|
+
/* two rules, not one list: ux_audit reads each as covering every control */
|
|
29
|
+
:where(:disabled) { opacity: 0.55; cursor: not-allowed; }
|
|
30
|
+
:where([aria-disabled="true"]) { opacity: 0.55; cursor: not-allowed; }
|
|
31
|
+
:where([aria-busy="true"]) { cursor: progress; }
|
|
32
|
+
:where([aria-invalid="true"]) { outline: 2px solid var(--k-danger, currentColor); outline-offset: 1px; }
|
|
33
|
+
|
|
34
|
+
/* touch targets: 44px on phones and on any coarse pointer */
|
|
35
|
+
@media (max-width: 480px), (pointer: coarse) {
|
|
36
|
+
:where(button, [role="button"], select, summary, input:not([type="checkbox"], [type="radio"], [type="range"], [type="hidden"])) { min-height: 44px; min-width: 44px; }
|
|
37
|
+
/* a link that is laid out as a block or a flex item is a target; a link in a sentence is not */
|
|
38
|
+
:where(nav, [role="navigation"], footer, menu) :where(a) { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; }
|
|
39
|
+
/* a checkbox or radio is tapped through its label */
|
|
40
|
+
:where(label:has(input[type="checkbox"], input[type="radio"])) { display: inline-flex; align-items: center; gap: 0.6em; min-height: 44px; }
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* text for screen readers only */
|
|
44
|
+
:where(.sr-only) { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
|
|
45
|
+
|
|
46
|
+
/* !important is required: a blanket rule loses to any class selector without it */
|
|
47
|
+
@media (prefers-reduced-motion: reduce) {
|
|
48
|
+
*, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
|
|
49
|
+
}
|