maverick-wave-astro 1.40.0 → 1.42.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/README.md CHANGED
@@ -157,8 +157,10 @@ their schemas; a site not yet moved has `contentmanager/sections.json`.
157
157
  build - it knows the formats `date`, `email`, `uri` and the keywords `x-widget`,
158
158
  `x-item-title`, `x-labels`, `x-empty`, `x-not-before`, `x-groups`,
159
159
  `x-newest-first`, `x-translate`, `x-show-if` (the werkbank shows a field only
160
- while a neighbour has one of the given values) and `x-width` (`narrow` |
161
- `medium` | `wide`: how wide a field stands next to other short ones). Photos
160
+ while a neighbour has one of the given values), `x-width` (`narrow` |
161
+ `medium` | `wide`: how wide a field stands next to other short ones) and
162
+ `x-story-for` (filled, the field stands in stories for the neighbour named). A
163
+ group in `x-groups` with `"advanced": true` folds away under "Feinschliff". Photos
162
164
  uploaded in the werkbank land in `public/images/uploads/`; the integration
163
165
  derives their sizes before the build (`maverick-wave-astro/uploads`), skips a
164
166
  file sharp cannot read and removes the originals from `dist/`, since they still
package/bin/check.mjs CHANGED
@@ -38,6 +38,8 @@ ajv.addVocabulary([
38
38
  'x-story-design',
39
39
  'x-package',
40
40
  'x-keep-ids',
41
+ // Read by the build: filled, the field stands in stories for the one named.
42
+ 'x-story-for',
41
43
  ]);
42
44
  const TIME = /^([01]\d|2[0-3]):[0-5]\d$/;
43
45
  const minutes = time => Number(time.slice(0, 2)) * 60 + Number(time.slice(3));
@@ -1,9 +1,10 @@
1
1
  ---
2
2
  // Story images in 9:16 for Instagram Story and WhatsApp Status, drawn in the
3
- // browser from what the site keeps anyway: the upcoming events and the running
4
- // promotion, and the story tabs of the werkbank, each in the design it picks
5
- // from the section Stories. Meant for a page of its own with noIndex and no link to it - the
6
- // owner's tool, not a page of the homepage. With #mw-story=... the werkbank
3
+ // browser from what the site keeps anyway: the upcoming events, the prices -
4
+ // discounted while a promotion runs - and the story tabs of the werkbank,
5
+ // each in the design it picks from the section Stories. Meant for a page of
6
+ // its own with noIndex and no link to it - the owner's tool, not a page of
7
+ // the homepage. With #mw-story=... the werkbank
7
8
  // shows the state it just saved here.
8
9
  import '../styles/story-cards.css';
9
10
 
@@ -25,6 +26,7 @@ import { blockLines, placeOf, type StoryShare } from '../dist/story/caption.js';
25
26
  import {
26
27
  eventBlocks,
27
28
  eventCard,
29
+ priceOffers,
28
30
  promoOffers,
29
31
  seriesCards,
30
32
  type StoriesConfig,
@@ -40,8 +42,8 @@ import type { StoryLook } from '../dist/types.js';
40
42
  interface Props extends StoryLook {
41
43
  events?: readonly StoryEvent[];
42
44
  promo?: Promo | null;
43
- // The prices the promotion applies to - as in Price, only those with an
44
- // amount.
45
+ // The prices: one story with all of them, or while a promotion runs the
46
+ // ones it applies to - as in Price, only those with an amount.
45
47
  offers?: readonly StoryOffer[];
46
48
  // From stories() in maverick-wave-astro/werkbank: the designs of the section
47
49
  // Stories, the design of the promotion and every story tab with the entries
@@ -60,6 +62,8 @@ interface Props extends StoryLook {
60
62
  shareVideo?: string;
61
63
  saveVideo?: string;
62
64
  empty?: string;
65
+ // In the werkbank, when the open section makes no story right now.
66
+ previewEmpty?: string;
63
67
  soldOut?: string;
64
68
  free?: string;
65
69
  currency?: string;
@@ -71,7 +75,11 @@ interface Props extends StoryLook {
71
75
  // The label top left, e.g. "Workshop" instead of the general "Termin".
72
76
  eventKicker?: string;
73
77
  promoKicker?: string;
74
- // The call to action below the card, e.g. where to sign up or book.
78
+ pricesKicker?: string;
79
+ // Above the regular prices when the story tab of the offers names none.
80
+ pricesTitle?: string;
81
+ // The call to action below the card, e.g. where to sign up or book - the
82
+ // one of the promotion stands below the prices as well.
75
83
  eventFooter?: string;
76
84
  promoFooter?: string;
77
85
  // A second line below both, e.g. an invitation to reply to the story.
@@ -110,6 +118,9 @@ const {
110
118
  empty = german
111
119
  ? 'Gerade gibt es nichts zu teilen.'
112
120
  : 'Nothing to share right now.',
121
+ previewEmpty = german
122
+ ? 'Hier entsteht gerade keine Story: Vergangenes zeigt die Vorschau nicht. Sobald ein kommender Eintrag veröffentlicht ist, siehst du hier seine Story.'
123
+ : 'No story here right now: the preview leaves out what is over. Once an upcoming entry is published, its story shows here.',
113
124
  soldOut = german ? 'Ausgebucht' : 'Sold out',
114
125
  free = german ? 'kostenlos' : 'free',
115
126
  currency = 'Euro',
@@ -119,6 +130,8 @@ const {
119
130
  daysLeft = german ? 'Nur noch {n} Tage' : 'Only {n} days left',
120
131
  eventKicker = german ? 'Termin' : 'Event',
121
132
  promoKicker = german ? 'Aktion' : 'Offer',
133
+ pricesKicker = german ? 'Preise' : 'Prices',
134
+ pricesTitle = german ? 'Unsere Preise' : 'Our prices',
122
135
  eventFooter,
123
136
  promoFooter,
124
137
  reply,
@@ -221,6 +234,38 @@ const promoStories: Story[] =
221
234
  ]
222
235
  : [];
223
236
 
237
+ // Never beside the promotion: the full prices would contradict it.
238
+ const regular = promoStories.length > 0 ? [] : priceOffers(offers, free);
239
+ const pricesHeading = promoStory?.config.title?.trim() || pricesTitle;
240
+ const priceStories: Story[] =
241
+ regular.length > 0
242
+ ? [
243
+ {
244
+ card: { kind: 'promo', title: pricesHeading, offers: regular },
245
+ share: {
246
+ lead: pricesKicker,
247
+ lines: [
248
+ { style: 'h2', text: pricesHeading },
249
+ ...regular.map(offer => ({
250
+ style: 'p' as const,
251
+ text: `${offer.name}: ${typeof offer.regular === 'number' ? amount(offer.regular) : offer.regular}`,
252
+ })),
253
+ ],
254
+ footer: promoFooter,
255
+ reply,
256
+ },
257
+ label: pricesHeading,
258
+ file: storyFileName(site, german ? 'preise' : 'prices'),
259
+ },
260
+ ]
261
+ : [];
262
+ const allStories = [
263
+ ...eventStories,
264
+ ...seriesStoryList,
265
+ ...promoStories,
266
+ ...priceStories,
267
+ ];
268
+
224
269
  const look: LookOptions = {
225
270
  logo: withBase(logo),
226
271
  background,
@@ -241,6 +286,7 @@ const look: LookOptions = {
241
286
  daysLeft,
242
287
  eventKicker,
243
288
  promoKicker,
289
+ pricesKicker,
244
290
  eventFooter,
245
291
  promoFooter,
246
292
  reply,
@@ -266,9 +312,11 @@ const look: LookOptions = {
266
312
  })}
267
313
  data-share-texts={JSON.stringify({ currency, free, soldOut })}
268
314
  data-copied={copied}
315
+ data-prices-title={pricesTitle}
316
+ data-preview-empty={previewEmpty}
269
317
  >
270
318
  {
271
- [...eventStories, ...seriesStoryList, ...promoStories].map(story => (
319
+ allStories.map(story => (
272
320
  <article
273
321
  class="mwa-story-card"
274
322
  data-story={JSON.stringify(story.card)}
@@ -502,26 +550,10 @@ const look: LookOptions = {
502
550
  return { story, config };
503
551
  };
504
552
 
505
- // The stories of a series as /stories/ shows them - and when everything is
506
- // over, the first entry anyway, so there is something to look at.
507
- const previewCards = (
508
- name: string,
509
- container: HTMLElement,
510
- count: number
511
- ) => {
512
- const series = { name, ...seriesData[name] };
513
- const site = container.dataset.site ?? '';
514
- const locale = container.dataset.locale ?? 'de-DE';
515
- const current = seriesCards(series, site, locale);
516
- return (
517
- current.length ? current : seriesCards(series, site, locale, new Date(0))
518
- ).slice(0, count);
519
- };
520
-
521
- // The designs show on a sample each, with the name of the design on top, and
522
- // on the first story of every series and the first running event and
523
- // promotion. A story tab shows on all the stories of its section, the tab of
524
- // the offers on the promotion. The rest of the page stays out of the preview.
553
+ // Only what the open section makes: the designs on a sample each, with the
554
+ // name of the design on top; a story tab the stories /stories/ shows for its
555
+ // section, nothing that is over; the tab of the offers the prices or the
556
+ // running promotion.
525
557
  const showPreview = (
526
558
  container: HTMLElement,
527
559
  { section, content, look }: NonNullable<ReturnType<typeof readPreview>>
@@ -536,20 +568,25 @@ const look: LookOptions = {
536
568
  seriesData[section].config = content as StorySeriesConfig;
537
569
  }
538
570
  const all = [...container.querySelectorAll<HTMLElement>('[data-story]')];
539
- const firstOf = (kind: StoryCard['kind']) =>
540
- all.find(
541
- el =>
542
- (JSON.parse(el.dataset.story ?? '{}') as StoryCard).kind === kind &&
543
- !outOfSchedule(el.dataset, new Date())
544
- );
545
- const kept = isLook
546
- ? [firstOf('event'), firstOf('promo')]
547
- : isPromo
548
- ? [firstOf('promo')]
549
- : [];
571
+ const offers = isPromo
572
+ ? all.find(
573
+ el =>
574
+ (JSON.parse(el.dataset.story ?? '{}') as StoryCard).kind ===
575
+ 'promo' && !outOfSchedule(el.dataset, new Date())
576
+ )
577
+ : undefined;
578
+ // The heading of the regular prices follows the tab while it is typed.
579
+ const card = JSON.parse(offers?.dataset.story ?? '{}') as StoryCard;
580
+ if (offers && card.kind === 'promo' && !card.percent) {
581
+ const { title } = content as StoryPromoConfig;
582
+ card.title =
583
+ (typeof title === 'string' && title.trim()) ||
584
+ (container.dataset.pricesTitle ?? card.title);
585
+ offers.dataset.story = JSON.stringify(card);
586
+ }
550
587
  all.forEach(el => el.remove());
551
- const names = isLook ? Object.keys(seriesData) : isPromo ? [] : [section];
552
588
  const empty = container.querySelector('[data-story-empty]');
589
+ if (empty) empty.textContent = container.dataset.previewEmpty ?? '';
553
590
  if (isLook) {
554
591
  const sample = sampleStory(container.dataset.locale ?? 'de-DE');
555
592
  (designs.length > 0 ? designs : [{}]).forEach((design, index) => {
@@ -563,13 +600,16 @@ const look: LookOptions = {
563
600
  sampleDesigns.set(name, design);
564
601
  empty?.before(cardElement(sample.story, name));
565
602
  });
566
- }
567
- for (const name of names.filter(name => seriesData[name])) {
568
- for (const story of previewCards(name, container, isLook ? 1 : 30)) {
569
- empty?.before(cardElement(story, name));
603
+ } else if (offers) {
604
+ empty?.before(offers);
605
+ } else if (seriesData[section]) {
606
+ const series = { name: section, ...seriesData[section] };
607
+ const site = container.dataset.site ?? '';
608
+ const locale = container.dataset.locale ?? 'de-DE';
609
+ for (const story of seriesCards(series, site, locale).slice(0, 30)) {
610
+ empty?.before(cardElement(story, section));
570
611
  }
571
612
  }
572
- for (const el of kept) if (el) empty?.before(el);
573
613
  container.querySelectorAll('.mwa-story-share').forEach(el => el.remove());
574
614
  // Saving again changes only the hash - the frame stays, the story redraws.
575
615
  addEventListener('hashchange', () => location.reload());
package/dist/content.d.ts CHANGED
@@ -5,6 +5,8 @@ export type StorySource = {
5
5
  parent: string;
6
6
  list: string;
7
7
  fields: Readonly<Record<string, FieldKind>>;
8
+ /** From `x-story-for`: a field to the one it stands in for in stories. */
9
+ standIns: Readonly<Record<string, string>>;
8
10
  };
9
11
  export type StorySections = {
10
12
  /** The section with the designs every story picks from. */
@@ -23,6 +25,8 @@ export type Werkbank = {
23
25
  stories: StorySections;
24
26
  };
25
27
  export declare const entryFields: (schema: unknown, list: string) => Record<string, FieldKind>;
28
+ export declare const storyStandIns: (schema: unknown, list: string) => Record<string, string>;
29
+ export declare const withStandIns: <T>(item: T, standIns: Readonly<Record<string, string>>) => T;
26
30
  export type Forms = {
27
31
  anmeldung: Readonly<Record<string, string>>;
28
32
  kontakt: Readonly<Record<string, {
package/dist/content.js CHANGED
@@ -24,13 +24,34 @@ const fieldKind = (field) => {
24
24
  return null;
25
25
  return 'text';
26
26
  };
27
- export const entryFields = (schema, list) => {
28
- const items = schema?.properties?.[list]?.items?.properties;
29
- return Object.fromEntries(Object.entries(items ?? {}).flatMap(([name, field]) => {
30
- const kind = fieldKind(field);
31
- return kind ? [[name, kind]] : [];
27
+ const entryProperties = (schema, list) => schema?.properties?.[list]?.items?.properties ?? {};
28
+ export const entryFields = (schema, list) => Object.fromEntries(Object.entries(entryProperties(schema, list)).flatMap(([name, field]) => {
29
+ const kind = fieldKind(field);
30
+ return kind ? [[name, kind]] : [];
31
+ }));
32
+ export const storyStandIns = (schema, list) => {
33
+ const properties = entryProperties(schema, list);
34
+ return Object.fromEntries(Object.entries(properties).flatMap(([name, field]) => {
35
+ const target = field['x-story-for'];
36
+ return typeof target === 'string' && target in properties
37
+ ? [[name, target]]
38
+ : [];
32
39
  }));
33
40
  };
41
+ // A short text for the story beside the long one for the page: filled, it
42
+ // takes the place of the long one in every block that shows it.
43
+ export const withStandIns = (item, standIns) => {
44
+ if (typeof item !== 'object' || item === null)
45
+ return item;
46
+ const entry = item;
47
+ const filled = Object.entries(standIns).filter(([from]) => typeof entry[from] === 'string' && entry[from].trim() !== '');
48
+ if (filled.length === 0)
49
+ return item;
50
+ return {
51
+ ...entry,
52
+ ...Object.fromEntries(filled.map(([from, to]) => [to, entry[from]])),
53
+ };
54
+ };
34
55
  const readJson = (file) => JSON.parse(readFileSync(file, 'utf8'));
35
56
  // Written by the werkbank before every build: per event with registration the
36
57
  // booking page, per contact form where it posts to plus a signed token.
@@ -89,12 +110,14 @@ export const loadWerkbank = (root) => {
89
110
  }
90
111
  const schemaFile = path.join(root, parent.schema);
91
112
  files.push(schemaFile);
113
+ const schema = readJson(schemaFile);
92
114
  return {
93
115
  name: schluessel,
94
116
  ...(parent.titel ? { title: parent.titel } : {}),
95
117
  parent: zu,
96
118
  list: liste,
97
- fields: entryFields(readJson(schemaFile), liste),
119
+ fields: entryFields(schema, liste),
120
+ standIns: storyStandIns(schema, liste),
98
121
  };
99
122
  });
100
123
  const sectionOf = (ending) => manifest.bereiche.find(({ schema }) => schema.endsWith(ending))?.schluessel;
@@ -62,6 +62,7 @@ export interface StoryTexts {
62
62
  daysLeft: string;
63
63
  eventKicker?: string;
64
64
  promoKicker?: string;
65
+ pricesKicker?: string;
65
66
  eventFooter?: string;
66
67
  promoFooter?: string;
67
68
  reply?: string;
@@ -16,8 +16,9 @@ export interface StoryOffer {
16
16
  export interface PromoOffer {
17
17
  name: string;
18
18
  features: string;
19
- regular: number;
20
- discounted: number;
19
+ /** Without a promotion also a word like "Auf Anfrage", shown without currency. */
20
+ regular: number | string;
21
+ discounted?: number;
21
22
  }
22
23
  export interface StoryDate {
23
24
  day: string;
@@ -39,7 +40,8 @@ export interface EventCard {
39
40
  }
40
41
  export interface PromoCard {
41
42
  kind: 'promo';
42
- percent: string;
43
+ /** Missing: no promotion runs - no badge, nothing struck through. */
44
+ percent?: string;
43
45
  title: string;
44
46
  /** Last day, already formatted for display. Empty means open-ended. */
45
47
  until?: string;
@@ -84,6 +86,7 @@ export interface StoriesConfig {
84
86
  }
85
87
  export interface StoryPromoConfig {
86
88
  design?: string;
89
+ title?: string;
87
90
  }
88
91
  export declare const designsOf: (config?: StoriesConfig | null) => any[];
89
92
  export declare const designFor: (designs: readonly StoryLookConfig[], id: unknown) => StoryLookConfig;
@@ -179,6 +182,7 @@ export declare const eventBlocks: (card: EventCard) => BlocksCard;
179
182
  export declare const storyDate: (date: string, locale?: string) => StoryDate | undefined;
180
183
  export declare const daysLeft: (untilIso: string, now?: Date) => number;
181
184
  export declare const promoOffers: (promo: Promo, offers: readonly StoryOffer[]) => PromoOffer[];
185
+ export declare const priceOffers: (offers: readonly StoryOffer[], free: string) => PromoOffer[];
182
186
  export declare const storyFileName: (...parts: string[]) => string;
183
187
  export declare const eventCard: (entry: StoryEvent, locale?: string) => EventCard;
184
188
  export declare const plainText: (markdown: string) => string;
@@ -135,6 +135,21 @@ export const promoOffers = (promo, offers) => offers
135
135
  ...offer,
136
136
  discounted: discountedPrice(promo, offer.regular),
137
137
  }));
138
+ // As in Price as well: every offer with a price, 0 reads as free, any other
139
+ // text stays a word.
140
+ export const priceOffers = (offers, free) => offers.flatMap(offer => {
141
+ const text = String(offer.price ?? '').trim();
142
+ if (text === '')
143
+ return [];
144
+ const amount = Number(text);
145
+ return [
146
+ {
147
+ name: offer.name,
148
+ features: (offer.features ?? []).slice(0, 2).join(' · '),
149
+ regular: Number.isFinite(amount) ? amount || free : text,
150
+ },
151
+ ];
152
+ });
138
153
  // The name the image gets on the phone - it ends up in the gallery or in a
139
154
  // chat, so it says whose it is and what it shows. Each part stops at 50
140
155
  // characters, so a long title still leaves the date in view.
@@ -1,6 +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
- // through once and once with the discount.
3
+ // through once and once with the discount. While none runs, the same card
4
+ // shows the regular prices under a heading.
4
5
  import { CLASSIC, divider, drawArea, drawBackground, fitLine, footerPieces, HEIGHT, inkFor, onDarkGround, PADDING, place, shiftedLeft, textBlock, topBarPieces, totalHeight, WIDTH, } from "./base.js";
5
6
  import { daysLeft } from "./cards.js";
6
7
  const BADGE_RADIUS = 150;
@@ -72,38 +73,44 @@ const miniCard = (ctx, look, offer, height, { left, width, fill }) => ({
72
73
  ctx.roundRect(left, y, width, height, look.radii.map(radius => radius / 2));
73
74
  ctx.fill();
74
75
  const right = left + width - MINI_PADDING;
75
- const regular = `${offer.regular} ${texts.currency}`;
76
- const discounted = String(offer.discounted);
76
+ const struck = offer.discounted !== undefined;
77
+ const regular = struck ? `${offer.regular} ${texts.currency}` : '';
78
+ const price = String(offer.discounted ?? offer.regular);
79
+ // A word like "Auf Anfrage" has no currency and would crowd out the name
80
+ // at full size.
81
+ const word = typeof (offer.discounted ?? offer.regular) === 'string';
82
+ const priceFont = heading(word ? 44 : 60, 700);
83
+ const currency = word ? '' : texts.currency;
77
84
  ctx.font = font(32, 400);
78
85
  const regularWidth = ctx.measureText(regular).width;
79
- ctx.font = heading(60, 700);
80
- const discountedWidth = ctx.measureText(discounted).width;
86
+ ctx.font = priceFont;
87
+ const priceWidth = ctx.measureText(price).width;
81
88
  ctx.font = font(32, 500);
82
- const currencyWidth = ctx.measureText(texts.currency).width;
89
+ const currencyWidth = currency ? 12 + ctx.measureText(currency).width : 0;
83
90
  ctx.textBaseline = 'middle';
84
- const regularY = Math.round(y + height * 0.3);
85
- ctx.font = font(32, 400);
86
- ctx.fillStyle = colors.muted;
87
- ctx.fillText(regular, right - regularWidth, regularY);
88
- // The stroke lies on the middle of the line, exactly where the middle
89
- // baseline is.
90
- ctx.fillRect(right - regularWidth, regularY - 1, regularWidth, 3);
91
- const discountedBlock = discountedWidth + 12 + currencyWidth;
92
- const discountedY = y + height * 0.66;
93
- const discountedX = right - discountedBlock;
94
- ctx.font = heading(60, 700);
91
+ if (struck) {
92
+ const regularY = Math.round(y + height * 0.3);
93
+ ctx.font = font(32, 400);
94
+ ctx.fillStyle = colors.muted;
95
+ ctx.fillText(regular, right - regularWidth, regularY);
96
+ // The stroke lies on the middle of the line, exactly where the middle
97
+ // baseline is.
98
+ ctx.fillRect(right - regularWidth, regularY - 1, regularWidth, 3);
99
+ }
100
+ const priceBlock = priceWidth + currencyWidth;
101
+ const priceY = y + height * (struck ? 0.66 : 0.5);
102
+ const priceX = right - priceBlock;
103
+ ctx.font = priceFont;
95
104
  ctx.fillStyle = colors.accentText;
96
- ctx.fillText(discounted, discountedX, discountedY);
97
- ctx.font = font(32, 500);
98
- ctx.fillStyle = colors.muted;
99
- ctx.fillText(texts.currency, discountedX + discountedWidth + 12, discountedY + 4);
105
+ ctx.fillText(price, priceX, priceY);
106
+ if (currency) {
107
+ ctx.font = font(32, 500);
108
+ ctx.fillStyle = colors.muted;
109
+ ctx.fillText(currency, priceX + priceWidth + 12, priceY + 4);
110
+ }
100
111
  // Whatever is left to the left of the price block is shared by name and
101
112
  // features.
102
- const space = right -
103
- left -
104
- MINI_PADDING -
105
- Math.max(regularWidth, discountedBlock) -
106
- 36;
113
+ const space = right - left - MINI_PADDING - Math.max(regularWidth, priceBlock) - 36;
107
114
  ctx.font = heading(40, 700);
108
115
  ctx.fillStyle = colors.text;
109
116
  ctx.fillText(fitLine(ctx, offer.name, space), left + MINI_PADDING, y + height * 0.36);
@@ -117,14 +124,16 @@ const miniCard = (ctx, look, offer, height, { left, width, fill }) => ({
117
124
  // of the section Stories like every other story.
118
125
  export const promoPieces = (ctx, card, look, frame = CLASSIC) => {
119
126
  const { texts } = look;
120
- const placement = place(look, frame, texts.promoKicker);
127
+ const badge = card.percent;
128
+ const kicker = badge ? texts.promoKicker : texts.pricesKicker;
129
+ const placement = place(look, frame, kicker);
121
130
  const stage = placement.stage;
122
131
  const ink = inkFor(look, frame);
123
132
  const { left, contentWidth } = frame;
124
133
  const room = { x: left, maxWidth: contentWidth, align: frame.align };
125
134
  // Without a card there is no edge to keep away from.
126
135
  const inset = frame.surface === 'none' ? 0 : PADDING;
127
- const when = deadline(card, texts)?.toUpperCase();
136
+ const when = badge ? deadline(card, texts)?.toUpperCase() : undefined;
128
137
  const besideBadge = (badgeLeft) => badgeLeft + BADGE_RADIUS * 2 + 40;
129
138
  const metaAt = (x, maxWidth) => when
130
139
  ? textBlock(ctx, when, {
@@ -162,7 +171,7 @@ export const promoPieces = (ctx, card, look, frame = CLASSIC) => {
162
171
  fade: ink.fade,
163
172
  });
164
173
  // The middle of the badge lies 40px inside the card, the title 56px below it.
165
- const titleOffset = 40 + BADGE_RADIUS + 56;
174
+ const titleOffset = badge ? 40 + BADGE_RADIUS + 56 : inset;
166
175
  const offersOffset = titleOffset + title.height + title.gap + line.height + 56;
167
176
  // Full, the card fills the stage. To fit, it is as tall as its prices at
168
177
  // their largest and stands at the top, in the middle or at the bottom.
@@ -190,7 +199,7 @@ export const promoPieces = (ctx, card, look, frame = CLASSIC) => {
190
199
  box: { x: 0, y: 0, width: WIDTH, height: HEIGHT },
191
200
  paint: () => drawBackground(ctx, look, frame),
192
201
  },
193
- ...topBarPieces(ctx, look, frame, placement, texts.promoKicker),
202
+ ...topBarPieces(ctx, look, frame, placement, kicker),
194
203
  {
195
204
  kind: 'area',
196
205
  box: frame.surface === 'band'
@@ -215,16 +224,18 @@ export const promoPieces = (ctx, card, look, frame = CLASSIC) => {
215
224
  paint: () => meta.paint(at),
216
225
  });
217
226
  }
218
- pieces.push({
219
- kind: 'price',
220
- box: {
221
- x: badgeX - BADGE_RADIUS,
222
- y: badgeY - BADGE_RADIUS,
223
- width: BADGE_RADIUS * 2,
224
- height: BADGE_RADIUS * 2,
225
- },
226
- paint: () => drawBadge(ctx, look, card.percent, badgeX, badgeY),
227
- });
227
+ if (badge) {
228
+ pieces.push({
229
+ kind: 'price',
230
+ box: {
231
+ x: badgeX - BADGE_RADIUS,
232
+ y: badgeY - BADGE_RADIUS,
233
+ width: BADGE_RADIUS * 2,
234
+ height: BADGE_RADIUS * 2,
235
+ },
236
+ paint: () => drawBadge(ctx, look, badge, badgeX, badgeY),
237
+ });
238
+ }
228
239
  const titleY = top + titleOffset;
229
240
  const lineY = titleY + title.height + title.gap;
230
241
  pieces.push({
package/dist/werkbank.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // For a site maintained in the werkbank: languages and sections come from
2
2
  // werkbank/struktur.json, the texts of the code from the site itself.
3
3
  import werkbank from 'virtual:maverick-wave-astro/werkbank';
4
- import { checkTexts, pick } from "./content.js";
4
+ import { checkTexts, pick, withStandIns } from "./content.js";
5
5
  import { languageRouting } from "./languages.js";
6
6
  const routing = languageRouting(werkbank.languages);
7
7
  export const { languages, homeOf, languageOf, pathIn, alternates, localized, switcher, } = routing;
@@ -41,13 +41,15 @@ export const stories = () => {
41
41
  },
42
42
  }
43
43
  : {}),
44
- series: series.map(({ name, title, parent, list, fields }) => {
44
+ series: series.map(({ name, title, parent, list, fields, standIns }) => {
45
45
  const entries = pick(werkbank, parent, lang)[list];
46
46
  return {
47
47
  name,
48
48
  ...(title ? { title } : {}),
49
49
  config: pick(werkbank, name, lang),
50
- items: Array.isArray(entries) ? entries : [],
50
+ items: Array.isArray(entries)
51
+ ? entries.map(item => withStandIns(item, standIns))
52
+ : [],
51
53
  fields,
52
54
  };
53
55
  }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maverick-wave-astro",
3
- "version": "1.40.0",
3
+ "version": "1.42.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.22.0",
56
+ "maverick-wave": "^6.32.0",
57
57
  "vite": "^8.0.0"
58
58
  },
59
59
  "dependencies": {
@@ -70,7 +70,7 @@
70
70
  "eslint-plugin-astro": "^1.5.0",
71
71
  "eslint-plugin-simple-import-sort": "^12.1.1",
72
72
  "globals": "^16.5.0",
73
- "maverick-wave": "^6.22.0",
73
+ "maverick-wave": "^6.32.0",
74
74
  "playwright-core": "^1.64.0",
75
75
  "prettier": "^3.6.2",
76
76
  "prettier-plugin-astro": "^0.14.1",
@@ -1,34 +1,37 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "title": "Story",
4
- "description": "Jeder Eintrag dieses Bereichs wird eine Story in einem deiner Designs aus der Kachel Stories. Hier legst du fest, welches Design, was in der Inhaltsbox steht - Zeile für Zeile, von oben nach unten - und was darüber und darunter steht.",
4
+ "description": "Jeder Eintrag dieses Bereichs wird eine Story. Hier wählst du das Design und die Texte über und unter der Inhaltsbox. Was in der Inhaltsbox steht, ist schon eingerichtet - ändern lässt es sich unter „Feinschliff“.",
5
5
  "type": "object",
6
6
  "additionalProperties": false,
7
7
  "required": ["showKicker", "showFooter", "showReply"],
8
8
  "x-groups": [
9
9
  {
10
- "title": "Design",
11
- "fields": ["design"]
10
+ "title": "Story",
11
+ "fields": [
12
+ "design",
13
+ "showKicker",
14
+ "kicker",
15
+ "showFooter",
16
+ "footer",
17
+ "showReply",
18
+ "reply"
19
+ ]
12
20
  },
13
21
  {
14
22
  "title": "Inhaltsbox",
15
- "fields": ["blocks"]
16
- },
17
- {
18
- "title": "Kleine Überschrift",
19
- "fields": ["showKicker", "kicker"]
20
- },
21
- {
22
- "title": "Aufruf und Hinweis",
23
- "fields": ["showFooter", "footer", "showReply", "reply"]
23
+ "fields": ["blocks"],
24
+ "advanced": true
24
25
  },
25
26
  {
26
27
  "title": "Welche Stories",
27
- "fields": ["order", "limit"]
28
+ "fields": ["order", "limit"],
29
+ "advanced": true
28
30
  },
29
31
  {
30
32
  "title": "Text zum Teilen",
31
- "fields": ["shareLead"]
33
+ "fields": ["shareLead"],
34
+ "advanced": true
32
35
  }
33
36
  ],
34
37
  "properties": {
@@ -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. Als Video kannst du jede Story auch als Reel posten.",
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 Workshops.",
5
5
  "type": "object",
6
6
  "additionalProperties": false,
7
7
  "required": ["designs"],
@@ -37,28 +37,44 @@
37
37
  "required": ["name", "design"],
38
38
  "x-groups": [
39
39
  {
40
- "title": "Design",
41
- "fields": ["name", "design", "background", "color", "colorBottom"]
40
+ "title": "Look",
41
+ "fields": [
42
+ "name",
43
+ "design",
44
+ "background",
45
+ "color",
46
+ "colorBottom",
47
+ "logo"
48
+ ]
49
+ },
50
+ {
51
+ "title": "Bewegung",
52
+ "fields": ["motion", "entrance"]
42
53
  },
43
54
  {
44
55
  "title": "Logo",
45
- "fields": ["logo", "logoOffset"]
56
+ "fields": ["logoOffset"],
57
+ "advanced": true
46
58
  },
47
59
  {
48
60
  "title": "Inhaltsbox",
49
- "fields": ["align", "areaWidth", "areaHeight", "areaPosition"]
61
+ "fields": ["align", "areaWidth", "areaHeight", "areaPosition"],
62
+ "advanced": true
50
63
  },
51
64
  {
52
65
  "title": "Aufruf und Hinweis",
53
- "fields": ["footerOffset"]
66
+ "fields": ["footerOffset"],
67
+ "advanced": true
54
68
  },
55
69
  {
56
70
  "title": "Für Reels",
57
- "fields": ["shiftLeft"]
71
+ "fields": ["shiftLeft"],
72
+ "advanced": true
58
73
  },
59
74
  {
60
- "title": "Bewegung",
61
- "fields": ["motion", "entrance", "effect", "backdrop", "seconds"]
75
+ "title": "Bewegung im Detail",
76
+ "fields": ["effect", "backdrop", "seconds"],
77
+ "advanced": true
62
78
  }
63
79
  ],
64
80
  "properties": {
@@ -72,7 +88,7 @@
72
88
  "x-translate": false
73
89
  },
74
90
  "design": {
75
- "title": "Grundaufbau",
91
+ "title": "Look",
76
92
  "type": "string",
77
93
  "enum": [
78
94
  "classic",
@@ -93,7 +109,7 @@
93
109
  "glass": "Glas - durchscheinende Inhaltsbox, weiße Schrift auf Farbverlauf"
94
110
  },
95
111
  "default": "classic",
96
- "description": "Legt fest, wie die Story aufgebaut ist. Alles darunter auf „Wie im Design“ folgt dem Grundaufbau, jede eigene Wahl ändert nur diesen einen Punkt."
112
+ "description": "Wie die Story grundsätzlich aussieht. Was auf „Wie im Design“ steht, richtet sich danach - auch alles unter „Feinschliff“."
97
113
  },
98
114
  "background": {
99
115
  "title": "Hintergrund",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "title": "Story",
4
- "description": "Läuft eine Aktion mit Rabatt, wird sie eine Story mit Plakette und Preisen. Hier wählst du ihr Design aus der Kachel Stories.",
4
+ "description": "Deine Preise als Story. Läuft eine Rabattaktion, zeigt sie von selbst die reduzierten Preise mit Plakette. Hier wählst du ihr Design aus der Kachel Stories.",
5
5
  "type": "object",
6
6
  "additionalProperties": false,
7
7
  "properties": {
@@ -11,6 +11,13 @@
11
11
  "type": "string",
12
12
  "x-story-design": true,
13
13
  "x-translate": false
14
+ },
15
+ "title": {
16
+ "title": "Überschrift",
17
+ "description": "Steht über deinen Preisen, solange keine Rabattaktion läuft. Während einer Aktion steht dort ihr Text.",
18
+ "type": "string",
19
+ "maxLength": 60,
20
+ "x-translate": false
14
21
  }
15
22
  }
16
23
  }