Repository navigation
feat(note): add recipe and tokens - #31729
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| await expect(note).toHaveScreenshot(screenshot(`note-diff`)); | ||
| }); | ||
|
|
||
| test('should render color correctly', async ({ page }) => { |
There was a problem hiding this comment.
Moved to the hue tests
There was a problem hiding this comment.
Moved to the hue tests
ShaneK
left a comment
There was a problem hiding this comment.
Just one small wording nit, otherwise looks good!
| 3. Mode classes (`ion-note.md`, `ion-note.ios`) are no longer supported. <sup>[3](#version-10x-note-mode-classes)</sup> | ||
|
|
||
| <h5 id="version-10x-note-replaced-css-variables">Replaced CSS variables</h5> | ||
|
|
||
| Use the new token structure for global styles, or the corresponding CSS variable for component-specific overrides: | ||
|
|
||
| | Old (9.x) | New token (global) | New CSS variable (component-specific) | | ||
| |---|---|---| | ||
| | `--color` | `IonNote.hue.bold.default.color` | `--ion-note-hue-bold-default-color` | | ||
|
|
||
| > [!NOTE] | ||
| > A note with `hue="subtle"` reads `IonNote.hue.subtle.default.color` for global styles, or `--ion-note-hue-subtle-default-color` for component-specific styles. | ||
|
|
||
| <h5 id="version-10x-note-hue">New <code>hue</code> property and color tokens</h5> | ||
|
|
||
| A new `hue` property selects between vibrant and muted color variants. It defaults to `"bold"`. | ||
|
|
||
| When `color` is set, a bold note now uses the color's `foreground` variant instead of `base`, which is darker so the text stays readable on the page. To revert to the previous appearance, set `IonNote.hue.bold.semantic.default.color` to `var(--ion-color-base)` for global styles, or `--ion-note-hue-bold-semantic-default-color` for component-specific styles. | ||
|
|
||
| When `color` is set, the note color now reads from a token instead of `--ion-color-base` directly. Global overrides should use the theme tokens; component-specific overrides use the corresponding CSS variables: | ||
|
|
||
| | Hue | Token (global) | CSS variable (component-specific) | | ||
| |---|---|---| | ||
| | `bold` | `IonNote.hue.bold.semantic.default.color` | `--ion-note-hue-bold-semantic-default-color` | | ||
| | `subtle` | `IonNote.hue.subtle.semantic.default.color` | `--ion-note-hue-subtle-semantic-default-color` | | ||
|
|
||
| <h5 id="version-10x-note-mode-classes">Mode classes</h5> | ||
|
|
||
| Remove any instances that target the mode classes: `ion-note.md`, `ion-note.ios`. |
There was a problem hiding this comment.
| 3. Mode classes (`ion-note.md`, `ion-note.ios`) are no longer supported. <sup>[3](#version-10x-note-mode-classes)</sup> | |
| <h5 id="version-10x-note-replaced-css-variables">Replaced CSS variables</h5> | |
| Use the new token structure for global styles, or the corresponding CSS variable for component-specific overrides: | |
| | Old (9.x) | New token (global) | New CSS variable (component-specific) | | |
| |---|---|---| | |
| | `--color` | `IonNote.hue.bold.default.color` | `--ion-note-hue-bold-default-color` | | |
| > [!NOTE] | |
| > A note with `hue="subtle"` reads `IonNote.hue.subtle.default.color` for global styles, or `--ion-note-hue-subtle-default-color` for component-specific styles. | |
| <h5 id="version-10x-note-hue">New <code>hue</code> property and color tokens</h5> | |
| A new `hue` property selects between vibrant and muted color variants. It defaults to `"bold"`. | |
| When `color` is set, a bold note now uses the color's `foreground` variant instead of `base`, which is darker so the text stays readable on the page. To revert to the previous appearance, set `IonNote.hue.bold.semantic.default.color` to `var(--ion-color-base)` for global styles, or `--ion-note-hue-bold-semantic-default-color` for component-specific styles. | |
| When `color` is set, the note color now reads from a token instead of `--ion-color-base` directly. Global overrides should use the theme tokens; component-specific overrides use the corresponding CSS variables: | |
| | Hue | Token (global) | CSS variable (component-specific) | | |
| |---|---|---| | |
| | `bold` | `IonNote.hue.bold.semantic.default.color` | `--ion-note-hue-bold-semantic-default-color` | | |
| | `subtle` | `IonNote.hue.subtle.semantic.default.color` | `--ion-note-hue-subtle-semantic-default-color` | | |
| <h5 id="version-10x-note-mode-classes">Mode classes</h5> | |
| Remove any instances that target the mode classes: `ion-note.md`, `ion-note.ios`. | |
| 3. Theme classes (`ion-note.md`, `ion-note.ios`) are no longer supported. <sup>[3](#version-10x-note-theme-classes)</sup> | |
| <h5 id="version-10x-note-replaced-css-variables">Replaced CSS variables</h5> | |
| Use the new token structure for global styles, or the corresponding CSS variable for component-specific overrides: | |
| | Old (9.x) | New token (global) | New CSS variable (component-specific) | | |
| |---|---|---| | |
| | `--color` | `IonNote.hue.bold.default.color` | `--ion-note-hue-bold-default-color` | | |
| > [!NOTE] | |
| > A note with `hue="subtle"` reads `IonNote.hue.subtle.default.color` for global styles, or `--ion-note-hue-subtle-default-color` for component-specific styles. | |
| <h5 id="version-10x-note-hue">New <code>hue</code> property and color tokens</h5> | |
| A new `hue` property selects between vibrant and muted color variants. It defaults to `"bold"`. | |
| When `color` is set, a bold note now uses the color's `foreground` variant instead of `base`, which is darker so the text stays readable on the page. To revert to the previous appearance, set `IonNote.hue.bold.semantic.default.color` to `var(--ion-color-base)` for global styles, or `--ion-note-hue-bold-semantic-default-color` for component-specific styles. | |
| When `color` is set, the note color now reads from a token instead of `--ion-color-base` directly. Global overrides should use the theme tokens; component-specific overrides use the corresponding CSS variables: | |
| | Hue | Token (global) | CSS variable (component-specific) | | |
| |---|---|---| | |
| | `bold` | `IonNote.hue.bold.semantic.default.color` | `--ion-note-hue-bold-semantic-default-color` | | |
| | `subtle` | `IonNote.hue.subtle.semantic.default.color` | `--ion-note-hue-subtle-semantic-default-color` | | |
| <h5 id="version-10x-note-theme-classes">Theme classes</h5> | |
| Remove any instances that target the theme classes: `ion-note.md`, `ion-note.ios`. |
Nit: Every other component in here says "Theme classes" with a -theme-classes anchor, so I think note should match? The removed class came from getIonTheme too, so theme is the accurate word. This renames the list item, the heading and the anchor together so the link still works.
There was a problem hiding this comment.
Thanks, but "mode classes" is intentional here. BREAKING.md compares against v9, where these classes come from mode, not the theme (example). #31723 already renamed the other components to "Mode classes"; this branch is just based on an older ionic-modular, so they still show "Theme classes" here. I reverted the rename.
Co-authored-by: Shane <[email protected]>
This reverts commit f11a991.
Issue number: internal
What is the current behavior?
ion-notedoes not fragment styles based on themes.What is the new behavior?
ion-noteto a single stylesheet driven by theme tokensIonNoteRecipe/IonNoteConfigand the note tokens for the ionic, ios and md themeshueproperty. It defaults to"bold"foregroundvariant instead ofbase, matchingion-textandion-titlethemevirtual propDoes this introduce a breaking change?
This PR introduces breaking changes to how
ion-noteis styled. Use the global token for theme-wide styling, or the CSS variable for component-specific overrides.Replaced CSS variables
--colorIonNote.hue.bold.default.color--ion-note-hue-bold-default-colorA note with
hue="subtle"readsIonNote.hue.subtle.default.color, or--ion-note-hue-subtle-default-color.Colors: When
coloris set, the note color reads from a token instead of--ion-color-base. A bold note now uses the color'sforegroundvariant, which is darker so the text stays readable on the page. To revert, setIonNote.hue.bold.semantic.default.colortovar(--ion-color-base).boldIonNote.hue.bold.semantic.default.color--ion-note-hue-bold-semantic-default-colorsubtleIonNote.hue.subtle.semantic.default.color--ion-note-hue-subtle-semantic-default-colorMode classes: Remove any instances that target the mode classes:
ion-note.md,ion-note.ios.Other information
Left for the parents
item.md.scssstill sets the margin,align-self, font size and padding of a slottedion-note. Those rules move with the item migration.Known gaps
next, because the high-contrast text color steps are reversed.ionic-modularhas the same values. Tracked as a follow-upforegroundmatches bold's.ion-textandion-titleare the sameHow to test