@taprootio/espalier 6.1.0 → 6.2.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
@@ -1,3 +1,13 @@
1
+ # 6.2.0
2
+
3
+ Banners gain a soft height contract, so a banner capped to the first fold or filling the viewport never clips its copy.
4
+
5
+ - **New: `--esp-image-banner-max-block-size`**, a soft cap. A banner is the smaller of its ratio height and the cap while its copy fits, exactly as with the same `max-block-size`, and grows past the cap when the copy (with its spacing) would not fit, giving the cap back once it does.
6
+ - **New: `--esp-image-banner-block-size`**, a soft target that replaces the ratio as the banner height (viewport-fill banners), and that copy grows the banner past in the same way.
7
+ - In the compact band (`compact-placement="below"`), the soft properties size only the image box and the band adds below it, so band copy is never clipped.
8
+ - `@taprootio/espalier/image/banner-static.css` reads both properties, so server-rendered banners lay out the same before and after upgrade (where container style queries exist: Chrome and Safari 18+; elsewhere a soft height applies at upgrade).
9
+ - **Fixed: a banner nested in another banner's overlay inherited the outer banner's ratio** when it had none of its own; it now keeps its image's own size. A real `max-block-size`, `block-size`, or `min-block-size` keeps its hard meaning, alongside a soft property too, and banners that set neither soft property are unchanged.
10
+
1
11
  # 6.1.0
2
12
 
3
13
  Banner overlays gain a copy-stack layout contract (supporting copy, one action, middle positions, a compact band, and a static first-paint layout), and pickers no longer pick the option a finger lands on when it starts scrolling.
@@ -16,6 +16,10 @@
16
16
  * --esp-image-static-compact-ratio the `compact-ratio` value, if any
17
17
  * --esp-image-object-position the focal point, e.g. `65% 40%`
18
18
  *
19
+ * It also reads the element's own soft height properties, exactly as the
20
+ * upgraded element does: --esp-image-banner-max-block-size (a soft cap) and
21
+ * --esp-image-banner-block-size (a soft target).
22
+ *
19
23
  * Limits, all documented in the image banners guide: the compact switch uses
20
24
  * the default 40rem width (a custom `--esp-image-compact-width` cannot apply
21
25
  * before upgrade); no scrim or texture paints until upgrade; copy must be
@@ -41,8 +45,20 @@ esp-image[banner]:not(:defined) {
41
45
  container-type: inline-size;
42
46
  }
43
47
 
44
- /* The image spans every row at the banner ratio, so the banner is as tall as
45
- the ratio or the copy, whichever is taller, and the image covers it all. */
48
+ /* The image spans every row at the banner ratio (its own natural size when
49
+ there is none), so the banner is as tall as the ratio or the copy,
50
+ whichever is taller, and the image stretches to cover it all. An empty
51
+ spacer spans the rows too; it carries the soft height (below). */
52
+ esp-image[banner]:not(:defined)::before {
53
+ content: "";
54
+ grid-row: 1 / -1;
55
+ grid-column: 1;
56
+ align-self: start;
57
+ justify-self: stretch;
58
+ aspect-ratio: var(--esp-image-static-ratio, auto);
59
+ block-size: var(--esp-image-banner-block-size, auto);
60
+ max-block-size: var(--esp-image-banner-max-block-size, none);
61
+ }
46
62
  esp-image[banner]:not(:defined) > picture,
47
63
  esp-image[banner]:not(:defined) > img {
48
64
  display: block;
@@ -202,8 +218,29 @@ esp-image[banner][compact-placement="below"][banner-scheme="dark"]:not(:defined)
202
218
  esp-image[banner]:not(:defined) > :is(picture, img) {
203
219
  aspect-ratio: var(--esp-image-static-compact-ratio, var(--esp-image-static-ratio, auto));
204
220
  }
221
+ /* At compact widths a compact ratio alone is enough for a soft cap (see
222
+ the soft height rule below). */
223
+ @container (style(--esp-image-static-compact-ratio) and style(--esp-image-banner-max-block-size) and (not style(--esp-image-banner-max-block-size: none)) and (not style(--esp-image-banner-max-block-size: auto))) {
224
+ esp-image[banner]:not(:defined) > :is(picture, img) {
225
+ contain: size;
226
+ aspect-ratio: auto;
227
+ }
228
+ }
229
+ /* A pseudo-element can query its own originating element. */
230
+ esp-image[banner]:not(:defined)::before {
231
+ aspect-ratio: var(--esp-image-static-compact-ratio, var(--esp-image-static-ratio, auto));
232
+ }
233
+ /* The band: the image box takes the first row, sized like the spacer (the
234
+ soft height sizes only the image box), and the copy follows below. */
235
+ esp-image[banner][compact-placement="below"]:not(:defined)::before {
236
+ display: none;
237
+ }
205
238
  esp-image[banner][compact-placement="below"]:not(:defined) > :is(picture, img) {
206
239
  grid-row: 1;
240
+ contain: none;
241
+ aspect-ratio: var(--esp-image-static-compact-ratio, var(--esp-image-static-ratio, auto));
242
+ block-size: var(--esp-image-banner-block-size, auto);
243
+ max-block-size: var(--esp-image-banner-max-block-size, none);
207
244
  }
208
245
  esp-image[banner][compact-placement="below"]:not(:defined)
209
246
  > :is([slot="overlay"], [slot="overlay-supporting"], [slot="overlay-action"]) {
@@ -226,6 +263,21 @@ esp-image[banner][compact-placement="below"][banner-scheme="dark"]:not(:defined)
226
263
  }
227
264
  }
228
265
 
266
+ /* Soft height, matching the element: a soft target, or a soft cap on a
267
+ banner with a static ratio, hands sizing to the spacer, so the image gives
268
+ up its own size (size containment, no ratio) and stretches over whatever
269
+ the spacer or the copy sets. none and auto count as unset. This needs
270
+ container style queries (Chrome, Safari 18+); elsewhere the soft height
271
+ applies at upgrade, and banners without it are unaffected. It follows the
272
+ compact rules so it wins over their image ratio; the band's image rule is
273
+ more specific and keeps its own sizing. */
274
+ @container (style(--esp-image-banner-block-size) and (not style(--esp-image-banner-block-size: none)) and (not style(--esp-image-banner-block-size: auto))) or (style(--esp-image-static-ratio) and style(--esp-image-banner-max-block-size) and (not style(--esp-image-banner-max-block-size: none)) and (not style(--esp-image-banner-max-block-size: auto))) {
275
+ esp-image[banner]:not(:defined) > :is(picture, img) {
276
+ contain: size;
277
+ aspect-ratio: auto;
278
+ }
279
+ }
280
+
229
281
  /* The image never moves under reduced motion, before upgrade as after. */
230
282
  @media (prefers-reduced-motion: reduce) {
231
283
  esp-image[banner]:not(:defined) > picture,