Skip to content

Commit d57ef96

Browse files
authored
[Blazor] Rename ComponentPlatform to RendererInfo (#56263)
* Rename ComponentPlatform to RendererInfo
1 parent 8ca8b6b commit d57ef96

File tree

14 files changed

+49
-58
lines changed

14 files changed

+49
-58
lines changed

src/Components/Components/src/ComponentBase.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ public ComponentBase()
4343
}
4444

4545
/// <summary>
46-
/// Gets the <see cref="ComponentPlatform"/> the component is running on.
46+
/// Gets the <see cref="Components.RendererInfo"/> the component is running on.
4747
/// </summary>
48-
protected ComponentPlatform Platform => _renderHandle.Platform;
48+
protected RendererInfo RendererInfo => _renderHandle.RendererInfo;
4949

5050
/// <summary>
5151
/// Gets the <see cref="ResourceAssetCollection"/> for the application.

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
#nullable enable
22
Microsoft.AspNetCore.Components.ComponentBase.Assets.get -> Microsoft.AspNetCore.Components.ResourceAssetCollection!
33
Microsoft.AspNetCore.Components.ComponentBase.AssignedRenderMode.get -> Microsoft.AspNetCore.Components.IComponentRenderMode?
4-
Microsoft.AspNetCore.Components.ComponentBase.Platform.get -> Microsoft.AspNetCore.Components.ComponentPlatform!
5-
Microsoft.AspNetCore.Components.ComponentPlatform
6-
Microsoft.AspNetCore.Components.ComponentPlatform.ComponentPlatform(string! platformName, bool isInteractive) -> void
7-
Microsoft.AspNetCore.Components.ComponentPlatform.IsInteractive.get -> bool
8-
Microsoft.AspNetCore.Components.ComponentPlatform.Name.get -> string!
4+
Microsoft.AspNetCore.Components.ComponentBase.RendererInfo.get -> Microsoft.AspNetCore.Components.RendererInfo!
95
Microsoft.AspNetCore.Components.ExcludeFromInteractiveRoutingAttribute
106
Microsoft.AspNetCore.Components.ExcludeFromInteractiveRoutingAttribute.ExcludeFromInteractiveRoutingAttribute() -> void
7+
Microsoft.AspNetCore.Components.RendererInfo
8+
Microsoft.AspNetCore.Components.RendererInfo.IsInteractive.get -> bool
9+
Microsoft.AspNetCore.Components.RendererInfo.Name.get -> string!
10+
Microsoft.AspNetCore.Components.RendererInfo.RendererInfo(string! rendererName, bool isInteractive) -> void
1111
Microsoft.AspNetCore.Components.RenderHandle.Assets.get -> Microsoft.AspNetCore.Components.ResourceAssetCollection!
12-
Microsoft.AspNetCore.Components.RenderHandle.Platform.get -> Microsoft.AspNetCore.Components.ComponentPlatform!
12+
Microsoft.AspNetCore.Components.RenderHandle.RendererInfo.get -> Microsoft.AspNetCore.Components.RendererInfo!
1313
Microsoft.AspNetCore.Components.RenderHandle.RenderMode.get -> Microsoft.AspNetCore.Components.IComponentRenderMode?
1414
Microsoft.AspNetCore.Components.ResourceAsset
1515
Microsoft.AspNetCore.Components.ResourceAsset.Properties.get -> System.Collections.Generic.IReadOnlyList<Microsoft.AspNetCore.Components.ResourceAssetProperty!>?
@@ -25,4 +25,4 @@ Microsoft.AspNetCore.Components.ResourceAssetProperty.ResourceAssetProperty(stri
2525
Microsoft.AspNetCore.Components.ResourceAssetProperty.Value.get -> string!
2626
static readonly Microsoft.AspNetCore.Components.ResourceAssetCollection.Empty -> Microsoft.AspNetCore.Components.ResourceAssetCollection!
2727
virtual Microsoft.AspNetCore.Components.RenderTree.Renderer.Assets.get -> Microsoft.AspNetCore.Components.ResourceAssetCollection!
28-
virtual Microsoft.AspNetCore.Components.RenderTree.Renderer.ComponentPlatform.get -> Microsoft.AspNetCore.Components.ComponentPlatform!
28+
virtual Microsoft.AspNetCore.Components.RenderTree.Renderer.RendererInfo.get -> Microsoft.AspNetCore.Components.RendererInfo!

src/Components/Components/src/RenderHandle.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ public Dispatcher Dispatcher
5252
?? throw new InvalidOperationException("No renderer has been initialized.");
5353

5454
/// <summary>
55-
/// Gets the <see cref="ComponentPlatform"/> the component is running on.
55+
/// Gets the <see cref="Components.RendererInfo"/> the component is running on.
5656
/// </summary>
57-
public ComponentPlatform Platform => _renderer?.ComponentPlatform ?? throw new InvalidOperationException("No renderer has been initialized.");
57+
public RendererInfo RendererInfo => _renderer?.RendererInfo ?? throw new InvalidOperationException("No renderer has been initialized.");
5858

5959
/// <summary>
6060
/// Retrieves the <see cref="IComponentRenderMode"/> assigned to the component.

src/Components/Components/src/RenderTree/ComponentPlatform.cs

Lines changed: 0 additions & 31 deletions
This file was deleted.

src/Components/Components/src/RenderTree/Renderer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,9 @@ protected internal ComponentState GetComponentState(IComponent component)
154154
=> _componentStateByComponent.GetValueOrDefault(component);
155155

156156
/// <summary>
157-
/// Gets the <see cref="ComponentPlatform"/> associated with this <see cref="Renderer"/>.
157+
/// Gets the <see cref="RendererInfo"/> associated with this <see cref="Renderer"/>.
158158
/// </summary>
159-
protected internal virtual ComponentPlatform ComponentPlatform { get; }
159+
protected internal virtual RendererInfo RendererInfo { get; }
160160

161161
/// <summary>
162162
/// Gets the <see cref="ResourceAssetCollection"/> associated with this <see cref="Renderer"/>.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
namespace Microsoft.AspNetCore.Components;
5+
6+
/// <summary>
7+
/// Provides information about the platform that the component is running on.
8+
/// </summary>
9+
/// <param name="rendererName">The name of the platform.</param>
10+
/// <param name="isInteractive">A flag to indicate if the platform is interactive.</param>
11+
public sealed class RendererInfo(string rendererName, bool isInteractive)
12+
{
13+
/// <summary>
14+
/// Gets the name of the platform.
15+
/// </summary>
16+
public string Name { get; } = rendererName;
17+
18+
/// <summary>
19+
/// Gets a flag to indicate if the platform is interactive.
20+
/// </summary>
21+
public bool IsInteractive { get; } = isInteractive;
22+
}

src/Components/Server/src/Circuits/RemoteRenderer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ internal partial class RemoteRenderer : WebRenderer
1818
#pragma warning restore CA1852 // Seal internal types
1919
{
2020
private static readonly Task CanceledTask = Task.FromCanceled(new CancellationToken(canceled: true));
21-
private static readonly ComponentPlatform _componentPlatform = new("Server", isInteractive: true);
21+
private static readonly RendererInfo _componentPlatform = new("Server", isInteractive: true);
2222

2323
private readonly CircuitClientProxy _client;
2424
private readonly CircuitOptions _options;
@@ -62,7 +62,7 @@ public RemoteRenderer(
6262

6363
protected override ResourceAssetCollection Assets => _resourceCollection ?? base.Assets;
6464

65-
protected override ComponentPlatform ComponentPlatform => _componentPlatform;
65+
protected override RendererInfo RendererInfo => _componentPlatform;
6666

6767
protected override IComponentRenderMode? GetComponentRenderMode(IComponent component) => RenderMode.InteractiveServer;
6868

src/Components/Web/src/HtmlRendering/StaticHtmlRenderer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace Microsoft.AspNetCore.Components.HtmlRendering.Infrastructure;
1919
/// </summary>
2020
public partial class StaticHtmlRenderer : Renderer
2121
{
22-
private static readonly ComponentPlatform _componentPlatform = new ComponentPlatform("Static", isInteractive: false);
22+
private static readonly RendererInfo _componentPlatform = new RendererInfo("Static", isInteractive: false);
2323

2424
private static readonly Task CanceledRenderTask = Task.FromCanceled(new CancellationToken(canceled: true));
2525
private readonly NavigationManager? _navigationManager;
@@ -41,7 +41,7 @@ public StaticHtmlRenderer(IServiceProvider serviceProvider, ILoggerFactory logge
4141
public override Dispatcher Dispatcher { get; } = Dispatcher.CreateDefault();
4242

4343
/// <inheritdoc/>
44-
protected internal override ComponentPlatform ComponentPlatform => _componentPlatform;
44+
protected internal override RendererInfo RendererInfo => _componentPlatform;
4545

4646
/// <summary>
4747
/// Adds a root component of the specified type and begins rendering it.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ Microsoft.AspNetCore.Components.Web.Internal.IInternalWebJSInProcessRuntime
33
Microsoft.AspNetCore.Components.Web.Internal.IInternalWebJSInProcessRuntime.InvokeJS(string! identifier, string? argsJson, Microsoft.JSInterop.JSCallResultType resultType, long targetInstanceId) -> string!
44
Microsoft.AspNetCore.Components.Web.KeyboardEventArgs.IsComposing.get -> bool
55
Microsoft.AspNetCore.Components.Web.KeyboardEventArgs.IsComposing.set -> void
6-
override Microsoft.AspNetCore.Components.HtmlRendering.Infrastructure.StaticHtmlRenderer.ComponentPlatform.get -> Microsoft.AspNetCore.Components.ComponentPlatform!
6+
override Microsoft.AspNetCore.Components.HtmlRendering.Infrastructure.StaticHtmlRenderer.RendererInfo.get -> Microsoft.AspNetCore.Components.RendererInfo!

src/Components/WebAssembly/WebAssembly/src/Rendering/WebAssemblyRenderer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ internal sealed partial class WebAssemblyRenderer : WebRenderer
2525
private readonly Dispatcher _dispatcher;
2626
private readonly ResourceAssetCollection _resourceCollection;
2727
private readonly IInternalJSImportMethods _jsMethods;
28-
private static readonly ComponentPlatform _componentPlatform = new("WebAssembly", isInteractive: true);
28+
private static readonly RendererInfo _componentPlatform = new("WebAssembly", isInteractive: true);
2929

3030
public WebAssemblyRenderer(IServiceProvider serviceProvider, ResourceAssetCollection resourceCollection, ILoggerFactory loggerFactory, JSComponentInterop jsComponentInterop)
3131
: base(serviceProvider, loggerFactory, DefaultWebAssemblyJSRuntime.Instance.ReadJsonSerializerOptions(), jsComponentInterop)
@@ -85,7 +85,7 @@ public void NotifyEndUpdateRootComponents(long batchId)
8585

8686
protected override ResourceAssetCollection Assets => _resourceCollection;
8787

88-
protected override ComponentPlatform ComponentPlatform => _componentPlatform;
88+
protected override RendererInfo RendererInfo => _componentPlatform;
8989

9090
public override Dispatcher Dispatcher => _dispatcher;
9191

0 commit comments

Comments
 (0)