// Generated API outline. Implementation bodies omitted.
#nullable enable
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using System.Threading;
using System;
using nfloat = System.Runtime.InteropServices.NFloat;
namespace Xui.ToolKit.UI.Branding
{
using Xui.Core.Canvas;
using Xui.Core.Math2D;
using Xui.Core.UI;
/// The Xui mark rendered as resolution-independent paths.
public sealed class XuiLogoView : View
{
/// Override to compute the desired border-edge size.
protected override Size MeasureCore(Size available, IMeasureContext context);
/// Override to render this view and its children.
protected override void RenderCore(IContext context);
}
}
namespace Xui.ToolKit.UI.Design
{
using Xui.Core.Canvas;
///
/// A group of four semantically related colors derived from a single tonal palette,
/// together with the underlying OKLCH ramp that generated them. Shared by all consumers;
/// interaction colors are derived once on demand instead of copied into individual views.
///
public sealed class ColorGroup
{
/// Whether this group belongs to a dark appearance palette.
public bool IsDark { get; init; }
/// Background for a hovered filled control.
public Color HoverBackground { get; }
/// Background for a pressed filled control.
public Color PressedBackground { get; }
/// Pressed state layer for an outline or text control.
public Color PressedContainer { get; }
/// Hovered active toggle track.
public Color ToggleHoverBackground { get; }
/// Pressed background within a segmented selection.
public Color SelectedPressedBackground { get; }
///
/// Strong, saturated action color (ramp at tone 0.56 light / 0.75 dark).
/// Use as fill for filled buttons, active indicators, primary UI elements.
///
public Color Background { get; init; }
///
/// Black or white text/icon color on Background, selected by its actual luminance.
///
public Color Foreground { get; init; }
///
/// Light tinted fill from the same palette (ramp at tone 0.90 light / 0.30 dark).
/// Use for tonal buttons, chips, and highlighted list rows.
///
public Color Container { get; init; }
///
/// Text/icon color on top of Container (ramp at tone 0.10 light / 0.90 dark).
///
public Color OnContainer { get; init; }
///
/// The full tonal ramp for this palette entry (Lightness 0 to 1 at the group's hue).
/// Use for computing hover/press state colors.
///
public OklchRamp Ramp { get; init; }
///
/// The lightness value (0–1) used to produce from the ramp.
/// Enables relative hover/press offset computation.
///
public nfloat BackgroundLightness { get; init; }
///
/// Creates a from a tonal ramp and color scheme.
///
public static ColorGroup FromRamp(OklchRamp ramp, bool isDark);
}
///
/// Provides color roles derived from a seed palette, grouped into semantic
/// bundles and a set of neutral/structural colors.
///
public interface IColorSystem
{
///
/// The application canvas color group.
/// Background = window/screen fill, Foreground = body text,
/// Container = card/panel fill, OnContainer = card text.
///
ColorGroup Application { get; }
///
/// The surface (card/panel) color group, slightly elevated from Application.
/// Background = card fill, Foreground = card body text,
/// Container = alternate surface (e.g. alternating table row, hover bg),
/// OnContainer = secondary text on alternate surface.
///
ColorGroup Surface { get; }
///
/// Low-chroma interactive group matching the surface tone.
/// Used for quiet buttons, toolbars, and controls that should not compete
/// with Primary/Secondary/Tertiary.
///
ColorGroup Neutral { get; }
/// Neutral border/divider color (mid-tone).
Color Outline { get; }
/// Lighter neutral border/divider variant.
Color OutlineVariant { get; }
/// Brand / primary action group (from the Primary tonal ramp).
ColorGroup Primary { get; }
/// Supporting / secondary action group (from the Secondary tonal ramp).
ColorGroup Secondary { get; }
/// Tertiary highlight / accent group (from the Tertiary tonal ramp).
ColorGroup Tertiary { get; }
/// Warning / caution state group (yellow-orange tonal ramp).
ColorGroup Warning { get; }
/// Error / destructive state group (from the Error tonal ramp).
ColorGroup Error { get; }
/// Focus ring color (typically Tertiary.Background at full opacity).
Color FocusRing { get; }
///
/// Returns a full tonal ramp for any hue/chroma combination.
///
OklchRamp GetTonalRamp(nfloat hueDegrees, nfloat chroma);
/// True if the current effective color scheme is dark.
bool IsDark { get; }
}
///
/// Provides corner-radius tokens scaled by .
///
public interface IShapeSystem
{
/// Global multiplier for all corner radii (default 1.0).
nfloat RoundnessFactor { get; }
/// 0 pt — no rounding.
CornerRadius None { get; }
/// 2 pt base, scaled by RoundnessFactor.
CornerRadius ExtraSmall { get; }
/// 4 pt base, scaled by RoundnessFactor.
CornerRadius Small { get; }
/// 8 pt base, scaled by RoundnessFactor.
CornerRadius Medium { get; }
/// 12 pt base, scaled by RoundnessFactor.
CornerRadius Large { get; }
/// 16 pt base, scaled by RoundnessFactor.
CornerRadius ExtraLarge { get; }
/// 9999 pt — fully round (pill).
CornerRadius Full { get; }
}
///
/// OKLCH perceptual color space (Oklab-based Lightness, Chroma, Hue).
/// Interpolation in OKLCH produces vivid, perceptually uniform color transitions.
/// See: https://bottosson.github.io/posts/oklab/
///
public readonly struct Oklch
{
/// Perceptual lightness (0.0 = black, 1.0 = white).
public nfloat L { get; init; }
/// Colorfulness (0.0 = neutral gray; typical max ~0.37 for sRGB gamut).
public nfloat C { get; init; }
/// Hue angle in degrees (0–360).
public nfloat H { get; init; }
///
/// Creates a new OKLCH color value.
///
public Oklch(nfloat l, nfloat c, nfloat h);
///
/// Converts an sRGB to OKLCH.
///
public Oklch(Color color);
///
/// Converts this OKLCH value back to an sRGB .
///
public Color ToColor();
///
/// Returns the maximum chroma representable in sRGB for the given lightness and hue.
/// Uses bisection search: for a candidate chroma, convert OKLCH to sRGB and check
/// whether all channels are in [0, 1].
///
public static nfloat MaxSrgbChroma(nfloat lightness, nfloat hueDegrees);
///
/// Converts this OKLCH value to an sRGB .
///
public static implicit operator Color(Oklch oklch);
///
/// Converts an sRGB to OKLCH.
///
public static implicit operator Oklch(Color color);
}
///
/// A gamut-aware tonal ramp that maps t in [0, 1] to a color at lightness t.
/// At each lightness, chroma is clamped to the sRGB gamut boundary for the hue,
/// ensuring every output color is representable without clipping.
///
public readonly struct OklchRamp
{
/// Hue angle in degrees (0–360).
public nfloat Hue { get; init; }
/// Requested target chroma (clamped to sRGB gamut at each lightness).
public nfloat TargetChroma { get; init; }
///
/// Creates a gamut-aware tonal ramp for the given hue and target chroma.
///
/// Hue angle in degrees (0–360).
/// Desired chroma level (will be clamped to sRGB gamut at each lightness).
public OklchRamp(nfloat hueDegrees, nfloat targetChroma);
///
/// Evaluates the ramp at position t in [0, 1], returning an sRGB Color.
/// t maps to lightness; chroma is gamut-clamped.
///
public Color this[nfloat t] { get; }
}
///
/// An immutable snapshot of a single text style from the typography scale.
///
public readonly struct TextStyle()
{
/// Font family name.
public string FontFamily { get; init; }
/// Font size in points (pre-multiplied by accessibility scale).
public nfloat FontSize { get; init; }
/// Line height in points.
public nfloat LineHeight { get; init; }
/// Additional letter spacing in points.
public nfloat LetterSpacing { get; init; }
/// Font weight (100–900).
public FontWeight FontWeight { get; init; }
/// Font style (normal, italic, oblique).
public FontStyle FontStyle { get; init; }
}
}
namespace Xui.ToolKit.UI.Design
{
///
/// Color-scheme relationship used to derive secondary/tertiary hues from a primary hue.
///
public enum ColorHarmony
{
/// Secondary = H + 180°.
Complementary,
/// Secondary = H + 30°, Tertiary = H + 60°.
Analogous,
/// Secondary = H + 150°, Tertiary = H + 210°.
SplitComplementary,
/// Secondary = H + 120°, Tertiary = H + 240°.
Triadic,
/// Secondary = H + 90°, Tertiary = H + 180°, Quaternary = H + 270°.
Tetradic,
}
/// Token groups affected by a live design-system update.
[Flags]
public enum DesignSystemChange
{
/// No tokens changed.
None = 0,
/// Palette or appearance changed; redraw without layout.
Colors = 1,
/// Font family or metrics changed; measure and arrange again.
Typography = 2,
/// Spacing or control sizing changed; measure and arrange again.
Spacing = 4,
/// Corner radii changed; redraw without layout.
Shape = 8,
/// Animation preferences or timings changed.
Motion = 16,
/// Initial application or a complete refresh of every token group.
All = Colors | Typography | Spacing | Shape | Motion,
}
///
/// Root interface for the Xui Design System.
/// Resolved from the parent-chain service provider via GetService<IDesignSystem>().
///
public interface IDesignSystem
{
/// Color tokens and palette math.
IColorSystem Colors { get; }
/// Typography scale.
ITypographySystem Typography { get; }
/// Spacing tokens derived from the 4-pt grid.
ISpacingSystem Spacing { get; }
/// Shape / corner-radius tokens.
IShapeSystem Shape { get; }
/// Motion tokens (curves and springs).
IMotionSystem Motion { get; }
/// Raised with the affected token groups after an update; consumers invalidate only the required passes.
event Action? Changed;
}
///
/// Receives a design-token update after a view has resolved its .
/// Implementations read shared tokens from the retained provider and invalidate only affected passes.
///
public interface IDesignSystemChangeNotifications
{
/// Responds to the changed token groups without duplicating theme state on the view.
void OnDesignTokenChange(DesignSystemChange changes);
}
///
/// Provides motion tokens for animations.
///
public interface IMotionSystem
{
/// Whether springs or curves are preferred for interactive feedback.
MotionPreference Preference { get; }
/// True if the user has requested reduced motion (accessibility).
bool ReducedMotion { get; }
/// Elements entering the screen — (0.05, 0.7, 0.1, 1.0), 400 ms.
CurveToken EmphasizedDecelerate { get; }
/// Elements leaving the screen — (0.3, 0.0, 0.8, 0.15), 200 ms.
CurveToken EmphasizedAccelerate { get; }
/// General transitions — (0.2, 0.0, 0.0, 1.0), 300 ms.
CurveToken Standard { get; }
/// Settling transitions — (0.0, 0.0, 0.0, 1.0), 250 ms.
CurveToken StandardDecelerate { get; }
/// Quick dismissals — (0.3, 0.0, 1.0, 1.0), 200 ms.
CurveToken StandardAccelerate { get; }
/// Progress bars, continuous — (0.0, 0.0, 1.0, 1.0), any duration.
CurveToken Linear { get; }
/// Art / lifestyle apps, button press — stiffness 600, damping 0.5.
SpringToken SpringBouncy { get; }
/// Default interactive feedback — stiffness 300, damping 0.8.
SpringToken SpringResponsive { get; }
/// Business / utility apps, modals — stiffness 200, damping 1.0.
SpringToken SpringSmooth { get; }
}
///
/// Provides two parallel spacing scales:
/// - — for layout, content gaps, margins, card padding.
- — for interactive leaf elements (button padding, input fields, hit targets).
/// On desktop, Active aligns with Passive (tight). On touch, Active shifts up
/// so that buttons/inputs get generous padding while layout stays compact.
public interface ISpacingSystem
{
/// Layout/content spacing scale.
SpacingScale Passive { get; }
/// Interactive element spacing scale (shifted up for touch targets).
SpacingScale Active { get; }
/// 0 pt.
nfloat None { get; }
}
///
/// Provides the typography scale.
/// All FontSize values are pre-multiplied by the accessibility font scale.
///
public interface ITypographySystem
{
/// 57 pt — Hero, marketing, splash.
TextStyle Display { get; }
/// 24–32 pt — Page and section titles.
TextStyleGroup Headline { get; }
/// 14–22 pt — Card headers, toolbars, tabs.
TextStyleGroup Title { get; }
/// 12–16 pt — Reading and UI text.
TextStyleGroup Body { get; }
/// 11–14 pt — Buttons, badges, captions.
TextStyleGroup Label { get; }
/// The default font family used across the application.
string DefaultFontFamily { get; }
}
///
/// Whether the application prefers curve-based (Bezier) or spring-based (physics) animations.
///
public enum MotionPreference
{
/// Duration + cubic Bezier easing.
Curve,
/// Spring physics (stiffness + damping).
Spring,
}
///
/// Controls animation timing and whether animations are enabled.
///
public enum MotionPreset
{
/// No animations — all transitions snap instantly.
None,
/// Short/snappy animations (50% of normal duration).
Short,
/// Normal animation timing (default).
Normal,
/// Slow/deliberate animations (200% of normal duration). Useful for review/accessibility.
Long,
}
///
/// Controls the relationship between Application and Surface background colors.
///
public enum NeutralStyle
{
///
/// Both Application and Surface are desaturated neutral gray. No hue tint.
///
Monochrome,
///
/// Application gets a subtle Secondary hue tint, Surface stays neutral.
/// Suitable for apps with many panels/surfaces where the app background groups them.
///
SecondaryApp,
///
/// Surface gets a subtle Secondary hue tint, Application stays neutral.
/// Suitable when few panels appear and most widgets sit directly on the app background.
///
SecondarySurface,
///
/// Application gets a subtle Tertiary hue tint, Surface stays neutral.
///
TertiaryApp,
///
/// Surface gets a subtle Tertiary hue tint, Application stays neutral.
///
TertiarySurface,
}
///
/// Predefined shape profiles that control corner radius tokens across the design system.
///
public enum ShapePreset
{
/// All corners square (0 radius everywhere).
Square,
///
/// Classic desktop style: slight container radius (~7pt), square buttons and inputs.
/// Typical of macOS and Windows window chrome.
///
Desktop,
///
/// Modern dialog style: large outer radius, smaller inner radius, small button radius (3–5pt).
/// Similar to macOS alerts and Android Material dialogs.
///
Rounded,
///
/// Same as Rounded but with fully-round (pill) buttons.
///
RoundedPill,
///
/// Maximum roundness: large container radius, pill buttons. High visual softness.
///
Soft,
}
///
/// Predefined sizing profiles that control spacing tokens, minimum hit-test radius,
/// and overall density of the UI.
///
public enum SizingPreset
{
///
/// Compact desktop: small spacing, small hit targets (4pt), precise pointer assumed.
/// Suitable for dense desktop applications with mouse input.
///
Desktop,
///
/// Touch-enabled desktop: same compact layout as Desktop but with larger hit targets (22pt).
/// Good for laptop touchscreens and stylus-enabled desktops.
///
TouchEnabled,
///
/// Mobile: generous spacing, large hit targets (22pt), finger-friendly.
/// Suitable for phones and tablets.
///
Mobile,
}
///
/// A set of spacing values on a geometric scale (S through XXXL).
/// Used for both passive (layout/content) and active (interactive leaf) spacing.
///
public readonly struct SpacingScale
{
/// Small spacing.
public nfloat S { get; init; }
/// Medium spacing.
public nfloat M { get; init; }
/// Large spacing.
public nfloat L { get; init; }
/// Extra-large spacing.
public nfloat XL { get; init; }
/// 2× extra-large spacing.
public nfloat XXL { get; init; }
/// 3× extra-large spacing.
public nfloat XXXL { get; init; }
///
/// Minimum hit-test dimension for small interactive elements (icon buttons, tree toggles, etc.).
/// On Desktop this is small (e.g. 20pt), on touch it's finger-sized (e.g. 44pt).
/// Use as MinimumWidth/MinimumHeight on compact clickable views.
///
public nfloat MinHitTarget { get; init; }
}
///
/// Spring physics parameters for animation.
///
public readonly struct SpringToken
{
/// Spring stiffness (higher = faster oscillation).
public float Stiffness { get; init; }
/// Damping ratio (1.0 = critically damped, less than 1.0 = bouncy).
public float Damping { get; init; }
}
///
/// A group of three related text styles at small, medium, and large sizes.
///
public readonly struct TextStyleGroup
{
/// Small variant.
public TextStyle S { get; init; }
/// Medium variant.
public TextStyle M { get; init; }
/// Large variant.
public TextStyle L { get; init; }
}
}
namespace Xui.ToolKit.UI.Design
{
using Xui.Core.Animation;
///
/// An easing curve paired with a default duration for animation.
/// Wraps from Xui.Core.Animation.
///
public readonly struct CurveToken
{
/// The cubic Bezier easing curve.
public Easing.CubicBezier Curve { get; init; }
/// Default duration for this easing curve.
public TimeSpan DefaultDuration { get; init; }
}
}
namespace Xui.ToolKit.UI.Design
{
using Xui.Core.Canvas;
using Xui.Core.DI;
using Xui.Core.Math2D;
using Xui.Core.UI;
/// Provides a device-aware design system to a subtree of controls.
public sealed class DesignSystemView : View
{
/// Wraps content with the supplied theme, or the default Xui theme.
public DesignSystemView(View content, XuiDesignSystemOptions? options = null);
///
/// Returns the number of child views. Used by layout containers and traversal logic.
/// Leaf views should return 0.
///
public override int Count { get; }
///
/// Indexer to access child views by index.
/// Layout containers should implement this to expose their children.
///
public override View this[int index] { get; }
///
/// Resolves a service of the given type by walking up the parent chain.
/// Returns null if no ancestor provides the service.
///
public override object? GetService(Type type);
///
/// Called when this view becomes active — it will receive events, render, and animate.
/// Override this to start animations, subscribe to data sources, or acquire resources.
///
protected override void OnActivate();
///
/// Called when this view becomes dormant — it should stop animations, timers, and event subscriptions.
/// The view may remain in the tree (e.g., in a virtualizing panel's recycle pool).
///
protected override void OnDeactivate();
/// Override to compute the desired border-edge size.
protected override Size MeasureCore(Size available, IMeasureContext context);
/// Override to arrange children within this view's final frame.
protected override void ArrangeCore(Rect rect, IMeasureContext context);
}
}
namespace Xui.ToolKit.UI.Design
{
using Xui.Core.DI;
///
/// Concrete implementation of that derives a complete set of
/// design tokens from a small number of seed properties and the current .
///
public class XuiDesignSystem : IDesignSystem
{
///
/// Creates a new design system from the given options and device info.
///
public XuiDesignSystem(XuiDesignSystemOptions options, IDeviceInfo device);
/// Updates the retained palette in place and rebuilds only other changed token groups.
public void Update(XuiDesignSystemOptions options, IDeviceInfo device);
/// Color tokens and palette math.
public IColorSystem Colors { get; }
/// Typography scale.
public ITypographySystem Typography { get; }
/// Spacing tokens derived from the 4-pt grid.
public ISpacingSystem Spacing { get; }
/// Shape / corner-radius tokens.
public IShapeSystem Shape { get; }
/// Motion tokens (curves and springs).
public IMotionSystem Motion { get; }
/// Raised with the affected token groups after an update; consumers invalidate only the required passes.
public event Action? Changed;
///
/// Raises the event, causing widgets to re-query tokens.
///
public void NotifyChanged(DesignSystemChange changes = DesignSystemChange.All);
}
///
/// Value-type options for constructing or updating a without allocating a configuration object.
///
public readonly struct XuiDesignSystemOptions
{
/// Initializes the default design-system settings.
public XuiDesignSystemOptions();
/// Primary brand hue in degrees (0–360). Required.
public nfloat PrimaryHue { get; init; }
/// Optional secondary hue override. If null, derived from .
public nfloat? SecondaryHue { get; init; }
/// Optional tertiary/accent hue override. If null, derived from .
public nfloat? TertiaryHue { get; init; }
/// Optional neutral hue override. If null, derived as primary hue desaturated.
public nfloat? NeutralHue { get; init; }
/// Color harmony used to derive secondary/tertiary hues. Default: SplitComplementary.
public ColorHarmony Harmony { get; init; }
/// Target chroma for the primary palette (typical range 0.10–0.35). Default: 0.15.
public nfloat Chroma { get; init; }
/// Optional primary action lightness (0–1). Null uses the appearance's default action tone.
public nfloat? PrimaryLightness { get; init; }
/// Global corner-radius multiplier (0.0 = square, 1.0 = default, 2.0 = very round). Default: 1.0.
public nfloat RoundnessFactor { get; init; }
/// Shape preset controlling corner radius tokens. Default: Soft.
public ShapePreset Shape { get; init; }
/// Sizing preset controlling spacing and hit-test targets. Default: Mobile.
public SizingPreset Sizing { get; init; }
/// Controls the hue relationship between Application and Surface backgrounds. Default: Monochrome.
public NeutralStyle NeutralStyle { get; init; }
/// Preferred animation style. Default: Curve.
public MotionPreference MotionPreference { get; init; }
/// Animation timing preset. Default: Normal.
public MotionPreset Motion { get; init; }
/// Default font family for all text styles. Default: system-ui.
public string DefaultFontFamily { get; init; }
}
}
namespace Xui.ToolKit.UI.Drawing
{
using Xui.Core.Canvas;
using Xui.Core.Math2D;
/// Draws a soft rounded-rectangle outline shadow using only gradient-filled geometry.
public static class RoundedRectShadow
{
/// Draws a shadow outside the supplied rounded rectangle.
/// The drawing context.
/// The rectangle whose interior remains unpainted.
/// Corner radii, clamped to fit the rectangle.
/// Distance from the outline to the transparent outer edge.
/// Shadow color and opacity at the outline.
///
/// Uses up to four strips and four quarter rings, without a bitmap, blur pass, or extra clip.
/// Uniform corners share one radial gradient; all strips share one linear gradient.
/// This is a geometric falloff, not a Gaussian blur. Canvas state is restored, but the current
/// path is replaced. The caller must include the extent in its culling bounds.
///
public static void Draw(IContext context, Rect bounds, CornerRadius radius, nfloat extent, Color color);
}
}
namespace Xui.ToolKit.UI.Layer
{
using System.Runtime.CompilerServices;
using Xui.Core.Abstract.Events;
using Xui.Core.Animation;
using Xui.Core.Canvas;
using Xui.Core.Math2D;
using Xui.Core.UI.Input;
using Xui.Core.UI.Layer;
///
/// Delayed press feedback and bounded, overlapping ripples. The host owns gesture capture and
/// calls Begin/End when a press starts, commits or is cancelled. One layer can paint many logical
/// cells by selecting a Target before arranging/rendering; it never allocates per-cell state.
///
public struct PressFeedbackLayer : ILayer where TView : class, ILayerHost
{
/// Logical cell to begin or render. Leave at zero for a single button.
public int Target;
/// Optional pressed background; transparent by default.
public Color Background;
/// Ripple color, rendered at twelve percent opacity.
public Color RippleColor;
/// Outline used to clip feedback to the arranged bounds.
public CornerRadius CornerRadius;
/// Whether a competing ancestor drag gesture warrants a touch recognition delay.
public static bool ShouldDelay(TView view, ref PointerEventRef e);
/// Starts feedback at a point in the same coordinate space as the arranged bounds.
public void Begin(TView view, Point position, bool delay);
/// Quick taps show immediately and hold for 200ms; early scroll cancellation stays invisible.
public void End(TView view, bool tapped);
/// Keeps the most recently committed tap visible while its host awaits the first highlighted render.
public void HoldReleasedFeedback();
/// Resumes completed feedback after reparenting, or clears it if the clock changed.
public void Activate(TView view);
/// Whether the current press has reached its highlight recognition time.
public readonly bool IsPressVisible { get; }
/// Current background strength for Target, for hosts that blend their own themed fill.
public nfloat FeedbackOpacity { get; }
/// Returns the desired border-edge size given the available space.
public Size Measure(TView view, Size availableSize, IMeasureContext context);
/// Finalises position and size within .
public void Arrange(TView view, Rect rect, IMeasureContext context);
/// Sets bounds before input, without requiring a drawing/measurement context.
public void SetBounds(Rect rect);
/// Draws content. Called after Arrange.
public void Render(TView view, IContext context);
/// Advances time-based state (animations, blinking cursors, etc.).
public void Animate(TView view, TimeSpan previousTime, TimeSpan currentTime);
/// Handles a pointer event in the given dispatch phase.
public void OnPointerEvent(TView view, ref PointerEventRef e, EventPhase phase);
/// Handles a key-down event while the host view has focus.
public void OnKeyDown(TView view, ref KeyEventRef e);
/// Handles a character input event while the host view has focus.
public void OnChar(TView view, ref KeyEventRef e);
/// Called when the host view gains keyboard focus.
public void OnFocus(TView view);
/// Called when the host view loses keyboard focus.
public void OnBlur(TView view);
}
}
namespace Xui.ToolKit.UI.Mobile.Navigation
{
using Xui.Core.UI;
/// Commands and state exposed by a navigation host.
public interface INavigation
{
/// Gets whether the current page has a previous page.
bool CanGoBack { get; }
/// Gets whether a push, pop, or interactive pop is active.
bool IsTransitioning { get; }
/// Pushes above the current page.
void Push(View page);
/// Pops the current page, if one exists beneath it.
void Pop();
}
}
namespace Xui.ToolKit.UI.Mobile.Navigation
{
/// Implemented by pages that synchronize custom visuals with navigation progress.
public interface INavigationAware
{
/// Receives lifecycle and progress changes for this page.
void OnNavigationStateChanged(in NavigationStateChange change);
}
/// Optional page metadata used by .
public interface IPage
{
/// Gets the page's surface, clipping, and transition-shadow preferences.
PagePresentation Presentation { get; }
}
/// Describes the direction of a navigation transition.
public enum NavigationDirection
{
/// No direction, used when a transition is not applicable.
None,
/// A push toward a newer page.
Forward,
/// A pop toward a previous page.
Backward,
}
/// Describes the lifecycle point of a navigation transition.
public enum NavigationPhase
{
/// The page is about to become visible.
WillAppear,
/// The page is becoming visible; use .
Appearing,
/// The page is fully visible.
Appeared,
/// The page is about to become hidden.
WillDisappear,
/// The page is becoming hidden; use .
Disappearing,
/// The page is no longer visible.
Disappeared,
/// An interactive transition was returned to its starting page.
Cancelled,
}
/// Describes whether a page is entering or leaving a transition.
public enum NavigationRole
{
/// The page being revealed.
Incoming,
/// The page being covered or removed.
Outgoing,
}
/// Allocation-free notification sent only to pages participating in a transition.
public readonly record struct NavigationStateChange(NavigationPhase Phase, NavigationDirection Direction, NavigationRole Role, nfloat Progress, bool IsInteractive);
/// Controls the clipping applied by to a page.
public enum PageClipMode
{
/// Clips to the display bounds and physical screen corner radius.
Device,
/// Clips to the square navigation bounds.
Bounds,
/// Does not apply a navigation clip.
None,
}
}
namespace Xui.ToolKit.UI.Mobile.Navigation
{
using Xui.Core.Animation;
using Xui.Core.Canvas.Composition.Graphics;
using Xui.Core.Canvas;
using Xui.Core.Math2D;
using Xui.Core.UI.Input;
using Xui.Core.UI;
///
/// A stack-based navigation host with UIKit-style page transitions and an interactive leading-edge pop gesture.
/// It owns page surfaces, clipping, transition shading, and lifecycle notifications.
///
public class NavigationView : ViewCollection, INavigation, IFullScreenView
{
/// Duration of non-interactive pushes and pops.
public TimeSpan TransitionDuration { get; set; }
/// Fast decelerating curve used by UIKit-style navigation transitions.
public Easing.CubicBezier TransitionEasing { get; set; }
/// Width of the leading-edge region that may start an interactive pop.
public nfloat BackSwipeEdgeWidth { get; set; }
/// Default opaque surface behind pages that do not provide a background.
public Color DefaultPageBackground { get; set; }
/// Whether the current state paints the whole display area opaquely.
public bool DrawsOpaqueFullScreen { get; }
/// Gets or sets whether the back page is darkened during navigation transitions.
public bool UsesBackgroundTransitionShade { get; set; }
///
/// Gets or sets whether the foreground page receives its rounded gradient edge shadow.
/// Disabled while isolating the cost of the gradient shadow from the flat shade.
///
public bool UsesRoundedPageTransitionShadow { get; set; }
/// Optional content rendered above the page stack and docked at the navigation viewport's top-right corner.
public View? OverlayContent { get; set; }
/// Creates a navigation stack with as its first page.
public NavigationView(View rootPage);
/// Gets whether the current page has a previous page.
public bool CanGoBack { get; }
/// Gets whether a push, pop, or interactive pop is active.
public bool IsTransitioning { get; }
/// Pushes above the current page.
public void Push(View page);
/// Pops the current page, if one exists beneath it.
public void Pop();
///
/// Called when this view becomes active — it will receive events, render, and animate.
/// Override this to start animations, subscribe to data sources, or acquire resources.
///
protected override void OnActivate();
/// Override to compute the desired border-edge size.
protected override Size MeasureCore(Size available, IMeasureContext context);
/// Override to arrange children within this view's final frame.
protected override void ArrangeCore(Rect rect, IMeasureContext context);
/// Override to render this view and its children.
protected override void RenderCore(IContext context);
///
/// Called during event dispatch to handle a pointer event in a specific event phase.
///
public override void OnPointerEvent(ref PointerEventRef e, EventPhase phase);
/// Override to animate this view and its children.
protected override void AnimateCore(TimeSpan previous, TimeSpan current);
}
}
namespace Xui.ToolKit.UI.Mobile.Navigation
{
using Xui.Core.Canvas;
/// Presentation preferences supplied by a page to its navigation host.
public readonly record struct PagePresentation
{
/// Creates the default opaque, device-clipped page presentation with its transition shadow enabled.
public PagePresentation();
/// Creates a page presentation with explicit surface, clipping, and shadow preferences.
public PagePresentation(Color? background, PageClipMode clip, bool usesTransitionShadow);
/// Gets the page background, or to use the navigation default.
public Color? Background { get; init; }
/// Gets the clipping applied to the page.
public PageClipMode Clip { get; init; }
/// Gets whether the transition shadow is drawn for this page.
public bool UsesTransitionShadow { get; init; }
}
}
namespace Xui.ToolKit.UI.Navigation
{
using Xui.Core.UI;
/// A named destination whose content is created when first opened.
/// Stable application-defined destination identifier.
/// Label shown in navigation and the page header.
/// Creates a fresh, unattached view for this destination.
public sealed record NavigationItem(string Id, string Title, Func Create);
}
namespace Xui.ToolKit.UI.Navigation
{
using Xui.Core.Canvas;
using Xui.Core.Math2D;
using Xui.Core.UI;
using Xui.ToolKit.UI.Widgets;
/// A page title, optional Back button, and a content view.
public sealed class NavigationPage : ViewCollection
{
/// Creates page chrome around application content.
public NavigationPage(string title, View content, Action? goBack = null);
/// Override to compute the desired border-edge size.
protected override Size MeasureCore(Size available, IMeasureContext context);
/// Override to arrange children within this view's final frame.
protected override void ArrangeCore(Rect rect, IMeasureContext context);
}
}
namespace Xui.ToolKit.UI.Navigation
{
using Xui.Core.Canvas;
using Xui.Core.Math2D;
using Xui.Core.UI;
using Xui.ToolKit.UI.Mobile.Navigation;
using Xui.ToolKit.UI.Widgets;
/// A small application shell: a home page and push navigation on mobile,
/// or a persistent sidebar with replaceable content on desktop.
public sealed class NavigationShell : ViewCollection
{
/// Creates a shell with a brand view and a short list of destinations.
/// Application title shown in the desktop sidebar.
/// Logo or other home-page branding.
/// Unique, nonempty destination IDs; "Home" is reserved.
/// Whether to show a persistent sidebar.
public NavigationShell(string title, View brand, IEnumerable destinations, bool desktop);
/// Opens a destination. Desktop pages retain their state while switching.
public void Navigate(string id);
/// Override to compute the desired border-edge size.
protected override Size MeasureCore(Size available, IMeasureContext context);
/// Override to arrange children within this view's final frame.
protected override void ArrangeCore(Rect rect, IMeasureContext context);
/// Override to render this view and its children.
protected override void RenderCore(IContext context);
}
}
namespace Xui.ToolKit.UI.Widgets
{
using Xui.Core.Canvas;
using Xui.Core.Math2D;
using Xui.ToolKit.UI.Layer;
///
/// A button that consumes design system tokens for colors, shape, and typography.
/// Supports (Filled, Outline, Text) and hover/pressed states.
///
public partial class Button
{
///
/// Called when this view becomes active — it will receive events, render, and animate.
/// Override this to start animations, subscribe to data sources, or acquire resources.
///
protected override void OnActivate();
/// Override to animate this view and its children.
protected override void AnimateCore(TimeSpan previous, TimeSpan current);
}
}
namespace Xui.ToolKit.UI.Widgets
{
using Xui.Core.Canvas;
using Xui.Core.Math2D;
using Xui.Core.UI.Input;
using Xui.Core.UI;
using Xui.ToolKit.UI.Design;
using Xui.ToolKit.UI.Layer;
///
/// A button that consumes design system tokens for colors, shape, and typography.
/// Supports (Filled, Outline, Text) and hover/pressed states.
///
public partial class Button : View, IDesignSystemChangeNotifications
{
/// Creates a new button with content-sized alignment.
public Button();
/// The button label text.
public string Text { get; set; }
/// Optional label size override; otherwise uses the design system.
public nfloat? FontSize { get; set; }
/// Optional shape override; otherwise uses the design system.
public CornerRadius? CornerRadius { get; set; }
/// Which color group to use. Default is Primary.
public ColorRole Role { get; set; }
/// Visual weight of the button. Default is Filled.
public ButtonVariant Variant { get; set; }
/// Horizontal alignment of the button label. Default is centered.
public TextAlign LabelTextAlign { get; set; }
/// Invoked when the button is clicked.
public Action? Clicked { get; set; }
/// Raised once when press recognition allows the highlight to appear. The gesture may still cancel.
public event Action? ClickMaybe;
/// Raised on a valid release, before Click. Start nonblocking preparation here.
public event Action? ClickFarFetch;
/// Raised when the committed click executes, before the compatibility Clicked callback.
public event Action? Click;
/// Waits for a highlighted render and the following animation tick before executing a quick click.
public bool WaitForPressFeedback { get; set; }
///
/// Returns the number of child views. Used by layout containers and traversal logic.
/// Leaf views should return 0.
///
public override int Count { get; }
///
/// Indexer to access child views by index.
/// Layout containers should implement this to expose their children.
///
public override View this[int index] { get; }
/// Responds to the changed token groups without duplicating theme state on the view.
public void OnDesignTokenChange(DesignSystemChange changes);
///
/// Called when this view becomes dormant — it should stop animations, timers, and event subscriptions.
/// The view may remain in the tree (e.g., in a virtualizing panel's recycle pool).
///
protected override void OnDeactivate();
/// Override to compute the desired border-edge size.
protected override Size MeasureCore(Size available, IMeasureContext context);
/// Override to render this view and its children.
protected override void RenderCore(IContext context);
/// The area available to the label, before applying the design system's padding.
protected virtual Rect LabelBounds { get; }
///
/// Called during event dispatch to handle a pointer event in a specific event phase.
///
public override void OnPointerEvent(ref PointerEventRef e, EventPhase phase);
}
}
namespace Xui.ToolKit.UI.Widgets
{
using Xui.Core.Canvas;
using Xui.Core.Math2D;
using Xui.Core.UI.Input;
using Xui.Core.UI;
using Xui.ToolKit.UI.Design;
///
/// A horizontal group of buttons that share a continuous border.
/// Supports (Filled, Outline, Text) and single selection.
///
public class ButtonGroup : ViewCollection, IDesignSystemChangeNotifications
{
/// Gets or sets the selected button index (0-based).
public int SelectedIndex { get; set; }
/// Invoked when the selection changes.
public Action? SelectionChanged { get; set; }
/// Which color group to use. Default is Primary.
public ColorRole Role { get; set; }
/// Visual style. Default is Outline.
public ButtonVariant Variant { get; set; }
/// Responds to the changed token groups without duplicating theme state on the view.
public void OnDesignTokenChange(DesignSystemChange changes);
///
/// Called when this view becomes dormant — it should stop animations, timers, and event subscriptions.
/// The view may remain in the tree (e.g., in a virtualizing panel's recycle pool).
///
protected override void OnDeactivate();
/// Override to compute the desired border-edge size.
protected override Size MeasureCore(Size available, IMeasureContext context);
/// Override to arrange children within this view's final frame.
protected override void ArrangeCore(Rect rect, IMeasureContext context);
/// Override to render this view and its children.
protected override void RenderCore(IContext context);
}
///
/// A single item inside a . Renders only text — the group draws backgrounds.
///
public class ButtonGroupItem : View, IDesignSystemChangeNotifications
{
/// The item label.
public string Text { get; set; }
///
/// Returns the number of child views. Used by layout containers and traversal logic.
/// Leaf views should return 0.
///
public override int Count { get; }
///
/// Indexer to access child views by index.
/// Layout containers should implement this to expose their children.
///
public override View this[int index] { get; }
/// Responds to the changed token groups without duplicating theme state on the view.
public void OnDesignTokenChange(DesignSystemChange changes);
///
/// Called when this view becomes dormant — it should stop animations, timers, and event subscriptions.
/// The view may remain in the tree (e.g., in a virtualizing panel's recycle pool).
///
protected override void OnDeactivate();
/// Override to compute the desired border-edge size.
protected override Size MeasureCore(Size available, IMeasureContext context);
/// Override to render this view and its children.
protected override void RenderCore(IContext context);
///
/// Called during event dispatch to handle a pointer event in a specific event phase.
///
public override void OnPointerEvent(ref PointerEventRef e, EventPhase phase);
}
///
/// A card-like container with a clickable title that expands/collapses its content
/// with an animated transition. Consumes motion tokens from the design system.
///
public class Expander : View, IDesignSystemChangeNotifications
{
/// The title text shown in the header.
public string Title { get; set; }
/// Gets or sets whether the expander is expanded.
public bool IsExpanded { get; set; }
/// The content view shown when expanded.
public View? Content { get; set; }
///
/// Returns the number of child views. Used by layout containers and traversal logic.
/// Leaf views should return 0.
///
public override int Count { get; }
///
/// Indexer to access child views by index.
/// Layout containers should implement this to expose their children.
///
public override View this[int index] { get; }
///
/// Called when this view becomes active — it will receive events, render, and animate.
/// Override this to start animations, subscribe to data sources, or acquire resources.
///
protected override void OnActivate();
/// Responds to the changed token groups without duplicating theme state on the view.
public void OnDesignTokenChange(DesignSystemChange changes);
///
/// Called when this view becomes dormant — it should stop animations, timers, and event subscriptions.
/// The view may remain in the tree (e.g., in a virtualizing panel's recycle pool).
///
protected override void OnDeactivate();
/// Override to animate this view and its children.
protected override void AnimateCore(TimeSpan previousTime, TimeSpan currentTime);
/// Override to compute the desired border-edge size.
protected override Size MeasureCore(Size available, IMeasureContext context);
/// Override to arrange children within this view's final frame.
protected override void ArrangeCore(Rect rect, IMeasureContext context);
/// Override to render this view and its children.
protected override void RenderCore(IContext context);
///
/// Called during event dispatch to handle a pointer event in a specific event phase.
///
public override void OnPointerEvent(ref PointerEventRef e, EventPhase phase);
}
}
namespace Xui.ToolKit.UI.Widgets
{
///
/// Controls the visual weight of a button.
///
public enum ButtonVariant
{
/// Filled background — highest visual weight. Default for primary actions.
Filled,
/// Outline border only — medium visual weight. For secondary/grouped actions.
Outline,
/// Text only — lowest visual weight. Background appears on hover/press only.
Text,
}
///
/// Selects which color group from the design system a widget should use.
///
public enum ColorRole
{
/// Brand / primary action colors.
Primary,
/// Supporting / secondary action colors.
Secondary,
/// Tertiary highlight / accent colors.
Tertiary,
/// Warning / caution state colors.
Warning,
/// Error / destructive state colors.
Error,
/// Low-contrast neutral colors for quiet buttons, toolbars, etc.
Neutral,
}
}
namespace Xui.ToolKit.UI.Widgets
{
using Xui.Core.Canvas.Composition.Graphics;
using Xui.Core.Canvas;
using Xui.Core.Math2D;
using Xui.Core.UI;
using Xui.ToolKit.UI.Design;
using Xui.ToolKit.UI.Drawing;
///
/// A card container that uses design system tokens for background, outline, shape, and padding.
/// By default uses Surface colors. Set to use a specific color group.
///
public class Card : View, IDesignSystemChangeNotifications
{
/// Content inset. Null uses the design system spacing; zero allows content to reach the card edges.
public nfloat? Padding { get; set; }
/// Clips content to the rounded card outline, useful for content that reaches the edges.
public bool ClipContent { get; set; }
/// Use a keyed native surface for this card's outline, shadow, and content.
public bool UseCompositionGroup { get; set; }
/// Outer shadow fade distance. Zero disables the shadow; layout size is unchanged.
public nfloat ShadowExtent { get; set; }
/// Color and opacity at the shadow's inner edge.
public Color ShadowColor { get; set; }
///
/// Gets this view's conservative bounds in its parent coordinate space for render culling.
///
///
/// A container may override this when its rendered geometry differs from its layout frame.
/// Computing the union of descendant culling frames is deliberately deferred: it can be
/// more expensive than rendering for small subtrees.
///
public override Rect CullingFrame { get; }
/// The content view inside the card.
public View? Content { get; set; }
///
/// When null, the card uses Surface colors. When set, uses the specified color group's
/// Container/OnContainer as background/foreground.
///
public ColorRole? Role { get; set; }
///
/// Returns the number of child views. Used by layout containers and traversal logic.
/// Leaf views should return 0.
///
public override int Count { get; }
///
/// Indexer to access child views by index.
/// Layout containers should implement this to expose their children.
///
public override View this[int index] { get; }
/// Responds to the changed token groups without duplicating theme state on the view.
public void OnDesignTokenChange(DesignSystemChange changes);
///
/// Called when this view becomes dormant — it should stop animations, timers, and event subscriptions.
/// The view may remain in the tree (e.g., in a virtualizing panel's recycle pool).
///
protected override void OnDeactivate();
/// Override to compute the desired border-edge size.
protected override Size MeasureCore(Size available, IMeasureContext context);
/// Override to arrange children within this view's final frame.
protected override void ArrangeCore(Rect rect, IMeasureContext context);
/// Override to render this view and its children.
protected override void RenderCore(IContext context);
}
}
namespace Xui.ToolKit.UI.Widgets
{
using System.Runtime.InteropServices;
using Xui.Core.Canvas;
using Xui.Core.Math2D;
using Xui.Core.UI.Input;
using Xui.Core.UI;
using Xui.ToolKit.UI.Design;
///
/// A checkbox with a checkmark drawn via path commands.
/// Consumes design system tokens for colors, shape, and sizing.
///
public class Checkbox : View, IDesignSystemChangeNotifications
{
/// Gets or sets whether the checkbox is checked.
public bool IsChecked { get; set; }
/// Invoked when the checked state changes.
public Action? Changed { get; set; }
/// Creates a checkbox with content-sized alignment.
public Checkbox();
/// Gets the number of child views, which is always zero.
public override int Count { get; }
/// Gets a child view by index.
/// Always thrown because a checkbox has no child views.
public override View this[int index] { get; }
/// Responds to the changed token groups without duplicating theme state on the view.
public void OnDesignTokenChange(DesignSystemChange changes);
///
/// Called when this view becomes dormant — it should stop animations, timers, and event subscriptions.
/// The view may remain in the tree (e.g., in a virtualizing panel's recycle pool).
///
protected override void OnDeactivate();
/// Measures the checkbox using its design-system-defined square size.
protected override Size MeasureCore(Size available, IMeasureContext context);
/// Renders the checkbox box, border, and optional checkmark.
protected override void RenderCore(IContext context);
/// Updates pointer feedback and toggles the checked state on a completed tap.
public override void OnPointerEvent(ref PointerEventRef e, EventPhase phase);
}
///
/// A radio button (circle with filled dot when selected).
/// Consumes design system tokens for colors and sizing.
///
public class RadioButton : View, IDesignSystemChangeNotifications
{
/// Gets or sets whether the radio button is selected.
public bool IsSelected { get; set; }
/// Invoked when the selection state changes.
public Action? Changed { get; set; }
/// Creates a radio button with content-sized alignment.
public RadioButton();
/// Gets the number of child views, which is always zero.
public override int Count { get; }
/// Gets a child view by index.
/// Always thrown because a radio button has no child views.
public override View this[int index] { get; }
/// Responds to the changed token groups without duplicating theme state on the view.
public void OnDesignTokenChange(DesignSystemChange changes);
///
/// Called when this view becomes dormant — it should stop animations, timers, and event subscriptions.
/// The view may remain in the tree (e.g., in a virtualizing panel's recycle pool).
///
protected override void OnDeactivate();
/// Measures the radio button using its design-system-defined diameter.
protected override Size MeasureCore(Size available, IMeasureContext context);
/// Renders the selected or unselected radio-button indicator.
protected override void RenderCore(IContext context);
/// Updates pointer feedback and selects the button on a completed tap.
public override void OnPointerEvent(ref PointerEventRef e, EventPhase phase);
}
///
/// A toggle switch that slides a thumb circle between on/off positions.
/// Consumes design system tokens for colors, shape, and sizing.
///
public class Toggle : View, IDesignSystemChangeNotifications
{
/// Gets or sets whether the toggle is on.
public bool IsOn { get; set; }
/// Invoked when the toggle value changes.
public Action? Changed { get; set; }
/// Creates a toggle with content-sized alignment.
public Toggle();
/// Gets the number of child views, which is always zero.
public override int Count { get; }
/// Gets a child view by index.
/// Always thrown because a toggle has no child views.
public override View this[int index] { get; }
/// Responds to the changed token groups without duplicating theme state on the view.
public void OnDesignTokenChange(DesignSystemChange changes);
///
/// Called when this view becomes dormant — it should stop animations, timers, and event subscriptions.
/// The view may remain in the tree (e.g., in a virtualizing panel's recycle pool).
///
protected override void OnDeactivate();
/// Measures the toggle using its design-system-defined track dimensions.
protected override Size MeasureCore(Size available, IMeasureContext context);
/// Renders the toggle track and thumb for its current state.
protected override void RenderCore(IContext context);
/// Updates pointer feedback and changes the toggle value on a completed tap.
public override void OnPointerEvent(ref PointerEventRef e, EventPhase phase);
}
}
namespace Xui.ToolKit.UI.Widgets
{
using Xui.Core.Canvas;
using Xui.Core.DI;
using Xui.Core.Math2D;
using Xui.Core.UI.Input;
using Xui.Core.UI;
using Xui.ToolKit.UI.Design;
///
/// A vertical list with selectable items, internally scrollable.
/// Each supports hover and selection states
/// using design system tokens.
///
public class ListView : View, IDesignSystemChangeNotifications
{
/// Gets or sets the selected item index (-1 for no selection).
public int SelectedIndex { get; set; }
/// Invoked when the selection changes.
public Action? SelectionChanged { get; set; }
/// Which color group to use for selection. Default is Primary.
public ColorRole Role { get; set; }
/// Initializes a list view with an internal scrollable content container.
public ListView();
///
/// The items to display. Set via collection initializer.
///
public ReadOnlySpan Content { init; }
///
/// Returns the number of child views. Used by layout containers and traversal logic.
/// Leaf views should return 0.
///
public override int Count { get; }
///
/// Indexer to access child views by index.
/// Layout containers should implement this to expose their children.
///
public override View this[int index] { get; }
/// Responds to the changed token groups without duplicating theme state on the view.
public void OnDesignTokenChange(DesignSystemChange changes);
///
/// Called when this view becomes dormant — it should stop animations, timers, and event subscriptions.
/// The view may remain in the tree (e.g., in a virtualizing panel's recycle pool).
///
protected override void OnDeactivate();
/// Override to compute the desired border-edge size.
protected override Size MeasureCore(Size available, IMeasureContext context);
/// Override to arrange children within this view's final frame.
protected override void ArrangeCore(Rect rect, IMeasureContext context);
/// Override to render this view and its children.
protected override void RenderCore(IContext context);
}
///
/// A single selectable item inside a .
/// Renders hover/selection backgrounds and hosts a content view.
///
public class ListViewItem : View, IDesignSystemChangeNotifications
{
/// The content view displayed inside this item.
public View? ItemContent { get; set; }
///
/// Returns the number of child views. Used by layout containers and traversal logic.
/// Leaf views should return 0.
///
public override int Count { get; }
///
/// Indexer to access child views by index.
/// Layout containers should implement this to expose their children.
///
public override View this[int index] { get; }
/// Responds to the changed token groups without duplicating theme state on the view.
public void OnDesignTokenChange(DesignSystemChange changes);
///
/// Called when this view becomes dormant — it should stop animations, timers, and event subscriptions.
/// The view may remain in the tree (e.g., in a virtualizing panel's recycle pool).
///
protected override void OnDeactivate();
/// Override to compute the desired border-edge size.
protected override Size MeasureCore(Size available, IMeasureContext context);
/// Override to arrange children within this view's final frame.
protected override void ArrangeCore(Rect rect, IMeasureContext context);
/// Override to render this view and its children.
protected override void RenderCore(IContext context);
///
/// Called during event dispatch to handle a pointer event in a specific event phase.
///
public override void OnPointerEvent(ref PointerEventRef e, EventPhase phase);
}
}
namespace Xui.ToolKit.UI.Widgets
{
using Xui.Core.Canvas;
using Xui.Core.Math2D;
using Xui.Core.UI.Input;
using Xui.Core.UI.Layer;
using Xui.Core.UI;
using Xui.ToolKit.UI.Design;
///
/// A design-system-aware text input. Uses the same
/// + layer stack as , but fills all visual
/// properties from tokens instead of exposing them individually.
///
public class TextInput : LayerView>, IDesignSystemChangeNotifications, ITextEditingClient
{
/// Creates a text input with shared native editing state.
public TextInput();
///
/// Gets whether this view can receive keyboard focus via Tab navigation.
///
public override bool Focusable { get; }
/// Keyboard hints, applied when this field receives focus.
public TextInputOptions InputOptions { get; set; }
/// Whether a keyboard action is currently available.
public bool CanPerformInputAction(TextInputAction action);
/// Handles a keyboard action, including focus navigation or finishing editing.
public void PerformInputAction(TextInputAction action);
/// The document and selection shared with the native input system.
public Xui.Core.UI.Input.TextEditingState Editor { get; }
/// Whether a native interaction owns caret, selection handles, and touch selection.
public bool NativeSelection { get; set; }
/// The input's hit-test bounds, in logical window coordinates.
public Rect InputBounds { get; }
/// Returns the caret rectangle for a UTF-16 offset, in logical window coordinates.
public Rect GetCaretRect(int offset, ITextMeasureContext measure);
/// Hit-tests a logical window point, returning a UTF-16 grapheme boundary.
public int GetTextPosition(Point point, ITextMeasureContext measure);
/// Whether the input contains any text.
public bool HasText { get; }
/// Gets or sets the text content.
public string Text { get; set; }
/// Gets or sets whether input is masked as a password.
public bool IsPassword { get; set; }
/// Override to compute the desired border-edge size.
protected override Size MeasureCore(Size availableSize, IMeasureContext context);
/// Override to render this view and its children.
protected override void RenderCore(IContext context);
/// Responds to the changed token groups without duplicating theme state on the view.
public void OnDesignTokenChange(DesignSystemChange changes);
///
/// Called when this view becomes dormant — it should stop animations, timers, and event subscriptions.
/// The view may remain in the tree (e.g., in a virtualizing panel's recycle pool).
///
protected override void OnDeactivate();
}
}