@coras-io/embed 0.10.0 → 0.11.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,5 +1,16 @@
1
1
  # @coras-io/embed
2
2
 
3
+ ## 0.11.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 3686a85: Load the first image of the details page at once and ahead of the other images, so the page's main image shows sooner. `coras-image` takes a new `fetch-priority` attribute for this
8
+
9
+ ### Patch Changes
10
+
11
+ - 3686a85: Make breadcrumb items real items of the breadcrumb list for screen readers
12
+ - 3686a85: Stop the footer from jumping while the details page loads: the loading skeleton now fills the screen, as the loaded page does
13
+
3
14
  ## 0.10.0
4
15
 
5
16
  ### Minor Changes
@@ -2,5 +2,6 @@ import { type CSSResultGroup, LitElement } from "lit";
2
2
  export declare class CorasBreadcrumbItem extends LitElement {
3
3
  static styles: CSSResultGroup;
4
4
  clickable: boolean;
5
+ connectedCallback(): void;
5
6
  render(): import("lit").TemplateResult<1>;
6
7
  }
@@ -13,13 +13,20 @@ export class CorasBreadcrumbItem extends LitElement {
13
13
  this.clickable = false;
14
14
  }
15
15
  static { this.styles = styles; }
16
+ // The list item is the host: an <li> inside this shadow root would not be a
17
+ // child of the list that <coras-breadcrumbs> renders.
18
+ connectedCallback() {
19
+ super.connectedCallback();
20
+ if (!this.hasAttribute("role"))
21
+ this.setAttribute("role", "listitem");
22
+ }
16
23
  render() {
17
24
  return html `
18
- <li part="base" class="breadcrumb-item">
25
+ <div part="base" class="breadcrumb-item">
19
26
  ${this.clickable
20
27
  ? html `<button type="button" class="link"><slot></slot></button>`
21
28
  : html `<span aria-current="page"><slot></slot></span>`}
22
- </li>
29
+ </div>
23
30
  `;
24
31
  }
25
32
  }
@@ -2,6 +2,7 @@ import { type CSSResultGroup, LitElement, nothing } from "lit";
2
2
  import { type ImagePreset } from "../../core/images/srcset.js";
3
3
  import { type ImgixCrop } from "../../core/images/url.js";
4
4
  type Loading = "lazy" | "eager";
5
+ type FetchPriority = "high" | "low" | "auto";
5
6
  type Decoding = "async" | "sync" | "auto";
6
7
  type Fit = "cover" | "contain";
7
8
  type Placeholder = "skeleton" | "color" | "none";
@@ -34,6 +35,8 @@ export declare class CorasImage extends LitElement {
34
35
  height: number;
35
36
  alt: string;
36
37
  loading: Loading;
38
+ /** Set to `high` on the one image that is the page's main content. */
39
+ fetchPriority: FetchPriority;
37
40
  decoding: Decoding;
38
41
  fit: Fit;
39
42
  placeholder: Placeholder;
@@ -41,6 +41,8 @@ export class CorasImage extends LitElement {
41
41
  this.height = 0;
42
42
  this.alt = "";
43
43
  this.loading = "lazy";
44
+ /** Set to `high` on the one image that is the page's main content. */
45
+ this.fetchPriority = "auto";
44
46
  this.decoding = "async";
45
47
  this.fit = "cover";
46
48
  this.placeholder = "skeleton";
@@ -188,6 +190,7 @@ export class CorasImage extends LitElement {
188
190
  height=${this.height || nothing}
189
191
  alt=${this.alt}
190
192
  loading=${this.loading}
193
+ fetchpriority=${this.fetchPriority}
191
194
  decoding=${this.decoding}
192
195
  @load=${this.handleLoad}
193
196
  @error=${this.handleError}
@@ -252,6 +255,9 @@ __decorate([
252
255
  __decorate([
253
256
  property({ type: String })
254
257
  ], CorasImage.prototype, "loading", void 0);
258
+ __decorate([
259
+ property({ type: String, attribute: "fetch-priority" })
260
+ ], CorasImage.prototype, "fetchPriority", void 0);
255
261
  __decorate([
256
262
  property({ type: String })
257
263
  ], CorasImage.prototype, "decoding", void 0);
@@ -431,14 +431,17 @@ let CorasDetailsPage = class CorasDetailsPage extends ErrorModalMixin(BaseMixin(
431
431
  if (!images) {
432
432
  return html ``;
433
433
  }
434
- return html `${map(images, (image) => html `
434
+ // The first image is the page's largest content, so it loads at once and
435
+ // ahead of the other images. The rest wait until the carousel shows them.
436
+ return html `${map(images, (image, index) => html `
435
437
  <coras-better-carousel-item>
436
438
  <coras-image
437
439
  src=${image.url}
438
440
  width=${IMAGE_CAROUSEL_WIDTH}
439
441
  height=${IMAGE_CAROUSEL_HEIGHT}
440
442
  preset="carousel-hero"
441
- loading="lazy"
443
+ loading=${index === 0 ? "eager" : "lazy"}
444
+ fetch-priority=${index === 0 ? "high" : "auto"}
442
445
  alt=""
443
446
  ></coras-image>
444
447
  </coras-better-carousel-item>
@@ -10,6 +10,9 @@ export default css `
10
10
  display: flex;
11
11
  flex-direction: column;
12
12
  gap: 1.75rem;
13
+ /* The loaded page is taller than the screen. Without this the footer
14
+ shows under the short skeleton and jumps away when the content comes. */
15
+ min-height: 100dvh;
13
16
 
14
17
  .sk-breadcrumb {
15
18
  width: 14rem;
package/package.json CHANGED
@@ -20,7 +20,7 @@
20
20
  "engines": {
21
21
  "node": ">=22"
22
22
  },
23
- "version": "0.10.0",
23
+ "version": "0.11.0",
24
24
  "private": false,
25
25
  "homepage": "https://docs.coras.io",
26
26
  "bugs": {