| 1 |
/** |
| 2 |
* Drafts widget styles. The card chrome (glass, padding) comes from the |
| 3 |
* widget layer; these rules lay out the header + the list of drafts. |
| 4 |
* Built into assets/js/widget-drafts[.min].css by the Vite target. |
| 5 |
*/ |
| 6 |
|
| 7 |
.dm-drafts__header { |
| 8 |
display: flex; |
| 9 |
align-items: center; |
| 10 |
gap: 8px; |
| 11 |
margin-bottom: 8px; |
| 12 |
} |
| 13 |
|
| 14 |
.dm-drafts__title { |
| 15 |
font-size: 13px; |
| 16 |
font-weight: 600; |
| 17 |
} |
| 18 |
|
| 19 |
.dm-drafts__badge { |
| 20 |
display: none; |
| 21 |
min-width: 18px; |
| 22 |
height: 18px; |
| 23 |
padding: 0 5px; |
| 24 |
border-radius: 999px; |
| 25 |
background: color-mix( in srgb, currentColor 16%, transparent ); |
| 26 |
font-size: 11px; |
| 27 |
font-weight: 600; |
| 28 |
line-height: 18px; |
| 29 |
text-align: center; |
| 30 |
opacity: 0.85; |
| 31 |
} |
| 32 |
|
| 33 |
.dm-drafts__badge--visible { |
| 34 |
display: inline-block; |
| 35 |
} |
| 36 |
|
| 37 |
.dm-drafts__empty { |
| 38 |
font-size: 12px; |
| 39 |
opacity: 0.7; |
| 40 |
padding: 6px 0; |
| 41 |
} |
| 42 |
|
| 43 |
.dm-drafts__list { |
| 44 |
display: flex; |
| 45 |
flex-direction: column; |
| 46 |
gap: 2px; |
| 47 |
} |
| 48 |
|
| 49 |
.dm-drafts__row { |
| 50 |
display: flex; |
| 51 |
align-items: center; |
| 52 |
gap: 2px; |
| 53 |
margin: 0 -8px; |
| 54 |
border-radius: 8px; |
| 55 |
} |
| 56 |
|
| 57 |
.dm-drafts__row:hover, |
| 58 |
.dm-drafts__row:has( a.dm-drafts__link:focus-visible ) { |
| 59 |
background: color-mix( in srgb, currentColor 10%, transparent ); |
| 60 |
} |
| 61 |
|
| 62 |
.dm-drafts__row.is-trashing { |
| 63 |
opacity: 0.5; |
| 64 |
pointer-events: none; |
| 65 |
} |
| 66 |
|
| 67 |
.dm-drafts__link { |
| 68 |
flex: 1 1 auto; |
| 69 |
min-width: 0; |
| 70 |
display: flex; |
| 71 |
align-items: baseline; |
| 72 |
justify-content: space-between; |
| 73 |
gap: 10px; |
| 74 |
padding: 6px 8px; |
| 75 |
text-decoration: none; |
| 76 |
} |
| 77 |
|
| 78 |
/* |
| 79 |
* Colour and focus ring, restated with the element in the selector. |
| 80 |
* |
| 81 |
* wp-admin repaints every `<a>` on interaction: `a:hover, a:active` |
| 82 |
* to #135e96 and `a:focus` to #043959, plus a hairline ring and a 2px |
| 83 |
* radius. Those selectors out-specify a plain |
| 84 |
* `.dm-drafts__link { color: inherit }`, so the row a user had just |
| 85 |
* clicked went dark navy on dark glass, about 1.5:1 against the card |
| 86 |
* it sits on. The one draft they could no longer read was the one |
| 87 |
* they were working on. Leading `a.` out-specifies core in turn, and |
| 88 |
* every interactive state is named so none of them can leak back. |
| 89 |
* |
| 90 |
* The ring is ours for the same reason the text is. Core's is the |
| 91 |
* neat accent on a 2px radius: it neither follows the row's 8px |
| 92 |
* corner nor holds contrast on a card that can be arbitrarily light |
| 93 |
* or dark, since the widget is glass over the wallpaper. |
| 94 |
* `--dm-drafts-accent` (defined further down) is the accent already |
| 95 |
* mixed toward `currentColor` for exactly that reason. |
| 96 |
*/ |
| 97 |
a.dm-drafts__link, |
| 98 |
a.dm-drafts__link:hover, |
| 99 |
a.dm-drafts__link:focus, |
| 100 |
a.dm-drafts__link:active, |
| 101 |
a.dm-drafts__link:visited { |
| 102 |
color: inherit; |
| 103 |
border-radius: 8px; |
| 104 |
} |
| 105 |
|
| 106 |
/* |
| 107 |
* Press feedback. |
| 108 |
* |
| 109 |
* Core's was a colour swap (`a:active` to #135e96), and it went out |
| 110 |
* with the rest of the leak above, which left a press saying nothing |
| 111 |
* at all. The shell answers a press with a scale rather than a hue: |
| 112 |
* `.os-constellation__row`, a row of this same shape, uses the same |
| 113 |
* 0.985. It costs no colour, which is what a card sitting on an |
| 114 |
* arbitrary wallpaper can least afford to spend, and unlike a hover |
| 115 |
* fill it works under a finger as well as a pointer. |
| 116 |
*/ |
| 117 |
a.dm-drafts__link:active { |
| 118 |
transform: scale( 0.985 ); |
| 119 |
} |
| 120 |
|
| 121 |
a.dm-drafts__link:focus-visible { |
| 122 |
outline: 2px solid var( --dm-drafts-accent, #2271b1 ); |
| 123 |
outline-offset: -2px; |
| 124 |
box-shadow: none; |
| 125 |
} |
| 126 |
|
| 127 |
/* Core rings on `:focus`, not `:focus-visible`, so a click parks a |
| 128 |
ring on the row long after the draft has opened in its window. |
| 129 |
Keyboard focus keeps the ring above; pointer focus drops it. */ |
| 130 |
a.dm-drafts__link:focus:not( :focus-visible ) { |
| 131 |
outline: none; |
| 132 |
box-shadow: none; |
| 133 |
} |
| 134 |
|
| 135 |
/* |
| 136 |
* Row actions (Trash, Suggest) are `<os-button variant="ghost">` hosts — |
| 137 |
* the component owns the focus ring, disabled semantics and theming; these |
| 138 |
* rules only tune it into a 26px icon square via the documented |
| 139 |
* `--os-ui-button-*` surface and the `button` shadow part. Both stay hidden |
| 140 |
* until the row is hovered or the control takes focus. |
| 141 |
*/ |
| 142 |
.dm-drafts__trash, |
| 143 |
.dm-drafts__spark { |
| 144 |
flex: 0 0 auto; |
| 145 |
opacity: 0; |
| 146 |
transition: opacity 120ms ease-out; |
| 147 |
--os-ui-button-padding: 0; |
| 148 |
--os-ui-button-border: none; |
| 149 |
--os-ui-button-border-radius: 6px; |
| 150 |
--os-ui-button-bg: transparent; |
| 151 |
/* Inherit the card's text color instead of the component's own |
| 152 |
light-theme default — widget cards can be dark glass. */ |
| 153 |
--os-ui-button-fg: currentColor; |
| 154 |
} |
| 155 |
|
| 156 |
.dm-drafts__trash { |
| 157 |
margin-right: 4px; |
| 158 |
} |
| 159 |
|
| 160 |
.dm-drafts__trash::part( button ), |
| 161 |
.dm-drafts__spark::part( button ) { |
| 162 |
width: 26px; |
| 163 |
height: 26px; |
| 164 |
} |
| 165 |
|
| 166 |
.dm-drafts__row:hover .dm-drafts__trash, |
| 167 |
.dm-drafts__row:hover .dm-drafts__spark { |
| 168 |
opacity: 0.65; |
| 169 |
} |
| 170 |
|
| 171 |
/* Keyboard focus goes to full strength, where the pointer only gets |
| 172 |
there on hover: at 0.65 the control's own focus ring was being faded |
| 173 |
along with it, and a focus indicator is the one thing that cannot |
| 174 |
afford to be three-quarters there. `:focus-within` on the host |
| 175 |
matches when the button inside the shadow root has focus. */ |
| 176 |
.dm-drafts__trash:focus-within, |
| 177 |
.dm-drafts__spark:focus-within { |
| 178 |
opacity: 1; |
| 179 |
} |
| 180 |
|
| 181 |
.dm-drafts__trash:hover { |
| 182 |
opacity: 1; |
| 183 |
--os-ui-button-bg-hover: color-mix( |
| 184 |
in srgb, |
| 185 |
var( --os-ui-danger, #d63638 ) 22%, |
| 186 |
transparent |
| 187 |
); |
| 188 |
--os-ui-button-fg: var( --dm-drafts-danger, #d63638 ); |
| 189 |
} |
| 190 |
|
| 191 |
.dm-drafts__spark:hover { |
| 192 |
opacity: 1; |
| 193 |
--os-ui-button-bg-hover: color-mix( |
| 194 |
in srgb, |
| 195 |
var( --os-ui-accent, #2271b1 ) 22%, |
| 196 |
transparent |
| 197 |
); |
| 198 |
--os-ui-button-fg: var( --dm-drafts-accent, #2271b1 ); |
| 199 |
} |
| 200 |
|
| 201 |
.dm-drafts__spark[aria-expanded='true'] { |
| 202 |
opacity: 1; |
| 203 |
--os-ui-button-bg: color-mix( |
| 204 |
in srgb, |
| 205 |
var( --os-ui-accent, #2271b1 ) 18%, |
| 206 |
transparent |
| 207 |
); |
| 208 |
--os-ui-button-fg: var( --dm-drafts-accent, #2271b1 ); |
| 209 |
} |
| 210 |
|
| 211 |
.dm-drafts__trash .dashicons, |
| 212 |
.dm-drafts__spark .dashicons { |
| 213 |
pointer-events: none; |
| 214 |
font-size: 16px; |
| 215 |
width: 16px; |
| 216 |
height: 16px; |
| 217 |
line-height: 16px; |
| 218 |
} |
| 219 |
|
| 220 |
/* The shell forces `cursor: default !important`; out-specify it. The |
| 221 |
`<os-button>` controls set their own cursor inside the shadow root, |
| 222 |
which that rule can't reach. */ |
| 223 |
body.os-active .dm-drafts__link { |
| 224 |
cursor: pointer !important; |
| 225 |
} |
| 226 |
|
| 227 |
/* |
| 228 |
* Adaptive accent for text + glyphs. `--os-ui-accent` neat is a mid blue |
| 229 |
* that sinks into a dark glass card; mixing it toward `currentColor` |
| 230 |
* keeps it legible whichever way the card leans. Backgrounds still use |
| 231 |
* the neat token — a low-alpha wash doesn't have a contrast problem. |
| 232 |
*/ |
| 233 |
.dm-drafts__row, |
| 234 |
.dm-drafts__suggest { |
| 235 |
--dm-drafts-accent: color-mix( |
| 236 |
in srgb, |
| 237 |
var( --os-ui-accent, #2271b1 ) 55%, |
| 238 |
currentColor |
| 239 |
); |
| 240 |
--dm-drafts-danger: color-mix( |
| 241 |
in srgb, |
| 242 |
var( --os-ui-danger, #d63638 ) 65%, |
| 243 |
currentColor |
| 244 |
); |
| 245 |
} |
| 246 |
|
| 247 |
/* --- 💡 suggestions panel ------------------------------------------ */ |
| 248 |
|
| 249 |
.dm-drafts__suggest { |
| 250 |
margin: 2px 0 8px; |
| 251 |
padding: 8px; |
| 252 |
border-radius: 8px; |
| 253 |
background: color-mix( in srgb, currentColor 7%, transparent ); |
| 254 |
font-size: 12px; |
| 255 |
display: flex; |
| 256 |
flex-direction: column; |
| 257 |
gap: 8px; |
| 258 |
} |
| 259 |
|
| 260 |
.dm-drafts__suggest-loading { |
| 261 |
display: flex; |
| 262 |
align-items: center; |
| 263 |
gap: 8px; |
| 264 |
opacity: 0.75; |
| 265 |
} |
| 266 |
|
| 267 |
.dm-drafts__suggest-hint { |
| 268 |
font-size: 11px; |
| 269 |
opacity: 0.7; |
| 270 |
font-style: italic; |
| 271 |
} |
| 272 |
|
| 273 |
/* |
| 274 |
* Notices inside the panel (readiness, load failure). |
| 275 |
* |
| 276 |
* `<os-notice>`'s built-in palette is tuned for a light window surface — |
| 277 |
* its text defaults to `--os-ui-fg` (#1d2327) over an 8%-alpha tone wash. |
| 278 |
* A widget card is glass over the wallpaper and can be arbitrarily dark, |
| 279 |
* so that pairing collapses to unreadable. Drive the component's |
| 280 |
* documented color surface from `currentColor` instead: the text tracks |
| 281 |
* whatever the card already proved legible, and the tone survives in the |
| 282 |
* accent stripe + icon, each mixed toward `currentColor` so it stays |
| 283 |
* visible on a dark and a light card alike. |
| 284 |
*/ |
| 285 |
.dm-drafts__notice { |
| 286 |
--os-ui-notice-color: currentColor; |
| 287 |
--os-ui-notice-bg: color-mix( in srgb, currentColor 8%, transparent ); |
| 288 |
--os-ui-notice-border: transparent; |
| 289 |
--os-ui-notice-font: inherit; |
| 290 |
--os-ui-notice-success: color-mix( |
| 291 |
in srgb, |
| 292 |
var( --os-ui-success-fg, #46b450 ) 65%, |
| 293 |
currentColor |
| 294 |
); |
| 295 |
--os-ui-notice-warning: color-mix( |
| 296 |
in srgb, |
| 297 |
var( --os-ui-warning-fg, #dba617 ) 65%, |
| 298 |
currentColor |
| 299 |
); |
| 300 |
--os-ui-notice-error: color-mix( |
| 301 |
in srgb, |
| 302 |
var( --os-ui-danger, #d63638 ) 65%, |
| 303 |
currentColor |
| 304 |
); |
| 305 |
/* Out-specifies the component's own `:host` padding — 10px/14px is |
| 306 |
window-banner scale and reads as a slab inside an 8px panel. */ |
| 307 |
padding: 8px 10px; |
| 308 |
border-radius: 6px; |
| 309 |
} |
| 310 |
|
| 311 |
/* Readiness — read-only diagnosis at the top of the panel, tone-coded |
| 312 |
success when nothing is missing, warning otherwise. */ |
| 313 |
.dm-drafts__readiness-summary { |
| 314 |
font-size: 12px; |
| 315 |
line-height: 1.35; |
| 316 |
} |
| 317 |
|
| 318 |
/* Block + disc, not flex-column: a flex container suppresses the list |
| 319 |
markers, which is what made these read as four orphaned grey lines. */ |
| 320 |
.dm-drafts__readiness-missing { |
| 321 |
margin: 4px 0 0; |
| 322 |
padding-inline-start: 16px; |
| 323 |
font-size: 11.5px; |
| 324 |
line-height: 1.4; |
| 325 |
opacity: 0.9; |
| 326 |
display: block; |
| 327 |
list-style: disc; |
| 328 |
} |
| 329 |
|
| 330 |
.dm-drafts__suggest-group { |
| 331 |
display: flex; |
| 332 |
flex-direction: column; |
| 333 |
gap: 3px; |
| 334 |
} |
| 335 |
|
| 336 |
.dm-drafts__suggest-label { |
| 337 |
font-size: 10px; |
| 338 |
font-weight: 700; |
| 339 |
text-transform: uppercase; |
| 340 |
letter-spacing: 0.04em; |
| 341 |
opacity: 0.72; |
| 342 |
} |
| 343 |
|
| 344 |
/* Suggestion buttons — `<os-button variant="ghost">` tuned to read as |
| 345 |
list rows (title / excerpt) or pills (tags / categories). */ |
| 346 |
.dm-drafts__suggest-item, |
| 347 |
.dm-drafts__suggest-tag { |
| 348 |
--os-ui-button-border: none; |
| 349 |
--os-ui-button-bg: transparent; |
| 350 |
--os-ui-button-fg: currentColor; |
| 351 |
} |
| 352 |
|
| 353 |
.dm-drafts__suggest-item { |
| 354 |
display: flex; |
| 355 |
--os-ui-button-padding: 4px 6px; |
| 356 |
--os-ui-button-border-radius: 6px; |
| 357 |
--os-ui-button-bg-hover: color-mix( in srgb, currentColor 12%, transparent ); |
| 358 |
} |
| 359 |
|
| 360 |
.dm-drafts__suggest-item::part( button ) { |
| 361 |
width: 100%; |
| 362 |
justify-content: flex-start; |
| 363 |
text-align: start; |
| 364 |
font-size: 12px; |
| 365 |
font-weight: 400; |
| 366 |
line-height: 1.35; |
| 367 |
} |
| 368 |
|
| 369 |
.dm-drafts__suggest-tags { |
| 370 |
display: flex; |
| 371 |
flex-wrap: wrap; |
| 372 |
gap: 4px; |
| 373 |
} |
| 374 |
|
| 375 |
.dm-drafts__suggest-tag { |
| 376 |
--os-ui-button-padding: 2px 8px; |
| 377 |
--os-ui-button-border-radius: 999px; |
| 378 |
--os-ui-button-border: 1px solid |
| 379 |
color-mix( in srgb, currentColor 30%, transparent ); |
| 380 |
--os-ui-button-bg-hover: color-mix( |
| 381 |
in srgb, |
| 382 |
var( --os-ui-accent, #2271b1 ) 16%, |
| 383 |
transparent |
| 384 |
); |
| 385 |
} |
| 386 |
|
| 387 |
.dm-drafts__suggest-tag::part( button ) { |
| 388 |
font-size: 11px; |
| 389 |
font-weight: 400; |
| 390 |
} |
| 391 |
|
| 392 |
.dm-drafts__suggest-tag:hover { |
| 393 |
--os-ui-button-fg: var( --dm-drafts-accent, #2271b1 ); |
| 394 |
--os-ui-button-border: 1px solid |
| 395 |
color-mix( in srgb, var( --dm-drafts-accent, #2271b1 ) 55%, transparent ); |
| 396 |
} |
| 397 |
|
| 398 |
/* |
| 399 |
* Applied — the suggestions the user accepted. |
| 400 |
* |
| 401 |
* A widget card is glass over an arbitrary wallpaper, so this state can't |
| 402 |
* ride on a hue: the LABEL stays at the card's own text color, which is |
| 403 |
* the one color the card already guarantees is readable. What marks it as |
| 404 |
* applied is a currentColor-derived wash, a tinted border and a ✓ — |
| 405 |
* shape and fill, both of which survive any background. |
| 406 |
* |
| 407 |
* Note also that this is not the component's `disabled` state: that dims |
| 408 |
* to 50% opacity, halving contrast exactly where we can least afford it. |
| 409 |
*/ |
| 410 |
.dm-drafts__suggest-item.is-applied, |
| 411 |
.dm-drafts__suggest-tag.is-applied { |
| 412 |
--dm-drafts-applied: color-mix( |
| 413 |
in srgb, |
| 414 |
var( --os-ui-success-fg, #46b450 ) 55%, |
| 415 |
currentColor |
| 416 |
); |
| 417 |
--os-ui-button-fg: currentColor; |
| 418 |
--os-ui-button-bg: color-mix( in srgb, currentColor 15%, transparent ); |
| 419 |
/* Same as the resting fill — an applied suggestion is inert, so it |
| 420 |
must not light up under the pointer as if it were still actionable. */ |
| 421 |
--os-ui-button-bg-hover: color-mix( in srgb, currentColor 15%, transparent ); |
| 422 |
--os-ui-button-border: 1px solid |
| 423 |
color-mix( in srgb, var( --dm-drafts-applied ) 60%, transparent ); |
| 424 |
opacity: 1; |
| 425 |
cursor: default; |
| 426 |
} |
| 427 |
|
| 428 |
/* Slotted, not a `::after` on the host — a shadow host's own |
| 429 |
pseudo-elements have no slot to render into. */ |
| 430 |
.dm-drafts__applied-check { |
| 431 |
margin-inline-start: 4px; |
| 432 |
font-weight: 700; |
| 433 |
color: var( --dm-drafts-applied, currentColor ); |
| 434 |
} |
| 435 |
|
| 436 |
.dm-drafts__name { |
| 437 |
flex: 1 1 auto; |
| 438 |
min-width: 0; |
| 439 |
font-size: 13px; |
| 440 |
overflow: hidden; |
| 441 |
text-overflow: ellipsis; |
| 442 |
white-space: nowrap; |
| 443 |
} |
| 444 |
|
| 445 |
.dm-drafts__time { |
| 446 |
flex: 0 0 auto; |
| 447 |
font-size: 11px; |
| 448 |
opacity: 0.6; |
| 449 |
font-variant-numeric: tabular-nums; |
| 450 |
} |
| 451 |
|