snapshots_test__records_ir.snap raw

---
source: crates/guiduck-component-core/tests/snapshots_test.rs
assertion_line: 220
expression: "compile_or_render_errors(source, \"TodoList.gdc\")"
---
Ir {
    name: "TodoList",
    records: [
        IrRecord {
            name: "Todo",
            fields: [
                (
                    "id",
                    I64,
                ),
                (
                    "label",
                    String,
                ),
            ],
        },
    ],
    props: [],
    outputs: [],
    states: [
        IrState {
            name: "todos",
            ty: ValueTy {
                kind: Record(
                    0,
                ),
                list: true,
            },
            init: List(
                [
                    Record {
                        name: "Todo",
                        fields: [
                            (
                                "id",
                                Int(
                                    1,
                                ),
                            ),
                            (
                                "label",
                                Str(
                                    "alpha",
                                ),
                            ),
                        ],
                    },
                    Record {
                        name: "Todo",
                        fields: [
                            (
                                "id",
                                Int(
                                    2,
                                ),
                            ),
                            (
                                "label",
                                Str(
                                    "beta",
                                ),
                            ),
                        ],
                    },
                ],
            ),
        },
        IrState {
            name: "next-id",
            ty: ValueTy {
                kind: Scalar(
                    I64,
                ),
                list: false,
            },
            init: Int(
                3,
            ),
        },
        IrState {
            name: "empty",
            ty: ValueTy {
                kind: Scalar(
                    Bool,
                ),
                list: false,
            },
            init: Bool(
                false,
            ),
        },
    ],
    handlers: [
        IrHandler {
            name: "add",
            payloads: [],
            returns: None,
        },
        IrHandler {
            name: "remove",
            payloads: [
                I64,
            ],
            returns: None,
        },
        IrHandler {
            name: "clear",
            payloads: [],
            returns: None,
        },
    ],
    nodes: [
        IrNode {
            widget: Widget(
                IrWidgetNode {
                    name: "container",
                    type_path: "::guiduck::core::Container",
                    props: [],
                    events: [],
                    queries: [],
                },
            ),
            classes: [],
            style: StyleIr {
                width: None,
                height: None,
                padding: Some(
                    8.0,
                ),
                gap: Some(
                    4.0,
                ),
                direction: Some(
                    Column,
                ),
                align_items: None,
                justify_content: None,
                align_self: None,
                grow: None,
                shrink: None,
                basis: None,
            },
            events: [],
            autofocus: false,
            enabled: None,
            focused: None,
            tooltip: None,
            accel: None,
            component_props: [],
            component_outputs: [],
            component_key: None,
            control: None,
            children: [
                1,
                3,
                5,
                7,
            ],
        },
        IrNode {
            widget: Widget(
                IrWidgetNode {
                    name: "container",
                    type_path: "::guiduck::core::Container",
                    props: [
                        IrWidgetProp {
                            name: "background",
                            setter: "set_background",
                            ty: Brush,
                            value: Static(
                                Color(
                                    70,
                                    130,
                                    180,
                                    255,
                                ),
                            ),
                        },
                    ],
                    events: [],
                    queries: [],
                },
            ),
            classes: [
                "add",
            ],
            style: StyleIr {
                width: Some(
                    Px(
                        80.0,
                    ),
                ),
                height: Some(
                    Px(
                        20.0,
                    ),
                ),
                padding: None,
                gap: None,
                direction: None,
                align_items: None,
                justify_content: None,
                align_self: None,
                grow: None,
                shrink: None,
                basis: None,
            },
            events: [
                IrEvent {
                    event: Click,
                    handler: "add",
                    args: [],
                },
            ],
            autofocus: false,
            enabled: None,
            focused: None,
            tooltip: None,
            accel: None,
            component_props: [],
            component_outputs: [],
            component_key: None,
            control: None,
            children: [
                2,
            ],
        },
        IrNode {
            widget: Widget(
                IrWidgetNode {
                    name: "text",
                    type_path: "::guiduck::core::Text",
                    props: [
                        IrWidgetProp {
                            name: "font-family",
                            setter: "set_family",
                            ty: Scalar(
                                String,
                            ),
                            value: Static(
                                Str(
                                    "DejaVu Sans",
                                ),
                            ),
                        },
                        IrWidgetProp {
                            name: "text",
                            setter: "set_text",
                            ty: RichText,
                            value: Static(
                                Str(
                                    "add",
                                ),
                            ),
                        },
                        IrWidgetProp {
                            name: "color",
                            setter: "set_brush",
                            ty: Brush,
                            value: Static(
                                Color(
                                    255,
                                    255,
                                    255,
                                    255,
                                ),
                            ),
                        },
                    ],
                    events: [],
                    queries: [],
                },
            ),
            classes: [],
            style: StyleIr {
                width: None,
                height: None,
                padding: None,
                gap: None,
                direction: None,
                align_items: None,
                justify_content: None,
                align_self: None,
                grow: None,
                shrink: None,
                basis: None,
            },
            events: [],
            autofocus: false,
            enabled: None,
            focused: None,
            tooltip: None,
            accel: None,
            component_props: [],
            component_outputs: [],
            component_key: None,
            control: None,
            children: [],
        },
        IrNode {
            widget: Widget(
                IrWidgetNode {
                    name: "container",
                    type_path: "::guiduck::core::Container",
                    props: [
                        IrWidgetProp {
                            name: "background",
                            setter: "set_background",
                            ty: Brush,
                            value: Static(
                                Color(
                                    180,
                                    70,
                                    70,
                                    255,
                                ),
                            ),
                        },
                    ],
                    events: [],
                    queries: [],
                },
            ),
            classes: [
                "clear",
            ],
            style: StyleIr {
                width: Some(
                    Px(
                        80.0,
                    ),
                ),
                height: Some(
                    Px(
                        20.0,
                    ),
                ),
                padding: None,
                gap: None,
                direction: None,
                align_items: None,
                justify_content: None,
                align_self: None,
                grow: None,
                shrink: None,
                basis: None,
            },
            events: [
                IrEvent {
                    event: Click,
                    handler: "clear",
                    args: [],
                },
            ],
            autofocus: false,
            enabled: None,
            focused: None,
            tooltip: None,
            accel: None,
            component_props: [],
            component_outputs: [],
            component_key: None,
            control: None,
            children: [
                4,
            ],
        },
        IrNode {
            widget: Widget(
                IrWidgetNode {
                    name: "text",
                    type_path: "::guiduck::core::Text",
                    props: [
                        IrWidgetProp {
                            name: "font-family",
                            setter: "set_family",
                            ty: Scalar(
                                String,
                            ),
                            value: Static(
                                Str(
                                    "DejaVu Sans",
                                ),
                            ),
                        },
                        IrWidgetProp {
                            name: "text",
                            setter: "set_text",
                            ty: RichText,
                            value: Static(
                                Str(
                                    "clear",
                                ),
                            ),
                        },
                        IrWidgetProp {
                            name: "color",
                            setter: "set_brush",
                            ty: Brush,
                            value: Static(
                                Color(
                                    255,
                                    255,
                                    255,
                                    255,
                                ),
                            ),
                        },
                    ],
                    events: [],
                    queries: [],
                },
            ),
            classes: [],
            style: StyleIr {
                width: None,
                height: None,
                padding: None,
                gap: None,
                direction: None,
                align_items: None,
                justify_content: None,
                align_self: None,
                grow: None,
                shrink: None,
                basis: None,
            },
            events: [],
            autofocus: false,
            enabled: None,
            focused: None,
            tooltip: None,
            accel: None,
            component_props: [],
            component_outputs: [],
            component_key: None,
            control: None,
            children: [],
        },
        IrNode {
            widget: If,
            classes: [],
            style: StyleIr {
                width: None,
                height: None,
                padding: None,
                gap: None,
                direction: None,
                align_items: None,
                justify_content: None,
                align_self: None,
                grow: None,
                shrink: None,
                basis: None,
            },
            events: [],
            autofocus: false,
            enabled: None,
            focused: None,
            tooltip: None,
            accel: None,
            component_props: [],
            component_outputs: [],
            component_key: None,
            control: Some(
                If {
                    cond: Path(
                        [
                            "empty",
                        ],
                        Span {
                            start: 851,
                            end: 856,
                        },
                    ),
                },
            ),
            children: [
                6,
            ],
        },
        IrNode {
            widget: Widget(
                IrWidgetNode {
                    name: "text",
                    type_path: "::guiduck::core::Text",
                    props: [
                        IrWidgetProp {
                            name: "font-family",
                            setter: "set_family",
                            ty: Scalar(
                                String,
                            ),
                            value: Static(
                                Str(
                                    "DejaVu Sans",
                                ),
                            ),
                        },
                        IrWidgetProp {
                            name: "text",
                            setter: "set_text",
                            ty: RichText,
                            value: Static(
                                Str(
                                    "no items",
                                ),
                            ),
                        },
                    ],
                    events: [],
                    queries: [],
                },
            ),
            classes: [
                "empty",
            ],
            style: StyleIr {
                width: None,
                height: None,
                padding: None,
                gap: None,
                direction: None,
                align_items: None,
                justify_content: None,
                align_self: None,
                grow: None,
                shrink: None,
                basis: None,
            },
            events: [],
            autofocus: false,
            enabled: None,
            focused: None,
            tooltip: None,
            accel: None,
            component_props: [],
            component_outputs: [],
            component_key: None,
            control: None,
            children: [],
        },
        IrNode {
            widget: For,
            classes: [],
            style: StyleIr {
                width: None,
                height: None,
                padding: None,
                gap: None,
                direction: None,
                align_items: None,
                justify_content: None,
                align_self: None,
                grow: None,
                shrink: None,
                basis: None,
            },
            events: [],
            autofocus: false,
            enabled: None,
            focused: None,
            tooltip: None,
            accel: None,
            component_props: [],
            component_outputs: [],
            component_key: None,
            control: Some(
                For {
                    var: "todo",
                    index: Some(
                        "i",
                    ),
                    list: "todos",
                    element: Record(
                        0,
                    ),
                    key: Some(
                        Path(
                            [
                                "todo",
                                "id",
                            ],
                            Span {
                                start: 955,
                                end: 962,
                            },
                        ),
                    ),
                },
            ),
            children: [
                8,
            ],
        },
        IrNode {
            widget: Widget(
                IrWidgetNode {
                    name: "container",
                    type_path: "::guiduck::core::Container",
                    props: [],
                    events: [],
                    queries: [],
                },
            ),
            classes: [
                "row",
            ],
            style: StyleIr {
                width: Some(
                    Px(
                        200.0,
                    ),
                ),
                height: Some(
                    Px(
                        20.0,
                    ),
                ),
                padding: None,
                gap: Some(
                    6.0,
                ),
                direction: Some(
                    Row,
                ),
                align_items: None,
                justify_content: None,
                align_self: None,
                grow: None,
                shrink: None,
                basis: None,
            },
            events: [],
            autofocus: false,
            enabled: None,
            focused: None,
            tooltip: None,
            accel: None,
            component_props: [],
            component_outputs: [],
            component_key: None,
            control: None,
            children: [
                9,
                10,
            ],
        },
        IrNode {
            widget: Widget(
                IrWidgetNode {
                    name: "text",
                    type_path: "::guiduck::core::Text",
                    props: [
                        IrWidgetProp {
                            name: "font-family",
                            setter: "set_family",
                            ty: Scalar(
                                String,
                            ),
                            value: Static(
                                Str(
                                    "DejaVu Sans",
                                ),
                            ),
                        },
                        IrWidgetProp {
                            name: "text",
                            setter: "set_text",
                            ty: RichText,
                            value: Binding(
                                Str(
                                    Template {
                                        segments: [
                                            Ref(
                                                "i",
                                                Span {
                                                    start: 1095,
                                                    end: 1096,
                                                },
                                            ),
                                            Literal(
                                                ": ",
                                            ),
                                            Ref(
                                                "todo.label",
                                                Span {
                                                    start: 1100,
                                                    end: 1110,
                                                },
                                            ),
                                        ],
                                    },
                                    Span {
                                        start: 1093,
                                        end: 1112,
                                    },
                                ),
                            ),
                        },
                    ],
                    events: [],
                    queries: [],
                },
            ),
            classes: [],
            style: StyleIr {
                width: None,
                height: None,
                padding: None,
                gap: None,
                direction: None,
                align_items: None,
                justify_content: None,
                align_self: None,
                grow: None,
                shrink: None,
                basis: None,
            },
            events: [],
            autofocus: false,
            enabled: None,
            focused: None,
            tooltip: None,
            accel: None,
            component_props: [],
            component_outputs: [],
            component_key: None,
            control: None,
            children: [],
        },
        IrNode {
            widget: Widget(
                IrWidgetNode {
                    name: "container",
                    type_path: "::guiduck::core::Container",
                    props: [
                        IrWidgetProp {
                            name: "background",
                            setter: "set_background",
                            ty: Brush,
                            value: Static(
                                Color(
                                    180,
                                    70,
                                    70,
                                    255,
                                ),
                            ),
                        },
                    ],
                    events: [],
                    queries: [],
                },
            ),
            classes: [
                "delete",
            ],
            style: StyleIr {
                width: Some(
                    Px(
                        14.0,
                    ),
                ),
                height: Some(
                    Px(
                        14.0,
                    ),
                ),
                padding: None,
                gap: None,
                direction: None,
                align_items: None,
                justify_content: None,
                align_self: None,
                grow: None,
                shrink: None,
                basis: None,
            },
            events: [
                IrEvent {
                    event: Click,
                    handler: "remove",
                    args: [
                        Path(
                            [
                                "todo",
                                "id",
                            ],
                            Span {
                                start: 1229,
                                end: 1236,
                            },
                        ),
                    ],
                },
            ],
            autofocus: false,
            enabled: None,
            focused: None,
            tooltip: None,
            accel: None,
            component_props: [],
            component_outputs: [],
            component_key: None,
            control: None,
            children: [],
        },
    ],
}