This commit is contained in:
deploy-bot committed 2026-12-04 18:41:33 +00:00
commit 1396974b03
286 files changed
+19411

No files matched your search

+81
View File
@@ -0,0 +1,81 @@
/*
* A plain stylesheet for the blocks of a page, the same for the Blade views and the Vue components. Everything hangs on CSS
* variables, so a site sets its own look by overriding them (`:root { --mb-accent: #c2410c; }`) or replaces the file.
* Classes: `.mb-block` on every block, `.mb-<type>`, and one `mb--<option>-<choice>` per style option (`mb--background-dark`).
*/
:root {
--mb-text: #1f2937;
--mb-muted: #6b7280;
--mb-bg: #ffffff;
--mb-bg-light: #f3f4f6;
--mb-bg-dark: #111827;
--mb-bg-brand: #1d4ed8;
--mb-accent: #1d4ed8;
--mb-radius: 0.5rem;
--mb-width: 64rem;
--mb-wide: 80rem;
--mb-space: 3rem;
}
.mb-block { color: var(--mb-text); background: var(--mb-bg); padding: var(--mb-space) 1rem; box-sizing: border-box; }
.mb-block *, .mb-block *::before, .mb-block *::after { box-sizing: border-box; }
.mb-inner { max-width: var(--mb-width); margin: 0 auto; }
.mb--width-wide .mb-inner { max-width: var(--mb-wide); }
.mb--width-full .mb-inner { max-width: none; }
.mb--background-light { background: var(--mb-bg-light); }
.mb--background-dark { background: var(--mb-bg-dark); color: #f9fafb; }
.mb--background-brand { background: var(--mb-bg-brand); color: #ffffff; }
.mb--align-center { text-align: center; }
.mb--spacing-s { padding-block: 1rem; }
.mb--spacing-l { padding-block: 6rem; }
.mb-block h1, .mb-block h2, .mb-block h3 { line-height: 1.2; margin: 0 0 0.75rem; }
.mb-eyebrow { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.8rem; color: var(--mb-muted); margin: 0 0 0.5rem; }
.mb-lead { font-size: 1.15rem; }
.mb-prose > :first-child { margin-top: 0; }
.mb-prose > :last-child { margin-bottom: 0; }
.mb-prose img { max-width: 100%; height: auto; }
.mb-hero { background: var(--mb-bg-dark) var(--mb-hero-image, none) center / cover no-repeat; color: #fff; padding-block: 6rem; }
.mb-hero.mb--height-tall { padding-block: 10rem; }
.mb-buttons { display: flex; gap: 0.75rem; flex-wrap: wrap; margin: 1.25rem 0 0; }
.mb-btn { display: inline-block; padding: 0.7rem 1.25rem; border-radius: var(--mb-radius); font-weight: 600; text-decoration: none; border: 2px solid var(--mb-accent); }
.mb-btn--primary { background: var(--mb-accent); color: #fff; }
.mb-btn--secondary { background: transparent; color: inherit; border-color: currentColor; }
.mb-split { display: grid; gap: 2rem; align-items: center; }
@media (min-width: 48rem) { .mb-split { grid-template-columns: 1fr 1fr; } .mb--side-left .mb-media { order: -1; } }
.mb-media { margin: 0; }
.mb-media img, .mb-image img, .mb-before-after img { width: 100%; height: auto; border-radius: var(--mb-radius); display: block; }
.mb-image figure, .mb-image .mb-inner { margin: 0 auto; }
.mb-block figcaption { font-size: 0.85rem; color: var(--mb-muted); margin-top: 0.4rem; }
.mb-points { padding-left: 1.2rem; }
.mb-points-box .mb-inner { background: var(--mb-bg-light); border-radius: var(--mb-radius); padding: 1.5rem; }
.mb-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.mb--columns-2 .mb-grid { grid-template-columns: repeat(2, 1fr); }
.mb--columns-3 .mb-grid { grid-template-columns: repeat(3, 1fr); }
.mb--columns-4 .mb-grid { grid-template-columns: repeat(4, 1fr); }
.mb-gallery img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--mb-radius); aspect-ratio: 4 / 3; }
.mb-card { background: var(--mb-bg-light); border-radius: var(--mb-radius); overflow: hidden; }
.mb-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.mb-card h3, .mb-card p { margin: 0.75rem 1rem; }
.mb-card a { color: inherit; text-decoration: none; }
.mb--layout-list .mb-grid { grid-template-columns: 1fr; }
.mb-quote blockquote { margin: 0 auto; font-size: 1.25rem; }
.mb-quote footer { font-size: 0.9rem; color: var(--mb-muted); margin-top: 0.75rem; }
.mb-stats dl, .mb-stats dd, .mb-stats dt { margin: 0; }
.mb-stats dd { font-size: 2rem; font-weight: 700; }
.mb-chips ul { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0; }
.mb-chips li { background: var(--mb-bg-light); border-radius: 999px; padding: 0.25rem 0.8rem; font-size: 0.9rem; }
.mb-faq details { border-bottom: 1px solid var(--mb-bg-light); padding: 0.75rem 0; }
.mb-faq summary { cursor: pointer; font-weight: 600; }
.mb-cta { text-align: center; }
.mb-cta .mb-buttons { justify-content: center; }
.mb-form label { display: block; margin: 0.75rem 0; font-weight: 600; }
.mb-form input:not([type='hidden']), .mb-form textarea { display: block; width: 100%; margin-top: 0.25rem; padding: 0.6rem; border: 1px solid #d1d5db; border-radius: var(--mb-radius); font: inherit; }
.mb-form .mb-hp { position: absolute; left: -10000px; width: 1px; height: 1px; opacity: 0; }
.mb-divider { border: 0; border-top: 1px solid var(--mb-bg-light); margin: 0 auto; max-width: var(--mb-width); padding: 0; }
.mb-spacer { padding-block: 1.5rem; }
.mb-spacer.mb--spacing-s { padding-block: 0.5rem; }
.mb-spacer.mb--spacing-l { padding-block: 3rem; }
+20
View File
@@ -0,0 +1,20 @@
<script setup lang="ts">
import { classes, safeUrl } from './support';
defineProps<{ data: Record<string, any>; style?: Record<string, string> }>();
</script>
<template>
<section :class="['mb-block mb-before-after', classes(style)]">
<div class="mb-inner mb-split">
<figure>
<img :src="safeUrl(data.before)" alt="Before" loading="lazy" />
<figcaption>Before</figcaption>
</figure>
<figure>
<img :src="safeUrl(data.after)" alt="After" loading="lazy" />
<figcaption>After</figcaption>
</figure>
</div>
</section>
</template>
+16
View File
@@ -0,0 +1,16 @@
<script setup lang="ts">
import { computed, type Component } from 'vue';
import { blockComponents } from './components';
import type { Block } from './support';
// Draws the blocks of a page (`Blocks::for()` as a prop): one component per type. `components` replaces or adds a type of the site;
// a type without a component draws nothing.
const props = defineProps<{ blocks: Block[]; components?: Record<string, Component> }>();
const map = computed(() => ({ ...blockComponents, ...(props.components ?? {}) }));
</script>
<template>
<template v-for="block in blocks" :key="block.id">
<component :is="map[block.type]" v-if="map[block.type]" :data="block.data" :style="block.style" :items="block.items" />
</template>
</template>
+13
View File
@@ -0,0 +1,13 @@
<script setup lang="ts">
import { safeUrl } from './support';
defineProps<{ buttons?: { label?: string; url?: string; style?: string }[] }>();
</script>
<template>
<p v-if="buttons && buttons.length" class="mb-buttons">
<template v-for="(button, index) in buttons" :key="index">
<a v-if="button.label" :class="['mb-btn', button.style === 'secondary' ? 'mb-btn--secondary' : 'mb-btn--primary']" :href="safeUrl(button.url)">{{ button.label }}</a>
</template>
</p>
</template>
+27
View File
@@ -0,0 +1,27 @@
<script setup lang="ts">
import Buttons from './Buttons.vue';
import { classes, pick, safeUrl, type Item } from './support';
// A record is shown under the usual names: title or name, summary / story / quote / intro / role, photo / picture / image, url / link.
defineProps<{ data: Record<string, any>; style?: Record<string, string>; items?: Item[] }>();
</script>
<template>
<section :class="['mb-block mb-cards', classes(style)]">
<div class="mb-inner">
<p v-if="data.eyebrow" class="mb-eyebrow">{{ data.eyebrow }}</p>
<h2 v-if="data.title">{{ data.title }}</h2>
<div class="mb-grid">
<article v-for="(item, index) in items || []" :key="item.id ?? index" class="mb-card">
<img v-if="pick(item, ['photo', 'picture', 'image'])" :src="safeUrl(pick(item, ['photo', 'picture', 'image']))" alt="" loading="lazy" />
<h3>
<a v-if="pick(item, ['url', 'link'])" :href="safeUrl(pick(item, ['url', 'link']))">{{ pick(item, ['title', 'name', 'label']) }}</a>
<template v-else>{{ pick(item, ['title', 'name', 'label']) }}</template>
</h3>
<p v-if="pick(item, ['summary', 'story', 'quote', 'intro', 'role'])">{{ pick(item, ['summary', 'story', 'quote', 'intro', 'role']) }}</p>
</article>
</div>
<Buttons v-if="data.button_label" :buttons="[{ label: data.button_label, url: data.button_url, style: 'secondary' }]" />
</div>
</section>
</template>
+13
View File
@@ -0,0 +1,13 @@
<script setup lang="ts">
import { classes } from './support';
defineProps<{ data: Record<string, any>; style?: Record<string, string> }>();
</script>
<template>
<section :class="['mb-block mb-chips', classes(style)]">
<ul class="mb-inner">
<li v-for="(chip, index) in data.items || []" :key="index">{{ chip }}</li>
</ul>
</section>
</template>
+16
View File
@@ -0,0 +1,16 @@
<script setup lang="ts">
import Buttons from './Buttons.vue';
import { classes } from './support';
defineProps<{ data: Record<string, any>; style?: Record<string, string> }>();
</script>
<template>
<section :class="['mb-block mb-cta', classes(style)]">
<div class="mb-inner">
<h2>{{ data.title }}</h2>
<p v-if="data.text">{{ data.text }}</p>
<Buttons :buttons="data.buttons" />
</div>
</section>
</template>
+9
View File
@@ -0,0 +1,9 @@
<script setup lang="ts">
import { classes } from './support';
defineProps<{ style?: Record<string, string> }>();
</script>
<template>
<hr :class="['mb-block mb-divider', classes(style)]" />
</template>
+19
View File
@@ -0,0 +1,19 @@
<script setup lang="ts">
import { classes } from './support';
// The `FAQPage` data for search engines comes from the server (`structured_data` of the page API, or `Blocks::structuredData()`):
// print it in the head of the page; a Vue template cannot hold a script tag.
defineProps<{ data: Record<string, any>; style?: Record<string, string> }>();
</script>
<template>
<section :class="['mb-block mb-faq', classes(style)]">
<div class="mb-inner">
<h2 v-if="data.title">{{ data.title }}</h2>
<details v-for="(item, index) in data.items || []" :key="index">
<summary>{{ item.question }}</summary>
<p>{{ item.answer }}</p>
</details>
</div>
</section>
</template>
+17
View File
@@ -0,0 +1,17 @@
<script setup lang="ts">
import { classes } from './support';
// The form of a request (callback, question, quote, contact) posts to the requests module of the package (`manager.leads.form`), with
// its honeypot, its signed moment and Turnstile. That needs fields and a token the site knows how to build, so the shipped component only
// shows the title and the text: a site replaces it with its own form (`components` of the renderer), see the README.
defineProps<{ data: Record<string, any>; style?: Record<string, string> }>();
</script>
<template>
<section :class="['mb-block mb-form', classes(style)]">
<div class="mb-inner">
<h2 v-if="data.title">{{ data.title }}</h2>
<p v-if="data.text">{{ data.text }}</p>
</div>
</section>
</template>
+16
View File
@@ -0,0 +1,16 @@
<script setup lang="ts">
import { classes, safeUrl } from './support';
defineProps<{ data: Record<string, any>; style?: Record<string, string> }>();
</script>
<template>
<section :class="['mb-block mb-gallery', classes(style)]">
<div class="mb-inner">
<h2 v-if="data.title">{{ data.title }}</h2>
<div class="mb-grid">
<img v-for="(photo, index) in data.photos || []" :key="index" :src="safeUrl(photo)" alt="" loading="lazy" />
</div>
</div>
</section>
</template>
+20
View File
@@ -0,0 +1,20 @@
<script setup lang="ts">
import { computed } from 'vue';
import Buttons from './Buttons.vue';
import { classes, safeUrl } from './support';
const props = defineProps<{ data: Record<string, any>; style?: Record<string, string> }>();
const background = computed(() => (props.data.photo ? { '--mb-hero-image': `url('${safeUrl(props.data.photo)}')` } : {}));
</script>
<template>
<section :class="['mb-block mb-hero', classes(style)]" :style="background">
<div class="mb-inner">
<p v-if="data.eyebrow" class="mb-eyebrow">{{ data.eyebrow }}</p>
<h1>{{ data.title }}</h1>
<p v-if="data.roles && data.roles.length" class="mb-roles">{{ data.roles.join(' · ') }}</p>
<p v-if="data.intro" class="mb-lead">{{ data.intro }}</p>
<Buttons :buttons="data.buttons" />
</div>
</section>
</template>
+14
View File
@@ -0,0 +1,14 @@
<script setup lang="ts">
import { classes, safeUrl } from './support';
defineProps<{ data: Record<string, any>; style?: Record<string, string> }>();
</script>
<template>
<section :class="['mb-block mb-image', classes(style)]">
<figure class="mb-inner">
<img :src="safeUrl(data.photo)" :alt="data.caption || ''" loading="lazy" />
<figcaption v-if="data.caption">{{ data.caption }}</figcaption>
</figure>
</section>
</template>
+15
View File
@@ -0,0 +1,15 @@
<script setup lang="ts">
import { classes } from './support';
defineProps<{ data: Record<string, any>; style?: Record<string, string> }>();
</script>
<template>
<section :class="['mb-block mb-page-title', classes(style)]">
<div class="mb-inner">
<h1>{{ data.title }}</h1>
<!-- `intro_html` is made on the server from Markdown with raw HTML escaped -->
<div v-if="data.intro" class="mb-prose" v-html="data.intro_html" />
</div>
</section>
</template>
+16
View File
@@ -0,0 +1,16 @@
<script setup lang="ts">
import { classes } from './support';
defineProps<{ data: Record<string, any>; style?: Record<string, string> }>();
</script>
<template>
<section :class="['mb-block mb-points-box', classes(style)]">
<div class="mb-inner">
<h2 v-if="data.title">{{ data.title }}</h2>
<ul class="mb-points">
<li v-for="(point, index) in data.points || []" :key="index">{{ point }}</li>
</ul>
</div>
</section>
</template>
+16
View File
@@ -0,0 +1,16 @@
<script setup lang="ts">
import { classes } from './support';
defineProps<{ data: Record<string, any>; style?: Record<string, string> }>();
</script>
<template>
<section :class="['mb-block mb-quote', classes(style)]">
<blockquote class="mb-inner">
<p>{{ data.quote }}</p>
<footer v-if="data.name">
{{ data.name }} <span v-if="data.role">{{ data.role }}</span>
</footer>
</blockquote>
</section>
</template>
+12
View File
@@ -0,0 +1,12 @@
<script setup lang="ts">
import { classes } from './support';
defineProps<{ data: Record<string, any>; style?: Record<string, string> }>();
</script>
<template>
<section :class="['mb-block mb-rich-text', classes(style)]">
<!-- `body_html` is made on the server from Markdown with raw HTML escaped -->
<div class="mb-inner mb-prose" v-html="data.body_html" />
</section>
</template>
+9
View File
@@ -0,0 +1,9 @@
<script setup lang="ts">
import { classes } from './support';
defineProps<{ style?: Record<string, string> }>();
</script>
<template>
<div :class="['mb-block mb-spacer', classes(style)]" aria-hidden="true" />
</template>
+16
View File
@@ -0,0 +1,16 @@
<script setup lang="ts">
import { classes } from './support';
defineProps<{ data: Record<string, any>; style?: Record<string, string> }>();
</script>
<template>
<section :class="['mb-block mb-stats', classes(style)]">
<dl class="mb-inner mb-grid">
<div v-for="(item, index) in data.items || []" :key="index">
<dt>{{ item.label }}</dt>
<dd>{{ item.value }}{{ item.suffix }}</dd>
</div>
</dl>
</section>
</template>
+23
View File
@@ -0,0 +1,23 @@
<script setup lang="ts">
import { classes, safeUrl } from './support';
defineProps<{ data: Record<string, any>; style?: Record<string, string> }>();
</script>
<template>
<section :class="['mb-block mb-text-media', classes(style)]">
<div class="mb-inner mb-split">
<div class="mb-text">
<h2 v-if="data.title">{{ data.title }}</h2>
<div class="mb-prose" v-html="data.body_html" />
<ul v-if="data.points && data.points.length" class="mb-points">
<li v-for="(point, index) in data.points" :key="index">{{ point }}</li>
</ul>
</div>
<figure v-if="data.photo" class="mb-media">
<img :src="safeUrl(data.photo)" :alt="data.caption || data.title || ''" loading="lazy" />
<figcaption v-if="data.caption">{{ data.caption }}</figcaption>
</figure>
</div>
</section>
</template>
+39
View File
@@ -0,0 +1,39 @@
import type { Component } from 'vue';
import BeforeAfter from './BeforeAfter.vue';
import Cards from './Cards.vue';
import Chips from './Chips.vue';
import Cta from './Cta.vue';
import Divider from './Divider.vue';
import Faq from './Faq.vue';
import Form from './Form.vue';
import Gallery from './Gallery.vue';
import Hero from './Hero.vue';
import ImageBlock from './ImageBlock.vue';
import PageTitle from './PageTitle.vue';
import PointsBox from './PointsBox.vue';
import Quote from './Quote.vue';
import RichText from './RichText.vue';
import Spacer from './Spacer.vue';
import Stats from './Stats.vue';
import TextMedia from './TextMedia.vue';
/** The components of the block types the package ships, by type. A site adds or replaces by giving `components` to the renderer. */
export const blockComponents: Record<string, Component> = {
hero: Hero,
page_title: PageTitle,
rich_text: RichText,
text_media: TextMedia,
image: ImageBlock,
points_box: PointsBox,
gallery: Gallery,
before_after: BeforeAfter,
quote: Quote,
stats: Stats,
chips: Chips,
faq: Faq,
cards: Cards,
cta: Cta,
form: Form,
divider: Divider,
spacer: Spacer,
};
+4
View File
@@ -0,0 +1,4 @@
export { blockComponents } from './components';
export { default as BlockRenderer } from './BlockRenderer.vue';
export { classes, pick, safeUrl } from './support';
export type { Block } from './support';
+28
View File
@@ -0,0 +1,28 @@
export type BlockData = Record<string, any>;
export type Item = Record<string, any>;
export type Block = { id: string; type: string; data: BlockData; style: Record<string, string>; items?: Item[] };
/** An address that is safe in an `href` or `src`: http(s), a path, `mailto:`, `tel:` or an anchor; anything else becomes `#`. */
export function safeUrl(url: unknown): string {
const value = typeof url === 'string' ? url.trim() : '';
return /^(https?:\/\/|\/(?!\/)|#|mailto:|tel:)/i.test(value) && !/[\s"'()<>\\]/.test(value) ? value : '#';
}
/** CSS classes for the style options of a block: `mb--background-dark mb--width-wide`. */
export function classes(style: Record<string, string> | undefined): string {
return Object.entries(style ?? {})
.map(([name, value]) => `mb--${name.replace(/[^a-z0-9_-]/gi, '')}-${String(value).replace(/[^a-z0-9_-]/gi, '')}`)
.join(' ');
}
/** The first non-empty text of a record under one of the usual names (a card shows a title or name, a summary or quote, a photo, a url). */
export function pick(item: Item, keys: string[]): string | undefined {
for (const key of keys) {
if (typeof item[key] === 'string' && item[key] !== '') {
return item[key];
}
}
return undefined;
}