@native-sdk/cli 0.9.1 → 0.9.3

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 (156) hide show
  1. package/build/app.zig +26 -9
  2. package/build.zig +124 -1
  3. package/package.json +9 -9
  4. package/packages/core/package-lock.json +2 -2
  5. package/packages/core/package.json +1 -1
  6. package/packages/core/sdk/core.ts +3 -1
  7. package/packages/core/sdk/events.d.ts +7 -0
  8. package/packages/core/sdk/events.ts +26 -5
  9. package/packages/core/sdk/text.d.ts +4 -0
  10. package/packages/core/sdk/text.ts +51 -0
  11. package/packages/core/src/checker.ts +58 -1
  12. package/packages/core/src/contract.ts +5 -4
  13. package/packages/core/src/devhost_journal.mjs +2 -2
  14. package/packages/core/src/diagnostics.ts +2 -2
  15. package/packages/core/src/service_contract.ts +10 -0
  16. package/packages/core/src/typed_ast.ts +9 -7
  17. package/packages/core/src/types.ts +28 -8
  18. package/skill-data/automation/SKILL.md +4 -3
  19. package/skill-data/native-ui/SKILL.md +10 -8
  20. package/skill-data/ts-core/SKILL.md +8 -5
  21. package/src/app_runner/root.zig +301 -12
  22. package/src/app_runner/ts_core_main.zig +6 -4
  23. package/src/app_runner/window_placement.zig +63 -0
  24. package/src/automation/protocol.zig +5 -1
  25. package/src/automation/snapshot.zig +119 -0
  26. package/src/embed/app_exports.zig +2 -1
  27. package/src/embed/conversions.zig +1 -0
  28. package/src/embed/host.zig +10 -3
  29. package/src/embed/root.zig +1 -0
  30. package/src/embed/tests.zig +13 -1
  31. package/src/embed/types.zig +2 -0
  32. package/src/embed/ui_host.zig +26 -2
  33. package/src/platform/android/NativeSdkActivity.java +49 -4
  34. package/src/platform/android/android_host.c +3 -3
  35. package/src/platform/android/native_sdk_app.h +1 -1
  36. package/src/platform/ios/apple_image_fit.h +38 -0
  37. package/src/platform/ios/files.zig +1 -0
  38. package/src/platform/ios/native_sdk_app.h +1 -1
  39. package/src/platform/ios/uikit_host.m +28 -5
  40. package/src/platform/linux/cef_host.cpp +10 -2
  41. package/src/platform/linux/gtk_host.c +43 -10
  42. package/src/platform/linux/gtk_host.h +3 -3
  43. package/src/platform/linux/root.zig +22 -7
  44. package/src/platform/macos/appkit_host.h +7 -4
  45. package/src/platform/macos/appkit_host.m +271 -52
  46. package/src/platform/macos/cef_host.mm +132 -34
  47. package/src/platform/macos/image_fit_test.m +44 -0
  48. package/src/platform/macos/root.zig +222 -14
  49. package/src/platform/null_platform.zig +17 -3
  50. package/src/platform/null_platform_tests.zig +58 -4
  51. package/src/platform/root.zig +2 -0
  52. package/src/platform/types.zig +69 -19
  53. package/src/platform/windows/root.zig +22 -7
  54. package/src/platform/windows/webview2_host.cpp +31 -6
  55. package/src/primitives/app_manifest/root.zig +3 -0
  56. package/src/primitives/app_manifest/tests.zig +24 -0
  57. package/src/primitives/app_manifest/types.zig +13 -0
  58. package/src/primitives/app_manifest/validation.zig +24 -0
  59. package/src/primitives/canvas/a11y_audit.zig +9 -7
  60. package/src/primitives/canvas/a11y_audit_tests.zig +24 -0
  61. package/src/primitives/canvas/events.zig +129 -1
  62. package/src/primitives/canvas/layout_audit.zig +6 -6
  63. package/src/primitives/canvas/markdown.zig +4 -0
  64. package/src/primitives/canvas/markdown_tests.zig +1 -0
  65. package/src/primitives/canvas/png.zig +138 -0
  66. package/src/primitives/canvas/root.zig +14 -2
  67. package/src/primitives/canvas/text_interaction.zig +23 -0
  68. package/src/primitives/canvas/text_span_tests.zig +5 -3
  69. package/src/primitives/canvas/text_spans.zig +2 -0
  70. package/src/primitives/canvas/text_tests.zig +65 -0
  71. package/src/primitives/canvas/ui.zig +66 -10
  72. package/src/primitives/canvas/ui_markup.zig +40 -13
  73. package/src/primitives/canvas/ui_markup_binary.zig +8 -6
  74. package/src/primitives/canvas/ui_markup_binary_tests.zig +14 -4
  75. package/src/primitives/canvas/ui_markup_compiled.zig +5 -1
  76. package/src/primitives/canvas/ui_markup_compiled_tests.zig +55 -0
  77. package/src/primitives/canvas/ui_markup_reflect.zig +6 -5
  78. package/src/primitives/canvas/ui_markup_tests.zig +11 -2
  79. package/src/primitives/canvas/ui_markup_view.zig +8 -2
  80. package/src/primitives/canvas/ui_markup_view_tests.zig +67 -6
  81. package/src/primitives/canvas/ui_schema.zig +17 -13
  82. package/src/primitives/canvas/ui_tests.zig +84 -0
  83. package/src/primitives/canvas/widget_access.zig +3 -3
  84. package/src/primitives/canvas/widget_anchored_tests.zig +106 -0
  85. package/src/primitives/canvas/widget_builtin_tests.zig +593 -32
  86. package/src/primitives/canvas/widget_invalidation.zig +33 -6
  87. package/src/primitives/canvas/widget_layout.zig +333 -126
  88. package/src/primitives/canvas/widget_layout_tests.zig +169 -0
  89. package/src/primitives/canvas/widget_metrics.zig +7 -8
  90. package/src/primitives/canvas/widget_render.zig +76 -44
  91. package/src/primitives/canvas/widget_render_controls.zig +110 -32
  92. package/src/primitives/canvas/widget_render_style.zig +58 -18
  93. package/src/primitives/canvas/widget_render_surfaces.zig +45 -14
  94. package/src/primitives/canvas/widget_routing.zig +40 -34
  95. package/src/primitives/canvas/widget_runtime.zig +11 -2
  96. package/src/primitives/canvas/widget_runtime_tests.zig +10 -14
  97. package/src/primitives/canvas/widget_semantics.zig +8 -3
  98. package/src/primitives/canvas/widget_semantics_tests.zig +6 -2
  99. package/src/primitives/canvas/widget_tree.zig +99 -5
  100. package/src/primitives/canvas/widgets.zig +20 -7
  101. package/src/root.zig +3 -0
  102. package/src/runtime/api.zig +6 -0
  103. package/src/runtime/automation_snapshot.zig +4 -0
  104. package/src/runtime/automation_widget_dispatch.zig +48 -6
  105. package/src/runtime/builtin_bridge.zig +5 -2
  106. package/src/runtime/canvas_frame_packet_tests.zig +22 -13
  107. package/src/runtime/canvas_image_tests.zig +146 -2
  108. package/src/runtime/canvas_images.zig +35 -16
  109. package/src/runtime/canvas_limits.zig +13 -3
  110. package/src/runtime/canvas_widget_accessibility_tests.zig +279 -4
  111. package/src/runtime/canvas_widget_anchored_tests.zig +54 -0
  112. package/src/runtime/canvas_widget_control_tests.zig +33 -1
  113. package/src/runtime/canvas_widget_events.zig +151 -26
  114. package/src/runtime/canvas_widget_floating_tests.zig +48 -0
  115. package/src/runtime/canvas_widget_runtime.zig +322 -102
  116. package/src/runtime/canvas_widget_scroll_driver_tests.zig +34 -0
  117. package/src/runtime/canvas_widget_scroll_drivers.zig +12 -10
  118. package/src/runtime/canvas_widget_scroll_tests.zig +193 -2
  119. package/src/runtime/canvas_widget_semantics_tests.zig +337 -3
  120. package/src/runtime/canvas_widget_split_tree_tests.zig +55 -0
  121. package/src/runtime/canvas_widget_state.zig +33 -7
  122. package/src/runtime/canvas_widget_text_tests.zig +124 -0
  123. package/src/runtime/core.zig +16 -0
  124. package/src/runtime/effects.zig +14 -14
  125. package/src/runtime/effects_image_tests.zig +91 -0
  126. package/src/runtime/gpu_surface_events.zig +25 -2
  127. package/src/runtime/native_command_event_tests.zig +29 -0
  128. package/src/runtime/root.zig +2 -0
  129. package/src/runtime/session_journal.zig +21 -2
  130. package/src/runtime/session_replay.zig +13 -8
  131. package/src/runtime/session_tests.zig +111 -4
  132. package/src/runtime/shell_layout_tests.zig +12 -0
  133. package/src/runtime/ts_core_host_tests.zig +47 -0
  134. package/src/runtime/ts_ui_app.zig +164 -1
  135. package/src/runtime/ui_app.zig +100 -21
  136. package/src/runtime/ui_app_tests.zig +351 -32
  137. package/src/runtime/ui_app_window_tests.zig +13 -1
  138. package/src/runtime/view.zig +3 -0
  139. package/src/runtime/view_widget_control.zig +18 -0
  140. package/src/runtime/view_widget_scroll.zig +112 -18
  141. package/src/runtime/view_widget_text.zig +1 -1
  142. package/src/runtime/view_widget_tree.zig +110 -13
  143. package/src/runtime/widget_bridge.zig +2 -0
  144. package/src/runtime/window_command_bridge_tests.zig +86 -0
  145. package/src/runtime/window_storage.zig +16 -1
  146. package/src/runtime/window_views.zig +1 -0
  147. package/src/tooling/ios.zig +3 -0
  148. package/src/tooling/manifest.zig +90 -2
  149. package/src/tooling/package.zig +67 -2
  150. package/src/tooling/raw_manifest.zig +10 -0
  151. package/src/tooling/templates.zig +128 -18
  152. package/src/tooling/verbs.zig +1 -0
  153. package/src/tooling/web_engine.zig +1 -1
  154. package/tools/corewire/emit.zig +31 -12
  155. package/tools/corewire/emit_facade.zig +57 -2
  156. package/tools/corewire/shim_rt.zig +20 -0
@@ -281,6 +281,23 @@ pub fn UiAppWithFeatures(comptime ModelT: type, comptime MsgT: type, comptime fe
281
281
  items: []const platform.TrayMenuItem = &.{},
282
282
  };
283
283
 
284
+ /// The stock-theme axes a model may own without replacing the full
285
+ /// DesignTokens register. `system` follows the platform's live color
286
+ /// scheme; null pack/accent values inherit the manifest-backed
287
+ /// Options fields. Native chrome and WebViews remain OS-themed — this
288
+ /// state controls canvas tokens only.
289
+ pub const ThemeColorScheme = enum { system, light, dark };
290
+
291
+ pub const ThemeState = struct {
292
+ pack: ?canvas.ThemePack = null,
293
+ color_scheme: ThemeColorScheme = .system,
294
+ accent: ?canvas.Color = null,
295
+ /// Adapter-only invalid declaration marker. Zig cores already
296
+ /// pass a typed Color; the TS adapter retains malformed source
297
+ /// text here so rebuild rejects it instead of silently inheriting.
298
+ invalid_accent: ?[]const u8 = null,
299
+ };
300
+
284
301
  /// One entry in the model-declared status-item collection.
285
302
  /// `id` is stable identity; dropping the entry removes that
286
303
  /// native status item, while every other field patches in place.
@@ -485,6 +502,11 @@ pub fn UiAppWithFeatures(comptime ModelT: type, comptime MsgT: type, comptime fe
485
502
  /// `tokens_fn` still take precedence because those paths own
486
503
  /// the complete token register.
487
504
  theme_fn: ?*const fn (model: *const ModelT) canvas.ThemePack = null,
505
+ /// Cohesive model-derived stock-theme state: built-in pack,
506
+ /// canvas color scheme, and accent. This subsumes `theme_fn` and
507
+ /// is mutually exclusive with it. Explicit `tokens_fn`/`tokens`
508
+ /// still own the complete register and take precedence.
509
+ theme_state_fn: ?*const fn (model: *const ModelT) ThemeState = null,
488
510
  /// The app's ONE-accent brand statement over the stock
489
511
  /// tokens: when set (and the app claims neither `tokens`
490
512
  /// nor `tokens_fn` — apps that own their tokens own their
@@ -962,6 +984,10 @@ pub fn UiAppWithFeatures(comptime ModelT: type, comptime MsgT: type, comptime fe
962
984
  /// light/dark setting live. Test/null platforms never emit it,
963
985
  /// so deterministic runs stay on the default light theme.
964
986
  system_appearance: platform.Appearance = .{},
987
+ /// Last valid model-derived state. Re-derived before each rebuild;
988
+ /// equality is a handful of scalar/optional fields.
989
+ theme_state: ThemeState = .{},
990
+ theme_state_known: bool = false,
965
991
  pixel_snap_scale: f32 = 1,
966
992
  frame_timestamp_ns: u64 = 0,
967
993
  markup_arenas: [2]std.heap.ArenaAllocator,
@@ -1397,6 +1423,7 @@ pub fn UiAppWithFeatures(comptime ModelT: type, comptime MsgT: type, comptime fe
1397
1423
  std.debug.assert((options.update != null) != (options.update_fx != null));
1398
1424
  // Declared windows need the per-window view to build them.
1399
1425
  std.debug.assert(options.windows_fn == null or options.window_view != null);
1426
+ std.debug.assert(options.theme_fn == null or options.theme_state_fn == null);
1400
1427
  if (comptime !features.runtime_markup) std.debug.assert(options.markup == null);
1401
1428
  }
1402
1429
 
@@ -1883,32 +1910,66 @@ pub fn UiAppWithFeatures(comptime ModelT: type, comptime MsgT: type, comptime fe
1883
1910
  tokens.pixel_snap.scale = self.pixel_snap_scale;
1884
1911
  return tokens;
1885
1912
  }
1886
- var tokens = canvas.DesignTokens.theme(.{
1887
- .color_scheme = switch (self.system_appearance.color_scheme) {
1913
+ const state = self.currentThemeState();
1914
+ const color_scheme: canvas.ColorScheme = switch (state.color_scheme) {
1915
+ .system => switch (self.system_appearance.color_scheme) {
1888
1916
  .light => .light,
1889
1917
  .dark => .dark,
1890
1918
  },
1919
+ .light => .light,
1920
+ .dark => .dark,
1921
+ };
1922
+ var tokens = canvas.DesignTokens.theme(.{
1923
+ .color_scheme = color_scheme,
1891
1924
  .contrast = if (self.system_appearance.high_contrast) .high else .standard,
1892
1925
  .reduce_motion = self.system_appearance.reduce_motion,
1893
- .pack = if (self.options.theme_fn) |theme_fn| theme_fn(&self.model) else self.options.theme,
1926
+ .pack = state.pack orelse if (self.options.theme_fn) |theme_fn| theme_fn(&self.model) else self.options.theme,
1894
1927
  });
1895
- if (self.options.theme_accent) |accent| {
1928
+ if (state.accent orelse self.options.theme_accent) |accent| {
1896
1929
  // The manifest accent layers over the resolved pack —
1897
1930
  // except under high contrast, where the pack's own loud
1898
1931
  // register wins untouched (accessibility beats brand).
1899
1932
  // The bundle takes the resolved scheme: the dark ring
1900
1933
  // derives desaturated (canvas.accentFocusRing).
1901
1934
  if (!self.system_appearance.high_contrast) {
1902
- tokens = tokens.withOverrides(canvas.accentOverrides(accent, switch (self.system_appearance.color_scheme) {
1903
- .light => .light,
1904
- .dark => .dark,
1905
- }));
1935
+ tokens = tokens.withOverrides(canvas.accentOverrides(accent, color_scheme));
1906
1936
  }
1907
1937
  }
1908
1938
  tokens.pixel_snap.scale = self.pixel_snap_scale;
1909
1939
  return tokens;
1910
1940
  }
1911
1941
 
1942
+ fn currentThemeState(self: *const Self) ThemeState {
1943
+ if (self.theme_state_known) return self.theme_state;
1944
+ return if (self.options.theme_state_fn) |theme_state_fn| theme_state_fn(&self.model) else .{};
1945
+ }
1946
+
1947
+ /// Re-derive once per rebuild and reject malformed adapter input at
1948
+ /// the declaration boundary. A valid retained state contains no
1949
+ /// borrowed accent text, so it remains safe between dispatches.
1950
+ fn refreshThemeState(self: *Self) error{InvalidThemeAccent}!void {
1951
+ // Complete-token paths outrank the stock-theme helper entirely.
1952
+ // Do not even validate an unused model accent: the app has
1953
+ // explicitly claimed the whole DesignTokens register.
1954
+ if (self.options.tokens_fn != null or self.options.tokens != null) {
1955
+ self.theme_state = .{};
1956
+ self.theme_state_known = true;
1957
+ return;
1958
+ }
1959
+ const next = if (self.options.theme_state_fn) |theme_state_fn| theme_state_fn(&self.model) else ThemeState{};
1960
+ if (next.invalid_accent) |accent| {
1961
+ ui_app_log.warn(
1962
+ "themeState(model) returned accent '{s}'; expected exactly #rrggbb (six hexadecimal digits)",
1963
+ .{accent},
1964
+ );
1965
+ return error.InvalidThemeAccent;
1966
+ }
1967
+ if (!self.theme_state_known or !std.meta.eql(self.theme_state, next)) {
1968
+ self.theme_state = next;
1969
+ self.theme_state_known = true;
1970
+ }
1971
+ }
1972
+
1912
1973
  /// The design tokens for a secondary window's rebuild: the same
1913
1974
  /// app-owned appearance as `effectiveTokens`, restamped with the
1914
1975
  /// SLOT's device scale. Each window snaps hairlines against its
@@ -1924,13 +1985,15 @@ pub fn UiAppWithFeatures(comptime ModelT: type, comptime MsgT: type, comptime fe
1924
1985
  /// true only when the app claims neither token override, so an
1925
1986
  /// appearance flip must re-derive and re-render.
1926
1987
  fn followsSystemAppearance(self: *const Self) bool {
1927
- return self.options.tokens_fn == null and self.options.tokens == null;
1988
+ if (self.options.tokens_fn != null or self.options.tokens != null) return false;
1989
+ if (self.options.theme_state_fn == null) return true;
1990
+ return self.currentThemeState().color_scheme == .system;
1928
1991
  }
1929
1992
 
1930
1993
  /// Whether tokens are derived per rebuild (model-owned or
1931
1994
  /// system-followed) rather than a fixed set.
1932
1995
  fn derivesTokens(self: *const Self) bool {
1933
- return self.options.tokens_fn != null or self.followsSystemAppearance();
1996
+ return self.options.tokens_fn != null or self.options.theme_state_fn != null or self.followsSystemAppearance();
1934
1997
  }
1935
1998
 
1936
1999
  /// Whether a rebuild must push its tokens into the runtime's
@@ -1947,8 +2010,8 @@ pub fn UiAppWithFeatures(comptime ModelT: type, comptime MsgT: type, comptime fe
1947
2010
  /// pre-registration metrics). Ordinary rebuilds keep skipping
1948
2011
  /// the redundant emission.
1949
2012
  fn rebuildEmitsTokens(self: *const Self, runtime: *Runtime, window_id: platform.WindowId, canvas_label: []const u8, tokens: canvas.DesignTokens) bool {
1950
- if (self.derivesTokens()) return true;
1951
2013
  const stored = runtime.canvasWidgetDesignTokens(window_id, canvas_label) catch return true;
2014
+ if (self.derivesTokens()) return !std.meta.eql(stored, tokens);
1952
2015
  if (!std.meta.eql(stored.text_measure, tokens.text_measure)) return true;
1953
2016
  return stored.pixel_snap.scale != tokens.pixel_snap.scale;
1954
2017
  }
@@ -1981,6 +2044,7 @@ pub fn UiAppWithFeatures(comptime ModelT: type, comptime MsgT: type, comptime fe
1981
2044
  /// for the next Msg.
1982
2045
  pub fn rebuild(self: *Self, runtime: *Runtime, window_id: platform.WindowId) anyerror!void {
1983
2046
  self.syncModel(runtime, window_id);
2047
+ try self.refreshThemeState();
1984
2048
  if (comptime features.runtime_markup) {
1985
2049
  // Under automation, drive the interpreter from the first
1986
2050
  // frame even when a compiled view is present: provenance
@@ -2953,6 +3017,7 @@ pub fn UiAppWithFeatures(comptime ModelT: type, comptime MsgT: type, comptime fe
2953
3017
 
2954
3018
  fn rebuildWindowSlot(self: *Self, runtime: *Runtime, slot: *WindowSlot) anyerror!void {
2955
3019
  if (self.options.window_view == null) return;
3020
+ try self.refreshThemeState();
2956
3021
  var tokens = runtime.tokensWithTextMeasure(self.slotEffectiveTokens(slot));
2957
3022
  const next_index = self.contextMenuRebuildIndex(slot.window_id, slot.arena_index);
2958
3023
  const bounds = geometry.RectF.fromSize(slot.canvas_size).deflate(runtime.viewportInsetsForWindow(slot.window_id));
@@ -4249,7 +4314,7 @@ pub fn UiAppWithFeatures(comptime ModelT: type, comptime MsgT: type, comptime fe
4249
4314
  }
4250
4315
  },
4251
4316
  .appearance_changed => |appearance| {
4252
- const changed = !std.meta.eql(self.system_appearance, appearance);
4317
+ const previous = self.system_appearance;
4253
4318
  self.system_appearance = appearance;
4254
4319
  if (self.options.on_appearance) |map| {
4255
4320
  if (map(appearance)) |msg| {
@@ -4257,14 +4322,22 @@ pub fn UiAppWithFeatures(comptime ModelT: type, comptime MsgT: type, comptime fe
4257
4322
  return;
4258
4323
  }
4259
4324
  }
4260
- // No app mapping consumed the change: when the stock
4261
- // tokens follow the system, re-derive and re-render
4262
- // live — flipping the OS appearance re-themes the
4263
- // running app without a restart. Before install the
4264
- // stored appearance alone is enough: the first build
4325
+ // No app mapping consumed the change. High contrast and
4326
+ // reduced motion remain live system axes even when the
4327
+ // model forces light/dark; only a scheme-only flip may
4328
+ // skip repaint while themeState is forced. Before install
4329
+ // the stored appearance alone is enough: the first build
4265
4330
  // reads it.
4266
- if (changed and self.installed and self.followsSystemAppearance()) {
4331
+ const accessibility_changed =
4332
+ previous.high_contrast != appearance.high_contrast or
4333
+ previous.reduce_motion != appearance.reduce_motion;
4334
+ const followed_scheme_changed =
4335
+ previous.color_scheme != appearance.color_scheme and self.followsSystemAppearance();
4336
+ if (self.installed and self.options.tokens_fn == null and self.options.tokens == null and
4337
+ (accessibility_changed or followed_scheme_changed))
4338
+ {
4267
4339
  try self.rebuild(runtime, self.canvas_window_id);
4340
+ try self.rebuildWindowSlots(runtime);
4268
4341
  if (self.options.chrome == null) {
4269
4342
  _ = try runtime.emitCanvasWidgetDisplayList(self.canvas_window_id, self.options.canvas_label, runtime.tokensWithTextMeasure(self.effectiveTokens()));
4270
4343
  }
@@ -4983,7 +5056,7 @@ pub fn UiAppWithFeatures(comptime ModelT: type, comptime MsgT: type, comptime fe
4983
5056
  // `on_double_press` handler (falling back to the ordinary
4984
5057
  // press), while its first release already dispatched the
4985
5058
  // single press — select-then-act, the list convention.
4986
- if (tree.msgForPointerClick(target.id, pointer_event.pointer.phase, pointer_event.pointer.click_count)) |msg| {
5059
+ if (tree.msgForPointerEvent(target.id, pointer_event.pointer)) |msg| {
4987
5060
  try self.dispatch(runtime, pointer_event.window_id, msg);
4988
5061
  }
4989
5062
  }
@@ -5829,6 +5902,12 @@ pub fn UiAppWithFeatures(comptime ModelT: type, comptime MsgT: type, comptime fe
5829
5902
  }
5830
5903
  return;
5831
5904
  }
5905
+ // A radio group owns Arrow/Home/End even when the
5906
+ // requested target is already focused and selected.
5907
+ // That in-place case deliberately has no selection
5908
+ // intent (and therefore no duplicate on-change), but
5909
+ // it must still stop before the app-level key map.
5910
+ if (keyboard_event.keyboard.radio_group_navigation) return;
5832
5911
  }
5833
5912
  }
5834
5913
  }
@@ -6022,8 +6101,8 @@ pub fn UiAppWithFeatures(comptime ModelT: type, comptime MsgT: type, comptime fe
6022
6101
  const tree = self.treeForViewLabel(drag_event.view_label);
6023
6102
  const live_template = if (tree) |value| value.msgFor(source.id, .drag) else null;
6024
6103
  const layout: ?canvas.WidgetLayoutTree = runtime.canvasWidgetLayout(drag_event.window_id, drag_event.view_label) catch null;
6025
- const live_view_size: ?geometry.SizeF = if (layout) |value| if (value.nodes.len > 0) blk: {
6026
- const root = value.nodes[0].frame.normalized();
6104
+ const live_view_size: ?geometry.SizeF = if (layout) |value| if (canvas.widgetLayoutRootBounds(value)) |root_value| blk: {
6105
+ const root = root_value.normalized();
6027
6106
  break :blk geometry.SizeF.init(root.width, root.height);
6028
6107
  } else null else null;
6029
6108