docs: MVP-5 extend CEM + scaffold composable block library#6211
docs: MVP-5 extend CEM + scaffold composable block library#6211caseyisonit wants to merge 1 commit into
Conversation
Adds the documentation-pipeline groundwork the badge pilot (MVP-7) and the
broader entity-readme rollout depend on. Two changes, one PR:
1. CEM extension — `cem.config.js` swaps `statusPlugin` for
`swcJsdocTagsPlugin`, which parses additional JSDoc tags into the manifest
so blocks can render directly from CEM rather than per-component metadata
files:
- `@summary` — one-line subtitle (consumed by the new `<Subtitle />` block)
- `@genre` / `@category` — taxonomy fields used by future doc routing
- `@related` — comma-split list of sibling entity tag names
- `@RSPparity` — react spectrum 2 parity status (full | partial | none | note)
- `@a11yPattern` — short pattern reference (e.g. `aria-describedby-owner`)
- structured `@deprecated` — JSON `{ reason, since, replacedBy }`,
key-value, or free-form prose; emitted as a structured object on the
declaration
Existing `@status` / `@since` behaviour is preserved (badge still emits
`status: "preview"`, `since: "0.0.1"`).
2. Block library scaffold — six new react blocks under
`.storybook/blocks/`, each reading from CEM via a shared
`cem-helpers.ts` module:
- `EventsTable` — renders `events[]` (from `@fires`)
- `CssPartsTable` — renders `cssParts[]` (from `@csspart`)
- `CssPropsTable` — renders `cssProperties[]` (from `@cssprop`); the
`--swc-*` contract is documented in the block's JSDoc
- `EmbedStory` — thin wrapper around `<Canvas of={…} />` + optional
`<Source of={…} />`, for embedding executable examples in narrative MDX
- `RelatedEntities` — renders cross-links from `@related`
- `Subtitle` — reads `@summary` from CEM, falls back to Storybook's
built-in subtitle block for transitional compatibility
`DocumentTemplate.mdx` is updated to import the new local `Subtitle`
block; the existing scaffolding is otherwise unchanged.
Smoke-tested:
- `npx tsc --noEmit` — new files compile clean (only pre-existing unrelated
vitest type error remains)
- `yarn analyze` — CEM regenerates without error; badge tag output preserved
- `yarn generate:contributor-docs` — docs pipeline healthy
Stacks on `caseyisonit/docs-mvp-3-persona-sidebar`. Unblocks MVP-7 (badge
pilot), which exercises every new block end-to-end.
|
📚 Branch Preview Links🔍 First Generation Visual Regression Test ResultsWhen a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:
Deployed to Azure Blob Storage: If the changes are expected, update the |
Description
Extends the CEM pipeline with custom JSDoc tags and scaffolds a composable block library so component docs can render directly from CEM rather than per-component metadata files. This is the documentation-pipeline groundwork that MVP-7 (Badge pilot) and the broader entity-readme rollout (Phase 2) depend on.
Two changes, one PR:
CEM extension —
cem.config.jsswapsstatusPluginforswcJsdocTagsPlugin, which parses additional JSDoc tags into the manifest:@summary— one-line subtitle (consumed by the new<Subtitle />block)@genre/@category— taxonomy fields used by future doc routing@related— comma-split list of sibling entity tag names@RSPparity— React Spectrum 2 parity status (full | partial | none | <note>)@a11yPattern— short pattern reference (e.g.aria-describedby-owner)@deprecated— JSON{ reason, since, replacedBy }, key-value, or free-form prose; emitted as a structured object on the declarationExisting
@status/@sincebehaviour is preserved (Badge still emitsstatus: "preview",since: "0.0.1").Block library scaffold — six new React blocks under
.storybook/blocks/, each reading from CEM via a sharedcem-helpers.tsmodule:EventsTable— rendersevents[](from@fires)CssPartsTable— renderscssParts[](from@csspart)CssPropsTable— renderscssProperties[](from@cssprop); the--swc-*contract is documented in the block's JSDocEmbedStory— thin wrapper around<Canvas of={…} />+ optional<Source of={…} />, for embedding executable examples in narrative MDXRelatedEntities— renders cross-links from@relatedSubtitle— reads@summaryfrom CEM, falls back to Storybook's built-in subtitle block for transitional compatibilityDocumentTemplate.mdxis updated to import the new localSubtitleblock; the existing scaffolding is otherwise unchanged.Motivation and context
Per the docs-overhaul v2 plan (CONTRIBUTOR-DOCS RFC), the per-entity authoring shape is class JSDoc +
README.mdx+ optional executable-only stories. For the MDX layer to render API surface (events, parts, props) without hand-maintained tables, every block needs to read from CEM — and CEM needs to carry the full surface.This PR builds the CEM-side parsing and the block-side rendering. It changes no public API surface and adds no new authoring requirements; existing components keep working unchanged.
Related issue(s)
Stacks on #6205 (MVP-3 persona sidebar). Unblocks MVP-7 (Badge pilot), which exercises every new block end-to-end.
Author's checklist
Manual review test cases
CEM regenerates with new tags.
2nd-gen/packages/swc, runyarn analyze2nd-gen/packages/swc/.storybook/custom-elements.jsonstatus: "preview"andsince: "0.0.1"(backward-compat preserved)Storybook still renders.
2nd-gen/packages/swc, runyarn storybookparameters.docs.subtitleuntil MVP-7 sets@summary)Type-check passes.
npx tsc --noEmit -p 2nd-gen/packages/swc/tsconfig.json@vitest/browser/providers/playwrighterror is unrelated)Device review
Accessibility testing checklist
Required: Complete each applicable item and document your testing steps.
Keyboard (required — document steps below)
No new interactive surface — all six new blocks render static HTML (tables, links). The only links are in
<RelatedEntities />, which uses native<a href>elements with no custom focus handling. Confirm no regressions in surrounding examples.Screen reader (required — document steps below)
Tables and links use semantic HTML (
<table>,<thead>,<tbody>,<a>); no custom ARIA. The<Subtitle />block emits a<p class="sbdocs-subtitle">matching Storybook's built-in subtitle markup.