Skip to content

Remove InternalsVisibleTo for Toolkit #28994

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

Merged
merged 4 commits into from
Apr 25, 2025
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
25 changes: 17 additions & 8 deletions src/Controls/src/Core/ICornerElement.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
#nullable disable
namespace Microsoft.Maui.Controls
namespace Microsoft.Maui.Controls;

/// <summary>
/// Defines properties for elements that can have rounded corners.
/// </summary>
/// <remarks>
/// This interface is implemented by UI elements that support corner radius customization,
/// allowing for consistent styling of corners across different controls.
/// </remarks>
public interface ICornerElement
{
interface ICornerElement
{
//note to implementor: implement this property publicly
CornerRadius CornerRadius { get; }
}
}
/// <summary>
/// Gets the radius for the corners of the element.
/// </summary>
/// <value>A <see cref="CornerRadius"/> value that specifies the radius for each corner of the element. The default value depends on the implementing control.</value>
/// <remarks>Implementors should implement this property publicly.</remarks>
CornerRadius CornerRadius { get; }
}
32 changes: 22 additions & 10 deletions src/Controls/src/Core/ILineHeightElement.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
#nullable disable
using System.ComponentModel;
namespace Microsoft.Maui.Controls;

namespace Microsoft.Maui.Controls.Internals
/// <summary>
/// Defines properties and methods for elements that support line height customization.
/// </summary>
/// <remarks>
/// This interface is implemented by UI elements that need to control the spacing between lines of text,
/// providing consistent line height behavior across different text-based controls.
/// </remarks>
public interface ILineHeightElement
{
[EditorBrowsable(EditorBrowsableState.Never)]
interface ILineHeightElement
{
double LineHeight { get; }
/// <summary>
/// Gets the line height for text displayed by this element.
/// </summary>
/// <value>A multiplier that determines the spacing between lines of text. A value of 1.0 represents standard line height.</value>
double LineHeight { get; }

void OnLineHeightChanged(double oldValue, double newValue);
}
}
/// <summary>
/// Called when the <see cref="LineHeight"/> property changes.
/// </summary>
/// <param name="oldValue">The old value of the property.</param>
/// <param name="newValue">The new value of the property.</param>
/// <remarks>Implementors should implement this method explicitly.</remarks>
void OnLineHeightChanged(double oldValue, double newValue);
}
41 changes: 30 additions & 11 deletions src/Controls/src/Core/ITextAlignmentElement.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,33 @@
#nullable disable
namespace Microsoft.Maui.Controls
namespace Microsoft.Maui.Controls;

/// <summary>
/// Defines properties and methods for elements that support text alignment.
/// </summary>
/// <remarks>
/// This interface is implemented by UI elements that need to control the horizontal and vertical
/// alignment of displayed text.
/// </remarks>
public interface ITextAlignmentElement
{
interface ITextAlignmentElement
{
//note to implementor: implement the properties publicly
TextAlignment HorizontalTextAlignment { get; }
/// <summary>
/// Gets the horizontal alignment of the text.
/// </summary>
/// <value>A <see cref="TextAlignment"/> value that specifies how the text is horizontally aligned. The default value depends on the implementing control.</value>
/// <remarks>Implementors should implement this property publicly.</remarks>
TextAlignment HorizontalTextAlignment { get; }

TextAlignment VerticalTextAlignment { get; }
/// <summary>
/// Gets the vertical alignment of the text.
/// </summary>
/// <value>A <see cref="TextAlignment"/> value that specifies how the text is vertically aligned. The default value depends on the implementing control.</value>
/// <remarks>Implementors should implement this property publicly.</remarks>
TextAlignment VerticalTextAlignment { get; }

//note to implementor: but implement the methods explicitly
void OnHorizontalTextAlignmentPropertyChanged(TextAlignment oldValue, TextAlignment newValue);
}
}
/// <summary>
/// Called when the <see cref="HorizontalTextAlignment"/> property changes.
/// </summary>
/// <param name="oldValue">The old value of the property.</param>
/// <param name="newValue">The new value of the property.</param>
/// <remarks>Implementors should implement this method explicitly.</remarks>
void OnHorizontalTextAlignmentPropertyChanged(TextAlignment oldValue, TextAlignment newValue);
}
71 changes: 54 additions & 17 deletions src/Controls/src/Core/ITextElement.cs
Original file line number Diff line number Diff line change
@@ -1,27 +1,64 @@
#nullable disable
using System;
using Microsoft.Maui.Controls.Internals;
using Microsoft.Maui.Graphics;

namespace Microsoft.Maui.Controls
namespace Microsoft.Maui.Controls;

/// <summary>
/// Defines properties and methods for elements that display text.
/// </summary>
/// <remarks>
/// This interface is implemented by UI elements that can display text and allows consistent
/// text styling and formatting across different controls.
/// </remarks>
public interface ITextElement
{
interface ITextElement
{
//note to implementor: implement this property publicly
Color TextColor { get; }
/// <summary>
/// Gets the color of the text.
/// </summary>
/// <value>The <see cref="Color"/> of the text. The default value depends on the implementing control.</value>
/// <remarks>Implementors should implement this property publicly.</remarks>
Color TextColor { get; }

//note to implementor: but implement this method explicitly
void OnTextColorPropertyChanged(Color oldValue, Color newValue);
/// <summary>
/// Called when the <see cref="TextColor"/> property changes.
/// </summary>
/// <param name="oldValue">The old value of the property.</param>
/// <param name="newValue">The new value of the property.</param>
/// <remarks>Implementors should implement this method explicitly.</remarks>
void OnTextColorPropertyChanged(Color oldValue, Color newValue);

double CharacterSpacing { get; }
/// <summary>
/// Gets the character spacing.
/// </summary>
/// <value>The spacing between characters in the text, in device-independent units. The default is 0.</value>
double CharacterSpacing { get; }

//note to implementor: but implement these methods explicitly
void OnCharacterSpacingPropertyChanged(double oldValue, double newValue);
/// <summary>
/// Called when the <see cref="CharacterSpacing"/> property changes.
/// </summary>
/// <param name="oldValue">The old value of the property.</param>
/// <param name="newValue">The new value of the property.</param>
/// <remarks>Implementors should implement this method explicitly.</remarks>
void OnCharacterSpacingPropertyChanged(double oldValue, double newValue);

TextTransform TextTransform { get; set; }
/// <summary>
/// Gets or sets the text transformation.
/// </summary>
/// <value>A <see cref="TextTransform"/> value that indicates how the text is transformed. The default is <see cref="TextTransform.None"/>.</value>
TextTransform TextTransform { get; set; }

void OnTextTransformChanged(TextTransform oldValue, TextTransform newValue);
/// <summary>
/// Called when the <see cref="TextTransform"/> property changes.
/// </summary>
/// <param name="oldValue">The old value of the property.</param>
/// <param name="newValue">The new value of the property.</param>
void OnTextTransformChanged(TextTransform oldValue, TextTransform newValue);

string UpdateFormsText(string original, TextTransform transform);
}
}
/// <summary>
/// Updates the text according to the specified transformation.
/// </summary>
/// <param name="original">The original text to transform.</param>
/// <param name="transform">The transformation to apply.</param>
/// <returns>The transformed text.</returns>
string UpdateFormsText(string original, TextTransform transform);
}
6 changes: 0 additions & 6 deletions src/Controls/src/Core/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,6 @@
[assembly: InternalsVisibleTo("Microsoft.Maui.Controls.DeviceTests")]
[assembly: InternalsVisibleTo("Controls.TestCases.HostApp")]

[assembly: InternalsVisibleTo("CommunityToolkit.Maui")]
[assembly: InternalsVisibleTo("CommunityToolkit.Maui.Core")]
[assembly: InternalsVisibleTo("CommunityToolkit.Maui.Embedding")]
[assembly: InternalsVisibleTo("CommunityToolkit.Maui.UnitTests")]
[assembly: InternalsVisibleTo("CommunityToolkit.Maui.Markup")]
[assembly: InternalsVisibleTo("CommunityToolkit.Maui.Markup.UnitTests")]
[assembly: InternalsVisibleTo("Controls.TestCases.HostApp")]

[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,25 @@
*REMOVED*~Microsoft.Maui.Controls.NavigableElement.StyleClass.set -> void
Microsoft.Maui.Controls.HybridWebView.InvokeJavaScriptAsync(string! methodName, object?[]? paramValues = null, System.Text.Json.Serialization.Metadata.JsonTypeInfo?[]? paramJsonTypeInfos = null) -> System.Threading.Tasks.Task!
Microsoft.Maui.Controls.HybridWebView.SetInvokeJavaScriptTarget<T>(T! target) -> void
Microsoft.Maui.Controls.ICornerElement
Microsoft.Maui.Controls.ICornerElement.CornerRadius.get -> Microsoft.Maui.CornerRadius
Microsoft.Maui.Controls.ILineHeightElement
Microsoft.Maui.Controls.ILineHeightElement.LineHeight.get -> double
Microsoft.Maui.Controls.ILineHeightElement.OnLineHeightChanged(double oldValue, double newValue) -> void
Microsoft.Maui.Controls.Internals.TextTransformUtilities
Microsoft.Maui.Controls.ITextAlignmentElement
Microsoft.Maui.Controls.ITextAlignmentElement.HorizontalTextAlignment.get -> Microsoft.Maui.TextAlignment
Microsoft.Maui.Controls.ITextAlignmentElement.OnHorizontalTextAlignmentPropertyChanged(Microsoft.Maui.TextAlignment oldValue, Microsoft.Maui.TextAlignment newValue) -> void
Microsoft.Maui.Controls.ITextAlignmentElement.VerticalTextAlignment.get -> Microsoft.Maui.TextAlignment
Microsoft.Maui.Controls.ITextElement
Microsoft.Maui.Controls.ITextElement.CharacterSpacing.get -> double
Microsoft.Maui.Controls.ITextElement.OnCharacterSpacingPropertyChanged(double oldValue, double newValue) -> void
Microsoft.Maui.Controls.ITextElement.OnTextTransformChanged(Microsoft.Maui.TextTransform oldValue, Microsoft.Maui.TextTransform newValue) -> void
Microsoft.Maui.Controls.ITextElement.TextTransform.get -> Microsoft.Maui.TextTransform
Microsoft.Maui.Controls.ITextElement.TextTransform.set -> void
~Microsoft.Maui.Controls.ITextElement.OnTextColorPropertyChanged(Microsoft.Maui.Graphics.Color oldValue, Microsoft.Maui.Graphics.Color newValue) -> void
~Microsoft.Maui.Controls.ITextElement.TextColor.get -> Microsoft.Maui.Graphics.Color
~Microsoft.Maui.Controls.ITextElement.UpdateFormsText(string original, Microsoft.Maui.TextTransform transform) -> string
Microsoft.Maui.Controls.ShadowTypeConverter
Microsoft.Maui.Controls.ShadowTypeConverter.ShadowTypeConverter() -> void
Microsoft.Maui.Controls.StyleableElement.Style.get -> Microsoft.Maui.Controls.Style?
Expand Down
18 changes: 18 additions & 0 deletions src/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,24 @@ static Microsoft.Maui.Controls.ViewExtensions.TranslateToAsync(this Microsoft.Ma
*REMOVED*~Microsoft.Maui.Controls.NavigableElement.StyleClass.set -> void
Microsoft.Maui.Controls.HybridWebView.InvokeJavaScriptAsync(string! methodName, object?[]? paramValues = null, System.Text.Json.Serialization.Metadata.JsonTypeInfo?[]? paramJsonTypeInfos = null) -> System.Threading.Tasks.Task!
Microsoft.Maui.Controls.HybridWebView.SetInvokeJavaScriptTarget<T>(T! target) -> void
Microsoft.Maui.Controls.ICornerElement
Microsoft.Maui.Controls.ICornerElement.CornerRadius.get -> Microsoft.Maui.CornerRadius
Microsoft.Maui.Controls.ILineHeightElement
Microsoft.Maui.Controls.ILineHeightElement.LineHeight.get -> double
Microsoft.Maui.Controls.ILineHeightElement.OnLineHeightChanged(double oldValue, double newValue) -> void
Microsoft.Maui.Controls.ITextAlignmentElement
Microsoft.Maui.Controls.ITextAlignmentElement.HorizontalTextAlignment.get -> Microsoft.Maui.TextAlignment
Microsoft.Maui.Controls.ITextAlignmentElement.OnHorizontalTextAlignmentPropertyChanged(Microsoft.Maui.TextAlignment oldValue, Microsoft.Maui.TextAlignment newValue) -> void
Microsoft.Maui.Controls.ITextAlignmentElement.VerticalTextAlignment.get -> Microsoft.Maui.TextAlignment
Microsoft.Maui.Controls.ITextElement
Microsoft.Maui.Controls.ITextElement.CharacterSpacing.get -> double
Microsoft.Maui.Controls.ITextElement.OnCharacterSpacingPropertyChanged(double oldValue, double newValue) -> void
Microsoft.Maui.Controls.ITextElement.OnTextTransformChanged(Microsoft.Maui.TextTransform oldValue, Microsoft.Maui.TextTransform newValue) -> void
Microsoft.Maui.Controls.ITextElement.TextTransform.get -> Microsoft.Maui.TextTransform
Microsoft.Maui.Controls.ITextElement.TextTransform.set -> void
~Microsoft.Maui.Controls.ITextElement.OnTextColorPropertyChanged(Microsoft.Maui.Graphics.Color oldValue, Microsoft.Maui.Graphics.Color newValue) -> void
~Microsoft.Maui.Controls.ITextElement.TextColor.get -> Microsoft.Maui.Graphics.Color
~Microsoft.Maui.Controls.ITextElement.UpdateFormsText(string original, Microsoft.Maui.TextTransform transform) -> string
~Microsoft.Maui.Controls.ResourceDictionary.SetAndCreateSource<T>(System.Uri value) -> void
~Microsoft.Maui.Controls.WebViewProcessTerminatedEventArgs.PlatformArgs.get -> Microsoft.Maui.Controls.PlatformWebViewProcessTerminatedEventArgs
~Microsoft.Maui.Controls.Xaml.IXamlTypeResolver.Resolve(string qualifiedTypeName, System.IServiceProvider serviceProvider = null, bool expandToExtension = true) -> System.Type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,24 @@ static Microsoft.Maui.Controls.ViewExtensions.TranslateToAsync(this Microsoft.Ma
*REMOVED*~Microsoft.Maui.Controls.NavigableElement.StyleClass.set -> void
Microsoft.Maui.Controls.HybridWebView.InvokeJavaScriptAsync(string! methodName, object?[]? paramValues = null, System.Text.Json.Serialization.Metadata.JsonTypeInfo?[]? paramJsonTypeInfos = null) -> System.Threading.Tasks.Task!
Microsoft.Maui.Controls.HybridWebView.SetInvokeJavaScriptTarget<T>(T! target) -> void
Microsoft.Maui.Controls.ICornerElement
Microsoft.Maui.Controls.ICornerElement.CornerRadius.get -> Microsoft.Maui.CornerRadius
Microsoft.Maui.Controls.ILineHeightElement
Microsoft.Maui.Controls.ILineHeightElement.LineHeight.get -> double
Microsoft.Maui.Controls.ILineHeightElement.OnLineHeightChanged(double oldValue, double newValue) -> void
Microsoft.Maui.Controls.ITextAlignmentElement
Microsoft.Maui.Controls.ITextAlignmentElement.HorizontalTextAlignment.get -> Microsoft.Maui.TextAlignment
Microsoft.Maui.Controls.ITextAlignmentElement.OnHorizontalTextAlignmentPropertyChanged(Microsoft.Maui.TextAlignment oldValue, Microsoft.Maui.TextAlignment newValue) -> void
Microsoft.Maui.Controls.ITextAlignmentElement.VerticalTextAlignment.get -> Microsoft.Maui.TextAlignment
Microsoft.Maui.Controls.ITextElement
Microsoft.Maui.Controls.ITextElement.CharacterSpacing.get -> double
Microsoft.Maui.Controls.ITextElement.OnCharacterSpacingPropertyChanged(double oldValue, double newValue) -> void
Microsoft.Maui.Controls.ITextElement.OnTextTransformChanged(Microsoft.Maui.TextTransform oldValue, Microsoft.Maui.TextTransform newValue) -> void
Microsoft.Maui.Controls.ITextElement.TextTransform.get -> Microsoft.Maui.TextTransform
Microsoft.Maui.Controls.ITextElement.TextTransform.set -> void
~Microsoft.Maui.Controls.ITextElement.OnTextColorPropertyChanged(Microsoft.Maui.Graphics.Color oldValue, Microsoft.Maui.Graphics.Color newValue) -> void
~Microsoft.Maui.Controls.ITextElement.TextColor.get -> Microsoft.Maui.Graphics.Color
~Microsoft.Maui.Controls.ITextElement.UpdateFormsText(string original, Microsoft.Maui.TextTransform transform) -> string
~Microsoft.Maui.Controls.ResourceDictionary.SetAndCreateSource<T>(System.Uri value) -> void
~Microsoft.Maui.Controls.Internals.TypedBindingBase.UpdateSourceEventName.set -> void
~Microsoft.Maui.Controls.Xaml.IXamlTypeResolver.Resolve(string qualifiedTypeName, System.IServiceProvider serviceProvider = null, bool expandToExtension = true) -> System.Type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,25 @@
*REMOVED*~Microsoft.Maui.Controls.NavigableElement.StyleClass.set -> void
Microsoft.Maui.Controls.HybridWebView.InvokeJavaScriptAsync(string! methodName, object?[]? paramValues = null, System.Text.Json.Serialization.Metadata.JsonTypeInfo?[]? paramJsonTypeInfos = null) -> System.Threading.Tasks.Task!
Microsoft.Maui.Controls.HybridWebView.SetInvokeJavaScriptTarget<T>(T! target) -> void
Microsoft.Maui.Controls.ICornerElement
Microsoft.Maui.Controls.ICornerElement.CornerRadius.get -> Microsoft.Maui.CornerRadius
Microsoft.Maui.Controls.ILineHeightElement
Microsoft.Maui.Controls.ILineHeightElement.LineHeight.get -> double
Microsoft.Maui.Controls.ILineHeightElement.OnLineHeightChanged(double oldValue, double newValue) -> void
Microsoft.Maui.Controls.Internals.TextTransformUtilities
Microsoft.Maui.Controls.ITextAlignmentElement
Microsoft.Maui.Controls.ITextAlignmentElement.HorizontalTextAlignment.get -> Microsoft.Maui.TextAlignment
Microsoft.Maui.Controls.ITextAlignmentElement.OnHorizontalTextAlignmentPropertyChanged(Microsoft.Maui.TextAlignment oldValue, Microsoft.Maui.TextAlignment newValue) -> void
Microsoft.Maui.Controls.ITextAlignmentElement.VerticalTextAlignment.get -> Microsoft.Maui.TextAlignment
Microsoft.Maui.Controls.ITextElement
Microsoft.Maui.Controls.ITextElement.CharacterSpacing.get -> double
Microsoft.Maui.Controls.ITextElement.OnCharacterSpacingPropertyChanged(double oldValue, double newValue) -> void
Microsoft.Maui.Controls.ITextElement.OnTextTransformChanged(Microsoft.Maui.TextTransform oldValue, Microsoft.Maui.TextTransform newValue) -> void
Microsoft.Maui.Controls.ITextElement.TextTransform.get -> Microsoft.Maui.TextTransform
Microsoft.Maui.Controls.ITextElement.TextTransform.set -> void
~Microsoft.Maui.Controls.ITextElement.OnTextColorPropertyChanged(Microsoft.Maui.Graphics.Color oldValue, Microsoft.Maui.Graphics.Color newValue) -> void
~Microsoft.Maui.Controls.ITextElement.TextColor.get -> Microsoft.Maui.Graphics.Color
~Microsoft.Maui.Controls.ITextElement.UpdateFormsText(string original, Microsoft.Maui.TextTransform transform) -> string
Microsoft.Maui.Controls.ShadowTypeConverter
Microsoft.Maui.Controls.ShadowTypeConverter.ShadowTypeConverter() -> void
Microsoft.Maui.Controls.StyleableElement.Style.get -> Microsoft.Maui.Controls.Style?
Expand Down
Loading
Loading