bud/bud_jsx.h(3)bud

NAME

bud/bud_jsx.h - JSX-style builder macros for bud node trees.

SYNOPSIS

#include <stdio.h>
#include 'bud.h'

Data Structures

struct bud_arg

One builder argument consumed by lx_el/lx_frag.

Macros

#define lx_none()

No-op builder argument.

#define _bud_ATTR_SEL(_1, _2, _3, _4, _5, _6, _7, NAME, ...)

Selector helper for the lx_attr() arity dispatch.

#define lx_attr(...)

Build an attribute argument; extra args become a printf format.

#define _bud_attr_2(k, v)

Two-arg form: literal name/value attribute.

#define _bud_attr_3(k, fmt, ...)

N-arg form dispatch for formatted attributes.

#define _bud_attr_N(k, fmt, ...)

Formatted attribute implementation.

#define lx_text(str)

Text child argument.

#define lx_node(n)

Foreign node child argument.

#define lx_tpl(...)

Raw-HTMl child argument from a printf format.

#define lx_on(e, b)

Event registration argument.

#define lx_bind(e, b, h)

Handler binding argument.

#define lx_key(k)

Keyed element argument for resilient hydration.

#define lx_el(tag, ...)

Element child argument from a tag and builder args.

#define lx_frag(...)

Fragment child argument from builder args.

#define lx_n(tag, ...)

Standalone element builder (statement form).

#define lx_frag_n(...)

Standalone fragment builder (statement form).

#define lx_textf(fmt, ...)

Formatted text child argument.

#define lx_hidden(name, val)

Hidden-input child argument.

#define lx_hidden_int(name, val)

Integer hidden-input child argument.

#define lx_submit(label, cls)

Submit-button child argument.

#define lx_link(href, text, cls)

Link child argument.

Typedefs

typedef enum bud_arg_type bud_arg_type

Discriminator for a builder argument.

typedef struct bud_arg bud_arg

One builder argument consumed by lx_el/lx_frag.

Enumerations

enum bud_arg_type { BUD_ARG_NONE = 0, BUD_ARG_NODE = 1, BUD_ARG_ATTR = 2, BUD_ARG_EVENT = 3, BUD_ARG_BIND = 4, BUD_ARG_ATTR_FMT = 5 }

Discriminator for a builder argument.

Functions

bud_node * bud_el_impl (const char *tag, size_t count, const bud_arg *args)

Assemble an element from builder arguments.

bud_node * bud_frag_impl (size_t count, const bud_arg *args)

Assemble a fragment from builder arguments.

bud_arg bud_attr_fmt (const char *name, const char *fmt,...)

Build a formatted attribute argument.

Detailed Description

JSX-style builder macros for bud node trees.

Compiles attribute lists, bindings and nested nodes into bud_node construction calls; used by both SSR and WASM builds.

Enumeration Type Documentation

enum bud_arg_type

Discriminator for a builder argument.

Enumerator

BUD_ARG_NONE
No-op placeholder.
BUD_ARG_NODE
Child node.
BUD_ARG_ATTR
Attribute name/value pair.
BUD_ARG_EVENT
Event listener registration.
BUD_ARG_BIND
Event handler binding.
BUD_ARG_ATTR_FMT
Formatting attribute (name + printf format).

Function Documentation

bud_arg bud_attr_fmt (const char * name, const char * fmt, ...)

Build a formatted attribute argument.

Parameters

name Attribute name.
fmt Format string.

Returns

Attribute argument whose value is formatted lazily at assembly.

bud_node * bud_el_impl (const char * tag, size_t count, const bud_arg * args)

Assemble an element from builder arguments.

Parameters

tag Element tag.
count Number of args.
args Builder argument array.

Returns

New element node.

bud_node * bud_frag_impl (size_t count, const bud_arg * args)

Assemble a fragment from builder arguments.

Parameters

count Number of args.
args Builder argument array.

Returns

New fragment node.

Author

Generated automatically by Doxygen for bud from the source code.