@native-sdk/cli 0.4.3 → 0.5.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 (100) hide show
  1. package/build/app.zig +308 -72
  2. package/build/ts_run.mjs +63 -0
  3. package/build.zig +336 -7
  4. package/build.zig.zon +1 -0
  5. package/package.json +15 -10
  6. package/packages/core/package-lock.json +43 -0
  7. package/packages/core/package.json +37 -0
  8. package/packages/core/rt/rt.zig +1579 -0
  9. package/packages/core/sdk/bytes_text_methods.d.ts +88 -0
  10. package/packages/core/sdk/core.ts +694 -0
  11. package/packages/core/sdk/events.ts +137 -0
  12. package/packages/core/sdk/text.ts +519 -0
  13. package/packages/core/src/checker.ts +1869 -0
  14. package/packages/core/src/cli.ts +68 -0
  15. package/packages/core/src/devhost.ts +291 -0
  16. package/packages/core/src/devhost_resolver.mjs +22 -0
  17. package/packages/core/src/diagnostics.ts +417 -0
  18. package/packages/core/src/emitter.ts +8815 -0
  19. package/packages/core/src/infer.ts +1515 -0
  20. package/packages/core/src/modules.ts +173 -0
  21. package/packages/core/src/ownership.ts +740 -0
  22. package/packages/core/src/text_polyfill.ts +337 -0
  23. package/packages/core/src/text_tables.ts +408 -0
  24. package/packages/core/src/transpile.ts +146 -0
  25. package/packages/core/src/typed_ast.ts +536 -0
  26. package/packages/core/src/types.ts +815 -0
  27. package/skill-data/core/SKILL.md +3 -0
  28. package/skill-data/native-ui/SKILL.md +30 -0
  29. package/skill-data/ts-core/SKILL.md +493 -0
  30. package/skill-data/zig/SKILL.md +208 -0
  31. package/skills/native-sdk/SKILL.md +1 -1
  32. package/src/app_runner/root.zig +75 -9
  33. package/src/app_runner/ts_core_main.zig +231 -0
  34. package/src/platform/linux/gtk_host.c +226 -21
  35. package/src/platform/windows/webview2_host.cpp +16 -10
  36. package/src/primitives/app_manifest/comptime_scene.zig +341 -0
  37. package/src/primitives/app_manifest/root.zig +13 -0
  38. package/src/primitives/app_manifest/types.zig +14 -0
  39. package/src/primitives/app_manifest/validation.zig +18 -0
  40. package/src/primitives/app_manifest/web_layer.zig +366 -0
  41. package/src/primitives/canvas/commands.zig +14 -7
  42. package/src/primitives/canvas/lazy_tls.zig +73 -0
  43. package/src/primitives/canvas/render_generic_resources.zig +22 -15
  44. package/src/primitives/canvas/root.zig +6 -0
  45. package/src/primitives/canvas/tests.zig +1 -0
  46. package/src/primitives/canvas/text_atlas.zig +40 -32
  47. package/src/primitives/canvas/text_layout_cache.zig +29 -22
  48. package/src/primitives/canvas/text_measure_cache.zig +56 -41
  49. package/src/primitives/canvas/text_spans.zig +39 -26
  50. package/src/primitives/canvas/tokens.zig +54 -0
  51. package/src/primitives/canvas/ui.zig +125 -0
  52. package/src/primitives/canvas/ui_markup.zig +22 -3
  53. package/src/primitives/canvas/ui_markup_compiled.zig +97 -7
  54. package/src/primitives/canvas/ui_markup_compiled_tests.zig +275 -0
  55. package/src/primitives/canvas/ui_markup_contract.zig +68 -14
  56. package/src/primitives/canvas/ui_markup_contract_tests.zig +257 -2
  57. package/src/primitives/canvas/ui_markup_reflect.zig +214 -0
  58. package/src/primitives/canvas/ui_markup_view.zig +105 -1
  59. package/src/primitives/canvas/ui_markup_view_tests.zig +336 -0
  60. package/src/primitives/canvas/ui_schema.zig +8 -0
  61. package/src/primitives/canvas/ui_schema_tests.zig +5 -4
  62. package/src/primitives/canvas/widget_invalidation.zig +14 -7
  63. package/src/primitives/canvas/widget_render.zig +25 -15
  64. package/src/primitives/canvas/widget_render_controls.zig +15 -9
  65. package/src/primitives/canvas/widget_runtime_tests.zig +44 -0
  66. package/src/root.zig +7 -0
  67. package/src/runtime/api.zig +7 -0
  68. package/src/runtime/bridge_responses.zig +2 -0
  69. package/src/runtime/builtin_bridge.zig +6 -0
  70. package/src/runtime/canvas_frame.zig +57 -36
  71. package/src/runtime/canvas_images.zig +9 -3
  72. package/src/runtime/canvas_widget_control_tests.zig +5 -6
  73. package/src/runtime/canvas_widget_runtime.zig +7 -4
  74. package/src/runtime/effects.zig +490 -2
  75. package/src/runtime/effects_host_tests.zig +594 -0
  76. package/src/runtime/flow.zig +8 -0
  77. package/src/runtime/platform_bridge_tests.zig +1 -0
  78. package/src/runtime/root.zig +18 -0
  79. package/src/runtime/session_replay.zig +7 -1
  80. package/src/runtime/session_tests.zig +35 -8
  81. package/src/runtime/tests.zig +2 -0
  82. package/src/runtime/ts_core_host.zig +1505 -0
  83. package/src/runtime/ts_core_host_tests.zig +1408 -0
  84. package/src/runtime/ts_ui_app.zig +469 -0
  85. package/src/runtime/ui_app.zig +58 -0
  86. package/src/runtime/view_canvas.zig +24 -17
  87. package/src/runtime/view_widget_tree.zig +2 -2
  88. package/src/runtime/web_layer_gate_tests.zig +242 -0
  89. package/src/runtime/window_storage.zig +5 -0
  90. package/src/runtime/window_view_runtime.zig +1 -0
  91. package/src/tooling/buildgraph.zig +7 -1
  92. package/src/tooling/codesign.zig +212 -105
  93. package/src/tooling/doctor.zig +78 -0
  94. package/src/tooling/manifest.zig +314 -1
  95. package/src/tooling/package.zig +722 -18
  96. package/src/tooling/raw_manifest.zig +16 -0
  97. package/src/tooling/root.zig +1 -0
  98. package/src/tooling/templates.zig +911 -88
  99. package/src/tooling/ts_core.zig +486 -0
  100. package/src/tooling/verbs.zig +22 -0
@@ -23,6 +23,7 @@ const builtin = @import("builtin");
23
23
  const font_coverage = @import("font_coverage.zig");
24
24
  const geometry = @import("geometry");
25
25
  const canvas = @import("root.zig");
26
+ const reflect = @import("ui_markup_reflect.zig");
26
27
  const ui_provenance = @import("ui_provenance.zig");
27
28
 
28
29
  const ObjectId = canvas.ObjectId;
@@ -786,6 +787,79 @@ pub fn Ui(comptime Msg: type) type {
786
787
  }.make;
787
788
  }
788
789
 
790
+ /// Comptime message constructor for `on_input` over a DECLARED
791
+ /// text-input event union (`ui_markup_reflect.declaredTextInputUnion`
792
+ /// — the transpiled-core shape, where the emitted module declares
793
+ /// its own mirror of `canvas.TextInputEvent` and type identity
794
+ /// cannot cross the emission boundary). The built message carries
795
+ /// the arm's own union value, translated field-for-field from the
796
+ /// runtime event at dispatch: tags map by name, numeric fields widen
797
+ /// the way the payload declares them (i64 or f64), and the event's
798
+ /// text slices ride through unchanged (host-event lifetime — one
799
+ /// dispatch, exactly what `update` gets everywhere else).
800
+ pub fn translatedInputMsg(comptime tag: std.meta.Tag(Msg), comptime Payload: type) InputMsgFn {
801
+ return struct {
802
+ fn caret(comptime D: type, direction: canvas.TextCaretDirection) D {
803
+ return switch (direction) {
804
+ inline else => |d| @field(D, @tagName(d)),
805
+ };
806
+ }
807
+
808
+ fn num(comptime N: type, value: usize) N {
809
+ // Saturating, not @intCast: selection offsets carry a
810
+ // defined "to the end, whatever the length" sentinel —
811
+ // select-all synthesizes `set_selection` with
812
+ // `focus = maxInt(usize)` (events.zig), which every
813
+ // consumer snaps to its text length (the runtime editor
814
+ // via snapTextSelection, an elm-mirror core via its own
815
+ // snap). maxInt(usize) does not fit the declared i64
816
+ // field class, and panicking on translation killed the
817
+ // app on the first cmd/ctrl+A (or automation set_text)
818
+ // in ANY transpiled-core text field. Saturating keeps
819
+ // the sentinel's meaning — still past any real length,
820
+ // the core's snap resolves it exactly like the Zig
821
+ // TextEditState does — and leaves real offsets exact.
822
+ return if (@typeInfo(N) == .float) @floatFromInt(value) else std.math.lossyCast(N, value);
823
+ }
824
+
825
+ fn make(edit: canvas.TextInputEvent) Msg {
826
+ const payload: Payload = switch (edit) {
827
+ .insert_text => |inserted| @unionInit(Payload, "insert_text", inserted),
828
+ .delete_backward => @unionInit(Payload, "delete_backward", {}),
829
+ .delete_forward => @unionInit(Payload, "delete_forward", {}),
830
+ .delete_word_backward => @unionInit(Payload, "delete_word_backward", {}),
831
+ .delete_word_forward => @unionInit(Payload, "delete_word_forward", {}),
832
+ .clear => @unionInit(Payload, "clear", {}),
833
+ .move_caret => |move| blk: {
834
+ const Move = @FieldType(Payload, "move_caret");
835
+ break :blk @unionInit(Payload, "move_caret", .{
836
+ .direction = caret(@FieldType(Move, "direction"), move.direction),
837
+ .extend = move.extend,
838
+ });
839
+ },
840
+ .set_selection => |selection| blk: {
841
+ const Selection = @FieldType(Payload, "set_selection");
842
+ break :blk @unionInit(Payload, "set_selection", .{
843
+ .anchor = num(@FieldType(Selection, "anchor"), selection.anchor),
844
+ .focus = num(@FieldType(Selection, "focus"), selection.focus),
845
+ });
846
+ },
847
+ .set_composition => |composition| blk: {
848
+ const Composition = @FieldType(Payload, "set_composition");
849
+ const Cursor = @typeInfo(@FieldType(Composition, "cursor")).optional.child;
850
+ break :blk @unionInit(Payload, "set_composition", .{
851
+ .text = composition.text,
852
+ .cursor = if (composition.cursor) |cursor| num(Cursor, cursor) else null,
853
+ });
854
+ },
855
+ .commit_composition => @unionInit(Payload, "commit_composition", {}),
856
+ .cancel_composition => @unionInit(Payload, "cancel_composition", {}),
857
+ };
858
+ return @unionInit(Msg, @tagName(tag), payload);
859
+ }
860
+ }.make;
861
+ }
862
+
789
863
  /// Comptime message constructor for `on_value`: `valueMsg(.confidence)`
790
864
  /// yields a function building `Msg{ .confidence = value }`.
791
865
  pub fn valueMsg(comptime tag: std.meta.Tag(Msg)) ValueMsgFn {
@@ -796,6 +870,20 @@ pub fn Ui(comptime Msg: type) type {
796
870
  }.make;
797
871
  }
798
872
 
873
+ /// Comptime message constructor for `on_value`/`on_resize` over a
874
+ /// DECLARED one-number float arm (`ui_markup_reflect.valueArmClass`
875
+ /// — the transpiled-core shape, where the arm's payload is the
876
+ /// emitted `f64` rather than `f32` by identity). The runtime's
877
+ /// applied 0..1 fraction widens exactly at dispatch.
878
+ pub fn translatedValueMsg(comptime tag: std.meta.Tag(Msg), comptime Payload: type) ValueMsgFn {
879
+ return struct {
880
+ fn make(value: f32) Msg {
881
+ const payload: Payload = @floatCast(value);
882
+ return @unionInit(Msg, @tagName(tag), payload);
883
+ }
884
+ }.make;
885
+ }
886
+
799
887
  /// Comptime message constructor for `on_scroll`:
800
888
  /// `scrollMsg(.activity_scrolled)` yields a function building
801
889
  /// `Msg{ .activity_scrolled = scroll }` from the post-scroll
@@ -808,6 +896,43 @@ pub fn Ui(comptime Msg: type) type {
808
896
  }.make;
809
897
  }
810
898
 
899
+ /// Comptime message constructor for `on_scroll` over a DECLARED
900
+ /// scroll-state record (`ui_markup_reflect.declaredScrollStateRecord`
901
+ /// — the transpiled-core shape, where the emitted module declares
902
+ /// its own mirror of `canvas.ScrollState` and type identity cannot
903
+ /// cross the emission boundary). The built message carries the
904
+ /// arm's own record value, translated field-for-field from the
905
+ /// runtime state at dispatch: fields map by name, and each numeric
906
+ /// field widens the way the payload declares it (exactly into
907
+ /// floats, rounded to the nearest whole number into integers).
908
+ pub fn translatedScrollMsg(comptime tag: std.meta.Tag(Msg), comptime Payload: type) ScrollMsgFn {
909
+ return struct {
910
+ fn num(comptime N: type, value: f32) N {
911
+ return if (@typeInfo(N) == .float) @floatCast(value) else @intFromFloat(@round(value));
912
+ }
913
+
914
+ /// The `canvas.ScrollState` field behind a payload field
915
+ /// name: identical for the canvas spelling, mapped for the
916
+ /// TS SDK spelling (`viewportExtent` — transpiled fields
917
+ /// keep their TS names).
918
+ fn sourceName(comptime name: []const u8) []const u8 {
919
+ if (@hasField(canvas.ScrollState, name)) return name;
920
+ inline for (reflect.scroll_state_field_names_ts, 0..) |ts_name, index| {
921
+ if (comptime std.mem.eql(u8, name, ts_name)) return reflect.scroll_state_field_names[index];
922
+ }
923
+ unreachable; // declaredScrollStateRecord admits no other name
924
+ }
925
+
926
+ fn make(scroll_state: canvas.ScrollState) Msg {
927
+ var payload: Payload = undefined;
928
+ inline for (@typeInfo(Payload).@"struct".fields) |field| {
929
+ @field(payload, field.name) = num(field.type, @field(scroll_state, sourceName(field.name)));
930
+ }
931
+ return @unionInit(Msg, @tagName(tag), payload);
932
+ }
933
+ }.make;
934
+ }
935
+
811
936
  /// Comptime message constructor for `on_link`: `linkMsg(.open_url)`
812
937
  /// yields a function building `Msg{ .open_url = link }`. The link
813
938
  /// slice lives in the view arena (or the caller's markdown source),
@@ -1118,10 +1118,10 @@ pub const known_events = schema.event_names;
1118
1118
 
1119
1119
  pub const on_scroll_element_message = "on-scroll is only supported on scroll - the runtime emits scroll offsets for scroll containers, so the handler belongs on the scroll element itself";
1120
1120
  pub const on_reach_end_element_message = "on-reach-end is only supported on scroll - the runtime emits the approach-end signal for scroll containers, so the handler belongs on the scroll element itself";
1121
- pub const on_scroll_payload_message = "on-scroll takes a bare Msg tag whose payload is the post-scroll state (a canvas.ScrollState variant, like activity_scrolled: canvas.ScrollState)";
1121
+ pub const on_scroll_payload_message = "on-scroll takes a bare Msg tag whose payload is the post-scroll state (a canvas.ScrollState variant, like activity_scrolled: canvas.ScrollState, or a declared record of its offset/velocity/viewport_extent/content_extent fields for transpiled cores)";
1122
1122
 
1123
1123
  pub const on_resize_element_message = "on-resize is only supported on split - the runtime emits fraction changes for split dividers, so the handler belongs on the split element itself";
1124
- pub const on_resize_payload_message = "on-resize takes a bare Msg tag whose payload is the new first-pane fraction (an f32 variant, like sidebar_resized: f32)";
1124
+ pub const on_resize_payload_message = "on-resize takes a bare Msg tag whose payload is the new first-pane fraction (an f32 variant, like sidebar_resized: f32; transpiled cores declare a one-number float arm)";
1125
1125
  pub const split_children_message = "split takes exactly two element children (the panes) - put conditional or repeated content inside a pane container, and nest splits for more panes";
1126
1126
 
1127
1127
  /// Elements the runtime's dismissal machinery closes (Escape, click
@@ -1213,6 +1213,8 @@ pub const grid_columns_element_message = "columns is only supported on grid - it
1213
1213
 
1214
1214
  pub const overscroll_element_message = "overscroll is only supported on scroll - it names a scroll region's edge behavior (none pins at the content edges, rubber_band lets the region bounce past them, default follows the ScrollPhysics.overscroll token); anywhere else it would be silently inert";
1215
1215
 
1216
+ pub const quiet_hover_element_message = "quiet-hover is only supported on pressable elements (hit targets like list-item, button, panel) - it opts an image-forward content tile out of the HOVER wash while press feedback, the focus ring, cursor intent, and hit testing keep their own channels; on a non-interactive element it would be silently inert";
1217
+
1216
1218
  /// The `overscroll` attribute's closed value vocabulary: the member names
1217
1219
  /// of `canvas.WidgetOverscroll`, mirrored as data here (this layer stays
1218
1220
  /// std-only) with a lockstep test in ui_markup_view_tests.zig holding the
@@ -1350,6 +1352,15 @@ pub fn anchorElement(name: []const u8) bool {
1350
1352
  return nameInList(name, &known_anchor_element_names);
1351
1353
  }
1352
1354
 
1355
+ /// Whether the engine hit-tests this element's widget kind — the surface
1356
+ /// the hover/press wash ladder exists on, and so the scope of the
1357
+ /// `quiet-hover` knob (registry `hit_target`; composites resolve through
1358
+ /// their library views and are out of scope).
1359
+ pub fn hitTargetElement(name: []const u8) bool {
1360
+ const entry = schema.elementByName(name) orelse return false;
1361
+ return entry.rule_hook == null and entry.hit_target;
1362
+ }
1363
+
1353
1364
  pub fn dismissEventElement(name: []const u8) bool {
1354
1365
  return nameInList(name, &known_dismiss_element_names);
1355
1366
  }
@@ -1832,7 +1843,7 @@ pub const chart_display_only_message = "chart is display-only - presses fall thr
1832
1843
  pub const series_parent_message = "series is only allowed inside a chart";
1833
1844
  pub const series_attr_message = "unknown attribute for series - it takes kind, values, color, and label";
1834
1845
  pub const series_kind_message = "series kind takes a literal: line, area, or bar (area is a line filled to the baseline; band envelopes need a paired lower-edge slice per point and stay with the Zig builder, ui.chart)";
1835
- pub const series_values_message = "series requires a values attribute with one {binding} naming a []const f32 iterable (a model field, pub decl, or fn - the same sources for each accepts); pad the window's leading gap with NaN samples, which draw nothing";
1846
+ pub const series_values_message = "series requires a values attribute with one {binding} naming a []const f32 or []const f64 iterable (a model field, pub decl, or fn - the same sources for each accepts; transpiled TS number arrays are f64); pad the window's leading gap with NaN samples, which draw nothing";
1836
1847
  pub const series_color_message = "series color takes a literal color token name (a canvas ColorTokens field, e.g. accent, info, success, text_muted)";
1837
1848
  pub const series_label_message = "series label expects text (a literal or one {binding}) - it names the series in the chart's semantics summary";
1838
1849
  pub const series_children_message = "series is a leaf - it takes no children; the values binding carries its data";
@@ -3132,6 +3143,14 @@ fn validateNode(document: MarkupDocument, node: MarkupNode, parent_element: ?[]c
3132
3143
  }
3133
3144
  }
3134
3145
  }
3146
+ if (std.mem.eql(u8, attribute.name, "quiet-hover")) {
3147
+ // The hover wash exists only on hit-tested elements:
3148
+ // anywhere else the knob is silently inert (same
3149
+ // policy as overscroll off scroll).
3150
+ if (!hitTargetElement(node.name)) {
3151
+ return attrError(node, attribute, quiet_hover_element_message);
3152
+ }
3153
+ }
3135
3154
  if (std.mem.eql(u8, attribute.name, "resize-duration")) {
3136
3155
  // The layout tween exists only where a fraction can
3137
3156
  // move: anywhere but a split the option is silently
@@ -1245,7 +1245,12 @@ fn CompiledMarkupEngine(comptime ModelT: type, comptime MsgT: type, comptime res
1245
1245
 
1246
1246
  /// Resolve a series `values` binding through the same sources
1247
1247
  /// `for each` accepts (scope slice args shadow model iterables),
1248
- /// requiring an f32 element type at comptime.
1248
+ /// requiring an f32 or f64 element type at comptime. f64
1249
+ /// iterables narrow into a build-arena f32 copy per sample (the
1250
+ /// interpreter's `f32Items` rule): transpiled TS cores carry
1251
+ /// every number array as f64 — the subset's one float class —
1252
+ /// and refusing them would leave markup charts unreachable from
1253
+ /// a TS model.
1249
1254
  fn chartValuesItems(comptime node: markup.MarkupNode, comptime entries: []const ScopeEntry, comptime raw: []const u8, ui: *Ui, model: *const ModelT, scope: anytype) []const f32 {
1250
1255
  const path = comptime blk: {
1251
1256
  const expression = markup.parseAttrExpression(raw) orelse fail(node, markup.series_values_message);
@@ -1256,17 +1261,31 @@ fn CompiledMarkupEngine(comptime ModelT: type, comptime MsgT: type, comptime res
1256
1261
  if (comptime (scope_index_opt != null)) {
1257
1262
  const scope_index = comptime scope_index_opt.?;
1258
1263
  comptime {
1259
- if (entries[scope_index].kind != .slice_arg or entries[scope_index].Item != f32) {
1264
+ if (entries[scope_index].kind != .slice_arg or
1265
+ (entries[scope_index].Item != f32 and entries[scope_index].Item != f64))
1266
+ {
1260
1267
  fail(node, markup.series_values_message);
1261
1268
  }
1262
1269
  }
1263
- return scopePayload(entries, scope_index, scope);
1270
+ return narrowedSeriesValues(entries[scope_index].Item, scopePayload(entries, scope_index, scope), ui);
1264
1271
  }
1265
1272
  const info = comptime (eachInfo(path) orelse fail(node, markup.series_values_message));
1266
1273
  comptime {
1267
- if (info.Item != f32) fail(node, markup.series_values_message);
1274
+ if (info.Item != f32 and info.Item != f64) fail(node, markup.series_values_message);
1268
1275
  }
1269
- return eachItems(info, ui, model);
1276
+ return narrowedSeriesValues(info.Item, eachItems(info, ui, model), ui);
1277
+ }
1278
+
1279
+ /// f32 series values pass through; f64 values copy down into the
1280
+ /// build arena (charts plot f32).
1281
+ fn narrowedSeriesValues(comptime Item: type, items: []const Item, ui: *Ui) []const f32 {
1282
+ if (comptime (Item == f32)) return items;
1283
+ const narrowed = ui.arena.alloc(f32, items.len) catch {
1284
+ ui.failed = true;
1285
+ return &.{};
1286
+ };
1287
+ for (narrowed, items) |*slot, value| slot.* = @floatCast(value);
1288
+ return narrowed;
1270
1289
  }
1271
1290
 
1272
1291
  /// Comptime icon-value classification with the invalid arm turned
@@ -1612,6 +1631,15 @@ fn CompiledMarkupEngine(comptime ModelT: type, comptime MsgT: type, comptime res
1612
1631
  break :blk std.fmt.parseFloat(f32, attribute.value) catch
1613
1632
  fail(node, markup.anchor_offset_value_message);
1614
1633
  };
1634
+ } else if (comptime std.mem.eql(u8, attribute.name, "quiet-hover")) {
1635
+ // The quiet-surface knob (`WidgetStyle.quiet_hover`)
1636
+ // for image-forward content tiles: hover wash off,
1637
+ // press/selection fills, focus ring, cursor intent,
1638
+ // and hit testing untouched. Hit-target elements only
1639
+ // (interpreter and validator parity); applied to
1640
+ // `options.style`, so no flat option field backs it.
1641
+ comptime if (!markup.hitTargetElement(node.name)) fail(node, markup.quiet_hover_element_message);
1642
+ options.style.quiet_hover = evalExpr(node, entries, attribute.value, ui, model, scope).truthy();
1615
1643
  } else if (comptime (colorStyleField(attribute.name) != null)) {
1616
1644
  // Style token refs resolve entirely at comptime: a typo
1617
1645
  // in a token name is a compile error.
@@ -1787,6 +1815,17 @@ fn CompiledMarkupEngine(comptime ModelT: type, comptime MsgT: type, comptime res
1787
1815
  options.on_resize = comptime (resizeConstructor(expression.tag) orelse fail(node, markup.on_resize_payload_message));
1788
1816
  return;
1789
1817
  }
1818
+ // The value-payload change event: a slider's `on-change` with a
1819
+ // bare tag naming a value-carrying arm dispatches the APPLIED
1820
+ // value through the `on_value` constructor (the `on-resize`
1821
+ // fraction mechanism) instead of a static Msg. Void arms keep
1822
+ // the static form below (interpreter parity).
1823
+ if (comptime (std.mem.eql(u8, event, "change") and std.mem.eql(u8, node.name, "slider") and expression.payload.len == 0)) {
1824
+ if (comptime valueConstructor(expression.tag)) |make| {
1825
+ options.on_value = make;
1826
+ return;
1827
+ }
1828
+ }
1790
1829
  const msg = constructMessage(node, expression, entries, ui, model, scope);
1791
1830
  if (comptime std.mem.eql(u8, event, "press")) {
1792
1831
  options.on_press = msg;
@@ -1827,6 +1866,12 @@ fn CompiledMarkupEngine(comptime ModelT: type, comptime MsgT: type, comptime res
1827
1866
  if (field.type == canvas.TextInputEvent and std.mem.eql(u8, field.name, tag)) {
1828
1867
  return Ui.inputMsg(@field(std.meta.Tag(MsgT), field.name));
1829
1868
  }
1869
+ // A declared mirror of the event union (transpiled
1870
+ // cores, where type identity cannot cross the emission
1871
+ // boundary): translated at dispatch, same handler shape.
1872
+ if (interpreter.declaredTextInputUnion(field.type) and std.mem.eql(u8, field.name, tag)) {
1873
+ return Ui.translatedInputMsg(@field(std.meta.Tag(MsgT), field.name), field.type);
1874
+ }
1830
1875
  }
1831
1876
  return null;
1832
1877
  }
@@ -1839,6 +1884,13 @@ fn CompiledMarkupEngine(comptime ModelT: type, comptime MsgT: type, comptime res
1839
1884
  if (field.type == canvas.ScrollState and std.mem.eql(u8, field.name, tag)) {
1840
1885
  return Ui.scrollMsg(@field(std.meta.Tag(MsgT), field.name));
1841
1886
  }
1887
+ // A declared mirror of the scroll-state record
1888
+ // (transpiled cores, where type identity cannot cross
1889
+ // the emission boundary): translated at dispatch, same
1890
+ // handler shape.
1891
+ if (interpreter.declaredScrollStateRecord(field.type) and std.mem.eql(u8, field.name, tag)) {
1892
+ return Ui.translatedScrollMsg(@field(std.meta.Tag(MsgT), field.name), field.type);
1893
+ }
1842
1894
  }
1843
1895
  return null;
1844
1896
  }
@@ -1851,6 +1903,32 @@ fn CompiledMarkupEngine(comptime ModelT: type, comptime MsgT: type, comptime res
1851
1903
  if (field.type == f32 and std.mem.eql(u8, field.name, tag)) {
1852
1904
  return Ui.valueMsg(@field(std.meta.Tag(MsgT), field.name));
1853
1905
  }
1906
+ // A declared one-number float arm (transpiled cores):
1907
+ // the fraction widens exactly at dispatch. Integer
1908
+ // arms stay excluded — a 0..1 fraction rounded into
1909
+ // an integer would be silently useless data.
1910
+ if (field.type == f64 and std.mem.eql(u8, field.name, tag)) {
1911
+ return Ui.translatedValueMsg(@field(std.meta.Tag(MsgT), field.name), field.type);
1912
+ }
1913
+ }
1914
+ return null;
1915
+ }
1916
+ }
1917
+
1918
+ /// The slider `on-change` value form: an arm carrying the applied
1919
+ /// 0..1 fraction as `f32` (the canvas-native shape) or the
1920
+ /// transpiled one-number float arm (`f64`, widened exactly).
1921
+ /// Interpreter parity.
1922
+ fn valueConstructor(comptime tag: []const u8) ?Ui.ValueMsgFn {
1923
+ comptime {
1924
+ @setEvalBranchQuota(10_000);
1925
+ for (@typeInfo(MsgT).@"union".fields) |field| {
1926
+ const class = interpreter.valueArmClass(field.type) orelse continue;
1927
+ if (!std.mem.eql(u8, field.name, tag)) continue;
1928
+ return switch (class) {
1929
+ .identity => Ui.valueMsg(@field(std.meta.Tag(MsgT), field.name)),
1930
+ .float => Ui.translatedValueMsg(@field(std.meta.Tag(MsgT), field.name), field.type),
1931
+ };
1854
1932
  }
1855
1933
  return null;
1856
1934
  }
@@ -2159,16 +2237,20 @@ fn CompiledMarkupEngine(comptime ModelT: type, comptime MsgT: type, comptime res
2159
2237
  /// and (when `allow_arena`) arena-taking scalar methods — or null
2160
2238
  /// when the path names nothing `valueOf` can represent (which is
2161
2239
  /// exactly when the interpreter fails).
2162
- fn OnType(comptime T: type, comptime path: []const u8, comptime allow_arena: bool) ?type {
2240
+ fn OnType(comptime OuterT: type, comptime path: []const u8, comptime allow_arena: bool) ?type {
2163
2241
  comptime {
2164
2242
  @setEvalBranchQuota(10_000);
2243
+ // Single-item const pointers are transparent
2244
+ // (`reflect.Pointee`): a `*const Row` loop item or shared
2245
+ // model node resolves like the struct it points at.
2246
+ const T = interpreter.Pointee(OuterT);
2165
2247
  if (@typeInfo(T) != .@"struct") return null;
2166
2248
  const head = interpreter.pathHead(path);
2167
2249
  const tail_opt = interpreter.pathTail(path);
2168
2250
  for (@typeInfo(T).@"struct".fields) |field| {
2169
2251
  if (!std.mem.eql(u8, field.name, head)) continue;
2170
2252
  if (tail_opt) |tail| {
2171
- if (@typeInfo(field.type) != .@"struct") return null;
2253
+ if (@typeInfo(interpreter.Pointee(field.type)) != .@"struct") return null;
2172
2254
  return OnType(field.type, tail, allow_arena);
2173
2255
  }
2174
2256
  if (!supportedValue(field.type)) return null;
@@ -2202,6 +2284,14 @@ fn CompiledMarkupEngine(comptime ModelT: type, comptime MsgT: type, comptime res
2202
2284
  /// to member access, method leaves to a direct call (arena-taking
2203
2285
  /// leaves receive the build arena).
2204
2286
  fn valueOn(comptime T: type, comptime path: []const u8, ptr: *const T, arena: std.mem.Allocator) (OnType(T, path, true).?) {
2287
+ // Mirror OnType's `reflect.Pointee` transparency: a resolved
2288
+ // path through a single-item const pointer dereferences it and
2289
+ // continues on the struct it shares (OnType already proved the
2290
+ // pointer shape, so only const single-item pointers reach this
2291
+ // branch).
2292
+ if (comptime (@typeInfo(T) == .pointer and @typeInfo(T).pointer.size == .one)) {
2293
+ return valueOn(@typeInfo(T).pointer.child, path, ptr.*, arena);
2294
+ }
2205
2295
  const head = comptime interpreter.pathHead(path);
2206
2296
  if (comptime (interpreter.pathTail(path) != null)) {
2207
2297
  const tail = comptime interpreter.pathTail(path).?;