maverick-wave-astro 1.45.0 → 1.46.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/dist/story/base.js +5 -0
- package/dist/story/cards.js +5 -1
- package/dist/story/event.d.ts +1 -0
- package/dist/story/event.js +14 -5
- package/package.json +1 -1
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.js
CHANGED
|
@@ -304,8 +304,12 @@ export const seriesCards = (series, site, locale = 'de-DE', now = new Date()) =>
|
|
|
304
304
|
items = items.slice(0, config.limit);
|
|
305
305
|
return items
|
|
306
306
|
.map(item => {
|
|
307
|
+
const written = new Set(Object.entries(series.standIns ?? {})
|
|
308
|
+
.filter(([from]) => textOf(item[from]))
|
|
309
|
+
.map(([, to]) => to));
|
|
307
310
|
const rendered = blockList(config).map(({ block, slot }) => {
|
|
308
|
-
|
|
311
|
+
// Written for the story, so shown whole - the sentence limit is for the long text.
|
|
312
|
+
const shown = renderBlock(item, written.has(block.source) ? { ...block, sentences: 0 } : block, fields, locale);
|
|
309
313
|
return { source: block.source, block: shown && { ...shown, slot } };
|
|
310
314
|
});
|
|
311
315
|
const blocks = rendered.flatMap(({ block }) => (block ? [block] : []));
|
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