feat(content): add recipe and tokens#31095
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| flex-shrink: 2; | ||
| overscroll-behavior-y: contain; | ||
| overflow-y: auto; | ||
| -webkit-overflow-scrolling: touch; |
There was a problem hiding this comment.
-webkit-overflow-scrolling has become obsolete since iOS 13.
| contain: size style; | ||
| } | ||
|
|
||
| :host(.ion-color) .inner-scroll { |
There was a problem hiding this comment.
There seems to be a lot deleted, but they were just moved around in the file.
| @Method() | ||
| async getBackgroundElement(): Promise<HTMLElement> { | ||
| if (!this.backgroundContentEl) { | ||
| await new Promise((resolve) => componentOnReady(this.el, resolve)); |
There was a problem hiding this comment.
Created a util for this since a lot of components are using the same code
| ...customTheme.palette, | ||
| }, | ||
| }; | ||
| theme = deepMerge(theme, customTheme); |
There was a problem hiding this comment.
This change mimics exactly how we are loading themes in the theme.ts file.
| $padding-top: var(--padding-top, var(--ion-content-padding-top, 0px)); | ||
| $padding-end: var(--padding-end, var(--ion-content-padding-end, 0px)); | ||
| $padding-bottom: var(--padding-bottom, var(--ion-content-padding-bottom, 0px)); | ||
| $padding-start: var(--padding-start, var(--ion-content-padding-start, 0px)); |
There was a problem hiding this comment.
In order for the padding classes (.ion-padding) to still be functional, we should be incorporating them as the first check.
| :host(.ion-color) .inner-scroll { | ||
| background: color.current-color(base); | ||
| color: color.current-color(contrast); | ||
| } |
There was a problem hiding this comment.
I didn't make this customizable because all themes are using the same styles. If the community requests it, then we can update the recipe to include it.
| } | ||
|
|
||
| .transition-shadow { | ||
| @include mixins.position-horizontal(null, 0); |
There was a problem hiding this comment.
We can now use this mixin instead of having to use left/right!
|
|
||
| :host(.ion-color) .inner-scroll { | ||
| background: color.current-color(base); | ||
| color: color.current-color(contrast); |
There was a problem hiding this comment.
ShaneK
left a comment
There was a problem hiding this comment.
Looking awesome! Mostly just have a few clarafication/documentation questions
ShaneK
left a comment
There was a problem hiding this comment.
Looks good to me! Just a question and a nit, but non-blocking
| * @returns The value found at the nested key or the fallback | ||
| */ | ||
| getObjectValue(key: string, fallback?: string): string | undefined { | ||
| getObjectValue(key: string, fallback?: ObjectConfigValue): ObjectConfigValue | undefined { |
There was a problem hiding this comment.
Are there callers lined up that need the boolean return? I couldn't find any consumers of getObjectValue, so widening from string | undefined to string | boolean | undefined reads as pre-emptive. If a follow-up PR needs it, that's cool, just checking.
| } | ||
|
|
||
| .transition-shadow { | ||
| @include mixins.position-horizontal(null, 0); |
There was a problem hiding this comment.
Nit: .transition-effect and .transition-shadow got converted to mixins.position-horizontal(...), but .transition-cover at line 245 still uses literal right: 0 with stylelint-disable. Full-width so RTL behavior is identical, but is leaving the asymmetric pattern intentional?


Issue number: resolves internal
What is the current behavior?
ion-contentdoes not fragment styles based on themes. All 3 themes share one style. However, it's not configured to the Modular Ionic.What is the new behavior?
content-interface.tstocontent.interfaces.tsand addedIonContentRecipetype.--offset-top/--offset-bottomto--internal-offset-top/--internal-offset-bottomto clearly separate them from the public CSS API..transition-effectand.transition-shadowwith theposition-horizontalmixin.-webkit-overflow-scrolling: touchfrom styles as this property has been a no-op since iOS 13.transitionShadow(present iniosmode, absent inmdmode) and thegetScrollElement()/getBackgroundElement()element ref methods.new Promise((resolve) => componentOnReady(...))patterns with a sharedwaitForComponenthelper, reducing boilerplate and improving type safety.Does this introduce a breaking change?
This PR introduces breaking changes to how
ion-contentis styled.Migration Path:
--backgroundand--colorhave been removed. Use the new token structure:--padding-*is still supported..ion-padding,.ion-padding-*classes incss/padding.scssset--padding-*directly on the host.ion-contentcontinues to honor those values (falling back to the new token when unset). Existing usage of the utility classes and direct--padding-*overrides will keep working.New code is encouraged to use the token-based API instead:
Note:
core/api.txtonly lists the new--ion-content-padding-*variables. The--padding-*overrides remain functional but are no longer part of the documented public API.If per-component customization is needed, the CSS variables can be used directly.
@props onion-contentand have been renamed to the--internal-*namespace, removing them from the public API:These are managed by
ion-contentitself (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.ion-content.md,ion-content.ios.Other information
Previews:
The framework (Angular, React, Vue) test apps are not being styled correctly anymore because the new tokens are not being passed to them. This is expected until we can export the tokens as mentioned in the design doc. The functionality in those test apps are still working.