@native-sdk/cli 0.0.0 → 0.4.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/LICENSE +176 -0
- package/README.md +50 -1
- package/app.zon +30 -0
- package/bin/native.js +156 -0
- package/build/app.zig +716 -0
- package/build.zig +2593 -0
- package/build.zig.zon +24 -0
- package/native-sdk.d.ts +615 -0
- package/package.json +44 -8
- package/skill-data/automation/SKILL.md +248 -0
- package/skill-data/core/SKILL.md +249 -0
- package/skill-data/core/references/app-model-runtime.md +141 -0
- package/skill-data/core/references/bridge-security-native-capabilities.md +230 -0
- package/skill-data/core/references/frontend-assets.md +124 -0
- package/skill-data/core/references/project-anatomy.md +108 -0
- package/skill-data/core/references/web-engines-packaging-debugging.md +199 -0
- package/skill-data/native-ui/SKILL.md +1080 -0
- package/skills/native-sdk/SKILL.md +33 -0
- package/src/app_runner/root.zig +740 -0
- package/src/assets/root.zig +20 -0
- package/src/automation/protocol.zig +285 -0
- package/src/automation/root.zig +13 -0
- package/src/automation/server.zig +506 -0
- package/src/automation/snapshot.zig +1202 -0
- package/src/automation/watcher.zig +165 -0
- package/src/bridge/root.zig +507 -0
- package/src/debug/root.zig +246 -0
- package/src/embed/app_exports.zig +11 -0
- package/src/embed/c_api.zig +793 -0
- package/src/embed/c_exports.zig +10 -0
- package/src/embed/chrome.zig +168 -0
- package/src/embed/conversions.zig +359 -0
- package/src/embed/host.zig +960 -0
- package/src/embed/root.zig +81 -0
- package/src/embed/tests.zig +2552 -0
- package/src/embed/types.zig +382 -0
- package/src/embed/ui_host.zig +289 -0
- package/src/extensions/root.zig +197 -0
- package/src/frontend/root.zig +48 -0
- package/src/js/root.zig +65 -0
- package/src/platform/android/NativeSdkActivity.java +1370 -0
- package/src/platform/android/android_host.c +696 -0
- package/src/platform/android/files.zig +9 -0
- package/src/platform/android/native_sdk_app.h +237 -0
- package/src/platform/ios/files.zig +8 -0
- package/src/platform/ios/native_sdk_app.h +289 -0
- package/src/platform/ios/uikit_host.m +2739 -0
- package/src/platform/linux/cef_host.cpp +599 -0
- package/src/platform/linux/gtk_host.c +5362 -0
- package/src/platform/linux/gtk_host.h +265 -0
- package/src/platform/linux/root.zig +1519 -0
- package/src/platform/macos/appkit_host.h +604 -0
- package/src/platform/macos/appkit_host.m +10392 -0
- package/src/platform/macos/automation_host.h +14 -0
- package/src/platform/macos/automation_host.m +12 -0
- package/src/platform/macos/cef_host.mm +3028 -0
- package/src/platform/macos/root.zig +2260 -0
- package/src/platform/null_platform.zig +2232 -0
- package/src/platform/null_platform_tests.zig +670 -0
- package/src/platform/policy_values.zig +14 -0
- package/src/platform/root.zig +181 -0
- package/src/platform/types.zig +2681 -0
- package/src/platform/windows/cef_host.cpp +3 -0
- package/src/platform/windows/root.zig +1521 -0
- package/src/platform/windows/webview2_host.cpp +6230 -0
- package/src/primitives/app_dirs/root.zig +440 -0
- package/src/primitives/app_manifest/root.zig +109 -0
- package/src/primitives/app_manifest/tests.zig +758 -0
- package/src/primitives/app_manifest/types.zig +587 -0
- package/src/primitives/app_manifest/validation.zig +828 -0
- package/src/primitives/assets/root.zig +520 -0
- package/src/primitives/canvas/a11y_audit.zig +390 -0
- package/src/primitives/canvas/a11y_audit_tests.zig +225 -0
- package/src/primitives/canvas/app_icon.zig +1590 -0
- package/src/primitives/canvas/chart.zig +392 -0
- package/src/primitives/canvas/chart_tests.zig +751 -0
- package/src/primitives/canvas/commands.zig +446 -0
- package/src/primitives/canvas/drawing.zig +309 -0
- package/src/primitives/canvas/equality.zig +316 -0
- package/src/primitives/canvas/events.zig +696 -0
- package/src/primitives/canvas/font_coverage.zig +118 -0
- package/src/primitives/canvas/font_ttf.zig +510 -0
- package/src/primitives/canvas/font_ttf_tests.zig +280 -0
- package/src/primitives/canvas/fonts/Geist-Regular.ttf +0 -0
- package/src/primitives/canvas/fonts/GeistMono-Regular.ttf +0 -0
- package/src/primitives/canvas/frame.zig +679 -0
- package/src/primitives/canvas/frame_metrics.zig +462 -0
- package/src/primitives/canvas/gpu.zig +639 -0
- package/src/primitives/canvas/hash.zig +112 -0
- package/src/primitives/canvas/icons/alert.svg +1 -0
- package/src/primitives/canvas/icons/archive.svg +1 -0
- package/src/primitives/canvas/icons/arrow-down.svg +1 -0
- package/src/primitives/canvas/icons/arrow-right.svg +1 -0
- package/src/primitives/canvas/icons/arrow-up.svg +1 -0
- package/src/primitives/canvas/icons/check-circle.svg +1 -0
- package/src/primitives/canvas/icons/check.svg +1 -0
- package/src/primitives/canvas/icons/chevron-down.svg +1 -0
- package/src/primitives/canvas/icons/chevron-left.svg +1 -0
- package/src/primitives/canvas/icons/chevron-right.svg +1 -0
- package/src/primitives/canvas/icons/chevron-up.svg +1 -0
- package/src/primitives/canvas/icons/circle-dot.svg +1 -0
- package/src/primitives/canvas/icons/clock.svg +1 -0
- package/src/primitives/canvas/icons/copy.svg +1 -0
- package/src/primitives/canvas/icons/download.svg +1 -0
- package/src/primitives/canvas/icons/edit.svg +1 -0
- package/src/primitives/canvas/icons/ellipsis.svg +1 -0
- package/src/primitives/canvas/icons/external-link.svg +1 -0
- package/src/primitives/canvas/icons/eye.svg +1 -0
- package/src/primitives/canvas/icons/file-text.svg +1 -0
- package/src/primitives/canvas/icons/folder-open.svg +1 -0
- package/src/primitives/canvas/icons/folder.svg +1 -0
- package/src/primitives/canvas/icons/git-branch.svg +1 -0
- package/src/primitives/canvas/icons/git-merge.svg +1 -0
- package/src/primitives/canvas/icons/git-pull-request.svg +1 -0
- package/src/primitives/canvas/icons/info.svg +1 -0
- package/src/primitives/canvas/icons/menu.svg +1 -0
- package/src/primitives/canvas/icons/missing.svg +1 -0
- package/src/primitives/canvas/icons/moon.svg +1 -0
- package/src/primitives/canvas/icons/music.svg +1 -0
- package/src/primitives/canvas/icons/panel-left.svg +1 -0
- package/src/primitives/canvas/icons/panel-right.svg +1 -0
- package/src/primitives/canvas/icons/pause.svg +1 -0
- package/src/primitives/canvas/icons/play.svg +1 -0
- package/src/primitives/canvas/icons/plus.svg +1 -0
- package/src/primitives/canvas/icons/refresh-cw.svg +1 -0
- package/src/primitives/canvas/icons/repeat.svg +1 -0
- package/src/primitives/canvas/icons/save.svg +1 -0
- package/src/primitives/canvas/icons/search.svg +1 -0
- package/src/primitives/canvas/icons/send.svg +1 -0
- package/src/primitives/canvas/icons/settings.svg +1 -0
- package/src/primitives/canvas/icons/shuffle.svg +1 -0
- package/src/primitives/canvas/icons/skip-back.svg +1 -0
- package/src/primitives/canvas/icons/skip-forward.svg +1 -0
- package/src/primitives/canvas/icons/sun.svg +1 -0
- package/src/primitives/canvas/icons/terminal.svg +1 -0
- package/src/primitives/canvas/icons/trash.svg +1 -0
- package/src/primitives/canvas/icons/volume.svg +1 -0
- package/src/primitives/canvas/icons/wrench.svg +1 -0
- package/src/primitives/canvas/icons/x-circle.svg +1 -0
- package/src/primitives/canvas/icons/x.svg +1 -0
- package/src/primitives/canvas/icons.zig +249 -0
- package/src/primitives/canvas/layout_audit.zig +744 -0
- package/src/primitives/canvas/layout_audit_tests.zig +426 -0
- package/src/primitives/canvas/markdown.zig +1031 -0
- package/src/primitives/canvas/markdown_hostile_tests.zig +471 -0
- package/src/primitives/canvas/markdown_tests.zig +538 -0
- package/src/primitives/canvas/plan_key_index.zig +120 -0
- package/src/primitives/canvas/png.zig +355 -0
- package/src/primitives/canvas/reference.zig +1457 -0
- package/src/primitives/canvas/reference_blur.zig +104 -0
- package/src/primitives/canvas/reference_memo.zig +322 -0
- package/src/primitives/canvas/reference_paths.zig +184 -0
- package/src/primitives/canvas/reference_tests.zig +1650 -0
- package/src/primitives/canvas/render.zig +747 -0
- package/src/primitives/canvas/render_effects.zig +255 -0
- package/src/primitives/canvas/render_fingerprints.zig +256 -0
- package/src/primitives/canvas/render_generic_resources.zig +376 -0
- package/src/primitives/canvas/render_images.zig +247 -0
- package/src/primitives/canvas/render_layers.zig +260 -0
- package/src/primitives/canvas/render_paths.zig +347 -0
- package/src/primitives/canvas/render_resources.zig +51 -0
- package/src/primitives/canvas/render_tests.zig +3186 -0
- package/src/primitives/canvas/root.zig +744 -0
- package/src/primitives/canvas/serialization.zig +1528 -0
- package/src/primitives/canvas/svg_icon.zig +636 -0
- package/src/primitives/canvas/svg_icon_tests.zig +312 -0
- package/src/primitives/canvas/test_support.zig +422 -0
- package/src/primitives/canvas/testdata/markdown_document.md +83 -0
- package/src/primitives/canvas/tests.zig +30 -0
- package/src/primitives/canvas/text.zig +82 -0
- package/src/primitives/canvas/text_atlas.zig +408 -0
- package/src/primitives/canvas/text_batch_tests.zig +431 -0
- package/src/primitives/canvas/text_interaction.zig +615 -0
- package/src/primitives/canvas/text_layout.zig +1069 -0
- package/src/primitives/canvas/text_layout_cache.zig +281 -0
- package/src/primitives/canvas/text_layout_hash.zig +113 -0
- package/src/primitives/canvas/text_layout_types.zig +128 -0
- package/src/primitives/canvas/text_measure_cache.zig +279 -0
- package/src/primitives/canvas/text_metrics.zig +309 -0
- package/src/primitives/canvas/text_metrics_tests.zig +262 -0
- package/src/primitives/canvas/text_span_tests.zig +608 -0
- package/src/primitives/canvas/text_spans.zig +1010 -0
- package/src/primitives/canvas/text_tests.zig +1949 -0
- package/src/primitives/canvas/themes/geist.zig +470 -0
- package/src/primitives/canvas/tokens.zig +1522 -0
- package/src/primitives/canvas/ui.zig +2686 -0
- package/src/primitives/canvas/ui_markup.zig +3791 -0
- package/src/primitives/canvas/ui_markup_binary.zig +522 -0
- package/src/primitives/canvas/ui_markup_binary_tests.zig +591 -0
- package/src/primitives/canvas/ui_markup_compiled.zig +2565 -0
- package/src/primitives/canvas/ui_markup_compiled_tests.zig +1669 -0
- package/src/primitives/canvas/ui_markup_contract.zig +1620 -0
- package/src/primitives/canvas/ui_markup_contract_tests.zig +953 -0
- package/src/primitives/canvas/ui_markup_edit.zig +416 -0
- package/src/primitives/canvas/ui_markup_edit_tests.zig +341 -0
- package/src/primitives/canvas/ui_markup_expr.zig +1152 -0
- package/src/primitives/canvas/ui_markup_expr_tests.zig +779 -0
- package/src/primitives/canvas/ui_markup_huge_model_tests.zig +505 -0
- package/src/primitives/canvas/ui_markup_reflect.zig +127 -0
- package/src/primitives/canvas/ui_markup_tests.zig +1545 -0
- package/src/primitives/canvas/ui_markup_view.zig +2352 -0
- package/src/primitives/canvas/ui_markup_view_tests.zig +3709 -0
- package/src/primitives/canvas/ui_provenance.zig +96 -0
- package/src/primitives/canvas/ui_provenance_tests.zig +186 -0
- package/src/primitives/canvas/ui_schema.zig +825 -0
- package/src/primitives/canvas/ui_schema_tests.zig +128 -0
- package/src/primitives/canvas/ui_tests.zig +1432 -0
- package/src/primitives/canvas/vector.zig +919 -0
- package/src/primitives/canvas/vector_tests.zig +547 -0
- package/src/primitives/canvas/virtual_extent_tests.zig +317 -0
- package/src/primitives/canvas/virtual_extents.zig +540 -0
- package/src/primitives/canvas/widget_access.zig +208 -0
- package/src/primitives/canvas/widget_anchored_tests.zig +264 -0
- package/src/primitives/canvas/widget_builtin_tests.zig +3160 -0
- package/src/primitives/canvas/widget_invalidation.zig +748 -0
- package/src/primitives/canvas/widget_layout.zig +2055 -0
- package/src/primitives/canvas/widget_layout_tests.zig +2691 -0
- package/src/primitives/canvas/widget_metrics.zig +228 -0
- package/src/primitives/canvas/widget_render.zig +2534 -0
- package/src/primitives/canvas/widget_render_controls.zig +1563 -0
- package/src/primitives/canvas/widget_render_scroll.zig +136 -0
- package/src/primitives/canvas/widget_render_style.zig +626 -0
- package/src/primitives/canvas/widget_render_surfaces.zig +794 -0
- package/src/primitives/canvas/widget_routing.zig +475 -0
- package/src/primitives/canvas/widget_runtime.zig +307 -0
- package/src/primitives/canvas/widget_runtime_tests.zig +3015 -0
- package/src/primitives/canvas/widget_semantics.zig +480 -0
- package/src/primitives/canvas/widget_semantics_tests.zig +2129 -0
- package/src/primitives/canvas/widget_tests.zig +8 -0
- package/src/primitives/canvas/widget_text_input.zig +351 -0
- package/src/primitives/canvas/widget_text_select.zig +147 -0
- package/src/primitives/canvas/widget_tree.zig +232 -0
- package/src/primitives/canvas/widgets.zig +1319 -0
- package/src/primitives/diagnostics/root.zig +445 -0
- package/src/primitives/geometry/root.zig +889 -0
- package/src/primitives/json/root.zig +272 -0
- package/src/primitives/platform_info/root.zig +450 -0
- package/src/primitives/trace/root.zig +569 -0
- package/src/root.zig +165 -0
- package/src/runtime/api.zig +431 -0
- package/src/runtime/async_bridge.zig +49 -0
- package/src/runtime/automation_commands.zig +686 -0
- package/src/runtime/automation_liveness_tests.zig +140 -0
- package/src/runtime/automation_snapshot.zig +246 -0
- package/src/runtime/automation_widget_dispatch.zig +617 -0
- package/src/runtime/bridge_dispatch_tests.zig +202 -0
- package/src/runtime/bridge_payload.zig +194 -0
- package/src/runtime/bridge_permission_tests.zig +551 -0
- package/src/runtime/bridge_responses.zig +414 -0
- package/src/runtime/builtin_bridge.zig +554 -0
- package/src/runtime/canvas_budget_edge_tests.zig +415 -0
- package/src/runtime/canvas_font_tests.zig +410 -0
- package/src/runtime/canvas_fonts.zig +229 -0
- package/src/runtime/canvas_frame.zig +1734 -0
- package/src/runtime/canvas_frame_animation_tests.zig +609 -0
- package/src/runtime/canvas_frame_cache_tests.zig +333 -0
- package/src/runtime/canvas_frame_helpers.zig +414 -0
- package/src/runtime/canvas_frame_invalidation_tests.zig +544 -0
- package/src/runtime/canvas_frame_packet_tests.zig +1353 -0
- package/src/runtime/canvas_frame_patch_tests.zig +1051 -0
- package/src/runtime/canvas_frame_retained_tests.zig +753 -0
- package/src/runtime/canvas_frame_tests.zig +9 -0
- package/src/runtime/canvas_frame_text_layout_budget_tests.zig +149 -0
- package/src/runtime/canvas_image_tests.zig +362 -0
- package/src/runtime/canvas_images.zig +224 -0
- package/src/runtime/canvas_limits.zig +317 -0
- package/src/runtime/canvas_screenshot_tests.zig +289 -0
- package/src/runtime/canvas_widget_accessibility_tests.zig +1494 -0
- package/src/runtime/canvas_widget_anchored_tests.zig +678 -0
- package/src/runtime/canvas_widget_chart_tests.zig +249 -0
- package/src/runtime/canvas_widget_clipboard_tests.zig +399 -0
- package/src/runtime/canvas_widget_context_menu.zig +318 -0
- package/src/runtime/canvas_widget_context_menu_tests.zig +462 -0
- package/src/runtime/canvas_widget_control_tests.zig +2164 -0
- package/src/runtime/canvas_widget_disclosure_tests.zig +440 -0
- package/src/runtime/canvas_widget_display.zig +677 -0
- package/src/runtime/canvas_widget_event_tests.zig +1779 -0
- package/src/runtime/canvas_widget_events.zig +1098 -0
- package/src/runtime/canvas_widget_floating_tests.zig +695 -0
- package/src/runtime/canvas_widget_layout_tests.zig +26 -0
- package/src/runtime/canvas_widget_runtime.zig +1335 -0
- package/src/runtime/canvas_widget_scroll_driver_tests.zig +582 -0
- package/src/runtime/canvas_widget_scroll_drivers.zig +202 -0
- package/src/runtime/canvas_widget_scroll_tests.zig +1549 -0
- package/src/runtime/canvas_widget_semantics_tests.zig +810 -0
- package/src/runtime/canvas_widget_split_tree_tests.zig +1031 -0
- package/src/runtime/canvas_widget_state.zig +798 -0
- package/src/runtime/canvas_widget_text_tests.zig +2104 -0
- package/src/runtime/canvas_widget_window_drag_tests.zig +284 -0
- package/src/runtime/clock.zig +231 -0
- package/src/runtime/core.zig +927 -0
- package/src/runtime/effects.zig +4197 -0
- package/src/runtime/effects_audio_tests.zig +690 -0
- package/src/runtime/effects_clipboard_tests.zig +317 -0
- package/src/runtime/effects_fetch_tests.zig +1031 -0
- package/src/runtime/effects_file_tests.zig +407 -0
- package/src/runtime/effects_tests.zig +1251 -0
- package/src/runtime/flow.zig +1175 -0
- package/src/runtime/frame_profile.zig +221 -0
- package/src/runtime/gpu_surface_events.zig +639 -0
- package/src/runtime/launch_timing.zig +59 -0
- package/src/runtime/markdown_app_tests.zig +224 -0
- package/src/runtime/native_command_event_tests.zig +431 -0
- package/src/runtime/platform_bridge_tests.zig +8 -0
- package/src/runtime/platform_config_tests.zig +392 -0
- package/src/runtime/root.zig +150 -0
- package/src/runtime/runtime_event_tests.zig +1079 -0
- package/src/runtime/session_journal.zig +1522 -0
- package/src/runtime/session_record.zig +332 -0
- package/src/runtime/session_replay.zig +274 -0
- package/src/runtime/session_state.zig +30 -0
- package/src/runtime/session_tests.zig +399 -0
- package/src/runtime/shell_layout.zig +472 -0
- package/src/runtime/shell_layout_tests.zig +1246 -0
- package/src/runtime/shell_view_tests.zig +604 -0
- package/src/runtime/state.zig +110 -0
- package/src/runtime/system_services.zig +392 -0
- package/src/runtime/test_support.zig +79 -0
- package/src/runtime/tests.zig +30 -0
- package/src/runtime/ui_app.zig +3290 -0
- package/src/runtime/ui_app_huge_model_tests.zig +351 -0
- package/src/runtime/ui_app_provenance.zig +370 -0
- package/src/runtime/ui_app_tests.zig +3254 -0
- package/src/runtime/ui_app_virtual_variable_tests.zig +485 -0
- package/src/runtime/ui_app_window_tests.zig +442 -0
- package/src/runtime/validation.zig +206 -0
- package/src/runtime/view.zig +908 -0
- package/src/runtime/view_canvas.zig +850 -0
- package/src/runtime/view_widget_control.zig +433 -0
- package/src/runtime/view_widget_scroll.zig +360 -0
- package/src/runtime/view_widget_text.zig +275 -0
- package/src/runtime/view_widget_tree.zig +843 -0
- package/src/runtime/webview_view_bridge_tests.zig +664 -0
- package/src/runtime/widget_bridge.zig +231 -0
- package/src/runtime/window_command_bridge_tests.zig +403 -0
- package/src/runtime/window_storage.zig +255 -0
- package/src/runtime/window_view_runtime.zig +727 -0
- package/src/runtime/window_views.zig +334 -0
- package/src/security/root.zig +118 -0
- package/src/tooling/android.zig +1172 -0
- package/src/tooling/assets.zig +128 -0
- package/src/tooling/buildgraph.zig +379 -0
- package/src/tooling/cef.zig +671 -0
- package/src/tooling/codesign.zig +172 -0
- package/src/tooling/components/identity_tests.zig +185 -0
- package/src/tooling/components/stepper.zig +113 -0
- package/src/tooling/components/timeline.native +27 -0
- package/src/tooling/components/timeline_item.zig +131 -0
- package/src/tooling/default_icon.icns +0 -0
- package/src/tooling/default_icon.png +0 -0
- package/src/tooling/dev.zig +172 -0
- package/src/tooling/doctor.zig +349 -0
- package/src/tooling/eject_components.zig +170 -0
- package/src/tooling/embedlib.zig +290 -0
- package/src/tooling/ios.zig +528 -0
- package/src/tooling/manifest.zig +1939 -0
- package/src/tooling/package.zig +2388 -0
- package/src/tooling/process_tree.zig +114 -0
- package/src/tooling/raw_manifest.zig +193 -0
- package/src/tooling/root.zig +22 -0
- package/src/tooling/templates.zig +3191 -0
- package/src/tooling/toolchain.zig +371 -0
- package/src/tooling/verbs.zig +204 -0
- package/src/tooling/web_engine.zig +135 -0
- package/src/tooling/xcodeproj.zig +462 -0
- package/src/window_state/root.zig +507 -0
- package/index.js +0 -2
package/src/root.zig
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
pub const geometry = @import("geometry");
|
|
2
|
+
pub const assets = @import("assets");
|
|
3
|
+
pub const app_dirs = @import("app_dirs");
|
|
4
|
+
pub const app_manifest = @import("app_manifest");
|
|
5
|
+
pub const trace = @import("trace");
|
|
6
|
+
pub const diagnostics = @import("diagnostics");
|
|
7
|
+
pub const platform_info = @import("platform_info");
|
|
8
|
+
pub const canvas = @import("canvas");
|
|
9
|
+
pub const markdown = canvas.markdown;
|
|
10
|
+
|
|
11
|
+
pub const runtime = @import("runtime/root.zig");
|
|
12
|
+
pub const platform = @import("platform/root.zig");
|
|
13
|
+
pub const window_state = @import("window_state/root.zig");
|
|
14
|
+
pub const asset_server = @import("assets/root.zig");
|
|
15
|
+
pub const debug = @import("debug/root.zig");
|
|
16
|
+
pub const automation = @import("automation/root.zig");
|
|
17
|
+
pub const embed = @import("embed/root.zig");
|
|
18
|
+
pub const extensions = @import("extensions/root.zig");
|
|
19
|
+
pub const js = @import("js/root.zig");
|
|
20
|
+
pub const bridge = @import("bridge/root.zig");
|
|
21
|
+
pub const frontend = @import("frontend/root.zig");
|
|
22
|
+
pub const security = @import("security/root.zig");
|
|
23
|
+
|
|
24
|
+
pub const Runtime = runtime.Runtime;
|
|
25
|
+
pub const RuntimeOptions = runtime.Options;
|
|
26
|
+
pub const App = runtime.App;
|
|
27
|
+
pub const Event = runtime.Event;
|
|
28
|
+
pub const LifecycleEvent = runtime.LifecycleEvent;
|
|
29
|
+
pub const Command = runtime.Command;
|
|
30
|
+
pub const CommandEvent = runtime.CommandEvent;
|
|
31
|
+
pub const CommandSource = runtime.CommandSource;
|
|
32
|
+
pub const TestHarness = runtime.TestHarness;
|
|
33
|
+
pub const UiApp = runtime.UiApp;
|
|
34
|
+
pub const UiAppWithFeatures = runtime.UiAppWithFeatures;
|
|
35
|
+
pub const UiAppFeatures = runtime.UiAppFeatures;
|
|
36
|
+
pub const Effects = runtime.Effects;
|
|
37
|
+
pub const EffectLine = runtime.EffectLine;
|
|
38
|
+
pub const EffectExit = runtime.EffectExit;
|
|
39
|
+
pub const EffectExitReason = runtime.EffectExitReason;
|
|
40
|
+
pub const EffectExecutor = runtime.EffectExecutor;
|
|
41
|
+
pub const EffectOutputMode = runtime.EffectOutputMode;
|
|
42
|
+
pub const FetchResponseMode = runtime.FetchResponseMode;
|
|
43
|
+
pub const EffectResponse = runtime.EffectResponse;
|
|
44
|
+
pub const EffectFetchOutcome = runtime.EffectFetchOutcome;
|
|
45
|
+
pub const EffectFileOp = runtime.EffectFileOp;
|
|
46
|
+
pub const EffectFileOutcome = runtime.EffectFileOutcome;
|
|
47
|
+
pub const EffectFileResult = runtime.EffectFileResult;
|
|
48
|
+
pub const effect_error_exit_code = runtime.effect_error_exit_code;
|
|
49
|
+
pub const max_effects = runtime.max_effects;
|
|
50
|
+
pub const max_effect_argv = runtime.max_effect_argv;
|
|
51
|
+
pub const max_effect_argv_bytes = runtime.max_effect_argv_bytes;
|
|
52
|
+
pub const max_effect_stdin_bytes = runtime.max_effect_stdin_bytes;
|
|
53
|
+
pub const max_effect_line_bytes = runtime.max_effect_line_bytes;
|
|
54
|
+
pub const max_effect_line_bytes_ceiling = runtime.max_effect_line_bytes_ceiling;
|
|
55
|
+
pub const max_effect_collect_bytes = runtime.max_effect_collect_bytes;
|
|
56
|
+
pub const max_effect_stderr_tail_bytes = runtime.max_effect_stderr_tail_bytes;
|
|
57
|
+
pub const max_effect_queue_entries = runtime.max_effect_queue_entries;
|
|
58
|
+
pub const max_effect_url_bytes = runtime.max_effect_url_bytes;
|
|
59
|
+
pub const max_effect_fetch_headers = runtime.max_effect_fetch_headers;
|
|
60
|
+
pub const max_effect_fetch_header_bytes = runtime.max_effect_fetch_header_bytes;
|
|
61
|
+
pub const max_effect_fetch_payload_bytes = runtime.max_effect_fetch_payload_bytes;
|
|
62
|
+
pub const max_effect_body_bytes = runtime.max_effect_body_bytes;
|
|
63
|
+
pub const default_effect_fetch_timeout_ms = runtime.default_effect_fetch_timeout_ms;
|
|
64
|
+
pub const max_effect_file_path_bytes = runtime.max_effect_file_path_bytes;
|
|
65
|
+
pub const max_effect_file_bytes = runtime.max_effect_file_bytes;
|
|
66
|
+
pub const EffectClipboardOp = runtime.EffectClipboardOp;
|
|
67
|
+
pub const EffectClipboardOutcome = runtime.EffectClipboardOutcome;
|
|
68
|
+
pub const EffectClipboardResult = runtime.EffectClipboardResult;
|
|
69
|
+
pub const max_effect_clipboard_bytes = runtime.max_effect_clipboard_bytes;
|
|
70
|
+
pub const TimerMode = runtime.TimerMode;
|
|
71
|
+
pub const EffectTimer = runtime.EffectTimer;
|
|
72
|
+
pub const EffectTimerOutcome = runtime.EffectTimerOutcome;
|
|
73
|
+
pub const max_effect_timers = runtime.max_effect_timers;
|
|
74
|
+
pub const EffectAudio = runtime.EffectAudio;
|
|
75
|
+
pub const EffectAudioEventKind = runtime.EffectAudioEventKind;
|
|
76
|
+
pub const EffectAudioSource = runtime.EffectAudioSource;
|
|
77
|
+
pub const audioCachePath = runtime.audioCachePath;
|
|
78
|
+
pub const max_effect_audio_path_bytes = runtime.max_effect_audio_path_bytes;
|
|
79
|
+
pub const Clock = runtime.Clock;
|
|
80
|
+
pub const TestClock = runtime.TestClock;
|
|
81
|
+
pub const nowMs = runtime.nowMs;
|
|
82
|
+
pub const nowNanoseconds = runtime.nowNanoseconds;
|
|
83
|
+
pub const monotonicMs = runtime.monotonicMs;
|
|
84
|
+
pub const monotonicNanoseconds = runtime.monotonicNanoseconds;
|
|
85
|
+
pub const setFreestandingMonotonicNanoseconds = runtime.setFreestandingMonotonicNanoseconds;
|
|
86
|
+
pub const RegisteredImage = runtime.RegisteredImage;
|
|
87
|
+
pub const max_registered_canvas_images = runtime.max_registered_canvas_images;
|
|
88
|
+
pub const max_registered_canvas_image_pixel_bytes = runtime.max_registered_canvas_image_pixel_bytes;
|
|
89
|
+
pub const ShellConfig = app_manifest.ShellConfig;
|
|
90
|
+
pub const ShellWindow = app_manifest.ShellWindow;
|
|
91
|
+
pub const ShellView = app_manifest.ShellView;
|
|
92
|
+
pub const ShellEdge = app_manifest.ShellEdge;
|
|
93
|
+
pub const ShellAxis = app_manifest.ShellAxis;
|
|
94
|
+
pub const ShellTab = app_manifest.ShellTab;
|
|
95
|
+
pub const ShellPrimaryAction = app_manifest.ShellPrimaryAction;
|
|
96
|
+
pub const ShellChrome = app_manifest.ShellChrome;
|
|
97
|
+
|
|
98
|
+
pub const WebViewSource = platform.WebViewSource;
|
|
99
|
+
pub const WebViewSourceKind = platform.WebViewSourceKind;
|
|
100
|
+
pub const WebViewAssetSource = platform.WebViewAssetSource;
|
|
101
|
+
pub const WebEngine = platform.WebEngine;
|
|
102
|
+
pub const PlatformFeature = platform.PlatformFeature;
|
|
103
|
+
pub const ViewKind = platform.ViewKind;
|
|
104
|
+
pub const ViewOptions = platform.ViewOptions;
|
|
105
|
+
pub const ViewPatch = platform.ViewPatch;
|
|
106
|
+
pub const ViewInfo = platform.ViewInfo;
|
|
107
|
+
pub const GpuFrame = platform.GpuFrame;
|
|
108
|
+
pub const GpuSurfaceOptions = platform.GpuSurfaceOptions;
|
|
109
|
+
pub const GpuSurfaceBackend = platform.GpuSurfaceBackend;
|
|
110
|
+
pub const GpuSurfacePixelFormat = platform.GpuSurfacePixelFormat;
|
|
111
|
+
pub const GpuSurfacePresentMode = platform.GpuSurfacePresentMode;
|
|
112
|
+
pub const GpuSurfaceAlphaMode = platform.GpuSurfaceAlphaMode;
|
|
113
|
+
pub const GpuSurfaceColorSpace = platform.GpuSurfaceColorSpace;
|
|
114
|
+
pub const GpuSurfaceStatus = platform.GpuSurfaceStatus;
|
|
115
|
+
pub const CanvasFrameProfileRisk = platform.CanvasFrameProfileRisk;
|
|
116
|
+
pub const AppInfo = platform.AppInfo;
|
|
117
|
+
pub const Platform = platform.Platform;
|
|
118
|
+
pub const NullPlatform = platform.NullPlatform;
|
|
119
|
+
pub const WindowId = platform.WindowId;
|
|
120
|
+
pub const WindowOptions = platform.WindowOptions;
|
|
121
|
+
pub const WindowCreateOptions = platform.WindowCreateOptions;
|
|
122
|
+
pub const WindowInfo = platform.WindowInfo;
|
|
123
|
+
pub const WindowState = platform.WindowState;
|
|
124
|
+
pub const WindowRestorePolicy = platform.WindowRestorePolicy;
|
|
125
|
+
pub const WindowTitlebarStyle = platform.WindowTitlebarStyle;
|
|
126
|
+
pub const WindowChrome = platform.WindowChrome;
|
|
127
|
+
pub const FormFactor = platform.FormFactor;
|
|
128
|
+
pub const WindowDragRegion = platform.WindowDragRegion;
|
|
129
|
+
pub const WindowShowMode = platform.WindowShowMode;
|
|
130
|
+
pub const Menu = platform.Menu;
|
|
131
|
+
pub const MenuItem = platform.MenuItem;
|
|
132
|
+
pub const Shortcut = platform.Shortcut;
|
|
133
|
+
pub const ShortcutModifiers = platform.ShortcutModifiers;
|
|
134
|
+
pub const ShortcutEvent = platform.ShortcutEvent;
|
|
135
|
+
pub const TimerEvent = platform.TimerEvent;
|
|
136
|
+
pub const reserved_timer_id_base = platform.reserved_timer_id_base;
|
|
137
|
+
pub const ColorScheme = platform.ColorScheme;
|
|
138
|
+
pub const Appearance = platform.Appearance;
|
|
139
|
+
pub const GpuSurfaceFrameEvent = platform.GpuSurfaceFrameEvent;
|
|
140
|
+
pub const GpuSurfaceResizeEvent = platform.GpuSurfaceResizeEvent;
|
|
141
|
+
pub const GpuSurfaceInputKind = platform.GpuSurfaceInputKind;
|
|
142
|
+
pub const GpuSurfaceInputEvent = platform.GpuSurfaceInputEvent;
|
|
143
|
+
pub const FileFilter = platform.FileFilter;
|
|
144
|
+
pub const OpenDialogOptions = platform.OpenDialogOptions;
|
|
145
|
+
pub const OpenDialogResult = platform.OpenDialogResult;
|
|
146
|
+
pub const SaveDialogOptions = platform.SaveDialogOptions;
|
|
147
|
+
pub const MessageDialogStyle = platform.MessageDialogStyle;
|
|
148
|
+
pub const MessageDialogResult = platform.MessageDialogResult;
|
|
149
|
+
pub const MessageDialogOptions = platform.MessageDialogOptions;
|
|
150
|
+
pub const TrayItemId = platform.TrayItemId;
|
|
151
|
+
pub const TrayOptions = platform.TrayOptions;
|
|
152
|
+
pub const TrayMenuItem = platform.TrayMenuItem;
|
|
153
|
+
pub const BridgeDispatcher = bridge.Dispatcher;
|
|
154
|
+
pub const BridgePolicy = bridge.Policy;
|
|
155
|
+
pub const BridgeCommandPolicy = bridge.CommandPolicy;
|
|
156
|
+
pub const BridgeHandler = bridge.Handler;
|
|
157
|
+
pub const BridgeRegistry = bridge.Registry;
|
|
158
|
+
pub const SecurityPolicy = security.Policy;
|
|
159
|
+
pub const NavigationPolicy = security.NavigationPolicy;
|
|
160
|
+
pub const ExternalLinkPolicy = security.ExternalLinkPolicy;
|
|
161
|
+
pub const ExternalLinkAction = security.ExternalLinkAction;
|
|
162
|
+
|
|
163
|
+
test {
|
|
164
|
+
@import("std").testing.refAllDecls(@This());
|
|
165
|
+
}
|
|
@@ -0,0 +1,431 @@
|
|
|
1
|
+
const std = @import("std");
|
|
2
|
+
const trace = @import("trace");
|
|
3
|
+
const canvas = @import("canvas");
|
|
4
|
+
const automation = @import("../automation/root.zig");
|
|
5
|
+
const bridge = @import("../bridge/root.zig");
|
|
6
|
+
const extensions = @import("../extensions/root.zig");
|
|
7
|
+
const app_manifest = @import("app_manifest");
|
|
8
|
+
const platform = @import("../platform/root.zig");
|
|
9
|
+
const runtime_effects = @import("effects.zig");
|
|
10
|
+
const runtime_session_record = @import("session_record.zig");
|
|
11
|
+
const runtime_view = @import("view.zig");
|
|
12
|
+
const security = @import("../security/root.zig");
|
|
13
|
+
const widget_bridge = @import("widget_bridge.zig");
|
|
14
|
+
const window_state = @import("../window_state/root.zig");
|
|
15
|
+
|
|
16
|
+
pub const LifecycleEvent = enum {
|
|
17
|
+
start,
|
|
18
|
+
activate,
|
|
19
|
+
deactivate,
|
|
20
|
+
frame,
|
|
21
|
+
stop,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
pub const CommandEvent = struct {
|
|
25
|
+
name: []const u8,
|
|
26
|
+
source: CommandSource = .runtime,
|
|
27
|
+
window_id: platform.WindowId = 0,
|
|
28
|
+
view_label: []const u8 = "",
|
|
29
|
+
tray_item_id: platform.TrayItemId = 0,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
pub const Command = app_manifest.Command;
|
|
33
|
+
|
|
34
|
+
pub const CommandSource = enum {
|
|
35
|
+
runtime,
|
|
36
|
+
menu,
|
|
37
|
+
shortcut,
|
|
38
|
+
toolbar,
|
|
39
|
+
tray,
|
|
40
|
+
native_view,
|
|
41
|
+
bridge,
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
pub const ShortcutEvent = platform.ShortcutEvent;
|
|
45
|
+
pub const TimerEvent = platform.TimerEvent;
|
|
46
|
+
pub const Appearance = platform.Appearance;
|
|
47
|
+
pub const GpuFrame = platform.GpuFrame;
|
|
48
|
+
pub const GpuSurfaceFrameEvent = platform.GpuSurfaceFrameEvent;
|
|
49
|
+
pub const GpuSurfaceResizeEvent = platform.GpuSurfaceResizeEvent;
|
|
50
|
+
pub const GpuSurfaceInputEvent = platform.GpuSurfaceInputEvent;
|
|
51
|
+
|
|
52
|
+
pub const CanvasWidgetPointerEvent = struct {
|
|
53
|
+
window_id: platform.WindowId = 1,
|
|
54
|
+
view_label: []const u8,
|
|
55
|
+
pointer: canvas.WidgetPointerEvent,
|
|
56
|
+
target: ?canvas.WidgetHit = null,
|
|
57
|
+
/// Where a press on `target` actually lands: the deepest widget on the
|
|
58
|
+
/// hit path that claims presses — equal to `target` for interactive
|
|
59
|
+
/// widgets, the nearest pressable ancestor when the raw hit is plain
|
|
60
|
+
/// text/decoration, and null when nothing on the path is pressable OR
|
|
61
|
+
/// when this `.up` ended a text-selection drag (dragging selects,
|
|
62
|
+
/// clicking presses). Press-family dispatch (typed `on_press`, engine
|
|
63
|
+
/// `command`s, control activation) resolves through this; hover,
|
|
64
|
+
/// cursor, and text selection stay on `target`.
|
|
65
|
+
press_target: ?canvas.WidgetHit = null,
|
|
66
|
+
route: []const canvas.WidgetEventRouteEntry = &.{},
|
|
67
|
+
/// A text edit this pointer gesture performed on `target` (the
|
|
68
|
+
/// search field's built-in clear affordance). The runtime already
|
|
69
|
+
/// applied it (the optimistic echo; the source tree is truth on the
|
|
70
|
+
/// next rebuild); `UiApp` maps it through the tree's handler table
|
|
71
|
+
/// to the field's `on_input` Msg so a model-owned buffer clears too.
|
|
72
|
+
edit: ?canvas.TextInputEvent = null,
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
pub const CanvasWidgetKeyboardEvent = struct {
|
|
76
|
+
window_id: platform.WindowId = 1,
|
|
77
|
+
view_label: []const u8,
|
|
78
|
+
keyboard: canvas.WidgetKeyboardEvent,
|
|
79
|
+
target: ?canvas.WidgetFocusTarget = null,
|
|
80
|
+
route: []const canvas.WidgetEventRouteEntry = &.{},
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
/// A scroll container's offset changed from a user gesture (wheel,
|
|
84
|
+
/// kinetic momentum steps, keyboard, or an accessibility scroll action).
|
|
85
|
+
/// `scroll` is the post-change state — offset, viewport and content
|
|
86
|
+
/// extents (`maxOffset()` derives the range) — read at dispatch time, so
|
|
87
|
+
/// rapid motion coalesces into the latest state per node. Programmatic
|
|
88
|
+
/// source-tree offset changes do not emit this event: the model already
|
|
89
|
+
/// knows those.
|
|
90
|
+
pub const CanvasWidgetScrollEvent = struct {
|
|
91
|
+
window_id: platform.WindowId = 1,
|
|
92
|
+
view_label: []const u8,
|
|
93
|
+
/// The scroll container's structural widget id.
|
|
94
|
+
id: canvas.ObjectId,
|
|
95
|
+
scroll: canvas.ScrollState,
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
pub const CanvasWidgetDisplayListChrome = runtime_view.CanvasWidgetDisplayListChrome;
|
|
99
|
+
|
|
100
|
+
pub const CanvasPresentationMode = enum {
|
|
101
|
+
skipped,
|
|
102
|
+
gpu_packet,
|
|
103
|
+
pixels,
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
pub const CanvasPresentationResult = struct {
|
|
107
|
+
frame: canvas.CanvasFrame,
|
|
108
|
+
mode: CanvasPresentationMode = .skipped,
|
|
109
|
+
packet_command_count: usize = 0,
|
|
110
|
+
packet_cache_action_count: usize = 0,
|
|
111
|
+
packet_cached_resource_command_count: usize = 0,
|
|
112
|
+
packet_unsupported_command_count: usize = 0,
|
|
113
|
+
packet_representable: bool = true,
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
pub const CanvasWidgetAccessibilityActionKind = widget_bridge.CanvasWidgetAccessibilityActionKind;
|
|
117
|
+
pub const CanvasWidgetAccessibilityAction = widget_bridge.CanvasWidgetAccessibilityAction;
|
|
118
|
+
|
|
119
|
+
pub const CanvasWidgetFileDropEvent = struct {
|
|
120
|
+
window_id: platform.WindowId = 1,
|
|
121
|
+
view_label: []const u8,
|
|
122
|
+
drop: canvas.WidgetFileDropEvent,
|
|
123
|
+
target: ?canvas.WidgetHit = null,
|
|
124
|
+
route: []const canvas.WidgetEventRouteEntry = &.{},
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
pub const CanvasWidgetDragEvent = struct {
|
|
128
|
+
window_id: platform.WindowId = 1,
|
|
129
|
+
view_label: []const u8,
|
|
130
|
+
drag: canvas.WidgetDragEvent,
|
|
131
|
+
source: ?canvas.WidgetHit = null,
|
|
132
|
+
route: []const canvas.WidgetEventRouteEntry = &.{},
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
/// A dismissible floating surface (dialog, drawer, sheet, popover,
|
|
136
|
+
/// menu-surface, dropdown-menu) was dismissed by a user gesture — Escape,
|
|
137
|
+
/// a pointer press outside it, or an automation/accessibility dismiss
|
|
138
|
+
/// action. The runtime hides the surface immediately (the optimistic
|
|
139
|
+
/// echo; the source tree is truth on the next rebuild) and delivers this
|
|
140
|
+
/// event so a TEA model can OWN the close: `UiApp` maps it through the
|
|
141
|
+
/// tree's handler table to the surface's `on_dismiss` Msg.
|
|
142
|
+
pub const CanvasWidgetDismissEvent = struct {
|
|
143
|
+
window_id: platform.WindowId = 1,
|
|
144
|
+
view_label: []const u8,
|
|
145
|
+
/// The dismissed surface's structural widget id.
|
|
146
|
+
id: canvas.ObjectId,
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
/// A split container's fraction changed from a user resize — divider
|
|
150
|
+
/// drag, keyboard adjustment on the focused divider, or an assistive
|
|
151
|
+
/// increment/decrement. The runtime already applied the fraction (the
|
|
152
|
+
/// optimistic echo; the source tree is truth on the next rebuild) and
|
|
153
|
+
/// delivers this event so a TEA model can OWN it: `UiApp` maps it
|
|
154
|
+
/// through the tree's handler table to the split's `on_resize` Msg.
|
|
155
|
+
pub const CanvasWidgetResizeEvent = struct {
|
|
156
|
+
window_id: platform.WindowId = 1,
|
|
157
|
+
view_label: []const u8,
|
|
158
|
+
/// The split container's structural widget id.
|
|
159
|
+
id: canvas.ObjectId,
|
|
160
|
+
/// The applied first-pane fraction (already clamped against the
|
|
161
|
+
/// panes' min widths).
|
|
162
|
+
fraction: f32,
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
/// A slider's value changed from a pointer gesture — a click on the rail
|
|
166
|
+
/// (the thumb jumps to the pressed point) or a scrubbing drag. The
|
|
167
|
+
/// runtime already applied the value (the optimistic echo; the source
|
|
168
|
+
/// tree is truth on the next rebuild) and delivers this event so a TEA
|
|
169
|
+
/// model can OWN it: `UiApp` maps it through the tree's handler table to
|
|
170
|
+
/// the slider's `on_value`/`on_change` Msg. Keyboard steps and assistive
|
|
171
|
+
/// increment/decrement do not emit this event — they already dispatch
|
|
172
|
+
/// through the keyboard path (`msgForKeyboard`).
|
|
173
|
+
pub const CanvasWidgetChangeEvent = struct {
|
|
174
|
+
window_id: platform.WindowId = 1,
|
|
175
|
+
view_label: []const u8,
|
|
176
|
+
/// The slider's structural widget id.
|
|
177
|
+
id: canvas.ObjectId,
|
|
178
|
+
/// The applied value (already clamped to 0...1).
|
|
179
|
+
value: f32,
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
/// A secondary-button press (right/ctrl-click, touch long-press) whose
|
|
183
|
+
/// route offered NO context menu — no app-declared items, no editable or
|
|
184
|
+
/// selected-text default. Delivered with the resolved press target so
|
|
185
|
+
/// `UiApp` can treat it as the press-and-hold alternative: the target's
|
|
186
|
+
/// `on_hold` Msg dispatches immediately. Widgets with a declared context
|
|
187
|
+
/// menu never see this — the native menu wins.
|
|
188
|
+
pub const CanvasWidgetContextPressEvent = struct {
|
|
189
|
+
window_id: platform.WindowId = 1,
|
|
190
|
+
view_label: []const u8,
|
|
191
|
+
/// The deepest press-claiming widget on the hit route (the same
|
|
192
|
+
/// resolution primary presses use).
|
|
193
|
+
press_target: ?canvas.WidgetHit = null,
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
/// The user selected an item from a widget's app-declared native context
|
|
197
|
+
/// menu (`ElementOptions.context_menu`). `item_index` indexes the
|
|
198
|
+
/// widget's declared items; `UiApp` maps it to the item's `Msg` through
|
|
199
|
+
/// the tree's handler table (`Tree.msgForContextMenu`).
|
|
200
|
+
pub const CanvasWidgetContextMenuEvent = struct {
|
|
201
|
+
window_id: platform.WindowId = 1,
|
|
202
|
+
view_label: []const u8,
|
|
203
|
+
target_id: canvas.ObjectId,
|
|
204
|
+
item_index: usize,
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
/// A right/ctrl-click landed on a widget with a declared context menu,
|
|
208
|
+
/// but the platform could not present it natively (this host has no
|
|
209
|
+
/// native menu presenter, or presenting failed). The app loop answers by
|
|
210
|
+
/// presenting the SAME declared items as an anchored canvas surface —
|
|
211
|
+
/// one authored menu, platform-appropriate presentation.
|
|
212
|
+
pub const CanvasWidgetContextMenuRequestEvent = struct {
|
|
213
|
+
window_id: platform.WindowId = 1,
|
|
214
|
+
view_label: []const u8,
|
|
215
|
+
target_id: canvas.ObjectId,
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
/// A window the RUNTIME knew as open was closed by the platform — the
|
|
219
|
+
/// user clicked its close button (or the host tore it down). Never
|
|
220
|
+
/// emitted for `runtime.closeWindow` calls the app itself made through
|
|
221
|
+
/// the reconcile path before the platform echo arrives with the window
|
|
222
|
+
/// already forgotten. The model owns the consequence, matching the
|
|
223
|
+
/// dismissal precedent: `UiApp` maps this to the declared window's
|
|
224
|
+
/// `on_close` Msg, and the next rebuild's declared window set is truth —
|
|
225
|
+
/// a model that keeps declaring the window gets it back.
|
|
226
|
+
pub const WindowClosedEvent = struct {
|
|
227
|
+
window_id: platform.WindowId,
|
|
228
|
+
/// The window's label from runtime storage (stable for the dispatch).
|
|
229
|
+
label: []const u8,
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
/// An automation `provenance` query for a live widget: the runtime has
|
|
233
|
+
/// already resolved the view and (for point queries) hit-tested the
|
|
234
|
+
/// widget id; the app that authored the view answers from its retained
|
|
235
|
+
/// provenance table and publishes the response through the automation
|
|
236
|
+
/// server. Slices are valid for the synchronous dispatch only.
|
|
237
|
+
pub const AutomationProvenanceEvent = struct {
|
|
238
|
+
window_id: platform.WindowId,
|
|
239
|
+
view_label: []const u8,
|
|
240
|
+
widget_id: u64,
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
pub const InvalidationReason = enum {
|
|
244
|
+
startup,
|
|
245
|
+
surface_resize,
|
|
246
|
+
command,
|
|
247
|
+
state,
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
pub const FrameDiagnostics = struct {
|
|
251
|
+
frame_index: u64 = 0,
|
|
252
|
+
command_count: usize = 0,
|
|
253
|
+
dirty_region_count: usize = 0,
|
|
254
|
+
resource_upload_count: usize = 0,
|
|
255
|
+
duration_ns: u64 = 0,
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
pub const Event = union(enum) {
|
|
259
|
+
lifecycle: LifecycleEvent,
|
|
260
|
+
appearance_changed: Appearance,
|
|
261
|
+
command: CommandEvent,
|
|
262
|
+
shortcut: ShortcutEvent,
|
|
263
|
+
timer: TimerEvent,
|
|
264
|
+
/// The platform loop was nudged from another thread
|
|
265
|
+
/// (`PlatformServices.wake_fn`): apps drain their effect completion
|
|
266
|
+
/// queues here, on the loop thread, and dispatch the resulting Msgs.
|
|
267
|
+
effects_wake,
|
|
268
|
+
/// A platform audio player report (load acknowledgment, position
|
|
269
|
+
/// tick, completion, failure): the ui-app layer routes it back
|
|
270
|
+
/// through `Effects.takeAudioMsg` into the app's `on_event` Msg.
|
|
271
|
+
audio: platform.AudioEvent,
|
|
272
|
+
files_dropped: platform.FileDropEvent,
|
|
273
|
+
gpu_surface_frame: GpuSurfaceFrameEvent,
|
|
274
|
+
gpu_surface_resized: GpuSurfaceResizeEvent,
|
|
275
|
+
gpu_surface_input: GpuSurfaceInputEvent,
|
|
276
|
+
canvas_widget_pointer: CanvasWidgetPointerEvent,
|
|
277
|
+
canvas_widget_keyboard: CanvasWidgetKeyboardEvent,
|
|
278
|
+
canvas_widget_scroll: CanvasWidgetScrollEvent,
|
|
279
|
+
canvas_widget_file_drop: CanvasWidgetFileDropEvent,
|
|
280
|
+
canvas_widget_drag: CanvasWidgetDragEvent,
|
|
281
|
+
canvas_widget_context_menu: CanvasWidgetContextMenuEvent,
|
|
282
|
+
canvas_widget_context_menu_request: CanvasWidgetContextMenuRequestEvent,
|
|
283
|
+
canvas_widget_dismiss: CanvasWidgetDismissEvent,
|
|
284
|
+
canvas_widget_context_press: CanvasWidgetContextPressEvent,
|
|
285
|
+
canvas_widget_resize: CanvasWidgetResizeEvent,
|
|
286
|
+
canvas_widget_change: CanvasWidgetChangeEvent,
|
|
287
|
+
window_closed: WindowClosedEvent,
|
|
288
|
+
automation_provenance: AutomationProvenanceEvent,
|
|
289
|
+
|
|
290
|
+
pub fn name(self: Event) []const u8 {
|
|
291
|
+
return switch (self) {
|
|
292
|
+
.lifecycle => |event_value| @tagName(event_value),
|
|
293
|
+
.appearance_changed => "appearance_changed",
|
|
294
|
+
.command => |event_value| event_value.name,
|
|
295
|
+
.shortcut => "shortcut",
|
|
296
|
+
.timer => "timer",
|
|
297
|
+
.effects_wake => "effects_wake",
|
|
298
|
+
.audio => "audio",
|
|
299
|
+
.files_dropped => "files_dropped",
|
|
300
|
+
.gpu_surface_frame => "gpu_surface_frame",
|
|
301
|
+
.gpu_surface_resized => "gpu_surface_resized",
|
|
302
|
+
.gpu_surface_input => "gpu_surface_input",
|
|
303
|
+
.canvas_widget_pointer => "canvas_widget_pointer",
|
|
304
|
+
.canvas_widget_keyboard => "canvas_widget_keyboard",
|
|
305
|
+
.canvas_widget_scroll => "canvas_widget_scroll",
|
|
306
|
+
.canvas_widget_file_drop => "canvas_widget_file_drop",
|
|
307
|
+
.canvas_widget_drag => "canvas_widget_drag",
|
|
308
|
+
.canvas_widget_context_menu => "canvas_widget_context_menu",
|
|
309
|
+
.canvas_widget_context_menu_request => "canvas_widget_context_menu_request",
|
|
310
|
+
.canvas_widget_dismiss => "canvas_widget_dismiss",
|
|
311
|
+
.canvas_widget_context_press => "canvas_widget_context_press",
|
|
312
|
+
.canvas_widget_resize => "canvas_widget_resize",
|
|
313
|
+
.canvas_widget_change => "canvas_widget_change",
|
|
314
|
+
.window_closed => "window_closed",
|
|
315
|
+
.automation_provenance => "automation_provenance",
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
/// Session-replay control, type-erased over the app's Msg union so the
|
|
321
|
+
/// replay driver can steer any app through its `App` value: `.arm`
|
|
322
|
+
/// switches the app's effects channel into replay mode (fake executor,
|
|
323
|
+
/// journaled results as the only terminal source) before the first
|
|
324
|
+
/// replayed event; `.feed` delivers one journaled effect result into
|
|
325
|
+
/// the stub executor's pending request with the matching key.
|
|
326
|
+
pub const ReplayControl = union(enum) {
|
|
327
|
+
arm,
|
|
328
|
+
feed: runtime_effects.EffectResultRecord,
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
pub fn App(comptime Runtime: type) type {
|
|
332
|
+
return struct {
|
|
333
|
+
const Self = @This();
|
|
334
|
+
const StartFn = *const fn (context: *anyopaque, runtime: *Runtime) anyerror!void;
|
|
335
|
+
const EventFn = *const fn (context: *anyopaque, runtime: *Runtime, event: Event) anyerror!void;
|
|
336
|
+
const SourceFn = *const fn (context: *anyopaque) anyerror!platform.WebViewSource;
|
|
337
|
+
const SceneFn = *const fn (context: *anyopaque) anyerror!app_manifest.ShellConfig;
|
|
338
|
+
const StopFn = *const fn (context: *anyopaque, runtime: *Runtime) anyerror!void;
|
|
339
|
+
const ReplayFn = *const fn (context: *anyopaque, control: ReplayControl) anyerror!void;
|
|
340
|
+
|
|
341
|
+
context: *anyopaque,
|
|
342
|
+
name: []const u8,
|
|
343
|
+
source: platform.WebViewSource = platform.WebViewSource.html(""),
|
|
344
|
+
source_fn: ?SourceFn = null,
|
|
345
|
+
scene_fn: ?SceneFn = null,
|
|
346
|
+
start_fn: ?StartFn = null,
|
|
347
|
+
event_fn: ?EventFn = null,
|
|
348
|
+
stop_fn: ?StopFn = null,
|
|
349
|
+
/// Session-replay hook (`UiApp` wires it automatically). Null
|
|
350
|
+
/// means the app cannot be replayed with effect stubbing —
|
|
351
|
+
/// replay refuses journals that carry effect results for it.
|
|
352
|
+
replay_fn: ?ReplayFn = null,
|
|
353
|
+
|
|
354
|
+
pub fn start(self: Self, runtime: *Runtime) anyerror!void {
|
|
355
|
+
if (self.start_fn) |start_fn| try start_fn(self.context, runtime);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
pub fn event(self: Self, runtime: *Runtime, event_value: Event) anyerror!void {
|
|
359
|
+
if (self.event_fn) |event_fn| try event_fn(self.context, runtime, event_value);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
pub fn webViewSource(self: Self) anyerror!platform.WebViewSource {
|
|
363
|
+
if (self.source_fn) |source_fn| return source_fn(self.context);
|
|
364
|
+
return self.source;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
pub fn scene(self: Self) anyerror!?app_manifest.ShellConfig {
|
|
368
|
+
if (self.scene_fn) |scene_fn| return try scene_fn(self.context);
|
|
369
|
+
return null;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
pub fn stop(self: Self, runtime: *Runtime) anyerror!void {
|
|
373
|
+
if (self.stop_fn) |stop_fn| try stop_fn(self.context, runtime);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
/// Steer the app's replay hook. `error.ReplayUnsupported` when
|
|
377
|
+
/// the app registered none.
|
|
378
|
+
pub fn replayControl(self: Self, control: ReplayControl) anyerror!void {
|
|
379
|
+
const replay_fn = self.replay_fn orelse return error.ReplayUnsupported;
|
|
380
|
+
try replay_fn(self.context, control);
|
|
381
|
+
}
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
pub const Options = struct {
|
|
386
|
+
platform: platform.Platform,
|
|
387
|
+
trace_sink: ?trace.Sink = null,
|
|
388
|
+
log_path: ?[]const u8 = null,
|
|
389
|
+
extensions: ?extensions.ModuleRegistry = null,
|
|
390
|
+
bridge: ?bridge.Dispatcher = null,
|
|
391
|
+
builtin_bridge: bridge.Policy = .{},
|
|
392
|
+
security: security.Policy = .{},
|
|
393
|
+
commands: []const Command = &.{},
|
|
394
|
+
menus: []const platform.Menu = &.{},
|
|
395
|
+
shortcuts: []const platform.Shortcut = &.{},
|
|
396
|
+
automation: ?automation.Server = null,
|
|
397
|
+
window_state_store: ?window_state.Store = null,
|
|
398
|
+
js_window_api: bool = false,
|
|
399
|
+
gpu_surface_frame_diagnostics: bool = true,
|
|
400
|
+
/// Pixels-only presentation hosts (the mobile embed host) opt in to
|
|
401
|
+
/// keeping the view's keyed command mirror alive across PIXEL
|
|
402
|
+
/// presents: the mirror then describes what the presented pixel
|
|
403
|
+
/// buffer shows, so the next frame's dirty bounds refine to the
|
|
404
|
+
/// commands that actually changed (a keystroke repaints the field,
|
|
405
|
+
/// not the window) instead of degrading to the summary union on
|
|
406
|
+
/// every Msg rebuild. Must stay false on any platform that wires a
|
|
407
|
+
/// gpu-surface packet presenter — a later packet patch would target
|
|
408
|
+
/// a dictionary the host never adopted (the patch gate additionally
|
|
409
|
+
/// refuses pixel-adopted baselines as defense in depth).
|
|
410
|
+
pixel_present_retained_baseline: bool = false,
|
|
411
|
+
/// Optional render memo for the CPU pixel present path (see
|
|
412
|
+
/// `canvas.ReferenceRenderMemo`): pixels-only hosts that re-render
|
|
413
|
+
/// the retained scene every changed frame attach one so heavyweight
|
|
414
|
+
/// per-pixel commands replay their stored output and scaled image
|
|
415
|
+
/// draws blend from scale-once panels. Purely an optimization —
|
|
416
|
+
/// output bytes are identical with or without it. Must outlive the
|
|
417
|
+
/// runtime; null (the default) changes nothing.
|
|
418
|
+
pixel_present_render_memo: ?*canvas.ReferenceRenderMemo = null,
|
|
419
|
+
/// The process environment spawned effect children inherit (the app
|
|
420
|
+
/// runner threads it through from `std.process.Init`). `null` lets
|
|
421
|
+
/// the effect system resolve a fallback for hosts without a process
|
|
422
|
+
/// `Init` (embed/mobile): the libc/PEB environment where available,
|
|
423
|
+
/// `.empty` otherwise.
|
|
424
|
+
environ: ?std.process.Environ = null,
|
|
425
|
+
/// Session recorder (record/replay): when set, the dispatch choke
|
|
426
|
+
/// point journals every platform event, the effects channel journals
|
|
427
|
+
/// every drained result, and each published frame appends a state
|
|
428
|
+
/// fingerprint checkpoint. The app runner arms this from
|
|
429
|
+
/// `NATIVE_SDK_SESSION_RECORD=<path>`.
|
|
430
|
+
session_recorder: ?*runtime_session_record.SessionRecorder = null,
|
|
431
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
const bridge = @import("../bridge/root.zig");
|
|
2
|
+
const platform = @import("../platform/root.zig");
|
|
3
|
+
|
|
4
|
+
pub const max_async_bridge_responses: usize = 64;
|
|
5
|
+
pub const max_bridge_origin_bytes: usize = 512;
|
|
6
|
+
|
|
7
|
+
pub fn AsyncBridgeResponseSlot(comptime Runtime: type) type {
|
|
8
|
+
return struct {
|
|
9
|
+
const Self = @This();
|
|
10
|
+
|
|
11
|
+
in_use: bool = false,
|
|
12
|
+
runtime: ?*Runtime = null,
|
|
13
|
+
source: bridge.Source = .{},
|
|
14
|
+
origin_storage: [max_bridge_origin_bytes]u8 = undefined,
|
|
15
|
+
webview_label_storage: [platform.max_webview_label_bytes]u8 = undefined,
|
|
16
|
+
|
|
17
|
+
pub fn init(self: *Self, runtime: *Runtime, source: bridge.Source) !void {
|
|
18
|
+
if (source.origin.len > self.origin_storage.len) return error.BridgeOriginTooLarge;
|
|
19
|
+
if (source.webview_label.len > self.webview_label_storage.len) return error.WebViewLabelTooLarge;
|
|
20
|
+
self.runtime = runtime;
|
|
21
|
+
self.source = .{
|
|
22
|
+
.origin = try copyInto(&self.origin_storage, source.origin),
|
|
23
|
+
.window_id = source.window_id,
|
|
24
|
+
.webview_label = try copyInto(&self.webview_label_storage, source.webview_label),
|
|
25
|
+
};
|
|
26
|
+
self.in_use = true;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
pub fn release(self: *Self) void {
|
|
30
|
+
self.in_use = false;
|
|
31
|
+
self.runtime = null;
|
|
32
|
+
self.source = .{};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
pub fn respond(self: *Self, response: []const u8) anyerror!void {
|
|
36
|
+
if (!self.in_use) return error.AsyncBridgeResponseAlreadyCompleted;
|
|
37
|
+
const runtime = self.runtime orelse return error.AsyncBridgeResponseAlreadyCompleted;
|
|
38
|
+
const source = self.source;
|
|
39
|
+
defer self.release();
|
|
40
|
+
try runtime.respondToBridge(source, response);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
fn copyInto(buffer: []u8, value: []const u8) ![]const u8 {
|
|
46
|
+
if (value.len > buffer.len) return error.NoSpaceLeft;
|
|
47
|
+
@memcpy(buffer[0..value.len], value);
|
|
48
|
+
return buffer[0..value.len];
|
|
49
|
+
}
|