Skip to content

Commit 35cf9a0

Browse files
committed
BlazorExpress.Core integration
1 parent 04d3534 commit 35cf9a0

14 files changed

Lines changed: 14 additions & 525 deletions

File tree

BlazorExpress.Bulma.Demo.RCL/BlazorExpress.Bulma.Demo.RCL.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</ItemGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.11" />
14+
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.17" />
1515
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
1616
</ItemGroup>
1717

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
@using BlazorExpress.Bulma
2+
@using BlazorExpress.Core
23
@using Microsoft.AspNetCore.Components.Routing
34
@using Microsoft.AspNetCore.Components.Web

BlazorExpress.Bulma.Demo.Server/BlazorExpress.Bulma.Demo.Server.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.11" />
10+
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.17" />
1111
</ItemGroup>
1212

1313
<ItemGroup>

BlazorExpress.Bulma.Demo.WebAssembly/BlazorExpress.Bulma.Demo.WebAssembly.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.11" />
10+
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.17" />
1111
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.5" />
1212
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.5" PrivateAssets="all" />
1313
</ItemGroup>

BlazorExpress.Bulma/BlazorExpress.Bulma.csproj

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,16 @@
3636
</None>
3737
</ItemGroup>
3838

39+
<ItemGroup>
40+
<PackageReference Include="BlazorExpress.Core" Version="0.0.4" />
41+
</ItemGroup>
42+
3943
<ItemGroup>
4044
<SupportedPlatform Include="browser" />
4145
</ItemGroup>
4246

4347
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
44-
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.11" />
48+
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.17" />
4549
</ItemGroup>
4650

4751
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
Lines changed: 2 additions & 200 deletions
Original file line numberDiff line numberDiff line change
@@ -1,203 +1,5 @@
1-
using System.Diagnostics.CodeAnalysis;
1+
namespace BlazorExpress.Bulma;
22

3-
namespace BlazorExpress.Bulma;
4-
5-
public abstract class BulmaComponentBase : ComponentBase, IDisposable, IAsyncDisposable
3+
public abstract class BulmaComponentBase : BlazorExpressComponentCore
64
{
7-
#region Fields and Constants
8-
9-
private bool isAsyncDisposed;
10-
11-
private bool isDisposed;
12-
13-
internal Queue<Func<Task>> queuedTasks = new();
14-
15-
#endregion
16-
17-
#region Methods
18-
19-
/// <inheritdoc />
20-
protected override async Task OnAfterRenderAsync(bool firstRender)
21-
{
22-
// process queued tasks
23-
while (queuedTasks.TryDequeue(out var taskToExecute))
24-
await taskToExecute.Invoke();
25-
26-
if (firstRender)
27-
IsFirstRenderComplete = true;
28-
}
29-
30-
/// <inheritdoc />
31-
protected override void OnInitialized()
32-
{
33-
Id ??= IdUtility.GetNextId();
34-
}
35-
36-
public static string BuildClassNames(params (string? cssClass, bool when)[] cssClassList)
37-
{
38-
var list = new HashSet<string>();
39-
40-
if (cssClassList is not null && cssClassList.Any())
41-
foreach (var (cssClass, when) in cssClassList)
42-
if (!string.IsNullOrWhiteSpace(cssClass) && when)
43-
list.Add(cssClass);
44-
45-
if (list.Any())
46-
return string.Join(" ", list);
47-
48-
return string.Empty;
49-
}
50-
51-
public static string BuildClassNames(string? userDefinedCssClass, params (string? cssClass, bool when)[] cssClassList)
52-
{
53-
var list = new HashSet<string>();
54-
55-
if (cssClassList is not null && cssClassList.Any())
56-
foreach (var (cssClass, when) in cssClassList)
57-
if (!string.IsNullOrWhiteSpace(cssClass) && when)
58-
list.Add(cssClass);
59-
60-
if (!string.IsNullOrWhiteSpace(userDefinedCssClass))
61-
list.Add(userDefinedCssClass.Trim());
62-
63-
if (list.Any())
64-
return string.Join(" ", list);
65-
66-
return string.Empty;
67-
}
68-
69-
public static string BuildStyleNames(string? userDefinedCssStyle, params (string? cssStyle, bool when)[] cssStyleList)
70-
{
71-
var list = new HashSet<string>();
72-
73-
if (cssStyleList is not null && cssStyleList.Any())
74-
foreach (var (cssStyle, when) in cssStyleList)
75-
if (!string.IsNullOrWhiteSpace(cssStyle) && when)
76-
list.Add(cssStyle);
77-
78-
if (!string.IsNullOrWhiteSpace(userDefinedCssStyle))
79-
list.Add(userDefinedCssStyle.Trim());
80-
81-
if (list.Any())
82-
return string.Join(';', list);
83-
84-
return string.Empty;
85-
}
86-
87-
/// <inheritdoc />
88-
/// <seealso cref="https://learn.microsoft.com/en-us/dotnet/api/system.idisposable?view=net-6.0" />
89-
public void Dispose()
90-
{
91-
Dispose(true);
92-
GC.SuppressFinalize(this);
93-
}
94-
95-
/// <inheritdoc />
96-
/// <seealso
97-
/// cref="https://learn.microsoft.com/en-us/dotnet/standard/garbage-collection/implementing-disposeasync#implement-both-dispose-and-async-dispose-patterns" />
98-
public async ValueTask DisposeAsync()
99-
{
100-
await DisposeAsyncCore(true).ConfigureAwait(false);
101-
102-
Dispose(false);
103-
GC.SuppressFinalize(this);
104-
}
105-
106-
protected virtual void Dispose(bool disposing)
107-
{
108-
if (!isDisposed)
109-
{
110-
if (disposing)
111-
{
112-
// cleanup
113-
}
114-
115-
isDisposed = true;
116-
}
117-
}
118-
119-
protected virtual ValueTask DisposeAsyncCore(bool disposing)
120-
{
121-
if (!isAsyncDisposed)
122-
{
123-
if (disposing)
124-
{
125-
// cleanup
126-
}
127-
128-
isAsyncDisposed = true;
129-
}
130-
131-
return ValueTask.CompletedTask;
132-
}
133-
134-
#endregion
135-
136-
#region Properties, Indexers
137-
138-
[Parameter(CaptureUnmatchedValues = true)] public Dictionary<string, object> AdditionalAttributes { get; set; } = default!;
139-
140-
/// <summary>
141-
/// Gets or sets the CSS class.
142-
/// <para>
143-
/// Default value is <see langword="null" />.
144-
/// </para>
145-
/// </summary>
146-
[AddedVersion("1.0.0")]
147-
[DefaultValue(null)]
148-
[Description("Gets or sets the CSS class.")]
149-
[Parameter]
150-
public string? Class { get; set; }
151-
152-
protected virtual string? ClassNames => Class;
153-
154-
/// <summary>
155-
/// Gets or sets the associated <see cref="ElementReference" />.
156-
/// <para>
157-
/// May be <see langword="null" />, if accessed before the component is rendered.
158-
/// </para>
159-
/// </summary>
160-
[DisallowNull]
161-
public ElementReference? Element { get; set; }
162-
163-
/// <summary>
164-
/// Gets or sets the ID. If not set, a unique ID will be generated.
165-
/// <para>
166-
/// Default value is <see langword="null" />.
167-
/// </para>
168-
/// </summary>
169-
[AddedVersion("1.0.0")]
170-
[DefaultValue(null)]
171-
[Description("Gets or sets the ID. If not set, a unique ID will be generated.")]
172-
[Parameter]
173-
public string? Id { get; set; }
174-
175-
protected bool IsFirstRenderComplete { get; private set; }
176-
177-
[Inject] protected IJSRuntime JSRuntime { get; set; } = default!;
178-
179-
/// <summary>
180-
/// Gets or sets the CSS style.
181-
/// <para>
182-
/// Default value is <see langword="null" />.
183-
/// </para>
184-
/// </summary>
185-
[AddedVersion("1.0.0")]
186-
[DefaultValue(null)]
187-
[Description("Gets or sets the CSS style.")]
188-
[Parameter]
189-
public string? Style { get; set; }
190-
191-
protected virtual string? StyleNames => Style;
192-
193-
#endregion
194-
195-
#region Other
196-
197-
~BulmaComponentBase()
198-
{
199-
Dispose(false);
200-
}
201-
202-
#endregion
2035
}

0 commit comments

Comments
 (0)