@native-sdk/cli 0.8.3 → 0.8.4
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 +50 -3
- package/build.zig +131 -360
- package/native-sdk.d.ts +4 -0
- package/package.json +9 -9
- package/packages/core/compile-surface/core.ts +90 -1
- package/packages/core/package-lock.json +2 -2
- package/packages/core/package.json +1 -1
- package/packages/core/sdk/core.d.ts +65 -2
- package/packages/core/sdk/core.ts +189 -33
- package/packages/core/sdk/events.d.ts +14 -0
- package/packages/core/sdk/events.ts +18 -0
- package/packages/core/src/checker.ts +61 -1
- package/packages/core/src/devhost.ts +3 -3
- package/packages/core/src/diagnostics.ts +4 -4
- package/skill-data/core/SKILL.md +4 -2
- package/skill-data/core/references/project-anatomy.md +2 -1
- package/skill-data/core/references/web-engines-packaging-debugging.md +3 -1
- package/skill-data/native-ui/SKILL.md +8 -8
- package/skill-data/ts-core/SKILL.md +16 -13
- package/src/app_runner/ts_core_main.zig +25 -2
- package/src/embed/host.zig +6 -0
- package/src/embed/ui_host.zig +2 -0
- package/src/platform/linux/root.zig +1 -0
- package/src/platform/macos/appkit_host.h +10 -0
- package/src/platform/macos/appkit_host.m +515 -93
- package/src/platform/macos/capture_info_plist.c +25 -0
- package/src/platform/macos/cef_host.mm +22 -0
- package/src/platform/macos/root.zig +68 -0
- package/src/platform/null_platform.zig +58 -0
- package/src/platform/root.zig +7 -0
- package/src/platform/types.zig +100 -0
- package/src/platform/windows/root.zig +56 -0
- package/src/platform/windows/webview2_host.cpp +171 -0
- package/src/primitives/app_manifest/types.zig +2 -0
- package/src/primitives/canvas/code_tests.zig +9 -9
- package/src/primitives/canvas/events.zig +12 -11
- package/src/primitives/canvas/frame.zig +44 -9
- package/src/primitives/canvas/icons/mic.svg +1 -0
- package/src/primitives/canvas/icons.zig +2 -0
- package/src/primitives/canvas/root.zig +8 -0
- package/src/primitives/canvas/text_span_tests.zig +39 -0
- package/src/primitives/canvas/ui.zig +23 -4
- package/src/primitives/canvas/ui_markup.zig +15 -0
- package/src/primitives/canvas/ui_markup_compiled.zig +9 -0
- package/src/primitives/canvas/ui_markup_compiled_tests.zig +1 -1
- package/src/primitives/canvas/ui_markup_tests.zig +5 -0
- package/src/primitives/canvas/ui_markup_view.zig +9 -0
- package/src/primitives/canvas/ui_markup_view_tests.zig +9 -6
- package/src/primitives/canvas/ui_schema.zig +19 -10
- package/src/primitives/canvas/ui_schema_tests.zig +5 -3
- package/src/primitives/canvas/ui_tests.zig +18 -4
- package/src/primitives/canvas/widget_invalidation.zig +9 -2
- package/src/primitives/canvas/widget_render.zig +296 -114
- package/src/primitives/canvas/widget_runtime_tests.zig +133 -0
- package/src/primitives/canvas/widget_text_input.zig +10 -10
- package/src/primitives/canvas/widget_tree.zig +1 -1
- package/src/primitives/canvas/widgets.zig +29 -5
- package/src/root.zig +10 -0
- package/src/runtime/automation_widget_dispatch.zig +1 -0
- package/src/runtime/bridge_payload.zig +2 -0
- package/src/runtime/canvas_frame.zig +13 -2
- package/src/runtime/canvas_frame_invalidation_tests.zig +35 -10
- package/src/runtime/canvas_widget_anchored_tests.zig +83 -0
- package/src/runtime/canvas_widget_events.zig +69 -24
- package/src/runtime/canvas_widget_runtime.zig +101 -6
- package/src/runtime/canvas_widget_scroll_driver_tests.zig +47 -4
- package/src/runtime/canvas_widget_scroll_drivers.zig +3 -3
- package/src/runtime/canvas_widget_semantics_tests.zig +2 -0
- package/src/runtime/canvas_widget_split_tree_tests.zig +228 -0
- package/src/runtime/canvas_widget_state.zig +6 -1
- package/src/runtime/canvas_widget_text_tests.zig +112 -3
- package/src/runtime/effects.zig +313 -2
- package/src/runtime/effects_audio_capture_tests.zig +251 -0
- package/src/runtime/root.zig +3 -0
- package/src/runtime/tests.zig +1 -0
- package/src/runtime/ts_core_host.zig +401 -32
- package/src/runtime/ts_core_host_tests.zig +407 -0
- package/src/runtime/ts_ui_app.zig +39 -1
- package/src/runtime/ui_app.zig +18 -3
- package/src/runtime/ui_app_tests.zig +48 -0
- package/src/runtime/view.zig +2 -0
- package/src/runtime/view_widget_scroll.zig +56 -5
- package/src/runtime/view_widget_text.zig +24 -5
- package/src/runtime/view_widget_tree.zig +1 -1
- package/src/tooling/manifest.zig +1034 -0
- package/src/tooling/package.zig +837 -6
- package/src/tooling/raw_manifest.zig +35 -0
- package/src/tooling/templates.zig +55 -0
- package/tools/corewire/emit_facade.zig +36 -0
|
@@ -611,6 +611,62 @@ test "widget render state dirty bounds tracks changed runtime states" {
|
|
|
611
611
|
);
|
|
612
612
|
}
|
|
613
613
|
|
|
614
|
+
test "quiet logical menu focus paints and dirties the active row without an outline" {
|
|
615
|
+
const children = [_]Widget{
|
|
616
|
+
.{
|
|
617
|
+
.id = 2,
|
|
618
|
+
.kind = .menu_item,
|
|
619
|
+
.frame = geometry.RectF.init(10, 12, 120, 32),
|
|
620
|
+
.text = "Duplicate",
|
|
621
|
+
},
|
|
622
|
+
.{
|
|
623
|
+
.id = 3,
|
|
624
|
+
.kind = .menu_item,
|
|
625
|
+
.frame = geometry.RectF.init(10, 52, 120, 32),
|
|
626
|
+
.text = "Rename",
|
|
627
|
+
},
|
|
628
|
+
};
|
|
629
|
+
var nodes: [3]WidgetLayoutNode = undefined;
|
|
630
|
+
const layout = try layoutWidgetTree(.{ .kind = .stack, .children = &children }, geometry.RectF.init(0, 0, 160, 100), &nodes);
|
|
631
|
+
|
|
632
|
+
// A pointer-opened menu keeps focus-visible quiet, but ArrowDown
|
|
633
|
+
// still establishes a logical active row. That row needs the menu
|
|
634
|
+
// wash so the movement is perceptible, without acquiring the focus
|
|
635
|
+
// outline reserved for keyboard traversal between controls.
|
|
636
|
+
var commands: [16]CanvasCommand = undefined;
|
|
637
|
+
var builder = Builder.init(&commands);
|
|
638
|
+
try layout.emitDisplayListWithState(&builder, .{}, .{ .focused_id = 2 });
|
|
639
|
+
var duplicate_wash = false;
|
|
640
|
+
var rename_wash = false;
|
|
641
|
+
var duplicate_outline = false;
|
|
642
|
+
for (builder.displayList().commands) |command| switch (command) {
|
|
643
|
+
.fill_rounded_rect => |fill| {
|
|
644
|
+
if (fill.id == widgetPartId(2, 1)) duplicate_wash = true;
|
|
645
|
+
if (fill.id == widgetPartId(3, 1)) rename_wash = true;
|
|
646
|
+
},
|
|
647
|
+
.stroke_rect => |stroke| {
|
|
648
|
+
if (stroke.id == widgetPartId(2, 2)) duplicate_outline = true;
|
|
649
|
+
},
|
|
650
|
+
else => {},
|
|
651
|
+
};
|
|
652
|
+
try std.testing.expect(duplicate_wash);
|
|
653
|
+
try std.testing.expect(!rename_wash);
|
|
654
|
+
try std.testing.expect(!duplicate_outline);
|
|
655
|
+
|
|
656
|
+
// Moving to the next row changes pixels on both the old and new
|
|
657
|
+
// rows; retained rendering must invalidate the complete union.
|
|
658
|
+
const duplicate_frame = layout.findById(2).?.frame;
|
|
659
|
+
const rename_frame = layout.findById(3).?.frame;
|
|
660
|
+
const dirty = layout.renderStateDirtyBounds(
|
|
661
|
+
.{ .focused_id = 2 },
|
|
662
|
+
.{ .focused_id = 3 },
|
|
663
|
+
).?;
|
|
664
|
+
try std.testing.expect(dirty.x <= @min(duplicate_frame.x, rename_frame.x));
|
|
665
|
+
try std.testing.expect(dirty.y <= @min(duplicate_frame.y, rename_frame.y));
|
|
666
|
+
try std.testing.expect(dirty.maxX() >= @max(duplicate_frame.maxX(), rename_frame.maxX()));
|
|
667
|
+
try std.testing.expect(dirty.maxY() >= @max(duplicate_frame.maxY(), rename_frame.maxY()));
|
|
668
|
+
}
|
|
669
|
+
|
|
614
670
|
test "widget render state dirty bounds tracks terminal logical focus" {
|
|
615
671
|
const rows = [_]canvas.TerminalRow{.{ .cells = &.{} }};
|
|
616
672
|
var grid = canvas.TerminalGrid{
|
|
@@ -2796,6 +2852,83 @@ test "drag landing layout motion escapes its scroll lane clip" {
|
|
|
2796
2852
|
try std.testing.expect(saw_landing_motion);
|
|
2797
2853
|
}
|
|
2798
2854
|
|
|
2855
|
+
test "rich text remains visible in floating drag and landing passes" {
|
|
2856
|
+
const source = "Lifted rich text";
|
|
2857
|
+
const spans = [_]canvas.TextSpan{.{ .text = source }};
|
|
2858
|
+
const root_frame = geometry.RectF.init(0, 0, 320, 140);
|
|
2859
|
+
const scroll_frame = geometry.RectF.init(10, 10, 140, 60);
|
|
2860
|
+
const card_frame = geometry.RectF.init(12, 80, 120, 36);
|
|
2861
|
+
const text_frame = geometry.RectF.init(18, 86, 108, 24);
|
|
2862
|
+
const nodes = [_]WidgetLayoutNode{
|
|
2863
|
+
.{
|
|
2864
|
+
.widget = .{ .id = 1, .kind = .panel, .frame = root_frame },
|
|
2865
|
+
.frame = root_frame,
|
|
2866
|
+
.depth = 0,
|
|
2867
|
+
},
|
|
2868
|
+
.{
|
|
2869
|
+
.widget = .{ .id = 2, .kind = .scroll_view, .frame = scroll_frame },
|
|
2870
|
+
.frame = scroll_frame,
|
|
2871
|
+
.depth = 1,
|
|
2872
|
+
.parent_index = 0,
|
|
2873
|
+
},
|
|
2874
|
+
.{
|
|
2875
|
+
.widget = .{
|
|
2876
|
+
.id = 3,
|
|
2877
|
+
.kind = .row,
|
|
2878
|
+
.frame = card_frame,
|
|
2879
|
+
.style = .{ .background = Color.rgb8(240, 240, 240), .radius = 6 },
|
|
2880
|
+
},
|
|
2881
|
+
.frame = card_frame,
|
|
2882
|
+
.depth = 2,
|
|
2883
|
+
.parent_index = 1,
|
|
2884
|
+
},
|
|
2885
|
+
.{
|
|
2886
|
+
.widget = .{
|
|
2887
|
+
.id = 4,
|
|
2888
|
+
.kind = .text,
|
|
2889
|
+
.frame = text_frame,
|
|
2890
|
+
.text = source,
|
|
2891
|
+
.spans = &spans,
|
|
2892
|
+
},
|
|
2893
|
+
.frame = text_frame,
|
|
2894
|
+
.depth = 3,
|
|
2895
|
+
.parent_index = 2,
|
|
2896
|
+
},
|
|
2897
|
+
};
|
|
2898
|
+
const layout = WidgetLayoutTree{ .nodes = &nodes };
|
|
2899
|
+
|
|
2900
|
+
var preview_commands: [64]CanvasCommand = undefined;
|
|
2901
|
+
var preview_builder = Builder.init(&preview_commands);
|
|
2902
|
+
try layout.emitDisplayListWithState(&preview_builder, .{}, .{
|
|
2903
|
+
.drag_preview_id = 3,
|
|
2904
|
+
.drag_preview_origin = geometry.PointF.init(card_frame.x, card_frame.y),
|
|
2905
|
+
.drag_preview_offset = geometry.OffsetF.init(0, -60),
|
|
2906
|
+
});
|
|
2907
|
+
|
|
2908
|
+
var preview_has_text = false;
|
|
2909
|
+
for (preview_builder.displayList().commands) |command| switch (command) {
|
|
2910
|
+
.draw_text => |draw| preview_has_text = preview_has_text or std.mem.eql(u8, source, draw.text),
|
|
2911
|
+
else => {},
|
|
2912
|
+
};
|
|
2913
|
+
try std.testing.expect(preview_has_text);
|
|
2914
|
+
|
|
2915
|
+
const layout_motions = [_]WidgetLayoutMotion{.{
|
|
2916
|
+
.id = 3,
|
|
2917
|
+
.offset = geometry.OffsetF.init(0, -60),
|
|
2918
|
+
.escape_ancestor_clips = true,
|
|
2919
|
+
}};
|
|
2920
|
+
var landing_commands: [64]CanvasCommand = undefined;
|
|
2921
|
+
var landing_builder = Builder.init(&landing_commands);
|
|
2922
|
+
try layout.emitDisplayListWithState(&landing_builder, .{}, .{ .layout_motions = &layout_motions });
|
|
2923
|
+
|
|
2924
|
+
var landing_has_text = false;
|
|
2925
|
+
for (landing_builder.displayList().commands) |command| switch (command) {
|
|
2926
|
+
.draw_text => |draw| landing_has_text = landing_has_text or std.mem.eql(u8, source, draw.text),
|
|
2927
|
+
else => {},
|
|
2928
|
+
};
|
|
2929
|
+
try std.testing.expect(landing_has_text);
|
|
2930
|
+
}
|
|
2931
|
+
|
|
2799
2932
|
test "input-group wears the focus ring for its focused descendant" {
|
|
2800
2933
|
const tokens = DesignTokens{};
|
|
2801
2934
|
const group_children = [_]Widget{
|
|
@@ -191,14 +191,14 @@ fn widgetTextInputLineHeight(text_size: f32) f32 {
|
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
fn widgetTextInputWrap(widget: Widget, line_height: f32) TextWrap {
|
|
194
|
-
if (widget.code_editor) return if (widget.text_no_wrap) .none else .word;
|
|
194
|
+
if (widget.runtime_flags.code_editor) return if (widget.text_no_wrap) .none else .word;
|
|
195
195
|
if (widget.kind == .textarea) return .word;
|
|
196
196
|
if (widget.kind == .text_field and widget.frame.height >= line_height * 2.25) return .word;
|
|
197
197
|
return .none;
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
fn widgetTextInputVerticalInset(widget: Widget, tokens: DesignTokens, text_size: f32, options: TextLayoutOptions) f32 {
|
|
201
|
-
if (widget.code_editor) return 0;
|
|
201
|
+
if (widget.runtime_flags.code_editor) return 0;
|
|
202
202
|
if (options.wrap != .none) return widget_metrics.widgetControlInset(widget, tokens, tokens.spacing.sm);
|
|
203
203
|
return @max(0, (widget.frame.height - widgetTextInputLineHeight(text_size)) * 0.5);
|
|
204
204
|
}
|
|
@@ -220,7 +220,7 @@ const text_input_caret_reserve: f32 = 1;
|
|
|
220
220
|
/// unscrolled field always has.
|
|
221
221
|
fn widgetTextInputHorizontalScrollOffset(widget: Widget, tokens: DesignTokens, text_size: f32, text_inset: f32, options: TextLayoutOptions) f32 {
|
|
222
222
|
if (options.wrap != .none) return 0;
|
|
223
|
-
const offset = if (widget.code_editor) widget.value_x else widget.value;
|
|
223
|
+
const offset = if (widget.runtime_flags.code_editor) widget.value_x else widget.value;
|
|
224
224
|
return std.math.clamp(offset, 0, widgetTextInputMaxHorizontalScrollOffset(widget, tokens, text_size, text_inset, options));
|
|
225
225
|
}
|
|
226
226
|
|
|
@@ -232,7 +232,7 @@ fn widgetTextInputMaxHorizontalScrollOffset(widget: Widget, tokens: DesignTokens
|
|
|
232
232
|
// paints — so a value holding a line break scrolls by the same
|
|
233
233
|
// single-line extent it draws.
|
|
234
234
|
const font_id = widgetTextInputFontId(widget, tokens);
|
|
235
|
-
const text_width = if (widget.code_editor)
|
|
235
|
+
const text_width = if (widget.runtime_flags.code_editor)
|
|
236
236
|
if (codeContentWidthCacheCurrent(widget, font_id, text_size))
|
|
237
237
|
widget.code_content_width
|
|
238
238
|
else
|
|
@@ -243,7 +243,7 @@ fn widgetTextInputMaxHorizontalScrollOffset(widget: Widget, tokens: DesignTokens
|
|
|
243
243
|
}
|
|
244
244
|
|
|
245
245
|
pub fn widgetTextInputOrigin(widget: Widget, tokens: DesignTokens, text_size: f32, inset: f32, options: TextLayoutOptions) geometry.PointF {
|
|
246
|
-
if (widget.code_editor) {
|
|
246
|
+
if (widget.runtime_flags.code_editor) {
|
|
247
247
|
return geometry.PointF.init(
|
|
248
248
|
widget.frame.x + inset - widgetTextInputHorizontalScrollOffset(widget, tokens, text_size, inset, options),
|
|
249
249
|
widget.frame.y + text_size - widgetTextInputScrollOffset(widget, tokens, text_size, inset, options),
|
|
@@ -365,7 +365,7 @@ pub fn textInputCaretVisibleScrollOffsetForWidget(widget: Widget, tokens: Design
|
|
|
365
365
|
// selection rects measure with — the PRESENTED bytes (byte offsets
|
|
366
366
|
// are interchangeable: the presentation substitutes 1:1).
|
|
367
367
|
const caret_offset = snapTextOffset(widget.text, selection.focus);
|
|
368
|
-
const caret_line_start = if (widget.code_editor)
|
|
368
|
+
const caret_line_start = if (widget.runtime_flags.code_editor)
|
|
369
369
|
(std.mem.lastIndexOfScalar(u8, widget.text[0..caret_offset], '\n') orelse 0) +
|
|
370
370
|
@as(usize, @intFromBool(std.mem.lastIndexOfScalar(u8, widget.text[0..caret_offset], '\n') != null))
|
|
371
371
|
else
|
|
@@ -464,7 +464,7 @@ pub fn widgetTextInputDrawText(
|
|
|
464
464
|
}
|
|
465
465
|
|
|
466
466
|
pub fn widgetTextInputInset(widget: Widget, tokens: DesignTokens) f32 {
|
|
467
|
-
if (widget.code_editor) return widget_metrics.widgetCodeLineNumberGutterWidth(widget, tokens);
|
|
467
|
+
if (widget.runtime_flags.code_editor) return widget_metrics.widgetCodeLineNumberGutterWidth(widget, tokens);
|
|
468
468
|
const text_size = widgetTextInputSize(widget, tokens);
|
|
469
469
|
return switch (widget.kind) {
|
|
470
470
|
.search_field, .combobox => widget_metrics.widgetControlInset(widget, tokens, tokens.spacing.md) + @max(widget_metrics.widgetSizedDensityValue(widget, tokens, 8), text_size - 2) + widget_metrics.widgetControlInset(widget, tokens, tokens.spacing.sm),
|
|
@@ -473,7 +473,7 @@ pub fn widgetTextInputInset(widget: Widget, tokens: DesignTokens) f32 {
|
|
|
473
473
|
}
|
|
474
474
|
|
|
475
475
|
fn widgetTextInputFontId(widget: Widget, tokens: DesignTokens) FontId {
|
|
476
|
-
return if (widget.code_editor) tokens.typography.mono_font_id else tokens.typography.font_id;
|
|
476
|
+
return if (widget.runtime_flags.code_editor) tokens.typography.mono_font_id else tokens.typography.font_id;
|
|
477
477
|
}
|
|
478
478
|
|
|
479
479
|
fn codeContentWidthCacheCurrent(widget: Widget, font_id: FontId, text_size: f32) bool {
|
|
@@ -489,7 +489,7 @@ fn codeContentWidthCacheCurrent(widget: Widget, font_id: FontId, text_size: f32)
|
|
|
489
489
|
/// Runtime reconciliation carries this cache across unchanged app rebuilds;
|
|
490
490
|
/// edits invalidate it before caret scrolling recomputes the new document.
|
|
491
491
|
pub fn cacheTextInputContentWidthForWidget(widget: *Widget, tokens: DesignTokens) void {
|
|
492
|
-
if (widget.kind != .textarea or !widget.code_editor or !widget.text_no_wrap) return;
|
|
492
|
+
if (widget.kind != .textarea or !widget.runtime_flags.code_editor or !widget.text_no_wrap) return;
|
|
493
493
|
if (widget.hasCodeDiff()) return;
|
|
494
494
|
const text_size = widgetTextInputSize(widget.*, tokens);
|
|
495
495
|
const font_id = widgetTextInputFontId(widget.*, tokens);
|
|
@@ -578,7 +578,7 @@ fn widgetTextInputTrailingInset(widget: Widget, text_size: f32, inset: f32) f32
|
|
|
578
578
|
// field padding. Its source viewport runs all the way to the trailing
|
|
579
579
|
// edge; mirroring the gutter here invents horizontal overflow for lines
|
|
580
580
|
// that visibly fit beside the numbers.
|
|
581
|
-
if (widget.code_editor) return 0;
|
|
581
|
+
if (widget.runtime_flags.code_editor) return 0;
|
|
582
582
|
if (widget.kind == .combobox) return inset + @max(8, text_size - 4);
|
|
583
583
|
// A search field holding text reserves the trailing slot for the
|
|
584
584
|
// built-in clear affordance so the text never runs under the x.
|
|
@@ -128,7 +128,7 @@ pub fn widgetScrollsAxis(widget: Widget, axis: token_model.ScrollAxis) bool {
|
|
|
128
128
|
return switch (axis) {
|
|
129
129
|
.vertical => widget.kind != .scroll_view or widget.scroll_axes.scrollsVertically() or widget.layout.virtualized,
|
|
130
130
|
.horizontal => (widget.kind == .scroll_view and widget.scroll_axes.scrollsHorizontally() and !widget.layout.virtualized) or
|
|
131
|
-
(widget.kind == .textarea and widget.code_editor and widget.text_no_wrap),
|
|
131
|
+
(widget.kind == .textarea and widget.runtime_flags.code_editor and widget.text_no_wrap),
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
134
|
|
|
@@ -264,6 +264,18 @@ pub const WidgetState = struct {
|
|
|
264
264
|
invalid: bool = false,
|
|
265
265
|
};
|
|
266
266
|
|
|
267
|
+
/// Engine-owned widget markers share one byte so adding runtime policy does
|
|
268
|
+
/// not expand every retained `Widget`. Builder-facing behavior remains on
|
|
269
|
+
/// ordinary named fields; these bits are stamped only by engine code.
|
|
270
|
+
pub const WidgetRuntimeFlags = packed struct(u8) {
|
|
271
|
+
/// `Ui.code` stamped this textarea as the editor surface.
|
|
272
|
+
code_editor: bool = false,
|
|
273
|
+
/// The runtime installed an OS-native scroll driver; engine-drawn
|
|
274
|
+
/// scrollbar and kinetic physics stand down for this scroll view.
|
|
275
|
+
native_scroll: bool = false,
|
|
276
|
+
_reserved: u6 = 0,
|
|
277
|
+
};
|
|
278
|
+
|
|
267
279
|
/// Two 128-line masks for code-only diff presentation. `Widget` packs them
|
|
268
280
|
/// into fields dormant on decorated code so ordinary widgets do not grow.
|
|
269
281
|
pub const CodeDiffLines = struct {
|
|
@@ -947,7 +959,14 @@ pub const Widget = struct {
|
|
|
947
959
|
/// selection, and accessibility paths all apply; this bit only swaps
|
|
948
960
|
/// the textarea's visual/geometry policy to bare monospace highlighted
|
|
949
961
|
/// code (no control fill, border, radius, focus ring, or inset).
|
|
950
|
-
|
|
962
|
+
runtime_flags: WidgetRuntimeFlags = .{},
|
|
963
|
+
/// Textarea Enter policy (`ElementOptions.submit_on_enter` / markup
|
|
964
|
+
/// `submit-on-enter`): plain Enter submits instead of editing, while
|
|
965
|
+
/// Shift+Enter remains a newline. False keeps the ordinary multiline
|
|
966
|
+
/// contract. Ignored by non-textarea kinds. The engine-only booleans in
|
|
967
|
+
/// `runtime_flags` share a byte so adding this policy does not grow every
|
|
968
|
+
/// retained widget.
|
|
969
|
+
submit_on_enter: bool = false,
|
|
951
970
|
/// Syntax grammar for an editable `Ui.code` surface. Editable code
|
|
952
971
|
/// retains one plain source span and tokenizes only visible logical
|
|
953
972
|
/// lines during paint, so large documents do not consume the view's
|
|
@@ -1033,10 +1052,6 @@ pub const Widget = struct {
|
|
|
1033
1052
|
semantics: WidgetSemantics = .{},
|
|
1034
1053
|
/// App-declared native context menu for this widget (empty = none).
|
|
1035
1054
|
context_menu: []const WidgetContextMenuItem = &.{},
|
|
1036
|
-
/// True when the runtime installed a native scroll driver for this
|
|
1037
|
-
/// `.scroll_view`: the engine's drawn scrollbar and kinetic physics
|
|
1038
|
-
/// stand down — the OS scroller owns feel and the overlay scroller.
|
|
1039
|
-
native_scroll: bool = false,
|
|
1040
1055
|
/// Per-region edge behavior for scroll containers (`overscroll:` in
|
|
1041
1056
|
/// the builder, `overscroll=` in markup): `.default` follows the
|
|
1042
1057
|
/// `ScrollPhysics.overscroll` token (off unless a theme flips it),
|
|
@@ -1618,3 +1633,12 @@ fn mergeLayoutDefaults(explicit: WidgetLayoutStyle, defaults: WidgetLayoutStyle)
|
|
|
1618
1633
|
if (explicit.min_size.width == 0 and explicit.min_size.height == 0) merged.min_size = defaults.min_size;
|
|
1619
1634
|
return merged;
|
|
1620
1635
|
}
|
|
1636
|
+
|
|
1637
|
+
test "Widget keeps the retained hot-path footprint after textarea policy flags" {
|
|
1638
|
+
// One layout tree holds thousands of Widgets by value. On the 64-bit
|
|
1639
|
+
// targets that run the renderer, 776 bytes is the reviewed footprint;
|
|
1640
|
+
// packing engine-only markers keeps the new textarea policy within it.
|
|
1641
|
+
if (@sizeOf(usize) == 8) {
|
|
1642
|
+
try std.testing.expectEqual(@as(usize, 776), @sizeOf(Widget));
|
|
1643
|
+
}
|
|
1644
|
+
}
|
package/src/root.zig
CHANGED
|
@@ -74,6 +74,9 @@ pub const EffectTimerOutcome = runtime.EffectTimerOutcome;
|
|
|
74
74
|
pub const max_effect_timers = runtime.max_effect_timers;
|
|
75
75
|
pub const EffectAudio = runtime.EffectAudio;
|
|
76
76
|
pub const EffectAudioEventKind = runtime.EffectAudioEventKind;
|
|
77
|
+
pub const EffectAudioCaptureEvent = runtime.EffectAudioCaptureEvent;
|
|
78
|
+
pub const EffectAudioCaptureEventKind = runtime.EffectAudioCaptureEventKind;
|
|
79
|
+
pub const decodeAudioCaptureChannelEvent = runtime.decodeAudioCaptureChannelEvent;
|
|
77
80
|
pub const EffectAudioSource = runtime.EffectAudioSource;
|
|
78
81
|
pub const audioCachePath = runtime.audioCachePath;
|
|
79
82
|
pub const max_effect_audio_path_bytes = runtime.max_effect_audio_path_bytes;
|
|
@@ -133,6 +136,13 @@ pub const WebViewSourceKind = platform.WebViewSourceKind;
|
|
|
133
136
|
pub const WebViewAssetSource = platform.WebViewAssetSource;
|
|
134
137
|
pub const WebEngine = platform.WebEngine;
|
|
135
138
|
pub const PlatformFeature = platform.PlatformFeature;
|
|
139
|
+
pub const AudioCaptureSource = platform.AudioCaptureSource;
|
|
140
|
+
pub const AudioCaptureFormat = platform.AudioCaptureFormat;
|
|
141
|
+
pub const AudioCaptureEvent = platform.AudioCaptureEvent;
|
|
142
|
+
pub const AudioCaptureEventKind = platform.AudioCaptureEventKind;
|
|
143
|
+
pub const AudioCaptureSink = platform.AudioCaptureSink;
|
|
144
|
+
pub const AudioCapturePushResult = platform.AudioCapturePushResult;
|
|
145
|
+
pub const max_audio_capture_pcm_bytes = platform.max_audio_capture_pcm_bytes;
|
|
136
146
|
pub const ViewKind = platform.ViewKind;
|
|
137
147
|
pub const ViewOptions = platform.ViewOptions;
|
|
138
148
|
pub const ViewPatch = platform.ViewPatch;
|
|
@@ -508,6 +508,7 @@ pub fn RuntimeAutomationWidgetDispatch(comptime Runtime: type) type {
|
|
|
508
508
|
self.views[view_index].recordGpuSurfaceInputTimestamp(automationInputTimestampNs());
|
|
509
509
|
try CanvasWidgetEventMethods().invalidateForCanvasWidgetRenderStateChange(self, view_index, previous_state, self.views[view_index].canvasWidgetRenderState());
|
|
510
510
|
}
|
|
511
|
+
_ = try self.views[view_index].ensureCanvasWidgetFocusedTextCaret();
|
|
511
512
|
}
|
|
512
513
|
|
|
513
514
|
pub fn dispatchAutomationWidgetKey(self: *Runtime, app: runtime_api.App(Runtime), view_index: usize, id: canvas.ObjectId, key: []const u8) anyerror!void {
|
|
@@ -125,6 +125,8 @@ pub fn platformFeatureFromString(value: []const u8) ?platform.PlatformFeature {
|
|
|
125
125
|
if (std.mem.eql(u8, value, "audioPlayback")) return .audio_playback;
|
|
126
126
|
if (std.mem.eql(u8, value, "audioStreaming")) return .audio_streaming;
|
|
127
127
|
if (std.mem.eql(u8, value, "audioSpectrum")) return .audio_spectrum;
|
|
128
|
+
if (std.mem.eql(u8, value, "microphoneCapture")) return .microphone_capture;
|
|
129
|
+
if (std.mem.eql(u8, value, "systemAudioCapture")) return .system_audio_capture;
|
|
128
130
|
if (std.mem.eql(u8, value, "windowHideOnClose")) return .window_hide_on_close;
|
|
129
131
|
if (std.mem.eql(u8, value, "videoPlayback")) return .video_playback;
|
|
130
132
|
return null;
|
|
@@ -220,6 +220,7 @@ pub fn RuntimeCanvasFrames(comptime Runtime: type) type {
|
|
|
220
220
|
|
|
221
221
|
var frame_options = options;
|
|
222
222
|
if (frame_options.surface_size.isEmpty()) frame_options.surface_size = self.views[index].frame.size();
|
|
223
|
+
frame_options.backdrop_blur_sample_extent_multiplier = backdropBlurSampleExtentMultiplier(self.options.platform.name);
|
|
223
224
|
return self.views[index].canvasDisplayList().framePlan(previous, frame_options, storage);
|
|
224
225
|
}
|
|
225
226
|
|
|
@@ -874,6 +875,7 @@ pub fn RuntimeCanvasFrames(comptime Runtime: type) type {
|
|
|
874
875
|
launch_timing.lapOnce("first_plan_begin");
|
|
875
876
|
defer launch_timing.lapOnce("first_plan_done");
|
|
876
877
|
var frame_options = options;
|
|
878
|
+
frame_options.backdrop_blur_sample_extent_multiplier = backdropBlurSampleExtentMultiplier(self.options.platform.name);
|
|
877
879
|
if (frame_options.surface_size.isEmpty()) {
|
|
878
880
|
frame_options.surface_size = if (self.views[index].gpu_size.isEmpty()) self.views[index].frame.size() else self.views[index].gpu_size;
|
|
879
881
|
}
|
|
@@ -1134,6 +1136,7 @@ pub fn RuntimeCanvasFrames(comptime Runtime: type) type {
|
|
|
1134
1136
|
render_plan.commands,
|
|
1135
1137
|
dirty_bounds,
|
|
1136
1138
|
dirty_rects[0..dirty_rect_count],
|
|
1139
|
+
frame_options.backdrop_blur_sample_extent_multiplier,
|
|
1137
1140
|
)) {
|
|
1138
1141
|
// A blur's apron must be reconstructed from the scene as
|
|
1139
1142
|
// it existed before that command. Retained pixels beyond
|
|
@@ -1316,14 +1319,22 @@ fn incrementalCanvasDamageIntersectsBackdropBlur(
|
|
|
1316
1319
|
commands: []const canvas.RenderCommand,
|
|
1317
1320
|
dirty_bounds: ?geometry.RectF,
|
|
1318
1321
|
dirty_rects: []const geometry.RectF,
|
|
1322
|
+
sample_extent_multiplier: f32,
|
|
1319
1323
|
) bool {
|
|
1320
|
-
if (dirty_rects.len == 0) return canvas.
|
|
1324
|
+
if (dirty_rects.len == 0) return canvas.incrementalDamageIntersectsBackdropBlurWithSampleExtent(commands, dirty_bounds, sample_extent_multiplier);
|
|
1321
1325
|
for (dirty_rects) |dirty_rect| {
|
|
1322
|
-
if (canvas.
|
|
1326
|
+
if (canvas.incrementalDamageIntersectsBackdropBlurWithSampleExtent(commands, dirty_rect, sample_extent_multiplier)) return true;
|
|
1323
1327
|
}
|
|
1324
1328
|
return false;
|
|
1325
1329
|
}
|
|
1326
1330
|
|
|
1331
|
+
/// AppKit approximates its Gaussian with three consecutive box filters, so
|
|
1332
|
+
/// one output pixel can depend on the sum of three box radii. Other renderers
|
|
1333
|
+
/// retain the shared one-radius footprint.
|
|
1334
|
+
fn backdropBlurSampleExtentMultiplier(platform_name: []const u8) f32 {
|
|
1335
|
+
return if (std.mem.eql(u8, platform_name, "macos")) 3 else 1;
|
|
1336
|
+
}
|
|
1337
|
+
|
|
1327
1338
|
/// Rework a planned frame's incremental damage for the present's
|
|
1328
1339
|
/// EFFECTIVE scale. Two obligations when the scales differ:
|
|
1329
1340
|
/// - A COARSER presentation scale carries a larger device pixel than
|
|
@@ -438,10 +438,13 @@ test "backdrop blur promotes intersecting damage to a full repaint" {
|
|
|
438
438
|
}
|
|
439
439
|
};
|
|
440
440
|
|
|
441
|
-
const surface = geometry.SizeF.init(
|
|
441
|
+
const surface = geometry.SizeF.init(120, 40);
|
|
442
442
|
const harness = try TestHarness().create(std.testing.allocator, .{});
|
|
443
443
|
defer harness.destroy(std.testing.allocator);
|
|
444
444
|
harness.null_platform.gpu_surfaces = true;
|
|
445
|
+
// Exercise the AppKit-specific three-box sampling footprint while the
|
|
446
|
+
// null host keeps the test deterministic and headless.
|
|
447
|
+
harness.runtime.options.platform.name = "macos";
|
|
445
448
|
harness.runtime.options.pixel_present_retained_baseline = true;
|
|
446
449
|
var app_state: TestApp = .{};
|
|
447
450
|
try harness.start(app_state.app());
|
|
@@ -452,14 +455,14 @@ test "backdrop blur promotes intersecting damage to a full repaint" {
|
|
|
452
455
|
.kind = .gpu_surface,
|
|
453
456
|
.frame = geometry.RectF.init(0, 0, surface.width, surface.height),
|
|
454
457
|
});
|
|
455
|
-
var pixels: [
|
|
456
|
-
var scratch: [
|
|
458
|
+
var pixels: [120 * 40 * 4]u8 = undefined;
|
|
459
|
+
var scratch: [120 * 40 * 4]u8 = undefined;
|
|
457
460
|
const clear = canvas.Color.rgb8(0, 0, 0);
|
|
458
461
|
|
|
459
462
|
const initial = [_]canvas.CanvasCommand{
|
|
460
463
|
.{ .fill_rect = .{ .id = 1, .rect = geometry.RectF.init(4, 4, 4, 4), .fill = .{ .color = canvas.Color.rgb8(255, 0, 0) } } },
|
|
461
464
|
.{ .fill_rect = .{ .id = 2, .rect = geometry.RectF.init(44, 15, 4, 4), .fill = .{ .color = canvas.Color.rgb8(255, 0, 0) } } },
|
|
462
|
-
.{ .fill_rect = .{ .id = 5, .rect = geometry.RectF.init(
|
|
465
|
+
.{ .fill_rect = .{ .id = 5, .rect = geometry.RectF.init(110, 4, 4, 4), .fill = .{ .color = canvas.Color.rgb8(255, 0, 0) } } },
|
|
463
466
|
.{ .push_clip = .{ .id = 3, .rect = geometry.RectF.init(50, 10, 20, 20) } },
|
|
464
467
|
.{ .blur = .{ .id = 4, .rect = geometry.RectF.init(50, 10, 20, 20), .radius = 8 } },
|
|
465
468
|
.pop_clip,
|
|
@@ -471,12 +474,13 @@ test "backdrop blur promotes intersecting damage to a full repaint" {
|
|
|
471
474
|
}, canvasFrameScratchStorage(&harness.runtime), &pixels, &scratch, clear);
|
|
472
475
|
try std.testing.expect(first.full_repaint);
|
|
473
476
|
|
|
474
|
-
// Two damage islands well outside the blur's
|
|
475
|
-
// path even though their bounding
|
|
477
|
+
// Two damage islands well outside the three-pass blur's conservative
|
|
478
|
+
// sampling extent keep the retained path even though their bounding
|
|
479
|
+
// union crosses the blur apron.
|
|
476
480
|
const far_changed = [_]canvas.CanvasCommand{
|
|
477
481
|
.{ .fill_rect = .{ .id = 1, .rect = geometry.RectF.init(4, 4, 4, 4), .fill = .{ .color = canvas.Color.rgb8(0, 255, 0) } } },
|
|
478
482
|
initial[1],
|
|
479
|
-
.{ .fill_rect = .{ .id = 5, .rect = geometry.RectF.init(
|
|
483
|
+
.{ .fill_rect = .{ .id = 5, .rect = geometry.RectF.init(110, 4, 4, 4), .fill = .{ .color = canvas.Color.rgb8(0, 255, 0) } } },
|
|
480
484
|
initial[3],
|
|
481
485
|
initial[4],
|
|
482
486
|
initial[5],
|
|
@@ -490,20 +494,41 @@ test "backdrop blur promotes intersecting damage to a full repaint" {
|
|
|
490
494
|
try std.testing.expect(incremental.dirty_bounds != null);
|
|
491
495
|
try std.testing.expectEqual(@as(usize, 2), incremental.dirtyRects().len);
|
|
492
496
|
|
|
497
|
+
// AppKit's radius-8 Gaussian uses three boxes whose combined support
|
|
498
|
+
// reaches beyond the declared radius. Moving this rect to twenty points
|
|
499
|
+
// past the blur output must therefore replay the whole list; the old
|
|
500
|
+
// radius-only apron left the affected blur pixels stale.
|
|
501
|
+
const gaussian_apron_changed = [_]canvas.CanvasCommand{
|
|
502
|
+
far_changed[0],
|
|
503
|
+
far_changed[1],
|
|
504
|
+
.{ .fill_rect = .{ .id = 5, .rect = geometry.RectF.init(90, 4, 4, 4), .fill = .{ .color = canvas.Color.rgb8(0, 0, 255) } } },
|
|
505
|
+
initial[3],
|
|
506
|
+
initial[4],
|
|
507
|
+
initial[5],
|
|
508
|
+
};
|
|
509
|
+
_ = try harness.runtime.setCanvasDisplayList(1, "canvas", .{ .commands = &gaussian_apron_changed });
|
|
510
|
+
const gaussian_promoted = try harness.runtime.presentNextCanvasFramePixels(1, "canvas", .{
|
|
511
|
+
.frame_index = 3,
|
|
512
|
+
.surface_size = surface,
|
|
513
|
+
}, canvasFrameScratchStorage(&harness.runtime), &pixels, &scratch, clear);
|
|
514
|
+
try std.testing.expect(gaussian_promoted.full_repaint);
|
|
515
|
+
try std.testing.expectEqual(@as(usize, 0), gaussian_promoted.changes.len);
|
|
516
|
+
try std.testing.expectEqualDeep(geometry.RectF.init(0, 0, surface.width, surface.height), gaussian_promoted.dirty_bounds.?);
|
|
517
|
+
|
|
493
518
|
// This changed rect stops two points before the blur output, but it
|
|
494
519
|
// lies inside the radius-8 sampling apron. A scissored replay would
|
|
495
520
|
// sample the prior composited frame outside its dirty boundary.
|
|
496
521
|
const apron_changed = [_]canvas.CanvasCommand{
|
|
497
|
-
|
|
522
|
+
gaussian_apron_changed[0],
|
|
498
523
|
.{ .fill_rect = .{ .id = 2, .rect = geometry.RectF.init(44, 15, 4, 4), .fill = .{ .color = canvas.Color.rgb8(0, 0, 255) } } },
|
|
499
|
-
|
|
524
|
+
gaussian_apron_changed[2],
|
|
500
525
|
initial[3],
|
|
501
526
|
initial[4],
|
|
502
527
|
initial[5],
|
|
503
528
|
};
|
|
504
529
|
_ = try harness.runtime.setCanvasDisplayList(1, "canvas", .{ .commands = &apron_changed });
|
|
505
530
|
const promoted = try harness.runtime.presentNextCanvasFramePixels(1, "canvas", .{
|
|
506
|
-
.frame_index =
|
|
531
|
+
.frame_index = 4,
|
|
507
532
|
.surface_size = surface,
|
|
508
533
|
}, canvasFrameScratchStorage(&harness.runtime), &pixels, &scratch, clear);
|
|
509
534
|
try std.testing.expect(promoted.full_repaint);
|
|
@@ -31,6 +31,9 @@ const PickerModel = struct {
|
|
|
31
31
|
// issue/file browsers draw one).
|
|
32
32
|
switcher_open: bool = false,
|
|
33
33
|
switcher_dismissals: u32 = 0,
|
|
34
|
+
actions_open: bool = false,
|
|
35
|
+
action: u32 = 99,
|
|
36
|
+
actions: u32 = 0,
|
|
34
37
|
};
|
|
35
38
|
|
|
36
39
|
const PickerMsg = union(enum) {
|
|
@@ -41,6 +44,9 @@ const PickerMsg = union(enum) {
|
|
|
41
44
|
crumb_press,
|
|
42
45
|
toggle_switcher,
|
|
43
46
|
close_switcher,
|
|
47
|
+
toggle_actions,
|
|
48
|
+
close_actions,
|
|
49
|
+
action: u32,
|
|
44
50
|
};
|
|
45
51
|
|
|
46
52
|
const PickerApp = ui_app_model.UiApp(PickerModel, PickerMsg);
|
|
@@ -67,6 +73,13 @@ fn pickerUpdate(model: *PickerModel, msg: PickerMsg) void {
|
|
|
67
73
|
model.switcher_open = false;
|
|
68
74
|
model.switcher_dismissals += 1;
|
|
69
75
|
},
|
|
76
|
+
.toggle_actions => model.actions_open = !model.actions_open,
|
|
77
|
+
.close_actions => model.actions_open = false,
|
|
78
|
+
.action => |index| {
|
|
79
|
+
model.action = index;
|
|
80
|
+
model.actions += 1;
|
|
81
|
+
model.actions_open = false;
|
|
82
|
+
},
|
|
70
83
|
}
|
|
71
84
|
}
|
|
72
85
|
|
|
@@ -86,6 +99,29 @@ fn pickerView(ui: *PickerApp.Ui, model: *const PickerModel) PickerApp.Ui.Node {
|
|
|
86
99
|
}),
|
|
87
100
|
}) else ui.stack(.{ .height = 28 }, .{trigger});
|
|
88
101
|
|
|
102
|
+
// A menu button uses the same anchored ownership shape as the picker,
|
|
103
|
+
// but remains an ordinary button: dropdown keyboard behavior belongs
|
|
104
|
+
// to the built-in composition rather than an app-authored key handler.
|
|
105
|
+
const actions_trigger = ui.el(.button, .{
|
|
106
|
+
.text = "Actions",
|
|
107
|
+
.width = 160,
|
|
108
|
+
.expanded = model.actions_open,
|
|
109
|
+
.on_press = .toggle_actions,
|
|
110
|
+
}, .{});
|
|
111
|
+
const actions = if (model.actions_open) ui.stack(.{ .height = 28 }, .{
|
|
112
|
+
actions_trigger,
|
|
113
|
+
ui.el(.dropdown_menu, .{
|
|
114
|
+
.anchor = .below,
|
|
115
|
+
.anchor_alignment = .stretch,
|
|
116
|
+
.width = 160,
|
|
117
|
+
.height = 90,
|
|
118
|
+
.on_dismiss = .close_actions,
|
|
119
|
+
}, .{
|
|
120
|
+
ui.el(.menu_item, .{ .key = .{ .int = 20 }, .text = "Duplicate", .height = 26, .on_press = PickerMsg{ .action = 0 } }, .{}),
|
|
121
|
+
ui.el(.menu_item, .{ .key = .{ .int = 21 }, .text = "Rename", .height = 26, .on_press = PickerMsg{ .action = 1 } }, .{}),
|
|
122
|
+
}),
|
|
123
|
+
}) else ui.stack(.{ .height = 28 }, .{actions_trigger});
|
|
124
|
+
|
|
89
125
|
// A plain-text trigger: pressable (the handler makes it a hit
|
|
90
126
|
// target) but NOT focusable — clicking it clears widget focus, so
|
|
91
127
|
// its menu floats with nothing focused.
|
|
@@ -104,6 +140,7 @@ fn pickerView(ui: *PickerApp.Ui, model: *const PickerModel) PickerApp.Ui.Node {
|
|
|
104
140
|
|
|
105
141
|
return ui.column(.{ .gap = 8, .padding = 12 }, .{
|
|
106
142
|
picker,
|
|
143
|
+
actions,
|
|
107
144
|
switcher,
|
|
108
145
|
ui.button(.{ .on_press = .crumb_press, .on_hold = .crumb_hold }, "Crumb"),
|
|
109
146
|
ui.text(.{}, ui.fmt("picked {d}", .{model.picked})),
|
|
@@ -407,6 +444,52 @@ test "anchored picker: the open-select keymap opens, walks, commits, and returns
|
|
|
407
444
|
try std.testing.expectEqual(trigger_id, fixture.harness.runtime.views[0].canvas_widget_focused_id);
|
|
408
445
|
}
|
|
409
446
|
|
|
447
|
+
test "anchored dropdown menu: button arrows walk, commit, and return focus" {
|
|
448
|
+
const fixture = try Fixture.create();
|
|
449
|
+
defer fixture.destroy();
|
|
450
|
+
|
|
451
|
+
const trigger_id = fixture.widgetIdByText(.button, "Actions").?;
|
|
452
|
+
try fixture.clickWidget(trigger_id);
|
|
453
|
+
try std.testing.expect(fixture.app_state.model.actions_open);
|
|
454
|
+
try std.testing.expectEqual(trigger_id, fixture.harness.runtime.views[0].canvas_widget_focused_id);
|
|
455
|
+
|
|
456
|
+
const duplicate_id = fixture.widgetIdByText(.menu_item, "Duplicate").?;
|
|
457
|
+
const rename_id = fixture.widgetIdByText(.menu_item, "Rename").?;
|
|
458
|
+
try fixture.key("arrowdown");
|
|
459
|
+
try std.testing.expectEqual(duplicate_id, fixture.harness.runtime.views[0].canvas_widget_focused_id);
|
|
460
|
+
try std.testing.expectEqual(@as(canvas.ObjectId, 0), fixture.harness.runtime.views[0].canvas_widget_focus_visible_id);
|
|
461
|
+
|
|
462
|
+
// Pointer entry is deliberately quiet, but a menu still needs a
|
|
463
|
+
// visible active-row affordance when arrows move into it. Logical
|
|
464
|
+
// focus paints the row wash; focus-visible remains empty, so no
|
|
465
|
+
// traversal outline flashes on the menu item.
|
|
466
|
+
const display_list = try fixture.harness.runtime.canvasDisplayList(1, canvas_label);
|
|
467
|
+
var duplicate_wash = false;
|
|
468
|
+
var duplicate_outline = false;
|
|
469
|
+
for (display_list.commands) |command| switch (command) {
|
|
470
|
+
.fill_rounded_rect => |fill| {
|
|
471
|
+
if (fill.id == partId(duplicate_id, 1)) duplicate_wash = true;
|
|
472
|
+
},
|
|
473
|
+
.stroke_rect => |stroke| {
|
|
474
|
+
if (stroke.id == partId(duplicate_id, 2)) duplicate_outline = true;
|
|
475
|
+
},
|
|
476
|
+
else => {},
|
|
477
|
+
};
|
|
478
|
+
try std.testing.expect(duplicate_wash);
|
|
479
|
+
try std.testing.expect(!duplicate_outline);
|
|
480
|
+
|
|
481
|
+
try fixture.key("arrowdown");
|
|
482
|
+
try std.testing.expectEqual(rename_id, fixture.harness.runtime.views[0].canvas_widget_focused_id);
|
|
483
|
+
try fixture.key("arrowup");
|
|
484
|
+
try std.testing.expectEqual(duplicate_id, fixture.harness.runtime.views[0].canvas_widget_focused_id);
|
|
485
|
+
|
|
486
|
+
try fixture.key("enter");
|
|
487
|
+
try std.testing.expectEqual(@as(u32, 0), fixture.app_state.model.action);
|
|
488
|
+
try std.testing.expectEqual(@as(u32, 1), fixture.app_state.model.actions);
|
|
489
|
+
try std.testing.expect(!fixture.app_state.model.actions_open);
|
|
490
|
+
try std.testing.expectEqual(trigger_id, fixture.harness.runtime.views[0].canvas_widget_focused_id);
|
|
491
|
+
}
|
|
492
|
+
|
|
410
493
|
test "anchored picker: arrows enter at the marked row and escape returns focus to the trigger" {
|
|
411
494
|
const fixture = try Fixture.create();
|
|
412
495
|
defer fixture.destroy();
|