peachsim 0.1.2722 → 0.1.2724
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-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +1 -1
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +2 -2
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +1 -1
- package/dist-lib/bridge-contract-input.mjs +5 -5
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +3 -3
- package/dist-lib/bundle-channel.cjs +40 -22
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +3 -3
- package/dist-lib/cloud-contract.cjs +1 -1
- package/dist-lib/cloud-contract.mjs +3 -3
- package/dist-lib/cloud-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +2 -2
- package/dist-lib/cloud.cjs +1 -1
- package/dist-lib/cloud.mjs +7 -7
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/config.mjs +5 -5
- package/dist-lib/detox/index.cjs +1 -1
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/esm-chunks/{acorn-WXT5BN3N.mjs → acorn-EURHASUG.mjs} +3 -3
- package/dist-lib/esm-chunks/{chunk-2GNOD4OQ.mjs → chunk-4JBJMTW6.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-7SPRXX7U.mjs → chunk-4JK43CMT.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-WBN7IUWQ.mjs → chunk-6DUHHBHL.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-HMQMHBQL.mjs → chunk-6QOAUFXS.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-YAMJOL3T.mjs → chunk-75EXFIUY.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-B3RWPISY.mjs → chunk-7L46YGKM.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-QXPI426H.mjs → chunk-CQZUJXUJ.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-IOV6JL2A.mjs → chunk-DUZ423VJ.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-TOYF6UUA.mjs → chunk-EAAWWHM5.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-BVW6GQ7R.mjs → chunk-ELUCK72T.mjs} +6 -6
- package/dist-lib/esm-chunks/{chunk-PG5A6PA2.mjs → chunk-H27F6KTB.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-A6VMTX6Z.mjs → chunk-HBMYCY5F.mjs} +32 -21
- package/dist-lib/esm-chunks/{chunk-NX24DHF4.mjs → chunk-J7WTMPA2.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-ZIW6KYK2.mjs → chunk-LHYDMCSX.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-GG5BIIIB.mjs → chunk-N44HIDJI.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-7PI2KWCZ.mjs → chunk-OZ3AV4BF.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-JTYCUVI6.mjs → chunk-PBX3L23V.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-B5OD7Z5G.mjs → chunk-PSFDJFEP.mjs} +4 -4
- package/dist-lib/esm-chunks/{chunk-KNWASISV.mjs → chunk-QCMMBFZK.mjs} +3 -3
- package/dist-lib/esm-chunks/{chunk-PTKBPZT3.mjs → chunk-QRTEE3NG.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-PMRCLDUL.mjs → chunk-T552XKQW.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-ZOKB6ZSG.mjs → chunk-TIR2OCFT.mjs} +5 -5
- package/dist-lib/esm-chunks/{chunk-F5NIHETA.mjs → chunk-U2CXAJOV.mjs} +2 -2
- package/dist-lib/esm-chunks/{chunk-JNHM4ED3.mjs → chunk-UMMJ3AVM.mjs} +7 -8
- package/dist-lib/esm-chunks/{metro-layout-parser-2NKB2F5L.mjs → metro-layout-parser-KH6NZMEH.mjs} +3 -3
- package/dist-lib/esm-chunks/{swift-package-prebuilt-WYMQ4AQP.mjs → swift-package-prebuilt-5CSXNIFW.mjs} +12 -12
- package/dist-lib/esm-chunks/{swift-sdk-app-module-W4VSM642.mjs → swift-sdk-app-module-HX2YLJ4X.mjs} +33 -24
- package/dist-lib/esm-chunks/{swift-sdk-image-UN5UJ5GR.mjs → swift-sdk-image-32W2IHSJ.mjs} +16 -18
- package/dist-lib/esm-chunks/{swift-sdk-image-producer-4GEOEY7X.mjs → swift-sdk-image-producer-7Z2DBPQQ.mjs} +5 -5
- package/dist-lib/expo-swift-bundle.cjs +40 -22
- package/dist-lib/expo-swift-metadata.cjs +1 -1
- package/dist-lib/expo-swift-metadata.mjs +7 -7
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +237 -34
- package/dist-lib/host/fetch-proxy-handler.cjs +4 -4
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +2 -2
- package/dist-lib/host/replacement-module-handler.cjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +1 -1
- package/dist-lib/kotlin-host.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +3 -3
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +3 -3
- package/dist-lib/metro-production-bundle.cjs +1 -1
- package/dist-lib/metro-production-bundle.mjs +4 -4
- package/dist-lib/native-app-identity-project.cjs +1 -1
- package/dist-lib/native-app-identity-project.mjs +15 -15
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +6 -6
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +3 -3
- package/dist-lib/pdfium-raster.cjs +1 -1
- package/dist-lib/pdfium-raster.mjs +2 -2
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +3 -3
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/public-origins-lib-esm.json +85 -85
- package/dist-lib/public-origins-lib.json +64 -64
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +2 -2
- package/dist-lib/reap-browser.cjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +8 -8
- package/dist-lib/skills.cjs +237 -34
- package/dist-lib/swift-compile.cjs +37 -19
- package/dist-lib/swift-compile.mjs +12 -12
- package/dist-lib/swift-package.cjs +1 -1
- package/dist-lib/swift-package.mjs +3 -3
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +6 -6
- package/dist-lib/swift-svg-raster.cjs +1 -1
- package/dist-lib/swift-svg-raster.mjs +2 -2
- package/dist-lib/swift-toolchain.cjs +1 -1
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vendor/@peculiar/x509.cjs +1 -1
- package/dist-lib/vendor/@ruby/prism/src/nodes.js.cjs +1 -1
- package/dist-lib/vendor/@ruby/prism/src/parsePrism.js.cjs +1 -1
- package/dist-lib/vendor/acorn.cjs +1 -1
- package/dist-lib/vendor/magic-string.cjs +1 -1
- package/dist-lib/vendor/stream-json.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/index.js.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/parser/index.js.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/parser/tokenizer/index.js.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/parser/tokenizer/types.js.cjs +1 -1
- package/dist-lib/vendor/sucrase.cjs +1 -1
- package/dist-lib/vendor/terser.cjs +1 -1
- package/dist-lib/vendor/valibot.cjs +1 -1
- package/dist-lib/vendor/ws.cjs +1 -1
- package/dist-lib/vendor/zod.cjs +1 -1
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +3 -3
- package/dist-types/packages/peach-engine/src/engine/native-layout.d.ts +0 -2
- package/dist-types/packages/peach-engine/src/engine/native-text-measure.d.ts +3 -6
- package/dist-types/packages/peach-engine/src/engine/native-text-metric-policy.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/engine/native-text-runtimeContract.d.ts +0 -5
- package/package.json +1 -1
- package/src/binaryen.lock.json +1 -1
- package/src/one-direct-host-source.ts +194 -10
- package/src/one-native-controls-package.ts +81 -36
- package/src/swift-compile.ts +16 -4
- package/src/swift-sdk-app-module.ts +22 -10
- package/src/swift-sdk-image.ts +1 -1
- package/src/swiftSdkLinkContract.ts +2 -0
|
@@ -83,6 +83,110 @@ public final class PeachOneDirectStage: NSObject {
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
+
@MainActor
|
|
87
|
+
private final class PeachDirectSwipeConfiguration: ObservableObject {
|
|
88
|
+
struct Action: Identifiable {
|
|
89
|
+
let id: Int
|
|
90
|
+
let title: String
|
|
91
|
+
let symbol: String?
|
|
92
|
+
let destructive: Bool
|
|
93
|
+
let tint: UIColor?
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
struct Edge {
|
|
97
|
+
var actions: [Action] = []
|
|
98
|
+
var fullSwipe = false
|
|
99
|
+
|
|
100
|
+
init(_ items: [[String: Any]] = [], fullSwipe: Bool = false) {
|
|
101
|
+
self.fullSwipe = fullSwipe
|
|
102
|
+
actions = items.enumerated().map { index, item in
|
|
103
|
+
Action(id: index, title: item["title"] as? String ?? "", symbol: item["systemImage"] as? String,
|
|
104
|
+
destructive: item["destructive"] as? Bool ?? false, tint: item["color"] as? UIColor)
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
struct Edges {
|
|
110
|
+
var leading = Edge()
|
|
111
|
+
var trailing = Edge()
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
@Published var edges = Edges()
|
|
115
|
+
var emit: ((String, NSDictionary) -> Void)?
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
@MainActor
|
|
119
|
+
private struct PeachDirectSwipeRow: View {
|
|
120
|
+
@ObservedObject var configuration: PeachDirectSwipeConfiguration
|
|
121
|
+
@ObservedObject var children: OneNativeChildren
|
|
122
|
+
|
|
123
|
+
var body: some View {
|
|
124
|
+
Group {
|
|
125
|
+
ForEach(children.items) { child in child.content }
|
|
126
|
+
}
|
|
127
|
+
.swipeActions(edge: .leading, allowsFullSwipe: configuration.edges.leading.fullSwipe) {
|
|
128
|
+
buttons(configuration.edges.leading, edge: "leading")
|
|
129
|
+
}
|
|
130
|
+
.swipeActions(edge: .trailing, allowsFullSwipe: configuration.edges.trailing.fullSwipe) {
|
|
131
|
+
buttons(configuration.edges.trailing, edge: "trailing")
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
@ViewBuilder
|
|
136
|
+
private func buttons(_ group: PeachDirectSwipeConfiguration.Edge, edge: String) -> some View {
|
|
137
|
+
ForEach(group.actions) { action in
|
|
138
|
+
let role: ButtonRole? = action.destructive ? .destructive : nil
|
|
139
|
+
let activate: () -> Void = { configuration.emit?("action", ["edge": edge, "index": action.id]) }
|
|
140
|
+
let tint = action.tint.map { Color(uiColor: $0) }
|
|
141
|
+
if let symbol = action.symbol {
|
|
142
|
+
Button(action.title, systemImage: symbol, role: role, action: activate).tint(tint)
|
|
143
|
+
} else {
|
|
144
|
+
Button(action.title, role: role, action: activate).tint(tint)
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
@MainActor
|
|
151
|
+
@objc(PeachDirectSwipeActionsView)
|
|
152
|
+
public final class PeachDirectSwipeActionsView: OneNativeContainerView {
|
|
153
|
+
private let configuration: PeachDirectSwipeConfiguration
|
|
154
|
+
private let slot: OneNativeContainerSlotView
|
|
155
|
+
|
|
156
|
+
@objc public init() {
|
|
157
|
+
let configuration = PeachDirectSwipeConfiguration()
|
|
158
|
+
self.configuration = configuration
|
|
159
|
+
slot = OneNativeContainerSlotView(frame: .zero)
|
|
160
|
+
super.init(wrap: { children, _ in
|
|
161
|
+
AnyView(PeachDirectSwipeRow(configuration: configuration, children: children))
|
|
162
|
+
})
|
|
163
|
+
insertChild(slot, at: 0)
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
required init?(coder: NSCoder) { fatalError("init(coder:) is unavailable") }
|
|
167
|
+
|
|
168
|
+
@objc(configureLeading:trailing:fullSwipe:emit:)
|
|
169
|
+
public func configure(leading: [[String: Any]], trailing: [[String: Any]], fullSwipe: [String: Bool],
|
|
170
|
+
emit: @escaping (String, NSDictionary) -> Void
|
|
171
|
+
) {
|
|
172
|
+
configuration.emit = emit
|
|
173
|
+
configuration.edges = .init(leading: .init(leading, fullSwipe: fullSwipe["leading"] == true),
|
|
174
|
+
trailing: .init(trailing, fullSwipe: fullSwipe["trailing"] == true))
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
@objc public func setRow(_ view: UIView?) {
|
|
178
|
+
guard slot.content !== view else { return }
|
|
179
|
+
slot.content?.removeFromSuperview()
|
|
180
|
+
slot.content = view
|
|
181
|
+
refreshRow(for: slot)
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
public override func layoutSubviews() {
|
|
185
|
+
slot.configure(height: bounds.height, width: 0)
|
|
186
|
+
super.layoutSubviews()
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
86
190
|
@MainActor
|
|
87
191
|
private final class PeachDirectTableView: UITableView {
|
|
88
192
|
var onLayoutBounds: ((CGSize) -> Void)?
|
|
@@ -1216,26 +1320,28 @@ public struct OneDirectStageView: View {
|
|
|
1216
1320
|
public init() {}
|
|
1217
1321
|
|
|
1218
1322
|
public var body: some View {
|
|
1219
|
-
OneDirectStageRepresentable(tick: tick)
|
|
1323
|
+
OneDirectStageRepresentable(tick: tick, onDirty: { tick &+= 1 })
|
|
1220
1324
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
|
1221
|
-
.onAppear {
|
|
1222
|
-
PeachOneDirectStage.shared.onStageDirty = {
|
|
1223
|
-
tick &+= 1
|
|
1224
|
-
}
|
|
1225
|
-
}
|
|
1226
1325
|
}
|
|
1227
1326
|
}
|
|
1228
1327
|
|
|
1229
1328
|
private struct OneDirectStageRepresentable: UIViewRepresentable {
|
|
1230
1329
|
let tick: UInt64
|
|
1330
|
+
let onDirty: () -> Void
|
|
1231
1331
|
|
|
1232
1332
|
func makeUIView(context: Context) -> UIView {
|
|
1233
|
-
PeachOneDirectStage.shared
|
|
1333
|
+
let stage = PeachOneDirectStage.shared
|
|
1334
|
+
stage.onStageDirty = onDirty
|
|
1335
|
+
return stage.stageView
|
|
1234
1336
|
}
|
|
1235
1337
|
|
|
1236
1338
|
func updateUIView(_ uiView: UIView, context: Context) {
|
|
1237
1339
|
_ = tick
|
|
1238
1340
|
}
|
|
1341
|
+
|
|
1342
|
+
static func dismantleUIView(_ uiView: UIView, coordinator: ()) {
|
|
1343
|
+
PeachOneDirectStage.shared.onStageDirty = nil
|
|
1344
|
+
}
|
|
1239
1345
|
}
|
|
1240
1346
|
`
|
|
1241
1347
|
|
|
@@ -1358,6 +1464,9 @@ uint32_t peach_one_node_css_color(uint32_t nodeLo, uint32_t nodeHi, const char*
|
|
|
1358
1464
|
uint32_t sourceLen, double* rgbaOut);
|
|
1359
1465
|
PEACH_ONE_GUEST_IMPORT("node_layout_size")
|
|
1360
1466
|
uint32_t peach_one_node_layout_size(uint32_t nodeLo, uint32_t nodeHi, double* sizeOut);
|
|
1467
|
+
PEACH_ONE_GUEST_IMPORT("slot_content_frame")
|
|
1468
|
+
uint32_t peach_one_slot_content_frame(uint32_t ownerLo, uint32_t ownerHi,
|
|
1469
|
+
uint32_t contentLo, uint32_t contentHi, double x, double y, double width, double height);
|
|
1361
1470
|
PEACH_ONE_GUEST_IMPORT("wake_stage")
|
|
1362
1471
|
void peach_one_wake_stage(void);
|
|
1363
1472
|
}
|
|
@@ -1416,6 +1525,61 @@ UIColor* PeachPlatformColor(NSString* keyword) {
|
|
|
1416
1525
|
return keyword ? colors[keyword.lowercaseString] : nil;
|
|
1417
1526
|
}
|
|
1418
1527
|
|
|
1528
|
+
@interface PeachDirectSwipeActionsContainer : NSObject <PeachContainer>
|
|
1529
|
+
@end
|
|
1530
|
+
|
|
1531
|
+
static NSArray<NSDictionary*>* SwiftSwipeActions(id items) {
|
|
1532
|
+
if (![items isKindOfClass:NSArray.class]) return @[];
|
|
1533
|
+
NSArray* entries = static_cast<NSArray*>(items);
|
|
1534
|
+
NSMutableArray* actions = [NSMutableArray arrayWithCapacity:entries.count];
|
|
1535
|
+
for (NSDictionary* item in entries) {
|
|
1536
|
+
if (![item isKindOfClass:NSDictionary.class]) return @[];
|
|
1537
|
+
NSMutableDictionary* action = [item mutableCopy];
|
|
1538
|
+
action[@"color"] = PeachProcessedColor(item[@"color"]);
|
|
1539
|
+
[actions addObject:action];
|
|
1540
|
+
}
|
|
1541
|
+
return actions;
|
|
1542
|
+
}
|
|
1543
|
+
|
|
1544
|
+
@implementation PeachDirectSwipeActionsContainer {
|
|
1545
|
+
PeachDirectSwipeActionsView* _view;
|
|
1546
|
+
peach_node _child;
|
|
1547
|
+
__weak UIView* _row;
|
|
1548
|
+
}
|
|
1549
|
+
|
|
1550
|
+
- (void)configure:(NSDictionary*)spec emit:(PeachContainerEmit)emit {
|
|
1551
|
+
if (!_view) _view = [PeachDirectSwipeActionsView new];
|
|
1552
|
+
NSDictionary* fullSwipe = [spec[@"fullSwipe"] isKindOfClass:NSDictionary.class] ? spec[@"fullSwipe"] : @{};
|
|
1553
|
+
[_view configureLeading:SwiftSwipeActions(spec[@"leading"])
|
|
1554
|
+
trailing:SwiftSwipeActions(spec[@"trailing"])
|
|
1555
|
+
fullSwipe:fullSwipe
|
|
1556
|
+
emit:emit];
|
|
1557
|
+
}
|
|
1558
|
+
|
|
1559
|
+
- (void)child:(peach_node)node { _child = node; }
|
|
1560
|
+
|
|
1561
|
+
- (void)mountIn:(UIView*)container views:(id<PeachViewLookup>)views {
|
|
1562
|
+
_row = _child ? [views viewForNode:_child] : nil;
|
|
1563
|
+
_child = 0;
|
|
1564
|
+
[_view setRow:_row];
|
|
1565
|
+
if (_view.superview != container) [container addSubview:_view];
|
|
1566
|
+
_view.frame = container.bounds;
|
|
1567
|
+
}
|
|
1568
|
+
|
|
1569
|
+
- (BOOL)ownsView:(UIView*)view { return view && view == _row; }
|
|
1570
|
+
|
|
1571
|
+
- (void)unmount {
|
|
1572
|
+
[_view setRow:nil];
|
|
1573
|
+
[_view removeFromSuperview];
|
|
1574
|
+
_row = nil;
|
|
1575
|
+
}
|
|
1576
|
+
|
|
1577
|
+
- (void)detach {
|
|
1578
|
+
[self unmount];
|
|
1579
|
+
_view = nil;
|
|
1580
|
+
}
|
|
1581
|
+
@end
|
|
1582
|
+
|
|
1419
1583
|
@interface PeachDirectTableListContainer : NSObject <PeachContainer>
|
|
1420
1584
|
- (void)refreshLayoutIn:(UIView*)container views:(id<PeachViewLookup>)views;
|
|
1421
1585
|
@end
|
|
@@ -1567,11 +1731,24 @@ int32_t emitEventToHost(peach_node node, NSString* event, NSDictionary* payload)
|
|
|
1567
1731
|
return peach_one_emit_container_event(nodeLo(node), nodeHi(node), evPtr, evLen, jsPtr, jsLen);
|
|
1568
1732
|
}
|
|
1569
1733
|
|
|
1570
|
-
id<PeachContainer> makeContainer(NSString* kind, peach_node node) {
|
|
1571
|
-
if ([kind isEqualToString:@"swiftUI"])
|
|
1734
|
+
id<PeachContainer> makeContainer(NSString* kind, peach_node node, NSDictionary* spec) {
|
|
1735
|
+
if ([kind isEqualToString:@"swiftUI"]) {
|
|
1736
|
+
PeachSwiftUI* swift = [PeachSwiftUI new];
|
|
1737
|
+
NSString* control = spec[@"control"];
|
|
1738
|
+
if ([control isEqual:@"OneNativeContainerSlot"] || [control isEqual:@"OneNativeTab"]) {
|
|
1739
|
+
swift.slotContentLayout = ^(peach_node content, CGRect frame) {
|
|
1740
|
+
if (peach_one_slot_content_frame(nodeLo(node), nodeHi(node), nodeLo(content),
|
|
1741
|
+
nodeHi(content), frame.origin.x, frame.origin.y, frame.size.width, frame.size.height)) {
|
|
1742
|
+
[PeachOneDirectStage.shared markDirty];
|
|
1743
|
+
}
|
|
1744
|
+
};
|
|
1745
|
+
}
|
|
1746
|
+
return swift;
|
|
1747
|
+
}
|
|
1572
1748
|
if ([kind isEqualToString:@"sheet"]) return [PeachSheet new];
|
|
1573
1749
|
if ([kind isEqualToString:@"menu"]) return [PeachMenu new];
|
|
1574
1750
|
if ([kind isEqualToString:@"contextMenu"]) return [PeachContextMenu new];
|
|
1751
|
+
if ([kind isEqualToString:@"swipeActions"]) return [PeachDirectSwipeActionsContainer new];
|
|
1575
1752
|
if ([kind isEqualToString:@"tableList"]) return [PeachDirectTableListContainer new];
|
|
1576
1753
|
if ([kind isEqualToString:@"popover"]) {
|
|
1577
1754
|
return [[PeachPopover alloc] initWithDismissRequest:^BOOL(NSInteger revision) {
|
|
@@ -1680,7 +1857,7 @@ uint32_t peach_one_container_configure(uint32_t targetLo, uint32_t targetHi, con
|
|
|
1680
1857
|
}
|
|
1681
1858
|
if (!record.container) {
|
|
1682
1859
|
record.kind = kind;
|
|
1683
|
-
record.container = makeContainer(kind, node);
|
|
1860
|
+
record.container = makeContainer(kind, node, spec);
|
|
1684
1861
|
if (!record.container) return 0;
|
|
1685
1862
|
}
|
|
1686
1863
|
PeachContainerEmit emit = ^(NSString* event, NSDictionary* payload) {
|
|
@@ -1883,6 +2060,13 @@ void peach_one_container_command(uint32_t targetLo, uint32_t targetHi, const cha
|
|
|
1883
2060
|
@autoreleasepool {
|
|
1884
2061
|
const peach_node node = joinNode(targetLo, targetHi);
|
|
1885
2062
|
NSString* name = nsStringFromBytes(namePtr, nameLen);
|
|
2063
|
+
NSString* prefix = @"contextMenuInteraction:";
|
|
2064
|
+
if (node && [name hasPrefix:prefix]) {
|
|
2065
|
+
NSString* event = [name substringFromIndex:prefix.length];
|
|
2066
|
+
NSString* action = [event isEqualToString:@"action"] ? nsStringFromBytes(jsonPtr, jsonLen) : nil;
|
|
2067
|
+
emitEventToHost(node, event, action ? @{@"id": action} : @{});
|
|
2068
|
+
return;
|
|
2069
|
+
}
|
|
1886
2070
|
NSDictionary* payload = jsonDictFromBytes(jsonPtr, jsonLen);
|
|
1887
2071
|
if (node == 0) {
|
|
1888
2072
|
if ([name isEqualToString:@"completeAction"]) {
|
|
@@ -30,7 +30,12 @@ import {
|
|
|
30
30
|
} from './oneNativeControlsContract'
|
|
31
31
|
import { swiftCodeMask, syncSwiftTree } from './swift-compile'
|
|
32
32
|
import { swiftDistributionRoot } from './swift-distribution'
|
|
33
|
-
import {
|
|
33
|
+
import {
|
|
34
|
+
artifactFor,
|
|
35
|
+
projectFor,
|
|
36
|
+
swiftPackageMetadata,
|
|
37
|
+
swiftPackageReleaseFiles,
|
|
38
|
+
} from './swift-host'
|
|
34
39
|
import { swiftModuleDigest } from './swift-sdk-surface'
|
|
35
40
|
import { collectSwiftSourceClosure } from './swift-source-closure'
|
|
36
41
|
import { SWIFT_PACKAGE_PATH } from './swift-submit'
|
|
@@ -40,6 +45,7 @@ import type { SwiftEntryModuleArgs } from './swiftContract'
|
|
|
40
45
|
// One.podspec defines a flag for each SDK version up to the installed one, and the
|
|
41
46
|
// native graph reports NATIVE_GRAPH_SDK_VERSION (27.1) to podspecs
|
|
42
47
|
const ONE_SDK_DEFINES = ['ONE_IOS_26_SDK', 'ONE_IOS_27_SDK', 'ONE_IOS_27_1_SDK']
|
|
48
|
+
const GUEST_ENTRY = 'Sources/Controls/OneNativeControlsGuest.swift'
|
|
43
49
|
|
|
44
50
|
const BRIDGE_SWIFT = `@_spi(Peach) import SwiftUI
|
|
45
51
|
@_spi(Peach) import UIKit
|
|
@@ -1928,7 +1934,7 @@ export async function oneNativeControlsPackage(
|
|
|
1928
1934
|
watched.add(sourcePath)
|
|
1929
1935
|
}
|
|
1930
1936
|
files.set('Sources/ControlsHost/ios/PeachOneDirectHost.mm', PEACH_ONE_DIRECT_HOST_MM)
|
|
1931
|
-
files.set(
|
|
1937
|
+
files.set(GUEST_ENTRY, GUEST_MAIN_SWIFT)
|
|
1932
1938
|
if (bindings) {
|
|
1933
1939
|
files.set('Sources/One/One.swift', oneSDKModule)
|
|
1934
1940
|
for (const relative of ONE_SDK_RUNTIME_SOURCES) {
|
|
@@ -2051,20 +2057,21 @@ export async function oneNativeControlsPackage(
|
|
|
2051
2057
|
}
|
|
2052
2058
|
}
|
|
2053
2059
|
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2060
|
+
interface OneNativeControlsBuildOptions {
|
|
2061
|
+
moduleRoot?: string
|
|
2062
|
+
startupRuntimeUrl?: URL
|
|
2063
|
+
sdk?: OneNativeControlsSDKInput | null
|
|
2064
|
+
}
|
|
2065
|
+
|
|
2066
|
+
async function compileOneNativeControls<T>(
|
|
2067
|
+
appRoot: string | undefined,
|
|
2068
|
+
options: OneNativeControlsBuildOptions | undefined,
|
|
2069
|
+
linkedGroups: readonly string[] | undefined,
|
|
2070
|
+
build: (
|
|
2071
|
+
project: ReturnType<typeof projectFor>,
|
|
2072
|
+
moduleRoot: string | undefined,
|
|
2073
|
+
) => Promise<T>,
|
|
2074
|
+
) {
|
|
2068
2075
|
const original = options?.sdk
|
|
2069
2076
|
const moduleRoot =
|
|
2070
2077
|
options?.moduleRoot ??
|
|
@@ -2091,20 +2098,11 @@ export async function stageOneNativeControlsRelease(
|
|
|
2091
2098
|
const compile = async () => {
|
|
2092
2099
|
for (;;) {
|
|
2093
2100
|
const { packagePath, oneSDKModules, oneSDKShards } = prepared
|
|
2094
|
-
|
|
2095
|
-
|
|
2101
|
+
const project = projectFor(fs.realpathSync(packagePath))
|
|
2102
|
+
if (oneSDKModules?.length) project.oneModule = false
|
|
2096
2103
|
try {
|
|
2097
|
-
const
|
|
2098
|
-
|
|
2099
|
-
ONE_NATIVE_CONTROLS_PACKAGE,
|
|
2100
|
-
moduleRoot,
|
|
2101
|
-
'',
|
|
2102
|
-
undefined,
|
|
2103
|
-
undefined,
|
|
2104
|
-
[],
|
|
2105
|
-
options?.startupRuntimeUrl,
|
|
2106
|
-
)
|
|
2107
|
-
return { packagePath, oneSDKModules, metadata }
|
|
2104
|
+
const artifact = await build(project, moduleRoot)
|
|
2105
|
+
return { packagePath, oneSDKModules, artifact }
|
|
2108
2106
|
} catch (error) {
|
|
2109
2107
|
if (restored || !sdk?.reemitForWasi || !(error instanceof Error)) throw error
|
|
2110
2108
|
const diagnostic = translateShardedOneSDKDiagnostic(error.message, oneSDKShards)
|
|
@@ -2115,13 +2113,7 @@ export async function stageOneNativeControlsRelease(
|
|
|
2115
2113
|
}
|
|
2116
2114
|
}
|
|
2117
2115
|
}
|
|
2118
|
-
const
|
|
2119
|
-
const metadataPath = `${SWIFT_PACKAGE_PATH}${ONE_NATIVE_CONTROLS_PACKAGE}`
|
|
2120
|
-
const files = await swiftPackageReleaseFiles(
|
|
2121
|
-
packagePath,
|
|
2122
|
-
ONE_NATIVE_CONTROLS_PACKAGE,
|
|
2123
|
-
metadata,
|
|
2124
|
-
)
|
|
2116
|
+
const compiled = await compile()
|
|
2125
2117
|
if (receipt && original && sdk && sdk !== original && !restored) {
|
|
2126
2118
|
const revised = Object.fromEntries(
|
|
2127
2119
|
[...sdk.files].filter(([name, source]) => original.files.get(name) !== source),
|
|
@@ -2134,5 +2126,58 @@ export async function stageOneNativeControlsRelease(
|
|
|
2134
2126
|
fs.rmSync(partial, { force: true })
|
|
2135
2127
|
}
|
|
2136
2128
|
}
|
|
2129
|
+
return compiled
|
|
2130
|
+
}
|
|
2131
|
+
|
|
2132
|
+
export async function stageOneNativeControlsArtifact(
|
|
2133
|
+
appRoot: string,
|
|
2134
|
+
sdk: OneNativeControlsSDKInput | undefined,
|
|
2135
|
+
linkedGroups?: readonly string[],
|
|
2136
|
+
) {
|
|
2137
|
+
const { artifact } = await compileOneNativeControls(
|
|
2138
|
+
appRoot,
|
|
2139
|
+
{ sdk },
|
|
2140
|
+
linkedGroups,
|
|
2141
|
+
(project, moduleRoot) => artifactFor(project, GUEST_ENTRY, moduleRoot),
|
|
2142
|
+
)
|
|
2143
|
+
return artifact
|
|
2144
|
+
}
|
|
2145
|
+
|
|
2146
|
+
export async function stageOneNativeControlsRelease(
|
|
2147
|
+
appRoot?: string,
|
|
2148
|
+
options?: OneNativeControlsBuildOptions,
|
|
2149
|
+
linkedGroups?: readonly string[],
|
|
2150
|
+
): Promise<{
|
|
2151
|
+
metadataPath: string
|
|
2152
|
+
metadata: SwiftEntryModuleArgs
|
|
2153
|
+
files: Map<string, Blob>
|
|
2154
|
+
oneSDKModules?: string[]
|
|
2155
|
+
}> {
|
|
2156
|
+
const {
|
|
2157
|
+
packagePath,
|
|
2158
|
+
oneSDKModules,
|
|
2159
|
+
artifact: metadata,
|
|
2160
|
+
} = await compileOneNativeControls(
|
|
2161
|
+
appRoot,
|
|
2162
|
+
options,
|
|
2163
|
+
linkedGroups,
|
|
2164
|
+
(project, moduleRoot) =>
|
|
2165
|
+
swiftPackageMetadata(
|
|
2166
|
+
project.packagePath,
|
|
2167
|
+
ONE_NATIVE_CONTROLS_PACKAGE,
|
|
2168
|
+
moduleRoot,
|
|
2169
|
+
'',
|
|
2170
|
+
undefined,
|
|
2171
|
+
undefined,
|
|
2172
|
+
[],
|
|
2173
|
+
options?.startupRuntimeUrl,
|
|
2174
|
+
),
|
|
2175
|
+
)
|
|
2176
|
+
const metadataPath = `${SWIFT_PACKAGE_PATH}${ONE_NATIVE_CONTROLS_PACKAGE}`
|
|
2177
|
+
const files = await swiftPackageReleaseFiles(
|
|
2178
|
+
packagePath,
|
|
2179
|
+
ONE_NATIVE_CONTROLS_PACKAGE,
|
|
2180
|
+
metadata,
|
|
2181
|
+
)
|
|
2137
2182
|
return { metadataPath, metadata, files, oneSDKModules }
|
|
2138
2183
|
}
|
package/src/swift-compile.ts
CHANGED
|
@@ -5861,15 +5861,19 @@ function readCompiledArtifact(
|
|
|
5861
5861
|
!isRecord(image) ||
|
|
5862
5862
|
typeof image.key !== 'string' ||
|
|
5863
5863
|
typeof image.sha256 !== 'string' ||
|
|
5864
|
-
typeof image.binding !== 'string'
|
|
5864
|
+
typeof image.binding !== 'string' ||
|
|
5865
|
+
typeof image.liveSlots !== 'string'
|
|
5865
5866
|
)
|
|
5866
5867
|
return null
|
|
5867
5868
|
const binding = readFileSync(path.join(directory, 'sdk-binding.bin'))
|
|
5868
5869
|
if (createHash('sha256').update(binding).digest('hex') !== image.binding) return null
|
|
5870
|
+
const liveSlots = readFileSync(path.join(directory, 'sdk-live-slots.bin'))
|
|
5871
|
+
if (createHash('sha256').update(liveSlots).digest('hex') !== image.liveSlots)
|
|
5872
|
+
return null
|
|
5869
5873
|
const sdk: SwiftSdkModuleAsset = {
|
|
5870
5874
|
key: image.key,
|
|
5871
5875
|
sha256: image.sha256,
|
|
5872
|
-
binding: { bytes: binding, sha256: image.binding },
|
|
5876
|
+
binding: { bytes: binding, sha256: image.binding, liveSlots },
|
|
5873
5877
|
}
|
|
5874
5878
|
return { hash, bytes, icu: { sha256: receipt.icu, gzip }, sdk }
|
|
5875
5879
|
} catch (error) {
|
|
@@ -5889,8 +5893,13 @@ function saveCompiledArtifact(root: string, artifact: SwiftCompileArtifact): voi
|
|
|
5889
5893
|
try {
|
|
5890
5894
|
writeFileSync(path.join(pending, 'app.wasm'), artifact.bytes)
|
|
5891
5895
|
writeFileSync(path.join(pending, 'icu.gz'), artifact.icu.gzip)
|
|
5892
|
-
if (artifact.sdk)
|
|
5896
|
+
if (artifact.sdk) {
|
|
5893
5897
|
writeFileSync(path.join(pending, 'sdk-binding.bin'), artifact.sdk.binding.bytes)
|
|
5898
|
+
writeFileSync(
|
|
5899
|
+
path.join(pending, 'sdk-live-slots.bin'),
|
|
5900
|
+
artifact.sdk.binding.liveSlots,
|
|
5901
|
+
)
|
|
5902
|
+
}
|
|
5894
5903
|
writeFileSync(
|
|
5895
5904
|
path.join(pending, 'artifact.json'),
|
|
5896
5905
|
JSON.stringify({
|
|
@@ -5901,13 +5910,16 @@ function saveCompiledArtifact(root: string, artifact: SwiftCompileArtifact): voi
|
|
|
5901
5910
|
key: artifact.sdk.key,
|
|
5902
5911
|
sha256: artifact.sdk.sha256,
|
|
5903
5912
|
binding: artifact.sdk.binding.sha256,
|
|
5913
|
+
liveSlots: createHash('sha256')
|
|
5914
|
+
.update(artifact.sdk.binding.liveSlots)
|
|
5915
|
+
.digest('hex'),
|
|
5904
5916
|
},
|
|
5905
5917
|
}),
|
|
5906
5918
|
)
|
|
5907
5919
|
// publish the receipt last; interrupted or concurrent writes cannot pass
|
|
5908
5920
|
// both content digests unless they contain this exact verified result.
|
|
5909
5921
|
const outputs = ['app.wasm', 'icu.gz']
|
|
5910
|
-
if (artifact.sdk) outputs.push('sdk-binding.bin')
|
|
5922
|
+
if (artifact.sdk) outputs.push('sdk-binding.bin', 'sdk-live-slots.bin')
|
|
5911
5923
|
for (const file of [...outputs, 'artifact.json']) {
|
|
5912
5924
|
renameSync(path.join(pending, file), path.join(directory, file))
|
|
5913
5925
|
}
|
|
@@ -37,7 +37,6 @@ import { projectOutputFile, type SwiftProjectUser } from './swift-project-user'
|
|
|
37
37
|
import {
|
|
38
38
|
readSwiftSdkManifest,
|
|
39
39
|
SWIFT_SDK_APP_MEMORY_BASE,
|
|
40
|
-
SWIFT_SDK_APP_TABLE_BASE,
|
|
41
40
|
SWIFT_SDK_MEMORY_BASE,
|
|
42
41
|
SWIFT_SDK_PIECE_FIELDS,
|
|
43
42
|
type SwiftSdkImage,
|
|
@@ -58,7 +57,10 @@ import {
|
|
|
58
57
|
readSwiftPrunedLinkResponse,
|
|
59
58
|
SWIFT_PRUNED_LINK_MAP,
|
|
60
59
|
} from './swift-wasm-prune'
|
|
61
|
-
import {
|
|
60
|
+
import {
|
|
61
|
+
SWIFT_SDK_APP_TABLE_BASE,
|
|
62
|
+
SWIFT_SDK_FUNCTION_ADDRESS_PREFIX,
|
|
63
|
+
} from './swiftSdkLinkContract'
|
|
62
64
|
import { SWIFT_WASM_TRIPLE } from './swiftTargetContract'
|
|
63
65
|
import { writeWasmCustomSection } from './wasm-narrow-boundary'
|
|
64
66
|
import { KEEP_WASM_NAMES, lowerWasm, type WasmOptimization } from './wasm-optimize'
|
|
@@ -1312,15 +1314,14 @@ export function createSwiftSdkBinding(
|
|
|
1312
1314
|
usage: SwiftSdkUsage,
|
|
1313
1315
|
projection?: SwiftSdkProjection,
|
|
1314
1316
|
): SwiftSdkBindingAsset {
|
|
1315
|
-
const
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
])
|
|
1317
|
+
const binding = bindSwiftAppModule(linkage, sdk)
|
|
1318
|
+
const { data, liveSlots } = selectSwiftSdkData(sdk, usage, linkage, projection)
|
|
1319
|
+
const bytes = Buffer.concat([binding, data])
|
|
1319
1320
|
const sha256 =
|
|
1320
1321
|
typeof Bun !== 'undefined'
|
|
1321
1322
|
? new Bun.CryptoHasher('sha256').update(bytes).digest('hex')
|
|
1322
1323
|
: createHash('sha256').update(bytes).digest('hex')
|
|
1323
|
-
return { bytes, sha256 }
|
|
1324
|
+
return { bytes, sha256, liveSlots }
|
|
1324
1325
|
}
|
|
1325
1326
|
|
|
1326
1327
|
/** use the native object names from the link before guest image aliases are assigned. */
|
|
@@ -1401,12 +1402,12 @@ export function swiftSdkProjectionSpans(
|
|
|
1401
1402
|
* pieces its pruned link keeps, their transitive dependencies, the live swift record table and
|
|
1402
1403
|
* the constructor mask. format: u32 run count, then per run u64 address, u32 length and bytes.
|
|
1403
1404
|
*/
|
|
1404
|
-
|
|
1405
|
+
function selectSwiftSdkData(
|
|
1405
1406
|
sdk: SwiftSdkImage,
|
|
1406
1407
|
usage: SwiftSdkUsage,
|
|
1407
1408
|
linkage?: SwiftSdkAppLinkage,
|
|
1408
1409
|
projection?: SwiftSdkProjection,
|
|
1409
|
-
)
|
|
1410
|
+
) {
|
|
1410
1411
|
const { manifest, block, segments } = readSwiftSdkManifest(sdk)
|
|
1411
1412
|
const { strings } = manifest
|
|
1412
1413
|
const familyOf = (object: string) =>
|
|
@@ -1945,7 +1946,18 @@ export function selectSwiftSdkData(
|
|
|
1945
1946
|
blob.set(run.bytes, at + 12)
|
|
1946
1947
|
at += 12 + run.bytes.length
|
|
1947
1948
|
}
|
|
1948
|
-
|
|
1949
|
+
const selected = new Set(boundSlots)
|
|
1950
|
+
slots.forEach((slot, index) => {
|
|
1951
|
+
if (slot && liveFunctions[index]) selected.add(slot)
|
|
1952
|
+
})
|
|
1953
|
+
const liveSlots = Buffer.alloc((selected.size + 1) * 4)
|
|
1954
|
+
liveSlots.writeUInt32LE(selected.size, 0)
|
|
1955
|
+
let slotOffset = 4
|
|
1956
|
+
for (const slot of selected) {
|
|
1957
|
+
liveSlots.writeUInt32LE(slot, slotOffset)
|
|
1958
|
+
slotOffset += 4
|
|
1959
|
+
}
|
|
1960
|
+
return { data: blob, liveSlots }
|
|
1949
1961
|
}
|
|
1950
1962
|
|
|
1951
1963
|
function partitionParent(section: string) {
|
package/src/swift-sdk-image.ts
CHANGED
|
@@ -51,6 +51,7 @@ import {
|
|
|
51
51
|
readSwiftPrunedLinkResponse,
|
|
52
52
|
type SwiftSdkObjectOrigin,
|
|
53
53
|
} from './swift-wasm-prune'
|
|
54
|
+
import { SWIFT_SDK_APP_TABLE_BASE } from './swiftSdkLinkContract'
|
|
54
55
|
import { SWIFT_WASM_TRIPLE } from './swiftTargetContract'
|
|
55
56
|
import { KEEP_WASM_NAMES, lowerWasm, WASM_LOWER_IDENTITY } from './wasm-optimize'
|
|
56
57
|
import type { SwiftDistributionWasm } from './swift-distribution-contract'
|
|
@@ -60,7 +61,6 @@ const run = promisify(execFile)
|
|
|
60
61
|
// the app owns memory between the main stack and the sdk; libc's heap follows both.
|
|
61
62
|
export const SWIFT_SDK_APP_MEMORY_BASE = 8372224
|
|
62
63
|
export const SWIFT_SDK_MEMORY_BASE = 128 * 1024 * 1024
|
|
63
|
-
export const SWIFT_SDK_APP_TABLE_BASE = 524288
|
|
64
64
|
|
|
65
65
|
// the app whose production link supplies the sdk image's link line and host exports
|
|
66
66
|
const EMPTY_APP = `import SwiftUI
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { WasmMapChunkIdentity } from './swift-sdk-image-map'
|
|
2
2
|
|
|
3
3
|
export const SWIFT_SDK_FUNCTION_ADDRESS_PREFIX = '__peach_sdk_function_address.'
|
|
4
|
+
export const SWIFT_SDK_APP_TABLE_BASE = 524288
|
|
4
5
|
export const OBJC_LOAD_FUNCTION = '.objcv2_load_function'
|
|
5
6
|
|
|
6
7
|
export type SwiftSdkValueKind = 'address' | 'function' | 'tls'
|
|
@@ -33,6 +34,7 @@ export interface SwiftSdkAppLink {
|
|
|
33
34
|
export interface SwiftSdkBindingAsset {
|
|
34
35
|
readonly sha256: string
|
|
35
36
|
readonly bytes: Buffer
|
|
37
|
+
readonly liveSlots: Buffer
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
export interface SwiftSdkModuleAsset {
|