peachsim 0.1.2662 → 0.1.2664

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.
Files changed (125) hide show
  1. package/dist-lib/agent-daemon-client.cjs +1 -1
  2. package/dist-lib/agent-events.cjs +1 -1
  3. package/dist-lib/attached-projects.cjs +1 -1
  4. package/dist-lib/auth/shared-session.cjs +1 -1
  5. package/dist-lib/backend-origin.cjs +1 -1
  6. package/dist-lib/beta.cjs +1 -1
  7. package/dist-lib/beta.mjs +2 -2
  8. package/dist-lib/bridge-constants.cjs +1 -1
  9. package/dist-lib/bridge-contract-input.cjs +1 -1
  10. package/dist-lib/bridge-contract-input.mjs +5 -5
  11. package/dist-lib/bridge-contract.cjs +1 -1
  12. package/dist-lib/bridge-contract.mjs +3 -3
  13. package/dist-lib/bundle-channel.cjs +314 -12
  14. package/dist-lib/capture-contract.cjs +1 -1
  15. package/dist-lib/capture-contract.mjs +3 -3
  16. package/dist-lib/cloud-contract.cjs +1 -1
  17. package/dist-lib/cloud-contract.mjs +3 -3
  18. package/dist-lib/cloud-test-args.cjs +1 -1
  19. package/dist-lib/cloud-test-args.mjs +2 -2
  20. package/dist-lib/cloud.cjs +1 -1
  21. package/dist-lib/cloud.mjs +7 -7
  22. package/dist-lib/config.cjs +1 -1
  23. package/dist-lib/config.mjs +5 -5
  24. package/dist-lib/detox/index.cjs +2 -2
  25. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  26. package/dist-lib/esm-chunks/{acorn-MFBE73CV.mjs → acorn-3U6EU7PO.mjs} +3 -3
  27. package/dist-lib/esm-chunks/{chunk-T5XVET5M.mjs → chunk-2HO57LUD.mjs} +1 -1
  28. package/dist-lib/esm-chunks/{chunk-ULUPQXN4.mjs → chunk-2LFY365I.mjs} +1 -1
  29. package/dist-lib/esm-chunks/{chunk-N66ZEIRX.mjs → chunk-66KK3MIG.mjs} +2 -2
  30. package/dist-lib/esm-chunks/{chunk-WJ5S2KZR.mjs → chunk-6PEAK5M5.mjs} +1 -1
  31. package/dist-lib/esm-chunks/{chunk-I4WBNATG.mjs → chunk-7IPHJM2I.mjs} +1 -1
  32. package/dist-lib/esm-chunks/{chunk-VC25U5MB.mjs → chunk-BOHFFNGU.mjs} +1 -1
  33. package/dist-lib/esm-chunks/{chunk-JQRP67DQ.mjs → chunk-CFJZS5CE.mjs} +6 -6
  34. package/dist-lib/esm-chunks/{chunk-BXG34MPE.mjs → chunk-ERGD3KKN.mjs} +1 -1
  35. package/dist-lib/esm-chunks/{chunk-UZWDAUVE.mjs → chunk-EZBQ6ZK5.mjs} +1 -1
  36. package/dist-lib/esm-chunks/{chunk-U6EFBR2E.mjs → chunk-FML4O4LG.mjs} +14 -14
  37. package/dist-lib/esm-chunks/{chunk-GOHNNSQT.mjs → chunk-HDUQW4GQ.mjs} +5 -5
  38. package/dist-lib/esm-chunks/{chunk-QZ5QKBQU.mjs → chunk-HZ2MRRBP.mjs} +1 -1
  39. package/dist-lib/esm-chunks/{chunk-VWFJFTPH.mjs → chunk-JLQGBHPP.mjs} +1 -1
  40. package/dist-lib/esm-chunks/{chunk-Q6TBKKDJ.mjs → chunk-JUAYA5J7.mjs} +1 -1
  41. package/dist-lib/esm-chunks/{chunk-2SNPAV3T.mjs → chunk-K2IPDHF4.mjs} +4 -4
  42. package/dist-lib/esm-chunks/{chunk-RET2UHLH.mjs → chunk-KXGHURRU.mjs} +1 -1
  43. package/dist-lib/esm-chunks/{chunk-SEPP7VI2.mjs → chunk-MKUIWBJN.mjs} +1 -1
  44. package/dist-lib/esm-chunks/{chunk-KS5LU45K.mjs → chunk-NBRFPXHI.mjs} +1 -1
  45. package/dist-lib/esm-chunks/{chunk-QOTPXRB5.mjs → chunk-NZL67K66.mjs} +6 -6
  46. package/dist-lib/esm-chunks/{chunk-BFZ5NZWL.mjs → chunk-QZJ5VH7F.mjs} +1 -1
  47. package/dist-lib/esm-chunks/{chunk-T6MLX2EQ.mjs → chunk-UKAH2MGN.mjs} +1 -1
  48. package/dist-lib/esm-chunks/{chunk-QIATHQJU.mjs → chunk-XKY7FRVJ.mjs} +3 -3
  49. package/dist-lib/esm-chunks/{chunk-4O2WUV7P.mjs → chunk-XRVX2ZRS.mjs} +1 -1
  50. package/dist-lib/esm-chunks/{chunk-CMPAZOPV.mjs → chunk-ZPGI2MXX.mjs} +1 -1
  51. package/dist-lib/esm-chunks/{metro-layout-parser-ORSSI3AE.mjs → metro-layout-parser-2VDVNNSP.mjs} +3 -3
  52. package/dist-lib/esm-chunks/{swift-package-prebuilt-BH2JJ5KR.mjs → swift-package-prebuilt-4COK4ZLX.mjs} +12 -12
  53. package/dist-lib/esm-chunks/{swift-sdk-app-module-O5CV2FUF.mjs → swift-sdk-app-module-FDCK65JN.mjs} +16 -16
  54. package/dist-lib/esm-chunks/{swift-sdk-image-4PLMEMHM.mjs → swift-sdk-image-PVTKL5U5.mjs} +16 -16
  55. package/dist-lib/esm-chunks/{swift-sdk-image-producer-3PG6DWGA.mjs → swift-sdk-image-producer-IHDGAN67.mjs} +5 -5
  56. package/dist-lib/expo-swift-bundle.cjs +313 -11
  57. package/dist-lib/expo-swift-metadata.cjs +1 -1
  58. package/dist-lib/expo-swift-metadata.mjs +7 -7
  59. package/dist-lib/home-paths.cjs +1 -1
  60. package/dist-lib/host/bridge-host.cjs +314 -12
  61. package/dist-lib/host/fetch-proxy-handler.cjs +12 -4
  62. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  63. package/dist-lib/host/fetch-proxy-overrides.mjs +2 -2
  64. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  65. package/dist-lib/host/websocket-proxy.cjs +1 -1
  66. package/dist-lib/index.cjs +1 -1
  67. package/dist-lib/kotlin-host.cjs +1 -1
  68. package/dist-lib/menu.cjs +1 -1
  69. package/dist-lib/menu.mjs +3 -3
  70. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  71. package/dist-lib/metro-fingerprint-registry.mjs +3 -3
  72. package/dist-lib/metro-production-bundle.cjs +1 -1
  73. package/dist-lib/metro-production-bundle.mjs +4 -4
  74. package/dist-lib/native-app-identity-project.cjs +1 -1
  75. package/dist-lib/native-app-identity-project.mjs +15 -15
  76. package/dist-lib/native-app-identity.cjs +1 -1
  77. package/dist-lib/native-app-identity.mjs +6 -6
  78. package/dist-lib/native-firebase-metadata.cjs +1 -1
  79. package/dist-lib/native-firebase-metadata.mjs +3 -3
  80. package/dist-lib/pdfium-raster.cjs +1 -1
  81. package/dist-lib/pdfium-raster.mjs +2 -2
  82. package/dist-lib/plist.cjs +1 -1
  83. package/dist-lib/plist.mjs +3 -3
  84. package/dist-lib/profiles.cjs +1 -1
  85. package/dist-lib/public-brand.cjs +1 -1
  86. package/dist-lib/public-origins-lib-esm.json +85 -85
  87. package/dist-lib/public-origins-lib.json +69 -64
  88. package/dist-lib/react-native-host-modules.cjs +1 -1
  89. package/dist-lib/react-native-host-modules.mjs +2 -2
  90. package/dist-lib/reap-browser.cjs +1 -1
  91. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  92. package/dist-lib/sdk.cjs +1 -1
  93. package/dist-lib/sdk.mjs +8 -8
  94. package/dist-lib/skills.cjs +314 -12
  95. package/dist-lib/swift-compile.cjs +1 -1
  96. package/dist-lib/swift-compile.mjs +12 -12
  97. package/dist-lib/swift-package.cjs +1 -1
  98. package/dist-lib/swift-package.mjs +3 -3
  99. package/dist-lib/swift-submit.cjs +1 -1
  100. package/dist-lib/swift-submit.mjs +6 -6
  101. package/dist-lib/swift-svg-raster.cjs +1 -1
  102. package/dist-lib/swift-svg-raster.mjs +2 -2
  103. package/dist-lib/swift-toolchain.cjs +1 -1
  104. package/dist-lib/swift.cjs +1 -1
  105. package/dist-lib/vendor/@peculiar/x509.cjs +1 -1
  106. package/dist-lib/vendor/@ruby/prism/src/nodes.js.cjs +1 -1
  107. package/dist-lib/vendor/@ruby/prism/src/parsePrism.js.cjs +1 -1
  108. package/dist-lib/vendor/acorn.cjs +1 -1
  109. package/dist-lib/vendor/magic-string.cjs +1 -1
  110. package/dist-lib/vendor/stream-json.cjs +1 -1
  111. package/dist-lib/vendor/sucrase/dist/index.js.cjs +1 -1
  112. package/dist-lib/vendor/sucrase/dist/parser/index.js.cjs +1 -1
  113. package/dist-lib/vendor/sucrase/dist/parser/tokenizer/index.js.cjs +1 -1
  114. package/dist-lib/vendor/sucrase/dist/parser/tokenizer/types.js.cjs +1 -1
  115. package/dist-lib/vendor/sucrase.cjs +1 -1
  116. package/dist-lib/vendor/terser.cjs +1 -1
  117. package/dist-lib/vendor/valibot.cjs +1 -1
  118. package/dist-lib/vendor/ws.cjs +1 -1
  119. package/dist-lib/vendor/zod.cjs +1 -1
  120. package/dist-lib/worklet-executable.cjs +1 -1
  121. package/dist-lib/worklet-executable.mjs +3 -3
  122. package/package.json +1 -1
  123. package/runtime-companion.json +1 -1
  124. package/src/turbo-fabric-app.ts +281 -0
  125. package/src/turbo-source.ts +32 -7
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2662 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2664 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2662 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2664 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2662 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2664 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
 
4
4
  // ../../node_modules/acorn/dist/acorn.js
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2662 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2664 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2662 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2664 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2662 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2664 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2662 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2664 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2662 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2664 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2662 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2664 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
 
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2662 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2664 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2662 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2664 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __commonJS = (cb, mod) => function __require() {
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2662 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2664 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
 
4
4
  // ../../node_modules/valibot/dist/index.cjs
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2662 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2664 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2662 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2664 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2662 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2664 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
@@ -1,12 +1,12 @@
1
- /*! peach v0.1.2662 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2664 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  import {
3
3
  parse
4
- } from "./esm-chunks/chunk-QZ5QKBQU.mjs";
4
+ } from "./esm-chunks/chunk-HZ2MRRBP.mjs";
5
5
  import {
6
6
  __privateAdd,
7
7
  __privateGet,
8
8
  __publicField
9
- } from "./esm-chunks/chunk-CMPAZOPV.mjs";
9
+ } from "./esm-chunks/chunk-ZPGI2MXX.mjs";
10
10
 
11
11
  // src/worklet-kernel.ts
12
12
  var Unsupported = class extends Error {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "peachsim",
3
- "version": "0.1.2662",
3
+ "version": "0.1.2664",
4
4
  "description": "Vite and Metro plugins, testing drivers, and SDK exports for peach.",
5
5
  "author": "Tamagui LLC",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -1 +1 @@
1
- {"abi":1,"sha256":"31b7603a64b7e420169226e41dfb40153e4f53755c48f802a93420090f66560b","file":"node/cli-31b7603a64b7e420169226e41dfb40153e4f53755c48f802a93420090f66560b.cjs"}
1
+ {"abi":1,"sha256":"0ad3faed77929d763ea2b0a67e07d83b2b0f804b2274fbd017286c33d22db5ef","file":"node/cli-0ad3faed77929d763ea2b0a67e07d83b2b0f804b2274fbd017286c33d22db5ef.cjs"}
@@ -0,0 +1,281 @@
1
+ export const FABRIC_APP_INCLUDES = `#import <Block.h>
2
+ #import <React/RCTScheduler.h>
3
+ #import <React/RCTSurfacePresenter.h>
4
+ #include <jsi/JSIDynamic.h>
5
+ #include <react/renderer/components/view/BaseViewProps.h>
6
+ #include <react/renderer/components/view/ViewEventEmitter.h>
7
+ #include <react/renderer/core/InstanceHandle.h>
8
+ #include <react/renderer/core/LayoutableShadowNode.h>
9
+ #include <react/renderer/mounting/ShadowTree.h>
10
+ #include <react/renderer/uimanager/UIManager.h>
11
+ `
12
+
13
+ export const FABRIC_APP_PRESENTER = `
14
+ namespace {
15
+ extern std::shared_ptr<react::CallInvoker> fabricInvoker;
16
+ extern std::shared_ptr<react::RuntimeScheduler> fabricScheduler;
17
+ }
18
+
19
+ @interface PeachAppSurfacePresenter : RCTSurfacePresenter
20
+ @property(nonatomic) std::function<void(const react::MountingTransaction &)> publishMount;
21
+ @property(nonatomic) std::function<void(react::Tag, folly::dynamic)> publishProps;
22
+ @property(nonatomic) std::function<void(react::Tag, const std::string &, const folly::dynamic &)> dispatchCommand;
23
+ @end
24
+
25
+ @implementation PeachAppSurfacePresenter
26
+ - (void)schedulerDidFinishTransaction:(std::shared_ptr<const react::MountingCoordinator>)coordinator {
27
+ // guest commits can finish outside a React Native scheduler task.
28
+ fabricInvoker->invokeAsync([](jsi::Runtime &) {
29
+ fabricScheduler->scheduleWork([](jsi::Runtime &) {});
30
+ });
31
+ }
32
+
33
+ - (void)schedulerShouldRenderTransactions:(std::shared_ptr<const react::MountingCoordinator>)coordinator {
34
+ if (auto transaction = coordinator->pullTransaction()) {
35
+ self.publishMount(*transaction);
36
+ }
37
+ }
38
+
39
+ - (void)schedulerDidSynchronouslyUpdateViewOnUIThread:(ReactTag)tag props:(folly::dynamic)props {
40
+ self.publishProps(static_cast<react::Tag>(tag), std::move(props));
41
+ }
42
+
43
+ - (void)schedulerDidDispatchCommand:(const react::ShadowView &)shadowView
44
+ commandName:(const std::string &)name
45
+ args:(const folly::dynamic &)args {
46
+ self.dispatchCommand(shadowView.tag, name, args);
47
+ }
48
+ @end
49
+
50
+ namespace {
51
+ using AppNode = std::shared_ptr<const react::ShadowNode>;
52
+ using AppChildren = std::vector<AppNode>;
53
+
54
+ class PeachAppShadowTree {
55
+ public:
56
+ PeachAppShadowTree(std::shared_ptr<react::UIManager> manager, const react::ContextContainer &context)
57
+ : manager_(std::move(manager)), context_(context) {}
58
+
59
+ ~PeachAppShadowTree() {
60
+ if (surface_ != 0) manager_->getShadowTreeRegistry().remove(surface_);
61
+ }
62
+
63
+ void commit(jsi::Runtime &rt, react::SurfaceId surface, double width, double height, double scale,
64
+ bool rtl, const jsi::Array &roots) {
65
+ react::LayoutConstraints constraints;
66
+ constraints.maximumSize = {static_cast<react::Float>(width), static_cast<react::Float>(height)};
67
+ constraints.minimumSize = constraints.maximumSize;
68
+ constraints.layoutDirection = rtl ? react::LayoutDirection::RightToLeft : react::LayoutDirection::LeftToRight;
69
+ react::LayoutContext layout;
70
+ layout.pointScaleFactor = static_cast<react::Float>(scale);
71
+ layout.viewportSize = constraints.maximumSize;
72
+ if (surface_ != 0 && surface_ != surface)
73
+ throw jsi::JSError(rt, "Fabric runtime is already bound to another app surface");
74
+ if (surface_ == 0) {
75
+ surface_ = surface;
76
+ manager_->startEmptySurface(std::make_unique<react::ShadowTree>(surface_, constraints, layout, *manager_, context_));
77
+ } else if (constraints != constraints_ || layout != layout_) {
78
+ manager_->getShadowTreeRegistry().visit(surface_, [&](const react::ShadowTree &tree) {
79
+ tree.commit([&](const react::RootShadowNode &root) {
80
+ return root.clone({surface_, context_}, constraints, layout);
81
+ }, {});
82
+ });
83
+ }
84
+ constraints_ = constraints;
85
+ layout_ = layout;
86
+
87
+ std::unordered_map<react::Tag, AppNode> next;
88
+ auto children = readChildren(rt, roots, next);
89
+ nodes_.swap(next);
90
+ manager_->completeSurface(surface_, children,
91
+ {.enableStateReconciliation = true, .mountSynchronously = false, .source = react::ShadowTree::CommitSource::React});
92
+ }
93
+
94
+ jsi::Value handle(jsi::Runtime &rt, react::Tag tag, const jsi::Value &surface, const jsi::Value &generation) const {
95
+ auto value = react::valueFromShadowNode(rt, node(rt, tag));
96
+ auto object = value.getObject(rt);
97
+ object.setProperty(rt, "__nativeTag", tag);
98
+ object.setProperty(rt, "__viewTag", tag);
99
+ object.setProperty(rt, "__surfaceId", surface);
100
+ object.setProperty(rt, "__surfaceGeneration", generation);
101
+ return object;
102
+ }
103
+
104
+ void dispatch(jsi::Runtime &rt, react::Tag tag, std::string type, const jsi::Value &payload) const {
105
+ const auto emitter = std::dynamic_pointer_cast<const react::ViewEventEmitter>(node(rt, tag)->getEventEmitter());
106
+ if (emitter) emitter->dispatchEvent(std::move(type), jsi::dynamicFromValue(rt, payload));
107
+ }
108
+
109
+ void publish(jsi::Runtime &rt, const react::ShadowViewMutation &mutation, const jsi::Function &apply) const {
110
+ using Mutation = react::ShadowViewMutation;
111
+ if (mutation.type != Mutation::Insert && mutation.type != Mutation::Update) return;
112
+ const auto &view = mutation.newChildShadowView;
113
+ const auto found = nodes_.find(view.tag);
114
+ if (found == nodes_.end()) return;
115
+ const auto newest = manager_->getNewestCloneOfShadowNode(*found->second);
116
+ const auto *target = dynamic_cast<const react::LayoutableShadowNode *>(newest.get());
117
+ if (!target) return;
118
+ const react::ShadowNode *parent = nullptr;
119
+ if (mutation.parentTag != surface_) {
120
+ const auto mountedParent = nodes_.find(mutation.parentTag);
121
+ if (mountedParent != nodes_.end()) parent = mountedParent->second.get();
122
+ }
123
+ auto layout = jsi::Value::null();
124
+ // fabric's differ includes the offsets of ancestors it flattens into the mount parent.
125
+ const auto targetMetrics = mutation.parentTag == surface_ || parent
126
+ ? manager_->getRelativeLayoutMetrics(*target, parent, {.includeTransform = false})
127
+ : react::EmptyLayoutMetrics;
128
+ if (targetMetrics != react::EmptyLayoutMetrics && view.layoutMetrics.frame != targetMetrics.frame) {
129
+ const auto &frame = view.layoutMetrics.frame;
130
+ const auto &targetFrame = targetMetrics.frame;
131
+ auto rect = jsi::Array(rt, 8);
132
+ double dimensions[] = {frame.origin.x, frame.origin.y, frame.size.width, frame.size.height,
133
+ targetFrame.origin.x, targetFrame.origin.y, targetFrame.size.width, targetFrame.size.height};
134
+ for (size_t i = 0; i < 8; ++i) rect.setValueAtIndex(rt, i, dimensions[i]);
135
+ layout = std::move(rect);
136
+ }
137
+ auto props = jsi::Object(rt);
138
+ if (const auto *style = dynamic_cast<const react::BaseViewProps *>(view.props.get())) {
139
+ const auto *targetStyle = dynamic_cast<const react::BaseViewProps *>(target->getProps().get());
140
+ if (targetStyle && style->opacity != targetStyle->opacity) props.setProperty(rt, "opacity", style->opacity);
141
+ if (targetStyle && style->transform != targetStyle->transform) {
142
+ auto matrix = jsi::Array(rt, 16);
143
+ const auto transform = style->resolveTransform(view.layoutMetrics);
144
+ for (size_t i = 0; i < 16; ++i) matrix.setValueAtIndex(rt, i, transform.matrix[i]);
145
+ auto operation = jsi::Object(rt);
146
+ operation.setProperty(rt, "matrix", std::move(matrix));
147
+ auto entries = jsi::Array(rt, 1);
148
+ entries.setValueAtIndex(rt, 0, std::move(operation));
149
+ props.setProperty(rt, "transform", std::move(entries));
150
+ }
151
+ }
152
+ apply.call(rt, view.tag, std::move(props), std::move(layout));
153
+ }
154
+
155
+ private:
156
+ AppNode node(jsi::Runtime &rt, react::Tag tag) const {
157
+ if (tag == surface_) {
158
+ AppNode root;
159
+ manager_->getShadowTreeRegistry().visit(surface_, [&](const react::ShadowTree &tree) {
160
+ root = tree.getCurrentRevision().rootShadowNode;
161
+ });
162
+ if (root) return root;
163
+ }
164
+ auto found = nodes_.find(tag);
165
+ if (found == nodes_.end()) throw jsi::JSError(rt, "Fabric view is absent from its committed surface");
166
+ if (auto current = manager_->getNewestCloneOfShadowNode(*found->second)) return current;
167
+ return found->second;
168
+ }
169
+
170
+ std::shared_ptr<AppChildren> readChildren(jsi::Runtime &rt, const jsi::Array &values,
171
+ std::unordered_map<react::Tag, AppNode> &next) const {
172
+ auto children = std::make_shared<AppChildren>();
173
+ children->reserve(values.size(rt));
174
+ for (size_t i = 0; i < values.size(rt); ++i) {
175
+ auto row = values.getValueAtIndex(rt, i).asObject(rt).asArray(rt);
176
+ if (row.size(rt) != 5) throw jsi::JSError(rt, "invalid Fabric view in app commit");
177
+ const auto tag = static_cast<react::Tag>(row.getValueAtIndex(rt, 0).asNumber());
178
+ const auto component = row.getValueAtIndex(rt, 1).asString(rt).utf8(rt);
179
+ const auto properties = row.getValueAtIndex(rt, 2);
180
+ const auto instance = row.getValueAtIndex(rt, 3);
181
+ auto descendants = readChildren(rt, row.getValueAtIndex(rt, 4).asObject(rt).asArray(rt), next);
182
+ auto existing = nodes_.find(tag);
183
+ AppNode view;
184
+ if (existing == nodes_.end()) {
185
+ auto initial = manager_->createNode(tag, component, surface_, react::RawProps(rt, properties),
186
+ std::make_shared<react::InstanceHandle>(rt, instance, tag));
187
+ for (const auto &child : *descendants) manager_->appendChild(initial, child);
188
+ view = std::move(initial);
189
+ } else {
190
+ view = manager_->cloneNode(*existing->second, descendants, react::RawProps(rt, properties));
191
+ }
192
+ if (!next.emplace(tag, view).second) throw jsi::JSError(rt, "duplicate Fabric view tag in app commit");
193
+ children->push_back(std::move(view));
194
+ }
195
+ return children;
196
+ }
197
+
198
+ std::shared_ptr<react::UIManager> manager_;
199
+ const react::ContextContainer &context_;
200
+ react::SurfaceId surface_ = 0;
201
+ react::LayoutConstraints constraints_;
202
+ react::LayoutContext layout_;
203
+ std::unordered_map<react::Tag, AppNode> nodes_;
204
+ };
205
+
206
+ PeachAppSurfacePresenter *appSurfacePresenter;
207
+ std::unique_ptr<PeachAppShadowTree> appShadowTree;
208
+ std::optional<jsi::Function> appMountHandler;
209
+ std::optional<jsi::Function> appPropsHandler;
210
+ std::optional<jsi::Function> appCommandHandler;
211
+ }
212
+
213
+ id peachAppSurfacePresenter() {
214
+ return appSurfacePresenter;
215
+ }
216
+ `
217
+
218
+ export const FABRIC_APP_INSTALL = `
219
+ react::RuntimeExecutor execute = [invoker = fabricInvoker](std::function<void(jsi::Runtime &)> &&work) {
220
+ using RuntimeBlock = void (^)(jsi::Runtime &);
221
+ if (const auto *block = work.target<RuntimeBlock>()) {
222
+ // stack blocks need a copy before the executor can queue them.
223
+ RuntimeBlock owned = (__bridge_transfer RuntimeBlock)_Block_copy((__bridge const void *)*block);
224
+ work = [owned](jsi::Runtime &rt) { owned(rt); };
225
+ }
226
+ invoker->invokeAsync(std::move(work));
227
+ };
228
+ appSurfacePresenter = [[PeachAppSurfacePresenter alloc] initWithContextContainer:fabricContext
229
+ runtimeExecutor:execute bridgelessBindingsExecutor:execute];
230
+ appShadowTree = std::make_unique<PeachAppShadowTree>(appSurfacePresenter.scheduler.uiManager, *fabricContext);
231
+ appSurfacePresenter.publishMount = [execute](const react::MountingTransaction &transaction) {
232
+ execute([surface = transaction.getSurfaceId(), mutations = transaction.getMutations()](jsi::Runtime &rt) {
233
+ if (appShadowTree && appMountHandler) {
234
+ for (const auto &mutation : mutations) appShadowTree->publish(rt, mutation, *appMountHandler);
235
+ [appSurfacePresenter.scheduler reportMount:surface];
236
+ }
237
+ });
238
+ };
239
+ appSurfacePresenter.publishProps = [execute](react::Tag tag, folly::dynamic props) {
240
+ execute([tag, props = std::move(props)](jsi::Runtime &rt) {
241
+ if (appPropsHandler) appPropsHandler->call(rt, tag, jsi::valueFromDynamic(rt, props));
242
+ });
243
+ };
244
+ appSurfacePresenter.dispatchCommand = [execute](react::Tag tag, const std::string &name, const folly::dynamic &args) {
245
+ execute([tag, name, args](jsi::Runtime &rt) {
246
+ if (appCommandHandler) appCommandHandler->call(rt, tag, jsi::String::createFromUtf8(rt, name), jsi::valueFromDynamic(rt, args));
247
+ });
248
+ };
249
+ `
250
+
251
+ export const FABRIC_APP_METHODS = `
252
+ method("commitApp", 6, [](jsi::Runtime &rt, const jsi::Value &, const jsi::Value *args, size_t) -> jsi::Value {
253
+ appShadowTree->commit(rt, static_cast<react::SurfaceId>(args[0].asNumber()), args[1].asNumber(),
254
+ args[2].asNumber(), args[3].asNumber(), args[4].getBool(), args[5].asObject(rt).asArray(rt));
255
+ return jsi::Value::undefined();
256
+ });
257
+ method("setAppHandlers", 3, [](jsi::Runtime &rt, const jsi::Value &, const jsi::Value *args, size_t) -> jsi::Value {
258
+ appMountHandler = args[0].asObject(rt).asFunction(rt);
259
+ appPropsHandler = args[1].asObject(rt).asFunction(rt);
260
+ appCommandHandler = args[2].asObject(rt).asFunction(rt);
261
+ return jsi::Value::undefined();
262
+ });
263
+ method("dispatchAppEvent", 3, [](jsi::Runtime &rt, const jsi::Value &, const jsi::Value *args, size_t) -> jsi::Value {
264
+ appShadowTree->dispatch(rt, static_cast<react::Tag>(args[0].asNumber()), args[1].asString(rt).utf8(rt), args[2]);
265
+ return jsi::Value::undefined();
266
+ });
267
+ constexpr auto *shadowFactory = "peachCreateFabricShadowHandle";
268
+ rt.global().setProperty(rt, shadowFactory, jsi::Function::createFromHostFunction(rt,
269
+ jsi::PropNameID::forAscii(rt, shadowFactory), 3,
270
+ [](jsi::Runtime &rt, const jsi::Value &, const jsi::Value *args, size_t) -> jsi::Value {
271
+ return appShadowTree->handle(rt, static_cast<react::Tag>(args[0].asNumber()), args[1], args[2]);
272
+ }));
273
+ `
274
+
275
+ export const FABRIC_APP_TEARDOWN = `
276
+ appShadowTree.reset();
277
+ appMountHandler.reset();
278
+ appPropsHandler.reset();
279
+ appCommandHandler.reset();
280
+ appSurfacePresenter = nil;
281
+ `
@@ -48,6 +48,13 @@ import {
48
48
  installedRendererDependencyGlobs,
49
49
  runInstalledTurboCodegen,
50
50
  } from './turbo-codegen-intake'
51
+ import {
52
+ FABRIC_APP_INCLUDES,
53
+ FABRIC_APP_INSTALL,
54
+ FABRIC_APP_METHODS,
55
+ FABRIC_APP_PRESENTER,
56
+ FABRIC_APP_TEARDOWN,
57
+ } from './turbo-fabric-app'
51
58
  import { installedXcodeWorkspace, readXcodeAppTarget } from './xcode-project'
52
59
  import type { ReactNativeCoreMode } from './react-native-core'
53
60
  import type { SwiftCompileInput } from './swift-compile'
@@ -1835,6 +1842,7 @@ export async function collectTurboSources(options: {
1835
1842
 
1836
1843
  let objc = Boolean(options.reactNativeProvider)
1837
1844
  let fabric = Boolean(options.reactNativeProvider)
1845
+ let appPresenter = false
1838
1846
  // the packages whose own Fabric components compile here
1839
1847
  const fabricPackages = new Set<string>()
1840
1848
  const fabricViews: FabricComponent[] = []
@@ -1999,6 +2007,11 @@ export async function collectTurboSources(options: {
1999
2007
  providerObjC = true
2000
2008
  const stripped = stripComments(text)
2001
2009
  if (OBJC_TURBO.test(stripped) || OBJC_BRIDGE.test(stripped)) {
2010
+ if (/-\s*\(\s*void\s*\)\s*setSurfacePresenter\s*:/.test(stripped)) {
2011
+ fabric = true
2012
+ appPresenter = true
2013
+ fabricTarget ??= { targetName, label, root: provider.root }
2014
+ }
2002
2015
  const registers = OBJC_REGISTERED.test(stripped)
2003
2016
  for (const [, className] of stripped.matchAll(/@implementation\s+(\w+)/g))
2004
2017
  if (!managers.has(className!)) {
@@ -2520,7 +2533,8 @@ export async function collectTurboSources(options: {
2520
2533
  // reach the React Fabric headers its component views include
2521
2534
  const hostTarget =
2522
2535
  (fabricViews.length > 0 ? fabricTarget : null) ??
2523
- (paperClasses.length > 0 ? paperTarget : null)
2536
+ (paperClasses.length > 0 ? paperTarget : null) ??
2537
+ (appPresenter ? fabricTarget : null)
2524
2538
  if (hostTarget) {
2525
2539
  result.fabricComponents = fabricViews.map(({ name }) => name)
2526
2540
  result.paperViewManagers = [...new Set(paperClasses)].sort()
@@ -2556,7 +2570,7 @@ export async function collectTurboSources(options: {
2556
2570
  }
2557
2571
  }
2558
2572
  const unit = `${targetPath(hostTarget.targetName)}/PeachFabricHost.mm`
2559
- add(unit, fabricHostSource(fabricViews, result.paperViewManagers))
2573
+ add(unit, fabricHostSource(fabricViews, result.paperViewManagers, appPresenter))
2560
2574
  scanText(
2561
2575
  { key: unit, ...hostTarget, relative: 'PeachFabricHost.mm' },
2562
2576
  result.files[unit]!,
@@ -3117,6 +3131,7 @@ RCT_EXPORT_METHOD(load:(NSString *)uri
3117
3131
  extern "C" void RCTRegisterModule(Class);
3118
3132
  static PeachTurboModuleDelegate *delegate;
3119
3133
  static RCTTurboModuleManager *manager;
3134
+ id peachAppSurfacePresenter() __attribute__((weak));
3120
3135
 
3121
3136
  @implementation PeachTurboModuleDelegate
3122
3137
 
@@ -3141,6 +3156,9 @@ static RCTTurboModuleManager *manager;
3141
3156
  - (id<RCTTurboModule>)getModuleInstanceFromClass:(Class)moduleClass
3142
3157
  {
3143
3158
  id<RCTTurboModule> module = [moduleClass new];
3159
+ if (peachAppSurfacePresenter && [module respondsToSelector:@selector(setSurfacePresenter:)]) {
3160
+ [module performSelector:@selector(setSurfacePresenter:) withObject:peachAppSurfacePresenter()];
3161
+ }
3144
3162
  if ([module respondsToSelector:@selector(setDispatchToJSThread:)])
3145
3163
  ((id<RCTJSDispatcherModule>)module).dispatchToJSThread = ^(dispatch_block_t block) {
3146
3164
  dispatchToJSThread(block);
@@ -3228,8 +3246,8 @@ ${hasEventDispatcher ? ' if (![RCTGetModuleClasses() containsObject:[RCTEventDi
3228
3246
  auto& runtime = peach::jsi_runtime::create(
3229
3247
  [] { invoker->drain(); },
3230
3248
  [] {
3231
- if (peachTeardownFabricViews) peachTeardownFabricViews();
3232
3249
  [manager invalidate];
3250
+ if (peachTeardownFabricViews) peachTeardownFabricViews();
3233
3251
  manager = nil;
3234
3252
  delegate = nil;
3235
3253
  invoker.reset();
@@ -3401,6 +3419,7 @@ const FABRIC_HOST_PAPER_INCLUDES = `#import <UIKit/UIKit.h>
3401
3419
  #import <React/RCTUIManager.h>
3402
3420
  #import <React/RCTUtils.h>
3403
3421
  #import <React/RCTViewManager.h>
3422
+ #include <react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropComponentDescriptor.h>
3404
3423
  #include <react/renderer/components/view/ViewEventEmitter.h>
3405
3424
  #include <react/renderer/core/ShadowNodeFragment.h>
3406
3425
  #include <react/utils/FollyConvert.h>
@@ -3909,6 +3928,7 @@ public func peach_paper_uiactivity_stop(_ p: UnsafeMutableRawPointer) {
3909
3928
  function fabricHostSource(
3910
3929
  views: readonly FabricComponent[],
3911
3930
  paperClasses: readonly string[],
3931
+ appPresenter: boolean,
3912
3932
  ): string {
3913
3933
  const entries = views
3914
3934
  .map(
@@ -3917,7 +3937,8 @@ function fabricHostSource(
3917
3937
  )
3918
3938
  .join(', ')
3919
3939
  const paper = paperClasses.length > 0
3920
- return `${FABRIC_HOST_INCLUDES}${paper ? FABRIC_HOST_PAPER_INCLUDES : ''}
3940
+ return `${FABRIC_HOST_INCLUDES}${paper ? FABRIC_HOST_PAPER_INCLUDES : ''}${appPresenter ? FABRIC_APP_INCLUDES : ''}
3941
+ ${appPresenter ? FABRIC_APP_PRESENTER : ''}
3921
3942
  @interface PeachFabricComponents : NSObject <RCTComponentViewFactoryComponentProvider>
3922
3943
  @end
3923
3944
 
@@ -4525,8 +4546,8 @@ void applyFabricFocus() {
4525
4546
  fabricFocusField = [[UITextField alloc] initWithFrame:CGRectZero];
4526
4547
  fabricFocusField.backgroundColor = nil;
4527
4548
  fabricFocusField.opaque = NO;
4528
- fabricFocusField.hidden = NO;
4529
- fabricFocusField.userInteractionEnabled = YES;
4549
+ // the browser already owns and draws the guest text editor.
4550
+ fabricFocusField.hidden = YES;
4530
4551
  }
4531
4552
  if (fabricFocusField.superview != container) {
4532
4553
  [container addSubview:fabricFocusField];
@@ -4667,7 +4688,8 @@ static void peachEventDispatcherDispatchEvent(id self, SEL _cmd, id<RCTEvent> ev
4667
4688
  NSNumber *reactTag = event.viewTag;
4668
4689
  if (!reactTag) return;
4669
4690
  auto found = fabricViews.find(reactTag.intValue);
4670
- if (found == fabricViews.end() || !found->second.family) return;
4691
+ if (found == fabricViews.end() || !found->second.family ||
4692
+ !dynamic_cast<const react::LegacyViewManagerInteropComponentDescriptor *>(found->second.descriptor)) return;
4671
4693
  NSArray *args = [event arguments];
4672
4694
  NSString *eventName = args.count >= 2 && [args[1] isKindOfClass:[NSString class]]
4673
4695
  ? args[1]
@@ -4953,6 +4975,7 @@ ${
4953
4975
  std::weak_ptr<react::EventLogger>());
4954
4976
  react::ComponentDescriptorParameters parameters{fabricDispatcher, fabricContext, nullptr};
4955
4977
  fabricDescriptors = [factory createComponentDescriptorRegistryWithParameters:parameters];
4978
+ ${appPresenter ? FABRIC_APP_INSTALL : ''}
4956
4979
  auto views = jsi::Object(rt);
4957
4980
  auto method = [&](const char *name, unsigned count, jsi::HostFunctionType body) {
4958
4981
  views.setProperty(
@@ -4977,6 +5000,7 @@ ${
4977
5000
  }
4978
5001
  }));
4979
5002
  };
5003
+ ${appPresenter ? FABRIC_APP_METHODS : ''}
4980
5004
  // create(name, instanceHandle, props), Create then Insert: the family the
4981
5005
  // handle's events resolve through, the first props, the initial state, and
4982
5006
  // the layout the view has before the engine measures it
@@ -5345,6 +5369,7 @@ void peachTeardownFabricViews() {
5345
5369
  fabricFocusParentTag = 0;
5346
5370
  fabricOwner.reset();
5347
5371
  fabricEventHandler.reset();
5372
+ ${appPresenter ? FABRIC_APP_TEARDOWN : ''}
5348
5373
  }
5349
5374
 
5350
5375
  extern "C" void *peach_fabric_view_content(int tag) {