@easy-web/content-blocks 1.3.3 → 1.4.1

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
@@ -1,296 +1,13 @@
1
1
  ---
2
- import type { GalleryCarouselData } from '../schemas/galleries';
2
+ /**
3
+ * @deprecated Import `@easy-web/core/components/GalleryCarousel.astro` instead.
4
+ * Compatibility wrapper: renders the core component with the same props and slots.
5
+ */
6
+ import type { ComponentProps } from 'astro/types';
7
+ import GalleryCarousel from '@easy-web/core/components/GalleryCarousel.astro';
3
8
 
4
- type Props = Omit<GalleryCarouselData, 'kind' | 'locale' | 'translationKey'>;
9
+ type Props = ComponentProps<typeof GalleryCarousel>;
5
10
 
6
- const {
7
- title,
8
- autoplay = false,
9
- interval = 4000,
10
- showDots = true,
11
- showArrows = true,
12
- slides,
13
- } = Astro.props;
11
+ const props = Astro.props;
14
12
  ---
15
-
16
- {slides.length > 0 && (
17
- <section class="ew-carousel-wrap">
18
- <div class="ew-carousel-wrap__inner">
19
- {title && <h2 class="ew-carousel-wrap__title">{title}</h2>}
20
- <div
21
- class="ew-carousel"
22
- data-autoplay={String(autoplay)}
23
- data-interval={String(interval)}
24
- aria-roledescription="carousel"
25
- aria-label={title ?? 'Image carousel'}
26
- tabindex="0"
27
- >
28
- <div class="ew-carousel__viewport">
29
- {slides.map((slide, i) => (
30
- <figure
31
- class="ew-carousel__slide"
32
- data-active={i === 0 ? 'true' : 'false'}
33
- aria-hidden={i !== 0}
34
- aria-roledescription="slide"
35
- aria-label={`${i + 1} / ${slides.length}`}
36
- >
37
- <img
38
- src={slide.src}
39
- alt={slide.alt}
40
- class="ew-carousel__img"
41
- loading={i === 0 ? 'eager' : 'lazy'}
42
- />
43
- {slide.caption && (
44
- <figcaption class="ew-carousel__caption">{slide.caption}</figcaption>
45
- )}
46
- </figure>
47
- ))}
48
- </div>
49
-
50
- {slides.length > 1 && showArrows && (
51
- <>
52
- <button
53
- type="button"
54
- class="ew-carousel__arrow ew-carousel__arrow--prev"
55
- aria-label="Previous slide"
56
- >
57
- <svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
58
- <polyline points="15 18 9 12 15 6"></polyline>
59
- </svg>
60
- </button>
61
- <button
62
- type="button"
63
- class="ew-carousel__arrow ew-carousel__arrow--next"
64
- aria-label="Next slide"
65
- >
66
- <svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
67
- <polyline points="9 18 15 12 9 6"></polyline>
68
- </svg>
69
- </button>
70
- </>
71
- )}
72
-
73
- {slides.length > 1 && showDots && (
74
- <div class="ew-carousel__dots" role="tablist" aria-label="Slide navigation">
75
- {slides.map((_, i) => (
76
- <button
77
- type="button"
78
- class="ew-carousel__dot"
79
- data-active={i === 0 ? 'true' : 'false'}
80
- data-index={i}
81
- role="tab"
82
- aria-label={`Go to slide ${i + 1}`}
83
- aria-selected={i === 0 ? 'true' : 'false'}
84
- ></button>
85
- ))}
86
- </div>
87
- )}
88
- </div>
89
- </div>
90
- </section>
91
- )}
92
-
93
- <script>
94
- type Carousel = HTMLElement;
95
-
96
- const initCarousel = (el: Carousel) => {
97
- const slides = Array.from(el.querySelectorAll<HTMLElement>('.ew-carousel__slide'));
98
- const dots = Array.from(el.querySelectorAll<HTMLElement>('.ew-carousel__dot'));
99
- if (slides.length <= 1) return;
100
-
101
- let current = 0;
102
- let timer: ReturnType<typeof setInterval> | null = null;
103
- const intervalMs = Number(el.dataset.interval) || 4000;
104
- const autoplay = el.dataset.autoplay === 'true';
105
- const reduced = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
106
-
107
- const go = (idx: number) => {
108
- const next = ((idx % slides.length) + slides.length) % slides.length;
109
- if (next === current) return;
110
- slides[current].dataset.active = 'false';
111
- slides[current].setAttribute('aria-hidden', 'true');
112
- slides[next].dataset.active = 'true';
113
- slides[next].setAttribute('aria-hidden', 'false');
114
- if (dots[current]) {
115
- dots[current].dataset.active = 'false';
116
- dots[current].setAttribute('aria-selected', 'false');
117
- }
118
- if (dots[next]) {
119
- dots[next].dataset.active = 'true';
120
- dots[next].setAttribute('aria-selected', 'true');
121
- }
122
- current = next;
123
- };
124
-
125
- const stop = () => {
126
- if (timer) {
127
- clearInterval(timer);
128
- timer = null;
129
- }
130
- };
131
- const start = () => {
132
- stop();
133
- if (autoplay && !reduced) {
134
- timer = setInterval(() => go(current + 1), intervalMs);
135
- }
136
- };
137
-
138
- el.querySelector<HTMLElement>('.ew-carousel__arrow--prev')
139
- ?.addEventListener('click', () => { go(current - 1); start(); });
140
- el.querySelector<HTMLElement>('.ew-carousel__arrow--next')
141
- ?.addEventListener('click', () => { go(current + 1); start(); });
142
- dots.forEach((dot, i) => {
143
- dot.addEventListener('click', () => { go(i); start(); });
144
- });
145
-
146
- el.addEventListener('mouseenter', stop);
147
- el.addEventListener('mouseleave', start);
148
- el.addEventListener('focusin', stop);
149
- el.addEventListener('focusout', start);
150
-
151
- el.addEventListener('keydown', (e: KeyboardEvent) => {
152
- if (e.key === 'ArrowLeft') { e.preventDefault(); go(current - 1); start(); }
153
- else if (e.key === 'ArrowRight') { e.preventDefault(); go(current + 1); start(); }
154
- });
155
-
156
- start();
157
- };
158
-
159
- document.querySelectorAll<HTMLElement>('.ew-carousel').forEach(initCarousel);
160
- </script>
161
-
162
- <style>
163
- .ew-carousel-wrap {
164
- padding: var(--ew-space-8) var(--ew-space-5);
165
- }
166
- .ew-carousel-wrap__inner {
167
- max-width: 72rem;
168
- margin: 0 auto;
169
- }
170
- .ew-carousel-wrap__title {
171
- font-family: var(--ew-font-sans);
172
- font-size: var(--ew-text-xl);
173
- font-weight: 700;
174
- color: var(--ew-on-surface);
175
- margin: 0 0 var(--ew-space-5);
176
- line-height: var(--ew-leading-tight);
177
- }
178
-
179
- .ew-carousel {
180
- position: relative;
181
- background: var(--ew-surface-muted);
182
- border-radius: var(--ew-radius-md);
183
- overflow: hidden;
184
- outline: none;
185
- }
186
- .ew-carousel:focus-visible {
187
- outline: 3px solid var(--ew-primary);
188
- outline-offset: -3px;
189
- }
190
-
191
- .ew-carousel__viewport {
192
- position: relative;
193
- width: 100%;
194
- aspect-ratio: 16 / 9;
195
- }
196
-
197
- .ew-carousel__slide {
198
- position: absolute;
199
- inset: 0;
200
- margin: 0;
201
- opacity: 0;
202
- transition: opacity 0.4s ease;
203
- pointer-events: none;
204
- }
205
- .ew-carousel__slide[data-active='true'] {
206
- opacity: 1;
207
- pointer-events: auto;
208
- }
209
- @media (prefers-reduced-motion: reduce) {
210
- .ew-carousel__slide {
211
- transition: none;
212
- }
213
- }
214
-
215
- .ew-carousel__img {
216
- width: 100%;
217
- height: 100%;
218
- object-fit: cover;
219
- display: block;
220
- }
221
-
222
- .ew-carousel__caption {
223
- position: absolute;
224
- left: 0;
225
- right: 0;
226
- bottom: 0;
227
- padding: var(--ew-space-3) var(--ew-space-5);
228
- background: linear-gradient(to top, rgba(0, 0, 0, 0.65), rgba(0, 0, 0, 0));
229
- color: #fff;
230
- font-family: var(--ew-font-sans);
231
- font-size: var(--ew-text-sm);
232
- line-height: var(--ew-leading-normal);
233
- margin: 0;
234
- }
235
-
236
- .ew-carousel__arrow {
237
- position: absolute;
238
- top: 50%;
239
- transform: translateY(-50%);
240
- width: 2.5rem;
241
- height: 2.5rem;
242
- border-radius: var(--ew-radius-full);
243
- border: none;
244
- background: rgba(0, 0, 0, 0.45);
245
- color: #fff;
246
- cursor: pointer;
247
- display: inline-flex;
248
- align-items: center;
249
- justify-content: center;
250
- transition: background 0.15s ease;
251
- z-index: 2;
252
- }
253
- .ew-carousel__arrow:hover,
254
- .ew-carousel__arrow:focus-visible {
255
- background: rgba(0, 0, 0, 0.7);
256
- }
257
- .ew-carousel__arrow:focus-visible {
258
- outline: 2px solid #fff;
259
- outline-offset: 2px;
260
- }
261
- .ew-carousel__arrow--prev { left: var(--ew-space-3); }
262
- .ew-carousel__arrow--next { right: var(--ew-space-3); }
263
-
264
- .ew-carousel__dots {
265
- position: absolute;
266
- bottom: var(--ew-space-3);
267
- left: 0;
268
- right: 0;
269
- display: flex;
270
- justify-content: center;
271
- gap: var(--ew-space-2);
272
- z-index: 2;
273
- }
274
- .ew-carousel__dot {
275
- width: 0.5rem;
276
- height: 0.5rem;
277
- border-radius: var(--ew-radius-full);
278
- border: none;
279
- background: rgba(255, 255, 255, 0.5);
280
- cursor: pointer;
281
- padding: 0;
282
- transition: background 0.15s ease, transform 0.15s ease;
283
- }
284
- .ew-carousel__dot[data-active='true'] {
285
- background: #fff;
286
- transform: scale(1.3);
287
- }
288
- .ew-carousel__dot:hover,
289
- .ew-carousel__dot:focus-visible {
290
- background: rgba(255, 255, 255, 0.85);
291
- }
292
- .ew-carousel__dot:focus-visible {
293
- outline: 2px solid #fff;
294
- outline-offset: 2px;
295
- }
296
- </style>
13
+ <GalleryCarousel {...props} />
@@ -1,153 +1,13 @@
1
1
  ---
2
- import type { GalleryFeatureHighlightData } from '../schemas/galleries';
2
+ /**
3
+ * @deprecated Import `@easy-web/core/components/GalleryFeatureHighlight.astro` instead.
4
+ * Compatibility wrapper: renders the core component with the same props and slots.
5
+ */
6
+ import type { ComponentProps } from 'astro/types';
7
+ import GalleryFeatureHighlight from '@easy-web/core/components/GalleryFeatureHighlight.astro';
3
8
 
4
- type Props = Omit<GalleryFeatureHighlightData, 'kind' | 'locale' | 'translationKey'>;
9
+ type Props = ComponentProps<typeof GalleryFeatureHighlight>;
5
10
 
6
- const {
7
- title,
8
- gap = 'lg',
9
- items,
10
- } = Astro.props;
11
-
12
- const sectionClass = ['ew-feature-highlight', `ew-feature-highlight--gap-${gap}`].join(' ');
11
+ const props = Astro.props;
13
12
  ---
14
-
15
- {items.length > 0 && (
16
- <section class="ew-feature-highlight-wrap">
17
- <div class="ew-feature-highlight-wrap__inner">
18
- {title && <h2 class="ew-feature-highlight-wrap__title">{title}</h2>}
19
- <div class={sectionClass}>
20
- {items.map((item, i) => {
21
- const position = item.imagePosition ?? (i % 2 === 0 ? 'right' : 'left');
22
- const rowClass = `ew-feature-highlight__row ew-feature-highlight__row--image-${position}`;
23
- return (
24
- <article class={rowClass}>
25
- <div class="ew-feature-highlight__media">
26
- <img
27
- src={item.src}
28
- alt={item.alt}
29
- class="ew-feature-highlight__img"
30
- loading="lazy"
31
- />
32
- </div>
33
- <div class="ew-feature-highlight__content">
34
- <h3 class="ew-feature-highlight__title">{item.title}</h3>
35
- <p class="ew-feature-highlight__description">{item.description}</p>
36
- {item.href && item.cta && (
37
- <a href={item.href} class="ew-feature-highlight__cta">{item.cta}</a>
38
- )}
39
- </div>
40
- </article>
41
- );
42
- })}
43
- </div>
44
- </div>
45
- </section>
46
- )}
47
-
48
- <style>
49
- .ew-feature-highlight-wrap {
50
- padding: var(--ew-space-8) var(--ew-space-5);
51
- }
52
- .ew-feature-highlight-wrap__inner {
53
- max-width: 72rem;
54
- margin: 0 auto;
55
- }
56
- .ew-feature-highlight-wrap__title {
57
- font-family: var(--ew-font-sans);
58
- font-size: var(--ew-text-xl);
59
- font-weight: 700;
60
- color: var(--ew-on-surface);
61
- margin: 0 0 var(--ew-space-5);
62
- line-height: var(--ew-leading-tight);
63
- }
64
-
65
- .ew-feature-highlight {
66
- display: flex;
67
- flex-direction: column;
68
- }
69
- .ew-feature-highlight--gap-sm { gap: var(--ew-space-5); }
70
- .ew-feature-highlight--gap-md { gap: var(--ew-space-7); }
71
- .ew-feature-highlight--gap-lg { gap: var(--ew-space-8); }
72
-
73
- .ew-feature-highlight__row {
74
- display: grid;
75
- grid-template-columns: 1fr 1fr;
76
- align-items: center;
77
- gap: var(--ew-space-7);
78
- }
79
-
80
- .ew-feature-highlight__row--image-left .ew-feature-highlight__media { order: 1; }
81
- .ew-feature-highlight__row--image-left .ew-feature-highlight__content { order: 2; }
82
- .ew-feature-highlight__row--image-right .ew-feature-highlight__media { order: 2; }
83
- .ew-feature-highlight__row--image-right .ew-feature-highlight__content { order: 1; }
84
-
85
- @media (max-width: 768px) {
86
- .ew-feature-highlight__row {
87
- grid-template-columns: 1fr;
88
- gap: var(--ew-space-4);
89
- }
90
- .ew-feature-highlight__row .ew-feature-highlight__media { order: 1; }
91
- .ew-feature-highlight__row .ew-feature-highlight__content { order: 2; }
92
- }
93
-
94
- .ew-feature-highlight__media {
95
- overflow: hidden;
96
- border-radius: var(--ew-radius-md);
97
- }
98
-
99
- .ew-feature-highlight__img {
100
- width: 100%;
101
- height: auto;
102
- display: block;
103
- aspect-ratio: 4 / 3;
104
- object-fit: cover;
105
- }
106
-
107
- .ew-feature-highlight__content {
108
- display: flex;
109
- flex-direction: column;
110
- gap: var(--ew-space-3);
111
- }
112
-
113
- .ew-feature-highlight__title {
114
- font-family: var(--ew-font-sans);
115
- font-size: var(--ew-text-xl);
116
- font-weight: 700;
117
- color: var(--ew-on-surface);
118
- margin: 0;
119
- line-height: var(--ew-leading-tight);
120
- }
121
-
122
- .ew-feature-highlight__description {
123
- font-family: var(--ew-font-sans);
124
- font-size: var(--ew-text-base);
125
- color: var(--ew-on-surface);
126
- margin: 0;
127
- line-height: var(--ew-leading-loose);
128
- }
129
-
130
- .ew-feature-highlight__cta {
131
- align-self: flex-start;
132
- display: inline-block;
133
- background: var(--ew-primary);
134
- color: var(--ew-on-primary);
135
- padding: var(--ew-space-2) var(--ew-space-5);
136
- border-radius: var(--ew-radius-md);
137
- text-decoration: none;
138
- font-family: var(--ew-font-sans);
139
- font-weight: 600;
140
- font-size: var(--ew-text-base);
141
- margin-top: var(--ew-space-2);
142
- transition: transform 0.15s ease, box-shadow 0.15s ease;
143
- }
144
- .ew-feature-highlight__cta:hover,
145
- .ew-feature-highlight__cta:focus-visible {
146
- transform: translateY(-1px);
147
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
148
- }
149
- .ew-feature-highlight__cta:focus-visible {
150
- outline: 2px solid var(--ew-primary);
151
- outline-offset: 2px;
152
- }
153
- </style>
13
+ <GalleryFeatureHighlight {...props} />