feat(ripple-effect): add recipe and tokens#31203
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| </ion-content> | ||
| </ion-app> | ||
| <script> | ||
| function blockClicked() { |
There was a problem hiding this comment.
Cleaned up the layout and added ripple demos at full trigger to make it easier to debug.
There was a problem hiding this comment.
This can be tested manually by commenting out the disconnection flag.
There was a problem hiding this comment.
While consolidating the ripple-effect theme files, the only difference in the rippleAnimation keyframe between ionic and ios/md was the easing curve:
- ios/md used
cubic-bezier(0.4, 0, 0.2, 1)directly - ionic used
$ion-transition-curve-expressive
That ionic variable is defined as var(--token-transition-curve-expressive, cubic-bezier(0.4, 0, 0.2, 1)), so it resolves to the exact same curve by default. All three themes animate identically.
I chose to hardcode cubic-bezier(0.4, 0, 0.2, 1) in the consolidated file rather than introduce a --ion-ripple-effect-* token for it, because:
- No visual difference to express. A token's purpose is to let a value vary per theme or be customized. Here the value is identical across all three themes, so a token would add public API surface and a recipe/token entry in every theme file for zero behavioral gain.
- Consistency cost. If we tokenized this easing, we'd owe matching tokens for the other keyframe easings (
fadeInAnimation/fadeOutAnimationboth use linear) to avoid an arbitrary split — more surface area, still no visual difference.
If we ever need the ripple easing to be theme-customizable, then we can create the token at that time.
Issue number: resolves internal
What is the current behavior?
ion-ripple-effectfragments its styles across separate theme stylesheets.What is the new behavior?
ion-ripple-effectto Modular Ionic.ripple-effect.common.scssandripple-effect.ionic.scssinto a singleripple-effect.scss.IonRippleEffectRecipewith--ion-ripple-effect-opacity, plus per-theme token defaults in the ios, md, and ionic theme files.--ripple-opacityto--ion-ripple-effect-opacity.--translate-endand--final-scaleas--internal-translate-endand--internal-final-scale.themevirtual prop and thegetIonThemeruntime read.SCALE_DURATIONconstant tied to the$scale-durationSass variable.ION_RIPPLE_EFFECT_TYPESplus theIonRippleEffectTypetype.Does this introduce a breaking change?
This PR introduces breaking changes to how
ion-ripple-effectis styled.Migration Path:
--ripple-opacityis renamed.--ripple-opacityIonRippleEffect.opacity--ion-ripple-effect-opacityOther information
Preview