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

[Extensions] Add a namespace for extension methods to prevent possible naming clashes #1776

Merged
merged 5 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
@@ -1,5 +1,6 @@
@page "/icon-explorer"
@using FluentUI.Demo.AssetExplorer.Components.Controls
@using Microsoft.FluentUI.AspNetCore.Components.Extensions

<PageTitle>FluentUI Blazor - Icon Explorers</PageTitle>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.Logging;
using Microsoft.FluentUI.AspNetCore.Components;
using Microsoft.FluentUI.AspNetCore.Components.Extensions;

namespace FluentUI.Demo.Shared.Components;

Expand Down
39 changes: 18 additions & 21 deletions examples/Demo/Shared/Microsoft.FluentUI.AspNetCore.Components.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13027,50 +13027,50 @@
Gets the size of the panel 2 (bottom/right) after a resize operation.
</summary>
</member>
<member name="M:Microsoft.FluentUI.AspNetCore.Components.AdditionalAttributesExtensions.RenderedAttributesEqual(System.Collections.Generic.IReadOnlyDictionary{System.String,System.Object},System.Collections.Generic.IReadOnlyDictionary{System.String,System.Object})">
<member name="M:Microsoft.FluentUI.AspNetCore.Components.Extensions.AdditionalAttributesExtensions.RenderedAttributesEqual(System.Collections.Generic.IReadOnlyDictionary{System.String,System.Object},System.Collections.Generic.IReadOnlyDictionary{System.String,System.Object})">
<summary> Determines whether two sets of attributes are equal when rendered. </summary>
<param name="x">The compared set</param>
<param name="y">The set to compare with</param>
<remarks></remarks>
<returns><c>true</c> if both sets render the same attributes; otherwise, <c>false</c>.</returns>
</member>
<member name="T:Microsoft.FluentUI.AspNetCore.Components.DateTimeExtensions">
<member name="T:Microsoft.FluentUI.AspNetCore.Components.Extensions.DateTimeExtensions">
<summary>
Extension methods for <see cref="T:System.DateTime"/>.
</summary>
</member>
<member name="M:Microsoft.FluentUI.AspNetCore.Components.DateTimeExtensions.ToIsoDateString(System.Nullable{System.DateTime})">
<member name="M:Microsoft.FluentUI.AspNetCore.Components.Extensions.DateTimeExtensions.ToIsoDateString(System.Nullable{System.DateTime})">
<summary>
Returns a string in the ISO format yyyy-MM-dd.
</summary>
<param name="self"></param>
<returns></returns>
</member>
<member name="M:Microsoft.FluentUI.AspNetCore.Components.DateTimeExtensions.StartOfMonth(System.DateTime,System.Globalization.CultureInfo)">
<member name="M:Microsoft.FluentUI.AspNetCore.Components.Extensions.DateTimeExtensions.StartOfMonth(System.DateTime,System.Globalization.CultureInfo)">
<summary>
Returns the first day of the month.
</summary>
<param name="self"></param>
<param name="culture"></param>
<returns></returns>
</member>
<member name="M:Microsoft.FluentUI.AspNetCore.Components.DateTimeExtensions.EndOfMonth(System.DateTime,System.Globalization.CultureInfo)">
<member name="M:Microsoft.FluentUI.AspNetCore.Components.Extensions.DateTimeExtensions.EndOfMonth(System.DateTime,System.Globalization.CultureInfo)">
<summary>
Returns the last day of the month.
</summary>
<param name="self"></param>
<param name="culture"></param>
<returns></returns>
</member>
<member name="M:Microsoft.FluentUI.AspNetCore.Components.DateTimeExtensions.StartOfWeek(System.DateTime,System.DayOfWeek)">
<member name="M:Microsoft.FluentUI.AspNetCore.Components.Extensions.DateTimeExtensions.StartOfWeek(System.DateTime,System.DayOfWeek)">
<summary>
Returns the first day of the week.
</summary>
<param name="self"></param>
<param name="firstDayOfWeek"></param>
<returns></returns>
</member>
<member name="M:Microsoft.FluentUI.AspNetCore.Components.DateTimeExtensions.ToTimeAgo(System.TimeSpan,Microsoft.FluentUI.AspNetCore.Components.TimeAgoOptions)">
<member name="M:Microsoft.FluentUI.AspNetCore.Components.Extensions.DateTimeExtensions.ToTimeAgo(System.TimeSpan,Microsoft.FluentUI.AspNetCore.Components.TimeAgoOptions)">
<summary>
Get a string showing how long ago a DateTime was, for example '4 minutes ago'.
</summary>
Expand All @@ -13079,82 +13079,82 @@
<returns></returns>
<remarks>Inspired from https://github.com/NickStrupat/TimeAgo.</remarks>
</member>
<member name="M:Microsoft.FluentUI.AspNetCore.Components.DateTimeExtensions.ToDateTime(System.DateOnly)">
<member name="M:Microsoft.FluentUI.AspNetCore.Components.Extensions.DateTimeExtensions.ToDateTime(System.DateOnly)">
<summary>
Converts the DateOnly to an equivalent DateTime.
</summary>
<param name="value"></param>
<returns></returns>
</member>
<member name="M:Microsoft.FluentUI.AspNetCore.Components.DateTimeExtensions.ToDateTime(System.TimeOnly)">
<member name="M:Microsoft.FluentUI.AspNetCore.Components.Extensions.DateTimeExtensions.ToDateTime(System.TimeOnly)">
<summary>
Converts the TimeOnly to an equivalent DateTime.
</summary>
<param name="value"></param>
<returns></returns>
</member>
<member name="M:Microsoft.FluentUI.AspNetCore.Components.DateTimeExtensions.ToDateTime(System.Nullable{System.DateOnly})">
<member name="M:Microsoft.FluentUI.AspNetCore.Components.Extensions.DateTimeExtensions.ToDateTime(System.Nullable{System.DateOnly})">
<summary>
Converts the nullable DateOnly to an equivalent DateTime.
Returns <see cref="P:System.DateOnly.MinValue"/> if the <paramref name="value"/> is null.
</summary>
<param name="value"></param>
<returns></returns>
</member>
<member name="M:Microsoft.FluentUI.AspNetCore.Components.DateTimeExtensions.ToDateTime(System.Nullable{System.TimeOnly})">
<member name="M:Microsoft.FluentUI.AspNetCore.Components.Extensions.DateTimeExtensions.ToDateTime(System.Nullable{System.TimeOnly})">
<summary>
Converts the nullable TimeOnly to an equivalent DateTime.
Returns <see cref="F:System.DateTime.MinValue"/> if the <paramref name="value"/> is null.
</summary>
<param name="value"></param>
<returns></returns>
</member>
<member name="M:Microsoft.FluentUI.AspNetCore.Components.DateTimeExtensions.ToDateTimeNullable(System.Nullable{System.DateOnly})">
<member name="M:Microsoft.FluentUI.AspNetCore.Components.Extensions.DateTimeExtensions.ToDateTimeNullable(System.Nullable{System.DateOnly})">
<summary>
Converts the nullable DateOnly to an equivalent DateTime.
</summary>
<param name="value"></param>
<returns></returns>
</member>
<member name="M:Microsoft.FluentUI.AspNetCore.Components.DateTimeExtensions.ToDateTimeNullable(System.Nullable{System.TimeOnly})">
<member name="M:Microsoft.FluentUI.AspNetCore.Components.Extensions.DateTimeExtensions.ToDateTimeNullable(System.Nullable{System.TimeOnly})">
<summary>
Converts the nullable TimeOnly to an equivalent DateTime.
</summary>
<param name="value"></param>
<returns></returns>
</member>
<member name="M:Microsoft.FluentUI.AspNetCore.Components.DateTimeExtensions.ToDateTime(System.Nullable{System.DateTime})">
<member name="M:Microsoft.FluentUI.AspNetCore.Components.Extensions.DateTimeExtensions.ToDateTime(System.Nullable{System.DateTime})">
<summary>
Converts the nullable DateTime to an equivalent DateTime.
Returns <see cref="P:System.DateOnly.MinValue"/> if the <paramref name="value"/> is null.
</summary>
<param name="value"></param>
<returns></returns>
</member>
<member name="M:Microsoft.FluentUI.AspNetCore.Components.DateTimeExtensions.ToDateOnly(System.Nullable{System.DateTime})">
<member name="M:Microsoft.FluentUI.AspNetCore.Components.Extensions.DateTimeExtensions.ToDateOnly(System.Nullable{System.DateTime})">
<summary>
Converts the nullable DateTime to an equivalent DateOnly, removing the time part.
Returns <see cref="P:System.DateOnly.MinValue"/> if the <paramref name="value"/> is null.
</summary>
<param name="value"></param>
<returns></returns>
</member>
<member name="M:Microsoft.FluentUI.AspNetCore.Components.DateTimeExtensions.ToTimeOnly(System.Nullable{System.DateTime})">
<member name="M:Microsoft.FluentUI.AspNetCore.Components.Extensions.DateTimeExtensions.ToTimeOnly(System.Nullable{System.DateTime})">
<summary>
Converts the nullable DateTime to an equivalent TimeOnly, removing the time part.
Returns <see cref="P:System.TimeOnly.MinValue"/> if the <paramref name="value"/> is null.
</summary>
<param name="value"></param>
<returns></returns>
</member>
<member name="M:Microsoft.FluentUI.AspNetCore.Components.DateTimeExtensions.ToDateOnlyNullable(System.Nullable{System.DateTime})">
<member name="M:Microsoft.FluentUI.AspNetCore.Components.Extensions.DateTimeExtensions.ToDateOnlyNullable(System.Nullable{System.DateTime})">
<summary>
Converts the nullable DateTime to an equivalent DateOnly?, removing the time part.
</summary>
<param name="value"></param>
<returns></returns>
</member>
<member name="M:Microsoft.FluentUI.AspNetCore.Components.DateTimeExtensions.ToTimeOnlyNullable(System.Nullable{System.DateTime})">
<member name="M:Microsoft.FluentUI.AspNetCore.Components.Extensions.DateTimeExtensions.ToTimeOnlyNullable(System.Nullable{System.DateTime})">
<summary>
Converts the nullable DateTime to an equivalent TimeOnly?, removing the time part.
</summary>
Expand All @@ -13175,9 +13175,6 @@
<param name="services">Service collection</param>
<param name="configuration">Library configuration</param>
</member>
<member name="M:Microsoft.FluentUI.AspNetCore.Components.StringExtensions.ToPercentage(System.Decimal)">
<summary />
</member>
<member name="T:Microsoft.FluentUI.AspNetCore.Components.GlobalState">
<summary>
This class is used to store the global design values of the Fluent UI components.
Expand Down
3 changes: 2 additions & 1 deletion examples/Demo/Shared/_Imports.razor
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
@using Microsoft.Extensions.Logging;

@using Microsoft.FluentUI.AspNetCore.Components
@using Microsoft.FluentUI.AspNetCore.Components.Extensions
@using Microsoft.FluentUI.AspNetCore.Components.DesignTokens

@using Microsoft.JSInterop
@using Microsoft.JSInterop
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Globalization;
using Microsoft.AspNetCore.Components;
using Microsoft.FluentUI.AspNetCore.Components.Extensions;
using Microsoft.FluentUI.AspNetCore.Components.Utilities;

namespace Microsoft.FluentUI.AspNetCore.Components;
Expand Down
1 change: 1 addition & 0 deletions src/Core/Components/DateTime/CalendarExtended.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Globalization;
using Microsoft.FluentUI.AspNetCore.Components.Extensions;

namespace Microsoft.FluentUI.AspNetCore.Components;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Globalization;
using System.Text.Json;
using Microsoft.AspNetCore.Components;
using Microsoft.FluentUI.AspNetCore.Components.Extensions;
using Microsoft.JSInterop;

namespace Microsoft.FluentUI.AspNetCore.Components;
Expand Down
1 change: 1 addition & 0 deletions src/Core/Components/Grid/FluentGridItem.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// --------------------------------------------------------------

using Microsoft.AspNetCore.Components;
using Microsoft.FluentUI.AspNetCore.Components.Extensions;
using Microsoft.FluentUI.AspNetCore.Components.Utilities;

namespace Microsoft.FluentUI.AspNetCore.Components;
Expand Down
1 change: 1 addition & 0 deletions src/Core/Components/Icons/FluentIcon.razor.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.FluentUI.AspNetCore.Components.Extensions;
using Microsoft.FluentUI.AspNetCore.Components.Utilities;

namespace Microsoft.FluentUI.AspNetCore.Components;
Expand Down
1 change: 1 addition & 0 deletions src/Core/Components/Icons/Icon.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Components;
using Microsoft.FluentUI.AspNetCore.Components.Extensions;
using Microsoft.FluentUI.AspNetCore.Components.Utilities;

namespace Microsoft.FluentUI.AspNetCore.Components;
Expand Down
1 change: 1 addition & 0 deletions src/Core/Components/Label/FluentLabel.razor.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Components;
using Microsoft.FluentUI.AspNetCore.Components.Extensions;
using Microsoft.FluentUI.AspNetCore.Components.Utilities;

namespace Microsoft.FluentUI.AspNetCore.Components;
Expand Down
1 change: 1 addition & 0 deletions src/Core/Components/Menu/FluentMenuItem.razor.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Components;
using Microsoft.FluentUI.AspNetCore.Components.Extensions;

namespace Microsoft.FluentUI.AspNetCore.Components;

Expand Down
1 change: 1 addition & 0 deletions src/Core/Components/Radio/FluentRadioGroup.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
//using System.Globalization;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Forms;
using Microsoft.FluentUI.AspNetCore.Components.Extensions;

namespace Microsoft.FluentUI.AspNetCore.Components;

Expand Down
1 change: 1 addition & 0 deletions src/Core/Components/Slider/FluentSlider.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Globalization;

using Microsoft.AspNetCore.Components;
using Microsoft.FluentUI.AspNetCore.Components.Extensions;
using Microsoft.FluentUI.AspNetCore.Components.Utilities;

namespace Microsoft.FluentUI.AspNetCore.Components;
Expand Down
1 change: 1 addition & 0 deletions src/Core/Components/TextField/FluentTextField.razor.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Diagnostics.CodeAnalysis;
using Microsoft.AspNetCore.Components;
using Microsoft.FluentUI.AspNetCore.Components.Extensions;
using Microsoft.JSInterop;

namespace Microsoft.FluentUI.AspNetCore.Components;
Expand Down
4 changes: 2 additions & 2 deletions src/Core/Extensions/AdditionalAttributesExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Microsoft.FluentUI.AspNetCore.Components;
namespace Microsoft.FluentUI.AspNetCore.Components.Extensions;

public static class AdditionalAttributesExtensions
internal static class AdditionalAttributesExtensions
{
/// <summary> Determines whether two sets of attributes are equal when rendered. </summary>
/// <param name="x">The compared set</param>
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Extensions/BooleanExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Microsoft.FluentUI.AspNetCore.Components;
namespace Microsoft.FluentUI.AspNetCore.Components.Extensions;

internal static class BooleanExtensions
{
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Extensions/DateTimeExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Globalization;

namespace Microsoft.FluentUI.AspNetCore.Components;
namespace Microsoft.FluentUI.AspNetCore.Components.Extensions;

/// <summary>
/// Extension methods for <see cref="DateTime"/>.
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Extensions/EnumExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.ComponentModel;
using System.Reflection;

namespace Microsoft.FluentUI.AspNetCore.Components;
namespace Microsoft.FluentUI.AspNetCore.Components.Extensions;

public static class EnumExtensions
{
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Extensions/FluentInputExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Globalization;
using Microsoft.AspNetCore.Components;

namespace Microsoft.FluentUI.AspNetCore.Components;
namespace Microsoft.FluentUI.AspNetCore.Components.Extensions;

internal static class FluentInputExtensions
{
Expand Down
1 change: 1 addition & 0 deletions src/Core/Extensions/ServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Microsoft.FluentUI.AspNetCore.Components.Components.Tooltip;
using Microsoft.FluentUI.AspNetCore.Components.DesignTokens;

// This namespace is deliberately "Components" and not "Components.Extensions".
namespace Microsoft.FluentUI.AspNetCore.Components;

public static class ServiceCollectionExtensions
Expand Down
10 changes: 0 additions & 10 deletions src/Core/Extensions/StringExtensions.cs

This file was deleted.

3 changes: 2 additions & 1 deletion src/Core/_Imports.razor
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
@using Microsoft.AspNetCore.Components.Web.Virtualization
@using Microsoft.JSInterop
@using Microsoft.FluentUI.AspNetCore.Components
@using Microsoft.FluentUI.AspNetCore.Components.Infrastructure
@using Microsoft.FluentUI.AspNetCore.Components.Infrastructure
@using Microsoft.FluentUI.AspNetCore.Components.Extensions
1 change: 1 addition & 0 deletions tests/Core/DateTime/FluentCalendarTests.razor
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@using System.Globalization
@using Microsoft.FluentUI.AspNetCore.Components.Extensions
@using Xunit
@inherits TestContext

Expand Down
1 change: 1 addition & 0 deletions tests/Core/DateTime/ToDateTimeExtensionsTests.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Microsoft.FluentUI.AspNetCore.Components.Extensions;
using Xunit;

namespace Microsoft.FluentUI.AspNetCore.Components.Tests.DateTime;
Expand Down
1 change: 1 addition & 0 deletions tests/Core/DateTime/ToTimeAgoTests.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Microsoft.FluentUI.AspNetCore.Components.Extensions;
using Xunit;

namespace Microsoft.FluentUI.AspNetCore.Components.Tests.DateTime;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections;
using Microsoft.FluentUI.AspNetCore.Components.Extensions;
using Xunit;

namespace Microsoft.FluentUI.AspNetCore.Components.Tests.Extensions;
Expand Down
Loading