maverick-wave-astro 1.30.0 → 1.32.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>
@@ -4,6 +4,8 @@
4
4
  // links under the text as the `actions` slot. Dismissible, the MaverickWave
5
5
  // script fades it out - only for what may go, since it is back on reload.
6
6
  import { config } from '../dist/config.js';
7
+ import { PACKAGE_ICONS } from '../dist/icons.js';
8
+ import Icon from './Icon.astro';
7
9
 
8
10
  interface Props {
9
11
  type?: 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'info';
@@ -57,7 +59,7 @@ const {
57
59
  class="mw-btn-mini mw-btn-mini-danger mw-alert-close"
58
60
  aria-label={title ? `${closeLabel}: ${title}` : closeLabel}
59
61
  >
60
- &#120299;
62
+ <Icon svg={PACKAGE_ICONS.close} size={10} strokeWidth={2.4} />
61
63
  </button>
62
64
  )
63
65
  }
@@ -2,6 +2,9 @@
2
2
  // The link page behind a profile: who this is, then one card per link with the
3
3
  // imprint always last. The only section of its page, under the site's own
4
4
  // header with the way back to the start.
5
+ import type { ImageMetadata } from 'astro';
6
+ import { Image } from 'astro:assets';
7
+
5
8
  import { bioHref, type BioLink, isUpload } from '../dist/bio.js';
6
9
  import { config } from '../dist/config.js';
7
10
  import { withBase } from '../dist/path.js';
@@ -12,8 +15,11 @@ import type { SocialLink } from './SocialLinks.astro';
12
15
 
13
16
  interface Props {
14
17
  name: string;
15
- // A werkbank upload without extension, or a file from public/ with one
16
- avatar?: string;
18
+ // A werkbank upload without extension, a file from public/ with one, or an
19
+ // imported image from src/
20
+ avatar?: string | ImageMetadata;
21
+ // Upright 4:5 for a photo that shows more than a face
22
+ avatarShape?: 'round' | 'portrait';
17
23
  tagline?: string;
18
24
  // What is true today - free places, back from holiday on the 3rd
19
25
  status?: string;
@@ -29,6 +35,7 @@ const german = config.site.lang.startsWith('de');
29
35
  const {
30
36
  name,
31
37
  avatar,
38
+ avatarShape = 'round',
32
39
  tagline,
33
40
  status,
34
41
  links,
@@ -44,8 +51,21 @@ const {
44
51
  <div class="mw-bio-head">
45
52
  {
46
53
  avatar && (
47
- <div class="mw-bio-avatar">
48
- {isUpload(avatar) ? (
54
+ <div
55
+ class:list={[
56
+ 'mw-bio-avatar',
57
+ avatarShape === 'portrait' && 'mw-bio-avatar-portrait',
58
+ ]}
59
+ >
60
+ {typeof avatar === 'object' ? (
61
+ <Image
62
+ src={avatar}
63
+ alt=""
64
+ width={260}
65
+ loading="eager"
66
+ fetchpriority="high"
67
+ />
68
+ ) : isUpload(avatar) ? (
49
69
  <Picture src={avatar} alt="" sizes="104px" widths={[260]} eager />
50
70
  ) : (
51
71
  <img src={withBase(avatar)} alt="" width="104" height="104" />
@@ -3,7 +3,9 @@
3
3
  // Each tile opens its post as a popover - the browser does that, no script.
4
4
  import { config, siteLocale } from '../dist/config.js';
5
5
  import { longDate, parseIsoDate } from '../dist/date.js';
6
+ import { PACKAGE_ICONS } from '../dist/icons.js';
6
7
  import { publicImage } from '../dist/image-size.js';
8
+ import Icon from './Icon.astro';
7
9
 
8
10
  interface Props {
9
11
  posts: readonly {
@@ -64,7 +66,7 @@ const {
64
66
  popovertargetaction="hide"
65
67
  aria-label={closeLabel}
66
68
  >
67
- &#120299;
69
+ <Icon svg={PACKAGE_ICONS.close} />
68
70
  </button>
69
71
  <img {...image} alt={post.alt} loading="lazy" decoding="async" />
70
72
  {(post.text || post.date) && (
@@ -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
  )
@@ -4,10 +4,12 @@
4
4
  interface Props {
5
5
  svg: string;
6
6
  size?: number;
7
+ // Heavier for a small icon, or the line fades out
8
+ strokeWidth?: number;
7
9
  class?: string;
8
10
  }
9
11
 
10
- const { svg, size = 20, class: className } = Astro.props;
12
+ const { svg, size = 20, strokeWidth = 1.7, class: className } = Astro.props;
11
13
  ---
12
14
 
13
15
  <svg
@@ -18,7 +20,7 @@ const { svg, size = 20, class: className } = Astro.props;
18
20
  viewBox="0 0 24 24"
19
21
  fill="none"
20
22
  stroke="currentColor"
21
- stroke-width="1.7"
23
+ stroke-width={strokeWidth}
22
24
  stroke-linecap="round"
23
25
  stroke-linejoin="round"
24
26
  aria-hidden="true"
@@ -10,6 +10,7 @@ interface Props {
10
10
  href: string;
11
11
  active?: boolean;
12
12
  }[];
13
+ // The word in front of the name: "Sprache" reads "Sprache: Deutsch (DE)"
13
14
  label: string;
14
15
  class?: string;
15
16
  }
@@ -19,7 +20,9 @@ const current = languages.find(language => language.active) ?? languages[0];
19
20
  ---
20
21
 
21
22
  <details class:list={['mw-dropdown mw-dropdown-end mw-lang-switch', className]}>
22
- <summary aria-label={label}>
23
+ <summary
24
+ aria-label={`${label}: ${current.name} (${current.code.toUpperCase()})`}
25
+ >
23
26
  <span class:list={['mw-flag', `mw-flag-${current.flag}`]}></span>
24
27
  <span class="mw-lang-switch-code">{current.code}</span>
25
28
  <Icon
@@ -4,6 +4,8 @@
4
4
  // focus trap and the inert page come from the element itself. As a drawer it
5
5
  // is a full-height panel at the right edge, or the left with "start".
6
6
  import { config } from '../dist/config.js';
7
+ import { PACKAGE_ICONS } from '../dist/icons.js';
8
+ import Icon from './Icon.astro';
7
9
 
8
10
  interface Props {
9
11
  id: string;
@@ -41,7 +43,7 @@ const {
41
43
  <div class="mw-modal-header">
42
44
  <h4 id={`${id}-title`} class="mw-modal-title">{title}</h4>
43
45
  <button type="button" class="mw-modal-close" aria-label={closeLabel}>
44
- &#120299;
46
+ <Icon svg={PACKAGE_ICONS.close} size={16} />
45
47
  </button>
46
48
  </div>
47
49
  <div class="mw-modal-body">
@@ -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>
@@ -3,8 +3,10 @@
3
3
  // phone. The stylesheet plays the frames, the script adds tapping, video on
4
4
  // its turn and closing at the end.
5
5
  import { config } from '../dist/config.js';
6
+ import { PACKAGE_ICONS } from '../dist/icons.js';
6
7
  import { publicImage } from '../dist/image-size.js';
7
8
  import { withBase } from '../dist/path.js';
9
+ import Icon from './Icon.astro';
8
10
 
9
11
  interface Props {
10
12
  stories: readonly {
@@ -55,7 +57,7 @@ const {
55
57
  popovertargetaction="hide"
56
58
  aria-label={closeLabel}
57
59
  >
58
- &#120299;
60
+ <Icon svg={PACKAGE_ICONS.close} />
59
61
  </button>
60
62
  </div>
61
63
  {story.frames.map(frame =>
package/dist/icons.d.ts CHANGED
@@ -18,4 +18,5 @@ export declare const PACKAGE_ICONS: {
18
18
  readonly sparkle: "<path d=\"M12 2.8 13.9 9l6.2 1.9-6.2 1.9L12 19l-1.9-6.2L3.9 10.9 10.1 9 12 2.8Z\"/><path d=\"M19 16.5l.7 2.2 2.2.7-2.2.7-.7 2.2-.7-2.2-2.2-.7 2.2-.7.7-2.2Z\"/>";
19
19
  readonly star: "<path d=\"m12 3.8 2.5 5.1 5.6.8-4 4 .9 5.6L12 16.6l-5 2.7.9-5.6-4-4 5.6-.8Z\"/>";
20
20
  readonly 'panel-right': "<rect x=\"3\" y=\"4\" width=\"18\" height=\"16\" rx=\"2.4\"/><path d=\"M15 4v16\"/>";
21
+ readonly close: "<path d=\"M6 6l12 12M18 6 6 18\"/>";
21
22
  };
package/dist/icons.js CHANGED
@@ -20,4 +20,5 @@ export const PACKAGE_ICONS = {
20
20
  sparkle: '<path d="M12 2.8 13.9 9l6.2 1.9-6.2 1.9L12 19l-1.9-6.2L3.9 10.9 10.1 9 12 2.8Z"/><path d="M19 16.5l.7 2.2 2.2.7-2.2.7-.7 2.2-.7-2.2-2.2-.7 2.2-.7.7-2.2Z"/>',
21
21
  star: '<path d="m12 3.8 2.5 5.1 5.6.8-4 4 .9 5.6L12 16.6l-5 2.7.9-5.6-4-4 5.6-.8Z"/>',
22
22
  'panel-right': '<rect x="3" y="4" width="18" height="16" rx="2.4"/><path d="M15 4v16"/>',
23
+ close: '<path d="M6 6l12 12M18 6 6 18"/>',
23
24
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maverick-wave-astro",
3
- "version": "1.30.0",
3
+ "version": "1.32.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.18.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.18.0",
73
73
  "playwright-core": "^1.64.0",
74
74
  "prettier": "^3.6.2",
75
75
  "prettier-plugin-astro": "^0.14.1",