using System; namespace Microsoft.AspNetCore.Components; /// /// Represents a segment of UI content, implemented as a delegate that /// writes the content to a builder /// public delegate void RenderFragment( Rendering.RenderTreeBuilder builder ); /// /// Represents a segment of UI content for an object of type , implemented as /// a function that returns a . /// public delegate RenderFragment RenderFragment( TValue value ); /// /// A component type /// public interface IComponent { } /// /// Signifies a parameter attribute /// public class ParameterAttribute : Attribute { } /// /// A base component /// public class ComponentBase : IComponent { } [System.AttributeUsage( System.AttributeTargets.Class, AllowMultiple = true, Inherited = true )] public sealed class EventHandlerAttribute : System.Attribute { public EventHandlerAttribute( string attributeName, System.Type eventArgsType, bool enableStopPropagation, bool enablePreventDefault ) { ArgumentNullException.ThrowIfNull( attributeName ); ArgumentNullException.ThrowIfNull( eventArgsType ); AttributeName = attributeName; EventArgsType = eventArgsType; EnableStopPropagation = enableStopPropagation; EnablePreventDefault = enablePreventDefault; } /// /// Gets the attribute name. /// public string AttributeName { get; } /// /// Gets the event argument type. /// public Type EventArgsType { get; } /// /// Gets the event's ability to stop propagation. /// public bool EnableStopPropagation { get; } /// /// Gets the event's ability to prevent default event flow. /// public bool EnablePreventDefault { get; } } internal interface IEventCallback { bool HasDelegate { get; } object UnpackForRenderTree(); } public interface IHandleEvent { } public readonly struct EventCallback : IEventCallback { public static readonly EventCallbackFactory Factory; public object UnpackForRenderTree() => null; public bool HasDelegate => false; } public readonly struct EventCallback : IEventCallback { public object UnpackForRenderTree() => null; public bool HasDelegate => false; } public sealed class EventCallbackFactory { public EventCallback Create( object receiver, System.Action callback ) => throw null; public object UnpackForRenderTree() => null; public bool HasDelegate => false; } /// /// Specifies that the component parameter is required to be provided by the user when authoring it in the editor. /// /// If a value for this parameter is not provided, editors or build tools may provide warnings indicating the user to /// specify a value. This attribute is only valid on properties marked with . /// /// [AttributeUsage( AttributeTargets.Property, AllowMultiple = false )] public sealed class EditorRequiredAttribute : Attribute { }