@anyblades/blades 3.1.0-beta.2 → 3.1.0-beta.4

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/README.md CHANGED
@@ -290,6 +290,7 @@ Add `<html data-compact>` for the whole page, or put the attribute on a single e
290
290
  ## <sup style>Featured by</sup> <!-- [1] big projects [2] awesome [3] smaller projects [4] blogs/social -->
291
291
 
292
292
  - [getgrav.org](https://getgrav.org/migrate-to-2#:~:text=blades)
293
+ - https://usehadron.dev/
293
294
  - [@11ty/buildawesome](https://bsky.app/profile/11ty.dev/post/3mp75r53ccv2b) [↗](https://mastodon.social/@11ty@neighborhood.11ty.dev/116816881367741413)
294
295
  - [<i class="fa-brands fa-build-awesome mark-brand"></i> buildawesome.one](https://buildawesome.one/#:~:text=blades)
295
296
  - https://github.com/dbohdan/classless-css
@@ -297,7 +298,7 @@ Add `<html data-compact>` for the whole page, or put the attribute on a single e
297
298
  - [/gabrielizalo/awesome-css-frameworks](https://github.com/gabrielizalo/awesome-css-frameworks-and-ui-libraries/tree/master/Lightweight)
298
299
  - https://github.com/eggplantpasta/greenroom
299
300
  - [/adamdjbrett/11ty-wisp](https://github.com/adamdjbrett/11ty-wisp#features:~:text=blades) [↗](https://github.com/adamdjbrett/000000076#:~:text=blades)
300
- - [doany.io](https://doany.io/en/posts/svelte-bun-sqlite/#on-biome-and-css)
301
+ - [doany.io](https://doany.io/en/posts/svelte-bun-sqlite/#on-biome-and-css:~:text=anyblades)
301
302
  - [@box464](https://mastodon.social/@box464/117442493473921346)
302
303
  - [@draupnerdata](https://www.youtube.com/watch?v=yDjArj9HSjs&t=180s)
303
304
  - [@cantdutchthis](https://news.ycombinator.com/item?id=48729467)
@@ -309,10 +310,3 @@ Add `<html data-compact>` for the whole page, or put the attribute on a single e
309
310
 
310
311
  <!--{.markerless .columns}-->
311
312
  <!--[hostfurl.com, @johnheenan]-->
312
-
313
- ## <sup style>Credits</sup>
314
-
315
- - https://picocss.com/ for [inspiration](//blades.ninja/css/pico/)
316
- - https://11ty.dev/ for [site generation](//buildawesome.one/)
317
-
318
- <!--{.markerless}-->
package/css/blades.css CHANGED
@@ -2403,7 +2403,11 @@ label > details.dropdown {
2403
2403
  --pico-loading-spinner-opacity: 0.5;
2404
2404
  }
2405
2405
 
2406
- [aria-busy="true"]:not(input, select, textarea, html, form) {
2406
+ [aria-busy="true"]:not(input, select, textarea, html, form):not(
2407
+ :where(button, [type="submit"], [type="button"], [type="reset"], [role="button"])
2408
+ ) {
2409
+ /* :where() zeroes the specificity of the button list inside :not(), so this rule stays
2410
+ * low-specificity and doesn't override the more specific button rules below */
2407
2411
  white-space: nowrap;
2408
2412
  }
2409
2413
  [aria-busy="true"]:not(input, select, textarea, html, form)::before {
@@ -2432,6 +2436,19 @@ a[aria-busy="true"] {
2432
2436
  pointer-events: none;
2433
2437
  }
2434
2438
 
2439
+ /* Buttons keep their size: the label stays in place but hidden, the spinner sits on top */
2440
+ button[aria-busy="true"]:not(:empty), [type="submit"][aria-busy="true"]:not(:empty), [type="button"][aria-busy="true"]:not(:empty), [type="reset"][aria-busy="true"]:not(:empty), [role="button"][aria-busy="true"]:not(:empty) {
2441
+ position: relative;
2442
+ color: transparent;
2443
+ }
2444
+ button[aria-busy="true"]:not(:empty) > *, [type="submit"][aria-busy="true"]:not(:empty) > *, [type="button"][aria-busy="true"]:not(:empty) > *, [type="reset"][aria-busy="true"]:not(:empty) > *, [role="button"][aria-busy="true"]:not(:empty) > * {
2445
+ opacity: 0;
2446
+ }
2447
+ button[aria-busy="true"]:not(:empty)::before, [type="submit"][aria-busy="true"]:not(:empty)::before, [type="button"][aria-busy="true"]:not(:empty)::before, [type="reset"][aria-busy="true"]:not(:empty)::before, [role="button"][aria-busy="true"]:not(:empty)::before {
2448
+ position: absolute;
2449
+ margin: auto;
2450
+ inset: 0;
2451
+ }
2435
2452
  /**
2436
2453
  * Modal (<dialog>)
2437
2454
  */
@@ -3281,6 +3298,31 @@ label:has(> span):has(
3281
3298
  padding-block: 0.75rem; /* match Pico */
3282
3299
  }
3283
3300
  /* Components */
3301
+ /*\3c !--section:docs-->
3302
+
3303
+ A `<dialog>` opened with `dialog.showModal()` fades in and its `<article>` zooms in, without JS classes.
3304
+ Pico's modal JS (`.modal-is-open`, `.modal-is-opening`, `.modal-is-closing`) still works on top of it.
3305
+
3306
+ - `dialog.close()` closes it at once, as before.
3307
+ - `<dialog open>` in markup and non-modal `dialog.show()` aren't animated.
3308
+ - Browsers without `@starting-style`, and reduced motion, open it at once.
3309
+
3310
+ \3c !--section:code-->```css */
3311
+ dialog:modal {
3312
+ transition: opacity var(--pico-transition);
3313
+ }
3314
+ dialog:modal > article {
3315
+ transition: transform var(--pico-transition);
3316
+ }
3317
+ @starting-style {
3318
+ dialog:modal {
3319
+ opacity: 0;
3320
+ }
3321
+
3322
+ dialog:modal > article {
3323
+ transform: scale(0.96);
3324
+ }
3325
+ }
3284
3326
  /* Extends https://github.com/picocss/pico/blob/main/scss/content/_link.scss
3285
3327
  \3c !--section:code-->
3286
3328
  ```css */
@@ -3340,6 +3382,110 @@ How we made it: https://codepen.io/editor/anydigital/pen/019d2b94-5616-75dc-a23e
3340
3382
  \3c !--section--> */
3341
3383
  /*\3c !--section:docs-->
3342
3384
 
3385
+ A `<ul>` or `<menu>` with the `popover` attribute is styled like a dropdown and opens next to the button
3386
+ that toggles it, with no JS:
3387
+
3388
+ ```html
3389
+ <button popovertarget="actions">Actions</button>
3390
+ <ul id="actions" popover>
3391
+ <li><a href="#">Edit</a></li>
3392
+ <li><a href="#">Duplicate</a></li>
3393
+ </ul>
3394
+ ```
3395
+
3396
+ - Clicking outside or pressing Esc closes it, and it's drawn on top of everything (no `z-index`, no clipping by `overflow`).
3397
+ - It opens below the button (on the reading side, also in RTL) and flips when there's no room.
3398
+ Open it with `popovertarget`, `commandfor` or `showPopover({ source })`, so it knows its button.
3399
+ - Browsers without CSS anchor positioning show it in the middle of the screen instead, like a plain popover.
3400
+ - It uses the dropdown colours (`--pico-dropdown-*`, from `components/dropdown`).
3401
+
3402
+ \3c !--section:code-->```css */
3403
+ :is(ul, menu)[popover] {
3404
+ min-width: -moz-fit-content;
3405
+ min-width: fit-content;
3406
+ margin: auto;
3407
+ padding: 0;
3408
+ border: var(--pico-border-width) solid var(--pico-dropdown-border-color);
3409
+ border-radius: var(--pico-border-radius);
3410
+ background-color: var(--pico-dropdown-background-color);
3411
+ box-shadow: var(--pico-dropdown-box-shadow);
3412
+ color: var(--pico-dropdown-color);
3413
+ white-space: nowrap;
3414
+ opacity: 0;
3415
+ transition:
3416
+ opacity var(--pico-transition),
3417
+ overlay var(--pico-transition) allow-discrete,
3418
+ display var(--pico-transition) allow-discrete;
3419
+ }
3420
+ /* Beats `nav ul` / `aside ul`, which would otherwise show the closed menu */
3421
+ :is(ul, menu)[popover]:not(:popover-open) {
3422
+ display: none;
3423
+ }
3424
+ :is(ul, menu)[popover]:popover-open {
3425
+ display: block;
3426
+ opacity: 1;
3427
+ }
3428
+ :is(ul, menu)[popover] li {
3429
+ display: block;
3430
+ margin-bottom: 0;
3431
+ padding: calc(var(--pico-form-element-spacing-vertical) * 0.5)
3432
+ var(--pico-form-element-spacing-horizontal);
3433
+ list-style: none;
3434
+ }
3435
+ :is(ul, menu)[popover] li:first-of-type {
3436
+ margin-top: calc(var(--pico-form-element-spacing-vertical) * 0.5);
3437
+ }
3438
+ :is(ul, menu)[popover] li:last-of-type {
3439
+ margin-bottom: calc(var(--pico-form-element-spacing-vertical) * 0.5);
3440
+ }
3441
+ :is(ul, menu)[popover] li:has(label):hover {
3442
+ background-color: var(--pico-dropdown-hover-background-color);
3443
+ }
3444
+ :is(ul, menu)[popover] li a {
3445
+ display: block;
3446
+ margin: calc(var(--pico-form-element-spacing-vertical) * -0.5)
3447
+ calc(var(--pico-form-element-spacing-horizontal) * -1);
3448
+ padding: calc(var(--pico-form-element-spacing-vertical) * 0.5)
3449
+ var(--pico-form-element-spacing-horizontal);
3450
+ overflow: hidden;
3451
+ border-radius: 0;
3452
+ color: var(--pico-dropdown-color);
3453
+ text-decoration: none;
3454
+ text-overflow: ellipsis;
3455
+ }
3456
+ :is(ul, menu)[popover] li a:is(:hover, :focus, :active, :focus-visible, [aria-current]:not([aria-current="false"])) {
3457
+ background-color: var(--pico-dropdown-hover-background-color);
3458
+ }
3459
+ :is(ul, menu)[popover] li label {
3460
+ width: 100%;
3461
+ }
3462
+ /* Beats Pico's `nav ul:first-of-type` / `:last-of-type` margins */
3463
+ nav :is(ul, menu)[popover] {
3464
+ margin: auto;
3465
+ }
3466
+ @starting-style {
3467
+ :is(ul, menu)[popover]:popover-open {
3468
+ opacity: 0;
3469
+ }
3470
+ }
3471
+
3472
+ /* Next to the button that opened it (its implicit anchor) */
3473
+ @supports (position-area: bottom) {
3474
+ :is(ul, menu)[popover],
3475
+ nav :is(ul, menu)[popover] {
3476
+ position-area: bottom span-right;
3477
+ position-try-fallbacks: flip-block, flip-inline;
3478
+ margin: 0;
3479
+ margin-top: var(--pico-outline-width);
3480
+ inset: auto;
3481
+ }
3482
+
3483
+ :is(ul, menu)[popover]:dir(rtl), nav :is(ul, menu)[popover]:dir(rtl) {
3484
+ position-area: bottom span-left;
3485
+ }
3486
+ }
3487
+ /*\3c !--section:docs-->
3488
+
3343
3489
  Use `dl.timeline` or wrap a `<dl>` with `.has-timeline` to style it as a
3344
3490
  vertical timeline — each `<dd>` gets a left border strip acting as the track:
3345
3491
 
@@ -3359,6 +3505,7 @@ dl.timeline dd, .has-timeline > dl dd {
3359
3505
  padding: 0.25rem 0 0.75rem 1rem;
3360
3506
  border-inline-start: 0.25rem solid var(--blades-timeline-border-color);
3361
3507
  }
3508
+ /* Compact version (opt-in via `data-compact` attr anywhere) */
3362
3509
  /*
3363
3510
  * Compact: opt-in denser sizing and a more current look, applied under `data-compact` on
3364
3511
  * <html> (whole page) or on any element such as a single <form>. Without the attribute it