@sinnstack/ui 0.0.0-stage → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (306) hide show
  1. package/CHANGELOG.md +89 -0
  2. package/LICENSE +373 -0
  3. package/README.md +188 -2
  4. package/docs/blocks.md +373 -0
  5. package/docs/data.md +128 -0
  6. package/docs/finishes.md +165 -0
  7. package/docs/motion.md +166 -0
  8. package/docs/primitives.md +510 -0
  9. package/docs/seo.md +191 -0
  10. package/docs/tokens.md +122 -0
  11. package/package.json +132 -3
  12. package/scripts/check-contrast.mjs +180 -0
  13. package/src/blocks/BlockRenderer.astro +60 -0
  14. package/src/blocks/CTABanner.astro +121 -0
  15. package/src/blocks/CTAPair.astro +110 -0
  16. package/src/blocks/CardGrid.astro +167 -0
  17. package/src/blocks/ConsentEmbed.astro +125 -0
  18. package/src/blocks/ConsentManager.astro +147 -0
  19. package/src/blocks/ConsentScript.astro +47 -0
  20. package/src/blocks/ContactCard.astro +164 -0
  21. package/src/blocks/ContactForm.astro +224 -0
  22. package/src/blocks/ErrorPage.astro +242 -0
  23. package/src/blocks/FAQ.astro +135 -0
  24. package/src/blocks/FeatureGrid.astro +148 -0
  25. package/src/blocks/Hero.astro +171 -0
  26. package/src/blocks/HeroCarousel.astro +220 -0
  27. package/src/blocks/HighlightCards.astro +107 -0
  28. package/src/blocks/LocationHours.astro +311 -0
  29. package/src/blocks/LogoCloud.astro +135 -0
  30. package/src/blocks/MaintenancePage.astro +173 -0
  31. package/src/blocks/MediaText.astro +177 -0
  32. package/src/blocks/PageHeader.astro +126 -0
  33. package/src/blocks/ProseSection.astro +98 -0
  34. package/src/blocks/Reviews.astro +194 -0
  35. package/src/blocks/RichText.astro +58 -0
  36. package/src/blocks/StatsBand.astro +117 -0
  37. package/src/blocks/Steps.astro +141 -0
  38. package/src/blocks/Testimonials.astro +144 -0
  39. package/src/blocks/Topbar.astro +158 -0
  40. package/src/blocks/cms/card-grid.ts +48 -0
  41. package/src/blocks/cms/consent.ts +16 -0
  42. package/src/blocks/cms/contact-card.ts +46 -0
  43. package/src/blocks/cms/contact-form.ts +37 -0
  44. package/src/blocks/cms/cta-banner.ts +27 -0
  45. package/src/blocks/cms/cta-pair.ts +30 -0
  46. package/src/blocks/cms/data-base.ts +5 -0
  47. package/src/blocks/cms/data.ts +257 -0
  48. package/src/blocks/cms/faq.ts +38 -0
  49. package/src/blocks/cms/feature-grid.ts +47 -0
  50. package/src/blocks/cms/fixtures.ts +591 -0
  51. package/src/blocks/cms/hero-carousel.ts +36 -0
  52. package/src/blocks/cms/hero.ts +33 -0
  53. package/src/blocks/cms/highlight-cards.ts +41 -0
  54. package/src/blocks/cms/images.ts +37 -0
  55. package/src/blocks/cms/index.ts +59 -0
  56. package/src/blocks/cms/location-hours.ts +67 -0
  57. package/src/blocks/cms/logo-cloud.ts +36 -0
  58. package/src/blocks/cms/media-text.ts +26 -0
  59. package/src/blocks/cms/page-header.ts +27 -0
  60. package/src/blocks/cms/pages.ts +35 -0
  61. package/src/blocks/cms/prose-section.ts +25 -0
  62. package/src/blocks/cms/reviews.ts +50 -0
  63. package/src/blocks/cms/schema-dsl.ts +134 -0
  64. package/src/blocks/cms/schema.ts +794 -0
  65. package/src/blocks/cms/shared.ts +63 -0
  66. package/src/blocks/cms/stats-band.ts +35 -0
  67. package/src/blocks/cms/steps.ts +40 -0
  68. package/src/blocks/cms/testimonials.ts +46 -0
  69. package/src/blocks/cms/topbar.ts +27 -0
  70. package/src/blocks/cms/types.ts +27 -0
  71. package/src/blocks/consent.ts +14 -0
  72. package/src/blocks/icons.ts +47 -0
  73. package/src/blocks/index.ts +42 -0
  74. package/src/blocks/internal/Actions.astro +35 -0
  75. package/src/blocks/internal/BlockHeader.astro +45 -0
  76. package/src/blocks/internal/BlockShell.astro +58 -0
  77. package/src/blocks/internal/CarouselScript.astro +7 -0
  78. package/src/blocks/internal/ConsentEmbedScript.astro +7 -0
  79. package/src/blocks/internal/ConsentManagerScript.astro +7 -0
  80. package/src/blocks/internal/HoursScript.astro +7 -0
  81. package/src/blocks/internal/Placeholder.astro +13 -0
  82. package/src/blocks/internal/RichTextNode.astro +133 -0
  83. package/src/blocks/internal/StandaloneDocument.astro +53 -0
  84. package/src/blocks/internal/consent.ts +96 -0
  85. package/src/blocks/internal/fields.ts +18 -0
  86. package/src/blocks/internal/registry-contract.ts +67 -0
  87. package/src/blocks/internal/reviews.ts +22 -0
  88. package/src/blocks/internal/slug.ts +12 -0
  89. package/src/blocks/internal/util.ts +23 -0
  90. package/src/blocks/lib/contact.ts +92 -0
  91. package/src/blocks/lib/error-pages.ts +119 -0
  92. package/src/blocks/lib/faq.ts +37 -0
  93. package/src/blocks/lib/hours.ts +201 -0
  94. package/src/blocks/lib/maintenance.ts +129 -0
  95. package/src/blocks/lib/markdown.ts +350 -0
  96. package/src/blocks/lib/rich-text.ts +132 -0
  97. package/src/blocks/registry.ts +79 -0
  98. package/src/blocks/scripts/carousel.ts +218 -0
  99. package/src/blocks/scripts/consent-embed.ts +105 -0
  100. package/src/blocks/scripts/consent-manager.ts +112 -0
  101. package/src/blocks/scripts/consent-store.ts +86 -0
  102. package/src/blocks/scripts/error-page.ts +71 -0
  103. package/src/blocks/scripts/hours.ts +107 -0
  104. package/src/blocks/scripts/maintenance.ts +109 -0
  105. package/src/blocks/styles/blocks.css +1320 -0
  106. package/src/blocks/styles/consent.css +102 -0
  107. package/src/blocks/styles/faq.css +28 -0
  108. package/src/blocks/styles/location.css +92 -0
  109. package/src/blocks/styles/prose-section.css +13 -0
  110. package/src/blocks/styles/quotes.css +123 -0
  111. package/src/blocks/styles/rich-text.css +14 -0
  112. package/src/blocks/types.ts +293 -0
  113. package/src/data/ChartAxis.astro +19 -0
  114. package/src/data/ChartContainer.astro +152 -0
  115. package/src/data/ChartLegend.astro +25 -0
  116. package/src/data/ChartSeries.astro +14 -0
  117. package/src/data/ChartTable.astro +17 -0
  118. package/src/data/ChartTooltip.astro +20 -0
  119. package/src/data/Sparkline.astro +55 -0
  120. package/src/data/cms.ts +130 -0
  121. package/src/data/index.ts +10 -0
  122. package/src/data/internal/scale.ts +107 -0
  123. package/src/data/lib/chart.ts +459 -0
  124. package/src/data/lib/render.ts +219 -0
  125. package/src/data/lib/sparkline.ts +117 -0
  126. package/src/data/schema.ts +65 -0
  127. package/src/data/scripts/chart.ts +324 -0
  128. package/src/data/styles/chart.css +392 -0
  129. package/src/finishes/aurora.css +75 -0
  130. package/src/finishes/autumn.css +87 -0
  131. package/src/finishes/blueprint.css +69 -0
  132. package/src/finishes/brutalist.css +55 -0
  133. package/src/finishes/clay.css +48 -0
  134. package/src/finishes/day-cycle.css +46 -0
  135. package/src/finishes/fog.css +71 -0
  136. package/src/finishes/glass.css +149 -0
  137. package/src/finishes/holographic.css +91 -0
  138. package/src/finishes/night.css +77 -0
  139. package/src/finishes/paper.css +58 -0
  140. package/src/finishes/polished-glass.css +159 -0
  141. package/src/finishes/rain.css +84 -0
  142. package/src/finishes/scripts/day-cycle.ts +30 -0
  143. package/src/finishes/scripts/holographic.ts +37 -0
  144. package/src/finishes/scripts/spotlight.ts +30 -0
  145. package/src/finishes/spotlight.css +41 -0
  146. package/src/finishes/spring.css +80 -0
  147. package/src/finishes/terminal.css +49 -0
  148. package/src/motion/Marquee.astro +90 -0
  149. package/src/motion/MotionProvider.astro +50 -0
  150. package/src/motion/PageTransitions.astro +61 -0
  151. package/src/motion/Parallax.astro +44 -0
  152. package/src/motion/ParallaxLayer.astro +31 -0
  153. package/src/motion/RevealOnScroll.astro +59 -0
  154. package/src/motion/SceneRegistry.astro +38 -0
  155. package/src/motion/ScrollScene.astro +81 -0
  156. package/src/motion/index.ts +12 -0
  157. package/src/motion/integration.ts +48 -0
  158. package/src/motion/runtime/page-transitions.ts +68 -0
  159. package/src/motion/runtime/runtime.ts +180 -0
  160. package/src/motion/runtime/scenes.ts +248 -0
  161. package/src/motion/runtime/types.ts +103 -0
  162. package/src/motion/styles/motion.css +332 -0
  163. package/src/motion/transitions.ts +74 -0
  164. package/src/motion/virtual.d.ts +4 -0
  165. package/src/primitives/Accordion.astro +129 -0
  166. package/src/primitives/Breadcrumbs.astro +50 -0
  167. package/src/primitives/BulletList.astro +69 -0
  168. package/src/primitives/Button.astro +73 -0
  169. package/src/primitives/ButtonGroup.astro +54 -0
  170. package/src/primitives/Callout.astro +137 -0
  171. package/src/primitives/Caption.astro +35 -0
  172. package/src/primitives/Card.astro +72 -0
  173. package/src/primitives/CardContent.astro +24 -0
  174. package/src/primitives/CardFooter.astro +36 -0
  175. package/src/primitives/CardHeader.astro +86 -0
  176. package/src/primitives/Checkbox.astro +38 -0
  177. package/src/primitives/ChoiceGroup.astro +23 -0
  178. package/src/primitives/Cluster.astro +49 -0
  179. package/src/primitives/Container.astro +44 -0
  180. package/src/primitives/DescriptionList.astro +83 -0
  181. package/src/primitives/Dialog.astro +38 -0
  182. package/src/primitives/Disclosure.astro +67 -0
  183. package/src/primitives/Divider.astro +93 -0
  184. package/src/primitives/Drawer.astro +33 -0
  185. package/src/primitives/Fieldset.astro +80 -0
  186. package/src/primitives/Flex.astro +64 -0
  187. package/src/primitives/FocusRing.astro +63 -0
  188. package/src/primitives/FocusTrap.astro +64 -0
  189. package/src/primitives/Footer.astro +155 -0
  190. package/src/primitives/Form.astro +68 -0
  191. package/src/primitives/FormDescription.astro +26 -0
  192. package/src/primitives/FormError.astro +106 -0
  193. package/src/primitives/FormField.astro +72 -0
  194. package/src/primitives/Grid.astro +64 -0
  195. package/src/primitives/Heading.astro +45 -0
  196. package/src/primitives/IconButton.astro +48 -0
  197. package/src/primitives/Image.astro +125 -0
  198. package/src/primitives/Input.astro +86 -0
  199. package/src/primitives/Label.astro +50 -0
  200. package/src/primitives/Link.astro +81 -0
  201. package/src/primitives/LinkButton.astro +66 -0
  202. package/src/primitives/List.astro +39 -0
  203. package/src/primitives/ListItem.astro +178 -0
  204. package/src/primitives/MediaObject.astro +66 -0
  205. package/src/primitives/MetricCard.astro +278 -0
  206. package/src/primitives/NavLink.astro +81 -0
  207. package/src/primitives/NavMenu.astro +109 -0
  208. package/src/primitives/Navbar.astro +197 -0
  209. package/src/primitives/Panel.astro +153 -0
  210. package/src/primitives/Picture.astro +167 -0
  211. package/src/primitives/Popover.astro +95 -0
  212. package/src/primitives/Prose.astro +45 -0
  213. package/src/primitives/Radio.astro +21 -0
  214. package/src/primitives/Rating.astro +135 -0
  215. package/src/primitives/ReducedMotion.astro +90 -0
  216. package/src/primitives/SegmentedControl.astro +132 -0
  217. package/src/primitives/Select.astro +109 -0
  218. package/src/primitives/Sheet.astro +45 -0
  219. package/src/primitives/SkipLink.astro +31 -0
  220. package/src/primitives/Slider.astro +186 -0
  221. package/src/primitives/Spacer.astro +35 -0
  222. package/src/primitives/Stack.astro +51 -0
  223. package/src/primitives/Surface.astro +70 -0
  224. package/src/primitives/Switch.astro +22 -0
  225. package/src/primitives/Table.astro +382 -0
  226. package/src/primitives/Tabs.astro +126 -0
  227. package/src/primitives/Text.astro +56 -0
  228. package/src/primitives/Textarea.astro +75 -0
  229. package/src/primitives/Thumbnail.astro +154 -0
  230. package/src/primitives/Toggle.astro +99 -0
  231. package/src/primitives/Tooltip.astro +50 -0
  232. package/src/primitives/VisuallyHidden.astro +29 -0
  233. package/src/primitives/index.ts +103 -0
  234. package/src/primitives/internal/AccordionScript.astro +7 -0
  235. package/src/primitives/internal/ChoiceField.astro +91 -0
  236. package/src/primitives/internal/FocusTrapScript.astro +8 -0
  237. package/src/primitives/internal/FormValidationScript.astro +10 -0
  238. package/src/primitives/internal/IndeterminateScript.astro +13 -0
  239. package/src/primitives/internal/ModalPanel.astro +114 -0
  240. package/src/primitives/internal/OverlayScript.astro +7 -0
  241. package/src/primitives/internal/ReducedMotionScript.astro +7 -0
  242. package/src/primitives/internal/SliderScript.astro +7 -0
  243. package/src/primitives/internal/SparklineScript.astro +7 -0
  244. package/src/primitives/internal/TableSortScript.astro +7 -0
  245. package/src/primitives/internal/TabsScript.astro +7 -0
  246. package/src/primitives/internal/TooltipScript.astro +7 -0
  247. package/src/primitives/internal/image-plan.ts +82 -0
  248. package/src/primitives/internal/image.ts +129 -0
  249. package/src/primitives/internal/slider.ts +170 -0
  250. package/src/primitives/lib/deprecate.ts +47 -0
  251. package/src/primitives/lib/focus-trap.ts +197 -0
  252. package/src/primitives/lib/focus.ts +60 -0
  253. package/src/primitives/lib/motion.ts +68 -0
  254. package/src/primitives/scripts/accordion.ts +123 -0
  255. package/src/primitives/scripts/form-validation.ts +225 -0
  256. package/src/primitives/scripts/overlay.ts +71 -0
  257. package/src/primitives/scripts/reduced-motion.ts +59 -0
  258. package/src/primitives/scripts/slider.ts +150 -0
  259. package/src/primitives/scripts/sparkline.ts +131 -0
  260. package/src/primitives/scripts/table-sort.ts +68 -0
  261. package/src/primitives/scripts/tabs.ts +151 -0
  262. package/src/primitives/scripts/tooltip.ts +28 -0
  263. package/src/primitives/styles/a11y.css +104 -0
  264. package/src/primitives/styles/accordion.css +53 -0
  265. package/src/primitives/styles/breadcrumbs.css +59 -0
  266. package/src/primitives/styles/bullet-list.css +89 -0
  267. package/src/primitives/styles/button.css +237 -0
  268. package/src/primitives/styles/choice.css +164 -0
  269. package/src/primitives/styles/cluster.css +24 -0
  270. package/src/primitives/styles/container.css +19 -0
  271. package/src/primitives/styles/data.css +849 -0
  272. package/src/primitives/styles/disclosure.css +140 -0
  273. package/src/primitives/styles/divider.css +50 -0
  274. package/src/primitives/styles/flex.css +42 -0
  275. package/src/primitives/styles/form.css +241 -0
  276. package/src/primitives/styles/grid.css +36 -0
  277. package/src/primitives/styles/media.css +247 -0
  278. package/src/primitives/styles/nav.css +792 -0
  279. package/src/primitives/styles/overlay.css +362 -0
  280. package/src/primitives/styles/prose.css +146 -0
  281. package/src/primitives/styles/scale.css +175 -0
  282. package/src/primitives/styles/segmented.css +165 -0
  283. package/src/primitives/styles/slider.css +170 -0
  284. package/src/primitives/styles/spacer.css +17 -0
  285. package/src/primitives/styles/stack.css +25 -0
  286. package/src/primitives/styles/surface.css +403 -0
  287. package/src/primitives/styles/tabs.css +223 -0
  288. package/src/primitives/styles/typography.css +144 -0
  289. package/src/primitives/styles/utilities.css +24 -0
  290. package/src/primitives/types.ts +385 -0
  291. package/src/primitives/utils.ts +254 -0
  292. package/src/seo/JSONLD.astro +35 -0
  293. package/src/seo/SEOHead.astro +47 -0
  294. package/src/seo/cms.ts +59 -0
  295. package/src/seo/index.ts +10 -0
  296. package/src/seo/integration.ts +268 -0
  297. package/src/seo/internal/url.ts +68 -0
  298. package/src/seo/lib/jsonld.ts +342 -0
  299. package/src/seo/lib/meta.ts +205 -0
  300. package/src/seo/lib/redirects.ts +293 -0
  301. package/src/seo/lib/robots.ts +33 -0
  302. package/src/seo/lib/rss.ts +98 -0
  303. package/src/seo/lib/sitemap.ts +105 -0
  304. package/src/seo/schema.ts +43 -0
  305. package/src/tokens/base.css +71 -0
  306. package/src/tokens/tokens.css +210 -0
@@ -0,0 +1,60 @@
1
+ ---
2
+ /**
3
+ * BlockRenderer — renders a page's list of CMS blocks through the registry.
4
+ *
5
+ * - Picks each block's component by `_template` and maps the CMS data to props.
6
+ * - With `fieldPath` (the key the blocks are stored under, e.g. "blocks"), each block gets its
7
+ * path (`blocks.2`) and renders `data-sinn-field` attributes for SinnStackCMS visual editing.
8
+ * Leave it off in production for clean HTML.
9
+ * - Heading levels are decided here, not by editors: the first block that can hold the page title
10
+ * (Hero or PageHeader, `h1: true` in the registry) is the page's h1 (unless `pageHasH1`);
11
+ * every other block heading is h2.
12
+ * - Unknown templates are skipped (with a placeholder in dev/preview, so editors notice).
13
+ * - Images: pass `resolveImage` (see createImageResolver) so CMS paths become optimized assets.
14
+ *
15
+ * @example
16
+ * <BlockRenderer blocks={page.blocks} resolveImage={resolveImage} />
17
+ */
18
+ import { blockRegistry, type BlockRegistry } from './registry';
19
+ import { templateName } from './cms/index';
20
+ import { noImages } from './cms/images';
21
+ import type { ImageResolver } from './cms/types';
22
+ import Placeholder from './internal/Placeholder.astro';
23
+ import { PLACEHOLDER_DEFAULT } from './internal/util';
24
+
25
+ type Props = {
26
+ blocks?: Array<Record<string, any> | null | undefined> | null;
27
+ registry?: BlockRegistry;
28
+ resolveImage?: ImageResolver;
29
+ /** Show placeholders for empty or unknown blocks (default: on in dev). Turn on in CMS preview. */
30
+ placeholder?: boolean;
31
+ /** The layout already renders an h1, so no hero should. */
32
+ pageHasH1?: boolean;
33
+ /** Where `blocks` sits in the content entry (e.g. "blocks"). Turns on `data-sinn-field` annotations. */
34
+ fieldPath?: string;
35
+ };
36
+
37
+ const { blocks = [], registry = blockRegistry, resolveImage = noImages, placeholder = PLACEHOLDER_DEFAULT, pageHasH1 = false, fieldPath } = Astro.props;
38
+
39
+ let h1Used = pageHasH1;
40
+ type Rendered = { name: string | undefined; entry: BlockRegistry[string] | undefined; props: Record<string, unknown> };
41
+ const rendered = (blocks ?? []).flatMap((block, index): Rendered[] => {
42
+ if (!block) return [];
43
+ const name = templateName(block);
44
+ const entry = name ? registry[name] : undefined;
45
+ if (!entry) {
46
+ if (import.meta.env?.DEV) console.warn(`[BlockRenderer] No block registered for "${name ?? '(unknown)'}".`);
47
+ return [{ name, entry: undefined, props: {} }];
48
+ }
49
+ const headingLevel = (entry.h1 ?? name === 'hero') && !h1Used ? 1 : 2;
50
+ if (headingLevel === 1) h1Used = true;
51
+ const props = entry.toProps(block, { resolveImage, headingLevel, placeholder });
52
+ return [{ name, entry, props: { ...props, fieldPath: fieldPath ? `${fieldPath}.${index}` : undefined } }];
53
+ });
54
+ ---
55
+
56
+ {
57
+ rendered.map(({ name, entry, props }) =>
58
+ entry ? <entry.component {...props} /> : placeholder && <Placeholder label={`Unknown block "${name ?? '?'}"`} hint="Register it in the block registry." />,
59
+ )
60
+ }
@@ -0,0 +1,121 @@
1
+ ---
2
+ /**
3
+ * CTABanner — one prominent call to action in its own band, usually near the end of a page.
4
+ *
5
+ * - One idea, one primary action. `actions` makes the first solid and the rest outline; on the
6
+ * solid panel, buttons, links and the focus ring recolor themselves to keep contrast.
7
+ * - `variant`: `solid` (solid tone color), `soft` (tinted) or `outline`: the same words as Button.
8
+ * `tone`: `accent` or `neutral` (near-black in light mode, near-white in dark).
9
+ * `filled` and `subtle` are the deprecated names for `solid` and `soft`.
10
+ * - `bleed`: runs edge to edge instead of a rounded panel inside the container.
11
+ * - Wide containers put text and actions side by side; narrow ones stack. `align="center"` always
12
+ * stacks and centers.
13
+ * - Slots: `actions`, `note` (small print), `heading`/`description` for markup, default for extras.
14
+ * - Placeholder: with no heading, a dashed placeholder in dev/CMS preview, nothing in builds.
15
+ *
16
+ * @example
17
+ * <CTABanner heading="Ready to start your project?" description="Book a call or send us a brief."
18
+ * actions={[{ label: 'Book a visit', href: '/book' }, { label: 'Call (817) 555-0100', href: 'tel:+18175550100' }]}
19
+ * note="Most visits start within 48 hours." />
20
+ */
21
+ import Container from '../primitives/Container.astro';
22
+ import Heading from '../primitives/Heading.astro';
23
+ import Text from '../primitives/Text.astro';
24
+ import type { HTMLAttributes } from 'astro/types';
25
+ import type { ActionItem, BlockProps, HeadingLevelNumber } from './types';
26
+ import Actions from './internal/Actions.astro';
27
+ import Placeholder from './internal/Placeholder.astro';
28
+ import { blockIds, PLACEHOLDER_DEFAULT } from './internal/util';
29
+ import { sf, joinField } from './internal/fields';
30
+ import './styles/blocks.css';
31
+ import { renameValue } from '../primitives/lib/deprecate';
32
+
33
+ type Props = Omit<HTMLAttributes<'section'>, 'title'> &
34
+ Omit<BlockProps, 'background'> & {
35
+ heading?: string;
36
+ description?: string;
37
+ actions?: ActionItem[];
38
+ note?: string;
39
+ headingLevel?: HeadingLevelNumber;
40
+ variant?: 'solid' | 'soft' | 'outline' | 'filled' | 'subtle';
41
+ /** Full-width band (no rounded corners) instead of a panel inside the container. */
42
+ bleed?: boolean;
43
+ /** Panel padding and heading size. */
44
+ size?: 'm' | 'l';
45
+ };
46
+
47
+ const {
48
+ heading,
49
+ description,
50
+ actions = [],
51
+ note,
52
+ headingLevel = 2,
53
+ variant: variantProp = 'solid',
54
+ tone = 'accent',
55
+ align = 'start',
56
+ bleed = false,
57
+ size = 'm',
58
+ anchor,
59
+ spacing = 'm',
60
+ scheme,
61
+ containerSize = 'default',
62
+ placeholder = PLACEHOLDER_DEFAULT,
63
+ fieldPath,
64
+ id,
65
+ class: className,
66
+ ...rest
67
+ } = Astro.props;
68
+
69
+ const slots = Astro.slots;
70
+ const hasHeading = Boolean(heading?.trim()) || slots.has('heading');
71
+ const { sectionId, headingId } = blockIds('cta', anchor, id);
72
+ const variant = renameValue('CTABanner', 'variant', variantProp, { filled: 'solid', subtle: 'soft' });
73
+ const surface = variant === 'solid' ? 'strong' : variant === 'soft' ? 'tinted' : undefined;
74
+ const hasAside = actions.length > 0 || slots.has('actions') || Boolean(note) || slots.has('note');
75
+ ---
76
+
77
+ {
78
+ !hasHeading ? (
79
+ placeholder && <Placeholder label="Call to action" hint="Add a heading and at least one action." field={joinField(fieldPath)} />
80
+ ) : (
81
+ <section
82
+ id={sectionId}
83
+ class:list={['sinn-block', 'sinn-cta', className]}
84
+ data-variant={variant}
85
+ data-spacing={spacing === 'l' ? undefined : spacing}
86
+ data-scheme={scheme}
87
+ data-size={size === 'm' ? undefined : size}
88
+ data-align={align === 'center' ? 'center' : undefined}
89
+ data-bleed={bleed ? '' : undefined}
90
+ aria-labelledby={headingId}
91
+ {...sf(fieldPath)}
92
+ {...rest}
93
+ >
94
+ <Container size={bleed ? 'full' : containerSize} gutter={bleed ? 'none' : 'm'} query={false}>
95
+ <div class="sinn-cta__panel" data-surface={surface} data-tone={surface ? tone : undefined}>
96
+ <Container size={bleed ? containerSize : 'full'} gutter={bleed ? 'm' : 'none'} query={false} class="sinn-cta__inner">
97
+ <div class="sinn-cta__text">
98
+ <Heading level={headingLevel} size={size === 'l' ? '3xl' : '2xl'} weight="bold" id={headingId} class="sinn-cta__title" {...sf(fieldPath, 'heading')}>
99
+ {slots.has('heading') ? <slot name="heading" /> : heading}
100
+ </Heading>
101
+ {(description || slots.has('description')) && (
102
+ <Text size="l" class="sinn-cta__description" measure {...sf(fieldPath, 'description')}>
103
+ {slots.has('description') ? <slot name="description" /> : description}
104
+ </Text>
105
+ )}
106
+ <slot />
107
+ </div>
108
+ {hasAside && (
109
+ <div class="sinn-cta__aside">
110
+ <Actions actions={actions} class="sinn-cta__actions" fieldPath={fieldPath}>
111
+ {slots.has('actions') && <slot name="actions" />}
112
+ </Actions>
113
+ {(note || slots.has('note')) && <p class="sinn-cta__note" {...sf(fieldPath, 'note')}>{slots.has('note') ? <slot name="note" /> : note}</p>}
114
+ </div>
115
+ )}
116
+ </Container>
117
+ </div>
118
+ </Container>
119
+ </section>
120
+ )
121
+ }
@@ -0,0 +1,110 @@
1
+ ---
2
+ /**
3
+ * CTAPair — two calls to action side by side, each on its own colored panel: "We're here 24/7 →
4
+ * Get in touch" beside "Agency partner? → Send a brief". Use it to split two audiences.
5
+ *
6
+ * - Two panels (a third is ignored: two choices read as a fork, more as a menu). One panel is
7
+ * fine too, but then a CTABanner is usually the better fit.
8
+ * - Each panel is a strong surface: text, buttons and the focus ring recolor for contrast. `tone`
9
+ * per panel; by default the first is `accent` and the second `neutral`, so they read as two.
10
+ * - `bleed` (default): panels run edge to edge with no gap, as a full-width band. Otherwise they
11
+ * are rounded panels inside the container.
12
+ * - Panels sit side by side when the container is at least ~40rem wide; below that they stack.
13
+ * - The section has no heading of its own; pass `label` to name it as a landmark ("Get in touch").
14
+ * Panel headings are h2 (`headingLevel` overrides).
15
+ * - Placeholder: no panel with a heading → dashed placeholder in dev/CMS preview, nothing in builds.
16
+ *
17
+ * @example
18
+ * <CTAPair label="Get in touch" items={[
19
+ * { heading: 'We are here for you 24/7', actions: [{ label: 'Get in touch', href: '/contact' }] },
20
+ * { heading: 'Agency partner?', actions: [{ label: 'Partner program', href: '/partners' }] },
21
+ * ]} />
22
+ */
23
+ import Container from '../primitives/Container.astro';
24
+ import Heading from '../primitives/Heading.astro';
25
+ import Text from '../primitives/Text.astro';
26
+ import type { HTMLAttributes } from 'astro/types';
27
+ import type { BlockProps, CtaPanelItem, HeadingLevelNumber } from './types';
28
+ import Actions from './internal/Actions.astro';
29
+ import Placeholder from './internal/Placeholder.astro';
30
+ import { blockIds, slugify, PLACEHOLDER_DEFAULT } from './internal/util';
31
+ import { sf, joinField } from './internal/fields';
32
+ import './styles/blocks.css';
33
+
34
+ type Props = Omit<HTMLAttributes<'section'>, 'title'> &
35
+ Omit<BlockProps, 'background' | 'tone'> & {
36
+ items?: CtaPanelItem[];
37
+ /** Accessible name for the section (it has no visible heading of its own). */
38
+ label?: string;
39
+ headingLevel?: HeadingLevelNumber;
40
+ /** Full-width band with no gaps (default) or rounded panels inside the container. */
41
+ bleed?: boolean;
42
+ /** Panel padding and heading size. */
43
+ size?: 'm' | 'l';
44
+ };
45
+
46
+ const {
47
+ items = [],
48
+ label,
49
+ headingLevel = 2,
50
+ bleed = true,
51
+ size = 'm',
52
+ align = 'center',
53
+ anchor,
54
+ spacing = bleed ? 'none' : 'm',
55
+ scheme,
56
+ containerSize = 'default',
57
+ placeholder = PLACEHOLDER_DEFAULT,
58
+ fieldPath,
59
+ id,
60
+ class: className,
61
+ ...rest
62
+ } = Astro.props;
63
+
64
+ const panels = (items ?? []).filter((p) => p && String(p.heading ?? '').trim()).slice(0, 2);
65
+ if ((items ?? []).length > 2 && import.meta.env?.DEV) console.warn('[CTAPair] Only the first two panels are shown.');
66
+ const { sectionId } = blockIds('cta-pair', anchor, id);
67
+ const panelId = (i: number) => `${sectionId ?? 'sinn-cta-pair'}-${i}-${slugify(panels[i].heading).slice(0, 24) || 'panel'}`;
68
+ ---
69
+
70
+ {
71
+ panels.length === 0 ? (
72
+ placeholder && <Placeholder label="Two calls to action" hint="Add a heading and an action to each panel." field={joinField(fieldPath, 'items')} />
73
+ ) : (
74
+ <section
75
+ id={sectionId}
76
+ class:list={['sinn-block', 'sinn-cta-pair', className]}
77
+ aria-label={label || undefined}
78
+ data-spacing={spacing === 'l' ? undefined : spacing}
79
+ data-scheme={scheme}
80
+ data-size={size === 'm' ? undefined : size}
81
+ data-align={align === 'center' ? 'center' : undefined}
82
+ data-bleed={bleed ? '' : undefined}
83
+ data-count={panels.length}
84
+ {...sf(fieldPath)}
85
+ {...rest}
86
+ >
87
+ <Container size={bleed ? 'full' : containerSize} gutter={bleed ? 'none' : 'm'} query={false}>
88
+ <ul class="sinn-cta-pair__list" role="list" {...sf(fieldPath, 'items')}>
89
+ {panels.map((panel, i) => {
90
+ const tone = panel.tone ?? (i === 0 ? 'accent' : 'neutral');
91
+ const hid = `${panelId(i)}-title`;
92
+ return (
93
+ <li class="sinn-cta-pair__panel" data-surface="strong" data-tone={tone} {...sf(fieldPath, panel.field)}>
94
+ <div class="sinn-cta-pair__inner">
95
+ <Heading level={headingLevel} size={size === 'l' ? '2xl' : 'xl'} weight="bold" id={hid} class="sinn-cta-pair__title" {...sf(fieldPath, panel.field, 'heading')}>
96
+ {panel.heading}
97
+ </Heading>
98
+ {panel.description && (
99
+ <Text class="sinn-cta-pair__description" {...sf(fieldPath, panel.field, 'description')}>{panel.description}</Text>
100
+ )}
101
+ <Actions actions={panel.actions ?? []} size="m" class="sinn-cta-pair__actions" fieldPath={joinField(fieldPath, panel.field)} />
102
+ </div>
103
+ </li>
104
+ );
105
+ })}
106
+ </ul>
107
+ </Container>
108
+ </section>
109
+ )
110
+ }
@@ -0,0 +1,167 @@
1
+ ---
2
+ /**
3
+ * CardGrid — a collection of cards (articles, locations, case studies, team) as a page section.
4
+ *
5
+ * - `items` is plain data; for custom cards put `<li><Card>…</Card></li>` in the default slot.
6
+ * - `layout`: `grid` (columns of vertical cards) or `list` (one column of horizontal cards,
7
+ * stacking on narrow containers). `featured`: in a grid, the first card spans two columns
8
+ * (side-by-side image and text) once there's room for it.
9
+ * - A card with `href` is one link (its title); the whole card is clickable.
10
+ * - Cards in a row share a height. `columns` is the maximum (never narrower than ~16rem).
11
+ * - Images use the primitives Image: reserved box (no layout shift), lazy, responsive `sizes`.
12
+ * `priorityCount` loads the first N eagerly when the grid is near the top of the page.
13
+ * - Card titles are one level below the section heading (`itemTitleLevel` overrides).
14
+ * - Empty: shows `emptyMessage` plus the `empty` slot (e.g. "Clear filters"). `emptyMessage=""`
15
+ * renders nothing (or a placeholder in dev/CMS preview).
16
+ * - Slot `footer`: pagination, "View all".
17
+ *
18
+ * @example
19
+ * <CardGrid heading="From the blog" variant="elevated" featured
20
+ * items={posts.map((p) => ({ title: p.title, description: p.summary, href: p.url, image: { src: p.cover, alt: '' }, meta: p.date }))} />
21
+ */
22
+ import Card from '../primitives/Card.astro';
23
+ import CardHeader from '../primitives/CardHeader.astro';
24
+ import CardContent from '../primitives/CardContent.astro';
25
+ import Text from '../primitives/Text.astro';
26
+ import Image from '../primitives/Image.astro';
27
+ import type { HTMLAttributes } from 'astro/types';
28
+ import type { BlockProps, CardItem, HeadingLevelNumber } from './types';
29
+ import BlockShell from './internal/BlockShell.astro';
30
+ import BlockHeader from './internal/BlockHeader.astro';
31
+ import Placeholder from './internal/Placeholder.astro';
32
+ import { blockIds, PLACEHOLDER_DEFAULT } from './internal/util';
33
+ import { sf, joinField } from './internal/fields';
34
+ import { renameProp, renameValue } from '../primitives/lib/deprecate';
35
+
36
+ type Props = Omit<HTMLAttributes<'section'>, 'title'> &
37
+ BlockProps & {
38
+ eyebrow?: string;
39
+ heading?: string;
40
+ description?: string;
41
+ headingLevel?: HeadingLevelNumber;
42
+ /** Heading level of each item's title. Default: one below the section heading. */
43
+ itemTitleLevel?: HeadingLevelNumber;
44
+ /** @deprecated Use `itemTitleLevel` (item text is `title`, so its level is `itemTitleLevel`). */
45
+ itemHeadingLevel?: HeadingLevelNumber;
46
+ items?: CardItem[];
47
+ layout?: 'grid' | 'list';
48
+ featured?: boolean;
49
+ columns?: 1 | 2 | 3 | 4;
50
+ variant?: 'outline' | 'elevated' | 'filled';
51
+ size?: 's' | 'm' | 'l';
52
+ /** Card title size: m (compact, bold: fits long titles on one line) · l (default). */
53
+ titleSize?: 'm' | 'l';
54
+ /** Image aspect ratio in CSS syntax (`16/9`), like Hero, MediaText and Card. The dash forms are deprecated. */
55
+ mediaAspect?: '16/9' | '3/2' | '4/3' | '1/1' | '16-9' | '3-2' | '4-3' | '1-1';
56
+ priorityCount?: number;
57
+ emptyMessage?: string;
58
+ };
59
+
60
+ const {
61
+ eyebrow,
62
+ heading,
63
+ description,
64
+ headingLevel = 2,
65
+ itemTitleLevel: itemTitleLevelProp,
66
+ itemHeadingLevel,
67
+ items = [],
68
+ layout = 'grid',
69
+ featured = false,
70
+ columns = 3,
71
+ variant = 'outline',
72
+ size = 'm',
73
+ titleSize = 'l',
74
+ mediaAspect: mediaAspectProp = '16/9',
75
+ priorityCount = 0,
76
+ emptyMessage = 'Nothing to show yet.',
77
+ align = 'start',
78
+ anchor,
79
+ spacing = 'l',
80
+ background = 'none',
81
+ tone = 'accent',
82
+ scheme,
83
+ containerSize = 'default',
84
+ placeholder = PLACEHOLDER_DEFAULT,
85
+ fieldPath,
86
+ id,
87
+ class: className,
88
+ ...rest
89
+ } = Astro.props;
90
+
91
+ const slots = Astro.slots;
92
+ const isEmpty = items.length === 0 && !slots.has('default');
93
+ const showEmpty = isEmpty && (Boolean(emptyMessage) || slots.has('empty'));
94
+ const { sectionId, headingId } = blockIds('cards', anchor, id);
95
+ const itemTitleLevel = renameProp('CardGrid', 'itemTitleLevel', itemTitleLevelProp, 'itemHeadingLevel', itemHeadingLevel);
96
+ const itemLevel = (itemTitleLevel ?? (heading ? Math.min(6, headingLevel + 1) : 3)) as HeadingLevelNumber;
97
+ const aspect = renameValue('CardGrid', 'mediaAspect', mediaAspectProp, { '16-9': '16/9', '3-2': '3/2', '4-3': '4/3', '1-1': '1/1' }) as '16/9' | '3/2' | '4/3' | '1/1';
98
+ const isList = layout === 'list';
99
+ const cols = isList ? 1 : columns;
100
+ // Width the image is shown at, for the responsive `sizes` hint.
101
+ const sizes = isList ? '(min-width: 48rem) 40vw, 100vw' : `(min-width: 64rem) ${Math.round(100 / cols)}vw, (min-width: 40rem) 50vw, 100vw`;
102
+ ---
103
+
104
+ {
105
+ isEmpty && !showEmpty ? (
106
+ placeholder && <Placeholder label="Card grid" hint="Add at least one card." field={joinField(fieldPath, 'items')} />
107
+ ) : (
108
+ <BlockShell
109
+ name="cards"
110
+ id={sectionId}
111
+ class={className}
112
+ spacing={spacing}
113
+ background={background}
114
+ tone={tone}
115
+ scheme={scheme}
116
+ containerSize={containerSize}
117
+ labelledby={heading ? headingId : undefined}
118
+ align={align}
119
+ data-title-size={titleSize === 'l' ? undefined : titleSize}
120
+ data-layout={isList ? 'list' : undefined}
121
+ data-featured={featured && !isList ? '' : undefined}
122
+ {...sf(fieldPath)}
123
+ {...rest}
124
+ >
125
+ <BlockHeader eyebrow={eyebrow} heading={heading} headingId={headingId} headingLevel={headingLevel} description={description} fieldPath={fieldPath} />
126
+ {showEmpty ? (
127
+ <div class="sinn-block__empty" role="status">
128
+ {emptyMessage && <Text tone="muted">{emptyMessage}</Text>}
129
+ {slots.has('empty') && <div class="sinn-block__empty-action"><slot name="empty" /></div>}
130
+ </div>
131
+ ) : (
132
+ <ul class="sinn-block__grid" role="list" data-columns={cols} {...sf(fieldPath, 'items')}>
133
+ {items.map((item, i) => {
134
+ const horizontal = isList || (featured && i === 0);
135
+ return (
136
+ <li data-featured-item={featured && !isList && i === 0 ? '' : undefined} {...sf(fieldPath, item.field)}>
137
+ <Card as="article" variant={variant} size={size} orientation={horizontal ? 'horizontal' : 'vertical'} mediaAspect={item.image ? (isList ? '4/3' : aspect) : undefined}>
138
+ {item.image && (
139
+ <Image
140
+ slot="media"
141
+ src={item.image.src}
142
+ alt={item.image.alt}
143
+ width={item.image.width}
144
+ height={item.image.height}
145
+ aspect={isList ? '4/3' : aspect}
146
+ layout="full"
147
+ sizes={sizes}
148
+ priority={i < priorityCount}
149
+ />
150
+ )}
151
+ <CardHeader eyebrow={item.eyebrow} title={item.title} titleLevel={itemLevel} titleSize={featured && i === 0 && !isList ? 'xl' : titleSize} href={item.href} description={item.description} />
152
+ {item.meta && (
153
+ <CardContent>
154
+ <Text size="xs" tone="muted">{item.meta}</Text>
155
+ </CardContent>
156
+ )}
157
+ </Card>
158
+ </li>
159
+ );
160
+ })}
161
+ <slot />
162
+ </ul>
163
+ )}
164
+ {slots.has('footer') && <div class="sinn-block__footer"><slot name="footer" /></div>}
165
+ </BlockShell>
166
+ )
167
+ }
@@ -0,0 +1,125 @@
1
+ ---
2
+ /**
3
+ * ConsentEmbed: a third-party iframe (Google Maps, YouTube, Vimeo, a booking widget) that
4
+ * loads only after consent.
5
+ *
6
+ * - Until then the iframe sits in an inert `<template>`, so the browser makes no request to the
7
+ * provider. In its place: who hosts it, what loading it shares, a "Load map" button (this
8
+ * embed, this visit, nothing stored), an "Always allow" button (saves consent for the category,
9
+ * so every embed of it loads) and a link to open it on the provider's site.
10
+ * - Once the category is allowed (here, in another embed or in ConsentManager) it loads at once,
11
+ * and keyboard focus moves into it if the visitor asked for it. Revoking unloads it again.
12
+ * - Without JavaScript only the link shows, so nothing third-party ever loads.
13
+ * - `title` is required: it names the iframe for screen readers ("Map of the Sinnstack studio").
14
+ * - The box keeps its `aspect` ratio before and after loading (no layout shift). `poster` shows
15
+ * a local still behind the notice (a screenshot of the map or the video's first frame).
16
+ * - Your CSP needs `frame-src` for the provider (e.g. `https://www.google.com`).
17
+ *
18
+ * @example
19
+ * <ConsentEmbed src="https://www.youtube-nocookie.com/embed/VIDEO_ID" title="Studio tour (2 minutes)"
20
+ * provider="YouTube" kind="video" aspect="16/9" allow="fullscreen; picture-in-picture" />
21
+ */
22
+ import Button from '../primitives/Button.astro';
23
+ import Image from '../primitives/Image.astro';
24
+ import Link from '../primitives/Link.astro';
25
+ import type { HTMLAttributes } from 'astro/types';
26
+ import type { ImageSource } from './types';
27
+ import ConsentEmbedScript from './internal/ConsentEmbedScript.astro';
28
+ import { safeHref } from './lib/contact';
29
+ import './styles/consent.css';
30
+
31
+ type Props = Omit<HTMLAttributes<'div'>, 'title'> & {
32
+ /** The iframe URL (https). */
33
+ src: string;
34
+ /** Accessible name of the iframe. Required. */
35
+ title: string;
36
+ /** Who hosts it: "Google Maps", "YouTube". */
37
+ provider: string;
38
+ /** What it is, for the button and notice: "map", "video", "booking calendar". */
39
+ kind?: string;
40
+ /** Consent category it needs. */
41
+ category?: string;
42
+ aspect?: '16/9' | '4/3' | '3/2' | '1/1' | '21/9';
43
+ /** Link to the content on the provider's site. Default: `src`. */
44
+ fallbackHref?: string;
45
+ /** A local still image behind the notice (decorative). */
46
+ poster?: ImageSource;
47
+ /** iframe `allow` (e.g. "fullscreen; picture-in-picture"). */
48
+ allow?: string;
49
+ allowFullscreen?: boolean;
50
+ /** iframe `sandbox` tokens, when the provider supports them. */
51
+ sandbox?: string;
52
+ referrerPolicy?: HTMLAttributes<'iframe'>['referrerpolicy'];
53
+ /** Text; `{provider}` and `{kind}` are replaced. Translate per site. */
54
+ labels?: { notice?: string; load?: string; always?: string; open?: string };
55
+ };
56
+
57
+ const {
58
+ src,
59
+ title,
60
+ provider,
61
+ kind = 'content',
62
+ category = 'media',
63
+ aspect = '16/9',
64
+ fallbackHref,
65
+ poster,
66
+ allow,
67
+ allowFullscreen = false,
68
+ sandbox,
69
+ referrerPolicy = 'strict-origin-when-cross-origin',
70
+ labels = {},
71
+ class: className,
72
+ ...rest
73
+ } = Astro.props;
74
+
75
+ const fill = (s: string) => s.replace(/\{provider\}/g, () => provider).replace(/\{kind\}/g, () => kind);
76
+ const text = {
77
+ notice: fill(labels.notice ?? '{provider} hosts this {kind}. Loading it shares your IP address and device details with {provider}, who may set cookies.'),
78
+ load: fill(labels.load ?? 'Load {kind}'),
79
+ always: fill(labels.always ?? 'Always allow embedded content'),
80
+ open: fill(labels.open ?? 'Open in {provider}'),
81
+ };
82
+ const url = typeof src === 'string' && /^(https:\/\/|\/)/i.test(src.trim()) ? src.trim() : undefined;
83
+ if (!url) throw new Error(`<ConsentEmbed> needs an https:// (or site-relative) src; got "${src}".`);
84
+ if (!title?.trim()) throw new Error('<ConsentEmbed> needs a `title` that names the embedded content.');
85
+ const fallback = safeHref(fallbackHref ?? url);
86
+ ---
87
+
88
+ <div
89
+ class:list={['sinn-embed', className]}
90
+ data-sinn-embed
91
+ data-category={category}
92
+ data-state="blocked"
93
+ data-aspect={aspect.replace('/', '-')}
94
+ {...rest}
95
+ >
96
+ <div class="sinn-embed__frame" data-embed-frame>
97
+ {poster && (
98
+ <div class="sinn-embed__poster" aria-hidden="true">
99
+ <Image src={poster.src} alt="" width={poster.width} height={poster.height} layout="full" placeholder={false} />
100
+ </div>
101
+ )}
102
+ <div class="sinn-embed__notice" data-embed-notice>
103
+ <p class="sinn-embed__title">{title}</p>
104
+ <p class="sinn-embed__text">{text.notice}</p>
105
+ <div class="sinn-embed__actions" data-embed-actions hidden>
106
+ <Button type="button" size="s" data-embed-load>{text.load}</Button>
107
+ <Button type="button" size="s" variant="outline" tone="neutral" data-embed-always>{text.always}</Button>
108
+ </div>
109
+ {fallback && <Link href={fallback} external class="sinn-embed__link">{text.open}</Link>}
110
+ </div>
111
+ <template data-embed-template>
112
+ <iframe
113
+ src={url}
114
+ title={title}
115
+ loading="lazy"
116
+ allow={allow}
117
+ allowfullscreen={allowFullscreen || undefined}
118
+ sandbox={sandbox}
119
+ referrerpolicy={referrerPolicy}
120
+ class="sinn-embed__iframe"
121
+ ></iframe>
122
+ </template>
123
+ </div>
124
+ </div>
125
+ <ConsentEmbedScript />