Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,8 @@ jobs:
# Generated registry files are current, the registry rules hold, and Astro types check.
- run: npm run check
- run: npm run validate
# Every font face in src/data/font-pack.json still matches the bytes Fontsource serves, and the font
# stylesheets and registry items are what scripts/build-fonts.mjs produces from its spec.
- run: node scripts/build-fonts.mjs --check
- run: node scripts/build-fonts.mjs --hydrate
- run: npx astro build
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ dist/
.env
.env.*
/qa/
# Pinned font binaries, hydrated by scripts/build-fonts.mjs --hydrate; Site Boulder serves its own pack.
/public/_astro/sbo-fonts/
5 changes: 3 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Astro Blocks is a shadcn-compatible **source registry** of native `.astro` websi
- **The registry is optional.** Design for the site first: its audience, material and thesis. Reach for a block only when it is the fastest route to the structure you already want.
- After adding a block, the copy belongs to the site. Change its markup, styles and behavior freely. Compose blocks, cut parts you don't need, or write an original component when that fits better. Never measure success by how many blocks a site uses.
- Blocks read the site's semantic tokens (`--color-*`, `--font-*`, `--step-*`, `--space-*`, `--radius-*`). Restyle through the site's theme before editing a block's CSS. Keep the site's own tokens, CMS hooks, content and footer credit.
- A site with no type direction can install one of three free pairings (`pairing-editorial`, `pairing-product`, `pairing-warm`; see [`docs/type-pairings.md`](docs/type-pairings.md)): one self-hosted CSS file each, setting only type tokens. Install through the registry, never by retyping the file. Installs stay on `system-ui` unless a site opts in.
- A site with no type direction can install `font-*` families (one small stylesheet each, loading pinned WOFF2 by sha256) or one of three pairings built from them (`pairing-editorial`, `pairing-product`, `pairing-warm`); see [`docs/type-pairings.md`](docs/type-pairings.md). Install through the registry, never by retyping a file, and never embed font bytes in source. Installs stay on `system-ui` unless a site opts in.
- Each catalog item states `useWhen` and `avoidWhen`. Respect `avoidWhen`; it encodes the taste judgment behind the item.

## Layout
Expand All @@ -17,7 +17,7 @@ Astro Blocks is a shadcn-compatible **source registry** of native `.astro` websi
- Composed pages are optional gallery inspiration, never registry items. Add one only when its art direction is exceptional; the blocks come first. The Lake weekend decision guide was retired from the gallery and stays at tag `v0.1.4`.
- `src/components/examples/<item>.astro`: one usage example per item. The gallery renders it live and shows it as the usage code, so docs cannot drift from the preview.
- `src/pages/`, `src/components/gallery/`, `src/styles/gallery-*.css`, `src/data/`: the gallery site, synced to a Site Boulder draft.
- Generated, never hand-edited: `public/r/*.json` (`shadcn build`), `src/data/catalog.json` (props, slots, usage and hashes derived from source, which Site Boulder's registry reads), and `src/data/gallery-catalog.json` (the same without usage, which the gallery reads; its block pages show each example's own source).
- Generated, never hand-edited: `public/fonts/*.css`, `src/data/font-pack.json` and the `font-*` entries in `registry.json` (`scripts/build-fonts.mjs`), `public/r/*.json` (`shadcn build`), `src/data/catalog.json` (props, slots, usage and hashes derived from source, which Site Boulder's registry reads), and `src/data/gallery-catalog.json` (the same without usage, which the gallery reads; its block pages show each example's own source).

## Conventions the build enforces

Expand All @@ -44,6 +44,7 @@ Design rules the build cannot check:
```sh
npm ci
npm run dev # workbench and gallery at http://localhost:4321
npm run fonts # regenerate font stylesheets, font-pack.json and font-* items (--check / --hydrate)
npm run registry # validate, shadcn build, derive catalog
npm run check # generated files current + astro check
npm run validate # shadcn registry validate
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Each item in [`registry.json`](registry.json) says when to use it and, as import
## Design

- **Tokens, not themes.** Blocks read semantic custom properties: `--color-bg`, `--color-surface`, `--color-text`, `--color-muted`, `--color-accent`, `--color-on-accent`, `--font-display`, `--font-body`, the `--step-*` type scale, `--leading-display` and `--leading-tight`, `--space-gutter`, `--section-gap`, `--radius-sm` and `--radius-lg`. Set them once, in your own theme, and every block follows. Each block also falls back to the neutral defaults in [`tokens.css`](src/styles/tokens.css) (`npx shadcn@latest add lambda-curry/astro-blocks/tokens#v0.1.16`), so nothing breaks without them. One more is optional and absent from `tokens.css`: `--color-rule` recolors every structural hairline (row and table rules, dividers, header and footer rules, and the outlines of bars, panels and tiles). Unset, each keeps its own translucent mix of the text color. Write it with `currentColor`, such as `--color-rule: color-mix(in oklab, currentColor 20%, transparent)`, so rules stay right on inverse footers. Forms read one more optional token, `--color-error`, for error text, borders and the error summary. Unset, it is a red mixed with the text color, which measured at least 4.7:1 on the background and surface of the four gallery themes (default, paper, ink and grove). Check it against a theme with a strongly colored surface, and set the token there if needed.
- **Optional type pairings.** Three self-hosted pairings of free OFL fonts, `pairing-editorial`, `pairing-product` and `pairing-warm`, set only type tokens. Installs stay on the system font until a site adds one. See [docs/type-pairings.md](docs/type-pairings.md).
- **Optional type.** Sixteen curated self-hosted typefaces, each its own `font-*` item installing a small stylesheet that loads pinned WOFF2 by sha256, plus three pairings built from them (`pairing-editorial`, `pairing-product`, `pairing-warm`) that set only type tokens. Installs stay on the system font until a site adds one. See [docs/type-pairings.md](docs/type-pairings.md) and the live specimens at `/typography`.
- **Container queries.** Blocks lay out from the width they are given, so they work full-width or inside a narrow column.
- **Zero JS for static blocks; opt-in `@ui-sdk/web` for interactive blocks.** Narrow-screen menus use the HTML `popover` attribute, the transparent header turns solid via CSS scroll-driven animation, and the wordmark footer sizes with container units—shipping 0 B JS across all 32 static blocks. Only `detail-dialog`, `filter-collection`, and `compare-tray` import exact-pinned `@ui-sdk/core@0.1.0-beta.23` and `@ui-sdk/web@0.1.0-beta.23` in `<script>` tags.
- **Accessible by default.** One `h1` per page (heroes take `headingLevel`), visible focus, 44px targets, landmarks, alt text through props, and motion that respects `prefers-reduced-motion`.
Expand Down
Loading
Loading