maverick-wave-astro 1.29.0 → 1.31.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.
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  // Questions and answers. The icon comes as a slot, rendered once and placed in
3
- // every row - the site decides whether it gets its own wrapper.
3
+ // every row - the site decides whether it gets its own wrapper. Each item is a
4
+ // <details>, so it opens without a script.
4
5
  import { answerParagraphs, type Question } from '../dist/faq.js';
5
6
 
6
7
  interface Props {
@@ -16,31 +17,20 @@ const icon = await Astro.slots.render('icon');
16
17
 
17
18
  <div class:list={['mw-accordion', className]}>
18
19
  {
19
- items.map((item, index) => {
20
- const open = firstOpen && index === 0;
21
- return (
22
- <div class="mw-accordion-item">
23
- <button
24
- type="button"
25
- class:list={['mw-accordion-header', open && 'mw-active']}
26
- aria-expanded={open ? 'true' : 'false'}
27
- aria-controls={`${idPrefix}${index}`}
28
- >
29
- <span>{item.question}</span>
30
- <Fragment set:html={icon} />
31
- </button>
32
- <div
33
- class:list={['mw-accordion-content', open && 'mw-active']}
34
- id={`${idPrefix}${index}`}
35
- >
36
- <div class="mw-accordion-content-inner">
37
- {answerParagraphs(item.answer).map(paragraph => (
38
- <p>{paragraph}</p>
39
- ))}
40
- </div>
20
+ items.map((item, index) => (
21
+ <details class="mw-accordion-item" open={firstOpen && index === 0}>
22
+ <summary class="mw-accordion-header">
23
+ <span>{item.question}</span>
24
+ <Fragment set:html={icon} />
25
+ </summary>
26
+ <div class="mw-accordion-content" id={`${idPrefix}${index}`}>
27
+ <div class="mw-accordion-content-inner">
28
+ {answerParagraphs(item.answer).map(paragraph => (
29
+ <p>{paragraph}</p>
30
+ ))}
41
31
  </div>
42
32
  </div>
43
- );
44
- })
33
+ </details>
34
+ ))
45
35
  }
46
36
  </div>
@@ -28,9 +28,11 @@ type Props = {
28
28
  // The page brings its own body: no skip link, no <main>, no header or
29
29
  // footer slot - a presentation is one.
30
30
  bare?: boolean;
31
+ // false keeps the occasion of the day off, e.g. on a TV or a menu sheet.
32
+ occasion?: boolean;
31
33
  };
32
34
 
33
- const { site, ogImage: OG_IMAGE, htmlClasses, designCss, occasion } = config;
35
+ const { site, ogImage: OG_IMAGE, htmlClasses, designCss } = config;
34
36
 
35
37
  const {
36
38
  title,
@@ -48,8 +50,11 @@ const {
48
50
  htmlData = {},
49
51
  bodyClass,
50
52
  bare = false,
53
+ occasion: withOccasion = true,
51
54
  } = Astro.props;
52
55
 
56
+ const occasion = withOccasion ? config.occasion : null;
57
+
53
58
  const canonicalUrl = new URL(
54
59
  withoutTrailingSlash(Astro.url.pathname),
55
60
  Astro.site
@@ -71,13 +71,13 @@ const button = classes.buttons ?? 'mw-btn-lg';
71
71
  <div class:list={['mw-home-text', classes.text]}>
72
72
  {
73
73
  badge && (
74
- <Badge class="mw-hero-badge">
75
- <span
76
- class:list={[
77
- 'mw-hero-badge-dot',
78
- badge.pulse && 'mw-badge-pulse',
79
- ]}
80
- />
74
+ <Badge
75
+ class:list={[
76
+ 'mw-hero-badge',
77
+ badge.pulse && 'mw-hero-badge-pulse',
78
+ ]}
79
+ >
80
+ <span class="mw-hero-badge-dot" />
81
81
  {badge.text}
82
82
  </Badge>
83
83
  )
@@ -1,7 +1,8 @@
1
1
  ---
2
2
  // One key figure with its label, an optional change and a sparkline in the
3
3
  // `chart` slot. The value sizes itself to the room it gets. Several side by
4
- // side go into a StatGroup.
4
+ // side go into a StatGroup. With `facts` the figure leads and the facts sit
5
+ // small beside it - "where do I stand" reads in the same place on every page.
5
6
  interface Props {
6
7
  label: string;
7
8
  value: string | number;
@@ -14,33 +15,98 @@ interface Props {
14
15
  invert?: boolean;
15
16
  };
16
17
  note?: string;
18
+ facts?: readonly {
19
+ term: string;
20
+ value: string | number;
21
+ tone?: 'success' | 'warning' | 'danger' | 'info';
22
+ }[];
23
+ // The figure of a small box: label and value a step down.
24
+ size?: 'sm';
25
+ // A stripe and a tint in that tone - put a word next to it, a colour alone
26
+ // is no state anyone can tell apart.
27
+ edge?:
28
+ | 'primary'
29
+ | 'secondary'
30
+ | 'success'
31
+ | 'warning'
32
+ | 'danger'
33
+ | 'info'
34
+ | 'muted';
17
35
  class?: string;
18
36
  }
19
37
 
20
- const { label, value, unit, delta, note, class: className } = Astro.props;
38
+ const {
39
+ label,
40
+ value,
41
+ unit,
42
+ delta,
43
+ note,
44
+ facts,
45
+ size,
46
+ edge,
47
+ class: className,
48
+ } = Astro.props;
49
+ const Head = facts ? 'div' : Fragment;
21
50
  ---
22
51
 
23
- <div class:list={['mw-stat', className]}>
24
- <span class="mw-stat-label">{label}</span>
25
- <span class="mw-stat-value"
26
- >{value}{unit && <span class="mw-stat-unit">{unit}</span>}</span
27
- >
52
+ <div
53
+ class:list={[
54
+ 'mw-stat',
55
+ facts && 'mw-stat-lead',
56
+ size && `mw-stat-${size}`,
57
+ edge && `mw-edge-${edge}`,
58
+ className,
59
+ ]}
60
+ >
61
+ <Head {...facts ? { class: 'mw-stat-head' } : {}}>
62
+ {
63
+ facts && (
64
+ <span class="mw-stat-value">
65
+ {value}
66
+ {unit && <span class="mw-stat-unit">{unit}</span>}
67
+ </span>
68
+ )
69
+ }
70
+ <span class="mw-stat-label">{label}</span>
71
+ {
72
+ !facts && (
73
+ <span class="mw-stat-value">
74
+ {value}
75
+ {unit && <span class="mw-stat-unit">{unit}</span>}
76
+ </span>
77
+ )
78
+ }
79
+ {
80
+ (delta || note) && (
81
+ <div class="mw-stat-footer">
82
+ {delta && (
83
+ <span
84
+ class:list={[
85
+ 'mw-stat-delta',
86
+ `mw-stat-delta-${delta.direction}`,
87
+ delta.invert && 'mw-stat-delta-invert',
88
+ ]}
89
+ >
90
+ {delta.text}
91
+ </span>
92
+ )}
93
+ {note && <span class="mw-stat-note">{note}</span>}
94
+ </div>
95
+ )
96
+ }
97
+ </Head>
28
98
  {
29
- (delta || note) && (
30
- <div class="mw-stat-footer">
31
- {delta && (
32
- <span
33
- class:list={[
34
- 'mw-stat-delta',
35
- `mw-stat-delta-${delta.direction}`,
36
- delta.invert && 'mw-stat-delta-invert',
37
- ]}
38
- >
39
- {delta.text}
40
- </span>
41
- )}
42
- {note && <span class="mw-stat-note">{note}</span>}
43
- </div>
99
+ facts && (
100
+ <dl class="mw-stat-facts">
101
+ {facts.map(fact => (
102
+ <div>
103
+ <dt>{fact.term}</dt>
104
+ <dd class:list={[fact.tone && `mw-text-${fact.tone}`]}>
105
+ {fact.value}
106
+ </dd>
107
+ </div>
108
+ ))}
109
+ </dl>
44
110
  )
45
111
  }
46
112
  {
@@ -1,13 +1,15 @@
1
1
  ---
2
2
  // Stats in a row with a rule between them once the group is 30rem wide,
3
- // stacked below that.
3
+ // stacked below that. "strip" puts them in one bordered box with a hairline
4
+ // between every two - the strip under a page title.
4
5
  interface Props {
6
+ strip?: boolean;
5
7
  class?: string;
6
8
  }
7
9
 
8
- const { class: className } = Astro.props;
10
+ const { strip = false, class: className } = Astro.props;
9
11
  ---
10
12
 
11
- <div class:list={['mw-stat-group', className]}>
13
+ <div class:list={[strip ? 'mw-stat-strip' : 'mw-stat-group', className]}>
12
14
  <slot />
13
15
  </div>
@@ -21,7 +21,7 @@ import {
21
21
  upcomingEvents,
22
22
  } from '../dist/schedule.js';
23
23
  import type { LookOptions, StoryIcon } from '../dist/story/base.js';
24
- import { blockLines, type StoryShare } from '../dist/story/caption.js';
24
+ import { blockLines, placeOf, type StoryShare } from '../dist/story/caption.js';
25
25
  import {
26
26
  eventBlocks,
27
27
  eventCard,
@@ -51,8 +51,8 @@ interface Props extends StoryLook {
51
51
  series?: readonly StorySeries[];
52
52
  // Path data from the site's own icon set, so the story matches the page.
53
53
  icons?: Partial<Record<StoryIcon, string>>;
54
- // The town for the texts to share, e.g. from the imprint - the section
55
- // Stories may name another one.
54
+ // The town for the texts to share, e.g. the city of the imprint with its
55
+ // postcode - the section Stories may name another one.
56
56
  place?: string;
57
57
  texts?: {
58
58
  share?: string;
@@ -134,7 +134,7 @@ const {
134
134
  } = texts;
135
135
 
136
136
  const site = config.site.name;
137
- const sharePlace = storyLook?.config.place?.trim() || place?.trim() || '';
137
+ const sharePlace = placeOf(storyLook?.config.place) || placeOf(place);
138
138
 
139
139
  interface Story {
140
140
  card: StoryCard;
@@ -22,6 +22,7 @@ export interface ShareSettings {
22
22
  place?: string;
23
23
  hashtags?: string;
24
24
  }
25
+ export declare const placeOf: (text: string | undefined) => string;
25
26
  export declare const shareLine: (block: RenderedBlock, label?: boolean) => ShareLine;
26
27
  export declare const blockLines: (blocks: readonly RenderedBlock[]) => ShareLine[];
27
28
  export declare const hashtagsOf: ({ place, hashtags }: ShareSettings) => string[];
@@ -4,6 +4,8 @@
4
4
  // the place and its local hashtags. Worked out in the browser on the page
5
5
  // /stories/ - "heute" is the day the owner shares it, not the day of the build.
6
6
  import { capitalized, dayPhrase, dayWords, parseIsoDate, } from "../date.js";
7
+ // The town as the imprint has it, "73240 Wendlingen" - a postcode is no hashtag.
8
+ export const placeOf = (text) => (text ?? '').trim().replace(/^\d{5}\s+/, '');
7
9
  export const shareLine = (block, label = false) => ({
8
10
  style: block.style,
9
11
  text: block.text,
@@ -288,7 +288,8 @@ export const seriesCards = (series, site, locale = 'de-DE', now = new Date()) =>
288
288
  blocks.find(block => block.text)?.text ??
289
289
  name;
290
290
  const date = dateOf(item);
291
- const lines = rendered.flatMap(({ source, block }) => block
291
+ // The head names a coming day already, a past one is no news.
292
+ const lines = rendered.flatMap(({ source, block }) => block && source !== dateField
292
293
  ? [
293
294
  shareLine(block, source === FIXED_TEXT && HEADINGS.includes(block.style)),
294
295
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maverick-wave-astro",
3
- "version": "1.29.0",
3
+ "version": "1.31.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.16.0",
56
+ "maverick-wave": "^6.17.0",
57
57
  "vite": "^8.0.0"
58
58
  },
59
59
  "dependencies": {
@@ -69,7 +69,7 @@
69
69
  "eslint-plugin-astro": "^1.5.0",
70
70
  "eslint-plugin-simple-import-sort": "^12.1.1",
71
71
  "globals": "^16.5.0",
72
- "maverick-wave": "^6.16.0",
72
+ "maverick-wave": "^6.17.0",
73
73
  "playwright-core": "^1.64.0",
74
74
  "prettier": "^3.6.2",
75
75
  "prettier-plugin-astro": "^0.14.1",
@@ -172,6 +172,18 @@
172
172
  white-space: nowrap;
173
173
  }
174
174
 
175
+ /* Beside a long title, time and place squeeze it into breaking mid-word. */
176
+ .mwa-signage-slide-events .mwa-signage-item {
177
+ grid-template-columns: minmax(0, 1fr);
178
+ }
179
+
180
+ .mwa-signage-slide-events .mwa-signage-value {
181
+ font-size: 3.2vmin;
182
+ font-weight: 400;
183
+ white-space: normal;
184
+ color: var(--mwa-signage-muted);
185
+ }
186
+
175
187
  /* A closure is why someone looks at the hours at all. */
176
188
  .mwa-signage-slide-hours .mwa-signage-text {
177
189
  font-weight: 700;