Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add stylelint rule to prevent theme CSS vars outside of wp-components #59020

Merged
merged 2 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@
"at-rule-empty-line-before": null,
"at-rule-no-unknown": null,
"comment-empty-line-before": null,
"declaration-property-value-disallowed-list": [
{
"/.*/": [ "/--wp-components-color-/" ]
},
{
"message": "--wp-components-color-* variables are not ready to be used outside of the components package."
}
],
"font-weight-notation": null,
"max-line-length": null,
"no-descending-specificity": null,
Expand Down
2 changes: 1 addition & 1 deletion packages/base-styles/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
*/

@mixin block-toolbar-button-style__focus() {
box-shadow: inset 0 0 0 $border-width var(--wp-components-color-background, $white), 0 0 0 var(--wp-admin-border-width-focus) var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
box-shadow: inset 0 0 0 $border-width $white, 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);

// Windows High Contrast mode will show this outline, but not the box-shadow.
outline: 2px solid transparent;
Expand Down
6 changes: 3 additions & 3 deletions packages/dataviews/src/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
}
th {
text-align: left;
color: var(--wp-components-color-foreground, $gray-900);
color: $gray-900;
font-weight: normal;
font-size: $default-font-size;
}
Expand Down Expand Up @@ -527,7 +527,7 @@
&:hover,
&[data-active-item],
&:focus {
background-color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
background-color: var(--wp-admin-theme-color);
color: $white;

.dataviews-search-widget-filter-combobox-item-check {
Expand Down Expand Up @@ -587,7 +587,7 @@

&:focus {
background: $white;
box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
}

&::placeholder {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
outline: 3px solid transparent;
outline-offset: -2px;

color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
color: var(--wp-admin-theme-color);
background: rgba(var(--wp-admin-theme-color--rgb), 0.04);

.edit-site-global-styles-screen-revisions__revision-button {
Expand All @@ -61,7 +61,7 @@
}

&::before {
background: var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
background: var(--wp-admin-theme-color);
}

.edit-site-global-styles-screen-revisions__changes,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
&:focus-visible:not(:disabled) {
box-shadow:
0 0 0 var(--wp-admin-border-width-focus)
var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
var(--wp-admin-theme-color);
outline: 3px solid transparent;
}

Expand Down
Loading