@native-sdk/cli 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -6
- package/bin/native.js +2 -1
- package/build/app.zig +320 -60
- package/build/corewire.zig +53 -0
- package/build/test_shards.zig +49 -0
- package/build/ts_run.mjs +3 -3
- package/build.zig +1818 -87
- package/package.json +19 -14
- package/packages/core/compile-surface/core.ts +134 -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 +57 -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 +308 -4
- package/packages/core/sdk/core.ts +320 -84
- package/packages/core/sdk/events.d.ts +247 -0
- package/packages/core/sdk/events.ts +230 -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 +166 -19
- 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/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/effect_plans.ts +71 -0
- package/packages/core/src/flow_measurement.ts +121 -0
- package/packages/core/src/font_registry.ts +37 -0
- 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_development.ts +160 -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 +74 -0
- package/packages/core/src/portable_sources.ts +17 -0
- package/packages/core/src/registered_font.ts +93 -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 +3930 -0
- package/packages/core/src/scalar_text.ts +84 -0
- package/packages/core/src/service_contract.ts +2 -1
- 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 +11 -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_components.ts +2415 -0
- package/packages/core/src/view_coordination.ts +198 -0
- package/packages/core/src/view_frontend.ts +980 -0
- package/packages/core/src/widget_audits.ts +202 -0
- package/packages/core/src/widget_changes.ts +258 -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_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/core/references/web-engines-packaging-debugging.md +2 -1
- package/skill-data/native-ui/SKILL.md +76 -17
- package/skill-data/ts-core/SKILL.md +113 -9
- package/skill-data/ts-services/SKILL.md +1 -1
- package/skill-data/ts-services/references/service-surface.md +264 -144
- package/src/app_runner/root.zig +25 -12
- package/src/app_runner/ts_compiled_view.zig +1631 -0
- package/src/app_runner/ts_core_main.zig +143 -10
- package/src/app_runner/ts_core_mobile.zig +24 -12
- package/src/automation/server.zig +1 -3
- 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/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 +2 -0
- package/src/platform/macos/appkit_host.m +188 -30
- package/src/platform/macos/pointer_motion_test.m +96 -0
- 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/widget_focus_test.m +66 -0
- package/src/platform/null_platform.zig +26 -2
- package/src/platform/null_platform_tests.zig +13 -0
- package/src/platform/root.zig +1 -0
- package/src/platform/types.zig +13 -0
- package/src/platform/windows/root.zig +2 -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/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/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 +128 -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/measurement_coordination_policy.zig +288 -0
- package/src/primitives/canvas/numeric_capabilities.zig +14 -0
- package/src/primitives/canvas/reference.zig +12 -6
- 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 +100 -0
- 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 +23 -0
- package/src/primitives/canvas/text_query_policy.zig +156 -0
- package/src/primitives/canvas/text_run_policy.zig +252 -0
- package/src/primitives/canvas/text_scalar_policy.zig +156 -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 +38 -0
- package/src/primitives/canvas/ui.zig +250 -83
- package/src/primitives/canvas/ui_markup.zig +139 -33
- package/src/primitives/canvas/ui_markup_compiled.zig +319 -59
- package/src/primitives/canvas/ui_markup_compiled_tests.zig +225 -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_reflect.zig +56 -0
- package/src/primitives/canvas/ui_markup_tests.zig +116 -0
- package/src/primitives/canvas/ui_markup_view.zig +258 -32
- 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 +292 -0
- package/src/primitives/canvas/virtual_extents.zig +99 -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 +126 -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 +20 -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 +21 -0
- package/src/runtime/accessibility_policy.zig +122 -0
- package/src/runtime/api.zig +28 -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/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 +4 -4
- 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 +437 -81
- 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/core.zig +156 -6
- package/src/runtime/desktop_files.zig +189 -0
- package/src/runtime/effects.zig +466 -29
- package/src/runtime/effects_tests.zig +28 -0
- package/src/runtime/file_policy_test_reference.zig +113 -0
- package/src/runtime/flow.zig +418 -341
- package/src/runtime/flow_reference.zig +1426 -0
- package/src/runtime/font_registry_policy.zig +72 -0
- package/src/runtime/frame_profile.zig +24 -33
- 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/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 +13 -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 +224 -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/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 +46 -36
- package/src/runtime/tests.zig +1 -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 +2325 -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 +1087 -45
- package/src/runtime/ui_app.zig +1117 -629
- 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 +619 -9
- package/src/runtime/ui_app_window_tests.zig +89 -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_widget_control.zig +51 -14
- package/src/runtime/view_widget_scroll.zig +16 -5
- package/src/runtime/view_widget_text.zig +153 -68
- package/src/runtime/view_widget_tree.zig +460 -56
- package/src/runtime/webview_view_bridge_tests.zig +2 -0
- package/src/runtime/widget_motion_policy.zig +238 -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 +163 -10
- package/src/tooling/codesign.zig +125 -74
- 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/package.zig +85 -1
- package/src/tooling/raw_manifest.zig +6 -0
- package/src/tooling/templates.zig +15 -3
- package/src/tooling/ts_core.zig +13 -3
- package/src/tooling/verbs.zig +22 -0
- 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 +166 -0
- package/tools/corewire/core_abi.zig +51 -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 +360 -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 +290 -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 +35 -0
- package/tools/corewire/intake_cases.ts +55 -0
- package/tools/corewire/intake_goldens.json +12237 -0
- package/tools/corewire/invocation.test.ts +24 -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 +55 -0
- package/tools/corewire/profile.test.ts +248 -0
- package/tools/corewire/profile.zig +56 -0
- package/tools/corewire/profile_emission.ts +202 -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 +267 -1438
- package/tools/corewire/emit_profile.zig +0 -521
|
@@ -5,6 +5,8 @@ const platform = @import("../platform/root.zig");
|
|
|
5
5
|
const validation = @import("validation.zig");
|
|
6
6
|
const runtime_api = @import("api.zig");
|
|
7
7
|
const automation_commands = @import("automation_commands.zig");
|
|
8
|
+
const interactions = @import("automation_interaction_policy.zig");
|
|
9
|
+
const reference_dispatch = @import("automation_widget_dispatch_reference.zig");
|
|
8
10
|
const runtime_clock = @import("clock.zig");
|
|
9
11
|
const canvas_widget_runtime = @import("canvas_widget_runtime.zig");
|
|
10
12
|
const runtime_canvas_widget_display = @import("canvas_widget_display.zig");
|
|
@@ -17,13 +19,12 @@ const AutomationProvenanceTarget = automation_commands.AutomationProvenanceTarge
|
|
|
17
19
|
const AutomationWidgetWheel = automation_commands.AutomationWidgetWheel;
|
|
18
20
|
const AutomationWidgetKey = automation_commands.AutomationWidgetKey;
|
|
19
21
|
const AutomationWidgetPointerDrag = automation_commands.AutomationWidgetPointerDrag;
|
|
20
|
-
const parseAutomationTextSelection =
|
|
21
|
-
const parseAutomationDragDelta =
|
|
22
|
-
const parseAutomationDropPaths =
|
|
22
|
+
const parseAutomationTextSelection = @import("automation_command_policy.zig").parseAutomationTextSelection;
|
|
23
|
+
const parseAutomationDragDelta = @import("automation_command_policy.zig").parseAutomationDragDelta;
|
|
24
|
+
const parseAutomationDropPaths = @import("automation_command_policy.zig").parseAutomationDropPaths;
|
|
23
25
|
const automationInputTimestampNs = runtime_clock.automationInputTimestampNs;
|
|
24
26
|
const canvasWidgetInteractionTargetExists = canvas_widget_runtime.canvasWidgetInteractionTargetExists;
|
|
25
27
|
const canvasWidgetSelectableTargetExists = canvas_widget_runtime.canvasWidgetSelectableTargetExists;
|
|
26
|
-
const validateViewLabel = validation.validateViewLabel;
|
|
27
28
|
|
|
28
29
|
pub fn RuntimeAutomationWidgetDispatch(comptime Runtime: type) type {
|
|
29
30
|
return struct {
|
|
@@ -40,7 +41,7 @@ pub fn RuntimeAutomationWidgetDispatch(comptime Runtime: type) type {
|
|
|
40
41
|
.id = action.id,
|
|
41
42
|
.action = canvasWidgetActionKindFromAutomation(action.action),
|
|
42
43
|
.text = action.value,
|
|
43
|
-
.selection = if (action.action == .set_selection) try parseAutomationTextSelection(action.value) else null,
|
|
44
|
+
.selection = if (action.action == .set_selection) try parseAutomationTextSelection(self.automation_command_policy, action.value) else null,
|
|
44
45
|
});
|
|
45
46
|
}
|
|
46
47
|
|
|
@@ -64,48 +65,16 @@ pub fn RuntimeAutomationWidgetDispatch(comptime Runtime: type) type {
|
|
|
64
65
|
}
|
|
65
66
|
|
|
66
67
|
pub fn dispatchAutomationWidgetClick(self: *Runtime, app: runtime_api.App(Runtime), target: AutomationWidgetTarget) anyerror!void {
|
|
67
|
-
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
// release state, and the Msg-driven rebuild — into a single
|
|
78
|
-
// display-list emission with the same final content.
|
|
79
|
-
CanvasWidgetDisplayMethods().beginCanvasWidgetDisplayListRefreshBatch(self);
|
|
80
|
-
var click_batch_active = true;
|
|
81
|
-
errdefer if (click_batch_active) {
|
|
82
|
-
// Flush, not drop: half a click may already have changed
|
|
83
|
-
// widget state that must reach the retained display list.
|
|
84
|
-
CanvasWidgetDisplayMethods().endCanvasWidgetDisplayListRefreshBatch(self) catch {
|
|
85
|
-
CanvasWidgetDisplayMethods().cancelCanvasWidgetDisplayListRefreshBatch(self);
|
|
86
|
-
};
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
try self.dispatchPlatformEvent(app, .{ .gpu_surface_input = .{
|
|
90
|
-
.window_id = window_id,
|
|
91
|
-
.label = label,
|
|
92
|
-
.kind = .pointer_down,
|
|
93
|
-
.timestamp_ns = timestamp_ns,
|
|
94
|
-
.x = point.x,
|
|
95
|
-
.y = point.y,
|
|
96
|
-
.button = 0,
|
|
97
|
-
} });
|
|
98
|
-
try self.dispatchPlatformEvent(app, .{ .gpu_surface_input = .{
|
|
99
|
-
.window_id = window_id,
|
|
100
|
-
.label = label,
|
|
101
|
-
.kind = .pointer_up,
|
|
102
|
-
.timestamp_ns = timestamp_ns,
|
|
103
|
-
.x = point.x,
|
|
104
|
-
.y = point.y,
|
|
105
|
-
.button = 0,
|
|
106
|
-
} });
|
|
107
|
-
try CanvasWidgetDisplayMethods().endCanvasWidgetDisplayListRefreshBatch(self);
|
|
108
|
-
click_batch_active = false;
|
|
68
|
+
if (self.automation_interaction_policy == null) return ReferenceMethods().dispatchAutomationWidgetClick(self, app, target);
|
|
69
|
+
const index = try automationWidgetTargetViewIndex(self, target);
|
|
70
|
+
var options = interactionTarget(self, index, target.id);
|
|
71
|
+
options.phase = 1;
|
|
72
|
+
try interactions.plan(self.automation_interaction_policy.?, .click, options).admit();
|
|
73
|
+
options.phase = 0;
|
|
74
|
+
options.point = try automationWidgetAimPoint(self, index, target.id);
|
|
75
|
+
const program = interactions.plan(self.automation_interaction_policy.?, .click, options);
|
|
76
|
+
try program.admit();
|
|
77
|
+
try dispatchInteractionSteps(self, app, index, program, .{});
|
|
109
78
|
}
|
|
110
79
|
|
|
111
80
|
/// Drive a press-and-hold gesture through the real pointer+timer
|
|
@@ -119,40 +88,16 @@ pub fn RuntimeAutomationWidgetDispatch(comptime Runtime: type) type {
|
|
|
119
88
|
/// nothing arms, the fire no-ops, and the release presses — the
|
|
120
89
|
/// same click a real user's long-press-and-release produces.
|
|
121
90
|
pub fn dispatchAutomationWidgetHold(self: *Runtime, app: runtime_api.App(Runtime), target: AutomationWidgetTarget) anyerror!void {
|
|
122
|
-
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
try self
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
.timestamp_ns = timestamp_ns,
|
|
133
|
-
.x = point.x,
|
|
134
|
-
.y = point.y,
|
|
135
|
-
.button = 0,
|
|
136
|
-
} });
|
|
137
|
-
try self.dispatchPlatformEvent(app, .{ .timer = .{
|
|
138
|
-
.id = platform.press_hold_timer_id,
|
|
139
|
-
.timestamp_ns = timestamp_ns,
|
|
140
|
-
} });
|
|
141
|
-
try self.dispatchPlatformEvent(app, .{ .gpu_surface_input = .{
|
|
142
|
-
.window_id = window_id,
|
|
143
|
-
.label = label,
|
|
144
|
-
.kind = .pointer_up,
|
|
145
|
-
.timestamp_ns = timestamp_ns,
|
|
146
|
-
.x = point.x,
|
|
147
|
-
.y = point.y,
|
|
148
|
-
.button = 0,
|
|
149
|
-
} });
|
|
150
|
-
// A fired hold's release deliberately does not cancel the
|
|
151
|
-
// platform timer the down armed (the app never cancels a
|
|
152
|
-
// timer that already fired); the wall-clock fire would be a
|
|
153
|
-
// harmless no-op, but cancel it so a live run leaves no
|
|
154
|
-
// pending one-shot behind.
|
|
155
|
-
self.cancelTimer(platform.press_hold_timer_id) catch {};
|
|
91
|
+
if (self.automation_interaction_policy == null) return ReferenceMethods().dispatchAutomationWidgetHold(self, app, target);
|
|
92
|
+
const index = try automationWidgetTargetViewIndex(self, target);
|
|
93
|
+
var options = interactionTarget(self, index, target.id);
|
|
94
|
+
options.phase = 1;
|
|
95
|
+
try interactions.plan(self.automation_interaction_policy.?, .hold, options).admit();
|
|
96
|
+
options.phase = 0;
|
|
97
|
+
options.point = try automationWidgetAimPoint(self, index, target.id);
|
|
98
|
+
const program = interactions.plan(self.automation_interaction_policy.?, .hold, options);
|
|
99
|
+
try program.admit();
|
|
100
|
+
try dispatchInteractionSteps(self, app, index, program, .{});
|
|
156
101
|
}
|
|
157
102
|
|
|
158
103
|
/// Drive a secondary click (right/ctrl-click) as the full
|
|
@@ -162,30 +107,16 @@ pub fn RuntimeAutomationWidgetDispatch(comptime Runtime: type) type {
|
|
|
162
107
|
/// context-press event — the desktop press-and-hold alternative
|
|
163
108
|
/// whose press target's `on_hold` Msg dispatches immediately.
|
|
164
109
|
pub fn dispatchAutomationWidgetContextPress(self: *Runtime, app: runtime_api.App(Runtime), target: AutomationWidgetTarget) anyerror!void {
|
|
165
|
-
|
|
166
|
-
const
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
try self
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
.timestamp_ns = timestamp_ns,
|
|
176
|
-
.x = point.x,
|
|
177
|
-
.y = point.y,
|
|
178
|
-
.button = 1,
|
|
179
|
-
} });
|
|
180
|
-
try self.dispatchPlatformEvent(app, .{ .gpu_surface_input = .{
|
|
181
|
-
.window_id = window_id,
|
|
182
|
-
.label = label,
|
|
183
|
-
.kind = .pointer_up,
|
|
184
|
-
.timestamp_ns = timestamp_ns,
|
|
185
|
-
.x = point.x,
|
|
186
|
-
.y = point.y,
|
|
187
|
-
.button = 1,
|
|
188
|
-
} });
|
|
110
|
+
if (self.automation_interaction_policy == null) return ReferenceMethods().dispatchAutomationWidgetContextPress(self, app, target);
|
|
111
|
+
const index = try automationWidgetTargetViewIndex(self, target);
|
|
112
|
+
var options = interactionTarget(self, index, target.id);
|
|
113
|
+
options.phase = 1;
|
|
114
|
+
try interactions.plan(self.automation_interaction_policy.?, .context_press, options).admit();
|
|
115
|
+
options.phase = 0;
|
|
116
|
+
options.point = try automationWidgetAimPoint(self, index, target.id);
|
|
117
|
+
const program = interactions.plan(self.automation_interaction_policy.?, .context_press, options);
|
|
118
|
+
try program.admit();
|
|
119
|
+
try dispatchInteractionSteps(self, app, index, program, .{});
|
|
189
120
|
}
|
|
190
121
|
|
|
191
122
|
/// Invoke one of the target widget's DECLARED context-menu items
|
|
@@ -194,8 +125,9 @@ pub fn RuntimeAutomationWidgetDispatch(comptime Runtime: type) type {
|
|
|
194
125
|
/// the verb skips presentation and dispatches the SELECTION on
|
|
195
126
|
/// the same path a real pick takes: it arms the pending request
|
|
196
127
|
/// exactly as presenting would, then delivers a
|
|
197
|
-
/// `context_menu_action` platform event
|
|
198
|
-
///
|
|
128
|
+
/// `context_menu_action` platform event. The journal owns the
|
|
129
|
+
/// complete invocation so replay also reconstructs its pending
|
|
130
|
+
/// request before resolving through `dispatchContextMenuAction`
|
|
199
131
|
/// into the widget's `.context_menu` handler. Named errors say
|
|
200
132
|
/// why an invocation cannot happen: no declared menu, an index
|
|
201
133
|
/// past the declared items, a separator slot, a disabled item —
|
|
@@ -204,13 +136,71 @@ pub fn RuntimeAutomationWidgetDispatch(comptime Runtime: type) type {
|
|
|
204
136
|
/// target's view, mid-verb.
|
|
205
137
|
pub fn dispatchAutomationWidgetContextMenuItem(self: *Runtime, app: runtime_api.App(Runtime), item: automation_commands.AutomationWidgetContextMenuItem) anyerror!void {
|
|
206
138
|
const view_index = try automationWidgetTargetViewIndex(self, item.target);
|
|
207
|
-
const
|
|
139
|
+
const invocation: platform.WidgetContextMenuActionEvent = .{
|
|
140
|
+
.window_id = self.views[view_index].window_id,
|
|
141
|
+
.label = self.views[view_index].label,
|
|
142
|
+
.id = item.target.id,
|
|
143
|
+
.item_index = std.math.cast(u32, item.item_index) orelse return error.ContextMenuItemOutOfRange,
|
|
144
|
+
};
|
|
145
|
+
// Driver misuse must fail before staging a journal event.
|
|
146
|
+
// The platform handler also validates replayed invocations.
|
|
147
|
+
_ = try widgetContextMenuTargetViewIndex(self, invocation);
|
|
148
|
+
try self.dispatchPlatformEvent(app, .{ .widget_context_menu_action = invocation });
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
fn widgetContextMenuTargetViewIndex(self: *Runtime, item: platform.WidgetContextMenuActionEvent) anyerror!usize {
|
|
152
|
+
if (self.automation_interaction_policy) |policy| {
|
|
153
|
+
try @import("shell_admission_policy.zig").label(self.shell_admission_policy, 0, item.label);
|
|
154
|
+
const window_index = runtimeFindWindowIndexById(self, item.window_id);
|
|
155
|
+
const window_open = if (window_index) |index| self.windows[index].info.open else false;
|
|
156
|
+
var facts: u32 = if (window_open) interactions.Fact.window else 0;
|
|
157
|
+
var selected: ?usize = null;
|
|
158
|
+
if (window_open) for (self.views[0..self.view_count], 0..) |*view, index| {
|
|
159
|
+
if (view.open and view.kind == .gpu_surface and view.window_id == item.window_id and std.mem.eql(u8, view.label, item.label)) {
|
|
160
|
+
selected = index;
|
|
161
|
+
break;
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
if (selected) |index| {
|
|
165
|
+
facts |= interactions.Fact.view;
|
|
166
|
+
if (self.views[index].canvasWidgetNodeIndexById(item.id)) |node_index| {
|
|
167
|
+
facts |= interactions.Fact.node;
|
|
168
|
+
const widget = self.views[index].widget_layout_nodes[node_index].widget;
|
|
169
|
+
if (widget.context_menu.len != 0) facts |= interactions.Fact.menu;
|
|
170
|
+
if (item.item_index < widget.context_menu.len) {
|
|
171
|
+
facts |= interactions.Fact.item;
|
|
172
|
+
const declared = widget.context_menu[item.item_index];
|
|
173
|
+
if (declared.separator) facts |= interactions.Fact.separator;
|
|
174
|
+
if (declared.enabled) facts |= interactions.Fact.enabled;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
try interactions.plan(policy, .menu_admission, .{ .facts = facts }).admit();
|
|
179
|
+
return selected.?;
|
|
180
|
+
}
|
|
181
|
+
try @import("shell_admission_policy.zig").label(self.shell_admission_policy, 0, item.label);
|
|
182
|
+
const window_index = runtimeFindWindowIndexById(self, item.window_id) orelse return error.WindowNotFound;
|
|
183
|
+
if (!self.windows[window_index].info.open) return error.WindowNotFound;
|
|
184
|
+
const view_index = find: {
|
|
185
|
+
for (self.views[0..self.view_count], 0..) |*view, index| {
|
|
186
|
+
if (view.open and view.kind == .gpu_surface and view.window_id == item.window_id and std.mem.eql(u8, view.label, item.label)) break :find index;
|
|
187
|
+
}
|
|
188
|
+
return error.ViewNotFound;
|
|
189
|
+
};
|
|
190
|
+
const node_index = self.views[view_index].canvasWidgetNodeIndexById(item.id) orelse return error.InvalidCommand;
|
|
208
191
|
const widget = self.views[view_index].widget_layout_nodes[node_index].widget;
|
|
209
192
|
if (widget.context_menu.len == 0) return error.ContextMenuUndeclared;
|
|
210
193
|
if (item.item_index >= widget.context_menu.len) return error.ContextMenuItemOutOfRange;
|
|
211
194
|
const declared = widget.context_menu[item.item_index];
|
|
212
195
|
if (declared.separator) return error.ContextMenuItemSeparator;
|
|
213
196
|
if (!declared.enabled) return error.ContextMenuItemDisabled;
|
|
197
|
+
return view_index;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
pub fn dispatchWidgetContextMenuItem(self: *Runtime, app: runtime_api.App(Runtime), item: platform.WidgetContextMenuActionEvent) anyerror!void {
|
|
201
|
+
const view_index = try widgetContextMenuTargetViewIndex(self, item);
|
|
202
|
+
const node_index = self.views[view_index].canvasWidgetNodeIndexById(item.id) orelse return error.InvalidCommand;
|
|
203
|
+
const widget = self.views[view_index].widget_layout_nodes[node_index].widget;
|
|
214
204
|
|
|
215
205
|
// This direct dispatch supersedes any pending presentation:
|
|
216
206
|
// the replacement request commits first (bookkeeping must
|
|
@@ -247,26 +237,42 @@ pub fn RuntimeAutomationWidgetDispatch(comptime Runtime: type) type {
|
|
|
247
237
|
// dispatching its item. Refuse by name instead — the
|
|
248
238
|
// handler's successor menu is on the glass with its own
|
|
249
239
|
// pending request, so nothing is orphaned.
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
240
|
+
if (self.automation_interaction_policy) |policy| {
|
|
241
|
+
const current = self.canvas_widget_context_menu_pending;
|
|
242
|
+
const view_open = view_check: {
|
|
243
|
+
for (self.views[0..self.view_count]) |*view| {
|
|
244
|
+
if (view.open and view.window_id == pending.window_id and std.mem.eql(u8, view.label, pending.viewLabel())) break :view_check true;
|
|
245
|
+
}
|
|
246
|
+
break :view_check false;
|
|
247
|
+
};
|
|
248
|
+
const program = interactions.plan(policy, .menu_completion, .{ .facts = (if (current != null) @as(u32, interactions.Fact.pending) else 0) | (if (view_open) @as(u32, interactions.Fact.view) else 0), .expected_token = token, .current_token = if (current) |value| value.token else 0 });
|
|
249
|
+
if (program.flags & 32 != 0) self.canvas_widget_context_menu_pending = null;
|
|
250
|
+
if (program.status != 0) {
|
|
251
|
+
try notice;
|
|
252
|
+
try program.admit();
|
|
253
|
+
}
|
|
254
|
+
} else {
|
|
255
|
+
const still_armed = if (self.canvas_widget_context_menu_pending) |current| current.token == token else false;
|
|
256
|
+
if (!still_armed) {
|
|
257
|
+
try notice;
|
|
258
|
+
return error.ContextMenuSuperseded;
|
|
259
|
+
}
|
|
260
|
+
// The notice may instead have CLOSED the verb's target view:
|
|
261
|
+
// the armed request can never resolve (the action dispatch
|
|
262
|
+
// would clear the token, fail its view lookup, and silently
|
|
263
|
+
// drop the selection). Disarm it and refuse by name — never
|
|
264
|
+
// a silent success, never an orphaned token.
|
|
265
|
+
const view_open = view_check: {
|
|
266
|
+
for (self.views[0..self.view_count]) |*view| {
|
|
267
|
+
if (view.open and view.window_id == pending.window_id and std.mem.eql(u8, view.label, pending.viewLabel())) break :view_check true;
|
|
268
|
+
}
|
|
269
|
+
break :view_check false;
|
|
270
|
+
};
|
|
271
|
+
if (!view_open) {
|
|
272
|
+
self.canvas_widget_context_menu_pending = null;
|
|
273
|
+
try notice;
|
|
274
|
+
return error.ContextMenuViewClosed;
|
|
263
275
|
}
|
|
264
|
-
break :view_check false;
|
|
265
|
-
};
|
|
266
|
-
if (!view_open) {
|
|
267
|
-
self.canvas_widget_context_menu_pending = null;
|
|
268
|
-
try notice;
|
|
269
|
-
return error.ContextMenuViewClosed;
|
|
270
276
|
}
|
|
271
277
|
// The synthetic event names its view from the request's own
|
|
272
278
|
// bounded copy, never `self.views[view_index]` re-read here:
|
|
@@ -301,49 +307,22 @@ pub fn RuntimeAutomationWidgetDispatch(comptime Runtime: type) type {
|
|
|
301
307
|
}
|
|
302
308
|
|
|
303
309
|
pub fn dispatchAutomationWidgetWheel(self: *Runtime, app: runtime_api.App(Runtime), wheel: AutomationWidgetWheel) anyerror!void {
|
|
304
|
-
|
|
305
|
-
const
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
const node = layout.findById(wheel.target.id) orelse return error.WheelTargetUnknown;
|
|
312
|
-
if (!canvasWidgetInteractionTargetExists(layout, wheel.target.id)) return error.WheelTargetNotInteractive;
|
|
313
|
-
const bounds = node.frame.normalized();
|
|
314
|
-
if (bounds.isEmpty()) return error.WheelTargetHasEmptyBounds;
|
|
315
|
-
const point = bounds.center();
|
|
316
|
-
const timestamp_ns = automationInputTimestampNs();
|
|
317
|
-
try self.dispatchPlatformEvent(app, .{ .gpu_surface_input = .{
|
|
318
|
-
.window_id = self.views[view_index].window_id,
|
|
319
|
-
.label = self.views[view_index].label,
|
|
320
|
-
.kind = .scroll,
|
|
321
|
-
.timestamp_ns = timestamp_ns,
|
|
322
|
-
.x = point.x,
|
|
323
|
-
.y = point.y,
|
|
324
|
-
.delta_x = wheel.delta_x,
|
|
325
|
-
.delta_y = wheel.delta_y,
|
|
326
|
-
} });
|
|
310
|
+
if (self.automation_interaction_policy == null) return ReferenceMethods().dispatchAutomationWidgetWheel(self, app, wheel);
|
|
311
|
+
const index = try automationWidgetTargetViewIndex(self, wheel.target);
|
|
312
|
+
var options = interactionTarget(self, index, wheel.target.id);
|
|
313
|
+
options.delta = .{ .dx = wheel.delta_x, .dy = wheel.delta_y };
|
|
314
|
+
const program = interactions.plan(self.automation_interaction_policy.?, .wheel, options);
|
|
315
|
+
try program.admit();
|
|
316
|
+
try dispatchInteractionSteps(self, app, index, program, .{});
|
|
327
317
|
}
|
|
328
318
|
|
|
329
319
|
pub fn dispatchAutomationWidgetKeyInput(self: *Runtime, app: runtime_api.App(Runtime), key: AutomationWidgetKey) anyerror!void {
|
|
330
|
-
|
|
331
|
-
try
|
|
332
|
-
try self.
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
.timestamp_ns = automationInputTimestampNs(),
|
|
337
|
-
.key = key.key,
|
|
338
|
-
.text = key.text,
|
|
339
|
-
.modifiers = .{
|
|
340
|
-
.shift = key.modifiers.shift,
|
|
341
|
-
.control = key.modifiers.control,
|
|
342
|
-
.option = key.modifiers.option,
|
|
343
|
-
.command = key.modifiers.command,
|
|
344
|
-
.primary = key.modifiers.primary,
|
|
345
|
-
},
|
|
346
|
-
} });
|
|
320
|
+
if (self.automation_interaction_policy == null) return ReferenceMethods().dispatchAutomationWidgetKeyInput(self, app, key);
|
|
321
|
+
const index = try automationGpuSurfaceViewIndexByLabel(self, key.view_label);
|
|
322
|
+
try self.focusView(self.views[index].window_id, self.views[index].label);
|
|
323
|
+
const program = interactions.plan(self.automation_interaction_policy.?, .key, .{});
|
|
324
|
+
try program.admit();
|
|
325
|
+
try dispatchInteractionSteps(self, app, index, program, .{ .key = key.key, .text = key.text, .modifiers = .{ .shift = key.modifiers.shift, .control = key.modifiers.control, .option = key.modifiers.option, .command = key.modifiers.command, .primary = key.modifiers.primary } });
|
|
347
326
|
}
|
|
348
327
|
|
|
349
328
|
/// Drive a trackpad pinch through the real platform-event path:
|
|
@@ -360,102 +339,22 @@ pub fn RuntimeAutomationWidgetDispatch(comptime Runtime: type) type {
|
|
|
360
339
|
/// not a widget verb (it never routes into the widget tree; the
|
|
361
340
|
/// app hears it through the pinch channel).
|
|
362
341
|
pub fn dispatchAutomationWidgetPinch(self: *Runtime, app: runtime_api.App(Runtime), pinch: automation_commands.AutomationWidgetPinch) anyerror!void {
|
|
363
|
-
|
|
364
|
-
const
|
|
365
|
-
const
|
|
366
|
-
const
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
);
|
|
370
|
-
// The wire delta is `scale - 1` in f32, and f32 rounding can
|
|
371
|
-
// betray the parser's `scale > 0` guard: any scale at or
|
|
372
|
-
// below 2^-25 rounds the difference to exactly -1
|
|
373
|
-
// (ties-to-even at the halfway point), which would put the
|
|
374
|
-
// factor `1 + delta = 0` on the wire — a zoom through zero
|
|
375
|
-
// scale, which no gesture can perform and no downstream
|
|
376
|
-
// product can recover from. The invariant is the WIRE's
|
|
377
|
-
// (every emitted factor stays > 0), so validate the computed
|
|
378
|
-
// delta, not the input; the minimum accepted scale is the
|
|
379
|
-
// smallest f32 above 2^-25 (~2.9802326e-8), whose delta
|
|
380
|
-
// rounds to -1 + 2^-24 — the smallest positive factor the
|
|
381
|
-
// wire can carry. Refused before anything dispatches, so no
|
|
382
|
-
// partial gesture reaches the journal.
|
|
383
|
-
const delta = pinch.scale - 1;
|
|
384
|
-
if (1 + delta <= 0) return error.PinchScaleBelowWireMinimum;
|
|
385
|
-
const timestamp_ns = automationInputTimestampNs();
|
|
386
|
-
try self.dispatchPlatformEvent(app, .{ .gpu_surface_input = .{
|
|
387
|
-
.window_id = window_id,
|
|
388
|
-
.label = label,
|
|
389
|
-
.kind = .pinch_begin,
|
|
390
|
-
.timestamp_ns = timestamp_ns,
|
|
391
|
-
.x = point.x,
|
|
392
|
-
.y = point.y,
|
|
393
|
-
} });
|
|
394
|
-
try self.dispatchPlatformEvent(app, .{ .gpu_surface_input = .{
|
|
395
|
-
.window_id = window_id,
|
|
396
|
-
.label = label,
|
|
397
|
-
.kind = .pinch_change,
|
|
398
|
-
.timestamp_ns = timestamp_ns,
|
|
399
|
-
.x = point.x,
|
|
400
|
-
.y = point.y,
|
|
401
|
-
.scale = delta,
|
|
402
|
-
} });
|
|
403
|
-
try self.dispatchPlatformEvent(app, .{ .gpu_surface_input = .{
|
|
404
|
-
.window_id = window_id,
|
|
405
|
-
.label = label,
|
|
406
|
-
.kind = .pinch_end,
|
|
407
|
-
.timestamp_ns = timestamp_ns,
|
|
408
|
-
.x = point.x,
|
|
409
|
-
.y = point.y,
|
|
410
|
-
} });
|
|
342
|
+
if (self.automation_interaction_policy == null) return ReferenceMethods().dispatchAutomationWidgetPinch(self, app, pinch);
|
|
343
|
+
const index = try automationGpuSurfaceViewIndexByLabel(self, pinch.view_label);
|
|
344
|
+
const options: interactions.Options = .{ .frame = .init(0, 0, self.views[index].gpu_size.width, self.views[index].gpu_size.height), .point = pinch.point orelse .zero(), .facts = if (pinch.point != null) interactions.Fact.point else 0, .delta = .{ .dx = pinch.scale, .dy = 0 } };
|
|
345
|
+
const program = interactions.plan(self.automation_interaction_policy.?, .pinch, options);
|
|
346
|
+
try program.admit();
|
|
347
|
+
try dispatchInteractionSteps(self, app, index, program, .{});
|
|
411
348
|
}
|
|
412
349
|
|
|
413
350
|
pub fn dispatchAutomationWidgetPointerDrag(self: *Runtime, app: runtime_api.App(Runtime), drag: AutomationWidgetPointerDrag) anyerror!void {
|
|
414
|
-
|
|
415
|
-
const
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
const
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
bounds.x + bounds.width * drag.start_x_ratio,
|
|
422
|
-
bounds.y + bounds.height * drag.start_y_ratio,
|
|
423
|
-
);
|
|
424
|
-
const end = geometry.PointF.init(
|
|
425
|
-
bounds.x + bounds.width * drag.end_x_ratio,
|
|
426
|
-
bounds.y + bounds.height * drag.end_y_ratio,
|
|
427
|
-
);
|
|
428
|
-
const timestamp_ns = automationInputTimestampNs();
|
|
429
|
-
|
|
430
|
-
try self.dispatchPlatformEvent(app, .{ .gpu_surface_input = .{
|
|
431
|
-
.window_id = self.views[view_index].window_id,
|
|
432
|
-
.label = self.views[view_index].label,
|
|
433
|
-
.kind = .pointer_down,
|
|
434
|
-
.timestamp_ns = timestamp_ns,
|
|
435
|
-
.x = start.x,
|
|
436
|
-
.y = start.y,
|
|
437
|
-
.button = 0,
|
|
438
|
-
} });
|
|
439
|
-
try self.dispatchPlatformEvent(app, .{ .gpu_surface_input = .{
|
|
440
|
-
.window_id = self.views[view_index].window_id,
|
|
441
|
-
.label = self.views[view_index].label,
|
|
442
|
-
.kind = .pointer_drag,
|
|
443
|
-
.timestamp_ns = timestamp_ns,
|
|
444
|
-
.x = end.x,
|
|
445
|
-
.y = end.y,
|
|
446
|
-
.delta_x = end.x - start.x,
|
|
447
|
-
.delta_y = end.y - start.y,
|
|
448
|
-
.button = 0,
|
|
449
|
-
} });
|
|
450
|
-
try self.dispatchPlatformEvent(app, .{ .gpu_surface_input = .{
|
|
451
|
-
.window_id = self.views[view_index].window_id,
|
|
452
|
-
.label = self.views[view_index].label,
|
|
453
|
-
.kind = .pointer_up,
|
|
454
|
-
.timestamp_ns = timestamp_ns,
|
|
455
|
-
.x = end.x,
|
|
456
|
-
.y = end.y,
|
|
457
|
-
.button = 0,
|
|
458
|
-
} });
|
|
351
|
+
if (self.automation_interaction_policy == null) return ReferenceMethods().dispatchAutomationWidgetPointerDrag(self, app, drag);
|
|
352
|
+
const index = try automationWidgetTargetViewIndex(self, drag.target);
|
|
353
|
+
var options = interactionTarget(self, index, drag.target.id);
|
|
354
|
+
options.ratios = .{ drag.start_x_ratio, drag.start_y_ratio, drag.end_x_ratio, drag.end_y_ratio };
|
|
355
|
+
const program = interactions.plan(self.automation_interaction_policy.?, .pointer_drag, options);
|
|
356
|
+
try program.admit();
|
|
357
|
+
try dispatchInteractionSteps(self, app, index, program, .{});
|
|
459
358
|
}
|
|
460
359
|
|
|
461
360
|
pub fn canvasWidgetActionsForId(self: *const Runtime, view_index: usize, id: canvas.ObjectId) ?canvas.WidgetActions {
|
|
@@ -565,17 +464,13 @@ pub fn RuntimeAutomationWidgetDispatch(comptime Runtime: type) type {
|
|
|
565
464
|
// The escalation deliberately skips the tooltip machine —
|
|
566
465
|
// it is still programmatic focus (no reveal), and the focus
|
|
567
466
|
// MOVE above already hid any focus-owned tooltip.
|
|
568
|
-
if (self.
|
|
569
|
-
const
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
// above), so no keyboard provenance either.
|
|
576
|
-
self.views[view_index].canvas_widget_focus_visible_keyboard = false;
|
|
577
|
-
try CanvasWidgetEventMethods().invalidateForCanvasWidgetRenderStateChange(self, view_index, previous_state, self.views[view_index].canvasWidgetRenderState());
|
|
578
|
-
}
|
|
467
|
+
if (self.canvasWidgetKeyboardFocusParticipation(view_index, id, 1)) {
|
|
468
|
+
const previous_state = self.views[view_index].canvasWidgetRenderState();
|
|
469
|
+
self.views[view_index].canvas_widget_focus_visible_id = id;
|
|
470
|
+
// Still programmatic (no reveal — see the comment
|
|
471
|
+
// above), so no keyboard provenance either.
|
|
472
|
+
self.views[view_index].canvas_widget_focus_visible_keyboard = false;
|
|
473
|
+
try CanvasWidgetEventMethods().invalidateForCanvasWidgetRenderStateChange(self, view_index, previous_state, self.views[view_index].canvasWidgetRenderState());
|
|
579
474
|
}
|
|
580
475
|
try self.dispatchPlatformEvent(app, .{ .gpu_surface_input = .{
|
|
581
476
|
.window_id = self.views[view_index].window_id,
|
|
@@ -615,40 +510,12 @@ pub fn RuntimeAutomationWidgetDispatch(comptime Runtime: type) type {
|
|
|
615
510
|
/// editor — writing the editor state directly produced on-screen
|
|
616
511
|
/// state no real user could reach.
|
|
617
512
|
pub fn setAutomationCanvasWidgetText(self: *Runtime, app: runtime_api.App(Runtime), view_index: usize, id: canvas.ObjectId, text: []const u8) anyerror!void {
|
|
513
|
+
if (self.automation_interaction_policy == null) return ReferenceMethods().setAutomationCanvasWidgetText(self, app, view_index, id, text);
|
|
618
514
|
try focusAutomationCanvasWidget(self, view_index, id);
|
|
619
|
-
if (
|
|
620
|
-
const
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
// Select all (the platform primary shortcut), exactly like a
|
|
625
|
-
// user pressing cmd/ctrl+a in the focused field.
|
|
626
|
-
try self.dispatchPlatformEvent(app, .{ .gpu_surface_input = .{
|
|
627
|
-
.window_id = window_id,
|
|
628
|
-
.label = label,
|
|
629
|
-
.kind = .key_down,
|
|
630
|
-
.timestamp_ns = timestamp_ns,
|
|
631
|
-
.key = "a",
|
|
632
|
-
.modifiers = .{ .primary = true },
|
|
633
|
-
} });
|
|
634
|
-
if (text.len == 0) {
|
|
635
|
-
// Empty replacement: delete the selection.
|
|
636
|
-
try self.dispatchPlatformEvent(app, .{ .gpu_surface_input = .{
|
|
637
|
-
.window_id = window_id,
|
|
638
|
-
.label = label,
|
|
639
|
-
.kind = .key_down,
|
|
640
|
-
.timestamp_ns = timestamp_ns,
|
|
641
|
-
.key = "backspace",
|
|
642
|
-
} });
|
|
643
|
-
return;
|
|
644
|
-
}
|
|
645
|
-
try self.dispatchPlatformEvent(app, .{ .gpu_surface_input = .{
|
|
646
|
-
.window_id = window_id,
|
|
647
|
-
.label = label,
|
|
648
|
-
.kind = .text_input,
|
|
649
|
-
.timestamp_ns = timestamp_ns,
|
|
650
|
-
.text = text,
|
|
651
|
-
} });
|
|
515
|
+
const facts: u32 = (if (self.views[view_index].canEditCanvasWidgetText(id)) @as(u32, interactions.Fact.editable) else 0) | (if (text.len != 0) @as(u32, interactions.Fact.text) else 0);
|
|
516
|
+
const program = interactions.plan(self.automation_interaction_policy.?, .replace_text, .{ .facts = facts });
|
|
517
|
+
try program.admit();
|
|
518
|
+
try dispatchInteractionSteps(self, app, view_index, program, .{ .text = text });
|
|
652
519
|
}
|
|
653
520
|
|
|
654
521
|
/// Composition edits ride the SAME ime input events a real IME
|
|
@@ -668,15 +535,11 @@ pub fn RuntimeAutomationWidgetDispatch(comptime Runtime: type) type {
|
|
|
668
535
|
kind: platform.GpuSurfaceInputKind,
|
|
669
536
|
text: []const u8,
|
|
670
537
|
) anyerror!void {
|
|
538
|
+
if (self.automation_interaction_policy == null) return ReferenceMethods().composeAutomationCanvasWidgetText(self, app, view_index, id, kind, text);
|
|
671
539
|
try focusAutomationCanvasWidget(self, view_index, id);
|
|
672
|
-
if (
|
|
673
|
-
try
|
|
674
|
-
|
|
675
|
-
.label = self.views[view_index].label,
|
|
676
|
-
.kind = kind,
|
|
677
|
-
.timestamp_ns = automationInputTimestampNs(),
|
|
678
|
-
.text = text,
|
|
679
|
-
} });
|
|
540
|
+
const program = interactions.plan(self.automation_interaction_policy.?, .composition, .{ .facts = if (self.views[view_index].canEditCanvasWidgetText(id)) interactions.Fact.editable else 0 });
|
|
541
|
+
try program.admit();
|
|
542
|
+
try dispatchInteractionSteps(self, app, view_index, program, .{ .text = text, .composition = kind });
|
|
680
543
|
}
|
|
681
544
|
|
|
682
545
|
/// Selection edits have no platform input kind to ride, so the
|
|
@@ -708,17 +571,17 @@ pub fn RuntimeAutomationWidgetDispatch(comptime Runtime: type) type {
|
|
|
708
571
|
}
|
|
709
572
|
|
|
710
573
|
pub fn dispatchAutomationCanvasWidgetDrag(self: *Runtime, app: runtime_api.App(Runtime), view_index: usize, id: canvas.ObjectId, value: []const u8) anyerror!void {
|
|
574
|
+
if (self.automation_interaction_policy == null) return ReferenceMethods().dispatchAutomationCanvasWidgetDrag(self, app, view_index, id, value);
|
|
711
575
|
if (view_index >= self.view_count) return error.ViewNotFound;
|
|
712
|
-
const delta = try parseAutomationDragDelta(value);
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
const
|
|
716
|
-
|
|
717
|
-
if (bounds.isEmpty()) return error.InvalidCommand;
|
|
576
|
+
const delta = try parseAutomationDragDelta(self.automation_command_policy, value);
|
|
577
|
+
var options = interactionTarget(self, view_index, id);
|
|
578
|
+
options.delta = delta;
|
|
579
|
+
const program = interactions.plan(self.automation_interaction_policy.?, .drag, options);
|
|
580
|
+
try program.admit();
|
|
718
581
|
|
|
719
582
|
const window_id = self.views[view_index].window_id;
|
|
720
583
|
const label = self.views[view_index].label;
|
|
721
|
-
const origin =
|
|
584
|
+
const origin = program.origin;
|
|
722
585
|
const previous_pressed_id = self.views[view_index].canvas_widget_pressed_id;
|
|
723
586
|
const previous_state = self.views[view_index].canvasWidgetRenderState();
|
|
724
587
|
self.views[view_index].canvas_widget_pressed_id = id;
|
|
@@ -737,26 +600,7 @@ pub fn RuntimeAutomationWidgetDispatch(comptime Runtime: type) type {
|
|
|
737
600
|
}
|
|
738
601
|
}
|
|
739
602
|
|
|
740
|
-
try self
|
|
741
|
-
.window_id = window_id,
|
|
742
|
-
.label = label,
|
|
743
|
-
.kind = .pointer_drag,
|
|
744
|
-
.x = origin.x + delta.dx,
|
|
745
|
-
.y = origin.y + delta.dy,
|
|
746
|
-
.delta_x = delta.dx,
|
|
747
|
-
.delta_y = delta.dy,
|
|
748
|
-
} });
|
|
749
|
-
|
|
750
|
-
// Complete the gesture through the same release path as a
|
|
751
|
-
// physical pointer so markup `on-drag` handlers receive their
|
|
752
|
-
// release position instead of automation stopping mid-drag.
|
|
753
|
-
try self.dispatchPlatformEvent(app, .{ .gpu_surface_input = .{
|
|
754
|
-
.window_id = window_id,
|
|
755
|
-
.label = label,
|
|
756
|
-
.kind = .pointer_up,
|
|
757
|
-
.x = origin.x + delta.dx,
|
|
758
|
-
.y = origin.y + delta.dy,
|
|
759
|
-
} });
|
|
603
|
+
try dispatchInteractionSteps(self, app, view_index, program, .{});
|
|
760
604
|
|
|
761
605
|
if (runtimeFindViewIndex(self, window_id, label)) |current_index| {
|
|
762
606
|
if (self.views[current_index].canvas_widget_pressed_id == id) {
|
|
@@ -768,21 +612,16 @@ pub fn RuntimeAutomationWidgetDispatch(comptime Runtime: type) type {
|
|
|
768
612
|
}
|
|
769
613
|
|
|
770
614
|
pub fn dispatchAutomationCanvasWidgetFileDrop(self: *Runtime, app: runtime_api.App(Runtime), view_index: usize, id: canvas.ObjectId, value: []const u8) anyerror!void {
|
|
771
|
-
if (
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
const
|
|
776
|
-
const
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
try self
|
|
781
|
-
.window_id = self.views[view_index].window_id,
|
|
782
|
-
.view_label = self.views[view_index].label,
|
|
783
|
-
.point = bounds.center(),
|
|
784
|
-
.paths = paths,
|
|
785
|
-
} });
|
|
615
|
+
if (self.automation_interaction_policy == null) return ReferenceMethods().dispatchAutomationCanvasWidgetFileDrop(self, app, view_index, id, value);
|
|
616
|
+
var options = interactionTarget(self, view_index, id);
|
|
617
|
+
options.phase = 1;
|
|
618
|
+
try interactions.plan(self.automation_interaction_policy.?, .drop, options).admit();
|
|
619
|
+
var buffer: [platform.max_drop_paths][]const u8 = undefined;
|
|
620
|
+
const paths = try parseAutomationDropPaths(self.automation_command_policy, value, &buffer);
|
|
621
|
+
options = interactionTarget(self, view_index, id);
|
|
622
|
+
const program = interactions.plan(self.automation_interaction_policy.?, .drop, options);
|
|
623
|
+
try program.admit();
|
|
624
|
+
try dispatchInteractionSteps(self, app, view_index, program, .{ .paths = paths });
|
|
786
625
|
}
|
|
787
626
|
|
|
788
627
|
fn automationWidgetTargetViewIndex(self: *Runtime, target: AutomationWidgetTarget) anyerror!usize {
|
|
@@ -832,7 +671,7 @@ pub fn RuntimeAutomationWidgetDispatch(comptime Runtime: type) type {
|
|
|
832
671
|
/// per window, and for hand-rolled duplicates the first open
|
|
833
672
|
/// match in window order wins, deterministically.
|
|
834
673
|
pub fn automationGpuSurfaceViewIndexByLabel(self: *Runtime, view_label: []const u8) anyerror!usize {
|
|
835
|
-
try
|
|
674
|
+
try @import("shell_admission_policy.zig").label(self.shell_admission_policy, 0, view_label);
|
|
836
675
|
for (self.views[0..self.view_count], 0..) |*view, index| {
|
|
837
676
|
if (!view.open or view.kind != .gpu_surface) continue;
|
|
838
677
|
if (!std.mem.eql(u8, view.label, view_label)) continue;
|
|
@@ -843,6 +682,79 @@ pub fn RuntimeAutomationWidgetDispatch(comptime Runtime: type) type {
|
|
|
843
682
|
return error.ViewNotFound;
|
|
844
683
|
}
|
|
845
684
|
|
|
685
|
+
fn ReferenceMethods() type {
|
|
686
|
+
return reference_dispatch.RuntimeAutomationWidgetDispatch(Runtime);
|
|
687
|
+
}
|
|
688
|
+
fn interactionTarget(self: *Runtime, index: usize, id: canvas.ObjectId) interactions.Options {
|
|
689
|
+
if (index >= self.view_count) return .{};
|
|
690
|
+
const layout = self.views[index].widgetLayoutTree();
|
|
691
|
+
const node = layout.findById(id);
|
|
692
|
+
return .{ .facts = interactions.Fact.view | (if (node != null) @as(u32, interactions.Fact.node) else 0) | (if (canvasWidgetInteractionTargetExists(layout, id)) @as(u32, interactions.Fact.interactive) else 0), .frame = if (node) |value| value.frame else .zero() };
|
|
693
|
+
}
|
|
694
|
+
const InteractionPayload = struct {
|
|
695
|
+
key: []const u8 = "",
|
|
696
|
+
text: []const u8 = "",
|
|
697
|
+
modifiers: platform.ShortcutModifiers = .{},
|
|
698
|
+
composition: platform.GpuSurfaceInputKind = .ime_set_composition,
|
|
699
|
+
paths: []const []const u8 = &.{},
|
|
700
|
+
};
|
|
701
|
+
fn dispatchInteractionSteps(self: *Runtime, app: runtime_api.App(Runtime), index: usize, program: interactions.Program, payload: InteractionPayload) anyerror!void {
|
|
702
|
+
const window_id = self.views[index].window_id;
|
|
703
|
+
const label = self.views[index].label;
|
|
704
|
+
const timestamp = if (program.flags & 4 != 0) automationInputTimestampNs() else 0;
|
|
705
|
+
var batch_active = program.flags & 1 != 0;
|
|
706
|
+
if (batch_active) CanvasWidgetDisplayMethods().beginCanvasWidgetDisplayListRefreshBatch(self);
|
|
707
|
+
errdefer if (batch_active) {
|
|
708
|
+
CanvasWidgetDisplayMethods().endCanvasWidgetDisplayListRefreshBatch(self) catch CanvasWidgetDisplayMethods().cancelCanvasWidgetDisplayListRefreshBatch(self);
|
|
709
|
+
};
|
|
710
|
+
for (program.steps[0..program.count]) |step| {
|
|
711
|
+
const current_window = if (program.flags & 2 != 0) self.views[index].window_id else window_id;
|
|
712
|
+
const current_label = if (program.flags & 2 != 0) self.views[index].label else label;
|
|
713
|
+
if (step.event == .hold_timer) {
|
|
714
|
+
try self.dispatchPlatformEvent(app, .{ .timer = .{ .id = platform.press_hold_timer_id, .timestamp_ns = timestamp } });
|
|
715
|
+
} else if (step.event == .drop) {
|
|
716
|
+
try self.dispatchPlatformEvent(app, .{ .files_dropped = .{ .window_id = current_window, .view_label = current_label, .point = step.point, .paths = payload.paths } });
|
|
717
|
+
} else {
|
|
718
|
+
try self.dispatchPlatformEvent(app, .{ .gpu_surface_input = .{
|
|
719
|
+
.window_id = current_window,
|
|
720
|
+
.label = current_label,
|
|
721
|
+
.kind = switch (step.event) {
|
|
722
|
+
.down => .pointer_down,
|
|
723
|
+
.up => .pointer_up,
|
|
724
|
+
.drag => .pointer_drag,
|
|
725
|
+
.scroll => .scroll,
|
|
726
|
+
.key => .key_down,
|
|
727
|
+
.text => .text_input,
|
|
728
|
+
.pinch_begin => .pinch_begin,
|
|
729
|
+
.pinch_change => .pinch_change,
|
|
730
|
+
.pinch_end => .pinch_end,
|
|
731
|
+
.composition => payload.composition,
|
|
732
|
+
else => unreachable,
|
|
733
|
+
},
|
|
734
|
+
.timestamp_ns = timestamp,
|
|
735
|
+
.x = step.point.x,
|
|
736
|
+
.y = step.point.y,
|
|
737
|
+
.delta_x = step.delta.dx,
|
|
738
|
+
.delta_y = step.delta.dy,
|
|
739
|
+
.scale = step.scale,
|
|
740
|
+
.button = step.button,
|
|
741
|
+
.key = switch (step.key) {
|
|
742
|
+
.borrowed => if (step.event == .key) payload.key else "",
|
|
743
|
+
.select_all => "a",
|
|
744
|
+
.backspace => "backspace",
|
|
745
|
+
},
|
|
746
|
+
.text = if (step.text) payload.text else "",
|
|
747
|
+
.modifiers = if (step.key == .select_all) .{ .primary = true } else if (step.event == .key) payload.modifiers else .{},
|
|
748
|
+
} });
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
if (program.flags & 16 != 0) self.cancelTimer(platform.press_hold_timer_id) catch {};
|
|
752
|
+
if (batch_active) {
|
|
753
|
+
try CanvasWidgetDisplayMethods().endCanvasWidgetDisplayListRefreshBatch(self);
|
|
754
|
+
batch_active = false;
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
|
|
846
758
|
fn CanvasWidgetDisplayMethods() type {
|
|
847
759
|
return runtime_canvas_widget_display.RuntimeCanvasWidgetDisplay(Runtime);
|
|
848
760
|
}
|