public sealed class BuildContextWhat a Component's Build constructs with, and what Vixen.Ui.Markup emits calls to.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
Per ADR-010 every method here does one thing once. Element creates an element; Attribute sets a value that will never change; Bind registers one effect that assigns one property. Nothing walks a tree, nothing diffs, and a steady-state interface allocates nothing because nothing runs.
The two exceptions are Switch and For, which is the point: those are the only two places where the shape of the tree depends on state, so those are the only two places that add and remove elements.
Fields and properties (4)
public const string DefaultSlotThe name of the slot a component's children go to when they name none.
public UiDocument DocumentThe document being built into.
public UiElement MountThe element the root component hangs from.
public UiElement AnchorWhat a null parent means right now.
Methods (41)
public static T Build<T>(UiDocument document, UiElement mount) where T : Component, new()Builds a component into a document.
public static BuildContext BuildInto(Component component, UiDocument document, UiElement mount)Builds an already-created component, so a caller can choose how it was made.
public static IDisposable Compose(UiElement host, Action<BuildContext> build, string? scope = null)Builds a markup-authored element's own tree into itself.
public void Rebuild(Component component)Throws away what a component built and builds it again.
public UiElement Element(UiElement? parent, string tag)Creates an intrinsic element.
public T Child<T>(UiElement? parent) where T : IComposable, new()Creates whatever a capitalised tag named, and builds it if it is a component.
public T Child<T>(UiElement? parent, string? tag) where T : IComposable, new()The same, under a tag of the caller's choosing.
public T Create<T>(UiElement? parent) where T : IComposable, new()Creates a child without building it, so its parameters can be assigned first.
public T Create<T>(UiElement? parent, string? tag) where T : IComposable, new()The same, under a tag of the caller's choosing.
public void Compose<T>(T created) where T : IComposableRuns the Build of what Create``1 made.
public static UiElement Host(Component component)The element an attribute written on a capitalised tag applies to.
public static UiElement Host(UiElement element)public static UiElement Bindable(UiElement element)The element a bind: or a change: names a property on.
public static UiElement Bindable(Component component)public static UiElement Inner(Component component)Where the content written inside a capitalised tag goes.
public static UiElement Inner(UiElement element)public static void Subscribe(string name, Action<UiElement, Action<UiEvent>, EventSubscription> subscribe)Teaches the runtime an event name, or changes what one already means.
public UiElement Text(UiElement? parent, string text)Creates an element holding fixed text.
public UiElement Text(UiElement? parent, Func<object?> text, string? origin = null, int line = 0)Creates an element holding text that follows an expression.
public void Attribute(UiElement target, string name, string value)Sets a value that will not change.
public void Bind(UiElement target, string name, Func<object?> value, string? origin = null, int line = 0)Keeps an attribute equal to an expression.
public void Bind(Action assign, string? origin = null, int line = 0)Runs an assignment now, and again whenever what it read changes.
public IReadOnlySignal<AsyncValue<T>> Load<TRequest, T>(Func<TRequest> request, Func<TRequest, CancellationToken, Task<T>> load)Runs asynchronous work for as long as whatever declared it is in the document.
public IReadOnlySignal<AsyncValue<T>> Load<T>(Func<CancellationToken, Task<T>> load)The arrival case: work that runs once because it asks for nothing.
public void Use<T>(T target, Action<T> action, string? origin = null, int line = 0)Runs an expression against what a tag made, now and again whenever what it read changes.
public static void Describes(Func<UiElement, UiElement> attach)Says what describes an element, for markup's help.
public static void Contextualises(Action<UiElement, UiElement> attach)Says how a menu is attached to an element, for markup's context-menu.
public void Help(UiElement target, string text)Describes an element with fixed text, which is markup's help="Save the scene".
public void Help(UiElement target, Func<object?> text, string? origin = null, int line = 0)Describes an element with text that follows an expression.
public static void Menu(UiElement target, UiElement menu)Makes a secondary click on an element open a menu, which is markup's context-menu.
public void On(UiElement target, string name, Action handler, params string[] modifiers)Subscribes a handler to an event by name.
public void On<TEvent>(UiElement target, string name, Action<TEvent> handler, params string[] modifiers) where TEvent : UiEventSubscribes a handler that wants the event.
public void TwoWay<T>(UiElement target, string name, Func<T> get, Action<T> set, params string[] commits)Binds a property in both directions.
public void Changed<T>(UiElement target, string name, Func<T> read, Action<T> handler)Calls a handler whenever a property changes, other than because a binding wrote it.
public void Refs<TElement>(ElementRefs<TElement> refs, TElement element) where TElement : UiElementRegisters an @for row's element under the key the loop reconciles it on.
public UiElement Slot(UiElement? parent, string name)Declares where a caller's children go.
public static UiElement Into(Component component, string name)Where content a consumer addressed to a named slot goes.
public static UiElement Into(UiElement element, string name)public void Switch(UiElement? parent, Func<int> arm, Action<BuildContext, UiElement, int> build)Builds whichever arm a selector picks, and rebuilds when it picks another.
public void For<T>(UiElement? parent, Func<IEnumerable<T>> items, Func<T, object> key, Action<BuildContext, UiElement, T> build, ExitSpec? exit = null, Action<BuildContext, UiElement>? empty = null)Builds one subtree per item, keyed, and reconciles when the sequence changes.
public void For<T>(UiElement? parent, Func<IEnumerable<T>> items, Func<T, object> key, Action<BuildContext, UiElement, T, Signal<int>> build, ExitSpec? exit = null, Action<BuildContext, UiElement>? empty = null)The same, with each row told where it is.
Used by (212, showing 40)
- ActionBarMmo.Ui
- BagGridMmo.Ui
- ChatPanelMmo.Ui
- GalleryHelloUi
- HierarchyHelloUi
- HudMmo.Ui
- HudTestsMmo.Ui.Tests
- InspectorHelloUi
- LootRollMmo.Ui
- QuestTrackerMmo.Ui
- ShellHelloUi
- UnitFrameMmo.Ui
- VendorPanelMmo.Ui
- AmbientAcrossDockingTestsVixen.Ui.Controls.Advanced.Tests
- AmbientConsumerVixen.Ui.Controls.Tests
- AmbientHostVixen.Ui.Controls.Tests
- AmbientProviderVixen.Ui.Controls.Tests
- AmbientValueTestsVixen.Ui.Controls.Tests
- AsyncArrivalTestsVixen.Ui.Controls.Tests
- AsyncGuestVixen.Ui.Controls.Tests
- AsyncHostVixen.Ui.Controls.Tests
- AttachmentSeamTestsVixen.Ui.Tests
- BadEventVixen.Ui.Tests
- BadWatcherVixen.Ui.Controls.Advanced.Tests
- BarVixen.Ui.Controls.Tests
- BareVixen.Ui.Tests
- BindReachSheetVixen.Ui.Controls.Tests
- BindReachTestsVixen.Ui.Controls.Tests
- BoundVixen.Ui.Tests
- BoundOverlaySheetVixen.Ui.Controls.Tests
- BoxedVixen.Ui.Controls.Tests
- BoxesVixen.Ui.HotReload.Tests
- BoxesVixen.Ui.HotReload.Tests
- BranchingVixen.Ui.Tests
- BranchingRefsVixen.Ui.Tests
- BrokenBindingTestsVixen.Ui.Tests
- CarryingVixen.Ui.HotReload.Tests
- ClickableVixen.Ui.Controls.Tests
- ClickableVixen.Ui.Tests
- ColorPickerTestsVixen.Ui.Controls.Advanced.Tests