Block library: docs, agent guide, skills; picker order as an explicit list

- docs/block-library.md: setup, every block (fields, variants, accessibility),
  options, registry, primitives, eject, page templates, seeding after launch,
  versioning, manifest, turn off / override / extend
- AGENT.md (compass, how to add, §6, §6.3, module map), ipal-block (library
  block first), ipal-site (phases 2, 4, 6, 8), ipal-reference (wiring rows,
  export index), seed-content template from pageTemplates, seeding.md ($form)
- CHANGELOG Unreleased; proposal marked built with an as-built section

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-10-29 14:12:50 +01:00
co-authored by Claude Opus 5.5
parent 2d1cc0e77d
commit 2a07fb8844
14 changed files with 470 additions and 39 deletions
+25 -7
View File
@@ -1,6 +1,7 @@
# Block library — proposal
> **Status:** approved design, not built. The owner accepted every recommendation, D1–D10, on 2026-10-29 (§12).
> **Status:** approved (D1–D10, 2026-10-29) and built on `claude/block-library-build`. The shipped reference is
> [block-library.md](../block-library.md); where the build differs from this proposal, §13 says how and why.
> Building starts when the coordinator confirms that all five designs (tokens, blocks, reference site,
> doctor, starter) are in and consistent.
> **Scope:** a shared set of page blocks and page templates in `@intecion/ipal-kit`, so agents
@@ -118,7 +119,6 @@ New entries (names to confirm, decision D1):
|---|---|---|
| `@intecion/ipal-kit/blocks` | block configs and field builders (no React) | `payload.config`, collections |
| `@intecion/ipal-kit/blocks/rsc` | block components, UI primitives, `createBlockRegistry` | the page route, `blocks/registry.ts` |
| `@intecion/ipal-kit/blocks/client` | small client parts (accordion state, if any) | used internally; exported for custom components |
| `@intecion/ipal-kit/templates` | page template data for seeds | seed scripts only |
**Manifest.** `@intecion/ipal-kit/blocks` also exports `blockLibraryManifest`, plain data with no React:
@@ -166,21 +166,21 @@ Phase 2 = less common blocks.
| Slug | Panel name (en / pl) | Fields (in panel order) | Variants | Notes |
|---|---|---|---|---|
| `hero` | Hero / Sekcja główna | `header`, `media`, `links`, `settings` | `split` (image beside), `background` (image behind, `bg-overlay` scrim), `centered`, `page` (small page hero, no media) | the LCP image: `priority` when `isFirst`; video via `Media videoMode="background"` with a poster |
| `hero` | Hero / `Sekcja główna` | `header`, `media`, `links`, `settings` | `split` (image beside), `background` (image behind, `bg-overlay` scrim), `centered`, `page` (small page hero, no media) | the LCP image: `priority` when `isFirst`; video via `Media videoMode="background"` with a poster |
| `textMedia` | Text and image / Tekst i obraz | `header`, `content` (rich text), `media`, `links`, `settings` | `mediaRight`, `mediaLeft` | rich text via `RenderRichText`; image `sizes` = half |
| `featureGrid` | Feature grid / Siatka zalet | `header`, `items[]` (`icon` or `media`, `heading`, `text`, `link`), `links`, `settings` | `cards`, `list`, `numbered`; columns 2 / 3 / 4 | covers USP lists, service cards, category cards; whole card clickable when `link` has no label |
| `gallery` | Gallery / Galeria | `header`, `items[]` (`media`, `caption`), `links`, `settings` | `grid`, `masonry`; columns | every image a `LightboxTrigger` (group = block id); labels from Form messages → Image viewer; no own prev/next fields |
| `faq` | FAQ / Pytania i odpowiedzi | `header`, `items[]` (`question`, `answer`), `links`, `settings` | `single`, `twoColumn` | `<details>`/`<summary>`; FAQPage JSON-LD through `getPageJsonLd({ faq })` with the exported `faqItemsFromLayout()` |
| `cta` | Call to action / Wezwanie do działania | `header`, `links`, `media` (optional), `settings` | `band`, `card`, `split` | wrap in `<NoSnippet>` when the project repeats it on every page (option) |
| `cta` | Call to action / `Wezwanie do działania` | `header`, `links`, `media` (optional), `settings` | `band`, `card`, `split` | wrap in `<NoSnippet>` when the project repeats it on every page (option) |
| `contact` | Contact / Kontakt | `header`, `form` (relation to `forms`), `details` (from the company global, toggle), `content`, `settings` | `formOnly`, `formWithDetails` | form through `RenderForm` (`sendForm`, `formTexts` from `blockProps`); `classNames` from the shared form tokens; contact details from a project-supplied resolver, never typed into the block |
| `team` | Team / Zespół | `header`, `items[]` (`media`, `heading` = name, `text` = role, `link` = profile), `settings` | `grid`, `list` | profile link label = screen-reader text |
| `team` | Team / `Zespół` | `header`, `items[]` (`media`, `heading` = name, `text` = role, `link` = profile), `settings` | `grid`, `list` | profile link label = screen-reader text |
| `pricing` | Pricing / Cennik | `header`, `items[]` (`heading`, `price`, `period`, `text`, `features[]`, `highlighted`, `link`), `note`, `settings` | — | highlighted plan: label text from the block (`highlightLabel`), not colour only |
| `logos` | Logos / Logotypy | `header`, `items[]` (`media`, `heading` = name, `link`), `settings` | `row`, `grid` | alt = name when the media alt is empty; no marquee by default (reduced motion) |
| `testimonials` | Testimonials / Opinie | `header`, `source` (`inline` / `collection`), `items[]` (`quote`, `heading` = author, `text` = role, `media`, `rating`) or `entries` (relation), `settings` | `grid`, `single` | `<figure>` + `<blockquote>` + `<figcaption>`; rating has a text equivalent; `collection` mode only when the project passes the collection slug |
| `stats` | Key figures / Liczby | `header`, `items[]` (`value`, `heading` = label, `text`), `settings` | `row`, `cards` | static numbers; count-up animation off by default and never under reduced motion. Panel name avoids "statistics" (glossary: visit counting) |
| `richText` | Text / Tekst | `header`, `content`, `tableOfContents` (`buildTableOfContentsField`), `settings` | `narrow` (measure), `wide` | used by legal pages and posts; heading anchors from `richtext/headings` |
| `steps` | Steps / Kroki | `header`, `items[]` (`heading`, `text`, `media`), `links`, `settings` | `numbered`, `timeline` | ordered list `<ol>` |
| `entryList` | Entry list / Lista wpisów | `header`, `collection` (select from the project's `content.collections`), `mode` (`latest` / `selected`), `entries`, `limit`, `links`, `settings` | `cards`, `list` | blog teasers, projects, products; data loaded on the server through `createContentHelpers` |
| `entryList` | Entry list / `Lista wpisów` | `header`, `collection` (select from the project's `content.collections`), `mode` (`latest` / `selected`), `entries`, `limit`, `links`, `settings` | `cards`, `list` | blog teasers, projects, products; data loaded on the server through `createContentHelpers` |
| *phase 2* `video`, `tabs`, `map`, `cookieTable`, `comparisonTable` | | | | `video` = `YouTubeEmbed`/`Media player`; `map` behind consent; `cookieTable` wraps `CookieTable` |
Field names follow AGENT.md §6.5 (`header`, `items`, `heading`, `text`, `content`, `media`, `link(s)`,
@@ -302,7 +302,7 @@ names**, compiled by the project through `@source "…/node_modules/@intecion/ip
(the line projects already have). All seven sites use Tailwind v4. Each element also gets a
`data-ipal-block` / `data-ipal-part` attribute, and each block takes a `classNames` map (like
`RenderForm`) that replaces the default classes per part. Alternative: a plain CSS file
(`@intecion/ipal-kit/blocks.css`) on CSS variables — works without Tailwind, but is harder to
(a `blocks.css` file in the package) on CSS variables — works without Tailwind, but is harder to
change per project.
## 7. How a project uses, changes and extends it
@@ -489,3 +489,21 @@ The owner accepted every recommendation below on 2026-10-29 ("Accept all three",
| D8 | Move existing sites onto the library, or new sites only | **new sites + the reference site now**; old sites move block by block when they get work, with ipal-migrate-fields recipes, never as a big-bang |
| D9 | Testimonials: inline items only, or also a relation to a `testimonials` collection | **both**, collection mode only when the project names the collection |
| D10 | Panel name for the stats block ("Statistics" is the glossary word for visit counting) | **"Key figures" / "Liczby"** |
## 13. As built — differences from this proposal
- **No `/blocks/client` entry.** No block needed its own client code: FAQ is `<details>`, the gallery uses the
lightbox's `LightboxTrigger`, the table of contents is the rich-text module's.
- **`next/image` and `next/link` are passed in** (`createBlockRegistry(content, { Image, Link })`), because the plugin
never imports `next/*`. Without them the blocks render a plain `<img>` (width, height, lazy, focal point) and `<a>`.
- **No pinned `dbName`.** A fixed table name would clash when one block is used in two collections. Database names
come only from slugs and field names (never labels), and the schema snapshot test guards them.
- **Contact needs no `blockProps`:** the block reads the form texts and link options from lib/content itself; only
`sendForm` is passed to the registry.
- **`ui` primitives:** `Button` is the `buttonClass` function (a look, not an element); `Anchor` and `TitleLink` were
added so internal links can use next/link and a card title stays text when its link is dead.
- **Admin wording:** the new admin-ux test over the library found two 4-word labels in existing builders —
the link checkbox is now "New tab" (with a description) and the table-of-contents switch "Show contents".
- **Seeder:** `{ $form: 'title' }` references are deferred to the second pass like `$page`, so a page with a form
never reaches the database with an unresolved reference.