@native-sdk/cli 0.9.0 → 0.9.2
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/build/app.zig +357 -33
- package/build.zig +234 -11
- package/native-sdk.d.ts +8 -0
- package/package.json +10 -10
- package/packages/core/compile-surface/core.ts +70 -1
- package/packages/core/package-lock.json +11 -11
- package/packages/core/package.json +2 -2
- package/packages/core/scripts/merge_static_archives.mjs +78 -0
- package/packages/core/scripts/run_external_core_compiler.mjs +52 -7
- package/packages/core/scripts/run_external_service_compiler.mjs +53 -13
- package/packages/core/scripts/stage_external_services.mjs +1 -1
- package/packages/core/sdk/core.d.ts +75 -0
- package/packages/core/sdk/core.ts +170 -13
- package/packages/core/sdk/events.d.ts +53 -0
- package/packages/core/sdk/events.ts +78 -7
- package/packages/core/src/checker.ts +470 -2
- package/packages/core/src/cli.ts +13 -0
- package/packages/core/src/contract.ts +3 -1
- package/packages/core/src/devhost.ts +30 -1
- package/packages/core/src/devhost_journal.mjs +10 -8
- package/packages/core/src/diagnostics.ts +99 -8
- package/packages/core/src/frontend.ts +6 -0
- package/packages/core/src/infer.ts +24 -0
- package/skill-data/automation/SKILL.md +1 -1
- package/skill-data/native-ui/SKILL.md +18 -12
- package/skill-data/ts-core/SKILL.md +54 -21
- package/skill-data/ts-services/SKILL.md +4 -4
- package/skill-data/ts-services/references/service-surface.md +2 -1
- package/skill-data/zig/SKILL.md +1 -1
- package/src/app_runner/root.zig +122 -6
- package/src/app_runner/ts_core_main.zig +9 -4
- package/src/app_runner/ts_core_mobile.zig +241 -0
- package/src/app_runner/window_placement.zig +63 -0
- package/src/automation/protocol.zig +5 -1
- package/src/automation/snapshot.zig +8 -6
- package/src/embed/app_exports.zig +3 -1
- package/src/embed/conversions.zig +1 -0
- package/src/embed/host.zig +10 -3
- package/src/embed/root.zig +2 -0
- package/src/embed/tests.zig +41 -1
- package/src/embed/types.zig +2 -0
- package/src/embed/ui_host.zig +94 -4
- package/src/platform/android/NativeSdkActivity.java +49 -4
- package/src/platform/android/android_host.c +3 -3
- package/src/platform/android/native_sdk_app.h +1 -1
- package/src/platform/ios/apple_image_fit.h +38 -0
- package/src/platform/ios/files.zig +1 -0
- package/src/platform/ios/native_sdk_app.h +1 -1
- package/src/platform/ios/uikit_host.m +28 -5
- package/src/platform/linux/cef_host.cpp +17 -3
- package/src/platform/linux/gtk_host.c +243 -15
- package/src/platform/linux/gtk_host.h +5 -4
- package/src/platform/linux/root.zig +91 -11
- package/src/platform/macos/appkit_host.h +18 -11
- package/src/platform/macos/appkit_host.m +402 -128
- package/src/platform/macos/cef_host.mm +342 -122
- package/src/platform/macos/image_fit_test.m +44 -0
- package/src/platform/macos/root.zig +231 -39
- package/src/platform/null_platform.zig +251 -54
- package/src/platform/null_platform_tests.zig +97 -4
- package/src/platform/root.zig +12 -0
- package/src/platform/types.zig +174 -35
- package/src/platform/windows/root.zig +42 -13
- package/src/platform/windows/webview2_host.cpp +72 -11
- package/src/primitives/app_manifest/root.zig +3 -0
- package/src/primitives/app_manifest/tests.zig +24 -0
- package/src/primitives/app_manifest/types.zig +13 -0
- package/src/primitives/app_manifest/validation.zig +24 -0
- package/src/primitives/canvas/a11y_audit.zig +9 -7
- package/src/primitives/canvas/a11y_audit_tests.zig +24 -0
- package/src/primitives/canvas/events.zig +50 -0
- package/src/primitives/canvas/layout_audit.zig +6 -6
- package/src/primitives/canvas/markdown.zig +4 -0
- package/src/primitives/canvas/markdown_tests.zig +1 -0
- package/src/primitives/canvas/png.zig +138 -0
- package/src/primitives/canvas/root.zig +13 -2
- package/src/primitives/canvas/text_span_tests.zig +5 -3
- package/src/primitives/canvas/text_spans.zig +2 -0
- package/src/primitives/canvas/text_tests.zig +20 -0
- package/src/primitives/canvas/ui.zig +55 -2
- package/src/primitives/canvas/ui_markup.zig +40 -13
- package/src/primitives/canvas/ui_markup_binary.zig +8 -6
- package/src/primitives/canvas/ui_markup_binary_tests.zig +14 -4
- package/src/primitives/canvas/ui_markup_compiled.zig +5 -1
- package/src/primitives/canvas/ui_markup_compiled_tests.zig +52 -0
- package/src/primitives/canvas/ui_markup_tests.zig +11 -2
- package/src/primitives/canvas/ui_markup_view.zig +8 -2
- package/src/primitives/canvas/ui_markup_view_tests.zig +49 -4
- package/src/primitives/canvas/ui_schema.zig +17 -13
- package/src/primitives/canvas/ui_tests.zig +47 -0
- package/src/primitives/canvas/widget_access.zig +3 -3
- package/src/primitives/canvas/widget_anchored_tests.zig +106 -0
- package/src/primitives/canvas/widget_builtin_tests.zig +580 -32
- package/src/primitives/canvas/widget_invalidation.zig +33 -6
- package/src/primitives/canvas/widget_layout.zig +333 -126
- package/src/primitives/canvas/widget_layout_tests.zig +169 -0
- package/src/primitives/canvas/widget_metrics.zig +7 -8
- package/src/primitives/canvas/widget_render.zig +76 -44
- package/src/primitives/canvas/widget_render_controls.zig +110 -32
- package/src/primitives/canvas/widget_render_style.zig +58 -18
- package/src/primitives/canvas/widget_render_surfaces.zig +45 -14
- package/src/primitives/canvas/widget_routing.zig +40 -34
- package/src/primitives/canvas/widget_runtime.zig +11 -2
- package/src/primitives/canvas/widget_runtime_tests.zig +10 -14
- package/src/primitives/canvas/widget_semantics.zig +8 -3
- package/src/primitives/canvas/widget_semantics_tests.zig +6 -2
- package/src/primitives/canvas/widget_tree.zig +99 -5
- package/src/primitives/canvas/widgets.zig +20 -7
- package/src/root.zig +10 -0
- package/src/runtime/api.zig +14 -0
- package/src/runtime/automation_commands.zig +35 -2
- package/src/runtime/automation_snapshot.zig +32 -24
- package/src/runtime/automation_widget_dispatch.zig +48 -6
- package/src/runtime/bridge_permission_tests.zig +35 -1
- package/src/runtime/bridge_responses.zig +1 -1
- package/src/runtime/builtin_bridge.zig +16 -3
- package/src/runtime/canvas_frame_packet_tests.zig +22 -13
- package/src/runtime/canvas_image_tests.zig +146 -2
- package/src/runtime/canvas_images.zig +35 -16
- package/src/runtime/canvas_limits.zig +13 -3
- package/src/runtime/canvas_widget_accessibility_tests.zig +279 -4
- package/src/runtime/canvas_widget_anchored_tests.zig +54 -0
- package/src/runtime/canvas_widget_control_tests.zig +31 -1
- package/src/runtime/canvas_widget_events.zig +151 -26
- package/src/runtime/canvas_widget_floating_tests.zig +48 -0
- package/src/runtime/canvas_widget_runtime.zig +322 -102
- package/src/runtime/canvas_widget_scroll_driver_tests.zig +34 -0
- package/src/runtime/canvas_widget_scroll_drivers.zig +12 -10
- package/src/runtime/canvas_widget_scroll_tests.zig +193 -2
- package/src/runtime/canvas_widget_semantics_tests.zig +337 -3
- package/src/runtime/canvas_widget_split_tree_tests.zig +55 -0
- package/src/runtime/canvas_widget_state.zig +33 -7
- package/src/runtime/core.zig +28 -6
- package/src/runtime/effects.zig +1337 -49
- package/src/runtime/effects_file_tests.zig +587 -0
- package/src/runtime/effects_image_tests.zig +91 -0
- package/src/runtime/effects_notification_tests.zig +11 -0
- package/src/runtime/file_access.zig +400 -0
- package/src/runtime/file_effect_crash_helper.zig +28 -0
- package/src/runtime/file_effect_crash_tests.zig +37 -0
- package/src/runtime/flow.zig +21 -9
- package/src/runtime/gpu_surface_events.zig +25 -2
- package/src/runtime/native_command_event_tests.zig +44 -2
- package/src/runtime/pty.zig +5 -2
- package/src/runtime/root.zig +7 -0
- package/src/runtime/session_blobs.zig +4 -1
- package/src/runtime/session_journal.zig +56 -5
- package/src/runtime/session_record.zig +38 -0
- package/src/runtime/session_replay.zig +110 -15
- package/src/runtime/session_tests.zig +192 -4
- package/src/runtime/shell_layout_tests.zig +12 -0
- package/src/runtime/state.zig +10 -0
- package/src/runtime/system_services.zig +129 -36
- package/src/runtime/ts_core_host.zig +281 -11
- package/src/runtime/ts_core_host_tests.zig +142 -1
- package/src/runtime/ts_ui_app.zig +461 -8
- package/src/runtime/ui_app.zig +330 -112
- package/src/runtime/ui_app_tests.zig +251 -25
- package/src/runtime/ui_app_window_tests.zig +74 -8
- package/src/runtime/validation.zig +20 -0
- package/src/runtime/view.zig +3 -0
- package/src/runtime/view_widget_control.zig +18 -0
- package/src/runtime/view_widget_scroll.zig +112 -18
- package/src/runtime/view_widget_tree.zig +110 -13
- package/src/runtime/widget_bridge.zig +2 -0
- package/src/runtime/window_command_bridge_tests.zig +86 -0
- package/src/runtime/window_storage.zig +16 -1
- package/src/runtime/window_views.zig +1 -0
- package/src/tooling/ios.zig +3 -0
- package/src/tooling/manifest.zig +90 -2
- package/src/tooling/package.zig +67 -2
- package/src/tooling/raw_manifest.zig +10 -0
- package/src/tooling/templates.zig +156 -18
- package/src/tooling/ts_core.zig +83 -0
- package/src/tooling/web_engine.zig +1 -1
- package/tools/corewire/emit.zig +3 -3
- package/tools/corewire/emit_facade.zig +65 -5
- package/tools/corewire/emit_profile.zig +2 -2
- package/tools/corewire/emit_service.zig +2 -2
- package/tools/corewire/service_contract.zig +4 -4
- package/tools/corewire/sidecar.zig +4 -4
|
@@ -139,6 +139,7 @@ enum EventKind {
|
|
|
139
139
|
kContextMenuAction = 19,
|
|
140
140
|
kViewFocused = 20,
|
|
141
141
|
kTrayCommand = 21,
|
|
142
|
+
kNotificationCommand = 22,
|
|
142
143
|
};
|
|
143
144
|
|
|
144
145
|
constexpr uint32_t kShortcutModifierPrimary = 1u << 0;
|
|
@@ -718,6 +719,9 @@ struct Host {
|
|
|
718
719
|
int external_link_action = 0;
|
|
719
720
|
bool app_active = false;
|
|
720
721
|
bool notification_icon_added = false;
|
|
722
|
+
std::string notification_id;
|
|
723
|
+
std::string notification_action_label;
|
|
724
|
+
std::string notification_action_command;
|
|
721
725
|
bool tray_active = false;
|
|
722
726
|
AppTimer app_timers[kMaxAppTimers];
|
|
723
727
|
/* Last emitted appearance values; -1 = nothing emitted yet, so the
|
|
@@ -1593,6 +1597,22 @@ static bool emitStatusCommand(Host *host, HWND hwnd, const std::string &command)
|
|
|
1593
1597
|
return true;
|
|
1594
1598
|
}
|
|
1595
1599
|
|
|
1600
|
+
static bool emitNotificationCommand(Host *host, HWND hwnd) {
|
|
1601
|
+
if (!host || !host->callback || host->notification_action_command.empty()) return false;
|
|
1602
|
+
std::string command = host->notification_action_command;
|
|
1603
|
+
host->notification_id.clear();
|
|
1604
|
+
host->notification_action_label.clear();
|
|
1605
|
+
host->notification_action_command.clear();
|
|
1606
|
+
const Window *window = windowForHwnd(host, hwnd);
|
|
1607
|
+
WindowsEvent event = {};
|
|
1608
|
+
event.kind = kNotificationCommand;
|
|
1609
|
+
event.window_id = window ? window->id : 1;
|
|
1610
|
+
event.command_name = command.c_str();
|
|
1611
|
+
event.command_name_len = command.size();
|
|
1612
|
+
host->callback(host->callback_context, &event);
|
|
1613
|
+
return true;
|
|
1614
|
+
}
|
|
1615
|
+
|
|
1596
1616
|
static void showTrayMenu(Host *host, HWND hwnd) {
|
|
1597
1617
|
if (!host || !host->tray_active || !hwnd) return;
|
|
1598
1618
|
emitStatusCommand(host, hwnd, host->tray_open_command);
|
|
@@ -5095,7 +5115,7 @@ static const wchar_t *nativeSdkBridgeScript() {
|
|
|
5095
5115
|
});
|
|
5096
5116
|
var os=Object.freeze({
|
|
5097
5117
|
openUrl:function(value){var options=typeof value==='string'?{url:value}:(value||{});return invoke('native-sdk.os.openUrl',{url:ensureString(options.url,'url')});},
|
|
5098
|
-
showNotification:function(value){var options=typeof value==='string'?{title:value}:(value||{});var payload={title:ensureString(options.title,'title')};if(options.subtitle!=null){payload.subtitle=ensureString(options.subtitle,'subtitle');}if(options.body!=null){payload.body=ensureString(options.body,'body');}return invoke('native-sdk.os.showNotification',payload);},
|
|
5118
|
+
showNotification:function(value){var options=typeof value==='string'?{title:value}:(value||{});var payload={title:ensureString(options.title,'title')};if(options.id!=null){payload.id=ensureString(options.id,'id');}if(options.subtitle!=null){payload.subtitle=ensureString(options.subtitle,'subtitle');}if(options.body!=null){payload.body=ensureString(options.body,'body');}if(options.actionLabel!=null){payload.actionLabel=ensureString(options.actionLabel,'actionLabel');}if(options.actionCommand!=null){payload.actionCommand=ensureString(options.actionCommand,'actionCommand');}return invoke('native-sdk.os.showNotification',payload);},
|
|
5099
5119
|
revealPath:function(value){var options=typeof value==='string'?{path:value}:(value||{});return invoke('native-sdk.os.revealPath',{path:ensureString(options.path,'path')});},
|
|
5100
5120
|
addRecentDocument:function(value){var options=typeof value==='string'?{path:value}:(value||{});return invoke('native-sdk.os.addRecentDocument',{path:ensureString(options.path,'path')});},
|
|
5101
5121
|
clearRecentDocuments:function(){return invoke('native-sdk.os.clearRecentDocuments',{});}
|
|
@@ -5688,8 +5708,12 @@ static LRESULT CALLBACK windowProc(HWND hwnd, UINT message, WPARAM wparam, LPARA
|
|
|
5688
5708
|
if (host) showAppContextMenu(host, hwnd);
|
|
5689
5709
|
return 0;
|
|
5690
5710
|
case kNotificationCallbackMessage:
|
|
5691
|
-
if (host
|
|
5711
|
+
if (host) {
|
|
5692
5712
|
UINT tray_event = LOWORD(lparam);
|
|
5713
|
+
if (tray_event == NIN_BALLOONUSERCLICK && emitNotificationCommand(host, hwnd)) {
|
|
5714
|
+
return 0;
|
|
5715
|
+
}
|
|
5716
|
+
if (!host->tray_active) break;
|
|
5693
5717
|
if (tray_event == NIN_SELECT || tray_event == NIN_KEYSELECT || tray_event == WM_LBUTTONUP) {
|
|
5694
5718
|
if (keyDown(VK_MENU) && !host->tray_alternate_activation_command.empty()) {
|
|
5695
5719
|
emitStatusCommand(host, hwnd, host->tray_alternate_activation_command);
|
|
@@ -6101,8 +6125,10 @@ size_t native_sdk_windows_clipboard_read_data(Host *host, const char *mime_type,
|
|
|
6101
6125
|
int native_sdk_windows_clipboard_write_data(Host *host, const char *mime_type, size_t mime_type_len, const char *bytes, size_t bytes_len);
|
|
6102
6126
|
void native_sdk_windows_cancel_timer(Host *host, uint64_t timer_id);
|
|
6103
6127
|
|
|
6104
|
-
Host *native_sdk_windows_create(const char *app_name, size_t app_name_len, const char *window_title, size_t window_title_len, const char *bundle_id, size_t bundle_id_len, const char *icon_path, size_t icon_path_len, const char *window_label, size_t window_label_len, double x, double y, double width, double height, int restore_frame, int resizable, int titlebar_style, double min_width, double min_height, int show_policy, uint32_t window_flags) {
|
|
6128
|
+
Host *native_sdk_windows_create(const char *app_name, size_t app_name_len, const char *window_title, size_t window_title_len, const char *bundle_id, size_t bundle_id_len, const char *icon_path, size_t icon_path_len, const char *window_label, size_t window_label_len, double x, double y, double width, double height, int restore_frame, int initial_placement, int restore_policy, int resizable, int titlebar_style, double min_width, double min_height, int show_policy, uint32_t window_flags) {
|
|
6105
6129
|
(void)restore_frame;
|
|
6130
|
+
(void)initial_placement;
|
|
6131
|
+
(void)restore_policy;
|
|
6106
6132
|
INITCOMMONCONTROLSEX controls = {};
|
|
6107
6133
|
controls.dwSize = sizeof(controls);
|
|
6108
6134
|
controls.dwICC = ICC_PROGRESS_CLASS | ICC_TAB_CLASSES;
|
|
@@ -6261,11 +6287,12 @@ void native_sdk_windows_request_frame(Host *host) {
|
|
|
6261
6287
|
static const GUID kNativeSdkCLSID_WICImagingFactory = {0xcacaf262, 0x9370, 0x4615, {0xa1, 0x3b, 0x9f, 0x55, 0x39, 0xda, 0x4c, 0x0a}};
|
|
6262
6288
|
static const GUID kNativeSdkIID_IWICImagingFactory = {0xec5ec8a9, 0xc395, 0x4314, {0x9c, 0x77, 0x54, 0xd7, 0xa9, 0x35, 0xff, 0x70}};
|
|
6263
6289
|
static const GUID kNativeSdkGUID_WICPixelFormat32bppRGBA = {0xf5c7ad2d, 0x6a8d, 0x43dd, {0xa7, 0xa8, 0xa2, 0x99, 0x35, 0x26, 0x1a, 0xe9}};
|
|
6290
|
+
static constexpr size_t kNativeSdkMaxDecodedImageDimension = 8192;
|
|
6264
6291
|
|
|
6265
|
-
int native_sdk_windows_decode_image(const uint8_t *bytes, size_t bytes_len, uint8_t *pixels, size_t pixels_len, size_t *out_width, size_t *out_height) {
|
|
6292
|
+
int native_sdk_windows_decode_image(const uint8_t *bytes, size_t bytes_len, uint8_t *pixels, size_t pixels_len, size_t max_pixels, size_t *out_width, size_t *out_height) {
|
|
6266
6293
|
if (out_width) *out_width = 0;
|
|
6267
6294
|
if (out_height) *out_height = 0;
|
|
6268
|
-
if (!bytes || bytes_len == 0 || !pixels || bytes_len > UINT32_MAX) return 0;
|
|
6295
|
+
if (!bytes || bytes_len == 0 || !pixels || bytes_len > UINT32_MAX || max_pixels == 0) return 0;
|
|
6269
6296
|
|
|
6270
6297
|
HRESULT init = CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
|
|
6271
6298
|
bool uninitialize = SUCCEEDED(init); // S_FALSE still pairs with CoUninitialize.
|
|
@@ -6275,6 +6302,7 @@ int native_sdk_windows_decode_image(const uint8_t *bytes, size_t bytes_len, uint
|
|
|
6275
6302
|
IWICStream *stream = nullptr;
|
|
6276
6303
|
IWICBitmapDecoder *decoder = nullptr;
|
|
6277
6304
|
IWICBitmapFrameDecode *frame = nullptr;
|
|
6305
|
+
IWICBitmapScaler *scaler = nullptr;
|
|
6278
6306
|
IWICFormatConverter *converter = nullptr;
|
|
6279
6307
|
do {
|
|
6280
6308
|
if (FAILED(CoCreateInstance(kNativeSdkCLSID_WICImagingFactory, nullptr, CLSCTX_INPROC_SERVER, kNativeSdkIID_IWICImagingFactory, reinterpret_cast<void **>(&factory)))) break;
|
|
@@ -6286,9 +6314,21 @@ int native_sdk_windows_decode_image(const uint8_t *bytes, size_t bytes_len, uint
|
|
|
6286
6314
|
UINT frame_width = 0;
|
|
6287
6315
|
UINT frame_height = 0;
|
|
6288
6316
|
if (FAILED(frame->GetSize(&frame_width, &frame_height))) break;
|
|
6289
|
-
if (frame_width == 0 || frame_height == 0
|
|
6317
|
+
if (frame_width == 0 || frame_height == 0) break;
|
|
6290
6318
|
size_t width = frame_width;
|
|
6291
6319
|
size_t height = frame_height;
|
|
6320
|
+
double source_pixels = static_cast<double>(width) * static_cast<double>(height);
|
|
6321
|
+
if (source_pixels > static_cast<double>(max_pixels) || width > kNativeSdkMaxDecodedImageDimension || height > kNativeSdkMaxDecodedImageDimension) {
|
|
6322
|
+
double area_scale = sqrt(static_cast<double>(max_pixels) / source_pixels);
|
|
6323
|
+
double axis_scale = static_cast<double>(kNativeSdkMaxDecodedImageDimension) / static_cast<double>(std::max(width, height));
|
|
6324
|
+
double scale = std::min(1.0, std::min(area_scale, axis_scale));
|
|
6325
|
+
width = std::max<size_t>(1, static_cast<size_t>(floor(static_cast<double>(width) * scale)));
|
|
6326
|
+
height = std::max<size_t>(1, static_cast<size_t>(floor(static_cast<double>(height) * scale)));
|
|
6327
|
+
while (width * height > max_pixels) {
|
|
6328
|
+
if (width > 1 && (height == 1 || width > height)) width -= 1;
|
|
6329
|
+
else height -= 1;
|
|
6330
|
+
}
|
|
6331
|
+
}
|
|
6292
6332
|
if (out_width) *out_width = width;
|
|
6293
6333
|
if (out_height) *out_height = height;
|
|
6294
6334
|
size_t byte_len = width * height * 4;
|
|
@@ -6298,12 +6338,19 @@ int native_sdk_windows_decode_image(const uint8_t *bytes, size_t bytes_len, uint
|
|
|
6298
6338
|
}
|
|
6299
6339
|
|
|
6300
6340
|
if (FAILED(factory->CreateFormatConverter(&converter))) break;
|
|
6301
|
-
|
|
6341
|
+
IWICBitmapSource *source_bitmap = frame;
|
|
6342
|
+
if (width != frame_width || height != frame_height) {
|
|
6343
|
+
if (FAILED(factory->CreateBitmapScaler(&scaler))) break;
|
|
6344
|
+
if (FAILED(scaler->Initialize(frame, static_cast<UINT>(width), static_cast<UINT>(height), WICBitmapInterpolationModeFant))) break;
|
|
6345
|
+
source_bitmap = scaler;
|
|
6346
|
+
}
|
|
6347
|
+
if (FAILED(converter->Initialize(source_bitmap, kNativeSdkGUID_WICPixelFormat32bppRGBA, WICBitmapDitherTypeNone, nullptr, 0.0, WICBitmapPaletteTypeCustom))) break;
|
|
6302
6348
|
if (FAILED(converter->CopyPixels(nullptr, static_cast<UINT>(width * 4), static_cast<UINT>(byte_len), pixels))) break;
|
|
6303
6349
|
result = 1;
|
|
6304
6350
|
} while (false);
|
|
6305
6351
|
|
|
6306
6352
|
if (converter) converter->Release();
|
|
6353
|
+
if (scaler) scaler->Release();
|
|
6307
6354
|
if (frame) frame->Release();
|
|
6308
6355
|
if (decoder) decoder->Release();
|
|
6309
6356
|
if (stream) stream->Release();
|
|
@@ -6531,8 +6578,10 @@ void native_sdk_windows_set_shortcuts(Host *host, const char *const *ids, const
|
|
|
6531
6578
|
}
|
|
6532
6579
|
}
|
|
6533
6580
|
|
|
6534
|
-
int native_sdk_windows_create_window(Host *host, uint64_t window_id, const char *window_title, size_t window_title_len, const char *window_label, size_t window_label_len, double x, double y, double width, double height, int restore_frame, int resizable, int titlebar_style, double min_width, double min_height, int show_policy, uint32_t window_flags) {
|
|
6581
|
+
int native_sdk_windows_create_window(Host *host, uint64_t window_id, const char *window_title, size_t window_title_len, const char *window_label, size_t window_label_len, double x, double y, double width, double height, int restore_frame, int initial_placement, int restore_policy, int resizable, int titlebar_style, double min_width, double min_height, int show_policy, uint32_t window_flags) {
|
|
6535
6582
|
(void)restore_frame;
|
|
6583
|
+
(void)initial_placement;
|
|
6584
|
+
(void)restore_policy;
|
|
6536
6585
|
if (!host || host->windows.find(window_id) != host->windows.end()) return 0;
|
|
6537
6586
|
Window window;
|
|
6538
6587
|
window.id = window_id;
|
|
@@ -7452,9 +7501,13 @@ int native_sdk_windows_show_message_dialog(Host *host, const WindowsMessageDialo
|
|
|
7452
7501
|
return 0;
|
|
7453
7502
|
}
|
|
7454
7503
|
|
|
7455
|
-
int native_sdk_windows_show_notification(Host *host, const char *title, size_t title_len, const char *subtitle, size_t subtitle_len, const char *body, size_t body_len) {
|
|
7504
|
+
int native_sdk_windows_show_notification(Host *host, const char *title, size_t title_len, const char *subtitle, size_t subtitle_len, const char *body, size_t body_len, const char *notification_id, size_t notification_id_len, const char *action_label, size_t action_label_len, const char *action_command, size_t action_command_len) {
|
|
7456
7505
|
if (!host || !title || title_len == 0) return 0;
|
|
7457
|
-
if ((subtitle_len > 0 && !subtitle) || (body_len > 0 && !body)
|
|
7506
|
+
if ((subtitle_len > 0 && !subtitle) || (body_len > 0 && !body) ||
|
|
7507
|
+
(notification_id_len > 0 && !notification_id) ||
|
|
7508
|
+
(action_label_len > 0 && !action_label) ||
|
|
7509
|
+
(action_command_len > 0 && !action_command) ||
|
|
7510
|
+
((action_label_len == 0) != (action_command_len == 0))) return 0;
|
|
7458
7511
|
if (!ensureNotificationIcon(host)) return 0;
|
|
7459
7512
|
|
|
7460
7513
|
std::wstring title_wide = widen(slice(title, title_len));
|
|
@@ -7462,6 +7515,10 @@ int native_sdk_windows_show_notification(Host *host, const char *title, size_t t
|
|
|
7462
7515
|
if (subtitle && subtitle_len > 0) body_wide += widen(slice(subtitle, subtitle_len));
|
|
7463
7516
|
if (subtitle_len > 0 && body_len > 0) body_wide += L"\n";
|
|
7464
7517
|
if (body && body_len > 0) body_wide += widen(slice(body, body_len));
|
|
7518
|
+
if (action_label_len > 0) {
|
|
7519
|
+
if (!body_wide.empty()) body_wide += L"\n\n";
|
|
7520
|
+
body_wide += L"[" + widen(slice(action_label, action_label_len)) + L"]";
|
|
7521
|
+
}
|
|
7465
7522
|
|
|
7466
7523
|
NOTIFYICONDATAW data = notificationIconData(host);
|
|
7467
7524
|
if (!data.hWnd) return 0;
|
|
@@ -7469,7 +7526,11 @@ int native_sdk_windows_show_notification(Host *host, const char *title, size_t t
|
|
|
7469
7526
|
data.dwInfoFlags = NIIF_INFO;
|
|
7470
7527
|
copyWideField(data.szInfoTitle, ARRAYSIZE(data.szInfoTitle), title_wide);
|
|
7471
7528
|
copyWideField(data.szInfo, ARRAYSIZE(data.szInfo), body_wide);
|
|
7472
|
-
|
|
7529
|
+
if (!Shell_NotifyIconW(NIM_MODIFY, &data)) return 0;
|
|
7530
|
+
host->notification_id = slice(notification_id, notification_id_len);
|
|
7531
|
+
host->notification_action_label = slice(action_label, action_label_len);
|
|
7532
|
+
host->notification_action_command = slice(action_command, action_command_len);
|
|
7533
|
+
return 1;
|
|
7473
7534
|
}
|
|
7474
7535
|
|
|
7475
7536
|
int native_sdk_windows_create_tray(Host *host, const char *icon_path, size_t icon_path_len, const char *tooltip, size_t tooltip_len, const char *activation_command, size_t activation_command_len, const char *alternate_activation_command, size_t alternate_activation_command_len, const char *open_command, size_t open_command_len) {
|
|
@@ -82,6 +82,7 @@ pub const UrlScheme = types.UrlScheme;
|
|
|
82
82
|
pub const PackageMetadata = types.PackageMetadata;
|
|
83
83
|
pub const UpdateConfig = types.UpdateConfig;
|
|
84
84
|
pub const Manifest = types.Manifest;
|
|
85
|
+
pub const ImagesConfig = types.ImagesConfig;
|
|
85
86
|
pub const validateManifest = validation.validateManifest;
|
|
86
87
|
pub const validateIdentity = validation.validateIdentity;
|
|
87
88
|
pub const validateDescription = validation.validateDescription;
|
|
@@ -105,7 +106,9 @@ pub const validateUrl = validation.validateUrl;
|
|
|
105
106
|
pub const validateIcons = validation.validateIcons;
|
|
106
107
|
pub const validatePermissions = validation.validatePermissions;
|
|
107
108
|
pub const validateCapabilities = validation.validateCapabilities;
|
|
109
|
+
pub const validateDockVisibility = validation.validateDockVisibility;
|
|
108
110
|
pub const validatePersist = validation.validatePersist;
|
|
111
|
+
pub const validateImages = validation.validateImages;
|
|
109
112
|
pub const validateBridge = validation.validateBridge;
|
|
110
113
|
pub const validateFrontend = validation.validateFrontend;
|
|
111
114
|
pub const validateBridgeOrigin = validation.validateBridgeOrigin;
|
|
@@ -88,6 +88,7 @@ const validateUrl = validation.validateUrl;
|
|
|
88
88
|
const validateIcons = validation.validateIcons;
|
|
89
89
|
const validatePermissions = validation.validatePermissions;
|
|
90
90
|
const validateCapabilities = validation.validateCapabilities;
|
|
91
|
+
const validateImages = validation.validateImages;
|
|
91
92
|
const validateBridge = validation.validateBridge;
|
|
92
93
|
const validateFrontend = validation.validateFrontend;
|
|
93
94
|
const validateBridgeOrigin = validation.validateBridgeOrigin;
|
|
@@ -105,6 +106,22 @@ test "valid minimal manifest" {
|
|
|
105
106
|
try validateManifest(manifest);
|
|
106
107
|
}
|
|
107
108
|
|
|
109
|
+
test "accessory startup requires the tray capability" {
|
|
110
|
+
const tray_capabilities = [_]Capability{.tray};
|
|
111
|
+
try validateManifest(.{
|
|
112
|
+
.identity = .{ .id = "com.example.menu", .name = "menu" },
|
|
113
|
+
.version = .{ .major = 1, .minor = 0, .patch = 0 },
|
|
114
|
+
.capabilities = &tray_capabilities,
|
|
115
|
+
.dock_visible = false,
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
try std.testing.expectError(error.MissingTrayCapability, validateManifest(.{
|
|
119
|
+
.identity = .{ .id = "com.example.stranded", .name = "stranded" },
|
|
120
|
+
.version = .{ .major = 1, .minor = 0, .patch = 0 },
|
|
121
|
+
.dock_visible = false,
|
|
122
|
+
}));
|
|
123
|
+
}
|
|
124
|
+
|
|
108
125
|
test "manifest validates shell windows and views" {
|
|
109
126
|
const shell_views = [_]ShellView{
|
|
110
127
|
.{ .label = "toolbar", .kind = .toolbar, .edge = .top, .height = 44, .role = "toolbar" },
|
|
@@ -759,3 +776,10 @@ test "package metadata validation catches empty authors and invalid keywords" {
|
|
|
759
776
|
try std.testing.expectError(error.InvalidKeyword, validatePackageMetadata(.{ .keywords = &.{"Bad"} }));
|
|
760
777
|
try std.testing.expectError(error.InvalidUrl, validatePackageMetadata(.{ .repository = "ssh://example.com/repo" }));
|
|
761
778
|
}
|
|
779
|
+
|
|
780
|
+
test "registered-image manifest budget accepts the documented range only" {
|
|
781
|
+
try validateImages(.{});
|
|
782
|
+
try validateImages(.{ .max_image_pixel_bytes = 8 * 1024 * 1024 });
|
|
783
|
+
try std.testing.expectError(error.InvalidDimension, validateImages(.{ .max_image_pixel_bytes = 1024 * 1024 - 1 }));
|
|
784
|
+
try std.testing.expectError(error.InvalidDimension, validateImages(.{ .max_image_pixel_bytes = 8 * 1024 * 1024 + 1 }));
|
|
785
|
+
}
|
|
@@ -26,6 +26,7 @@ pub const ValidationError = error{
|
|
|
26
26
|
InvalidTimeout,
|
|
27
27
|
InvalidKeyword,
|
|
28
28
|
MissingRequiredField,
|
|
29
|
+
MissingTrayCapability,
|
|
29
30
|
WebViewLayerConflict,
|
|
30
31
|
NoSpaceLeft,
|
|
31
32
|
};
|
|
@@ -658,13 +659,25 @@ pub const PersistConfig = struct {
|
|
|
658
659
|
restore: PersistRestore,
|
|
659
660
|
};
|
|
660
661
|
|
|
662
|
+
pub const ImagesConfig = struct {
|
|
663
|
+
/// Per-used-slot decoded RGBA8 budget. The default is 1 MiB; apps may
|
|
664
|
+
/// deliberately raise it through 8 MiB. Sixteen fully used slots at
|
|
665
|
+
/// the ceiling are a declared 128 MiB high-water mark.
|
|
666
|
+
max_image_pixel_bytes: usize = 1024 * 1024,
|
|
667
|
+
};
|
|
668
|
+
|
|
661
669
|
pub const Manifest = struct {
|
|
662
670
|
identity: AppIdentity,
|
|
663
671
|
version: Version,
|
|
664
672
|
icons: []const Icon = &.{},
|
|
665
673
|
permissions: []const Permission = &.{},
|
|
666
674
|
capabilities: []const Capability = &.{},
|
|
675
|
+
/// Whether the app starts with its ordinary desktop presence. On
|
|
676
|
+
/// macOS false selects Accessory before startup windows exist, so no
|
|
677
|
+
/// Dock tile flashes; other hosts currently ignore the field.
|
|
678
|
+
dock_visible: bool = true,
|
|
667
679
|
persist: ?PersistConfig = null,
|
|
680
|
+
images: ImagesConfig = .{},
|
|
668
681
|
bridge: BridgeConfig = .{},
|
|
669
682
|
frontend: ?FrontendConfig = null,
|
|
670
683
|
security: SecurityConfig = .{},
|
|
@@ -68,13 +68,18 @@ const UrlScheme = types.UrlScheme;
|
|
|
68
68
|
const PackageMetadata = types.PackageMetadata;
|
|
69
69
|
const UpdateConfig = types.UpdateConfig;
|
|
70
70
|
const Manifest = types.Manifest;
|
|
71
|
+
const ImagesConfig = types.ImagesConfig;
|
|
72
|
+
const default_image_pixel_bytes: usize = 1024 * 1024;
|
|
73
|
+
const max_image_pixel_bytes_ceiling: usize = 8 * 1024 * 1024;
|
|
71
74
|
pub fn validateManifest(manifest: Manifest) ValidationError!void {
|
|
72
75
|
try validateIdentity(manifest.identity);
|
|
73
76
|
try validateVersion(manifest.version);
|
|
74
77
|
try validateIcons(manifest.icons);
|
|
75
78
|
try validatePermissions(manifest.permissions);
|
|
76
79
|
try validateCapabilities(manifest.capabilities);
|
|
80
|
+
try validateDockVisibility(manifest.dock_visible, manifest.capabilities);
|
|
77
81
|
try validatePersist(manifest.persist, manifest.capabilities);
|
|
82
|
+
try validateImages(manifest.images);
|
|
78
83
|
try validateBridge(manifest.bridge);
|
|
79
84
|
if (manifest.frontend) |frontend| try validateFrontend(frontend);
|
|
80
85
|
try validateSecurity(manifest.security);
|
|
@@ -92,6 +97,14 @@ pub fn validateManifest(manifest: Manifest) ValidationError!void {
|
|
|
92
97
|
try validateUpdates(manifest.updates);
|
|
93
98
|
}
|
|
94
99
|
|
|
100
|
+
pub fn validateImages(images: ImagesConfig) ValidationError!void {
|
|
101
|
+
if (images.max_image_pixel_bytes < default_image_pixel_bytes or
|
|
102
|
+
images.max_image_pixel_bytes > max_image_pixel_bytes_ceiling)
|
|
103
|
+
{
|
|
104
|
+
return error.InvalidDimension;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
95
108
|
/// Whether the manifest declares web content — the shared declare-to-use
|
|
96
109
|
/// contract (web_layer.zig) over the typed manifest. Validation has no
|
|
97
110
|
/// engine flag, so the manifest's own engine is the resolved engine here;
|
|
@@ -544,6 +557,17 @@ pub fn validateCapabilities(capabilities: []const Capability) ValidationError!vo
|
|
|
544
557
|
}
|
|
545
558
|
}
|
|
546
559
|
|
|
560
|
+
/// An accessory app has no Dock or app-switcher route back to its
|
|
561
|
+
/// windows. Require the status-item capability as the explicit re-show
|
|
562
|
+
/// affordance instead of allowing an app to strand itself invisibly.
|
|
563
|
+
pub fn validateDockVisibility(dock_visible: bool, capabilities: []const Capability) ValidationError!void {
|
|
564
|
+
if (dock_visible) return;
|
|
565
|
+
for (capabilities) |capability| {
|
|
566
|
+
if (capability == .tray) return;
|
|
567
|
+
}
|
|
568
|
+
return error.MissingTrayCapability;
|
|
569
|
+
}
|
|
570
|
+
|
|
547
571
|
pub fn validatePersist(config: ?types.PersistConfig, capabilities: []const Capability) ValidationError!void {
|
|
548
572
|
var declared = false;
|
|
549
573
|
for (capabilities) |capability| {
|
|
@@ -140,12 +140,14 @@ fn frameHasArea(frame: geometry.RectF) bool {
|
|
|
140
140
|
// ---------------------------------------------------------- missing label
|
|
141
141
|
|
|
142
142
|
/// Roles whose announcement is useless without a name: the control set a
|
|
143
|
-
/// screen reader user OPERATES
|
|
144
|
-
///
|
|
145
|
-
///
|
|
143
|
+
/// screen reader user OPERATES, plus a radiogroup whose name supplies the
|
|
144
|
+
/// shared question for its otherwise individually named choices. Other
|
|
145
|
+
/// text/status/group/image roles either carry their name as content or
|
|
146
|
+
/// degrade without blocking (images are the markup lint's warning);
|
|
147
|
+
/// progressbars are display-only.
|
|
146
148
|
fn roleNeedsName(role: WidgetRole) bool {
|
|
147
149
|
return switch (role) {
|
|
148
|
-
.button, .textbox, .checkbox, .radio, .switch_control, .slider, .menuitem, .tab, .link, .treeitem, .listitem => true,
|
|
150
|
+
.button, .textbox, .checkbox, .radio, .radiogroup, .switch_control, .slider, .menuitem, .tab, .link, .treeitem, .listitem => true,
|
|
149
151
|
else => false,
|
|
150
152
|
};
|
|
151
153
|
}
|
|
@@ -240,9 +242,9 @@ fn auditFocusReachable(layout: WidgetLayoutTree, node_index: usize, sink: *Findi
|
|
|
240
242
|
var scrolls_vertically = false;
|
|
241
243
|
var scrolls_horizontally = false;
|
|
242
244
|
while (true) {
|
|
243
|
-
//
|
|
244
|
-
//
|
|
245
|
-
if (widget_tree.
|
|
245
|
+
// Window-level surfaces escape every ancestor clip (the routing
|
|
246
|
+
// layer keeps focus targets inside them live).
|
|
247
|
+
if (widget_tree.widgetEscapesAncestorClips(layout.nodes[current].widget)) return;
|
|
246
248
|
const parent_index = layout.nodes[current].parent_index orelse return;
|
|
247
249
|
const parent = layout.nodes[parent_index];
|
|
248
250
|
if (widgetClipsForAudit(parent.widget)) {
|
|
@@ -40,6 +40,30 @@ test "an unlabeled button is a missing-label finding; text or a label clears it"
|
|
|
40
40
|
try std.testing.expectEqual(@as(usize, 0), clean.total);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
test "a radio group needs its own accessible name" {
|
|
44
|
+
var nodes: [16]canvas.WidgetLayoutNode = undefined;
|
|
45
|
+
var storage: [8]a11y_audit.A11yAuditFinding = undefined;
|
|
46
|
+
|
|
47
|
+
const unnamed = Widget{ .kind = .column, .children = &.{
|
|
48
|
+
.{ .id = 2, .kind = .radio_group, .children = &.{
|
|
49
|
+
.{ .id = 3, .kind = .radio, .text = "Default" },
|
|
50
|
+
.{ .id = 4, .kind = .radio, .text = "Compact" },
|
|
51
|
+
} },
|
|
52
|
+
} };
|
|
53
|
+
const issues = try auditTree(unnamed, window, &nodes, &storage);
|
|
54
|
+
try std.testing.expectEqual(@as(usize, 1), issues.total);
|
|
55
|
+
try std.testing.expectEqual(a11y_audit.A11yAuditRuleKind.missing_label, issues.findings[0].rule);
|
|
56
|
+
|
|
57
|
+
const named = Widget{ .kind = .column, .children = &.{
|
|
58
|
+
.{ .id = 2, .kind = .radio_group, .semantics = .{ .label = "Density" }, .children = &.{
|
|
59
|
+
.{ .id = 3, .kind = .radio, .text = "Default" },
|
|
60
|
+
.{ .id = 4, .kind = .radio, .text = "Compact" },
|
|
61
|
+
} },
|
|
62
|
+
} };
|
|
63
|
+
const clean = try auditTree(named, window, &nodes, &storage);
|
|
64
|
+
try std.testing.expectEqual(@as(usize, 0), clean.total);
|
|
65
|
+
}
|
|
66
|
+
|
|
43
67
|
test "a text field's value is not its name; a placeholder or label is" {
|
|
44
68
|
var nodes: [16]canvas.WidgetLayoutNode = undefined;
|
|
45
69
|
var storage: [8]a11y_audit.A11yAuditFinding = undefined;
|
|
@@ -71,6 +71,13 @@ pub const WidgetPointerEvent = struct {
|
|
|
71
71
|
/// Shift on pointer-down to extend from the existing selection
|
|
72
72
|
/// anchor instead of replacing it with a collapsed caret.
|
|
73
73
|
modifiers: WidgetKeyboardModifiers = .{},
|
|
74
|
+
/// Runtime-stamped outcome for a release that selected a radio:
|
|
75
|
+
/// true when retained selection actually changed, false when the
|
|
76
|
+
/// already-selected radio was activated again, null when this event
|
|
77
|
+
/// was not a radio selection (or never crossed the runtime seam).
|
|
78
|
+
/// Typed dispatch uses the stamp to keep `on_change` edge-triggered
|
|
79
|
+
/// while preserving the legacy toggle/press activation fallbacks.
|
|
80
|
+
radio_selection_changed: ?bool = null,
|
|
74
81
|
};
|
|
75
82
|
|
|
76
83
|
pub const WidgetKeyboardPhase = enum {
|
|
@@ -105,6 +112,24 @@ pub const WidgetKeyboardEvent = struct {
|
|
|
105
112
|
/// it to tell "selection followed focus onto me" (dispatch select)
|
|
106
113
|
/// from "an arrow landed on me in place" (collapse/expand intent).
|
|
107
114
|
focus_moved: bool = false,
|
|
115
|
+
/// True when the nearest `radio_group` scope owns this
|
|
116
|
+
/// Arrow/Home/End key. Unlike `focus_moved`, this stays true when the
|
|
117
|
+
/// target is already at the requested edge or is the group's only
|
|
118
|
+
/// focusable radio, so the key cannot leak to an app-level fallback.
|
|
119
|
+
/// Bare radios deliberately leave this false: they retain their
|
|
120
|
+
/// legacy focus-only spatial navigation.
|
|
121
|
+
radio_group_navigation: bool = false,
|
|
122
|
+
/// Whether this radio-group navigation should select the routed
|
|
123
|
+
/// target. A real focus move always selects; an in-place move selects
|
|
124
|
+
/// only when the current radio was unchecked, avoiding duplicate
|
|
125
|
+
/// change dispatches for Home-on-first / End-on-last.
|
|
126
|
+
radio_group_selection: bool = false,
|
|
127
|
+
/// Runtime-stamped outcome for a radio select intent. Space/Enter and
|
|
128
|
+
/// radio-group navigation set this to the retained mutation result;
|
|
129
|
+
/// null means the event was not a radio selection (or was routed by a
|
|
130
|
+
/// direct Tree consumer). This keeps `on_change` tied to a transition,
|
|
131
|
+
/// not merely to an activation key.
|
|
132
|
+
radio_selection_changed: ?bool = null,
|
|
108
133
|
edit: ?TextInputEvent = null,
|
|
109
134
|
/// True when the runtime clamped a clipboard paste to fit capacity
|
|
110
135
|
/// before building `edit`; apps that care about lost bytes must check
|
|
@@ -563,6 +588,9 @@ pub fn widgetKeyboardControlIntent(widget: Widget, keyboard: WidgetKeyboardEvent
|
|
|
563
588
|
if (widget.semantics.role == .treeitem) {
|
|
564
589
|
if (widgetTreeItemKeyboardControlIntent(widget, keyboard)) |intent| return intent;
|
|
565
590
|
}
|
|
591
|
+
if (widget.kind == .radio) {
|
|
592
|
+
if (widgetRadioKeyboardControlIntent(widget, keyboard)) |intent| return intent;
|
|
593
|
+
}
|
|
566
594
|
return switch (widget.kind) {
|
|
567
595
|
.button, .icon_button => if (isWidgetActivationKey(keyboard.key))
|
|
568
596
|
.{ .kind = .press, .actions = .{ .press = true } }
|
|
@@ -778,6 +806,28 @@ fn widgetTreeItemKeyboardControlIntent(widget: Widget, keyboard: WidgetKeyboardE
|
|
|
778
806
|
return null;
|
|
779
807
|
}
|
|
780
808
|
|
|
809
|
+
/// A radio inside a `radio_group` follows focus for the group's
|
|
810
|
+
/// Arrow/Home/End keymap. Space/Enter continue through the ordinary
|
|
811
|
+
/// activation arm below; radios outside a group never receive the
|
|
812
|
+
/// `radio_group_selection` stamp and keep their old behavior.
|
|
813
|
+
fn widgetRadioKeyboardControlIntent(widget: Widget, keyboard: WidgetKeyboardEvent) ?WidgetControlIntent {
|
|
814
|
+
if (!keyboard.radio_group_selection) return null;
|
|
815
|
+
const navigation_key = std.ascii.eqlIgnoreCase(keyboard.key, "arrowup") or
|
|
816
|
+
std.ascii.eqlIgnoreCase(keyboard.key, "arrowdown") or
|
|
817
|
+
std.ascii.eqlIgnoreCase(keyboard.key, "arrowleft") or
|
|
818
|
+
std.ascii.eqlIgnoreCase(keyboard.key, "arrowright") or
|
|
819
|
+
std.ascii.eqlIgnoreCase(keyboard.key, "home") or
|
|
820
|
+
std.ascii.eqlIgnoreCase(keyboard.key, "end");
|
|
821
|
+
if (!navigation_key) return null;
|
|
822
|
+
return .{
|
|
823
|
+
.kind = .select,
|
|
824
|
+
.actions = .{
|
|
825
|
+
.select = true,
|
|
826
|
+
.press = widget.command.len > 0,
|
|
827
|
+
},
|
|
828
|
+
};
|
|
829
|
+
}
|
|
830
|
+
|
|
781
831
|
pub fn widgetScrollKeyboardIntent(widget: Widget, keyboard: WidgetKeyboardEvent) ?WidgetControlIntent {
|
|
782
832
|
if (keyboard.phase != .key_down or keyboard.modifiers.hasNavigationModifier()) return null;
|
|
783
833
|
if (widget.state.disabled) return null;
|
|
@@ -380,7 +380,7 @@ fn nodeIsOverlapCandidate(layout: WidgetLayoutTree, node_index: usize, parent_in
|
|
|
380
380
|
const node = layout.nodes[node_index];
|
|
381
381
|
if (node.parent_index != parent_index) return false;
|
|
382
382
|
const widget = node.widget;
|
|
383
|
-
if (widget
|
|
383
|
+
if (widget_tree.widgetEscapesAncestorClips(widget)) return false;
|
|
384
384
|
if (widget.semantics.hidden) return false;
|
|
385
385
|
if (widget.opacity <= 0) return false;
|
|
386
386
|
if (!equality_model.affinesEqual(widget.transform, canvas.Affine.identity())) return false;
|
|
@@ -411,15 +411,15 @@ fn scopeScrollsHorizontally(widget: Widget) bool {
|
|
|
411
411
|
}
|
|
412
412
|
|
|
413
413
|
/// Nearest ancestor whose clip bounds this node: the first clipping
|
|
414
|
-
/// ancestor, or the window (node 0's scope) when none clips.
|
|
415
|
-
///
|
|
416
|
-
///
|
|
414
|
+
/// ancestor, or the window (node 0's scope) when none clips. Window-level
|
|
415
|
+
/// surfaces hoist out of every ancestor clip and are clipped by the window
|
|
416
|
+
/// alone, so the walk stops at that boundary.
|
|
417
417
|
fn clipScopeIndex(layout: WidgetLayoutTree, node_index: usize) ?usize {
|
|
418
|
-
if (layout.nodes[node_index].widget
|
|
418
|
+
if (widget_tree.widgetEscapesAncestorClips(layout.nodes[node_index].widget)) return null;
|
|
419
419
|
var current = layout.nodes[node_index].parent_index;
|
|
420
420
|
while (current) |index| {
|
|
421
421
|
if (widgetClipsForAudit(layout.nodes[index].widget)) return index;
|
|
422
|
-
if (layout.nodes[index].widget
|
|
422
|
+
if (widget_tree.widgetEscapesAncestorClips(layout.nodes[index].widget)) return null;
|
|
423
423
|
current = layout.nodes[index].parent_index;
|
|
424
424
|
}
|
|
425
425
|
return null;
|
|
@@ -1530,6 +1530,10 @@ pub fn Markdown(comptime Msg: type) type {
|
|
|
1530
1530
|
if (style.html_small > 0) span.scale = if (span.scale > 0) span.scale * 0.875 else 0.875;
|
|
1531
1531
|
if (style.html_heading_level) |level| span.scale = heading_scales[@min(level, heading_scales.len) - 1];
|
|
1532
1532
|
if (span.link.len == 0 and style.html_link.len > 0) span.link = style.html_link;
|
|
1533
|
+
// Markdown keeps its conventional underlined-link register,
|
|
1534
|
+
// while the underlying TextSpan renderer leaves decoration
|
|
1535
|
+
// entirely under the span's explicit `underline` flag.
|
|
1536
|
+
if (span.link.len > 0) span.underline = true;
|
|
1533
1537
|
appendSpan(spans, len, span);
|
|
1534
1538
|
}
|
|
1535
1539
|
|
|
@@ -187,6 +187,7 @@ test "markdown maps headings, paragraphs, and inline styles onto spans" {
|
|
|
187
187
|
try testing.expectEqualStrings("gone", spans[7].text);
|
|
188
188
|
try testing.expectEqualStrings("a link", spans[9].text);
|
|
189
189
|
try testing.expectEqualStrings("https://example.com", spans[9].link);
|
|
190
|
+
try testing.expect(spans[9].underline);
|
|
190
191
|
|
|
191
192
|
// The link span grew a hit-area child that dispatches on_link's Msg.
|
|
192
193
|
const link_child = paragraph.children[0];
|