@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
|
@@ -291,6 +291,8 @@ pub const Video = struct {
|
|
|
291
291
|
};
|
|
292
292
|
|
|
293
293
|
pub const Input = struct {
|
|
294
|
+
/// Compiled byte serializer; borrowed storage and writer I/O stay native.
|
|
295
|
+
serialization_policy: ?*const fn ([]const u8, []u8) usize = null,
|
|
294
296
|
windows: []const Window,
|
|
295
297
|
views: []const platform.ViewInfo = &.{},
|
|
296
298
|
widgets: []const Widget = &.{},
|
|
@@ -330,648 +332,18 @@ pub const Input = struct {
|
|
|
330
332
|
};
|
|
331
333
|
|
|
332
334
|
pub fn writeText(input: Input, writer: anytype) !void {
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
// binary (or a stale app) is refused loudly instead of silently
|
|
336
|
-
// driving yesterday's dropbox shape.
|
|
337
|
-
try writer.print("ready=true protocol=0x{x:0>16} frame={d} commands={d} runtime_uptime_ns={d} dispatch_errors={d} dropped_trace_records={d} publisher_pid={d} markup_watch={s}\n", .{
|
|
338
|
-
protocol.fingerprint,
|
|
339
|
-
input.diagnostics.frame_index,
|
|
340
|
-
input.diagnostics.command_count,
|
|
341
|
-
input.diagnostics.runtime_uptime_ns,
|
|
342
|
-
input.diagnostics.dispatch_error_count,
|
|
343
|
-
input.diagnostics.dropped_trace_records,
|
|
344
|
-
input.diagnostics.publisher_pid,
|
|
345
|
-
if (input.diagnostics.markup_watch_armed) "armed" else "off",
|
|
346
|
-
});
|
|
347
|
-
// Per-stage frame timing (`profile on`): rolling p50/p90 in
|
|
348
|
-
// microseconds per pipeline stage, one greppable key per number so
|
|
349
|
-
// harnesses extract them the way the perf script reads gpu_* fields.
|
|
350
|
-
// Stages that recorded nothing yet print zeros with `_n=0`.
|
|
351
|
-
if (input.frame_profile) |profile| {
|
|
352
|
-
try writer.writeAll("frame_profile");
|
|
353
|
-
for (profile.stages) |stage| {
|
|
354
|
-
try writer.print(" {s}_p50_us={d} {s}_p90_us={d} {s}_max_us={d} {s}_n={d}", .{
|
|
355
|
-
stage.name, stage.p50_us,
|
|
356
|
-
stage.name, stage.p90_us,
|
|
357
|
-
stage.name, stage.max_us,
|
|
358
|
-
stage.name, stage.count,
|
|
359
|
-
});
|
|
360
|
-
}
|
|
361
|
-
try writer.writeByte('\n');
|
|
362
|
-
}
|
|
363
|
-
for (input.windows) |window| {
|
|
364
|
-
try writer.print(
|
|
365
|
-
"window @w{d} \"{s}\" bounds=({d},{d} {d}x{d}) focused={any} frame={d} commands={d}\n",
|
|
366
|
-
.{
|
|
367
|
-
window.id,
|
|
368
|
-
window.title,
|
|
369
|
-
window.bounds.x,
|
|
370
|
-
window.bounds.y,
|
|
371
|
-
window.bounds.width,
|
|
372
|
-
window.bounds.height,
|
|
373
|
-
window.focused,
|
|
374
|
-
input.diagnostics.frame_index,
|
|
375
|
-
input.diagnostics.command_count,
|
|
376
|
-
},
|
|
377
|
-
);
|
|
378
|
-
}
|
|
379
|
-
for (input.views) |view| {
|
|
380
|
-
try writer.print(
|
|
381
|
-
" view @w{d}/{s} kind={s} role=\"{s}\" accessibility_label=\"{s}\" text=\"{s}\" bounds=({d},{d} {d}x{d}) layer={d} visible={any} enabled={any} focused={any} open={any}",
|
|
382
|
-
.{
|
|
383
|
-
view.window_id,
|
|
384
|
-
view.label,
|
|
385
|
-
@tagName(view.kind),
|
|
386
|
-
view.role,
|
|
387
|
-
view.accessibility_label,
|
|
388
|
-
view.text,
|
|
389
|
-
view.frame.x,
|
|
390
|
-
view.frame.y,
|
|
391
|
-
view.frame.width,
|
|
392
|
-
view.frame.height,
|
|
393
|
-
view.layer,
|
|
394
|
-
view.visible,
|
|
395
|
-
view.enabled,
|
|
396
|
-
view.focused,
|
|
397
|
-
view.open,
|
|
398
|
-
},
|
|
399
|
-
);
|
|
400
|
-
if (view.kind == .gpu_surface) {
|
|
401
|
-
try writer.print(" gpu_size={d}x{d} gpu_scale={d} gpu_backend={s} gpu_pixel_format={s} gpu_present_mode={s} gpu_alpha_mode={s} gpu_color_space={s} gpu_vsync={any} gpu_status={s} gpu_present_path={s} gpu_frame={d} gpu_timestamp_ns={d} gpu_frame_interval_ns={d} gpu_input_count={d} gpu_input_timestamp_ns={d} gpu_input_latency_ns={d} gpu_input_latency_budget_ns={d} gpu_input_latency_budget_exceeded={d} gpu_input_latency_budget_ok={any} gpu_first_frame_latency_ns={d} gpu_first_frame_latency_budget_ns={d} gpu_first_frame_latency_budget_exceeded={d} gpu_first_frame_latency_budget_ok={any} gpu_nonblank={any} gpu_occluded={any} gpu_sample=0x{x:0>8}", .{
|
|
402
|
-
view.gpu_size.width,
|
|
403
|
-
view.gpu_size.height,
|
|
404
|
-
view.gpu_scale_factor,
|
|
405
|
-
@tagName(view.gpu_backend),
|
|
406
|
-
@tagName(view.gpu_pixel_format),
|
|
407
|
-
@tagName(view.gpu_present_mode),
|
|
408
|
-
@tagName(view.gpu_alpha_mode),
|
|
409
|
-
@tagName(view.gpu_color_space),
|
|
410
|
-
view.gpu_vsync,
|
|
411
|
-
@tagName(view.gpu_status),
|
|
412
|
-
@tagName(view.gpu_present_path),
|
|
413
|
-
view.gpu_frame_index,
|
|
414
|
-
view.gpu_timestamp_ns,
|
|
415
|
-
view.gpu_frame_interval_ns,
|
|
416
|
-
view.gpu_input_event_count,
|
|
417
|
-
view.gpu_input_timestamp_ns,
|
|
418
|
-
view.gpu_input_latency_ns,
|
|
419
|
-
view.gpu_input_latency_budget_ns,
|
|
420
|
-
view.gpu_input_latency_budget_exceeded_count,
|
|
421
|
-
view.gpu_input_latency_budget_ok,
|
|
422
|
-
view.gpu_first_frame_latency_ns,
|
|
423
|
-
view.gpu_first_frame_latency_budget_ns,
|
|
424
|
-
view.gpu_first_frame_latency_budget_exceeded_count,
|
|
425
|
-
view.gpu_first_frame_latency_budget_ok,
|
|
426
|
-
view.gpu_frame_nonblank,
|
|
427
|
-
view.gpu_occluded,
|
|
428
|
-
view.gpu_sample_color,
|
|
429
|
-
});
|
|
430
|
-
// Packet-fallback telemetry: WHY the last packet attempt
|
|
431
|
-
// fell back to the CPU pixel path (overflow byte math or the
|
|
432
|
-
// offending command kind) plus a running fallback-frame
|
|
433
|
-
// counter that never resets, so oscillation between the two
|
|
434
|
-
// render paths is visible even when the snapshot lands on a
|
|
435
|
-
// healthy frame.
|
|
436
|
-
try writer.print(" present_fallback={s} present_fallback_needed={d} present_fallback_limit={d} present_fallback_command=\"{s}\" present_fallback_frames={d}", .{
|
|
437
|
-
@tagName(view.gpu_present_fallback_reason),
|
|
438
|
-
view.gpu_present_fallback_needed_bytes,
|
|
439
|
-
view.gpu_present_fallback_limit_bytes,
|
|
440
|
-
view.gpu_present_fallback_command_kind,
|
|
441
|
-
view.gpu_present_fallback_frame_count,
|
|
442
|
-
});
|
|
443
|
-
// Incremental-presentation telemetry: whether the last packet
|
|
444
|
-
// present shipped the full command list or a patch against
|
|
445
|
-
// the host's retained dictionary, the patch's bytes and edit
|
|
446
|
-
// counts, and how many commands the host currently retains —
|
|
447
|
-
// the numbers that make "frame cost scales with what changed"
|
|
448
|
-
// observable instead of asserted.
|
|
449
|
-
try writer.print(" present_mode={s} present_patch_bytes={d} present_patch_upserts={d} present_patch_evicts={d} present_retained_commands={d}", .{
|
|
450
|
-
@tagName(view.gpu_present_packet_mode),
|
|
451
|
-
view.gpu_present_patch_bytes,
|
|
452
|
-
view.gpu_present_patch_upsert_count,
|
|
453
|
-
view.gpu_present_patch_evict_count,
|
|
454
|
-
view.gpu_present_retained_command_count,
|
|
455
|
-
});
|
|
456
|
-
try writer.print(" canvas_revision={d} canvas_commands={d} canvas_frame_requires_render={any} canvas_frame_full_repaint={any} canvas_frame_batches={d} canvas_frame_encoder_commands={d} canvas_frame_encoder_cache_actions={d} canvas_frame_encoder_pipeline_binds={d} canvas_frame_encoder_draws={d} canvas_frame_pipelines={d} canvas_frame_pipeline_uploads={d} canvas_frame_pipeline_retains={d} canvas_frame_pipeline_evicts={d}", .{
|
|
457
|
-
view.canvas_revision,
|
|
458
|
-
view.canvas_command_count,
|
|
459
|
-
view.canvas_frame_requires_render,
|
|
460
|
-
view.canvas_frame_full_repaint,
|
|
461
|
-
view.canvas_frame_batch_count,
|
|
462
|
-
view.canvas_frame_encoder_command_count,
|
|
463
|
-
view.canvas_frame_encoder_cache_action_count,
|
|
464
|
-
view.canvas_frame_encoder_bind_pipeline_count,
|
|
465
|
-
view.canvas_frame_encoder_draw_batch_count,
|
|
466
|
-
view.canvas_frame_pipeline_count,
|
|
467
|
-
view.canvas_frame_pipeline_upload_count,
|
|
468
|
-
view.canvas_frame_pipeline_retain_count,
|
|
469
|
-
view.canvas_frame_pipeline_evict_count,
|
|
470
|
-
});
|
|
471
|
-
try writer.print(" canvas_frame_path_geometries={d} canvas_frame_path_vertices={d} canvas_frame_path_indices={d} canvas_frame_path_uploads={d} canvas_frame_path_retains={d} canvas_frame_path_evicts={d} canvas_frame_images={d} canvas_frame_image_uploads={d} canvas_frame_image_retains={d} canvas_frame_image_evicts={d}", .{
|
|
472
|
-
view.canvas_frame_path_geometry_count,
|
|
473
|
-
view.canvas_frame_path_geometry_vertex_count,
|
|
474
|
-
view.canvas_frame_path_geometry_index_count,
|
|
475
|
-
view.canvas_frame_path_geometry_upload_count,
|
|
476
|
-
view.canvas_frame_path_geometry_retain_count,
|
|
477
|
-
view.canvas_frame_path_geometry_evict_count,
|
|
478
|
-
view.canvas_frame_image_count,
|
|
479
|
-
view.canvas_frame_image_upload_count,
|
|
480
|
-
view.canvas_frame_image_retain_count,
|
|
481
|
-
view.canvas_frame_image_evict_count,
|
|
482
|
-
});
|
|
483
|
-
try writer.print(" canvas_frame_layers={d} canvas_frame_opacity_layers={d} canvas_frame_clip_layers={d} canvas_frame_transform_layers={d} canvas_frame_layer_uploads={d} canvas_frame_layer_retains={d} canvas_frame_layer_evicts={d}", .{
|
|
484
|
-
view.canvas_frame_layer_count,
|
|
485
|
-
view.canvas_frame_layer_opacity_count,
|
|
486
|
-
view.canvas_frame_layer_clip_count,
|
|
487
|
-
view.canvas_frame_layer_transform_count,
|
|
488
|
-
view.canvas_frame_layer_upload_count,
|
|
489
|
-
view.canvas_frame_layer_retain_count,
|
|
490
|
-
view.canvas_frame_layer_evict_count,
|
|
491
|
-
});
|
|
492
|
-
try writer.print(" canvas_frame_resources={d} canvas_frame_uploads={d} canvas_frame_retains={d} canvas_frame_evicts={d} canvas_frame_effects={d} canvas_frame_shadows={d} canvas_frame_blurs={d} canvas_frame_effect_uploads={d} canvas_frame_effect_retains={d} canvas_frame_effect_evicts={d}", .{
|
|
493
|
-
view.canvas_frame_resource_count,
|
|
494
|
-
view.canvas_frame_resource_upload_count,
|
|
495
|
-
view.canvas_frame_resource_retain_count,
|
|
496
|
-
view.canvas_frame_resource_evict_count,
|
|
497
|
-
view.canvas_frame_visual_effect_count,
|
|
498
|
-
view.canvas_frame_visual_effect_shadow_count,
|
|
499
|
-
view.canvas_frame_visual_effect_blur_count,
|
|
500
|
-
view.canvas_frame_visual_effect_upload_count,
|
|
501
|
-
view.canvas_frame_visual_effect_retain_count,
|
|
502
|
-
view.canvas_frame_visual_effect_evict_count,
|
|
503
|
-
});
|
|
504
|
-
try writer.print(" canvas_frame_glyphs={d} canvas_frame_glyph_uploads={d} canvas_frame_glyph_retains={d} canvas_frame_glyph_evicts={d} canvas_frame_text_layouts={d} canvas_frame_text_lines={d} canvas_frame_text_uploads={d} canvas_frame_text_retains={d} canvas_frame_text_evicts={d}", .{
|
|
505
|
-
view.canvas_frame_glyph_atlas_entry_count,
|
|
506
|
-
view.canvas_frame_glyph_atlas_upload_count,
|
|
507
|
-
view.canvas_frame_glyph_atlas_retain_count,
|
|
508
|
-
view.canvas_frame_glyph_atlas_evict_count,
|
|
509
|
-
view.canvas_frame_text_layout_count,
|
|
510
|
-
view.canvas_frame_text_layout_line_count,
|
|
511
|
-
view.canvas_frame_text_layout_upload_count,
|
|
512
|
-
view.canvas_frame_text_layout_retain_count,
|
|
513
|
-
view.canvas_frame_text_layout_evict_count,
|
|
514
|
-
});
|
|
515
|
-
try writer.print(" canvas_frame_gpu_packet_commands={d} canvas_frame_gpu_packet_cache_actions={d} canvas_frame_gpu_packet_cached_resources={d} canvas_frame_gpu_packet_unsupported={d} canvas_frame_gpu_packet_representable={any}", .{
|
|
516
|
-
view.canvas_frame_gpu_packet_command_count,
|
|
517
|
-
view.canvas_frame_gpu_packet_cache_action_count,
|
|
518
|
-
view.canvas_frame_gpu_packet_cached_resource_command_count,
|
|
519
|
-
view.canvas_frame_gpu_packet_unsupported_command_count,
|
|
520
|
-
view.canvas_frame_gpu_packet_representable,
|
|
521
|
-
});
|
|
522
|
-
try writer.print(" canvas_frame_changes={d} canvas_frame_budget_exceeded={d} canvas_frame_budget_ok={any}", .{
|
|
523
|
-
view.canvas_frame_change_count,
|
|
524
|
-
view.canvas_frame_budget_exceeded_count,
|
|
525
|
-
view.canvas_frame_budget_ok,
|
|
526
|
-
});
|
|
527
|
-
// Widget budget headroom telemetry (node and context-menu
|
|
528
|
-
// budgets):
|
|
529
|
-
// current retained node/semantics/context-menu-item counts
|
|
530
|
-
// against the per-view budgets, so authors see the cliff
|
|
531
|
-
// coming instead of bisecting overflow by hand. The budgets
|
|
532
|
-
// ride on Input because this module cannot import the
|
|
533
|
-
// runtime's canvas_limits.
|
|
534
|
-
try writer.print(" widget_nodes={d}/{d} widget_semantics={d}/{d} context_menu_items={d}/{d}", .{
|
|
535
|
-
view.widget_node_count,
|
|
536
|
-
input.widget_node_budget,
|
|
537
|
-
view.widget_semantics_count,
|
|
538
|
-
input.widget_semantics_budget,
|
|
539
|
-
view.widget_context_menu_item_count,
|
|
540
|
-
input.widget_context_menu_item_budget,
|
|
541
|
-
});
|
|
542
|
-
// Text-layout plan headroom: the last planned frame's
|
|
543
|
-
// text runs and wrapped lines against the per-frame budgets,
|
|
544
|
-
// so a growing transcript shows the cliff here before a frame
|
|
545
|
-
// dies with TextLayoutPlanListFull/TextLayoutLineListFull (a
|
|
546
|
-
// failed plan also lands in the dispatch-error ring above).
|
|
547
|
-
try writer.print(" text_layout_plans={d}/{d} text_layout_lines={d}/{d}", .{
|
|
548
|
-
view.canvas_frame_text_layout_count,
|
|
549
|
-
input.text_layout_plan_budget,
|
|
550
|
-
view.canvas_frame_text_layout_line_count,
|
|
551
|
-
input.text_layout_line_budget,
|
|
552
|
-
});
|
|
553
|
-
if (view.canvas_frame_dirty_bounds) |dirty| {
|
|
554
|
-
try writer.print(" canvas_frame_dirty=({d},{d} {d}x{d})", .{ dirty.x, dirty.y, dirty.width, dirty.height });
|
|
555
|
-
} else {
|
|
556
|
-
try writer.writeAll(" canvas_frame_dirty=null");
|
|
557
|
-
}
|
|
558
|
-
try writer.print(" canvas_frame_profile_work_units={d} canvas_frame_profile_risk={s} canvas_frame_profile_surface_area={d} canvas_frame_profile_dirty_area={d} canvas_frame_profile_dirty_ratio={d}", .{
|
|
559
|
-
view.canvas_frame_profile_work_units,
|
|
560
|
-
@tagName(view.canvas_frame_profile_risk),
|
|
561
|
-
view.canvas_frame_profile_surface_area,
|
|
562
|
-
view.canvas_frame_profile_dirty_area,
|
|
563
|
-
view.canvas_frame_profile_dirty_ratio,
|
|
564
|
-
});
|
|
565
|
-
try writer.print(" widget_revision={d} widget_nodes={d} widget_semantics={d}", .{
|
|
566
|
-
view.widget_revision,
|
|
567
|
-
view.widget_node_count,
|
|
568
|
-
view.widget_semantics_count,
|
|
569
|
-
});
|
|
570
|
-
try writer.print(" widget_cursor={s}", .{@tagName(view.cursor)});
|
|
571
|
-
}
|
|
572
|
-
if (view.kind == .webview) {
|
|
573
|
-
try writer.print(" url=\"{s}\"", .{view.url});
|
|
574
|
-
}
|
|
575
|
-
try writer.writeByte('\n');
|
|
576
|
-
}
|
|
577
|
-
for (input.widgets) |widget| {
|
|
578
|
-
try writer.print(
|
|
579
|
-
" widget @w{d}/{s}#{d} role={s} name=\"{s}\" bounds=({d},{d} {d}x{d}) focused={any} enabled={any}",
|
|
580
|
-
.{
|
|
581
|
-
widget.window_id,
|
|
582
|
-
widget.view_label,
|
|
583
|
-
widget.id,
|
|
584
|
-
widget.role,
|
|
585
|
-
widget.name,
|
|
586
|
-
widget.bounds.x,
|
|
587
|
-
widget.bounds.y,
|
|
588
|
-
widget.bounds.width,
|
|
589
|
-
widget.bounds.height,
|
|
590
|
-
widget.focused,
|
|
591
|
-
widget.enabled,
|
|
592
|
-
},
|
|
593
|
-
);
|
|
594
|
-
try writeWidgetParent(widget, writer);
|
|
595
|
-
if (widget.value) |value| try writer.print(" value={d}", .{value});
|
|
596
|
-
try writeWidgetTextValue(widget, writer);
|
|
597
|
-
try writeWidgetPlaceholder(widget, writer);
|
|
598
|
-
try writeWidgetGrid(widget, writer);
|
|
599
|
-
try writeWidgetList(widget, writer);
|
|
600
|
-
try writeWidgetScroll(widget, writer);
|
|
601
|
-
try writeWidgetVirtualRange(widget, writer);
|
|
602
|
-
try writeWidgetState(widget, writer);
|
|
603
|
-
try writeWidgetActions(widget.actions, writer);
|
|
604
|
-
try writeWidgetTextRanges(widget, writer);
|
|
605
|
-
try writeWidgetContextMenu(widget, writer);
|
|
606
|
-
try writer.writeByte('\n');
|
|
607
|
-
}
|
|
608
|
-
for (input.commands) |command| {
|
|
609
|
-
try writer.writeAll("command id=");
|
|
610
|
-
try writeQuotedSnapshotText(command.id, writer);
|
|
611
|
-
try writer.writeAll(" title=");
|
|
612
|
-
try writeQuotedSnapshotText(command.title, writer);
|
|
613
|
-
try writer.print(" enabled={any} checked={any}\n", .{ command.enabled, command.checked });
|
|
614
|
-
}
|
|
615
|
-
for (input.menus) |menu| {
|
|
616
|
-
try writer.writeAll("app-menu title=");
|
|
617
|
-
try writeQuotedSnapshotText(menu.title, writer);
|
|
618
|
-
try writer.print(" items={d}\n", .{menu.items.len});
|
|
619
|
-
for (menu.items) |item| {
|
|
620
|
-
if (item.separator) {
|
|
621
|
-
try writer.writeAll(" app-menu-item separator\n");
|
|
622
|
-
continue;
|
|
623
|
-
}
|
|
624
|
-
try writer.writeAll(" app-menu-item label=");
|
|
625
|
-
try writeQuotedSnapshotText(item.label, writer);
|
|
626
|
-
try writer.writeAll(" command=");
|
|
627
|
-
try writeQuotedSnapshotText(item.command, writer);
|
|
628
|
-
try writer.print(" enabled={any} checked={any} key=", .{
|
|
629
|
-
item.enabled,
|
|
630
|
-
item.checked,
|
|
631
|
-
});
|
|
632
|
-
try writeQuotedSnapshotText(item.key, writer);
|
|
633
|
-
try writer.print(" modifiers=(primary={any},command={any},control={any},option={any},shift={any})\n", .{
|
|
634
|
-
item.modifiers.primary,
|
|
635
|
-
item.modifiers.command,
|
|
636
|
-
item.modifiers.control,
|
|
637
|
-
item.modifiers.option,
|
|
638
|
-
item.modifiers.shift,
|
|
639
|
-
});
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
for (input.trays) |tray| {
|
|
643
|
-
try writer.print("tray #{d} title=\"{s}\" visible={any} items={d}\n", .{ tray.id, tray.title, tray.visible, tray.items.len });
|
|
644
|
-
for (tray.items) |item| {
|
|
645
|
-
if (item.separator) {
|
|
646
|
-
try writer.writeAll(" tray-item separator\n");
|
|
647
|
-
continue;
|
|
648
|
-
}
|
|
649
|
-
if (item.segmented) |segmented| {
|
|
650
|
-
try writer.print(" tray-item #{d} role=segmented options={d}\n", .{ item.id, segmented.options.len });
|
|
651
|
-
for (segmented.options) |option| {
|
|
652
|
-
try writer.print(" tray-segment #{d} label=", .{option.id});
|
|
653
|
-
try writeQuotedSnapshotText(option.label, writer);
|
|
654
|
-
try writer.writeAll(" command=");
|
|
655
|
-
try writeQuotedSnapshotText(option.command, writer);
|
|
656
|
-
try writer.print(" selected={any} enabled={any}\n", .{ option.selected, option.enabled });
|
|
657
|
-
}
|
|
658
|
-
continue;
|
|
659
|
-
}
|
|
660
|
-
if (item.metric) |metric| {
|
|
661
|
-
try writer.print(" tray-item #{d} role=metric primary=", .{item.id});
|
|
662
|
-
try writeQuotedSnapshotText(metric.primary_text, writer);
|
|
663
|
-
try writer.writeAll(" secondary=");
|
|
664
|
-
try writeQuotedSnapshotText(metric.secondary_text, writer);
|
|
665
|
-
try writer.writeAll(" accessibility=");
|
|
666
|
-
try writeQuotedSnapshotText(metric.accessibility_label, writer);
|
|
667
|
-
try writer.writeByte('\n');
|
|
668
|
-
continue;
|
|
669
|
-
}
|
|
670
|
-
if (item.chart) |chart| {
|
|
671
|
-
try writer.print(" tray-item #{d} role=chart caption=", .{item.id});
|
|
672
|
-
try writeQuotedSnapshotText(chart.leading_caption, writer);
|
|
673
|
-
try writer.writeAll(" summary=");
|
|
674
|
-
try writeQuotedSnapshotText(chart.trailing_summary, writer);
|
|
675
|
-
try writer.writeAll(" accessibility=");
|
|
676
|
-
try writeQuotedSnapshotText(chart.accessibility_label, writer);
|
|
677
|
-
try writer.print(" domain=({d},{d}) values=", .{ chart.min_value, chart.max_value });
|
|
678
|
-
for (chart.values, 0..) |value, index| {
|
|
679
|
-
if (index > 0) try writer.writeByte(',');
|
|
680
|
-
try writer.print("{d}", .{value});
|
|
681
|
-
}
|
|
682
|
-
try writer.writeByte('\n');
|
|
683
|
-
continue;
|
|
684
|
-
}
|
|
685
|
-
try writer.print(" tray-item #{d} label=\"{s}\" command=\"{s}\" enabled={any} detail=\"{s}\" role={s} key=\"{s}\" modifiers=(primary={any},command={any},control={any},option={any},shift={any})\n", .{
|
|
686
|
-
item.id,
|
|
687
|
-
item.label,
|
|
688
|
-
item.command,
|
|
689
|
-
item.enabled,
|
|
690
|
-
item.detail,
|
|
691
|
-
@tagName(item.role),
|
|
692
|
-
item.key,
|
|
693
|
-
item.modifiers.primary,
|
|
694
|
-
item.modifiers.command,
|
|
695
|
-
item.modifiers.control,
|
|
696
|
-
item.modifiers.option,
|
|
697
|
-
item.modifiers.shift,
|
|
698
|
-
});
|
|
699
|
-
}
|
|
700
|
-
}
|
|
701
|
-
if (input.audio) |audio| {
|
|
702
|
-
try writer.print("audio key={d} state={s} source={s} position_ms={d} duration_ms={d} spectrum_events={d}", .{
|
|
703
|
-
audio.key,
|
|
704
|
-
// Buffering is the honest third state: the transport is not
|
|
705
|
-
// paused, but a stalled stream is not audibly playing either.
|
|
706
|
-
if (audio.buffering) "buffering" else if (audio.playing) "playing" else "paused",
|
|
707
|
-
audio.source,
|
|
708
|
-
audio.position_ms,
|
|
709
|
-
audio.duration_ms,
|
|
710
|
-
audio.spectrum_events,
|
|
711
|
-
});
|
|
712
|
-
// Band bytes print only once analysis has actually delivered —
|
|
713
|
-
// a host that cannot analyze shows `spectrum_events=0` and no
|
|
714
|
-
// bands line noise (honest absence, not a row of fake zeros).
|
|
715
|
-
if (audio.spectrum_events > 0) {
|
|
716
|
-
try writer.print(" spectrum_bands={x}", .{audio.spectrum_bands});
|
|
717
|
-
}
|
|
718
|
-
try writer.print("\n", .{});
|
|
719
|
-
}
|
|
720
|
-
if (input.video) |video| {
|
|
721
|
-
try writer.print("video key={d} surface={d} state={s} source={s} position_ms={d} duration_ms={d} dimensions={d}x{d} loop={any} muted={any}\n", .{
|
|
722
|
-
video.key,
|
|
723
|
-
video.surface,
|
|
724
|
-
// The audio line's honest third state, verbatim.
|
|
725
|
-
if (video.buffering) "buffering" else if (video.playing) "playing" else "paused",
|
|
726
|
-
video.source,
|
|
727
|
-
video.position_ms,
|
|
728
|
-
video.duration_ms,
|
|
729
|
-
video.width,
|
|
730
|
-
video.height,
|
|
731
|
-
video.looping,
|
|
732
|
-
video.muted,
|
|
733
|
-
});
|
|
734
|
-
}
|
|
735
|
-
for (input.errors) |dispatch_error| {
|
|
736
|
-
if (dispatch_error.detail_len > 0) {
|
|
737
|
-
try writer.print(" error event={s} name={s} detail=\"{s}\" timestamp_ns={d}\n", .{
|
|
738
|
-
dispatch_error.event(),
|
|
739
|
-
dispatch_error.error_name,
|
|
740
|
-
dispatch_error.detail(),
|
|
741
|
-
dispatch_error.timestamp_ns,
|
|
742
|
-
});
|
|
743
|
-
} else {
|
|
744
|
-
try writer.print(" error event={s} name={s} timestamp_ns={d}\n", .{
|
|
745
|
-
dispatch_error.event(),
|
|
746
|
-
dispatch_error.error_name,
|
|
747
|
-
dispatch_error.timestamp_ns,
|
|
748
|
-
});
|
|
749
|
-
}
|
|
750
|
-
}
|
|
751
|
-
if (input.source) |source| {
|
|
752
|
-
try writer.print(" source kind={s} bytes={d}\n", .{ @tagName(source.kind), source.bytes.len });
|
|
753
|
-
}
|
|
335
|
+
if (input.serialization_policy == null) return @import("snapshot_reference.zig").writeText(input, writer);
|
|
336
|
+
try @import("snapshot_serialization.zig").write(input, writer, .full);
|
|
754
337
|
}
|
|
755
338
|
|
|
756
339
|
pub fn writeA11yText(input: Input, writer: anytype) !void {
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
try writer.print("@w{d} role=window name=\"{s}\" bounds=({d},{d} {d}x{d})\n", .{
|
|
760
|
-
window.id,
|
|
761
|
-
window.title,
|
|
762
|
-
window.bounds.x,
|
|
763
|
-
window.bounds.y,
|
|
764
|
-
window.bounds.width,
|
|
765
|
-
window.bounds.height,
|
|
766
|
-
});
|
|
767
|
-
}
|
|
768
|
-
for (input.views) |view| {
|
|
769
|
-
const role = if (view.role.len > 0) view.role else @tagName(view.kind);
|
|
770
|
-
const name = if (view.accessibility_label.len > 0) view.accessibility_label else if (view.text.len > 0) view.text else view.label;
|
|
771
|
-
try writer.print("@w{d}/{s} role={s} name=\"{s}\" bounds=({d},{d} {d}x{d})\n", .{
|
|
772
|
-
view.window_id,
|
|
773
|
-
view.label,
|
|
774
|
-
role,
|
|
775
|
-
name,
|
|
776
|
-
view.frame.x,
|
|
777
|
-
view.frame.y,
|
|
778
|
-
view.frame.width,
|
|
779
|
-
view.frame.height,
|
|
780
|
-
});
|
|
781
|
-
}
|
|
782
|
-
for (input.widgets) |widget| {
|
|
783
|
-
try writer.print("@w{d}/{s}#{d} role={s} name=\"{s}\" bounds=({d},{d} {d}x{d})", .{
|
|
784
|
-
widget.window_id,
|
|
785
|
-
widget.view_label,
|
|
786
|
-
widget.id,
|
|
787
|
-
widget.role,
|
|
788
|
-
widget.name,
|
|
789
|
-
widget.bounds.x,
|
|
790
|
-
widget.bounds.y,
|
|
791
|
-
widget.bounds.width,
|
|
792
|
-
widget.bounds.height,
|
|
793
|
-
});
|
|
794
|
-
try writeWidgetParent(widget, writer);
|
|
795
|
-
if (widget.value) |value| try writer.print(" value={d}", .{value});
|
|
796
|
-
try writeWidgetTextValue(widget, writer);
|
|
797
|
-
try writeWidgetGrid(widget, writer);
|
|
798
|
-
try writeWidgetList(widget, writer);
|
|
799
|
-
try writeWidgetScroll(widget, writer);
|
|
800
|
-
try writeWidgetVirtualRange(widget, writer);
|
|
801
|
-
try writeWidgetState(widget, writer);
|
|
802
|
-
try writeWidgetActions(widget.actions, writer);
|
|
803
|
-
try writeWidgetTextRanges(widget, writer);
|
|
804
|
-
try writeWidgetContextMenu(widget, writer);
|
|
805
|
-
try writer.writeByte('\n');
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
|
|
809
|
-
/// Catalog values are user-authored but snapshots are line-oriented. Keep
|
|
810
|
-
/// each configured command/menu record on exactly one line and preserve its
|
|
811
|
-
/// byte identity with JSON-style escapes for delimiters and control bytes.
|
|
812
|
-
fn writeQuotedSnapshotText(value: []const u8, writer: anytype) !void {
|
|
813
|
-
const hex = "0123456789abcdef";
|
|
814
|
-
try writer.writeByte('"');
|
|
815
|
-
for (value) |byte| {
|
|
816
|
-
switch (byte) {
|
|
817
|
-
'"' => try writer.writeAll("\\\""),
|
|
818
|
-
'\\' => try writer.writeAll("\\\\"),
|
|
819
|
-
'\n' => try writer.writeAll("\\n"),
|
|
820
|
-
'\r' => try writer.writeAll("\\r"),
|
|
821
|
-
'\t' => try writer.writeAll("\\t"),
|
|
822
|
-
else => if (byte < 0x20 or byte == 0x7f) {
|
|
823
|
-
try writer.writeAll("\\u00");
|
|
824
|
-
try writer.writeByte(hex[byte >> 4]);
|
|
825
|
-
try writer.writeByte(hex[byte & 0x0f]);
|
|
826
|
-
} else {
|
|
827
|
-
try writer.writeByte(byte);
|
|
828
|
-
},
|
|
829
|
-
}
|
|
830
|
-
}
|
|
831
|
-
try writer.writeByte('"');
|
|
832
|
-
}
|
|
833
|
-
|
|
834
|
-
fn writeWidgetParent(widget: Widget, writer: anytype) !void {
|
|
835
|
-
if (widget.parent_id) |parent_id| try writer.print(" parent=#{d}", .{parent_id});
|
|
836
|
-
}
|
|
837
|
-
|
|
838
|
-
fn writeWidgetTextValue(widget: Widget, writer: anytype) !void {
|
|
839
|
-
if (widget.text_value.len == 0) return;
|
|
840
|
-
try writer.print(" text=\"{s}\"", .{widget.text_value});
|
|
340
|
+
if (input.serialization_policy == null) return @import("snapshot_reference.zig").writeA11yText(input, writer);
|
|
341
|
+
try @import("snapshot_serialization.zig").write(input, writer, .accessibility);
|
|
841
342
|
}
|
|
842
343
|
|
|
843
|
-
fn
|
|
844
|
-
if (
|
|
845
|
-
try
|
|
846
|
-
}
|
|
847
|
-
|
|
848
|
-
fn writeWidgetGrid(widget: Widget, writer: anytype) !void {
|
|
849
|
-
if (widget.grid_row_index == null and
|
|
850
|
-
widget.grid_column_index == null and
|
|
851
|
-
widget.grid_row_count == null and
|
|
852
|
-
widget.grid_column_count == null) return;
|
|
853
|
-
|
|
854
|
-
try writer.writeAll(" grid=[");
|
|
855
|
-
var wrote = false;
|
|
856
|
-
try writeWidgetGridValue("row_index", widget.grid_row_index, &wrote, writer);
|
|
857
|
-
try writeWidgetGridValue("column_index", widget.grid_column_index, &wrote, writer);
|
|
858
|
-
try writeWidgetGridValue("row_count", widget.grid_row_count, &wrote, writer);
|
|
859
|
-
try writeWidgetGridValue("column_count", widget.grid_column_count, &wrote, writer);
|
|
860
|
-
try writer.writeByte(']');
|
|
861
|
-
}
|
|
862
|
-
|
|
863
|
-
fn writeWidgetGridValue(name: []const u8, value: ?usize, wrote: *bool, writer: anytype) !void {
|
|
864
|
-
const unwrapped = value orelse return;
|
|
865
|
-
if (wrote.*) try writer.writeByte(',');
|
|
866
|
-
try writer.print("{s}={d}", .{ name, unwrapped });
|
|
867
|
-
wrote.* = true;
|
|
868
|
-
}
|
|
869
|
-
|
|
870
|
-
fn writeWidgetList(widget: Widget, writer: anytype) !void {
|
|
871
|
-
if (!widget.list.present) return;
|
|
872
|
-
try writer.print(" list=[index={d},count={d}]", .{ widget.list.item_index, widget.list.item_count });
|
|
873
|
-
}
|
|
874
|
-
|
|
875
|
-
fn writeWidgetScroll(widget: Widget, writer: anytype) !void {
|
|
876
|
-
if (!widget.scroll.present) return;
|
|
877
|
-
try writer.print(" scroll=[offset={d},viewport={d},content={d}]", .{
|
|
878
|
-
widget.scroll.offset,
|
|
879
|
-
widget.scroll.viewport_extent,
|
|
880
|
-
widget.scroll.content_extent,
|
|
881
|
-
});
|
|
882
|
-
}
|
|
883
|
-
|
|
884
|
-
fn writeWidgetVirtualRange(widget: Widget, writer: anytype) !void {
|
|
885
|
-
if (!widget.virtual_range.present) return;
|
|
886
|
-
try writer.print(" virtual=[start={d},end={d},first={d},last={d},rendered={d}]", .{
|
|
887
|
-
widget.virtual_range.start_index,
|
|
888
|
-
widget.virtual_range.end_index,
|
|
889
|
-
widget.virtual_range.first_visible_index,
|
|
890
|
-
widget.virtual_range.last_visible_index,
|
|
891
|
-
widget.virtual_range.rendered_count,
|
|
892
|
-
});
|
|
893
|
-
}
|
|
894
|
-
|
|
895
|
-
fn writeWidgetState(widget: Widget, writer: anytype) !void {
|
|
896
|
-
if (!widget.focused and
|
|
897
|
-
widget.enabled and
|
|
898
|
-
!widget.hovered and
|
|
899
|
-
!widget.pressed and
|
|
900
|
-
!widget.selected and
|
|
901
|
-
widget.expanded == null and
|
|
902
|
-
!widget.required and
|
|
903
|
-
!widget.read_only and
|
|
904
|
-
!widget.invalid) return;
|
|
905
|
-
try writer.writeAll(" state=[");
|
|
906
|
-
var wrote = false;
|
|
907
|
-
try writeWidgetStateFlag(widget.focused, "focused", &wrote, writer);
|
|
908
|
-
try writeWidgetStateFlag(!widget.enabled, "disabled", &wrote, writer);
|
|
909
|
-
try writeWidgetStateFlag(widget.hovered, "hovered", &wrote, writer);
|
|
910
|
-
try writeWidgetStateFlag(widget.pressed, "pressed", &wrote, writer);
|
|
911
|
-
try writeWidgetStateFlag(widget.selected, "selected", &wrote, writer);
|
|
912
|
-
if (widget.expanded) |expanded| {
|
|
913
|
-
try writeWidgetStateFlag(true, if (expanded) "expanded" else "collapsed", &wrote, writer);
|
|
914
|
-
}
|
|
915
|
-
try writeWidgetStateFlag(widget.required, "required", &wrote, writer);
|
|
916
|
-
try writeWidgetStateFlag(widget.read_only, "read_only", &wrote, writer);
|
|
917
|
-
try writeWidgetStateFlag(widget.invalid, "invalid", &wrote, writer);
|
|
918
|
-
try writer.writeByte(']');
|
|
919
|
-
}
|
|
920
|
-
|
|
921
|
-
fn writeWidgetStateFlag(enabled: bool, name: []const u8, wrote: *bool, writer: anytype) !void {
|
|
922
|
-
if (!enabled) return;
|
|
923
|
-
if (wrote.*) try writer.writeByte(',');
|
|
924
|
-
try writer.writeAll(name);
|
|
925
|
-
wrote.* = true;
|
|
926
|
-
}
|
|
927
|
-
|
|
928
|
-
fn writeWidgetActions(actions: WidgetActions, writer: anytype) !void {
|
|
929
|
-
if (actions.isEmpty()) return;
|
|
930
|
-
try writer.writeAll(" actions=[");
|
|
931
|
-
var wrote = false;
|
|
932
|
-
try writeWidgetAction(actions.focus, "focus", &wrote, writer);
|
|
933
|
-
try writeWidgetAction(actions.press, "press", &wrote, writer);
|
|
934
|
-
try writeWidgetAction(actions.toggle, "toggle", &wrote, writer);
|
|
935
|
-
try writeWidgetAction(actions.increment, "increment", &wrote, writer);
|
|
936
|
-
try writeWidgetAction(actions.decrement, "decrement", &wrote, writer);
|
|
937
|
-
try writeWidgetAction(actions.set_text, "set_text", &wrote, writer);
|
|
938
|
-
try writeWidgetAction(actions.set_selection, "set_selection", &wrote, writer);
|
|
939
|
-
try writeWidgetAction(actions.select, "select", &wrote, writer);
|
|
940
|
-
try writeWidgetAction(actions.drag, "drag", &wrote, writer);
|
|
941
|
-
try writeWidgetAction(actions.drop_files, "drop_files", &wrote, writer);
|
|
942
|
-
try writeWidgetAction(actions.dismiss, "dismiss", &wrote, writer);
|
|
943
|
-
try writer.writeByte(']');
|
|
944
|
-
}
|
|
945
|
-
|
|
946
|
-
fn writeWidgetAction(enabled: bool, name: []const u8, wrote: *bool, writer: anytype) !void {
|
|
947
|
-
if (!enabled) return;
|
|
948
|
-
if (wrote.*) try writer.writeByte(',');
|
|
949
|
-
try writer.writeAll(name);
|
|
950
|
-
wrote.* = true;
|
|
951
|
-
}
|
|
952
|
-
|
|
953
|
-
fn writeWidgetTextRanges(widget: Widget, writer: anytype) !void {
|
|
954
|
-
if (widget.text_selection) |selection| try writer.print(" selection={d}..{d}", .{ selection.start, selection.end });
|
|
955
|
-
if (widget.text_composition) |composition| try writer.print(" composition={d}..{d}", .{ composition.start, composition.end });
|
|
956
|
-
}
|
|
957
|
-
|
|
958
|
-
/// The widget's declared context-menu items: quoted labels in declared
|
|
959
|
-
/// order (list position = the `widget-context-menu` item index), bare
|
|
960
|
-
/// `separator` for divider slots, `(disabled)` marking items a real
|
|
961
|
-
/// menu would grey out.
|
|
962
|
-
fn writeWidgetContextMenu(widget: Widget, writer: anytype) !void {
|
|
963
|
-
if (widget.context_menu.len == 0) return;
|
|
964
|
-
try writer.writeAll(" context_menu=[");
|
|
965
|
-
for (widget.context_menu, 0..) |item, index| {
|
|
966
|
-
if (index > 0) try writer.writeByte(',');
|
|
967
|
-
if (item.separator) {
|
|
968
|
-
try writer.writeAll("separator");
|
|
969
|
-
continue;
|
|
970
|
-
}
|
|
971
|
-
try writer.print("\"{s}\"", .{item.label});
|
|
972
|
-
if (!item.enabled) try writer.writeAll("(disabled)");
|
|
973
|
-
}
|
|
974
|
-
try writer.writeByte(']');
|
|
344
|
+
pub fn writeWindowsText(input: Input, writer: anytype) !void {
|
|
345
|
+
if (input.serialization_policy == null) return @import("snapshot_reference.zig").writeWindowsText(input, writer);
|
|
346
|
+
try @import("snapshot_serialization.zig").write(input, writer, .windows);
|
|
975
347
|
}
|
|
976
348
|
|
|
977
349
|
test "snapshot emits window and source" {
|