diff --git a/components/Animations/src/ArgumentNullExceptionExtensions.cs b/components/Animations/src/ArgumentNullExceptionExtensions.cs new file mode 100644 index 00000000..545654bf --- /dev/null +++ b/components/Animations/src/ArgumentNullExceptionExtensions.cs @@ -0,0 +1,65 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Diagnostics.CodeAnalysis; +using System.Runtime.CompilerServices; + +namespace System; + +/// +/// Throw helper extensions for . +/// +internal static class ArgumentNullExceptionExtensions +{ + /// + /// Throws an for a given parameter name. + /// + /// Dummy value to invoke the extension upon (always pass . + /// The name of the parameter to report in the exception. + /// Thrown with . + [DoesNotReturn] + public static void Throw(this ArgumentNullException? _, string? parameterName) + { + throw new ArgumentNullException(parameterName); + } + + /// + /// Throws an if is . + /// + /// Dummy value to invoke the extension upon (always pass . + /// The reference type argument to validate as non-. + /// The name of the parameter with which corresponds. + /// Thrown if is . + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void ThrowIfNull(this ArgumentNullException? _, [NotNull] object? argument, [CallerArgumentExpression(nameof(argument))] string? parameterName = null) + { + if (argument is null) + { + Throw(parameterName); + } + } + + /// + /// Throws an if is . + /// + /// Dummy value to invoke the extension upon (always pass . + /// The pointer argument to validate as non-. + /// The name of the parameter with which corresponds. + /// Thrown if is . + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void ThrowIfNull(this ArgumentNullException? _, [NotNull] void* argument, [CallerArgumentExpression(nameof(argument))] string? parameterName = null) + { + if (argument is null) + { + Throw(parameterName); + } + } + + /// + [DoesNotReturn] + private static void Throw(string? parameterName) + { + throw new ArgumentNullException(parameterName); + } +} diff --git a/components/Animations/src/Builders/Interfaces/IKeyFrameInfo.cs b/components/Animations/src/Builders/Interfaces/IKeyFrameInfo.cs index 4ef174a5..1c09c864 100644 --- a/components/Animations/src/Builders/Interfaces/IKeyFrameInfo.cs +++ b/components/Animations/src/Builders/Interfaces/IKeyFrameInfo.cs @@ -14,7 +14,7 @@ namespace CommunityToolkit.WinUI.Animations; /// /// An interface representing a generic model containing info for an abstract keyframe. /// -internal interface IKeyFrameInfo +public interface IKeyFrameInfo { /// /// Gets the easing type to use to reach the new keyframe. diff --git a/components/Animations/src/Builders/NormalizedKeyFrameAnimationBuilder{T}.Composition.cs b/components/Animations/src/Builders/NormalizedKeyFrameAnimationBuilder{T}.Composition.cs index 5fc551d7..0ba50437 100644 --- a/components/Animations/src/Builders/NormalizedKeyFrameAnimationBuilder{T}.Composition.cs +++ b/components/Animations/src/Builders/NormalizedKeyFrameAnimationBuilder{T}.Composition.cs @@ -14,7 +14,7 @@ namespace CommunityToolkit.WinUI.Animations; /// -internal abstract partial class NormalizedKeyFrameAnimationBuilder +public abstract partial class NormalizedKeyFrameAnimationBuilder { /// /// Gets a instance representing the animation to start. diff --git a/components/Animations/src/Builders/NormalizedKeyFrameAnimationBuilder{T}.Xaml.cs b/components/Animations/src/Builders/NormalizedKeyFrameAnimationBuilder{T}.Xaml.cs index f024ce1e..8cc6e1dd 100644 --- a/components/Animations/src/Builders/NormalizedKeyFrameAnimationBuilder{T}.Xaml.cs +++ b/components/Animations/src/Builders/NormalizedKeyFrameAnimationBuilder{T}.Xaml.cs @@ -5,7 +5,7 @@ namespace CommunityToolkit.WinUI.Animations; /// -internal abstract partial class NormalizedKeyFrameAnimationBuilder +public abstract partial class NormalizedKeyFrameAnimationBuilder where T : unmanaged { /// diff --git a/components/Animations/src/Builders/NormalizedKeyFrameAnimationBuilder{T}.cs b/components/Animations/src/Builders/NormalizedKeyFrameAnimationBuilder{T}.cs index 3ffc4b90..368998a2 100644 --- a/components/Animations/src/Builders/NormalizedKeyFrameAnimationBuilder{T}.cs +++ b/components/Animations/src/Builders/NormalizedKeyFrameAnimationBuilder{T}.cs @@ -17,7 +17,7 @@ namespace CommunityToolkit.WinUI.Animations; /// A generic keyframe animation builder. /// /// The type of values being set by the animation being constructed. -internal abstract partial class NormalizedKeyFrameAnimationBuilder : INormalizedKeyFrameAnimationBuilder +public abstract partial class NormalizedKeyFrameAnimationBuilder : INormalizedKeyFrameAnimationBuilder where T : unmanaged { /// diff --git a/components/Animations/src/CommunityToolkit.WinUI.Animations.csproj b/components/Animations/src/CommunityToolkit.WinUI.Animations.csproj index 48b2672b..bdeab471 100644 --- a/components/Animations/src/CommunityToolkit.WinUI.Animations.csproj +++ b/components/Animations/src/CommunityToolkit.WinUI.Animations.csproj @@ -12,9 +12,6 @@ - - - all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/components/Animations/src/Extensions/System/GuidExtensions.cs b/components/Animations/src/Extensions/System/GuidExtensions.cs index c0cfe2b1..bed74f90 100644 --- a/components/Animations/src/Extensions/System/GuidExtensions.cs +++ b/components/Animations/src/Extensions/System/GuidExtensions.cs @@ -9,7 +9,7 @@ namespace CommunityToolkit.WinUI.Animations; /// /// An extension for the type /// -internal static class GuidExtensions +public static class GuidExtensions { /// /// Returns a representation of a only made of uppercase letters diff --git a/components/Animations/src/Xaml/AnimationSet.cs b/components/Animations/src/Xaml/AnimationSet.cs index 1c717ca2..c1adb84b 100644 --- a/components/Animations/src/Xaml/AnimationSet.cs +++ b/components/Animations/src/Xaml/AnimationSet.cs @@ -57,7 +57,7 @@ public sealed class AnimationSet : DependencyObjectCollection /// /// Gets or sets the weak reference to the parent that owns the current animation collection. /// - internal WeakReference? ParentReference { get; set; } + public WeakReference? ParentReference { get; set; } /// /// Thrown when there is no attached instance. diff --git a/components/Extensions/src/CommunityToolkit.WinUI.Extensions.csproj b/components/Extensions/src/CommunityToolkit.WinUI.Extensions.csproj index 84092b31..c9a3113a 100644 --- a/components/Extensions/src/CommunityToolkit.WinUI.Extensions.csproj +++ b/components/Extensions/src/CommunityToolkit.WinUI.Extensions.csproj @@ -28,10 +28,5 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - diff --git a/components/Extensions/src/Shadows/AttachedDropShadow.cs b/components/Extensions/src/Shadows/AttachedDropShadow.cs index 23417431..4fadc421 100644 --- a/components/Extensions/src/Shadows/AttachedDropShadow.cs +++ b/components/Extensions/src/Shadows/AttachedDropShadow.cs @@ -31,7 +31,7 @@ public sealed class AttachedDropShadow : AttachedShadowBase #endif /// - protected internal override bool SupportsOnSizeChangedEvent => true; + public override bool SupportsOnSizeChangedEvent => true; private static readonly TypedResourceKey RoundedRectangleGeometryResourceKey = "RoundedGeometry"; private static readonly TypedResourceKey ShapeResourceKey = "Shape"; @@ -350,7 +350,7 @@ private void CustomMaskedElement_Loaded(object sender, RoutedEventArgs e) } /// - protected internal override void OnSizeChanged(AttachedShadowElementContext context, Size newSize, Size previousSize) + public override void OnSizeChanged(AttachedShadowElementContext context, Size newSize, Size previousSize) { if (context.SpriteVisual != null) { diff --git a/components/Extensions/src/Shadows/AttachedShadowBase.cs b/components/Extensions/src/Shadows/AttachedShadowBase.cs index 90145fe1..bbe1f4ef 100644 --- a/components/Extensions/src/Shadows/AttachedShadowBase.cs +++ b/components/Extensions/src/Shadows/AttachedShadowBase.cs @@ -101,7 +101,7 @@ public Color Color /// /// Gets a value indicating whether or not OnSizeChanged should be called when is fired. /// - protected internal abstract bool SupportsOnSizeChangedEvent { get; } + public abstract bool SupportsOnSizeChangedEvent { get; } /// /// Use this method as the for DependencyProperties in derived classes. @@ -142,7 +142,7 @@ internal void DisconnectElement(FrameworkElement element) /// Override to handle when the for an element is being initialized. /// /// The that is being initialized. - protected internal virtual void OnElementContextInitialized(AttachedShadowElementContext context) + public virtual void OnElementContextInitialized(AttachedShadowElementContext context) { OnPropertyChanged(context, OpacityProperty, Opacity, Opacity); OnPropertyChanged(context, BlurRadiusProperty, BlurRadius, BlurRadius); @@ -288,7 +288,7 @@ protected virtual void OnPropertyChanged(AttachedShadowElementContext context, D /// The for the firing its SizeChanged event /// The new size of the /// The previous size of the - protected internal virtual void OnSizeChanged(AttachedShadowElementContext context, Size newSize, Size previousSize) + public virtual void OnSizeChanged(AttachedShadowElementContext context, Size newSize, Size previousSize) { } } diff --git a/components/Extensions/src/Shadows/AttachedShadowElementContext.cs b/components/Extensions/src/Shadows/AttachedShadowElementContext.cs index 4c23b241..21a92775 100644 --- a/components/Extensions/src/Shadows/AttachedShadowElementContext.cs +++ b/components/Extensions/src/Shadows/AttachedShadowElementContext.cs @@ -278,7 +278,7 @@ public bool TryGetResource(string key, out T? resource) /// /// The type of the resource being added. /// The resource that was added - internal T AddResource(TypedResourceKey key, T resource) + public T AddResource(TypedResourceKey key, T resource) where T : notnull => AddResource(key.Key, resource); /// @@ -286,28 +286,28 @@ internal T AddResource(TypedResourceKey key, T resource) /// /// The type of the resource being retrieved. /// True if the resource exists, false otherwise - internal bool TryGetResource(TypedResourceKey key, out T? resource) => TryGetResource(key.Key, out resource); + public bool TryGetResource(TypedResourceKey key, out T? resource) => TryGetResource(key.Key, out resource); /// /// Retries a resource with the specified key and type /// /// The type of the resource being retrieved. /// The resource if it exists or a default value. - internal T? GetResource(TypedResourceKey key) => GetResource(key.Key); + public T? GetResource(TypedResourceKey key) => GetResource(key.Key); /// /// Removes an existing resource with the specified key and type /// /// The type of the resource being removed. /// The resource that was removed, if any - internal T? RemoveResource(TypedResourceKey key) => RemoveResource(key.Key); + public T? RemoveResource(TypedResourceKey key) => RemoveResource(key.Key); /// /// Removes an existing resource with the specified key and type, and disposes it /// /// The type of the resource being removed. /// The resource that was removed, if any - internal T? RemoveAndDisposeResource(TypedResourceKey key) + public T? RemoveAndDisposeResource(TypedResourceKey key) where T : IDisposable => RemoveAndDisposeResource(key.Key); /// diff --git a/components/Extensions/src/Shadows/TypedResourceKey.cs b/components/Extensions/src/Shadows/TypedResourceKey.cs index d487c9c3..a99f1b5a 100644 --- a/components/Extensions/src/Shadows/TypedResourceKey.cs +++ b/components/Extensions/src/Shadows/TypedResourceKey.cs @@ -8,7 +8,7 @@ namespace CommunityToolkit.WinUI; /// A generic class that can be used to retrieve keyed resources of the specified type. /// /// The of resource the will retrieve. -internal sealed class TypedResourceKey +public sealed class TypedResourceKey { /// /// Initializes a new instance of the class with the specified key. diff --git a/components/Media/src/ArgumentNullExceptionExtensions.cs b/components/Media/src/ArgumentNullExceptionExtensions.cs new file mode 100644 index 00000000..545654bf --- /dev/null +++ b/components/Media/src/ArgumentNullExceptionExtensions.cs @@ -0,0 +1,65 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Diagnostics.CodeAnalysis; +using System.Runtime.CompilerServices; + +namespace System; + +/// +/// Throw helper extensions for . +/// +internal static class ArgumentNullExceptionExtensions +{ + /// + /// Throws an for a given parameter name. + /// + /// Dummy value to invoke the extension upon (always pass . + /// The name of the parameter to report in the exception. + /// Thrown with . + [DoesNotReturn] + public static void Throw(this ArgumentNullException? _, string? parameterName) + { + throw new ArgumentNullException(parameterName); + } + + /// + /// Throws an if is . + /// + /// Dummy value to invoke the extension upon (always pass . + /// The reference type argument to validate as non-. + /// The name of the parameter with which corresponds. + /// Thrown if is . + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void ThrowIfNull(this ArgumentNullException? _, [NotNull] object? argument, [CallerArgumentExpression(nameof(argument))] string? parameterName = null) + { + if (argument is null) + { + Throw(parameterName); + } + } + + /// + /// Throws an if is . + /// + /// Dummy value to invoke the extension upon (always pass . + /// The pointer argument to validate as non-. + /// The name of the parameter with which corresponds. + /// Thrown if is . + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void ThrowIfNull(this ArgumentNullException? _, [NotNull] void* argument, [CallerArgumentExpression(nameof(argument))] string? parameterName = null) + { + if (argument is null) + { + Throw(parameterName); + } + } + + /// + [DoesNotReturn] + private static void Throw(string? parameterName) + { + throw new ArgumentNullException(parameterName); + } +} diff --git a/components/Media/src/CommunityToolkit.WinUI.Media.csproj b/components/Media/src/CommunityToolkit.WinUI.Media.csproj index 21ff99fd..288866db 100644 --- a/components/Media/src/CommunityToolkit.WinUI.Media.csproj +++ b/components/Media/src/CommunityToolkit.WinUI.Media.csproj @@ -7,6 +7,7 @@ CommunityToolkit.WinUI.MediaRns + true ReadMe.md diff --git a/components/Media/src/Shadows/AttachedCardShadow.cs b/components/Media/src/Shadows/AttachedCardShadow.cs index 223ce515..da8956f5 100644 --- a/components/Media/src/Shadows/AttachedCardShadow.cs +++ b/components/Media/src/Shadows/AttachedCardShadow.cs @@ -88,10 +88,10 @@ public InnerContentClipMode InnerContentClipMode #endif /// - protected internal override bool SupportsOnSizeChangedEvent => true; + public override bool SupportsOnSizeChangedEvent => true; /// - protected internal override void OnElementContextInitialized(AttachedShadowElementContext context) + public override void OnElementContextInitialized(AttachedShadowElementContext context) { UpdateVisualOpacityMask(context); base.OnElementContextInitialized(context); @@ -330,7 +330,7 @@ protected override void SetElementChildVisual(AttachedShadowElementContext conte } /// - protected internal override void OnSizeChanged(AttachedShadowElementContext context, Size newSize, Size previousSize) + public override void OnSizeChanged(AttachedShadowElementContext context, Size newSize, Size previousSize) { Vector2 sizeAsVec2 = newSize.ToVector2(); diff --git a/tooling b/tooling index e366657a..72887567 160000 --- a/tooling +++ b/tooling @@ -1 +1 @@ -Subproject commit e366657a924a745c6fb4162dc4c58d2e07fc0613 +Subproject commit 728875676176f6957104e2c81bbfe9267a297348