maverick-wave-astro 1.11.0 → 1.12.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/StoryCards.astro +30 -2
- package/dist/story/base.d.ts +66 -21
- package/dist/story/base.js +372 -90
- package/dist/story/cards.d.ts +12 -1
- package/dist/story/cards.js +27 -3
- package/dist/story/event.js +127 -105
- package/dist/story/promo.d.ts +1 -1
- package/dist/story/promo.js +126 -94
- package/package.json +1 -1
|
@@ -24,6 +24,7 @@ import type { LookOptions, StoryIcon } from '../dist/story/base.js';
|
|
|
24
24
|
import {
|
|
25
25
|
promoOffers,
|
|
26
26
|
type StoryCard,
|
|
27
|
+
storyDate,
|
|
27
28
|
type StoryEvent,
|
|
28
29
|
storyFileName,
|
|
29
30
|
type StoryOffer,
|
|
@@ -46,7 +47,14 @@ interface Props extends StoryLook {
|
|
|
46
47
|
free?: string;
|
|
47
48
|
currency?: string;
|
|
48
49
|
until?: string;
|
|
49
|
-
|
|
50
|
+
untilTomorrow?: string;
|
|
51
|
+
lastDay?: string;
|
|
52
|
+
// With {n} for the number of days.
|
|
53
|
+
daysLeft?: string;
|
|
54
|
+
// The label top left, e.g. "Workshop" instead of the general "Termin".
|
|
55
|
+
eventKicker?: string;
|
|
56
|
+
promoKicker?: string;
|
|
57
|
+
// The call to action below the card, e.g. where to sign up or book.
|
|
50
58
|
eventFooter?: string;
|
|
51
59
|
promoFooter?: string;
|
|
52
60
|
// A second line below both, e.g. an invitation to reply to the story.
|
|
@@ -76,6 +84,11 @@ const {
|
|
|
76
84
|
free = german ? 'kostenlos' : 'free',
|
|
77
85
|
currency = 'Euro',
|
|
78
86
|
until = german ? 'Nur noch bis' : 'Only until',
|
|
87
|
+
untilTomorrow = german ? 'Nur noch bis morgen' : 'Ends tomorrow',
|
|
88
|
+
lastDay = german ? 'Nur noch heute' : 'Last day today',
|
|
89
|
+
daysLeft = german ? 'Nur noch {n} Tage' : 'Only {n} days left',
|
|
90
|
+
eventKicker = german ? 'Termin' : 'Event',
|
|
91
|
+
promoKicker = german ? 'Aktion' : 'Offer',
|
|
79
92
|
eventFooter,
|
|
80
93
|
promoFooter,
|
|
81
94
|
reply,
|
|
@@ -96,6 +109,7 @@ const eventStories = upcomingEvents(events).map((entry): Story => ({
|
|
|
96
109
|
kind: 'event',
|
|
97
110
|
title: entry.title,
|
|
98
111
|
date: eventDateText(entry),
|
|
112
|
+
stamp: storyDate(entry.date),
|
|
99
113
|
time: entry.time,
|
|
100
114
|
location: entry.location,
|
|
101
115
|
price: entry.price !== undefined ? String(entry.price) : undefined,
|
|
@@ -119,6 +133,7 @@ const promoStories: Story[] =
|
|
|
119
133
|
percent: discountText(promo),
|
|
120
134
|
title: promo.text,
|
|
121
135
|
until: promoEndDate(promo),
|
|
136
|
+
untilIso: promo.until,
|
|
122
137
|
offers: discounted,
|
|
123
138
|
},
|
|
124
139
|
label: promoText(promo),
|
|
@@ -142,7 +157,20 @@ const look: LookOptions = {
|
|
|
142
157
|
location: icons.location ?? PACKAGE_ICONS['map-pin'],
|
|
143
158
|
sparkle: icons.sparkle ?? PACKAGE_ICONS.sparkle,
|
|
144
159
|
},
|
|
145
|
-
texts: {
|
|
160
|
+
texts: {
|
|
161
|
+
soldOut,
|
|
162
|
+
free,
|
|
163
|
+
currency,
|
|
164
|
+
until,
|
|
165
|
+
untilTomorrow,
|
|
166
|
+
lastDay,
|
|
167
|
+
daysLeft,
|
|
168
|
+
eventKicker,
|
|
169
|
+
promoKicker,
|
|
170
|
+
eventFooter,
|
|
171
|
+
promoFooter,
|
|
172
|
+
reply,
|
|
173
|
+
},
|
|
146
174
|
};
|
|
147
175
|
---
|
|
148
176
|
|
package/dist/story/base.d.ts
CHANGED
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
import type { StoryLook } from '../types.ts';
|
|
2
2
|
export declare const WIDTH = 1080;
|
|
3
3
|
export declare const HEIGHT = 1920;
|
|
4
|
-
export declare const mw: (value: number) => number;
|
|
5
|
-
export declare const MARGIN = 66;
|
|
6
4
|
export declare const PADDING = 76;
|
|
5
|
+
export declare const LEFT: number;
|
|
7
6
|
export declare const CONTENT_WIDTH: number;
|
|
7
|
+
export declare const OVERHANG = 72;
|
|
8
|
+
type Rgb = readonly [number, number, number];
|
|
8
9
|
export type StoryIcon = 'calendar' | 'clock' | 'location' | 'sparkle';
|
|
9
10
|
export interface StoryTexts {
|
|
10
11
|
soldOut: string;
|
|
11
12
|
free: string;
|
|
12
13
|
currency: string;
|
|
13
14
|
until: string;
|
|
15
|
+
untilTomorrow: string;
|
|
16
|
+
lastDay: string;
|
|
17
|
+
/** With {n} for the number of days. */
|
|
18
|
+
daysLeft: string;
|
|
19
|
+
eventKicker?: string;
|
|
20
|
+
promoKicker?: string;
|
|
14
21
|
eventFooter?: string;
|
|
15
22
|
promoFooter?: string;
|
|
16
23
|
reply?: string;
|
|
@@ -20,32 +27,43 @@ export interface LookOptions extends StoryLook {
|
|
|
20
27
|
texts: StoryTexts;
|
|
21
28
|
}
|
|
22
29
|
export type Look = Awaited<ReturnType<typeof loadLook>>;
|
|
30
|
+
export interface Stage {
|
|
31
|
+
top: number;
|
|
32
|
+
bottom: number;
|
|
33
|
+
height: number;
|
|
34
|
+
}
|
|
23
35
|
export declare const loadLook: (options: LookOptions) => Promise<{
|
|
24
36
|
colors: {
|
|
25
|
-
grayClear: string;
|
|
26
37
|
primary: string;
|
|
27
38
|
secondary: string;
|
|
28
39
|
text: string;
|
|
29
40
|
muted: string;
|
|
30
41
|
graySurface: string;
|
|
31
|
-
secondarySurface: string;
|
|
32
42
|
accent: string;
|
|
33
43
|
shadowNear: string;
|
|
34
44
|
shadowFar: string;
|
|
45
|
+
primaryRgb: Rgb;
|
|
46
|
+
secondaryRgb: Rgb;
|
|
47
|
+
grayClear: string;
|
|
48
|
+
accentText: string;
|
|
49
|
+
onPrimary: string;
|
|
50
|
+
onSecondary: string;
|
|
35
51
|
};
|
|
36
52
|
font: (size: number, weight?: number) => string;
|
|
53
|
+
heading: (size: number, weight?: number) => string;
|
|
37
54
|
radii: number[];
|
|
38
55
|
logo: {
|
|
39
56
|
width: number;
|
|
40
57
|
height: number;
|
|
41
58
|
image: HTMLImageElement;
|
|
42
|
-
};
|
|
59
|
+
} | null;
|
|
43
60
|
icons: {
|
|
44
|
-
calendar: HTMLImageElement;
|
|
45
|
-
clock: HTMLImageElement;
|
|
46
|
-
location: HTMLImageElement;
|
|
47
|
-
sparkle: HTMLImageElement;
|
|
61
|
+
calendar: HTMLImageElement | null;
|
|
62
|
+
clock: HTMLImageElement | null;
|
|
63
|
+
location: HTMLImageElement | null;
|
|
64
|
+
sparkle: HTMLImageElement | null;
|
|
48
65
|
};
|
|
66
|
+
grain: HTMLCanvasElement | null;
|
|
49
67
|
background: readonly [string, string];
|
|
50
68
|
texts: StoryTexts;
|
|
51
69
|
}>;
|
|
@@ -54,24 +72,51 @@ export interface Block {
|
|
|
54
72
|
gap: number;
|
|
55
73
|
paint: (y: number) => void;
|
|
56
74
|
}
|
|
57
|
-
export declare const
|
|
58
|
-
|
|
59
|
-
|
|
75
|
+
export declare const totalHeight: (blocks: Block[]) => number;
|
|
76
|
+
export declare const paintColumn: (blocks: Block[], top: number) => number;
|
|
77
|
+
export declare const spaced: (ctx: CanvasRenderingContext2D, pixels: number) => void;
|
|
78
|
+
export declare const fitLine: (ctx: CanvasRenderingContext2D, text: string, maxWidth: number) => string;
|
|
79
|
+
interface TextStyle {
|
|
80
|
+
font: (size: number) => string;
|
|
60
81
|
color: string;
|
|
82
|
+
/** Tried from the first on - the largest at which the text fits wins. */
|
|
83
|
+
sizes: number[];
|
|
61
84
|
lineHeight: number;
|
|
62
|
-
|
|
63
|
-
|
|
85
|
+
maxLines: number;
|
|
86
|
+
letterSpacing?: number;
|
|
87
|
+
}
|
|
88
|
+
export declare const textBlock: (ctx: CanvasRenderingContext2D, text: string, style: TextStyle, gap: number, { x, maxWidth }?: {
|
|
89
|
+
x?: number | undefined;
|
|
90
|
+
maxWidth?: number | undefined;
|
|
64
91
|
}) => Block;
|
|
65
|
-
export declare const iconRow: (ctx: CanvasRenderingContext2D,
|
|
66
|
-
|
|
67
|
-
weight: number;
|
|
92
|
+
export declare const iconRow: (ctx: CanvasRenderingContext2D, image: HTMLImageElement | null, text: string, { font, color, gap, letterSpacing, }: {
|
|
93
|
+
font: string;
|
|
68
94
|
color: string;
|
|
69
95
|
gap: number;
|
|
96
|
+
letterSpacing?: number;
|
|
97
|
+
}, { x, maxWidth }?: {
|
|
98
|
+
x?: number | undefined;
|
|
99
|
+
maxWidth?: number | undefined;
|
|
70
100
|
}) => Block;
|
|
71
101
|
export declare const divider: (ctx: CanvasRenderingContext2D, look: Look, gap: number) => Block;
|
|
72
|
-
export
|
|
73
|
-
|
|
74
|
-
|
|
102
|
+
export interface PillStyle {
|
|
103
|
+
font: string;
|
|
104
|
+
color: string;
|
|
105
|
+
fill: string;
|
|
106
|
+
stroke?: string;
|
|
107
|
+
height: number;
|
|
108
|
+
padding: number;
|
|
109
|
+
letterSpacing?: number;
|
|
110
|
+
}
|
|
111
|
+
export declare const pill: (ctx: CanvasRenderingContext2D, text: string, style: PillStyle, maxWidth: number) => {
|
|
112
|
+
width: number;
|
|
75
113
|
height: number;
|
|
114
|
+
paint: (x: number, y: number) => void;
|
|
76
115
|
};
|
|
77
|
-
export declare const
|
|
116
|
+
export declare const drawSurface: (ctx: CanvasRenderingContext2D, look: Look, x: number, y: number, width: number, height: number, radii?: number[]) => void;
|
|
117
|
+
export declare const drawStory: (ctx: CanvasRenderingContext2D, look: Look, { kicker, footer, content, }: {
|
|
118
|
+
kicker?: string;
|
|
119
|
+
footer?: string;
|
|
120
|
+
content: (card: Stage) => void;
|
|
121
|
+
}) => void;
|
|
122
|
+
export {};
|