@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
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
//! Copied surface plans and explicit font/registry/drawing capabilities.
|
|
2
|
+
const std = @import("std");
|
|
3
|
+
const geometry = @import("geometry");
|
|
4
|
+
const c = @import("root.zig");
|
|
5
|
+
const style = @import("widget_render_style.zig");
|
|
6
|
+
const metrics = @import("widget_metrics.zig");
|
|
7
|
+
const text = @import("text.zig");
|
|
8
|
+
const drawing = @import("drawing.zig");
|
|
9
|
+
const icons = @import("icons.zig");
|
|
10
|
+
pub const reference = @import("widget_render_surfaces.zig");
|
|
11
|
+
pub const Operation = enum(u8) { alert, card, modal, panel, bubble, bubble_radius, bubble_ink, pill_rect, reactions, accordion, chevron, tabs, grip, floating, alert_mark };
|
|
12
|
+
fn word(b: []u8, at: usize, value: u32) void {
|
|
13
|
+
std.mem.writeInt(u32, b[at..][0..4], value, .little);
|
|
14
|
+
}
|
|
15
|
+
fn read(b: []const u8, at: usize) u32 {
|
|
16
|
+
return std.mem.readInt(u32, b[at..][0..4], .little);
|
|
17
|
+
}
|
|
18
|
+
fn float(b: []const u8, at: usize) f32 {
|
|
19
|
+
return @bitCast(read(b, at));
|
|
20
|
+
}
|
|
21
|
+
fn rect(b: []const u8, at: usize) geometry.RectF {
|
|
22
|
+
return .init(float(b, at), float(b, at + 4), float(b, at + 8), float(b, at + 12));
|
|
23
|
+
}
|
|
24
|
+
fn point(b: []const u8, at: usize) geometry.PointF {
|
|
25
|
+
return .init(float(b, at), float(b, at + 4));
|
|
26
|
+
}
|
|
27
|
+
fn radius(b: []const u8, at: usize) drawing.Radius {
|
|
28
|
+
return .{ .top_left = float(b, at), .top_right = float(b, at + 4), .bottom_right = float(b, at + 8), .bottom_left = float(b, at + 12) };
|
|
29
|
+
}
|
|
30
|
+
fn color(b: []const u8, at: usize) drawing.Color {
|
|
31
|
+
return .{ .r = float(b, at), .g = float(b, at + 4), .b = float(b, at + 8), .a = float(b, at + 12) };
|
|
32
|
+
}
|
|
33
|
+
pub const Plan = struct {
|
|
34
|
+
bytes: [1088]u8,
|
|
35
|
+
pub fn pill(self: *const Plan) ?geometry.RectF {
|
|
36
|
+
return if (read(&self.bytes, 8) & 4 != 0) rect(&self.bytes, 16) else null;
|
|
37
|
+
}
|
|
38
|
+
pub fn bubbleRadius(self: *const Plan) drawing.Radius {
|
|
39
|
+
if (read(&self.bytes, 8) != 1) @panic("missing surface radius");
|
|
40
|
+
return radius(&self.bytes, 16);
|
|
41
|
+
}
|
|
42
|
+
pub fn contentTokens(self: *const Plan, tokens: c.DesignTokens) c.DesignTokens {
|
|
43
|
+
var copied = tokens;
|
|
44
|
+
if (read(&self.bytes, 8) & 2 != 0) {
|
|
45
|
+
copied.colors.text = color(&self.bytes, 32);
|
|
46
|
+
copied.colors.text_muted = color(&self.bytes, 48);
|
|
47
|
+
}
|
|
48
|
+
return copied;
|
|
49
|
+
}
|
|
50
|
+
pub fn emit(self: *const Plan, builder: *c.Builder, widget: c.Widget, tokens: c.DesignTokens) c.Error!void {
|
|
51
|
+
for (0..read(&self.bytes, 4)) |i| {
|
|
52
|
+
const at = 64 + i * 128;
|
|
53
|
+
const id = @import("widgets.zig").widgetCommandPartId(.{ .widget_id = widget.id, .slot = read(&self.bytes, at + 4) });
|
|
54
|
+
const bounds = rect(&self.bytes, at + 8);
|
|
55
|
+
const arc = radius(&self.bytes, at + 24);
|
|
56
|
+
const ink = color(&self.bytes, at + 40);
|
|
57
|
+
const stroke: drawing.Stroke = .{ .fill = .{ .color = ink }, .width = float(&self.bytes, at + 56) };
|
|
58
|
+
switch (read(&self.bytes, at)) {
|
|
59
|
+
0 => try builder.fillRoundedRect(.{ .id = id, .rect = bounds, .radius = arc, .fill = .{ .color = ink } }),
|
|
60
|
+
1 => try builder.strokeRect(.{ .id = id, .rect = bounds, .radius = arc, .stroke = stroke }),
|
|
61
|
+
2 => try builder.shadow(.{ .id = id, .rect = bounds, .radius = arc, .offset = .{ .dx = 0, .dy = float(&self.bytes, at + 60) }, .blur = float(&self.bytes, at + 64), .spread = float(&self.bytes, at + 68), .color = ink }),
|
|
62
|
+
3 => try builder.drawText(.{ .id = id, .font_id = tokens.typography.font_id, .size = float(&self.bytes, at + 60), .origin = point(&self.bytes, at + 72), .color = ink, .text = widget.text, .text_layout = .{ .max_width = float(&self.bytes, at + 64), .line_height = float(&self.bytes, at + 68), .wrap = @enumFromInt(read(&self.bytes, at + 80)), .alignment = @enumFromInt(read(&self.bytes, at + 84)), .overflow = @enumFromInt(read(&self.bytes, at + 88)), .measure = tokens.text_measure } }),
|
|
63
|
+
4 => try builder.drawLine(.{ .id = id, .from = point(&self.bytes, at + 8), .to = point(&self.bytes, at + 16), .stroke = stroke }),
|
|
64
|
+
5 => {
|
|
65
|
+
const registry = icons.resolve(switch (read(&self.bytes, at + 92)) {
|
|
66
|
+
0 => "info",
|
|
67
|
+
1 => "alert",
|
|
68
|
+
2 => "chevron-down",
|
|
69
|
+
else => unreachable,
|
|
70
|
+
}) orelse continue;
|
|
71
|
+
const transform: drawing.Affine = .{ .a = float(&self.bytes, at + 96), .b = float(&self.bytes, at + 100), .c = float(&self.bytes, at + 104), .d = float(&self.bytes, at + 108), .tx = float(&self.bytes, at + 112), .ty = float(&self.bytes, at + 116) };
|
|
72
|
+
const flipped = read(&self.bytes, at + 80) == 1;
|
|
73
|
+
if (flipped) try builder.transform(transform);
|
|
74
|
+
try @import("widget_render_controls.zig").emitVectorIconWithTokens(builder, widget.id, read(&self.bytes, at + 4), bounds, ink, registry, tokens);
|
|
75
|
+
if (flipped) try builder.transform(transform);
|
|
76
|
+
},
|
|
77
|
+
6 => try builder.fillRect(.{ .id = id, .rect = bounds, .fill = .{ .color = ink } }),
|
|
78
|
+
else => unreachable,
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
pub const Request = struct {
|
|
84
|
+
bytes: [560]u8 = @splat(0),
|
|
85
|
+
pub fn putFloat(self: *Request, at: usize, value: f32) void {
|
|
86
|
+
word(&self.bytes, at, @bitCast(value));
|
|
87
|
+
}
|
|
88
|
+
pub fn putColor(self: *Request, at: usize, value: drawing.Color) void {
|
|
89
|
+
inline for (.{ "r", "g", "b", "a" }, 0..) |name, i| self.putFloat(at + i * 4, @field(value, name));
|
|
90
|
+
}
|
|
91
|
+
fn optionalColor(self: *Request, at: usize, value: ?drawing.Color, bit: u32) void {
|
|
92
|
+
if (value) |v| {
|
|
93
|
+
word(&self.bytes, 8, read(&self.bytes, 8) | bit);
|
|
94
|
+
self.putColor(at, v);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
fn putRadius(self: *Request, at: usize, value: drawing.Radius) void {
|
|
98
|
+
inline for (.{ "top_left", "top_right", "bottom_right", "bottom_left" }, 0..) |name, i| self.putFloat(at + i * 4, @field(value, name));
|
|
99
|
+
}
|
|
100
|
+
pub fn init(op: Operation, widget: c.Widget, tokens: c.DesignTokens, visual: c.ControlVisualTokens, fallback_radius: f32) Request {
|
|
101
|
+
var self: Request = .{};
|
|
102
|
+
self.bytes[0..4].* = .{ 31, 1, @intFromEnum(op), @import("render_plan_policy.zig").numericFlags() };
|
|
103
|
+
const bits: u32 = @as(u32, @intFromBool(widget.text.len > 0)) | (@as(u32, @intFromBool(widget.state.focused)) << 1) | (@as(u32, @intFromBool(@import("widget_access.zig").booleanControlSelected(widget))) << 2) | (@as(u32, @intFromBool(widget.kind == .resizable)) << 3) | (@as(u32, @intFromBool(tokens.controls.tabs_indicator == .underline)) << 4) | (@as(u32, @intFromBool(tokens.pixel_snap.geometry)) << 5) | (@as(u32, @intFromBool(tokens.pixel_snap.text)) << 6) | (@as(u32, @intFromBool(widget.style.radius != null)) << 8) | (@as(u32, @intFromBool(widget.kind == .bubble)) << 9);
|
|
104
|
+
word(&self.bytes, 4, bits);
|
|
105
|
+
self.bytes[12] = @intFromEnum(widget.variant);
|
|
106
|
+
self.bytes[13] = @intFromEnum(widget.text_alignment);
|
|
107
|
+
self.bytes[14] = @intFromEnum(widget.text_overflow);
|
|
108
|
+
self.bytes[15] = @import("control_geometry_policy.zig").signalingFlags();
|
|
109
|
+
inline for (.{ "x", "y", "width", "height" }, 0..) |name, i| self.putFloat(16 + i * 4, @field(widget.frame, name));
|
|
110
|
+
self.putRadius(32, style.controlRadius(widget, visual, fallback_radius));
|
|
111
|
+
self.putFloat(48, switch (op) {
|
|
112
|
+
.card => metrics.widgetTypographySizeWithTokens(widget, tokens.typography.body_size + 1, tokens),
|
|
113
|
+
.modal => metrics.widgetTypographySizeWithTokens(widget, tokens.typography.title_size, tokens),
|
|
114
|
+
.pill_rect, .reactions => metrics.widgetLabelTextSize(widget, tokens),
|
|
115
|
+
else => metrics.widgetBodyTextSize(widget, tokens),
|
|
116
|
+
});
|
|
117
|
+
self.putFloat(52, if (op == .alert) metrics.widgetAlertInset(widget, tokens) else metrics.widgetControlInset(widget, tokens, if (op == .modal) tokens.spacing.xl else tokens.spacing.lg));
|
|
118
|
+
self.putFloat(56, metrics.widgetSizedDensityValue(widget, tokens, 16));
|
|
119
|
+
self.putFloat(60, metrics.widgetControlInset(widget, tokens, tokens.spacing.md));
|
|
120
|
+
self.putFloat(64, @import("widget_layout.zig").accordionHeaderHeight(widget, tokens));
|
|
121
|
+
self.putFloat(68, tokens.pixel_snap.scale);
|
|
122
|
+
inline for (.{ "top", "right", "bottom", "left" }, 0..) |name, i| self.putFloat(72 + i * 4, @field(widget.layout.padding, name));
|
|
123
|
+
const shadow = if (op == .panel) tokens.shadow.sm else tokens.shadow.md;
|
|
124
|
+
self.putFloat(88, shadow.y);
|
|
125
|
+
self.putFloat(92, shadow.blur);
|
|
126
|
+
self.putFloat(96, shadow.spread);
|
|
127
|
+
self.putFloat(100, style.controlStrokeWidth(widget, visual, tokens.stroke.hairline));
|
|
128
|
+
self.putFloat(104, style.controlStrokeWidth(widget, visual, tokens.stroke.regular));
|
|
129
|
+
self.putFloat(108, tokens.radius.lg);
|
|
130
|
+
self.putFloat(112, widget.style.radius orelse 0);
|
|
131
|
+
self.putFloat(120, tokens.stroke.focus_offset);
|
|
132
|
+
self.putFloat(124, tokens.stroke.focus);
|
|
133
|
+
self.putRadius(128, style.widgetRadius(widget, tokens.radius.md));
|
|
134
|
+
self.putFloat(144, metrics.widgetSizedDensityValue(widget, tokens, 6));
|
|
135
|
+
self.putFloat(148, metrics.widgetSizedDensityValue(widget, tokens, 4));
|
|
136
|
+
self.putFloat(152, metrics.widgetSizedDensityValue(widget, tokens, 10));
|
|
137
|
+
self.putColor(160, if (op == .alert) style.alertBackgroundColor(widget, visual, tokens) else if (op == .tabs) style.widgetBackgroundColor(widget, visual.background orelse tokens.colors.surface_subtle) else style.surfaceStateBackground(widget, visual, tokens));
|
|
138
|
+
self.putColor(176, if (op == .alert) style.alertBorderColor(widget, visual, tokens) else widget.style.border orelse visual.border orelse tokens.colors.border);
|
|
139
|
+
const foreground = if (op == .alert and widget.variant == .destructive) widget.style.accent orelse tokens.colors.destructive else if (op == .grip or (op == .panel and widget.kind == .resizable)) visual.foreground orelse visual.border orelse tokens.colors.text_muted else visual.foreground orelse tokens.colors.text;
|
|
140
|
+
self.putColor(192, style.widgetForegroundColor(widget, tokens, foreground));
|
|
141
|
+
self.putColor(208, style.widgetForegroundColor(widget, tokens, tokens.colors.text_muted));
|
|
142
|
+
self.putColor(224, tokens.colors.shadow);
|
|
143
|
+
self.putColor(240, tokens.colors.background);
|
|
144
|
+
self.putColor(256, tokens.colors.surface_subtle);
|
|
145
|
+
self.putColor(272, tokens.colors.text);
|
|
146
|
+
self.putColor(288, tokens.colors.accent);
|
|
147
|
+
self.putColor(304, tokens.colors.accent_text);
|
|
148
|
+
self.putColor(320, tokens.colors.destructive);
|
|
149
|
+
self.optionalColor(336, tokens.controls.button_destructive.background, 128);
|
|
150
|
+
self.optionalColor(352, tokens.controls.bubble.background, 16);
|
|
151
|
+
self.optionalColor(368, tokens.controls.bubble.border, 32);
|
|
152
|
+
self.optionalColor(384, tokens.controls.bubble.foreground, 64);
|
|
153
|
+
self.optionalColor(400, widget.style.background, 1);
|
|
154
|
+
self.optionalColor(416, widget.style.border, 2);
|
|
155
|
+
self.optionalColor(432, widget.style.accent, 4);
|
|
156
|
+
self.optionalColor(448, widget.style.accent_foreground, 8);
|
|
157
|
+
self.optionalColor(480, widget.style.background orelse visual.background, 256);
|
|
158
|
+
self.optionalColor(496, widget.style.border orelse visual.border, 512);
|
|
159
|
+
self.putColor(512, style.widgetFocusRingFill(widget, tokens).color);
|
|
160
|
+
return self;
|
|
161
|
+
}
|
|
162
|
+
pub fn run(self_: Request, widget: c.Widget, tokens: c.DesignTokens) Plan {
|
|
163
|
+
var self = self_;
|
|
164
|
+
var copied: Plan = .{ .bytes = @splat(0xa5) };
|
|
165
|
+
const policy = tokens.control_geometry_policy orelse @panic("missing surface recipe owner");
|
|
166
|
+
for (0..2) |phase| {
|
|
167
|
+
if (policy(&self.bytes, &copied.bytes) != copied.bytes.len or read(&copied.bytes, 0) != 1 or read(&copied.bytes, 4) > 8 or read(&copied.bytes, 8) > 15 or read(&copied.bytes, 12) != 0) @panic("invalid compiled surface copied");
|
|
168
|
+
const pending = read(&copied.bytes, 8) & 8 != 0;
|
|
169
|
+
if (pending) {
|
|
170
|
+
if (phase != 0 or (self.bytes[2] != @intFromEnum(Operation.pill_rect) and self.bytes[2] != @intFromEnum(Operation.reactions)) or read(&copied.bytes, 8) != 8 or read(&copied.bytes, 4) != 0 or !std.mem.allEqual(u8, copied.bytes[16..], 0)) @panic("invalid surface measurement continuation");
|
|
171
|
+
self.putFloat(116, text.measureTextWidthForFontWithPolicy(tokens.text_measure, tokens.text_run_policy, tokens.typography.font_id, widget.text, float(&self.bytes, 48)));
|
|
172
|
+
word(&self.bytes, 4, read(&self.bytes, 4) | 128);
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
const op: Operation = @enumFromInt(self.bytes[2]);
|
|
176
|
+
const presence = read(&copied.bytes, 8);
|
|
177
|
+
switch (op) {
|
|
178
|
+
.bubble_radius => {
|
|
179
|
+
if (presence != 1 or read(&copied.bytes, 4) != 0) @panic("invalid surface radius result");
|
|
180
|
+
},
|
|
181
|
+
.bubble_ink => {
|
|
182
|
+
if ((presence != 0 and presence != 2) or read(&copied.bytes, 4) != 0) @panic("invalid surface ink result");
|
|
183
|
+
},
|
|
184
|
+
.pill_rect, .reactions => {
|
|
185
|
+
if (presence != 0 and presence != 4) @panic("invalid surface pill result");
|
|
186
|
+
},
|
|
187
|
+
else => {
|
|
188
|
+
if (presence != 0) @panic("unexpected surface auxiliary result");
|
|
189
|
+
},
|
|
190
|
+
}
|
|
191
|
+
validate(&copied);
|
|
192
|
+
return copied;
|
|
193
|
+
}
|
|
194
|
+
@panic("incomplete compiled surface measurement");
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
fn validate(copied: *const Plan) void {
|
|
198
|
+
const b = &copied.bytes;
|
|
199
|
+
const count = read(b, 4);
|
|
200
|
+
const flags = read(b, 8);
|
|
201
|
+
if (flags != 0 and flags != 1 and flags != 2 and flags != 4) @panic("invalid surface auxiliary presence");
|
|
202
|
+
if (flags & 5 == 0 and !std.mem.allEqual(u8, b[16..32], 0)) @panic("invalid absent surface geometry");
|
|
203
|
+
if (flags & 2 == 0 and !std.mem.allEqual(u8, b[32..64], 0)) @panic("invalid absent surface ink");
|
|
204
|
+
if (!std.mem.allEqual(u8, b[64 + @as(usize, count) * 128 ..], 0)) @panic("invalid unused surface commands");
|
|
205
|
+
for (0..count) |i| {
|
|
206
|
+
const at = 64 + i * 128;
|
|
207
|
+
const kind = read(b, at);
|
|
208
|
+
const slot = read(b, at + 4);
|
|
209
|
+
if (kind > 6 or slot > 10 or slot == 0 or !std.mem.allEqual(u8, b[at + 120 ..][0..8], 0)) @panic("invalid surface command identity");
|
|
210
|
+
const ranges: []const [2]usize = switch (kind) {
|
|
211
|
+
0, 6 => &.{.{ 56, 120 }},
|
|
212
|
+
1 => &.{.{ 60, 120 }},
|
|
213
|
+
2 => &.{ .{ 56, 60 }, .{ 72, 120 } },
|
|
214
|
+
3 => &.{ .{ 8, 40 }, .{ 56, 60 }, .{ 92, 120 } },
|
|
215
|
+
4 => &.{ .{ 24, 40 }, .{ 60, 120 } },
|
|
216
|
+
5 => &.{ .{ 24, 40 }, .{ 56, 80 }, .{ 84, 92 } },
|
|
217
|
+
else => unreachable,
|
|
218
|
+
};
|
|
219
|
+
for (ranges) |range| if (!std.mem.allEqual(u8, b[at + range[0] .. at + range[1]], 0)) @panic("invalid unused surface command fields");
|
|
220
|
+
if (kind == 5 and read(b, at + 80) == 0 and !std.mem.allEqual(u8, b[at + 96 ..][0..24], 0)) @panic("invalid absent surface transform");
|
|
221
|
+
if (kind == 3 and (read(b, at + 80) > 1 or read(b, at + 84) > 2 or read(b, at + 88) > 1)) @panic("invalid surface text layout");
|
|
222
|
+
if (kind == 5 and (read(b, at + 92) > 2 or read(b, at + 80) > 1)) @panic("invalid surface registry descriptor");
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
pub fn plan(op: Operation, widget: c.Widget, tokens: c.DesignTokens, visual: c.ControlVisualTokens, fallback_radius: f32) Plan {
|
|
226
|
+
return Request.init(op, widget, tokens, visual, fallback_radius).run(widget, tokens);
|
|
227
|
+
}
|
|
228
|
+
pub fn emit(op: Operation, builder: *c.Builder, widget: c.Widget, tokens: c.DesignTokens, visual: c.ControlVisualTokens, fallback_radius: f32) c.Error!void {
|
|
229
|
+
const copied = plan(op, widget, tokens, visual, fallback_radius);
|
|
230
|
+
try copied.emit(builder, widget, tokens);
|
|
231
|
+
}
|