-
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 5 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
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 |
|---|---|---|
| @@ -1,34 +1,27 @@ | ||
| @import "../../themes/native/native.globals"; | ||
| @use "../../themes/mixins" as mixins; | ||
| @use "../../themes/functions.color" as color; | ||
|
|
||
| // Content | ||
| // -------------------------------------------------- | ||
|
|
||
| :host { | ||
| /** | ||
| * @prop --background: Background of the content | ||
| * @prop --ion-content-background: Background of the content | ||
| * | ||
| * @prop --color: Color of the content | ||
| * @prop --ion-content-color: Color of the content | ||
| * | ||
| * @prop --padding-top: Top padding of the content | ||
| * @prop --padding-end: Right padding if direction is left-to-right, and left padding if direction is right-to-left of the content | ||
| * @prop --padding-bottom: Bottom padding of the content | ||
| * @prop --padding-start: Left padding if direction is left-to-right, and right padding if direction is right-to-left of the content | ||
| * @prop --ion-content-font-family: Font family of the content | ||
| * | ||
| * @prop --keyboard-offset: Keyboard offset of the content | ||
|
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. I removed the comments for the internal variables. |
||
| * @prop --ion-content-overflow: Overflow behavior of the scrollable area | ||
| * | ||
| * @prop --offset-top: Offset top of the content | ||
| * @prop --offset-bottom: Offset bottom of the content | ||
| * @prop --ion-content-padding-top: Top padding of the content | ||
| * @prop --ion-content-padding-end: Right padding if direction is left-to-right, and left padding if direction is right-to-left of the content | ||
| * @prop --ion-content-padding-bottom: Bottom padding of the content | ||
| * @prop --ion-content-padding-start: Left padding if direction is left-to-right, and right padding if direction is right-to-left of the content | ||
| */ | ||
| --background: #{$background-color}; | ||
| --color: #{$text-color}; | ||
| --padding-top: 0px; | ||
| --padding-bottom: 0px; | ||
| --padding-start: 0px; | ||
| --padding-end: 0px; | ||
| --keyboard-offset: 0px; | ||
| --offset-top: 0px; | ||
| --offset-bottom: 0px; | ||
| --overflow: auto; | ||
| --internal-keyboard-offset: 0px; | ||
| --internal-offset-top: 0px; | ||
| --internal-offset-bottom: 0px; | ||
|
ShaneK marked this conversation as resolved.
|
||
|
|
||
| display: block; | ||
| position: relative; | ||
|
|
@@ -44,36 +37,26 @@ | |
| padding: 0 !important; | ||
| /* stylelint-enable */ | ||
|
|
||
| font-family: $font-family-base; | ||
| font-family: var(--ion-content-font-family); | ||
|
ShaneK marked this conversation as resolved.
Outdated
|
||
|
|
||
| contain: size style; | ||
| } | ||
|
|
||
| :host(.ion-color) .inner-scroll { | ||
|
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. There seems to be a lot deleted, but they were just moved around in the file. |
||
| background: current-color(base); | ||
| color: current-color(contrast); | ||
| } | ||
|
|
||
| #background-content { | ||
| @include position(calc(var(--offset-top) * -1), 0px, calc(var(--offset-bottom) * -1), 0px); | ||
|
|
||
| position: absolute; | ||
|
|
||
| background: var(--background); | ||
| } | ||
| // Content Inner Scroll | ||
| // --------------------------------------------- | ||
|
|
||
| .inner-scroll { | ||
| @include position(calc(var(--offset-top) * -1), 0px, calc(var(--offset-bottom) * -1), 0px); | ||
| @include padding( | ||
| calc(var(--padding-top) + var(--offset-top)), | ||
| var(--padding-end), | ||
| calc(var(--padding-bottom) + var(--keyboard-offset) + var(--offset-bottom)), | ||
| var(--padding-start) | ||
| @include mixins.position(calc(var(--internal-offset-top) * -1), 0px, calc(var(--internal-offset-bottom) * -1), 0px); | ||
| @include mixins.padding( | ||
| calc(var(--ion-content-padding-top) + var(--internal-offset-top)), | ||
| var(--ion-content-padding-end), | ||
| calc(var(--ion-content-padding-bottom) + var(--internal-keyboard-offset) + var(--internal-offset-bottom)), | ||
| var(--ion-content-padding-start) | ||
| ); | ||
|
|
||
| position: absolute; | ||
|
|
||
| color: var(--color); | ||
| color: var(--ion-content-color); | ||
|
|
||
| box-sizing: border-box; | ||
|
|
||
|
|
@@ -89,10 +72,16 @@ | |
| touch-action: pan-x pan-y pinch-zoom; | ||
| } | ||
|
|
||
| :host(.ion-color) .inner-scroll { | ||
| background: color.current-color(base); | ||
| color: color.current-color(contrast); | ||
|
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. |
||
| } | ||
|
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. 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. |
||
|
|
||
| // Content Scroll | ||
| // --------------------------------------------- | ||
|
|
||
| .scroll-y, | ||
| .scroll-x { | ||
| -webkit-overflow-scrolling: touch; | ||
|
|
||
| /** | ||
| * This adds `.inner-scroll` as part of the | ||
| * stacking context in WebKit. Without it, | ||
|
|
@@ -115,15 +104,29 @@ | |
| } | ||
|
|
||
| .scroll-y { | ||
| overflow-y: var(--overflow); | ||
| overflow-y: var(--ion-content-overflow); | ||
| overscroll-behavior-y: contain; | ||
| } | ||
|
|
||
| .scroll-x { | ||
| overflow-x: var(--overflow); | ||
| overflow-x: var(--ion-content-overflow); | ||
| overscroll-behavior-x: contain; | ||
| } | ||
|
|
||
| // Content Background | ||
| // --------------------------------------------- | ||
|
|
||
| #background-content { | ||
| @include mixins.position(calc(var(--internal-offset-top) * -1), 0px, calc(var(--internal-offset-bottom) * -1), 0px); | ||
|
|
||
| position: absolute; | ||
|
|
||
| background: var(--ion-content-background); | ||
| } | ||
|
|
||
| // Content Overscroll | ||
| // --------------------------------------------- | ||
|
|
||
| .overscroll::before, | ||
| .overscroll::after { | ||
| position: absolute; | ||
|
|
@@ -142,6 +145,9 @@ | |
| top: -1px; | ||
| } | ||
|
|
||
| // Content Sizing | ||
| // --------------------------------------------- | ||
|
|
||
| :host(.content-sizing) { | ||
| display: flex; | ||
|
|
||
|
|
@@ -159,6 +165,7 @@ | |
|
|
||
| contain: none; | ||
| } | ||
|
|
||
| :host(.content-sizing) .inner-scroll { | ||
| position: relative; | ||
|
|
||
|
|
@@ -172,10 +179,34 @@ | |
| top: 0; | ||
| bottom: 0; | ||
|
|
||
| margin-top: calc(var(--offset-top) * -1); | ||
| margin-bottom: calc(var(--offset-bottom) * -1); | ||
| margin-top: calc(var(--internal-offset-top) * -1); | ||
| margin-bottom: calc(var(--internal-offset-bottom) * -1); | ||
| } | ||
|
|
||
| // Content Slotted Elements | ||
| // --------------------------------------------- | ||
|
|
||
| // Elements with the "fixed" slot | ||
| ::slotted([slot="fixed"]) { | ||
| position: absolute; | ||
|
|
||
| /** | ||
| * When presenting ion-content inside of an ion-modal, the .inner-scroll | ||
| * element is composited. In WebKit, the fixed content is not composited | ||
| * causing it to appear under the main scrollable content as a result. | ||
| * The fixed content is correctly composited in other browsers. Adding | ||
| * the translateZ forces the fixed content to be composited so it correctly | ||
| * shows on top of the scrollable content. Setting a negative z-index will | ||
| * still allow the fixed content to appear under the scroll content if specified. | ||
| */ | ||
| transform: translateZ(0); | ||
| } | ||
|
|
||
| // Content: iOS Mode Transition | ||
|
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. The design doc did not account for animations based on mode. Should we be aiming to convert them to be based on themes? If so, then we can allow devs to customize the certain parts of the animations. In this instance, they could provide their preferred background color during the transition. |
||
| // The transition shadow effect is only animated by the iOS transition | ||
| // builder, so these styles are only rendered in iOS mode. | ||
| // --------------------------------------------- | ||
|
|
||
| .transition-effect { | ||
| display: none; | ||
| position: absolute; | ||
|
|
@@ -238,21 +269,3 @@ | |
|
|
||
| transform: scaleX(-1); | ||
| } | ||
|
|
||
| // Content: Fixed | ||
| // -------------------------------------------------- | ||
|
|
||
| ::slotted([slot="fixed"]) { | ||
| position: absolute; | ||
|
|
||
| /** | ||
| * When presenting ion-content inside of an ion-modal, the .inner-scroll | ||
| * element is composited. In WebKit, the fixed content is not composited | ||
| * causing it to appear under the main scrollable content as a result. | ||
| * The fixed content is correctly composited in other browsers. Adding | ||
| * the translateZ forces the fixed content to be composited so it correctly | ||
| * shows on top of the scrollable content. Setting a negative z-index will | ||
| * still allow the fixed content to appear under the scroll content if specified. | ||
| */ | ||
| transform: translateZ(0); | ||
| } | ||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-webkit-overflow-scrollinghas become obsolete since iOS 13.