Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions lib/src/misc/element_child_relation.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/// Canonical numeric codes for how a node participates in the Duit element tree.
///
/// Values are stable wire-level integers (0–4); prefer these names over raw literals.
sealed class ElementChildRelation {
/// No structural child slots (leaf nodes in the tree sense).
static const none = 0;

/// Exactly one structural child.
static const single = 1;

/// Multiple structural children.
static const multi = 2;

/// Component slot (merged template / component content).
static const component = 3;

/// Fragment slot (registered fragment subtree).
static const fragment = 4;
}
1 change: 1 addition & 0 deletions lib/src/misc/index.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export "element_child_relation.dart";
export "script_runner.dart";
export "logger/index.dart";
export "parser.dart";
Expand Down
6 changes: 1 addition & 5 deletions lib/src/ui/descriptor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,7 @@ final class WidgetDescriptor {

/// Defines the child relationship pattern for this element type.
///
/// - `0`: No child elements (leaf widgets like Text, Image)
/// - `1`: Single child element (wrapper widgets like Container, Padding)
/// - `2`: Multiple child elements (layout widgets like Row, Column, Stack)
/// - `3`: Component content
/// - `4`: Fragment content
/// Prefer [ElementChildRelation] constants instead of raw integers.
final int childRelation;

/// Whether this element type is controlled by default.
Expand Down
Loading