Skip to content

API Reference / @gtkx/react / @gtkx/react/config

@gtkx/react/config ​

Element registration and renderer behaviors, such as defineElements and defineBehavior.

Type Aliases ​

Type AliasDescription
DetachInfoPer-child values a slot hook receives while removing one child.
ElementBehavior-
ElementConfigHow one GLib type is rendered.
ElementPropsExport-
ModuleExportA named export in a module, referenced as plain data (the module is never imported at runtime).
PlaceInfoPer-child values a slot hook receives while placing or moving one child.
PropsThe props of a host element or node, as React passes them through the reconciler.

Variables ​

VariableDescription
BUILTIN_ELEMENTS-
ELEMENTSEvery registered element config, keyed by GLib type name.

Functions ​

FunctionDescription
defineBehaviorTypes one behavior against the GObject class it applies to, so every hook's object parameter is inferred rather than annotated by hand. Pass the class as the type argument.
defineElementsIdentity helper that types the module named by elements.behaviors in gtkx.config.ts, enabling editor autocompletion and type checking. Key each entry by GLib type name and write each behavior with defineBehavior so its hooks receive the concrete GObject class.
mergeElementConfigsMerges maps of ElementConfig keyed by GLib type name into one, concatenating each type's behaviors and omitted props in the order the maps are given (an earlier map's behaviors come first), taking the last component and props seen, and marking a type lazy if any map does. Use it to combine an app's element config with its behaviors.