@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,192 @@
|
|
|
1
|
+
// Paragraph layout continuation. The host measures only the requested raw
|
|
2
|
+
// span slice. Every cursor, word, line, alignment and capacity decision lives
|
|
3
|
+
// in this copied packet; no host pointer or compiler frame is retained.
|
|
4
|
+
function nscvParagraphLayout(request: Uint8Array): Uint8Array {
|
|
5
|
+
if (request.length < 192 || request[0] !== 53 || request[1]! > 1 || request[2] !== 1 || request[3]! > 2 || request[4]! > 2 || request[5]! > 1 || request[6]! > 1 || request[7]! > 2)
|
|
6
|
+
throw new Error("invalid paragraph header");
|
|
7
|
+
const out = request.slice(), w = new DataView(out.buffer);
|
|
8
|
+
const u = (at: number): number => w.getUint32(at, true);
|
|
9
|
+
const f = (at: number): number => w.getFloat32(at, true);
|
|
10
|
+
const put = (at: number, value: number): void => { w.setUint32(at, value, true); };
|
|
11
|
+
const float = (at: number, value: number): void => { w.setFloat32(at, value, true); };
|
|
12
|
+
const sourceCount = u(8), count = Math.min(sourceCount, 32), capacity = u(12), first = u(16), data = u(20);
|
|
13
|
+
const pieces = 192 + sourceCount * 32, runs = pieces + 32 * 16;
|
|
14
|
+
if (data !== runs + capacity * 32 || u(24) !== out.length || data > out.length)
|
|
15
|
+
throw new Error("invalid paragraph storage");
|
|
16
|
+
let endOfText = data;
|
|
17
|
+
for (let s = 0; s < sourceCount; s++) {
|
|
18
|
+
const at = 192 + s * 32;
|
|
19
|
+
if (u(at) !== endOfText || u(at + 4) > out.length - endOfText || u(at + 16) > 1)
|
|
20
|
+
throw new Error("invalid paragraph span");
|
|
21
|
+
endOfText += u(at + 4);
|
|
22
|
+
for (let p = at + 20; p < at + 32; p++) if (out[p] !== 0) throw new Error("invalid paragraph reserved byte");
|
|
23
|
+
}
|
|
24
|
+
if (endOfText !== out.length || u(56) > capacity || u(60) > u(56) || u(96) > 32 || u(112) > u(96) || u(72) > 1 || u(76) > 1 || u(40) > 10)
|
|
25
|
+
throw new Error("invalid paragraph continuation");
|
|
26
|
+
if (out[5] !== (sourceCount > 32 ? 1 : 0)) throw new Error("invalid paragraph truncation flag");
|
|
27
|
+
for (let at = 172; at < 184; at++) if (out[at] !== 0) throw new Error("invalid paragraph reserved byte");
|
|
28
|
+
const length = (s: number): number => { if (s >= count) throw new Error("invalid paragraph span index"); return u(196 + s * 32); };
|
|
29
|
+
const byte = (s: number, p: number): number => { if (p >= length(s)) throw new Error("invalid paragraph byte index"); return out[u(192 + s * 32) + p]!; };
|
|
30
|
+
const range = (s: number, a: number, b: number): void => { if (s >= count || a > b || b > length(s)) throw new Error("invalid paragraph range"); };
|
|
31
|
+
const cursor = (s: number, p: number): void => {
|
|
32
|
+
if (s > count || (s === count ? p !== 0 : p > length(s))) throw new Error("invalid paragraph cursor");
|
|
33
|
+
};
|
|
34
|
+
const savedPhase = u(40);
|
|
35
|
+
if (savedPhase === 10) {
|
|
36
|
+
if (out[6] !== 0 || out[7] !== 0) throw new Error("invalid paragraph initial status");
|
|
37
|
+
for (let at = 44; at < 192; at++) if (out[at] !== 0) throw new Error("invalid paragraph initial state");
|
|
38
|
+
for (let at = pieces; at < data; at++) if (out[at] !== 0) throw new Error("invalid paragraph initial storage");
|
|
39
|
+
} else {
|
|
40
|
+
if (out[6] !== 1 || out[7] !== 1) throw new Error("paragraph measurement reply missing");
|
|
41
|
+
if (savedPhase !== 1 && savedPhase !== 3 && savedPhase !== 6 && savedPhase !== 8) throw new Error("invalid paragraph reply phase");
|
|
42
|
+
cursor(u(44), u(48)); cursor(u(100), u(104)); cursor(u(152), u(156));
|
|
43
|
+
if (u(160) > u(156) || u(52) > out.length || u(144) !== 0) throw new Error("invalid paragraph extent");
|
|
44
|
+
if (u(84) !== u(88)) range(u(80), u(84), u(88));
|
|
45
|
+
for (let n = 0; n < u(96); n++) range(u(pieces + n * 16), u(pieces + n * 16 + 4), u(pieces + n * 16 + 8));
|
|
46
|
+
for (let n = 0; n < u(56); n++) {
|
|
47
|
+
const at = runs + n * 32, start = u(at + 4), size = u(at + 8), line = u(at + 12);
|
|
48
|
+
range(u(at), start, start + size);
|
|
49
|
+
if (size === 0 || line < first || line > u(52) || line >= Math.min(4294967295, first + 128) || u(at + 28) !== 0)
|
|
50
|
+
throw new Error("invalid paragraph run");
|
|
51
|
+
}
|
|
52
|
+
range(u(128), u(132), u(136));
|
|
53
|
+
if (savedPhase === 1 && (u(128) !== u(44) || u(132) !== u(48))) throw new Error("invalid paragraph whitespace reply");
|
|
54
|
+
if (savedPhase === 3 && (u(96) >= 32 || u(128) !== u(100) || u(132) !== u(104))) throw new Error("invalid paragraph word reply");
|
|
55
|
+
if (savedPhase === 6) {
|
|
56
|
+
if (u(112) >= u(96)) throw new Error("invalid paragraph piece cursor");
|
|
57
|
+
const at = pieces + u(112) * 16;
|
|
58
|
+
if (u(128) !== u(at) || u(116) < u(at + 4) || u(116) > u(120) || u(120) >= u(at + 8) || u(132) !== u(116) || u(136) <= u(120) || u(136) > u(at + 8))
|
|
59
|
+
throw new Error("invalid paragraph prefix reply");
|
|
60
|
+
}
|
|
61
|
+
if (savedPhase === 8 && (u(128) !== u(152) || u(132) !== u(160) || u(136) !== u(156))) throw new Error("invalid paragraph intrinsic reply");
|
|
62
|
+
if ((out[1] === 1) !== (savedPhase === 8)) throw new Error("invalid paragraph reply mode");
|
|
63
|
+
}
|
|
64
|
+
const next = (s: number, start: number, offset: number, limit: number): number => {
|
|
65
|
+
let cursor = offset;
|
|
66
|
+
while (cursor > start && cursor < limit && (byte(s, cursor) & 0xc0) === 0x80) cursor--;
|
|
67
|
+
const lead = byte(s, cursor), size = (lead & 0x80) === 0 ? 1 : (lead & 0xe0) === 0xc0 ? 2 : (lead & 0xf0) === 0xe0 ? 3 : (lead & 0xf8) === 0xf0 ? 4 : 1;
|
|
68
|
+
const result = Math.min(limit, cursor + size);
|
|
69
|
+
return result <= offset ? Math.min(limit, offset + 1) : result;
|
|
70
|
+
};
|
|
71
|
+
const clearPending = (): void => { put(84, 0); put(88, 0); float(92, 0); };
|
|
72
|
+
const place = (s: number, start: number, end: number, width: number): void => {
|
|
73
|
+
range(s, start, end);
|
|
74
|
+
if (start === end) return;
|
|
75
|
+
const line = u(52), n = u(56);
|
|
76
|
+
if (line >= first) {
|
|
77
|
+
const at = runs + (n - 1) * 32;
|
|
78
|
+
if (n > u(60) && u(at) === s && u(at + 12) === line && u(at + 4) + u(at + 8) === start) {
|
|
79
|
+
put(at + 8, u(at + 8) + end - start); float(at + 20, Math.fround(f(at + 20) + width));
|
|
80
|
+
} else if (n >= capacity || line >= Math.min(4294967295, first + 128)) put(76, 1);
|
|
81
|
+
else {
|
|
82
|
+
const at = runs + n * 32;
|
|
83
|
+
put(at, s); put(at + 4, start); put(at + 8, end - start); put(at + 12, line);
|
|
84
|
+
float(at + 16, f(64)); float(at + 20, width);
|
|
85
|
+
float(at + 24, Math.fround(f(188) + Math.fround(Math.fround(line) * f(184)))); put(at + 28, 0); put(56, n + 1);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
const pen = Math.fround(f(64) + width); float(64, pen); float(68, nscvShellMax(f(68), pen)); put(72, 1);
|
|
89
|
+
};
|
|
90
|
+
const flush = (): void => { const s = u(80), a = u(84), b = u(88), width = f(92); clearPending(); if (a !== b) place(s, a, b, width); };
|
|
91
|
+
const align = (): void => {
|
|
92
|
+
if (out[4] === 0 || !Number.isFinite(f(36))) return;
|
|
93
|
+
const extra = Math.fround(f(36) - f(64)); if (extra <= 0) return;
|
|
94
|
+
const dx = out[4] === 1 ? Math.fround(extra * 0.5) : extra;
|
|
95
|
+
for (let n = u(60); n < u(56); n++) float(runs + n * 32 + 16, Math.fround(f(runs + n * 32 + 16) + dx));
|
|
96
|
+
};
|
|
97
|
+
const lineBreak = (): void => { clearPending(); align(); put(60, u(56)); put(52, u(52) + 1); float(64, 0); put(72, 0); };
|
|
98
|
+
const ask = (phase: number, s: number, start: number, end: number): Uint8Array => {
|
|
99
|
+
range(s, start, end); put(40, phase); put(128, s); put(132, start); put(136, end); float(140, 0); out[6] = 0; out[7] = 1; return out;
|
|
100
|
+
};
|
|
101
|
+
let phase = u(40);
|
|
102
|
+
if (phase === 10) {
|
|
103
|
+
let scale = 1;
|
|
104
|
+
for (let s = 0; s < sourceCount; s++) { const v = f(204 + s * 32); scale = Math.max(scale, Number.isFinite(v) && v > 0 ? v : 1); }
|
|
105
|
+
float(188, Math.fround(f(32) * scale));
|
|
106
|
+
float(184, f(28) > 0 ? f(28) : Math.fround(f(188) * 1.25));
|
|
107
|
+
if (out[3] === 0 || !(f(36) > 0) || !Number.isFinite(f(36))) float(36, Infinity);
|
|
108
|
+
put(76, out[5]!); phase = out[1] === 1 ? 7 : 0;
|
|
109
|
+
}
|
|
110
|
+
if (phase === 1 || phase === 3 || phase === 6 || phase === 8) {
|
|
111
|
+
if (out[6] !== 1 || out[7] !== 1) throw new Error("paragraph measurement reply missing");
|
|
112
|
+
range(u(128), u(132), u(136));
|
|
113
|
+
const width = f(140);
|
|
114
|
+
if (phase === 1) {
|
|
115
|
+
flush(); put(80, u(128)); put(84, u(132)); put(88, u(136)); float(92, width); put(48, u(136)); phase = 0;
|
|
116
|
+
} else if (phase === 3) {
|
|
117
|
+
const at = pieces + u(96) * 16;
|
|
118
|
+
if (u(96) >= 32) throw new Error("paragraph word overflow");
|
|
119
|
+
put(at, u(128)); put(at + 4, u(132)); put(at + 8, u(136)); float(at + 12, width);
|
|
120
|
+
put(96, u(96) + 1); float(108, Math.fround(f(108) + width)); put(104, u(136)); phase = 2;
|
|
121
|
+
} else if (phase === 6) {
|
|
122
|
+
const overflow = Math.fround(f(64) + width) > Math.fround(f(36) + 0.015625);
|
|
123
|
+
if (overflow) {
|
|
124
|
+
if (u(120) === u(116) && u(72) === 0) { put(120, u(136)); float(124, width); }
|
|
125
|
+
phase = 9;
|
|
126
|
+
} else { put(120, u(136)); float(124, width); phase = 5; }
|
|
127
|
+
} else {
|
|
128
|
+
float(164, Math.fround(f(164) + width));
|
|
129
|
+
if (u(156) < length(u(152))) {
|
|
130
|
+
if (byte(u(152), u(156)) === 10) { float(168, nscvShellMax(f(168), f(164))); float(164, 0); }
|
|
131
|
+
put(156, u(156) + 1); put(160, u(156));
|
|
132
|
+
} else { put(152, u(152) + 1); put(156, 0); put(160, 0); }
|
|
133
|
+
phase = 7;
|
|
134
|
+
}
|
|
135
|
+
out[6] = 0; out[7] = 0;
|
|
136
|
+
}
|
|
137
|
+
while (true) {
|
|
138
|
+
if (phase === 7) {
|
|
139
|
+
const s = u(152);
|
|
140
|
+
if (s >= count) { float(68, nscvShellMax(f(168), f(164))); break; }
|
|
141
|
+
let cursor = u(156);
|
|
142
|
+
while (cursor < length(s) && byte(s, cursor) !== 10 && byte(s, cursor) !== 13) cursor++;
|
|
143
|
+
put(156, cursor); return ask(8, s, u(160), cursor);
|
|
144
|
+
}
|
|
145
|
+
if (phase === 0) {
|
|
146
|
+
const s = u(44), offset = u(48);
|
|
147
|
+
if (s >= count) { clearPending(); align(); const n = u(52) + (u(72) !== 0 || u(56) > u(60) || u(52) === 0 ? 1 : 0); put(144, n); float(148, Math.fround(Math.fround(n) * f(184))); break; }
|
|
148
|
+
if (offset >= length(s)) { put(44, s + 1); put(48, 0); continue; }
|
|
149
|
+
const b = byte(s, offset);
|
|
150
|
+
if (b === 10) { lineBreak(); put(48, offset + 1); continue; }
|
|
151
|
+
if (b === 13) { put(48, offset + 1); continue; }
|
|
152
|
+
if (b === 32 || b === 9) {
|
|
153
|
+
let end = offset;
|
|
154
|
+
while (end < length(s) && (byte(s, end) === 32 || byte(s, end) === 9)) end++;
|
|
155
|
+
if (u(72) !== 0 || u(208 + s * 32) === 1) return ask(1, s, offset, end);
|
|
156
|
+
put(48, end); continue;
|
|
157
|
+
}
|
|
158
|
+
put(96, 0); put(112, 0); put(100, s); put(104, offset); float(108, 0); phase = 2;
|
|
159
|
+
} else if (phase === 2) {
|
|
160
|
+
const s = u(100), offset = u(104);
|
|
161
|
+
if (s < count && u(96) < 32) {
|
|
162
|
+
if (offset >= length(s)) { put(100, s + 1); put(104, 0); continue; }
|
|
163
|
+
const b = byte(s, offset);
|
|
164
|
+
if (b !== 10 && b !== 32 && b !== 9) {
|
|
165
|
+
let end = offset;
|
|
166
|
+
while (end < length(s) && byte(s, end) !== 10 && byte(s, end) !== 13 && byte(s, end) !== 32 && byte(s, end) !== 9) end++;
|
|
167
|
+
return ask(3, s, offset, end);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
if (out[3] === 1 && u(72) !== 0 && Math.fround(Math.fround(f(64) + f(92)) + f(108)) > Math.fround(f(36) + 0.015625)) lineBreak(); else flush();
|
|
171
|
+
put(112, 0); phase = 4;
|
|
172
|
+
} else if (phase === 4) {
|
|
173
|
+
const p = u(112);
|
|
174
|
+
if (p >= u(96)) { put(44, u(100)); put(48, u(104)); phase = 0; continue; }
|
|
175
|
+
const at = pieces + p * 16, s = u(at), a = u(at + 4), b = u(at + 8), width = f(at + 12);
|
|
176
|
+
range(s, a, b);
|
|
177
|
+
if (a !== b && Math.fround(f(64) + width) > Math.fround(f(36) + 0.015625)) { put(116, a); put(120, a); float(124, 0); phase = 5; }
|
|
178
|
+
else { place(s, a, b, width); put(112, p + 1); }
|
|
179
|
+
} else if (phase === 5) {
|
|
180
|
+
const at = pieces + u(112) * 16, s = u(at), limit = u(at + 8);
|
|
181
|
+
if (u(120) < limit) return ask(6, s, u(116), next(s, u(at + 4), u(120), limit));
|
|
182
|
+
phase = 9;
|
|
183
|
+
} else if (phase === 9) {
|
|
184
|
+
const at = pieces + u(112) * 16, s = u(at), limit = u(at + 8);
|
|
185
|
+
if (u(120) === u(116)) { lineBreak(); phase = 5; continue; }
|
|
186
|
+
place(s, u(116), u(120), f(124)); put(116, u(120));
|
|
187
|
+
if (u(116) < limit) { lineBreak(); put(120, u(116)); float(124, 0); phase = 5; }
|
|
188
|
+
else { put(112, u(112) + 1); phase = 4; }
|
|
189
|
+
} else throw new Error("invalid paragraph phase");
|
|
190
|
+
}
|
|
191
|
+
put(40, 0); out[6] = 0; out[7] = 2; return out;
|
|
192
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
[
|
|
2
|
+
"src/view_components.ts",
|
|
3
|
+
"src/runtime_policy.ts",
|
|
4
|
+
"src/session_codecs.ts",
|
|
5
|
+
"src/host_flow.ts",
|
|
6
|
+
"src/markup_development.ts",
|
|
7
|
+
"src/command_coordination.ts",
|
|
8
|
+
"src/status_validation.ts",
|
|
9
|
+
"src/paragraph_layout.ts",
|
|
10
|
+
"src/text_run_layout.ts",
|
|
11
|
+
"src/text_query_layout.ts",
|
|
12
|
+
"src/text_span_queries.ts",
|
|
13
|
+
"src/text_measurement_cache.ts",
|
|
14
|
+
"src/text_document_width.ts",
|
|
15
|
+
"src/scalar_text.ts",
|
|
16
|
+
"src/glyph_atlas.ts",
|
|
17
|
+
"src/registered_font.ts",
|
|
18
|
+
"src/vector_effects.ts",
|
|
19
|
+
"src/render_resources.ts",
|
|
20
|
+
"src/gpu_planning.ts",
|
|
21
|
+
"src/gpu_packet_preparation.ts",
|
|
22
|
+
"src/gpu_presentation.ts",
|
|
23
|
+
"src/canvas_frame_coordination.ts",
|
|
24
|
+
"src/canvas_scene_observation.ts",
|
|
25
|
+
"src/canvas_presentation_lifecycle.ts",
|
|
26
|
+
"src/input_composition.ts",
|
|
27
|
+
"src/host_input_regions.ts",
|
|
28
|
+
"src/view_coordination.ts",
|
|
29
|
+
"src/window_lifecycle.ts",
|
|
30
|
+
"src/image_registry.ts",
|
|
31
|
+
"src/font_registry.ts",
|
|
32
|
+
"src/shell_coordination.ts",
|
|
33
|
+
"src/shell_admission.ts",
|
|
34
|
+
"src/system_admission.ts",
|
|
35
|
+
"src/bridge_descriptors.ts",
|
|
36
|
+
"src/authorization.ts",
|
|
37
|
+
"src/builtin_coordination.ts",
|
|
38
|
+
"src/automation_commands.ts",
|
|
39
|
+
"src/automation_interactions.ts",
|
|
40
|
+
"src/render_animation_lifecycle.ts",
|
|
41
|
+
"src/motion_sampling.ts",
|
|
42
|
+
"src/vector_raster.ts",
|
|
43
|
+
"src/terminal_paint.ts",
|
|
44
|
+
"src/control_appearance.ts",
|
|
45
|
+
"src/component_construction.ts",
|
|
46
|
+
"src/widget_motion.ts",
|
|
47
|
+
"src/component_composition.ts",
|
|
48
|
+
"src/code_content.ts",
|
|
49
|
+
"src/chart_content.ts",
|
|
50
|
+
"sdk/internal/markdown_policy.ts",
|
|
51
|
+
"src/widget_audits.ts",
|
|
52
|
+
"src/widget_routing.ts",
|
|
53
|
+
"src/widget_changes.ts",
|
|
54
|
+
"src/widget_retention.ts",
|
|
55
|
+
"src/widget_reconcile.ts",
|
|
56
|
+
"src/scroll_tree.ts",
|
|
57
|
+
"src/widget_continuity.ts",
|
|
58
|
+
"src/staged_rebuild.ts",
|
|
59
|
+
"src/virtual_windows.ts",
|
|
60
|
+
"src/context_menus.ts",
|
|
61
|
+
"src/web_panes.ts",
|
|
62
|
+
"src/extent_program.ts",
|
|
63
|
+
"src/scroll_mutation.ts",
|
|
64
|
+
"src/markup_expressions.ts",
|
|
65
|
+
"src/markup_text.ts",
|
|
66
|
+
"src/markup_display.ts",
|
|
67
|
+
"src/markup_scalars.ts",
|
|
68
|
+
"src/markup_parser.ts",
|
|
69
|
+
"src/markup_document.ts",
|
|
70
|
+
"src/markup_imports.ts",
|
|
71
|
+
"src/markup_canonical.ts",
|
|
72
|
+
"src/markup_construction.ts",
|
|
73
|
+
"src/markup_elements.ts",
|
|
74
|
+
"src/markup_specialized.ts",
|
|
75
|
+
"src/markup_values.ts",
|
|
76
|
+
"src/markup_runtime.ts",
|
|
77
|
+
"src/markup_shapes.ts",
|
|
78
|
+
"src/widget_paint.ts",
|
|
79
|
+
"src/widget_presentation.ts",
|
|
80
|
+
"src/widget_paint_walk.ts",
|
|
81
|
+
"src/control_geometry.ts",
|
|
82
|
+
"src/control_content.ts",
|
|
83
|
+
"src/surface_recipes.ts",
|
|
84
|
+
"src/widget_metrics.ts",
|
|
85
|
+
"src/intrinsic_measure.ts",
|
|
86
|
+
"src/measurement_coordination.ts",
|
|
87
|
+
"src/flow_measurement.ts",
|
|
88
|
+
"src/layout_coordination.ts",
|
|
89
|
+
"src/render_coordination.ts",
|
|
90
|
+
"src/control_commands.ts",
|
|
91
|
+
"src/control_payloads.ts",
|
|
92
|
+
"src/control_primitives.ts",
|
|
93
|
+
"src/leaf_plans.ts",
|
|
94
|
+
"src/chart_plans.ts",
|
|
95
|
+
"src/indicator_plans.ts",
|
|
96
|
+
"src/effect_plans.ts",
|
|
97
|
+
"src/stream_policy.ts"
|
|
98
|
+
]
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Ordered policies compiled in the same module as every Native view. Paths
|
|
2
|
+
* are relative to packages/core; the build graphs consume the same manifest.
|
|
3
|
+
*/
|
|
4
|
+
import { readFileSync } from "node:fs";
|
|
5
|
+
|
|
6
|
+
const manifest: unknown = JSON.parse(readFileSync(new URL("./portable_sources.json", import.meta.url), "utf8"));
|
|
7
|
+
if (!Array.isArray(manifest) || manifest.length === 0 ||
|
|
8
|
+
manifest.some(source => typeof source !== "string" || !/^(?:src|sdk\/internal)\/(?:[a-z0-9_]+\/)*[a-z0-9_]+\.ts$/.test(source)) ||
|
|
9
|
+
new Set(manifest).size !== manifest.length) {
|
|
10
|
+
throw new Error("invalid portable source inventory: expected unique package-relative TypeScript paths");
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const portableSourcePaths: readonly string[] = Object.freeze(manifest);
|
|
14
|
+
// Preserve the source files verbatim, including their own trailing newlines.
|
|
15
|
+
export const portableSourceText = portableSourcePaths
|
|
16
|
+
.map(source => readFileSync(new URL(`../${source}`, import.meta.url), "utf8"))
|
|
17
|
+
.join("");
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// A fixed copied continuation owns registered-face traversal, width, byte
|
|
2
|
+
// advances and ink reduction. Native answers only text and font-table reads.
|
|
3
|
+
function nscvRegisteredMin(a: number, b: number, zeroRules: number): number {
|
|
4
|
+
if (a === 0 && b === 0 && (1 / a < 0) !== (1 / b < 0)) return (zeroRules & (1 / a < 0 ? 2 : 1)) !== 0 ? -0 : 0;
|
|
5
|
+
return Number.isNaN(a) ? b : Number.isNaN(b) ? a : a < b ? a : b;
|
|
6
|
+
}
|
|
7
|
+
function nscvRegisteredMax(a: number, b: number, zeroRules: number): number {
|
|
8
|
+
if (a === 0 && b === 0 && (1 / a < 0) !== (1 / b < 0)) return (zeroRules & (1 / a < 0 ? 8 : 4)) !== 0 ? -0 : 0;
|
|
9
|
+
return Number.isNaN(a) ? b : Number.isNaN(b) ? a : a > b ? a : b;
|
|
10
|
+
}
|
|
11
|
+
class NscRegisteredFont {
|
|
12
|
+
readonly bytes: Uint8Array;
|
|
13
|
+
readonly wire: DataView;
|
|
14
|
+
constructor(request: Uint8Array) {
|
|
15
|
+
if (request.length !== 128 || request[0] !== 62 || request[1] !== 1 || request[2]! > 2 || request[3]! > 1 || request[4]! > 1 || request[5]! > 15 || request[6] !== 0 || request[7] !== 0)
|
|
16
|
+
throw new Error("invalid registered font header");
|
|
17
|
+
this.bytes = request.slice(); this.wire = new DataView(this.bytes.buffer);
|
|
18
|
+
if (this.u(32) > this.u(8) || this.u(36) > this.u(8) || this.u(72) > 4 || this.u(84) > 1 || this.u(104) > 4 || this.u(124) > 1)
|
|
19
|
+
throw new Error("invalid registered font state");
|
|
20
|
+
if (request[3] === 0) {
|
|
21
|
+
for (let i = 32; i < 128; i++) if (request[i] !== 0) throw new Error("invalid initial registered font state");
|
|
22
|
+
} else if (this.u(72) === 0 || this.u(36) < this.u(32) || this.u(44) > 65535 || this.u(52) > 2) {
|
|
23
|
+
throw new Error("invalid registered font continuation");
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
u(at: number): number { return this.wire.getUint32(at, true); }
|
|
27
|
+
f(at: number): number { return this.wire.getFloat32(at, true); }
|
|
28
|
+
put(at: number, value: number): void { this.wire.setUint32(at, value, true); }
|
|
29
|
+
float(at: number, value: number): void { this.wire.setFloat32(at, value, true); }
|
|
30
|
+
action(value: number): Uint8Array { this.put(72, value); this.bytes[3] = value === 0 ? 2 : 1; return this.bytes; }
|
|
31
|
+
cell(em: number): Uint8Array {
|
|
32
|
+
const registered = this.bytes[4] === 1;
|
|
33
|
+
const value = Math.fround(this.f(20) * em);
|
|
34
|
+
// A registered cluster is itself a one-cluster width sum starting at
|
|
35
|
+
// +0. Built-in advance estimators return their product directly.
|
|
36
|
+
this.float(76, registered ? Math.fround(0 + value) : value);
|
|
37
|
+
if (this.bytes[2] !== 2) return this.finishCluster();
|
|
38
|
+
const lead = this.bytes[108]!;
|
|
39
|
+
if (lead === 32 || lead === 9 || lead === 10 || lead === 13) return this.finishCluster();
|
|
40
|
+
if (this.u(40) !== 0xffffffff) return this.action(3);
|
|
41
|
+
return this.block();
|
|
42
|
+
}
|
|
43
|
+
fallback(): number {
|
|
44
|
+
const cp = this.u(40);
|
|
45
|
+
return cp !== 0xffffffff && nscvScalarTextWide(cp) ? 1 : cp >= 0x2190 && cp <= 0x2bff ? Math.fround(0.8) : Math.fround(this.f(28) / this.f(24));
|
|
46
|
+
}
|
|
47
|
+
finishCluster(): Uint8Array {
|
|
48
|
+
if (this.bytes[2] === 1) { this.put(112, this.u(32)); this.put(116, this.u(36)); this.float(120, this.f(76)); }
|
|
49
|
+
this.float(80, Math.fround(this.f(80) + this.f(76)));
|
|
50
|
+
this.put(32, this.u(36));
|
|
51
|
+
return this.action(this.u(32) === this.u(8) ? 0 : 1);
|
|
52
|
+
}
|
|
53
|
+
ink(a: number, b: number, c: number, d: number): void {
|
|
54
|
+
if (this.u(84) === 0) { this.float(88, a); this.float(92, b); this.float(96, c); this.float(100, d); this.put(84, 1); }
|
|
55
|
+
else { this.float(88, nscvRegisteredMin(this.f(88), a, this.bytes[5]!)); this.float(92, nscvRegisteredMax(this.f(92), b, this.bytes[5]!)); this.float(96, nscvRegisteredMin(this.f(96), c, this.bytes[5]!)); this.float(100, nscvRegisteredMax(this.f(100), d, this.bytes[5]!)); }
|
|
56
|
+
}
|
|
57
|
+
block(): Uint8Array {
|
|
58
|
+
this.ink(this.f(80), Math.fround(this.f(80) + this.f(76)), -this.f(20), 0);
|
|
59
|
+
return this.finishCluster();
|
|
60
|
+
}
|
|
61
|
+
step(): Uint8Array {
|
|
62
|
+
this.put(112, 0); this.put(116, 0); this.float(120, 0);
|
|
63
|
+
if (this.bytes[3] === 0) {
|
|
64
|
+
this.put(124, this.bytes[2] === 2 && this.bytes[4] === 0 ? 0 : 1);
|
|
65
|
+
return this.action(this.u(8) === 0 || this.u(124) === 0 ? 0 : 1);
|
|
66
|
+
}
|
|
67
|
+
const action = this.u(72);
|
|
68
|
+
if (action === 1) {
|
|
69
|
+
const remaining = this.u(8) - this.u(32), available = Math.min(4, remaining);
|
|
70
|
+
if (available === 0 || this.u(104) !== available) throw new Error("invalid registered font text reply");
|
|
71
|
+
const lead = this.bytes[108]!, length = Math.min(remaining, nscvScalarTextSequence(lead));
|
|
72
|
+
this.put(36, this.u(32) + length);
|
|
73
|
+
const cp = nscvScalarTextCodepoint(this.bytes, 108, 108 + length);
|
|
74
|
+
this.put(40, cp < 0 ? 0xffffffff : cp);
|
|
75
|
+
if (this.bytes[4] === 0 && this.u(12) === 2 && this.u(16) === 0) return this.cell(Math.fround(0.6));
|
|
76
|
+
return cp < 0 ? this.cell(this.fallback()) : this.action(2);
|
|
77
|
+
}
|
|
78
|
+
if (action === 2) return this.cell(this.u(44) === 0 ? this.fallback() : Math.fround(this.f(48) / this.f(24)));
|
|
79
|
+
if (action === 3) return this.u(44) === 0 ? this.block() : this.action(4);
|
|
80
|
+
if (action !== 4) throw new Error("invalid registered font action");
|
|
81
|
+
if (this.u(52) === 2) { this.put(124, 0); return this.action(0); }
|
|
82
|
+
if (this.u(52) === 1) {
|
|
83
|
+
const scale = Math.fround(this.f(20) / this.f(24)), natural = Math.fround(this.f(48) * scale);
|
|
84
|
+
const inset = nscvRegisteredMax(0, Math.fround(Math.fround(this.f(76) - natural) * 0.5), this.bytes[5]!);
|
|
85
|
+
const start = Math.fround(this.f(80) + inset);
|
|
86
|
+
this.ink(Math.fround(start + Math.fround(this.f(56) * scale)), Math.fround(start + Math.fround(Math.fround(this.f(56) + this.f(64)) * scale)),
|
|
87
|
+
-Math.fround(Math.fround(this.f(60) + this.f(68)) * scale), -Math.fround(this.f(60) * scale));
|
|
88
|
+
}
|
|
89
|
+
return this.finishCluster();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function nscvRegisteredFont(request: Uint8Array): Uint8Array { return new NscRegisteredFont(request).step(); }
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/** Render-animation admission, retirement, and replacement damage. Clocks,
|
|
2
|
+
* retained records, command bounds, and buffer lifetime are native capabilities.
|
|
3
|
+
* Bounds are requested in reference order, including repeated targets. */
|
|
4
|
+
function nscvAnimationIdentity(w: DataView, at: number): boolean {
|
|
5
|
+
return w.getFloat32(at, true) === 1 && w.getFloat32(at + 4, true) === 0 &&
|
|
6
|
+
w.getFloat32(at + 8, true) === 0 && w.getFloat32(at + 12, true) === 1 &&
|
|
7
|
+
w.getFloat32(at + 16, true) === 0 && w.getFloat32(at + 20, true) === 0;
|
|
8
|
+
}
|
|
9
|
+
function nscvAnimationId(w: DataView, at: number): boolean {
|
|
10
|
+
return w.getUint32(at, true) !== 0 || w.getUint32(at + 4, true) !== 0;
|
|
11
|
+
}
|
|
12
|
+
function nscvAnimationSame(w: DataView, a: number, b: number): boolean {
|
|
13
|
+
return w.getUint32(a, true) === w.getUint32(b, true) && w.getUint32(a + 4, true) === w.getUint32(b + 4, true);
|
|
14
|
+
}
|
|
15
|
+
function nscvAnimationActive(w: DataView, at: number): boolean {
|
|
16
|
+
const duration = w.getUint32(at + 16, true);
|
|
17
|
+
if (!nscvAnimationId(w, at) || duration === 0) return false;
|
|
18
|
+
if (w.getUint32(at + 20, true) !== 0) return true;
|
|
19
|
+
const low = w.getUint32(20, true), high = w.getUint32(24, true);
|
|
20
|
+
const startLow = w.getUint32(at + 8, true), startHigh = w.getUint32(at + 12, true);
|
|
21
|
+
if (high < startHigh || high === startHigh && low <= startLow) return true;
|
|
22
|
+
const borrow = low < startLow ? 1 : 0;
|
|
23
|
+
const elapsedLow = low - startLow + borrow * 4294967296, elapsedHigh = high - startHigh - borrow;
|
|
24
|
+
// A u32 millisecond duration fits exactly in a JavaScript number. The
|
|
25
|
+
// elapsed u64 never becomes one: compare its two words independently.
|
|
26
|
+
const span = duration * 1000000, spanHigh = Math.floor(span / 4294967296), spanLow = span - spanHigh * 4294967296;
|
|
27
|
+
return elapsedHigh < spanHigh || elapsedHigh === spanHigh && elapsedLow < spanLow;
|
|
28
|
+
}
|
|
29
|
+
function nscvAnimationLifecycle(request: Uint8Array): Uint8Array {
|
|
30
|
+
if (request.length < 80 || request[0] !== 72 || request[1] !== 1 || request[2]! > 3 || request[3]! > 15)
|
|
31
|
+
throw new Error("invalid render animation header");
|
|
32
|
+
const w = new DataView(request.buffer, request.byteOffset, request.byteLength);
|
|
33
|
+
const mode = request[2]!, animations = w.getUint32(4, true), overrides = w.getUint32(8, true), commands = w.getUint32(12, true);
|
|
34
|
+
const capacity = w.getUint32(16, true);
|
|
35
|
+
if (w.getUint32(28, true) !== 0) throw new Error("invalid render animation reserved word");
|
|
36
|
+
if (mode === 3) {
|
|
37
|
+
if (request[3] !== 0 || w.getUint32(20, true) !== 0 || w.getUint32(24, true) !== 0) throw new Error("invalid animation admission facts");
|
|
38
|
+
for (let at = 32; at < 80; at += 4) if (w.getUint32(at, true) !== 0) throw new Error("invalid animation admission tail");
|
|
39
|
+
if (request.length !== 80 + (animations > capacity ? 0 : animations * 8)) throw new Error("invalid animation admission shape");
|
|
40
|
+
const result = new Uint8Array(32), out = new DataView(result.buffer); out.setUint32(0, 1, true);
|
|
41
|
+
if (animations > capacity) out.setUint32(4, 1, true);
|
|
42
|
+
else {
|
|
43
|
+
for (let i = 0; i < animations; i++) if (!nscvAnimationId(w, 80 + i * 8)) { out.setUint32(4, 2, true); break; }
|
|
44
|
+
if (animations === 0 && overrides === 0 && commands === 0) out.setUint32(8, 1, true);
|
|
45
|
+
}
|
|
46
|
+
return result;
|
|
47
|
+
}
|
|
48
|
+
if (capacity !== 0 || mode === 0 && (overrides !== 0 || commands !== 0) || mode === 1 && (animations !== 0 || commands !== 0) ||
|
|
49
|
+
animations > Math.floor((request.length - 80) / 112) || overrides > Math.floor((request.length - 80 - animations * 112) / 40) ||
|
|
50
|
+
request.length !== 80 + animations * 112 + overrides * 40 + commands * 16)
|
|
51
|
+
throw new Error("invalid render animation shape");
|
|
52
|
+
for (let i = 0; i < animations; i++) {
|
|
53
|
+
const at = 80 + i * 112;
|
|
54
|
+
if (w.getUint32(at + 20, true) > 2 || w.getUint32(at + 24, true) > 15) throw new Error("invalid render animation record");
|
|
55
|
+
for (let end = at + 88; end < at + 112; end += 4) if (w.getUint32(end, true) !== 0) throw new Error("invalid animation record tail");
|
|
56
|
+
}
|
|
57
|
+
const overrideStart = 80 + animations * 112, commandStart = overrideStart + overrides * 40;
|
|
58
|
+
for (let i = 0; i < overrides; i++) if (w.getUint32(overrideStart + i * 40 + 8, true) > 3) throw new Error("invalid animation override mask");
|
|
59
|
+
for (let i = 0; i < commands; i++) if (w.getUint32(commandStart + i * 16 + 8, true) > 1 || w.getUint32(commandStart + i * 16 + 12, true) !== 0)
|
|
60
|
+
throw new Error("invalid animation command identity");
|
|
61
|
+
if (mode === 2) return nscvAnimationSchedule(request, w, animations, overrides, commands, overrideStart, commandStart);
|
|
62
|
+
if (request[3] !== 0) throw new Error("invalid lifecycle numeric flags");
|
|
63
|
+
for (let at = 32; at < 80; at += 4) if (w.getUint32(at, true) !== 0) throw new Error("invalid lifecycle continuation");
|
|
64
|
+
const count = mode === 0 ? animations : overrides, result = new Uint8Array(32 + count), out = new DataView(result.buffer);
|
|
65
|
+
out.setUint32(0, 1, true); out.setUint32(4, count, true);
|
|
66
|
+
let active = false, pruned = false;
|
|
67
|
+
for (let i = 0; i < count; i++) {
|
|
68
|
+
const at = mode === 0 ? 80 + i * 112 : overrideStart + i * 40;
|
|
69
|
+
const mask = w.getUint32(at + (mode === 0 ? 24 : 8), true);
|
|
70
|
+
const noop = ((mask & 1) === 0 || w.getFloat32(at + (mode === 0 ? 28 : 12), true) === 1) &&
|
|
71
|
+
((mask & (mode === 0 ? 4 : 2)) === 0 || nscvAnimationIdentity(w, at + (mode === 0 ? 56 : 16)));
|
|
72
|
+
const running = mode === 0 && nscvAnimationActive(w, at), keep = mode === 0 ? running || !noop : !noop;
|
|
73
|
+
result[32 + i] = (keep ? 1 : 0) | (running ? 2 : 0);
|
|
74
|
+
active = active || running; pruned = pruned || !keep;
|
|
75
|
+
}
|
|
76
|
+
out.setUint32(8, active ? 1 : 0, true); out.setUint32(12, pruned ? 1 : 0, true);
|
|
77
|
+
return result;
|
|
78
|
+
}
|
|
79
|
+
function nscvAnimationSchedule(request: Uint8Array, w: DataView, animations: number, overrides: number, commands: number, overrideStart: number, commandStart: number): Uint8Array {
|
|
80
|
+
const count = animations + overrides, flags = request[3]!;
|
|
81
|
+
let cursor = w.getUint32(32, true), bounds = nscvRenderOptional(w, 36);
|
|
82
|
+
const answer = w.getUint32(56, true), present = w.getUint32(60, true);
|
|
83
|
+
if (cursor > count || w.getUint32(36, true) > 1 || present > 1 || answer !== 4294967295 && answer >= commands)
|
|
84
|
+
throw new Error("invalid animation bounds continuation");
|
|
85
|
+
if (cursor === 0 && w.getUint32(36, true) !== 0) throw new Error("invalid initial animation bounds");
|
|
86
|
+
const result = new Uint8Array(64), out = new DataView(result.buffer); out.setUint32(0, 1, true);
|
|
87
|
+
let consumed = false;
|
|
88
|
+
const include = (rect: NscSurfaceRect): void => {
|
|
89
|
+
bounds = bounds === null ? nscvSurfaceNormalize(rect) : nscvRenderUnion(bounds, rect, flags);
|
|
90
|
+
};
|
|
91
|
+
for (; cursor < count; cursor++) {
|
|
92
|
+
const old = cursor < overrides, at = old ? overrideStart + cursor * 40 : 80 + (cursor - overrides) * 112;
|
|
93
|
+
if (!nscvAnimationId(w, at)) continue;
|
|
94
|
+
let source = -1;
|
|
95
|
+
for (let i = 0; i < commands; i++) {
|
|
96
|
+
const commandAt = commandStart + i * 16;
|
|
97
|
+
if (w.getUint32(commandAt + 8, true) !== 0 && nscvAnimationSame(w, at, commandAt)) { source = i; break; }
|
|
98
|
+
}
|
|
99
|
+
if (source < 0) continue;
|
|
100
|
+
if (answer === 4294967295 || consumed) {
|
|
101
|
+
out.setUint32(4, 1, true); out.setUint32(8, cursor, true); out.setUint32(12, source, true);
|
|
102
|
+
nscvRenderPutOptional(out, 16, bounds); return result;
|
|
103
|
+
}
|
|
104
|
+
if (answer !== source) throw new Error("mismatched animation bounds capability");
|
|
105
|
+
consumed = true;
|
|
106
|
+
if (present === 0) continue;
|
|
107
|
+
const rect = nscvRenderRect(w, 64); include(rect);
|
|
108
|
+
const mask = w.getUint32(at + (old ? 8 : 24), true);
|
|
109
|
+
if (old) {
|
|
110
|
+
if ((mask & 2) !== 0) include(nscvRenderTransform(nscvRenderAffine(w, at + 16), rect, flags));
|
|
111
|
+
} else {
|
|
112
|
+
if ((mask & 2) !== 0) include(nscvRenderTransform(nscvRenderAffine(w, at + 32), rect, flags));
|
|
113
|
+
if ((mask & 4) !== 0) include(nscvRenderTransform(nscvRenderAffine(w, at + 56), rect, flags));
|
|
114
|
+
if ((mask & 8) !== 0) {
|
|
115
|
+
const r = nscvSurfaceNormalize(rect), x = w.getFloat32(at + 80, true), y = w.getFloat32(at + 84, true), f = Math.fround;
|
|
116
|
+
let radius = 0;
|
|
117
|
+
for (let corner = 0; corner < 4; corner++) {
|
|
118
|
+
const dx = f(((corner & 1) !== 0 ? nscvSurfaceRight(r) : r.x) - x);
|
|
119
|
+
const dy = f((corner >= 2 ? nscvSurfaceBottom(r) : r.y) - y);
|
|
120
|
+
radius = nscvRenderExtreme(radius, f(Math.sqrt(f(f(dx * dx) + f(dy * dy)))), flags, true);
|
|
121
|
+
}
|
|
122
|
+
include({ x: f(x - radius), y: f(y - radius), width: f(radius * 2), height: f(radius * 2) });
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if (answer !== 4294967295 && !consumed) throw new Error("unconsumed animation bounds capability");
|
|
127
|
+
out.setUint32(8, cursor, true); out.setUint32(12, 4294967295, true); nscvRenderPutOptional(out, 16, bounds); return result;
|
|
128
|
+
}
|