maverick-wave-astro 1.5.0 → 1.7.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.
Files changed (55) hide show
  1. package/README.md +47 -12
  2. package/bin/check.mjs +47 -11
  3. package/components/ActionBar.astro +80 -0
  4. package/components/Alert.astro +64 -0
  5. package/components/AppShell.astro +209 -0
  6. package/components/AvatarGroup.astro +66 -0
  7. package/components/Bento.astro +16 -0
  8. package/components/BentoItem.astro +29 -0
  9. package/components/Breadcrumbs.astro +6 -0
  10. package/components/Chat.astro +115 -0
  11. package/components/ChatComposer.astro +70 -0
  12. package/components/Compare.astro +64 -0
  13. package/components/Dropdown.astro +86 -0
  14. package/components/EmptyState.astro +11 -2
  15. package/components/Footer.astro +178 -102
  16. package/components/Header.astro +6 -0
  17. package/components/Marquee.astro +93 -0
  18. package/components/Meter.astro +55 -0
  19. package/components/Modal.astro +11 -2
  20. package/components/Offer.astro +9 -1
  21. package/components/Pagination.astro +90 -0
  22. package/components/Picture.astro +4 -1
  23. package/components/Progress.astro +28 -12
  24. package/components/ProgressRing.astro +41 -0
  25. package/components/Segmented.astro +54 -0
  26. package/components/Spinner.astro +47 -0
  27. package/components/Stat.astro +53 -0
  28. package/components/StatGroup.astro +13 -0
  29. package/components/Stepper.astro +8 -2
  30. package/components/Table.astro +22 -8
  31. package/components/ThemeToggle.astro +2 -4
  32. package/components/Timeline.astro +25 -2
  33. package/dist/content.d.ts +21 -0
  34. package/dist/content.js +99 -0
  35. package/dist/design.d.ts +12 -0
  36. package/dist/design.js +7 -1
  37. package/dist/i18n.d.ts +9 -0
  38. package/dist/i18n.js +37 -0
  39. package/dist/icons.d.ts +6 -0
  40. package/dist/icons.js +6 -0
  41. package/dist/integration.d.ts +2 -1
  42. package/dist/integration.js +36 -8
  43. package/dist/languages.d.ts +38 -0
  44. package/dist/languages.js +76 -0
  45. package/dist/structured-data.d.ts +15 -0
  46. package/dist/structured-data.js +11 -0
  47. package/dist/werkbank.d.ts +25 -0
  48. package/dist/werkbank.js +17 -0
  49. package/package.json +5 -4
  50. package/routes/virtual.d.ts +7 -0
  51. package/schemas/design.schema.json +19 -5
  52. package/schemas/translations.schema.json +12 -0
  53. package/styles/marquee.css +9 -0
  54. package/styles/table.css +0 -8
  55. package/styles/theme-toggle.css +0 -13
package/README.md CHANGED
@@ -30,8 +30,9 @@ The integration sets the CSP-safe build options, the `@` alias, the sitemap,
30
30
 
31
31
  `design` in `site.ts` takes the semantic values from `src/design.ts`, e.g.
32
32
  `{ corners: 'even', buttonShape: 'pill', spacing: 'airy' }`, or the text from
33
- the setup box of the MaverickWave overlay. `src/content/design.json` overrides
34
- it value by value - that is the file customers edit in the contentmanager.
33
+ the setup box of the MaverickWave overlay. The werkbank section with
34
+ `schemas/design.schema.json` overrides it value by value; a site not yet moved
35
+ there uses `src/content/design.json`.
35
36
 
36
37
  ## Layout
37
38
 
@@ -51,13 +52,25 @@ Slot `banner` sits below the header; `htmlData` puts `data-*` on `<html>`.
51
52
  `bodyClass` adds to `site.bodyClass`; `bare` renders only the default slot into
52
53
  `<body>` - no skip link, no `<main>`, no header or footer.
53
54
 
55
+ `AppShell` is the frame of an app page: render it inside `BaseLayout bare`, it
56
+ brings its own skip link. `nav` groups `AppLink`s, `tabbar` takes the phone's
57
+ destinations, the `aside` slot a side panel, `persist` remembers rail and aside.
58
+ The toggles come from the MaverickWave script.
59
+
54
60
  ## Components
55
61
 
56
- - Frame: `Header`, `Footer` (social links, notes, legal links, credit),
57
- `ThemeToggle`, `LanguageSwitch`, `Announcement`, `PromoBar`
62
+ - Frame: `Header`, `Footer` (social links and notes above a bar with copyright,
63
+ credit and the legal `links`; `dark`, `compact`), `ThemeToggle`,
64
+ `LanguageSwitch`, `Announcement`, `PromoBar`
58
65
  - Sections: `Hero` (`variant` start | fade), `SectionHead`, `IconCard`,
59
66
  `ValueList`, `OpeningHours`, `Address`, `Accordion`, `Calendar`,
60
- `CalendarLegend`, `EmptyState`
67
+ `CalendarLegend`, `EmptyState` (`inline`)
68
+ - Blocks: `Bento` with `BentoItem` (`size` wide | tall | lg | full), `ActionBar`
69
+ (call, route, booking), `Marquee`, `Compare`, `Stat` in a `StatGroup`,
70
+ `Meter`, `ProgressRing`, `Chat`, `Pagination`
71
+ - Options: `Modal` `drawer` (end | start), `Progress` without `value` runs
72
+ indeterminate, `Timeline` `variant="compact"`, `Picture` `shape` (arch |
73
+ signature | leaf), `Table` `hover` and `stickyFirst`
61
74
  - Pages: `NotFound`, `LegalPage`, `ImprintCard`, `PrivacyCard`
62
75
  - `Schedule` hides expired entries in the browser (`data-expires`,
63
76
  `data-starts`, `data-schedule-list`, `data-day`)
@@ -95,10 +108,10 @@ site-wide.
95
108
 
96
109
  Seasonal decoration on the cards, panels and testimonials - snow, a garland,
97
110
  leaves, bunting. Drawn by MaverickWave (`components/occasions`), switched on by
98
- a file: with `src/content/occasions.json` the integration sets
99
- `data-mw-occasions` on `<html>` and serves `/occasions.js`, MaverickWave's head
100
- script, as the first script in `<head>`. It picks today's entry before the first
101
- paint.
111
+ a file: with `src/content/occasions.json`, or a werkbank section with an
112
+ `occasions.schema.json`, the integration sets `data-mw-occasions` on `<html>`
113
+ and serves `/occasions.js`, MaverickWave's head script, as the first script in
114
+ `<head>`. It picks today's entry before the first paint.
102
115
 
103
116
  ```json
104
117
  {
@@ -118,20 +131,42 @@ paint.
118
131
  `motion` (`static` | `dynamic`) and the optional `size` (`sm` | `lg`) hold for
119
132
  every entry. Needs maverick-wave 5.34 or later.
120
133
 
121
- ## Contentmanager
134
+ ## Werkbank
122
135
 
123
- `contentmanager/sections.json` lists the editable files and their schemas;
136
+ `werkbank/struktur.json` lists the languages and the editable sections with
137
+ their schemas; a site not yet moved has `contentmanager/sections.json`.
124
138
  `schemas/design.schema.json`, `schemas/promo.schema.json` and
125
139
  `schemas/occasions.schema.json` ship with the package. Put
126
140
  `mwa-check && astro build` in the build script so a broken file stops the
127
141
  build - it knows the formats `date`, `email`, `uri` and the keywords `x-widget`,
128
142
  `x-item-title`, `x-labels`, `x-empty`, `x-not-before`, `x-groups`,
129
- `x-newest-first`. Photos uploaded in the contentmanager land in
143
+ `x-newest-first`, `x-translate`. Photos uploaded in the werkbank land in
130
144
  `public/images/uploads/`; the integration derives their sizes before the build
131
145
  (`maverick-wave-astro/uploads`), skips a file sharp cannot read and removes the
132
146
  originals from `dist/`, since they still carry EXIF and GPS. Tooling: re-export
133
147
  `maverick-wave-astro/eslint` and `/prettier`.
134
148
 
149
+ Pages read sections and the texts of the code through
150
+ `maverick-wave-astro/werkbank`:
151
+
152
+ ```ts
153
+ // src/texts.ts
154
+ const de = { hero: { title: "Willkommen" } };
155
+ const en: typeof de = { hero: { title: "Welcome" } };
156
+ export const textsFor = defineTexts<typeof de>({ de, en });
157
+
158
+ // a component
159
+ const { hero } = textsFor(Astro.url);
160
+ const workshops = content<Workshops>("workshops", Astro.url);
161
+ ```
162
+
163
+ A section comes from `src/content/werkbank/<schluessel>.json`, which the
164
+ werkbank writes before every build, or else from its start content - so
165
+ `astro dev` works without the werkbank. A language without texts, or a text
166
+ missing in one language, stops the build. The first language lives at `/`, every
167
+ other one under `/<code>/`; `localized`, `alternates` and `switcher` (the props
168
+ of `LanguageSwitch`) take `Astro.url`.
169
+
135
170
  ## Releasing
136
171
 
137
172
  - `tools/install-local.sh <site>|--all` packs and installs into sites without
package/bin/check.mjs CHANGED
@@ -1,20 +1,21 @@
1
1
  #!/usr/bin/env node
2
- // Checks every content file from contentmanager/sections.json against its
3
- // schema before the build - the same check the contentmanager runs on save.
4
- // Catches hand edits and notices when file and schema drift apart.
2
+ // Checks every content file against its schema before the build - the same
3
+ // check the werkbank runs on save. Catches hand edits and notices when file and
4
+ // schema drift apart. Reads werkbank/struktur.json, or for a site not yet moved
5
+ // contentmanager/sections.json.
5
6
  import { existsSync, readFileSync } from 'node:fs';
6
7
  import path from 'node:path';
7
8
 
8
9
  import Ajv2020 from 'ajv/dist/2020.js';
9
10
  import addFormats from 'ajv-formats';
10
11
 
11
- const MANIFEST = 'contentmanager/sections.json';
12
+ const CONTENTMANAGER = 'contentmanager/sections.json';
13
+ const WERKBANK = 'werkbank/struktur.json';
14
+ const BUILT = 'src/content/werkbank';
12
15
 
13
16
  const read = file =>
14
17
  JSON.parse(readFileSync(path.resolve(process.cwd(), file), 'utf8'));
15
18
 
16
- if (!existsSync(MANIFEST)) process.exit(0);
17
-
18
19
  const ajv = new Ajv2020({ allErrors: true, verbose: true });
19
20
  addFormats(ajv, ['date', 'email', 'uri']);
20
21
  ajv.addVocabulary([
@@ -24,8 +25,9 @@ ajv.addVocabulary([
24
25
  'x-empty',
25
26
  'x-groups',
26
27
  'x-newest-first',
28
+ 'x-translate',
27
29
  ]);
28
- // Same rule as in the contentmanager: YYYY-MM-DD compares as text.
30
+ // Same rule as in the werkbank: YYYY-MM-DD compares as text.
29
31
  ajv.addKeyword({
30
32
  keyword: 'x-not-before',
31
33
  type: 'string',
@@ -41,12 +43,46 @@ const message = error =>
41
43
  ? `is before "${error.schema}"`
42
44
  : error.message;
43
45
 
46
+ // What the build reads: the file from the werkbank in every language, without
47
+ // one the start content.
48
+ const werkbankDocuments = () =>
49
+ read(WERKBANK).bereiche.flatMap(({ schluessel, schema, start }) => {
50
+ const built = `${BUILT}/${schluessel}.json`;
51
+ if (existsSync(built)) {
52
+ return Object.entries(read(built)).map(([lang, document]) => ({
53
+ name: `${built} (${lang})`,
54
+ schema,
55
+ document,
56
+ }));
57
+ }
58
+ return start ? [{ name: start, schema, document: read(start) }] : [];
59
+ });
60
+
61
+ const contentmanagerDocuments = () =>
62
+ read(CONTENTMANAGER).sections.map(({ file, schema }) => ({
63
+ name: file,
64
+ schema,
65
+ document: read(file),
66
+ }));
67
+
68
+ const documents = existsSync(WERKBANK)
69
+ ? werkbankDocuments()
70
+ : existsSync(CONTENTMANAGER)
71
+ ? contentmanagerDocuments()
72
+ : [];
73
+
74
+ const compiled = new Map();
75
+ const validator = schema => {
76
+ if (!compiled.has(schema)) compiled.set(schema, ajv.compile(read(schema)));
77
+ return compiled.get(schema);
78
+ };
79
+
44
80
  let count = 0;
45
- for (const { file, schema } of read(MANIFEST).sections) {
46
- const validate = ajv.compile(read(schema));
47
- if (validate(read(file))) continue;
81
+ for (const { name, schema, document } of documents) {
82
+ const validate = validator(schema);
83
+ if (validate(document)) continue;
48
84
  for (const error of validate.errors) {
49
- console.error(`${file}${error.instancePath}: ${message(error)}`);
85
+ console.error(`${name}${error.instancePath}: ${message(error)}`);
50
86
  count++;
51
87
  }
52
88
  }
@@ -0,0 +1,80 @@
1
+ ---
2
+ // Call, directions, book - held at the bottom edge of a phone. From a tablet
3
+ // up it steps aside unless `always` is set; while it shows, the page keeps
4
+ // its height free. Place it last in the body, after the footer.
5
+ import { config } from '../dist/config.js';
6
+ import { PACKAGE_ICONS } from '../dist/icons.js';
7
+ import { linkTo } from '../dist/path.js';
8
+ import Icon from './Icon.astro';
9
+
10
+ type Kind = 'call' | 'route' | 'booking' | 'mail';
11
+
12
+ interface Props {
13
+ label: string;
14
+ // Up to four; `kind` brings the icon and, without `label`, the text.
15
+ items: readonly {
16
+ href: string;
17
+ kind?: Kind;
18
+ label?: string;
19
+ icon?: string;
20
+ // The one that matters most, filled.
21
+ primary?: boolean;
22
+ }[];
23
+ always?: boolean;
24
+ // At the bottom of its own frame instead of the window, e.g. a device.
25
+ embedded?: boolean;
26
+ class?: string;
27
+ }
28
+
29
+ const german = config.site.lang.startsWith('de');
30
+
31
+ const KINDS: Record<Kind, { icon: string; label: string }> = {
32
+ call: { icon: PACKAGE_ICONS.phone, label: german ? 'Anrufen' : 'Call' },
33
+ route: {
34
+ icon: PACKAGE_ICONS['map-pin'],
35
+ label: german ? 'Route' : 'Directions',
36
+ },
37
+ booking: {
38
+ icon: PACKAGE_ICONS['calendar-check'],
39
+ label: german ? 'Termin' : 'Book',
40
+ },
41
+ mail: { icon: PACKAGE_ICONS.mail, label: german ? 'E-Mail' : 'Email' },
42
+ };
43
+
44
+ const {
45
+ label,
46
+ items,
47
+ always = false,
48
+ embedded = false,
49
+ class: className,
50
+ } = Astro.props;
51
+ ---
52
+
53
+ <nav
54
+ class:list={[
55
+ 'mw-action-bar',
56
+ always && 'mw-action-bar-always',
57
+ embedded && 'mw-action-bar-embedded',
58
+ className,
59
+ ]}
60
+ aria-label={label}
61
+ >
62
+ {
63
+ items.map(item => {
64
+ const kind = item.kind ? KINDS[item.kind] : undefined;
65
+ const icon = item.icon ?? kind?.icon;
66
+ return (
67
+ <a
68
+ class:list={[
69
+ 'mw-action-bar-item',
70
+ item.primary && 'mw-action-bar-primary',
71
+ ]}
72
+ href={linkTo(item.href)}
73
+ >
74
+ {icon && <Icon svg={icon} />}
75
+ <span>{item.label ?? kind?.label}</span>
76
+ </a>
77
+ );
78
+ })
79
+ }
80
+ </nav>
@@ -0,0 +1,64 @@
1
+ ---
2
+ // A message that belongs to the page it sits on: a closing day, a changed
3
+ // address, a note above a form. The icon comes as the `icon` slot, buttons or
4
+ // links under the text as the `actions` slot. Dismissible, the MaverickWave
5
+ // script fades it out - only for what may go, since it is back on reload.
6
+ import { config } from '../dist/config.js';
7
+
8
+ interface Props {
9
+ type?: 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'info';
10
+ title?: string;
11
+ // One paragraph; anything richer goes into the default slot.
12
+ text?: string;
13
+ // Only for an alert a script shows later - static text is read in order.
14
+ role?: 'alert' | 'status';
15
+ dismissible?: boolean;
16
+ closeLabel?: string;
17
+ class?: string;
18
+ }
19
+
20
+ const german = config.site.lang.startsWith('de');
21
+
22
+ const {
23
+ type = 'info',
24
+ title,
25
+ text,
26
+ role,
27
+ dismissible = false,
28
+ closeLabel = german ? 'Hinweis schließen' : 'Dismiss',
29
+ class: className,
30
+ } = Astro.props;
31
+ ---
32
+
33
+ <div class:list={['mw-alert', `mw-alert-${type}`, className]} role={role}>
34
+ {
35
+ Astro.slots.has('icon') && (
36
+ <div class="mw-alert-icon">
37
+ <slot name="icon" />
38
+ </div>
39
+ )
40
+ }
41
+ <div class="mw-alert-content">
42
+ {title && <span class="mw-alert-title">{title}</span>}
43
+ {text && <p>{text}</p>}
44
+ <slot />
45
+ {
46
+ Astro.slots.has('actions') && (
47
+ <div class="mw-alert-actions">
48
+ <slot name="actions" />
49
+ </div>
50
+ )
51
+ }
52
+ </div>
53
+ {
54
+ dismissible && (
55
+ <button
56
+ type="button"
57
+ class="mw-btn-mini mw-btn-mini-danger mw-alert-close"
58
+ aria-label={title ? `${closeLabel}: ${title}` : closeLabel}
59
+ >
60
+ &#120299;
61
+ </button>
62
+ )
63
+ }
64
+ </div>
@@ -0,0 +1,209 @@
1
+ ---
2
+ // The frame of an application instead of a page: a sidebar beside a column
3
+ // that scrolls on its own under a sticky top bar, an optional aside and a tab
4
+ // bar for the phone. Use it inside BaseLayout with `bare`. The MaverickWave
5
+ // script folds the sidebar to a rail, opens the panels and remembers both.
6
+ import { config } from '../dist/config.js';
7
+ import { PACKAGE_ICONS } from '../dist/icons.js';
8
+ import { linkTo } from '../dist/path.js';
9
+ import Icon from './Icon.astro';
10
+
11
+ export type AppLink = {
12
+ label: string;
13
+ href: string;
14
+ // Inner SVG markup like Icon takes it; the rail shows only this.
15
+ icon?: string;
16
+ badge?: string | number;
17
+ // Otherwise taken from the current path.
18
+ current?: boolean;
19
+ };
20
+
21
+ interface Props {
22
+ title: string;
23
+ // Or the `brand` slot for a logo image.
24
+ brand?: { label: string; href?: string; icon?: string };
25
+ nav?: readonly { title?: string; links: readonly AppLink[] }[];
26
+ // The main destinations at the bottom edge of a phone.
27
+ tabbar?: readonly AppLink[];
28
+ // With an `aside` slot: the title of the panel and its toggle.
29
+ aside?: { title: string; icon?: string };
30
+ // Remembers the rail and the docked aside under this name.
31
+ persist?: string;
32
+ collapsed?: boolean;
33
+ sidebarDark?: boolean;
34
+ // The whole column without gutter or scroll, for a canvas or a game board.
35
+ flush?: boolean;
36
+ // Prefix for the ids the toggles point at.
37
+ id?: string;
38
+ navLabel?: string;
39
+ class?: string;
40
+ }
41
+
42
+ const german = config.site.lang.startsWith('de');
43
+
44
+ const {
45
+ title,
46
+ brand,
47
+ nav = [],
48
+ tabbar = [],
49
+ aside,
50
+ persist,
51
+ collapsed = false,
52
+ sidebarDark = false,
53
+ flush = false,
54
+ id = 'app',
55
+ navLabel = german ? 'Hauptnavigation' : 'Main',
56
+ class: className,
57
+ } = Astro.props;
58
+
59
+ const path = (href: string) => href.replace(/\/$/, '') || '/';
60
+ const here = path(Astro.url.pathname);
61
+ const isCurrent = (link: AppLink) =>
62
+ link.current ?? path(linkTo(link.href)) === here;
63
+ const hasAside = Boolean(aside) && Astro.slots.has('aside');
64
+ const closeLabel = german ? 'Schließen' : 'Close';
65
+ ---
66
+
67
+ <a class="mw-skip-link" href={`#${id}-content`}>
68
+ {german ? 'Zum Inhalt springen' : 'Skip to content'}
69
+ </a>
70
+ <div
71
+ class:list={['mw-app', collapsed && 'mw-app-collapsed', className]}
72
+ data-mw-app-persist={persist}
73
+ >
74
+ <aside
75
+ class:list={['mw-app-sidebar', sidebarDark && 'mw-app-sidebar-dark']}
76
+ id={`${id}-nav`}
77
+ aria-label={navLabel}
78
+ >
79
+ <slot name="brand">
80
+ {
81
+ brand && (
82
+ <a class="mw-app-brand" href={linkTo(brand.href ?? '/')}>
83
+ {brand.icon && <Icon svg={brand.icon} />}
84
+ <span class="mw-app-label">{brand.label}</span>
85
+ </a>
86
+ )
87
+ }
88
+ </slot>
89
+ <nav class="mw-app-nav">
90
+ <slot name="nav">
91
+ {
92
+ nav.map(group => (
93
+ <Fragment>
94
+ {group.title && <p class="mw-app-nav-title">{group.title}</p>}
95
+ {group.links.map(link => (
96
+ <a
97
+ class="mw-app-nav-link mw-tooltip-inline-end"
98
+ href={linkTo(link.href)}
99
+ aria-current={isCurrent(link) ? 'page' : undefined}
100
+ data-tooltip={link.label}
101
+ >
102
+ {link.icon && <Icon svg={link.icon} />}
103
+ <span class="mw-app-label">{link.label}</span>
104
+ {link.badge !== undefined && (
105
+ <span class="mw-badge mw-badge-primary mw-badge-sm">
106
+ {link.badge}
107
+ </span>
108
+ )}
109
+ </a>
110
+ ))}
111
+ </Fragment>
112
+ ))
113
+ }
114
+ </slot>
115
+ </nav>
116
+ {
117
+ Astro.slots.has('sidebar-footer') && (
118
+ <div class="mw-app-sidebar-footer">
119
+ <slot name="sidebar-footer" />
120
+ </div>
121
+ )
122
+ }
123
+ </aside>
124
+
125
+ <div class="mw-app-main">
126
+ <header class="mw-app-topbar">
127
+ <button
128
+ type="button"
129
+ class="mw-app-toggle"
130
+ data-mw-app-toggle
131
+ aria-controls={`${id}-nav`}
132
+ aria-label="Navigation"
133
+ >
134
+ <span class="mw-app-toggle-icon"></span>
135
+ </button>
136
+ <h1 class="mw-app-title">{title}</h1>
137
+ <div class="mw-app-actions">
138
+ <slot name="actions" />
139
+ {
140
+ hasAside && aside && (
141
+ <button
142
+ type="button"
143
+ class="mw-app-toggle"
144
+ data-mw-app-aside-toggle
145
+ aria-controls={`${id}-aside`}
146
+ aria-label={aside.title}
147
+ >
148
+ <Icon svg={aside.icon ?? PACKAGE_ICONS['panel-right']} />
149
+ </button>
150
+ )
151
+ }
152
+ </div>
153
+ </header>
154
+ <main
155
+ class:list={['mw-app-content', flush && 'mw-app-content-flush']}
156
+ id={`${id}-content`}
157
+ tabindex="-1"
158
+ >
159
+ <slot />
160
+ </main>
161
+ <slot name="footer" />
162
+ </div>
163
+
164
+ {
165
+ hasAside && aside && (
166
+ <aside class="mw-app-aside" id={`${id}-aside`} aria-label={aside.title}>
167
+ <div class="mw-app-aside-header">
168
+ <h2>{aside.title}</h2>
169
+ <button
170
+ type="button"
171
+ class="mw-app-toggle"
172
+ data-mw-app-aside-toggle
173
+ aria-label={closeLabel}
174
+ >
175
+ &#x2715;
176
+ </button>
177
+ </div>
178
+ <div class="mw-app-aside-body">
179
+ <slot name="aside" />
180
+ </div>
181
+ </aside>
182
+ )
183
+ }
184
+
185
+ {
186
+ tabbar.length > 0 && (
187
+ <nav
188
+ class="mw-app-tabbar"
189
+ aria-label={german ? 'Hauptbereiche' : 'Primary'}
190
+ >
191
+ {tabbar.map(link => (
192
+ <a
193
+ class="mw-app-tabbar-item"
194
+ href={linkTo(link.href)}
195
+ aria-current={isCurrent(link) ? 'page' : undefined}
196
+ >
197
+ {link.icon && <Icon svg={link.icon} />}
198
+ <span class="mw-app-label">{link.label}</span>
199
+ {link.badge !== undefined && (
200
+ <span class="mw-badge mw-badge-primary mw-badge-sm">
201
+ {link.badge}
202
+ </span>
203
+ )}
204
+ </a>
205
+ ))}
206
+ </nav>
207
+ )
208
+ }
209
+ </div>
@@ -0,0 +1,66 @@
1
+ ---
2
+ // Faces in a row, overlapping: who teaches, who is coming along. Past `max`
3
+ // the rest folds into "+n", read out in words.
4
+ import { config } from '../dist/config.js';
5
+ import { linkTo } from '../dist/path.js';
6
+ import Avatar from './Avatar.astro';
7
+
8
+ interface Props {
9
+ people: readonly {
10
+ // Initials, or a photo from public/ with its alt text
11
+ initials?: string;
12
+ image?: string;
13
+ alt?: string;
14
+ color?: 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'info';
15
+ }[];
16
+ max?: number;
17
+ size?: 'xs' | 'sm' | 'lg' | 'xl';
18
+ // What "+n" says to a screen reader, {count} is replaced.
19
+ moreLabel?: string;
20
+ class?: string;
21
+ }
22
+
23
+ const german = config.site.lang.startsWith('de');
24
+
25
+ const {
26
+ people,
27
+ max = people.length,
28
+ size,
29
+ moreLabel = german ? '{count} weitere Personen' : '{count} more people',
30
+ class: className,
31
+ } = Astro.props;
32
+
33
+ const shown = people.slice(0, max);
34
+ const rest = people.length - shown.length;
35
+ ---
36
+
37
+ <div class:list={['mw-avatar-group', className]}>
38
+ {
39
+ shown.map(person => (
40
+ <Avatar initials={person.initials} size={size} color={person.color}>
41
+ {person.image && (
42
+ <img
43
+ src={linkTo(person.image)}
44
+ alt={person.alt ?? ''}
45
+ loading="lazy"
46
+ />
47
+ )}
48
+ </Avatar>
49
+ ))
50
+ }
51
+ {
52
+ rest > 0 && (
53
+ <div
54
+ class:list={[
55
+ 'mw-avatar',
56
+ size && `mw-avatar-${size}`,
57
+ 'mw-avatar-more',
58
+ ]}
59
+ role="img"
60
+ aria-label={moreLabel.replace('{count}', String(rest))}
61
+ >
62
+ +{rest}
63
+ </div>
64
+ )
65
+ }
66
+ </div>
@@ -0,0 +1,16 @@
1
+ ---
2
+ // Tiles of different sizes on one row rhythm: one column on a phone, two from
3
+ // sm, four from lg. The tiles are BentoItem. The grid packs dense, so keep
4
+ // the tile order the reading order.
5
+ interface Props {
6
+ // Rows of 7rem instead of 11rem, for a row of figures.
7
+ compact?: boolean;
8
+ class?: string;
9
+ }
10
+
11
+ const { compact = false, class: className } = Astro.props;
12
+ ---
13
+
14
+ <div class:list={['mw-bento', compact && 'mw-bento-compact', className]}>
15
+ <slot />
16
+ </div>
@@ -0,0 +1,29 @@
1
+ ---
2
+ // One tile of a Bento. The sizes only start with the second column, so a
3
+ // phone gets a plain stack. As a card it fills its cell.
4
+ interface Props {
5
+ size?: 'wide' | 'tall' | 'lg' | 'full';
6
+ // "full" expects card parts inside (mw-card-img, mw-card-body).
7
+ card?: 'simple' | 'full' | 'none';
8
+ as?: 'div' | 'article' | 'li';
9
+ class?: string;
10
+ }
11
+
12
+ const {
13
+ size,
14
+ card = 'simple',
15
+ as: Tag = 'div',
16
+ class: className,
17
+ } = Astro.props;
18
+ ---
19
+
20
+ <Tag
21
+ class:list={[
22
+ card !== 'none' && 'mw-card',
23
+ card === 'simple' && 'mw-card-simple',
24
+ size && `mw-bento-${size}`,
25
+ className,
26
+ ]}
27
+ >
28
+ <slot />
29
+ </Tag>
@@ -4,7 +4,9 @@
4
4
  import { config } from '../dist/config.js';
5
5
  import { PACKAGE_ICONS } from '../dist/icons.js';
6
6
  import { withBase } from '../dist/path.js';
7
+ import { breadcrumbList } from '../dist/structured-data.js';
7
8
  import Icon from './Icon.astro';
9
+ import JsonLd from './JsonLd.astro';
8
10
 
9
11
  interface Props {
10
12
  items: readonly { label: string; href: string }[];
@@ -27,6 +29,9 @@ const {
27
29
  small = false,
28
30
  class: className = 'mw-mt-8 mw-mb-8',
29
31
  } = Astro.props;
32
+ const trail = Astro.site
33
+ ? breadcrumbList([{ label: homeLabel, href: homeHref }, ...items], Astro.site)
34
+ : null;
30
35
  ---
31
36
 
32
37
  <nav
@@ -67,3 +72,4 @@ const {
67
72
  }
68
73
  </ol>
69
74
  </nav>
75
+ {trail && <JsonLd data={trail} />}