@native-sdk/cli 0.10.1 → 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 +1796 -83
- 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/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/components/identity_tests.zig +62 -36
- package/src/tooling/components/stepper.native +24 -0
- package/src/tooling/components/stepper.zig +0 -19
- package/src/tooling/components/timeline-item.native +22 -0
- package/src/tooling/components/timeline.native +5 -3
- package/src/tooling/components/timeline_item.zig +0 -32
- package/src/tooling/eject_components.zig +76 -8
- package/src/tooling/ios.zig +66 -12
- package/src/tooling/manifest.zig +35 -0
- package/src/tooling/raw_manifest.zig +6 -0
- package/src/tooling/templates.zig +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,161 @@
|
|
|
1
|
+
//! Copied command facts and checked selections. Native retains borrowed names,
|
|
2
|
+
//! registry storage, exact OS identities, capability results and event lifetime.
|
|
3
|
+
const std = @import("std");
|
|
4
|
+
const platform = @import("../platform/root.zig");
|
|
5
|
+
const validation = @import("validation.zig");
|
|
6
|
+
const app_manifest = @import("app_manifest");
|
|
7
|
+
pub const Policy = *const fn ([]const u8, []u8) usize;
|
|
8
|
+
pub const Dispatch = enum(u8) { app, invalid, updater };
|
|
9
|
+
pub const Menu = struct { exists: bool, actionable: bool, row: ?usize, option: ?usize };
|
|
10
|
+
pub const Slot = struct { kind: enum(u8) { absent, retained, available, full }, index: ?usize };
|
|
11
|
+
|
|
12
|
+
comptime {
|
|
13
|
+
if (platform.max_views != 32 or platform.max_view_label_bytes != 64 or platform.max_tray_items != 32 or platform.max_tray_segment_options != 8 or platform.max_status_items != 8 or validation.max_command_id_bytes != 128 or !std.mem.eql(u8, platform.update_check_command, "app.check-for-updates")) @compileError("update command coordination packet limits");
|
|
14
|
+
if (app_manifest.max_commands != 256 or app_manifest.max_command_id_bytes != 128 or app_manifest.max_command_title_bytes != 128) @compileError("update command catalog packet limits");
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const Packet = struct {
|
|
18
|
+
bytes: []u8,
|
|
19
|
+
len: usize = 0,
|
|
20
|
+
fn append(self: *Packet, bytes: []const u8) void {
|
|
21
|
+
if (bytes.len > self.bytes.len - self.len) @panic("command packet capacity");
|
|
22
|
+
@memcpy(self.bytes[self.len..][0..bytes.len], bytes);
|
|
23
|
+
self.len += bytes.len;
|
|
24
|
+
}
|
|
25
|
+
fn word(self: *Packet, value: u32) void {
|
|
26
|
+
var bytes: [4]u8 = undefined;
|
|
27
|
+
std.mem.writeInt(u32, &bytes, value, .little);
|
|
28
|
+
self.append(&bytes);
|
|
29
|
+
}
|
|
30
|
+
fn identity(self: *Packet, value: u64) void {
|
|
31
|
+
var bytes: [8]u8 = undefined;
|
|
32
|
+
std.mem.writeInt(u64, &bytes, value, .little);
|
|
33
|
+
self.append(&bytes);
|
|
34
|
+
}
|
|
35
|
+
fn written(self: *const Packet) []const u8 {
|
|
36
|
+
return self.bytes[0..self.len];
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
fn read(bytes: []const u8, at: usize) u32 {
|
|
40
|
+
return std.mem.readInt(u32, bytes[at..][0..4], .little);
|
|
41
|
+
}
|
|
42
|
+
fn run(policy: Policy, request: []const u8, result: []u8) void {
|
|
43
|
+
if (policy(request, result) != result.len) @panic("invalid compiled command result size");
|
|
44
|
+
}
|
|
45
|
+
fn text(policy: Policy, operation: u8, value: []const u8, limit: usize) u8 {
|
|
46
|
+
var bytes: [136]u8 = undefined;
|
|
47
|
+
var packet = Packet{ .bytes = &bytes };
|
|
48
|
+
packet.append(&.{ 69, operation, 0, 0 });
|
|
49
|
+
packet.word(std.math.cast(u32, value.len) orelse std.math.maxInt(u32));
|
|
50
|
+
packet.append(value[0..@min(value.len, limit)]);
|
|
51
|
+
var result: [4]u8 = undefined;
|
|
52
|
+
run(policy, packet.written(), &result);
|
|
53
|
+
if (!std.mem.eql(u8, result[1..], &.{ 0, 0, 0 })) @panic("invalid compiled command reserved bytes");
|
|
54
|
+
return result[0];
|
|
55
|
+
}
|
|
56
|
+
pub fn dispatch(policy: Policy, name: []const u8) Dispatch {
|
|
57
|
+
return std.enums.fromInt(Dispatch, text(policy, 0, name, 128)) orelse @panic("invalid compiled command dispatch");
|
|
58
|
+
}
|
|
59
|
+
pub fn bridgeLabel(policy: Policy, label: []const u8) []const u8 {
|
|
60
|
+
return switch (text(policy, 4, label, 64)) {
|
|
61
|
+
0 => label,
|
|
62
|
+
1 => "",
|
|
63
|
+
else => @panic("invalid compiled command label"),
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
pub fn catalog(policy: Policy, commands: []const app_manifest.Command) !void {
|
|
68
|
+
var bytes: [8 + 256 * (8 + 128 + 128)]u8 = undefined;
|
|
69
|
+
var packet = Packet{ .bytes = &bytes };
|
|
70
|
+
packet.append(&.{ 69, 5, 0, 0 });
|
|
71
|
+
packet.word(std.math.cast(u32, commands.len) orelse std.math.maxInt(u32));
|
|
72
|
+
if (commands.len <= 256) for (commands) |*command| {
|
|
73
|
+
packet.word(std.math.cast(u32, command.id.len) orelse std.math.maxInt(u32));
|
|
74
|
+
packet.word(std.math.cast(u32, command.title.len) orelse std.math.maxInt(u32));
|
|
75
|
+
packet.append(command.id[0..@min(command.id.len, 128)]);
|
|
76
|
+
packet.append(command.title[0..@min(command.title.len, 128)]);
|
|
77
|
+
};
|
|
78
|
+
var result: [4]u8 = undefined;
|
|
79
|
+
run(policy, packet.written(), &result);
|
|
80
|
+
if (!std.mem.eql(u8, result[1..], &.{ 0, 0, 0 })) @panic("invalid compiled command catalog reserved bytes");
|
|
81
|
+
return switch (result[0]) {
|
|
82
|
+
0 => {},
|
|
83
|
+
1 => error.InvalidCommand,
|
|
84
|
+
2 => error.InvalidName,
|
|
85
|
+
3 => error.DuplicateCommand,
|
|
86
|
+
else => @panic("invalid compiled command catalog admission"),
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
pub fn nativeViewSource(policy: Policy, views: anytype, window_id: platform.WindowId, label: []const u8) bool {
|
|
91
|
+
if (views.len > platform.max_views) @panic("command view capacity");
|
|
92
|
+
var bytes: [20 + 64 + platform.max_views * (16 + 128)]u8 = undefined;
|
|
93
|
+
var packet = Packet{ .bytes = &bytes };
|
|
94
|
+
packet.append(&.{ 69, 1, 0, 0 });
|
|
95
|
+
packet.word(@intCast(views.len));
|
|
96
|
+
packet.identity(window_id);
|
|
97
|
+
packet.word(std.math.cast(u32, label.len) orelse std.math.maxInt(u32));
|
|
98
|
+
packet.append(label[0..@min(label.len, 64)]);
|
|
99
|
+
// Iterate pointers: retained views contain large native widget buffers.
|
|
100
|
+
for (views) |*view| {
|
|
101
|
+
const parent = view.parent orelse "";
|
|
102
|
+
if (view.label.len > 64 or parent.len > 64) @panic("command view label capacity");
|
|
103
|
+
packet.append(&.{ @as(u8, @intFromBool(view.open)) | (@as(u8, @intFromBool(view.kind == .toolbar)) << 1) | (@as(u8, @intFromBool(view.parent != null)) << 2), @intCast(view.label.len), @intCast(parent.len), 0 });
|
|
104
|
+
packet.identity(view.window_id);
|
|
105
|
+
packet.word(0);
|
|
106
|
+
packet.append(view.label);
|
|
107
|
+
packet.append(parent);
|
|
108
|
+
}
|
|
109
|
+
var result: [4]u8 = undefined;
|
|
110
|
+
run(policy, packet.written(), &result);
|
|
111
|
+
if (!std.mem.eql(u8, result[1..], &.{ 0, 0, 0 }) or (result[0] != 3 and result[0] != 6)) @panic("invalid compiled command source");
|
|
112
|
+
return result[0] == 3;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
pub fn menu(policy: Policy, items: anytype, item_id: platform.TrayItemId) Menu {
|
|
116
|
+
if (items.len > platform.max_tray_items) @panic("command menu capacity");
|
|
117
|
+
var bytes: [12 + platform.max_tray_items * (8 + platform.max_tray_segment_options * 8)]u8 = undefined;
|
|
118
|
+
var packet = Packet{ .bytes = &bytes };
|
|
119
|
+
packet.append(&.{ 69, 2, 0, 0 });
|
|
120
|
+
packet.word(@intCast(items.len));
|
|
121
|
+
packet.word(item_id);
|
|
122
|
+
for (items) |*item| {
|
|
123
|
+
const options: []const platform.TraySegmentOption = if (item.segmented) |segment| segment.options else &.{};
|
|
124
|
+
if (options.len > platform.max_tray_segment_options) @panic("command segment capacity");
|
|
125
|
+
packet.word(item.id);
|
|
126
|
+
packet.append(&.{ @as(u8, @intFromBool(item.separator)) | (@as(u8, @intFromBool(item.enabled)) << 1) | (@as(u8, @intFromBool(item.role == .command or item.role == .agent)) << 2) | (@as(u8, @intFromBool(item.command.len > 0)) << 3), @intCast(options.len), 0, 0 });
|
|
127
|
+
for (options) |option| {
|
|
128
|
+
packet.word(option.id);
|
|
129
|
+
packet.append(&.{ @intFromBool(option.enabled), 0, 0, 0 });
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
var result: [16]u8 = undefined;
|
|
133
|
+
run(policy, packet.written(), &result);
|
|
134
|
+
const row = read(&result, 4);
|
|
135
|
+
const option = read(&result, 8);
|
|
136
|
+
if (result[0] > 1 or result[1] > 1 or result[2] != 0 or result[3] != 0 or read(&result, 12) != 0) @panic("invalid compiled command menu flags");
|
|
137
|
+
if (row != std.math.maxInt(u32)) {
|
|
138
|
+
if (row >= items.len) @panic("invalid compiled command menu row");
|
|
139
|
+
if (option != std.math.maxInt(u32) and (items[row].segmented == null or option >= items[row].segmented.?.options.len)) @panic("invalid compiled command menu option");
|
|
140
|
+
} else if (option != std.math.maxInt(u32)) @panic("invalid compiled command menu fallback");
|
|
141
|
+
return .{ .exists = result[0] == 1, .actionable = result[1] == 1, .row = if (row == std.math.maxInt(u32)) null else row, .option = if (option == std.math.maxInt(u32)) null else option };
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
pub fn slot(policy: Policy, slots: anytype, id: platform.StatusItemId, admit: bool, count: usize) Slot {
|
|
145
|
+
if (slots.len != 8 or count > 8) @panic("command status capacity");
|
|
146
|
+
var bytes: [80]u8 = undefined;
|
|
147
|
+
var packet = Packet{ .bytes = &bytes };
|
|
148
|
+
packet.append(&.{ 69, 3, 0, 0 });
|
|
149
|
+
packet.word(@intFromBool(admit));
|
|
150
|
+
packet.word(id);
|
|
151
|
+
packet.word(@intCast(count));
|
|
152
|
+
for (slots) |*entry| {
|
|
153
|
+
packet.append(&.{ @intFromBool(entry.active), 0, 0, 0 });
|
|
154
|
+
packet.word(entry.id);
|
|
155
|
+
}
|
|
156
|
+
var result: [8]u8 = undefined;
|
|
157
|
+
run(policy, packet.written(), &result);
|
|
158
|
+
const index = read(&result, 4);
|
|
159
|
+
if (result[0] > 3 or !std.mem.eql(u8, result[1..4], &.{ 0, 0, 0 }) or ((result[0] == 1 or result[0] == 2) != (index < slots.len)) or (index >= slots.len and index != std.math.maxInt(u32))) @panic("invalid compiled command status selection");
|
|
160
|
+
return .{ .kind = @enumFromInt(result[0]), .index = if (index == std.math.maxInt(u32)) null else index };
|
|
161
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
//! Portable menu and scroll plans; native owns payloads, pins and latch storage.
|
|
2
|
+
const std = @import("std");
|
|
3
|
+
const canvas = @import("canvas");
|
|
4
|
+
pub const Policy = ?*const fn ([]const u8, []u8) usize;
|
|
5
|
+
pub const Stage = enum(u8) { shown_count, pin_owner, rebuild_arena, release_window, dismiss_token, restore_tree, selection_begin, selection_item, missing_tree, fallback_label, fallback_dismiss, fallback_item, fallback_dispatch, fallback_vanished, rebuild_views, scroll_rebuild };
|
|
6
|
+
pub const Plan = [16]u8;
|
|
7
|
+
pub fn request(stage: Stage, a: bool, b: bool, c: bool, x: u64, y: u64) [32]u8 {
|
|
8
|
+
var bytes: [32]u8 = @splat(0);
|
|
9
|
+
bytes[0..5].* = .{ 22, @intFromEnum(stage), @intFromBool(a), @intFromBool(b), @intFromBool(c) };
|
|
10
|
+
std.mem.writeInt(u64, bytes[8..16], x, .little);
|
|
11
|
+
std.mem.writeInt(u64, bytes[16..24], y, .little);
|
|
12
|
+
return bytes;
|
|
13
|
+
}
|
|
14
|
+
pub fn plan(policy: Policy, stage: Stage, a: bool, b: bool, c: bool, x: u64, y: u64) Plan {
|
|
15
|
+
const bytes = request(stage, a, b, c, x, y);
|
|
16
|
+
if (policy) |callback| {
|
|
17
|
+
var result: Plan = undefined;
|
|
18
|
+
if (callback(&bytes, &result) != result.len) @panic("invalid compiled component plan size");
|
|
19
|
+
const ceiling: u8 = switch (stage) {
|
|
20
|
+
.pin_owner, .selection_item, .fallback_dispatch => 2,
|
|
21
|
+
.selection_begin => 3,
|
|
22
|
+
else => 1,
|
|
23
|
+
};
|
|
24
|
+
if (result[0] > ceiling or !std.mem.allEqual(u8, result[1..8], 0)) @panic("invalid compiled component action");
|
|
25
|
+
if (stage != .shown_count and !std.mem.allEqual(u8, result[8..], 0)) @panic("invalid compiled component count");
|
|
26
|
+
if (stage == .shown_count and (result[0] != 0 or std.mem.readInt(u64, result[8..16], .little) > @min(x, y))) @panic("invalid compiled menu count");
|
|
27
|
+
return result;
|
|
28
|
+
}
|
|
29
|
+
return reference(stage, a, b, c, x, y);
|
|
30
|
+
}
|
|
31
|
+
pub fn reference(stage: Stage, a: bool, b: bool, c: bool, x: u64, y: u64) Plan {
|
|
32
|
+
var result: Plan = @splat(0);
|
|
33
|
+
result[0] = switch (stage) {
|
|
34
|
+
.shown_count => 0,
|
|
35
|
+
.pin_owner => if (a) 1 else if (b) 2 else 0,
|
|
36
|
+
.rebuild_arena => @intFromBool(a and b and c),
|
|
37
|
+
.release_window => @intFromBool(a and b and c),
|
|
38
|
+
.dismiss_token => @intFromBool(a and b),
|
|
39
|
+
.restore_tree => @intFromBool(a and (b or c)),
|
|
40
|
+
.selection_begin => @as(u8, @intFromBool(a)) | (@as(u8, @intFromBool(b and c)) << 1),
|
|
41
|
+
.selection_item => if (a and b) 1 else 2,
|
|
42
|
+
.missing_tree => @intFromBool(a),
|
|
43
|
+
.fallback_label => @intFromBool(a and b),
|
|
44
|
+
.fallback_dismiss => @intFromBool(a and b and c),
|
|
45
|
+
.fallback_item => @intFromBool(a and b and c),
|
|
46
|
+
.fallback_dispatch => if (a) 1 else 2,
|
|
47
|
+
.fallback_vanished => @intFromBool(a and !b),
|
|
48
|
+
.rebuild_views => @intFromBool(a),
|
|
49
|
+
.scroll_rebuild => @intFromBool(!a and b and c and x != 0),
|
|
50
|
+
};
|
|
51
|
+
if (stage == .shown_count) std.mem.writeInt(u64, result[8..16], @min(x, y), .little);
|
|
52
|
+
return result;
|
|
53
|
+
}
|
|
54
|
+
pub const Reach = struct { horizontal: bool, action: enum(u8) { none, clear, store } };
|
|
55
|
+
pub fn reachRequest(start: bool, id_present: bool, scroll: canvas.ScrollState, vertical_fired: bool, horizontal_fired: bool) [32]u8 {
|
|
56
|
+
var bytes: [32]u8 = @splat(0);
|
|
57
|
+
bytes[0..6].* = .{ 23, @intFromBool(start), @intFromBool(id_present), @intFromBool(vertical_fired), @intFromBool(horizontal_fired), 0 };
|
|
58
|
+
const v = scroll.axis(.vertical);
|
|
59
|
+
const h = scroll.axis(.horizontal);
|
|
60
|
+
const values = [_]f32{ v.offset, v.viewport_extent, v.content_extent, h.offset, h.viewport_extent, h.content_extent };
|
|
61
|
+
for (values, 0..) |value, i| std.mem.writeInt(u32, bytes[8 + i * 4 ..][0..4], @bitCast(value), .little);
|
|
62
|
+
return bytes;
|
|
63
|
+
}
|
|
64
|
+
pub fn reach(policy: Policy, start: bool, id_present: bool, scroll: canvas.ScrollState, vertical_fired: bool, horizontal_fired: bool) Reach {
|
|
65
|
+
if (policy) |callback| {
|
|
66
|
+
const bytes = reachRequest(start, id_present, scroll, vertical_fired, horizontal_fired);
|
|
67
|
+
var result: [8]u8 = undefined;
|
|
68
|
+
if (callback(&bytes, &result) != result.len or result[0] > 1 or result[1] > 2 or !std.mem.allEqual(u8, result[2..], 0)) @panic("invalid compiled reach plan");
|
|
69
|
+
return .{ .horizontal = result[0] != 0, .action = @enumFromInt(result[1]) };
|
|
70
|
+
}
|
|
71
|
+
return reachReference(start, id_present, scroll, vertical_fired, horizontal_fired);
|
|
72
|
+
}
|
|
73
|
+
pub fn reachReference(start: bool, id_present: bool, scroll: canvas.ScrollState, vertical_fired: bool, horizontal_fired: bool) Reach {
|
|
74
|
+
const vertical = scroll.axis(.vertical);
|
|
75
|
+
const horizontal = scroll.axis(.horizontal);
|
|
76
|
+
const use_horizontal = !(vertical.maxOffset() > 0) and horizontal.maxOffset() > 0;
|
|
77
|
+
const axis = if (use_horizontal) horizontal else vertical;
|
|
78
|
+
var result: Reach = .{ .horizontal = use_horizontal, .action = .none };
|
|
79
|
+
if (!id_present or axis.viewport_extent <= 0) return result;
|
|
80
|
+
const remaining = if (start) axis.offset else axis.content_extent - axis.viewport_extent - axis.offset;
|
|
81
|
+
if (remaining > axis.viewport_extent * @as(f32, 1.5)) result.action = .clear else if (!(remaining > axis.viewport_extent * @as(f32, 1.0)) and !(if (use_horizontal) horizontal_fired else vertical_fired)) result.action = .store;
|
|
82
|
+
return result;
|
|
83
|
+
}
|
package/src/runtime/core.zig
CHANGED
|
@@ -27,6 +27,7 @@ const runtime_frame_profile = @import("frame_profile.zig");
|
|
|
27
27
|
const runtime_gpu_surface_events = @import("gpu_surface_events.zig");
|
|
28
28
|
const runtime_flow = @import("flow.zig");
|
|
29
29
|
const runtime_session_state = @import("session_state.zig");
|
|
30
|
+
const session_journal = @import("session_journal.zig");
|
|
30
31
|
const runtime_state = @import("state.zig");
|
|
31
32
|
const runtime_system_services = @import("system_services.zig");
|
|
32
33
|
const runtime_builtin_bridge = @import("builtin_bridge.zig");
|
|
@@ -205,6 +206,14 @@ pub const Runtime = struct {
|
|
|
205
206
|
max_image_pixel_bytes: usize = canvas_limits.max_registered_canvas_image_pixel_bytes,
|
|
206
207
|
surface: platform.Surface,
|
|
207
208
|
appearance: platform.Appearance = .{},
|
|
209
|
+
/// Synchronous OS facts queued only while replaying. One event must
|
|
210
|
+
/// consume the complete sequence before the next event can begin.
|
|
211
|
+
replay_window_chrome_active: bool = false,
|
|
212
|
+
replay_window_chrome_source: session_journal.WindowChromeSource = .native_queries,
|
|
213
|
+
replay_window_chrome_failed: bool = false,
|
|
214
|
+
replay_window_chrome: [session_journal.max_session_window_chrome_queries]session_journal.WindowChromeRecord = undefined,
|
|
215
|
+
replay_window_chrome_count: usize = 0,
|
|
216
|
+
replay_window_chrome_index: usize = 0,
|
|
208
217
|
windows: [platform.max_windows]RuntimeWindow = undefined,
|
|
209
218
|
window_count: usize = 0,
|
|
210
219
|
views: [platform.max_views]RuntimeView = undefined,
|
|
@@ -258,6 +267,27 @@ pub const Runtime = struct {
|
|
|
258
267
|
video_height: u64 = 0,
|
|
259
268
|
shell_layouts: [platform.max_windows]RuntimeShellLayout = undefined,
|
|
260
269
|
shell_layout_count: usize = 0,
|
|
270
|
+
shell_layout_policy: ?*const fn ([]const u8, []u8) usize = null,
|
|
271
|
+
view_coordination_policy: ?*const fn ([]const u8, []u8) usize = null,
|
|
272
|
+
window_lifecycle_policy: ?*const fn ([]const u8, []u8) usize = null,
|
|
273
|
+
image_registry_policy: ?*const fn ([]const u8, []u8) usize = null,
|
|
274
|
+
font_registry_policy: ?*const fn ([]const u8, []u8) usize = null,
|
|
275
|
+
shell_coordination_policy: ?*const fn ([]const u8, []u8) usize = null,
|
|
276
|
+
shell_admission_policy: ?*const fn ([]const u8, []u8) usize = null,
|
|
277
|
+
system_admission_policy: ?*const fn ([]const u8, []u8) usize = null,
|
|
278
|
+
bridge_descriptor_policy: ?*const fn ([]const u8, []u8) usize = null,
|
|
279
|
+
authorization_policy: ?*const fn ([]const u8, []u8) usize = null,
|
|
280
|
+
builtin_coordination_policy: ?*const fn ([]const u8, []u8) usize = null,
|
|
281
|
+
automation_command_policy: ?*const fn ([]const u8, []u8) usize = null,
|
|
282
|
+
automation_interaction_policy: ?*const fn ([]const u8, []u8) usize = null,
|
|
283
|
+
snapshot_policy: ?*const fn ([]const u8, []u8) usize = null,
|
|
284
|
+
host_flow_policy: ?*const fn ([]const u8, []u8) usize = null,
|
|
285
|
+
command_policy: ?*const fn ([]const u8, []u8) usize = null,
|
|
286
|
+
text_cache_policy: ?*const fn ([]const u8, []u8) usize = null,
|
|
287
|
+
render_cache_policy: ?*const fn ([]const u8, []u8) usize = null,
|
|
288
|
+
render_plan_policy: ?*const fn ([]const u8, []u8) usize = null,
|
|
289
|
+
render_override_policy: ?*const fn ([]const u8, []u8) usize = null,
|
|
290
|
+
render_damage_policy: ?*const fn ([]const u8, []u8) usize = null,
|
|
261
291
|
/// Reused by runtime-created window restoration. `Store.loadWindow`
|
|
262
292
|
/// needs the whole bounded state file plus decoded-string scratch; keep
|
|
263
293
|
/// that 64-KiB workspace on the already heap-owned Runtime instead of
|
|
@@ -523,6 +553,15 @@ pub const Runtime = struct {
|
|
|
523
553
|
// The profile rings exceed the small-default copy bound above;
|
|
524
554
|
// assign explicitly so the disabled state is never undefined.
|
|
525
555
|
self.frame_profile = .{};
|
|
556
|
+
// Status rows exceed the small-default copy bound. Initialize their
|
|
557
|
+
// ownership metadata without touching unused menu payload buffers.
|
|
558
|
+
for (&self.status_items) |*item| {
|
|
559
|
+
item.id = 0;
|
|
560
|
+
item.active = false;
|
|
561
|
+
item.visible = true;
|
|
562
|
+
item.title = "";
|
|
563
|
+
item.item_count = 0;
|
|
564
|
+
}
|
|
526
565
|
self.started_timestamp_ns = timestampToU64(nowNanoseconds());
|
|
527
566
|
self.text_measure_provider = if (options.platform.services.measure_text_fn) |measure_fn|
|
|
528
567
|
.{
|
|
@@ -691,6 +730,7 @@ pub const Runtime = struct {
|
|
|
691
730
|
pub const listWindows = WindowViewMethods.listWindows;
|
|
692
731
|
pub const focusWindow = WindowViewMethods.focusWindow;
|
|
693
732
|
pub const closeWindow = WindowViewMethods.closeWindow;
|
|
733
|
+
pub const restoreWindowCapabilityResult = WindowViewMethods.restoreWindowCapabilityResult;
|
|
694
734
|
pub const minimizeWindow = WindowViewMethods.minimizeWindow;
|
|
695
735
|
pub const hideWindow = WindowViewMethods.hideWindow;
|
|
696
736
|
pub const showWindow = WindowViewMethods.showWindow;
|
|
@@ -846,6 +886,14 @@ pub const Runtime = struct {
|
|
|
846
886
|
/// pointers are stable for the runtime's lifetime and tokens stamped
|
|
847
887
|
/// with them compare equal frame to frame.
|
|
848
888
|
pub fn textMeasureProvider(self: *const Runtime) ?*const canvas.TextMeasureProvider {
|
|
889
|
+
if (self.font_registry_policy) |policy| {
|
|
890
|
+
const choice = @import("font_registry_policy.zig").plan(policy, .provider, &.{}, self.canvas_font_count, .{ .facts = @intFromBool(self.text_measure_provider != null) }).action;
|
|
891
|
+
return switch (choice) {
|
|
892
|
+
1 => if (self.text_measure_provider) |*provider| provider else unreachable,
|
|
893
|
+
2 => &self.canvas_font_measure_provider,
|
|
894
|
+
else => null,
|
|
895
|
+
};
|
|
896
|
+
}
|
|
849
897
|
if (self.text_measure_provider) |*provider| return provider;
|
|
850
898
|
if (self.canvas_font_count > 0) return &self.canvas_font_measure_provider;
|
|
851
899
|
return null;
|
|
@@ -884,6 +932,29 @@ pub const Runtime = struct {
|
|
|
884
932
|
return self.surface.safe_area_insets;
|
|
885
933
|
}
|
|
886
934
|
|
|
935
|
+
/// Query native chrome live, or consume the recorded OS result on
|
|
936
|
+
/// replay. Missing, extra and differently targeted queries diverge
|
|
937
|
+
/// loudly; replay never consults the current host for this fact.
|
|
938
|
+
pub fn windowChrome(self: *Runtime, window_id: platform.WindowId) !platform.WindowChrome {
|
|
939
|
+
if (self.replay_window_chrome_active) {
|
|
940
|
+
if (self.replay_window_chrome_source == .unavailable) return .{};
|
|
941
|
+
if (self.replay_window_chrome_index == self.replay_window_chrome_count) {
|
|
942
|
+
self.replay_window_chrome_failed = true;
|
|
943
|
+
return error.ReplayChromeDivergence;
|
|
944
|
+
}
|
|
945
|
+
const record = self.replay_window_chrome[self.replay_window_chrome_index];
|
|
946
|
+
if (record.window_id != window_id) {
|
|
947
|
+
self.replay_window_chrome_failed = true;
|
|
948
|
+
return error.ReplayChromeDivergence;
|
|
949
|
+
}
|
|
950
|
+
self.replay_window_chrome_index += 1;
|
|
951
|
+
return record.chrome;
|
|
952
|
+
}
|
|
953
|
+
const chrome = self.options.platform.services.windowChrome(window_id);
|
|
954
|
+
if (self.options.session_recorder) |recorder| recorder.recordWindowChrome(.{ .window_id = window_id, .chrome = chrome });
|
|
955
|
+
return chrome;
|
|
956
|
+
}
|
|
957
|
+
|
|
887
958
|
/// The OS window-control cluster's frame in a canvas view's LOCAL
|
|
888
959
|
/// coordinates (Windows: the DWM min/max/close buttons; macOS: the
|
|
889
960
|
/// traffic lights), from the platform's live chrome report. Zero-sized
|
|
@@ -892,9 +963,9 @@ pub const Runtime = struct {
|
|
|
892
963
|
/// view's window-content frame so a docked canvas judges the overlap
|
|
893
964
|
/// in its own space. This is the geometry `UiApp` consults to keep a
|
|
894
965
|
/// drag header's content out from under the cluster.
|
|
895
|
-
pub fn windowControlsForView(self: *
|
|
966
|
+
pub fn windowControlsForView(self: *Runtime, window_id: platform.WindowId, label: []const u8) !geometry.RectF {
|
|
896
967
|
const zero = geometry.RectF.init(0, 0, 0, 0);
|
|
897
|
-
const buttons = self.
|
|
968
|
+
const buttons = (try self.windowChrome(window_id)).buttons.normalized();
|
|
898
969
|
if (buttons.width <= 0 or buttons.height <= 0) return zero;
|
|
899
970
|
const view_frame = (self.absoluteViewFrame(window_id, label, 0) catch return buttons).normalized();
|
|
900
971
|
return geometry.RectF.init(buttons.x - view_frame.x, buttons.y - view_frame.y, buttons.width, buttons.height);
|
|
@@ -995,7 +1066,11 @@ pub const Runtime = struct {
|
|
|
995
1066
|
|
|
996
1067
|
const CanvasWidgetEventMethods = runtime_canvas_widget_events.RuntimeCanvasWidgetEvents(Runtime);
|
|
997
1068
|
pub const advanceCanvasTooltipIntentForFrame = CanvasWidgetEventMethods.advanceCanvasTooltipIntentForFrame;
|
|
1069
|
+
pub const reconcileCanvasTooltipIntent = CanvasWidgetEventMethods.reconcileCanvasTooltipIntent;
|
|
1070
|
+
pub const captureCanvasTooltipAdoptionBindings = CanvasWidgetEventMethods.captureCanvasTooltipAdoptionBindings;
|
|
1071
|
+
pub const canvasWidgetPressTargetForRoute = CanvasWidgetEventMethods.canvasWidgetPressTargetForRoute;
|
|
998
1072
|
pub const routeCanvasWidgetPointerInput = CanvasWidgetEventMethods.routeCanvasWidgetPointerInput;
|
|
1073
|
+
pub const canvasWidgetKeyboardFocusParticipation = CanvasWidgetEventMethods.canvasWidgetKeyboardFocusParticipation;
|
|
999
1074
|
pub const routeCanvasWidgetKeyboardInput = CanvasWidgetEventMethods.routeCanvasWidgetKeyboardInput;
|
|
1000
1075
|
pub const routeCanvasWidgetTextInput = CanvasWidgetEventMethods.routeCanvasWidgetTextInput;
|
|
1001
1076
|
pub const routeCanvasWidgetFileDrop = CanvasWidgetEventMethods.routeCanvasWidgetFileDrop;
|
|
@@ -1015,9 +1090,10 @@ pub const Runtime = struct {
|
|
|
1015
1090
|
const updateCanvasWidgetControlFromKeyboard = CanvasWidgetEventMethods.updateCanvasWidgetControlFromKeyboard;
|
|
1016
1091
|
const dismissCanvasWidgetSurfaceFromPointerInput = CanvasWidgetEventMethods.dismissCanvasWidgetSurfaceFromPointerInput;
|
|
1017
1092
|
const dismissCanvasWidgetSurfaceFromKeyboardInput = CanvasWidgetEventMethods.dismissCanvasWidgetSurfaceFromKeyboardInput;
|
|
1018
|
-
const
|
|
1019
|
-
const
|
|
1020
|
-
const
|
|
1093
|
+
pub const updateCanvasWidgetClickCountFromPointer = CanvasWidgetEventMethods.updateCanvasWidgetClickCountFromPointer;
|
|
1094
|
+
pub const dispatchCanvasWidgetCommandForId = CanvasWidgetEventMethods.dispatchCanvasWidgetCommandForId;
|
|
1095
|
+
pub const dispatchCanvasWidgetCommandFromPointer = CanvasWidgetEventMethods.dispatchCanvasWidgetCommandFromPointer;
|
|
1096
|
+
pub const dispatchCanvasWidgetCommandFromKeyboard = CanvasWidgetEventMethods.dispatchCanvasWidgetCommandFromKeyboard;
|
|
1021
1097
|
const updateCanvasWidgetFocusFromKeyboardInput = CanvasWidgetEventMethods.updateCanvasWidgetFocusFromKeyboardInput;
|
|
1022
1098
|
const setCanvasWidgetFocusFromKeyboard = CanvasWidgetEventMethods.setCanvasWidgetFocusFromKeyboard;
|
|
1023
1099
|
const invalidateForWidgetInvalidations = CanvasWidgetEventMethods.invalidateForWidgetInvalidations;
|
|
@@ -1029,7 +1105,7 @@ pub const Runtime = struct {
|
|
|
1029
1105
|
const dispatchGpuSurfaceInput = GpuSurfaceEventMethods.dispatchGpuSurfaceInput;
|
|
1030
1106
|
|
|
1031
1107
|
const AutomationWidgetMethods = runtime_automation_widget_dispatch.RuntimeAutomationWidgetDispatch(Runtime);
|
|
1032
|
-
const dispatchAutomationWidgetAction = AutomationWidgetMethods.dispatchAutomationWidgetAction;
|
|
1108
|
+
pub const dispatchAutomationWidgetAction = AutomationWidgetMethods.dispatchAutomationWidgetAction;
|
|
1033
1109
|
const dispatchAutomationWidgetClick = AutomationWidgetMethods.dispatchAutomationWidgetClick;
|
|
1034
1110
|
const dispatchAutomationWidgetHold = AutomationWidgetMethods.dispatchAutomationWidgetHold;
|
|
1035
1111
|
const dispatchAutomationWidgetContextPress = AutomationWidgetMethods.dispatchAutomationWidgetContextPress;
|
|
@@ -1258,6 +1334,80 @@ const testingBuiltinBridgeErrorCode = builtinBridgeErrorCode;
|
|
|
1258
1334
|
const testingBuiltinBridgeErrorMessage = builtinBridgeErrorMessage;
|
|
1259
1335
|
|
|
1260
1336
|
pub const testing = struct {
|
|
1337
|
+
pub const markup_development_policy = @import("markup_development_policy.zig");
|
|
1338
|
+
pub const markup_provenance = @import("ui_app_provenance.zig");
|
|
1339
|
+
pub const markup_provenance_reference = @import("ui_app_provenance_reference.zig");
|
|
1340
|
+
pub const host_flow_reference = @import("flow_reference.zig");
|
|
1341
|
+
pub const host_event_pump = @import("host_event_pump.zig");
|
|
1342
|
+
pub const host_event_pump_reference = @import("host_event_pump_reference.zig");
|
|
1343
|
+
pub const journal_policy = @import("journal_policy.zig");
|
|
1344
|
+
pub const blob_policy = @import("blob_policy.zig");
|
|
1345
|
+
pub const blob_reference_store = @import("session_blobs_reference.zig");
|
|
1346
|
+
pub const snapshot_policy = @import("snapshot_policy.zig");
|
|
1347
|
+
pub const frame_profile = runtime_frame_profile;
|
|
1348
|
+
pub const replay_progress_policy = @import("replay_progress_policy.zig");
|
|
1349
|
+
pub const recording_policy = @import("recording_policy.zig");
|
|
1350
|
+
pub const syncHostInputDrivers = runtime_canvas_widget_scroll_drivers.RuntimeCanvasWidgetScrollDrivers(Runtime).syncCanvasWidgetScrollDriversForView;
|
|
1351
|
+
pub const stampHostInputRegions = runtime_canvas_widget_scroll_drivers.RuntimeCanvasWidgetScrollDrivers(Runtime).stampCanvasWidgetNativeScroll;
|
|
1352
|
+
pub const syncHostInputDragRegions = runtime_canvas_widget_events.RuntimeCanvasWidgetEvents(Runtime).syncCanvasWidgetWindowDragRegionsForView;
|
|
1353
|
+
pub const host_input_regions_policy = @import("host_input_regions_policy.zig");
|
|
1354
|
+
pub const view_coordination_policy = @import("view_coordination_policy.zig");
|
|
1355
|
+
pub const view_coordination_methods = @import("window_view_runtime.zig").RuntimeWindowViewRuntime(Runtime);
|
|
1356
|
+
pub const window_lifecycle_policy = @import("window_lifecycle_policy.zig");
|
|
1357
|
+
pub const image_registry_policy = @import("image_registry_policy.zig");
|
|
1358
|
+
pub const font_registry_policy = @import("font_registry_policy.zig");
|
|
1359
|
+
pub const shell_coordination_policy = @import("shell_coordination_policy.zig");
|
|
1360
|
+
pub const shell_admission_policy = @import("shell_admission_policy.zig");
|
|
1361
|
+
pub const system_admission_policy = @import("system_admission_policy.zig");
|
|
1362
|
+
pub const bridge_descriptor_policy = @import("bridge_descriptor_policy.zig");
|
|
1363
|
+
pub const authorization_policy = @import("authorization_policy.zig");
|
|
1364
|
+
pub const automation_commands = @import("automation_commands.zig");
|
|
1365
|
+
pub const automation_command_policy = @import("automation_command_policy.zig");
|
|
1366
|
+
pub const automation_interaction_policy = @import("automation_interaction_policy.zig");
|
|
1367
|
+
pub const builtin_coordination_policy = @import("builtin_coordination_policy.zig");
|
|
1368
|
+
pub const reference_bridge_payload = @import("bridge_payload.zig");
|
|
1369
|
+
pub const reference_descriptor_validation = @import("validation.zig");
|
|
1370
|
+
pub const shell_view_methods = @import("window_views.zig").RuntimeWindowViews(Runtime);
|
|
1371
|
+
pub const window_storage_methods = @import("window_storage.zig").RuntimeWindowStorage(Runtime);
|
|
1372
|
+
pub const referenceWindowDragRegions = @import("canvas_widget_events.zig").collectCanvasWidgetWindowDragRegions;
|
|
1373
|
+
pub const input_composition_policy = @import("input_composition_policy.zig");
|
|
1374
|
+
pub const clearInputCompositionOnBlur = runtime_view.clearImeGraceOnViewBlur;
|
|
1375
|
+
pub const referenceInputPointer = canvas_frame_helpers.canvasWidgetPointerEventFromGpuInput;
|
|
1376
|
+
pub const referenceInputKeyboard = canvas_frame_helpers.canvasWidgetKeyboardEventFromGpuInput;
|
|
1377
|
+
pub const referenceInputText = canvas_frame_helpers.canvasWidgetTextInputEventFromGpuInput;
|
|
1378
|
+
pub const referenceInputEscape = canvas_frame_helpers.canvasWidgetEscapeKey;
|
|
1379
|
+
pub const referenceInputCommandModifier = canvas_frame_helpers.gpuInputHasTextCommandModifier;
|
|
1380
|
+
pub const scene_observation_policy = @import("canvas_scene_observation_policy.zig");
|
|
1381
|
+
pub const presentation_lifecycle_policy = @import("canvas_presentation_lifecycle_policy.zig");
|
|
1382
|
+
pub const referencePresentationFallback = @import("canvas_frame.zig").referencePresentationFallback;
|
|
1383
|
+
pub const compiledPresentationFallback = @import("canvas_frame.zig").compiledPresentationFallback;
|
|
1384
|
+
pub const referenceSceneDirtyProjection = @import("canvas_frame.zig").canvasDirtyRegionForView;
|
|
1385
|
+
pub const referenceSceneBlurExtent = @import("canvas_frame.zig").backdropBlurSampleExtentMultiplier;
|
|
1386
|
+
pub const referenceSceneColor = canvas_frame_helpers.canvasColorToRgba8;
|
|
1387
|
+
pub const referenceFrameBounds = canvas_frame_helpers.canvasFullRepaintBounds;
|
|
1388
|
+
pub const referenceFrameScale = canvas_frame_helpers.normalizedCanvasPresentationScale;
|
|
1389
|
+
pub const referenceFrameBudgetUnset = canvas_frame_helpers.canvasFrameBudgetIsUnset;
|
|
1390
|
+
pub const render_animation_policy = @import("render_animation_policy.zig");
|
|
1391
|
+
pub const motion_sampling_policy = @import("motion_sampling_policy.zig");
|
|
1392
|
+
pub const referenceAnimationScheduleDirtyBounds = @import("canvas_frame.zig").referenceAnimationScheduleDirtyBounds;
|
|
1393
|
+
pub const command_policy = @import("command_policy.zig");
|
|
1394
|
+
pub const status_validation = @import("status_validation.zig");
|
|
1395
|
+
pub const native_validation = @import("validation.zig");
|
|
1396
|
+
pub const command_services = runtime_system_services.RuntimeSystemServices(Runtime);
|
|
1397
|
+
pub const builtin_bridge_methods = @import("builtin_bridge.zig").RuntimeBuiltinBridge(Runtime);
|
|
1398
|
+
pub const accessibility_policy = @import("accessibility_policy.zig");
|
|
1399
|
+
pub const accessibility_publication = runtime_canvas_widget_display.RuntimeCanvasWidgetDisplay(Runtime);
|
|
1400
|
+
pub const DamageCurrentCommand = @import("canvas_frame.zig").DamageCurrentCommand;
|
|
1401
|
+
pub const referenceDamageSnap = @import("canvas_frame.zig").referenceDamageSnap;
|
|
1402
|
+
pub const referenceDamageWiden = @import("canvas_frame.zig").referenceDamageWiden;
|
|
1403
|
+
pub const referenceDamagePatch = @import("canvas_frame.zig").referenceDamagePatch;
|
|
1404
|
+
pub fn mergeCanvasRenderOverrides(scheduled: []const canvas.CanvasRenderOverride, explicit: []const canvas.CanvasRenderOverride, output: []canvas.CanvasRenderOverride) ![]const canvas.CanvasRenderOverride {
|
|
1405
|
+
return canvas_frame_helpers.mergeCanvasRenderOverrides(scheduled, explicit, output);
|
|
1406
|
+
}
|
|
1407
|
+
|
|
1408
|
+
pub const nativeShellPlan = shell_layout.referenceShellPlan;
|
|
1409
|
+
pub const compiledShellPlan = shell_layout.compiledShellPlan;
|
|
1410
|
+
pub const encodeShellPlanRequest = shell_layout.encodeShellPlanRequest;
|
|
1261
1411
|
pub fn copyInto(buffer: []u8, value: []const u8) ![]const u8 {
|
|
1262
1412
|
return testingCopyInto(buffer, value);
|
|
1263
1413
|
}
|