@native-sdk/cli 0.9.0 → 0.9.1
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 +331 -24
- package/build.zig +179 -11
- package/native-sdk.d.ts +8 -0
- package/package.json +10 -10
- package/packages/core/compile-surface/core.ts +70 -1
- package/packages/core/package-lock.json +11 -11
- package/packages/core/package.json +2 -2
- package/packages/core/scripts/merge_static_archives.mjs +78 -0
- package/packages/core/scripts/run_external_core_compiler.mjs +52 -7
- package/packages/core/scripts/run_external_service_compiler.mjs +53 -13
- package/packages/core/scripts/stage_external_services.mjs +1 -1
- package/packages/core/sdk/core.d.ts +75 -0
- package/packages/core/sdk/core.ts +167 -12
- package/packages/core/sdk/events.d.ts +53 -0
- package/packages/core/sdk/events.ts +78 -7
- package/packages/core/src/checker.ts +470 -2
- package/packages/core/src/cli.ts +13 -0
- package/packages/core/src/contract.ts +3 -1
- package/packages/core/src/devhost.ts +30 -1
- package/packages/core/src/devhost_journal.mjs +10 -8
- package/packages/core/src/diagnostics.ts +99 -8
- package/packages/core/src/frontend.ts +6 -0
- package/packages/core/src/infer.ts +24 -0
- package/skill-data/automation/SKILL.md +1 -1
- package/skill-data/native-ui/SKILL.md +11 -5
- package/skill-data/ts-core/SKILL.md +53 -20
- package/skill-data/ts-services/SKILL.md +4 -4
- package/skill-data/ts-services/references/service-surface.md +2 -1
- package/skill-data/zig/SKILL.md +1 -1
- package/src/app_runner/root.zig +29 -0
- package/src/app_runner/ts_core_main.zig +5 -0
- package/src/app_runner/ts_core_mobile.zig +241 -0
- package/src/automation/protocol.zig +5 -1
- package/src/automation/snapshot.zig +8 -6
- package/src/embed/app_exports.zig +1 -0
- package/src/embed/root.zig +1 -0
- package/src/embed/tests.zig +28 -0
- package/src/embed/ui_host.zig +68 -2
- package/src/platform/linux/cef_host.cpp +7 -1
- package/src/platform/linux/gtk_host.c +200 -5
- package/src/platform/linux/gtk_host.h +2 -1
- package/src/platform/linux/root.zig +69 -4
- package/src/platform/macos/appkit_host.h +11 -7
- package/src/platform/macos/appkit_host.m +210 -88
- package/src/platform/macos/cef_host.mm +210 -88
- package/src/platform/macos/root.zig +77 -30
- package/src/platform/null_platform.zig +234 -51
- package/src/platform/null_platform_tests.zig +39 -0
- package/src/platform/root.zig +10 -0
- package/src/platform/types.zig +105 -16
- package/src/platform/windows/root.zig +20 -6
- package/src/platform/windows/webview2_host.cpp +41 -5
- package/src/root.zig +7 -0
- package/src/runtime/api.zig +8 -0
- package/src/runtime/automation_commands.zig +35 -2
- package/src/runtime/automation_snapshot.zig +32 -24
- package/src/runtime/bridge_permission_tests.zig +35 -1
- package/src/runtime/bridge_responses.zig +1 -1
- package/src/runtime/builtin_bridge.zig +11 -1
- package/src/runtime/core.zig +12 -6
- package/src/runtime/effects.zig +1323 -35
- package/src/runtime/effects_file_tests.zig +587 -0
- package/src/runtime/effects_notification_tests.zig +11 -0
- package/src/runtime/file_access.zig +400 -0
- package/src/runtime/file_effect_crash_helper.zig +28 -0
- package/src/runtime/file_effect_crash_tests.zig +37 -0
- package/src/runtime/flow.zig +21 -9
- package/src/runtime/native_command_event_tests.zig +44 -2
- package/src/runtime/pty.zig +5 -2
- package/src/runtime/root.zig +5 -0
- package/src/runtime/session_blobs.zig +4 -1
- package/src/runtime/session_journal.zig +56 -5
- package/src/runtime/session_record.zig +38 -0
- package/src/runtime/session_replay.zig +97 -7
- package/src/runtime/session_tests.zig +81 -0
- package/src/runtime/state.zig +10 -0
- package/src/runtime/system_services.zig +129 -36
- package/src/runtime/ts_core_host.zig +281 -11
- package/src/runtime/ts_core_host_tests.zig +95 -1
- package/src/runtime/ts_ui_app.zig +461 -8
- package/src/runtime/ui_app.zig +321 -109
- package/src/runtime/ui_app_tests.zig +132 -6
- package/src/runtime/ui_app_window_tests.zig +61 -7
- package/src/runtime/validation.zig +20 -0
- package/src/tooling/templates.zig +28 -0
- package/src/tooling/ts_core.zig +83 -0
- package/tools/corewire/emit.zig +3 -3
- package/tools/corewire/emit_facade.zig +65 -5
- package/tools/corewire/emit_profile.zig +2 -2
- package/tools/corewire/emit_service.zig +2 -2
- package/tools/corewire/service_contract.zig +4 -4
- package/tools/corewire/sidecar.zig +4 -4
|
@@ -43,6 +43,7 @@ const AppKitEventKind = enum(c_int) {
|
|
|
43
43
|
video = 21,
|
|
44
44
|
view_focused = 22,
|
|
45
45
|
tray_command = 23,
|
|
46
|
+
notification_command = 24,
|
|
46
47
|
};
|
|
47
48
|
|
|
48
49
|
const AppKitEvent = extern struct {
|
|
@@ -67,6 +68,7 @@ const AppKitEvent = extern struct {
|
|
|
67
68
|
shortcut_modifiers: u32,
|
|
68
69
|
command_name: [*]const u8,
|
|
69
70
|
command_name_len: usize,
|
|
71
|
+
status_item_id: u32,
|
|
70
72
|
view_label: [*]const u8,
|
|
71
73
|
view_label_len: usize,
|
|
72
74
|
key_text: [*]const u8,
|
|
@@ -246,7 +248,7 @@ extern fn native_sdk_appkit_decode_image(bytes: [*]const u8, bytes_len: usize, p
|
|
|
246
248
|
extern fn native_sdk_appkit_clipboard_write(host: *AppKitHost, text: [*]const u8, text_len: usize) void;
|
|
247
249
|
extern fn native_sdk_appkit_clipboard_read_data(host: *AppKitHost, mime_type: [*]const u8, mime_type_len: usize, buffer: [*]u8, buffer_len: usize) usize;
|
|
248
250
|
extern fn native_sdk_appkit_clipboard_write_data(host: *AppKitHost, mime_type: [*]const u8, mime_type_len: usize, bytes: [*]const u8, bytes_len: usize) c_int;
|
|
249
|
-
extern fn native_sdk_appkit_show_notification(host: *AppKitHost, title: [*]const u8, title_len: usize, subtitle: [*]const u8, subtitle_len: usize, body: [*]const u8, body_len: usize) c_int;
|
|
251
|
+
extern fn native_sdk_appkit_show_notification(host: *AppKitHost, title: [*]const u8, title_len: usize, subtitle: [*]const u8, subtitle_len: usize, body: [*]const u8, body_len: usize, notification_id: [*]const u8, notification_id_len: usize, action_label: [*]const u8, action_label_len: usize, action_command: [*]const u8, action_command_len: usize) c_int;
|
|
250
252
|
extern fn native_sdk_appkit_open_external_url(host: *AppKitHost, url: [*]const u8, url_len: usize) c_int;
|
|
251
253
|
extern fn native_sdk_appkit_reveal_path(host: *AppKitHost, path: [*]const u8, path_len: usize) c_int;
|
|
252
254
|
extern fn native_sdk_appkit_add_recent_document(host: *AppKitHost, path: [*]const u8, path_len: usize) c_int;
|
|
@@ -399,16 +401,17 @@ const widget_action_drag: u32 = 1 << 8;
|
|
|
399
401
|
const widget_action_drop_files: u32 = 1 << 9;
|
|
400
402
|
const widget_action_dismiss: u32 = 1 << 10;
|
|
401
403
|
|
|
402
|
-
const AppKitTrayCallback = *const fn (context: ?*anyopaque, item_id: u32) callconv(.c) void;
|
|
404
|
+
const AppKitTrayCallback = *const fn (context: ?*anyopaque, status_item_id: u32, item_id: u32) callconv(.c) void;
|
|
403
405
|
|
|
404
406
|
extern fn native_sdk_appkit_show_open_dialog(host: *AppKitHost, opts: *const AppKitOpenDialogOpts, buffer: [*]u8, buffer_len: usize) AppKitOpenDialogResult;
|
|
405
407
|
extern fn native_sdk_appkit_show_save_dialog(host: *AppKitHost, opts: *const AppKitSaveDialogOpts, buffer: [*]u8, buffer_len: usize) usize;
|
|
406
408
|
extern fn native_sdk_appkit_show_message_dialog(host: *AppKitHost, opts: *const AppKitMessageDialogOpts) c_int;
|
|
407
|
-
extern fn native_sdk_appkit_create_tray(host: *AppKitHost, icon_path: [*]const u8, icon_path_len: usize, title: [*]const u8, title_len: usize, tooltip: [*]const u8, tooltip_len: usize, width: f64, tone: c_int, icon_opacity: f64, monospaced: c_int, activation_command: [*]const u8, activation_command_len: usize, alternate_activation_command: [*]const u8, alternate_activation_command_len: usize, open_command: [*]const u8, open_command_len: usize) void;
|
|
408
|
-
extern fn
|
|
409
|
-
extern fn
|
|
410
|
-
extern fn
|
|
411
|
-
extern fn
|
|
409
|
+
extern fn native_sdk_appkit_create_tray(host: *AppKitHost, status_item_id: u32, icon_path: [*]const u8, icon_path_len: usize, title: [*]const u8, title_len: usize, tooltip: [*]const u8, tooltip_len: usize, visible: c_int, width: f64, tone: c_int, icon_opacity: f64, monospaced: c_int, activation_command: [*]const u8, activation_command_len: usize, alternate_activation_command: [*]const u8, alternate_activation_command_len: usize, open_command: [*]const u8, open_command_len: usize) void;
|
|
410
|
+
extern fn native_sdk_appkit_update_tray_shell(host: *AppKitHost, status_item_id: u32, icon_path: [*]const u8, icon_path_len: usize, tooltip: [*]const u8, tooltip_len: usize, visible: c_int, activation_command: [*]const u8, activation_command_len: usize, alternate_activation_command: [*]const u8, alternate_activation_command_len: usize, open_command: [*]const u8, open_command_len: usize) void;
|
|
411
|
+
extern fn native_sdk_appkit_update_tray_menu(host: *AppKitHost, status_item_id: u32, item_ids: [*]const u32, labels: [*]const [*]const u8, label_lens: [*]const usize, separators: [*]const c_int, enabled_flags: [*]const c_int, details: [*]const [*]const u8, detail_lens: [*]const usize, roles: [*]const c_int, keys: [*]const [*]const u8, key_lens: [*]const usize, modifiers: [*]const u32, count: usize) void;
|
|
412
|
+
extern fn native_sdk_appkit_update_tray_title(host: *AppKitHost, status_item_id: u32, title: [*]const u8, title_len: usize) void;
|
|
413
|
+
extern fn native_sdk_appkit_update_tray_presentation(host: *AppKitHost, status_item_id: u32, title: [*]const u8, title_len: usize, width: f64, tone: c_int, icon_opacity: f64, monospaced: c_int) void;
|
|
414
|
+
extern fn native_sdk_appkit_remove_tray(host: *AppKitHost, status_item_id: u32) void;
|
|
412
415
|
extern fn native_sdk_appkit_set_tray_callback(host: *AppKitHost, callback: AppKitTrayCallback, context: ?*anyopaque) void;
|
|
413
416
|
|
|
414
417
|
/// Whether a Dock icon path names a raw image source (.png/.svg) that
|
|
@@ -751,6 +754,7 @@ pub const MacPlatform = struct {
|
|
|
751
754
|
.add_recent_document_fn = addRecentDocument,
|
|
752
755
|
.clear_recent_documents_fn = clearRecentDocuments,
|
|
753
756
|
.create_tray_fn = createTray,
|
|
757
|
+
.update_tray_shell_fn = updateTrayShell,
|
|
754
758
|
.update_tray_menu_fn = updateTrayMenu,
|
|
755
759
|
.update_tray_title_fn = updateTrayTitle,
|
|
756
760
|
.update_tray_presentation_fn = updateTrayPresentation,
|
|
@@ -970,6 +974,11 @@ fn appkitCallback(context: ?*anyopaque, event: *const AppKitEvent) callconv(.c)
|
|
|
970
974
|
.tray_command => state.emit(.{ .tray_command = .{
|
|
971
975
|
.name = event.command_name[0..event.command_name_len],
|
|
972
976
|
.window_id = event.window_id,
|
|
977
|
+
.status_item_id = event.status_item_id,
|
|
978
|
+
} }),
|
|
979
|
+
.notification_command => state.emit(.{ .notification_command = .{
|
|
980
|
+
.name = event.command_name[0..event.command_name_len],
|
|
981
|
+
.window_id = event.window_id,
|
|
973
982
|
} }),
|
|
974
983
|
.timer => state.emit(.{ .timer = .{
|
|
975
984
|
.id = event.timer_id,
|
|
@@ -2109,6 +2118,12 @@ fn showNotification(context: ?*anyopaque, options: platform_mod.NotificationOpti
|
|
|
2109
2118
|
options.subtitle.len,
|
|
2110
2119
|
options.body.ptr,
|
|
2111
2120
|
options.body.len,
|
|
2121
|
+
options.id.ptr,
|
|
2122
|
+
options.id.len,
|
|
2123
|
+
options.action_label.ptr,
|
|
2124
|
+
options.action_label.len,
|
|
2125
|
+
options.action_command.ptr,
|
|
2126
|
+
options.action_command.len,
|
|
2112
2127
|
) == 0) return error.UnsupportedService;
|
|
2113
2128
|
}
|
|
2114
2129
|
|
|
@@ -2379,6 +2394,31 @@ fn isSupportedNativeViewKind(kind: platform_mod.ViewKind) bool {
|
|
|
2379
2394
|
};
|
|
2380
2395
|
}
|
|
2381
2396
|
|
|
2397
|
+
test "macos notification actions use process-scoped opaque tokens" {
|
|
2398
|
+
for ([_][]const u8{ @embedFile("appkit_host.m"), @embedFile("cef_host.mm") }) |host_source| {
|
|
2399
|
+
try std.testing.expect(std.mem.indexOf(
|
|
2400
|
+
u8,
|
|
2401
|
+
host_source,
|
|
2402
|
+
"NSString *actionToken = [NSUUID UUID].UUIDString;",
|
|
2403
|
+
) != null);
|
|
2404
|
+
try std.testing.expect(std.mem.indexOf(
|
|
2405
|
+
u8,
|
|
2406
|
+
host_source,
|
|
2407
|
+
"notification.userInfo = @{ @\"native-sdk-action-token\": actionToken };",
|
|
2408
|
+
) != null);
|
|
2409
|
+
try std.testing.expect(std.mem.indexOf(
|
|
2410
|
+
u8,
|
|
2411
|
+
host_source,
|
|
2412
|
+
"self.notificationActionCommands[token]",
|
|
2413
|
+
) != null);
|
|
2414
|
+
try std.testing.expect(std.mem.indexOf(
|
|
2415
|
+
u8,
|
|
2416
|
+
host_source,
|
|
2417
|
+
"@\"native-sdk-action-command\"",
|
|
2418
|
+
) == null);
|
|
2419
|
+
}
|
|
2420
|
+
}
|
|
2421
|
+
|
|
2382
2422
|
test "macos supports native container and control kinds" {
|
|
2383
2423
|
try std.testing.expect(isSupportedNativeViewKind(.split));
|
|
2384
2424
|
try std.testing.expect(isSupportedNativeViewKind(.stack));
|
|
@@ -2522,18 +2562,20 @@ fn showMessageDialog(context: ?*anyopaque, options: platform_mod.MessageDialogOp
|
|
|
2522
2562
|
|
|
2523
2563
|
const max_tray_items: usize = 32;
|
|
2524
2564
|
|
|
2525
|
-
fn createTray(context: ?*anyopaque, options: platform_mod.TrayOptions) anyerror!void {
|
|
2565
|
+
fn createTray(context: ?*anyopaque, status_item_id: platform_mod.StatusItemId, options: platform_mod.TrayOptions) anyerror!void {
|
|
2526
2566
|
const self: *MacPlatform = @ptrCast(@alignCast(context.?));
|
|
2527
2567
|
var presentation = options.presentation;
|
|
2528
2568
|
if (presentation.title.len == 0) presentation.title = options.title;
|
|
2529
2569
|
native_sdk_appkit_create_tray(
|
|
2530
2570
|
self.host,
|
|
2571
|
+
status_item_id,
|
|
2531
2572
|
options.icon_path.ptr,
|
|
2532
2573
|
options.icon_path.len,
|
|
2533
2574
|
presentation.title.ptr,
|
|
2534
2575
|
presentation.title.len,
|
|
2535
2576
|
options.tooltip.ptr,
|
|
2536
2577
|
options.tooltip.len,
|
|
2578
|
+
if (options.visible) 1 else 0,
|
|
2537
2579
|
presentation.width,
|
|
2538
2580
|
@intFromEnum(presentation.tone),
|
|
2539
2581
|
presentation.icon_opacity,
|
|
@@ -2546,11 +2588,16 @@ fn createTray(context: ?*anyopaque, options: platform_mod.TrayOptions) anyerror!
|
|
|
2546
2588
|
options.open_command.len,
|
|
2547
2589
|
);
|
|
2548
2590
|
if (options.items.len > 0) {
|
|
2549
|
-
try updateTrayMenu(context, options.items);
|
|
2591
|
+
try updateTrayMenu(context, status_item_id, options.items);
|
|
2550
2592
|
}
|
|
2551
2593
|
}
|
|
2552
2594
|
|
|
2553
|
-
fn
|
|
2595
|
+
fn updateTrayShell(context: ?*anyopaque, status_item_id: platform_mod.StatusItemId, shell: platform_mod.TrayShell) anyerror!void {
|
|
2596
|
+
const self: *MacPlatform = @ptrCast(@alignCast(context.?));
|
|
2597
|
+
native_sdk_appkit_update_tray_shell(self.host, status_item_id, shell.icon_path.ptr, shell.icon_path.len, shell.tooltip.ptr, shell.tooltip.len, if (shell.visible) 1 else 0, shell.activation_command.ptr, shell.activation_command.len, shell.alternate_activation_command.ptr, shell.alternate_activation_command.len, shell.open_command.ptr, shell.open_command.len);
|
|
2598
|
+
}
|
|
2599
|
+
|
|
2600
|
+
fn updateTrayMenu(context: ?*anyopaque, status_item_id: platform_mod.StatusItemId, items: []const platform_mod.TrayMenuItem) anyerror!void {
|
|
2554
2601
|
const self: *MacPlatform = @ptrCast(@alignCast(context.?));
|
|
2555
2602
|
const count = @min(items.len, max_tray_items);
|
|
2556
2603
|
var ids: [max_tray_items]u32 = undefined;
|
|
@@ -2581,27 +2628,27 @@ fn updateTrayMenu(context: ?*anyopaque, items: []const platform_mod.TrayMenuItem
|
|
|
2581
2628
|
(@as(u32, @intFromBool(item.modifiers.option)) << 3) |
|
|
2582
2629
|
(@as(u32, @intFromBool(item.modifiers.shift)) << 4);
|
|
2583
2630
|
}
|
|
2584
|
-
native_sdk_appkit_update_tray_menu(self.host, &ids, &labels, &label_lens, &separators, &enabled_flags, &details, &detail_lens, &roles, &keys, &key_lens, &modifiers, count);
|
|
2631
|
+
native_sdk_appkit_update_tray_menu(self.host, status_item_id, &ids, &labels, &label_lens, &separators, &enabled_flags, &details, &detail_lens, &roles, &keys, &key_lens, &modifiers, count);
|
|
2585
2632
|
}
|
|
2586
2633
|
|
|
2587
|
-
fn updateTrayTitle(context: ?*anyopaque, title: []const u8) anyerror!void {
|
|
2634
|
+
fn updateTrayTitle(context: ?*anyopaque, status_item_id: platform_mod.StatusItemId, title: []const u8) anyerror!void {
|
|
2588
2635
|
const self: *MacPlatform = @ptrCast(@alignCast(context.?));
|
|
2589
|
-
native_sdk_appkit_update_tray_title(self.host, title.ptr, title.len);
|
|
2636
|
+
native_sdk_appkit_update_tray_title(self.host, status_item_id, title.ptr, title.len);
|
|
2590
2637
|
}
|
|
2591
2638
|
|
|
2592
|
-
fn updateTrayPresentation(context: ?*anyopaque, presentation: platform_mod.TrayPresentation) anyerror!void {
|
|
2639
|
+
fn updateTrayPresentation(context: ?*anyopaque, status_item_id: platform_mod.StatusItemId, presentation: platform_mod.TrayPresentation) anyerror!void {
|
|
2593
2640
|
const self: *MacPlatform = @ptrCast(@alignCast(context.?));
|
|
2594
|
-
native_sdk_appkit_update_tray_presentation(self.host, presentation.title.ptr, presentation.title.len, presentation.width, @intFromEnum(presentation.tone), presentation.icon_opacity, if (presentation.monospaced) 1 else 0);
|
|
2641
|
+
native_sdk_appkit_update_tray_presentation(self.host, status_item_id, presentation.title.ptr, presentation.title.len, presentation.width, @intFromEnum(presentation.tone), presentation.icon_opacity, if (presentation.monospaced) 1 else 0);
|
|
2595
2642
|
}
|
|
2596
2643
|
|
|
2597
|
-
fn removeTray(context: ?*anyopaque) anyerror!void {
|
|
2644
|
+
fn removeTray(context: ?*anyopaque, status_item_id: platform_mod.StatusItemId) anyerror!void {
|
|
2598
2645
|
const self: *MacPlatform = @ptrCast(@alignCast(context.?));
|
|
2599
|
-
native_sdk_appkit_remove_tray(self.host);
|
|
2646
|
+
native_sdk_appkit_remove_tray(self.host, status_item_id);
|
|
2600
2647
|
}
|
|
2601
2648
|
|
|
2602
|
-
fn appkitTrayCallback(context: ?*anyopaque, item_id: u32) callconv(.c) void {
|
|
2649
|
+
fn appkitTrayCallback(context: ?*anyopaque, status_item_id: u32, item_id: u32) callconv(.c) void {
|
|
2603
2650
|
const state: *RunState = @ptrCast(@alignCast(context.?));
|
|
2604
|
-
state.emit(.{ .tray_action = item_id });
|
|
2651
|
+
state.emit(.{ .tray_action = .{ .status_item_id = status_item_id, .item_id = item_id } });
|
|
2605
2652
|
}
|
|
2606
2653
|
|
|
2607
2654
|
fn flattenFilters(filters: []const platform_mod.FileFilter, buffer: []u8) []const u8 {
|
|
@@ -2631,7 +2678,7 @@ test "mac status agent rows recognize decorated states and stay actionable" {
|
|
|
2631
2678
|
try std.testing.expect(std.mem.indexOf(u8, host_source, "[state hasPrefix:@\"configured \"]") != null);
|
|
2632
2679
|
try std.testing.expect(std.mem.indexOf(u8, host_source, "[state hasPrefix:@\"warning \"]") != null);
|
|
2633
2680
|
try std.testing.expect(std.mem.indexOf(u8, host_source, "label.textColor = configured ? successColor : warning ? warningColor : NSColor.secondaryLabelColor;") != null);
|
|
2634
|
-
try std.testing.expect(std.mem.indexOf(u8, host_source, "button.tag = itemIds[index];") != null);
|
|
2681
|
+
try std.testing.expect(std.mem.indexOf(u8, host_source, "button.tag = (NSInteger)(((uint64_t)statusItemId << 32) | itemIds[index]);") != null);
|
|
2635
2682
|
try std.testing.expect(std.mem.indexOf(u8, host_source, "button.enabled = enabled[index].boolValue;") != null);
|
|
2636
2683
|
try std.testing.expect(std.mem.indexOf(u8, host_source, "button.keyEquivalent = NativeSdkMenuKeyEquivalent(key);") != null);
|
|
2637
2684
|
try std.testing.expect(std.mem.indexOf(u8, host_source, "button.keyEquivalentModifierMask = NativeSdkMenuModifierFlags(modifiers[index].unsignedIntValue);") != null);
|
|
@@ -2640,22 +2687,22 @@ test "mac status agent rows recognize decorated states and stay actionable" {
|
|
|
2640
2687
|
|
|
2641
2688
|
test "mac title-only tray updates preserve the applied presentation" {
|
|
2642
2689
|
for ([_][]const u8{ @embedFile("appkit_host.m"), @embedFile("cef_host.mm") }) |host_source| {
|
|
2643
|
-
try std.testing.expect(std.mem.indexOf(u8, host_source, "
|
|
2644
|
-
try std.testing.expect(std.mem.indexOf(u8, host_source, "
|
|
2645
|
-
try std.testing.expect(std.mem.indexOf(u8, host_source, "
|
|
2646
|
-
try std.testing.expect(std.mem.indexOf(u8, host_source, "
|
|
2690
|
+
try std.testing.expect(std.mem.indexOf(u8, host_source, "entry.presentationWidth = width;") != null);
|
|
2691
|
+
try std.testing.expect(std.mem.indexOf(u8, host_source, "entry.presentationTone = tone;") != null);
|
|
2692
|
+
try std.testing.expect(std.mem.indexOf(u8, host_source, "entry.presentationIconOpacity = iconOpacity;") != null);
|
|
2693
|
+
try std.testing.expect(std.mem.indexOf(u8, host_source, "entry.presentationMonospaced = monospaced;") != null);
|
|
2647
2694
|
const update_at = std.mem.indexOf(u8, host_source, "void native_sdk_appkit_update_tray_title(") orelse return error.TestExpectedEqual;
|
|
2648
2695
|
const update_tail = host_source[update_at..];
|
|
2649
|
-
try std.testing.expect(std.mem.indexOf(u8, update_tail, "
|
|
2650
|
-
try std.testing.expect(std.mem.indexOf(u8, update_tail, "
|
|
2651
|
-
try std.testing.expect(std.mem.indexOf(u8, update_tail, "
|
|
2652
|
-
try std.testing.expect(std.mem.indexOf(u8, update_tail, "
|
|
2696
|
+
try std.testing.expect(std.mem.indexOf(u8, update_tail, "entry.presentationWidth,") != null);
|
|
2697
|
+
try std.testing.expect(std.mem.indexOf(u8, update_tail, "entry.presentationTone,") != null);
|
|
2698
|
+
try std.testing.expect(std.mem.indexOf(u8, update_tail, "entry.presentationIconOpacity,") != null);
|
|
2699
|
+
try std.testing.expect(std.mem.indexOf(u8, update_tail, "entry.presentationMonospaced") != null);
|
|
2653
2700
|
}
|
|
2654
2701
|
}
|
|
2655
2702
|
|
|
2656
2703
|
test "mac status lifecycle hooks emit tray commands" {
|
|
2657
2704
|
for ([_][]const u8{ @embedFile("appkit_host.m"), @embedFile("cef_host.mm") }) |host_source| {
|
|
2658
|
-
const emit_at = std.mem.indexOf(u8, host_source, "- (void)emitStatusCommand:(NSString *)command {") orelse return error.TestExpectedEqual;
|
|
2705
|
+
const emit_at = std.mem.indexOf(u8, host_source, "- (void)emitStatusCommand:(NSString *)command statusItemId:(uint32_t)statusItemId {") orelse return error.TestExpectedEqual;
|
|
2659
2706
|
const emit_tail = host_source[emit_at..];
|
|
2660
2707
|
const emit_end = std.mem.indexOf(u8, emit_tail, "- (void)statusItemActivated:") orelse return error.TestExpectedEqual;
|
|
2661
2708
|
const emit_source = emit_tail[0..emit_end];
|
|
@@ -2666,7 +2713,7 @@ test "mac status lifecycle hooks emit tray commands" {
|
|
|
2666
2713
|
|
|
2667
2714
|
test "mac status menu updates preserve the menu being opened" {
|
|
2668
2715
|
for ([_][]const u8{ @embedFile("appkit_host.m"), @embedFile("cef_host.mm") }) |host_source| {
|
|
2669
|
-
try std.testing.expect(std.mem.indexOf(u8, host_source, "NSMenu *menu =
|
|
2716
|
+
try std.testing.expect(std.mem.indexOf(u8, host_source, "NSMenu *menu = entry.menu;") != null);
|
|
2670
2717
|
try std.testing.expect(std.mem.indexOf(u8, host_source, "[menu removeAllItems];") != null);
|
|
2671
2718
|
}
|
|
2672
2719
|
}
|