diff --git a/crates/thing-core/tests/goldens/resolve-f09-composition-stack.bin b/crates/thing-core/tests/goldens/resolve-f09-composition-stack.bin new file mode 100644 index 0000000..259dc2c Binary files /dev/null and b/crates/thing-core/tests/goldens/resolve-f09-composition-stack.bin differ diff --git a/crates/thing-core/tests/goldens/resolve-f09-composition-stack.txt b/crates/thing-core/tests/goldens/resolve-f09-composition-stack.txt new file mode 100644 index 0000000..671d184 --- /dev/null +++ b/crates/thing-core/tests/goldens/resolve-f09-composition-stack.txt @@ -0,0 +1,864 @@ +SurfaceDocument { + provider_id: ProviderId( + "provider.stack", + ), + label: Segment( + "stack", + ), + version: Version( + 1, + ), + title: "Stack", + root: Box( + BoxNode { + common: NodeCommon { + id: NodeId( + "root", + ), + visible: Literal( + BoolLiteral { + value: true, + }, + ), + a11y_label: None, + }, + style: BoxStyle { + display: Flex, + direction: Column, + wrap: NoWrap, + gap: Size2 { + width: Px( + Scalar { + value: 4.0, + }, + ), + height: Px( + Scalar { + value: 8.0, + }, + ), + }, + padding: Edges { + top: Px( + Scalar { + value: 2.0, + }, + ), + right: Px( + Scalar { + value: 2.0, + }, + ), + bottom: Px( + Scalar { + value: 2.0, + }, + ), + left: Px( + Scalar { + value: 2.0, + }, + ), + }, + margin: Edges { + top: Auto, + right: Auto, + bottom: Auto, + left: Auto, + }, + size: Size2 { + width: Percent( + Scalar { + value: 100.0, + }, + ), + height: Content, + }, + min_size: Size2 { + width: Px( + Scalar { + value: 0.0, + }, + ), + height: Px( + Scalar { + value: 0.0, + }, + ), + }, + max_size: Size2 { + width: Auto, + height: Auto, + }, + position: Relative, + inset: Edges { + top: Auto, + right: Auto, + bottom: Auto, + left: Auto, + }, + overflow: Visible, + align_items: Stretch, + align_self: Auto, + align_content: Start, + justify_content: SpaceBetween, + grow: 1.0, + shrink: 0.0, + basis: Auto, + grid_columns: [], + grid_rows: [], + }, + paint: Paint { + background: None, + border: None, + radius: 0.0, + }, + role: Group, + children: [ + Box( + BoxNode { + common: NodeCommon { + id: NodeId( + "std-stat", + ), + visible: Literal( + BoolLiteral { + value: true, + }, + ), + a11y_label: None, + }, + style: BoxStyle { + display: Flex, + direction: Column, + wrap: NoWrap, + gap: Size2 { + width: Px( + Scalar { + value: 0.0, + }, + ), + height: Px( + Scalar { + value: 4.0, + }, + ), + }, + padding: Edges { + top: Px( + Scalar { + value: 0.0, + }, + ), + right: Px( + Scalar { + value: 0.0, + }, + ), + bottom: Px( + Scalar { + value: 0.0, + }, + ), + left: Px( + Scalar { + value: 0.0, + }, + ), + }, + margin: Edges { + top: Px( + Scalar { + value: 0.0, + }, + ), + right: Px( + Scalar { + value: 0.0, + }, + ), + bottom: Px( + Scalar { + value: 0.0, + }, + ), + left: Px( + Scalar { + value: 0.0, + }, + ), + }, + size: Size2 { + width: Auto, + height: Content, + }, + min_size: Size2 { + width: Px( + Scalar { + value: 0.0, + }, + ), + height: Px( + Scalar { + value: 0.0, + }, + ), + }, + max_size: Size2 { + width: Auto, + height: Auto, + }, + position: Relative, + inset: Edges { + top: Auto, + right: Auto, + bottom: Auto, + left: Auto, + }, + overflow: Visible, + align_items: Stretch, + align_self: Auto, + align_content: Start, + justify_content: Start, + grow: 0.0, + shrink: 1.0, + basis: Auto, + grid_columns: [], + grid_rows: [], + }, + paint: Paint { + background: None, + border: None, + radius: 0.0, + }, + role: Group, + children: [ + Text( + TextNode { + common: NodeCommon { + id: NodeId( + "std-stat/stat-label", + ), + visible: Literal( + BoolLiteral { + value: true, + }, + ), + a11y_label: None, + }, + content: Literal( + TextLiteral { + value: "Load", + }, + ), + style_token: "caption", + wrap: true, + max_lines: None, + selectable: false, + }, + ), + Text( + TextNode { + common: NodeCommon { + id: NodeId( + "std-stat/stat-value", + ), + visible: Literal( + BoolLiteral { + value: true, + }, + ), + a11y_label: None, + }, + content: Bound( + Bind { + source: Record( + StateRef { + provider: Some( + ProviderId( + "provider.swarm", + ), + ), + schema: SchemaId( + "gamecult.thing.test.swarm.v1", + ), + key: RecordKey( + "summary", + ), + }, + ), + member: MemberPath { + steps: [ + Name( + MemberName { + name: "load", + }, + ), + ], + }, + format: None, + }, + ), + style_token: "title", + wrap: true, + max_lines: None, + selectable: false, + }, + ), + ], + }, + ), + Box( + BoxNode { + common: NodeCommon { + id: NodeId( + "outer-card", + ), + visible: Literal( + BoolLiteral { + value: true, + }, + ), + a11y_label: None, + }, + style: BoxStyle { + display: Flex, + direction: Column, + wrap: NoWrap, + gap: Size2 { + width: Px( + Scalar { + value: 4.0, + }, + ), + height: Px( + Scalar { + value: 8.0, + }, + ), + }, + padding: Edges { + top: Px( + Scalar { + value: 2.0, + }, + ), + right: Px( + Scalar { + value: 2.0, + }, + ), + bottom: Px( + Scalar { + value: 2.0, + }, + ), + left: Px( + Scalar { + value: 2.0, + }, + ), + }, + margin: Edges { + top: Auto, + right: Auto, + bottom: Auto, + left: Auto, + }, + size: Size2 { + width: Percent( + Scalar { + value: 100.0, + }, + ), + height: Content, + }, + min_size: Size2 { + width: Px( + Scalar { + value: 0.0, + }, + ), + height: Px( + Scalar { + value: 0.0, + }, + ), + }, + max_size: Size2 { + width: Auto, + height: Auto, + }, + position: Relative, + inset: Edges { + top: Auto, + right: Auto, + bottom: Auto, + left: Auto, + }, + overflow: Visible, + align_items: Stretch, + align_self: Auto, + align_content: Start, + justify_content: SpaceBetween, + grow: 1.0, + shrink: 0.0, + basis: Auto, + grid_columns: [], + grid_rows: [], + }, + paint: Paint { + background: None, + border: None, + radius: 0.0, + }, + role: Group, + children: [ + Text( + TextNode { + common: NodeCommon { + id: NodeId( + "outer-card/card-title", + ), + visible: Literal( + BoolLiteral { + value: true, + }, + ), + a11y_label: None, + }, + content: Literal( + TextLiteral { + value: "Card", + }, + ), + style_token: "title", + wrap: true, + max_lines: None, + selectable: false, + }, + ), + Repeat( + RepeatNode { + common: NodeCommon { + id: NodeId( + "outer-card/card-rows", + ), + visible: Literal( + BoolLiteral { + value: true, + }, + ), + a11y_label: None, + }, + collection: Records( + RecordsSource { + provider: Some( + ProviderId( + "provider.stack", + ), + ), + schema: SchemaId( + "gamecult.thing.test.swarm.v1", + ), + key_prefix: "mind-", + }, + ), + key_member: MemberPath { + steps: [ + Name( + MemberName { + name: "id", + }, + ), + ], + }, + template: Text( + TextNode { + common: NodeCommon { + id: NodeId( + "outer-card/card-row", + ), + visible: Literal( + BoolLiteral { + value: true, + }, + ), + a11y_label: None, + }, + content: Bound( + Bind { + source: Item, + member: MemberPath { + steps: [ + Name( + MemberName { + name: "name", + }, + ), + ], + }, + format: None, + }, + ), + style_token: "body", + wrap: false, + max_lines: None, + selectable: false, + }, + ), + }, + ), + Button( + ButtonNode { + common: NodeCommon { + id: NodeId( + "outer-card/card-act", + ), + visible: Literal( + BoolLiteral { + value: true, + }, + ), + a11y_label: None, + }, + content: [ + Text( + TextNode { + common: NodeCommon { + id: NodeId( + "outer-card/card-act-label", + ), + visible: Literal( + BoolLiteral { + value: true, + }, + ), + a11y_label: None, + }, + content: Literal( + TextLiteral { + value: "Open", + }, + ), + style_token: "body", + wrap: true, + max_lines: None, + selectable: false, + }, + ), + ], + on_activate: Id( + CommandIdRef { + id: CommandId( + "open", + ), + }, + ), + enabled: Literal( + BoolLiteral { + value: true, + }, + ), + }, + ), + Box( + BoxNode { + common: NodeCommon { + id: NodeId( + "inner-card", + ), + visible: Literal( + BoolLiteral { + value: true, + }, + ), + a11y_label: None, + }, + style: BoxStyle { + display: Flex, + direction: Column, + wrap: NoWrap, + gap: Size2 { + width: Px( + Scalar { + value: 4.0, + }, + ), + height: Px( + Scalar { + value: 8.0, + }, + ), + }, + padding: Edges { + top: Px( + Scalar { + value: 2.0, + }, + ), + right: Px( + Scalar { + value: 2.0, + }, + ), + bottom: Px( + Scalar { + value: 2.0, + }, + ), + left: Px( + Scalar { + value: 2.0, + }, + ), + }, + margin: Edges { + top: Auto, + right: Auto, + bottom: Auto, + left: Auto, + }, + size: Size2 { + width: Percent( + Scalar { + value: 100.0, + }, + ), + height: Content, + }, + min_size: Size2 { + width: Px( + Scalar { + value: 0.0, + }, + ), + height: Px( + Scalar { + value: 0.0, + }, + ), + }, + max_size: Size2 { + width: Auto, + height: Auto, + }, + position: Relative, + inset: Edges { + top: Auto, + right: Auto, + bottom: Auto, + left: Auto, + }, + overflow: Visible, + align_items: Stretch, + align_self: Auto, + align_content: Start, + justify_content: SpaceBetween, + grow: 1.0, + shrink: 0.0, + basis: Auto, + grid_columns: [], + grid_rows: [], + }, + paint: Paint { + background: None, + border: None, + radius: 0.0, + }, + role: Group, + children: [ + Text( + TextNode { + common: NodeCommon { + id: NodeId( + "inner-card/card-title", + ), + visible: Literal( + BoolLiteral { + value: true, + }, + ), + a11y_label: None, + }, + content: Literal( + TextLiteral { + value: "Card", + }, + ), + style_token: "title", + wrap: true, + max_lines: None, + selectable: false, + }, + ), + Repeat( + RepeatNode { + common: NodeCommon { + id: NodeId( + "inner-card/card-rows", + ), + visible: Literal( + BoolLiteral { + value: true, + }, + ), + a11y_label: None, + }, + collection: Records( + RecordsSource { + provider: Some( + ProviderId( + "provider.stack", + ), + ), + schema: SchemaId( + "gamecult.thing.test.swarm.v1", + ), + key_prefix: "mind-", + }, + ), + key_member: MemberPath { + steps: [ + Name( + MemberName { + name: "id", + }, + ), + ], + }, + template: Text( + TextNode { + common: NodeCommon { + id: NodeId( + "inner-card/card-row", + ), + visible: Literal( + BoolLiteral { + value: true, + }, + ), + a11y_label: None, + }, + content: Bound( + Bind { + source: Item, + member: MemberPath { + steps: [ + Name( + MemberName { + name: "name", + }, + ), + ], + }, + format: None, + }, + ), + style_token: "body", + wrap: false, + max_lines: None, + selectable: false, + }, + ), + }, + ), + Button( + ButtonNode { + common: NodeCommon { + id: NodeId( + "inner-card/card-act", + ), + visible: Literal( + BoolLiteral { + value: true, + }, + ), + a11y_label: None, + }, + content: [ + Text( + TextNode { + common: NodeCommon { + id: NodeId( + "inner-card/card-act-label", + ), + visible: Literal( + BoolLiteral { + value: true, + }, + ), + a11y_label: None, + }, + content: Literal( + TextLiteral { + value: "Open", + }, + ), + style_token: "body", + wrap: true, + max_lines: None, + selectable: false, + }, + ), + ], + on_activate: Id( + CommandIdRef { + id: CommandId( + "open", + ), + }, + ), + enabled: Literal( + BoolLiteral { + value: true, + }, + ), + }, + ), + Text( + TextNode { + common: NodeCommon { + id: NodeId( + "inner-note", + ), + visible: Literal( + BoolLiteral { + value: true, + }, + ), + a11y_label: None, + }, + content: Literal( + TextLiteral { + value: "nested", + }, + ), + style_token: "body", + wrap: true, + max_lines: None, + selectable: false, + }, + ), + ], + }, + ), + ], + }, + ), + ], + }, + ), + commands: [ + CommandDecl { + id: CommandId( + "open", + ), + payload_schema: SchemaId( + "gamecult.thing.test.open.v1", + ), + captures: [], + confirm: None, + }, + ], +} diff --git a/crates/thing-testkit/fixtures/f09-composition-stack.surface.cc b/crates/thing-testkit/fixtures/f09-composition-stack.surface.cc index 2fbb0ce..e72f6bd 100644 Binary files a/crates/thing-testkit/fixtures/f09-composition-stack.surface.cc and b/crates/thing-testkit/fixtures/f09-composition-stack.surface.cc differ diff --git a/crates/thing-testkit/fixtures/f10-hostile.surface.cc b/crates/thing-testkit/fixtures/f10-hostile.surface.cc index e96531a..56e3926 100644 Binary files a/crates/thing-testkit/fixtures/f10-hostile.surface.cc and b/crates/thing-testkit/fixtures/f10-hostile.surface.cc differ