ferst-core 0.15.0 → 0.17.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/NOTICE +63 -31
- package/README.md +13 -4
- package/bin/ferst-media.mjs +96 -0
- package/bin/ferst-modules.mjs +17 -2
- package/components/BlockRenderer.astro +131 -129
- package/components/Card.astro +53 -51
- package/components/MembersAccount.astro +370 -0
- package/components/PostCard.astro +138 -136
- package/components/SiteHeader.astro +32 -14
- package/components/blocks/Grid.astro +49 -48
- package/components/blocks/Heading.astro +4 -1
- package/components/islands/BookMonth.tsx +95 -0
- package/components/islands/MembersAccount.tsx +392 -0
- package/components/recipes/Banner.astro +146 -146
- package/components/recipes/Book.astro +1147 -926
- package/components/recipes/FeatureCards.astro +112 -118
- package/components/recipes/Gallery.astro +57 -59
- package/components/recipes/Hero.astro +112 -10
- package/components/recipes/LatestPosts.astro +295 -292
- package/components/recipes/Locations.astro +146 -143
- package/components/recipes/Marquee.astro +75 -75
- package/components/recipes/MediaCards.astro +213 -219
- package/components/recipes/MembersContent.astro +176 -0
- package/components/recipes/Pricing.astro +149 -150
- package/components/recipes/Stats.astro +150 -157
- package/components/recipes/Tiles.astro +342 -296
- package/content/blocks.ts +1091 -1024
- package/content/cookies.ts +14 -0
- package/content/imageSlots.mjs +542 -0
- package/content/recipe-questions.ts +81 -80
- package/content/schemas.ts +13 -11
- package/examples/recipes.ts +5 -0
- package/fonts/OFL.txt +1332 -287
- package/fonts/anton-latin-400-normal.woff2 +0 -0
- package/fonts/bangers-latin-400-normal.woff2 +0 -0
- package/fonts/bebas-neue-latin-400-normal.woff2 +0 -0
- package/fonts/bowlby-one-latin-400-normal.woff2 +0 -0
- package/fonts/fredoka-latin-400-normal.woff2 +0 -0
- package/fonts/fredoka-latin-600-normal.woff2 +0 -0
- package/fonts/fredoka-latin-700-normal.woff2 +0 -0
- package/fonts/knewave-latin-400-normal.woff2 +0 -0
- package/fonts/lora-latin-400-normal.woff2 +0 -0
- package/fonts/lora-latin-600-normal.woff2 +0 -0
- package/fonts/lora-latin-700-normal.woff2 +0 -0
- package/fonts/merriweather-latin-400-normal.woff2 +0 -0
- package/fonts/merriweather-latin-600-normal.woff2 +0 -0
- package/fonts/merriweather-latin-700-normal.woff2 +0 -0
- package/fonts/nunito-latin-400-normal.woff2 +0 -0
- package/fonts/nunito-latin-600-normal.woff2 +0 -0
- package/fonts/nunito-latin-700-normal.woff2 +0 -0
- package/fonts/oswald-latin-400-normal.woff2 +0 -0
- package/fonts/oswald-latin-600-normal.woff2 +0 -0
- package/fonts/oswald-latin-700-normal.woff2 +0 -0
- package/fonts/rubik-dirt-latin-400-normal.woff2 +0 -0
- package/integration.mjs +319 -263
- package/layouts/Base.astro +8 -16
- package/lib/book.ts +416 -378
- package/lib/fonts.ts +130 -0
- package/lib/gridRows.ts +197 -0
- package/lib/image-fields.ts +140 -0
- package/lib/image-size.mjs +108 -73
- package/lib/image-sizes.ts +16 -0
- package/lib/logo-header.ts +46 -0
- package/lib/media-check.mjs +524 -0
- package/lib/members-account.ts +276 -0
- package/lib/members.ts +115 -0
- package/lib/theme-preview.ts +203 -140
- package/lib/themeTokens.ts +235 -220
- package/package.json +80 -71
- package/routes/account.astro +16 -0
- package/routes/cookie-policy.astro +28 -28
- package/styles/fonts.css +239 -76
- package/styles/theme.css +228 -160
- package/lib/gridColumns.ts +0 -22
package/NOTICE
CHANGED
|
@@ -1,31 +1,63 @@
|
|
|
1
|
-
Ferst Core
|
|
2
|
-
Copyright 2026 MyAI4 Ltd
|
|
3
|
-
|
|
4
|
-
This product includes software developed by MyAI4 Ltd (https://ferst.co.uk).
|
|
5
|
-
|
|
6
|
-
Versions 0.2.0 and later are licensed under the Business Source License 1.1
|
|
7
|
-
(see LICENSE). The Licensed Work may be used in production to build, operate
|
|
8
|
-
and maintain individual websites, but not to provide a multi-tenant or hosted
|
|
9
|
-
website service to third parties. Four years after a version is published it
|
|
10
|
-
converts automatically to the Change License, the Apache License, Version 2.0
|
|
11
|
-
(see LICENSE-Apache-2.0).
|
|
12
|
-
|
|
13
|
-
Versions 0.1.x were released under the Apache License, Version 2.0 and remain
|
|
14
|
-
available under that licence.
|
|
15
|
-
|
|
16
|
-
When you redistribute this software or a derivative work, retain this NOTICE
|
|
17
|
-
and the attribution above.
|
|
18
|
-
|
|
19
|
-
--------------------------------------------------------------------------------
|
|
20
|
-
Third-party notices
|
|
21
|
-
|
|
22
|
-
Some inline icon shapes in lib/icons.ts are derived from Lucide
|
|
23
|
-
(https://lucide.dev), used under the ISC License:
|
|
24
|
-
|
|
25
|
-
Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part
|
|
26
|
-
of Feather (MIT). All other copyright (c) for Lucide are held by Lucide
|
|
27
|
-
Contributors 2022.
|
|
28
|
-
|
|
29
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
30
|
-
purpose with or without fee is hereby granted, provided that the above
|
|
31
|
-
copyright notice and this permission notice appear in all copies.
|
|
1
|
+
Ferst Core
|
|
2
|
+
Copyright 2026 MyAI4 Ltd
|
|
3
|
+
|
|
4
|
+
This product includes software developed by MyAI4 Ltd (https://ferst.co.uk).
|
|
5
|
+
|
|
6
|
+
Versions 0.2.0 and later are licensed under the Business Source License 1.1
|
|
7
|
+
(see LICENSE). The Licensed Work may be used in production to build, operate
|
|
8
|
+
and maintain individual websites, but not to provide a multi-tenant or hosted
|
|
9
|
+
website service to third parties. Four years after a version is published it
|
|
10
|
+
converts automatically to the Change License, the Apache License, Version 2.0
|
|
11
|
+
(see LICENSE-Apache-2.0).
|
|
12
|
+
|
|
13
|
+
Versions 0.1.x were released under the Apache License, Version 2.0 and remain
|
|
14
|
+
available under that licence.
|
|
15
|
+
|
|
16
|
+
When you redistribute this software or a derivative work, retain this NOTICE
|
|
17
|
+
and the attribution above.
|
|
18
|
+
|
|
19
|
+
--------------------------------------------------------------------------------
|
|
20
|
+
Third-party notices
|
|
21
|
+
|
|
22
|
+
Some inline icon shapes in lib/icons.ts are derived from Lucide
|
|
23
|
+
(https://lucide.dev), used under the ISC License:
|
|
24
|
+
|
|
25
|
+
Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part
|
|
26
|
+
of Feather (MIT). All other copyright (c) for Lucide are held by Lucide
|
|
27
|
+
Contributors 2022.
|
|
28
|
+
|
|
29
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
30
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
31
|
+
copyright notice and this permission notice appear in all copies.
|
|
32
|
+
|
|
33
|
+
The Book block's month (look: "calendar") is a React island (docs/BLOCK-ARCHITECTURE.md
|
|
34
|
+
section 8). What it ships to a visitor's browser includes:
|
|
35
|
+
|
|
36
|
+
- React, React DOM, scheduler and use-sync-external-store
|
|
37
|
+
(https://github.com/facebook/react), Copyright (c) Meta Platforms, Inc. and affiliates,
|
|
38
|
+
and @astrojs/react (https://github.com/withastro/astro), Copyright (c) 2021 Fred K.
|
|
39
|
+
Schott (with portions Copyright (c) 2020 SvelteKit contributors), under the MIT License:
|
|
40
|
+
|
|
41
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
42
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
43
|
+
the Software without restriction, including without limitation the rights to
|
|
44
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
45
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
46
|
+
subject to the following conditions:
|
|
47
|
+
|
|
48
|
+
The above copyright notice and this permission notice shall be included in all
|
|
49
|
+
copies or substantial portions of the Software.
|
|
50
|
+
|
|
51
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
52
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
53
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
54
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
|
55
|
+
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
56
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
57
|
+
|
|
58
|
+
- React Aria Components, React Aria, React Stately, @internationalized/date,
|
|
59
|
+
@internationalized/string, @internationalized/number and @react-types/shared
|
|
60
|
+
(https://github.com/adobe/react-spectrum), Copyright 2019 Adobe, and @swc/helpers
|
|
61
|
+
(https://github.com/swc-project/swc), Copyright (c) SWC contributors, under the Apache
|
|
62
|
+
License, Version 2.0 (a copy is in LICENSE-Apache-2.0). None of them carries a NOTICE
|
|
63
|
+
file of its own.
|
package/README.md
CHANGED
|
@@ -67,17 +67,26 @@ No code change; the colours live in your repo, edited by hand or in the CMS:
|
|
|
67
67
|
"corners": "rounded",
|
|
68
68
|
"elevation": "raised",
|
|
69
69
|
"stroke": "on",
|
|
70
|
-
"fields": "boxed"
|
|
70
|
+
"fields": "boxed",
|
|
71
|
+
"titleEffect": "none"
|
|
71
72
|
}
|
|
72
73
|
```
|
|
73
74
|
|
|
74
75
|
`brand` drives buttons/links/accents, `ink` text, `surface` backgrounds (cards,
|
|
75
|
-
sections and borders are tinted from it). The
|
|
76
|
-
`elevation` / `stroke` / `fields` — are set once and apply
|
|
77
|
-
|
|
76
|
+
sections and borders are tinted from it). The knobs — `corners` /
|
|
77
|
+
`elevation` / `stroke` / `fields` / `titleEffect` — are set once and apply across
|
|
78
|
+
the whole site. Set no brand and the neutral defaults stand. For the rare token that
|
|
78
79
|
must differ from what the three colours derive, `advanced.light` / `advanced.dark`
|
|
79
80
|
are raw `{ "--token": "value" }` escape hatches layered last.
|
|
80
81
|
|
|
82
|
+
Fonts are picked from a curated set of self-hosted, open-licence faces grouped by
|
|
83
|
+
mood (`lib/fonts.ts`: clean, rounded, serif, bold condensed, punchy, brush), each
|
|
84
|
+
offered only for the roles it suits; poster and brush faces are for display titles,
|
|
85
|
+
never body text. A face downloads only when a page uses it. `titleEffect` (`none`,
|
|
86
|
+
`stroke`, `shadow` or `glow`) gives the display titles (the opener, banners, the
|
|
87
|
+
marquee) an outline, a poster shadow or a glow in the brand colour; it never changes
|
|
88
|
+
the text colour itself, so the theme's contrast holds.
|
|
89
|
+
|
|
81
90
|
## Licence
|
|
82
91
|
|
|
83
92
|
[Business Source License 1.1](./LICENSE) from v0.2.0 (v0.1.x was Apache-2.0 and stays
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// ferst-media — the site's pictures against the places they're shown (content/imageSlots.mjs).
|
|
3
|
+
// Run it in a site's folder:
|
|
4
|
+
//
|
|
5
|
+
// npx --no-install ferst-media check # each picture used, per place: ok, fixable or remake
|
|
6
|
+
// npx --no-install ferst-media brief # the shape and size each place on this site needs
|
|
7
|
+
// npx --no-install ferst-media brief --all # every place a picture can go, used or not
|
|
8
|
+
// npx --no-install ferst-media check --json # the same, as JSON (also for brief)
|
|
9
|
+
// npx --no-install ferst-media check <folder> # a site in another folder
|
|
10
|
+
//
|
|
11
|
+
// Advice only: it never changes a picture and always exits 0, so it can't fail a build.
|
|
12
|
+
import { readFileSync, realpathSync } from 'node:fs';
|
|
13
|
+
import { join, resolve } from 'node:path';
|
|
14
|
+
import { pathToFileURL } from 'node:url';
|
|
15
|
+
import { briefSite, checkSite, formatBrief, formatCheck } from '../lib/media-check.mjs';
|
|
16
|
+
|
|
17
|
+
export const HELP = `ferst-media: the site's pictures against the places they're shown.
|
|
18
|
+
|
|
19
|
+
ferst-media check [folder] [--json]
|
|
20
|
+
Each picture the pages, posts and logo settings use, per place:
|
|
21
|
+
ok fits the place
|
|
22
|
+
fixable close to the place's shape, too big, or with a plain border baked in
|
|
23
|
+
remake too far from the shape, or too small: it needs a new version
|
|
24
|
+
and the media rules each file breaks (names in lower case with hyphens,
|
|
25
|
+
nothing wider than 2400 pixels, no location data).
|
|
26
|
+
|
|
27
|
+
ferst-media brief [folder] [--all] [--json]
|
|
28
|
+
The places this site's pages show pictures, with the shape, size and tips for
|
|
29
|
+
each: a brief for whoever supplies the pictures. --all lists every place.
|
|
30
|
+
|
|
31
|
+
Nothing is changed and the exit code is always 0. Fitting pictures to their places
|
|
32
|
+
automatically (ferst-media fit) is planned; until then, a fixable picture is trimmed,
|
|
33
|
+
cropped or scaled in any image editor.`;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* True when THIS file is run as a CLI (not imported). Each bin needs its own copy:
|
|
37
|
+
* `import.meta.url` is per file. Handles npm's `node_modules/.bin` symlink via realpath.
|
|
38
|
+
*/
|
|
39
|
+
export function isDirectInvocation(argv1) {
|
|
40
|
+
if (!argv1) return false;
|
|
41
|
+
if (import.meta.url === pathToFileURL(argv1).href) return true;
|
|
42
|
+
try {
|
|
43
|
+
return import.meta.url === pathToFileURL(realpathSync(argv1)).href;
|
|
44
|
+
} catch {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** The command, the site's folder and the flags from the arguments. */
|
|
50
|
+
export function parseArgs(argv) {
|
|
51
|
+
const flags = new Set(argv.filter((a) => a.startsWith('--')));
|
|
52
|
+
const rest = argv.filter((a) => !a.startsWith('--'));
|
|
53
|
+
const command = ['check', 'brief'].includes(rest[0]) ? rest.shift() : rest[0] ? 'help' : 'check';
|
|
54
|
+
return { command, root: resolve(rest[0] ?? '.'), json: flags.has('--json'), all: flags.has('--all'), help: flags.has('--help') || flags.has('-h') };
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** sharp, when the site has it (it comes with Astro): it finds borders baked into pictures. */
|
|
58
|
+
async function loadSharp() {
|
|
59
|
+
try {
|
|
60
|
+
return (await import('sharp')).default;
|
|
61
|
+
} catch {
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function siteName(root) {
|
|
67
|
+
try {
|
|
68
|
+
const s = JSON.parse(readFileSync(join(root, 'src/content/siteSettings/index.json'), 'utf8'));
|
|
69
|
+
return s?.identity?.siteTitle || s?.identity?.shortName || '';
|
|
70
|
+
} catch {
|
|
71
|
+
return '';
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Run one command and return what it prints. */
|
|
76
|
+
export async function run(argv, { sharp } = {}) {
|
|
77
|
+
const args = parseArgs(argv);
|
|
78
|
+
if (args.help || args.command === 'help') return HELP;
|
|
79
|
+
if (args.command === 'brief') {
|
|
80
|
+
const entries = briefSite(args.root, { all: args.all });
|
|
81
|
+
return args.json ? JSON.stringify(entries, null, 2) : formatBrief(entries, { siteName: siteName(args.root) });
|
|
82
|
+
}
|
|
83
|
+
const result = await checkSite(args.root, { sharp: sharp === undefined ? await loadSharp() : sharp });
|
|
84
|
+
return args.json ? JSON.stringify(result, null, 2) : formatCheck(result);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
async function main() {
|
|
88
|
+
try {
|
|
89
|
+
console.log(await run(process.argv.slice(2)));
|
|
90
|
+
} catch (err) {
|
|
91
|
+
console.log(`ferst-media couldn't finish: ${err instanceof Error ? err.message : err}`);
|
|
92
|
+
}
|
|
93
|
+
process.exitCode = 0;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (isDirectInvocation(process.argv[1])) main();
|
package/bin/ferst-modules.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// ferst-modules — what this site has from its organisation's modules in the Ferst portal:
|
|
3
|
-
// the forms it can place, what it can take payment for and bookings for,
|
|
3
|
+
// the forms it can place, what it can take payment for and bookings for, its members' pages, and
|
|
4
|
+
// the calendar it shows.
|
|
4
5
|
// Run it in a client repo root:
|
|
5
6
|
//
|
|
6
7
|
// npx --no-install ferst-modules # the site named in ferst-site.json
|
|
@@ -10,7 +11,8 @@
|
|
|
10
11
|
// Forms and calendars live in the portal, never in the repo: place a form with a
|
|
11
12
|
// `{ "type": "form", "form": "<its name on this site>" }` block, take a payment with a
|
|
12
13
|
// `{ "type": "pay", "item": "<its id>" }` block, take bookings with a
|
|
13
|
-
// `{ "type": "book", "service": "<its id>" }` block (or `"resource"`, for a person or a place),
|
|
14
|
+
// `{ "type": "book", "service": "<its id>" }` block (or `"resource"`, for a person or a place), show a
|
|
15
|
+
// members' page with a `{ "type": "membersContent", "page": "<its id>" }` block, and show the calendar by setting
|
|
14
16
|
// calendarSettings.embedUrl to the address printed here.
|
|
15
17
|
import { readFileSync, realpathSync } from 'node:fs';
|
|
16
18
|
import { resolve } from 'node:path';
|
|
@@ -105,6 +107,19 @@ export function formatModules(data) {
|
|
|
105
107
|
out.push('');
|
|
106
108
|
}
|
|
107
109
|
|
|
110
|
+
// Members (platform 2026-11-30+): the members' pages this site shows, titles only (the pages
|
|
111
|
+
// themselves are members-only and never in the repo).
|
|
112
|
+
if (data.modules.members !== undefined || data.members !== undefined) {
|
|
113
|
+
out.push('Members');
|
|
114
|
+
if (!data.modules.members) out.push(' The Members module is off for this site.');
|
|
115
|
+
else if (!data.members?.pages?.length) out.push(' No members’ pages on this site yet. They are written in the portal (Members, Pages).');
|
|
116
|
+
for (const p of data.members?.pages ?? []) {
|
|
117
|
+
out.push(` ${p.title}`);
|
|
118
|
+
out.push(` place it with: { "type": "membersContent", "page": "${p.id}" }`);
|
|
119
|
+
}
|
|
120
|
+
out.push('');
|
|
121
|
+
}
|
|
122
|
+
|
|
108
123
|
// `calendar` since the platform renamed the module (2026-11-19); `events` before it.
|
|
109
124
|
const calendar = data.calendar !== undefined ? data.calendar : data.events;
|
|
110
125
|
out.push('Calendar');
|
|
@@ -1,129 +1,131 @@
|
|
|
1
|
-
---
|
|
2
|
-
/**
|
|
3
|
-
* Renders an ordered list of blocks by mapping each block's `type` to its
|
|
4
|
-
* component via a registry. Disabled blocks are skipped. The registry is typed
|
|
5
|
-
* `Record<BlockType, …>`, so adding a block type to the union without a renderer
|
|
6
|
-
* here is a compile error — no silent `undefined` component at runtime.
|
|
7
|
-
*/
|
|
8
|
-
import type { Block, BlockType } from '../content/blocks';
|
|
9
|
-
import Heading from './blocks/Heading.astro';
|
|
10
|
-
import Prose from './blocks/Prose.astro';
|
|
11
|
-
import ImageBlock from './blocks/ImageBlock.astro';
|
|
12
|
-
import ButtonBlock from './blocks/ButtonBlock.astro';
|
|
13
|
-
import Quote from './blocks/Quote.astro';
|
|
14
|
-
import Divider from './blocks/Divider.astro';
|
|
15
|
-
import Spacer from './blocks/Spacer.astro';
|
|
16
|
-
import Badge from './blocks/Badge.astro';
|
|
17
|
-
import Stat from './blocks/Stat.astro';
|
|
18
|
-
import List from './blocks/List.astro';
|
|
19
|
-
import Section from './blocks/Section.astro';
|
|
20
|
-
import Grid from './blocks/Grid.astro';
|
|
21
|
-
import Stack from './blocks/Stack.astro';
|
|
22
|
-
import Hero from './recipes/Hero.astro';
|
|
23
|
-
import FeatureCards from './recipes/FeatureCards.astro';
|
|
24
|
-
import Cta from './recipes/Cta.astro';
|
|
25
|
-
import Faq from './recipes/Faq.astro';
|
|
26
|
-
import Gallery from './recipes/Gallery.astro';
|
|
27
|
-
import Testimonial from './recipes/Testimonial.astro';
|
|
28
|
-
import ContactForm from './recipes/ContactForm.astro';
|
|
29
|
-
import Form from './recipes/Form.astro';
|
|
30
|
-
import Pay from './recipes/Pay.astro';
|
|
31
|
-
import Book from './recipes/Book.astro';
|
|
32
|
-
import
|
|
33
|
-
import
|
|
34
|
-
import
|
|
35
|
-
import
|
|
36
|
-
import
|
|
37
|
-
import
|
|
38
|
-
import
|
|
39
|
-
import
|
|
40
|
-
import
|
|
41
|
-
import
|
|
42
|
-
import
|
|
43
|
-
import
|
|
44
|
-
import
|
|
45
|
-
import
|
|
46
|
-
import
|
|
47
|
-
import
|
|
48
|
-
import
|
|
49
|
-
import
|
|
50
|
-
import
|
|
51
|
-
import
|
|
52
|
-
import
|
|
53
|
-
import
|
|
54
|
-
import
|
|
55
|
-
import
|
|
56
|
-
import
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
//
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* Renders an ordered list of blocks by mapping each block's `type` to its
|
|
4
|
+
* component via a registry. Disabled blocks are skipped. The registry is typed
|
|
5
|
+
* `Record<BlockType, …>`, so adding a block type to the union without a renderer
|
|
6
|
+
* here is a compile error — no silent `undefined` component at runtime.
|
|
7
|
+
*/
|
|
8
|
+
import type { Block, BlockType } from '../content/blocks';
|
|
9
|
+
import Heading from './blocks/Heading.astro';
|
|
10
|
+
import Prose from './blocks/Prose.astro';
|
|
11
|
+
import ImageBlock from './blocks/ImageBlock.astro';
|
|
12
|
+
import ButtonBlock from './blocks/ButtonBlock.astro';
|
|
13
|
+
import Quote from './blocks/Quote.astro';
|
|
14
|
+
import Divider from './blocks/Divider.astro';
|
|
15
|
+
import Spacer from './blocks/Spacer.astro';
|
|
16
|
+
import Badge from './blocks/Badge.astro';
|
|
17
|
+
import Stat from './blocks/Stat.astro';
|
|
18
|
+
import List from './blocks/List.astro';
|
|
19
|
+
import Section from './blocks/Section.astro';
|
|
20
|
+
import Grid from './blocks/Grid.astro';
|
|
21
|
+
import Stack from './blocks/Stack.astro';
|
|
22
|
+
import Hero from './recipes/Hero.astro';
|
|
23
|
+
import FeatureCards from './recipes/FeatureCards.astro';
|
|
24
|
+
import Cta from './recipes/Cta.astro';
|
|
25
|
+
import Faq from './recipes/Faq.astro';
|
|
26
|
+
import Gallery from './recipes/Gallery.astro';
|
|
27
|
+
import Testimonial from './recipes/Testimonial.astro';
|
|
28
|
+
import ContactForm from './recipes/ContactForm.astro';
|
|
29
|
+
import Form from './recipes/Form.astro';
|
|
30
|
+
import Pay from './recipes/Pay.astro';
|
|
31
|
+
import Book from './recipes/Book.astro';
|
|
32
|
+
import MembersContent from './recipes/MembersContent.astro';
|
|
33
|
+
import Accordion from './recipes/Accordion.astro';
|
|
34
|
+
import Tiles from './recipes/Tiles.astro';
|
|
35
|
+
import Banner from './recipes/Banner.astro';
|
|
36
|
+
import Stats from './recipes/Stats.astro';
|
|
37
|
+
import Steps from './recipes/Steps.astro';
|
|
38
|
+
import Pricing from './recipes/Pricing.astro';
|
|
39
|
+
import Logos from './recipes/Logos.astro';
|
|
40
|
+
import Tabs from './recipes/Tabs.astro';
|
|
41
|
+
import Announcement from './recipes/Announcement.astro';
|
|
42
|
+
import Bento from './recipes/Bento.astro';
|
|
43
|
+
import Marquee from './recipes/Marquee.astro';
|
|
44
|
+
import LatestPosts from './recipes/LatestPosts.astro';
|
|
45
|
+
import MapEmbed from './recipes/MapEmbed.astro';
|
|
46
|
+
import Table from './recipes/Table.astro';
|
|
47
|
+
import Notice from './recipes/Notice.astro';
|
|
48
|
+
import MediaCards from './recipes/MediaCards.astro';
|
|
49
|
+
import ContactCard from './recipes/ContactCard.astro';
|
|
50
|
+
import Locations from './recipes/Locations.astro';
|
|
51
|
+
import Video from './recipes/Video.astro';
|
|
52
|
+
import Documents from './recipes/Documents.astro';
|
|
53
|
+
import LinkRow from './recipes/LinkRow.astro';
|
|
54
|
+
import DocumentRecipe from './recipes/Document.astro';
|
|
55
|
+
import Timetable from './recipes/Timetable.astro';
|
|
56
|
+
import Contacts from './recipes/Contacts.astro';
|
|
57
|
+
import MediaText from './recipes/MediaText.astro';
|
|
58
|
+
|
|
59
|
+
interface Props {
|
|
60
|
+
blocks: Block[];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const { blocks } = Astro.props;
|
|
64
|
+
|
|
65
|
+
const registry: Record<BlockType, any> = {
|
|
66
|
+
heading: Heading,
|
|
67
|
+
prose: Prose,
|
|
68
|
+
image: ImageBlock,
|
|
69
|
+
button: ButtonBlock,
|
|
70
|
+
quote: Quote,
|
|
71
|
+
divider: Divider,
|
|
72
|
+
spacer: Spacer,
|
|
73
|
+
badge: Badge,
|
|
74
|
+
stat: Stat,
|
|
75
|
+
list: List,
|
|
76
|
+
section: Section,
|
|
77
|
+
grid: Grid,
|
|
78
|
+
stack: Stack,
|
|
79
|
+
hero: Hero,
|
|
80
|
+
featureCards: FeatureCards,
|
|
81
|
+
cta: Cta,
|
|
82
|
+
faq: Faq,
|
|
83
|
+
gallery: Gallery,
|
|
84
|
+
testimonial: Testimonial,
|
|
85
|
+
contactForm: ContactForm,
|
|
86
|
+
form: Form,
|
|
87
|
+
pay: Pay,
|
|
88
|
+
book: Book,
|
|
89
|
+
membersContent: MembersContent,
|
|
90
|
+
accordion: Accordion,
|
|
91
|
+
tiles: Tiles,
|
|
92
|
+
banner: Banner,
|
|
93
|
+
stats: Stats,
|
|
94
|
+
steps: Steps,
|
|
95
|
+
pricing: Pricing,
|
|
96
|
+
logos: Logos,
|
|
97
|
+
tabs: Tabs,
|
|
98
|
+
announcement: Announcement,
|
|
99
|
+
bento: Bento,
|
|
100
|
+
marquee: Marquee,
|
|
101
|
+
latestPosts: LatestPosts,
|
|
102
|
+
mapEmbed: MapEmbed,
|
|
103
|
+
table: Table,
|
|
104
|
+
notice: Notice,
|
|
105
|
+
mediaCards: MediaCards,
|
|
106
|
+
contactCard: ContactCard,
|
|
107
|
+
locations: Locations,
|
|
108
|
+
video: Video,
|
|
109
|
+
documents: Documents,
|
|
110
|
+
linkRow: LinkRow,
|
|
111
|
+
document: DocumentRecipe,
|
|
112
|
+
timetable: Timetable,
|
|
113
|
+
contacts: Contacts,
|
|
114
|
+
mediaText: MediaText,
|
|
115
|
+
};
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
{
|
|
119
|
+
blocks
|
|
120
|
+
.filter((block) => block.enabled !== false)
|
|
121
|
+
.map((block) => {
|
|
122
|
+
const Component = registry[block.type];
|
|
123
|
+
// A block's own `align` sets the alignment cascade for everything inside it. The
|
|
124
|
+
// wrapper is `display: contents`, so it adds no box and the layout is unchanged;
|
|
125
|
+
// heading / banner / section handle their own `align`.
|
|
126
|
+
const own = block.type === 'heading' || block.type === 'banner' || block.type === 'section';
|
|
127
|
+
return block.align && !own
|
|
128
|
+
? <div class="block-align" data-content-align={block.align}><Component {...block} /></div>
|
|
129
|
+
: <Component {...block} />;
|
|
130
|
+
})
|
|
131
|
+
}
|
package/components/Card.astro
CHANGED
|
@@ -1,51 +1,53 @@
|
|
|
1
|
-
---
|
|
2
|
-
interface Props {
|
|
3
|
-
as?: string;
|
|
4
|
-
hover?: boolean;
|
|
5
|
-
padding?: string;
|
|
6
|
-
overflow?: string;
|
|
7
|
-
class?: string;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
border: var(--
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
1
|
+
---
|
|
2
|
+
interface Props {
|
|
3
|
+
as?: string;
|
|
4
|
+
hover?: boolean;
|
|
5
|
+
padding?: string;
|
|
6
|
+
overflow?: string;
|
|
7
|
+
class?: string;
|
|
8
|
+
/** Extra inline style, e.g. a planned grid's placement (lib/gridRows). */
|
|
9
|
+
style?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const { as: Tag = 'div', hover = true, padding = '1.25rem 1.5rem', overflow = 'hidden', class: className, style } = Astro.props;
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
<Tag class:list={['card', { 'card--hover': hover }, className]} style={`--card-padding: ${padding}; --card-overflow: ${overflow}${style ? `; ${style}` : ''}`}>
|
|
16
|
+
<slot />
|
|
17
|
+
</Tag>
|
|
18
|
+
|
|
19
|
+
<style>
|
|
20
|
+
/* Token-driven so the global surface "knobs" (--radius / --card-border /
|
|
21
|
+
--shadow-*) restyle every card at once, in both themes. */
|
|
22
|
+
.card {
|
|
23
|
+
position: relative;
|
|
24
|
+
border-radius: var(--radius);
|
|
25
|
+
background: var(--bg-surface);
|
|
26
|
+
border: var(--card-border);
|
|
27
|
+
box-shadow: var(--shadow-md);
|
|
28
|
+
overflow: var(--card-overflow, hidden);
|
|
29
|
+
padding: var(--card-padding);
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-direction: column;
|
|
32
|
+
/* Children follow the page / section alignment (Base: --content-items). */
|
|
33
|
+
align-items: var(--content-items, stretch);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.card--hover {
|
|
37
|
+
transition: transform 0.2s ease, box-shadow 0.2s ease;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.card--hover:hover {
|
|
41
|
+
transform: translateY(-4px);
|
|
42
|
+
box-shadow: var(--shadow-lg);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@media (prefers-reduced-motion: reduce) {
|
|
46
|
+
.card--hover {
|
|
47
|
+
transition: none;
|
|
48
|
+
}
|
|
49
|
+
.card--hover:hover {
|
|
50
|
+
transform: none;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
</style>
|