@volvo-cars/css 0.54.0 → 0.56.0
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 +2 -583
- package/dist/UNSTABLE_styles.cjs.map +1 -1
- package/dist/UNSTABLE_styles.js +1 -1
- package/dist/chunk-5ANAWLXR.js +2 -0
- package/dist/{chunk-WNBZDYPV.js.map → chunk-5ANAWLXR.js.map} +1 -1
- package/dist/{chunk-CAOJ5SMH.js → chunk-DCLPPQO6.js} +1 -1
- package/dist/{chunk-CAOJ5SMH.js.map → chunk-DCLPPQO6.js.map} +1 -1
- package/dist/css/v0/styles.072dba76.css +1 -0
- package/dist/css/v0/{tokens.f03d8fbc.css → tokens.534178ca.css} +1 -1
- package/dist/imports.json +2 -2
- package/dist/join.d.ts +8 -0
- package/dist/links.cjs +1 -1
- package/dist/links.cjs.map +1 -1
- package/dist/links.js +1 -1
- package/dist/links.server.cjs +1 -1
- package/dist/links.server.cjs.map +1 -1
- package/dist/links.server.js +1 -1
- package/dist/merge.d.ts +9 -0
- package/dist/meta.json +138 -450
- package/dist/styles.css +1 -1
- package/dist/styles.d.ts +38 -384
- package/dist/styles_all-media.css +1 -1
- package/dist/tokens.css +1 -1
- package/dist/tokens.d.ts +5 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.ts +6 -1
- package/dist/utils.js +1 -1
- package/dist/utils.js.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-WNBZDYPV.js +0 -2
- package/dist/css/v0/styles.e56560d5.css +0 -1
package/README.md
CHANGED
|
@@ -2,587 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
<Moved />
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
The CSS library for the Volvo Cars Web Design System.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
CSS (`@volvo-cars/css`) is the CSS library for the Volvo Cars Web Design System, providing low level styling for components with as little friction as possible. It includes:
|
|
10
|
-
|
|
11
|
-
- Global styles and resets
|
|
12
|
-
- Design tokens as CSS variables
|
|
13
|
-
- Utility class names to apply design tokens
|
|
14
|
-
- Styles for core components/blocks
|
|
15
|
-
|
|
16
|
-
It is fully compatible with dark mode and right-to-left languages without any JavaScript runtime or build step.
|
|
17
|
-
|
|
18
|
-
## Resets and default styles
|
|
19
|
-
|
|
20
|
-
Base styles and resets are added to any elements within the root class name selector.
|
|
21
|
-
|
|
22
|
-
- Default margins are removed
|
|
23
|
-
- Border styles default to `0 solid var(--v-color-ornament-primary)`
|
|
24
|
-
- Headings, lists and links are unstyled
|
|
25
|
-
|
|
26
|
-
See [global.css](https://github.com/volvo-cars/design-system-web/blob/master/packages/css/src/styles/global.css) for all global styles and resets.
|
|
27
|
-
|
|
28
|
-
To simplify styling of body content and content coming from a CMS, some elements will have default styles applied if they have _no other class name_.
|
|
29
|
-
|
|
30
|
-
```html live
|
|
31
|
-
<div className="stack-text">
|
|
32
|
-
<h2>For a better future.</h2>
|
|
33
|
-
<p>
|
|
34
|
-
We want to provide you with the <a href="#">freedom to move</a> in a
|
|
35
|
-
personal, sustainable and safe way.
|
|
36
|
-
</p>
|
|
37
|
-
<ul>
|
|
38
|
-
<li>Learn</li>
|
|
39
|
-
<li>Shop</li>
|
|
40
|
-
</ul>
|
|
41
|
-
</div>
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
As soon as any class is added to the element, default styles no longer apply and they are fully reset, letting you apply your own custom styles without conflict.
|
|
45
|
-
|
|
46
|
-
```html live
|
|
47
|
-
<div>
|
|
48
|
-
<h2 class="anything">For a better future.</h2>
|
|
49
|
-
<p>
|
|
50
|
-
We want to provide you with the
|
|
51
|
-
<a class="anything" href="#">freedom to move</a> in a personal, sustainable
|
|
52
|
-
and safe way.
|
|
53
|
-
</p>
|
|
54
|
-
<ul class="navigation">
|
|
55
|
-
<li>Learn</li>
|
|
56
|
-
<li>Shop</li>
|
|
57
|
-
</ul>
|
|
58
|
-
</div>
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
## Typography
|
|
62
|
-
|
|
63
|
-
Typography class names use the following naming convention:
|
|
64
|
-
|
|
65
|
-
`.{category}-{variant}`
|
|
66
|
-
|
|
67
|
-
**Category** is one of `heading`, `statement`, `title`, `body` and `micro`.
|
|
68
|
-
**Variant** is a name matching the size in pixels or describes the use case (`1-3`, `signature`, etc).
|
|
69
|
-
|
|
70
|
-
### Headings & Statements
|
|
71
|
-
|
|
72
|
-
Heading and Statement font sizes are fluid, with a smaller font-size on smaller viewports.
|
|
73
|
-
|
|
74
|
-
| Class | Element | Font |
|
|
75
|
-
| --------------------- | ------- | ------------------------------------------- |
|
|
76
|
-
| `heading-1` | `h1` | 32-40 (2rem-2.5rem), Volvo Novum Medium |
|
|
77
|
-
| `heading-2` | `h2` | 24-32 (1.5rem-2rem), Volvo Novum Medium |
|
|
78
|
-
| `heading-3` | `h3` | 24-32 (1.5rem-2rem), Volvo Novum Semi-Light |
|
|
79
|
-
| `statement-3` | | 48-56 (3rem-3.5rem), Volvo Novum Medium |
|
|
80
|
-
| `statement-signature` | | 40-72 (2.5rem-4.5rem), Volvo Broad |
|
|
81
|
-
|
|
82
|
-
Use a suitable semantic heading element and apply the class name matching the desired style.
|
|
83
|
-
|
|
84
|
-
```html example
|
|
85
|
-
<div className="stack-text">
|
|
86
|
-
<h1 className="heading-1">Heading 1</h1>
|
|
87
|
-
<h2 className="heading-2">Heading 2</h2>
|
|
88
|
-
<h3 className="heading-3">Heading 3</h3>
|
|
89
|
-
</div>
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
```html example
|
|
93
|
-
<div className="stack-text">
|
|
94
|
-
<h3 className="statement-3">Statement 3</h3>
|
|
95
|
-
<h1 className="statement-signature">Statement Signature</h1>
|
|
96
|
-
</div>
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
To disable the fluid font-size and fix the size, pass the `data-fluid-typography` attribute with values `min` / `max`.
|
|
100
|
-
|
|
101
|
-
```html live
|
|
102
|
-
<h2 class="heading-2" data-fluid-typography="min">
|
|
103
|
-
Heading 2 fixed to min size
|
|
104
|
-
</h2>
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
### Text Styles
|
|
108
|
-
|
|
109
|
-
| Class | Element | |
|
|
110
|
-
| ---------- | ------- | ------------------------------------ |
|
|
111
|
-
| `title-24` | | 24 (1.5rem), Volvo Novum Semi-Light |
|
|
112
|
-
| `title-20` | | 20 (1.25rem), Volvo Novum Semi-Light |
|
|
113
|
-
| `body-16` | `:root` | 16 (1rem), Volvo Novum Semi-Light |
|
|
114
|
-
| `micro` | `small` | 12 (0.75rem), Volvo Novum Semi-Light |
|
|
115
|
-
|
|
116
|
-
```html example
|
|
117
|
-
<div className="stack-16">
|
|
118
|
-
<p className="title-24">Title 24</p>
|
|
119
|
-
<p className="title-20">Title 20</p>
|
|
120
|
-
<p className="body-16">Body 16</p>
|
|
121
|
-
<p className="micro">Micro</p>
|
|
122
|
-
</div>
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
### Links
|
|
126
|
-
|
|
127
|
-
| Class | Element | Properties |
|
|
128
|
-
| ---------------- | ------- | ------------------------------------------------------------------------------------ |
|
|
129
|
-
| `link-inline` | `a` | `text-decoration-line: underline;`<br />`color: var(--v-color-foreground-secondary)` |
|
|
130
|
-
| `link-secondary` | | `color: var(--v-color-foreground-primary)` |
|
|
131
|
-
|
|
132
|
-
```html example
|
|
133
|
-
<div>
|
|
134
|
-
<p><a href="#" className="link-inline">Link - inline</a></p>
|
|
135
|
-
<p><a href="#" className="link-secondary">Link - secondary</a></p>
|
|
136
|
-
</div>
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
### Lists
|
|
140
|
-
|
|
141
|
-
Makes `ul` and `ol` display as lists with bullets or numbers.
|
|
142
|
-
|
|
143
|
-
| Class | Element | Properties |
|
|
144
|
-
| ------ | ------- | --------------------------- |
|
|
145
|
-
| `list` | `ul` | `list-style-type: disc;` |
|
|
146
|
-
| `list` | `ol` | `list-style-type: decimal;` |
|
|
147
|
-
|
|
148
|
-
```html example
|
|
149
|
-
<div>
|
|
150
|
-
<ol>
|
|
151
|
-
<li>List item</li>
|
|
152
|
-
<li>List item</li>
|
|
153
|
-
</ol>
|
|
154
|
-
<ul>
|
|
155
|
-
<li>List item</li>
|
|
156
|
-
<li>List item</li>
|
|
157
|
-
</ul>
|
|
158
|
-
</div>
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
### Utility classes
|
|
162
|
-
|
|
163
|
-
| Class | Element | Properties |
|
|
164
|
-
| ------------- | ------------- | ------------------ |
|
|
165
|
-
| `font-medium` | `b`, `strong` | `font-weight: 500` |
|
|
166
|
-
| `font-light` | | `font-weight: 300` |
|
|
167
|
-
|
|
168
|
-
### Migrating from the `vcc-ui` `<Text>` component
|
|
169
|
-
|
|
170
|
-
| vcc-ui Text | @volvo-cars/css |
|
|
171
|
-
| -------------------------------------------- | ------------------------------------ |
|
|
172
|
-
| `<Text variant="yang">` | `<h1 class="statement-signature">` |
|
|
173
|
-
| `<Text variant="peary">` | `<h1 class="statement-3">` |
|
|
174
|
-
| `<Text variant="cook">` | `<h1>`, `<p class="heading-1">` |
|
|
175
|
-
| `<Text variant="ootah" subStyle="emphasis">` | `<h2>`, `<p class="heading-2">` |
|
|
176
|
-
| `<Text variant="ootah" subStyle="standard">` | `<h3>`, `<p class="heading-3">` |
|
|
177
|
-
| `<Text variant="hillary">` | `<p class="title-20">` |
|
|
178
|
-
| `<Text>`, `<Text variant="columbus">` | `<p>`, `<p class="body-16">` |
|
|
179
|
-
| `<Text variant="kelly">` | `<p>`, `<p class="body-16">` |
|
|
180
|
-
| `<Text variant="bates">` | `<small>`, `<p class="micro">` |
|
|
181
|
-
| `<Text variant="amundsen">` | `<p style="font: var(--v-font-14)">` |
|
|
182
|
-
|
|
183
|
-
**Example change**
|
|
184
|
-
|
|
185
|
-
```diff
|
|
186
|
-
-<Text variant="cook" as="h1">
|
|
187
|
-
+<h1 className="heading-1">
|
|
188
|
-
{title}
|
|
189
|
-
-</Text>
|
|
190
|
-
+</h1>
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
If you need to change the text style depending for different media queries, use tokens to create a custom style.
|
|
194
|
-
|
|
195
|
-
```jsx
|
|
196
|
-
import vtokens from '@volvo-cars/css/tokens';
|
|
197
|
-
|
|
198
|
-
<Block
|
|
199
|
-
extend={{
|
|
200
|
-
font: vtokens.font14,
|
|
201
|
-
fromM: {
|
|
202
|
-
font: vtokens.font16,
|
|
203
|
-
},
|
|
204
|
-
}}
|
|
205
|
-
>
|
|
206
|
-
Text
|
|
207
|
-
</Block>;
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
## Color
|
|
211
|
-
|
|
212
|
-
### Text color
|
|
213
|
-
|
|
214
|
-
| Class | Properties |
|
|
215
|
-
| ---------------------- | -------------------------------------------------- |
|
|
216
|
-
| `text-primary` | `color: var(--v-color-foreground-primary)` |
|
|
217
|
-
| `text-secondary` | `color: var(--v-color-foreground-secondary)` |
|
|
218
|
-
| `text-accent-blue` | `color: var(--v-color-foreground-accent-blue)` |
|
|
219
|
-
| `text-always-black` | `color: var(--v-color-foreground-always-black)` |
|
|
220
|
-
| `text-always-white` | `color: var(--v-color-foreground-always-white)` |
|
|
221
|
-
| `text-feedback-green` | `color: var(--v-color-foreground-feedback-green)` |
|
|
222
|
-
| `text-feedback-orange` | `color: var(--v-color-foreground-feedback-orange)` |
|
|
223
|
-
| `text-feedback-red` | `color: var(--v-color-foreground-feedback-red)` |
|
|
224
|
-
| `text-inherit` | `color: inherit` |
|
|
225
|
-
|
|
226
|
-
```html example
|
|
227
|
-
<div>
|
|
228
|
-
<p class="text-primary">Text color - primary</p>
|
|
229
|
-
<p class="text-secondary">Text color - secondary</p>
|
|
230
|
-
<p class="text-accent-blue">Text color - accent-blue</p>
|
|
231
|
-
<p class="text-always-black">Text color - always-black</p>
|
|
232
|
-
<p class="text-always-white">Text color - always-white</p>
|
|
233
|
-
<p class="text-feedback-green">Text color - feedback-green</p>
|
|
234
|
-
<p class="text-feedback-red">Text color - feedback-red</p>
|
|
235
|
-
<p class="text-feedback-orange">Text color - feedback-orange</p>
|
|
236
|
-
<p class="text-inherit">Text color - inherit</p>
|
|
237
|
-
</div>
|
|
238
|
-
```
|
|
239
|
-
|
|
240
|
-
### Background color
|
|
241
|
-
|
|
242
|
-
| Class | Properties |
|
|
243
|
-
| ---------------------------- | -------------------------------------------------- |
|
|
244
|
-
| `bg-primary` | `color: var(--v-color-background-primary)` |
|
|
245
|
-
| `bg-secondary` | `color: var(--v-color-background-secondary)` |
|
|
246
|
-
| `bg-surface-accent-blue` | `color: var(--v-color-background-accent-blue)` |
|
|
247
|
-
| `bg-always-black` | `color: var(--v-color-background-always-black)` |
|
|
248
|
-
| `bg-always-white` | `color: var(--v-color-background-always-white)` |
|
|
249
|
-
| `bg-surface-feedback-green` | `color: var(--v-color-background-feedback-green)` |
|
|
250
|
-
| `bg-surface-feedback-orange` | `color: var(--v-color-background-feedback-orange)` |
|
|
251
|
-
| `bg-surface-feedback-red` | `color: var(--v-color-background-feedback-red)` |
|
|
252
|
-
| `bg-inherit` | `color: inherit` |
|
|
253
|
-
|
|
254
|
-
```html example
|
|
255
|
-
<div>
|
|
256
|
-
<div class="bg-primary">Background color - primary</div>
|
|
257
|
-
<div class="bg-secondary">Background color - secondary</div>
|
|
258
|
-
<div class="bg-surface-accent-blue text-always-white">
|
|
259
|
-
Background color - accent-blue
|
|
260
|
-
</div>
|
|
261
|
-
<div class="bg-always-black text-always-white">
|
|
262
|
-
Background color - always-black
|
|
263
|
-
</div>
|
|
264
|
-
<div class="bg-always-white text-always-black">
|
|
265
|
-
Background color - always-white
|
|
266
|
-
</div>
|
|
267
|
-
<div class="bg-surface-feedback-green text-always-white">
|
|
268
|
-
Background color - feedback-green
|
|
269
|
-
</div>
|
|
270
|
-
<div class="bg-surface-feedback-red text-always-white">
|
|
271
|
-
Background color - feedback-red
|
|
272
|
-
</div>
|
|
273
|
-
<div class="bg-surface-feedback-orange text-always-white">
|
|
274
|
-
Background color - feedback-orange
|
|
275
|
-
</div>
|
|
276
|
-
<div class="bg-inherit">Background color - inherit</div>
|
|
277
|
-
</div>
|
|
278
|
-
```
|
|
279
|
-
|
|
280
|
-
### Dark mode
|
|
281
|
-
|
|
282
|
-
Light mode is the default color mode of the theme. Use the `data-color-mode` attribute to switch between `dark` and `light` color modes.
|
|
283
|
-
|
|
284
|
-
```html
|
|
285
|
-
<div class="volvo_v0">
|
|
286
|
-
<p>Light mode</p>
|
|
287
|
-
<div data-color-mode="dark">
|
|
288
|
-
<p>Dark mode</p>
|
|
289
|
-
</div>
|
|
290
|
-
</div>
|
|
291
|
-
<html class="volvo_v0" data-color-mode="dark">
|
|
292
|
-
<p>Dark mode</p>
|
|
293
|
-
<div data-color-mode="light">
|
|
294
|
-
<p>Light mode</p>
|
|
295
|
-
</div>
|
|
296
|
-
</div>
|
|
297
|
-
```
|
|
298
|
-
|
|
299
|
-
## Design Tokens
|
|
300
|
-
|
|
301
|
-
If you only want the design tokens and not the styles, only these files are required.
|
|
302
|
-
|
|
303
|
-
```js
|
|
304
|
-
import '@volvo-cars/css/font-face.css';
|
|
305
|
-
import '@volvo-cars/css/tokens.css';
|
|
306
|
-
```
|
|
307
|
-
|
|
308
|
-
Design token variable names consist of the following parts:
|
|
309
|
-
|
|
310
|
-
- **Type** is the main token group such as `color`, `font` or `size`. The names helps with namespacing tokens and with tooling: you can get autocomplete for all colors in your editor by typing `--v-color..`. Type is the only required part and all other parts vary depending on the type.
|
|
311
|
-
|
|
312
|
-
- **Category** is a category from a fixed list of categories per token type. Typical values are `feedback`, `ornament`, `heading`.
|
|
313
|
-
|
|
314
|
-
- **Property** to apply the token to, such as `background`, `foreground`, `ornament`, `lineheight` or `size`.
|
|
315
|
-
|
|
316
|
-
- **Variant** distinguishes alternative use cases. These can be abstract such as `primary`, `secondary` or enumerated choices of varying size or color such as `blue`, `green`, `14`.
|
|
317
|
-
|
|
318
|
-
Depending on the category, the name consists of different parts.
|
|
319
|
-
|
|
320
|
-
### Typography
|
|
321
|
-
|
|
322
|
-
Naming scheme: `--v-font-{category}-{variant}-{property}-{modifier}`
|
|
323
|
-
|
|
324
|
-
- **category** is one of `heading`, `statement`, `title` or none.
|
|
325
|
-
- **variant** distinguishes alternative use cases (`1-4`), size in pixels (`20`, `16`) or literal values (`sans`, `broad`).
|
|
326
|
-
- **property** is one of `size` or `lineheight`. If omitted refers to the `font` shorthand CSS property.
|
|
327
|
-
- **modifier** is a property suffix such as `min` or `max`.
|
|
328
|
-
|
|
329
|
-
#### Font Family
|
|
330
|
-
|
|
331
|
-
- `--v-font-sans-family` (Volvo Novum in supported locales as determined by `<html lang>`, otherwise fallback fonts)
|
|
332
|
-
- `--v-font-broad-family`
|
|
333
|
-
|
|
334
|
-
#### Font Sizes
|
|
335
|
-
|
|
336
|
-
- `--v-font-{12,14,16}-size`
|
|
337
|
-
- `--v-font-{12,14,16}-lineheight`
|
|
338
|
-
- `--v-font-{12,14,16}` (`font` shorthand with `font-weight: 300`)
|
|
339
|
-
- `--v-font-title-{20,24}-size`
|
|
340
|
-
- `--v-font-title-{20,24}-lineheight`
|
|
341
|
-
- `--v-font-title-{20,24}` (`font` shorthand with `font-weight: 300`)
|
|
342
|
-
- `--v-font-heading-{1-3}-size-min`
|
|
343
|
-
- `--v-font-heading-{1-3}-size-max`
|
|
344
|
-
- `--v-font-heading-{1-3}-size`
|
|
345
|
-
- `--v-font-heading-{1-3}-lineheight`
|
|
346
|
-
- `--v-font-heading-{1-3}`
|
|
347
|
-
- `--v-font-statement-{1-3,signature}-size-min`
|
|
348
|
-
- `--v-font-statement-{1-3,signature}-size-max`
|
|
349
|
-
- `--v-font-statement-{1-3,signature}-size`
|
|
350
|
-
- `--v-font-statement-{1-3,signature}-lineheight`
|
|
351
|
-
- `--v-font-statement-{1-3,signature}`
|
|
352
|
-
|
|
353
|
-
### Color
|
|
354
|
-
|
|
355
|
-
- `--v-color-foreground-primary` - Foreground color for primary text and icons.
|
|
356
|
-
- `--v-color-foreground-secondary` - Foreground color for secondary text and icons.
|
|
357
|
-
- `--v-color-foreground-accent-blue` - Foreground color for links and selected states.
|
|
358
|
-
- `--v-color-foreground-feedback-green` - Foreground color to signify positive actions.
|
|
359
|
-
- `--v-color-foreground-feedback-orange` - Foreground color to highlight errors, invalid data and destructive actions for caution.
|
|
360
|
-
- `--v-color-foreground-feedback-red` - Foreground color to highlight errors, invalid data and destructive actions.
|
|
361
|
-
|
|
362
|
-
- `--v-color-ornament-primary` - Ornamental color to visually group or separate UI elements.
|
|
363
|
-
- `--v-color-background-primary` - The primary background colour.
|
|
364
|
-
- `--v-color-background-secondary` - The secondary background colour.
|
|
365
|
-
- `--v-color-background-accent-blue` - Background color for links and selected states.
|
|
366
|
-
- `--v-color-background-feedback-green` - Background color to signify positive actions.
|
|
367
|
-
- `--v-color-background-feedback-orange` - Background color to highlight errors, invalid data and destructive actions for caution.
|
|
368
|
-
- `--v-color-background-feedback-red` - Background color to highlight errors, invalid data and destructive actions.
|
|
369
|
-
- `--v-color-always-black` - Always black regardless of color mode.
|
|
370
|
-
- `--v-color-always-white` - Always white regardless of color mode.
|
|
371
|
-
|
|
372
|
-
### Spacing
|
|
373
|
-
|
|
374
|
-
#### Small spacing
|
|
375
|
-
|
|
376
|
-
Small spacing is fixed in size for all viewport sizes.
|
|
377
|
-
|
|
378
|
-
- `--v-space-4` - 0.25rem
|
|
379
|
-
- `--v-space-8` - 0.5rem
|
|
380
|
-
- `--v-space-16` - 1rem
|
|
381
|
-
- `--v-space-24` - 1.5rem
|
|
382
|
-
- `--v-space-32` - 2rem
|
|
383
|
-
- `--v-space-48` - 3rem
|
|
384
|
-
- `--v-space-64` - 4rem
|
|
385
|
-
|
|
386
|
-
#### Fluid spacing
|
|
387
|
-
|
|
388
|
-
Fluid spacing grows between the smallest value to the largest depending on the viewport size.
|
|
389
|
-
|
|
390
|
-
- `--v-space-l` 4rem-6rem
|
|
391
|
-
- `--v-space-m` 3rem-4rem
|
|
392
|
-
- `--v-space-s` 2rem-3rem
|
|
393
|
-
|
|
394
|
-
## Usage
|
|
395
|
-
|
|
396
|
-
Include the styles in your application by rendering the `links` in your page `<head>`. The links point to CSS files hosted on a shared volvocars.com CDN. The file names include content based hashes, meaning that when a new version is released any unchanged CSS files will remain in caches in the CDN and browsers.
|
|
397
|
-
|
|
398
|
-
### SSR / Next.js
|
|
399
|
-
|
|
400
|
-
In `_document` in a **Next.js** application:
|
|
401
|
-
|
|
402
|
-
```js
|
|
403
|
-
import { links } from '@volvo-cars/css/links';
|
|
404
|
-
|
|
405
|
-
<Head>
|
|
406
|
-
{links().map((link) => (
|
|
407
|
-
<link key={link.href} {...link} />
|
|
408
|
-
))}
|
|
409
|
-
</Head>;
|
|
410
|
-
```
|
|
411
|
-
|
|
412
|
-
### HTML
|
|
413
|
-
|
|
414
|
-
The array returned by `links()` stringifies to HTML `<link>` tags, letting you do:
|
|
415
|
-
|
|
416
|
-
```js
|
|
417
|
-
import { links } from '@volvo-cars/css/links';
|
|
418
|
-
|
|
419
|
-
const html = `<html><head>${links()}</head><body>...`;
|
|
420
|
-
```
|
|
421
|
-
|
|
422
|
-
If you don't have a JavaScript backend, the stylesheets from the current release are available below. Note that if you copy paste these you need to manually update the HTML whenever a new version of `@volvo-cars/css` is released.
|
|
423
|
-
|
|
424
|
-
<CSSLinks />
|
|
425
|
-
|
|
426
|
-
### Client-side JavaScript
|
|
427
|
-
|
|
428
|
-
```js
|
|
429
|
-
import { links } from '@volvo-cars/css/links';
|
|
430
|
-
|
|
431
|
-
const fragment = document.createDocumentFragment();
|
|
432
|
-
for (const link of links()) {
|
|
433
|
-
fragment.append(Object.assign(document.createElement('link'), link));
|
|
434
|
-
}
|
|
435
|
-
document.head.append(fragment);
|
|
436
|
-
```
|
|
437
|
-
|
|
438
|
-
If your bundler supports it, you can also import the CSS files directly from the npm package and they will be self-hosted on your domain. _Do not do this if your application is hosted on www.volvocars.com_.
|
|
439
|
-
|
|
440
|
-
```js
|
|
441
|
-
import '@volvo-cars/css/font-face.css';
|
|
442
|
-
import '@volvo-cars/css/tokens.css';
|
|
443
|
-
import '@volvo-cars/css/styles_all-media.css';
|
|
444
|
-
```
|
|
445
|
-
|
|
446
|
-
### Filtering
|
|
447
|
-
|
|
448
|
-
For micro-frontend components you might want to exclude some link tags using the `filter` object passed to `links()`.
|
|
449
|
-
|
|
450
|
-
```js
|
|
451
|
-
import { links } from '@volvo-cars/css/links';
|
|
452
|
-
|
|
453
|
-
links({
|
|
454
|
-
filter: {
|
|
455
|
-
// Excludes all `<link rel=preload>` tags.
|
|
456
|
-
preload: false,
|
|
457
|
-
// Excludes the `font-face.css` / inlined font-face CSS
|
|
458
|
-
fonts: false,
|
|
459
|
-
// Excludes `tokens.css`
|
|
460
|
-
tokens: false,
|
|
461
|
-
},
|
|
462
|
-
});
|
|
463
|
-
```
|
|
464
|
-
|
|
465
|
-
## Scoping
|
|
466
|
-
|
|
467
|
-
The stylesheet is scoped with a parent selector, meaning that it will only affect children of a wrapper with a versioned class name. All element selectors have 0 specificity, meaning that any CSS from the application overrides it regardless of the order of styles. Other selectors have a maximum of 10 (0,1,0) in specificity (20 for pseudo states) and are easily overrideable with class name selectors in application code.
|
|
468
|
-
|
|
469
|
-
You typically want to apply the root class name to your `<html>` element but you can also apply it to parts of your page.
|
|
470
|
-
|
|
471
|
-
**Example**
|
|
472
|
-
|
|
473
|
-
```html
|
|
474
|
-
<style>
|
|
475
|
-
h1 {
|
|
476
|
-
font-size: 10px;
|
|
477
|
-
}
|
|
478
|
-
</style>
|
|
479
|
-
|
|
480
|
-
<h1>10px</h1>
|
|
481
|
-
<h2>Default browser styles</h2>
|
|
482
|
-
<div class="volvo_v0">
|
|
483
|
-
<h1>10px</h1>
|
|
484
|
-
<h1 class="heading-1">Design system styled heading</h1>
|
|
485
|
-
</div>
|
|
486
|
-
```
|
|
487
|
-
|
|
488
|
-
## Responsive design
|
|
489
|
-
|
|
490
|
-
Web experiences should be created mobile first, with layouts fluidly adjusting to the viewport using layout techniques such as flexbox, grid, container queries and viewport units.
|
|
491
|
-
|
|
492
|
-
In some cases this is not possible, and you need to significantly shift the layout at specific viewport sizes. In these cases you can customize the experience for non-mobile users using media queries.
|
|
493
|
-
|
|
494
|
-
Media query breakpoints are exported as Custom Media Queries, a [draft CSS specification](https://drafts.csswg.org/mediaqueries-5/#custom-mq). They can only be used with a CSS postprocessor such as PostCSS, by importing the breakpoints in each file using them with `@import url('@volvo-cars/css/breakpoints.css')`.
|
|
495
|
-
|
|
496
|
-
To avoid fragmenting a component's styles across a stylesheet, you may want to keep your component styles in a single place and only change custom properties with different media conditions.
|
|
497
|
-
|
|
498
|
-
```css
|
|
499
|
-
@import url('@volvo-cars/css/breakpoints.css');
|
|
500
|
-
|
|
501
|
-
.component {
|
|
502
|
-
--size: 2rem;
|
|
503
|
-
width: var(--size);
|
|
504
|
-
height: var(--size);
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
@media (--v-from-lg) {
|
|
508
|
-
.component {
|
|
509
|
-
--size: 3rem;
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
```
|
|
513
|
-
|
|
514
|
-
| Name | Widths |
|
|
515
|
-
| -------------- | -------------------- |
|
|
516
|
-
| `--v-from-md` | >= 30rem (480px) |
|
|
517
|
-
| `--v-from-lg` | >= 64rem (1024px) |
|
|
518
|
-
| `--v-from-xl` | >= 100rem (1600px) |
|
|
519
|
-
| `--v-until-md` | < 30rem |
|
|
520
|
-
| `--v-until-lg` | < 64rem |
|
|
521
|
-
| `--v-until-xl` | < 100rem |
|
|
522
|
-
| `--v-only-md` | 30rem–63.99rem |
|
|
523
|
-
| `--v-only-lg` | 64rem–99.99rem |
|
|
524
|
-
| `--v-only-xl` | >= 100rem |
|
|
525
|
-
|
|
526
|
-
### Next.js
|
|
527
|
-
|
|
528
|
-
In Next.js, run
|
|
529
|
-
|
|
530
|
-
`yarn add --dev postcss postcss-import postcss-preset-env`
|
|
531
|
-
|
|
532
|
-
and add the following to `postcss.config.js`
|
|
533
|
-
|
|
534
|
-
```js
|
|
535
|
-
module.exports = {
|
|
536
|
-
plugins: {
|
|
537
|
-
'postcss-import': {
|
|
538
|
-
resolve: require.resolve,
|
|
539
|
-
},
|
|
540
|
-
'postcss-preset-env': {
|
|
541
|
-
autoprefixer: {
|
|
542
|
-
flexbox: false,
|
|
543
|
-
},
|
|
544
|
-
stage: 3,
|
|
545
|
-
features: {
|
|
546
|
-
'custom-properties': false,
|
|
547
|
-
'custom-media-queries': true,
|
|
548
|
-
},
|
|
549
|
-
},
|
|
550
|
-
},
|
|
551
|
-
};
|
|
552
|
-
```
|
|
553
|
-
|
|
554
|
-
## TypeScript
|
|
555
|
-
|
|
556
|
-
As a convenience for TypeScript developers all class names and CSS variables are exported as JavaScript modules with TypeScript interfaces.
|
|
557
|
-
|
|
558
|
-
```ts
|
|
559
|
-
import vss from '@volvo-cars/css/styles';
|
|
560
|
-
|
|
561
|
-
console.assert(vss.body16 === 'body-16');
|
|
562
|
-
console.assert(vss.heading1 === 'heading-1');
|
|
563
|
-
|
|
564
|
-
document.body.classList.add(vss.body14);
|
|
565
|
-
```
|
|
566
|
-
|
|
567
|
-
```ts
|
|
568
|
-
import vtokens from '@volvo-cars/css/tokens';
|
|
569
|
-
|
|
570
|
-
console.assert(vtokens.fontHeading1Size === 'var(--v-font-heading-1-size)');
|
|
571
|
-
|
|
572
|
-
document.body.style.font = vtokens.font16;
|
|
573
|
-
```
|
|
574
|
-
|
|
575
|
-
### clsx
|
|
576
|
-
|
|
577
|
-
To merge or apply class names conditionally you can use the `clsx` utility.
|
|
578
|
-
|
|
579
|
-
```tsx
|
|
580
|
-
import { clsx } from '@volvo-cars/css/utils';
|
|
581
|
-
import vss from '@volvo-cars/css/styles';
|
|
582
|
-
|
|
583
|
-
<button
|
|
584
|
-
className={clsx(vss.fontMedium, isActive && vss.textPrimary, 'my-class-name')}
|
|
585
|
-
>
|
|
586
|
-
Button
|
|
587
|
-
</button>;
|
|
588
|
-
```
|
|
7
|
+
[Read the docs](https://developer.volvocars.com/design-system/web/)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/UNSTABLE_styles.ts","../src/join.ts","../src/root-class-name.js","../src/to-kebab-case.ts","../src/styles.ts"],"sourcesContent":["import { cssJoin } from './join';\nimport classNames from './styles';\n\ntype BaseStylesChain = {\n [key in keyof typeof classNames]: Styles;\n};\n\ntype ClsxClassValue = (Parameters<typeof cssJoin>[0] | Styles)[];\n\ntype Styles = BaseStylesChain &\n string & {\n with: (...classes: ClsxClassValue) => Styles;\n toJSON: () => string;\n };\n\ntype PrivateTarget = Styles & {\n _classes: Set<string>;\n _add: (value: string) => void;\n _lastClassName: string;\n _proxy?: PrivateTarget;\n};\n\nfunction createTarget(_className = ''): PrivateTarget {\n const target = {\n _classes: new Set([_className]),\n _add(value: string) {\n target._classes.add(value);\n target._lastClassName = value;\n },\n _lastClassName: _className,\n } as PrivateTarget;\n\n target.toString = function () {\n return [...target._classes].join(' ').trim();\n };\n target.toJSON = function () {\n return [...target._classes].join(' ').trim();\n };\n\n return target;\n}\n\nconst chain: Styles = new Proxy(createTarget(), {\n get: function get(...args): Styles {\n let [target, key] = args || [];\n\n if (typeof key === 'symbol') {\n //@ts-ignore\n return;\n }\n\n if (key === 'toString' || key === 'valueOf' || key === 'toJSON') {\n return Reflect.get(...args);\n }\n\n if (key === 'with') {\n //@ts-ignore\n return (...classes: ClsxClassValue) => {\n const currentTarget = target._proxy\n ? target\n : createTargetAndAssignProxy(get);\n\n const newClasses = cssJoin(currentTarget.toString(), ...classes);\n for (const newClass of newClasses.split(' ')) {\n currentTarget._add(newClass);\n }\n return currentTarget._proxy;\n };\n }\n\n const className = classNames[key];\n\n if (target._proxy) {\n target._add(className);\n return target._proxy;\n }\n\n return createTargetAndAssignProxy(get, className)._proxy as Styles;\n },\n});\n\nexport default chain;\n\nfunction createTargetAndAssignProxy(get: any, className?: string) {\n const target = createTarget(className);\n target._proxy = new Proxy(target, { get });\n return target;\n}\n","/*\nMIT License\n\nCopyright (c) Luke Edwards <luke.edwards05@gmail.com> (lukeed.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\nexport type ClassValue =\n | ClassArray\n | ClassDictionary\n | string\n | number\n | null\n | boolean\n | undefined;\n\ninterface ClassDictionary {\n [id: string]: unknown;\n}\n\ninterface ClassArray extends Array<ClassValue> {}\n\nfunction toVal(mix: NonNullable<ClassValue>) {\n let k: string | number,\n y: string,\n str = '';\n\n if (typeof mix === 'string' || typeof mix === 'number') {\n str += mix;\n } else if (mix && typeof mix === 'object' && '_classes' in mix) {\n str += mix.toString();\n } else if (typeof mix === 'object') {\n if (Array.isArray(mix)) {\n for (k = 0; k < mix.length; k++) {\n if (mix[k]) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n if ((y = toVal(mix[k]!))) {\n str && (str += ' ');\n str += y;\n }\n }\n }\n } else {\n for (k in mix) {\n if (mix[k]) {\n str && (str += ' ');\n str += k;\n }\n }\n }\n }\n\n return str;\n}\n\nexport function cssJoin(...classes: ClassValue[]): string {\n let i = 0;\n let tmp: ClassValue;\n let x: string;\n let str = '';\n while (i < classes.length) {\n if ((tmp = classes[i++])) {\n if ((x = toVal(tmp))) {\n str && (str += ' ');\n str += x;\n }\n }\n }\n return str;\n}\n","// Bump this version for any backward incompatible changes to the\n// CSS itself, such as if something would break if several versions\n// of the CSS are applied to the same elements.\nexport const cssVersion = 'v0';\n\nexport const rootClassName = `volvo_${cssVersion}`;\n","export function toKebabCase(x: string) {\n return x\n .replace(/([0-9])([A-Z])/g, '$1-$2')\n .replace(/([a-z])([A-Z0-9])/g, '$1-$2')\n .toLowerCase();\n}\n","import { rootClassName } from './root-class-name';\nimport { toKebabCase } from './to-kebab-case';\n\nexport interface ClassNames {\n [key: string]: string;\n}\n\nfunction toClassName(key: string) {\n return toKebabCase(key);\n}\n\nconst vss = new Proxy(Object.create({ root: rootClassName }), {\n get(target, key: string) {\n if (key in target) {\n return target[key];\n }\n return toClassName(key);\n },\n});\n\nexport default vss;\n"],"mappings":"4ZAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GC2BA,SAASI,EAAMC,EAA8B,CAC3C,IAAIC,EACFC,EACAC,EAAM,GAER,GAAI,OAAOH,GAAQ,UAAY,OAAOA,GAAQ,SAC5CG,GAAOH,UACEA,GAAO,OAAOA,GAAQ,UAAY,aAAcA,EACzDG,GAAOH,EAAI,SAAS,UACX,OAAOA,GAAQ,SACxB,GAAI,MAAM,QAAQA,CAAG,EACnB,IAAKC,EAAI,EAAGA,EAAID,EAAI,OAAQC,IACtBD,EAAIC,CAAC,IAEFC,EAAIH,EAAMC,EAAIC,CAAC,CAAE,KACpBE,IAAQA,GAAO,KACfA,GAAOD,OAKb,KAAKD,KAAKD,EACJA,EAAIC,CAAC,IACPE,IAAQA,GAAO,KACfA,GAAOF,GAMf,OAAOE,CACT,
|
|
1
|
+
{"version":3,"sources":["../src/UNSTABLE_styles.ts","../src/join.ts","../src/root-class-name.js","../src/to-kebab-case.ts","../src/styles.ts"],"sourcesContent":["import { cssJoin } from './join';\nimport classNames from './styles';\n\ntype BaseStylesChain = {\n [key in keyof typeof classNames]: Styles;\n};\n\ntype ClsxClassValue = (Parameters<typeof cssJoin>[0] | Styles)[];\n\ntype Styles = BaseStylesChain &\n string & {\n with: (...classes: ClsxClassValue) => Styles;\n toJSON: () => string;\n };\n\ntype PrivateTarget = Styles & {\n _classes: Set<string>;\n _add: (value: string) => void;\n _lastClassName: string;\n _proxy?: PrivateTarget;\n};\n\nfunction createTarget(_className = ''): PrivateTarget {\n const target = {\n _classes: new Set([_className]),\n _add(value: string) {\n target._classes.add(value);\n target._lastClassName = value;\n },\n _lastClassName: _className,\n } as PrivateTarget;\n\n target.toString = function () {\n return [...target._classes].join(' ').trim();\n };\n target.toJSON = function () {\n return [...target._classes].join(' ').trim();\n };\n\n return target;\n}\n\nconst chain: Styles = new Proxy(createTarget(), {\n get: function get(...args): Styles {\n let [target, key] = args || [];\n\n if (typeof key === 'symbol') {\n //@ts-ignore\n return;\n }\n\n if (key === 'toString' || key === 'valueOf' || key === 'toJSON') {\n return Reflect.get(...args);\n }\n\n if (key === 'with') {\n //@ts-ignore\n return (...classes: ClsxClassValue) => {\n const currentTarget = target._proxy\n ? target\n : createTargetAndAssignProxy(get);\n\n const newClasses = cssJoin(currentTarget.toString(), ...classes);\n for (const newClass of newClasses.split(' ')) {\n currentTarget._add(newClass);\n }\n return currentTarget._proxy;\n };\n }\n\n const className = classNames[key];\n\n if (target._proxy) {\n target._add(className);\n return target._proxy;\n }\n\n return createTargetAndAssignProxy(get, className)._proxy as Styles;\n },\n});\n\nexport default chain;\n\nfunction createTargetAndAssignProxy(get: any, className?: string) {\n const target = createTarget(className);\n target._proxy = new Proxy(target, { get });\n return target;\n}\n","/*\nMIT License\n\nCopyright (c) Luke Edwards <luke.edwards05@gmail.com> (lukeed.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\nexport type ClassValue =\n | ClassArray\n | ClassDictionary\n | string\n | number\n | null\n | boolean\n | undefined;\n\ninterface ClassDictionary {\n [id: string]: unknown;\n}\n\ninterface ClassArray extends Array<ClassValue> {}\n\nfunction toVal(mix: NonNullable<ClassValue>) {\n let k: string | number,\n y: string,\n str = '';\n\n if (typeof mix === 'string' || typeof mix === 'number') {\n str += mix;\n } else if (mix && typeof mix === 'object' && '_classes' in mix) {\n str += mix.toString();\n } else if (typeof mix === 'object') {\n if (Array.isArray(mix)) {\n for (k = 0; k < mix.length; k++) {\n if (mix[k]) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n if ((y = toVal(mix[k]!))) {\n str && (str += ' ');\n str += y;\n }\n }\n }\n } else {\n for (k in mix) {\n if (mix[k]) {\n str && (str += ' ');\n str += k;\n }\n }\n }\n }\n\n return str;\n}\n\n/**\n * Conditionally join strings of class names together, filtering out falsy values.\n *\n * @example\n * cssJoin('bg-secondary', variant === 'primary' && 'text-primary')\n *\n * @param classes\n */\nexport function cssJoin(...classes: ClassValue[]): string {\n let i = 0;\n let tmp: ClassValue;\n let x: string;\n let str = '';\n while (i < classes.length) {\n if ((tmp = classes[i++])) {\n if ((x = toVal(tmp))) {\n str && (str += ' ');\n str += x;\n }\n }\n }\n return str;\n}\n","// Bump this version for any backward incompatible changes to the\n// CSS itself, such as if something would break if several versions\n// of the CSS are applied to the same elements.\nexport const cssVersion = 'v0';\n\nexport const rootClassName = `volvo_${cssVersion}`;\n","export function toKebabCase(x: string) {\n return x\n .replace(/([0-9])([A-Z])/g, '$1-$2')\n .replace(/([a-z])([A-Z0-9])/g, '$1-$2')\n .toLowerCase();\n}\n","import { rootClassName } from './root-class-name';\nimport { toKebabCase } from './to-kebab-case';\n\nexport interface ClassNames {\n [key: string]: string;\n}\n\nfunction toClassName(key: string) {\n return toKebabCase(key);\n}\n\nconst vss = new Proxy(Object.create({ root: rootClassName }), {\n get(target, key: string) {\n if (key in target) {\n return target[key];\n }\n return toClassName(key);\n },\n});\n\nexport default vss;\n"],"mappings":"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","names":["UNSTABLE_styles_exports","__export","UNSTABLE_styles_default","__toCommonJS","toVal","mix","k","y","str","cssJoin","classes","i","tmp","x","cssVersion","rootClassName","toKebabCase","x","toClassName","key","toKebabCase","vss","rootClassName","target","styles_default","createTarget","_className","target","value","chain","get","args","key","classes","currentTarget","createTargetAndAssignProxy","newClasses","cssJoin","newClass","className","styles_default","UNSTABLE_styles_default"]}
|
package/dist/UNSTABLE_styles.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as o}from"./chunk-6XA6KEHH.js";import"./chunk-Q6P47KLU.js";import{a as l}from"./chunk-
|
|
1
|
+
import{a as o}from"./chunk-6XA6KEHH.js";import"./chunk-Q6P47KLU.js";import{a as l}from"./chunk-DCLPPQO6.js";function y(s=""){let t={_classes:new Set([s]),_add(e){t._classes.add(e),t._lastClassName=e},_lastClassName:s};return t.toString=function(){return[...t._classes].join(" ").trim()},t.toJSON=function(){return[...t._classes].join(" ").trim()},t}var f=new Proxy(y(),{get:function s(...t){let[e,r]=t||[];if(typeof r=="symbol")return;if(r==="toString"||r==="valueOf"||r==="toJSON")return Reflect.get(...t);if(r==="with")return(...c)=>{let a=e._proxy?e:i(s),g=l(a.toString(),...c);for(let u of g.split(" "))a._add(u);return a._proxy};let n=o[r];return e._proxy?(e._add(n),e._proxy):i(s,n)._proxy}}),_=f;function i(s,t){let e=y(t);return e._proxy=new Proxy(e,{get:s}),e}export{_ as default};
|
|
2
2
|
//# sourceMappingURL=UNSTABLE_styles.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as c}from"./chunk-BBIFT7L4.js";var n={"font-face.css":"css/v0/font-face.05a7ed4c.css","tokens.css":"css/v0/tokens.534178ca.css","styles.css":"css/v0/styles.072dba76.css","styles_md.css":"css/v0/styles_md.e7fc7f7f.css","styles_xl.css":"css/v0/styles_xl.12709e42.css","styles_hover.css":"css/v0/styles_hover.673bbe51.css"};var i="https://www.volvocars.com/static/shared/pkg/";function a({fonts:s=!0,tokens:e=!0}={}){return([t])=>t==="font-face.css"?s:t.endsWith("tokens.css")?e:!0}function p(s){let e=s.split("_").pop()?.replace(".css","");return c[e]}export{n as a,i as b,a as c,p as d};
|
|
2
|
+
//# sourceMappingURL=chunk-5ANAWLXR.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/imports.json","../src/links/constants.ts","../src/links/create-filter.ts","../src/links/get-media-query.ts"],"sourcesContent":["{\n \"font-face.css\": \"css/v0/font-face.05a7ed4c.css\",\n \"tokens.css\": \"css/v0/tokens.
|
|
1
|
+
{"version":3,"sources":["../src/imports.json","../src/links/constants.ts","../src/links/create-filter.ts","../src/links/get-media-query.ts"],"sourcesContent":["{\n \"font-face.css\": \"css/v0/font-face.05a7ed4c.css\",\n \"tokens.css\": \"css/v0/tokens.534178ca.css\",\n \"styles.css\": \"css/v0/styles.072dba76.css\",\n \"styles_md.css\": \"css/v0/styles_md.e7fc7f7f.css\",\n \"styles_xl.css\": \"css/v0/styles_xl.12709e42.css\",\n \"styles_hover.css\": \"css/v0/styles_hover.673bbe51.css\"\n}","export const defaultBase = 'https://www.volvocars.com/static/shared/pkg/';\n","export interface LinksFilter {\n preload?: boolean;\n fonts?: boolean;\n tokens?: boolean;\n}\n\nexport function createFilter({\n fonts = true,\n tokens = true,\n}: LinksFilter = {}) {\n return ([name]: [string, string]) => {\n if (name === 'font-face.css') return fonts;\n if (name.endsWith('tokens.css')) return tokens;\n return true;\n };\n}\n","import mediaQueries from '../media-queries';\n\nexport function getMediaQuery(name: string) {\n let suffix = name.split('_').pop()?.replace('.css', '');\n return mediaQueries[suffix as keyof typeof mediaQueries];\n}\n"],"mappings":"wCAAA,IAAAA,EAAA,CACE,gBAAiB,gCACjB,aAAc,6BACd,aAAc,6BACd,gBAAiB,gCACjB,gBAAiB,gCACjB,mBAAoB,kCACtB,ECPO,IAAMC,EAAc,+CCMpB,SAASC,EAAa,CAC3B,MAAAC,EAAQ,GACR,OAAAC,EAAS,EACX,EAAiB,CAAC,EAAG,CACnB,MAAO,CAAC,CAACC,CAAI,IACPA,IAAS,gBAAwBF,EACjCE,EAAK,SAAS,YAAY,EAAUD,EACjC,EAEX,CCbO,SAASE,EAAcC,EAAc,CAC1C,IAAIC,EAASD,EAAK,MAAM,GAAG,EAAE,IAAI,GAAG,QAAQ,OAAQ,EAAE,EACtD,OAAOE,EAAaD,CAAmC,CACzD","names":["imports_default","defaultBase","createFilter","fonts","tokens","name","getMediaQuery","name","suffix","media_queries_default"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
function l(e){let n,r,t="";if(typeof e=="string"||typeof e=="number")t+=e;else if(e&&typeof e=="object"&&"_classes"in e)t+=e.toString();else if(typeof e=="object")if(Array.isArray(e))for(n=0;n<e.length;n++)e[n]&&(r=l(e[n]))&&(t&&(t+=" "),t+=r);else for(n in e)e[n]&&(t&&(t+=" "),t+=n);return t}function a(...e){let n=0,r,t,s="";for(;n<e.length;)(r=e[n++])&&(t=l(r))&&(s&&(s+=" "),s+=t);return s}export{a};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
2
|
+
//# sourceMappingURL=chunk-DCLPPQO6.js.map
|