maverick-wave-astro 1.0.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/README.md +83 -0
- package/bin/check.mjs +53 -0
- package/components/Accordion.astro +47 -0
- package/components/Address.astro +36 -0
- package/components/Announcement.astro +27 -0
- package/components/Avatar.astro +34 -0
- package/components/BaseLayout.astro +142 -0
- package/components/BlogPost.astro +144 -0
- package/components/Breadcrumbs.astro +69 -0
- package/components/Calendar.astro +104 -0
- package/components/CalendarLegend.astro +34 -0
- package/components/ComingSoon.astro +21 -0
- package/components/DateStamp.astro +24 -0
- package/components/EmptyState.astro +24 -0
- package/components/Favicons.astro +42 -0
- package/components/Feed.astro +85 -0
- package/components/Footer.astro +162 -0
- package/components/Gallery.astro +55 -0
- package/components/Header.astro +107 -0
- package/components/Hero.astro +158 -0
- package/components/Icon.astro +27 -0
- package/components/IconCard.astro +36 -0
- package/components/ImageSlider.astro +64 -0
- package/components/ImprintCard.astro +52 -0
- package/components/JsonLd.astro +11 -0
- package/components/LanguageSwitch.astro +53 -0
- package/components/LegalPage.astro +19 -0
- package/components/Media.astro +40 -0
- package/components/MetaInfo.astro +24 -0
- package/components/Modal.astro +47 -0
- package/components/Mosaic.astro +38 -0
- package/components/NotFound.astro +34 -0
- package/components/Offer.astro +79 -0
- package/components/OpeningHours.astro +14 -0
- package/components/PageHeader.astro +38 -0
- package/components/Picture.astro +50 -0
- package/components/PortraitGallery.astro +68 -0
- package/components/PostalAddress.astro +20 -0
- package/components/Price.astro +84 -0
- package/components/PrivacyCard.astro +65 -0
- package/components/Progress.astro +53 -0
- package/components/PromoBar.astro +25 -0
- package/components/Schedule.astro +60 -0
- package/components/SectionHead.astro +18 -0
- package/components/SocialLinks.astro +47 -0
- package/components/Stepper.astro +76 -0
- package/components/Stories.astro +80 -0
- package/components/TabPanel.astro +15 -0
- package/components/Table.astro +115 -0
- package/components/Tabs.astro +38 -0
- package/components/Testimonial.astro +61 -0
- package/components/ThemeToggle.astro +30 -0
- package/components/Tiles.astro +63 -0
- package/components/Timeline.astro +64 -0
- package/components/ValueList.astro +42 -0
- package/config/eslint.js +58 -0
- package/config/prettier.mjs +30 -0
- package/dist/config.d.ts +3 -0
- package/dist/config.js +6 -0
- package/dist/contact.d.ts +2 -0
- package/dist/contact.js +8 -0
- package/dist/date.d.ts +26 -0
- package/dist/date.js +72 -0
- package/dist/design.d.ts +166 -0
- package/dist/design.js +175 -0
- package/dist/icons.d.ts +13 -0
- package/dist/icons.js +15 -0
- package/dist/image-size.d.ts +10 -0
- package/dist/image-size.js +70 -0
- package/dist/integration.d.ts +13 -0
- package/dist/integration.js +90 -0
- package/dist/path.d.ts +1 -0
- package/dist/path.js +5 -0
- package/dist/schedule.d.ts +30 -0
- package/dist/schedule.js +117 -0
- package/dist/social.d.ts +35 -0
- package/dist/social.js +37 -0
- package/dist/structured-data.d.ts +1 -0
- package/dist/structured-data.js +2 -0
- package/dist/text.d.ts +3 -0
- package/dist/text.js +30 -0
- package/dist/types.d.ts +35 -0
- package/dist/types.js +1 -0
- package/dist/uploads.d.ts +7 -0
- package/dist/uploads.js +64 -0
- package/package.json +75 -0
- package/routes/design.css.ts +7 -0
- package/routes/theme.js.ts +28 -0
- package/routes/virtual.d.ts +6 -0
- package/schemas/design.schema.json +214 -0
- package/schemas/promo.schema.json +37 -0
- package/styles/schedule.css +17 -0
- package/styles/table.css +8 -0
- package/styles/theme-toggle.css +13 -0
package/dist/schedule.js
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
// The build picks events and promotions, the browser checks them again
|
|
2
|
+
// (components/Schedule.astro) - so both disappear on time instead of with the
|
|
3
|
+
// next build. All calculations run in local time, so the build needs
|
|
4
|
+
// TZ=Europe/Berlin.
|
|
5
|
+
// End of the given day, because an event is valid until its day is over.
|
|
6
|
+
export const endOfDay = (date) => {
|
|
7
|
+
const day = new Date(`${date}T23:59:59`);
|
|
8
|
+
return Number.isNaN(day.getTime()) ? null : day;
|
|
9
|
+
};
|
|
10
|
+
// Neither an event nor a promotion should vanish shortly after midnight, but
|
|
11
|
+
// during the next morning. The date in the text stays the last day.
|
|
12
|
+
export const GRACE_HOURS = 12;
|
|
13
|
+
export const visibleUntil = (date) => {
|
|
14
|
+
const day = endOfDay(date);
|
|
15
|
+
if (!day)
|
|
16
|
+
return null;
|
|
17
|
+
day.setHours(day.getHours() + GRACE_HOURS);
|
|
18
|
+
return day;
|
|
19
|
+
};
|
|
20
|
+
// Free text instead of a date stays - an unusual format beats a swallowed
|
|
21
|
+
// event.
|
|
22
|
+
export const upcomingEvents = (entries, now = new Date()) => entries
|
|
23
|
+
.filter(entry => {
|
|
24
|
+
const end = visibleUntil(entry.date);
|
|
25
|
+
return !end || now <= end;
|
|
26
|
+
})
|
|
27
|
+
.sort((a, b) => a.date.localeCompare(b.date));
|
|
28
|
+
// Value for data-expires: the moment the event is gone. Empty means free text
|
|
29
|
+
// instead of a date - that never expires.
|
|
30
|
+
export const eventExpiry = (entry) => {
|
|
31
|
+
const end = visibleUntil(entry.date);
|
|
32
|
+
return end ? end.toISOString() : '';
|
|
33
|
+
};
|
|
34
|
+
export const eventDateText = (entry, locale = 'de-DE') => {
|
|
35
|
+
const day = endOfDay(entry.date);
|
|
36
|
+
if (!day)
|
|
37
|
+
return entry.date;
|
|
38
|
+
return day.toLocaleDateString(locale, {
|
|
39
|
+
weekday: 'short',
|
|
40
|
+
day: 'numeric',
|
|
41
|
+
month: 'long',
|
|
42
|
+
year: 'numeric',
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
// A planned promotion is in the HTML before its first day already - only the
|
|
46
|
+
// script makes it visible.
|
|
47
|
+
export const promoInHtml = (promo, now = new Date()) => {
|
|
48
|
+
const percent = Number(promo?.percent);
|
|
49
|
+
if (!promo || !Number.isFinite(percent) || percent <= 0)
|
|
50
|
+
return false;
|
|
51
|
+
if (promo.until) {
|
|
52
|
+
const end = visibleUntil(promo.until);
|
|
53
|
+
if (!end || now > end)
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
return true;
|
|
57
|
+
};
|
|
58
|
+
// Value for data-promo-until on <html>: the moment the promotion is gone.
|
|
59
|
+
// Empty means open-ended, null means no promotion - then there is nothing in
|
|
60
|
+
// the HTML to hide either.
|
|
61
|
+
export const promoExpiry = (promo, now = new Date()) => {
|
|
62
|
+
if (!promoInHtml(promo, now))
|
|
63
|
+
return null;
|
|
64
|
+
const end = promo.until ? visibleUntil(promo.until) : null;
|
|
65
|
+
return end ? end.toISOString() : '';
|
|
66
|
+
};
|
|
67
|
+
// Value for data-promo-from on <html>: the moment the promotion starts. Null
|
|
68
|
+
// means it applies right away, or there is none.
|
|
69
|
+
export const promoStart = (promo, now = new Date()) => {
|
|
70
|
+
if (!promoInHtml(promo, now) || !promo.from)
|
|
71
|
+
return null;
|
|
72
|
+
const start = new Date(`${promo.from}T00:00:00`);
|
|
73
|
+
return Number.isNaN(start.getTime()) ? null : start.toISOString();
|
|
74
|
+
};
|
|
75
|
+
// Thin space between number and percent sign, as typesetting wants it.
|
|
76
|
+
export const discountText = (promo) => `-${Number(promo.percent)}\u2009%`;
|
|
77
|
+
// Always rounded down: rounding up would give customers less than the
|
|
78
|
+
// promised percentage.
|
|
79
|
+
export const discountedPrice = (promo, amount) => Math.floor(amount * (1 - Number(promo.percent) / 100));
|
|
80
|
+
// Last day of the promotion, formatted. Null means open-ended.
|
|
81
|
+
export const promoEndDate = (promo, locale = 'de-DE') => {
|
|
82
|
+
const end = promo.until ? endOfDay(promo.until) : null;
|
|
83
|
+
return end
|
|
84
|
+
? end.toLocaleDateString(locale, {
|
|
85
|
+
day: '2-digit',
|
|
86
|
+
month: '2-digit',
|
|
87
|
+
year: 'numeric',
|
|
88
|
+
})
|
|
89
|
+
: null;
|
|
90
|
+
};
|
|
91
|
+
export const promoText = (promo, { locale = 'de-DE', untilWord = 'bis' } = {}) => {
|
|
92
|
+
const date = promoEndDate(promo, locale);
|
|
93
|
+
return date ? `${promo.text} ${untilWord} ${date}` : promo.text;
|
|
94
|
+
};
|
|
95
|
+
// Google wants the time with its offset, otherwise it guesses.
|
|
96
|
+
const offset = (date) => {
|
|
97
|
+
const zone = new Intl.DateTimeFormat('en-US', {
|
|
98
|
+
timeZone: 'Europe/Berlin',
|
|
99
|
+
timeZoneName: 'longOffset',
|
|
100
|
+
})
|
|
101
|
+
.formatToParts(new Date(`${date}T12:00:00Z`))
|
|
102
|
+
.find(part => part.type === 'timeZoneName')?.value;
|
|
103
|
+
return zone && zone !== 'GMT' ? zone.replace('GMT', '') : '+00:00';
|
|
104
|
+
};
|
|
105
|
+
// The time is free text - the first two "HH:MM" in it are used.
|
|
106
|
+
export const eventTimeRange = (entry) => {
|
|
107
|
+
if (!endOfDay(entry.date))
|
|
108
|
+
return null;
|
|
109
|
+
const times = [...(entry.time ?? '').matchAll(/(\d{1,2}):(\d{2})/g)].map(([, hour, minute]) => `${hour.padStart(2, '0')}:${minute}`);
|
|
110
|
+
if (times.length === 0)
|
|
111
|
+
return { start: entry.date, end: null };
|
|
112
|
+
const zone = offset(entry.date);
|
|
113
|
+
return {
|
|
114
|
+
start: `${entry.date}T${times[0]}:00${zone}`,
|
|
115
|
+
end: times[1] ? `${entry.date}T${times[1]}:00${zone}` : null,
|
|
116
|
+
};
|
|
117
|
+
};
|
package/dist/social.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export declare const SOCIAL_ICONS: {
|
|
2
|
+
readonly instagram: {
|
|
3
|
+
readonly viewBox: "0 0 448 512";
|
|
4
|
+
readonly body: "<path d=\"M224.1 141c-63.6 0-114.9 51.3-114.9 114.9s51.3 114.9 114.9 114.9S339 319.5 339 255.9 287.7 141 224.1 141zm0 189.6c-41.1 0-74.7-33.5-74.7-74.7s33.5-74.7 74.7-74.7 74.7 33.5 74.7 74.7-33.6 74.7-74.7 74.7zm146.4-194.3c0 14.9-12 26.8-26.8 26.8-14.9 0-26.8-12-26.8-26.8s12-26.8 26.8-26.8 26.8 12 26.8 26.8zm76.1 27.2c-1.7-35.9-9.9-67.7-36.2-93.9-26.2-26.2-58-34.4-93.9-36.2-37-2.1-147.9-2.1-184.9 0-35.8 1.7-67.6 9.9-93.9 36.1s-34.4 58-36.2 93.9c-2.1 37-2.1 147.9 0 184.9 1.7 35.9 9.9 67.7 36.2 93.9s58 34.4 93.9 36.2c37 2.1 147.9 2.1 184.9 0 35.9-1.7 67.7-9.9 93.9-36.2 26.2-26.2 34.4-58 36.2-93.9 2.1-37 2.1-147.8 0-184.8zM398.8 388c-7.8 19.6-22.9 34.7-42.6 42.6-29.5 11.7-99.5 9-132.1 9s-102.7 2.6-132.1-9c-19.6-7.8-34.7-22.9-42.6-42.6-11.7-29.5-9-99.5-9-132.1s-2.6-102.7 9-132.1c7.8-19.6 22.9-34.7 42.6-42.6 29.5-11.7 99.5-9 132.1-9s102.7-2.6 132.1 9c19.6 7.8 34.7 22.9 42.6 42.6 11.7 29.5 9 99.5 9 132.1s2.7 102.7-9 132.1z\"/>";
|
|
5
|
+
};
|
|
6
|
+
readonly github: {
|
|
7
|
+
readonly viewBox: "0 0 496 512";
|
|
8
|
+
readonly body: "<path d=\"M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z\"/>";
|
|
9
|
+
};
|
|
10
|
+
readonly linkedin: {
|
|
11
|
+
readonly viewBox: "0 0 448 512";
|
|
12
|
+
readonly body: "<path d=\"M416 32H31.9C14.3 32 0 46.5 0 64.3v383.4C0 465.5 14.3 480 31.9 480H416c17.6 0 32-14.5 32-32.3V64.3c0-17.8-14.4-32.3-32-32.3zM135.4 416H69V202.2h66.5V416zm-33.2-243c-21.3 0-38.5-17.3-38.5-38.5S80.9 96 102.2 96c21.2 0 38.5 17.3 38.5 38.5 0 21.3-17.2 38.5-38.5 38.5zm282.1 243h-66.4V312c0-24.8-.5-56.7-34.5-56.7-34.6 0-39.9 27-39.9 54.9V416h-66.4V202.2h63.7v29.2h.9c8.9-16.8 30.6-34.5 62.9-34.5 67.2 0 79.7 44.3 79.7 101.9V416z\"/>";
|
|
13
|
+
};
|
|
14
|
+
readonly xing: {
|
|
15
|
+
readonly viewBox: "0 0 384 512";
|
|
16
|
+
readonly body: "<path d=\"M162.7 210c-1.8 3.3-25.2 44.4-70.1 123.5-4.9 8.3-10.8 12.5-17.7 12.5H9.8c-7.7 0-12.1-7.5-8.5-14.4l69-121.3c.2 0 .2-.1 0-.3l-43.9-75.6c-4.3-7.8.3-14.1 8.5-14.1H100c7.3 0 13.3 4.1 18 12.2l44.7 77.5zM382.6 46.1l-144 253v.3L330.2 466c3.9 7.1.2 14.1-8.5 14.1h-65.2c-7.6 0-13.6-4-18-12.2l-92.4-168.5c3.3-5.8 51.5-90.8 144.8-255.2 4.6-8.1 10.4-12.2 17.5-12.2h65.7c8 0 12.3 6.7 8.5 14.1z\"/>";
|
|
17
|
+
};
|
|
18
|
+
readonly devto: {
|
|
19
|
+
readonly viewBox: "0 0 448 512";
|
|
20
|
+
readonly body: "<path d=\"M120.12 208.29c-3.88-2.9-7.77-4.35-11.65-4.35H91.03v104.47h17.45c3.88 0 7.77-1.45 11.65-4.35 3.88-2.9 5.82-7.25 5.82-13.06v-69.65c-.01-5.8-1.96-10.16-5.83-13.06zM404.1 32H43.9C19.7 32 .06 51.59 0 75.8v360.4C.06 460.41 19.7 480 43.9 480h360.2c24.21 0 43.84-19.59 43.9-43.8V75.8c-.06-24.21-19.7-43.8-43.9-43.8zM154.2 291.19c0 18.81-11.61 47.31-48.36 47.25h-46.4V172.98h47.38c35.44 0 47.36 28.46 47.37 47.28l.01 70.93zm100.68-88.66H201.6v38.42h32.57v29.57H201.6v38.41h53.29v29.57h-62.18c-11.16.29-20.44-8.53-20.72-19.69V193.7c-.27-11.15 8.56-20.41 19.71-20.69h63.19l-.01 29.52zm103.64 115.29c-13.2 30.75-36.85 24.63-47.44 0l-38.53-144.8h32.57l29.71 113.72 29.57-113.72h32.58l-38.46 144.8z\"/>";
|
|
21
|
+
};
|
|
22
|
+
readonly mail: {
|
|
23
|
+
readonly viewBox: "0 0 512 512";
|
|
24
|
+
readonly body: "<path d=\"M48 64C21.5 64 0 85.5 0 112c0 15.1 7.1 29.3 19.2 38.4L236.8 313.6c11.4 8.5 27 8.5 38.4 0L492.8 150.4c12.1-9.1 19.2-23.3 19.2-38.4c0-26.5-21.5-48-48-48L48 64zM0 176L0 384c0 35.3 28.7 64 64 64l384 0c35.3 0 64-28.7 64-64l0-208L294.4 339.2c-22.8 17.1-54 17.1-76.8 0L0 176z\"/>";
|
|
25
|
+
};
|
|
26
|
+
readonly phone: {
|
|
27
|
+
readonly viewBox: "0 0 512 512";
|
|
28
|
+
readonly body: "<path d=\"M164.9 24.6c-7.7-18.6-28-28.5-47.4-23.2l-88 24C12.1 30.2 0 46 0 64C0 311.4 200.6 512 448 512c18 0 33.8-12.1 38.6-29.5l24-88c5.3-19.4-4.6-39.7-23.2-47.4l-96-40c-16.3-6.8-35.2-2.1-46.3 11.6L304.7 368C234.3 334.7 177.3 277.7 144 207.3L193.3 167c13.7-11.2 18.4-30 11.6-46.3l-40-96z\"/>";
|
|
29
|
+
};
|
|
30
|
+
readonly dailydev: {
|
|
31
|
+
readonly viewBox: "3 10 34 20";
|
|
32
|
+
readonly body: "<g transform=\"translate(4 11)\"><path opacity=\".56\" transform=\"translate(21 .93)\" d=\"M6.47910463,8.01371418 L2.94663391,4.48124347 L4.71194884,0.95 L10.4515234,6.68957458 C11.1828255,7.42087669 11.1828255,8.60655167 10.4515234,9.33785378 L3.38719562,16.4021816 C2.65589351,17.1334837 1.47021853,17.1334837 0.738916421,16.4021816 C0.00761431424,15.6708795 0.00761431424,14.4852045 0.738916421,13.7539024 L6.47910463,8.01371418 Z\"/><path d=\"M21.7402327,0.548323198 C22.4715349,-0.182978908 23.6575166,-0.182672097 24.3888188,0.54863001 L25.7132652,1.87307642 L10.2610836,17.325258 C9.52978147,18.0565601 8.34379968,18.0562533 7.61249757,17.3249512 L6.28805116,16.0005048 L21.7402327,0.548323198 Z M15.1176939,5.40493351 L12.4688011,8.05382633 L8.93633036,4.52135561 L4.52089537,8.9367906 L8.05336609,12.4692613 L6.28805116,16.0005048 L0.54847658,10.2609302 C-0.182825527,9.52962809 -0.182825527,8.34395311 0.54847658,7.612651 L7.61249757,0.54863001 C8.34379968,-0.182672097 9.52978147,-0.182978908 10.2610836,0.548323198 L15.1176939,5.40493351 Z\"/></g>";
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
export type SocialType = keyof typeof SOCIAL_ICONS;
|
package/dist/social.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Filled brand and contact icons for the footer, so every site shows the same
|
|
2
|
+
// set. Paths from Font Awesome Free 6.7.2 (icons CC BY 4.0,
|
|
3
|
+
// https://fontawesome.com/license/free), daily.dev as used on m1well.com.
|
|
4
|
+
export const SOCIAL_ICONS = {
|
|
5
|
+
instagram: {
|
|
6
|
+
viewBox: '0 0 448 512',
|
|
7
|
+
body: '<path d="M224.1 141c-63.6 0-114.9 51.3-114.9 114.9s51.3 114.9 114.9 114.9S339 319.5 339 255.9 287.7 141 224.1 141zm0 189.6c-41.1 0-74.7-33.5-74.7-74.7s33.5-74.7 74.7-74.7 74.7 33.5 74.7 74.7-33.6 74.7-74.7 74.7zm146.4-194.3c0 14.9-12 26.8-26.8 26.8-14.9 0-26.8-12-26.8-26.8s12-26.8 26.8-26.8 26.8 12 26.8 26.8zm76.1 27.2c-1.7-35.9-9.9-67.7-36.2-93.9-26.2-26.2-58-34.4-93.9-36.2-37-2.1-147.9-2.1-184.9 0-35.8 1.7-67.6 9.9-93.9 36.1s-34.4 58-36.2 93.9c-2.1 37-2.1 147.9 0 184.9 1.7 35.9 9.9 67.7 36.2 93.9s58 34.4 93.9 36.2c37 2.1 147.9 2.1 184.9 0 35.9-1.7 67.7-9.9 93.9-36.2 26.2-26.2 34.4-58 36.2-93.9 2.1-37 2.1-147.8 0-184.8zM398.8 388c-7.8 19.6-22.9 34.7-42.6 42.6-29.5 11.7-99.5 9-132.1 9s-102.7 2.6-132.1-9c-19.6-7.8-34.7-22.9-42.6-42.6-11.7-29.5-9-99.5-9-132.1s-2.6-102.7 9-132.1c7.8-19.6 22.9-34.7 42.6-42.6 29.5-11.7 99.5-9 132.1-9s102.7-2.6 132.1 9c19.6 7.8 34.7 22.9 42.6 42.6 11.7 29.5 9 99.5 9 132.1s2.7 102.7-9 132.1z"/>',
|
|
8
|
+
},
|
|
9
|
+
github: {
|
|
10
|
+
viewBox: '0 0 496 512',
|
|
11
|
+
body: '<path d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"/>',
|
|
12
|
+
},
|
|
13
|
+
linkedin: {
|
|
14
|
+
viewBox: '0 0 448 512',
|
|
15
|
+
body: '<path d="M416 32H31.9C14.3 32 0 46.5 0 64.3v383.4C0 465.5 14.3 480 31.9 480H416c17.6 0 32-14.5 32-32.3V64.3c0-17.8-14.4-32.3-32-32.3zM135.4 416H69V202.2h66.5V416zm-33.2-243c-21.3 0-38.5-17.3-38.5-38.5S80.9 96 102.2 96c21.2 0 38.5 17.3 38.5 38.5 0 21.3-17.2 38.5-38.5 38.5zm282.1 243h-66.4V312c0-24.8-.5-56.7-34.5-56.7-34.6 0-39.9 27-39.9 54.9V416h-66.4V202.2h63.7v29.2h.9c8.9-16.8 30.6-34.5 62.9-34.5 67.2 0 79.7 44.3 79.7 101.9V416z"/>',
|
|
16
|
+
},
|
|
17
|
+
xing: {
|
|
18
|
+
viewBox: '0 0 384 512',
|
|
19
|
+
body: '<path d="M162.7 210c-1.8 3.3-25.2 44.4-70.1 123.5-4.9 8.3-10.8 12.5-17.7 12.5H9.8c-7.7 0-12.1-7.5-8.5-14.4l69-121.3c.2 0 .2-.1 0-.3l-43.9-75.6c-4.3-7.8.3-14.1 8.5-14.1H100c7.3 0 13.3 4.1 18 12.2l44.7 77.5zM382.6 46.1l-144 253v.3L330.2 466c3.9 7.1.2 14.1-8.5 14.1h-65.2c-7.6 0-13.6-4-18-12.2l-92.4-168.5c3.3-5.8 51.5-90.8 144.8-255.2 4.6-8.1 10.4-12.2 17.5-12.2h65.7c8 0 12.3 6.7 8.5 14.1z"/>',
|
|
20
|
+
},
|
|
21
|
+
devto: {
|
|
22
|
+
viewBox: '0 0 448 512',
|
|
23
|
+
body: '<path d="M120.12 208.29c-3.88-2.9-7.77-4.35-11.65-4.35H91.03v104.47h17.45c3.88 0 7.77-1.45 11.65-4.35 3.88-2.9 5.82-7.25 5.82-13.06v-69.65c-.01-5.8-1.96-10.16-5.83-13.06zM404.1 32H43.9C19.7 32 .06 51.59 0 75.8v360.4C.06 460.41 19.7 480 43.9 480h360.2c24.21 0 43.84-19.59 43.9-43.8V75.8c-.06-24.21-19.7-43.8-43.9-43.8zM154.2 291.19c0 18.81-11.61 47.31-48.36 47.25h-46.4V172.98h47.38c35.44 0 47.36 28.46 47.37 47.28l.01 70.93zm100.68-88.66H201.6v38.42h32.57v29.57H201.6v38.41h53.29v29.57h-62.18c-11.16.29-20.44-8.53-20.72-19.69V193.7c-.27-11.15 8.56-20.41 19.71-20.69h63.19l-.01 29.52zm103.64 115.29c-13.2 30.75-36.85 24.63-47.44 0l-38.53-144.8h32.57l29.71 113.72 29.57-113.72h32.58l-38.46 144.8z"/>',
|
|
24
|
+
},
|
|
25
|
+
mail: {
|
|
26
|
+
viewBox: '0 0 512 512',
|
|
27
|
+
body: '<path d="M48 64C21.5 64 0 85.5 0 112c0 15.1 7.1 29.3 19.2 38.4L236.8 313.6c11.4 8.5 27 8.5 38.4 0L492.8 150.4c12.1-9.1 19.2-23.3 19.2-38.4c0-26.5-21.5-48-48-48L48 64zM0 176L0 384c0 35.3 28.7 64 64 64l384 0c35.3 0 64-28.7 64-64l0-208L294.4 339.2c-22.8 17.1-54 17.1-76.8 0L0 176z"/>',
|
|
28
|
+
},
|
|
29
|
+
phone: {
|
|
30
|
+
viewBox: '0 0 512 512',
|
|
31
|
+
body: '<path d="M164.9 24.6c-7.7-18.6-28-28.5-47.4-23.2l-88 24C12.1 30.2 0 46 0 64C0 311.4 200.6 512 448 512c18 0 33.8-12.1 38.6-29.5l24-88c5.3-19.4-4.6-39.7-23.2-47.4l-96-40c-16.3-6.8-35.2-2.1-46.3 11.6L304.7 368C234.3 334.7 177.3 277.7 144 207.3L193.3 167c13.7-11.2 18.4-30 11.6-46.3l-40-96z"/>',
|
|
32
|
+
},
|
|
33
|
+
dailydev: {
|
|
34
|
+
viewBox: '3 10 34 20',
|
|
35
|
+
body: '<g transform="translate(4 11)"><path opacity=".56" transform="translate(21 .93)" d="M6.47910463,8.01371418 L2.94663391,4.48124347 L4.71194884,0.95 L10.4515234,6.68957458 C11.1828255,7.42087669 11.1828255,8.60655167 10.4515234,9.33785378 L3.38719562,16.4021816 C2.65589351,17.1334837 1.47021853,17.1334837 0.738916421,16.4021816 C0.00761431424,15.6708795 0.00761431424,14.4852045 0.738916421,13.7539024 L6.47910463,8.01371418 Z"/><path d="M21.7402327,0.548323198 C22.4715349,-0.182978908 23.6575166,-0.182672097 24.3888188,0.54863001 L25.7132652,1.87307642 L10.2610836,17.325258 C9.52978147,18.0565601 8.34379968,18.0562533 7.61249757,17.3249512 L6.28805116,16.0005048 L21.7402327,0.548323198 Z M15.1176939,5.40493351 L12.4688011,8.05382633 L8.93633036,4.52135561 L4.52089537,8.9367906 L8.05336609,12.4692613 L6.28805116,16.0005048 L0.54847658,10.2609302 C-0.182825527,9.52962809 -0.182825527,8.34395311 0.54847658,7.612651 L7.61249757,0.54863001 C8.34379968,-0.182672097 9.52978147,-0.182978908 10.2610836,0.548323198 L15.1176939,5.40493351 Z"/></g>',
|
|
36
|
+
},
|
|
37
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const jsonLdText: (data: unknown) => string;
|
package/dist/text.d.ts
ADDED
package/dist/text.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Content marks single phrases with **...** - markdown() below is for a whole
|
|
2
|
+
// contentmanager field.
|
|
3
|
+
const escape = (value) => value.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
|
4
|
+
export const emphasize = (value) => escape(value).replace(/\*\*(.+?)\*\*/g, '<strong>$1</strong>');
|
|
5
|
+
// A customer typing "javascript:" as a link target gets plain text.
|
|
6
|
+
const SAFE_LINK = /^(https?:\/\/|mailto:|tel:)/;
|
|
7
|
+
const inline = (value) => escape(value)
|
|
8
|
+
.replace(/\[([^\]]+)\]\(([^)\s]+)\)/g, (_, text, href) => SAFE_LINK.test(href)
|
|
9
|
+
? `<a href="${href.replace(/"/g, '"')}">${text}</a>`
|
|
10
|
+
: text)
|
|
11
|
+
.replace(/\*\*(.+?)\*\*/g, '<strong>$1</strong>')
|
|
12
|
+
.replace(/(^|[^*])\*([^*\s](?:[^*]*[^*\s])?)\*/g, '$1<em>$2</em>')
|
|
13
|
+
.replace(/\n/g, '<br>');
|
|
14
|
+
export const markdown = (value) => (value ?? '')
|
|
15
|
+
.replace(/\r\n/g, '\n')
|
|
16
|
+
.split(/\n\s*\n/)
|
|
17
|
+
.map(block => block.trim())
|
|
18
|
+
.filter(Boolean)
|
|
19
|
+
.map(block => {
|
|
20
|
+
const lines = block.split('\n');
|
|
21
|
+
return lines.every(line => line.startsWith('- '))
|
|
22
|
+
? `<ul>${lines.map(line => `<li>${inline(line.slice(2))}</li>`).join('')}</ul>`
|
|
23
|
+
: `<p>${inline(block)}</p>`;
|
|
24
|
+
})
|
|
25
|
+
.join('');
|
|
26
|
+
const WORDS_PER_MINUTE = 190;
|
|
27
|
+
export const readingTime = (body) => {
|
|
28
|
+
const words = (body ?? '').trim().split(/\s+/).length;
|
|
29
|
+
return Math.max(1, Math.round(words / WORDS_PER_MINUTE));
|
|
30
|
+
};
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Design } from './design.ts';
|
|
2
|
+
export type Site = {
|
|
3
|
+
name: string;
|
|
4
|
+
lang?: string;
|
|
5
|
+
locale?: string;
|
|
6
|
+
themeColor: string;
|
|
7
|
+
bodyClass?: string;
|
|
8
|
+
preloadFonts?: readonly string[];
|
|
9
|
+
externalStylesheets?: readonly string[];
|
|
10
|
+
favicons?: 'set' | 'svg';
|
|
11
|
+
hasSvgFavicon?: boolean;
|
|
12
|
+
colorScheme?: 'dark' | 'light';
|
|
13
|
+
noIndex?: boolean;
|
|
14
|
+
counter?: boolean;
|
|
15
|
+
themeToggle?: 'system' | 'dark';
|
|
16
|
+
mwScript?: boolean;
|
|
17
|
+
design?: Design | string;
|
|
18
|
+
};
|
|
19
|
+
export type OgImage = {
|
|
20
|
+
path: string;
|
|
21
|
+
type: string;
|
|
22
|
+
width: number;
|
|
23
|
+
height: number;
|
|
24
|
+
alt?: string;
|
|
25
|
+
};
|
|
26
|
+
export type Config = {
|
|
27
|
+
site: Site & {
|
|
28
|
+
lang: string;
|
|
29
|
+
locale: string;
|
|
30
|
+
};
|
|
31
|
+
ogImage: OgImage;
|
|
32
|
+
design: Design;
|
|
33
|
+
htmlClasses: string[];
|
|
34
|
+
designCss: string;
|
|
35
|
+
};
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const UPLOAD_WIDTHS: readonly [260, 500, 1000, 1600];
|
|
2
|
+
/** Existing sizes are kept, so a rebuild costs nothing. */
|
|
3
|
+
export declare const prepareUploads: (publicDir: string) => Promise<{
|
|
4
|
+
written: number;
|
|
5
|
+
skipped: string[];
|
|
6
|
+
}>;
|
|
7
|
+
export declare const removeOriginals: (outDir: string) => void;
|
package/dist/uploads.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { existsSync, readdirSync, rmSync } from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
// The contentmanager stores only the original, the build derives what Picture asks for.
|
|
4
|
+
export const UPLOAD_WIDTHS = [260, 500, 1000, 1600];
|
|
5
|
+
const ORIGINAL = /^([0-9a-f]{16})\.(jpg|png|webp)$/;
|
|
6
|
+
const TYPES = ['webp', 'jpg'];
|
|
7
|
+
const uploadsDir = (root) => path.join(root, 'images', 'uploads');
|
|
8
|
+
const missingVariants = (dir) => readdirSync(dir).flatMap(file => {
|
|
9
|
+
const name = ORIGINAL.exec(file)?.[1];
|
|
10
|
+
if (!name)
|
|
11
|
+
return [];
|
|
12
|
+
return UPLOAD_WIDTHS.flatMap(width => TYPES.map(type => ({
|
|
13
|
+
source: path.join(dir, file),
|
|
14
|
+
target: path.join(dir, `${name}-${width}.${type}`),
|
|
15
|
+
width,
|
|
16
|
+
type,
|
|
17
|
+
}))).filter(variant => !existsSync(variant.target));
|
|
18
|
+
});
|
|
19
|
+
/** Existing sizes are kept, so a rebuild costs nothing. */
|
|
20
|
+
export const prepareUploads = async (publicDir) => {
|
|
21
|
+
const dir = uploadsDir(publicDir);
|
|
22
|
+
if (!existsSync(dir))
|
|
23
|
+
return { written: 0, skipped: [] };
|
|
24
|
+
const missing = missingVariants(dir);
|
|
25
|
+
if (missing.length === 0)
|
|
26
|
+
return { written: 0, skipped: [] };
|
|
27
|
+
// Loaded only on demand: sites without uploads never touch sharp.
|
|
28
|
+
const { default: sharp } = await import('sharp');
|
|
29
|
+
let written = 0;
|
|
30
|
+
const skipped = new Set();
|
|
31
|
+
for (const variant of missing) {
|
|
32
|
+
if (skipped.has(variant.source))
|
|
33
|
+
continue;
|
|
34
|
+
try {
|
|
35
|
+
// rotate() applies the EXIF orientation, phone photos arrive sideways otherwise.
|
|
36
|
+
const image = sharp(variant.source)
|
|
37
|
+
.rotate()
|
|
38
|
+
.resize({ width: variant.width, withoutEnlargement: true });
|
|
39
|
+
const encoded = variant.type === 'webp'
|
|
40
|
+
? image.webp({ quality: 80 })
|
|
41
|
+
: image.jpeg({ quality: 82, mozjpeg: true });
|
|
42
|
+
await encoded.toFile(variant.target);
|
|
43
|
+
written++;
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
// One broken upload must not stop every build of the site - it just gets no sizes.
|
|
47
|
+
skipped.add(variant.source);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
written,
|
|
52
|
+
skipped: [...skipped].map(source => path.basename(source)),
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
// Nothing links an original, and it still carries the camera's EXIF including GPS.
|
|
56
|
+
export const removeOriginals = (outDir) => {
|
|
57
|
+
const dir = uploadsDir(outDir);
|
|
58
|
+
if (!existsSync(dir))
|
|
59
|
+
return;
|
|
60
|
+
for (const file of readdirSync(dir)) {
|
|
61
|
+
if (ORIGINAL.test(file))
|
|
62
|
+
rmSync(path.join(dir, file));
|
|
63
|
+
}
|
|
64
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "maverick-wave-astro",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Shared frame for static Astro homepages built with MaverickWave: layout, SEO, design variants, schedule, building blocks.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": "m1well",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"astro",
|
|
10
|
+
"astro-component",
|
|
11
|
+
"astro-integration",
|
|
12
|
+
"maverick-wave"
|
|
13
|
+
],
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/integration.d.ts",
|
|
17
|
+
"default": "./dist/integration.js"
|
|
18
|
+
},
|
|
19
|
+
"./eslint": "./config/eslint.js",
|
|
20
|
+
"./prettier": "./config/prettier.mjs",
|
|
21
|
+
"./schemas/*": "./schemas/*",
|
|
22
|
+
"./*.astro": "./components/*.astro",
|
|
23
|
+
"./*": {
|
|
24
|
+
"types": "./dist/*.d.ts",
|
|
25
|
+
"default": "./dist/*.js"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist",
|
|
30
|
+
"components",
|
|
31
|
+
"config",
|
|
32
|
+
"routes",
|
|
33
|
+
"schemas",
|
|
34
|
+
"styles",
|
|
35
|
+
"bin"
|
|
36
|
+
],
|
|
37
|
+
"bin": {
|
|
38
|
+
"mwa-check": "./bin/check.mjs"
|
|
39
|
+
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "rm -rf dist && tsc -p tsconfig.build.json",
|
|
42
|
+
"test": "TZ=Europe/Berlin node --test 'test/**/*.test.ts'",
|
|
43
|
+
"check": "tsc -p tsconfig.json --noEmit",
|
|
44
|
+
"lint": "eslint .",
|
|
45
|
+
"format": "prettier --check .",
|
|
46
|
+
"format:fix": "prettier --write .",
|
|
47
|
+
"prepack": "npm run build"
|
|
48
|
+
},
|
|
49
|
+
"engines": {
|
|
50
|
+
"node": ">=22.18"
|
|
51
|
+
},
|
|
52
|
+
"peerDependencies": {
|
|
53
|
+
"astro": "^7.2.0",
|
|
54
|
+
"maverick-wave": "^5.33.0"
|
|
55
|
+
},
|
|
56
|
+
"dependencies": {
|
|
57
|
+
"@astrojs/sitemap": "^3.7.3",
|
|
58
|
+
"ajv": "^8.20.0",
|
|
59
|
+
"ajv-formats": "^3.0.1"
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@eslint/js": "^9.39.1",
|
|
63
|
+
"@types/node": "^24.13.6",
|
|
64
|
+
"astro": "^7.2.4",
|
|
65
|
+
"eslint": "^9.39.1",
|
|
66
|
+
"eslint-plugin-astro": "^1.5.0",
|
|
67
|
+
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
68
|
+
"globals": "^16.5.0",
|
|
69
|
+
"maverick-wave": "^5.33.0",
|
|
70
|
+
"prettier": "^3.6.2",
|
|
71
|
+
"prettier-plugin-astro": "^0.14.1",
|
|
72
|
+
"typescript": "^6.0.3",
|
|
73
|
+
"typescript-eslint": "^8.46.4"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { APIRoute } from 'astro';
|
|
2
|
+
import config from 'virtual:maverick-wave-astro/config';
|
|
3
|
+
|
|
4
|
+
// A file because the CSP allows no inline script. Classic and in <head>, so
|
|
5
|
+
// the stored theme is set before the first paint.
|
|
6
|
+
const FOLLOW_SYSTEM = `(function () {
|
|
7
|
+
const stored = localStorage.getItem('mw-theme');
|
|
8
|
+
if (stored === 'light' || stored === 'dark') {
|
|
9
|
+
document.documentElement.classList.add('mw-theme-' + stored);
|
|
10
|
+
}
|
|
11
|
+
})();
|
|
12
|
+
`;
|
|
13
|
+
|
|
14
|
+
const DARK_BY_DEFAULT = `(function () {
|
|
15
|
+
let stored = localStorage.getItem('mw-theme');
|
|
16
|
+
if (stored !== 'light') {
|
|
17
|
+
stored = 'dark';
|
|
18
|
+
localStorage.setItem('mw-theme', 'dark');
|
|
19
|
+
}
|
|
20
|
+
document.documentElement.classList.add('mw-theme-' + stored);
|
|
21
|
+
})();
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
export const GET: APIRoute = () =>
|
|
25
|
+
new Response(
|
|
26
|
+
config.site.themeToggle === 'dark' ? DARK_BY_DEFAULT : FOLLOW_SYSTEM,
|
|
27
|
+
{ headers: { 'Content-Type': 'text/javascript; charset=utf-8' } }
|
|
28
|
+
);
|