An over-engineering audit of the whole tree, applied in five reviewed batches. Behaviour stays the same except where UPGRADE.md says otherwise. PHP: the showcase and error-page stylesheets are prebuilt into resources/dist by bin/stylesheets.mjs, through Vite's own postcss-import (first occurrence kept, the order an application's build gives), instead of Stylesheets::bundle() inlining imports on every request; only the import walk DesignGuard needs stays. SchemeStylesheet::withProfiles() replaces three copies of the scheme-plus-profiles loop, material:scheme leaves spec and contrast checks to the node script that already made them, and the error page's scheme cache, the hashed view namespace, the translations path with no lang/ folder and DesignGuard's 1.x-name hints are gone. JS: the androidx shape port progress.js and both bin scripts each carried lives once in resources/js/shapes.js (the generated SVGs are unchanged); util.js holds ringIndex(), ms(), reopenGuard() and remember(), which were written out several times; listeners are released through AbortController; tooltip.js's hoverPopover() serves the rich tooltip too. CSS: every rule for an element inside the navigation rail queries `--md-navigation-rail-value` instead of repeating the seven collapsed conditions under five media branches; badge, alert, progress, slider and button read one non-inheriting colour-role table (components/color.css); the dialog chrome, the submenu's popover chrome, the chip's state layer and touch target, and the visually-hidden inputs use the shared rules they copied; foundation/tokens.css is folded into foundation.css. Views: Support\Field and Support\Link replace the error-key, bound-value and link-attribute blocks copied into the fields and link components; the timepicker period group, the menu filter and the showcase head are partials; the datepicker's steppers and entry fields are loops; component docblocks no longer restate SKILL.md. Tests and tooling: one dataset-driven ComponentStylesheetsTest replaces four per-group files, DesignGuardTest and the layout-component tests use datasets, browser tests share one ready() helper, CSS parsing lives in ComponentStylesheet alone. docs/audits and the finding IDs citing it are removed, as are pestphp/pest-plugin-laravel, the unused composer scripts and check:font; the lint job runs in the feature job, which now installs node packages so the prebuilt-stylesheet staleness test runs in CI. Feature suite 1177 passed, Chrome browser suite 299 passed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
104 lines
4.1 KiB
CSS
104 lines
4.1 KiB
CSS
/*
|
|
* <x-badge>: M3's small and large badges, and the library's status label.
|
|
*
|
|
* BadgeTokens (androidx Compose Material 3, Apache-2.0): the small badge is a 6px dot
|
|
* (`data-md-dot`), the large badge 16px tall and at least 16px wide with 4px either side of a
|
|
* `label-small` count in tabular figures, both fully round and `error` by default. A floating
|
|
* badge sits on M3's anchor geometry at the top-end corner of its `position: relative` parent: the
|
|
* dot flush in the corner, the count 2px above it with its start 12px in from the parent's end.
|
|
*
|
|
* The status label (`data-md-variant`) is not an M3 badge: 24px tall, small corner, 8px either
|
|
* side, 4px between an icon and its word, `label-medium`. `tonal` draws it in the colour's
|
|
* container, `solid` in the colour itself, `outline` as a 1px `outline` edge around
|
|
* `on-surface-variant` text — `outline` rather than `outline-variant`, because M3 asks a badge for
|
|
* 3:1 against what is behind it and `outline-variant` is the decorative role dividers use.
|
|
*
|
|
* `data-md-color` picks the pair of roles; `neutral` has no hue of its own (`on-surface-variant`
|
|
* and `surface`, or `surface-container-high` behind `on-surface-variant` text), and `plain` sets
|
|
* no colour at all, so the caller's CSS paints it.
|
|
*/
|
|
|
|
@layer material.reset, material.tokens, material.base, material.layout, material.components, material.text, material.visibility;
|
|
|
|
@import './color.css';
|
|
|
|
@layer material.components {
|
|
[data-md-badge] {
|
|
--md-badge-color: var(--md-color, var(--md-sys-color-error));
|
|
--md-badge-on-color: var(--md-on-color, var(--md-sys-color-on-error));
|
|
--md-badge-container: var(--md-container, var(--md-sys-color-error-container));
|
|
--md-badge-on-container: var(--md-on-container, var(--md-sys-color-on-error-container));
|
|
|
|
display: inline-flex;
|
|
flex-shrink: 0;
|
|
align-items: center;
|
|
justify-content: center;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
[data-md-badge][data-md-dot] {
|
|
inline-size: 6px;
|
|
block-size: 6px;
|
|
border-radius: var(--md-sys-shape-corner-full);
|
|
}
|
|
|
|
[data-md-badge]:not([data-md-dot], [data-md-variant]) {
|
|
min-inline-size: 16px;
|
|
block-size: 16px;
|
|
border-radius: var(--md-sys-shape-corner-full);
|
|
padding-inline: var(--md-sys-measurement-space50);
|
|
font: var(--md-sys-typescale-label-sm);
|
|
letter-spacing: var(--md-sys-typescale-label-sm-tracking);
|
|
font-variation-settings: normal;
|
|
font-variant-numeric: tabular-nums;
|
|
}
|
|
|
|
[data-md-badge][data-md-variant] {
|
|
gap: var(--md-sys-measurement-space50);
|
|
block-size: 24px;
|
|
border-radius: var(--md-sys-shape-corner-sm);
|
|
padding-inline: var(--md-sys-measurement-space100);
|
|
font: var(--md-sys-typescale-label-md);
|
|
letter-spacing: var(--md-sys-typescale-label-md-tracking);
|
|
font-variation-settings: normal;
|
|
}
|
|
|
|
[data-md-badge][data-md-variant='outline'] {
|
|
border: 1px solid;
|
|
}
|
|
|
|
[data-md-badge][data-md-color='neutral'] {
|
|
--md-badge-color: var(--md-sys-color-on-surface-variant);
|
|
--md-badge-on-color: var(--md-sys-color-surface);
|
|
--md-badge-container: var(--md-sys-color-surface-container-high);
|
|
--md-badge-on-container: var(--md-sys-color-on-surface-variant);
|
|
}
|
|
|
|
[data-md-badge]:not([data-md-color='plain']) {
|
|
background-color: var(--md-badge-color);
|
|
color: var(--md-badge-on-color);
|
|
|
|
&[data-md-variant='tonal'] {
|
|
background-color: var(--md-badge-container);
|
|
color: var(--md-badge-on-container);
|
|
}
|
|
|
|
&[data-md-variant='outline'] {
|
|
border-color: var(--md-sys-color-outline);
|
|
background-color: transparent;
|
|
color: var(--md-sys-color-on-surface-variant);
|
|
}
|
|
}
|
|
|
|
[data-md-badge][data-md-floating] {
|
|
position: absolute;
|
|
inset-block-start: calc(-1 * var(--md-sys-measurement-space25));
|
|
inset-inline-start: calc(100% - 12px);
|
|
}
|
|
|
|
[data-md-badge][data-md-floating][data-md-dot] {
|
|
inset-block-start: 0;
|
|
inset-inline: auto 0;
|
|
}
|
|
}
|