@escape-game-over/atlas 0.1.80 → 0.1.82

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@escape-game-over/atlas",
3
- "version": "0.1.80",
3
+ "version": "0.1.82",
4
4
  "type": "module",
5
5
  "description": "Typed, data-driven machinery for static multi-locale, multi-deployment Astro sites.",
6
6
  "private": false,
@@ -49,7 +49,7 @@
49
49
  "check-fmt": "biome check . --error-on-warnings"
50
50
  },
51
51
  "dependencies": {
52
- "@types/google.maps": "3.66.5"
52
+ "@types/google.maps": "3.66.6"
53
53
  },
54
54
  "peerDependencies": {
55
55
  "@types/node": ">=22",
@@ -59,10 +59,10 @@
59
59
  },
60
60
  "devDependencies": {
61
61
  "@biomejs/biome": "2.5.15",
62
- "@types/node": "26.6.4",
63
- "@vitest/coverage-istanbul": "5.0.3",
64
- "astro": "7.3.6",
62
+ "@types/node": "26.6.5",
63
+ "@vitest/coverage-istanbul": "5.0.4",
64
+ "astro": "7.4.0",
65
65
  "typescript": "6.0.3",
66
- "vitest": "5.0.3"
66
+ "vitest": "5.0.4"
67
67
  }
68
68
  }
@@ -8,7 +8,15 @@
8
8
  * are made at standard device widths up to the source's own. A lazy image
9
9
  * gets `auto` in front, so browsers that can measure the real width do.
10
10
  *
11
- * `zoom` opens the image larger in a dialog.
11
+ * `zoom` opens the image larger in a dialog. Its close button shows the `close`
12
+ * slot, the site's own icon, which `zoom` requires: a text `×` centres by the
13
+ * font's metrics, not the button's.
14
+ *
15
+ * ```astro
16
+ * <Image src={photo} alt={alt} sizes="33vw" zoom={{ closeLabel: t("close") }}>
17
+ * <Icon slot="close" name="lucide:x" />
18
+ * </Image>
19
+ * ```
12
20
  */
13
21
  import { Picture } from "astro:assets";
14
22
  import type { ComponentProps } from "astro/types";
@@ -49,6 +57,12 @@ const DEVICE_WIDTHS = [640, 750, 828, 1080, 1280, 1668, 1920, 2048, 2560, 3840];
49
57
  const given = Astro.props;
50
58
  const { src, alt, priority = false, zoom } = given;
51
59
 
60
+ if (zoom !== undefined && !Astro.slots.has("close")) {
61
+ throw new Error(
62
+ `Image: "${alt}" zooms but has no close icon. Pass one: <Icon slot="close" …>.`
63
+ );
64
+ }
65
+
52
66
  const shape =
53
67
  given.sizes !== undefined
54
68
  ? (() => {
@@ -97,5 +111,9 @@ const picture: ComponentProps<typeof Picture> = {
97
111
  closeLabel={zoom.closeLabel}
98
112
  class={zoom.class}>
99
113
  <Picture {...picture} />
114
+ <slot
115
+ name='close'
116
+ slot='close'
117
+ />
100
118
  </Zoom>
101
119
  )}
@@ -2,7 +2,8 @@
2
2
  /**
3
3
  * Internal to `Image.astro`. No script: `command="show-modal"` opens the dialog
4
4
  * and `closedby="any"` lets a click outside close it. The large image is lazy
5
- * inside a closed dialog, so it is fetched on open.
5
+ * inside a closed dialog, so it is fetched on open. The close button shows the
6
+ * `close` slot.
6
7
  */
7
8
 
8
9
  import { getImage } from "astro:assets";
@@ -47,7 +48,7 @@ const id = `atlas-zoom${large.src.replace(/[^\w-]/g, "-")}`;
47
48
  command="close"
48
49
  aria-label={closeLabel}
49
50
  >
50
- ×
51
+ <slot name="close" />
51
52
  </button>
52
53
  <img
53
54
  src={large.src}