snapshots_test__counter_ir.snap raw
---
source: crates/guiduck-component-core/tests/snapshots_test.rs
assertion_line: 41
expression: "compile_or_render_errors(source, \"Counter.gdc\")"
---
Ir {
name: "Counter",
records: [],
props: [],
outputs: [],
states: [
IrState {
name: "count",
ty: ValueTy {
kind: Scalar(
I32,
),
list: false,
},
init: Int(
0,
),
},
IrState {
name: "hovered",
ty: ValueTy {
kind: Scalar(
Bool,
),
list: false,
},
init: Bool(
false,
),
},
IrState {
name: "pressed",
ty: ValueTy {
kind: Scalar(
Bool,
),
list: false,
},
init: Bool(
false,
),
},
],
handlers: [
IrHandler {
name: "increment",
payloads: [],
returns: None,
},
IrHandler {
name: "pointer-entered",
payloads: [],
returns: None,
},
IrHandler {
name: "pointer-left",
payloads: [],
returns: None,
},
IrHandler {
name: "pressed-down",
payloads: [],
returns: None,
},
IrHandler {
name: "released",
payloads: [],
returns: None,
},
],
nodes: [
IrNode {
widget: Widget(
IrWidgetNode {
name: "container",
type_path: "::guiduck::core::Container",
props: [
IrWidgetProp {
name: "background",
setter: "set_background",
ty: Brush,
value: Static(
Color(
255,
255,
255,
255,
),
),
},
],
events: [],
queries: [],
},
),
classes: [],
style: StyleIr {
width: Some(
Percent(
1.0,
),
),
height: Some(
Percent(
1.0,
),
),
padding: Some(
16.0,
),
gap: Some(
16.0,
),
direction: Some(
Column,
),
align_items: Some(
Start,
),
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,
2,
],
},
IrNode {
widget: Widget(
IrWidgetNode {
name: "text",
type_path: "::guiduck::core::Text",
props: [
IrWidgetProp {
name: "font-size",
setter: "set_font_size",
ty: Scalar(
F32,
),
value: Static(
Float(
18.0,
),
),
},
IrWidgetProp {
name: "font-family",
setter: "set_family",
ty: Scalar(
String,
),
value: Static(
Str(
"DejaVu Sans",
),
),
},
IrWidgetProp {
name: "color",
setter: "set_brush",
ty: Brush,
value: Static(
Color(
0,
0,
0,
255,
),
),
},
IrWidgetProp {
name: "text",
setter: "set_text",
ty: RichText,
value: Binding(
Str(
Template {
segments: [
Literal(
"Count: ",
),
Ref(
"count",
Span {
start: 673,
end: 678,
},
),
],
},
Span {
start: 664,
end: 680,
},
),
),
},
],
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: "corner-radius",
setter: "set_corner_radius",
ty: Scalar(
F64,
),
value: Static(
Float(
8.0,
),
),
},
IrWidgetProp {
name: "background",
setter: "set_background",
ty: Brush,
value: Binding(
If(
Path(
[
"pressed",
],
Span {
start: 826,
end: 833,
},
),
Str(
Template {
segments: [
Literal(
"#483d8b",
),
],
},
Span {
start: 834,
end: 843,
},
),
If(
Path(
[
"hovered",
],
Span {
start: 876,
end: 883,
},
),
Str(
Template {
segments: [
Literal(
"#6495ed",
),
],
},
Span {
start: 884,
end: 893,
},
),
Str(
Template {
segments: [
Literal(
"#4682b4",
),
],
},
Span {
start: 894,
end: 903,
},
),
Span {
start: 872,
end: 904,
},
),
Span {
start: 822,
end: 905,
},
),
),
},
],
events: [],
queries: [],
},
),
classes: [],
style: StyleIr {
width: Some(
Px(
120.0,
),
),
height: Some(
Px(
40.0,
),
),
padding: None,
gap: None,
direction: None,
align_items: Some(
Center,
),
justify_content: Some(
Center,
),
align_self: None,
grow: None,
shrink: None,
basis: None,
},
events: [
IrEvent {
event: Click,
handler: "increment",
args: [],
},
IrEvent {
event: PointerEnter,
handler: "pointer-entered",
args: [],
},
IrEvent {
event: PointerLeave,
handler: "pointer-left",
args: [],
},
IrEvent {
event: PointerDown,
handler: "pressed-down",
args: [],
},
IrEvent {
event: PointerUp,
handler: "released",
args: [],
},
],
autofocus: false,
enabled: None,
focused: None,
tooltip: None,
accel: None,
component_props: [],
component_outputs: [],
component_key: None,
control: None,
children: [
3,
],
},
IrNode {
widget: Widget(
IrWidgetNode {
name: "text",
type_path: "::guiduck::core::Text",
props: [
IrWidgetProp {
name: "font-size",
setter: "set_font_size",
ty: Scalar(
F32,
),
value: Static(
Float(
16.0,
),
),
},
IrWidgetProp {
name: "font-family",
setter: "set_family",
ty: Scalar(
String,
),
value: Static(
Str(
"DejaVu Sans",
),
),
},
IrWidgetProp {
name: "color",
setter: "set_brush",
ty: Brush,
value: Static(
Color(
255,
255,
255,
255,
),
),
},
IrWidgetProp {
name: "text",
setter: "set_text",
ty: RichText,
value: Static(
Str(
"+1",
),
),
},
],
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: [],
},
],
}