6 |
7 |
8 |
9 | bit platform
10 |
11 |
12 |
13 |
14 |
15 |
16 | Our vision is to empower organizations and people to maximize their performance through
17 | high quality development services and products.
18 |
19 |
20 |
27 |
28 | @code {
29 | int _counter;
30 | }
--------------------------------------------------------------------------------
/Bit.BlazorUIPlayground.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | net10.0
7 | enable
8 | enable
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | all
17 | runtime; build; native; contentfiles; analyzers; buildtransitive
18 |
19 |
20 |
21 | all
22 | runtime; build; native; contentfiles; analyzers; buildtransitive
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/Program.cs:
--------------------------------------------------------------------------------
1 | using Bit.BlazorUIPlayground.Components;
2 |
3 | var builder = WebApplication.CreateBuilder(args);
4 |
5 | // Add services to the container.
6 | builder.Services.AddRazorComponents()
7 | .AddInteractiveServerComponents();
8 |
9 | builder.Services.AddBitBlazorUIServices();
10 |
11 | var app = builder.Build();
12 |
13 | // Configure the HTTP request pipeline.
14 | if (!app.Environment.IsDevelopment())
15 | {
16 | app.UseExceptionHandler("/Error", createScopeForErrors: true);
17 | // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
18 | app.UseHsts();
19 | }
20 |
21 | if (builder.Environment.IsDevelopment() is false)
22 | {
23 | app.UseHttpsRedirection();
24 | app.UseResponseCompression();
25 | }
26 |
27 | app.UseStaticFiles();
28 | app.UseAntiforgery();
29 |
30 | app.MapStaticAssets();
31 | app.MapRazorComponents()
32 | .AddInteractiveServerRenderMode();
33 |
34 | app.Run();
35 |
--------------------------------------------------------------------------------
/Clean.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # This batch script cleans your project by deleting unnecessary files.
4 | # It is important to close any IDEs, such as vs for mac, before running this script to prevent conflicts or data loss.
5 | # The commands in this script are specifically designed for macOS/Linux.
6 |
7 | # Runs the dotnet clean command for each .csproj file.
8 | for csproj in $(find . -name '*.csproj'); do
9 | dotnet clean $csproj
10 | done
11 |
12 | # Deletes specified directories
13 | for dir in $(find . -type d \( -name "bin" -o -name "obj" -o -name "node_modules" -o -name "Packages" -o -name ".vs" -o -name "TestResults" -o -name "AppPackages" -o -name ".meteor" \)); do
14 | rm -rf $dir
15 | done
16 |
17 | # Deletes specified files
18 | for file in $(find . -type f \( -name "*.csproj.user" -o -name "Resources.designer.cs" -o -name "*.css" -o -name "*.min.css" -o -name "*.js" -o -name "*.min.js" -o -name "*.map" \)); do
19 | rm -f $file
20 | done
21 |
22 | # Deletes empty directories.
23 | find . -type d -empty -delete
--------------------------------------------------------------------------------
/.devcontainer/devcontainer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Bit Blazor UI Playground",
3 | "image": "mcr.microsoft.com/dotnet/sdk:10.0",
4 | "hostRequirements": {
5 | "cpus": 4
6 | },
7 | "waitFor": "onCreateCommand",
8 | "onCreateCommand": "dotnet dev-certs https --trust",
9 | "customizations": {
10 | "codespaces": {
11 | "openFiles": [
12 | "Components/Pages/Home.razor"
13 | ]
14 | },
15 | "vscode": {
16 | "extensions": [
17 | "GitHub.copilot",
18 | "GitHub.copilot-chat",
19 | "ms-dotnettools.csharp",
20 | "ms-dotnettools.csdevkit",
21 | "ms-dotnettools.vscode-dotnet-runtime"
22 | ]
23 | }
24 | },
25 | "portsAttributes": {
26 | "4000": {
27 | "label": "Application",
28 | "onAutoForward": "openPreview"
29 | },
30 | "4001": {
31 | "label": "Application",
32 | "onAutoForward": "openPreview"
33 | }
34 | },
35 | "forwardPorts": [
36 | 4000,
37 | 4001
38 | ],
39 | "remoteEnv": {
40 | "ASPNETCORE_ENVIRONMENT": "Development"
41 | }
42 | }
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) [year] [fullname]
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Components/Layout/Header.razor.css:
--------------------------------------------------------------------------------
1 | header {
2 | top: 0;
3 | width: 100%;
4 | z-index: 11;
5 | position: fixed;
6 | backdrop-filter: blur(20px);
7 | -webkit-backdrop-filter: blur(20px);
8 | }
9 |
10 | .container {
11 | display: flex;
12 | min-height: 3rem;
13 | margin-left: auto;
14 | margin-right: auto;
15 | padding-left: 1rem;
16 | align-items: center;
17 | padding-right: 1rem;
18 | flex-flow: row nowrap;
19 | box-sizing: border-box;
20 | justify-content: space-between;
21 | }
22 |
23 | .content {
24 | height: 100%;
25 | display: flex;
26 | align-items: center;
27 | flex-flow: row nowrap;
28 | }
29 |
30 | ::deep .logo {
31 | width: 2rem;
32 | height: 2rem;
33 | cursor: pointer;
34 | margin-right: 1rem;
35 | background-size: contain;
36 | background-position: center;
37 | background-repeat: no-repeat;
38 | background-image: url('/bit-logo.svg');
39 | }
40 |
41 | ::deep .link {
42 | padding: 1rem;
43 | line-height: 1.5;
44 | text-decoration: none;
45 | }
46 |
47 | .right-section {
48 | gap: 1rem;
49 | display: flex;
50 | align-items: center;
51 | }
--------------------------------------------------------------------------------
/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json.schemastore.org/launchsettings.json",
3 | "iisSettings": {
4 | "windowsAuthentication": false,
5 | "anonymousAuthentication": true,
6 | "iisExpress": {
7 | "applicationUrl": "http://localhost:61616",
8 | "sslPort": 44390
9 | }
10 | },
11 | "profiles": {
12 | "http": {
13 | "commandName": "Project",
14 | "dotnetRunMessages": true,
15 | "launchBrowser": true,
16 | "applicationUrl": "http://localhost:5293",
17 | "environmentVariables": {
18 | "ASPNETCORE_ENVIRONMENT": "Development"
19 | }
20 | },
21 | "https": {
22 | "commandName": "Project",
23 | "dotnetRunMessages": true,
24 | "launchBrowser": true,
25 | "applicationUrl": "https://localhost:7173;http://localhost:5293",
26 | "environmentVariables": {
27 | "ASPNETCORE_ENVIRONMENT": "Development"
28 | }
29 | },
30 | "IIS Express": {
31 | "commandName": "IISExpress",
32 | "launchBrowser": true,
33 | "environmentVariables": {
34 | "ASPNETCORE_ENVIRONMENT": "Development"
35 | }
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Components/Pages/Error.razor:
--------------------------------------------------------------------------------
1 | @page "/Error"
2 | @using System.Diagnostics
3 |
4 | Error
5 |
6 |
Error.
7 |
An error occurred while processing your request.
8 |
9 | @if (ShowRequestId)
10 | {
11 |
12 | Request ID:@RequestId
13 |
14 | }
15 |
16 |
Development Mode
17 |
18 | Swapping to Development environment will display more detailed information about the error that occurred.
19 |
20 |
21 | The Development environment shouldn't be enabled for deployed applications.
22 | It can result in displaying sensitive information from exceptions to end users.
23 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development
24 | and restarting the app.
25 |
26 |
27 | @code{
28 | [CascadingParameter] private HttpContext? HttpContext { get; set; }
29 |
30 | private string? RequestId { get; set; }
31 | private bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
32 |
33 | protected override void OnInitialized() => RequestId = Activity.Current?.Id ?? HttpContext?.TraceIdentifier;
34 | }
35 |
--------------------------------------------------------------------------------
/Clean.bat:
--------------------------------------------------------------------------------
1 | :: This batch script is designed for comprehensive cleaning of your project by deleting unnecessary files.
2 | :: It's crucial to close any Integrated Development Environment (IDE), such as Visual Studio, etc., before executing this script to prevent any conflicts or loss of unsaved data.
3 | :: Please note that the commands included in this script are specifically tailored for the Windows
4 |
5 | :: Delete css,js and source maps files if not tracked in git
6 | powershell -Command "[string]$trackedFiles = git ls-files; Get-ChildItem -Force -Include *.css,*.min.css,*.js,*.min.js,*.map -Recurse | ForEach-Object { if ($trackedFiles -NotMatch $_.Name) { Remove-Item -Recurse -Path $_ -Confirm:$false -Force }}"
7 |
8 | :: Runs dotnet clean for each csproj file
9 | powershell -Command "Get-ChildItem -Force -Include *.csproj -Recurse | ForEach-Object { dotnet clean $_.FullName }"
10 |
11 | :: Delete specified files & folders
12 | powershell -Command "Get-ChildItem -Force -Include *.csproj.user,Resources.designer.cs,bin,obj,node_modules,Packages,TestResults,AppPackages,.meteor -Recurse | ForEach-Object { Remove-Item -Recurse -Path $_ -Confirm:$false -Force }"
13 | FOR /d /r . %%d IN (.vs) DO @IF EXIST "%%d" rd /s /q "%%d"
14 |
15 | :: Delete empty directories
16 | powershell -Command "Get-ChildItem -Recurse | Where-Object { $_.PSIsContainer -and @(Get-ChildItem -Lit $_.FullName).Count -eq 0 } | Remove-Item -Confirm:$false -Force"
--------------------------------------------------------------------------------
/Components/Layout/Header.razor:
--------------------------------------------------------------------------------
1 | @rendermode InteractiveServer
2 | @inject NavigationManager _navigationManager
3 | @inject BitThemeManager _bitThemeManager
4 |
5 |
6 |
7 |
8 |
9 | Home
10 | About
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | @code {
21 | private string _currentUrl = string.Empty;
22 |
23 | protected override void OnInitialized()
24 | {
25 | _currentUrl = _navigationManager.Uri.Replace(_navigationManager.BaseUri, "/", StringComparison.Ordinal);
26 | _navigationManager.LocationChanged += OnLocationChanged;
27 |
28 | base.OnInitialized();
29 | }
30 |
31 | private void OnLocationChanged(object? sender, LocationChangedEventArgs args)
32 | {
33 | _currentUrl = _navigationManager.Uri.Replace(_navigationManager.BaseUri, "/", StringComparison.Ordinal);
34 | StateHasChanged();
35 | }
36 |
37 | private async Task ToggleTheme()
38 | {
39 | await _bitThemeManager.ToggleDarkLightAsync();
40 | }
41 | }
--------------------------------------------------------------------------------
/.github/copilot-instructions.md:
--------------------------------------------------------------------------------
1 | # GitHub Copilot Instructions
2 |
3 | ## Key Technologies
4 |
5 | - **C# 13.0**
6 | - **ASP.NET Core 9.0**
7 | - **Blazor**: Component-based web UI framework
8 | - **Bit.BlazorUI**: Primary UI component library
9 |
10 | ## Coding Conventions & Best Practices
11 |
12 | 1. **Follow the established project structure**: Adhere to the defined layout for consistency.
13 | 2. **Use Bit.BlazorUI Components**: Prioritize using components from the Bit.BlazorUI library over generic HTML to ensure UI consistency and leverage built-in features.
14 | 3. **Embrace Nullable Reference Types**: All new code must be nullable-aware, as nullability is enabled project-wide.
15 | 4. **Leverage Dependency Injection**: Register and resolve services using the built-in DI container.
16 | 5. **Implement Structured Logging**: Use structured logging for clear, queryable application logs.
17 | 6. **Use Async Programming**: Employ `async/await` for I/O-bound operations to prevent blocking threads.
18 | 7. **Modern C#**: Write modern, concise, and efficient code by using the latest C# language features, including implicit usings and global using statements.
19 | 8. **Prefer razor.cs code-behind files**: Use `.razor.cs` files for component logic instead of @code blocks in `.razor` files.
20 | 9. **Prefer razor.css files**: Use `.razor.css` files for component styles instead of inline styles in `.razor` files.
21 | 10. **After applying changes, make sure project builds successfully**: Always verify that the project builds without errors after making changes.
22 |
23 | ## Rules
24 |
25 | **RULE 1:** If a task (question, code modification or review) involves the use of bit BlazorUI components (e.g., `BitButton`, `BitTooltip`, `BitTextField`),
26 | or refers to `bitplatform`, `bit Bswup`, `bit Butil`, `bit Besql`, or `bit Boilerplate`, or involves UI components without explicitly specifying their UI toolkit,
27 | you **MUST** use the deepwiki's `ask_question` mcp tool to find the correct implementation and usage patterns of `bitfoundation/bitplatform` deep wiki before writing or changing any code.
28 |
29 | **End of RULE 1**
30 |
31 | **RULE 2:** If a task (question, code modification, or review) involves Microsoft technologies such as C#, F#, ASP.NET Core, Microsoft.Extensions, NuGet, Entity Framework, Blazor or the `dotnet` runtime,
32 | you **MUST** use the `microsoft.docs.mcp` server to search Microsoft's latest official documentation for detailed and up-to-date information before responding to specific or narrowly defined questions.
33 |
34 | **End of RULE 2**
35 |
36 | **RULE 3:** You **MUST** use the read-website-fast's `fetch` mcp tools, to gather information from URLs provided by the user.
37 |
38 | **End of RULE 3**
39 |
--------------------------------------------------------------------------------
/wwwroot/bit-logo.svg:
--------------------------------------------------------------------------------
1 |
9 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | x64/
19 | x86/
20 | build/
21 | bld/
22 | [Bb]in/
23 | [Oo]bj/
24 |
25 | # Visual Studio 2015 cache/options directory
26 | .vs/
27 |
28 | # MSTest test Results
29 | [Tt]est[Rr]esult*/
30 | [Bb]uild[Ll]og.*
31 |
32 | # NUNIT
33 | *.VisualState.xml
34 | TestResult.xml
35 |
36 | # Build Results of an ATL Project
37 | [Dd]ebugPS/
38 | [Rr]eleasePS/
39 | dlldata.c
40 |
41 | # DNX
42 | project.lock.json
43 | artifacts/
44 |
45 | *_i.c
46 | *_p.c
47 | *_i.h
48 | *.ilk
49 | *.meta
50 | *.obj
51 | *.pch
52 | *.pdb
53 | *.pgc
54 | *.pgd
55 | *.rsp
56 | *.sbr
57 | *.tlb
58 | *.tli
59 | *.tlh
60 | *.tmp
61 | *.tmp_proj
62 | *.log
63 | *.vspscc
64 | *.vssscc
65 | .builds
66 | *.pidb
67 | *.svclog
68 | *.scc
69 |
70 | # Chutzpah Test files
71 | _Chutzpah*
72 |
73 | # Visual C++ cache files
74 | ipch/
75 | *.aps
76 | *.ncb
77 | *.opensdf
78 | *.sdf
79 | *.cachefile
80 |
81 | # Visual Studio profiler
82 | *.psess
83 | *.vsp
84 | *.vspx
85 |
86 | # TFS 2012 Local Workspace
87 | $tf/
88 |
89 | # Guidance Automation Toolkit
90 | *.gpState
91 |
92 | # ReSharper is a .NET coding add-in
93 | _ReSharper*/
94 | *.[Rr]e[Ss]harper
95 | *.DotSettings.user
96 |
97 | # JustCode is a .NET coding add-in
98 | .JustCode
99 |
100 | # TeamCity is a build add-in
101 | _TeamCity*
102 |
103 | # DotCover is a Code Coverage Tool
104 | *.dotCover
105 |
106 | # NCrunch
107 | _NCrunch_*
108 | .*crunch*.local.xml
109 |
110 | # MightyMoose
111 | *.mm.*
112 | AutoTest.Net/
113 |
114 | # Web workbench (sass)
115 | .sass-cache/
116 |
117 | # Installshield output folder
118 | [Ee]xpress/
119 |
120 | # DocProject is a documentation generator add-in
121 | DocProject/buildhelp/
122 | DocProject/Help/*.HxT
123 | DocProject/Help/*.HxC
124 | DocProject/Help/*.hhc
125 | DocProject/Help/*.hhk
126 | DocProject/Help/*.hhp
127 | DocProject/Help/Html2
128 | DocProject/Help/html
129 |
130 | # Click-Once directory
131 | publish/
132 |
133 | # Publish Web Output
134 | *.[Pp]ublish.xml
135 | *.azurePubxml
136 | ## TODO: Comment the next line if you want to checkin your
137 | ## web deploy settings but do note that will include unencrypted
138 | ## passwords
139 | *.pubxml
140 |
141 | *.publishproj
142 |
143 | # NuGet Packages
144 | *.nupkg
145 | # The packages folder can be ignored because of Package Restore
146 | **/packages/*
147 | # except build/, which is used as an MSBuild target.
148 | !**/packages/build/
149 | # Uncomment if necessary however generally it will be regenerated when needed
150 | #!**/packages/repositories.config
151 |
152 | # Windows Azure Build Output
153 | csx/
154 | *.build.csdef
155 |
156 | # Windows Store app package directory
157 | AppPackages/
158 |
159 | # Visual Studio cache files
160 | # files ending in .cache can be ignored
161 | *.[Cc]ache
162 | # but keep track of directories ending in .cache
163 | !*.[Cc]ache/
164 |
165 | # Others
166 | ClientBin/
167 | [Ss]tyle[Cc]op.*
168 | ~$*
169 | *~
170 | *.dbmdl
171 | *.dbproj.schemaview
172 | *.publishsettings
173 | node_modules/
174 | orleans.codegen.cs
175 |
176 | # RIA/Silverlight projects
177 | Generated_Code/
178 |
179 | # Backup & report files from converting an old project file
180 | # to a newer Visual Studio version. Backup files are not needed,
181 | # because we have git ;-)
182 | _UpgradeReport_Files/
183 | Backup*/
184 | UpgradeLog*.XML
185 | UpgradeLog*.htm
186 |
187 | # SQL Server files
188 | *.mdf
189 | *.ldf
190 |
191 | # Business Intelligence projects
192 | *.rdl.data
193 | *.bim.layout
194 | *.bim_*.settings
195 |
196 | # Microsoft Fakes
197 | FakesAssemblies/
198 |
199 | # Node.js Tools for Visual Studio
200 | .ntvs_analysis.dat
201 |
202 | # Visual Studio 6 build log
203 | *.plg
204 |
205 | # Visual Studio 6 workspace options file
206 | *.opt
207 |
208 | # LightSwitch generated files
209 | GeneratedArtifacts/
210 | _Pvt_Extensions/
211 | ModelManifest.xml
212 |
213 | # VS Code
214 | .vscode
215 |
216 | # Rider
217 | .idea
218 |
219 | profile.arm.json
--------------------------------------------------------------------------------