-
Notifications
You must be signed in to change notification settings - Fork 13.4k
feat(content): add recipe and tokens #31095
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: ionic-modular
Are you sure you want to change the base?
Changes from all commits
7afba1a
32d2fdb
57c3140
5983c3b
76a32dd
7646ae6
412806f
c8f817c
6a496be
2904ea8
ca169b0
6dd900b
ec21b54
ec39980
7b8d89c
5d7fb5f
68c7136
dab1803
4704cc1
94e7f36
dddcd4e
095398c
32ea3b7
6f20e80
bc743b4
6337586
a56e8ce
e167474
944296c
718f411
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -19,6 +19,7 @@ This is a comprehensive list of the breaking changes introduced in the major ver | |||||||
| - [Button](#version-9x-button) | ||||||||
| - [Card](#version-9x-card) | ||||||||
| - [Chip](#version-9x-chip) | ||||||||
| - [Content](#version-9x-content) | ||||||||
| - [Datetime](#version-9x-datetime) | ||||||||
| - [Grid](#version-9x-grid) | ||||||||
| - [Input Otp](#version-9x-input-otp) | ||||||||
|
|
@@ -82,6 +83,53 @@ This is a comprehensive list of the breaking changes introduced in the major ver | |||||||
| - Specific theme classes (e.g., `ion-chip.md`) are no longer supported. Style modifications based on the active theme must be implemented using theme tokens rather than direct class targeting. | ||||||||
| - The `border-radius` of the `ios` and `md` chip now defaults to `10px` and `8px`, respectively, instead of `16px` in accordance with the iOS and Material Design 3 guidelines. To revert to the previous appearance, set the `shape` to `"round"`, or override the `IonChip.shape.round.border.radius` to specify a different value for global styles and `--ion-chip-shape-round-border-radius` for component-specific styles. | ||||||||
|
|
||||||||
| <h4 id="version-9x-content">Content</h4> | ||||||||
|
|
||||||||
| The following breaking changes apply to `ion-content`: | ||||||||
|
|
||||||||
| 1. `--background` and `--color` CSS variables have been replaced. | ||||||||
| 2. `--padding-*` CSS variables are no longer part of the documented public API (but remain functional). | ||||||||
| 3. `--keyboard-offset`, `--offset-top`, and `--offset-bottom` have been renamed to the `--internal-*` namespace with no replacement. | ||||||||
| 4. Theme classes (`ion-content.md`, `ion-content.ios`) are no longer supported. | ||||||||
|
|
||||||||
| <h5>Removed CSS variables</h5> | ||||||||
|
|
||||||||
| `--background` and `--color` have been removed. Use the new token structure for global styles, or the corresponding CSS variable for component-specific overrides: | ||||||||
|
|
||||||||
| | Old (8.x) | New token (global) | New CSS variable (component-specific) | | ||||||||
| |---|---|---| | ||||||||
| | `--background` | `IonContent.background` | `--ion-content-background` | | ||||||||
| | `--color` | `IonContent.color` | `--ion-content-color` | | ||||||||
|
|
||||||||
| <h5>Padding variables</h5> | ||||||||
|
|
||||||||
| New code should use the token-based API: | ||||||||
|
|
||||||||
| | Old (8.x) | New token (global) | New CSS variable (component-specific) | | ||||||||
| |---|---|---| | ||||||||
| | `--padding-top` | `IonContent.padding.top` | `--ion-content-padding-top` | | ||||||||
| | `--padding-end` | `IonContent.padding.end` | `--ion-content-padding-end` | | ||||||||
| | `--padding-bottom` | `IonContent.padding.bottom` | `--ion-content-padding-bottom` | | ||||||||
| | `--padding-start` | `IonContent.padding.start` | `--ion-content-padding-start` | | ||||||||
|
|
||||||||
| > **Note:** The `--padding-*` overrides and `.ion-padding`, `.ion-padding-*` utility classes in `css/padding.scss` continue to work — `ion-content` honors them as a fallback when the new token is unset. They are no longer part of the documented public API (only `--ion-content-padding-*` is listed in `core/api.txt`), but existing usage will not break. | ||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Recommend using GitHub's blockquote highlighting. |
||||||||
|
|
||||||||
| <h5>Internal-only variables</h5> | ||||||||
|
|
||||||||
| The following CSS variables were previously documented `@prop`s on `ion-content` and have been renamed to the `--internal-*` namespace, removing them from the public API: | ||||||||
|
|
||||||||
| | Old (8.x) | New | | ||||||||
| |---|---| | ||||||||
| | `--keyboard-offset` | `--internal-keyboard-offset` | | ||||||||
| | `--offset-top` | `--internal-offset-top` | | ||||||||
| | `--offset-bottom` | `--internal-offset-bottom` | | ||||||||
|
|
||||||||
| These are managed by `ion-content` itself (keyboard avoidance and header/footer offsets) and were never intended for consumer override. There is no replacement — any code that was setting them directly should be removed. | ||||||||
|
|
||||||||
| <h5>Theme classes</h5> | ||||||||
|
|
||||||||
| Remove any instances that target the theme classes: `ion-content.md`, `ion-content.ios`. | ||||||||
|
|
||||||||
| <h4 id="version-9x-datetime">Datetime</h4> | ||||||||
|
|
||||||||
| - The `ion-buttons` component has been removed from the internal implementation of `ion-datetime` and is no longer required when passing custom buttons to the `slot="buttons"`. When providing custom buttons, use a `div` element instead of `ion-buttons`. While existing code using `ion-buttons` may continue to work visually, future updates to the `ion-buttons` component may cause any styles you rely on to break. | ||||||||
|
|
||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,7 +24,7 @@ const DEFAULT_THEME = 'md'; | |
| const DEFAULT_PALETTE = 'light'; | ||
|
|
||
| (function() { | ||
|
|
||
| /** | ||
| * The `rtl` param is used to set the directionality of the | ||
| * document. This can be `true` or `false`. | ||
|
|
@@ -128,6 +128,27 @@ const DEFAULT_PALETTE = 'light'; | |
| ); | ||
| } | ||
|
|
||
| /** | ||
| * Deep merges two objects, with source properties overriding target properties | ||
| * @param target The target object to merge into | ||
| * @param source The source object to merge from | ||
| * @returns The merged object | ||
| */ | ||
| // TODO(FW-6750): Remove this once the theme tokens can be imported directly into the test pages | ||
| const deepMerge = (target, source) => { | ||
| const result = { ...target }; | ||
|
|
||
| for (const key in source) { | ||
| if (source[key] && typeof source[key] === 'object' && !Array.isArray(source[key])) { | ||
| result[key] = deepMerge(result[key] ?? {}, source[key]); | ||
| } else { | ||
| result[key] = source[key]; | ||
| } | ||
| } | ||
| return result; | ||
| }; | ||
|
|
||
| // TODO(FW-6750): Determine if this function can be removed once the theme tokens can be imported directly into the test pages | ||
| async function loadThemeTokens(themeName, paletteName) { | ||
| try { | ||
| // Store existing theme set from the app initialization | ||
|
|
@@ -138,14 +159,7 @@ const DEFAULT_PALETTE = 'light'; | |
|
|
||
| // Merge with existing theme to preserve any customizations | ||
| if (customTheme) { | ||
| theme = { | ||
| ...theme, | ||
| ...customTheme, | ||
| palette: { | ||
| ...theme.palette, | ||
| ...customTheme.palette, | ||
| }, | ||
| }; | ||
| theme = deepMerge(theme, customTheme); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change mimics exactly how we are loading themes in the |
||
| } | ||
|
|
||
| // If a specific palette is requested, modify the palette structure | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -143,7 +143,6 @@ | |
| flex-shrink: 2; | ||
| overscroll-behavior-y: contain; | ||
| overflow-y: auto; | ||
| -webkit-overflow-scrolling: touch; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| pointer-events: all; | ||
|
|
||
| background: var(--background); | ||
|
|
||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change was because I synced the padding between themes to be consistent. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,16 +9,33 @@ | |
| /> | ||
| <link href="../../../../../css/ionic.bundle.css" rel="stylesheet" /> | ||
| <link href="../../../../../scripts/testing/styles.css" rel="stylesheet" /> | ||
| <script> | ||
| // Need to be called before loading Ionic else | ||
| // the scripts.js logic runs too early. | ||
| window.Ionic = { | ||
| config: { | ||
| customTheme: { | ||
| components: { | ||
| IonContent: { | ||
| background: '#dde2ef', | ||
| padding: { | ||
| start: '16px', | ||
| end: '16px', | ||
| top: '16px', | ||
| bottom: '16px', | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }; | ||
| </script> | ||
| <script src="../../../../../scripts/testing/scripts.js"></script> | ||
| <script nomodule src="../../../../../dist/ionic/ionic.js"></script> | ||
| <script type="module" src="../../../../../dist/ionic/ionic.esm.js"></script> | ||
|
|
||
| <!-- Styles only for testing purposes to identify the card shape --> | ||
| <style> | ||
| ion-content { | ||
| --background: #dde2ef; | ||
| } | ||
|
|
||
| .container { | ||
| padding: 8px; | ||
| } | ||
|
|
@@ -33,7 +50,7 @@ | |
| </ion-toolbar> | ||
| </ion-header> | ||
|
|
||
| <ion-content class="ion-padding ion-text-center" id="content" no-bounce> | ||
| <ion-content class="ion-text-center" id="content" no-bounce> | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added the padding through the config since I already had to pass the background value there. Figured that I would keep it all in one place by adding the padding. |
||
| <h1>Default</h1> | ||
| <div id="default" class="container"> | ||
| <ion-card> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,14 +10,26 @@ | |
| /> | ||
| <link href="../../../../../css/ionic/bundle.ionic.css" rel="stylesheet" /> | ||
| <link href="../../../../../scripts/testing/styles.css" rel="stylesheet" /> | ||
| <script> | ||
| // Need to be called before loading Ionic else | ||
| // the scripts.js logic runs too early. | ||
| window.Ionic = { | ||
| config: { | ||
| customTheme: { | ||
| components: { | ||
| IonContent: { | ||
| background: '#dde2ef', | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }; | ||
| </script> | ||
| <script src="../../../../../scripts/testing/scripts.js"></script> | ||
| <script nomodule src="../../../../../dist/ionic/ionic.js"></script> | ||
| <script type="module" src="../../../../../dist/ionic/ionic.esm.js"></script> | ||
|
|
||
| <style> | ||
| ion-content { | ||
| --background: #dde2ef; | ||
| } | ||
| .ion-margin-top { | ||
| margin-top: 32px; | ||
| } | ||
|
|
@@ -32,7 +44,7 @@ | |
| </ion-toolbar> | ||
| </ion-header> | ||
|
|
||
| <ion-content class="ion-padding-space-400" id="content" no-bounce> | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed the class because it wasn't set anywhere. |
||
| <ion-content id="content" no-bounce> | ||
| <h4>Preview options</h4> | ||
|
|
||
| <p> | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.