domma-cms 1.81.0 → 1.82.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/CHANGELOG.md +7 -0
- package/admin/js/templates/docs/usage-site-settings.html +18 -0
- package/admin/js/templates/settings.html +6 -6
- package/docs/DommaFeatures.md +1 -1
- package/docs/plans/2026-11-19-brand-kit-design.md +1 -1
- package/package.json +1 -1
- package/plugins/free-tier.lock.json +9 -9
- package/plugins/theme-roller/CLAUDE.md +9 -0
- package/plugins/theme-roller/admin/lib/themes.js +49 -0
- package/plugins/theme-roller/admin/templates/theme-roller.html +2 -0
- package/plugins/theme-roller/admin/views/theme-roller-view.js +25 -2
- package/plugins/theme-roller/docs/guide.md +1 -0
- package/plugins/theme-roller/plugin.json +1 -1
- package/plugins/theme-roller/tests/themes.test.js +20 -0
- package/public/js/site.js +1 -1
- package/server/routes/favicon.js +10 -6
- package/server/services/adminBrand.js +8 -3
- package/server/services/brandKit.js +63 -1
- package/server/services/chat/launcher-bridge.js +2 -1
- package/server/services/launchers.js +5 -1
- package/server/services/renderer.js +7 -5
- package/server/templates/page.html +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.82.0] - 2026-11-20
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- **The Brand Kit fills the gaps on the website and in the admin.** Once a site has saved its Brand Kit (Site Settings > Branding), it is used wherever the site's own settings are empty: the browser icon (the Kit's square mark, else its logo; the letter icon takes its accent colour), a navbar brand with no name, logo or icon (the Kit's logo, else its name), the admin name and logos and the sign-in screen, chat launchers with no colour or picture of their own (its accent, and its mark unless the chat has a character), and og:site_name. Nothing you have set changes, and a site that never saved a Kit renders exactly as before. The theme is never changed. `GET /api/brand-kit` now says whether the Kit has been `saved`.
|
|
8
|
+
- **Theme Roller** 1.4.0: "New theme from Brand Kit" starts a new theme from the Kit's accent, colours and fonts. It never changes an existing theme.
|
|
9
|
+
|
|
3
10
|
## [1.81.0] - 2026-11-19
|
|
4
11
|
|
|
5
12
|
### Added
|
|
@@ -93,6 +93,24 @@
|
|
|
93
93
|
</ul>
|
|
94
94
|
<p>Save, then open <strong>SMTP > Email preview gallery</strong> to see your emails in the
|
|
95
95
|
Kit.</p>
|
|
96
|
+
<p>Once saved, the Kit also fills in what you have left empty elsewhere. Anything you have set
|
|
97
|
+
yourself stays as it is:</p>
|
|
98
|
+
<ul>
|
|
99
|
+
<li><strong>Browser icon</strong> - with no favicon and no brand logo, the Kit's square mark
|
|
100
|
+
(else its logo). With none of those, the letter icon takes the Kit's accent colour.</li>
|
|
101
|
+
<li><strong>Navbar brand</strong> - when the Public site brand has no name, logo or icon, the
|
|
102
|
+
navbar shows the Kit's logo (or, without one, its name).</li>
|
|
103
|
+
<li><strong>Admin and sign-in</strong> - an empty Admin name uses the Kit's name (else the
|
|
104
|
+
site title), and empty admin logos use the Kit's logo and dark logo, on the sign-in screen
|
|
105
|
+
too.</li>
|
|
106
|
+
<li><strong>Chat launchers</strong> - a chat with no colour of its own takes the Kit's accent,
|
|
107
|
+
and one with no picture (and no character) shows the Kit's square mark.</li>
|
|
108
|
+
<li><strong>Sharing</strong> - links shared on social media name the site by the Kit's
|
|
109
|
+
business name.</li>
|
|
110
|
+
</ul>
|
|
111
|
+
<p>The Kit never changes your theme. To make a theme in its colours, open the Theme Roller and
|
|
112
|
+
choose <strong>New theme from Brand Kit</strong>: it makes a new theme for you to look at,
|
|
113
|
+
and nothing changes until you use it.</p>
|
|
96
114
|
|
|
97
115
|
<h3 id="email-identity">Email identity</h3>
|
|
98
116
|
<p>Every email the site sends by itself - account invitations and password resets, form
|
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
<div class="tab-panel">
|
|
118
118
|
<div class="stx-card dm-settings-section" id="stx-brand-kit"><div class="stx-card-title dm-settings-section-title"><span data-icon="briefcase" data-icon-size="16" aria-hidden="true"></span>Brand Kit
|
|
119
119
|
<span data-help-title="Brand Kit" data-help="One brand for the whole site. Your emails use it now, and more of Domma will follow. Anything left empty uses what the site already has - the brand name, logo and contact details below and in the Footer tool. Changing the Kit never changes your theme."></span></div>
|
|
120
|
-
<p class="text-muted">Your business's name, logo, colours, fonts and contact details, in one place. Every automated email uses them. Leave a field empty to use what the site already has.</p>
|
|
120
|
+
<p class="text-muted">Your business's name, logo, colours, fonts and contact details, in one place. Every automated email uses them. Once saved, they also fill whatever you leave empty below and elsewhere: the browser icon, a blank navbar brand, the admin's name and logo (and the sign-in screen), and chat launchers' colour and picture. Your theme is never changed. Leave a Kit field empty to use what the site already has.</p>
|
|
121
121
|
<h4 class="stx-subhead">Names</h4>
|
|
122
122
|
<div class="stx-grid">
|
|
123
123
|
<div><label class="form-label" for="stx-kitName">Business name
|
|
@@ -203,7 +203,7 @@
|
|
|
203
203
|
<span data-help="Any legal wording your emails must carry. Shown in small type at the very bottom."></span></label>
|
|
204
204
|
<textarea id="stx-kitSmallPrint" class="form-input" rows="2" placeholder="Optional legal text" data-model="kitSmallPrint.value"></textarea></div>
|
|
205
205
|
</div>
|
|
206
|
-
<p class="text-muted">Social links come from the <a href="#/footer">Footer tool</a>. Email-only changes - a different name or logo just for email - go under the SMTP tab's Email identity.</p>
|
|
206
|
+
<p class="text-muted">To start a theme in these colours, open the Theme Roller and choose New theme from Brand Kit. Social links come from the <a href="#/footer">Footer tool</a>. Email-only changes - a different name or logo just for email - go under the SMTP tab's Email identity.</p>
|
|
207
207
|
</div>
|
|
208
208
|
<div class="stx-card-columns">
|
|
209
209
|
<div class="stx-card dm-settings-section"><div class="stx-card-title dm-settings-section-title"><span data-icon="globe" data-icon-size="16" aria-hidden="true"></span>Public site</div><div class="stx-grid">
|
|
@@ -211,7 +211,7 @@
|
|
|
211
211
|
<span data-help="Shows the name and mark in the navbar and footer. Off hides them and keeps the saved values for next time."></span></label>
|
|
212
212
|
<input id="stx-brand-enabled" type="checkbox" class="form-switch" data-model="brandEnabled.value"></div>
|
|
213
213
|
<div><label class="form-label" for="stx-brandText">Brand name</label>
|
|
214
|
-
<input id="stx-brandText" type="text" class="form-input" placeholder="My Site" data-model="brandText.value">
|
|
214
|
+
<input id="stx-brandText" type="text" class="form-input" placeholder="My Site - with logo and icon empty, the Brand Kit's name" data-model="brandText.value">
|
|
215
215
|
</div>
|
|
216
216
|
<div><label class="form-label" for="stx-brandUrl">Brand link</label>
|
|
217
217
|
<input id="stx-brandUrl" type="text" class="form-input" placeholder="/" data-model="brandUrl.value">
|
|
@@ -226,14 +226,14 @@
|
|
|
226
226
|
<div data-brand-icon="brandIcon"></div>
|
|
227
227
|
</div>
|
|
228
228
|
|
|
229
|
-
</div><p class="text-muted">The logo takes priority over the icon. Set the browser icon in <a href="#/appearance?tab=favicon">Appearance > Favicon</a
|
|
229
|
+
</div><p class="text-muted">The logo takes priority over the icon. With name, logo and icon all empty, the navbar shows the Brand Kit's logo (else its name). Set the browser icon in <a href="#/appearance?tab=favicon">Appearance > Favicon</a> - without one, the Brand Kit's square mark or logo is used.</p></div>
|
|
230
230
|
<div class="stx-card dm-settings-section"><div class="stx-card-title dm-settings-section-title"><span data-icon="layout" data-icon-size="16" aria-hidden="true"></span>Admin
|
|
231
|
-
<span data-help-title="Admin name and mark" data-help="The name and logo or icon at the top of the admin - in the top bar, the sidebar and the browser tab - for everyone who signs in. Leave the name empty to use the site title."></span></div><div class="stx-grid">
|
|
231
|
+
<span data-help-title="Admin name and mark" data-help="The name and logo or icon at the top of the admin - in the top bar, the sidebar and the browser tab - for everyone who signs in. Leave the name empty to use the Brand Kit's name (else the site title); leave the logos empty to use the Brand Kit's."></span></div><div class="stx-grid">
|
|
232
232
|
<div class="stx-setting stx-wide"><label class="form-label" for="stx-admin-brand-enabled">Show admin branding
|
|
233
233
|
<span data-help="Shows the name and mark in the admin top bar and sidebar, and the name in browser tab titles. Off hides them and keeps the saved values."></span></label>
|
|
234
234
|
<input id="stx-admin-brand-enabled" type="checkbox" class="form-switch" data-model="adminBrandEnabled.value"></div>
|
|
235
235
|
<div><label class="form-label" for="stx-adminBrandTitle">Admin name</label>
|
|
236
|
-
<input id="stx-adminBrandTitle" type="text" class="form-input" placeholder="Uses the site title
|
|
236
|
+
<input id="stx-adminBrandTitle" type="text" class="form-input" placeholder="Uses the Brand Kit's name, else the site title" data-model="adminBrandTitle.value">
|
|
237
237
|
</div>
|
|
238
238
|
<div><label class="form-label" for="stx-adminBrandLogo">Admin logo image</label>
|
|
239
239
|
<input id="stx-adminBrandLogo" type="text" class="form-input" placeholder="/media/logo.png" data-model="adminBrandLogo.value">
|
package/docs/DommaFeatures.md
CHANGED
|
@@ -1457,7 +1457,7 @@ The four Tools below were plugins until 0.67.0 and are now part of the CMS. They
|
|
|
1457
1457
|
Where: `server/services/publicCors.js`.
|
|
1458
1458
|
- **Email service** - A Nodemailer transport built from the SMTP settings in `site.json`, used for form emails, password resets and notices. With no SMTP host set, mail goes to a throwaway Ethereal test inbox, which reports success but delivers to nobody. The CMS makes this visible in Settings, in health checks and with an "Email not set up" notification. New sites ship with an SMTP host, defaulting to a local mail server on port 25 or taken from the environment.
|
|
1459
1459
|
Where: `server/services/email.js`, `bin/lib/smtp-defaults.js`, `POST /api/settings/test-email` - Since: 0.55.0.
|
|
1460
|
-
- **Brand Kit** - one site-wide brand under **Site Settings > Branding > Brand Kit** (`site.json` `brandKit`): business name, short name and registered name; logo, logo for dark backgrounds and a square mark (Media or https); accent colour and up to four named brand colours; heading and body fonts (safe fonts and Google fonts with safe fallbacks); contact email, phone, address, website, company number and VAT number; a footer line and small print. Every empty field falls back to what the site already had (`brand.text`/`title`, `brand.logo`/`logo`, `contactEmail`/footer email, the footer address, `baseUrl`), so sites look the same until the Kit is filled in - no migration. The Kit never changes the theme (its colours are not theme tokens). Automated emails read it (below); plugins read it with `hooks.brandKit()` (resolved, fallbacks applied); anyone can read the public parts at `GET /api/brand-kit` (absolute addresses, never SMTP or private settings). An SVG logo gets a PNG copy for mail programs at `GET /api/brand-kit/logo.png` (sharp, 480x192 max, cached; needs the Site URL - Needs attention says so otherwise).
|
|
1460
|
+
- **Brand Kit** - one site-wide brand under **Site Settings > Branding > Brand Kit** (`site.json` `brandKit`): business name, short name and registered name; logo, logo for dark backgrounds and a square mark (Media or https); accent colour and up to four named brand colours; heading and body fonts (safe fonts and Google fonts with safe fallbacks); contact email, phone, address, website, company number and VAT number; a footer line and small print. Every empty field falls back to what the site already had (`brand.text`/`title`, `brand.logo`/`logo`, `contactEmail`/footer email, the footer address, `baseUrl`), so sites look the same until the Kit is filled in - no migration. The Kit never changes the theme (its colours are not theme tokens). Automated emails read it (below); plugins read it with `hooks.brandKit()` (resolved, fallbacks applied); anyone can read the public parts at `GET /api/brand-kit` (absolute addresses, never SMTP or private settings). An SVG logo gets a PNG copy for mail programs at `GET /api/brand-kit/logo.png` (sharp, 480x192 max, cached; needs the Site URL - Needs attention says so otherwise). **Website and sign-in defaults** (phase 3): once the Kit has been SAVED (`updatedAt`; `savedBrand()` - the Kit's own fields, no fallbacks), it fills what the site leaves empty: favicon (`site.favicon`, `brand.logo`, then Kit mark, then Kit logo; letter icon in the Kit accent with black/white ink), a completely blank navbar brand (`navBrand()`, both render paths: the Kit logo alone with its name as `alt`, else the Kit name), admin name/logo/dark logo and the sign-in screen (`adminBrandFor`: own, then Kit, then site title), chat launchers' accent/accentText and avatar (`chatBrandDefaults()` in launchers.js and the chat bridge; a character keeps its art) and og:site_name. A site with no saved Kit renders byte-for-byte the same. `GET /api/brand-kit` carries `saved`. The Theme Roller's **New theme from Brand Kit** makes a new custom theme from it on request (the Kit never changes a theme). Email Pro's read-only **Site brand** and Invoices' fallback are phase 2 (Email Pro 0.24.0, Invoices 1.11.0). Next phases (Tools, the Manager): `docs/plans/2026-11-19-brand-kit-design.md`.
|
|
1461
1461
|
Where: `server/services/brandKit.js`, `server/routes/api/brand-kit.js`, `brandKitFromForm()` in `admin/js/lib/site-settings-arrange.js` - Since: unreleased.
|
|
1462
1462
|
- **One email look for every automated email** - Account invitations, password resets and security alerts, form notifications, automations, call invites, bookings and calendar mail, order and account emails from the Shop, invoices and quotes, Support, Docs and signing, Waypoint, Job Board, Surveys, Onboard, Campaigns layouts, Ecards, prize and game emails, SEO reports and Wiki updates all go out in one shared, mobile-friendly frame: the site's name and logo at the top, a label for the kind of email (Your account, Bookings, Your order...), an accent line and buttons in the site's colour, and a footer with the support address and a link to the site. Every email keeps a full plain-text version. It reads the **Brand Kit** (Site Settings > Branding; the footer also carries the registered name, company and VAT numbers, address and small print, and the Kit's fonts); **Site Settings > SMTP > Email identity** overrides it for email only - brand name, logo (PNG or JPEG; an SVG site logo falls back to the name), accent colour, support email and a footer line. The **Email preview gallery** beside it shows each kind with sample data and can send a test. Mail people write themselves (Email, Campaigns content) is never wrapped; an email already in one of Email Pro's brandings (an invoice sent in a brand) is not framed twice.
|
|
1463
1463
|
Where: `server/services/emailBrand.js` (`brandEmail`, `emailBrand`, `EMAIL_FAMILIES`), `sendEmail(transport, {branding: {family}})` in `server/services/email.js`, `server/services/emailExamples.js`, Settings > SMTP - Since: 1.78.0.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Brand Kit - one site-wide brand (design, not built)
|
|
2
2
|
|
|
3
|
-
Status: agreed design, 2026-11-19 (decisions below). Phase 1 built (feat/brand-kit); phases
|
|
3
|
+
Status: agreed design, 2026-11-19 (decisions below). Phase 1 released (CMS 1.81.0), phase 2 released (Email Pro 0.24.0, Invoices 1.11.0), phase 3 built (feat/brand-kit-site-defaults, with the marketplace's Theme Roller and Social Media Pro); phases 4-5 not started.
|
|
4
4
|
|
|
5
5
|
## The problem
|
|
6
6
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"note": "Written by `make sync-free-tier` in dcms-marketplace. Do not edit these plugins here - edit them there and sync.",
|
|
3
|
-
"source": "dcms-marketplace@
|
|
3
|
+
"source": "dcms-marketplace@c3d9700c",
|
|
4
4
|
"plugins": {
|
|
5
5
|
"blog": {
|
|
6
6
|
"version": "1.11.0",
|
|
@@ -373,22 +373,22 @@
|
|
|
373
373
|
}
|
|
374
374
|
},
|
|
375
375
|
"theme-roller": {
|
|
376
|
-
"version": "1.
|
|
376
|
+
"version": "1.4.0",
|
|
377
377
|
"files": {
|
|
378
|
-
"CLAUDE.md": "
|
|
378
|
+
"CLAUDE.md": "3f66142aa2ebe9968d63b237dc42e68bb441b67c01dd2a6d612fc7b2ab539c65",
|
|
379
379
|
"admin/css/theme-roller.css": "dfb2059fb6da0e5cfaf5bd4c1e1d5da7b1918f0edbeb2a2df8a2333094bc8149",
|
|
380
380
|
"admin/lib/prompt.js": "36ccd3f1536fbcfa57d69470157df633609ed7f1af41b7e351e4df13db210faf",
|
|
381
|
-
"admin/lib/themes.js": "
|
|
381
|
+
"admin/lib/themes.js": "66f3352e68107f698a0da84282c900cb2658293d0eee88b6e700d12a714a5aae",
|
|
382
382
|
"admin/lib/view.js": "16105e216465bfb0a7a9fe838af6deb5384904327906b98099abbad898b96cdf",
|
|
383
|
-
"admin/templates/theme-roller.html": "
|
|
384
|
-
"admin/views/theme-roller-view.js": "
|
|
383
|
+
"admin/templates/theme-roller.html": "e45837316f1f359bee96b9e55d19e61da9c3dcb298c56a0b7e211f43cf3eea92",
|
|
384
|
+
"admin/views/theme-roller-view.js": "f9adf76f8d8c755ac4bf87e6af46cef66375f265db6fb5c008789e581dbb67b9",
|
|
385
385
|
"config.js": "450f0af4f4c1ecc4c7180f2e364c8a59bfed69dd350fb6b47bce8641c2a37786",
|
|
386
|
-
"docs/guide.md": "
|
|
386
|
+
"docs/guide.md": "aaf83ff6b898c6a1aa3100076ff9ad9683933dce2d92260862f307c53db72054",
|
|
387
387
|
"plugin.js": "e685064cb17b879d41428c71a3a2b072501acaa964088c322964f27f622deff2",
|
|
388
|
-
"plugin.json": "
|
|
388
|
+
"plugin.json": "89eec785e3abf8297a0d56cca825841ea3c6a2b30b76d7bbee23601ad6f1c6d5",
|
|
389
389
|
"tests/api.test.js": "8ad5a76a1feebde7ad6dc3867ee49b25d4a33c3579e2149b955cd8333ab73ef0",
|
|
390
390
|
"tests/prompt-values.test.js": "8cedaecea858dd76bbb92923ad49f8a7b579a368e681265b095dbe13060edc24",
|
|
391
|
-
"tests/themes.test.js": "
|
|
391
|
+
"tests/themes.test.js": "14fd48851788516df9a988e911640419ae10e9bddf159e1e7a3e0bb7480783f2",
|
|
392
392
|
"tests/view.test.js": "24adb2c3e4f9d84dbcd8450addb134f75e2fec25667cda106ec8c80618247e94"
|
|
393
393
|
}
|
|
394
394
|
},
|
|
@@ -40,6 +40,15 @@ label) load as id = label = name.
|
|
|
40
40
|
- The public theme switcher cannot offer custom themes (the core refuses them there): a visitor can only switch
|
|
41
41
|
between built-in themes. Say so to a site owner who expects their custom theme in the switcher.
|
|
42
42
|
|
|
43
|
+
## Unreleased: New theme from Brand Kit (Brand Kit phase 3)
|
|
44
|
+
|
|
45
|
+
**From Brand Kit** on the Roller bar: `newFromKit()` reads core's public `GET /api/brand-kit` (CMS 1.81.0+; only
|
|
46
|
+
`accent`, `colours`, `fonts.body` are used, so no newer core is needed) and `themeFromKit()` (admin/lib/themes.js, pure,
|
|
47
|
+
tests/themes.test.js) turns it into changes: accent -> `--dm-primary` + hover/active/dark/light shades, `--dm-primary-text`
|
|
48
|
+
/ `-hover-text` (black or white), `--dm-link(-hover)`; colours -> `--dm-accent-1..4`; a body font -> `--dm-font-sans`
|
|
49
|
+
(stack). All through `cleanChanges`. It loads them as a NEW unsaved theme on the current base; the Kit never changes a
|
|
50
|
+
theme (Darryl's decision) - only Save + Content > Theme do.
|
|
51
|
+
|
|
43
52
|
## 1.2.0 (2026-10-15 Tool Upgrade, second pass)
|
|
44
53
|
|
|
45
54
|
- Saved themes: All / In use / Not in use with counts, a search box, and core's skeleton on the first load
|
|
@@ -194,3 +194,52 @@ export function badgeFor(themes, cfg = {}) {
|
|
|
194
194
|
}
|
|
195
195
|
};
|
|
196
196
|
}
|
|
197
|
+
|
|
198
|
+
// ---- A new theme from the Brand Kit -----------------------------------------------
|
|
199
|
+
|
|
200
|
+
const HEX6 = /^#[0-9a-f]{6}$/i;
|
|
201
|
+
const rgbOf = (hex) => [1, 3, 5].map(i => parseInt(hex.slice(i, i + 2), 16));
|
|
202
|
+
const hexOf = (rgb) => `#${rgb.map(v => Math.max(0, Math.min(255, Math.round(v))).toString(16).padStart(2, '0')).join('')}`;
|
|
203
|
+
/** A colour moved toward black (amount < 0) or white (amount > 0), 0..1. */
|
|
204
|
+
export function shade(hex, amount) {
|
|
205
|
+
const t = amount < 0 ? 0 : 255;
|
|
206
|
+
const a = Math.abs(amount);
|
|
207
|
+
return hexOf(rgbOf(hex).map(v => v + (t - v) * a));
|
|
208
|
+
}
|
|
209
|
+
/** Black or white, whichever reads on a colour. */
|
|
210
|
+
export function inkFor(hex) {
|
|
211
|
+
const [r, g, b] = rgbOf(hex).map(v => v / 255).map(c => (c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4));
|
|
212
|
+
return 0.2126 * r + 0.7152 * g + 0.0722 * b > 0.4 ? '#111111' : '#ffffff';
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* The token changes a new theme starts from, made from the site's Brand Kit (core
|
|
217
|
+
* `GET /api/brand-kit`): the accent as the primary colour (with its hover, active, dark and light
|
|
218
|
+
* shades, readable text on it, and links), the Kit's named colours as `--dm-accent-1..4`, and its
|
|
219
|
+
* body font as the sans font. Only used when someone asks for it - the Kit never changes a theme.
|
|
220
|
+
*
|
|
221
|
+
* @param {object} kit - the public Brand Kit
|
|
222
|
+
* @returns {Object<string,string>|null} null when the Kit has no accent colour
|
|
223
|
+
*/
|
|
224
|
+
export function themeFromKit(kit) {
|
|
225
|
+
const accent = String(kit?.accent ?? '').trim().toLowerCase();
|
|
226
|
+
if (!HEX6.test(accent)) return null;
|
|
227
|
+
const ink = inkFor(accent);
|
|
228
|
+
const changes = {
|
|
229
|
+
'--dm-primary': accent,
|
|
230
|
+
'--dm-primary-hover': shade(accent, -0.12),
|
|
231
|
+
'--dm-primary-active': shade(accent, -0.2),
|
|
232
|
+
'--dm-primary-dark': shade(accent, -0.3),
|
|
233
|
+
'--dm-primary-light': shade(accent, 0.85),
|
|
234
|
+
'--dm-primary-text': ink,
|
|
235
|
+
'--dm-primary-hover-text': ink,
|
|
236
|
+
'--dm-link': accent,
|
|
237
|
+
'--dm-link-hover': shade(accent, -0.2)
|
|
238
|
+
};
|
|
239
|
+
(Array.isArray(kit?.colours) ? kit.colours : [])
|
|
240
|
+
.filter(c => HEX6.test(String(c?.hex ?? ''))).slice(0, 4)
|
|
241
|
+
.forEach((c, i) => { changes[`--dm-accent-${i + 1}`] = String(c.hex).toLowerCase(); });
|
|
242
|
+
const body = kit?.fonts?.body;
|
|
243
|
+
if (body?.id && typeof body.stack === 'string') changes['--dm-font-sans'] = body.stack;
|
|
244
|
+
return cleanChanges(changes).changes;
|
|
245
|
+
}
|
|
@@ -27,6 +27,8 @@
|
|
|
27
27
|
<div class="trx-actions">
|
|
28
28
|
<button type="button" class="btn btn-sm btn-ghost" data-on-click="newTheme" title="Start a new theme">
|
|
29
29
|
<span data-icon="plus" data-icon-size="14"></span> New</button>
|
|
30
|
+
<button type="button" class="btn btn-sm btn-ghost" data-on-click="newFromKit" title="Start a new theme in your Brand Kit's colours and font (Site Settings > Branding)">
|
|
31
|
+
<span data-icon="briefcase" data-icon-size="14"></span> From Brand Kit</button>
|
|
30
32
|
<button type="button" class="btn btn-sm btn-primary" data-on-click="save" data-bind-disabled="saving.value">
|
|
31
33
|
<span data-icon="save" data-icon-size="14"></span> <span data-bind-text="saveText.value">Save</span></button>
|
|
32
34
|
<button type="button" class="btn btn-sm btn-outline" data-on-click="saveAs" data-bind-hidden="!editingId.value" title="Save these settings as a new theme">
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* by setting the base, building a fresh roller, then putting the changes in
|
|
24
24
|
* place and re-rendering its inputs from them (loadInto below).
|
|
25
25
|
*/
|
|
26
|
-
import {themeCss, USAGE_LABEL} from '../lib/themes.js';
|
|
26
|
+
import {themeCss, themeFromKit, USAGE_LABEL} from '../lib/themes.js';
|
|
27
27
|
import {OLD_DRAFT_KEY, RESTORE_ANSWERS, changesKey, draftKeyFor, filterThemes, listCounts, restoreQuestion, staleNote, stillDirty} from '../lib/view.js';
|
|
28
28
|
import {promptWith} from '../lib/prompt.js';
|
|
29
29
|
import {fmtDate} from '../../../_lib/admin/ui/dates.js';
|
|
@@ -290,6 +290,29 @@ export const themeRollerView = {
|
|
|
290
290
|
loadInto(currentBase() || 'charcoal-dark');
|
|
291
291
|
}
|
|
292
292
|
|
|
293
|
+
/**
|
|
294
|
+
* A new, unsaved theme in the Brand Kit's colours and body font, on the current base. Nothing
|
|
295
|
+
* changes until it is saved and used: the Kit never changes a theme by itself.
|
|
296
|
+
*/
|
|
297
|
+
async function newFromKit() {
|
|
298
|
+
let kit;
|
|
299
|
+
try { kit = await apiRequest('/brand-kit'); } catch { kit = null; }
|
|
300
|
+
if (!here()) return;
|
|
301
|
+
const changes = kit ? themeFromKit(kit) : null;
|
|
302
|
+
if (!changes) {
|
|
303
|
+
E.toast(kit ? 'Your Brand Kit has no accent colour yet. Set one in Site Settings > Branding first.'
|
|
304
|
+
: 'This site has no Brand Kit (Domma CMS 1.81.0 or later, Site Settings > Branding).', {type: 'warning'});
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
if (!await discardOk()) return;
|
|
308
|
+
editingId.value = '';
|
|
309
|
+
editingLabel.value = kit.name ? `${kit.name} brand` : 'Brand Kit';
|
|
310
|
+
editingWas = '';
|
|
311
|
+
loadInto(currentBase() || 'charcoal-dark', changes);
|
|
312
|
+
tabs.activate(0);
|
|
313
|
+
E.toast('A new theme in your Brand Kit\'s colours. Change anything, then Save - nothing is used until you choose it.', {type: 'info'});
|
|
314
|
+
}
|
|
315
|
+
|
|
293
316
|
// ---- Server ----
|
|
294
317
|
async function load() {
|
|
295
318
|
try {
|
|
@@ -535,7 +558,7 @@ export const themeRollerView = {
|
|
|
535
558
|
// ---- Bindings ----
|
|
536
559
|
root.querySelector('.trx-list').innerHTML = ROW;
|
|
537
560
|
const tabs = E.tabs(root.querySelector('.trx-tabs'), {tabSelector: '.tab-item', panelSelector: '.tab-panel'});
|
|
538
|
-
const bindings = M.applyBindings(data, root, {methods: {newTheme, save, saveAs, saveCss,
|
|
561
|
+
const bindings = M.applyBindings(data, root, {methods: {newTheme, newFromKit, save, saveAs, saveCss,
|
|
539
562
|
s_all: () => { show.value = 'all'; }, s_used: () => { show.value = 'used'; }, s_unused: () => { show.value = 'unused'; }}});
|
|
540
563
|
scope(() => bindings.dispose());
|
|
541
564
|
scope(helpPopovers(root, {position: 'bottom'}));
|
|
@@ -32,6 +32,7 @@ The theme editor. The bar above it shows the name of the theme you are editing (
|
|
|
32
32
|
|
|
33
33
|
- Pick the base theme and change any setting in the roller. The preview covers the whole admin while you are on this screen. When you leave, the admin goes back to its own theme.
|
|
34
34
|
- **New** - start a new theme.
|
|
35
|
+
- **From Brand Kit** - start a new theme in your Brand Kit's colours and font (Site Settings > Branding): its accent becomes the main colour (buttons, links and their hover shades, with black or white text that reads on it), its named colours become the accent colours, and its body font becomes the main font. It starts on the theme you are looking at. Nothing is saved or used until you **Save** it and choose it in Content > Theme - the Brand Kit never changes a theme by itself. Needs an accent colour in the Kit.
|
|
35
36
|
- **Save** - save the theme. A new theme asks for a name first. Saving a theme that is in use updates the site straight away.
|
|
36
37
|
- **Save as...** - save your settings as a new theme, leaving the original as it was. Shown when you are editing a saved theme.
|
|
37
38
|
- The menu button next to it has the same actions as a theme in **Saved themes**.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "theme-roller",
|
|
3
3
|
"displayName": "Theme Roller",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.4.0",
|
|
5
5
|
"tier": "free",
|
|
6
6
|
"description": "Make your own themes: start from any built-in theme, change its colours, fonts, spacing and borders with a live preview, and save it. Saved themes join the built-in ones everywhere a theme is chosen - the site, the admin, day and night, a region of a page. Needs Domma CMS 0.73 or later to use them.",
|
|
7
7
|
"author": "Darryl Waterhouse",
|
|
@@ -75,3 +75,23 @@ test('the sidebar badge counts saved themes; the popover says what is worn and w
|
|
|
75
75
|
assert.deepEqual(auto.details.rows[0], {label: 'Site (day / night)', value: 'Sea / charcoal-dark'});
|
|
76
76
|
assert.equal(badgeFor([], {}).label, 'No custom themes yet');
|
|
77
77
|
});
|
|
78
|
+
|
|
79
|
+
test('themeFromKit: the Kit\'s accent as primary (shades, readable text, links), its colours as accents, its body font', async () => {
|
|
80
|
+
const {themeFromKit, shade, inkFor} = await import('../admin/lib/themes.js');
|
|
81
|
+
assert.equal(themeFromKit({}), null, 'no accent: nothing to start from');
|
|
82
|
+
assert.equal(themeFromKit({accent: 'teal'}), null);
|
|
83
|
+
const t = themeFromKit({accent: '#0F766E', colours: [{name: 'Sand', hex: '#eeddcc'}, {name: 'bad', hex: 'red'}, {hex: '#111111'}],
|
|
84
|
+
fonts: {body: {id: 'open-sans', stack: '"Open Sans", Arial, sans-serif'}, heading: {id: '', stack: 'Arial'}}});
|
|
85
|
+
assert.equal(t['--dm-primary'], '#0f766e');
|
|
86
|
+
assert.equal(t['--dm-primary-text'], '#ffffff');
|
|
87
|
+
assert.equal(t['--dm-primary-hover'], shade('#0f766e', -0.12));
|
|
88
|
+
assert.equal(t['--dm-link'], '#0f766e');
|
|
89
|
+
assert.equal(t['--dm-accent-1'], '#eeddcc');
|
|
90
|
+
assert.equal(t['--dm-accent-2'], '#111111', 'bad colours skipped');
|
|
91
|
+
assert.equal(t['--dm-font-sans'], '"Open Sans", Arial, sans-serif');
|
|
92
|
+
assert.equal(themeFromKit({accent: '#fde047'})['--dm-primary-text'], '#111111');
|
|
93
|
+
assert.equal(themeFromKit({accent: '#fde047', fonts: {body: {id: '', stack: 'Arial'}}})['--dm-font-sans'], undefined, 'Site default font: the theme keeps its own');
|
|
94
|
+
// Nothing unsafe gets through the core's value rule.
|
|
95
|
+
assert.equal(themeFromKit({accent: '#000000', fonts: {body: {id: 'x', stack: 'a;}</style><script>'}}})['--dm-font-sans'], undefined);
|
|
96
|
+
assert.equal(inkFor('#ffffff'), '#111111');
|
|
97
|
+
});
|
package/public/js/site.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{applyMobileMenu as ae,initCarouselPopup as ie}from"/public/js/mobile-ui.mjs?v=20261016-mobile-options";import{installSmoothCarets as re}from"/public/js/smooth-caret.js";import{decodeBase64Json as V}from"/public/js/utf8-base64.mjs";import{makeBadgeEl as U,applyColour as G,applyPill as ce,applyFloat as le,applyHighlight as Y,applyItemHighlight as de,itemHighlightAttrs as me,currentItems as K,menuAlign as ue,applyClasses as P,cssClasses as X,applyEntrance as J}from"/public/js/menu-decor.mjs?v=20261109-current-query";import{applyMenuLook as pe,applyFooterLook as fe}from"/public/js/menu-cards.mjs?v=20261115-rich-captions";import{initPageMotion as he}from"/public/js/page-motion.mjs?v=20261029-page-motion";import{applyFooterShowcase as ge}from"/public/js/footer-showcase.mjs?v=20261029-footer-showcase";import{initFloatingMenus as ye}from"/public/js/menu-float.js?v=20260927-float";import{enhancePickerFields as Q,markInvalidFields as Z,showValidationPopup as ee}from"/public/js/forms.js?v=20261109-form-embed";import{buildWizardSteps as ve}from"/public/js/form-steps.mjs";import{mountMotionControl as be}from"/public/js/motion-control.mjs?v=20261031-launchers";import{applyFormClasses as te,applyFormEntrance as oe,applySubmitButtons as we,applyWizardButtons as Ce}from"/public/js/form-submit.mjs";import{captureFileFields as ne,destroyDropzones as Se,fileBlueprint as xe,restoreFileFields as ke,setFileLimits as Le,splitFiles as $e,submitBody as Ee,totalTooLarge as Ae,wireFileFields as Te}from"/public/js/form-files.mjs";document.addEventListener("click",m=>{const r=m.target?.closest?.(".dm-banner__dismiss");r&&(m.preventDefault(),r.closest(".dm-banner")?.remove())}),$(()=>{re(document);const m=window.__CMS_NAV__||{},r=window.__CMS_SITE__||{},q=r.brandingEnabled!==!1&&m.brand?.enabled!==!1;if(r.autoTheme?.enabled){let t=function(d){const p=(d||"07:00").split(":");return+p[0]*60+(+p[1]||0)},e=function(){const d=new Date,p=d.getHours()*60+d.getMinutes();return p>=t(a.dayStart)&&p<t(a.nightStart)?a.dayTheme:a.nightTheme},n=function(d){if(window.CMSThemeSwitcher?.hasPreference())return;const p=a.apply&&a.apply[d]||{theme:d,custom:""};Domma.theme.set(p.theme);for(const o of[...document.body.classList])o.startsWith("dm-custom-")&&document.body.classList.remove(o);p.custom&&document.body.classList.add(p.custom)};const a=r.autoTheme;n(e()),setInterval(()=>n(e()),6e4)}const C=$("#site-navbar");if(C.length&&m.brand){let e=function(l,v=0){return Array.isArray(l)?l.filter(u=>!(u&&(u.type==="spacer"||u.type==="theme-switcher"))).filter(u=>!(u&&u.type==="separator"&&v===0)).map(u=>u&&u.type==="separator"?{divider:!0}:Array.isArray(u?.items)?{...u,items:e(u.items,v+1)}:u):l};const a={...m.brand},t=a.size&&a.size!=="md"?` navbar-brand-${a.size}`:"";if(a.logo||a.icon||a.tagline){let l="";a.logo?l+=`<img src="${a.logo}" class="navbar-brand-logo" alt="${a.text||""}">`:a.icon&&(l+=`<span data-icon="${a.icon}" style="width:1.1em;height:1.1em;margin-right:.35em;vertical-align:middle;"></span>`),a.text&&(l+=`<span class="navbar-brand-text${t}">${a.text}</span>`),a.tagline&&(l+=`<small class="navbar-brand-tagline">${a.tagline}</small>`),a.html=l}else t&&a.text&&(a.html=`<span class="navbar-brand-text${t}">${a.text}</span>`);const n=e(m.items||[]),d=m.position==="floating",p=m.orientation==="vertical";C.get(0).querySelector(":scope > .cms-nojs-links")?.remove(),Domma.elements.navbar("#site-navbar",{brand:q?a:null,items:n,variant:m.variant||"dark",position:d?"static":m.position||"sticky",collapsible:!0,appearOnHover:!!m.appearOnHover}),Domma.icons.scan("#site-navbar");const o=C.get(0);ae(o,m.mobile);const h=()=>{if(!p)return;const v=o.querySelector('a[aria-current="page"]')?.closest(".navbar-dropdown");v&&!v.classList.contains("open")&&v.querySelector(":scope > .navbar-dropdown-toggle")?.click()};o.classList.add(`dm-nav-align-${ue(m)||"centre"}`),p&&C.get(0).classList.add("dm-nav-vertical",m.side==="right"?"dm-nav-vertical-right":"dm-nav-vertical-left");const f=m.dock||{};p&&!d&&Me(o,m.side==="right"),!p&&f.hideOnScroll&&qe(o),Y(o,m),J(o,m),P(o,m.class),d&&(le(C.get(0),m),ye(C.get(0).parentNode||document));const c=o.querySelector(".navbar-toggle"),y=o.querySelector(".navbar-collapse");if(c&&y){let l=null;const v=()=>{y.classList.contains("show")&&c.click()},u=()=>{l&&(l.remove(),l=null),document.body.classList.remove("dm-drawer-open")},g=()=>{l||(l=document.createElement("div"),l.className="dm-navbar-backdrop",l.addEventListener("click",v),document.body.appendChild(l),document.body.classList.add("dm-drawer-open"))};c.addEventListener("click",()=>{requestAnimationFrame(()=>{y.classList.contains("show")?(h(),g()):u()})}),y.addEventListener("click",w=>{w.target.closest("a")&&requestAnimationFrame(u)}),document.addEventListener("keydown",w=>{w.key==="Escape"&&y.classList.contains("show")&&v()})}const L=o.querySelector(".navbar-nav");if(L){const l=Array.from(L.children);let v=0;for(const u of m.items||[])if(!(u&&u.type==="separator")){if(u&&u.type==="spacer"){const g=document.createElement("li"),w=["xs","sm","md","lg","xl","flex"].includes(u.size)?u.size:"md";g.className=`dm-menu-spacer dm-menu-spacer--${w}`,g.setAttribute("aria-hidden","true"),L.insertBefore(g,l[v]||null);continue}if(u&&u.type==="theme-switcher"){const g=document.createElement("li");g.className="dm-menu-theme-switcher";const w=document.createElement("span");w.dataset.themeSwitcher="menu",w.dataset.position="inline",g.appendChild(w),L.insertBefore(g,l[v]||null);continue}v++}window.CMSThemeSwitcher?.scan(L)}const x=K(n,location.pathname+location.search);o.querySelectorAll("[data-path]").forEach(l=>{const v=l.dataset.path.split(".").map(Number),u=v.length>1,g=v.reduce((z,B)=>z?.items?.[B],{items:n});if(!g)return;g.colour&&G(l,g.colour),g.pill&&!u&&ce(l,g.pill),de(l,g),P(l.closest("li"),g.class);const w=U(g.badge);w&&l.appendChild(w),x.has(g)&&(l.classList.add("active"),l.setAttribute("aria-current","page"))}),pe(o,m,n),h()}let I=null;const b=$("#site-footer");if(b.length){let d=function(i){return String(i??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")},p=function(i){return d(i).replace(/'/g,"'")},o=function(i){if(i&&i.type==="separator")return'<li class="footer-sep"><hr></li>';if(i&&i.type==="spacer")return`<li class="dm-menu-spacer dm-menu-spacer--${["xs","sm","md","lg","xl","flex"].includes(i.size)?i.size:"md"}" aria-hidden="true"></li>`;if(i&&i.type==="theme-switcher")return'<li class="dm-menu-theme-switcher"><span data-theme-switcher="menu" data-position="inline"></span></li>';const A=p(i.url||"#"),M=d(i.text||""),D=Array.isArray(i.items)&&i.items.length?`<ul>${i.items.map(o).join("")}</ul>`:"",N=me(i),W=[N.hover&&` data-menu-item-hover="${p(N.hover)}"`,N.active&&` data-menu-item-active="${p(N.active)}"`].filter(Boolean).join(""),j=N.accent?` style="--dm-menu-highlight:${p(N.accent)}"`:"",O=X(i.class).join(" ");return`<li${O?` class="${p(O)}"`:""}><a href="${A}"${W}${j}>${M}</a>${D}</li>`},f=function(){if(!r.footer)return"";const i=Object.keys(t).filter(M=>a[M]);if(!i.length)return"";const A=X(r.footer.socialClass).join(" ");return`<div class="footer-social">${i.map(M=>{const{label:D,svg:N}=t[M];return`<a href="${a[M]}" target="_blank" rel="noopener noreferrer" aria-label="${D}" class="footer-social-link${A?` ${p(A)}`:""}">${N}</a>`}).join("")}</div>`},x=function(i){if(!i||i.type==="separator"||i.type==="spacer")return"";if(i.type==="theme-switcher")return`<li class="cms-footer-col">${o(i).replace(/^<li[^>]*>|<\/li>$/g,"")}</li>`;const A=Array.isArray(i.items)&&i.items.length?`<ul>${i.items.map(o).join("")}</ul>`:"",M=L(i)?`<span class="cms-footer-col-title">${d(i.text||"")}</span>`:`<a class="cms-footer-col-title" href="${p(i.url||"#")}">${d(i.text||"")}</a>`,D=["cms-footer-col",...X(i.class)].join(" ");return`<li class="${p(D)}">${M}${A}</li>`},u=function(i,A,M=!1){return(i||[]).forEach(D=>{D&&(D.type==="separator"||D.type==="spacer"||D.type==="theme-switcher")||(M&&L(D)||A.push(D),Array.isArray(D.items)&&D.items.length&&u(D.items,A))}),A};const a=r.social||{},t={twitter:{label:"X / Twitter",svg:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-4.714-6.231-5.401 6.231H2.742l7.73-8.835L1.254 2.25H8.08l4.259 5.629L18.244 2.25zm-1.161 17.52h1.833L7.084 4.126H5.117z"/></svg>'},facebook:{label:"Facebook",svg:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z"/></svg>'},instagram:{label:"Instagram",svg:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.07-1.644-.07-4.849 0-3.204.013-3.583.07-4.849.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zM12 0C8.741 0 8.333.014 7.053.072 2.695.272.273 2.69.073 7.052.014 8.333 0 8.741 0 12c0 3.259.014 3.668.072 4.948.2 4.358 2.618 6.78 6.98 6.98C8.333 23.986 8.741 24 12 24c3.259 0 3.668-.014 4.948-.072 4.354-.2 6.782-2.618 6.979-6.98.059-1.28.073-1.689.073-4.948 0-3.259-.014-3.667-.072-4.947-.196-4.354-2.617-6.78-6.979-6.98C15.668.014 15.259 0 12 0zm0 5.838a6.162 6.162 0 100 12.324 6.162 6.162 0 000-12.324zM12 16a4 4 0 110-8 4 4 0 010 8zm6.406-11.845a1.44 1.44 0 100 2.881 1.44 1.44 0 000-2.881z"/></svg>'},linkedin:{label:"LinkedIn",svg:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.062 2.062 0 01-2.063-2.065 2.064 2.064 0 112.063 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"/></svg>'},github:{label:"GitHub",svg:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/></svg>'},youtube:{label:"YouTube",svg:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M23.495 6.205a3.007 3.007 0 00-2.088-2.088c-1.87-.501-9.396-.501-9.396-.501s-7.507-.01-9.396.501A3.007 3.007 0 00.527 6.205a31.247 31.247 0 00-.522 5.805 31.247 31.247 0 00.522 5.783 3.007 3.007 0 002.088 2.088c1.868.502 9.396.502 9.396.502s7.506 0 9.396-.502a3.007 3.007 0 002.088-2.088 31.247 31.247 0 00.5-5.783 31.247 31.247 0 00-.5-5.805zM9.609 15.601V8.408l6.264 3.602z"/></svg>'}};let e='<div class="footer-inner container">';const n=window.__CMS_FOOTER__||{primary:[],legal:[],copyright:""},h=(()=>{const i=r.cookieConsent;if(!i||i.showSettingsLink===!1)return"";const A=M=>(M||[]).some(D=>D&&(D.url==="#cookie-settings"||A(D.items)));return A(n.primary)||A(n.legal)?"":`<li class="cms-cookie-settings"><a href="#cookie-settings">${d(i.settingsLinkText||"Cookie settings")}</a></li>`})(),c=["columns","row"].includes(r.footer?.layout)?r.footer.layout:"auto",y=r.footer?.look==="showcase"||c==="columns"||c==="auto"&&n.primary.some(i=>Array.isArray(i?.items)&&i.items.length),L=i=>y&&!i.url&&Array.isArray(i.items)&&i.items.length>0;if(y){const i=m.brand||{},A=q&&(i.text||r.title)||"",M=q?i.logo?`<img src="${p(i.logo)}" class="cms-footer-brand-logo" alt="">`:i.icon?'<span class="cms-footer-brand-icon"></span>':"":"",D=String(r.footer?.blurb||"").trim();e='<div class="footer-inner footer-inner--columns container"><div class="cms-footer-top">',e+=`<div class="cms-footer-brand">${A||M?`<a class="cms-footer-brand-name" href="${p(i.url||"/")}">${M}<span>${d(A)}</span></a>`:""}${D?`<p class="cms-footer-blurb">${d(D)}</p>`:""}${f()}</div>`,n.primary.length&&(e+=`<nav class="footer-nav footer-nav--primary footer-nav--columns" aria-label="Footer"><ul>${n.primary.map(x).join("")}</ul></nav>`),e+='</div><div class="cms-footer-bottom">',n.copyright&&(e+=`<p class="cms-footer-copyright">${d(n.copyright)}</p>`),(n.legal.length||h)&&(e+=`<nav class="footer-nav footer-nav--legal" aria-label="Legal"><ul>${n.legal.map(o).join("")}${h}</ul></nav>`),e+="</div>"}else n.copyright&&(e+=`<p>${d(n.copyright)}</p>`),n.primary.length&&(e+=`<nav class="footer-nav footer-nav--primary"><ul>${n.primary.map(o).join("")}</ul></nav>`),(n.legal.length||h)&&(e+=`<nav class="footer-nav footer-nav--legal"><ul>${n.legal.map(o).join("")}${h}</ul></nav>`),e+=f();e+="</div>",b.get(0).querySelector(":scope > .cms-nojs-links")?.remove();const l=b.get(0).querySelector(":scope > .cms-footer-blocks");l?.remove(),b.html(e),l&&b.get(0).prepend(l),window.CMSThemeSwitcher?.scan(b.get(0));const v=b.get(0).querySelector(".cms-footer-brand-icon");v&&m.brand?.icon&&v.setAttribute("data-icon",m.brand.icon),P(b.get(0),r.footer?.class),y&&ge(b.get(0),r);const g=[...u(n.primary,[],!0),...u(n.legal,[])],w=K([...n.primary||[],...n.legal||[]],location.pathname+location.search),z=b.get(0).querySelectorAll(".footer-nav a"),B=[];z.forEach((i,A)=>{const M=g[A];if(!M)return;if(B.push({a:i,item:M}),M.icon){const N=document.createElement("span");N.className="cms-footer-ic",N.setAttribute("data-icon",String(M.icon)),N.setAttribute("data-icon-size","15"),N.setAttribute("aria-hidden","true"),i.prepend(N)}M.colour&&G(i,M.colour);const D=U(M.badge);D&&i.appendChild(D),w.has(M)&&(i.classList.add("is-active"),i.setAttribute("aria-current","page"))}),Y(b.get(0).querySelector(".footer-nav--primary"),{highlight:n.primaryHighlight}),Y(b.get(0).querySelector(".footer-nav--legal"),{highlight:n.legalHighlight}),J(b.get(0).querySelector(".footer-nav--primary"),{entrance:n.primaryEntrance}),J(b.get(0).querySelector(".footer-nav--legal"),{entrance:n.legalEntrance}),P(b.get(0).querySelector(".footer-nav--primary"),n.primaryClass),P(b.get(0).querySelector(".footer-nav--legal"),n.legalClass),fe(b.get(0),n,B),I=b.get(0).querySelector(".cms-footer-bottom")||b.get(0).querySelector(".footer-inner")}be(r.motion||{enabled:r.footer?.showMotionToggle!==!1,default:r.footer?.motionDefault,placement:"footer",control:r.footer?.motionControl,label:"Reduce motion"},{footer:I,navbar:document.querySelector("#site-navbar .navbar-container")?.closest("#site-navbar")||null});const k=document.getElementById("site-sidebar");k&&De(k),Domma.icons.scan(),Domma.syntax?.scan&&Domma.syntax.scan();const s=$(".page-body");if(s.length){s.find(".accordion").each(function(){Domma.elements.accordion(this,{allowMultiple:this.dataset.multi==="true"})}),s.find(".tabs").each(function(){Domma.elements.tabs(this)}),s.find(".carousel").each(function(){const t={primary:"--dm-primary",secondary:"--dm-secondary",accent:"--dm-primary",text:"--dm-text",surface:"--dm-surface",background:"--dm-background",success:"--dm-success",warning:"--dm-warning",danger:"--dm-danger",info:"--dm-info"},e=f=>{const c=String(f||"").trim();return c?t[c.toLowerCase()]?`var(${t[c.toLowerCase()]})`:CSS.supports("color",c)?c:"":""},n=e(this.dataset.background),d=e(this.dataset.arrowBackground),p=e(this.dataset.arrowColor);n&&(this.style.setProperty("--dm-carousel-background",n),this.classList.add("dm-carousel-custom-background")),d&&this.style.setProperty("--dm-carousel-arrow-background",d),p&&this.style.setProperty("--dm-carousel-arrow-color",p);const o=["top","middle","bottom"].includes(this.dataset.arrowPosition)?this.dataset.arrowPosition:"middle";this.classList.add(`dm-carousel-arrows-${o}`);const h={autoplay:this.dataset.autoplay==="true",interval:parseInt(this.dataset.interval,10)||5e3,loop:this.dataset.loop!=="false",animation:this.dataset.animation||"slide",heightMode:this.dataset.heightMode==="average"?"average":"crop"};if(this.dataset.height){const f=Number(this.dataset.height);Number.isFinite(f)&&f>0&&(h.height=f)}if(this.dataset.animationDuration){const f=parseInt(this.dataset.animationDuration,10);Number.isFinite(f)&&(h.animationDuration=f)}this.dataset.animationEasing&&(h.animationEasing=this.dataset.animationEasing),this.dataset.ctx&&(this._dmCtxSlides=Array.from(this.querySelectorAll(".carousel-slide")).map(f=>f.cloneNode(!0)),this._dmCarouselOpts=h),this._dmCarousel=Domma.elements.carousel(this,h),ie(this)}),s.find(".dm-countdown").each(function(){const t={autoStart:!0},e=String(this.dataset.format||"").trim(),n=String(this.dataset.to||"").trim(),d=/^(\d{4})-(\d{2})-(\d{2})$/.exec(n),p=d?new Date(+d[1],+d[2]-1,+d[3]).getTime():n?new Date(n).getTime():NaN;Number.isFinite(p)?t.duration=Math.max(0,p-Date.now()):this.dataset.duration&&(t.duration=(parseInt(this.dataset.duration,10)||0)*1e3);const o=/^dd:/i.test(e);t.format=o?"hh:mm:ss":e||(t.duration>=36e5?"hh:mm:ss":"mm:ss");const h=this,f=y=>String(y).padStart(2,"0"),c=y=>{const L=Math.max(0,Math.floor(y/1e3)),x=h.querySelector(".dm-timer-time");x&&(x.textContent=`${f(Math.floor(L/86400))}:${f(Math.floor(L%86400/3600))}:${f(Math.floor(L%3600/60))}:${f(L%60)}`)};o&&(t.onTick=c),Domma.elements.timer(this,t),o&&c(t.duration||0)}),s.find("[data-tooltip]:not(.dm-range-slider)").each(function(){Domma.elements.tooltip(this,{content:$(this).data("tooltip"),position:$(this).data("tooltip-position")||"top"})}),s.find(".dm-progression").each(function(){const t=Array.from(this.querySelectorAll(".dm-progression-item")).map(d=>{const p={title:d.querySelector(".dm-progression-item-title")?.textContent?.trim()||"",description:d.querySelector(".dm-progression-item-body")?.innerHTML?.trim()||""};return d.dataset.date&&(p.date=d.dataset.date),d.dataset.status&&(p.status=d.dataset.status),d.dataset.eventIcon&&(p.icon=d.dataset.eventIcon),d.dataset.entryId&&(p._entryId=d.dataset.entryId),p}),e=this.dataset.layout==="centred"?"centered":this.dataset.layout||"vertical",n=Domma.elements.progression(this,{layout:e,theme:this.dataset.theme||"minimal",mode:this.dataset.mode||"timeline",statusIcons:!0,allowHtml:!0,...t.length?{items:t}:{}});if((this.dataset.mode||"timeline")==="timeline"){const d={completed:{label:"Completed",icon:"check-circle",tone:"success"},planned:{label:"Planned",icon:"circle",tone:"secondary"},"in-progress":{label:"In progress",icon:"clock",tone:"primary"},blocked:{label:"Blocked",icon:"alert-circle",tone:"danger"}};this.querySelectorAll(".dm-progression-item").forEach((p,o)=>{const h=t[o];if(!h)return;const f=p.querySelector(".dm-progression-title");if(h.icon&&f){const y=document.createElement("span");y.dataset.icon=h.icon,y.style.cssText="display:inline-flex;vertical-align:middle;margin-right:.4em",y.setAttribute("aria-hidden","true"),f.prepend(y)}const c=d[h.status];if(c&&f){const y=document.createElement("span");y.className=`badge badge-${c.tone} cms-timeline-status`,y.style.cssText="display:inline-flex;align-items:center;gap:.35em;margin:.4rem 0";const L=document.createElement("span");L.dataset.icon=c.icon,L.dataset.iconSize="14",L.setAttribute("aria-hidden","true"),y.append(L,document.createTextNode(c.label)),f.after(y)}})}Domma.icons.scan(this),t.length&&(this._dmCtx={instance:n,items:t})});try{Domma.effects.reveal(".page-body .hero",{animation:"slide-up",duration:480,threshold:.06,stagger:60,once:!1})}catch{}const a=matchMedia("(prefers-reduced-motion: reduce)").matches||document.documentElement.classList.contains("dm-reduced-motion");document.querySelectorAll(".page-body .row[data-reveal]").forEach(t=>{const e=t.dataset.revealMode||"stagger",n=t.dataset.revealAnimation||"slide-up",d=parseInt(t.dataset.revealDuration,10)||(n.startsWith("swoosh")?700:400),p=parseInt(t.dataset.revealStagger,10)||(n.startsWith("swoosh")?90:60),o=parseInt(t.dataset.revealDelay,10)||0,h=t.dataset.revealDirection==="rtl",f=t.dataset.revealReplay==="true",c=Array.from(t.children);if(a&&n.startsWith("swoosh"))return;const y={"slide-up":"translateY(30px)","slide-down":"translateY(-30px)","slide-left":"translateX(30px)","slide-right":"translateX(-30px)",zoom:"scale(0.85)",flip:"perspective(600px) rotateX(15deg)",swoosh:"translateY(36px) scale(0.96)"},L=u=>n!=="swoosh-sides"?y[n]||"":c.length>1&&u===0?"translateX(-64px) rotate(-1.5deg)":c.length>1&&u===c.length-1?"translateX(64px) rotate(1.5deg)":"translateY(40px) scale(0.94)",x=n.startsWith("swoosh"),l=x?"cubic-bezier(.2,.8,.2,1)":"ease",v=(u,g)=>{u.style.opacity="0",u.style.transform=L(g),x&&(u.style.filter="blur(10px)")};c.forEach((u,g)=>{u.style.transition="none",v(u,g)}),t.offsetWidth,c.forEach((u,g)=>{u.style.transition=`opacity ${d}ms ${l}, transform ${d}ms ${l}`+(x?`, filter ${d}ms ${l}`:"");const w=h?c.length-1-g:g;u.style.transitionDelay=e==="stagger"?`${o+w*p}ms`:`${o}ms`}),requestAnimationFrame(()=>requestAnimationFrame(()=>{const u=new IntersectionObserver(g=>{g.forEach(w=>{if(w.isIntersecting){if(w.target.offsetWidth,w.target.style.opacity="1",w.target.style.transform="",x&&(w.target.style.filter=""),!f){u.unobserve(w.target);const z=w.target;z.addEventListener("transitionend",function B(i){i.target!==z||i.propertyName!=="opacity"||(z.removeEventListener("transitionend",B),z.style.transition="",z.style.transitionDelay="")})}}else f&&w.boundingClientRect.top>0&&v(w.target,c.indexOf(w.target))})},{threshold:.1,rootMargin:"100000px 0px 0px 0px"});c.forEach(g=>u.observe(g))}))}),he(document.querySelector(".page-body")||document),s.find(".card[data-collapsible]").each(function(){const t=this.querySelector(":scope > .card-header");t&&t.addEventListener("click",()=>this.classList.toggle("is-collapsed"))}),s.find(".dm-so-trigger").each(function(){this.addEventListener("click",()=>{const t=this.dataset.soTarget,e=document.getElementById(t);if(!e)return;const n=E.slideover({title:e.dataset.soTitle||"",size:e.dataset.soSize||"md",position:e.dataset.soPosition||"right"});e.style.display="",n.setContent(e),n.open()})})}if(typeof $.setup=="function"){const a=Object.assign({},window.__CMS_DCONFIG__||{});if(document.querySelectorAll(".dm-page-config[data-config]").forEach(t=>{try{const e=V(t.dataset.config);Object.assign(a,e)}catch{}}),Object.keys(a).length>0){const t={};for(const[e,n]of Object.entries(a)){const d=n?.events?.click,{confirm:p,toast:o,alert:h,prompt:f,...c}=d||{};if(p||o||h||f){$(e).on("click",async function(W){if(W.preventDefault(),p&&!await E.confirm(p))return;let j=null;if(!(f&&(j=await E.prompt(f,{inputPlaceholder:c.promptPlaceholder||"",inputValue:c.promptDefault||""}),j===null))){{const O=$(c.target||this);c.toggleClass&&O.toggleClass(c.toggleClass),c.addClass&&O.addClass(c.addClass),c.removeClass&&O.removeClass(c.removeClass),j!==null&&(c.setText&&O.text(j),c.setVal&&O.val(j),c.setAttr&&O.attr(c.setAttr,j))}c.href&&se(c.href),o&&E.toast(o,{type:c.toastType||"success"}),h&&E.alert(h)}});const{target:L,toggleClass:x,addClass:l,removeClass:v,setText:u,setVal:g,setAttr:w,href:z,toastType:B,promptPlaceholder:i,promptDefault:A,...M}=c,D={...n.events};Object.keys(M).length?D.click=L?{target:L,...M}:M:delete D.click;const N={...n,events:D};Object.keys(D).length||delete N.events,Object.keys(N).length&&(t[e]=N)}else t[e]=n}$.setup(t)}}s.length&&R(s.get(0))}),window.wireCTAButtons=R;function se(m){if(!_e(m)){console.warn("[site] refused to go to",String(m).slice(0,60));return}const r=document.body?.classList.contains("dm-launcher-embed")&&window.top!==window;(r?window.top:window).location.href=m}function _e(m){const r=String(m??"").replace(/[\u0000-\u0020\u007f-\u00a0\u200b-\u200f\ufeff]/g,"").toLowerCase();return!r||r.includes("\\")||r.startsWith("//")?!1:/^(\/|#|\?|\.\.?\/)/.test(r)||/^(https?:\/\/|mailto:|tel:)/.test(r)?!0:!/^[a-z][a-z0-9+.-]*:/.test(r)}function R(m){m.querySelectorAll(".dm-cta-trigger").forEach(r=>{r.__ctaWired||(r.__ctaWired=!0,r.addEventListener("click",async()=>{const q=r.dataset.action,C=r.dataset.entry,I=r.dataset.confirm;let b=S.get("auth_token");if(!b){E.toast("Please log in to perform this action.",{type:"warning"});return}if(I&&!await E.confirm(I))return;const k=Array.from(r.childNodes).map(a=>a.cloneNode(!0));r.disabled=!0,r.textContent="Running\u2026";const s=a=>fetch(`/api/actions/${encodeURIComponent(q)}/public`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify(r.dataset.scope?{entryId:C,scope:r.dataset.scope}:{entryId:C})});try{let a=await s(b);if(a.status===401){const e=S.get("auth_refresh_token");if(e){const n=await fetch("/api/auth/refresh",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:e})});if(n.ok){const{token:d}=await n.json();S.set("auth_token",d),b=d,a=await s(b)}}}const t=await a.json().catch(()=>({}));if(!a.ok||t.success===!1)throw new Error(t.error||t.message||`Error ${a.status}`);E.toast(t.message||"Action completed.",{type:"success"})}catch(a){E.toast(a.message||"Action failed.",{type:"error"})}finally{r.disabled=!1,r.textContent="",k.forEach(a=>r.appendChild(a)),Domma.icons.scan(r)}}))})}(function(){const r=document.querySelectorAll('.dm-collection-hydrate[data-collection-scope="mine"]');if(!r.length)return;const q=S.get("auth_token");function C(b,k){const s=document.createElement("div");s.className="dm-collection-display dm-collection-empty";const a=document.createElement("p");if(k){a.appendChild(document.createTextNode("Please "));const t=document.createElement("a");t.href="/login",t.textContent="sign in",a.appendChild(t),a.appendChild(document.createTextNode(" to view your entries."))}else a.textContent=b;return s.appendChild(a),s}function I(b,k){const s=document.createElement("template");s.innerHTML=k||"",b.replaceWith(s.content)}r.forEach(async b=>{const k=b.dataset.collectionAttrs;if(!k)return;if(!q){b.replaceChildren(C("",!0));return}const s=a=>fetch("/api/collections/render-scope",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify({attrs:k})});try{let a=q,t=await s(a);if(t.status===401){const n=S.get("auth_refresh_token");if(n){const d=await fetch("/api/auth/refresh",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:n})});if(d.ok){const{token:p}=await d.json();S.set("auth_token",p),a=p,t=await s(a)}}}if(!t.ok){const{error:n}=await t.json().catch(()=>({}));b.replaceChildren(C(n||"Unable to load entries.",!1));return}const{html:e}=await t.json();I(b,e),window.DommaCollectionBrowser?.hydrate&&window.DommaCollectionBrowser.hydrate(document)}catch{b.replaceChildren(C("Unable to load entries.",!1))}}),setTimeout(()=>{typeof Domma<"u"&&Domma.icons?.scan&&Domma.icons.scan(),typeof Domma<"u"&&Domma.syntax?.scan&&Domma.syntax.scan(),R(document.body)},100)})(),(function(){const r=document.querySelectorAll("[data-collection-table]");!r.length||typeof T>"u"||!T.create||r.forEach(q=>{let C;try{C=V(q.dataset.payload)}catch{return}const{rows:I,search:b,sortable:k,exportable:s,pageSize:a,empty:t,ctaConfig:e,slug:n,exportCfg:d}=C;if(!Array.isArray(C.columns)||!C.columns.length)return;const p=c=>String(c??"").replace(/</g,"\u2039").replace(/>/g,"\u203A"),o=C.columns.map(c=>c&&typeof c=="object"?{key:p(c.key),title:p(c.title||c.key)}:{key:p(c),title:p(c)});if(e){const c=o.findIndex(y=>y.key==="_cta");c!==-1&&(o[c]={key:"_cta",title:"",render:(y,L)=>{const x=document.createElement("button");if(x.className=`btn btn-${e.style||"primary"} dm-cta-trigger`,x.dataset.action=e.action||"",e.scope&&(x.dataset.scope=e.scope),x.dataset.entry=L._entryId||"",e.confirm&&(x.dataset.confirm=e.confirm),e.icon){const l=document.createElement("span");l.dataset.icon=e.icon,x.appendChild(l),x.appendChild(document.createTextNode(" "))}return x.appendChild(document.createTextNode(e.label||"Run")),x}})}const h="col-table-"+Math.random().toString(36).slice(2,7),f=document.createElement("div");f.id=h,q.replaceChildren(f),T.create("#"+h,{data:I,columns:o,search:b,sortable:k,exportable:s,pageSize:a,emptyMessage:t}),e&&R(f),q._dmTable={columns:o,rows:I,slug:n,exportCfg:d,render(c){T.create("#"+h,{data:c,columns:o,search:b,sortable:k,exportable:s,pageSize:a,emptyMessage:t}),e&&R(f)}}})})(),(function(){const r=document.querySelectorAll("[data-form-inline]");if(!r.length||typeof F>"u")return;function q(s){const a=s&&s.logic;return!!(a&&(a.visibility||a.requirement))}function C(s,a){const t={};return(s||[]).forEach(e=>{if(e.type==="page-break"||e.type==="spacer"||!e.name)return;const n=e.type==="chooser"||!!(e.variant&&["select","radio","checkbox-group"].includes(e.type)),d=e.type==="checkbox"?"boolean":e.type==="date"||e.type==="icon"||e.type==="image"?"string":n?"chooser":e.type,p={...e.formConfig||{}};p.span==="full"&&a&&(p.span=a);const o={type:d,required:q(e)?!1:e.required,label:e.label,options:e.options,formConfig:{...e.placeholder&&{placeholder:e.placeholder},...e.helper&&{hint:e.helper},...e.tooltip&&{tooltip:e.tooltip},...p}};e.minLength!==void 0&&(o.minLength=e.minLength),e.maxLength!==void 0&&(o.maxLength=e.maxLength),e.min!==void 0&&(o.min=e.min),e.max!==void 0&&(o.max=e.max),n&&(e.variant&&(o.variant=e.variant),(e.multiple||e.type==="checkbox-group")&&(o.multiple=!0),e.density&&(o.density=e.density),e.columns&&(o.columns=e.columns),e.accent&&(o.accent=e.accent),e.accentStyle&&(o.accentStyle=e.accentStyle),e.glow&&(o.glow=!0),e.glowColour&&(o.glowColour=e.glowColour),e.shadow&&(o.shadow=e.shadow),e.shadowColour&&(o.shadowColour=e.shadowColour)),t[e.name]=e.type==="file"?xe(e,o):o}),t}function I(s){const a={};return(s||[]).forEach(t=>{if(!(!t.name||t.type==="page-break"||t.type==="spacer")&&(t.type==="select"||t.type==="multiselect")&&t.required){const e=(t.options||[])[0];e&&(a[t.name]=typeof e=="object"?e.value:e)}}),a}function b(s,a){(a||[]).forEach(t=>{if(t.type!=="date"||!t.name)return;const e=s.querySelector(`[name="${t.name}"]`);e&&e.type!=="date"&&(e.type="date")})}function k(s,a,t){let e=s.querySelector(".cms-form-message");e||(e=document.createElement("p"),e.className="cms-form-message",s.appendChild(e)),e.textContent=a,e.style.cssText=t?"color:var(--dm-danger);margin-top:.75rem;":"color:var(--dm-success);margin-top:.75rem;"}r.forEach(s=>{let a;try{a=V(s.dataset.formInline)}catch{return}s.querySelector(":scope > .cms-form-embed-summary")?.remove();const t=a.fields||[],e=a.settings||{},n=Number(e.columns)===3?3:2,d=e.layout||"grid",p=t.some(x=>x.type==="page-break"),o=new Map;Le(s,a.fileLimits,o),Te(s,t);const h=async x=>{if(s.dataset.triggerBlocked==="true"){const l=s._formLogicRuntime,v=l&&l.submitBlock?l.submitBlock().reasons:[];k(s,v.join(" ")||"This form cannot be submitted yet.",!0);const u=new Error("Blocked by a form trigger");throw u.formSubmitFailed=!0,u}try{const l=s.querySelector(".fb-form-honeypot"),v=l?.querySelector('input[type="text"]')||null,u=l?.querySelector('[name="_t"]')||null,g=Object.assign({},x);delete g._t,l?.dataset.hpName&&delete g[l.dataset.hpName],v!==null&&(g._hp=v.value),u!==null&&(g._t=u.value);const w=new Map(o);ne(s,w);const z=$e(g,t,w),B=Ae(s,z.files);if(B){k(s,B,!0);const A=new Error(B);throw A.formSubmitFailed=!0,A}const i=await H.post(`/api/forms/submit/${a.slug}`,z.files.size?Ee(z.values,z.files).body:z.values);if(i&&i.error){k(s,i.error,!0);const A=new Error(i.error);throw A.formSubmitFailed=!0,A}if(i?.redirect){se(i.redirect);return}for(Se(s);s.firstChild;)s.removeChild(s.firstChild);k(s,i?.message||e.successMessage||"Thank you for your submission.",!1)}catch(l){throw l.formSubmitFailed||k(s,l.message||"Submission failed. Please try again.",!0),l}},f=Date.now();function c(x){const l=x.querySelector("form");if(!l||l.querySelector(".fb-form-honeypot"))return;const v=document.createElement("div");v.className="fb-form-honeypot",v.setAttribute("aria-hidden","true");const u=document.createElement("input");u.name=l.querySelector('[name="website"]')?"_website":"website",v.dataset.hpName=u.name,u.type="text",u.tabIndex=-1,u.autocomplete="url",u.placeholder="https://",v.appendChild(u);const g=document.createElement("input");g.name="_t",g.type="hidden",g.value=f,v.appendChild(g),l.appendChild(v)}function y(x){if(!window.FormLogicEngine||!t.some(v=>v.logic||Array.isArray(v.triggers)&&v.triggers.length))return null;const l=new window.FormLogicEngine.FormLogicRuntime(a,s,x?{baseValues:x}:void 0);if(l.init(),s._formLogicRuntime=l,s._formLogicObserved)return l;if(s._formLogicObserved=!0,s.parentNode&&typeof MutationObserver<"u"){const v=new MutationObserver(function(u){for(const g of u)for(const w of g.removedNodes)if(w===s||w.nodeType===1&&w.contains&&w.contains(s)){s._formLogicRuntime&&s._formLogicRuntime.destroy(),v.disconnect();return}});v.observe(s.parentNode,{childList:!0,subtree:!1}),s._formLogicObserver=v}return l}let L=!1;if(s.addEventListener("dm-form-end",x=>{const l=x.detail?.validation;if(l&&!l.valid){Z(s,l.missing),ee(l);return}L||(L=!0,h(x.detail?.values||{}).catch(()=>{}).finally(()=>{L=!1}))}),p&&F.wizard){const x=ve(t,a.title),l=x.map(i=>({title:i.title,description:i.description,fields:C(i.fields,n)})),v=x.map(i=>i.fields);let u=0,g=null,w=null;const z=i=>{const A=window.FormLogicEngine;if(!A||!A.validateFields)return;const M=A.validateFields(s,v[u]||[]);M.valid||(i.preventDefault(),i.stopImmediatePropagation(),Z(s,M.missing),ee(M))},B=()=>{const i=v[u]||t;Ce(s,e),te(s,e,i),oe(s,e),b(s,i),Q(s,i),ke(s,o),e.honeypot!==!1&&c(s),g&&g.destroy(),g=y(w?.getStepData?w.getStepData():void 0),s.querySelectorAll(".wizard-next, .wizard-submit").forEach(A=>A.addEventListener("click",z,!0))};w=F.wizard(s,{schema:{steps:l},layout:d,columns:n,finishText:e.submitText||"Finish",onSubmit:h,onStepChange:i=>{ne(s,o),u=i,setTimeout(B,0)}}),s.addEventListener("dm-form-trigger",i=>{if(i.detail?.type!=="goto-step"||!w?.goToStep)return;const A=Number(i.detail.action.step);!Number.isFinite(A)||A<0||A>=l.length||A!==u&&w.goToStep(A)}),Promise.resolve(w).then(B)}else if(F.render){const x=F.render(s,C(t,n),I(t),{submitText:e.submitText||"Submit",layout:d,columns:n,onSubmit:h});Promise.resolve(x).then(function(){we(s,e,d),te(s,e,t),oe(s,e),b(s,t),Q(s,t),e.honeypot!==!1&&c(s),y()})}})})();function Me(m,r){const q=document.body,C=q.classList,I=new Set((q.dataset.railSite||"").split(" ").filter(Boolean)),b=()=>window.matchMedia("(min-width: 993px)").matches;m.querySelectorAll(".navbar-link, .navbar-dropdown-toggle").forEach(n=>{const d=n.textContent.trim();d&&(n.setAttribute("title",d),n.querySelector("svg, [data-icon]")||(n.dataset.initial=d.charAt(0).toUpperCase()))});const k=document.createElement("button");k.type="button",k.className="dm-nav-collapse-toggle";const s=()=>{const n=C.contains("dm-vnav-collapsed");k.setAttribute("aria-pressed",String(n)),k.setAttribute("aria-label",n?"Expand menu":"Collapse menu"),k.title=k.getAttribute("aria-label");const d=r?"chevrons-left":"chevrons-right",p=r?"chevrons-right":"chevrons-left";k.innerHTML=`<span data-icon="${n?d:p}"></span>`,window.Domma&&Domma.icons&&Domma.icons.scan(k)},a=n=>{C.toggle("dm-vnav-collapsed",n),S.set("nav_collapsed",n),s()};k.addEventListener("click",()=>a(!C.contains("dm-vnav-collapsed"))),s();const t=m.querySelector(".navbar-container")||m;t.insertBefore(k,t.firstChild?.nextSibling||null);const e=n=>{C.toggle("dm-vnav-autohide",n),C.toggle("dm-vnav-collapsible",!n&&I.has("collapsible")),n?C.remove("dm-vnav-collapsed"):I.has("collapsible")&&S.get("nav_collapsed")===!0&&C.add("dm-vnav-collapsed"),m.classList.remove("dm-nav-revealed"),s()};m.addEventListener("pointerdown",n=>{C.contains("dm-vnav-autohide")&&n.pointerType!=="mouse"&&!m.classList.contains("dm-nav-revealed")&&(m.classList.add("dm-nav-revealed"),n.preventDefault())}),document.addEventListener("pointerdown",n=>{m.contains(n.target)||m.classList.remove("dm-nav-revealed")}),window.E&&typeof E.contextMenu=="function"&&E.contextMenu(m,{items:()=>{const n=C.contains("dm-vnav-autohide"),d=C.contains("dm-vnav-collapsed"),p=S.has("nav_autohide")||S.has("nav_collapsed");return[{header:"Menu"},{label:d?"Expand menu":"Collapse to icons",icon:d?"maximize":"minimize",disabled:!b()||n||!I.has("collapsible"),action:()=>a(!d)},{label:n?"Keep on screen":"Hide when not in use",icon:n?"eye":"eye-off",disabled:!b(),action:()=>{S.set("nav_autohide",!n),e(!n)}},{type:"divider"},{label:"Reset to the site's setting",icon:"refresh",disabled:!p,action:()=>{S.remove("nav_autohide"),S.remove("nav_collapsed"),e(I.has("autohide")),C.toggle("dm-vnav-collapsed",!I.has("autohide")&&I.has("start-collapsed")),s()}}]}})}function qe(m){m.classList.add("dm-nav-scroll-hide");let r=window.scrollY,q=!1;window.addEventListener("scroll",()=>{q||(q=!0,requestAnimationFrame(()=>{q=!1;const C=window.scrollY,I=m.matches(":focus-within")||m.querySelector(".navbar-dropdown.open, .navbar-collapse.show");C>r&&C>m.offsetHeight&&!I?m.classList.add("dm-nav-scrolled-away"):C<r&&m.classList.remove("dm-nav-scrolled-away"),r=C}))},{passive:!0})}function De(m){let r={};try{r=JSON.parse(m.dataset.contents||"{}")}catch{}const q=m.closest(".site-main"),C=document.querySelector(".site-content"),I=new Set(String(r.exclude||"").split(",").map(o=>o.trim().toLowerCase()).filter(Boolean)),b=o=>!o.closest(".hero, .card, .accordion, .tabs, figure, #site-sidebar"),k=o=>(C?[...C.querySelectorAll(o)]:[]).filter(b).filter(h=>!I.has(h.textContent.trim().toLowerCase())),s=r.headings==="h2"?k("h2"):r.headings==="h3"?k("h3"):r.headings==="h2h3"?k("h2, h3"):k("h2").length?k("h2"):k("h3");if(!s.length){q?.classList.add("no-sidebar-items");return}const a=new Set([...document.querySelectorAll("[id]")].map(o=>o.id)),t=document.createElement("nav");t.className="dm-contents",t.setAttribute("aria-label",r.title||"Page contents"),r.hover&&(t.dataset.menuHover=r.hover),r.selected&&(t.dataset.menuActive=r.selected),r.accent&&t.style.setProperty("--dm-menu-highlight",r.accent.startsWith("#")?r.accent:`var(--dm-${r.accent})`),r.font&&(t.style.fontFamily=r.font),r.fontSize&&(t.style.fontSize=r.fontSize),r.fontWeight&&(t.style.fontWeight=r.fontWeight);const e=document.createElement("div");e.className="dm-contents-head";const n=document.createElement("p");n.className="dm-contents-title",n.textContent=r.title||"",e.appendChild(n),t.appendChild(e);const d=document.createElement("ol");d.className="dm-contents-list"+(r.numbered?" is-numbered":"");const p=[];for(const o of s){if(!o.id){const c=(o.textContent||"").toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"section";let y=c;for(let L=2;a.has(y);L++)y=`${c}-${L}`;a.add(y),o.id=y}const h=document.createElement("li");h.className=`dm-contents-item dm-contents-${o.tagName.toLowerCase()}`;const f=document.createElement("a");f.href=`#${o.id}`,f.textContent=o.textContent.trim(),h.appendChild(f),d.appendChild(h),p.push([o,f])}if(t.appendChild(d),m.replaceChildren(t),r.scrollSpy!==!1&&"IntersectionObserver"in window){const o=new Map,h=()=>{const c=p.find(([y])=>o.get(y))||null;p.forEach(([,y])=>{const L=c&&y===c[1];y.classList.toggle("is-active",!!L),L?y.setAttribute("aria-current","location"):y.removeAttribute("aria-current")})},f=new IntersectionObserver(c=>{c.forEach(y=>o.set(y.target,y.isIntersecting)),h()},{rootMargin:"-80px 0px -60% 0px"});p.forEach(([c])=>f.observe(c))}if(q?.classList.contains("contents-collapsible")){const o=document.createElement("button");o.type="button",o.className="dm-contents-toggle";const h=()=>{const f=q.classList.contains("contents-collapsed");o.setAttribute("aria-expanded",String(!f)),o.setAttribute("aria-label",f?"Show the contents":"Hide the contents"),o.title=o.getAttribute("aria-label"),o.innerHTML=`<span data-icon="${f?"list":"x"}"></span>`,window.Domma?.icons&&Domma.icons.scan(o)};o.addEventListener("click",()=>{S.set("contents_collapsed",q.classList.toggle("contents-collapsed")),h()}),h(),e.insertBefore(o,e.firstChild)}if(q?.classList.contains("contents-floating")&&r.movable){t.classList.add("is-movable");const o=S.get("contents_position");o&&Number.isFinite(o.x)&&Object.assign(m.style,{left:`${o.x}px`,top:`${o.y}px`,right:"auto",bottom:"auto"}),e.addEventListener("pointerdown",h=>{if(h.target.closest("button"))return;const f=m.getBoundingClientRect(),c=h.clientX-f.left,y=h.clientY-f.top,L=l=>{const v=Math.max(0,Math.min(window.innerWidth-f.width,l.clientX-c)),u=Math.max(0,Math.min(window.innerHeight-40,l.clientY-y));Object.assign(m.style,{left:`${v}px`,top:`${u}px`,right:"auto",bottom:"auto"})},x=()=>{document.removeEventListener("pointermove",L),S.set("contents_position",{x:parseInt(m.style.left,10),y:parseInt(m.style.top,10)})};document.addEventListener("pointermove",L),document.addEventListener("pointerup",x,{once:!0})})}window.E&&typeof E.contextMenu=="function"&&E.contextMenu(m,{items:()=>{const o=q?.classList.contains("contents-collapsible"),h=q?.classList.contains("contents-collapsed"),f=p.find(([,c])=>c.classList.contains("is-active"));return[{header:"Contents"},...o?[{label:h?"Show the contents":"Collapse to a button",icon:h?"list":"minimize",action:()=>m.querySelector(".dm-contents-toggle")?.click()}]:[],{label:"Copy a link to this section",icon:"link",disabled:!f,action:async()=>{const c=`${location.origin}${location.pathname}#${f[0].id}`;try{await _.copyToClipboard(c),E.toast("Link copied.",{type:"success"})}catch{E.toast("Could not copy the link.",{type:"error"})}}},{label:"Back to the top",icon:"arrow-up",action:()=>window.scrollTo({top:0,behavior:"smooth"})}]}}),q?.classList.contains("contents-autohide")&&(m.addEventListener("pointerdown",o=>{o.pointerType!=="mouse"&&!m.classList.contains("is-revealed")&&(m.classList.add("is-revealed"),o.preventDefault())}),document.addEventListener("pointerdown",o=>{m.contains(o.target)||m.classList.remove("is-revealed")}))}
|
|
1
|
+
import{applyMobileMenu as se,initCarouselPopup as re}from"/public/js/mobile-ui.mjs?v=20261016-mobile-options";import{installSmoothCarets as ie}from"/public/js/smooth-caret.js";import{decodeBase64Json as V}from"/public/js/utf8-base64.mjs";import{makeBadgeEl as U,applyColour as G,applyPill as ce,applyFloat as le,applyHighlight as Y,applyItemHighlight as de,itemHighlightAttrs as me,currentItems as K,menuAlign as ue,applyClasses as P,cssClasses as X,applyEntrance as J}from"/public/js/menu-decor.mjs?v=20261109-current-query";import{applyMenuLook as pe,applyFooterLook as fe}from"/public/js/menu-cards.mjs?v=20261115-rich-captions";import{initPageMotion as he}from"/public/js/page-motion.mjs?v=20261029-page-motion";import{applyFooterShowcase as ge}from"/public/js/footer-showcase.mjs?v=20261029-footer-showcase";import{initFloatingMenus as ye}from"/public/js/menu-float.js?v=20260927-float";import{enhancePickerFields as Q,markInvalidFields as Z,showValidationPopup as ee}from"/public/js/forms.js?v=20261109-form-embed";import{buildWizardSteps as ve}from"/public/js/form-steps.mjs";import{mountMotionControl as be}from"/public/js/motion-control.mjs?v=20261031-launchers";import{applyFormClasses as te,applyFormEntrance as oe,applySubmitButtons as we,applyWizardButtons as Se}from"/public/js/form-submit.mjs";import{captureFileFields as ne,destroyDropzones as Ce,fileBlueprint as xe,restoreFileFields as ke,setFileLimits as Le,splitFiles as $e,submitBody as Ee,totalTooLarge as Ae,wireFileFields as Te}from"/public/js/form-files.mjs";document.addEventListener("click",m=>{const i=m.target?.closest?.(".dm-banner__dismiss");i&&(m.preventDefault(),i.closest(".dm-banner")?.remove())}),$(()=>{ie(document);const m=window.__CMS_NAV__||{},i=window.__CMS_SITE__||{},M=i.brandingEnabled!==!1&&m.brand?.enabled!==!1;if(i.autoTheme?.enabled){let t=function(d){const p=(d||"07:00").split(":");return+p[0]*60+(+p[1]||0)},e=function(){const d=new Date,p=d.getHours()*60+d.getMinutes();return p>=t(s.dayStart)&&p<t(s.nightStart)?s.dayTheme:s.nightTheme},n=function(d){if(window.CMSThemeSwitcher?.hasPreference())return;const p=s.apply&&s.apply[d]||{theme:d,custom:""};Domma.theme.set(p.theme);for(const o of[...document.body.classList])o.startsWith("dm-custom-")&&document.body.classList.remove(o);p.custom&&document.body.classList.add(p.custom)};const s=i.autoTheme;n(e()),setInterval(()=>n(e()),6e4)}const C=$("#site-navbar");if(C.length&&m.brand){let e=function(l,v=0){return Array.isArray(l)?l.filter(u=>!(u&&(u.type==="spacer"||u.type==="theme-switcher"))).filter(u=>!(u&&u.type==="separator"&&v===0)).map(u=>u&&u.type==="separator"?{divider:!0}:Array.isArray(u?.items)?{...u,items:e(u.items,v+1)}:u):l};const s={...m.brand},t=s.size&&s.size!=="md"?` navbar-brand-${s.size}`:"";if(s.logo||s.icon||s.tagline){let l="";s.logo?l+=`<img src="${s.logo}" class="navbar-brand-logo" alt="${String(s.text||s.alt||"").replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<")}">`:s.icon&&(l+=`<span data-icon="${s.icon}" style="width:1.1em;height:1.1em;margin-right:.35em;vertical-align:middle;"></span>`),s.text&&(l+=`<span class="navbar-brand-text${t}">${s.text}</span>`),s.tagline&&(l+=`<small class="navbar-brand-tagline">${s.tagline}</small>`),s.html=l}else t&&s.text&&(s.html=`<span class="navbar-brand-text${t}">${s.text}</span>`);const n=e(m.items||[]),d=m.position==="floating",p=m.orientation==="vertical";C.get(0).querySelector(":scope > .cms-nojs-links")?.remove(),Domma.elements.navbar("#site-navbar",{brand:M?s:null,items:n,variant:m.variant||"dark",position:d?"static":m.position||"sticky",collapsible:!0,appearOnHover:!!m.appearOnHover}),Domma.icons.scan("#site-navbar");const o=C.get(0);se(o,m.mobile);const h=()=>{if(!p)return;const v=o.querySelector('a[aria-current="page"]')?.closest(".navbar-dropdown");v&&!v.classList.contains("open")&&v.querySelector(":scope > .navbar-dropdown-toggle")?.click()};o.classList.add(`dm-nav-align-${ue(m)||"centre"}`),p&&C.get(0).classList.add("dm-nav-vertical",m.side==="right"?"dm-nav-vertical-right":"dm-nav-vertical-left");const f=m.dock||{};p&&!d&&qe(o,m.side==="right"),!p&&f.hideOnScroll&&Me(o),Y(o,m),J(o,m),P(o,m.class),d&&(le(C.get(0),m),ye(C.get(0).parentNode||document));const c=o.querySelector(".navbar-toggle"),y=o.querySelector(".navbar-collapse");if(c&&y){let l=null;const v=()=>{y.classList.contains("show")&&c.click()},u=()=>{l&&(l.remove(),l=null),document.body.classList.remove("dm-drawer-open")},g=()=>{l||(l=document.createElement("div"),l.className="dm-navbar-backdrop",l.addEventListener("click",v),document.body.appendChild(l),document.body.classList.add("dm-drawer-open"))};c.addEventListener("click",()=>{requestAnimationFrame(()=>{y.classList.contains("show")?(h(),g()):u()})}),y.addEventListener("click",w=>{w.target.closest("a")&&requestAnimationFrame(u)}),document.addEventListener("keydown",w=>{w.key==="Escape"&&y.classList.contains("show")&&v()})}const L=o.querySelector(".navbar-nav");if(L){const l=Array.from(L.children);let v=0;for(const u of m.items||[])if(!(u&&u.type==="separator")){if(u&&u.type==="spacer"){const g=document.createElement("li"),w=["xs","sm","md","lg","xl","flex"].includes(u.size)?u.size:"md";g.className=`dm-menu-spacer dm-menu-spacer--${w}`,g.setAttribute("aria-hidden","true"),L.insertBefore(g,l[v]||null);continue}if(u&&u.type==="theme-switcher"){const g=document.createElement("li");g.className="dm-menu-theme-switcher";const w=document.createElement("span");w.dataset.themeSwitcher="menu",w.dataset.position="inline",g.appendChild(w),L.insertBefore(g,l[v]||null);continue}v++}window.CMSThemeSwitcher?.scan(L)}const x=K(n,location.pathname+location.search);o.querySelectorAll("[data-path]").forEach(l=>{const v=l.dataset.path.split(".").map(Number),u=v.length>1,g=v.reduce((z,B)=>z?.items?.[B],{items:n});if(!g)return;g.colour&&G(l,g.colour),g.pill&&!u&&ce(l,g.pill),de(l,g),P(l.closest("li"),g.class);const w=U(g.badge);w&&l.appendChild(w),x.has(g)&&(l.classList.add("active"),l.setAttribute("aria-current","page"))}),pe(o,m,n),h()}let I=null;const b=$("#site-footer");if(b.length){let d=function(r){return String(r??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")},p=function(r){return d(r).replace(/'/g,"'")},o=function(r){if(r&&r.type==="separator")return'<li class="footer-sep"><hr></li>';if(r&&r.type==="spacer")return`<li class="dm-menu-spacer dm-menu-spacer--${["xs","sm","md","lg","xl","flex"].includes(r.size)?r.size:"md"}" aria-hidden="true"></li>`;if(r&&r.type==="theme-switcher")return'<li class="dm-menu-theme-switcher"><span data-theme-switcher="menu" data-position="inline"></span></li>';const A=p(r.url||"#"),q=d(r.text||""),D=Array.isArray(r.items)&&r.items.length?`<ul>${r.items.map(o).join("")}</ul>`:"",N=me(r),W=[N.hover&&` data-menu-item-hover="${p(N.hover)}"`,N.active&&` data-menu-item-active="${p(N.active)}"`].filter(Boolean).join(""),j=N.accent?` style="--dm-menu-highlight:${p(N.accent)}"`:"",O=X(r.class).join(" ");return`<li${O?` class="${p(O)}"`:""}><a href="${A}"${W}${j}>${q}</a>${D}</li>`},f=function(){if(!i.footer)return"";const r=Object.keys(t).filter(q=>s[q]);if(!r.length)return"";const A=X(i.footer.socialClass).join(" ");return`<div class="footer-social">${r.map(q=>{const{label:D,svg:N}=t[q];return`<a href="${s[q]}" target="_blank" rel="noopener noreferrer" aria-label="${D}" class="footer-social-link${A?` ${p(A)}`:""}">${N}</a>`}).join("")}</div>`},x=function(r){if(!r||r.type==="separator"||r.type==="spacer")return"";if(r.type==="theme-switcher")return`<li class="cms-footer-col">${o(r).replace(/^<li[^>]*>|<\/li>$/g,"")}</li>`;const A=Array.isArray(r.items)&&r.items.length?`<ul>${r.items.map(o).join("")}</ul>`:"",q=L(r)?`<span class="cms-footer-col-title">${d(r.text||"")}</span>`:`<a class="cms-footer-col-title" href="${p(r.url||"#")}">${d(r.text||"")}</a>`,D=["cms-footer-col",...X(r.class)].join(" ");return`<li class="${p(D)}">${q}${A}</li>`},u=function(r,A,q=!1){return(r||[]).forEach(D=>{D&&(D.type==="separator"||D.type==="spacer"||D.type==="theme-switcher")||(q&&L(D)||A.push(D),Array.isArray(D.items)&&D.items.length&&u(D.items,A))}),A};const s=i.social||{},t={twitter:{label:"X / Twitter",svg:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-4.714-6.231-5.401 6.231H2.742l7.73-8.835L1.254 2.25H8.08l4.259 5.629L18.244 2.25zm-1.161 17.52h1.833L7.084 4.126H5.117z"/></svg>'},facebook:{label:"Facebook",svg:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z"/></svg>'},instagram:{label:"Instagram",svg:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.07-1.644-.07-4.849 0-3.204.013-3.583.07-4.849.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zM12 0C8.741 0 8.333.014 7.053.072 2.695.272.273 2.69.073 7.052.014 8.333 0 8.741 0 12c0 3.259.014 3.668.072 4.948.2 4.358 2.618 6.78 6.98 6.98C8.333 23.986 8.741 24 12 24c3.259 0 3.668-.014 4.948-.072 4.354-.2 6.782-2.618 6.979-6.98.059-1.28.073-1.689.073-4.948 0-3.259-.014-3.667-.072-4.947-.196-4.354-2.617-6.78-6.979-6.98C15.668.014 15.259 0 12 0zm0 5.838a6.162 6.162 0 100 12.324 6.162 6.162 0 000-12.324zM12 16a4 4 0 110-8 4 4 0 010 8zm6.406-11.845a1.44 1.44 0 100 2.881 1.44 1.44 0 000-2.881z"/></svg>'},linkedin:{label:"LinkedIn",svg:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.062 2.062 0 01-2.063-2.065 2.064 2.064 0 112.063 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"/></svg>'},github:{label:"GitHub",svg:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/></svg>'},youtube:{label:"YouTube",svg:'<svg viewBox="0 0 24 24" fill="currentColor"><path d="M23.495 6.205a3.007 3.007 0 00-2.088-2.088c-1.87-.501-9.396-.501-9.396-.501s-7.507-.01-9.396.501A3.007 3.007 0 00.527 6.205a31.247 31.247 0 00-.522 5.805 31.247 31.247 0 00.522 5.783 3.007 3.007 0 002.088 2.088c1.868.502 9.396.502 9.396.502s7.506 0 9.396-.502a3.007 3.007 0 002.088-2.088 31.247 31.247 0 00.5-5.783 31.247 31.247 0 00-.5-5.805zM9.609 15.601V8.408l6.264 3.602z"/></svg>'}};let e='<div class="footer-inner container">';const n=window.__CMS_FOOTER__||{primary:[],legal:[],copyright:""},h=(()=>{const r=i.cookieConsent;if(!r||r.showSettingsLink===!1)return"";const A=q=>(q||[]).some(D=>D&&(D.url==="#cookie-settings"||A(D.items)));return A(n.primary)||A(n.legal)?"":`<li class="cms-cookie-settings"><a href="#cookie-settings">${d(r.settingsLinkText||"Cookie settings")}</a></li>`})(),c=["columns","row"].includes(i.footer?.layout)?i.footer.layout:"auto",y=i.footer?.look==="showcase"||c==="columns"||c==="auto"&&n.primary.some(r=>Array.isArray(r?.items)&&r.items.length),L=r=>y&&!r.url&&Array.isArray(r.items)&&r.items.length>0;if(y){const r=m.brand||{},A=M&&(r.text||i.title)||"",q=M?r.logo?`<img src="${p(r.logo)}" class="cms-footer-brand-logo" alt="">`:r.icon?'<span class="cms-footer-brand-icon"></span>':"":"",D=String(i.footer?.blurb||"").trim();e='<div class="footer-inner footer-inner--columns container"><div class="cms-footer-top">',e+=`<div class="cms-footer-brand">${A||q?`<a class="cms-footer-brand-name" href="${p(r.url||"/")}">${q}<span>${d(A)}</span></a>`:""}${D?`<p class="cms-footer-blurb">${d(D)}</p>`:""}${f()}</div>`,n.primary.length&&(e+=`<nav class="footer-nav footer-nav--primary footer-nav--columns" aria-label="Footer"><ul>${n.primary.map(x).join("")}</ul></nav>`),e+='</div><div class="cms-footer-bottom">',n.copyright&&(e+=`<p class="cms-footer-copyright">${d(n.copyright)}</p>`),(n.legal.length||h)&&(e+=`<nav class="footer-nav footer-nav--legal" aria-label="Legal"><ul>${n.legal.map(o).join("")}${h}</ul></nav>`),e+="</div>"}else n.copyright&&(e+=`<p>${d(n.copyright)}</p>`),n.primary.length&&(e+=`<nav class="footer-nav footer-nav--primary"><ul>${n.primary.map(o).join("")}</ul></nav>`),(n.legal.length||h)&&(e+=`<nav class="footer-nav footer-nav--legal"><ul>${n.legal.map(o).join("")}${h}</ul></nav>`),e+=f();e+="</div>",b.get(0).querySelector(":scope > .cms-nojs-links")?.remove();const l=b.get(0).querySelector(":scope > .cms-footer-blocks");l?.remove(),b.html(e),l&&b.get(0).prepend(l),window.CMSThemeSwitcher?.scan(b.get(0));const v=b.get(0).querySelector(".cms-footer-brand-icon");v&&m.brand?.icon&&v.setAttribute("data-icon",m.brand.icon),P(b.get(0),i.footer?.class),y&&ge(b.get(0),i);const g=[...u(n.primary,[],!0),...u(n.legal,[])],w=K([...n.primary||[],...n.legal||[]],location.pathname+location.search),z=b.get(0).querySelectorAll(".footer-nav a"),B=[];z.forEach((r,A)=>{const q=g[A];if(!q)return;if(B.push({a:r,item:q}),q.icon){const N=document.createElement("span");N.className="cms-footer-ic",N.setAttribute("data-icon",String(q.icon)),N.setAttribute("data-icon-size","15"),N.setAttribute("aria-hidden","true"),r.prepend(N)}q.colour&&G(r,q.colour);const D=U(q.badge);D&&r.appendChild(D),w.has(q)&&(r.classList.add("is-active"),r.setAttribute("aria-current","page"))}),Y(b.get(0).querySelector(".footer-nav--primary"),{highlight:n.primaryHighlight}),Y(b.get(0).querySelector(".footer-nav--legal"),{highlight:n.legalHighlight}),J(b.get(0).querySelector(".footer-nav--primary"),{entrance:n.primaryEntrance}),J(b.get(0).querySelector(".footer-nav--legal"),{entrance:n.legalEntrance}),P(b.get(0).querySelector(".footer-nav--primary"),n.primaryClass),P(b.get(0).querySelector(".footer-nav--legal"),n.legalClass),fe(b.get(0),n,B),I=b.get(0).querySelector(".cms-footer-bottom")||b.get(0).querySelector(".footer-inner")}be(i.motion||{enabled:i.footer?.showMotionToggle!==!1,default:i.footer?.motionDefault,placement:"footer",control:i.footer?.motionControl,label:"Reduce motion"},{footer:I,navbar:document.querySelector("#site-navbar .navbar-container")?.closest("#site-navbar")||null});const k=document.getElementById("site-sidebar");k&&De(k),Domma.icons.scan(),Domma.syntax?.scan&&Domma.syntax.scan();const a=$(".page-body");if(a.length){a.find(".accordion").each(function(){Domma.elements.accordion(this,{allowMultiple:this.dataset.multi==="true"})}),a.find(".tabs").each(function(){Domma.elements.tabs(this)}),a.find(".carousel").each(function(){const t={primary:"--dm-primary",secondary:"--dm-secondary",accent:"--dm-primary",text:"--dm-text",surface:"--dm-surface",background:"--dm-background",success:"--dm-success",warning:"--dm-warning",danger:"--dm-danger",info:"--dm-info"},e=f=>{const c=String(f||"").trim();return c?t[c.toLowerCase()]?`var(${t[c.toLowerCase()]})`:CSS.supports("color",c)?c:"":""},n=e(this.dataset.background),d=e(this.dataset.arrowBackground),p=e(this.dataset.arrowColor);n&&(this.style.setProperty("--dm-carousel-background",n),this.classList.add("dm-carousel-custom-background")),d&&this.style.setProperty("--dm-carousel-arrow-background",d),p&&this.style.setProperty("--dm-carousel-arrow-color",p);const o=["top","middle","bottom"].includes(this.dataset.arrowPosition)?this.dataset.arrowPosition:"middle";this.classList.add(`dm-carousel-arrows-${o}`);const h={autoplay:this.dataset.autoplay==="true",interval:parseInt(this.dataset.interval,10)||5e3,loop:this.dataset.loop!=="false",animation:this.dataset.animation||"slide",heightMode:this.dataset.heightMode==="average"?"average":"crop"};if(this.dataset.height){const f=Number(this.dataset.height);Number.isFinite(f)&&f>0&&(h.height=f)}if(this.dataset.animationDuration){const f=parseInt(this.dataset.animationDuration,10);Number.isFinite(f)&&(h.animationDuration=f)}this.dataset.animationEasing&&(h.animationEasing=this.dataset.animationEasing),this.dataset.ctx&&(this._dmCtxSlides=Array.from(this.querySelectorAll(".carousel-slide")).map(f=>f.cloneNode(!0)),this._dmCarouselOpts=h),this._dmCarousel=Domma.elements.carousel(this,h),re(this)}),a.find(".dm-countdown").each(function(){const t={autoStart:!0},e=String(this.dataset.format||"").trim(),n=String(this.dataset.to||"").trim(),d=/^(\d{4})-(\d{2})-(\d{2})$/.exec(n),p=d?new Date(+d[1],+d[2]-1,+d[3]).getTime():n?new Date(n).getTime():NaN;Number.isFinite(p)?t.duration=Math.max(0,p-Date.now()):this.dataset.duration&&(t.duration=(parseInt(this.dataset.duration,10)||0)*1e3);const o=/^dd:/i.test(e);t.format=o?"hh:mm:ss":e||(t.duration>=36e5?"hh:mm:ss":"mm:ss");const h=this,f=y=>String(y).padStart(2,"0"),c=y=>{const L=Math.max(0,Math.floor(y/1e3)),x=h.querySelector(".dm-timer-time");x&&(x.textContent=`${f(Math.floor(L/86400))}:${f(Math.floor(L%86400/3600))}:${f(Math.floor(L%3600/60))}:${f(L%60)}`)};o&&(t.onTick=c),Domma.elements.timer(this,t),o&&c(t.duration||0)}),a.find("[data-tooltip]:not(.dm-range-slider)").each(function(){Domma.elements.tooltip(this,{content:$(this).data("tooltip"),position:$(this).data("tooltip-position")||"top"})}),a.find(".dm-progression").each(function(){const t=Array.from(this.querySelectorAll(".dm-progression-item")).map(d=>{const p={title:d.querySelector(".dm-progression-item-title")?.textContent?.trim()||"",description:d.querySelector(".dm-progression-item-body")?.innerHTML?.trim()||""};return d.dataset.date&&(p.date=d.dataset.date),d.dataset.status&&(p.status=d.dataset.status),d.dataset.eventIcon&&(p.icon=d.dataset.eventIcon),d.dataset.entryId&&(p._entryId=d.dataset.entryId),p}),e=this.dataset.layout==="centred"?"centered":this.dataset.layout||"vertical",n=Domma.elements.progression(this,{layout:e,theme:this.dataset.theme||"minimal",mode:this.dataset.mode||"timeline",statusIcons:!0,allowHtml:!0,...t.length?{items:t}:{}});if((this.dataset.mode||"timeline")==="timeline"){const d={completed:{label:"Completed",icon:"check-circle",tone:"success"},planned:{label:"Planned",icon:"circle",tone:"secondary"},"in-progress":{label:"In progress",icon:"clock",tone:"primary"},blocked:{label:"Blocked",icon:"alert-circle",tone:"danger"}};this.querySelectorAll(".dm-progression-item").forEach((p,o)=>{const h=t[o];if(!h)return;const f=p.querySelector(".dm-progression-title");if(h.icon&&f){const y=document.createElement("span");y.dataset.icon=h.icon,y.style.cssText="display:inline-flex;vertical-align:middle;margin-right:.4em",y.setAttribute("aria-hidden","true"),f.prepend(y)}const c=d[h.status];if(c&&f){const y=document.createElement("span");y.className=`badge badge-${c.tone} cms-timeline-status`,y.style.cssText="display:inline-flex;align-items:center;gap:.35em;margin:.4rem 0";const L=document.createElement("span");L.dataset.icon=c.icon,L.dataset.iconSize="14",L.setAttribute("aria-hidden","true"),y.append(L,document.createTextNode(c.label)),f.after(y)}})}Domma.icons.scan(this),t.length&&(this._dmCtx={instance:n,items:t})});try{Domma.effects.reveal(".page-body .hero",{animation:"slide-up",duration:480,threshold:.06,stagger:60,once:!1})}catch{}const s=matchMedia("(prefers-reduced-motion: reduce)").matches||document.documentElement.classList.contains("dm-reduced-motion");document.querySelectorAll(".page-body .row[data-reveal]").forEach(t=>{const e=t.dataset.revealMode||"stagger",n=t.dataset.revealAnimation||"slide-up",d=parseInt(t.dataset.revealDuration,10)||(n.startsWith("swoosh")?700:400),p=parseInt(t.dataset.revealStagger,10)||(n.startsWith("swoosh")?90:60),o=parseInt(t.dataset.revealDelay,10)||0,h=t.dataset.revealDirection==="rtl",f=t.dataset.revealReplay==="true",c=Array.from(t.children);if(s&&n.startsWith("swoosh"))return;const y={"slide-up":"translateY(30px)","slide-down":"translateY(-30px)","slide-left":"translateX(30px)","slide-right":"translateX(-30px)",zoom:"scale(0.85)",flip:"perspective(600px) rotateX(15deg)",swoosh:"translateY(36px) scale(0.96)"},L=u=>n!=="swoosh-sides"?y[n]||"":c.length>1&&u===0?"translateX(-64px) rotate(-1.5deg)":c.length>1&&u===c.length-1?"translateX(64px) rotate(1.5deg)":"translateY(40px) scale(0.94)",x=n.startsWith("swoosh"),l=x?"cubic-bezier(.2,.8,.2,1)":"ease",v=(u,g)=>{u.style.opacity="0",u.style.transform=L(g),x&&(u.style.filter="blur(10px)")};c.forEach((u,g)=>{u.style.transition="none",v(u,g)}),t.offsetWidth,c.forEach((u,g)=>{u.style.transition=`opacity ${d}ms ${l}, transform ${d}ms ${l}`+(x?`, filter ${d}ms ${l}`:"");const w=h?c.length-1-g:g;u.style.transitionDelay=e==="stagger"?`${o+w*p}ms`:`${o}ms`}),requestAnimationFrame(()=>requestAnimationFrame(()=>{const u=new IntersectionObserver(g=>{g.forEach(w=>{if(w.isIntersecting){if(w.target.offsetWidth,w.target.style.opacity="1",w.target.style.transform="",x&&(w.target.style.filter=""),!f){u.unobserve(w.target);const z=w.target;z.addEventListener("transitionend",function B(r){r.target!==z||r.propertyName!=="opacity"||(z.removeEventListener("transitionend",B),z.style.transition="",z.style.transitionDelay="")})}}else f&&w.boundingClientRect.top>0&&v(w.target,c.indexOf(w.target))})},{threshold:.1,rootMargin:"100000px 0px 0px 0px"});c.forEach(g=>u.observe(g))}))}),he(document.querySelector(".page-body")||document),a.find(".card[data-collapsible]").each(function(){const t=this.querySelector(":scope > .card-header");t&&t.addEventListener("click",()=>this.classList.toggle("is-collapsed"))}),a.find(".dm-so-trigger").each(function(){this.addEventListener("click",()=>{const t=this.dataset.soTarget,e=document.getElementById(t);if(!e)return;const n=E.slideover({title:e.dataset.soTitle||"",size:e.dataset.soSize||"md",position:e.dataset.soPosition||"right"});e.style.display="",n.setContent(e),n.open()})})}if(typeof $.setup=="function"){const s=Object.assign({},window.__CMS_DCONFIG__||{});if(document.querySelectorAll(".dm-page-config[data-config]").forEach(t=>{try{const e=V(t.dataset.config);Object.assign(s,e)}catch{}}),Object.keys(s).length>0){const t={};for(const[e,n]of Object.entries(s)){const d=n?.events?.click,{confirm:p,toast:o,alert:h,prompt:f,...c}=d||{};if(p||o||h||f){$(e).on("click",async function(W){if(W.preventDefault(),p&&!await E.confirm(p))return;let j=null;if(!(f&&(j=await E.prompt(f,{inputPlaceholder:c.promptPlaceholder||"",inputValue:c.promptDefault||""}),j===null))){{const O=$(c.target||this);c.toggleClass&&O.toggleClass(c.toggleClass),c.addClass&&O.addClass(c.addClass),c.removeClass&&O.removeClass(c.removeClass),j!==null&&(c.setText&&O.text(j),c.setVal&&O.val(j),c.setAttr&&O.attr(c.setAttr,j))}c.href&&ae(c.href),o&&E.toast(o,{type:c.toastType||"success"}),h&&E.alert(h)}});const{target:L,toggleClass:x,addClass:l,removeClass:v,setText:u,setVal:g,setAttr:w,href:z,toastType:B,promptPlaceholder:r,promptDefault:A,...q}=c,D={...n.events};Object.keys(q).length?D.click=L?{target:L,...q}:q:delete D.click;const N={...n,events:D};Object.keys(D).length||delete N.events,Object.keys(N).length&&(t[e]=N)}else t[e]=n}$.setup(t)}}a.length&&R(a.get(0))}),window.wireCTAButtons=R;function ae(m){if(!_e(m)){console.warn("[site] refused to go to",String(m).slice(0,60));return}const i=document.body?.classList.contains("dm-launcher-embed")&&window.top!==window;(i?window.top:window).location.href=m}function _e(m){const i=String(m??"").replace(/[\u0000-\u0020\u007f-\u00a0\u200b-\u200f\ufeff]/g,"").toLowerCase();return!i||i.includes("\\")||i.startsWith("//")?!1:/^(\/|#|\?|\.\.?\/)/.test(i)||/^(https?:\/\/|mailto:|tel:)/.test(i)?!0:!/^[a-z][a-z0-9+.-]*:/.test(i)}function R(m){m.querySelectorAll(".dm-cta-trigger").forEach(i=>{i.__ctaWired||(i.__ctaWired=!0,i.addEventListener("click",async()=>{const M=i.dataset.action,C=i.dataset.entry,I=i.dataset.confirm;let b=S.get("auth_token");if(!b){E.toast("Please log in to perform this action.",{type:"warning"});return}if(I&&!await E.confirm(I))return;const k=Array.from(i.childNodes).map(s=>s.cloneNode(!0));i.disabled=!0,i.textContent="Running\u2026";const a=s=>fetch(`/api/actions/${encodeURIComponent(M)}/public`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${s}`},body:JSON.stringify(i.dataset.scope?{entryId:C,scope:i.dataset.scope}:{entryId:C})});try{let s=await a(b);if(s.status===401){const e=S.get("auth_refresh_token");if(e){const n=await fetch("/api/auth/refresh",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:e})});if(n.ok){const{token:d}=await n.json();S.set("auth_token",d),b=d,s=await a(b)}}}const t=await s.json().catch(()=>({}));if(!s.ok||t.success===!1)throw new Error(t.error||t.message||`Error ${s.status}`);E.toast(t.message||"Action completed.",{type:"success"})}catch(s){E.toast(s.message||"Action failed.",{type:"error"})}finally{i.disabled=!1,i.textContent="",k.forEach(s=>i.appendChild(s)),Domma.icons.scan(i)}}))})}(function(){const i=document.querySelectorAll('.dm-collection-hydrate[data-collection-scope="mine"]');if(!i.length)return;const M=S.get("auth_token");function C(b,k){const a=document.createElement("div");a.className="dm-collection-display dm-collection-empty";const s=document.createElement("p");if(k){s.appendChild(document.createTextNode("Please "));const t=document.createElement("a");t.href="/login",t.textContent="sign in",s.appendChild(t),s.appendChild(document.createTextNode(" to view your entries."))}else s.textContent=b;return a.appendChild(s),a}function I(b,k){const a=document.createElement("template");a.innerHTML=k||"",b.replaceWith(a.content)}i.forEach(async b=>{const k=b.dataset.collectionAttrs;if(!k)return;if(!M){b.replaceChildren(C("",!0));return}const a=s=>fetch("/api/collections/render-scope",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${s}`},body:JSON.stringify({attrs:k})});try{let s=M,t=await a(s);if(t.status===401){const n=S.get("auth_refresh_token");if(n){const d=await fetch("/api/auth/refresh",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:n})});if(d.ok){const{token:p}=await d.json();S.set("auth_token",p),s=p,t=await a(s)}}}if(!t.ok){const{error:n}=await t.json().catch(()=>({}));b.replaceChildren(C(n||"Unable to load entries.",!1));return}const{html:e}=await t.json();I(b,e),window.DommaCollectionBrowser?.hydrate&&window.DommaCollectionBrowser.hydrate(document)}catch{b.replaceChildren(C("Unable to load entries.",!1))}}),setTimeout(()=>{typeof Domma<"u"&&Domma.icons?.scan&&Domma.icons.scan(),typeof Domma<"u"&&Domma.syntax?.scan&&Domma.syntax.scan(),R(document.body)},100)})(),(function(){const i=document.querySelectorAll("[data-collection-table]");!i.length||typeof T>"u"||!T.create||i.forEach(M=>{let C;try{C=V(M.dataset.payload)}catch{return}const{rows:I,search:b,sortable:k,exportable:a,pageSize:s,empty:t,ctaConfig:e,slug:n,exportCfg:d}=C;if(!Array.isArray(C.columns)||!C.columns.length)return;const p=c=>String(c??"").replace(/</g,"\u2039").replace(/>/g,"\u203A"),o=C.columns.map(c=>c&&typeof c=="object"?{key:p(c.key),title:p(c.title||c.key)}:{key:p(c),title:p(c)});if(e){const c=o.findIndex(y=>y.key==="_cta");c!==-1&&(o[c]={key:"_cta",title:"",render:(y,L)=>{const x=document.createElement("button");if(x.className=`btn btn-${e.style||"primary"} dm-cta-trigger`,x.dataset.action=e.action||"",e.scope&&(x.dataset.scope=e.scope),x.dataset.entry=L._entryId||"",e.confirm&&(x.dataset.confirm=e.confirm),e.icon){const l=document.createElement("span");l.dataset.icon=e.icon,x.appendChild(l),x.appendChild(document.createTextNode(" "))}return x.appendChild(document.createTextNode(e.label||"Run")),x}})}const h="col-table-"+Math.random().toString(36).slice(2,7),f=document.createElement("div");f.id=h,M.replaceChildren(f),T.create("#"+h,{data:I,columns:o,search:b,sortable:k,exportable:a,pageSize:s,emptyMessage:t}),e&&R(f),M._dmTable={columns:o,rows:I,slug:n,exportCfg:d,render(c){T.create("#"+h,{data:c,columns:o,search:b,sortable:k,exportable:a,pageSize:s,emptyMessage:t}),e&&R(f)}}})})(),(function(){const i=document.querySelectorAll("[data-form-inline]");if(!i.length||typeof F>"u")return;function M(a){const s=a&&a.logic;return!!(s&&(s.visibility||s.requirement))}function C(a,s){const t={};return(a||[]).forEach(e=>{if(e.type==="page-break"||e.type==="spacer"||!e.name)return;const n=e.type==="chooser"||!!(e.variant&&["select","radio","checkbox-group"].includes(e.type)),d=e.type==="checkbox"?"boolean":e.type==="date"||e.type==="icon"||e.type==="image"?"string":n?"chooser":e.type,p={...e.formConfig||{}};p.span==="full"&&s&&(p.span=s);const o={type:d,required:M(e)?!1:e.required,label:e.label,options:e.options,formConfig:{...e.placeholder&&{placeholder:e.placeholder},...e.helper&&{hint:e.helper},...e.tooltip&&{tooltip:e.tooltip},...p}};e.minLength!==void 0&&(o.minLength=e.minLength),e.maxLength!==void 0&&(o.maxLength=e.maxLength),e.min!==void 0&&(o.min=e.min),e.max!==void 0&&(o.max=e.max),n&&(e.variant&&(o.variant=e.variant),(e.multiple||e.type==="checkbox-group")&&(o.multiple=!0),e.density&&(o.density=e.density),e.columns&&(o.columns=e.columns),e.accent&&(o.accent=e.accent),e.accentStyle&&(o.accentStyle=e.accentStyle),e.glow&&(o.glow=!0),e.glowColour&&(o.glowColour=e.glowColour),e.shadow&&(o.shadow=e.shadow),e.shadowColour&&(o.shadowColour=e.shadowColour)),t[e.name]=e.type==="file"?xe(e,o):o}),t}function I(a){const s={};return(a||[]).forEach(t=>{if(!(!t.name||t.type==="page-break"||t.type==="spacer")&&(t.type==="select"||t.type==="multiselect")&&t.required){const e=(t.options||[])[0];e&&(s[t.name]=typeof e=="object"?e.value:e)}}),s}function b(a,s){(s||[]).forEach(t=>{if(t.type!=="date"||!t.name)return;const e=a.querySelector(`[name="${t.name}"]`);e&&e.type!=="date"&&(e.type="date")})}function k(a,s,t){let e=a.querySelector(".cms-form-message");e||(e=document.createElement("p"),e.className="cms-form-message",a.appendChild(e)),e.textContent=s,e.style.cssText=t?"color:var(--dm-danger);margin-top:.75rem;":"color:var(--dm-success);margin-top:.75rem;"}i.forEach(a=>{let s;try{s=V(a.dataset.formInline)}catch{return}a.querySelector(":scope > .cms-form-embed-summary")?.remove();const t=s.fields||[],e=s.settings||{},n=Number(e.columns)===3?3:2,d=e.layout||"grid",p=t.some(x=>x.type==="page-break"),o=new Map;Le(a,s.fileLimits,o),Te(a,t);const h=async x=>{if(a.dataset.triggerBlocked==="true"){const l=a._formLogicRuntime,v=l&&l.submitBlock?l.submitBlock().reasons:[];k(a,v.join(" ")||"This form cannot be submitted yet.",!0);const u=new Error("Blocked by a form trigger");throw u.formSubmitFailed=!0,u}try{const l=a.querySelector(".fb-form-honeypot"),v=l?.querySelector('input[type="text"]')||null,u=l?.querySelector('[name="_t"]')||null,g=Object.assign({},x);delete g._t,l?.dataset.hpName&&delete g[l.dataset.hpName],v!==null&&(g._hp=v.value),u!==null&&(g._t=u.value);const w=new Map(o);ne(a,w);const z=$e(g,t,w),B=Ae(a,z.files);if(B){k(a,B,!0);const A=new Error(B);throw A.formSubmitFailed=!0,A}const r=await H.post(`/api/forms/submit/${s.slug}`,z.files.size?Ee(z.values,z.files).body:z.values);if(r&&r.error){k(a,r.error,!0);const A=new Error(r.error);throw A.formSubmitFailed=!0,A}if(r?.redirect){ae(r.redirect);return}for(Ce(a);a.firstChild;)a.removeChild(a.firstChild);k(a,r?.message||e.successMessage||"Thank you for your submission.",!1)}catch(l){throw l.formSubmitFailed||k(a,l.message||"Submission failed. Please try again.",!0),l}},f=Date.now();function c(x){const l=x.querySelector("form");if(!l||l.querySelector(".fb-form-honeypot"))return;const v=document.createElement("div");v.className="fb-form-honeypot",v.setAttribute("aria-hidden","true");const u=document.createElement("input");u.name=l.querySelector('[name="website"]')?"_website":"website",v.dataset.hpName=u.name,u.type="text",u.tabIndex=-1,u.autocomplete="url",u.placeholder="https://",v.appendChild(u);const g=document.createElement("input");g.name="_t",g.type="hidden",g.value=f,v.appendChild(g),l.appendChild(v)}function y(x){if(!window.FormLogicEngine||!t.some(v=>v.logic||Array.isArray(v.triggers)&&v.triggers.length))return null;const l=new window.FormLogicEngine.FormLogicRuntime(s,a,x?{baseValues:x}:void 0);if(l.init(),a._formLogicRuntime=l,a._formLogicObserved)return l;if(a._formLogicObserved=!0,a.parentNode&&typeof MutationObserver<"u"){const v=new MutationObserver(function(u){for(const g of u)for(const w of g.removedNodes)if(w===a||w.nodeType===1&&w.contains&&w.contains(a)){a._formLogicRuntime&&a._formLogicRuntime.destroy(),v.disconnect();return}});v.observe(a.parentNode,{childList:!0,subtree:!1}),a._formLogicObserver=v}return l}let L=!1;if(a.addEventListener("dm-form-end",x=>{const l=x.detail?.validation;if(l&&!l.valid){Z(a,l.missing),ee(l);return}L||(L=!0,h(x.detail?.values||{}).catch(()=>{}).finally(()=>{L=!1}))}),p&&F.wizard){const x=ve(t,s.title),l=x.map(r=>({title:r.title,description:r.description,fields:C(r.fields,n)})),v=x.map(r=>r.fields);let u=0,g=null,w=null;const z=r=>{const A=window.FormLogicEngine;if(!A||!A.validateFields)return;const q=A.validateFields(a,v[u]||[]);q.valid||(r.preventDefault(),r.stopImmediatePropagation(),Z(a,q.missing),ee(q))},B=()=>{const r=v[u]||t;Se(a,e),te(a,e,r),oe(a,e),b(a,r),Q(a,r),ke(a,o),e.honeypot!==!1&&c(a),g&&g.destroy(),g=y(w?.getStepData?w.getStepData():void 0),a.querySelectorAll(".wizard-next, .wizard-submit").forEach(A=>A.addEventListener("click",z,!0))};w=F.wizard(a,{schema:{steps:l},layout:d,columns:n,finishText:e.submitText||"Finish",onSubmit:h,onStepChange:r=>{ne(a,o),u=r,setTimeout(B,0)}}),a.addEventListener("dm-form-trigger",r=>{if(r.detail?.type!=="goto-step"||!w?.goToStep)return;const A=Number(r.detail.action.step);!Number.isFinite(A)||A<0||A>=l.length||A!==u&&w.goToStep(A)}),Promise.resolve(w).then(B)}else if(F.render){const x=F.render(a,C(t,n),I(t),{submitText:e.submitText||"Submit",layout:d,columns:n,onSubmit:h});Promise.resolve(x).then(function(){we(a,e,d),te(a,e,t),oe(a,e),b(a,t),Q(a,t),e.honeypot!==!1&&c(a),y()})}})})();function qe(m,i){const M=document.body,C=M.classList,I=new Set((M.dataset.railSite||"").split(" ").filter(Boolean)),b=()=>window.matchMedia("(min-width: 993px)").matches;m.querySelectorAll(".navbar-link, .navbar-dropdown-toggle").forEach(n=>{const d=n.textContent.trim();d&&(n.setAttribute("title",d),n.querySelector("svg, [data-icon]")||(n.dataset.initial=d.charAt(0).toUpperCase()))});const k=document.createElement("button");k.type="button",k.className="dm-nav-collapse-toggle";const a=()=>{const n=C.contains("dm-vnav-collapsed");k.setAttribute("aria-pressed",String(n)),k.setAttribute("aria-label",n?"Expand menu":"Collapse menu"),k.title=k.getAttribute("aria-label");const d=i?"chevrons-left":"chevrons-right",p=i?"chevrons-right":"chevrons-left";k.innerHTML=`<span data-icon="${n?d:p}"></span>`,window.Domma&&Domma.icons&&Domma.icons.scan(k)},s=n=>{C.toggle("dm-vnav-collapsed",n),S.set("nav_collapsed",n),a()};k.addEventListener("click",()=>s(!C.contains("dm-vnav-collapsed"))),a();const t=m.querySelector(".navbar-container")||m;t.insertBefore(k,t.firstChild?.nextSibling||null);const e=n=>{C.toggle("dm-vnav-autohide",n),C.toggle("dm-vnav-collapsible",!n&&I.has("collapsible")),n?C.remove("dm-vnav-collapsed"):I.has("collapsible")&&S.get("nav_collapsed")===!0&&C.add("dm-vnav-collapsed"),m.classList.remove("dm-nav-revealed"),a()};m.addEventListener("pointerdown",n=>{C.contains("dm-vnav-autohide")&&n.pointerType!=="mouse"&&!m.classList.contains("dm-nav-revealed")&&(m.classList.add("dm-nav-revealed"),n.preventDefault())}),document.addEventListener("pointerdown",n=>{m.contains(n.target)||m.classList.remove("dm-nav-revealed")}),window.E&&typeof E.contextMenu=="function"&&E.contextMenu(m,{items:()=>{const n=C.contains("dm-vnav-autohide"),d=C.contains("dm-vnav-collapsed"),p=S.has("nav_autohide")||S.has("nav_collapsed");return[{header:"Menu"},{label:d?"Expand menu":"Collapse to icons",icon:d?"maximize":"minimize",disabled:!b()||n||!I.has("collapsible"),action:()=>s(!d)},{label:n?"Keep on screen":"Hide when not in use",icon:n?"eye":"eye-off",disabled:!b(),action:()=>{S.set("nav_autohide",!n),e(!n)}},{type:"divider"},{label:"Reset to the site's setting",icon:"refresh",disabled:!p,action:()=>{S.remove("nav_autohide"),S.remove("nav_collapsed"),e(I.has("autohide")),C.toggle("dm-vnav-collapsed",!I.has("autohide")&&I.has("start-collapsed")),a()}}]}})}function Me(m){m.classList.add("dm-nav-scroll-hide");let i=window.scrollY,M=!1;window.addEventListener("scroll",()=>{M||(M=!0,requestAnimationFrame(()=>{M=!1;const C=window.scrollY,I=m.matches(":focus-within")||m.querySelector(".navbar-dropdown.open, .navbar-collapse.show");C>i&&C>m.offsetHeight&&!I?m.classList.add("dm-nav-scrolled-away"):C<i&&m.classList.remove("dm-nav-scrolled-away"),i=C}))},{passive:!0})}function De(m){let i={};try{i=JSON.parse(m.dataset.contents||"{}")}catch{}const M=m.closest(".site-main"),C=document.querySelector(".site-content"),I=new Set(String(i.exclude||"").split(",").map(o=>o.trim().toLowerCase()).filter(Boolean)),b=o=>!o.closest(".hero, .card, .accordion, .tabs, figure, #site-sidebar"),k=o=>(C?[...C.querySelectorAll(o)]:[]).filter(b).filter(h=>!I.has(h.textContent.trim().toLowerCase())),a=i.headings==="h2"?k("h2"):i.headings==="h3"?k("h3"):i.headings==="h2h3"?k("h2, h3"):k("h2").length?k("h2"):k("h3");if(!a.length){M?.classList.add("no-sidebar-items");return}const s=new Set([...document.querySelectorAll("[id]")].map(o=>o.id)),t=document.createElement("nav");t.className="dm-contents",t.setAttribute("aria-label",i.title||"Page contents"),i.hover&&(t.dataset.menuHover=i.hover),i.selected&&(t.dataset.menuActive=i.selected),i.accent&&t.style.setProperty("--dm-menu-highlight",i.accent.startsWith("#")?i.accent:`var(--dm-${i.accent})`),i.font&&(t.style.fontFamily=i.font),i.fontSize&&(t.style.fontSize=i.fontSize),i.fontWeight&&(t.style.fontWeight=i.fontWeight);const e=document.createElement("div");e.className="dm-contents-head";const n=document.createElement("p");n.className="dm-contents-title",n.textContent=i.title||"",e.appendChild(n),t.appendChild(e);const d=document.createElement("ol");d.className="dm-contents-list"+(i.numbered?" is-numbered":"");const p=[];for(const o of a){if(!o.id){const c=(o.textContent||"").toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"section";let y=c;for(let L=2;s.has(y);L++)y=`${c}-${L}`;s.add(y),o.id=y}const h=document.createElement("li");h.className=`dm-contents-item dm-contents-${o.tagName.toLowerCase()}`;const f=document.createElement("a");f.href=`#${o.id}`,f.textContent=o.textContent.trim(),h.appendChild(f),d.appendChild(h),p.push([o,f])}if(t.appendChild(d),m.replaceChildren(t),i.scrollSpy!==!1&&"IntersectionObserver"in window){const o=new Map,h=()=>{const c=p.find(([y])=>o.get(y))||null;p.forEach(([,y])=>{const L=c&&y===c[1];y.classList.toggle("is-active",!!L),L?y.setAttribute("aria-current","location"):y.removeAttribute("aria-current")})},f=new IntersectionObserver(c=>{c.forEach(y=>o.set(y.target,y.isIntersecting)),h()},{rootMargin:"-80px 0px -60% 0px"});p.forEach(([c])=>f.observe(c))}if(M?.classList.contains("contents-collapsible")){const o=document.createElement("button");o.type="button",o.className="dm-contents-toggle";const h=()=>{const f=M.classList.contains("contents-collapsed");o.setAttribute("aria-expanded",String(!f)),o.setAttribute("aria-label",f?"Show the contents":"Hide the contents"),o.title=o.getAttribute("aria-label"),o.innerHTML=`<span data-icon="${f?"list":"x"}"></span>`,window.Domma?.icons&&Domma.icons.scan(o)};o.addEventListener("click",()=>{S.set("contents_collapsed",M.classList.toggle("contents-collapsed")),h()}),h(),e.insertBefore(o,e.firstChild)}if(M?.classList.contains("contents-floating")&&i.movable){t.classList.add("is-movable");const o=S.get("contents_position");o&&Number.isFinite(o.x)&&Object.assign(m.style,{left:`${o.x}px`,top:`${o.y}px`,right:"auto",bottom:"auto"}),e.addEventListener("pointerdown",h=>{if(h.target.closest("button"))return;const f=m.getBoundingClientRect(),c=h.clientX-f.left,y=h.clientY-f.top,L=l=>{const v=Math.max(0,Math.min(window.innerWidth-f.width,l.clientX-c)),u=Math.max(0,Math.min(window.innerHeight-40,l.clientY-y));Object.assign(m.style,{left:`${v}px`,top:`${u}px`,right:"auto",bottom:"auto"})},x=()=>{document.removeEventListener("pointermove",L),S.set("contents_position",{x:parseInt(m.style.left,10),y:parseInt(m.style.top,10)})};document.addEventListener("pointermove",L),document.addEventListener("pointerup",x,{once:!0})})}window.E&&typeof E.contextMenu=="function"&&E.contextMenu(m,{items:()=>{const o=M?.classList.contains("contents-collapsible"),h=M?.classList.contains("contents-collapsed"),f=p.find(([,c])=>c.classList.contains("is-active"));return[{header:"Contents"},...o?[{label:h?"Show the contents":"Collapse to a button",icon:h?"list":"minimize",action:()=>m.querySelector(".dm-contents-toggle")?.click()}]:[],{label:"Copy a link to this section",icon:"link",disabled:!f,action:async()=>{const c=`${location.origin}${location.pathname}#${f[0].id}`;try{await _.copyToClipboard(c),E.toast("Link copied.",{type:"success"})}catch{E.toast("Could not copy the link.",{type:"error"})}}},{label:"Back to the top",icon:"arrow-up",action:()=>window.scrollTo({top:0,behavior:"smooth"})}]}}),M?.classList.contains("contents-autohide")&&(m.addEventListener("pointerdown",o=>{o.pointerType!=="mouse"&&!m.classList.contains("is-revealed")&&(m.classList.add("is-revealed"),o.preventDefault())}),document.addEventListener("pointerdown",o=>{m.contains(o.target)||m.classList.remove("is-revealed")}))}
|
package/server/routes/favicon.js
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* Read per request, so a new logo or title shows without a restart.
|
|
10
10
|
*/
|
|
11
11
|
import {getConfig} from '../config.js';
|
|
12
|
+
import {inkOn, savedBrand} from '../services/brandKit.js';
|
|
12
13
|
|
|
13
14
|
/** A same-site path or an https URL - never a scheme that could run anything. */
|
|
14
15
|
// A backslash is refused anywhere: browsers read /\evil.com as //evil.com.
|
|
@@ -20,12 +21,13 @@ const SAFE_LOGO = /^(\/(?![/\\])[^\s"'<>\\]*|https:\/\/[^\s"'<>\\]+)$/i;
|
|
|
20
21
|
* @param {string} title - the site's name
|
|
21
22
|
* @returns {string} SVG
|
|
22
23
|
*/
|
|
23
|
-
export function letterIcon(title = '') {
|
|
24
|
+
export function letterIcon(title = '', colour = '#4f46e5') {
|
|
24
25
|
const ch = (String(title).match(/[\p{L}\p{N}]/u) || ['D'])[0].toUpperCase();
|
|
26
|
+
const fill = /^#[\da-f]{6}$/i.test(colour) ? colour : '#4f46e5';
|
|
25
27
|
const esc = ch.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
|
26
28
|
return '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">'
|
|
27
|
-
+
|
|
28
|
-
+ `<text x="32" y="44" text-anchor="middle" font-family="system-ui,-apple-system,Segoe UI,Roboto,sans-serif" font-size="36" font-weight="700" fill="
|
|
29
|
+
+ `<rect width="64" height="64" rx="14" fill="${fill}"/>`
|
|
30
|
+
+ `<text x="32" y="44" text-anchor="middle" font-family="system-ui,-apple-system,Segoe UI,Roboto,sans-serif" font-size="36" font-weight="700" fill="${inkOn(fill)}">${esc}</text>`
|
|
29
31
|
+ '</svg>';
|
|
30
32
|
}
|
|
31
33
|
|
|
@@ -36,12 +38,14 @@ export function letterIcon(title = '') {
|
|
|
36
38
|
* @returns {{redirect: string}|{svg: string}}
|
|
37
39
|
*/
|
|
38
40
|
export function faviconFor(site = {}) {
|
|
39
|
-
// site.json `favicon` (a Settings key) first, then the brand logo
|
|
40
|
-
|
|
41
|
+
// site.json `favicon` (a Settings key) first, then the brand logo, then a saved Brand Kit's
|
|
42
|
+
// square mark and logo; the letter icon takes the Kit's name and accent colour.
|
|
43
|
+
const kit = savedBrand(site || {});
|
|
44
|
+
for (const v of [site?.favicon, site?.brand?.logo, kit?.mark, kit?.logo]) {
|
|
41
45
|
const url = typeof v === 'string' ? v.trim() : '';
|
|
42
46
|
if (url && SAFE_LOGO.test(url)) return {redirect: url};
|
|
43
47
|
}
|
|
44
|
-
return {svg: letterIcon(site?.title || site?.brand?.text || '')};
|
|
48
|
+
return {svg: letterIcon(site?.title || site?.brand?.text || kit?.name || '', kit?.accent || undefined)};
|
|
45
49
|
}
|
|
46
50
|
|
|
47
51
|
export async function faviconRoutes(fastify) {
|
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
* @module server/services/adminBrand
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
+
import {savedBrand} from './brandKit.js';
|
|
15
|
+
|
|
14
16
|
/** The fallback when a site has neither an admin name nor a title. */
|
|
15
17
|
export const DEFAULT_ADMIN_TITLE = 'Domma CMS';
|
|
16
18
|
|
|
@@ -22,11 +24,14 @@ export function adminBrandFor(site = {}) {
|
|
|
22
24
|
const own = site?.adminBrand && typeof site.adminBrand === 'object' ? site.adminBrand : {};
|
|
23
25
|
// Whitespace collapsed: a title reads back that way from the browser tab.
|
|
24
26
|
const str = (v) => (typeof v === 'string' ? v.replace(/[ \t\n\f\r]+/g, ' ').trim() : '');
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
+
// A saved Brand Kit fills what is left empty: its logos (the dark one only beside its own logo).
|
|
28
|
+
const kit = savedBrand(site || {});
|
|
29
|
+
const ownLogo = str(own.logo);
|
|
30
|
+
const logo = ownLogo || str(kit?.logo);
|
|
31
|
+
const logoDark = str(own.logoDark) || (ownLogo ? '' : str(kit?.logoDark));
|
|
27
32
|
return {
|
|
28
33
|
enabled: own.enabled !== false,
|
|
29
|
-
title: (str(own.title) || str(site?.title) || DEFAULT_ADMIN_TITLE).slice(0, 120),
|
|
34
|
+
title: (str(own.title) || str(kit?.name) || str(site?.title) || DEFAULT_ADMIN_TITLE).slice(0, 120),
|
|
30
35
|
// Same rule as the sidebar header: a site path or an http(s) address, nothing else.
|
|
31
36
|
logo: /^(?:\/(?!\/)|https?:\/\/)/i.test(logo) ? logo : '',
|
|
32
37
|
// Optional: the logo for a dark admin theme (lib/theme-aware-logo.js picks one by the theme's background).
|
|
@@ -8,6 +8,12 @@
|
|
|
8
8
|
* address, `baseUrl`), so a site looks the same until its owner fills the Kit in.
|
|
9
9
|
*
|
|
10
10
|
* The Kit never changes the theme (Darryl, 2026-11-19): its colours are the brand's, not tokens.
|
|
11
|
+
*
|
|
12
|
+
* Website and sign-in defaults (phase 3): once a site has SAVED its Kit (`savedBrand()`), the Kit
|
|
13
|
+
* fills what the site's own settings leave empty - the favicon (routes/favicon.js), a completely
|
|
14
|
+
* blank navbar brand (`navBrand()`, renderer.js), the admin name and logos (adminBrand.js), a chat
|
|
15
|
+
* launcher's accent and avatar (`chatBrandDefaults()`) and og:site_name. A site that never saved a
|
|
16
|
+
* Kit renders exactly as before.
|
|
11
17
|
* Plan: docs/plans/2026-11-19-brand-kit-design.md.
|
|
12
18
|
*
|
|
13
19
|
* @module services/brandKit
|
|
@@ -242,6 +248,60 @@ export function kitFont(id) {
|
|
|
242
248
|
return KIT_FONTS[id] || KIT_FONTS[''];
|
|
243
249
|
}
|
|
244
250
|
|
|
251
|
+
/**
|
|
252
|
+
* The Kit's OWN fields, to use as DEFAULTS for the site's other settings: the cleaned Kit once it
|
|
253
|
+
* has been saved, else null - so a site that never saved one looks exactly as it did. Unlike
|
|
254
|
+
* siteBrand() nothing here falls back to the site's other settings (they are what it fills in for).
|
|
255
|
+
*
|
|
256
|
+
* @returns {{name, legalName, shortName, logo, logoDark, mark, accent, colours, fonts, contact, ...}|null}
|
|
257
|
+
*/
|
|
258
|
+
export function savedBrand(site = {}) {
|
|
259
|
+
const raw = site?.brandKit && typeof site.brandKit === 'object' ? site.brandKit : null;
|
|
260
|
+
if (!raw?.updatedAt) return null;
|
|
261
|
+
try { return normaliseBrandKit(raw, {now: () => raw.updatedAt}); } catch { return null; }
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/** Black or white, whichever reads on a colour. */
|
|
265
|
+
export function inkOn(hex) {
|
|
266
|
+
if (!HEX.test(String(hex || ''))) return '#ffffff';
|
|
267
|
+
const [r, g, b] = [1, 3, 5].map(i => parseInt(hex.slice(i, i + 2), 16) / 255)
|
|
268
|
+
.map(c => (c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4));
|
|
269
|
+
return 0.2126 * r + 0.7152 * g + 0.0722 * b > 0.4 ? '#111111' : '#ffffff';
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* The public navbar's brand (`site.brand`): the site's own, untouched, unless it is completely
|
|
274
|
+
* blank (no text, logo or icon) - then the saved Kit's logo (a full logo carries the name, so it
|
|
275
|
+
* stands alone; its name is the image's alt text), else its name.
|
|
276
|
+
*/
|
|
277
|
+
export function navBrand(site = {}) {
|
|
278
|
+
const own = site.brand && typeof site.brand === 'object' && !Array.isArray(site.brand) ? site.brand : {};
|
|
279
|
+
if (own.text || own.logo || own.icon) return own;
|
|
280
|
+
const b = savedBrand(site);
|
|
281
|
+
if (!b) return own;
|
|
282
|
+
if (b.logo) return {...own, logo: b.logo, ...(b.name ? {alt: b.name} : {})};
|
|
283
|
+
return b.name ? {...own, text: b.name} : own;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* A chat launcher's look (normaliseLauncherChat + characterChat), with the saved Kit's accent (and
|
|
288
|
+
* black or white text on it) and square mark as the bot's picture where the launcher sets none.
|
|
289
|
+
* A character keeps its own art, so no mark is put in for one.
|
|
290
|
+
*/
|
|
291
|
+
export function chatBrandDefaults(chat, site = {}) {
|
|
292
|
+
if (!chat || typeof chat !== 'object') return chat;
|
|
293
|
+
const b = savedBrand(site);
|
|
294
|
+
if (!b) return chat;
|
|
295
|
+
const out = {...chat};
|
|
296
|
+
if (!out.accent && b.accent) {
|
|
297
|
+
out.accent = b.accent;
|
|
298
|
+
if (!out.accentText) out.accentText = inkOn(b.accent);
|
|
299
|
+
}
|
|
300
|
+
// The launcher's own rule: a picture on this site only.
|
|
301
|
+
if (!out.avatar && !out.character && /^\/[A-Za-z0-9._~\-/%]+$/.test(b.mark || '')) out.avatar = b.mark;
|
|
302
|
+
return out;
|
|
303
|
+
}
|
|
304
|
+
|
|
245
305
|
/** What anyone may read (`GET /api/brand-kit`): the brand as the site presents it, absolute addresses. */
|
|
246
306
|
export function publicBrandKit(site = {}) {
|
|
247
307
|
const b = siteBrand(site);
|
|
@@ -254,7 +314,9 @@ export function publicBrandKit(site = {}) {
|
|
|
254
314
|
accent: b.accent, colours: b.colours,
|
|
255
315
|
fonts: {heading: font(b.fonts.heading), body: font(b.fonts.body)},
|
|
256
316
|
contact: b.contact, social: b.social,
|
|
257
|
-
footerLine: b.footerLine, smallPrint: b.smallPrint, legalLine: legalLine(b)
|
|
317
|
+
footerLine: b.footerLine, smallPrint: b.smallPrint, legalLine: legalLine(b),
|
|
318
|
+
// Whether the owner has saved a Kit (the Theme Roller offers "New theme from Brand Kit" then).
|
|
319
|
+
saved: Boolean(b.updatedAt)
|
|
258
320
|
};
|
|
259
321
|
}
|
|
260
322
|
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
import {normaliseLauncherChat} from './settings.js';
|
|
15
15
|
import {getConfig} from '../../config.js';
|
|
16
16
|
import {characterChat} from '../../../public/js/characters.mjs';
|
|
17
|
+
import {chatBrandDefaults} from '../brandKit.js';
|
|
17
18
|
|
|
18
19
|
let loader = () => import('../launchers.js');
|
|
19
20
|
|
|
@@ -57,7 +58,7 @@ export async function chatLauncher(id) {
|
|
|
57
58
|
if (list === null) return null;
|
|
58
59
|
const found = list.find(l => l && String(l.id) === id);
|
|
59
60
|
return found ? {id, place: found.place === 'admin' ? 'admin' : found.place === 'both' ? 'both' : 'site',
|
|
60
|
-
chat: characterChat(normaliseLauncherChat(found.chat), getConfig('site').characters)} : null;
|
|
61
|
+
chat: chatBrandDefaults(characterChat(normaliseLauncherChat(found.chat), getConfig('site').characters), getConfig('site'))} : null;
|
|
61
62
|
}
|
|
62
63
|
|
|
63
64
|
/**
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
import {getConfig, saveConfig} from '../config.js';
|
|
18
18
|
import {characterChat} from '../../public/js/characters.mjs';
|
|
19
|
+
import {chatBrandDefaults} from './brandKit.js';
|
|
19
20
|
import * as cache from './cache/index.js';
|
|
20
21
|
import {isToolEnabled} from './tools.js';
|
|
21
22
|
import {
|
|
@@ -105,7 +106,10 @@ export function launchersForPage(urlPath, user) {
|
|
|
105
106
|
/** A launcher as the browser gets it, the chat with its character applied. */
|
|
106
107
|
function pageLauncher(l) {
|
|
107
108
|
const out = publicLauncher(l);
|
|
108
|
-
if (out.chat)
|
|
109
|
+
if (out.chat) {
|
|
110
|
+
const site = getConfig('site');
|
|
111
|
+
out.chat = chatBrandDefaults(characterChat(out.chat, site.characters), site);
|
|
112
|
+
}
|
|
109
113
|
return out;
|
|
110
114
|
}
|
|
111
115
|
|
|
@@ -7,6 +7,7 @@ import fs from 'fs/promises';
|
|
|
7
7
|
import path from 'path';
|
|
8
8
|
import {fileURLToPath} from 'url';
|
|
9
9
|
import {getConfig} from '../config.js';
|
|
10
|
+
import {navBrand, savedBrand} from './brandKit.js';
|
|
10
11
|
import {getInjectionSnippets} from './plugins.js';
|
|
11
12
|
import {applyTransforms} from './hooks.js';
|
|
12
13
|
import {contentsPaint, readContentsOverride, resolveContents} from './pageContents.js';
|
|
@@ -459,7 +460,7 @@ export async function renderPage(page, opts = {}) {
|
|
|
459
460
|
// navigation.json.bak file so a restored backup keeps working.
|
|
460
461
|
const navigation = navMenu
|
|
461
462
|
? {
|
|
462
|
-
brand: site
|
|
463
|
+
brand: navBrand(site),
|
|
463
464
|
items: navItemsDecorated,
|
|
464
465
|
variant: navMenu.variant || 'default',
|
|
465
466
|
position: navMenu.position || 'sticky',
|
|
@@ -488,7 +489,7 @@ export async function renderPage(page, opts = {}) {
|
|
|
488
489
|
...(navMenu.class && {class: navMenu.class}),
|
|
489
490
|
...(navMenu.style && {style: navMenu.style})
|
|
490
491
|
}
|
|
491
|
-
: (await readLegacyNavBackup()) || {brand: site
|
|
492
|
+
: (await readLegacyNavBackup()) || {brand: navBrand(site), items: []};
|
|
492
493
|
|
|
493
494
|
// Inside a launcher's panel the layout is the body alone, whatever the page asks for.
|
|
494
495
|
const preset = embed
|
|
@@ -855,7 +856,8 @@ function buildSeoMeta({page, site, baseUrl, title, description, image}) {
|
|
|
855
856
|
ogType: page.seo?.ogType || 'article',
|
|
856
857
|
noindex: page.seo?.noindex === true,
|
|
857
858
|
canonical,
|
|
858
|
-
|
|
859
|
+
// A saved Brand Kit's name is the business's; else the site title as before.
|
|
860
|
+
siteName: savedBrand(site)?.name || site.title || '',
|
|
859
861
|
twitterSite: site.social?.twitter || '',
|
|
860
862
|
og: {},
|
|
861
863
|
twitter: {},
|
|
@@ -1309,7 +1311,7 @@ export async function renderBlogPage(templatePath, data = {}, seoMeta = {}) {
|
|
|
1309
1311
|
// navigation.json.bak file so a restored backup keeps working.
|
|
1310
1312
|
const navigation = navMenu
|
|
1311
1313
|
? {
|
|
1312
|
-
brand: site
|
|
1314
|
+
brand: navBrand(site),
|
|
1313
1315
|
items: navItemsDecorated,
|
|
1314
1316
|
variant: navMenu.variant || 'default',
|
|
1315
1317
|
position: navMenu.position || 'sticky',
|
|
@@ -1335,7 +1337,7 @@ export async function renderBlogPage(templatePath, data = {}, seoMeta = {}) {
|
|
|
1335
1337
|
...(navMenu.class && {class: navMenu.class}),
|
|
1336
1338
|
...(navMenu.style && {style: navMenu.style})
|
|
1337
1339
|
}
|
|
1338
|
-
: (await readLegacyNavBackup()) || {brand: site
|
|
1340
|
+
: (await readLegacyNavBackup()) || {brand: navBrand(site), items: []};
|
|
1339
1341
|
|
|
1340
1342
|
// Replace {{key}} tokens in the plugin fragment with data values
|
|
1341
1343
|
const renderedFragment = fragment.replace(/\{\{(\w+)\}\}/g, (_, key) => {
|
|
@@ -189,7 +189,7 @@
|
|
|
189
189
|
<script src="/public/js/form-logic-engine.js?v=20261031-forms-reduce-motion" defer></script>
|
|
190
190
|
|
|
191
191
|
<!-- Site initialisation -->
|
|
192
|
-
<script src="/public/js/site.js?v=
|
|
192
|
+
<script src="/public/js/site.js?v=20261120-brand-kit-logo" type="module"></script>
|
|
193
193
|
<script src="/public/js/collection-context.js?v=20261010-utf8-payloads" type="module"></script>
|
|
194
194
|
{{ctxMenusModule}}
|
|
195
195
|
<!-- [image zoom] pictures' full-size view - only on a page that has one -->
|