@sinnstack/ui 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/LICENSE +373 -0
- package/README.md +186 -2
- package/docs/blocks.md +364 -0
- package/docs/data.md +128 -0
- package/docs/motion.md +166 -0
- package/docs/primitives.md +510 -0
- package/docs/seo.md +187 -0
- package/docs/tokens.md +122 -0
- package/package.json +141 -3
- package/scripts/check-contrast.mjs +180 -0
- package/src/blocks/BlockRenderer.astro +54 -0
- package/src/blocks/CTABanner.astro +121 -0
- package/src/blocks/CTAPair.astro +110 -0
- package/src/blocks/CardGrid.astro +167 -0
- package/src/blocks/ConsentEmbed.astro +125 -0
- package/src/blocks/ConsentManager.astro +147 -0
- package/src/blocks/ConsentScript.astro +47 -0
- package/src/blocks/ContactCard.astro +164 -0
- package/src/blocks/ContactForm.astro +224 -0
- package/src/blocks/ErrorPage.astro +242 -0
- package/src/blocks/FAQ.astro +135 -0
- package/src/blocks/FeatureGrid.astro +148 -0
- package/src/blocks/Hero.astro +171 -0
- package/src/blocks/HeroCarousel.astro +220 -0
- package/src/blocks/HighlightCards.astro +107 -0
- package/src/blocks/LocationHours.astro +311 -0
- package/src/blocks/LogoCloud.astro +135 -0
- package/src/blocks/MaintenancePage.astro +168 -0
- package/src/blocks/MediaText.astro +177 -0
- package/src/blocks/PageHeader.astro +126 -0
- package/src/blocks/ProseSection.astro +98 -0
- package/src/blocks/Reviews.astro +194 -0
- package/src/blocks/RichText.astro +57 -0
- package/src/blocks/StatsBand.astro +117 -0
- package/src/blocks/Steps.astro +141 -0
- package/src/blocks/Testimonials.astro +144 -0
- package/src/blocks/Topbar.astro +158 -0
- package/src/blocks/cms/card-grid.ts +80 -0
- package/src/blocks/cms/consent.ts +45 -0
- package/src/blocks/cms/contact-card.ts +88 -0
- package/src/blocks/cms/contact-form.ts +55 -0
- package/src/blocks/cms/cta-banner.ts +48 -0
- package/src/blocks/cms/cta-pair.ts +63 -0
- package/src/blocks/cms/data-base.ts +7 -0
- package/src/blocks/cms/data.ts +257 -0
- package/src/blocks/cms/faq.ts +70 -0
- package/src/blocks/cms/feature-grid.ts +80 -0
- package/src/blocks/cms/fixtures.ts +599 -0
- package/src/blocks/cms/hero-carousel.ts +80 -0
- package/src/blocks/cms/hero.ts +77 -0
- package/src/blocks/cms/highlight-cards.ts +76 -0
- package/src/blocks/cms/images.ts +38 -0
- package/src/blocks/cms/index.ts +87 -0
- package/src/blocks/cms/location-hours.ts +149 -0
- package/src/blocks/cms/logo-cloud.ts +62 -0
- package/src/blocks/cms/media-text.ts +44 -0
- package/src/blocks/cms/page-header.ts +49 -0
- package/src/blocks/cms/pages.ts +81 -0
- package/src/blocks/cms/prose-section.ts +45 -0
- package/src/blocks/cms/reviews.ts +101 -0
- package/src/blocks/cms/shared.ts +115 -0
- package/src/blocks/cms/stats-band.ts +61 -0
- package/src/blocks/cms/steps.ts +67 -0
- package/src/blocks/cms/testimonials.ts +80 -0
- package/src/blocks/cms/topbar.ts +64 -0
- package/src/blocks/cms/types.ts +63 -0
- package/src/blocks/consent.ts +14 -0
- package/src/blocks/icons.ts +47 -0
- package/src/blocks/index.ts +42 -0
- package/src/blocks/internal/Actions.astro +29 -0
- package/src/blocks/internal/BlockHeader.astro +45 -0
- package/src/blocks/internal/BlockShell.astro +58 -0
- package/src/blocks/internal/CarouselScript.astro +7 -0
- package/src/blocks/internal/ConsentEmbedScript.astro +7 -0
- package/src/blocks/internal/ConsentManagerScript.astro +7 -0
- package/src/blocks/internal/HoursScript.astro +7 -0
- package/src/blocks/internal/Placeholder.astro +13 -0
- package/src/blocks/internal/RichTextNode.astro +133 -0
- package/src/blocks/internal/StandaloneDocument.astro +53 -0
- package/src/blocks/internal/tina.ts +19 -0
- package/src/blocks/internal/util.ts +23 -0
- package/src/blocks/lib/consent.ts +96 -0
- package/src/blocks/lib/contact.ts +86 -0
- package/src/blocks/lib/error-pages.ts +119 -0
- package/src/blocks/lib/faq.ts +37 -0
- package/src/blocks/lib/hours.ts +201 -0
- package/src/blocks/lib/maintenance.ts +129 -0
- package/src/blocks/lib/reviews.ts +22 -0
- package/src/blocks/lib/rich-text.ts +143 -0
- package/src/blocks/lib/slug.ts +12 -0
- package/src/blocks/registry.ts +79 -0
- package/src/blocks/scripts/carousel.ts +218 -0
- package/src/blocks/scripts/consent-embed.ts +105 -0
- package/src/blocks/scripts/consent-manager.ts +112 -0
- package/src/blocks/scripts/consent-store.ts +86 -0
- package/src/blocks/scripts/error-page.ts +71 -0
- package/src/blocks/scripts/hours.ts +106 -0
- package/src/blocks/scripts/maintenance.ts +109 -0
- package/src/blocks/styles/blocks.css +1320 -0
- package/src/blocks/styles/consent.css +102 -0
- package/src/blocks/styles/faq.css +28 -0
- package/src/blocks/styles/location.css +92 -0
- package/src/blocks/styles/prose-section.css +13 -0
- package/src/blocks/styles/quotes.css +123 -0
- package/src/blocks/styles/rich-text.css +14 -0
- package/src/blocks/types.ts +283 -0
- package/src/data/ChartAxis.astro +19 -0
- package/src/data/ChartContainer.astro +151 -0
- package/src/data/ChartLegend.astro +25 -0
- package/src/data/ChartSeries.astro +14 -0
- package/src/data/ChartTable.astro +17 -0
- package/src/data/ChartTooltip.astro +20 -0
- package/src/data/Sparkline.astro +55 -0
- package/src/data/cms.ts +190 -0
- package/src/data/index.ts +10 -0
- package/src/data/lib/chart.ts +450 -0
- package/src/data/lib/render.ts +219 -0
- package/src/data/lib/scale.ts +107 -0
- package/src/data/lib/sparkline.ts +117 -0
- package/src/data/scripts/chart.ts +324 -0
- package/src/data/styles/chart.css +392 -0
- package/src/motion/Marquee.astro +90 -0
- package/src/motion/MotionProvider.astro +50 -0
- package/src/motion/PageTransitions.astro +61 -0
- package/src/motion/Parallax.astro +44 -0
- package/src/motion/ParallaxLayer.astro +31 -0
- package/src/motion/RevealOnScroll.astro +59 -0
- package/src/motion/SceneRegistry.astro +38 -0
- package/src/motion/ScrollScene.astro +81 -0
- package/src/motion/index.ts +12 -0
- package/src/motion/integration.ts +48 -0
- package/src/motion/runtime/page-transitions.ts +68 -0
- package/src/motion/runtime/runtime.ts +180 -0
- package/src/motion/runtime/scenes.ts +248 -0
- package/src/motion/runtime/types.ts +103 -0
- package/src/motion/styles/motion.css +332 -0
- package/src/motion/transitions.ts +74 -0
- package/src/motion/virtual.d.ts +4 -0
- package/src/primitives/Accordion.astro +129 -0
- package/src/primitives/Breadcrumbs.astro +50 -0
- package/src/primitives/BulletList.astro +69 -0
- package/src/primitives/Button.astro +73 -0
- package/src/primitives/ButtonGroup.astro +54 -0
- package/src/primitives/Callout.astro +137 -0
- package/src/primitives/Caption.astro +35 -0
- package/src/primitives/Card.astro +72 -0
- package/src/primitives/CardContent.astro +24 -0
- package/src/primitives/CardFooter.astro +36 -0
- package/src/primitives/CardHeader.astro +86 -0
- package/src/primitives/Checkbox.astro +38 -0
- package/src/primitives/ChoiceGroup.astro +23 -0
- package/src/primitives/Cluster.astro +49 -0
- package/src/primitives/Container.astro +44 -0
- package/src/primitives/DescriptionList.astro +83 -0
- package/src/primitives/Dialog.astro +38 -0
- package/src/primitives/Disclosure.astro +67 -0
- package/src/primitives/Divider.astro +93 -0
- package/src/primitives/Drawer.astro +33 -0
- package/src/primitives/Fieldset.astro +80 -0
- package/src/primitives/Flex.astro +64 -0
- package/src/primitives/FocusRing.astro +63 -0
- package/src/primitives/FocusTrap.astro +64 -0
- package/src/primitives/Footer.astro +155 -0
- package/src/primitives/Form.astro +68 -0
- package/src/primitives/FormDescription.astro +26 -0
- package/src/primitives/FormError.astro +106 -0
- package/src/primitives/FormField.astro +72 -0
- package/src/primitives/Grid.astro +64 -0
- package/src/primitives/Heading.astro +45 -0
- package/src/primitives/IconButton.astro +48 -0
- package/src/primitives/Image.astro +125 -0
- package/src/primitives/Input.astro +84 -0
- package/src/primitives/Label.astro +50 -0
- package/src/primitives/Link.astro +81 -0
- package/src/primitives/LinkButton.astro +66 -0
- package/src/primitives/List.astro +39 -0
- package/src/primitives/ListItem.astro +178 -0
- package/src/primitives/MediaObject.astro +66 -0
- package/src/primitives/MetricCard.astro +276 -0
- package/src/primitives/NavLink.astro +81 -0
- package/src/primitives/NavMenu.astro +109 -0
- package/src/primitives/Navbar.astro +197 -0
- package/src/primitives/Panel.astro +153 -0
- package/src/primitives/Picture.astro +167 -0
- package/src/primitives/Popover.astro +95 -0
- package/src/primitives/Prose.astro +45 -0
- package/src/primitives/Radio.astro +21 -0
- package/src/primitives/Rating.astro +135 -0
- package/src/primitives/ReducedMotion.astro +90 -0
- package/src/primitives/SegmentedControl.astro +132 -0
- package/src/primitives/Select.astro +107 -0
- package/src/primitives/Sheet.astro +45 -0
- package/src/primitives/SkipLink.astro +31 -0
- package/src/primitives/Slider.astro +186 -0
- package/src/primitives/Spacer.astro +35 -0
- package/src/primitives/Stack.astro +51 -0
- package/src/primitives/Surface.astro +70 -0
- package/src/primitives/Switch.astro +22 -0
- package/src/primitives/Table.astro +382 -0
- package/src/primitives/Tabs.astro +126 -0
- package/src/primitives/Text.astro +56 -0
- package/src/primitives/Textarea.astro +73 -0
- package/src/primitives/Thumbnail.astro +154 -0
- package/src/primitives/Toggle.astro +99 -0
- package/src/primitives/Tooltip.astro +50 -0
- package/src/primitives/VisuallyHidden.astro +29 -0
- package/src/primitives/index.ts +103 -0
- package/src/primitives/internal/AccordionScript.astro +7 -0
- package/src/primitives/internal/ChoiceField.astro +89 -0
- package/src/primitives/internal/FocusTrapScript.astro +8 -0
- package/src/primitives/internal/FormValidationScript.astro +10 -0
- package/src/primitives/internal/IndeterminateScript.astro +13 -0
- package/src/primitives/internal/ModalPanel.astro +114 -0
- package/src/primitives/internal/OverlayScript.astro +7 -0
- package/src/primitives/internal/ReducedMotionScript.astro +7 -0
- package/src/primitives/internal/SliderScript.astro +7 -0
- package/src/primitives/internal/SparklineScript.astro +7 -0
- package/src/primitives/internal/TableSortScript.astro +7 -0
- package/src/primitives/internal/TabsScript.astro +7 -0
- package/src/primitives/internal/TooltipScript.astro +7 -0
- package/src/primitives/lib/deprecate.ts +47 -0
- package/src/primitives/lib/focus-trap.ts +197 -0
- package/src/primitives/lib/focus.ts +60 -0
- package/src/primitives/lib/image-plan.ts +82 -0
- package/src/primitives/lib/image.ts +129 -0
- package/src/primitives/lib/motion.ts +68 -0
- package/src/primitives/lib/slider.ts +170 -0
- package/src/primitives/scripts/accordion.ts +123 -0
- package/src/primitives/scripts/form-validation.ts +225 -0
- package/src/primitives/scripts/overlay.ts +71 -0
- package/src/primitives/scripts/reduced-motion.ts +59 -0
- package/src/primitives/scripts/slider.ts +150 -0
- package/src/primitives/scripts/sparkline.ts +131 -0
- package/src/primitives/scripts/table-sort.ts +68 -0
- package/src/primitives/scripts/tabs.ts +151 -0
- package/src/primitives/scripts/tooltip.ts +28 -0
- package/src/primitives/styles/a11y.css +104 -0
- package/src/primitives/styles/accordion.css +53 -0
- package/src/primitives/styles/breadcrumbs.css +59 -0
- package/src/primitives/styles/bullet-list.css +89 -0
- package/src/primitives/styles/button.css +237 -0
- package/src/primitives/styles/choice.css +164 -0
- package/src/primitives/styles/cluster.css +24 -0
- package/src/primitives/styles/container.css +19 -0
- package/src/primitives/styles/data.css +849 -0
- package/src/primitives/styles/disclosure.css +140 -0
- package/src/primitives/styles/divider.css +50 -0
- package/src/primitives/styles/flex.css +42 -0
- package/src/primitives/styles/form.css +241 -0
- package/src/primitives/styles/grid.css +36 -0
- package/src/primitives/styles/media.css +247 -0
- package/src/primitives/styles/nav.css +792 -0
- package/src/primitives/styles/overlay.css +362 -0
- package/src/primitives/styles/prose.css +146 -0
- package/src/primitives/styles/scale.css +175 -0
- package/src/primitives/styles/segmented.css +165 -0
- package/src/primitives/styles/slider.css +170 -0
- package/src/primitives/styles/spacer.css +17 -0
- package/src/primitives/styles/stack.css +25 -0
- package/src/primitives/styles/surface.css +403 -0
- package/src/primitives/styles/tabs.css +223 -0
- package/src/primitives/styles/typography.css +144 -0
- package/src/primitives/styles/utilities.css +24 -0
- package/src/primitives/types.ts +385 -0
- package/src/primitives/utils.ts +254 -0
- package/src/seo/JSONLD.astro +35 -0
- package/src/seo/SEOHead.astro +47 -0
- package/src/seo/cms.ts +80 -0
- package/src/seo/index.ts +10 -0
- package/src/seo/integration.ts +231 -0
- package/src/seo/lib/jsonld.ts +334 -0
- package/src/seo/lib/meta.ts +205 -0
- package/src/seo/lib/redirects.ts +283 -0
- package/src/seo/lib/robots.ts +33 -0
- package/src/seo/lib/rss.ts +98 -0
- package/src/seo/lib/sitemap.ts +105 -0
- package/src/seo/lib/url.ts +68 -0
- package/src/tokens/base.css +71 -0
- package/src/tokens/tokens.css +210 -0
|
@@ -0,0 +1,510 @@
|
|
|
1
|
+
# @sinnstack/ui/primitives
|
|
2
|
+
|
|
3
|
+
Astro primitives for layout, typography, buttons, choice controls, forms, surfaces, content containers, navigation, overlays, data display, media and accessibility utilities. All are `.astro` components that render static HTML. A few features ship a small script, each loaded once per page and only on pages that use it: Toggle (~300 B), Checkbox `indeterminate` (~100 B), Form `validate="inline"` (~1.5 KB gzipped), Dialog/Drawer/Sheet fallback (~0.5 KB), Tooltip Esc handling (~300 B), Table client sorting (~1 KB), MetricCard sparkline readout (~1 KB), FocusTrap (~1.5 KB) and ReducedMotion (~0.8 KB).
|
|
4
|
+
|
|
5
|
+
```astro
|
|
6
|
+
---
|
|
7
|
+
import '@sinnstack/ui/tokens.css'; // once, in the root layout
|
|
8
|
+
import '@sinnstack/ui/base.css'; // optional page baseline
|
|
9
|
+
import { Container, Stack, Heading, Text, Button, Checkbox } from '@sinnstack/ui/primitives';
|
|
10
|
+
---
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
**Strict CSP:** set `build.inlineStylesheets: 'never'` and `vite.build.assetsInlineLimit: 0` in `astro.config`. Without the second setting, Astro inlines small scripts such as Toggle's. `apps/playground` shows the config.
|
|
14
|
+
|
|
15
|
+
**Specificity:** selectors are wrapped entirely in `:where()`, pseudo-classes included, so component rules have zero specificity. A component's internal states (loading beats disabled, pressed beats variant) are resolved by source order within one file. The few rules where one component adjusts another (spacing after a SegmentedControl legend, a FormError inside a fieldset or choice, hiding the ReducedMotion toggle) carry one class of specificity instead, so they hold whichever stylesheet loads last. Site CSS in `@layer sinn.overrides`, or unlayered, still beats all of them.
|
|
16
|
+
|
|
17
|
+
**Layer order:** every stylesheet in the library opens with the full order statement (`@layer sinn.reset, sinn.tokens, sinn.primitives, sinn.data, sinn.motion, sinn.blocks, sinn.overrides;`). The browser fixes the order from the first `@layer` it meets, and with per-component imports any stylesheet can be first. `pnpm --filter @sinnstack/ui test` checks this.
|
|
18
|
+
|
|
19
|
+
## How they're built
|
|
20
|
+
|
|
21
|
+
- **Token props only.** Spacing and sizing props take token keys (`gap="m"`, `min="s"`), which are rendered as `data-*` attributes and mapped to CSS variables in `styles/scale.css`. No `style` attributes are emitted, so pages work under a strict CSP that blocks inline styles.
|
|
22
|
+
- **Zero specificity.** Selectors are wrapped in `:where()` (the few cross-component exceptions are listed above) and live in `@layer sinn.primitives`. Any site or block CSS overrides them without `!important`.
|
|
23
|
+
- **Logical properties throughout** (`inline-size`, `margin-block`, `padding-inline`), so RTL works with no extra code.
|
|
24
|
+
- **No breakpoints.** Grid and the Flex switcher respond to their own width, so they behave the same in a sidebar or a full-width slot. Container sets `container-type: inline-size` so blocks inside can use `@container`.
|
|
25
|
+
- **Every component** takes `class` and forwards any other HTML attribute (`id`, `aria-*`, `data-tina-field`…). Most take `as` to render a semantic element.
|
|
26
|
+
- **Lists keep their semantics.** When Stack, Cluster or Grid render as `ul`/`ol`, list bullets are removed and `role="list"` is added back, because Safari/VoiceOver drop list semantics once `list-style: none` is set.
|
|
27
|
+
|
|
28
|
+
## Prop vocabulary
|
|
29
|
+
|
|
30
|
+
The same word means the same thing on every component, here and in `@sinnstack/ui/blocks` and `@sinnstack/ui/data`.
|
|
31
|
+
|
|
32
|
+
| Prop | Means | Values |
|
|
33
|
+
|---|---|---|
|
|
34
|
+
| `variant` | Visual treatment | Drawn from one set per kind of thing. Toned elements: `solid · soft · outline · ghost` (Button), `soft · outline · stripe` (Callout), `solid · soft · outline` (CTABanner). Single containers: `outline · elevated · filled` (Card, CardGrid), `outline · plain` (ContactCard, ContactForm, MetricCard, Table). Collections: `plain · divided · card` (FeatureGrid, Steps, Disclosure; Accordion has no `plain`), `plain · divided · inset` (List). Navigation: `underline · pill · solid · plain` (NavMenu; Tabs uses `underline · pill`). Divider: line style `solid · dashed · dotted` |
|
|
35
|
+
| `layout` | Arrangement of the parts | Per component: Hero `text · split · media`, LogoCloud `strip · grid`, CardGrid `grid · list`, DescriptionList `stacked · inline · grid · summary` |
|
|
36
|
+
| `tone` | Colour family only | `accent · neutral · info · success · warning · danger` (text adds `default · muted · inherit`) |
|
|
37
|
+
| `emphasis` | Strength, not colour | `subtle · default · strong` (Divider) |
|
|
38
|
+
| `background` | Section or panel fill | `none · default · subtle · sunken · raised · tinted · strong`; `tinted` and `strong` take a `tone` |
|
|
39
|
+
| status values | Data tones (Table, ListItem, DescriptionList, Bar) | `success · warning · danger` (`good`/`bad` still work) |
|
|
40
|
+
| `size` | The s/m/l scale | `s · m · l` (MetricCard `l` is the big headline figure). Text components use the type scale |
|
|
41
|
+
| `containerSize` | Width of an inner Container | `narrow · default · wide · full` (Navbar, Footer, blocks). Container itself keeps `size` |
|
|
42
|
+
| `fullWidth` | Stretch to fill the row | Button, ButtonGroup, Tabs, SegmentedControl |
|
|
43
|
+
| `columns` | Column count | Grid, BulletList, blocks |
|
|
44
|
+
| `marker` | List marker | `check · dot · none` (BulletList, MediaText) |
|
|
45
|
+
| `<part>Level` | Heading level of a part | `headingLevel`, `titleLevel`, `itemTitleLevel` |
|
|
46
|
+
| aspect ratios | CSS syntax | `'16/9' · '3/2' · '4/3' · '1/1'` (Card, CardGrid, Hero, MediaText) |
|
|
47
|
+
|
|
48
|
+
Exceptions kept on purpose: HeroCarousel `minHeight="banner"` (a height that follows the width), FocusRing `tone`, Navbar `linkSize`.
|
|
49
|
+
|
|
50
|
+
### Renamed props and values
|
|
51
|
+
|
|
52
|
+
The old names still work and look exactly the same (the markup uses the new attribute values, which the CSS targets). In `astro dev` each one logs a one-time console warning naming the new spelling; production builds stay silent.
|
|
53
|
+
|
|
54
|
+
| Component | Old | New |
|
|
55
|
+
|---|---|---|
|
|
56
|
+
| Grid | `cols` | `columns` |
|
|
57
|
+
| Divider | `tone` | `emphasis` |
|
|
58
|
+
| Tabs | `variant="pills"`, `fitted` | `variant="pill"`, `fullWidth` |
|
|
59
|
+
| SegmentedControl | `block` | `fullWidth` |
|
|
60
|
+
| Disclosure, Accordion | `variant="bordered"` | `variant="divided"` |
|
|
61
|
+
| Callout | `variant="accent"` | `variant="stripe"` |
|
|
62
|
+
| Card | `mediaAspect="16-9"` (dash forms) | `mediaAspect="16/9"` |
|
|
63
|
+
| Surface | `background="accent"` (and `success · warning · danger`) | `background="tinted" tone="accent"` |
|
|
64
|
+
| Navbar, Footer | `size` | `containerSize` |
|
|
65
|
+
| MetricCard | `size="hero"` | `size="l"` |
|
|
66
|
+
| Table, ListItem, DescriptionList, Bar | tone `good` / `bad` | `success` / `danger` |
|
|
67
|
+
| BulletList | `columnMin` as a CSS length | a Measure key (`xs · s · m · l · xl`); other values fall back to 14rem with a dev warning |
|
|
68
|
+
| utils | `deltaTone()` returned `good · bad · muted` | returns `success · danger · muted` |
|
|
69
|
+
|
|
70
|
+
Blocks and data have their own rename tables in their READMEs.
|
|
71
|
+
|
|
72
|
+
## Space scale
|
|
73
|
+
|
|
74
|
+
`none · 3xs · 2xs · xs · s · m · l · xl · 2xl · 3xl`. Fluid between 320 px and 1240 px with rem bounds, so the values follow browser zoom.
|
|
75
|
+
|
|
76
|
+
## Measure scale (Grid `min`, Flex `switchAt`)
|
|
77
|
+
|
|
78
|
+
`xs 12rem · s 16rem · m 20rem · l 26rem · xl 34rem`
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
### Container
|
|
83
|
+
|
|
84
|
+
Constrains content to a maximum width, with gutters.
|
|
85
|
+
|
|
86
|
+
| Prop | Type | Default |
|
|
87
|
+
|---|---|---|
|
|
88
|
+
| `as` | HTML tag | `div` |
|
|
89
|
+
| `size` | `narrow` (65ch) · `default` · `wide` · `full` | `default` |
|
|
90
|
+
| `gutter` | Space | `m` |
|
|
91
|
+
| `query` | boolean: make it a query container | `true` |
|
|
92
|
+
|
|
93
|
+
### Stack
|
|
94
|
+
|
|
95
|
+
Vertical flow with consistent spacing between children.
|
|
96
|
+
|
|
97
|
+
| Prop | Type | Default |
|
|
98
|
+
|---|---|---|
|
|
99
|
+
| `as` | HTML tag | `div` |
|
|
100
|
+
| `gap` | Space | `m` |
|
|
101
|
+
| `align` | `start · center · end · stretch` | `stretch` |
|
|
102
|
+
| `justify` | `start · center · end · between` | `start` |
|
|
103
|
+
| `fill` | boolean: `block-size: 100%` | `false` |
|
|
104
|
+
|
|
105
|
+
A card whose footer sits at the bottom: `<Stack fill>…<Spacer grow size="none" /><Footer /></Stack>`
|
|
106
|
+
|
|
107
|
+
### Cluster
|
|
108
|
+
|
|
109
|
+
Horizontal group that wraps onto new lines (tags, buttons, links).
|
|
110
|
+
|
|
111
|
+
| Prop | Type | Default |
|
|
112
|
+
|---|---|---|
|
|
113
|
+
| `as` | HTML tag | `div` |
|
|
114
|
+
| `gap` / `rowGap` | Space | `s` / same as `gap` |
|
|
115
|
+
| `justify` | `start · center · end · between · around · evenly` | `start` |
|
|
116
|
+
| `align` | `start · center · end · stretch · baseline` | `center` |
|
|
117
|
+
|
|
118
|
+
### Flex
|
|
119
|
+
|
|
120
|
+
General flexbox. Use Stack or Cluster first when either one fits.
|
|
121
|
+
|
|
122
|
+
| Prop | Type | Default |
|
|
123
|
+
|---|---|---|
|
|
124
|
+
| `as` | HTML tag | `div` |
|
|
125
|
+
| `direction` | `row · column · row-reverse · column-reverse` | `row` |
|
|
126
|
+
| `wrap` | boolean | `false` |
|
|
127
|
+
| `gap` / `rowGap` | Space | `s` |
|
|
128
|
+
| `justify` / `align` | see Cluster | `start` / `stretch` |
|
|
129
|
+
| `inline` | boolean: `inline-flex` | `false` |
|
|
130
|
+
| `switchAt` | Measure: row above it, column below it. Overrides `direction` | — |
|
|
131
|
+
|
|
132
|
+
Give a child `data-flex-grow` to make it fill the remaining space.
|
|
133
|
+
|
|
134
|
+
### Grid
|
|
135
|
+
|
|
136
|
+
Responsive grid with no breakpoints.
|
|
137
|
+
|
|
138
|
+
| Prop | Type | Default |
|
|
139
|
+
|---|---|---|
|
|
140
|
+
| `as` | HTML tag | `div` |
|
|
141
|
+
| `min` | Measure: smallest width an item can have | `s` |
|
|
142
|
+
| `columns` | 1–6: most columns allowed in a row (`cols` is the deprecated name) | as many as fit |
|
|
143
|
+
| `fit` | boolean: `auto-fit`, so items stretch when there are too few to fill a row | `false` |
|
|
144
|
+
| `gap` / `rowGap` | Space | `m` |
|
|
145
|
+
| `align` | `start · center · end · stretch` | `stretch` |
|
|
146
|
+
|
|
147
|
+
`min()` clamps every item to 100% of the grid's width, so nothing scrolls sideways at 320 px or 200% zoom.
|
|
148
|
+
|
|
149
|
+
### Spacer
|
|
150
|
+
|
|
151
|
+
Empty space, hidden from assistive tech (`aria-hidden`). Use `gap` first when it can do the job.
|
|
152
|
+
|
|
153
|
+
| Prop | Type | Default |
|
|
154
|
+
|---|---|---|
|
|
155
|
+
| `size` | Space | `m` |
|
|
156
|
+
| `axis` | `block · inline` | `block` |
|
|
157
|
+
| `grow` | boolean: `flex-grow: 1` | `false` |
|
|
158
|
+
|
|
159
|
+
### Divider
|
|
160
|
+
|
|
161
|
+
| Prop | Type | Default |
|
|
162
|
+
|---|---|---|
|
|
163
|
+
| `orientation` | `horizontal · vertical` | `horizontal` |
|
|
164
|
+
| `label` / `labelAlign` | string / `start · center · end` | — / `center` |
|
|
165
|
+
| `emphasis` | `subtle · default · strong`: how strongly the line reads (`tone` is the deprecated name) | `default` |
|
|
166
|
+
| `variant` | `solid · dashed · dotted` | `solid` |
|
|
167
|
+
| `thickness` | `thin · thick` | `thin` |
|
|
168
|
+
| `space` | Space (margin along the axis it separates) | `m` |
|
|
169
|
+
| `decorative` | boolean: hide from assistive tech | `false` |
|
|
170
|
+
|
|
171
|
+
How each kind is exposed to assistive tech: a plain horizontal divider is an `<hr>`. A vertical or labelled divider is a `role="separator"` element with `aria-orientation`, and a labelled one uses its label as the accessible name. With `decorative`, the divider gets `aria-hidden`. Colors come from border tokens, which switch in dark mode (`light-dark()`) and are replaced by system colors in forced-colors mode.
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## Typography
|
|
176
|
+
|
|
177
|
+
Shared props on Text, Heading, Label and Caption: `size` (`xs`–`4xl`), `tone` (`default · muted · accent · danger · success`), `weight` (`regular · medium · semibold · bold`), `align` (`start · center · end`).
|
|
178
|
+
|
|
179
|
+
| Component | Renders | Notable props |
|
|
180
|
+
|---|---|---|
|
|
181
|
+
| **Text** | `p` (`as` to change) | `truncate` (one line), `lines` 2–5 (clamp), `measure` (cap at ~65ch). Uses `text-wrap: pretty` |
|
|
182
|
+
| **Heading** | `h1`–`h6` | `level` is **required**. `size` defaults by level (1→3xl … 6→s) and can be changed independently. Uses `text-wrap: balance` |
|
|
183
|
+
| **Link** | `a` | `tone` (`accent · neutral · inherit`), `underline` (`always · hover · none`), `newTab` (adds hidden "(opens in a new tab)" text), `external` (auto-detected against `Astro.site`; adds arrow icon and `rel="external"`). Styles `aria-current` |
|
|
184
|
+
| **Label** | `label` (`as`: `span · legend · div · dt`) | `required` (visual `*`; also put `required` on the input), `optional` (true or a translated string) |
|
|
185
|
+
| **Caption** | `p` (`as`: `figcaption · small · span · div`) | Muted by default. Give it an `id` and reference it from `aria-describedby` |
|
|
186
|
+
| **Prose** | `div` (`as`: `article · section`) | Typography for content whose markup you don't control (CMS rich text, Markdown): headings, lists, quotes, code, tables, figures. `size` (`s · m · l`), `measure` (~65ch), `align`. Links stay underlined. Wrap embedded components in `class="sinn-not-prose"` so they keep their own look. For Tina rich text use `RichText` from `@sinnstack/ui/blocks` |
|
|
187
|
+
|
|
188
|
+
A `<button class="sinn-link">` (an action that reads like a link, e.g. "Cookie settings") loses its button chrome and looks like Link.
|
|
189
|
+
|
|
190
|
+
Keep `underline="always"` for links inside paragraphs (WCAG 1.4.1). Use `hover` or `none` only in navigation, footers and cards, where links are obvious from context.
|
|
191
|
+
|
|
192
|
+
## Buttons
|
|
193
|
+
|
|
194
|
+
Shared props: `variant` (`solid · soft · outline · ghost`), `tone` (`accent · neutral · danger`), `size` (`s` 32 px · `m` 40 px · `l` 48 px, all above the 24 px target minimum), `fullWidth`. Put icons in the `icon-start` and `icon-end` slots with `aria-hidden="true"`.
|
|
195
|
+
|
|
196
|
+
| Component | Renders | Notes |
|
|
197
|
+
|---|---|---|
|
|
198
|
+
| **Button** | `button` | `type` defaults to `"button"`, so pass `type="submit"` explicitly. `loading` keeps the button's size, shows a spinner and hidden "Loading" text, sets `aria-busy` and disables the button so it can't be submitted twice. The spinner slows down rather than stopping under reduced motion |
|
|
199
|
+
| **LinkButton** | `a` | Navigation styled as a button. `newTab`. `disabled` removes `href` and sets `aria-disabled` |
|
|
200
|
+
| **IconButton** | Button or LinkButton (when `href` is given) | `label` is **required**. It renders as visually hidden text rather than `aria-label`, so browser auto-translation picks it up. Defaults to `ghost` |
|
|
201
|
+
| **ButtonGroup** | `div role="group"` | `label`, `attached` (segmented, shared borders), `orientation`, `gap`, `fullWidth` |
|
|
202
|
+
| **Toggle** | `button aria-pressed` | `pressed`, `name`/`value` (a hidden input submits the value only while pressed), `label` for icon-only toggles. Variants: `outline` (default), `ghost`, `soft`. Fires `sinn-toggle-change` (bubbles, composed; detail `{ pressed, value }`). Pressed state adds a thicker border so it isn't shown by color alone |
|
|
203
|
+
|
|
204
|
+
Switch vs Toggle vs Checkbox: a **Switch** is a setting that takes effect immediately ("Email notifications"). A **Toggle** is a pressed or unpressed tool ("Bold", "Grid view"). A **Checkbox** is a choice that's applied when the form is submitted.
|
|
205
|
+
|
|
206
|
+
## Choice controls
|
|
207
|
+
|
|
208
|
+
Checkbox, Radio and Switch are native `<input>`s with `appearance: none`, so form submission, validation, keyboard handling and screen-reader announcements are all native. In forced-colors mode they fall back to native rendering.
|
|
209
|
+
|
|
210
|
+
Shared props: `label` (or rich content in the default slot), `description` (linked via `aria-describedby`), `error` (Checkbox and Switch only: message under the label), `invalid` (sets `aria-invalid` without a message), `messages`, `size` (`s · m · l`), `labelPosition` (`end · start`). **`class` goes on the wrapper; every other attribute goes on the input.** With no label, pass `aria-label`. An `id` is generated when you don't pass one.
|
|
211
|
+
|
|
212
|
+
| Component | Notes |
|
|
213
|
+
|---|---|
|
|
214
|
+
| **Checkbox** | `indeterminate` is applied by a ~100 B script on load (it's a DOM property, not an attribute) |
|
|
215
|
+
| **Radio** | `name` is required. Arrow-key navigation is native. Always place radios inside a ChoiceGroup |
|
|
216
|
+
| **Switch** | `<input type="checkbox" role="switch">`, announced as "switch, on/off". The thumb moves with `inset-inline-start`, so it slides the correct way in RTL |
|
|
217
|
+
| **ChoiceGroup** | Preset of Fieldset (see Forms). Put group errors here |
|
|
218
|
+
|
|
219
|
+
## Disclosure & selection
|
|
220
|
+
|
|
221
|
+
Each control is the native element first: radios, range inputs, `<details>`, in-page links. They work with no JavaScript. Where a script adds something, it's a small module loaded once per page and delegated from `document`, and the page looks the same before and after it runs (no layout shift).
|
|
222
|
+
|
|
223
|
+
| Component | Built on | JS | Notes |
|
|
224
|
+
|---|---|---|---|
|
|
225
|
+
| **SegmentedControl** | `<fieldset>` of radios | 0 KB | One choice from 2–8 short options. Arrow keys, form submission and "radio button 2 of 3" are native. `width="equal"` slides a highlight under the choice (positioned with `:has()`, no script); `fit` sizes segments to their labels. `fullWidth` stretches the control to its container (`block` is the deprecated name). `iconOnly` keeps labels as accessible names. The selected segment has a `border-strong` edge, so it reads at 3:1 against the track, not just through a shadow |
|
|
226
|
+
| **Slider** | `<input type="range">` (two for a range) | ~2 KB | Fill, ticks and readout drawn on an SVG rail inset by half a thumb, so percentages line up exactly with the native thumb. The script formats the announced value (`aria-valuetext`: "$20", "25 miles"), keeps a range's thumbs `minGap` steps apart, stacks the right thumb on top, and moves the nearer thumb when the rail is clicked. Without JS the inputs still work; the fill and readout, which would go stale, are hidden (`@media (scripting: none)`) |
|
|
227
|
+
| **Disclosure** | `<details>`/`<summary>` | 0 KB | `variant`: `plain` (text toggle), `divided` (rules above and below; `bordered` is the deprecated name), `card`. Opening animates with `::details-content` where supported, and closed content prints. Chrome opens it for find-in-page and for links into it |
|
|
228
|
+
| **Accordion** | a group of `<details>` | ~1 KB | `variant`: `divided` (default; `bordered` is the deprecated name) or `card`. `mode="single"` uses the native `name` attribute. `headingLevel` wraps titles in headings (exposed inside the summary in Chrome; not yet checked with VoiceOver/NVDA). The script adds "Show all sections" (3+ sections; its row is reserved from first paint), ↑/↓/Home/End between headers, opens the section holding a `#link` target, and opens everything for printing |
|
|
229
|
+
| **Tabs** | in-page links + panels | ~1.4 KB | `variant`: `underline` or `pill` (`pills` deprecated). `fullWidth` stretches the tabs across the row (`fitted` deprecated). Without JS, links switch panels through `:target`. The script adds the ARIA tabs pattern: roles, one tab stop, ←/→ (↑/↓ vertical, mirrored in RTL), Home/End, automatic or `manual` activation, disabled tabs skipped. `/page#pricing` and links to `#pricing` select that tab; `syncHash` writes the selection to the URL. Vertical tabs move above the panels below 36rem (container query). Long lists scroll inside themselves and fade at the edge. Every panel prints under its label |
|
|
230
|
+
|
|
231
|
+
**Content for Accordion and Tabs** comes from `items` (`{ id, title/label, content? }`) plus a named slot per `id` for rich content: `<Fragment slot="pricing">…</Fragment>`. Accordion also takes a function child that renders any item, for content from a list: `{(item, i) => <RichText value={answers[i]} />}` (Astro can't name slots in a loop). Plain `content` strings are escaped. The `items` shape is what a CMS list gives you, so an FAQ or tabs block can map its Tina fields straight onto it.
|
|
232
|
+
|
|
233
|
+
**Events** (bubble, composed): `sinn-slider-change` `{ value }` on commit (native `input`/`change` fire too); `sinn-tab-change` `{ id, index, previousId }`. SegmentedControl fires the native `change`.
|
|
234
|
+
|
|
235
|
+
**Formats:** Slider takes any `ValueFormat`. A new `unit` kind (`{ kind: 'unit', unit: 'mile', unitDisplay: 'long' }` → "25 miles") uses Intl's localized units; an unknown unit falls back to the plain number.
|
|
236
|
+
|
|
237
|
+
## Forms
|
|
238
|
+
|
|
239
|
+
Forms are built on native HTML validation (`required`, `type="email"`, `pattern`, `minlength`…), so they work with no JavaScript and a normal server round-trip.
|
|
240
|
+
|
|
241
|
+
| Component | Renders | Notes |
|
|
242
|
+
|---|---|---|
|
|
243
|
+
| **Form** | `form` (`method="post"` by default) | `validate`: `native` (default, 0 KB) · `inline` (opt-in script) · `none` (`novalidate`, server only). `errors` shows a focused summary at the top, linking to each field. `submitError` is for failures not tied to a field. `gap` sets spacing |
|
|
244
|
+
| **FormField** | label + description + control + error | Used inside Input, Textarea and Select. For custom controls, pass a function child: `{(field) => <My {...field.attrs} />}` |
|
|
245
|
+
| **Input** | `input` | All field props, plus `type`, `size` and `start`/`end` slots for addons ("$", ".com", an icon) |
|
|
246
|
+
| **Textarea** | `textarea` | `rows` (4), `resize`, `autosize` (`field-sizing: content`, where supported). Set the initial text with `value` |
|
|
247
|
+
| **Select** | native `select` | `options` (flat or grouped), `value`, `placeholder` (an empty first option, so `required` works), `multiple`. The chevron is drawn in CSS, so there's no data-URI image to allow in the CSP |
|
|
248
|
+
| **Fieldset** | `fieldset` + `legend` | `legend`, `description`, `error`, `required`, `hideLegend`, `legendSize` (`l` when the fieldset is the page's main question), `orientation`, `gap` |
|
|
249
|
+
| **ChoiceGroup** | Fieldset | Preset for radios and checkboxes (`gap="xs"`) |
|
|
250
|
+
| **FormDescription** | `p` | Field instructions. Reference its `id` from `aria-describedby` |
|
|
251
|
+
| **FormError** | `p` (field) · `div role="alert"` (form) | Field variant: hidden while empty, with an icon and a hidden "Error:" prefix. Form variant: summary with `title`, `errors` links and `autofocus` |
|
|
252
|
+
|
|
253
|
+
**Field props** (Input, Textarea, Select, Checkbox, Switch): `label`, `description`, `error`, `hideLabel`, `optional`, `messages`. Radios take `label`/`description`; their errors go on the Fieldset or ChoiceGroup. `class` goes on the field wrapper; every other attribute goes on the control.
|
|
254
|
+
|
|
255
|
+
**Wiring:** `for`/`id` are always set. `aria-describedby` points at the description, and at the error only while the error has content. `aria-invalid` is set from `error`.
|
|
256
|
+
|
|
257
|
+
### Server-side validation (no JS)
|
|
258
|
+
|
|
259
|
+
```astro
|
|
260
|
+
---
|
|
261
|
+
const result = Astro.request.method === 'POST' ? await handle(await Astro.request.formData()) : null;
|
|
262
|
+
---
|
|
263
|
+
<Form errors={result?.errors}>
|
|
264
|
+
<Input name="email" id="email" type="email" label="Email" autocomplete="email" required
|
|
265
|
+
value={result?.values.email} error={result?.fieldErrors.email} />
|
|
266
|
+
<Button type="submit">Send</Button>
|
|
267
|
+
</Form>
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
Astro Actions work the same way: pass `action={actions.contact}` and read the result with `Astro.getActionResult()`.
|
|
271
|
+
|
|
272
|
+
### Inline validation (`validate="inline"`)
|
|
273
|
+
|
|
274
|
+
When the script runs, the form gets `novalidate`. From then on:
|
|
275
|
+
- A field is checked when you leave it (if you changed it) and on submit. A field showing an error is re-checked on every keystroke, so the error clears as soon as the field is fixed.
|
|
276
|
+
- On submit it shows every error, focuses the first invalid control and fires `sinn-form-invalid` (detail `{ controls }`). An invalid submit is stopped before it reaches the page's own `submit` listeners, so a fetch handler only ever sees valid data.
|
|
277
|
+
- Radios validate as a group, and their error appears in the enclosing Fieldset.
|
|
278
|
+
- Messages are the browser's localized `validationMessage`, unless you pass `messages={{ valueMissing: 'Enter your email address', typeMismatch: '…' }}`.
|
|
279
|
+
- A valid native submit marks the form `aria-busy` and blocks double submits. The lock is released when the page is restored from the back/forward cache. A handler that calls `preventDefault()` manages its own state.
|
|
280
|
+
- Error-summary links move focus to the field (without JS they scroll to it).
|
|
281
|
+
- Without JS, the browser's native validation messages still work.
|
|
282
|
+
|
|
283
|
+
**Writing `pattern`:** browsers compile it with the regex `v` flag, so inside `[...]` escape `(`, `)`, `-`, `[`, `{`, `/` and `|`. Write `[0-9 \(\)\-]`, not `[0-9 ()-]`. An invalid pattern is silently ignored.
|
|
284
|
+
|
|
285
|
+
**Not included yet** (needs JS beyond this budget): password reveal, live character counter, async checks such as "email already registered". Do those on the server, or as Lit islands later.
|
|
286
|
+
|
|
287
|
+
## Surfaces & content
|
|
288
|
+
|
|
289
|
+
| Component | Renders | Props / notes |
|
|
290
|
+
|---|---|---|
|
|
291
|
+
| **Surface** | `div` (`as`) | `background` (`default · subtle · sunken · raised · tinted · none`), `tone` (`accent · neutral · success · warning · danger`, for `tinted`; the old `background="accent"` and the other tone names map to `tinted` + that tone), `padding` (Space, default `m`), `radius`, `border`, `elevation` 0–3, `scheme` (`light · dark`) |
|
|
292
|
+
| **Card** | `div` (`as="article"` for self-contained items) | `variant` (`outline · elevated · filled`), `size` (`s · m · l`, sets padding and radius), `orientation` (`vertical · horizontal`), `mediaAspect` (`16/9 · 3/2 · 4/3 · 1/1 · auto`; the dash forms still work). `media` slot for an image |
|
|
293
|
+
| **CardHeader** | `div` | `title`, `titleLevel` (default 3), `titleSize`, `titleId`, `description`, `eyebrow`, `href`. `actions` slot for menu or icon buttons |
|
|
294
|
+
| **CardContent** | `div` | `gap`. Grows to fill spare height |
|
|
295
|
+
| **CardFooter** | `div` | `justify` (`start · end · between · stretch`), `divider`, `gap` |
|
|
296
|
+
| **Panel** | `section` labelled by its title | `title`, `titleLevel` (default 2), `description`, `variant` (`outline · elevated · plain`), `size`, `divider`, `flush`, `collapsible`, `open`, `group`. Slots: `actions`, `header`, `footer` |
|
|
297
|
+
| **Callout** | `div` | `tone` (`info · success · warning · danger · neutral`), `variant` (`soft · outline · stripe`; `accent` is the deprecated name for `stripe`), `size` (`s · m`), `title`, `titleLevel`, `icon`, `toneLabel`, `live` (`off · polite · assertive`). Slots: `icon`, `actions` |
|
|
298
|
+
|
|
299
|
+
**Forcing a theme on part of a page:** `<Surface scheme="dark">` sets `color-scheme` on that element. Every color token is a `light-dark()` value that the browser resolves where it's used, so text, buttons, inputs and callouts inside all switch theme, with no duplicate dark styles.
|
|
300
|
+
|
|
301
|
+
**Cards in a row:** cards fill their grid cell (`block-size: 100%`), and CardContent grows, so cards share a height and their footers line up. Wrap them in `<Grid as="ul">` with each card in an `<li>`.
|
|
302
|
+
|
|
303
|
+
**Linked cards:** give CardHeader an `href`. The title becomes the card's only link, and its `::after` stretches over the whole card, so clicking anywhere on the card follows it. Screen readers hear one short link instead of the card's full text. Other buttons and links in the card are raised above the overlay and keep working. When the link has keyboard focus, the whole card gets the focus ring.
|
|
304
|
+
|
|
305
|
+
**Horizontal cards** sit side by side while the card is wider than ~30rem and stack when narrower. This uses the same technique as `<Flex switchAt>`, so it needs no breakpoints and works in any column.
|
|
306
|
+
|
|
307
|
+
**Collapsible panels** use native `<details>`, so they need no JS and keyboard support is built in. Panels with the same `group` form an exclusive accordion through the native `name` attribute: opening one closes the others. Trade-off: the summary is announced as a button, so screen-reader users can't jump to the title with heading navigation, and header `actions` aren't rendered in this mode.
|
|
308
|
+
|
|
309
|
+
**Callouts** are never told apart by color alone. Each tone has its own icon and a visually hidden prefix ("Warning: "), which you can translate with `toneLabel`. They're static by default. Use `live="polite"` for a message that appears after an action, and save `assertive` for urgent problems. A dismiss button would need JS, so it isn't included yet.
|
|
310
|
+
|
|
311
|
+
## Navigation
|
|
312
|
+
|
|
313
|
+
| Component | Renders | Props / notes |
|
|
314
|
+
|---|---|---|
|
|
315
|
+
| **SkipLink** | `a` | `target` (default `main`), `label`. Put it first in `<body>`. Mark the target `<main id="main" tabindex="-1" data-skip-target>` |
|
|
316
|
+
| **NavLink** | `a` (or `li > a` with `listItem`) | `href`, `match` (`exact · prefix`), `current` (override), `newTab`. Sets `aria-current` from `Astro.url` |
|
|
317
|
+
| **NavMenu** | `ul role="list"` (in `nav` when `label` is set) | `items` or NavLink children, `label`, `orientation`, `variant` (`underline · pill · plain`), `gap`. Vertical menus show one level of nested `items` |
|
|
318
|
+
| **Navbar** | `header` | `items`, `label`, `brandHref`, `brandLabel`, `collapse` (`s` 40rem · `m` 56rem · `l` 64rem · `always` · `never`), `align`, `sticky`, `blur`, `hideActionsWhenCollapsed`, `containerSize` (`size` deprecated), `menuLabel`, `closeLabel`. Slots: `brand`, `actions`, `menu-footer`, default (custom nav) |
|
|
319
|
+
| **Footer** | `footer` | `name`, `brandHref`, `description`, `sections`, `legal`, `label`, `legalLabel`, `headingLevel`, `year`, `containerSize` (`size` deprecated). Slots: `brand`, default, `social`, `bottom` |
|
|
320
|
+
| **Breadcrumbs** | `nav > ol` | `items` (`{ label, href? }[]`; the last is the current page), `label` (default `Breadcrumb`), `size` (`s · m`). Used by the blocks `PageHeader` |
|
|
321
|
+
|
|
322
|
+
**Current page:** NavLink, NavMenu and Footer compare each link with `Astro.url` when the page renders. The current page gets `aria-current="page"`. With `match="prefix"`, a section link also gets `aria-current="true"` on pages inside the section, so `/services` is marked on `/services/hosting`. `/` only matches itself, and links to other sites never match. The current item is shown with color, weight and a shape (an underline bar, a pill, or a side bar), never color alone.
|
|
323
|
+
|
|
324
|
+
**Mobile menu with no JavaScript:** below the `collapse` width, the links move into a sheet opened by a "Menu" button. The sheet is a native popover (`popovertarget`), so the browser handles Esc, clicking outside, the button's expanded state and Tab order (from the button into the menu). Below 26rem the button shows only its icon, and "Menu" stays as its accessible name. Browsers from before the Popover API (pre-2024) can't open the sheet.
|
|
325
|
+
|
|
326
|
+
**Small phones:** at 320px with a long text brand, the brand wraps between words and the action button wraps its text. To keep the bar to one line, use a logo image in the `brand` slot, or set `hideActionsWhenCollapsed` and repeat the action in `menu-footer`.
|
|
327
|
+
|
|
328
|
+
**Sticky header and anchors:** with `sticky`, the page gets `scroll-padding-block-start` automatically (via `:root:has(...)`), so focused elements, in-page links and the skip-link target never end up under the bar (WCAG 2.4.11).
|
|
329
|
+
|
|
330
|
+
**Breadcrumbs:** the last item renders as text with `aria-current="page"` (its `href` is ignored); other items without an `href` render as text. Separators are a CSS chevron (decorative, flipped in RTL), so screen readers read only the labels. The trail wraps when narrow instead of truncating. Pair it with `breadcrumbList()` from `@sinnstack/ui/seo/jsonld`.
|
|
331
|
+
|
|
332
|
+
**Not included yet:** dropdown submenus in the Navbar. They need a disclosure pattern with keyboard handling, which belongs with the Zag.js widgets.
|
|
333
|
+
|
|
334
|
+
`apps/playground/src/layouts/Site.astro` is the reference layout: SkipLink → (optional Topbar from `@sinnstack/ui/blocks`) → Navbar → `main` → Footer.
|
|
335
|
+
|
|
336
|
+
## Overlays
|
|
337
|
+
|
|
338
|
+
All five are built on browser features. The only scripts are a ~0.5 KB fallback for Dialog, Drawer and Sheet, which does almost nothing in current browsers, and ~300 B of Esc handling for Tooltip.
|
|
339
|
+
|
|
340
|
+
| Component | Built on | Props / notes |
|
|
341
|
+
|---|---|---|
|
|
342
|
+
| **Dialog** | `<dialog>` + `showModal()` | `id`, `title` (required, the accessible name; `hideTitle` keeps it for screen readers only), `titleLevel`, `description`, `size` (`s · m · l · xl · full`), `role` (`dialog · alertdialog`), `dismissible` (`any · closerequest · none`), `closeButton`, `closeLabel`, `footerJustify`. Slots: default (body), `header`, `footer` |
|
|
343
|
+
| **Drawer** | same | Full-height side panel. `side` (`start · end`), `size` (`s · m · l`). Same opening and closing rules |
|
|
344
|
+
| **Sheet** | same | Edge panel, bottom by default. `side` (`bottom · top · start · end`), `contained` (a centered column on wide screens), `handle` |
|
|
345
|
+
| **Popover** | Popover API + CSS anchor positioning | Renders its own trigger Button. `label`, `iconOnly`, button style props, `placement` (`bottom · top · start · end`), `align` (`start · center · end`), `mode` (`auto · manual`), `contentLabel` (gives it `role="dialog"` for interactive content), `padding`. Slot `trigger` for icon content |
|
|
346
|
+
| **Tooltip** | CSS + 300 B Esc script | `text`, `placement`, `type` (`description · label`). The trigger is a function child: `{(tip) => <IconButton {...tip.attrs} …/>}` |
|
|
347
|
+
|
|
348
|
+
### Opening and closing dialogs
|
|
349
|
+
|
|
350
|
+
Use invoker commands on any button. Button and IconButton have typed `commandfor` and `command` props:
|
|
351
|
+
|
|
352
|
+
```astro
|
|
353
|
+
<Button commandfor="cancel-appt" command="show-modal">Cancel appointment</Button>
|
|
354
|
+
<Dialog id="cancel-appt" title="Cancel this appointment?" role="alertdialog">
|
|
355
|
+
…
|
|
356
|
+
<Fragment slot="footer">
|
|
357
|
+
<Button variant="ghost" tone="neutral" commandfor="cancel-appt" command="close" value="keep" autofocus>Keep it</Button>
|
|
358
|
+
<Button tone="danger" commandfor="cancel-appt" command="close" value="cancel">Cancel appointment</Button>
|
|
359
|
+
</Fragment>
|
|
360
|
+
</Dialog>
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
- **What the platform handles:** focus moves into the dialog (or to the `autofocus` element) and back to the trigger on close. The page behind is inert. Esc closes. The dialog is announced and named by its title.
|
|
364
|
+
- **What this library adds:** the page stops scrolling while a modal is open (CSS `:has(:modal)`). Open and close animations use `@starting-style`; with reduced motion, dialogs simply appear. On small screens, footer buttons stack full-width with the primary (last) button on top.
|
|
365
|
+
- **Closing:** the × button, Esc, `command="close"` (the button's `value` becomes `dialog.returnValue`), `<form method="dialog">`, or a backdrop click when `dismissible="any"`. Listen for the native `close` event.
|
|
366
|
+
- **`role="alertdialog"`:** for confirmations that need an answer. There's no × button, and Esc and backdrop clicks don't close it, so the user has to pick an action. Put `autofocus` on the safe one.
|
|
367
|
+
- **Browser support:** invoker commands are native in Chrome 135+, Safari 26+ and Firefox 144+. `closedby` is native in Chromium 134+ and Firefox 141+. The fallback script covers older browsers; both paths are tested.
|
|
368
|
+
|
|
369
|
+
### Popover
|
|
370
|
+
|
|
371
|
+
Anchored to its trigger through the implicit anchor that `popovertarget` creates, so it needs no ids in CSS and no inline styles. It flips to the other side when there's no room. Esc, clicking outside and the trigger close it, and the trigger exposes its expanded state. Browsers without anchor positioning show it as a small centered card. For menus with arrow-key navigation, use the Zag.js menu from the widgets package.
|
|
372
|
+
|
|
373
|
+
### Tooltip
|
|
374
|
+
|
|
375
|
+
It shows on hover after ~350 ms, and right away on keyboard focus. It meets WCAG 1.4.13: you can move the pointer onto the bubble (hoverable), it stays while hovered or focused (persistent), and Esc hides it without moving focus (dismissible). Guidelines:
|
|
376
|
+
- Never put essential information only in a tooltip; touch screens can't hover.
|
|
377
|
+
- The trigger must be focusable.
|
|
378
|
+
- Use plain text only. For links or buttons, use Popover.
|
|
379
|
+
- Use `type="label"` only when the tooltip text is the control's name.
|
|
380
|
+
- The bubble is positioned with `position: absolute`, so a parent with `overflow: hidden` can clip it.
|
|
381
|
+
|
|
382
|
+
## Data display
|
|
383
|
+
|
|
384
|
+
These components are built for sites whose main appeal is how data is shown. All formatting runs at render time with `Intl` (`formatValue` is exported), so pages ship no formatting code. Every data-driven width (bars, meters, the goal track) comes from a `data-pct` attribute (0–100) mapped in CSS, so none of it needs inline styles and the strict CSP holds.
|
|
385
|
+
|
|
386
|
+
**Rules applied everywhere**
|
|
387
|
+
- **Text in text colors:** values, labels and legends use text colors. Colored marks (bars, dots, stars) carry the meaning.
|
|
388
|
+
- **Never color alone:** good or bad values always come with an arrow, a sign, or a status icon plus a hidden label.
|
|
389
|
+
- **Figures:** columns of numbers use tabular figures so digits line up; big standalone values keep proportional figures, which look tighter.
|
|
390
|
+
- **Typographic minus:** negative numbers use a real minus sign (−), which screen readers announce as "minus".
|
|
391
|
+
- **Thin marks:** bars are 8px with a square start and a 4px rounded end, and rules are hairlines.
|
|
392
|
+
- **Contrast is checked:** the token check covers the sparkline line, meter fill against its track, and star outlines (3:1 for graphics).
|
|
393
|
+
|
|
394
|
+
| Component | Props / notes |
|
|
395
|
+
|---|---|
|
|
396
|
+
| **List** | `ul role="list"` (or `ordered`). `variant` (`divided · inset · plain`), `density` |
|
|
397
|
+
| **BulletList** | Short text items with CSS-only markers (no data-display CSS). `items` or `<li>` children. `marker`: `check` (white disc, hairline ring, accent check) · `dot` · `none`. `columns={2}`: two balanced columns, top to bottom, only when each gets `columnMin`, a Measure key (`xs · s · m · l · xl`; default 14rem). `gap`, `ordered`. Markers recolor on strong surfaces |
|
|
398
|
+
| **ListItem** | `title`, `description`, `meta` (dot-separated; `srLabel` adds context), `href` (whole-row link with a chevron), `current`, `initials` (avatar from a name), `value` + `valueFormat` + `valueDetail` + `valueTone`, `delta` + `deltaFormat` + `higherIsBetter`, `titleLevel`, `truncate`, `align`. Slots: `leading`, `trailing`, default |
|
|
399
|
+
| **DescriptionList** | `items` or children. `layout`: `stacked` · `inline` (aligned term and value columns, stacking below 28rem) · `grid` (key-fact tiles) · `summary` (label … amount rows with tabular figures and an emphasized total). Items accept `value` + `format`, `detail`, `tone`, `emphasis`, `href` |
|
|
400
|
+
| **Table** | Built from `columns` + `rows`. `caption` (required), `description`, `footer` (totals), `currentKey`, `sortable` (`client · link`), `sort`, `stack`, `stickyFirst`, `maxHeight`, `zebra`, `density`, `variant`, `loading`, `emptyMessage`/`empty` slot, `cell` slot for rich cells |
|
|
401
|
+
| **Rating** | `value` (fractional fill, e.g. 4.3), `max`, `count` + `countLabel` (pluralized), `countHref`, `distribution` (a breakdown with one bar per star level), `size` |
|
|
402
|
+
| **MetricCard** | `label`, `value` + `format` + `unit`, `delta` or `previous` + `period` + `higherIsBetter`, `trend` + `trendLabels` + `trendPosition`, `target` + `targetLabel`, `footnote`, `href`, `size` (`s · m · l`; `hero` is the deprecated name for `l`), `variant` (`outline · plain`), `loading`. Slot `icon` |
|
|
403
|
+
|
|
404
|
+
**Formats:** `text · number · integer · compact (12.9K above 10,000) · currency · percent (from a fraction) · date · datetime · delta (+12) · delta-percent (+12.4%)`, or `{ kind, currency, digits, compact }`. Calendar dates (`YYYY-MM-DD`) never shift a day because of the server's time zone. Empty values render as "—".
|
|
405
|
+
|
|
406
|
+
### Table
|
|
407
|
+
|
|
408
|
+
- **Columns:**
|
|
409
|
+
- Numeric formats are end-aligned with tabular figures automatically.
|
|
410
|
+
- `rowHeader` makes the first column `<th scope="row">`.
|
|
411
|
+
- `hideBelow` drops low-priority columns in narrow containers.
|
|
412
|
+
- **Showing values:**
|
|
413
|
+
- `tone: 'delta'` colors a change by sign and adds an arrow, with an "Up"/"Down" phrase for screen readers. Set `higherIsBetter: false` for costs or wait times.
|
|
414
|
+
- A tone function (e.g. `v > 0.05 ? 'danger' : 'default'`; status tones are `success · warning · danger`, and `good`/`bad` still work) adds a status icon and a hidden label ("Flagged"), which you can change with `toneLabel`.
|
|
415
|
+
- `bar: true` draws an inline bar scaled to the column's largest value.
|
|
416
|
+
- **Scrolling:** wide tables scroll inside a focusable, labelled region. Edge shadows appear only while there's more to scroll (scroll-driven CSS). The header is always sticky; `stickyFirst` also pins the first column.
|
|
417
|
+
- **`stack`:** below 36rem of width, each row becomes a card of label/value pairs. ARIA roles are added so screen readers still read it as a table.
|
|
418
|
+
- **Sorting:**
|
|
419
|
+
- `client` (~1 KB): header buttons, numeric or date or natural text order, empty values last in both directions, stable ties, `aria-sort`, and a polite announcement ("Sorted by Visits, ascending"; translate with `sortedTemplate` and `directionLabels`).
|
|
420
|
+
- `link`: header links like `?sort=billed&dir=desc`, sorted on the server. This works without JS but needs SSR.
|
|
421
|
+
- **States:** `loading` shows skeleton rows at their final height (`aria-busy`); the empty state shows a centered message.
|
|
422
|
+
|
|
423
|
+
### MetricCard
|
|
424
|
+
|
|
425
|
+
It follows the stat-tile contract:
|
|
426
|
+
- **Label:** sentence case, no colon.
|
|
427
|
+
- **Value:** auto-compacted (1,284 · 12.9K · $4.2M), kept exact in `<data value>`.
|
|
428
|
+
- **Delta:** signed and compared against a named period. Its color depends on direction and on whether up is good, and it always has an arrow and a full sentence for screen readers ("Down 7.9% vs last month").
|
|
429
|
+
- **Trend:** a sparkline of ~12 points in a muted color, with the current period as an accent dot ringed in the surface color.
|
|
430
|
+
- Hovering snaps a crosshair to the nearest period, with a tooltip that shows the value first.
|
|
431
|
+
- The sparkline is focusable: ←/→/Home/End step through the points, and each step is announced.
|
|
432
|
+
- A visually hidden table holds the same data.
|
|
433
|
+
- The script is ~1 KB, loaded only when a page has an interactive sparkline.
|
|
434
|
+
- **`target`:** adds a goal meter whose track is a lighter step of the fill's color.
|
|
435
|
+
- **States:** `loading` shows skeletons at the final size; an empty value shows "—" and "No data".
|
|
436
|
+
- **Layout:** put cards in `<Grid min="xs">` for a row of KPIs that share a height. `trendPosition="end"` moves the sparkline beside the figures when the card is at least 22rem wide.
|
|
437
|
+
|
|
438
|
+
## Media
|
|
439
|
+
|
|
440
|
+
Image, Picture and Thumbnail run Astro's image service (`getImage` from `astro:assets`, which needs **Astro 5.10+** for `fit`/`position`) and render their own markup. That gives full control of `srcset` and `sizes`, and no inline styles.
|
|
441
|
+
|
|
442
|
+
**What every image gets**
|
|
443
|
+
- **No layout shift:** width and height attributes always match the delivered file's aspect ratio. When you set `aspect`, the files themselves are cropped (`fit: cover` at `position`), not just the CSS, so the box can't change once the image loads, even when Picture switches crops by breakpoint. Tested at CLS 0.0000 with slow-loading images on desktop and mobile.
|
|
444
|
+
- **Right-sized files:** candidate widths come from the display width (never upscaled, capped at 2×) and common breakpoints. Lazy images use `sizes="auto, …"`, so supporting browsers pick by the real laid-out width: an 800px-max image in a 286px grid cell downloads the 320w file. The `(min-width: Wpx) Wpx, 100vw` hint stays as the fallback.
|
|
445
|
+
- **Loading:** images are lazy by default. Set `priority` on the single LCP image (eager, `fetchpriority="high"`).
|
|
446
|
+
- **`alt` is required.** Use `alt=""` only for decorative images.
|
|
447
|
+
|
|
448
|
+
| Component | Props / notes |
|
|
449
|
+
|---|---|
|
|
450
|
+
| **Image** | `src` (import or URL), `alt`, `width` (max display width for local images), `layout` (`constrained` · `full` · `fixed`), `aspect` (`1/1 · 4/3 · 3/2 · 16/9 · 21/9 · 3/4 · 2/3 · 4/5`), `fit`, `position`, `sizes`, `priority`, `format` (default WebP), `quality`, `radius`, `placeholder`, `caption` + `credit` (wraps it in `<figure>`). Remote images: `width`/`height` are the file's size (or use `inferSize`), plus `displayWidth` |
|
|
451
|
+
| **Picture** | Same as Image, plus `formats` (default `['avif', 'webp']`), `fallbackFormat` (PNG for PNG/GIF sources, otherwise JPEG; SVGs pass through) and `sources` for art direction: `[{ media: '(max-width: 40rem)', src, aspect, width }]`. Each `<source>` has its own width and height, so the reserved box matches the source the browser picks |
|
|
452
|
+
| **Thumbnail** | `src`, `alt`, `size` (`xs` 40 · `s` 48 · `m` 64 · `l` 96 · `xl` 128px), `shape` (`rounded · circle · square`), `aspect` (landscape shapes keep the size as their height, so a strip lines up), `kind` (`image · video · file`), `duration`, `fileType`, `more` ("+5"), `href` or `button` (+ `commandfor` to open a Dialog), `label` (required when interactive), `current`. Generated at its exact size with 1x and 2x versions |
|
|
453
|
+
| **MediaObject** | `media` slot + body. `mediaWidth` (`xs · s · m · l · xl · third · half · auto`), `mediaPosition` (`start · end`, follows RTL), `align`, `gap`, `stackBelow` (`s` 24 · `m` 32 · `l` 44rem). Stacking uses a container query on the MediaObject itself, so the same component stacks in a 300px sidebar and sits side by side in a wide column |
|
|
454
|
+
|
|
455
|
+
**Remote images** need their domain in `image.domains` or `image.remotePatterns` in `astro.config`.
|
|
456
|
+
|
|
457
|
+
## Accessibility utilities
|
|
458
|
+
|
|
459
|
+
| Component | What it does |
|
|
460
|
+
|---|---|
|
|
461
|
+
| **VisuallyHidden** | Content for screen readers only (`as`, `focusable`). The text stays in the accessibility tree, unlike `hidden`. With `focusable`, it appears while it or its contents have focus |
|
|
462
|
+
| **FocusRing** | The library's focus treatment for content you don't control, or for special cases. `within` puts the ring on the wrapper while anything inside has keyboard focus. `tone="contrast"` adds a surface-colored halo so the ring stays visible on photos and colored fills. Also `offset` (`inset · tight · loose`), `weight`, `radius` |
|
|
463
|
+
| **FocusTrap** | `<sinn-focus-trap>`, a ~1.5 KB custom element with no framework. `active`, `mode` (`tab`: Tab wraps and escaped focus is pulled back, while the page stays readable; `inert`: everything outside becomes `inert`), `initialFocus`, `returnFocus`, `escapeDeactivates`, `contents`. Methods `.activate()` and `.deactivate()`; events `sinn-focus-trap-activate`, `sinn-focus-trap-deactivate` and `sinn-focus-trap-escape` (cancelable). Traps nest, and only the top one acts |
|
|
464
|
+
| **ReducedMotion** | Wraps moving content. The `still` slot replaces it when motion is reduced (swapped in CSS, so it's right on first paint); without a `still` alternative the motion is paused instead. Videos with `data-autoplay` only start when motion is allowed. `controls` adds a Pause/Play button (WCAG 2.2.2), and a user's pause sticks |
|
|
465
|
+
|
|
466
|
+
**Use the platform first.** Dialog, Drawer, Sheet and Popover already manage focus. Use FocusTrap for custom widgets that aren't dialogs, and always give users a visible way out.
|
|
467
|
+
|
|
468
|
+
**Focus everywhere.** `@sinnstack/ui/base.css` gives every focusable element on the page the same `:focus-visible` ring, including CMS links and embeds. Components refine it, and their layer wins. The focus color is contrast-checked at 3:1 or more in both themes.
|
|
469
|
+
|
|
470
|
+
**Motion: one preference, everywhere.**
|
|
471
|
+
- **Where it comes from:** the OS setting (`prefers-reduced-motion`), overridden by `<html data-motion="reduce|full">` for a site-level switch.
|
|
472
|
+
- **Library components:** they all follow it through the `--sinn-motion-scale` token (1 or 0) and the duration tokens. Overlays appear instantly, skeletons stop pulsing, the button spinner slows down (it's the only loading cue) rather than stopping, and thumbnails stop zooming on hover.
|
|
473
|
+
- **Content you don't own:** `base.css` brings site CSS, embeds and plugins down to near-instant animations and transitions. Mark necessary motion with `data-motion-essential`.
|
|
474
|
+
- **Scripts and islands:** import from `@sinnstack/ui/primitives/motion`:
|
|
475
|
+
- `prefersReducedMotion()` reads the current state.
|
|
476
|
+
- `onReducedMotionChange(cb)` reports changes.
|
|
477
|
+
- `setMotionPreference('reduce' | 'full' | 'system')` sets the attribute and remembers the choice in a cookie.
|
|
478
|
+
- `motionFromCookie(header)` lets an SSR page print the right `data-motion` on the next request, with no flash.
|
|
479
|
+
|
|
480
|
+
Other entry points: `@sinnstack/ui/primitives/focus` (`tabbables(root)`, which matches browser Tab order, and `deepActiveElement()`), and `@sinnstack/ui/primitives/focus-trap` (`defineFocusTrap()` for islands).
|
|
481
|
+
|
|
482
|
+
## Contrast
|
|
483
|
+
|
|
484
|
+
Run `pnpm --filter @sinnstack/ui check` to test every color pairing these components use (text on surface, text on each solid and soft fill, control boundaries, the focus ring) in both light and dark themes. A failing pair makes the command exit non-zero. Run it against a client theme with `node node_modules/@sinnstack/ui/scripts/check-contrast.mjs path/to/theme.css`. Hover colors are derived with `color-mix()` and aren't checked yet.
|
|
485
|
+
|
|
486
|
+
## Definition of done
|
|
487
|
+
|
|
488
|
+
| Item | Status |
|
|
489
|
+
|---|---|
|
|
490
|
+
| Props API | ✅ typed, token-based |
|
|
491
|
+
| Loading, error and empty states | Button: `loading` · Form: error summary, `aria-busy` while submitting · fields (incl. SegmentedControl, Slider): `error` · Select: `placeholder` · Accordion/Tabs: render nothing (and warn in dev) with no items · layout and typography: n/a |
|
|
492
|
+
| Responsive | ✅ intrinsic, plus container queries |
|
|
493
|
+
| Uses tokens | ✅ |
|
|
494
|
+
| a11y | ✅ by design · ⏳ axe run in CI against `apps/playground` |
|
|
495
|
+
| CMS schema | n/a for primitives. Blocks (e.g. a card grid, a callout, an FAQ or tabs block) compose these and own their Tina fragments. Accordion and Tabs take CMS-shaped `items` |
|
|
496
|
+
| Size budget | ✅ 0 KB JS except Toggle (~300 B), Checkbox `indeterminate` (~100 B), Form `validate="inline"` (~1.5 KB gzipped), overlay fallback (~0.5 KB), Tooltip (~300 B), Table sorting (~1 KB), sparkline readout (~1 KB), FocusTrap (~1.6 KB), ReducedMotion (~0.8 KB), Slider (~2 KB), Tabs (~1.4 KB), Accordion (~1 KB). Budgets per island in `.size-limit.json` |
|
|
497
|
+
| Docs entry | ✅ this file |
|
|
498
|
+
| Visual-regression baseline | ✅ SegmentedControl, Slider, Disclosure, Accordion, Tabs: `test/controls/baseline` (light, dark, no-JS × 390/1024) · ⏳ the rest: capture from `apps/playground` (320 px, 768 px, 1280 px, 200% zoom, dark mode, RTL) |
|
|
499
|
+
|
|
500
|
+
### Tests: disclosure & selection controls
|
|
501
|
+
|
|
502
|
+
```sh
|
|
503
|
+
pnpm test # slider model + unit format (9)
|
|
504
|
+
pnpm test:browser # 108 checks in Chrome, on pages from the real model, CSS and scripts, under a strict CSP
|
|
505
|
+
pnpm test:visual # screenshot baselines
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
Setup and flags: [TESTING.md](../../TESTING.md).
|
|
509
|
+
|
|
510
|
+
The test pages copy the `.astro` markup into `build.mjs` by hand (Astro isn't available in the test environment); the model, CSS and scripts are the shipped files.
|