@native-sdk/cli 0.8.2 → 0.8.3
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.zig +3 -0
- package/package.json +9 -9
- package/packages/core/package-lock.json +2 -2
- package/packages/core/package.json +1 -1
- package/src/app_runner/app_assets.zig +138 -0
- package/src/app_runner/root.zig +2 -0
- package/src/app_runner/ts_core_main.zig +2 -1
- package/src/primitives/canvas/widget_render.zig +25 -1
- package/src/primitives/canvas/widget_runtime_tests.zig +40 -0
- package/src/primitives/canvas/widgets.zig +12 -0
- package/src/runtime/canvas_widget_event_tests.zig +1 -0
- package/src/runtime/canvas_widget_state.zig +4 -0
- package/src/tooling/package.zig +4 -4
package/build.zig
CHANGED
|
@@ -102,6 +102,7 @@ pub fn build(b: *std.Build) void {
|
|
|
102
102
|
const diagnostics_mod = module(b, target, optimize, "src/primitives/diagnostics/root.zig");
|
|
103
103
|
const platform_info_mod = module(b, target, optimize, "src/primitives/platform_info/root.zig");
|
|
104
104
|
const json_mod = module(b, target, optimize, "src/primitives/json/root.zig");
|
|
105
|
+
const app_runner_assets_mod = module(b, target, optimize, "src/app_runner/app_assets.zig");
|
|
105
106
|
const canvas_mod = module(b, target, optimize, "src/primitives/canvas/root.zig");
|
|
106
107
|
canvas_mod.addImport("geometry", geometry_mod);
|
|
107
108
|
canvas_mod.addImport("json", json_mod);
|
|
@@ -126,6 +127,7 @@ pub fn build(b: *std.Build) void {
|
|
|
126
127
|
const diagnostics_tests = testArtifact(b, diagnostics_mod);
|
|
127
128
|
const platform_info_tests = testArtifact(b, platform_info_mod);
|
|
128
129
|
const json_tests = testArtifact(b, json_mod);
|
|
130
|
+
const app_runner_assets_tests = testArtifact(b, app_runner_assets_mod);
|
|
129
131
|
const canvas_tests = testArtifact(b, canvas_mod);
|
|
130
132
|
|
|
131
133
|
const desktop_mod = module(b, target, optimize, "src/root.zig");
|
|
@@ -468,6 +470,7 @@ pub fn build(b: *std.Build) void {
|
|
|
468
470
|
test_step.dependOn(&b.addRunArtifact(diagnostics_tests).step);
|
|
469
471
|
test_step.dependOn(&b.addRunArtifact(platform_info_tests).step);
|
|
470
472
|
test_step.dependOn(&b.addRunArtifact(json_tests).step);
|
|
473
|
+
test_step.dependOn(&b.addRunArtifact(app_runner_assets_tests).step);
|
|
471
474
|
test_step.dependOn(&b.addRunArtifact(canvas_tests).step);
|
|
472
475
|
for (desktop_test_shards) |shard_tests| {
|
|
473
476
|
test_step.dependOn(&b.addRunArtifact(shard_tests).step);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@native-sdk/cli",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.3",
|
|
4
4
|
"description": "The Native SDK: the complete toolkit for building native desktop applications — declarative markup, native rendering, WebView surfaces, and OS capabilities",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -34,14 +34,14 @@
|
|
|
34
34
|
"scriptc": "0.0.22"
|
|
35
35
|
},
|
|
36
36
|
"optionalDependencies": {
|
|
37
|
-
"@native-sdk/cli-darwin-arm64": "0.8.
|
|
38
|
-
"@native-sdk/cli-darwin-x64": "0.8.
|
|
39
|
-
"@native-sdk/cli-linux-arm64-gnu": "0.8.
|
|
40
|
-
"@native-sdk/cli-linux-arm64-musl": "0.8.
|
|
41
|
-
"@native-sdk/cli-linux-x64-gnu": "0.8.
|
|
42
|
-
"@native-sdk/cli-linux-x64-musl": "0.8.
|
|
43
|
-
"@native-sdk/cli-win32-arm64": "0.8.
|
|
44
|
-
"@native-sdk/cli-win32-x64": "0.8.
|
|
37
|
+
"@native-sdk/cli-darwin-arm64": "0.8.3",
|
|
38
|
+
"@native-sdk/cli-darwin-x64": "0.8.3",
|
|
39
|
+
"@native-sdk/cli-linux-arm64-gnu": "0.8.3",
|
|
40
|
+
"@native-sdk/cli-linux-arm64-musl": "0.8.3",
|
|
41
|
+
"@native-sdk/cli-linux-x64-gnu": "0.8.3",
|
|
42
|
+
"@native-sdk/cli-linux-x64-musl": "0.8.3",
|
|
43
|
+
"@native-sdk/cli-win32-arm64": "0.8.3",
|
|
44
|
+
"@native-sdk/cli-win32-x64": "0.8.3"
|
|
45
45
|
},
|
|
46
46
|
"repository": {
|
|
47
47
|
"type": "git",
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@native-sdk/core",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.3",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@native-sdk/core",
|
|
9
|
-
"version": "0.8.
|
|
9
|
+
"version": "0.8.3",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"scriptc": "0.0.22"
|
|
12
12
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@native-sdk/core",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.3",
|
|
4
4
|
"description": "The TypeScript authoring tier: the app-core subset, its checker and contract frontend, the exact-pinned core compiler dependency, and the SDK module cores import",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
//! Startup asset reads shared by generated app runners.
|
|
2
|
+
//!
|
|
3
|
+
//! Relative paths keep their app-directory meaning during development. In a
|
|
4
|
+
//! packaged macOS app, the same tree lives below `Contents/Resources`; Finder
|
|
5
|
+
//! and `open` do not preserve a useful working directory, so resolve that tree
|
|
6
|
+
//! from the executable's bundle layout before reading it.
|
|
7
|
+
|
|
8
|
+
const std = @import("std");
|
|
9
|
+
const builtin = @import("builtin");
|
|
10
|
+
|
|
11
|
+
pub fn readFileAlloc(
|
|
12
|
+
io: std.Io,
|
|
13
|
+
path: []const u8,
|
|
14
|
+
allocator: std.mem.Allocator,
|
|
15
|
+
limit: std.Io.Limit,
|
|
16
|
+
) std.Io.Dir.ReadFileAllocError![]u8 {
|
|
17
|
+
if (comptime builtin.os.tag == .macos) {
|
|
18
|
+
var executable_buffer: [std.Io.Dir.max_path_bytes]u8 = undefined;
|
|
19
|
+
const executable_len = std.process.executablePath(io, &executable_buffer) catch
|
|
20
|
+
return std.Io.Dir.cwd().readFileAlloc(io, path, allocator, limit);
|
|
21
|
+
return readFileAllocFromMacosExecutable(
|
|
22
|
+
io,
|
|
23
|
+
executable_buffer[0..executable_len],
|
|
24
|
+
path,
|
|
25
|
+
allocator,
|
|
26
|
+
limit,
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return std.Io.Dir.cwd().readFileAlloc(io, path, allocator, limit);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
pub fn readFileAllocFromMacosExecutable(
|
|
34
|
+
io: std.Io,
|
|
35
|
+
executable_path: []const u8,
|
|
36
|
+
path: []const u8,
|
|
37
|
+
allocator: std.mem.Allocator,
|
|
38
|
+
limit: std.Io.Limit,
|
|
39
|
+
) std.Io.Dir.ReadFileAllocError![]u8 {
|
|
40
|
+
var bundled_path_buffer: [std.Io.Dir.max_path_bytes]u8 = undefined;
|
|
41
|
+
if (macosBundleResourcePath(executable_path, path, &bundled_path_buffer) catch null) |bundled_path| {
|
|
42
|
+
return std.Io.Dir.cwd().readFileAlloc(io, bundled_path, allocator, limit) catch |err| switch (err) {
|
|
43
|
+
// Match the platform host's asset resolver: a package miss keeps
|
|
44
|
+
// the old cwd-relative behavior, while a real read failure is not
|
|
45
|
+
// hidden by a second lookup.
|
|
46
|
+
error.FileNotFound => std.Io.Dir.cwd().readFileAlloc(io, path, allocator, limit),
|
|
47
|
+
else => |read_err| read_err,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
return std.Io.Dir.cwd().readFileAlloc(io, path, allocator, limit);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
pub fn macosBundleResourcePath(
|
|
54
|
+
executable_path: []const u8,
|
|
55
|
+
asset_path: []const u8,
|
|
56
|
+
output: []u8,
|
|
57
|
+
) error{NoSpaceLeft}!?[]const u8 {
|
|
58
|
+
if (asset_path.len == 0 or std.fs.path.isAbsolutePosix(asset_path)) return null;
|
|
59
|
+
|
|
60
|
+
const executable_dir = std.fs.path.dirnamePosix(executable_path) orelse return null;
|
|
61
|
+
if (!std.mem.eql(u8, std.fs.path.basenamePosix(executable_dir), "MacOS")) return null;
|
|
62
|
+
|
|
63
|
+
const contents_dir = std.fs.path.dirnamePosix(executable_dir) orelse return null;
|
|
64
|
+
if (!std.mem.eql(u8, std.fs.path.basenamePosix(contents_dir), "Contents")) return null;
|
|
65
|
+
|
|
66
|
+
const bundle_dir = std.fs.path.dirnamePosix(contents_dir) orelse return null;
|
|
67
|
+
if (!std.ascii.eqlIgnoreCase(std.fs.path.extension(bundle_dir), ".app")) return null;
|
|
68
|
+
|
|
69
|
+
return std.fmt.bufPrint(output, "{s}/Resources/{s}", .{ contents_dir, asset_path }) catch
|
|
70
|
+
error.NoSpaceLeft;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
test "macOS bundle resource path mirrors the app-relative asset tree" {
|
|
74
|
+
var buffer: [256]u8 = undefined;
|
|
75
|
+
const resolved = (try macosBundleResourcePath(
|
|
76
|
+
"/Applications/Kanban.app/Contents/MacOS/kanban",
|
|
77
|
+
"assets/logos/openai-svgl.png",
|
|
78
|
+
&buffer,
|
|
79
|
+
)).?;
|
|
80
|
+
try std.testing.expectEqualStrings(
|
|
81
|
+
"/Applications/Kanban.app/Contents/Resources/assets/logos/openai-svgl.png",
|
|
82
|
+
resolved,
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
const uppercase = (try macosBundleResourcePath(
|
|
86
|
+
"/Applications/Kanban.APP/Contents/MacOS/kanban",
|
|
87
|
+
"assets/logo.png",
|
|
88
|
+
&buffer,
|
|
89
|
+
)).?;
|
|
90
|
+
try std.testing.expectEqualStrings(
|
|
91
|
+
"/Applications/Kanban.APP/Contents/Resources/assets/logo.png",
|
|
92
|
+
uppercase,
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
try std.testing.expectEqual(null, try macosBundleResourcePath(
|
|
96
|
+
"/tmp/kanban",
|
|
97
|
+
"assets/logo.png",
|
|
98
|
+
&buffer,
|
|
99
|
+
));
|
|
100
|
+
try std.testing.expectEqual(null, try macosBundleResourcePath(
|
|
101
|
+
"/Applications/Kanban.app/Contents/Helpers/kanban",
|
|
102
|
+
"assets/logo.png",
|
|
103
|
+
&buffer,
|
|
104
|
+
));
|
|
105
|
+
try std.testing.expectEqual(null, try macosBundleResourcePath(
|
|
106
|
+
"/Applications/Kanban.app/Contents/MacOS/kanban",
|
|
107
|
+
"/tmp/logo.png",
|
|
108
|
+
&buffer,
|
|
109
|
+
));
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
test "packaged macOS startup assets read from Contents Resources" {
|
|
113
|
+
var tmp = std.testing.tmpDir(.{});
|
|
114
|
+
defer tmp.cleanup();
|
|
115
|
+
|
|
116
|
+
const resource_dir = "Kanban.app/Contents/Resources/assets/logos";
|
|
117
|
+
try tmp.dir.createDirPath(std.testing.io, resource_dir);
|
|
118
|
+
try tmp.dir.writeFile(std.testing.io, .{
|
|
119
|
+
.sub_path = resource_dir ++ "/openai.png",
|
|
120
|
+
.data = "packaged-avatar",
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
var executable_buffer: [std.Io.Dir.max_path_bytes]u8 = undefined;
|
|
124
|
+
const executable_path = try std.fmt.bufPrint(
|
|
125
|
+
&executable_buffer,
|
|
126
|
+
".zig-cache/tmp/{s}/Kanban.app/Contents/MacOS/kanban",
|
|
127
|
+
.{tmp.sub_path[0..]},
|
|
128
|
+
);
|
|
129
|
+
const bytes = try readFileAllocFromMacosExecutable(
|
|
130
|
+
std.testing.io,
|
|
131
|
+
executable_path,
|
|
132
|
+
"assets/logos/openai.png",
|
|
133
|
+
std.testing.allocator,
|
|
134
|
+
.limited(1024),
|
|
135
|
+
);
|
|
136
|
+
defer std.testing.allocator.free(bytes);
|
|
137
|
+
try std.testing.expectEqualStrings("packaged-avatar", bytes);
|
|
138
|
+
}
|
package/src/app_runner/root.zig
CHANGED
|
@@ -5,6 +5,8 @@ const app_manifest = @import("app_manifest_zon");
|
|
|
5
5
|
const manifest_shortcuts = if (@hasField(@TypeOf(app_manifest), "shortcuts")) app_manifest.shortcuts else .{};
|
|
6
6
|
const manifest_windows = if (@hasField(@TypeOf(app_manifest), "windows")) app_manifest.windows else .{};
|
|
7
7
|
|
|
8
|
+
pub const app_assets = @import("app_assets.zig");
|
|
9
|
+
|
|
8
10
|
pub const StdoutTraceSink = struct {
|
|
9
11
|
pub fn sink(self: *StdoutTraceSink) native_sdk.trace.Sink {
|
|
10
12
|
return .{ .context = self, .write_fn = write };
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
//! (native file drops with source, point, and paths).
|
|
36
36
|
//! images app.zon's `.assets.images` entries (`.{ .id = 1,
|
|
37
37
|
//! .path = "assets/..." }`) are read once at launch
|
|
38
|
+
//! (from `Contents/Resources` in a packaged macOS app)
|
|
38
39
|
//! and registered on the installing frame — the ids
|
|
39
40
|
//! are the `ImageId`s markup avatar bindings use. A
|
|
40
41
|
//! missing file or failed decode skips the entry
|
|
@@ -112,7 +113,7 @@ pub fn main(init: std.process.Init) !void {
|
|
|
112
113
|
var boot_images_buffer: [manifest_images.len]Adapter.BootImage = undefined;
|
|
113
114
|
var boot_image_count: usize = 0;
|
|
114
115
|
inline for (manifest_images) |asset| {
|
|
115
|
-
if (
|
|
116
|
+
if (runner.app_assets.readFileAlloc(init.io, asset.path, std.heap.page_allocator, .limited(max_boot_image_bytes))) |bytes| {
|
|
116
117
|
boot_images_buffer[boot_image_count] = .{ .id = asset.id, .bytes = bytes };
|
|
117
118
|
boot_image_count += 1;
|
|
118
119
|
} else |_| {}
|
|
@@ -164,11 +164,33 @@ pub fn emitWidgetLayout(builder: *Builder, layout: anytype, tokens: DesignTokens
|
|
|
164
164
|
pub fn emitWidgetLayoutWithState(builder: *Builder, layout: anytype, tokens: DesignTokens, state: WidgetRenderState) Error!void {
|
|
165
165
|
scrim_viewport = widgetLayoutRootBounds(layout);
|
|
166
166
|
try emitWidgetLayoutChildren(builder, layout, null, tokens, state);
|
|
167
|
+
try emitWidgetLayoutClipEscapingMotions(builder, layout, tokens, state);
|
|
167
168
|
try emitWidgetLayoutAnchored(builder, layout, tokens, state);
|
|
168
169
|
try emitWidgetLayoutChartHoverDetails(builder, layout, tokens, state);
|
|
169
170
|
try emitWidgetLayoutDragPreview(builder, layout, tokens, state);
|
|
170
171
|
}
|
|
171
172
|
|
|
173
|
+
/// Pointer-up replaces the window-level drag preview with a FLIP landing.
|
|
174
|
+
/// Paint that one moving subtree in the same unclipped coordinate space until
|
|
175
|
+
/// its offset reaches zero, so crossing into another scroll lane does not crop
|
|
176
|
+
/// the card at the destination lane's bounds. Other layout motions stay in the
|
|
177
|
+
/// ordinary tree walk and retain their scroll clipping.
|
|
178
|
+
fn emitWidgetLayoutClipEscapingMotions(builder: *Builder, layout: anytype, tokens: DesignTokens, state: WidgetRenderState) Error!void {
|
|
179
|
+
for (layout.nodes, 0..) |node, index| {
|
|
180
|
+
if (widget_tree.widgetIsAnchored(node.widget)) continue;
|
|
181
|
+
if (!state.layoutMotionEscapesAncestorClips(node.widget.id)) continue;
|
|
182
|
+
if (widget_tree.isWidgetHiddenInAncestors(layout, index)) continue;
|
|
183
|
+
if (widget_tree.isWidgetConcealedByDisclosure(layout, index)) continue;
|
|
184
|
+
|
|
185
|
+
const ancestor_transform = widgetLayoutNodeAncestorEmissionTransform(layout, index) orelse return error.InvalidTransform;
|
|
186
|
+
const wrap_ancestor_transform = !affinesEqual(ancestor_transform, Affine.identity());
|
|
187
|
+
const inverse_ancestor_transform = if (wrap_ancestor_transform) ancestor_transform.inverse() orelse return error.InvalidTransform else Affine.identity();
|
|
188
|
+
if (wrap_ancestor_transform) try builder.transform(ancestor_transform);
|
|
189
|
+
try emitWidgetLayoutNode(builder, layout, index, tokens, state, .none);
|
|
190
|
+
if (wrap_ancestor_transform) try builder.transform(inverse_ancestor_transform);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
172
194
|
/// Paint the active drag source in a late, window-level pass so the card under
|
|
173
195
|
/// the pointer escapes its column's clip. Normal emission suppresses this
|
|
174
196
|
/// subtree, leaving its one current layout slot blank.
|
|
@@ -586,7 +608,9 @@ fn emitWidgetLayoutChildren(
|
|
|
586
608
|
const child_index = nextWidgetLayoutPaintChild(layout, parent_index, tokens, previous) orelse return;
|
|
587
609
|
// Anchored floating children paint in the late z-pass
|
|
588
610
|
// (`emitWidgetLayoutAnchored`), never in tree position.
|
|
589
|
-
if (!widget_tree.widgetIsAnchored(layout.nodes[child_index].widget)
|
|
611
|
+
if (!widget_tree.widgetIsAnchored(layout.nodes[child_index].widget) and
|
|
612
|
+
!state.layoutMotionEscapesAncestorClips(layout.nodes[child_index].widget.id))
|
|
613
|
+
{
|
|
590
614
|
const segment = if (group_index) |index|
|
|
591
615
|
layoutButtonGroupSegment(layout, index, child_index)
|
|
592
616
|
else
|
|
@@ -2756,6 +2756,46 @@ test "widget layout emission applies presentation motion to a keyed draggable" {
|
|
|
2756
2756
|
try std.testing.expect(saw_motion_inverse);
|
|
2757
2757
|
}
|
|
2758
2758
|
|
|
2759
|
+
test "drag landing layout motion escapes its scroll lane clip" {
|
|
2760
|
+
const cards = [_]Widget{.{
|
|
2761
|
+
.id = 3,
|
|
2762
|
+
.kind = .row,
|
|
2763
|
+
.frame = geometry.RectF.init(12, 16, 120, 36),
|
|
2764
|
+
.style = .{ .background = Color.rgb8(240, 240, 240), .radius = 6 },
|
|
2765
|
+
}};
|
|
2766
|
+
const columns = [_]Widget{.{
|
|
2767
|
+
.id = 2,
|
|
2768
|
+
.kind = .scroll_view,
|
|
2769
|
+
.frame = geometry.RectF.init(10, 10, 140, 80),
|
|
2770
|
+
.children = &cards,
|
|
2771
|
+
}};
|
|
2772
|
+
var nodes: [3]WidgetLayoutNode = undefined;
|
|
2773
|
+
const layout = try layoutWidgetTree(.{ .id = 1, .kind = .panel, .children = &columns }, geometry.RectF.init(0, 0, 320, 140), &nodes);
|
|
2774
|
+
const layout_motions = [_]WidgetLayoutMotion{.{
|
|
2775
|
+
.id = 3,
|
|
2776
|
+
.offset = geometry.OffsetF.init(180, 0),
|
|
2777
|
+
.escape_ancestor_clips = true,
|
|
2778
|
+
}};
|
|
2779
|
+
|
|
2780
|
+
var commands: [16]CanvasCommand = undefined;
|
|
2781
|
+
var builder = Builder.init(&commands);
|
|
2782
|
+
try layout.emitDisplayListWithState(&builder, .{}, .{ .layout_motions = &layout_motions });
|
|
2783
|
+
|
|
2784
|
+
var clip_depth: usize = 0;
|
|
2785
|
+
var saw_landing_motion = false;
|
|
2786
|
+
for (builder.displayList().commands) |command| switch (command) {
|
|
2787
|
+
.push_clip => clip_depth += 1,
|
|
2788
|
+
.pop_clip => clip_depth -= 1,
|
|
2789
|
+
.transform => |transform| {
|
|
2790
|
+
if (!affinesEqual(transform, Affine.translate(180, 0))) continue;
|
|
2791
|
+
saw_landing_motion = true;
|
|
2792
|
+
try std.testing.expectEqual(@as(usize, 0), clip_depth);
|
|
2793
|
+
},
|
|
2794
|
+
else => {},
|
|
2795
|
+
};
|
|
2796
|
+
try std.testing.expect(saw_landing_motion);
|
|
2797
|
+
}
|
|
2798
|
+
|
|
2759
2799
|
test "input-group wears the focus ring for its focused descendant" {
|
|
2760
2800
|
const tokens = DesignTokens{};
|
|
2761
2801
|
const group_children = [_]Widget{
|
|
@@ -279,6 +279,10 @@ pub const WidgetLayoutMotion = struct {
|
|
|
279
279
|
id: ObjectId,
|
|
280
280
|
from_offset: geometry.OffsetF = .{},
|
|
281
281
|
offset: geometry.OffsetF = .{},
|
|
282
|
+
/// A drag landing begins at the pointer after the live preview has
|
|
283
|
+
/// disappeared. Hoist that one moving subtree above ancestor clips until
|
|
284
|
+
/// it settles; ordinary neighbor reflow stays clipped to its scroll lane.
|
|
285
|
+
escape_ancestor_clips: bool = false,
|
|
282
286
|
start_ns: u64 = 0,
|
|
283
287
|
duration_ms: u32 = 180,
|
|
284
288
|
easing: Easing = .emphasized,
|
|
@@ -344,6 +348,14 @@ pub const WidgetRenderState = struct {
|
|
|
344
348
|
}
|
|
345
349
|
return .{};
|
|
346
350
|
}
|
|
351
|
+
|
|
352
|
+
pub fn layoutMotionEscapesAncestorClips(self: WidgetRenderState, id: ObjectId) bool {
|
|
353
|
+
if (id == 0 or self.rendering_drag_preview) return false;
|
|
354
|
+
for (self.layout_motions) |motion| {
|
|
355
|
+
if (motion.id == id) return motion.escape_ancestor_clips;
|
|
356
|
+
}
|
|
357
|
+
return false;
|
|
358
|
+
}
|
|
347
359
|
};
|
|
348
360
|
|
|
349
361
|
pub const WidgetMainAlignment = enum {
|
|
@@ -2875,6 +2875,7 @@ test "runtime dispatches opted-in canvas widget drag events" {
|
|
|
2875
2875
|
try std.testing.expectEqual(@as(canvas.ObjectId, 2), motion_state.layout_motions[0].id);
|
|
2876
2876
|
try std.testing.expectEqual(@as(f32, 44), motion_state.layout_motions[0].offset.dx);
|
|
2877
2877
|
try std.testing.expectEqual(@as(f32, -40), motion_state.layout_motions[0].offset.dy);
|
|
2878
|
+
try std.testing.expect(motion_state.layout_motions[0].escape_ancestor_clips);
|
|
2878
2879
|
try harness.runtime.advanceCanvasWidgetDragLayoutMotionForFrame(0, 1_000_000_000);
|
|
2879
2880
|
motion_state = harness.runtime.views[0].canvasWidgetRenderState();
|
|
2880
2881
|
try std.testing.expectEqual(@as(f32, 44), motion_state.layout_motions[0].offset.dx);
|
|
@@ -564,6 +564,10 @@ pub fn RuntimeCanvasWidgetState(comptime Runtime: type) type {
|
|
|
564
564
|
.id = id,
|
|
565
565
|
.from_offset = offset,
|
|
566
566
|
.offset = offset,
|
|
567
|
+
// The terminal source replaces a window-level floating
|
|
568
|
+
// preview, so keep it above both its old and new lane's
|
|
569
|
+
// clips until it reaches the committed slot.
|
|
570
|
+
.escape_ancestor_clips = view.canvas_widget_drag_landing_source_id == id,
|
|
567
571
|
.duration_ms = duration_ms,
|
|
568
572
|
.easing = .emphasized,
|
|
569
573
|
.spring = view.widget_tokens.motion.spring,
|
package/src/tooling/package.zig
CHANGED
|
@@ -623,10 +623,10 @@ fn assetOutputPath(allocator: std.mem.Allocator, output_path: []const u8, resour
|
|
|
623
623
|
/// app-relative path — Resources/assets by default — so a relative asset
|
|
624
624
|
/// path the app uses at runtime ("assets/music/track.mp3") names the
|
|
625
625
|
/// same file inside the bundle that it names in a dev run: the packaged
|
|
626
|
-
/// macOS host
|
|
627
|
-
/// absolute or parent-escaping --assets directory has no
|
|
628
|
-
/// meaning a packaged process could resolve, so it keeps the
|
|
629
|
-
/// Resources layout.
|
|
626
|
+
/// generated runner and macOS host resolve relative asset paths against
|
|
627
|
+
/// Resources. An absolute or parent-escaping --assets directory has no
|
|
628
|
+
/// app-relative meaning a packaged process could resolve, so it keeps the
|
|
629
|
+
/// flat Resources layout.
|
|
630
630
|
fn macosAssetOutputPath(allocator: std.mem.Allocator, options: PackageOptions) ![]const u8 {
|
|
631
631
|
if (options.frontend != null) return assetOutputPath(allocator, options.output_path, "Contents/Resources", options);
|
|
632
632
|
if (appRelativeAssetSubpath(options.assets_dir)) |subpath| {
|