@native-sdk/cli 0.8.3 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/app.zig +905 -61
- package/build.zig +674 -373
- package/build.zig.zon +1 -0
- package/native-sdk.d.ts +6 -0
- package/package.json +12 -11
- package/packages/core/compile-surface/core.ts +455 -3
- package/packages/core/package-lock.json +11 -11
- package/packages/core/package.json +2 -2
- package/packages/core/scripts/compiler_typecheck.mjs +116 -15
- package/packages/core/scripts/gen_service_surface.mjs +268 -0
- package/packages/core/scripts/npm_static_spike.mjs +64 -0
- package/packages/core/scripts/run_external_core_compiler.mjs +77 -6
- package/packages/core/scripts/run_external_service_compiler.mjs +240 -0
- package/packages/core/scripts/stage_external_core.mjs +9 -1
- package/packages/core/scripts/stage_external_services.mjs +172 -0
- package/packages/core/scripts/surface_manifest_diff.mjs +253 -0
- package/packages/core/scripts/vendor_service_packages.mjs +189 -0
- package/packages/core/sdk/core.d.ts +214 -2
- package/packages/core/sdk/core.ts +715 -42
- package/packages/core/sdk/events.d.ts +50 -0
- package/packages/core/sdk/events.ts +75 -0
- package/packages/core/src/checker.ts +528 -15
- package/packages/core/src/cli.ts +143 -3
- package/packages/core/src/contract.ts +26 -5
- package/packages/core/src/devhost.ts +1849 -18
- package/packages/core/src/devhost_journal.mjs +181 -0
- package/packages/core/src/devhost_resolver.mjs +17 -1
- package/packages/core/src/devhost_service_worker.mjs +90 -0
- package/packages/core/src/diagnostics.ts +84 -18
- package/packages/core/src/frontend.ts +204 -34
- package/packages/core/src/modules.ts +129 -80
- package/packages/core/src/service_contract.ts +597 -0
- package/packages/core/src/sqlite_cli.ts +93 -0
- package/packages/core/src/sqlite_codegen.ts +806 -0
- package/packages/core/src/sqlite_runtime_policy.ts +364 -0
- package/packages/core/src/typed_ast.ts +36 -8
- package/skill-data/core/SKILL.md +4 -2
- package/skill-data/core/references/project-anatomy.md +3 -2
- package/skill-data/core/references/web-engines-packaging-debugging.md +3 -1
- package/skill-data/native-ui/SKILL.md +55 -8
- package/skill-data/ts-core/SKILL.md +92 -40
- package/skill-data/ts-services/SKILL.md +126 -0
- package/skill-data/ts-services/references/service-surface.md +603 -0
- package/skill-data/zig/SKILL.md +1 -1
- package/skills/native-sdk/SKILL.md +1 -1
- package/src/app_runner/no_migrations.zig +3 -0
- package/src/app_runner/no_services.zig +20 -0
- package/src/app_runner/root.zig +104 -4
- package/src/app_runner/ts_core_main.zig +268 -4
- package/src/automation/snapshot.zig +23 -5
- package/src/embed/app_exports.zig +11 -1
- package/src/embed/c_api.zig +48 -2
- package/src/embed/conversions.zig +4 -5
- package/src/embed/host.zig +115 -1
- package/src/embed/root.zig +7 -0
- package/src/embed/tests.zig +213 -0
- package/src/embed/types.zig +51 -0
- package/src/embed/ui_host.zig +121 -5
- package/src/platform/android/NativeSdkActivity.java +131 -0
- package/src/platform/android/android_host.c +182 -1
- package/src/platform/android/native_sdk_app.h +17 -0
- package/src/platform/ios/native_sdk_app.h +17 -0
- package/src/platform/ios/uikit_host.m +115 -0
- package/src/platform/linux/cef_host.cpp +1 -1
- package/src/platform/linux/gtk_host.c +89 -17
- package/src/platform/linux/gtk_host.h +3 -0
- package/src/platform/linux/root.zig +41 -18
- package/src/platform/macos/appkit_host.h +26 -3
- package/src/platform/macos/appkit_host.m +1051 -129
- package/src/platform/macos/capture_info_plist.c +25 -0
- package/src/platform/macos/cef_host.mm +270 -36
- package/src/platform/macos/root.zig +312 -34
- package/src/platform/null_platform.zig +281 -19
- package/src/platform/null_platform_tests.zig +74 -0
- package/src/platform/root.zig +16 -0
- package/src/platform/types.zig +279 -15
- package/src/platform/windows/root.zig +243 -21
- package/src/platform/windows/webview2_host.cpp +464 -46
- package/src/primitives/app_manifest/comptime_scene.zig +2 -0
- package/src/primitives/app_manifest/root.zig +4 -0
- package/src/primitives/app_manifest/tests.zig +3 -0
- package/src/primitives/app_manifest/types.zig +34 -0
- package/src/primitives/app_manifest/validation.zig +19 -1
- 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 +56 -0
- package/src/runtime/api.zig +11 -0
- package/src/runtime/automation_snapshot.zig +4 -0
- package/src/runtime/automation_widget_dispatch.zig +1 -0
- package/src/runtime/bridge_payload.zig +2 -0
- package/src/runtime/bridge_permission_tests.zig +23 -2
- package/src/runtime/bridge_responses.zig +3 -1
- package/src/runtime/canvas_frame.zig +31 -13
- package/src/runtime/canvas_frame_animation_tests.zig +4 -0
- 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/clock.zig +13 -1
- package/src/runtime/core.zig +133 -1
- package/src/runtime/credentials_store.zig +115 -0
- package/src/runtime/effects.zig +2568 -75
- package/src/runtime/effects_audio_capture_tests.zig +251 -0
- package/src/runtime/effects_credentials_tests.zig +332 -0
- package/src/runtime/effects_host_tests.zig +208 -1
- package/src/runtime/effects_relational_tests.zig +314 -0
- package/src/runtime/effects_store_tests.zig +211 -0
- package/src/runtime/flow.zig +14 -1
- package/src/runtime/gpu_surface_events.zig +6 -1
- package/src/runtime/native_command_event_tests.zig +42 -0
- package/src/runtime/persist_store.zig +666 -0
- package/src/runtime/record_store.zig +788 -0
- package/src/runtime/relational_store.zig +854 -0
- package/src/runtime/root.zig +52 -0
- package/src/runtime/runtime_event_tests.zig +70 -0
- package/src/runtime/service_host.zig +711 -0
- package/src/runtime/service_pool.zig +1314 -0
- package/src/runtime/session_blobs.zig +1 -1
- package/src/runtime/session_journal.zig +102 -0
- package/src/runtime/session_record.zig +177 -0
- package/src/runtime/session_replay.zig +109 -4
- package/src/runtime/shell_layout.zig +1 -0
- package/src/runtime/shell_layout_tests.zig +120 -0
- package/src/runtime/sqlite_engine.zig +474 -0
- package/src/runtime/state.zig +6 -0
- package/src/runtime/system_services.zig +49 -10
- package/src/runtime/tests.zig +5 -0
- package/src/runtime/ts_core_host.zig +1189 -118
- package/src/runtime/ts_core_host_tests.zig +638 -11
- package/src/runtime/ts_ui_app.zig +537 -1
- package/src/runtime/ui_app.zig +160 -19
- package/src/runtime/ui_app_tests.zig +203 -5
- package/src/runtime/validation.zig +22 -0
- package/src/runtime/view.zig +11 -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/runtime/window_storage.zig +1 -0
- package/src/runtime/window_view_runtime.zig +2 -3
- package/src/runtime/window_views.zig +19 -0
- package/src/tooling/android.zig +21 -16
- package/src/tooling/db.zig +160 -0
- package/src/tooling/ios.zig +7 -1
- package/src/tooling/manifest.zig +1248 -2
- package/src/tooling/package.zig +953 -6
- package/src/tooling/raw_manifest.zig +65 -0
- package/src/tooling/root.zig +1 -0
- package/src/tooling/templates.zig +216 -4
- package/src/tooling/ts_core.zig +283 -17
- package/src/tooling/verbs.zig +7 -0
- package/third_party/sqlite/README.md +13 -0
- package/third_party/sqlite/sqlite3.c +269649 -0
- package/third_party/sqlite/sqlite3.h +14349 -0
- package/tools/corewire/core_abi.zig +14 -2
- package/tools/corewire/emit.zig +98 -29
- package/tools/corewire/emit_facade.zig +414 -23
- package/tools/corewire/emit_profile.zig +6 -2
- package/tools/corewire/emit_service.zig +924 -0
- package/tools/corewire/main.zig +122 -0
- package/tools/corewire/service_contract.zig +250 -0
- package/tools/corewire/sidecar.zig +26 -15
package/src/platform/root.zig
CHANGED
|
@@ -31,12 +31,14 @@ pub const max_clipboard_data_bytes = types.max_clipboard_data_bytes;
|
|
|
31
31
|
pub const max_credential_service_bytes = types.max_credential_service_bytes;
|
|
32
32
|
pub const max_credential_account_bytes = types.max_credential_account_bytes;
|
|
33
33
|
pub const max_credential_secret_bytes = types.max_credential_secret_bytes;
|
|
34
|
+
pub const max_local_time_text_bytes = types.max_local_time_text_bytes;
|
|
34
35
|
pub const max_tray_items = types.max_tray_items;
|
|
35
36
|
pub const max_tray_icon_path_bytes = types.max_tray_icon_path_bytes;
|
|
36
37
|
pub const max_tray_title_bytes = types.max_tray_title_bytes;
|
|
37
38
|
pub const max_tray_tooltip_bytes = types.max_tray_tooltip_bytes;
|
|
38
39
|
pub const max_tray_item_label_bytes = types.max_tray_item_label_bytes;
|
|
39
40
|
pub const max_tray_item_command_bytes = types.max_tray_item_command_bytes;
|
|
41
|
+
pub const max_tray_item_detail_bytes = types.max_tray_item_detail_bytes;
|
|
40
42
|
pub const max_drop_paths_bytes = types.max_drop_paths_bytes;
|
|
41
43
|
pub const max_drop_paths = types.max_drop_paths;
|
|
42
44
|
pub const max_window_event_name_bytes = types.max_window_event_name_bytes;
|
|
@@ -72,6 +74,7 @@ pub const validateShortcut = types.validateShortcut;
|
|
|
72
74
|
pub const validateMenus = types.validateMenus;
|
|
73
75
|
pub const validateMenuItem = types.validateMenuItem;
|
|
74
76
|
pub const isValidShortcutKey = types.isValidShortcutKey;
|
|
77
|
+
pub const isValidShortcutBinding = types.isValidShortcutBinding;
|
|
75
78
|
pub const WindowRestorePolicy = types.WindowRestorePolicy;
|
|
76
79
|
pub const WindowTitlebarStyle = types.WindowTitlebarStyle;
|
|
77
80
|
pub const WindowChrome = types.WindowChrome;
|
|
@@ -79,6 +82,7 @@ pub const FormFactor = types.FormFactor;
|
|
|
79
82
|
pub const WindowDragRegion = types.WindowDragRegion;
|
|
80
83
|
pub const WindowShowMode = types.WindowShowMode;
|
|
81
84
|
pub const WindowClosePolicy = types.WindowClosePolicy;
|
|
85
|
+
pub const LaunchAtLoginStatus = types.LaunchAtLoginStatus;
|
|
82
86
|
pub const WindowOptions = types.WindowOptions;
|
|
83
87
|
pub const WindowState = types.WindowState;
|
|
84
88
|
pub const WindowInfo = types.WindowInfo;
|
|
@@ -122,17 +126,29 @@ pub const MessageDialogOptions = types.MessageDialogOptions;
|
|
|
122
126
|
pub const NotificationOptions = types.NotificationOptions;
|
|
123
127
|
pub const CredentialKey = types.CredentialKey;
|
|
124
128
|
pub const Credential = types.Credential;
|
|
129
|
+
pub const LocalTimeStyle = types.LocalTimeStyle;
|
|
125
130
|
pub const TrayItemId = types.TrayItemId;
|
|
126
131
|
pub const TrayOptions = types.TrayOptions;
|
|
132
|
+
pub const TrayTone = types.TrayTone;
|
|
133
|
+
pub const TrayPresentation = types.TrayPresentation;
|
|
127
134
|
pub const TrayMenuItem = types.TrayMenuItem;
|
|
135
|
+
pub const TrayItemRole = types.TrayItemRole;
|
|
128
136
|
pub const NativeCommandEvent = types.NativeCommandEvent;
|
|
129
137
|
pub const MenuCommandEvent = types.MenuCommandEvent;
|
|
138
|
+
pub const TrayCommandEvent = types.TrayCommandEvent;
|
|
130
139
|
pub const reserved_timer_id_base = types.reserved_timer_id_base;
|
|
131
140
|
pub const press_hold_timer_id = types.press_hold_timer_id;
|
|
132
141
|
pub const TimerEvent = types.TimerEvent;
|
|
133
142
|
pub const AudioEvent = types.AudioEvent;
|
|
134
143
|
pub const AudioEventKind = types.AudioEventKind;
|
|
135
144
|
pub const AudioLoadResolution = types.AudioLoadResolution;
|
|
145
|
+
pub const AudioCaptureSource = types.AudioCaptureSource;
|
|
146
|
+
pub const AudioCaptureFormat = types.AudioCaptureFormat;
|
|
147
|
+
pub const AudioCaptureEventKind = types.AudioCaptureEventKind;
|
|
148
|
+
pub const AudioCaptureEvent = types.AudioCaptureEvent;
|
|
149
|
+
pub const AudioCapturePushResult = types.AudioCapturePushResult;
|
|
150
|
+
pub const AudioCaptureSink = types.AudioCaptureSink;
|
|
151
|
+
pub const max_audio_capture_pcm_bytes = types.max_audio_capture_pcm_bytes;
|
|
136
152
|
pub const max_audio_path_bytes = types.max_audio_path_bytes;
|
|
137
153
|
pub const audio_spectrum_band_count = types.audio_spectrum_band_count;
|
|
138
154
|
pub const audio_spectrum_floor_db = types.audio_spectrum_floor_db;
|
package/src/platform/types.zig
CHANGED
|
@@ -61,6 +61,8 @@ pub const Error = error{
|
|
|
61
61
|
InvalidCredentialOptions,
|
|
62
62
|
CredentialFieldTooLarge,
|
|
63
63
|
CredentialNotFound,
|
|
64
|
+
CredentialStoreLocked,
|
|
65
|
+
CredentialStoreFailed,
|
|
64
66
|
InvalidTrayOptions,
|
|
65
67
|
TrayFieldTooLarge,
|
|
66
68
|
InvalidAudioOptions,
|
|
@@ -158,6 +160,13 @@ pub const PlatformFeature = enum {
|
|
|
158
160
|
/// keeps emitting; the null platform models the rule through its
|
|
159
161
|
/// windows' modeled occlusion so the suites can pin it.
|
|
160
162
|
audio_spectrum,
|
|
163
|
+
/// Capture from the default microphone as interleaved signed 16-bit
|
|
164
|
+
/// little-endian PCM. The source delivers through `AudioCaptureSink`
|
|
165
|
+
/// from its native audio thread until `audioCaptureStop` returns.
|
|
166
|
+
microphone_capture,
|
|
167
|
+
/// Capture the system output mix (WASAPI loopback on Windows,
|
|
168
|
+
/// ScreenCaptureKit audio on macOS) through the same bounded PCM sink.
|
|
169
|
+
system_audio_capture,
|
|
161
170
|
/// The `close_policy = .hide` window shape: the host can intercept
|
|
162
171
|
/// the user's close affordance, keep the window alive off the
|
|
163
172
|
/// glass, and re-show it later (`show_window_fn`, tray actions, the
|
|
@@ -238,13 +247,18 @@ pub const max_clipboard_mime_type_bytes: usize = 128;
|
|
|
238
247
|
pub const max_clipboard_data_bytes: usize = 65536;
|
|
239
248
|
pub const max_credential_service_bytes: usize = 128;
|
|
240
249
|
pub const max_credential_account_bytes: usize = 256;
|
|
241
|
-
|
|
250
|
+
/// One honest cross-platform bound: Windows Credential Manager's generic
|
|
251
|
+
/// credential blob is the narrowest first-party backend at 5 * 512 bytes.
|
|
252
|
+
/// Every host accepts this whole range; none silently truncates it.
|
|
253
|
+
pub const max_credential_secret_bytes: usize = 5 * 512;
|
|
254
|
+
pub const max_local_time_text_bytes: usize = 512;
|
|
242
255
|
pub const max_tray_items: usize = 32;
|
|
243
256
|
pub const max_tray_icon_path_bytes: usize = 4096;
|
|
244
257
|
pub const max_tray_title_bytes: usize = 64;
|
|
245
258
|
pub const max_tray_tooltip_bytes: usize = 256;
|
|
246
259
|
pub const max_tray_item_label_bytes: usize = 256;
|
|
247
260
|
pub const max_tray_item_command_bytes: usize = 128;
|
|
261
|
+
pub const max_tray_item_detail_bytes: usize = 256;
|
|
248
262
|
pub const max_drop_paths_bytes: usize = 8192;
|
|
249
263
|
pub const max_drop_paths: usize = max_drop_paths_bytes / 2 + 1;
|
|
250
264
|
pub const max_window_event_name_bytes: usize = 64;
|
|
@@ -348,8 +362,7 @@ pub const MenuItem = struct {
|
|
|
348
362
|
|
|
349
363
|
pub fn validateShortcut(shortcut: Shortcut) Error!void {
|
|
350
364
|
if (!isValidCommandId(shortcut.id, max_shortcut_id_bytes)) return error.InvalidShortcut;
|
|
351
|
-
if (!
|
|
352
|
-
if (!shortcut.modifiers.hasAny() and shortcutRequiresModifier(shortcut.key)) return error.InvalidShortcut;
|
|
365
|
+
if (!isValidShortcutBinding(shortcut.key, shortcut.modifiers)) return error.InvalidShortcut;
|
|
353
366
|
}
|
|
354
367
|
|
|
355
368
|
pub fn validateMenus(menus: []const Menu) Error!void {
|
|
@@ -368,9 +381,8 @@ pub fn validateMenuItem(item: MenuItem) Error!void {
|
|
|
368
381
|
if (item.label.len == 0 or item.label.len > max_menu_item_label_bytes) return error.InvalidMenuOptions;
|
|
369
382
|
if (!isValidCommandId(item.command, max_menu_command_bytes)) return error.InvalidCommand;
|
|
370
383
|
if (item.key.len > 0) {
|
|
371
|
-
if (!isValidShortcutKey(item.key)) return error.InvalidShortcut;
|
|
372
384
|
if (item.key.len > max_menu_key_bytes) return error.InvalidShortcut;
|
|
373
|
-
if (!item.
|
|
385
|
+
if (!isValidShortcutBinding(item.key, item.modifiers)) return error.InvalidShortcut;
|
|
374
386
|
}
|
|
375
387
|
}
|
|
376
388
|
|
|
@@ -428,6 +440,10 @@ pub fn isValidShortcutKey(key: []const u8) bool {
|
|
|
428
440
|
return false;
|
|
429
441
|
}
|
|
430
442
|
|
|
443
|
+
pub fn isValidShortcutBinding(key: []const u8, modifiers: ShortcutModifiers) bool {
|
|
444
|
+
return isValidShortcutKey(key) and (modifiers.hasAny() or !shortcutRequiresModifier(key));
|
|
445
|
+
}
|
|
446
|
+
|
|
431
447
|
fn shortcutRequiresModifier(key: []const u8) bool {
|
|
432
448
|
if (key.len == 1) return true;
|
|
433
449
|
return std.ascii.eqlIgnoreCase(key, "space") or
|
|
@@ -565,6 +581,11 @@ pub const WindowDragRegion = struct {
|
|
|
565
581
|
pub const WindowShowMode = enum {
|
|
566
582
|
immediate,
|
|
567
583
|
on_first_present,
|
|
584
|
+
/// Create the native window ordered out and keep it that way until
|
|
585
|
+
/// an explicit `showWindow`/focus request. This is the launch shape
|
|
586
|
+
/// for a menu-bar app whose real surface is its status item: the
|
|
587
|
+
/// host window exists for runtime/view ownership but never flashes.
|
|
588
|
+
hidden,
|
|
568
589
|
};
|
|
569
590
|
|
|
570
591
|
/// What the user's close affordance (the red traffic light, cmd+W, the
|
|
@@ -611,6 +632,12 @@ pub const WindowOptions = struct {
|
|
|
611
632
|
/// or `showWindow`) activates the app and takes keyboard focus.
|
|
612
633
|
/// Explicit `focusWindow` remains an activation request either way.
|
|
613
634
|
activate_on_show: bool = true,
|
|
635
|
+
/// Whether macOS may move the window into a native fullscreen
|
|
636
|
+
/// Space. False keeps ordinary resizing but removes the green
|
|
637
|
+
/// fullscreen affordance and rejects the fullscreen shortcut.
|
|
638
|
+
/// Other desktop hosts currently have no separate fullscreen mode
|
|
639
|
+
/// at this seam and keep their existing maximize behavior.
|
|
640
|
+
allows_fullscreen: bool = true,
|
|
614
641
|
/// Content min-size floor the WINDOW enforces (macOS
|
|
615
642
|
/// `contentMinSize`): the user cannot resize below it, so declared
|
|
616
643
|
/// layout floors stop clamping/clipping panes instead of stopping
|
|
@@ -637,15 +664,14 @@ pub const WindowState = struct {
|
|
|
637
664
|
focused: bool = true,
|
|
638
665
|
maximized: bool = false,
|
|
639
666
|
fullscreen: bool = false,
|
|
640
|
-
/// True while the window is alive but off the glass
|
|
641
|
-
///
|
|
642
|
-
///
|
|
643
|
-
/// stays true, and
|
|
644
|
-
///
|
|
645
|
-
///
|
|
646
|
-
///
|
|
647
|
-
///
|
|
648
|
-
/// starts shown.
|
|
667
|
+
/// True while the window is alive but ordered off the glass: an
|
|
668
|
+
/// explicitly hidden startup window, `Effects.hideWindow`, or a
|
|
669
|
+
/// `close_policy = .hide` user close. The window keeps its views and
|
|
670
|
+
/// native identity, `open` stays true, and show/focus flips it back.
|
|
671
|
+
/// Distinct from minimized (which keeps a Dock/taskbar affordance)
|
|
672
|
+
/// and closed (`open = false`, the window is gone). Session-transient:
|
|
673
|
+
/// it is never restored from the window-state store; each launch uses
|
|
674
|
+
/// the declaration's show policy again.
|
|
649
675
|
hidden: bool = false,
|
|
650
676
|
};
|
|
651
677
|
|
|
@@ -688,6 +714,7 @@ pub const WindowCreateOptions = struct {
|
|
|
688
714
|
always_on_top: bool = false,
|
|
689
715
|
click_through: bool = false,
|
|
690
716
|
activate_on_show: bool = true,
|
|
717
|
+
allows_fullscreen: bool = true,
|
|
691
718
|
/// Window-enforced content min-size floor (see
|
|
692
719
|
/// `WindowOptions.min_width`/`min_height`); 0 = no floor.
|
|
693
720
|
min_width: f32 = 0,
|
|
@@ -711,6 +738,7 @@ pub const WindowCreateOptions = struct {
|
|
|
711
738
|
.always_on_top = self.always_on_top,
|
|
712
739
|
.click_through = self.click_through,
|
|
713
740
|
.activate_on_show = self.activate_on_show,
|
|
741
|
+
.allows_fullscreen = self.allows_fullscreen,
|
|
714
742
|
.min_width = self.min_width,
|
|
715
743
|
.min_height = self.min_height,
|
|
716
744
|
.close_policy = self.close_policy,
|
|
@@ -718,6 +746,18 @@ pub const WindowCreateOptions = struct {
|
|
|
718
746
|
}
|
|
719
747
|
};
|
|
720
748
|
|
|
749
|
+
/// The operating system's registration state for launching this app at
|
|
750
|
+
/// user login. `requires_approval` is a successful query, not an I/O
|
|
751
|
+
/// failure: macOS knows the registration but the user must approve it
|
|
752
|
+
/// in System Settings. `not_found` means the current executable is not
|
|
753
|
+
/// an installed application bundle that SMAppService can register.
|
|
754
|
+
pub const LaunchAtLoginStatus = enum {
|
|
755
|
+
disabled,
|
|
756
|
+
enabled,
|
|
757
|
+
requires_approval,
|
|
758
|
+
not_found,
|
|
759
|
+
};
|
|
760
|
+
|
|
721
761
|
pub const WebViewOptions = struct {
|
|
722
762
|
window_id: WindowId = 1,
|
|
723
763
|
label: []const u8,
|
|
@@ -960,6 +1000,10 @@ pub const ViewInfo = struct {
|
|
|
960
1000
|
gpu_frame_index: u64 = 0,
|
|
961
1001
|
gpu_timestamp_ns: u64 = 0,
|
|
962
1002
|
gpu_frame_interval_ns: u64 = default_gpu_frame_interval_ns,
|
|
1003
|
+
/// GPU-surface input events accepted by the runtime for this view.
|
|
1004
|
+
/// Monotonic for the view lifetime; automation uses deltas to separate
|
|
1005
|
+
/// host/input-stack delivery from renderer frame coverage.
|
|
1006
|
+
gpu_input_event_count: u64 = 0,
|
|
963
1007
|
gpu_input_timestamp_ns: u64 = 0,
|
|
964
1008
|
gpu_input_latency_ns: u64 = 0,
|
|
965
1009
|
gpu_input_latency_budget_ns: u64 = default_gpu_frame_interval_ns,
|
|
@@ -970,6 +1014,9 @@ pub const ViewInfo = struct {
|
|
|
970
1014
|
gpu_first_frame_latency_budget_exceeded_count: usize = 0,
|
|
971
1015
|
gpu_first_frame_latency_budget_ok: bool = true,
|
|
972
1016
|
gpu_frame_nonblank: bool = false,
|
|
1017
|
+
/// Whether the most recent host completion was an occluded logical
|
|
1018
|
+
/// heartbeat rather than a presentation that reached the display.
|
|
1019
|
+
gpu_occluded: bool = false,
|
|
973
1020
|
gpu_sample_color: u32 = 0,
|
|
974
1021
|
gpu_backend: GpuSurfaceBackend = .none,
|
|
975
1022
|
gpu_pixel_format: GpuSurfacePixelFormat = .none,
|
|
@@ -1341,8 +1388,38 @@ pub const Credential = struct {
|
|
|
1341
1388
|
secret: []const u8,
|
|
1342
1389
|
};
|
|
1343
1390
|
|
|
1391
|
+
/// Host-local, locale-aware timestamp presentation. This deliberately lives
|
|
1392
|
+
/// behind PlatformServices: the same epoch can format differently after a
|
|
1393
|
+
/// locale or time-zone change, so app cores must observe it as an effect.
|
|
1394
|
+
pub const LocalTimeStyle = enum(u8) {
|
|
1395
|
+
date,
|
|
1396
|
+
time,
|
|
1397
|
+
datetime,
|
|
1398
|
+
};
|
|
1399
|
+
|
|
1344
1400
|
pub const TrayItemId = u32;
|
|
1345
1401
|
|
|
1402
|
+
/// Visual emphasis for the menu-bar button's live presentation. Hosts
|
|
1403
|
+
/// without a colored-title seam may render every value as `normal`.
|
|
1404
|
+
pub const TrayTone = enum(u8) {
|
|
1405
|
+
normal,
|
|
1406
|
+
warning,
|
|
1407
|
+
critical,
|
|
1408
|
+
};
|
|
1409
|
+
|
|
1410
|
+
/// The model-derived part of a status item. Keeping this separate from
|
|
1411
|
+
/// icon/tooltip/activation options lets UiApp patch presentation without
|
|
1412
|
+
/// recreating the native item.
|
|
1413
|
+
pub const TrayPresentation = struct {
|
|
1414
|
+
title: []const u8 = "",
|
|
1415
|
+
/// Explicit status-item width in points; zero asks the host to choose
|
|
1416
|
+
/// variable width for a title and square width for icon-only state.
|
|
1417
|
+
width: f32 = 0,
|
|
1418
|
+
tone: TrayTone = .normal,
|
|
1419
|
+
icon_opacity: f32 = 1,
|
|
1420
|
+
monospaced: bool = false,
|
|
1421
|
+
};
|
|
1422
|
+
|
|
1346
1423
|
pub const TrayOptions = struct {
|
|
1347
1424
|
icon_path: []const u8 = "",
|
|
1348
1425
|
/// Status-bar button title, shown when no icon resolves (macOS
|
|
@@ -1350,6 +1427,25 @@ pub const TrayOptions = struct {
|
|
|
1350
1427
|
title: []const u8 = "",
|
|
1351
1428
|
tooltip: []const u8 = "",
|
|
1352
1429
|
items: []const TrayMenuItem = &.{},
|
|
1430
|
+
presentation: TrayPresentation = .{},
|
|
1431
|
+
/// Ordinary click, Option-click, and menu-open hooks. Each command
|
|
1432
|
+
/// enters the same on_command route as a selected menu row.
|
|
1433
|
+
activation_command: []const u8 = "",
|
|
1434
|
+
alternate_activation_command: []const u8 = "",
|
|
1435
|
+
open_command: []const u8 = "",
|
|
1436
|
+
};
|
|
1437
|
+
|
|
1438
|
+
/// Semantic status-menu rows. `command` is the ordinary actionable row;
|
|
1439
|
+
/// the others let a capable host render readouts without presenting them
|
|
1440
|
+
/// as disabled actions. Hosts without rich-menu support may degrade them
|
|
1441
|
+
/// to non-actionable text rows.
|
|
1442
|
+
pub const TrayItemRole = enum(u8) {
|
|
1443
|
+
command,
|
|
1444
|
+
info,
|
|
1445
|
+
header,
|
|
1446
|
+
hero,
|
|
1447
|
+
agent,
|
|
1448
|
+
context,
|
|
1353
1449
|
};
|
|
1354
1450
|
|
|
1355
1451
|
pub const TrayMenuItem = struct {
|
|
@@ -1358,6 +1454,10 @@ pub const TrayMenuItem = struct {
|
|
|
1358
1454
|
command: []const u8 = "",
|
|
1359
1455
|
separator: bool = false,
|
|
1360
1456
|
enabled: bool = true,
|
|
1457
|
+
detail: []const u8 = "",
|
|
1458
|
+
role: TrayItemRole = .command,
|
|
1459
|
+
key: []const u8 = "",
|
|
1460
|
+
modifiers: ShortcutModifiers = .{},
|
|
1361
1461
|
};
|
|
1362
1462
|
|
|
1363
1463
|
pub const NativeCommandEvent = struct {
|
|
@@ -1371,6 +1471,14 @@ pub const MenuCommandEvent = struct {
|
|
|
1371
1471
|
window_id: WindowId = 1,
|
|
1372
1472
|
};
|
|
1373
1473
|
|
|
1474
|
+
/// A named command emitted by status-item lifecycle hooks (activation,
|
|
1475
|
+
/// alternate activation, or menu open). Unlike `tray_action`, this command
|
|
1476
|
+
/// does not identify a menu row, but its source is still the tray.
|
|
1477
|
+
pub const TrayCommandEvent = struct {
|
|
1478
|
+
name: []const u8,
|
|
1479
|
+
window_id: WindowId = 1,
|
|
1480
|
+
};
|
|
1481
|
+
|
|
1374
1482
|
/// Timer ids at or above this value are reserved for the framework's own
|
|
1375
1483
|
/// internal timers (for example the ui-app markup watch poll). Application
|
|
1376
1484
|
/// code must pick ids below this value when calling `startTimer`.
|
|
@@ -1456,6 +1564,79 @@ pub const AudioLoadResolution = enum(u8) {
|
|
|
1456
1564
|
stream,
|
|
1457
1565
|
};
|
|
1458
1566
|
|
|
1567
|
+
/// The two independently-addressable capture sources. A host may run one
|
|
1568
|
+
/// stream of each kind concurrently.
|
|
1569
|
+
pub const AudioCaptureSource = enum(u8) {
|
|
1570
|
+
microphone,
|
|
1571
|
+
system,
|
|
1572
|
+
};
|
|
1573
|
+
|
|
1574
|
+
/// The canonical format requested from a capture host. First-party hosts
|
|
1575
|
+
/// resample and remix their device-native format to this exact shape.
|
|
1576
|
+
pub const AudioCaptureFormat = struct {
|
|
1577
|
+
sample_rate: u32 = 48_000,
|
|
1578
|
+
channels: u8 = 1,
|
|
1579
|
+
|
|
1580
|
+
pub fn valid(self: AudioCaptureFormat) bool {
|
|
1581
|
+
return (self.sample_rate == 16_000 or self.sample_rate == 24_000 or self.sample_rate == 48_000) and
|
|
1582
|
+
(self.channels == 1 or self.channels == 2);
|
|
1583
|
+
}
|
|
1584
|
+
};
|
|
1585
|
+
|
|
1586
|
+
/// Capture reports are small, bounded records. `.data` bytes are interleaved
|
|
1587
|
+
/// signed 16-bit little-endian PCM in the requested format. First-party hosts
|
|
1588
|
+
/// keep chunks at or below 20 ms so the largest supported packet (48 kHz,
|
|
1589
|
+
/// stereo) is 3840 bytes and fits the effects channel's 4 KiB envelope.
|
|
1590
|
+
pub const max_audio_capture_pcm_bytes: usize = 3840;
|
|
1591
|
+
|
|
1592
|
+
pub const AudioCaptureEventKind = enum(u8) {
|
|
1593
|
+
started,
|
|
1594
|
+
data,
|
|
1595
|
+
failed,
|
|
1596
|
+
};
|
|
1597
|
+
|
|
1598
|
+
pub const AudioCaptureEvent = struct {
|
|
1599
|
+
kind: AudioCaptureEventKind,
|
|
1600
|
+
source: AudioCaptureSource,
|
|
1601
|
+
format: AudioCaptureFormat,
|
|
1602
|
+
timestamp_ns: u64 = 0,
|
|
1603
|
+
frames: u32 = 0,
|
|
1604
|
+
pcm_s16le: []const u8 = "",
|
|
1605
|
+
};
|
|
1606
|
+
|
|
1607
|
+
pub const AudioCapturePushResult = enum(u8) {
|
|
1608
|
+
accepted,
|
|
1609
|
+
dropped_full,
|
|
1610
|
+
dropped_oversized,
|
|
1611
|
+
closed,
|
|
1612
|
+
};
|
|
1613
|
+
|
|
1614
|
+
/// Thread-safe, non-blocking destination retained by a native capture host.
|
|
1615
|
+
/// `audio_capture_stop_fn` must quiesce the source before returning: no later
|
|
1616
|
+
/// call may enter this sink. A source exits permanently when `push` answers
|
|
1617
|
+
/// `.closed`; back-pressure drops are counted and reported by the effects
|
|
1618
|
+
/// channel that owns the sink.
|
|
1619
|
+
pub const AudioCaptureSink = struct {
|
|
1620
|
+
context: ?*anyopaque = null,
|
|
1621
|
+
generation: u64 = 0,
|
|
1622
|
+
push_fn: ?*const fn (context: ?*anyopaque, generation: u64, event: AudioCaptureEvent) AudioCapturePushResult = null,
|
|
1623
|
+
|
|
1624
|
+
pub fn push(self: AudioCaptureSink, event: AudioCaptureEvent) AudioCapturePushResult {
|
|
1625
|
+
const push_fn = self.push_fn orelse return .closed;
|
|
1626
|
+
if (!event.format.valid()) return .dropped_oversized;
|
|
1627
|
+
if (event.kind == .data) {
|
|
1628
|
+
if (event.pcm_s16le.len > max_audio_capture_pcm_bytes or
|
|
1629
|
+
event.pcm_s16le.len != @as(usize, event.frames) * @as(usize, event.format.channels) * 2)
|
|
1630
|
+
{
|
|
1631
|
+
return .dropped_oversized;
|
|
1632
|
+
}
|
|
1633
|
+
} else if (event.frames != 0 or event.pcm_s16le.len != 0) {
|
|
1634
|
+
return .dropped_oversized;
|
|
1635
|
+
}
|
|
1636
|
+
return push_fn(self.context, self.generation, event);
|
|
1637
|
+
}
|
|
1638
|
+
};
|
|
1639
|
+
|
|
1459
1640
|
/// Longest video source string (local path or URL) `videoLoad`/
|
|
1460
1641
|
/// `videoLoadUrl` accepts; longer strings are rejected with
|
|
1461
1642
|
/// `error.VideoPathTooLarge` before the platform is asked.
|
|
@@ -2243,6 +2424,7 @@ pub const Event = union(enum) {
|
|
|
2243
2424
|
shortcut: ShortcutEvent,
|
|
2244
2425
|
native_command: NativeCommandEvent,
|
|
2245
2426
|
menu_command: MenuCommandEvent,
|
|
2427
|
+
tray_command: TrayCommandEvent,
|
|
2246
2428
|
timer: TimerEvent,
|
|
2247
2429
|
/// A cross-thread nudge posted through `PlatformServices.wake_fn`:
|
|
2248
2430
|
/// worker threads (effect executors) ask the platform loop to deliver
|
|
@@ -2280,6 +2462,7 @@ pub const Event = union(enum) {
|
|
|
2280
2462
|
.shortcut => "shortcut",
|
|
2281
2463
|
.native_command => "native_command",
|
|
2282
2464
|
.menu_command => "menu_command",
|
|
2465
|
+
.tray_command => "tray_command",
|
|
2283
2466
|
.timer => "timer",
|
|
2284
2467
|
.wake => "wake",
|
|
2285
2468
|
.files_dropped => "files_dropped",
|
|
@@ -2334,12 +2517,26 @@ pub const PlatformServices = struct {
|
|
|
2334
2517
|
/// controls — chromeless windows have no system button to click.
|
|
2335
2518
|
/// Platforms without the concept leave this null.
|
|
2336
2519
|
minimize_window_fn: ?*const fn (context: ?*anyopaque, window_id: WindowId) anyerror!void = null,
|
|
2520
|
+
/// Keep a live window and all of its views, but order it off the
|
|
2521
|
+
/// glass. The runtime marks `WindowInfo.hidden` while it is out;
|
|
2522
|
+
/// `show_window_fn` is the inverse. Platforms without a reliable
|
|
2523
|
+
/// re-show path leave this null.
|
|
2524
|
+
hide_window_fn: ?*const fn (context: ?*anyopaque, window_id: WindowId) anyerror!void = null,
|
|
2337
2525
|
/// The real OS show verb: unhide + order front. It activates by
|
|
2338
2526
|
/// default; windows created with `activate_on_show = false` use the
|
|
2339
2527
|
/// platform's passive variant. This is the counterpart to a
|
|
2340
2528
|
/// `close_policy = .hide` hide, and the tray "Open" consequence.
|
|
2341
2529
|
/// Platforms without the concept leave this null.
|
|
2342
2530
|
show_window_fn: ?*const fn (context: ?*anyopaque, window_id: WindowId) anyerror!void = null,
|
|
2531
|
+
/// Change whether the process appears in the Dock/app switcher.
|
|
2532
|
+
/// macOS maps true/false to the regular/accessory activation
|
|
2533
|
+
/// policies; other hosts leave this null.
|
|
2534
|
+
set_dock_presence_fn: ?*const fn (context: ?*anyopaque, visible: bool) anyerror!void = null,
|
|
2535
|
+
/// Query and update the installed app bundle's SMAppService login
|
|
2536
|
+
/// registration. Unbundled development executables and hosts
|
|
2537
|
+
/// without the service leave these null / return UnsupportedService.
|
|
2538
|
+
launch_at_login_status_fn: ?*const fn (context: ?*anyopaque) anyerror!LaunchAtLoginStatus = null,
|
|
2539
|
+
set_launch_at_login_fn: ?*const fn (context: ?*anyopaque, enabled: bool) anyerror!LaunchAtLoginStatus = null,
|
|
2343
2540
|
/// The graceful app quit: terminate through the SAME shutdown path
|
|
2344
2541
|
/// a last-window close takes — but the host QUEUES the emit, so
|
|
2345
2542
|
/// `app_shutdown` dispatches on its NEXT loop turn, only after the
|
|
@@ -2405,6 +2602,13 @@ pub const PlatformServices = struct {
|
|
|
2405
2602
|
set_credential_fn: ?*const fn (context: ?*anyopaque, credential: Credential) anyerror!void = null,
|
|
2406
2603
|
get_credential_fn: ?*const fn (context: ?*anyopaque, key: CredentialKey, buffer: []u8) anyerror![]const u8 = null,
|
|
2407
2604
|
delete_credential_fn: ?*const fn (context: ?*anyopaque, key: CredentialKey) anyerror!void = null,
|
|
2605
|
+
/// Teardown detached a synchronous platform operation which may still
|
|
2606
|
+
/// use `context` after the runtime is gone. The platform must latch this
|
|
2607
|
+
/// notification and skip destruction of everything the callback can
|
|
2608
|
+
/// reach. First-party hosts share the channel-wake abandon latch because
|
|
2609
|
+
/// its lifetime obligation is identical. Loop-thread, teardown-only.
|
|
2610
|
+
note_blocking_call_abandoned_fn: ?*const fn (context: ?*anyopaque) void = null,
|
|
2611
|
+
format_local_time_fn: ?*const fn (context: ?*anyopaque, timestamp_ms: i64, style: LocalTimeStyle, buffer: []u8) anyerror![]const u8 = null,
|
|
2408
2612
|
open_external_url_fn: ?*const fn (context: ?*anyopaque, url: []const u8) anyerror!void = null,
|
|
2409
2613
|
reveal_path_fn: ?*const fn (context: ?*anyopaque, path: []const u8) anyerror!void = null,
|
|
2410
2614
|
add_recent_document_fn: ?*const fn (context: ?*anyopaque, path: []const u8) anyerror!void = null,
|
|
@@ -2412,6 +2616,7 @@ pub const PlatformServices = struct {
|
|
|
2412
2616
|
create_tray_fn: ?*const fn (context: ?*anyopaque, options: TrayOptions) anyerror!void = null,
|
|
2413
2617
|
update_tray_menu_fn: ?*const fn (context: ?*anyopaque, items: []const TrayMenuItem) anyerror!void = null,
|
|
2414
2618
|
update_tray_title_fn: ?*const fn (context: ?*anyopaque, title: []const u8) anyerror!void = null,
|
|
2619
|
+
update_tray_presentation_fn: ?*const fn (context: ?*anyopaque, presentation: TrayPresentation) anyerror!void = null,
|
|
2415
2620
|
remove_tray_fn: ?*const fn (context: ?*anyopaque) anyerror!void = null,
|
|
2416
2621
|
configure_security_policy_fn: ?*const fn (context: ?*anyopaque, policy: security.Policy) anyerror!void = null,
|
|
2417
2622
|
configure_menus_fn: ?*const fn (context: ?*anyopaque, menus: []const Menu) anyerror!void = null,
|
|
@@ -2465,6 +2670,14 @@ pub const PlatformServices = struct {
|
|
|
2465
2670
|
audio_seek_fn: ?*const fn (context: ?*anyopaque, position_ms: u64) anyerror!void = null,
|
|
2466
2671
|
/// Set the player volume, `0.0` (silent) through `1.0` (full).
|
|
2467
2672
|
audio_set_volume_fn: ?*const fn (context: ?*anyopaque, volume: f32) anyerror!void = null,
|
|
2673
|
+
/// Start one microphone or system-output capture. Sources are independent,
|
|
2674
|
+
/// but a second start of the same source replaces its current stream.
|
|
2675
|
+
/// Startup and asynchronous failures are reported through `sink`; a
|
|
2676
|
+
/// synchronous error means no source was retained.
|
|
2677
|
+
audio_capture_start_fn: ?*const fn (context: ?*anyopaque, source: AudioCaptureSource, format: AudioCaptureFormat, sink: AudioCaptureSink) anyerror!void = null,
|
|
2678
|
+
/// Stop and synchronously quiesce one source. No sink call from that source
|
|
2679
|
+
/// may occur after this function returns.
|
|
2680
|
+
audio_capture_stop_fn: ?*const fn (context: ?*anyopaque, source: AudioCaptureSource) anyerror!void = null,
|
|
2468
2681
|
/// Load a local video file into THE app's single video player,
|
|
2469
2682
|
/// leaving it PAUSED at position zero (transport is a separate
|
|
2470
2683
|
/// verb, exactly like audio). Loading replaces whatever was loaded
|
|
@@ -2754,11 +2967,31 @@ pub const PlatformServices = struct {
|
|
|
2754
2967
|
return minimize_fn(self.context, window_id);
|
|
2755
2968
|
}
|
|
2756
2969
|
|
|
2970
|
+
pub fn hideWindow(self: PlatformServices, window_id: WindowId) anyerror!void {
|
|
2971
|
+
const hide_fn = self.hide_window_fn orelse return error.UnsupportedService;
|
|
2972
|
+
return hide_fn(self.context, window_id);
|
|
2973
|
+
}
|
|
2974
|
+
|
|
2757
2975
|
pub fn showWindow(self: PlatformServices, window_id: WindowId) anyerror!void {
|
|
2758
2976
|
const show_fn = self.show_window_fn orelse return error.UnsupportedService;
|
|
2759
2977
|
return show_fn(self.context, window_id);
|
|
2760
2978
|
}
|
|
2761
2979
|
|
|
2980
|
+
pub fn setDockPresence(self: PlatformServices, visible: bool) anyerror!void {
|
|
2981
|
+
const set_fn = self.set_dock_presence_fn orelse return error.UnsupportedService;
|
|
2982
|
+
return set_fn(self.context, visible);
|
|
2983
|
+
}
|
|
2984
|
+
|
|
2985
|
+
pub fn launchAtLoginStatus(self: PlatformServices) anyerror!LaunchAtLoginStatus {
|
|
2986
|
+
const status_fn = self.launch_at_login_status_fn orelse return error.UnsupportedService;
|
|
2987
|
+
return status_fn(self.context);
|
|
2988
|
+
}
|
|
2989
|
+
|
|
2990
|
+
pub fn setLaunchAtLogin(self: PlatformServices, enabled: bool) anyerror!LaunchAtLoginStatus {
|
|
2991
|
+
const set_fn = self.set_launch_at_login_fn orelse return error.UnsupportedService;
|
|
2992
|
+
return set_fn(self.context, enabled);
|
|
2993
|
+
}
|
|
2994
|
+
|
|
2762
2995
|
pub fn quitApp(self: PlatformServices) anyerror!void {
|
|
2763
2996
|
const quit_fn = self.quit_app_fn orelse return error.UnsupportedService;
|
|
2764
2997
|
return quit_fn(self.context);
|
|
@@ -2918,6 +3151,16 @@ pub const PlatformServices = struct {
|
|
|
2918
3151
|
return delete_fn(self.context, key);
|
|
2919
3152
|
}
|
|
2920
3153
|
|
|
3154
|
+
pub fn noteBlockingCallAbandoned(self: PlatformServices) void {
|
|
3155
|
+
const note_fn = self.note_blocking_call_abandoned_fn orelse return;
|
|
3156
|
+
note_fn(self.context);
|
|
3157
|
+
}
|
|
3158
|
+
|
|
3159
|
+
pub fn formatLocalTime(self: PlatformServices, timestamp_ms: i64, style: LocalTimeStyle, buffer: []u8) anyerror![]const u8 {
|
|
3160
|
+
const format_fn = self.format_local_time_fn orelse return error.UnsupportedService;
|
|
3161
|
+
return format_fn(self.context, timestamp_ms, style, buffer);
|
|
3162
|
+
}
|
|
3163
|
+
|
|
2921
3164
|
pub fn openExternalUrl(self: PlatformServices, url: []const u8) anyerror!void {
|
|
2922
3165
|
const open_fn = self.open_external_url_fn orelse return error.UnsupportedService;
|
|
2923
3166
|
return open_fn(self.context, url);
|
|
@@ -2957,6 +3200,14 @@ pub const PlatformServices = struct {
|
|
|
2957
3200
|
return title_fn(self.context, title);
|
|
2958
3201
|
}
|
|
2959
3202
|
|
|
3203
|
+
/// Patch all live menu-bar presentation fields without recreating the
|
|
3204
|
+
/// native item. A host that only implements title updates still gets a
|
|
3205
|
+
/// correct title and intentionally degrades the richer styling.
|
|
3206
|
+
pub fn updateTrayPresentation(self: PlatformServices, presentation: TrayPresentation) anyerror!void {
|
|
3207
|
+
if (self.update_tray_presentation_fn) |update_fn| return update_fn(self.context, presentation);
|
|
3208
|
+
return self.updateTrayTitle(presentation.title);
|
|
3209
|
+
}
|
|
3210
|
+
|
|
2960
3211
|
pub fn removeTray(self: PlatformServices) anyerror!void {
|
|
2961
3212
|
const remove_fn = self.remove_tray_fn orelse return error.UnsupportedService;
|
|
2962
3213
|
return remove_fn(self.context);
|
|
@@ -3068,6 +3319,17 @@ pub const PlatformServices = struct {
|
|
|
3068
3319
|
return volume_fn(self.context, volume);
|
|
3069
3320
|
}
|
|
3070
3321
|
|
|
3322
|
+
pub fn audioCaptureStart(self: PlatformServices, source: AudioCaptureSource, format: AudioCaptureFormat, sink: AudioCaptureSink) anyerror!void {
|
|
3323
|
+
if (!format.valid() or sink.push_fn == null) return error.InvalidAudioOptions;
|
|
3324
|
+
const start_fn = self.audio_capture_start_fn orelse return error.UnsupportedService;
|
|
3325
|
+
return start_fn(self.context, source, format, sink);
|
|
3326
|
+
}
|
|
3327
|
+
|
|
3328
|
+
pub fn audioCaptureStop(self: PlatformServices, source: AudioCaptureSource) anyerror!void {
|
|
3329
|
+
const stop_fn = self.audio_capture_stop_fn orelse return error.UnsupportedService;
|
|
3330
|
+
return stop_fn(self.context, source);
|
|
3331
|
+
}
|
|
3332
|
+
|
|
3071
3333
|
/// Load a local video file into the app's single video player (see
|
|
3072
3334
|
/// `video_load_fn`). Platforms without video playback answer
|
|
3073
3335
|
/// `error.UnsupportedService`; bad arguments are rejected here
|
|
@@ -3293,7 +3555,8 @@ fn defaultSupportsFeature(services: PlatformServices, feature: PlatformFeature)
|
|
|
3293
3555
|
.reveal_path => services.reveal_path_fn != null,
|
|
3294
3556
|
.notifications => services.show_notification_fn != null,
|
|
3295
3557
|
.recent_documents => services.add_recent_document_fn != null or services.clear_recent_documents_fn != null,
|
|
3296
|
-
.credentials => services.set_credential_fn != null and services.get_credential_fn != null and services.delete_credential_fn != null
|
|
3558
|
+
.credentials => services.set_credential_fn != null and services.get_credential_fn != null and services.delete_credential_fn != null and
|
|
3559
|
+
services.note_blocking_call_abandoned_fn != null,
|
|
3297
3560
|
.file_drops => false,
|
|
3298
3561
|
.app_activation_events => false,
|
|
3299
3562
|
.gpu_surfaces => false,
|
|
@@ -3307,6 +3570,7 @@ fn defaultSupportsFeature(services: PlatformServices, feature: PlatformFeature)
|
|
|
3307
3570
|
// cannot see it; platforms that analyze answer through their own
|
|
3308
3571
|
// `supports_fn` (like file_drops and gpu_surfaces above).
|
|
3309
3572
|
.audio_spectrum => false,
|
|
3573
|
+
.microphone_capture, .system_audio_capture => services.audio_capture_start_fn != null and services.audio_capture_stop_fn != null,
|
|
3310
3574
|
// Hide-on-close is host close-delegate behavior, not a service
|
|
3311
3575
|
// verb: hosts that implement it answer through their own
|
|
3312
3576
|
// `supports_fn`. The generic floor is honest refusal.
|