diff --git a/docs/dev/block-library-proposal.md b/docs/dev/block-library-proposal.md index b33e6ba..105aa8f 100644 --- a/docs/dev/block-library-proposal.md +++ b/docs/dev/block-library-proposal.md @@ -149,7 +149,7 @@ so they need no `@/lib/content` import. A project can keep its own primitives an skipped levels. **Background.** `settings.background` (`default` / `muted` / `inverted` + project values) maps to -token classes in `Section`. Contrast is the tokens' job: each background has a matching foreground token. +token utilities in `Section` (§6). Contrast is the tokens' job: each background has a matching text token. ### 5.2 Block list @@ -158,7 +158,7 @@ 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, overlay token), `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 | @@ -256,24 +256,36 @@ The plugin's tests check these for each block, and the block docs list them: ## 6. Styling — design tokens -The library styles **only through the token names of the design-tokens track**. Those names are not -final yet (message sent to the design-tokens session on 2026-10-29); the table below is the contract -the blocks need, with the names this proposal assumes. The tokens session decides the names; the -blocks follow them. +The library styles **only through the token names of the design-tokens track** +(`docs/dev/design-tokens-proposal.md` on `claude/design-tokens-95806d`; names agreed with that session +on 2026-10-29, still pending the owner's approval). The canonical variables are the `--ipal-*` names the +plugin already ships; utilities come from the plugin preset `@intecion/ipal-kit/tailwind.css`. +Colours switch under `html[data-theme=dark]`, so blocks never use `dark:` for colours. -| Need | Assumed token (CSS variable) | Tailwind utility | -|---|---|---| -| Page background / text | `--color-background` / `--color-foreground` | `bg-background`, `text-foreground` | -| Muted section and text | `--color-muted` / `--color-muted-foreground` | `bg-muted`, `text-muted-foreground` | -| Inverted section | `--color-inverted` / `--color-inverted-foreground` | `bg-inverted`, `text-inverted-foreground` | -| Brand / text on brand | `--color-primary` / `--color-primary-foreground` | `bg-primary`, `text-primary-foreground` | -| Card surface | `--color-card` / `--color-card-foreground`, `--color-border`, `--radius-card`, `--shadow-card` | `bg-card`, `border-border`, `rounded-card`, `shadow-card` | -| Focus ring | `--color-ring` | `ring-ring` | -| Hero overlay | `--color-overlay` | `bg-overlay` | -| Type scale | `--ipal-fs-display(-fit)`, `--ipal-fs-h1…h3`, `--ipal-fs-lg/base/sm` (fluid.css) | `text-display`, `text-h1`… | -| Spacing | `--ipal-space-section(-fit)`, `--ipal-space-gap`, `--ipal-space-gutter` (fluid.css) | `py-section`, `gap-gap`, `px-gutter` | -| Widths | `--ipal-container(-wide)`, `--ipal-measure` | `max-w-container`, `max-w-measure` | -| Plugin components | `--ipal-primary`, `--ipal-surface`, `--ipal-text`, `--ipal-border`, `--ipal-radius` (existing) | mapped to the above in the starter | +| Block need | Utilities (variable) | +|---|---| +| Section backgrounds (`settings.background`) | `default` → `bg-bg`; `muted` → `bg-surface-muted`; `inverted` → `bg-inverse text-on-inverse` (`--ipal-bg`, `--ipal-surface-muted`, `--ipal-surface-inverse`, `--ipal-text-inverse`) | +| Body, heading, muted text | `text-fg`, `text-fg-strong`, `text-fg-muted` (eyebrow, captions, item roles) | +| Card (feature, team, pricing, testimonial) | `bg-surface text-fg border border-border rounded-card shadow-sm`; clickable card: `hover:shadow-md transition-shadow duration-fast ease-out` | +| Highlighted pricing plan, rating stars, badges | `bg-accent text-on-accent` / `text-accent` (always with a text label, §5.4) | +| Buttons (in the `Button` primitive only) | `bg-primary hover:bg-primary-hover text-on-primary`, `bg-secondary …`, ghost `hover:bg-hover`; `rounded-control` | +| Links in rich text and cards | `text-link hover:text-link-hover` | +| Focus | `focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus` | +| Hero image overlay | `bg-overlay` (scrim), gradient `bg-linear-to-t from-overlay to-transparent` | +| Images | `rounded-media` | +| Type | `font-heading text-display / text-h1 / text-h2 / text-h3 / text-h4`, `text-lead` (intro), `leading-heading tracking-heading`; hero fit: `text-[length:var(--ipal-fs-display-fit)]`, `min-h-[var(--ipal-hero-min-h)]` | +| Spacing | `py-section` (`py-section-sm` for CTA band, logos), `gap-gap` for section grids, Tailwind steps inside cards, `mt-stack` heading → content, `px-gutter` | +| Widths | `max-w-container` (default), `max-w-container-wide` (gallery wide), `max-w-narrow` (`richText narrow`, legal), `max-w-measure` (running text) | +| Motion | `duration-fast/base/slow`, `ease-out` (0 ms under reduced motion) | +| Layering | `z-overlay` (lightbox is already the plugin's) | + +**Inverted sections.** Links, borders and the focus ring inside `bg-inverse` must stay readable. +Requested from the tokens track: `Section` sets `data-surface="inverse"` and the preset re-maps +`--ipal-text`, `--ipal-text-strong`, `--ipal-text-muted`, `--ipal-link`, `--ipal-border` and `--ipal-focus` +inside it, so cards, links and rich text need no inverse variants. Open until that session confirms. + +If the owner picks shadcn-style utility names instead (`text-foreground`, `bg-muted`), the blocks change +by a mechanical class rename; the roles stay. **How blocks carry styles (decision D2).** Recommended: **Tailwind v4 utilities that use only token names**, compiled by the project through `@source "…/node_modules/@intecion/ipal-kit/dist/**/*.js"` @@ -456,7 +468,7 @@ Ships as **1.15.0** (new feature, no breaking change). | # | Decision | Recommendation | |---|---|---| | D1 | Ship the library inside `@intecion/ipal-kit` (new entries) or as a separate package `@intecion/ipal-blocks` | **inside**, new entries `/blocks`, `/blocks/rsc`, `/templates` — one version, one guide | -| D2 | Styling: Tailwind token utilities + `classNames`/`data-ipal-*`, or a plain CSS file on variables | **Tailwind token utilities** (all sites are on Tailwind v4) | +| D2 | Styling: Tailwind token utilities from the plugin preset + `classNames`/`data-ipal-*`, or a plain CSS file on variables | **Tailwind token utilities** (all sites are on Tailwind v4; agreed with the design-tokens session) | | D3 | Offer an `ipal-blocks eject ` command that copies a block into the project | **yes**, phase 2 | | D4 | Localization default: fields inside blocks (one structure) or the whole `layout` per language | **fields inside blocks**, `localization: 'layout'` as an option | | D5 | Default slugs: plain (`faq`, `hero`) or prefixed (`ipalFaq`) | **plain**, with a `slug` option for clashes — data stays readable and matches what sites use |