@native-sdk/cli 0.9.1 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/app.zig +26 -9
- package/build.zig +124 -1
- package/package.json +9 -9
- package/packages/core/package-lock.json +2 -2
- package/packages/core/package.json +1 -1
- package/packages/core/sdk/core.ts +3 -1
- package/packages/core/sdk/events.d.ts +7 -0
- package/packages/core/sdk/events.ts +26 -5
- package/packages/core/sdk/text.d.ts +4 -0
- package/packages/core/sdk/text.ts +51 -0
- package/packages/core/src/checker.ts +58 -1
- package/packages/core/src/contract.ts +5 -4
- package/packages/core/src/devhost_journal.mjs +2 -2
- package/packages/core/src/diagnostics.ts +2 -2
- package/packages/core/src/service_contract.ts +10 -0
- package/packages/core/src/typed_ast.ts +9 -7
- package/packages/core/src/types.ts +28 -8
- package/skill-data/automation/SKILL.md +4 -3
- package/skill-data/native-ui/SKILL.md +10 -8
- package/skill-data/ts-core/SKILL.md +8 -5
- package/src/app_runner/root.zig +301 -12
- package/src/app_runner/ts_core_main.zig +6 -4
- package/src/app_runner/window_placement.zig +63 -0
- package/src/automation/protocol.zig +5 -1
- package/src/automation/snapshot.zig +119 -0
- package/src/embed/app_exports.zig +2 -1
- package/src/embed/conversions.zig +1 -0
- package/src/embed/host.zig +10 -3
- package/src/embed/root.zig +1 -0
- package/src/embed/tests.zig +13 -1
- package/src/embed/types.zig +2 -0
- package/src/embed/ui_host.zig +26 -2
- package/src/platform/android/NativeSdkActivity.java +49 -4
- package/src/platform/android/android_host.c +3 -3
- package/src/platform/android/native_sdk_app.h +1 -1
- package/src/platform/ios/apple_image_fit.h +38 -0
- package/src/platform/ios/files.zig +1 -0
- package/src/platform/ios/native_sdk_app.h +1 -1
- package/src/platform/ios/uikit_host.m +28 -5
- package/src/platform/linux/cef_host.cpp +10 -2
- package/src/platform/linux/gtk_host.c +43 -10
- package/src/platform/linux/gtk_host.h +3 -3
- package/src/platform/linux/root.zig +22 -7
- package/src/platform/macos/appkit_host.h +7 -4
- package/src/platform/macos/appkit_host.m +271 -52
- package/src/platform/macos/cef_host.mm +132 -34
- package/src/platform/macos/image_fit_test.m +44 -0
- package/src/platform/macos/root.zig +222 -14
- package/src/platform/null_platform.zig +17 -3
- package/src/platform/null_platform_tests.zig +58 -4
- package/src/platform/root.zig +2 -0
- package/src/platform/types.zig +69 -19
- package/src/platform/windows/root.zig +22 -7
- package/src/platform/windows/webview2_host.cpp +31 -6
- package/src/primitives/app_manifest/root.zig +3 -0
- package/src/primitives/app_manifest/tests.zig +24 -0
- package/src/primitives/app_manifest/types.zig +13 -0
- package/src/primitives/app_manifest/validation.zig +24 -0
- package/src/primitives/canvas/a11y_audit.zig +9 -7
- package/src/primitives/canvas/a11y_audit_tests.zig +24 -0
- package/src/primitives/canvas/events.zig +129 -1
- package/src/primitives/canvas/layout_audit.zig +6 -6
- package/src/primitives/canvas/markdown.zig +4 -0
- package/src/primitives/canvas/markdown_tests.zig +1 -0
- package/src/primitives/canvas/png.zig +138 -0
- package/src/primitives/canvas/root.zig +14 -2
- package/src/primitives/canvas/text_interaction.zig +23 -0
- package/src/primitives/canvas/text_span_tests.zig +5 -3
- package/src/primitives/canvas/text_spans.zig +2 -0
- package/src/primitives/canvas/text_tests.zig +65 -0
- package/src/primitives/canvas/ui.zig +66 -10
- package/src/primitives/canvas/ui_markup.zig +40 -13
- package/src/primitives/canvas/ui_markup_binary.zig +8 -6
- package/src/primitives/canvas/ui_markup_binary_tests.zig +14 -4
- package/src/primitives/canvas/ui_markup_compiled.zig +5 -1
- package/src/primitives/canvas/ui_markup_compiled_tests.zig +55 -0
- package/src/primitives/canvas/ui_markup_reflect.zig +6 -5
- package/src/primitives/canvas/ui_markup_tests.zig +11 -2
- package/src/primitives/canvas/ui_markup_view.zig +8 -2
- package/src/primitives/canvas/ui_markup_view_tests.zig +67 -6
- package/src/primitives/canvas/ui_schema.zig +17 -13
- package/src/primitives/canvas/ui_tests.zig +84 -0
- package/src/primitives/canvas/widget_access.zig +3 -3
- package/src/primitives/canvas/widget_anchored_tests.zig +106 -0
- package/src/primitives/canvas/widget_builtin_tests.zig +593 -32
- package/src/primitives/canvas/widget_invalidation.zig +33 -6
- package/src/primitives/canvas/widget_layout.zig +333 -126
- package/src/primitives/canvas/widget_layout_tests.zig +169 -0
- package/src/primitives/canvas/widget_metrics.zig +7 -8
- package/src/primitives/canvas/widget_render.zig +76 -44
- package/src/primitives/canvas/widget_render_controls.zig +110 -32
- package/src/primitives/canvas/widget_render_style.zig +58 -18
- package/src/primitives/canvas/widget_render_surfaces.zig +45 -14
- package/src/primitives/canvas/widget_routing.zig +40 -34
- package/src/primitives/canvas/widget_runtime.zig +11 -2
- package/src/primitives/canvas/widget_runtime_tests.zig +10 -14
- package/src/primitives/canvas/widget_semantics.zig +8 -3
- package/src/primitives/canvas/widget_semantics_tests.zig +6 -2
- package/src/primitives/canvas/widget_tree.zig +99 -5
- package/src/primitives/canvas/widgets.zig +20 -7
- package/src/root.zig +3 -0
- package/src/runtime/api.zig +6 -0
- package/src/runtime/automation_snapshot.zig +4 -0
- package/src/runtime/automation_widget_dispatch.zig +48 -6
- package/src/runtime/builtin_bridge.zig +5 -2
- package/src/runtime/canvas_frame_packet_tests.zig +22 -13
- package/src/runtime/canvas_image_tests.zig +146 -2
- package/src/runtime/canvas_images.zig +35 -16
- package/src/runtime/canvas_limits.zig +13 -3
- package/src/runtime/canvas_widget_accessibility_tests.zig +279 -4
- package/src/runtime/canvas_widget_anchored_tests.zig +54 -0
- package/src/runtime/canvas_widget_control_tests.zig +33 -1
- package/src/runtime/canvas_widget_events.zig +151 -26
- package/src/runtime/canvas_widget_floating_tests.zig +48 -0
- package/src/runtime/canvas_widget_runtime.zig +322 -102
- package/src/runtime/canvas_widget_scroll_driver_tests.zig +34 -0
- package/src/runtime/canvas_widget_scroll_drivers.zig +12 -10
- package/src/runtime/canvas_widget_scroll_tests.zig +193 -2
- package/src/runtime/canvas_widget_semantics_tests.zig +337 -3
- package/src/runtime/canvas_widget_split_tree_tests.zig +55 -0
- package/src/runtime/canvas_widget_state.zig +33 -7
- package/src/runtime/canvas_widget_text_tests.zig +124 -0
- package/src/runtime/core.zig +16 -0
- package/src/runtime/effects.zig +14 -14
- package/src/runtime/effects_image_tests.zig +91 -0
- package/src/runtime/gpu_surface_events.zig +25 -2
- package/src/runtime/native_command_event_tests.zig +29 -0
- package/src/runtime/root.zig +2 -0
- package/src/runtime/session_journal.zig +21 -2
- package/src/runtime/session_replay.zig +13 -8
- package/src/runtime/session_tests.zig +111 -4
- package/src/runtime/shell_layout_tests.zig +12 -0
- package/src/runtime/ts_core_host_tests.zig +47 -0
- package/src/runtime/ts_ui_app.zig +164 -1
- package/src/runtime/ui_app.zig +100 -21
- package/src/runtime/ui_app_tests.zig +351 -32
- package/src/runtime/ui_app_window_tests.zig +13 -1
- package/src/runtime/view.zig +3 -0
- package/src/runtime/view_widget_control.zig +18 -0
- package/src/runtime/view_widget_scroll.zig +112 -18
- package/src/runtime/view_widget_text.zig +1 -1
- package/src/runtime/view_widget_tree.zig +110 -13
- package/src/runtime/widget_bridge.zig +2 -0
- package/src/runtime/window_command_bridge_tests.zig +86 -0
- package/src/runtime/window_storage.zig +16 -1
- package/src/runtime/window_views.zig +1 -0
- package/src/tooling/ios.zig +3 -0
- package/src/tooling/manifest.zig +90 -2
- package/src/tooling/package.zig +67 -2
- package/src/tooling/raw_manifest.zig +10 -0
- package/src/tooling/templates.zig +128 -18
- package/src/tooling/verbs.zig +1 -0
- package/src/tooling/web_engine.zig +1 -1
- package/tools/corewire/emit.zig +31 -12
- package/tools/corewire/emit_facade.zig +57 -2
- package/tools/corewire/shim_rt.zig +20 -0
package/build/app.zig
CHANGED
|
@@ -1254,6 +1254,9 @@ pub const MobileLibOptions = struct {
|
|
|
1254
1254
|
filesystem_permission: bool = false,
|
|
1255
1255
|
/// Stable app identity used as the Keychain/Keystore service namespace.
|
|
1256
1256
|
credentials_service: []const u8 = "dev.native_sdk.app",
|
|
1257
|
+
/// Frozen registered-image pixel budget. Standard app builds infer it
|
|
1258
|
+
/// from app.zon; low-level embedders default to the SDK's 1 MiB tier.
|
|
1259
|
+
max_image_pixel_bytes: usize = 1024 * 1024,
|
|
1257
1260
|
/// A TypeScript core's staged mobile wiring: set by `addAppArtifacts`
|
|
1258
1261
|
/// when the tree carries src/core.ts. The `app` module roots at the
|
|
1259
1262
|
/// staged mobile entry instead of `main`, and the compiled core (and
|
|
@@ -1318,6 +1321,7 @@ fn addMobileLibWithTarget(b: *std.Build, dep: *std.Build.Dependency, target: std
|
|
|
1318
1321
|
mobile_options.addOption(bool, "credentials_permission", options.credentials_permission);
|
|
1319
1322
|
mobile_options.addOption(bool, "filesystem_permission", options.filesystem_permission);
|
|
1320
1323
|
mobile_options.addOption([]const u8, "credentials_service", options.credentials_service);
|
|
1324
|
+
mobile_options.addOption(usize, "max_image_pixel_bytes", options.max_image_pixel_bytes);
|
|
1321
1325
|
exports_mod.addImport("mobile_build_options", mobile_options.createModule());
|
|
1322
1326
|
const migration_path = options.relational_migrations orelse dep.path("src/app_runner/no_migrations.zig");
|
|
1323
1327
|
const migration_mod = b.createModule(.{ .root_source_file = migration_path, .target = target, .optimize = optimize });
|
|
@@ -1515,6 +1519,7 @@ pub fn addAppArtifacts(b: *std.Build, dep: *std.Build.Dependency, app_options: A
|
|
|
1515
1519
|
.credentials_permission = app_config.credentials_permission,
|
|
1516
1520
|
.filesystem_permission = app_config.filesystem_permission,
|
|
1517
1521
|
.credentials_service = app_config.app_id,
|
|
1522
|
+
.max_image_pixel_bytes = app_config.max_image_pixel_bytes,
|
|
1518
1523
|
.ts_core = if (ts_stage) |stage| .{
|
|
1519
1524
|
.main_root = stage.mobile_root,
|
|
1520
1525
|
.archive = stage.archive,
|
|
@@ -1850,19 +1855,23 @@ fn appModule(b: *std.Build, dep: *std.Build.Dependency, target: std.Build.Resolv
|
|
|
1850
1855
|
});
|
|
1851
1856
|
app_mod.link_libc = true;
|
|
1852
1857
|
}
|
|
1853
|
-
|
|
1858
|
+
addMacosInfoPlist(b, app_mod, target, app_config);
|
|
1854
1859
|
return app_mod;
|
|
1855
1860
|
}
|
|
1856
1861
|
|
|
1857
1862
|
/// Bare Mach-O executables launched by the dev loop do not have an app
|
|
1858
|
-
/// bundle's external Info.plist.
|
|
1859
|
-
///
|
|
1860
|
-
///
|
|
1861
|
-
/// their richer external plist generated by package.zig.
|
|
1862
|
-
fn
|
|
1863
|
+
/// bundle's external Info.plist. Embed launch policy plus capture usage
|
|
1864
|
+
/// strings in the conventional section so LaunchServices starts accessory
|
|
1865
|
+
/// apps without a transient Dock tile and capture consent can be presented.
|
|
1866
|
+
/// Packaged apps retain their richer external plist generated by package.zig.
|
|
1867
|
+
fn addMacosInfoPlist(b: *std.Build, app_mod: *std.Build.Module, target: std.Build.ResolvedTarget, config: AppManifestBuildConfig) void {
|
|
1863
1868
|
if (target.result.os.tag != .macos) return;
|
|
1864
|
-
if (!config.microphone_permission and !config.system_audio_permission) return;
|
|
1869
|
+
if (config.dock_visible and !config.microphone_permission and !config.system_audio_permission) return;
|
|
1865
1870
|
|
|
1871
|
+
const launch_policy = if (!config.dock_visible)
|
|
1872
|
+
" <key>LSUIElement</key>\\n <true/>\\n"
|
|
1873
|
+
else
|
|
1874
|
+
"";
|
|
1866
1875
|
const microphone = if (config.microphone_permission)
|
|
1867
1876
|
" <key>NSMicrophoneUsageDescription</key>\\n <string>This app captures microphone audio when you start recording.</string>\\n"
|
|
1868
1877
|
else
|
|
@@ -1873,11 +1882,11 @@ fn addMacosPrivacyInfoPlist(b: *std.Build, app_mod: *std.Build.Module, target: s
|
|
|
1873
1882
|
else
|
|
1874
1883
|
"";
|
|
1875
1884
|
const source = b.fmt(
|
|
1876
|
-
\\#define NATIVE_SDK_INFO_PLIST "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n" "<plist version=\"1.0\">\n<dict>\n{s}{s}</dict>\n</plist>\n"
|
|
1885
|
+
\\#define NATIVE_SDK_INFO_PLIST "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n" "<plist version=\"1.0\">\n<dict>\n{s}{s}{s}</dict>\n</plist>\n"
|
|
1877
1886
|
\\__attribute__((used, section("__TEXT,__info_plist")))
|
|
1878
1887
|
\\static const unsigned char native_sdk_info_plist[sizeof(NATIVE_SDK_INFO_PLIST) - 1] = NATIVE_SDK_INFO_PLIST;
|
|
1879
1888
|
\\
|
|
1880
|
-
, .{ microphone, system_audio });
|
|
1889
|
+
, .{ launch_policy, microphone, system_audio });
|
|
1881
1890
|
const generated = b.addWriteFiles().add("native_sdk_macos_info_plist.c", source);
|
|
1882
1891
|
app_mod.addCSourceFile(.{ .file = generated, .flags = &.{} });
|
|
1883
1892
|
}
|
|
@@ -2481,6 +2490,7 @@ const AppManifestBuildConfig = struct {
|
|
|
2481
2490
|
cef_dir: []const u8 = "third_party/cef/macos",
|
|
2482
2491
|
cef_auto_install: bool = false,
|
|
2483
2492
|
webview_layer: WebLayerOption = .auto,
|
|
2493
|
+
dock_visible: bool = true,
|
|
2484
2494
|
microphone_permission: bool = false,
|
|
2485
2495
|
system_audio_permission: bool = false,
|
|
2486
2496
|
persist_capability: bool = false,
|
|
@@ -2493,6 +2503,7 @@ const AppManifestBuildConfig = struct {
|
|
|
2493
2503
|
credentials_capability: bool = false,
|
|
2494
2504
|
credentials_permission: bool = false,
|
|
2495
2505
|
filesystem_permission: bool = false,
|
|
2506
|
+
max_image_pixel_bytes: usize = 1024 * 1024,
|
|
2496
2507
|
sqlite_capability: bool = false,
|
|
2497
2508
|
/// The first web declaration found (for teaching messages), or null
|
|
2498
2509
|
/// when app.zon declares no web use. `web_engine = "system"` alone is
|
|
@@ -2514,6 +2525,7 @@ const InferenceManifest = struct {
|
|
|
2514
2525
|
id: []const u8 = "dev.native_sdk.app",
|
|
2515
2526
|
capabilities: []const []const u8 = &.{},
|
|
2516
2527
|
permissions: []const []const u8 = &.{},
|
|
2528
|
+
dock_visible: bool = true,
|
|
2517
2529
|
web_engine: []const u8 = "system",
|
|
2518
2530
|
webview_layer: []const u8 = "auto",
|
|
2519
2531
|
core_compiler: []const u8 = "external",
|
|
@@ -2525,6 +2537,9 @@ const InferenceManifest = struct {
|
|
|
2525
2537
|
persist: ?struct {
|
|
2526
2538
|
version: u64,
|
|
2527
2539
|
} = null,
|
|
2540
|
+
images: struct {
|
|
2541
|
+
max_image_pixel_bytes: usize = 1024 * 1024,
|
|
2542
|
+
} = .{},
|
|
2528
2543
|
service_packages: []const ServicePackageConfig = &.{},
|
|
2529
2544
|
service_carrier: []const u8 = "auto",
|
|
2530
2545
|
service_pool_size: u8 = 0,
|
|
@@ -2575,6 +2590,7 @@ fn appManifestBuildConfig(b: *std.Build, app_root: []const u8) AppManifestBuildC
|
|
|
2575
2590
|
.cef_dir = raw.cef.dir,
|
|
2576
2591
|
.cef_auto_install = raw.cef.auto_install,
|
|
2577
2592
|
.webview_layer = web_layer_contract.parseWebViewLayer(raw.webview_layer) orelse @panic("app.zon .webview_layer must be \"auto\", \"include\", or \"exclude\""),
|
|
2593
|
+
.dock_visible = raw.dock_visible,
|
|
2578
2594
|
.microphone_permission = hasManifestPermission(raw.permissions, "microphone"),
|
|
2579
2595
|
.system_audio_permission = hasManifestPermission(raw.permissions, "system_audio"),
|
|
2580
2596
|
.persist_capability = hasManifestCapability(raw.capabilities, "persist"),
|
|
@@ -2587,6 +2603,7 @@ fn appManifestBuildConfig(b: *std.Build, app_root: []const u8) AppManifestBuildC
|
|
|
2587
2603
|
.credentials_capability = hasManifestCapability(raw.capabilities, "credentials"),
|
|
2588
2604
|
.credentials_permission = hasManifestPermission(raw.permissions, "credentials"),
|
|
2589
2605
|
.filesystem_permission = hasManifestPermission(raw.permissions, "filesystem"),
|
|
2606
|
+
.max_image_pixel_bytes = raw.images.max_image_pixel_bytes,
|
|
2590
2607
|
.sqlite_capability = hasManifestCapability(raw.capabilities, "store") or hasManifestCapability(raw.capabilities, "sqlite"),
|
|
2591
2608
|
.web_declaration = web_layer_contract.manifestDeclaration(raw),
|
|
2592
2609
|
};
|
package/build.zig
CHANGED
|
@@ -206,7 +206,38 @@ pub fn build(b: *std.Build) void {
|
|
|
206
206
|
else
|
|
207
207
|
sqliteCompileFlags(),
|
|
208
208
|
});
|
|
209
|
+
const app_runner_window_placement_mod = module(b, target, optimize, "src/app_runner/window_placement.zig");
|
|
210
|
+
app_runner_window_placement_mod.addImport("native_sdk", desktop_mod);
|
|
211
|
+
const app_runner_window_placement_tests = testArtifact(b, app_runner_window_placement_mod);
|
|
212
|
+
const app_runner_options = b.addOptions();
|
|
213
|
+
app_runner_options.addOption([]const u8, "platform", "null");
|
|
214
|
+
app_runner_options.addOption([]const u8, "trace", "off");
|
|
215
|
+
app_runner_options.addOption([]const u8, "web_engine", "system");
|
|
216
|
+
app_runner_options.addOption(bool, "debug_overlay", false);
|
|
217
|
+
app_runner_options.addOption(bool, "automation", false);
|
|
218
|
+
app_runner_options.addOption(bool, "web_layer", false);
|
|
219
|
+
const app_runner_mod = module(b, target, optimize, "src/app_runner/root.zig");
|
|
220
|
+
app_runner_mod.addImport("native_sdk", desktop_mod);
|
|
221
|
+
app_runner_mod.addImport("build_options", app_runner_options.createModule());
|
|
222
|
+
app_runner_mod.addImport("app_manifest_zon", b.createModule(.{ .root_source_file = b.path("tests/app-runner/menu_commands_fixture.zon") }));
|
|
223
|
+
const app_runner_migrations_mod = module(b, target, optimize, "src/app_runner/no_migrations.zig");
|
|
224
|
+
app_runner_migrations_mod.addImport("native_sdk", desktop_mod);
|
|
225
|
+
app_runner_mod.addImport("relational_migrations", app_runner_migrations_mod);
|
|
226
|
+
const app_runner_tests = testArtifact(b, app_runner_mod);
|
|
227
|
+
const app_runner_test_run = b.addRunArtifact(app_runner_tests);
|
|
228
|
+
const app_runner_test_step = b.step("test-app-runner", "Run framework app-runner manifest fallback tests");
|
|
229
|
+
app_runner_test_step.dependOn(&app_runner_test_run.step);
|
|
209
230
|
desktop_mod.link_libc = true;
|
|
231
|
+
if (target.result.os.tag == .macos) {
|
|
232
|
+
const flags: []const []const u8 = if (b.sysroot) |sysroot|
|
|
233
|
+
&.{ "-fobjc-arc", "-fno-sanitize=builtin", "-ObjC", "-mmacosx-version-min=11.0", "-isysroot", sysroot, b.fmt("-I{s}/usr/include", .{sysroot}) }
|
|
234
|
+
else
|
|
235
|
+
&.{ "-fobjc-arc", "-fno-sanitize=builtin", "-ObjC", "-mmacosx-version-min=11.0" };
|
|
236
|
+
desktop_mod.addCSourceFile(.{ .file = b.path("src/platform/macos/image_fit_test.m"), .flags = flags });
|
|
237
|
+
desktop_mod.linkFramework("Foundation", .{});
|
|
238
|
+
desktop_mod.linkFramework("ImageIO", .{});
|
|
239
|
+
desktop_mod.linkSystemLibrary("objc", .{});
|
|
240
|
+
}
|
|
210
241
|
const desktop_tests = testArtifact(b, desktop_mod);
|
|
211
242
|
const desktop_test_shards = desktopTestShardArtifacts(b, desktop_mod);
|
|
212
243
|
// Tier-5 crash battery: a child uses the public streamed sink, signals
|
|
@@ -593,6 +624,8 @@ pub fn build(b: *std.Build) void {
|
|
|
593
624
|
test_step.dependOn(&b.addRunArtifact(platform_info_tests).step);
|
|
594
625
|
test_step.dependOn(&b.addRunArtifact(json_tests).step);
|
|
595
626
|
test_step.dependOn(&b.addRunArtifact(app_runner_assets_tests).step);
|
|
627
|
+
test_step.dependOn(&b.addRunArtifact(app_runner_window_placement_tests).step);
|
|
628
|
+
test_step.dependOn(&app_runner_test_run.step);
|
|
596
629
|
test_step.dependOn(&b.addRunArtifact(canvas_tests).step);
|
|
597
630
|
test_step.dependOn(&b.addRunArtifact(record_store_tests).step);
|
|
598
631
|
test_step.dependOn(&file_crash_run.step);
|
|
@@ -824,6 +857,31 @@ pub fn build(b: *std.Build) void {
|
|
|
824
857
|
.{ .path = "build/app.zig", .pattern = "test_step.dependOn(&analysis_obj.step);" },
|
|
825
858
|
.{ .path = "src/runtime/ui_app.zig", .pattern = "has no default value - give every Model field a default" },
|
|
826
859
|
});
|
|
860
|
+
addFileContainsCheckStep(b, file_contains_checker, test_step, "test-owned-runner-window-placement", "Verify owned example runners preserve explicit origins and distinguish successful state restoration", &.{
|
|
861
|
+
.{ .path = "examples/hello/src/runner.zig", .pattern = ".initial_placement = if (@hasField(@TypeOf(window), \"x\") or @hasField(@TypeOf(window), \"y\")) .explicit else .default" },
|
|
862
|
+
.{ .path = "examples/hello/src/runner.zig", .pattern = "window.initial_placement = .restored;" },
|
|
863
|
+
.{ .path = "examples/hello/src/runner.zig", .pattern = "app_info.main_window.initial_placement = .restored;" },
|
|
864
|
+
.{ .path = "examples/capabilities/src/runner.zig", .pattern = "info.main_window.default_frame = manifestShellStartupFrame(info.main_window.default_frame);" },
|
|
865
|
+
.{ .path = "examples/capabilities/src/runner.zig", .pattern = "info.main_window.restore_state = manifestShellStartupRestoreState(info.main_window.restore_state);" },
|
|
866
|
+
.{ .path = "examples/capabilities/src/runner.zig", .pattern = "info.main_window.restore_policy = manifestShellStartupRestorePolicy(info.main_window.restore_policy);" },
|
|
867
|
+
.{ .path = "examples/capabilities/src/runner.zig", .pattern = "info.main_window.initial_placement = manifestShellStartupInitialPlacement(info.main_window.initial_placement);" },
|
|
868
|
+
});
|
|
869
|
+
addFileContainsCheckStep(b, file_contains_checker, test_step, "test-macos-window-placement-contracts", "Verify both macOS hosts use the primary display and restore persisted content frames without titlebar growth", &.{
|
|
870
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "return [NSScreen screens].firstObject ?: [NSScreen mainScreen];" },
|
|
871
|
+
.{ .path = "src/platform/macos/cef_host.mm", .pattern = "return [NSScreen screens].firstObject ?: [NSScreen mainScreen];" },
|
|
872
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "[window frameRectForContentRect:restoredContentFrame]" },
|
|
873
|
+
.{ .path = "src/platform/macos/cef_host.mm", .pattern = "[window frameRectForContentRect:restoredContentFrame]" },
|
|
874
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "[window setFrame:restoredWindowFrame display:NO];" },
|
|
875
|
+
.{ .path = "src/platform/macos/cef_host.mm", .pattern = "[window setFrame:restoredWindowFrame display:NO];" },
|
|
876
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "[window setFrame:NativeSdkCenterFrameOnScreen(window.frame, primaryScreen) display:NO];" },
|
|
877
|
+
.{ .path = "src/platform/macos/cef_host.mm", .pattern = "[window setFrame:NativeSdkCenterFrameOnScreen(window.frame, primaryScreen) display:NO];" },
|
|
878
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "else if (initialPlacement == 1) {\n // Fresh authored dimensions are content size" },
|
|
879
|
+
.{ .path = "src/platform/macos/cef_host.mm", .pattern = "else if (initialPlacement == 1) {\n // AppKit adds titlebar chrome" },
|
|
880
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "[window setFrame:NativeSdkConstrainFrame(window.frame) display:NO];" },
|
|
881
|
+
.{ .path = "src/platform/macos/cef_host.mm", .pattern = "[window setFrame:NativeSdkConstrainFrame(window.frame) display:NO];" },
|
|
882
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "initWithFrame:window.contentView.bounds" },
|
|
883
|
+
.{ .path = "src/platform/macos/cef_host.mm", .pattern = "initWithFrame:window.contentView.bounds" },
|
|
884
|
+
});
|
|
827
885
|
addFileContainsCheckStep(b, file_contains_checker, test_step, "test-bridge-view-selector-helpers", "Verify injected view helpers accept string selectors", &.{
|
|
828
886
|
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "viewSelectorPayload(options)" },
|
|
829
887
|
.{ .path = "src/platform/macos/cef_host.mm", .pattern = "viewSelectorPayload(options)" },
|
|
@@ -1458,6 +1516,13 @@ pub fn build(b: *std.Build) void {
|
|
|
1458
1516
|
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "NativeSdkTextNavigationNeedsRawKeyEvent(event)" },
|
|
1459
1517
|
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "NSEventModifierFlagCommand | NSEventModifierFlagOption" },
|
|
1460
1518
|
});
|
|
1519
|
+
addFileContainsCheckStep(b, file_contains_checker, test_step, "test-appkit-widget-accessibility-hierarchy", "Verify AppKit preserves retained-widget accessibility parentage", &.{
|
|
1520
|
+
.{ .path = "src/platform/macos/appkit_host.h", .pattern = "uint64_t parent_id;" },
|
|
1521
|
+
.{ .path = "src/platform/macos/root.zig", .pattern = ".parent_id = node.parent_id orelse 0" },
|
|
1522
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "element.accessibilityParent = parent;" },
|
|
1523
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "parent.accessibilityChildren = [childrenByParentId objectForKey:parentId];" },
|
|
1524
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "return self.widgetAccessibilityRootElements ?: @[];" },
|
|
1525
|
+
});
|
|
1461
1526
|
addFileContainsCheckStep(b, file_contains_checker, test_step, "test-appkit-appearance-bridge", "Verify AppKit reports system light and dark appearance changes", &.{
|
|
1462
1527
|
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "effectiveAppearance" },
|
|
1463
1528
|
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "accessibilityDisplayShouldReduceMotion" },
|
|
@@ -1480,6 +1545,7 @@ pub fn build(b: *std.Build) void {
|
|
|
1480
1545
|
addTestStep(b, "test-diagnostics", "Run diagnostics module tests", diagnostics_tests);
|
|
1481
1546
|
addTestStep(b, "test-platform-info", "Run platform info module tests", platform_info_tests);
|
|
1482
1547
|
addTestStep(b, "test-json", "Run JSON primitive tests", json_tests);
|
|
1548
|
+
addTestStep(b, "test-app-runner-window-placement", "Run app-runner window placement decision tests", app_runner_window_placement_tests);
|
|
1483
1549
|
addTestStep(b, "test-canvas", "Run canvas display list tests", canvas_tests);
|
|
1484
1550
|
addTestStep(b, "test-desktop", "Run Native SDK framework tests", desktop_tests);
|
|
1485
1551
|
for (desktop_test_shard_specs, desktop_test_shards) |spec, shard_tests| {
|
|
@@ -1713,6 +1779,7 @@ pub fn build(b: *std.Build) void {
|
|
|
1713
1779
|
"examples/calculator/zig-out/package/test-ios-layout/calculator.xcodeproj/xcshareddata/xcschemes/calculator.xcscheme",
|
|
1714
1780
|
"examples/calculator/zig-out/package/test-ios-layout/Host/uikit_host.m",
|
|
1715
1781
|
"examples/calculator/zig-out/package/test-ios-layout/Host/native_sdk_app.h",
|
|
1782
|
+
"examples/calculator/zig-out/package/test-ios-layout/Host/apple_image_fit.h",
|
|
1716
1783
|
"examples/calculator/zig-out/package/test-ios-layout/Host/Info.plist",
|
|
1717
1784
|
"examples/calculator/zig-out/package/test-ios-layout/Assets.xcassets/AppIcon.appiconset/AppIcon.png",
|
|
1718
1785
|
"examples/calculator/zig-out/package/test-ios-layout/Assets.xcassets/AppIcon.appiconset/Contents.json",
|
|
@@ -1813,13 +1880,20 @@ pub fn build(b: *std.Build) void {
|
|
|
1813
1880
|
});
|
|
1814
1881
|
addFileContainsCheckStep(b, file_contains_checker, mobile_examples_step, "test-example-mobile-widget-abi", "Verify mobile examples use stable widget ABI lookups", &.{
|
|
1815
1882
|
.{ .path = "examples/ios/NativeSdkIOSExample/native_sdk.h", .pattern = "native_sdk_viewport_state_t" },
|
|
1883
|
+
.{ .path = "examples/ios/NativeSdkIOSExample/native_sdk.h", .pattern = "NATIVE_SDK_WIDGET_ROLE_RADIOGROUP = 21" },
|
|
1816
1884
|
.{ .path = "examples/ios/NativeSdkIOSExample/native_sdk.h", .pattern = "native_sdk_app_scroll" },
|
|
1817
1885
|
.{ .path = "examples/ios/NativeSdkIOSExample/native_sdk.h", .pattern = "native_sdk_app_set_text_measure" },
|
|
1886
|
+
.{ .path = "examples/android/app/src/main/cpp/native_sdk.h", .pattern = "NATIVE_SDK_WIDGET_ROLE_RADIOGROUP = 21" },
|
|
1818
1887
|
.{ .path = "examples/android/app/src/main/cpp/native_sdk.h", .pattern = "native_sdk_app_set_text_measure" },
|
|
1819
1888
|
.{ .path = "examples/mobile-canvas/ios/native_sdk_app.h", .pattern = "native_sdk_app_set_text_measure" },
|
|
1820
1889
|
.{ .path = "examples/ios/NativeSdkIOSExample/NativeSdkHostViewController.swift", .pattern = "native_sdk_app_widget_semantics_by_id" },
|
|
1890
|
+
.{ .path = "examples/ios/NativeSdkIOSExample/NativeSdkHostViewController.swift", .pattern = "NATIVE_SDK_WIDGET_ROLE_RADIO" },
|
|
1891
|
+
.{ .path = "examples/ios/NativeSdkIOSExample/NativeSdkHostViewController.swift", .pattern = "childrenByParentId[node.parentId, default: []].append(element)" },
|
|
1892
|
+
.{ .path = "examples/ios/NativeSdkIOSExample/NativeSdkHostViewController.swift", .pattern = "parent.accessibilityContainerType = .semanticGroup" },
|
|
1893
|
+
.{ .path = "examples/ios/NativeSdkIOSExample/NativeSdkHostViewController.swift", .pattern = "parent.isAccessibilityElement = false" },
|
|
1821
1894
|
.{ .path = "examples/android/app/src/main/cpp/native_sdk.h", .pattern = "native_sdk_app_widget_semantics_by_id" },
|
|
1822
1895
|
.{ .path = "examples/android/app/src/main/java/dev/native_sdk/examples/android/MainActivity.kt", .pattern = "nativeScroll(nativeApp" },
|
|
1896
|
+
.{ .path = "examples/android/app/src/main/java/dev/native_sdk/examples/android/MainActivity.kt", .pattern = "WIDGET_ROLE_RADIOGROUP -> \"android.widget.RadioGroup\"" },
|
|
1823
1897
|
.{ .path = "examples/android/app/src/main/java/dev/native_sdk/examples/android/MainActivity.kt", .pattern = "nativeWidgetSemanticsByIdFields" },
|
|
1824
1898
|
.{ .path = "examples/android/app/src/main/cpp/native_sdk_jni.c", .pattern = "native_sdk_app_widget_semantics_by_id" },
|
|
1825
1899
|
.{ .path = "examples/android/app/src/main/cpp/native_sdk_jni.c", .pattern = "native_sdk_app_scroll" },
|
|
@@ -2103,6 +2177,52 @@ pub fn build(b: *std.Build) void {
|
|
|
2103
2177
|
native_shell_smoke_run.step.dependOn(&cli_exe.step);
|
|
2104
2178
|
native_shell_smoke_step.dependOn(&native_shell_smoke_run.step);
|
|
2105
2179
|
|
|
2180
|
+
const menu_bar_smoke_step = b.step("test-menu-bar-smoke", "Run zero-config TypeScript app-menu automation smoke test");
|
|
2181
|
+
const menu_bar_smoke_build = managedExampleRun(b, cli_exe, &.{ "build", "-Dplatform=macos", "-Dweb-engine=system", "-Dautomation=true", "-Doptimize=Debug" });
|
|
2182
|
+
menu_bar_smoke_build.setCwd(b.path("examples/menu-bar"));
|
|
2183
|
+
const menu_bar_smoke_run = b.addSystemCommand(&.{
|
|
2184
|
+
"sh", "-c",
|
|
2185
|
+
\\set -eu
|
|
2186
|
+
\\cd examples/menu-bar
|
|
2187
|
+
\\app="zig-out/bin/menu-bar"
|
|
2188
|
+
\\cli="$1"
|
|
2189
|
+
\\case "$cli" in /*) ;; *) cli="../../$cli" ;; esac
|
|
2190
|
+
\\automation_dir=".zig-cache/native-sdk-automation"
|
|
2191
|
+
\\mkdir -p "$automation_dir"
|
|
2192
|
+
\\rm -f "$automation_dir/snapshot.txt" "$automation_dir/accessibility.txt" "$automation_dir/windows.txt" "$automation_dir"/command*.txt
|
|
2193
|
+
\\"$app" > .zig-cache/native-sdk-menu-bar-smoke.log 2>&1 &
|
|
2194
|
+
\\pid=$!
|
|
2195
|
+
\\trap 'status=$?; kill "$pid" >/dev/null 2>&1 || true; wait "$pid" >/dev/null 2>&1 || true; if [ "$status" -ne 0 ]; then echo "---- app log (.zig-cache/native-sdk-menu-bar-smoke.log) ----" >&2; cat .zig-cache/native-sdk-menu-bar-smoke.log >&2 2>/dev/null || true; fi' EXIT
|
|
2196
|
+
\\ready="$("$cli" automate wait 2>&1)"
|
|
2197
|
+
\\case "$ready" in *"ready=true"*) ;; *) echo "menu-bar automation snapshot was not ready" >&2; exit 1 ;; esac
|
|
2198
|
+
\\before="$(cat "$automation_dir/snapshot.txt" 2>/dev/null || true)"
|
|
2199
|
+
\\case "$before" in *'command id="player.next" title="Next Track" enabled=true checked=false'*) ;; *) echo "app.zon command catalog was not loaded by the zero-config runner" >&2; exit 1 ;; esac
|
|
2200
|
+
\\case "$before" in *'app-menu title="Player" items=6'*) ;; *) echo "app.zon Player menu was not loaded by the zero-config runner" >&2; exit 1 ;; esac
|
|
2201
|
+
\\case "$before" in *'app-menu-item label="Next Track" command="player.next" enabled=true checked=false key="n" modifiers=(primary=true,command=false,control=false,option=false,shift=false)'*) ;; *) echo "app.zon player.next menu item was not loaded by the zero-config runner" >&2; exit 1 ;; esac
|
|
2202
|
+
\\case "$before" in
|
|
2203
|
+
\\ *'Ambient Coast'*) expected='Night Drive' ;;
|
|
2204
|
+
\\ *'Night Drive'*) expected='Paper Planes' ;;
|
|
2205
|
+
\\ *'Paper Planes'*) expected='Ambient Coast' ;;
|
|
2206
|
+
\\ *) echo "menu-bar snapshot did not expose the current TypeScript model track" >&2; exit 1 ;;
|
|
2207
|
+
\\esac
|
|
2208
|
+
\\"$cli" automate menu-command player.next >/dev/null 2>&1
|
|
2209
|
+
\\attempts=0
|
|
2210
|
+
\\while [ "$attempts" -lt 50 ]; do
|
|
2211
|
+
\\ snapshot="$(cat "$automation_dir/snapshot.txt" 2>/dev/null || true)"
|
|
2212
|
+
\\ case "$snapshot" in *"$expected"*) break ;; esac
|
|
2213
|
+
\\ attempts=$((attempts + 1))
|
|
2214
|
+
\\ sleep 0.1
|
|
2215
|
+
\\done
|
|
2216
|
+
\\case "$snapshot" in *"$expected"*) ;; *) echo "app.zon menu command did not reach the zero-config TypeScript commandMsg mapper" >&2; exit 1 ;; esac
|
|
2217
|
+
\\echo "menu-bar smoke ok"
|
|
2218
|
+
,
|
|
2219
|
+
"sh",
|
|
2220
|
+
});
|
|
2221
|
+
menu_bar_smoke_run.addFileArg(cli_exe.getEmittedBin());
|
|
2222
|
+
menu_bar_smoke_run.step.dependOn(&menu_bar_smoke_build.step);
|
|
2223
|
+
menu_bar_smoke_run.step.dependOn(&cli_exe.step);
|
|
2224
|
+
menu_bar_smoke_step.dependOn(&menu_bar_smoke_run.step);
|
|
2225
|
+
|
|
2106
2226
|
const gpu_surface_smoke_step = b.step("test-gpu-surface-smoke", "Run macOS GPU surface automation smoke test");
|
|
2107
2227
|
// The GPU smoke apps are managed examples (no build.zig of their own),
|
|
2108
2228
|
// so their binaries come from the CLI verb. -Doptimize=Debug keeps the
|
|
@@ -2593,7 +2713,7 @@ pub fn build(b: *std.Build) void {
|
|
|
2593
2713
|
\\case "$ready_snapshot" in *'view @w1/components-canvas kind=gpu_surface'*'gpu_nonblank=true'*'canvas_frame_gpu_packet_representable=true'*) ;; *) echo "component gallery GPU surface was not ready" >&2; exit 1 ;; esac
|
|
2594
2714
|
\\case "$ready_snapshot" in *'view @w1/main kind=webview'*) echo "component gallery created an implicit WebView" >&2; exit 1 ;; *) ;; esac
|
|
2595
2715
|
\\"$cli" automate assert 'role=tree name="Components"' 'role=treeitem name="Components".*state=\[expanded\]' 'role=treeitem name="Accordion".*state=\[selected\]' 'role=group name="Details".*state=\[selected,expanded\]' 'name="Accordion details are visible. The model owns this expanded state."'
|
|
2596
|
-
\\"$cli" automate assert 'role=group name="Theme"' 'role=button name="Default".*state=\[selected\]' 'role=button name="Geist"'
|
|
2716
|
+
\\"$cli" automate assert 'role=group name="Theme pack"' 'role=group name="Color scheme"' 'role=group name="Theme accent"' 'role=button name="Default".*state=\[selected\]' 'role=button name="Geist"' 'role=button name="System".*state=\[selected\]' 'role=button name="Pink"' 'role=button name="Teal"'
|
|
2597
2717
|
\\"$cli" automate screenshot components-canvas >/dev/null 2>&1
|
|
2598
2718
|
\\cp "$automation_dir/screenshot-components-canvas.png" "$automation_dir/screenshot-components-house.png"
|
|
2599
2719
|
\\rm -f "$automation_dir/screenshot-components-canvas.png"
|
|
@@ -3460,6 +3580,9 @@ fn tsCoreE2eArtifact(
|
|
|
3460
3580
|
// against (the same module the generated shims stage).
|
|
3461
3581
|
conformance_mod.addImport("corewire_rt", module(b, target, optimize, "tools/corewire/shim_rt.zig"));
|
|
3462
3582
|
conformance_mod.addImport("shim_markup_core", sidecarShimModule(b, target, optimize, corewire_exe, b.path("tests/sidecar/markup_fixture.contract.json")));
|
|
3583
|
+
// Compile-cost guard: this generated mirror carries 160 realistically
|
|
3584
|
+
// named Msg arms and must need no quota setting in app or test code.
|
|
3585
|
+
conformance_mod.addImport("shim_wide_core", sidecarShimModule(b, target, optimize, corewire_exe, b.path("tests/sidecar/wide_msg_fixture.contract.json")));
|
|
3463
3586
|
// The integer-class fixture: a hand-written sidecar attesting mixed
|
|
3464
3587
|
// i64/u64 slot classes, so the suite drives boundary and full-range
|
|
3465
3588
|
// integer values through a generated mirror's decode paths.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@native-sdk/cli",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.3",
|
|
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": {
|
|
@@ -35,14 +35,14 @@
|
|
|
35
35
|
"scriptc": "0.0.31"
|
|
36
36
|
},
|
|
37
37
|
"optionalDependencies": {
|
|
38
|
-
"@native-sdk/cli-darwin-arm64": "0.9.
|
|
39
|
-
"@native-sdk/cli-darwin-x64": "0.9.
|
|
40
|
-
"@native-sdk/cli-linux-arm64-gnu": "0.9.
|
|
41
|
-
"@native-sdk/cli-linux-arm64-musl": "0.9.
|
|
42
|
-
"@native-sdk/cli-linux-x64-gnu": "0.9.
|
|
43
|
-
"@native-sdk/cli-linux-x64-musl": "0.9.
|
|
44
|
-
"@native-sdk/cli-win32-arm64": "0.9.
|
|
45
|
-
"@native-sdk/cli-win32-x64": "0.9.
|
|
38
|
+
"@native-sdk/cli-darwin-arm64": "0.9.3",
|
|
39
|
+
"@native-sdk/cli-darwin-x64": "0.9.3",
|
|
40
|
+
"@native-sdk/cli-linux-arm64-gnu": "0.9.3",
|
|
41
|
+
"@native-sdk/cli-linux-arm64-musl": "0.9.3",
|
|
42
|
+
"@native-sdk/cli-linux-x64-gnu": "0.9.3",
|
|
43
|
+
"@native-sdk/cli-linux-x64-musl": "0.9.3",
|
|
44
|
+
"@native-sdk/cli-win32-arm64": "0.9.3",
|
|
45
|
+
"@native-sdk/cli-win32-x64": "0.9.3"
|
|
46
46
|
},
|
|
47
47
|
"repository": {
|
|
48
48
|
"type": "git",
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@native-sdk/core",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.3",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@native-sdk/core",
|
|
9
|
-
"version": "0.9.
|
|
9
|
+
"version": "0.9.3",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"scriptc": "0.0.31"
|
|
12
12
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@native-sdk/core",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.3",
|
|
4
4
|
"description": "The TypeScript authoring tier: the app-core subset, its checker and contract frontend, the exact-pinned core compiler dependency, and the SDK module cores import",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -614,7 +614,9 @@ export type VideoEventKind<M extends Msgish> = M extends Msgish
|
|
|
614
614
|
/// live id), "not_found" (missing local file, no url), "io_failed" (a local
|
|
615
615
|
/// read failure), "connect_failed"/"tls_failed"/"protocol_failed"/"timed_out"
|
|
616
616
|
/// (the fetch taxonomy), "http_status" (a non-2xx answer; `status` carries
|
|
617
|
-
/// it), "cancelled", "too_large" (
|
|
617
|
+
/// it), "cancelled", "too_large" (the encoded source exceeds the fixed
|
|
618
|
+
/// source bound; conforming codecs decode photo-scale pixels down to the
|
|
619
|
+
/// app's registered-image budget),
|
|
618
620
|
/// "unsupported" (no platform codec), "decode_failed", "registry_full", and
|
|
619
621
|
/// "alloc_failed" (the host refused the memory the registration needed —
|
|
620
622
|
/// resource exhaustion, not corrupt bytes: the same source may load once
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
export type { TextCaretDirection, TextCaretMove, TextSelection, TextInputEvent } from "./text.js";
|
|
2
|
+
export type ThemeStatePack = "house" | "geist";
|
|
3
|
+
export type ThemeStateColorScheme = "light" | "dark" | "system";
|
|
4
|
+
export type ThemeState = {
|
|
5
|
+
readonly pack?: ThemeStatePack;
|
|
6
|
+
readonly colorScheme?: ThemeStateColorScheme;
|
|
7
|
+
readonly accent?: string;
|
|
8
|
+
};
|
|
2
9
|
export type StatusItemTone = "normal" | "warning" | "critical";
|
|
3
10
|
export type StatusItemMenuRole = "command" | "info" | "header" | "hero" | "agent" | "context";
|
|
4
11
|
export interface StatusItemModifiers {
|
|
@@ -37,6 +37,8 @@
|
|
|
37
37
|
// - `AppearanceEvent`, `ChromeEvent`, `AudioEvent`: the full arm
|
|
38
38
|
// payload shapes, canonical and importable for helper signatures
|
|
39
39
|
// (an arm value is structurally assignable to its event record).
|
|
40
|
+
// - `ThemeState`: the model-derived built-in theme axes returned by
|
|
41
|
+
// `themeState(model)`; omitted fields inherit the manifest/system.
|
|
40
42
|
// - `StatusItemState`, `StatusItemDescriptor`, and their nested records:
|
|
41
43
|
// the model-derived shell returned by `statusItem(model)` or keyed
|
|
42
44
|
// `statusItems(model)`; the generated launcher refreshes shell,
|
|
@@ -44,6 +46,20 @@
|
|
|
44
46
|
|
|
45
47
|
export type { TextCaretDirection, TextCaretMove, TextSelection, TextInputEvent } from "./text.ts";
|
|
46
48
|
|
|
49
|
+
/// The stock theme axes a TypeScript core may derive from committed model
|
|
50
|
+
/// state. Omit `pack`/`accent` to inherit app.zon; omit `colorScheme` (or
|
|
51
|
+
/// return `"system"`) to follow the OS. High contrast and reduced motion
|
|
52
|
+
/// remain system-owned, and high contrast suppresses accent overrides.
|
|
53
|
+
export type ThemeStatePack = "house" | "geist";
|
|
54
|
+
|
|
55
|
+
export type ThemeStateColorScheme = "light" | "dark" | "system";
|
|
56
|
+
|
|
57
|
+
export type ThemeState = {
|
|
58
|
+
readonly pack?: ThemeStatePack;
|
|
59
|
+
readonly colorScheme?: ThemeStateColorScheme;
|
|
60
|
+
readonly accent?: string;
|
|
61
|
+
};
|
|
62
|
+
|
|
47
63
|
/// One row in a menu-bar status item's menu. Non-separator rows need a
|
|
48
64
|
/// unique non-zero `id`, a non-empty `label`, and (when actionable) a
|
|
49
65
|
/// command name accepted by `commandMsg`. Rich readout roles may carry
|
|
@@ -247,8 +263,10 @@ export interface PinchEvent {
|
|
|
247
263
|
readonly y: number;
|
|
248
264
|
}
|
|
249
265
|
|
|
250
|
-
/// A file drop's optional point in
|
|
251
|
-
///
|
|
266
|
+
/// A file drop's optional point in top-left-origin local coordinates. A
|
|
267
|
+
/// non-empty `FileDropEvent.viewLabel` names its canvas or WebView coordinate
|
|
268
|
+
/// space; an empty label may carry window-content coordinates. Hosts that
|
|
269
|
+
/// cannot resolve local coordinates leave `FileDropEvent.point` null.
|
|
252
270
|
export interface FileDropPoint {
|
|
253
271
|
readonly x: number;
|
|
254
272
|
readonly y: number;
|
|
@@ -256,9 +274,12 @@ export interface FileDropPoint {
|
|
|
256
274
|
|
|
257
275
|
/// The app-level file-drop channel's record (`dropMsg(drop)`). `windowId`
|
|
258
276
|
/// and `viewLabel` identify the source; `point` is present when the host can
|
|
259
|
-
/// resolve
|
|
260
|
-
///
|
|
261
|
-
///
|
|
277
|
+
/// resolve local coordinates. The macOS system host reports labeled canvas or
|
|
278
|
+
/// WebView coordinates and degrades unlabeled regions to window-content
|
|
279
|
+
/// coordinates; hosts without either leave `point` null. Paths are byte text
|
|
280
|
+
/// so arbitrary UTF-8 filesystem names cross without becoming runtime JS
|
|
281
|
+
/// strings. Return null from `dropMsg` to ignore a drop, or map it to an
|
|
282
|
+
/// ordinary Msg.
|
|
262
283
|
export interface FileDropEvent {
|
|
263
284
|
readonly windowId: number;
|
|
264
285
|
readonly viewLabel: string;
|
|
@@ -22,6 +22,10 @@ export type TextInputEvent = {
|
|
|
22
22
|
readonly kind: "delete_word_backward";
|
|
23
23
|
} | {
|
|
24
24
|
readonly kind: "delete_word_forward";
|
|
25
|
+
} | {
|
|
26
|
+
readonly kind: "delete_to_start";
|
|
27
|
+
} | {
|
|
28
|
+
readonly kind: "delete_to_line_start";
|
|
25
29
|
} | {
|
|
26
30
|
readonly kind: "clear";
|
|
27
31
|
} | {
|
|
@@ -56,6 +56,8 @@ export type TextInputEvent =
|
|
|
56
56
|
| { readonly kind: "delete_forward" }
|
|
57
57
|
| { readonly kind: "delete_word_backward" }
|
|
58
58
|
| { readonly kind: "delete_word_forward" }
|
|
59
|
+
| { readonly kind: "delete_to_start" }
|
|
60
|
+
| { readonly kind: "delete_to_line_start" }
|
|
59
61
|
| { readonly kind: "clear" }
|
|
60
62
|
| { readonly kind: "move_caret"; readonly move: TextCaretMove }
|
|
61
63
|
| { readonly kind: "set_selection"; readonly selection: TextSelection }
|
|
@@ -417,6 +419,51 @@ function deleteWordForwardTextEdit(state: TextEditState, capacity: number): Text
|
|
|
417
419
|
);
|
|
418
420
|
}
|
|
419
421
|
|
|
422
|
+
function textLineStartOffset(text: Uint8Array, offset: number): number {
|
|
423
|
+
let cursor = snapTextOffset(text, offset);
|
|
424
|
+
while (cursor > 0 && text[cursor - 1] !== 0x0a) cursor -= 1;
|
|
425
|
+
return cursor;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
function deleteToStartTextEdit(state: TextEditState, capacity: number): TextEditState | null {
|
|
429
|
+
const range = activeTextReplaceRange(state);
|
|
430
|
+
if (!rangeIsCollapsed(range, state.text.length)) {
|
|
431
|
+
return replaceTextEditRange(state, range, new Uint8Array(0), capacity, null, 0);
|
|
432
|
+
}
|
|
433
|
+
const caret = snapTextCaretOffset(state.text, state.selection.focus);
|
|
434
|
+
if (caret === 0) {
|
|
435
|
+
return { text: state.text, selection: caretSelectionAt(0, 0), composition: null };
|
|
436
|
+
}
|
|
437
|
+
return replaceTextEditRange(
|
|
438
|
+
state,
|
|
439
|
+
{ start: 0, end: caret },
|
|
440
|
+
new Uint8Array(0),
|
|
441
|
+
capacity,
|
|
442
|
+
null,
|
|
443
|
+
0,
|
|
444
|
+
);
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
function deleteToLineStartTextEdit(state: TextEditState, capacity: number): TextEditState | null {
|
|
448
|
+
const range = activeTextReplaceRange(state);
|
|
449
|
+
if (!rangeIsCollapsed(range, state.text.length)) {
|
|
450
|
+
return replaceTextEditRange(state, range, new Uint8Array(0), capacity, null, 0);
|
|
451
|
+
}
|
|
452
|
+
const caret = snapTextCaretOffset(state.text, state.selection.focus);
|
|
453
|
+
const lineStart = textLineStartOffset(state.text, caret);
|
|
454
|
+
if (lineStart === caret) {
|
|
455
|
+
return { text: state.text, selection: caretSelectionAt(caret, caret), composition: null };
|
|
456
|
+
}
|
|
457
|
+
return replaceTextEditRange(
|
|
458
|
+
state,
|
|
459
|
+
{ start: lineStart, end: caret },
|
|
460
|
+
new Uint8Array(0),
|
|
461
|
+
capacity,
|
|
462
|
+
null,
|
|
463
|
+
0,
|
|
464
|
+
);
|
|
465
|
+
}
|
|
466
|
+
|
|
420
467
|
function moveTextCaret(state: TextEditState, move: TextCaretMove): TextEditState {
|
|
421
468
|
const range = selectionRange(state.selection, state.text.length);
|
|
422
469
|
const focus = snapTextCaretOffset(state.text, state.selection.focus);
|
|
@@ -472,6 +519,10 @@ export function applyTextInputEvent(
|
|
|
472
519
|
return deleteWordBackwardTextEdit(normalized, capacity);
|
|
473
520
|
case "delete_word_forward":
|
|
474
521
|
return deleteWordForwardTextEdit(normalized, capacity);
|
|
522
|
+
case "delete_to_start":
|
|
523
|
+
return deleteToStartTextEdit(normalized, capacity);
|
|
524
|
+
case "delete_to_line_start":
|
|
525
|
+
return deleteToLineStartTextEdit(normalized, capacity);
|
|
475
526
|
case "clear":
|
|
476
527
|
return { text: new Uint8Array(0), selection: { anchor: 0, focus: 0 }, composition: null };
|
|
477
528
|
case "move_caret":
|