@native-sdk/cli 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -6
- package/bin/native.js +2 -1
- package/build/app.zig +320 -60
- package/build/corewire.zig +53 -0
- package/build/test_shards.zig +49 -0
- package/build/ts_run.mjs +3 -3
- package/build.zig +1818 -87
- package/package.json +19 -14
- package/packages/core/compile-surface/core.ts +134 -72
- package/packages/core/package-lock.json +75 -357
- package/packages/core/package.json +25 -4
- package/packages/core/scripts/compiler_command.mjs +17 -12
- package/packages/core/scripts/compiler_typecheck.mjs +1 -0
- package/packages/core/scripts/gen_declarations.mjs +3 -2
- package/packages/core/scripts/gen_service_surface.mjs +22 -10
- package/packages/core/scripts/install_scriptc.mjs +182 -0
- package/packages/core/scripts/invoke_scriptc.mjs +18 -0
- package/packages/core/scripts/merge_static_archives.mjs +6 -1
- package/packages/core/scripts/npm_static_spike.mjs +2 -2
- package/packages/core/scripts/run_external_core_compiler.mjs +22 -10
- package/packages/core/scripts/run_external_service_compiler.mjs +15 -15
- package/packages/core/scripts/run_library_compiler.mjs +51 -0
- package/packages/core/scripts/run_native_tests.mjs +22 -0
- package/packages/core/scripts/scriptc-toolchain.json +101 -0
- package/packages/core/scripts/scriptc_toolchain.mjs +121 -0
- package/packages/core/scripts/stage_external_core.mjs +57 -1
- package/packages/core/scripts/surface_manifest_diff.mjs +19 -12
- package/packages/core/sdk/bytes.d.ts +2 -0
- package/packages/core/sdk/bytes.ts +86 -0
- package/packages/core/sdk/core.d.ts +308 -4
- package/packages/core/sdk/core.ts +320 -84
- package/packages/core/sdk/events.d.ts +247 -0
- package/packages/core/sdk/events.ts +230 -2
- package/packages/core/sdk/internal/image_identity.d.ts +7 -0
- package/packages/core/sdk/internal/image_identity.ts +71 -0
- package/packages/core/sdk/internal/markdown_policy.d.ts +5 -0
- package/packages/core/sdk/internal/markdown_policy.ts +878 -0
- package/packages/core/sdk/text.d.ts +27 -0
- package/packages/core/sdk/text.ts +206 -15
- package/packages/core/sdk/theme.d.ts +251 -0
- package/packages/core/sdk/theme.ts +267 -0
- package/packages/core/src/authorization.ts +137 -0
- package/packages/core/src/automation_commands.ts +201 -0
- package/packages/core/src/automation_interactions.ts +92 -0
- package/packages/core/src/bridge_descriptors.ts +104 -0
- package/packages/core/src/builtin_coordination.ts +172 -0
- package/packages/core/src/canvas_frame_coordination.ts +81 -0
- package/packages/core/src/canvas_presentation_lifecycle.ts +84 -0
- package/packages/core/src/canvas_scene_observation.ts +145 -0
- package/packages/core/src/chart_content.ts +161 -0
- package/packages/core/src/chart_plans.ts +432 -0
- package/packages/core/src/checker.ts +166 -19
- package/packages/core/src/code_content.ts +580 -0
- package/packages/core/src/command_coordination.ts +140 -0
- package/packages/core/src/component_composition.ts +94 -0
- package/packages/core/src/component_construction.ts +149 -0
- package/packages/core/src/contract.ts +25 -7
- package/packages/core/src/control_appearance.ts +232 -0
- package/packages/core/src/control_commands.ts +115 -0
- package/packages/core/src/control_content.ts +105 -0
- package/packages/core/src/control_geometry.ts +107 -0
- package/packages/core/src/control_payloads.ts +119 -0
- package/packages/core/src/control_primitives.ts +134 -0
- package/packages/core/src/devhost.ts +82 -7
- package/packages/core/src/devhost_journal.mjs +30 -7
- package/packages/core/src/effect_plans.ts +71 -0
- package/packages/core/src/flow_measurement.ts +121 -0
- package/packages/core/src/font_registry.ts +37 -0
- package/packages/core/src/glyph_atlas.ts +86 -0
- package/packages/core/src/gpu_packet_preparation.ts +130 -0
- package/packages/core/src/gpu_planning.ts +123 -0
- package/packages/core/src/gpu_presentation.ts +55 -0
- package/packages/core/src/host_flow.ts +89 -0
- package/packages/core/src/host_input_regions.ts +165 -0
- package/packages/core/src/image_registry.ts +66 -0
- package/packages/core/src/indicator_plans.ts +132 -0
- package/packages/core/src/infer.ts +150 -8
- package/packages/core/src/input_composition.ts +116 -0
- package/packages/core/src/intrinsic_measure.ts +100 -0
- package/packages/core/src/layout_coordination.ts +207 -0
- package/packages/core/src/leaf_plans.ts +134 -0
- package/packages/core/src/markup_development.ts +160 -0
- package/packages/core/src/measurement_coordination.ts +185 -0
- package/packages/core/src/modules.ts +1 -1
- package/packages/core/src/motion_sampling.ts +100 -0
- package/packages/core/src/paragraph_layout.ts +192 -0
- package/packages/core/src/portable_sources.json +74 -0
- package/packages/core/src/portable_sources.ts +17 -0
- package/packages/core/src/registered_font.ts +93 -0
- package/packages/core/src/render_animation_lifecycle.ts +128 -0
- package/packages/core/src/render_coordination.ts +170 -0
- package/packages/core/src/render_resources.ts +234 -0
- package/packages/core/src/runtime_policy.ts +3930 -0
- package/packages/core/src/scalar_text.ts +84 -0
- package/packages/core/src/service_contract.ts +2 -1
- package/packages/core/src/session_codecs.ts +309 -0
- package/packages/core/src/shell_admission.ts +126 -0
- package/packages/core/src/shell_coordination.ts +93 -0
- package/packages/core/src/sqlite_cli.ts +11 -0
- package/packages/core/src/status_validation.ts +232 -0
- package/packages/core/src/stream_policy.ts +63 -0
- package/packages/core/src/surface_recipes.ts +136 -0
- package/packages/core/src/system_admission.ts +60 -0
- package/packages/core/src/terminal_paint.ts +436 -0
- package/packages/core/src/text_document_width.ts +81 -0
- package/packages/core/src/text_measurement_cache.ts +69 -0
- package/packages/core/src/text_query_layout.ts +179 -0
- package/packages/core/src/text_run_layout.ts +410 -0
- package/packages/core/src/text_span_queries.ts +355 -0
- package/packages/core/src/typed_ast.ts +18 -1
- package/packages/core/src/types.ts +7 -5
- package/packages/core/src/vector_effects.ts +98 -0
- package/packages/core/src/vector_raster.ts +243 -0
- package/packages/core/src/view_components.ts +2415 -0
- package/packages/core/src/view_coordination.ts +198 -0
- package/packages/core/src/view_frontend.ts +980 -0
- package/packages/core/src/widget_audits.ts +202 -0
- package/packages/core/src/widget_changes.ts +258 -0
- package/packages/core/src/widget_metrics.ts +139 -0
- package/packages/core/src/widget_motion.ts +171 -0
- package/packages/core/src/widget_paint.ts +272 -0
- package/packages/core/src/widget_paint_walk.ts +203 -0
- package/packages/core/src/widget_presentation.ts +141 -0
- package/packages/core/src/widget_routing.ts +262 -0
- package/packages/core/src/window_lifecycle.ts +92 -0
- package/packages/core/testing/index.ts +430 -0
- package/schemas/app.schema.json +13 -0
- package/skill-data/core/SKILL.md +2 -2
- package/skill-data/core/references/web-engines-packaging-debugging.md +2 -1
- package/skill-data/native-ui/SKILL.md +76 -17
- package/skill-data/ts-core/SKILL.md +113 -9
- package/skill-data/ts-services/SKILL.md +1 -1
- package/skill-data/ts-services/references/service-surface.md +264 -144
- package/src/app_runner/root.zig +25 -12
- package/src/app_runner/ts_compiled_view.zig +1631 -0
- package/src/app_runner/ts_core_main.zig +143 -10
- package/src/app_runner/ts_core_mobile.zig +24 -12
- package/src/automation/server.zig +1 -3
- package/src/automation/snapshot.zig +9 -637
- package/src/automation/snapshot_reference.zig +656 -0
- package/src/automation/snapshot_serialization.zig +566 -0
- package/src/platform/linux/gtk_host.c +36 -24
- package/src/platform/linux/gtk_pixels.h +118 -0
- package/src/platform/linux/gtk_pixels_test.c +241 -0
- package/src/platform/linux/root.zig +2 -0
- package/src/platform/macos/appkit_host.m +188 -30
- package/src/platform/macos/pointer_motion_test.m +96 -0
- package/src/platform/macos/scroll_driver_test.m +105 -0
- package/src/platform/macos/spectrum_bins.h +34 -0
- package/src/platform/macos/spectrum_bins_test.c +56 -0
- package/src/platform/macos/text_keyboard_test.m +80 -0
- package/src/platform/macos/widget_focus_test.m +66 -0
- package/src/platform/null_platform.zig +26 -2
- package/src/platform/null_platform_tests.zig +13 -0
- package/src/platform/root.zig +1 -0
- package/src/platform/types.zig +13 -0
- package/src/platform/windows/root.zig +2 -0
- package/src/platform/windows/webview2_host.cpp +7 -2
- package/src/primitives/app_manifest/comptime_scene.zig +1 -1
- package/src/primitives/app_manifest/root.zig +2 -0
- package/src/primitives/app_manifest/tests.zig +4 -1
- package/src/primitives/app_manifest/validation.zig +2 -0
- package/src/primitives/canvas/a11y_audit.zig +3 -1
- package/src/primitives/canvas/canvas_frame_coordination_policy.zig +134 -0
- package/src/primitives/canvas/chart_content_policy.zig +75 -0
- package/src/primitives/canvas/chart_plan_policy.zig +196 -0
- package/src/primitives/canvas/code_content_policy.zig +162 -0
- package/src/primitives/canvas/commands.zig +29 -1
- package/src/primitives/canvas/component_composition.zig +125 -0
- package/src/primitives/canvas/component_composition_policy.zig +44 -0
- package/src/primitives/canvas/component_construction_policy.zig +187 -0
- package/src/primitives/canvas/container_layout_policy.zig +87 -0
- package/src/primitives/canvas/control_appearance_policy.zig +142 -0
- package/src/primitives/canvas/control_command_policy.zig +75 -0
- package/src/primitives/canvas/control_content_policy.zig +90 -0
- package/src/primitives/canvas/control_geometry_policy.zig +165 -0
- package/src/primitives/canvas/control_payload_policy.zig +48 -0
- package/src/primitives/canvas/control_primitive_policy.zig +129 -0
- package/src/primitives/canvas/effect_plan_policy.zig +96 -0
- package/src/primitives/canvas/events.zig +1027 -1
- package/src/primitives/canvas/flow_measurement_policy.zig +237 -0
- package/src/primitives/canvas/frame.zig +92 -23
- package/src/primitives/canvas/glyph_atlas_policy.zig +40 -0
- package/src/primitives/canvas/gpu.zig +10 -0
- package/src/primitives/canvas/gpu_packet_preparation_policy.zig +325 -0
- package/src/primitives/canvas/gpu_planning_policy.zig +364 -0
- package/src/primitives/canvas/gpu_presentation_policy.zig +74 -0
- package/src/primitives/canvas/grid_layout_policy.zig +51 -0
- package/src/primitives/canvas/indicator_plan_policy.zig +128 -0
- package/src/primitives/canvas/intrinsic_layout_policy.zig +87 -0
- package/src/primitives/canvas/intrinsic_measure_policy.zig +128 -0
- package/src/primitives/canvas/layout_audit.zig +5 -2
- package/src/primitives/canvas/layout_coordination_policy.zig +262 -0
- package/src/primitives/canvas/leaf_plan_policy.zig +117 -0
- package/src/primitives/canvas/markdown.zig +13 -3
- package/src/primitives/canvas/markdown_content_policy.zig +227 -0
- package/src/primitives/canvas/markdown_image_binding.zig +81 -0
- package/src/primitives/canvas/measurement_coordination_policy.zig +288 -0
- package/src/primitives/canvas/numeric_capabilities.zig +14 -0
- package/src/primitives/canvas/reference.zig +12 -6
- package/src/primitives/canvas/registered_font_policy.zig +152 -0
- package/src/primitives/canvas/render.zig +48 -0
- package/src/primitives/canvas/render_cache_policy.zig +184 -0
- package/src/primitives/canvas/render_coordination_policy.zig +163 -0
- package/src/primitives/canvas/render_damage_policy.zig +160 -0
- package/src/primitives/canvas/render_effects.zig +14 -0
- package/src/primitives/canvas/render_generic_resources.zig +14 -0
- package/src/primitives/canvas/render_images.zig +14 -0
- package/src/primitives/canvas/render_layers.zig +14 -0
- package/src/primitives/canvas/render_override_policy.zig +119 -0
- package/src/primitives/canvas/render_paths.zig +14 -0
- package/src/primitives/canvas/render_plan_policy.zig +199 -0
- package/src/primitives/canvas/render_resource_policy.zig +476 -0
- package/src/primitives/canvas/root.zig +100 -0
- package/src/primitives/canvas/semantic_tree_policy.zig +158 -0
- package/src/primitives/canvas/serialization.zig +8 -1
- package/src/primitives/canvas/surface_layout_policy.zig +36 -0
- package/src/primitives/canvas/surface_recipe_policy.zig +231 -0
- package/src/primitives/canvas/terminal_grid.zig +10 -696
- package/src/primitives/canvas/terminal_grid_reference.zig +709 -0
- package/src/primitives/canvas/terminal_paint_policy.zig +191 -0
- package/src/primitives/canvas/text.zig +1 -0
- package/src/primitives/canvas/text_atlas.zig +113 -0
- package/src/primitives/canvas/text_cache_policy.zig +94 -0
- package/src/primitives/canvas/text_document_policy.zig +120 -0
- package/src/primitives/canvas/text_layout.zig +51 -2
- package/src/primitives/canvas/text_layout_cache.zig +29 -0
- package/src/primitives/canvas/text_layout_hash.zig +1 -0
- package/src/primitives/canvas/text_layout_types.zig +3 -0
- package/src/primitives/canvas/text_measure_cache.zig +46 -0
- package/src/primitives/canvas/text_measurement_policy.zig +124 -0
- package/src/primitives/canvas/text_metrics.zig +23 -0
- package/src/primitives/canvas/text_query_policy.zig +156 -0
- package/src/primitives/canvas/text_run_policy.zig +252 -0
- package/src/primitives/canvas/text_scalar_policy.zig +156 -0
- package/src/primitives/canvas/text_span_query_policy.zig +232 -0
- package/src/primitives/canvas/text_spans.zig +280 -8
- package/src/primitives/canvas/text_tests.zig +10 -0
- package/src/primitives/canvas/tokens.zig +38 -0
- package/src/primitives/canvas/ui.zig +250 -83
- package/src/primitives/canvas/ui_markup.zig +139 -33
- package/src/primitives/canvas/ui_markup_compiled.zig +319 -59
- package/src/primitives/canvas/ui_markup_compiled_tests.zig +225 -0
- package/src/primitives/canvas/ui_markup_contract.zig +146 -14
- package/src/primitives/canvas/ui_markup_contract_tests.zig +77 -0
- package/src/primitives/canvas/ui_markup_reflect.zig +56 -0
- package/src/primitives/canvas/ui_markup_tests.zig +116 -0
- package/src/primitives/canvas/ui_markup_view.zig +258 -32
- package/src/primitives/canvas/ui_markup_view_tests.zig +142 -10
- package/src/primitives/canvas/ui_schema.zig +13 -1
- package/src/primitives/canvas/ui_schema_tests.zig +11 -7
- package/src/primitives/canvas/ui_tests.zig +1 -0
- package/src/primitives/canvas/vector.zig +36 -2
- package/src/primitives/canvas/vector_effect_policy.zig +236 -0
- package/src/primitives/canvas/vector_raster_policy.zig +190 -0
- package/src/primitives/canvas/virtual_extent_policy.zig +292 -0
- package/src/primitives/canvas/virtual_extents.zig +99 -3
- package/src/primitives/canvas/virtual_flow_policy.zig +108 -0
- package/src/primitives/canvas/widget_audit_policy.zig +293 -0
- package/src/primitives/canvas/widget_change_policy.zig +298 -0
- package/src/primitives/canvas/widget_invalidation.zig +113 -2
- package/src/primitives/canvas/widget_layout.zig +673 -128
- package/src/primitives/canvas/widget_layout_tests.zig +4 -0
- package/src/primitives/canvas/widget_metric_policy.zig +126 -0
- package/src/primitives/canvas/widget_metrics.zig +45 -6
- package/src/primitives/canvas/widget_paint_policy.zig +166 -0
- package/src/primitives/canvas/widget_paint_walk_policy.zig +252 -0
- package/src/primitives/canvas/widget_presentation_policy.zig +168 -0
- package/src/primitives/canvas/widget_render.zig +744 -74
- package/src/primitives/canvas/widget_render_controls.zig +1217 -133
- package/src/primitives/canvas/widget_render_scroll.zig +11 -3
- package/src/primitives/canvas/widget_render_style.zig +94 -0
- package/src/primitives/canvas/widget_render_surfaces.zig +61 -50
- package/src/primitives/canvas/widget_routing.zig +75 -0
- package/src/primitives/canvas/widget_routing_policy.zig +135 -0
- package/src/primitives/canvas/widget_runtime.zig +20 -1
- package/src/primitives/canvas/widget_semantics.zig +25 -0
- package/src/primitives/canvas/widget_text_input.zig +86 -23
- package/src/primitives/canvas/widget_text_select.zig +1 -0
- package/src/primitives/canvas/widget_tree.zig +8 -1
- package/src/primitives/canvas/widgets.zig +42 -12
- package/src/primitives/canvas/wrapped_layout_policy.zig +104 -0
- package/src/root.zig +21 -0
- package/src/runtime/accessibility_policy.zig +122 -0
- package/src/runtime/api.zig +28 -0
- package/src/runtime/app_dispatch_policy.zig +68 -0
- package/src/runtime/authorization_policy.zig +150 -0
- package/src/runtime/automation_command_policy.zig +241 -0
- package/src/runtime/automation_interaction_policy.zig +107 -0
- package/src/runtime/automation_snapshot.zig +52 -22
- package/src/runtime/automation_snapshot_reference.zig +290 -0
- package/src/runtime/automation_widget_dispatch.zig +267 -355
- package/src/runtime/automation_widget_dispatch_reference.zig +900 -0
- package/src/runtime/blob_policy.zig +58 -0
- package/src/runtime/blob_reference.zig +64 -0
- package/src/runtime/bridge_descriptor_policy.zig +206 -0
- package/src/runtime/builtin_bridge.zig +180 -44
- package/src/runtime/builtin_coordination_policy.zig +121 -0
- package/src/runtime/callback_policy_test_reference.zig +97 -0
- package/src/runtime/canvas_drag_policy.zig +94 -0
- package/src/runtime/canvas_fonts.zig +38 -10
- package/src/runtime/canvas_frame.zig +590 -134
- package/src/runtime/canvas_frame_helpers.zig +1 -0
- package/src/runtime/canvas_hover_policy.zig +131 -0
- package/src/runtime/canvas_images.zig +59 -30
- package/src/runtime/canvas_keyboard_focus_policy.zig +154 -0
- package/src/runtime/canvas_limits.zig +1 -1
- package/src/runtime/canvas_presentation_lifecycle_policy.zig +86 -0
- package/src/runtime/canvas_scene_observation_policy.zig +181 -0
- package/src/runtime/canvas_widget_context_menu.zig +4 -4
- package/src/runtime/canvas_widget_display.zig +110 -9
- package/src/runtime/canvas_widget_events.zig +718 -328
- package/src/runtime/canvas_widget_runtime.zig +437 -81
- package/src/runtime/canvas_widget_scroll_drivers.zig +39 -1
- package/src/runtime/canvas_widget_scroll_tests.zig +31 -0
- package/src/runtime/canvas_widget_state.zig +93 -56
- package/src/runtime/channel_sources.zig +80 -0
- package/src/runtime/command_policy.zig +161 -0
- package/src/runtime/component_policy.zig +83 -0
- package/src/runtime/core.zig +156 -6
- package/src/runtime/desktop_files.zig +189 -0
- package/src/runtime/effects.zig +466 -29
- package/src/runtime/effects_tests.zig +28 -0
- package/src/runtime/file_policy_test_reference.zig +113 -0
- package/src/runtime/flow.zig +418 -341
- package/src/runtime/flow_reference.zig +1426 -0
- package/src/runtime/font_registry_policy.zig +72 -0
- package/src/runtime/frame_profile.zig +24 -33
- package/src/runtime/gpu_surface_events.zig +97 -35
- package/src/runtime/host_event_pump.zig +303 -0
- package/src/runtime/host_event_pump_reference.zig +268 -0
- package/src/runtime/host_flow_policy.zig +155 -0
- package/src/runtime/host_input_regions_policy.zig +156 -0
- package/src/runtime/image_registry_policy.zig +94 -0
- package/src/runtime/input_composition_policy.zig +138 -0
- package/src/runtime/journal_policy.zig +66 -0
- package/src/runtime/journal_reference.zig +53 -0
- package/src/runtime/lifecycle_policy_test_reference.zig +97 -0
- package/src/runtime/markup_development_policy.zig +91 -0
- package/src/runtime/media_surface.zig +40 -1
- package/src/runtime/motion_sampling_policy.zig +159 -0
- package/src/runtime/recording_policy.zig +42 -0
- package/src/runtime/render_animation_policy.zig +206 -0
- package/src/runtime/replay_policy.zig +66 -0
- package/src/runtime/replay_policy_reference.zig +326 -0
- package/src/runtime/replay_progress_policy.zig +64 -0
- package/src/runtime/replay_progress_reference.zig +34 -0
- package/src/runtime/request_policy_test_reference.zig +188 -0
- package/src/runtime/root.zig +13 -0
- package/src/runtime/session_blobs.zig +157 -58
- package/src/runtime/session_blobs_reference.zig +692 -0
- package/src/runtime/session_codec.zig +361 -0
- package/src/runtime/session_codec_reference.zig +1027 -0
- package/src/runtime/session_journal.zig +246 -983
- package/src/runtime/session_record.zig +224 -45
- package/src/runtime/session_replay.zig +157 -415
- package/src/runtime/session_tests.zig +552 -0
- package/src/runtime/shell_admission_policy.zig +225 -0
- package/src/runtime/shell_coordination_policy.zig +138 -0
- package/src/runtime/shell_layout.zig +126 -1
- package/src/runtime/snapshot_policy.zig +60 -0
- package/src/runtime/snapshot_reference.zig +64 -0
- package/src/runtime/state.zig +16 -0
- package/src/runtime/status_validation.zig +190 -0
- package/src/runtime/system_admission_policy.zig +140 -0
- package/src/runtime/system_services.zig +46 -36
- package/src/runtime/tests.zig +1 -0
- package/src/runtime/ts_canvas_hooks.zig +261 -0
- package/src/runtime/ts_canvas_hooks_tests.zig +279 -0
- package/src/runtime/ts_canvas_icons.zig +234 -0
- package/src/runtime/ts_core_host.zig +2325 -411
- package/src/runtime/ts_core_host_tests.zig +1982 -0
- package/src/runtime/ts_test_host.zig +699 -0
- package/src/runtime/ts_ui_app.zig +1087 -45
- package/src/runtime/ui_app.zig +1117 -629
- package/src/runtime/ui_app_provenance.zig +147 -5
- package/src/runtime/ui_app_provenance_reference.zig +370 -0
- package/src/runtime/ui_app_tests.zig +619 -9
- package/src/runtime/ui_app_window_tests.zig +89 -0
- package/src/runtime/view.zig +25 -0
- package/src/runtime/view_canvas.zig +30 -6
- package/src/runtime/view_coordination_policy.zig +147 -0
- package/src/runtime/view_widget_control.zig +51 -14
- package/src/runtime/view_widget_scroll.zig +16 -5
- package/src/runtime/view_widget_text.zig +153 -68
- package/src/runtime/view_widget_tree.zig +460 -56
- package/src/runtime/webview_view_bridge_tests.zig +2 -0
- package/src/runtime/widget_motion_policy.zig +238 -0
- package/src/runtime/window_command_bridge_tests.zig +63 -0
- package/src/runtime/window_lifecycle_policy.zig +127 -0
- package/src/runtime/window_storage.zig +74 -8
- package/src/runtime/window_view_runtime.zig +148 -33
- package/src/runtime/window_views.zig +163 -10
- package/src/tooling/codesign.zig +125 -74
- package/src/tooling/components/identity_tests.zig +62 -36
- package/src/tooling/components/stepper.native +24 -0
- package/src/tooling/components/stepper.zig +0 -19
- package/src/tooling/components/timeline-item.native +22 -0
- package/src/tooling/components/timeline.native +5 -3
- package/src/tooling/components/timeline_item.zig +0 -32
- package/src/tooling/eject_components.zig +76 -8
- package/src/tooling/ios.zig +66 -12
- package/src/tooling/manifest.zig +35 -0
- package/src/tooling/package.zig +85 -1
- package/src/tooling/raw_manifest.zig +6 -0
- package/src/tooling/templates.zig +15 -3
- package/src/tooling/ts_core.zig +13 -3
- package/src/tooling/verbs.zig +22 -0
- package/tools/corewire/build_profile.mjs +54 -0
- package/tools/corewire/contract_intake.ts +303 -0
- package/tools/corewire/contract_intake.zig +82 -0
- package/tools/corewire/core.test.ts +166 -0
- package/tools/corewire/core_abi.zig +51 -0
- package/tools/corewire/core_cases.ts +233 -0
- package/tools/corewire/core_contract.ts +407 -0
- package/tools/corewire/core_emission.ts +136 -0
- package/tools/corewire/core_emission.zig +69 -0
- package/tools/corewire/core_goldens.json +3110 -0
- package/tools/corewire/core_policy.ts +14 -0
- package/tools/corewire/core_policy.zig +48 -0
- package/tools/corewire/core_projection.ts +360 -0
- package/tools/corewire/core_vocabulary.ts +6 -0
- package/tools/corewire/emit.zig +19 -1590
- package/tools/corewire/emit_facade.ts +714 -0
- package/tools/corewire/emit_facade.zig +10 -3752
- package/tools/corewire/emit_mirror.ts +290 -0
- package/tools/corewire/emit_profile.ts +50 -0
- package/tools/corewire/emit_service.ts +331 -0
- package/tools/corewire/emit_service.zig +23 -842
- package/tools/corewire/entry.test.ts +95 -0
- package/tools/corewire/entry_coordination.ts +127 -0
- package/tools/corewire/entry_coordination.zig +190 -0
- package/tools/corewire/facade_templates.ts +85 -0
- package/tools/corewire/filesystem.test.ts +166 -0
- package/tools/corewire/filesystem_coordination.ts +213 -0
- package/tools/corewire/filesystem_coordination.zig +245 -0
- package/tools/corewire/intake.test.ts +35 -0
- package/tools/corewire/intake_cases.ts +55 -0
- package/tools/corewire/intake_goldens.json +12237 -0
- package/tools/corewire/invocation.test.ts +24 -0
- package/tools/corewire/invocation.ts +175 -0
- package/tools/corewire/invocation.zig +136 -0
- package/tools/corewire/invocation_cases.ts +60 -0
- package/tools/corewire/invocation_fixture.ts +33 -0
- package/tools/corewire/invocation_goldens.json +1143 -0
- package/tools/corewire/invocation_tests.zig +111 -0
- package/tools/corewire/invocation_usage.ts +2 -0
- package/tools/corewire/lossless_projection.ts +96 -0
- package/tools/corewire/main.zig +7 -680
- package/tools/corewire/main_reference.zig +415 -0
- package/tools/corewire/mirror_templates.ts +55 -0
- package/tools/corewire/profile.test.ts +248 -0
- package/tools/corewire/profile.zig +56 -0
- package/tools/corewire/profile_emission.ts +202 -0
- package/tools/corewire/profile_library.json +29 -0
- package/tools/corewire/profile_tests.zig +136 -0
- package/tools/corewire/service.test.ts +75 -0
- package/tools/corewire/service_cases.ts +61 -0
- package/tools/corewire/service_contract.zig +40 -146
- package/tools/corewire/service_goldens.json +650 -0
- package/tools/corewire/service_projection.zig +52 -0
- package/tools/corewire/service_templates.ts +14 -0
- package/tools/corewire/shim_rt.zig +9 -0
- package/tools/corewire/sidecar.zig +267 -1438
- package/tools/corewire/emit_profile.zig +0 -521
|
@@ -194,50 +194,6 @@ pub const TerminalCellMetrics = struct {
|
|
|
194
194
|
font_size: f32,
|
|
195
195
|
};
|
|
196
196
|
|
|
197
|
-
/// Glyphs in the advance probe. A row paints as MERGED text runs the
|
|
198
|
-
/// text layout advances itself, so the cell width has to be the layout's
|
|
199
|
-
/// own advance: one glyph's measured width is its box, which on a real
|
|
200
|
-
/// mono face sits inside the advance, and the difference compounds
|
|
201
|
-
/// across a run until the row's tail clips at the widget edge. Measuring
|
|
202
|
-
/// a run and dividing takes the advance the layout will actually use
|
|
203
|
-
/// (every mono cell the same), so column N lands where the painter's
|
|
204
|
-
/// backgrounds, cursor, and selection put it.
|
|
205
|
-
const advance_probe_len = 16;
|
|
206
|
-
const advance_probe = "M" ** advance_probe_len;
|
|
207
|
-
|
|
208
|
-
pub fn cellMetrics(tokens: canvas.DesignTokens) TerminalCellMetrics {
|
|
209
|
-
const font_size = tokens.typography.label_size;
|
|
210
|
-
const height = @round(font_size * 1.4);
|
|
211
|
-
var width: f32 = @round(font_size * 0.6);
|
|
212
|
-
const measured = canvas.measureTextWidthForFont(
|
|
213
|
-
tokens.text_measure,
|
|
214
|
-
tokens.typography.mono_font_id,
|
|
215
|
-
advance_probe,
|
|
216
|
-
font_size,
|
|
217
|
-
);
|
|
218
|
-
if (measured > 0) width = measured / advance_probe_len;
|
|
219
|
-
// Deliberately NOT quantized to the device pixel grid: the cell
|
|
220
|
-
// width has to be the advance the text renderer actually walks a
|
|
221
|
-
// merged run by, and that advance is the face's, not a rounded one.
|
|
222
|
-
// Rounding it — even to a whole device pixel — makes every glyph in
|
|
223
|
-
// a run land a fraction past its cell, and by column 50 the drift is
|
|
224
|
-
// visible against the cell backgrounds, cursor, and selection.
|
|
225
|
-
return .{ .width = width, .height = height, .font_size = font_size };
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
/// Clamp a proposed grid to the canvas budgets: the glyph budget bounds
|
|
229
|
-
/// total cells, so a very wide viewport trades rows for columns to stay
|
|
230
|
-
/// under the cell ceiling instead of overflowing the frame.
|
|
231
|
-
pub fn clampGrid(proposed_cols: usize, proposed_rows: usize) TerminalCellPos {
|
|
232
|
-
var c = std.math.clamp(proposed_cols, 2, max_cols);
|
|
233
|
-
var r = std.math.clamp(proposed_rows, 2, max_rows);
|
|
234
|
-
if (c * r > max_cells) r = @max(2, max_cells / c);
|
|
235
|
-
if (c * r > max_cells) c = @max(2, max_cells / r);
|
|
236
|
-
return .{ .x = @intCast(c), .y = @intCast(r) };
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
// ------------------------------------------------------------- painting
|
|
240
|
-
|
|
241
197
|
/// Everything one paint needs beyond the grid.
|
|
242
198
|
pub const TerminalPaintOptions = struct {
|
|
243
199
|
/// Grid origin and extent in canvas points (the text region).
|
|
@@ -316,663 +272,21 @@ pub fn paintIdBase(id: u64) u64 {
|
|
|
316
272
|
/// keeping the whole namespace under the 2^24 stride).
|
|
317
273
|
pub const reserved_id_offset: u64 = 0x62_0000;
|
|
318
274
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
/// `widgetPartId` convention for identity-less widgets.
|
|
323
|
-
const CommandIds = struct {
|
|
324
|
-
base: u64,
|
|
325
|
-
keyed: bool,
|
|
326
|
-
|
|
327
|
-
fn at(self: CommandIds, offset: u64) u64 {
|
|
328
|
-
return if (self.keyed) self.base +% offset else 0;
|
|
329
|
-
}
|
|
330
|
-
};
|
|
331
|
-
|
|
332
|
-
/// Atlas entries one DISTINCT code point can occupy: the runtime atlas
|
|
333
|
-
/// keys on (font, glyph, size, subpixel_x, subpixel_y), and the
|
|
334
|
-
/// subpixel quantization has FOUR x buckets — a fractional cell width
|
|
335
|
-
/// walks the same scalar through all of them across a row's columns
|
|
336
|
-
/// (the grid's rows share one y bucket: row advance is the rounded
|
|
337
|
-
/// integral cell height). The glyph preflight charges every new code
|
|
338
|
-
/// point at this multiplier so a grid within its budget can never
|
|
339
|
-
/// undercount its own atlas usage 4x and fail the frame with
|
|
340
|
-
/// GlyphAtlasListFull.
|
|
341
|
-
const atlas_variants_per_glyph: usize = 4;
|
|
342
|
-
|
|
343
|
-
/// Distinct-code-point probe set backing `glyph_budget`: open-addressed,
|
|
344
|
-
/// power-of-two slots, zero meaning empty (a stored value is `cp + 1` so
|
|
345
|
-
/// U+0000 never aliases an empty slot). Sized at twice the runtime's
|
|
346
|
-
/// per-view atlas capacity so any honest budget stays under half load
|
|
347
|
-
/// and lookups stay O(1); budgets are clamped to half the slots so the
|
|
348
|
-
/// probe loop can never run against a full table.
|
|
349
|
-
const glyph_probe_slots: usize = 16384;
|
|
350
|
-
|
|
351
|
-
fn glyphProbeInsert(slots: *[glyph_probe_slots]u32, cp: u21) bool {
|
|
352
|
-
const stored: u32 = @as(u32, cp) + 1;
|
|
353
|
-
var index: usize = (stored *% 0x9E37_79B1) >> (32 - 14);
|
|
354
|
-
while (true) {
|
|
355
|
-
const entry = slots[index];
|
|
356
|
-
if (entry == stored) return false;
|
|
357
|
-
if (entry == 0) {
|
|
358
|
-
slots[index] = stored;
|
|
359
|
-
return true;
|
|
360
|
-
}
|
|
361
|
-
index = (index + 1) & (glyph_probe_slots - 1);
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
/// Count the row's code points NOT yet in `seen`, inserting them —
|
|
366
|
-
/// mirroring the paint loop's emissions exactly (spacer cells and box
|
|
367
|
-
/// cells contribute nothing; a cluster's combining marks count like its
|
|
368
|
-
/// primary). Entries inserted by a row the budget then rejects stay in
|
|
369
|
-
/// the set harmlessly: painting stops at that row, so the set is never
|
|
370
|
-
/// consulted again.
|
|
371
|
-
fn rowNewGlyphs(row: TerminalRow, seen: *[glyph_probe_slots]u32) usize {
|
|
372
|
-
var new_count: usize = 0;
|
|
373
|
-
for (row.cells) |cell| {
|
|
374
|
-
if (cell.wide == .spacer or cell.cp == 0) continue;
|
|
375
|
-
if (box.isBoxDrawing(cell.cp)) continue;
|
|
376
|
-
var iterator = std.unicode.Utf8Iterator{ .bytes = cell.cluster, .i = 0 };
|
|
377
|
-
while (iterator.nextCodepoint()) |cp| {
|
|
378
|
-
if (glyphProbeInsert(seen, cp)) new_count += 1;
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
return new_count;
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
/// The bytes painting will actually EMIT for one cell — the preflight
|
|
385
|
-
/// (`rowTextBytes`) sums these against the text store, so this mirrors
|
|
386
|
-
/// the paint loop's suppressions exactly: spacer, empty, and box cells
|
|
387
|
-
/// paint no text.
|
|
388
|
-
fn cellTextBytes(cell: TerminalCell) usize {
|
|
389
|
-
if (cell.wide == .spacer or cell.cp == 0) return 0;
|
|
390
|
-
if (box.isBoxDrawing(cell.cp)) return 0;
|
|
391
|
-
return cell.cluster.len;
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
fn rowTextBytes(row: TerminalRow) usize {
|
|
395
|
-
var total: usize = 0;
|
|
396
|
-
for (row.cells) |cell| total += cellTextBytes(cell);
|
|
397
|
-
return total;
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
/// Rounded-corner code points that draw through `strokePath` and so
|
|
401
|
-
/// consume the builder's path-element store (three elements each). Every
|
|
402
|
-
/// other box glyph paints as `fillRect`s and consumes none.
|
|
403
|
-
fn cellPathElements(cell: TerminalCell) usize {
|
|
404
|
-
if (cell.wide == .spacer or cell.cp == 0) return 0;
|
|
405
|
-
return switch (cell.cp) {
|
|
406
|
-
0x256D, 0x256E, 0x256F, 0x2570 => 3,
|
|
407
|
-
else => 0,
|
|
408
|
-
};
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
fn rowPathElements(row: TerminalRow) usize {
|
|
412
|
-
var total: usize = 0;
|
|
413
|
-
for (row.cells) |cell| total += cellPathElements(cell);
|
|
414
|
-
return total;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
/// Text bytes ALREADY in the display list — every `draw_text`, whether
|
|
418
|
-
/// its bytes are builder-owned (a chart's labels, this grid's own runs)
|
|
419
|
-
/// or referenced from view-owned memory (an earlier text widget). The
|
|
420
|
-
/// runtime's per-view text budget (`CanvasResourceCounts`, 32 KiB)
|
|
421
|
-
/// counts them all, so the grid must degrade against this total, not
|
|
422
|
-
/// against its builder-owned counter alone.
|
|
423
|
-
fn displayListTextBytes(list: canvas.DisplayList) usize {
|
|
424
|
-
var total: usize = 0;
|
|
425
|
-
for (list.commands) |command| {
|
|
426
|
-
if (command == .draw_text) total += command.draw_text.text.len;
|
|
427
|
-
}
|
|
428
|
-
return total;
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
/// Path elements already in the display list — every `fill_path`/
|
|
432
|
-
/// `stroke_path`, including static (comptime) paths that bypass the
|
|
433
|
-
/// builder's element store (an icon's geometry). The runtime's per-view
|
|
434
|
-
/// path-element budget (2048) counts them all.
|
|
435
|
-
fn displayListPathElements(list: canvas.DisplayList) usize {
|
|
436
|
-
var total: usize = 0;
|
|
437
|
-
for (list.commands) |command| {
|
|
438
|
-
total += switch (command) {
|
|
439
|
-
.fill_path => |c| c.elements.len,
|
|
440
|
-
.stroke_path => |c| c.elements.len,
|
|
441
|
-
else => 0,
|
|
442
|
-
};
|
|
443
|
-
}
|
|
444
|
-
return total;
|
|
275
|
+
pub fn cellMetrics(tokens: canvas.DesignTokens) TerminalCellMetrics {
|
|
276
|
+
if (tokens.terminal_paint_policy) |policy| return @import("terminal_paint_policy.zig").metrics(tokens, policy);
|
|
277
|
+
return @import("terminal_grid_reference.zig").cellMetrics(tokens);
|
|
445
278
|
}
|
|
446
279
|
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
/// cell that carries one, plus the cell's ink — eight commands for a
|
|
450
|
-
/// pure-double box joint, two (text run + underline) for a styled
|
|
451
|
-
/// character, none for an empty cell — plus one selection wash. Real
|
|
452
|
-
/// rows merge runs and cost far less; this bound is what the per-row
|
|
453
|
-
/// preflight checks so a row is only started when it can finish whole,
|
|
454
|
-
/// and it is content-accurate (a cheap ASCII row costs ~2/column, not a
|
|
455
|
-
/// flat worst-case-per-column reserve that would starve wide grids).
|
|
456
|
-
fn rowCommandCost(row: TerminalRow) usize {
|
|
457
|
-
var total: usize = 1; // the selection wash
|
|
458
|
-
var i: usize = 0;
|
|
459
|
-
while (i < row.cells.len) : (i += 1) {
|
|
460
|
-
const cell = row.cells[i];
|
|
461
|
-
if (cell.wide == .spacer) continue;
|
|
462
|
-
if (cell.bg != null) total += 1;
|
|
463
|
-
if (cell.cp == 0) continue;
|
|
464
|
-
if (box.isBoxDrawing(cell.cp)) {
|
|
465
|
-
if (box.mergesHorizontally(cell.cp)) {
|
|
466
|
-
// A horizontally-merged run (a long `─` border) paints
|
|
467
|
-
// ONE geometry command plus a possible underline, no
|
|
468
|
-
// matter how wide — mirror the paint loop's merge (same
|
|
469
|
-
// code point, foreground, and underline) so the estimate
|
|
470
|
-
// does not charge nine per column for what collapses to
|
|
471
|
-
// two commands. Backgrounds still count per cell (their
|
|
472
|
-
// own run pass is separate).
|
|
473
|
-
var span: usize = 1;
|
|
474
|
-
while (i + span < row.cells.len) : (span += 1) {
|
|
475
|
-
const next = row.cells[i + span];
|
|
476
|
-
if (next.cp != cell.cp or !colorEql(next.fg, cell.fg) or next.underline != cell.underline) break;
|
|
477
|
-
if (next.bg != null) total += 1;
|
|
478
|
-
}
|
|
479
|
-
// A merged run's worst-case ink: a double piece (═)
|
|
480
|
-
// paints TWO parallel bars, plus a possible underline.
|
|
481
|
-
total += 3;
|
|
482
|
-
i += span - 1;
|
|
483
|
-
} else {
|
|
484
|
-
// The glyph's own worst case (kept lockstep with the
|
|
485
|
-
// paint switch by `box.maxCommands`) plus a possible
|
|
486
|
-
// underline — a row of one-bar pieces costs what it
|
|
487
|
-
// paints, never a flat joint-worst-case that starves
|
|
488
|
-
// wide grids.
|
|
489
|
-
total += box.maxCommands(cell.cp) + 1;
|
|
490
|
-
}
|
|
491
|
-
} else {
|
|
492
|
-
total += 2; // the text run plus its underline
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
return total;
|
|
280
|
+
pub fn clampGrid(proposed_cols: usize, proposed_rows: usize) TerminalCellPos {
|
|
281
|
+
return @import("terminal_grid_reference.zig").clampGrid(proposed_cols, proposed_rows);
|
|
496
282
|
}
|
|
497
283
|
|
|
498
|
-
fn
|
|
499
|
-
|
|
284
|
+
pub fn clampGridWithPolicy(proposed_cols: usize, proposed_rows: usize, policy: ?*const fn ([]const u8, []u8) usize) TerminalCellPos {
|
|
285
|
+
if (policy) |owner| return @import("terminal_paint_policy.zig").clampGrid(proposed_cols, proposed_rows, owner);
|
|
286
|
+
return clampGrid(proposed_cols, proposed_rows);
|
|
500
287
|
}
|
|
501
288
|
|
|
502
|
-
/// Paint the grid into the display list: per-row background runs, the
|
|
503
|
-
/// selection wash, per-run text, decorations, the cursor, the keyboard
|
|
504
|
-
/// caret, and the scrollback indicator. Row commands carry stable ids
|
|
505
|
-
/// derived from `options.id_base` so the retained renderer's diff keeps
|
|
506
|
-
/// damage row-shaped.
|
|
507
289
|
pub fn paint(grid: TerminalGrid, builder: *canvas.Builder, options: TerminalPaintOptions) !void {
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
// The command-id namespace (see `paintIdBase`): the widget part-id
|
|
511
|
-
// convention with a 24-bit slot space. An anonymous caller (id 0)
|
|
512
|
-
// keeps the framework's unkeyed convention — every command id 0.
|
|
513
|
-
const ids = CommandIds{ .base = paintIdBase(options.id_base), .keyed = options.id_base != 0 };
|
|
514
|
-
|
|
515
|
-
// Fixed prologue/epilogue overhead (background fill, clip push,
|
|
516
|
-
// scrollbar thumb, clip pop): if the builder — with whatever earlier
|
|
517
|
-
// widgets already emitted — cannot seat that overhead under the
|
|
518
|
-
// budget, the paint degrades to nothing BEFORE emitting the prologue,
|
|
519
|
-
// so a full builder never overruns its ceiling and never leaves an
|
|
520
|
-
// unbalanced clip. The `builder.len` term is what makes the check an
|
|
521
|
-
// ABSOLUTE ceiling, not a per-paint one. 0 stays the unbounded
|
|
522
|
-
// (test) mode.
|
|
523
|
-
const fixed_overhead: usize = 8;
|
|
524
|
-
if (options.command_budget > 0 and builder.len + fixed_overhead > options.command_budget) return;
|
|
525
|
-
|
|
526
|
-
// The terminal surface: full-bleed background under the grid.
|
|
527
|
-
try builder.fillRect(.{
|
|
528
|
-
.id = ids.at(0x61_0000),
|
|
529
|
-
.rect = options.background_frame orelse options.frame,
|
|
530
|
-
.fill = .{ .color = grid.background },
|
|
531
|
-
});
|
|
532
|
-
|
|
533
|
-
// Everything the grid paints is CLIPPED to its frame: for one frame
|
|
534
|
-
// after a shrink the producer may still hold the pre-resize grid,
|
|
535
|
-
// and unclipped rows or wide cells would paint past the region. The
|
|
536
|
-
// clip makes the stale frame degrade to a cropped grid.
|
|
537
|
-
try builder.pushClip(.{ .id = ids.at(0x61_0001), .rect = options.frame });
|
|
538
|
-
|
|
539
|
-
const origin_x = options.frame.x;
|
|
540
|
-
const origin_y = options.frame.y;
|
|
541
|
-
const cell_w = metrics.width;
|
|
542
|
-
const cell_h = metrics.height;
|
|
543
|
-
|
|
544
|
-
// The id stride between box cells: a pure-double joint (╬ ╪ ╫ and the
|
|
545
|
-
// double tees) emits up to eight commands, so a shorter stride would
|
|
546
|
-
// collide adjacent double cells' ids.
|
|
547
|
-
const commands_per_cell: usize = 8;
|
|
548
|
-
// The command budget is checked PER ROW against that row's actual
|
|
549
|
-
// upper-bound cost (`rowCommandCost`), not a flat worst-case-per-
|
|
550
|
-
// column reserve: a cheap ASCII row costs ~2/column, so a wide grid
|
|
551
|
-
// paints its rows instead of reserving them all away. The epilogue
|
|
552
|
-
// (cursor, caret, scrollbar thumb, clip pop) rides this fixed slack.
|
|
553
|
-
const epilogue_reserve: usize = 8;
|
|
554
|
-
// The per-view TEXT budget is a separate ceiling from the command
|
|
555
|
-
// count, and the runtime enforces it over EVERY `draw_text` in the
|
|
556
|
-
// finished display list (`CanvasResourceCounts`, 32 KiB) — referenced
|
|
557
|
-
// sibling text included, not just this builder's own `allocTextBytes`
|
|
558
|
-
// bytes. So the grid degrades against the running total of ALL text
|
|
559
|
-
// already in the list plus what it adds, minus the reserve held back
|
|
560
|
-
// for widgets emitted AFTER it. Each row is measured up front and
|
|
561
|
-
// skipped WHOLE if it would cross the ceiling — never torn midway.
|
|
562
|
-
const text_ceiling: usize = if (canvas.max_display_list_text_bytes > options.text_reserve)
|
|
563
|
-
canvas.max_display_list_text_bytes - options.text_reserve
|
|
564
|
-
else
|
|
565
|
-
0;
|
|
566
|
-
var text_total: usize = displayListTextBytes(builder.displayList());
|
|
567
|
-
// The per-view PATH-ELEMENT budget (2048), likewise enforced over the
|
|
568
|
-
// whole display list including static sibling paths (an icon's
|
|
569
|
-
// geometry) that never touch this builder's element store — so the
|
|
570
|
-
// rounded-corner preflight degrades against the running list total,
|
|
571
|
-
// not the builder-owned counter alone.
|
|
572
|
-
var path_total: usize = displayListPathElements(builder.displayList());
|
|
573
|
-
const path_ceiling: usize = builder.path_elements.len -| options.path_reserve;
|
|
574
|
-
|
|
575
|
-
// The glyph-atlas proxy budget (see `TerminalPaintOptions`): clamped
|
|
576
|
-
// under half the probe table so insertion can never scan a full
|
|
577
|
-
// ring; the set costs one 64 KiB clear per bounded paint.
|
|
578
|
-
const glyph_budget = @min(options.glyph_budget, glyph_probe_slots / 2);
|
|
579
|
-
var glyph_seen: [glyph_probe_slots]u32 = undefined;
|
|
580
|
-
if (glyph_budget > 0) @memset(&glyph_seen, 0);
|
|
581
|
-
var glyphs_counted: usize = 0;
|
|
582
|
-
|
|
583
|
-
// Light box-drawing line weight, scaled with the cell (roughly the
|
|
584
|
-
// stroke a terminal font would carry at this size).
|
|
585
|
-
const box_thickness: f32 = @max(1, @round(metrics.font_size / 8));
|
|
586
|
-
|
|
587
|
-
// A run's staging buffer, sized to the whole text store (see
|
|
588
|
-
// `text_scratch_bytes`): any cluster the store can hold stages
|
|
589
|
-
// whole. The run-break flushes when the buffer nears full, so long
|
|
590
|
-
// runs simply split across draw commands rather than overflow.
|
|
591
|
-
var text_scratch: [text_scratch_bytes]u8 = undefined;
|
|
592
|
-
// Rows painted so far (the loop paints 0..N contiguously from the
|
|
593
|
-
// top and stops at the first row a budget rejects): the cursor and
|
|
594
|
-
// caret below are suppressed on any row this never reached, so a row
|
|
595
|
-
// dropped for budget never leaves its lone cursor floating over the
|
|
596
|
-
// blank background.
|
|
597
|
-
var painted_rows: usize = 0;
|
|
598
|
-
for (grid.rows, 0..) |row, row_index| {
|
|
599
|
-
// Command-count stop, ATOMIC per row: this row's actual
|
|
600
|
-
// upper-bound cost plus the epilogue must fit the budget, so a
|
|
601
|
-
// cheap wide row paints while a genuinely too-dense row (and
|
|
602
|
-
// everything after it) is skipped whole — never started and torn.
|
|
603
|
-
if (options.command_budget > 0 and
|
|
604
|
-
builder.len + rowCommandCost(row) + epilogue_reserve > options.command_budget) break;
|
|
605
|
-
// Text stop, ATOMIC per row, against the view-global running
|
|
606
|
-
// total (all draw_text already in the list plus this row's
|
|
607
|
-
// bytes) — stop BEFORE a row that would cross the per-view text
|
|
608
|
-
// ceiling, never emit its first runs and then have the frame
|
|
609
|
-
// rejected at commit. A row that ADDS no text can never cross
|
|
610
|
-
// anything, so it paints even when earlier widgets already sit
|
|
611
|
-
// past the grid's reserved share — the ceiling bounds what the
|
|
612
|
-
// grid adds, not what its siblings spent.
|
|
613
|
-
const row_text = rowTextBytes(row);
|
|
614
|
-
if (row_text > 0 and text_total + row_text > text_ceiling) break;
|
|
615
|
-
// Path-element stop, ATOMIC per row, against the view-global
|
|
616
|
-
// running total (static sibling paths included): a row of rounded
|
|
617
|
-
// corners is skipped BEFORE it would cross the per-view
|
|
618
|
-
// path-element budget; a row adding none paints regardless.
|
|
619
|
-
const row_paths = rowPathElements(row);
|
|
620
|
-
if (row_paths > 0 and path_total + row_paths > path_ceiling) break;
|
|
621
|
-
// Glyph-budget stop, same row-atomic shape: stop BEFORE the row
|
|
622
|
-
// whose new DISTINCT code points would cross the atlas proxy —
|
|
623
|
-
// the frame degrades to fewer rows instead of failing whole on
|
|
624
|
-
// `GlyphAtlasListFull`.
|
|
625
|
-
if (glyph_budget > 0) {
|
|
626
|
-
glyphs_counted += rowNewGlyphs(row, &glyph_seen) * atlas_variants_per_glyph;
|
|
627
|
-
if (glyphs_counted > glyph_budget) break;
|
|
628
|
-
}
|
|
629
|
-
// Row-atomic rollback snapshot: the preflights above make a tear
|
|
630
|
-
// unreachable, but if a builder store is ever exhausted mid-row
|
|
631
|
-
// anyway, these restore points drop the partial row's commands
|
|
632
|
-
// whole (see the `row_torn` handling below) so nothing half a row
|
|
633
|
-
// ever reaches the glass.
|
|
634
|
-
const row_start_len = builder.len;
|
|
635
|
-
const row_start_paths = builder.path_element_len;
|
|
636
|
-
const row_start_text = builder.text_byte_len;
|
|
637
|
-
const row_y = origin_y + @as(f32, @floatFromInt(row_index)) * cell_h;
|
|
638
|
-
// Rows STARTING at or past the frame's bottom paint nothing
|
|
639
|
-
// visible; a row straddling the edge still paints and the clip
|
|
640
|
-
// crops it, so content reaches the very edge without spilling.
|
|
641
|
-
if (row_y >= options.frame.y + options.frame.height) break;
|
|
642
|
-
const row_id = @as(u64, @intCast(row_index)) << 16;
|
|
643
|
-
|
|
644
|
-
// Background runs: contiguous cells sharing a non-default bg
|
|
645
|
-
// (the producer already extended a wide primary's background
|
|
646
|
-
// onto its spacer column).
|
|
647
|
-
var run_start: usize = 0;
|
|
648
|
-
var run_color: ?canvas.Color = null;
|
|
649
|
-
var x: usize = 0;
|
|
650
|
-
while (x <= row.cells.len) : (x += 1) {
|
|
651
|
-
const bg: ?canvas.Color = if (x < row.cells.len) row.cells[x].bg else null;
|
|
652
|
-
if (run_color) |color| {
|
|
653
|
-
const same = if (bg) |next| colorEql(color, next) else false;
|
|
654
|
-
if (!same) {
|
|
655
|
-
try builder.fillRect(.{
|
|
656
|
-
.id = ids.at(row_id + 1 + run_start),
|
|
657
|
-
.rect = geometry.RectF.init(
|
|
658
|
-
origin_x + @as(f32, @floatFromInt(run_start)) * cell_w,
|
|
659
|
-
row_y,
|
|
660
|
-
@as(f32, @floatFromInt(x - run_start)) * cell_w,
|
|
661
|
-
cell_h,
|
|
662
|
-
),
|
|
663
|
-
.fill = .{ .color = color },
|
|
664
|
-
});
|
|
665
|
-
run_color = bg;
|
|
666
|
-
run_start = x;
|
|
667
|
-
}
|
|
668
|
-
} else if (bg != null) {
|
|
669
|
-
run_color = bg;
|
|
670
|
-
run_start = x;
|
|
671
|
-
}
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
// Selection wash (under the ink, over the backgrounds).
|
|
675
|
-
if (row.selection) |range| {
|
|
676
|
-
const wash = canvas.Color.rgba(
|
|
677
|
-
grid.selection_color.r,
|
|
678
|
-
grid.selection_color.g,
|
|
679
|
-
grid.selection_color.b,
|
|
680
|
-
0.30,
|
|
681
|
-
);
|
|
682
|
-
try builder.fillRect(.{
|
|
683
|
-
.id = ids.at(row_id + 0x4000),
|
|
684
|
-
.rect = geometry.RectF.init(
|
|
685
|
-
origin_x + @as(f32, @floatFromInt(range[0])) * cell_w,
|
|
686
|
-
row_y,
|
|
687
|
-
@as(f32, @floatFromInt(@as(usize, range[1]) - range[0] + 1)) * cell_w,
|
|
688
|
-
cell_h,
|
|
689
|
-
),
|
|
690
|
-
.fill = .{ .color = wash },
|
|
691
|
-
});
|
|
692
|
-
}
|
|
693
|
-
|
|
694
|
-
// Text runs: contiguous cells sharing a foreground, flushed on
|
|
695
|
-
// color or decoration change (bold/italic render with the one
|
|
696
|
-
// mono face — weight axes require registered companion faces,
|
|
697
|
-
// a limitation the docs state outright).
|
|
698
|
-
// A builder-store exhaustion mid-row (the display list, its text
|
|
699
|
-
// bytes, or its path elements filling despite the reserves) TEARS
|
|
700
|
-
// the row: the reserves make it unreachable in the widget path,
|
|
701
|
-
// but if it ever happens the row is left incomplete, so it must
|
|
702
|
-
// NOT count as painted and no further row may start — otherwise
|
|
703
|
-
// the cursor could paint over content the tear dropped.
|
|
704
|
-
var row_torn = false;
|
|
705
|
-
var run_len: usize = 0;
|
|
706
|
-
var run_x: usize = 0;
|
|
707
|
-
var run_fg: canvas.Color = grid.foreground;
|
|
708
|
-
var run_underline = false;
|
|
709
|
-
var text_len: usize = 0;
|
|
710
|
-
// Multi-codepoint clusters (combining marks) paint as their OWN
|
|
711
|
-
// single-cell run at their exact cell origin: inside a merged
|
|
712
|
-
// run their advance would come from the text layout, and a
|
|
713
|
-
// layout that advances a combining mark by a full glyph would
|
|
714
|
-
// shift every later cell in the run off the grid — while the
|
|
715
|
-
// backgrounds, cursor, and selection stayed cell-aligned.
|
|
716
|
-
// Isolating the cluster pins its neighbors to their own cell
|
|
717
|
-
// origins whatever the mark advances to; plain single-scalar
|
|
718
|
-
// runs keep the merged fast path.
|
|
719
|
-
var break_after_cluster = false;
|
|
720
|
-
x = 0;
|
|
721
|
-
while (x <= row.cells.len) : (x += 1) {
|
|
722
|
-
var cp: u21 = 0;
|
|
723
|
-
var fg = grid.foreground;
|
|
724
|
-
var underline = false;
|
|
725
|
-
var skip = false;
|
|
726
|
-
var box_cp: u21 = 0;
|
|
727
|
-
var cell_bytes: usize = 0;
|
|
728
|
-
var multi_cluster = false;
|
|
729
|
-
if (x < row.cells.len) {
|
|
730
|
-
const cell = row.cells[x];
|
|
731
|
-
if (cell.wide == .spacer) skip = true;
|
|
732
|
-
cp = cell.cp;
|
|
733
|
-
fg = cell.fg;
|
|
734
|
-
underline = cell.underline;
|
|
735
|
-
// Box-drawing, block, and shade cells render as GEOMETRY
|
|
736
|
-
// at exact cell bounds, never font glyphs: glyphs fill
|
|
737
|
-
// the em box, not the padded cell, so borders drawn from
|
|
738
|
-
// them show seams between rows and columns. The cell
|
|
739
|
-
// still breaks the text run (cp zeroes) and paints below.
|
|
740
|
-
if (cp != 0 and !skip and box.isBoxDrawing(cp)) {
|
|
741
|
-
box_cp = cp;
|
|
742
|
-
cp = 0;
|
|
743
|
-
}
|
|
744
|
-
// The current cell's full byte need: the run breaks
|
|
745
|
-
// BEFORE a cell that would not fit the remaining
|
|
746
|
-
// scratch, so the cell restarts in a fresh buffer and a
|
|
747
|
-
// large grapheme landing near the buffer's end keeps
|
|
748
|
-
// all its marks instead of being cut.
|
|
749
|
-
if (cp != 0 and !skip) {
|
|
750
|
-
cell_bytes = cell.cluster.len;
|
|
751
|
-
const primary_len = std.unicode.utf8CodepointSequenceLength(cp) catch 1;
|
|
752
|
-
multi_cluster = cell.cluster.len > primary_len;
|
|
753
|
-
}
|
|
754
|
-
}
|
|
755
|
-
const breaks = x == row.cells.len or skip or cp == 0 or
|
|
756
|
-
!colorEql(fg, run_fg) or underline != run_underline or
|
|
757
|
-
multi_cluster or break_after_cluster or
|
|
758
|
-
text_len + cell_bytes > text_scratch.len;
|
|
759
|
-
if (breaks and run_len > 0 and text_len > 0) {
|
|
760
|
-
// The row-wise text ceiling reserves enough that this
|
|
761
|
-
// append fits; the catch is a defensive floor that stops
|
|
762
|
-
// the run cleanly if it ever did not (never a torn cell).
|
|
763
|
-
const run_text = builder.allocTextBytes(text_scratch[0..text_len]) catch {
|
|
764
|
-
row_torn = true;
|
|
765
|
-
break;
|
|
766
|
-
};
|
|
767
|
-
try builder.drawText(.{
|
|
768
|
-
.id = ids.at(row_id + 0x8000 + run_x),
|
|
769
|
-
.font_id = tokens.typography.mono_font_id,
|
|
770
|
-
.size = metrics.font_size,
|
|
771
|
-
// `origin` is the BASELINE, not the glyph top: the
|
|
772
|
-
// canvas boxes a run as one em of ascent above the
|
|
773
|
-
// origin and a quarter below, so centering that
|
|
774
|
-
// 1.25em box in the cell puts the baseline at
|
|
775
|
-
// row top + (cell - 1.25*size)/2 + size. Anchoring
|
|
776
|
-
// the top here instead paints every row one line
|
|
777
|
-
// high — and the clip swallows row zero whole.
|
|
778
|
-
.origin = geometry.PointF.init(
|
|
779
|
-
origin_x + @as(f32, @floatFromInt(run_x)) * cell_w,
|
|
780
|
-
row_y + (cell_h - metrics.font_size * 1.25) * 0.5 + metrics.font_size,
|
|
781
|
-
),
|
|
782
|
-
.color = run_fg,
|
|
783
|
-
.text = run_text,
|
|
784
|
-
// The run carries the measurement seam for one
|
|
785
|
-
// reason: a command's raster extent comes from its
|
|
786
|
-
// own declared bounds, and without a provider those
|
|
787
|
-
// bounds are the estimator's 0.6 em mono pitch. A
|
|
788
|
-
// host face with a wider pitch (macOS resolves the
|
|
789
|
-
// mono id to the system monospaced face at 0.618 em
|
|
790
|
-
// when Geist Mono is absent) then inks past the
|
|
791
|
-
// declared extent, and a full-width row loses its
|
|
792
|
-
// last cell — measured: column 50 of 50 sheared to a
|
|
793
|
-
// two-pixel sliver. Measuring the run the way the
|
|
794
|
-
// host inks it makes the bounds cover the ink for
|
|
795
|
-
// whatever face resolves. Line breaking stays off
|
|
796
|
-
// (`wrap = .none`, no `max_width`), so the run still
|
|
797
|
-
// paints as one line at this exact baseline.
|
|
798
|
-
.text_layout = .{
|
|
799
|
-
.wrap = .none,
|
|
800
|
-
.line_height = cell_h,
|
|
801
|
-
.measure = tokens.text_measure,
|
|
802
|
-
},
|
|
803
|
-
});
|
|
804
|
-
if (run_underline) {
|
|
805
|
-
try builder.fillRect(.{
|
|
806
|
-
.id = ids.at(row_id + 0xc000 + run_x),
|
|
807
|
-
.rect = geometry.RectF.init(
|
|
808
|
-
origin_x + @as(f32, @floatFromInt(run_x)) * cell_w,
|
|
809
|
-
row_y + cell_h - 2,
|
|
810
|
-
@as(f32, @floatFromInt(run_len)) * cell_w,
|
|
811
|
-
1,
|
|
812
|
-
),
|
|
813
|
-
.fill = .{ .color = run_fg },
|
|
814
|
-
});
|
|
815
|
-
}
|
|
816
|
-
text_len = 0;
|
|
817
|
-
run_len = 0;
|
|
818
|
-
}
|
|
819
|
-
if (x >= row.cells.len or skip) continue;
|
|
820
|
-
if (box_cp != 0) {
|
|
821
|
-
// Merge a run of the same seamless piece (a border's
|
|
822
|
-
// long `─`) into ONE command: fewer commands and one
|
|
823
|
-
// unbroken bar instead of per-cell segments. Cells merge
|
|
824
|
-
// only when they match on EVERY channel the span paints —
|
|
825
|
-
// code point, foreground, AND underline — so a run where
|
|
826
|
-
// underline toggles mid-way breaks into separate spans
|
|
827
|
-
// and each keeps its own decoration.
|
|
828
|
-
var span: usize = 1;
|
|
829
|
-
if (box.mergesHorizontally(box_cp)) {
|
|
830
|
-
while (x + span < row.cells.len) : (span += 1) {
|
|
831
|
-
const next = row.cells[x + span];
|
|
832
|
-
if (next.cp != box_cp or !colorEql(next.fg, fg) or next.underline != underline) break;
|
|
833
|
-
}
|
|
834
|
-
}
|
|
835
|
-
const rect = geometry.RectF.init(
|
|
836
|
-
origin_x + @as(f32, @floatFromInt(x)) * cell_w,
|
|
837
|
-
row_y,
|
|
838
|
-
@as(f32, @floatFromInt(span)) * cell_w,
|
|
839
|
-
cell_h,
|
|
840
|
-
);
|
|
841
|
-
// Eight-command stride per column: a pure-double joint
|
|
842
|
-
// emits up to eight commands (two bars per side), so a
|
|
843
|
-
// four-wide stride would collide the ids of adjacent
|
|
844
|
-
// double cells and fail the retained diff with
|
|
845
|
-
// DuplicateObjectId.
|
|
846
|
-
box.paint(builder, ids.at(row_id + 0x6000 + @as(u64, @intCast(x)) * commands_per_cell), rect, box_cp, fg, box_thickness) catch {
|
|
847
|
-
row_torn = true;
|
|
848
|
-
break;
|
|
849
|
-
};
|
|
850
|
-
// A box/block cell can still carry SGR underline: the
|
|
851
|
-
// geometry replaces the glyph, not its decoration, so an
|
|
852
|
-
// underlined `─` or `█` keeps its underline like any other
|
|
853
|
-
// styled cell (0xd000 id range, clear of the box geometry
|
|
854
|
-
// and text ranges).
|
|
855
|
-
if (underline) {
|
|
856
|
-
builder.fillRect(.{
|
|
857
|
-
.id = ids.at(row_id + 0xd000 + @as(u64, @intCast(x))),
|
|
858
|
-
.rect = geometry.RectF.init(rect.x, row_y + cell_h - 2, rect.width, 1),
|
|
859
|
-
.fill = .{ .color = fg },
|
|
860
|
-
}) catch {
|
|
861
|
-
row_torn = true;
|
|
862
|
-
break;
|
|
863
|
-
};
|
|
864
|
-
}
|
|
865
|
-
x += span - 1;
|
|
866
|
-
continue;
|
|
867
|
-
}
|
|
868
|
-
if (cp == 0) continue;
|
|
869
|
-
if (run_len == 0) {
|
|
870
|
-
run_x = x;
|
|
871
|
-
run_fg = fg;
|
|
872
|
-
run_underline = underline;
|
|
873
|
-
}
|
|
874
|
-
const cell = row.cells[x];
|
|
875
|
-
// Stage the whole cluster; the break above guaranteed it
|
|
876
|
-
// fits, and the min is a defensive floor that can only cut
|
|
877
|
-
// where the preflight already stopped the row.
|
|
878
|
-
const take = @min(cell.cluster.len, text_scratch.len - text_len);
|
|
879
|
-
@memcpy(text_scratch[text_len..][0..take], cell.cluster[0..take]);
|
|
880
|
-
text_len += take;
|
|
881
|
-
run_len += if (cell.wide == .wide) 2 else 1;
|
|
882
|
-
break_after_cluster = multi_cluster;
|
|
883
|
-
}
|
|
884
|
-
// A torn row is not painted content: roll the builder back to the
|
|
885
|
-
// row's start so no partial row reaches the glass, then stop (the
|
|
886
|
-
// suppressed cursor/caret rely on `painted_rows` not advancing).
|
|
887
|
-
if (row_torn) {
|
|
888
|
-
builder.len = row_start_len;
|
|
889
|
-
builder.path_element_len = row_start_paths;
|
|
890
|
-
builder.text_byte_len = row_start_text;
|
|
891
|
-
break;
|
|
892
|
-
}
|
|
893
|
-
// Advance the view-global running totals by exactly what this row
|
|
894
|
-
// added (the builder-owned deltas): the terminal's own text/path
|
|
895
|
-
// emissions all flow through `allocTextBytes`/`allocPathElements`,
|
|
896
|
-
// so the counter deltas are its contribution to the per-view
|
|
897
|
-
// budgets the next row's preflight checks.
|
|
898
|
-
text_total += builder.text_byte_len - row_start_text;
|
|
899
|
-
path_total += builder.path_element_len - row_start_paths;
|
|
900
|
-
painted_rows = row_index + 1;
|
|
901
|
-
}
|
|
902
|
-
|
|
903
|
-
// The cursor, over the ink: solid only while this live terminal owns
|
|
904
|
-
// keyboard focus. Blur leaves the conventional hollow terminal
|
|
905
|
-
// cursor; an ended session keeps that outline at the dimmer stopped
|
|
906
|
-
// alpha. Suppressed if its row was never painted (dropped for budget).
|
|
907
|
-
if (grid.cursor) |cursor| if (cursor.y < painted_rows) {
|
|
908
|
-
const cursor_x = origin_x + @as(f32, @floatFromInt(cursor.x)) * cell_w;
|
|
909
|
-
const cursor_y = origin_y + @as(f32, @floatFromInt(cursor.y)) * cell_h;
|
|
910
|
-
const cursor_color = canvas.Color.rgba(
|
|
911
|
-
grid.cursor_color.r,
|
|
912
|
-
grid.cursor_color.g,
|
|
913
|
-
grid.cursor_color.b,
|
|
914
|
-
if (grid.running) 0.45 else 0.22,
|
|
915
|
-
);
|
|
916
|
-
const rect = switch (cursor.shape) {
|
|
917
|
-
.bar => geometry.RectF.init(cursor_x, cursor_y, 2, cell_h),
|
|
918
|
-
.underline => geometry.RectF.init(cursor_x, cursor_y + cell_h - 2, cell_w, 2),
|
|
919
|
-
.block => geometry.RectF.init(cursor_x, cursor_y, cell_w, cell_h),
|
|
920
|
-
};
|
|
921
|
-
if (options.focused and grid.running) {
|
|
922
|
-
try builder.fillRect(.{
|
|
923
|
-
.id = ids.at(0x61_0002),
|
|
924
|
-
.rect = rect,
|
|
925
|
-
.fill = .{ .color = cursor_color },
|
|
926
|
-
});
|
|
927
|
-
} else {
|
|
928
|
-
try builder.strokeRect(.{
|
|
929
|
-
.id = ids.at(0x61_0002),
|
|
930
|
-
.rect = rect,
|
|
931
|
-
.stroke = .{ .fill = .{ .color = cursor_color }, .width = 1 },
|
|
932
|
-
});
|
|
933
|
-
}
|
|
934
|
-
};
|
|
935
|
-
|
|
936
|
-
// Selection head outline while selecting (the keyboard caret).
|
|
937
|
-
// Suppressed on a row that was never painted, like the cursor.
|
|
938
|
-
if (grid.select_head) |head| if (head.y < painted_rows) {
|
|
939
|
-
const head_x = origin_x + @as(f32, @floatFromInt(head.x)) * cell_w;
|
|
940
|
-
const head_y = origin_y + @as(f32, @floatFromInt(head.y)) * cell_h;
|
|
941
|
-
try builder.strokeRect(.{
|
|
942
|
-
.id = ids.at(0x61_0003),
|
|
943
|
-
.rect = geometry.RectF.init(head_x, head_y, cell_w, cell_h),
|
|
944
|
-
.stroke = .{ .fill = .{ .color = tokens.colors.focus_ring }, .width = 1 },
|
|
945
|
-
});
|
|
946
|
-
};
|
|
947
|
-
|
|
948
|
-
// Scrollback indicator: a right-edge thumb while the viewport is in
|
|
949
|
-
// history, sized by the visible fraction.
|
|
950
|
-
const bar = grid.scrollbar;
|
|
951
|
-
if (bar.total > bar.len) {
|
|
952
|
-
const total: f32 = @floatFromInt(bar.total);
|
|
953
|
-
const offset: f32 = @floatFromInt(bar.offset);
|
|
954
|
-
const visible: f32 = @floatFromInt(bar.len);
|
|
955
|
-
const at_bottom = bar.offset + bar.len >= bar.total;
|
|
956
|
-
if (!at_bottom) {
|
|
957
|
-
const track_h = options.frame.height;
|
|
958
|
-
const thumb_h = @max(24, track_h * (visible / total));
|
|
959
|
-
const thumb_y = options.frame.y + (track_h - thumb_h) * (offset / @max(1, total - visible));
|
|
960
|
-
try builder.fillRect(.{
|
|
961
|
-
.id = ids.at(0x61_0004),
|
|
962
|
-
.rect = geometry.RectF.init(
|
|
963
|
-
options.frame.x + options.frame.width - 5,
|
|
964
|
-
thumb_y,
|
|
965
|
-
3,
|
|
966
|
-
thumb_h,
|
|
967
|
-
),
|
|
968
|
-
.fill = .{ .color = canvas.Color.rgba(
|
|
969
|
-
tokens.colors.text_muted.r,
|
|
970
|
-
tokens.colors.text_muted.g,
|
|
971
|
-
tokens.colors.text_muted.b,
|
|
972
|
-
0.6,
|
|
973
|
-
) },
|
|
974
|
-
});
|
|
975
|
-
}
|
|
976
|
-
}
|
|
977
|
-
try builder.popClip();
|
|
290
|
+
if (options.tokens.terminal_paint_policy) |policy| return @import("terminal_paint_policy.zig").paint(grid, builder, options, policy);
|
|
291
|
+
return @import("terminal_grid_reference.zig").paint(grid, builder, options);
|
|
978
292
|
}
|