@sinnstack/ui 0.2.0 → 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 (138) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/README.md +6 -4
  3. package/docs/blocks.md +373 -364
  4. package/docs/data.md +128 -128
  5. package/docs/finishes.md +165 -0
  6. package/docs/primitives.md +4 -4
  7. package/docs/seo.md +191 -187
  8. package/package.json +15 -24
  9. package/src/blocks/BlockRenderer.astro +13 -7
  10. package/src/blocks/CTABanner.astro +8 -8
  11. package/src/blocks/CTAPair.astro +9 -9
  12. package/src/blocks/CardGrid.astro +7 -7
  13. package/src/blocks/ConsentEmbed.astro +1 -1
  14. package/src/blocks/ConsentManager.astro +1 -1
  15. package/src/blocks/ContactCard.astro +14 -14
  16. package/src/blocks/ContactForm.astro +4 -4
  17. package/src/blocks/ErrorPage.astro +1 -1
  18. package/src/blocks/FAQ.astro +9 -9
  19. package/src/blocks/FeatureGrid.astro +7 -7
  20. package/src/blocks/Hero.astro +11 -11
  21. package/src/blocks/HeroCarousel.astro +11 -11
  22. package/src/blocks/HighlightCards.astro +10 -10
  23. package/src/blocks/LocationHours.astro +14 -14
  24. package/src/blocks/LogoCloud.astro +7 -7
  25. package/src/blocks/MaintenancePage.astro +8 -3
  26. package/src/blocks/MediaText.astro +12 -12
  27. package/src/blocks/PageHeader.astro +9 -9
  28. package/src/blocks/ProseSection.astro +8 -8
  29. package/src/blocks/Reviews.astro +11 -11
  30. package/src/blocks/RichText.astro +58 -57
  31. package/src/blocks/StatsBand.astro +117 -117
  32. package/src/blocks/Steps.astro +9 -9
  33. package/src/blocks/Testimonials.astro +13 -13
  34. package/src/blocks/cms/card-grid.ts +48 -80
  35. package/src/blocks/cms/consent.ts +1 -30
  36. package/src/blocks/cms/contact-card.ts +4 -46
  37. package/src/blocks/cms/contact-form.ts +2 -20
  38. package/src/blocks/cms/cta-banner.ts +2 -23
  39. package/src/blocks/cms/cta-pair.ts +4 -37
  40. package/src/blocks/cms/data-base.ts +2 -4
  41. package/src/blocks/cms/data.ts +19 -19
  42. package/src/blocks/cms/faq.ts +4 -36
  43. package/src/blocks/cms/feature-grid.ts +47 -80
  44. package/src/blocks/cms/fixtures.ts +591 -599
  45. package/src/blocks/cms/hero-carousel.ts +4 -48
  46. package/src/blocks/cms/hero.ts +2 -46
  47. package/src/blocks/cms/highlight-cards.ts +4 -39
  48. package/src/blocks/cms/images.ts +1 -2
  49. package/src/blocks/cms/index.ts +59 -87
  50. package/src/blocks/cms/location-hours.ts +3 -85
  51. package/src/blocks/cms/logo-cloud.ts +36 -62
  52. package/src/blocks/cms/media-text.ts +2 -20
  53. package/src/blocks/cms/page-header.ts +27 -49
  54. package/src/blocks/cms/pages.ts +35 -81
  55. package/src/blocks/cms/prose-section.ts +2 -22
  56. package/src/blocks/cms/reviews.ts +5 -56
  57. package/src/blocks/cms/schema-dsl.ts +134 -0
  58. package/src/blocks/cms/schema.ts +794 -0
  59. package/src/blocks/cms/shared.ts +63 -115
  60. package/src/blocks/cms/stats-band.ts +35 -61
  61. package/src/blocks/cms/steps.ts +4 -31
  62. package/src/blocks/cms/testimonials.ts +4 -38
  63. package/src/blocks/cms/topbar.ts +4 -41
  64. package/src/blocks/cms/types.ts +1 -37
  65. package/src/blocks/consent.ts +2 -2
  66. package/src/blocks/index.ts +2 -2
  67. package/src/blocks/internal/Actions.astro +11 -5
  68. package/src/blocks/internal/BlockHeader.astro +7 -7
  69. package/src/blocks/internal/Placeholder.astro +3 -3
  70. package/src/blocks/internal/fields.ts +18 -0
  71. package/src/blocks/internal/registry-contract.ts +67 -0
  72. package/src/blocks/internal/util.ts +4 -4
  73. package/src/blocks/lib/contact.ts +10 -4
  74. package/src/blocks/lib/faq.ts +1 -1
  75. package/src/blocks/lib/markdown.ts +350 -0
  76. package/src/blocks/lib/rich-text.ts +132 -143
  77. package/src/blocks/scripts/consent-manager.ts +1 -1
  78. package/src/blocks/scripts/consent-store.ts +1 -1
  79. package/src/blocks/scripts/hours.ts +3 -2
  80. package/src/blocks/types.ts +33 -23
  81. package/src/data/ChartContainer.astro +2 -1
  82. package/src/data/cms.ts +130 -190
  83. package/src/data/lib/chart.ts +13 -4
  84. package/src/data/schema.ts +65 -0
  85. package/src/finishes/aurora.css +75 -0
  86. package/src/finishes/autumn.css +87 -0
  87. package/src/finishes/blueprint.css +69 -0
  88. package/src/finishes/brutalist.css +55 -0
  89. package/src/finishes/clay.css +48 -0
  90. package/src/finishes/day-cycle.css +46 -0
  91. package/src/finishes/fog.css +71 -0
  92. package/src/finishes/glass.css +149 -0
  93. package/src/finishes/holographic.css +91 -0
  94. package/src/finishes/night.css +77 -0
  95. package/src/finishes/paper.css +58 -0
  96. package/src/finishes/polished-glass.css +159 -0
  97. package/src/finishes/rain.css +84 -0
  98. package/src/finishes/scripts/day-cycle.ts +30 -0
  99. package/src/finishes/scripts/holographic.ts +37 -0
  100. package/src/finishes/scripts/spotlight.ts +30 -0
  101. package/src/finishes/spotlight.css +41 -0
  102. package/src/finishes/spring.css +80 -0
  103. package/src/finishes/terminal.css +49 -0
  104. package/src/primitives/Divider.astro +1 -1
  105. package/src/primitives/FocusRing.astro +1 -1
  106. package/src/primitives/FormField.astro +2 -2
  107. package/src/primitives/Image.astro +3 -3
  108. package/src/primitives/Input.astro +4 -2
  109. package/src/primitives/MetricCard.astro +3 -1
  110. package/src/primitives/Picture.astro +3 -3
  111. package/src/primitives/Prose.astro +1 -1
  112. package/src/primitives/Select.astro +4 -2
  113. package/src/primitives/Slider.astro +1 -1
  114. package/src/primitives/Table.astro +1 -1
  115. package/src/primitives/Textarea.astro +4 -2
  116. package/src/primitives/Thumbnail.astro +2 -2
  117. package/src/primitives/index.ts +4 -4
  118. package/src/primitives/internal/ChoiceField.astro +4 -2
  119. package/src/primitives/scripts/slider.ts +1 -1
  120. package/src/primitives/scripts/table-sort.ts +2 -2
  121. package/src/seo/cms.ts +59 -80
  122. package/src/seo/index.ts +1 -1
  123. package/src/seo/integration.ts +40 -3
  124. package/src/seo/lib/jsonld.ts +10 -2
  125. package/src/seo/lib/meta.ts +2 -2
  126. package/src/seo/lib/redirects.ts +14 -4
  127. package/src/seo/lib/rss.ts +1 -1
  128. package/src/seo/lib/sitemap.ts +1 -1
  129. package/src/seo/schema.ts +43 -0
  130. package/src/blocks/internal/tina.ts +0 -19
  131. /package/src/blocks/{lib → internal}/consent.ts +0 -0
  132. /package/src/blocks/{lib → internal}/reviews.ts +0 -0
  133. /package/src/blocks/{lib → internal}/slug.ts +0 -0
  134. /package/src/data/{lib → internal}/scale.ts +0 -0
  135. /package/src/primitives/{lib → internal}/image-plan.ts +0 -0
  136. /package/src/primitives/{lib → internal}/image.ts +0 -0
  137. /package/src/primitives/{lib → internal}/slider.ts +0 -0
  138. /package/src/seo/{lib → internal}/url.ts +0 -0
@@ -41,7 +41,7 @@ import ConsentEmbed from './ConsentEmbed.astro';
41
41
  import { mailHref, telHref } from './lib/contact';
42
42
  import { addressLine, dayRangeLabel, directionsHref, formatHours, groupWeek, mapEmbedSrc, mapSearchHref, parseTime, weekHours } from './lib/hours';
43
43
  import { blockIds, PLACEHOLDER_DEFAULT } from './internal/util';
44
- import { tf, tinaField } from './internal/tina';
44
+ import { sf, joinField } from './internal/fields';
45
45
  import './styles/blocks.css';
46
46
  import './styles/location.css';
47
47
 
@@ -131,7 +131,7 @@ const {
131
131
  scheme,
132
132
  containerSize = 'default',
133
133
  placeholder = PLACEHOLDER_DEFAULT,
134
- tina,
134
+ fieldPath,
135
135
  id,
136
136
  class: className,
137
137
  ...rest
@@ -195,7 +195,7 @@ const specialData = JSON.stringify(specials.map(({ date, opens, closes, closed }
195
195
 
196
196
  {
197
197
  !hasAddress && !hasHours ? (
198
- placeholder && <Placeholder label="Location and hours" hint="Add an address or opening hours." tinaField={tinaField(tina, 'address')} />
198
+ placeholder && <Placeholder label="Location and hours" hint="Add an address or opening hours." field={joinField(fieldPath, 'address')} />
199
199
  ) : (
200
200
  <BlockShell
201
201
  name="location"
@@ -209,17 +209,17 @@ const specialData = JSON.stringify(specials.map(({ date, opens, closes, closed }
209
209
  labelledby={hasHeading ? headingId : undefined}
210
210
  align={align}
211
211
  data-layout={showMap ? layout : 'stacked'}
212
- {...tf(tina)}
212
+ {...sf(fieldPath)}
213
213
  {...rest}
214
214
  >
215
- <BlockHeader eyebrow={eyebrow} heading={heading} headingId={headingId} headingLevel={headingLevel} description={description} tina={tina} />
215
+ <BlockHeader eyebrow={eyebrow} heading={heading} headingId={headingId} headingLevel={headingLevel} description={description} fieldPath={fieldPath} />
216
216
  <div class="sinn-location__inner">
217
217
  <div class="sinn-location__details" data-sinn-hours={hasHours ? '' : undefined} data-tz={timeZone} data-locale={locale} data-hours={hasHours ? hoursData : undefined} data-special={specials.length ? specialData : undefined}>
218
218
  {hasAddress && address && (
219
219
  <div class="sinn-location__group">
220
220
  <Heading level={subLevel} size="s" weight="semibold" class="sinn-location__label">{L.address}</Heading>
221
- <address class="sinn-location__address" {...tf(tina, 'address')}>
222
- {name?.trim() && <span class="sinn-location__name" {...tf(tina, 'name')}>{name}</span>}
221
+ <address class="sinn-location__address" {...sf(fieldPath, 'address')}>
222
+ {name?.trim() && <span class="sinn-location__name" {...sf(fieldPath, 'name')}>{name}</span>}
223
223
  <span>{address.street}</span>
224
224
  {address.street2?.trim() && <span>{address.street2}</span>}
225
225
  <span>{`${address.city}, ${address.region} ${address.postalCode}`.trim()}</span>
@@ -230,13 +230,13 @@ const specialData = JSON.stringify(specials.map(({ date, opens, closes, closed }
230
230
  {tel && phone && (
231
231
  <div>
232
232
  <dt>{L.phone}</dt>
233
- <dd><Link href={tel} {...tf(tina, 'phone')}>{phone}</Link></dd>
233
+ <dd><Link href={tel} {...sf(fieldPath, 'phone')}>{phone}</Link></dd>
234
234
  </div>
235
235
  )}
236
236
  {mail && email && (
237
237
  <div>
238
238
  <dt>{L.email}</dt>
239
- <dd><Link href={mail} {...tf(tina, 'email')}>{email}</Link></dd>
239
+ <dd><Link href={mail} {...sf(fieldPath, 'email')}>{email}</Link></dd>
240
240
  </div>
241
241
  )}
242
242
  </dl>
@@ -247,7 +247,7 @@ const specialData = JSON.stringify(specials.map(({ date, opens, closes, closed }
247
247
  {L.directions}
248
248
  <VisuallyHidden>{` (${mapProvider})`}</VisuallyHidden>
249
249
  </LinkButton>
250
- {map === 'link' && <Link href={mapSearchHref(address)} external>{L.openMap.replace('{provider}', mapProvider)}</Link>}
250
+ {map === 'link' && <Link href={mapSearchHref(address)} external>{L.openMap.replace('{provider}', () => mapProvider)}</Link>}
251
251
  </div>
252
252
  )}
253
253
  </div>
@@ -261,7 +261,7 @@ const specialData = JSON.stringify(specials.map(({ date, opens, closes, closed }
261
261
  <span class="sinn-sr-only">, </span>
262
262
  <span class="sinn-hours__detail" data-hours-detail></span>
263
263
  </p>
264
- <dl class="sinn-hours" {...tf(tina, 'hours')}>
264
+ <dl class="sinn-hours" {...sf(fieldPath, 'hours')}>
265
265
  {groups.map((g) => (
266
266
  <div class="sinn-hours__row" data-hours-days={g.days.join(' ')}>
267
267
  <dt>
@@ -273,11 +273,11 @@ const specialData = JSON.stringify(specials.map(({ date, opens, closes, closed }
273
273
  </div>
274
274
  ))}
275
275
  </dl>
276
- {hoursNote?.trim() && <Text size="s" tone="muted" class="sinn-hours__note" {...tf(tina, 'hoursNote')}>{hoursNote}</Text>}
276
+ {hoursNote?.trim() && <Text size="s" tone="muted" class="sinn-hours__note" {...sf(fieldPath, 'hoursNote')}>{hoursNote}</Text>}
277
277
  {specials.length > 0 && (
278
278
  <div class="sinn-hours__special" data-hours-special>
279
279
  <Heading level={Math.min(6, subLevel + 1) as Exclude<HeadingLevel, 1>} size="xs" weight="semibold" class="sinn-location__label">{L.special}</Heading>
280
- <dl class="sinn-hours" {...tf(tina, 'special')}>
280
+ <dl class="sinn-hours" {...sf(fieldPath, 'special')}>
281
281
  {specials.map((s) => (
282
282
  <div class="sinn-hours__row" data-hours-date={s.date}>
283
283
  <dt><time datetime={s.date}>{s.dateText}</time>{s.label?.trim() && <span class="sinn-hours__label">{` · ${s.label.trim()}`}</span>}</dt>
@@ -294,7 +294,7 @@ const specialData = JSON.stringify(specials.map(({ date, opens, closes, closed }
294
294
  <div class="sinn-location__map">
295
295
  <ConsentEmbed
296
296
  src={mapEmbedUrl ?? mapEmbedSrc(address)}
297
- title={L.mapTitle.replace('{place}', place)}
297
+ title={L.mapTitle.replace('{place}', () => place)}
298
298
  provider={mapProvider}
299
299
  kind="map"
300
300
  aspect="4/3"
@@ -27,7 +27,7 @@ import BlockShell from './internal/BlockShell.astro';
27
27
  import BlockHeader from './internal/BlockHeader.astro';
28
28
  import Placeholder from './internal/Placeholder.astro';
29
29
  import { blockIds, PLACEHOLDER_DEFAULT } from './internal/util';
30
- import { tf, tinaField } from './internal/tina';
30
+ import { sf, joinField } from './internal/fields';
31
31
  import { renameProp } from '../primitives/lib/deprecate';
32
32
 
33
33
  type Props = Omit<HTMLAttributes<'section'>, 'title'> &
@@ -69,7 +69,7 @@ const {
69
69
  scheme,
70
70
  containerSize = 'default',
71
71
  placeholder = PLACEHOLDER_DEFAULT,
72
- tina,
72
+ fieldPath,
73
73
  id,
74
74
  class: className,
75
75
  ...rest
@@ -96,7 +96,7 @@ const resolved = await Promise.all(
96
96
 
97
97
  {
98
98
  resolved.length === 0 ? (
99
- placeholder && <Placeholder label="Logo cloud" hint="Add at least one logo." tinaField={tinaField(tina, 'logos')} />
99
+ placeholder && <Placeholder label="Logo cloud" hint="Add at least one logo." field={joinField(fieldPath, 'logos')} />
100
100
  ) : (
101
101
  <BlockShell
102
102
  name="logos"
@@ -113,13 +113,13 @@ const resolved = await Promise.all(
113
113
  data-layout={layout}
114
114
  data-mono={mono ? '' : undefined}
115
115
  data-tile={tile ? '' : undefined}
116
- {...tf(tina)}
116
+ {...sf(fieldPath)}
117
117
  {...rest}
118
118
  >
119
- <BlockHeader eyebrow={eyebrow} heading={heading} headingId={headingId} headingLevel={headingLevel} compact={compact} description={description} tina={tina} />
120
- <ul class="sinn-logos__list" role="list" data-columns={layout === 'grid' ? columns : undefined} {...tf(tina, 'logos')}>
119
+ <BlockHeader eyebrow={eyebrow} heading={heading} headingId={headingId} headingLevel={headingLevel} compact={compact} description={description} fieldPath={fieldPath} />
120
+ <ul class="sinn-logos__list" role="list" data-columns={layout === 'grid' ? columns : undefined} {...sf(fieldPath, 'logos')}>
121
121
  {resolved.map((logo, i) => (
122
- <li class="sinn-logos__item" {...tf(tina, 'logos', i)}>
122
+ <li class="sinn-logos__item" {...sf(fieldPath, logo.field)}>
123
123
  {logo.href ? (
124
124
  <a class="sinn-logos__link" href={logo.href}>
125
125
  <img src={logo.url} alt={logo.alt} width={logo.w} height={logo.h} loading="lazy" decoding="async" />
@@ -29,9 +29,10 @@ import Actions from './internal/Actions.astro';
29
29
  import StandaloneDocument from './internal/StandaloneDocument.astro';
30
30
  import { blockIds } from './internal/util';
31
31
  import { formatUntil, relativeUntil } from './lib/maintenance';
32
+ import { renameValue } from '../primitives/lib/deprecate';
32
33
 
33
34
  type Props = Omit<HTMLAttributes<'section'>, 'title'> &
34
- Omit<BlockProps, 'placeholder' | 'tina'> & {
35
+ Omit<BlockProps, 'placeholder' | 'fieldPath'> & {
35
36
  heading?: string;
36
37
  description?: string;
37
38
  /** When you expect to be back: ISO 8601 with an offset ("2026-11-15T15:00:00-06:00"). */
@@ -44,7 +45,8 @@ type Props = Omit<HTMLAttributes<'section'>, 'title'> &
44
45
  contact?: ActionItem[];
45
46
  contactHeading?: string;
46
47
  notice?: string;
47
- noticeTone?: 'warning' | 'danger' | 'neutral' | 'accent';
48
+ /** The notice's Callout tone. `accent` is the deprecated name for `info`. */
49
+ noticeTone?: 'info' | 'success' | 'warning' | 'danger' | 'neutral' | 'accent';
48
50
  links?: Array<{ label: string; href: string }>;
49
51
  autoRefresh?: boolean;
50
52
  pollUrl?: string;
@@ -66,7 +68,7 @@ const {
66
68
  contact = [],
67
69
  contactHeading = 'Need help right now?',
68
70
  notice,
69
- noticeTone = 'warning',
71
+ noticeTone: noticeToneProp = 'warning',
70
72
  links = [],
71
73
  autoRefresh = true,
72
74
  pollUrl = '/',
@@ -86,6 +88,9 @@ const {
86
88
  class: className,
87
89
  ...rest
88
90
  } = Astro.props;
91
+ // `accent` was never a Callout tone: the notice looked like `info` but lost its screen-reader
92
+ // prefix ("Note:"). It now maps to `info`.
93
+ const noticeTone = renameValue('MaintenancePage', 'noticeTone', noticeToneProp, { accent: 'info' }) as Exclude<typeof noticeToneProp, 'accent'>;
89
94
 
90
95
  const { sectionId, headingId } = blockIds('maintenance', anchor, id);
91
96
  const iso = until ? new Date(until).toISOString() : undefined;
@@ -31,7 +31,7 @@ import Actions from './internal/Actions.astro';
31
31
  import Placeholder from './internal/Placeholder.astro';
32
32
  import { blockIcons } from './icons';
33
33
  import { blockIds, PLACEHOLDER_DEFAULT } from './internal/util';
34
- import { tf, tinaField } from './internal/tina';
34
+ import { sf, joinField } from './internal/fields';
35
35
  import { renameProp, renameValue } from '../primitives/lib/deprecate';
36
36
 
37
37
  type Props = Omit<HTMLAttributes<'section'>, 'title'> &
@@ -83,7 +83,7 @@ const {
83
83
  scheme,
84
84
  containerSize = 'default',
85
85
  placeholder = PLACEHOLDER_DEFAULT,
86
- tina,
86
+ fieldPath,
87
87
  id,
88
88
  class: className,
89
89
  ...rest
@@ -101,7 +101,7 @@ const share = { s: 40, m: 50, l: 58 }[mediaWidth];
101
101
 
102
102
  {
103
103
  !hasHeading && !hasMedia ? (
104
- placeholder && <Placeholder label="Image and text" hint="Add a heading and an image." tinaField={tinaField(tina)} />
104
+ placeholder && <Placeholder label="Image and text" hint="Add a heading and an image." field={joinField(fieldPath)} />
105
105
  ) : (
106
106
  <BlockShell
107
107
  name="media-text"
@@ -120,12 +120,12 @@ const share = { s: 40, m: 50, l: 58 }[mediaWidth];
120
120
  data-stack={stackOrder === 'text' ? 'text' : undefined}
121
121
  data-valign={verticalAlign === 'start' ? 'start' : undefined}
122
122
  data-has-media={hasMedia ? '' : undefined}
123
- {...tf(tina)}
123
+ {...sf(fieldPath)}
124
124
  {...rest}
125
125
  >
126
126
  <div class="sinn-media-text__layout">
127
127
  {hasMedia && (
128
- <div class="sinn-media-text__media" data-aspect={mediaAspect === 'auto' ? 'auto' : undefined} {...tf(tina, 'image')}>
128
+ <div class="sinn-media-text__media" data-aspect={mediaAspect === 'auto' ? 'auto' : undefined} {...sf(fieldPath, 'image')}>
129
129
  {slots.has('media') ? (
130
130
  <slot name="media" />
131
131
  ) : (
@@ -145,21 +145,21 @@ const share = { s: 40, m: 50, l: 58 }[mediaWidth];
145
145
  </div>
146
146
  )}
147
147
  <div class="sinn-media-text__content">
148
- {eyebrow && <p class="sinn-block__eyebrow" {...tf(tina, 'eyebrow')}>{eyebrow}</p>}
148
+ {eyebrow && <p class="sinn-block__eyebrow" {...sf(fieldPath, 'eyebrow')}>{eyebrow}</p>}
149
149
  {hasHeading && (
150
- <Heading level={headingLevel} size={headingSize} weight="bold" id={headingId} class="sinn-media-text__title" {...tf(tina, 'heading')}>
150
+ <Heading level={headingLevel} size={headingSize} weight="bold" id={headingId} class="sinn-media-text__title" {...sf(fieldPath, 'heading')}>
151
151
  {slots.has('heading') ? <slot name="heading" /> : heading}
152
152
  </Heading>
153
153
  )}
154
154
  {(description || slots.has('description')) && (
155
- <Text size="l" tone="muted" class="sinn-media-text__description" {...tf(tina, 'description')}>
155
+ <Text size="l" tone="muted" class="sinn-media-text__description" {...sf(fieldPath, 'description')}>
156
156
  {slots.has('description') ? <slot name="description" /> : description}
157
157
  </Text>
158
158
  )}
159
159
  {cleanPoints.length > 0 && (
160
- <ul class="sinn-media-text__points" role="list" data-marker={marker} {...tf(tina, 'points')}>
161
- {cleanPoints.map((point, i) => (
162
- <li {...tf(tina, 'points', i)}>
160
+ <ul class="sinn-media-text__points" role="list" data-marker={marker} {...sf(fieldPath, 'points')}>
161
+ {cleanPoints.map((point) => (
162
+ <li>
163
163
  {marker === 'check' && <span class="sinn-media-text__check" set:html={blockIcons.check} />}
164
164
  <span>{point}</span>
165
165
  </li>
@@ -167,7 +167,7 @@ const share = { s: 40, m: 50, l: 58 }[mediaWidth];
167
167
  </ul>
168
168
  )}
169
169
  <slot />
170
- <Actions actions={actions} size="m" class="sinn-media-text__actions" tina={tina}>
170
+ <Actions actions={actions} size="m" class="sinn-media-text__actions" fieldPath={fieldPath}>
171
171
  {slots.has('actions') && <slot name="actions" />}
172
172
  </Actions>
173
173
  </div>
@@ -27,7 +27,7 @@ import BlockShell from './internal/BlockShell.astro';
27
27
  import Actions from './internal/Actions.astro';
28
28
  import Placeholder from './internal/Placeholder.astro';
29
29
  import { blockIds, PLACEHOLDER_DEFAULT } from './internal/util';
30
- import { tf, tinaField } from './internal/tina';
30
+ import { sf, joinField } from './internal/fields';
31
31
 
32
32
  type Props = Omit<HTMLAttributes<'section'>, 'title'> &
33
33
  BlockProps & {
@@ -65,7 +65,7 @@ const {
65
65
  scheme,
66
66
  containerSize = 'default',
67
67
  placeholder = PLACEHOLDER_DEFAULT,
68
- tina,
68
+ fieldPath,
69
69
  id,
70
70
  class: className,
71
71
  ...rest
@@ -85,7 +85,7 @@ const crumbsEl = crumbs.length > 1 ? 'nav' : null;
85
85
 
86
86
  {
87
87
  !hasHeading ? (
88
- placeholder && <Placeholder label="Page header" hint="Add the page title." tinaField={tinaField(tina)} />
88
+ placeholder && <Placeholder label="Page header" hint="Add the page title." field={joinField(fieldPath)} />
89
89
  ) : (
90
90
  <BlockShell
91
91
  name="page-header"
@@ -100,24 +100,24 @@ const crumbsEl = crumbs.length > 1 ? 'nav' : null;
100
100
  labelledby={headingId}
101
101
  align={align}
102
102
  data-crumbs={crumbsEl && breadcrumbPosition === 'below' ? 'below' : undefined}
103
- {...tf(tina)}
103
+ {...sf(fieldPath)}
104
104
  {...rest}
105
105
  >
106
106
  <div class="sinn-page-header__inner">
107
- {crumbsEl && <Breadcrumbs items={crumbs} label={breadcrumbLabel} class="sinn-page-header__crumbs" {...tf(tina, 'breadcrumbs')} />}
107
+ {crumbsEl && <Breadcrumbs items={crumbs} label={breadcrumbLabel} class="sinn-page-header__crumbs" {...sf(fieldPath, 'breadcrumbs')} />}
108
108
  <div class="sinn-page-header__text">
109
- {eyebrow && <p class="sinn-block__eyebrow" {...tf(tina, 'eyebrow')}>{eyebrow}</p>}
110
- <Heading level={headingLevel} size={headingSize} weight="bold" id={headingId} class="sinn-page-header__title" {...tf(tina, 'heading')}>
109
+ {eyebrow && <p class="sinn-block__eyebrow" {...sf(fieldPath, 'eyebrow')}>{eyebrow}</p>}
110
+ <Heading level={headingLevel} size={headingSize} weight="bold" id={headingId} class="sinn-page-header__title" {...sf(fieldPath, 'heading')}>
111
111
  {slots.has('heading') ? <slot name="heading" /> : title}
112
112
  </Heading>
113
113
  {(description || slots.has('description')) && (
114
- <Text size="l" tone="muted" class="sinn-page-header__description" measure {...tf(tina, 'description')}>
114
+ <Text size="l" tone="muted" class="sinn-page-header__description" measure {...sf(fieldPath, 'description')}>
115
115
  {slots.has('description') ? <slot name="description" /> : description}
116
116
  </Text>
117
117
  )}
118
118
  <slot />
119
119
  </div>
120
- <Actions actions={actions} size="m" class="sinn-page-header__actions" tina={tina}>
120
+ <Actions actions={actions} size="m" class="sinn-page-header__actions" fieldPath={fieldPath}>
121
121
  {slots.has('actions') && <slot name="actions" />}
122
122
  </Actions>
123
123
  </div>
@@ -22,7 +22,7 @@ import Placeholder from './internal/Placeholder.astro';
22
22
  import RichText from './RichText.astro';
23
23
  import { isRichTextEmpty, type RichTextValue } from './lib/rich-text';
24
24
  import { blockIds, PLACEHOLDER_DEFAULT } from './internal/util';
25
- import { tf, tinaField } from './internal/tina';
25
+ import { sf, joinField } from './internal/fields';
26
26
  import './styles/blocks.css';
27
27
  import './styles/prose-section.css';
28
28
 
@@ -31,7 +31,7 @@ type Props = Omit<HTMLAttributes<'section'>, 'title'> &
31
31
  eyebrow?: string;
32
32
  heading?: string;
33
33
  headingLevel?: HeadingLevel;
34
- /** Rich text (TinaCMS rich-text AST) or plain text. */
34
+ /** Rich text (a rich-text tree) or plain text. */
35
35
  body?: RichTextValue;
36
36
  actions?: ActionItem[];
37
37
  /** Readable line length (~65ch). Default on. */
@@ -57,7 +57,7 @@ const {
57
57
  scheme,
58
58
  containerSize = 'default',
59
59
  placeholder = PLACEHOLDER_DEFAULT,
60
- tina,
60
+ fieldPath,
61
61
  id,
62
62
  class: className,
63
63
  ...rest
@@ -71,7 +71,7 @@ const bodyTop = (hasHeading ? Math.min(6, headingLevel + 1) : Math.max(2, headin
71
71
 
72
72
  {
73
73
  !hasBody && !hasHeading ? (
74
- placeholder && <Placeholder label="Text section" hint="Add a heading or some text." tinaField={tinaField(tina, 'body')} />
74
+ placeholder && <Placeholder label="Text section" hint="Add a heading or some text." field={joinField(fieldPath, 'body')} />
75
75
  ) : (
76
76
  <BlockShell
77
77
  name="prose-section"
@@ -85,14 +85,14 @@ const bodyTop = (hasHeading ? Math.min(6, headingLevel + 1) : Math.max(2, headin
85
85
  labelledby={hasHeading ? headingId : undefined}
86
86
  align={align}
87
87
  data-measure={measure ? '' : undefined}
88
- {...tf(tina)}
88
+ {...sf(fieldPath)}
89
89
  {...rest}
90
90
  >
91
- <BlockHeader eyebrow={eyebrow} heading={heading} headingId={headingId} headingLevel={headingLevel} tina={tina} />
91
+ <BlockHeader eyebrow={eyebrow} heading={heading} headingId={headingId} headingLevel={headingLevel} fieldPath={fieldPath} />
92
92
  {hasBody && (
93
- <RichText value={body} headingLevel={bodyTop} size={size} measure={measure} align={align} resolveImage={resolveImage} class="sinn-prose-section__body" {...tf(tina, 'body')} />
93
+ <RichText value={body} headingLevel={bodyTop} size={size} measure={measure} align={align} resolveImage={resolveImage} class="sinn-prose-section__body" {...sf(fieldPath, 'body')} />
94
94
  )}
95
- <Actions actions={actions} class="sinn-block__footer" tina={tina} />
95
+ <Actions actions={actions} class="sinn-block__footer" fieldPath={fieldPath} />
96
96
  </BlockShell>
97
97
  )
98
98
  }
@@ -27,9 +27,9 @@ import BlockShell from './internal/BlockShell.astro';
27
27
  import BlockHeader from './internal/BlockHeader.astro';
28
28
  import Placeholder from './internal/Placeholder.astro';
29
29
  import { safeHref } from './lib/contact';
30
- import { formatReviewDate, validReviews } from './lib/reviews';
30
+ import { formatReviewDate, validReviews } from './internal/reviews';
31
31
  import { blockIds, PLACEHOLDER_DEFAULT } from './internal/util';
32
- import { tf, tinaField } from './internal/tina';
32
+ import { sf, joinField } from './internal/fields';
33
33
  import './styles/blocks.css';
34
34
  import './styles/quotes.css';
35
35
 
@@ -78,7 +78,7 @@ const {
78
78
  scheme,
79
79
  containerSize = 'default',
80
80
  placeholder = PLACEHOLDER_DEFAULT,
81
- tina,
81
+ fieldPath,
82
82
  id,
83
83
  class: className,
84
84
  ...rest
@@ -104,7 +104,7 @@ const external = (h?: string) => (h && /^https?:/i.test(h) ? 'noopener' : undefi
104
104
 
105
105
  {
106
106
  reviews.length === 0 && !hasSummary ? (
107
- placeholder && <Placeholder label="Reviews" hint="Add a review with text, an author and a rating, or an overall rating." tinaField={tinaField(tina, 'items')} />
107
+ placeholder && <Placeholder label="Reviews" hint="Add a review with text, an author and a rating, or an overall rating." field={joinField(fieldPath, 'items')} />
108
108
  ) : (
109
109
  <BlockShell
110
110
  name="reviews"
@@ -118,12 +118,12 @@ const external = (h?: string) => (h && /^https?:/i.test(h) ? 'noopener' : undefi
118
118
  labelledby={hasHeading ? headingId : undefined}
119
119
  align={align}
120
120
  data-variant={variant}
121
- {...tf(tina)}
121
+ {...sf(fieldPath)}
122
122
  {...rest}
123
123
  >
124
- <BlockHeader eyebrow={eyebrow} heading={heading} headingId={headingId} headingLevel={headingLevel} description={description} tina={tina} />
124
+ <BlockHeader eyebrow={eyebrow} heading={heading} headingId={headingId} headingLevel={headingLevel} description={description} fieldPath={fieldPath} />
125
125
  {hasSummary && summary && (
126
- <div class="sinn-reviews__summary" {...tf(tina, 'summary')}>
126
+ <div class="sinn-reviews__summary" {...sf(fieldPath, 'summary')}>
127
127
  <div class="sinn-reviews__overall">
128
128
  <Rating value={summary.rating} max={max} count={summary.count} size="l" class="sinn-reviews__rating" />
129
129
  {summary.source && <p class="sinn-reviews__source">{fill(text.onSource, { source: summary.source })}</p>}
@@ -147,20 +147,20 @@ const external = (h?: string) => (h && /^https?:/i.test(h) ? 'noopener' : undefi
147
147
  </div>
148
148
  )}
149
149
  {reviews.length > 0 && (
150
- <ul class="sinn-quotes" role="list" data-columns={columns} {...tf(tina, 'items')}>
150
+ <ul class="sinn-quotes" role="list" data-columns={columns} {...sf(fieldPath, 'items')}>
151
151
  {reviews.map((r, i) => {
152
152
  const href = r.source?.href ? safeHref(r.source.href) : undefined;
153
153
  const date = formatReviewDate(r.date, locale);
154
154
  return (
155
- <li class="sinn-quotes__item" {...tf(tina, 'items', i)}>
155
+ <li class="sinn-quotes__item" {...sf(fieldPath, r.field)}>
156
156
  <article class="sinn-quote sinn-review">
157
157
  <Rating value={r.rating} max={max} size="s" showValue={false} class="sinn-quote__rating" />
158
- <blockquote class="sinn-quote__text" {...tf(r.tina, 'text')}>
158
+ <blockquote class="sinn-quote__text" {...sf(fieldPath, r.field, 'text')}>
159
159
  {r.text.trim().split(/\n\s*\n/).map((p) => <p>{p.trim()}</p>)}
160
160
  </blockquote>
161
161
  <p class="sinn-quote__person">
162
162
  <span class="sinn-quote__who">
163
- <span class="sinn-quote__name" {...tf(r.tina, 'author')}>{r.author}</span>
163
+ <span class="sinn-quote__name" {...sf(fieldPath, r.field, 'author')}>{r.author}</span>
164
164
  {(date || r.source?.label) && (
165
165
  <span class="sinn-quote__role">
166
166
  {date && <time datetime={date.iso}>{date.text}</time>}
@@ -1,57 +1,58 @@
1
- ---
2
- /**
3
- * RichText: renders CMS rich text (a TinaCMS rich-text field, or plain text) safely, styled
4
- * by the Prose primitive.
5
- *
6
- * - **Safe by construction.** Only known elements render: paragraphs, headings, lists, links,
7
- * quotes, code, images, rules, tables, bold/italic/strikethrough/code text. Raw HTML, MDX
8
- * templates and unknown nodes are dropped (with a dev warning). Text is always escaped, and
9
- * links keep only http(s), mailto, tel, sms and relative URLs.
10
- * - **Headings fit the page outline.** The content's top heading renders at `headingLevel`
11
- * (default 2), whatever level the editor picked, and levels below it keep their spacing, so
12
- * an editor's "H1" never competes with the page title.
13
- * - **No layout shift from images.** Pass `resolveImage` (BlockRenderer passes its own) so CMS
14
- * images become optimized assets with known sizes.
15
- * - Wide tables and code blocks scroll inside a focusable region, never the page.
16
- * - Plain text: blank lines separate paragraphs, single newlines become line breaks.
17
- *
18
- * @example
19
- * <RichText value={page.body} headingLevel={2} measure />
20
- */
21
- import Prose from '../primitives/Prose.astro';
22
- import RichTextNode from './internal/RichTextNode.astro';
23
- import { isRichTextEmpty, toRichTextRoot, topHeadingLevel, type RichTextValue } from './lib/rich-text';
24
- import type { ImageResolver } from './cms/types';
25
- import './styles/rich-text.css';
26
-
27
- type Props = {
28
- value: RichTextValue;
29
- /** Level the content's top heading renders at (2–6). */
30
- headingLevel?: 2 | 3 | 4 | 5 | 6;
31
- size?: 's' | 'm' | 'l';
32
- /** Cap line length at ~65 characters. */
33
- measure?: boolean;
34
- align?: 'start' | 'center';
35
- /** Resolves CMS image paths to imported assets (see createImageResolver). */
36
- resolveImage?: ImageResolver;
37
- /** Accessible name of the scrollable table region. Translate per site. */
38
- labels?: { table?: string };
39
- as?: 'div' | 'article' | 'section';
40
- class?: string;
41
- [key: `data-${string}`]: string | undefined;
42
- };
43
-
44
- const { value, headingLevel = 2, size = 'm', measure = false, align = 'start', resolveImage, labels = {}, as = 'div', class: className, ...rest } = Astro.props;
45
- const root = toRichTextRoot(value);
46
- const empty = isRichTextEmpty(root);
47
- const contentTop = topHeadingLevel(root);
48
- const names = { table: labels.table ?? 'Table' };
49
- ---
50
-
51
- {
52
- !empty && (
53
- <Prose as={as} size={size} measure={measure} align={align} class:list={['sinn-rich-text', className]} {...rest}>
54
- {root.children.map((node) => <RichTextNode node={node} contentTop={contentTop} topLevel={headingLevel} resolveImage={resolveImage} labels={names} />)}
55
- </Prose>
56
- )
57
- }
1
+ ---
2
+ /**
3
+ * RichText: renders CMS rich text (Markdown, or a rich-text tree) safely, styled
4
+ * by the Prose primitive.
5
+ *
6
+ * - **Safe by construction.** Only known elements render: paragraphs, headings, lists, links,
7
+ * quotes, code, images, rules, tables, bold/italic/strikethrough/code text. Raw HTML, MDX
8
+ * templates and unknown nodes are dropped (with a dev warning). Text is always escaped, and
9
+ * links keep only http(s), mailto, tel, sms and relative URLs.
10
+ * - **Headings fit the page outline.** The content's top heading renders at `headingLevel`
11
+ * (default 2), whatever level the editor picked, and levels below it keep their spacing, so
12
+ * an editor's "H1" never competes with the page title.
13
+ * - **No layout shift from images.** Pass `resolveImage` (BlockRenderer passes its own) so CMS
14
+ * images become optimized assets with known sizes.
15
+ * - Wide tables and code blocks scroll inside a focusable region, never the page.
16
+ * - Markdown: the subset in lib/markdown.ts. Blank lines separate paragraphs, single newlines
17
+ * become line breaks, and raw HTML shows as text.
18
+ *
19
+ * @example
20
+ * <RichText value={page.body} headingLevel={2} measure />
21
+ */
22
+ import Prose from '../primitives/Prose.astro';
23
+ import RichTextNode from './internal/RichTextNode.astro';
24
+ import { isRichTextEmpty, toRichTextRoot, topHeadingLevel, type RichTextValue } from './lib/rich-text';
25
+ import type { ImageResolver } from './cms/types';
26
+ import './styles/rich-text.css';
27
+
28
+ type Props = {
29
+ value: RichTextValue;
30
+ /** Level the content's top heading renders at (2–6). */
31
+ headingLevel?: 2 | 3 | 4 | 5 | 6;
32
+ size?: 's' | 'm' | 'l';
33
+ /** Cap line length at ~65 characters. */
34
+ measure?: boolean;
35
+ align?: 'start' | 'center';
36
+ /** Resolves CMS image paths to imported assets (see createImageResolver). */
37
+ resolveImage?: ImageResolver;
38
+ /** Accessible name of the scrollable table region. Translate per site. */
39
+ labels?: { table?: string };
40
+ as?: 'div' | 'article' | 'section';
41
+ class?: string;
42
+ [key: `data-${string}`]: string | undefined;
43
+ };
44
+
45
+ const { value, headingLevel = 2, size = 'm', measure = false, align = 'start', resolveImage, labels = {}, as = 'div', class: className, ...rest } = Astro.props;
46
+ const root = toRichTextRoot(value);
47
+ const empty = isRichTextEmpty(root);
48
+ const contentTop = topHeadingLevel(root);
49
+ const names = { table: labels.table ?? 'Table' };
50
+ ---
51
+
52
+ {
53
+ !empty && (
54
+ <Prose as={as} size={size} measure={measure} align={align} class:list={['sinn-rich-text', className]} {...rest}>
55
+ {root.children.map((node) => <RichTextNode node={node} contentTop={contentTop} topLevel={headingLevel} resolveImage={resolveImage} labels={names} />)}
56
+ </Prose>
57
+ )
58
+ }