maverick-wave-astro 1.45.0 → 1.47.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 +5 -1
- package/dist/story/base.js +5 -0
- package/dist/story/cards.d.ts +11 -0
- package/dist/story/cards.js +23 -3
- package/dist/story/event.d.ts +1 -0
- package/dist/story/event.js +14 -5
- package/package.json +1 -1
- package/schemas/story-blocks.schema.json +1 -1
- package/schemas/story-look.schema.json +1 -1
|
@@ -408,6 +408,7 @@ const look: LookOptions = {
|
|
|
408
408
|
} from '../dist/story/caption.js';
|
|
409
409
|
import {
|
|
410
410
|
type BlocksCard,
|
|
411
|
+
cardTexts,
|
|
411
412
|
designFor,
|
|
412
413
|
designsOf,
|
|
413
414
|
seriesCards,
|
|
@@ -1077,7 +1078,10 @@ const look: LookOptions = {
|
|
|
1077
1078
|
design,
|
|
1078
1079
|
frame,
|
|
1079
1080
|
motion: playable ? motion : null,
|
|
1080
|
-
texts:
|
|
1081
|
+
texts: cardTexts(
|
|
1082
|
+
seriesTexts(seriesData[el.dataset.series ?? '']?.config ?? {}),
|
|
1083
|
+
card
|
|
1084
|
+
),
|
|
1081
1085
|
moves: playable && Boolean(motion),
|
|
1082
1086
|
state: 'waiting',
|
|
1083
1087
|
scene: null,
|
package/dist/story/base.js
CHANGED
|
@@ -360,6 +360,11 @@ const settled = async (promise) => {
|
|
|
360
360
|
}
|
|
361
361
|
};
|
|
362
362
|
export const loadLook = async (options) => {
|
|
363
|
+
// Safari runs module scripts before slow stylesheets have arrived - read
|
|
364
|
+
// that early, the brand colours come out black and the fonts as Times.
|
|
365
|
+
if (document.readyState !== 'complete') {
|
|
366
|
+
await new Promise(resolve => addEventListener('load', resolve, { once: true }));
|
|
367
|
+
}
|
|
363
368
|
const page = readPage();
|
|
364
369
|
const font = (size, weight = 400) => `${weight} ${size}px ${page.bodyFamily}`;
|
|
365
370
|
const heading = (size, weight = 700) => `${weight} ${size}px ${page.headingFamily}`;
|
package/dist/story/cards.d.ts
CHANGED
|
@@ -179,7 +179,17 @@ export interface RenderedBlock {
|
|
|
179
179
|
export interface BlocksCard {
|
|
180
180
|
kind: 'blocks';
|
|
181
181
|
blocks: RenderedBlock[];
|
|
182
|
+
without?: OwnText[];
|
|
182
183
|
}
|
|
184
|
+
declare const OWN_SWITCHES: {
|
|
185
|
+
readonly footer: "showFooter";
|
|
186
|
+
readonly reply: "showReply";
|
|
187
|
+
};
|
|
188
|
+
type OwnText = keyof typeof OWN_SWITCHES;
|
|
189
|
+
export declare const cardTexts: <T extends {
|
|
190
|
+
footer?: string;
|
|
191
|
+
reply?: string;
|
|
192
|
+
}>(texts: T, card: StoryCard) => T;
|
|
183
193
|
export type StoryCard = EventCard | PromoCard | BlocksCard;
|
|
184
194
|
export declare const eventBlocks: (card: EventCard) => BlocksCard;
|
|
185
195
|
export declare const storyDate: (date: string, locale?: string) => StoryDate | undefined;
|
|
@@ -199,3 +209,4 @@ export interface SeriesStory {
|
|
|
199
209
|
share: StoryShare;
|
|
200
210
|
}
|
|
201
211
|
export declare const seriesCards: (series: StorySeries, site: string, locale?: string, now?: Date) => SeriesStory[];
|
|
212
|
+
export {};
|
package/dist/story/cards.js
CHANGED
|
@@ -79,6 +79,16 @@ export const seriesTexts = (config) => ({
|
|
|
79
79
|
footer: shown(config.showFooter, config.footer),
|
|
80
80
|
reply: shown(config.showReply, config.reply),
|
|
81
81
|
});
|
|
82
|
+
// An entry switches the series' call to action or note off for its own story,
|
|
83
|
+
// say an Instagram live nobody registers for.
|
|
84
|
+
const OWN_SWITCHES = { footer: 'showFooter', reply: 'showReply' };
|
|
85
|
+
const switchedOff = (item) => Object.keys(OWN_SWITCHES).filter(text => item[OWN_SWITCHES[text]] === false);
|
|
86
|
+
export const cardTexts = (texts, card) => card.kind === 'blocks' && card.without?.length
|
|
87
|
+
? {
|
|
88
|
+
...texts,
|
|
89
|
+
...Object.fromEntries(card.without.map(text => [text, undefined])),
|
|
90
|
+
}
|
|
91
|
+
: texts;
|
|
82
92
|
// The event card as blocks: the tile with time and place beside it, title,
|
|
83
93
|
// description and price - the layout every story of a series starts from.
|
|
84
94
|
export const eventBlocks = (card) => {
|
|
@@ -304,8 +314,12 @@ export const seriesCards = (series, site, locale = 'de-DE', now = new Date()) =>
|
|
|
304
314
|
items = items.slice(0, config.limit);
|
|
305
315
|
return items
|
|
306
316
|
.map(item => {
|
|
317
|
+
const written = new Set(Object.entries(series.standIns ?? {})
|
|
318
|
+
.filter(([from]) => textOf(item[from]))
|
|
319
|
+
.map(([, to]) => to));
|
|
307
320
|
const rendered = blockList(config).map(({ block, slot }) => {
|
|
308
|
-
|
|
321
|
+
// Written for the story, so shown whole - the sentence limit is for the long text.
|
|
322
|
+
const shown = renderBlock(item, written.has(block.source) ? { ...block, sentences: 0 } : block, fields, locale);
|
|
309
323
|
return { source: block.source, block: shown && { ...shown, slot } };
|
|
310
324
|
});
|
|
311
325
|
const blocks = rendered.flatMap(({ block }) => (block ? [block] : []));
|
|
@@ -323,12 +337,18 @@ export const seriesCards = (series, site, locale = 'de-DE', now = new Date()) =>
|
|
|
323
337
|
shareLine(block, source === FIXED_TEXT && HEADINGS.includes(block.style)),
|
|
324
338
|
]
|
|
325
339
|
: []);
|
|
340
|
+
const without = switchedOff(item);
|
|
341
|
+
const card = {
|
|
342
|
+
kind: 'blocks',
|
|
343
|
+
blocks,
|
|
344
|
+
...(without.length ? { without } : {}),
|
|
345
|
+
};
|
|
326
346
|
return {
|
|
327
|
-
card
|
|
347
|
+
card,
|
|
328
348
|
label,
|
|
329
349
|
file: storyFileName(site, name, label, date ?? ''),
|
|
330
350
|
expires: order === 'upcoming' && date ? eventExpiry({ date }) : undefined,
|
|
331
|
-
share: { lead, date, lines, footer, reply },
|
|
351
|
+
share: { lead, date, lines, ...cardTexts({ footer, reply }, card) },
|
|
332
352
|
};
|
|
333
353
|
})
|
|
334
354
|
.filter(story => story.card.blocks.length > 0);
|
package/dist/story/event.d.ts
CHANGED
package/dist/story/event.js
CHANGED
|
@@ -17,10 +17,19 @@ const WEEKDAY_SIZES = [
|
|
|
17
17
|
];
|
|
18
18
|
const TILE_HEIGHT = 262;
|
|
19
19
|
const BAND = 70;
|
|
20
|
-
// The text at its full size, then smaller before a line has to be cut.
|
|
21
|
-
const TEXT_SIZES = [40, 36, 32];
|
|
22
20
|
const TEXT_LEADING = 1.5;
|
|
23
|
-
const TEXT_LINE =
|
|
21
|
+
const TEXT_LINE = 40 * TEXT_LEADING;
|
|
22
|
+
const TEXT_SMALLEST = 32;
|
|
23
|
+
// A short text starts a little larger, a long one a little smaller, then all
|
|
24
|
+
// get smaller before a line has to be cut.
|
|
25
|
+
export const textSizes = (text) => {
|
|
26
|
+
const long = Math.min(1, Math.max(0, (text.length - 120) / 140));
|
|
27
|
+
const sizes = [];
|
|
28
|
+
for (let size = Math.round(44 - 8 * long); size >= TEXT_SMALLEST; size -= 2) {
|
|
29
|
+
sizes.push(size);
|
|
30
|
+
}
|
|
31
|
+
return sizes;
|
|
32
|
+
};
|
|
24
33
|
const TEXT_GAP = 28;
|
|
25
34
|
// Below a run of rows, before the next block.
|
|
26
35
|
const AFTER_ROWS = 48;
|
|
@@ -238,12 +247,12 @@ const column = (ctx, look, frame, ink, blocks, space, minLead) => {
|
|
|
238
247
|
totalHeight(rows.map(row => rowBlock(ctx, look, ink, row, room)))
|
|
239
248
|
: 0;
|
|
240
249
|
const maxHeight = free - reserved >= 2 * TEXT_LINE ? free - reserved : free;
|
|
241
|
-
if (maxHeight < Math.round(
|
|
250
|
+
if (maxHeight < Math.round(TEXT_SMALLEST * TEXT_LEADING))
|
|
242
251
|
break;
|
|
243
252
|
add(textBlock(ctx, block.text, {
|
|
244
253
|
font: size => look.font(size, 400),
|
|
245
254
|
color: inkOf(ink, block.color),
|
|
246
|
-
sizes:
|
|
255
|
+
sizes: textSizes(block.text),
|
|
247
256
|
lineHeight: TEXT_LEADING,
|
|
248
257
|
maxHeight,
|
|
249
258
|
}, TEXT_GAP, room), 'text', [block], block.above, block.below);
|
package/package.json
CHANGED
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"showKicker": "true"
|
|
53
53
|
},
|
|
54
54
|
"title": "Text der kleinen Überschrift",
|
|
55
|
-
"description": "Steht oben neben dem Logo, zum Beispiel „
|
|
55
|
+
"description": "Steht oben neben dem Logo, zum Beispiel „Termin“ oder „Mittagstisch“.",
|
|
56
56
|
"type": "string",
|
|
57
57
|
"x-translate": false
|
|
58
58
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
3
|
"title": "Stories",
|
|
4
|
-
"description": "Wie deine Stories aussehen. Wähl einen Look und, wenn du magst, eigene Farben und die Stelle fürs Logo - die Vorschau rechts zeigt es sofort. Alles Weitere steht unter „Feinschliff“ und passt meist schon. Welches Design eine Story bekommt, wählst du im Reiter Story eines Bereichs, zum Beispiel bei den
|
|
4
|
+
"description": "Wie deine Stories aussehen. Wähl einen Look und, wenn du magst, eigene Farben und die Stelle fürs Logo - die Vorschau rechts zeigt es sofort. Alles Weitere steht unter „Feinschliff“ und passt meist schon. Welches Design eine Story bekommt, wählst du im Reiter Story eines Bereichs, zum Beispiel bei den Terminen.",
|
|
5
5
|
"type": "object",
|
|
6
6
|
"additionalProperties": false,
|
|
7
7
|
"required": ["designs"],
|