maverick-wave-astro 1.23.0 → 1.25.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/bin/check.mjs +12 -2
- package/components/BaseLayout.astro +25 -13
- package/components/ClosureNotice.astro +3 -10
- package/components/DateStamp.astro +2 -5
- package/components/OpeningHours.astro +3 -7
- package/components/Schedule.astro +9 -51
- package/components/StoryCards.astro +0 -4
- package/dist/built-pages.d.ts +2 -0
- package/dist/built-pages.js +11 -0
- package/dist/hours.d.ts +2 -3
- package/dist/hours.js +9 -10
- package/dist/integration.d.ts +1 -1
- package/dist/integration.js +60 -12
- package/dist/minify.d.ts +1 -0
- package/dist/minify.js +26 -0
- package/dist/occasions.d.ts +4 -2
- package/dist/occasions.js +47 -5
- package/dist/path.d.ts +1 -0
- package/dist/path.js +3 -0
- package/dist/schedule.d.ts +1 -2
- package/dist/schedule.js +18 -25
- package/dist/types.d.ts +2 -2
- package/dist/uploads.js +12 -2
- package/package.json +3 -2
- package/styles/schedule.css +3 -2
- package/routes/occasions.js.ts +0 -10
package/bin/check.mjs
CHANGED
|
@@ -39,14 +39,24 @@ ajv.addVocabulary([
|
|
|
39
39
|
'x-package',
|
|
40
40
|
'x-keep-ids',
|
|
41
41
|
]);
|
|
42
|
-
|
|
42
|
+
const TIME = /^([01]\d|2[0-3]):[0-5]\d$/;
|
|
43
|
+
const minutes = time => Number(time.slice(0, 2)) * 60 + Number(time.slice(3));
|
|
44
|
+
// Two times may cross midnight - "20:00" to "02:00" ends the next day, as
|
|
45
|
+
// eventTimeRange reads it - but by twelve hours at most, so "02:00" typed for
|
|
46
|
+
// "14:00" in a break still stands out.
|
|
47
|
+
const overnight = (start, end) =>
|
|
48
|
+
TIME.test(start) &&
|
|
49
|
+
TIME.test(end) &&
|
|
50
|
+
minutes(end) + 24 * 60 - minutes(start) <= 12 * 60;
|
|
51
|
+
|
|
52
|
+
// Same rule as in the werkbank: YYYY-MM-DD and HH:MM compare as text.
|
|
43
53
|
ajv.addKeyword({
|
|
44
54
|
keyword: 'x-not-before',
|
|
45
55
|
type: 'string',
|
|
46
56
|
schemaType: 'string',
|
|
47
57
|
validate: (sibling, value, _schema, context) => {
|
|
48
58
|
const other = context?.parentData?.[sibling];
|
|
49
|
-
return !other || value >= other;
|
|
59
|
+
return !other || value >= other || overnight(other, value);
|
|
50
60
|
},
|
|
51
61
|
});
|
|
52
62
|
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
---
|
|
2
2
|
import config from 'virtual:maverick-wave-astro/config';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { occasionClasses } from '../dist/occasions.js';
|
|
5
|
+
import { withBase, withoutTrailingSlash } from '../dist/path.js';
|
|
6
|
+
import { type Promo, promoExpiry } from '../dist/schedule.js';
|
|
5
7
|
import Favicons from './Favicons.astro';
|
|
6
8
|
|
|
7
9
|
type Props = {
|
|
@@ -16,8 +18,10 @@ type Props = {
|
|
|
16
18
|
locale?: string;
|
|
17
19
|
alternates?: { hreflang: string; href: string | URL }[];
|
|
18
20
|
skipLabel?: string;
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
+
// The site's promotion: the build decides whether it runs today, Schedule
|
|
22
|
+
// takes it away should it end before the next build.
|
|
23
|
+
promo?: Promo | null;
|
|
24
|
+
// Ends up as data-* on <html>. null and undefined leave the attribute out.
|
|
21
25
|
htmlData?: Record<string, string | null | undefined>;
|
|
22
26
|
// Next to site.bodyClass, e.g. mw-deck for a presentation
|
|
23
27
|
bodyClass?: string;
|
|
@@ -26,7 +30,7 @@ type Props = {
|
|
|
26
30
|
bare?: boolean;
|
|
27
31
|
};
|
|
28
32
|
|
|
29
|
-
const { site, ogImage: OG_IMAGE, htmlClasses, designCss,
|
|
33
|
+
const { site, ogImage: OG_IMAGE, htmlClasses, designCss, occasion } = config;
|
|
30
34
|
|
|
31
35
|
const {
|
|
32
36
|
title,
|
|
@@ -40,12 +44,16 @@ const {
|
|
|
40
44
|
locale = site.locale,
|
|
41
45
|
alternates = [],
|
|
42
46
|
skipLabel = lang.startsWith('de') ? 'Zum Inhalt springen' : 'Skip to content',
|
|
47
|
+
promo,
|
|
43
48
|
htmlData = {},
|
|
44
49
|
bodyClass,
|
|
45
50
|
bare = false,
|
|
46
51
|
} = Astro.props;
|
|
47
52
|
|
|
48
|
-
const canonicalUrl = new URL(
|
|
53
|
+
const canonicalUrl = new URL(
|
|
54
|
+
withoutTrailingSlash(Astro.url.pathname),
|
|
55
|
+
Astro.site
|
|
56
|
+
);
|
|
49
57
|
|
|
50
58
|
// Only the default image has known dimensions, so only it gets width/height.
|
|
51
59
|
const previewImage = new URL(ogImage ?? withBase(OG_IMAGE.path), Astro.site);
|
|
@@ -61,17 +69,26 @@ const robots =
|
|
|
61
69
|
? 'noindex, nofollow'
|
|
62
70
|
: 'index, follow, max-image-preview:large, max-snippet:-1';
|
|
63
71
|
|
|
64
|
-
|
|
72
|
+
const promoUntil = promoExpiry(promo);
|
|
73
|
+
|
|
74
|
+
const classes = [
|
|
75
|
+
...htmlClasses,
|
|
76
|
+
...occasionClasses(occasion),
|
|
77
|
+
...(promoUntil ? ['mwa-promo-active'] : []),
|
|
78
|
+
];
|
|
79
|
+
|
|
80
|
+
// An empty data-mw-occasion-intro plays the intro once per visit.
|
|
65
81
|
const dataAttributes = Object.fromEntries(
|
|
66
82
|
Object.entries({
|
|
67
|
-
'mw-
|
|
83
|
+
'mw-occasion-intro': occasion?.intro ? '' : null,
|
|
84
|
+
'promo-until': promoUntil,
|
|
68
85
|
...htmlData,
|
|
69
86
|
}).map(([name, value]) => [`data-${name}`, value ?? undefined])
|
|
70
87
|
);
|
|
71
88
|
---
|
|
72
89
|
|
|
73
90
|
<!doctype html>
|
|
74
|
-
<html lang={lang} class:list={
|
|
91
|
+
<html lang={lang} class:list={classes} {...dataAttributes}>
|
|
75
92
|
<head>
|
|
76
93
|
<meta charset="UTF-8" />
|
|
77
94
|
<meta
|
|
@@ -139,11 +156,6 @@ const dataAttributes = Object.fromEntries(
|
|
|
139
156
|
<slot name="head" />
|
|
140
157
|
{designCss && <link rel="stylesheet" href={withBase('/design.css')} />}
|
|
141
158
|
{site.themeToggle && <script is:inline src={withBase('/theme.js')} />}
|
|
142
|
-
{
|
|
143
|
-
occasions.length > 0 && (
|
|
144
|
-
<script is:inline src={withBase('/occasions.js')} />
|
|
145
|
-
)
|
|
146
|
-
}
|
|
147
159
|
</head>
|
|
148
160
|
|
|
149
161
|
<body
|
|
@@ -6,13 +6,11 @@ import '../styles/hours.css';
|
|
|
6
6
|
|
|
7
7
|
import { siteLocale } from '../dist/config.js';
|
|
8
8
|
import {
|
|
9
|
+
announcedClosures,
|
|
9
10
|
type Closure,
|
|
10
|
-
closureEnd,
|
|
11
|
-
closureStart,
|
|
12
11
|
closureText,
|
|
13
12
|
type HoursTexts,
|
|
14
13
|
hoursTexts,
|
|
15
|
-
upcomingClosures,
|
|
16
14
|
} from '../dist/hours.js';
|
|
17
15
|
|
|
18
16
|
interface Props {
|
|
@@ -26,7 +24,7 @@ interface Props {
|
|
|
26
24
|
|
|
27
25
|
const { closures, href, locale = siteLocale, texts: own = {} } = Astro.props;
|
|
28
26
|
const texts = { ...hoursTexts(locale), ...own };
|
|
29
|
-
const list =
|
|
27
|
+
const list = announcedClosures(closures);
|
|
30
28
|
const Pill = href ? 'a' : 'div';
|
|
31
29
|
---
|
|
32
30
|
|
|
@@ -34,12 +32,7 @@ const Pill = href ? 'a' : 'div';
|
|
|
34
32
|
list.length > 0 && (
|
|
35
33
|
<div class="mwa-closure-notices">
|
|
36
34
|
{list.map(closure => (
|
|
37
|
-
<Pill
|
|
38
|
-
class="mw-hero-badge mw-hero-badge-urgent"
|
|
39
|
-
href={href}
|
|
40
|
-
data-starts={closureStart(closure)}
|
|
41
|
-
data-expires={closureEnd(closure)}
|
|
42
|
-
>
|
|
35
|
+
<Pill class="mw-hero-badge mw-hero-badge-urgent" href={href}>
|
|
43
36
|
<span class="mw-hero-badge-dot" />
|
|
44
37
|
{closureText(closure, locale, texts)}
|
|
45
38
|
</Pill>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
// Weekday above, date below - the stamp in front of an mw-date-stamp-body.
|
|
3
|
-
// "today" is
|
|
3
|
+
// "today" is the day of the build, the nightly build moves it along.
|
|
4
4
|
import { siteLocale } from '../dist/config.js';
|
|
5
5
|
import { dateStamp, isoDate, parseIsoDate } from '../dist/date.js';
|
|
6
6
|
|
|
@@ -16,10 +16,7 @@ const stamp = dateStamp(parseIsoDate(date), locale);
|
|
|
16
16
|
const today = stamp.iso === isoDate(new Date());
|
|
17
17
|
---
|
|
18
18
|
|
|
19
|
-
<p
|
|
20
|
-
class:list={['mw-date-stamp', today && 'mw-date-stamp-today', className]}
|
|
21
|
-
data-day={stamp.iso}
|
|
22
|
-
>
|
|
19
|
+
<p class:list={['mw-date-stamp', today && 'mw-date-stamp-today', className]}>
|
|
23
20
|
<span class="mw-date-stamp-day">{stamp.weekday}</span>
|
|
24
21
|
<time class="mw-date-stamp-date" datetime={stamp.iso}>{stamp.short}</time>
|
|
25
22
|
</p>
|
|
@@ -4,16 +4,14 @@
|
|
|
4
4
|
// above the rows while it is announced.
|
|
5
5
|
import { siteLocale } from '../dist/config.js';
|
|
6
6
|
import {
|
|
7
|
+
announcedClosures,
|
|
7
8
|
type Closure,
|
|
8
|
-
closureEnd,
|
|
9
|
-
closureStart,
|
|
10
9
|
closureText,
|
|
11
10
|
type HoursLine,
|
|
12
11
|
hoursLines,
|
|
13
12
|
type HoursRow,
|
|
14
13
|
type HoursTexts,
|
|
15
14
|
hoursTexts,
|
|
16
|
-
upcomingClosures,
|
|
17
15
|
} from '../dist/hours.js';
|
|
18
16
|
import Alert from './Alert.astro';
|
|
19
17
|
import ValueList from './ValueList.astro';
|
|
@@ -43,10 +41,8 @@ const items = hoursLines(hours, locale, texts).map(line => ({
|
|
|
43
41
|
---
|
|
44
42
|
|
|
45
43
|
{
|
|
46
|
-
|
|
47
|
-
<
|
|
48
|
-
<Alert type="warning" title={closureText(closure, locale, texts)} />
|
|
49
|
-
</div>
|
|
44
|
+
announcedClosures(closures).map(closure => (
|
|
45
|
+
<Alert type="warning" title={closureText(closure, locale, texts)} />
|
|
50
46
|
))
|
|
51
47
|
}
|
|
52
48
|
<ValueList items={items} />
|
|
@@ -1,62 +1,20 @@
|
|
|
1
1
|
---
|
|
2
|
-
// The
|
|
3
|
-
//
|
|
4
|
-
//
|
|
2
|
+
// The nightly build decides what is current, see schedule.ts. Left for the
|
|
3
|
+
// browser: a promotion that ends before the next build - a struck-through price
|
|
4
|
+
// after the last day would be a fake discount (UWG, PAngV).
|
|
5
5
|
import '../styles/schedule.css';
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
<script>
|
|
9
|
-
import { isoDate } from '../dist/date.js';
|
|
10
|
-
import { outOfSchedule } from '../dist/schedule.js';
|
|
11
|
-
|
|
12
9
|
const html = document.documentElement;
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
// "until" there is no promotion.
|
|
17
|
-
const { promoFrom, promoUntil } = html.dataset;
|
|
18
|
-
if (
|
|
19
|
-
promoUntil &&
|
|
20
|
-
new Date(promoUntil) >= now &&
|
|
21
|
-
(!promoFrom || new Date(promoFrom) <= now)
|
|
22
|
-
) {
|
|
23
|
-
html.classList.add('mwa-promo-active');
|
|
10
|
+
const { promoUntil } = html.dataset;
|
|
11
|
+
if (promoUntil && new Date(promoUntil) < new Date()) {
|
|
12
|
+
html.classList.remove('mwa-promo-active');
|
|
24
13
|
}
|
|
25
14
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if (outOfSchedule(element.dataset, now)) element.remove();
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
// A list without remaining entries is replaced by the template right after
|
|
33
|
-
// it, or removed altogether.
|
|
34
|
-
document.querySelectorAll('[data-schedule-list]').forEach(list => {
|
|
35
|
-
if (list.querySelector('[data-starts], [data-expires]')) return;
|
|
36
|
-
const empty = list.nextElementSibling;
|
|
37
|
-
if (
|
|
38
|
-
empty instanceof HTMLTemplateElement &&
|
|
39
|
-
'scheduleEmpty' in empty.dataset
|
|
40
|
-
) {
|
|
41
|
-
list.replaceWith(empty.content.cloneNode(true));
|
|
42
|
-
} else {
|
|
43
|
-
list.remove();
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
// The build only knows its own day - "today" in a calendar or on a date
|
|
48
|
-
// stamp moves along here.
|
|
49
|
-
const today = isoDate(now);
|
|
50
|
-
document.querySelectorAll<HTMLElement>('[data-day]').forEach(day => {
|
|
51
|
-
const mark = day.classList.contains('mw-date-stamp')
|
|
52
|
-
? 'mw-date-stamp-today'
|
|
53
|
-
: 'mw-calendar-today';
|
|
54
|
-
day.classList.toggle(mark, day.dataset.day === today);
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
// The browser jumps to the anchor before the promotion bar, late fonts and
|
|
58
|
-
// styles take their room, which leaves the target under the bar. Reload and
|
|
59
|
-
// back keep their own position, a visitor who already scrolls keeps theirs.
|
|
15
|
+
// The browser jumps to the anchor before late fonts take their room, which
|
|
16
|
+
// leaves the target too far down. Reload and back keep their own position, a
|
|
17
|
+
// visitor who already scrolls keeps theirs.
|
|
60
18
|
const navigation = performance.getEntriesByType('navigation')[0] as
|
|
61
19
|
PerformanceNavigationTiming | undefined;
|
|
62
20
|
const target =
|
|
@@ -17,7 +17,6 @@ import {
|
|
|
17
17
|
promoEndDate,
|
|
18
18
|
promoExpiry,
|
|
19
19
|
promoInHtml,
|
|
20
|
-
promoStart,
|
|
21
20
|
promoText,
|
|
22
21
|
upcomingEvents,
|
|
23
22
|
} from '../dist/schedule.js';
|
|
@@ -121,7 +120,6 @@ interface Story {
|
|
|
121
120
|
card: StoryCard;
|
|
122
121
|
label: string;
|
|
123
122
|
file: string;
|
|
124
|
-
starts?: string | null;
|
|
125
123
|
expires?: string | null;
|
|
126
124
|
series?: string;
|
|
127
125
|
}
|
|
@@ -172,7 +170,6 @@ const promoStories: Story[] =
|
|
|
172
170
|
german ? 'rabatt' : 'promo',
|
|
173
171
|
promo.until ?? ''
|
|
174
172
|
),
|
|
175
|
-
starts: promoStart(promo),
|
|
176
173
|
expires: promoExpiry(promo),
|
|
177
174
|
},
|
|
178
175
|
]
|
|
@@ -225,7 +222,6 @@ const look: LookOptions = {
|
|
|
225
222
|
class="mwa-story-card"
|
|
226
223
|
data-story={JSON.stringify(story.card)}
|
|
227
224
|
data-file={story.file}
|
|
228
|
-
data-starts={story.starts}
|
|
229
225
|
data-expires={story.expires}
|
|
230
226
|
data-series={story.series}
|
|
231
227
|
>
|
package/dist/built-pages.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ export declare const readPage: (html: string) => BuiltPage | undefined;
|
|
|
15
15
|
export declare const readBuiltPages: (dir: string) => BuiltPage[];
|
|
16
16
|
/** What would cost the page its snippet in the search results. */
|
|
17
17
|
export declare const seoWarnings: (page: BuiltPage) => string[];
|
|
18
|
+
export declare const personalData: (html: string) => string[];
|
|
19
|
+
export declare const pagesWithPersonalData: (dir: string) => string[];
|
|
18
20
|
export declare const largeImages: (dir: string) => {
|
|
19
21
|
file: string;
|
|
20
22
|
bytes: number;
|
package/dist/built-pages.js
CHANGED
|
@@ -62,6 +62,17 @@ export const seoWarnings = (page) => {
|
|
|
62
62
|
page.headings !== 1 && `${page.headings} <h1> on the page, one is right`,
|
|
63
63
|
].filter((warning) => typeof warning === 'string');
|
|
64
64
|
};
|
|
65
|
+
// Nothing a page needs, and with name and address from the imprint enough to
|
|
66
|
+
// order in someone else's name. The build stops on it.
|
|
67
|
+
const PERSONAL_DATA = [
|
|
68
|
+
{
|
|
69
|
+
pattern: /\sdata-[\w-]*(?:birth|geburt)[\w-]*=/i,
|
|
70
|
+
what: 'a birth date in a data attribute',
|
|
71
|
+
},
|
|
72
|
+
{ pattern: /"birthDate"\s*:/, what: 'birthDate in the structured data' },
|
|
73
|
+
];
|
|
74
|
+
export const personalData = (html) => PERSONAL_DATA.filter(({ pattern }) => pattern.test(html)).map(({ what }) => what);
|
|
75
|
+
export const pagesWithPersonalData = (dir) => files(dir, /\.html$/).flatMap(file => personalData(readFileSync(path.join(dir, file), 'utf8')).map(what => `${file}: ${what}`));
|
|
65
76
|
export const largeImages = (dir) => files(dir, /\.(jpe?g|png|webp|avif)$/i)
|
|
66
77
|
.map(file => ({ file, bytes: statSync(path.join(dir, file)).size }))
|
|
67
78
|
.filter(image => image.bytes > IMAGE_MAX_BYTES);
|
package/dist/hours.d.ts
CHANGED
|
@@ -40,7 +40,6 @@ export interface HoursTexts {
|
|
|
40
40
|
}
|
|
41
41
|
export declare const hoursTexts: (locale: string) => HoursTexts;
|
|
42
42
|
export declare const hoursLines: (rows: readonly (HoursRow | HoursLine)[], locale: string, texts: HoursTexts) => HoursLine[];
|
|
43
|
-
export declare const closureStart: (closure: Closure) =>
|
|
44
|
-
export declare const
|
|
45
|
-
export declare const upcomingClosures: (closures: readonly Closure[] | undefined, now?: Date) => Closure[];
|
|
43
|
+
export declare const closureStart: (closure: Closure) => Date;
|
|
44
|
+
export declare const announcedClosures: (closures: readonly Closure[] | undefined, now?: Date) => Closure[];
|
|
46
45
|
export declare const closureText: (closure: Closure, locale: string, texts: HoursTexts) => string;
|
package/dist/hours.js
CHANGED
|
@@ -72,25 +72,24 @@ export const hoursLines = (rows, locale, texts) => rows.flatMap(row => {
|
|
|
72
72
|
const validClosure = (closure) => DATE.test(closure.from ?? '') &&
|
|
73
73
|
DATE.test(closure.until ?? '') &&
|
|
74
74
|
closure.until >= closure.from;
|
|
75
|
-
//
|
|
75
|
+
// Midnight of the day it is announced.
|
|
76
76
|
export const closureStart = (closure) => {
|
|
77
77
|
const notice = closure.notice ?? '';
|
|
78
|
-
return
|
|
78
|
+
return DATE.test(notice)
|
|
79
79
|
? parseIsoDate(notice)
|
|
80
|
-
: addDays(parseIsoDate(closure.from), -ANNOUNCE_DAYS)
|
|
80
|
+
: addDays(parseIsoDate(closure.from), -ANNOUNCE_DAYS);
|
|
81
81
|
};
|
|
82
|
-
//
|
|
83
|
-
//
|
|
84
|
-
export const
|
|
85
|
-
export const upcomingClosures = (closures, now = new Date()) => (closures ?? [])
|
|
82
|
+
// Announced on the day of the build and not over yet. No grace hours as with
|
|
83
|
+
// events - the next morning the door is open again.
|
|
84
|
+
export const announcedClosures = (closures, now = new Date()) => (closures ?? [])
|
|
86
85
|
.filter(closure => {
|
|
87
86
|
const end = validClosure(closure) && endOfDay(closure.until);
|
|
88
|
-
return end && end >= now;
|
|
87
|
+
return end && end >= now && closureStart(closure) <= now;
|
|
89
88
|
})
|
|
90
89
|
.sort((a, b) => a.from.localeCompare(b.from));
|
|
91
90
|
const shortDate = (date, locale) => parseIsoDate(date).toLocaleDateString(locale, {
|
|
92
|
-
day: '
|
|
93
|
-
month: '
|
|
91
|
+
day: '2-digit',
|
|
92
|
+
month: '2-digit',
|
|
94
93
|
});
|
|
95
94
|
export const closureText = (closure, locale, texts) => {
|
|
96
95
|
const label = closure.text?.trim() || texts.closure;
|
package/dist/integration.d.ts
CHANGED
|
@@ -11,5 +11,5 @@ export type Options = {
|
|
|
11
11
|
designFile?: string;
|
|
12
12
|
occasionsFile?: string;
|
|
13
13
|
};
|
|
14
|
-
export declare const buildConfig: (options: Options, root: string, werkbank?: Werkbank | undefined) => Config;
|
|
14
|
+
export declare const buildConfig: (options: Options, root: string, werkbank?: Werkbank | undefined, now?: Date) => Config;
|
|
15
15
|
export default function homepage(options: Options): AstroIntegration;
|
package/dist/integration.js
CHANGED
|
@@ -2,10 +2,12 @@ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
4
|
import sitemap, {} from '@astrojs/sitemap';
|
|
5
|
-
import { IMAGE_MAX_BYTES, largeImages, readBuiltPages, seoWarnings, } from "./built-pages.js";
|
|
5
|
+
import { IMAGE_MAX_BYTES, largeImages, pagesWithPersonalData, readBuiltPages, seoWarnings, } from "./built-pages.js";
|
|
6
6
|
import { loadWerkbank } from "./content.js";
|
|
7
7
|
import { designClasses, designCss, designFromSetup, mergeDesigns, validateDesign, } from "./design.js";
|
|
8
|
-
import {
|
|
8
|
+
import { minifyScripts } from "./minify.js";
|
|
9
|
+
import { todaysOccasion } from "./occasions.js";
|
|
10
|
+
import { withoutTrailingSlash } from "./path.js";
|
|
9
11
|
import { llmsTxt, robotsTxt, securityTxt } from "./root-files.js";
|
|
10
12
|
import { prepareUploads, removeOriginals } from "./uploads.js";
|
|
11
13
|
const CONFIG_MODULE = 'virtual:maverick-wave-astro/config';
|
|
@@ -17,6 +19,49 @@ if (!isLocal && navigator.sendBeacon) {
|
|
|
17
19
|
const page = window.location.pathname.replace(/^\\/+|\\/+$/g, '') || 'home';
|
|
18
20
|
navigator.sendBeacon(\`/_c/\${page}\`);
|
|
19
21
|
}`;
|
|
22
|
+
// MaverickWave's helpers for local development belong to the SPAs: the
|
|
23
|
+
// localhost indicator needs markup no Astro site renders, and BaseLayout always
|
|
24
|
+
// sets viewport-fit. Without the calls the minifier drops both functions.
|
|
25
|
+
const DEV_HELPERS = ['initLocalhostIndicator();', 'warnMissingViewportFit();'];
|
|
26
|
+
const withoutDevHelpers = {
|
|
27
|
+
name: 'maverick-wave-astro:without-dev-helpers',
|
|
28
|
+
transform(code, id) {
|
|
29
|
+
if (!id.endsWith('/maverick-wave/src/js/main.js'))
|
|
30
|
+
return undefined;
|
|
31
|
+
const missing = DEV_HELPERS.filter(call => !code.includes(call));
|
|
32
|
+
if (missing.length > 0) {
|
|
33
|
+
this.warn(`maverick-wave no longer calls ${missing.join(' ')}`);
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
code: DEV_HELPERS.reduce((result, call) => result.replace(call, ''), code),
|
|
37
|
+
map: null,
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
const withoutSlash = (url) => {
|
|
42
|
+
const target = new URL(url);
|
|
43
|
+
target.pathname = withoutTrailingSlash(target.pathname);
|
|
44
|
+
return target.href;
|
|
45
|
+
};
|
|
46
|
+
// The sitemap names a page the way its canonical does.
|
|
47
|
+
const sitemapOptions = (own = {}) => ({
|
|
48
|
+
...own,
|
|
49
|
+
serialize: async (item) => {
|
|
50
|
+
const entry = own.serialize ? await own.serialize(item) : item;
|
|
51
|
+
if (!entry)
|
|
52
|
+
return undefined;
|
|
53
|
+
return {
|
|
54
|
+
...entry,
|
|
55
|
+
url: withoutSlash(entry.url),
|
|
56
|
+
...(entry.links && {
|
|
57
|
+
links: entry.links.map(link => ({
|
|
58
|
+
...link,
|
|
59
|
+
url: withoutSlash(link.url),
|
|
60
|
+
})),
|
|
61
|
+
}),
|
|
62
|
+
};
|
|
63
|
+
},
|
|
64
|
+
});
|
|
20
65
|
const readJson = (file) => existsSync(file) ? JSON.parse(readFileSync(file, 'utf8')) : undefined;
|
|
21
66
|
const designPath = (options, root) => path.join(root, options.designFile ?? 'src/content/design.json');
|
|
22
67
|
const occasionsPath = (options, root) => path.join(root, options.occasionsFile ?? 'src/content/occasions.json');
|
|
@@ -33,7 +78,7 @@ const fromWerkbank = (werkbank, matches) => {
|
|
|
33
78
|
? undefined
|
|
34
79
|
: werkbank.sections[section][werkbank.languages[0]];
|
|
35
80
|
};
|
|
36
|
-
export const buildConfig = (options, root, werkbank = loadWerkbank(root)) => {
|
|
81
|
+
export const buildConfig = (options, root, werkbank = loadWerkbank(root), now = new Date()) => {
|
|
37
82
|
const { site, ogImage } = options;
|
|
38
83
|
const base = typeof site.design === 'string'
|
|
39
84
|
? designFromSetup(site.design)
|
|
@@ -47,7 +92,7 @@ export const buildConfig = (options, root, werkbank = loadWerkbank(root)) => {
|
|
|
47
92
|
design,
|
|
48
93
|
htmlClasses: designClasses(design),
|
|
49
94
|
designCss: designCss(design),
|
|
50
|
-
|
|
95
|
+
occasion: occasions ? todaysOccasion(occasions, now) : null,
|
|
51
96
|
};
|
|
52
97
|
};
|
|
53
98
|
// Only a site at the root of its host: /.well-known and robots.txt below a
|
|
@@ -136,11 +181,14 @@ export default function homepage(options) {
|
|
|
136
181
|
output: 'static',
|
|
137
182
|
// The CSP has no 'unsafe-inline' and would drop inlined CSS and JS.
|
|
138
183
|
build: { inlineStylesheets: 'never' },
|
|
139
|
-
integrations: options.sitemap === false
|
|
184
|
+
integrations: options.sitemap === false
|
|
185
|
+
? []
|
|
186
|
+
: [sitemap(sitemapOptions(options.sitemap))],
|
|
140
187
|
vite: {
|
|
141
188
|
build: { assetsInlineLimit: 0 },
|
|
142
189
|
resolve: { alias: { '@': path.join(root, 'src') } },
|
|
143
190
|
plugins: [
|
|
191
|
+
withoutDevHelpers,
|
|
144
192
|
{
|
|
145
193
|
name: 'maverick-wave-astro:config',
|
|
146
194
|
resolveId: (id) => id in modules ? `\0${id}` : undefined,
|
|
@@ -172,17 +220,17 @@ export default function homepage(options) {
|
|
|
172
220
|
prerender: true,
|
|
173
221
|
});
|
|
174
222
|
}
|
|
175
|
-
if (config.occasions.length > 0) {
|
|
176
|
-
injectRoute({
|
|
177
|
-
pattern: '/occasions.js',
|
|
178
|
-
entrypoint: new URL('../routes/occasions.js.ts', import.meta.url),
|
|
179
|
-
prerender: true,
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
223
|
},
|
|
183
224
|
'astro:build:done': ({ dir, logger }) => {
|
|
184
225
|
const out = fileURLToPath(dir);
|
|
226
|
+
const personal = pagesWithPersonalData(out);
|
|
227
|
+
if (personal.length > 0) {
|
|
228
|
+
throw new Error(`personal data in the HTML, take it out of the page:\n${personal.join('\n')}`);
|
|
229
|
+
}
|
|
185
230
|
removeOriginals(out);
|
|
231
|
+
for (const file of minifyScripts(out)) {
|
|
232
|
+
logger.warn(`${file} does not parse, it stays unminified`);
|
|
233
|
+
}
|
|
186
234
|
const pages = readBuiltPages(out);
|
|
187
235
|
if (build) {
|
|
188
236
|
const files = rootFiles(build, options.sitemap !== false, pages, logger);
|
package/dist/minify.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const minifyScripts: (dir: string) => string[];
|
package/dist/minify.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { readdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { minifySync } from 'vite';
|
|
4
|
+
// Tried as a classic script first, so its top-level names stay as they are - a
|
|
5
|
+
// module only when the file does not parse as a script.
|
|
6
|
+
const minified = (file, code) => {
|
|
7
|
+
for (const module of file.endsWith('.mjs') ? [true] : [false, true]) {
|
|
8
|
+
const result = minifySync(file, code, { module });
|
|
9
|
+
if (result.errors.length === 0)
|
|
10
|
+
return result.code;
|
|
11
|
+
}
|
|
12
|
+
return null;
|
|
13
|
+
};
|
|
14
|
+
// Every script leaves the build minified and without a single comment. Vite's
|
|
15
|
+
// bundles mostly are already, files from public/ and the injected routes are
|
|
16
|
+
// not. Returns the files that would not parse and stayed as they were.
|
|
17
|
+
export const minifyScripts = (dir) => readdirSync(dir, { recursive: true, encoding: 'utf8' })
|
|
18
|
+
.filter(file => /\.m?js$/.test(file))
|
|
19
|
+
.flatMap(file => {
|
|
20
|
+
const target = path.join(dir, file);
|
|
21
|
+
const code = minified(file, readFileSync(target, 'utf8'));
|
|
22
|
+
if (code === null)
|
|
23
|
+
return [file];
|
|
24
|
+
writeFileSync(target, code);
|
|
25
|
+
return [];
|
|
26
|
+
});
|
package/dist/occasions.d.ts
CHANGED
|
@@ -8,9 +8,11 @@ export type Occasions = {
|
|
|
8
8
|
yearly?: boolean;
|
|
9
9
|
}[];
|
|
10
10
|
};
|
|
11
|
-
export type
|
|
11
|
+
export type Occasion = {
|
|
12
|
+
effect: string;
|
|
12
13
|
scroll: boolean;
|
|
13
14
|
intro: boolean;
|
|
14
15
|
size?: 'sm' | 'lg';
|
|
15
16
|
};
|
|
16
|
-
export declare const
|
|
17
|
+
export declare const todaysOccasion: (occasions: Occasions, now?: Date) => Occasion | null;
|
|
18
|
+
export declare const occasionClasses: (occasion: Occasion | null) => string[];
|
package/dist/occasions.js
CHANGED
|
@@ -1,10 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
const DAY = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
2
|
+
const localDay = (value) => {
|
|
3
|
+
const match = DAY.exec(value);
|
|
4
|
+
return match ? new Date(+match[1], +match[2] - 1, +match[3]) : null;
|
|
5
|
+
};
|
|
6
|
+
// Local days, the last one included. A yearly window keeps month and day and
|
|
7
|
+
// may run over New Year - 5 December to 5 February.
|
|
8
|
+
const windowLength = (entry, now) => {
|
|
9
|
+
const from = localDay(entry.from);
|
|
10
|
+
const until = localDay(entry.until);
|
|
11
|
+
if (!from || !until || until < from)
|
|
12
|
+
return null;
|
|
13
|
+
const years = entry.yearly
|
|
14
|
+
? [now.getFullYear() - 1, now.getFullYear()]
|
|
15
|
+
: [from.getFullYear()];
|
|
16
|
+
for (const year of years) {
|
|
17
|
+
const shift = year - from.getFullYear();
|
|
18
|
+
const start = new Date(year, from.getMonth(), from.getDate());
|
|
19
|
+
const end = new Date(until.getFullYear() + shift, until.getMonth(), until.getDate() + 1);
|
|
20
|
+
if (start <= now && now < end)
|
|
21
|
+
return end.getTime() - start.getTime();
|
|
22
|
+
}
|
|
23
|
+
return null;
|
|
24
|
+
};
|
|
25
|
+
// The shortest window that contains the day wins, so Christmas beats the snow
|
|
26
|
+
// season around it without anyone having to order the list.
|
|
27
|
+
export const todaysOccasion = (occasions, now = new Date()) => {
|
|
28
|
+
let best = null;
|
|
29
|
+
for (const entry of occasions.entries) {
|
|
30
|
+
const length = windowLength(entry, now);
|
|
31
|
+
if (length !== null && (!best || length < best.length)) {
|
|
32
|
+
best = { entry, length };
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if (!best)
|
|
36
|
+
return null;
|
|
3
37
|
const dynamic = occasions.motion === 'dynamic';
|
|
4
|
-
return
|
|
5
|
-
|
|
38
|
+
return {
|
|
39
|
+
effect: best.entry.effect,
|
|
6
40
|
scroll: dynamic,
|
|
7
41
|
intro: dynamic,
|
|
8
42
|
...(occasions.size && { size: occasions.size }),
|
|
9
|
-
}
|
|
43
|
+
};
|
|
10
44
|
};
|
|
45
|
+
// What MaverickWave reads on <html> to draw the occasion.
|
|
46
|
+
export const occasionClasses = (occasion) => occasion
|
|
47
|
+
? [
|
|
48
|
+
`mw-occasion-${occasion.effect}`,
|
|
49
|
+
...(occasion.scroll ? ['mw-occasion-scroll'] : []),
|
|
50
|
+
...(occasion.size ? [`mw-occasion-${occasion.size}`] : []),
|
|
51
|
+
]
|
|
52
|
+
: [];
|
package/dist/path.d.ts
CHANGED
package/dist/path.js
CHANGED
|
@@ -5,3 +5,6 @@ const base = (import.meta.env?.BASE_URL ?? '/').replace(/\/$/, '');
|
|
|
5
5
|
export const withBase = (target) => `${base}/${target.replace(/^\//, '')}`;
|
|
6
6
|
// Content links can point anywhere: only a path on this site gets the base.
|
|
7
7
|
export const linkTo = (target) => target.startsWith('/') ? withBase(target) : target;
|
|
8
|
+
// Canonical and sitemap write a page the way the links on the site do: without
|
|
9
|
+
// the trailing slash, the root stays "/".
|
|
10
|
+
export const withoutTrailingSlash = (pathname) => pathname.replace(/\/+$/, '') || '/';
|
package/dist/schedule.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const endOfDay: (date: string) => Date | null;
|
|
2
|
-
export declare const GRACE_HOURS =
|
|
2
|
+
export declare const GRACE_HOURS = 3;
|
|
3
3
|
export declare const visibleUntil: (date: string) => Date | null;
|
|
4
4
|
export type ScheduledEvent = {
|
|
5
5
|
date: string;
|
|
@@ -20,7 +20,6 @@ export type Promo = {
|
|
|
20
20
|
};
|
|
21
21
|
export declare const promoInHtml: (promo: Promo | null | undefined, now?: Date) => promo is Promo;
|
|
22
22
|
export declare const promoExpiry: (promo: Promo | null | undefined, now?: Date) => string | null;
|
|
23
|
-
export declare const promoStart: (promo: Promo | null | undefined, now?: Date) => string | null;
|
|
24
23
|
export declare const discountText: (promo: Promo) => string;
|
|
25
24
|
export declare const discountedPrice: (promo: Promo, amount: number) => number;
|
|
26
25
|
export declare const promoEndDate: (promo: Promo, locale?: string) => string | null;
|
package/dist/schedule.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
// The build
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
// TZ=Europe/Berlin - the
|
|
1
|
+
// The build decides what is current: every site is built again each night, so
|
|
2
|
+
// the HTML only holds what applies on the day of the build. The browser keeps
|
|
3
|
+
// a single check, the end of a promotion (components/Schedule.astro). All
|
|
4
|
+
// calculations run in local time, so the build needs TZ=Europe/Berlin - the
|
|
5
|
+
// integration sets it unless the environment does.
|
|
5
6
|
import { addDays, isoDate, parseIsoDate } from "./date.js";
|
|
6
7
|
// End of the given day, because an event is valid until its day is over.
|
|
7
8
|
export const endOfDay = (date) => {
|
|
8
9
|
const day = new Date(`${date}T23:59:59`);
|
|
9
10
|
return Number.isNaN(day.getTime()) ? null : day;
|
|
10
11
|
};
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
export const GRACE_HOURS =
|
|
12
|
+
// A build shortly after midnight keeps last night's event, the nightly build at
|
|
13
|
+
// half past three drops it. The date in the text stays the last day.
|
|
14
|
+
export const GRACE_HOURS = 3;
|
|
14
15
|
export const visibleUntil = (date) => {
|
|
15
16
|
const day = endOfDay(date);
|
|
16
17
|
if (!day)
|
|
@@ -18,8 +19,7 @@ export const visibleUntil = (date) => {
|
|
|
18
19
|
day.setHours(day.getHours() + GRACE_HOURS);
|
|
19
20
|
return day;
|
|
20
21
|
};
|
|
21
|
-
//
|
|
22
|
-
// Schedule and StoryCards.
|
|
22
|
+
// data-starts and data-expires on a story card, read by StoryCards.
|
|
23
23
|
export const outOfSchedule = ({ starts, expires }, now = new Date()) => Boolean((expires && new Date(expires) < now) || (starts && new Date(starts) > now));
|
|
24
24
|
// Free text instead of a date stays - an unusual format beats a swallowed
|
|
25
25
|
// event.
|
|
@@ -29,8 +29,8 @@ export const upcomingEvents = (entries, now = new Date()) => entries
|
|
|
29
29
|
return !end || now <= end;
|
|
30
30
|
})
|
|
31
31
|
.sort((a, b) => a.date.localeCompare(b.date));
|
|
32
|
-
// Value for data-expires: the moment the event is gone. Empty
|
|
33
|
-
// instead of a date - that never expires.
|
|
32
|
+
// Value for data-expires on a story card: the moment the event is gone. Empty
|
|
33
|
+
// means free text instead of a date - that never expires.
|
|
34
34
|
export const eventExpiry = (entry) => {
|
|
35
35
|
const end = visibleUntil(entry.date);
|
|
36
36
|
return end ? end.toISOString() : '';
|
|
@@ -46,29 +46,22 @@ export const eventDateText = (entry, locale = 'de-DE') => {
|
|
|
46
46
|
year: 'numeric',
|
|
47
47
|
});
|
|
48
48
|
};
|
|
49
|
-
//
|
|
50
|
-
//
|
|
51
|
-
//
|
|
49
|
+
// Only a promotion that runs on the day of the build ends up in the HTML.
|
|
50
|
+
// Without a last day there is none: an open-ended discount strikes through a
|
|
51
|
+
// price nobody ever pays (UWG, PAngV).
|
|
52
52
|
export const promoInHtml = (promo, now = new Date()) => {
|
|
53
53
|
const percent = Number(promo?.percent);
|
|
54
54
|
if (!promo || !Number.isFinite(percent) || percent <= 0)
|
|
55
55
|
return false;
|
|
56
56
|
const end = visibleUntil(promo.until ?? '');
|
|
57
|
-
|
|
57
|
+
const start = promo.from ? new Date(`${promo.from}T00:00:00`) : null;
|
|
58
|
+
return end !== null && now <= end && !(start && now < start);
|
|
58
59
|
};
|
|
59
|
-
// Value for data-promo-until on <html>: the moment the promotion is gone
|
|
60
|
-
//
|
|
60
|
+
// Value for data-promo-until on <html>: the moment the promotion is gone, in
|
|
61
|
+
// case the nightly build fails. Null means no promotion in the HTML.
|
|
61
62
|
export const promoExpiry = (promo, now = new Date()) => promoInHtml(promo, now)
|
|
62
63
|
? (visibleUntil(promo.until ?? '')?.toISOString() ?? null)
|
|
63
64
|
: null;
|
|
64
|
-
// Value for data-promo-from on <html>: the moment the promotion starts. Null
|
|
65
|
-
// means it applies right away, or there is none.
|
|
66
|
-
export const promoStart = (promo, now = new Date()) => {
|
|
67
|
-
if (!promoInHtml(promo, now) || !promo.from)
|
|
68
|
-
return null;
|
|
69
|
-
const start = new Date(`${promo.from}T00:00:00`);
|
|
70
|
-
return Number.isNaN(start.getTime()) ? null : start.toISOString();
|
|
71
|
-
};
|
|
72
65
|
// Thin space between number and percent sign, as typesetting wants it.
|
|
73
66
|
export const discountText = (promo) => `-${Number(promo.percent)}\u2009%`;
|
|
74
67
|
// Always rounded down: rounding up would give customers less than the
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Design } from './design.ts';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Occasion } from './occasions.ts';
|
|
3
3
|
import type { AiCrawlers } from './root-files.ts';
|
|
4
4
|
export type Site = {
|
|
5
5
|
name: string;
|
|
@@ -40,5 +40,5 @@ export type Config = {
|
|
|
40
40
|
design: Design;
|
|
41
41
|
htmlClasses: string[];
|
|
42
42
|
designCss: string;
|
|
43
|
-
|
|
43
|
+
occasion: Occasion | null;
|
|
44
44
|
};
|
package/dist/uploads.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { existsSync, readdirSync, rmSync } from 'node:fs';
|
|
1
|
+
import { existsSync, readdirSync, renameSync, rmSync } from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
// The contentmanager stores only the original, the build derives what Picture asks for.
|
|
4
4
|
export const UPLOAD_WIDTHS = [260, 500, 1000, 1600];
|
|
5
5
|
const ORIGINAL = /^([0-9a-f]{16})\.(jpg|png|webp)$/;
|
|
6
|
+
// A size is written under this suffix and renamed when complete - a build
|
|
7
|
+
// killed mid-write leaves no half file that every later build would skip.
|
|
8
|
+
const UNFINISHED = '.tmp';
|
|
6
9
|
const TYPES = ['webp', 'jpg'];
|
|
7
10
|
const uploadsDir = (root) => path.join(root, 'images', 'uploads');
|
|
8
11
|
const missingVariants = (dir) => readdirSync(dir).flatMap(file => {
|
|
@@ -21,6 +24,10 @@ export const prepareUploads = async (publicDir) => {
|
|
|
21
24
|
const dir = uploadsDir(publicDir);
|
|
22
25
|
if (!existsSync(dir))
|
|
23
26
|
return { written: 0, skipped: [] };
|
|
27
|
+
for (const file of readdirSync(dir)) {
|
|
28
|
+
if (file.endsWith(UNFINISHED))
|
|
29
|
+
rmSync(path.join(dir, file), { force: true });
|
|
30
|
+
}
|
|
24
31
|
const missing = missingVariants(dir);
|
|
25
32
|
if (missing.length === 0)
|
|
26
33
|
return { written: 0, skipped: [] };
|
|
@@ -31,6 +38,7 @@ export const prepareUploads = async (publicDir) => {
|
|
|
31
38
|
for (const variant of missing) {
|
|
32
39
|
if (skipped.has(variant.source))
|
|
33
40
|
continue;
|
|
41
|
+
const unfinished = `${variant.target}${UNFINISHED}`;
|
|
34
42
|
try {
|
|
35
43
|
// rotate() applies the EXIF orientation, phone photos arrive sideways otherwise.
|
|
36
44
|
const image = sharp(variant.source)
|
|
@@ -39,10 +47,12 @@ export const prepareUploads = async (publicDir) => {
|
|
|
39
47
|
const encoded = variant.type === 'webp'
|
|
40
48
|
? image.webp({ quality: 80 })
|
|
41
49
|
: image.jpeg({ quality: 82, mozjpeg: true });
|
|
42
|
-
await encoded.toFile(
|
|
50
|
+
await encoded.toFile(unfinished);
|
|
51
|
+
renameSync(unfinished, variant.target);
|
|
43
52
|
written++;
|
|
44
53
|
}
|
|
45
54
|
catch {
|
|
55
|
+
rmSync(unfinished, { force: true });
|
|
46
56
|
// One broken upload must not stop every build of the site - it just gets no sizes.
|
|
47
57
|
skipped.add(variant.source);
|
|
48
58
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "maverick-wave-astro",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.25.0",
|
|
4
4
|
"description": "Shared frame for static Astro homepages built with MaverickWave: layout, SEO, design variants, schedule, building blocks.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -53,7 +53,8 @@
|
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"astro": "^7.2.0",
|
|
56
|
-
"maverick-wave": "^6.15.0"
|
|
56
|
+
"maverick-wave": "^6.15.0",
|
|
57
|
+
"vite": "^8.0.0"
|
|
57
58
|
},
|
|
58
59
|
"dependencies": {
|
|
59
60
|
"@astrojs/sitemap": "^3.7.3",
|
package/styles/schedule.css
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
/*
|
|
2
|
-
every rule would have to
|
|
1
|
+
/* BaseLayout sets the class, Schedule removes it once the promotion is over.
|
|
2
|
+
These rules only hide, never show, otherwise every rule would have to
|
|
3
|
+
rebuild MaverickWave's display value. */
|
|
3
4
|
html:not(.mwa-promo-active) .mwa-promo-only {
|
|
4
5
|
display: none;
|
|
5
6
|
}
|
package/routes/occasions.js.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { APIRoute } from 'astro';
|
|
2
|
-
import script from 'maverick-wave/src/js/occasions.js?raw';
|
|
3
|
-
|
|
4
|
-
// Picks today's occasion before the first paint - a file for the same CSP
|
|
5
|
-
// reason as theme.js, and the one MaverickWave ships, so the schedule has a
|
|
6
|
-
// single implementation.
|
|
7
|
-
export const GET: APIRoute = () =>
|
|
8
|
-
new Response(script, {
|
|
9
|
-
headers: { 'Content-Type': 'text/javascript; charset=utf-8' },
|
|
10
|
-
});
|