Features¶
ConnectSoft.Blazor.ComponentLibraryTemplate scaffolds a Razor Class Library (RCL) that is packable to NuGet, with its own design-token system, theme adapters, JS interop, and build-time security analyzers. It is not derived from ConnectSoft.BaseTemplate - it is a standalone front-end library template.
Components¶
Shipped under src/<Name>/Components/:
| Component | Notes |
|---|---|
Button |
Themable action button |
TextField |
Text input with validation adapter hooks |
Modal |
Dialog backed by modal.js interop |
DatePicker |
Calendar input backed by datepicker.js |
DataGrid |
Tabular data with datagrid.js interop |
LazyRender |
Defers rendering via LazyRenderPreloadService + lazy-render.js |
HelloWorld, SemanticDemo |
Reference/demo components |
Box |
Layout primitive - optional, removed when --include-sample-content false |
Theme adapters (satellite projects)¶
The template ships three optional theming strategies as separate projects so consumers reference only what they need (verified by the LinkerTest trim project):
| Project | Provider | DI extension |
|---|---|---|
.Tokens |
TokensThemeProvider |
TokensServiceCollectionExtensions |
.Flowbite |
FlowbiteThemeProvider |
FlowbiteServiceCollectionExtensions |
.DaisyUI |
DaisyUIThemeProvider |
DaisyUIServiceCollectionExtensions |
Adapter abstractions in the RCL: IThemeProvider, IToastAdapter, IDialogAdapter, IValidationAdapter with Bridge* and null implementations, plus RtlDirectionService.
Design tokens (static web assets)¶
CSS token layers under wwwroot/: tokens.css, tokens.dark.css, tokens.density.css, tokens.a11y.css, tokens.semantic.css, tokens.utilities.css, utilities.density.css, rtl.css. Tailwind compiles Styles/app.css to wwwroot/css/app.css via the project's package.json npm build.
Build-time security analyzers¶
The .SecurityAnalyzers project is referenced as a Roslyn analyzer and enforces safe-markup rules:
RawHtmlPatternAnalyzerMarkupStringJustificationAnalyzerAddMarkupContentBannedAnalyzerInnerHtmlJsInteropAnalyzer
A .Security project provides CSP primitives (CspMiddleware, CspNonceService) for hosts that consume the library.
Observability and options¶
LibraryTemplateOptionsbound from the"LibraryTemplate"configuration section, validated byValidateLibraryTemplateOptions.LibraryTemplateMetricsandLibraryTemplateDiagnosticsintegrate withConnectSoft.Extensions.Diagnostics.Metrics.- Localization via
Resources/Strings.resx.
Optional gallery¶
When --include-gallery true (default), a Blazor WebAssembly Gallery sample is generated with demo pages (e.g. ThemeOverridesDemo, BrandAndDensityDemo) for visual verification.