@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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
//!
|
|
3
3
|
//! `native eject component <name>` copies the canonical sources next to
|
|
4
4
|
//! this file into an app. These tests are what keeps those copies
|
|
5
|
-
//!
|
|
5
|
+
//! precisely: each builds the ejected form and the library form against
|
|
6
6
|
//! the same inputs and requires the two widget trees to be IDENTICAL —
|
|
7
7
|
//! every id, every field, every handler — so ejecting is never a visual
|
|
8
8
|
//! or behavioral change, only an ownership change. A library refactor
|
|
@@ -19,18 +19,22 @@ const testing = std.testing;
|
|
|
19
19
|
const native_sdk = @import("native_sdk");
|
|
20
20
|
const canvas = native_sdk.canvas;
|
|
21
21
|
|
|
22
|
-
const
|
|
23
|
-
const
|
|
22
|
+
const stepper_template = @embedFile("stepper.native");
|
|
23
|
+
const timeline_item_template = @embedFile("timeline-item.native");
|
|
24
24
|
const timeline_template = @embedFile("timeline.native");
|
|
25
|
+
const legacy_stepper = @import("stepper.zig");
|
|
26
|
+
const legacy_timeline_item = @import("timeline_item.zig");
|
|
25
27
|
|
|
26
28
|
/// A stand-in app model/message pair: the composites under test bind no
|
|
27
29
|
/// model state themselves (their inputs arrive as options/args), so an
|
|
28
30
|
/// empty model and one payload-carrying message tag cover the surface.
|
|
29
|
-
const Model = struct {
|
|
31
|
+
const Model = struct {
|
|
32
|
+
open_id: u32 = 7,
|
|
33
|
+
};
|
|
30
34
|
const Msg = union(enum) { open: u32 };
|
|
31
35
|
const Ui = canvas.Ui(Msg);
|
|
32
36
|
|
|
33
|
-
test "ejected stepper builds the library stepper's exact tree" {
|
|
37
|
+
test "ejected stepper markup builds the library stepper's exact tree" {
|
|
34
38
|
var arena_state = std.heap.ArenaAllocator.init(testing.allocator);
|
|
35
39
|
defer arena_state.deinit();
|
|
36
40
|
const arena = arena_state.allocator();
|
|
@@ -44,58 +48,68 @@ test "ejected stepper builds the library stepper's exact tree" {
|
|
|
44
48
|
const library_steps = [_]Ui.StepperStep{
|
|
45
49
|
.{ .label = labels[0] }, .{ .label = labels[1] }, .{ .label = labels[2] },
|
|
46
50
|
};
|
|
47
|
-
const library_tree = try library_ui.finalize(library_ui.stepper(.{
|
|
48
|
-
|
|
51
|
+
const library_tree = try library_ui.finalize(library_ui.stepper(.{
|
|
52
|
+
.active = active,
|
|
53
|
+
.key = canvas.uiKey("pipeline"),
|
|
54
|
+
.global_key = canvas.uiKey("pipeline-global"),
|
|
55
|
+
.semantics = .{ .label = "Pipeline" },
|
|
56
|
+
}, &library_steps));
|
|
57
|
+
|
|
58
|
+
const active_text = if (active == 0) "0" else if (active == 1) "1" else "3";
|
|
59
|
+
const source = "<import src=\"components/stepper.native\"/>\n<use template=\"stepper\" active=\"" ++ active_text ++ "\" key=\"pipeline\" global_key=\"pipeline-global\" label=\"Pipeline\">" ++
|
|
60
|
+
"<step>Plan</step><step>Work</step><step>Ship</step></use>";
|
|
61
|
+
const files = [_]canvas.ui_markup.SourceFile{.{ .path = "components/stepper.native", .source = stepper_template }};
|
|
49
62
|
var ejected_ui = Ui.init(arena);
|
|
50
|
-
const
|
|
51
|
-
.{ .label = labels[0] }, .{ .label = labels[1] }, .{ .label = labels[2] },
|
|
52
|
-
};
|
|
53
|
-
const ejected_tree = try ejected_ui.finalize(stepper_component.build(&ejected_ui, .{ .active = active }, &ejected_steps));
|
|
63
|
+
const ejected_tree = try buildMarkupTree(arena, &ejected_ui, source, &files);
|
|
54
64
|
|
|
55
65
|
try testing.expectEqualDeep(library_tree.root, ejected_tree.root);
|
|
56
66
|
try testing.expectEqualDeep(library_tree.handlers, ejected_tree.handlers);
|
|
57
67
|
}
|
|
58
68
|
}
|
|
59
69
|
|
|
60
|
-
test "ejected
|
|
70
|
+
test "ejected stepper defaults preserve the library's unkeyed identity" {
|
|
61
71
|
var arena_state = std.heap.ArenaAllocator.init(testing.allocator);
|
|
62
72
|
defer arena_state.deinit();
|
|
63
73
|
const arena = arena_state.allocator();
|
|
64
74
|
|
|
65
|
-
const
|
|
75
|
+
const source = "<import src=\"components/stepper.native\"/>\n<use template=\"stepper\" active=\"1\"><step>Plan</step><step>Ship</step></use>";
|
|
76
|
+
const files = [_]canvas.ui_markup.SourceFile{.{ .path = "components/stepper.native", .source = stepper_template }};
|
|
77
|
+
var library_ui = Ui.init(arena);
|
|
78
|
+
const labels = [_]Ui.StepperStep{ .{ .label = "Plan" }, .{ .label = "Ship" } };
|
|
79
|
+
const library_tree = try library_ui.finalize(library_ui.stepper(.{ .active = 1 }, &labels));
|
|
80
|
+
var ejected_ui = Ui.init(arena);
|
|
81
|
+
const ejected_tree = try buildMarkupTree(arena, &ejected_ui, source, &files);
|
|
82
|
+
try testing.expectEqualDeep(library_tree.root, ejected_tree.root);
|
|
83
|
+
}
|
|
66
84
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
85
|
+
test "ejected timeline-item markup builds the library item's exact tree" {
|
|
86
|
+
var arena_state = std.heap.ArenaAllocator.init(testing.allocator);
|
|
87
|
+
defer arena_state.deinit();
|
|
88
|
+
const arena = arena_state.allocator();
|
|
89
|
+
|
|
90
|
+
// The full visual shape: indicator variant, description, meta,
|
|
91
|
+
// connector, selection, and a forwarded typed press handler.
|
|
70
92
|
var library_ui = Ui.init(arena);
|
|
71
93
|
const library_tree = try library_ui.finalize(library_ui.timelineItem(.{
|
|
72
|
-
.key = .
|
|
94
|
+
.key = canvas.uiKey("item"),
|
|
95
|
+
.global_key = canvas.uiKey("item-global"),
|
|
73
96
|
.icon = "check",
|
|
74
97
|
.variant = .primary,
|
|
75
98
|
.title = "Build the release",
|
|
76
99
|
.description = "Compile, test, and package the app",
|
|
77
100
|
.meta = "2m 14s",
|
|
78
101
|
.selected = true,
|
|
79
|
-
.on_press =
|
|
102
|
+
.on_press = Msg{ .open = 7 },
|
|
80
103
|
}));
|
|
81
104
|
|
|
105
|
+
const source = "<import src=\"components/timeline-item.native\"/>\n<use template=\"timeline-item\" title=\"Build the release\" description=\"Compile, test, and package the app\" meta=\"2m 14s\" icon=\"check\" variant=\"primary\" selected=\"true\" key=\"item\" global_key=\"item-global\" on-press=\"open:{open_id}\" />";
|
|
106
|
+
const files = [_]canvas.ui_markup.SourceFile{.{ .path = "components/timeline-item.native", .source = timeline_item_template }};
|
|
82
107
|
var ejected_ui = Ui.init(arena);
|
|
83
|
-
const ejected_tree = try
|
|
84
|
-
.key = .{ .int = 7 },
|
|
85
|
-
.icon = "check",
|
|
86
|
-
.variant = .primary,
|
|
87
|
-
.title = "Build the release",
|
|
88
|
-
.description = "Compile, test, and package the app",
|
|
89
|
-
.meta = "2m 14s",
|
|
90
|
-
.selected = true,
|
|
91
|
-
.on_press = .{ .open = 7 },
|
|
92
|
-
}));
|
|
108
|
+
const ejected_tree = try buildMarkupTree(arena, &ejected_ui, source, &files);
|
|
93
109
|
|
|
94
110
|
try testing.expectEqualDeep(library_tree.root, ejected_tree.root);
|
|
95
111
|
try testing.expectEqualDeep(library_tree.handlers, ejected_tree.handlers);
|
|
96
|
-
// The press is real in both forms, not just structurally equal.
|
|
97
112
|
try testing.expectEqual(Msg{ .open = 7 }, ejected_tree.msgForPointer(ejected_tree.root.id, .up).?);
|
|
98
|
-
|
|
99
113
|
// The minimal shape: dot indicator (no badge content), title only,
|
|
100
114
|
// no connector, no press — the other half of every conditional.
|
|
101
115
|
var minimal_library_ui = Ui.init(arena);
|
|
@@ -103,15 +117,27 @@ test "ejected timeline item builds the library item's exact tree, press handler
|
|
|
103
117
|
.title = "Queued",
|
|
104
118
|
.connector = false,
|
|
105
119
|
}));
|
|
120
|
+
const minimal_source = "<import src=\"components/timeline-item.native\"/>\n<use template=\"timeline-item\" title=\"Queued\" connector=\"false\" />";
|
|
121
|
+
const minimal_files = [_]canvas.ui_markup.SourceFile{.{ .path = "components/timeline-item.native", .source = timeline_item_template }};
|
|
106
122
|
var minimal_ejected_ui = Ui.init(arena);
|
|
107
|
-
const minimal_ejected = try
|
|
108
|
-
.title = "Queued",
|
|
109
|
-
.connector = false,
|
|
110
|
-
}));
|
|
123
|
+
const minimal_ejected = try buildMarkupTree(arena, &minimal_ejected_ui, minimal_source, &minimal_files);
|
|
111
124
|
try testing.expectEqualDeep(minimal_library.root, minimal_ejected.root);
|
|
112
125
|
try testing.expectEqualDeep(minimal_library.handlers, minimal_ejected.handlers);
|
|
113
126
|
}
|
|
114
127
|
|
|
128
|
+
test "legacy Zig ejection sources remain compilable for Zig-core apps" {
|
|
129
|
+
var arena_state = std.heap.ArenaAllocator.init(testing.allocator);
|
|
130
|
+
defer arena_state.deinit();
|
|
131
|
+
const arena = arena_state.allocator();
|
|
132
|
+
|
|
133
|
+
var stepper_ui = Ui.init(arena);
|
|
134
|
+
const steps = [_]legacy_stepper.Step{.{ .label = "Build" }};
|
|
135
|
+
_ = legacy_stepper.build(&stepper_ui, .{}, &steps);
|
|
136
|
+
|
|
137
|
+
var timeline_ui = Ui.init(arena);
|
|
138
|
+
_ = legacy_timeline_item.TimelineItem(Msg).build(&timeline_ui, .{ .title = "Build", .on_press = .{ .open = 7 } });
|
|
139
|
+
}
|
|
140
|
+
|
|
115
141
|
/// Build a markup view over the test Model through the interpreter,
|
|
116
142
|
/// resolving imports from an embedded source set (the same loader shape
|
|
117
143
|
/// apps use for their import closures).
|
|
@@ -140,9 +166,9 @@ test "the ejected timeline template builds the library <timeline> element's exac
|
|
|
140
166
|
\\ <timeline-item title="Building" meta="just now" connector="false" />
|
|
141
167
|
\\
|
|
142
168
|
;
|
|
143
|
-
const element_source = "<timeline gap=\"4\" label=\"Activity\">\n" ++ items ++ "</timeline>\n";
|
|
169
|
+
const element_source = "<timeline gap=\"4\" label=\"Activity\" key=\"ledger\" global-key=\"ledger-global\">\n" ++ items ++ "</timeline>\n";
|
|
144
170
|
const template_source = "<import src=\"components/timeline.native\"/>\n" ++
|
|
145
|
-
"<use template=\"timeline\" gap=\"4\" label=\"Activity\">\n" ++ items ++ "</use>\n";
|
|
171
|
+
"<use template=\"timeline\" gap=\"4\" label=\"Activity\" key=\"ledger\" global_key=\"ledger-global\">\n" ++ items ++ "</use>\n";
|
|
146
172
|
const files = [_]canvas.ui_markup.SourceFile{
|
|
147
173
|
.{ .path = "components/timeline.native", .source = timeline_template },
|
|
148
174
|
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<!-- Your app's stepper.
|
|
2
|
+
Ejected from the Native SDK component library.
|
|
3
|
+
|
|
4
|
+
This file now belongs to your app: edit it freely, and SDK updates
|
|
5
|
+
never touch it. The template keeps the SDK stepper's typed rendering
|
|
6
|
+
and inserts the caller's step children at the same structural point:
|
|
7
|
+
|
|
8
|
+
before: <stepper active="{stage}">...</stepper>
|
|
9
|
+
after: <import src="components/stepper.native"/>
|
|
10
|
+
<use template="stepper" active="{stage}">...</use>
|
|
11
|
+
|
|
12
|
+
`step` remains an SDK-owned markup element. Its completed/active/
|
|
13
|
+
pending state still derives from the active index, and the slot is
|
|
14
|
+
built in the consumer's scope so loop bindings keep working. The
|
|
15
|
+
`global_key` template arg uses an underscore because template args are
|
|
16
|
+
binding names; it forwards to the element's `global-key` attribute.
|
|
17
|
+
|
|
18
|
+
Deleting this file costs nothing; `native eject component stepper`
|
|
19
|
+
writes it again. -->
|
|
20
|
+
<template name="stepper" args="active key= global_key= label=">
|
|
21
|
+
<stepper active="{active}" key="{key}" global-key="{global_key}" label="{label}">
|
|
22
|
+
<slot/>
|
|
23
|
+
</stepper>
|
|
24
|
+
</template>
|
|
@@ -20,29 +20,20 @@
|
|
|
20
20
|
//! step number otherwise — and hairline separators connect the steps.
|
|
21
21
|
//! Display-only: driving `active` belongs to the app model.
|
|
22
22
|
|
|
23
|
-
const std = @import("std");
|
|
24
23
|
const native_sdk = @import("native_sdk");
|
|
25
24
|
const canvas = native_sdk.canvas;
|
|
26
25
|
|
|
27
|
-
/// Visual state of a step, derived from its index against
|
|
28
|
-
/// `Options.active`.
|
|
29
26
|
pub const StepState = enum { completed, active, pending };
|
|
30
27
|
|
|
31
28
|
pub const Step = struct {
|
|
32
|
-
/// Step label ("Work", "Review · round 2").
|
|
33
29
|
label: []const u8,
|
|
34
30
|
};
|
|
35
31
|
|
|
36
32
|
pub const Options = struct {
|
|
37
|
-
/// Index of the active step: earlier steps render completed (check
|
|
38
|
-
/// indicator), later ones pending. An index past the last step
|
|
39
|
-
/// renders every step completed.
|
|
40
33
|
active: usize = 0,
|
|
41
34
|
key: ?canvas.UiKey = null,
|
|
42
35
|
global_key: ?canvas.UiKey = null,
|
|
43
36
|
grow: f32 = 0,
|
|
44
|
-
/// Row semantics; role defaults to `list` (each step is a `listitem`
|
|
45
|
-
/// carrying its label, state, and position).
|
|
46
37
|
semantics: canvas.WidgetSemantics = .{},
|
|
47
38
|
};
|
|
48
39
|
|
|
@@ -52,9 +43,6 @@ pub fn stepState(active: usize, index: usize) StepState {
|
|
|
52
43
|
return .pending;
|
|
53
44
|
}
|
|
54
45
|
|
|
55
|
-
/// Build the stepper into the app's view. `ui` is the app's typed view
|
|
56
|
-
/// builder (`*canvas.Ui(Msg)`); taking it generically keeps this file
|
|
57
|
-
/// independent of your app's message type.
|
|
58
46
|
pub fn build(ui: anytype, options: Options, steps: []const Step) @TypeOf(ui.*).Node {
|
|
59
47
|
var semantics = options.semantics;
|
|
60
48
|
if (semantics.role == .none) semantics.role = .list;
|
|
@@ -66,8 +54,6 @@ pub fn build(ui: anytype, options: Options, steps: []const Step) @TypeOf(ui.*).N
|
|
|
66
54
|
for (steps, 0..) |step, index| {
|
|
67
55
|
nodes[index * 2] = stepNode(ui, options.active, index, steps.len, step);
|
|
68
56
|
if (index + 1 < steps.len) {
|
|
69
|
-
// The connector between steps: a bare separator inside a row
|
|
70
|
-
// renders as a hairline across the space it grows into.
|
|
71
57
|
nodes[index * 2 + 1] = ui.el(.separator, .{ .grow = 1 }, .{});
|
|
72
58
|
}
|
|
73
59
|
}
|
|
@@ -83,17 +69,12 @@ pub fn build(ui: anytype, options: Options, steps: []const Step) @TypeOf(ui.*).N
|
|
|
83
69
|
|
|
84
70
|
fn stepNode(ui: anytype, active: usize, index: usize, count: usize, step: Step) @TypeOf(ui.*).Node {
|
|
85
71
|
const state = stepState(active, index);
|
|
86
|
-
// Completed steps wear the vector `check` icon — a check text glyph
|
|
87
|
-
// is outside the bundled font's coverage and would render as a tofu
|
|
88
|
-
// box on the reference/screenshot paths.
|
|
89
72
|
const indicator = ui.el(.badge, .{
|
|
90
73
|
.variant = if (state == .pending) canvas.WidgetVariant.outline else .primary,
|
|
91
74
|
.icon = if (state == .completed) "check" else "",
|
|
92
75
|
.text = if (state == .completed) "" else ui.fmt("{d}", .{index + 1}),
|
|
93
76
|
}, .{});
|
|
94
77
|
const label = switch (state) {
|
|
95
|
-
// The active step reads bold; a single bold span is the wrapped
|
|
96
|
-
// text machinery, so the emphasis costs no second text pipeline.
|
|
97
78
|
.active => ui.paragraph(.{}, &.{.{ .text = step.label, .weight = .bold }}),
|
|
98
79
|
.completed => ui.text(.{}, step.label),
|
|
99
80
|
.pending => ui.text(.{ .style_tokens = .{ .foreground = .text_muted } }, step.label),
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<!-- Your app's timeline item.
|
|
2
|
+
Ejected from the Native SDK component library.
|
|
3
|
+
|
|
4
|
+
This file now belongs to your app: edit it freely, and SDK updates
|
|
5
|
+
never touch it. The template exposes the item's markup-owned shape and
|
|
6
|
+
keeps its content and state arguments at the same element boundary:
|
|
7
|
+
|
|
8
|
+
before: <timeline-item title="Build" variant="primary" />
|
|
9
|
+
after: <import src="components/timeline-item.native"/>
|
|
10
|
+
<use template="timeline-item" title="Build" variant="primary" />
|
|
11
|
+
|
|
12
|
+
A call site that needs a typed `on-press` forwards it on the `<use>`:
|
|
13
|
+
`<use template="timeline-item" ... on-press="open:{entry.id}" />`.
|
|
14
|
+
Message bindings stay typed and resolve at the use site. The `global_key` template
|
|
15
|
+
arg uses an underscore because template args are binding names; it
|
|
16
|
+
forwards to the element's `global-key` attribute.
|
|
17
|
+
|
|
18
|
+
Deleting this file costs nothing; `native eject component timeline-item`
|
|
19
|
+
writes it again. -->
|
|
20
|
+
<template name="timeline-item" args="title description= meta= indicator= icon= variant=outline connector=true selected=false key= global_key=">
|
|
21
|
+
<timeline-item title="{title}" description="{description}" meta="{meta}" indicator="{indicator}" icon="{icon}" variant="{variant}" connector="{connector}" selected="{selected}" key="{key}" global-key="{global_key}" />
|
|
22
|
+
</template>
|
|
@@ -16,12 +16,14 @@
|
|
|
16
16
|
are only reachable through <use>, so the built-in <timeline> element
|
|
17
17
|
keeps meaning what it always did at call sites you have not
|
|
18
18
|
migrated. <timeline-item> children work unchanged inside the <use> -
|
|
19
|
-
they land at the <slot/> below.
|
|
19
|
+
they land at the <slot/> below. The `global_key` template arg uses an
|
|
20
|
+
underscore because template args are binding names; it forwards to the
|
|
21
|
+
element's `global-key` attribute.
|
|
20
22
|
|
|
21
23
|
Deleting this file costs nothing; `native eject component timeline`
|
|
22
24
|
writes it again. -->
|
|
23
|
-
<template name="timeline" args="gap=0 grow=0 label=">
|
|
24
|
-
<column role="list" gap="{gap}" grow="{grow}" label="{label}">
|
|
25
|
+
<template name="timeline" args="gap=0 grow=0 label= key= global_key=">
|
|
26
|
+
<column role="list" gap="{gap}" grow="{grow}" label="{label}" key="{key}" global-key="{global_key}">
|
|
25
27
|
<slot/>
|
|
26
28
|
</column>
|
|
27
29
|
</template>
|
|
@@ -16,14 +16,7 @@
|
|
|
16
16
|
//! The library form stays available — call sites you have not migrated
|
|
17
17
|
//! keep rendering the stock item, and deleting this file costs nothing
|
|
18
18
|
//! (`native eject component timeline-item` writes it again).
|
|
19
|
-
//!
|
|
20
|
-
//! The composition, in one glance: a leading status indicator (badge or
|
|
21
|
-
//! dot, plus a hairline connector toward the next item), a
|
|
22
|
-
//! title/description/meta content column, and — when pressable — a
|
|
23
|
-
//! trailing chevron with `on_press` bound to the item's root, so presses
|
|
24
|
-
//! on the plain text fall through to the item.
|
|
25
19
|
|
|
26
|
-
const std = @import("std");
|
|
27
20
|
const native_sdk = @import("native_sdk");
|
|
28
21
|
const canvas = native_sdk.canvas;
|
|
29
22
|
|
|
@@ -34,31 +27,13 @@ pub fn TimelineItem(comptime Msg: type) type {
|
|
|
34
27
|
pub const Options = struct {
|
|
35
28
|
key: ?canvas.UiKey = null,
|
|
36
29
|
global_key: ?canvas.UiKey = null,
|
|
37
|
-
/// Indicator badge text ("3"); empty (with no `icon`)
|
|
38
|
-
/// renders a small dot. Prefer `icon` for symbols — text
|
|
39
|
-
/// glyphs outside the bundled font render as tofu boxes on
|
|
40
|
-
/// the reference/screenshot paths.
|
|
41
30
|
indicator: []const u8 = "",
|
|
42
|
-
/// Vector icon indicator (registry name, e.g. "check"):
|
|
43
|
-
/// drawn inside the badge with the variant's tint. Wins the
|
|
44
|
-
/// badge's content slot alongside `indicator` text.
|
|
45
31
|
icon: []const u8 = "",
|
|
46
|
-
/// Indicator color variant — map item outcomes here (primary
|
|
47
|
-
/// for done, destructive for errors, outline for stopped, ...).
|
|
48
32
|
variant: canvas.WidgetVariant = .outline,
|
|
49
33
|
title: []const u8,
|
|
50
|
-
/// Wrapped muted preview under the title.
|
|
51
34
|
description: []const u8 = "",
|
|
52
|
-
/// Muted trailing meta line ("claude · sonnet · 1m 12s").
|
|
53
35
|
meta: []const u8 = "",
|
|
54
|
-
/// Hairline connector from the indicator toward the next
|
|
55
|
-
/// item; clear it on the last item.
|
|
56
36
|
connector: bool = true,
|
|
57
|
-
/// Whole-item press: adds a trailing chevron and binds the
|
|
58
|
-
/// press to the item's root, focusable with role `listitem`.
|
|
59
|
-
/// A click anywhere on the item dispatches — presses on the
|
|
60
|
-
/// title/description/meta text fall through to the root
|
|
61
|
-
/// (dragging still selects the text).
|
|
62
37
|
on_press: ?Msg = null,
|
|
63
38
|
selected: bool = false,
|
|
64
39
|
};
|
|
@@ -95,7 +70,6 @@ pub fn TimelineItem(comptime Msg: type) type {
|
|
|
95
70
|
content_len += 1;
|
|
96
71
|
}
|
|
97
72
|
const content = ui.el(.column, .{ .grow = 1, .gap = 2 }, .{content_nodes[0..content_len]});
|
|
98
|
-
|
|
99
73
|
const item_semantics = canvas.WidgetSemantics{
|
|
100
74
|
.role = .listitem,
|
|
101
75
|
.label = options.title,
|
|
@@ -113,12 +87,6 @@ pub fn TimelineItem(comptime Msg: type) type {
|
|
|
113
87
|
row_len += 1;
|
|
114
88
|
}
|
|
115
89
|
const row_node = ui.el(.row, .{ .gap = 10, .padding = 8 }, .{row_children[0..row_len]});
|
|
116
|
-
|
|
117
|
-
// The press binds to the item's root: a bound handler makes
|
|
118
|
-
// the stack a hit target, and presses on the plain
|
|
119
|
-
// title/description/meta text fall through to it (dragging
|
|
120
|
-
// still selects the text). No overlay, no duplicated
|
|
121
|
-
// handlers.
|
|
122
90
|
return ui.el(.stack, .{
|
|
123
91
|
.key = options.key,
|
|
124
92
|
.global_key = options.global_key,
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
//! The ownership model, stated once: the default is to USE the library
|
|
5
5
|
//! composites and theme them through design tokens; ejecting writes the
|
|
6
6
|
//! composite's canonical source into the app (`src/components/`) for the
|
|
7
|
-
//! moment you need to own its shape. Only
|
|
7
|
+
//! moment you need to own its shape. Only library compositions are on the
|
|
8
8
|
//! menu — views the library itself builds from public primitives (rows,
|
|
9
9
|
//! columns, badges, separators, text). Engine control classes (buttons,
|
|
10
10
|
//! text fields, tabs, ...) are never ejectable: their behavior lives in
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
//! fork.
|
|
13
13
|
//!
|
|
14
14
|
//! Each canonical source lives as a real file next to this one
|
|
15
|
-
//! (`components/`), embedded verbatim at compile time, and held
|
|
15
|
+
//! (`components/`), embedded verbatim at compile time, and held in parity
|
|
16
16
|
//! by identity tests (`src/tooling/components/identity_tests.zig`) that
|
|
17
17
|
//! build the ejected form and the library form against the same inputs
|
|
18
18
|
//! and require identical widget trees. Whether a component ejects as a
|
|
@@ -25,6 +25,9 @@
|
|
|
25
25
|
const std = @import("std");
|
|
26
26
|
const buildgraph = @import("buildgraph.zig");
|
|
27
27
|
|
|
28
|
+
pub const ComponentForm = enum { markup, zig };
|
|
29
|
+
pub const ComponentCore = enum { ts, zig };
|
|
30
|
+
|
|
28
31
|
pub const Component = struct {
|
|
29
32
|
/// The name `native eject component <name>` accepts (the registry
|
|
30
33
|
/// element / builder-sugar name, so users name the thing they see).
|
|
@@ -36,30 +39,75 @@ pub const Component = struct {
|
|
|
36
39
|
/// The canonical source, embedded verbatim — the identity tests keep
|
|
37
40
|
/// it building the exact tree the library builds.
|
|
38
41
|
source: []const u8,
|
|
42
|
+
/// The source form written into an app. This is explicit so the CLI can
|
|
43
|
+
/// refuse a future Zig-form component in a TypeScript tree rather than
|
|
44
|
+
/// violating the app-authoring rule.
|
|
45
|
+
form_kind: ComponentForm = .markup,
|
|
39
46
|
/// One-line form summary for listings and the success message.
|
|
40
47
|
form: []const u8,
|
|
48
|
+
/// Legacy Zig source retained for Zig-core apps. TypeScript apps use the
|
|
49
|
+
/// markup source above; Zig apps keep the builder-shaped component API
|
|
50
|
+
/// that existed before markup templates became the default.
|
|
51
|
+
zig_path: ?[]const u8 = null,
|
|
52
|
+
zig_source: ?[]const u8 = null,
|
|
53
|
+
zig_form: []const u8 = "Zig view function",
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
pub const Ejection = struct {
|
|
57
|
+
name: []const u8,
|
|
58
|
+
path: []const u8,
|
|
59
|
+
source: []const u8,
|
|
60
|
+
form: []const u8,
|
|
61
|
+
form_kind: ComponentForm,
|
|
41
62
|
};
|
|
42
63
|
|
|
64
|
+
pub fn forCore(component: *const Component, core: ComponentCore) ?Ejection {
|
|
65
|
+
return switch (core) {
|
|
66
|
+
.ts => .{
|
|
67
|
+
.name = component.name,
|
|
68
|
+
.path = component.path,
|
|
69
|
+
.source = component.source,
|
|
70
|
+
.form = component.form,
|
|
71
|
+
.form_kind = component.form_kind,
|
|
72
|
+
},
|
|
73
|
+
.zig => if (component.zig_path != null and component.zig_source != null) .{
|
|
74
|
+
.name = component.name,
|
|
75
|
+
.path = component.zig_path.?,
|
|
76
|
+
.source = component.zig_source.?,
|
|
77
|
+
.form = component.zig_form,
|
|
78
|
+
.form_kind = .zig,
|
|
79
|
+
} else null,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
43
83
|
/// The ejectable set. Growing it is three steps: add the canonical
|
|
44
84
|
/// source under `components/`, add its identity test, add a row here.
|
|
45
85
|
pub const components = [_]Component{
|
|
46
86
|
.{
|
|
47
87
|
.name = "stepper",
|
|
48
|
-
.path = "src/components/stepper.
|
|
49
|
-
.source = @embedFile("components/stepper.
|
|
50
|
-
.form = "
|
|
88
|
+
.path = "src/components/stepper.native",
|
|
89
|
+
.source = @embedFile("components/stepper.native"),
|
|
90
|
+
.form = "markup template",
|
|
91
|
+
.form_kind = .markup,
|
|
92
|
+
.zig_path = "src/components/stepper.zig",
|
|
93
|
+
.zig_source = @embedFile("components/stepper.zig"),
|
|
51
94
|
},
|
|
52
95
|
.{
|
|
53
96
|
.name = "timeline",
|
|
54
97
|
.path = "src/components/timeline.native",
|
|
55
98
|
.source = @embedFile("components/timeline.native"),
|
|
56
99
|
.form = "markup template",
|
|
100
|
+
.zig_path = null,
|
|
101
|
+
.zig_source = null,
|
|
57
102
|
},
|
|
58
103
|
.{
|
|
59
104
|
.name = "timeline-item",
|
|
60
|
-
.path = "src/components/
|
|
61
|
-
.source = @embedFile("components/
|
|
62
|
-
.form = "
|
|
105
|
+
.path = "src/components/timeline-item.native",
|
|
106
|
+
.source = @embedFile("components/timeline-item.native"),
|
|
107
|
+
.form = "markup template",
|
|
108
|
+
.form_kind = .markup,
|
|
109
|
+
.zig_path = "src/components/timeline_item.zig",
|
|
110
|
+
.zig_source = @embedFile("components/timeline_item.zig"),
|
|
63
111
|
},
|
|
64
112
|
};
|
|
65
113
|
|
|
@@ -119,6 +167,10 @@ fn editDistance(a: []const u8, b: []const u8) ?usize {
|
|
|
119
167
|
/// destination already exists — eject transfers ownership exactly once
|
|
120
168
|
/// and never overwrites a component the user may have edited.
|
|
121
169
|
pub fn eject(io: std.Io, app_dir: []const u8, component: *const Component) error{ AlreadyEjected, WriteFailed }!void {
|
|
170
|
+
return ejectSelection(io, app_dir, forCore(component, .ts).?);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
pub fn ejectSelection(io: std.Io, app_dir: []const u8, component: Ejection) error{ AlreadyEjected, WriteFailed }!void {
|
|
122
174
|
var dir = std.Io.Dir.cwd().openDir(io, app_dir, .{}) catch return error.WriteFailed;
|
|
123
175
|
defer dir.close(io);
|
|
124
176
|
if (buildgraph.fileExistsIn(io, dir, component.path)) return error.AlreadyEjected;
|
|
@@ -168,3 +220,19 @@ test "unknown names suggest their nearest ejectable component" {
|
|
|
168
220
|
test "the component list names every ejectable component" {
|
|
169
221
|
try std.testing.expectEqualStrings("stepper, timeline, timeline-item", component_list);
|
|
170
222
|
}
|
|
223
|
+
|
|
224
|
+
test "current ejectable components all use the markup form" {
|
|
225
|
+
for (components) |component| {
|
|
226
|
+
try std.testing.expectEqual(ComponentForm.markup, component.form_kind);
|
|
227
|
+
try std.testing.expect(std.mem.endsWith(u8, component.path, ".native"));
|
|
228
|
+
try std.testing.expectEqualStrings("markup template", component.form);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
test "Zig-core selection preserves the legacy builder sources" {
|
|
233
|
+
try std.testing.expectEqualStrings("src/components/stepper.zig", forCore(&components[0], .zig).?.path);
|
|
234
|
+
try std.testing.expectEqual(ComponentForm.zig, forCore(&components[0], .zig).?.form_kind);
|
|
235
|
+
try std.testing.expect(forCore(&components[1], .zig) == null);
|
|
236
|
+
try std.testing.expectEqualStrings("src/components/timeline_item.zig", forCore(&components[2], .zig).?.path);
|
|
237
|
+
try std.testing.expect(std.mem.indexOf(u8, forCore(&components[2], .zig).?.source, "on_press") != null);
|
|
238
|
+
}
|
package/src/tooling/ios.zig
CHANGED
|
@@ -36,6 +36,7 @@ pub const host_image_fit_header = @import("ios_host").apple_image_fit_h;
|
|
|
36
36
|
pub const host_source_name = "uikit_host.m";
|
|
37
37
|
pub const host_header_name = "native_sdk_app.h";
|
|
38
38
|
pub const host_image_fit_header_name = "apple_image_fit.h";
|
|
39
|
+
const ubsan_runtime_name = "libclang_rt.ubsan_iossim_dynamic.dylib";
|
|
39
40
|
|
|
40
41
|
pub const deployment_target = "15.0";
|
|
41
42
|
|
|
@@ -307,18 +308,40 @@ pub fn runDev(allocator: std.mem.Allocator, io: std.Io, options: DevOptions) !vo
|
|
|
307
308
|
// target (ELF from the Android tier) must fail here with the real
|
|
308
309
|
// cause, not as a confusing linker error.
|
|
309
310
|
embedlib.requireArchiveClass(allocator, io, lib_path, .macho, LibSlice.simulator.zigTriple()) catch return error.HostCompileFailed;
|
|
310
|
-
try
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
"
|
|
316
|
-
"
|
|
317
|
-
"-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
311
|
+
const ubsan_runtime = if (try archiveNeedsUbsan(allocator, io, lib_path)) try simulatorUbsanRuntimePathAlloc(allocator, io) else null;
|
|
312
|
+
defer if (ubsan_runtime) |path| allocator.free(path);
|
|
313
|
+
var clang_args: std.ArrayList([]const u8) = .empty;
|
|
314
|
+
defer clang_args.deinit(allocator);
|
|
315
|
+
try clang_args.appendSlice(allocator, &.{
|
|
316
|
+
"xcrun", "--sdk", LibSlice.simulator.clangSdk(),
|
|
317
|
+
"clang", "-target", LibSlice.simulator.clangTriple(),
|
|
318
|
+
"-fobjc-arc", "-O2", ".native/ios/host/" ++ host_source_name,
|
|
319
|
+
lib_path,
|
|
320
|
+
});
|
|
321
|
+
if (ubsan_runtime) |path| {
|
|
322
|
+
// ScriptC's Debug runtime references Clang UBSan handlers. Link
|
|
323
|
+
// the runtime directly so the UIKit host itself stays uninstrumented.
|
|
324
|
+
try clang_args.appendSlice(allocator, &.{ path, "-Wl,-rpath,@executable_path" });
|
|
325
|
+
}
|
|
326
|
+
try clang_args.appendSlice(allocator, &.{
|
|
327
|
+
"-framework", "UIKit",
|
|
328
|
+
"-framework", "Metal",
|
|
329
|
+
"-framework", "QuartzCore",
|
|
330
|
+
"-framework", "Foundation",
|
|
331
|
+
"-framework", "CoreGraphics",
|
|
332
|
+
"-framework", "AVFoundation",
|
|
333
|
+
"-framework", "ImageIO",
|
|
334
|
+
"-framework", "Security",
|
|
335
|
+
"-o", executable_path,
|
|
336
|
+
});
|
|
337
|
+
try runInherit(io, clang_args.items, error.HostCompileFailed);
|
|
338
|
+
if (ubsan_runtime) |path| {
|
|
339
|
+
const bundled_runtime = try std.fs.path.join(allocator, &.{ bundle_path, ubsan_runtime_name });
|
|
340
|
+
defer allocator.free(bundled_runtime);
|
|
341
|
+
const arch = if (builtin.cpu.arch == .x86_64) "x86_64" else "arm64";
|
|
342
|
+
try runInherit(io, &.{ "xcrun", "lipo", "-thin", arch, path, "-output", bundled_runtime }, error.HostCompileFailed);
|
|
343
|
+
try runInherit(io, &.{ "codesign", "--force", "--sign", "-", bundled_runtime }, error.HostCompileFailed);
|
|
344
|
+
}
|
|
322
345
|
try runInherit(io, &.{ "codesign", "--force", "--sign", "-", bundle_path }, error.HostCompileFailed);
|
|
323
346
|
|
|
324
347
|
const device = options.device orelse try pickSimulatorDevice(allocator, io);
|
|
@@ -412,6 +435,37 @@ pub fn hasOptimizeFlag(args: []const []const u8) bool {
|
|
|
412
435
|
return false;
|
|
413
436
|
}
|
|
414
437
|
|
|
438
|
+
fn archiveNeedsUbsan(allocator: std.mem.Allocator, io: std.Io, lib_path: []const u8) !bool {
|
|
439
|
+
const result = std.process.run(allocator, io, .{
|
|
440
|
+
.argv = &.{ "xcrun", "nm", "-u", "-j", lib_path },
|
|
441
|
+
.stdout_limit = .limited(16 * 1024 * 1024),
|
|
442
|
+
.stderr_limit = .limited(64 * 1024),
|
|
443
|
+
}) catch return error.HostCompileFailed;
|
|
444
|
+
defer allocator.free(result.stdout);
|
|
445
|
+
defer allocator.free(result.stderr);
|
|
446
|
+
if (result.term != .exited or result.term.exited != 0) {
|
|
447
|
+
std.debug.print("native dev (ios): could not inspect the embed archive for sanitizer references: {s}\n", .{result.stderr});
|
|
448
|
+
return error.HostCompileFailed;
|
|
449
|
+
}
|
|
450
|
+
return std.mem.indexOf(u8, result.stdout, "___ubsan_handle_") != null;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
fn simulatorUbsanRuntimePathAlloc(allocator: std.mem.Allocator, io: std.Io) ![]const u8 {
|
|
454
|
+
const result = std.process.run(allocator, io, .{
|
|
455
|
+
.argv = &.{ "xcrun", "--sdk", "iphonesimulator", "clang", "-print-file-name=" ++ ubsan_runtime_name },
|
|
456
|
+
.stdout_limit = .limited(4096),
|
|
457
|
+
.stderr_limit = .limited(64 * 1024),
|
|
458
|
+
}) catch return error.HostCompileFailed;
|
|
459
|
+
defer allocator.free(result.stdout);
|
|
460
|
+
defer allocator.free(result.stderr);
|
|
461
|
+
const path = std.mem.trim(u8, result.stdout, " \t\r\n");
|
|
462
|
+
if (result.term != .exited or result.term.exited != 0 or !buildgraph.fileExists(io, path)) {
|
|
463
|
+
std.debug.print("native dev (ios): Xcode's simulator UBSan runtime ({s}) is unavailable\n", .{ubsan_runtime_name});
|
|
464
|
+
return error.HostCompileFailed;
|
|
465
|
+
}
|
|
466
|
+
return allocator.dupe(u8, path);
|
|
467
|
+
}
|
|
468
|
+
|
|
415
469
|
/// Spawn with inherited stdio and turn a non-zero exit into `fail_error`
|
|
416
470
|
/// after naming the failed step (never fail in silence).
|
|
417
471
|
fn runInherit(io: std.Io, argv: []const []const u8, fail_error: anyerror) !void {
|