fix: consumer-configurable sidebar package selector - #14
Merged
Conversation
…ation links to enhance navigation and usability
…r dynamic package management and improve icon handling
…ptions for enhanced package management
…on and default state in ShellDocsOptions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the first entry in
docs/SHELLUI_DOGFOOD_FIXES.md— the hardcoded ShellDocs-only package list in the sidebar's package selector.The bug
PackageSelector.razorshipped astatic readonly List<Package>hardcoded to ShellDocs' own five packages (ShellDocs,ShellDocs.Markdown,ShellDocs.Core,ShellDocs.CLI,ShellDocs.Components). Every consumer's sidebar surfaced that list — a ShellUI docs site rendered ShellDocs' package names, a MudBlazor site would have too. There was no consumer-config path, and the selector always rendered even for consumers with a single package family (dropdown of one).Discovered during the first render of shellui-docs while scaffolding it via ShellDocs.
The fix
New public API on
ShellDocsOptionsConsumers declare their family in
Program.cs:PackageSelector.razorbehavior changesShellDocsOptions; readsOptions.Packagesat render time; hardcoded ShellDocs list deleted.Options.Packages.Count <= 1. A consumer with zero or one packages sees no selector — no dropdown-of-one noise.RootUrl. Previously used a fuzzy substring match that wrongly pickedShellDocsfor/docs/components/calloutwhen it should have pickedShellDocs.Components.AddPackage(...)call omits aniconPath— same 24×24 stroke contract as consumer-supplied paths.Preview app migration
examples/ShellDocs.Preview/Program.csnow callsAddPackage(...)for its five packages. Proves the consumer flow end-to-end and keeps the preview app's selector rendering identically to before.Test plan
dotnet build shelldocs.slnx— clean, 0 warnings, 0 errorsdotnet test shelldocs.slnx— 121 / 121 passing (+2 new inPackageRegistrationTests)/docs/introduction→ selector shows ShellDocs (correct)/docs/markdown→ ShellDocs.Markdown (correct)/docs/components/callout→ ShellDocs.Components (previously would have wrongly selectedShellDocsunder the old substring match)new ShellDocsOptions().Packagesis empty by default;PackageSelectorearly-return path renders no markupFiles touched
src/ShellDocs.Components/ShellDocsOptions.cs— newDocsPackagepublic record,Packageslist,AddPackagefluentsrc/ShellDocs.Components/Chrome/PackageSelector.razor— rewritten; drops hardcoded list, injects options, early-returns, longest-prefix matchexamples/ShellDocs.Preview/Program.cs— migrated toAddPackage(...)docs/SHELLUI_DOGFOOD_FIXES.md— entry moved from Open to Fixedtests/ShellDocs.Tests/PackageRegistrationTests.cs(new, 2 tests)