@justeattakeaway/pie-css 0.11.0 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +186 -26
- package/dist/index.css +85 -14
- package/package.json +2 -1
- package/scss/index.scss +1 -0
- package/scss/settings/_breakpoints.scss +19 -0
- package/scss/settings/_include-media.scss +596 -0
- package/scss/settings/_mq.scss +6 -0
- package/scss/settings/index.scss +1 -0
package/README.md
CHANGED
|
@@ -13,27 +13,32 @@
|
|
|
13
13
|
# Table of Contents
|
|
14
14
|
|
|
15
15
|
1. [Introduction](#introduction)
|
|
16
|
-
2. [
|
|
16
|
+
2. [Installation](#installation)
|
|
17
|
+
3. [Using the `pie-css` CSS stylesheet in your web application](#using-the-pie-css-css-stylesheet-in-your-web-application)
|
|
17
18
|
1. JS or Framework import (via bundler)
|
|
18
|
-
2.
|
|
19
|
+
2. Nuxt
|
|
19
20
|
3. Sass /SCSS
|
|
20
21
|
4. Native HTML
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
4. [What's included in the `pie-css` base stylesheet](#whats-included-in-the-pie-css-base-stylesheet)
|
|
23
|
+
4. [Using the `pie-css` SCSS helpers (mixins & functions)](#using-the-pie-css-scss-helpers-mixins--functions)
|
|
24
|
+
1. [Importing the `pie-css` SCSS helpers](#importing-the-pie-css-scss-helpers)
|
|
25
|
+
2. [`pie-css` SCSS Helper Definitions](#pie-css-scss-helper-definitions)
|
|
26
|
+
- [`font-size()`](#font-size)
|
|
27
|
+
- [`@include media()`](#include-media)
|
|
28
|
+
5. [Testing](#testing)
|
|
24
29
|
- [CSS](#css)
|
|
25
|
-
- [SCSS](#scss
|
|
30
|
+
- [SCSS](#scss)
|
|
26
31
|
|
|
27
32
|
## Introduction
|
|
28
33
|
|
|
29
|
-
|
|
34
|
+
`pie-css` is a styling library that provides both a minimal set of CSS styles to help PIE Web Components display as intended on web applications, and a set of optional SCSS style helpers (mixins & functions) to help with common styling tasks.
|
|
35
|
+
|
|
36
|
+
It also includes the PIE design tokens (and HSL colour variants) as CSS variables, as these variables are used across the PIE component styles and therefore need to be imported when using the PIE Web Components.
|
|
30
37
|
|
|
31
|
-
---
|
|
32
38
|
|
|
33
|
-
##
|
|
34
|
-
`pie-css` provides a base stylesheet that sets up some basic styles used by our components. It is essential that this stylesheet is included in any application that uses PIE Web Components. The stylesheet provides some basic styles for things like typography and provides the design tokens that are used by our components.
|
|
39
|
+
## Installation
|
|
35
40
|
|
|
36
|
-
To install
|
|
41
|
+
To install `pie-css`, run the following on your command line:
|
|
37
42
|
|
|
38
43
|
```bash
|
|
39
44
|
# npm
|
|
@@ -43,12 +48,19 @@ npm i @justeattakeaway/pie-css
|
|
|
43
48
|
yarn add @justeattakeaway/pie-css
|
|
44
49
|
```
|
|
45
50
|
|
|
46
|
-
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Using the `pie-css` CSS stylesheet in your web application
|
|
55
|
+
|
|
56
|
+
`pie-css` provides a base stylesheet that sets up some basic styles used by the PIE Web Components. It is essential that this stylesheet is included in any application that uses PIE Web Components. The stylesheet provides a minimal set of styles for ensuring typography displayed as intended, while also importing the PIE design tokens that are used by our components.
|
|
57
|
+
|
|
58
|
+
[Once installed](#installation), how you include these styles will largely depend on the type of application you are building (and your own preference), but here are a few examples.
|
|
47
59
|
|
|
48
60
|
|
|
49
61
|
### JS or Framework import (via bundler)
|
|
50
62
|
|
|
51
|
-
One common way of importing
|
|
63
|
+
One common way of importing the styles would be through a regular JS import as part of your application bundle.
|
|
52
64
|
|
|
53
65
|
```js
|
|
54
66
|
import '@justeattakeaway/pie-css';
|
|
@@ -80,12 +92,12 @@ import App from './App.vue';
|
|
|
80
92
|
createApp(App).mount('#app');
|
|
81
93
|
```
|
|
82
94
|
|
|
83
|
-
###
|
|
95
|
+
### Nuxt
|
|
84
96
|
|
|
85
|
-
If you are using
|
|
97
|
+
If you are using Nuxt, you can import `pie-css` in your `nuxt.config.js` file.
|
|
86
98
|
|
|
87
99
|
|
|
88
|
-
For
|
|
100
|
+
For Nuxt v3, this would look like this:
|
|
89
101
|
|
|
90
102
|
```js
|
|
91
103
|
// Nuxt v3
|
|
@@ -95,7 +107,7 @@ export default defineNuxtConfig({
|
|
|
95
107
|
});
|
|
96
108
|
```
|
|
97
109
|
|
|
98
|
-
For
|
|
110
|
+
For Nuxt v2, it is very similar, looking more like this:
|
|
99
111
|
|
|
100
112
|
```js
|
|
101
113
|
export default {
|
|
@@ -121,22 +133,43 @@ If you are using Sass, you could import the CSS file as part of your styles dire
|
|
|
121
133
|
Of course, you could include the styles straight inside your HTML document – most likely you'd want to link to the `/@justeattakeaway/pie-css/dist/index.css` CSS file in the head of your HTML.
|
|
122
134
|
|
|
123
135
|
|
|
136
|
+
## What's included in the `pie-css` base stylesheet
|
|
124
137
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
138
|
+
You can see the pre-compiled `pie-css` styles [in the `pie-css` repo](https://github.com/justeattakeaway/pie/blob/main/packages/tools/pie-css/css/input.css), but let's run through what's included.
|
|
139
|
+
|
|
140
|
+
### PIE Design Tokens
|
|
141
|
+
|
|
142
|
+
A core dependency of our PIE Web Components are the PIE design tokens. These are imported in the `pie-css` styles, as well as tokens for HSL colour variants (which are useful when needing to lighten/darken colours).
|
|
128
143
|
|
|
129
|
-
|
|
144
|
+
### box-sizing
|
|
130
145
|
|
|
131
|
-
|
|
146
|
+
We set `box-sizing: border-box` so that the CSS box model acts consistently when using PIE components.
|
|
132
147
|
|
|
133
|
-
|
|
148
|
+
### Typography
|
|
134
149
|
|
|
135
|
-
|
|
150
|
+
There are a number of typographic CSS rules that we specify to help with font rendering. These are:
|
|
136
151
|
|
|
137
|
-
|
|
152
|
+
```css
|
|
153
|
+
/* These rules with smooth fonts. It makes fonts look crisp and clean on devices
|
|
154
|
+
that support it. */
|
|
155
|
+
text-rendering: optimizelegibility;
|
|
156
|
+
-webkit-font-smoothing: antialiased;
|
|
157
|
+
-moz-font-smoothing: antialiased;
|
|
138
158
|
|
|
139
|
-
|
|
159
|
+
/* These are added to prevent text size adjustments in various browsers.
|
|
160
|
+
In some browsers, such as iOS Safari, will try to increase the font-size
|
|
161
|
+
when you rotate the screen. This can be jarring and break layouts. */
|
|
162
|
+
-webkit-text-size-adjust: 100%;
|
|
163
|
+
text-size-adjust: 100%;
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### z-index variables
|
|
167
|
+
|
|
168
|
+
Some PIE Web Components use a z-index value to control how they stack on a webpage. These values are defined as CSS variables and are utilized internally.
|
|
169
|
+
|
|
170
|
+
In most cases, a webpage should follow the DOM's natural stacking order and the default z-index order assigned for each component. However, if you're creating custom components, refer to the following table to make sure they don't conflict with other components.
|
|
171
|
+
|
|
172
|
+
| Token | Z-Index Value |
|
|
140
173
|
| -------------------------- | ---------------|
|
|
141
174
|
| --dt-z-index-dropdown | 1000 |
|
|
142
175
|
| --dt-z-index-fab | 1000 |
|
|
@@ -148,6 +181,133 @@ Some PIE Web Components use a z-index value to control how they stack on a webpa
|
|
|
148
181
|
| --dt-z-index-cookie-banner | 5000 |
|
|
149
182
|
| --dt-z-index-toast | 6000 |
|
|
150
183
|
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## Using the `pie-css` SCSS helpers (mixins & functions)
|
|
187
|
+
|
|
188
|
+
PIE CSS provides an optional set of SCSS helpers that are used by the PIE Web Components. These can also be used by web applications using SCSS, by importing the helpers into their project.
|
|
189
|
+
|
|
190
|
+
These helpers are for carrying out common tasks when interacting with the PIE design tokens, such as setting font sizes and media-queries in a consistent way, and for sharing styles definitions via SCSS mixins and functions.
|
|
191
|
+
|
|
192
|
+
One common example is to add unit suffixes (such as `px`) to the end of `font-size` declarations, as these are imported as unit-less values from our design tokens.
|
|
193
|
+
|
|
194
|
+
### Importing the `pie-css` SCSS helpers
|
|
195
|
+
|
|
196
|
+
Ensure you have installed `pie-css` as set out in [the installation section](Installation).
|
|
197
|
+
|
|
198
|
+
Once you have done this, you can then import the helpers by writing the following in your SCSS:
|
|
199
|
+
|
|
200
|
+
```scss
|
|
201
|
+
@use '@justeattakeaway/pie-css/scss' as *;
|
|
202
|
+
|
|
203
|
+
// or to namespace the mixins and functions, to avoid collisions
|
|
204
|
+
// import the helpers while defining a namespace
|
|
205
|
+
@use '@justeattakeaway/pie-css/scss' as p;
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
You should now be able to use the `pie-scss` helpers in that SCSS scope.
|
|
209
|
+
|
|
210
|
+
Be aware that if you want to set this up globally across your application, you'll need to add this import to your application SCSS config, but it's recommended to `@use` the helpers only in the SCSS files that use them on your project.
|
|
211
|
+
|
|
212
|
+
### `pie-css` SCSS Helper Definitions
|
|
213
|
+
|
|
214
|
+
#### `font-size()`
|
|
215
|
+
|
|
216
|
+
Used to reference design token font variables to add `px` unit values.
|
|
217
|
+
|
|
218
|
+
`font-size` can be used as a mixin to output the full style declaration, or as a function when you would like to assign the design token to a CSS variable.
|
|
219
|
+
|
|
220
|
+
```scss
|
|
221
|
+
// Use the font-size() mixin
|
|
222
|
+
.c-label {
|
|
223
|
+
@include font-size(--dt-font-body-s-size);
|
|
224
|
+
}
|
|
225
|
+
// Outputs:
|
|
226
|
+
.c-label {
|
|
227
|
+
font-size: calc(var(--dt-font-body-s-size) * 1px);
|
|
228
|
+
}
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
```scss
|
|
232
|
+
// Use the font-size function
|
|
233
|
+
--body-font-size: #{font-size(--dt-font-body-s-size)};
|
|
234
|
+
|
|
235
|
+
.c-label {
|
|
236
|
+
font-size: var(--body-font-size);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// Outputs:
|
|
240
|
+
--body-font-size: calc(var(--dt-font-body-s-size) * 1px);
|
|
241
|
+
|
|
242
|
+
.c-label {
|
|
243
|
+
font-size: var(--dt-font-body-s-size);
|
|
244
|
+
}
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
#### `@include media()`
|
|
248
|
+
|
|
249
|
+
For media queries, we use an SCSS helper library called [include-media](https://eduardoboucas.github.io/include-media).
|
|
250
|
+
|
|
251
|
+
This library allows you to setup shortcut names for common breakpoints and provides a nicer syntax for working with media queries through the use of logical operators (such as `>=` and `<=`).
|
|
252
|
+
|
|
253
|
+
As part of the `pie-css` SCSS helpers, we setup the breakpoint shortcut names such that:
|
|
254
|
+
|
|
255
|
+
```scss
|
|
256
|
+
$breakpoints: (
|
|
257
|
+
xs: 320px,
|
|
258
|
+
sm: 600px,
|
|
259
|
+
md: 768px,
|
|
260
|
+
lg: 1024px,
|
|
261
|
+
xl: 1280px,
|
|
262
|
+
xxl: 1440px
|
|
263
|
+
);
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
You can then use these in your SCSS like so:
|
|
267
|
+
|
|
268
|
+
```scss
|
|
269
|
+
@use '@justeattakeaway/pie-css/scss' as *;
|
|
270
|
+
|
|
271
|
+
.c-formField {
|
|
272
|
+
color: red;
|
|
273
|
+
|
|
274
|
+
@include media('>=sm') {
|
|
275
|
+
color: blue;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// Outputs:
|
|
280
|
+
.c-formField {
|
|
281
|
+
color: red;
|
|
282
|
+
}
|
|
283
|
+
@media (min-width: 600px) {
|
|
284
|
+
.c-formField {
|
|
285
|
+
color: blue;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
It also lets you write nice expressions like this:
|
|
291
|
+
|
|
292
|
+
```scss
|
|
293
|
+
.c-formField {
|
|
294
|
+
// target between sm and md breakpoints on retina2x devices
|
|
295
|
+
@include media('>=sm', '<=md', 'retina2x') {
|
|
296
|
+
color: purple;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
To see the full list of features `include-media` provides, [check out their website](https://eduardoboucas.github.io/include-media).
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
### Other SCSS helpers
|
|
306
|
+
|
|
307
|
+
We will be writing more in-depth docs on all of our SCSS helpers shortly, but for now, feel free to browse the [SCSS code in the PIE mono-repo](https://github.com/justeattakeaway/pie/tree/main/packages/tools/pie-css/scss) – or reach out to one of the DS team who can take you through what's available.
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
151
311
|
## Testing
|
|
152
312
|
|
|
153
313
|
We strive to ensure all styles are appropriately tested. How we test the styles differs for CSS and SCSS. Below, we outline both approaches.
|
package/dist/index.css
CHANGED
|
@@ -50,7 +50,8 @@
|
|
|
50
50
|
--dt-color-red: #d50525;
|
|
51
51
|
--dt-color-red-10: #ffe9ea;
|
|
52
52
|
--dt-color-red-25: #f2a6b0;
|
|
53
|
-
--dt-color-red-30: #
|
|
53
|
+
--dt-color-red-30: #f68179;
|
|
54
|
+
--dt-color-red-40: #e22c3e;
|
|
54
55
|
--dt-color-red-90: #491e24;
|
|
55
56
|
--dt-color-red-dark-hc: #a4041f;
|
|
56
57
|
--dt-color-red-light-hc: #ff7a80;
|
|
@@ -59,6 +60,7 @@
|
|
|
59
60
|
--dt-color-tomato-5: #ffd3bf;
|
|
60
61
|
--dt-color-tomato-90: #622b18;
|
|
61
62
|
--dt-color-turmeric-5: #fff9de;
|
|
63
|
+
--dt-color-turmeric-60: #bf8b09;
|
|
62
64
|
--dt-color-turmeric-80: #745300;
|
|
63
65
|
--dt-color-white: #fff;
|
|
64
66
|
--dt-color-yellow: #f6c243;
|
|
@@ -81,6 +83,7 @@
|
|
|
81
83
|
--dt-color-border-strong: var(--dt-color-mozzarella-30);
|
|
82
84
|
--dt-color-border-inverse: var(--dt-color-mozzarella-70);
|
|
83
85
|
--dt-color-border-selected: var(--dt-color-mozzarella-50);
|
|
86
|
+
--dt-color-border-selected-brand: var(--dt-color-orange);
|
|
84
87
|
--dt-color-divider-default: rgb(0,0,0,0.08);
|
|
85
88
|
--dt-color-divider-inverse: rgb(255,255,255,0.20);
|
|
86
89
|
--dt-color-interactive-brand: var(--dt-color-orange);
|
|
@@ -89,6 +92,7 @@
|
|
|
89
92
|
--dt-color-interactive-inverse: var(--dt-color-white);
|
|
90
93
|
--dt-color-interactive-light: var(--dt-color-white);
|
|
91
94
|
--dt-color-interactive-form: var(--dt-color-mozzarella-60);
|
|
95
|
+
--dt-color-interactive-error: var(--dt-color-red);
|
|
92
96
|
--dt-color-overlay: rgb(0,0,0,0.55);
|
|
93
97
|
--dt-color-support-error: var(--dt-color-red);
|
|
94
98
|
--dt-color-support-warning: var(--dt-color-yellow);
|
|
@@ -101,6 +105,9 @@
|
|
|
101
105
|
--dt-color-support-info-02: var(--dt-color-blue-10);
|
|
102
106
|
--dt-color-support-info-inverse: var(--dt-color-blue-30);
|
|
103
107
|
--dt-color-support-positive-inverse: var(--dt-color-green-30);
|
|
108
|
+
--dt-color-support-neutral-persistent: var(--dt-color-mozzarella-20);
|
|
109
|
+
--dt-color-support-error-inverse: var(--dt-color-red-40);
|
|
110
|
+
--dt-color-support-warning-inverse: var(--dt-color-yellow);
|
|
104
111
|
--dt-color-support-brand-01: var(--dt-color-orange-30);
|
|
105
112
|
--dt-color-support-brand-02: var(--dt-color-orange-10);
|
|
106
113
|
--dt-color-support-brand-03: var(--dt-color-blue-25);
|
|
@@ -145,6 +152,7 @@
|
|
|
145
152
|
--dt-color-active-01-dark: 12%;
|
|
146
153
|
--dt-color-active-02: 20%;
|
|
147
154
|
--dt-color-active-02-light: 20%;
|
|
155
|
+
--dt-color-resting: 0%;
|
|
148
156
|
--dt-color-focus-inner: var(--dt-color-white);
|
|
149
157
|
--dt-color-focus-outer: var(--dt-color-blue-70);
|
|
150
158
|
--dt-color-disabled-01: var(--dt-color-mozzarella-20);
|
|
@@ -152,6 +160,9 @@
|
|
|
152
160
|
--dt-color-skeleton-01: var(--dt-color-mozzarella-10);
|
|
153
161
|
--dt-color-skeleton-02: var(--dt-color-mozzarella-20);
|
|
154
162
|
--dt-color-skeleton-03: var(--dt-color-white);
|
|
163
|
+
--dt-color-skeleton-shimmer-01: var(--dt-color-mozzarella-5);
|
|
164
|
+
--dt-color-skeleton-shimmer-02: var(--dt-color-mozzarella-5);
|
|
165
|
+
--dt-color-skeleton-shimmer-03: var(--dt-color-mozzarella-10);
|
|
155
166
|
/* Highcontrast color theme */
|
|
156
167
|
--dt-color-highcontrast-background-default: var(--dt-color-white);
|
|
157
168
|
--dt-color-highcontrast-background-subtle: var(--dt-color-white);
|
|
@@ -167,6 +178,7 @@
|
|
|
167
178
|
--dt-color-highcontrast-border-strong: var(--dt-color-black);
|
|
168
179
|
--dt-color-highcontrast-border-inverse: var(--dt-color-white);
|
|
169
180
|
--dt-color-highcontrast-border-selected: var(--dt-color-black);
|
|
181
|
+
--dt-color-highcontrast-border-selected-brand: var(--dt-color-orange-dark-hc);
|
|
170
182
|
--dt-color-highcontrast-divider-default: var(--dt-color-black);
|
|
171
183
|
--dt-color-highcontrast-divider-inverse: var(--dt-color-white);
|
|
172
184
|
--dt-color-highcontrast-interactive-brand: var(--dt-color-orange-dark-hc);
|
|
@@ -175,6 +187,7 @@
|
|
|
175
187
|
--dt-color-highcontrast-interactive-inverse: var(--dt-color-white);
|
|
176
188
|
--dt-color-highcontrast-interactive-light: var(--dt-color-white);
|
|
177
189
|
--dt-color-highcontrast-interactive-form: var(--dt-color-black);
|
|
190
|
+
--dt-color-highcontrast-interactive-error: var(--dt-color-red);
|
|
178
191
|
--dt-color-highcontrast-overlay: rgb(0,0,0,0.55);
|
|
179
192
|
--dt-color-highcontrast-support-error: var(--dt-color-red-dark-hc);
|
|
180
193
|
--dt-color-highcontrast-support-warning: var(--dt-color-yellow-dark-hc);
|
|
@@ -187,6 +200,9 @@
|
|
|
187
200
|
--dt-color-highcontrast-support-info-02: var(--dt-color-white);
|
|
188
201
|
--dt-color-highcontrast-support-info-inverse: var(--dt-color-blue-light-hc);
|
|
189
202
|
--dt-color-highcontrast-support-positive-inverse: var(--dt-color-green-light-hc);
|
|
203
|
+
--dt-color-highcontrast-support-neutral-persistent: var(--dt-color-white);
|
|
204
|
+
--dt-color-highcontrast-support-error-inverse: var(--dt-color-red-light-hc);
|
|
205
|
+
--dt-color-highcontrast-support-warning-inverse: var(--dt-color-yellow);
|
|
190
206
|
--dt-color-highcontrast-support-brand-01: var(--dt-color-orange-30);
|
|
191
207
|
--dt-color-highcontrast-support-brand-02: var(--dt-color-white);
|
|
192
208
|
--dt-color-highcontrast-support-brand-03: var(--dt-color-white);
|
|
@@ -231,6 +247,7 @@
|
|
|
231
247
|
--dt-color-highcontrast-active-01-dark: 12%;
|
|
232
248
|
--dt-color-highcontrast-active-02: 20%;
|
|
233
249
|
--dt-color-highcontrast-active-02-light: 20%;
|
|
250
|
+
--dt-color-highcontrast-resting: 0%;
|
|
234
251
|
--dt-color-highcontrast-focus-inner: var(--dt-color-white);
|
|
235
252
|
--dt-color-highcontrast-focus-outer: var(--dt-color-blue-70);
|
|
236
253
|
--dt-color-highcontrast-disabled-01: var(--dt-color-mozzarella-20);
|
|
@@ -238,6 +255,9 @@
|
|
|
238
255
|
--dt-color-highcontrast-skeleton-01: var(--dt-color-mozzarella-10);
|
|
239
256
|
--dt-color-highcontrast-skeleton-02: var(--dt-color-mozzarella-20);
|
|
240
257
|
--dt-color-highcontrast-skeleton-03: var(--dt-color-white);
|
|
258
|
+
--dt-color-highcontrast-skeleton-shimmer-01: var(--dt-color-mozzarella-5);
|
|
259
|
+
--dt-color-highcontrast-skeleton-shimmer-02: var(--dt-color-mozzarella-5);
|
|
260
|
+
--dt-color-highcontrast-skeleton-shimmer-03: var(--dt-color-mozzarella-10);
|
|
241
261
|
/* Dark color theme */
|
|
242
262
|
--dt-color-dark-background-default: var(--dt-color-mozzarella-100);
|
|
243
263
|
--dt-color-dark-background-subtle: var(--dt-color-mozzarella-80);
|
|
@@ -253,6 +273,7 @@
|
|
|
253
273
|
--dt-color-dark-border-strong: var(--dt-color-mozzarella-60);
|
|
254
274
|
--dt-color-dark-border-inverse: var(--dt-color-mozzarella-20);
|
|
255
275
|
--dt-color-dark-border-selected: var(--dt-color-mozzarella-30);
|
|
276
|
+
--dt-color-dark-border-selected-brand: var(--dt-color-orange);
|
|
256
277
|
--dt-color-dark-divider-default: rgb(255,255,255,0.20);
|
|
257
278
|
--dt-color-dark-divider-inverse: rgb(0,0,0,0.08);
|
|
258
279
|
--dt-color-dark-interactive-brand: var(--dt-color-orange);
|
|
@@ -261,8 +282,9 @@
|
|
|
261
282
|
--dt-color-dark-interactive-inverse: var(--dt-color-mozzarella-90);
|
|
262
283
|
--dt-color-dark-interactive-light: var(--dt-color-white);
|
|
263
284
|
--dt-color-dark-interactive-form: var(--dt-color-mozzarella-50);
|
|
285
|
+
--dt-color-dark-interactive-error: var(--dt-color-red-40);
|
|
264
286
|
--dt-color-dark-overlay: rgb(0,0,0,0.55);
|
|
265
|
-
--dt-color-dark-support-error: var(--dt-color-red);
|
|
287
|
+
--dt-color-dark-support-error: var(--dt-color-red-40);
|
|
266
288
|
--dt-color-dark-support-warning: var(--dt-color-yellow);
|
|
267
289
|
--dt-color-dark-support-positive: var(--dt-color-green-30);
|
|
268
290
|
--dt-color-dark-support-info: var(--dt-color-blue-30);
|
|
@@ -273,6 +295,9 @@
|
|
|
273
295
|
--dt-color-dark-support-info-02: var(--dt-color-blue-90);
|
|
274
296
|
--dt-color-dark-support-info-inverse: var(--dt-color-blue);
|
|
275
297
|
--dt-color-dark-support-positive-inverse: var(--dt-color-green);
|
|
298
|
+
--dt-color-dark-support-neutral-persistent: var(--dt-color-mozzarella-20);
|
|
299
|
+
--dt-color-dark-support-error-inverse: var(--dt-color-red);
|
|
300
|
+
--dt-color-dark-support-warning-inverse: var(--dt-color-turmeric-60);
|
|
276
301
|
--dt-color-dark-support-brand-01: var(--dt-color-orange-30);
|
|
277
302
|
--dt-color-dark-support-brand-02: var(--dt-color-orange-90);
|
|
278
303
|
--dt-color-dark-support-brand-03: var(--dt-color-blue-25);
|
|
@@ -317,13 +342,17 @@
|
|
|
317
342
|
--dt-color-dark-active-01-dark: 12%;
|
|
318
343
|
--dt-color-dark-active-02: 12%;
|
|
319
344
|
--dt-color-dark-active-02-light: 20%;
|
|
345
|
+
--dt-color-dark-resting: 0%;
|
|
320
346
|
--dt-color-dark-focus-inner: var(--dt-color-black);
|
|
321
347
|
--dt-color-dark-focus-outer: var(--dt-color-blue-30);
|
|
322
348
|
--dt-color-dark-disabled-01: var(--dt-color-mozzarella-80);
|
|
323
349
|
--dt-color-dark-disabled-01-inverse: var(--dt-color-mozzarella-20);
|
|
324
350
|
--dt-color-dark-skeleton-01: var(--dt-color-mozzarella-80);
|
|
325
|
-
--dt-color-dark-skeleton-02: var(--dt-color-mozzarella-
|
|
351
|
+
--dt-color-dark-skeleton-02: var(--dt-color-mozzarella-75);
|
|
326
352
|
--dt-color-dark-skeleton-03: var(--dt-color-mozzarella-90);
|
|
353
|
+
--dt-color-dark-skeleton-shimmer-01: var(--dt-color-mozzarella-75);
|
|
354
|
+
--dt-color-dark-skeleton-shimmer-02: var(--dt-color-mozzarella-70);
|
|
355
|
+
--dt-color-dark-skeleton-shimmer-03: var(--dt-color-mozzarella-80);
|
|
327
356
|
/* Highcontrast-dark color theme */
|
|
328
357
|
--dt-color-highcontrast-dark-background-default: var(--dt-color-black);
|
|
329
358
|
--dt-color-highcontrast-dark-background-subtle: var(--dt-color-black);
|
|
@@ -339,6 +368,7 @@
|
|
|
339
368
|
--dt-color-highcontrast-dark-border-strong: var(--dt-color-white);
|
|
340
369
|
--dt-color-highcontrast-dark-border-inverse: var(--dt-color-black);
|
|
341
370
|
--dt-color-highcontrast-dark-border-selected: var(--dt-color-white);
|
|
371
|
+
--dt-color-highcontrast-dark-border-selected-brand: var(--dt-color-orange-30);
|
|
342
372
|
--dt-color-highcontrast-dark-divider-default: var(--dt-color-white);
|
|
343
373
|
--dt-color-highcontrast-dark-divider-inverse: var(--dt-color-black);
|
|
344
374
|
--dt-color-highcontrast-dark-interactive-brand: var(--dt-color-orange-30);
|
|
@@ -347,6 +377,7 @@
|
|
|
347
377
|
--dt-color-highcontrast-dark-interactive-inverse: var(--dt-color-black);
|
|
348
378
|
--dt-color-highcontrast-dark-interactive-light: var(--dt-color-white);
|
|
349
379
|
--dt-color-highcontrast-dark-interactive-form: var(--dt-color-white);
|
|
380
|
+
--dt-color-highcontrast-dark-interactive-error: var(--dt-color-red-40);
|
|
350
381
|
--dt-color-highcontrast-dark-overlay: rgb(0,0,0,0.55);
|
|
351
382
|
--dt-color-highcontrast-dark-support-error: var(--dt-color-red-light-hc);
|
|
352
383
|
--dt-color-highcontrast-dark-support-warning: var(--dt-color-yellow);
|
|
@@ -359,6 +390,9 @@
|
|
|
359
390
|
--dt-color-highcontrast-dark-support-info-02: var(--dt-color-black);
|
|
360
391
|
--dt-color-highcontrast-dark-support-info-inverse: var(--dt-color-blue-dark-hc);
|
|
361
392
|
--dt-color-highcontrast-dark-support-positive-inverse: var(--dt-color-green-dark-hc);
|
|
393
|
+
--dt-color-highcontrast-dark-support-neutral-persistent: var(--dt-color-black);
|
|
394
|
+
--dt-color-highcontrast-dark-support-error-inverse: var(--dt-color-red-dark-hc);
|
|
395
|
+
--dt-color-highcontrast-dark-support-warning-inverse: var(--dt-color-turmeric-60);
|
|
362
396
|
--dt-color-highcontrast-dark-support-brand-01: var(--dt-color-orange-30);
|
|
363
397
|
--dt-color-highcontrast-dark-support-brand-02: var(--dt-color-black);
|
|
364
398
|
--dt-color-highcontrast-dark-support-brand-03: var(--dt-color-black);
|
|
@@ -403,6 +437,7 @@
|
|
|
403
437
|
--dt-color-highcontrast-dark-active-01-dark: 12%;
|
|
404
438
|
--dt-color-highcontrast-dark-active-02: 12%;
|
|
405
439
|
--dt-color-highcontrast-dark-active-02-light: 20%;
|
|
440
|
+
--dt-color-highcontrast-dark-resting: 0%;
|
|
406
441
|
--dt-color-highcontrast-dark-focus-inner: var(--dt-color-black);
|
|
407
442
|
--dt-color-highcontrast-dark-focus-outer: var(--dt-color-blue-30);
|
|
408
443
|
--dt-color-highcontrast-dark-disabled-01: var(--dt-color-mozzarella-80);
|
|
@@ -410,6 +445,9 @@
|
|
|
410
445
|
--dt-color-highcontrast-dark-skeleton-01: var(--dt-color-mozzarella-80);
|
|
411
446
|
--dt-color-highcontrast-dark-skeleton-02: var(--dt-color-mozzarella-100);
|
|
412
447
|
--dt-color-highcontrast-dark-skeleton-03: var(--dt-color-mozzarella-90);
|
|
448
|
+
--dt-color-highcontrast-dark-skeleton-shimmer-01: var(--dt-color-mozzarella-75);
|
|
449
|
+
--dt-color-highcontrast-dark-skeleton-shimmer-02: var(--dt-color-mozzarella-70);
|
|
450
|
+
--dt-color-highcontrast-dark-skeleton-shimmer-03: var(--dt-color-mozzarella-80);
|
|
413
451
|
/* Global tokens - Font */
|
|
414
452
|
--dt-font-family-code: 'PTMono';
|
|
415
453
|
--dt-font-family-primary: 'JetSansDigital';
|
|
@@ -426,9 +464,6 @@
|
|
|
426
464
|
/* Size-16 font theme */
|
|
427
465
|
--dt-font-size-16: 16;
|
|
428
466
|
--dt-font-size-16-line-height: 24;
|
|
429
|
-
/* Size-19 font theme */
|
|
430
|
-
--dt-font-size-19: 19;
|
|
431
|
-
--dt-font-size-19-line-height: 28;
|
|
432
467
|
/* Size-20 font theme */
|
|
433
468
|
--dt-font-size-20: 20;
|
|
434
469
|
--dt-font-size-20-line-height: 28;
|
|
@@ -508,11 +543,6 @@
|
|
|
508
543
|
--dt-font-interactive-s-family: var(--dt-font-family-primary);
|
|
509
544
|
--dt-font-interactive-s-weight: var(--dt-font-weight-bold);
|
|
510
545
|
--dt-font-interactive-s-line-height: var(--dt-font-size-16-line-height);
|
|
511
|
-
/* Interactive-m font theme */
|
|
512
|
-
--dt-font-interactive-m-size: var(--dt-font-size-19);
|
|
513
|
-
--dt-font-interactive-m-family: var(--dt-font-family-primary);
|
|
514
|
-
--dt-font-interactive-m-weight: var(--dt-font-weight-bold);
|
|
515
|
-
--dt-font-interactive-m-line-height: var(--dt-font-size-19-line-height);
|
|
516
546
|
/* Interactive-l font theme */
|
|
517
547
|
--dt-font-interactive-l-size: var(--dt-font-size-20);
|
|
518
548
|
--dt-font-interactive-l-family: var(--dt-font-family-primary);
|
|
@@ -610,6 +640,17 @@
|
|
|
610
640
|
--dt-radius-rounded-c: var(--dt-radius-04);
|
|
611
641
|
--dt-radius-rounded-d: var(--dt-radius-05);
|
|
612
642
|
--dt-radius-rounded-e: var(--dt-radius-06);
|
|
643
|
+
/* Global tokens - Motion */
|
|
644
|
+
--dt-motion-easing-in: cubic-bezier(0.8, 0, 1, 1);
|
|
645
|
+
--dt-motion-easing-out: cubic-bezier(0, 0, 0.18, 0.99);
|
|
646
|
+
--dt-motion-easing-persistent-expressive: cubic-bezier(0.95, 0, 0, 0.95);
|
|
647
|
+
--dt-motion-easing-persistent-functional: cubic-bezier(0.45, 0, 0.55, 1);
|
|
648
|
+
--dt-motion-timing-100: 100ms;
|
|
649
|
+
--dt-motion-timing-150: 150ms;
|
|
650
|
+
--dt-motion-timing-200: 200ms;
|
|
651
|
+
--dt-motion-timing-250: 250ms;
|
|
652
|
+
--dt-motion-timing-300: 300ms;
|
|
653
|
+
--dt-motion-timing-350: 350ms;
|
|
613
654
|
/* Global tokens - Spacing */
|
|
614
655
|
--dt-spacing-10: 80px;
|
|
615
656
|
--dt-spacing-00: 0;
|
|
@@ -824,9 +865,12 @@
|
|
|
824
865
|
--dt-color-red-25-h: 352;
|
|
825
866
|
--dt-color-red-25-s: 74.5%;
|
|
826
867
|
--dt-color-red-25-l: 80%;
|
|
827
|
-
--dt-color-red-30-h:
|
|
828
|
-
--dt-color-red-30-s:
|
|
829
|
-
--dt-color-red-30-l:
|
|
868
|
+
--dt-color-red-30-h: 4;
|
|
869
|
+
--dt-color-red-30-s: 87.4%;
|
|
870
|
+
--dt-color-red-30-l: 72%;
|
|
871
|
+
--dt-color-red-40-h: 354;
|
|
872
|
+
--dt-color-red-40-s: 75.8%;
|
|
873
|
+
--dt-color-red-40-l: 52.9%;
|
|
830
874
|
--dt-color-red-90-h: 352;
|
|
831
875
|
--dt-color-red-90-s: 41.7%;
|
|
832
876
|
--dt-color-red-90-l: 20.2%;
|
|
@@ -851,6 +895,9 @@
|
|
|
851
895
|
--dt-color-turmeric-5-h: 49;
|
|
852
896
|
--dt-color-turmeric-5-s: 100%;
|
|
853
897
|
--dt-color-turmeric-5-l: 93.5%;
|
|
898
|
+
--dt-color-turmeric-60-h: 43;
|
|
899
|
+
--dt-color-turmeric-60-s: 91%;
|
|
900
|
+
--dt-color-turmeric-60-l: 39.2%;
|
|
854
901
|
--dt-color-turmeric-80-h: 43;
|
|
855
902
|
--dt-color-turmeric-80-s: 100%;
|
|
856
903
|
--dt-color-turmeric-80-l: 22.7%;
|
|
@@ -911,6 +958,9 @@
|
|
|
911
958
|
--dt-color-border-selected-h: var(--dt-color-mozzarella-50-h);
|
|
912
959
|
--dt-color-border-selected-s: var(--dt-color-mozzarella-50-s);
|
|
913
960
|
--dt-color-border-selected-l: var(--dt-color-mozzarella-50-l);
|
|
961
|
+
--dt-color-border-selected-brand-h: var(--dt-color-orange-h);
|
|
962
|
+
--dt-color-border-selected-brand-s: var(--dt-color-orange-s);
|
|
963
|
+
--dt-color-border-selected-brand-l: var(--dt-color-orange-l);
|
|
914
964
|
--dt-color-interactive-brand-h: var(--dt-color-orange-h);
|
|
915
965
|
--dt-color-interactive-brand-s: var(--dt-color-orange-s);
|
|
916
966
|
--dt-color-interactive-brand-l: var(--dt-color-orange-l);
|
|
@@ -929,6 +979,9 @@
|
|
|
929
979
|
--dt-color-interactive-form-h: var(--dt-color-mozzarella-60-h);
|
|
930
980
|
--dt-color-interactive-form-s: var(--dt-color-mozzarella-60-s);
|
|
931
981
|
--dt-color-interactive-form-l: var(--dt-color-mozzarella-60-l);
|
|
982
|
+
--dt-color-interactive-error-h: var(--dt-color-red-h);
|
|
983
|
+
--dt-color-interactive-error-s: var(--dt-color-red-s);
|
|
984
|
+
--dt-color-interactive-error-l: var(--dt-color-red-l);
|
|
932
985
|
--dt-color-support-error-h: var(--dt-color-red-h);
|
|
933
986
|
--dt-color-support-error-s: var(--dt-color-red-s);
|
|
934
987
|
--dt-color-support-error-l: var(--dt-color-red-l);
|
|
@@ -962,6 +1015,15 @@
|
|
|
962
1015
|
--dt-color-support-positive-inverse-h: var(--dt-color-green-30-h);
|
|
963
1016
|
--dt-color-support-positive-inverse-s: var(--dt-color-green-30-s);
|
|
964
1017
|
--dt-color-support-positive-inverse-l: var(--dt-color-green-30-l);
|
|
1018
|
+
--dt-color-support-neutral-persistent-h: var(--dt-color-mozzarella-20-h);
|
|
1019
|
+
--dt-color-support-neutral-persistent-s: var(--dt-color-mozzarella-20-s);
|
|
1020
|
+
--dt-color-support-neutral-persistent-l: var(--dt-color-mozzarella-20-l);
|
|
1021
|
+
--dt-color-support-error-inverse-h: var(--dt-color-red-40-h);
|
|
1022
|
+
--dt-color-support-error-inverse-s: var(--dt-color-red-40-s);
|
|
1023
|
+
--dt-color-support-error-inverse-l: var(--dt-color-red-40-l);
|
|
1024
|
+
--dt-color-support-warning-inverse-h: var(--dt-color-yellow-h);
|
|
1025
|
+
--dt-color-support-warning-inverse-s: var(--dt-color-yellow-s);
|
|
1026
|
+
--dt-color-support-warning-inverse-l: var(--dt-color-yellow-l);
|
|
965
1027
|
--dt-color-support-brand-01-h: var(--dt-color-orange-30-h);
|
|
966
1028
|
--dt-color-support-brand-01-s: var(--dt-color-orange-30-s);
|
|
967
1029
|
--dt-color-support-brand-01-l: var(--dt-color-orange-30-l);
|
|
@@ -1091,6 +1153,15 @@
|
|
|
1091
1153
|
--dt-color-skeleton-03-h: var(--dt-color-white-h);
|
|
1092
1154
|
--dt-color-skeleton-03-s: var(--dt-color-white-s);
|
|
1093
1155
|
--dt-color-skeleton-03-l: var(--dt-color-white-l);
|
|
1156
|
+
--dt-color-skeleton-shimmer-01-h: var(--dt-color-mozzarella-5-h);
|
|
1157
|
+
--dt-color-skeleton-shimmer-01-s: var(--dt-color-mozzarella-5-s);
|
|
1158
|
+
--dt-color-skeleton-shimmer-01-l: var(--dt-color-mozzarella-5-l);
|
|
1159
|
+
--dt-color-skeleton-shimmer-02-h: var(--dt-color-mozzarella-5-h);
|
|
1160
|
+
--dt-color-skeleton-shimmer-02-s: var(--dt-color-mozzarella-5-s);
|
|
1161
|
+
--dt-color-skeleton-shimmer-02-l: var(--dt-color-mozzarella-5-l);
|
|
1162
|
+
--dt-color-skeleton-shimmer-03-h: var(--dt-color-mozzarella-10-h);
|
|
1163
|
+
--dt-color-skeleton-shimmer-03-s: var(--dt-color-mozzarella-10-s);
|
|
1164
|
+
--dt-color-skeleton-shimmer-03-l: var(--dt-color-mozzarella-10-l);
|
|
1094
1165
|
}
|
|
1095
1166
|
html {
|
|
1096
1167
|
box-sizing: border-box;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justeattakeaway/pie-css",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.1",
|
|
4
4
|
"description": "A styling library that provides both a shared collection of ready to use CSS styles to be used across JET web front-ends, and SCSS-based style helpers for our PIE Web Component library.",
|
|
5
5
|
"author": "Just Eat Takeaway.com - Design System Team",
|
|
6
6
|
"files": [
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"license": "Apache-2.0",
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/postcss-import": "14.0.3",
|
|
31
|
+
"include-media": "2.0.0",
|
|
31
32
|
"postcss": "8.4.32",
|
|
32
33
|
"postcss-import": "15.1.0",
|
|
33
34
|
"w3c-css-validator": "1.3.1"
|
package/scss/index.scss
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Interval settings to be used by @include-media Sass library
|
|
2
|
+
// https://eduardoboucas.github.io/include-media/documentation/#variable-unit-intervals
|
|
3
|
+
$unit-intervals: (
|
|
4
|
+
'px': 1,
|
|
5
|
+
'em': 0.001, // We need more sensitivity, some browsers are very specific with breakpoints
|
|
6
|
+
'rem': 0.1,
|
|
7
|
+
'': 0
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
// Breakpoints to be used by @include-media Sass library
|
|
11
|
+
// https://eduardoboucas.github.io/include-media/documentation/#variable-breakpoints
|
|
12
|
+
$breakpoints: (
|
|
13
|
+
xs: 320px,
|
|
14
|
+
sm: 600px,
|
|
15
|
+
md: 768px,
|
|
16
|
+
lg: 1024px,
|
|
17
|
+
xl: 1280px,
|
|
18
|
+
xxl: 1440px
|
|
19
|
+
);
|
|
@@ -0,0 +1,596 @@
|
|
|
1
|
+
//
|
|
2
|
+
// !IMPORTANT: This file is a copy of the original include-media SCSS library
|
|
3
|
+
// !DO NOT directly edit this file/
|
|
4
|
+
//
|
|
5
|
+
// _ _ _ _ _
|
|
6
|
+
// (_) | | | | | (_)
|
|
7
|
+
// _ _ __ ___| |_ _ __| | ___ _ __ ___ ___ __| |_ __ _
|
|
8
|
+
// | | '_ \ / __| | | | |/ _` |/ _ \ | '_ ` _ \ / _ \/ _` | |/ _` |
|
|
9
|
+
// | | | | | (__| | |_| | (_| | __/ | | | | | | __/ (_| | | (_| |
|
|
10
|
+
// |_|_| |_|\___|_|\__,_|\__,_|\___| |_| |_| |_|\___|\__,_|_|\__,_|
|
|
11
|
+
//
|
|
12
|
+
// Simple, elegant and maintainable media queries in Sass
|
|
13
|
+
// v2.0.0
|
|
14
|
+
//
|
|
15
|
+
// https://eduardoboucas.github.io/include-media
|
|
16
|
+
//
|
|
17
|
+
// Authors: Eduardo Boucas (@eduardoboucas)
|
|
18
|
+
// Kitty Giraudel (@kittygiraudel)
|
|
19
|
+
//
|
|
20
|
+
// This project is licensed under the terms of the MIT license
|
|
21
|
+
@charset "UTF-8";
|
|
22
|
+
|
|
23
|
+
////
|
|
24
|
+
/// include-media library public configuration
|
|
25
|
+
/// @author Eduardo Boucas
|
|
26
|
+
/// @access public
|
|
27
|
+
////
|
|
28
|
+
@use 'sass:math';
|
|
29
|
+
@use 'sass:map';
|
|
30
|
+
@use 'sass:list';
|
|
31
|
+
@use 'sass:string';
|
|
32
|
+
@use 'sass:meta';
|
|
33
|
+
|
|
34
|
+
///
|
|
35
|
+
/// Creates a list of global breakpoints
|
|
36
|
+
///
|
|
37
|
+
/// @example scss - Creates a single breakpoint with the label `phone`
|
|
38
|
+
/// $breakpoints: ('phone': 320px);
|
|
39
|
+
///
|
|
40
|
+
$breakpoints: (
|
|
41
|
+
'phone': 320px,
|
|
42
|
+
'tablet': 768px,
|
|
43
|
+
'desktop': 1024px,
|
|
44
|
+
) !default;
|
|
45
|
+
|
|
46
|
+
///
|
|
47
|
+
/// Creates a list of static expressions or media types
|
|
48
|
+
///
|
|
49
|
+
/// @example scss - Creates a single media type (screen)
|
|
50
|
+
/// $media-expressions: ('screen': 'screen');
|
|
51
|
+
///
|
|
52
|
+
/// @example scss - Creates a static expression with logical disjunction (OR operator)
|
|
53
|
+
/// $media-expressions: (
|
|
54
|
+
/// 'retina2x': '(-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi)'
|
|
55
|
+
/// );
|
|
56
|
+
///
|
|
57
|
+
$media-expressions: (
|
|
58
|
+
'screen': 'screen',
|
|
59
|
+
'print': 'print',
|
|
60
|
+
'handheld': 'handheld',
|
|
61
|
+
'landscape': '(orientation: landscape)',
|
|
62
|
+
'portrait': '(orientation: portrait)',
|
|
63
|
+
'retina2x':
|
|
64
|
+
'(-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi), (min-resolution: 2dppx)',
|
|
65
|
+
'retina3x':
|
|
66
|
+
'(-webkit-min-device-pixel-ratio: 3), (min-resolution: 350dpi), (min-resolution: 3dppx)',
|
|
67
|
+
) !default;
|
|
68
|
+
|
|
69
|
+
///
|
|
70
|
+
/// Defines a number to be added or subtracted from each unit when declaring breakpoints with exclusive intervals
|
|
71
|
+
///
|
|
72
|
+
/// @example scss - Interval for pixels is defined as `1` by default
|
|
73
|
+
/// @include media('>128px') {}
|
|
74
|
+
///
|
|
75
|
+
/// /* Generates: */
|
|
76
|
+
/// @media (min-width: 129px) {}
|
|
77
|
+
///
|
|
78
|
+
/// @example scss - Interval for ems is defined as `0.01` by default
|
|
79
|
+
/// @include media('>20em') {}
|
|
80
|
+
///
|
|
81
|
+
/// /* Generates: */
|
|
82
|
+
/// @media (min-width: 20.01em) {}
|
|
83
|
+
///
|
|
84
|
+
/// @example scss - Interval for rems is defined as `0.1` by default, to be used with `font-size: 62.5%;`
|
|
85
|
+
/// @include media('>2.0rem') {}
|
|
86
|
+
///
|
|
87
|
+
/// /* Generates: */
|
|
88
|
+
/// @media (min-width: 2.1rem) {}
|
|
89
|
+
///
|
|
90
|
+
$unit-intervals: (
|
|
91
|
+
'px': 1,
|
|
92
|
+
'em': 0.01,
|
|
93
|
+
'rem': 0.1,
|
|
94
|
+
'': 0,
|
|
95
|
+
) !default;
|
|
96
|
+
|
|
97
|
+
///
|
|
98
|
+
/// Defines whether support for media queries is available, useful for creating separate stylesheets
|
|
99
|
+
/// for browsers that don't support media queries.
|
|
100
|
+
///
|
|
101
|
+
/// @example scss - Disables support for media queries
|
|
102
|
+
/// $im-media-support: false;
|
|
103
|
+
/// @include media('>=tablet') {
|
|
104
|
+
/// .foo {
|
|
105
|
+
/// color: tomato;
|
|
106
|
+
/// }
|
|
107
|
+
/// }
|
|
108
|
+
///
|
|
109
|
+
/// /* Generates: */
|
|
110
|
+
/// .foo {
|
|
111
|
+
/// color: tomato;
|
|
112
|
+
/// }
|
|
113
|
+
///
|
|
114
|
+
$im-media-support: true !default;
|
|
115
|
+
|
|
116
|
+
///
|
|
117
|
+
/// Selects which breakpoint to emulate when support for media queries is disabled. Media queries that start at or
|
|
118
|
+
/// intercept the breakpoint will be displayed, any others will be ignored.
|
|
119
|
+
///
|
|
120
|
+
/// @example scss - This media query will show because it intercepts the static breakpoint
|
|
121
|
+
/// $im-media-support: false;
|
|
122
|
+
/// $im-no-media-breakpoint: 'desktop';
|
|
123
|
+
/// @include media('>=tablet') {
|
|
124
|
+
/// .foo {
|
|
125
|
+
/// color: tomato;
|
|
126
|
+
/// }
|
|
127
|
+
/// }
|
|
128
|
+
///
|
|
129
|
+
/// /* Generates: */
|
|
130
|
+
/// .foo {
|
|
131
|
+
/// color: tomato;
|
|
132
|
+
/// }
|
|
133
|
+
///
|
|
134
|
+
/// @example scss - This media query will NOT show because it does not intercept the desktop breakpoint
|
|
135
|
+
/// $im-media-support: false;
|
|
136
|
+
/// $im-no-media-breakpoint: 'tablet';
|
|
137
|
+
/// @include media('>=desktop') {
|
|
138
|
+
/// .foo {
|
|
139
|
+
/// color: tomato;
|
|
140
|
+
/// }
|
|
141
|
+
/// }
|
|
142
|
+
///
|
|
143
|
+
/// /* No output */
|
|
144
|
+
///
|
|
145
|
+
$im-no-media-breakpoint: 'desktop' !default;
|
|
146
|
+
|
|
147
|
+
///
|
|
148
|
+
/// Selects which media expressions are allowed in an expression for it to be used when media queries
|
|
149
|
+
/// are not supported.
|
|
150
|
+
///
|
|
151
|
+
/// @example scss - This media query will show because it intercepts the static breakpoint and contains only accepted media expressions
|
|
152
|
+
/// $im-media-support: false;
|
|
153
|
+
/// $im-no-media-breakpoint: 'desktop';
|
|
154
|
+
/// $im-no-media-expressions: ('screen');
|
|
155
|
+
/// @include media('>=tablet', 'screen') {
|
|
156
|
+
/// .foo {
|
|
157
|
+
/// color: tomato;
|
|
158
|
+
/// }
|
|
159
|
+
/// }
|
|
160
|
+
///
|
|
161
|
+
/// /* Generates: */
|
|
162
|
+
/// .foo {
|
|
163
|
+
/// color: tomato;
|
|
164
|
+
/// }
|
|
165
|
+
///
|
|
166
|
+
/// @example scss - This media query will NOT show because it intercepts the static breakpoint but contains a media expression that is not accepted
|
|
167
|
+
/// $im-media-support: false;
|
|
168
|
+
/// $im-no-media-breakpoint: 'desktop';
|
|
169
|
+
/// $im-no-media-expressions: ('screen');
|
|
170
|
+
/// @include media('>=tablet', 'retina2x') {
|
|
171
|
+
/// .foo {
|
|
172
|
+
/// color: tomato;
|
|
173
|
+
/// }
|
|
174
|
+
/// }
|
|
175
|
+
///
|
|
176
|
+
/// /* No output */
|
|
177
|
+
///
|
|
178
|
+
$im-no-media-expressions: ('screen', 'portrait', 'landscape') !default;
|
|
179
|
+
|
|
180
|
+
////
|
|
181
|
+
/// Cross-engine logging engine
|
|
182
|
+
/// @author Kitty Giraudel
|
|
183
|
+
/// @access private
|
|
184
|
+
////
|
|
185
|
+
|
|
186
|
+
///
|
|
187
|
+
/// Log a message either with `@error` if supported
|
|
188
|
+
/// else with `@warn`, using `feature-exists('at-error')`
|
|
189
|
+
/// to detect support.
|
|
190
|
+
///
|
|
191
|
+
/// @param {String} $message - Message to log
|
|
192
|
+
///
|
|
193
|
+
@function im-log($message) {
|
|
194
|
+
@if meta.feature-exists('at-error') {
|
|
195
|
+
@error $message;
|
|
196
|
+
} @else {
|
|
197
|
+
@warn $message;
|
|
198
|
+
|
|
199
|
+
$_: noop();
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
@return $message;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
///
|
|
206
|
+
/// Wrapper mixin for the log function so it can be used with a more friendly
|
|
207
|
+
/// API than `@if im-log('..') {}` or `$_: im-log('..')`. Basically, use the function
|
|
208
|
+
/// within functions because it is not possible to include a mixin in a function
|
|
209
|
+
/// and use the mixin everywhere else because it's much more elegant.
|
|
210
|
+
///
|
|
211
|
+
/// @param {String} $message - Message to log
|
|
212
|
+
///
|
|
213
|
+
@mixin log($message) {
|
|
214
|
+
@if im-log($message) {
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
///
|
|
219
|
+
/// Function with no `@return` called next to `@warn` in Sass 3.3
|
|
220
|
+
/// to trigger a compiling error and stop the process.
|
|
221
|
+
///
|
|
222
|
+
@function noop() {
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
///
|
|
226
|
+
/// Determines whether a list of conditions is intercepted by the static breakpoint.
|
|
227
|
+
///
|
|
228
|
+
/// @param {Arglist} $conditions - Media query conditions
|
|
229
|
+
///
|
|
230
|
+
/// @return {Boolean} - Returns true if the conditions are intercepted by the static breakpoint
|
|
231
|
+
///
|
|
232
|
+
@function im-intercepts-static-breakpoint($conditions...) {
|
|
233
|
+
$no-media-breakpoint-value: map.get($breakpoints, $im-no-media-breakpoint);
|
|
234
|
+
|
|
235
|
+
@if not $no-media-breakpoint-value {
|
|
236
|
+
@if im-log('`#{$im-no-media-breakpoint}` is not a valid breakpoint.') {
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
@each $condition in $conditions {
|
|
241
|
+
@if not map.has-key($media-expressions, $condition) {
|
|
242
|
+
$operator: get-expression-operator($condition);
|
|
243
|
+
$prefix: get-expression-prefix($operator);
|
|
244
|
+
$value: get-expression-value($condition, $operator);
|
|
245
|
+
|
|
246
|
+
@if ($prefix == 'max' and $value <= $no-media-breakpoint-value) or
|
|
247
|
+
($prefix == 'min' and $value > $no-media-breakpoint-value)
|
|
248
|
+
{
|
|
249
|
+
@return false;
|
|
250
|
+
}
|
|
251
|
+
} @else if not list.index($im-no-media-expressions, $condition) {
|
|
252
|
+
@return false;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
@return true;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
////
|
|
260
|
+
/// Parsing engine
|
|
261
|
+
/// @author Kitty Giraudel
|
|
262
|
+
/// @access private
|
|
263
|
+
////
|
|
264
|
+
|
|
265
|
+
///
|
|
266
|
+
/// Get operator of an expression
|
|
267
|
+
///
|
|
268
|
+
/// @param {String} $expression - Expression to extract operator from
|
|
269
|
+
///
|
|
270
|
+
/// @return {String} - Any of `>=`, `>`, `<=`, `<`, `≥`, `≤`
|
|
271
|
+
///
|
|
272
|
+
@function get-expression-operator($expression) {
|
|
273
|
+
@each $operator in ('>=', '>', '<=', '<', '≥', '≤') {
|
|
274
|
+
@if string.index($expression, $operator) {
|
|
275
|
+
@return $operator;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// It is not possible to include a mixin inside a function, so we have to
|
|
280
|
+
// rely on the `im-log(..)` function rather than the `log(..)` mixin. Because
|
|
281
|
+
// functions cannot be called anywhere in Sass, we need to hack the call in
|
|
282
|
+
// a dummy variable, such as `$_`. If anybody ever raise a scoping issue with
|
|
283
|
+
// Sass 3.3, change this line in `@if im-log(..) {}` instead.
|
|
284
|
+
$_: im-log('No operator found in `#{$expression}`.');
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
///
|
|
288
|
+
/// Get dimension of an expression, based on a found operator
|
|
289
|
+
///
|
|
290
|
+
/// @param {String} $expression - Expression to extract dimension from
|
|
291
|
+
/// @param {String} $operator - Operator from `$expression`
|
|
292
|
+
///
|
|
293
|
+
/// @return {String} - `width` or `height` (or potentially anything else)
|
|
294
|
+
///
|
|
295
|
+
@function get-expression-dimension($expression, $operator) {
|
|
296
|
+
$operator-index: string.index($expression, $operator);
|
|
297
|
+
$parsed-dimension: string.slice($expression, 0, $operator-index - 1);
|
|
298
|
+
$dimension: 'width';
|
|
299
|
+
|
|
300
|
+
@if string.length($parsed-dimension) > 0 {
|
|
301
|
+
$dimension: $parsed-dimension;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
@return $dimension;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
///
|
|
308
|
+
/// Get dimension prefix based on an operator
|
|
309
|
+
///
|
|
310
|
+
/// @param {String} $operator - Operator
|
|
311
|
+
///
|
|
312
|
+
/// @return {String} - `min` or `max`
|
|
313
|
+
///
|
|
314
|
+
@function get-expression-prefix($operator) {
|
|
315
|
+
@return if(list.index(('<', '<=', '≤'), $operator), 'max', 'min');
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
///
|
|
319
|
+
/// Get value of an expression, based on a found operator
|
|
320
|
+
///
|
|
321
|
+
/// @param {String} $expression - Expression to extract value from
|
|
322
|
+
/// @param {String} $operator - Operator from `$expression`
|
|
323
|
+
///
|
|
324
|
+
/// @return {Number} - A numeric value
|
|
325
|
+
///
|
|
326
|
+
@function get-expression-value($expression, $operator) {
|
|
327
|
+
$operator-index: string.index($expression, $operator);
|
|
328
|
+
$value: string.slice($expression, $operator-index + string.length($operator));
|
|
329
|
+
|
|
330
|
+
@if map.has-key($breakpoints, $value) {
|
|
331
|
+
$value: map.get($breakpoints, $value);
|
|
332
|
+
} @else {
|
|
333
|
+
$value: to-number($value);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
$interval: map.get($unit-intervals, math.unit($value));
|
|
337
|
+
|
|
338
|
+
@if not $interval {
|
|
339
|
+
// It is not possible to include a mixin inside a function, so we have to
|
|
340
|
+
// rely on the `im-log(..)` function rather than the `log(..)` mixin. Because
|
|
341
|
+
// functions cannot be called anywhere in Sass, we need to hack the call in
|
|
342
|
+
// a dummy variable, such as `$_`. If anybody ever raise a scoping issue with
|
|
343
|
+
// Sass 3.3, change this line in `@if im-log(..) {}` instead.
|
|
344
|
+
$_: im-log('Unknown unit `#{math.unit($value)}`.');
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
@if $operator == '>' {
|
|
348
|
+
$value: $value + $interval;
|
|
349
|
+
} @else if $operator == '<' {
|
|
350
|
+
$value: $value - $interval;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
@return $value;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
///
|
|
357
|
+
/// Parse an expression to return a valid media-query expression
|
|
358
|
+
///
|
|
359
|
+
/// @param {String} $expression - Expression to parse
|
|
360
|
+
///
|
|
361
|
+
/// @return {String} - Valid media query
|
|
362
|
+
///
|
|
363
|
+
@function parse-expression($expression) {
|
|
364
|
+
// If it is part of $media-expressions, it has no operator
|
|
365
|
+
// then there is no need to go any further, just return the value
|
|
366
|
+
@if map.has-key($media-expressions, $expression) {
|
|
367
|
+
@return map.get($media-expressions, $expression);
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
$operator: get-expression-operator($expression);
|
|
371
|
+
$dimension: get-expression-dimension($expression, $operator);
|
|
372
|
+
$prefix: get-expression-prefix($operator);
|
|
373
|
+
$value: get-expression-value($expression, $operator);
|
|
374
|
+
|
|
375
|
+
@return '(#{$prefix}-#{$dimension}: #{$value})';
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
///
|
|
379
|
+
/// Slice `$list` between `$start` and `$end` indexes
|
|
380
|
+
///
|
|
381
|
+
/// @access private
|
|
382
|
+
///
|
|
383
|
+
/// @param {List} $list - List to slice
|
|
384
|
+
/// @param {Number} $start [1] - Start index
|
|
385
|
+
/// @param {Number} $end [length($list)] - End index
|
|
386
|
+
///
|
|
387
|
+
/// @return {List} Sliced list
|
|
388
|
+
///
|
|
389
|
+
@function slice($list, $start: 1, $end: list.length($list)) {
|
|
390
|
+
@if list.length($list) < 1 or $start > $end {
|
|
391
|
+
@return ();
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
$result: ();
|
|
395
|
+
|
|
396
|
+
@for $i from $start through $end {
|
|
397
|
+
$result: list.append($result, list.nth($list, $i), comma);
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
@return $result;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
////
|
|
404
|
+
/// String to number converter
|
|
405
|
+
/// @author Kitty Giraudel
|
|
406
|
+
/// @access private
|
|
407
|
+
////
|
|
408
|
+
|
|
409
|
+
///
|
|
410
|
+
/// Casts a string into a number
|
|
411
|
+
///
|
|
412
|
+
/// @param {String | Number} $value - Value to be parsed
|
|
413
|
+
///
|
|
414
|
+
/// @return {Number}
|
|
415
|
+
///
|
|
416
|
+
|
|
417
|
+
@function to-number($value) {
|
|
418
|
+
@if meta.type-of($value) == 'number' {
|
|
419
|
+
@return $value;
|
|
420
|
+
} @else if meta.type-of($value) != 'string' {
|
|
421
|
+
$_: im-log('Value for `to-number` should be a number or a string.');
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
$first-character: string.slice($value, 1, 1);
|
|
425
|
+
$result: 0;
|
|
426
|
+
$digits: 0;
|
|
427
|
+
$minus: ($first-character == '-');
|
|
428
|
+
$numbers: (
|
|
429
|
+
'0': 0,
|
|
430
|
+
'1': 1,
|
|
431
|
+
'2': 2,
|
|
432
|
+
'3': 3,
|
|
433
|
+
'4': 4,
|
|
434
|
+
'5': 5,
|
|
435
|
+
'6': 6,
|
|
436
|
+
'7': 7,
|
|
437
|
+
'8': 8,
|
|
438
|
+
'9': 9,
|
|
439
|
+
);
|
|
440
|
+
|
|
441
|
+
// Remove +/- sign if present at first character
|
|
442
|
+
@if $first-character == '+' or $first-character == '-' {
|
|
443
|
+
$value: string.slice($value, 2);
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
@for $i from 1 through string.length($value) {
|
|
447
|
+
$character: string.slice($value, $i, $i);
|
|
448
|
+
|
|
449
|
+
@if not(list.index(map.keys($numbers), $character) or $character == '.') {
|
|
450
|
+
@return to-length(if($minus, -$result, $result), string.slice($value, $i));
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
@if $character == '.' {
|
|
454
|
+
$digits: 1;
|
|
455
|
+
} @else if $digits == 0 {
|
|
456
|
+
$result: $result * 10 + map.get($numbers, $character);
|
|
457
|
+
} @else {
|
|
458
|
+
$digits: $digits * 10;
|
|
459
|
+
$result: $result + math.div(map.get($numbers, $character), $digits);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
@return if($minus, -$result, $result);
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
///
|
|
467
|
+
/// Add `$unit` to `$value`
|
|
468
|
+
///
|
|
469
|
+
/// @param {Number} $value - Value to add unit to
|
|
470
|
+
/// @param {String} $unit - String representation of the unit
|
|
471
|
+
///
|
|
472
|
+
/// @return {Number} - `$value` expressed in `$unit`
|
|
473
|
+
///
|
|
474
|
+
@function to-length($value, $unit) {
|
|
475
|
+
$units: (
|
|
476
|
+
'px': 1px,
|
|
477
|
+
'cm': 1cm,
|
|
478
|
+
'mm': 1mm,
|
|
479
|
+
'%': 1%,
|
|
480
|
+
'ch': 1ch,
|
|
481
|
+
'pc': 1pc,
|
|
482
|
+
'in': 1in,
|
|
483
|
+
'em': 1em,
|
|
484
|
+
'rem': 1rem,
|
|
485
|
+
'pt': 1pt,
|
|
486
|
+
'ex': 1ex,
|
|
487
|
+
'vw': 1vw,
|
|
488
|
+
'vh': 1vh,
|
|
489
|
+
'vmin': 1vmin,
|
|
490
|
+
'vmax': 1vmax,
|
|
491
|
+
);
|
|
492
|
+
|
|
493
|
+
@if not list.index(map.keys($units), $unit) {
|
|
494
|
+
$_: im-log('Invalid unit `#{$unit}`.');
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
@return $value * map.get($units, $unit);
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
///
|
|
501
|
+
/// This mixin aims at redefining the configuration just for the scope of
|
|
502
|
+
/// the call. It is helpful when having a component needing an extended
|
|
503
|
+
/// configuration such as custom breakpoints (referred to as tweakpoints)
|
|
504
|
+
/// for instance.
|
|
505
|
+
///
|
|
506
|
+
/// @author Kitty Giraudel
|
|
507
|
+
///
|
|
508
|
+
/// @param {Map} $tweakpoints [()] - Map of tweakpoints to be merged with `$breakpoints`
|
|
509
|
+
/// @param {Map} $tweak-media-expressions [()] - Map of tweaked media expressions to be merged with `$media-expression`
|
|
510
|
+
///
|
|
511
|
+
/// @example scss - Extend the global breakpoints with a tweakpoint
|
|
512
|
+
/// @include media-context(('custom': 678px)) {
|
|
513
|
+
/// .foo {
|
|
514
|
+
/// @include media('>phone', '<=custom') {
|
|
515
|
+
/// // ...
|
|
516
|
+
/// }
|
|
517
|
+
/// }
|
|
518
|
+
/// }
|
|
519
|
+
///
|
|
520
|
+
/// @example scss - Extend the global media expressions with a custom one
|
|
521
|
+
/// @include media-context($tweak-media-expressions: ('all': 'all')) {
|
|
522
|
+
/// .foo {
|
|
523
|
+
/// @include media('all', '>phone') {
|
|
524
|
+
/// // ...
|
|
525
|
+
/// }
|
|
526
|
+
/// }
|
|
527
|
+
/// }
|
|
528
|
+
///
|
|
529
|
+
/// @example scss - Extend both configuration maps
|
|
530
|
+
/// @include media-context(('custom': 678px), ('all': 'all')) {
|
|
531
|
+
/// .foo {
|
|
532
|
+
/// @include media('all', '>phone', '<=custom') {
|
|
533
|
+
/// // ...
|
|
534
|
+
/// }
|
|
535
|
+
/// }
|
|
536
|
+
/// }
|
|
537
|
+
///
|
|
538
|
+
@mixin media-context($tweakpoints: (), $tweak-media-expressions: ()) {
|
|
539
|
+
// Save global configuration
|
|
540
|
+
$global-breakpoints: $breakpoints;
|
|
541
|
+
$global-media-expressions: $media-expressions;
|
|
542
|
+
|
|
543
|
+
// Update global configuration
|
|
544
|
+
$breakpoints: map.merge($breakpoints, $tweakpoints) !global;
|
|
545
|
+
$media-expressions: map.merge($media-expressions, $tweak-media-expressions) !global;
|
|
546
|
+
|
|
547
|
+
@content;
|
|
548
|
+
|
|
549
|
+
// Restore global configuration
|
|
550
|
+
$breakpoints: $global-breakpoints !global;
|
|
551
|
+
$media-expressions: $global-media-expressions !global;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
////
|
|
555
|
+
/// include-media public exposed API
|
|
556
|
+
/// @author Eduardo Boucas
|
|
557
|
+
/// @access public
|
|
558
|
+
////
|
|
559
|
+
|
|
560
|
+
///
|
|
561
|
+
/// Generates a media query based on a list of conditions
|
|
562
|
+
///
|
|
563
|
+
/// @param {Arglist} $conditions - Media query conditions
|
|
564
|
+
///
|
|
565
|
+
/// @example scss - With a single set breakpoint
|
|
566
|
+
/// @include media('>phone') { }
|
|
567
|
+
///
|
|
568
|
+
/// @example scss - With two set breakpoints
|
|
569
|
+
/// @include media('>phone', '<=tablet') { }
|
|
570
|
+
///
|
|
571
|
+
/// @example scss - With custom values
|
|
572
|
+
/// @include media('>=358px', '<850px') { }
|
|
573
|
+
///
|
|
574
|
+
/// @example scss - With set breakpoints with custom values
|
|
575
|
+
/// @include media('>desktop', '<=1350px') { }
|
|
576
|
+
///
|
|
577
|
+
/// @example scss - With a static expression
|
|
578
|
+
/// @include media('retina2x') { }
|
|
579
|
+
///
|
|
580
|
+
/// @example scss - Mixing everything
|
|
581
|
+
/// @include media('>=350px', '<tablet', 'retina3x') { }
|
|
582
|
+
///
|
|
583
|
+
@mixin media($conditions...) {
|
|
584
|
+
@if ($im-media-support and list.length($conditions) == 0) or
|
|
585
|
+
(not $im-media-support and im-intercepts-static-breakpoint($conditions...))
|
|
586
|
+
{
|
|
587
|
+
@content;
|
|
588
|
+
} @else if $im-media-support and list.length($conditions) > 0 {
|
|
589
|
+
@media #{string.unquote(parse-expression(list.nth($conditions, 1)))} {
|
|
590
|
+
// Recursive call
|
|
591
|
+
@include media(slice($conditions, 2)...) {
|
|
592
|
+
@content;
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@forward './mq';
|