Name the monospace faces once, as a typeface token and md-mono

Both applications show values a person reads or types character by
character: SealShare's share tokens and recovery codes, ReStride's file
and folder names and its keyboard shortcuts. The package wrote the
platform's monospace stack twice (the reset's <code>, <kbd>, <samp> and
the mono field) and gave everything else nothing, so an app copied the
stack by hand. --md-ref-typeface-mono now holds it, read by the reset,
the field and a new md-mono text class; the guard points font-mono at
<code> or md-mono. Not an M3 token: M3 names a brand and a plain
typeface and nothing for code. Decided with the user (plan step 46).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Andreas Reinhold / reini
2026-09-15 12:56:55 +02:00
co-authored by Claude Opus 5
parent 92d3d761f3
commit f307079a45
8 changed files with 34 additions and 5 deletions
+14
View File
@@ -222,6 +222,19 @@ it('paints the page in surface and on-surface, in the brand typeface, smoothed i
->not->toContain('font-smoothing');
});
it('names the monospace faces once, as a typeface token the reset, the field and md-mono read', function () {
// Not an M3 token: M3 names a brand and a plain typeface and nothing for code.
$sources = collect(File::allFiles(stylesheetPath()))
->filter(fn (SplFileInfo $file): bool => str_contains($file->getContents(), 'ui-monospace'))
->map(fn (SplFileInfo $file): string => str_replace(stylesheetPath().'/', '', $file->getPathname()))
->values()
->all();
expect($sources)->toBe(['tokens/type.css'])
->and((string) file_get_contents(stylesheetPath('foundation/reset.css')))->toContain('font-family: var(--md-ref-typeface-mono);')
->and((string) file_get_contents(stylesheetPath('components/field.css')))->toContain('font-family: var(--md-ref-typeface-mono);');
});
it('leaves no stylesheet under resources/css/ outside all.css or showcase.css', function () {
// The full tree now that Tailwind is gone (plan step 39): every .css file on disk, not just the
// ones a bundler happens to reach — a stray or orphaned file would show up here even though
@@ -710,6 +723,7 @@ it('ships exactly the documented text classes, each ink an M3 role', function ()
'md-line-clamp-3' => ['overflow' => 'hidden', 'display' => '-webkit-box', '-webkit-box-orient' => 'vertical', '-webkit-line-clamp' => '3'],
'md-nowrap' => ['white-space' => 'nowrap'],
'md-tabular' => ['font-variant-numeric' => 'tabular-nums'],
'md-mono' => ['font-family' => 'var(--md-ref-typeface-mono)'],
'md-visually-hidden' => [
'position' => 'absolute', 'width' => '1px', 'height' => '1px', 'padding' => '0', 'margin' => '-1px',
'overflow' => 'hidden', 'clip-path' => 'inset(50%)', 'white-space' => 'nowrap', 'border-width' => '0',