craft-native 0.0.238 → 0.0.242
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/dist/android/src/index.d.ts +23 -1
- package/dist/android/src/index.js +102 -9
- package/dist/android/src/native-map.d.ts +7 -0
- package/dist/android/templates/CraftBridge.kt.template +2 -1
- package/dist/android/templates/CraftNativeBackground.kt.template +28 -2
- package/dist/android/templates/CraftNativeMapGoogle.kt.template +440 -0
- package/dist/android/templates/CraftNativeMapLibre.kt.template +438 -0
- package/dist/android/templates/CraftNativeMessagingService.kt.template +3 -1
- package/dist/android/templates/CraftNativeNotificationReceiver.kt.template +2 -1
- package/dist/android/templates/LocationRecordingService.kt.template +3 -1
- package/dist/android/templates/MainActivityNative.kt.template +14 -433
- package/dist/android/templates/build.gradle.kts.app.template +1 -1
- package/dist/android/templates/build.gradle.kts.project.template +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/ios/src/index.d.ts +12 -1
- package/dist/ios/src/index.js +32 -7
- package/dist/ios/src/testing.d.ts +14 -2
- package/dist/ios/templates/CraftApp.swift +117 -29
- package/dist/ios/templates/CraftHybrid.swift +193 -29
- package/dist/ios/templates/CraftNativeActions.swift +26 -27
- package/dist/ios/templates/CraftNativeFiles.swift +205 -1
- package/dist/ios/templates/CraftNativeScreen.swift +230 -33
- package/dist/ios/templates/testing/DriverTests.swift.template +37 -0
- package/dist/macos/templates/native_layout.zig +41 -5
- package/package.json +1 -1
|
@@ -32,15 +32,18 @@ pub const AlignItems = enum {
|
|
|
32
32
|
baseline,
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
-
/// Cross-axis distribution between wrapped flex lines.
|
|
35
|
+
/// Cross-axis distribution between wrapped flex lines. The order is the
|
|
36
|
+
/// hosts' wire code (5 stretch, 6 space-evenly), which the layout-tree ABI
|
|
37
|
+
/// decodes by position, as craft_native_flex_line_distribution and the grid
|
|
38
|
+
/// read it by number.
|
|
36
39
|
pub const AlignContent = enum {
|
|
37
40
|
flex_start,
|
|
38
41
|
center,
|
|
39
42
|
flex_end,
|
|
40
43
|
space_between,
|
|
41
44
|
space_around,
|
|
42
|
-
space_evenly,
|
|
43
45
|
stretch,
|
|
46
|
+
space_evenly,
|
|
44
47
|
};
|
|
45
48
|
|
|
46
49
|
pub const Size = struct {
|
|
@@ -1610,7 +1613,7 @@ fn emptyLayoutStyleInput() LayoutStyleInput {
|
|
|
1610
1613
|
.align_items = 3,
|
|
1611
1614
|
.align_self = 0,
|
|
1612
1615
|
.flex_wrap = 0,
|
|
1613
|
-
.align_content =
|
|
1616
|
+
.align_content = 5,
|
|
1614
1617
|
.margin_top = 0,
|
|
1615
1618
|
.margin_right = 0,
|
|
1616
1619
|
.margin_bottom = 0,
|
|
@@ -1648,7 +1651,7 @@ fn emptyLayoutStyleInputV2() LayoutStyleInputV2 {
|
|
|
1648
1651
|
.align_items = 3,
|
|
1649
1652
|
.align_self = 0,
|
|
1650
1653
|
.flex_wrap = 0,
|
|
1651
|
-
.align_content =
|
|
1654
|
+
.align_content = 5,
|
|
1652
1655
|
.margin_top = 0,
|
|
1653
1656
|
.margin_right = 0,
|
|
1654
1657
|
.margin_bottom = 0,
|
|
@@ -1687,7 +1690,7 @@ fn emptyLayoutStyleInputV4() LayoutStyleInputV4 {
|
|
|
1687
1690
|
.align_items = 3,
|
|
1688
1691
|
.align_self = 0,
|
|
1689
1692
|
.flex_wrap = 0,
|
|
1690
|
-
.align_content =
|
|
1693
|
+
.align_content = 5,
|
|
1691
1694
|
.margin_top = 0,
|
|
1692
1695
|
.margin_right = 0,
|
|
1693
1696
|
.margin_bottom = 0,
|
|
@@ -1915,6 +1918,39 @@ test "v3 tree layout mirrors wrapped cross-axis lines" {
|
|
|
1915
1918
|
try std.testing.expectEqual(@as(f32, 30), frames[2].y);
|
|
1916
1919
|
}
|
|
1917
1920
|
|
|
1921
|
+
test "v3 tree layout reads the hosts' align-content codes" {
|
|
1922
|
+
// Two 40-wide items wrap into two 10-tall lines in a 60x70 box: 50 free.
|
|
1923
|
+
var first_style = emptyLayoutStyleInputV2();
|
|
1924
|
+
first_style.intrinsic_width = 40;
|
|
1925
|
+
first_style.intrinsic_height = 10;
|
|
1926
|
+
var second_style = first_style;
|
|
1927
|
+
second_style.intrinsic_width = 40;
|
|
1928
|
+
var root_style = emptyLayoutStyleInputV2();
|
|
1929
|
+
root_style.width = 60;
|
|
1930
|
+
root_style.height = 70;
|
|
1931
|
+
root_style.flex_wrap = 1;
|
|
1932
|
+
root_style.align_items = 0;
|
|
1933
|
+
|
|
1934
|
+
// 6, space-evenly: 50 / 3 before, between and after the lines.
|
|
1935
|
+
root_style.align_content = 6;
|
|
1936
|
+
var nodes = [_]LayoutNodeInputV2{
|
|
1937
|
+
.{ .style = root_style, .first_child = 1, .child_count = 2 },
|
|
1938
|
+
.{ .style = first_style, .first_child = 0, .child_count = 0 },
|
|
1939
|
+
.{ .style = second_style, .first_child = 0, .child_count = 0 },
|
|
1940
|
+
};
|
|
1941
|
+
var frames: [3]Frame = undefined;
|
|
1942
|
+
try std.testing.expectEqual(@as(c_int, 0), craft_native_layout_tree_v3(60, 70, &nodes, nodes.len, &frames, frames.len));
|
|
1943
|
+
try std.testing.expectApproxEqAbs(@as(f32, 16.666), frames[1].y, 0.01);
|
|
1944
|
+
try std.testing.expectApproxEqAbs(@as(f32, 43.333), frames[2].y, 0.01);
|
|
1945
|
+
try std.testing.expectApproxEqAbs(@as(f32, 10), frames[1].height, 0.001);
|
|
1946
|
+
|
|
1947
|
+
// 5, stretch: each line grows by half the free space, from the top.
|
|
1948
|
+
nodes[0].style.align_content = 5;
|
|
1949
|
+
try std.testing.expectEqual(@as(c_int, 0), craft_native_layout_tree_v3(60, 70, &nodes, nodes.len, &frames, frames.len));
|
|
1950
|
+
try std.testing.expectApproxEqAbs(@as(f32, 0), frames[1].y, 0.001);
|
|
1951
|
+
try std.testing.expectApproxEqAbs(@as(f32, 35), frames[2].y, 0.001);
|
|
1952
|
+
}
|
|
1953
|
+
|
|
1918
1954
|
test "rejects malformed host-neutral layout trees without writing frames" {
|
|
1919
1955
|
var style = emptyLayoutStyleInput();
|
|
1920
1956
|
style.width = 20;
|