fix(sidebar): make sidebar interop work inside Razor Class Libraries + CLI install hardening - #30
Merged
Merged
Conversation
added 12 commits
September 24, 2026 14:25
…ng redundant try-catch block Streamlined the clipboard copy functionality in the CopyButtonTemplate by eliminating the nested try-catch structure. The code now directly invokes the `copyToClipboard` method, improving readability and maintainability.
…d ShellUI JS integration - Introduced a constant for the ShellUI JS sidebar API marker to facilitate checks during component installation. - Updated `InstallComponentForInitAsync` to return a boolean indicating success or failure, improving error handling. - Added `EnsureShellUiJs` method to ensure the ShellUI JS component is installed correctly, including updates to the configuration file when necessary. - Enhanced existing installation logic to handle cases where components already exist, providing feedback on updates and installations. - Improved overall readability and maintainability of the component installation process.
… imports - Introduced `RelativeJsModuleImportTests` to ensure templates do not dynamically import relative JS modules, which can lead to 404 errors when compiled into Razor Class Libraries. - Added `SidebarInteropTests` to verify that the sidebar provider uses global lifecycle interop and that the sidebar JS is retained only as a hidden legacy alias. - Updated `TemplateCompileTests` to include the `sidebar-provider` component, ensuring comprehensive coverage of Razor template parsing.
…ent removal logic - Changed CLI command references from 'dotnet shellui' to 'shellui' for consistency. - Added a warning when attempting to remove 'sidebar-js' if it is still referenced by the SidebarProvider. - Improved error handling for uninitialized ShellUI state during component operations.
…mmand references and enhance initialization logic - Changed CLI command references from 'dotnet shellui' to 'shellui' for consistency across the application. - Improved error messages for uninitialized ShellUI state to provide clearer guidance. - Enhanced the initialization process by ensuring configuration is prepared and saved correctly, improving overall user experience during setup.
…cumentation clarity - Modified the 'update' command description to better reflect its functionality, emphasizing the rewriting of installed components from current CLI templates. - Revised the README to clarify the purpose of the ShellUI CLI, including versioning details and installation instructions, ensuring users have a clear understanding of the tool's capabilities and usage.
…nstructions - Revised the README to provide a clearer overview of the `ShellUI.Components` library, emphasizing its .NET 10 compatibility and Tailwind CSS integration. - Streamlined installation instructions for published packages, clarifying versioning details and current-source workflows. - Enhanced the documentation to reflect the latest features and installation paths, ensuring users have accurate guidance for utilizing the library.
…ities - Updated ShellUI JavaScript utilities to improve global interactivity and sidebar integration. - Refined the sidebar interop logic, including mobile detection and keyboard shortcuts, to enhance user experience. - Adjusted dependencies in SidebarProviderTemplate to reflect the new ShellUI JS integration. - Deprecated the legacy sidebar-js module, clarifying its purpose in the updated context.
…tructions - Revised the README to enhance clarity on the ShellUI component library, emphasizing the CLI-first approach and options for referencing components. - Updated installation instructions to reflect the latest versioning and packaging details, ensuring users have accurate guidance for setup. - Improved the status section to provide a clearer overview of current capabilities and compatibility with .NET 10 and Tailwind CSS.
- Revised the VERSIONING_STRATEGY.md to reflect the current version `0.4.0-alpha.1`, clarifying the unified versioning approach and publication boundaries. - Enhanced the ARCHITECTURE.md to describe the current source tree, including the CLI and component structure, and updated the architecture graph for better clarity. - Updated CLI_INSTALLATION.md to provide accurate installation instructions for the current source and published packages, including versioning details. - Streamlined CLI_SYNTAX.md to align with the latest command structure and options available in the current source. - Adjusted COMPONENT_DEPENDENCIES.md to reflect the authoritative source for component dependencies and their installation behavior. - Revised COMPONENT_ROADMAP.md to outline the current inventory and goals for future component development.
…d bundle size - Updated CI workflow to enhance validation for ShellUI initialization, ensuring that the correct JavaScript files are referenced and that the sidebar integration is properly handled. - Revised size guard comments for clarity and adjusted the bundle size threshold to prevent runaway outputs. - Added checks to confirm the presence of necessary functions in the global ShellUI JavaScript and to ensure legacy sidebar JS is not included in fresh installs.
- Modified the safelist drift test to include an additional target file in the regeneration command, ensuring accurate instructions for updating the safelist. - This change enhances the clarity of the error message when the safelist is out of date, providing users with the correct command to regenerate the safelist.
8 tasks
Shewart
added a commit
that referenced
this pull request
Sep 26, 2026
## Summary This prepares `v0.3.0-rc.2`: it sets the version, writes the release notes, and updates the docs. It also adds the three new charts to the CLI and fixes chart tooltips. After merge, tag the merged commit on `main` as `v0.3.0-rc.2` to publish. ## Release changes - **Version:** `Directory.Build.props` goes from `0.4.0-alpha.1` to `0.3.0-rc.2`. v0.3.0 ships from `main` first, and 0.4 starts after it. - **Release notes:** the "Unreleased" section becomes `# ShellUI v0.3.0-rc.2`. It covers the move to .NET 10 (a breaking change), Tailwind 4.3.2, the new components, and the fixes from #29, #30 and the `Class` parameter PR. - **`release.yml`:** fails before building or publishing when the CLI or Components version doesn't match the tag. - **Docs (16 files):** install commands pin `--version 0.3.0-rc.2`, and `0.3.0-rc.1` is named as the last release for .NET 9. Docs that only restated the current version now point to `Directory.Build.props`. Component counts are updated to 76 direct targets and 176 registry entries. ## Charts - **New CLI targets:** `donut-chart`, `radar-chart` and `radial-chart`. Before this, they existed only in the NuGet package. - **The CLI `chart-variants` template had drifted from the package in #26.** CLI-installed charts had broken tooltips: empty rows for pie, donut and radial. They also used the reverted `oklch` palette and lacked the animation and legend options. The template now matches the package, and `Chart` gains `ShowToolbar` and `ShowLegend`. - **Radar tooltips never appeared** because of the shared tooltip mode. RadarChart now uses per-point tooltips. - **Tooltip x-axis labels:** they were dropped for bar and radar charts because an empty categories list stopped the lookup. Fixed in the package, the template and the demo. - **Tests:** new drift check between `chart-variants` and the package, and sync and dependency coverage for the new charts. ## Test plan - [x] Clean Release build of `ShellUI.slnx`: no warnings or errors - [x] `dotnet test`: 107/107 passing - [x] Demo app build: no warnings or errors - [x] Fresh Blazor app: `shellui add donut-chart radar-chart radial-chart pie-chart bar-chart` exits with 0, builds with no warnings, and all five tooltips show label and value on hover - [x] Version check: tag `v0.3.0-rc.2` passes and a mismatched tag fails - [x] `scripts/extract-release-notes.sh 0.3.0-rc.2` extracts the section - [ ] CI - [ ] After merge: `pwsh ./prepare-release.ps1 -Version 0.3.0 -Suffix rc.2 -DryRun` on `main` ## After merge 1. `git checkout main && git pull --ff-only` 2. `pwsh ./prepare-release.ps1 -Version 0.3.0 -Suffix rc.2 -DryRun` 3. `git tag v0.3.0-rc.2 && git push origin v0.3.0-rc.2` 4. Test the published packages in FDMS and a fresh app, then prepare `v0.3.0`.
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
SidebarProvidernow uses the host-loadedshellui.jsfor its JavaScript calls instead of dynamically importing./shellui-sidebar.js. The relative import resolved against the page URL, so it returned a 404 whenever the generated component was compiled into a consumer's own Razor Class Library, where the asset is served from_content/<Library>/. The error was swallowed by atry/catch, so mobile detection and the Ctrl/Cmd+B shortcut silently did nothing. This came up in a real consumer (FDMS.UI).This PR also hardens
init/add/updatein the CLI and refreshes the docs.Changes
Templates
shellui-js: addsShellUI.initSidebar(handle, dotNetRef)/ShellUI.disposeSidebar(handle)(media-query mobile detection plus the Ctrl/Cmd+B shortcut, tracked per handle). The file now extendswindow.ShellUIwithObject.assigninstead of replacing it.sidebar-provider: calls the global helpers with a per-instance handle, depends onshellui-jsinstead ofsidebar-js, and logs interop failures instead of swallowing them.sidebar: no longer depends onsidebar-js.sidebar-js: kept as a hidden legacy entry, only for projects that still have the old generated provider.copy-button: removed theimport("./_content/ShellUI.Components/shellui.js")attempt and callsShellUI.copyToClipboarddirectly.CLI
addwith dependencies: if a dependency fails, the parent is now marked failed instead of being installed on top of a missing dependency. NuGet packages are still collected for components whose files were skipped as already present.shellui.js: if the existingwwwroot/shellui.jspredates the sidebar API,addrewrites it. If the file is marked customized,addstops and tells the user to update it by hand.update:shellui-js, it makes sure a compatibleshellui.jsis installed.shellui.json. Previously it passedskipConfig: true, so versions were never updated.remove sidebar-js: refuses while the project'sSidebarProviderstill imports the legacy module.init:shellorshellui-jscan't be installed.shellui.json.shellui.jsonis written only after the Tailwind build succeeds, so a failed init can be re-run.npx @tailwindcss/cli(the Tailwind v4 package name) instead ofnpx tailwindcss.shellui …instead ofdotnet shellui …, because it's installed as a global tool.Tests (98 passing)
RelativeJsModuleImportTests: fails if any template dynamically imports a relative./or../JS module (sidebar-jsis exempt as the legacy entry).SidebarInteropTests: checks that the provider uses the global helpers, thatshellui.jsexposes and cleans up the sidebar API, thatsidebar-jsis hidden and nothing depends on it, and that the NuGet package'sSidebarProviderkeeps its_content/path.sidebar-provideradded toRazorTemplate_CodeBlockParses.CI
SidebarProvider.razorcallsShellUI.initSidebarand does not importshellui-sidebar.js, thatshellui.jsexposesinitSidebar/disposeSidebar, and that a fresh sidebar install does not writewwwroot/shellui-sidebar.js.Docs
docs/*rewritten against the current registry: 73 direct CLI targets, 173 registry entries, and a CLI command list that matches the tool.RELEASE_NOTES.md: adds an "Unreleased / current source" section above the historicalv0.3.0-rc.1notes.SafelistDriftTestsnow includes the.targetsoutput path.Backward compatibility
wwwroot/shellui-sidebar.jsand the old provider keep working, becausesidebar-jsstays in the registry.shellui update sidebar-providermoves a project to the new interop and upgradesshellui.jsif needed.ShellUI.ComponentsNuGet package is unchanged. ItsSidebarProviderstill imports its own asset through_content/ShellUI.Components/.Test plan
dotnet build ShellUI.slnx -c Releasedotnet test ShellUI.slnx -c Release(98/98)shellui add dashboard-02in a Razor Class Library consumed by a Blazor Server host. The sidebar should collapse at widths under 768px and toggle with Ctrl+B.Follow-ups (separate PR, before v0.3.0-rc.2)
ClassNamewhile the NuGet package components exposeClass.Class="…"falls through to the unmatched attributes and can drop the base styling (the Skeleton report).shellui addexits with code 0 even when components fail.release.ymluses the whole ofRELEASE_NOTES.mdas the release body; it needs to use only the section for the tag being released.updateprints "Updated" and counts skipped components as successfully updated.