clayui.dhover×185 error×12all
/**
A thin D face for Clay (`clay_impl.c`, compiled by ImportC), for the build
benchmark: the calls Clay's C macros expand to, wrapped so a view reads like
the other builders' views — and nothing more between the view and Clay.

    CLAY_AUTO_ID({ .layout = { .layoutDirection = CLAY_TOP_TO_BOTTOM, .childGap = 1 } }) { … }

becomes

    with (ui.column(gap: 1)) { … }

which is `Clay__OpenElement(); Clay__ConfigureOpenElement(decl);` at the
`with` and `Clay__CloseElement()` when it ends (the macro's `for` latch). A
keyed element is `Clay__OpenElementWithId(Clay__HashString(key,
Clay_GetOpenElementId()))`, i.e. `CLAY(CLAY_SID_LOCAL(key), …)`.

Leaves are Clay elements with FIXED sizing (the width computed here, as the
other builders compute it) and a background colour, so each leaf emits one
render command at `Clay_EndLayout`. Clay text elements cannot reproduce the
other builders' leaf sizes without a different tree (see README.md).

`Side` = `true` adds the per-leaf side work the sketches' builders do and Clay
does not: every text interned into a `BumpTextPool` (a copy) and every
`ui.on(msg)` copied into an argument arena and a message table, as
`lazystack.Ui.on` does.
*/
module 
(module) clayui

A thin D face for Clay (clay_impl.c, compiled by ImportC), for the build benchmark: the calls Clay's C macros expand to, wrapped so a view reads like the other builders' views — and nothing more between the view and Clay.

CLAY_AUTO_ID({ .layout = { .layoutDirection = CLAY_TOP_TO_BOTTOM, .childGap = 1 } }) { … }

becomes

with (ui.column(gap: 1)) { … }

which is Clay__OpenElement(); Clay__ConfigureOpenElement(decl); at the with and Clay__CloseElement() when it ends (the macro's for latch). A keyed element is Clay__OpenElementWithId(Clay__HashString(key, Clay_GetOpenElementId())), i.e. CLAY(CLAY_SID_LOCAL(key), …).

Leaves are Clay elements with FIXED sizing (the width computed here, as the other builders compute it) and a background colour, so each leaf emits one render command at Clay_EndLayout. Clay text elements cannot reproduce the other builders' leaf sizes without a different tree (see README.md).

Side = true adds the per-leaf side work the sketches' builders do and Clay does not: every text interned into a BumpTextPool (a copy) and every ui.on(msg) copied into an argument arena and a message table, as lazystack.Ui.on does.

clayui
;
import
(package) core
core
.
(module) core.interpolation

This module provides definitions to support D's interpolated expression sequence literal, sometimes called string interpolation.

string str;
int num;
// the compiler uses this module to implement the
// i"..." literal used here.
auto a = i"$​(str) has $​(num) items.";

The variable a is a sequence of expressions:

a[0] == InterpolationHeader()
a[$-1] == InterpolationFooter()

First and last, you see the header and footer, to clearly indicate where interpolation begins and ends. Note that there may be nested interpolated sequences too, each with their own header and footer. Think of them as a set of balanced parenthesis around the contents.

Inside, you will find three general categories of content: InterpolatedLiteral!"string" for string expressions, InterpolatedExpression!"code" for code expressions, and then the values themselves as their own type.

In the example:

auto a = i"$​(str) has $​(num) items.";

We will find:

a[0] == InterpolationHeader()
a[1] == InterpolatedExpression!"str"
a[2] == str
a[3] == InterpolatedLiteral!" has ";
a[4] == InterpolatedExpression!"num";
a[5] == num
a[6] == InterpolatedLiteral!" items.";
a[7] == InterpolationFooter()
a.length == 8;

You can see the correspondence with the original input: when you write $​(expression), the string of the expression is passed as InterpolatedExpression!ThatString, (excluding any parenthesis around the expression), and everything else is passed as InterpolatedLiteral!str, in the same sequence as they appeared in the source.

After an InterpolatedExpression!..., you will find the actual value(s) in the tuple. (If the expression expanded to multiple values - for example, if it was itself a tuple, there will be multiple values for a single expression.)

Library functions should NOT attempt to mixin the code from an InterpolatedExpression themselves. Doing so will fail, since it is coming from a different scope anyway. The string is provided to you only for informational purposes and as a sentinel to separate things the user wrote.

Your code should be able to handle an empty code string in InterpolatedExpression or even an entirely missing InterpolatedExpression, in case an implementation decides to not emit these.

The toString members on these return null, except for the InterpolatedLiteral, which returns the literal string. This is to ease processing by generic functions like std.stdio.write or std.conv.text, making them effectively transparently skipped.

To extract the string from an InterpolatedLiteral, you can use an is expression or the .toString method.

To extract the string from a InterpolatedExpression, you can use an is expression or the .expression member.

None of these structures have runtime state.

@historyAdded in dmd 2.10x frontend, released in late 2023.
interpolation
:
(struct) core.interpolation.InterpolationFooter

ditto

InterpolationFooter
,
(struct) core.interpolation.InterpolationHeader

Sentinel values to indicate the beginning and end of an interpolated expression sequence.

Note that these can nest, so while processing a sequence, it may be helpful to keep a nesting count if that knowledge is important to your application.

InterpolationHeader
;
import
(package) std
std
.
(package) std.experimental
experimental
.
(package) std.experimental.allocator
allocator
.
(package) std.experimental.allocator.building_blocks
building_blocks
.
(module) std.experimental.allocator.building_blocks.region

Source

std/experimental/allocator/building_blocks/region.d

region
:
(alias struct) clayui.InSituRegion = std.experimental.allocator.building_blocks.region.InSituRegion(ulong size, ulong minAlign = platformAlignment)

InSituRegion is a convenient region that carries its storage within itself (in the form of a statically-sized array).

The first template argument is the size of the region and the second is the needed alignment. Depending on the alignment requested and platform details, the actual available storage may be smaller than the compile-time parameter. To make sure that at least n bytes are available in the region, use ``InSituRegion!(n + a - 1, a).

Given that the most frequent use of InSituRegion is as a stack allocator, it allocates starting at the end on systems where stack grows downwards, such that hot memory is used first.

InSituRegion
;
import
(package) sparkles
sparkles
.
(package) sparkles.base
base
.
(module) sparkles.base.buffer

A @nogc container with Small Buffer Optimization (SBO).

Provides an append-only buffer that stores small amounts of data inline (avoiding heap allocation) and automatically switches to heap storage when capacity is exceeded.

Primary use case: appending elements in a temporary scope where GC allocation is not desired.

buffer
:
(alias struct) clayui.BoundedSink = sparkles.base.buffer.BoundedSink(T)

A bounded output range over storage someone else owns.

Handed out by tryWrite and valid only inside it, so a partially written destination is never observable: either the whole write fits, or nothing is kept. Overflow is recorded rather than thrown, which is what lets the entire sparkles.base.text.writers family compose inside one attempt.

BoundedSink
,
(alias template) clayui.InlineBuffer = sparkles.base.buffer.InlineBuffer(T, ulong N, Storage extra = Storage.none) if (!(extra & ~Storage.unique))

A buffer that never allocates: the elements live in the inline T[N] and nowhere else.

The policy with a guarantee no other has. Because there is no union, a slice of the storage is provably a reference to the enclosing frame, so -dip1000 rejects returning one from a @safe function — the property CString is built on. It also has no destructor, so it is plain data: copyable, comparable, and usable as a field in an aggregate that must stay POD.

It is deliberately not an output range: put promises to accept what it is given, and this cannot. Write into it with tryWrite.

Pass Storage.unique as extra for the move-only form, which is what prevents an accidental copy of a large one.

InlineBuffer
;
import
(package) sparkles
sparkles
.
(package) sparkles.base
base
.
(package) sparkles.base.text
text
.
(module) sparkles.base.text.writers

@nogc-compatible text writing utilities for output ranges.

Provides functions for writing integers, floats, escaped characters/strings, and ANSI escape sequences to output ranges without GC allocation.

writers
:
(alias template) clayui.writeText = sparkles.base.text.writers.writeText(Writer, Args...)(ref Writer w, InterpolationHeader, Args args, InterpolationFooter)

Writes an interpolated sequence to an output range, verbatim.

SharedBuffer!(char, 128) buf;
buf.writeText(i"pid $(pid) exited with $(status)");

Plain, not styled. Literals are copied through and interpolated values go via writeValue; nothing is parsed. That is the difference from sparkles.base.styled_template.writeStyled, which reads {red …} as markup — and the reason to reach for this one whenever the text is not a style template. Interpolating a value that may contain a brace (a file path, a user's input) through the styled writer silently eats it as a style block; here a brace is a brace.

The @nogc half of the pair. std.conv.text already renders an interpolated sequence to a string, so use that where a GC allocation is fine; this is for the paths where it is not, and it inherits Writer's attributes the way every template in this module does.

writeText
;
import
(module) benchtext

The benchmark's frame text store, used by all three builders under version (Bench): a bump arena with TextPool's intern/withText/release surface. TextPool cannot be sized for a 100 000-row frame on a test worker's 512 KiB stack: its compact keeps a uint[slots] on the stack (2 MiB at 2^19 slots), and the frame is reserved on every intern that may compact.

benchtext
:
(struct) benchtext.BumpTextPool
BumpTextPool
,
(alias template) clayui.FrameBuf = benchtext.FrameBuf(T)

The frame tables' buffer in the benchmark. By default the sparkles:base HeapBuffer!(T, Storage.unique) the prototypes use; under version (RawBuf) a bare malloc'd array. The mutable Buffer.opIndex/opSlice call ensureUniqueStorage (not inlined, computing roundedCapacity) on every access even for Storage.unique, and the top-down builders index their node table far more than the inside-out one does; RawBuf takes that cost out of all three, leaving the builders' own work.

FrameBuf
;
import
(module) treehash

The tree checksum every builder folds its nodes into, in pre-order.

treehash
:
(alias) clayui.treeHash = ulong treehash.treeHash(ulong h, scope const(char)[] kind, uint w, uint hgt, uint children) pure nothrow @nogc @safe
treeHash
;
public import
(module) clay_impl
clay_impl
;
C preprocess command `cpp` failed for file `/home/runner/work/sparkles/sparkles/docs/research/ui-authoring/experiments/ui-api-demo-lazy/bench/clay/clay_impl.c`, exit status 1
/// What each element is, for the tree checksum; kept in the declaration's /// `userData` (Clay copies it into the element, at no extra cost). Names as /// in the other builders' `Kind`. enum
(enum) clayui.Kind

What each element is, for the tree checksum; kept in the declaration's userData (Clay copies it into the element, at no extra cost). Names as in the other builders' Kind.

Kind
: ubyte {
(enum value) clayui.Kind.column = cast(ubyte)0u
column
,
(enum value) clayui.Kind.row = 1
row
,
(enum value) clayui.Kind.label = 2
label
,
(enum value) clayui.Kind.toggle = 3
toggle
,
(enum value) clayui.Kind.numberField = 4
numberField
,
(enum value) clayui.Kind.keyValue = 5
keyValue
}
private immutable
(alias) object.string = string
string
[6]
(immutable global) immutable(string[6]) clayui.kindName
kindName
= ["column", "row", "label", "toggle", "numberField", "keyValue"];
/// `Density`, as the other builders' `Env` carries it. enum
(enum) clayui.Density

Density, as the other builders' Env carries it.

Density
: ubyte {
(enum value) clayui.Density.compact = cast(ubyte)0u
compact
,
(enum value) clayui.Density.comfortable = 1
comfortable
}
private extern (C) void
clayui.countError
countError
(Clay_ErrorData
(parameter) Clay_ErrorData e
e
) nothrow @nogc
undefined identifier `Clay_ErrorData`
{ auto
_error_ counts
counts
= cast(uint*) e.userData;
counts[e.errorType == CLAY_ERROR_TYPE_DUPLICATE_ID ? 1 : 0]++; } /// One message, as `lazystack.MsgRec`: its type key and its bytes in the arena. private struct
(struct) clayui.MsgRec

One message, as lazystack.MsgRec``: its type key and its bytes in the arena.

MsgRec
{ ulong
(field) ulong clayui.MsgRec.typeKey
typeKey
; const(void)[]
(field) const(void)[] clayui.MsgRec.value
value
; }
private ulong
ulong clayui.fnv(scope const(char)[] s) pure nothrow @nogc @safe
fnv
(scope const(char)[]
(parameter) const(char)[] s
s
) @safe pure nothrow @nogc
{ ulong
(local variable) ulong h
h
= 0xcbf29ce484222325;
foreach (
(parameter) const(char) c
c
;
(parameter) const(char)[] s
s
)
(local variable) ulong h
h
= (
(local variable) ulong h
h
^
(local variable) const(char) c
c
) * 0x100000001b3;
return
(local variable) ulong h
h
;
} /// A handle to a message, as the other builders' `MsgRef`. struct
(struct) clayui.MsgRef

A handle to a message, as the other builders' MsgRef.

MsgRef
{ uint
(field) uint clayui.MsgRef.index
index
= uint.
(constant) uint uint.max = 4294967295u
max
; }
/** One Clay context, sized for `maxElements` elements, owned (malloc'd) by this struct. Clay's context is a global (`Clay__currentContext`): `begin` makes this one current. */ struct
(struct) clayui.ClayUi(bool Side = false)

One Clay context, sized for maxElements elements, owned (malloc'd) by this struct. Clay's context is a global (Clay__currentContext): begin makes this one current.

ClayUi
(bool Side = false)
{ private void*
_error_ memory
memory
;
private Clay_Context*
_error_ ctx
ctx
;
private uint[2]
_error_ errors
errors
; // [other, duplicate id]
(unresolved type) Density
Density
_error_ density
density
= Density.
Density.comfortable
comfortable
;
private InlineBuffer!(char, 1024)
_error_ scratch
scratch
;
static if (Side) { private BumpTextPool texts; private FrameBuf!MsgRec msgs; private InSituRegion!(8 << 20) argArena; } @disable this(this); /// Allocates and initialises the context. The layout root is huge so that /// nothing is shrunk to fit or culled. void
void setup(int maxElements) nothrow @nogc @trusted

Allocates and initialises the context. The layout root is huge so that nothing is shrunk to fit or culled.

setup
(int
(parameter) int maxElements
maxElements
) @trusted nothrow @nogc
{ import core.stdc.stdlib : malloc; Clay_SetCurrentContext(null); // the defaults below apply to a new context only Clay_SetMaxElementCount(maxElements); const
_error_ size
size
= Clay_MinMemorySize();
memory = malloc(size); assert(memory !is null, "out of memory"); auto
_error_ arena
arena
= Clay_CreateArenaWithCapacityAndMemory(size, memory);
ctx = Clay_Initialize(arena, Clay_Dimensions(1e9, 1e9), Clay_ErrorHandler(&countError, &errors[0])); assert(ctx !is null, "Clay_Initialize failed"); Clay_SetMeasureTextFunction(&measureCells, null); } ~this() @trusted nothrow @nogc { import core.stdc.stdlib : free; if (Clay_GetCurrentContext() is ctx) Clay_SetCurrentContext(null); free(memory); } /// Bytes Clay asked for. size_t
size_t memorySize() const nothrow @nogc @trusted

Bytes Clay asked for.

memorySize
() const @trusted nothrow @nogc => ctx.internalArena.capacity;
/// `Clay_BeginLayout` on this context. void
void begin() nothrow @nogc @trusted

Clay_BeginLayout on this context.

begin
() @trusted nothrow @nogc
{ Clay_SetCurrentContext(ctx); Clay_BeginLayout(); } /// `Clay_EndLayout`: the remaining layout passes and the render commands. Clay_RenderCommandArray
Clay_RenderCommandArray end() nothrow @nogc @trusted

Clay_EndLayout: the remaining layout passes and the render commands.

end
() @trusted nothrow @nogc => Clay_EndLayout(0);
/// Errors Clay reported, other than duplicate ids (which it resolves). uint
uint errorCount() const nothrow @nogc @safe

Errors Clay reported, other than duplicate ids (which it resolves).

errorCount
() const @safe nothrow @nogc => errors[0];
/// Duplicate-id reports (auto ids are 32-bit hashes; see README.md). uint
uint duplicateIds() const nothrow @nogc @safe

Duplicate-id reports (auto ids are 32-bit hashes; see README.md).

duplicateIds
() const @safe nothrow @nogc => errors[1];
/// Drops the frame's side tables, keeping the storage. void
void reset() nothrow @nogc @trusted

Drops the frame's side tables, keeping the storage.

reset
() @trusted nothrow @nogc
{ scratch.clear(); static if (Side) { texts.clearAll(); msgs.clear(releaseStorage: false); argArena.deallocateAll(); } } /// Formats an IES into the frame's scratch, as `lazystack.Ui.text`. const(char)[]
const(char)[] text(InterpolationHeader header, Args args, InterpolationFooter footer) return
text
(Args...)(
(unresolved type) InterpolationHeader
InterpolationHeader
(parameter) InterpolationHeader header
header
, Args
(parameter) Args args
args
,
(unresolved type) InterpolationFooter
InterpolationFooter
(parameter) InterpolationFooter footer
footer
) return
{ const
_error_ start
start
= scratch.length;
const
_error_ fits
fits
= scratch.tryWrite((scope ref BoundedSink!char
(parameter) BoundedSink!char w
w
) {
w.
w.writeText
writeText
(header, args, footer);
}); assert(fits, "the frame's text scratch is full"); return scratch[start .. scratch.length]; } /// A message handle. Without `Side`, nothing is stored (Clay has no /// message table; an app would check `Clay_PointerOver(id)` instead). MsgRef
MsgRef on(M value)
on
(M)(M
(parameter) M value
value
)
{ static if (Side) { static assert(__traits(isPOD, M), "a message is plain data: it is copied as bytes"); const block = () @trusted { auto b = argArena.allocate(M.sizeof); if (b !is null) b[] = (cast(const(void)*) &value)[0 .. M.sizeof]; return b; }(); assert(block !is null, "the frame's argument arena is full"); const self = MsgRef(cast(uint) msgs.length); msgs ~= MsgRec(fnv(M.mangleof), block); return self; } else return MsgRef.init; } pragma(inline, true) private void
void keep(scope const(char)[] s) pure nothrow @nogc @safe
keep
(scope const(char)[]
(parameter) const(char)[] s
s
) @safe pure nothrow @nogc
{ static if (Side) if (s.length) cast(void) texts.intern(s); } // ── the tree, read back from Clay's own element storage ──────────────── /// The view's root: the first element opened after Clay's root container. enum int
(constant) int viewRoot = 1

The view's root: the first element opened after Clay's root container.

viewRoot
= 1;
/// Elements Clay holds this frame (its root container included). size_t
size_t elementCount() const nothrow @nogc @trusted

Elements Clay holds this frame (its root container included).

elementCount
() const @trusted nothrow @nogc => ctx.layoutElements.length;
/// Pre-order checksum of the subtree under element `i`, read from /// `layoutElements[i]`: `dimensions` (the fit size `Clay__CloseElement` /// computed), `children.elements[0 .. children.length]`, and the kind in /// `config.userData`. void
void checksum(int i, ref ulong h, ref size_t count) const nothrow @nogc @trusted

Pre-order checksum of the subtree under element i, read from layoutElements[i]: dimensions (the fit size Clay__CloseElement computed), children.elements[0 .. children.length], and the kind in config.userData.

checksum
(int
(parameter) int i
i
, ref ulong
(parameter) ulong h
h
, ref size_t
(parameter) size_t count
count
) const @trusted nothrow @nogc
{ const
_error_ e
e
= &ctx.layoutElements.internalArray[i];
assert(!e.isTextElement, "this bench declares no text elements"); const
_error_ kind
kind
= cast(size_t) e.config.userData - 1;
h = treeHash(h, kindName[kind], cast(uint) e.dimensions.width, cast(uint) e.dimensions.height, e.children.length); count++; foreach (
(parameter) c
c
; e.children.elements[0 .. e.children.length])
checksum(c, h, count); } } /// `Clay_String` over a D slice; `isStaticallyAllocated` as the macros set it /// for literals (the bench's strings outlive every frame). pragma(inline, true) Clay_String
clayui.clayString

Clay_String over a D slice; isStaticallyAllocated as the macros set it for literals (the bench's strings outlive every frame).

clayString
(const(char)[]
(parameter) const(char)[] s
s
) @trusted pure nothrow @nogc
undefined identifier `Clay_String`
=> Clay_String(true, cast(int) s.length, s.ptr); private extern (C) Clay_Dimensions
clayui.measureCells
measureCells
(Clay_StringSlice
(parameter) Clay_StringSlice text
text
,
undefined identifier `Clay_Dimensions`
undefined identifier `Clay_StringSlice`
Clay_TextElementConfig* config, void* userData) nothrow @nogc
undefined identifier `Clay_TextElementConfig`
=> Clay_Dimensions(cells(text.chars[0 .. text.length]), 1); /// Display width of UTF-8 text: one cell per code point (as `lazystack.cells`). uint
uint clayui.cells(scope const(char)[] s) pure nothrow @nogc @safe

Display width of UTF-8 text: one cell per code point (as lazystack.cells``).

cells
(scope const(char)[]
(parameter) const(char)[] s
s
) @safe pure nothrow @nogc
{ uint
(local variable) uint n
n
;
foreach (
(parameter) const(char) c
c
;
(parameter) const(char)[] s
s
)
(local variable) uint n
n
+= (
(local variable) const(char) c
c
& 0xC0) != 0x80;
return
(local variable) uint n
n
;
} /// Decimal digits of `v` (as `lazystack.digits`). uint
uint clayui.digits(int v) pure nothrow @nogc @safe

Decimal digits of v (as lazystack.digits``).

digits
(int
(parameter) int v
v
) @safe pure nothrow @nogc
{ uint
(local variable) uint n
n
=
(parameter) int v
v
< 0 ? 2 : 1;
for (
(parameter) int v
v
/= 10; v; v /= 10)
(local variable) uint n
n
++;
return
(local variable) uint n
n
;
} // ── containers: `with (ui.column(gap: 1)) { … }` ───────────────────────── /// Closes the element it was returned for when the `with` scope ends. struct
(struct) clayui.Open

Closes the element it was returned for when the with scope ends.

Open
{ private bool
(field) bool clayui.Open.live
live
;
@disable this(this); pragma(inline, true) ~this() @trusted nothrow @nogc { if (
(field) bool clayui.Open.live
live
)
Clay__CloseElement();
undefined identifier `Clay__CloseElement`
} } pragma(inline, true) private
(struct) clayui.Open

Closes the element it was returned for when the with scope ends.

Open
clayui.container
container
(
(enum) clayui.Kind

What each element is, for the tree checksum; kept in the declaration's userData (Clay copies it into the element, at no extra cost). Names as in the other builders' Kind.

Kind
(parameter) Kind kind
kind
, Clay_LayoutDirection dir, int
(parameter) int gap
gap
) @trusted nothrow @nogc
undefined identifier `Clay_LayoutDirection`
{ Clay__OpenElement(); Clay_ElementDeclaration
_error_ d
d
; // all FIT, no padding: Clay's defaults
d.layout.layoutDirection = dir; d.layout.childGap = cast(ushort) gap; d.userData = cast(void*) (kind + 1); Clay__ConfigureOpenElement(d); return Open(true); } /// A vertical stack: `CLAY_AUTO_ID({ .layout = { .layoutDirection = CLAY_TOP_TO_BOTTOM, .childGap = gap } })`. pragma(inline, true) Open
Open column(U)(ref U ui, int gap = 0)

A vertical stack: CLAY_AUTO_ID({ .layout = { .layoutDirection = CLAY_TOP_TO_BOTTOM, .childGap = gap } }).

column
(U)(ref U
(parameter) U ui
ui
, int
(parameter) int gap
gap
= 0) => container(Kind.
Kind.column
column
, CLAY_TOP_TO_BOTTOM, gap);
/// A horizontal stack. pragma(inline, true) Open
Open row(U)(ref U ui, int gap = 0)

A horizontal stack.

row
(U)(ref U
(parameter) U ui
ui
, int
(parameter) int gap
gap
= 0) => container(Kind.
Kind.row
row
, CLAY_LEFT_TO_RIGHT, gap);
// ── leaves: fixed-size elements ──────────────────────────────────────────── pragma(inline, true) private void
void clayui.configureLeaf(clayui.Kind kind, uint w) nothrow @nogc @trusted
configureLeaf
(
(enum) clayui.Kind

What each element is, for the tree checksum; kept in the declaration's userData (Clay copies it into the element, at no extra cost). Names as in the other builders' Kind.

Kind
(parameter) clayui.Kind kind
kind
, uint
(parameter) uint w
w
) @trusted nothrow @nogc
{ Clay_ElementDeclaration
(local variable) _error_ d
d
;
undefined identifier `Clay_ElementDeclaration`
d.layout.sizing.width.
(field) _error_ d.layout.sizing.width.size
size
.minMax = Clay_SizingMinMax(w, w);
d.layout.sizing.width.type = CLAY__SIZING_TYPE_FIXED; d.layout.sizing.height.
(field) _error_ d.layout.sizing.height.size
size
.minMax = Clay_SizingMinMax(1, 1);
d.layout.sizing.height.type = CLAY__SIZING_TYPE_FIXED; d.backgroundColor = Clay_Color(40, 40, 48, 255); d.userData = cast(void*) (kind + 1); Clay__ConfigureOpenElement(d);
undefined identifier `Clay__ConfigureOpenElement`
} pragma(inline, true) private void
void clayui.leaf(clayui.Kind kind, uint w) nothrow @nogc @trusted
leaf
(
(enum) clayui.Kind

What each element is, for the tree checksum; kept in the declaration's userData (Clay copies it into the element, at no extra cost). Names as in the other builders' Kind.

Kind
(parameter) clayui.Kind kind
kind
, uint
(parameter) uint w
w
) @trusted nothrow @nogc
{ Clay__OpenElement();
undefined identifier `Clay__OpenElement`
void clayui.configureLeaf(clayui.Kind kind, uint w) nothrow @nogc @trusted
configureLeaf
(
(parameter) clayui.Kind kind
kind
,
(parameter) uint w
w
);
Clay__CloseElement();
undefined identifier `Clay__CloseElement`
} /// One run of text. pragma(inline, true) void
void label(U)(ref U ui, scope const(char)[] text)

One run of text.

label
(U)(ref U
(parameter) U ui
ui
, scope const(char)[]
(parameter) const(char)[] text
text
)
{ ui.
ui.keep
keep
(text);
leaf(Kind.
Kind.label
label
, text.
text.cells
cells
);
} /// A switch. pragma(inline, true) void
void toggle(U)(ref U ui, bool on, scope const(char)[] label, MsgRef onPress)

A switch.

toggle
(U)(ref U
(parameter) U ui
ui
, bool
(parameter) bool on
on
, scope const(char)[]
(parameter) const(char)[] label
label
,
(unresolved type) MsgRef
MsgRef
(parameter) MsgRef onPress
onPress
)
{ ui.
ui.keep
keep
(label);
leaf(Kind.
Kind.toggle
toggle
, label.
label.cells
cells
+ 4);
} /// A number field. pragma(inline, true) void
void numberField(U)(ref U ui, int value, scope const(char)[] unit, MsgRef onChange)

A number field.

numberField
(U)(ref U
(parameter) U ui
ui
, int
(parameter) int value
value
, scope const(char)[]
(parameter) const(char)[] unit
unit
,
(unresolved type) MsgRef
MsgRef
(parameter) MsgRef onChange
onChange
)
{ ui.
ui.keep
keep
(unit);
leaf(Kind.
Kind.numberField
numberField
, value.
value.digits
digits
+ 1 + unit.
unit.cells
cells
);
} /// A name and its value, keyed: its id is `CLAY_SID_LOCAL(key)`. pragma(inline, true) void
void keyValue(U)(ref U ui, scope const(char)[] key, scope const(char)[] name, scope const(char)[] value, MsgRef onPress)

A name and its value, keyed: its id is CLAY_SID_LOCAL(key).

keyValue
(U)(ref U
(parameter) U ui
ui
, scope const(char)[]
(parameter) const(char)[] key
key
, scope const(char)[]
(parameter) const(char)[] name
name
,
scope const(char)[]
(parameter) const(char)[] value
value
,
(unresolved type) MsgRef
MsgRef
(parameter) MsgRef onPress
onPress
)
{ ui.
ui.keep
keep
(name);
ui.
ui.keep
keep
(value);
() @trusted { Clay__OpenElementWithId(Clay__HashString(clayString(key), Clay_GetOpenElementId())); configureLeaf(Kind.
Kind.keyValue
keyValue
, name.
name.cells
cells
+ 1 + value.
value.cells
cells
);
Clay__CloseElement(); }(); }