|
| 1 | +# HEAD |
| 2 | + |
| 3 | +This version introduces some major modernization changes around CSS and drops browser support for XXXX ( to be defined before V23 is published). |
| 4 | + |
| 5 | +The good news is we don't expect any visible changes in modern browsers and you should be able to do some automated visual regression testing to help with the migration. |
| 6 | + |
| 7 | +Introducing theme variables! CSS variables beginning with `--theme-` will adjust based on media queries. |
| 8 | + |
| 9 | + |
| 10 | +## Typography |
| 11 | + |
| 12 | +* Modernization: |
| 13 | + * Default to CSS vars for font family, size, and line-height (#982) |
| 14 | + * Removed `@supports` declarations if they only had font declarations |
| 15 | + * `@include text-body-*` and `@include text-heading-*` mixins use CSS vars now |
| 16 | + * Edited `@mixin font-size()` to stop outputting a pixel fallback |
| 17 | +* Reorganization: |
| 18 | + * Renamed `-title-` to `-heading-` in mixins and CSS vars |
| 19 | + * and `mzp-u-heading-*` utility classes |
| 20 | + * component HTML/CSS classes will follow in a separate PR |
| 21 | + * Added font-family declaration to `@include text-body-*` mixins |
| 22 | + * Added `--theme-` prefix to variables expected to morph |
| 23 | + * Added `--token-` prefix to unchanging variables |
| 24 | + * Re-name font-size tokens to use a scale instead of tshirt sizes for names |
| 25 | + * Added `--theme-button-line-height` var |
| 26 | +* Bug fixes: |
| 27 | + * Moved `@include text-*` to end of declarations |
| 28 | + |
| 29 | +## Color |
| 30 | + |
| 31 | +* To come in follow up PR. |
| 32 | + |
| 33 | +## Migration Tips |
| 34 | + |
| 35 | +See the [Migration Guide](https://protocol.mozilla.org/docs/usage/migration) for automated scripts (VS Code find/replace and terminal commands) to help with these changes. |
| 36 | + |
| 37 | +* Browser support |
| 38 | + * If you require support for older browsers we recommend adding some post-processing to your workflow for CSS variables and font sizes in pixels. |
| 39 | +* Rename typography mixins `text-title-(2xs|3xs|xs|sm|md|lg|xl|2xl)` → `text-heading-$1` |
| 40 | +* Rename utility classes `mzp-u-title-(2xs|3xs|xs|sm|md|lg|xl|2xl)` → `mzp-u-heading-$1` |
| 41 | +* Replace any remaining `text-display-*` usage with the equivalent `text-heading-*` mixin: |
| 42 | + * `text-display-xx([sl])` → `text-heading-2x$1` |
| 43 | + * `text-display-(xs|sm|md|lg|xl)` → `text-heading-$1` |
| 44 | +* Rename CSS variables to use pattern `--theme-<component>-<property>-<scale>`: |
| 45 | + * `--body-font-family` → `--theme-body-font-family` |
| 46 | + * `--title-font-family` → `--theme-heading-font-family` |
| 47 | + * `--body-line-height` → `--theme-body-line-height` |
| 48 | + * `--title-(2xs|3xs|xs|sm|md|lg|xl|2xl)-size` → `--theme-heading-font-size-$1` |
| 49 | + * `--body-(xs|sm|md|lg|xl)-size` → `--theme-body-font-size-$1` |
| 50 | + * `--title-(2xs|3xs|xs|sm|md|lg|xl|2xl)-line-height` → `--theme-heading-line-height-$1` |
| 51 | +* Removed Sass variables (use CSS variables instead): |
| 52 | + * `$title-(2xs|3xs|xs|sm|md|lg|xl|2xl)-size` → `var(--theme-heading-font-size-$1)` |
| 53 | + * `$title-(2xs|3xs|xs|sm|md|lg|xl|2xl)-line-height` → `var(--theme-heading-line-height-$1)` |
| 54 | + * `$body-line-height` → `var(--theme-body-line-height)` |
| 55 | + * `$body-(xs|sm|md|lg|xl)-size` → `var(--theme-body-font-size-$1)` |
| 56 | + * `$body-font-family` → `var(--theme-body-font-family)` |
| 57 | + * `$title-font-family` → `var(--theme-heading-font-family)` |
| 58 | + * `$button-font-family` → `var(--theme-button-font-family)` |
| 59 | + * `$text-body-line-height` → `var(--theme-body-line-height)` |
| 60 | + * `$text-title-line-height` → `var(--theme-heading-line-height)` |
| 61 | + * `$text-display-line-height`→ `var(--theme-body-line-height)` |
| 62 | +* `text-body-*` mixins now declare `font-family`. |
| 63 | + * You can remove any `font-family` declarations from places which use these mixins (unless you don't want the default font). |
| 64 | +* Removed mixins and functions: |
| 65 | + * `type-scale()` function and associated lookup tables |
| 66 | + * `text-body-cta` mixin (use `text-body-md` instead) |
| 67 | +* You can remove `@supports (--css: variables)` blocks that only contain font declarations, as CSS custom properties are now required. |
| 68 | + |
1 | 69 | # 22.0.0 |
2 | 70 |
|
3 | 71 | ## Features |
@@ -200,7 +268,7 @@ stating variables explicitly, like this: |
200 | 268 | @supports (--css: variables) { |
201 | 269 | background-color: var(--background-color-inverse); |
202 | 270 | color: var(--body-text-color-inverse); |
203 | | - line-height: var(--body-line-height); |
| 271 | + line-height: var(--token-body-line-height); |
204 | 272 | } |
205 | 273 | } |
206 | 274 | ``` |
|
0 commit comments