-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Expand file tree
/
Copy pathcontent.scss
More file actions
271 lines (210 loc) · 6.68 KB
/
content.scss
File metadata and controls
271 lines (210 loc) · 6.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
@use "../../themes/mixins" as mixins;
@use "../../themes/functions.color" as color;
// Content
// --------------------------------------------------
:host {
/**
* @prop --ion-content-background: Background of the content
*
* @prop --ion-content-color: Color of the content
*
* @prop --ion-content-font-family: Font family of the content
*
* @prop --ion-content-overflow: Overflow behavior of the scrollable area
*
* @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
*/
--internal-keyboard-offset: 0px;
--internal-offset-top: 0px;
--internal-offset-bottom: 0px;
display: block;
position: relative;
flex: 1;
width: 100%;
height: 100%;
/* stylelint-disable */
margin: 0 !important;
padding: 0 !important;
/* stylelint-enable */
font-family: var(--ion-content-font-family);
contain: size style;
}
// Content Inner Scroll
// ---------------------------------------------
.inner-scroll {
@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(--ion-content-color);
box-sizing: border-box;
overflow: hidden;
/**
* touch-action: manipulation is an alias
* for this, but WebKit has an issue
* where pointercancel events are not fired
* when scrolling: https://bugs.webkit.org/show_bug.cgi?id=240917
* Using the long form below avoids the issue.
*/
touch-action: pan-x pan-y pinch-zoom;
}
:host(.ion-color) .inner-scroll {
background: color.current-color(base);
color: color.current-color(contrast);
}
// Content Scroll
// ---------------------------------------------
.scroll-y,
.scroll-x {
/**
* This adds `.inner-scroll` as part of the
* stacking context in WebKit. Without it,
* children of ion-content are treated as
* siblings rather than descendants. This
* can result in the children being put
* into their own layers, degrading
* scrolling performance.
*
* An optimization called "layer backing
* sharing" usually kicks in to prevent
* this, but having translate3d defeats
* this optimization.
*
* See: https://bugs.webkit.org/show_bug.cgi?id=216701
*/
z-index: 0;
will-change: scroll-position;
}
.scroll-y {
overflow-y: var(--ion-content-overflow);
overscroll-behavior-y: contain;
}
.scroll-x {
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;
width: 1px;
height: 1px;
content: "";
}
.overscroll::before {
bottom: -1px;
}
.overscroll::after {
top: -1px;
}
// Content Sizing
// ---------------------------------------------
:host(.content-sizing) {
display: flex;
flex-direction: column;
/**
* This resolves a sizing issue in popovers where extra long content
* would overflow the popover's height, preventing scrolling. It's a
* quirk of flexbox that forces the content to shrink to fit.
*
* overflow: hidden can't be used here because it prevents the visual
* effect from showing on translucent headers.
*/
min-height: 0;
contain: none;
}
:host(.content-sizing) .inner-scroll {
position: relative;
/**
* Because the outer content has display: flex here (to help enable
* scrolling in a popover), offsetting via `top` (such as when using
* a translucent header) creates white space under the content. Use
* a negative margin instead to keep the bottom in place. (A similar
* thing happens with `bottom` and footers.)
*/
top: 0;
bottom: 0;
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
// 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;
width: 100%;
height: 100vh;
opacity: 0;
pointer-events: none;
}
:host(.content-ltr) .transition-effect {
/* stylelint-disable property-disallowed-list */
left: -100%;
/* stylelint-enable property-disallowed-list */
}
:host(.content-rtl) .transition-effect {
/* stylelint-disable property-disallowed-list */
right: -100%;
/* stylelint-enable property-disallowed-list */
}
.transition-cover {
position: absolute;
/* stylelint-disable property-disallowed-list */
right: 0;
/* stylelint-enable property-disallowed-list */
width: 100%;
height: 100%;
background: black;
opacity: 0.1;
}
.transition-shadow {
display: block;
position: absolute;
width: 100%;
height: 100%;
box-shadow: inset -9px 0 9px 0 rgba(0, 0, 100, 0.03);
}
:host(.content-ltr) .transition-shadow {
/* stylelint-disable property-disallowed-list */
right: 0;
/* stylelint-enable property-disallowed-list */
}
:host(.content-rtl) .transition-shadow {
/* stylelint-disable property-disallowed-list */
left: 0;
/* stylelint-enable property-disallowed-list */
transform: scaleX(-1);
}