Skip to content

feat: api-reference primitives : TypeTable + ComponentPreview - #12

Merged
Shewart merged 3 commits into
mainfrom
feat/api-reference-primitives
Jul 21, 2026
Merged

feat: api-reference primitives : TypeTable + ComponentPreview#12
Shewart merged 3 commits into
mainfrom
feat/api-reference-primitives

Conversation

@Shewart

@Shewart Shewart commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Ships the two API-reference primitives from the Phase 2 roadmap so consumers can hand-author prop tables and single-component demos without dropping into full razor:preview fences.

New components

<TypeTable> / <TypeRow> — the props/API reference table.

  • Parent renders a four-column layout (Prop / Type / Default / Description) with type-code chips and a required badge.
  • Children register into the parent via CascadingValue — same pattern as <CodeGroup> / <CodeTab>. Nothing rendered from <TypeRow> directly; it just hands its data up.
  • Duplicates by Name are deduped silently.
  • v1 is hand-authored; roadmap's v2 wires this up to XML-doc auto-generation via ShellDocs.Xml<TypeTable Source="ShellUI.Button" />.

<ComponentPreview Component="..." ...props> — the declarative-prop cousin of razor:preview.

  • Takes the target's registered tag name as a string Component prop; resolves it through the same TypeRegistry that backs razor:preview.
  • Uses [Parameter(CaptureUnmatchedValues = true)] to receive arbitrary target-component props as attributes on the tag itself — no dictionary syntax, no fenced-block wrapper.
  • Reflects on the target's [Parameter] types and coerces each string value via the shared SlotRenderer.Coerce (booleans, ints, enums, etc.).
  • Renders live via DynamicComponent, plus a fumadocs-style stacked source-view (collapsed teaser + centered View source button, expands to show the reconstructed razor snippet with Copy and Hide). Source string is rebuilt from the resolved prop dict — attributes sorted alphabetically for stability, self-closing form when there's no body.
  • Unknown Component renders an inline Unknown component: <code>Foo</code> error instead of throwing.

Infrastructure

  • SlotRenderer.GetParameterProps and Coerce are now internal (were private) so ComponentPreview can drive the same per-type conversion its parent slot-renderer uses.
  • ChildContentSource threading: when the target component declares a [Parameter] public string? ChildContentSource, SlotRenderer.BuildParameters now passes the raw child markup through unchanged alongside the usual ChildContent RenderFragment. That's what lets <ComponentPreview> reconstruct its source-view without asking the author to repeat themselves.

Fixes bundled in

  • <Steps> rail centering. The border-left rail was drawn on the naked <ol>, and the number badge was pushed ~12px right of it — reading as "circle next to line" instead of "spine with beads on it". Whole list is now shifted right by 1rem so the border sits at global x = 1rem, and each badge is centered on that line via left: calc(-1rem - 0.5px). Badge fill changed from --muted--card so it clearly breaks the rail (muted was the same tonal family as --border and blended into it). Badge bumped 1.85rem → 2rem, number 0.75rem → 0.8125rem.

Docs

  • examples/ShellDocs.Preview/content/docs/components/type-table.md — Basic + Props sections
  • examples/ShellDocs.Preview/content/docs/components/component-preview.md — Basic + self-closing examples, Props section
  • meta.json sidebar updated: [..., "type-table", "component-preview"]

Shewart added 3 commits July 22, 2026 00:16
…mentation examples and structured prop references
…or improved documentation display and prop management
…umentation capabilities and improve prop management
@Shewart
Shewart merged commit f18aa7a into main Jul 21, 2026
1 check passed
@Shewart
Shewart deleted the feat/api-reference-primitives branch July 21, 2026 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant