Skip to content

Commit 4bc113e

Browse files
Renames
1 parent e3fe72d commit 4bc113e

File tree

6 files changed

+30
-30
lines changed

6 files changed

+30
-30
lines changed

src/Components/Web/src/HtmlRendering/HtmlContent.cs renamed to src/Components/Web/src/HtmlRendering/HtmlComponent.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ namespace Microsoft.AspNetCore.Components.Web;
88
/// <summary>
99
/// Represents the output of rendering a component as HTML. The content can change if the component instance re-renders.
1010
/// </summary>
11-
public sealed class HtmlContent
11+
public sealed class HtmlComponent
1212
{
1313
private readonly HtmlRendererCore _renderer;
1414
private readonly int _componentId;
1515
private readonly Task _quiescenceTask;
1616

17-
internal HtmlContent(HtmlRendererCore renderer, int componentId, Task quiescenceTask)
17+
internal HtmlComponent(HtmlRendererCore renderer, int componentId, Task quiescenceTask)
1818
{
1919
_renderer = renderer;
2020
_componentId = componentId;
@@ -35,16 +35,16 @@ public Task WaitForQuiescenceAsync()
3535
public string ToHtmlString()
3636
{
3737
using var writer = new StringWriter();
38-
WriteTo(writer);
38+
WriteHtmlTo(writer);
3939
return writer.ToString();
4040
}
4141

4242
/// <summary>
4343
/// Writes the component's latest output as HTML to the specified writer.
4444
/// </summary>
4545
/// <param name="output">The output destination.</param>
46-
public void WriteTo(TextWriter output)
46+
public void WriteHtmlTo(TextWriter output)
4747
{
48-
HtmlContentWriter.Write(_renderer, _componentId, output);
48+
HtmlComponentWriter.Write(_renderer, _componentId, output);
4949
}
5050
}

src/Components/Web/src/HtmlRendering/HtmlContentWriter.cs renamed to src/Components/Web/src/HtmlRendering/HtmlComponentWriter.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace Microsoft.AspNetCore.Components.Web;
1010

1111
// This is OK to be a struct because it never gets passed around anywhere. Other code can't even get an instance
1212
// of it. It just keeps track of some contextual information during a single synchronous HTML output operation.
13-
internal ref struct HtmlContentWriter
13+
internal ref struct HtmlComponentWriter
1414
{
1515
private static readonly HashSet<string> SelfClosingElements = new HashSet<string>(StringComparer.OrdinalIgnoreCase)
1616
{
@@ -28,11 +28,11 @@ public static void Write(HtmlRendererCore renderer, int componentId, TextWriter
2828
// So, we require exclusive access to the renderer during this synchronous process.
2929
renderer.Dispatcher.AssertAccess();
3030

31-
var context = new HtmlContentWriter(renderer, output);
31+
var context = new HtmlComponentWriter(renderer, output);
3232
context.RenderComponent(componentId);
3333
}
3434

35-
private HtmlContentWriter(HtmlRendererCore renderer, TextWriter output)
35+
private HtmlComponentWriter(HtmlRendererCore renderer, TextWriter output)
3636
{
3737
_renderer = renderer;
3838
_output = output;

src/Components/Web/src/HtmlRendering/HtmlRenderer.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,24 +40,24 @@ public ValueTask DisposeAsync()
4040
/// <summary>
4141
/// Adds an instance of the specified component and instructs it to render. The resulting content represents the
4242
/// initial synchronous rendering state, which may later change. To wait for the component hierarchy to complete
43-
/// any asynchronous operations such as loading, use <see cref="HtmlContent.WaitForQuiescenceAsync"/> before
44-
/// reading content from the <see cref="HtmlContent"/>.
43+
/// any asynchronous operations such as loading, use <see cref="HtmlComponent.WaitForQuiescenceAsync"/> before
44+
/// reading content from the <see cref="HtmlComponent"/>.
4545
/// </summary>
4646
/// <typeparam name="TComponent">The component type.</typeparam>
47-
/// <returns>A task that completes with <see cref="HtmlContent"/> instance representing the render output.</returns>
48-
public HtmlContent BeginRenderingComponent<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] TComponent>() where TComponent : IComponent
47+
/// <returns>A task that completes with <see cref="HtmlComponent"/> instance representing the render output.</returns>
48+
public HtmlComponent BeginRenderingComponent<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] TComponent>() where TComponent : IComponent
4949
=> BeginRenderingComponent<TComponent>(ParameterView.Empty);
5050

5151
/// <summary>
5252
/// Adds an instance of the specified component and instructs it to render. The resulting content represents the
5353
/// initial synchronous rendering state, which may later change. To wait for the component hierarchy to complete
54-
/// any asynchronous operations such as loading, use <see cref="HtmlContent.WaitForQuiescenceAsync"/> before
55-
/// reading content from the <see cref="HtmlContent"/>.
54+
/// any asynchronous operations such as loading, use <see cref="HtmlComponent.WaitForQuiescenceAsync"/> before
55+
/// reading content from the <see cref="HtmlComponent"/>.
5656
/// </summary>
5757
/// <typeparam name="TComponent">The component type.</typeparam>
5858
/// <param name="parameters">Parameters for the component.</param>
59-
/// <returns>A task that completes with <see cref="HtmlContent"/> instance representing the render output.</returns>
60-
public HtmlContent BeginRenderingComponent<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] TComponent>(
59+
/// <returns>A task that completes with <see cref="HtmlComponent"/> instance representing the render output.</returns>
60+
public HtmlComponent BeginRenderingComponent<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] TComponent>(
6161
ParameterView parameters) where TComponent : IComponent
6262
=> _passiveHtmlRenderer.BeginRenderingComponentAsync(typeof(TComponent), parameters);
6363

@@ -66,8 +66,8 @@ public ValueTask DisposeAsync()
6666
/// for the component hierarchy to complete asynchronous tasks such as loading.
6767
/// </summary>
6868
/// <typeparam name="TComponent">The component type.</typeparam>
69-
/// <returns>A task that completes with <see cref="HtmlContent"/> once the component hierarchy has completed any asynchronous tasks such as loading.</returns>
70-
public Task<HtmlContent> RenderComponentAsync<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] TComponent>() where TComponent : IComponent
69+
/// <returns>A task that completes with <see cref="HtmlComponent"/> once the component hierarchy has completed any asynchronous tasks such as loading.</returns>
70+
public Task<HtmlComponent> RenderComponentAsync<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] TComponent>() where TComponent : IComponent
7171
=> RenderComponentAsync<TComponent>(ParameterView.Empty);
7272

7373
/// <summary>
@@ -76,8 +76,8 @@ public ValueTask DisposeAsync()
7676
/// </summary>
7777
/// <typeparam name="TComponent">The component type.</typeparam>
7878
/// <param name="parameters">Parameters for the component.</param>
79-
/// <returns>A task that completes with <see cref="HtmlContent"/> once the component hierarchy has completed any asynchronous tasks such as loading.</returns>
80-
public async Task<HtmlContent> RenderComponentAsync<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] TComponent>(
79+
/// <returns>A task that completes with <see cref="HtmlComponent"/> once the component hierarchy has completed any asynchronous tasks such as loading.</returns>
80+
public async Task<HtmlComponent> RenderComponentAsync<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] TComponent>(
8181
ParameterView parameters) where TComponent : IComponent
8282
{
8383
var content = BeginRenderingComponent<TComponent>(parameters);

src/Components/Web/src/HtmlRendering/HtmlRendererCore.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public HtmlRendererCore(IServiceProvider serviceProvider, ILoggerFactory loggerF
2121

2222
public override Dispatcher Dispatcher { get; } = Dispatcher.CreateDefault();
2323

24-
public HtmlContent BeginRenderingComponentAsync(
24+
public HtmlComponent BeginRenderingComponentAsync(
2525
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type componentType,
2626
ParameterView initialParameters)
2727
{
@@ -34,7 +34,7 @@ public HtmlContent BeginRenderingComponentAsync(
3434
ExceptionDispatchInfo.Capture(quiescenceTask.Exception.InnerException ?? quiescenceTask.Exception).Throw();
3535
}
3636

37-
return new HtmlContent(this, componentId, quiescenceTask);
37+
return new HtmlComponent(this, componentId, quiescenceTask);
3838
}
3939

4040
protected override void HandleException(Exception exception)

src/Components/Web/src/PublicAPI.Unshipped.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#nullable enable
2-
Microsoft.AspNetCore.Components.Web.HtmlContent
3-
Microsoft.AspNetCore.Components.Web.HtmlContent.ToHtmlString() -> string!
4-
Microsoft.AspNetCore.Components.Web.HtmlContent.WaitForQuiescenceAsync() -> System.Threading.Tasks.Task!
5-
Microsoft.AspNetCore.Components.Web.HtmlContent.WriteTo(System.IO.TextWriter! output) -> void
2+
Microsoft.AspNetCore.Components.Web.HtmlComponent
3+
Microsoft.AspNetCore.Components.Web.HtmlComponent.ToHtmlString() -> string!
4+
Microsoft.AspNetCore.Components.Web.HtmlComponent.WaitForQuiescenceAsync() -> System.Threading.Tasks.Task!
5+
Microsoft.AspNetCore.Components.Web.HtmlComponent.WriteHtmlTo(System.IO.TextWriter! output) -> void
66
Microsoft.AspNetCore.Components.Web.HtmlRenderer
77
Microsoft.AspNetCore.Components.Web.HtmlRenderer.BeginRenderingComponent<TComponent>() -> Microsoft.AspNetCore.Components.Web.HtmlContent!
88
Microsoft.AspNetCore.Components.Web.HtmlRenderer.BeginRenderingComponent<TComponent>(Microsoft.AspNetCore.Components.ParameterView parameters) -> Microsoft.AspNetCore.Components.Web.HtmlContent!

src/Components/Web/test/HtmlRendering/HtmlRendererTest.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public async Task HtmlContent_Write_ThrowsIfNotOnSyncContext()
3737
var htmlContent = await htmlRenderer.Dispatcher.InvokeAsync(htmlRenderer.BeginRenderingComponent<TestComponent>);
3838

3939
// Act
40-
var ex = Assert.Throws<InvalidOperationException>(() => htmlContent.WriteTo(new StringWriter()));
40+
var ex = Assert.Throws<InvalidOperationException>(() => htmlContent.WriteHtmlTo(new StringWriter()));
4141
Assert.Contains("The current thread is not associated with the Dispatcher", ex.Message);
4242
}
4343

@@ -858,7 +858,7 @@ await htmlRenderer.Dispatcher.InvokeAsync(async () =>
858858
{
859859
// Act
860860
var result = await htmlRenderer.RenderComponentAsync<TestComponent>();
861-
result.WriteTo(writer);
861+
result.WriteHtmlTo(writer);
862862
writer.Flush();
863863

864864
// Assert
@@ -982,10 +982,10 @@ await htmlRenderer.Dispatcher.InvokeAsync(async () =>
982982
});
983983
}
984984

985-
void AssertHtmlContentEquals(IEnumerable<string> expected, HtmlContent actual)
985+
void AssertHtmlContentEquals(IEnumerable<string> expected, HtmlComponent actual)
986986
=> AssertHtmlContentEquals(string.Join(string.Empty, expected), actual);
987987

988-
void AssertHtmlContentEquals(string expected, HtmlContent actual)
988+
void AssertHtmlContentEquals(string expected, HtmlComponent actual)
989989
{
990990
var actualHtml = actual.ToHtmlString();
991991
Assert.Equal(expected, actualHtml);

0 commit comments

Comments
 (0)