@native-sdk/cli 0.10.1 → 0.11.1
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 +393 -97
- package/build/corewire.zig +53 -0
- package/build/test_shards.zig +49 -0
- package/build/ts_run.mjs +3 -3
- package/build.zig +2030 -83
- package/native-sdk.d.ts +5 -1
- package/package.json +20 -14
- package/packages/core/compile-surface/core.ts +164 -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 +68 -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 +332 -5
- package/packages/core/sdk/core.ts +371 -85
- package/packages/core/sdk/events.d.ts +252 -0
- package/packages/core/sdk/events.ts +240 -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 +186 -19
- package/packages/core/src/cli.ts +2 -11
- 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/context_menus.ts +76 -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/diagnostics.ts +7 -0
- package/packages/core/src/effect_plans.ts +71 -0
- package/packages/core/src/extent_program.ts +53 -0
- package/packages/core/src/flow_measurement.ts +121 -0
- package/packages/core/src/font_registry.ts +37 -0
- package/packages/core/src/frontend.ts +12 -10
- 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_canonical.ts +140 -0
- package/packages/core/src/markup_construction.ts +189 -0
- package/packages/core/src/markup_development.ts +160 -0
- package/packages/core/src/markup_display.ts +43 -0
- package/packages/core/src/markup_document.ts +226 -0
- package/packages/core/src/markup_elements.ts +225 -0
- package/packages/core/src/markup_expressions.ts +79 -0
- package/packages/core/src/markup_imports.ts +146 -0
- package/packages/core/src/markup_parser.ts +228 -0
- package/packages/core/src/markup_runtime.ts +93 -0
- package/packages/core/src/markup_scalars.ts +143 -0
- package/packages/core/src/markup_shapes.ts +243 -0
- package/packages/core/src/markup_specialized.ts +242 -0
- package/packages/core/src/markup_text.ts +86 -0
- package/packages/core/src/markup_values.ts +336 -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 +98 -0
- package/packages/core/src/portable_sources.ts +17 -0
- package/packages/core/src/registered_font.ts +92 -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 +3954 -0
- package/packages/core/src/scalar_text.ts +82 -0
- package/packages/core/src/scroll_mutation.ts +86 -0
- package/packages/core/src/scroll_tree.ts +86 -0
- package/packages/core/src/service_contract.ts +55 -3
- 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 +14 -46
- package/packages/core/src/sqlite_codegen.ts +84 -0
- package/packages/core/src/staged_rebuild.ts +60 -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_bridge.ts +161 -0
- package/packages/core/src/view_check.ts +145 -0
- package/packages/core/src/view_components.ts +2415 -0
- package/packages/core/src/view_coordination.ts +198 -0
- package/packages/core/src/view_evaluator.ts +823 -0
- package/packages/core/src/view_frontend.ts +1102 -0
- package/packages/core/src/view_program.ts +221 -0
- package/packages/core/src/view_reload.ts +166 -0
- package/packages/core/src/view_reload_watch.ts +98 -0
- package/packages/core/src/view_sources.ts +34 -0
- package/packages/core/src/virtual_windows.ts +88 -0
- package/packages/core/src/web_panes.ts +67 -0
- package/packages/core/src/widget_audits.ts +202 -0
- package/packages/core/src/widget_changes.ts +258 -0
- package/packages/core/src/widget_continuity.ts +37 -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_reconcile.ts +63 -0
- package/packages/core/src/widget_retention.ts +62 -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 +77 -18
- package/skill-data/ts-core/SKILL.md +117 -11
- package/skill-data/ts-services/SKILL.md +1 -1
- package/skill-data/ts-services/references/service-surface.md +288 -144
- package/src/app_runner/root.zig +39 -12
- package/src/app_runner/ts_compiled_view.zig +1702 -0
- package/src/app_runner/ts_core_main.zig +185 -14
- package/src/app_runner/ts_core_mobile.zig +25 -13
- package/src/automation/server.zig +57 -6
- 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/embed/host.zig +2 -0
- package/src/embed/tests.zig +2 -0
- package/src/embed/ui_host.zig +2 -0
- package/src/platform/keyboard_input.zig +32 -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 +4 -0
- package/src/platform/macos/appkit_host.h +7 -2
- package/src/platform/macos/appkit_host.m +219 -39
- package/src/platform/macos/cef_host.mm +15 -1
- package/src/platform/macos/global_shortcuts.zig +138 -0
- package/src/platform/macos/key_codes.zig +102 -0
- package/src/platform/macos/keyboard_input.zig +81 -0
- package/src/platform/macos/pointer_motion_test.m +96 -0
- package/src/platform/macos/root.zig +25 -3
- 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/webview_inspection_test.m +106 -0
- package/src/platform/macos/widget_focus_test.m +66 -0
- package/src/platform/null_platform.zig +130 -2
- package/src/platform/null_platform_tests.zig +13 -0
- package/src/platform/root.zig +15 -0
- package/src/platform/types.zig +115 -0
- package/src/platform/windows/global_shortcuts.zig +157 -0
- package/src/platform/windows/key_codes.zig +63 -0
- package/src/platform/windows/keyboard_input.zig +136 -0
- package/src/platform/windows/root.zig +17 -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/decision_reuse.zig +133 -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/font_ttf.zig +27 -3
- package/src/primitives/canvas/fonts/Geist-Bold.ttf +0 -0
- package/src/primitives/canvas/fonts/Geist-Medium.ttf +0 -0
- package/src/primitives/canvas/fonts/OFL.txt +93 -0
- package/src/primitives/canvas/fonts/README.md +15 -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 +131 -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/markdown_tests.zig +3 -3
- 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 +15 -11
- package/src/primitives/canvas/reference_tests.zig +58 -0
- 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 +107 -4
- 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 +53 -37
- package/src/primitives/canvas/text_metrics_tests.zig +52 -7
- package/src/primitives/canvas/text_query_policy.zig +295 -0
- package/src/primitives/canvas/text_run_policy.zig +252 -0
- package/src/primitives/canvas/text_scalar_policy.zig +234 -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 +47 -0
- package/src/primitives/canvas/ui.zig +251 -83
- package/src/primitives/canvas/ui_markup.zig +207 -46
- package/src/primitives/canvas/ui_markup_canonical.zig +237 -0
- package/src/primitives/canvas/ui_markup_compiled.zig +1724 -80
- package/src/primitives/canvas/ui_markup_compiled_tests.zig +225 -0
- package/src/primitives/canvas/ui_markup_compiled_values.zig +76 -0
- package/src/primitives/canvas/ui_markup_construction.zig +146 -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_display.zig +82 -0
- package/src/primitives/canvas/ui_markup_document.zig +196 -0
- package/src/primitives/canvas/ui_markup_elements.zig +163 -0
- package/src/primitives/canvas/ui_markup_expr.zig +192 -2
- package/src/primitives/canvas/ui_markup_imports.zig +262 -0
- package/src/primitives/canvas/ui_markup_parser.zig +117 -0
- package/src/primitives/canvas/ui_markup_reflect.zig +56 -0
- package/src/primitives/canvas/ui_markup_runtime.zig +76 -0
- package/src/primitives/canvas/ui_markup_scalars.zig +115 -0
- package/src/primitives/canvas/ui_markup_shapes.zig +224 -0
- package/src/primitives/canvas/ui_markup_specialized.zig +106 -0
- package/src/primitives/canvas/ui_markup_tests.zig +116 -0
- package/src/primitives/canvas/ui_markup_text.zig +128 -0
- package/src/primitives/canvas/ui_markup_values.zig +368 -0
- package/src/primitives/canvas/ui_markup_view.zig +3026 -57
- 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 +350 -0
- package/src/primitives/canvas/virtual_extents.zig +113 -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 +129 -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 +21 -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 +26 -0
- package/src/runtime/accessibility_policy.zig +122 -0
- package/src/runtime/api.zig +29 -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/bridge_payload.zig +2 -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 +183 -4
- package/src/runtime/canvas_widget_context_menu_test_cases.zig +1147 -0
- package/src/runtime/canvas_widget_context_menu_tests.zig +23 -1098
- 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 +720 -150
- 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/context_menu_policy.zig +112 -0
- package/src/runtime/core.zig +170 -6
- package/src/runtime/desktop_files.zig +189 -0
- package/src/runtime/effects.zig +638 -33
- package/src/runtime/effects_host_tests.zig +25 -0
- package/src/runtime/effects_tests.zig +28 -0
- package/src/runtime/file_policy_test_reference.zig +113 -0
- package/src/runtime/flow.zig +419 -341
- package/src/runtime/flow_reference.zig +1427 -0
- package/src/runtime/font_registry_policy.zig +72 -0
- package/src/runtime/frame_profile.zig +24 -33
- package/src/runtime/global_shortcuts.zig +75 -0
- 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/keyboard_input.zig +86 -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 +16 -0
- package/src/runtime/scroll_mutation_policy.zig +130 -0
- package/src/runtime/scroll_mutation_runtime.zig +158 -0
- package/src/runtime/scroll_tree_policy.zig +99 -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 +231 -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/staged_rebuild_policy.zig +83 -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 +65 -36
- package/src/runtime/tests.zig +2 -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 +2451 -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 +1111 -45
- package/src/runtime/ui_app.zig +1381 -650
- 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 +667 -188
- package/src/runtime/ui_app_window_tests.zig +222 -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_reload.zig +226 -0
- package/src/runtime/view_widget_control.zig +51 -14
- package/src/runtime/view_widget_scroll.zig +46 -26
- package/src/runtime/view_widget_text.zig +153 -68
- package/src/runtime/view_widget_tree.zig +503 -69
- package/src/runtime/virtual_window_policy.zig +128 -0
- package/src/runtime/web_pane_policy.zig +111 -0
- package/src/runtime/web_pane_test_cases.zig +204 -0
- package/src/runtime/webview_view_bridge_tests.zig +2 -0
- package/src/runtime/widget_continuity_policy.zig +73 -0
- package/src/runtime/widget_motion_policy.zig +238 -0
- package/src/runtime/widget_reconcile_policy.zig +81 -0
- package/src/runtime/widget_retention_policy.zig +75 -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 +179 -11
- package/src/security/root.zig +1 -0
- 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 +23 -3
- package/src/tooling/ts_core.zig +97 -4
- package/src/tooling/verbs.zig +87 -1
- 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 +188 -0
- package/tools/corewire/core_abi.zig +55 -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 +361 -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 +300 -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 +39 -0
- package/tools/corewire/intake_cases.ts +55 -0
- package/tools/corewire/intake_goldens.json +12237 -0
- package/tools/corewire/invocation.test.ts +28 -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 +59 -0
- package/tools/corewire/profile.test.ts +248 -0
- package/tools/corewire/profile.zig +56 -0
- package/tools/corewire/profile_emission.ts +204 -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 +269 -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;
|
|
@@ -1010,6 +1016,8 @@ static int NativeSdkCredentialStatus(OSStatus status, int missingCode) {
|
|
|
1010
1016
|
* menu items (Reload, Toggle Web Inspector, Undo/Redo) so canvas-only
|
|
1011
1017
|
* apps never ship menu items nothing answers. */
|
|
1012
1018
|
@property(nonatomic, assign) BOOL hasWebContent;
|
|
1019
|
+
/* Set before any WebView or default menu is created. */
|
|
1020
|
+
@property(nonatomic, assign) BOOL webViewInspection;
|
|
1013
1021
|
/* The decoded manifest icon (nil until the async decode lands, or when
|
|
1014
1022
|
* the file is missing). The About panel needs it passed explicitly:
|
|
1015
1023
|
* unbundled dev binaries have no bundle icon for the standard panel to
|
|
@@ -1055,7 +1063,7 @@ static int NativeSdkCredentialStatus(OSStatus status, int missingCode) {
|
|
|
1055
1063
|
@property(nonatomic, strong) NSArray<NSString *> *allowedNavigationOrigins;
|
|
1056
1064
|
@property(nonatomic, strong) NSArray<NSString *> *allowedExternalURLs;
|
|
1057
1065
|
@property(nonatomic, assign) NSInteger externalLinkAction;
|
|
1058
|
-
- (instancetype)initWithAppName:(NSString *)appName displayName:(NSString *)displayName version:(NSString *)version aboutDescription:(NSString *)aboutDescription hasWebContent:(BOOL)hasWebContent dockVisible:(BOOL)dockVisible windowTitle:(NSString *)windowTitle bundleIdentifier:(NSString *)bundleIdentifier iconPath:(NSString *)iconPath windowLabel:(NSString *)windowLabel x:(double)x y:(double)y width:(double)width height:(double)height restoreFrame:(BOOL)restoreFrame initialPlacement:(int)initialPlacement restorePolicy:(int)restorePolicy resizable:(BOOL)resizable titlebarStyle:(int)titlebarStyle showPolicy:(int)showPolicy windowFlags:(uint32_t)windowFlags;
|
|
1066
|
+
- (instancetype)initWithAppName:(NSString *)appName displayName:(NSString *)displayName version:(NSString *)version aboutDescription:(NSString *)aboutDescription hasWebContent:(BOOL)hasWebContent webViewInspection:(BOOL)webViewInspection dockVisible:(BOOL)dockVisible windowTitle:(NSString *)windowTitle bundleIdentifier:(NSString *)bundleIdentifier iconPath:(NSString *)iconPath windowLabel:(NSString *)windowLabel x:(double)x y:(double)y width:(double)width height:(double)height restoreFrame:(BOOL)restoreFrame initialPlacement:(int)initialPlacement restorePolicy:(int)restorePolicy resizable:(BOOL)resizable titlebarStyle:(int)titlebarStyle showPolicy:(int)showPolicy windowFlags:(uint32_t)windowFlags;
|
|
1059
1067
|
- (BOOL)createWindowWithId:(uint64_t)windowId title:(NSString *)title label:(NSString *)label x:(double)x y:(double)y width:(double)width height:(double)height restoreFrame:(BOOL)restoreFrame initialPlacement:(int)initialPlacement restorePolicy:(int)restorePolicy resizable:(BOOL)resizable titlebarStyle:(int)titlebarStyle showPolicy:(int)showPolicy windowFlags:(uint32_t)windowFlags makeMain:(BOOL)makeMain;
|
|
1060
1068
|
- (void)orderWindowForImplicitShow:(uint64_t)windowId;
|
|
1061
1069
|
- (void)showDeferredWindowIfPending:(uint64_t)windowId reason:(const char *)reason;
|
|
@@ -1501,6 +1509,10 @@ static NSPoint NativeSdkViewLocalYDownPoint(NSView *view, NSPoint point) {
|
|
|
1501
1509
|
|
|
1502
1510
|
@end
|
|
1503
1511
|
|
|
1512
|
+
static BOOL NativeSdkAccessibilityValuesEqual(id left, id right) {
|
|
1513
|
+
return left == right || [left isEqual:right];
|
|
1514
|
+
}
|
|
1515
|
+
|
|
1504
1516
|
@implementation NativeSdkWidgetAccessibilityElement
|
|
1505
1517
|
|
|
1506
1518
|
/* The action-flag gate for advertising AXPress: press, toggle, and
|
|
@@ -1515,7 +1527,7 @@ static const uint32_t NativeSdkWidgetPressActionFlags =
|
|
|
1515
1527
|
NATIVE_SDK_APPKIT_WIDGET_ACTION_SELECT;
|
|
1516
1528
|
|
|
1517
1529
|
- (NSArray *)accessibilityActionNames {
|
|
1518
|
-
if (!self.accessibilityEnabled) return @[];
|
|
1530
|
+
if (!self.surfaceView || !self.accessibilityEnabled) return @[];
|
|
1519
1531
|
NSMutableArray *actions = [NSMutableArray arrayWithCapacity:3];
|
|
1520
1532
|
if ((self.actionFlags & NativeSdkWidgetPressActionFlags) != 0) {
|
|
1521
1533
|
[actions addObject:NSAccessibilityPressAction];
|
|
@@ -1544,22 +1556,22 @@ static const uint32_t NativeSdkWidgetPressActionFlags =
|
|
|
1544
1556
|
* list instead of no-op'ing on invocation. */
|
|
1545
1557
|
- (BOOL)isAccessibilitySelectorAllowed:(SEL)selector {
|
|
1546
1558
|
if (selector == @selector(accessibilityPerformPress)) {
|
|
1547
|
-
return self.accessibilityEnabled && (self.actionFlags & NativeSdkWidgetPressActionFlags) != 0;
|
|
1559
|
+
return self.surfaceView && self.accessibilityEnabled && (self.actionFlags & NativeSdkWidgetPressActionFlags) != 0;
|
|
1548
1560
|
}
|
|
1549
1561
|
if (selector == @selector(accessibilityPerformIncrement)) {
|
|
1550
|
-
return self.accessibilityEnabled && (self.actionFlags & NATIVE_SDK_APPKIT_WIDGET_ACTION_INCREMENT) != 0;
|
|
1562
|
+
return self.surfaceView && self.accessibilityEnabled && (self.actionFlags & NATIVE_SDK_APPKIT_WIDGET_ACTION_INCREMENT) != 0;
|
|
1551
1563
|
}
|
|
1552
1564
|
if (selector == @selector(accessibilityPerformDecrement)) {
|
|
1553
|
-
return self.accessibilityEnabled && (self.actionFlags & NATIVE_SDK_APPKIT_WIDGET_ACTION_DECREMENT) != 0;
|
|
1565
|
+
return self.surfaceView && self.accessibilityEnabled && (self.actionFlags & NATIVE_SDK_APPKIT_WIDGET_ACTION_DECREMENT) != 0;
|
|
1554
1566
|
}
|
|
1555
1567
|
if (selector == @selector(accessibilityPerformCancel)) {
|
|
1556
|
-
return self.accessibilityEnabled && (self.actionFlags & NATIVE_SDK_APPKIT_WIDGET_ACTION_DISMISS) != 0;
|
|
1568
|
+
return self.surfaceView && self.accessibilityEnabled && (self.actionFlags & NATIVE_SDK_APPKIT_WIDGET_ACTION_DISMISS) != 0;
|
|
1557
1569
|
}
|
|
1558
1570
|
return [super isAccessibilitySelectorAllowed:selector];
|
|
1559
1571
|
}
|
|
1560
1572
|
|
|
1561
1573
|
- (BOOL)accessibilityPerformPress {
|
|
1562
|
-
if (!self.accessibilityEnabled) return NO;
|
|
1574
|
+
if (!self.surfaceView || !self.accessibilityEnabled) return NO;
|
|
1563
1575
|
if ((self.actionFlags & NATIVE_SDK_APPKIT_WIDGET_ACTION_TOGGLE) != 0) {
|
|
1564
1576
|
return [self.surfaceView emitWidgetAccessibilityActionWithId:self.widgetId action:NATIVE_SDK_APPKIT_WIDGET_ACCESSIBILITY_ACTION_TOGGLE];
|
|
1565
1577
|
}
|
|
@@ -1573,17 +1585,17 @@ static const uint32_t NativeSdkWidgetPressActionFlags =
|
|
|
1573
1585
|
}
|
|
1574
1586
|
|
|
1575
1587
|
- (BOOL)accessibilityPerformIncrement {
|
|
1576
|
-
if (!self.accessibilityEnabled || (self.actionFlags & NATIVE_SDK_APPKIT_WIDGET_ACTION_INCREMENT) == 0) return NO;
|
|
1588
|
+
if (!self.surfaceView || !self.accessibilityEnabled || (self.actionFlags & NATIVE_SDK_APPKIT_WIDGET_ACTION_INCREMENT) == 0) return NO;
|
|
1577
1589
|
return [self.surfaceView emitWidgetAccessibilityActionWithId:self.widgetId action:NATIVE_SDK_APPKIT_WIDGET_ACCESSIBILITY_ACTION_INCREMENT];
|
|
1578
1590
|
}
|
|
1579
1591
|
|
|
1580
1592
|
- (BOOL)accessibilityPerformDecrement {
|
|
1581
|
-
if (!self.accessibilityEnabled || (self.actionFlags & NATIVE_SDK_APPKIT_WIDGET_ACTION_DECREMENT) == 0) return NO;
|
|
1593
|
+
if (!self.surfaceView || !self.accessibilityEnabled || (self.actionFlags & NATIVE_SDK_APPKIT_WIDGET_ACTION_DECREMENT) == 0) return NO;
|
|
1582
1594
|
return [self.surfaceView emitWidgetAccessibilityActionWithId:self.widgetId action:NATIVE_SDK_APPKIT_WIDGET_ACCESSIBILITY_ACTION_DECREMENT];
|
|
1583
1595
|
}
|
|
1584
1596
|
|
|
1585
1597
|
- (BOOL)accessibilityPerformCancel {
|
|
1586
|
-
if (!self.accessibilityEnabled || (self.actionFlags & NATIVE_SDK_APPKIT_WIDGET_ACTION_DISMISS) == 0) return NO;
|
|
1598
|
+
if (!self.surfaceView || !self.accessibilityEnabled || (self.actionFlags & NATIVE_SDK_APPKIT_WIDGET_ACTION_DISMISS) == 0) return NO;
|
|
1587
1599
|
return [self.surfaceView emitWidgetAccessibilityActionWithId:self.widgetId action:NATIVE_SDK_APPKIT_WIDGET_ACCESSIBILITY_ACTION_DISMISS];
|
|
1588
1600
|
}
|
|
1589
1601
|
|
|
@@ -1596,16 +1608,23 @@ static const uint32_t NativeSdkWidgetPressActionFlags =
|
|
|
1596
1608
|
* reports the app's actual focus back. */
|
|
1597
1609
|
- (void)setAccessibilityFocused:(BOOL)focused {
|
|
1598
1610
|
[super setAccessibilityFocused:focused];
|
|
1599
|
-
if (!focused || !self.accessibilityEnabled) return;
|
|
1611
|
+
if (!self.surfaceView || !focused || !self.accessibilityEnabled) return;
|
|
1600
1612
|
if ((self.actionFlags & NATIVE_SDK_APPKIT_WIDGET_ACTION_FOCUS) == 0) return;
|
|
1601
1613
|
[self.surfaceView emitWidgetAccessibilityActionWithId:self.widgetId action:NATIVE_SDK_APPKIT_WIDGET_ACCESSIBILITY_ACTION_FOCUS];
|
|
1602
1614
|
}
|
|
1603
1615
|
|
|
1616
|
+
/* Publishing runtime state must not look like an assistive client writing
|
|
1617
|
+
* AXFocused. That feedback resets keyboard focus to programmatic focus and
|
|
1618
|
+
* makes plain list rows lose their Tab-established navigation contract. */
|
|
1619
|
+
- (void)publishAccessibilityFocused:(BOOL)focused {
|
|
1620
|
+
[super setAccessibilityFocused:focused];
|
|
1621
|
+
}
|
|
1622
|
+
|
|
1604
1623
|
- (BOOL)accessibilityIsAttributeSettable:(NSAccessibilityAttributeName)attribute {
|
|
1605
|
-
if (self.accessibilityEnabled && [attribute isEqualToString:NSAccessibilityValueAttribute]) {
|
|
1624
|
+
if (self.surfaceView && self.accessibilityEnabled && [attribute isEqualToString:NSAccessibilityValueAttribute]) {
|
|
1606
1625
|
return (self.actionFlags & NATIVE_SDK_APPKIT_WIDGET_ACTION_SET_TEXT) != 0;
|
|
1607
1626
|
}
|
|
1608
|
-
if (self.accessibilityEnabled &&
|
|
1627
|
+
if (self.surfaceView && self.accessibilityEnabled &&
|
|
1609
1628
|
([attribute isEqualToString:NSAccessibilitySelectedTextRangeAttribute] ||
|
|
1610
1629
|
[attribute isEqualToString:NSAccessibilitySelectedTextRangesAttribute])) {
|
|
1611
1630
|
return (self.actionFlags & NATIVE_SDK_APPKIT_WIDGET_ACTION_SET_SELECTION) != 0;
|
|
@@ -1627,7 +1646,7 @@ static const uint32_t NativeSdkWidgetPressActionFlags =
|
|
|
1627
1646
|
}
|
|
1628
1647
|
|
|
1629
1648
|
- (BOOL)emitSetTextAccessibilityValue:(id)value {
|
|
1630
|
-
if (!self.accessibilityEnabled || (self.actionFlags & NATIVE_SDK_APPKIT_WIDGET_ACTION_SET_TEXT) == 0) return NO;
|
|
1649
|
+
if (!self.surfaceView || !self.accessibilityEnabled || (self.actionFlags & NATIVE_SDK_APPKIT_WIDGET_ACTION_SET_TEXT) == 0) return NO;
|
|
1631
1650
|
NSString *text = @"";
|
|
1632
1651
|
if ([value isKindOfClass:[NSString class]]) {
|
|
1633
1652
|
text = (NSString *)value;
|
|
@@ -1642,7 +1661,7 @@ static const uint32_t NativeSdkWidgetPressActionFlags =
|
|
|
1642
1661
|
}
|
|
1643
1662
|
|
|
1644
1663
|
- (BOOL)emitSetSelectionAccessibilityValue:(id)value {
|
|
1645
|
-
if (!self.accessibilityEnabled || (self.actionFlags & NATIVE_SDK_APPKIT_WIDGET_ACTION_SET_SELECTION) == 0) return NO;
|
|
1664
|
+
if (!self.surfaceView || !self.accessibilityEnabled || (self.actionFlags & NATIVE_SDK_APPKIT_WIDGET_ACTION_SET_SELECTION) == 0) return NO;
|
|
1646
1665
|
NSRange selectedRange = NSMakeRange(NSNotFound, 0);
|
|
1647
1666
|
if ([value isKindOfClass:[NSValue class]]) {
|
|
1648
1667
|
selectedRange = [(NSValue *)value rangeValue];
|
|
@@ -5812,13 +5831,46 @@ static BOOL NativeSdkCompositeBlurWriteRegion(NSDictionary *command, CGFloat sca
|
|
|
5812
5831
|
}
|
|
5813
5832
|
|
|
5814
5833
|
- (void)updateWidgetAccessibilityWithNodes:(const native_sdk_appkit_widget_accessibility_node_t *)nodes count:(NSUInteger)count {
|
|
5834
|
+
NSArray<NativeSdkWidgetAccessibilityElement *> *previous = (id)(self.widgetAccessibilityElements ?: @[]);
|
|
5815
5835
|
if (!nodes || count == 0) {
|
|
5836
|
+
for (NativeSdkWidgetAccessibilityElement *element in previous) {
|
|
5837
|
+
element.surfaceView = nil;
|
|
5838
|
+
element.actionFlags = 0;
|
|
5839
|
+
element.canUndo = NO;
|
|
5840
|
+
element.canRedo = NO;
|
|
5841
|
+
[element publishAccessibilityFocused:NO];
|
|
5842
|
+
element.accessibilityEnabled = NO;
|
|
5843
|
+
element.accessibilityParent = nil;
|
|
5844
|
+
element.accessibilityChildren = @[];
|
|
5845
|
+
}
|
|
5816
5846
|
self.widgetAccessibilityElements = @[];
|
|
5817
5847
|
self.widgetAccessibilityRootElements = @[];
|
|
5818
|
-
NSAccessibilityPostNotification(self, NSAccessibilityLayoutChangedNotification);
|
|
5848
|
+
if (previous.count > 0) NSAccessibilityPostNotification(self, NSAccessibilityLayoutChangedNotification);
|
|
5819
5849
|
return;
|
|
5820
5850
|
}
|
|
5821
5851
|
|
|
5852
|
+
// Reuse each unique, nonzero widget identity within this surface. Duplicate
|
|
5853
|
+
// and anonymous ids remain independent elements, preserving their ordering.
|
|
5854
|
+
NSMutableDictionary<NSNumber *, NativeSdkWidgetAccessibilityElement *> *previousById = [NSMutableDictionary dictionaryWithCapacity:previous.count];
|
|
5855
|
+
NSMutableSet<NSNumber *> *ambiguousIds = [NSMutableSet set];
|
|
5856
|
+
for (NativeSdkWidgetAccessibilityElement *element in previous) {
|
|
5857
|
+
NSNumber *key = @(element.widgetId);
|
|
5858
|
+
if (previousById[key]) [ambiguousIds addObject:key];
|
|
5859
|
+
previousById[key] = element;
|
|
5860
|
+
}
|
|
5861
|
+
NSMutableSet<NSNumber *> *incomingIds = [NSMutableSet set];
|
|
5862
|
+
for (NSUInteger i = 0; i < count; i++) {
|
|
5863
|
+
NSNumber *key = @(nodes[i].id);
|
|
5864
|
+
if ([incomingIds containsObject:key]) [ambiguousIds addObject:key];
|
|
5865
|
+
[incomingIds addObject:key];
|
|
5866
|
+
}
|
|
5867
|
+
NativeSdkWidgetAccessibilityElement *defaults = [[NativeSdkWidgetAccessibilityElement alloc] init];
|
|
5868
|
+
BOOL layoutChanged = previous.count != count;
|
|
5869
|
+
NSMutableArray<NativeSdkWidgetAccessibilityElement *> *valueChangedElements = [NSMutableArray array];
|
|
5870
|
+
NSMutableArray<NativeSdkWidgetAccessibilityElement *> *titleChangedElements = [NSMutableArray array];
|
|
5871
|
+
NSMutableArray<NativeSdkWidgetAccessibilityElement *> *focusedElements = [NSMutableArray array];
|
|
5872
|
+
NSMutableArray<NativeSdkWidgetAccessibilityElement *> *selectionChangedElements = [NSMutableArray array];
|
|
5873
|
+
BOOL focusChanged = NO;
|
|
5822
5874
|
NSMutableArray<NativeSdkWidgetAccessibilityElement *> *elements = [NSMutableArray arrayWithCapacity:count];
|
|
5823
5875
|
NSMutableArray<NSNumber *> *parentIds = [NSMutableArray arrayWithCapacity:count];
|
|
5824
5876
|
NSMutableDictionary<NSNumber *, NativeSdkWidgetAccessibilityElement *> *elementsById = [NSMutableDictionary dictionaryWithCapacity:count];
|
|
@@ -5828,7 +5880,52 @@ static BOOL NativeSdkCompositeBlurWriteRegion(NSDictionary *command, CGFloat sca
|
|
|
5828
5880
|
NSString *textValue = NativeSdkStringFromBytes(node.text_value, node.text_value_len) ?: @"";
|
|
5829
5881
|
NSString *placeholder = NativeSdkStringFromBytes(node.placeholder, node.placeholder_len) ?: @"";
|
|
5830
5882
|
NSString *name = label.length > 0 ? label : textValue;
|
|
5831
|
-
|
|
5883
|
+
NSNumber *key = @(node.id);
|
|
5884
|
+
NativeSdkWidgetAccessibilityElement *element = node.id != 0 && ![ambiguousIds containsObject:key] ? previousById[key] : nil;
|
|
5885
|
+
BOOL reused = element != nil;
|
|
5886
|
+
if (!element) element = [[NativeSdkWidgetAccessibilityElement alloc] init];
|
|
5887
|
+
id previousValue = element.accessibilityValue;
|
|
5888
|
+
NSString *previousLabel = element.accessibilityLabel;
|
|
5889
|
+
NSString *previousPlaceholder = element.accessibilityPlaceholderValue;
|
|
5890
|
+
NSString *previousDescription = element.accessibilityValueDescription;
|
|
5891
|
+
id previousMin = element.accessibilityMinValue, previousMax = element.accessibilityMaxValue;
|
|
5892
|
+
BOOL previousExpanded = element.accessibilityExpanded;
|
|
5893
|
+
BOOL previousRequired = element.accessibilityRequired;
|
|
5894
|
+
BOOL previousUndo = element.canUndo, previousRedo = element.canRedo;
|
|
5895
|
+
NSInteger previousCharacters = element.accessibilityNumberOfCharacters;
|
|
5896
|
+
NSRange previousVisible = element.accessibilityVisibleCharacterRange;
|
|
5897
|
+
NSString *previousSelectedText = element.accessibilitySelectedText;
|
|
5898
|
+
NSInteger previousRows = element.accessibilityRowCount, previousColumns = element.accessibilityColumnCount, previousIndex = element.accessibilityIndex;
|
|
5899
|
+
NSRange previousRowRange = element.accessibilityRowIndexRange, previousColumnRange = element.accessibilityColumnIndexRange;
|
|
5900
|
+
NSString *previousRole = element.accessibilityRole;
|
|
5901
|
+
NSRange previousSelection = element.accessibilitySelectedTextRange;
|
|
5902
|
+
BOOL previousFocused = element.accessibilityFocused;
|
|
5903
|
+
BOOL previousSelected = element.accessibilitySelected;
|
|
5904
|
+
BOOL previousEnabled = element.accessibilityEnabled;
|
|
5905
|
+
uint32_t previousActions = element.actionFlags;
|
|
5906
|
+
NSRect previousFrame = element.surfaceFrame;
|
|
5907
|
+
if (!reused || index >= previous.count || previous[index] != element) layoutChanged = YES;
|
|
5908
|
+
// Optional fields must return to exactly the fresh-element defaults.
|
|
5909
|
+
// Reusing an editor as a label must not retain selection or scroll data.
|
|
5910
|
+
element.accessibilityValue = defaults.accessibilityValue;
|
|
5911
|
+
element.accessibilityValueDescription = defaults.accessibilityValueDescription;
|
|
5912
|
+
element.accessibilityMinValue = defaults.accessibilityMinValue;
|
|
5913
|
+
element.accessibilityMaxValue = defaults.accessibilityMaxValue;
|
|
5914
|
+
element.accessibilityRowCount = defaults.accessibilityRowCount;
|
|
5915
|
+
element.accessibilityColumnCount = defaults.accessibilityColumnCount;
|
|
5916
|
+
element.accessibilityRowIndexRange = defaults.accessibilityRowIndexRange;
|
|
5917
|
+
element.accessibilityColumnIndexRange = defaults.accessibilityColumnIndexRange;
|
|
5918
|
+
element.accessibilityIndex = defaults.accessibilityIndex;
|
|
5919
|
+
element.accessibilityNumberOfCharacters = defaults.accessibilityNumberOfCharacters;
|
|
5920
|
+
element.accessibilityVisibleCharacterRange = defaults.accessibilityVisibleCharacterRange;
|
|
5921
|
+
element.accessibilitySelectedTextRange = defaults.accessibilitySelectedTextRange;
|
|
5922
|
+
element.accessibilitySelectedTextRanges = defaults.accessibilitySelectedTextRanges;
|
|
5923
|
+
element.accessibilitySelectedText = defaults.accessibilitySelectedText;
|
|
5924
|
+
element.accessibilityInsertionPointLineNumber = defaults.accessibilityInsertionPointLineNumber;
|
|
5925
|
+
element.accessibilityExpanded = defaults.accessibilityExpanded;
|
|
5926
|
+
if ([element respondsToSelector:@selector(setAccessibilityPlaceholderValue:)]) {
|
|
5927
|
+
element.accessibilityPlaceholderValue = defaults.accessibilityPlaceholderValue;
|
|
5928
|
+
}
|
|
5832
5929
|
element.surfaceView = self;
|
|
5833
5930
|
element.widgetId = node.id;
|
|
5834
5931
|
element.actionFlags = node.action_flags;
|
|
@@ -5885,7 +5982,7 @@ static BOOL NativeSdkCompositeBlurWriteRegion(NSDictionary *command, CGFloat sca
|
|
|
5885
5982
|
}
|
|
5886
5983
|
}
|
|
5887
5984
|
element.accessibilityEnabled = (node.state_flags & NATIVE_SDK_APPKIT_WIDGET_STATE_ENABLED) != 0;
|
|
5888
|
-
element
|
|
5985
|
+
[element publishAccessibilityFocused:(node.state_flags & NATIVE_SDK_APPKIT_WIDGET_STATE_FOCUSED) != 0];
|
|
5889
5986
|
element.accessibilitySelected = (node.state_flags & NATIVE_SDK_APPKIT_WIDGET_STATE_SELECTED) != 0;
|
|
5890
5987
|
element.canUndo = (node.state_flags & NATIVE_SDK_APPKIT_WIDGET_STATE_CAN_UNDO) != 0;
|
|
5891
5988
|
element.canRedo = (node.state_flags & NATIVE_SDK_APPKIT_WIDGET_STATE_CAN_REDO) != 0;
|
|
@@ -5910,6 +6007,14 @@ static BOOL NativeSdkCompositeBlurWriteRegion(NSDictionary *command, CGFloat sca
|
|
|
5910
6007
|
CGFloat nativeY = self.bounds.size.height - node.y - node.height;
|
|
5911
6008
|
element.surfaceFrame = NSMakeRect(node.x, nativeY, node.width, node.height);
|
|
5912
6009
|
element.accessibilityFrameInParentSpace = element.surfaceFrame;
|
|
6010
|
+
if (reused) {
|
|
6011
|
+
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;
|
|
6012
|
+
if (!NativeSdkAccessibilityValuesEqual(previousLabel, element.accessibilityLabel) || !NativeSdkAccessibilityValuesEqual(previousPlaceholder, element.accessibilityPlaceholderValue)) [titleChangedElements addObject:element];
|
|
6013
|
+
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];
|
|
6014
|
+
if (!NSEqualRanges(previousSelection, element.accessibilitySelectedTextRange) || !NativeSdkAccessibilityValuesEqual(previousSelectedText, element.accessibilitySelectedText)) [selectionChangedElements addObject:element];
|
|
6015
|
+
}
|
|
6016
|
+
if (previousFocused != element.accessibilityFocused) focusChanged = YES;
|
|
6017
|
+
if (!previousFocused && element.accessibilityFocused) [focusedElements addObject:element];
|
|
5913
6018
|
[elements addObject:element];
|
|
5914
6019
|
[parentIds addObject:@(node.parent_id)];
|
|
5915
6020
|
[elementsById setObject:element forKey:@(node.id)];
|
|
@@ -5922,6 +6027,7 @@ static BOOL NativeSdkCompositeBlurWriteRegion(NSDictionary *command, CGFloat sca
|
|
|
5922
6027
|
NSNumber *parentId = parentIds[index];
|
|
5923
6028
|
NativeSdkWidgetAccessibilityElement *parent = parentId.unsignedLongLongValue == 0 ? nil : [elementsById objectForKey:parentId];
|
|
5924
6029
|
if (parent && parent != element) {
|
|
6030
|
+
if (element.accessibilityParent != parent) layoutChanged = YES;
|
|
5925
6031
|
element.accessibilityParent = parent;
|
|
5926
6032
|
NSRect parentFrame = parent.surfaceFrame;
|
|
5927
6033
|
NSRect childFrame = element.surfaceFrame;
|
|
@@ -5938,17 +6044,35 @@ static BOOL NativeSdkCompositeBlurWriteRegion(NSDictionary *command, CGFloat sca
|
|
|
5938
6044
|
}
|
|
5939
6045
|
[children addObject:element];
|
|
5940
6046
|
} else {
|
|
6047
|
+
if (element.accessibilityParent != self) layoutChanged = YES;
|
|
5941
6048
|
element.accessibilityParent = self;
|
|
5942
6049
|
[rootElements addObject:element];
|
|
5943
6050
|
}
|
|
5944
6051
|
}
|
|
5945
|
-
for (
|
|
5946
|
-
|
|
5947
|
-
|
|
6052
|
+
for (NativeSdkWidgetAccessibilityElement *element in elements) {
|
|
6053
|
+
element.accessibilityChildren = elementsById[@(element.widgetId)] == element ? (childrenByParentId[@(element.widgetId)] ?: defaults.accessibilityChildren) : defaults.accessibilityChildren;
|
|
6054
|
+
}
|
|
6055
|
+
for (NativeSdkWidgetAccessibilityElement *element in previous) {
|
|
6056
|
+
if ([elements indexOfObjectIdenticalTo:element] != NSNotFound) continue;
|
|
6057
|
+
element.surfaceView = nil;
|
|
6058
|
+
element.actionFlags = 0;
|
|
6059
|
+
element.canUndo = NO;
|
|
6060
|
+
element.canRedo = NO;
|
|
6061
|
+
[element publishAccessibilityFocused:NO];
|
|
6062
|
+
element.accessibilityEnabled = NO;
|
|
6063
|
+
element.accessibilityParent = nil;
|
|
6064
|
+
element.accessibilityChildren = @[];
|
|
5948
6065
|
}
|
|
5949
6066
|
self.widgetAccessibilityElements = elements;
|
|
5950
6067
|
self.widgetAccessibilityRootElements = rootElements;
|
|
5951
|
-
|
|
6068
|
+
// Content updates keep the graph stable and announce only changed content.
|
|
6069
|
+
// Assistive clients can retain a control while playback updates its value.
|
|
6070
|
+
if (layoutChanged) NSAccessibilityPostNotification(self, NSAccessibilityLayoutChangedNotification);
|
|
6071
|
+
for (NativeSdkWidgetAccessibilityElement *element in titleChangedElements) NSAccessibilityPostNotification(element, NSAccessibilityTitleChangedNotification);
|
|
6072
|
+
for (NativeSdkWidgetAccessibilityElement *element in valueChangedElements) NSAccessibilityPostNotification(element, NSAccessibilityValueChangedNotification);
|
|
6073
|
+
for (NativeSdkWidgetAccessibilityElement *element in selectionChangedElements) NSAccessibilityPostNotification(element, NSAccessibilitySelectedTextChangedNotification);
|
|
6074
|
+
for (NativeSdkWidgetAccessibilityElement *element in focusedElements) NSAccessibilityPostNotification(element, NSAccessibilityFocusedUIElementChangedNotification);
|
|
6075
|
+
if (focusChanged && focusedElements.count == 0) NSAccessibilityPostNotification(self, NSAccessibilityFocusedUIElementChangedNotification);
|
|
5952
6076
|
}
|
|
5953
6077
|
|
|
5954
6078
|
- (void)stopDisplayTimer {
|
|
@@ -6664,7 +6788,11 @@ static BOOL NativeSdkCompositeBlurWriteRegion(NSDictionary *command, CGFloat sca
|
|
|
6664
6788
|
// focused terminal needs the modifiers even more: its emulator
|
|
6665
6789
|
// translates the natural macOS gestures to shell bindings, and
|
|
6666
6790
|
// negotiated key protocols must see every other combined chord.
|
|
6667
|
-
|
|
6791
|
+
// Enter's modifiers choose newline versus submission. Cocoa's
|
|
6792
|
+
// insertNewline: selector discards them; preserve the physical
|
|
6793
|
+
// gesture unless an IME owns Return to commit marked text.
|
|
6794
|
+
BOOL rawEnter = ![self hasMarkedText] && [NativeSdkShortcutKeyForEvent(event) isEqualToString:@"enter"];
|
|
6795
|
+
if (rawEnter || NativeSdkTextNavigationNeedsRawKeyEvent(event)) {
|
|
6668
6796
|
[self emitInputEventWithKind:NATIVE_SDK_APPKIT_GPU_INPUT_KEY_DOWN event:event button:0 deltaX:0 deltaY:0];
|
|
6669
6797
|
return;
|
|
6670
6798
|
}
|
|
@@ -6912,6 +7040,7 @@ static double NativeSdkClampedPinchMagnification(double magnification) {
|
|
|
6912
7040
|
// GPU_SURFACE_SCROLL_DRIVER events.
|
|
6913
7041
|
|
|
6914
7042
|
- (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 {
|
|
7043
|
+
self.reconcilingScrollDrivers = YES;
|
|
6915
7044
|
if (!self.scrollDrivers) self.scrollDrivers = [[NSMutableArray alloc] init];
|
|
6916
7045
|
// Occluder rects arrive in canvas coordinates (top-left origin,
|
|
6917
7046
|
// y-down); store them flipped into this view's space, like the
|
|
@@ -7009,6 +7138,7 @@ static double NativeSdkClampedPinchMagnification(double magnification) {
|
|
|
7009
7138
|
[ordered addObject:driver];
|
|
7010
7139
|
}
|
|
7011
7140
|
self.scrollDrivers = ordered;
|
|
7141
|
+
self.reconcilingScrollDrivers = NO;
|
|
7012
7142
|
}
|
|
7013
7143
|
|
|
7014
7144
|
// Per-axis programmatic offset write: an axis the runtime did not move
|
|
@@ -7138,6 +7268,22 @@ static BOOL NativeSdkScrollDriverCanConsumeHorizontally(NativeSdkScrollDriverVie
|
|
|
7138
7268
|
NSClipView *clipView = note.object;
|
|
7139
7269
|
for (NativeSdkScrollDriverView *driver in self.scrollDrivers) {
|
|
7140
7270
|
if (driver.contentView != clipView) continue;
|
|
7271
|
+
// Resizing several documents can flush another driver's pending
|
|
7272
|
+
// report. That callback rebuilds the app and re-enters this sync,
|
|
7273
|
+
// overwriting reports and retained geometry from the outer push.
|
|
7274
|
+
// Report resize constraints after the full push settles, reading
|
|
7275
|
+
// the live origin so an intervening source write stays authoritative.
|
|
7276
|
+
if (self.reconcilingScrollDrivers) {
|
|
7277
|
+
__weak NativeSdkMetalSurfaceView *weakSelf = self;
|
|
7278
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
7279
|
+
NativeSdkMetalSurfaceView *strongSelf = weakSelf;
|
|
7280
|
+
if (!strongSelf || driver.superview != strongSelf) return;
|
|
7281
|
+
[strongSelf queueScrollDriverEventWithId:driver.driverId
|
|
7282
|
+
offsetX:driver.contentView.bounds.origin.x
|
|
7283
|
+
offsetY:driver.contentView.bounds.origin.y];
|
|
7284
|
+
});
|
|
7285
|
+
return;
|
|
7286
|
+
}
|
|
7141
7287
|
[self queueScrollDriverEventWithId:driver.driverId offsetX:clipView.bounds.origin.x offsetY:clipView.bounds.origin.y];
|
|
7142
7288
|
return;
|
|
7143
7289
|
}
|
|
@@ -7192,6 +7338,21 @@ static BOOL NativeSdkScrollDriverCanConsumeHorizontally(NativeSdkScrollDriverVie
|
|
|
7192
7338
|
- (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
7339
|
if (!self.host || self.surfaceLabel.length == 0) return;
|
|
7194
7340
|
const NSPoint yDownPoint = NativeSdkViewLocalYDownPoint(self, point);
|
|
7341
|
+
// Coalesced motion retains its latest absolute point. Derive drag deltas
|
|
7342
|
+
// from the last emitted point so a batch preserves every pixel of travel.
|
|
7343
|
+
if (kind == NATIVE_SDK_APPKIT_GPU_INPUT_POINTER_DOWN) {
|
|
7344
|
+
self.pointerDragInputActive = YES;
|
|
7345
|
+
self.pointerDragInputPoint = yDownPoint;
|
|
7346
|
+
self.pointerDragInputButton = button;
|
|
7347
|
+
} else if (kind == NATIVE_SDK_APPKIT_GPU_INPUT_POINTER_DRAG &&
|
|
7348
|
+
self.pointerDragInputActive && self.pointerDragInputButton == button) {
|
|
7349
|
+
deltaX = yDownPoint.x - self.pointerDragInputPoint.x;
|
|
7350
|
+
deltaY = yDownPoint.y - self.pointerDragInputPoint.y;
|
|
7351
|
+
self.pointerDragInputPoint = yDownPoint;
|
|
7352
|
+
} else if (kind == NATIVE_SDK_APPKIT_GPU_INPUT_POINTER_CANCEL ||
|
|
7353
|
+
(kind == NATIVE_SDK_APPKIT_GPU_INPUT_POINTER_UP && self.pointerDragInputButton == button)) {
|
|
7354
|
+
self.pointerDragInputActive = NO;
|
|
7355
|
+
}
|
|
7195
7356
|
const char *labelBytes = self.surfaceLabel.UTF8String ?: "";
|
|
7196
7357
|
NSString *safeKeyText = keyText ?: @"";
|
|
7197
7358
|
NSString *safeInputText = inputText ?: @"";
|
|
@@ -7927,7 +8088,7 @@ static float NativeSdkCaptureReadRemixedSample(const AudioBufferList *buffers, c
|
|
|
7927
8088
|
|
|
7928
8089
|
@implementation NativeSdkAppKitHost
|
|
7929
8090
|
|
|
7930
|
-
- (instancetype)initWithAppName:(NSString *)appName displayName:(NSString *)displayName version:(NSString *)version aboutDescription:(NSString *)aboutDescription hasWebContent:(BOOL)hasWebContent dockVisible:(BOOL)dockVisible windowTitle:(NSString *)windowTitle bundleIdentifier:(NSString *)bundleIdentifier iconPath:(NSString *)iconPath windowLabel:(NSString *)windowLabel x:(double)x y:(double)y width:(double)width height:(double)height restoreFrame:(BOOL)restoreFrame initialPlacement:(int)initialPlacement restorePolicy:(int)restorePolicy resizable:(BOOL)resizable titlebarStyle:(int)titlebarStyle showPolicy:(int)showPolicy windowFlags:(uint32_t)windowFlags {
|
|
8091
|
+
- (instancetype)initWithAppName:(NSString *)appName displayName:(NSString *)displayName version:(NSString *)version aboutDescription:(NSString *)aboutDescription hasWebContent:(BOOL)hasWebContent webViewInspection:(BOOL)webViewInspection dockVisible:(BOOL)dockVisible windowTitle:(NSString *)windowTitle bundleIdentifier:(NSString *)bundleIdentifier iconPath:(NSString *)iconPath windowLabel:(NSString *)windowLabel x:(double)x y:(double)y width:(double)width height:(double)height restoreFrame:(BOOL)restoreFrame initialPlacement:(int)initialPlacement restorePolicy:(int)restorePolicy resizable:(BOOL)resizable titlebarStyle:(int)titlebarStyle showPolicy:(int)showPolicy windowFlags:(uint32_t)windowFlags {
|
|
7931
8092
|
self = [super init];
|
|
7932
8093
|
if (!self) {
|
|
7933
8094
|
return nil;
|
|
@@ -7945,6 +8106,7 @@ static float NativeSdkCaptureReadRemixedSample(const AudioBufferList *buffers, c
|
|
|
7945
8106
|
self.appVersion = version ?: @"";
|
|
7946
8107
|
self.aboutDescription = aboutDescription ?: @"";
|
|
7947
8108
|
self.hasWebContent = hasWebContent;
|
|
8109
|
+
self.webViewInspection = webViewInspection;
|
|
7948
8110
|
NSString *configuredBundleIdentifier = bundleIdentifier.length > 0 ? bundleIdentifier : @"dev.native_sdk.app";
|
|
7949
8111
|
self.bundleIdentifier = NativeSdkPackagedBundleIdentifier() ?: configuredBundleIdentifier;
|
|
7950
8112
|
self.iconPath = iconPath ?: @"";
|
|
@@ -8484,7 +8646,7 @@ static float NativeSdkCaptureReadRemixedSample(const AudioBufferList *buffers, c
|
|
|
8484
8646
|
[userContentController addUserScript:bridgeScript];
|
|
8485
8647
|
configuration.userContentController = userContentController;
|
|
8486
8648
|
if ([configuration.preferences respondsToSelector:NSSelectorFromString(@"setDeveloperExtrasEnabled:")]) {
|
|
8487
|
-
[configuration.preferences setValue:@
|
|
8649
|
+
[configuration.preferences setValue:@(self.webViewInspection) forKey:@"developerExtrasEnabled"];
|
|
8488
8650
|
}
|
|
8489
8651
|
WKWebView *webView = [[NativeSdkWebView alloc] initWithFrame:container.bounds configuration:configuration];
|
|
8490
8652
|
((NativeSdkWebView *)webView).host = self;
|
|
@@ -8496,7 +8658,7 @@ static float NativeSdkCaptureReadRemixedSample(const AudioBufferList *buffers, c
|
|
|
8496
8658
|
webView.layer.backgroundColor = NSColor.clearColor.CGColor;
|
|
8497
8659
|
[webView setValue:@NO forKey:@"drawsBackground"];
|
|
8498
8660
|
if ([webView respondsToSelector:NSSelectorFromString(@"setInspectable:")]) {
|
|
8499
|
-
[webView setValue:@
|
|
8661
|
+
[webView setValue:@(self.webViewInspection) forKey:@"inspectable"];
|
|
8500
8662
|
}
|
|
8501
8663
|
webView.navigationDelegate = self;
|
|
8502
8664
|
webView.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
|
|
@@ -9167,7 +9329,7 @@ static float NativeSdkCaptureReadRemixedSample(const AudioBufferList *buffers, c
|
|
|
9167
9329
|
configuration.userContentController = controller;
|
|
9168
9330
|
}
|
|
9169
9331
|
if ([configuration.preferences respondsToSelector:NSSelectorFromString(@"setDeveloperExtrasEnabled:")]) {
|
|
9170
|
-
[configuration.preferences setValue:@
|
|
9332
|
+
[configuration.preferences setValue:@(self.webViewInspection) forKey:@"developerExtrasEnabled"];
|
|
9171
9333
|
}
|
|
9172
9334
|
|
|
9173
9335
|
WKWebView *webview = [[NativeSdkWebView alloc] initWithFrame:[self webViewFrameForWindow:window x:x y:y width:width height:height] configuration:configuration];
|
|
@@ -9182,7 +9344,7 @@ static float NativeSdkCaptureReadRemixedSample(const AudioBufferList *buffers, c
|
|
|
9182
9344
|
[webview setValue:@NO forKey:@"drawsBackground"];
|
|
9183
9345
|
}
|
|
9184
9346
|
if ([webview respondsToSelector:NSSelectorFromString(@"setInspectable:")]) {
|
|
9185
|
-
[webview setValue:@
|
|
9347
|
+
[webview setValue:@(self.webViewInspection) forKey:@"inspectable"];
|
|
9186
9348
|
}
|
|
9187
9349
|
webview.navigationDelegate = self;
|
|
9188
9350
|
webview.autoresizingMask = NSViewNotSizable;
|
|
@@ -9885,7 +10047,9 @@ static void NativeSdkApplyProcessDisplayName(NSString *displayName) {
|
|
|
9885
10047
|
[viewMenuItem setSubmenu:viewMenu];
|
|
9886
10048
|
if (self.hasWebContent) {
|
|
9887
10049
|
[viewMenu addItem:[self menuItem:@"Reload" action:@selector(reload:) key:@"r" modifiers:NSEventModifierFlagCommand]];
|
|
9888
|
-
|
|
10050
|
+
if (self.webViewInspection) {
|
|
10051
|
+
[viewMenu addItem:[self menuItem:@"Toggle Web Inspector" action:@selector(toggleWebInspector:) key:@"i" modifiers:(NSEventModifierFlagCommand | NSEventModifierFlagOption)]];
|
|
10052
|
+
}
|
|
9889
10053
|
[viewMenu addItem:[NSMenuItem separatorItem]];
|
|
9890
10054
|
}
|
|
9891
10055
|
[viewMenu addItem:[self menuItem:@"Enter Full Screen" action:@selector(toggleFullScreen:) key:@"f" modifiers:(NSEventModifierFlagCommand | NSEventModifierFlagControl)]];
|
|
@@ -11031,17 +11195,16 @@ static int NativeSdkSpectrumComputeBands(native_sdk_spectrum_tap_state_t *state,
|
|
|
11031
11195
|
* bin, matching how a bar analyzer reads (an average would smear
|
|
11032
11196
|
* narrow tones into invisibility). Bin 0 (DC) never contributes. */
|
|
11033
11197
|
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
11198
|
for (int band = 0; band < NATIVE_SDK_APPKIT_AUDIO_SPECTRUM_BANDS; band += 1) {
|
|
11036
11199
|
const double low_hz = NATIVE_SDK_SPECTRUM_LOW_HZ * pow(ratio, (double)band / NATIVE_SDK_APPKIT_AUDIO_SPECTRUM_BANDS);
|
|
11037
11200
|
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
|
-
|
|
11201
|
+
native_sdk_spectrum_bin_range_t bins;
|
|
11202
|
+
if (!native_sdk_spectrum_bin_range(low_hz, high_hz, sample_rate, NATIVE_SDK_SPECTRUM_FFT_SIZE, &bins)) {
|
|
11203
|
+
bands[band] = 0;
|
|
11204
|
+
continue;
|
|
11205
|
+
}
|
|
11043
11206
|
float peak = 0.0f;
|
|
11044
|
-
for (int bin =
|
|
11207
|
+
for (int bin = bins.first; bin <= bins.last; bin += 1) {
|
|
11045
11208
|
if (power[bin] > peak) peak = power[bin];
|
|
11046
11209
|
}
|
|
11047
11210
|
const float amplitude = 2.0f * sqrtf(peak) / (float)NATIVE_SDK_SPECTRUM_FFT_SIZE;
|
|
@@ -12694,6 +12857,7 @@ static void NativeSdkVideoFittedSize(double naturalWidth, double naturalHeight,
|
|
|
12694
12857
|
|
|
12695
12858
|
- (void)toggleWebInspector:(id)sender {
|
|
12696
12859
|
(void)sender;
|
|
12860
|
+
if (!self.webViewInspection) return;
|
|
12697
12861
|
WKWebView *webView = [self mainWebViewForWindow:NSApp.keyWindow];
|
|
12698
12862
|
if (!webView) return;
|
|
12699
12863
|
SEL selector = NSSelectorFromString(@"_showInspector");
|
|
@@ -12956,7 +13120,7 @@ static BOOL NativeSdkPolicyListMatches(NSArray<NSString *> *values, NSURL *url)
|
|
|
12956
13120
|
return NO;
|
|
12957
13121
|
}
|
|
12958
13122
|
|
|
12959
|
-
native_sdk_appkit_host_t *native_sdk_appkit_create(const char *app_name, size_t app_name_len, const char *display_name, size_t display_name_len, const char *version, size_t version_len, const char *about_description, size_t about_description_len, int has_web_content, int dock_visible, const char *window_title, size_t window_title_len, const char *bundle_id, size_t bundle_id_len, const char *icon_path, size_t icon_path_len, const char *window_label, size_t window_label_len, double x, double y, double width, double height, int restore_frame, int initial_placement, int restore_policy, int resizable, int titlebar_style, int show_policy, uint32_t window_flags) {
|
|
13123
|
+
native_sdk_appkit_host_t *native_sdk_appkit_create(const char *app_name, size_t app_name_len, const char *display_name, size_t display_name_len, const char *version, size_t version_len, const char *about_description, size_t about_description_len, int has_web_content, int webview_inspection, int dock_visible, const char *window_title, size_t window_title_len, const char *bundle_id, size_t bundle_id_len, const char *icon_path, size_t icon_path_len, const char *window_label, size_t window_label_len, double x, double y, double width, double height, int restore_frame, int initial_placement, int restore_policy, int resizable, int titlebar_style, int show_policy, uint32_t window_flags) {
|
|
12960
13124
|
@autoreleasepool {
|
|
12961
13125
|
NSString *appNameString = [[NSString alloc] initWithBytes:app_name length:app_name_len encoding:NSUTF8StringEncoding] ?: @"native-sdk";
|
|
12962
13126
|
NSString *displayNameString = [[NSString alloc] initWithBytes:display_name length:display_name_len encoding:NSUTF8StringEncoding] ?: @"";
|
|
@@ -12966,7 +13130,7 @@ native_sdk_appkit_host_t *native_sdk_appkit_create(const char *app_name, size_t
|
|
|
12966
13130
|
NSString *bundleIdString = [[NSString alloc] initWithBytes:bundle_id length:bundle_id_len encoding:NSUTF8StringEncoding] ?: @"dev.native_sdk.app";
|
|
12967
13131
|
NSString *iconPathString = [[NSString alloc] initWithBytes:icon_path length:icon_path_len encoding:NSUTF8StringEncoding] ?: @"";
|
|
12968
13132
|
NSString *windowLabelString = [[NSString alloc] initWithBytes:window_label length:window_label_len encoding:NSUTF8StringEncoding] ?: @"main";
|
|
12969
|
-
NativeSdkAppKitHost *host = [[NativeSdkAppKitHost alloc] initWithAppName:appNameString displayName:displayNameString version:versionString aboutDescription:aboutDescriptionString hasWebContent:(has_web_content != 0) dockVisible:(dock_visible != 0) windowTitle:windowTitleString bundleIdentifier:bundleIdString iconPath:iconPathString windowLabel:windowLabelString x:x y:y width:width height:height restoreFrame:(restore_frame != 0) initialPlacement:initial_placement restorePolicy:restore_policy resizable:(resizable != 0) titlebarStyle:titlebar_style showPolicy:show_policy windowFlags:window_flags];
|
|
13133
|
+
NativeSdkAppKitHost *host = [[NativeSdkAppKitHost alloc] initWithAppName:appNameString displayName:displayNameString version:versionString aboutDescription:aboutDescriptionString hasWebContent:(has_web_content != 0) webViewInspection:(webview_inspection != 0) dockVisible:(dock_visible != 0) windowTitle:windowTitleString bundleIdentifier:bundleIdString iconPath:iconPathString windowLabel:windowLabelString x:x y:y width:width height:height restoreFrame:(restore_frame != 0) initialPlacement:initial_placement restorePolicy:restore_policy resizable:(resizable != 0) titlebarStyle:titlebar_style showPolicy:show_policy windowFlags:window_flags];
|
|
12970
13134
|
return (__bridge_retained native_sdk_appkit_host_t *)host;
|
|
12971
13135
|
}
|
|
12972
13136
|
}
|
|
@@ -13331,6 +13495,22 @@ int native_sdk_appkit_focus_window(native_sdk_appkit_host_t *host, uint64_t wind
|
|
|
13331
13495
|
return 1;
|
|
13332
13496
|
}
|
|
13333
13497
|
|
|
13498
|
+
int native_sdk_appkit_set_window_color_scheme(native_sdk_appkit_host_t *host, uint64_t window_id, int color_scheme) {
|
|
13499
|
+
NativeSdkAppKitHost *object = (__bridge NativeSdkAppKitHost *)host;
|
|
13500
|
+
NSWindow *window = object.windows[@(window_id)];
|
|
13501
|
+
if (!window || color_scheme < 0 || color_scheme > 2) return 0;
|
|
13502
|
+
NSAppearance *appearance = color_scheme == 0 ? nil : [NSAppearance appearanceNamed:
|
|
13503
|
+
color_scheme == 2 ? NSAppearanceNameDarkAqua : NSAppearanceNameAqua];
|
|
13504
|
+
if (window.appearance == appearance || [window.appearance isEqual:appearance]) return 1;
|
|
13505
|
+
// Keep NSApp's effective appearance untouched: the runtime must still
|
|
13506
|
+
// observe real OS changes while the app forces a window's scheme.
|
|
13507
|
+
window.appearance = appearance;
|
|
13508
|
+
// The canvas present owns backgroundColor (including transparent clear
|
|
13509
|
+
// colors). Changing appearance must not overwrite that retained color.
|
|
13510
|
+
[window.contentView setNeedsDisplay:YES];
|
|
13511
|
+
return 1;
|
|
13512
|
+
}
|
|
13513
|
+
|
|
13334
13514
|
int native_sdk_appkit_close_window(native_sdk_appkit_host_t *host, uint64_t window_id) {
|
|
13335
13515
|
NativeSdkAppKitHost *object = (__bridge NativeSdkAppKitHost *)host;
|
|
13336
13516
|
if (!object.windows[@(window_id)]) return 0;
|
|
@@ -2435,7 +2435,7 @@ static void NativeSdkApplyOverlayWindowFlags(NativeSdkChromiumHost *host, uint64
|
|
|
2435
2435
|
}
|
|
2436
2436
|
}
|
|
2437
2437
|
|
|
2438
|
-
native_sdk_appkit_host_t *native_sdk_appkit_create(const char *app_name, size_t app_name_len, const char *display_name, size_t display_name_len, const char *version, size_t version_len, const char *about_description, size_t about_description_len, int has_web_content, int dock_visible, const char *window_title, size_t window_title_len, const char *bundle_id, size_t bundle_id_len, const char *icon_path, size_t icon_path_len, const char *window_label, size_t window_label_len, double x, double y, double width, double height, int restore_frame, int initial_placement, int restore_policy, int resizable, int titlebar_style, int show_policy, uint32_t window_flags) {
|
|
2438
|
+
native_sdk_appkit_host_t *native_sdk_appkit_create(const char *app_name, size_t app_name_len, const char *display_name, size_t display_name_len, const char *version, size_t version_len, const char *about_description, size_t about_description_len, int has_web_content, int webview_inspection, int dock_visible, const char *window_title, size_t window_title_len, const char *bundle_id, size_t bundle_id_len, const char *icon_path, size_t icon_path_len, const char *window_label, size_t window_label_len, double x, double y, double width, double height, int restore_frame, int initial_placement, int restore_policy, int resizable, int titlebar_style, int show_policy, uint32_t window_flags) {
|
|
2439
2439
|
@autoreleasepool {
|
|
2440
2440
|
// A windowed CEF child cannot paint transparent pixels into its
|
|
2441
2441
|
// parent NSWindow. Refuse instead of accepting a flag that leaves
|
|
@@ -2451,6 +2451,7 @@ native_sdk_appkit_host_t *native_sdk_appkit_create(const char *app_name, size_t
|
|
|
2451
2451
|
// has_web_content is likewise ABI parity: this host always
|
|
2452
2452
|
// hosts web content, and its menus already assume it.
|
|
2453
2453
|
(void)has_web_content;
|
|
2454
|
+
(void)webview_inspection;
|
|
2454
2455
|
(void)bundle_id;
|
|
2455
2456
|
(void)bundle_id_len;
|
|
2456
2457
|
(void)icon_path;
|
|
@@ -2753,6 +2754,19 @@ int native_sdk_appkit_focus_window(native_sdk_appkit_host_t *host, uint64_t wind
|
|
|
2753
2754
|
return 1;
|
|
2754
2755
|
}
|
|
2755
2756
|
|
|
2757
|
+
int native_sdk_appkit_set_window_color_scheme(native_sdk_appkit_host_t *host, uint64_t window_id, int color_scheme) {
|
|
2758
|
+
NativeSdkChromiumHost *object = (__bridge NativeSdkChromiumHost *)host;
|
|
2759
|
+
NSWindow *window = object.windows[@(window_id)];
|
|
2760
|
+
if (!window || color_scheme < 0 || color_scheme > 2) return 0;
|
|
2761
|
+
NSAppearance *appearance = color_scheme == 0 ? nil : [NSAppearance appearanceNamed:
|
|
2762
|
+
color_scheme == 2 ? NSAppearanceNameDarkAqua : NSAppearanceNameAqua];
|
|
2763
|
+
if (window.appearance == appearance || [window.appearance isEqual:appearance]) return 1;
|
|
2764
|
+
// Keep system observation independent from the app's window override.
|
|
2765
|
+
window.appearance = appearance;
|
|
2766
|
+
[window.contentView setNeedsDisplay:YES];
|
|
2767
|
+
return 1;
|
|
2768
|
+
}
|
|
2769
|
+
|
|
2756
2770
|
int native_sdk_appkit_close_window(native_sdk_appkit_host_t *host, uint64_t window_id) {
|
|
2757
2771
|
NativeSdkChromiumHost *object = (__bridge NativeSdkChromiumHost *)host;
|
|
2758
2772
|
if (!object.windows[@(window_id)]) return 0;
|