| 1 |
@use 'checkbox'; |
| 2 |
@use 'theme'; |
| 3 |
|
| 4 |
// Match the active subnavigation tile so it blends into the admin canvas. |
| 5 |
body.wp-admin { |
| 6 |
background: #f0f0f1; |
| 7 |
} |
| 8 |
|
| 9 |
// Remove the WordPress core 10px top margin on the import and manage snippets containers |
| 10 |
// so the subnav band sits flush against the toolbar. |
| 11 |
#import-container.wrap, |
| 12 |
#manage-snippets-container.wrap { |
| 13 |
margin-block-start: 0; |
| 14 |
} |
| 15 |
|
| 16 |
/** |
| 17 |
* Native form control styling. |
| 18 |
* |
| 19 |
* WordPress core ships different control metrics between versions (30/32px classic, |
| 20 |
* 40px with a 2px radius in the WP 7.0 "modern" redesign) and recolours secondary |
| 21 |
* buttons with the modern accent (#3858E9). These rules apply the plugin's own control |
| 22 |
* tokens — 38px height, 5px radius, theme control borders and the brand accent — |
| 23 |
* to native elements inside our admin pages so the layout renders consistently across |
| 24 |
* WP versions. They deliberately leave the admin menu, admin bar and |
| 25 |
* `@wordpress/components` React widgets untouched — only native inputs/buttons |
| 26 |
* rendered inside our own markup are normalised. |
| 27 |
*/ |
| 28 |
|
| 29 |
// Scope to our admin page content. We intentionally keep this to a single `.wrap` class so |
| 30 |
// the rules sit just above WordPress core defaults (which we must override) but below the |
| 31 |
// plugin's own more-specific per-control rules, which are emitted later in each bundle and so |
| 32 |
// win on equal specificity. This lets bespoke controls (conditions button, row-action links, |
| 33 |
// priority input, etc.) keep their intended styling without per-element exclusions here. |
| 34 |
.wrap, |
| 35 |
// Modals render through a portal on `document.body`, outside the page wrapper, so |
| 36 |
// the plugin's own dialogs are listed here to pick up the same control tokens. |
| 37 |
.code-snippets-preview-modal, |
| 38 |
.code-snippets-modal { |
| 39 |
// Native single-line text controls and selects: token height + border. |
| 40 |
// `@wordpress/components` inputs/selects (`.components-*`) keep their own design — they |
| 41 |
// are excluded so React widgets such as the tags token field are left untouched. |
| 42 |
// `.snippet-priority` (the borderless list-table priority field) is excluded so it keeps |
| 43 |
// its plain transparent styling rather than gaining a bordered box. |
| 44 |
input[type='text']='text']:not([class*='components-'], [id^='react-select-']), |
| 45 |
input[type='search']='search']:not([class*='components-']), |
| 46 |
input[type='number']='number']:not([class*='components-'], .snippet-priority), |
| 47 |
input[type='email']='email']:not([class*='components-']), |
| 48 |
input[type='url']='url']:not([class*='components-']), |
| 49 |
input[type='password']='password']:not([class*='components-']), |
| 50 |
input[type='tel']='tel']:not([class*='components-']) { |
| 51 |
// `min-block-size` (not a fixed `block-size`) so controls floor at the token height but |
| 52 |
// can still flex-stretch where the layout calls for it (e.g. the 54px cloud search bar). |
| 53 |
min-block-size: var(--cs-control-height); |
| 54 |
padding-block: 0; |
| 55 |
padding-inline: 8px; |
| 56 |
border: 1px solid var(--cs-color-border); |
| 57 |
border-radius: var(--cs-control-radius); |
| 58 |
line-height: 2; |
| 59 |
color: var(--cs-color-text); |
| 60 |
font-size: 14px; |
| 61 |
|
| 62 |
&:focus { |
| 63 |
border-color: var(--cs-color-accent); |
| 64 |
box-shadow: 0 0 0 1px var(--cs-color-accent); |
| 65 |
outline: 2px solid transparent; |
| 66 |
} |
| 67 |
} |
| 68 |
|
| 69 |
// Selects: same metrics, but preserve room for the WP dropdown chevron on the inline-end |
| 70 |
// side. WP 7.0 keeps the chevron as a background image; clamping both paddings to 8px (as |
| 71 |
// for text inputs) would let the arrow overlap the text, so the inline-end padding is wider. |
| 72 |
select:not([class*='components-']) { |
| 73 |
min-block-size: var(--cs-control-height); |
| 74 |
padding-block: 0; |
| 75 |
padding-inline: 8px 24px; |
| 76 |
border: 1px solid var(--cs-color-border); |
| 77 |
border-radius: var(--cs-control-radius); |
| 78 |
|
| 79 |
// WP 7.0 leaves a tall (≈38px) line-height on selects, pushing the value off-centre. |
| 80 |
// Pin it so the text stays vertically centred within the token height. |
| 81 |
line-height: 2; |
| 82 |
color: var(--cs-color-text); |
| 83 |
font-size: 14px; |
| 84 |
|
| 85 |
&:focus { |
| 86 |
border-color: var(--cs-color-accent); |
| 87 |
box-shadow: 0 0 0 1px var(--cs-color-accent); |
| 88 |
outline: 2px solid transparent; |
| 89 |
} |
| 90 |
} |
| 91 |
|
| 92 |
// Secondary buttons: token geometry, the grey fill and the brand accent border/text in |
| 93 |
// place of WP 7.0's transparent + modern-blue treatment. `.button-primary` is excluded |
| 94 |
// so its solid fill below is not overwritten. The line-height centres text vertically |
| 95 |
// in anchor-based buttons, which lack a button element's automatic centring. |
| 96 |
.button:not(.button-primary, .button-link), |
| 97 |
.button-secondary, |
| 98 |
.page-title-action { |
| 99 |
min-block-size: var(--cs-control-height); |
| 100 |
padding-block: 0; |
| 101 |
padding-inline: 12px; |
| 102 |
border-radius: var(--cs-control-radius); |
| 103 |
line-height: 2.5715; |
| 104 |
font-size: 14px; |
| 105 |
font-weight: 400; |
| 106 |
background: #f6f7f7; |
| 107 |
border-color: var(--cs-color-accent); |
| 108 |
color: var(--cs-color-accent); |
| 109 |
|
| 110 |
&:hover:not(:disabled) { |
| 111 |
background: #f0f0f1; |
| 112 |
border-color: var(--cs-color-accent-hover); |
| 113 |
color: var(--cs-color-accent-hover); |
| 114 |
} |
| 115 |
|
| 116 |
&:focus:not(:disabled) { |
| 117 |
border-color: #3582c4; |
| 118 |
box-shadow: 0 0 0 1px #3582c4; |
| 119 |
outline: 2px solid transparent; |
| 120 |
} |
| 121 |
} |
| 122 |
|
| 123 |
// Primary buttons: WP 7.0 recolours these with the modern accent and drops the solid |
| 124 |
// fill. Restore the classic solid brand-accent fill with white text. The `:not` |
| 125 |
// matches the secondary rule's specificity so a `.button-small.button-primary` |
| 126 |
// keeps the token height instead of collapsing to the 26px small size. |
| 127 |
.button-primary:not(.button-link) { |
| 128 |
min-block-size: var(--cs-control-height); |
| 129 |
padding-block: 0; |
| 130 |
padding-inline: 12px; |
| 131 |
border-radius: var(--cs-control-radius); |
| 132 |
line-height: 2.5715; |
| 133 |
font-size: 14px; |
| 134 |
font-weight: 700; |
| 135 |
background: var(--cs-color-accent); |
| 136 |
border-color: var(--cs-color-accent); |
| 137 |
color: #fff; |
| 138 |
|
| 139 |
&:hover:not(:disabled) { |
| 140 |
background: var(--cs-color-accent-hover); |
| 141 |
border-color: var(--cs-color-accent-hover); |
| 142 |
color: #fff; |
| 143 |
} |
| 144 |
|
| 145 |
&:focus:not(:disabled) { |
| 146 |
background: var(--cs-color-accent-hover); |
| 147 |
border-color: var(--cs-color-accent-hover); |
| 148 |
box-shadow: 0 0 0 1px #fff, 0 0 0 3px var(--cs-color-accent); |
| 149 |
outline: 2px solid transparent; |
| 150 |
} |
| 151 |
} |
| 152 |
|
| 153 |
// Small buttons stay compact rather than inheriting the 40px control height. |
| 154 |
.button-small { |
| 155 |
min-block-size: 26px; |
| 156 |
line-height: 2.1818; |
| 157 |
font-size: 11px; |
| 158 |
} |
| 159 |
} |
| 160 |
|
| 161 |
.wp-core-ui .wrap .button .dashicons { |
| 162 |
color: inherit; |
| 163 |
|
| 164 |
// WP 7.0's taller button line-height leaks onto dashicon glyphs inside buttons (e.g. the |
| 165 |
// conditions badge icon), pushing them out of vertical alignment. Reset it so icons stay |
| 166 |
// centred — mirrors the existing `.button svg` rule for SVG icons. |
| 167 |
line-height: 1; |
| 168 |
} |
| 169 |
|
| 170 |
// The Screen Options panel sits outside the page wrapper, in WordPress' own |
| 171 |
// screen meta region. These stylesheets are only loaded on the plugin's screens, |
| 172 |
// so its checkboxes are styled to match the ones in the page below it. |
| 173 |
#adv-settings { |
| 174 |
input[type='checkbox']='checkbox'] { |
| 175 |
@include checkbox.canonical; |
| 176 |
} |
| 177 |
|
| 178 |
// The canonical checkbox drops the margin WordPress relies on here, and the |
| 179 |
// gap otherwise comes from whitespace in the markup, which differs between |
| 180 |
// the fieldsets this plugin prints and the ones WordPress prints. |
| 181 |
label { |
| 182 |
display: inline-flex; |
| 183 |
align-items: center; |
| 184 |
gap: 6px; |
| 185 |
} |
| 186 |
} |
| 187 |
|