@spillway-cms/blocks 0.1.22 → 0.1.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/THIRD_PARTY_NOTICES.md +49 -0
  2. package/dist/ask.d.ts +8 -5
  3. package/dist/ask.js +46 -16
  4. package/dist/ask.js.map +1 -1
  5. package/dist/breadcrumbs.d.ts +27 -0
  6. package/dist/breadcrumbs.js +44 -0
  7. package/dist/breadcrumbs.js.map +1 -0
  8. package/dist/calendar.d.ts +34 -6
  9. package/dist/calendar.js +61 -5
  10. package/dist/calendar.js.map +1 -1
  11. package/dist/config.d.ts +52 -4
  12. package/dist/config.js +108 -25
  13. package/dist/config.js.map +1 -1
  14. package/dist/css.js +28 -0
  15. package/dist/css.js.map +1 -1
  16. package/dist/examples.js +67 -1
  17. package/dist/examples.js.map +1 -1
  18. package/dist/form.d.ts +11 -0
  19. package/dist/form.js +7 -3
  20. package/dist/form.js.map +1 -1
  21. package/dist/icons-data.d.ts +18 -0
  22. package/dist/icons-data.js +117 -0
  23. package/dist/icons-data.js.map +1 -0
  24. package/dist/icons.d.ts +31 -0
  25. package/dist/icons.js +49 -0
  26. package/dist/icons.js.map +1 -0
  27. package/dist/index.d.ts +13 -4
  28. package/dist/index.js +5 -1
  29. package/dist/index.js.map +1 -1
  30. package/dist/marketing.d.ts +3 -0
  31. package/dist/marketing.js +5 -2
  32. package/dist/marketing.js.map +1 -1
  33. package/dist/meta.js +46 -16
  34. package/dist/meta.js.map +1 -1
  35. package/dist/mini-calendar.d.ts +20 -0
  36. package/dist/mini-calendar.js +85 -0
  37. package/dist/mini-calendar.js.map +1 -0
  38. package/dist/motion.d.ts +1 -1
  39. package/dist/motion.js +2 -1
  40. package/dist/motion.js.map +1 -1
  41. package/dist/registry-package.js +1 -1
  42. package/dist/registry-package.js.map +1 -1
  43. package/dist/registry-types.d.ts +7 -0
  44. package/dist/registry-types.js.map +1 -1
  45. package/dist/styles.css +231 -1
  46. package/dist/styles.js +95 -0
  47. package/dist/styles.js.map +1 -1
  48. package/dist/toc.d.ts +32 -0
  49. package/dist/toc.js +79 -0
  50. package/dist/toc.js.map +1 -0
  51. package/dist/video.d.ts +36 -1
  52. package/dist/video.js +157 -4
  53. package/dist/video.js.map +1 -1
  54. package/dist/widgets.d.ts +95 -0
  55. package/dist/widgets.js +449 -0
  56. package/dist/widgets.js.map +1 -0
  57. package/package.json +4 -3
package/dist/config.d.ts CHANGED
@@ -12,6 +12,7 @@
12
12
  import type { Config, Slot } from '@puckeditor/core';
13
13
  import { type BlockMotion } from '@spillway-cms/shared';
14
14
  import { type CalendarProps } from './calendar.js';
15
+ import { type MiniCalendarProps } from './mini-calendar.js';
15
16
  import { type CollectionProps } from './collection.js';
16
17
  import { type FormProps } from './form.js';
17
18
  import { type ResolvedMedia } from './image.js';
@@ -24,11 +25,13 @@ import { type RegistryPackageProps } from './registry-package.js';
24
25
  import { type GalleryProps } from './gallery.js';
25
26
  import { type FaqProps, type LogoStripProps, type StatsProps, type TestimonialsProps } from './marketing.js';
26
27
  import { type ScrollytellingProps } from './story.js';
28
+ import { type AccordionProps, type CarouselProps, type TabsProps } from './widgets.js';
27
29
  import { type LottieProps, type Model3DProps } from './players.js';
28
30
  import { type VideoProps } from './video.js';
29
31
  import { type SearchProps } from './search.js';
30
32
  import { type AskProps } from './ask.js';
31
33
  import { type MenuBlockProps } from './menu.js';
34
+ import { type BreadcrumbsBlockProps } from './breadcrumbs.js';
32
35
  import { type RegistryStatsProps } from './registry-stats.js';
33
36
  import { type StatusBoardProps } from './status-board.js';
34
37
  import { type ThemeGalleryProps } from './registry-gallery.js';
@@ -36,6 +39,8 @@ import { type PublisherProfileProps } from './registry-publisher.js';
36
39
  import { type OrgProfileProps } from './registry-org.js';
37
40
  import { type DocsFeedbackProps } from './docs-feedback.js';
38
41
  import { type ModuleBlockProps } from './module-block.js';
42
+ import { type OnThisPageProps } from './toc.js';
43
+ import { type SectionOverlay, type SectionTextColor } from '@spillway-cms/shared';
39
44
  export type Align = 'left' | 'center';
40
45
  export type TextAlign = 'left' | 'center' | 'right';
41
46
  export interface HeroProps {
@@ -64,6 +69,11 @@ export interface HeroProps {
64
69
  imagePosition?: 'right' | 'left';
65
70
  align: Align;
66
71
  size: 'default' | 'large';
72
+ /**
73
+ * The title's heading level: h1 (the default, the page's title) or h2, for a hero further down the page or a carousel's slides
74
+ * after the first, so the page keeps one H1.
75
+ */
76
+ titleLevel?: 'h1' | 'h2';
67
77
  /** The block style's key (Brand → Styles), e.g. "dark-band"; empty means the site's default Hero style. */
68
78
  style?: string;
69
79
  /** Resolved by the server from `backgroundImage` when it is a library image; never stored. */
@@ -84,6 +94,10 @@ export interface HeadingProps {
84
94
  align: TextAlign;
85
95
  /** The block style's key; empty means the site's default Heading style. */
86
96
  style?: string;
97
+ /** Link name: the heading's id, so `#name` jumps to it (letters, digits and hyphens; unique on the page). */
98
+ anchor?: string;
99
+ /** The id the server settled on for this page (the link name made unique, or one from the text for On this page). Never stored. */
100
+ anchorId?: string;
87
101
  }
88
102
  export interface TextProps {
89
103
  /** HTML (or plain paragraphs). On the page builder canvas only, the rich text editor Puck renders in place. */
@@ -122,12 +136,31 @@ export interface SectionProps {
122
136
  content: Slot;
123
137
  background: 'none' | 'surface' | 'primary' | 'secondary' | 'dark';
124
138
  width: 'narrow' | 'normal' | 'wide';
139
+ /** A media library image behind the blocks, cropped around its focal point (docs/dev/section-media-icons-anchors.md). */
140
+ backgroundImage?: string;
141
+ /** A muted, looping .mp4 or .webm behind the blocks, with the background image as its poster; it plays under the Hero's rules. */
142
+ backgroundVideo?: string;
143
+ /** A brand color laid over the image so text stays readable; unset is Dark. */
144
+ overlay?: SectionOverlay;
145
+ /** The overlay's strength in percent (20 to 80); unset is 60. */
146
+ overlayStrength?: number;
147
+ /** Light or dark text over the image; auto picks from the overlay. */
148
+ textColor?: SectionTextColor;
149
+ /** Link name: the section's id, so `#name` jumps to it. */
150
+ anchor?: string;
151
+ /** Set by the server; never stored. */
152
+ anchorId?: string;
153
+ backgroundMedia?: ResolvedMedia | null;
154
+ backgroundPriority?: boolean;
125
155
  }
126
156
  export interface ButtonsItem {
127
157
  label: string;
128
158
  href: string;
129
159
  emphasis: 'primary' | 'secondary' | 'link';
130
160
  newTab?: boolean;
161
+ /** An icon beside the label (decorative: the label names the button). */
162
+ icon?: string;
163
+ iconPosition?: 'before' | 'after';
131
164
  }
132
165
  /** One to four buttons in a row that wraps on small screens. */
133
166
  export interface ButtonsProps {
@@ -153,6 +186,9 @@ export interface CardItem {
153
186
  text: string;
154
187
  href: string;
155
188
  imageUrl: string;
189
+ /** An icon above the title, from the bundled set; decorative unless `iconLabel` is set. */
190
+ icon?: string;
191
+ iconLabel?: string;
156
192
  }
157
193
  export interface CardsProps {
158
194
  cards: CardItem[];
@@ -186,6 +222,9 @@ export interface ButtonProps {
186
222
  align: TextAlign;
187
223
  /** The block style's key; empty means the site's default Button style. */
188
224
  style?: string;
225
+ /** An icon beside the label (decorative: the label names the button). */
226
+ icon?: string;
227
+ iconPosition?: 'before' | 'after';
189
228
  }
190
229
  export interface RootProps {
191
230
  title: string;
@@ -199,8 +238,13 @@ export type BlockProps = {
199
238
  Search: SearchProps;
200
239
  Ask: AskProps;
201
240
  Menu: MenuBlockProps;
241
+ Breadcrumbs: BreadcrumbsBlockProps;
202
242
  Columns: ColumnsProps;
203
243
  Section: SectionProps;
244
+ OnThisPage: OnThisPageProps;
245
+ Tabs: TabsProps;
246
+ Accordion: AccordionProps;
247
+ Carousel: CarouselProps;
204
248
  Buttons: ButtonsProps;
205
249
  CallToAction: CallToActionProps;
206
250
  Cards: CardsProps;
@@ -218,6 +262,7 @@ export type BlockProps = {
218
262
  Button: ButtonProps;
219
263
  Collection: CollectionProps;
220
264
  Calendar: CalendarProps;
265
+ MiniCalendar: MiniCalendarProps;
221
266
  Form: FormProps;
222
267
  Shared: SharedProps;
223
268
  Component: SiteComponentProps;
@@ -242,14 +287,16 @@ export type BlocksConfig = Config<{
242
287
  }>;
243
288
  /** The Hero's side image: about half the container from 900px, the full width below. */
244
289
  export declare const HERO_SIDE_SIZES = "(min-width: 1200px) 640px, (min-width: 900px) 50vw, 100vw";
290
+ /** A link name as typed, made into an id: lowercase letters, digits and hyphens (empty when nothing usable is left). */
291
+ export declare function anchorIdOf(anchor: unknown): string;
245
292
  export declare const config: BlocksConfig;
246
- export declare const SPACED_BLOCKS: readonly ["Section", "Columns", "Divider", "Heading", "Text", "Image", "Gallery", "Video", "Search", "Ask", "Embed", "Lottie", "Model3D", "Button", "Buttons", "Hero", "CallToAction", "Cards", "Faq", "Testimonials", "Stats", "LogoStrip", "Scrollytelling", "Collection", "Calendar", "Form"];
293
+ export declare const SPACED_BLOCKS: readonly ["Section", "Columns", "Tabs", "Accordion", "Carousel", "OnThisPage", "Divider", "Heading", "Text", "Image", "Gallery", "Video", "Search", "Ask", "Embed", "Lottie", "Model3D", "Button", "Buttons", "Hero", "CallToAction", "Cards", "Faq", "Testimonials", "Stats", "LogoStrip", "Scrollytelling", "Collection", "Calendar", "MiniCalendar", "Form"];
247
294
  /** The classes for a block's Space above and Space below; unknown values are ignored. */
248
295
  export declare function spacingClasses(props: BlockSpacing | undefined): string;
249
296
  /** Blocks whose items (cards, images, logos, quotes, buttons, list items) can arrive one after another and respond to hover. */
250
297
  export declare const MOTION_ITEM_BLOCKS: readonly ["Image", "Gallery", "Buttons", "Button", "Cards", "Faq", "Testimonials", "Stats", "LogoStrip", "Collection"];
251
- /** Blocks with a background image that parallax can move. */
252
- export declare const MOTION_PARALLAX_BLOCKS: readonly ["Hero"];
298
+ /** Blocks with a background image that parallax can move (a Section's only when it has one). */
299
+ export declare const MOTION_PARALLAX_BLOCKS: readonly ["Hero", "Section"];
253
300
  /**
254
301
  * A block's Motion settings as attributes on its root element (docs/dev/motion.md): `data-motion` (the entrance), `data-motion-delay`,
255
302
  * `data-motion-stagger` and `data-motion-hover`. Unknown values are dropped. Nothing moves until the page's motion script arms them,
@@ -262,7 +309,8 @@ export declare const MOTION_SCRIPT_BLOCKS: readonly ["Scrollytelling", "Lottie",
262
309
  export declare const PLAYER_BLOCKS: readonly ["Lottie", "Model3D"];
263
310
  /**
264
311
  * Whether a block asks for any motion (the page then carries the motion script): Motion settings, Stats that count up, a marquee,
265
- * a Hero's video, a muted Video that plays on its own, or a block in MOTION_SCRIPT_BLOCKS (pass its type).
312
+ * a Hero's video, a muted Video that plays on its own, a Carousel that plays on its own, or a block in MOTION_SCRIPT_BLOCKS (pass
313
+ * its type).
266
314
  */
267
315
  export declare function hasMotion(props: {
268
316
  motion?: BlockMotion;
package/dist/config.js CHANGED
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
2
2
  import { cloneElement, isValidElement } from 'react';
3
3
  import { MOTION_ENTRANCES, MOTION_HOVERS, MOTION_SCROLLS } from '@spillway-cms/shared';
4
4
  import { calendarComponent } from './calendar.js';
5
+ import { miniCalendarComponent } from './mini-calendar.js';
5
6
  import { collectionComponent } from './collection.js';
6
7
  import { renderForm } from './form.js';
7
8
  import { ResponsiveImage, WIDE_SIZES } from './image.js';
@@ -14,11 +15,13 @@ import { registryPackageComponent } from './registry-package.js';
14
15
  import { galleryComponent } from './gallery.js';
15
16
  import { faqComponent, logoStripComponent, statsComponent, testimonialsComponent } from './marketing.js';
16
17
  import { scrollytellingComponent } from './story.js';
18
+ import { accordionComponent, carouselComponent, slugify, tabsComponent } from './widgets.js';
17
19
  import { lottieComponent, model3dComponent } from './players.js';
18
20
  import { videoComponent } from './video.js';
19
21
  import { searchComponent } from './search.js';
20
22
  import { askComponent } from './ask.js';
21
23
  import { menuBlockComponent } from './menu.js';
24
+ import { breadcrumbsBlockComponent } from './breadcrumbs.js';
22
25
  import { registryStatsComponent } from './registry-stats.js';
23
26
  import { statusBoardComponent } from './status-board.js';
24
27
  import { themeGalleryComponent } from './registry-gallery.js';
@@ -26,7 +29,9 @@ import { publisherProfileComponent } from './registry-publisher.js';
26
29
  import { orgProfileComponent } from './registry-org.js';
27
30
  import { docsFeedbackComponent } from './docs-feedback.js';
28
31
  import { moduleBlockComponent } from './module-block.js';
29
- import { DEFAULT_EMBED_HOSTS } from '@spillway-cms/shared';
32
+ import { onThisPageComponent } from './toc.js';
33
+ import { Icon, iconField, iconLabelField } from './icons.js';
34
+ import { DEFAULT_EMBED_HOSTS, SECTION_OVERLAY_STRENGTHS, sectionOverlayOf, sectionStrengthOf, sectionTextTone } from '@spillway-cms/shared';
30
35
  import { holdEmbedHtml, isPlainText, keyboardScrollable, sanitizeEmbedHtml, sanitizeTextHtml } from './sanitize.js';
31
36
  /** `https://www.youtube.com/embed/x` → `www.youtube.com`; empty when it is not a URL. */
32
37
  function hostOf(url) {
@@ -86,18 +91,35 @@ function paragraphs(text) {
86
91
  function isExternal(href) {
87
92
  return /^(https?:)?\/\//i.test(href);
88
93
  }
89
- function Button({ label, href, variant, newTab, }) {
94
+ function Button({ label, href, variant, newTab, icon, iconPosition, }) {
90
95
  if (!label)
91
96
  return null;
92
97
  const external = isExternal(href);
93
- return (_jsx("a", { className: cx('sw-button', `sw-button--${variant}`), href: href || '#', target: newTab ? '_blank' : undefined, rel: newTab || external ? 'noopener' : undefined, children: label }));
98
+ const after = iconPosition === 'after';
99
+ return (_jsxs("a", { className: cx('sw-button', `sw-button--${variant}`), href: href || '#', target: newTab ? '_blank' : undefined, rel: newTab || external ? 'noopener' : undefined, children: [!after ? _jsx(Icon, { name: icon }) : null, label, after ? _jsx(Icon, { name: icon }) : null] }));
94
100
  }
101
+ const iconPositionField = {
102
+ type: 'radio',
103
+ label: 'Icon position',
104
+ options: [
105
+ { label: 'Before the label', value: 'before' },
106
+ { label: 'After the label', value: 'after' },
107
+ ],
108
+ };
109
+ /** A link name as typed, made into an id: lowercase letters, digits and hyphens (empty when nothing usable is left). */
110
+ export function anchorIdOf(anchor) {
111
+ const slug = typeof anchor === 'string' ? slugify(anchor) : '';
112
+ return slug && /^\d/.test(slug) ? `n-${slug}` : slug;
113
+ }
114
+ const anchorField = { type: 'text', label: 'Link name (optional, for #links and On this page)', placeholder: 'admissions' };
115
+ /** Whether a background video URL is one the Section and the Hero play: an .mp4 or .webm at a path or an http(s) URL. */
116
+ const isBackgroundVideo = (v) => typeof v === 'string' && /^(\/(?!\/)|https?:\/\/)/i.test(v.trim()) && /\.(mp4|webm)(\?.*)?$/i.test(v.trim());
95
117
  // ---------- Config ----------
96
118
  export const config = {
97
119
  categories: {
98
- layout: { title: 'Layout', components: ['Section', 'Columns', 'Spacer', 'Divider'] },
99
- content: { title: 'Content', components: ['Heading', 'Text', 'Image', 'Gallery', 'Video', 'Embed', 'Lottie', 'Model3D', 'Button', 'Buttons', 'Search', 'Ask', 'Menu'] },
100
- marketing: { title: 'Marketing', components: ['Hero', 'CallToAction', 'Cards', 'Faq', 'Testimonials', 'Stats', 'LogoStrip', 'Scrollytelling', 'Collection', 'Calendar', 'Form', 'Shared'] },
120
+ layout: { title: 'Layout', components: ['Section', 'Columns', 'Tabs', 'Accordion', 'Carousel', 'OnThisPage', 'Spacer', 'Divider'] },
121
+ content: { title: 'Content', components: ['Heading', 'Text', 'Image', 'Gallery', 'Video', 'Embed', 'Lottie', 'Model3D', 'Button', 'Buttons', 'Search', 'Ask', 'Menu', 'Breadcrumbs'] },
122
+ marketing: { title: 'Marketing', components: ['Hero', 'CallToAction', 'Cards', 'Faq', 'Testimonials', 'Stats', 'LogoStrip', 'Scrollytelling', 'Collection', 'Calendar', 'MiniCalendar', 'Form', 'Shared'] },
101
123
  // The docs kit's feedback block; the admin lists it only on a site that has the docs_feedback form.
102
124
  docs: { title: 'Docs', components: ['DocsFeedback'] },
103
125
  // The package registry's public pages; the admin lists them only on an instance that hosts the registry (REGISTRY_HOST=1).
@@ -120,12 +142,18 @@ export const config = {
120
142
  // ----- Marketing -----
121
143
  // Saved query rendered as cards, list or grid; items are resolved by the server (see src/collection.tsx).
122
144
  Collection: collectionComponent,
145
+ // Slides, items and tabs that each hold blocks, enhanced by the page's widgets script (see src/widgets.tsx).
146
+ Carousel: carouselComponent(() => config),
147
+ Accordion: accordionComponent(() => config),
148
+ Tabs: tabsComponent(() => config),
123
149
  // A block from the component library, resolved by the server (see src/shared.tsx).
124
150
  Shared: createSharedComponent(() => config),
125
151
  // A site component (Components → Site components): a locked design with the page's values, resolved by the server (see src/site-component.tsx).
126
152
  Component: createSiteComponent(() => config),
127
- // Month grid or list of a collection's event occurrences; resolved by the server (see src/calendar.tsx).
153
+ // Month grid, week, day or list of a collection's event occurrences; resolved by the server (see src/calendar.tsx).
128
154
  Calendar: calendarComponent,
155
+ // One small month of the same, for a sidebar or a home page (see src/mini-calendar.tsx).
156
+ MiniCalendar: miniCalendarComponent,
129
157
  // Islands: content per audience or per experiment variant; the server picks what each visitor sees (see src/personalize.tsx, src/experiment.tsx).
130
158
  Personalize: personalizeComponent,
131
159
  Experiment: experimentComponent,
@@ -186,6 +214,14 @@ export const config = {
186
214
  { label: 'Large', value: 'large' },
187
215
  ],
188
216
  },
217
+ titleLevel: {
218
+ type: 'radio',
219
+ label: 'Title level',
220
+ options: [
221
+ { label: 'H1 (the page title)', value: 'h1' },
222
+ { label: 'H2 (further down, or a later slide)', value: 'h2' },
223
+ ],
224
+ },
189
225
  },
190
226
  defaultProps: {
191
227
  eyebrow: 'Introducing',
@@ -202,7 +238,7 @@ export const config = {
202
238
  align: 'center',
203
239
  size: 'default',
204
240
  },
205
- render: ({ eyebrow, title, subtitle, primaryLabel, primaryHref, secondaryLabel, secondaryHref, backgroundImage, backgroundVideo, image, imageAlt, imagePosition, align, size, style, backgroundMedia, imageMedia, imagePriority, backgroundPriority, }) => {
241
+ render: ({ eyebrow, title, subtitle, primaryLabel, primaryHref, secondaryLabel, secondaryHref, backgroundImage, backgroundVideo, image, imageAlt, imagePosition, align, size, titleLevel, style, backgroundMedia, imageMedia, imagePriority, backgroundPriority, }) => {
206
242
  const video = backgroundVideo && backgroundImage && /\.(mp4|webm)(\?.*)?$/i.test(backgroundVideo) ? backgroundVideo : null;
207
243
  const hasImage = Boolean(backgroundImage);
208
244
  // A library image becomes a real, eagerly loaded picture behind the text (first paint matters for a hero);
@@ -210,7 +246,7 @@ export const config = {
210
246
  const hasPicture = hasImage && Boolean(backgroundMedia) && !video;
211
247
  const hasActions = Boolean(primaryLabel || secondaryLabel);
212
248
  const side = typeof image === 'string' && image.trim() ? image.trim() : '';
213
- const text = (_jsxs("div", { className: "sw-hero__inner", children: [eyebrow ? _jsx("span", { className: "sw-hero__eyebrow", children: eyebrow }) : null, _jsx("h1", { className: "sw-hero__title", children: title }), subtitle ? _jsx("p", { className: "sw-hero__subtitle", children: subtitle }) : null, hasActions ? (_jsxs("div", { className: "sw-actions", children: [_jsx(Button, { label: primaryLabel, href: primaryHref, variant: "primary" }), _jsx(Button, { label: secondaryLabel, href: secondaryHref, variant: "secondary" })] })) : null] }));
249
+ const text = (_jsxs("div", { className: "sw-hero__inner", children: [eyebrow ? _jsx("span", { className: "sw-hero__eyebrow", children: eyebrow }) : null, titleLevel === 'h2' ? _jsx("h2", { className: "sw-hero__title", children: title }) : _jsx("h1", { className: "sw-hero__title", children: title }), subtitle ? _jsx("p", { className: "sw-hero__subtitle", children: subtitle }) : null, hasActions ? (_jsxs("div", { className: "sw-actions", children: [_jsx(Button, { label: primaryLabel, href: primaryHref, variant: "primary" }), _jsx(Button, { label: secondaryLabel, href: secondaryHref, variant: "secondary" })] })) : null] }));
214
250
  return (_jsxs("section", { className: cx('sw-block', 'sw-hero', `sw-hero--${size}`, hasImage && 'sw-hero--image', side && 'sw-hero--side', side && `sw-hero--side-${imagePosition === 'left' ? 'left' : 'right'}`, `sw-align-${align}`, styleClassFor('Hero', style)), style: hasImage && !hasPicture && !video ? { backgroundImage: `url("${backgroundImage}")` } : undefined, children: [video ? (_jsxs(_Fragment, { children: [_jsx("video", { className: "sw-hero__bg sw-hero__video", muted: true, loop: true, playsInline: true, preload: "none", poster: backgroundMedia?.url ?? backgroundImage, "aria-hidden": "true", "data-sw-bg-video": "", children: _jsx("source", { src: video, type: /\.webm(\?.*)?$/i.test(video) ? 'video/webm' : 'video/mp4' }) }), _jsx("button", { type: "button", className: "sw-video-toggle", "data-sw-video-toggle": "", "aria-pressed": "false", hidden: true, children: "Pause background video" })] })) : null, hasPicture ? (_jsx(ResponsiveImage, { className: "sw-hero__bg", src: backgroundImage, alt: "", media: backgroundMedia, sizes: "100vw", loading: backgroundPriority === false ? 'lazy' : 'eager', priority: backgroundPriority ? 'high' : 'auto', aspect: { w: 16, h: 7 } })) : null, _jsx("div", { className: "sw-container", children: side ? (
215
251
  // Text first in the markup, so it comes first when the columns stack and for screen readers; CSS moves a left image.
216
252
  _jsxs("div", { className: "sw-hero__layout", children: [text, _jsx("div", { className: "sw-hero__media", children: _jsx(ResponsiveImage, { className: "sw-hero__image", src: side, alt: (typeof imageAlt === 'string' && imageAlt.trim()) || imageMedia?.alt || '', media: imageMedia, sizes: HERO_SIDE_SIZES, loading: imagePriority === false ? 'lazy' : 'eager', priority: imagePriority && !hasPicture ? 'high' : 'auto', style: sideImageCap(imageMedia) }) })] })) : (text) })] }));
@@ -247,8 +283,10 @@ export const config = {
247
283
  text: { type: 'textarea', label: 'Text', contentEditable: true },
248
284
  href: { type: 'text', label: 'Link', placeholder: '/page or https://...' },
249
285
  imageUrl: { type: 'text', label: 'Image URL', placeholder: '/media/...' },
286
+ icon: iconField('Icon (above the title)'),
287
+ iconLabel: iconLabelField,
250
288
  },
251
- defaultItemProps: { title: 'Card title', text: 'A short description.', href: '', imageUrl: '' },
289
+ defaultItemProps: { title: 'Card title', text: 'A short description.', href: '', imageUrl: '', icon: '', iconLabel: '' },
252
290
  },
253
291
  columns: {
254
292
  type: 'radio',
@@ -281,7 +319,7 @@ export const config = {
281
319
  const Title = titleLevel === 'h2' ? 'h2' : 'h3';
282
320
  return (_jsx("section", { className: cx('sw-block', 'sw-cards', `sw-cards--${columns}`, styleClassFor('Cards', style)), children: _jsx("div", { className: "sw-container", children: _jsx("ul", { className: "sw-cards__grid", children: (cards ?? []).map((card, i) => {
283
321
  const linked = Boolean(card.href);
284
- return (_jsxs("li", { className: cx('sw-card', linked && 'sw-card--link'), children: [card.imageUrl ? _jsx(ResponsiveImage, { className: "sw-card__image", src: card.imageUrl, alt: "", media: cardMedia?.[i] ?? null, sizes: CARD_SIZES[columns] ?? CARD_SIZES[3], aspect: { w: 16, h: 9 } }) : null, _jsxs("div", { className: "sw-card__body", children: [_jsx(Title, { className: "sw-card__title", children: linked ? _jsx("a", { href: card.href, children: card.title }) : card.title }), card.text ? _jsx("p", { className: "sw-card__text", children: card.text }) : null, linked ? (_jsx("span", { className: "sw-card__more", "aria-hidden": "true", children: "Read more \u2192" })) : null] })] }, i));
322
+ return (_jsxs("li", { className: cx('sw-card', linked && 'sw-card--link'), children: [card.imageUrl ? _jsx(ResponsiveImage, { className: "sw-card__image", src: card.imageUrl, alt: "", media: cardMedia?.[i] ?? null, sizes: CARD_SIZES[columns] ?? CARD_SIZES[3], aspect: { w: 16, h: 9 } }) : null, _jsxs("div", { className: "sw-card__body", children: [_jsx(Icon, { name: card.icon, label: card.iconLabel, className: "sw-card__icon" }), _jsx(Title, { className: "sw-card__title", children: linked ? _jsx("a", { href: card.href, children: card.title }) : card.title }), card.text ? _jsx("p", { className: "sw-card__text", children: card.text }) : null, linked ? (_jsx("span", { className: "sw-card__more", "aria-hidden": "true", children: "Read more \u2192" })) : null] })] }, i));
285
323
  }) }) }) }));
286
324
  },
287
325
  },
@@ -301,11 +339,13 @@ export const config = {
301
339
  ],
302
340
  },
303
341
  align: { type: 'radio', label: 'Alignment', options: textAlignOptions },
342
+ anchor: anchorField,
304
343
  },
305
- defaultProps: { text: 'Section heading', level: 'h2', align: 'left' },
306
- render: ({ text, level, align, style }) => {
344
+ defaultProps: { text: 'Section heading', level: 'h2', align: 'left', anchor: '' },
345
+ render: ({ text, level, align, style, anchor, anchorId }) => {
307
346
  const Tag = level;
308
- return (_jsx("section", { className: cx('sw-block', 'sw-heading', `sw-align-${align}`, styleClassFor('Heading', style)), children: _jsx("div", { className: "sw-container", children: _jsx(Tag, { className: "sw-heading__text", children: text }) }) }));
347
+ const id = (typeof anchorId === 'string' && anchorId) || anchorIdOf(anchor) || undefined;
348
+ return (_jsx("section", { className: cx('sw-block', 'sw-heading', `sw-align-${align}`, styleClassFor('Heading', style)), children: _jsx("div", { className: "sw-container", children: _jsx(Tag, { className: "sw-heading__text", id: id, children: text }) }) }));
309
349
  },
310
350
  },
311
351
  Text: {
@@ -376,6 +416,8 @@ export const config = {
376
416
  Search: searchComponent,
377
417
  Ask: askComponent,
378
418
  Menu: menuBlockComponent,
419
+ // The trail to the page, resolved by the server from its path or the main menu (see src/breadcrumbs.tsx).
420
+ Breadcrumbs: breadcrumbsBlockComponent,
379
421
  Embed: {
380
422
  label: 'Embed',
381
423
  fields: {
@@ -397,10 +439,12 @@ export const config = {
397
439
  label: { type: 'text', label: 'Label' },
398
440
  href: { type: 'text', label: 'Link' },
399
441
  align: { type: 'radio', label: 'Alignment', options: textAlignOptions },
442
+ icon: iconField(),
443
+ iconPosition: iconPositionField,
400
444
  },
401
- defaultProps: { label: 'Learn more', href: '#', align: 'left' },
445
+ defaultProps: { label: 'Learn more', href: '#', align: 'left', icon: '', iconPosition: 'after' },
402
446
  // The emphasis comes from the style; the old `variant` only picks the style of a Button saved without one.
403
- render: ({ label, href, variant, align, style }) => (_jsx("section", { className: cx('sw-block', 'sw-button-block', `sw-align-${align}`, styleClassFor('Button', style || (variant === 'secondary' ? 'secondary' : ''))), children: _jsx("div", { className: "sw-container", children: _jsx("div", { className: "sw-actions", children: _jsx(Button, { label: label, href: href, variant: variant === 'secondary' ? 'secondary' : 'primary' }) }) }) })),
447
+ render: ({ label, href, variant, align, style, icon, iconPosition }) => (_jsx("section", { className: cx('sw-block', 'sw-button-block', `sw-align-${align}`, styleClassFor('Button', style || (variant === 'secondary' ? 'secondary' : ''))), children: _jsx("div", { className: "sw-container", children: _jsx("div", { className: "sw-actions", children: _jsx(Button, { label: label, href: href, variant: variant === 'secondary' ? 'secondary' : 'primary', icon: icon, iconPosition: iconPosition }) }) }) })),
404
448
  },
405
449
  Buttons: {
406
450
  label: 'Buttons',
@@ -424,8 +468,10 @@ export const config = {
424
468
  ],
425
469
  },
426
470
  newTab: { type: 'radio', label: 'Open in a new tab', options: yesNo },
471
+ icon: iconField(),
472
+ iconPosition: iconPositionField,
427
473
  },
428
- defaultItemProps: { label: 'Learn more', href: '', emphasis: 'secondary', newTab: false },
474
+ defaultItemProps: { label: 'Learn more', href: '', emphasis: 'secondary', newTab: false, icon: '', iconPosition: 'after' },
429
475
  },
430
476
  align: { type: 'radio', label: 'Alignment', options: textAlignOptions },
431
477
  },
@@ -436,7 +482,7 @@ export const config = {
436
482
  ],
437
483
  align: 'left',
438
484
  },
439
- render: ({ buttons, align }) => (_jsx("section", { className: cx('sw-block', 'sw-button-block', 'sw-buttons', `sw-align-${align}`), children: _jsx("div", { className: "sw-container", children: _jsx("div", { className: "sw-actions", children: (buttons ?? []).map((b, i) => (_jsx(Button, { label: b.label, href: b.href, variant: b.emphasis === 'secondary' || b.emphasis === 'link' ? b.emphasis : 'primary', newTab: b.newTab === true }, i))) }) }) })),
485
+ render: ({ buttons, align }) => (_jsx("section", { className: cx('sw-block', 'sw-button-block', 'sw-buttons', `sw-align-${align}`), children: _jsx("div", { className: "sw-container", children: _jsx("div", { className: "sw-actions", children: (buttons ?? []).map((b, i) => (_jsx(Button, { label: b.label, href: b.href, variant: b.emphasis === 'secondary' || b.emphasis === 'link' ? b.emphasis : 'primary', newTab: b.newTab === true, icon: b.icon, iconPosition: b.iconPosition }, i))) }) }) })),
440
486
  },
441
487
  // ----- Layout -----
442
488
  Section: {
@@ -463,13 +509,46 @@ export const config = {
463
509
  { label: 'Wide', value: 'wide' },
464
510
  ],
465
511
  },
512
+ backgroundImage: { type: 'text', label: 'Background image URL', placeholder: '/media/...' },
513
+ backgroundVideo: { type: 'text', label: 'Background video URL (needs a background image as its poster)', placeholder: '/media/....mp4' },
514
+ overlay: {
515
+ type: 'select',
516
+ label: 'Overlay on the image',
517
+ options: [
518
+ { label: 'Dark', value: 'dark' },
519
+ { label: 'Light', value: 'light' },
520
+ { label: 'Primary color', value: 'primary' },
521
+ { label: 'Secondary color', value: 'secondary' },
522
+ { label: 'None', value: 'none' },
523
+ ],
524
+ },
525
+ overlayStrength: { type: 'select', label: 'Overlay strength', options: SECTION_OVERLAY_STRENGTHS.map((n) => ({ label: `${n}%`, value: n })) },
526
+ textColor: {
527
+ type: 'radio',
528
+ label: 'Text color on the image',
529
+ options: [
530
+ { label: 'Automatic', value: 'auto' },
531
+ { label: 'Light', value: 'light' },
532
+ { label: 'Dark', value: 'dark' },
533
+ ],
534
+ },
535
+ anchor: anchorField,
466
536
  },
467
- defaultProps: { content: [], background: 'surface', width: 'normal' },
468
- render: ({ content: Content, background, width }) => {
537
+ defaultProps: { content: [], background: 'surface', width: 'normal', backgroundImage: '', backgroundVideo: '', overlay: 'dark', overlayStrength: 60, textColor: 'auto', anchor: '' },
538
+ render: ({ content: Content, background, width, backgroundImage, backgroundVideo, overlay, overlayStrength, textColor, anchor, anchorId, backgroundMedia, backgroundPriority }) => {
469
539
  const bg = ['surface', 'primary', 'secondary', 'dark'].includes(background) ? background : 'none';
470
- return (_jsx("section", { className: cx('sw-block', 'sw-section', `sw-section--bg-${bg}`, bg !== 'none' && 'sw-section--filled', (bg === 'primary' || bg === 'secondary' || bg === 'dark') && 'sw-section--on-dark'), children: _jsx("div", { className: cx('sw-container', width === 'narrow' && 'sw-container--narrow', width === 'wide' && 'sw-container--wide'), children: _jsx(Content, { className: "sw-section__body" }) }) }));
540
+ const image = typeof backgroundImage === 'string' ? backgroundImage.trim() : '';
541
+ // A background video needs the image as its poster (what visitors who see no motion get), like the Hero's.
542
+ const video = image && isBackgroundVideo(backgroundVideo) ? backgroundVideo.trim() : '';
543
+ const ov = image ? sectionOverlayOf(overlay) : 'none';
544
+ const strength = sectionStrengthOf(overlayStrength);
545
+ const tone = image ? sectionTextTone(ov, textColor) : bg === 'primary' || bg === 'secondary' || bg === 'dark' ? 'light' : null;
546
+ const id = (typeof anchorId === 'string' && anchorId) || anchorIdOf(anchor) || undefined;
547
+ return (_jsxs("section", { id: id, className: cx('sw-block', 'sw-section', `sw-section--bg-${bg}`, (bg !== 'none' || image) && 'sw-section--filled', image && 'sw-section--media', image && ov !== 'none' && `sw-section--overlay-${ov} sw-section--strength-${strength}`, tone === 'light' && 'sw-section--on-dark', image && tone === 'dark' && 'sw-section--on-light'), children: [video ? (_jsxs(_Fragment, { children: [_jsx("video", { className: "sw-section__bg sw-section__video", muted: true, loop: true, playsInline: true, preload: "none", poster: backgroundMedia?.url ?? image, "aria-hidden": "true", "data-sw-bg-video": "", children: _jsx("source", { src: video, type: /\.webm(\?.*)?$/i.test(video) ? 'video/webm' : 'video/mp4' }) }), _jsx("button", { type: "button", className: "sw-video-toggle", "data-sw-video-toggle": "", "aria-pressed": "false", hidden: true, children: "Pause background video" })] })) : image ? (_jsx(ResponsiveImage, { className: "sw-section__bg", src: image, alt: "", media: backgroundMedia, sizes: "100vw", loading: backgroundPriority ? 'eager' : 'lazy', priority: backgroundPriority ? 'high' : 'auto' })) : null, image && ov !== 'none' ? _jsx("span", { className: "sw-section__overlay", "aria-hidden": "true" }) : null, _jsx("div", { className: cx('sw-container', width === 'narrow' && 'sw-container--narrow', width === 'wide' && 'sw-container--wide'), children: _jsx(Content, { className: "sw-section__body" }) })] }));
471
548
  },
472
549
  },
550
+ // Jump links to the page's headings, filled in by the server (see src/toc.tsx).
551
+ OnThisPage: onThisPageComponent,
473
552
  Columns: {
474
553
  label: 'Columns',
475
554
  fields: {
@@ -577,7 +656,7 @@ const spaceOptions = [
577
656
  { label: 'L', value: 'l' },
578
657
  { label: 'XL', value: 'xl' },
579
658
  ];
580
- export const SPACED_BLOCKS = ['Section', 'Columns', 'Divider', 'Heading', 'Text', 'Image', 'Gallery', 'Video', 'Search', 'Ask', 'Embed', 'Lottie', 'Model3D', 'Button', 'Buttons', 'Hero', 'CallToAction', 'Cards', 'Faq', 'Testimonials', 'Stats', 'LogoStrip', 'Scrollytelling', 'Collection', 'Calendar', 'Form'];
659
+ export const SPACED_BLOCKS = ['Section', 'Columns', 'Tabs', 'Accordion', 'Carousel', 'OnThisPage', 'Divider', 'Heading', 'Text', 'Image', 'Gallery', 'Video', 'Search', 'Ask', 'Embed', 'Lottie', 'Model3D', 'Button', 'Buttons', 'Hero', 'CallToAction', 'Cards', 'Faq', 'Testimonials', 'Stats', 'LogoStrip', 'Scrollytelling', 'Collection', 'Calendar', 'MiniCalendar', 'Form'];
581
660
  /** The classes for a block's Space above and Space below; unknown values are ignored. */
582
661
  export function spacingClasses(props) {
583
662
  const out = [];
@@ -592,8 +671,8 @@ export function spacingClasses(props) {
592
671
  /** Blocks whose items (cards, images, logos, quotes, buttons, list items) can arrive one after another and respond to hover. */
593
672
  export const MOTION_ITEM_BLOCKS = ['Image', 'Gallery', 'Buttons', 'Button', 'Cards', 'Faq', 'Testimonials', 'Stats', 'LogoStrip', 'Collection'];
594
673
  const ENTRANCE_LABELS = { none: 'None', fade: 'Fade in', rise: 'Rise', scale: 'Scale up', 'slide-left': 'Slide from the left', 'slide-right': 'Slide from the right' };
595
- /** Blocks with a background image that parallax can move. */
596
- export const MOTION_PARALLAX_BLOCKS = ['Hero'];
674
+ /** Blocks with a background image that parallax can move (a Section's only when it has one). */
675
+ export const MOTION_PARALLAX_BLOCKS = ['Hero', 'Section'];
597
676
  const SCROLL_LABELS = { none: 'None', parallax: 'Parallax background', 'fade-out': 'Fade out as it leaves', pin: 'Pin while the next blocks scroll over' };
598
677
  const HOVER_LABELS = { none: 'None', lift: 'Lift', zoom: 'Zoom the image', tilt: 'Tilt (expressive brands only)' };
599
678
  const DELAYS = ['none', 'short', 'medium'];
@@ -625,13 +704,17 @@ export const MOTION_SCRIPT_BLOCKS = ['Scrollytelling', 'Lottie', 'Model3D'];
625
704
  export const PLAYER_BLOCKS = ['Lottie', 'Model3D'];
626
705
  /**
627
706
  * Whether a block asks for any motion (the page then carries the motion script): Motion settings, Stats that count up, a marquee,
628
- * a Hero's video, a muted Video that plays on its own, or a block in MOTION_SCRIPT_BLOCKS (pass its type).
707
+ * a Hero's video, a muted Video that plays on its own, a Carousel that plays on its own, or a block in MOTION_SCRIPT_BLOCKS (pass
708
+ * its type).
629
709
  */
630
710
  export function hasMotion(props, type) {
631
711
  if (type && MOTION_SCRIPT_BLOCKS.includes(type))
632
712
  return true;
633
713
  if (type === 'Video' && props?.autoplay === true && props?.muted === true)
634
714
  return true;
715
+ // Autoplay counts as motion: the brand's level gates it, and the page gets the visitor's Reduce motion switch.
716
+ if (type === 'Carousel' && props?.autoplay === true)
717
+ return true;
635
718
  // A module block resolved as a scene (its props carry `scene`).
636
719
  if (type === 'ModuleBlock' && props?.scene)
637
720
  return true;