@native-sdk/cli 0.9.2 → 0.9.4
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 +273 -37
- package/build/ts_run.mjs +15 -18
- package/build.zig +141 -9
- package/package.json +13 -10
- package/packages/core/compile-surface/core.ts +1 -0
- package/packages/core/package-lock.json +16 -13
- package/packages/core/package.json +5 -2
- package/packages/core/scripts/compiler_command.mjs +71 -0
- package/packages/core/scripts/compiler_typecheck.mjs +4 -4
- package/packages/core/scripts/embed_markup_c.mjs +25 -0
- package/packages/core/scripts/npm_static_spike.mjs +3 -3
- package/packages/core/scripts/run_external_core_compiler.mjs +4 -3
- package/packages/core/scripts/run_external_service_compiler.mjs +2 -1
- package/packages/core/sdk/core.ts +1 -0
- package/packages/core/sdk/events.d.ts +10 -0
- package/packages/core/sdk/events.ts +30 -5
- package/packages/core/sdk/text.d.ts +4 -0
- package/packages/core/sdk/text.ts +51 -0
- package/packages/core/src/checker.ts +61 -3
- package/packages/core/src/contract.ts +5 -4
- package/packages/core/src/devhost_journal.mjs +2 -2
- package/packages/core/src/diagnostics.ts +2 -2
- package/packages/core/src/service_contract.ts +10 -0
- package/packages/core/src/typed_ast.ts +9 -7
- package/packages/core/src/types.ts +28 -8
- package/skill-data/automation/SKILL.md +4 -3
- package/skill-data/native-ui/SKILL.md +5 -2
- package/skill-data/ts-core/SKILL.md +10 -4
- package/skill-data/ts-services/references/service-surface.md +1 -1
- package/src/app_runner/root.zig +208 -6
- package/src/app_runner/ts_core_main.zig +14 -4
- package/src/app_runner/ts_core_mobile.zig +6 -2
- package/src/automation/protocol.zig +5 -1
- package/src/automation/snapshot.zig +119 -0
- package/src/platform/macos/appkit_host.m +79 -12
- package/src/platform/macos/root.zig +68 -5
- package/src/primitives/canvas/events.zig +79 -1
- package/src/primitives/canvas/root.zig +1 -0
- package/src/primitives/canvas/text_interaction.zig +23 -0
- package/src/primitives/canvas/text_tests.zig +45 -0
- package/src/primitives/canvas/ui.zig +11 -8
- package/src/primitives/canvas/ui_markup_compiled_tests.zig +3 -0
- package/src/primitives/canvas/ui_markup_reflect.zig +6 -5
- package/src/primitives/canvas/ui_markup_view_tests.zig +18 -2
- package/src/primitives/canvas/ui_tests.zig +37 -0
- package/src/primitives/canvas/widget_builtin_tests.zig +13 -0
- package/src/runtime/automation_snapshot.zig +4 -0
- package/src/runtime/canvas_widget_control_tests.zig +2 -0
- package/src/runtime/canvas_widget_text_tests.zig +124 -0
- package/src/runtime/native_command_event_tests.zig +29 -0
- package/src/runtime/session_journal.zig +21 -2
- package/src/runtime/ts_ui_app.zig +184 -7
- package/src/runtime/ui_app.zig +98 -18
- package/src/runtime/ui_app_tests.zig +232 -13
- package/src/runtime/ui_app_window_tests.zig +23 -0
- package/src/runtime/view_widget_text.zig +1 -1
- package/src/tooling/templates.zig +6 -2
- package/src/tooling/ts_core.zig +1 -1
- package/src/tooling/verbs.zig +228 -0
- package/tools/corewire/emit.zig +31 -12
- package/tools/corewire/emit_facade.zig +57 -2
- package/tools/corewire/emit_profile.zig +20 -7
- package/tools/corewire/emit_service.zig +49 -24
- package/tools/corewire/main.zig +21 -2
- package/tools/corewire/shim_rt.zig +20 -0
|
@@ -483,7 +483,7 @@ static int NativeSdkCredentialStatus(OSStatus status, int missingCode) {
|
|
|
483
483
|
- (BOOL)emitSetSelectionAccessibilityValue:(id)value;
|
|
484
484
|
@end
|
|
485
485
|
|
|
486
|
-
@interface NativeSdkMetalSurfaceView : NSView <NSTextInputClient>
|
|
486
|
+
@interface NativeSdkMetalSurfaceView : NSView <NSTextInputClient, NSDraggingDestination>
|
|
487
487
|
@property(nonatomic, strong) id<MTLDevice> device;
|
|
488
488
|
@property(nonatomic, strong) id<MTLCommandQueue> commandQueue;
|
|
489
489
|
@property(nonatomic, strong) CAMetalLayer *metalLayer;
|
|
@@ -502,6 +502,7 @@ static int NativeSdkCredentialStatus(OSStatus status, int missingCode) {
|
|
|
502
502
|
@property(nonatomic, assign) NativeSdkAppKitHost *host;
|
|
503
503
|
@property(nonatomic, assign) uint64_t windowId;
|
|
504
504
|
@property(nonatomic, strong) NSString *surfaceLabel;
|
|
505
|
+
@property(nonatomic, strong) NSString *viewLabel;
|
|
505
506
|
@property(nonatomic, assign) NSUInteger frameIndex;
|
|
506
507
|
/* Whether this surface has completed at least one REAL present. Gates the
|
|
507
508
|
* occluded short-circuit: until the first present lands, occluded frames
|
|
@@ -1100,7 +1101,7 @@ static int NativeSdkCredentialStatus(OSStatus status, int missingCode) {
|
|
|
1100
1101
|
- (void)stop;
|
|
1101
1102
|
- (BOOL)drainPendingPreRunStop;
|
|
1102
1103
|
- (void)emitEvent:(native_sdk_appkit_event_t)event;
|
|
1103
|
-
- (BOOL)emitDroppedFileURLs:(NSArray<NSURL *> *)urls windowId:(uint64_t)windowId;
|
|
1104
|
+
- (BOOL)emitDroppedFileURLs:(NSArray<NSURL *> *)urls windowId:(uint64_t)windowId viewLabel:(NSString *)viewLabel point:(NSPoint)point;
|
|
1104
1105
|
- (void)startApplicationActivationObservers;
|
|
1105
1106
|
- (void)stopApplicationActivationObservers;
|
|
1106
1107
|
- (void)applicationDidBecomeActive:(NSNotification *)notification;
|
|
@@ -1199,6 +1200,14 @@ static void NativeSdkEmitGpuSurfaceResizes(NSView *view) {
|
|
|
1199
1200
|
}
|
|
1200
1201
|
}
|
|
1201
1202
|
|
|
1203
|
+
// Convert an AppKit-local point to the runtime's top-left-origin space.
|
|
1204
|
+
// Unflipped canvas/content views need the y inversion; flipped views such as
|
|
1205
|
+
// WKWebView already use the runtime's orientation and must pass through.
|
|
1206
|
+
static NSPoint NativeSdkViewLocalYDownPoint(NSView *view, NSPoint point) {
|
|
1207
|
+
if (!view.isFlipped) point.y = view.bounds.size.height - point.y;
|
|
1208
|
+
return point;
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1202
1211
|
@implementation NativeSdkWindowDelegate
|
|
1203
1212
|
|
|
1204
1213
|
- (void)windowDidResize:(NSNotification *)notification {
|
|
@@ -1291,9 +1300,9 @@ static void NativeSdkEmitGpuSurfaceResizes(NSView *view) {
|
|
|
1291
1300
|
|
|
1292
1301
|
// The window is a dragging destination now that the main WebView (whose
|
|
1293
1302
|
// registration used to catch every drop) is lazy: NSWindow forwards
|
|
1294
|
-
// these to its delegate
|
|
1295
|
-
//
|
|
1296
|
-
//
|
|
1303
|
+
// these to its delegate. A present main/child WebView or canvas surface
|
|
1304
|
+
// still wins (views outrank the window for registered types); the fallback
|
|
1305
|
+
// hit-tests anyway so adopted/layered content keeps the most specific label.
|
|
1297
1306
|
- (NSDragOperation)draggingEntered:(id<NSDraggingInfo>)sender {
|
|
1298
1307
|
(void)sender;
|
|
1299
1308
|
return NSDragOperationCopy;
|
|
@@ -1303,7 +1312,36 @@ static void NativeSdkEmitGpuSurfaceResizes(NSView *view) {
|
|
|
1303
1312
|
NSPasteboard *pasteboard = sender.draggingPasteboard;
|
|
1304
1313
|
NSArray<NSURL *> *urls = [pasteboard readObjectsForClasses:@[ [NSURL class] ]
|
|
1305
1314
|
options:@{ NSPasteboardURLReadingFileURLsOnlyKey : @YES }];
|
|
1306
|
-
|
|
1315
|
+
NSWindow *window = self.host.windows[@(self.windowId)] ?: (self.windowId == 1 ? self.host.window : nil);
|
|
1316
|
+
NSView *contentView = window.contentView;
|
|
1317
|
+
if (!contentView) return NO;
|
|
1318
|
+
|
|
1319
|
+
const NSPoint windowPoint = sender.draggingLocation;
|
|
1320
|
+
const NSPoint contentPoint = [contentView convertPoint:windowPoint fromView:nil];
|
|
1321
|
+
NSView *targetView = [contentView hitTest:contentPoint];
|
|
1322
|
+
NSString *viewLabel = @"";
|
|
1323
|
+
for (NSView *candidate = targetView; candidate; candidate = candidate.superview) {
|
|
1324
|
+
if ([candidate isKindOfClass:[NativeSdkMetalSurfaceView class]]) {
|
|
1325
|
+
NSString *label = ((NativeSdkMetalSurfaceView *)candidate).viewLabel;
|
|
1326
|
+
if (label.length > 0) {
|
|
1327
|
+
targetView = candidate;
|
|
1328
|
+
viewLabel = label;
|
|
1329
|
+
break;
|
|
1330
|
+
}
|
|
1331
|
+
} else if ([candidate isKindOfClass:[NativeSdkWebView class]]) {
|
|
1332
|
+
NSString *label = ((NativeSdkWebView *)candidate).viewLabel;
|
|
1333
|
+
if (label.length > 0) {
|
|
1334
|
+
targetView = candidate;
|
|
1335
|
+
viewLabel = label;
|
|
1336
|
+
break;
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
if (candidate == contentView) break;
|
|
1340
|
+
}
|
|
1341
|
+
|
|
1342
|
+
NSView *coordinateView = viewLabel.length > 0 ? targetView : contentView;
|
|
1343
|
+
NSPoint point = NativeSdkViewLocalYDownPoint(coordinateView, [coordinateView convertPoint:windowPoint fromView:nil]);
|
|
1344
|
+
return [self.host emitDroppedFileURLs:urls windowId:self.windowId viewLabel:viewLabel point:point];
|
|
1307
1345
|
}
|
|
1308
1346
|
|
|
1309
1347
|
// close_policy .hide: the USER's close affordance (the red button,
|
|
@@ -1407,7 +1445,8 @@ static void NativeSdkEmitGpuSurfaceResizes(NSView *view) {
|
|
|
1407
1445
|
NSPasteboard *pasteboard = sender.draggingPasteboard;
|
|
1408
1446
|
NSArray<NSURL *> *urls = [pasteboard readObjectsForClasses:@[[NSURL class]]
|
|
1409
1447
|
options:@{ NSPasteboardURLReadingFileURLsOnlyKey: @YES }];
|
|
1410
|
-
|
|
1448
|
+
NSPoint point = NativeSdkViewLocalYDownPoint(self, [self convertPoint:sender.draggingLocation fromView:nil]);
|
|
1449
|
+
return [self.host emitDroppedFileURLs:urls windowId:self.windowId viewLabel:self.viewLabel point:point];
|
|
1411
1450
|
}
|
|
1412
1451
|
|
|
1413
1452
|
@end
|
|
@@ -3713,6 +3752,14 @@ static void NativeSdkPremultiplyStraightRgba8(const uint8_t *source, uint8_t *de
|
|
|
3713
3752
|
|
|
3714
3753
|
@implementation NativeSdkMetalSurfaceView
|
|
3715
3754
|
|
|
3755
|
+
- (NSString *)viewLabel {
|
|
3756
|
+
return self.surfaceLabel;
|
|
3757
|
+
}
|
|
3758
|
+
|
|
3759
|
+
- (void)setViewLabel:(NSString *)viewLabel {
|
|
3760
|
+
self.surfaceLabel = viewLabel ?: @"";
|
|
3761
|
+
}
|
|
3762
|
+
|
|
3716
3763
|
- (instancetype)initWithFrame:(NSRect)frameRect {
|
|
3717
3764
|
self = [super initWithFrame:frameRect];
|
|
3718
3765
|
if (!self) return nil;
|
|
@@ -3761,7 +3808,7 @@ static void NativeSdkPremultiplyStraightRgba8(const uint8_t *source, uint8_t *de
|
|
|
3761
3808
|
- (void)configureWithHost:(NativeSdkAppKitHost *)host windowId:(uint64_t)windowId label:(NSString *)label {
|
|
3762
3809
|
self.host = host;
|
|
3763
3810
|
self.windowId = windowId;
|
|
3764
|
-
self.
|
|
3811
|
+
self.viewLabel = label;
|
|
3765
3812
|
__weak NativeSdkMetalSurfaceView *weakSelf = self;
|
|
3766
3813
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
3767
3814
|
NativeSdkMetalSurfaceView *strongSelf = weakSelf;
|
|
@@ -3772,6 +3819,19 @@ static void NativeSdkPremultiplyStraightRgba8(const uint8_t *source, uint8_t *de
|
|
|
3772
3819
|
});
|
|
3773
3820
|
}
|
|
3774
3821
|
|
|
3822
|
+
- (NSDragOperation)draggingEntered:(id<NSDraggingInfo>)sender {
|
|
3823
|
+
(void)sender;
|
|
3824
|
+
return NSDragOperationCopy;
|
|
3825
|
+
}
|
|
3826
|
+
|
|
3827
|
+
- (BOOL)performDragOperation:(id<NSDraggingInfo>)sender {
|
|
3828
|
+
NSPasteboard *pasteboard = sender.draggingPasteboard;
|
|
3829
|
+
NSArray<NSURL *> *urls = [pasteboard readObjectsForClasses:@[[NSURL class]]
|
|
3830
|
+
options:@{ NSPasteboardURLReadingFileURLsOnlyKey: @YES }];
|
|
3831
|
+
NSPoint point = NativeSdkViewLocalYDownPoint(self, [self convertPoint:sender.draggingLocation fromView:nil]);
|
|
3832
|
+
return [self.host emitDroppedFileURLs:urls windowId:self.windowId viewLabel:self.viewLabel point:point];
|
|
3833
|
+
}
|
|
3834
|
+
|
|
3775
3835
|
- (void)dealloc {
|
|
3776
3836
|
[self stopDisplayTimer];
|
|
3777
3837
|
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
|
@@ -7019,7 +7079,7 @@ static BOOL NativeSdkScrollDriverCanConsumeHorizontally(NativeSdkScrollDriverVie
|
|
|
7019
7079
|
|
|
7020
7080
|
- (void)emitInputEventWithKind:(NSInteger)kind point:(NSPoint)point timestampNs:(uint64_t)timestampNs modifiers:(uint32_t)modifiers keyText:(NSString *)keyText inputText:(NSString *)inputText button:(NSInteger)button deltaX:(double)deltaX deltaY:(double)deltaY {
|
|
7021
7081
|
if (!self.host || self.surfaceLabel.length == 0) return;
|
|
7022
|
-
|
|
7082
|
+
const NSPoint yDownPoint = NativeSdkViewLocalYDownPoint(self, point);
|
|
7023
7083
|
const char *labelBytes = self.surfaceLabel.UTF8String ?: "";
|
|
7024
7084
|
NSString *safeKeyText = keyText ?: @"";
|
|
7025
7085
|
NSString *safeInputText = inputText ?: @"";
|
|
@@ -7029,8 +7089,8 @@ static BOOL NativeSdkScrollDriverCanConsumeHorizontally(NativeSdkScrollDriverVie
|
|
|
7029
7089
|
.kind = NATIVE_SDK_APPKIT_EVENT_GPU_SURFACE_INPUT,
|
|
7030
7090
|
.window_id = self.windowId,
|
|
7031
7091
|
.timestamp_ns = timestampNs,
|
|
7032
|
-
.x =
|
|
7033
|
-
.y = y,
|
|
7092
|
+
.x = yDownPoint.x,
|
|
7093
|
+
.y = yDownPoint.y,
|
|
7034
7094
|
.view_label = labelBytes,
|
|
7035
7095
|
.view_label_len = [self.surfaceLabel lengthOfBytesUsingEncoding:NSUTF8StringEncoding],
|
|
7036
7096
|
.key_text = keyBytes,
|
|
@@ -8449,6 +8509,7 @@ static float NativeSdkCaptureReadRemixedSample(const AudioBufferList *buffers, c
|
|
|
8449
8509
|
case NATIVE_SDK_APPKIT_VIEW_GPU_SURFACE: {
|
|
8450
8510
|
NativeSdkMetalSurfaceView *surface = [[NativeSdkMetalSurfaceView alloc] initWithFrame:NSZeroRect];
|
|
8451
8511
|
if (![surface isAvailable]) return nil;
|
|
8512
|
+
[surface registerForDraggedTypes:@[NSPasteboardTypeFileURL]];
|
|
8452
8513
|
view = surface;
|
|
8453
8514
|
break;
|
|
8454
8515
|
}
|
|
@@ -12036,7 +12097,7 @@ static void NativeSdkVideoFittedSize(double naturalWidth, double naturalHeight,
|
|
|
12036
12097
|
}];
|
|
12037
12098
|
}
|
|
12038
12099
|
|
|
12039
|
-
- (BOOL)emitDroppedFileURLs:(NSArray<NSURL *> *)urls windowId:(uint64_t)windowId {
|
|
12100
|
+
- (BOOL)emitDroppedFileURLs:(NSArray<NSURL *> *)urls windowId:(uint64_t)windowId viewLabel:(NSString *)viewLabel point:(NSPoint)point {
|
|
12040
12101
|
if (urls.count == 0) return NO;
|
|
12041
12102
|
NSMutableArray<NSString *> *paths = [NSMutableArray array];
|
|
12042
12103
|
for (NSURL *url in urls) {
|
|
@@ -12053,9 +12114,15 @@ static void NativeSdkVideoFittedSize(double naturalWidth, double naturalHeight,
|
|
|
12053
12114
|
[data appendData:pathData];
|
|
12054
12115
|
}
|
|
12055
12116
|
if (data.length == 0) return NO;
|
|
12117
|
+
NSString *safeViewLabel = viewLabel ?: @"";
|
|
12118
|
+
const char *viewLabelBytes = safeViewLabel.UTF8String ?: "";
|
|
12056
12119
|
[self emitEvent:(native_sdk_appkit_event_t){
|
|
12057
12120
|
.kind = NATIVE_SDK_APPKIT_EVENT_FILES_DROPPED,
|
|
12058
12121
|
.window_id = windowId,
|
|
12122
|
+
.x = point.x,
|
|
12123
|
+
.y = point.y,
|
|
12124
|
+
.view_label = viewLabelBytes,
|
|
12125
|
+
.view_label_len = [safeViewLabel lengthOfBytesUsingEncoding:NSUTF8StringEncoding],
|
|
12059
12126
|
.drop_paths = data.bytes,
|
|
12060
12127
|
.drop_paths_len = data.length,
|
|
12061
12128
|
}];
|
|
@@ -999,11 +999,7 @@ fn appkitCallback(context: ?*anyopaque, event: *const AppKitEvent) callconv(.c)
|
|
|
999
999
|
.wake => state.emit(.wake),
|
|
1000
1000
|
.files_dropped => {
|
|
1001
1001
|
var paths_buffer: [platform_mod.max_drop_paths][]const u8 = undefined;
|
|
1002
|
-
|
|
1003
|
-
state.emit(.{ .files_dropped = .{
|
|
1004
|
-
.window_id = event.window_id,
|
|
1005
|
-
.paths = paths,
|
|
1006
|
-
} });
|
|
1002
|
+
state.emit(.{ .files_dropped = fileDropEventFromAppKitEvent(event, paths_buffer[0..]) });
|
|
1007
1003
|
},
|
|
1008
1004
|
.gpu_surface_frame => state.emit(.{ .gpu_surface_frame = .{
|
|
1009
1005
|
.window_id = event.window_id,
|
|
@@ -1141,6 +1137,17 @@ fn gpuSurfaceInputEventFromAppKitEvent(event: *const AppKitEvent) platform_mod.G
|
|
|
1141
1137
|
};
|
|
1142
1138
|
}
|
|
1143
1139
|
|
|
1140
|
+
fn fileDropEventFromAppKitEvent(event: *const AppKitEvent, paths_buffer: [][]const u8) platform_mod.FileDropEvent {
|
|
1141
|
+
return .{
|
|
1142
|
+
.window_id = event.window_id,
|
|
1143
|
+
.view_label = appKitEventBytes(event.view_label, event.view_label_len),
|
|
1144
|
+
// AppKit's system host converts every accepted drop to the same
|
|
1145
|
+
// top-left-origin view space as gpu-surface input before emitting.
|
|
1146
|
+
.point = geometry.PointF.init(@floatCast(event.x), @floatCast(event.y)),
|
|
1147
|
+
.paths = platform_mod.splitDropPaths(appKitEventBytes(event.drop_paths, event.drop_paths_len), paths_buffer),
|
|
1148
|
+
};
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1144
1151
|
fn readClipboard(context: ?*anyopaque, buffer: []u8) anyerror![]const u8 {
|
|
1145
1152
|
const self: *MacPlatform = @ptrCast(@alignCast(context.?));
|
|
1146
1153
|
const len = native_sdk_appkit_clipboard_read(self.host, buffer.ptr, buffer.len);
|
|
@@ -3169,6 +3176,62 @@ test "mac gpu surface input preserves key and text" {
|
|
|
3169
3176
|
try std.testing.expect(input.modifiers.shift);
|
|
3170
3177
|
}
|
|
3171
3178
|
|
|
3179
|
+
test "mac file drop bridge preserves view label point and paths" {
|
|
3180
|
+
const label = "kanban-canvas";
|
|
3181
|
+
const paths = "/tmp/spec.txt\x00/tmp/design.pdf";
|
|
3182
|
+
var event = std.mem.zeroes(AppKitEvent);
|
|
3183
|
+
event.kind = .files_dropped;
|
|
3184
|
+
event.window_id = 7;
|
|
3185
|
+
event.view_label = label.ptr;
|
|
3186
|
+
event.view_label_len = label.len;
|
|
3187
|
+
event.x = 42.5;
|
|
3188
|
+
event.y = 91.25;
|
|
3189
|
+
event.drop_paths = paths.ptr;
|
|
3190
|
+
event.drop_paths_len = paths.len;
|
|
3191
|
+
|
|
3192
|
+
var paths_buffer: [platform_mod.max_drop_paths][]const u8 = undefined;
|
|
3193
|
+
const drop = fileDropEventFromAppKitEvent(&event, paths_buffer[0..]);
|
|
3194
|
+
try std.testing.expectEqual(@as(platform_mod.WindowId, 7), drop.window_id);
|
|
3195
|
+
try std.testing.expectEqualStrings("kanban-canvas", drop.view_label);
|
|
3196
|
+
try std.testing.expectEqualDeep(geometry.PointF.init(42.5, 91.25), drop.point.?);
|
|
3197
|
+
try std.testing.expectEqual(@as(usize, 2), drop.paths.len);
|
|
3198
|
+
try std.testing.expectEqualStrings("/tmp/spec.txt", drop.paths[0]);
|
|
3199
|
+
try std.testing.expectEqualStrings("/tmp/design.pdf", drop.paths[1]);
|
|
3200
|
+
}
|
|
3201
|
+
|
|
3202
|
+
test "mac file drops and pointer input share the host y-down conversion" {
|
|
3203
|
+
const host_source = @embedFile("appkit_host.m");
|
|
3204
|
+
try std.testing.expectEqual(@as(usize, 5), std.mem.count(u8, host_source, "NativeSdkViewLocalYDownPoint("));
|
|
3205
|
+
try std.testing.expect(std.mem.indexOf(
|
|
3206
|
+
u8,
|
|
3207
|
+
host_source,
|
|
3208
|
+
"if (!view.isFlipped) point.y = view.bounds.size.height - point.y;",
|
|
3209
|
+
) != null);
|
|
3210
|
+
try std.testing.expect(std.mem.indexOf(
|
|
3211
|
+
u8,
|
|
3212
|
+
host_source,
|
|
3213
|
+
"const NSPoint yDownPoint = NativeSdkViewLocalYDownPoint(self, point);",
|
|
3214
|
+
) != null);
|
|
3215
|
+
try std.testing.expect(std.mem.indexOf(
|
|
3216
|
+
u8,
|
|
3217
|
+
host_source,
|
|
3218
|
+
"NativeSdkViewLocalYDownPoint(self, [self convertPoint:sender.draggingLocation fromView:nil])",
|
|
3219
|
+
) != null);
|
|
3220
|
+
|
|
3221
|
+
const label = "canvas";
|
|
3222
|
+
var event = std.mem.zeroes(AppKitEvent);
|
|
3223
|
+
event.view_label = label.ptr;
|
|
3224
|
+
event.view_label_len = label.len;
|
|
3225
|
+
event.x = 128.5;
|
|
3226
|
+
event.y = 73.25;
|
|
3227
|
+
|
|
3228
|
+
var paths_buffer: [platform_mod.max_drop_paths][]const u8 = undefined;
|
|
3229
|
+
const drop = fileDropEventFromAppKitEvent(&event, paths_buffer[0..]);
|
|
3230
|
+
const input = gpuSurfaceInputEventFromAppKitEvent(&event);
|
|
3231
|
+
try std.testing.expectEqual(input.x, drop.point.?.x);
|
|
3232
|
+
try std.testing.expectEqual(input.y, drop.point.?.y);
|
|
3233
|
+
}
|
|
3234
|
+
|
|
3172
3235
|
test "mac gpu surface input preserves ime composition cursor" {
|
|
3173
3236
|
const label = "canvas";
|
|
3174
3237
|
const text = "compose";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const std = @import("std");
|
|
2
|
+
const builtin = @import("builtin");
|
|
2
3
|
const geometry = @import("geometry");
|
|
3
4
|
const canvas = @import("root.zig");
|
|
4
5
|
const text_model = @import("text.zig");
|
|
@@ -540,6 +541,7 @@ fn widgetKeyboardKeyDownTextEditEvent(event: WidgetKeyboardEvent) ?TextInputEven
|
|
|
540
541
|
if (widgetKeyboardCommandTextNavigationEvent(event)) |edit| return edit;
|
|
541
542
|
if (widgetKeyboardWordTextNavigationEvent(event)) |edit| return edit;
|
|
542
543
|
if (widgetKeyboardWordDeleteTextEditEvent(event)) |edit| return edit;
|
|
544
|
+
if (widgetKeyboardLineDeleteTextEditEvent(event)) |edit| return edit;
|
|
543
545
|
if (event.modifiers.hasNavigationModifier()) return null;
|
|
544
546
|
if (std.ascii.eqlIgnoreCase(event.key, "backspace")) return .delete_backward;
|
|
545
547
|
if (std.ascii.eqlIgnoreCase(event.key, "delete")) return .delete_forward;
|
|
@@ -566,13 +568,49 @@ fn widgetKeyboardWordTextNavigationEvent(event: WidgetKeyboardEvent) ?TextInputE
|
|
|
566
568
|
}
|
|
567
569
|
|
|
568
570
|
fn widgetKeyboardWordDeleteTextEditEvent(event: WidgetKeyboardEvent) ?TextInputEvent {
|
|
569
|
-
|
|
571
|
+
return widgetKeyboardWordDeleteTextEditEventForPlatform(builtin.os.tag, event);
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
fn widgetKeyboardWordDeleteTextEditEventForPlatform(comptime os_tag: @TypeOf(builtin.os.tag), event: WidgetKeyboardEvent) ?TextInputEvent {
|
|
575
|
+
// Ctrl-primary hosts project Ctrl into BOTH `control` and `super`.
|
|
576
|
+
// Accept that folded shape off macOS so Ctrl+Backspace keeps its
|
|
577
|
+
// platform word-delete meaning; a bare Super/Meta chord stays inert.
|
|
578
|
+
if (event.modifiers.shift) return null;
|
|
579
|
+
if (event.modifiers.super) {
|
|
580
|
+
if (comptime os_tag == .macos) return null;
|
|
581
|
+
if (!event.modifiers.control) return null;
|
|
582
|
+
}
|
|
570
583
|
if (event.modifiers.alt == event.modifiers.control) return null;
|
|
571
584
|
if (std.ascii.eqlIgnoreCase(event.key, "backspace")) return .delete_word_backward;
|
|
572
585
|
if (std.ascii.eqlIgnoreCase(event.key, "delete")) return .delete_word_forward;
|
|
573
586
|
return null;
|
|
574
587
|
}
|
|
575
588
|
|
|
589
|
+
fn widgetKeyboardLineDeleteTextEditEvent(event: WidgetKeyboardEvent) ?TextInputEvent {
|
|
590
|
+
return widgetKeyboardLineDeleteTextEditEventForPlatform(builtin.os.tag, event);
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
fn widgetKeyboardLineDeleteTextEditEventForPlatform(comptime os_tag: @TypeOf(builtin.os.tag), event: WidgetKeyboardEvent) ?TextInputEvent {
|
|
594
|
+
// Command+Backspace is Cocoa's deleteToBeginningOfLine:. Keep it
|
|
595
|
+
// macOS-only: elsewhere Primary is Ctrl and belongs to word delete.
|
|
596
|
+
// Textareas deliberately use the hard newline boundary in v1; visual
|
|
597
|
+
// soft-wrap deletion can layer on runtime geometry in a follow-up.
|
|
598
|
+
if (comptime os_tag != .macos) return null;
|
|
599
|
+
if (!event.modifiers.super or event.modifiers.control or event.modifiers.alt) return null;
|
|
600
|
+
if (std.ascii.eqlIgnoreCase(event.key, "backspace")) return .delete_to_line_start;
|
|
601
|
+
return null;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
/// Resolve the generic keyboard vocabulary against a concrete editor kind.
|
|
605
|
+
/// A single-line field presents model-provided line breaks as spaces, so its
|
|
606
|
+
/// Command+Backspace target is always offset 0; a textarea keeps the hard-line
|
|
607
|
+
/// boundary carried by `.delete_to_line_start`.
|
|
608
|
+
pub fn widgetKeyboardTextEditEventForWidget(widget: Widget, event: WidgetKeyboardEvent) ?TextInputEvent {
|
|
609
|
+
const edit = event.textEditEvent() orelse return null;
|
|
610
|
+
if (edit == .delete_to_line_start and widgetKindSingleLineTextEntry(widget.kind)) return .delete_to_start;
|
|
611
|
+
return edit;
|
|
612
|
+
}
|
|
613
|
+
|
|
576
614
|
fn widgetKeyboardSelectAllTextEditEvent(event: WidgetKeyboardEvent) ?TextInputEvent {
|
|
577
615
|
if (!event.modifiers.hasCommandModifier() or event.modifiers.alt or event.modifiers.shift) return null;
|
|
578
616
|
if (!std.ascii.eqlIgnoreCase(event.key, "a")) return null;
|
|
@@ -710,6 +748,9 @@ fn widgetSemanticPressControlIntent(widget: Widget, actions: WidgetActions) Widg
|
|
|
710
748
|
}
|
|
711
749
|
|
|
712
750
|
pub fn isWidgetActivationKey(key: []const u8) bool {
|
|
751
|
+
// Host adapters normalize the physical Return key to "enter" before
|
|
752
|
+
// it reaches this canonical event vocabulary. AppKit maps both its
|
|
753
|
+
// carriage-return key event and insertNewline: selector to that name.
|
|
713
754
|
return std.ascii.eqlIgnoreCase(key, "space") or std.ascii.eqlIgnoreCase(key, "enter");
|
|
714
755
|
}
|
|
715
756
|
|
|
@@ -727,6 +768,43 @@ pub fn isWidgetTextEntry(widget: Widget) bool {
|
|
|
727
768
|
};
|
|
728
769
|
}
|
|
729
770
|
|
|
771
|
+
test "line delete is macOS-only and folded Ctrl-primary remains word delete elsewhere" {
|
|
772
|
+
const command_backspace = WidgetKeyboardEvent{
|
|
773
|
+
.phase = .key_down,
|
|
774
|
+
.key = "backspace",
|
|
775
|
+
.modifiers = .{ .super = true },
|
|
776
|
+
};
|
|
777
|
+
try std.testing.expectEqual(TextInputEvent.delete_to_line_start, widgetKeyboardLineDeleteTextEditEventForPlatform(.macos, command_backspace).?);
|
|
778
|
+
try std.testing.expect(widgetKeyboardLineDeleteTextEditEventForPlatform(.linux, command_backspace) == null);
|
|
779
|
+
try std.testing.expect(widgetKeyboardLineDeleteTextEditEventForPlatform(.windows, command_backspace) == null);
|
|
780
|
+
|
|
781
|
+
const folded_control_backspace = WidgetKeyboardEvent{
|
|
782
|
+
.phase = .key_down,
|
|
783
|
+
.key = "backspace",
|
|
784
|
+
.modifiers = .{ .super = true, .control = true },
|
|
785
|
+
};
|
|
786
|
+
try std.testing.expect(widgetKeyboardWordDeleteTextEditEventForPlatform(.macos, folded_control_backspace) == null);
|
|
787
|
+
try std.testing.expectEqual(TextInputEvent.delete_word_backward, widgetKeyboardWordDeleteTextEditEventForPlatform(.linux, folded_control_backspace).?);
|
|
788
|
+
try std.testing.expectEqual(TextInputEvent.delete_word_backward, widgetKeyboardWordDeleteTextEditEventForPlatform(.windows, folded_control_backspace).?);
|
|
789
|
+
|
|
790
|
+
const shifted_command_backspace = WidgetKeyboardEvent{
|
|
791
|
+
.phase = .key_down,
|
|
792
|
+
.key = "backspace",
|
|
793
|
+
.modifiers = .{ .super = true, .shift = true },
|
|
794
|
+
};
|
|
795
|
+
try std.testing.expectEqual(TextInputEvent.delete_to_line_start, widgetKeyboardLineDeleteTextEditEventForPlatform(.macos, shifted_command_backspace).?);
|
|
796
|
+
|
|
797
|
+
// Widget-kind resolution is downstream of platform recognition. Stamp
|
|
798
|
+
// the recognized semantic edit so these assertions stay host-neutral;
|
|
799
|
+
// the explicit-platform assertions above own the macOS chord mapping.
|
|
800
|
+
const recognized_line_delete = WidgetKeyboardEvent{
|
|
801
|
+
.phase = .key_down,
|
|
802
|
+
.edit = .delete_to_line_start,
|
|
803
|
+
};
|
|
804
|
+
try std.testing.expectEqual(TextInputEvent.delete_to_start, widgetKeyboardTextEditEventForWidget(.{ .kind = .input }, recognized_line_delete).?);
|
|
805
|
+
try std.testing.expectEqual(TextInputEvent.delete_to_line_start, widgetKeyboardTextEditEventForWidget(.{ .kind = .textarea }, recognized_line_delete).?);
|
|
806
|
+
}
|
|
807
|
+
|
|
730
808
|
/// The arrow keys that open a closed select/combobox trigger's picker
|
|
731
809
|
/// (and, once it is mounted, walk into it).
|
|
732
810
|
pub fn isWidgetMenuOpenArrowKey(key: []const u8) bool {
|
|
@@ -645,6 +645,7 @@ pub const WidgetClipboardAction = event_model.WidgetClipboardAction;
|
|
|
645
645
|
pub const widgetKeyboardClipboardAction = event_model.widgetKeyboardClipboardAction;
|
|
646
646
|
pub const widgetKeyboardNewlineTextEditEvent = event_model.widgetKeyboardNewlineTextEditEvent;
|
|
647
647
|
pub const widgetCodeTabTextEditEvent = event_model.widgetCodeTabTextEditEvent;
|
|
648
|
+
pub const widgetKeyboardTextEditEventForWidget = event_model.widgetKeyboardTextEditEventForWidget;
|
|
648
649
|
pub const widgetKindSingleLineTextEntry = event_model.widgetKindSingleLineTextEntry;
|
|
649
650
|
pub const sanitizedSingleLineTextInputEvent = event_model.sanitizedSingleLineTextInputEvent;
|
|
650
651
|
pub const widgetKeyboardControlIntent = event_model.widgetKeyboardControlIntent;
|
|
@@ -103,6 +103,8 @@ pub const TextInputEvent = union(enum) {
|
|
|
103
103
|
delete_forward,
|
|
104
104
|
delete_word_backward,
|
|
105
105
|
delete_word_forward,
|
|
106
|
+
delete_to_start,
|
|
107
|
+
delete_to_line_start,
|
|
106
108
|
clear,
|
|
107
109
|
move_caret: TextCaretMove,
|
|
108
110
|
set_selection: TextSelection,
|
|
@@ -136,6 +138,8 @@ pub fn applyTextInputEvent(state: TextEditState, event: TextInputEvent, output:
|
|
|
136
138
|
.delete_forward => deleteForwardTextEdit(normalized, output),
|
|
137
139
|
.delete_word_backward => deleteWordBackwardTextEdit(normalized, output),
|
|
138
140
|
.delete_word_forward => deleteWordForwardTextEdit(normalized, output),
|
|
141
|
+
.delete_to_start => deleteToStartTextEdit(normalized, output),
|
|
142
|
+
.delete_to_line_start => deleteToLineStartTextEdit(normalized, output),
|
|
139
143
|
.clear => .{
|
|
140
144
|
.text = "",
|
|
141
145
|
.selection = TextSelection.collapsed(0),
|
|
@@ -251,6 +255,25 @@ fn deleteWordForwardTextEdit(state: TextEditState, output: []u8) Error!TextEditS
|
|
|
251
255
|
return replaceTextEditRange(state, TextRange.init(caret, nextTextWordOffset(state.text, caret)), "", output, null, 0);
|
|
252
256
|
}
|
|
253
257
|
|
|
258
|
+
fn deleteToStartTextEdit(state: TextEditState, output: []u8) Error!TextEditState {
|
|
259
|
+
const range = activeTextReplaceRange(state);
|
|
260
|
+
if (!range.isCollapsed(state.text.len)) return replaceTextEditRange(state, range, "", output, null, 0);
|
|
261
|
+
|
|
262
|
+
const caret = snapTextCaretOffset(state.text, state.selection.focus);
|
|
263
|
+
if (caret == 0) return .{ .text = state.text, .selection = TextSelection.collapsed(0), .composition = null };
|
|
264
|
+
return replaceTextEditRange(state, TextRange.init(0, caret), "", output, null, 0);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
fn deleteToLineStartTextEdit(state: TextEditState, output: []u8) Error!TextEditState {
|
|
268
|
+
const range = activeTextReplaceRange(state);
|
|
269
|
+
if (!range.isCollapsed(state.text.len)) return replaceTextEditRange(state, range, "", output, null, 0);
|
|
270
|
+
|
|
271
|
+
const caret = snapTextCaretOffset(state.text, state.selection.focus);
|
|
272
|
+
const line_start = textLineStartOffset(state.text, caret);
|
|
273
|
+
if (line_start == caret) return .{ .text = state.text, .selection = TextSelection.collapsed(caret), .composition = null };
|
|
274
|
+
return replaceTextEditRange(state, TextRange.init(line_start, caret), "", output, null, 0);
|
|
275
|
+
}
|
|
276
|
+
|
|
254
277
|
fn moveTextCaret(state: TextEditState, move: TextCaretMove) TextEditState {
|
|
255
278
|
const range = state.selection.range(state.text.len);
|
|
256
279
|
const focus = snapTextCaretOffset(state.text, state.selection.focus);
|
|
@@ -429,6 +429,31 @@ test "text edit state applies utf8-aware caret insert and delete events" {
|
|
|
429
429
|
try std.testing.expectEqualStrings(" cafe", state.text);
|
|
430
430
|
try std.testing.expectEqualDeep(TextSelection.collapsed(0), state.selection);
|
|
431
431
|
|
|
432
|
+
state = TextEditState{ .text = "first\nsecond line", .selection = TextSelection.collapsed(12) };
|
|
433
|
+
state = try state.apply(.delete_to_start, &storage_b);
|
|
434
|
+
try std.testing.expectEqualStrings(" line", state.text);
|
|
435
|
+
try std.testing.expectEqualDeep(TextSelection.collapsed(0), state.selection);
|
|
436
|
+
|
|
437
|
+
state = TextEditState{ .text = "first\nsecond line", .selection = TextSelection.collapsed(12) };
|
|
438
|
+
state = try state.apply(.delete_to_line_start, &storage_a);
|
|
439
|
+
try std.testing.expectEqualStrings("first\n line", state.text);
|
|
440
|
+
try std.testing.expectEqualDeep(TextSelection.collapsed(6), state.selection);
|
|
441
|
+
|
|
442
|
+
state = TextEditState{ .text = "first\nsecond", .selection = TextSelection.collapsed(6) };
|
|
443
|
+
state = try state.apply(.delete_to_line_start, &storage_b);
|
|
444
|
+
try std.testing.expectEqualStrings("first\nsecond", state.text);
|
|
445
|
+
try std.testing.expectEqualDeep(TextSelection.collapsed(6), state.selection);
|
|
446
|
+
|
|
447
|
+
state = TextEditState{ .text = "first\nsecond", .selection = .{ .anchor = 7, .focus = 10 } };
|
|
448
|
+
state = try state.apply(.delete_to_line_start, &storage_a);
|
|
449
|
+
try std.testing.expectEqualStrings("first\nsnd", state.text);
|
|
450
|
+
try std.testing.expectEqualDeep(TextSelection.collapsed(7), state.selection);
|
|
451
|
+
|
|
452
|
+
state = TextEditState{ .text = "one\r\ntwo", .selection = TextSelection.collapsed(8) };
|
|
453
|
+
state = try state.apply(.delete_to_line_start, &storage_b);
|
|
454
|
+
try std.testing.expectEqualStrings("one\r\n", state.text);
|
|
455
|
+
try std.testing.expectEqualDeep(TextSelection.collapsed(5), state.selection);
|
|
456
|
+
|
|
432
457
|
state = TextEditState.init("");
|
|
433
458
|
state = try state.apply(.{ .insert_text = "AxB" }, &storage_b);
|
|
434
459
|
try std.testing.expectEqualStrings("AxB", state.text);
|
|
@@ -732,6 +757,26 @@ test "widget keyboard events map to text edit events" {
|
|
|
732
757
|
try std.testing.expectEqualStrings("hello brave ", nav_state.text);
|
|
733
758
|
try std.testing.expectEqualDeep(TextSelection.collapsed(12), nav_state.selection);
|
|
734
759
|
|
|
760
|
+
const command_backspace = (WidgetKeyboardEvent{ .phase = .key_down, .key = "backspace", .modifiers = .{ .super = true } }).textEditEvent();
|
|
761
|
+
if (comptime @import("builtin").os.tag == .macos) {
|
|
762
|
+
try std.testing.expectEqual(TextInputEvent.delete_to_line_start, command_backspace.?);
|
|
763
|
+
} else {
|
|
764
|
+
try std.testing.expect(command_backspace == null);
|
|
765
|
+
}
|
|
766
|
+
const shifted_command_backspace = (WidgetKeyboardEvent{ .phase = .key_down, .key = "backspace", .modifiers = .{ .super = true, .shift = true } }).textEditEvent();
|
|
767
|
+
if (comptime @import("builtin").os.tag == .macos) {
|
|
768
|
+
try std.testing.expectEqual(TextInputEvent.delete_to_line_start, shifted_command_backspace.?);
|
|
769
|
+
} else {
|
|
770
|
+
try std.testing.expect(shifted_command_backspace == null);
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
const folded_control_backspace = (WidgetKeyboardEvent{ .phase = .key_down, .key = "backspace", .modifiers = .{ .super = true, .control = true } }).textEditEvent();
|
|
774
|
+
if (comptime @import("builtin").os.tag == .macos) {
|
|
775
|
+
try std.testing.expect(folded_control_backspace == null);
|
|
776
|
+
} else {
|
|
777
|
+
try std.testing.expectEqual(TextInputEvent.delete_word_backward, folded_control_backspace.?);
|
|
778
|
+
}
|
|
779
|
+
|
|
735
780
|
nav_state = TextEditState{ .text = "hello brave world", .selection = TextSelection.collapsed(0) };
|
|
736
781
|
const control_delete = (WidgetKeyboardEvent{ .phase = .key_down, .key = "delete", .modifiers = .{ .control = true } }).textEditEvent().?;
|
|
737
782
|
nav_state = try nav_state.apply(control_delete, &nav_storage);
|
|
@@ -1044,6 +1044,8 @@ pub fn Ui(comptime Msg: type) type {
|
|
|
1044
1044
|
.delete_forward => @unionInit(Payload, "delete_forward", {}),
|
|
1045
1045
|
.delete_word_backward => @unionInit(Payload, "delete_word_backward", {}),
|
|
1046
1046
|
.delete_word_forward => @unionInit(Payload, "delete_word_forward", {}),
|
|
1047
|
+
.delete_to_start => @unionInit(Payload, "delete_to_start", {}),
|
|
1048
|
+
.delete_to_line_start => @unionInit(Payload, "delete_to_line_start", {}),
|
|
1047
1049
|
.clear => @unionInit(Payload, "clear", {}),
|
|
1048
1050
|
.move_caret => |move| blk: {
|
|
1049
1051
|
const Move = @FieldType(Payload, "move_caret");
|
|
@@ -1471,13 +1473,14 @@ pub fn Ui(comptime Msg: type) type {
|
|
|
1471
1473
|
if (widget.semantics.role == .treeitem and keyboard.focus_moved) {
|
|
1472
1474
|
if (self.msgFor(target_id, .change)) |msg| return msg;
|
|
1473
1475
|
}
|
|
1474
|
-
//
|
|
1475
|
-
//
|
|
1476
|
-
//
|
|
1477
|
-
// while Space
|
|
1478
|
-
//
|
|
1479
|
-
//
|
|
1480
|
-
|
|
1476
|
+
// List rows and comboboxes prefer a bound submit handler
|
|
1477
|
+
// on plain Enter before their activation intent: Enter is
|
|
1478
|
+
// the row's PRIMARY action or commits the combobox text,
|
|
1479
|
+
// while Space and the combobox open arrows keep the
|
|
1480
|
+
// activation below. Only widgets that bind `on_submit`
|
|
1481
|
+
// return from this branch; everything else resolves
|
|
1482
|
+
// exactly as before.
|
|
1483
|
+
if ((widget.kind == .list_item or widget.kind == .combobox) and isSubmitKeyboard(widget, keyboard)) {
|
|
1481
1484
|
if (self.msgFor(target_id, .submit)) |msg| return msg;
|
|
1482
1485
|
}
|
|
1483
1486
|
if (canvas.widgetKeyboardControlIntent(widget, keyboard)) |intent| {
|
|
@@ -1510,7 +1513,7 @@ pub fn Ui(comptime Msg: type) type {
|
|
|
1510
1513
|
} else {
|
|
1511
1514
|
const locally_derived = canvas.widgetCodeTabTextEditEvent(widget, keyboard) orelse
|
|
1512
1515
|
canvas.widgetKeyboardNewlineTextEditEvent(widget, keyboard) orelse
|
|
1513
|
-
|
|
1516
|
+
canvas.widgetKeyboardTextEditEventForWidget(widget, keyboard);
|
|
1514
1517
|
if (locally_derived) |text_edit| {
|
|
1515
1518
|
// Direct Tree consumers still sanitize locally:
|
|
1516
1519
|
// these bytes have not crossed the runtime seam.
|
|
@@ -993,6 +993,9 @@ test "compiled catalog elements match the interpreter and the hand-written view"
|
|
|
993
993
|
interpreted.msgForKeyboard(input.id, submit).?,
|
|
994
994
|
compiled.msgForKeyboard(input.id, submit).?,
|
|
995
995
|
);
|
|
996
|
+
const combobox = fixture.findByKind(compiled.root, .combobox).?;
|
|
997
|
+
try testing.expectEqual(fixture.CatalogMsg.submit_query, compiled.msgForKeyboard(combobox.id, submit).?);
|
|
998
|
+
try testing.expectEqual(fixture.CatalogMsg.open_picker, compiled.msgForKeyboard(combobox.id, .{ .phase = .key_down, .key = "space" }).?);
|
|
996
999
|
}
|
|
997
1000
|
|
|
998
1001
|
test "compiled catalog stays in parity when conditional surfaces flip" {
|
|
@@ -106,9 +106,10 @@ pub fn isZeroArgFn(comptime T: type, comptime DeclType: type) bool {
|
|
|
106
106
|
/// declared-shape predicate below stays std-only. A drift test in
|
|
107
107
|
/// `ui_markup_contract_tests.zig` holds this list equal to the real union.
|
|
108
108
|
pub const text_input_event_tags = [_][]const u8{
|
|
109
|
-
"insert_text", "delete_backward",
|
|
110
|
-
"delete_word_forward", "
|
|
111
|
-
"
|
|
109
|
+
"insert_text", "delete_backward", "delete_forward", "delete_word_backward",
|
|
110
|
+
"delete_word_forward", "delete_to_start", "delete_to_line_start", "clear",
|
|
111
|
+
"move_caret", "set_selection", "set_composition", "commit_composition",
|
|
112
|
+
"cancel_composition",
|
|
112
113
|
};
|
|
113
114
|
|
|
114
115
|
/// The caret-direction member vocabulary (`canvas.TextCaretDirection`).
|
|
@@ -125,8 +126,8 @@ pub const text_caret_affinity_members = [_][]const u8{
|
|
|
125
126
|
/// where the emitted module declares its own mirror union (type identity
|
|
126
127
|
/// cannot cross the emission boundary). Matched structurally, by the same
|
|
127
128
|
/// contract everywhere markup resolves `on-input`:
|
|
128
|
-
/// - a tagged union carrying exactly the
|
|
129
|
-
/// - `insert_text` a bytes payload; the
|
|
129
|
+
/// - a tagged union carrying exactly the thirteen canvas event tags;
|
|
130
|
+
/// - `insert_text` a bytes payload; the nine verb arms void;
|
|
130
131
|
/// - `move_caret` a record of `direction` (an enum with exactly the six
|
|
131
132
|
/// caret-direction member names) and `extend: bool`;
|
|
132
133
|
/// - `set_selection` a record of numeric `anchor`/`focus`, optionally
|