|
1 | 1 | # @vanilla-extract/css
|
2 | 2 |
|
| 3 | +## 1.16.0 |
| 4 | + |
| 5 | +### Minor Changes |
| 6 | + |
| 7 | +- [#1475](https://github.com/vanilla-extract-css/vanilla-extract/pull/1475) [`cd9d8b2`](https://github.com/vanilla-extract-css/vanilla-extract/commit/cd9d8b231bbd7a7ac6674d2b28f77cff93e5be9e) Thanks [@corradopetrelli](https://github.com/corradopetrelli)! - Add `::-webkit-calendar-picker-indicator` as a valid pseudo-element |
| 8 | + |
| 9 | +- [#1450](https://github.com/vanilla-extract-css/vanilla-extract/pull/1450) [`7b256d2`](https://github.com/vanilla-extract-css/vanilla-extract/commit/7b256d2a8ee815911ee96199abe78d6b7246c415) Thanks [@wuz](https://github.com/wuz)! - Add `createViewTransition` API |
| 10 | + |
| 11 | + `createViewTransition` creates a single scoped view transition name for use with CSS View Transitions. This avoids potential naming collisions with other view transitions. |
| 12 | + |
| 13 | + ```ts |
| 14 | + import { |
| 15 | + style, |
| 16 | + createViewTransition |
| 17 | + } from '@vanilla-extract/css'; |
| 18 | + |
| 19 | + export const titleViewTransition = createViewTransition(); |
| 20 | + |
| 21 | + export const pageTitle = style({ |
| 22 | + viewTransitionName: titleViewTransition |
| 23 | + }); |
| 24 | + ``` |
| 25 | + |
3 | 26 | ## 1.15.5
|
4 | 27 |
|
5 | 28 | ### Patch Changes
|
|
54 | 77 | globalFontFace(gentium, [
|
55 | 78 | {
|
56 | 79 | src: 'local("Gentium")',
|
57 |
| - fontWeight: 'normal', |
| 80 | + fontWeight: 'normal' |
58 | 81 | },
|
59 | 82 | {
|
60 | 83 | src: 'local("Gentium Bold")',
|
61 |
| - fontWeight: 'bold', |
62 |
| - }, |
| 84 | + fontWeight: 'bold' |
| 85 | + } |
63 | 86 | ]);
|
64 | 87 | ```
|
65 | 88 |
|
|
110 | 133 | const gentium = fontFace([
|
111 | 134 | {
|
112 | 135 | src: 'local("Gentium")',
|
113 |
| - fontWeight: 'normal', |
| 136 | + fontWeight: 'normal' |
114 | 137 | },
|
115 | 138 | {
|
116 | 139 | src: 'local("Gentium Bold")',
|
117 |
| - fontWeight: 'bold', |
118 |
| - }, |
| 140 | + fontWeight: 'bold' |
| 141 | + } |
119 | 142 | ]);
|
120 | 143 |
|
121 | 144 | export const font = style({
|
122 |
| - fontFamily: gentium, |
| 145 | + fontFamily: gentium |
123 | 146 | });
|
124 | 147 | ```
|
125 | 148 |
|
|
152 | 175 | export const standard = style({
|
153 | 176 | '@layer': {
|
154 | 177 | [typography]: {
|
155 |
| - fontSize: '1rem', |
156 |
| - }, |
157 |
| - }, |
| 178 | + fontSize: '1rem' |
| 179 | + } |
| 180 | + } |
158 | 181 | });
|
159 | 182 | ```
|
160 | 183 |
|
|
225 | 248 |
|
226 | 249 | const identifier = generateIdentifier({
|
227 | 250 | debugId,
|
228 |
| - debugFileName: false, |
| 251 | + debugFileName: false |
229 | 252 | });
|
230 | 253 | ```
|
231 | 254 |
|
|
244 | 267 | `createContainer` creates a single scoped container name for use with CSS Container Queries. This avoids potential naming collisions with other containers.
|
245 | 268 |
|
246 | 269 | ```ts
|
247 |
| - import { style, createContainer } from '@vanilla-extract/css'; |
| 270 | + import { |
| 271 | + style, |
| 272 | + createContainer |
| 273 | + } from '@vanilla-extract/css'; |
248 | 274 |
|
249 | 275 | export const sidebarContainer = createContainer();
|
250 | 276 |
|
251 | 277 | export const sidebar = style({
|
252 |
| - containerName: sidebarContainer, |
| 278 | + containerName: sidebarContainer |
253 | 279 | });
|
254 | 280 |
|
255 | 281 | export const navigation = style({
|
256 | 282 | '@container': {
|
257 | 283 | [`${sidebarContainer} (min-width: 400px)`]: {
|
258 |
| - display: 'flex', |
259 |
| - }, |
260 |
| - }, |
| 284 | + display: 'flex' |
| 285 | + } |
| 286 | + } |
261 | 287 | });
|
262 | 288 | ```
|
263 | 289 |
|
|
269 | 295 | export const myStyle = style({
|
270 | 296 | '@container': {
|
271 | 297 | '(min-width: 400px)': {
|
272 |
| - display: 'flex', |
273 |
| - }, |
274 |
| - }, |
| 298 | + display: 'flex' |
| 299 | + } |
| 300 | + } |
275 | 301 | });
|
276 | 302 | ```
|
277 | 303 |
|
|
409 | 435 |
|
410 | 436 | const base = style({ padding: 12 });
|
411 | 437 |
|
412 |
| - export const primary = style([base, { background: 'blue' }]); |
| 438 | + export const primary = style([ |
| 439 | + base, |
| 440 | + { background: 'blue' } |
| 441 | + ]); |
413 | 442 |
|
414 |
| - export const secondary = style([base, { background: 'aqua' }]); |
| 443 | + export const secondary = style([ |
| 444 | + base, |
| 445 | + { background: 'aqua' } |
| 446 | + ]); |
415 | 447 | ```
|
416 | 448 |
|
417 | 449 | When composed styles are used in selectors, they are assigned an additional class if required so they can be uniquely identified. When selectors are processed internally, the composed classes are removed, only leaving behind the unique identifier classes. This allows you to treat them as if they were a single class within vanilla-extract selectors.
|
|
425 | 457 | export const container = style([background, padding]);
|
426 | 458 |
|
427 | 459 | globalStyle(`${container} *`, {
|
428 |
| - boxSizing: 'border-box', |
| 460 | + boxSizing: 'border-box' |
429 | 461 | });
|
430 | 462 | ```
|
431 | 463 |
|
|
450 | 482 | // themes.css.ts
|
451 | 483 | import {
|
452 | 484 | createGlobalThemeContract,
|
453 |
| - createGlobalTheme, |
| 485 | + createGlobalTheme |
454 | 486 | } from '@vanilla-extract/css';
|
455 | 487 |
|
456 | 488 | export const vars = createGlobalThemeContract({
|
457 | 489 | color: {
|
458 |
| - brand: 'color-brand', |
| 490 | + brand: 'color-brand' |
459 | 491 | },
|
460 | 492 | font: {
|
461 |
| - body: 'font-body', |
462 |
| - }, |
| 493 | + body: 'font-body' |
| 494 | + } |
463 | 495 | });
|
464 | 496 |
|
465 | 497 | createGlobalTheme(':root', vars, {
|
466 | 498 | color: {
|
467 |
| - brand: 'blue', |
| 499 | + brand: 'blue' |
468 | 500 | },
|
469 | 501 | font: {
|
470 |
| - body: 'arial', |
471 |
| - }, |
| 502 | + body: 'arial' |
| 503 | + } |
472 | 504 | });
|
473 | 505 | ```
|
474 | 506 |
|
|
483 | 515 | export const vars = createGlobalThemeContract(
|
484 | 516 | {
|
485 | 517 | color: {
|
486 |
| - brand: 'color-brand', |
| 518 | + brand: 'color-brand' |
487 | 519 | },
|
488 | 520 | font: {
|
489 |
| - body: 'font-body', |
490 |
| - }, |
| 521 | + body: 'font-body' |
| 522 | + } |
491 | 523 | },
|
492 |
| - (value) => `prefix-${value}`, |
| 524 | + (value) => `prefix-${value}` |
493 | 525 | );
|
494 | 526 | ```
|
495 | 527 |
|
|
502 | 534 | export const vars = createGlobalThemeContract(
|
503 | 535 | {
|
504 | 536 | color: {
|
505 |
| - brand: null, |
| 537 | + brand: null |
506 | 538 | },
|
507 | 539 | font: {
|
508 |
| - body: null, |
509 |
| - }, |
| 540 | + body: null |
| 541 | + } |
510 | 542 | },
|
511 |
| - (_value, path) => `prefix-${path.join('-')}`, |
| 543 | + (_value, path) => `prefix-${path.join('-')}` |
512 | 544 | );
|
513 | 545 | ```
|
514 | 546 |
|
|
541 | 573 | When style compositions are used in selectors, they are now assigned an additional class so they can be uniquely identified. When selectors are processed internally, the composed classes are removed, only leaving behind the unique identifier classes. This allows you to treat them as if they were a single class within vanilla-extract selectors.
|
542 | 574 |
|
543 | 575 | ```ts
|
544 |
| - import { style, globalStyle, composeStyles } from '@vanilla-extract/css'; |
| 576 | + import { |
| 577 | + style, |
| 578 | + globalStyle, |
| 579 | + composeStyles |
| 580 | + } from '@vanilla-extract/css'; |
545 | 581 |
|
546 | 582 | const background = style({ background: 'mintcream' });
|
547 | 583 | const padding = style({ padding: 12 });
|
548 | 584 |
|
549 |
| - export const container = composeStyles(background, padding); |
| 585 | + export const container = composeStyles( |
| 586 | + background, |
| 587 | + padding |
| 588 | + ); |
550 | 589 |
|
551 | 590 | globalStyle(`${container} *`, {
|
552 |
| - boxSizing: 'border-box', |
| 591 | + boxSizing: 'border-box' |
553 | 592 | });
|
554 | 593 | ```
|
555 | 594 |
|
|
0 commit comments