@aglyn/shared-ui-theme 1.0.0-beta.222 → 1.0.0-beta.223
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 +3 -3
- package/package.json +4 -4
- package/src/lib/console.theme.js +40 -1
- package/src/lib/console.theme.js.map +1 -1
- package/src/lib/util/accent-text.d.ts +72 -1
- package/src/lib/util/accent-text.js +121 -4
- package/src/lib/util/accent-text.js.map +1 -1
- package/src/lib/util/create-responsive-theme.js +64 -1
- package/src/lib/util/create-responsive-theme.js.map +1 -1
- package/src/vendor/mui.d.ts +25 -0
- package/src/vendor/mui.js.map +1 -1
package/README.md
CHANGED
|
@@ -14,14 +14,14 @@ Peer dependencies: `react`, `@mui/material`, `@mui/system`, `@mui/utils`, `@mui/
|
|
|
14
14
|
|
|
15
15
|
From the root entry:
|
|
16
16
|
|
|
17
|
-
- **Theme factory.** `createResponsiveTheme({ themeOptions, responsiveFontSizesOptions? })` runs `createTheme`, derives shades for the extra palette colors, repairs derived shades that miss AA contrast, and applies `responsiveFontSizes` across every breakpoint. `createResponsiveCssVarTheme(light, dark, options?)` combines two themes into one CSS-variables theme switched by class.
|
|
18
|
-
- **MUI module augmentation.** Importing the package extends MUI's types with the palette additions these themes use (`tertiary`, `surface`, `tint`), extra typography variants such as `displayXl`, and the matching component `color` overrides. It also re-exports a selection of MUI types and helpers (`Theme`, `ThemeOptions`, `SxProps`, `darkScrollbar`, `visuallyHidden`).
|
|
17
|
+
- **Theme factory.** `createResponsiveTheme({ themeOptions, responsiveFontSizesOptions? })` runs `createTheme`, derives shades for the extra palette colors, repairs derived shades that miss AA contrast, derives each palette color's hover shades (`hover`, the fill a hovered contained Button or Fab takes under its own `contrastText`, and `hoverText`, the hovered text/outlined label), and applies `responsiveFontSizes` across every breakpoint. `createResponsiveCssVarTheme(light, dark, options?)` combines two themes into one CSS-variables theme switched by class.
|
|
18
|
+
- **MUI module augmentation.** Importing the package extends MUI's types with the palette additions these themes use (`tertiary`, `surface`, `tint`, and `hover` / `hoverText` on every palette color), extra typography variants such as `displayXl`, and the matching component `color` overrides. It also re-exports a selection of MUI types and helpers (`Theme`, `ThemeOptions`, `SxProps`, `darkScrollbar`, `visuallyHidden`).
|
|
19
19
|
- **Default themes.** `consoleThemeLight` / `consoleThemeDark` / `consoleThemeCssVar` / `getConsoleTheme(mode)` and `tenantThemeLight` / `tenantThemeDark`, with their `ThemeOptions` (`consoleOptions`, `tenantOptions` and the dark variants). `siteFallbackTheme(host, scheme)` and `siteBaseOptions(host, scheme)` pick between them for a host.
|
|
20
20
|
- **Host theme.** A `HostTheme` (the type lives in `@aglyn/shared-data-types`) is a site's theme customization as plain data. `hostThemeToThemeOptions(theme, scheme)` converts it to `ThemeOptions`; `sanitizeHostTheme`, `mergeThemeOptions`, `hasHostTheme` and `getGoogleFontsUrl` support it. `HostThemeProvider` renders children under it, taking `theme`, a required `fallback` theme or `[light, dark]` pair, `baseOptions`, and `initialMode` / `initialDeviceMode` so a server render can choose the scheme before hydration.
|
|
21
21
|
- **Self-hosted fonts.** `util/self-hosted-fonts` reads a Google Fonts CSS2 stylesheet into `@font-face` rules (`parseGoogleFontFaces`), writes them back with every file on the site's own `/api/fonts` route (`selfHostedFontFaceCss`), and picks the one or two faces worth preloading (`selfHostedFontPreloads`). The tenant fetches and serves; this half is pure.
|
|
22
22
|
- **Light/dark mode.** `createWithThemeProvider({ theme })` returns a higher-order component that provides the theme and mode state; `useThemeMode()` reads and toggles it. The choice is stored in the `theme-color-mode` cookie (`COOKIE_THEME_KEY`).
|
|
23
23
|
- **Emotion.** `createEmotionCache`, `CacheProvider`, `createLayeredEmotionCache`, `createWithEmotionClientCache`, and the constants `EMOTION_CACHE_KEY`, `APP_EMOTION_CACHE_OPTIONS`, `MUI_CSS_LAYER_NAME`.
|
|
24
|
-
- **Contrast.** `contrastRatio`, `relativeLuminance`, `meetsContrast`, `accessibleShade`, `accentTextColor`, `accentFillColor`, `auditPaletteContrast`, with `AA_TEXT_CONTRAST` (4.5) and `AA_NON_TEXT_CONTRAST` (3).
|
|
24
|
+
- **Contrast.** `contrastRatio`, `relativeLuminance`, `meetsContrast`, `accessibleShade`, `accentTextColor`, `accentFillColor`, `accentHoverFillColor`, `accentHoverTextColor`, `hoverFillShade`, `inkContrast`, `auditPaletteContrast`, with `AA_TEXT_CONTRAST` (4.5) and `AA_NON_TEXT_CONTRAST` (3).
|
|
25
25
|
- **Small helpers.** `mergeSxProps` / `useMergeSxProps`, `generateComponentClassKeys`, `FontFamily`, `buildFontFamilyList`.
|
|
26
26
|
|
|
27
27
|
By subpath only: `util/theme-editor-fields` and `util/theme-editor-defaults` (the field vocabulary and readers/writers a theme editor uses over a `HostTheme`), `util/theme-mode-cookie`, `util/color-scheme-hint` and `util/scheme-route-segment` (server-side resolution of the visitor's scheme).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aglyn/shared-ui-theme",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.223",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"homepage": "https://aglyn.com",
|
|
6
6
|
"repository": {
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"./package.json": "./package.json"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@aglyn/shared-data-types": "1.0.0-beta.
|
|
29
|
-
"@aglyn/shared-util-tools": "1.0.0-beta.
|
|
30
|
-
"@aglyn/shared-util-vendor": "1.0.0-beta.
|
|
28
|
+
"@aglyn/shared-data-types": "1.0.0-beta.223",
|
|
29
|
+
"@aglyn/shared-util-tools": "1.0.0-beta.223",
|
|
30
|
+
"@aglyn/shared-util-vendor": "1.0.0-beta.223",
|
|
31
31
|
"@emotion/cache": "^11.14.0",
|
|
32
32
|
"@emotion/react": "11.14.0",
|
|
33
33
|
"@swc/helpers": "0.5.23",
|
package/src/lib/console.theme.js
CHANGED
|
@@ -16,7 +16,7 @@ import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/ import { lightBlue } from "@mui/material/colors";
|
|
18
18
|
import { buildFontFamilyList } from "./constants.js";
|
|
19
|
-
import { accentTextColor } from "./util/accent-text.js";
|
|
19
|
+
import { accentHoverFillColor, accentHoverTextColor, accentTextColor } from "./util/accent-text.js";
|
|
20
20
|
import createResponsiveTheme, { createResponsiveCssVarTheme } from "./util/create-responsive-theme.js";
|
|
21
21
|
const colorScheme = {
|
|
22
22
|
light: {
|
|
@@ -287,11 +287,25 @@ const baseOptions = {
|
|
|
287
287
|
// and `--variant-containedBg` are left on `main`: a border and a
|
|
288
288
|
// fill owe 3:1, and the brand belongs there.
|
|
289
289
|
//
|
|
290
|
+
// Hover, every variant (AGL-3465). MUI's contained hover sets
|
|
291
|
+
// `--variant-containedBg` to `palette[color].dark` — the accent-text
|
|
292
|
+
// shade, LIGHTER than `main` in a dark scheme, so a white label
|
|
293
|
+
// sinks to ~2:1 under the pointer. It takes the hover fill
|
|
294
|
+
// (`palette[color].hover`) instead, which carries `contrastText` at
|
|
295
|
+
// AA in both schemes. Text and outlined labels take `hoverText`,
|
|
296
|
+
// the accent-text shade that still clears AA once MUI's hover wash
|
|
297
|
+
// is under it. Same media query and selector as MUI's rule, emitted
|
|
298
|
+
// after it, so these win on a pointer device and a touch screen
|
|
299
|
+
// keeps MUI's reset. `inherit` has no palette entry and keeps MUI's
|
|
300
|
+
// grey hover.
|
|
301
|
+
//
|
|
290
302
|
// Resolved per instance rather than baked, because `components` are
|
|
291
303
|
// evaluated ONCE against the root theme — a literal read here would
|
|
292
304
|
// freeze the light-scheme hex into dark mode.
|
|
293
305
|
root: ({ theme, ownerState })=>{
|
|
294
306
|
const accent = accentTextColor(theme, ownerState == null ? void 0 : ownerState.color);
|
|
307
|
+
const hoverFill = accentHoverFillColor(theme, ownerState == null ? void 0 : ownerState.color);
|
|
308
|
+
const hoverText = accentHoverTextColor(theme, ownerState == null ? void 0 : ownerState.color);
|
|
295
309
|
return _extends({
|
|
296
310
|
'&a[disabled], &.disabled': {
|
|
297
311
|
pointerEvents: 'none',
|
|
@@ -301,6 +315,15 @@ const baseOptions = {
|
|
|
301
315
|
}, accent && {
|
|
302
316
|
'--variant-textColor': accent,
|
|
303
317
|
'--variant-outlinedColor': accent
|
|
318
|
+
}, (hoverFill || hoverText) && {
|
|
319
|
+
'@media (hover: hover)': {
|
|
320
|
+
'&:hover': _extends({}, hoverFill && {
|
|
321
|
+
'--variant-containedBg': hoverFill
|
|
322
|
+
}, hoverText && {
|
|
323
|
+
'--variant-textColor': hoverText,
|
|
324
|
+
'--variant-outlinedColor': hoverText
|
|
325
|
+
})
|
|
326
|
+
}
|
|
304
327
|
});
|
|
305
328
|
}
|
|
306
329
|
}
|
|
@@ -336,6 +359,22 @@ const baseOptions = {
|
|
|
336
359
|
MuiFab: {
|
|
337
360
|
defaultProps: {
|
|
338
361
|
color: 'primary'
|
|
362
|
+
},
|
|
363
|
+
styleOverrides: {
|
|
364
|
+
// The Fab fills its hover with `palette[color].dark` too, under the
|
|
365
|
+
// same `contrastText` — so it takes the hover fill for the reason
|
|
366
|
+
// `MuiButton` does. Gated to pointer devices, which leaves MUI's own
|
|
367
|
+
// `(hover: none)` reset to `main` in charge on a touch screen.
|
|
368
|
+
root: ({ theme, ownerState })=>{
|
|
369
|
+
const hoverFill = accentHoverFillColor(theme, ownerState == null ? void 0 : ownerState.color);
|
|
370
|
+
return hoverFill ? {
|
|
371
|
+
'@media (hover: hover)': {
|
|
372
|
+
'&:hover': {
|
|
373
|
+
backgroundColor: hoverFill
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
} : {};
|
|
377
|
+
}
|
|
339
378
|
}
|
|
340
379
|
},
|
|
341
380
|
MuiIconButton: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../libs/shared/ui/theme/src/lib/console.theme.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2023 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { lightBlue } from '@mui/material/colors'\nimport type { PaletteOptions, Theme, ThemeOptions } from '../vendor/mui'\nimport { buildFontFamilyList } from './constants'\nimport { accentTextColor } from './util/accent-text'\nimport createResponsiveTheme, {\n createResponsiveCssVarTheme,\n} from './util/create-responsive-theme'\n\nexport type ColorVariant = 'light' | 'dark'\nexport type BackgroundRecord = PaletteOptions['background']\nexport type OrdinalIdentifier<K extends string = ''> =\n 'primary' | 'secondary' | 'tertiary'\nexport type OrdinalRecord<T extends OrdinalIdentifier = OrdinalIdentifier> =\n Pick<PaletteOptions, T>\nexport type PrimaryRecord = OrdinalRecord<'primary'>['primary']\nexport type SecondaryRecord = OrdinalRecord<'secondary'>['secondary']\nexport type TertiaryRecord = OrdinalRecord<'tertiary'>['tertiary']\nexport type ActionIdentifier = 'svgBackground' | 'svgFilled' | 'svgStroke'\nexport type ActionRecord = Pick<PaletteOptions, ActionIdentifier>\n\nconst colorScheme = {\n light: {\n // Palette rotated 2026-08-03 (AGL-1186): the blue accent that every\n // component was already opting into is now `primary`, so nothing has to\n // opt out of a primary that was really a surface tone. Whole colour\n // objects moved, so each keeps the contrastText it shipped with.\n primary: {\n main: '#00b0ff',\n // The accent rendered AS TEXT — `ACCENT_TEXT_SHADE` in\n // `util/accent-text.ts`. Links and the labels of text and outlined\n // buttons read this slot; `main` keeps painting fills, borders and\n // indicators, which owe 3:1 rather than 4.5:1. The brand blue is\n // 2.43:1 on white, so as normal-size text it needs the deeper shade:\n // this one measures 4.95:1 on paper and 4.54:1 on the page.\n dark: '#0077ad',\n contrastText: '#FFFFFF',\n },\n secondary: {\n main: '#e040fb',\n // Same slot, same role. Authored rather than left to derivation so the\n // value every link resolves to is readable in this file: 6.11:1 on\n // paper, 5.61:1 on the page.\n dark: '#9d2db0',\n contrastText: '#FFFFFF',\n },\n tertiary: {\n main: '#404C5C',\n contrastText: '#FFFFFF',\n },\n surface: {\n main: `#F8F9FA`,\n contrastText: '#000000',\n },\n // Pale accent washes used as tile/panel FILLS (AGL-1244). Each member is\n // named after the accent whose icon sits on it — the mega-menu's blue\n // tiles pair `tint.primary` with a `primary.dark` glyph — so the pairing\n // is legible from the token names alone. These were the last raw hexes on\n // the marketing nav; they are not `primary.light` (`#33BFFF`) and never\n // were, which is why the slot had to be named rather than borrowed.\n tint: {\n primary: '#E6F5FF',\n secondary: '#FBE6FE',\n tertiary: '#EEF0F2',\n },\n // MUI's own outlined-input border weight, promoted to a token so a field\n // drawn outside MUI can match one drawn by it (see `PaletteOptions`).\n inputOutline: 'rgba(0, 0, 0, 0.23)',\n background: {\n default: '#F5F5F5',\n paper: '#FFFFFF',\n },\n info: {\n // The deepest blue of this hue that still carries a WHITE label at the\n // 4.5:1 AA text bar (4.56:1). A lighter info takes every filled\n // variant sub-AA, and flipping its ink to dark makes an informational\n // surface read as a warning.\n main: '#1878cd',\n contrastText: '#FFFFFF',\n },\n error: {\n // The deepest red of this hue that keeps a white label at AA (4.51:1).\n // An error surface is a destructive-action affordance, so the fill\n // carries the contrast and the ink stays white.\n main: '#e32c27',\n contrastText: '#FFFFFF',\n },\n success: {\n main: '#4CAF50',\n contrastText: '#000000DE',\n },\n warning: {\n main: '#FFAB40',\n contrastText: '#000000DE',\n },\n grey: {\n 50: '#FAFAFA',\n 100: '#F5F5F5',\n 200: '#EEEEEE',\n 300: '#E0E0E0',\n 400: '#BDBDBD',\n 500: '#9E9E9E',\n 600: '#757575',\n 700: '#616161',\n 800: '#424242',\n 900: '#212121',\n A100: '#D5D5D5',\n A200: '#AAAAAA',\n A400: '#303030',\n A700: '#616161',\n },\n svgBackground: {\n main: '#FAFAFA',\n hover: '#FAFAFA',\n active: '#FAFAFA',\n focus: '#FAFAFA',\n },\n svgFilled: {\n main: '#9E9E9E',\n hover: lightBlue['400'],\n active: lightBlue['400'],\n focus: lightBlue['400'],\n },\n svgStroke: {\n main: '#FFFFFF',\n hover: '#FFFFFF',\n active: '#FFFFFF',\n focus: '#FFFFFF',\n },\n },\n dark: {\n primary: {\n main: '#00b0ff',\n // The accent-as-text slot, LIGHTER than `main` here and deliberately\n // so. MUI derives `dark` as `darken(main, 0.3)` in both schemes — it\n // cannot see that the ground flipped — which lands `#007bb2` at 3.67:1\n // on this page. Every `dark` shade in this scheme is therefore\n // authored, and each is the value `ensureAccessibleShades` computes by\n // walking the accent LIGHTER until it clears 4.5:1 against both\n // `background.default` and `background.paper`. 9.02:1 / 6.62:1.\n dark: '#4dc8ff',\n contrastText: '#FFFFFF',\n },\n secondary: {\n main: '#e040fb',\n // 7.04:1 on the page, 5.17:1 on a raised panel. The brand magenta\n // itself is 3.78:1 on paper, so it cannot be the text shade here.\n dark: '#e979fc',\n contrastText: '#FFFFFF',\n },\n // Dark takes a LIFTED slate, not the brand `#404C5C`: that scores 1.38\n // against this scheme's page and would just move the old invisibility\n // bug from primary to tertiary. `#7C8CA3` measures 5.02 vs page and\n // 3.63 vs a raised panel, and needs dark ink rather than white (6.14\n // against black, 3.42 against white).\n tertiary: {\n main: '#7C8CA3',\n // 7.73:1 / 5.68:1 — `main` itself is 2.78:1 on the page.\n dark: '#a3afbf',\n contrastText: '#000000DE',\n },\n surface: {\n // Held at 1.17:1 from the page even though that is flat for an\n // elevation step. This token is also the panel the besigner draws its\n // hierarchy depth cues on, and lifting it toward the page pushes the\n // active guide — `secondary.main` on this fill — from 4.41:1 down to\n // 3.89:1. Trading a legible cue for a slightly clearer edge is the\n // wrong way round; the depth cues are what someone actually reads.\n main: `#202934`,\n contrastText: '#FFFFFF',\n },\n // The hand-curated dark counterparts the 15 tinted tiles carried in their\n // `@scheme dark` slices before the token existed (AGL-1244). Carrying the\n // exact values here is what lets those slices be DELETED without dark mode\n // shifting: a literal needs a slice, a token flips on its own.\n tint: {\n // Tile FILLS, so the bar is separation from the page rather than a\n // WCAG text ratio: below ~1.5:1 a tinted tile has no visible edge. The\n // originals sat at 1.13–1.25:1 and disappeared. White ink clears 11:1\n // on all three.\n primary: '#193d55',\n // Magenta cannot reach 1.5:1 without turning purple-grey, so this one\n // stops at 1.44:1 and the tile carries an `inputOutline` border in\n // dark instead of pushing the hue further.\n secondary: '#571e61',\n tertiary: '#333b44',\n },\n inputOutline: 'rgba(255, 255, 255, 0.23)',\n background: {\n default: '#161c21',\n paper: '#2a3440',\n },\n info: {\n main: '#1878cd',\n // 6.22:1 / 4.57:1.\n dark: '#5da1dc',\n contrastText: '#FFFFFF',\n },\n error: {\n main: '#e32c27',\n // 6.18:1 / 4.54:1.\n dark: '#ed7876',\n contrastText: '#FFFFFF',\n },\n success: {\n main: '#4CAF50',\n // 8.56:1 / 6.29:1.\n dark: '#82c785',\n contrastText: '#000000DE',\n },\n warning: {\n main: '#FFAB40',\n // 10.98:1 / 8.07:1.\n dark: '#ffc479',\n contrastText: '#000000DE',\n },\n grey: {\n 50: '#FAFAFA',\n 100: '#F5F5F5',\n 200: '#EEEEEE',\n 300: '#E0E0E0',\n 400: '#BDBDBD',\n 500: '#9E9E9E',\n 600: '#757575',\n 700: '#616161',\n 800: '#424242',\n 900: '#212121',\n A100: '#D5D5D5',\n A200: '#AAAAAA',\n A400: '#303030',\n A700: '#616161',\n },\n svgBackground: {\n main: '#FAFAFA',\n hover: '#FAFAFA',\n active: '#FAFAFA',\n focus: '#FAFAFA',\n },\n svgFilled: {\n main: '#9E9E9E',\n hover: lightBlue['A100'],\n active: lightBlue['A100'],\n focus: lightBlue['A100'],\n },\n svgStroke: {\n main: '#FFFFFF',\n hover: '#FFFFFF',\n active: '#FFFFFF',\n focus: '#FFFFFF',\n },\n },\n}\n\nconst shadowKeyUmbraOpacity = 0.2\nconst shadowKeyPenumbraOpacity = 0.14\nconst shadowAmbientShadowOpacity = 0.12\n\nfunction createShadowInset(...px: number[]) {\n return [\n `inset ${px[0]}px ${px[1]}px ${px[2]}px ${px[3]}px rgba(0,0,0,${shadowKeyUmbraOpacity})`,\n `inset ${px[4]}px ${px[5]}px ${px[6]}px ${px[7]}px rgba(0,0,0,${shadowKeyPenumbraOpacity})`,\n `inset ${px[8]}px ${px[9]}px ${px[10]}px ${px[11]}px rgba(0,0,0,${shadowAmbientShadowOpacity})`,\n ].join(',')\n}\n\nconst baseOptions: ThemeOptions = {\n components: {\n MuiAppBar: {\n defaultProps: {\n enableColorOnDark: true,\n },\n },\n MuiAvatar: {\n styleOverrides: {\n root: {\n width: 32,\n height: 32,\n },\n },\n },\n MuiButton: {\n defaultProps: {\n color: 'primary',\n },\n styleOverrides: {\n // MUI's own variants set `--variant-textColor` and\n // `--variant-outlinedColor` to `palette[color].main`, which paints\n // the brand color as normal-size text — `#00b0ff` at 2.43:1 on\n // white. Both vars move to the accent-text shade\n // (`palette[color].dark`, scheme-aware). `--variant-outlinedBorder`\n // and `--variant-containedBg` are left on `main`: a border and a\n // fill owe 3:1, and the brand belongs there.\n //\n // Resolved per instance rather than baked, because `components` are\n // evaluated ONCE against the root theme — a literal read here would\n // freeze the light-scheme hex into dark mode.\n root: ({ theme, ownerState }) => {\n const accent = accentTextColor(theme, ownerState?.color)\n return {\n '&a[disabled], &.disabled': {\n pointerEvents: 'none',\n textDecoration: 'none',\n filter: 'grayscale(1) opacity(0.65)',\n },\n ...(accent && {\n '--variant-textColor': accent,\n '--variant-outlinedColor': accent,\n }),\n }\n },\n },\n },\n /**\n * Room for a floated label at the top of a dialog (AGL-703).\n *\n * MUI zeroes a DialogContent's top padding when it follows a DialogTitle\n * — `.MuiDialogTitle-root + .MuiDialogContent-root` — and the content box\n * scrolls (`overflow-y: auto`). So the first field's shrunk outlined\n * label, which sits ABOVE its own border, is clipped by the scroll\n * container. It shows on any dialog whose first control has a value on\n * open: the New author dialog's `Type` select had its label shaved in\n * half.\n *\n * Twenty-seven dialogs tried to fix this themselves with\n * `sx={{ pt: 1 }}`, and NONE of them worked: MUI's rule is two classes\n * and `sx` is one, so the adjacent-sibling selector wins on specificity\n * every time. Matching that selector here is what makes the fix apply —\n * which is why it belongs in the theme rather than at any call site.\n *\n * 12px: the shrunk label rises ~9px above the input's top edge, plus a\n * little air so it does not sit ON the dialog title.\n */\n MuiDialogContent: {\n styleOverrides: {\n root: ({ theme }: any) => ({\n '.MuiDialogTitle-root + &': {\n paddingTop: theme.spacing(1.5),\n },\n }),\n },\n },\n MuiFab: {\n defaultProps: {\n color: 'primary',\n },\n },\n MuiIconButton: {\n defaultProps: {\n color: 'primary',\n },\n // color: 'inherit', // Default color to inherit\n styleOverrides: {\n root: ({ theme }) => ({\n padding: theme.spacing(1),\n }),\n },\n variants: [\n {\n props: { variant: 'outlined' } as any, // @TODO ⚠️ fix typing\n style: ({ theme }) => ({\n border: `1px solid`,\n borderColor: `inherit`,\n }),\n },\n ],\n },\n MuiLink: {\n defaultProps: {\n color: 'primary',\n },\n styleOverrides: {\n // A Link is text by definition, so `color=\"primary\"` resolving to\n // `palette.primary.main` is always measured against the wrong bar.\n // Only the PaletteColor keys are rewritten — `inherit`,\n // `textPrimary`, `textSecondary` and `textDisabled` return undefined\n // from `accentTextColor` and keep MUI's own resolution.\n root: ({ theme, ownerState }) => {\n const accent = accentTextColor(theme, ownerState?.color)\n return {\n '&[disabled], &.disabled': {\n pointerEvents: 'none',\n textDecoration: 'none',\n filter: 'grayscale(1) opacity(0.65)',\n },\n ...(accent && { color: accent }),\n }\n },\n },\n },\n // MuiMenu: {},\n // No accent defaults live here any more (AGL-1186). Tabs, checkboxes,\n // radios, switches, sliders, progress and badges each briefly carried\n // `color: 'secondary'` to escape a `primary` that was a surface tone.\n // Now that `primary` IS the accent they render correctly on MUI's own\n // default, and a per-component default is exactly what the rotation\n // exists to remove.\n //\n // That includes the `MuiTabs` default AGL-1181 records as its fix: it\n // was removed here deliberately, not reverted. The rotation fixed the\n // root cause the default was papering over, so a reader who finds\n // nothing at that issue's write-up is looking at the right file.\n MuiToolbar: {\n styleOverrides: {\n // Honour `disableGutters` (AGL-1230). This override targets the ROOT\n // slot, and `disableGutters` only drops the `gutters` slot — so the\n // padding survived the prop, app-wide, and the prop silently did\n // nothing at ≥sm. It cost the marketing nav a 24px offset against the\n // page container at every width below the container's clamp.\n root: ({ theme, ownerState }) =>\n ownerState?.disableGutters\n ? {}\n : {\n [theme.breakpoints.up('sm')]: {\n paddingLeft: theme.spacing(3),\n paddingRight: theme.spacing(3),\n },\n },\n },\n },\n // The tertiary indicator (AGL-3411). MUI styles Tabs' indicator for\n // `primary` and `secondary` only, so `indicatorColor=\"tertiary\"` — which\n // the palette and the Tabs element's picker both offer — drew MUI's\n // primary. Resolved per render so it follows the scheme.\n MuiTabs: {\n variants: [\n {\n props: { indicatorColor: 'tertiary' } as any, // augmentation widens this\n style: ({ theme }: any) => ({\n '& .MuiTabs-indicator': {\n backgroundColor: (theme.vars || theme).palette.tertiary.main,\n },\n }),\n },\n ],\n },\n MuiTooltip: {\n defaultProps: {\n arrow: true,\n },\n },\n },\n // mixins: {},\n shadowsInset: [\n 'none',\n createShadowInset(0, 2, 1, -1, 0, 1, 1, -0, 0, 1, 3, -0),\n createShadowInset(0, 3, 1, -2, 0, 2, 2, -0, 0, 1, 5, -0),\n createShadowInset(0, 3, 3, -2, 0, 3, 4, -0, 0, 1, 8, -0),\n createShadowInset(0, 2, 4, -1, 0, 4, 5, -0, 0, 1, 10, -0),\n createShadowInset(0, 3, 5, -1, 0, 5, 8, -0, 0, 1, 14, -0),\n createShadowInset(0, 3, 5, -1, 0, 6, 10, -0, 0, 1, 18, -0),\n createShadowInset(0, 4, 5, -2, 0, 7, 10, -1, 0, 2, 16, -1),\n createShadowInset(0, 5, 5, -3, 0, 8, 10, -1, 0, 3, 14, -2),\n createShadowInset(0, 5, 6, -3, 0, 9, 12, -1, 0, 3, 16, -2),\n createShadowInset(0, 6, 6, -3, 0, 10, 14, -1, 0, 4, 18, -3),\n createShadowInset(0, 6, 7, -4, 0, 11, 15, -1, 0, 4, 20, -3),\n createShadowInset(0, 7, 8, -4, 0, 12, 17, -2, 0, 5, 22, -4),\n createShadowInset(0, 7, 8, -4, 0, 13, 19, -2, 0, 5, 24, -4),\n createShadowInset(0, 7, 9, -4, 0, 14, 21, -2, 0, 5, 26, -4),\n createShadowInset(0, 8, 9, -5, 0, 15, 22, -2, 0, 6, 28, -5),\n createShadowInset(0, 8, 10, -5, 0, 16, 24, -2, 0, 6, 30, -5),\n createShadowInset(0, 8, 11, -5, 0, 17, 26, -2, 0, 6, 32, -5),\n createShadowInset(0, 9, 11, -5, 0, 18, 28, -2, 0, 7, 34, -6),\n createShadowInset(0, 9, 12, -6, 0, 19, 29, -2, 0, 7, 36, -6),\n createShadowInset(0, 10, 13, -6, 0, 20, 31, -3, 0, 8, 38, -7),\n createShadowInset(0, 10, 13, -6, 0, 21, 33, -3, 0, 8, 40, -7),\n createShadowInset(0, 10, 14, -6, 0, 22, 35, -3, 0, 8, 42, -7),\n createShadowInset(0, 11, 14, -7, 0, 23, 36, -3, 0, 9, 44, -8),\n createShadowInset(0, 11, 15, -7, 0, 24, 38, -3, 0, 9, 46, -8),\n ],\n shape: {\n borderRadius: 4,\n appIconBorderRadius: `17.544%`,\n },\n spacing: 8,\n typography: {\n fontFamily: buildFontFamilyList().join(','),\n // The brand's named weights, beyond MUI's four.\n //\n // MUI ships Light 300 / Regular 400 / Medium 500 / Bold 700, and the\n // brand type ramp uses three more: Black for heroes, ExtraBold for H2,\n // SemiBold below Bold. Without these tokens, reaching 600/800/900 means\n // typing a raw number, which pins an element to a weight instead of to\n // the brand and leaves it behind when the ramp moves.\n //\n // They are ADDITIVE — `createTypography` deep-merges unknown keys\n // through its `...other`, so nothing MUI defines changes. And they are\n // reachable the same way the built-ins are: `@mui/system`'s `style()`\n // retries a miss as `${prop}${capitalize(value)}`, so `fontWeight:\n // 'extraBold'` resolves to `typography.fontWeightExtraBold`. The\n // besigner's weight picker discovers them off the theme rather than\n // from a list, so they appear in the panel without another edit.\n //\n // Roboto Flex is a variable face covering 100–1000, so every rung here\n // renders as a real weight rather than a synthesised one.\n fontWeightSemiBold: 600,\n fontWeightExtraBold: 800,\n fontWeightBlack: 900,\n // The brand's display ramp, so `variant=\"h1\"` / `\"h2\"` MEANS the brand.\n // MUI's defaults are Light 300 at 96px/60px — a display face for a\n // Material app, and nothing like the brand's Black heroes and ExtraBold\n // H2. Left at the defaults, every heading on a built page needs a\n // hand-written `fontSize` and `fontWeight` to look right, and the ones\n // that miss render as a Material display face nobody chose while the\n // markup still says Heading 2.\n //\n // Scoped deliberately to h1 and h2. They have ZERO `variant=\"hN\"` usages\n // in the console and one in the tenant app, so this restyles no product\n // surface — it only changes what a SITE gets when it asks for a heading,\n // which is exactly the thing that should follow the brand. h3–h6 carry\n // 95 usages between them and are left on MUI's scale; `overline` has 19\n // and is left alone for the same reason.\n //\n // `responsiveFontSizes` runs over these afterwards (xs→xl), so these are\n // the DESKTOP end of a ramp that scales itself down — 56px/40px here\n // land near the 34px/30px the mobile frames show.\n // The rung ABOVE h1. h1 is the brand's 56px display size and\n // stays that; a hero drawn at 72px had nothing to ask for, so every one\n // hand-wrote `fontSize: '72px'` — and that literal then LOST to h1's own\n // `responsiveFontSizes` ramp on wide viewports, silently rendering 56px.\n // Listed in `RAMPED_DISPLAY_VARIANTS` so it scales down like the rest of\n // the ramp rather than staying 72px on a phone.\n displayXl: {\n fontSize: '4.5rem',\n fontWeight: 900,\n lineHeight: 1.04,\n letterSpacing: '-0.028em',\n },\n h1: {\n fontSize: '3.5rem',\n fontWeight: 900,\n lineHeight: 1.05,\n letterSpacing: '-0.025em',\n },\n h2: {\n fontSize: '2.5rem',\n fontWeight: 800,\n lineHeight: 1.15,\n letterSpacing: '-0.02em',\n },\n // h3 has to come DOWN with them, or the ramp inverts. Retuning h1/h2 to\n // the brand (56/40px) while h3 kept MUI's 48px left a Heading 3 LARGER\n // than a Heading 2 — visible the moment the theme preview listed the\n // variants in size order. h3 carries zero `variant=\"h3\"` usages, the same\n // as h1 and h2, so this restyles no product surface; h4-h6 keep MUI's\n // scale because 95 usages ride on them.\n h3: {\n fontSize: '2.25rem',\n fontWeight: 700,\n lineHeight: 1.2,\n letterSpacing: '-0.015em',\n },\n // The three text rungs the brand uses that MUI's scale has no name for.\n // MUI runs 16 / 14 / 12 (`body1` / `body2` / `caption`); the brand's\n // pages want 17, 13 and 11, and with no token to ask for they write the\n // pixels instead. One marketing page alone can carry 286 such literals —\n // 165 of them the same 11px metadata line — each pinned to a size rather\n // than to the scale.\n //\n // Full variant objects rather than bare sizes, so one pick brings the\n // line height with it: `variant=\"micro\"` or, where the element's own\n // variant must stay, `fontSize: 'micro.fontSize'` — the token path the\n // Font Size picker already offers for `h4.fontSize`.\n //\n // Named for the job, not the number, so the name survives a retune: a\n // lede stays the lede if the brand moves it to 18px.\n lede: {\n fontSize: '1.0625rem',\n fontWeight: 400,\n lineHeight: 1.6,\n },\n bodyCompact: {\n fontSize: '0.8125rem',\n fontWeight: 400,\n lineHeight: 1.5,\n },\n micro: {\n fontSize: '0.6875rem',\n fontWeight: 400,\n lineHeight: 1.6,\n },\n },\n zIndex: {\n max: 2147483647,\n min: -2147483648,\n },\n}\n\nexport const consoleOptions: ThemeOptions = {\n ...baseOptions,\n palette: {\n mode: 'light',\n ...colorScheme.light,\n },\n}\nexport const consoleOptionsDark: ThemeOptions = {\n ...baseOptions,\n palette: {\n mode: 'dark',\n ...colorScheme.dark,\n },\n}\n\nexport const consoleThemeLight: Theme = createResponsiveTheme({\n themeOptions: { ...consoleOptions },\n})\nexport const consoleThemeDark: Theme = createResponsiveTheme({\n themeOptions: { ...consoleOptionsDark },\n})\n\nexport const consoleThemeCssVar = createResponsiveCssVarTheme(\n consoleThemeLight,\n consoleThemeDark,\n)\n\nexport const getConsoleTheme = (mode: 'light' | 'dark' = 'light') => {\n const theme = {\n light: consoleThemeLight,\n dark: consoleThemeDark,\n }\n return theme[mode]\n}\nexport const getConsoleMetaThemeColor = (mode: 'light' | 'dark' = 'light') => {\n const themeColor = {\n light: consoleThemeLight.palette.secondary.main,\n dark: consoleThemeDark.palette.primary.main,\n }\n return themeColor[mode]\n}\nexport default consoleThemeLight\n"],"names":["lightBlue","buildFontFamilyList","accentTextColor","createResponsiveTheme","createResponsiveCssVarTheme","colorScheme","light","primary","main","dark","contrastText","secondary","tertiary","surface","tint","inputOutline","background","default","paper","info","error","success","warning","grey","A100","A200","A400","A700","svgBackground","hover","active","focus","svgFilled","svgStroke","shadowKeyUmbraOpacity","shadowKeyPenumbraOpacity","shadowAmbientShadowOpacity","createShadowInset","px","join","baseOptions","components","MuiAppBar","defaultProps","enableColorOnDark","MuiAvatar","styleOverrides","root","width","height","MuiButton","color","theme","ownerState","accent","pointerEvents","textDecoration","filter","MuiDialogContent","paddingTop","spacing","MuiFab","MuiIconButton","padding","variants","props","variant","style","border","borderColor","MuiLink","MuiToolbar","disableGutters","breakpoints","up","paddingLeft","paddingRight","MuiTabs","indicatorColor","backgroundColor","vars","palette","MuiTooltip","arrow","shadowsInset","shape","borderRadius","appIconBorderRadius","typography","fontFamily","fontWeightSemiBold","fontWeightExtraBold","fontWeightBlack","displayXl","fontSize","fontWeight","lineHeight","letterSpacing","h1","h2","h3","lede","bodyCompact","micro","zIndex","max","min","consoleOptions","mode","consoleOptionsDark","consoleThemeLight","themeOptions","consoleThemeDark","consoleThemeCssVar","getConsoleTheme","getConsoleMetaThemeColor","themeColor"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,SAAS,QAAQ,uBAAsB;AAEhD,SAASC,mBAAmB,QAAQ,iBAAa;AACjD,SAASC,eAAe,QAAQ,wBAAoB;AACpD,OAAOC,yBACLC,2BAA2B,QACtB,oCAAgC;AAcvC,MAAMC,cAAc;IAClBC,OAAO;QACL,o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;QACzE,yEAAyE;QACzE,qBAAqB;QACrB,EAAE;QACF,sEAAsE;QACtE,qEAAqE;QACrE,uEAAuE;QACvE,qDAAqD;QACrD,EAAE;QACF,sEAAsE;QACtE,qDAAqD;QACrDI,MAAM;YACJP,UAAU;YACVC,YAAY;YACZC,YAAY;QACd;QACAM,aAAa;YACXR,UAAU;YACVC,YAAY;YACZC,YAAY;QACd;QACAO,OAAO;YACLT,UAAU;YACVC,YAAY;YACZC,YAAY;QACd;IACF;IACAQ,QAAQ;QACNC,KAAK;QACLC,KAAK,CAAC;IACR;AACF;AAEA,OAAO,MAAMC,iBAA+B,aACvCnE;IACHyC,SAAS;QACP2B,MAAM;OACHvG,YAAYC,KAAK;GAEvB;AACD,OAAO,MAAMuG,qBAAmC,aAC3CrE;IACHyC,SAAS;QACP2B,MAAM;OACHvG,YAAYI,IAAI;GAEtB;AAED,OAAO,MAAMqG,oBAA2B3G,sBAAsB;IAC5D4G,cAAc,aAAKJ;AACrB,GAAE;AACF,OAAO,MAAMK,mBAA0B7G,sBAAsB;IAC3D4G,cAAc,aAAKF;AACrB,GAAE;AAEF,OAAO,MAAMI,qBAAqB7G,4BAChC0G,mBACAE,kBACD;AAED,OAAO,MAAME,kBAAkB,CAACN,OAAyB,OAAO;IAC9D,MAAMxD,QAAQ;QACZ9C,OAAOwG;QACPrG,MAAMuG;IACR;IACA,OAAO5D,KAAK,CAACwD,KAAK;AACpB,EAAC;AACD,OAAO,MAAMO,2BAA2B,CAACP,OAAyB,OAAO;IACvE,MAAMQ,aAAa;QACjB9G,OAAOwG,kBAAkB7B,OAAO,CAACtE,SAAS,CAACH,IAAI;QAC/CC,MAAMuG,iBAAiB/B,OAAO,CAAC1E,OAAO,CAACC,IAAI;IAC7C;IACA,OAAO4G,UAAU,CAACR,KAAK;AACzB,EAAC;AACD,eAAeE,kBAAiB"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/shared/ui/theme/src/lib/console.theme.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2023 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { lightBlue } from '@mui/material/colors'\nimport type { PaletteOptions, Theme, ThemeOptions } from '../vendor/mui'\nimport { buildFontFamilyList } from './constants'\nimport {\n accentHoverFillColor,\n accentHoverTextColor,\n accentTextColor,\n} from './util/accent-text'\nimport createResponsiveTheme, {\n createResponsiveCssVarTheme,\n} from './util/create-responsive-theme'\n\nexport type ColorVariant = 'light' | 'dark'\nexport type BackgroundRecord = PaletteOptions['background']\nexport type OrdinalIdentifier<K extends string = ''> =\n 'primary' | 'secondary' | 'tertiary'\nexport type OrdinalRecord<T extends OrdinalIdentifier = OrdinalIdentifier> =\n Pick<PaletteOptions, T>\nexport type PrimaryRecord = OrdinalRecord<'primary'>['primary']\nexport type SecondaryRecord = OrdinalRecord<'secondary'>['secondary']\nexport type TertiaryRecord = OrdinalRecord<'tertiary'>['tertiary']\nexport type ActionIdentifier = 'svgBackground' | 'svgFilled' | 'svgStroke'\nexport type ActionRecord = Pick<PaletteOptions, ActionIdentifier>\n\nconst colorScheme = {\n light: {\n // Palette rotated 2026-08-03 (AGL-1186): the blue accent that every\n // component was already opting into is now `primary`, so nothing has to\n // opt out of a primary that was really a surface tone. Whole colour\n // objects moved, so each keeps the contrastText it shipped with.\n primary: {\n main: '#00b0ff',\n // The accent rendered AS TEXT — `ACCENT_TEXT_SHADE` in\n // `util/accent-text.ts`. Links and the labels of text and outlined\n // buttons read this slot; `main` keeps painting fills, borders and\n // indicators, which owe 3:1 rather than 4.5:1. The brand blue is\n // 2.43:1 on white, so as normal-size text it needs the deeper shade:\n // this one measures 4.95:1 on paper and 4.54:1 on the page.\n dark: '#0077ad',\n contrastText: '#FFFFFF',\n },\n secondary: {\n main: '#e040fb',\n // Same slot, same role. Authored rather than left to derivation so the\n // value every link resolves to is readable in this file: 6.11:1 on\n // paper, 5.61:1 on the page.\n dark: '#9d2db0',\n contrastText: '#FFFFFF',\n },\n tertiary: {\n main: '#404C5C',\n contrastText: '#FFFFFF',\n },\n surface: {\n main: `#F8F9FA`,\n contrastText: '#000000',\n },\n // Pale accent washes used as tile/panel FILLS (AGL-1244). Each member is\n // named after the accent whose icon sits on it — the mega-menu's blue\n // tiles pair `tint.primary` with a `primary.dark` glyph — so the pairing\n // is legible from the token names alone. These were the last raw hexes on\n // the marketing nav; they are not `primary.light` (`#33BFFF`) and never\n // were, which is why the slot had to be named rather than borrowed.\n tint: {\n primary: '#E6F5FF',\n secondary: '#FBE6FE',\n tertiary: '#EEF0F2',\n },\n // MUI's own outlined-input border weight, promoted to a token so a field\n // drawn outside MUI can match one drawn by it (see `PaletteOptions`).\n inputOutline: 'rgba(0, 0, 0, 0.23)',\n background: {\n default: '#F5F5F5',\n paper: '#FFFFFF',\n },\n info: {\n // The deepest blue of this hue that still carries a WHITE label at the\n // 4.5:1 AA text bar (4.56:1). A lighter info takes every filled\n // variant sub-AA, and flipping its ink to dark makes an informational\n // surface read as a warning.\n main: '#1878cd',\n contrastText: '#FFFFFF',\n },\n error: {\n // The deepest red of this hue that keeps a white label at AA (4.51:1).\n // An error surface is a destructive-action affordance, so the fill\n // carries the contrast and the ink stays white.\n main: '#e32c27',\n contrastText: '#FFFFFF',\n },\n success: {\n main: '#4CAF50',\n contrastText: '#000000DE',\n },\n warning: {\n main: '#FFAB40',\n contrastText: '#000000DE',\n },\n grey: {\n 50: '#FAFAFA',\n 100: '#F5F5F5',\n 200: '#EEEEEE',\n 300: '#E0E0E0',\n 400: '#BDBDBD',\n 500: '#9E9E9E',\n 600: '#757575',\n 700: '#616161',\n 800: '#424242',\n 900: '#212121',\n A100: '#D5D5D5',\n A200: '#AAAAAA',\n A400: '#303030',\n A700: '#616161',\n },\n svgBackground: {\n main: '#FAFAFA',\n hover: '#FAFAFA',\n active: '#FAFAFA',\n focus: '#FAFAFA',\n },\n svgFilled: {\n main: '#9E9E9E',\n hover: lightBlue['400'],\n active: lightBlue['400'],\n focus: lightBlue['400'],\n },\n svgStroke: {\n main: '#FFFFFF',\n hover: '#FFFFFF',\n active: '#FFFFFF',\n focus: '#FFFFFF',\n },\n },\n dark: {\n primary: {\n main: '#00b0ff',\n // The accent-as-text slot, LIGHTER than `main` here and deliberately\n // so. MUI derives `dark` as `darken(main, 0.3)` in both schemes — it\n // cannot see that the ground flipped — which lands `#007bb2` at 3.67:1\n // on this page. Every `dark` shade in this scheme is therefore\n // authored, and each is the value `ensureAccessibleShades` computes by\n // walking the accent LIGHTER until it clears 4.5:1 against both\n // `background.default` and `background.paper`. 9.02:1 / 6.62:1.\n dark: '#4dc8ff',\n contrastText: '#FFFFFF',\n },\n secondary: {\n main: '#e040fb',\n // 7.04:1 on the page, 5.17:1 on a raised panel. The brand magenta\n // itself is 3.78:1 on paper, so it cannot be the text shade here.\n dark: '#e979fc',\n contrastText: '#FFFFFF',\n },\n // Dark takes a LIFTED slate, not the brand `#404C5C`: that scores 1.38\n // against this scheme's page and would just move the old invisibility\n // bug from primary to tertiary. `#7C8CA3` measures 5.02 vs page and\n // 3.63 vs a raised panel, and needs dark ink rather than white (6.14\n // against black, 3.42 against white).\n tertiary: {\n main: '#7C8CA3',\n // 7.73:1 / 5.68:1 — `main` itself is 2.78:1 on the page.\n dark: '#a3afbf',\n contrastText: '#000000DE',\n },\n surface: {\n // Held at 1.17:1 from the page even though that is flat for an\n // elevation step. This token is also the panel the besigner draws its\n // hierarchy depth cues on, and lifting it toward the page pushes the\n // active guide — `secondary.main` on this fill — from 4.41:1 down to\n // 3.89:1. Trading a legible cue for a slightly clearer edge is the\n // wrong way round; the depth cues are what someone actually reads.\n main: `#202934`,\n contrastText: '#FFFFFF',\n },\n // The hand-curated dark counterparts the 15 tinted tiles carried in their\n // `@scheme dark` slices before the token existed (AGL-1244). Carrying the\n // exact values here is what lets those slices be DELETED without dark mode\n // shifting: a literal needs a slice, a token flips on its own.\n tint: {\n // Tile FILLS, so the bar is separation from the page rather than a\n // WCAG text ratio: below ~1.5:1 a tinted tile has no visible edge. The\n // originals sat at 1.13–1.25:1 and disappeared. White ink clears 11:1\n // on all three.\n primary: '#193d55',\n // Magenta cannot reach 1.5:1 without turning purple-grey, so this one\n // stops at 1.44:1 and the tile carries an `inputOutline` border in\n // dark instead of pushing the hue further.\n secondary: '#571e61',\n tertiary: '#333b44',\n },\n inputOutline: 'rgba(255, 255, 255, 0.23)',\n background: {\n default: '#161c21',\n paper: '#2a3440',\n },\n info: {\n main: '#1878cd',\n // 6.22:1 / 4.57:1.\n dark: '#5da1dc',\n contrastText: '#FFFFFF',\n },\n error: {\n main: '#e32c27',\n // 6.18:1 / 4.54:1.\n dark: '#ed7876',\n contrastText: '#FFFFFF',\n },\n success: {\n main: '#4CAF50',\n // 8.56:1 / 6.29:1.\n dark: '#82c785',\n contrastText: '#000000DE',\n },\n warning: {\n main: '#FFAB40',\n // 10.98:1 / 8.07:1.\n dark: '#ffc479',\n contrastText: '#000000DE',\n },\n grey: {\n 50: '#FAFAFA',\n 100: '#F5F5F5',\n 200: '#EEEEEE',\n 300: '#E0E0E0',\n 400: '#BDBDBD',\n 500: '#9E9E9E',\n 600: '#757575',\n 700: '#616161',\n 800: '#424242',\n 900: '#212121',\n A100: '#D5D5D5',\n A200: '#AAAAAA',\n A400: '#303030',\n A700: '#616161',\n },\n svgBackground: {\n main: '#FAFAFA',\n hover: '#FAFAFA',\n active: '#FAFAFA',\n focus: '#FAFAFA',\n },\n svgFilled: {\n main: '#9E9E9E',\n hover: lightBlue['A100'],\n active: lightBlue['A100'],\n focus: lightBlue['A100'],\n },\n svgStroke: {\n main: '#FFFFFF',\n hover: '#FFFFFF',\n active: '#FFFFFF',\n focus: '#FFFFFF',\n },\n },\n}\n\nconst shadowKeyUmbraOpacity = 0.2\nconst shadowKeyPenumbraOpacity = 0.14\nconst shadowAmbientShadowOpacity = 0.12\n\nfunction createShadowInset(...px: number[]) {\n return [\n `inset ${px[0]}px ${px[1]}px ${px[2]}px ${px[3]}px rgba(0,0,0,${shadowKeyUmbraOpacity})`,\n `inset ${px[4]}px ${px[5]}px ${px[6]}px ${px[7]}px rgba(0,0,0,${shadowKeyPenumbraOpacity})`,\n `inset ${px[8]}px ${px[9]}px ${px[10]}px ${px[11]}px rgba(0,0,0,${shadowAmbientShadowOpacity})`,\n ].join(',')\n}\n\nconst baseOptions: ThemeOptions = {\n components: {\n MuiAppBar: {\n defaultProps: {\n enableColorOnDark: true,\n },\n },\n MuiAvatar: {\n styleOverrides: {\n root: {\n width: 32,\n height: 32,\n },\n },\n },\n MuiButton: {\n defaultProps: {\n color: 'primary',\n },\n styleOverrides: {\n // MUI's own variants set `--variant-textColor` and\n // `--variant-outlinedColor` to `palette[color].main`, which paints\n // the brand color as normal-size text — `#00b0ff` at 2.43:1 on\n // white. Both vars move to the accent-text shade\n // (`palette[color].dark`, scheme-aware). `--variant-outlinedBorder`\n // and `--variant-containedBg` are left on `main`: a border and a\n // fill owe 3:1, and the brand belongs there.\n //\n // Hover, every variant (AGL-3465). MUI's contained hover sets\n // `--variant-containedBg` to `palette[color].dark` — the accent-text\n // shade, LIGHTER than `main` in a dark scheme, so a white label\n // sinks to ~2:1 under the pointer. It takes the hover fill\n // (`palette[color].hover`) instead, which carries `contrastText` at\n // AA in both schemes. Text and outlined labels take `hoverText`,\n // the accent-text shade that still clears AA once MUI's hover wash\n // is under it. Same media query and selector as MUI's rule, emitted\n // after it, so these win on a pointer device and a touch screen\n // keeps MUI's reset. `inherit` has no palette entry and keeps MUI's\n // grey hover.\n //\n // Resolved per instance rather than baked, because `components` are\n // evaluated ONCE against the root theme — a literal read here would\n // freeze the light-scheme hex into dark mode.\n root: ({ theme, ownerState }) => {\n const accent = accentTextColor(theme, ownerState?.color)\n const hoverFill = accentHoverFillColor(theme, ownerState?.color)\n const hoverText = accentHoverTextColor(theme, ownerState?.color)\n return {\n '&a[disabled], &.disabled': {\n pointerEvents: 'none',\n textDecoration: 'none',\n filter: 'grayscale(1) opacity(0.65)',\n },\n ...(accent && {\n '--variant-textColor': accent,\n '--variant-outlinedColor': accent,\n }),\n ...((hoverFill || hoverText) && {\n '@media (hover: hover)': {\n '&:hover': {\n ...(hoverFill && { '--variant-containedBg': hoverFill }),\n ...(hoverText && {\n '--variant-textColor': hoverText,\n '--variant-outlinedColor': hoverText,\n }),\n },\n },\n }),\n }\n },\n },\n },\n /**\n * Room for a floated label at the top of a dialog (AGL-703).\n *\n * MUI zeroes a DialogContent's top padding when it follows a DialogTitle\n * — `.MuiDialogTitle-root + .MuiDialogContent-root` — and the content box\n * scrolls (`overflow-y: auto`). So the first field's shrunk outlined\n * label, which sits ABOVE its own border, is clipped by the scroll\n * container. It shows on any dialog whose first control has a value on\n * open: the New author dialog's `Type` select had its label shaved in\n * half.\n *\n * Twenty-seven dialogs tried to fix this themselves with\n * `sx={{ pt: 1 }}`, and NONE of them worked: MUI's rule is two classes\n * and `sx` is one, so the adjacent-sibling selector wins on specificity\n * every time. Matching that selector here is what makes the fix apply —\n * which is why it belongs in the theme rather than at any call site.\n *\n * 12px: the shrunk label rises ~9px above the input's top edge, plus a\n * little air so it does not sit ON the dialog title.\n */\n MuiDialogContent: {\n styleOverrides: {\n root: ({ theme }: any) => ({\n '.MuiDialogTitle-root + &': {\n paddingTop: theme.spacing(1.5),\n },\n }),\n },\n },\n MuiFab: {\n defaultProps: {\n color: 'primary',\n },\n styleOverrides: {\n // The Fab fills its hover with `palette[color].dark` too, under the\n // same `contrastText` — so it takes the hover fill for the reason\n // `MuiButton` does. Gated to pointer devices, which leaves MUI's own\n // `(hover: none)` reset to `main` in charge on a touch screen.\n root: ({ theme, ownerState }) => {\n const hoverFill = accentHoverFillColor(theme, ownerState?.color)\n return hoverFill\n ? {\n '@media (hover: hover)': {\n '&:hover': { backgroundColor: hoverFill },\n },\n }\n : {}\n },\n },\n },\n MuiIconButton: {\n defaultProps: {\n color: 'primary',\n },\n // color: 'inherit', // Default color to inherit\n styleOverrides: {\n root: ({ theme }) => ({\n padding: theme.spacing(1),\n }),\n },\n variants: [\n {\n props: { variant: 'outlined' } as any, // @TODO ⚠️ fix typing\n style: ({ theme }) => ({\n border: `1px solid`,\n borderColor: `inherit`,\n }),\n },\n ],\n },\n MuiLink: {\n defaultProps: {\n color: 'primary',\n },\n styleOverrides: {\n // A Link is text by definition, so `color=\"primary\"` resolving to\n // `palette.primary.main` is always measured against the wrong bar.\n // Only the PaletteColor keys are rewritten — `inherit`,\n // `textPrimary`, `textSecondary` and `textDisabled` return undefined\n // from `accentTextColor` and keep MUI's own resolution.\n root: ({ theme, ownerState }) => {\n const accent = accentTextColor(theme, ownerState?.color)\n return {\n '&[disabled], &.disabled': {\n pointerEvents: 'none',\n textDecoration: 'none',\n filter: 'grayscale(1) opacity(0.65)',\n },\n ...(accent && { color: accent }),\n }\n },\n },\n },\n // MuiMenu: {},\n // No accent defaults live here any more (AGL-1186). Tabs, checkboxes,\n // radios, switches, sliders, progress and badges each briefly carried\n // `color: 'secondary'` to escape a `primary` that was a surface tone.\n // Now that `primary` IS the accent they render correctly on MUI's own\n // default, and a per-component default is exactly what the rotation\n // exists to remove.\n //\n // That includes the `MuiTabs` default AGL-1181 records as its fix: it\n // was removed here deliberately, not reverted. The rotation fixed the\n // root cause the default was papering over, so a reader who finds\n // nothing at that issue's write-up is looking at the right file.\n MuiToolbar: {\n styleOverrides: {\n // Honour `disableGutters` (AGL-1230). This override targets the ROOT\n // slot, and `disableGutters` only drops the `gutters` slot — so the\n // padding survived the prop, app-wide, and the prop silently did\n // nothing at ≥sm. It cost the marketing nav a 24px offset against the\n // page container at every width below the container's clamp.\n root: ({ theme, ownerState }) =>\n ownerState?.disableGutters\n ? {}\n : {\n [theme.breakpoints.up('sm')]: {\n paddingLeft: theme.spacing(3),\n paddingRight: theme.spacing(3),\n },\n },\n },\n },\n // The tertiary indicator (AGL-3411). MUI styles Tabs' indicator for\n // `primary` and `secondary` only, so `indicatorColor=\"tertiary\"` — which\n // the palette and the Tabs element's picker both offer — drew MUI's\n // primary. Resolved per render so it follows the scheme.\n MuiTabs: {\n variants: [\n {\n props: { indicatorColor: 'tertiary' } as any, // augmentation widens this\n style: ({ theme }: any) => ({\n '& .MuiTabs-indicator': {\n backgroundColor: (theme.vars || theme).palette.tertiary.main,\n },\n }),\n },\n ],\n },\n MuiTooltip: {\n defaultProps: {\n arrow: true,\n },\n },\n },\n // mixins: {},\n shadowsInset: [\n 'none',\n createShadowInset(0, 2, 1, -1, 0, 1, 1, -0, 0, 1, 3, -0),\n createShadowInset(0, 3, 1, -2, 0, 2, 2, -0, 0, 1, 5, -0),\n createShadowInset(0, 3, 3, -2, 0, 3, 4, -0, 0, 1, 8, -0),\n createShadowInset(0, 2, 4, -1, 0, 4, 5, -0, 0, 1, 10, -0),\n createShadowInset(0, 3, 5, -1, 0, 5, 8, -0, 0, 1, 14, -0),\n createShadowInset(0, 3, 5, -1, 0, 6, 10, -0, 0, 1, 18, -0),\n createShadowInset(0, 4, 5, -2, 0, 7, 10, -1, 0, 2, 16, -1),\n createShadowInset(0, 5, 5, -3, 0, 8, 10, -1, 0, 3, 14, -2),\n createShadowInset(0, 5, 6, -3, 0, 9, 12, -1, 0, 3, 16, -2),\n createShadowInset(0, 6, 6, -3, 0, 10, 14, -1, 0, 4, 18, -3),\n createShadowInset(0, 6, 7, -4, 0, 11, 15, -1, 0, 4, 20, -3),\n createShadowInset(0, 7, 8, -4, 0, 12, 17, -2, 0, 5, 22, -4),\n createShadowInset(0, 7, 8, -4, 0, 13, 19, -2, 0, 5, 24, -4),\n createShadowInset(0, 7, 9, -4, 0, 14, 21, -2, 0, 5, 26, -4),\n createShadowInset(0, 8, 9, -5, 0, 15, 22, -2, 0, 6, 28, -5),\n createShadowInset(0, 8, 10, -5, 0, 16, 24, -2, 0, 6, 30, -5),\n createShadowInset(0, 8, 11, -5, 0, 17, 26, -2, 0, 6, 32, -5),\n createShadowInset(0, 9, 11, -5, 0, 18, 28, -2, 0, 7, 34, -6),\n createShadowInset(0, 9, 12, -6, 0, 19, 29, -2, 0, 7, 36, -6),\n createShadowInset(0, 10, 13, -6, 0, 20, 31, -3, 0, 8, 38, -7),\n createShadowInset(0, 10, 13, -6, 0, 21, 33, -3, 0, 8, 40, -7),\n createShadowInset(0, 10, 14, -6, 0, 22, 35, -3, 0, 8, 42, -7),\n createShadowInset(0, 11, 14, -7, 0, 23, 36, -3, 0, 9, 44, -8),\n createShadowInset(0, 11, 15, -7, 0, 24, 38, -3, 0, 9, 46, -8),\n ],\n shape: {\n borderRadius: 4,\n appIconBorderRadius: `17.544%`,\n },\n spacing: 8,\n typography: {\n fontFamily: buildFontFamilyList().join(','),\n // The brand's named weights, beyond MUI's four.\n //\n // MUI ships Light 300 / Regular 400 / Medium 500 / Bold 700, and the\n // brand type ramp uses three more: Black for heroes, ExtraBold for H2,\n // SemiBold below Bold. Without these tokens, reaching 600/800/900 means\n // typing a raw number, which pins an element to a weight instead of to\n // the brand and leaves it behind when the ramp moves.\n //\n // They are ADDITIVE — `createTypography` deep-merges unknown keys\n // through its `...other`, so nothing MUI defines changes. And they are\n // reachable the same way the built-ins are: `@mui/system`'s `style()`\n // retries a miss as `${prop}${capitalize(value)}`, so `fontWeight:\n // 'extraBold'` resolves to `typography.fontWeightExtraBold`. The\n // besigner's weight picker discovers them off the theme rather than\n // from a list, so they appear in the panel without another edit.\n //\n // Roboto Flex is a variable face covering 100–1000, so every rung here\n // renders as a real weight rather than a synthesised one.\n fontWeightSemiBold: 600,\n fontWeightExtraBold: 800,\n fontWeightBlack: 900,\n // The brand's display ramp, so `variant=\"h1\"` / `\"h2\"` MEANS the brand.\n // MUI's defaults are Light 300 at 96px/60px — a display face for a\n // Material app, and nothing like the brand's Black heroes and ExtraBold\n // H2. Left at the defaults, every heading on a built page needs a\n // hand-written `fontSize` and `fontWeight` to look right, and the ones\n // that miss render as a Material display face nobody chose while the\n // markup still says Heading 2.\n //\n // Scoped deliberately to h1 and h2. They have ZERO `variant=\"hN\"` usages\n // in the console and one in the tenant app, so this restyles no product\n // surface — it only changes what a SITE gets when it asks for a heading,\n // which is exactly the thing that should follow the brand. h3–h6 carry\n // 95 usages between them and are left on MUI's scale; `overline` has 19\n // and is left alone for the same reason.\n //\n // `responsiveFontSizes` runs over these afterwards (xs→xl), so these are\n // the DESKTOP end of a ramp that scales itself down — 56px/40px here\n // land near the 34px/30px the mobile frames show.\n // The rung ABOVE h1. h1 is the brand's 56px display size and\n // stays that; a hero drawn at 72px had nothing to ask for, so every one\n // hand-wrote `fontSize: '72px'` — and that literal then LOST to h1's own\n // `responsiveFontSizes` ramp on wide viewports, silently rendering 56px.\n // Listed in `RAMPED_DISPLAY_VARIANTS` so it scales down like the rest of\n // the ramp rather than staying 72px on a phone.\n displayXl: {\n fontSize: '4.5rem',\n fontWeight: 900,\n lineHeight: 1.04,\n letterSpacing: '-0.028em',\n },\n h1: {\n fontSize: '3.5rem',\n fontWeight: 900,\n lineHeight: 1.05,\n letterSpacing: '-0.025em',\n },\n h2: {\n fontSize: '2.5rem',\n fontWeight: 800,\n lineHeight: 1.15,\n letterSpacing: '-0.02em',\n },\n // h3 has to come DOWN with them, or the ramp inverts. Retuning h1/h2 to\n // the brand (56/40px) while h3 kept MUI's 48px left a Heading 3 LARGER\n // than a Heading 2 — visible the moment the theme preview listed the\n // variants in size order. h3 carries zero `variant=\"h3\"` usages, the same\n // as h1 and h2, so this restyles no product surface; h4-h6 keep MUI's\n // scale because 95 usages ride on them.\n h3: {\n fontSize: '2.25rem',\n fontWeight: 700,\n lineHeight: 1.2,\n letterSpacing: '-0.015em',\n },\n // The three text rungs the brand uses that MUI's scale has no name for.\n // MUI runs 16 / 14 / 12 (`body1` / `body2` / `caption`); the brand's\n // pages want 17, 13 and 11, and with no token to ask for they write the\n // pixels instead. One marketing page alone can carry 286 such literals —\n // 165 of them the same 11px metadata line — each pinned to a size rather\n // than to the scale.\n //\n // Full variant objects rather than bare sizes, so one pick brings the\n // line height with it: `variant=\"micro\"` or, where the element's own\n // variant must stay, `fontSize: 'micro.fontSize'` — the token path the\n // Font Size picker already offers for `h4.fontSize`.\n //\n // Named for the job, not the number, so the name survives a retune: a\n // lede stays the lede if the brand moves it to 18px.\n lede: {\n fontSize: '1.0625rem',\n fontWeight: 400,\n lineHeight: 1.6,\n },\n bodyCompact: {\n fontSize: '0.8125rem',\n fontWeight: 400,\n lineHeight: 1.5,\n },\n micro: {\n fontSize: '0.6875rem',\n fontWeight: 400,\n lineHeight: 1.6,\n },\n },\n zIndex: {\n max: 2147483647,\n min: -2147483648,\n },\n}\n\nexport const consoleOptions: ThemeOptions = {\n ...baseOptions,\n palette: {\n mode: 'light',\n ...colorScheme.light,\n },\n}\nexport const consoleOptionsDark: ThemeOptions = {\n ...baseOptions,\n palette: {\n mode: 'dark',\n ...colorScheme.dark,\n },\n}\n\nexport const consoleThemeLight: Theme = createResponsiveTheme({\n themeOptions: { ...consoleOptions },\n})\nexport const consoleThemeDark: Theme = createResponsiveTheme({\n themeOptions: { ...consoleOptionsDark },\n})\n\nexport const consoleThemeCssVar = createResponsiveCssVarTheme(\n consoleThemeLight,\n consoleThemeDark,\n)\n\nexport const getConsoleTheme = (mode: 'light' | 'dark' = 'light') => {\n const theme = {\n light: consoleThemeLight,\n dark: consoleThemeDark,\n }\n return theme[mode]\n}\nexport const getConsoleMetaThemeColor = (mode: 'light' | 'dark' = 'light') => {\n const themeColor = {\n light: consoleThemeLight.palette.secondary.main,\n dark: consoleThemeDark.palette.primary.main,\n }\n return themeColor[mode]\n}\nexport default consoleThemeLight\n"],"names":["lightBlue","buildFontFamilyList","accentHoverFillColor","accentHoverTextColor","accentTextColor","createResponsiveTheme","createResponsiveCssVarTheme","colorScheme","light","primary","main","dark","contrastText","secondary","tertiary","surface","tint","inputOutline","background","default","paper","info","error","success","warning","grey","A100","A200","A400","A700","svgBackground","hover","active","focus","svgFilled","svgStroke","shadowKeyUmbraOpacity","shadowKeyPenumbraOpacity","shadowAmbientShadowOpacity","createShadowInset","px","join","baseOptions","components","MuiAppBar","defaultProps","enableColorOnDark","MuiAvatar","styleOverrides","root","width","height","MuiButton","color","theme","ownerState","accent","hoverFill","hoverText","pointerEvents","textDecoration","filter","MuiDialogContent","paddingTop","spacing","MuiFab","backgroundColor","MuiIconButton","padding","variants","props","variant","style","border","borderColor","MuiLink","MuiToolbar","disableGutters","breakpoints","up","paddingLeft","paddingRight","MuiTabs","indicatorColor","vars","palette","MuiTooltip","arrow","shadowsInset","shape","borderRadius","appIconBorderRadius","typography","fontFamily","fontWeightSemiBold","fontWeightExtraBold","fontWeightBlack","displayXl","fontSize","fontWeight","lineHeight","letterSpacing","h1","h2","h3","lede","bodyCompact","micro","zIndex","max","min","consoleOptions","mode","consoleOptionsDark","consoleThemeLight","themeOptions","consoleThemeDark","consoleThemeCssVar","getConsoleTheme","getConsoleMetaThemeColor","themeColor"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,SAAS,QAAQ,uBAAsB;AAEhD,SAASC,mBAAmB,QAAQ,iBAAa;AACjD,SACEC,oBAAoB,EACpBC,oBAAoB,EACpBC,eAAe,QACV,wBAAoB;AAC3B,OAAOC,yBACLC,2BAA2B,QACtB,oCAAgC;AAcvC,MAAMC,cAAc;IAClBC,OAAO;QACL,oEAAoE;QACpE,wEAAwE;QACxE,oEAAoE;QACpE,iEAAiE;QACjEC,SAAS;YACPC,MAAM;YACN,uDAAuD;YACvD,mEAAmE;YACnE,mEAAmE;YACnE,iEAAiE;YACjE,qEAAqE;YACrE,4DAA4D;YAC5DC,MAAM;YACNC,cAAc;QAChB;QACAC,WAAW;YACTH,MAAM;YACN,uEAAuE;YACvE,mEAAmE;YACnE,6BAA6B;YAC7BC,MAAM;YACNC,cAAc;QAChB;QACAE,U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kBAAkB,CAACN,OAAyB,OAAO;IAC9D,MAAM1D,QAAQ;QACZ9C,OAAO0G;QACPvG,MAAMyG;IACR;IACA,OAAO9D,KAAK,CAAC0D,KAAK;AACpB,EAAC;AACD,OAAO,MAAMO,2BAA2B,CAACP,OAAyB,OAAO;IACvE,MAAMQ,aAAa;QACjBhH,OAAO0G,kBAAkB7B,OAAO,CAACxE,SAAS,CAACH,IAAI;QAC/CC,MAAMyG,iBAAiB/B,OAAO,CAAC5E,OAAO,CAACC,IAAI;IAC7C;IACA,OAAO8G,UAAU,CAACR,KAAK;AACzB,EAAC;AACD,eAAeE,kBAAiB"}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
import type
|
|
17
|
+
import { type Palette, type PaletteColor, type Theme } from '../../vendor/mui';
|
|
18
18
|
/**
|
|
19
19
|
* The palette slot that carries "this accent, rendered AS TEXT on the
|
|
20
20
|
* scheme's own surfaces" (AGL-1293 / AGL-1297).
|
|
@@ -58,6 +58,77 @@ export declare const AA_NON_TEXT_CONTRAST = 3;
|
|
|
58
58
|
* `undefined`.
|
|
59
59
|
*/
|
|
60
60
|
export declare function accentTextColor(theme: Theme | undefined, color: string | undefined): string | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* The palette slot that carries "this accent's FILL under the pointer": the
|
|
63
|
+
* background a contained Button or a Fab takes on hover, painted under the
|
|
64
|
+
* accent's own `contrastText` (AGL-3465).
|
|
65
|
+
*
|
|
66
|
+
* MUI paints that hover with `palette[color].dark`, and `dark` here is
|
|
67
|
+
* {@link ACCENT_TEXT_SHADE} — chosen to be READ ON the page, so it is LIGHTER
|
|
68
|
+
* than `main` in a dark scheme. A white label on the console's dark-scheme
|
|
69
|
+
* `primary.dark` measures 1.91:1; on the tenant default's `#5e9fe0`,
|
|
70
|
+
* 2.80:1. The fill and the text shade answer different questions, so they
|
|
71
|
+
* get different slots, and `createResponsiveTheme` derives this one for
|
|
72
|
+
* every palette color with a `contrastText` — see {@link hoverFillShade}.
|
|
73
|
+
*/
|
|
74
|
+
export declare const ACCENT_HOVER_FILL: "hover";
|
|
75
|
+
/**
|
|
76
|
+
* The hover fill for `color`, as a value safe to hand to a `styleOverrides`
|
|
77
|
+
* root — the counterpart of {@link accentTextColor}, and resolved the same
|
|
78
|
+
* way: a `var()` on a CSS-vars theme so it follows the scheme, a literal on
|
|
79
|
+
* a single-mode theme. Wired into `MuiButton`'s contained hover and
|
|
80
|
+
* `MuiFab`'s hover in `console.theme.ts`.
|
|
81
|
+
*/
|
|
82
|
+
export declare function accentHoverFillColor(theme: Theme | undefined, color: string | undefined): string | undefined;
|
|
83
|
+
/**
|
|
84
|
+
* The palette slot that carries "this accent as TEXT, on its own hover
|
|
85
|
+
* wash": the label of a hovered text or outlined Button (AGL-3465).
|
|
86
|
+
*
|
|
87
|
+
* MUI hovers those two variants by laying `main` at
|
|
88
|
+
* `palette.action.hoverOpacity` over whatever they sit on, and leaves the
|
|
89
|
+
* label on {@link ACCENT_TEXT_SHADE}. That shade is held to 4.5:1 against
|
|
90
|
+
* the bare page and paper, so one sitting near the bar drops under it the
|
|
91
|
+
* moment the wash lands — the console's light-scheme `primary.dark` goes
|
|
92
|
+
* from 4.54:1 to 4.37:1 on the page. This slot is the same shade walked on
|
|
93
|
+
* until it clears the washed surfaces too, and equals `dark` wherever `dark`
|
|
94
|
+
* already does.
|
|
95
|
+
*/
|
|
96
|
+
export declare const ACCENT_HOVER_TEXT: "hoverText";
|
|
97
|
+
/**
|
|
98
|
+
* The hovered text/outlined label for `color`, resolved like
|
|
99
|
+
* {@link accentTextColor}. Wired into `MuiButton`'s hover in
|
|
100
|
+
* `console.theme.ts`.
|
|
101
|
+
*/
|
|
102
|
+
export declare function accentHoverTextColor(theme: Theme | undefined, color: string | undefined): string | undefined;
|
|
103
|
+
/**
|
|
104
|
+
* `ink` as it actually renders on `fill`. A `contrastText` such as
|
|
105
|
+
* `#000000DE` is translucent, so the color a reader sees is the blend; the
|
|
106
|
+
* contrast of that blend is the honest number.
|
|
107
|
+
*/
|
|
108
|
+
export declare function inkOnFill(ink: string, fill: string): string;
|
|
109
|
+
/** Contrast of `ink` rendered on `fill`, alpha included. */
|
|
110
|
+
export declare function inkContrast(ink: string, fill: string): number;
|
|
111
|
+
/**
|
|
112
|
+
* The hover fill of one palette color: a shade of `main` that visibly
|
|
113
|
+
* differs from it and still carries `contrastText` at `minContrast`.
|
|
114
|
+
*
|
|
115
|
+
* In order:
|
|
116
|
+
* 1. `dark`, when it already does both. That is MUI's own hover, and every
|
|
117
|
+
* palette whose hover was legible keeps it byte-identical.
|
|
118
|
+
* 2. Otherwise `main` stepped by `tonalOffset` AWAY from the ink — darker
|
|
119
|
+
* under a light label, lighter under a dark one — then walked further
|
|
120
|
+
* the same way until the ink clears the bar. Away from the ink is the
|
|
121
|
+
* one direction in which every step raises the ratio.
|
|
122
|
+
* 3. If that step is too small to see — a fill already at the pole the ink
|
|
123
|
+
* is not, like white under black — `main` stepped TOWARD the ink, as long
|
|
124
|
+
* as the ink still clears the bar there.
|
|
125
|
+
*
|
|
126
|
+
* Throws on an unparseable color; the theme pass that calls it leaves such
|
|
127
|
+
* a palette color without the slot.
|
|
128
|
+
*/
|
|
129
|
+
export declare function hoverFillShade(color: Pick<PaletteColor, 'main' | 'contrastText'> & {
|
|
130
|
+
dark?: string;
|
|
131
|
+
}, tonalOffset?: number, minContrast?: number): string;
|
|
61
132
|
/**
|
|
62
133
|
* The accent shade a FILLED surface can paint under the accent's own ink —
|
|
63
134
|
* the counterpart to {@link accentTextColor}, and a different value for a
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
1
2
|
/**
|
|
2
3
|
* @license
|
|
3
4
|
* Copyright 2026 Aglyn LLC
|
|
@@ -13,8 +14,8 @@
|
|
|
13
14
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
15
|
* See the License for the specific language governing permissions and
|
|
15
16
|
* limitations under the License.
|
|
16
|
-
*/ import {
|
|
17
|
-
import { AA_TEXT_CONTRAST, accessibleShade, contrastRatio } from "./accessible-shade.js";
|
|
17
|
+
*/ import { darken, decomposeColor, hslToRgb, lighten, rgbToHex } from "../../vendor/mui.js";
|
|
18
|
+
import { AA_TEXT_CONTRAST, accessibleShade, contrastRatio, relativeLuminance } from "./accessible-shade.js";
|
|
18
19
|
/**
|
|
19
20
|
* The palette slot that carries "this accent, rendered AS TEXT on the
|
|
20
21
|
* scheme's own surfaces" (AGL-1293 / AGL-1297).
|
|
@@ -55,6 +56,15 @@ import { AA_TEXT_CONTRAST, accessibleShade, contrastRatio } from "./accessible-s
|
|
|
55
56
|
* PaletteColor shape (`'inherit'`, `'textPrimary'`, `undefined`) returns
|
|
56
57
|
* `undefined`.
|
|
57
58
|
*/ export function accentTextColor(theme, color) {
|
|
59
|
+
return paletteSlot(theme, color, ACCENT_TEXT_SHADE);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* One slot of one palette color, as a value safe to hand to a
|
|
63
|
+
* `styleOverrides` root: a `var(--mui-palette-…)` reference on a CSS-vars
|
|
64
|
+
* theme, a literal on a single-mode theme. `undefined` for anything without
|
|
65
|
+
* a PaletteColor shape (`'inherit'`, `'textPrimary'`, `undefined`) or a
|
|
66
|
+
* palette that lacks the slot.
|
|
67
|
+
*/ function paletteSlot(theme, color, slot) {
|
|
58
68
|
var _theme_vars;
|
|
59
69
|
var _source_palette;
|
|
60
70
|
if (!theme || !color) return undefined;
|
|
@@ -63,8 +73,115 @@ import { AA_TEXT_CONTRAST, accessibleShade, contrastRatio } from "./accessible-s
|
|
|
63
73
|
const source = (_theme_vars = theme.vars) != null ? _theme_vars : theme;
|
|
64
74
|
const paletteColor = source == null ? void 0 : (_source_palette = source.palette) == null ? void 0 : _source_palette[color];
|
|
65
75
|
if (!paletteColor || typeof paletteColor !== 'object') return undefined;
|
|
66
|
-
const
|
|
67
|
-
return typeof
|
|
76
|
+
const value = paletteColor[slot];
|
|
77
|
+
return typeof value === 'string' ? value : undefined;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* The palette slot that carries "this accent's FILL under the pointer": the
|
|
81
|
+
* background a contained Button or a Fab takes on hover, painted under the
|
|
82
|
+
* accent's own `contrastText` (AGL-3465).
|
|
83
|
+
*
|
|
84
|
+
* MUI paints that hover with `palette[color].dark`, and `dark` here is
|
|
85
|
+
* {@link ACCENT_TEXT_SHADE} — chosen to be READ ON the page, so it is LIGHTER
|
|
86
|
+
* than `main` in a dark scheme. A white label on the console's dark-scheme
|
|
87
|
+
* `primary.dark` measures 1.91:1; on the tenant default's `#5e9fe0`,
|
|
88
|
+
* 2.80:1. The fill and the text shade answer different questions, so they
|
|
89
|
+
* get different slots, and `createResponsiveTheme` derives this one for
|
|
90
|
+
* every palette color with a `contrastText` — see {@link hoverFillShade}.
|
|
91
|
+
*/ export const ACCENT_HOVER_FILL = 'hover';
|
|
92
|
+
/**
|
|
93
|
+
* The hover fill for `color`, as a value safe to hand to a `styleOverrides`
|
|
94
|
+
* root — the counterpart of {@link accentTextColor}, and resolved the same
|
|
95
|
+
* way: a `var()` on a CSS-vars theme so it follows the scheme, a literal on
|
|
96
|
+
* a single-mode theme. Wired into `MuiButton`'s contained hover and
|
|
97
|
+
* `MuiFab`'s hover in `console.theme.ts`.
|
|
98
|
+
*/ export function accentHoverFillColor(theme, color) {
|
|
99
|
+
return paletteSlot(theme, color, ACCENT_HOVER_FILL);
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* The palette slot that carries "this accent as TEXT, on its own hover
|
|
103
|
+
* wash": the label of a hovered text or outlined Button (AGL-3465).
|
|
104
|
+
*
|
|
105
|
+
* MUI hovers those two variants by laying `main` at
|
|
106
|
+
* `palette.action.hoverOpacity` over whatever they sit on, and leaves the
|
|
107
|
+
* label on {@link ACCENT_TEXT_SHADE}. That shade is held to 4.5:1 against
|
|
108
|
+
* the bare page and paper, so one sitting near the bar drops under it the
|
|
109
|
+
* moment the wash lands — the console's light-scheme `primary.dark` goes
|
|
110
|
+
* from 4.54:1 to 4.37:1 on the page. This slot is the same shade walked on
|
|
111
|
+
* until it clears the washed surfaces too, and equals `dark` wherever `dark`
|
|
112
|
+
* already does.
|
|
113
|
+
*/ export const ACCENT_HOVER_TEXT = 'hoverText';
|
|
114
|
+
/**
|
|
115
|
+
* The hovered text/outlined label for `color`, resolved like
|
|
116
|
+
* {@link accentTextColor}. Wired into `MuiButton`'s hover in
|
|
117
|
+
* `console.theme.ts`.
|
|
118
|
+
*/ export function accentHoverTextColor(theme, color) {
|
|
119
|
+
return paletteSlot(theme, color, ACCENT_HOVER_TEXT);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* The smallest contrast ratio between a fill and its hover shade that still
|
|
123
|
+
* reads as a change. Below it the pointer gets no feedback at all — the
|
|
124
|
+
* failure a near-white fill hits when it is lightened.
|
|
125
|
+
*/ const MIN_HOVER_STEP = 1.1;
|
|
126
|
+
/**
|
|
127
|
+
* `ink` as it actually renders on `fill`. A `contrastText` such as
|
|
128
|
+
* `#000000DE` is translucent, so the color a reader sees is the blend; the
|
|
129
|
+
* contrast of that blend is the honest number.
|
|
130
|
+
*/ export function inkOnFill(ink, fill) {
|
|
131
|
+
var _foreground_values_;
|
|
132
|
+
const foreground = rgbChannels(ink);
|
|
133
|
+
const alpha = foreground.type.endsWith('a') ? (_foreground_values_ = foreground.values[3]) != null ? _foreground_values_ : 1 : 1;
|
|
134
|
+
if (alpha >= 1) return ink;
|
|
135
|
+
const background = rgbChannels(fill);
|
|
136
|
+
const channels = [
|
|
137
|
+
0,
|
|
138
|
+
1,
|
|
139
|
+
2
|
|
140
|
+
].map((index)=>Math.round(foreground.values[index] * alpha + background.values[index] * (1 - alpha)));
|
|
141
|
+
return `rgb(${channels.join(', ')})`;
|
|
142
|
+
}
|
|
143
|
+
/** A color decomposed into 0–255 RGB channels, whatever notation it came in. */ function rgbChannels(color) {
|
|
144
|
+
const decomposed = decomposeColor(color);
|
|
145
|
+
return decomposed.type.startsWith('hsl') ? decomposeColor(hslToRgb(color)) : decomposed;
|
|
146
|
+
}
|
|
147
|
+
/** Contrast of `ink` rendered on `fill`, alpha included. */ export function inkContrast(ink, fill) {
|
|
148
|
+
return contrastRatio(inkOnFill(ink, fill), fill);
|
|
149
|
+
}
|
|
150
|
+
/** How far each further step of the hover-fill walk moves the fill. */ const HOVER_WALK_STEP = 0.1;
|
|
151
|
+
/**
|
|
152
|
+
* The hover fill of one palette color: a shade of `main` that visibly
|
|
153
|
+
* differs from it and still carries `contrastText` at `minContrast`.
|
|
154
|
+
*
|
|
155
|
+
* In order:
|
|
156
|
+
* 1. `dark`, when it already does both. That is MUI's own hover, and every
|
|
157
|
+
* palette whose hover was legible keeps it byte-identical.
|
|
158
|
+
* 2. Otherwise `main` stepped by `tonalOffset` AWAY from the ink — darker
|
|
159
|
+
* under a light label, lighter under a dark one — then walked further
|
|
160
|
+
* the same way until the ink clears the bar. Away from the ink is the
|
|
161
|
+
* one direction in which every step raises the ratio.
|
|
162
|
+
* 3. If that step is too small to see — a fill already at the pole the ink
|
|
163
|
+
* is not, like white under black — `main` stepped TOWARD the ink, as long
|
|
164
|
+
* as the ink still clears the bar there.
|
|
165
|
+
*
|
|
166
|
+
* Throws on an unparseable color; the theme pass that calls it leaves such
|
|
167
|
+
* a palette color without the slot.
|
|
168
|
+
*/ export function hoverFillShade(color, tonalOffset = 0.3, minContrast = AA_TEXT_CONTRAST) {
|
|
169
|
+
const { main, dark, contrastText: ink } = color;
|
|
170
|
+
const visible = (fill)=>contrastRatio(main, fill) >= MIN_HOVER_STEP;
|
|
171
|
+
const legible = (fill)=>inkContrast(ink, fill) >= minContrast;
|
|
172
|
+
if (typeof dark === 'string' && visible(dark) && legible(dark)) return dark;
|
|
173
|
+
const away = relativeLuminance(inkOnFill(ink, main)) > relativeLuminance(main) ? 'darken' : 'lighten';
|
|
174
|
+
const shift = (fill, direction, amount)=>rgbToHex(direction === 'darken' ? darken(fill, amount) : lighten(fill, amount));
|
|
175
|
+
let awayFill = shift(main, away, tonalOffset);
|
|
176
|
+
while(!legible(awayFill)){
|
|
177
|
+
const next = shift(awayFill, away, HOVER_WALK_STEP);
|
|
178
|
+
// At the pole: nothing further exists in this direction.
|
|
179
|
+
if (next === awayFill) break;
|
|
180
|
+
awayFill = next;
|
|
181
|
+
}
|
|
182
|
+
if (visible(awayFill)) return awayFill;
|
|
183
|
+
const towardFill = shift(main, away === 'darken' ? 'lighten' : 'darken', tonalOffset);
|
|
184
|
+
return legible(towardFill) ? towardFill : awayFill;
|
|
68
185
|
}
|
|
69
186
|
/**
|
|
70
187
|
* The accent shade a FILLED surface can paint under the accent's own ink —
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../../libs/shared/ui/theme/src/lib/util/accent-text.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Palette, PaletteColor, Theme } from '../../vendor/mui'\nimport {\n AA_TEXT_CONTRAST,\n accessibleShade,\n contrastRatio,\n} from './accessible-shade'\n\n/**\n * The palette slot that carries \"this accent, rendered AS TEXT on the\n * scheme's own surfaces\" (AGL-1293 / AGL-1297).\n *\n * `dark` is deliberately overloaded rather than a new slot being invented:\n * `ensureAccessibleShades` already guarantees the value of this slot clears\n * {@link AA_TEXT_CONTRAST} against `background.default` and\n * `background.paper` in whichever direction the scheme needs (darker in\n * light, LIGHTER in dark), so every tenant palette carries an accessible\n * value here whether or not its author thought about one. A second slot\n * would have to be whitelisted in `host-theme.ts`, authored per host, and\n * kept in sync — three new ways for a palette to be missing it.\n *\n * `console.theme.ts` authors the shade explicitly for both schemes rather\n * than relying on that repair, so the value a link resolves to is readable\n * in the palette instead of recomputed at boot.\n */\nexport const ACCENT_TEXT_SHADE = 'dark' as const\n\n/** WCAG AA contrast bar for non-text UI (borders, icon fills, indicators). */\nexport const AA_NON_TEXT_CONTRAST = 3\n\n/**\n * The accent-as-text color for `color`, as a value safe to hand to a\n * `styleOverrides` root.\n *\n * Wired into `MuiButton`'s `--variant-textColor` / `--variant-outlinedColor`\n * and `MuiLink`'s `color` in `console.theme.ts`. Those three are the places\n * MUI paints an accent at normal text size, where `main` owes 4.5:1 and the\n * brand blue delivers 2.43:1 on white. Everything that paints the accent as\n * a FILL, a BORDER or an INDICATOR — `--variant-containedBg`,\n * `--variant-outlinedBorder`, the Tabs indicator — keeps `main`: those owe\n * 3:1, and the brand color is meant to be seen there.\n *\n * Returns a CSS variable reference (`var(--mui-palette-primary-dark)`) on a\n * CSS-vars theme and a literal on a single-mode theme. That distinction is\n * load-bearing: `components` are evaluated ONCE against the root theme, so\n * baking a light-scheme literal would freeze it into dark mode.\n *\n * @param theme the active MUI theme (CSS-vars or single-mode)\n * @param color a palette key — `'primary'`, `'error'`, … Anything without a\n * PaletteColor shape (`'inherit'`, `'textPrimary'`, `undefined`) returns\n * `undefined`.\n */\nexport function accentTextColor(\n theme: Theme | undefined,\n color: string | undefined,\n): string | undefined {\n if (!theme || !color) return undefined\n // `theme.vars` is the CSS-variable mirror of the palette; prefer it so the\n // emitted value is a `var()` that follows the scheme.\n const source = ((theme as unknown as { vars?: { palette?: unknown } }).vars ??\n theme) as { palette?: Record<string, unknown> }\n const paletteColor = source?.palette?.[color] as\n Record<string, string> | undefined\n if (!paletteColor || typeof paletteColor !== 'object') return undefined\n const accent = paletteColor[ACCENT_TEXT_SHADE]\n return typeof accent === 'string' ? accent : undefined\n}\n\n/**\n * The accent shade a FILLED surface can paint under the accent's own ink —\n * the counterpart to {@link accentTextColor}, and a different value for a\n * different question (AGL-2704).\n *\n * {@link ACCENT_TEXT_SHADE} answers \"this accent, READ ON the page\", so it\n * inverts direction per scheme: darker than `main` in light, LIGHTER in\n * dark. That makes it wrong as a fill in exactly one scheme. The console's\n * `primary.dark` is `#0077ad` in light, where white on it measures 4.95:1,\n * and `#4dc8ff` in dark, where the same white measures 1.91:1 — below the\n * 2.43:1 the brand fill it replaced already scored.\n *\n * This shade answers \"this accent, PAINTED UNDER its own `contrastText`\"\n * instead. The constraint is the ink, not the page, so the walk starts at\n * `main` and darkens until the ink clears the bar — and the answer is the\n * SAME in both schemes, which is the property a token reference needs. An\n * `sx` value resolves against whichever scheme is active, so a fill token\n * that only holds in one of them cannot be authored safely.\n *\n * Takes a resolved `Palette`, never `theme.vars`: the walk decomposes real\n * colors, and a CSS-variable mirror hands it `var(--mui-palette-…)`.\n *\n * @param palette a resolved (non-`vars`) palette\n * @param color a palette key — `'primary'`, `'error'`, …\n * @param minContrast the bar the ink must clear. Default\n * {@link AA_TEXT_CONTRAST}.\n */\nexport function accentFillColor(\n palette: Palette | undefined,\n color: string | undefined,\n minContrast: number = AA_TEXT_CONTRAST,\n): string | undefined {\n if (!palette || !color) return undefined\n const paletteColor = (palette as unknown as Record<string, unknown>)[\n color\n ] as Record<string, string> | undefined\n if (!paletteColor || typeof paletteColor !== 'object') return undefined\n const { main, contrastText } = paletteColor\n if (typeof main !== 'string' || typeof contrastText !== 'string') {\n return undefined\n }\n try {\n return accessibleShade(main, [contrastText], 'darken', { minContrast })\n } catch {\n // Unparseable color (a `color()` literal, an unresolved variable). A\n // caller gets nothing rather than a guess, the same as `accentTextColor`.\n return undefined\n }\n}\n\n/** One measured way a palette fails its accessibility contract. */\nexport type PaletteContrastViolation = {\n /** Palette key — `'primary'`, `'error'`, … */\n color: string\n /**\n * `accentText` — the accent painted as text on the scheme's surfaces.\n * `contrastText` — the foreground painted ON that accent.\n * `accentFill` — that same foreground painted on the accent's TEXT shade,\n * i.e. a surface filled with {@link ACCENT_TEXT_SHADE}. Off by default;\n * see {@link AuditPaletteContrastOptions.roles}.\n */\n role: 'accentText' | 'contrastText' | 'accentFill'\n /** The foreground colour that failed. */\n value: string\n /** The background it failed against. */\n against: string\n /** Measured WCAG ratio, 1–21. */\n ratio: number\n /** The bar it had to clear. */\n required: number\n /**\n * Set only when this exact pairing matches a\n * {@link DOCUMENTED_CONTRAST_EXCEPTIONS} entry: the human decision that\n * knowingly accepts the measured ratio. Excluded from the default result;\n * surfaced by `includeExempt`.\n */\n exemption?: string\n}\n\n/**\n * Pairings a human has knowingly SIGNED OFF below the bar — decided, not\n * outstanding.\n *\n * The rest of what {@link auditPaletteContrast} reports is a FINDING: a\n * measurement offered for a decision the account owner owns, not a defect queued for\n * repair. Nothing in this module changes a rendered colour.\n *\n * This is not a suppression list and it must not become one. Each entry pins\n * all four coordinates of one pairing — palette key, role, the exact\n * foreground and the exact background — so it waives a decision, not a slot.\n * Change the brand blue, change the white, or move the same white onto\n * `secondary`, and none of them match: the audit reports it again, which is\n * the point. A new entry needs a named person, a date, their words, and the\n * measured ratio, the same as this one.\n */\nexport const DOCUMENTED_CONTRAST_EXCEPTIONS: ReadonlyArray<{\n color: string\n role: PaletteContrastViolation['role']\n value: string\n against: string\n reason: string\n}> = [\n {\n // AGL-1293. Computing this slot for contrast resolves it to dark ink\n // (8.65:1), which turns every filled primary button dark-on-blue. The\n // tradeoff is to darken the brand or to keep it and accept sub-AA white,\n // and the brand blue is fixed: white on `#00b0ff` is 2.43:1, below the\n // 4.5:1 AA text bar and below the 3:1 non-text bar. Accepted knowingly.\n //\n // This is the ONE decided pairing. Everything else the audit reports —\n // the five other authored sub-AA `contrastText` literals, and `#00b0ff`\n // as text — is a finding, not a waiver, and stays undecided here.\n color: 'primary',\n role: 'contrastText',\n value: '#FFFFFF',\n against: '#00b0ff',\n reason:\n 'AGL-1293 — the brand blue stays as authored, with white text (white on #00b0ff = 2.43:1, knowingly below AA)',\n },\n]\n\n/** Case-insensitive exact colour match; nothing fuzzy, nothing normalised away. */\nfunction sameColor(a: string, b: string) {\n return a.trim().toLowerCase() === b.trim().toLowerCase()\n}\n\n/**\n * The signed-off reason for this exact pairing, or `undefined`. Exact on all\n * four coordinates — a near miss is not a match.\n */\nfunction documentedExemption(\n color: string,\n role: PaletteContrastViolation['role'],\n value: string,\n against: string,\n): string | undefined {\n return DOCUMENTED_CONTRAST_EXCEPTIONS.find(\n (exception) =>\n exception.color === color &&\n exception.role === role &&\n sameColor(exception.value, value) &&\n sameColor(exception.against, against),\n )?.reason\n}\n\nconst AUDITED_COLOR_KEYS = [\n 'primary',\n 'secondary',\n 'tertiary',\n 'error',\n 'warning',\n 'info',\n 'success',\n] as const\n\nexport type AuditPaletteContrastOptions = {\n /** Bar for foreground text. Default {@link AA_TEXT_CONTRAST}. */\n minContrast?: number\n /** Restrict the audit to these palette keys. Default: all accents. */\n colors?: ReadonlyArray<string>\n /**\n * Include pairings matched by {@link DOCUMENTED_CONTRAST_EXCEPTIONS},\n * carrying their `exemption`. Default `false`, so a signed-off decision does\n * not read as an open defect. Pass `true` to see everything measured — the\n * spec that proves the exception is still exactly 2.43:1 uses this, so the\n * waiver documents a number rather than hiding one.\n */\n includeExempt?: boolean\n /**\n * Which roles to measure. Default {@link DEFAULT_AUDITED_ROLES} — the two\n * pairings every palette owes unconditionally.\n *\n * `accentFill` is opt-in because it is a question about a SURFACE, not\n * about the palette: it asks what a fill painted with\n * {@link ACCENT_TEXT_SHADE} does to the accent's own ink. In a dark scheme\n * that shade is lighter than `main` by design, so every accent fails it —\n * correctly, and uselessly for a palette that fills with nothing. Pass it\n * where something actually does (AGL-2704: the marketing pricing page\n * filled a nav CTA and a badge with `primary.dark`, which held in light at\n * 4.95:1 and collapsed to 1.91:1 in dark).\n */\n roles?: ReadonlyArray<PaletteContrastViolation['role']>\n}\n\n/** The roles {@link auditPaletteContrast} measures unless told otherwise. */\nexport const DEFAULT_AUDITED_ROLES: ReadonlyArray<\n PaletteContrastViolation['role']\n> = ['accentText', 'contrastText']\n\n/**\n * Measures whether a palette actually keeps the AGL-1293 promise, rather\n * than trusting that the derivation ran.\n *\n * This is the part that can go RED. `ensureAccessibleShades` only repairs\n * shades it DERIVED — an explicitly authored `primary.dark`, or an accent\n * whose AA bar is simply unreachable in the scheme's foreground direction\n * (walking toward white on a mid-grey page tops out at 3.95:1), passes\n * straight through. Those palettes are exactly the ones a customer can build\n * in the theme editor, so the contract has to be checked, not assumed.\n *\n * Returns every violation with its measured ratio; an empty array means the\n * palette is AA-clean for text.\n */\nexport function auditPaletteContrast(\n palette: Palette | undefined,\n options: AuditPaletteContrastOptions = {},\n): PaletteContrastViolation[] {\n const {\n minContrast = AA_TEXT_CONTRAST,\n colors = AUDITED_COLOR_KEYS,\n includeExempt = false,\n roles = DEFAULT_AUDITED_ROLES,\n } = options\n const measures = (role: PaletteContrastViolation['role']) =>\n roles.includes(role)\n const violations: PaletteContrastViolation[] = []\n /** Records a measured failure unless a documented decision waives it. */\n const record = (violation: PaletteContrastViolation) => {\n const exemption = documentedExemption(\n violation.color,\n violation.role,\n violation.value,\n violation.against,\n )\n if (exemption && !includeExempt) return\n violations.push(exemption ? { ...violation, exemption } : violation)\n }\n if (!palette) return violations\n const indexed = palette as unknown as Record<string, PaletteColor | undefined>\n const backgrounds = [\n palette.background?.default,\n palette.background?.paper,\n ].filter((background): background is string => typeof background === 'string')\n\n for (const key of colors) {\n const color = indexed[key]\n if (!color || typeof color.main !== 'string') continue\n const accent = (color as unknown as Record<string, string>)[\n ACCENT_TEXT_SHADE\n ]\n for (const background of backgrounds) {\n if (!measures('accentText') || typeof accent !== 'string') continue\n try {\n const ratio = contrastRatio(accent, background)\n if (ratio < minContrast) {\n record({\n color: key,\n role: 'accentText',\n value: accent,\n against: background,\n ratio,\n required: minContrast,\n })\n }\n } catch {\n // Unparseable colour (CSS variable, color-mix()): not measurable\n // here. Silence rather than a false violation — the caller audits a\n // resolved palette, not a `vars` mirror.\n }\n }\n if (typeof color.contrastText !== 'string') continue\n if (measures('contrastText')) {\n try {\n const ratio = contrastRatio(color.contrastText, color.main)\n if (ratio < minContrast) {\n record({\n color: key,\n role: 'contrastText',\n value: color.contrastText,\n against: color.main,\n ratio,\n required: minContrast,\n })\n }\n } catch {\n // As above.\n }\n }\n // The same ink, on a surface filled with the accent's TEXT shade. That\n // shade is chosen to be READ ON the page, so in a dark scheme it sits\n // lighter than `main` and cannot carry a light ink — which is invisible\n // to the `contrastText` measure above, because that one only ever looks\n // at `main`.\n if (measures('accentFill') && typeof accent === 'string') {\n try {\n const ratio = contrastRatio(color.contrastText, accent)\n if (ratio < minContrast) {\n record({\n color: key,\n role: 'accentFill',\n value: color.contrastText,\n against: accent,\n ratio,\n required: minContrast,\n })\n }\n } catch {\n // As above.\n }\n }\n }\n return violations\n}\n\n/** Human-readable one-liner per violation, for test output and dev warnings. */\nexport function formatPaletteContrastViolation(\n violation: PaletteContrastViolation,\n): string {\n const measured = `${violation.color}.${violation.role} ${violation.value} on ${\n violation.against\n } is ${violation.ratio.toFixed(2)}:1, below ${violation.required}:1`\n // The waived line still carries its number, so a reader sees what was\n // accepted rather than a bare \"exempt\".\n return violation.exemption\n ? `${measured} — KNOWN EXCEPTION: ${violation.exemption}`\n : measured\n}\n\nexport default accentTextColor\n"],"names":["AA_TEXT_CONTRAST","accessibleShade","contrastRatio","ACCENT_TEXT_SHADE","AA_NON_TEXT_CONTRAST","accentTextColor","theme","color","source","undefined","vars","paletteColor","palette","accent","accentFillColor","minContrast","main","contrastText","DOCUMENTED_CONTRAST_EXCEPTIONS","role","value","against","reason","sameColor","a","b","trim","toLowerCase","documentedExemption","find","exception","AUDITED_COLOR_KEYS","DEFAULT_AUDITED_ROLES","auditPaletteContrast","options","colors","includeExempt","roles","measures","includes","violations","record","violation","exemption","push","indexed","backgrounds","background","default","paper","filter","key","ratio","required","formatPaletteContrastViolation","measured","toFixed"],"mapp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uEAAuE;QACvE,sEAAsE;QACtE,wEAAwE;QACxE,wEAAwE;QACxE,aAAa;QACb,IAAIuB,SAAS,iBAAiB,OAAOzB,WAAW,UAAU;YACxD,IAAI;gBACF,MAAMuC,QAAQlD,cAAcK,MAAMU,YAAY,EAAEJ;gBAChD,IAAIuC,QAAQrC,aAAa;oBACvB0B,OAAO;wBACLlC,OAAO4C;wBACPhC,MAAM;wBACNC,OAAOb,MAAMU,YAAY;wBACzBI,SAASR;wBACTuC;wBACAC,UAAUtC;oBACZ;gBACF;YACF,EAAE,eAAM;YACN,YAAY;YACd;QACF;IACF;IACA,OAAOyB;AACT;AAEA,8EAA8E,GAC9E,OAAO,SAASc,+BACdZ,SAAmC;IAEnC,MAAMa,WAAW,GAAGb,UAAUnC,KAAK,CAAC,CAAC,EAAEmC,UAAUvB,IAAI,CAAC,CAAC,EAAEuB,UAAUtB,KAAK,CAAC,IAAI,EAC3EsB,UAAUrB,OAAO,CAClB,IAAI,EAAEqB,UAAUU,KAAK,CAACI,OAAO,CAAC,GAAG,UAAU,EAAEd,UAAUW,QAAQ,CAAC,EAAE,CAAC;IACpE,sEAAsE;IACtE,wCAAwC;IACxC,OAAOX,UAAUC,SAAS,GACtB,GAAGY,SAAS,oBAAoB,EAAEb,UAAUC,SAAS,EAAE,GACvDY;AACN;AAEA,eAAelD,gBAAe"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../libs/shared/ui/theme/src/lib/util/accent-text.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n darken,\n decomposeColor,\n hslToRgb,\n lighten,\n rgbToHex,\n type Palette,\n type PaletteColor,\n type Theme,\n} from '../../vendor/mui'\nimport {\n AA_TEXT_CONTRAST,\n accessibleShade,\n contrastRatio,\n relativeLuminance,\n type ShadeDirection,\n} from './accessible-shade'\n\n/**\n * The palette slot that carries \"this accent, rendered AS TEXT on the\n * scheme's own surfaces\" (AGL-1293 / AGL-1297).\n *\n * `dark` is deliberately overloaded rather than a new slot being invented:\n * `ensureAccessibleShades` already guarantees the value of this slot clears\n * {@link AA_TEXT_CONTRAST} against `background.default` and\n * `background.paper` in whichever direction the scheme needs (darker in\n * light, LIGHTER in dark), so every tenant palette carries an accessible\n * value here whether or not its author thought about one. A second slot\n * would have to be whitelisted in `host-theme.ts`, authored per host, and\n * kept in sync — three new ways for a palette to be missing it.\n *\n * `console.theme.ts` authors the shade explicitly for both schemes rather\n * than relying on that repair, so the value a link resolves to is readable\n * in the palette instead of recomputed at boot.\n */\nexport const ACCENT_TEXT_SHADE = 'dark' as const\n\n/** WCAG AA contrast bar for non-text UI (borders, icon fills, indicators). */\nexport const AA_NON_TEXT_CONTRAST = 3\n\n/**\n * The accent-as-text color for `color`, as a value safe to hand to a\n * `styleOverrides` root.\n *\n * Wired into `MuiButton`'s `--variant-textColor` / `--variant-outlinedColor`\n * and `MuiLink`'s `color` in `console.theme.ts`. Those three are the places\n * MUI paints an accent at normal text size, where `main` owes 4.5:1 and the\n * brand blue delivers 2.43:1 on white. Everything that paints the accent as\n * a FILL, a BORDER or an INDICATOR — `--variant-containedBg`,\n * `--variant-outlinedBorder`, the Tabs indicator — keeps `main`: those owe\n * 3:1, and the brand color is meant to be seen there.\n *\n * Returns a CSS variable reference (`var(--mui-palette-primary-dark)`) on a\n * CSS-vars theme and a literal on a single-mode theme. That distinction is\n * load-bearing: `components` are evaluated ONCE against the root theme, so\n * baking a light-scheme literal would freeze it into dark mode.\n *\n * @param theme the active MUI theme (CSS-vars or single-mode)\n * @param color a palette key — `'primary'`, `'error'`, … Anything without a\n * PaletteColor shape (`'inherit'`, `'textPrimary'`, `undefined`) returns\n * `undefined`.\n */\nexport function accentTextColor(\n theme: Theme | undefined,\n color: string | undefined,\n): string | undefined {\n return paletteSlot(theme, color, ACCENT_TEXT_SHADE)\n}\n\n/**\n * One slot of one palette color, as a value safe to hand to a\n * `styleOverrides` root: a `var(--mui-palette-…)` reference on a CSS-vars\n * theme, a literal on a single-mode theme. `undefined` for anything without\n * a PaletteColor shape (`'inherit'`, `'textPrimary'`, `undefined`) or a\n * palette that lacks the slot.\n */\nfunction paletteSlot(\n theme: Theme | undefined,\n color: string | undefined,\n slot: string,\n): string | undefined {\n if (!theme || !color) return undefined\n // `theme.vars` is the CSS-variable mirror of the palette; prefer it so the\n // emitted value is a `var()` that follows the scheme.\n const source = ((theme as unknown as { vars?: { palette?: unknown } }).vars ??\n theme) as { palette?: Record<string, unknown> }\n const paletteColor = source?.palette?.[color] as\n Record<string, string> | undefined\n if (!paletteColor || typeof paletteColor !== 'object') return undefined\n const value = paletteColor[slot]\n return typeof value === 'string' ? value : undefined\n}\n\n/**\n * The palette slot that carries \"this accent's FILL under the pointer\": the\n * background a contained Button or a Fab takes on hover, painted under the\n * accent's own `contrastText` (AGL-3465).\n *\n * MUI paints that hover with `palette[color].dark`, and `dark` here is\n * {@link ACCENT_TEXT_SHADE} — chosen to be READ ON the page, so it is LIGHTER\n * than `main` in a dark scheme. A white label on the console's dark-scheme\n * `primary.dark` measures 1.91:1; on the tenant default's `#5e9fe0`,\n * 2.80:1. The fill and the text shade answer different questions, so they\n * get different slots, and `createResponsiveTheme` derives this one for\n * every palette color with a `contrastText` — see {@link hoverFillShade}.\n */\nexport const ACCENT_HOVER_FILL = 'hover' as const\n\n/**\n * The hover fill for `color`, as a value safe to hand to a `styleOverrides`\n * root — the counterpart of {@link accentTextColor}, and resolved the same\n * way: a `var()` on a CSS-vars theme so it follows the scheme, a literal on\n * a single-mode theme. Wired into `MuiButton`'s contained hover and\n * `MuiFab`'s hover in `console.theme.ts`.\n */\nexport function accentHoverFillColor(\n theme: Theme | undefined,\n color: string | undefined,\n): string | undefined {\n return paletteSlot(theme, color, ACCENT_HOVER_FILL)\n}\n\n/**\n * The palette slot that carries \"this accent as TEXT, on its own hover\n * wash\": the label of a hovered text or outlined Button (AGL-3465).\n *\n * MUI hovers those two variants by laying `main` at\n * `palette.action.hoverOpacity` over whatever they sit on, and leaves the\n * label on {@link ACCENT_TEXT_SHADE}. That shade is held to 4.5:1 against\n * the bare page and paper, so one sitting near the bar drops under it the\n * moment the wash lands — the console's light-scheme `primary.dark` goes\n * from 4.54:1 to 4.37:1 on the page. This slot is the same shade walked on\n * until it clears the washed surfaces too, and equals `dark` wherever `dark`\n * already does.\n */\nexport const ACCENT_HOVER_TEXT = 'hoverText' as const\n\n/**\n * The hovered text/outlined label for `color`, resolved like\n * {@link accentTextColor}. Wired into `MuiButton`'s hover in\n * `console.theme.ts`.\n */\nexport function accentHoverTextColor(\n theme: Theme | undefined,\n color: string | undefined,\n): string | undefined {\n return paletteSlot(theme, color, ACCENT_HOVER_TEXT)\n}\n\n/**\n * The smallest contrast ratio between a fill and its hover shade that still\n * reads as a change. Below it the pointer gets no feedback at all — the\n * failure a near-white fill hits when it is lightened.\n */\nconst MIN_HOVER_STEP = 1.1\n\n/**\n * `ink` as it actually renders on `fill`. A `contrastText` such as\n * `#000000DE` is translucent, so the color a reader sees is the blend; the\n * contrast of that blend is the honest number.\n */\nexport function inkOnFill(ink: string, fill: string): string {\n const foreground = rgbChannels(ink)\n const alpha = foreground.type.endsWith('a') ? (foreground.values[3] ?? 1) : 1\n if (alpha >= 1) return ink\n const background = rgbChannels(fill)\n const channels = [0, 1, 2].map((index) =>\n Math.round(\n foreground.values[index] * alpha + background.values[index] * (1 - alpha),\n ),\n )\n return `rgb(${channels.join(', ')})`\n}\n\n/** A color decomposed into 0–255 RGB channels, whatever notation it came in. */\nfunction rgbChannels(color: string) {\n const decomposed = decomposeColor(color)\n return decomposed.type.startsWith('hsl')\n ? decomposeColor(hslToRgb(color))\n : decomposed\n}\n\n/** Contrast of `ink` rendered on `fill`, alpha included. */\nexport function inkContrast(ink: string, fill: string): number {\n return contrastRatio(inkOnFill(ink, fill), fill)\n}\n\n/** How far each further step of the hover-fill walk moves the fill. */\nconst HOVER_WALK_STEP = 0.1\n\n/**\n * The hover fill of one palette color: a shade of `main` that visibly\n * differs from it and still carries `contrastText` at `minContrast`.\n *\n * In order:\n * 1. `dark`, when it already does both. That is MUI's own hover, and every\n * palette whose hover was legible keeps it byte-identical.\n * 2. Otherwise `main` stepped by `tonalOffset` AWAY from the ink — darker\n * under a light label, lighter under a dark one — then walked further\n * the same way until the ink clears the bar. Away from the ink is the\n * one direction in which every step raises the ratio.\n * 3. If that step is too small to see — a fill already at the pole the ink\n * is not, like white under black — `main` stepped TOWARD the ink, as long\n * as the ink still clears the bar there.\n *\n * Throws on an unparseable color; the theme pass that calls it leaves such\n * a palette color without the slot.\n */\nexport function hoverFillShade(\n color: Pick<PaletteColor, 'main' | 'contrastText'> & { dark?: string },\n tonalOffset = 0.3,\n minContrast: number = AA_TEXT_CONTRAST,\n): string {\n const { main, dark, contrastText: ink } = color\n const visible = (fill: string) => contrastRatio(main, fill) >= MIN_HOVER_STEP\n const legible = (fill: string) => inkContrast(ink, fill) >= minContrast\n if (typeof dark === 'string' && visible(dark) && legible(dark)) return dark\n\n const away: ShadeDirection =\n relativeLuminance(inkOnFill(ink, main)) > relativeLuminance(main)\n ? 'darken'\n : 'lighten'\n const shift = (fill: string, direction: ShadeDirection, amount: number) =>\n rgbToHex(\n direction === 'darken' ? darken(fill, amount) : lighten(fill, amount),\n )\n\n let awayFill = shift(main, away, tonalOffset)\n while (!legible(awayFill)) {\n const next = shift(awayFill, away, HOVER_WALK_STEP)\n // At the pole: nothing further exists in this direction.\n if (next === awayFill) break\n awayFill = next\n }\n if (visible(awayFill)) return awayFill\n const towardFill = shift(\n main,\n away === 'darken' ? 'lighten' : 'darken',\n tonalOffset,\n )\n return legible(towardFill) ? towardFill : awayFill\n}\n\n/**\n * The accent shade a FILLED surface can paint under the accent's own ink —\n * the counterpart to {@link accentTextColor}, and a different value for a\n * different question (AGL-2704).\n *\n * {@link ACCENT_TEXT_SHADE} answers \"this accent, READ ON the page\", so it\n * inverts direction per scheme: darker than `main` in light, LIGHTER in\n * dark. That makes it wrong as a fill in exactly one scheme. The console's\n * `primary.dark` is `#0077ad` in light, where white on it measures 4.95:1,\n * and `#4dc8ff` in dark, where the same white measures 1.91:1 — below the\n * 2.43:1 the brand fill it replaced already scored.\n *\n * This shade answers \"this accent, PAINTED UNDER its own `contrastText`\"\n * instead. The constraint is the ink, not the page, so the walk starts at\n * `main` and darkens until the ink clears the bar — and the answer is the\n * SAME in both schemes, which is the property a token reference needs. An\n * `sx` value resolves against whichever scheme is active, so a fill token\n * that only holds in one of them cannot be authored safely.\n *\n * Takes a resolved `Palette`, never `theme.vars`: the walk decomposes real\n * colors, and a CSS-variable mirror hands it `var(--mui-palette-…)`.\n *\n * @param palette a resolved (non-`vars`) palette\n * @param color a palette key — `'primary'`, `'error'`, …\n * @param minContrast the bar the ink must clear. Default\n * {@link AA_TEXT_CONTRAST}.\n */\nexport function accentFillColor(\n palette: Palette | undefined,\n color: string | undefined,\n minContrast: number = AA_TEXT_CONTRAST,\n): string | undefined {\n if (!palette || !color) return undefined\n const paletteColor = (palette as unknown as Record<string, unknown>)[\n color\n ] as Record<string, string> | undefined\n if (!paletteColor || typeof paletteColor !== 'object') return undefined\n const { main, contrastText } = paletteColor\n if (typeof main !== 'string' || typeof contrastText !== 'string') {\n return undefined\n }\n try {\n return accessibleShade(main, [contrastText], 'darken', { minContrast })\n } catch {\n // Unparseable color (a `color()` literal, an unresolved variable). A\n // caller gets nothing rather than a guess, the same as `accentTextColor`.\n return undefined\n }\n}\n\n/** One measured way a palette fails its accessibility contract. */\nexport type PaletteContrastViolation = {\n /** Palette key — `'primary'`, `'error'`, … */\n color: string\n /**\n * `accentText` — the accent painted as text on the scheme's surfaces.\n * `contrastText` — the foreground painted ON that accent.\n * `accentFill` — that same foreground painted on the accent's TEXT shade,\n * i.e. a surface filled with {@link ACCENT_TEXT_SHADE}. Off by default;\n * see {@link AuditPaletteContrastOptions.roles}.\n */\n role: 'accentText' | 'contrastText' | 'accentFill'\n /** The foreground colour that failed. */\n value: string\n /** The background it failed against. */\n against: string\n /** Measured WCAG ratio, 1–21. */\n ratio: number\n /** The bar it had to clear. */\n required: number\n /**\n * Set only when this exact pairing matches a\n * {@link DOCUMENTED_CONTRAST_EXCEPTIONS} entry: the human decision that\n * knowingly accepts the measured ratio. Excluded from the default result;\n * surfaced by `includeExempt`.\n */\n exemption?: string\n}\n\n/**\n * Pairings a human has knowingly SIGNED OFF below the bar — decided, not\n * outstanding.\n *\n * The rest of what {@link auditPaletteContrast} reports is a FINDING: a\n * measurement offered for a decision the account owner owns, not a defect queued for\n * repair. Nothing in this module changes a rendered colour.\n *\n * This is not a suppression list and it must not become one. Each entry pins\n * all four coordinates of one pairing — palette key, role, the exact\n * foreground and the exact background — so it waives a decision, not a slot.\n * Change the brand blue, change the white, or move the same white onto\n * `secondary`, and none of them match: the audit reports it again, which is\n * the point. A new entry needs a named person, a date, their words, and the\n * measured ratio, the same as this one.\n */\nexport const DOCUMENTED_CONTRAST_EXCEPTIONS: ReadonlyArray<{\n color: string\n role: PaletteContrastViolation['role']\n value: string\n against: string\n reason: string\n}> = [\n {\n // AGL-1293. Computing this slot for contrast resolves it to dark ink\n // (8.65:1), which turns every filled primary button dark-on-blue. The\n // tradeoff is to darken the brand or to keep it and accept sub-AA white,\n // and the brand blue is fixed: white on `#00b0ff` is 2.43:1, below the\n // 4.5:1 AA text bar and below the 3:1 non-text bar. Accepted knowingly.\n //\n // This is the ONE decided pairing. Everything else the audit reports —\n // the five other authored sub-AA `contrastText` literals, and `#00b0ff`\n // as text — is a finding, not a waiver, and stays undecided here.\n color: 'primary',\n role: 'contrastText',\n value: '#FFFFFF',\n against: '#00b0ff',\n reason:\n 'AGL-1293 — the brand blue stays as authored, with white text (white on #00b0ff = 2.43:1, knowingly below AA)',\n },\n]\n\n/** Case-insensitive exact colour match; nothing fuzzy, nothing normalised away. */\nfunction sameColor(a: string, b: string) {\n return a.trim().toLowerCase() === b.trim().toLowerCase()\n}\n\n/**\n * The signed-off reason for this exact pairing, or `undefined`. Exact on all\n * four coordinates — a near miss is not a match.\n */\nfunction documentedExemption(\n color: string,\n role: PaletteContrastViolation['role'],\n value: string,\n against: string,\n): string | undefined {\n return DOCUMENTED_CONTRAST_EXCEPTIONS.find(\n (exception) =>\n exception.color === color &&\n exception.role === role &&\n sameColor(exception.value, value) &&\n sameColor(exception.against, against),\n )?.reason\n}\n\nconst AUDITED_COLOR_KEYS = [\n 'primary',\n 'secondary',\n 'tertiary',\n 'error',\n 'warning',\n 'info',\n 'success',\n] as const\n\nexport type AuditPaletteContrastOptions = {\n /** Bar for foreground text. Default {@link AA_TEXT_CONTRAST}. */\n minContrast?: number\n /** Restrict the audit to these palette keys. Default: all accents. */\n colors?: ReadonlyArray<string>\n /**\n * Include pairings matched by {@link DOCUMENTED_CONTRAST_EXCEPTIONS},\n * carrying their `exemption`. Default `false`, so a signed-off decision does\n * not read as an open defect. Pass `true` to see everything measured — the\n * spec that proves the exception is still exactly 2.43:1 uses this, so the\n * waiver documents a number rather than hiding one.\n */\n includeExempt?: boolean\n /**\n * Which roles to measure. Default {@link DEFAULT_AUDITED_ROLES} — the two\n * pairings every palette owes unconditionally.\n *\n * `accentFill` is opt-in because it is a question about a SURFACE, not\n * about the palette: it asks what a fill painted with\n * {@link ACCENT_TEXT_SHADE} does to the accent's own ink. In a dark scheme\n * that shade is lighter than `main` by design, so every accent fails it —\n * correctly, and uselessly for a palette that fills with nothing. Pass it\n * where something actually does (AGL-2704: the marketing pricing page\n * filled a nav CTA and a badge with `primary.dark`, which held in light at\n * 4.95:1 and collapsed to 1.91:1 in dark).\n */\n roles?: ReadonlyArray<PaletteContrastViolation['role']>\n}\n\n/** The roles {@link auditPaletteContrast} measures unless told otherwise. */\nexport const DEFAULT_AUDITED_ROLES: ReadonlyArray<\n PaletteContrastViolation['role']\n> = ['accentText', 'contrastText']\n\n/**\n * Measures whether a palette actually keeps the AGL-1293 promise, rather\n * than trusting that the derivation ran.\n *\n * This is the part that can go RED. `ensureAccessibleShades` only repairs\n * shades it DERIVED — an explicitly authored `primary.dark`, or an accent\n * whose AA bar is simply unreachable in the scheme's foreground direction\n * (walking toward white on a mid-grey page tops out at 3.95:1), passes\n * straight through. Those palettes are exactly the ones a customer can build\n * in the theme editor, so the contract has to be checked, not assumed.\n *\n * Returns every violation with its measured ratio; an empty array means the\n * palette is AA-clean for text.\n */\nexport function auditPaletteContrast(\n palette: Palette | undefined,\n options: AuditPaletteContrastOptions = {},\n): PaletteContrastViolation[] {\n const {\n minContrast = AA_TEXT_CONTRAST,\n colors = AUDITED_COLOR_KEYS,\n includeExempt = false,\n roles = DEFAULT_AUDITED_ROLES,\n } = options\n const measures = (role: PaletteContrastViolation['role']) =>\n roles.includes(role)\n const violations: PaletteContrastViolation[] = []\n /** Records a measured failure unless a documented decision waives it. */\n const record = (violation: PaletteContrastViolation) => {\n const exemption = documentedExemption(\n violation.color,\n violation.role,\n violation.value,\n violation.against,\n )\n if (exemption && !includeExempt) return\n violations.push(exemption ? { ...violation, exemption } : violation)\n }\n if (!palette) return violations\n const indexed = palette as unknown as Record<string, PaletteColor | undefined>\n const backgrounds = [\n palette.background?.default,\n palette.background?.paper,\n ].filter((background): background is string => typeof background === 'string')\n\n for (const key of colors) {\n const color = indexed[key]\n if (!color || typeof color.main !== 'string') continue\n const accent = (color as unknown as Record<string, string>)[\n ACCENT_TEXT_SHADE\n ]\n for (const background of backgrounds) {\n if (!measures('accentText') || typeof accent !== 'string') continue\n try {\n const ratio = contrastRatio(accent, background)\n if (ratio < minContrast) {\n record({\n color: key,\n role: 'accentText',\n value: accent,\n against: background,\n ratio,\n required: minContrast,\n })\n }\n } catch {\n // Unparseable colour (CSS variable, color-mix()): not measurable\n // here. Silence rather than a false violation — the caller audits a\n // resolved palette, not a `vars` mirror.\n }\n }\n if (typeof color.contrastText !== 'string') continue\n if (measures('contrastText')) {\n try {\n const ratio = contrastRatio(color.contrastText, color.main)\n if (ratio < minContrast) {\n record({\n color: key,\n role: 'contrastText',\n value: color.contrastText,\n against: color.main,\n ratio,\n required: minContrast,\n })\n }\n } catch {\n // As above.\n }\n }\n // The same ink, on a surface filled with the accent's TEXT shade. That\n // shade is chosen to be READ ON the page, so in a dark scheme it sits\n // lighter than `main` and cannot carry a light ink — which is invisible\n // to the `contrastText` measure above, because that one only ever looks\n // at `main`.\n if (measures('accentFill') && typeof accent === 'string') {\n try {\n const ratio = contrastRatio(color.contrastText, accent)\n if (ratio < minContrast) {\n record({\n color: key,\n role: 'accentFill',\n value: color.contrastText,\n against: accent,\n ratio,\n required: minContrast,\n })\n }\n } catch {\n // As above.\n }\n }\n }\n return violations\n}\n\n/** Human-readable one-liner per violation, for test output and dev warnings. */\nexport function formatPaletteContrastViolation(\n violation: PaletteContrastViolation,\n): string {\n const measured = `${violation.color}.${violation.role} ${violation.value} on ${\n violation.against\n } is ${violation.ratio.toFixed(2)}:1, below ${violation.required}:1`\n // The waived line still carries its number, so a reader sees what was\n // accepted rather than a bare \"exempt\".\n return violation.exemption\n ? `${measured} — KNOWN EXCEPTION: ${violation.exemption}`\n : measured\n}\n\nexport default accentTextColor\n"],"names":["darken","decomposeColor","hslToRgb","lighten","rgbToHex","AA_TEXT_CONTRAST","accessibleShade","contrastRatio","relativeLuminance","ACCENT_TEXT_SHADE","AA_NON_TEXT_CONTRAST","accentTextColor","theme","color","paletteSlot","slot","source","undefined","vars","paletteColor","palette","value","ACCENT_HOVER_FILL","accentHoverFillColor","ACCENT_HOVER_TEXT","accentHoverTextColor","MIN_HOVER_STEP","inkOnFill","ink","fill","foreground","rgbChannels","alpha","type","endsWith","values","background","channels","map","index","Math","round","join","decomposed","startsWith","inkContrast","HOVER_WALK_STEP","hoverFillShade","tonalOffset","minContrast","main","dark","contrastText","visible","legible","away","shift","direction","amount","awayFill","next","towardFill","accentFillColor","DOCUMENTED_CONTRAST_EXCEPTIONS","role","against","reason","sameColor","a","b","trim","toLowerCase","documentedExemption","find","exception","AUDITED_COLOR_KEYS","DEFAULT_AUDITED_ROLES","auditPaletteContrast","options","colors","includeExempt","roles","measures","includes","violations","record","violation","exemption","push","indexed","backgrounds","default","paper","filter","key","accent","ratio","required","formatPaletteContrastViolation","measured","toFixed"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED,SACEA,MAAM,EACNC,cAAc,EACdC,QAAQ,EACRC,OAAO,EACPC,QAAQ,QAIH,sBAAkB;AACzB,SACEC,gBAAgB,EAChBC,eAAe,EACfC,aAAa,EACbC,iBAAiB,QAEZ,wBAAoB;AAE3B;;;;;;;;;;;;;;;;CAgBC,GACD,OAAO,MAAMC,oBAAoB,OAAe;AAEhD,4EAA4E,GAC5E,OAAO,MAAMC,uBAAuB,EAAC;AAErC;;;;;;;;;;;;;;;;;;;;;CAqBC,GACD,OAAO,SAASC,gBACdC,KAAwB,EACxBC,KAAyB;IAEzB,OAAOC,YAAYF,OAAOC,OAAOJ;AACnC;AAEA;;;;;;CAMC,GACD,SAASK,YACPF,KAAwB,EACxBC,KAAyB,EACzBE,IAAY;QAKI;QAEKC;IALrB,IAAI,CAACJ,SAAS,CAACC,OAAO,OAAOI;IAC7B,2EAA2E;IAC3E,sDAAsD;IACtD,MAAMD,UAAU,cAAA,AAACJ,MAAsDM,IAAI,YAA3D,cACdN;IACF,MAAMO,eAAeH,2BAAAA,kBAAAA,OAAQI,OAAO,qBAAfJ,eAAiB,CAACH,MAAM;IAE7C,IAAI,CAACM,gBAAgB,OAAOA,iBAAiB,UAAU,OAAOF;IAC9D,MAAMI,QAAQF,YAAY,CAACJ,KAAK;IAChC,OAAO,OAAOM,UAAU,WAAWA,QAAQJ;AAC7C;AAEA;;;;;;;;;;;;CAYC,GACD,OAAO,MAAMK,oBAA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/C,aAAa;oBACvBoC,OAAO;wBACLxE,OAAOiF;wBACP9B,MAAM;wBACN3C,OAAOR,MAAMuC,YAAY;wBACzBa,SAASpD,MAAMqC,IAAI;wBACnB8C;wBACAC,UAAUhD;oBACZ;gBACF;YACF,EAAE,eAAM;YACN,YAAY;YACd;QACF;QACA,uEAAuE;QACvE,sEAAsE;QACtE,wEAAwE;QACxE,wEAAwE;QACxE,aAAa;QACb,IAAIiC,SAAS,iBAAiB,OAAOa,WAAW,UAAU;YACxD,IAAI;gBACF,MAAMC,QAAQzF,cAAcM,MAAMuC,YAAY,EAAE2C;gBAChD,IAAIC,QAAQ/C,aAAa;oBACvBoC,OAAO;wBACLxE,OAAOiF;wBACP9B,MAAM;wBACN3C,OAAOR,MAAMuC,YAAY;wBACzBa,SAAS8B;wBACTC;wBACAC,UAAUhD;oBACZ;gBACF;YACF,EAAE,eAAM;YACN,YAAY;YACd;QACF;IACF;IACA,OAAOmC;AACT;AAEA,8EAA8E,GAC9E,OAAO,SAASc,+BACdZ,SAAmC;IAEnC,MAAMa,WAAW,GAAGb,UAAUzE,KAAK,CAAC,CAAC,EAAEyE,UAAUtB,IAAI,CAAC,CAAC,EAAEsB,UAAUjE,KAAK,CAAC,IAAI,EAC3EiE,UAAUrB,OAAO,CAClB,IAAI,EAAEqB,UAAUU,KAAK,CAACI,OAAO,CAAC,GAAG,UAAU,EAAEd,UAAUW,QAAQ,CAAC,EAAE,CAAC;IACpE,sEAAsE;IACtE,wCAAwC;IACxC,OAAOX,UAAUC,SAAS,GACtB,GAAGY,SAAS,oBAAoB,EAAEb,UAAUC,SAAS,EAAE,GACvDY;AACN;AAEA,eAAexF,gBAAe"}
|
|
@@ -16,7 +16,8 @@ import { _ as _object_without_properties_loose } from "@swc/helpers/_/_object_wi
|
|
|
16
16
|
* See the License for the specific language governing permissions and
|
|
17
17
|
* limitations under the License.
|
|
18
18
|
*/ import { extendTheme as muiExtendTheme } from "@mui/material/styles";
|
|
19
|
-
import { createTheme, darken, getContrastRatio, lighten, responsiveFontSizes } from "../../vendor/mui.js";
|
|
19
|
+
import { alpha, createTheme, darken, getContrastRatio, lighten, responsiveFontSizes } from "../../vendor/mui.js";
|
|
20
|
+
import { ACCENT_HOVER_FILL, ACCENT_HOVER_TEXT, hoverFillShade, inkOnFill } from "./accent-text.js";
|
|
20
21
|
import { accessibleShade, contrastRatio, meetsContrast } from "./accessible-shade.js";
|
|
21
22
|
var ContrastText = /*#__PURE__*/ function(ContrastText) {
|
|
22
23
|
ContrastText["LIGHT"] = "rgba(0, 0, 0, 0.87)";
|
|
@@ -152,6 +153,65 @@ function addShadeVariants(paletteColor, tonalOffset) {
|
|
|
152
153
|
}
|
|
153
154
|
}
|
|
154
155
|
}
|
|
156
|
+
/**
|
|
157
|
+
* Post-`createTheme` pass giving every palette color a defined HOVER
|
|
158
|
+
* (AGL-3465): `palette[color].hover`, the fill ({@link ACCENT_HOVER_FILL}),
|
|
159
|
+
* and `palette[color].hoverText`, the label ({@link ACCENT_HOVER_TEXT}).
|
|
160
|
+
* The `MuiButton` and `MuiFab` overrides read both.
|
|
161
|
+
*
|
|
162
|
+
* - **The fill.** MUI fills a hovered contained Button and Fab with
|
|
163
|
+
* `palette[color].dark`, which this theme uses as the accent-as-TEXT
|
|
164
|
+
* shade: lighter than `main` in a dark scheme, so a white label on it
|
|
165
|
+
* sinks to ~2:1. Every entry with a string `main` and `contrastText` gets
|
|
166
|
+
* one — the built-in accents, `tertiary`, `surface`, and any custom color
|
|
167
|
+
* a palette adds — so a color a component can be asked to wear always has
|
|
168
|
+
* a hover that carries its own ink at AA.
|
|
169
|
+
* - **The label.** A hovered text or outlined Button keeps `dark` as its
|
|
170
|
+
* label and lays `main` at `action.hoverOpacity` under it. Foreground
|
|
171
|
+
* colors get `dark` walked in the scheme's foreground direction until it
|
|
172
|
+
* clears AA on that wash over both `background.default` and
|
|
173
|
+
* `background.paper`; it stays `dark`, byte-identical, wherever `dark`
|
|
174
|
+
* already does. `surface` gets none: its `dark` is a surface step, not
|
|
175
|
+
* text, so it has no label to protect.
|
|
176
|
+
*
|
|
177
|
+
* A slot the caller authored passes through untouched.
|
|
178
|
+
*/ function ensureHoverShades(theme, inputPalette) {
|
|
179
|
+
var _ref;
|
|
180
|
+
var _theme_palette_background, _theme_palette_background1, _theme_palette_action;
|
|
181
|
+
const palette = theme.palette;
|
|
182
|
+
const providedColors = inputPalette;
|
|
183
|
+
const tonalOffsetDark = resolveTonalOffsets(theme.palette.tonalOffset).dark;
|
|
184
|
+
const foregroundDirection = theme.palette.mode === 'dark' ? 'lighten' : 'darken';
|
|
185
|
+
const backgrounds = [
|
|
186
|
+
(_theme_palette_background = theme.palette.background) == null ? void 0 : _theme_palette_background.default,
|
|
187
|
+
(_theme_palette_background1 = theme.palette.background) == null ? void 0 : _theme_palette_background1.paper
|
|
188
|
+
].filter((background)=>typeof background === 'string');
|
|
189
|
+
const hoverOpacity = (_ref = (_theme_palette_action = theme.palette.action) == null ? void 0 : _theme_palette_action.hoverOpacity) != null ? _ref : 0;
|
|
190
|
+
for (const [key, value] of Object.entries(palette)){
|
|
191
|
+
var _ref1;
|
|
192
|
+
if (!value || typeof value !== 'object') continue;
|
|
193
|
+
const color = value;
|
|
194
|
+
const { main, dark, contrastText } = color;
|
|
195
|
+
if (typeof main !== 'string' || typeof contrastText !== 'string') continue;
|
|
196
|
+
const provided = (_ref1 = providedColors == null ? void 0 : providedColors[key]) != null ? _ref1 : {};
|
|
197
|
+
try {
|
|
198
|
+
if (typeof provided[ACCENT_HOVER_FILL] !== 'string') {
|
|
199
|
+
color[ACCENT_HOVER_FILL] = hoverFillShade({
|
|
200
|
+
main,
|
|
201
|
+
contrastText,
|
|
202
|
+
dark: typeof dark === 'string' ? dark : undefined
|
|
203
|
+
}, tonalOffsetDark);
|
|
204
|
+
}
|
|
205
|
+
if (typeof provided[ACCENT_HOVER_TEXT] !== 'string' && FOREGROUND_COLOR_KEYS.includes(key) && typeof dark === 'string' && backgrounds.length) {
|
|
206
|
+
const wash = alpha(main, hoverOpacity);
|
|
207
|
+
color[ACCENT_HOVER_TEXT] = accessibleShade(dark, backgrounds.map((background)=>inkOnFill(wash, background)), foregroundDirection);
|
|
208
|
+
}
|
|
209
|
+
} catch (unused) {
|
|
210
|
+
// Unparseable colour (CSS variable, color-mix()): no slot, so the
|
|
211
|
+
// component overrides fall back to MUI's own hover for this color.
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
155
215
|
/**
|
|
156
216
|
* MUI's own default `responsiveFontSizes` variant list, spelled out because
|
|
157
217
|
* passing `variants` replaces it rather than extending it.
|
|
@@ -238,6 +298,9 @@ function addShadeVariants(paletteColor, tonalOffset) {
|
|
|
238
298
|
// Scheme- and AA-aware repair of DERIVED shades only (AGL-1297); explicit
|
|
239
299
|
// palette values pass through byte-identical.
|
|
240
300
|
ensureAccessibleShades(theme, themeOptions == null ? void 0 : themeOptions.palette);
|
|
301
|
+
// After the shade repair, because both hover slots start from `dark` and
|
|
302
|
+
// have to see the value that ships.
|
|
303
|
+
ensureHoverShades(theme, themeOptions == null ? void 0 : themeOptions.palette);
|
|
241
304
|
theme = responsiveFontSizes(theme, _extends({
|
|
242
305
|
// Override to include `xs` and `xl` - default: ['sm', 'md', 'lg']
|
|
243
306
|
breakpoints: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../../libs/shared/ui/theme/src/lib/util/create-responsive-theme.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2024 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n CssVarsThemeOptions,\n extendTheme as muiExtendTheme,\n} from '@mui/material/styles'\nimport {\n createTheme,\n darken,\n getContrastRatio,\n lighten,\n type PaletteColor,\n type PaletteOptions,\n responsiveFontSizes,\n type Theme,\n type ThemeOptions,\n} from '../../vendor/mui'\nimport {\n accessibleShade,\n contrastRatio,\n meetsContrast,\n type ShadeDirection,\n} from './accessible-shade'\n\nenum ContrastText {\n LIGHT = 'rgba(0, 0, 0, 0.87)',\n DARK = '#FFFFFF',\n}\n\ntype TonalOffset = number | { light?: number; dark?: number }\n\nfunction resolveTonalOffsets(tonalOffset: TonalOffset | undefined) {\n const offsetObj = typeof tonalOffset === 'number' ? undefined : tonalOffset\n const offsetNum = typeof tonalOffset === 'number' ? tonalOffset : undefined\n return {\n light: offsetObj?.light ?? offsetNum ?? 0.2,\n dark: offsetObj?.dark ?? (offsetNum ?? 0.2) * 1.5,\n }\n}\n\nfunction getContrastTextColor(background: string, contrastThreshold: number) {\n return getContrastRatio(background, ContrastText.DARK) >= (contrastThreshold ?? 3)\n ? ContrastText.DARK\n : ContrastText.LIGHT\n}\nfunction addShade(paletteColor: PaletteColor, shade: string, variant: string | undefined, tonalOffset: TonalOffset) {\n // Custom palette colors (tertiary, surface) are optional in host themes.\n if (!paletteColor?.main) return\n const { light: tonalOffsetLight, dark: tonalOffsetDark } =\n resolveTonalOffsets(tonalOffset)\n const indexed = paletteColor as unknown as Record<string, string>\n\n if (!indexed[shade]) {\n // eslint-disable-next-line no-prototype-builtins\n if (paletteColor.hasOwnProperty(variant)) {\n indexed[shade] = indexed[variant]\n } else if (shade === 'light') {\n paletteColor.light = lighten(paletteColor.main, tonalOffsetLight)\n } else if (shade === 'dark') {\n paletteColor.dark = darken(paletteColor.main, tonalOffsetDark)\n } else if (shade === 'contrastText') {\n paletteColor.contrastText = getContrastTextColor(\n paletteColor.main,\n tonalOffsetDark,\n )\n }\n }\n}\nfunction addShadeVariants(paletteColor: PaletteColor, tonalOffset?: TonalOffset) {\n addShade(paletteColor, 'dark', undefined, tonalOffset)\n addShade(paletteColor, 'light', undefined, tonalOffset)\n addShade(paletteColor, 'contrastText', undefined, tonalOffset)\n}\n\n/**\n * Colour families whose shades act as FOREGROUNDS — the `dark` slot carries\n * \"accessible accent text\" (AGL-1293 put the marketing brand blue there), so\n * its derivation must clear AA against the scheme's real backgrounds.\n *\n * `surface` is deliberately absent: its `light`/`dark` are surface STEPS\n * (panel fills, borders — see the designer's box styler), and walking them to\n * text contrast would repaint layout chrome, not fix any text.\n */\nconst FOREGROUND_COLOR_KEYS = [\n 'primary',\n 'secondary',\n 'tertiary',\n 'error',\n 'warning',\n 'info',\n 'success',\n] as const\n\n/** `contrastText` IS a text pairing wherever it lives, so `surface` joins here. */\nconst CONTRAST_TEXT_COLOR_KEYS = [...FOREGROUND_COLOR_KEYS, 'surface'] as const\n\n/**\n * Post-`createTheme` pass making DERIVED shades scheme- and AA-aware\n * (AGL-1297). Fixed tonal offsets derive `dark = darken(main, 0.3)` no\n * matter the scheme, which (a) misses 4.5:1 on real off-white surfaces and\n * (b) points the wrong way entirely in dark mode, where the accessible\n * direction for a foreground shade is LIGHTER.\n *\n * Invariants:\n * - Only slots ABSENT from the caller's `palette` input are ever touched;\n * an explicitly authored shade passes through byte-identical (the\n * marketing host's hand-set `primary.dark` values depend on this).\n * - A derived value that already clears 4.5:1 against both\n * `background.default` and `background.paper` is kept byte-identical, so\n * themes that were fine yesterday do not shift.\n * - A failing derived `dark` is re-seeded at the tonal offset from `main`\n * in the scheme's foreground direction (darken in light, lighten in\n * dark), then walked in HSL lightness until it clears the bar.\n * - A light-scheme `light` is a background TINT — its ramp direction points\n * away from the text bar by design — so it keeps the tonal derivation.\n * In dark schemes `light` is foreground-capable and gets the same walk.\n * - Derived `contrastText` keeps the threshold choice unless that pairing\n * is below 4.5:1 against `main`; then it walks toward the pole with more\n * contrast headroom.\n */\nfunction ensureAccessibleShades(\n theme: Theme,\n inputPalette: PaletteOptions | undefined,\n) {\n const { palette } = theme\n const backgrounds = [\n palette.background?.default,\n palette.background?.paper,\n ].filter((background): background is string => typeof background === 'string')\n if (!backgrounds.length) return\n const mode: 'light' | 'dark' = palette.mode === 'dark' ? 'dark' : 'light'\n const foregroundDirection: ShadeDirection =\n mode === 'dark' ? 'lighten' : 'darken'\n const tonalOffsetDark = resolveTonalOffsets(palette.tonalOffset).dark\n const providedColors = inputPalette as\n | Record<string, unknown>\n | undefined\n\n for (const key of CONTRAST_TEXT_COLOR_KEYS) {\n const color = (palette as unknown as Record<string, PaletteColor>)[key]\n if (!color || typeof color.main !== 'string') continue\n const provided = providedColors?.[key]\n // A ColorPartial ramp (`{ 50…900 }`) is an author-owned scale — MUI maps\n // its shades straight across, so nothing in it counts as derived.\n if (provided && typeof provided === 'object' && !('main' in provided)) {\n continue\n }\n // Read with brackets, not dots: these keys come from an index signature,\n // and `json-editor` compiles this file under\n // `noPropertyAccessFromIndexSignature` (paths resolve to source, so a\n // consumer's flags check its dependencies). Dot access reds that build\n // while this project's own stays green — AGL-1323.\n const explicit = (provided ?? {}) as Record<string, unknown>\n const isForeground = (FOREGROUND_COLOR_KEYS as readonly string[]).includes(\n key,\n )\n\n try {\n if (\n isForeground &&\n !explicit['dark'] &&\n typeof color.dark === 'string' &&\n !meetsContrast(color.dark, backgrounds)\n ) {\n const seed =\n mode === 'dark' ? lighten(color.main, tonalOffsetDark) : color.dark\n color.dark = accessibleShade(seed, backgrounds, foregroundDirection)\n }\n if (\n isForeground &&\n mode === 'dark' &&\n !explicit['light'] &&\n typeof color.light === 'string' &&\n !meetsContrast(color.light, backgrounds)\n ) {\n color.light = accessibleShade(color.light, backgrounds, 'lighten')\n }\n if (\n !explicit['contrastText'] &&\n typeof color.contrastText === 'string' &&\n !meetsContrast(color.contrastText, [color.main])\n ) {\n const textDirection: ShadeDirection =\n contrastRatio('#fff', color.main) >= contrastRatio('#000', color.main)\n ? 'lighten'\n : 'darken'\n color.contrastText = accessibleShade(\n color.contrastText,\n [color.main],\n textDirection,\n )\n }\n } catch {\n // Unparseable colour (CSS variable, color-mix()): leave the derived\n // value alone rather than failing theme creation.\n }\n }\n}\n\n/**\n * MUI's own default `responsiveFontSizes` variant list, spelled out because\n * passing `variants` replaces it rather than extending it.\n */\nconst RAMPED_MUI_VARIANTS = [\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'subtitle1',\n 'subtitle2',\n 'body1',\n 'body2',\n 'caption',\n 'button',\n 'overline',\n] as const\n\n/**\n * The brand's custom display rungs, which MUI cannot know about.\n *\n * Only variants whose size genuinely needs to shrink belong here. `lede`,\n * `bodyCompact` and `micro` are body-scale text that reads the same at every\n * width and are deliberately absent.\n */\nconst RAMPED_DISPLAY_VARIANTS = ['displayXl'] as const\n\nexport type CreateResponsiveThemeOptions = {\n themeOptions?: ThemeOptions\n responsiveFontSizesOptions?: Parameters<typeof responsiveFontSizes>[1]\n}\n\n/**\n * START EXAMPLE – OVERRIDE DEFAULT PROPS ↓\n * ⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄\n * ```typescript\n * const theme = createMuiTheme({\n * props: {\n * // Name of the component ⚛️\n * MuiButtonBase: {\n * // The default props to change\n * disableRipple: true, // No more ripple, on the whole application 💣!\n * },\n * },\n * })\n * ```\n * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n * END EXAMPLE – OVERRIDE DEFAULT PROPS ↑\n *\n * START EXAMPLE – OVERRIDE DEFAULT STYLES ↓\n * ⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄\n * ```typescript\n * const theme = createMuiTheme({\n * overrides: {\n * // Style sheet name ⚛️\n * MuiButton: {\n * // Name of the rule\n * text: {\n * // Some CSS\n * color: 'white',\n * },\n * },\n * MuiCssBaseline: {\n * '@global': {\n * html: {\n * WebkitFontSmoothing: 'auto',\n * },\n * },\n * },\n * },\n * })\n * ```\n * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n * END EXAMPLE – OVERRIDE DEFAULT STYLES ↑\n *\n * @param {ThemeOptions} options\n * @returns {Theme}\n */\nexport function createResponsiveTheme(\n options: CreateResponsiveThemeOptions,\n): Theme {\n const { themeOptions, responsiveFontSizesOptions } = options\n let theme = createTheme(themeOptions)\n addShadeVariants(theme.palette.tertiary, theme.palette.tonalOffset)\n addShadeVariants(theme.palette.surface, theme.palette.tonalOffset)\n // `tint` is deliberately absent from BOTH shade passes (AGL-1244). It is a\n // group of string leaves rather than a PaletteColor — no `main` to ramp\n // from, no `contrastText` to pair — so `addShadeVariants` would no-op and\n // `ensureAccessibleShades` (which keys off `CONTRAST_TEXT_COLOR_KEYS`) never\n // sees it. Both correct: a 90%-desaturated wash is authored, not derived,\n // and walking it to a text-contrast bar would repaint the fill.\n // Scheme- and AA-aware repair of DERIVED shades only (AGL-1297); explicit\n // palette values pass through byte-identical.\n ensureAccessibleShades(theme, themeOptions?.palette)\n\n theme = responsiveFontSizes(theme, {\n // Override to include `xs` and `xl` - default: ['sm', 'md', 'lg']\n breakpoints: ['xs', 'sm', 'md', 'lg', 'xl'],\n // MUI only ramps the variants it ships, so a CUSTOM display variant would\n // keep its desktop size on a phone — `displayXl` at 72px on a 375px\n // screen. Passing `variants` REPLACES MUI's default list, so the defaults\n // are spelled out here and ours appended; drop one and that variant\n // silently stops scaling.\n variants: [...RAMPED_MUI_VARIANTS, ...RAMPED_DISPLAY_VARIANTS],\n ...responsiveFontSizesOptions,\n })\n\n return theme\n}\n\nexport function createResponsiveCssVarTheme(\n light: Theme,\n dark: Theme,\n options?: CssVarsThemeOptions,\n) {\n const { palette: lightPalette, ...lightTheme } = light\n const { palette: darkPalette } = dark\n\n return muiExtendTheme({\n ...lightTheme,\n // Allow setMode() to work by driving the color scheme via a CSS class on\n // <html> instead of the OS-level @media query (the default 'media' selector\n // makes setMode() a no-op because media queries can't be overridden in JS).\n colorSchemeSelector: 'class',\n ...options,\n colorSchemes: {\n ...options?.colorSchemes,\n light: { palette: lightPalette, ...((options?.colorSchemes?.light ?? {}) as object) },\n dark: { palette: darkPalette, ...((options?.colorSchemes?.dark ?? {}) as object) },\n },\n })\n}\n\nexport default createResponsiveTheme\n"],"names":["extendTheme","muiExtendTheme","createTheme","darken","getContrastRatio","lighten","responsiveFontSizes","accessibleShade","contrastRatio","meetsContrast","ContrastText","resolveTonalOffsets","tonalOffset","offsetObj","undefined","offsetNum","light","dark","getContrastTextColor","background","contrastThreshold","addShade","paletteColor","shade","variant","main","tonalOffsetLight","tonalOffsetDark","indexed","hasOwnProperty","contrastText","addShadeVariants","FOREGROUND_COLOR_KEYS","CONTRAST_TEXT_COLOR_KEYS","ensureAccessibleShades","theme","inputPalette","palette","backgrounds","default","paper","filter","length","mode","foregroundDirection","providedColors","key","color","provided","explicit","isForeground","includes","seed","textDirection","RAMPED_MUI_VARIANTS","RAMPED_DISPLAY_VARIANTS","createResponsiveTheme","options","themeOptions","responsiveFontSizesOptions","tertiary","surface","breakpoints","variants","createResponsiveCssVarTheme","lightPalette","lightTheme","darkPalette","colorSchemeSelector","colorSchemes"],"mappings":";;AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAEEA,eAAeC,cAAc,QACxB,uBAAsB;AAC7B,SACEC,WAAW,EACXC,MAAM,EACNC,gBAAgB,EAChBC,OAAO,EAGPC,mBAAmB,QAGd,sBAAkB;AACzB,SACEC,eAAe,EACfC,aAAa,EACbC,aAAa,QAER,wBAAoB;AAE3B,IAAA,AAAKC,sCAAAA;;;WAAAA;EAAAA;AAOL,SAASC,oBAAoBC,WAAoC;QAItDC;IAHT,MAAMA,YAAY,OAAOD,gBAAgB,WAAWE,YAAYF;IAChE,MAAMG,YAAY,OAAOH,gBAAgB,WAAWA,cAAcE;IAClE,OAAO;QACLE,KAAK,GAAEH,gB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AAgE;IAChE,0EAA0E;IAC1E,8CAA8C;IAC9CsB,uBAAuBC,OAAOuB,gCAAAA,aAAcrB,OAAO;IAEnDF,QAAQ7B,oBAAoB6B,OAAO;QACjC,kEAAkE;QAClE2B,aAAa;YAAC;YAAM;YAAM;YAAM;YAAM;SAAK;QAC3C,0EAA0E;QAC1E,oEAAoE;QACpE,0EAA0E;QAC1E,oEAAoE;QACpE,0BAA0B;QAC1BC,UAAU;eAAIT;eAAwBC;SAAwB;OAC3DI;IAGL,OAAOxB;AACT;AAEA,OAAO,SAAS6B,4BACdhD,KAAY,EACZC,IAAW,EACXwC,OAA6B;;QAcYA,uBACFA;IAbvC,MAAM,EAAEpB,SAAS4B,YAAY,EAAiB,GAAGjD,OAAfkD,8CAAelD;;;IACjD,MAAM,EAAEqB,SAAS8B,WAAW,EAAE,GAAGlD;IAEjC,OAAOhB,eAAe,aACjBiE;QACH,yEAAyE;QACzE,4EAA4E;QAC5E,4EAA4E;QAC5EE,qBAAqB;OAClBX;QACHY,cAAc,aACTZ,2BAAAA,QAASY,YAAY;YACxBrD,OAAO;gBAAEqB,SAAS4B;uBAAmBR,4BAAAA,wBAAAA,QAASY,YAAY,qBAArBZ,sBAAuBzC,KAAK,mBAAI,CAAC;YACtEC,MAAM;gBAAEoB,SAAS8B;wBAAkBV,4BAAAA,yBAAAA,QAASY,YAAY,qBAArBZ,uBAAuBxC,IAAI,oBAAI,CAAC;;;AAGzE;AAEA,eAAeuC,sBAAqB"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../libs/shared/ui/theme/src/lib/util/create-responsive-theme.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2024 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n CssVarsThemeOptions,\n extendTheme as muiExtendTheme,\n} from '@mui/material/styles'\nimport {\n alpha,\n createTheme,\n darken,\n getContrastRatio,\n lighten,\n type PaletteColor,\n type PaletteOptions,\n responsiveFontSizes,\n type Theme,\n type ThemeOptions,\n} from '../../vendor/mui'\nimport {\n ACCENT_HOVER_FILL,\n ACCENT_HOVER_TEXT,\n hoverFillShade,\n inkOnFill,\n} from './accent-text'\nimport {\n accessibleShade,\n contrastRatio,\n meetsContrast,\n type ShadeDirection,\n} from './accessible-shade'\n\nenum ContrastText {\n LIGHT = 'rgba(0, 0, 0, 0.87)',\n DARK = '#FFFFFF',\n}\n\ntype TonalOffset = number | { light?: number; dark?: number }\n\nfunction resolveTonalOffsets(tonalOffset: TonalOffset | undefined) {\n const offsetObj = typeof tonalOffset === 'number' ? undefined : tonalOffset\n const offsetNum = typeof tonalOffset === 'number' ? tonalOffset : undefined\n return {\n light: offsetObj?.light ?? offsetNum ?? 0.2,\n dark: offsetObj?.dark ?? (offsetNum ?? 0.2) * 1.5,\n }\n}\n\nfunction getContrastTextColor(background: string, contrastThreshold: number) {\n return getContrastRatio(background, ContrastText.DARK) >= (contrastThreshold ?? 3)\n ? ContrastText.DARK\n : ContrastText.LIGHT\n}\nfunction addShade(paletteColor: PaletteColor, shade: string, variant: string | undefined, tonalOffset: TonalOffset) {\n // Custom palette colors (tertiary, surface) are optional in host themes.\n if (!paletteColor?.main) return\n const { light: tonalOffsetLight, dark: tonalOffsetDark } =\n resolveTonalOffsets(tonalOffset)\n const indexed = paletteColor as unknown as Record<string, string>\n\n if (!indexed[shade]) {\n // eslint-disable-next-line no-prototype-builtins\n if (paletteColor.hasOwnProperty(variant)) {\n indexed[shade] = indexed[variant]\n } else if (shade === 'light') {\n paletteColor.light = lighten(paletteColor.main, tonalOffsetLight)\n } else if (shade === 'dark') {\n paletteColor.dark = darken(paletteColor.main, tonalOffsetDark)\n } else if (shade === 'contrastText') {\n paletteColor.contrastText = getContrastTextColor(\n paletteColor.main,\n tonalOffsetDark,\n )\n }\n }\n}\nfunction addShadeVariants(paletteColor: PaletteColor, tonalOffset?: TonalOffset) {\n addShade(paletteColor, 'dark', undefined, tonalOffset)\n addShade(paletteColor, 'light', undefined, tonalOffset)\n addShade(paletteColor, 'contrastText', undefined, tonalOffset)\n}\n\n/**\n * Colour families whose shades act as FOREGROUNDS — the `dark` slot carries\n * \"accessible accent text\" (AGL-1293 put the marketing brand blue there), so\n * its derivation must clear AA against the scheme's real backgrounds.\n *\n * `surface` is deliberately absent: its `light`/`dark` are surface STEPS\n * (panel fills, borders — see the designer's box styler), and walking them to\n * text contrast would repaint layout chrome, not fix any text.\n */\nconst FOREGROUND_COLOR_KEYS = [\n 'primary',\n 'secondary',\n 'tertiary',\n 'error',\n 'warning',\n 'info',\n 'success',\n] as const\n\n/** `contrastText` IS a text pairing wherever it lives, so `surface` joins here. */\nconst CONTRAST_TEXT_COLOR_KEYS = [...FOREGROUND_COLOR_KEYS, 'surface'] as const\n\n/**\n * Post-`createTheme` pass making DERIVED shades scheme- and AA-aware\n * (AGL-1297). Fixed tonal offsets derive `dark = darken(main, 0.3)` no\n * matter the scheme, which (a) misses 4.5:1 on real off-white surfaces and\n * (b) points the wrong way entirely in dark mode, where the accessible\n * direction for a foreground shade is LIGHTER.\n *\n * Invariants:\n * - Only slots ABSENT from the caller's `palette` input are ever touched;\n * an explicitly authored shade passes through byte-identical (the\n * marketing host's hand-set `primary.dark` values depend on this).\n * - A derived value that already clears 4.5:1 against both\n * `background.default` and `background.paper` is kept byte-identical, so\n * themes that were fine yesterday do not shift.\n * - A failing derived `dark` is re-seeded at the tonal offset from `main`\n * in the scheme's foreground direction (darken in light, lighten in\n * dark), then walked in HSL lightness until it clears the bar.\n * - A light-scheme `light` is a background TINT — its ramp direction points\n * away from the text bar by design — so it keeps the tonal derivation.\n * In dark schemes `light` is foreground-capable and gets the same walk.\n * - Derived `contrastText` keeps the threshold choice unless that pairing\n * is below 4.5:1 against `main`; then it walks toward the pole with more\n * contrast headroom.\n */\nfunction ensureAccessibleShades(\n theme: Theme,\n inputPalette: PaletteOptions | undefined,\n) {\n const { palette } = theme\n const backgrounds = [\n palette.background?.default,\n palette.background?.paper,\n ].filter((background): background is string => typeof background === 'string')\n if (!backgrounds.length) return\n const mode: 'light' | 'dark' = palette.mode === 'dark' ? 'dark' : 'light'\n const foregroundDirection: ShadeDirection =\n mode === 'dark' ? 'lighten' : 'darken'\n const tonalOffsetDark = resolveTonalOffsets(palette.tonalOffset).dark\n const providedColors = inputPalette as\n | Record<string, unknown>\n | undefined\n\n for (const key of CONTRAST_TEXT_COLOR_KEYS) {\n const color = (palette as unknown as Record<string, PaletteColor>)[key]\n if (!color || typeof color.main !== 'string') continue\n const provided = providedColors?.[key]\n // A ColorPartial ramp (`{ 50…900 }`) is an author-owned scale — MUI maps\n // its shades straight across, so nothing in it counts as derived.\n if (provided && typeof provided === 'object' && !('main' in provided)) {\n continue\n }\n // Read with brackets, not dots: these keys come from an index signature,\n // and `json-editor` compiles this file under\n // `noPropertyAccessFromIndexSignature` (paths resolve to source, so a\n // consumer's flags check its dependencies). Dot access reds that build\n // while this project's own stays green — AGL-1323.\n const explicit = (provided ?? {}) as Record<string, unknown>\n const isForeground = (FOREGROUND_COLOR_KEYS as readonly string[]).includes(\n key,\n )\n\n try {\n if (\n isForeground &&\n !explicit['dark'] &&\n typeof color.dark === 'string' &&\n !meetsContrast(color.dark, backgrounds)\n ) {\n const seed =\n mode === 'dark' ? lighten(color.main, tonalOffsetDark) : color.dark\n color.dark = accessibleShade(seed, backgrounds, foregroundDirection)\n }\n if (\n isForeground &&\n mode === 'dark' &&\n !explicit['light'] &&\n typeof color.light === 'string' &&\n !meetsContrast(color.light, backgrounds)\n ) {\n color.light = accessibleShade(color.light, backgrounds, 'lighten')\n }\n if (\n !explicit['contrastText'] &&\n typeof color.contrastText === 'string' &&\n !meetsContrast(color.contrastText, [color.main])\n ) {\n const textDirection: ShadeDirection =\n contrastRatio('#fff', color.main) >= contrastRatio('#000', color.main)\n ? 'lighten'\n : 'darken'\n color.contrastText = accessibleShade(\n color.contrastText,\n [color.main],\n textDirection,\n )\n }\n } catch {\n // Unparseable colour (CSS variable, color-mix()): leave the derived\n // value alone rather than failing theme creation.\n }\n }\n}\n\n/**\n * Post-`createTheme` pass giving every palette color a defined HOVER\n * (AGL-3465): `palette[color].hover`, the fill ({@link ACCENT_HOVER_FILL}),\n * and `palette[color].hoverText`, the label ({@link ACCENT_HOVER_TEXT}).\n * The `MuiButton` and `MuiFab` overrides read both.\n *\n * - **The fill.** MUI fills a hovered contained Button and Fab with\n * `palette[color].dark`, which this theme uses as the accent-as-TEXT\n * shade: lighter than `main` in a dark scheme, so a white label on it\n * sinks to ~2:1. Every entry with a string `main` and `contrastText` gets\n * one — the built-in accents, `tertiary`, `surface`, and any custom color\n * a palette adds — so a color a component can be asked to wear always has\n * a hover that carries its own ink at AA.\n * - **The label.** A hovered text or outlined Button keeps `dark` as its\n * label and lays `main` at `action.hoverOpacity` under it. Foreground\n * colors get `dark` walked in the scheme's foreground direction until it\n * clears AA on that wash over both `background.default` and\n * `background.paper`; it stays `dark`, byte-identical, wherever `dark`\n * already does. `surface` gets none: its `dark` is a surface step, not\n * text, so it has no label to protect.\n *\n * A slot the caller authored passes through untouched.\n */\nfunction ensureHoverShades(\n theme: Theme,\n inputPalette: PaletteOptions | undefined,\n) {\n const palette = theme.palette as unknown as Record<string, unknown>\n const providedColors = inputPalette as Record<string, unknown> | undefined\n const tonalOffsetDark = resolveTonalOffsets(theme.palette.tonalOffset).dark\n const foregroundDirection: ShadeDirection =\n theme.palette.mode === 'dark' ? 'lighten' : 'darken'\n const backgrounds = [\n theme.palette.background?.default,\n theme.palette.background?.paper,\n ].filter((background): background is string => typeof background === 'string')\n const hoverOpacity = theme.palette.action?.hoverOpacity ?? 0\n\n for (const [key, value] of Object.entries(palette)) {\n if (!value || typeof value !== 'object') continue\n const color = value as Record<string, unknown>\n const { main, dark, contrastText } = color\n if (typeof main !== 'string' || typeof contrastText !== 'string') continue\n const provided = (providedColors?.[key] ?? {}) as Record<string, unknown>\n try {\n if (typeof provided[ACCENT_HOVER_FILL] !== 'string') {\n color[ACCENT_HOVER_FILL] = hoverFillShade(\n {\n main,\n contrastText,\n dark: typeof dark === 'string' ? dark : undefined,\n },\n tonalOffsetDark,\n )\n }\n if (\n typeof provided[ACCENT_HOVER_TEXT] !== 'string' &&\n (FOREGROUND_COLOR_KEYS as readonly string[]).includes(key) &&\n typeof dark === 'string' &&\n backgrounds.length\n ) {\n const wash = alpha(main, hoverOpacity)\n color[ACCENT_HOVER_TEXT] = accessibleShade(\n dark,\n backgrounds.map((background) => inkOnFill(wash, background)),\n foregroundDirection,\n )\n }\n } catch {\n // Unparseable colour (CSS variable, color-mix()): no slot, so the\n // component overrides fall back to MUI's own hover for this color.\n }\n }\n}\n\n/**\n * MUI's own default `responsiveFontSizes` variant list, spelled out because\n * passing `variants` replaces it rather than extending it.\n */\nconst RAMPED_MUI_VARIANTS = [\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'subtitle1',\n 'subtitle2',\n 'body1',\n 'body2',\n 'caption',\n 'button',\n 'overline',\n] as const\n\n/**\n * The brand's custom display rungs, which MUI cannot know about.\n *\n * Only variants whose size genuinely needs to shrink belong here. `lede`,\n * `bodyCompact` and `micro` are body-scale text that reads the same at every\n * width and are deliberately absent.\n */\nconst RAMPED_DISPLAY_VARIANTS = ['displayXl'] as const\n\nexport type CreateResponsiveThemeOptions = {\n themeOptions?: ThemeOptions\n responsiveFontSizesOptions?: Parameters<typeof responsiveFontSizes>[1]\n}\n\n/**\n * START EXAMPLE – OVERRIDE DEFAULT PROPS ↓\n * ⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄\n * ```typescript\n * const theme = createMuiTheme({\n * props: {\n * // Name of the component ⚛️\n * MuiButtonBase: {\n * // The default props to change\n * disableRipple: true, // No more ripple, on the whole application 💣!\n * },\n * },\n * })\n * ```\n * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n * END EXAMPLE – OVERRIDE DEFAULT PROPS ↑\n *\n * START EXAMPLE – OVERRIDE DEFAULT STYLES ↓\n * ⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄\n * ```typescript\n * const theme = createMuiTheme({\n * overrides: {\n * // Style sheet name ⚛️\n * MuiButton: {\n * // Name of the rule\n * text: {\n * // Some CSS\n * color: 'white',\n * },\n * },\n * MuiCssBaseline: {\n * '@global': {\n * html: {\n * WebkitFontSmoothing: 'auto',\n * },\n * },\n * },\n * },\n * })\n * ```\n * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n * END EXAMPLE – OVERRIDE DEFAULT STYLES ↑\n *\n * @param {ThemeOptions} options\n * @returns {Theme}\n */\nexport function createResponsiveTheme(\n options: CreateResponsiveThemeOptions,\n): Theme {\n const { themeOptions, responsiveFontSizesOptions } = options\n let theme = createTheme(themeOptions)\n addShadeVariants(theme.palette.tertiary, theme.palette.tonalOffset)\n addShadeVariants(theme.palette.surface, theme.palette.tonalOffset)\n // `tint` is deliberately absent from BOTH shade passes (AGL-1244). It is a\n // group of string leaves rather than a PaletteColor — no `main` to ramp\n // from, no `contrastText` to pair — so `addShadeVariants` would no-op and\n // `ensureAccessibleShades` (which keys off `CONTRAST_TEXT_COLOR_KEYS`) never\n // sees it. Both correct: a 90%-desaturated wash is authored, not derived,\n // and walking it to a text-contrast bar would repaint the fill.\n // Scheme- and AA-aware repair of DERIVED shades only (AGL-1297); explicit\n // palette values pass through byte-identical.\n ensureAccessibleShades(theme, themeOptions?.palette)\n // After the shade repair, because both hover slots start from `dark` and\n // have to see the value that ships.\n ensureHoverShades(theme, themeOptions?.palette)\n\n theme = responsiveFontSizes(theme, {\n // Override to include `xs` and `xl` - default: ['sm', 'md', 'lg']\n breakpoints: ['xs', 'sm', 'md', 'lg', 'xl'],\n // MUI only ramps the variants it ships, so a CUSTOM display variant would\n // keep its desktop size on a phone — `displayXl` at 72px on a 375px\n // screen. Passing `variants` REPLACES MUI's default list, so the defaults\n // are spelled out here and ours appended; drop one and that variant\n // silently stops scaling.\n variants: [...RAMPED_MUI_VARIANTS, ...RAMPED_DISPLAY_VARIANTS],\n ...responsiveFontSizesOptions,\n })\n\n return theme\n}\n\nexport function createResponsiveCssVarTheme(\n light: Theme,\n dark: Theme,\n options?: CssVarsThemeOptions,\n) {\n const { palette: lightPalette, ...lightTheme } = light\n const { palette: darkPalette } = dark\n\n return muiExtendTheme({\n ...lightTheme,\n // Allow setMode() to work by driving the color scheme via a CSS class on\n // <html> instead of the OS-level @media query (the default 'media' selector\n // makes setMode() a no-op because media queries can't be overridden in JS).\n colorSchemeSelector: 'class',\n ...options,\n colorSchemes: {\n ...options?.colorSchemes,\n light: { palette: lightPalette, ...((options?.colorSchemes?.light ?? {}) as object) },\n dark: { palette: darkPalette, ...((options?.colorSchemes?.dark ?? {}) as object) },\n },\n })\n}\n\nexport default createResponsiveTheme\n"],"names":["extendTheme","muiExtendTheme","alpha","createTheme","darken","getContrastRatio","lighten","responsiveFontSizes","ACCENT_HOVER_FILL","ACCENT_HOVER_TEXT","hoverFillShade","inkOnFill","accessibleShade","contrastRatio","meetsContrast","ContrastText","resolveTonalOffsets","tonalOffset","offsetObj","undefined","offsetNum","light","dark","getContrastTextColor","background","contrastThreshold","addShade","paletteColor","shade","variant","main","tonalOffsetLight","tonalOffsetDark","indexed","hasOwnProperty","contrastText","addShadeVariants","FOREGROUND_COLOR_KEYS","CONTRAST_TEXT_COLOR_KEYS","ensureAccessibleShades","theme","inputPalette","palette","backgrounds","default","paper","filter","length","mode","foregroundDirection","providedColors","key","color","provided","explicit","isForeground","includes","seed","textDirection","ensureHoverShades","hoverOpacity","action","value","Object","entries","wash","map","RAMPED_MUI_VARIANTS","RAMPED_DISPLAY_VARIANTS","createResponsiveTheme","options","themeOptions","responsiveFontSizesOptions","tertiary","surface","breakpoints","variants","createResponsiveCssVarTheme","lightPalette","lightTheme","darkPalette","colorSchemeSelector","colorSchemes"],"mappings":";;AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAEEA,eAAeC,cAAc,QACxB,uBAAsB;AAC7B,SACEC,KAAK,EACLC,WAAW,EACXC,MAAM,EACNC,gBAAgB,EAChBC,OAAO,EAGPC,mBAAmB,QAGd,sBAAkB;AACzB,SACEC,iBAAiB,EACjBC,iBAAiB,EACjBC,cAAc,EACdC,SAAS,QACJ,mBAAe;AACtB,SACEC,eAAe,EACfC,aAAa,EACbC,aAAa,QAER,wBAAoB;AAE3B,IAAA,AAAKC,sCAAAA;;;WAAAA;EAAAA;AAOL,SAASC,oBAAoBC,WAAoC;QAItDC;IAHT,MAAMA,YAAY,OAAOD,gBAAgB,WAAWE,YAAYF;IAChE,MAAMG,YAAY,OAAOH,gBAAgB,WAAWA,cAAcE;IAClE,OAAO;QACLE,KAAK,GAAEH,gBAAAA,6BAAAA,UAAWG,KAAK,oBAAID,qBAApBF,OAAiC;QACxCI,IAAI,WAAEJ,6BAAAA,UAAWI,IAAI,oBAAI,CAACF,oBAAAA,YAAa,OAAO;IAChD;AACF;AAEA,SAASG,qBAAqBC,UAAkB,EAAEC,iBAAyB;IACzE,OAAOpB,iBAAiBmB,2BAAmCC,4BAAAA,oBAAqB;AAGlF;AACA,SAASC,SAASC,YAA0B,EAAEC,KAAa,EAAEC,OAA2B,EAAEZ,WAAwB;IAChH,yEAAyE;IACzE,IAAI,EAACU,gCAAAA,aAAcG,IAAI,GAAE;IACzB,MAAM,EAAET,OAAOU,gBAAgB,EAAET,MAAMU,eAAe,EAAE,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BiC,OAAO;QACjC,kEAAkE;QAClEmC,aAAa;YAAC;YAAM;YAAM;YAAM;YAAM;SAAK;QAC3C,0EAA0E;QAC1E,oEAAoE;QACpE,0EAA0E;QAC1E,oEAAoE;QACpE,0BAA0B;QAC1BC,UAAU;eAAIT;eAAwBC;SAAwB;OAC3DI;IAGL,OAAOhC;AACT;AAEA,OAAO,SAASqC,4BACdxD,KAAY,EACZC,IAAW,EACXgD,OAA6B;;QAcYA,uBACFA;IAbvC,MAAM,EAAE5B,SAASoC,YAAY,EAAiB,GAAGzD,OAAf0D,8CAAe1D;;;IACjD,MAAM,EAAEqB,SAASsC,WAAW,EAAE,GAAG1D;IAEjC,OAAOrB,eAAe,aACjB8E;QACH,yEAAyE;QACzE,4EAA4E;QAC5E,4EAA4E;QAC5EE,qBAAqB;OAClBX;QACHY,cAAc,aACTZ,2BAAAA,QAASY,YAAY;YACxB7D,OAAO;gBAAEqB,SAASoC;uBAAmBR,4BAAAA,wBAAAA,QAASY,YAAY,qBAArBZ,sBAAuBjD,KAAK,mBAAI,CAAC;YACtEC,MAAM;gBAAEoB,SAASsC;wBAAkBV,4BAAAA,yBAAAA,QAASY,YAAY,qBAArBZ,uBAAuBhD,IAAI,oBAAI,CAAC;;;AAGzE;AAEA,eAAe+C,sBAAqB"}
|
package/src/vendor/mui.d.ts
CHANGED
|
@@ -136,6 +136,31 @@ declare module '@mui/material/styles' {
|
|
|
136
136
|
secondary: string;
|
|
137
137
|
tertiary: string;
|
|
138
138
|
}
|
|
139
|
+
/**
|
|
140
|
+
* A color's two HOVER shades (AGL-3465), read by the `MuiButton` and
|
|
141
|
+
* `MuiFab` overrides — `ACCENT_HOVER_FILL` and `ACCENT_HOVER_TEXT` in
|
|
142
|
+
* `util/accent-text.ts`.
|
|
143
|
+
*
|
|
144
|
+
* - `hover` — the fill a contained Button or a Fab takes on hover,
|
|
145
|
+
* carrying `contrastText` at AA. Not `dark`: that slot is the accent
|
|
146
|
+
* rendered as TEXT, lighter than `main` in a dark scheme, and a light
|
|
147
|
+
* label on it disappears.
|
|
148
|
+
* - `hoverText` — the label of a hovered text or outlined Button: `dark`,
|
|
149
|
+
* walked until it clears AA on MUI's hover wash as well as on the bare
|
|
150
|
+
* page and paper.
|
|
151
|
+
*
|
|
152
|
+
* `createResponsiveTheme` derives both, which is why they are optional on
|
|
153
|
+
* each side: a theme built with plain `createTheme` has neither, and an
|
|
154
|
+
* author may set one.
|
|
155
|
+
*/
|
|
156
|
+
interface PaletteColor {
|
|
157
|
+
hover?: string;
|
|
158
|
+
hoverText?: string;
|
|
159
|
+
}
|
|
160
|
+
interface SimplePaletteColorOptions {
|
|
161
|
+
hover?: string;
|
|
162
|
+
hoverText?: string;
|
|
163
|
+
}
|
|
139
164
|
/**
|
|
140
165
|
* START EXAMPLE – MODULE AUGMENTATION ↓
|
|
141
166
|
* ⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄
|
package/src/vendor/mui.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../libs/shared/ui/theme/src/vendor/mui.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Theme as MuiTheme } from '@mui/material/styles'\nimport type {\n Color as MuiColor,\n CssVarsTheme,\n CSSProperties,\n Shadows,\n} from '@mui/material/styles'\n// import type { ExtraColorOptions } from '@mui/material/styles/createPalette'\n// import type { WithStyles } from '@mui/styles'\n// import type { ClassKeyInferable } from '@mui/styles/withStyles'\nimport type { ColorPropOverrides, IActionStates } from '../lib/theme.types'\n// import type {ContainerTypeMap} from '@mui/material/Container'\n\n// _____ _______ ____ ____ ___ ____ _____ ____\n// / _ \\ \\ / / ____| _ \\| _ \\|_ _| _ \\| ____/ ___|\n// | | | \\ \\ / /| _| | |_) | |_) || || | | | _| \\___ \\\n// | |_| |\\ V / | |___| _ <| _ < | || |_| | |___ ___) |\n// \\___/ \\_/ |_____|_| \\_\\_| \\_\\___|____/|_____|____/\n\ndeclare module '@mui/material/Button' {\n interface ButtonPropsColorOverrides extends ColorPropOverrides {}\n}\ndeclare module '@mui/material/ButtonGroup' {\n interface ButtonGroupPropsColorOverrides extends ColorPropOverrides {}\n}\ndeclare module '@mui/material/Container' {\n interface ContainerOwnProps {\n variant?: 'vertical' | 'horizontal' | 'boxed'\n }\n}\n/**\n * `<Typography variant=\"lede\">` and its two siblings (AGL-1308).\n *\n * The `TypographyVariants` augmentation further down puts the three variants\n * on the THEME; this is what lets a component ASK for one. Declaring the theme\n * side alone is the half-fix that compiles the theme and then rejects every\n * use of it — the same trap `TypographyVariantsOptions` without\n * `TypographyVariants` sets, one level up.\n */\ndeclare module '@mui/material/Typography' {\n interface TypographyPropsVariantOverrides {\n lede: true\n bodyCompact: true\n micro: true\n displayXl: true\n }\n}\ndeclare module '@mui/material/ToggleButtonGroup' {\n interface ToggleButtonGroupPropsColorOverrides extends ColorPropOverrides {}\n}\ndeclare module '@mui/material/Fab' {\n interface FabPropsColorOverrides extends ColorPropOverrides {}\n}\ndeclare module '@mui/material/SvgIcon' {\n interface SvgIconPropsColorOverrides extends ColorPropOverrides {}\n}\ndeclare module '@mui/material/AppBar' {\n interface AppBarPropsColorOverrides extends ColorPropOverrides {\n surface: true\n }\n}\ndeclare module '@mui/material/Chip' {\n interface ChipPropsColorOverrides extends ColorPropOverrides {}\n}\ndeclare module '@mui/material/IconButton' {\n // Was `AppBarPropsColorOverrides` — a copy-paste from the block above, so\n // this augmented nothing and IconButton never accepted `tertiary`.\n interface IconButtonPropsColorOverrides extends ColorPropOverrides {}\n}\ndeclare module '@mui/material/Tabs' {\n interface TabsPropsIndicatorColorOverrides extends ColorPropOverrides {}\n}\n// Tertiary everywhere primary and secondary are (AGL-3411). Each of these\n// already renders any palette color with a `main` — MUI builds their color\n// styles from the palette's entries — so tertiary worked at runtime and was\n// only refused by the types.\ndeclare module '@mui/material/Checkbox' {\n interface CheckboxPropsColorOverrides extends ColorPropOverrides {}\n}\ndeclare module '@mui/material/Radio' {\n interface RadioPropsColorOverrides extends ColorPropOverrides {}\n}\ndeclare module '@mui/material/Switch' {\n interface SwitchPropsColorOverrides extends ColorPropOverrides {}\n}\ndeclare module '@mui/material/Slider' {\n interface SliderPropsColorOverrides extends ColorPropOverrides {}\n}\ndeclare module '@mui/material/Badge' {\n interface BadgePropsColorOverrides extends ColorPropOverrides {}\n}\ndeclare module '@mui/material/CircularProgress' {\n interface CircularProgressPropsColorOverrides extends ColorPropOverrides {}\n}\ndeclare module '@mui/material/LinearProgress' {\n interface LinearProgressPropsColorOverrides extends ColorPropOverrides {}\n}\ndeclare module '@mui/material/Pagination' {\n interface PaginationPropsColorOverrides extends ColorPropOverrides {}\n}\ndeclare module '@mui/material/PaginationItem' {\n interface PaginationItemPropsColorOverrides extends ColorPropOverrides {}\n}\ndeclare module '@mui/system' {\n interface Shape {\n appIconBorderRadius: number | string\n }\n}\ndeclare module '@mui/material/styles' {\n type ExtraColor = Palette['primary']\n type ExtraColorOptions = PaletteOptions['primary']\n\n /**\n * Pale accent washes used as SURFACES (AGL-1244) — `tint.primary`,\n * `tint.secondary`, `tint.tertiary`.\n *\n * A group of string leaves like `background` and `text`, NOT a\n * `PaletteColor`: there is no ramp to walk and no `contrastText`, because a\n * tint is never a component `color` — the ink on it is the accent token the\n * tile's icon already uses. That is also why `tint` is absent from\n * `ColorPropOverrides`: `<Button color=\"tint\">` would have no foreground to\n * pair with and must stay a type error.\n */\n interface PaletteTint {\n primary: string\n secondary: string\n tertiary: string\n }\n\n /**\n * START EXAMPLE – MODULE AUGMENTATION ↓\n * ⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄\n * ```typescript\n * // Add new property ↓\n * declare module '@mui/material/styles' {\n * interface Theme {\n * status: {\n * danger: React.CSSProperties['color'],\n * }\n * }\n * interface ThemeOptions {\n * status: {\n * danger: React.CSSProperties['color']\n * }\n * }\n * }\n * const theme = createMuiTheme({\n * status: {\n * danger: '#e53e3e',\n * },\n * })\n *\n * // Add to existing property (e.g., palette, typography) ↓\n * declare module \"@mui/material/styles\" {\n * interface Palette {\n * neutral: Palette['primary']\n * }\n * interface PaletteOptions {\n * neutral: PaletteOptions['primary']\n * }\n * }\n * const theme = createMuiTheme({\n * palette: {\n * neutral: {\n * main: '#5c6ac4',\n * },\n * },\n * })\n * ```\n * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n * END EXAMPLE – MODULE AUGMENTATION ↑\n */\n\n /**\n * The resting border of an outlined input.\n *\n * A token because MUI has none: `OutlinedInput` hardcodes\n * `rgba(0, 0, 0, 0.23)` / `rgba(255, 255, 255, 0.23)` inside its own\n * styles, so there is nothing on the theme to read. Anything that has to\n * draw an input BESIDE a MUI one — Stripe Elements, which paints its fields\n * inside a cross-origin iframe from an `appearance` object we hand it — can\n * otherwise only match by copying those literals, and the copy silently\n * stops matching the first time the scheme moves.\n *\n * Deliberately NOT `divider` (`rgba(0, 0, 0, 0.12)`): half the weight, so a\n * field drawn with it reads as a different, lighter control sitting next to\n * ours — which is precisely the mismatch this token exists to prevent.\n *\n * A string leaf like `background` and `text`, not a `PaletteColor`: there is\n * no ramp and no `contrastText`, because nothing is ever drawn ON it.\n */\n interface PaletteOptions {\n background?: PaletteOptions['background']\n tertiary?: ExtraColorOptions\n surface?: ExtraColorOptions\n tint?: Partial<PaletteTint>\n inputOutline?: string\n svgBackground?: IActionStates\n svgFilled?: IActionStates\n svgStroke?: IActionStates\n text?: PaletteOptions['text']\n }\n\n interface TypeBackground {}\n\n interface Palette {\n background: Palette['background']\n tertiary: ExtraColor\n surface: ExtraColor\n inputOutline: string\n tint: PaletteTint\n svgBackground: IActionStates\n svgFilled: IActionStates\n svgStroke: IActionStates\n text: Palette['text']\n }\n\n /**\n * The brand's extra rungs on the font-weight scale (AGL-1308).\n *\n * MUI ships four — `fontWeightLight/Regular/Medium/Bold` — and the brand\n * adds three above them: 600, 800 and 900, all real weights because Roboto\n * Flex is a variable face covering 100–1000. Declaring them here is what\n * makes `createTheme({ typography: { fontWeightSemiBold: 600 } })` compile;\n * without the augmentation `TypographyVariantsOptions` is a closed shape and\n * the theme itself does not typecheck.\n *\n * They are reachable the way the built-ins are: `@mui/system`'s `style()`\n * retries a miss as `${prop}${capitalize(value)}`, so `fontWeight: 'black'`\n * resolves to `typography.fontWeightBlack`.\n *\n * BOTH interfaces, and that is not belt-and-braces. `TypographyVariantsOptions`\n * is what `createTheme` ACCEPTS and `TypographyVariants` is what the resolved\n * `theme.typography` HANDS BACK — augmenting only the first compiles the\n * theme and then fails every reader, which is the shape this was in.\n *\n * Optional on the options side, required on the resolved side: an override\n * may omit it (MUI merges the default in), a reader may not have to check.\n *\n * ## And the SCALE variants\n *\n * `displayXl` is the rung ABOVE `h1`. The brand's display ramp tops out at\n * h1's 56px, so a marketing hero drawn at 72px had no token to ask for and\n * hand-wrote the pixels — which then lost to the variant's own responsive\n * ramp. One rung, not two: h1 already IS the 56px display size, and a\n * second name for it would leave two tokens to keep in step.\n *\n * `lede`, `bodyCompact` and `micro` — 17px, 13px and 11px with their line\n * heights — exist because the built pages kept reaching for those sizes and,\n * with nothing to ask for, wrote the pixels: /press alone carried 286 such\n * literals. Full variant objects rather than bare sizes, so one pick brings\n * the line height with it. Named for the JOB rather than the number, so the\n * name survives a retune: a lede stays the lede if the brand moves it to\n * 18px. `@mui/material/Typography` is augmented separately, above, so a\n * component can ASK for one.\n *\n * ⚑ Declared in THIS file rather than beside the values in\n * `console.theme.ts`, because module augmentation belongs with the rest of\n * the vendor augmentations — and putting it here is what let it be added\n * without touching a file another session was editing at the time.\n */\n interface TypographyVariantsOptions {\n fontWeightSemiBold?: number\n fontWeightExtraBold?: number\n fontWeightBlack?: number\n lede?: CSSProperties\n bodyCompact?: CSSProperties\n micro?: CSSProperties\n displayXl?: CSSProperties\n }\n\n interface TypographyVariants {\n fontWeightSemiBold: number\n fontWeightExtraBold: number\n fontWeightBlack: number\n lede: CSSProperties\n bodyCompact: CSSProperties\n micro: CSSProperties\n displayXl: CSSProperties\n }\n\n interface ZIndex {\n max: number\n min: number\n }\n\n interface Mixins {\n menuArrow: CSSProperties\n }\n\n interface ThemeOptions {\n shadowsInset?: Shadows\n }\n\n interface Theme {\n palette: Palette\n shadowsInset: Shadows\n }\n\n interface Theme {\n // CssVarsTheme['vars'] supplies the members MUI requires on vars (font,\n // opacity, overlays, …); the Omit layers our theme augmentations on top.\n vars: CssVarsTheme['vars'] &\n Omit<\n Theme,\n 'typography' | 'mixins' | 'breakpoints' | 'direction' | 'transitions' | 'vars'\n >\n }\n\n interface DefaultTheme extends Theme {}\n\n // type ExtendPropsOfWithStyles<\n // P extends { classes?: ClassNameMap<string> },\n // StylesType extends ClassKeyInferable<any, any>,\n // IncludeTheme extends boolean | undefined = false\n // > = P & WithStyles<StylesType, IncludeTheme>\n}\n\ndeclare module '@mui/styles' {\n interface DefaultTheme extends MuiTheme {}\n}\n\n// _______ ______ ___ ____ _____ ____\n// | ____\\ \\/ / _ \\ / _ \\| _ \\_ _/ ___|\n// | _| \\ /| |_) | | | | |_) || | \\___ \\\n// | |___ / \\| __/| |_| | _ < | | ___) |\n// |_____/_/\\_\\_| \\___/|_| \\_\\|_| |____/\n\nexport type { Overwrite } from '@mui/types'\n\nexport {\n type ShapeOptions,\n type Spacing,\n type SpacingOptions,\n type MuiStyledOptions,\n type SxProps,\n type BoxProps,\n} from '@mui/system'\n\nexport { darkScrollbar } from '@mui/material'\nexport { visuallyHidden } from '@mui/utils'\n\nexport {\n type Breakpoint,\n type BreakpointOverrides,\n type Breakpoints,\n type BreakpointsOptions,\n type ClassNameMap,\n type ColorFormat,\n type ColorObject,\n type ComponentsOverrides,\n type ComponentsProps,\n type ComponentsPropsList,\n type ComponentsVariants,\n type CreateMUIStyled,\n type CSSObject,\n type Direction,\n type Duration,\n type Easing,\n // type ExtendPropsOfWithStyles,\n type Palette,\n type PaletteColor,\n type PaletteColorOptions,\n type PaletteOptions,\n type SimplePaletteColorOptions,\n type StyledComponentProps,\n type Theme,\n type ThemedProps,\n type ThemeOptions,\n type ThemeWithProps,\n type Transitions,\n type TransitionsOptions,\n type TypographyStyle,\n type TypographyVariant,\n type TypographyVariants,\n type TypographyVariantsOptions,\n alpha,\n createTheme,\n darken,\n decomposeColor,\n easing,\n emphasize,\n getContrastRatio,\n getLuminance,\n hexToRgb,\n hslToRgb,\n lighten,\n recomposeColor,\n responsiveFontSizes,\n rgbToHex,\n styled,\n StyledEngineProvider,\n ThemeProvider,\n useTheme,\n useThemeProps,\n experimental_sx as sx,\n getInitColorSchemeScript,\n} from '@mui/material/styles'\n\nexport type ColorPartial = Partial<MuiColor>\nexport {\n type CommonColors,\n type TypeBackground,\n type TypeText,\n type Shadows,\n} from '@mui/material/styles'\n\n// export { type ClassKeyInferable, type CreateCSSProperties } from '@mui/styles/withStyles'\n\nexport { type Shape } from '@mui/system'\n\n// The VALUE half of this block is NOT re-exported (AGL-2682). `getThemeProps`,\n// `jssPreset`, `StylesContext`, `StylesProvider`, `useThemeVariants`,\n// `withThemeCreator`, `makeStyles`, `withStyles` and `createStyles` had no\n// reader anywhere in the repo, and a value re-export is a RUNTIME edge: it put\n// `@mui/styles` — MUI v4's deprecated JSS engine, and the `jss` tree under it —\n// inside the reachable set of every file that takes anything at all from this\n// barrel, which on the tenant is every published customer page. The one real\n// consumer of any of them, `shared-ui-jsx`'s `sandbox-frame.tsx`, imports\n// `jssPreset` and `StylesProvider` from `@mui/styles` directly; that is the\n// pattern to copy if a value is needed again.\n//\n// The types stay exactly as they were. `export type` is erased at compile time\n// and carries no edge, so nothing a consumer writes has to change.\nexport type {\n BaseCreateCSSProperties,\n BaseCSSProperties,\n CSSProperties,\n ServerStyleSheets,\n StyledProps,\n StyleRules,\n StyleRulesCallback,\n Styles,\n StylesOptions,\n StylesProviderProps,\n ThemedComponentProps,\n ThemeOfStyles,\n ThemeProviderProps,\n WithStyles,\n WithStylesOptions,\n WithTheme,\n WithThemeCreatorOption,\n} from '@mui/styles'\n"],"names":["darkScrollbar","visuallyHidden","alpha","createTheme","darken","decomposeColor","easing","emphasize","getContrastRatio","getLuminance","hexToRgb","hslToRgb","lighten","recomposeColor","responsiveFontSizes","rgbToHex","styled","StyledEngineProvider","ThemeProvider","useTheme","useThemeProps","experimental_sx","sx","getInitColorSchemeScript"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAqVD,SAASA,aAAa,QAAQ,gBAAe;AAC7C,SAASC,cAAc,QAAQ,aAAY;AAE3C,SAkCEC,KAAK,EACLC,WAAW,EACXC,MAAM,EACNC,cAAc,EACdC,MAAM,EACNC,SAAS,EACTC,gBAAgB,EAChBC,YAAY,EACZC,QAAQ,EACRC,QAAQ,EACRC,OAAO,EACPC,cAAc,EACdC,mBAAmB,EACnBC,QAAQ,EACRC,MAAM,EACNC,oBAAoB,EACpBC,aAAa,EACbC,QAAQ,EACRC,aAAa,EACbC,mBAAmBC,EAAE,EACrBC,wBAAwB,QACnB,uBAAsB"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/shared/ui/theme/src/vendor/mui.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Theme as MuiTheme } from '@mui/material/styles'\nimport type {\n Color as MuiColor,\n CssVarsTheme,\n CSSProperties,\n Shadows,\n} from '@mui/material/styles'\n// import type { ExtraColorOptions } from '@mui/material/styles/createPalette'\n// import type { WithStyles } from '@mui/styles'\n// import type { ClassKeyInferable } from '@mui/styles/withStyles'\nimport type { ColorPropOverrides, IActionStates } from '../lib/theme.types'\n// import type {ContainerTypeMap} from '@mui/material/Container'\n\n// _____ _______ ____ ____ ___ ____ _____ ____\n// / _ \\ \\ / / ____| _ \\| _ \\|_ _| _ \\| ____/ ___|\n// | | | \\ \\ / /| _| | |_) | |_) || || | | | _| \\___ \\\n// | |_| |\\ V / | |___| _ <| _ < | || |_| | |___ ___) |\n// \\___/ \\_/ |_____|_| \\_\\_| \\_\\___|____/|_____|____/\n\ndeclare module '@mui/material/Button' {\n interface ButtonPropsColorOverrides extends ColorPropOverrides {}\n}\ndeclare module '@mui/material/ButtonGroup' {\n interface ButtonGroupPropsColorOverrides extends ColorPropOverrides {}\n}\ndeclare module '@mui/material/Container' {\n interface ContainerOwnProps {\n variant?: 'vertical' | 'horizontal' | 'boxed'\n }\n}\n/**\n * `<Typography variant=\"lede\">` and its two siblings (AGL-1308).\n *\n * The `TypographyVariants` augmentation further down puts the three variants\n * on the THEME; this is what lets a component ASK for one. Declaring the theme\n * side alone is the half-fix that compiles the theme and then rejects every\n * use of it — the same trap `TypographyVariantsOptions` without\n * `TypographyVariants` sets, one level up.\n */\ndeclare module '@mui/material/Typography' {\n interface TypographyPropsVariantOverrides {\n lede: true\n bodyCompact: true\n micro: true\n displayXl: true\n }\n}\ndeclare module '@mui/material/ToggleButtonGroup' {\n interface ToggleButtonGroupPropsColorOverrides extends ColorPropOverrides {}\n}\ndeclare module '@mui/material/Fab' {\n interface FabPropsColorOverrides extends ColorPropOverrides {}\n}\ndeclare module '@mui/material/SvgIcon' {\n interface SvgIconPropsColorOverrides extends ColorPropOverrides {}\n}\ndeclare module '@mui/material/AppBar' {\n interface AppBarPropsColorOverrides extends ColorPropOverrides {\n surface: true\n }\n}\ndeclare module '@mui/material/Chip' {\n interface ChipPropsColorOverrides extends ColorPropOverrides {}\n}\ndeclare module '@mui/material/IconButton' {\n // Was `AppBarPropsColorOverrides` — a copy-paste from the block above, so\n // this augmented nothing and IconButton never accepted `tertiary`.\n interface IconButtonPropsColorOverrides extends ColorPropOverrides {}\n}\ndeclare module '@mui/material/Tabs' {\n interface TabsPropsIndicatorColorOverrides extends ColorPropOverrides {}\n}\n// Tertiary everywhere primary and secondary are (AGL-3411). Each of these\n// already renders any palette color with a `main` — MUI builds their color\n// styles from the palette's entries — so tertiary worked at runtime and was\n// only refused by the types.\ndeclare module '@mui/material/Checkbox' {\n interface CheckboxPropsColorOverrides extends ColorPropOverrides {}\n}\ndeclare module '@mui/material/Radio' {\n interface RadioPropsColorOverrides extends ColorPropOverrides {}\n}\ndeclare module '@mui/material/Switch' {\n interface SwitchPropsColorOverrides extends ColorPropOverrides {}\n}\ndeclare module '@mui/material/Slider' {\n interface SliderPropsColorOverrides extends ColorPropOverrides {}\n}\ndeclare module '@mui/material/Badge' {\n interface BadgePropsColorOverrides extends ColorPropOverrides {}\n}\ndeclare module '@mui/material/CircularProgress' {\n interface CircularProgressPropsColorOverrides extends ColorPropOverrides {}\n}\ndeclare module '@mui/material/LinearProgress' {\n interface LinearProgressPropsColorOverrides extends ColorPropOverrides {}\n}\ndeclare module '@mui/material/Pagination' {\n interface PaginationPropsColorOverrides extends ColorPropOverrides {}\n}\ndeclare module '@mui/material/PaginationItem' {\n interface PaginationItemPropsColorOverrides extends ColorPropOverrides {}\n}\ndeclare module '@mui/system' {\n interface Shape {\n appIconBorderRadius: number | string\n }\n}\ndeclare module '@mui/material/styles' {\n type ExtraColor = Palette['primary']\n type ExtraColorOptions = PaletteOptions['primary']\n\n /**\n * Pale accent washes used as SURFACES (AGL-1244) — `tint.primary`,\n * `tint.secondary`, `tint.tertiary`.\n *\n * A group of string leaves like `background` and `text`, NOT a\n * `PaletteColor`: there is no ramp to walk and no `contrastText`, because a\n * tint is never a component `color` — the ink on it is the accent token the\n * tile's icon already uses. That is also why `tint` is absent from\n * `ColorPropOverrides`: `<Button color=\"tint\">` would have no foreground to\n * pair with and must stay a type error.\n */\n interface PaletteTint {\n primary: string\n secondary: string\n tertiary: string\n }\n\n /**\n * A color's two HOVER shades (AGL-3465), read by the `MuiButton` and\n * `MuiFab` overrides — `ACCENT_HOVER_FILL` and `ACCENT_HOVER_TEXT` in\n * `util/accent-text.ts`.\n *\n * - `hover` — the fill a contained Button or a Fab takes on hover,\n * carrying `contrastText` at AA. Not `dark`: that slot is the accent\n * rendered as TEXT, lighter than `main` in a dark scheme, and a light\n * label on it disappears.\n * - `hoverText` — the label of a hovered text or outlined Button: `dark`,\n * walked until it clears AA on MUI's hover wash as well as on the bare\n * page and paper.\n *\n * `createResponsiveTheme` derives both, which is why they are optional on\n * each side: a theme built with plain `createTheme` has neither, and an\n * author may set one.\n */\n interface PaletteColor {\n hover?: string\n hoverText?: string\n }\n interface SimplePaletteColorOptions {\n hover?: string\n hoverText?: string\n }\n\n /**\n * START EXAMPLE – MODULE AUGMENTATION ↓\n * ⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄\n * ```typescript\n * // Add new property ↓\n * declare module '@mui/material/styles' {\n * interface Theme {\n * status: {\n * danger: React.CSSProperties['color'],\n * }\n * }\n * interface ThemeOptions {\n * status: {\n * danger: React.CSSProperties['color']\n * }\n * }\n * }\n * const theme = createMuiTheme({\n * status: {\n * danger: '#e53e3e',\n * },\n * })\n *\n * // Add to existing property (e.g., palette, typography) ↓\n * declare module \"@mui/material/styles\" {\n * interface Palette {\n * neutral: Palette['primary']\n * }\n * interface PaletteOptions {\n * neutral: PaletteOptions['primary']\n * }\n * }\n * const theme = createMuiTheme({\n * palette: {\n * neutral: {\n * main: '#5c6ac4',\n * },\n * },\n * })\n * ```\n * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n * END EXAMPLE – MODULE AUGMENTATION ↑\n */\n\n /**\n * The resting border of an outlined input.\n *\n * A token because MUI has none: `OutlinedInput` hardcodes\n * `rgba(0, 0, 0, 0.23)` / `rgba(255, 255, 255, 0.23)` inside its own\n * styles, so there is nothing on the theme to read. Anything that has to\n * draw an input BESIDE a MUI one — Stripe Elements, which paints its fields\n * inside a cross-origin iframe from an `appearance` object we hand it — can\n * otherwise only match by copying those literals, and the copy silently\n * stops matching the first time the scheme moves.\n *\n * Deliberately NOT `divider` (`rgba(0, 0, 0, 0.12)`): half the weight, so a\n * field drawn with it reads as a different, lighter control sitting next to\n * ours — which is precisely the mismatch this token exists to prevent.\n *\n * A string leaf like `background` and `text`, not a `PaletteColor`: there is\n * no ramp and no `contrastText`, because nothing is ever drawn ON it.\n */\n interface PaletteOptions {\n background?: PaletteOptions['background']\n tertiary?: ExtraColorOptions\n surface?: ExtraColorOptions\n tint?: Partial<PaletteTint>\n inputOutline?: string\n svgBackground?: IActionStates\n svgFilled?: IActionStates\n svgStroke?: IActionStates\n text?: PaletteOptions['text']\n }\n\n interface TypeBackground {}\n\n interface Palette {\n background: Palette['background']\n tertiary: ExtraColor\n surface: ExtraColor\n inputOutline: string\n tint: PaletteTint\n svgBackground: IActionStates\n svgFilled: IActionStates\n svgStroke: IActionStates\n text: Palette['text']\n }\n\n /**\n * The brand's extra rungs on the font-weight scale (AGL-1308).\n *\n * MUI ships four — `fontWeightLight/Regular/Medium/Bold` — and the brand\n * adds three above them: 600, 800 and 900, all real weights because Roboto\n * Flex is a variable face covering 100–1000. Declaring them here is what\n * makes `createTheme({ typography: { fontWeightSemiBold: 600 } })` compile;\n * without the augmentation `TypographyVariantsOptions` is a closed shape and\n * the theme itself does not typecheck.\n *\n * They are reachable the way the built-ins are: `@mui/system`'s `style()`\n * retries a miss as `${prop}${capitalize(value)}`, so `fontWeight: 'black'`\n * resolves to `typography.fontWeightBlack`.\n *\n * BOTH interfaces, and that is not belt-and-braces. `TypographyVariantsOptions`\n * is what `createTheme` ACCEPTS and `TypographyVariants` is what the resolved\n * `theme.typography` HANDS BACK — augmenting only the first compiles the\n * theme and then fails every reader, which is the shape this was in.\n *\n * Optional on the options side, required on the resolved side: an override\n * may omit it (MUI merges the default in), a reader may not have to check.\n *\n * ## And the SCALE variants\n *\n * `displayXl` is the rung ABOVE `h1`. The brand's display ramp tops out at\n * h1's 56px, so a marketing hero drawn at 72px had no token to ask for and\n * hand-wrote the pixels — which then lost to the variant's own responsive\n * ramp. One rung, not two: h1 already IS the 56px display size, and a\n * second name for it would leave two tokens to keep in step.\n *\n * `lede`, `bodyCompact` and `micro` — 17px, 13px and 11px with their line\n * heights — exist because the built pages kept reaching for those sizes and,\n * with nothing to ask for, wrote the pixels: /press alone carried 286 such\n * literals. Full variant objects rather than bare sizes, so one pick brings\n * the line height with it. Named for the JOB rather than the number, so the\n * name survives a retune: a lede stays the lede if the brand moves it to\n * 18px. `@mui/material/Typography` is augmented separately, above, so a\n * component can ASK for one.\n *\n * ⚑ Declared in THIS file rather than beside the values in\n * `console.theme.ts`, because module augmentation belongs with the rest of\n * the vendor augmentations — and putting it here is what let it be added\n * without touching a file another session was editing at the time.\n */\n interface TypographyVariantsOptions {\n fontWeightSemiBold?: number\n fontWeightExtraBold?: number\n fontWeightBlack?: number\n lede?: CSSProperties\n bodyCompact?: CSSProperties\n micro?: CSSProperties\n displayXl?: CSSProperties\n }\n\n interface TypographyVariants {\n fontWeightSemiBold: number\n fontWeightExtraBold: number\n fontWeightBlack: number\n lede: CSSProperties\n bodyCompact: CSSProperties\n micro: CSSProperties\n displayXl: CSSProperties\n }\n\n interface ZIndex {\n max: number\n min: number\n }\n\n interface Mixins {\n menuArrow: CSSProperties\n }\n\n interface ThemeOptions {\n shadowsInset?: Shadows\n }\n\n interface Theme {\n palette: Palette\n shadowsInset: Shadows\n }\n\n interface Theme {\n // CssVarsTheme['vars'] supplies the members MUI requires on vars (font,\n // opacity, overlays, …); the Omit layers our theme augmentations on top.\n vars: CssVarsTheme['vars'] &\n Omit<\n Theme,\n 'typography' | 'mixins' | 'breakpoints' | 'direction' | 'transitions' | 'vars'\n >\n }\n\n interface DefaultTheme extends Theme {}\n\n // type ExtendPropsOfWithStyles<\n // P extends { classes?: ClassNameMap<string> },\n // StylesType extends ClassKeyInferable<any, any>,\n // IncludeTheme extends boolean | undefined = false\n // > = P & WithStyles<StylesType, IncludeTheme>\n}\n\ndeclare module '@mui/styles' {\n interface DefaultTheme extends MuiTheme {}\n}\n\n// _______ ______ ___ ____ _____ ____\n// | ____\\ \\/ / _ \\ / _ \\| _ \\_ _/ ___|\n// | _| \\ /| |_) | | | | |_) || | \\___ \\\n// | |___ / \\| __/| |_| | _ < | | ___) |\n// |_____/_/\\_\\_| \\___/|_| \\_\\|_| |____/\n\nexport type { Overwrite } from '@mui/types'\n\nexport {\n type ShapeOptions,\n type Spacing,\n type SpacingOptions,\n type MuiStyledOptions,\n type SxProps,\n type BoxProps,\n} from '@mui/system'\n\nexport { darkScrollbar } from '@mui/material'\nexport { visuallyHidden } from '@mui/utils'\n\nexport {\n type Breakpoint,\n type BreakpointOverrides,\n type Breakpoints,\n type BreakpointsOptions,\n type ClassNameMap,\n type ColorFormat,\n type ColorObject,\n type ComponentsOverrides,\n type ComponentsProps,\n type ComponentsPropsList,\n type ComponentsVariants,\n type CreateMUIStyled,\n type CSSObject,\n type Direction,\n type Duration,\n type Easing,\n // type ExtendPropsOfWithStyles,\n type Palette,\n type PaletteColor,\n type PaletteColorOptions,\n type PaletteOptions,\n type SimplePaletteColorOptions,\n type StyledComponentProps,\n type Theme,\n type ThemedProps,\n type ThemeOptions,\n type ThemeWithProps,\n type Transitions,\n type TransitionsOptions,\n type TypographyStyle,\n type TypographyVariant,\n type TypographyVariants,\n type TypographyVariantsOptions,\n alpha,\n createTheme,\n darken,\n decomposeColor,\n easing,\n emphasize,\n getContrastRatio,\n getLuminance,\n hexToRgb,\n hslToRgb,\n lighten,\n recomposeColor,\n responsiveFontSizes,\n rgbToHex,\n styled,\n StyledEngineProvider,\n ThemeProvider,\n useTheme,\n useThemeProps,\n experimental_sx as sx,\n getInitColorSchemeScript,\n} from '@mui/material/styles'\n\nexport type ColorPartial = Partial<MuiColor>\nexport {\n type CommonColors,\n type TypeBackground,\n type TypeText,\n type Shadows,\n} from '@mui/material/styles'\n\n// export { type ClassKeyInferable, type CreateCSSProperties } from '@mui/styles/withStyles'\n\nexport { type Shape } from '@mui/system'\n\n// The VALUE half of this block is NOT re-exported (AGL-2682). `getThemeProps`,\n// `jssPreset`, `StylesContext`, `StylesProvider`, `useThemeVariants`,\n// `withThemeCreator`, `makeStyles`, `withStyles` and `createStyles` had no\n// reader anywhere in the repo, and a value re-export is a RUNTIME edge: it put\n// `@mui/styles` — MUI v4's deprecated JSS engine, and the `jss` tree under it —\n// inside the reachable set of every file that takes anything at all from this\n// barrel, which on the tenant is every published customer page. The one real\n// consumer of any of them, `shared-ui-jsx`'s `sandbox-frame.tsx`, imports\n// `jssPreset` and `StylesProvider` from `@mui/styles` directly; that is the\n// pattern to copy if a value is needed again.\n//\n// The types stay exactly as they were. `export type` is erased at compile time\n// and carries no edge, so nothing a consumer writes has to change.\nexport type {\n BaseCreateCSSProperties,\n BaseCSSProperties,\n CSSProperties,\n ServerStyleSheets,\n StyledProps,\n StyleRules,\n StyleRulesCallback,\n Styles,\n StylesOptions,\n StylesProviderProps,\n ThemedComponentProps,\n ThemeOfStyles,\n ThemeProviderProps,\n WithStyles,\n WithStylesOptions,\n WithTheme,\n WithThemeCreatorOption,\n} from '@mui/styles'\n"],"names":["darkScrollbar","visuallyHidden","alpha","createTheme","darken","decomposeColor","easing","emphasize","getContrastRatio","getLuminance","hexToRgb","hslToRgb","lighten","recomposeColor","responsiveFontSizes","rgbToHex","styled","StyledEngineProvider","ThemeProvider","useTheme","useThemeProps","experimental_sx","sx","getInitColorSchemeScript"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GA+WD,SAASA,aAAa,QAAQ,gBAAe;AAC7C,SAASC,cAAc,QAAQ,aAAY;AAE3C,SAkCEC,KAAK,EACLC,WAAW,EACXC,MAAM,EACNC,cAAc,EACdC,MAAM,EACNC,SAAS,EACTC,gBAAgB,EAChBC,YAAY,EACZC,QAAQ,EACRC,QAAQ,EACRC,OAAO,EACPC,cAAc,EACdC,mBAAmB,EACnBC,QAAQ,EACRC,MAAM,EACNC,oBAAoB,EACpBC,aAAa,EACbC,QAAQ,EACRC,aAAa,EACbC,mBAAmBC,EAAE,EACrBC,wBAAwB,QACnB,uBAAsB"}
|