maverick-wave-astro 1.22.0 → 1.23.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/components/ClosureNotice.astro +49 -0
- package/components/OpeningHours.astro +43 -4
- package/components/SectionHead.astro +4 -1
- package/components/StoryCards.astro +107 -0
- package/dist/hours.d.ts +46 -0
- package/dist/hours.js +102 -0
- package/dist/story/base.d.ts +3 -0
- package/dist/story/base.js +22 -0
- package/dist/story/cards.d.ts +2 -0
- package/dist/story/event.js +2 -2
- package/dist/story/promo.js +2 -2
- package/package.json +3 -3
- package/schemas/design.schema.json +2 -1
- package/schemas/opening-hours.schema.json +163 -0
- package/schemas/story-look.schema.json +15 -2
- package/styles/hours.css +5 -0
- package/styles/story-cards.css +68 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
// The next closure as a pill for the hero's kicker slot. Urgent, so it takes
|
|
3
|
+
// the place of the hero's own badge while it shows - the first thing a
|
|
4
|
+
// visitor reads should be that the door stays shut, not the latest news.
|
|
5
|
+
import '../styles/hours.css';
|
|
6
|
+
|
|
7
|
+
import { siteLocale } from '../dist/config.js';
|
|
8
|
+
import {
|
|
9
|
+
type Closure,
|
|
10
|
+
closureEnd,
|
|
11
|
+
closureStart,
|
|
12
|
+
closureText,
|
|
13
|
+
type HoursTexts,
|
|
14
|
+
hoursTexts,
|
|
15
|
+
upcomingClosures,
|
|
16
|
+
} from '../dist/hours.js';
|
|
17
|
+
|
|
18
|
+
interface Props {
|
|
19
|
+
closures?: readonly Closure[];
|
|
20
|
+
// Usually the section with the opening hours.
|
|
21
|
+
href?: string;
|
|
22
|
+
// The page's language on a site with several - weekdays and dates follow it.
|
|
23
|
+
locale?: string;
|
|
24
|
+
texts?: Partial<HoursTexts>;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const { closures, href, locale = siteLocale, texts: own = {} } = Astro.props;
|
|
28
|
+
const texts = { ...hoursTexts(locale), ...own };
|
|
29
|
+
const list = upcomingClosures(closures);
|
|
30
|
+
const Pill = href ? 'a' : 'div';
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
{
|
|
34
|
+
list.length > 0 && (
|
|
35
|
+
<div class="mwa-closure-notices">
|
|
36
|
+
{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
|
+
>
|
|
43
|
+
<span class="mw-hero-badge-dot" />
|
|
44
|
+
{closureText(closure, locale, texts)}
|
|
45
|
+
</Pill>
|
|
46
|
+
))}
|
|
47
|
+
</div>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
@@ -1,14 +1,53 @@
|
|
|
1
1
|
---
|
|
2
|
+
// Days on the left, times on the right. Rows from the werkbank carry weekdays
|
|
3
|
+
// and times, rows written by hand a label and their times. A closure stands
|
|
4
|
+
// above the rows while it is announced.
|
|
5
|
+
import { siteLocale } from '../dist/config.js';
|
|
6
|
+
import {
|
|
7
|
+
type Closure,
|
|
8
|
+
closureEnd,
|
|
9
|
+
closureStart,
|
|
10
|
+
closureText,
|
|
11
|
+
type HoursLine,
|
|
12
|
+
hoursLines,
|
|
13
|
+
type HoursRow,
|
|
14
|
+
type HoursTexts,
|
|
15
|
+
hoursTexts,
|
|
16
|
+
upcomingClosures,
|
|
17
|
+
} from '../dist/hours.js';
|
|
18
|
+
import Alert from './Alert.astro';
|
|
2
19
|
import ValueList from './ValueList.astro';
|
|
3
20
|
|
|
4
21
|
interface Props {
|
|
5
|
-
hours: readonly
|
|
22
|
+
hours: readonly (HoursRow | HoursLine)[];
|
|
23
|
+
closures?: readonly Closure[];
|
|
24
|
+
note?: string;
|
|
25
|
+
// The page's language on a site with several - weekdays and dates follow it.
|
|
26
|
+
locale?: string;
|
|
27
|
+
texts?: Partial<HoursTexts>;
|
|
6
28
|
}
|
|
7
29
|
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
30
|
+
const {
|
|
31
|
+
hours,
|
|
32
|
+
closures,
|
|
33
|
+
note,
|
|
34
|
+
locale = siteLocale,
|
|
35
|
+
texts: own = {},
|
|
36
|
+
} = Astro.props;
|
|
37
|
+
const texts = { ...hoursTexts(locale), ...own };
|
|
38
|
+
|
|
39
|
+
const items = hoursLines(hours, locale, texts).map(line => ({
|
|
40
|
+
label: line.days,
|
|
41
|
+
value: line.times,
|
|
11
42
|
}));
|
|
12
43
|
---
|
|
13
44
|
|
|
45
|
+
{
|
|
46
|
+
upcomingClosures(closures).map(closure => (
|
|
47
|
+
<div data-starts={closureStart(closure)} data-expires={closureEnd(closure)}>
|
|
48
|
+
<Alert type="warning" title={closureText(closure, locale, texts)} />
|
|
49
|
+
</div>
|
|
50
|
+
))
|
|
51
|
+
}
|
|
14
52
|
<ValueList items={items} />
|
|
53
|
+
{note?.trim() && <p class="mw-text-sm mw-text-muted mw-mt-5 mw-mb-0">{note}</p>}
|
|
@@ -2,16 +2,19 @@
|
|
|
2
2
|
interface Props {
|
|
3
3
|
title: string;
|
|
4
4
|
intro?: string;
|
|
5
|
+
// The small spaced line above the title - what kind of section this is.
|
|
6
|
+
eyebrow?: string;
|
|
5
7
|
numbered?: boolean;
|
|
6
8
|
// h1 for subpages, whose head is the page title as well.
|
|
7
9
|
level?: 'h1' | 'h2';
|
|
8
10
|
}
|
|
9
11
|
|
|
10
|
-
const { title, intro, numbered = false, level = 'h2' } = Astro.props;
|
|
12
|
+
const { title, intro, eyebrow, numbered = false, level = 'h2' } = Astro.props;
|
|
11
13
|
const Title = level;
|
|
12
14
|
---
|
|
13
15
|
|
|
14
16
|
<div class:list={['mw-section-head', numbered && 'mw-section-head-numbered']}>
|
|
17
|
+
{eyebrow && <p class="mw-text-eyebrow mw-mb-3">{eyebrow}</p>}
|
|
15
18
|
<Title class="mw-section-head-title">{title}</Title>
|
|
16
19
|
{intro && <p class="mw-section-head-intro">{intro}</p>}
|
|
17
20
|
<slot />
|
|
@@ -260,6 +260,7 @@ const look: LookOptions = {
|
|
|
260
260
|
markPreview,
|
|
261
261
|
paintAll,
|
|
262
262
|
type Piece,
|
|
263
|
+
type Rect,
|
|
263
264
|
WIDTH,
|
|
264
265
|
} from '../dist/story/base.js';
|
|
265
266
|
import {
|
|
@@ -944,6 +945,7 @@ const look: LookOptions = {
|
|
|
944
945
|
showReply: ['reply'],
|
|
945
946
|
reply: ['reply'],
|
|
946
947
|
footerOffset: ['call', 'reply'],
|
|
948
|
+
shiftLeft: ['logo', 'kicker', 'area', 'call', 'reply'],
|
|
947
949
|
logo: ['logo'],
|
|
948
950
|
logoOffset: ['logo'],
|
|
949
951
|
align: ['area'],
|
|
@@ -1036,6 +1038,103 @@ const look: LookOptions = {
|
|
|
1036
1038
|
inView = target.design;
|
|
1037
1039
|
};
|
|
1038
1040
|
|
|
1041
|
+
// Where Instagram lays its own controls over the picture, measured on
|
|
1042
|
+
// an iPhone. The taller screen cuts a strip off both sides of a reel.
|
|
1043
|
+
const CROP = 56;
|
|
1044
|
+
const ZONES: Record<
|
|
1045
|
+
string,
|
|
1046
|
+
readonly (Rect & { kind: string; label?: string })[]
|
|
1047
|
+
> = {
|
|
1048
|
+
story: [
|
|
1049
|
+
{
|
|
1050
|
+
kind: 'bar',
|
|
1051
|
+
x: 0,
|
|
1052
|
+
y: 0,
|
|
1053
|
+
width: WIDTH,
|
|
1054
|
+
height: 180,
|
|
1055
|
+
label: german ? 'Fortschritt und Profil' : 'Progress and profile',
|
|
1056
|
+
},
|
|
1057
|
+
{
|
|
1058
|
+
kind: 'bar',
|
|
1059
|
+
x: 0,
|
|
1060
|
+
y: 1700,
|
|
1061
|
+
width: WIDTH,
|
|
1062
|
+
height: 220,
|
|
1063
|
+
label: german ? 'Antworten und Teilen' : 'Reply and share',
|
|
1064
|
+
},
|
|
1065
|
+
],
|
|
1066
|
+
reel: [
|
|
1067
|
+
{
|
|
1068
|
+
kind: 'crop',
|
|
1069
|
+
x: 0,
|
|
1070
|
+
y: 0,
|
|
1071
|
+
width: CROP,
|
|
1072
|
+
height: HEIGHT,
|
|
1073
|
+
label: german ? 'Beschnitt am Handy' : 'Cut off on the phone',
|
|
1074
|
+
},
|
|
1075
|
+
{ kind: 'crop', x: WIDTH - CROP, y: 0, width: CROP, height: HEIGHT },
|
|
1076
|
+
{
|
|
1077
|
+
kind: 'bar',
|
|
1078
|
+
x: CROP,
|
|
1079
|
+
y: 170,
|
|
1080
|
+
width: WIDTH - CROP * 2,
|
|
1081
|
+
height: 80,
|
|
1082
|
+
label: german ? 'Zurück und Kamera' : 'Back and camera',
|
|
1083
|
+
},
|
|
1084
|
+
{
|
|
1085
|
+
kind: 'icons',
|
|
1086
|
+
x: 905,
|
|
1087
|
+
y: 1230,
|
|
1088
|
+
width: WIDTH - CROP - 905,
|
|
1089
|
+
height: 640,
|
|
1090
|
+
label: german ? 'Herz, Kommentar, Teilen' : 'Like, comment, share',
|
|
1091
|
+
},
|
|
1092
|
+
{
|
|
1093
|
+
kind: 'bar',
|
|
1094
|
+
x: 80,
|
|
1095
|
+
y: 1710,
|
|
1096
|
+
width: 740,
|
|
1097
|
+
height: 160,
|
|
1098
|
+
label: german ? 'Name und Beschreibung' : 'Name and caption',
|
|
1099
|
+
},
|
|
1100
|
+
{
|
|
1101
|
+
kind: 'feed',
|
|
1102
|
+
x: 0,
|
|
1103
|
+
y: (HEIGHT - 1350) / 2,
|
|
1104
|
+
width: WIDTH,
|
|
1105
|
+
height: 1350,
|
|
1106
|
+
label: german ? 'Ausschnitt im Feed' : 'Crop in the feed',
|
|
1107
|
+
},
|
|
1108
|
+
],
|
|
1109
|
+
};
|
|
1110
|
+
let instagram: string | null = null;
|
|
1111
|
+
const showInstagram = () => {
|
|
1112
|
+
for (const story of all.values()) {
|
|
1113
|
+
story.stage.querySelector('.mwa-story-instagram')?.remove();
|
|
1114
|
+
const zones = ZONES[instagram ?? ''];
|
|
1115
|
+
if (!zones) continue;
|
|
1116
|
+
const layer = document.createElement('div');
|
|
1117
|
+
layer.className = 'mwa-story-instagram';
|
|
1118
|
+
layer.setAttribute('aria-hidden', 'true');
|
|
1119
|
+
for (const zone of zones) {
|
|
1120
|
+
const box = document.createElement('div');
|
|
1121
|
+
box.className = `mwa-story-zone mwa-story-zone-${zone.kind}`;
|
|
1122
|
+
box.style.left = percent(zone.x, WIDTH);
|
|
1123
|
+
box.style.top = percent(zone.y, HEIGHT);
|
|
1124
|
+
box.style.width = percent(zone.width, WIDTH);
|
|
1125
|
+
box.style.height = percent(zone.height, HEIGHT);
|
|
1126
|
+
if (zone.label) {
|
|
1127
|
+
const tag = document.createElement('span');
|
|
1128
|
+
tag.className = 'mwa-story-zone-tag';
|
|
1129
|
+
tag.textContent = zone.label;
|
|
1130
|
+
box.append(tag);
|
|
1131
|
+
}
|
|
1132
|
+
layer.append(box);
|
|
1133
|
+
}
|
|
1134
|
+
story.stage.append(layer);
|
|
1135
|
+
}
|
|
1136
|
+
};
|
|
1137
|
+
|
|
1039
1138
|
addEventListener('message', event => {
|
|
1040
1139
|
if (event.source !== parent || event.data?.type !== 'mw-story-feld') {
|
|
1041
1140
|
return;
|
|
@@ -1045,6 +1144,14 @@ const look: LookOptions = {
|
|
|
1045
1144
|
all: event.data.beschriften === true,
|
|
1046
1145
|
};
|
|
1047
1146
|
mark();
|
|
1147
|
+
const zones =
|
|
1148
|
+
typeof event.data.instagram === 'string'
|
|
1149
|
+
? event.data.instagram
|
|
1150
|
+
: null;
|
|
1151
|
+
if (zones !== instagram) {
|
|
1152
|
+
instagram = zones;
|
|
1153
|
+
showInstagram();
|
|
1154
|
+
}
|
|
1048
1155
|
});
|
|
1049
1156
|
// The frame may have sent before this script was ready - it answers this.
|
|
1050
1157
|
parent.postMessage({ type: 'mw-story-bereit' }, '*');
|
package/dist/hours.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export declare const WEEKDAYS: readonly ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"];
|
|
2
|
+
export type Weekday = (typeof WEEKDAYS)[number];
|
|
3
|
+
export declare const HOURS_MODES: readonly ["open", "break", "closed"];
|
|
4
|
+
export interface HoursRow {
|
|
5
|
+
from: Weekday;
|
|
6
|
+
/** Empty: only the day in from. */
|
|
7
|
+
to?: Weekday | '';
|
|
8
|
+
mode?: (typeof HOURS_MODES)[number];
|
|
9
|
+
/** HH:MM */
|
|
10
|
+
opens?: string;
|
|
11
|
+
breakFrom?: string;
|
|
12
|
+
breakUntil?: string;
|
|
13
|
+
closes?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface OpeningHoursContent {
|
|
16
|
+
hours: readonly HoursRow[];
|
|
17
|
+
note?: string;
|
|
18
|
+
closures?: readonly Closure[];
|
|
19
|
+
}
|
|
20
|
+
export interface HoursLine {
|
|
21
|
+
days: string;
|
|
22
|
+
times: readonly string[];
|
|
23
|
+
}
|
|
24
|
+
export interface Closure {
|
|
25
|
+
/** YYYY-MM-DD, the first and the last closed day. */
|
|
26
|
+
from: string;
|
|
27
|
+
until: string;
|
|
28
|
+
text?: string;
|
|
29
|
+
/** YYYY-MM-DD from when on the closure shows. */
|
|
30
|
+
notice?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface HoursTexts {
|
|
33
|
+
/** Between two weekdays: "Montag bis Freitag". */
|
|
34
|
+
to: string;
|
|
35
|
+
closed: string;
|
|
36
|
+
/** A closure without its own text. */
|
|
37
|
+
closure: string;
|
|
38
|
+
on: string;
|
|
39
|
+
between: [string, string];
|
|
40
|
+
}
|
|
41
|
+
export declare const hoursTexts: (locale: string) => HoursTexts;
|
|
42
|
+
export declare const hoursLines: (rows: readonly (HoursRow | HoursLine)[], locale: string, texts: HoursTexts) => HoursLine[];
|
|
43
|
+
export declare const closureStart: (closure: Closure) => string;
|
|
44
|
+
export declare const closureEnd: (closure: Closure) => string;
|
|
45
|
+
export declare const upcomingClosures: (closures: readonly Closure[] | undefined, now?: Date) => Closure[];
|
|
46
|
+
export declare const closureText: (closure: Closure, locale: string, texts: HoursTexts) => string;
|
package/dist/hours.js
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
// Opening hours and closures as the werkbank keeps them (schemas/
|
|
2
|
+
// opening-hours.schema.json). A closure is in the HTML from the build on and
|
|
3
|
+
// shows in the browser only while it is announced (Schedule.astro), so it
|
|
4
|
+
// comes and goes on time without a new build.
|
|
5
|
+
import { addDays, parseIsoDate } from "./date.js";
|
|
6
|
+
import { endOfDay } from "./schedule.js";
|
|
7
|
+
export const WEEKDAYS = [
|
|
8
|
+
'monday',
|
|
9
|
+
'tuesday',
|
|
10
|
+
'wednesday',
|
|
11
|
+
'thursday',
|
|
12
|
+
'friday',
|
|
13
|
+
'saturday',
|
|
14
|
+
'sunday',
|
|
15
|
+
];
|
|
16
|
+
export const HOURS_MODES = ['open', 'break', 'closed'];
|
|
17
|
+
export const hoursTexts = (locale) => locale.startsWith('de')
|
|
18
|
+
? {
|
|
19
|
+
to: 'bis',
|
|
20
|
+
closed: 'geschlossen',
|
|
21
|
+
closure: 'Urlaub',
|
|
22
|
+
on: 'am',
|
|
23
|
+
between: ['vom', 'bis'],
|
|
24
|
+
}
|
|
25
|
+
: {
|
|
26
|
+
to: 'to',
|
|
27
|
+
closed: 'closed',
|
|
28
|
+
closure: 'Closed',
|
|
29
|
+
on: 'on',
|
|
30
|
+
between: ['from', 'to'],
|
|
31
|
+
};
|
|
32
|
+
const ANNOUNCE_DAYS = 14;
|
|
33
|
+
const TIME = /^\d{2}:\d{2}$/;
|
|
34
|
+
const DATE = /^\d{4}-\d{2}-\d{2}$/;
|
|
35
|
+
// 1 January 2024 was a Monday.
|
|
36
|
+
const weekdayName = (day, locale) => new Date(2024, 0, 1 + WEEKDAYS.indexOf(day)).toLocaleDateString(locale, {
|
|
37
|
+
weekday: 'long',
|
|
38
|
+
});
|
|
39
|
+
const dayLabel = (row, locale, texts) => row.to && row.to !== row.from
|
|
40
|
+
? `${weekdayName(row.from, locale)} ${texts.to} ${weekdayName(row.to, locale)}`
|
|
41
|
+
: weekdayName(row.from, locale);
|
|
42
|
+
const span = (from, until) => from && until && TIME.test(from) && TIME.test(until)
|
|
43
|
+
? [`${from} - ${until}`]
|
|
44
|
+
: [];
|
|
45
|
+
const timesOf = (row) => {
|
|
46
|
+
if (row.mode === 'closed')
|
|
47
|
+
return [];
|
|
48
|
+
if (row.mode === 'break') {
|
|
49
|
+
return [
|
|
50
|
+
...span(row.opens, row.breakFrom),
|
|
51
|
+
...span(row.breakUntil, row.closes),
|
|
52
|
+
];
|
|
53
|
+
}
|
|
54
|
+
return span(row.opens, row.closes);
|
|
55
|
+
};
|
|
56
|
+
const isRow = (row) => WEEKDAYS.includes(row.from);
|
|
57
|
+
// A row that is open but has no times yet stays out - "closed" there would
|
|
58
|
+
// send people away on a day the door is open.
|
|
59
|
+
export const hoursLines = (rows, locale, texts) => rows.flatMap(row => {
|
|
60
|
+
if (!isRow(row))
|
|
61
|
+
return [row];
|
|
62
|
+
const times = timesOf(row);
|
|
63
|
+
if (times.length === 0 && row.mode !== 'closed')
|
|
64
|
+
return [];
|
|
65
|
+
return [
|
|
66
|
+
{
|
|
67
|
+
days: dayLabel(row, locale, texts),
|
|
68
|
+
times: times.length > 0 ? times : [texts.closed],
|
|
69
|
+
},
|
|
70
|
+
];
|
|
71
|
+
});
|
|
72
|
+
const validClosure = (closure) => DATE.test(closure.from ?? '') &&
|
|
73
|
+
DATE.test(closure.until ?? '') &&
|
|
74
|
+
closure.until >= closure.from;
|
|
75
|
+
// Value for data-starts: midnight of the day it is announced.
|
|
76
|
+
export const closureStart = (closure) => {
|
|
77
|
+
const notice = closure.notice ?? '';
|
|
78
|
+
return (DATE.test(notice)
|
|
79
|
+
? parseIsoDate(notice)
|
|
80
|
+
: addDays(parseIsoDate(closure.from), -ANNOUNCE_DAYS)).toISOString();
|
|
81
|
+
};
|
|
82
|
+
// Value for data-expires: the end of the last closed day. No grace hours as
|
|
83
|
+
// with events - the next morning the door is open again.
|
|
84
|
+
export const closureEnd = (closure) => endOfDay(closure.until)?.toISOString() ?? '';
|
|
85
|
+
export const upcomingClosures = (closures, now = new Date()) => (closures ?? [])
|
|
86
|
+
.filter(closure => {
|
|
87
|
+
const end = validClosure(closure) && endOfDay(closure.until);
|
|
88
|
+
return end && end >= now;
|
|
89
|
+
})
|
|
90
|
+
.sort((a, b) => a.from.localeCompare(b.from));
|
|
91
|
+
const shortDate = (date, locale) => parseIsoDate(date).toLocaleDateString(locale, {
|
|
92
|
+
day: 'numeric',
|
|
93
|
+
month: 'numeric',
|
|
94
|
+
});
|
|
95
|
+
export const closureText = (closure, locale, texts) => {
|
|
96
|
+
const label = closure.text?.trim() || texts.closure;
|
|
97
|
+
if (closure.from === closure.until) {
|
|
98
|
+
return `${label} ${texts.on} ${shortDate(closure.from, locale)}`;
|
|
99
|
+
}
|
|
100
|
+
const [from, until] = texts.between;
|
|
101
|
+
return `${label} ${from} ${shortDate(closure.from, locale)} ${until} ${shortDate(closure.until, locale)}`;
|
|
102
|
+
};
|
package/dist/story/base.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ declare const MARGINS: {
|
|
|
15
15
|
export { STEP };
|
|
16
16
|
export declare const LOGO_STEPS: readonly [-15, 30];
|
|
17
17
|
export declare const FOOTER_STEPS: readonly [-20, 10];
|
|
18
|
+
export declare const SHIFT_STEPS: readonly [0, 6];
|
|
18
19
|
type Surface = 'card' | 'square' | 'round' | 'outline' | 'band' | 'glass' | 'none';
|
|
19
20
|
interface Design {
|
|
20
21
|
background: 'gradient' | 'solid' | 'light';
|
|
@@ -36,6 +37,7 @@ export interface Frame extends Pick<Design, 'background' | 'logo' | 'align' | 's
|
|
|
36
37
|
/** Pixels, already clamped to the steps the schema allows. */
|
|
37
38
|
logoOffset: number;
|
|
38
39
|
footerOffset: number;
|
|
40
|
+
shiftLeft: number;
|
|
39
41
|
height: Design['areaHeight'];
|
|
40
42
|
position: Design['areaPosition'];
|
|
41
43
|
margin: number;
|
|
@@ -134,6 +136,7 @@ export interface Piece {
|
|
|
134
136
|
slots?: readonly number[];
|
|
135
137
|
}
|
|
136
138
|
export declare const paintAll: (pieces: readonly Piece[]) => void;
|
|
139
|
+
export declare const shiftedLeft: (ctx: CanvasRenderingContext2D, frame: Frame, pieces: Piece[]) => Piece[];
|
|
137
140
|
export interface Block {
|
|
138
141
|
height: number;
|
|
139
142
|
gap: number;
|
package/dist/story/base.js
CHANGED
|
@@ -36,6 +36,9 @@ export { STEP };
|
|
|
36
36
|
// 160px below where Instagram starts covering it.
|
|
37
37
|
export const LOGO_STEPS = [-15, 30];
|
|
38
38
|
export const FOOTER_STEPS = [-20, 10];
|
|
39
|
+
// On a reel Instagram's buttons cover the right edge from the middle down -
|
|
40
|
+
// 60px clear them and still keep the text off the left edge the phone cuts.
|
|
41
|
+
export const SHIFT_STEPS = [0, 6];
|
|
39
42
|
const DESIGNS = {
|
|
40
43
|
classic: {
|
|
41
44
|
background: 'gradient',
|
|
@@ -154,6 +157,7 @@ export const frameFor = (look = {}) => {
|
|
|
154
157
|
logo: choice(look.logo, ['left', 'center', 'right'], design.logo),
|
|
155
158
|
logoOffset: pixels(look.logoOffset, LOGO_STEPS),
|
|
156
159
|
footerOffset: pixels(look.footerOffset, FOOTER_STEPS),
|
|
160
|
+
shiftLeft: pixels(look.shiftLeft, SHIFT_STEPS),
|
|
157
161
|
align: choice(look.align, ['left', 'center'], design.align),
|
|
158
162
|
height: choice(look.areaHeight, ['full', 'fit'], design.areaHeight),
|
|
159
163
|
position: choice(look.areaPosition, ['top', 'middle', 'bottom'], design.areaPosition),
|
|
@@ -393,6 +397,24 @@ export const paintAll = (pieces) => {
|
|
|
393
397
|
for (const piece of pieces)
|
|
394
398
|
piece.paint();
|
|
395
399
|
};
|
|
400
|
+
// The background stays where it is, so no edge shows on the right.
|
|
401
|
+
export const shiftedLeft = (ctx, frame, pieces) => {
|
|
402
|
+
const by = frame.shiftLeft;
|
|
403
|
+
if (!by)
|
|
404
|
+
return pieces;
|
|
405
|
+
return pieces.map(piece => piece.kind === 'background'
|
|
406
|
+
? piece
|
|
407
|
+
: {
|
|
408
|
+
...piece,
|
|
409
|
+
box: { ...piece.box, x: piece.box.x - by },
|
|
410
|
+
paint: () => {
|
|
411
|
+
ctx.save();
|
|
412
|
+
ctx.translate(-by, 0);
|
|
413
|
+
piece.paint();
|
|
414
|
+
ctx.restore();
|
|
415
|
+
},
|
|
416
|
+
});
|
|
417
|
+
};
|
|
396
418
|
export const totalHeight = (blocks) => blocks.reduce((sum, b) => sum + b.height + b.gap, 0) -
|
|
397
419
|
(blocks.at(-1)?.gap ?? 0);
|
|
398
420
|
export const paintColumn = (blocks, top) => {
|
package/dist/story/cards.d.ts
CHANGED
|
@@ -67,6 +67,8 @@ export interface StoryLookConfig {
|
|
|
67
67
|
areaPosition?: 'top' | 'middle' | 'bottom';
|
|
68
68
|
/** Call to action and note together, in steps like the logo. */
|
|
69
69
|
footerOffset?: number;
|
|
70
|
+
/** Steps like the logo, everything but the background to the left. */
|
|
71
|
+
shiftLeft?: number;
|
|
70
72
|
/** A video instead of an image. The choices below are empty as well. */
|
|
71
73
|
motion?: boolean;
|
|
72
74
|
entrance?: Entrance;
|
package/dist/story/event.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// after it stand beside it. A price in the last place sits at the bottom of the
|
|
8
8
|
// card and keeps its place. Everything else follows from top to bottom, and
|
|
9
9
|
// the next block that no longer fits ends the card.
|
|
10
|
-
import { CLASSIC, divider, drawArea, drawBackground, drawSurface, fitLine, footerPieces, HEIGHT, iconRow, inkFor, OVERHANG, PADDING, paintColumn, pill, place, spaced, textBlock, topBarPieces, totalHeight, WIDTH, } from "./base.js";
|
|
10
|
+
import { CLASSIC, divider, drawArea, drawBackground, drawSurface, fitLine, footerPieces, HEIGHT, iconRow, inkFor, OVERHANG, PADDING, paintColumn, pill, place, shiftedLeft, spaced, textBlock, topBarPieces, totalHeight, WIDTH, } from "./base.js";
|
|
11
11
|
import { eventBlocks, } from "./cards.js";
|
|
12
12
|
const TILE_WIDTH = 216;
|
|
13
13
|
const WEEKDAY_SIZES = [
|
|
@@ -363,7 +363,7 @@ overhang) => {
|
|
|
363
363
|
});
|
|
364
364
|
}
|
|
365
365
|
pieces.push(...footerPieces(ctx, look, frame, texts.footer, texts.reply));
|
|
366
|
-
return pieces;
|
|
366
|
+
return shiftedLeft(ctx, frame, pieces);
|
|
367
367
|
};
|
|
368
368
|
export const eventPieces = (ctx, card, look, frame = CLASSIC) => blockPieces(ctx, eventBlocks(card), look, frame, {
|
|
369
369
|
kicker: look.texts.eventKicker,
|
package/dist/story/promo.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Story image for the running promotion: the discount as a badge that sticks
|
|
2
2
|
// out of the card, the time left beside it, the prices below - each one struck
|
|
3
3
|
// through once and once with the discount.
|
|
4
|
-
import { CLASSIC, divider, drawArea, drawBackground, fitLine, footerPieces, HEIGHT, inkFor, onDarkGround, PADDING, place, textBlock, topBarPieces, totalHeight, WIDTH, } from "./base.js";
|
|
4
|
+
import { CLASSIC, divider, drawArea, drawBackground, fitLine, footerPieces, HEIGHT, inkFor, onDarkGround, PADDING, place, shiftedLeft, textBlock, topBarPieces, totalHeight, WIDTH, } from "./base.js";
|
|
5
5
|
import { daysLeft } from "./cards.js";
|
|
6
6
|
const BADGE_RADIUS = 150;
|
|
7
7
|
const MINI_GAP = 24;
|
|
@@ -257,5 +257,5 @@ export const promoPieces = (ctx, card, look, frame = CLASSIC) => {
|
|
|
257
257
|
at += mini.height + mini.gap;
|
|
258
258
|
}
|
|
259
259
|
pieces.push(...footerPieces(ctx, look, frame, texts.promoFooter, texts.reply));
|
|
260
|
-
return pieces;
|
|
260
|
+
return shiftedLeft(ctx, frame, pieces);
|
|
261
261
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "maverick-wave-astro",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.23.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,7 @@
|
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"astro": "^7.2.0",
|
|
56
|
-
"maverick-wave": "^6.
|
|
56
|
+
"maverick-wave": "^6.15.0"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"@astrojs/sitemap": "^3.7.3",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"eslint-plugin-astro": "^1.5.0",
|
|
69
69
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
70
70
|
"globals": "^16.5.0",
|
|
71
|
-
"maverick-wave": "^6.
|
|
71
|
+
"maverick-wave": "^6.15.0",
|
|
72
72
|
"playwright-core": "^1.64.0",
|
|
73
73
|
"prettier": "^3.6.2",
|
|
74
74
|
"prettier-plugin-astro": "^0.14.1",
|
|
@@ -108,7 +108,8 @@
|
|
|
108
108
|
"x-empty": "Wie eingerichtet"
|
|
109
109
|
},
|
|
110
110
|
"links": {
|
|
111
|
-
"title": "Links
|
|
111
|
+
"title": "Links neben Buttons",
|
|
112
|
+
"description": "Links im Text sind immer unterstrichen.",
|
|
112
113
|
"type": "string",
|
|
113
114
|
"enum": ["default", "underline"],
|
|
114
115
|
"x-labels": {
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "Öffnungszeiten",
|
|
4
|
+
"description": "Wann du da bist und wann nicht. Ein Urlaub erscheint vorher auf der Startseite und über den Öffnungszeiten und verschwindet nach seinem letzten Tag von selbst.",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["hours"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"hours": {
|
|
10
|
+
"title": "Öffnungszeiten",
|
|
11
|
+
"description": "Eine Zeile für jeden Tag oder für mehrere Tage mit denselben Zeiten, zum Beispiel Montag bis Freitag.",
|
|
12
|
+
"type": "array",
|
|
13
|
+
"x-item-title": "{from} {to}",
|
|
14
|
+
"items": {
|
|
15
|
+
"title": "Zeile",
|
|
16
|
+
"type": "object",
|
|
17
|
+
"additionalProperties": false,
|
|
18
|
+
"required": ["from", "mode"],
|
|
19
|
+
"properties": {
|
|
20
|
+
"from": {
|
|
21
|
+
"title": "Tag",
|
|
22
|
+
"type": "string",
|
|
23
|
+
"enum": [
|
|
24
|
+
"monday",
|
|
25
|
+
"tuesday",
|
|
26
|
+
"wednesday",
|
|
27
|
+
"thursday",
|
|
28
|
+
"friday",
|
|
29
|
+
"saturday",
|
|
30
|
+
"sunday"
|
|
31
|
+
],
|
|
32
|
+
"x-labels": {
|
|
33
|
+
"monday": "Montag",
|
|
34
|
+
"tuesday": "Dienstag",
|
|
35
|
+
"wednesday": "Mittwoch",
|
|
36
|
+
"thursday": "Donnerstag",
|
|
37
|
+
"friday": "Freitag",
|
|
38
|
+
"saturday": "Samstag",
|
|
39
|
+
"sunday": "Sonntag"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"to": {
|
|
43
|
+
"title": "Bis",
|
|
44
|
+
"type": "string",
|
|
45
|
+
"enum": [
|
|
46
|
+
"monday",
|
|
47
|
+
"tuesday",
|
|
48
|
+
"wednesday",
|
|
49
|
+
"thursday",
|
|
50
|
+
"friday",
|
|
51
|
+
"saturday",
|
|
52
|
+
"sunday"
|
|
53
|
+
],
|
|
54
|
+
"x-labels": {
|
|
55
|
+
"monday": "bis Montag",
|
|
56
|
+
"tuesday": "bis Dienstag",
|
|
57
|
+
"wednesday": "bis Mittwoch",
|
|
58
|
+
"thursday": "bis Donnerstag",
|
|
59
|
+
"friday": "bis Freitag",
|
|
60
|
+
"saturday": "bis Samstag",
|
|
61
|
+
"sunday": "bis Sonntag"
|
|
62
|
+
},
|
|
63
|
+
"x-empty": "nur dieser Tag"
|
|
64
|
+
},
|
|
65
|
+
"mode": {
|
|
66
|
+
"title": "Geöffnet",
|
|
67
|
+
"type": "string",
|
|
68
|
+
"enum": ["open", "break", "closed"],
|
|
69
|
+
"x-labels": {
|
|
70
|
+
"open": "Durchgehend",
|
|
71
|
+
"break": "Mit Mittagspause",
|
|
72
|
+
"closed": "Geschlossen"
|
|
73
|
+
},
|
|
74
|
+
"default": "open"
|
|
75
|
+
},
|
|
76
|
+
"opens": {
|
|
77
|
+
"title": "Öffnet",
|
|
78
|
+
"type": "string",
|
|
79
|
+
"x-widget": "time",
|
|
80
|
+
"pattern": "^\\d{2}:\\d{2}$",
|
|
81
|
+
"x-show-if": {
|
|
82
|
+
"mode": ["open", "break"]
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"breakFrom": {
|
|
86
|
+
"title": "Pause ab",
|
|
87
|
+
"type": "string",
|
|
88
|
+
"x-widget": "time",
|
|
89
|
+
"pattern": "^\\d{2}:\\d{2}$",
|
|
90
|
+
"x-not-before": "opens",
|
|
91
|
+
"x-show-if": {
|
|
92
|
+
"mode": "break"
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
"breakUntil": {
|
|
96
|
+
"title": "Pause bis",
|
|
97
|
+
"type": "string",
|
|
98
|
+
"x-widget": "time",
|
|
99
|
+
"pattern": "^\\d{2}:\\d{2}$",
|
|
100
|
+
"x-not-before": "breakFrom",
|
|
101
|
+
"x-show-if": {
|
|
102
|
+
"mode": "break"
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
"closes": {
|
|
106
|
+
"title": "Schließt",
|
|
107
|
+
"type": "string",
|
|
108
|
+
"x-widget": "time",
|
|
109
|
+
"pattern": "^\\d{2}:\\d{2}$",
|
|
110
|
+
"x-show-if": {
|
|
111
|
+
"mode": ["open", "break"]
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
"note": {
|
|
118
|
+
"title": "Hinweis unter den Zeiten",
|
|
119
|
+
"description": "Zum Beispiel „Die Küche schließt eine Stunde früher.“ Leer lassen, wenn es nichts zu sagen gibt.",
|
|
120
|
+
"type": "string"
|
|
121
|
+
},
|
|
122
|
+
"closures": {
|
|
123
|
+
"title": "Urlaub und geschlossene Tage",
|
|
124
|
+
"description": "Steht ab „Ankündigen ab“ auf der Startseite und über den Öffnungszeiten, nach dem letzten Tag verschwindet er von selbst.",
|
|
125
|
+
"type": "array",
|
|
126
|
+
"x-item-title": "{from} bis {until}",
|
|
127
|
+
"items": {
|
|
128
|
+
"title": "Urlaub",
|
|
129
|
+
"type": "object",
|
|
130
|
+
"additionalProperties": false,
|
|
131
|
+
"required": ["from", "until"],
|
|
132
|
+
"properties": {
|
|
133
|
+
"from": {
|
|
134
|
+
"title": "Erster Tag",
|
|
135
|
+
"type": "string",
|
|
136
|
+
"format": "date",
|
|
137
|
+
"pattern": "^\\d{4}-\\d{2}-\\d{2}$"
|
|
138
|
+
},
|
|
139
|
+
"until": {
|
|
140
|
+
"title": "Letzter Tag",
|
|
141
|
+
"description": "Bei einem einzelnen Tag derselbe wie der erste.",
|
|
142
|
+
"type": "string",
|
|
143
|
+
"format": "date",
|
|
144
|
+
"pattern": "^\\d{4}-\\d{2}-\\d{2}$",
|
|
145
|
+
"x-not-before": "from"
|
|
146
|
+
},
|
|
147
|
+
"text": {
|
|
148
|
+
"title": "Text",
|
|
149
|
+
"description": "Leer: „Urlaub“. Zum Beispiel „Betriebsurlaub“ oder „Wir renovieren“, die Daten hängt die Seite selbst an.",
|
|
150
|
+
"type": "string"
|
|
151
|
+
},
|
|
152
|
+
"notice": {
|
|
153
|
+
"title": "Ankündigen ab",
|
|
154
|
+
"description": "Leer: zwei Wochen vor dem ersten Tag.",
|
|
155
|
+
"type": "string",
|
|
156
|
+
"format": "date",
|
|
157
|
+
"pattern": "^\\d{4}-\\d{2}-\\d{2}$"
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
3
|
"title": "Stories",
|
|
4
|
-
"description": "Deine Story-Designs. Jedes beginnt mit einem Grundaufbau, alles darunter steht auf „Wie im Design“ und lässt sich einzeln ändern. Die Vorschau rechts zeigt jede Änderung sofort, online geht sie erst mit „Veröffentlichen“. Welches Design eine Story bekommt, wählst du im Reiter Story eines Bereichs, zum Beispiel bei den Workshops.",
|
|
4
|
+
"description": "Deine Story-Designs. Jedes beginnt mit einem Grundaufbau, alles darunter steht auf „Wie im Design“ und lässt sich einzeln ändern. Die Vorschau rechts zeigt jede Änderung sofort, online geht sie erst mit „Veröffentlichen“. Welches Design eine Story bekommt, wählst du im Reiter Story eines Bereichs, zum Beispiel bei den Workshops. Als Video kannst du jede Story auch als Reel posten.",
|
|
5
5
|
"type": "object",
|
|
6
6
|
"additionalProperties": false,
|
|
7
7
|
"required": ["designs"],
|
|
@@ -42,6 +42,10 @@
|
|
|
42
42
|
"title": "Aufruf und Hinweis",
|
|
43
43
|
"fields": ["footerOffset"]
|
|
44
44
|
},
|
|
45
|
+
{
|
|
46
|
+
"title": "Für Reels",
|
|
47
|
+
"fields": ["shiftLeft"]
|
|
48
|
+
},
|
|
45
49
|
{
|
|
46
50
|
"title": "Bewegung",
|
|
47
51
|
"fields": ["motion", "entrance", "effect", "backdrop", "seconds"]
|
|
@@ -252,9 +256,18 @@
|
|
|
252
256
|
"x-widget": "slider",
|
|
253
257
|
"default": 0
|
|
254
258
|
},
|
|
259
|
+
"shiftLeft": {
|
|
260
|
+
"title": "Alles nach links rücken",
|
|
261
|
+
"description": "Bei einem Reel liegen rechts Herz, Kommentar und Teilen über dem Bild. Wo genau, zeigt die Vorschau mit „Instagram einblenden: Reel“. Jede Stufe rückt Logo, Inhaltsbox, Aufruf und Hinweis 10 Pixel nach links, der Hintergrund bleibt. Für Stories reicht 0. Am besten legst du dir für Reels ein eigenes Design an.",
|
|
262
|
+
"type": "integer",
|
|
263
|
+
"minimum": 0,
|
|
264
|
+
"maximum": 6,
|
|
265
|
+
"x-widget": "slider",
|
|
266
|
+
"default": 0
|
|
267
|
+
},
|
|
255
268
|
"motion": {
|
|
256
269
|
"title": "Als Video",
|
|
257
|
-
"description": "Die Story wird ein kurzes Video statt eines Bildes: Logo, Inhaltsbox und Zeilen kommen nacheinander herein, danach bleibt alles an seinem Platz. Die Vorschau spielt das Video in einer Schleife ab. Gehört zum Zusatz „Bewegte Stories“.",
|
|
270
|
+
"description": "Die Story wird ein kurzes Video statt eines Bildes: Logo, Inhaltsbox und Zeilen kommen nacheinander herein, danach bleibt alles an seinem Platz. Die Vorschau spielt das Video in einer Schleife ab. Du postest es als Story oder als Reel. Gehört zum Zusatz „Bewegte Stories“.",
|
|
258
271
|
"type": "boolean",
|
|
259
272
|
"default": false,
|
|
260
273
|
"x-package": "stories-video"
|
package/styles/hours.css
ADDED
package/styles/story-cards.css
CHANGED
|
@@ -238,3 +238,71 @@ html:has(.mwa-story-cards-preview) {
|
|
|
238
238
|
background: #ffd60a;
|
|
239
239
|
color: #111;
|
|
240
240
|
}
|
|
241
|
+
|
|
242
|
+
/* What Instagram lays over a story or a reel, switched on in the werkbank's
|
|
243
|
+
preview. Pink, so it never looks like the yellow frame of a field. */
|
|
244
|
+
.mwa-story-instagram {
|
|
245
|
+
position: absolute;
|
|
246
|
+
inset: 0;
|
|
247
|
+
z-index: 2;
|
|
248
|
+
overflow: hidden;
|
|
249
|
+
border-radius: 0.75rem;
|
|
250
|
+
pointer-events: none;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.mwa-story-zone {
|
|
254
|
+
position: absolute;
|
|
255
|
+
box-sizing: border-box;
|
|
256
|
+
border: 2px dashed rgb(255 60 170 / 0.9);
|
|
257
|
+
background: rgb(255 60 170 / 0.22);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.mwa-story-zone-crop {
|
|
261
|
+
border-style: dotted;
|
|
262
|
+
background: repeating-linear-gradient(
|
|
263
|
+
45deg,
|
|
264
|
+
rgb(255 60 170 / 0.4) 0 4px,
|
|
265
|
+
transparent 4px 8px
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.mwa-story-zone-feed {
|
|
270
|
+
border-style: dotted;
|
|
271
|
+
background: none;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.mwa-story-zone-tag {
|
|
275
|
+
position: absolute;
|
|
276
|
+
top: 0.3em;
|
|
277
|
+
left: 0.3em;
|
|
278
|
+
padding: 0.1em 0.45em;
|
|
279
|
+
border-radius: 999px;
|
|
280
|
+
background: rgb(255 60 170 / 0.95);
|
|
281
|
+
color: #fff;
|
|
282
|
+
font:
|
|
283
|
+
600 max(10px, 3.4cqi) / 1.3 system-ui,
|
|
284
|
+
sans-serif;
|
|
285
|
+
white-space: nowrap;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/* The icon column is too narrow for its name - it goes above it. */
|
|
289
|
+
.mwa-story-zone-icons .mwa-story-zone-tag {
|
|
290
|
+
top: auto;
|
|
291
|
+
bottom: 100%;
|
|
292
|
+
left: auto;
|
|
293
|
+
right: 0;
|
|
294
|
+
margin-bottom: 2px;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
.mwa-story-zone-crop .mwa-story-zone-tag {
|
|
298
|
+
top: 50%;
|
|
299
|
+
left: 50%;
|
|
300
|
+
writing-mode: vertical-rl;
|
|
301
|
+
translate: -50% -50%;
|
|
302
|
+
rotate: 180deg;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
.mwa-story-zone-feed .mwa-story-zone-tag {
|
|
306
|
+
left: auto;
|
|
307
|
+
right: 6%;
|
|
308
|
+
}
|