@native-sdk/cli 0.5.3 → 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.
- package/build/app.zig +91 -2
- package/build.zig +756 -5
- package/build.zig.zon +7 -0
- package/native-sdk.d.ts +19 -1
- package/package.json +9 -9
- package/packages/core/package-lock.json +2 -2
- package/packages/core/package.json +1 -1
- package/packages/core/rt/rt.zig +416 -9
- package/packages/core/sdk/core.ts +706 -5
- package/packages/core/sdk/events.ts +17 -8
- package/packages/core/src/checker.ts +305 -2
- package/packages/core/src/diagnostics.ts +12 -0
- package/packages/core/src/emitter.ts +3187 -264
- package/packages/core/src/typed_ast.ts +51 -4
- package/packages/core/src/types.ts +34 -1
- package/skill-data/native-ui/SKILL.md +42 -4
- package/skill-data/ts-core/SKILL.md +13 -3
- package/src/app_runner/root.zig +112 -10
- package/src/app_runner/ts_core_main.zig +4 -0
- package/src/automation/layout_fingerprint.zig +160 -0
- package/src/automation/protocol.zig +82 -33
- package/src/automation/root.zig +1 -0
- package/src/automation/server.zig +1 -1
- package/src/automation/snapshot.zig +68 -9
- package/src/automation/watcher.zig +1 -1
- package/src/embed/host.zig +5 -0
- package/src/embed/tests.zig +119 -1
- package/src/embed/ui_host.zig +13 -0
- package/src/platform/linux/gtk_host.c +639 -16
- package/src/platform/linux/gtk_host.h +25 -0
- package/src/platform/linux/root.zig +351 -7
- package/src/platform/macos/appkit_host.h +152 -8
- package/src/platform/macos/appkit_host.m +1816 -100
- package/src/platform/macos/cef_host.mm +372 -11
- package/src/platform/macos/root.zig +379 -11
- package/src/platform/null_platform.zig +696 -9
- package/src/platform/null_platform_tests.zig +35 -0
- package/src/platform/root.zig +42 -0
- package/src/platform/types.zig +524 -18
- package/src/platform/windows/root.zig +432 -9
- package/src/platform/windows/webview2_host.cpp +482 -45
- package/src/primitives/app_manifest/comptime_scene.zig +5 -0
- package/src/primitives/app_manifest/root.zig +1 -0
- package/src/primitives/app_manifest/types.zig +32 -0
- package/src/primitives/app_manifest/validation.zig +18 -0
- package/src/primitives/canvas/a11y_audit.zig +33 -11
- package/src/primitives/canvas/a11y_audit_tests.zig +20 -0
- package/src/primitives/canvas/drawing.zig +25 -0
- package/src/primitives/canvas/equality.zig +8 -0
- package/src/primitives/canvas/events.zig +103 -16
- package/src/primitives/canvas/frame.zig +125 -1
- package/src/primitives/canvas/layout_audit.zig +22 -5
- package/src/primitives/canvas/markdown_hostile_tests.zig +8 -4
- package/src/primitives/canvas/render_tests.zig +13 -10
- package/src/primitives/canvas/root.zig +48 -0
- package/src/primitives/canvas/terminal_box.zig +471 -0
- package/src/primitives/canvas/terminal_grid.zig +978 -0
- package/src/primitives/canvas/terminal_grid_tests.zig +1093 -0
- package/src/primitives/canvas/test_support.zig +1 -0
- package/src/primitives/canvas/tests.zig +2 -0
- package/src/primitives/canvas/text_tests.zig +39 -4
- package/src/primitives/canvas/tokens.zig +115 -12
- package/src/primitives/canvas/ui.zig +535 -12
- package/src/primitives/canvas/ui_markup.zig +253 -36
- package/src/primitives/canvas/ui_markup_binary.zig +4 -1
- package/src/primitives/canvas/ui_markup_compiled.zig +195 -9
- package/src/primitives/canvas/ui_markup_compiled_tests.zig +188 -8
- package/src/primitives/canvas/ui_markup_contract.zig +89 -6
- package/src/primitives/canvas/ui_markup_contract_tests.zig +65 -1
- package/src/primitives/canvas/ui_markup_huge_document_tests.zig +154 -0
- package/src/primitives/canvas/ui_markup_huge_model_tests.zig +1 -0
- package/src/primitives/canvas/ui_markup_reflect.zig +75 -24
- package/src/primitives/canvas/ui_markup_tests.zig +178 -9
- package/src/primitives/canvas/ui_markup_view.zig +220 -11
- package/src/primitives/canvas/ui_markup_view_tests.zig +553 -28
- package/src/primitives/canvas/ui_schema.zig +110 -17
- package/src/primitives/canvas/ui_schema_tests.zig +18 -10
- package/src/primitives/canvas/ui_tests.zig +141 -9
- package/src/primitives/canvas/widget_access.zig +28 -2
- package/src/primitives/canvas/widget_anchored_tests.zig +48 -0
- package/src/primitives/canvas/widget_invalidation.zig +81 -1
- package/src/primitives/canvas/widget_layout.zig +59 -11
- package/src/primitives/canvas/widget_layout_tests.zig +125 -4
- package/src/primitives/canvas/widget_render.zig +272 -18
- package/src/primitives/canvas/widget_render_scroll.zig +108 -27
- package/src/primitives/canvas/widget_routing.zig +59 -7
- package/src/primitives/canvas/widget_runtime.zig +23 -0
- package/src/primitives/canvas/widget_runtime_tests.zig +149 -0
- package/src/primitives/canvas/widget_semantics.zig +119 -11
- package/src/primitives/canvas/widget_semantics_tests.zig +409 -0
- package/src/primitives/canvas/widget_tree.zig +17 -0
- package/src/primitives/canvas/widgets.zig +132 -0
- package/src/root.zig +23 -0
- package/src/runtime/api.zig +76 -5
- package/src/runtime/automation_commands.zig +20 -1
- package/src/runtime/automation_snapshot.zig +25 -1
- package/src/runtime/automation_widget_dispatch.zig +73 -8
- package/src/runtime/bridge_payload.zig +8 -0
- package/src/runtime/bridge_responses.zig +5 -0
- package/src/runtime/builtin_bridge.zig +9 -4
- package/src/runtime/canvas_font_tests.zig +439 -2
- package/src/runtime/canvas_fonts.zig +61 -6
- package/src/runtime/canvas_frame.zig +62 -7
- package/src/runtime/canvas_frame_animation_tests.zig +5 -4
- package/src/runtime/canvas_frame_helpers.zig +190 -1
- package/src/runtime/canvas_frame_invalidation_tests.zig +531 -0
- package/src/runtime/canvas_frame_patch_tests.zig +161 -10
- package/src/runtime/canvas_frame_retained_tests.zig +5 -2
- package/src/runtime/canvas_image_tests.zig +195 -0
- package/src/runtime/canvas_images.zig +45 -12
- package/src/runtime/canvas_widget_accessibility_tests.zig +1 -1
- package/src/runtime/canvas_widget_clipboard_tests.zig +40 -0
- package/src/runtime/canvas_widget_context_menu.zig +269 -32
- package/src/runtime/canvas_widget_context_menu_tests.zig +640 -14
- package/src/runtime/canvas_widget_display.zig +1 -1
- package/src/runtime/canvas_widget_event_tests.zig +1823 -0
- package/src/runtime/canvas_widget_events.zig +240 -24
- package/src/runtime/canvas_widget_runtime.zig +213 -29
- package/src/runtime/canvas_widget_scroll_driver_tests.zig +170 -7
- package/src/runtime/canvas_widget_scroll_drivers.zig +151 -17
- package/src/runtime/canvas_widget_scroll_tests.zig +435 -23
- package/src/runtime/canvas_widget_state.zig +6 -0
- package/src/runtime/canvas_widget_text_tests.zig +1 -1
- package/src/runtime/core.zig +131 -13
- package/src/runtime/effects.zig +8136 -180
- package/src/runtime/effects_channel_tests.zig +3519 -0
- package/src/runtime/effects_fetch_tests.zig +89 -1
- package/src/runtime/effects_file_tests.zig +41 -1
- package/src/runtime/effects_image_tests.zig +1304 -0
- package/src/runtime/effects_pty_tests.zig +1362 -0
- package/src/runtime/effects_tests.zig +167 -9
- package/src/runtime/effects_video_tests.zig +3609 -0
- package/src/runtime/flow.zig +42 -4
- package/src/runtime/gpu_surface_events.zig +473 -13
- package/src/runtime/media_surface.zig +116 -11
- package/src/runtime/media_surface_tests.zig +61 -0
- package/src/runtime/pty.zig +1252 -0
- package/src/runtime/pty_windows.zig +1780 -0
- package/src/runtime/root.zig +36 -0
- package/src/runtime/runtime_event_tests.zig +20 -1
- package/src/runtime/session_blobs.zig +689 -0
- package/src/runtime/session_journal.zig +432 -62
- package/src/runtime/session_record.zig +43 -2
- package/src/runtime/session_replay.zig +556 -20
- package/src/runtime/session_tests.zig +2087 -1
- package/src/runtime/shell_layout.zig +7 -0
- package/src/runtime/terminal_session.zig +1569 -0
- package/src/runtime/terminal_session_tests.zig +450 -0
- package/src/runtime/terminal_vt_ghostty.zig +15 -0
- package/src/runtime/terminal_vt_stub.zig +13 -0
- package/src/runtime/testdata/fonts/NotoSansSC-Receipt.ttf +0 -0
- package/src/runtime/testdata/fonts/OFL.txt +93 -0
- package/src/runtime/tests.zig +8 -0
- package/src/runtime/ts_core_host.zig +1320 -45
- package/src/runtime/ts_core_host_tests.zig +1100 -1
- package/src/runtime/ts_ui_app.zig +23 -5
- package/src/runtime/ui_app.zig +2444 -69
- package/src/runtime/ui_app_tests.zig +3171 -744
- package/src/runtime/ui_app_virtual_variable_tests.zig +4 -2
- package/src/runtime/ui_app_window_tests.zig +736 -0
- package/src/runtime/view.zig +190 -2
- package/src/runtime/view_widget_scroll.zig +218 -68
- package/src/runtime/view_widget_text.zig +11 -2
- package/src/runtime/view_widget_tree.zig +111 -3
- package/src/runtime/window_command_bridge_tests.zig +117 -0
- package/src/runtime/window_storage.zig +77 -2
- package/src/runtime/window_view_runtime.zig +34 -2
- package/src/runtime/window_views.zig +62 -1
- package/src/terminal_session_tests_root.zig +15 -0
- package/src/tooling/manifest.zig +75 -0
- package/src/tooling/raw_manifest.zig +2 -0
- package/src/tooling/templates.zig +244 -8
|
@@ -283,6 +283,9 @@ fn CompiledMarkupEngine(comptime ModelT: type, comptime MsgT: type, comptime res
|
|
|
283
283
|
// Series inside a chart are consumed by buildChart.
|
|
284
284
|
comptime fail(node, markup.series_parent_message);
|
|
285
285
|
}
|
|
286
|
+
if (comptime std.mem.eql(u8, node.name, "video")) {
|
|
287
|
+
return buildVideo(node, entries, ui, model, scope);
|
|
288
|
+
}
|
|
286
289
|
if (comptime std.mem.eql(u8, node.name, "context-menu")) {
|
|
287
290
|
// Direct context-menu children are consumed by their host
|
|
288
291
|
// element below; one reaching here is misplaced.
|
|
@@ -405,6 +408,31 @@ fn CompiledMarkupEngine(comptime ModelT: type, comptime MsgT: type, comptime res
|
|
|
405
408
|
}
|
|
406
409
|
if (pane_count != 2) fail(node, markup.split_children_message);
|
|
407
410
|
}
|
|
411
|
+
// Interpreter parity: the image leaf's static shape.
|
|
412
|
+
// Without its id binding the leaf can never draw —
|
|
413
|
+
// statically dead markup, a compile error here too. And
|
|
414
|
+
// it takes no children at all (icon's leaf policy): the
|
|
415
|
+
// check reads the ORIGINAL node, so an extracted
|
|
416
|
+
// context-menu still counts as a child exactly like the
|
|
417
|
+
// validator's raw-node check.
|
|
418
|
+
if (kind == .image) {
|
|
419
|
+
if (node.attr("image") == null) {
|
|
420
|
+
fail(node, markup.image_missing_image_message);
|
|
421
|
+
}
|
|
422
|
+
if (node.children.len > 0) {
|
|
423
|
+
fail(node, markup.image_children_message);
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
// Interpreter parity: the terminal leaf's static shape —
|
|
427
|
+
// pty required (dead markup without it), no children.
|
|
428
|
+
if (kind == .terminal) {
|
|
429
|
+
if (node.attr("pty") == null) {
|
|
430
|
+
fail(node, markup.terminal_missing_pty_message);
|
|
431
|
+
}
|
|
432
|
+
if (node.children.len > 0) {
|
|
433
|
+
fail(node, markup.terminal_children_message);
|
|
434
|
+
}
|
|
435
|
+
}
|
|
408
436
|
// Interpreter parity: the a11y lint's error half — an
|
|
409
437
|
// unnamed interactive control or a misused role ships a
|
|
410
438
|
// view a screen reader user cannot operate, so it is a
|
|
@@ -1217,6 +1245,72 @@ fn CompiledMarkupEngine(comptime ModelT: type, comptime MsgT: type, comptime res
|
|
|
1217
1245
|
return series;
|
|
1218
1246
|
}
|
|
1219
1247
|
|
|
1248
|
+
// ---------------------------------------------------------- video
|
|
1249
|
+
|
|
1250
|
+
/// Comptime mirror of the interpreter's `buildVideo`: the leaf
|
|
1251
|
+
/// shape and the closed attribute set resolve at comptime with
|
|
1252
|
+
/// the interpreter's messages; the src string, flags, and
|
|
1253
|
+
/// sizing evaluate at runtime and lower through `Ui.video`.
|
|
1254
|
+
fn buildVideo(comptime node: markup.MarkupNode, comptime entries: []const ScopeEntry, ui: *Ui, model: *const ModelT, scope: anytype) Ui.Node {
|
|
1255
|
+
comptime {
|
|
1256
|
+
if (node.children.len > 0) fail(node.children[0], markup.video_children_message);
|
|
1257
|
+
for (node.attrs) |attribute| {
|
|
1258
|
+
if (std.mem.eql(u8, attribute.name, "kind")) continue;
|
|
1259
|
+
const known = std.mem.eql(u8, attribute.name, "src") or
|
|
1260
|
+
markup.videoFlagAttrName(attribute.name) or
|
|
1261
|
+
std.mem.eql(u8, attribute.name, "width") or
|
|
1262
|
+
std.mem.eql(u8, attribute.name, "height") or
|
|
1263
|
+
std.mem.eql(u8, attribute.name, "grow") or
|
|
1264
|
+
std.mem.eql(u8, attribute.name, "label") or
|
|
1265
|
+
std.mem.eql(u8, attribute.name, "key") or
|
|
1266
|
+
std.mem.eql(u8, attribute.name, "global-key");
|
|
1267
|
+
if (!known) fail(node, markup.video_attr_message);
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
var options: Ui.VideoOptions = .{};
|
|
1271
|
+
if (comptime (node.attr("src") != null)) {
|
|
1272
|
+
options.src = stringAttr(node, entries, comptime node.attr("src").?, ui, model, scope, markup.video_src_message);
|
|
1273
|
+
}
|
|
1274
|
+
if (comptime (node.attr("controls") != null)) {
|
|
1275
|
+
options.controls = videoFlagValue(node, entries, comptime node.attr("controls").?, ui, model, scope);
|
|
1276
|
+
}
|
|
1277
|
+
if (comptime (node.attr("autoplay") != null)) {
|
|
1278
|
+
options.autoplay = videoFlagValue(node, entries, comptime node.attr("autoplay").?, ui, model, scope);
|
|
1279
|
+
}
|
|
1280
|
+
if (comptime (node.attr("loop") != null)) {
|
|
1281
|
+
options.loop = videoFlagValue(node, entries, comptime node.attr("loop").?, ui, model, scope);
|
|
1282
|
+
}
|
|
1283
|
+
if (comptime (node.attr("muted") != null)) {
|
|
1284
|
+
options.muted = videoFlagValue(node, entries, comptime node.attr("muted").?, ui, model, scope);
|
|
1285
|
+
}
|
|
1286
|
+
if (comptime (node.attr("width") != null)) {
|
|
1287
|
+
options.width = floatAttr(node, entries, comptime node.attr("width").?, ui, model, scope);
|
|
1288
|
+
}
|
|
1289
|
+
if (comptime (node.attr("height") != null)) {
|
|
1290
|
+
options.height = floatAttr(node, entries, comptime node.attr("height").?, ui, model, scope);
|
|
1291
|
+
}
|
|
1292
|
+
if (comptime (node.attr("grow") != null)) {
|
|
1293
|
+
options.grow = floatAttr(node, entries, comptime node.attr("grow").?, ui, model, scope);
|
|
1294
|
+
}
|
|
1295
|
+
if (comptime (node.attr("label") != null)) {
|
|
1296
|
+
options.label = stringAttr(node, entries, comptime node.attr("label").?, ui, model, scope, "label expects text");
|
|
1297
|
+
}
|
|
1298
|
+
if (comptime (node.attr("key") != null)) {
|
|
1299
|
+
options.key = attrKey(node, entries, comptime node.attr("key").?, ui, model, scope, "keys must be integers or strings");
|
|
1300
|
+
}
|
|
1301
|
+
if (comptime (node.attr("global-key") != null)) {
|
|
1302
|
+
options.global_key = attrKey(node, entries, comptime node.attr("global-key").?, ui, model, scope, "keys must be integers or strings");
|
|
1303
|
+
}
|
|
1304
|
+
return ui.video(options);
|
|
1305
|
+
}
|
|
1306
|
+
|
|
1307
|
+
/// One video flag's value (interpreter parity): bare presence
|
|
1308
|
+
/// declares true, a valued flag evaluates truthy.
|
|
1309
|
+
fn videoFlagValue(comptime node: markup.MarkupNode, comptime entries: []const ScopeEntry, comptime raw: []const u8, ui: *Ui, model: *const ModelT, scope: anytype) bool {
|
|
1310
|
+
if (comptime (raw.len == 0)) return true;
|
|
1311
|
+
return evalExpr(node, entries, raw, ui, model, scope).truthy();
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1220
1314
|
/// Resolve a chart `x-labels` binding through the same sources
|
|
1221
1315
|
/// `for each` accepts, requiring a string element type at
|
|
1222
1316
|
/// comptime — the label twin of `chartValuesItems`.
|
|
@@ -1591,6 +1685,21 @@ fn CompiledMarkupEngine(comptime ModelT: type, comptime MsgT: type, comptime res
|
|
|
1591
1685
|
applyImageAttr(node, attribute.value, entries, ui, model, scope, options);
|
|
1592
1686
|
} else if (comptime std.mem.eql(u8, attribute.name, "surface")) {
|
|
1593
1687
|
applySurfaceAttr(node, attribute.value, entries, ui, model, scope, options);
|
|
1688
|
+
} else if (comptime std.mem.eql(u8, attribute.name, "pty")) {
|
|
1689
|
+
applyPtyAttr(node, attribute.value, entries, ui, model, scope, options);
|
|
1690
|
+
} else if (comptime (std.mem.eql(u8, attribute.name, "scrollback") and !std.mem.eql(u8, node.name, "terminal"))) {
|
|
1691
|
+
// Terminal-scoped (validator parity for unvalidated
|
|
1692
|
+
// paths): anywhere else the option is inert data.
|
|
1693
|
+
comptime fail(node, markup.scrollback_element_message);
|
|
1694
|
+
} else if (comptime (std.mem.eql(u8, attribute.name, "text") and std.mem.eql(u8, node.name, "terminal"))) {
|
|
1695
|
+
// Runtime-owned text channel (interpreter and
|
|
1696
|
+
// validator parity).
|
|
1697
|
+
comptime fail(node, markup.terminal_text_attr_message);
|
|
1698
|
+
} else if (comptime markup.videoFlagAttrName(attribute.name)) {
|
|
1699
|
+
// The video element's flags, video-scoped (its own
|
|
1700
|
+
// build consumed them): anywhere else they would be
|
|
1701
|
+
// silently inert (interpreter and validator parity).
|
|
1702
|
+
comptime fail(node, markup.video_flag_element_message);
|
|
1594
1703
|
} else if (comptime std.mem.eql(u8, attribute.name, "name")) {
|
|
1595
1704
|
// Consumed by the icon branch in buildElement; a
|
|
1596
1705
|
// compile error on any other element (interpreter and
|
|
@@ -1656,18 +1765,18 @@ fn CompiledMarkupEngine(comptime ModelT: type, comptime MsgT: type, comptime res
|
|
|
1656
1765
|
}
|
|
1657
1766
|
|
|
1658
1767
|
/// Comptime mirror of the interpreter's `applyImageAttr`:
|
|
1659
|
-
/// `image="{binding}"` on avatar resolves to a `u64`
|
|
1660
|
-
/// app registered at runtime —
|
|
1661
|
-
/// binding must produce an integer, all checked at comptime
|
|
1662
|
-
/// the interpreter's messages.
|
|
1768
|
+
/// `image="{binding}"` on avatar and image resolves to a `u64`
|
|
1769
|
+
/// ImageId the app registered at runtime — binding-only, and
|
|
1770
|
+
/// the binding must produce an integer, all checked at comptime
|
|
1771
|
+
/// with the interpreter's messages.
|
|
1663
1772
|
fn applyImageAttr(comptime node: markup.MarkupNode, comptime raw: []const u8, comptime entries: []const ScopeEntry, ui: *Ui, model: *const ModelT, scope: anytype, options: *Ui.ElementOptions) void {
|
|
1664
1773
|
comptime {
|
|
1665
|
-
if (!std.mem.eql(u8, node.name, "avatar")) fail(node, markup.
|
|
1666
|
-
const expression = markup.parseAttrExpression(raw) orelse fail(node, markup.
|
|
1667
|
-
if (expression != .binding) fail(node, markup.
|
|
1774
|
+
if (!std.mem.eql(u8, node.name, "avatar") and !std.mem.eql(u8, node.name, "image")) fail(node, markup.image_binding_element_message);
|
|
1775
|
+
const expression = markup.parseAttrExpression(raw) orelse fail(node, markup.image_binding_message);
|
|
1776
|
+
if (expression != .binding) fail(node, markup.image_binding_message);
|
|
1668
1777
|
}
|
|
1669
1778
|
const path = comptime markup.parseAttrExpression(raw).?.binding;
|
|
1670
|
-
comptime requireVariant(pathVariant(node, entries, path, true), &.{.integer}, node, markup.
|
|
1779
|
+
comptime requireVariant(pathVariant(node, entries, path, true), &.{.integer}, node, markup.image_binding_message);
|
|
1671
1780
|
// Range-checked before the u64 cast (the interpreter fails
|
|
1672
1781
|
// the same way): a signed model field (`image: i64 = -1`)
|
|
1673
1782
|
// can deliver a negative — fail the build, never trap.
|
|
@@ -1701,6 +1810,29 @@ fn CompiledMarkupEngine(comptime ModelT: type, comptime MsgT: type, comptime res
|
|
|
1701
1810
|
};
|
|
1702
1811
|
}
|
|
1703
1812
|
|
|
1813
|
+
/// `pty="{binding}"` on terminal resolves to the model-owned u64
|
|
1814
|
+
/// pty effect key whose session the terminal renders —
|
|
1815
|
+
/// terminal-only, binding-only, integer-valued, all checked at
|
|
1816
|
+
/// comptime with the interpreter's messages (the media-surface
|
|
1817
|
+
/// `surface` grammar exactly). The key rides `options.pty` into
|
|
1818
|
+
/// `Widget.terminal.pty`.
|
|
1819
|
+
fn applyPtyAttr(comptime node: markup.MarkupNode, comptime raw: []const u8, comptime entries: []const ScopeEntry, ui: *Ui, model: *const ModelT, scope: anytype, options: *Ui.ElementOptions) void {
|
|
1820
|
+
comptime {
|
|
1821
|
+
if (!std.mem.eql(u8, node.name, "terminal")) fail(node, markup.terminal_pty_element_message);
|
|
1822
|
+
const expression = markup.parseAttrExpression(raw) orelse fail(node, markup.terminal_pty_message);
|
|
1823
|
+
if (expression != .binding) fail(node, markup.terminal_pty_message);
|
|
1824
|
+
}
|
|
1825
|
+
const path = comptime markup.parseAttrExpression(raw).?.binding;
|
|
1826
|
+
comptime requireVariant(pathVariant(node, entries, path, true), &.{.integer}, node, markup.terminal_pty_message);
|
|
1827
|
+
// Range-checked before the u64 cast (the interpreter fails
|
|
1828
|
+
// the same way): a signed model field can deliver a negative
|
|
1829
|
+
// — fail the build, never trap.
|
|
1830
|
+
options.pty = switch (bindingValue(node, entries, path, ui, model, scope, true)) {
|
|
1831
|
+
.integer => |int| if (int < 0) runtimeFail(u64, ui) else @intCast(int),
|
|
1832
|
+
else => runtimeFail(u64, ui),
|
|
1833
|
+
};
|
|
1834
|
+
}
|
|
1835
|
+
|
|
1704
1836
|
fn colorStyleField(comptime attr_name: []const u8) ?[]const u8 {
|
|
1705
1837
|
comptime {
|
|
1706
1838
|
@setEvalBranchQuota(10_000);
|
|
@@ -1845,7 +1977,21 @@ fn CompiledMarkupEngine(comptime ModelT: type, comptime MsgT: type, comptime res
|
|
|
1845
1977
|
comptime {
|
|
1846
1978
|
if (!std.mem.eql(u8, node.name, "scroll")) fail(node, markup.on_scroll_element_message);
|
|
1847
1979
|
}
|
|
1848
|
-
options.on_scroll = comptime (scrollConstructor(expression.tag) orelse
|
|
1980
|
+
options.on_scroll = comptime (scrollConstructor(expression.tag) orelse
|
|
1981
|
+
// The retired one-axis record gets the migration
|
|
1982
|
+
// teaching (it names the new per-axis fields) instead
|
|
1983
|
+
// of the generic payload rejection.
|
|
1984
|
+
fail(node, if (legacyScrollTag(expression.tag)) markup.on_scroll_legacy_payload_message else markup.on_scroll_payload_message));
|
|
1985
|
+
return;
|
|
1986
|
+
}
|
|
1987
|
+
if (comptime std.mem.eql(u8, event, "terminal")) {
|
|
1988
|
+
comptime {
|
|
1989
|
+
if (!std.mem.eql(u8, node.name, "terminal")) fail(node, markup.on_terminal_element_message);
|
|
1990
|
+
// Bare tag only: the runtime supplies the payload, so
|
|
1991
|
+
// an authored one would be silently discarded.
|
|
1992
|
+
if (expression.payload.len > 0) fail(node, markup.on_terminal_payload_message);
|
|
1993
|
+
}
|
|
1994
|
+
options.on_terminal = comptime (terminalConstructor(expression.tag) orelse fail(node, markup.on_terminal_payload_message));
|
|
1849
1995
|
return;
|
|
1850
1996
|
}
|
|
1851
1997
|
if (comptime std.mem.eql(u8, event, "resize")) {
|
|
@@ -1886,6 +2032,13 @@ fn CompiledMarkupEngine(comptime ModelT: type, comptime MsgT: type, comptime res
|
|
|
1886
2032
|
// Press family: like on-press, a bound hold makes any
|
|
1887
2033
|
// element pressable.
|
|
1888
2034
|
options.on_hold = msg;
|
|
2035
|
+
} else if (comptime std.mem.eql(u8, event, "hover-enter")) {
|
|
2036
|
+
// Hover family: binding either edge makes any element
|
|
2037
|
+
// hover-hittable (never pressable), so both are legal
|
|
2038
|
+
// everywhere like the press family (interpreter parity).
|
|
2039
|
+
options.on_hover_enter = msg;
|
|
2040
|
+
} else if (comptime std.mem.eql(u8, event, "hover-leave")) {
|
|
2041
|
+
options.on_hover_leave = msg;
|
|
1889
2042
|
} else if (comptime std.mem.eql(u8, event, "reach-end")) {
|
|
1890
2043
|
// The approach-end signal (infinite-scroll fetch) is
|
|
1891
2044
|
// emitted for scroll containers only (interpreter and
|
|
@@ -1936,6 +2089,39 @@ fn CompiledMarkupEngine(comptime ModelT: type, comptime MsgT: type, comptime res
|
|
|
1936
2089
|
}
|
|
1937
2090
|
}
|
|
1938
2091
|
|
|
2092
|
+
fn terminalConstructor(comptime tag: []const u8) ?Ui.TerminalMsgFn {
|
|
2093
|
+
comptime {
|
|
2094
|
+
@setEvalBranchQuota(10_000);
|
|
2095
|
+
for (@typeInfo(MsgT).@"union".fields) |field| {
|
|
2096
|
+
if (field.type == canvas.TerminalState and std.mem.eql(u8, field.name, tag)) {
|
|
2097
|
+
return Ui.terminalMsg(@field(std.meta.Tag(MsgT), field.name));
|
|
2098
|
+
}
|
|
2099
|
+
// A declared mirror of the terminal-state record
|
|
2100
|
+
// (transpiled cores): translated at dispatch, same
|
|
2101
|
+
// handler shape.
|
|
2102
|
+
if (interpreter.declaredTerminalStateRecord(field.type) and std.mem.eql(u8, field.name, tag)) {
|
|
2103
|
+
return Ui.translatedTerminalMsg(@field(std.meta.Tag(MsgT), field.name), field.type);
|
|
2104
|
+
}
|
|
2105
|
+
}
|
|
2106
|
+
return null;
|
|
2107
|
+
}
|
|
2108
|
+
}
|
|
2109
|
+
|
|
2110
|
+
/// Whether `tag` names an arm carrying the RETIRED one-axis
|
|
2111
|
+
/// scroll record — recognized only so the on-scroll rejection
|
|
2112
|
+
/// can teach the two-axis migration by field name.
|
|
2113
|
+
fn legacyScrollTag(comptime tag: []const u8) bool {
|
|
2114
|
+
comptime {
|
|
2115
|
+
@setEvalBranchQuota(10_000);
|
|
2116
|
+
for (@typeInfo(MsgT).@"union".fields) |field| {
|
|
2117
|
+
if (interpreter.declaredLegacyScrollStateRecord(field.type) and std.mem.eql(u8, field.name, tag)) {
|
|
2118
|
+
return true;
|
|
2119
|
+
}
|
|
2120
|
+
}
|
|
2121
|
+
return false;
|
|
2122
|
+
}
|
|
2123
|
+
}
|
|
2124
|
+
|
|
1939
2125
|
fn resizeConstructor(comptime tag: []const u8) ?Ui.ValueMsgFn {
|
|
1940
2126
|
comptime {
|
|
1941
2127
|
@setEvalBranchQuota(10_000);
|
|
@@ -42,6 +42,7 @@ fn expectSameTree(comptime MsgT: type, expected: canvas.Ui(MsgT).Tree, actual: c
|
|
|
42
42
|
.input => |make| try testing.expectEqual(make, actual_handler.action.input),
|
|
43
43
|
.value => |make| try testing.expectEqual(make, actual_handler.action.value),
|
|
44
44
|
.scroll => |make| try testing.expectEqual(make, actual_handler.action.scroll),
|
|
45
|
+
.terminal => |make| try testing.expectEqual(make, actual_handler.action.terminal),
|
|
45
46
|
// Context-menu handler entries carry one ?Msg per declared
|
|
46
47
|
// item (separators are null slots); markup `<context-menu>`
|
|
47
48
|
// and the Zig builder both produce them.
|
|
@@ -391,11 +392,11 @@ test "compiled on-scroll binds the ScrollState constructor identically to the in
|
|
|
391
392
|
|
|
392
393
|
// Both engines dispatch the same typed scroll Msg for the container.
|
|
393
394
|
const feed = fixture.findByKind(compiled.root, .scroll_view).?;
|
|
394
|
-
const state = canvas.ScrollState{ .
|
|
395
|
-
try testing.expectEqual(@as(f32, 40), compiled.msgForScroll(feed.id, state).?.feed_scrolled.
|
|
395
|
+
const state = canvas.ScrollState{ .offset_y = 40, .viewport_extent_y = 80, .content_extent_y = 200 };
|
|
396
|
+
try testing.expectEqual(@as(f32, 40), compiled.msgForScroll(feed.id, state).?.feed_scrolled.offset_y);
|
|
396
397
|
try testing.expectEqual(
|
|
397
|
-
interpreted.msgForScroll(feed.id, state).?.feed_scrolled.
|
|
398
|
-
compiled.msgForScroll(feed.id, state).?.feed_scrolled.
|
|
398
|
+
interpreted.msgForScroll(feed.id, state).?.feed_scrolled.offset_y,
|
|
399
|
+
compiled.msgForScroll(feed.id, state).?.feed_scrolled.offset_y,
|
|
399
400
|
);
|
|
400
401
|
|
|
401
402
|
// And the same approach-end Msg (`on-reach-end`, the infinite-scroll
|
|
@@ -1251,6 +1252,152 @@ test "compiled avatar and media-surface id bindings refuse negative model values
|
|
|
1251
1252
|
try testing.expectError(error.OutOfMemory, surface_ui.finalize(surface_node));
|
|
1252
1253
|
}
|
|
1253
1254
|
|
|
1255
|
+
// ------------------------------------------------ image leaf id binding
|
|
1256
|
+
|
|
1257
|
+
const ImageLeafUi = fixture.ImageLeafUi;
|
|
1258
|
+
const ImageLeafInterpreter = markup_view.MarkupView(fixture.ImageLeafModel, fixture.ImageLeafMsg);
|
|
1259
|
+
const ImageLeafCompiled = canvas.CompiledMarkupView(fixture.ImageLeafModel, fixture.ImageLeafMsg, fixture.image_markup_source);
|
|
1260
|
+
const ImageLeafNegativeCompiled = canvas.CompiledMarkupView(fixture.ImageLeafModel, fixture.ImageLeafMsg, fixture.image_negative_markup_source);
|
|
1261
|
+
|
|
1262
|
+
test "compiled image leaf binding matches the interpreter and the hand-written view" {
|
|
1263
|
+
var arena_state = std.heap.ArenaAllocator.init(testing.allocator);
|
|
1264
|
+
defer arena_state.deinit();
|
|
1265
|
+
const arena = arena_state.allocator();
|
|
1266
|
+
|
|
1267
|
+
const model = fixture.ImageLeafModel{ .cover = 42 };
|
|
1268
|
+
|
|
1269
|
+
var view = try ImageLeafInterpreter.init(arena, fixture.image_markup_source);
|
|
1270
|
+
var interpreted_ui = ImageLeafUi.init(arena);
|
|
1271
|
+
const interpreted = try interpreted_ui.finalize(try view.build(&interpreted_ui, &model));
|
|
1272
|
+
|
|
1273
|
+
var compiled_ui = ImageLeafUi.init(arena);
|
|
1274
|
+
const compiled = try compiled_ui.finalize(ImageLeafCompiled.build(&compiled_ui, &model));
|
|
1275
|
+
|
|
1276
|
+
var hand_ui = ImageLeafUi.init(arena);
|
|
1277
|
+
const hand = try hand_ui.finalize(fixture.handImageLeafView(&hand_ui, &model));
|
|
1278
|
+
|
|
1279
|
+
try expectSameTree(fixture.ImageLeafMsg, hand, interpreted);
|
|
1280
|
+
try expectSameTree(fixture.ImageLeafMsg, hand, compiled);
|
|
1281
|
+
|
|
1282
|
+
// The field binding and the fn binding both resolve to the
|
|
1283
|
+
// widget's image id at comptime-unrolled access.
|
|
1284
|
+
const cover = compiled.root.children[0];
|
|
1285
|
+
try testing.expectEqual(canvas.WidgetKind.image, cover.kind);
|
|
1286
|
+
try testing.expectEqual(@as(canvas.ImageId, 42), cover.image_id);
|
|
1287
|
+
try testing.expectEqual(@as(canvas.ImageId, 43), compiled.root.children[1].image_id);
|
|
1288
|
+
|
|
1289
|
+
// 0 draws nothing in both engines — the not-loaded-yet state.
|
|
1290
|
+
const empty_model = fixture.ImageLeafModel{};
|
|
1291
|
+
var empty_ui = ImageLeafUi.init(arena);
|
|
1292
|
+
const empty = try empty_ui.finalize(ImageLeafCompiled.build(&empty_ui, &empty_model));
|
|
1293
|
+
try testing.expectEqual(@as(canvas.ImageId, 0), empty.root.children[0].image_id);
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1296
|
+
test "compiled image leaf binding refuses negative model values instead of trapping" {
|
|
1297
|
+
var arena_state = std.heap.ArenaAllocator.init(testing.allocator);
|
|
1298
|
+
defer arena_state.deinit();
|
|
1299
|
+
const arena = arena_state.allocator();
|
|
1300
|
+
|
|
1301
|
+
// A negative i64 binding into the u64 id seam latches the failed
|
|
1302
|
+
// build (the interpreter's teaching error mirrors it), and
|
|
1303
|
+
// finalize surfaces the failure — never an @intCast trap.
|
|
1304
|
+
var image_ui = ImageLeafUi.init(arena);
|
|
1305
|
+
const image_node = ImageLeafNegativeCompiled.build(&image_ui, &fixture.ImageLeafModel{});
|
|
1306
|
+
try testing.expect(image_ui.failed);
|
|
1307
|
+
try testing.expectError(error.OutOfMemory, image_ui.finalize(image_node));
|
|
1308
|
+
}
|
|
1309
|
+
|
|
1310
|
+
// -------------------------------------------------- terminal element
|
|
1311
|
+
|
|
1312
|
+
const TerminalElementUi = fixture.TerminalElementUi;
|
|
1313
|
+
const TerminalElementInterpreter = markup_view.MarkupView(fixture.TerminalElementModel, fixture.TerminalElementMsg);
|
|
1314
|
+
const TerminalElementCompiled = canvas.CompiledMarkupView(fixture.TerminalElementModel, fixture.TerminalElementMsg, fixture.terminal_markup_source);
|
|
1315
|
+
|
|
1316
|
+
test "compiled terminal element matches the interpreter and the hand-written ui.terminal tree" {
|
|
1317
|
+
var arena_state = std.heap.ArenaAllocator.init(testing.allocator);
|
|
1318
|
+
defer arena_state.deinit();
|
|
1319
|
+
const arena = arena_state.allocator();
|
|
1320
|
+
|
|
1321
|
+
const model = fixture.TerminalElementModel{};
|
|
1322
|
+
|
|
1323
|
+
var view = try TerminalElementInterpreter.init(arena, fixture.terminal_markup_source);
|
|
1324
|
+
var interpreted_ui = TerminalElementUi.init(arena);
|
|
1325
|
+
const interpreted = try interpreted_ui.finalize(try view.build(&interpreted_ui, &model));
|
|
1326
|
+
|
|
1327
|
+
var compiled_ui = TerminalElementUi.init(arena);
|
|
1328
|
+
const compiled = try compiled_ui.finalize(TerminalElementCompiled.build(&compiled_ui, &model));
|
|
1329
|
+
|
|
1330
|
+
var hand_ui = TerminalElementUi.init(arena);
|
|
1331
|
+
const hand = try hand_ui.finalize(fixture.handTerminalElementView(&hand_ui, &model));
|
|
1332
|
+
|
|
1333
|
+
try expectSameTree(fixture.TerminalElementMsg, hand, interpreted);
|
|
1334
|
+
try expectSameTree(fixture.TerminalElementMsg, hand, compiled);
|
|
1335
|
+
|
|
1336
|
+
// All three lowerings bind the model-owned key and the echo.
|
|
1337
|
+
for ([_]TerminalElementUi.Tree{ hand, interpreted, compiled }) |tree| {
|
|
1338
|
+
const widget = fixture.findWidgetKind(tree.root, .terminal) orelse return error.TestExpectedTerminal;
|
|
1339
|
+
try testing.expectEqual(@as(u64, 7), widget.terminal.pty);
|
|
1340
|
+
try testing.expectEqual(@as(u32, 4), widget.terminal.scrollback);
|
|
1341
|
+
try testing.expect(widget.terminal.grid == null);
|
|
1342
|
+
}
|
|
1343
|
+
}
|
|
1344
|
+
|
|
1345
|
+
// --------------------------------------------- video playback element
|
|
1346
|
+
|
|
1347
|
+
const VideoElementUi = fixture.VideoElementUi;
|
|
1348
|
+
const VideoElementInterpreter = markup_view.MarkupView(fixture.VideoElementModel, fixture.VideoElementMsg);
|
|
1349
|
+
const VideoElementCompiled = canvas.CompiledMarkupView(fixture.VideoElementModel, fixture.VideoElementMsg, fixture.video_markup_source);
|
|
1350
|
+
const VideoElementPlainCompiled = canvas.CompiledMarkupView(fixture.VideoElementModel, fixture.VideoElementMsg, fixture.video_plain_markup_source);
|
|
1351
|
+
|
|
1352
|
+
test "compiled video element matches the interpreter and the hand-written ui.video tree" {
|
|
1353
|
+
var arena_state = std.heap.ArenaAllocator.init(testing.allocator);
|
|
1354
|
+
defer arena_state.deinit();
|
|
1355
|
+
const arena = arena_state.allocator();
|
|
1356
|
+
|
|
1357
|
+
const model = fixture.VideoElementModel{};
|
|
1358
|
+
|
|
1359
|
+
var view = try VideoElementInterpreter.init(arena, fixture.video_markup_source);
|
|
1360
|
+
var interpreted_ui = VideoElementUi.init(arena);
|
|
1361
|
+
const interpreted = try interpreted_ui.finalize(try view.build(&interpreted_ui, &model));
|
|
1362
|
+
|
|
1363
|
+
var compiled_ui = VideoElementUi.init(arena);
|
|
1364
|
+
const compiled = try compiled_ui.finalize(VideoElementCompiled.build(&compiled_ui, &model));
|
|
1365
|
+
|
|
1366
|
+
var hand_ui = VideoElementUi.init(arena);
|
|
1367
|
+
const hand = try hand_ui.finalize(fixture.handVideoElementView(&hand_ui, &model));
|
|
1368
|
+
|
|
1369
|
+
try expectSameTree(fixture.VideoElementMsg, hand, interpreted);
|
|
1370
|
+
try expectSameTree(fixture.VideoElementMsg, hand, compiled);
|
|
1371
|
+
try expectSameTexts(interpreted.root, compiled.root);
|
|
1372
|
+
|
|
1373
|
+
// The compiled lowering binds the framework-owned playback surface
|
|
1374
|
+
// and stamps the chrome's runtime-consumed verbs, exactly like the
|
|
1375
|
+
// interpreter and the hand-written builder call.
|
|
1376
|
+
const surface = compiled.root.children[0].children[0];
|
|
1377
|
+
try testing.expectEqual(canvas.WidgetKind.media_surface, surface.kind);
|
|
1378
|
+
try testing.expectEqual(canvas.video_playback_surface_id, surface.image_id);
|
|
1379
|
+
const toggle = fixture.findVideoControl(compiled.root, .toggle) orelse return error.TestUnexpectedResult;
|
|
1380
|
+
try testing.expectEqual(canvas.WidgetKind.button, toggle.kind);
|
|
1381
|
+
const scrub = fixture.findVideoControl(compiled.root, .scrub) orelse return error.TestUnexpectedResult;
|
|
1382
|
+
try testing.expectEqual(canvas.WidgetKind.slider, scrub.kind);
|
|
1383
|
+
|
|
1384
|
+
// Both engines recorded the same declaration for the app loop's
|
|
1385
|
+
// reconcile.
|
|
1386
|
+
const compiled_declaration = compiled_ui.video_declaration orelse return error.TestUnexpectedResult;
|
|
1387
|
+
const interpreted_declaration = interpreted_ui.video_declaration orelse return error.TestUnexpectedResult;
|
|
1388
|
+
try testing.expectEqualStrings(interpreted_declaration.src, compiled_declaration.src);
|
|
1389
|
+
try testing.expectEqual(interpreted_declaration.autoplay, compiled_declaration.autoplay);
|
|
1390
|
+
try testing.expectEqual(interpreted_declaration.loop, compiled_declaration.loop);
|
|
1391
|
+
try testing.expectEqual(interpreted_declaration.muted, compiled_declaration.muted);
|
|
1392
|
+
|
|
1393
|
+
// The controls-less shape compiles to the bare surface: no chrome.
|
|
1394
|
+
var plain_ui = VideoElementUi.init(arena);
|
|
1395
|
+
const plain = try plain_ui.finalize(VideoElementPlainCompiled.build(&plain_ui, &model));
|
|
1396
|
+
try testing.expectEqual(canvas.WidgetKind.media_surface, plain.root.children[0].kind);
|
|
1397
|
+
try testing.expect(fixture.findVideoControl(plain.root, .toggle) == null);
|
|
1398
|
+
try testing.expect(fixture.findVideoControl(plain.root, .scrub) == null);
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1254
1401
|
// ------------------------------------------------------ text wrap parity
|
|
1255
1402
|
|
|
1256
1403
|
const WrapUi = fixture.WrapUi;
|
|
@@ -1459,6 +1606,37 @@ test "compiled anchored picker (anchor, on-dismiss, on-hold) matches the interpr
|
|
|
1459
1606
|
try testing.expect(crumb.semantics.actions.press);
|
|
1460
1607
|
}
|
|
1461
1608
|
|
|
1609
|
+
// ------------------------------------------------------- hover-pair parity
|
|
1610
|
+
|
|
1611
|
+
const HoverCompiled = canvas.CompiledMarkupView(fixture.Model, fixture.Msg, fixture.hover_markup_source);
|
|
1612
|
+
|
|
1613
|
+
test "compiled hover pair (on-hover-enter, on-hover-leave) matches the interpreter" {
|
|
1614
|
+
var arena_state = std.heap.ArenaAllocator.init(testing.allocator);
|
|
1615
|
+
defer arena_state.deinit();
|
|
1616
|
+
const arena = arena_state.allocator();
|
|
1617
|
+
|
|
1618
|
+
const model = fixture.Model{};
|
|
1619
|
+
|
|
1620
|
+
var view = try InboxInterpreter.init(arena, fixture.hover_markup_source);
|
|
1621
|
+
var interpreter_ui = InboxUi.init(arena);
|
|
1622
|
+
const interpreted = try interpreter_ui.finalize(try view.build(&interpreter_ui, &model));
|
|
1623
|
+
var compiled_ui = InboxUi.init(arena);
|
|
1624
|
+
const compiled = try compiled_ui.finalize(HoverCompiled.build(&compiled_ui, &model));
|
|
1625
|
+
try expectSameTree(fixture.Msg, interpreted, compiled);
|
|
1626
|
+
|
|
1627
|
+
// Both engines stamp the listener flag (hover-hittable, never
|
|
1628
|
+
// pressable) and bind both edges through the handler table.
|
|
1629
|
+
const panel = fixture.findByKind(compiled.root, .panel).?;
|
|
1630
|
+
const row = fixture.findByKind(compiled.root, .row).?;
|
|
1631
|
+
try testing.expect(panel.hover_msgs and row.hover_msgs);
|
|
1632
|
+
try testing.expect(!row.semantics.actions.press);
|
|
1633
|
+
try testing.expect(!canvas.widgetIsHitTarget(row));
|
|
1634
|
+
try testing.expect(canvas.widgetIsHoverMsgHitTarget(row));
|
|
1635
|
+
try testing.expectEqual(fixture.Msg.add, compiled.msgFor(panel.id, .hover_enter).?);
|
|
1636
|
+
try testing.expectEqual(@as(u32, 0), compiled.msgFor(panel.id, .hover_leave).?.toggle);
|
|
1637
|
+
try testing.expect(compiled.msgFor(row.id, .hover_leave) == null);
|
|
1638
|
+
}
|
|
1639
|
+
|
|
1462
1640
|
// -------------------------------------------------- split panes and trees
|
|
1463
1641
|
|
|
1464
1642
|
const PaneCompiled = canvas.CompiledMarkupView(fixture.PaneModel, fixture.PaneMsg, fixture.pane_markup_source);
|
|
@@ -2031,11 +2209,13 @@ test "compiled on-scroll binds a declared scroll-state mirror identically to the
|
|
|
2031
2209
|
// Both engines translate the runtime state into the DECLARED record:
|
|
2032
2210
|
// float fields widen exactly, integer-classed fields round.
|
|
2033
2211
|
const region = fixture.findByKind(compiled.root, .scroll_view).?;
|
|
2034
|
-
const state = canvas.ScrollState{ .
|
|
2212
|
+
const state = canvas.ScrollState{ .offset_x = 12.5, .offset_y = 41.5, .velocity_y = -3.25, .viewport_extent_x = 320.2, .viewport_extent_y = 480.4, .content_extent_x = 960.7, .content_extent_y = 2000.6 };
|
|
2035
2213
|
const compiled_msg = compiled.msgForScroll(region.id, state).?;
|
|
2036
|
-
try testing.expectEqual(@as(f64, 41.5), compiled_msg.library_scrolled.
|
|
2037
|
-
try testing.expectEqual(@as(
|
|
2038
|
-
try testing.expectEqual(@as(i64,
|
|
2214
|
+
try testing.expectEqual(@as(f64, 41.5), compiled_msg.library_scrolled.offsetY);
|
|
2215
|
+
try testing.expectEqual(@as(f64, 12.5), compiled_msg.library_scrolled.offsetX);
|
|
2216
|
+
try testing.expectEqual(@as(i64, 480), compiled_msg.library_scrolled.viewportExtentY);
|
|
2217
|
+
try testing.expectEqual(@as(i64, 2001), compiled_msg.library_scrolled.contentExtentY);
|
|
2218
|
+
try testing.expectEqual(@as(i64, 961), compiled_msg.library_scrolled.contentExtentX);
|
|
2039
2219
|
try testing.expectEqual(
|
|
2040
2220
|
interpreted.msgForScroll(region.id, state).?,
|
|
2041
2221
|
compiled.msgForScroll(region.id, state).?,
|