Skip to content

feat: versioned docs, multi-sibling previews, DemoPreview, ShellIcons - #27

Merged
Shewart merged 10 commits into
mainfrom
feat/versioned-docs
Oct 2, 2026
Merged

Shewart merged 10 commits into
mainfrom
feat/versioned-docs

Conversation

@Shewart

@Shewart Shewart commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Versioned docs for multi-version sites (the ShellUI docs: content/docs/v0.3, content/docs/v0.2.1), razor:preview fixes so real component-library previews render, a <DemoPreview> primitive for stateful demos, and icons via ShellIcons. Every chrome interaction follows the 0.1.7 static-host pattern: server-rendered initial state, data attributes, and delegated handlers in shelldocs.js. No @onclick state.

Versions

  • ShellDocsOptions.AddVersion(id, label, rootUrl, description, latest) → Versions / DocsVersion record.
  • DocsVersionResolver: the current version is the one whose RootUrl is a segment-aware prefix of the path, otherwise the latest, otherwise the first.
  • <VersionSelector /> sits under the package selector in the sidebar (mobile drawer included) and in the header for the TopNav layout. It's hidden with fewer than 2 versions. Switching keeps the same page → else the same package → else the version's first page.
  • {version} token in AddPackage root URLs. Switching packages keeps the version.
  • Inside a version: the sidebar shows only that version, prev/next never crosses versions, search covers the current version plus unversioned pages, and the breadcrumb omits the version folder.

Previews

  • razor:preview renders all top-level siblings (components, HTML wrappers, text) in one frame. The unknown-component error panel is kept.
  • Razor-form values: ButtonVariant.Destructive, @ButtonVariant.Destructive, @true, @42, [Flags] values as A | B.
  • Attributes that can't be set from markup (OnClick="Handler", @bind-*, @ref, @onclick, unsupported types, bad values) are skipped with a warning; the page no longer crashes.
  • <DemoPreview Component="X" Title="…" /> + DemoSourceRoot: renders a registered demo component, with its .razor file shown as source.
  • Fix: the copy button showed both the copy and check icons.

Icons

  • Inline SVG icons replaced with ShellIcons.Blazor 0.1.0-alpha. Brand marks and consumer-supplied raw icons are unchanged; scoped icon CSS now uses ::deep.

Housekeeping

  • Comments trimmed to the non-obvious "why" across the repo.
  • Example app exercises two version folders, multi-sibling previews, enum forms and a DemoPreview.
  • Version 0.1.8-alpha, CHANGELOG, README, ARCHITECTURE.

Consumer notes

  • Ship DemoPreview sources with a None item. The Razor SDK drops .razor files from publish even with Content Update:
    <None Include="Demos/**/*.razor" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" />
  • /docs/{*Path:nonfile} won't match a bare /docs/v0.2.1; pages under it are fine. The selectors only link to a version root when it has an index.md.

Testing

  • dotnet build shelldocs.slnx: 0 warnings. dotnet test: 242 passed; every commit builds and passes on its own.
  • Manually in the example app:
    • The version switch keeps the page, and the sidebar is scoped.
    • The package switch keeps the version.
    • Search and prev/next stay inside a version.
    • Selectors work after a hard refresh and with no Blazor runtime.
    • Icons render at the intended sizes.

Shewart added 10 commits October 2, 2026 09:02
- Drop section banners, step-by-step narration, and comments that restate the code.
- Keep and tighten the "why" notes: static-host constraints, Markdig/MSBuild gotchas, security caveats, ordering rules.
- Remove stale references (Prism, removed methods, old branch names).
- UrlPath.Normalize / IsUnder / RelativeTo / Combine — "/docs/v0.30" is not under "/docs/v0.3"; dotted segments stay intact.
- NavigationGraph.GetPrevNext(node, inScope) skips out-of-scope neighbours.
- NavigationGraph.FindFolder(url) finds the section built from a content folder (hidden folders included).
- NavigationGraph.FirstPageUnder(prefix).
…version-scoped chrome

- ShellDocsOptions.AddVersion(id, label, rootUrl, description, latest) + DocsVersion record.
- DocsVersionResolver: current version (containing → latest → first), scoped sidebar nodes, version/package hrefs, search filter, prev/next scope.
- <VersionSelector />: under PackageSelector in DocsSidebar (mobile drawer included) and in DocsHeader for TopNav. Plain hrefs: same page → same package → first page of the target version.
- "{version}" token in AddPackage root URLs; package matching is segment-aware on resolved URLs.
- Sidebar, prev/next, search and breadcrumb stay inside the current version.
- shelldocs.js: shared dropdown delegation for .pkg/.ver, Escape and option-click close.
- Search recalculates via @Bind:after (no longer one keystroke behind); aria-selected renders true/false.
…kip uncoercible attributes

- razor:preview fences parse into ordered nodes (PreviewSlot.Nodes): sibling components, HTML wrappers and text all render inside the one frame, as real render-tree elements. The unknown-component error panel stays when nothing resolves.
- RazorTagScanner: quote- and @( … )-aware tag reader; full attribute names kept, so @bind-Value is no longer misread as Value.
- SlotRenderer.Coerce accepts @-prefixed values, Type.Member enums, [Flags] "A | B", numeric suffixes and @null.
- BuildParameters never throws: directive attributes, EventCallback/delegate params, unsupported types, bad values and unknown attributes without a catch-all are skipped with a logged warning. Same for ComponentPreview.
- Parameter names match case-insensitively, like Blazor.
…r .razor source

- <DemoPreview Component="X" Title="…" /> renders registered component X inside the preview frame; the source tab shows {DemoSourceRoot}/**/X.razor (shallowest match, cached, re-read when the file changes).
- ShellDocsOptions.DemoSourceRoot.
- PreviewFrame gains a content mode (Content / Code / Language / Title / Error / ErrorTitle) and an optional title bar.
- A missing component, root or file renders the red error panel, without echoing server paths.
…view

- Two version folders (content/docs/v2.0, content/docs/v1.9.1) with AddVersion; Core/CLI packages use "/docs/{version}/…".
- Demo Ui/Button with enum params for razor:preview, and Demos/ButtonClickDemo.razor for <DemoPreview>.
- Demo .razor files ship via a None item (the Razor SDK drops them from publish otherwise).
- Add ShellIcons.Blazor 0.1.0-alpha (Lucide-derived typed icon components) to ShellDocs.Components.
- Replace inline <svg> icons across chrome, content primitives, layouts and the example pages with typed icons (ChevronDown, Search, Copy, Check, PanelLeft, Sun/Moon, TriangleAlert, …).
- SidebarIcons maps titles to icon component types instead of raw path strings.
- Icon <svg>s now come from a child component, so scoped CSS targets them through ::deep.
- Brand marks (GitHub, X) and consumer-supplied raw icons (DocsPackage.IconPath, NavMenuItem.IconSvg, Card.IconSvg) stay inline; only their defaults use ShellIcons.
- Files where Lucide names collide (Heading, Type, TableOfContents) use fully qualified icon tags.
@Shewart
Shewart merged commit fdadc16 into main Oct 2, 2026
1 check passed
@Shewart
Shewart deleted the feat/versioned-docs branch October 2, 2026 17: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