@micha.bigler/ui-core-micha 2.33.1 → 2.34.0
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/WORK_ORDERS.md +4 -2
- package/dist/auth/ReauthModal.js +3 -1
- package/dist/components/AccessCodeManager.js +16 -14
- package/dist/components/AccessCodeSingleUseToggle.js +2 -1
- package/dist/components/AllowedEmailDomainsManager.js +3 -1
- package/dist/components/AuthFactorRequirementCard.js +2 -1
- package/dist/components/BulkInviteCsvTab.js +7 -7
- package/dist/components/LoginForm.js +2 -1
- package/dist/components/MFAComponent.js +11 -5
- package/dist/components/MfaLoginComponent.js +4 -1
- package/dist/components/PasskeysComponent.js +4 -2
- package/dist/components/QrSignupManager.js +2 -1
- package/dist/components/QrSignupValidityManager.js +4 -1
- package/dist/components/RegistrationMethodsManager.js +3 -1
- package/dist/components/SecurityComponent.js +3 -1
- package/dist/components/SupportRecoveryRequestsTab.js +4 -1
- package/dist/components/UserInviteComponent.js +8 -8
- package/dist/components/UserListComponent.js +8 -4
- package/dist/components/charts/ChartFrame.js +5 -2
- package/dist/components/charts/TimeSeriesChart.js +7 -4
- package/dist/index.js +1 -1
- package/dist/layout/PageLayout.js +3 -2
- package/dist/messaging/AttachmentList.js +6 -1
- package/dist/messaging/Composer.js +2 -1
- package/dist/messaging/DirectMessageLauncher.js +2 -1
- package/dist/messaging/MessageBubble.js +29 -8
- package/dist/messaging/PollCard.js +6 -4
- package/dist/messaging/Thread.js +2 -1
- package/dist/notifications/NotificationSettings.js +17 -3
- package/dist/notifications/PopupSurface.js +2 -1
- package/dist/onboarding/steps/BrowserPushStep.js +2 -1
- package/dist/pages/AccountPage.js +2 -1
- package/dist/pages/LoginPage.js +2 -1
- package/dist/pages/SignUpPage.js +2 -1
- package/dist/pages/SignupConfirmPage.js +2 -1
- package/dist/theme/index.js +2 -1
- package/dist/theme/kitSxRegistry.js +187 -0
- package/dist/theme/themeCompleteness.js +218 -0
- package/dist/theme/tokens.js +1 -0
- package/package.json +1 -1
- package/src/auth/ReauthModal.jsx +5 -2
- package/src/components/AccessCodeManager.jsx +22 -20
- package/src/components/AccessCodeSingleUseToggle.jsx +4 -2
- package/src/components/AllowedEmailDomainsManager.jsx +6 -3
- package/src/components/AuthFactorRequirementCard.jsx +4 -2
- package/src/components/BulkInviteCsvTab.jsx +11 -10
- package/src/components/LoginForm.jsx +5 -3
- package/src/components/MFAComponent.jsx +14 -7
- package/src/components/MfaLoginComponent.jsx +9 -5
- package/src/components/PasskeysComponent.jsx +7 -4
- package/src/components/QrSignupManager.jsx +6 -4
- package/src/components/QrSignupValidityManager.jsx +8 -4
- package/src/components/RegistrationMethodsManager.jsx +7 -4
- package/src/components/SecurityComponent.jsx +10 -7
- package/src/components/SupportRecoveryRequestsTab.jsx +8 -4
- package/src/components/UserInviteComponent.jsx +10 -10
- package/src/components/UserListComponent.jsx +12 -7
- package/src/components/charts/ChartFrame.jsx +6 -2
- package/src/components/charts/TimeSeriesChart.jsx +8 -4
- package/src/index.js +3 -0
- package/src/layout/PageLayout.jsx +4 -2
- package/src/messaging/AttachmentList.jsx +9 -3
- package/src/messaging/Composer.jsx +3 -1
- package/src/messaging/DirectMessageLauncher.jsx +3 -1
- package/src/messaging/MessageBubble.jsx +31 -9
- package/src/messaging/PollCard.jsx +8 -6
- package/src/messaging/Thread.jsx +3 -1
- package/src/notifications/NotificationSettings.jsx +24 -9
- package/src/notifications/PopupSurface.jsx +3 -1
- package/src/onboarding/steps/BrowserPushStep.jsx +3 -1
- package/src/pages/AccountPage.jsx +11 -9
- package/src/pages/LoginPage.jsx +6 -4
- package/src/pages/SignUpPage.jsx +4 -2
- package/src/pages/SignupConfirmPage.jsx +4 -2
- package/src/theme/index.js +3 -0
- package/src/theme/kitSxRegistry.js +246 -0
- package/src/theme/themeCompleteness.js +228 -0
- package/src/theme/tokens.js +1 -0
- package/tests/createAppTheme.test.js +1 -0
- package/tests/themeCompleteness.test.js +214 -0
- package/work-orders/THEME-3.md +210 -0
- package/work-orders/THEME-4.md +271 -0
|
@@ -1,13 +1,28 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
|
|
1
4
|
import { createTheme } from '@mui/material/styles';
|
|
2
5
|
import { describe, expect, it } from 'vitest';
|
|
3
6
|
|
|
4
7
|
import {
|
|
5
8
|
assertThemeComplete,
|
|
9
|
+
assertKitSxDisjoint,
|
|
6
10
|
calculateContrastRatio,
|
|
7
11
|
createAppTheme,
|
|
12
|
+
KIT_COMPONENT_SX_REGISTRY,
|
|
13
|
+
reportKitSxBypasses,
|
|
8
14
|
THEME_COMPLETENESS_SURFACES,
|
|
9
15
|
} from '../src/theme';
|
|
10
16
|
|
|
17
|
+
function jsxSources(directory) {
|
|
18
|
+
return fs.readdirSync(directory, { withFileTypes: true }).flatMap((entry) => {
|
|
19
|
+
const entryPath = path.join(directory, entry.name);
|
|
20
|
+
if (entry.isDirectory()) return jsxSources(entryPath);
|
|
21
|
+
if (!entry.name.endsWith('.jsx')) return [];
|
|
22
|
+
return [{ path: path.relative(process.cwd(), entryPath), source: fs.readFileSync(entryPath, 'utf8') }];
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
11
26
|
describe('theme completeness', () => {
|
|
12
27
|
it('finds untouched MUI surfaces and accepts createAppTheme', () => {
|
|
13
28
|
const bare = assertThemeComplete(createTheme());
|
|
@@ -41,6 +56,16 @@ describe('theme completeness', () => {
|
|
|
41
56
|
expect(baseline.findings).toEqual([]);
|
|
42
57
|
});
|
|
43
58
|
|
|
59
|
+
it('requires and automatically resolves the subtle background for a minimal adopter', () => {
|
|
60
|
+
const muiDefault = createTheme();
|
|
61
|
+
const theme = createAppTheme({ palette: { primary: { main: '#0F62FE' } } });
|
|
62
|
+
|
|
63
|
+
expect(muiDefault.palette.background.subtle).toBeUndefined();
|
|
64
|
+
expect(THEME_COMPLETENESS_SURFACES.map(({ surface }) => surface))
|
|
65
|
+
.toContain('palette.background.subtle');
|
|
66
|
+
expect(assertThemeComplete(theme).findings).toEqual([]);
|
|
67
|
+
});
|
|
68
|
+
|
|
44
69
|
it('keeps the narrowed bottom-navigation inventory complete', () => {
|
|
45
70
|
const bottomNavigationSurfaces = THEME_COMPLETENESS_SURFACES
|
|
46
71
|
.map(({ surface }) => surface)
|
|
@@ -108,6 +133,11 @@ describe('theme completeness', () => {
|
|
|
108
133
|
.toContain('contrast.success.text-on-bg');
|
|
109
134
|
});
|
|
110
135
|
|
|
136
|
+
it('keeps secondary ink AA-legible on the subtle background', () => {
|
|
137
|
+
const ratio = calculateContrastRatio('#5B6670', '#F4F5F6');
|
|
138
|
+
expect(ratio).toBeGreaterThanOrEqual(4.5);
|
|
139
|
+
});
|
|
140
|
+
|
|
111
141
|
it('requires every MUI status main to clear AA on white and the page background', () => {
|
|
112
142
|
const theme = createAppTheme({ palette: { primary: { main: '#8AB4F8' } } });
|
|
113
143
|
|
|
@@ -139,3 +169,187 @@ describe('theme completeness', () => {
|
|
|
139
169
|
);
|
|
140
170
|
});
|
|
141
171
|
});
|
|
172
|
+
|
|
173
|
+
describe('kit sx disjointness', () => {
|
|
174
|
+
const theme = createAppTheme({ palette: { primary: { main: '#0F62FE' } } });
|
|
175
|
+
|
|
176
|
+
it('finds the real shadowing incident shape and names every part', () => {
|
|
177
|
+
const result = assertKitSxDisjoint(theme, {
|
|
178
|
+
registry: [{
|
|
179
|
+
component: 'FixtureBottomNav',
|
|
180
|
+
muiComponent: 'MuiBottomNavigation',
|
|
181
|
+
sx: { boxShadow: 'none' },
|
|
182
|
+
}],
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
expect(result.findings).toEqual([{
|
|
186
|
+
surface: 'FixtureBottomNav.MuiBottomNavigation.boxShadow',
|
|
187
|
+
reason: expect.stringMatching(/FixtureBottomNav.*MuiBottomNavigation.*boxShadow/),
|
|
188
|
+
}]);
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
it('checks same-root variant slots without conflating child slots', () => {
|
|
192
|
+
const chipResult = assertKitSxDisjoint(theme, {
|
|
193
|
+
registry: [{
|
|
194
|
+
component: 'FixtureChip',
|
|
195
|
+
muiComponent: 'MuiChip',
|
|
196
|
+
sx: { borderColor: 'red' },
|
|
197
|
+
}],
|
|
198
|
+
});
|
|
199
|
+
const bottomNavActionResult = assertKitSxDisjoint(theme, {
|
|
200
|
+
registry: [{
|
|
201
|
+
component: 'FixtureBottomNavAction',
|
|
202
|
+
muiComponent: 'MuiBottomNavigationAction',
|
|
203
|
+
sx: { maxWidth: 'none' },
|
|
204
|
+
}],
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
expect(chipResult.findings.map(({ surface }) => surface))
|
|
208
|
+
.toContain('FixtureChip.MuiChip.borderColor');
|
|
209
|
+
expect(bottomNavActionResult.findings).toEqual([]);
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
it('keeps every registered kit sx object disjoint from the baseline', () => {
|
|
213
|
+
expect(KIT_COMPONENT_SX_REGISTRY.length).toBeGreaterThan(2);
|
|
214
|
+
expect(assertKitSxDisjoint(theme, {
|
|
215
|
+
exemptions: [
|
|
216
|
+
{
|
|
217
|
+
surface: 'UserListComponent.bodyCell.MuiTableCell.py',
|
|
218
|
+
reason: 'The user list intentionally uses a tighter row density than the baseline TableCell default.',
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
surface: 'UserListComponent.emptyCell.MuiTableCell.py',
|
|
222
|
+
reason: 'The empty-state message intentionally uses more vertical breathing room than the baseline TableCell default.',
|
|
223
|
+
},
|
|
224
|
+
],
|
|
225
|
+
}).findings).toEqual([]);
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
it('flags inline sx while accepting a top-level exported object', () => {
|
|
229
|
+
const result = reportKitSxBypasses([
|
|
230
|
+
{
|
|
231
|
+
path: 'InlineFixture.jsx',
|
|
232
|
+
source: 'export function Fixture() { return <Button sx={{ minHeight: 12 }} />; }',
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
path: 'ExportedFixture.jsx',
|
|
236
|
+
source: 'export const FIXTURE_SX = { minHeight: 12 }; export function Fixture() { return <Button sx={FIXTURE_SX} />; }',
|
|
237
|
+
},
|
|
238
|
+
]);
|
|
239
|
+
|
|
240
|
+
expect(result.findings).toHaveLength(1);
|
|
241
|
+
expect(result.findings[0]).toEqual({
|
|
242
|
+
surface: 'InlineFixture.jsx:1.MuiButton.sx',
|
|
243
|
+
reason: expect.stringMatching(/Button.*inline sx object.*exported object/i),
|
|
244
|
+
});
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
it('flags a local sx identifier and ignores nested JSX props', () => {
|
|
248
|
+
const result = reportKitSxBypasses([
|
|
249
|
+
{
|
|
250
|
+
path: 'LocalFixture.jsx',
|
|
251
|
+
source: 'const LOCAL_SX = { minHeight: 12 }; export function Fixture() { return <Button sx={LOCAL_SX} />; }',
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
path: 'NestedFixture.jsx',
|
|
255
|
+
source: 'export function Fixture() { return <Button startIcon={<Box sx={{ width: 12 }} />} />; }',
|
|
256
|
+
},
|
|
257
|
+
]);
|
|
258
|
+
|
|
259
|
+
expect(result.findings).toEqual([{
|
|
260
|
+
surface: 'LocalFixture.jsx:1.MuiButton.sx',
|
|
261
|
+
reason: expect.stringMatching(/Button.*non-exported sx object.*LOCAL_SX/i),
|
|
262
|
+
}]);
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
it('flags an exported sx object omitted from the registry', () => {
|
|
266
|
+
const result = reportKitSxBypasses([{
|
|
267
|
+
path: 'UnregisteredFixture.jsx',
|
|
268
|
+
source: 'export const UNREGISTERED_SX = { minHeight: 12 }; export function Fixture() { return <Button sx={UNREGISTERED_SX} />; }',
|
|
269
|
+
}], { registry: [] });
|
|
270
|
+
|
|
271
|
+
expect(result.findings).toEqual([{
|
|
272
|
+
surface: 'UnregisteredFixture.jsx:1.MuiButton.sx',
|
|
273
|
+
reason: expect.stringMatching(/Button.*exported sx object.*UNREGISTERED_SX.*MuiButton registry entry/i),
|
|
274
|
+
}]);
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
it('flags an sx object registered against the wrong MUI key', () => {
|
|
278
|
+
const result = reportKitSxBypasses([{
|
|
279
|
+
path: 'WrongTargetFixture.jsx',
|
|
280
|
+
source: 'export const WRONG_TARGET_SX = { minHeight: 12 }; export function Fixture() { return <Button sx={WRONG_TARGET_SX} />; }',
|
|
281
|
+
}], {
|
|
282
|
+
registry: [{ exportName: 'WRONG_TARGET_SX', muiComponent: 'MuiPaper' }],
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
expect(result.findings).toEqual([{
|
|
286
|
+
surface: 'WrongTargetFixture.jsx:1.MuiButton.sx',
|
|
287
|
+
reason: expect.stringMatching(/WRONG_TARGET_SX.*MuiButton registry entry/i),
|
|
288
|
+
}]);
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
it('does not let current kit source bypass the exported-object convention', () => {
|
|
292
|
+
expect(reportKitSxBypasses(
|
|
293
|
+
jsxSources(path.resolve('src')),
|
|
294
|
+
{ registry: KIT_COMPONENT_SX_REGISTRY },
|
|
295
|
+
).findings).toEqual([]);
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
it('suppresses exactly one collision with a reason', () => {
|
|
299
|
+
const registry = [{
|
|
300
|
+
component: 'FixtureButton',
|
|
301
|
+
muiComponent: 'MuiButton',
|
|
302
|
+
sx: { minHeight: 12, textTransform: 'uppercase' },
|
|
303
|
+
}];
|
|
304
|
+
const before = assertKitSxDisjoint(theme, { registry }).findings;
|
|
305
|
+
const after = assertKitSxDisjoint(theme, {
|
|
306
|
+
registry,
|
|
307
|
+
exemptions: [{
|
|
308
|
+
surface: 'FixtureButton.MuiButton.minHeight',
|
|
309
|
+
reason: 'The fixture deliberately overrides one baseline property.',
|
|
310
|
+
}],
|
|
311
|
+
}).findings;
|
|
312
|
+
|
|
313
|
+
expect(before).toHaveLength(2);
|
|
314
|
+
expect(after).toHaveLength(1);
|
|
315
|
+
expect(after[0].surface).toBe('FixtureButton.MuiButton.textTransform');
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
it('honours a reasoned exemption declared on the theme', () => {
|
|
319
|
+
const exemptTheme = {
|
|
320
|
+
...theme,
|
|
321
|
+
themeCompleteness: {
|
|
322
|
+
...theme.themeCompleteness,
|
|
323
|
+
exemptions: [{
|
|
324
|
+
surface: 'FixtureButton.MuiButton.minHeight',
|
|
325
|
+
reason: 'The fixture deliberately owns its compact height.',
|
|
326
|
+
}],
|
|
327
|
+
},
|
|
328
|
+
};
|
|
329
|
+
const result = assertKitSxDisjoint(exemptTheme, {
|
|
330
|
+
registry: [{
|
|
331
|
+
component: 'FixtureButton',
|
|
332
|
+
muiComponent: 'MuiButton',
|
|
333
|
+
sx: { minHeight: 12 },
|
|
334
|
+
}],
|
|
335
|
+
});
|
|
336
|
+
|
|
337
|
+
expect(result.findings).toEqual([]);
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
it('reports an exemption without a reason as its own finding', () => {
|
|
341
|
+
const result = assertKitSxDisjoint(theme, {
|
|
342
|
+
registry: [{
|
|
343
|
+
component: 'FixtureButton',
|
|
344
|
+
muiComponent: 'MuiButton',
|
|
345
|
+
sx: { minHeight: 12 },
|
|
346
|
+
}],
|
|
347
|
+
exemptions: [{ surface: 'FixtureButton.MuiButton.minHeight' }],
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
expect(result.findings.map(({ surface }) => surface)).toEqual([
|
|
351
|
+
'exemption.FixtureButton.MuiButton.minHeight',
|
|
352
|
+
'FixtureButton.MuiButton.minHeight',
|
|
353
|
+
]);
|
|
354
|
+
});
|
|
355
|
+
});
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
# THEME-3 — Add the missing "subtle surface" baseline token
|
|
2
|
+
|
|
3
|
+
**Target repo:** `ui-core-micha` (branch `main` — this repo has no `develop`; a push touching
|
|
4
|
+
`src/**`/`package.json` publishes to npm immediately via `publish.yml`)
|
|
5
|
+
**Tier:** 3 — shared-core theme baseline, consumed by every `createAppTheme` adopter.
|
|
6
|
+
**Review:** independent `reviewer` **and** `ui_reviewer`, concurrently, both mandatory before commit
|
|
7
|
+
(no staging net in this repo — the independent review is the only gate and is not back-fillable).
|
|
8
|
+
**Found by:** `cockpit/UI-6` (adopting `createAppTheme` with the frozen `UI-4` token table). The
|
|
9
|
+
sheet's canonical token table (section 8, "what cockpit stops owning") lists an *inset surface*
|
|
10
|
+
`#F4F5F6` as a baseline-supplied value, replacing `cockpit.surface2` (16 of 195 token reads in that
|
|
11
|
+
WO). It does not exist anywhere in the shipped package — confirmed by grepping
|
|
12
|
+
`src/theme/tokens.js`/`themeCompleteness.js` for the hex and for any "surface"/"inset" key. The value
|
|
13
|
+
was one of the design-language instrument's *own* internal comparison-stack entries
|
|
14
|
+
(`cockpit/work-orders/assets/UI-4-design-language.html:681`), never actually wired into
|
|
15
|
+
`createAppTheme`. Per this estate's own rule ("a gap in the shared kit discovered mid-adoption is a
|
|
16
|
+
`ui-core-micha` work order and cockpit's item waits — not a local workaround"), `UI-6` is blocked on
|
|
17
|
+
this landing and publishing first.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## A. Envelope
|
|
22
|
+
|
|
23
|
+
### Goal
|
|
24
|
+
|
|
25
|
+
Add a third baseline background tier — `palette.background.subtle` — to `createAppTheme`'s shared
|
|
26
|
+
palette, for panels/table stripes/excerpt boxes that need to read as slightly recessed from
|
|
27
|
+
`background.paper` without a bespoke per-app colour. Register it in the completeness-assertion
|
|
28
|
+
surface inventory so every adopter (present and future) gets the same guarantee the other baseline
|
|
29
|
+
surfaces already have.
|
|
30
|
+
|
|
31
|
+
### Scope
|
|
32
|
+
|
|
33
|
+
1. **`src/theme/tokens.js`** — add `background.subtle: '#F4F5F6'` to `BASELINE_PALETTE.background`
|
|
34
|
+
(alongside the existing `default`/`paper`). This is a **fixed baseline constant**, not
|
|
35
|
+
accent-derived — the same treatment as `default`/`paper`, not the accent-tint derivation used for
|
|
36
|
+
`cockpit.accentTint`.
|
|
37
|
+
2. **`src/theme/themeCompleteness.js`** — add `pathSurface('palette.background.subtle')` to
|
|
38
|
+
`THEME_COMPLETENESS_SURFACES`.
|
|
39
|
+
3. **Recompute the contrast claim independently** — the frozen sheet's "muted ink on it: 4.81" was
|
|
40
|
+
computed on the sheet's own static comparison canvas, not via this package's
|
|
41
|
+
`calculateContrastRatio`. Recompute `calculateContrastRatio('#5B6670', '#F4F5F6')` (baseline
|
|
42
|
+
`ink.secondary`, the tone most likely to sit on this surface) directly against the shipped
|
|
43
|
+
function before treating the sheet's number as confirmed.
|
|
44
|
+
4. Publish (version bump — see Risks for the semver call).
|
|
45
|
+
|
|
46
|
+
### Non-goals / do not touch
|
|
47
|
+
|
|
48
|
+
- Renaming or removing any existing palette token.
|
|
49
|
+
- `CHART-*`/`SHELL-*`/`AUTH-*` surfaces — unrelated to this addition.
|
|
50
|
+
- `fitness-monitor` or any other consuming app's own repo — this WO lands and publishes the token
|
|
51
|
+
only; `cockpit/UI-6` consumes it afterward, in its own repo, as a separate step.
|
|
52
|
+
- Any accent-derived tint/shade math — this token is a fixed baseline value, structurally unlike
|
|
53
|
+
`cockpit.accentTint`/`accentLight`/`accentDark`.
|
|
54
|
+
|
|
55
|
+
### Risks
|
|
56
|
+
|
|
57
|
+
- **`fitness-monitor` is a real, already-shipped adopter** (`frontend/src/theme.js` +
|
|
58
|
+
`frontend/src/theme.test.js`) that hard-asserts `assertThemeComplete(theme).findings` equals `[]`.
|
|
59
|
+
A new *required* completeness surface must resolve automatically for every adopter with zero
|
|
60
|
+
app-level action — the same guarantee `background.default`/`background.paper` already give,
|
|
61
|
+
**not** an opt-in the app must declare. Concretely: the new key must come from
|
|
62
|
+
`BASELINE_PALETTE` so every real `createAppTheme(...)` output has it defined, and MUI's own
|
|
63
|
+
default theme must never define `background.subtle` itself (a novel key — verify this, don't
|
|
64
|
+
assume it), so `descriptor.get(MUI_DEFAULT_THEME)` returns `undefined` and the "still equals MUI's
|
|
65
|
+
untouched default" branch never fires. If either assumption is wrong, `fitness-monitor`'s CI
|
|
66
|
+
breaks on its next pin bump and this WO must not ship that way.
|
|
67
|
+
- **Semver classification** — additive to the factory's *output* (no adopter passes anything new to
|
|
68
|
+
get it), which argues for a patch, mirroring `SHELL-4`'s "narrows the contract, cannot turn
|
|
69
|
+
cockpit red" precedent in the opposite direction (widens the contract, but resolves automatically,
|
|
70
|
+
so it also cannot turn an adopter red). Confirm no adopter needs a code change before treating
|
|
71
|
+
this as settled rather than asserting it.
|
|
72
|
+
- **Do not silently rename cockpit's `surface2` in this repo** — this WO adds the baseline token;
|
|
73
|
+
cockpit's own re-point of 16 call sites from `cockpit.surface2` to the new baseline token is
|
|
74
|
+
`UI-6`'s job, in cockpit's repo, not this one's.
|
|
75
|
+
|
|
76
|
+
### Required tests to WRITE
|
|
77
|
+
|
|
78
|
+
1. `assertThemeComplete` stays empty-findings for a minimal adopter call —
|
|
79
|
+
`createAppTheme({ palette: { primary: { main: '#0F62FE' } } })` (mirroring `fitness-monitor`'s
|
|
80
|
+
real usage) — proving the new surface resolves with zero adopter action, not just for a theme
|
|
81
|
+
that happens to declare it.
|
|
82
|
+
2. `theme.palette.background.subtle` equals `'#F4F5F6'` on an unconfigured `createAppTheme(...)`
|
|
83
|
+
call.
|
|
84
|
+
3. `calculateContrastRatio('#5B6670', '#F4F5F6')` (baseline `ink.secondary` on the new surface)
|
|
85
|
+
passes AA (≥ 4.5:1) — computed via the shipped function, not asserted from the sheet's number.
|
|
86
|
+
4. Existing `tests/createAppTheme.test.js` and `tests/themeCompleteness.test.js` stay green
|
|
87
|
+
unmodified in intent (only extended where the new surface must appear in an enumeration they
|
|
88
|
+
already assert against, e.g. a surface-count or key-list check if one exists).
|
|
89
|
+
|
|
90
|
+
### Verification
|
|
91
|
+
|
|
92
|
+
No visual/prototype gate — this is a token-level palette addition with no rendered specimen of its
|
|
93
|
+
own in this repo. The rendered check for what this token actually looks like on real cockpit
|
|
94
|
+
surfaces happens downstream, in `cockpit/UI-6`'s own two-width verification.
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## B. Implementation map
|
|
99
|
+
|
|
100
|
+
*Filled by the Orchestrator on `git pull` — see `AGENTS.md` → "Work Order".*
|
|
101
|
+
|
|
102
|
+
### Context package
|
|
103
|
+
|
|
104
|
+
- **`src/theme/tokens.js`** — `BASELINE_PALETTE.background` currently reads:
|
|
105
|
+
```js
|
|
106
|
+
background: {
|
|
107
|
+
default: '#FAFAFA',
|
|
108
|
+
paper: '#FFFFFF',
|
|
109
|
+
},
|
|
110
|
+
```
|
|
111
|
+
Add `subtle: '#F4F5F6'` as a third key. This is the ONLY change needed in this file for the new
|
|
112
|
+
value itself — do not touch `SERIES_COLOURS`, `STATUS_KEYS`, `BASELINE_STATIC`, or the exemptions
|
|
113
|
+
list.
|
|
114
|
+
- **`src/theme/themeCompleteness.js`** — `THEME_COMPLETENESS_SURFACES` (around line 155-192) already
|
|
115
|
+
has `pathSurface('palette.background.default')` and `pathSurface('palette.background.paper')` in
|
|
116
|
+
its list. Add `pathSurface('palette.background.subtle')` immediately next to them — same helper,
|
|
117
|
+
same pattern, no new machinery needed.
|
|
118
|
+
- **Why this can't collide with an existing adopter (verified, not assumed):** `MUI_DEFAULT_THEME =
|
|
119
|
+
createTheme()` (line 5 of `themeCompleteness.js`) is vanilla MUI with no `background.subtle` key —
|
|
120
|
+
MUI's own palette only ever defines `background.default`/`.paper`. So for every real
|
|
121
|
+
`createAppTheme(...)` output, `descriptor.get(theme)` resolves to `'#F4F5F6'` (defined) while
|
|
122
|
+
`descriptor.get(MUI_DEFAULT_THEME)` resolves to `undefined` — the `sameValue` check in
|
|
123
|
+
`assertThemeComplete` (around line 354) therefore never flags it, with no exemption required. This
|
|
124
|
+
is exactly why `background.default` needs no exemption today; `background.subtle` gets the same
|
|
125
|
+
treatment. `background.paper` is the one that DOES need an exemption, because MUI's own default
|
|
126
|
+
theme also happens to be white — do not copy that exemption pattern here, it does not apply.
|
|
127
|
+
- **`calculateContrastRatio` is already exported** from `src/theme/themeCompleteness.js` and
|
|
128
|
+
re-exported from `src/theme/index.js` — use it directly for the required contrast test, do not
|
|
129
|
+
reimplement contrast math.
|
|
130
|
+
- **Test file conventions** (read `tests/themeCompleteness.test.js` and
|
|
131
|
+
`tests/createAppTheme.test.js` for the existing style before writing new assertions — minimal
|
|
132
|
+
`createAppTheme({ palette: { primary: { main: '#0F62FE' } } })` is the repo's own established
|
|
133
|
+
"minimal adopter" fixture, already used in both files; reuse it rather than inventing a new one).
|
|
134
|
+
- Directive: work from this package; do not explore broadly from scratch; open only the two named
|
|
135
|
+
source files plus the two named test files to verify. If you must dig deeper, delegate to a
|
|
136
|
+
read-only Explore sub-agent (Haiku).
|
|
137
|
+
|
|
138
|
+
### Target repo working directory (absolute)
|
|
139
|
+
|
|
140
|
+
`C:\Users\biglmi\Documents\webapps\ui-core-micha`
|
|
141
|
+
|
|
142
|
+
### Preamble
|
|
143
|
+
|
|
144
|
+
> The text of this whole file is the COMPLETE spec — not a plan to refine; there is no separate plan
|
|
145
|
+
> file. Read the nearest `AGENTS.md`, the relevant `.codex/skills/<role>/SKILL.md`, and this repo's
|
|
146
|
+
> own `DESIGN.md`/conventions ONLY for conventions. Stay in scope; do not touch
|
|
147
|
+
> `CHART-*`/`SHELL-*`/`AUTH-*` surfaces or any file outside `src/theme/` and `tests/` unless this
|
|
148
|
+
> spec says so; do not update any `MEMORY.md`. Do NOT `git add` / `commit` / `push` — leave every
|
|
149
|
+
> change uncommitted in the working tree for the orchestrator's independent review; do NOT bump
|
|
150
|
+
> `package.json`'s version yourself — the Orchestrator decides and applies the semver bump after
|
|
151
|
+
> review, per the Risks section's still-open patch/minor question. WRITE the tests the "Required
|
|
152
|
+
> tests to WRITE" section calls for AND **RUN the tests you just wrote** (plus the two named existing
|
|
153
|
+
> spec files, to confirm no regression) to confirm they execute and pass — that is the ONLY test run
|
|
154
|
+
> you do (NOT this repo's full suite, NOT any review). The orchestrator re-runs the authoritative set
|
|
155
|
+
> + does the independent review after you finish — those are the gate; your own run does not count
|
|
156
|
+
> as the gate.
|
|
157
|
+
>
|
|
158
|
+
> Narrate continuously: a `PLAN: <step1> | <step2> | …` line up front, then a single-line
|
|
159
|
+
> `PROGRESS: [<n>/<total>] <present-tense action>` before every relevant action (and `… done` on
|
|
160
|
+
> completion), spaced so no gap exceeds ~2 min, stdout unbuffered, plus exactly one final
|
|
161
|
+
> `RESULT: DONE|BLOCKED <reason>`.
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## C. Orchestrator only — NOT ADDRESSED TO THE IMPLEMENTER
|
|
166
|
+
|
|
167
|
+
> **If you are the implementer reading this work order as your own specification: STOP at this line.
|
|
168
|
+
> Everything below describes what the Orchestrator does AFTER you finish. You do none of it — no
|
|
169
|
+
> reviewers, no verification run, no register edit, no commit.** You ARE the invocation described
|
|
170
|
+
> below; do NOT shell out to `codex exec`.
|
|
171
|
+
|
|
172
|
+
### Execution directive
|
|
173
|
+
|
|
174
|
+
Implement through `codex exec` in the background — invoked directly via Bash (never the
|
|
175
|
+
`debugger`/`*_coder` Agent wrappers) with BOTH flags `--skip-git-repo-check` and
|
|
176
|
+
`--dangerously-bypass-approvals-and-sandbox`. **Pass the work order via stdin, not as a positional
|
|
177
|
+
argument** (this repo's own `THEME-1` row already documents the Windows command-line length limit
|
|
178
|
+
hitting this via the npm shim). Fallback to direct Claude implementation only on Codex
|
|
179
|
+
quota/rate-limit/non-zero exit — the fallback flips authorship, so both reviewers stay mandatory
|
|
180
|
+
either way.
|
|
181
|
+
|
|
182
|
+
### Review routing
|
|
183
|
+
|
|
184
|
+
Tier 3: `reviewer` (Sonnet) + `ui_reviewer` (Sonnet), concurrent, same background batch, before
|
|
185
|
+
commit. No `sec_reviewer` — no auth/security surface in scope. `ui_reviewer`'s job here is narrow
|
|
186
|
+
(no rendered surface to review) — focus it on the completeness-contract and adopter-safety question
|
|
187
|
+
rather than visual design.
|
|
188
|
+
|
|
189
|
+
### Verification
|
|
190
|
+
|
|
191
|
+
No rendered two-width check — token-only change with no specimen in this repo (per the Envelope).
|
|
192
|
+
The authoritative check is: the two new/extended test files pass, `tests/createAppTheme.test.js` +
|
|
193
|
+
`tests/themeCompleteness.test.js` stay green, and a direct read of `fitness-monitor`'s
|
|
194
|
+
`frontend/src/theme.test.js` assertion confirms it would still pass unmodified against the new
|
|
195
|
+
package version (do not just reason about it — actually run `fitness-monitor`'s own scoped theme
|
|
196
|
+
test against the locally-built `ui-core-micha` if practical, or explain why not).
|
|
197
|
+
|
|
198
|
+
### Register + commit
|
|
199
|
+
|
|
200
|
+
Decide and apply the semver bump (patch, per the Risks section's reasoning, unless the
|
|
201
|
+
implementation reveals an adopter needs a code change — then escalate to minor and say why). Update
|
|
202
|
+
the `WORK_ORDERS.md` THEME-3 row to `done` with the named review verdicts and version, then commit +
|
|
203
|
+
push to `main` on green (this push publishes to npm — confirm everything is green first, there is no
|
|
204
|
+
staging net here).
|
|
205
|
+
|
|
206
|
+
### Mini-handover
|
|
207
|
+
|
|
208
|
+
Repo: `ui-core-micha` (`C:\Users\biglmi\Documents\webapps\ui-core-micha`), branch `main`.
|
|
209
|
+
WO: `work-orders/THEME-3.md`. **Ready to run** — no preconditions, small well-bounded addition.
|
|
210
|
+
Follow `orchestrate-codex`.
|