@wordpress/base-styles 5.22.0 → 6.0.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/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 6.0.0 (2025-05-22)
6
+
7
+ ### Breaking Changes
8
+
9
+ - This package now requires [Dart Sass](https://www.npmjs.com/package/sass) to compile. Legacy Sass compilers like [LibSass](https://sass-lang.com/blog/libsass-is-deprecated/) ([`node-sass`](https://www.npmjs.com/package/node-sass)) and [Ruby Sass](https://sass-lang.com/blog/ruby-sass-is-unsupported/) are no longer supported ([#70135](https://github.com/WordPress/gutenberg/pull/70135)).
10
+
11
+ ## 5.23.0 (2025-05-07)
12
+
5
13
  ## 5.22.0 (2025-04-11)
6
14
 
7
15
  ## 5.21.0 (2025-03-27)
package/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  Base SCSS utilities and variables for WordPress.
4
4
 
5
+ Note: This package requires [Dart Sass](https://www.npmjs.com/package/sass) to compile. When using this package, make sure you are using Sass version 1.23.0 or later, which is based on Dart Sass.
6
+
5
7
  ## Installation
6
8
 
7
9
  Install the module
@@ -10,33 +12,29 @@ Install the module
10
12
  npm install @wordpress/base-styles --save-dev
11
13
  ```
12
14
 
13
- ## Use
14
-
15
- ### SCSS utilities and variables
15
+ ## Usage
16
16
 
17
17
  In your application's SCSS file, include styles like so:
18
18
 
19
19
  ```scss
20
- @import 'node_modules/@wordpress/base-styles/colors';
21
- @import 'node_modules/@wordpress/base-styles/variables';
22
- @import 'node_modules/@wordpress/base-styles/mixins';
23
- @import 'node_modules/@wordpress/base-styles/breakpoints';
24
- @import 'node_modules/@wordpress/base-styles/animations';
25
- @import 'node_modules/@wordpress/base-styles/z-index';
26
- @import 'node_modules/@wordpress/base-styles/default-custom-properties';
20
+ @use '@wordpress/base-styles/colors';
21
+ @use '@wordpress/base-styles/variables';
22
+ @use '@wordpress/base-styles/mixins';
23
+ @use '@wordpress/base-styles/breakpoints';
24
+ @use '@wordpress/base-styles/animations';
25
+ @use '@wordpress/base-styles/z-index';
26
+ @use '@wordpress/base-styles/default-custom-properties';
27
27
  ```
28
28
 
29
- If you use [Webpack](https://webpack.js.org/) for your SCSS pipeline, you can use `~` to resolve to `node_modules`:
29
+ Make sure to use namespaces when accessing utilities, variables, functions, etc. For example:
30
30
 
31
31
  ```scss
32
- @import '~@wordpress/base-styles/colors';
33
- ```
34
-
35
- To make that work with [`sass`](https://www.npmjs.com/package/sass) or [`node-sass`](https://www.npmjs.com/package/node-sass) NPM modules without Webpack, you'd have to use [includePaths option](https://sass-lang.com/documentation/js-api#includepaths):
32
+ .selector {
33
+ color: colors.$gray-300;
36
34
 
37
- ```json
38
- {
39
- "includePaths": [ "node_modules" ]
35
+ @include mixins.break-medium() {
36
+ font-size: variables.$font-size-large;
37
+ }
40
38
  }
41
39
  ```
42
40
 
@@ -1,5 +1,7 @@
1
1
  /** @format */
2
2
 
3
+ @use "sass:color";
4
+
3
5
  // Hugo's new WordPress shades of gray, from http://codepen.io/hugobaeta/pen/grJjVp.
4
6
  $black: #000;
5
7
  $white: #fff;
@@ -41,23 +43,23 @@ $blue-30: #5198d9;
41
43
 
42
44
  // Grays
43
45
  $gray: #87a6bc;
44
- $gray-light: lighten($gray, 33%); //#f3f6f8
45
- $gray-dark: darken($gray, 38%); //#2e4453
46
+ $gray-light: color.adjust($gray, $lightness: 33%); //#f3f6f8
47
+ $gray-dark: color.adjust($gray, $lightness: -38%); //#2e4453
46
48
  $gray-900: #1a1a1a;
47
49
  $gray-700: #757575;
48
50
 
49
51
  // $gray-text: ideal for standard, non placeholder text
50
52
  // $gray-text-min: minimum contrast needed for WCAG 2.0 AA on white background
51
53
  $gray-text: $gray-dark;
52
- $gray-text-min: darken($gray, 18%); //#537994
54
+ $gray-text-min: color.adjust($gray, $lightness: -18%); //#537994
53
55
 
54
56
  // Shades of gray
55
- $gray-lighten-10: lighten($gray, 10%); // #a8bece
56
- $gray-lighten-20: lighten($gray, 20%); // #c8d7e1
57
- $gray-lighten-30: lighten($gray, 30%); // #e9eff3
58
- $gray-darken-10: darken($gray, 10%);
59
- $gray-darken-20: darken($gray, 20%); // #4f748e
60
- $gray-darken-30: darken($gray, 30%); // #3d596d
57
+ $gray-lighten-10: color.adjust($gray, $lightness: 10%); // #a8bece
58
+ $gray-lighten-20: color.adjust($gray, $lightness: 20%); // #c8d7e1
59
+ $gray-lighten-30: color.adjust($gray, $lightness: 30%); // #e9eff3
60
+ $gray-darken-10: color.adjust($gray, $lightness: -10%);
61
+ $gray-darken-20: color.adjust($gray, $lightness: -20%); // #4f748e
62
+ $gray-darken-30: color.adjust($gray, $lightness: -30%); // #3d596d
61
63
 
62
64
  // Custom
63
65
  $toolbar-button: #7b9ab1;
package/_colors.scss CHANGED
@@ -1,5 +1,3 @@
1
- @import "./functions";
2
-
3
1
  /**
4
2
  * Colors
5
3
  */
@@ -1,11 +1,14 @@
1
+ @use "./mixins";
2
+ @use "./functions";
3
+
1
4
  // It is important to include these styles in all built stylesheets.
2
5
  // This allows to CSS variables post CSS plugin to generate fallbacks.
3
6
  // It also provides default CSS variables for npm package consumers.
4
7
  :root {
5
- @include admin-scheme(#007cba);
6
8
  --wp-block-synced-color: #7a00df;
7
- --wp-block-synced-color--rgb: #{hex-to-rgb(#7a00df)};
9
+ --wp-block-synced-color--rgb: #{functions.hex-to-rgb(#7a00df)};
8
10
  // This CSS variable is not used in Gutenberg project,
9
11
  // but is maintained for backwards compatibility.
10
12
  --wp-bound-block-color: var(--wp-block-synced-color);
13
+ @include mixins.admin-scheme(#007cba);
11
14
  }
package/_functions.scss CHANGED
@@ -4,6 +4,21 @@
4
4
  * @param {string} hex - the hexadecimal value to convert
5
5
  * @return {string} comma separated rgb values
6
6
  */
7
+
8
+ @use "sass:color";
9
+ @use "sass:meta";
10
+
7
11
  @function hex-to-rgb($hex) {
8
- @return red($hex), green($hex), blue($hex);
12
+ /*
13
+ * TODO: `color.{red|green|blue}` will trigger a deprecation warning in Dart Sass,
14
+ * but the Sass used by the Gutenberg project doesn't support `color.channel()` yet,
15
+ * so we can't migrate to it at this time.
16
+ * In the future, after the Gutenberg project has been fully migrated to Dart Sass,
17
+ * Remove this conditional statement and use only `color.channel()`.
18
+ */
19
+ @if meta.function-exists("channel", "color") {
20
+ @return color.channel($hex, "red"), color.channel($hex, "green"), color.channel($hex, "blue");
21
+ } @else {
22
+ @return color.red($hex), color.green($hex), color.blue($hex);
23
+ }
9
24
  }
package/_mixins.scss CHANGED
@@ -1,72 +1,77 @@
1
- @import "./functions";
2
- @import "./long-content-fade";
3
-
4
1
  /**
5
2
  * Typography
6
3
  */
7
4
 
5
+ @use "sass:color";
6
+ @use "sass:math";
7
+ @use "./variables";
8
+ @use "./colors";
9
+ @use "./breakpoints";
10
+ @use "./functions";
11
+ @use "./long-content-fade";
12
+
8
13
  @mixin _text-heading() {
9
- font-family: $font-family-headings;
10
- font-weight: $font-weight-medium;
14
+ font-family: variables.$font-family-headings;
15
+ font-weight: variables.$font-weight-medium;
11
16
  }
12
17
 
13
18
  @mixin _text-body() {
14
- font-family: $font-family-body;
15
- font-weight: $font-weight-regular;
19
+ font-family: variables.$font-family-body;
20
+ font-weight: variables.$font-weight-regular;
16
21
  }
17
22
 
18
23
  @mixin heading-small() {
19
24
  @include _text-heading();
20
- font-size: $font-size-x-small;
21
- line-height: $font-line-height-x-small;
25
+ font-size: variables.$font-size-x-small;
26
+ line-height: variables.$font-line-height-x-small;
22
27
  }
23
28
 
24
29
  @mixin heading-medium() {
25
30
  @include _text-heading();
26
- font-size: $font-size-medium;
27
- line-height: $font-line-height-small;
31
+ font-size: variables.$font-size-medium;
32
+ line-height: variables.$font-line-height-small;
28
33
  }
29
34
 
30
35
  @mixin heading-large() {
31
36
  @include _text-heading();
32
- font-size: $font-size-large;
33
- line-height: $font-line-height-small;
37
+ font-size: variables.$font-size-large;
38
+ line-height: variables.$font-line-height-small;
34
39
  }
35
40
 
36
41
  @mixin heading-x-large() {
37
42
  @include _text-heading();
38
- font-size: $font-size-x-large;
39
- line-height: $font-line-height-medium;
43
+ font-size: variables.$font-size-x-large;
44
+ line-height: variables.$font-line-height-medium;
40
45
  }
41
46
 
42
47
  @mixin heading-2x-large() {
43
48
  @include _text-heading();
44
- font-size: $font-size-2x-large;
45
- line-height: $font-line-height-2x-large;
49
+ font-size: variables.$font-size-2x-large;
50
+ line-height: variables.$font-line-height-2x-large;
46
51
  }
47
52
 
48
53
  @mixin body-small() {
49
54
  @include _text-body();
50
- font-size: $font-size-small;
51
- line-height: $font-line-height-x-small;
55
+ font-size: variables.$font-size-small;
56
+ line-height: variables.$font-line-height-x-small;
52
57
  }
53
58
 
54
59
  @mixin body-medium() {
55
60
  @include _text-body();
56
- font-size: $font-size-medium;
57
- line-height: $font-line-height-small;
61
+ font-size: variables.$font-size-medium;
62
+ line-height: variables.$font-line-height-small;
58
63
  }
59
64
 
60
65
  @mixin body-large() {
61
66
  @include _text-body();
62
- font-size: $font-size-large;
63
- line-height: $font-line-height-medium;
67
+ font-size: variables.$font-size-large;
68
+ line-height: variables.$font-line-height-medium;
64
69
  }
65
70
 
66
71
  @mixin body-x-large() {
67
72
  @include _text-body();
68
- font-size: $font-size-x-large;
69
- line-height: $font-line-height-x-large;
73
+ font-size: variables.$font-size-x-large;
74
+ line-height: variables.$font-line-height-x-large;
70
75
  }
71
76
 
72
77
  /**
@@ -74,55 +79,55 @@
74
79
  */
75
80
 
76
81
  @mixin break-xhuge() {
77
- @media (min-width: #{ ($break-xhuge) }) {
82
+ @media (min-width: #{ (breakpoints.$break-xhuge) }) {
78
83
  @content;
79
84
  }
80
85
  }
81
86
 
82
87
  @mixin break-huge() {
83
- @media (min-width: #{ ($break-huge) }) {
88
+ @media (min-width: #{ (breakpoints.$break-huge) }) {
84
89
  @content;
85
90
  }
86
91
  }
87
92
 
88
93
  @mixin break-wide() {
89
- @media (min-width: #{ ($break-wide) }) {
94
+ @media (min-width: #{ (breakpoints.$break-wide) }) {
90
95
  @content;
91
96
  }
92
97
  }
93
98
 
94
99
  @mixin break-xlarge() {
95
- @media (min-width: #{ ($break-xlarge) }) {
100
+ @media (min-width: #{ (breakpoints.$break-xlarge) }) {
96
101
  @content;
97
102
  }
98
103
  }
99
104
 
100
105
  @mixin break-large() {
101
- @media (min-width: #{ ($break-large) }) {
106
+ @media (min-width: #{ (breakpoints.$break-large) }) {
102
107
  @content;
103
108
  }
104
109
  }
105
110
 
106
111
  @mixin break-medium() {
107
- @media (min-width: #{ ($break-medium) }) {
112
+ @media (min-width: #{ (breakpoints.$break-medium) }) {
108
113
  @content;
109
114
  }
110
115
  }
111
116
 
112
117
  @mixin break-small() {
113
- @media (min-width: #{ ($break-small) }) {
118
+ @media (min-width: #{ (breakpoints.$break-small) }) {
114
119
  @content;
115
120
  }
116
121
  }
117
122
 
118
123
  @mixin break-mobile() {
119
- @media (min-width: #{ ($break-mobile) }) {
124
+ @media (min-width: #{ (breakpoints.$break-mobile) }) {
120
125
  @content;
121
126
  }
122
127
  }
123
128
 
124
129
  @mixin break-zoomed-in() {
125
- @media (min-width: #{ ($break-zoomed-in) }) {
130
+ @media (min-width: #{ (breakpoints.$break-zoomed-in) }) {
126
131
  @content;
127
132
  }
128
133
  }
@@ -132,7 +137,7 @@
132
137
  */
133
138
 
134
139
  @mixin block-toolbar-button-style__focus() {
135
- box-shadow: inset 0 0 0 $border-width $white, 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
140
+ box-shadow: inset 0 0 0 variables.$border-width colors.$white, 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
136
141
 
137
142
  // Windows High Contrast mode will show this outline, but not the box-shadow.
138
143
  outline: 2px solid transparent;
@@ -141,13 +146,12 @@
141
146
  // Tabs, Inputs, Square buttons.
142
147
  @mixin input-style__neutral() {
143
148
  box-shadow: 0 0 0 transparent;
149
+ border-radius: variables.$radius-small;
150
+ border: variables.$border-width solid colors.$gray-600;
144
151
 
145
152
  @media not (prefers-reduced-motion) {
146
153
  transition: box-shadow 0.1s linear;
147
154
  }
148
-
149
- border-radius: $radius-small;
150
- border: $border-width solid $gray-600;
151
155
  }
152
156
 
153
157
 
@@ -168,7 +172,7 @@
168
172
 
169
173
 
170
174
  @mixin button-style-outset__focus($focus-color) {
171
- box-shadow: 0 0 0 var(--wp-admin-border-width-focus) $white, 0 0 0 calc(2 * var(--wp-admin-border-width-focus)) $focus-color;
175
+ box-shadow: 0 0 0 var(--wp-admin-border-width-focus) colors.$white, 0 0 0 calc(2 * var(--wp-admin-border-width-focus)) $focus-color;
172
176
 
173
177
  // Windows High Contrast mode will show this outline, but not the box-shadow.
174
178
  outline: 2px solid transparent;
@@ -184,18 +188,18 @@
184
188
  #{$selector} { /* Set left position when auto-fold is not on the body element. */
185
189
  left: 0;
186
190
 
187
- @media (min-width: #{ ($break-medium + 1) }) {
188
- left: $admin-sidebar-width;
191
+ @media (min-width: #{ (breakpoints.$break-medium + 1) }) {
192
+ left: variables.$admin-sidebar-width;
189
193
  }
190
194
  }
191
195
 
192
196
  .auto-fold #{$selector} { /* Auto fold is when on smaller breakpoints, nav menu auto collapses. */
193
- @media (min-width: #{ ($break-medium + 1) }) {
194
- left: $admin-sidebar-width-collapsed;
197
+ @media (min-width: #{ (breakpoints.$break-medium + 1) }) {
198
+ left: variables.$admin-sidebar-width-collapsed;
195
199
  }
196
200
 
197
- @media (min-width: #{ ($break-large + 1) }) {
198
- left: $admin-sidebar-width;
201
+ @media (min-width: #{ (breakpoints.$break-large + 1) }) {
202
+ left: variables.$admin-sidebar-width;
199
203
  }
200
204
  }
201
205
 
@@ -203,8 +207,8 @@
203
207
  .folded #{$selector} {
204
208
  left: 0;
205
209
 
206
- @media (min-width: #{ ($break-medium + 1) }) {
207
- left: $admin-sidebar-width-collapsed;
210
+ @media (min-width: #{ (breakpoints.$break-medium + 1) }) {
211
+ left: variables.$admin-sidebar-width-collapsed;
208
212
  }
209
213
  }
210
214
 
@@ -225,11 +229,11 @@
225
229
 
226
230
  @mixin caption-style-theme() {
227
231
  color: #555;
228
- font-size: $default-font-size;
232
+ font-size: variables.$default-font-size;
229
233
  text-align: center;
230
234
 
231
235
  .is-dark-theme & {
232
- color: $light-gray-placeholder;
236
+ color: colors.$light-gray-placeholder;
233
237
  }
234
238
  }
235
239
 
@@ -260,16 +264,16 @@
260
264
  }
261
265
 
262
266
  @mixin input-control($accent-color: var(--wp-admin-theme-color)) {
263
- font-family: $default-font;
267
+ font-family: variables.$default-font;
264
268
  padding: 6px 8px;
265
- @include input-style__neutral();
266
-
267
269
  /* Fonts smaller than 16px causes mobile safari to zoom. */
268
- font-size: $mobile-text-min-font-size;
270
+ font-size: variables.$mobile-text-min-font-size;
269
271
  /* Override core line-height. To be reviewed. */
270
272
  line-height: normal;
273
+ @include input-style__neutral();
274
+
271
275
  @include break-small {
272
- font-size: $default-font-size;
276
+ font-size: variables.$default-font-size;
273
277
  /* Override core line-height. To be reviewed. */
274
278
  line-height: normal;
275
279
  }
@@ -280,27 +284,27 @@
280
284
 
281
285
  // Use opacity to work in various editor styles.
282
286
  &::-webkit-input-placeholder {
283
- color: $dark-gray-placeholder;
287
+ color: colors.$dark-gray-placeholder;
284
288
  }
285
289
 
286
290
  &::-moz-placeholder {
287
- color: $dark-gray-placeholder;
291
+ color: colors.$dark-gray-placeholder;
288
292
  }
289
293
 
290
294
  &:-ms-input-placeholder {
291
- color: $dark-gray-placeholder;
295
+ color: colors.$dark-gray-placeholder;
292
296
  }
293
297
  }
294
298
 
295
299
  @mixin checkbox-control {
296
- @include input-control;
297
- border: $border-width solid $gray-900;
298
- margin-right: $grid-unit-15;
300
+ border: variables.$border-width solid colors.$gray-900;
301
+ margin-right: variables.$grid-unit-15;
299
302
  transition: none;
300
- border-radius: $radius-small;
303
+ border-radius: variables.$radius-small;
304
+ @include input-control;
301
305
 
302
306
  &:focus {
303
- box-shadow: 0 0 0 ($border-width * 2) $white, 0 0 0 ($border-width * 2 + $border-width-focus-fallback) var(--wp-admin-theme-color);
307
+ box-shadow: 0 0 0 (variables.$border-width * 2) colors.$white, 0 0 0 (variables.$border-width * 2 + variables.$border-width-focus-fallback) var(--wp-admin-theme-color);
304
308
 
305
309
  // Only visible in Windows High Contrast mode.
306
310
  outline: 2px solid transparent;
@@ -319,7 +323,7 @@
319
323
  &:checked::before,
320
324
  &[aria-checked="mixed"]::before {
321
325
  margin: -3px -5px;
322
- color: $white;
326
+ color: colors.$white;
323
327
 
324
328
  @include break-medium() {
325
329
  margin: -4px 0 0 -5px;
@@ -353,8 +357,8 @@
353
357
 
354
358
  &[aria-disabled="true"],
355
359
  &:disabled {
356
- background: $gray-100;
357
- border-color: $gray-300;
360
+ background: colors.$gray-100;
361
+ border-color: colors.$gray-300;
358
362
  cursor: default;
359
363
 
360
364
  // Override style inherited from wp-admin. Required to avoid degraded appearance on different backgrounds.
@@ -363,46 +367,49 @@
363
367
  }
364
368
 
365
369
  @mixin radio-control {
366
- @include input-control;
367
- border: $border-width solid $gray-900;
368
- margin-right: $grid-unit-15;
370
+ border: variables.$border-width solid colors.$gray-900;
371
+ margin-right: variables.$grid-unit-15;
369
372
  transition: none;
370
- border-radius: $radius-round;
371
- width: $radio-input-size-sm;
372
- height: $radio-input-size-sm;
373
- min-width: $radio-input-size-sm;
374
- max-width: $radio-input-size-sm;
373
+ border-radius: variables.$radius-round;
374
+ width: variables.$radio-input-size-sm;
375
+ height: variables.$radio-input-size-sm;
376
+ min-width: variables.$radio-input-size-sm;
377
+ max-width: variables.$radio-input-size-sm;
375
378
  position: relative;
376
379
 
380
+ @media not (prefers-reduced-motion) {
381
+ transition: box-shadow 0.1s linear;
382
+ }
383
+
377
384
  @include break-small() {
378
- height: $radio-input-size;
379
- width: $radio-input-size;
380
- min-width: $radio-input-size;
381
- max-width: $radio-input-size;
385
+ height: variables.$radio-input-size;
386
+ width: variables.$radio-input-size;
387
+ min-width: variables.$radio-input-size;
388
+ max-width: variables.$radio-input-size;
382
389
  }
383
390
 
384
391
  &:checked::before {
385
392
  box-sizing: inherit;
386
- width: math.div($radio-input-size-sm, 2);
387
- height: math.div($radio-input-size-sm, 2);
393
+ width: math.div(variables.$radio-input-size-sm, 2);
394
+ height: math.div(variables.$radio-input-size-sm, 2);
388
395
  position: absolute;
389
396
  top: 50%;
390
397
  left: 50%;
391
398
  transform: translate(-50%, -50%);
392
399
  margin: 0;
393
- background-color: $white;
400
+ background-color: colors.$white;
394
401
 
395
402
  // This border serves as a background color in Windows High Contrast mode.
396
- border: 4px solid $white;
403
+ border: 4px solid colors.$white;
397
404
 
398
405
  @include break-small() {
399
- width: math.div($radio-input-size, 2);
400
- height: math.div($radio-input-size, 2);
406
+ width: math.div(variables.$radio-input-size, 2);
407
+ height: math.div(variables.$radio-input-size, 2);
401
408
  }
402
409
  }
403
410
 
404
411
  &:focus {
405
- box-shadow: 0 0 0 ($border-width * 2) $white, 0 0 0 ($border-width * 2 + $border-width-focus-fallback) var(--wp-admin-theme-color);
412
+ box-shadow: 0 0 0 (variables.$border-width * 2) colors.$white, 0 0 0 (variables.$border-width * 2 + variables.$border-width-focus-fallback) var(--wp-admin-theme-color);
406
413
 
407
414
  // Only visible in Windows High Contrast mode.
408
415
  outline: 2px solid transparent;
@@ -433,29 +440,29 @@
433
440
  &:focus {
434
441
  color: var(--wp-admin-theme-color--rgb);
435
442
  box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color, #007cba);
436
- border-radius: $radius-small;
443
+ border-radius: variables.$radius-small;
437
444
  }
438
445
  }
439
446
 
440
447
  // The editor input reset with increased specificity to avoid theme styles bleeding in.
441
448
  @mixin editor-input-reset() {
442
- font-family: $editor-html-font !important;
443
- color: $gray-900 !important;
444
- background: $white !important;
445
- padding: $grid-unit-15 !important;
446
- border: $border-width solid $gray-900 !important;
449
+ font-family: variables.$editor-html-font !important;
450
+ color: colors.$gray-900 !important;
451
+ background: colors.$white !important;
452
+ padding: variables.$grid-unit-15 !important;
453
+ border: variables.$border-width solid colors.$gray-900 !important;
447
454
  box-shadow: none !important;
448
- border-radius: $radius-small !important;
455
+ border-radius: variables.$radius-small !important;
449
456
 
450
457
  // Fonts smaller than 16px causes mobile safari to zoom.
451
- font-size: $mobile-text-min-font-size !important;
458
+ font-size: variables.$mobile-text-min-font-size !important;
452
459
  @include break-small {
453
- font-size: $default-font-size !important;
460
+ font-size: variables.$default-font-size !important;
454
461
  }
455
462
 
456
463
  &:focus {
457
464
  border-color: var(--wp-admin-theme-color) !important;
458
- box-shadow: 0 0 0 ($border-width-focus-fallback - $border-width) var(--wp-admin-theme-color) !important;
465
+ box-shadow: 0 0 0 (variables.$border-width-focus-fallback - variables.$border-width) var(--wp-admin-theme-color) !important;
459
466
 
460
467
  // Windows High Contrast mode will show this outline, but not the box-shadow.
461
468
  outline: 2px solid transparent !important;
@@ -467,7 +474,7 @@
467
474
  */
468
475
 
469
476
  @mixin wp-admin-reset( $content-container ) {
470
- background: $white;
477
+ background: colors.$white;
471
478
 
472
479
  #wpcontent {
473
480
  padding-left: 0;
@@ -494,7 +501,7 @@
494
501
 
495
502
  ul#adminmenu a.wp-has-current-submenu::after,
496
503
  ul#adminmenu > li.current > a.current::after {
497
- border-right-color: $white;
504
+ border-right-color: colors.$white;
498
505
  }
499
506
 
500
507
  .media-frame select.attachment-filters:last-of-type {
@@ -507,12 +514,12 @@
507
514
  // Define RGB equivalents for use in rgba function.
508
515
  // Hexadecimal css vars do not work in the rgba function.
509
516
  --wp-admin-theme-color: #{$color-primary};
510
- --wp-admin-theme-color--rgb: #{hex-to-rgb($color-primary)};
517
+ --wp-admin-theme-color--rgb: #{functions.hex-to-rgb($color-primary)};
511
518
  // Darker shades.
512
- --wp-admin-theme-color-darker-10: #{darken($color-primary, 5%)};
513
- --wp-admin-theme-color-darker-10--rgb: #{hex-to-rgb(darken($color-primary, 5%))};
514
- --wp-admin-theme-color-darker-20: #{darken($color-primary, 10%)};
515
- --wp-admin-theme-color-darker-20--rgb: #{hex-to-rgb(darken($color-primary, 10%))};
519
+ --wp-admin-theme-color-darker-10: #{color.adjust($color-primary, $lightness: -5%)};
520
+ --wp-admin-theme-color-darker-10--rgb: #{functions.hex-to-rgb(color.adjust($color-primary, $lightness: -5%))};
521
+ --wp-admin-theme-color-darker-20: #{color.adjust($color-primary, $lightness: -10%)};
522
+ --wp-admin-theme-color-darker-20--rgb: #{functions.hex-to-rgb(color.adjust($color-primary, $lightness: -10%))};
516
523
 
517
524
  // Focus style width.
518
525
  // Avoid rounding issues by showing a whole 2px for 1x screens, and 1.5px on high resolution screens.
package/_variables.scss CHANGED
@@ -6,7 +6,7 @@
6
6
  * For example, don't add rules to this sheet that affect block visuals. It's purely for UI.
7
7
  */
8
8
 
9
- @import "./colors";
9
+ @use "./colors";
10
10
 
11
11
  /**
12
12
  * Fonts & basic variables.
@@ -77,16 +77,16 @@ $radius-round: 50%; // For circles and ovals.
77
77
  */
78
78
 
79
79
  // For sections and containers that group related content and controls, which may overlap other content. Example: Preview Frame.
80
- $elevation-x-small: 0 1px 1px rgba($black, 0.03), 0 1px 2px rgba($black, 0.02), 0 3px 3px rgba($black, 0.02), 0 4px 4px rgba($black, 0.01);
80
+ $elevation-x-small: 0 1px 1px rgba(colors.$black, 0.03), 0 1px 2px rgba(colors.$black, 0.02), 0 3px 3px rgba(colors.$black, 0.02), 0 4px 4px rgba(colors.$black, 0.01);
81
81
 
82
82
  // For components that provide contextual feedback without being intrusive. Generally non-interruptive. Example: Tooltips, Snackbar.
83
- $elevation-small: 0 1px 2px rgba($black, 0.05), 0 2px 3px rgba($black, 0.04), 0 6px 6px rgba($black, 0.03), 0 8px 8px rgba($black, 0.02);
83
+ $elevation-small: 0 1px 2px rgba(colors.$black, 0.05), 0 2px 3px rgba(colors.$black, 0.04), 0 6px 6px rgba(colors.$black, 0.03), 0 8px 8px rgba(colors.$black, 0.02);
84
84
 
85
85
  // For components that offer additional actions. Example: Menus, Command Palette
86
- $elevation-medium: 0 2px 3px rgba($black, 0.05), 0 4px 5px rgba($black, 0.04), 0 12px 12px rgba($black, 0.03), 0 16px 16px rgba($black, 0.02);
86
+ $elevation-medium: 0 2px 3px rgba(colors.$black, 0.05), 0 4px 5px rgba(colors.$black, 0.04), 0 12px 12px rgba(colors.$black, 0.03), 0 16px 16px rgba(colors.$black, 0.02);
87
87
 
88
88
  // For components that confirm decisions or handle necessary interruptions. Example: Modals.
89
- $elevation-large: 0 5px 15px rgba($black, 0.08), 0 15px 27px rgba($black, 0.07), 0 30px 36px rgba($black, 0.04), 0 50px 43px rgba($black, 0.02);
89
+ $elevation-large: 0 5px 15px rgba(colors.$black, 0.08), 0 15px 27px rgba(colors.$black, 0.07), 0 30px 36px rgba(colors.$black, 0.04), 0 50px 43px rgba(colors.$black, 0.02);
90
90
 
91
91
  /**
92
92
  * Dimensions.
package/_z-index.scss CHANGED
@@ -1,3 +1,5 @@
1
+ @use "sass:map";
2
+
1
3
  // Stores a list of z-index values in a central location. For clarity, when a
2
4
  // specific value is needed, add a comment explaining why (what other rules the
3
5
  // value is designed to work with).
@@ -14,6 +16,7 @@ $z-layers: (
14
16
  // These next three share a stacking context
15
17
  ".block-library-template-part__selection-search": 2, // higher sticky element
16
18
  ".block-library-query-pattern__selection-search": 2, // higher sticky element
19
+ ".editor-post-template__swap-template-search": 2, // higher sticky element
17
20
 
18
21
  // These next two share a stacking context
19
22
  ".interface-complementary-area .components-panel" : 0, // lower scrolling content
@@ -216,8 +219,8 @@ $z-layers: (
216
219
  );
217
220
 
218
221
  @function z-index( $key ) {
219
- @if map-has-key( $z-layers, $key ) {
220
- @return map-get( $z-layers, $key );
222
+ @if map.has-key( $z-layers, $key ) {
223
+ @return map.get( $z-layers, $key );
221
224
  }
222
225
 
223
226
  @error "Error: Specified z-index `#{$key}` does not exist in the mapping";
@@ -1,15 +1,57 @@
1
- /**
2
- * Converts a hex value into the rgb equivalent.
3
- *
4
- * @param {string} hex - the hexadecimal value to convert
5
- * @return {string} comma separated rgb values
6
- */
7
1
  /**
8
2
  * Colors
9
3
  */
10
4
  /**
11
5
  * Breakpoints & Media Queries
12
6
  */
7
+ /**
8
+ * Colors
9
+ */
10
+ /**
11
+ * SCSS Variables.
12
+ *
13
+ * Please use variables from this sheet to ensure consistency across the UI.
14
+ * Don't add to this sheet unless you're pretty sure the value will be reused in many places.
15
+ * For example, don't add rules to this sheet that affect block visuals. It's purely for UI.
16
+ */
17
+ /**
18
+ * Fonts & basic variables.
19
+ */
20
+ /**
21
+ * Typography
22
+ */
23
+ /**
24
+ * Grid System.
25
+ * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/
26
+ */
27
+ /**
28
+ * Radius scale.
29
+ */
30
+ /**
31
+ * Elevation scale.
32
+ */
33
+ /**
34
+ * Dimensions.
35
+ */
36
+ /**
37
+ * Mobile specific styles
38
+ */
39
+ /**
40
+ * Editor styles.
41
+ */
42
+ /**
43
+ * Block & Editor UI.
44
+ */
45
+ /**
46
+ * Block paddings.
47
+ */
48
+ /**
49
+ * React Native specific.
50
+ * These variables do not appear to be used anywhere else.
51
+ */
52
+ /**
53
+ * Colors
54
+ */
13
55
  /**
14
56
  * SCSS Variables.
15
57
  *
@@ -17,15 +59,91 @@
17
59
  * Don't add to this sheet unless you're pretty sure the value will be reused in many places.
18
60
  * For example, don't add rules to this sheet that affect block visuals. It's purely for UI.
19
61
  */
62
+ /**
63
+ * Fonts & basic variables.
64
+ */
65
+ /**
66
+ * Typography
67
+ */
68
+ /**
69
+ * Grid System.
70
+ * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/
71
+ */
72
+ /**
73
+ * Radius scale.
74
+ */
75
+ /**
76
+ * Elevation scale.
77
+ */
78
+ /**
79
+ * Dimensions.
80
+ */
81
+ /**
82
+ * Mobile specific styles
83
+ */
84
+ /**
85
+ * Editor styles.
86
+ */
87
+ /**
88
+ * Block & Editor UI.
89
+ */
90
+ /**
91
+ * Block paddings.
92
+ */
93
+ /**
94
+ * React Native specific.
95
+ * These variables do not appear to be used anywhere else.
96
+ */
97
+ /**
98
+ * Breakpoints & Media Queries
99
+ */
20
100
  /**
21
101
  * Converts a hex value into the rgb equivalent.
22
102
  *
23
103
  * @param {string} hex - the hexadecimal value to convert
24
104
  * @return {string} comma separated rgb values
25
105
  */
106
+ /**
107
+ * Long content fade mixin
108
+ *
109
+ * Creates a fading overlay to signify that the content is longer
110
+ * than the space allows.
111
+ */
112
+ /**
113
+ * Typography
114
+ */
115
+ /**
116
+ * Breakpoint mixins
117
+ */
118
+ /**
119
+ * Focus styles.
120
+ */
121
+ /**
122
+ * Applies editor left position to the selector passed as argument
123
+ */
124
+ /**
125
+ * Styles that are reused verbatim in a few places
126
+ */
127
+ /**
128
+ * Allows users to opt-out of animations via OS-level preferences.
129
+ */
130
+ /**
131
+ * Reset default styles for JavaScript UI based pages.
132
+ * This is a WP-admin agnostic reset
133
+ */
134
+ /**
135
+ * Reset the WP Admin page styles for Gutenberg-like pages.
136
+ */
26
137
  /**
27
138
  * Colors
28
139
  */
140
+ /**
141
+ * SCSS Variables.
142
+ *
143
+ * Please use variables from this sheet to ensure consistency across the UI.
144
+ * Don't add to this sheet unless you're pretty sure the value will be reused in many places.
145
+ * For example, don't add rules to this sheet that affect block visuals. It's purely for UI.
146
+ */
29
147
  /**
30
148
  * Fonts & basic variables.
31
149
  */
@@ -61,6 +179,9 @@
61
179
  * React Native specific.
62
180
  * These variables do not appear to be used anywhere else.
63
181
  */
182
+ /**
183
+ * Breakpoints & Media Queries
184
+ */
64
185
  /**
65
186
  * Converts a hex value into the rgb equivalent.
66
187
  *
@@ -99,6 +220,9 @@
99
220
  * Reset the WP Admin page styles for Gutenberg-like pages.
100
221
  */
101
222
  :root {
223
+ --wp-block-synced-color: #7a00df;
224
+ --wp-block-synced-color--rgb: 122, 0, 223;
225
+ --wp-bound-block-color: var(--wp-block-synced-color);
102
226
  --wp-admin-theme-color: #007cba;
103
227
  --wp-admin-theme-color--rgb: 0, 124, 186;
104
228
  --wp-admin-theme-color-darker-10: #006ba1;
@@ -106,9 +230,6 @@
106
230
  --wp-admin-theme-color-darker-20: #005a87;
107
231
  --wp-admin-theme-color-darker-20--rgb: 0, 90, 135;
108
232
  --wp-admin-border-width-focus: 2px;
109
- --wp-block-synced-color: #7a00df;
110
- --wp-block-synced-color--rgb: 122, 0, 223;
111
- --wp-bound-block-color: var(--wp-block-synced-color);
112
233
  }
113
234
  @media (min-resolution: 192dpi) {
114
235
  :root {
@@ -1,15 +1,57 @@
1
- /**
2
- * Converts a hex value into the rgb equivalent.
3
- *
4
- * @param {string} hex - the hexadecimal value to convert
5
- * @return {string} comma separated rgb values
6
- */
7
1
  /**
8
2
  * Colors
9
3
  */
10
4
  /**
11
5
  * Breakpoints & Media Queries
12
6
  */
7
+ /**
8
+ * Colors
9
+ */
10
+ /**
11
+ * SCSS Variables.
12
+ *
13
+ * Please use variables from this sheet to ensure consistency across the UI.
14
+ * Don't add to this sheet unless you're pretty sure the value will be reused in many places.
15
+ * For example, don't add rules to this sheet that affect block visuals. It's purely for UI.
16
+ */
17
+ /**
18
+ * Fonts & basic variables.
19
+ */
20
+ /**
21
+ * Typography
22
+ */
23
+ /**
24
+ * Grid System.
25
+ * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/
26
+ */
27
+ /**
28
+ * Radius scale.
29
+ */
30
+ /**
31
+ * Elevation scale.
32
+ */
33
+ /**
34
+ * Dimensions.
35
+ */
36
+ /**
37
+ * Mobile specific styles
38
+ */
39
+ /**
40
+ * Editor styles.
41
+ */
42
+ /**
43
+ * Block & Editor UI.
44
+ */
45
+ /**
46
+ * Block paddings.
47
+ */
48
+ /**
49
+ * React Native specific.
50
+ * These variables do not appear to be used anywhere else.
51
+ */
52
+ /**
53
+ * Colors
54
+ */
13
55
  /**
14
56
  * SCSS Variables.
15
57
  *
@@ -17,15 +59,91 @@
17
59
  * Don't add to this sheet unless you're pretty sure the value will be reused in many places.
18
60
  * For example, don't add rules to this sheet that affect block visuals. It's purely for UI.
19
61
  */
62
+ /**
63
+ * Fonts & basic variables.
64
+ */
65
+ /**
66
+ * Typography
67
+ */
68
+ /**
69
+ * Grid System.
70
+ * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/
71
+ */
72
+ /**
73
+ * Radius scale.
74
+ */
75
+ /**
76
+ * Elevation scale.
77
+ */
78
+ /**
79
+ * Dimensions.
80
+ */
81
+ /**
82
+ * Mobile specific styles
83
+ */
84
+ /**
85
+ * Editor styles.
86
+ */
87
+ /**
88
+ * Block & Editor UI.
89
+ */
90
+ /**
91
+ * Block paddings.
92
+ */
93
+ /**
94
+ * React Native specific.
95
+ * These variables do not appear to be used anywhere else.
96
+ */
97
+ /**
98
+ * Breakpoints & Media Queries
99
+ */
20
100
  /**
21
101
  * Converts a hex value into the rgb equivalent.
22
102
  *
23
103
  * @param {string} hex - the hexadecimal value to convert
24
104
  * @return {string} comma separated rgb values
25
105
  */
106
+ /**
107
+ * Long content fade mixin
108
+ *
109
+ * Creates a fading overlay to signify that the content is longer
110
+ * than the space allows.
111
+ */
112
+ /**
113
+ * Typography
114
+ */
115
+ /**
116
+ * Breakpoint mixins
117
+ */
118
+ /**
119
+ * Focus styles.
120
+ */
121
+ /**
122
+ * Applies editor left position to the selector passed as argument
123
+ */
124
+ /**
125
+ * Styles that are reused verbatim in a few places
126
+ */
127
+ /**
128
+ * Allows users to opt-out of animations via OS-level preferences.
129
+ */
130
+ /**
131
+ * Reset default styles for JavaScript UI based pages.
132
+ * This is a WP-admin agnostic reset
133
+ */
134
+ /**
135
+ * Reset the WP Admin page styles for Gutenberg-like pages.
136
+ */
26
137
  /**
27
138
  * Colors
28
139
  */
140
+ /**
141
+ * SCSS Variables.
142
+ *
143
+ * Please use variables from this sheet to ensure consistency across the UI.
144
+ * Don't add to this sheet unless you're pretty sure the value will be reused in many places.
145
+ * For example, don't add rules to this sheet that affect block visuals. It's purely for UI.
146
+ */
29
147
  /**
30
148
  * Fonts & basic variables.
31
149
  */
@@ -61,6 +179,9 @@
61
179
  * React Native specific.
62
180
  * These variables do not appear to be used anywhere else.
63
181
  */
182
+ /**
183
+ * Breakpoints & Media Queries
184
+ */
64
185
  /**
65
186
  * Converts a hex value into the rgb equivalent.
66
187
  *
@@ -99,6 +220,9 @@
99
220
  * Reset the WP Admin page styles for Gutenberg-like pages.
100
221
  */
101
222
  :root {
223
+ --wp-block-synced-color: #7a00df;
224
+ --wp-block-synced-color--rgb: 122, 0, 223;
225
+ --wp-bound-block-color: var(--wp-block-synced-color);
102
226
  --wp-admin-theme-color: #007cba;
103
227
  --wp-admin-theme-color--rgb: 0, 124, 186;
104
228
  --wp-admin-theme-color-darker-10: #006ba1;
@@ -106,9 +230,6 @@
106
230
  --wp-admin-theme-color-darker-20: #005a87;
107
231
  --wp-admin-theme-color-darker-20--rgb: 0, 90, 135;
108
232
  --wp-admin-border-width-focus: 2px;
109
- --wp-block-synced-color: #7a00df;
110
- --wp-block-synced-color--rgb: 122, 0, 223;
111
- --wp-bound-block-color: var(--wp-block-synced-color);
112
233
  }
113
234
  @media (min-resolution: 192dpi) {
114
235
  :root {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/base-styles",
3
- "version": "5.22.0",
3
+ "version": "6.0.0",
4
4
  "description": "Base SCSS utilities and variables for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -27,5 +27,5 @@
27
27
  "publishConfig": {
28
28
  "access": "public"
29
29
  },
30
- "gitHead": "01a314d7e46a50101e328fdb11959c441e49372d"
30
+ "gitHead": "9c03d1458cae76792ae15e67b421205836bf4393"
31
31
  }