@easy-web/content-blocks 1.3.3 → 1.4.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.
Files changed (54) hide show
  1. package/README.md +10 -395
  2. package/dist/schemas/galleries.d.ts +3 -316
  3. package/dist/schemas/galleries.d.ts.map +1 -1
  4. package/dist/schemas/galleries.js +3 -133
  5. package/dist/schemas/galleries.js.map +1 -1
  6. package/dist/schemas/notFound.d.ts +3 -32
  7. package/dist/schemas/notFound.d.ts.map +1 -1
  8. package/dist/schemas/notFound.js +3 -27
  9. package/dist/schemas/notFound.js.map +1 -1
  10. package/package.json +3 -4
  11. package/src/components/BlogPostCard.astro +8 -74
  12. package/src/components/Card.astro +8 -65
  13. package/src/components/CardGrid.astro +8 -24
  14. package/src/components/ContactSection.astro +8 -68
  15. package/src/components/CtaSection.astro +8 -77
  16. package/src/components/DraftBanner.astro +8 -28
  17. package/src/components/Footer.astro +8 -76
  18. package/src/components/GalleryCarousel.astro +9 -292
  19. package/src/components/GalleryFeatureHighlight.astro +9 -149
  20. package/src/components/GalleryHeroSlider.astro +9 -358
  21. package/src/components/GalleryImageGrid.astro +9 -139
  22. package/src/components/GalleryLightboxGrid.astro +9 -349
  23. package/src/components/GalleryMasonryGrid.astro +9 -123
  24. package/src/components/GallerySection.astro +9 -65
  25. package/src/components/Header.astro +13 -217
  26. package/src/components/HeaderCentered.astro +17 -242
  27. package/src/components/HeaderFlyout.astro +13 -380
  28. package/src/components/HeaderHideOnScroll.astro +17 -248
  29. package/src/components/Hero.astro +8 -73
  30. package/src/components/LanguageNotice.astro +8 -27
  31. package/src/components/LanguageSwitch.astro +7 -65
  32. package/src/components/LegalLayout.astro +8 -57
  33. package/src/components/NotFound.astro +7 -118
  34. package/src/components/PageShell.astro +7 -79
  35. package/src/components/Prose.astro +10 -153
  36. package/src/components/Section.astro +8 -32
  37. package/src/components/ThemeToggle.astro +8 -77
  38. package/src/components/UniversalMedia.astro +7 -96
  39. package/src/schemas/galleries.ts +3 -150
  40. package/src/schemas/notFound.ts +3 -31
  41. package/dist/__tests__/exports-resolution.test.d.ts +0 -2
  42. package/dist/__tests__/exports-resolution.test.d.ts.map +0 -1
  43. package/dist/__tests__/exports-resolution.test.js +0 -83
  44. package/dist/__tests__/exports-resolution.test.js.map +0 -1
  45. package/dist/components/__tests__/UniversalMedia.test.d.ts +0 -2
  46. package/dist/components/__tests__/UniversalMedia.test.d.ts.map +0 -1
  47. package/dist/components/__tests__/UniversalMedia.test.js +0 -46
  48. package/dist/components/__tests__/UniversalMedia.test.js.map +0 -1
  49. package/dist/schemas/__tests__/notFound.test.d.ts +0 -2
  50. package/dist/schemas/__tests__/notFound.test.d.ts.map +0 -1
  51. package/dist/schemas/__tests__/notFound.test.js +0 -29
  52. package/dist/schemas/__tests__/notFound.test.js.map +0 -1
  53. package/src/components/__tests__/UniversalMedia.test.ts +0 -65
  54. package/src/schemas/__tests__/notFound.test.ts +0 -32
package/README.md CHANGED
@@ -1,399 +1,14 @@
1
- # @easy-web/content-blocks
1
+ # @easy-web/content-blocks (deprecated)
2
2
 
3
- Reusable Astro content-block components for the ismaili.de web ecosystem. Twenty-eight pure-Astro components covering page chrome (`PageShell`, Header, Footer, ThemeToggle, LanguageSwitch), hero/CTA/contact sections, cards and grids, a CMS-driven gallery system with six variants, blog post cards, legal-page layouts, banners, and styled prose. All components use the `--ew-*` design tokens from `@easy-web/theme-core`; no styling system of their own.
3
+ This package is a compatibility layer. The Astro components and content schemas now live in [`@easy-web/core`](../core/README.md). Every component here is a thin wrapper that renders the core component with the same props and slots, so the HTML a site ships is unchanged, but new code should import from `@easy-web/core`.
4
4
 
5
- ## Installation
5
+ | Old import | New import |
6
+ | :--- | :--- |
7
+ | `import X from '@easy-web/content-blocks/components/X'` | `import X from '@easy-web/core/components/X'` |
8
+ | `import X from '@easy-web/content-blocks/components/X.astro'` | `import X from '@easy-web/core/components/X.astro'` |
9
+ | `import { gallerySchema } from '@easy-web/content-blocks/schemas/galleries'` | `import { gallerySchema } from '@easy-web/core/schemas/galleries'` |
10
+ | `import { notFoundSchema } from '@easy-web/content-blocks/schemas/notFound'` | `import { notFoundSchema } from '@easy-web/core/schemas/notFound'` |
6
11
 
7
- ```bash
8
- pnpm add @easy-web/content-blocks
9
- ```
12
+ `X` is any of: BlogPostCard, Card, CardGrid, ContactSection, CtaSection, DraftBanner, Footer, GalleryCarousel, GalleryFeatureHighlight, GalleryHeroSlider, GalleryImageGrid, GalleryLightboxGrid, GalleryMasonryGrid, GallerySection, Header, HeaderCentered, HeaderFlyout, HeaderHideOnScroll, Hero, LanguageNotice, LanguageSwitch, LegalLayout, NotFound, PageShell, Prose, Section, ThemeToggle, UniversalMedia.
10
13
 
11
- This package is published to npm. Install it like any other npm package.
12
-
13
- ### Peer dependencies
14
-
15
- * `astro >= 6.0.0 < 8.0.0`
16
- * `zod >= 4.0.0`
17
-
18
- `@easy-web/theme-core` (the `--ew-*` token CSS) and `@easy-web/i18n` (the alternate-link helper behind `LanguageSwitch` and the locale utilities behind `NotFound`) are regular **dependencies** of this package, so your package manager installs them for you. They used to be peer dependencies; they were promoted because changesets escalates peer-dependents to a major bump, which together with the `fixed` version group made minor releases impossible. Both are pure functions and CSS tokens with no shared runtime state, so a duplicate copy costs bundle size, not correctness. `@easy-web/auth` is deliberately excluded from that promotion — its MSAL single-instance requirement is real.
19
-
20
- ## Import convention
21
-
22
- Components ship as **raw `.astro` files**. There is no JavaScript barrel. Import each component from its component path:
23
-
24
- ```astro
25
- ---
26
- import Header from '@easy-web/content-blocks/components/Header';
27
- import Footer from '@easy-web/content-blocks/components/Footer';
28
- import Hero from '@easy-web/content-blocks/components/Hero';
29
- import Section from '@easy-web/content-blocks/components/Section';
30
- import CardGrid from '@easy-web/content-blocks/components/CardGrid';
31
- import Card from '@easy-web/content-blocks/components/Card';
32
- ---
33
- ```
34
-
35
- The package's `package.json` exports map declares `./components/*` → `./src/components/*.astro`, so Astro consumes the source files directly — no build step is involved on the package side for the components themselves.
36
-
37
- ## Quick start
38
-
39
- ### Layout — wire Header and Footer into your base layout
40
-
41
- ```astro
42
- ---
43
- // src/layouts/Base.astro
44
- import '@easy-web/theme-core/tokens.css';
45
- import { noFlashScript } from '@easy-web/theme-core';
46
- import PageShell from '@easy-web/content-blocks/components/PageShell';
47
- import Header from '@easy-web/content-blocks/components/Header';
48
- import Footer from '@easy-web/content-blocks/components/Footer';
49
- import { siteConfig } from '../config';
50
- import { i18n } from '../lib/i18n';
51
-
52
- interface Props {
53
- lang: string;
54
- title: string;
55
- pathname: string;
56
- alternateHref?: string;
57
- }
58
- const { lang, title, pathname, alternateHref } = Astro.props;
59
- const navItems = siteConfig.navItems[lang];
60
- const legalLinks = siteConfig.legalLinks[lang];
61
- ---
62
- <html lang={lang}>
63
- <head>
64
- <script is:inline set:html={noFlashScript}></script>
65
- <title>{title}</title>
66
- </head>
67
- <body>
68
- <PageShell skipLabel={siteConfig.skipLabel[lang]}>
69
- <Header
70
- slot="header"
71
- siteName={siteConfig.siteName}
72
- navItems={navItems}
73
- currentLang={lang}
74
- pathname={pathname}
75
- alternateHref={alternateHref}
76
- locales={i18n.locales}
77
- />
78
- <slot />
79
- <Footer slot="footer" siteName={siteConfig.siteName} legalLinks={legalLinks} />
80
- </PageShell>
81
- </body>
82
- </html>
83
- ```
84
-
85
- `PageShell` supplies the skip link and the `<main>` landmark; without it this layout ships a WCAG 2.1 SC 2.4.1 failure that an axe gate does not catch. `locales` suppresses the language switch on single-locale sites. Both are explained under [Site chrome](#site-chrome).
86
-
87
- ### Page — compose Hero + Section + CardGrid + Card
88
-
89
- ```astro
90
- ---
91
- // src/pages/index.astro
92
- import Layout from '../layouts/Base.astro';
93
- import Hero from '@easy-web/content-blocks/components/Hero';
94
- import Section from '@easy-web/content-blocks/components/Section';
95
- import CardGrid from '@easy-web/content-blocks/components/CardGrid';
96
- import Card from '@easy-web/content-blocks/components/Card';
97
- ---
98
- <Layout lang="de" title="Home" pathname="/">
99
- <Hero
100
- title="Willkommen"
101
- subtitle="Untertitel mit Beschreibung"
102
- ctaLabel="Mehr erfahren"
103
- ctaHref="#about"
104
- />
105
- <Section id="about">
106
- <h2>Über uns</h2>
107
- <p>Inhalt …</p>
108
- </Section>
109
- <Section>
110
- <CardGrid>
111
- <Card title="Erste Karte" description="Kurze Beschreibung" href="/a" />
112
- <Card title="Zweite Karte" description="Kurze Beschreibung" href="/b" />
113
- <Card title="Dritte Karte" description="Kurze Beschreibung" href="/c" />
114
- </CardGrid>
115
- </Section>
116
- </Layout>
117
- ```
118
-
119
- ## Component reference
120
-
121
- All components use the `--ew-*` design tokens from `@easy-web/theme-core`. None ship their own theme system; they inherit whatever tokens are loaded in the consuming page.
122
-
123
- ### Site chrome
124
-
125
- | Component | Required props | Optional props | Notes |
126
- | :--- | :--- | :--- | :--- |
127
- | `PageShell` | — | `mainId?: string`, `skipLabel?: string`, `class?: string` | Document landmark scaffold: skip link → `header` slot → `<main>` → `footer` slot. Owns that DOM order. `mainId` defaults to `main-content`, `skipLabel` to `'Skip to main content'` — **set it per locale**. |
128
- | `Header` | `siteName: string`, `navItems: NavItem[]`, `currentLang: string`, `pathname: string` | `brandHref?: string`, `alternateHref?: string`, `menuLabel?: string`, `logo?: string`, `navId?: string`, `locales?: readonly string[]` | Sticky responsive header with `actions` slot. Mobile hamburger menu (scoped vanilla JS). Default slot fallback renders `ThemeToggle` + `LanguageSwitch` — the switch is omitted when `locales` holds a single entry. `navId` defaults to `ew-header-nav`. `data-testid="header-classic"`. |
129
- | `HeaderCentered` | `siteName: string`, `navItems: NavItem[]`, `currentLang: string`, `pathname: string` | `alternateHref?: string`, `menuLabel?: string`, `logo?: string`, `navId?: string`, `locales?: readonly string[]` | Variant: brand centered, nav links split left/right. Same `actions` slot and mobile hamburger. `navId` defaults to `ew-header-centered-nav`. `data-testid="header-centered"`. |
130
- | `HeaderHideOnScroll` | `siteName: string`, `navItems: NavItem[]`, `currentLang: string`, `pathname: string` | `alternateHref?: string`, `menuLabel?: string`, `logo?: string`, `navId?: string`, `locales?: readonly string[]` | Variant: `position: fixed` header that slides off screen on scroll-down, reappears on scroll-up. Compensates body padding via JS. `navId` defaults to `ew-header-hos-nav`. `data-testid="header-hide-on-scroll"`. |
131
- | `HeaderFlyout` | `siteName: string`, `navItems: NavItem[]`, `currentLang: string`, `pathname: string` | `alternateHref?: string`, `menuLabel?: string`, `logo?: string`, `navId?: string`, `locales?: readonly string[]` | Variant: items with `children[]` show a flyout dropdown (hover/focus desktop, click mobile, keyboard accessible). `navId` defaults to `ew-header-flyout-nav` and also prefixes each dropdown's id. `data-testid="header-flyout"`. |
132
- | `Footer` | `siteName: string`, `legalLinks: Array<{ label: string; href: string }>` | — | Simple copyright + legal-link footer. |
133
- | `ThemeToggle` | — | — | Light / dark / system trio button. Talks to `@easy-web/theme-core` via `data-theme` on `<html>` and `localStorage`. |
134
- | `LanguageSwitch` | `currentLang: string`, `pathname: string` | `alternateHref?: string` | DE ↔ EN switcher. If `alternateHref` is provided, links there directly; otherwise infers the alternate path from `pathname`. Always renders when used directly — it has no concept of how many locales the site serves; the header variants gate it on their `locales` prop. |
135
-
136
- #### `PageShell` — skip link and `<main>` landmark
137
-
138
- A layout that renders `<Header /> <slot /> <Footer />` produces a document with no `<main>` landmark and no way to bypass the navigation. That fails WCAG 2.1 SC 2.4.1 "Bypass Blocks" (Level A) on every route whose content does not open with a heading.
139
-
140
- It fails quietly: axe-core reports this through its `bypass` rule, which carries `reviewOnFail`, so it lands in `incomplete` rather than `violations` — an accessibility gate asserting `violations.length === 0` stays green while the failure ships.
141
-
142
- `PageShell` owns the document order, because the skip link has to be the first focusable element and a caller that renders its own header cannot arrange that. Header and footer therefore arrive as named slots:
143
-
144
- ```astro
145
- ---
146
- // src/layouts/Base.astro
147
- import PageShell from '@easy-web/content-blocks/components/PageShell';
148
- import Header from '@easy-web/content-blocks/components/Header';
149
- import Footer from '@easy-web/content-blocks/components/Footer';
150
- import { m } from '../paraglide/messages';
151
- ---
152
- <body>
153
- <PageShell skipLabel={m.skip_to_main()}>
154
- <Header slot="header" siteName={siteConfig.siteName} navItems={navItems} currentLang={locale} pathname={pathname} locales={i18n.locales} />
155
- <slot />
156
- <Footer slot="footer" siteName={siteConfig.siteName} legalLinks={legalLinks} />
157
- </PageShell>
158
- </body>
159
- ```
160
-
161
- Rendered order is skip link → `header` slot → `<main>` → `footer` slot.
162
-
163
- `skipLabel` defaults to English (`'Skip to main content'`). **Source it from your message catalogue, not a literal** — it is visible text, and on a non-English site a hardcoded default is the one string on the page that is not translated.
164
-
165
- Two details are load-bearing and should survive any re-implementation:
166
-
167
- * `<main>` carries `tabindex="-1"` so activating the skip link moves focus, not just scroll position. Without it some browsers scroll the viewport but leave focus in the nav, so the next Tab returns to the menu — the control looks like it works while bypassing nothing.
168
- * The skip link is positioned off-screen rather than `display: none`, because a hidden element leaves the focus order entirely and would be unreachable by exactly the keyboard users it exists for.
169
-
170
- #### Header `actions` slot
171
-
172
- All four header variants expose a named `actions` slot. When the slot receives content, it replaces the default `ThemeToggle` + `LanguageSwitch` controls. When the slot is empty, the fallback renders those controls unchanged (backward compatible).
173
-
174
- ```astro
175
- ---
176
- import Header from '@easy-web/content-blocks/components/Header';
177
- import HeaderCentered from '@easy-web/content-blocks/components/HeaderCentered';
178
- import HeaderHideOnScroll from '@easy-web/content-blocks/components/HeaderHideOnScroll';
179
- import HeaderFlyout from '@easy-web/content-blocks/components/HeaderFlyout';
180
- ---
181
-
182
- <!-- Default: ThemeToggle + LanguageSwitch rendered automatically -->
183
- <Header siteName="My Site" navItems={navItems} currentLang="de" pathname={pathname} />
184
-
185
- <!-- Custom slot content replaces ThemeToggle + LanguageSwitch -->
186
- <HeaderCentered siteName="My Site" navItems={navItems} currentLang="de" pathname={pathname}>
187
- <fragment slot="actions">
188
- <MyCustomButton />
189
- </fragment>
190
- </HeaderCentered>
191
-
192
- <!-- Flyout: navItems may include children[] for dropdown panels -->
193
- <HeaderFlyout siteName="My Site" navItems={navItemsWithChildren} currentLang="de" pathname={pathname} />
194
- ```
195
-
196
- #### Single-locale sites — the `locales` prop
197
-
198
- `LanguageSwitch` derives its target as "the other locale" (`de` ↔ `en`). On a site that serves one locale that target is a route the site never builds, so the header shipped a control leading to a 404.
199
-
200
- Pass the locales the site actually serves and the switch is omitted when there is only one:
201
-
202
- ```astro
203
- ---
204
- // src/layouts/Base.astro
205
- import { i18n } from '../lib/i18n'; // createI18n({ locales: ['de'] as const, … })
206
- ---
207
- <Header
208
- siteName={siteConfig.siteName}
209
- navItems={navItems}
210
- currentLang={locale}
211
- pathname={pathname}
212
- locales={i18n.locales}
213
- />
214
- ```
215
-
216
- Feed it from the instance's `createI18n()` call rather than a hand-written array or a boolean flag — that keeps one declaration of the locale set behind the header, the hreflang links and the sitemap alternates, so they cannot drift apart.
217
-
218
- Omitting the prop keeps the switch rendering unconditionally, so existing bilingual consumers are unaffected. Suppressing the switch via the `actions` slot also works, but it replaces the whole control group — you then have to re-supply `ThemeToggle` yourself.
219
-
220
- Selecting the header variant in a Base layout via a `headerVariant` prop:
221
-
222
- ```astro
223
- ---
224
- // Base.astro
225
- import Header from '@easy-web/content-blocks/components/Header';
226
- import HeaderCentered from '@easy-web/content-blocks/components/HeaderCentered';
227
- import HeaderHideOnScroll from '@easy-web/content-blocks/components/HeaderHideOnScroll';
228
- import HeaderFlyout from '@easy-web/content-blocks/components/HeaderFlyout';
229
-
230
- interface Props {
231
- headerVariant?: 'classic' | 'centered' | 'hide-on-scroll' | 'flyout';
232
- // …other props
233
- }
234
- const { headerVariant = 'classic' } = Astro.props;
235
- const HeaderComponents = { classic: Header, centered: HeaderCentered, 'hide-on-scroll': HeaderHideOnScroll, flyout: HeaderFlyout };
236
- const ActiveHeader = HeaderComponents[headerVariant];
237
- ---
238
- <ActiveHeader siteName={siteName} navItems={navItems} currentLang={lang} pathname={pathname} alternateHref={alternateHref} />
239
- ```
240
-
241
- ### Hero / call-to-action / contact
242
-
243
- | Component | Required props | Optional props | Notes |
244
- | :--- | :--- | :--- | :--- |
245
- | `Hero` | `title: string` | `subtitle?: string`, `ctaLabel?: string`, `ctaHref?: string`, `variant?: 'centered' \| 'left-aligned'` | Page banner with optional CTA. CTA renders only when both `ctaLabel` and `ctaHref` are present. |
246
- | `CtaSection` | `heading: string`, `buttonLabel: string`, `buttonHref: string` | `body?: string`, `variant?: 'default' \| 'muted' \| 'primary'` | Standalone CTA banner. `primary` variant inverts colors to brand. |
247
- | `ContactSection` | `heading: string`, `email: string`, `buttonLabel: string` | `body?: string` | Centered mailto-only contact CTA. Button is `mailto:${email}`. |
248
-
249
- ### Structural
250
-
251
- | Component | Required props | Optional props | Notes |
252
- | :--- | :--- | :--- | :--- |
253
- | `Section` | — | `id?: string`, `class?: string` | Generic content wrapper. `id` enables anchor-link targets. Slot-based. |
254
- | `CardGrid` | — | — | Responsive CSS grid (3 → 2 → 1 columns by breakpoint). Slot in `Card`s. |
255
- | `Card` | `title: string` | `description?: string`, `href?: string`, `image?: string`, `imageAlt?: string` | Content card. Renders as `<a>` when `href` is provided, plain `<div>` otherwise. Image is `loading="lazy"`. |
256
-
257
- ### Gallery system
258
-
259
- The gallery system is **CMS-driven**: content authors create gallery entries in their site's `src/content/galleries/` directory; pages decide which entry to load and where to place it. Each entry has a `kind` field that selects the rendering variant.
260
-
261
- Six variants are available:
262
-
263
- | `kind` | Component | Use case |
264
- | :--- | :--- | :--- |
265
- | `image-grid` | `GalleryImageGrid` | Static N-column uniform grid. Component previews, team photos, sponsors. |
266
- | `hero-slider` | `GalleryHeroSlider` | Full-bleed editorial carousel with title + subtitle + optional CTA per slide. |
267
- | `carousel` | `GalleryCarousel` | Image slider with optional captions. Constrained-width container; no per-slide CTA. |
268
- | `masonry-grid` | `GalleryMasonryGrid` | Pinterest-style variable-height grid via CSS columns. Photography, portfolios. |
269
- | `feature-highlight` | `GalleryFeatureHighlight` | Alternating image+text+link rows. Product feature showcase, service descriptions. |
270
- | `lightbox-grid` | `GalleryLightboxGrid` | Uniform grid + click-to-expand modal. Photo albums, event galleries. Vanilla JS modal with keyboard navigation. |
271
-
272
- Schema is exported from this package and consumed by each instance's `content.config.ts`:
273
-
274
- ```ts
275
- import { defineCollection } from 'astro:content';
276
- import { glob } from 'astro/loaders';
277
- import { gallerySchema } from '@easy-web/content-blocks/schemas/galleries';
278
-
279
- const galleries = defineCollection({
280
- loader: glob({ pattern: '**/*.{yml,yaml}', base: './src/content/galleries' }),
281
- schema: gallerySchema,
282
- });
283
- ```
284
-
285
- Use the `GallerySection` dispatcher in pages — it switches on `entry.data.kind` and renders the right variant:
286
-
287
- ```astro
288
- ---
289
- import GallerySection from '@easy-web/content-blocks/components/GallerySection';
290
- import { getEntry } from 'astro:content';
291
-
292
- const heroEntry = await getEntry('galleries', 'home-hero-de');
293
- const previewEntry = await getEntry('galleries', 'about-component-preview-de');
294
- ---
295
- <GallerySection entry={heroEntry} />
296
- <!-- ...other page content... -->
297
- <GallerySection entry={previewEntry} />
298
- ```
299
-
300
- | Component | Required props | Optional props | Notes |
301
- | :--- | :--- | :--- | :--- |
302
- | `GallerySection` | `entry: { data: GalleryEntry }` | — | Dispatcher. Renders the correct variant based on `entry.data.kind`. Renders nothing when `entry` is null/undefined. |
303
- | `GalleryImageGrid` | `items: GalleryImageGridData['items']` | `title?`, `columns?: 2 \| 3 \| 4 \| 6`, `gap?: 'sm' \| 'md' \| 'lg'`, `aspectRatio?: 'square' \| '4/3' \| '16/9' \| 'auto'` | Pure CSS grid (responsive). Item `href` wraps in `<a>`. Item `caption` renders as `<figcaption>`. |
304
- | `GalleryHeroSlider` | `slides: GalleryHeroSliderData['slides']` | `title?`, `autoplay?: boolean`, `interval?: number` (ms), `height?: 'sm' \| 'md' \| 'lg' \| 'full'` | Vanilla JS slider. Pause on hover/focus, keyboard arrows, dot navigation, respects `prefers-reduced-motion`. |
305
- | `GalleryCarousel` | `slides: GalleryCarouselData['slides']` | `title?`, `autoplay?: boolean` (default `false`), `interval?: number`, `showDots?: boolean`, `showArrows?: boolean` | Constrained-width slider with optional per-slide caption (overlay at bottom). Same JS controls as `GalleryHeroSlider`. |
306
- | `GalleryMasonryGrid` | `items: GalleryMasonryGridData['items']` | `title?`, `columns?: 2 \| 3 \| 4`, `gap?: 'sm' \| 'md' \| 'lg'` | Pure CSS columns; no JS. `break-inside: avoid` keeps items intact. Falls back to fewer columns on smaller breakpoints. |
307
- | `GalleryFeatureHighlight` | `items: GalleryFeatureHighlightData['items']` | `title?`, `gap?: 'sm' \| 'md' \| 'lg'` | Alternating image-left / image-right rows; per-item `imagePosition` overrides the alternation. Stacks on mobile (image first). |
308
- | `GalleryLightboxGrid` | `items: GalleryLightboxGridData['items']` | `title?`, `columns?: 2 \| 3 \| 4`, `gap?: 'sm' \| 'md' \| 'lg'`, `aspectRatio?: 'square' \| '4/3' \| 'auto'` | Grid + modal lightbox. Click image to expand; keyboard `Esc`/arrows navigate; backdrop click closes; restores focus to trigger on close. Body scroll locked while open. |
309
-
310
- ### Blog
311
-
312
- | Component | Required props | Optional props | Notes |
313
- | :--- | :--- | :--- | :--- |
314
- | `BlogPostCard` | `title: string`, `description: string`, `href: string`, `pubDate: Date` | `heroImage?: string`, `heroImageAlt?: string`, `locale?: string` | Linked card for blog index pages. Date is `Intl.DateTimeFormat`-formatted with the provided `locale`. |
315
-
316
- ### Legal & long-form
317
-
318
- | Component | Required props | Optional props | Notes |
319
- | :--- | :--- | :--- | :--- |
320
- | `LegalLayout` | — | (slot-based) | Narrow content wrapper for impressum / datenschutz / AGB. Constrains line-length for legal prose. |
321
- | `Prose` | — | (slot-based) | Styled wrapper for Markdown/HTML content (`<h1>`–`<h6>`, `<p>`, `<ul>`, `<a>`, `<blockquote>`, `<code>`, etc.) using `--ew-*` typography tokens. |
322
-
323
- ### Banners / notices
324
-
325
- | Component | Required props | Optional props | Notes |
326
- | :--- | :--- | :--- | :--- |
327
- | `DraftBanner` | — | (slot-based, expects a short message) | Banner notice for draft content. |
328
- | `LanguageNotice` | — | (slot-based, expects a translation-status message) | Banner notice when a page is shown in the non-current locale or has a partial translation. |
329
-
330
- ## <UniversalMedia>
331
-
332
- A universal image dispatcher component that renders images from any source type consistently.
333
-
334
- ### Props
335
-
336
- | Prop | Type | Required | Description |
337
- |------|------|----------|-------------|
338
- | `src` | `ImageMetadata \| string` | ✓ | Image source: resolved metadata or a URL/path string |
339
- | `alt` | `string` | ✓ | Alt text |
340
- | `images` | `Record<string, () => Promise<{ default: ImageMetadata }>>` | ✓ | Consumer-supplied glob result (pass `import.meta.glob(...)` from the calling component) |
341
- | `fallbackSrc` | `string` | — | Fallback image path when `/src/assets/` glob lookup fails |
342
- | `fallbackAlt` | `string` | — | Fallback alt text (defaults to `alt`) |
343
- | `width` | `number` | — | Image width in px (default: 800) |
344
- | `height` | `number` | — | Image height in px (default: 600) |
345
- | `class` | `string` | — | CSS class name |
346
- | `decoding` | `'async' \| 'auto' \| 'sync'` | — | Image decoding hint (default: `'async'`) |
347
-
348
- ### Dispatch logic
349
-
350
- 1. **`ImageMetadata` object** → `<Image>` (Astro-optimised, generates srcset)
351
- 2. **`/src/assets/...` string** → glob lookup via `images` prop → `<Image>` (or fallback/plain `<img>` on miss)
352
- 3. **`http://...` / `https://...` string** → `<Image inferSize>` (reads dimensions from remote)
353
- 4. **Everything else** (e.g., `/public/...` paths) → plain `<img>`
354
-
355
- > **Unsupported formats**: HEIC and JXL. Reject these at the CMS upload level (e.g., Decap CMS widget `hint`).
356
-
357
- ### Usage
358
-
359
- ```astro
360
- ---
361
- import type { ImageMetadata } from 'astro';
362
- import UniversalMedia from '@easy-web/content-blocks/components/UniversalMedia';
363
-
364
- const images = import.meta.glob<{ default: ImageMetadata }>('/src/assets/**', { import: 'default' });
365
- ---
366
-
367
- <UniversalMedia
368
- src={entry.data.photo}
369
- alt={entry.data.photoAlt}
370
- {images}
371
- fallbackSrc="/src/assets/images/default.png"
372
- fallbackAlt="Default image"
373
- />
374
- ```
375
-
376
- ## Styling
377
-
378
- All components reference the `@easy-web/theme-core` CSS custom properties:
379
-
380
- * Colors: `--ew-surface`, `--ew-on-surface`, `--ew-surface-muted`, `--ew-primary`, `--ew-on-primary`, `--ew-border`, `--ew-muted`
381
- * Typography: `--ew-font-sans`, `--ew-text-{xs,sm,base,lg,xl,2xl,3xl}`, `--ew-leading-{tight,normal,loose}`
382
- * Spacing: `--ew-space-{0..12}`
383
- * Radii: `--ew-radius-{sm,md,lg,xl,full}`
384
-
385
- To re-skin a site, override these custom properties on a parent element (or globally on `:root`) — do not edit the components.
386
-
387
- Components use BEM-style class names prefixed with `ew-` (e.g., `.ew-hero`, `.ew-hero__title`, `.ew-hero--centered`). Selectors are intentionally specific enough to be styled via standard CSS overrides without `!important`.
388
-
389
- ## Adoption status
390
-
391
- The published version is `1.2.3`. Three site instances consume this package at `^1.2.3`: a pilot that validates every release first, and two customer sites.
392
-
393
- The per-instance adoption matrix is maintained in the ecosystem's index repository, which is not public.
394
-
395
- ## See also
396
-
397
- * [`@easy-web/theme-core`](https://github.com/achimismaili/easy-web/blob/main/packages/theme-core/README.md) — the design-token package these components consume.
398
- * [`@easy-web/i18n`](https://github.com/achimismaili/easy-web/blob/main/packages/i18n/README.md) — Astro + Paraglide bilingual utilities used together with `LanguageSwitch`.
399
- * [`easy-web/AGENTS.md`](https://github.com/achimismaili/easy-web/blob/main/AGENTS.md) — repo orientation and publishing workflow.
14
+ The core schemas import `z` from `astro/zod`; the `zod` peer dependency is kept here only so existing installs keep resolving. See [MIGRATION.md](MIGRATION.md) for older migration notes.