@native-sdk/cli 0.10.1 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -6
- package/bin/native.js +2 -1
- package/build/app.zig +393 -97
- package/build/corewire.zig +53 -0
- package/build/test_shards.zig +49 -0
- package/build/ts_run.mjs +3 -3
- package/build.zig +2030 -83
- package/native-sdk.d.ts +5 -1
- package/package.json +20 -14
- package/packages/core/compile-surface/core.ts +164 -72
- package/packages/core/package-lock.json +75 -357
- package/packages/core/package.json +25 -4
- package/packages/core/scripts/compiler_command.mjs +17 -12
- package/packages/core/scripts/compiler_typecheck.mjs +1 -0
- package/packages/core/scripts/gen_declarations.mjs +3 -2
- package/packages/core/scripts/gen_service_surface.mjs +22 -10
- package/packages/core/scripts/install_scriptc.mjs +182 -0
- package/packages/core/scripts/invoke_scriptc.mjs +18 -0
- package/packages/core/scripts/merge_static_archives.mjs +6 -1
- package/packages/core/scripts/npm_static_spike.mjs +2 -2
- package/packages/core/scripts/run_external_core_compiler.mjs +22 -10
- package/packages/core/scripts/run_external_service_compiler.mjs +15 -15
- package/packages/core/scripts/run_library_compiler.mjs +51 -0
- package/packages/core/scripts/run_native_tests.mjs +22 -0
- package/packages/core/scripts/scriptc-toolchain.json +101 -0
- package/packages/core/scripts/scriptc_toolchain.mjs +121 -0
- package/packages/core/scripts/stage_external_core.mjs +68 -1
- package/packages/core/scripts/surface_manifest_diff.mjs +19 -12
- package/packages/core/sdk/bytes.d.ts +2 -0
- package/packages/core/sdk/bytes.ts +86 -0
- package/packages/core/sdk/core.d.ts +332 -5
- package/packages/core/sdk/core.ts +371 -85
- package/packages/core/sdk/events.d.ts +252 -0
- package/packages/core/sdk/events.ts +240 -2
- package/packages/core/sdk/internal/image_identity.d.ts +7 -0
- package/packages/core/sdk/internal/image_identity.ts +71 -0
- package/packages/core/sdk/internal/markdown_policy.d.ts +5 -0
- package/packages/core/sdk/internal/markdown_policy.ts +878 -0
- package/packages/core/sdk/text.d.ts +27 -0
- package/packages/core/sdk/text.ts +206 -15
- package/packages/core/sdk/theme.d.ts +251 -0
- package/packages/core/sdk/theme.ts +267 -0
- package/packages/core/src/authorization.ts +137 -0
- package/packages/core/src/automation_commands.ts +201 -0
- package/packages/core/src/automation_interactions.ts +92 -0
- package/packages/core/src/bridge_descriptors.ts +104 -0
- package/packages/core/src/builtin_coordination.ts +172 -0
- package/packages/core/src/canvas_frame_coordination.ts +81 -0
- package/packages/core/src/canvas_presentation_lifecycle.ts +84 -0
- package/packages/core/src/canvas_scene_observation.ts +145 -0
- package/packages/core/src/chart_content.ts +161 -0
- package/packages/core/src/chart_plans.ts +432 -0
- package/packages/core/src/checker.ts +186 -19
- package/packages/core/src/cli.ts +2 -11
- package/packages/core/src/code_content.ts +580 -0
- package/packages/core/src/command_coordination.ts +140 -0
- package/packages/core/src/component_composition.ts +94 -0
- package/packages/core/src/component_construction.ts +149 -0
- package/packages/core/src/context_menus.ts +76 -0
- package/packages/core/src/contract.ts +25 -7
- package/packages/core/src/control_appearance.ts +232 -0
- package/packages/core/src/control_commands.ts +115 -0
- package/packages/core/src/control_content.ts +105 -0
- package/packages/core/src/control_geometry.ts +107 -0
- package/packages/core/src/control_payloads.ts +119 -0
- package/packages/core/src/control_primitives.ts +134 -0
- package/packages/core/src/devhost.ts +82 -7
- package/packages/core/src/devhost_journal.mjs +30 -7
- package/packages/core/src/diagnostics.ts +7 -0
- package/packages/core/src/effect_plans.ts +71 -0
- package/packages/core/src/extent_program.ts +53 -0
- package/packages/core/src/flow_measurement.ts +121 -0
- package/packages/core/src/font_registry.ts +37 -0
- package/packages/core/src/frontend.ts +12 -10
- package/packages/core/src/glyph_atlas.ts +86 -0
- package/packages/core/src/gpu_packet_preparation.ts +130 -0
- package/packages/core/src/gpu_planning.ts +123 -0
- package/packages/core/src/gpu_presentation.ts +55 -0
- package/packages/core/src/host_flow.ts +89 -0
- package/packages/core/src/host_input_regions.ts +165 -0
- package/packages/core/src/image_registry.ts +66 -0
- package/packages/core/src/indicator_plans.ts +132 -0
- package/packages/core/src/infer.ts +150 -8
- package/packages/core/src/input_composition.ts +116 -0
- package/packages/core/src/intrinsic_measure.ts +100 -0
- package/packages/core/src/layout_coordination.ts +207 -0
- package/packages/core/src/leaf_plans.ts +134 -0
- package/packages/core/src/markup_canonical.ts +140 -0
- package/packages/core/src/markup_construction.ts +189 -0
- package/packages/core/src/markup_development.ts +160 -0
- package/packages/core/src/markup_display.ts +43 -0
- package/packages/core/src/markup_document.ts +226 -0
- package/packages/core/src/markup_elements.ts +225 -0
- package/packages/core/src/markup_expressions.ts +79 -0
- package/packages/core/src/markup_imports.ts +146 -0
- package/packages/core/src/markup_parser.ts +228 -0
- package/packages/core/src/markup_runtime.ts +93 -0
- package/packages/core/src/markup_scalars.ts +143 -0
- package/packages/core/src/markup_shapes.ts +243 -0
- package/packages/core/src/markup_specialized.ts +242 -0
- package/packages/core/src/markup_text.ts +86 -0
- package/packages/core/src/markup_values.ts +336 -0
- package/packages/core/src/measurement_coordination.ts +185 -0
- package/packages/core/src/modules.ts +1 -1
- package/packages/core/src/motion_sampling.ts +100 -0
- package/packages/core/src/paragraph_layout.ts +192 -0
- package/packages/core/src/portable_sources.json +98 -0
- package/packages/core/src/portable_sources.ts +17 -0
- package/packages/core/src/registered_font.ts +92 -0
- package/packages/core/src/render_animation_lifecycle.ts +128 -0
- package/packages/core/src/render_coordination.ts +170 -0
- package/packages/core/src/render_resources.ts +234 -0
- package/packages/core/src/runtime_policy.ts +3954 -0
- package/packages/core/src/scalar_text.ts +82 -0
- package/packages/core/src/scroll_mutation.ts +86 -0
- package/packages/core/src/scroll_tree.ts +86 -0
- package/packages/core/src/service_contract.ts +55 -3
- package/packages/core/src/session_codecs.ts +309 -0
- package/packages/core/src/shell_admission.ts +126 -0
- package/packages/core/src/shell_coordination.ts +93 -0
- package/packages/core/src/sqlite_cli.ts +14 -46
- package/packages/core/src/sqlite_codegen.ts +84 -0
- package/packages/core/src/staged_rebuild.ts +60 -0
- package/packages/core/src/status_validation.ts +232 -0
- package/packages/core/src/stream_policy.ts +63 -0
- package/packages/core/src/surface_recipes.ts +136 -0
- package/packages/core/src/system_admission.ts +60 -0
- package/packages/core/src/terminal_paint.ts +436 -0
- package/packages/core/src/text_document_width.ts +81 -0
- package/packages/core/src/text_measurement_cache.ts +69 -0
- package/packages/core/src/text_query_layout.ts +179 -0
- package/packages/core/src/text_run_layout.ts +410 -0
- package/packages/core/src/text_span_queries.ts +355 -0
- package/packages/core/src/typed_ast.ts +18 -1
- package/packages/core/src/types.ts +7 -5
- package/packages/core/src/vector_effects.ts +98 -0
- package/packages/core/src/vector_raster.ts +243 -0
- package/packages/core/src/view_bridge.ts +161 -0
- package/packages/core/src/view_check.ts +145 -0
- package/packages/core/src/view_components.ts +2415 -0
- package/packages/core/src/view_coordination.ts +198 -0
- package/packages/core/src/view_evaluator.ts +823 -0
- package/packages/core/src/view_frontend.ts +1102 -0
- package/packages/core/src/view_program.ts +221 -0
- package/packages/core/src/view_reload.ts +166 -0
- package/packages/core/src/view_reload_watch.ts +98 -0
- package/packages/core/src/view_sources.ts +34 -0
- package/packages/core/src/virtual_windows.ts +88 -0
- package/packages/core/src/web_panes.ts +67 -0
- package/packages/core/src/widget_audits.ts +202 -0
- package/packages/core/src/widget_changes.ts +258 -0
- package/packages/core/src/widget_continuity.ts +37 -0
- package/packages/core/src/widget_metrics.ts +139 -0
- package/packages/core/src/widget_motion.ts +171 -0
- package/packages/core/src/widget_paint.ts +272 -0
- package/packages/core/src/widget_paint_walk.ts +203 -0
- package/packages/core/src/widget_presentation.ts +141 -0
- package/packages/core/src/widget_reconcile.ts +63 -0
- package/packages/core/src/widget_retention.ts +62 -0
- package/packages/core/src/widget_routing.ts +262 -0
- package/packages/core/src/window_lifecycle.ts +92 -0
- package/packages/core/testing/index.ts +430 -0
- package/schemas/app.schema.json +13 -0
- package/skill-data/core/SKILL.md +2 -2
- package/skill-data/native-ui/SKILL.md +77 -18
- package/skill-data/ts-core/SKILL.md +117 -11
- package/skill-data/ts-services/SKILL.md +1 -1
- package/skill-data/ts-services/references/service-surface.md +288 -144
- package/src/app_runner/root.zig +39 -12
- package/src/app_runner/ts_compiled_view.zig +1702 -0
- package/src/app_runner/ts_core_main.zig +185 -14
- package/src/app_runner/ts_core_mobile.zig +25 -13
- package/src/automation/server.zig +57 -6
- package/src/automation/snapshot.zig +9 -637
- package/src/automation/snapshot_reference.zig +656 -0
- package/src/automation/snapshot_serialization.zig +566 -0
- package/src/embed/host.zig +2 -0
- package/src/embed/tests.zig +2 -0
- package/src/embed/ui_host.zig +2 -0
- package/src/platform/keyboard_input.zig +32 -0
- package/src/platform/linux/gtk_host.c +36 -24
- package/src/platform/linux/gtk_pixels.h +118 -0
- package/src/platform/linux/gtk_pixels_test.c +241 -0
- package/src/platform/linux/root.zig +4 -0
- package/src/platform/macos/appkit_host.h +7 -2
- package/src/platform/macos/appkit_host.m +219 -39
- package/src/platform/macos/cef_host.mm +15 -1
- package/src/platform/macos/global_shortcuts.zig +138 -0
- package/src/platform/macos/key_codes.zig +102 -0
- package/src/platform/macos/keyboard_input.zig +81 -0
- package/src/platform/macos/pointer_motion_test.m +96 -0
- package/src/platform/macos/root.zig +25 -3
- package/src/platform/macos/scroll_driver_test.m +105 -0
- package/src/platform/macos/spectrum_bins.h +34 -0
- package/src/platform/macos/spectrum_bins_test.c +56 -0
- package/src/platform/macos/text_keyboard_test.m +80 -0
- package/src/platform/macos/webview_inspection_test.m +106 -0
- package/src/platform/macos/widget_focus_test.m +66 -0
- package/src/platform/null_platform.zig +130 -2
- package/src/platform/null_platform_tests.zig +13 -0
- package/src/platform/root.zig +15 -0
- package/src/platform/types.zig +115 -0
- package/src/platform/windows/global_shortcuts.zig +157 -0
- package/src/platform/windows/key_codes.zig +63 -0
- package/src/platform/windows/keyboard_input.zig +136 -0
- package/src/platform/windows/root.zig +17 -0
- package/src/platform/windows/webview2_host.cpp +7 -2
- package/src/primitives/app_manifest/comptime_scene.zig +1 -1
- package/src/primitives/app_manifest/root.zig +2 -0
- package/src/primitives/app_manifest/tests.zig +4 -1
- package/src/primitives/app_manifest/validation.zig +2 -0
- package/src/primitives/canvas/a11y_audit.zig +3 -1
- package/src/primitives/canvas/canvas_frame_coordination_policy.zig +134 -0
- package/src/primitives/canvas/chart_content_policy.zig +75 -0
- package/src/primitives/canvas/chart_plan_policy.zig +196 -0
- package/src/primitives/canvas/code_content_policy.zig +162 -0
- package/src/primitives/canvas/commands.zig +29 -1
- package/src/primitives/canvas/component_composition.zig +125 -0
- package/src/primitives/canvas/component_composition_policy.zig +44 -0
- package/src/primitives/canvas/component_construction_policy.zig +187 -0
- package/src/primitives/canvas/container_layout_policy.zig +87 -0
- package/src/primitives/canvas/control_appearance_policy.zig +142 -0
- package/src/primitives/canvas/control_command_policy.zig +75 -0
- package/src/primitives/canvas/control_content_policy.zig +90 -0
- package/src/primitives/canvas/control_geometry_policy.zig +165 -0
- package/src/primitives/canvas/control_payload_policy.zig +48 -0
- package/src/primitives/canvas/control_primitive_policy.zig +129 -0
- package/src/primitives/canvas/decision_reuse.zig +133 -0
- package/src/primitives/canvas/effect_plan_policy.zig +96 -0
- package/src/primitives/canvas/events.zig +1027 -1
- package/src/primitives/canvas/flow_measurement_policy.zig +237 -0
- package/src/primitives/canvas/font_ttf.zig +27 -3
- package/src/primitives/canvas/fonts/Geist-Bold.ttf +0 -0
- package/src/primitives/canvas/fonts/Geist-Medium.ttf +0 -0
- package/src/primitives/canvas/fonts/OFL.txt +93 -0
- package/src/primitives/canvas/fonts/README.md +15 -0
- package/src/primitives/canvas/frame.zig +92 -23
- package/src/primitives/canvas/glyph_atlas_policy.zig +40 -0
- package/src/primitives/canvas/gpu.zig +10 -0
- package/src/primitives/canvas/gpu_packet_preparation_policy.zig +325 -0
- package/src/primitives/canvas/gpu_planning_policy.zig +364 -0
- package/src/primitives/canvas/gpu_presentation_policy.zig +74 -0
- package/src/primitives/canvas/grid_layout_policy.zig +51 -0
- package/src/primitives/canvas/indicator_plan_policy.zig +128 -0
- package/src/primitives/canvas/intrinsic_layout_policy.zig +87 -0
- package/src/primitives/canvas/intrinsic_measure_policy.zig +131 -0
- package/src/primitives/canvas/layout_audit.zig +5 -2
- package/src/primitives/canvas/layout_coordination_policy.zig +262 -0
- package/src/primitives/canvas/leaf_plan_policy.zig +117 -0
- package/src/primitives/canvas/markdown.zig +13 -3
- package/src/primitives/canvas/markdown_content_policy.zig +227 -0
- package/src/primitives/canvas/markdown_image_binding.zig +81 -0
- package/src/primitives/canvas/markdown_tests.zig +3 -3
- package/src/primitives/canvas/measurement_coordination_policy.zig +288 -0
- package/src/primitives/canvas/numeric_capabilities.zig +14 -0
- package/src/primitives/canvas/reference.zig +15 -11
- package/src/primitives/canvas/reference_tests.zig +58 -0
- package/src/primitives/canvas/registered_font_policy.zig +152 -0
- package/src/primitives/canvas/render.zig +48 -0
- package/src/primitives/canvas/render_cache_policy.zig +184 -0
- package/src/primitives/canvas/render_coordination_policy.zig +163 -0
- package/src/primitives/canvas/render_damage_policy.zig +160 -0
- package/src/primitives/canvas/render_effects.zig +14 -0
- package/src/primitives/canvas/render_generic_resources.zig +14 -0
- package/src/primitives/canvas/render_images.zig +14 -0
- package/src/primitives/canvas/render_layers.zig +14 -0
- package/src/primitives/canvas/render_override_policy.zig +119 -0
- package/src/primitives/canvas/render_paths.zig +14 -0
- package/src/primitives/canvas/render_plan_policy.zig +199 -0
- package/src/primitives/canvas/render_resource_policy.zig +476 -0
- package/src/primitives/canvas/root.zig +107 -4
- package/src/primitives/canvas/semantic_tree_policy.zig +158 -0
- package/src/primitives/canvas/serialization.zig +8 -1
- package/src/primitives/canvas/surface_layout_policy.zig +36 -0
- package/src/primitives/canvas/surface_recipe_policy.zig +231 -0
- package/src/primitives/canvas/terminal_grid.zig +10 -696
- package/src/primitives/canvas/terminal_grid_reference.zig +709 -0
- package/src/primitives/canvas/terminal_paint_policy.zig +191 -0
- package/src/primitives/canvas/text.zig +1 -0
- package/src/primitives/canvas/text_atlas.zig +113 -0
- package/src/primitives/canvas/text_cache_policy.zig +94 -0
- package/src/primitives/canvas/text_document_policy.zig +120 -0
- package/src/primitives/canvas/text_layout.zig +51 -2
- package/src/primitives/canvas/text_layout_cache.zig +29 -0
- package/src/primitives/canvas/text_layout_hash.zig +1 -0
- package/src/primitives/canvas/text_layout_types.zig +3 -0
- package/src/primitives/canvas/text_measure_cache.zig +46 -0
- package/src/primitives/canvas/text_measurement_policy.zig +124 -0
- package/src/primitives/canvas/text_metrics.zig +53 -37
- package/src/primitives/canvas/text_metrics_tests.zig +52 -7
- package/src/primitives/canvas/text_query_policy.zig +295 -0
- package/src/primitives/canvas/text_run_policy.zig +252 -0
- package/src/primitives/canvas/text_scalar_policy.zig +234 -0
- package/src/primitives/canvas/text_span_query_policy.zig +232 -0
- package/src/primitives/canvas/text_spans.zig +280 -8
- package/src/primitives/canvas/text_tests.zig +10 -0
- package/src/primitives/canvas/tokens.zig +47 -0
- package/src/primitives/canvas/ui.zig +251 -83
- package/src/primitives/canvas/ui_markup.zig +207 -46
- package/src/primitives/canvas/ui_markup_canonical.zig +237 -0
- package/src/primitives/canvas/ui_markup_compiled.zig +1724 -80
- package/src/primitives/canvas/ui_markup_compiled_tests.zig +225 -0
- package/src/primitives/canvas/ui_markup_compiled_values.zig +76 -0
- package/src/primitives/canvas/ui_markup_construction.zig +146 -0
- package/src/primitives/canvas/ui_markup_contract.zig +146 -14
- package/src/primitives/canvas/ui_markup_contract_tests.zig +77 -0
- package/src/primitives/canvas/ui_markup_display.zig +82 -0
- package/src/primitives/canvas/ui_markup_document.zig +196 -0
- package/src/primitives/canvas/ui_markup_elements.zig +163 -0
- package/src/primitives/canvas/ui_markup_expr.zig +192 -2
- package/src/primitives/canvas/ui_markup_imports.zig +262 -0
- package/src/primitives/canvas/ui_markup_parser.zig +117 -0
- package/src/primitives/canvas/ui_markup_reflect.zig +56 -0
- package/src/primitives/canvas/ui_markup_runtime.zig +76 -0
- package/src/primitives/canvas/ui_markup_scalars.zig +115 -0
- package/src/primitives/canvas/ui_markup_shapes.zig +224 -0
- package/src/primitives/canvas/ui_markup_specialized.zig +106 -0
- package/src/primitives/canvas/ui_markup_tests.zig +116 -0
- package/src/primitives/canvas/ui_markup_text.zig +128 -0
- package/src/primitives/canvas/ui_markup_values.zig +368 -0
- package/src/primitives/canvas/ui_markup_view.zig +3026 -57
- package/src/primitives/canvas/ui_markup_view_tests.zig +142 -10
- package/src/primitives/canvas/ui_schema.zig +13 -1
- package/src/primitives/canvas/ui_schema_tests.zig +11 -7
- package/src/primitives/canvas/ui_tests.zig +1 -0
- package/src/primitives/canvas/vector.zig +36 -2
- package/src/primitives/canvas/vector_effect_policy.zig +236 -0
- package/src/primitives/canvas/vector_raster_policy.zig +190 -0
- package/src/primitives/canvas/virtual_extent_policy.zig +350 -0
- package/src/primitives/canvas/virtual_extents.zig +113 -3
- package/src/primitives/canvas/virtual_flow_policy.zig +108 -0
- package/src/primitives/canvas/widget_audit_policy.zig +293 -0
- package/src/primitives/canvas/widget_change_policy.zig +298 -0
- package/src/primitives/canvas/widget_invalidation.zig +113 -2
- package/src/primitives/canvas/widget_layout.zig +673 -128
- package/src/primitives/canvas/widget_layout_tests.zig +4 -0
- package/src/primitives/canvas/widget_metric_policy.zig +129 -0
- package/src/primitives/canvas/widget_metrics.zig +45 -6
- package/src/primitives/canvas/widget_paint_policy.zig +166 -0
- package/src/primitives/canvas/widget_paint_walk_policy.zig +252 -0
- package/src/primitives/canvas/widget_presentation_policy.zig +168 -0
- package/src/primitives/canvas/widget_render.zig +744 -74
- package/src/primitives/canvas/widget_render_controls.zig +1217 -133
- package/src/primitives/canvas/widget_render_scroll.zig +11 -3
- package/src/primitives/canvas/widget_render_style.zig +94 -0
- package/src/primitives/canvas/widget_render_surfaces.zig +61 -50
- package/src/primitives/canvas/widget_routing.zig +75 -0
- package/src/primitives/canvas/widget_routing_policy.zig +135 -0
- package/src/primitives/canvas/widget_runtime.zig +21 -1
- package/src/primitives/canvas/widget_semantics.zig +25 -0
- package/src/primitives/canvas/widget_text_input.zig +86 -23
- package/src/primitives/canvas/widget_text_select.zig +1 -0
- package/src/primitives/canvas/widget_tree.zig +8 -1
- package/src/primitives/canvas/widgets.zig +42 -12
- package/src/primitives/canvas/wrapped_layout_policy.zig +104 -0
- package/src/root.zig +26 -0
- package/src/runtime/accessibility_policy.zig +122 -0
- package/src/runtime/api.zig +29 -0
- package/src/runtime/app_dispatch_policy.zig +68 -0
- package/src/runtime/authorization_policy.zig +150 -0
- package/src/runtime/automation_command_policy.zig +241 -0
- package/src/runtime/automation_interaction_policy.zig +107 -0
- package/src/runtime/automation_snapshot.zig +52 -22
- package/src/runtime/automation_snapshot_reference.zig +290 -0
- package/src/runtime/automation_widget_dispatch.zig +267 -355
- package/src/runtime/automation_widget_dispatch_reference.zig +900 -0
- package/src/runtime/blob_policy.zig +58 -0
- package/src/runtime/blob_reference.zig +64 -0
- package/src/runtime/bridge_descriptor_policy.zig +206 -0
- package/src/runtime/bridge_payload.zig +2 -0
- package/src/runtime/builtin_bridge.zig +180 -44
- package/src/runtime/builtin_coordination_policy.zig +121 -0
- package/src/runtime/callback_policy_test_reference.zig +97 -0
- package/src/runtime/canvas_drag_policy.zig +94 -0
- package/src/runtime/canvas_fonts.zig +38 -10
- package/src/runtime/canvas_frame.zig +590 -134
- package/src/runtime/canvas_frame_helpers.zig +1 -0
- package/src/runtime/canvas_hover_policy.zig +131 -0
- package/src/runtime/canvas_images.zig +59 -30
- package/src/runtime/canvas_keyboard_focus_policy.zig +154 -0
- package/src/runtime/canvas_limits.zig +1 -1
- package/src/runtime/canvas_presentation_lifecycle_policy.zig +86 -0
- package/src/runtime/canvas_scene_observation_policy.zig +181 -0
- package/src/runtime/canvas_widget_context_menu.zig +183 -4
- package/src/runtime/canvas_widget_context_menu_test_cases.zig +1147 -0
- package/src/runtime/canvas_widget_context_menu_tests.zig +23 -1098
- package/src/runtime/canvas_widget_display.zig +110 -9
- package/src/runtime/canvas_widget_events.zig +718 -328
- package/src/runtime/canvas_widget_runtime.zig +720 -150
- package/src/runtime/canvas_widget_scroll_drivers.zig +39 -1
- package/src/runtime/canvas_widget_scroll_tests.zig +31 -0
- package/src/runtime/canvas_widget_state.zig +93 -56
- package/src/runtime/channel_sources.zig +80 -0
- package/src/runtime/command_policy.zig +161 -0
- package/src/runtime/component_policy.zig +83 -0
- package/src/runtime/context_menu_policy.zig +112 -0
- package/src/runtime/core.zig +170 -6
- package/src/runtime/desktop_files.zig +189 -0
- package/src/runtime/effects.zig +638 -33
- package/src/runtime/effects_host_tests.zig +25 -0
- package/src/runtime/effects_tests.zig +28 -0
- package/src/runtime/file_policy_test_reference.zig +113 -0
- package/src/runtime/flow.zig +419 -341
- package/src/runtime/flow_reference.zig +1427 -0
- package/src/runtime/font_registry_policy.zig +72 -0
- package/src/runtime/frame_profile.zig +24 -33
- package/src/runtime/global_shortcuts.zig +75 -0
- package/src/runtime/gpu_surface_events.zig +97 -35
- package/src/runtime/host_event_pump.zig +303 -0
- package/src/runtime/host_event_pump_reference.zig +268 -0
- package/src/runtime/host_flow_policy.zig +155 -0
- package/src/runtime/host_input_regions_policy.zig +156 -0
- package/src/runtime/image_registry_policy.zig +94 -0
- package/src/runtime/input_composition_policy.zig +138 -0
- package/src/runtime/journal_policy.zig +66 -0
- package/src/runtime/journal_reference.zig +53 -0
- package/src/runtime/keyboard_input.zig +86 -0
- package/src/runtime/lifecycle_policy_test_reference.zig +97 -0
- package/src/runtime/markup_development_policy.zig +91 -0
- package/src/runtime/media_surface.zig +40 -1
- package/src/runtime/motion_sampling_policy.zig +159 -0
- package/src/runtime/recording_policy.zig +42 -0
- package/src/runtime/render_animation_policy.zig +206 -0
- package/src/runtime/replay_policy.zig +66 -0
- package/src/runtime/replay_policy_reference.zig +326 -0
- package/src/runtime/replay_progress_policy.zig +64 -0
- package/src/runtime/replay_progress_reference.zig +34 -0
- package/src/runtime/request_policy_test_reference.zig +188 -0
- package/src/runtime/root.zig +16 -0
- package/src/runtime/scroll_mutation_policy.zig +130 -0
- package/src/runtime/scroll_mutation_runtime.zig +158 -0
- package/src/runtime/scroll_tree_policy.zig +99 -0
- package/src/runtime/session_blobs.zig +157 -58
- package/src/runtime/session_blobs_reference.zig +692 -0
- package/src/runtime/session_codec.zig +361 -0
- package/src/runtime/session_codec_reference.zig +1027 -0
- package/src/runtime/session_journal.zig +246 -983
- package/src/runtime/session_record.zig +231 -45
- package/src/runtime/session_replay.zig +157 -415
- package/src/runtime/session_tests.zig +552 -0
- package/src/runtime/shell_admission_policy.zig +225 -0
- package/src/runtime/shell_coordination_policy.zig +138 -0
- package/src/runtime/shell_layout.zig +126 -1
- package/src/runtime/snapshot_policy.zig +60 -0
- package/src/runtime/snapshot_reference.zig +64 -0
- package/src/runtime/staged_rebuild_policy.zig +83 -0
- package/src/runtime/state.zig +16 -0
- package/src/runtime/status_validation.zig +190 -0
- package/src/runtime/system_admission_policy.zig +140 -0
- package/src/runtime/system_services.zig +65 -36
- package/src/runtime/tests.zig +2 -0
- package/src/runtime/ts_canvas_hooks.zig +261 -0
- package/src/runtime/ts_canvas_hooks_tests.zig +279 -0
- package/src/runtime/ts_canvas_icons.zig +234 -0
- package/src/runtime/ts_core_host.zig +2451 -411
- package/src/runtime/ts_core_host_tests.zig +1982 -0
- package/src/runtime/ts_test_host.zig +699 -0
- package/src/runtime/ts_ui_app.zig +1111 -45
- package/src/runtime/ui_app.zig +1381 -650
- package/src/runtime/ui_app_provenance.zig +147 -5
- package/src/runtime/ui_app_provenance_reference.zig +370 -0
- package/src/runtime/ui_app_tests.zig +667 -188
- package/src/runtime/ui_app_window_tests.zig +222 -0
- package/src/runtime/view.zig +25 -0
- package/src/runtime/view_canvas.zig +30 -6
- package/src/runtime/view_coordination_policy.zig +147 -0
- package/src/runtime/view_reload.zig +226 -0
- package/src/runtime/view_widget_control.zig +51 -14
- package/src/runtime/view_widget_scroll.zig +46 -26
- package/src/runtime/view_widget_text.zig +153 -68
- package/src/runtime/view_widget_tree.zig +503 -69
- package/src/runtime/virtual_window_policy.zig +128 -0
- package/src/runtime/web_pane_policy.zig +111 -0
- package/src/runtime/web_pane_test_cases.zig +204 -0
- package/src/runtime/webview_view_bridge_tests.zig +2 -0
- package/src/runtime/widget_continuity_policy.zig +73 -0
- package/src/runtime/widget_motion_policy.zig +238 -0
- package/src/runtime/widget_reconcile_policy.zig +81 -0
- package/src/runtime/widget_retention_policy.zig +75 -0
- package/src/runtime/window_command_bridge_tests.zig +63 -0
- package/src/runtime/window_lifecycle_policy.zig +127 -0
- package/src/runtime/window_storage.zig +74 -8
- package/src/runtime/window_view_runtime.zig +148 -33
- package/src/runtime/window_views.zig +179 -11
- package/src/security/root.zig +1 -0
- package/src/tooling/components/identity_tests.zig +62 -36
- package/src/tooling/components/stepper.native +24 -0
- package/src/tooling/components/stepper.zig +0 -19
- package/src/tooling/components/timeline-item.native +22 -0
- package/src/tooling/components/timeline.native +5 -3
- package/src/tooling/components/timeline_item.zig +0 -32
- package/src/tooling/eject_components.zig +76 -8
- package/src/tooling/ios.zig +66 -12
- package/src/tooling/manifest.zig +35 -0
- package/src/tooling/raw_manifest.zig +6 -0
- package/src/tooling/templates.zig +23 -3
- package/src/tooling/ts_core.zig +97 -4
- package/src/tooling/verbs.zig +87 -1
- package/tools/corewire/build_profile.mjs +54 -0
- package/tools/corewire/contract_intake.ts +303 -0
- package/tools/corewire/contract_intake.zig +82 -0
- package/tools/corewire/core.test.ts +188 -0
- package/tools/corewire/core_abi.zig +55 -0
- package/tools/corewire/core_cases.ts +233 -0
- package/tools/corewire/core_contract.ts +407 -0
- package/tools/corewire/core_emission.ts +136 -0
- package/tools/corewire/core_emission.zig +69 -0
- package/tools/corewire/core_goldens.json +3110 -0
- package/tools/corewire/core_policy.ts +14 -0
- package/tools/corewire/core_policy.zig +48 -0
- package/tools/corewire/core_projection.ts +361 -0
- package/tools/corewire/core_vocabulary.ts +6 -0
- package/tools/corewire/emit.zig +19 -1590
- package/tools/corewire/emit_facade.ts +714 -0
- package/tools/corewire/emit_facade.zig +10 -3752
- package/tools/corewire/emit_mirror.ts +300 -0
- package/tools/corewire/emit_profile.ts +50 -0
- package/tools/corewire/emit_service.ts +331 -0
- package/tools/corewire/emit_service.zig +23 -842
- package/tools/corewire/entry.test.ts +95 -0
- package/tools/corewire/entry_coordination.ts +127 -0
- package/tools/corewire/entry_coordination.zig +190 -0
- package/tools/corewire/facade_templates.ts +85 -0
- package/tools/corewire/filesystem.test.ts +166 -0
- package/tools/corewire/filesystem_coordination.ts +213 -0
- package/tools/corewire/filesystem_coordination.zig +245 -0
- package/tools/corewire/intake.test.ts +39 -0
- package/tools/corewire/intake_cases.ts +55 -0
- package/tools/corewire/intake_goldens.json +12237 -0
- package/tools/corewire/invocation.test.ts +28 -0
- package/tools/corewire/invocation.ts +175 -0
- package/tools/corewire/invocation.zig +136 -0
- package/tools/corewire/invocation_cases.ts +60 -0
- package/tools/corewire/invocation_fixture.ts +33 -0
- package/tools/corewire/invocation_goldens.json +1143 -0
- package/tools/corewire/invocation_tests.zig +111 -0
- package/tools/corewire/invocation_usage.ts +2 -0
- package/tools/corewire/lossless_projection.ts +96 -0
- package/tools/corewire/main.zig +7 -680
- package/tools/corewire/main_reference.zig +415 -0
- package/tools/corewire/mirror_templates.ts +59 -0
- package/tools/corewire/profile.test.ts +248 -0
- package/tools/corewire/profile.zig +56 -0
- package/tools/corewire/profile_emission.ts +204 -0
- package/tools/corewire/profile_library.json +29 -0
- package/tools/corewire/profile_tests.zig +136 -0
- package/tools/corewire/service.test.ts +75 -0
- package/tools/corewire/service_cases.ts +61 -0
- package/tools/corewire/service_contract.zig +40 -146
- package/tools/corewire/service_goldens.json +650 -0
- package/tools/corewire/service_projection.zig +52 -0
- package/tools/corewire/service_templates.ts +14 -0
- package/tools/corewire/shim_rt.zig +9 -0
- package/tools/corewire/sidecar.zig +269 -1438
- package/tools/corewire/emit_profile.zig +0 -521
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#ifndef NATIVE_SDK_SPECTRUM_BINS_H
|
|
2
|
+
#define NATIVE_SDK_SPECTRUM_BINS_H
|
|
3
|
+
|
|
4
|
+
#include <math.h>
|
|
5
|
+
|
|
6
|
+
typedef struct native_sdk_spectrum_bin_range {
|
|
7
|
+
int first;
|
|
8
|
+
int last;
|
|
9
|
+
} native_sdk_spectrum_bin_range_t;
|
|
10
|
+
|
|
11
|
+
/* FFT power has fft_size / 2 entries; bin 0 is DC and the Nyquist bin
|
|
12
|
+
* is not present. Return 0 for a band wholly beyond that range. */
|
|
13
|
+
static inline int native_sdk_spectrum_bin_range(
|
|
14
|
+
double low_hz,
|
|
15
|
+
double high_hz,
|
|
16
|
+
double sample_rate,
|
|
17
|
+
int fft_size,
|
|
18
|
+
native_sdk_spectrum_bin_range_t *range
|
|
19
|
+
) {
|
|
20
|
+
const double nyquist_hz = sample_rate / 2.0;
|
|
21
|
+
if (low_hz >= nyquist_hz) return 0;
|
|
22
|
+
|
|
23
|
+
const int max_bin = fft_size / 2 - 1;
|
|
24
|
+
const double hz_per_bin = sample_rate / (double)fft_size;
|
|
25
|
+
int first = (int)(low_hz / hz_per_bin);
|
|
26
|
+
int last = high_hz >= nyquist_hz ? max_bin : (int)ceil(high_hz / hz_per_bin);
|
|
27
|
+
if (first < 1) first = 1;
|
|
28
|
+
if (last > max_bin) last = max_bin;
|
|
29
|
+
if (last < first) last = first;
|
|
30
|
+
*range = (native_sdk_spectrum_bin_range_t){ .first = first, .last = last };
|
|
31
|
+
return 1;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
#endif
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#include "spectrum_bins.h"
|
|
2
|
+
|
|
3
|
+
#include <stdio.h>
|
|
4
|
+
|
|
5
|
+
#define CHECK(condition) do { \
|
|
6
|
+
if (!(condition)) { \
|
|
7
|
+
fprintf(stderr, "%s:%d: %s\n", __FILE__, __LINE__, #condition); \
|
|
8
|
+
return 0; \
|
|
9
|
+
} \
|
|
10
|
+
} while (0)
|
|
11
|
+
|
|
12
|
+
static int check_band_ranges(double sample_rate, int expected_present) {
|
|
13
|
+
const int fft_size = 2048;
|
|
14
|
+
const int band_count = 32;
|
|
15
|
+
const double low_hz = 50.0;
|
|
16
|
+
const double ratio = 16000.0 / low_hz;
|
|
17
|
+
int present = 0;
|
|
18
|
+
for (int band = 0; band < band_count; band += 1) {
|
|
19
|
+
const double band_low = low_hz * pow(ratio, (double)band / band_count);
|
|
20
|
+
const double band_high = low_hz * pow(ratio, (double)(band + 1) / band_count);
|
|
21
|
+
native_sdk_spectrum_bin_range_t bins = { .first = -1, .last = -1 };
|
|
22
|
+
const int has_bins = native_sdk_spectrum_bin_range(band_low, band_high, sample_rate, fft_size, &bins);
|
|
23
|
+
CHECK(has_bins == (band_low < sample_rate / 2.0));
|
|
24
|
+
if (has_bins) {
|
|
25
|
+
CHECK(bins.first >= 1);
|
|
26
|
+
CHECK(bins.first <= bins.last);
|
|
27
|
+
CHECK(bins.last < fft_size / 2);
|
|
28
|
+
present += 1;
|
|
29
|
+
} else {
|
|
30
|
+
CHECK(bins.first == -1 && bins.last == -1);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
CHECK(present == expected_present);
|
|
34
|
+
return 1;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
int main(void) {
|
|
38
|
+
native_sdk_spectrum_bin_range_t bins;
|
|
39
|
+
|
|
40
|
+
/* A band starting at Nyquist must not fold onto the final FFT bin. */
|
|
41
|
+
CHECK(!native_sdk_spectrum_bin_range(8000, 9000, 16000, 2048, &bins));
|
|
42
|
+
CHECK(native_sdk_spectrum_bin_range(7999, 9000, 16000, 2048, &bins));
|
|
43
|
+
CHECK(bins.first == 1023 && bins.last == 1023);
|
|
44
|
+
|
|
45
|
+
CHECK(native_sdk_spectrum_bin_range(50, 60, 16000, 2048, &bins));
|
|
46
|
+
CHECK(bins.first == 6 && bins.last == 8);
|
|
47
|
+
CHECK(native_sdk_spectrum_bin_range(15000, 16000, 48000, 2048, &bins));
|
|
48
|
+
CHECK(bins.first == 640 && bins.last == 683);
|
|
49
|
+
|
|
50
|
+
CHECK(check_band_ranges(8000, 25));
|
|
51
|
+
CHECK(check_band_ranges(16000, 29));
|
|
52
|
+
CHECK(check_band_ranges(32000, 32));
|
|
53
|
+
CHECK(check_band_ranges(48000, 32));
|
|
54
|
+
CHECK(check_band_ranges(1, 0));
|
|
55
|
+
return 0;
|
|
56
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/* Exercise the production AppKit Enter path: modifier intent must survive
|
|
2
|
+
* Cocoa text interpretation while IME Return still commits marked text. */
|
|
3
|
+
#import "appkit_host.m"
|
|
4
|
+
#include <assert.h>
|
|
5
|
+
|
|
6
|
+
native_sdk_update_verify_result_t native_sdk_update_verify_feed(
|
|
7
|
+
const char *envelope, size_t envelope_len,
|
|
8
|
+
const char *public_key, size_t public_key_len,
|
|
9
|
+
const char *bundle_id, size_t bundle_id_len,
|
|
10
|
+
const char *current_version, size_t current_version_len,
|
|
11
|
+
const char *target, size_t target_len,
|
|
12
|
+
char *version_out, size_t version_capacity,
|
|
13
|
+
char *archive_url_out, size_t archive_url_capacity,
|
|
14
|
+
char *release_notes_out, size_t release_notes_capacity) {
|
|
15
|
+
abort();
|
|
16
|
+
}
|
|
17
|
+
int native_sdk_update_verify_archive(const char *path, size_t path_len, uint64_t expected_bytes, const char *sha256, size_t sha256_len) {
|
|
18
|
+
abort();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@interface NativeSdkTextHostProbe : NativeSdkAppKitHost
|
|
22
|
+
@property(nonatomic, assign) NSUInteger inputs;
|
|
23
|
+
@property(nonatomic, assign) native_sdk_appkit_event_t lastInput;
|
|
24
|
+
@end
|
|
25
|
+
@implementation NativeSdkTextHostProbe
|
|
26
|
+
- (void)emitEvent:(native_sdk_appkit_event_t)event {
|
|
27
|
+
if (event.kind == NATIVE_SDK_APPKIT_EVENT_GPU_SURFACE_INPUT) {
|
|
28
|
+
self.inputs += 1;
|
|
29
|
+
self.lastInput = event;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
@end
|
|
33
|
+
|
|
34
|
+
@interface NativeSdkTextProbe : NativeSdkMetalSurfaceView
|
|
35
|
+
@property(nonatomic, strong) NativeSdkWidgetAccessibilityElement *editor;
|
|
36
|
+
@property(nonatomic, assign) BOOL marked;
|
|
37
|
+
@property(nonatomic, assign) NSUInteger interpretations;
|
|
38
|
+
@end
|
|
39
|
+
@implementation NativeSdkTextProbe
|
|
40
|
+
- (void)requestRetainedCanvasFrame {}
|
|
41
|
+
- (NativeSdkWidgetAccessibilityElement *)focusedTextAccessibilityElement { return self.editor; }
|
|
42
|
+
- (BOOL)hasMarkedText { return self.marked; }
|
|
43
|
+
- (void)interpretKeyEvents:(NSArray<NSEvent *> *)events {
|
|
44
|
+
self.interpretations += 1;
|
|
45
|
+
// Cocoa can map Shift+Return onto the modifier-less newline selector.
|
|
46
|
+
[self doCommandBySelector:@selector(insertNewline:)];
|
|
47
|
+
}
|
|
48
|
+
@end
|
|
49
|
+
|
|
50
|
+
int main(void) {
|
|
51
|
+
@autoreleasepool {
|
|
52
|
+
[NSApplication sharedApplication];
|
|
53
|
+
NativeSdkTextHostProbe *host = [NativeSdkTextHostProbe new];
|
|
54
|
+
NativeSdkTextProbe *probe = [[NativeSdkTextProbe alloc] initWithFrame:NSMakeRect(0, 0, 600, 600)];
|
|
55
|
+
probe.host = host; probe.surfaceLabel = @"canvas";
|
|
56
|
+
probe.editor = [NativeSdkWidgetAccessibilityElement new];
|
|
57
|
+
const NSEventModifierFlags flags[] = { NSEventModifierFlagShift, 0,
|
|
58
|
+
NSEventModifierFlagCommand, NSEventModifierFlagOption, NSEventModifierFlagControl,
|
|
59
|
+
NSEventModifierFlagShift | NSEventModifierFlagCommand };
|
|
60
|
+
for (NSUInteger i = 0; i < sizeof(flags) / sizeof(flags[0]); i++) {
|
|
61
|
+
NSEvent *event = [NSEvent keyEventWithType:NSEventTypeKeyDown location:NSZeroPoint
|
|
62
|
+
modifierFlags:flags[i] timestamp:0 windowNumber:0 context:nil
|
|
63
|
+
characters:@"\r" charactersIgnoringModifiers:@"\r" isARepeat:NO keyCode:36];
|
|
64
|
+
[probe keyDown:event];
|
|
65
|
+
assert(host.inputs == i + 1);
|
|
66
|
+
assert(host.lastInput.input_kind == NATIVE_SDK_APPKIT_GPU_INPUT_KEY_DOWN);
|
|
67
|
+
assert(host.lastInput.key_text_len == 5 && memcmp(host.lastInput.key_text, "enter", 5) == 0);
|
|
68
|
+
assert(host.lastInput.shortcut_modifiers == NativeSdkModifierFlagsForEvent(event));
|
|
69
|
+
assert(probe.interpretations == 0);
|
|
70
|
+
}
|
|
71
|
+
probe.marked = YES;
|
|
72
|
+
NSEvent *event = [NSEvent keyEventWithType:NSEventTypeKeyDown location:NSZeroPoint
|
|
73
|
+
modifierFlags:NSEventModifierFlagShift timestamp:0 windowNumber:0 context:nil
|
|
74
|
+
characters:@"\r" charactersIgnoringModifiers:@"\r" isARepeat:NO keyCode:36];
|
|
75
|
+
[probe keyDown:event];
|
|
76
|
+
assert(probe.interpretations == 1);
|
|
77
|
+
assert(host.inputs == sizeof(flags) / sizeof(flags[0]) + 1);
|
|
78
|
+
}
|
|
79
|
+
return 0;
|
|
80
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/* Exercise the real host creation ABI and every system-WebView path.
|
|
2
|
+
* Inspection must never be inferred from bridge access or menu presence. */
|
|
3
|
+
#import "appkit_host.m"
|
|
4
|
+
#include <assert.h>
|
|
5
|
+
|
|
6
|
+
native_sdk_update_verify_result_t native_sdk_update_verify_feed(
|
|
7
|
+
const char *envelope, size_t envelope_len,
|
|
8
|
+
const char *public_key, size_t public_key_len,
|
|
9
|
+
const char *bundle_id, size_t bundle_id_len,
|
|
10
|
+
const char *current_version, size_t current_version_len,
|
|
11
|
+
const char *target, size_t target_len,
|
|
12
|
+
char *version_out, size_t version_capacity,
|
|
13
|
+
char *archive_url_out, size_t archive_url_capacity,
|
|
14
|
+
char *release_notes_out, size_t release_notes_capacity) {
|
|
15
|
+
abort();
|
|
16
|
+
}
|
|
17
|
+
int native_sdk_update_verify_archive(const char *path, size_t path_len, uint64_t expected_bytes, const char *sha256, size_t sha256_len) {
|
|
18
|
+
abort();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
static void checkInspection(WKWebView *view, BOOL enabled) {
|
|
23
|
+
assert(view != nil);
|
|
24
|
+
if ([view.configuration.preferences respondsToSelector:NSSelectorFromString(@"setDeveloperExtrasEnabled:")]) {
|
|
25
|
+
assert([[view.configuration.preferences valueForKey:@"developerExtrasEnabled"] boolValue] == enabled);
|
|
26
|
+
}
|
|
27
|
+
if ([view respondsToSelector:NSSelectorFromString(@"setInspectable:")]) {
|
|
28
|
+
assert([[view valueForKey:@"inspectable"] boolValue] == enabled);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
static BOOL hasMenuAction(NSMenu *menu, SEL action) {
|
|
33
|
+
for (NSMenuItem *item in menu.itemArray) {
|
|
34
|
+
if (item.action == action || (item.submenu && hasMenuAction(item.submenu, action))) return YES;
|
|
35
|
+
}
|
|
36
|
+
return NO;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
static void checkHost(BOOL enabled, BOOL declaresWebContent) {
|
|
40
|
+
native_sdk_appkit_host_t *handle = native_sdk_appkit_create(
|
|
41
|
+
"inspection-test", 15, "Inspection Test", 15, "", 0, "", 0,
|
|
42
|
+
declaresWebContent, enabled, 1,
|
|
43
|
+
"Inspection Test", 15, "dev.native_sdk.inspection_test", sizeof("dev.native_sdk.inspection_test") - 1,
|
|
44
|
+
"", 0, "main", 4, 0, 0, 640, 480, 0, 0, 0, 1, 0, 0, 0);
|
|
45
|
+
assert(handle);
|
|
46
|
+
NativeSdkAppKitHost *host = (__bridge NativeSdkAppKitHost *)handle;
|
|
47
|
+
assert(host.webViewInspection == enabled);
|
|
48
|
+
// Canvas-first hosts must stay lazy, even when Debug permits inspection.
|
|
49
|
+
assert(host.webView == nil && host.webViews.count == 0);
|
|
50
|
+
assert(hasMenuAction(NSApp.mainMenu, @selector(toggleWebInspector:)) == (enabled && declaresWebContent));
|
|
51
|
+
assert(hasMenuAction(NSApp.mainMenu, @selector(reload:)) == declaresWebContent);
|
|
52
|
+
if (!enabled) {
|
|
53
|
+
[host toggleWebInspector:nil];
|
|
54
|
+
assert(host.webView == nil); // A denied action cannot instantiate WebKit.
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Loading a primary page is the normal WebView-first startup path.
|
|
58
|
+
const char html[] = "<h1>Inspection test</h1>";
|
|
59
|
+
native_sdk_appkit_load_webview(handle, html, sizeof(html) - 1, 0,
|
|
60
|
+
"", 0, "", 0, "", 0, 0);
|
|
61
|
+
WKWebView *main = host.webView;
|
|
62
|
+
checkInspection(main, enabled);
|
|
63
|
+
assert([host ensureMainWebViewForWindowId:1] == main);
|
|
64
|
+
assert(main.configuration.userContentController.userScripts.count == 1);
|
|
65
|
+
|
|
66
|
+
assert([host createWindowWithId:2 title:@"Secondary" label:@"secondary"
|
|
67
|
+
x:0 y:0 width:400 height:300 restoreFrame:NO initialPlacement:0
|
|
68
|
+
restorePolicy:0 resizable:YES titlebarStyle:0 showPolicy:0 windowFlags:0 makeMain:NO]);
|
|
69
|
+
assert(host.webViews[@2] == nil);
|
|
70
|
+
WKWebView *secondary = [host ensureMainWebViewForWindowId:2];
|
|
71
|
+
checkInspection(secondary, enabled);
|
|
72
|
+
assert([host ensureMainWebViewForWindowId:2] == secondary);
|
|
73
|
+
|
|
74
|
+
// Trusted and isolated children, in both windows, share the host capability.
|
|
75
|
+
for (uint64_t windowId = 1; windowId <= 2; windowId++) {
|
|
76
|
+
for (NSUInteger bridge = 0; bridge <= 1; bridge++) {
|
|
77
|
+
NSString *label = bridge ? @"trusted" : @"isolated";
|
|
78
|
+
assert([host createWebViewInWindow:windowId label:label url:@"zero://inline/child"
|
|
79
|
+
x:0 y:0 width:200 height:120 layer:1 transparent:NO bridgeEnabled:(bridge != 0)]);
|
|
80
|
+
NSString *key = [host webViewKeyForWindow:windowId label:label];
|
|
81
|
+
WKWebView *child = host.childWebViews[key];
|
|
82
|
+
checkInspection(child, enabled);
|
|
83
|
+
assert(child.configuration.userContentController.userScripts.count == bridge);
|
|
84
|
+
assert([host.bridgeEnabledChildWebViewKeys containsObject:key] == (bridge != 0));
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
assert(host.childWebViews.count == 4);
|
|
88
|
+
for (NSWindow *window in host.windows.allValues) {
|
|
89
|
+
window.delegate = nil;
|
|
90
|
+
[window close];
|
|
91
|
+
}
|
|
92
|
+
native_sdk_appkit_destroy(handle);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
int main(void) {
|
|
96
|
+
@autoreleasepool {
|
|
97
|
+
[NSApplication sharedApplication];
|
|
98
|
+
for (NSUInteger enabled = 0; enabled <= 1; enabled++) {
|
|
99
|
+
for (NSUInteger web = 0; web <= 1; web++) {
|
|
100
|
+
checkHost(enabled != 0, web != 0);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
puts("WebView inspection: all primary, lazy, secondary, child and menu checks passed");
|
|
104
|
+
}
|
|
105
|
+
return 0;
|
|
106
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/* Exercise the production accessibility element without opening a window.
|
|
2
|
+
* Internal publication updates its snapshot; only assistive focus writes
|
|
3
|
+
* may enqueue a runtime focus action. */
|
|
4
|
+
#import "appkit_host.m"
|
|
5
|
+
#include <assert.h>
|
|
6
|
+
|
|
7
|
+
/* These unrelated host services are implemented by Zig in apps. The
|
|
8
|
+
* windowless probe must never reach them. */
|
|
9
|
+
native_sdk_update_verify_result_t native_sdk_update_verify_feed(
|
|
10
|
+
const char *envelope, size_t envelope_len,
|
|
11
|
+
const char *public_key, size_t public_key_len,
|
|
12
|
+
const char *bundle_id, size_t bundle_id_len,
|
|
13
|
+
const char *current_version, size_t current_version_len,
|
|
14
|
+
const char *target, size_t target_len,
|
|
15
|
+
char *version_out, size_t version_capacity,
|
|
16
|
+
char *archive_url_out, size_t archive_url_capacity,
|
|
17
|
+
char *release_notes_out, size_t release_notes_capacity) {
|
|
18
|
+
abort();
|
|
19
|
+
}
|
|
20
|
+
int native_sdk_update_verify_archive(const char *path, size_t path_len, uint64_t expected_bytes, const char *sha256, size_t sha256_len) {
|
|
21
|
+
abort();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@interface NativeSdkFocusProbe : NSObject
|
|
25
|
+
@property(nonatomic, assign) NSUInteger actions;
|
|
26
|
+
@property(nonatomic, assign) uint64_t widgetId;
|
|
27
|
+
@property(nonatomic, assign) NSInteger action;
|
|
28
|
+
- (BOOL)emitWidgetAccessibilityActionWithId:(uint64_t)widgetId action:(NSInteger)action;
|
|
29
|
+
@end
|
|
30
|
+
@implementation NativeSdkFocusProbe
|
|
31
|
+
- (BOOL)emitWidgetAccessibilityActionWithId:(uint64_t)widgetId action:(NSInteger)action {
|
|
32
|
+
self.actions += 1;
|
|
33
|
+
self.widgetId = widgetId;
|
|
34
|
+
self.action = action;
|
|
35
|
+
return YES;
|
|
36
|
+
}
|
|
37
|
+
@end
|
|
38
|
+
|
|
39
|
+
int main(void) {
|
|
40
|
+
@autoreleasepool {
|
|
41
|
+
NativeSdkFocusProbe *probe = [NativeSdkFocusProbe new];
|
|
42
|
+
NativeSdkWidgetAccessibilityElement *element = [NativeSdkWidgetAccessibilityElement new];
|
|
43
|
+
element.surfaceView = (NativeSdkMetalSurfaceView *)(id)probe;
|
|
44
|
+
element.widgetId = 42;
|
|
45
|
+
element.actionFlags = NATIVE_SDK_APPKIT_WIDGET_ACTION_FOCUS;
|
|
46
|
+
element.accessibilityEnabled = YES;
|
|
47
|
+
[element publishAccessibilityFocused:YES];
|
|
48
|
+
assert(element.accessibilityFocused && probe.actions == 0);
|
|
49
|
+
[element publishAccessibilityFocused:YES];
|
|
50
|
+
[element publishAccessibilityFocused:NO];
|
|
51
|
+
assert(!element.accessibilityFocused && probe.actions == 0);
|
|
52
|
+
element.accessibilityFocused = YES;
|
|
53
|
+
assert(probe.actions == 1 && probe.widgetId == 42);
|
|
54
|
+
assert(probe.action == NATIVE_SDK_APPKIT_WIDGET_ACCESSIBILITY_ACTION_FOCUS);
|
|
55
|
+
element.accessibilityFocused = NO;
|
|
56
|
+
assert(probe.actions == 1);
|
|
57
|
+
element.accessibilityEnabled = NO;
|
|
58
|
+
element.accessibilityFocused = YES;
|
|
59
|
+
assert(probe.actions == 1);
|
|
60
|
+
element.accessibilityEnabled = YES;
|
|
61
|
+
element.actionFlags = 0;
|
|
62
|
+
element.accessibilityFocused = YES;
|
|
63
|
+
assert(probe.actions == 1);
|
|
64
|
+
}
|
|
65
|
+
return 0;
|
|
66
|
+
}
|
|
@@ -68,6 +68,7 @@ const max_menu_key_bytes = types.max_menu_key_bytes;
|
|
|
68
68
|
const max_shortcuts = types.max_shortcuts;
|
|
69
69
|
const max_shortcut_id_bytes = types.max_shortcut_id_bytes;
|
|
70
70
|
const max_shortcut_key_bytes = types.max_shortcut_key_bytes;
|
|
71
|
+
const max_global_shortcuts = types.max_global_shortcuts;
|
|
71
72
|
const max_widget_accessibility_nodes = types.max_widget_accessibility_nodes;
|
|
72
73
|
const max_gpu_surface_packet_json_bytes = types.max_gpu_surface_packet_json_bytes;
|
|
73
74
|
const ShortcutModifiers = types.ShortcutModifiers;
|
|
@@ -297,6 +298,11 @@ pub const NullAudio = struct {
|
|
|
297
298
|
}
|
|
298
299
|
};
|
|
299
300
|
|
|
301
|
+
pub const NullGlobalShortcut = struct {
|
|
302
|
+
binding: types.OwnedShortcut,
|
|
303
|
+
pressed: bool = false,
|
|
304
|
+
};
|
|
305
|
+
|
|
300
306
|
pub const NullAudioCapture = struct {
|
|
301
307
|
active: bool = false,
|
|
302
308
|
format: types.AudioCaptureFormat = .{},
|
|
@@ -323,6 +329,10 @@ const NullStatusItem = struct {
|
|
|
323
329
|
open_command_len: usize = 0,
|
|
324
330
|
presentation: TrayPresentation = .{},
|
|
325
331
|
items: [max_tray_items]TrayMenuItem = undefined,
|
|
332
|
+
item_label_storage: [max_tray_items][max_tray_item_label_bytes]u8 = undefined,
|
|
333
|
+
item_command_storage: [max_tray_items][max_tray_item_command_bytes]u8 = undefined,
|
|
334
|
+
item_detail_storage: [max_tray_items][types.max_tray_item_detail_bytes]u8 = undefined,
|
|
335
|
+
item_key_storage: [max_tray_items][types.max_menu_key_bytes]u8 = undefined,
|
|
326
336
|
segment_options: [max_tray_items * max_tray_segment_options]types.TraySegmentOption = undefined,
|
|
327
337
|
segment_option_label_storage: [max_tray_items * max_tray_segment_options][max_tray_segment_label_bytes]u8 = undefined,
|
|
328
338
|
segment_option_command_storage: [max_tray_items * max_tray_segment_options][max_tray_item_command_bytes]u8 = undefined,
|
|
@@ -383,6 +393,8 @@ pub const NullPlatform = struct {
|
|
|
383
393
|
shortcut_count: usize = 0,
|
|
384
394
|
window_sources: [max_windows]?WebViewSource = [_]?WebViewSource{null} ** max_windows,
|
|
385
395
|
windows: [max_windows]WindowInfo = undefined,
|
|
396
|
+
window_label_storage: [max_windows][max_window_label_bytes]u8 = undefined,
|
|
397
|
+
window_title_storage: [max_windows][max_window_title_bytes]u8 = undefined,
|
|
386
398
|
/// Captured `WindowOptions.resizable` per created window, indexed
|
|
387
399
|
/// like `windows` — `WindowInfo` does not carry it, and tests need
|
|
388
400
|
/// to assert the flag survives to the platform seam (the macOS host
|
|
@@ -392,6 +404,10 @@ pub const NullPlatform = struct {
|
|
|
392
404
|
/// like `windows` — same seam-regression purpose as
|
|
393
405
|
/// `window_resizable` (the startup create used to hardcode it).
|
|
394
406
|
window_titlebar: [max_windows]WindowTitlebarStyle = [_]WindowTitlebarStyle{.standard} ** max_windows,
|
|
407
|
+
window_color_scheme: [max_windows]types.WindowColorScheme = @splat(.system),
|
|
408
|
+
/// Source-less test harnesses have an implicit primary window rather
|
|
409
|
+
/// than a createWindow entry, just like the main canvas surface.
|
|
410
|
+
main_window_color_scheme: types.WindowColorScheme = .system,
|
|
395
411
|
/// Captured independently from `restore_state`: persistence opt-in does
|
|
396
412
|
/// not mean a frame was actually found and restored.
|
|
397
413
|
window_placement: [max_windows]WindowInitialPlacement = [_]WindowInitialPlacement{.default} ** max_windows,
|
|
@@ -442,6 +458,8 @@ pub const NullPlatform = struct {
|
|
|
442
458
|
/// real hosts' close delegates, hiding instead of closing under
|
|
443
459
|
/// `.hide`.
|
|
444
460
|
window_close_policy: [max_windows]types.WindowClosePolicy = [_]types.WindowClosePolicy{.quit} ** max_windows,
|
|
461
|
+
/// Test seam: refuse one OS create without retaining a window identity.
|
|
462
|
+
fail_next_create_window: bool = false,
|
|
445
463
|
/// Test seam: make the NEXT `close_window_fn` call fail with
|
|
446
464
|
/// `error.CloseFailed` (the real hosts' refusal), consuming the
|
|
447
465
|
/// flag — the injection runtime rollback tests use to assert
|
|
@@ -458,6 +476,13 @@ pub const NullPlatform = struct {
|
|
|
458
476
|
dock_presence_count: u32 = 0,
|
|
459
477
|
launch_at_login_status: types.LaunchAtLoginStatus = .disabled,
|
|
460
478
|
launch_at_login_set_count: u32 = 0,
|
|
479
|
+
/// Set false before `platform()` to model a host without keyboard input.
|
|
480
|
+
keyboard_input: bool = true,
|
|
481
|
+
/// `.denied` makes posts fail like a macOS app without the Accessibility grant.
|
|
482
|
+
keyboard_input_access: types.KeyboardInputAccess = .granted,
|
|
483
|
+
keyboard_input_prompt_count: u32 = 0,
|
|
484
|
+
keyboard_chords: [32]types.KeyChord = undefined,
|
|
485
|
+
keyboard_chord_count: usize = 0,
|
|
461
486
|
/// Captured `WindowOptions.min_width`/`min_height` per created
|
|
462
487
|
/// window — the content min-size floor that must survive to the
|
|
463
488
|
/// create seam (macOS applies it as `contentMinSize`); same
|
|
@@ -714,6 +739,11 @@ pub const NullPlatform = struct {
|
|
|
714
739
|
microphone_capture: bool = true,
|
|
715
740
|
system_audio_capture: bool = true,
|
|
716
741
|
audio_captures: [2]NullAudioCapture = [_]NullAudioCapture{.{}} ** 2,
|
|
742
|
+
/// Model a host with system-wide shortcuts; false models Linux.
|
|
743
|
+
global_shortcuts: bool = true,
|
|
744
|
+
global_shortcut_entries: [max_global_shortcuts]NullGlobalShortcut = undefined,
|
|
745
|
+
global_shortcut_count: usize = 0,
|
|
746
|
+
global_shortcut_sink: types.GlobalShortcutSink = .{},
|
|
717
747
|
/// Whether this modeled host has a video decoder. On by default (the
|
|
718
748
|
/// fake below stands in for AVFoundation); tests modelling a staged
|
|
719
749
|
/// host (Windows/Linux today) set it false BEFORE `platform()` so
|
|
@@ -918,6 +948,7 @@ pub const NullPlatform = struct {
|
|
|
918
948
|
.quit_app_fn = quitApp,
|
|
919
949
|
.start_window_drag_fn = startWindowDrag,
|
|
920
950
|
.window_chrome_fn = windowChrome,
|
|
951
|
+
.set_window_color_scheme_fn = setWindowColorScheme,
|
|
921
952
|
.set_window_drag_regions_fn = setWindowDragRegions,
|
|
922
953
|
.create_view_fn = createView,
|
|
923
954
|
.update_view_fn = updateView,
|
|
@@ -949,6 +980,8 @@ pub const NullPlatform = struct {
|
|
|
949
980
|
.remove_tray_fn = removeTray,
|
|
950
981
|
.open_external_url_fn = openExternalUrl,
|
|
951
982
|
.reveal_path_fn = revealPath,
|
|
983
|
+
.send_key_chord_fn = if (self.keyboard_input) sendKeyChord else null,
|
|
984
|
+
.keyboard_input_access_fn = if (self.keyboard_input) keyboardInputAccess else null,
|
|
952
985
|
.add_recent_document_fn = addRecentDocument,
|
|
953
986
|
.clear_recent_documents_fn = clearRecentDocuments,
|
|
954
987
|
.configure_security_policy_fn = configureSecurityPolicy,
|
|
@@ -964,6 +997,7 @@ pub const NullPlatform = struct {
|
|
|
964
997
|
.audio_stop_fn = if (self.audio_playback) audioStop else null,
|
|
965
998
|
.audio_seek_fn = if (self.audio_playback) audioSeek else null,
|
|
966
999
|
.audio_set_volume_fn = if (self.audio_playback) audioSetVolume else null,
|
|
1000
|
+
.configure_global_shortcuts_fn = if (self.global_shortcuts) configureGlobalShortcuts else null,
|
|
967
1001
|
.audio_capture_start_fn = if (self.microphone_capture or self.system_audio_capture) audioCaptureStart else null,
|
|
968
1002
|
.audio_capture_stop_fn = if (self.microphone_capture or self.system_audio_capture) audioCaptureStop else null,
|
|
969
1003
|
.video_load_fn = if (self.video_playback) videoLoad else null,
|
|
@@ -1033,6 +1067,8 @@ pub const NullPlatform = struct {
|
|
|
1033
1067
|
.microphone_capture => self.microphone_capture,
|
|
1034
1068
|
.system_audio_capture => self.system_audio_capture,
|
|
1035
1069
|
.video_playback => self.video_playback,
|
|
1070
|
+
.global_shortcuts => self.global_shortcuts,
|
|
1071
|
+
.keyboard_input => self.keyboard_input,
|
|
1036
1072
|
};
|
|
1037
1073
|
}
|
|
1038
1074
|
|
|
@@ -1111,6 +1147,8 @@ pub const NullPlatform = struct {
|
|
|
1111
1147
|
.open = true,
|
|
1112
1148
|
.focused = true,
|
|
1113
1149
|
};
|
|
1150
|
+
self.windows[0].label = try copyInto(&self.window_label_storage[0], self.windows[0].label);
|
|
1151
|
+
self.windows[0].title = try copyInto(&self.window_title_storage[0], self.windows[0].title);
|
|
1114
1152
|
self.window_count = 1;
|
|
1115
1153
|
break :blk 0;
|
|
1116
1154
|
} else return error.WindowNotFound;
|
|
@@ -1141,6 +1179,10 @@ pub const NullPlatform = struct {
|
|
|
1141
1179
|
|
|
1142
1180
|
fn createWindow(context: ?*anyopaque, options: WindowOptions) anyerror!WindowInfo {
|
|
1143
1181
|
const self: *NullPlatform = @ptrCast(@alignCast(context.?));
|
|
1182
|
+
if (self.fail_next_create_window) {
|
|
1183
|
+
self.fail_next_create_window = false;
|
|
1184
|
+
return error.CreateFailed;
|
|
1185
|
+
}
|
|
1144
1186
|
// A CLOSED window releases its label and id for re-creation —
|
|
1145
1187
|
// mirroring the real hosts, where a closed NSWindow is gone from
|
|
1146
1188
|
// the host dictionaries. Model-driven windows reopen under one
|
|
@@ -1165,8 +1207,8 @@ pub const NullPlatform = struct {
|
|
|
1165
1207
|
}
|
|
1166
1208
|
const info: WindowInfo = .{
|
|
1167
1209
|
.id = options.id,
|
|
1168
|
-
.label = options.label,
|
|
1169
|
-
.title = options.resolvedTitle(self.app_info.app_name),
|
|
1210
|
+
.label = try copyInto(&self.window_label_storage[self.window_count], options.label),
|
|
1211
|
+
.title = try copyInto(&self.window_title_storage[self.window_count], options.resolvedTitle(self.app_info.app_name)),
|
|
1170
1212
|
.frame = options.default_frame,
|
|
1171
1213
|
.scale_factor = self.surface_value.scale_factor,
|
|
1172
1214
|
.open = true,
|
|
@@ -1176,6 +1218,7 @@ pub const NullPlatform = struct {
|
|
|
1176
1218
|
self.windows[self.window_count] = info;
|
|
1177
1219
|
self.window_resizable[self.window_count] = options.resizable;
|
|
1178
1220
|
self.window_titlebar[self.window_count] = options.titlebar;
|
|
1221
|
+
self.window_color_scheme[self.window_count] = .system;
|
|
1179
1222
|
self.window_placement[self.window_count] = options.initial_placement;
|
|
1180
1223
|
self.window_restore_policy[self.window_count] = options.restore_policy;
|
|
1181
1224
|
self.window_transparent[self.window_count] = options.transparent;
|
|
@@ -1514,6 +1557,7 @@ pub const NullPlatform = struct {
|
|
|
1514
1557
|
webview.layer = options.layer;
|
|
1515
1558
|
webview.transparent = options.transparent;
|
|
1516
1559
|
webview.bridge_enabled = options.bridge_enabled;
|
|
1560
|
+
webview.zoom = 1.0;
|
|
1517
1561
|
webview.open = true;
|
|
1518
1562
|
@memcpy(webview.label_storage[0..options.label.len], options.label);
|
|
1519
1563
|
@memcpy(webview.url_storage[0..options.url.len], options.url);
|
|
@@ -1805,6 +1849,10 @@ pub const NullPlatform = struct {
|
|
|
1805
1849
|
if (items.len > status_item.items.len) return error.InvalidTrayOptions;
|
|
1806
1850
|
for (items, 0..) |item, index| {
|
|
1807
1851
|
status_item.items[index] = item;
|
|
1852
|
+
status_item.items[index].label = try copyInto(&status_item.item_label_storage[index], item.label);
|
|
1853
|
+
status_item.items[index].command = try copyInto(&status_item.item_command_storage[index], item.command);
|
|
1854
|
+
status_item.items[index].detail = try copyInto(&status_item.item_detail_storage[index], item.detail);
|
|
1855
|
+
status_item.items[index].key = try copyInto(&status_item.item_key_storage[index], item.key);
|
|
1808
1856
|
if (item.segmented) |segmented| {
|
|
1809
1857
|
const start = index * max_tray_segment_options;
|
|
1810
1858
|
for (segmented.options, 0..) |option, option_index| {
|
|
@@ -1882,6 +1930,24 @@ pub const NullPlatform = struct {
|
|
|
1882
1930
|
self.revealed_path_len = (try copyInto(&self.revealed_path, path)).len;
|
|
1883
1931
|
}
|
|
1884
1932
|
|
|
1933
|
+
fn sendKeyChord(context: ?*anyopaque, chord: types.KeyChord) anyerror!void {
|
|
1934
|
+
const self: *NullPlatform = @ptrCast(@alignCast(context.?));
|
|
1935
|
+
if (self.keyboard_input_access == .denied) return error.KeyboardInputAccessDenied;
|
|
1936
|
+
if (self.keyboard_chord_count == self.keyboard_chords.len) return error.KeyboardInputFailed;
|
|
1937
|
+
self.keyboard_chords[self.keyboard_chord_count] = chord;
|
|
1938
|
+
self.keyboard_chord_count += 1;
|
|
1939
|
+
}
|
|
1940
|
+
|
|
1941
|
+
fn keyboardInputAccess(context: ?*anyopaque, prompt: bool) anyerror!types.KeyboardInputAccess {
|
|
1942
|
+
const self: *NullPlatform = @ptrCast(@alignCast(context.?));
|
|
1943
|
+
if (prompt and self.keyboard_input_access == .denied) self.keyboard_input_prompt_count += 1;
|
|
1944
|
+
return self.keyboard_input_access;
|
|
1945
|
+
}
|
|
1946
|
+
|
|
1947
|
+
pub fn keyboardChords(self: *const NullPlatform) []const types.KeyChord {
|
|
1948
|
+
return self.keyboard_chords[0..self.keyboard_chord_count];
|
|
1949
|
+
}
|
|
1950
|
+
|
|
1885
1951
|
fn addRecentDocument(context: ?*anyopaque, path: []const u8) anyerror!void {
|
|
1886
1952
|
const self: *NullPlatform = @ptrCast(@alignCast(context.?));
|
|
1887
1953
|
self.recent_document_path = undefined;
|
|
@@ -2046,6 +2112,46 @@ pub const NullPlatform = struct {
|
|
|
2046
2112
|
capture.stop_count += 1;
|
|
2047
2113
|
}
|
|
2048
2114
|
|
|
2115
|
+
fn configureGlobalShortcuts(context: ?*anyopaque, shortcuts: []const Shortcut, sink: types.GlobalShortcutSink, statuses: []types.GlobalShortcutStatus) anyerror!void {
|
|
2116
|
+
const self: *NullPlatform = @ptrCast(@alignCast(context.?));
|
|
2117
|
+
self.global_shortcut_sink = sink;
|
|
2118
|
+
var next: [max_global_shortcuts]NullGlobalShortcut = undefined;
|
|
2119
|
+
var count: usize = 0;
|
|
2120
|
+
for (shortcuts, statuses) |shortcut, *status| {
|
|
2121
|
+
status.* = .registered;
|
|
2122
|
+
for (next[0..count]) |*entry| {
|
|
2123
|
+
if (types.sameShortcutCombination(entry.binding.shortcut(), shortcut)) status.* = .conflict;
|
|
2124
|
+
}
|
|
2125
|
+
if (status.* == .conflict) continue;
|
|
2126
|
+
next[count] = .{ .binding = .init(shortcut) };
|
|
2127
|
+
for (self.configuredGlobalShortcuts()) |*previous| next[count].pressed = next[count].pressed or (previous.pressed and previous.binding.matches(shortcut));
|
|
2128
|
+
count += 1;
|
|
2129
|
+
}
|
|
2130
|
+
for (self.configuredGlobalShortcuts()) |*previous| {
|
|
2131
|
+
if (!previous.pressed) continue;
|
|
2132
|
+
for (next[0..count]) |*entry| {
|
|
2133
|
+
if (entry.binding.matches(previous.binding.shortcut())) break;
|
|
2134
|
+
} else sink.push(.{ .shortcut = previous.binding.shortcut(), .phase = .released });
|
|
2135
|
+
}
|
|
2136
|
+
@memcpy(self.global_shortcut_entries[0..count], next[0..count]);
|
|
2137
|
+
self.global_shortcut_count = count;
|
|
2138
|
+
}
|
|
2139
|
+
|
|
2140
|
+
pub fn configuredGlobalShortcuts(self: *const NullPlatform) []const NullGlobalShortcut {
|
|
2141
|
+
return self.global_shortcut_entries[0..self.global_shortcut_count];
|
|
2142
|
+
}
|
|
2143
|
+
|
|
2144
|
+
/// Simulate pressing or releasing a registered global shortcut.
|
|
2145
|
+
pub fn pushGlobalShortcut(self: *NullPlatform, id: []const u8, phase: types.GlobalShortcutPhase) bool {
|
|
2146
|
+
for (self.global_shortcut_entries[0..self.global_shortcut_count]) |*entry| {
|
|
2147
|
+
if (!std.mem.eql(u8, entry.binding.shortcut().id, id) or entry.pressed == (phase == .pressed)) continue;
|
|
2148
|
+
entry.pressed = phase == .pressed;
|
|
2149
|
+
self.global_shortcut_sink.push(.{ .shortcut = entry.binding.shortcut(), .phase = phase });
|
|
2150
|
+
return true;
|
|
2151
|
+
}
|
|
2152
|
+
return false;
|
|
2153
|
+
}
|
|
2154
|
+
|
|
2049
2155
|
/// Push deterministic PCM through a live fake capture.
|
|
2050
2156
|
pub fn pushAudioCapture(self: *NullPlatform, source: types.AudioCaptureSource, timestamp_ns: u64, pcm_s16le: []const u8) types.AudioCapturePushResult {
|
|
2051
2157
|
const capture = &self.audio_captures[@intFromEnum(source)];
|
|
@@ -2988,6 +3094,22 @@ pub const NullPlatform = struct {
|
|
|
2988
3094
|
return self.window_show_count[index];
|
|
2989
3095
|
}
|
|
2990
3096
|
|
|
3097
|
+
fn setWindowColorScheme(context: ?*anyopaque, window_id: WindowId, scheme: types.WindowColorScheme) anyerror!void {
|
|
3098
|
+
const self: *NullPlatform = @ptrCast(@alignCast(context.?));
|
|
3099
|
+
const index = self.findWindowIndex(window_id) orelse {
|
|
3100
|
+
if (window_id != 1) return error.WindowNotFound;
|
|
3101
|
+
self.main_window_color_scheme = scheme;
|
|
3102
|
+
return;
|
|
3103
|
+
};
|
|
3104
|
+
if (!self.windows[index].open) return error.WindowNotFound;
|
|
3105
|
+
self.window_color_scheme[index] = scheme;
|
|
3106
|
+
}
|
|
3107
|
+
|
|
3108
|
+
pub fn windowColorScheme(self: *const NullPlatform, window_id: WindowId) ?types.WindowColorScheme {
|
|
3109
|
+
const index = self.findWindowIndex(window_id) orelse return if (window_id == 1) self.main_window_color_scheme else null;
|
|
3110
|
+
return self.window_color_scheme[index];
|
|
3111
|
+
}
|
|
3112
|
+
|
|
2991
3113
|
/// Test seam: model a window leaving or returning to the glass
|
|
2992
3114
|
/// without a minimize verb (fully covered by another app, revealed
|
|
2993
3115
|
/// again) — the occlusion fact the real hosts' spectrum gating
|
|
@@ -3016,8 +3138,14 @@ pub const NullPlatform = struct {
|
|
|
3016
3138
|
var cursor = index;
|
|
3017
3139
|
while (cursor + 1 < self.window_count) : (cursor += 1) {
|
|
3018
3140
|
self.windows[cursor] = self.windows[cursor + 1];
|
|
3141
|
+
self.window_label_storage[cursor] = self.window_label_storage[cursor + 1];
|
|
3142
|
+
self.window_title_storage[cursor] = self.window_title_storage[cursor + 1];
|
|
3143
|
+
self.windows[cursor].label = self.window_label_storage[cursor][0..self.windows[cursor].label.len];
|
|
3144
|
+
self.windows[cursor].title = self.window_title_storage[cursor][0..self.windows[cursor].title.len];
|
|
3145
|
+
self.window_sources[cursor] = self.window_sources[cursor + 1];
|
|
3019
3146
|
self.window_resizable[cursor] = self.window_resizable[cursor + 1];
|
|
3020
3147
|
self.window_titlebar[cursor] = self.window_titlebar[cursor + 1];
|
|
3148
|
+
self.window_color_scheme[cursor] = self.window_color_scheme[cursor + 1];
|
|
3021
3149
|
self.window_placement[cursor] = self.window_placement[cursor + 1];
|
|
3022
3150
|
self.window_restore_policy[cursor] = self.window_restore_policy[cursor + 1];
|
|
3023
3151
|
self.window_transparent[cursor] = self.window_transparent[cursor + 1];
|
|
@@ -334,6 +334,10 @@ test "null platform owns retained rich tray row bytes" {
|
|
|
334
334
|
var null_platform = NullPlatform.init(.{});
|
|
335
335
|
defer null_platform.deinit();
|
|
336
336
|
|
|
337
|
+
var row_label = [_]u8{ 'O', 'p', 'e', 'n' };
|
|
338
|
+
var row_command = [_]u8{ 'o', 'p', 'e', 'n' };
|
|
339
|
+
var row_detail = [_]u8{ 'D', 'e', 't', 'a', 'i', 'l' };
|
|
340
|
+
var row_key = [_]u8{'o'};
|
|
337
341
|
var segment_label = [_]u8{ 'D', 'a', 'y' };
|
|
338
342
|
var segment_command = [_]u8{ 'r', 'a', 'n', 'g', 'e' };
|
|
339
343
|
var metric_primary = [_]u8{ '2', '4', '9', '4' };
|
|
@@ -361,8 +365,13 @@ test "null platform owns retained rich tray row bytes" {
|
|
|
361
365
|
.trailing_summary = &chart_summary,
|
|
362
366
|
.accessibility_label = &chart_accessibility,
|
|
363
367
|
} },
|
|
368
|
+
.{ .id = 1, .label = &row_label, .command = &row_command, .detail = &row_detail, .key = &row_key, .role = .agent, .modifiers = .{ .primary = true } },
|
|
364
369
|
} });
|
|
365
370
|
|
|
371
|
+
@memset(&row_label, 'X');
|
|
372
|
+
@memset(&row_command, 'Y');
|
|
373
|
+
@memset(&row_detail, 'Z');
|
|
374
|
+
@memset(&row_key, 'k');
|
|
366
375
|
@memset(&segment_label, 'X');
|
|
367
376
|
@memset(&segment_command, 'Y');
|
|
368
377
|
@memset(&metric_primary, 'P');
|
|
@@ -373,6 +382,10 @@ test "null platform owns retained rich tray row bytes" {
|
|
|
373
382
|
@memset(&chart_accessibility, 'Q');
|
|
374
383
|
|
|
375
384
|
const items = null_platform.trayItems();
|
|
385
|
+
try std.testing.expectEqualStrings("Open", items[3].label);
|
|
386
|
+
try std.testing.expectEqualStrings("open", items[3].command);
|
|
387
|
+
try std.testing.expectEqualStrings("Detail", items[3].detail);
|
|
388
|
+
try std.testing.expectEqualStrings("o", items[3].key);
|
|
376
389
|
try std.testing.expectEqualStrings("Day", items[0].segmented.?.options[0].label);
|
|
377
390
|
try std.testing.expectEqualStrings("range", items[0].segmented.?.options[0].command);
|
|
378
391
|
try std.testing.expectEqualStrings("2494", items[1].metric.?.primary_text);
|