/** * Shared, reactive read-model of the `` UI preferences * (mode / theme scheme / contrast / animation / consumption / language). * * The `mds-pref-*` controllers remain the sole internal writers/authority: they * publish the resolved state as `pref--` classes on `` (the * global theming contract consumed by the styles package tokens and the * Storybook accessibility menu) plus the standard `lang` attribute for the * language, and mirror the same values into the store. The MutationObservers * below keep the store in sync when external writers touch `` directly. * * Consumers read `preferenceStore.state.` during render: the read * auto-subscribes the component (@stencil/store), which re-renders it on * change. Style off dedicated host attributes with plain * `:host([pref-='...'])` selectors (no `:host-context`). */ type PreferenceName = 'animation' | 'consumption' | 'contrast' | 'mode' | 'theme-scheme'; /** * The corner axis is the one dimension published as an ATTRIBUTE rather than a * class: the shape is cosmetic rather than an accessibility preference, and it * has to be able to deviate on any subtree, which `data-corner-shape` does and a * `pref-*` class on `` does not. `undefined` means no deviation, i.e. the * shape the stylesheet ships (see projects/styles/scripts/corner.ts). */ type AttributePreferenceName = 'corner-shape'; type PreferenceState = Partial> & { language: string; }; /** * The part of the @stencil/store map the components use, written here so that the declaration of * `preferenceStore` names no type of @stencil/store, a devDependency the build bundles and a * consumer does not install (#1360, `nx run stencil:check.public-types`). A member of the map * this file does not list is a member to add here first. */ interface PreferenceStore { /** read during render to subscribe the component, written by the `mds-pref-*` controllers */ readonly state: PreferenceState; /** `cb` runs on every change of `propName`; the function returned unsubscribes it */ onChange(propName: Key, cb: (newValue: PreferenceState[Key]) => void): () => void; } declare const preferenceStore: PreferenceStore; declare const MODE_VALUES: string[]; /** * Where the block of a named theme says the one colour mode it can be used in (#1274): * `COLOR_MODES_PROPERTY` of design-tokens/semantic.model.ts, which prints it into `themes.css` * (projects/styles/SEMANTIC_COLOR_SPEC.md, section 8). A theme for both modes declares nothing. */ declare const COLOR_MODES_PROPERTY = "--magma-color-modes"; /** * The scheme a theme's declared modes lock it to: `light` or `dark` when the value names that one * mode, nothing when it names both, none, or a mode the format does not have (it lists the values * of `color-scheme`, `light` and `dark`). */ declare const lockedSchemeOf: (modes: string) => "light" | "dark" | undefined; /** * Carry the v1 storage keys over to the v2 ones, once, before any controller * reads them. * * v1 called the mode `mdsPrefTheme` and the named theme `mdsPrefThemeName`; v2 * calls them `mdsPrefMode` and `mdsPrefTheme`. The key `mdsPrefTheme` exists in * both with a different meaning, so it has to be moved before `mds-pref-theme` * reads it: a v1 `dark` read as a theme name would be applied as a theme, and * the v1 mode would be lost. A mode value cannot be a theme name * (`mds-pref-theme` rejects the three), which is what tells the two apart. It * runs here, at module load, because the controllers load in no fixed order. */ declare const migrateLegacyPreferenceStorage: (storage: Storage) => void; /** * Whether motion should be held back right now: the explicit `reduce` choice, or the OS * preference when the choice is `system` and when no controller has published one at all. * * The stylesheets read the same three cases through `:host([pref-animation])`, but a * stylesheet can only hold back what CSS drives. An animation written in JS - a GSAP * timeline, a rAF loop, a tween of an attribute - has to ask for itself, and until it does * the preference is only half kept. */ declare const prefersReducedMotion: () => boolean; export { COLOR_MODES_PROPERTY, MODE_VALUES, lockedSchemeOf, migrateLegacyPreferenceStorage, preferenceStore, prefersReducedMotion, };