@native-sdk/cli 0.5.2 → 0.5.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 +41 -1
- package/build.zig +264 -3
- package/native-sdk.d.ts +17 -1
- package/package.json +9 -9
- package/packages/core/package-lock.json +2 -2
- package/packages/core/package.json +1 -1
- package/packages/core/rt/rt.zig +138 -3
- package/packages/core/sdk/core.ts +225 -3
- package/packages/core/sdk/events.ts +39 -2
- package/packages/core/src/checker.ts +1 -1
- package/packages/core/src/emitter.ts +2625 -262
- package/packages/core/src/infer.ts +53 -7
- package/skill-data/automation/SKILL.md +7 -4
- package/skill-data/core/references/app-model-runtime.md +3 -0
- package/skill-data/native-ui/SKILL.md +4 -2
- package/skill-data/ts-core/SKILL.md +9 -1
- package/src/app_runner/root.zig +106 -1
- package/src/app_runner/ts_core_main.zig +4 -0
- package/src/automation/protocol.zig +20 -1
- package/src/embed/host.zig +27 -0
- package/src/embed/tests.zig +187 -0
- package/src/embed/ui_host.zig +4 -0
- package/src/platform/linux/gtk_host.c +112 -3
- package/src/platform/linux/root.zig +71 -0
- package/src/platform/macos/appkit_host.h +59 -2
- package/src/platform/macos/appkit_host.m +663 -34
- package/src/platform/macos/cef_host.mm +262 -10
- package/src/platform/macos/root.zig +126 -4
- package/src/platform/null_platform.zig +298 -5
- package/src/platform/null_platform_tests.zig +39 -0
- package/src/platform/root.zig +36 -0
- package/src/platform/types.zig +247 -8
- package/src/platform/windows/root.zig +134 -0
- package/src/platform/windows/webview2_host.cpp +152 -40
- package/src/primitives/app_manifest/comptime_scene.zig +5 -0
- package/src/primitives/app_manifest/root.zig +1 -0
- package/src/primitives/app_manifest/types.zig +32 -0
- package/src/primitives/canvas/chart.zig +7 -7
- package/src/primitives/canvas/chart_tests.zig +66 -0
- package/src/primitives/canvas/commands.zig +48 -0
- package/src/primitives/canvas/events.zig +161 -0
- package/src/primitives/canvas/font_ttf.zig +155 -8
- package/src/primitives/canvas/font_ttf_tests.zig +686 -0
- package/src/primitives/canvas/reference.zig +67 -8
- package/src/primitives/canvas/render_fingerprints.zig +8 -0
- package/src/primitives/canvas/root.zig +25 -0
- package/src/primitives/canvas/tests.zig +1 -0
- package/src/primitives/canvas/ui.zig +46 -9
- package/src/primitives/canvas/ui_markup.zig +82 -34
- package/src/primitives/canvas/ui_markup_binary.zig +4 -1
- package/src/primitives/canvas/ui_markup_binary_tests.zig +25 -0
- package/src/primitives/canvas/ui_markup_compiled.zig +63 -11
- package/src/primitives/canvas/ui_markup_compiled_tests.zig +88 -0
- package/src/primitives/canvas/ui_markup_contract.zig +10 -1
- package/src/primitives/canvas/ui_markup_contract_tests.zig +50 -0
- package/src/primitives/canvas/ui_markup_huge_document_tests.zig +154 -0
- package/src/primitives/canvas/ui_markup_tests.zig +55 -9
- package/src/primitives/canvas/ui_markup_view.zig +81 -14
- package/src/primitives/canvas/ui_markup_view_tests.zig +219 -7
- package/src/primitives/canvas/ui_schema.zig +29 -0
- package/src/primitives/canvas/ui_schema_tests.zig +11 -11
- package/src/primitives/canvas/ui_tests.zig +31 -0
- package/src/primitives/canvas/vector.zig +258 -141
- package/src/primitives/canvas/widget_access.zig +1 -1
- package/src/primitives/canvas/widget_builtin_tests.zig +129 -0
- package/src/primitives/canvas/widget_layout.zig +9 -4
- package/src/primitives/canvas/widget_render.zig +78 -40
- package/src/primitives/canvas/widget_render_controls.zig +15 -4
- package/src/primitives/canvas/widget_semantics.zig +6 -1
- package/src/primitives/canvas/widget_semantics_tests.zig +168 -0
- package/src/primitives/canvas/widget_text_input.zig +118 -10
- package/src/primitives/canvas/widgets.zig +16 -0
- package/src/root.zig +12 -0
- package/src/runtime/api.zig +15 -0
- package/src/runtime/automation_commands.zig +33 -0
- package/src/runtime/automation_widget_dispatch.zig +64 -0
- package/src/runtime/bridge_payload.zig +7 -0
- package/src/runtime/bridge_responses.zig +5 -0
- package/src/runtime/builtin_bridge.zig +9 -4
- package/src/runtime/canvas_font_tests.zig +711 -5
- package/src/runtime/canvas_fonts.zig +120 -25
- package/src/runtime/canvas_frame_helpers.zig +15 -0
- package/src/runtime/canvas_image_tests.zig +221 -0
- package/src/runtime/canvas_images.zig +78 -19
- package/src/runtime/canvas_limits.zig +44 -8
- package/src/runtime/canvas_widget_clipboard_tests.zig +123 -0
- package/src/runtime/canvas_widget_context_menu_tests.zig +55 -0
- package/src/runtime/canvas_widget_events.zig +24 -4
- package/src/runtime/canvas_widget_runtime.zig +24 -7
- package/src/runtime/canvas_widget_state.zig +6 -1
- package/src/runtime/canvas_widget_text_tests.zig +277 -0
- package/src/runtime/core.zig +148 -9
- package/src/runtime/effects.zig +1664 -43
- package/src/runtime/effects_fetch_tests.zig +89 -1
- package/src/runtime/effects_file_tests.zig +41 -1
- package/src/runtime/effects_image_tests.zig +1304 -0
- package/src/runtime/effects_tests.zig +153 -0
- package/src/runtime/flow.zig +44 -0
- package/src/runtime/gpu_surface_events.zig +7 -0
- package/src/runtime/media_surface.zig +726 -0
- package/src/runtime/media_surface_tests.zig +1476 -0
- package/src/runtime/root.zig +20 -0
- package/src/runtime/session_blobs.zig +689 -0
- package/src/runtime/session_journal.zig +111 -20
- package/src/runtime/session_record.zig +27 -2
- package/src/runtime/session_replay.zig +168 -16
- package/src/runtime/session_tests.zig +2118 -4
- package/src/runtime/shell_layout.zig +7 -0
- package/src/runtime/testdata/fonts/NotoSansSC-Receipt.ttf +0 -0
- package/src/runtime/testdata/fonts/OFL.txt +93 -0
- package/src/runtime/tests.zig +3 -0
- package/src/runtime/ts_core_host.zig +439 -4
- package/src/runtime/ts_core_host_tests.zig +41 -0
- package/src/runtime/ts_ui_app.zig +63 -0
- package/src/runtime/ui_app.zig +169 -6
- package/src/runtime/ui_app_tests.zig +334 -0
- package/src/runtime/ui_app_window_tests.zig +468 -0
- package/src/runtime/window_command_bridge_tests.zig +117 -0
- package/src/runtime/window_storage.zig +32 -0
- package/src/runtime/window_views.zig +61 -1
- package/src/tooling/manifest.zig +75 -0
- package/src/tooling/raw_manifest.zig +2 -0
- package/src/tooling/templates.zig +219 -1
package/build/app.zig
CHANGED
|
@@ -560,6 +560,18 @@ pub fn addAppArtifacts(b: *std.Build, dep: *std.Build.Dependency, app_options: A
|
|
|
560
560
|
const exe = b.addExecutable(.{
|
|
561
561
|
.name = app_options.name,
|
|
562
562
|
.root_module = app_mod,
|
|
563
|
+
// The app executable crosses the platform C seam on every host
|
|
564
|
+
// call (the GTK host's `native_sdk_gtk_create_view` is a
|
|
565
|
+
// 22-parameter mix of pointers, sizes, ints, and doubles), and
|
|
566
|
+
// Zig 0.16.0's self-hosted x86_64 backend miscompiles exactly
|
|
567
|
+
// that calling-convention shape (see useLlvmWorkaround below):
|
|
568
|
+
// a Debug `native dev` on x86_64 Linux placed the stack-passed
|
|
569
|
+
// string arguments one slot off, so the host read a garbage
|
|
570
|
+
// `role` pointer and crashed in `native_sdk_strndup` while the
|
|
571
|
+
// register-passed `label` arrived intact. Every other artifact
|
|
572
|
+
// in this graph already forces LLVM on x86_64; the app exe —
|
|
573
|
+
// the one binary users actually run — must too.
|
|
574
|
+
.use_llvm = useLlvmWorkaround(target),
|
|
563
575
|
});
|
|
564
576
|
// Windows subsystem posture: release-shaped exes (`native build`,
|
|
565
577
|
// and therefore everything `native package --target windows` wraps)
|
|
@@ -723,6 +735,19 @@ pub fn addAppArtifacts(b: *std.Build, dep: *std.Build.Dependency, app_options: A
|
|
|
723
735
|
/// t: f32, r: f32, bo: f32, l: f32, kt: f32, kr: f32, kb: f32,
|
|
724
736
|
/// kl: f32) callconv(.c) void { ... }
|
|
725
737
|
///
|
|
738
|
+
/// The same backend also mis-places STACK-passed integer/pointer arguments
|
|
739
|
+
/// in long mixed signatures with interleaved doubles: calling the GTK
|
|
740
|
+
/// host's `native_sdk_gtk_create_view` (22 params: 6 register ints, 4
|
|
741
|
+
/// doubles, 12 stack ints/pointers/sizes) from self-hosted Debug code
|
|
742
|
+
/// hands the clang-compiled callee arguments shifted by one stack slot
|
|
743
|
+
/// from `visible` onward — the callee's `role` pointer reads as the
|
|
744
|
+
/// caller's `enabled` value (a 4-byte 1 under 0xAA undefined fill,
|
|
745
|
+
/// faulting at 0xaaaaaaaa00000001) and `role_len` reads as the role
|
|
746
|
+
/// pointer. Register-passed arguments (`label`) arrive intact, which is
|
|
747
|
+
/// why the crash appears only at the first stack-passed string. Verified
|
|
748
|
+
/// against zig 0.16.0 on x86_64-linux with a standalone caller/callee
|
|
749
|
+
/// pair: self-hosted Debug corrupts, `-fllvm` is correct.
|
|
750
|
+
///
|
|
726
751
|
/// Force the LLVM backend on x86_64 until the upstream backend is fixed;
|
|
727
752
|
/// Release modes already default to LLVM, so this only changes Debug.
|
|
728
753
|
pub fn useLlvmWorkaround(target: std.Build.ResolvedTarget) ?bool {
|
|
@@ -921,7 +946,14 @@ fn linkPlatform(b: *std.Build, dep: *std.Build.Dependency, target: std.Build.Res
|
|
|
921
946
|
// the layer stays out even on machines where the
|
|
922
947
|
// development package is installed — libwebkitgtk is
|
|
923
948
|
// neither linked nor required at runtime, and the
|
|
924
|
-
// executable carries no WebKit reference at all.
|
|
949
|
+
// executable carries no WebKit reference at all. This
|
|
950
|
+
// is the expected, configured state of every canvas
|
|
951
|
+
// app on Linux, so the stub compile is deliberately
|
|
952
|
+
// silent — no build note, no compiler diagnostic (the
|
|
953
|
+
// host's seam comment explains why even an
|
|
954
|
+
// informational pragma is dangerous); a stubbed host
|
|
955
|
+
// teaches at runtime by reporting WebViewNotFound the
|
|
956
|
+
// moment an app actually uses a WebView.
|
|
925
957
|
app_mod.addCSourceFile(.{ .file = dep.path("src/platform/linux/gtk_host.c"), .flags = &.{"-DNATIVE_SDK_ALLOW_WEBKITGTK_STUB"} });
|
|
926
958
|
app_mod.linkSystemLibrary("gtk4", .{});
|
|
927
959
|
app_mod.linkSystemLibrary("dl", .{});
|
|
@@ -974,6 +1006,14 @@ fn linkPlatform(b: *std.Build, dep: *std.Build.Dependency, target: std.Build.Res
|
|
|
974
1006
|
// headers are reachable through the system include paths
|
|
975
1007
|
// — no WebView2Loader.dll is installed or path-wired,
|
|
976
1008
|
// and the executable carries no reference to it at all.
|
|
1009
|
+
// This is the expected, configured state of every
|
|
1010
|
+
// canvas app on Windows, so the stub compile is
|
|
1011
|
+
// deliberately silent — no build note, no compiler
|
|
1012
|
+
// diagnostic (the host's seam comment explains why
|
|
1013
|
+
// even an informational pragma is dangerous); a
|
|
1014
|
+
// stubbed host teaches at runtime by reporting
|
|
1015
|
+
// WebViewNotFound the moment an app actually uses a
|
|
1016
|
+
// WebView.
|
|
977
1017
|
app_mod.addCSourceFile(.{ .file = dep.path("src/platform/windows/webview2_host.cpp"), .flags = &.{ "-std=c++17", "-DNATIVE_SDK_ALLOW_WEBVIEW2_STUB" } });
|
|
978
1018
|
},
|
|
979
1019
|
.chromium => {
|
package/build.zig
CHANGED
|
@@ -219,6 +219,14 @@ pub fn build(b: *std.Build) void {
|
|
|
219
219
|
markup_cli_mod.addImport("markup_lsp", markup_lsp_mod);
|
|
220
220
|
const markup_cli_tests = testArtifact(b, markup_cli_mod);
|
|
221
221
|
|
|
222
|
+
// The evals harness's Cmd wire-format decoder (copied next to every
|
|
223
|
+
// ts-track case harness at grading time). Its own tests run here —
|
|
224
|
+
// NOT at eval time — because a decoder that lags a
|
|
225
|
+
// cmd_format_version bump panics mid-eval inside case harnesses,
|
|
226
|
+
// where the failure reads as the graded app's, not the tooling's.
|
|
227
|
+
const evals_cmdview_mod = module(b, target, optimize, "evals/harness-lib/cmdview.zig");
|
|
228
|
+
const evals_cmdview_tests = testArtifact(b, evals_cmdview_mod);
|
|
229
|
+
|
|
222
230
|
// `native version` names the commit the binary was built from, so
|
|
223
231
|
// binary/framework skew ("your native binary may be stale") is a
|
|
224
232
|
// one-command check. Falls back to "unknown" outside a git checkout.
|
|
@@ -438,6 +446,7 @@ pub fn build(b: *std.Build) void {
|
|
|
438
446
|
test_step.dependOn(&b.addRunArtifact(markup_lsp_tests).step);
|
|
439
447
|
test_step.dependOn(&b.addRunArtifact(automation_cli_tests).step);
|
|
440
448
|
test_step.dependOn(&b.addRunArtifact(markup_cli_tests).step);
|
|
449
|
+
test_step.dependOn(&b.addRunArtifact(evals_cmdview_tests).step);
|
|
441
450
|
addFileContainsCheckStep(b, file_contains_checker, test_step, "test-package-types", "Verify package TypeScript platform feature names", &.{
|
|
442
451
|
.{ .path = "packages/native-sdk/native-sdk.d.ts", .pattern = "NativeSdkCommandInfo" },
|
|
443
452
|
.{ .path = "packages/native-sdk/native-sdk.d.ts", .pattern = "list(): Promise<NativeSdkCommandInfo[]>" },
|
|
@@ -536,6 +545,16 @@ pub fn build(b: *std.Build) void {
|
|
|
536
545
|
addFileContainsCheckStep(b, file_contains_checker, test_step, "test-docs-shell-manifest-contracts", "Verify app.zon docs describe shell compatibility window labels", &.{
|
|
537
546
|
.{ .path = "docs/src/app/app-zon/page.mdx", .pattern = "labels must stay unique across both lists" },
|
|
538
547
|
});
|
|
548
|
+
addFileContainsCheckStep(b, file_contains_checker, test_step, "test-docs-media-producer-contracts", "Verify the media producer docs' typed callback stays mirrored by the compile-shaped pin in media_surface_tests.zig", &.{
|
|
549
|
+
.{ .path = "docs/src/app/media-producers/page.mdx", .pattern = "producer: media.MediaSurfaceProducer" },
|
|
550
|
+
.{ .path = "src/runtime/media_surface_tests.zig", .pattern = "producer: media.MediaSurfaceProducer" },
|
|
551
|
+
});
|
|
552
|
+
addFileContainsCheckStep(b, file_contains_checker, test_step, "test-session-replay-image-codec", "Verify the replay runner installs the host image codec headlessly (the desktop arms cannot link in unit tests; the null-fallback arm is covered in session_tests.zig)", &.{
|
|
553
|
+
.{ .path = "src/app_runner/root.zig", .pattern = "native_sdk.platform.installHeadlessImageCodec(build_options.platform, &null_platform, &replay_platform.services);" },
|
|
554
|
+
.{ .path = "src/platform/macos/root.zig", .pattern = "pub fn installHeadlessImageCodec(services: *platform_mod.PlatformServices) void {\n services.decode_image_fn = decodeImage;\n}" },
|
|
555
|
+
.{ .path = "src/platform/linux/root.zig", .pattern = "pub fn installHeadlessImageCodec(services: *platform_mod.PlatformServices) void {\n services.decode_image_fn = decodeImage;\n}" },
|
|
556
|
+
.{ .path = "src/platform/windows/root.zig", .pattern = "pub fn installHeadlessImageCodec(services: *platform_mod.PlatformServices) void {\n services.decode_image_fn = decodeImage;\n}" },
|
|
557
|
+
});
|
|
539
558
|
addFileContainsCheckStep(b, file_contains_checker, test_step, "test-js-view-helper-contracts", "Verify injected view helpers support label-first updates", &.{
|
|
540
559
|
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "update:function(options,patch)" },
|
|
541
560
|
.{ .path = "src/platform/macos/cef_host.mm", .pattern = "update:function(options,patch)" },
|
|
@@ -566,6 +585,46 @@ pub fn build(b: *std.Build) void {
|
|
|
566
585
|
.{ .path = "src/platform/linux/gtk_host.c", .pattern = "change != NATIVE_SDK_GST_STATE_CHANGE_ASYNC" },
|
|
567
586
|
.{ .path = "src/platform/linux/gtk_host.c", .pattern = "#define NATIVE_SDK_GST_STATE_CHANGE_ASYNC 2" },
|
|
568
587
|
});
|
|
588
|
+
addFileContainsCheckStep(b, file_contains_checker, test_step, "test-linux-init-close-policy-refusal", "Verify the Linux platform init refuses a .hide main window with the one shared teaching (the pre-created startup window never passes the runtime's create gate, so a silent drop here meant quit-on-close for direct-SDK users)", &.{
|
|
589
|
+
// The gate itself is unit-tested cross-host (it is extern-free);
|
|
590
|
+
// this pins its WIRING into initWithOptions, which only a Linux
|
|
591
|
+
// link can execute.
|
|
592
|
+
.{ .path = "src/platform/linux/root.zig", .pattern = "try refuseUnsupportedMainWindowClosePolicy(window_options);" },
|
|
593
|
+
// One message, all seams: the platform-init refusal and the
|
|
594
|
+
// generated runner's comptime refusal teach with the same text.
|
|
595
|
+
.{ .path = "src/platform/linux/root.zig", .pattern = "close_policy \\\"hide\\\" is not supported on linux: the GTK host has no status item (tray), so nothing could bring the hidden window back - declare \\\"quit\\\" (the default), or scope the .hide declaration to macos/windows builds" },
|
|
596
|
+
.{ .path = "src/app_runner/root.zig", .pattern = "close_policy \\\"hide\\\" is not supported on linux: the GTK host has no status item (tray), so nothing could bring the hidden window back - declare \\\"quit\\\" (the default), or scope the .hide declaration to macos/windows builds" },
|
|
597
|
+
.{ .path = "src/tooling/templates.zig", .pattern = "close_policy \\\\\\\"hide\\\\\\\" is not supported on linux" },
|
|
598
|
+
});
|
|
599
|
+
addFileContainsCheckStep(b, file_contains_checker, test_step, "test-macos-close-clears-policy-hidden", "Verify every macOS close exit leaves the policy-hidden set before its open=false emit (both hosts derive the frame event's hidden flag from set membership, and the Dock reopen re-shows every member — a close exit that skips the cleanup emits {open=false, hidden=true} and lets the reopen resurrect an app-closed window)", &.{
|
|
600
|
+
// AppKit: every close routes through NSWindow close/performClose,
|
|
601
|
+
// so the delegate's windowWillClose is the one cleanup site.
|
|
602
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "[self.host.policyHiddenWindows removeObject:@(self.windowId)];\n [self.host emitWindowFrameForWindowId:self.windowId open:NO];" },
|
|
603
|
+
// CEF: the delegate cleanup covers the [window close] fallback,
|
|
604
|
+
// and the app-driven close of a browser-bearing window exits
|
|
605
|
+
// through orderOut WITHOUT reaching windowWillClose — that
|
|
606
|
+
// branch must do the set cleanup itself, before its emit.
|
|
607
|
+
.{ .path = "src/platform/macos/cef_host.mm", .pattern = "[self.host.policyHiddenWindows removeObject:@(self.windowId)];\n [self.host emitWindowFrameForWindowId:self.windowId open:NO];" },
|
|
608
|
+
.{ .path = "src/platform/macos/cef_host.mm", .pattern = "[self.policyHiddenWindows removeObject:@(windowId)];\n [window orderOut:nil];\n [self emitWindowFrameForWindowId:windowId open:NO];" },
|
|
609
|
+
});
|
|
610
|
+
addFileContainsCheckStep(b, file_contains_checker, test_step, "test-macos-cef-window-verbs-synchronous", "Verify the CEF host's show and minimize verbs run synchronously on the main thread, the close verb's discipline (a dispatch_async show returns success while the window is still in policyHiddenWindows — the runtime's post-success focus flip then emits {focused:true, hidden:true} until the queued block lands — and a show-then-close in one dispatch re-orders: the queued show lands AFTER the synchronous close and puts a retained ordered-out closed window back on the glass)", &.{
|
|
611
|
+
// The show verb: direct on main, dispatch_sync hop otherwise,
|
|
612
|
+
// with the window lookup INSIDE the block so a window closed
|
|
613
|
+
// before an off-main hop lands is a no-op, not a resurrection.
|
|
614
|
+
.{ .path = "src/platform/macos/cef_host.mm", .pattern = "if ([NSThread isMainThread]) {\n showBlock();\n } else {\n dispatch_sync(dispatch_get_main_queue(), showBlock);\n }" },
|
|
615
|
+
// The minimize twin (a queued miniaturize captured past a
|
|
616
|
+
// synchronous close genies an app-closed window into the Dock).
|
|
617
|
+
.{ .path = "src/platform/macos/cef_host.mm", .pattern = "if ([NSThread isMainThread]) {\n miniaturizeBlock();\n } else {\n dispatch_sync(dispatch_get_main_queue(), miniaturizeBlock);\n }" },
|
|
618
|
+
// The C shims return success only after the synchronous verb —
|
|
619
|
+
// no dispatch_async between the lookup and the method call.
|
|
620
|
+
.{ .path = "src/platform/macos/cef_host.mm", .pattern = "if (!object.windows[@(window_id)]) return 0;\n [object miniaturizeWindowWithId:window_id];\n return 1;" },
|
|
621
|
+
.{ .path = "src/platform/macos/cef_host.mm", .pattern = "[object showWindowWithId:window_id];\n return 1;" },
|
|
622
|
+
// The AppKit host's twins are already synchronous direct calls
|
|
623
|
+
// (its runtime callbacks arrive on the main thread); these pins
|
|
624
|
+
// hold that symmetry.
|
|
625
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "[object showWindowWithId:window_id];\n return 1;" },
|
|
626
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "[object miniaturizeWindowWithId:window_id];\n return 1;" },
|
|
627
|
+
});
|
|
569
628
|
// The embedded-WebView layer must stay real AND declare-to-use: the
|
|
570
629
|
// standard build graph puts the vendored WebView2 SDK header on the
|
|
571
630
|
// include path exactly when app.zon declares web use (`if
|
|
@@ -636,6 +695,43 @@ pub fn build(b: *std.Build) void {
|
|
|
636
695
|
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "- (void)requestRetainedCanvasFrame" },
|
|
637
696
|
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "[self requestRetainedCanvasFrame];" },
|
|
638
697
|
});
|
|
698
|
+
addFileContainsCheckStep(b, file_contains_checker, test_step, "test-appkit-pinch-terminal-delta", "Verify the macOS pinch stream forwards a terminal Ended/Cancelled magnification as a change before the end marker", &.{
|
|
699
|
+
// AppKit documents every magnifyWithEvent: as carrying the
|
|
700
|
+
// magnification since the previous event — the terminal one
|
|
701
|
+
// included. The Ended/Cancelled branch must forward a nonzero
|
|
702
|
+
// terminal magnification as PINCH_CHANGE before PINCH_END (zero
|
|
703
|
+
// magnification: end only), or the cumulative product of
|
|
704
|
+
// (1 + delta) diverges from what the OS delivered. Cancelled
|
|
705
|
+
// deliberately shares the path: pinch applies deltas
|
|
706
|
+
// incrementally with no rollback.
|
|
707
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "if (phase & (NSEventPhaseEnded | NSEventPhaseCancelled)) {" },
|
|
708
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "[self emitPinchChangeForEvent:event];\n [self emitPinchInputEventWithKind:NATIVE_SDK_APPKIT_GPU_INPUT_PINCH_END event:event magnification:0];" },
|
|
709
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "PINCH_END event:event magnification:0];" },
|
|
710
|
+
});
|
|
711
|
+
addFileContainsCheckStep(b, file_contains_checker, test_step, "test-appkit-pinch-magnification-doctrine", "Verify the macOS host forwards raw NSEvent.magnification as the multiplicative pinch delta (the engine convention), with the per-event floor", &.{
|
|
712
|
+
// The reading of NSEvent.magnification is SETTLED and this step
|
|
713
|
+
// exists to keep it settled: Apple's API-reference prose says
|
|
714
|
+
// "add", Apple's own Event Handling Guide example multiplies,
|
|
715
|
+
// and every browser engine (WebKit, Chromium) treats raw
|
|
716
|
+
// magnification as the multiplicative per-event delta. The
|
|
717
|
+
// doctrine comment at magnifyWithEvent: carries the receipts;
|
|
718
|
+
// these pins hold both the comment and the code to it. Any
|
|
719
|
+
// sum-based "additive normalization" of magnification must
|
|
720
|
+
// change emitPinchChangeForEvent:'s pinned body — and thereby
|
|
721
|
+
// fail this step, on purpose. Re-read the doctrine comment
|
|
722
|
+
// before touching either.
|
|
723
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "m_magnification += m_magnification * scaleWithResistance;" },
|
|
724
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "pinch_update.scale = event.magnification + 1.0;" },
|
|
725
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "Ruling: raw event.magnification IS the multiplicative per-event" },
|
|
726
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "Do NOT reintroduce a running-sum" },
|
|
727
|
+
// The raw forwarding, pinned as one body: the only transform
|
|
728
|
+
// between the OS and the wire is the per-event floor (a single
|
|
729
|
+
// magnification at or below -1 would emit a factor <= 0 — a
|
|
730
|
+
// zoom inverted through zero scale, physically impossible).
|
|
731
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "static const double NativeSdkPinchMagnificationFloor = -1.0 + 0x1p-10;" },
|
|
732
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "return magnification < NativeSdkPinchMagnificationFloor ? NativeSdkPinchMagnificationFloor : magnification;" },
|
|
733
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "- (void)emitPinchChangeForEvent:(NSEvent *)event {\n const double magnification = NativeSdkClampedPinchMagnification(event.magnification);\n if (magnification == 0) return;\n [self emitPinchInputEventWithKind:NATIVE_SDK_APPKIT_GPU_INPUT_PINCH_CHANGE event:event magnification:magnification];\n}" },
|
|
734
|
+
});
|
|
639
735
|
addFileContainsCheckStep(b, file_contains_checker, test_step, "test-appkit-gpu-input-paces-retained-canvas", "Verify GPU input frame requests are paced to the display interval", &.{
|
|
640
736
|
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "NativeSdkRetainedFrameIntervalNanoseconds" },
|
|
641
737
|
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "retainedFrameLastEmitNs" },
|
|
@@ -652,6 +748,59 @@ pub fn build(b: *std.Build) void {
|
|
|
652
748
|
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "- (void)scheduleFrameEventEmission" },
|
|
653
749
|
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "- (void)emitScheduledFrameEvent" },
|
|
654
750
|
});
|
|
751
|
+
addFileContainsCheckStep(b, file_contains_checker, test_step, "test-quit-stop-queued", "Verify the quit verb's stop is queued to the next loop turn on every synchronous-emit host (a synchronous emitShutdown nests the shutdown dispatch inside the requesting command's dispatch, seals the session journal before the command commits, and replay diverges)", &.{
|
|
752
|
+
// macOS (AppKit and CEF hosts): the main-queue hop, with the
|
|
753
|
+
// pre-run-loop inline fallback the failed-START precedent needs.
|
|
754
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "if (!NSApp.running) {" },
|
|
755
|
+
.{ .path = "src/platform/macos/cef_host.mm", .pattern = "if (!NSApp.running) {" },
|
|
756
|
+
// Linux: the idle hop — the same seam the wake and
|
|
757
|
+
// frame-request paths ride.
|
|
758
|
+
.{ .path = "src/platform/linux/gtk_host.c", .pattern = "static gboolean native_sdk_stop_idle(gpointer data)" },
|
|
759
|
+
.{ .path = "src/platform/linux/gtk_host.c", .pattern = "g_idle_add(native_sdk_stop_idle, host);" },
|
|
760
|
+
// Windows was queued from the start: stop posts, the loop
|
|
761
|
+
// exits, and the shutdown emits after the loop at top level.
|
|
762
|
+
.{ .path = "src/platform/windows/webview2_host.cpp", .pattern = "void native_sdk_windows_stop(Host *host) {" },
|
|
763
|
+
.{ .path = "src/platform/windows/webview2_host.cpp", .pattern = "PostQuitMessage(0);" },
|
|
764
|
+
// The runtime ordering the queue protects: the recorder seals
|
|
765
|
+
// on the shutdown dispatch's exit, and the modeled host's
|
|
766
|
+
// queued seam keeps the runtime suites honest about it.
|
|
767
|
+
.{ .path = "src/runtime/flow.zig", .pattern = "if (event_value == .app_shutdown) recorder.finish();" },
|
|
768
|
+
.{ .path = "src/platform/null_platform.zig", .pattern = "pub fn takeQueuedQuit" },
|
|
769
|
+
});
|
|
770
|
+
addFileContainsCheckStep(b, file_contains_checker, test_step, "test-quit-pre-run-pending", "Verify a PRE-RUN quit verb on the macOS hosts parks as a pending flag drained at top level, never the inline emit (an inline pre-run emit nests the shutdown inside the boot dispatch that requested it — the recorder seals the journal before that dispatch commits, the same bug the running-path queue fixes)", &.{
|
|
771
|
+
// The quit verb's own landing point: pre-run it PARKS — the
|
|
772
|
+
// inline emitShutdown+stop stays exclusive to
|
|
773
|
+
// native_sdk_appkit_stop, the host-side failure request the
|
|
774
|
+
// failed-START precedent rides (runWithCallback's didShutdown
|
|
775
|
+
// check).
|
|
776
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "void native_sdk_appkit_request_stop(native_sdk_appkit_host_t *host) {" },
|
|
777
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "object.pendingPreRunStop = YES;" },
|
|
778
|
+
.{ .path = "src/platform/macos/cef_host.mm", .pattern = "void native_sdk_appkit_request_stop(native_sdk_appkit_host_t *host) {" },
|
|
779
|
+
.{ .path = "src/platform/macos/cef_host.mm", .pattern = "object.pendingPreRunStop = YES;" },
|
|
780
|
+
// The drains: after the START dispatch (at the didShutdown
|
|
781
|
+
// decision point) and after the remaining pre-run dispatches
|
|
782
|
+
// (appearance/resize/window-frame, and AppKit's synchronous
|
|
783
|
+
// first canvas frame) — emitShutdown + stop at TOP LEVEL, once.
|
|
784
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "- (BOOL)drainPendingPreRunStop {\n if (!self.pendingPreRunStop) return NO;\n self.pendingPreRunStop = NO;\n if (self.didShutdown) return NO;\n [self emitShutdown];\n [self stop];\n return YES;\n}" },
|
|
785
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "[self drainPendingPreRunStop];\n // A failed START handler requests shutdown synchronously" },
|
|
786
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "if ([self drainPendingPreRunStop]) return;" },
|
|
787
|
+
.{ .path = "src/platform/macos/cef_host.mm", .pattern = "- (BOOL)drainPendingPreRunStop {\n if (!self.pendingPreRunStop) return NO;\n self.pendingPreRunStop = NO;\n if (self.didShutdown) return NO;\n [self emitShutdown];\n [self stop];\n return YES;\n}" },
|
|
788
|
+
.{ .path = "src/platform/macos/cef_host.mm", .pattern = "[self drainPendingPreRunStop];\n // A failed START handler requests shutdown synchronously" },
|
|
789
|
+
.{ .path = "src/platform/macos/cef_host.mm", .pattern = "if ([self drainPendingPreRunStop]) {\n shutdownCefIfNeeded();\n return;\n }" },
|
|
790
|
+
// The Zig split: the quit verb rides request_stop; the failed
|
|
791
|
+
// emit keeps the byte-for-byte host-side stop.
|
|
792
|
+
.{ .path = "src/platform/macos/root.zig", .pattern = "native_sdk_appkit_request_stop(self.host);" },
|
|
793
|
+
.{ .path = "src/platform/macos/root.zig", .pattern = "if (self.self) |mac| native_sdk_appkit_stop(mac.host);" },
|
|
794
|
+
});
|
|
795
|
+
addFileContainsCheckStep(b, file_contains_checker, test_step, "test-gtk-stop-idle-tracked", "Verify the GTK quit-stop idle source is tracked on the host, coalesced while pending, skipped after shutdown, and removed at destroy (an untracked second g_idle_add leaves a source holding a freed host after the loop quits)", &.{
|
|
796
|
+
.{ .path = "src/platform/linux/gtk_host.c", .pattern = "guint stop_idle_source;" },
|
|
797
|
+
// The idle retires its own tracking before it emits.
|
|
798
|
+
.{ .path = "src/platform/linux/gtk_host.c", .pattern = "host->stop_idle_source = 0;\n if (!host->did_shutdown) {" },
|
|
799
|
+
// Coalesce + post-shutdown skip, then the tracked add.
|
|
800
|
+
.{ .path = "src/platform/linux/gtk_host.c", .pattern = "if (host->did_shutdown || host->stop_idle_source) return;\n host->stop_idle_source = g_idle_add(native_sdk_stop_idle, host);" },
|
|
801
|
+
// Destroy removes a still-pending stop turn.
|
|
802
|
+
.{ .path = "src/platform/linux/gtk_host.c", .pattern = "if (host->stop_idle_source) {\n g_source_remove(host->stop_idle_source);\n host->stop_idle_source = 0;\n }" },
|
|
803
|
+
});
|
|
655
804
|
addFileContainsCheckStep(b, file_contains_checker, test_step, "test-gpu-occluded-frame-heartbeat", "Verify occluded windows throttle frame completions to a heartbeat and restore full cadence on reveal", &.{
|
|
656
805
|
// macOS: occluded surfaces pace logical completions on the ~1 Hz
|
|
657
806
|
// heartbeat (never stopping — on_frame-driven models stay gently
|
|
@@ -668,13 +817,20 @@ pub fn build(b: *std.Build) void {
|
|
|
668
817
|
// sustain a spin.
|
|
669
818
|
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "scheduleFrameEventEmissionForPresentCompletion:YES" },
|
|
670
819
|
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "- (void)noteGpuSurfaceInputActivity" },
|
|
671
|
-
// Windows: the same throttle keyed on the
|
|
672
|
-
// occlusion
|
|
673
|
-
//
|
|
820
|
+
// Windows: the same throttle keyed on the two reliable
|
|
821
|
+
// occlusion facts — minimize (IsIconic) and the close_policy
|
|
822
|
+
// .hide hide (policy_hidden: a hidden menu-bar app must not
|
|
823
|
+
// spin its frame loop or its spectrum emissions full-rate for
|
|
824
|
+
// days). Restore re-arms the pending one-shot timer at the
|
|
825
|
+
// frame-grid delay through WM_SIZE, re-show through the show
|
|
826
|
+
// verb (SW_SHOW dispatches no WM_SIZE), and the input /
|
|
674
827
|
// first-present exemptions ride one prompt-frame flag.
|
|
675
828
|
.{ .path = "src/platform/windows/webview2_host.cpp", .pattern = "kGpuOccludedHeartbeatNs = 1000000000ull" },
|
|
676
829
|
.{ .path = "src/platform/windows/webview2_host.cpp", .pattern = "gpuSurfaceOccludedPacingActive" },
|
|
830
|
+
.{ .path = "src/platform/windows/webview2_host.cpp", .pattern = "owner->second.policy_hidden) return true;" },
|
|
677
831
|
.{ .path = "src/platform/windows/webview2_host.cpp", .pattern = "IsIconic(root)" },
|
|
832
|
+
.{ .path = "src/platform/windows/webview2_host.cpp", .pattern = "!IsIconic(entry.second.hwnd) && !entry.second.policy_hidden" },
|
|
833
|
+
.{ .path = "src/platform/windows/webview2_host.cpp", .pattern = "Re-show returns full frame cadence without dropping a beat" },
|
|
678
834
|
.{ .path = "src/platform/windows/webview2_host.cpp", .pattern = "gpu_prompt_frame_pending" },
|
|
679
835
|
.{ .path = "src/platform/windows/webview2_host.cpp", .pattern = "native_sdk_windows_note_gpu_surface_input" },
|
|
680
836
|
// The runtime side of the measurement honesty: occluded logical
|
|
@@ -768,6 +924,100 @@ pub fn build(b: *std.Build) void {
|
|
|
768
924
|
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "NativeSdkItalicSansFont(base)" },
|
|
769
925
|
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "NativeSdkItalicSansFont(NativeSdkWeightedSansFont(@[ @\"Geist-Bold\", @\"Geist Bold\" ], base, NSFontWeightBold, YES, size))" },
|
|
770
926
|
});
|
|
927
|
+
addFileContainsCheckStep(b, file_contains_checker, test_step, "test-appkit-registered-font-cache-eviction", "Verify the AppKit host invalidates BOTH per-process registered-font caches at registration (the caches are per-process while font-id permanence is per-runtime, so a new runtime re-registering an id must never resolve the previous runtime's face or its measured widths): the NSFont size cache by prefix eviction and the measured-width NSCache by a process-global registration token in its key", &.{
|
|
928
|
+
// No SDK test tier links appkit_host.m (only managed app builds
|
|
929
|
+
// compile it), so the eviction wiring is pinned textually like
|
|
930
|
+
// the other AppKit host contracts: the shared accessor both the
|
|
931
|
+
// resolve and registration paths use, the prefix eviction inside
|
|
932
|
+
// register_font, and the honest lifetime comment.
|
|
933
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "static NSMutableDictionary<NSString *, NSFont *> *NativeSdkRegisteredFontSizeCache(void)" },
|
|
934
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "NSString *stalePrefix = [NSString stringWithFormat:@\"%llu/\", (unsigned long long)font_id];" },
|
|
935
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "if ([cachedKey hasPrefix:stalePrefix]) [sizeCache removeObjectForKey:cachedKey];" },
|
|
936
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "an id is only permanent within" },
|
|
937
|
+
// The width-cache half: NSCache cannot enumerate keys, so the
|
|
938
|
+
// measured-width cache is invalidated by a registration token
|
|
939
|
+
// drawn from one process-global monotonic counter (tokens never
|
|
940
|
+
// repeat, which is what lets unregister DELETE an id's record
|
|
941
|
+
// instead of retaining a bumped one per retired id) — the token
|
|
942
|
+
// table, the fresh stamp inside register_font, and the
|
|
943
|
+
// token-carrying key inside measure_text.
|
|
944
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "static NSMutableDictionary<NSNumber *, NSNumber *> *NativeSdkRegisteredFontTokens(void)" },
|
|
945
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "unsigned long long token = ++NativeSdkRegisteredFontTokenCounter;" },
|
|
946
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "NativeSdkRegisteredFontTokens()[@(font_id)] = @(token);" },
|
|
947
|
+
// The stamp is also the registration's OWNERSHIP token: register
|
|
948
|
+
// reports it to the caller (`*out_token`), the runtime stores it
|
|
949
|
+
// beside the captured unregister owner, and unregister removes
|
|
950
|
+
// the id's state only while the id's current registration still
|
|
951
|
+
// carries it — an older runtime's deinit must never tear down a
|
|
952
|
+
// newer runtime's live face under a shared id (ids are
|
|
953
|
+
// per-runtime, host font state is per-process, last wins).
|
|
954
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "*out_token = token;" },
|
|
955
|
+
// The token and the registered face reach measure_text from ONE
|
|
956
|
+
// critical section (the snapshot helper): separate acquisitions
|
|
957
|
+
// let a registration land between the token read and the face
|
|
958
|
+
// resolution, pairing token 0 with the new registered face and
|
|
959
|
+
// caching registered widths under the reusable token-0 key —
|
|
960
|
+
// stale registered widths served after teardown. The snapshot
|
|
961
|
+
// signature and its measure_text call site are pinned so the
|
|
962
|
+
// two-acquisition shape cannot quietly return.
|
|
963
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "static NSFont *NativeSdkRegisteredFontSnapshot(unsigned long long value, CGFloat size, unsigned long long *out_token)" },
|
|
964
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "NSFont *registered = NativeSdkRegisteredFontSnapshot((unsigned long long)font_id, clamped, &token);" },
|
|
965
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "NSFont *font = registered ?: NativeSdkBuiltInFontForFontId(font_id, clamped);" },
|
|
966
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "[NSString stringWithFormat:@\"%llu/%llu/%.3f/%@\", (unsigned long long)font_id, token, (double)clamped, value]" },
|
|
967
|
+
// The width-cache WRITE is token-rechecked. Shaping runs outside
|
|
968
|
+
// the guard, so an unregister can land inside the shaping window:
|
|
969
|
+
// it clears the whole width cache (its only possible eviction),
|
|
970
|
+
// and an unconditional post-shape write would then repopulate the
|
|
971
|
+
// cleared cache with a retired-token entry — unreachable for
|
|
972
|
+
// serving (tokens never repeat) but resident until memory
|
|
973
|
+
// pressure, breaking the zero-retained-state teardown the clear
|
|
974
|
+
// exists to guarantee. measure_text therefore re-enters the
|
|
975
|
+
// descriptor guard after shaping and writes only while the id's
|
|
976
|
+
// current token still equals the snapshotted one; token 0
|
|
977
|
+
// (built-in resolution — never registered, so never cleared)
|
|
978
|
+
// caches without the recheck. Both branches are pinned so the
|
|
979
|
+
// unconditional-write shape cannot quietly return.
|
|
980
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "if (token == 0) {" },
|
|
981
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "NSNumber *currentToken = NativeSdkRegisteredFontTokens()[@(font_id)];" },
|
|
982
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "if (currentToken && currentToken.unsignedLongLongValue == token) {" },
|
|
983
|
+
// The teardown half: Runtime.deinit returns the host-side
|
|
984
|
+
// registration through the unregister owner each font entry
|
|
985
|
+
// captured at registration time (never live `options.platform`,
|
|
986
|
+
// which is publicly mutable), and the ObjC removal drops the
|
|
987
|
+
// descriptor, the size-cache entries, AND the token record —
|
|
988
|
+
// zero retained state per retired id. Pinned like the
|
|
989
|
+
// registration half (appkit_host.m has no SDK test tier); the
|
|
990
|
+
// capture and the deinit call site are pinned too so the seam
|
|
991
|
+
// can never silently lose its one caller or regress to the live
|
|
992
|
+
// read, and the embed cycle and platform-swap tests assert both
|
|
993
|
+
// behaviorally against null platform recorders.
|
|
994
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "int native_sdk_appkit_unregister_font(uint64_t font_id, uint64_t token) {" },
|
|
995
|
+
// The token-match guard itself: reverting removal to id-keyed
|
|
996
|
+
// (deleting whatever the id currently holds, whoever registered
|
|
997
|
+
// it) must fail here — the embed suite's survives-teardown test
|
|
998
|
+
// pins the same guard behaviorally against the null platform's
|
|
999
|
+
// host-font mirror.
|
|
1000
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "if (!current || current.unsignedLongLongValue != token) return 1;" },
|
|
1001
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "[NativeSdkRegisteredFontTokens() removeObjectForKey:@(font_id)];" },
|
|
1002
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "[table removeObjectForKey:@(font_id)];" },
|
|
1003
|
+
// Teardown must also CLEAR the measured-width NSCache: a
|
|
1004
|
+
// retiring token's entries can never be served again (tokens
|
|
1005
|
+
// never repeat) but they stay resident until memory pressure,
|
|
1006
|
+
// and NSCache cannot enumerate keys, so the whole-cache clear on
|
|
1007
|
+
// the token-matched path is the only release. Pinned textually
|
|
1008
|
+
// because no behavioral tier can observe it — only managed app
|
|
1009
|
+
// builds compile appkit_host.m, so no SDK test can watch the
|
|
1010
|
+
// ObjC cache empty. The shared accessor and its measure_text
|
|
1011
|
+
// call site are pinned with the clear so the cache cannot
|
|
1012
|
+
// quietly retreat to a function-local static the unregister
|
|
1013
|
+
// path has no way to reach.
|
|
1014
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "static NSCache<NSString *, NSNumber *> *NativeSdkMeasuredWidthCache(void)" },
|
|
1015
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "[NativeSdkMeasuredWidthCache() removeAllObjects];" },
|
|
1016
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "NSCache<NSString *, NSNumber *> *widthCache = NativeSdkMeasuredWidthCache();" },
|
|
1017
|
+
.{ .path = "src/runtime/canvas_fonts.zig", .pattern = ".host_unregister_fn = services.unregister_gpu_surface_font_fn," },
|
|
1018
|
+
.{ .path = "src/runtime/canvas_fonts.zig", .pattern = ".host_registration_token = host_token," },
|
|
1019
|
+
.{ .path = "src/runtime/core.zig", .pattern = "host_unregister_fn(entry.host_unregister_context, entry.id, entry.host_registration_token) catch {};" },
|
|
1020
|
+
});
|
|
771
1021
|
addFileContainsCheckStep(b, file_contains_checker, test_step, "test-appkit-gpu-widget-cursor-bridge", "Verify AppKit GPU widgets apply retained cursor intent", &.{
|
|
772
1022
|
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "native_sdk_appkit_set_view_cursor" },
|
|
773
1023
|
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "resetCursorRects" },
|
|
@@ -875,9 +1125,19 @@ pub fn build(b: *std.Build) void {
|
|
|
875
1125
|
for (desktop_test_shard_specs, desktop_test_shards) |spec, shard_tests| {
|
|
876
1126
|
addTestStep(b, b.fmt("test-desktop-{s}", .{spec.name}), spec.description, shard_tests);
|
|
877
1127
|
}
|
|
1128
|
+
// The font-registry suite as its own step so CI lanes on real
|
|
1129
|
+
// Windows hardware can run it natively: the whole font pipeline
|
|
1130
|
+
// (TrueType parsing, glyph rasterization, the reference renderer)
|
|
1131
|
+
// is platform-neutral Zig, and this suite's Chinese-receipt test
|
|
1132
|
+
// registers a committed CJK face through the app-fonts seam and
|
|
1133
|
+
// proves the rendered string is real glyphs, not tofu — running it
|
|
1134
|
+
// on a Windows runner makes that a Windows-native receipt. The same
|
|
1135
|
+
// tests also run inside `zig build test` via the canvas-frame shard.
|
|
1136
|
+
addTestStep(b, "test-canvas-fonts", "Run the runtime font-registry tests (includes the registered-CJK Chinese receipt)", filteredTestArtifact(b, desktop_mod, "canvas-fonts-tests", &.{"runtime.canvas_font_tests.test"}));
|
|
878
1137
|
addTestStep(b, "test-automation-protocol", "Run automation protocol tests", automation_protocol_tests);
|
|
879
1138
|
addTestStep(b, "test-automation-cli", "Run native automate CLI tests", automation_cli_tests);
|
|
880
1139
|
addTestStep(b, "test-markup-cli", "Run native markup CLI tests", markup_cli_tests);
|
|
1140
|
+
addTestStep(b, "test-evals-cmdview", "Run the evals harness Cmd wire decoder tests", evals_cmdview_tests);
|
|
881
1141
|
addTestStep(b, "test-tooling", "Run Native SDK tooling tests", tooling_tests);
|
|
882
1142
|
addTestStep(b, "test-eject-components", "Run ejected-component widget-identity tests", eject_components_tests);
|
|
883
1143
|
|
|
@@ -1008,6 +1268,7 @@ pub fn build(b: *std.Build) void {
|
|
|
1008
1268
|
addExampleTestStep(b, host_cli_exe, native_examples_step, "test-example-system-monitor", "Run system monitor example tests", "examples/system-monitor", .managed);
|
|
1009
1269
|
addExampleTestStep(b, host_cli_exe, native_examples_step, "test-example-system-monitor-ts", "Run system-monitor-ts example tests", "examples/system-monitor-ts", .managed);
|
|
1010
1270
|
addExampleTestStep(b, host_cli_exe, native_examples_step, "test-example-effects-probe", "Run effects probe example tests", "examples/effects-probe", .managed);
|
|
1271
|
+
addExampleTestStep(b, host_cli_exe, native_examples_step, "test-example-menu-bar", "Run menu-bar lifecycle example tests", "examples/menu-bar", .managed);
|
|
1011
1272
|
addExampleTestStep(b, host_cli_exe, native_examples_step, "test-example-feed", "Run feed example tests", "examples/feed", .managed);
|
|
1012
1273
|
addExampleTestStep(b, host_cli_exe, native_examples_step, "test-example-canvas-preview", "Run canvas preview example tests", "examples/canvas-preview", .managed);
|
|
1013
1274
|
addExampleTestStep(b, host_cli_exe, native_examples_step, "test-example-capabilities", "Run capabilities example tests", "examples/capabilities", .owned);
|
package/native-sdk.d.ts
CHANGED
|
@@ -25,6 +25,8 @@ export interface NativeSdkWindowInfo {
|
|
|
25
25
|
title: string;
|
|
26
26
|
open: boolean;
|
|
27
27
|
focused: boolean;
|
|
28
|
+
/** Alive but hidden by `close_policy = "hide"` — still open, not focused, invisible until re-shown. */
|
|
29
|
+
hidden: boolean;
|
|
28
30
|
x: number;
|
|
29
31
|
y: number;
|
|
30
32
|
width: number;
|
|
@@ -419,7 +421,21 @@ export type NativeSdkPlatformFeature =
|
|
|
419
421
|
| "app_activation_events"
|
|
420
422
|
| "appActivationEvents"
|
|
421
423
|
| "gpu_surfaces"
|
|
422
|
-
| "gpuSurfaces"
|
|
424
|
+
| "gpuSurfaces"
|
|
425
|
+
| "gpu_surface_scroll_drivers"
|
|
426
|
+
| "gpuSurfaceScrollDrivers"
|
|
427
|
+
| "context_menus"
|
|
428
|
+
| "contextMenus"
|
|
429
|
+
| "view_surface_adoption"
|
|
430
|
+
| "viewSurfaceAdoption"
|
|
431
|
+
| "audio_playback"
|
|
432
|
+
| "audioPlayback"
|
|
433
|
+
| "audio_streaming"
|
|
434
|
+
| "audioStreaming"
|
|
435
|
+
| "audio_spectrum"
|
|
436
|
+
| "audioSpectrum"
|
|
437
|
+
| "window_hide_on_close"
|
|
438
|
+
| "windowHideOnClose";
|
|
423
439
|
|
|
424
440
|
export type NativeSdkPlatformFeatureSelector =
|
|
425
441
|
| { feature: NativeSdkPlatformFeature; name?: never }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@native-sdk/cli",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4",
|
|
4
4
|
"description": "The Native SDK: the complete toolkit for building native desktop applications — declarative markup, native rendering, WebView surfaces, and OS capabilities",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -32,14 +32,14 @@
|
|
|
32
32
|
"@typescript/typescript6": "6.0.2"
|
|
33
33
|
},
|
|
34
34
|
"optionalDependencies": {
|
|
35
|
-
"@native-sdk/cli-darwin-arm64": "0.5.
|
|
36
|
-
"@native-sdk/cli-darwin-x64": "0.5.
|
|
37
|
-
"@native-sdk/cli-linux-arm64-gnu": "0.5.
|
|
38
|
-
"@native-sdk/cli-linux-arm64-musl": "0.5.
|
|
39
|
-
"@native-sdk/cli-linux-x64-gnu": "0.5.
|
|
40
|
-
"@native-sdk/cli-linux-x64-musl": "0.5.
|
|
41
|
-
"@native-sdk/cli-win32-arm64": "0.5.
|
|
42
|
-
"@native-sdk/cli-win32-x64": "0.5.
|
|
35
|
+
"@native-sdk/cli-darwin-arm64": "0.5.4",
|
|
36
|
+
"@native-sdk/cli-darwin-x64": "0.5.4",
|
|
37
|
+
"@native-sdk/cli-linux-arm64-gnu": "0.5.4",
|
|
38
|
+
"@native-sdk/cli-linux-arm64-musl": "0.5.4",
|
|
39
|
+
"@native-sdk/cli-linux-x64-gnu": "0.5.4",
|
|
40
|
+
"@native-sdk/cli-linux-x64-musl": "0.5.4",
|
|
41
|
+
"@native-sdk/cli-win32-arm64": "0.5.4",
|
|
42
|
+
"@native-sdk/cli-win32-x64": "0.5.4"
|
|
43
43
|
},
|
|
44
44
|
"repository": {
|
|
45
45
|
"type": "git",
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@native-sdk/core",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@native-sdk/core",
|
|
9
|
-
"version": "0.5.
|
|
9
|
+
"version": "0.5.4",
|
|
10
10
|
"devDependencies": {
|
|
11
11
|
"@typescript/old": "npm:typescript@6.0.3",
|
|
12
12
|
"@typescript/typescript6": "6.0.2"
|