Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RequiresPreviewFeatures to non-stable API #107

Merged
merged 2 commits into from
Feb 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>
<EnablePreviewFeatures>true</EnablePreviewFeatures>

<!-- Display name -->
<ApplicationTitle>ThirdPartyControlsSample</ApplicationTitle>
Expand Down
4 changes: 4 additions & 0 deletions src/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[*.cs]

# CA2252: This API requires opting into preview features
dotnet_diagnostic.CA2252.severity = none
4 changes: 2 additions & 2 deletions src/BlazorBindings.Maui/AttachedPropertyRegistry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
using Microsoft.Maui.Controls;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.Versioning;

namespace BlazorBindings.Maui
{
/// <remarks>Experimental API, subject to change.</remarks>
[EditorBrowsable(EditorBrowsableState.Never)]
[RequiresPreviewFeatures]
public static class AttachedPropertyRegistry
{
internal static readonly Dictionary<string, Action<BindableObject, object>> AttachedPropertyHandlers = new();
Expand Down
4 changes: 2 additions & 2 deletions src/BlazorBindings.Maui/Elements/AttributeHelper.Common.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;

namespace BlazorBindings.Maui.Elements
{
[EditorBrowsable(EditorBrowsableState.Never)]
[RequiresPreviewFeatures]
public static partial class AttributeHelper
{
public static bool GetBool(object value, bool defaultValueIfNull = default)
Expand Down
4 changes: 2 additions & 2 deletions src/BlazorBindings.Maui/Elements/BindableObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Rendering;
using System;
using System.ComponentModel;
using System.Runtime.Versioning;
using System.Threading.Tasks;
using MC = Microsoft.Maui.Controls;

Expand Down Expand Up @@ -51,7 +51,7 @@ protected override void RenderAdditionalElementContent(RenderTreeBuilder builder
RenderAdditionalPartialElementContent(builder, ref sequence);
}

[EditorBrowsable(EditorBrowsableState.Never)]
[RequiresPreviewFeatures]
protected virtual void RenderAdditionalPartialElementContent(RenderTreeBuilder builder, ref int sequence) { }

protected virtual bool HandleAdditionalParameter(string name, object value) => false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
// Licensed under the MIT license.

using BlazorBindings.Core;
using System.ComponentModel;
using System.Runtime.Versioning;
using MC = Microsoft.Maui.Controls;

namespace BlazorBindings.Maui.Elements.Handlers
{
/// <remarks>Experimental API, subject to change.</remarks>
[EditorBrowsable(EditorBrowsableState.Never)]
[RequiresPreviewFeatures]
public abstract class BaseAttachedPropertiesHandler : IMauiElementHandler, INonPhysicalChild
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using BlazorBindings.Core;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.Versioning;
using System.Threading.Tasks;
using MC = Microsoft.Maui.Controls;

Expand All @@ -15,7 +15,7 @@ namespace BlazorBindings.Maui.Elements.Handlers
/// from a Blazor component.
/// </summary>
/// <remarks>Experimental API, subject to change.</remarks>
[EditorBrowsable(EditorBrowsableState.Never)]
[RequiresPreviewFeatures]
public class RootContainerHandler : IMauiContainerElementHandler, INonChildContainerElement
{
private TaskCompletionSource<MC.BindableObject> _taskCompletionSource;
Expand Down
13 changes: 2 additions & 11 deletions src/BlazorBindings.Maui/Navigation/Navigation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Microsoft.Maui.Controls;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.Versioning;
using System.Threading.Tasks;
using IComponent = Microsoft.AspNetCore.Components.IComponent;
using MC = Microsoft.Maui.Controls;
Expand Down Expand Up @@ -82,18 +82,9 @@ public async Task PopToRootAsync(bool animated = true)
/// This method is exposed for extensibility purposes, and shouldn't be used directly.
/// </summary>
/// <remarks>Experimental API, subject to change.</remarks>
[EditorBrowsable(EditorBrowsableState.Never)]
[RequiresPreviewFeatures]
public async Task<T> BuildElement<T>(Type componentType, Dictionary<string, object> arguments) where T : Element
{
if (_wrapperComponentType != null)
{
arguments = new()
{
["ChildContent"] = RenderFragments.FromComponentType(componentType, arguments)
};
componentType = _wrapperComponentType;
}

var renderer = _services.GetRequiredService<MauiBlazorBindingsRenderer>();

var (bindableObject, componentTask) = await renderer.GetElementFromRenderedComponent(componentType, arguments);
Expand Down
4 changes: 2 additions & 2 deletions src/BlazorBindings.Maui/RenderTreeBuilderHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
using Microsoft.AspNetCore.Components.Rendering;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.Versioning;
using MC = Microsoft.Maui.Controls;

namespace BlazorBindings.Maui
{
/// <remarks>Experimental API, subject to change.</remarks>
[EditorBrowsable(EditorBrowsableState.Never)]
[RequiresPreviewFeatures]
public static class RenderTreeBuilderHelper
{
public static void AddContentProperty<TControl>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<TargetFramework>net7.0</TargetFramework>
<IsPackable>false</IsPackable>
<UseMaui>true</UseMaui>
<EnablePreviewFeatures>true</EnablePreviewFeatures>
</PropertyGroup>

<ItemGroup>
Expand Down