// Generated API outline. Implementation bodies omitted.
#nullable enable
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
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;
using static Xui.Core.Math2D.Constants;
namespace Xui.Core.UI.Layout
{
///
/// A container view that arranges children along a main axis with flexible sizing and wrapping.
/// Container-level properties mirror the CSS Flex Box spec.
///
///
/// Supports row/column layout, wrapping, order, gaps, flexible sizing, and space distribution.
/// Item baseline alignment currently falls back to cross-axis start; line baseline alignment
/// falls back to start. Views do not yet expose a common layout-baseline contract.
///
public partial class FlexBox
{
///
/// Aligns flex lines along the cross axis when there is extra space (only applies when wrapping).
/// Corresponds to the CSS align-content property on a flex container.
///
public enum AlignContent : byte
{
/// Browser default. Acts like .
Normal = 0,
/// Lines are packed toward the flex-start edge of the cross axis.
FlexStart = 1,
/// Lines are packed toward the flex-end edge of the cross axis.
FlexEnd = 2,
/// Lines are centered on the cross axis.
Center = 3,
/// Lines are evenly distributed; first line at start, last at end.
SpaceBetween = 4,
/// Lines are evenly distributed with equal space around each line.
SpaceAround = 5,
/// Lines are evenly distributed with equal space between all lines including edges.
SpaceEvenly = 6,
/// Lines are stretched to fill the container.
Stretch = 7,
/// Lines are aligned along their first baseline.
FirstBaseline = 8,
/// Lines are aligned along their last baseline.
LastBaseline = 9,
}
}
///
/// A container view that arranges children along a main axis with flexible sizing and wrapping.
/// Container-level properties mirror the CSS Flex Box spec.
///
///
/// Supports row/column layout, wrapping, order, gaps, flexible sizing, and space distribution.
/// Item baseline alignment currently falls back to cross-axis start; line baseline alignment
/// falls back to start. Views do not yet expose a common layout-baseline contract.
///
public partial class FlexBox
{
///
/// Sets the default cross-axis alignment for all flex items on a line.
/// Corresponds to the CSS align-items property on a flex container.
///
public enum AlignItems : byte
{
/// Browser default. Acts like .
Normal = 0,
/// Items are stretched to fill the cross axis.
Stretch = 1,
/// Items are packed toward the flex-start edge of the cross axis.
FlexStart = 2,
/// Items are packed toward the flex-end edge of the cross axis.
FlexEnd = 3,
/// Items are centered on the cross axis.
Center = 4,
/// Items are aligned along their first baseline.
Baseline = 5,
/// Items are aligned along their first baseline (same as ).
FirstBaseline = 6,
/// Items are aligned along their last baseline.
LastBaseline = 7,
}
}
///
/// A container view that arranges children along a main axis with flexible sizing and wrapping.
/// Container-level properties mirror the CSS Flex Box spec.
///
///
/// Supports row/column layout, wrapping, order, gaps, flexible sizing, and space distribution.
/// Item baseline alignment currently falls back to cross-axis start; line baseline alignment
/// falls back to start. Views do not yet expose a common layout-baseline contract.
///
public partial class FlexBox
{
///
/// Specifies the direction of the main axis along which flex items are placed.
/// Corresponds to the CSS flex-direction property.
///
public new enum Direction : byte
{
/// Items are placed left to right (inline-start to inline-end).
Row = 0,
/// Items are placed right to left (inline-end to inline-start).
RowReverse = 1,
/// Items are placed top to bottom (block-start to block-end).
Column = 2,
/// Items are placed bottom to top (block-end to block-start).
ColumnReverse = 3,
}
}
///
/// A container view that arranges children along a main axis with flexible sizing and wrapping.
/// Container-level properties mirror the CSS Flex Box spec.
///
///
/// Supports row/column layout, wrapping, order, gaps, flexible sizing, and space distribution.
/// Item baseline alignment currently falls back to cross-axis start; line baseline alignment
/// falls back to start. Views do not yet expose a common layout-baseline contract.
///
public partial class FlexBox
{
///
/// Controls the order in which the item appears within the flex container, overriding source order.
/// Corresponds to CSS order.
///
public static readonly View.Extra Order;
///
/// How much the item will grow relative to other flex items when free space is available.
/// Corresponds to CSS flex-grow. Default is 0 (does not grow).
///
public static readonly View.Extra Grow;
///
/// How much the item will shrink relative to other flex items when space is insufficient.
/// Corresponds to CSS flex-shrink. Default is 1 (shrinks evenly).
///
public static readonly View.Extra Shrink;
///
/// The initial size of the item along the main axis before free space is distributed.
/// nfloat.NaN means auto (use the item's width or height).
/// Corresponds to CSS flex-basis.
///
public static readonly View.Extra Basis;
}
///
/// A container view that arranges children along a main axis with flexible sizing and wrapping.
/// Container-level properties mirror the CSS Flex Box spec.
///
///
/// Supports row/column layout, wrapping, order, gaps, flexible sizing, and space distribution.
/// Item baseline alignment currently falls back to cross-axis start; line baseline alignment
/// falls back to start. Views do not yet expose a common layout-baseline contract.
///
public partial class FlexBox
{
///
/// Aligns flex items along the main axis when there is free space.
/// Corresponds to the CSS justify-content property on a flex container.
///
public enum JustifyContent : byte
{
/// Browser default. Acts like .
Normal = 0,
/// Items are packed toward the flex-start edge of the main axis.
FlexStart = 1,
/// Items are packed toward the flex-end edge of the main axis.
FlexEnd = 2,
/// Items are centered along the main axis.
Center = 3,
/// Items are evenly distributed; first item at start, last at end.
SpaceBetween = 4,
/// Items are evenly distributed with equal space around each item.
SpaceAround = 5,
/// Items are evenly distributed with equal space between all items including edges.
SpaceEvenly = 6,
/// Items are packed toward the start of the main axis.
Start = 7,
/// Items are packed toward the end of the main axis.
End = 8,
}
}
///
/// A container view that arranges children along a main axis with flexible sizing and wrapping.
/// Container-level properties mirror the CSS Flex Box spec.
///
///
/// Supports row/column layout, wrapping, order, gaps, flexible sizing, and space distribution.
/// Item baseline alignment currently falls back to cross-axis start; line baseline alignment
/// falls back to start. Views do not yet expose a common layout-baseline contract.
///
public partial class FlexBox
{
///
/// Controls whether flex items are forced onto a single line or can wrap onto multiple lines.
/// Corresponds to the CSS flex-wrap property.
///
public enum Wrap : byte
{
/// All flex items are on a single line.
NoWrap = 0,
/// Flex items wrap onto additional lines in the block-start direction.
Wrap = 1,
/// Flex items wrap onto additional lines in the block-end direction.
WrapReverse = 2,
}
}
///
/// A container view that arranges children along a main axis with flexible sizing and wrapping.
/// Container-level properties mirror the CSS Flex Box spec.
///
///
/// Supports row/column layout, wrapping, order, gaps, flexible sizing, and space distribution.
/// Item baseline alignment currently falls back to cross-axis start; line baseline alignment
/// falls back to start. Views do not yet expose a common layout-baseline contract.
///
public partial class FlexBox : ViewCollection
{
///
/// Sets the main axis direction along which flex items are placed.
/// Corresponds to flex-direction. Default is .
///
public Direction FlexDirection { get; set; }
///
/// Controls whether flex items wrap onto multiple lines.
/// Corresponds to flex-wrap. Default is .
///
public Wrap FlexWrap { get; set; }
///
/// Aligns flex items along the main axis when there is free space.
/// Corresponds to justify-content. Default is .
///
public JustifyContent FlexJustifyContent { get; set; }
///
/// Sets the default cross-axis alignment for all flex items on a line.
/// Corresponds to align-items. Default is .
///
public AlignItems FlexAlignItems { get; set; }
///
/// Aligns flex lines along the cross axis when there is extra space (only applies when wrapping).
/// Corresponds to align-content. Default is .
///
public AlignContent FlexAlignContent { get; set; }
///
/// Space between rows of flex items.
/// Corresponds to row-gap. Default is 0.
///
public nfloat RowGap { get; set; }
///
/// Space between columns of flex items.
/// Corresponds to column-gap. Default is 0.
///
public nfloat ColumnGap { get; set; }
}
///
/// A container view that arranges children in a grid of rows and columns.
/// Container-level properties mirror the CSS Grid spec.
///
///
/// CSS Grid Layout implementation for the Grid container.
/// Provides MeasureCore and ArrangeCore implementations following the CSS Grid Layout Module Level 1 specification.
///
///
/// Implementation notes:
///
/// - Track sizing supports: Length, Auto, MinContent, MaxContent, Fr (fractional units), MinMax, and FitContent
/// - Auto-placement follows grid-auto-flow (row or column direction)
/// - Named grid areas are parsed from TemplateAreas
/// - Gaps are applied between tracks
/// - Alignment is supported via justify-items, align-items, justify-content, align-content
/// - Child positioning via grid-row-start/end, grid-column-start/end, and grid-area
///
/// Algorithm approach:
///
/// - Build grid structure: parse areas, determine placement for each child
/// - Measure tracks: resolve fixed sizes, content-based sizes, then distribute fr units
/// - Arrange children: position each child in its grid area with alignment
///
///
public partial class Grid
{
///
/// Aligns the grid along the block axis within the container when the grid is smaller than the container.
/// Corresponds to the CSS align-content property on a grid container.
///
public enum AlignContent : byte
{
/// Browser default. Acts like .
Normal = 0,
/// Rows are packed toward the start of the block axis.
Start = 1,
/// Rows are packed toward the end of the block axis.
End = 2,
/// Rows are centered on the block axis.
Center = 3,
/// Rows are evenly distributed; first row at start, last at end.
SpaceBetween = 4,
/// Rows are evenly distributed with equal space around each row.
SpaceAround = 5,
/// Rows are evenly distributed with equal space between all rows including edges.
SpaceEvenly = 6,
/// Rows are stretched to fill the container block size.
Stretch = 7,
/// Rows are aligned along their first baseline.
FirstBaseline = 8,
/// Rows are aligned along their last baseline.
LastBaseline = 9,
}
}
///
/// A container view that arranges children in a grid of rows and columns.
/// Container-level properties mirror the CSS Grid spec.
///
///
/// CSS Grid Layout implementation for the Grid container.
/// Provides MeasureCore and ArrangeCore implementations following the CSS Grid Layout Module Level 1 specification.
///
///
/// Implementation notes:
///
/// - Track sizing supports: Length, Auto, MinContent, MaxContent, Fr (fractional units), MinMax, and FitContent
/// - Auto-placement follows grid-auto-flow (row or column direction)
/// - Named grid areas are parsed from TemplateAreas
/// - Gaps are applied between tracks
/// - Alignment is supported via justify-items, align-items, justify-content, align-content
/// - Child positioning via grid-row-start/end, grid-column-start/end, and grid-area
///
/// Algorithm approach:
///
/// - Build grid structure: parse areas, determine placement for each child
/// - Measure tracks: resolve fixed sizes, content-based sizes, then distribute fr units
/// - Arrange children: position each child in its grid area with alignment
///
///
public partial class Grid
{
///
/// Sets the default block-axis alignment for all grid items within their grid areas.
/// Corresponds to the CSS align-items property on a grid container.
///
public enum AlignItems : byte
{
/// Browser default. Acts like .
Normal = 0,
/// Items are stretched to fill the grid area block size.
Stretch = 1,
/// Items are packed toward the start of the block axis.
Start = 2,
/// Items are packed toward the end of the block axis.
End = 3,
/// Items are centered on the block axis.
Center = 4,
/// Items are aligned along their first baseline.
Baseline = 5,
/// Items are aligned along their first baseline (same as ).
FirstBaseline = 6,
/// Items are aligned along their last baseline.
LastBaseline = 7,
}
}
///
/// A container view that arranges children in a grid of rows and columns.
/// Container-level properties mirror the CSS Grid spec.
///
///
/// CSS Grid Layout implementation for the Grid container.
/// Provides MeasureCore and ArrangeCore implementations following the CSS Grid Layout Module Level 1 specification.
///
///
/// Implementation notes:
///
/// - Track sizing supports: Length, Auto, MinContent, MaxContent, Fr (fractional units), MinMax, and FitContent
/// - Auto-placement follows grid-auto-flow (row or column direction)
/// - Named grid areas are parsed from TemplateAreas
/// - Gaps are applied between tracks
/// - Alignment is supported via justify-items, align-items, justify-content, align-content
/// - Child positioning via grid-row-start/end, grid-column-start/end, and grid-area
///
/// Algorithm approach:
///
/// - Build grid structure: parse areas, determine placement for each child
/// - Measure tracks: resolve fixed sizes, content-based sizes, then distribute fr units
/// - Arrange children: position each child in its grid area with alignment
///
///
public partial class Grid
{
///
/// Controls how auto-placed items are inserted into the grid.
/// Corresponds to the CSS grid-auto-flow property.
///
public enum AutoFlow : byte
{
/// Auto-placed items fill each row in turn, adding new rows as needed.
Row = 0,
/// Auto-placed items fill each column in turn, adding new columns as needed.
Column = 1,
///
/// Auto-placed items fill each row, using a dense packing algorithm that attempts
/// to fill in holes earlier in the grid.
///
RowDense = 2,
///
/// Auto-placed items fill each column, using a dense packing algorithm that attempts
/// to fill in holes earlier in the grid.
///
ColumnDense = 3,
}
}
///
/// A container view that arranges children in a grid of rows and columns.
/// Container-level properties mirror the CSS Grid spec.
///
///
/// CSS Grid Layout implementation for the Grid container.
/// Provides MeasureCore and ArrangeCore implementations following the CSS Grid Layout Module Level 1 specification.
///
///
/// Implementation notes:
///
/// - Track sizing supports: Length, Auto, MinContent, MaxContent, Fr (fractional units), MinMax, and FitContent
/// - Auto-placement follows grid-auto-flow (row or column direction)
/// - Named grid areas are parsed from TemplateAreas
/// - Gaps are applied between tracks
/// - Alignment is supported via justify-items, align-items, justify-content, align-content
/// - Child positioning via grid-row-start/end, grid-column-start/end, and grid-area
///
/// Algorithm approach:
///
/// - Build grid structure: parse areas, determine placement for each child
/// - Measure tracks: resolve fixed sizes, content-based sizes, then distribute fr units
/// - Arrange children: position each child in its grid area with alignment
///
///
public partial class Grid
{
///
/// The grid line where the item's row starts (1-indexed). 0 means auto.
/// Corresponds to CSS grid-row-start.
///
public static readonly View.Extra RowStart;
///
/// The grid line where the item's row ends (1-indexed, exclusive). 0 means auto.
/// Corresponds to CSS grid-row-end.
///
public static readonly View.Extra RowEnd;
///
/// The grid line where the item's column starts (1-indexed). 0 means auto.
/// Corresponds to CSS grid-column-start.
///
public static readonly View.Extra ColumnStart;
///
/// The grid line where the item's column ends (1-indexed, exclusive). 0 means auto.
/// Corresponds to CSS grid-column-end.
///
public static readonly View.Extra ColumnEnd;
///
/// Places the item into a named grid area defined by .
/// Corresponds to CSS grid-area.
///
public static readonly View.Extra Area;
///
/// Controls the order in which the item appears within the grid, overriding source order.
/// Corresponds to CSS order.
///
public static readonly View.Extra Order;
///
/// The number of rows the item spans. Shorthand for setting = + RowSpan.
///
public static readonly View.Extra RowSpan;
///
/// The number of columns the item spans. Shorthand for setting = + ColumnSpan.
///
public static readonly View.Extra ColumnSpan;
}
///
/// A container view that arranges children in a grid of rows and columns.
/// Container-level properties mirror the CSS Grid spec.
///
///
/// CSS Grid Layout implementation for the Grid container.
/// Provides MeasureCore and ArrangeCore implementations following the CSS Grid Layout Module Level 1 specification.
///
///
/// Implementation notes:
///
/// - Track sizing supports: Length, Auto, MinContent, MaxContent, Fr (fractional units), MinMax, and FitContent
/// - Auto-placement follows grid-auto-flow (row or column direction)
/// - Named grid areas are parsed from TemplateAreas
/// - Gaps are applied between tracks
/// - Alignment is supported via justify-items, align-items, justify-content, align-content
/// - Child positioning via grid-row-start/end, grid-column-start/end, and grid-area
///
/// Algorithm approach:
///
/// - Build grid structure: parse areas, determine placement for each child
/// - Measure tracks: resolve fixed sizes, content-based sizes, then distribute fr units
/// - Arrange children: position each child in its grid area with alignment
///
///
public partial class Grid
{
///
/// Aligns the grid along the inline axis within the container when the grid is smaller than the container.
/// Corresponds to the CSS justify-content property on a grid container.
///
public enum JustifyContent : byte
{
/// Browser default. Acts like .
Normal = 0,
/// Grid is packed toward the start of the inline axis.
Start = 1,
/// Grid is packed toward the end of the inline axis.
End = 2,
/// Grid is centered along the inline axis.
Center = 3,
/// Grid is packed toward the left end of the inline axis.
Left = 4,
/// Grid is packed toward the right end of the inline axis.
Right = 5,
/// Columns are evenly distributed; first column at start, last at end.
SpaceBetween = 6,
/// Columns are evenly distributed with equal space around each column.
SpaceAround = 7,
/// Columns are evenly distributed with equal space between all columns including edges.
SpaceEvenly = 8,
/// Columns are stretched to fill the container inline size.
Stretch = 9,
}
}
///
/// A container view that arranges children in a grid of rows and columns.
/// Container-level properties mirror the CSS Grid spec.
///
///
/// CSS Grid Layout implementation for the Grid container.
/// Provides MeasureCore and ArrangeCore implementations following the CSS Grid Layout Module Level 1 specification.
///
///
/// Implementation notes:
///
/// - Track sizing supports: Length, Auto, MinContent, MaxContent, Fr (fractional units), MinMax, and FitContent
/// - Auto-placement follows grid-auto-flow (row or column direction)
/// - Named grid areas are parsed from TemplateAreas
/// - Gaps are applied between tracks
/// - Alignment is supported via justify-items, align-items, justify-content, align-content
/// - Child positioning via grid-row-start/end, grid-column-start/end, and grid-area
///
/// Algorithm approach:
///
/// - Build grid structure: parse areas, determine placement for each child
/// - Measure tracks: resolve fixed sizes, content-based sizes, then distribute fr units
/// - Arrange children: position each child in its grid area with alignment
///
///
public partial class Grid
{
///
/// Sets the default justify-self for all items, aligning them along the inline axis within their grid area.
/// Corresponds to the CSS justify-items property.
///
public enum JustifyItems : byte
{
/// Browser default. Acts like .
Normal = 0,
/// Items are stretched to fill the grid area inline size.
Stretch = 1,
/// Items are packed toward the start of the inline axis.
Start = 2,
/// Items are packed toward the end of the inline axis.
End = 3,
/// Items are centered along the inline axis.
Center = 4,
/// Items are packed toward the left end of the inline axis.
Left = 5,
/// Items are packed toward the right end of the inline axis.
Right = 6,
/// Items are aligned along their first baseline.
Baseline = 7,
/// Items are aligned along their first baseline (same as ).
FirstBaseline = 8,
/// Items are aligned along their last baseline.
LastBaseline = 9,
}
}
///
/// A container view that arranges children in a grid of rows and columns.
/// Container-level properties mirror the CSS Grid spec.
///
///
/// CSS Grid Layout implementation for the Grid container.
/// Provides MeasureCore and ArrangeCore implementations following the CSS Grid Layout Module Level 1 specification.
///
///
/// Implementation notes:
///
/// - Track sizing supports: Length, Auto, MinContent, MaxContent, Fr (fractional units), MinMax, and FitContent
/// - Auto-placement follows grid-auto-flow (row or column direction)
/// - Named grid areas are parsed from TemplateAreas
/// - Gaps are applied between tracks
/// - Alignment is supported via justify-items, align-items, justify-content, align-content
/// - Child positioning via grid-row-start/end, grid-column-start/end, and grid-area
///
/// Algorithm approach:
///
/// - Build grid structure: parse areas, determine placement for each child
/// - Measure tracks: resolve fixed sizes, content-based sizes, then distribute fr units
/// - Arrange children: position each child in its grid area with alignment
///
///
public partial class Grid
{
///
/// Represents a single CSS grid track sizing value such as a length, fr unit,
/// auto, min-content, max-content, minmax(), or fit-content().
///
public readonly struct TrackSize
{
/// The kind of track sizing function.
public TrackSizeKind Kind { get; }
/// Pixel length for the track.
public nfloat Value { get; }
/// Minimum value for tracks.
public nfloat MinValue { get; }
/// Maximum value for and tracks.
public nfloat MaxValue { get; }
/// The track sizes to content automatically. Equivalent to CSS auto.
public static readonly TrackSize Auto;
/// The track is sized to the smallest size that fits its content without overflow. Equivalent to CSS min-content.
public static readonly TrackSize MinContent;
/// The track is sized to the largest max-content contribution of its items. Equivalent to CSS max-content.
public static readonly TrackSize MaxContent;
/// Creates a track of an exact pixel length.
public static TrackSize Px(nfloat px);
/// Creates a fractional track. Fr(1) = CSS 1fr.
public static TrackSize Fr(nfloat fr);
/// Creates a minmax(min, max) track with pixel min and max values.
public static TrackSize MinMax(nfloat min, nfloat max);
/// Creates a fit-content(max) track clamped to the given pixel maximum.
public static TrackSize FitContent(nfloat max);
/// Implicitly converts a pixel value to a track.
public static implicit operator TrackSize(nfloat px);
/// Implicitly converts a pixel value to a track.
public static implicit operator TrackSize(float px);
/// Implicitly converts a pixel value to a track.
public static implicit operator TrackSize(double px);
/// Implicitly converts a pixel value to a track.
public static implicit operator TrackSize(int px);
/// Returns the fully qualified type name of this instance.
/// The fully qualified type name.
public override string ToString();
}
/// Identifies the kind of sizing function a represents.
public enum TrackSizeKind : byte
{
/// Sized to available space (auto).
Auto = 0,
/// Sized to smallest content contribution (min-content).
MinContent = 1,
/// Sized to largest content contribution (max-content).
MaxContent = 2,
/// Fixed pixel length.
Length = 3,
/// Flexible fractional unit (fr).
Fr = 4,
/// Clamped between a min and a max (minmax()).
MinMax = 5,
/// Like but clamped to a maximum (fit-content()).
FitContent = 6,
}
}
///
/// A container view that arranges children in a grid of rows and columns.
/// Container-level properties mirror the CSS Grid spec.
///
///
/// CSS Grid Layout implementation for the Grid container.
/// Provides MeasureCore and ArrangeCore implementations following the CSS Grid Layout Module Level 1 specification.
///
///
/// Implementation notes:
///
/// - Track sizing supports: Length, Auto, MinContent, MaxContent, Fr (fractional units), MinMax, and FitContent
/// - Auto-placement follows grid-auto-flow (row or column direction)
/// - Named grid areas are parsed from TemplateAreas
/// - Gaps are applied between tracks
/// - Alignment is supported via justify-items, align-items, justify-content, align-content
/// - Child positioning via grid-row-start/end, grid-column-start/end, and grid-area
///
/// Algorithm approach:
///
/// - Build grid structure: parse areas, determine placement for each child
/// - Measure tracks: resolve fixed sizes, content-based sizes, then distribute fr units
/// - Arrange children: position each child in its grid area with alignment
///
///
public partial class Grid : ViewCollection
{
///
/// Defines the track sizes for explicitly defined columns.
/// Corresponds to grid-template-columns. Default is an empty array (no explicit columns).
///
public TrackSize[] TemplateColumns { get; set; }
///
/// Defines the track sizes for explicitly defined rows.
/// Corresponds to grid-template-rows. Default is an empty array (no explicit rows).
///
public TrackSize[] TemplateRows { get; set; }
///
/// Defines named grid areas. Each string in the array defines one row; space-separated cell names
/// define columns within that row. A dot (.) denotes an unnamed cell.
/// Corresponds to grid-template-areas. Default is an empty array.
///
public string[] TemplateAreas { get; set; }
///
/// Sizing for implicitly created columns (those outside ).
/// Corresponds to grid-auto-columns. Default is .
///
public TrackSize AutoColumns { get; set; }
///
/// Sizing for implicitly created rows (those outside ).
/// Corresponds to grid-auto-rows. Default is .
///
public TrackSize AutoRows { get; set; }
///
/// Controls how auto-placed items flow into the grid.
/// Corresponds to grid-auto-flow. Default is .
///
public AutoFlow GridAutoFlow { get; set; }
///
/// Sets the default inline-axis alignment for all grid items within their grid areas.
/// Corresponds to justify-items. Default is .
///
public JustifyItems GridJustifyItems { get; set; }
///
/// Sets the default block-axis alignment for all grid items within their grid areas.
/// Corresponds to align-items. Default is .
///
public AlignItems GridAlignItems { get; set; }
///
/// Aligns the grid along the inline axis within the container when the grid is smaller than the container.
/// Corresponds to justify-content. Default is .
///
public JustifyContent GridJustifyContent { get; set; }
///
/// Aligns the grid along the block axis within the container when the grid is smaller than the container.
/// Corresponds to align-content. Default is .
///
public AlignContent GridAlignContent { get; set; }
///
/// Space between grid rows.
/// Corresponds to row-gap. Default is 0.
///
public nfloat RowGap { get; set; }
///
/// Space between grid columns.
/// Corresponds to column-gap. Default is 0.
///
public nfloat ColumnGap { get; set; }
}
}
namespace Xui.Core.UI.Layout
{
using Xui.Core.Canvas;
using Xui.Core.Math2D;
///
/// A container view that arranges children along a main axis with flexible sizing and wrapping.
/// Container-level properties mirror the CSS Flex Box spec.
///
///
/// Supports row/column layout, wrapping, order, gaps, flexible sizing, and space distribution.
/// Item baseline alignment currently falls back to cross-axis start; line baseline alignment
/// falls back to start. Views do not yet expose a common layout-baseline contract.
///
public partial class FlexBox
{
/// 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);
}
///
/// A container view that arranges children in a grid of rows and columns.
/// Container-level properties mirror the CSS Grid spec.
///
///
/// CSS Grid Layout implementation for the Grid container.
/// Provides MeasureCore and ArrangeCore implementations following the CSS Grid Layout Module Level 1 specification.
///
///
/// Implementation notes:
///
/// - Track sizing supports: Length, Auto, MinContent, MaxContent, Fr (fractional units), MinMax, and FitContent
/// - Auto-placement follows grid-auto-flow (row or column direction)
/// - Named grid areas are parsed from TemplateAreas
/// - Gaps are applied between tracks
/// - Alignment is supported via justify-items, align-items, justify-content, align-content
/// - Child positioning via grid-row-start/end, grid-column-start/end, and grid-area
///
/// Algorithm approach:
///
/// - Build grid structure: parse areas, determine placement for each child
/// - Measure tracks: resolve fixed sizes, content-based sizes, then distribute fr units
/// - Arrange children: position each child in its grid area with alignment
///
///
public partial class Grid
{
/// Override to compute the desired border-edge size.
protected override Size MeasureCore(Size availableBorderEdgeSize, IMeasureContext context);
/// Override to arrange children within this view's final frame.
protected override void ArrangeCore(Rect rect, IMeasureContext context);
}
}