Block library: item headings follow the section; the leading block's first image is the LCP image

Found by ipal-doctor live-seo on the reference archive pages (entry list under a
page header without a picture): cards jumped h1 → h3, and the first card image
was lazy.

- itemHeadingLevel: items one below the section heading (h3 under h2, h2 under the
  page h1, h2 when the block shows no heading); createBlockRegistry({ itemHeadings })
  fixes a level per block. featureGrid, entryList, pricing, steps, team.
- blockPosition / blockHasImage (root): createPageRoute and the 404 view pass
  firstImage next to isFirst; leadsWithImage marks the first image of the leading
  block eager + fetchPriority high (hero, textMedia, featureGrid, gallery, team,
  entryList); priorityImage: false turns it off.
- reference/ipal-doctor.json: the two live-seo silences removed; reference skills
  and docs/agent/reference-site/INDEX.md refreshed.
- bin/ipal-blocks.mjs executable like the other bins.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-10-29 16:38:04 +01:00
co-authored by Claude Opus 5.5
parent dd11bc8146
commit 6f56ef4205
27 changed files with 206 additions and 53 deletions
+7
View File
@@ -5,6 +5,7 @@ import type { BuilderFormClassNames } from '../forms/BuilderForm.js'
import type { SendFormAction } from '../forms/RenderForm.js'
import type { ResolveLinkHrefOptions } from '../links/resolveLinkHref.js'
import type { BlockTexts } from './texts.js'
import type { LibraryBlockSlug } from './types.js'
import type { LinkComponent } from './ui/Anchor.js'
import type { CardProps } from './ui/Card.js'
import type { CMSLinkProps, ResolveLink } from './ui/CMSLink.js'
@@ -54,12 +55,16 @@ export type BlockContext = {
icons?: Record<string, ComponentType<{ 'aria-hidden'?: boolean; className?: string }>>
/** next/image — optimized images with blur-up. Without it: a plain <img>. */
Image?: ImageComponent
/** Heading level of a block's items (cards, plans, steps), per block. Default: one below the section heading (itemHeadingLevel). */
itemHeadings?: Partial<Record<LibraryBlockSlug, 'h2' | 'h3' | 'h4'>>
/** Lightbox triggers on gallery images. Default true (needs <SiteProviders lightbox>). */
lightbox: boolean
/** next/link — client-side navigation for internal links. Without it: a plain <a>. */
Link?: LinkComponent
/** Turns a testimonials-collection document into an item. Default: quote, heading/author/name, text/role, media, rating. */
mapTestimonial?: (doc: Record<string, unknown>) => null | TestimonialItem
/** The first image of the leading block loads eagerly with high priority (LCP). Default true; `false` = never. */
priorityImage?: boolean
richText?: { className?: string }
/** The project's sendForm server action (createSubmitAction) — the contact block needs it. */
sendForm?: SendFormAction
@@ -70,6 +75,8 @@ export type BlockContext = {
export type LibraryBlockProps<D> = {
classNames?: PartClasses
ctx: BlockContext
/** No block before this one shows an image (createPageRoute, blockPosition). */
firstImage?: boolean
isFirst?: boolean
locale: string
ui: BlockUi