@native-sdk/cli 0.5.4 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/build/app.zig +50 -1
  2. package/build.zig +534 -3
  3. package/build.zig.zon +7 -0
  4. package/native-sdk.d.ts +3 -1
  5. package/package.json +9 -9
  6. package/packages/core/package-lock.json +2 -2
  7. package/packages/core/package.json +1 -1
  8. package/packages/core/rt/rt.zig +280 -8
  9. package/packages/core/sdk/core.ts +481 -2
  10. package/packages/core/sdk/events.ts +17 -8
  11. package/packages/core/src/checker.ts +305 -2
  12. package/packages/core/src/diagnostics.ts +12 -0
  13. package/packages/core/src/emitter.ts +599 -3
  14. package/packages/core/src/typed_ast.ts +51 -4
  15. package/packages/core/src/types.ts +34 -1
  16. package/skill-data/native-ui/SKILL.md +39 -2
  17. package/skill-data/ts-core/SKILL.md +4 -2
  18. package/src/app_runner/root.zig +32 -10
  19. package/src/automation/layout_fingerprint.zig +160 -0
  20. package/src/automation/protocol.zig +82 -33
  21. package/src/automation/root.zig +1 -0
  22. package/src/automation/server.zig +1 -1
  23. package/src/automation/snapshot.zig +68 -9
  24. package/src/automation/watcher.zig +1 -1
  25. package/src/embed/host.zig +5 -0
  26. package/src/embed/ui_host.zig +13 -0
  27. package/src/platform/linux/gtk_host.c +527 -13
  28. package/src/platform/linux/gtk_host.h +25 -0
  29. package/src/platform/linux/root.zig +280 -7
  30. package/src/platform/macos/appkit_host.h +104 -6
  31. package/src/platform/macos/appkit_host.m +1283 -66
  32. package/src/platform/macos/cef_host.mm +110 -1
  33. package/src/platform/macos/root.zig +287 -7
  34. package/src/platform/null_platform.zig +398 -4
  35. package/src/platform/null_platform_tests.zig +35 -0
  36. package/src/platform/root.zig +9 -0
  37. package/src/platform/types.zig +386 -14
  38. package/src/platform/windows/root.zig +298 -9
  39. package/src/platform/windows/webview2_host.cpp +330 -5
  40. package/src/primitives/app_manifest/validation.zig +18 -0
  41. package/src/primitives/canvas/a11y_audit.zig +33 -11
  42. package/src/primitives/canvas/a11y_audit_tests.zig +20 -0
  43. package/src/primitives/canvas/drawing.zig +25 -0
  44. package/src/primitives/canvas/equality.zig +8 -0
  45. package/src/primitives/canvas/events.zig +103 -16
  46. package/src/primitives/canvas/frame.zig +125 -1
  47. package/src/primitives/canvas/layout_audit.zig +22 -5
  48. package/src/primitives/canvas/markdown_hostile_tests.zig +8 -4
  49. package/src/primitives/canvas/render_tests.zig +13 -10
  50. package/src/primitives/canvas/root.zig +48 -0
  51. package/src/primitives/canvas/terminal_box.zig +471 -0
  52. package/src/primitives/canvas/terminal_grid.zig +978 -0
  53. package/src/primitives/canvas/terminal_grid_tests.zig +1093 -0
  54. package/src/primitives/canvas/test_support.zig +1 -0
  55. package/src/primitives/canvas/tests.zig +1 -0
  56. package/src/primitives/canvas/text_tests.zig +39 -4
  57. package/src/primitives/canvas/tokens.zig +115 -12
  58. package/src/primitives/canvas/ui.zig +524 -5
  59. package/src/primitives/canvas/ui_markup.zig +195 -2
  60. package/src/primitives/canvas/ui_markup_compiled.zig +172 -1
  61. package/src/primitives/canvas/ui_markup_compiled_tests.zig +133 -8
  62. package/src/primitives/canvas/ui_markup_contract.zig +88 -5
  63. package/src/primitives/canvas/ui_markup_contract_tests.zig +39 -1
  64. package/src/primitives/canvas/ui_markup_huge_model_tests.zig +1 -0
  65. package/src/primitives/canvas/ui_markup_reflect.zig +75 -24
  66. package/src/primitives/canvas/ui_markup_tests.zig +149 -0
  67. package/src/primitives/canvas/ui_markup_view.zig +191 -0
  68. package/src/primitives/canvas/ui_markup_view_tests.zig +403 -19
  69. package/src/primitives/canvas/ui_schema.zig +97 -17
  70. package/src/primitives/canvas/ui_schema_tests.zig +18 -11
  71. package/src/primitives/canvas/ui_tests.zig +141 -9
  72. package/src/primitives/canvas/widget_access.zig +28 -2
  73. package/src/primitives/canvas/widget_anchored_tests.zig +48 -0
  74. package/src/primitives/canvas/widget_invalidation.zig +81 -1
  75. package/src/primitives/canvas/widget_layout.zig +59 -11
  76. package/src/primitives/canvas/widget_layout_tests.zig +125 -4
  77. package/src/primitives/canvas/widget_render.zig +272 -18
  78. package/src/primitives/canvas/widget_render_scroll.zig +108 -27
  79. package/src/primitives/canvas/widget_routing.zig +59 -7
  80. package/src/primitives/canvas/widget_runtime.zig +23 -0
  81. package/src/primitives/canvas/widget_runtime_tests.zig +149 -0
  82. package/src/primitives/canvas/widget_semantics.zig +119 -11
  83. package/src/primitives/canvas/widget_semantics_tests.zig +409 -0
  84. package/src/primitives/canvas/widget_tree.zig +17 -0
  85. package/src/primitives/canvas/widgets.zig +132 -0
  86. package/src/root.zig +16 -0
  87. package/src/runtime/api.zig +70 -1
  88. package/src/runtime/automation_commands.zig +20 -1
  89. package/src/runtime/automation_snapshot.zig +25 -1
  90. package/src/runtime/automation_widget_dispatch.zig +73 -8
  91. package/src/runtime/bridge_payload.zig +1 -0
  92. package/src/runtime/canvas_frame.zig +62 -7
  93. package/src/runtime/canvas_frame_animation_tests.zig +5 -4
  94. package/src/runtime/canvas_frame_helpers.zig +190 -1
  95. package/src/runtime/canvas_frame_invalidation_tests.zig +531 -0
  96. package/src/runtime/canvas_frame_patch_tests.zig +161 -10
  97. package/src/runtime/canvas_frame_retained_tests.zig +5 -2
  98. package/src/runtime/canvas_widget_accessibility_tests.zig +1 -1
  99. package/src/runtime/canvas_widget_clipboard_tests.zig +40 -0
  100. package/src/runtime/canvas_widget_context_menu.zig +269 -32
  101. package/src/runtime/canvas_widget_context_menu_tests.zig +640 -14
  102. package/src/runtime/canvas_widget_display.zig +1 -1
  103. package/src/runtime/canvas_widget_event_tests.zig +1823 -0
  104. package/src/runtime/canvas_widget_events.zig +240 -24
  105. package/src/runtime/canvas_widget_runtime.zig +213 -29
  106. package/src/runtime/canvas_widget_scroll_driver_tests.zig +170 -7
  107. package/src/runtime/canvas_widget_scroll_drivers.zig +151 -17
  108. package/src/runtime/canvas_widget_scroll_tests.zig +435 -23
  109. package/src/runtime/canvas_widget_state.zig +6 -0
  110. package/src/runtime/canvas_widget_text_tests.zig +1 -1
  111. package/src/runtime/core.zig +73 -2
  112. package/src/runtime/effects.zig +6389 -54
  113. package/src/runtime/effects_channel_tests.zig +3519 -0
  114. package/src/runtime/effects_pty_tests.zig +1362 -0
  115. package/src/runtime/effects_tests.zig +14 -9
  116. package/src/runtime/effects_video_tests.zig +3609 -0
  117. package/src/runtime/flow.zig +25 -4
  118. package/src/runtime/gpu_surface_events.zig +473 -13
  119. package/src/runtime/media_surface.zig +116 -11
  120. package/src/runtime/media_surface_tests.zig +61 -0
  121. package/src/runtime/pty.zig +1252 -0
  122. package/src/runtime/pty_windows.zig +1780 -0
  123. package/src/runtime/root.zig +25 -0
  124. package/src/runtime/runtime_event_tests.zig +20 -1
  125. package/src/runtime/session_journal.zig +367 -61
  126. package/src/runtime/session_record.zig +16 -0
  127. package/src/runtime/session_replay.zig +395 -11
  128. package/src/runtime/session_tests.zig +109 -15
  129. package/src/runtime/terminal_session.zig +1569 -0
  130. package/src/runtime/terminal_session_tests.zig +450 -0
  131. package/src/runtime/terminal_vt_ghostty.zig +15 -0
  132. package/src/runtime/terminal_vt_stub.zig +13 -0
  133. package/src/runtime/tests.zig +6 -0
  134. package/src/runtime/ts_core_host.zig +980 -140
  135. package/src/runtime/ts_core_host_tests.zig +1059 -1
  136. package/src/runtime/ts_ui_app.zig +16 -5
  137. package/src/runtime/ui_app.zig +2333 -63
  138. package/src/runtime/ui_app_tests.zig +3171 -744
  139. package/src/runtime/ui_app_virtual_variable_tests.zig +4 -2
  140. package/src/runtime/ui_app_window_tests.zig +268 -0
  141. package/src/runtime/view.zig +190 -2
  142. package/src/runtime/view_widget_scroll.zig +218 -68
  143. package/src/runtime/view_widget_text.zig +11 -2
  144. package/src/runtime/view_widget_tree.zig +111 -3
  145. package/src/runtime/window_storage.zig +45 -2
  146. package/src/runtime/window_view_runtime.zig +34 -2
  147. package/src/runtime/window_views.zig +1 -0
  148. package/src/terminal_session_tests_root.zig +15 -0
  149. package/src/tooling/templates.zig +25 -7
@@ -675,6 +675,42 @@ test "overscroll on scroll stamps the region's edge behavior" {
675
675
  try testing.expectEqual(canvas.ScrollOverscroll.none, canvas.widgetScrollPhysics(tree.root.children[1], physics).overscroll);
676
676
  }
677
677
 
678
+ test "axis and value-x stamp the region's scroll axes and horizontal offset" {
679
+ var arena_state = std.heap.ArenaAllocator.init(testing.allocator);
680
+ defer arena_state.deinit();
681
+ const arena = arena_state.allocator();
682
+ const model = Model{};
683
+
684
+ var view = try InboxMarkup.init(arena, "<column>\n <scroll axis=\"horizontal\" value-x=\"120\">\n <row><text>a</text></row>\n </scroll>\n <scroll axis=\"both\">\n <column><text>b</text></column>\n </scroll>\n <scroll>\n <column><text>c</text></column>\n </scroll>\n</column>");
685
+ var ui = InboxUi.init(arena);
686
+ const tree = try ui.finalize(try view.build(&ui, &model));
687
+ const shelf = tree.root.children[0];
688
+ try testing.expectEqual(canvas.WidgetKind.scroll_view, shelf.kind);
689
+ try testing.expectEqual(canvas.ScrollAxes.horizontal, shelf.scroll_axes);
690
+ try testing.expectEqual(@as(f32, 120), shelf.value_x);
691
+ try testing.expect(canvas.widgetScrollsAxis(shelf, .horizontal));
692
+ try testing.expect(!canvas.widgetScrollsAxis(shelf, .vertical));
693
+ const freeform = tree.root.children[1];
694
+ try testing.expectEqual(canvas.ScrollAxes.both, freeform.scroll_axes);
695
+ try testing.expect(canvas.widgetScrollsAxis(freeform, .horizontal));
696
+ try testing.expect(canvas.widgetScrollsAxis(freeform, .vertical));
697
+ // The undeclared region keeps the pre-axis default: vertical only.
698
+ const classic = tree.root.children[2];
699
+ try testing.expectEqual(canvas.ScrollAxes.vertical, classic.scroll_axes);
700
+ try testing.expect(!canvas.widgetScrollsAxis(classic, .horizontal));
701
+ try testing.expect(canvas.widgetScrollsAxis(classic, .vertical));
702
+ }
703
+
704
+ test "axis value vocabulary mirrors the live ScrollAxes enum" {
705
+ // The validator's std-only mirror of the enum's member names; a new
706
+ // member cannot ship without its markup spelling.
707
+ const fields = @typeInfo(canvas.ScrollAxes).@"enum".fields;
708
+ try testing.expectEqual(fields.len, canvas.ui_markup.axis_value_names.len);
709
+ inline for (fields, 0..) |field, index| {
710
+ try testing.expectEqualStrings(field.name, canvas.ui_markup.axis_value_names[index]);
711
+ }
712
+ }
713
+
678
714
  test "overscroll value vocabulary mirrors the live WidgetOverscroll enum" {
679
715
  // The validator's std-only mirror of the enum's member names; a new
680
716
  // member cannot ship without its markup spelling.
@@ -1050,6 +1086,51 @@ pub const picker_markup_source =
1050
1086
  \\</column>
1051
1087
  ;
1052
1088
 
1089
+ /// Shared source for the hover-pair parity tests (interpreter here,
1090
+ /// compiled engine in ui_markup_compiled_tests.zig): nested hover
1091
+ /// listeners on LAYOUT containers — legal everywhere like the press
1092
+ /// family, and the binding is what makes them hover-hittable.
1093
+ pub const hover_markup_source =
1094
+ \\<column gap="8">
1095
+ \\ <panel padding="8" on-hover-enter="add" on-hover-leave="toggle:{open_count}">
1096
+ \\ <row gap="4" on-hover-enter="add">
1097
+ \\ <text>Peek target</text>
1098
+ \\ </row>
1099
+ \\ </panel>
1100
+ \\</column>
1101
+ ;
1102
+
1103
+ test "markup binds the hover pair and makes listeners hover-hittable, never pressable" {
1104
+ var arena_state = std.heap.ArenaAllocator.init(testing.allocator);
1105
+ defer arena_state.deinit();
1106
+ const arena = arena_state.allocator();
1107
+ const model = Model{};
1108
+
1109
+ var view = try InboxMarkup.init(arena, hover_markup_source);
1110
+ var ui = InboxUi.init(arena);
1111
+ const tree = try ui.finalize(try view.build(&ui, &model));
1112
+
1113
+ const panel = tree.root.children[0];
1114
+ const row = panel.children[0];
1115
+ try testing.expect(panel.hover_msgs);
1116
+ try testing.expect(row.hover_msgs);
1117
+ // Hover listening never implies pressability OR interactive
1118
+ // hit-testing: no press action, no press claim, invisible to the
1119
+ // wash/press hit test — only the hover-containment policy sees it.
1120
+ try testing.expect(!row.semantics.actions.press);
1121
+ try testing.expect(!canvas.widgetClaimsPress(row));
1122
+ try testing.expect(!canvas.widgetIsHitTarget(row));
1123
+ try testing.expect(canvas.widgetIsHoverMsgHitTarget(row));
1124
+
1125
+ // Both edges resolve through the handler table; an element binding
1126
+ // only enter has no leave Msg, and plain children listen for nothing.
1127
+ try testing.expectEqual(Msg.add, tree.msgFor(panel.id, .hover_enter).?);
1128
+ try testing.expectEqual(@as(u32, 0), tree.msgFor(panel.id, .hover_leave).?.toggle);
1129
+ try testing.expectEqual(Msg.add, tree.msgFor(row.id, .hover_enter).?);
1130
+ try testing.expect(tree.msgFor(row.id, .hover_leave) == null);
1131
+ try testing.expect(!row.children[0].hover_msgs);
1132
+ }
1133
+
1053
1134
  test "markup anchors dropdown-menus and binds dismiss and hold handlers" {
1054
1135
  var arena_state = std.heap.ArenaAllocator.init(testing.allocator);
1055
1136
  defer arena_state.deinit();
@@ -2677,6 +2758,288 @@ test "image leaf misuse fails the build with the teaching messages" {
2677
2758
  }
2678
2759
  }
2679
2760
 
2761
+ // ---------------------------------------------- video playback element
2762
+
2763
+ pub const VideoElementMsg = union(enum) { refresh };
2764
+
2765
+ pub const VideoElementModel = struct {
2766
+ clip: []const u8 = "assets/clips/intro.mp4",
2767
+ count: usize = 3,
2768
+ };
2769
+
2770
+ pub const video_markup_source =
2771
+ \\<column>
2772
+ \\ <video src="{clip}" controls autoplay loop muted width="320" height="180" label="Trailer"/>
2773
+ \\</column>
2774
+ ;
2775
+
2776
+ pub const video_plain_markup_source =
2777
+ \\<column>
2778
+ \\ <video src="assets/clips/intro.mp4" width="320" height="180" label="Trailer"/>
2779
+ \\</column>
2780
+ ;
2781
+
2782
+ pub const VideoElementUi = canvas.Ui(VideoElementMsg);
2783
+
2784
+ /// The hand-written equivalent of the video markup: `ui.video` with the
2785
+ /// same options, the parity baseline the compiled suite shares.
2786
+ pub fn handVideoElementView(ui: *VideoElementUi, model: *const VideoElementModel) VideoElementUi.Node {
2787
+ return ui.column(.{}, .{
2788
+ ui.video(.{
2789
+ .src = model.clip,
2790
+ .controls = true,
2791
+ .autoplay = true,
2792
+ .loop = true,
2793
+ .muted = true,
2794
+ .width = 320,
2795
+ .height = 180,
2796
+ .label = "Trailer",
2797
+ }),
2798
+ });
2799
+ }
2800
+
2801
+ /// The first widget in the tree carrying the given video-control verb,
2802
+ /// or null: how tests find the house chrome's runtime-consumed controls.
2803
+ pub fn findVideoControl(widget: canvas.Widget, verb: canvas.VideoControlVerb) ?canvas.Widget {
2804
+ if (widget.video_control == verb) return widget;
2805
+ for (widget.children) |child| {
2806
+ if (findVideoControl(child, verb)) |found| return found;
2807
+ }
2808
+ return null;
2809
+ }
2810
+
2811
+ // -------------------------------------------------- terminal element
2812
+
2813
+ pub const TerminalElementMsg = union(enum) { term_state: canvas.TerminalState };
2814
+
2815
+ pub const TerminalElementModel = struct {
2816
+ shell: u64 = 7,
2817
+ offset: u32 = 4,
2818
+ };
2819
+
2820
+ pub const terminal_markup_source =
2821
+ \\<column>
2822
+ \\ <terminal pty="{shell}" scrollback="{offset}" grow="1" label="Build shell" on-terminal="term_state"/>
2823
+ \\</column>
2824
+ ;
2825
+
2826
+ pub const TerminalElementUi = canvas.Ui(TerminalElementMsg);
2827
+
2828
+ /// The hand-written equivalent of the terminal markup: `ui.terminal`
2829
+ /// with the same options, the parity baseline the compiled suite shares.
2830
+ pub fn handTerminalElementView(ui: *TerminalElementUi, model: *const TerminalElementModel) TerminalElementUi.Node {
2831
+ return ui.column(.{}, .{
2832
+ ui.terminal(.{
2833
+ .pty = model.shell,
2834
+ .scrollback = model.offset,
2835
+ .grow = 1,
2836
+ .semantics = .{ .label = "Build shell" },
2837
+ .on_terminal = TerminalElementUi.terminalMsg(.term_state),
2838
+ }),
2839
+ });
2840
+ }
2841
+
2842
+ /// The first widget of the given kind in the tree, or null.
2843
+ pub fn findWidgetKind(widget: canvas.Widget, kind: canvas.WidgetKind) ?canvas.Widget {
2844
+ if (widget.kind == kind) return widget;
2845
+ for (widget.children) |child| {
2846
+ if (findWidgetKind(child, kind)) |found| return found;
2847
+ }
2848
+ return null;
2849
+ }
2850
+
2851
+ test "the terminal element binds its pty key, scrollback echo, and view-state handler" {
2852
+ var arena_state = std.heap.ArenaAllocator.init(testing.allocator);
2853
+ defer arena_state.deinit();
2854
+ const arena = arena_state.allocator();
2855
+
2856
+ const model = TerminalElementModel{};
2857
+ var view = try markup_view.MarkupView(TerminalElementModel, TerminalElementMsg).init(arena, terminal_markup_source);
2858
+ var ui = TerminalElementUi.init(arena);
2859
+ const tree = try ui.finalize(try view.build(&ui, &model));
2860
+
2861
+ const widget = findWidgetKind(tree.root, .terminal) orelse return error.TestExpectedTerminal;
2862
+ try testing.expectEqual(@as(u64, 7), widget.terminal.pty);
2863
+ try testing.expectEqual(@as(u32, 4), widget.terminal.scrollback);
2864
+ // No lookup installed (a bare builder): the widget renders unbound
2865
+ // and the author's label stays the accessible name.
2866
+ try testing.expect(widget.terminal.grid == null);
2867
+ try testing.expectEqualStrings("Build shell", widget.semantics.label);
2868
+
2869
+ // The view-state handler resolves through the tree and carries the
2870
+ // applied state.
2871
+ const msg = tree.msgForTerminal(widget.id, .{ .scrollback = 12, .history = 40, .cols = 80, .rows = 24 }) orelse return error.TestExpectedHandler;
2872
+ try testing.expectEqual(@as(u32, 12), msg.term_state.scrollback);
2873
+ try testing.expectEqual(@as(u32, 40), msg.term_state.history);
2874
+ try testing.expectEqual(@as(u16, 80), msg.term_state.cols);
2875
+ try testing.expectEqual(@as(u16, 24), msg.term_state.rows);
2876
+ }
2877
+
2878
+ test "the interpreter enforces the terminal leaf shape without the validator" {
2879
+ // Hot reload builds without a validation pass: the build itself must
2880
+ // refuse a pty-less terminal (dead markup) and terminal children (no
2881
+ // child slots), exactly like the image leaf.
2882
+ var arena_state = std.heap.ArenaAllocator.init(testing.allocator);
2883
+ defer arena_state.deinit();
2884
+ const arena = arena_state.allocator();
2885
+ const model = TerminalElementModel{};
2886
+
2887
+ const missing_pty =
2888
+ \\<column>
2889
+ \\ <terminal label="Shell"/>
2890
+ \\</column>
2891
+ ;
2892
+ var missing_view = try markup_view.MarkupView(TerminalElementModel, TerminalElementMsg).init(arena, missing_pty);
2893
+ var missing_ui = TerminalElementUi.init(arena);
2894
+ try testing.expectError(error.MarkupBuild, missing_view.build(&missing_ui, &model));
2895
+ try testing.expectEqualStrings(canvas.ui_markup.terminal_missing_pty_message, missing_view.diagnostic.message);
2896
+
2897
+ const with_child =
2898
+ \\<column>
2899
+ \\ <terminal pty="{shell}" label="Shell"><button>Run</button></terminal>
2900
+ \\</column>
2901
+ ;
2902
+ var child_view = try markup_view.MarkupView(TerminalElementModel, TerminalElementMsg).init(arena, with_child);
2903
+ var child_ui = TerminalElementUi.init(arena);
2904
+ try testing.expectError(error.MarkupBuild, child_view.build(&child_ui, &model));
2905
+ try testing.expectEqualStrings(canvas.ui_markup.terminal_children_message, child_view.diagnostic.message);
2906
+
2907
+ const misplaced_scrollback =
2908
+ \\<column>
2909
+ \\ <panel scrollback="3"/>
2910
+ \\</column>
2911
+ ;
2912
+ var scoped_view = try markup_view.MarkupView(TerminalElementModel, TerminalElementMsg).init(arena, misplaced_scrollback);
2913
+ var scoped_ui = TerminalElementUi.init(arena);
2914
+ try testing.expectError(error.MarkupBuild, scoped_view.build(&scoped_ui, &model));
2915
+ try testing.expectEqualStrings(canvas.ui_markup.scrollback_element_message, scoped_view.diagnostic.message);
2916
+ }
2917
+
2918
+ test "on-terminal requires a bare tag: an authored payload is refused" {
2919
+ var arena_state = std.heap.ArenaAllocator.init(testing.allocator);
2920
+ defer arena_state.deinit();
2921
+ const arena = arena_state.allocator();
2922
+
2923
+ // The runtime supplies the TerminalState, so `term_state:{offset}`
2924
+ // is dead data — refused with the payload teaching, not silently
2925
+ // discarded.
2926
+ const source =
2927
+ \\<column>
2928
+ \\ <terminal pty="{shell}" label="Shell" on-terminal="term_state:{offset}"/>
2929
+ \\</column>
2930
+ ;
2931
+ var view = try markup_view.MarkupView(TerminalElementModel, TerminalElementMsg).init(arena, source);
2932
+ var ui = TerminalElementUi.init(arena);
2933
+ const model = TerminalElementModel{};
2934
+ try testing.expectError(error.MarkupBuild, view.build(&ui, &model));
2935
+ try testing.expectEqualStrings(canvas.ui_markup.on_terminal_payload_message, view.diagnostic.message);
2936
+ }
2937
+
2938
+ test "the video element lowers to the playback surface with house chrome and records the declaration" {
2939
+ var arena_state = std.heap.ArenaAllocator.init(testing.allocator);
2940
+ defer arena_state.deinit();
2941
+ const arena = arena_state.allocator();
2942
+ const VideoMarkup = markup_view.MarkupView(VideoElementModel, VideoElementMsg);
2943
+ const model = VideoElementModel{};
2944
+
2945
+ var view = try VideoMarkup.init(arena, video_markup_source);
2946
+ var markup_ui = VideoElementUi.init(arena);
2947
+ const markup_tree = try markup_ui.finalize(try view.build(&markup_ui, &model));
2948
+
2949
+ var hand_ui = VideoElementUi.init(arena);
2950
+ const hand_tree = try hand_ui.finalize(handVideoElementView(&hand_ui, &model));
2951
+
2952
+ var markup_ids: std.ArrayListUnmanaged(canvas.ObjectId) = .empty;
2953
+ defer markup_ids.deinit(testing.allocator);
2954
+ var hand_ids: std.ArrayListUnmanaged(canvas.ObjectId) = .empty;
2955
+ defer hand_ids.deinit(testing.allocator);
2956
+ try collectIds(markup_tree.root, &markup_ids, testing.allocator);
2957
+ try collectIds(hand_tree.root, &hand_ids, testing.allocator);
2958
+ try testing.expectEqualSlices(canvas.ObjectId, hand_ids.items, markup_ids.items);
2959
+
2960
+ // With controls the element is a column: the playback surface bound
2961
+ // to the framework-owned playback id, then the transport row whose
2962
+ // controls carry the runtime-consumed verbs.
2963
+ const video_root = markup_tree.root.children[0];
2964
+ try testing.expectEqual(canvas.WidgetKind.column, video_root.kind);
2965
+ const surface = video_root.children[0];
2966
+ try testing.expectEqual(canvas.WidgetKind.media_surface, surface.kind);
2967
+ try testing.expectEqual(canvas.video_playback_surface_id, surface.image_id);
2968
+ try testing.expectEqualStrings("Trailer", surface.semantics.label);
2969
+ const toggle = findVideoControl(markup_tree.root, .toggle) orelse return error.TestUnexpectedResult;
2970
+ try testing.expectEqual(canvas.WidgetKind.button, toggle.kind);
2971
+ // The chrome renders the channel snapshot; outside an app loop the
2972
+ // default state is inactive, so the transport is disabled at the
2973
+ // play glyph.
2974
+ try testing.expect(toggle.state.disabled);
2975
+ try testing.expectEqualStrings("play", toggle.icon);
2976
+ const scrub = findVideoControl(markup_tree.root, .scrub) orelse return error.TestUnexpectedResult;
2977
+ try testing.expectEqual(canvas.WidgetKind.slider, scrub.kind);
2978
+ try testing.expect(scrub.state.disabled);
2979
+
2980
+ // The build recorded the declaration for the app loop's reconcile.
2981
+ const declaration = markup_ui.video_declaration orelse return error.TestUnexpectedResult;
2982
+ try testing.expectEqualStrings("assets/clips/intro.mp4", declaration.src);
2983
+ try testing.expect(declaration.controls);
2984
+ try testing.expect(declaration.autoplay);
2985
+ try testing.expect(declaration.loop);
2986
+ try testing.expect(declaration.muted);
2987
+
2988
+ // Without controls the element is the surface itself: no chrome
2989
+ // anywhere in the tree.
2990
+ var plain_view = try VideoMarkup.init(arena, video_plain_markup_source);
2991
+ var plain_ui = VideoElementUi.init(arena);
2992
+ const plain_tree = try plain_ui.finalize(try plain_view.build(&plain_ui, &model));
2993
+ const plain_surface = plain_tree.root.children[0];
2994
+ try testing.expectEqual(canvas.WidgetKind.media_surface, plain_surface.kind);
2995
+ try testing.expectEqual(canvas.video_playback_surface_id, plain_surface.image_id);
2996
+ try testing.expect(findVideoControl(plain_tree.root, .toggle) == null);
2997
+ try testing.expect(findVideoControl(plain_tree.root, .scrub) == null);
2998
+ try testing.expect(plain_ui.video_declaration != null);
2999
+ }
3000
+
3001
+ test "video misuse fails the build with the teaching messages" {
3002
+ var arena_state = std.heap.ArenaAllocator.init(testing.allocator);
3003
+ defer arena_state.deinit();
3004
+ const arena = arena_state.allocator();
3005
+ const model = VideoElementModel{};
3006
+ const VideoMarkup = markup_view.MarkupView(VideoElementModel, VideoElementMsg);
3007
+
3008
+ const cases = [_]struct { source: []const u8, message: []const u8 }{
3009
+ .{
3010
+ // A leaf like image and icon: nested content would silently
3011
+ // vanish (the compiled engine rejects the same construct as
3012
+ // a compile error).
3013
+ .source = "<row>\n <video src=\"a.mp4\"><text>Caption</text></video>\n</row>",
3014
+ .message = canvas.ui_markup.video_children_message,
3015
+ },
3016
+ .{
3017
+ // The closed attribute set teaches its vocabulary.
3018
+ .source = "<row>\n <video src=\"a.mp4\" gap=\"4\"/>\n</row>",
3019
+ .message = canvas.ui_markup.video_attr_message,
3020
+ },
3021
+ .{
3022
+ // A bound src must produce the source STRING (count is a
3023
+ // number).
3024
+ .source = "<row>\n <video src=\"{count}\"/>\n</row>",
3025
+ .message = canvas.ui_markup.video_src_message,
3026
+ },
3027
+ .{
3028
+ // The flags are video-scoped: anywhere else they would be
3029
+ // silently inert.
3030
+ .source = "<row>\n <panel controls=\"true\"/>\n</row>",
3031
+ .message = canvas.ui_markup.video_flag_element_message,
3032
+ },
3033
+ };
3034
+ for (cases) |case| {
3035
+ var view = try VideoMarkup.init(arena, case.source);
3036
+ var ui = VideoElementUi.init(arena);
3037
+ try testing.expectError(error.MarkupBuild, view.build(&ui, &model));
3038
+ try testing.expectEqualStrings(case.message, view.diagnostic.message);
3039
+ try testing.expect(view.diagnostic.line > 0);
3040
+ }
3041
+ }
3042
+
2680
3043
  // ------------------------------------- text alignment and grid columns
2681
3044
 
2682
3045
  pub const AlignMsg = union(enum) { refresh };
@@ -4149,10 +4512,14 @@ test "declaredTextInputUnion accepts the emitted mirror shape and rejects near-m
4149
4512
  /// independently (the number tier): float fields widen exactly, integer
4150
4513
  /// fields round.
4151
4514
  pub const MirrorScrollState = struct {
4152
- offset: f64,
4153
- velocity: f64,
4154
- viewportExtent: i64,
4155
- contentExtent: i64,
4515
+ offsetX: f64,
4516
+ offsetY: f64,
4517
+ velocityX: f64,
4518
+ velocityY: f64,
4519
+ viewportExtentX: i64,
4520
+ viewportExtentY: i64,
4521
+ contentExtentX: i64,
4522
+ contentExtentY: i64,
4156
4523
  };
4157
4524
 
4158
4525
  pub const MirrorControlsModel = struct {
@@ -4171,18 +4538,27 @@ pub const MirrorControlsMsg = union(enum) {
4171
4538
 
4172
4539
  test "declaredScrollStateRecord accepts the emitted mirror shape and rejects near-misses" {
4173
4540
  try testing.expect(markup_view.declaredScrollStateRecord(MirrorScrollState));
4174
- // The canvas struct itself matches structurally too (four f32 fields).
4541
+ // The canvas struct itself matches structurally too (eight f32 fields).
4175
4542
  try testing.expect(markup_view.declaredScrollStateRecord(canvas.ScrollState));
4176
4543
  // A Zig-declared mirror in the canvas spelling stays accepted.
4177
- try testing.expect(markup_view.declaredScrollStateRecord(struct { offset: f64, velocity: f64, viewport_extent: f64, content_extent: f64 }));
4544
+ try testing.expect(markup_view.declaredScrollStateRecord(struct { offset_x: f64, offset_y: f64, velocity_x: f64, velocity_y: f64, viewport_extent_x: f64, viewport_extent_y: f64, content_extent_x: f64, content_extent_y: f64 }));
4178
4545
  // Near-misses stay out: a missing field, a renamed field, a non-numeric
4179
4546
  // field, an extra field, a spelling mix.
4180
- try testing.expect(!markup_view.declaredScrollStateRecord(struct { offset: f64, velocity: f64, viewport_extent: f64 }));
4181
- try testing.expect(!markup_view.declaredScrollStateRecord(struct { offset: f64, velocity: f64, viewport_extent: f64, content_size: f64 }));
4182
- try testing.expect(!markup_view.declaredScrollStateRecord(struct { offset: []const u8, velocity: f64, viewport_extent: f64, content_extent: f64 }));
4183
- try testing.expect(!markup_view.declaredScrollStateRecord(struct { offset: f64, velocity: f64, viewport_extent: f64, content_extent: f64, extra: f64 }));
4184
- try testing.expect(!markup_view.declaredScrollStateRecord(struct { offset: f64, velocity: f64, viewport_extent: f64, contentExtent: f64 }));
4547
+ try testing.expect(!markup_view.declaredScrollStateRecord(struct { offset_x: f64, offset_y: f64, velocity_x: f64, velocity_y: f64, viewport_extent_x: f64, viewport_extent_y: f64, content_extent_x: f64 }));
4548
+ try testing.expect(!markup_view.declaredScrollStateRecord(struct { offset_x: f64, offset_y: f64, velocity_x: f64, velocity_y: f64, viewport_extent_x: f64, viewport_extent_y: f64, content_extent_x: f64, content_size_y: f64 }));
4549
+ try testing.expect(!markup_view.declaredScrollStateRecord(struct { offset_x: []const u8, offset_y: f64, velocity_x: f64, velocity_y: f64, viewport_extent_x: f64, viewport_extent_y: f64, content_extent_x: f64, content_extent_y: f64 }));
4550
+ try testing.expect(!markup_view.declaredScrollStateRecord(struct { offset_x: f64, offset_y: f64, velocity_x: f64, velocity_y: f64, viewport_extent_x: f64, viewport_extent_y: f64, content_extent_x: f64, content_extent_y: f64, extra: f64 }));
4551
+ try testing.expect(!markup_view.declaredScrollStateRecord(struct { offset_x: f64, offset_y: f64, velocity_x: f64, velocity_y: f64, viewport_extent_x: f64, viewport_extent_y: f64, content_extent_x: f64, contentExtentY: f64 }));
4185
4552
  try testing.expect(!markup_view.declaredScrollStateRecord(i64));
4553
+ // The RETIRED one-axis record is not a scroll-state record anymore -
4554
+ // it classifies as the legacy shape so on-scroll teaches the
4555
+ // per-axis migration by name (either spelling, never a mix).
4556
+ try testing.expect(!markup_view.declaredScrollStateRecord(struct { offset: f64, velocity: f64, viewport_extent: f64, content_extent: f64 }));
4557
+ try testing.expect(markup_view.declaredLegacyScrollStateRecord(struct { offset: f64, velocity: f64, viewport_extent: f64, content_extent: f64 }));
4558
+ try testing.expect(markup_view.declaredLegacyScrollStateRecord(struct { offset: f64, velocity: f64, viewportExtent: i64, contentExtent: i64 }));
4559
+ try testing.expect(!markup_view.declaredLegacyScrollStateRecord(MirrorScrollState));
4560
+ try testing.expect(!markup_view.declaredLegacyScrollStateRecord(canvas.ScrollState));
4561
+ try testing.expect(!markup_view.declaredLegacyScrollStateRecord(struct { offset: f64, velocity: f64, viewport_extent: f64, contentExtent: f64 }));
4186
4562
  }
4187
4563
 
4188
4564
  test "valueArmClass classifies exactly the value-carrying arm shapes" {
@@ -4211,17 +4587,25 @@ test "the interpreter binds on-scroll to a declared mirror record and translates
4211
4587
  const tree = try ui.finalize(try view.build(&ui, &model));
4212
4588
  const region = findByKind(tree.root, .scroll_view).?;
4213
4589
  const msg = tree.msgForScroll(region.id, .{
4214
- .offset = 41.5,
4215
- .velocity = -3.25,
4216
- .viewport_extent = 480.4,
4217
- .content_extent = 2000.6,
4590
+ .offset_x = 12.5,
4591
+ .offset_y = 41.5,
4592
+ .velocity_x = 1.5,
4593
+ .velocity_y = -3.25,
4594
+ .viewport_extent_x = 320.2,
4595
+ .viewport_extent_y = 480.4,
4596
+ .content_extent_x = 960.7,
4597
+ .content_extent_y = 2000.6,
4218
4598
  }).?;
4219
4599
  // Float fields widen exactly; integer-classed fields round to the
4220
4600
  // nearest whole number.
4221
- try testing.expectEqual(@as(f64, 41.5), msg.library_scrolled.offset);
4222
- try testing.expectEqual(@as(f64, -3.25), msg.library_scrolled.velocity);
4223
- try testing.expectEqual(@as(i64, 480), msg.library_scrolled.viewportExtent);
4224
- try testing.expectEqual(@as(i64, 2001), msg.library_scrolled.contentExtent);
4601
+ try testing.expectEqual(@as(f64, 12.5), msg.library_scrolled.offsetX);
4602
+ try testing.expectEqual(@as(f64, 41.5), msg.library_scrolled.offsetY);
4603
+ try testing.expectEqual(@as(f64, 1.5), msg.library_scrolled.velocityX);
4604
+ try testing.expectEqual(@as(f64, -3.25), msg.library_scrolled.velocityY);
4605
+ try testing.expectEqual(@as(i64, 320), msg.library_scrolled.viewportExtentX);
4606
+ try testing.expectEqual(@as(i64, 480), msg.library_scrolled.viewportExtentY);
4607
+ try testing.expectEqual(@as(i64, 961), msg.library_scrolled.contentExtentX);
4608
+ try testing.expectEqual(@as(i64, 2001), msg.library_scrolled.contentExtentY);
4225
4609
  }
4226
4610
 
4227
4611
  test "the interpreter binds slider on-change value arms and keeps the void static form" {
@@ -111,8 +111,8 @@ pub const AttrInfo = struct {
111
111
  /// How an event's payload reaches the Msg: `message` events take a tag
112
112
  /// with an optional `{binding}` payload; the others require a bare tag
113
113
  /// whose payload the RUNTIME supplies (TextInputEvent, ScrollState, the
114
- /// split fraction).
115
- pub const EventPayload = enum { message, text_input, scroll_state, fraction };
114
+ /// split fraction, TerminalState).
115
+ pub const EventPayload = enum { message, text_input, scroll_state, fraction, terminal_state };
116
116
 
117
117
  pub const EventInfo = struct {
118
118
  /// Stable code, assigned at birth, never reused. Nonzero.
@@ -329,6 +329,30 @@ pub const elements = [_]ElementInfo{
329
329
  // falls back to initials instead). Display-only like media-surface
330
330
  // and chart (presses fall through); pictorial for the a11y lint.
331
331
  .{ .code = 67, .name = "image", .widget_kind = "image", .hit_target = false, .a11y_name = .image },
332
+ // The video playback element: a leaf compositing the app's SINGLE
333
+ // video playback (decoded platform-side into the framework-owned
334
+ // playback surface, `canvas.video_playback_surface_id`) with
335
+ // optional house transport chrome. `src` declares the source — an
336
+ // app-assets path or an http(s) URL, the loadVideo cascade's
337
+ // resolution order — `controls` composes the house chrome
338
+ // (play/pause, elapsed, seek, duration), and autoplay/loop/muted
339
+ // shape the fresh playback. A composite: it lowers through
340
+ // `Ui.video` to existing widgets (media-surface plus the chrome
341
+ // row), so its rule hook owns the closed attribute set. Pictorial
342
+ // for the a11y lint, like media-surface and image.
343
+ .{ .code = 68, .name = "video", .rule_hook = "video", .hit_target = false, .a11y_name = .image },
344
+ // The terminal leaf: paints the framework-owned emulator session
345
+ // behind a MODEL-OWNED pty effect key and routes input to it when
346
+ // focused. Its `pty` attribute is the runtime-id binding shape
347
+ // (surface/image precedent): one {binding} to the u64 key the app's
348
+ // ptySpawn named — ids are model data, never markup literals; 0 is
349
+ // the unbound sentinel (an empty surface). `scrollback` echoes the
350
+ // app-visible view state back (the scroll `value` source-wins
351
+ // precedent) and `on-terminal` delivers it (a TerminalState
352
+ // record). An interactive control for the a11y lint: focused, it
353
+ // owns the keyboard, so it must carry a name — the runtime then
354
+ // announces the live screen text as its content.
355
+ .{ .code = 69, .name = "terminal", .widget_kind = "terminal", .a11y_name = .control },
332
356
  };
333
357
 
334
358
  // ------------------------------------------------------------- attributes
@@ -404,6 +428,10 @@ pub const attrs = [_]AttrInfo{
404
428
  .{ .code = 53, .name = "test", .class = .flag, .group = .structure },
405
429
  .{ .code = 54, .name = "template", .class = .text, .group = .structure },
406
430
  .{ .code = 55, .name = "args", .class = .text, .group = .structure },
431
+ // Attribute NAMES are unique by registry law, so `src` is stated
432
+ // once and scoped per element: `<import src>` names the imported
433
+ // markup file, and the video element's rule hook reuses it for the
434
+ // playback's source string (an app-assets path or http(s) URL).
407
435
  .{ .code = 56, .name = "src", .class = .text, .group = .structure },
408
436
  .{ .code = 57, .name = "kind", .class = .text, .group = .structure },
409
437
  // Chart composite attributes (fresh codes, assigned at birth).
@@ -493,6 +521,38 @@ pub const attrs = [_]AttrInfo{
493
521
  // like an image leaf with id 0), and usable ids stay below the
494
522
  // reserved namespace bit (bit 63), which acquire refuses.
495
523
  .{ .code = 81, .name = "surface", .class = .binding_only, .group = .element },
524
+ // Video element attributes (the <video> composite; its rule hook
525
+ // owns the closed set): controls composes the house transport
526
+ // chrome, autoplay/loop/muted shape the fresh playback the
527
+ // element's src declares. All flags — bare presence, a literal
528
+ // true/false, or a {binding} to a bool.
529
+ .{ .code = 82, .name = "controls", .class = .flag, .group = .composite },
530
+ .{ .code = 83, .name = "autoplay", .class = .flag, .group = .composite },
531
+ .{ .code = 84, .name = "loop", .class = .flag, .group = .composite },
532
+ .{ .code = 85, .name = "muted", .class = .flag, .group = .composite },
533
+ // Scroll axis declaration (scroll only; the validator scopes it):
534
+ // vertical (the default — every pre-axis document keeps its exact
535
+ // behavior), horizontal, or both. A closed vocabulary mirroring
536
+ // `canvas.ScrollAxes`, the overscroll pattern.
537
+ .{ .code = 86, .name = "axis", .class = .option, .group = .option, .field = "axis" },
538
+ // The horizontal scroll offset (scroll only, and only beside a
539
+ // horizontal-capable axis; the validator scopes both): the sideways
540
+ // counterpart of `value`, following the same source-wins reconcile
541
+ // rule — echo `on-scroll`'s offset_x back here and user scrolling
542
+ // survives rebuilds; move it model-side to scroll programmatically.
543
+ .{ .code = 87, .name = "value-x", .class = .number, .group = .option, .field = "value_x" },
544
+ // The terminal's pty rendezvous (terminal only; the validator
545
+ // scopes and REQUIRES it): one {binding} to the model-owned u64 pty
546
+ // effect key `ptySpawn` named — the media-surface `surface` shape
547
+ // exactly. A terminal without it is dead markup, taught rather than
548
+ // rendered inert.
549
+ .{ .code = 88, .name = "pty", .class = .binding_only, .group = .element },
550
+ // The terminal's scrollback offset in rows above the live screen
551
+ // (terminal only; the validator scopes it): the scroll `value`
552
+ // source-wins reconcile rule — echo `on-terminal`'s `scrollback`
553
+ // back here and user scrollback survives rebuilds; move it
554
+ // model-side to scroll programmatically. 0 is pinned to the bottom.
555
+ .{ .code = 89, .name = "scrollback", .class = .whole, .group = .option, .field = "scrollback" },
496
556
  };
497
557
 
498
558
  // ----------------------------------------------------------------- events
@@ -508,6 +568,24 @@ pub const events = [_]EventInfo{
508
568
  .{ .code = 8, .name = "hold" },
509
569
  .{ .code = 9, .name = "resize", .payload = .fraction, .only_on_element = "split" },
510
570
  .{ .code = 10, .name = "reach-end", .only_on_element = "scroll" },
571
+ // The pointer-hover pair (the Elm onMouseEnter/onMouseLeave
572
+ // convention): hover-enter dispatches when the pointer enters a
573
+ // bound element's hit region, hover-leave when it exits — discrete
574
+ // containment edges, never per-move. Binding either makes the
575
+ // element hover-hittable the way a bound press makes any element
576
+ // pressable (so both stay legal everywhere, like the press family)
577
+ // WITHOUT claiming presses, painting a wash, or adding an
578
+ // accessibility action. Hover comes from mouse/trackpad pointers
579
+ // only — touch input never synthesizes it.
580
+ .{ .code = 11, .name = "hover-enter" },
581
+ .{ .code = 12, .name = "hover-leave" },
582
+ // The terminal's view-state echo: dispatched with a TerminalState
583
+ // record (scrollback, history, cols, rows) after every
584
+ // runtime-applied view-state change — wheel and keyboard scrollback,
585
+ // and the layout-derived grid resize — so the model can echo
586
+ // `scrollback` back (the on-scroll reconcile shape) and render
587
+ // honest status. Emulator internals never ride it.
588
+ .{ .code = 13, .name = "terminal", .payload = .terminal_state, .only_on_element = "terminal" },
511
589
  };
512
590
 
513
591
  // ------------------------------------------------------- token vocabulary
@@ -543,16 +621,16 @@ pub const control_size_value_names = [_][]const u8{ "default", "sm", "lg", "icon
543
621
  pub const text_size_value_names = [_][]const u8{ "heading", "display" };
544
622
 
545
623
  pub const icon_names = [_][]const u8{
546
- "alert", "archive", "arrow-down", "arrow-right", "arrow-up",
547
- "check", "check-circle", "chevron-down", "chevron-left", "chevron-right",
548
- "chevron-up", "circle-dot", "clock", "copy", "download",
549
- "edit", "ellipsis", "external-link", "eye", "file-text",
550
- "folder", "folder-open", "git-branch", "git-merge", "git-pull-request",
551
- "info", "menu", "moon", "music", "panel-left",
552
- "panel-right", "pause", "play", "plus", "refresh-cw",
553
- "repeat", "save", "search", "send", "settings",
554
- "shuffle", "skip-back", "skip-forward", "sun", "terminal",
555
- "trash", "volume", "wrench", "x", "x-circle",
624
+ "alert", "archive", "arrow-down", "arrow-right", "arrow-up",
625
+ "check", "check-circle", "chevron-down", "chevron-left", "chevron-right",
626
+ "chevron-up", "circle-dot", "clock", "copy", "download",
627
+ "edit", "ellipsis", "external-link", "eye", "file-text",
628
+ "folder", "folder-open", "git-branch", "git-merge", "git-pull-request",
629
+ "info", "menu", "moon", "music", "panel-left",
630
+ "panel-right", "pause", "play", "plus", "refresh-cw",
631
+ "repeat", "save", "search", "send", "settings",
632
+ "shuffle", "skip-back", "skip-forward", "sun", "terminal",
633
+ "trash", "volume", "wrench", "x", "x-circle",
556
634
  };
557
635
 
558
636
  /// The semantic role vocabulary the `role` attribute accepts: the field
@@ -577,14 +655,16 @@ pub const container_role_names = [_][]const u8{
577
655
  };
578
656
 
579
657
  /// Whether markup can put element children inside this element: text
580
- /// leaves hold a single text run and the icon leaf holds nothing (both
581
- /// enforced by the validator), so a container role there is provably
582
- /// misuse. Other leaves (separator, value controls) structurally accept
583
- /// children, so the lint stays quiet about them.
658
+ /// leaves hold a single text run, and the icon and terminal leaves hold
659
+ /// nothing (all enforced by the validator), so a container role there is
660
+ /// provably misuse. Other leaves (separator, value controls)
661
+ /// structurally accept children, so the lint stays quiet about them.
584
662
  pub fn elementHoldsChildren(entry: *const ElementInfo) bool {
585
663
  if (entry.takes_children) return true;
586
664
  if (entry.takes_text) return false;
587
- return !std.mem.eql(u8, entry.name, "icon");
665
+ if (std.mem.eql(u8, entry.name, "icon")) return false;
666
+ if (std.mem.eql(u8, entry.name, "terminal")) return false;
667
+ return true;
588
668
  }
589
669
 
590
670
  // ---------------------------------------------------------------- lookups