@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
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
#include <unistd.h>
|
|
29
29
|
|
|
30
30
|
#include "../ios/apple_image_fit.h"
|
|
31
|
+
#include "spectrum_bins.h"
|
|
31
32
|
|
|
32
33
|
@class NativeSdkAppKitHost;
|
|
33
34
|
@class NativeSdkAudioCaptureTarget;
|
|
@@ -485,7 +486,8 @@ static int NativeSdkCredentialStatus(OSStatus status, int missingCode) {
|
|
|
485
486
|
@end
|
|
486
487
|
|
|
487
488
|
@interface NativeSdkWidgetAccessibilityElement : NSAccessibilityElement
|
|
488
|
-
|
|
489
|
+
- (void)publishAccessibilityFocused:(BOOL)focused;
|
|
490
|
+
@property(nonatomic, weak) NativeSdkMetalSurfaceView *surfaceView;
|
|
489
491
|
@property(nonatomic, assign) uint64_t widgetId;
|
|
490
492
|
@property(nonatomic, assign) uint32_t actionFlags;
|
|
491
493
|
@property(nonatomic, assign) BOOL canUndo;
|
|
@@ -588,6 +590,9 @@ static int NativeSdkCredentialStatus(OSStatus status, int missingCode) {
|
|
|
588
590
|
@property(nonatomic, assign) uint32_t pendingPointerMotionModifiers;
|
|
589
591
|
@property(nonatomic, assign) uint64_t pendingPointerMotionTimestampNs;
|
|
590
592
|
@property(nonatomic, assign) uint64_t pointerMotionInputLastEmitNs;
|
|
593
|
+
@property(nonatomic, assign) BOOL pointerDragInputActive;
|
|
594
|
+
@property(nonatomic, assign) NSPoint pointerDragInputPoint;
|
|
595
|
+
@property(nonatomic, assign) NSInteger pointerDragInputButton;
|
|
591
596
|
@property(nonatomic, assign) BOOL scrollInputPending;
|
|
592
597
|
@property(nonatomic, assign) NSPoint pendingScrollPoint;
|
|
593
598
|
@property(nonatomic, assign) double pendingScrollDeltaX;
|
|
@@ -708,6 +713,7 @@ static int NativeSdkCredentialStatus(OSStatus status, int missingCode) {
|
|
|
708
713
|
* that hit-block scroll regions beneath them. */
|
|
709
714
|
@property(nonatomic, strong) NSArray *scrollOccluderRects;
|
|
710
715
|
@property(nonatomic, assign) BOOL applyingScrollDriverOffset;
|
|
716
|
+
@property(nonatomic, assign) BOOL reconcilingScrollDrivers;
|
|
711
717
|
@property(nonatomic, assign) BOOL scrollDriverEventPending;
|
|
712
718
|
@property(nonatomic, assign) uint64_t pendingScrollDriverId;
|
|
713
719
|
@property(nonatomic, assign) double pendingScrollDriverOffsetX;
|
|
@@ -1501,6 +1507,10 @@ static NSPoint NativeSdkViewLocalYDownPoint(NSView *view, NSPoint point) {
|
|
|
1501
1507
|
|
|
1502
1508
|
@end
|
|
1503
1509
|
|
|
1510
|
+
static BOOL NativeSdkAccessibilityValuesEqual(id left, id right) {
|
|
1511
|
+
return left == right || [left isEqual:right];
|
|
1512
|
+
}
|
|
1513
|
+
|
|
1504
1514
|
@implementation NativeSdkWidgetAccessibilityElement
|
|
1505
1515
|
|
|
1506
1516
|
/* The action-flag gate for advertising AXPress: press, toggle, and
|
|
@@ -1515,7 +1525,7 @@ static const uint32_t NativeSdkWidgetPressActionFlags =
|
|
|
1515
1525
|
NATIVE_SDK_APPKIT_WIDGET_ACTION_SELECT;
|
|
1516
1526
|
|
|
1517
1527
|
- (NSArray *)accessibilityActionNames {
|
|
1518
|
-
if (!self.accessibilityEnabled) return @[];
|
|
1528
|
+
if (!self.surfaceView || !self.accessibilityEnabled) return @[];
|
|
1519
1529
|
NSMutableArray *actions = [NSMutableArray arrayWithCapacity:3];
|
|
1520
1530
|
if ((self.actionFlags & NativeSdkWidgetPressActionFlags) != 0) {
|
|
1521
1531
|
[actions addObject:NSAccessibilityPressAction];
|
|
@@ -1544,22 +1554,22 @@ static const uint32_t NativeSdkWidgetPressActionFlags =
|
|
|
1544
1554
|
* list instead of no-op'ing on invocation. */
|
|
1545
1555
|
- (BOOL)isAccessibilitySelectorAllowed:(SEL)selector {
|
|
1546
1556
|
if (selector == @selector(accessibilityPerformPress)) {
|
|
1547
|
-
return self.accessibilityEnabled && (self.actionFlags & NativeSdkWidgetPressActionFlags) != 0;
|
|
1557
|
+
return self.surfaceView && self.accessibilityEnabled && (self.actionFlags & NativeSdkWidgetPressActionFlags) != 0;
|
|
1548
1558
|
}
|
|
1549
1559
|
if (selector == @selector(accessibilityPerformIncrement)) {
|
|
1550
|
-
return self.accessibilityEnabled && (self.actionFlags & NATIVE_SDK_APPKIT_WIDGET_ACTION_INCREMENT) != 0;
|
|
1560
|
+
return self.surfaceView && self.accessibilityEnabled && (self.actionFlags & NATIVE_SDK_APPKIT_WIDGET_ACTION_INCREMENT) != 0;
|
|
1551
1561
|
}
|
|
1552
1562
|
if (selector == @selector(accessibilityPerformDecrement)) {
|
|
1553
|
-
return self.accessibilityEnabled && (self.actionFlags & NATIVE_SDK_APPKIT_WIDGET_ACTION_DECREMENT) != 0;
|
|
1563
|
+
return self.surfaceView && self.accessibilityEnabled && (self.actionFlags & NATIVE_SDK_APPKIT_WIDGET_ACTION_DECREMENT) != 0;
|
|
1554
1564
|
}
|
|
1555
1565
|
if (selector == @selector(accessibilityPerformCancel)) {
|
|
1556
|
-
return self.accessibilityEnabled && (self.actionFlags & NATIVE_SDK_APPKIT_WIDGET_ACTION_DISMISS) != 0;
|
|
1566
|
+
return self.surfaceView && self.accessibilityEnabled && (self.actionFlags & NATIVE_SDK_APPKIT_WIDGET_ACTION_DISMISS) != 0;
|
|
1557
1567
|
}
|
|
1558
1568
|
return [super isAccessibilitySelectorAllowed:selector];
|
|
1559
1569
|
}
|
|
1560
1570
|
|
|
1561
1571
|
- (BOOL)accessibilityPerformPress {
|
|
1562
|
-
if (!self.accessibilityEnabled) return NO;
|
|
1572
|
+
if (!self.surfaceView || !self.accessibilityEnabled) return NO;
|
|
1563
1573
|
if ((self.actionFlags & NATIVE_SDK_APPKIT_WIDGET_ACTION_TOGGLE) != 0) {
|
|
1564
1574
|
return [self.surfaceView emitWidgetAccessibilityActionWithId:self.widgetId action:NATIVE_SDK_APPKIT_WIDGET_ACCESSIBILITY_ACTION_TOGGLE];
|
|
1565
1575
|
}
|
|
@@ -1573,17 +1583,17 @@ static const uint32_t NativeSdkWidgetPressActionFlags =
|
|
|
1573
1583
|
}
|
|
1574
1584
|
|
|
1575
1585
|
- (BOOL)accessibilityPerformIncrement {
|
|
1576
|
-
if (!self.accessibilityEnabled || (self.actionFlags & NATIVE_SDK_APPKIT_WIDGET_ACTION_INCREMENT) == 0) return NO;
|
|
1586
|
+
if (!self.surfaceView || !self.accessibilityEnabled || (self.actionFlags & NATIVE_SDK_APPKIT_WIDGET_ACTION_INCREMENT) == 0) return NO;
|
|
1577
1587
|
return [self.surfaceView emitWidgetAccessibilityActionWithId:self.widgetId action:NATIVE_SDK_APPKIT_WIDGET_ACCESSIBILITY_ACTION_INCREMENT];
|
|
1578
1588
|
}
|
|
1579
1589
|
|
|
1580
1590
|
- (BOOL)accessibilityPerformDecrement {
|
|
1581
|
-
if (!self.accessibilityEnabled || (self.actionFlags & NATIVE_SDK_APPKIT_WIDGET_ACTION_DECREMENT) == 0) return NO;
|
|
1591
|
+
if (!self.surfaceView || !self.accessibilityEnabled || (self.actionFlags & NATIVE_SDK_APPKIT_WIDGET_ACTION_DECREMENT) == 0) return NO;
|
|
1582
1592
|
return [self.surfaceView emitWidgetAccessibilityActionWithId:self.widgetId action:NATIVE_SDK_APPKIT_WIDGET_ACCESSIBILITY_ACTION_DECREMENT];
|
|
1583
1593
|
}
|
|
1584
1594
|
|
|
1585
1595
|
- (BOOL)accessibilityPerformCancel {
|
|
1586
|
-
if (!self.accessibilityEnabled || (self.actionFlags & NATIVE_SDK_APPKIT_WIDGET_ACTION_DISMISS) == 0) return NO;
|
|
1596
|
+
if (!self.surfaceView || !self.accessibilityEnabled || (self.actionFlags & NATIVE_SDK_APPKIT_WIDGET_ACTION_DISMISS) == 0) return NO;
|
|
1587
1597
|
return [self.surfaceView emitWidgetAccessibilityActionWithId:self.widgetId action:NATIVE_SDK_APPKIT_WIDGET_ACCESSIBILITY_ACTION_DISMISS];
|
|
1588
1598
|
}
|
|
1589
1599
|
|
|
@@ -1596,16 +1606,23 @@ static const uint32_t NativeSdkWidgetPressActionFlags =
|
|
|
1596
1606
|
* reports the app's actual focus back. */
|
|
1597
1607
|
- (void)setAccessibilityFocused:(BOOL)focused {
|
|
1598
1608
|
[super setAccessibilityFocused:focused];
|
|
1599
|
-
if (!focused || !self.accessibilityEnabled) return;
|
|
1609
|
+
if (!self.surfaceView || !focused || !self.accessibilityEnabled) return;
|
|
1600
1610
|
if ((self.actionFlags & NATIVE_SDK_APPKIT_WIDGET_ACTION_FOCUS) == 0) return;
|
|
1601
1611
|
[self.surfaceView emitWidgetAccessibilityActionWithId:self.widgetId action:NATIVE_SDK_APPKIT_WIDGET_ACCESSIBILITY_ACTION_FOCUS];
|
|
1602
1612
|
}
|
|
1603
1613
|
|
|
1614
|
+
/* Publishing runtime state must not look like an assistive client writing
|
|
1615
|
+
* AXFocused. That feedback resets keyboard focus to programmatic focus and
|
|
1616
|
+
* makes plain list rows lose their Tab-established navigation contract. */
|
|
1617
|
+
- (void)publishAccessibilityFocused:(BOOL)focused {
|
|
1618
|
+
[super setAccessibilityFocused:focused];
|
|
1619
|
+
}
|
|
1620
|
+
|
|
1604
1621
|
- (BOOL)accessibilityIsAttributeSettable:(NSAccessibilityAttributeName)attribute {
|
|
1605
|
-
if (self.accessibilityEnabled && [attribute isEqualToString:NSAccessibilityValueAttribute]) {
|
|
1622
|
+
if (self.surfaceView && self.accessibilityEnabled && [attribute isEqualToString:NSAccessibilityValueAttribute]) {
|
|
1606
1623
|
return (self.actionFlags & NATIVE_SDK_APPKIT_WIDGET_ACTION_SET_TEXT) != 0;
|
|
1607
1624
|
}
|
|
1608
|
-
if (self.accessibilityEnabled &&
|
|
1625
|
+
if (self.surfaceView && self.accessibilityEnabled &&
|
|
1609
1626
|
([attribute isEqualToString:NSAccessibilitySelectedTextRangeAttribute] ||
|
|
1610
1627
|
[attribute isEqualToString:NSAccessibilitySelectedTextRangesAttribute])) {
|
|
1611
1628
|
return (self.actionFlags & NATIVE_SDK_APPKIT_WIDGET_ACTION_SET_SELECTION) != 0;
|
|
@@ -1627,7 +1644,7 @@ static const uint32_t NativeSdkWidgetPressActionFlags =
|
|
|
1627
1644
|
}
|
|
1628
1645
|
|
|
1629
1646
|
- (BOOL)emitSetTextAccessibilityValue:(id)value {
|
|
1630
|
-
if (!self.accessibilityEnabled || (self.actionFlags & NATIVE_SDK_APPKIT_WIDGET_ACTION_SET_TEXT) == 0) return NO;
|
|
1647
|
+
if (!self.surfaceView || !self.accessibilityEnabled || (self.actionFlags & NATIVE_SDK_APPKIT_WIDGET_ACTION_SET_TEXT) == 0) return NO;
|
|
1631
1648
|
NSString *text = @"";
|
|
1632
1649
|
if ([value isKindOfClass:[NSString class]]) {
|
|
1633
1650
|
text = (NSString *)value;
|
|
@@ -1642,7 +1659,7 @@ static const uint32_t NativeSdkWidgetPressActionFlags =
|
|
|
1642
1659
|
}
|
|
1643
1660
|
|
|
1644
1661
|
- (BOOL)emitSetSelectionAccessibilityValue:(id)value {
|
|
1645
|
-
if (!self.accessibilityEnabled || (self.actionFlags & NATIVE_SDK_APPKIT_WIDGET_ACTION_SET_SELECTION) == 0) return NO;
|
|
1662
|
+
if (!self.surfaceView || !self.accessibilityEnabled || (self.actionFlags & NATIVE_SDK_APPKIT_WIDGET_ACTION_SET_SELECTION) == 0) return NO;
|
|
1646
1663
|
NSRange selectedRange = NSMakeRange(NSNotFound, 0);
|
|
1647
1664
|
if ([value isKindOfClass:[NSValue class]]) {
|
|
1648
1665
|
selectedRange = [(NSValue *)value rangeValue];
|
|
@@ -5812,13 +5829,46 @@ static BOOL NativeSdkCompositeBlurWriteRegion(NSDictionary *command, CGFloat sca
|
|
|
5812
5829
|
}
|
|
5813
5830
|
|
|
5814
5831
|
- (void)updateWidgetAccessibilityWithNodes:(const native_sdk_appkit_widget_accessibility_node_t *)nodes count:(NSUInteger)count {
|
|
5832
|
+
NSArray<NativeSdkWidgetAccessibilityElement *> *previous = (id)(self.widgetAccessibilityElements ?: @[]);
|
|
5815
5833
|
if (!nodes || count == 0) {
|
|
5834
|
+
for (NativeSdkWidgetAccessibilityElement *element in previous) {
|
|
5835
|
+
element.surfaceView = nil;
|
|
5836
|
+
element.actionFlags = 0;
|
|
5837
|
+
element.canUndo = NO;
|
|
5838
|
+
element.canRedo = NO;
|
|
5839
|
+
[element publishAccessibilityFocused:NO];
|
|
5840
|
+
element.accessibilityEnabled = NO;
|
|
5841
|
+
element.accessibilityParent = nil;
|
|
5842
|
+
element.accessibilityChildren = @[];
|
|
5843
|
+
}
|
|
5816
5844
|
self.widgetAccessibilityElements = @[];
|
|
5817
5845
|
self.widgetAccessibilityRootElements = @[];
|
|
5818
|
-
NSAccessibilityPostNotification(self, NSAccessibilityLayoutChangedNotification);
|
|
5846
|
+
if (previous.count > 0) NSAccessibilityPostNotification(self, NSAccessibilityLayoutChangedNotification);
|
|
5819
5847
|
return;
|
|
5820
5848
|
}
|
|
5821
5849
|
|
|
5850
|
+
// Reuse each unique, nonzero widget identity within this surface. Duplicate
|
|
5851
|
+
// and anonymous ids remain independent elements, preserving their ordering.
|
|
5852
|
+
NSMutableDictionary<NSNumber *, NativeSdkWidgetAccessibilityElement *> *previousById = [NSMutableDictionary dictionaryWithCapacity:previous.count];
|
|
5853
|
+
NSMutableSet<NSNumber *> *ambiguousIds = [NSMutableSet set];
|
|
5854
|
+
for (NativeSdkWidgetAccessibilityElement *element in previous) {
|
|
5855
|
+
NSNumber *key = @(element.widgetId);
|
|
5856
|
+
if (previousById[key]) [ambiguousIds addObject:key];
|
|
5857
|
+
previousById[key] = element;
|
|
5858
|
+
}
|
|
5859
|
+
NSMutableSet<NSNumber *> *incomingIds = [NSMutableSet set];
|
|
5860
|
+
for (NSUInteger i = 0; i < count; i++) {
|
|
5861
|
+
NSNumber *key = @(nodes[i].id);
|
|
5862
|
+
if ([incomingIds containsObject:key]) [ambiguousIds addObject:key];
|
|
5863
|
+
[incomingIds addObject:key];
|
|
5864
|
+
}
|
|
5865
|
+
NativeSdkWidgetAccessibilityElement *defaults = [[NativeSdkWidgetAccessibilityElement alloc] init];
|
|
5866
|
+
BOOL layoutChanged = previous.count != count;
|
|
5867
|
+
NSMutableArray<NativeSdkWidgetAccessibilityElement *> *valueChangedElements = [NSMutableArray array];
|
|
5868
|
+
NSMutableArray<NativeSdkWidgetAccessibilityElement *> *titleChangedElements = [NSMutableArray array];
|
|
5869
|
+
NSMutableArray<NativeSdkWidgetAccessibilityElement *> *focusedElements = [NSMutableArray array];
|
|
5870
|
+
NSMutableArray<NativeSdkWidgetAccessibilityElement *> *selectionChangedElements = [NSMutableArray array];
|
|
5871
|
+
BOOL focusChanged = NO;
|
|
5822
5872
|
NSMutableArray<NativeSdkWidgetAccessibilityElement *> *elements = [NSMutableArray arrayWithCapacity:count];
|
|
5823
5873
|
NSMutableArray<NSNumber *> *parentIds = [NSMutableArray arrayWithCapacity:count];
|
|
5824
5874
|
NSMutableDictionary<NSNumber *, NativeSdkWidgetAccessibilityElement *> *elementsById = [NSMutableDictionary dictionaryWithCapacity:count];
|
|
@@ -5828,7 +5878,52 @@ static BOOL NativeSdkCompositeBlurWriteRegion(NSDictionary *command, CGFloat sca
|
|
|
5828
5878
|
NSString *textValue = NativeSdkStringFromBytes(node.text_value, node.text_value_len) ?: @"";
|
|
5829
5879
|
NSString *placeholder = NativeSdkStringFromBytes(node.placeholder, node.placeholder_len) ?: @"";
|
|
5830
5880
|
NSString *name = label.length > 0 ? label : textValue;
|
|
5831
|
-
|
|
5881
|
+
NSNumber *key = @(node.id);
|
|
5882
|
+
NativeSdkWidgetAccessibilityElement *element = node.id != 0 && ![ambiguousIds containsObject:key] ? previousById[key] : nil;
|
|
5883
|
+
BOOL reused = element != nil;
|
|
5884
|
+
if (!element) element = [[NativeSdkWidgetAccessibilityElement alloc] init];
|
|
5885
|
+
id previousValue = element.accessibilityValue;
|
|
5886
|
+
NSString *previousLabel = element.accessibilityLabel;
|
|
5887
|
+
NSString *previousPlaceholder = element.accessibilityPlaceholderValue;
|
|
5888
|
+
NSString *previousDescription = element.accessibilityValueDescription;
|
|
5889
|
+
id previousMin = element.accessibilityMinValue, previousMax = element.accessibilityMaxValue;
|
|
5890
|
+
BOOL previousExpanded = element.accessibilityExpanded;
|
|
5891
|
+
BOOL previousRequired = element.accessibilityRequired;
|
|
5892
|
+
BOOL previousUndo = element.canUndo, previousRedo = element.canRedo;
|
|
5893
|
+
NSInteger previousCharacters = element.accessibilityNumberOfCharacters;
|
|
5894
|
+
NSRange previousVisible = element.accessibilityVisibleCharacterRange;
|
|
5895
|
+
NSString *previousSelectedText = element.accessibilitySelectedText;
|
|
5896
|
+
NSInteger previousRows = element.accessibilityRowCount, previousColumns = element.accessibilityColumnCount, previousIndex = element.accessibilityIndex;
|
|
5897
|
+
NSRange previousRowRange = element.accessibilityRowIndexRange, previousColumnRange = element.accessibilityColumnIndexRange;
|
|
5898
|
+
NSString *previousRole = element.accessibilityRole;
|
|
5899
|
+
NSRange previousSelection = element.accessibilitySelectedTextRange;
|
|
5900
|
+
BOOL previousFocused = element.accessibilityFocused;
|
|
5901
|
+
BOOL previousSelected = element.accessibilitySelected;
|
|
5902
|
+
BOOL previousEnabled = element.accessibilityEnabled;
|
|
5903
|
+
uint32_t previousActions = element.actionFlags;
|
|
5904
|
+
NSRect previousFrame = element.surfaceFrame;
|
|
5905
|
+
if (!reused || index >= previous.count || previous[index] != element) layoutChanged = YES;
|
|
5906
|
+
// Optional fields must return to exactly the fresh-element defaults.
|
|
5907
|
+
// Reusing an editor as a label must not retain selection or scroll data.
|
|
5908
|
+
element.accessibilityValue = defaults.accessibilityValue;
|
|
5909
|
+
element.accessibilityValueDescription = defaults.accessibilityValueDescription;
|
|
5910
|
+
element.accessibilityMinValue = defaults.accessibilityMinValue;
|
|
5911
|
+
element.accessibilityMaxValue = defaults.accessibilityMaxValue;
|
|
5912
|
+
element.accessibilityRowCount = defaults.accessibilityRowCount;
|
|
5913
|
+
element.accessibilityColumnCount = defaults.accessibilityColumnCount;
|
|
5914
|
+
element.accessibilityRowIndexRange = defaults.accessibilityRowIndexRange;
|
|
5915
|
+
element.accessibilityColumnIndexRange = defaults.accessibilityColumnIndexRange;
|
|
5916
|
+
element.accessibilityIndex = defaults.accessibilityIndex;
|
|
5917
|
+
element.accessibilityNumberOfCharacters = defaults.accessibilityNumberOfCharacters;
|
|
5918
|
+
element.accessibilityVisibleCharacterRange = defaults.accessibilityVisibleCharacterRange;
|
|
5919
|
+
element.accessibilitySelectedTextRange = defaults.accessibilitySelectedTextRange;
|
|
5920
|
+
element.accessibilitySelectedTextRanges = defaults.accessibilitySelectedTextRanges;
|
|
5921
|
+
element.accessibilitySelectedText = defaults.accessibilitySelectedText;
|
|
5922
|
+
element.accessibilityInsertionPointLineNumber = defaults.accessibilityInsertionPointLineNumber;
|
|
5923
|
+
element.accessibilityExpanded = defaults.accessibilityExpanded;
|
|
5924
|
+
if ([element respondsToSelector:@selector(setAccessibilityPlaceholderValue:)]) {
|
|
5925
|
+
element.accessibilityPlaceholderValue = defaults.accessibilityPlaceholderValue;
|
|
5926
|
+
}
|
|
5832
5927
|
element.surfaceView = self;
|
|
5833
5928
|
element.widgetId = node.id;
|
|
5834
5929
|
element.actionFlags = node.action_flags;
|
|
@@ -5885,7 +5980,7 @@ static BOOL NativeSdkCompositeBlurWriteRegion(NSDictionary *command, CGFloat sca
|
|
|
5885
5980
|
}
|
|
5886
5981
|
}
|
|
5887
5982
|
element.accessibilityEnabled = (node.state_flags & NATIVE_SDK_APPKIT_WIDGET_STATE_ENABLED) != 0;
|
|
5888
|
-
element
|
|
5983
|
+
[element publishAccessibilityFocused:(node.state_flags & NATIVE_SDK_APPKIT_WIDGET_STATE_FOCUSED) != 0];
|
|
5889
5984
|
element.accessibilitySelected = (node.state_flags & NATIVE_SDK_APPKIT_WIDGET_STATE_SELECTED) != 0;
|
|
5890
5985
|
element.canUndo = (node.state_flags & NATIVE_SDK_APPKIT_WIDGET_STATE_CAN_UNDO) != 0;
|
|
5891
5986
|
element.canRedo = (node.state_flags & NATIVE_SDK_APPKIT_WIDGET_STATE_CAN_REDO) != 0;
|
|
@@ -5910,6 +6005,14 @@ static BOOL NativeSdkCompositeBlurWriteRegion(NSDictionary *command, CGFloat sca
|
|
|
5910
6005
|
CGFloat nativeY = self.bounds.size.height - node.y - node.height;
|
|
5911
6006
|
element.surfaceFrame = NSMakeRect(node.x, nativeY, node.width, node.height);
|
|
5912
6007
|
element.accessibilityFrameInParentSpace = element.surfaceFrame;
|
|
6008
|
+
if (reused) {
|
|
6009
|
+
if (![previousRole isEqual:element.accessibilityRole] || previousEnabled != element.accessibilityEnabled || previousActions != element.actionFlags || !NSEqualRects(previousFrame, element.surfaceFrame) || previousRows != element.accessibilityRowCount || previousColumns != element.accessibilityColumnCount || previousIndex != element.accessibilityIndex || !NSEqualRanges(previousRowRange, element.accessibilityRowIndexRange) || !NSEqualRanges(previousColumnRange, element.accessibilityColumnIndexRange)) layoutChanged = YES;
|
|
6010
|
+
if (!NativeSdkAccessibilityValuesEqual(previousLabel, element.accessibilityLabel) || !NativeSdkAccessibilityValuesEqual(previousPlaceholder, element.accessibilityPlaceholderValue)) [titleChangedElements addObject:element];
|
|
6011
|
+
if (!NativeSdkAccessibilityValuesEqual(previousValue, element.accessibilityValue) || !NativeSdkAccessibilityValuesEqual(previousDescription, element.accessibilityValueDescription) || !NativeSdkAccessibilityValuesEqual(previousMin, element.accessibilityMinValue) || !NativeSdkAccessibilityValuesEqual(previousMax, element.accessibilityMaxValue) || previousSelected != element.accessibilitySelected || previousExpanded != element.accessibilityExpanded || previousRequired != element.accessibilityRequired || previousUndo != element.canUndo || previousRedo != element.canRedo || previousCharacters != element.accessibilityNumberOfCharacters || !NSEqualRanges(previousVisible, element.accessibilityVisibleCharacterRange)) [valueChangedElements addObject:element];
|
|
6012
|
+
if (!NSEqualRanges(previousSelection, element.accessibilitySelectedTextRange) || !NativeSdkAccessibilityValuesEqual(previousSelectedText, element.accessibilitySelectedText)) [selectionChangedElements addObject:element];
|
|
6013
|
+
}
|
|
6014
|
+
if (previousFocused != element.accessibilityFocused) focusChanged = YES;
|
|
6015
|
+
if (!previousFocused && element.accessibilityFocused) [focusedElements addObject:element];
|
|
5913
6016
|
[elements addObject:element];
|
|
5914
6017
|
[parentIds addObject:@(node.parent_id)];
|
|
5915
6018
|
[elementsById setObject:element forKey:@(node.id)];
|
|
@@ -5922,6 +6025,7 @@ static BOOL NativeSdkCompositeBlurWriteRegion(NSDictionary *command, CGFloat sca
|
|
|
5922
6025
|
NSNumber *parentId = parentIds[index];
|
|
5923
6026
|
NativeSdkWidgetAccessibilityElement *parent = parentId.unsignedLongLongValue == 0 ? nil : [elementsById objectForKey:parentId];
|
|
5924
6027
|
if (parent && parent != element) {
|
|
6028
|
+
if (element.accessibilityParent != parent) layoutChanged = YES;
|
|
5925
6029
|
element.accessibilityParent = parent;
|
|
5926
6030
|
NSRect parentFrame = parent.surfaceFrame;
|
|
5927
6031
|
NSRect childFrame = element.surfaceFrame;
|
|
@@ -5938,17 +6042,35 @@ static BOOL NativeSdkCompositeBlurWriteRegion(NSDictionary *command, CGFloat sca
|
|
|
5938
6042
|
}
|
|
5939
6043
|
[children addObject:element];
|
|
5940
6044
|
} else {
|
|
6045
|
+
if (element.accessibilityParent != self) layoutChanged = YES;
|
|
5941
6046
|
element.accessibilityParent = self;
|
|
5942
6047
|
[rootElements addObject:element];
|
|
5943
6048
|
}
|
|
5944
6049
|
}
|
|
5945
|
-
for (
|
|
5946
|
-
|
|
5947
|
-
|
|
6050
|
+
for (NativeSdkWidgetAccessibilityElement *element in elements) {
|
|
6051
|
+
element.accessibilityChildren = elementsById[@(element.widgetId)] == element ? (childrenByParentId[@(element.widgetId)] ?: defaults.accessibilityChildren) : defaults.accessibilityChildren;
|
|
6052
|
+
}
|
|
6053
|
+
for (NativeSdkWidgetAccessibilityElement *element in previous) {
|
|
6054
|
+
if ([elements indexOfObjectIdenticalTo:element] != NSNotFound) continue;
|
|
6055
|
+
element.surfaceView = nil;
|
|
6056
|
+
element.actionFlags = 0;
|
|
6057
|
+
element.canUndo = NO;
|
|
6058
|
+
element.canRedo = NO;
|
|
6059
|
+
[element publishAccessibilityFocused:NO];
|
|
6060
|
+
element.accessibilityEnabled = NO;
|
|
6061
|
+
element.accessibilityParent = nil;
|
|
6062
|
+
element.accessibilityChildren = @[];
|
|
5948
6063
|
}
|
|
5949
6064
|
self.widgetAccessibilityElements = elements;
|
|
5950
6065
|
self.widgetAccessibilityRootElements = rootElements;
|
|
5951
|
-
|
|
6066
|
+
// Content updates keep the graph stable and announce only changed content.
|
|
6067
|
+
// Assistive clients can retain a control while playback updates its value.
|
|
6068
|
+
if (layoutChanged) NSAccessibilityPostNotification(self, NSAccessibilityLayoutChangedNotification);
|
|
6069
|
+
for (NativeSdkWidgetAccessibilityElement *element in titleChangedElements) NSAccessibilityPostNotification(element, NSAccessibilityTitleChangedNotification);
|
|
6070
|
+
for (NativeSdkWidgetAccessibilityElement *element in valueChangedElements) NSAccessibilityPostNotification(element, NSAccessibilityValueChangedNotification);
|
|
6071
|
+
for (NativeSdkWidgetAccessibilityElement *element in selectionChangedElements) NSAccessibilityPostNotification(element, NSAccessibilitySelectedTextChangedNotification);
|
|
6072
|
+
for (NativeSdkWidgetAccessibilityElement *element in focusedElements) NSAccessibilityPostNotification(element, NSAccessibilityFocusedUIElementChangedNotification);
|
|
6073
|
+
if (focusChanged && focusedElements.count == 0) NSAccessibilityPostNotification(self, NSAccessibilityFocusedUIElementChangedNotification);
|
|
5952
6074
|
}
|
|
5953
6075
|
|
|
5954
6076
|
- (void)stopDisplayTimer {
|
|
@@ -6664,7 +6786,11 @@ static BOOL NativeSdkCompositeBlurWriteRegion(NSDictionary *command, CGFloat sca
|
|
|
6664
6786
|
// focused terminal needs the modifiers even more: its emulator
|
|
6665
6787
|
// translates the natural macOS gestures to shell bindings, and
|
|
6666
6788
|
// negotiated key protocols must see every other combined chord.
|
|
6667
|
-
|
|
6789
|
+
// Enter's modifiers choose newline versus submission. Cocoa's
|
|
6790
|
+
// insertNewline: selector discards them; preserve the physical
|
|
6791
|
+
// gesture unless an IME owns Return to commit marked text.
|
|
6792
|
+
BOOL rawEnter = ![self hasMarkedText] && [NativeSdkShortcutKeyForEvent(event) isEqualToString:@"enter"];
|
|
6793
|
+
if (rawEnter || NativeSdkTextNavigationNeedsRawKeyEvent(event)) {
|
|
6668
6794
|
[self emitInputEventWithKind:NATIVE_SDK_APPKIT_GPU_INPUT_KEY_DOWN event:event button:0 deltaX:0 deltaY:0];
|
|
6669
6795
|
return;
|
|
6670
6796
|
}
|
|
@@ -6912,6 +7038,7 @@ static double NativeSdkClampedPinchMagnification(double magnification) {
|
|
|
6912
7038
|
// GPU_SURFACE_SCROLL_DRIVER events.
|
|
6913
7039
|
|
|
6914
7040
|
- (void)setScrollDrivers:(const native_sdk_appkit_scroll_driver_t *)drivers count:(NSUInteger)count occluders:(const native_sdk_appkit_scroll_occluder_t *)occluders occluderCount:(NSUInteger)occluderCount {
|
|
7041
|
+
self.reconcilingScrollDrivers = YES;
|
|
6915
7042
|
if (!self.scrollDrivers) self.scrollDrivers = [[NSMutableArray alloc] init];
|
|
6916
7043
|
// Occluder rects arrive in canvas coordinates (top-left origin,
|
|
6917
7044
|
// y-down); store them flipped into this view's space, like the
|
|
@@ -7009,6 +7136,7 @@ static double NativeSdkClampedPinchMagnification(double magnification) {
|
|
|
7009
7136
|
[ordered addObject:driver];
|
|
7010
7137
|
}
|
|
7011
7138
|
self.scrollDrivers = ordered;
|
|
7139
|
+
self.reconcilingScrollDrivers = NO;
|
|
7012
7140
|
}
|
|
7013
7141
|
|
|
7014
7142
|
// Per-axis programmatic offset write: an axis the runtime did not move
|
|
@@ -7138,6 +7266,22 @@ static BOOL NativeSdkScrollDriverCanConsumeHorizontally(NativeSdkScrollDriverVie
|
|
|
7138
7266
|
NSClipView *clipView = note.object;
|
|
7139
7267
|
for (NativeSdkScrollDriverView *driver in self.scrollDrivers) {
|
|
7140
7268
|
if (driver.contentView != clipView) continue;
|
|
7269
|
+
// Resizing several documents can flush another driver's pending
|
|
7270
|
+
// report. That callback rebuilds the app and re-enters this sync,
|
|
7271
|
+
// overwriting reports and retained geometry from the outer push.
|
|
7272
|
+
// Report resize constraints after the full push settles, reading
|
|
7273
|
+
// the live origin so an intervening source write stays authoritative.
|
|
7274
|
+
if (self.reconcilingScrollDrivers) {
|
|
7275
|
+
__weak NativeSdkMetalSurfaceView *weakSelf = self;
|
|
7276
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
7277
|
+
NativeSdkMetalSurfaceView *strongSelf = weakSelf;
|
|
7278
|
+
if (!strongSelf || driver.superview != strongSelf) return;
|
|
7279
|
+
[strongSelf queueScrollDriverEventWithId:driver.driverId
|
|
7280
|
+
offsetX:driver.contentView.bounds.origin.x
|
|
7281
|
+
offsetY:driver.contentView.bounds.origin.y];
|
|
7282
|
+
});
|
|
7283
|
+
return;
|
|
7284
|
+
}
|
|
7141
7285
|
[self queueScrollDriverEventWithId:driver.driverId offsetX:clipView.bounds.origin.x offsetY:clipView.bounds.origin.y];
|
|
7142
7286
|
return;
|
|
7143
7287
|
}
|
|
@@ -7192,6 +7336,21 @@ static BOOL NativeSdkScrollDriverCanConsumeHorizontally(NativeSdkScrollDriverVie
|
|
|
7192
7336
|
- (void)emitInputEventWithKind:(NSInteger)kind point:(NSPoint)point timestampNs:(uint64_t)timestampNs modifiers:(uint32_t)modifiers keyText:(NSString *)keyText inputText:(NSString *)inputText button:(NSInteger)button deltaX:(double)deltaX deltaY:(double)deltaY {
|
|
7193
7337
|
if (!self.host || self.surfaceLabel.length == 0) return;
|
|
7194
7338
|
const NSPoint yDownPoint = NativeSdkViewLocalYDownPoint(self, point);
|
|
7339
|
+
// Coalesced motion retains its latest absolute point. Derive drag deltas
|
|
7340
|
+
// from the last emitted point so a batch preserves every pixel of travel.
|
|
7341
|
+
if (kind == NATIVE_SDK_APPKIT_GPU_INPUT_POINTER_DOWN) {
|
|
7342
|
+
self.pointerDragInputActive = YES;
|
|
7343
|
+
self.pointerDragInputPoint = yDownPoint;
|
|
7344
|
+
self.pointerDragInputButton = button;
|
|
7345
|
+
} else if (kind == NATIVE_SDK_APPKIT_GPU_INPUT_POINTER_DRAG &&
|
|
7346
|
+
self.pointerDragInputActive && self.pointerDragInputButton == button) {
|
|
7347
|
+
deltaX = yDownPoint.x - self.pointerDragInputPoint.x;
|
|
7348
|
+
deltaY = yDownPoint.y - self.pointerDragInputPoint.y;
|
|
7349
|
+
self.pointerDragInputPoint = yDownPoint;
|
|
7350
|
+
} else if (kind == NATIVE_SDK_APPKIT_GPU_INPUT_POINTER_CANCEL ||
|
|
7351
|
+
(kind == NATIVE_SDK_APPKIT_GPU_INPUT_POINTER_UP && self.pointerDragInputButton == button)) {
|
|
7352
|
+
self.pointerDragInputActive = NO;
|
|
7353
|
+
}
|
|
7195
7354
|
const char *labelBytes = self.surfaceLabel.UTF8String ?: "";
|
|
7196
7355
|
NSString *safeKeyText = keyText ?: @"";
|
|
7197
7356
|
NSString *safeInputText = inputText ?: @"";
|
|
@@ -11031,17 +11190,16 @@ static int NativeSdkSpectrumComputeBands(native_sdk_spectrum_tap_state_t *state,
|
|
|
11031
11190
|
* bin, matching how a bar analyzer reads (an average would smear
|
|
11032
11191
|
* narrow tones into invisibility). Bin 0 (DC) never contributes. */
|
|
11033
11192
|
const double ratio = NATIVE_SDK_SPECTRUM_HIGH_HZ / NATIVE_SDK_SPECTRUM_LOW_HZ;
|
|
11034
|
-
const double hz_per_bin = sample_rate / (double)NATIVE_SDK_SPECTRUM_FFT_SIZE;
|
|
11035
11193
|
for (int band = 0; band < NATIVE_SDK_APPKIT_AUDIO_SPECTRUM_BANDS; band += 1) {
|
|
11036
11194
|
const double low_hz = NATIVE_SDK_SPECTRUM_LOW_HZ * pow(ratio, (double)band / NATIVE_SDK_APPKIT_AUDIO_SPECTRUM_BANDS);
|
|
11037
11195
|
const double high_hz = NATIVE_SDK_SPECTRUM_LOW_HZ * pow(ratio, (double)(band + 1) / NATIVE_SDK_APPKIT_AUDIO_SPECTRUM_BANDS);
|
|
11038
|
-
|
|
11039
|
-
|
|
11040
|
-
|
|
11041
|
-
|
|
11042
|
-
|
|
11196
|
+
native_sdk_spectrum_bin_range_t bins;
|
|
11197
|
+
if (!native_sdk_spectrum_bin_range(low_hz, high_hz, sample_rate, NATIVE_SDK_SPECTRUM_FFT_SIZE, &bins)) {
|
|
11198
|
+
bands[band] = 0;
|
|
11199
|
+
continue;
|
|
11200
|
+
}
|
|
11043
11201
|
float peak = 0.0f;
|
|
11044
|
-
for (int bin =
|
|
11202
|
+
for (int bin = bins.first; bin <= bins.last; bin += 1) {
|
|
11045
11203
|
if (power[bin] > peak) peak = power[bin];
|
|
11046
11204
|
}
|
|
11047
11205
|
const float amplitude = 2.0f * sqrtf(peak) / (float)NATIVE_SDK_SPECTRUM_FFT_SIZE;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/* Exercise production AppKit coalescing and pointer emission without a window.
|
|
2
|
+
* Absolute drag samples must retain lossless y-down geometry deltas. */
|
|
3
|
+
#import "appkit_host.m"
|
|
4
|
+
#include <assert.h>
|
|
5
|
+
|
|
6
|
+
/* These unrelated host services are implemented by Zig in apps. */
|
|
7
|
+
native_sdk_update_verify_result_t native_sdk_update_verify_feed(
|
|
8
|
+
const char *envelope, size_t envelope_len,
|
|
9
|
+
const char *public_key, size_t public_key_len,
|
|
10
|
+
const char *bundle_id, size_t bundle_id_len,
|
|
11
|
+
const char *current_version, size_t current_version_len,
|
|
12
|
+
const char *target, size_t target_len,
|
|
13
|
+
char *version_out, size_t version_capacity,
|
|
14
|
+
char *archive_url_out, size_t archive_url_capacity,
|
|
15
|
+
char *release_notes_out, size_t release_notes_capacity) {
|
|
16
|
+
abort();
|
|
17
|
+
}
|
|
18
|
+
int native_sdk_update_verify_archive(const char *path, size_t path_len, uint64_t expected_bytes, const char *sha256, size_t sha256_len) {
|
|
19
|
+
abort();
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@interface NativeSdkPointerHostProbe : NativeSdkAppKitHost
|
|
23
|
+
@property(nonatomic, assign) NSUInteger inputs;
|
|
24
|
+
@property(nonatomic, assign) native_sdk_appkit_event_t lastInput;
|
|
25
|
+
@end
|
|
26
|
+
@implementation NativeSdkPointerHostProbe
|
|
27
|
+
- (void)emitEvent:(native_sdk_appkit_event_t)event {
|
|
28
|
+
if (event.kind == NATIVE_SDK_APPKIT_EVENT_GPU_SURFACE_INPUT) {
|
|
29
|
+
self.inputs += 1;
|
|
30
|
+
self.lastInput = event;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
@end
|
|
34
|
+
|
|
35
|
+
@interface NativeSdkPointerProbe : NativeSdkMetalSurfaceView
|
|
36
|
+
@end
|
|
37
|
+
@implementation NativeSdkPointerProbe
|
|
38
|
+
- (void)requestRetainedCanvasFrame {}
|
|
39
|
+
@end
|
|
40
|
+
|
|
41
|
+
static NSPoint rawPoint(NativeSdkPointerProbe *probe, double x, double y) {
|
|
42
|
+
return NSMakePoint(x, probe.isFlipped ? y : probe.bounds.size.height - y);
|
|
43
|
+
}
|
|
44
|
+
static void emit(NativeSdkPointerProbe *probe, NSInteger kind, double x, double y, NSInteger button) {
|
|
45
|
+
[probe emitInputEventWithKind:kind point:rawPoint(probe, x, y) timestampNs:1
|
|
46
|
+
modifiers:0 keyText:@"" inputText:@"" button:button deltaX:0 deltaY:0];
|
|
47
|
+
}
|
|
48
|
+
static void queue(NativeSdkPointerProbe *probe, double x, double y) {
|
|
49
|
+
NSEvent *event = [NSEvent mouseEventWithType:NSEventTypeLeftMouseDragged
|
|
50
|
+
location:rawPoint(probe, x, y) modifierFlags:0 timestamp:0
|
|
51
|
+
windowNumber:0 context:nil eventNumber:1 clickCount:1 pressure:1];
|
|
52
|
+
[probe queuePointerMotionInputEvent:event kind:NATIVE_SDK_APPKIT_GPU_INPUT_POINTER_DRAG button:0];
|
|
53
|
+
}
|
|
54
|
+
static void expect(NativeSdkPointerHostProbe *host, double x, double y, double dx, double dy) {
|
|
55
|
+
const native_sdk_appkit_event_t event = host.lastInput;
|
|
56
|
+
assert(event.x == x && event.y == y);
|
|
57
|
+
assert(event.delta_x == dx && event.delta_y == dy);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
int main(void) {
|
|
61
|
+
@autoreleasepool {
|
|
62
|
+
[NSApplication sharedApplication];
|
|
63
|
+
NativeSdkPointerHostProbe *host = [NativeSdkPointerHostProbe new];
|
|
64
|
+
NativeSdkPointerProbe *probe = [[NativeSdkPointerProbe alloc] initWithFrame:NSMakeRect(0, 0, 600, 600)];
|
|
65
|
+
probe.host = host;
|
|
66
|
+
probe.surfaceLabel = @"canvas";
|
|
67
|
+
emit(probe, NATIVE_SDK_APPKIT_GPU_INPUT_POINTER_DOWN, 120, 200, 0);
|
|
68
|
+
expect(host, 120, 200, 0, 0);
|
|
69
|
+
queue(probe, 130.25, 210.5);
|
|
70
|
+
queue(probe, 150.5, 205.25);
|
|
71
|
+
assert(host.inputs == 1);
|
|
72
|
+
[probe emitQueuedPointerMotionInputEvent];
|
|
73
|
+
assert(host.inputs == 2);
|
|
74
|
+
expect(host, 150.5, 205.25, 30.5, 5.25);
|
|
75
|
+
queue(probe, 144.25, 198);
|
|
76
|
+
[probe emitQueuedPointerMotionInputEvent];
|
|
77
|
+
expect(host, 144.25, 198, -6.25, -7.25);
|
|
78
|
+
emit(probe, NATIVE_SDK_APPKIT_GPU_INPUT_POINTER_UP, 144.25, 198, 0);
|
|
79
|
+
emit(probe, NATIVE_SDK_APPKIT_GPU_INPUT_POINTER_DRAG, 900, 900, 0);
|
|
80
|
+
expect(host, 900, 900, 0, 0);
|
|
81
|
+
// A new gesture resets its baseline; another button cannot advance it.
|
|
82
|
+
emit(probe, NATIVE_SDK_APPKIT_GPU_INPUT_POINTER_DOWN, 30, 40, 0);
|
|
83
|
+
emit(probe, NATIVE_SDK_APPKIT_GPU_INPUT_POINTER_DRAG, 100, 100, 1);
|
|
84
|
+
expect(host, 100, 100, 0, 0);
|
|
85
|
+
emit(probe, NATIVE_SDK_APPKIT_GPU_INPUT_POINTER_DRAG, 31, 43, 0);
|
|
86
|
+
expect(host, 31, 43, 1, 3);
|
|
87
|
+
emit(probe, NATIVE_SDK_APPKIT_GPU_INPUT_POINTER_CANCEL, 31, 43, 0);
|
|
88
|
+
emit(probe, NATIVE_SDK_APPKIT_GPU_INPUT_POINTER_DRAG, 150, 200, 0);
|
|
89
|
+
expect(host, 150, 200, 0, 0);
|
|
90
|
+
// Secondary-button drags use the same point/delta convention.
|
|
91
|
+
emit(probe, NATIVE_SDK_APPKIT_GPU_INPUT_POINTER_DOWN, 60, 70, 1);
|
|
92
|
+
emit(probe, NATIVE_SDK_APPKIT_GPU_INPUT_POINTER_DRAG, 50, 65, 1);
|
|
93
|
+
expect(host, 50, 65, -10, -5);
|
|
94
|
+
}
|
|
95
|
+
return 0;
|
|
96
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/* Exercise production NSScrollView reconciliation without opening a window.
|
|
2
|
+
* Native resize reports must not re-enter the runtime during a driver push. */
|
|
3
|
+
#import "appkit_host.m"
|
|
4
|
+
#include <assert.h>
|
|
5
|
+
|
|
6
|
+
/* These unrelated host services are implemented by Zig in apps. */
|
|
7
|
+
native_sdk_update_verify_result_t native_sdk_update_verify_feed(
|
|
8
|
+
const char *envelope, size_t envelope_len,
|
|
9
|
+
const char *public_key, size_t public_key_len,
|
|
10
|
+
const char *bundle_id, size_t bundle_id_len,
|
|
11
|
+
const char *current_version, size_t current_version_len,
|
|
12
|
+
const char *target, size_t target_len,
|
|
13
|
+
char *version_out, size_t version_capacity,
|
|
14
|
+
char *archive_url_out, size_t archive_url_capacity,
|
|
15
|
+
char *release_notes_out, size_t release_notes_capacity) {
|
|
16
|
+
abort();
|
|
17
|
+
}
|
|
18
|
+
int native_sdk_update_verify_archive(const char *path, size_t path_len, uint64_t expected_bytes, const char *sha256, size_t sha256_len) {
|
|
19
|
+
abort();
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@interface NativeSdkScrollProbe : NativeSdkMetalSurfaceView
|
|
23
|
+
@property(nonatomic, assign) BOOL pushing;
|
|
24
|
+
@property(nonatomic, strong) NSMutableDictionary<NSNumber *, NSValue *> *reports;
|
|
25
|
+
@end
|
|
26
|
+
@implementation NativeSdkScrollProbe
|
|
27
|
+
- (void)queueScrollDriverEventWithId:(uint64_t)driverId offsetX:(double)offsetX offsetY:(double)offsetY {
|
|
28
|
+
assert(!self.pushing);
|
|
29
|
+
self.reports[@(driverId)] = [NSValue valueWithPoint:NSMakePoint(offsetX, offsetY)];
|
|
30
|
+
}
|
|
31
|
+
@end
|
|
32
|
+
|
|
33
|
+
static void push(NativeSdkScrollProbe *probe, native_sdk_appkit_scroll_driver_t *drivers, NSUInteger count) {
|
|
34
|
+
probe.pushing = YES;
|
|
35
|
+
[probe setScrollDrivers:drivers count:count occluders:NULL occluderCount:0];
|
|
36
|
+
probe.pushing = NO;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
static void drain(void) {
|
|
40
|
+
[[NSRunLoop mainRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.02]];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
int main(void) {
|
|
44
|
+
@autoreleasepool {
|
|
45
|
+
[NSApplication sharedApplication];
|
|
46
|
+
NativeSdkScrollProbe *probe = [[NativeSdkScrollProbe alloc] initWithFrame:NSMakeRect(0, 0, 1060, 720)];
|
|
47
|
+
probe.reports = [NSMutableDictionary new];
|
|
48
|
+
native_sdk_appkit_scroll_driver_t full[] = {
|
|
49
|
+
{ .driver_id = 1, .width = 714, .height = 310, .content_width = 900, .content_height = 772, .offset_x = 186, .offset_y = 462, .scrolls_x = 1, .scrolls_y = 1 },
|
|
50
|
+
{ .driver_id = 2, .parent_driver_id = 1, .width = 714, .height = 100, .content_width = 900, .content_height = 210, .offset_y = 110, .scrolls_y = 1 },
|
|
51
|
+
{ .driver_id = 3, .width = 714, .height = 110, .content_width = 1524, .content_height = 110, .offset_x = 810, .scrolls_x = 1 },
|
|
52
|
+
};
|
|
53
|
+
push(probe, full, 3);
|
|
54
|
+
drain();
|
|
55
|
+
[probe.reports removeAllObjects];
|
|
56
|
+
native_sdk_appkit_scroll_driver_t empty[3];
|
|
57
|
+
memcpy(empty, full, sizeof(empty));
|
|
58
|
+
for (NSUInteger i = 0; i < 3; i += 1) {
|
|
59
|
+
empty[i].content_width = empty[i].width;
|
|
60
|
+
empty[i].content_height = empty[i].height;
|
|
61
|
+
}
|
|
62
|
+
push(probe, empty, 3);
|
|
63
|
+
assert(probe.reports.count == 0);
|
|
64
|
+
drain();
|
|
65
|
+
assert(probe.reports.count == 3);
|
|
66
|
+
for (NSUInteger i = 0; i < 3; i += 1) {
|
|
67
|
+
assert(NSEqualPoints(probe.scrollDrivers[i].contentView.bounds.origin, NSZeroPoint));
|
|
68
|
+
assert(NSEqualPoints(probe.reports[@(i + 1)].pointValue, NSZeroPoint));
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// A source write before deferred reporting wins over the old resize
|
|
72
|
+
// origin. Removing a keyed region drops its pending resize report.
|
|
73
|
+
for (NSUInteger i = 0; i < 3; i += 1) {
|
|
74
|
+
full[i].set_offset_x = 1;
|
|
75
|
+
full[i].set_offset_y = 1;
|
|
76
|
+
}
|
|
77
|
+
push(probe, full, 3);
|
|
78
|
+
drain();
|
|
79
|
+
[probe.reports removeAllObjects];
|
|
80
|
+
push(probe, empty, 3);
|
|
81
|
+
full[0].offset_x = 40.5;
|
|
82
|
+
full[0].offset_y = 25.25;
|
|
83
|
+
push(probe, full, 2);
|
|
84
|
+
drain();
|
|
85
|
+
assert(NSEqualPoints(probe.reports[@1].pointValue, NSMakePoint(40.5, 25.25)));
|
|
86
|
+
assert(probe.reports[@3] == nil);
|
|
87
|
+
|
|
88
|
+
// An unchanged layout push preserves position and does not report
|
|
89
|
+
// a programmatic echo. Elasticity follows the granted axes.
|
|
90
|
+
full[0].rubber_band = 1;
|
|
91
|
+
push(probe, full, 1);
|
|
92
|
+
drain();
|
|
93
|
+
const NSPoint retained = probe.scrollDrivers[0].contentView.bounds.origin;
|
|
94
|
+
assert(probe.scrollDrivers[0].horizontalScrollElasticity == NSScrollElasticityAllowed);
|
|
95
|
+
assert(probe.scrollDrivers[0].verticalScrollElasticity == NSScrollElasticityAllowed);
|
|
96
|
+
[probe.reports removeAllObjects];
|
|
97
|
+
full[0].set_offset_x = 0;
|
|
98
|
+
full[0].set_offset_y = 0;
|
|
99
|
+
push(probe, full, 1);
|
|
100
|
+
drain();
|
|
101
|
+
assert(NSEqualPoints(probe.scrollDrivers[0].contentView.bounds.origin, retained));
|
|
102
|
+
assert(probe.reports.count == 0);
|
|
103
|
+
}
|
|
104
|
+
return 0;
|
|
105
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#ifndef NATIVE_SDK_SPECTRUM_BINS_H
|
|
2
|
+
#define NATIVE_SDK_SPECTRUM_BINS_H
|
|
3
|
+
|
|
4
|
+
#include <math.h>
|
|
5
|
+
|
|
6
|
+
typedef struct native_sdk_spectrum_bin_range {
|
|
7
|
+
int first;
|
|
8
|
+
int last;
|
|
9
|
+
} native_sdk_spectrum_bin_range_t;
|
|
10
|
+
|
|
11
|
+
/* FFT power has fft_size / 2 entries; bin 0 is DC and the Nyquist bin
|
|
12
|
+
* is not present. Return 0 for a band wholly beyond that range. */
|
|
13
|
+
static inline int native_sdk_spectrum_bin_range(
|
|
14
|
+
double low_hz,
|
|
15
|
+
double high_hz,
|
|
16
|
+
double sample_rate,
|
|
17
|
+
int fft_size,
|
|
18
|
+
native_sdk_spectrum_bin_range_t *range
|
|
19
|
+
) {
|
|
20
|
+
const double nyquist_hz = sample_rate / 2.0;
|
|
21
|
+
if (low_hz >= nyquist_hz) return 0;
|
|
22
|
+
|
|
23
|
+
const int max_bin = fft_size / 2 - 1;
|
|
24
|
+
const double hz_per_bin = sample_rate / (double)fft_size;
|
|
25
|
+
int first = (int)(low_hz / hz_per_bin);
|
|
26
|
+
int last = high_hz >= nyquist_hz ? max_bin : (int)ceil(high_hz / hz_per_bin);
|
|
27
|
+
if (first < 1) first = 1;
|
|
28
|
+
if (last > max_bin) last = max_bin;
|
|
29
|
+
if (last < first) last = first;
|
|
30
|
+
*range = (native_sdk_spectrum_bin_range_t){ .first = first, .last = last };
|
|
31
|
+
return 1;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
#endif
|