@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
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
//! Copied font metadata; bytes, parsing and lifetime remain native capabilities.
|
|
2
|
+
const std = @import("std");
|
|
3
|
+
pub const Policy = *const fn ([]const u8, []u8) usize;
|
|
4
|
+
pub const Mode = enum(u8) { register, lookup, unsupported_host, provider, repaint, refresh };
|
|
5
|
+
pub const Options = struct {
|
|
6
|
+
id: u64 = 0,
|
|
7
|
+
minimum_id: u64 = 64,
|
|
8
|
+
length: usize = 0,
|
|
9
|
+
budget: usize = 0,
|
|
10
|
+
built_count: usize = 0,
|
|
11
|
+
facts: u32 = 0,
|
|
12
|
+
};
|
|
13
|
+
pub const Program = struct {
|
|
14
|
+
status: u32,
|
|
15
|
+
selected: ?usize,
|
|
16
|
+
action: u32,
|
|
17
|
+
pub fn admit(self: Program) !void {
|
|
18
|
+
switch (self.status) {
|
|
19
|
+
0 => {},
|
|
20
|
+
1 => return error.InvalidFontId,
|
|
21
|
+
2 => return error.ReservedFontId,
|
|
22
|
+
3 => return error.FontTooLarge,
|
|
23
|
+
4 => return error.FontIdInUse,
|
|
24
|
+
5 => return error.FontRegistryFull,
|
|
25
|
+
6 => return error.FontHostRegistrationUnsupported,
|
|
26
|
+
else => unreachable,
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
fn put(bytes: []u8, at: usize, value: u32) void {
|
|
31
|
+
std.mem.writeInt(u32, bytes[at..][0..4], value, .little);
|
|
32
|
+
}
|
|
33
|
+
fn word(bytes: []const u8, at: usize) u32 {
|
|
34
|
+
return std.mem.readInt(u32, bytes[at..][0..4], .little);
|
|
35
|
+
}
|
|
36
|
+
fn wide(bytes: []u8, at: usize, value: u64) void {
|
|
37
|
+
std.mem.writeInt(u64, bytes[at..][0..8], value, .little);
|
|
38
|
+
}
|
|
39
|
+
pub fn plan(policy: Policy, mode: Mode, ids: []const u64, count: usize, options: Options) Program {
|
|
40
|
+
if (count > 8 or (mode == .register or mode == .lookup) and ids.len != count) @panic("font registry observation capacity");
|
|
41
|
+
var request: [128]u8 = @splat(0);
|
|
42
|
+
request[0..3].* = .{ 83, 1, @intFromEnum(mode) };
|
|
43
|
+
put(&request, 4, @intCast(count));
|
|
44
|
+
put(&request, 8, 8);
|
|
45
|
+
put(&request, 12, options.facts);
|
|
46
|
+
wide(&request, 16, options.id);
|
|
47
|
+
wide(&request, 24, options.minimum_id);
|
|
48
|
+
wide(&request, 32, options.length);
|
|
49
|
+
wide(&request, 40, options.budget);
|
|
50
|
+
put(&request, 48, @intCast(options.built_count));
|
|
51
|
+
for (ids, 0..) |id, i| wide(&request, 64 + i * 8, id);
|
|
52
|
+
var output: [16]u8 = @splat(0xa5);
|
|
53
|
+
const length = policy(request[0 .. 64 + count * 8], &output);
|
|
54
|
+
const status = word(&output, 4);
|
|
55
|
+
const selected = word(&output, 8);
|
|
56
|
+
const action = word(&output, 12);
|
|
57
|
+
if (length != output.len or word(&output, 0) != 1 or status > 6) @panic("invalid compiled font registry shape");
|
|
58
|
+
const maximum_action: u32 = switch (mode) {
|
|
59
|
+
.register => 3,
|
|
60
|
+
.lookup, .unsupported_host => 0,
|
|
61
|
+
.provider => 2,
|
|
62
|
+
.repaint, .refresh => 1,
|
|
63
|
+
};
|
|
64
|
+
if (action > maximum_action or (status != 0 and action != 0) or (status != 0 and mode != .register and mode != .unsupported_host) or (status == 6 and mode != .unsupported_host) or (mode == .unsupported_host and status != 0 and status != 6)) @panic("invalid compiled font registry admission");
|
|
65
|
+
if (selected != std.math.maxInt(u32) and (mode != .register and mode != .lookup or selected >= 8 or selected > count or (selected == count and !(mode == .register and status == 0)))) @panic("invalid compiled font registry selection");
|
|
66
|
+
if (mode == .register and status == 0 and (selected != count or (action != 1 and action != 3))) @panic("missing compiled font registration");
|
|
67
|
+
return .{ .status = status, .selected = if (selected == std.math.maxInt(u32)) null else selected, .action = action };
|
|
68
|
+
}
|
|
69
|
+
pub fn registryIds(runtime: anytype, scratch: *[8]u64) []const u64 {
|
|
70
|
+
for (runtime.canvas_font_entries[0..runtime.canvas_font_count], 0..) |entry, i| scratch[i] = entry.id;
|
|
71
|
+
return scratch[0..runtime.canvas_font_count];
|
|
72
|
+
}
|
|
@@ -13,11 +13,12 @@
|
|
|
13
13
|
//! present but no rebuild; a keystroke records emit without a rebuild —
|
|
14
14
|
//! so each stage keeps its own ring and sample count instead of one
|
|
15
15
|
//! row per frame. Percentiles are computed only at snapshot time
|
|
16
|
-
//! (nearest-rank over a copied,
|
|
16
|
+
//! (nearest-rank over a copied, sorted window), never in the
|
|
17
17
|
//! frame path.
|
|
18
18
|
|
|
19
19
|
const std = @import("std");
|
|
20
20
|
const runtime_clock = @import("clock.zig");
|
|
21
|
+
const snapshot = @import("snapshot_policy.zig");
|
|
21
22
|
|
|
22
23
|
/// Rolling window length per stage. 128 samples is ~2 s of 60 fps
|
|
23
24
|
/// present-side stages and a long memory for sparse stages (rebuilds),
|
|
@@ -78,12 +79,12 @@ pub const FrameProfileStageStats = struct {
|
|
|
78
79
|
};
|
|
79
80
|
|
|
80
81
|
/// The profile state itself: one bool gate plus per-stage rings. Lives
|
|
81
|
-
/// by value on the Runtime
|
|
82
|
-
/// default-copy covers it.
|
|
82
|
+
/// by value on the Runtime and initialized explicitly by `Runtime.initAt`.
|
|
83
83
|
pub const FrameProfile = struct {
|
|
84
84
|
/// The runtime toggle (`native automate profile on|off`). Every
|
|
85
85
|
/// stamp site checks this before reading the clock.
|
|
86
86
|
enabled: bool = false,
|
|
87
|
+
policy: snapshot.Policy = null,
|
|
87
88
|
lens: [frame_profile_stage_count]u16 = @splat(0),
|
|
88
89
|
heads: [frame_profile_stage_count]u16 = @splat(0),
|
|
89
90
|
totals: [frame_profile_stage_count]u64 = @splat(0),
|
|
@@ -102,7 +103,8 @@ pub const FrameProfile = struct {
|
|
|
102
103
|
pub inline fn end(self: *FrameProfile, stage: FrameProfileStage, begin_ns: u64) void {
|
|
103
104
|
if (begin_ns == 0) return;
|
|
104
105
|
const now = runtime_clock.monotonicNanoseconds();
|
|
105
|
-
self.
|
|
106
|
+
const elapsed = snapshot.plan(self.policy, .elapsed, .{ .words = .{ begin_ns, now, 0, 0, 0, 0, 0, 0 } });
|
|
107
|
+
self.recordNs(stage, elapsed.words[0]);
|
|
106
108
|
}
|
|
107
109
|
|
|
108
110
|
/// Record an externally measured duration (host-stamped decode/draw
|
|
@@ -110,28 +112,27 @@ pub const FrameProfile = struct {
|
|
|
110
112
|
pub fn recordNs(self: *FrameProfile, stage: FrameProfileStage, elapsed_ns: u64) void {
|
|
111
113
|
if (!self.enabled) return;
|
|
112
114
|
const index = @intFromEnum(stage);
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
self.
|
|
116
|
-
self.heads[index] = @intCast(
|
|
117
|
-
|
|
118
|
-
self.totals[index] +%= 1;
|
|
115
|
+
const projection = snapshot.plan(self.policy, .record, .{ .flags = 1, .words = .{ elapsed_ns, self.lens[index], self.heads[index], self.totals[index], 0, 0, 0, 0 } });
|
|
116
|
+
self.samples_us[index][self.heads[index]] = @intCast(projection.words[3]);
|
|
117
|
+
self.lens[index] = @intCast(projection.words[0]);
|
|
118
|
+
self.heads[index] = @intCast(projection.words[1]);
|
|
119
|
+
self.totals[index] = projection.words[2];
|
|
119
120
|
}
|
|
120
121
|
|
|
121
122
|
/// Drop every recorded sample (enable state is left alone).
|
|
122
123
|
pub fn reset(self: *FrameProfile) void {
|
|
123
|
-
self.
|
|
124
|
-
self.
|
|
125
|
-
self.
|
|
124
|
+
const projection = snapshot.plan(self.policy, .reset, .{});
|
|
125
|
+
self.lens = @splat(@intCast(projection.words[0]));
|
|
126
|
+
self.heads = @splat(@intCast(projection.words[1]));
|
|
127
|
+
self.totals = @splat(projection.words[2]);
|
|
126
128
|
}
|
|
127
129
|
|
|
128
130
|
/// True when any stage holds samples — the snapshot's "print the
|
|
129
131
|
/// frame_profile line at all" gate.
|
|
130
132
|
pub fn hasSamples(self: *const FrameProfile) bool {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
return false;
|
|
133
|
+
var lengths: [frame_profile_stage_count]u32 = undefined;
|
|
134
|
+
for (self.lens, &lengths) |len, *slot| slot.* = len;
|
|
135
|
+
return snapshot.plan(self.policy, .has_samples, .{ .samples = &lengths }).flags != 0;
|
|
135
136
|
}
|
|
136
137
|
|
|
137
138
|
/// Percentiles for one stage over its current window. Copies and
|
|
@@ -140,25 +141,15 @@ pub const FrameProfile = struct {
|
|
|
140
141
|
pub fn stats(self: *const FrameProfile, stage: FrameProfileStage) FrameProfileStageStats {
|
|
141
142
|
const index = @intFromEnum(stage);
|
|
142
143
|
const len: usize = self.lens[index];
|
|
143
|
-
|
|
144
|
-
var sorted: [max_frame_profile_samples]u32 = undefined;
|
|
145
|
-
@memcpy(sorted[0..len], self.samples_us[index][0..len]);
|
|
146
|
-
std.sort.pdq(u32, sorted[0..len], {}, std.sort.asc(u32));
|
|
144
|
+
const projection = snapshot.plan(self.policy, .stats, .{ .words = .{ len, self.totals[index], 0, 0, 0, 0, 0, 0 }, .samples = self.samples_us[index][0..len] });
|
|
147
145
|
return .{
|
|
148
|
-
.p50_us =
|
|
149
|
-
.p90_us =
|
|
150
|
-
.max_us =
|
|
151
|
-
.window_len =
|
|
152
|
-
.total =
|
|
146
|
+
.p50_us = projection.words[2],
|
|
147
|
+
.p90_us = projection.words[3],
|
|
148
|
+
.max_us = projection.words[4],
|
|
149
|
+
.window_len = @intCast(projection.words[0]),
|
|
150
|
+
.total = projection.words[1],
|
|
153
151
|
};
|
|
154
152
|
}
|
|
155
|
-
|
|
156
|
-
/// Nearest-rank percentile index (ceil(p/100 * n), 1-based rank →
|
|
157
|
-
/// 0-based index) — the same convention the perf harness gates on.
|
|
158
|
-
fn nearestRank(len: usize, percentile: usize) usize {
|
|
159
|
-
const rank = (len * percentile + 99) / 100;
|
|
160
|
-
return @max(rank, 1) - 1;
|
|
161
|
-
}
|
|
162
153
|
};
|
|
163
154
|
|
|
164
155
|
test "frame profile is inert while disabled" {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const composition = @import("input_composition_policy.zig");
|
|
1
2
|
const std = @import("std");
|
|
2
3
|
const canvas = @import("canvas");
|
|
3
4
|
const runtime_view = @import("view.zig");
|
|
@@ -18,6 +19,24 @@ const sizesEqual = canvas_frame_helpers.sizesEqual;
|
|
|
18
19
|
|
|
19
20
|
pub fn RuntimeGpuSurfaceEvents(comptime Runtime: type) type {
|
|
20
21
|
return struct {
|
|
22
|
+
const CompositionFacts = struct {
|
|
23
|
+
dismissed: bool = false,
|
|
24
|
+
composition_keys: bool = false,
|
|
25
|
+
claimed: bool = false,
|
|
26
|
+
latch: ?bool = null,
|
|
27
|
+
routed_id: u64 = 0,
|
|
28
|
+
};
|
|
29
|
+
fn inputPlan(self: *const Runtime, mode: composition.Mode, input: platform.GpuSurfaceInputEvent, extra: CompositionFacts) ?composition.Program {
|
|
30
|
+
const index = runtimeFindViewIndex(self, input.window_id, input.label) orelse return null;
|
|
31
|
+
const view = &self.views[index];
|
|
32
|
+
var facts = if (mode == .normalize) composition.Facts{} else composition.observations(self, view);
|
|
33
|
+
facts.dismissed = extra.dismissed;
|
|
34
|
+
facts.composition_keys = extra.composition_keys;
|
|
35
|
+
facts.claimed = extra.claimed;
|
|
36
|
+
facts.routed_id = extra.routed_id;
|
|
37
|
+
if (extra.latch) |value| facts.latch = value;
|
|
38
|
+
return composition.plan(view.canvas_widget_surface_scope_policy, mode, input, facts);
|
|
39
|
+
}
|
|
21
40
|
pub fn dispatchGpuSurfaceFrame(self: *Runtime, app: runtime_api.App(Runtime), frame_event: platform.GpuSurfaceFrameEvent) anyerror!void {
|
|
22
41
|
// Media-surface adoption rides the compositor's
|
|
23
42
|
// presented-frame clock: staged producer frames (latest
|
|
@@ -226,13 +245,6 @@ pub fn RuntimeGpuSurfaceEvents(comptime Runtime: type) type {
|
|
|
226
245
|
// a right-drag (the mouseenter/mouseleave
|
|
227
246
|
// convention), exactly as the wash does for the
|
|
228
247
|
// same journaled moves.
|
|
229
|
-
if (input_event.kind == .pointer_cancel and
|
|
230
|
-
self.views[index].canvas_widget_hover_pointer_live and
|
|
231
|
-
self.views[index].canvas_widget_hover_pointer_id == input_event.pointer_id)
|
|
232
|
-
{
|
|
233
|
-
self.views[index].canvas_widget_hover_msg_chain_len = 0;
|
|
234
|
-
self.views[index].canvas_widget_hover_pointer_live = false;
|
|
235
|
-
}
|
|
236
248
|
// A consumed secondary RELEASE outside the view is
|
|
237
249
|
// the gesture ending with the pointer already gone —
|
|
238
250
|
// hosts hold an implicit grab through a right-drag,
|
|
@@ -240,14 +252,7 @@ pub fn RuntimeGpuSurfaceEvents(comptime Runtime: type) type {
|
|
|
240
252
|
// re-entry: retire containment like the cancel
|
|
241
253
|
// above, matching the primary path whose outside
|
|
242
254
|
// release re-hit-tests to nothing.
|
|
243
|
-
|
|
244
|
-
self.views[index].canvas_widget_hover_pointer_live and
|
|
245
|
-
self.views[index].canvas_widget_hover_pointer_id == input_event.pointer_id and
|
|
246
|
-
!gpuViewContainsPoint(&self.views[index], input_event.x, input_event.y))
|
|
247
|
-
{
|
|
248
|
-
self.views[index].canvas_widget_hover_msg_chain_len = 0;
|
|
249
|
-
self.views[index].canvas_widget_hover_pointer_live = false;
|
|
250
|
-
}
|
|
255
|
+
CanvasWidgetEventMethods().retireCanvasWidgetHoverForConsumedPointer(&self.views[index], input_event, gpuViewContainsPoint(&self.views[index], input_event.x, input_event.y));
|
|
251
256
|
}
|
|
252
257
|
// The whole consumed stream still feeds the tooltip
|
|
253
258
|
// intent choke point: every pointer-carrying event
|
|
@@ -383,7 +388,7 @@ pub fn RuntimeGpuSurfaceEvents(comptime Runtime: type) type {
|
|
|
383
388
|
// it belongs to is still open. Chorded keys stay live —
|
|
384
389
|
// input methods never consume command chords, so those are
|
|
385
390
|
// genuine shortcuts even mid-composition.
|
|
386
|
-
const targetless_composition_owns_keys = (input_event.kind == .key_down or input_event.kind == .key_up) and
|
|
391
|
+
const targetless_composition_owns_keys = if (inputPlan(self, .keys, input_event, .{})) |program| program.has(4) else (input_event.kind == .key_down or input_event.kind == .key_up) and
|
|
387
392
|
!canvas_frame_helpers.gpuInputHasTextCommandModifier(input_event) and
|
|
388
393
|
self.targetless_ime_preedit_len > 0 and
|
|
389
394
|
self.targetless_ime_preedit_window == input_event.window_id and
|
|
@@ -504,7 +509,13 @@ pub fn RuntimeGpuSurfaceEvents(comptime Runtime: type) type {
|
|
|
504
509
|
// routing its commit or cancel to the newly focused editor
|
|
505
510
|
// would resolve a composition that editor never saw, and the
|
|
506
511
|
// target-less consumer's composed text would be lost.
|
|
507
|
-
const
|
|
512
|
+
const compiled_resolution = inputPlan(self, .resolve, input_event, .{ .dismissed = widget_surface_dismissed });
|
|
513
|
+
if (compiled_resolution) |program| {
|
|
514
|
+
const index = runtimeFindViewIndex(self, input_event.window_id, input_event.label).?;
|
|
515
|
+
composition.installWidget(&self.views[index], program);
|
|
516
|
+
if (program.has(2048)) self.targetless_ime_commit_grace = false;
|
|
517
|
+
}
|
|
518
|
+
const ime_continuation_owned_targetless = if (compiled_resolution) |program| program.has(8) else switch (input_event.kind) {
|
|
508
519
|
.ime_set_composition, .ime_commit_composition, .ime_cancel_composition => self.targetless_ime_preedit_len > 0 and
|
|
509
520
|
self.targetless_ime_preedit_window == input_event.window_id and
|
|
510
521
|
std.mem.eql(
|
|
@@ -520,7 +531,7 @@ pub fn RuntimeGpuSurfaceEvents(comptime Runtime: type) type {
|
|
|
520
531
|
// to the cancelled sequence; any other event disarms the
|
|
521
532
|
// grace (a plain Escape cancel is chased by its own
|
|
522
533
|
// key_down, so ordinary typing never inherits it).
|
|
523
|
-
const ime_grace: runtime_view.ImeCommitGrace = grace: {
|
|
534
|
+
const ime_grace: runtime_view.ImeCommitGrace = if (compiled_resolution) |program| if (program.has(32)) .swallow else .none else grace: {
|
|
524
535
|
const index = runtimeFindViewIndex(self, input_event.window_id, input_event.label) orelse break :grace .none;
|
|
525
536
|
if (self.views[index].kind != .gpu_surface) break :grace .none;
|
|
526
537
|
const armed = self.views[index].canvas_widget_ime_commit_grace;
|
|
@@ -564,7 +575,7 @@ pub fn RuntimeGpuSurfaceEvents(comptime Runtime: type) type {
|
|
|
564
575
|
// still open) and clears only when its commit or cancel
|
|
565
576
|
// closes it; an orphaned cancel arms the swallow grace so a
|
|
566
577
|
// converted commit's trailing text_input is swallowed too.
|
|
567
|
-
const ime_widget_owner_orphaned = switch (input_event.kind) {
|
|
578
|
+
const ime_widget_owner_orphaned = if (compiled_resolution) |program| program.has(16) else switch (input_event.kind) {
|
|
568
579
|
.ime_set_composition, .ime_commit_composition, .ime_cancel_composition => blk: {
|
|
569
580
|
const index = runtimeFindViewIndex(self, input_event.window_id, input_event.label) orelse break :blk false;
|
|
570
581
|
if (self.views[index].kind != .gpu_surface) break :blk false;
|
|
@@ -593,7 +604,7 @@ pub fn RuntimeGpuSurfaceEvents(comptime Runtime: type) type {
|
|
|
593
604
|
// composition's converted commit — it delivers TARGET-LESS
|
|
594
605
|
// on the owning surface, never into whichever text widget
|
|
595
606
|
// holds focus by now. One-shot: any other event disarms.
|
|
596
|
-
const targetless_commit_grace = grace: {
|
|
607
|
+
const targetless_commit_grace = if (compiled_resolution) |program| program.has(64) else grace: {
|
|
597
608
|
if (!self.targetless_ime_commit_grace) break :grace false;
|
|
598
609
|
self.targetless_ime_commit_grace = false;
|
|
599
610
|
break :grace input_event.kind == .text_input and
|
|
@@ -626,7 +637,9 @@ pub fn RuntimeGpuSurfaceEvents(comptime Runtime: type) type {
|
|
|
626
637
|
// releases the pin instead when anything else follows a
|
|
627
638
|
// plain cancel).
|
|
628
639
|
if (runtimeFindViewIndex(self, input_event.window_id, input_event.label)) |index| {
|
|
629
|
-
|
|
640
|
+
if (inputPlan(self, .routed, input_event, .{ .routed_id = text_input_event.keyboard.focused_id orelse 0 })) |program| {
|
|
641
|
+
composition.installWidget(&self.views[index], program);
|
|
642
|
+
} else switch (input_event.kind) {
|
|
630
643
|
.ime_set_composition => self.views[index].canvas_widget_ime_owner_id =
|
|
631
644
|
text_input_event.keyboard.focused_id orelse 0,
|
|
632
645
|
// Arm ONLY while an owner is pinned: a cancel of
|
|
@@ -654,6 +667,18 @@ pub fn RuntimeGpuSurfaceEvents(comptime Runtime: type) type {
|
|
|
654
667
|
// through `on_text`.
|
|
655
668
|
const committed_text_claimed = blk: {
|
|
656
669
|
const index = runtimeFindViewIndex(self, input_event.window_id, input_event.label) orelse break :blk false;
|
|
670
|
+
if (inputPlan(self, .claim, input_event, .{ .composition_keys = targetless_composition_owns_keys })) |split| {
|
|
671
|
+
// The first stage preserves short-circuiting: a carried
|
|
672
|
+
// claim needs no focused-widget intent observation.
|
|
673
|
+
if (split.has(256) or targetless_composition_owns_keys) {
|
|
674
|
+
composition.installWidget(&self.views[index], split);
|
|
675
|
+
break :blk split.has(256);
|
|
676
|
+
}
|
|
677
|
+
const claimed = targetlessCommittedTextClaimedByFocusedWidget(self, index, input_event);
|
|
678
|
+
const program = inputPlan(self, .claim, input_event, .{ .claimed = claimed }).?;
|
|
679
|
+
composition.installWidget(&self.views[index], program);
|
|
680
|
+
break :blk program.has(256);
|
|
681
|
+
}
|
|
657
682
|
// Consume the split-event claim carry first: hosts that
|
|
658
683
|
// deliver the claimed key_down and its committed text as
|
|
659
684
|
// SEPARATE events would otherwise recompute the claim
|
|
@@ -787,7 +812,7 @@ pub fn RuntimeGpuSurfaceEvents(comptime Runtime: type) type {
|
|
|
787
812
|
// composition keys at the source, so a key_down
|
|
788
813
|
// arriving after the resolution is a genuine
|
|
789
814
|
// keystroke on every host and always flows.
|
|
790
|
-
if (self.views[index].kind == .gpu_surface and self.views[index].focused and !targetless_composition_owns_keys) {
|
|
815
|
+
if (if (inputPlan(self, .key_delivery, input_event, .{ .composition_keys = targetless_composition_owns_keys })) |program| program.has(4096) else self.views[index].kind == .gpu_surface and self.views[index].focused and !targetless_composition_owns_keys) {
|
|
791
816
|
// Target-less, but the FOCUSED widget's id still
|
|
792
817
|
// rides along (0 = nothing focused): consumers
|
|
793
818
|
// that own focused input without editor state —
|
|
@@ -802,7 +827,7 @@ pub fn RuntimeGpuSurfaceEvents(comptime Runtime: type) type {
|
|
|
802
827
|
.focused_id = if (focused_id != 0) focused_id else null,
|
|
803
828
|
.key = input_event.key,
|
|
804
829
|
.text = input_event.text,
|
|
805
|
-
.modifiers = canvas_frame_helpers.canvasWidgetKeyboardModifiers(input_event.modifiers),
|
|
830
|
+
.modifiers = if (inputPlan(self, .normalize, input_event, .{})) |program| program.keyboardModifiers() else canvas_frame_helpers.canvasWidgetKeyboardModifiers(input_event.modifiers),
|
|
806
831
|
},
|
|
807
832
|
} });
|
|
808
833
|
}
|
|
@@ -835,7 +860,36 @@ pub fn RuntimeGpuSurfaceEvents(comptime Runtime: type) type {
|
|
|
835
860
|
self.targetless_ime_preedit_label[0..self.targetless_ime_preedit_label_len],
|
|
836
861
|
input_event.label,
|
|
837
862
|
);
|
|
838
|
-
const committed: ?[]const u8 =
|
|
863
|
+
const committed: ?[]const u8 = if (inputPlan(self, .fallback, input_event, .{})) |program| compiled: {
|
|
864
|
+
const text = switch (program.source) {
|
|
865
|
+
0 => "",
|
|
866
|
+
1 => input_event.text,
|
|
867
|
+
2 => self.targetless_ime_preedit[0..self.targetless_ime_preedit_len],
|
|
868
|
+
3 => {
|
|
869
|
+
var accepted = true;
|
|
870
|
+
if (input_event.text.len > self.targetless_ime_preedit.len) {
|
|
871
|
+
if (self.owned_allocator.realloc(self.targetless_ime_preedit, input_event.text.len)) |grown| {
|
|
872
|
+
self.targetless_ime_preedit = grown;
|
|
873
|
+
} else |_| accepted = false;
|
|
874
|
+
}
|
|
875
|
+
const installed = inputPlan(self, .buffer, input_event, .{ .claimed = accepted }).?;
|
|
876
|
+
if (installed.has(512)) self.targetless_ime_preedit_len = 0;
|
|
877
|
+
if (installed.has(1024)) {
|
|
878
|
+
@memcpy(self.targetless_ime_preedit[0..input_event.text.len], input_event.text);
|
|
879
|
+
self.targetless_ime_preedit_len = input_event.text.len;
|
|
880
|
+
self.targetless_ime_preedit_window = input_event.window_id;
|
|
881
|
+
const label_len = @min(input_event.label.len, self.targetless_ime_preedit_label.len);
|
|
882
|
+
@memcpy(self.targetless_ime_preedit_label[0..label_len], input_event.label[0..label_len]);
|
|
883
|
+
self.targetless_ime_preedit_label_len = label_len;
|
|
884
|
+
}
|
|
885
|
+
break :compiled null;
|
|
886
|
+
},
|
|
887
|
+
else => unreachable,
|
|
888
|
+
};
|
|
889
|
+
if (program.has(512)) self.targetless_ime_preedit_len = 0;
|
|
890
|
+
if (program.has(16384)) self.targetless_ime_commit_grace = true;
|
|
891
|
+
break :compiled if (text.len > 0) text else null;
|
|
892
|
+
} else switch (input_event.kind) {
|
|
839
893
|
.text_input => blk: {
|
|
840
894
|
// A command-chorded text event is a SHORTCUT, not
|
|
841
895
|
// typing — the same gate the focused-widget text
|
|
@@ -930,9 +984,11 @@ pub fn RuntimeGpuSurfaceEvents(comptime Runtime: type) type {
|
|
|
930
984
|
input_event.kind == .ime_commit_composition;
|
|
931
985
|
if (committed) |text| {
|
|
932
986
|
if (runtimeFindViewIndex(self, input_event.window_id, input_event.label)) |index| {
|
|
933
|
-
if (self.
|
|
934
|
-
(
|
|
935
|
-
|
|
987
|
+
const deliver = if (inputPlan(self, .delivery, input_event, .{ .claimed = committed_text_claimed, .latch = ime_resolution })) |program|
|
|
988
|
+
program.has(4096)
|
|
989
|
+
else
|
|
990
|
+
self.views[index].kind == .gpu_surface and self.views[index].focused and (!committed_text_claimed or ime_resolution);
|
|
991
|
+
if (deliver) {
|
|
936
992
|
// The focused widget's id rides the
|
|
937
993
|
// target-less event (see the key fallback
|
|
938
994
|
// above): a focused terminal resolves its
|
|
@@ -951,7 +1007,7 @@ pub fn RuntimeGpuSurfaceEvents(comptime Runtime: type) type {
|
|
|
951
1007
|
// `on_text` gate (insert_text only)
|
|
952
1008
|
// delivers it.
|
|
953
1009
|
.edit = .{ .insert_text = text },
|
|
954
|
-
.modifiers = canvas_frame_helpers.canvasWidgetKeyboardModifiers(input_event.modifiers),
|
|
1010
|
+
.modifiers = if (inputPlan(self, .normalize, input_event, .{})) |program| program.keyboardModifiers() else canvas_frame_helpers.canvasWidgetKeyboardModifiers(input_event.modifiers),
|
|
955
1011
|
},
|
|
956
1012
|
},
|
|
957
1013
|
});
|
|
@@ -1007,7 +1063,12 @@ pub fn RuntimeGpuSurfaceEvents(comptime Runtime: type) type {
|
|
|
1007
1063
|
const focused_id = self.views[index].canvas_widget_focused_id;
|
|
1008
1064
|
if (focused_id == 0) return false;
|
|
1009
1065
|
const node = self.views[index].widgetLayoutTree().findById(focused_id) orelse return false;
|
|
1010
|
-
const probe_key = if (input_event.
|
|
1066
|
+
const probe_key = if (inputPlan(self, .claim_probe, input_event, .{})) |program| switch (program.source) {
|
|
1067
|
+
0 => return false,
|
|
1068
|
+
1 => input_event.key,
|
|
1069
|
+
2 => "space",
|
|
1070
|
+
else => unreachable,
|
|
1071
|
+
} else if (input_event.key.len > 0)
|
|
1011
1072
|
input_event.key
|
|
1012
1073
|
else if (std.mem.eql(u8, input_event.text, " "))
|
|
1013
1074
|
"space"
|
|
@@ -1017,7 +1078,7 @@ pub fn RuntimeGpuSurfaceEvents(comptime Runtime: type) type {
|
|
|
1017
1078
|
.phase = .key_down,
|
|
1018
1079
|
.focused_id = focused_id,
|
|
1019
1080
|
.key = probe_key,
|
|
1020
|
-
.modifiers = canvas_frame_helpers.canvasWidgetKeyboardModifiers(input_event.modifiers),
|
|
1081
|
+
.modifiers = if (inputPlan(self, .normalize, input_event, .{})) |program| program.keyboardModifiers() else canvas_frame_helpers.canvasWidgetKeyboardModifiers(input_event.modifiers),
|
|
1021
1082
|
}) != null;
|
|
1022
1083
|
}
|
|
1023
1084
|
|
|
@@ -1121,7 +1182,8 @@ pub fn RuntimeGpuSurfaceEvents(comptime Runtime: type) type {
|
|
|
1121
1182
|
}, CanvasFrameMethods().canvasFrameScratchStorage(self), false);
|
|
1122
1183
|
const preview_render_pass = preview_frame.renderPass();
|
|
1123
1184
|
const preview_gpu_packet_summary = preview_frame.gpuPacketSummary();
|
|
1124
|
-
const
|
|
1185
|
+
const preview_encoder_counts = preview_render_pass.encoderCounts();
|
|
1186
|
+
const preview_budget_status = preview_frame.budgetStatusFromPlanningSummaries(preview_gpu_packet_summary, preview_encoder_counts);
|
|
1125
1187
|
enriched_frame_event.canvas_revision = self.views[index].canvas_revision;
|
|
1126
1188
|
enriched_frame_event.frame_interval_ns = self.views[index].gpu_frame_interval_ns;
|
|
1127
1189
|
enriched_frame_event.input_timestamp_ns = self.views[index].gpu_input_timestamp_ns;
|
|
@@ -1137,10 +1199,10 @@ pub fn RuntimeGpuSurfaceEvents(comptime Runtime: type) type {
|
|
|
1137
1199
|
enriched_frame_event.canvas_frame_requires_render = preview_frame.requiresRender();
|
|
1138
1200
|
enriched_frame_event.canvas_frame_full_repaint = preview_frame.full_repaint;
|
|
1139
1201
|
enriched_frame_event.canvas_frame_batch_count = preview_frame.batch_plan.batchCount();
|
|
1140
|
-
enriched_frame_event.canvas_frame_encoder_command_count =
|
|
1141
|
-
enriched_frame_event.canvas_frame_encoder_cache_action_count =
|
|
1142
|
-
enriched_frame_event.canvas_frame_encoder_bind_pipeline_count =
|
|
1143
|
-
enriched_frame_event.canvas_frame_encoder_draw_batch_count =
|
|
1202
|
+
enriched_frame_event.canvas_frame_encoder_command_count = preview_encoder_counts.commands;
|
|
1203
|
+
enriched_frame_event.canvas_frame_encoder_cache_action_count = preview_encoder_counts.caches;
|
|
1204
|
+
enriched_frame_event.canvas_frame_encoder_bind_pipeline_count = preview_encoder_counts.binds;
|
|
1205
|
+
enriched_frame_event.canvas_frame_encoder_draw_batch_count = preview_encoder_counts.draws;
|
|
1144
1206
|
enriched_frame_event.canvas_frame_pipeline_count = preview_frame.pipeline_cache_plan.entryCount();
|
|
1145
1207
|
enriched_frame_event.canvas_frame_pipeline_upload_count = preview_frame.pipeline_cache_plan.uploadCount();
|
|
1146
1208
|
enriched_frame_event.canvas_frame_pipeline_retain_count = preview_frame.pipeline_cache_plan.retainCount();
|