peachsim 0.1.2935 → 0.1.2937
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/LICENSE +6 -8
- package/cli/account-gate.ts +20 -3
- package/cli/app-bundle-resources.ts +66 -19
- package/cli/catalog/meta.ts +2 -106
- package/cli/command-agent.ts +7 -0
- package/cli/command-registry.ts +0 -1
- package/cli/commands/control.ts +13 -5
- package/cli/commands/daemon.ts +4 -2
- package/cli/commands/device.ts +78 -8
- package/cli/commands/do-chain.ts +11 -8
- package/cli/commands/inspect/core.ts +4 -9
- package/cli/commands/inspect/settling.ts +1 -0
- package/cli/commands/logout.ts +6 -1
- package/cli/commands/map.ts +2 -6
- package/cli/commands/package.ts +112 -57
- package/cli/commands/shell-url.ts +0 -1
- package/cli/download-auth.ts +2 -0
- package/cli/drivers/playwright-provisioning.ts +10 -38
- package/cli/github-workflow-identity.ts +8 -0
- package/cli/internal-child-contract.ts +1 -0
- package/cli/internal-child.ts +5 -0
- package/cli/main.ts +2 -10
- package/cli/outbound-endpoints.ts +26 -0
- package/detox/index.ts +227 -131
- 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 +47 -3
- package/dist-lib/bridge-contract-input.mjs +6 -6
- package/dist-lib/bridge-contract.cjs +10 -1
- package/dist-lib/bridge-contract.mjs +3 -3
- package/dist-lib/bundle-channel.cjs +12779 -9515
- package/dist-lib/capture-contract.cjs +39 -17
- 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 +8 -8
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/config.mjs +6 -6
- package/dist-lib/detox/index.cjs +200 -132
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/esm-chunks/{acorn-Q5TRRYSO.mjs → acorn-IIBLEO25.mjs} +3 -3
- package/dist-lib/esm-chunks/{chunk-UDWBTBVG.mjs → chunk-4FTPQKPT.mjs} +10 -1
- package/dist-lib/esm-chunks/chunk-4WIDTRBB.mjs +10232 -0
- package/dist-lib/esm-chunks/{chunk-LCMFYMT7.mjs → chunk-5QZOQ3NZ.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-BJ2OGUX7.mjs → chunk-CIY67HNL.mjs} +39 -17
- package/dist-lib/esm-chunks/{chunk-SKQTNQYE.mjs → chunk-CQFEMJ64.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-AXWVXRHX.mjs → chunk-CWVMCW23.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-MTALOHQR.mjs → chunk-F6DZ4DS2.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-I4R7IZRD.mjs → chunk-HJMF6O7L.mjs} +74 -46
- package/dist-lib/esm-chunks/chunk-I6T4PXJF.mjs +154 -0
- package/dist-lib/esm-chunks/{chunk-XWAUZKIA.mjs → chunk-IJU3JMWM.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-CXWUIOCH.mjs → chunk-KODEPXQC.mjs} +4 -4
- package/dist-lib/esm-chunks/{chunk-WJE5QHSD.mjs → chunk-LD4K2VBL.mjs} +155 -36
- package/dist-lib/esm-chunks/{chunk-2TSM64HI.mjs → chunk-LTE7YMEG.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-3GGOXUJA.mjs → chunk-M3CSKAJE.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-7G5UETIG.mjs → chunk-NA6DJPB6.mjs} +43 -1
- package/dist-lib/esm-chunks/{chunk-MSUHMNAI.mjs → chunk-NNAX24FS.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-VDJA4LP4.mjs → chunk-PZPJJBAS.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-UEEEJVQA.mjs → chunk-QXSTHMWN.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-S2RJB5I7.mjs → chunk-RBPVK5YI.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-VRAXNGYT.mjs → chunk-SCT5OFDV.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-T3M73LGP.mjs → chunk-U3CJGYSP.mjs} +50 -6
- package/dist-lib/esm-chunks/{chunk-SLUGTGQQ.mjs → chunk-VXTOQ522.mjs} +12 -6
- package/dist-lib/esm-chunks/{chunk-EL44SZMV.mjs → chunk-WMSVGYTH.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-FEDEPSEV.mjs → chunk-WRWINRWK.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-BNO52N2S.mjs → chunk-YZF2USRD.mjs} +1905 -8760
- package/dist-lib/esm-chunks/{chunk-TQLKYMVP.mjs → chunk-ZNHR6C3L.mjs} +1 -1
- package/dist-lib/esm-chunks/{download-auth-registry-G75MIT55.mjs → download-auth-registry-AHS5MSIB.mjs} +4 -4
- package/dist-lib/esm-chunks/{metro-layout-parser-FXLUDTYT.mjs → metro-layout-parser-24ZYK5UP.mjs} +3 -3
- package/dist-lib/esm-chunks/{swift-package-prebuilt-524D4MA2.mjs → swift-package-prebuilt-L4YNXQRD.mjs} +15 -15
- package/dist-lib/esm-chunks/{swift-sdk-app-module-EX544YJY.mjs → swift-sdk-app-module-RM652JSW.mjs} +87 -71
- package/dist-lib/esm-chunks/{swift-sdk-image-LOTMWVM7.mjs → swift-sdk-image-5PQ44UJT.mjs} +15 -15
- package/dist-lib/esm-chunks/{swift-sdk-image-producer-UO6B3M4U.mjs → swift-sdk-image-producer-GD3SM6YI.mjs} +5 -5
- package/dist-lib/esm-chunks/swift-sdk-later-data-62QYJ2KH.mjs +590 -0
- package/dist-lib/expo-swift-bundle.cjs +21037 -17896
- package/dist-lib/expo-swift-metadata.cjs +8 -2
- package/dist-lib/expo-swift-metadata.mjs +9 -8
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +22481 -18741
- package/dist-lib/host/fetch-proxy-handler.cjs +21079 -17980
- 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 +68 -38
- package/dist-lib/kotlin-host.cjs +97 -21
- 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 +23 -1
- package/dist-lib/metro-production-bundle.mjs +24 -4
- package/dist-lib/native-app-identity-project.cjs +3582 -571
- package/dist-lib/native-app-identity-project.mjs +1024 -398
- 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 +132 -116
- package/dist-lib/public-origins-lib.json +215 -173
- 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 +17 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +6 -7
- package/dist-lib/sdk.mjs +13 -14
- package/dist-lib/skills.cjs +23216 -19650
- package/dist-lib/swift-compile.cjs +4337 -2905
- package/dist-lib/swift-compile.mjs +15 -13
- 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 +19 -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/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 +94 -32
- package/dist-lib/vendor/zod.cjs +1 -1
- package/dist-lib/worklet-executable.cjs +8 -5
- package/dist-lib/worklet-executable.mjs +9 -6
- package/dist-types/packages/peach-engine/src/canvaskit-artifact-urls.d.ts +2 -1
- package/dist-types/packages/peach-engine/src/capture/compositor-presentation-recording.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/generated/canvaskit-artifact-hashes.d.ts +26 -0
- package/dist-types/packages/peach-engine/src/engine/guest-scene-inspect.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/engine/inspect-info.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/metalTypes.d.ts +32 -2
- package/dist-types/packages/peach-engine/src/engine/portalContract.d.ts +24 -0
- package/dist-types/packages/peach-engine/src/engine/remote-display-protocol.d.ts +12 -2
- package/dist-types/packages/peach-engine/src/guest/http-cookie-storage.d.ts +73 -0
- package/dist-types/packages/peach-engine/src/guest/native-evaluation-lease.d.ts +5 -0
- package/dist-types/packages/peach-engine/src/guest/nitro-jsi-host.d.ts +3 -1
- package/dist-types/packages/peach-engine/src/ios/apps/canvas-map-data.d.ts +225 -9
- package/dist-types/packages/peach-engine/src/ios/chrome-metrics.d.ts +4 -1
- package/dist-types/packages/peach-engine/src/ios/duo-vertical-bar-geometry.d.ts +0 -1
- package/dist-types/packages/peach-engine/src/native-preview-bundle.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/remote-stream/canvas-display-compositor.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/remote-stream/canvas-display-contract.d.ts +44 -10
- package/dist-types/packages/peach-engine/src/remote-stream/cloud-display.d.ts +4 -3
- package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +2 -4
- package/dist-types/packages/peach-engine/src/render-worker/metro-bundle-metadata.d.ts +2 -0
- package/dist-types/packages/peach-engine/src/render-worker/native-widgetContract.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/render-worker/protocol.d.ts +15 -27
- package/dist-types/packages/peach-engine/src/render-worker/reanimated-readiness.d.ts +2 -6
- package/dist-types/packages/peach-engine/src/render-worker/shell-protocol.d.ts +11 -3
- package/dist-types/packages/peach-engine/src/settings/devices.d.ts +3 -1
- package/dist-types/packages/peach-engine/src/settings/duo-fold.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/webview-automation-host.d.ts +1 -1
- package/dist-types/packages/peach-globals/src/app-bundle-resources.d.ts +10 -0
- package/dist-types/packages/peach-globals/src/compositorBridgeContract.d.ts +1 -1
- package/dist-types/packages/peach-globals/src/hostStorageBridgeContract.d.ts +1 -0
- package/dist-types/packages/peach-globals/src/index.d.ts +2 -2
- package/dist-types/packages/peach-globals/src/lockstepCaptureBridgeContract.d.ts +9 -6
- package/dist-types/packages/peach-globals/src/nodeContract.d.ts +11 -0
- package/dist-types/packages/peach-globals/src/oneWidgetContract.d.ts +28 -0
- package/package.json +2 -2
- package/runtime-companion.json +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreHaptics.framework/Headers/CoreHaptics.h +251 -0
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INImage.h +14 -0
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INIntent.h +18 -0
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INIntentIdentifiers.h +30 -0
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INIntentResponse.h +12 -0
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INInteraction.h +35 -0
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INObjectCollection.h +0 -7
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INObjectSection.h +0 -7
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INOutgoingMessageType.h +7 -0
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INPerson.h +36 -0
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INPersonHandle.h +22 -0
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INSendMessageIntent+UserNotifications.h +6 -0
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INSendMessageIntent.h +33 -0
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/INSpeakableString.h +24 -0
- package/sdk/ios/System/Library/Frameworks/Intents.framework/Headers/Intents.h +11 -7
- package/sdk/ios/System/Library/Frameworks/MessageUI.framework/Headers/MFMailComposeViewController.h +1 -1
- package/sdk/ios/System/Library/Frameworks/MessageUI.framework/Headers/MFMessageComposeViewController.h +1 -1
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLRenderCommandEncoder.h +0 -8
- package/sdk/ios/System/Library/Frameworks/MetalTypes.framework/Headers/MetalTypes.h +8 -0
- package/sdk/ios/System/Library/Frameworks/Social.framework/Headers/SLServiceTypes.h +9 -0
- package/sdk/ios/System/Library/Frameworks/Social.framework/Headers/Social.h +1 -0
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotification.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationAction.h +2 -2
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationAttachment.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationCategory.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationContent.h +2 -2
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationRequest.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationResponse.h +2 -2
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationSound.h +1 -1
- package/sdk/ios/System/Library/Frameworks/UserNotifications.framework/Headers/UNNotificationTrigger.h +5 -5
- package/sdk/ios/usr/lib/swift/UIKit.swiftmodule/arm64-apple-ios-simulator.swiftinterface +4 -0
- package/sdk/ios/wasm/include/unistd.h +1 -0
- package/src/acorn-program.ts +3 -0
- package/src/audio-codec-archives.ts +141 -0
- package/src/bridge-contract-input.ts +61 -1
- package/src/bridge-contract.ts +45 -4
- package/src/bundle-channel.mjs +44 -30
- package/src/capture-contract.ts +57 -39
- package/src/conformance-comparison-contract.ts +2 -0
- package/src/expo-discovery-cache.ts +0 -2
- package/src/expo-macro-host.ts +8 -3
- package/src/expo-native-compiler-digest.ts +0 -1
- package/src/expo-native-prebuilt.ts +1 -1
- package/src/expo-native-workspace.ts +83 -45
- package/src/expo-pod-prebuilt.ts +1 -0
- package/src/expo-swift-host.ts +158 -77
- package/src/expo-swift-legacy-runtime-source.ts +12 -1
- package/src/expo-swift-view-source.ts +51 -20
- package/src/expo-workspace-exclusion.ts +7 -1
- package/src/expoSwiftContract.ts +10 -1
- package/src/ffmpeg-source-build.ts +123 -59
- package/src/genrule-archives.ts +7 -2
- package/src/genrule-library-builds.ts +101 -18
- package/src/host/bridge-host.ts +10 -1
- package/src/installed-native-libraries.ts +147 -23
- package/src/installed-package-versions.ts +30 -0
- package/src/ios-rn-bundle-request.ts +3 -1
- package/src/ios-rn-bundle.ts +38 -27
- package/src/ios-rn-compile.ts +23 -6
- package/src/ios-rn-startup.ts +2 -1
- package/src/java-module-abi.ts +4 -3
- package/src/kotlin-host.ts +4 -4
- package/src/kotlin-library-sources.ts +8 -5
- package/src/metro-production-bundle.ts +24 -0
- package/src/native-firebase-config.ts +2 -0
- package/src/native-framework-compiler.ts +5 -0
- package/src/native-package-slice-build.ts +3 -0
- package/src/native-package-slice.ts +15 -10
- package/src/native-preparation.ts +4 -1
- package/src/native-static-libraries.ts +107 -33
- package/src/nativeRuntimePackageIndex.ts +1 -4
- package/src/nitro-adapter.lock.json +286 -286
- package/src/nitro-app-providers.ts +20 -8
- package/src/nitro-compile.ts +131 -37
- package/src/nitro-dependencies.ts +42 -8
- package/src/nitro-source.ts +40 -36
- package/src/nitro-superset.lock.json +4 -4
- package/src/nitroAdapterContract.ts +32 -7
- package/src/nitroContract.ts +21 -37
- package/src/one-direct-host-source.ts +247 -140
- package/src/one-fabric.ts +129 -0
- package/src/one-native-controls-package.ts +95 -21
- package/src/one-native-controls-release.ts +147 -14
- package/src/one-native-source.ts +4 -1
- package/src/one-nitro-inputs.ts +1 -1
- package/src/one-nitro-source.ts +45 -1
- package/src/one-sdk/source.ts +10 -41
- package/src/one-widget-metadata.ts +2 -2
- package/src/one-widget-package.ts +1 -1
- package/src/oneSdkContract.ts +3 -0
- package/src/playwright-browser-paths.ts +30 -0
- package/src/pods-install.ts +6 -2
- package/src/pods-post-install.ts +2 -2
- package/src/pods-project.ts +10 -0
- package/src/podspec-ruby-stdlib.ts +73 -0
- package/src/podspec-ruby.ts +1 -1
- package/src/podspec-sources.ts +31 -13
- package/src/process-group.ts +135 -5
- package/src/published-swift-sdk.ts +25 -1
- package/src/react-native-bridge-modules.ts +35 -3
- package/src/react-native-core-build.ts +14 -2
- package/src/react-native-core.ts +12 -2
- package/src/rive-runtime-dependencies.ts +178 -40
- package/src/serverDiscoveryContract.ts +1 -1
- package/src/storageSnapshotContract.ts +1 -1
- package/src/swift-app-data-store.ts +35 -0
- package/src/swift-compile.ts +403 -121
- package/src/swift-compiler-digest.ts +4 -0
- package/src/swift-darwin-records.ts +6 -0
- package/src/swift-distribution-mirror.ts +10 -1
- package/src/swift-distribution.lock.json +19 -18
- package/src/swift-distribution.ts +17 -1
- package/src/swift-entry-module.ts +1 -0
- package/src/swift-guest-compile.ts +8 -1
- package/src/swift-host.ts +79 -23
- package/src/swift-installed-targets.ts +51 -20
- package/src/swift-objc-standin.ts +60 -8
- package/src/swift-packages.ts +104 -24
- package/src/swift-project-user.ts +2 -1
- package/src/swift-reproducible.ts +99 -1
- package/src/swift-root-lock.ts +52 -46
- package/src/swift-sdk-app-module.ts +65 -13
- package/src/swift-sdk-image-producer.ts +2 -1
- package/src/swift-sdk-image.ts +23 -8
- package/src/swift-sdk-later-data.ts +294 -44
- package/src/swift-sdk-surface.ts +233 -55
- package/src/swift-shared-sdk.ts +7 -0
- package/src/swift-standin-builtin-behavior.ts +18 -0
- package/src/swift-standin-emit.ts +242 -54
- package/src/swift-standins.ts +184 -38
- package/src/swift-startup-split.ts +19 -9
- package/src/swift-toolchain.ts +18 -0
- package/src/swift-wasm-prune.ts +179 -9
- package/src/swift-xcframework.ts +16 -0
- package/src/swiftContract.ts +4 -1
- package/src/swiftSdkLinkContract.ts +2 -0
- package/src/swiftTargetContract.ts +1 -0
- package/src/turbo-bundle.ts +6 -3
- package/src/turbo-codegen-intake.ts +106 -16
- package/src/turbo-compile.ts +89 -68
- package/src/turbo-fabric-app.ts +287 -23
- package/src/turbo-provider-host.ts +122 -31
- package/src/turbo-runtime.lock.json +26 -26
- package/src/turbo-source.ts +374 -157
- package/src/vite-plugin.ts +48 -112
- package/src/wasm-binary-sections.ts +40 -0
- package/src/wasm-code-immediates.ts +35 -5
- package/src/widget-extension-bundle.ts +15 -1
- package/src/worklet-executable.ts +2 -1
- package/src/worklet-kernel.ts +5 -3
- package/src/worklets-babel.ts +2 -1
- package/src/xcode-project.ts +151 -53
- package/src/xcode-scheme-actions.ts +104 -0
- package/cli/commands/canvas.ts +0 -1204
- package/dist-lib/esm-chunks/chunk-B5QD2KEV.mjs +0 -2787
- package/dist-lib/vendor/magic-string.cjs +0 -1693
- package/dist-types/packages/peach-compat/src/stubs/native-seams/react-native-cookies.d.ts +0 -127
- package/src/appBundleResourcesContract.ts +0 -51
- package/src/canvas-groups.ts +0 -28
- package/src/canvas-map-layout.ts +0 -161
- package/src/oneWidgetContract.ts +0 -134
|
@@ -39,7 +39,6 @@ public final class PeachOneDirectStage: NSObject {
|
|
|
39
39
|
view.backgroundColor = .clear
|
|
40
40
|
self.stageView = view
|
|
41
41
|
_ = OneNativeAsyncActionModule.self
|
|
42
|
-
_ = PeachDirectBarMenuButton.self
|
|
43
42
|
_ = PeachDirectTabs.self
|
|
44
43
|
_ = PeachDirectStackHostView.self
|
|
45
44
|
super.init()
|
|
@@ -97,41 +96,6 @@ public final class PeachDirectStackHostView: UIView {
|
|
|
97
96
|
}
|
|
98
97
|
}
|
|
99
98
|
|
|
100
|
-
@MainActor
|
|
101
|
-
@objc(PeachDirectBarMenuButton)
|
|
102
|
-
public final class PeachDirectBarMenuButton: UIButton {
|
|
103
|
-
@objc public weak var hostView: UIView?
|
|
104
|
-
|
|
105
|
-
@objc public override init(frame: CGRect) {
|
|
106
|
-
super.init(frame: frame)
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
required init?(coder: NSCoder) {
|
|
110
|
-
fatalError("init(coder:) is unavailable")
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
public override var window: UIWindow? {
|
|
114
|
-
super.window ?? hostView?.window
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
public override func contextMenuInteraction(
|
|
118
|
-
_ interaction: UIContextMenuInteraction,
|
|
119
|
-
willDisplayMenuFor configuration: UIContextMenuConfiguration,
|
|
120
|
-
animator: (any UIContextMenuInteractionAnimating)?
|
|
121
|
-
) {
|
|
122
|
-
super.contextMenuInteraction(interaction, willDisplayMenuFor: configuration, animator: animator)
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
public override func contextMenuInteraction(
|
|
126
|
-
_ interaction: UIContextMenuInteraction,
|
|
127
|
-
willEndFor configuration: UIContextMenuConfiguration,
|
|
128
|
-
animator: (any UIContextMenuInteractionAnimating)?
|
|
129
|
-
) {
|
|
130
|
-
super.contextMenuInteraction(interaction, willEndFor: configuration, animator: animator)
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
|
|
135
99
|
@MainActor
|
|
136
100
|
private final class PeachDirectTabPageView: UIView {
|
|
137
101
|
var onAttach: (() -> Void)?
|
|
@@ -282,7 +246,10 @@ public final class PeachDirectTabs: NSObject {
|
|
|
282
246
|
emit: @escaping (String, NSDictionary) -> Void
|
|
283
247
|
) {
|
|
284
248
|
self.spec = spec
|
|
285
|
-
self.tint
|
|
249
|
+
if self.tint != tint {
|
|
250
|
+
self.tint = tint
|
|
251
|
+
applyTabTint()
|
|
252
|
+
}
|
|
286
253
|
self.background = background
|
|
287
254
|
self.emit = emit
|
|
288
255
|
var parsedBadges: [String: [String: UIColor]] = [:]
|
|
@@ -357,6 +324,8 @@ public final class PeachDirectTabs: NSObject {
|
|
|
357
324
|
view: view,
|
|
358
325
|
onLayout: { rect in onSlotLayout(node, rect) }
|
|
359
326
|
)
|
|
327
|
+
// the UIKit tab controller gives routed pages its full bounds, under the status and tab bars.
|
|
328
|
+
item.configureStyle(["sdkModifiers": Self.encodeJSON([["edgesIgnoringSafeArea", "all"]])])
|
|
360
329
|
item.icon = Self.iconImage(screenSpec.iconNode)
|
|
361
330
|
item.selectedIcon = Self.iconImage(screenSpec.selectedIconNode)
|
|
362
331
|
if screenSpec.iconNode != 0 || screenSpec.selectedIconNode != 0 {
|
|
@@ -456,16 +425,23 @@ public final class PeachDirectTabs: NSObject {
|
|
|
456
425
|
return page
|
|
457
426
|
}
|
|
458
427
|
|
|
428
|
+
private func applyTabTint() {
|
|
429
|
+
guard let tabBarController else { return }
|
|
430
|
+
tabBarController.view.tintColor = tint
|
|
431
|
+
tabBarController.tabBar.tintColor = tint
|
|
432
|
+
}
|
|
433
|
+
|
|
459
434
|
@discardableResult
|
|
460
435
|
private func applyBadgeColors() -> Bool {
|
|
461
436
|
if tabBarController == nil {
|
|
462
437
|
for page in pagesByNode.values where page.window != nil {
|
|
463
438
|
var next: UIResponder? = page
|
|
464
439
|
while let current = next {
|
|
465
|
-
if let controller = current as? UIViewController
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
440
|
+
if let controller = current as? UIViewController,
|
|
441
|
+
let tabs = (controller as? UITabBarController) ?? controller.tabBarController
|
|
442
|
+
{
|
|
443
|
+
tabBarController = tabs
|
|
444
|
+
if tint != nil { applyTabTint() }
|
|
469
445
|
break
|
|
470
446
|
}
|
|
471
447
|
next = current.next
|
|
@@ -1902,7 +1878,6 @@ static inline void PeachProfilerSheet(peach_node node) { (void)node; }
|
|
|
1902
1878
|
export const PEACH_ONE_DIRECT_HOST_MM = `#import <Foundation/Foundation.h>
|
|
1903
1879
|
#import <UIKit/UIKit.h>
|
|
1904
1880
|
#import "PeachContainer.h"
|
|
1905
|
-
#include "../native/core/containers/stack_record.h"
|
|
1906
1881
|
#include "../native/core/containers/swipe_actions_record.h"
|
|
1907
1882
|
#include "../native/core/containers/zoom_record.h"
|
|
1908
1883
|
#include "../native/core/containers/table_list_record.h"
|
|
@@ -1910,6 +1885,7 @@ export const PEACH_ONE_DIRECT_HOST_MM = `#import <Foundation/Foundation.h>
|
|
|
1910
1885
|
#include "../native/core/containers/swift_ui_record.h"
|
|
1911
1886
|
#include "../native/core/containers/tabs_record.h"
|
|
1912
1887
|
#include "../native/core/containers/swift_host_record.h"
|
|
1888
|
+
#import "PeachEffects.h"
|
|
1913
1889
|
#import "PeachGestures.h"
|
|
1914
1890
|
#import "PeachHeaderSearch.h"
|
|
1915
1891
|
#import "PeachMenu.h"
|
|
@@ -1925,6 +1901,7 @@ export const PEACH_ONE_DIRECT_HOST_MM = `#import <Foundation/Foundation.h>
|
|
|
1925
1901
|
#include "../peach_core_css.h"
|
|
1926
1902
|
#include "../include/OneNativeControlsHost.h"
|
|
1927
1903
|
|
|
1904
|
+
#include <algorithm>
|
|
1928
1905
|
#include <cmath>
|
|
1929
1906
|
#include <cstdint>
|
|
1930
1907
|
#include <cstring>
|
|
@@ -1949,8 +1926,8 @@ int32_t peach_guest_one_emit_container_event(uint32_t nodeLo, uint32_t nodeHi, c
|
|
|
1949
1926
|
PEACH_ONE_GUEST_IMPORT("node_css_color")
|
|
1950
1927
|
uint32_t peach_guest_one_node_css_color(uint32_t nodeLo, uint32_t nodeHi, const char* sourcePtr,
|
|
1951
1928
|
uint32_t sourceLen, double* rgbaOut);
|
|
1952
|
-
PEACH_ONE_GUEST_IMPORT("
|
|
1953
|
-
uint32_t
|
|
1929
|
+
PEACH_ONE_GUEST_IMPORT("node_layout_frame")
|
|
1930
|
+
uint32_t peach_guest_one_node_layout_frame(uint32_t nodeLo, uint32_t nodeHi, double* frameOut);
|
|
1954
1931
|
PEACH_ONE_GUEST_IMPORT("slot_content_frame")
|
|
1955
1932
|
uint32_t peach_guest_one_slot_content_frame(uint32_t ownerLo, uint32_t ownerHi,
|
|
1956
1933
|
uint32_t contentLo, uint32_t contentHi, double x, double y, double width, double height);
|
|
@@ -1964,6 +1941,18 @@ PEACH_ONE_GUEST_IMPORT("wake_stage")
|
|
|
1964
1941
|
void peach_guest_one_wake_stage(void);
|
|
1965
1942
|
}
|
|
1966
1943
|
|
|
1944
|
+
#import "../apple/PeachNativeRoutes.h"
|
|
1945
|
+
|
|
1946
|
+
static id<PeachNativeRouteRoot> gNativeRoutes;
|
|
1947
|
+
|
|
1948
|
+
static void emitRouteText(NSString* event, NSString* value) {
|
|
1949
|
+
NSData* name = [event dataUsingEncoding:NSUTF8StringEncoding];
|
|
1950
|
+
NSData* payload = [value dataUsingEncoding:NSUTF8StringEncoding];
|
|
1951
|
+
peach_guest_one_emit_container_event(0, 0,
|
|
1952
|
+
static_cast<const char*>(name.bytes), static_cast<uint32_t>(name.length),
|
|
1953
|
+
static_cast<const char*>(payload.bytes), static_cast<uint32_t>(payload.length));
|
|
1954
|
+
}
|
|
1955
|
+
|
|
1967
1956
|
static inline peach_node joinNode(uint32_t lo, uint32_t hi) {
|
|
1968
1957
|
return static_cast<uint64_t>(lo) | (static_cast<uint64_t>(hi) << 32);
|
|
1969
1958
|
}
|
|
@@ -1980,6 +1969,8 @@ static inline uint32_t nodeHi(peach_node node) { return static_cast<uint32_t>(no
|
|
|
1980
1969
|
@implementation PeachSafeAreaView
|
|
1981
1970
|
@end
|
|
1982
1971
|
|
|
1972
|
+
UIImage* PeachRecordBarImage(const peach_container::BarImage& image, id waiter, void (^loaded)(UIImage*));
|
|
1973
|
+
|
|
1983
1974
|
@interface PeachDirectStackRoute : UIViewController <UIAdaptivePresentationControllerDelegate>
|
|
1984
1975
|
@property(nonatomic, copy) NSString* routeKey;
|
|
1985
1976
|
@property(nonatomic) peach_node node;
|
|
@@ -1989,17 +1980,25 @@ static inline uint32_t nodeHi(peach_node node) { return static_cast<uint32_t>(no
|
|
|
1989
1980
|
@property(nonatomic) BOOL skipAnimation;
|
|
1990
1981
|
@property(nonatomic, copy) PeachContainerEmit emit;
|
|
1991
1982
|
@property(nonatomic) PeachHeaderSearch* search;
|
|
1983
|
+
@property(nonatomic) PeachZoomTransition* zoom;
|
|
1992
1984
|
// nil for a card the navigation controller pushes; the UIKit style a modal route presents with
|
|
1993
1985
|
@property(nonatomic) NSNumber* presentationStyle;
|
|
1994
1986
|
@property(nonatomic) UINavigationController* modalNavigation;
|
|
1987
|
+
@property(nonatomic) PeachStackSheetConfiguration* sheetConfiguration;
|
|
1995
1988
|
@property(nonatomic, copy) void (^dismissed)(void);
|
|
1996
1989
|
@property(nonatomic, copy) void (^dismissRequested)(void);
|
|
1990
|
+
- (void)configureZoom:(const std::optional<peach_container::StackZoom>&)zoom
|
|
1991
|
+
from:(PeachDirectStackRoute*)modalSource;
|
|
1992
|
+
- (void)applyHeaderAppearanceInBar:(UINavigationBar*)bar;
|
|
1997
1993
|
- (UIViewController*)presentedController;
|
|
1994
|
+
- (void)configureSheetOn:(UIViewController*)presented from:(UIViewController*)presenter;
|
|
1998
1995
|
@end
|
|
1999
1996
|
|
|
2000
1997
|
@interface PeachDirectStackRoute () {
|
|
2001
1998
|
@public
|
|
2002
1999
|
std::optional<peach_container::StackHeader> header;
|
|
2000
|
+
peach_container::StackColors colors;
|
|
2001
|
+
std::optional<peach_container::StackSheet> sheetOptions;
|
|
2003
2002
|
@private
|
|
2004
2003
|
BOOL _sentSafeArea;
|
|
2005
2004
|
UIEdgeInsets _sentInsets;
|
|
@@ -2010,6 +2009,57 @@ static inline uint32_t nodeHi(peach_node node) { return static_cast<uint32_t>(no
|
|
|
2010
2009
|
@end
|
|
2011
2010
|
|
|
2012
2011
|
@implementation PeachDirectStackRoute
|
|
2012
|
+
- (void)applyHeaderAppearanceInBar:(UINavigationBar*)bar {
|
|
2013
|
+
const auto backIcon = header->backIcon;
|
|
2014
|
+
__weak PeachDirectStackRoute* weakRoute = self;
|
|
2015
|
+
UIImage* indicator = backIcon ? PeachRecordBarImage(*backIcon, self, ^(UIImage* image) {
|
|
2016
|
+
PeachDirectStackRoute* route = weakRoute;
|
|
2017
|
+
UINavigationBar* current = route.navigationController.navigationBar;
|
|
2018
|
+
if (image && current && route->header->backIcon == backIcon)
|
|
2019
|
+
PeachApplyNativeHeaderAppearance(route.navigationItem, current, *route->header, route->colors, image);
|
|
2020
|
+
}) : nil;
|
|
2021
|
+
PeachApplyNativeHeaderAppearance(self.navigationItem, bar, *header, colors, indicator);
|
|
2022
|
+
}
|
|
2023
|
+
|
|
2024
|
+
- (void)configureZoom:(const std::optional<peach_container::StackZoom>&)zoom
|
|
2025
|
+
from:(PeachDirectStackRoute*)modalSource {
|
|
2026
|
+
NSString* barIdentifier = zoom ? PeachRecordString(zoom->sourceBarButtonItemIdentifier) : nil;
|
|
2027
|
+
NSString* identifier = barIdentifier ?: (zoom ? PeachRecordString(zoom->zoomTransitionSourceIdentifier) : nil);
|
|
2028
|
+
if (self.zoom && (![self.zoom.identifier isEqualToString:identifier] ||
|
|
2029
|
+
self.zoom.usesBarButtonItem != (barIdentifier != nil))) {
|
|
2030
|
+
[self.zoom detach];
|
|
2031
|
+
self.zoom = nil;
|
|
2032
|
+
}
|
|
2033
|
+
if (identifier.length) {
|
|
2034
|
+
if (!self.zoom) {
|
|
2035
|
+
UIBarButtonItem* (^barButton)(UIViewController*) = nil;
|
|
2036
|
+
if (barIdentifier) {
|
|
2037
|
+
__weak PeachDirectStackRoute* sourceRoute = modalSource;
|
|
2038
|
+
barButton = ^UIBarButtonItem*(UIViewController* source) {
|
|
2039
|
+
source = sourceRoute ?: source;
|
|
2040
|
+
if ([source isKindOfClass:UINavigationController.class])
|
|
2041
|
+
source = static_cast<UINavigationController*>(source).topViewController;
|
|
2042
|
+
for (NSArray<UIBarButtonItem*>* items in @[source.navigationItem.leftBarButtonItems ?: @[],
|
|
2043
|
+
source.navigationItem.rightBarButtonItems ?: @[], source.toolbarItems ?: @[]])
|
|
2044
|
+
for (UIBarButtonItem* item in items)
|
|
2045
|
+
if ([item.identifier isEqualToString:barIdentifier]) return item;
|
|
2046
|
+
return nil;
|
|
2047
|
+
};
|
|
2048
|
+
}
|
|
2049
|
+
self.zoom = [[PeachZoomTransition alloc] initWithController:self identifier:identifier barButtonItem:barButton];
|
|
2050
|
+
}
|
|
2051
|
+
const auto& bounds = zoom->dismissalBoundsRect;
|
|
2052
|
+
using Bounds = peach_container::StackZoomBounds;
|
|
2053
|
+
const auto bound = [&](std::optional<double> Bounds::* edge) -> NSNumber* {
|
|
2054
|
+
return bounds && (*bounds).*edge ? @(*((*bounds).*edge)) : nil;
|
|
2055
|
+
};
|
|
2056
|
+
[self.zoom configureWithMinX:bound(&Bounds::minX) maxX:bound(&Bounds::maxX)
|
|
2057
|
+
minY:bound(&Bounds::minY) maxY:bound(&Bounds::maxY)
|
|
2058
|
+
gestureEnabled:self.gestureEnabled && !self.guardsRemoval alignmentYOffset:nil];
|
|
2059
|
+
}
|
|
2060
|
+
self.modalNavigation.preferredTransition = self.preferredTransition;
|
|
2061
|
+
}
|
|
2062
|
+
|
|
2013
2063
|
- (void)reportSafeArea {
|
|
2014
2064
|
if (!self.node || !self.view.window) return;
|
|
2015
2065
|
const CGRect bounds = self.view.bounds;
|
|
@@ -2058,19 +2108,33 @@ static inline uint32_t nodeHi(peach_node node) { return static_cast<uint32_t>(no
|
|
|
2058
2108
|
// navigation controller, and the presentation follows the route's gesture and removal guard.
|
|
2059
2109
|
- (UIViewController*)presentedController {
|
|
2060
2110
|
if (!self.presentingViewController && !self.modalNavigation.presentingViewController) {
|
|
2061
|
-
self.
|
|
2062
|
-
|
|
2111
|
+
if (self.headerHidden) self.modalNavigation = nil;
|
|
2112
|
+
else if (!self.modalNavigation) {
|
|
2113
|
+
self.modalNavigation = [[UINavigationController alloc] initWithRootViewController:self];
|
|
2114
|
+
[self applyHeaderAppearanceInBar:self.modalNavigation.navigationBar];
|
|
2115
|
+
}
|
|
2116
|
+
self.modalNavigation.preferredTransition = self.preferredTransition;
|
|
2063
2117
|
if (header->largeTitleEnabled.value_or(false) && !self.modalNavigation.navigationBar.prefersLargeTitles)
|
|
2064
2118
|
self.modalNavigation.navigationBar.prefersLargeTitles = YES;
|
|
2065
2119
|
UIViewController* presented = self.modalNavigation ?: self;
|
|
2066
2120
|
presented.modalPresentationStyle = static_cast<UIModalPresentationStyle>(self.presentationStyle.integerValue);
|
|
2121
|
+
if (presented.modalPresentationStyle == UIModalPresentationAutomatic && !header->nativeDefaults)
|
|
2122
|
+
presented.sheetPresentationController.prefersPageSizing = YES;
|
|
2067
2123
|
presented.presentationController.delegate = self;
|
|
2068
2124
|
}
|
|
2069
2125
|
UIViewController* presented = self.modalNavigation ?: self;
|
|
2070
|
-
presented.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
|
|
2126
|
+
if (!presented.preferredTransition) presented.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
|
|
2071
2127
|
presented.modalInPresentation = !self.gestureEnabled || self.guardsRemoval;
|
|
2072
2128
|
return presented;
|
|
2073
2129
|
}
|
|
2130
|
+
- (void)configureSheetOn:(UIViewController*)presented from:(UIViewController*)presenter {
|
|
2131
|
+
if (!sheetOptions && !self.sheetConfiguration) return;
|
|
2132
|
+
UISheetPresentationController* sheet = presented.sheetPresentationController;
|
|
2133
|
+
if (!sheet) return;
|
|
2134
|
+
if (!self.sheetConfiguration) self.sheetConfiguration = [PeachStackSheetConfiguration new];
|
|
2135
|
+
[self.sheetConfiguration configure:sheetOptions sheet:sheet presented:presented from:presenter
|
|
2136
|
+
nativeDefaults:header->nativeDefaults defaultSize:CGSizeZero];
|
|
2137
|
+
}
|
|
2074
2138
|
- (BOOL)presentationControllerShouldDismiss:(UIPresentationController*)controller {
|
|
2075
2139
|
return self.gestureEnabled && !self.guardsRemoval;
|
|
2076
2140
|
}
|
|
@@ -2150,20 +2214,13 @@ UIImage* PeachRecordBarImage(const peach_container::BarImage& image, id, void (^
|
|
|
2150
2214
|
return nil;
|
|
2151
2215
|
}
|
|
2152
2216
|
|
|
2153
|
-
static UIFontWeight PeachDirectFontWeight(const std::optional<double>& weight, UIFontWeight fallback) {
|
|
2154
|
-
if (!weight || *weight <= 0) return fallback;
|
|
2155
|
-
const double raw = *weight;
|
|
2156
|
-
return raw <= 150 ? UIFontWeightUltraLight : raw <= 250 ? UIFontWeightThin : raw <= 350 ? UIFontWeightLight
|
|
2157
|
-
: raw <= 450 ? UIFontWeightRegular : raw <= 550 ? UIFontWeightMedium : raw <= 650 ? UIFontWeightSemibold
|
|
2158
|
-
: raw <= 750 ? UIFontWeightBold : raw <= 850 ? UIFontWeightHeavy : UIFontWeightBlack;
|
|
2159
|
-
}
|
|
2160
|
-
|
|
2161
2217
|
static UIFont* PeachDirectFont(const peach_container::BarFont& font, CGFloat size, UIFontWeight weight) {
|
|
2162
2218
|
const CGFloat points = font.size.value_or(size);
|
|
2163
2219
|
NSString* family = PeachRecordString(font.family);
|
|
2164
2220
|
if (family.length)
|
|
2165
2221
|
if (UIFont* named = [UIFont fontWithName:family size:points]) return named;
|
|
2166
|
-
|
|
2222
|
+
if (font.weight && *font.weight > 0) weight = PeachFontWeight(unsigned(*font.weight));
|
|
2223
|
+
return [UIFont systemFontOfSize:points weight:weight];
|
|
2167
2224
|
}
|
|
2168
2225
|
|
|
2169
2226
|
static UIBarButtonItemBadge* PeachDirectBadge(const std::optional<peach_container::BarBadge>& badge) {
|
|
@@ -2183,7 +2240,7 @@ static void PeachDirectShareBackground(UIBarButtonItem* button, const peach_cont
|
|
|
2183
2240
|
// react navigation's header items as the guest's bar button items; fire hears an item's
|
|
2184
2241
|
// index and its menu path
|
|
2185
2242
|
static NSArray<UIBarButtonItem*>* PeachDirectBarItems(const std::vector<peach_container::StackHeaderItem>& items,
|
|
2186
|
-
|
|
2243
|
+
NSDictionary<NSNumber*, UIView*>* customViews, void (^fire)(NSNumber*, NSArray*)) {
|
|
2187
2244
|
using Type = peach_container::StackHeaderItem::Type;
|
|
2188
2245
|
NSMutableArray<UIBarButtonItem*>* buttons = [NSMutableArray arrayWithCapacity:items.size()];
|
|
2189
2246
|
for (NSUInteger position = 0; position < items.size(); ++position) {
|
|
@@ -2209,69 +2266,43 @@ static NSArray<UIBarButtonItem*>* PeachDirectBarItems(const std::vector<peach_co
|
|
|
2209
2266
|
NSString* accessibilityHint = PeachRecordString(item.accessibilityHint);
|
|
2210
2267
|
NSString* identifier = PeachRecordString(item.identifier);
|
|
2211
2268
|
UIColor* tint = PeachRecordColor(item.tintColor);
|
|
2269
|
+
UIBarButtonItem* button = [UIBarButtonItem new];
|
|
2212
2270
|
if (item.type == Type::menu) {
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
if (image) [menuButton setImage:image forState:UIControlStateNormal];
|
|
2223
|
-
else if (label.length) {
|
|
2224
|
-
[menuButton setTitle:label forState:UIControlStateNormal];
|
|
2225
|
-
menuButton.titleLabel.font = item.labelStyle
|
|
2226
|
-
? PeachDirectFont(item.labelStyle->font, 17, UIFontWeightMedium)
|
|
2227
|
-
: [UIFont systemFontOfSize:17 weight:UIFontWeightMedium];
|
|
2271
|
+
if (!image) {
|
|
2272
|
+
button.title = label;
|
|
2273
|
+
if (item.labelStyle) {
|
|
2274
|
+
NSMutableDictionary* attributes = [NSMutableDictionary dictionary];
|
|
2275
|
+
attributes[NSFontAttributeName] = PeachDirectFont(item.labelStyle->font, 17, UIFontWeightMedium);
|
|
2276
|
+
if (UIColor* color = PeachRecordColor(item.labelStyle->color))
|
|
2277
|
+
attributes[NSForegroundColorAttributeName] = color;
|
|
2278
|
+
[button setTitleTextAttributes:attributes forState:UIControlStateNormal];
|
|
2279
|
+
}
|
|
2228
2280
|
}
|
|
2229
|
-
menuButton.accessibilityLabel = accessibilityLabel;
|
|
2230
|
-
menuButton.accessibilityHint = accessibilityHint;
|
|
2231
|
-
menuButton.accessibilityIdentifier = identifier;
|
|
2232
2281
|
if (item.menu)
|
|
2233
|
-
|
|
2282
|
+
button.menu = static_cast<UIMenu*>(PeachRecordMenuElement(*item.menu, @[],
|
|
2234
2283
|
^(NSArray<NSNumber*>* path, NSString*) { fire(itemIndex, path); },
|
|
2235
2284
|
^UIImage*(const peach_container::BarImage& menuImage) { return PeachRecordBarImage(menuImage, nil, nil); }, NO));
|
|
2236
|
-
menuButton.showsMenuAsPrimaryAction = YES;
|
|
2237
|
-
if (item.changesSelectionAsPrimaryAction)
|
|
2238
|
-
menuButton.changesSelectionAsPrimaryAction = *item.changesSelectionAsPrimaryAction;
|
|
2239
|
-
CGFloat width = item.width.value_or(0);
|
|
2240
|
-
if (width <= 0) {
|
|
2241
|
-
if (image) width = 36;
|
|
2242
|
-
else {
|
|
2243
|
-
const CGSize fit = [menuButton sizeThatFits:CGSizeMake(CGFLOAT_MAX, 36)];
|
|
2244
|
-
width = MAX(36, ceil(fit.width) + 22);
|
|
2245
|
-
}
|
|
2246
|
-
}
|
|
2247
|
-
menuButton.frame = CGRectMake(0, 0, width, 36);
|
|
2248
|
-
UIBarButtonItem* button = [[UIBarButtonItem alloc] initWithCustomView:menuButton];
|
|
2249
|
-
button.enabled = !item.disabled;
|
|
2250
2285
|
if (item.changesSelectionAsPrimaryAction)
|
|
2251
2286
|
button.changesSelectionAsPrimaryAction = *item.changesSelectionAsPrimaryAction;
|
|
2252
|
-
if (UIBarButtonItemBadge* badge = PeachDirectBadge(item.badge)) button.badge = badge;
|
|
2253
|
-
PeachDirectShareBackground(button, item);
|
|
2254
|
-
if (identifier.length) button.identifier = identifier;
|
|
2255
|
-
[buttons addObject:button];
|
|
2256
2287
|
} else {
|
|
2257
|
-
|
|
2288
|
+
button.primaryAction = [UIAction actionWithTitle:label ?: @"" image:nil identifier:nil
|
|
2258
2289
|
handler:^(UIAction*) { fire(itemIndex, @[]); }];
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2290
|
+
}
|
|
2291
|
+
if (image) button.image = image;
|
|
2292
|
+
button.enabled = !item.disabled;
|
|
2293
|
+
button.selected = item.selected.value_or(false);
|
|
2294
|
+
button.style = item.variant == "prominent" ? UIBarButtonItemStyleProminent : UIBarButtonItemStylePlain;
|
|
2295
|
+
if (item.width) button.width = *item.width;
|
|
2296
|
+
if (tint) button.tintColor = tint;
|
|
2297
|
+
button.accessibilityLabel = accessibilityLabel;
|
|
2298
|
+
button.accessibilityHint = accessibilityHint;
|
|
2299
|
+
if (UIBarButtonItemBadge* badge = PeachDirectBadge(item.badge)) button.badge = badge;
|
|
2300
|
+
PeachDirectShareBackground(button, item);
|
|
2301
|
+
if (identifier.length) {
|
|
2302
|
+
button.identifier = identifier;
|
|
2269
2303
|
button.accessibilityIdentifier = identifier;
|
|
2270
|
-
if (UIBarButtonItemBadge* badge = PeachDirectBadge(item.badge)) button.badge = badge;
|
|
2271
|
-
PeachDirectShareBackground(button, item);
|
|
2272
|
-
if (identifier.length) button.identifier = identifier;
|
|
2273
|
-
[buttons addObject:button];
|
|
2274
2304
|
}
|
|
2305
|
+
[buttons addObject:button];
|
|
2275
2306
|
} else {
|
|
2276
2307
|
[NSException raise:NSInvalidArgumentException format:@"unsupported One direct stack bar item %d", int(item.type)];
|
|
2277
2308
|
}
|
|
@@ -2287,6 +2318,7 @@ static NSArray<UIBarButtonItem*>* PeachDirectBarItems(const std::vector<peach_co
|
|
|
2287
2318
|
NSArray<PeachDirectStackRoute*>* _modals;
|
|
2288
2319
|
NSMutableArray<PeachDirectStackRoute*>* _presented;
|
|
2289
2320
|
NSMutableDictionary<NSString*, PeachDirectStackRoute*>* _retiring;
|
|
2321
|
+
std::unordered_map<std::string, peach_node> _nativePoppedRoutes;
|
|
2290
2322
|
std::vector<peach_container::StackSearchCommand> _searchCommands;
|
|
2291
2323
|
PeachContainerEmit _emit;
|
|
2292
2324
|
BOOL _waiting;
|
|
@@ -2302,6 +2334,11 @@ static NSArray<UIBarButtonItem*>* PeachDirectBarItems(const std::vector<peach_co
|
|
|
2302
2334
|
return;
|
|
2303
2335
|
}
|
|
2304
2336
|
_routes = std::move(spec->routes);
|
|
2337
|
+
std::erase_if(_nativePoppedRoutes, [&](const auto& popped) {
|
|
2338
|
+
return std::ranges::none_of(_routes, [&](const auto& route) {
|
|
2339
|
+
return route.key == popped.first && peach_node(route.node) == popped.second;
|
|
2340
|
+
});
|
|
2341
|
+
});
|
|
2305
2342
|
_emit = emit;
|
|
2306
2343
|
}
|
|
2307
2344
|
|
|
@@ -2335,7 +2372,7 @@ static NSArray<UIBarButtonItem*>* PeachDirectBarItems(const std::vector<peach_co
|
|
|
2335
2372
|
customViews[@(i)] = custom;
|
|
2336
2373
|
}
|
|
2337
2374
|
__weak PeachDirectStack* weakSelf = self;
|
|
2338
|
-
NSArray<UIBarButtonItem*>* buttons = PeachDirectBarItems(items,
|
|
2375
|
+
NSArray<UIBarButtonItem*>* buttons = PeachDirectBarItems(items, customViews,
|
|
2339
2376
|
^(NSNumber* itemIndex, NSArray* path) {
|
|
2340
2377
|
PeachDirectStack* owner = weakSelf;
|
|
2341
2378
|
if (!owner || !owner->_emit || ![owner hasAppliedRouteKey:key]) return;
|
|
@@ -2398,10 +2435,12 @@ static NSArray<UIBarButtonItem*>* PeachDirectBarItems(const std::vector<peach_co
|
|
|
2398
2435
|
for (const auto& spec : _routes) {
|
|
2399
2436
|
NSString* key = PeachRecordString(spec.key);
|
|
2400
2437
|
const auto node = peach_node(spec.node);
|
|
2438
|
+
if (const auto popped = _nativePoppedRoutes.find(spec.key);
|
|
2439
|
+
popped != _nativePoppedRoutes.end() && popped->second == node) continue;
|
|
2401
2440
|
NSNumber* presentationStyle = spec.presentation == "card" ? nil : PeachDirectPresentationStyle(spec.presentation);
|
|
2402
2441
|
if (!key.length || !node || (spec.presentation != "card" && (!presentationStyle || !next.count)) ||
|
|
2403
2442
|
(spec.animation != "default" && spec.animation != "none") ||
|
|
2404
|
-
spec.preferredTransition || spec.transitioningDelegate || spec.
|
|
2443
|
+
spec.preferredTransition || spec.transitioningDelegate || spec.replaceWithPop ||
|
|
2405
2444
|
spec.verticalGesture || spec.fullScreenGestureEnabled.value_or(false)) {
|
|
2406
2445
|
[NSException raise:NSInvalidArgumentException format:@"unsupported One direct stack route %@", key];
|
|
2407
2446
|
}
|
|
@@ -2418,6 +2457,7 @@ static NSArray<UIBarButtonItem*>* PeachDirectBarItems(const std::vector<peach_co
|
|
|
2418
2457
|
route.headerHidden = spec.headerHidden;
|
|
2419
2458
|
route.gestureEnabled = spec.gestureEnabled;
|
|
2420
2459
|
route.guardsRemoval = spec.guardsRemoval.value_or(false);
|
|
2460
|
+
[route configureZoom:spec.zoom from:presentationStyle ? next.lastObject : nil];
|
|
2421
2461
|
// PeachNavigation applies these to the route's scroll view; that scroll is the engine's here
|
|
2422
2462
|
const auto soft = [](const std::optional<std::string>& edge) { return edge && *edge == "soft"; };
|
|
2423
2463
|
const uint32_t softEdges = spec.scrollEdgeEffects
|
|
@@ -2431,6 +2471,7 @@ static NSArray<UIBarButtonItem*>* PeachDirectBarItems(const std::vector<peach_co
|
|
|
2431
2471
|
route.skipAnimation = spec.animation == "none";
|
|
2432
2472
|
route.emit = _emit;
|
|
2433
2473
|
route.presentationStyle = presentationStyle;
|
|
2474
|
+
if (route->sheetOptions != spec.sheet) route->sheetOptions = spec.sheet;
|
|
2434
2475
|
if (presentationStyle) {
|
|
2435
2476
|
// a swipe that dismisses the modal or asks to returns the stack to the route under it
|
|
2436
2477
|
PeachDirectStackRoute* below = next.lastObject;
|
|
@@ -2477,33 +2518,29 @@ static NSArray<UIBarButtonItem*>* PeachDirectBarItems(const std::vector<peach_co
|
|
|
2477
2518
|
previous.backButtonTitle = PeachRecordString(header.backTitle);
|
|
2478
2519
|
previous.backButtonDisplayMode = header.backButtonDisplayMode == "minimal" ? UINavigationItemBackButtonDisplayModeMinimal
|
|
2479
2520
|
: header.backButtonDisplayMode == "generic" ? UINavigationItemBackButtonDisplayModeGeneric : UINavigationItemBackButtonDisplayModeDefault;
|
|
2480
|
-
|
|
2521
|
+
const bool headerChanged = route->header != header;
|
|
2522
|
+
if (headerChanged || route->colors != spec.colors) {
|
|
2481
2523
|
route->header = header;
|
|
2524
|
+
route->colors = spec.colors;
|
|
2525
|
+
if (navigation) [route applyHeaderAppearanceInBar:navigation.navigationBar];
|
|
2526
|
+
}
|
|
2527
|
+
if (headerChanged) {
|
|
2482
2528
|
const auto largeTitleMode = header.largeTitleEnabled.value_or(false) ? UINavigationItemLargeTitleDisplayModeAlways
|
|
2483
2529
|
: header.largeTitleEnabled ? UINavigationItemLargeTitleDisplayModeNever : UINavigationItemLargeTitleDisplayModeAutomatic;
|
|
2484
2530
|
if (route.navigationItem.largeTitleDisplayMode != largeTitleMode) {
|
|
2485
2531
|
route.navigationItem.largeTitleDisplayMode = largeTitleMode;
|
|
2486
2532
|
[navigation.view setNeedsLayout];
|
|
2487
2533
|
}
|
|
2488
|
-
UINavigationBarAppearance* appearance = nil;
|
|
2489
|
-
NSString* blur = PeachRecordString(header.blurEffect);
|
|
2490
|
-
const bool transparent = header.transparent.value_or(false);
|
|
2491
|
-
if (transparent || blur) {
|
|
2492
|
-
appearance = [_navigation.navigationBar.standardAppearance copy];
|
|
2493
|
-
if (transparent) {
|
|
2494
|
-
[appearance configureWithTransparentBackground];
|
|
2495
|
-
if (!blur || [blur isEqualToString:@"none"]) appearance.backgroundColor = UIColor.clearColor;
|
|
2496
|
-
}
|
|
2497
|
-
if (blur && ![blur isEqualToString:@"systemDefault"]) appearance.backgroundEffect = PeachBlurEffect(blur);
|
|
2498
|
-
if (header.shadowVisible == false) appearance.shadowColor = nil;
|
|
2499
|
-
}
|
|
2500
|
-
route.navigationItem.standardAppearance = appearance;
|
|
2501
|
-
route.navigationItem.scrollEdgeAppearance = appearance;
|
|
2502
2534
|
[self applyHeaderItems:header.leftItems toNavigationItem:route.navigationItem key:key side:@"left" views:views];
|
|
2503
2535
|
[self applyHeaderItems:header.rightItems toNavigationItem:route.navigationItem key:key side:@"right" views:views];
|
|
2504
2536
|
}
|
|
2505
2537
|
if (header.largeTitleEnabled.value_or(false) && !navigation.navigationBar.prefersLargeTitles)
|
|
2506
2538
|
navigation.navigationBar.prefersLargeTitles = YES;
|
|
2539
|
+
if (presentationStyle) {
|
|
2540
|
+
UIViewController* presented = route.modalNavigation ?: route;
|
|
2541
|
+
if (UIViewController* presenter = presented.presentingViewController)
|
|
2542
|
+
[route configureSheetOn:presented from:presenter];
|
|
2543
|
+
}
|
|
2507
2544
|
[next addObject:route];
|
|
2508
2545
|
if (!presentationStyle) {
|
|
2509
2546
|
[cards addObject:route];
|
|
@@ -2577,6 +2614,8 @@ static NSArray<UIBarButtonItem*>* PeachDirectBarItems(const std::vector<peach_co
|
|
|
2577
2614
|
for (NSUInteger index = rootIndex; index < modals.count; ++index) {
|
|
2578
2615
|
PeachDirectStackRoute* route = modals[index];
|
|
2579
2616
|
UIViewController* presented = [route presentedController];
|
|
2617
|
+
[route configureSheetOn:presented from:presenter];
|
|
2618
|
+
if (route.sheetConfiguration.needsContentMeasurement) return after();
|
|
2580
2619
|
const BOOL last = index == modals.count - 1;
|
|
2581
2620
|
[owner->_presented addObject:route];
|
|
2582
2621
|
void (^completion)(void) = last ? after : static_cast<void (^)(void)>(nil);
|
|
@@ -2594,6 +2633,8 @@ static NSArray<UIBarButtonItem*>* PeachDirectBarItems(const std::vector<peach_co
|
|
|
2594
2633
|
- (void)retireRoutes {
|
|
2595
2634
|
for (NSString* key in _retiring.allKeys) {
|
|
2596
2635
|
PeachDirectStackRoute* route = _retiring[key];
|
|
2636
|
+
const auto pending = _nativePoppedRoutes.find(key.UTF8String);
|
|
2637
|
+
if (pending != _nativePoppedRoutes.end() && pending->second == route.node) continue;
|
|
2597
2638
|
if ([_navigation.viewControllers containsObject:route] || [_presented containsObject:route] ||
|
|
2598
2639
|
route.viewIfLoaded.window) continue;
|
|
2599
2640
|
[_retiring removeObjectForKey:key];
|
|
@@ -2618,8 +2659,12 @@ static NSArray<UIBarButtonItem*>* PeachDirectBarItems(const std::vector<peach_co
|
|
|
2618
2659
|
didShowViewController:(UIViewController*)controller animated:(BOOL)animated {
|
|
2619
2660
|
if (navigation.topViewController == controller && navigation.viewControllers.count < _cards.count) {
|
|
2620
2661
|
PeachDirectStackRoute* route = static_cast<PeachDirectStackRoute*>(controller);
|
|
2621
|
-
for (PeachDirectStackRoute* popped in _cards)
|
|
2622
|
-
if (
|
|
2662
|
+
for (PeachDirectStackRoute* popped in _cards) {
|
|
2663
|
+
if ([navigation.viewControllers containsObject:popped]) continue;
|
|
2664
|
+
_retiring[popped.routeKey] = popped;
|
|
2665
|
+
// a queued mount can still hold the route before the app acks dismissal.
|
|
2666
|
+
_nativePoppedRoutes.insert_or_assign(popped.routeKey.UTF8String, popped.node);
|
|
2667
|
+
}
|
|
2623
2668
|
_cards = static_cast<NSArray<PeachDirectStackRoute*>*>(navigation.viewControllers);
|
|
2624
2669
|
_applied = [_cards arrayByAddingObjectsFromArray:_modals ?: @[]];
|
|
2625
2670
|
_emit(@"dismissed", @{@"key": route.routeKey, @"closing": @YES});
|
|
@@ -2647,6 +2692,7 @@ static NSArray<UIBarButtonItem*>* PeachDirectBarItems(const std::vector<peach_co
|
|
|
2647
2692
|
_modals = nil;
|
|
2648
2693
|
[_presented removeAllObjects];
|
|
2649
2694
|
[_retiring removeAllObjects];
|
|
2695
|
+
_nativePoppedRoutes.clear();
|
|
2650
2696
|
_searchCommands.clear();
|
|
2651
2697
|
_waiting = NO;
|
|
2652
2698
|
_updatingModals = NO;
|
|
@@ -2797,18 +2843,26 @@ static NSArray<NSDictionary*>* SwiftSwipeActions(const std::vector<peach_contain
|
|
|
2797
2843
|
#endif
|
|
2798
2844
|
|
|
2799
2845
|
@interface PeachDirectZoomSource : NSObject <PeachContainer>
|
|
2800
|
-
- (void)setSourceFrame:(CGRect)frame;
|
|
2846
|
+
- (void)setSourceFrame:(CGRect)frame contentNode:(peach_node)content;
|
|
2847
|
+
@end
|
|
2848
|
+
|
|
2849
|
+
@interface PeachDirectZoomSourceView : UIView
|
|
2850
|
+
@property(nonatomic) uint64_t sourceNode;
|
|
2851
|
+
@end
|
|
2852
|
+
|
|
2853
|
+
@implementation PeachDirectZoomSourceView
|
|
2854
|
+
- (uint64_t)_peachFabricRendererNode { return self.sourceNode; }
|
|
2801
2855
|
@end
|
|
2802
2856
|
|
|
2803
2857
|
@implementation PeachDirectZoomSource {
|
|
2804
2858
|
PeachZoomMarker* _marker;
|
|
2805
|
-
|
|
2859
|
+
PeachDirectZoomSourceView* _geometry;
|
|
2806
2860
|
}
|
|
2807
2861
|
|
|
2808
2862
|
- (instancetype)init {
|
|
2809
2863
|
if ((self = [super init])) {
|
|
2810
2864
|
_marker = [[PeachZoomMarker alloc] initWithDetectsAlignment:NO];
|
|
2811
|
-
_geometry = [[
|
|
2865
|
+
_geometry = [[PeachDirectZoomSourceView alloc] initWithFrame:CGRectZero];
|
|
2812
2866
|
// the one child keeps painting in its existing scene slot.
|
|
2813
2867
|
_geometry.hidden = YES;
|
|
2814
2868
|
}
|
|
@@ -2822,12 +2876,18 @@ static NSArray<NSDictionary*>* SwiftSwipeActions(const std::vector<peach_contain
|
|
|
2822
2876
|
[_marker configureWithIdentifier:PeachRecordString(spec->identifier)
|
|
2823
2877
|
alignment:rect ? [NSValue valueWithCGRect:CGRectMake(rect->x, rect->y, rect->width, rect->height)] : nil
|
|
2824
2878
|
animateAspectRatioChange:spec->animateAspectRatioChange];
|
|
2879
|
+
if (const auto& appearance = spec->appearance) {
|
|
2880
|
+
const auto& fill = appearance->fill;
|
|
2881
|
+
_geometry.layer.cornerRadius = appearance->cornerRadius;
|
|
2882
|
+
_geometry.backgroundColor = [UIColor colorWithRed:fill[0] green:fill[1] blue:fill[2] alpha:fill[3]];
|
|
2883
|
+
}
|
|
2825
2884
|
}
|
|
2826
2885
|
- (void)child:(peach_node)node {}
|
|
2827
2886
|
- (void)mountIn:(UIView*)container views:(id<PeachViewLookup>)views {}
|
|
2828
2887
|
- (BOOL)ownsView:(UIView*)view { return NO; }
|
|
2829
2888
|
|
|
2830
|
-
- (void)setSourceFrame:(CGRect)frame {
|
|
2889
|
+
- (void)setSourceFrame:(CGRect)frame contentNode:(peach_node)content {
|
|
2890
|
+
_geometry.sourceNode = content;
|
|
2831
2891
|
if (CGRectIsEmpty(frame)) {
|
|
2832
2892
|
[self detach];
|
|
2833
2893
|
return;
|
|
@@ -3341,6 +3401,8 @@ std::unordered_map<peach_node, DirectContainerRecord> gRecords;
|
|
|
3341
3401
|
std::unordered_map<peach_node, UIView*> gContentViews;
|
|
3342
3402
|
std::unordered_map<peach_node, UIView*> gTriggerViews;
|
|
3343
3403
|
peach_node gInPlaceTriggerNode = 0;
|
|
3404
|
+
// set while a container that leaves its content in place (glass) mounts
|
|
3405
|
+
BOOL gPlacesContentInPlace = NO;
|
|
3344
3406
|
|
|
3345
3407
|
UIView* makeDirectHostView(NSString* kind, CGRect frame) {
|
|
3346
3408
|
if ([kind isEqualToString:@"stack"] || [kind isEqualToString:@"splitView"] || [kind isEqualToString:@"toolbar"])
|
|
@@ -3368,6 +3430,18 @@ UIView* contentViewForNode(peach_node node) {
|
|
|
3368
3430
|
return slot;
|
|
3369
3431
|
}
|
|
3370
3432
|
|
|
3433
|
+
// inside a container that leaves content in place, a content view sits at its node's laid-out
|
|
3434
|
+
// frame, as the mounted view does on iOS, so the children it adopts keep that node's offset
|
|
3435
|
+
UIView* framedContentView(peach_node node) {
|
|
3436
|
+
UIView* view = contentViewForNode(node);
|
|
3437
|
+
double frame[4] = {0, 0, 0, 0};
|
|
3438
|
+
if (peach_guest_one_node_layout_frame(nodeLo(node), nodeHi(node), frame)) {
|
|
3439
|
+
const CGRect next = CGRectMake(frame[0], frame[1], frame[2], frame[3]);
|
|
3440
|
+
if (!CGRectEqualToRect(view.frame, next)) view.frame = next;
|
|
3441
|
+
}
|
|
3442
|
+
return view;
|
|
3443
|
+
}
|
|
3444
|
+
|
|
3371
3445
|
UIView* directHostParent(peach_node content) {
|
|
3372
3446
|
// a content slot owns its children before uikit attaches it to the window, including a slot
|
|
3373
3447
|
// its container has not taken yet (a modal route's content waiting for its presentation).
|
|
@@ -3465,6 +3539,8 @@ id<PeachContainer> makeContainer(NSString* kind, peach_node node, std::span<cons
|
|
|
3465
3539
|
if ([kind isEqualToString:@"sheet"]) return placedBy([PeachSheet new], node);
|
|
3466
3540
|
if ([kind isEqualToString:@"menu"]) return [PeachMenu new];
|
|
3467
3541
|
if ([kind isEqualToString:@"contextMenu"]) return [PeachContextMenu new];
|
|
3542
|
+
if ([kind isEqualToString:@"blur"]) return [PeachBlur new];
|
|
3543
|
+
if ([kind isEqualToString:@"edgeFade"]) return [PeachEdgeFade new];
|
|
3468
3544
|
if ([kind isEqualToString:@"toolbar"]) return [PeachDirectToolbar new];
|
|
3469
3545
|
if ([kind isEqualToString:@"toolbarItem"] || [kind isEqualToString:@"menuAction"])
|
|
3470
3546
|
return [[PeachToolbarEntry alloc] initWithKind:kind];
|
|
@@ -3515,7 +3591,7 @@ id<PeachContainer> makeContainer(NSString* kind, peach_node node, std::span<cons
|
|
|
3515
3591
|
}
|
|
3516
3592
|
return trigger;
|
|
3517
3593
|
}
|
|
3518
|
-
return contentViewForNode(node);
|
|
3594
|
+
return gPlacesContentInPlace ? framedContentView(node) : contentViewForNode(node);
|
|
3519
3595
|
}
|
|
3520
3596
|
|
|
3521
3597
|
- (CGSize)layoutSizeForNode:(peach_node)node {
|
|
@@ -3523,9 +3599,9 @@ id<PeachContainer> makeContainer(NSString* kind, peach_node node, std::span<cons
|
|
|
3523
3599
|
![it->second.container isKindOfClass:PeachDirectZoomSource.class]) {
|
|
3524
3600
|
return it->second.frame.size;
|
|
3525
3601
|
}
|
|
3526
|
-
double
|
|
3527
|
-
if (node != 0 &&
|
|
3528
|
-
return CGSizeMake(
|
|
3602
|
+
double frame[4] = {0, 0, 0, 0};
|
|
3603
|
+
if (node != 0 && peach_guest_one_node_layout_frame(nodeLo(node), nodeHi(node), frame)) {
|
|
3604
|
+
return CGSizeMake(frame[2], frame[3]);
|
|
3529
3605
|
}
|
|
3530
3606
|
return CGSizeZero;
|
|
3531
3607
|
}
|
|
@@ -3542,13 +3618,20 @@ static PeachOneViewLookup* viewLookup() {
|
|
|
3542
3618
|
extern "C" {
|
|
3543
3619
|
|
|
3544
3620
|
void PeachOneDirectHostInit(void) {
|
|
3621
|
+
Class<PeachNativeRouteRoot> bridgeClass = NSClassFromString(@"OneNativeRouteBridge");
|
|
3622
|
+
gNativeRoutes = [bridgeClass shared];
|
|
3623
|
+
if ([gNativeRoutes respondsToSelector:@selector(observe:)]) {
|
|
3624
|
+
[gNativeRoutes observe:^(NSString* requests) { emitRouteText(@"routeRequests", requests); }];
|
|
3625
|
+
} else if (gNativeRoutes) {
|
|
3626
|
+
emitRouteText(@"routeRequests", @"[]");
|
|
3627
|
+
}
|
|
3545
3628
|
(void)PeachOneDirectStage.shared;
|
|
3546
3629
|
(void)viewLookup();
|
|
3547
3630
|
PeachOneDirectStage.shared.onWindowAttached = ^{
|
|
3548
3631
|
@autoreleasepool {
|
|
3549
3632
|
for (auto& [_, record] : gRecords) {
|
|
3550
3633
|
if ([record.container isKindOfClass:PeachDirectZoomSource.class]) {
|
|
3551
|
-
[static_cast<PeachDirectZoomSource*>(record.container) setSourceFrame:record.frame];
|
|
3634
|
+
[static_cast<PeachDirectZoomSource*>(record.container) setSourceFrame:record.frame contentNode:record.hostContentNode];
|
|
3552
3635
|
continue;
|
|
3553
3636
|
}
|
|
3554
3637
|
if (!record.container || record.composed || !record.hostView) continue;
|
|
@@ -3657,12 +3740,12 @@ void peach_one_container_mount(uint32_t targetLo, uint32_t targetHi, uint32_t pa
|
|
|
3657
3740
|
const BOOL detached = (flags & kMountDetached) != 0;
|
|
3658
3741
|
++gContainerCounters[composeOnly ? kComposed : childrenSent ? kMounted : kResized];
|
|
3659
3742
|
record.frame = CGRectMake(x, y, w, h);
|
|
3743
|
+
record.hostContentNode = hostContentNode;
|
|
3660
3744
|
if ([record.container isKindOfClass:PeachDirectZoomSource.class]) {
|
|
3661
3745
|
if (detached) record.frame = CGRectZero;
|
|
3662
|
-
[static_cast<PeachDirectZoomSource*>(record.container) setSourceFrame:record.frame];
|
|
3746
|
+
[static_cast<PeachDirectZoomSource*>(record.container) setSourceFrame:record.frame contentNode:record.hostContentNode];
|
|
3663
3747
|
return;
|
|
3664
3748
|
}
|
|
3665
|
-
record.hostContentNode = hostContentNode;
|
|
3666
3749
|
|
|
3667
3750
|
if (detached) {
|
|
3668
3751
|
if (record.hostView) [PeachOneDirectStage.shared detachHostView:record.hostView];
|
|
@@ -3675,6 +3758,8 @@ void peach_one_container_mount(uint32_t targetLo, uint32_t targetHi, uint32_t pa
|
|
|
3675
3758
|
PeachSwiftUI* swift = [record.container isKindOfClass:PeachSwiftUI.class]
|
|
3676
3759
|
? static_cast<PeachSwiftUI*>(record.container)
|
|
3677
3760
|
: nil;
|
|
3761
|
+
const bool laysOutContentInPlace = [record.container isKindOfClass:PeachEdgeFade.class] ||
|
|
3762
|
+
(swift && [swift.type isEqualToString:@"OneNativeGlass"]);
|
|
3678
3763
|
|
|
3679
3764
|
if (composeOnly) {
|
|
3680
3765
|
if (swift) {
|
|
@@ -3748,8 +3833,18 @@ void peach_one_container_mount(uint32_t targetLo, uint32_t targetHi, uint32_t pa
|
|
|
3748
3833
|
[record.container isKindOfClass:PeachContextMenu.class]) &&
|
|
3749
3834
|
!record.stagedChildren.empty() && !record.stagedChildren[0].isContainer;
|
|
3750
3835
|
gInPlaceTriggerNode = isMenuTrigger ? record.stagedChildren[0].node : 0;
|
|
3836
|
+
gPlacesContentInPlace = laysOutContentInPlace;
|
|
3751
3837
|
[record.container mountIn:(record.composed ? nil : record.hostView) views:viewLookup()];
|
|
3752
3838
|
gInPlaceTriggerNode = 0;
|
|
3839
|
+
gPlacesContentInPlace = NO;
|
|
3840
|
+
// a hosted drawing must pass through its touches when its uikit control does.
|
|
3841
|
+
if (swift && !record.composed) {
|
|
3842
|
+
UIView* control = [swift existingView];
|
|
3843
|
+
if (control.superview == record.hostView &&
|
|
3844
|
+
record.hostView.userInteractionEnabled != control.userInteractionEnabled) {
|
|
3845
|
+
record.hostView.userInteractionEnabled = control.userInteractionEnabled;
|
|
3846
|
+
}
|
|
3847
|
+
}
|
|
3753
3848
|
if (swift && [swift needsInitialHeight]) {
|
|
3754
3849
|
[swift layoutInitialHeightInTable:NO];
|
|
3755
3850
|
}
|
|
@@ -3767,6 +3862,11 @@ void peach_one_container_mount(uint32_t targetLo, uint32_t targetHi, uint32_t pa
|
|
|
3767
3862
|
sub.frame = record.hostView.bounds;
|
|
3768
3863
|
}
|
|
3769
3864
|
}
|
|
3865
|
+
if (laysOutContentInPlace)
|
|
3866
|
+
for (const auto& child : record.stagedChildren)
|
|
3867
|
+
if (gContentViews.contains(child.node)) framedContentView(child.node);
|
|
3868
|
+
if ([record.container isKindOfClass:PeachEdgeFade.class])
|
|
3869
|
+
[record.container mountIn:record.hostView views:viewLookup()];
|
|
3770
3870
|
}
|
|
3771
3871
|
}
|
|
3772
3872
|
if (swift && [swift needsInitialHeight]) {
|
|
@@ -3825,7 +3925,14 @@ void peach_guest_one_container_command(uint32_t targetLo, uint32_t targetHi,
|
|
|
3825
3925
|
}
|
|
3826
3926
|
NSDictionary* payload = jsonDictFromBytes(jsonPtr, jsonLen);
|
|
3827
3927
|
if (node == 0) {
|
|
3828
|
-
if ([name isEqualToString:@"
|
|
3928
|
+
if ([name isEqualToString:@"routeNavigate"] &&
|
|
3929
|
+
[gNativeRoutes respondsToSelector:@selector(navigate:path:error:)]) {
|
|
3930
|
+
NSString* operation = payload[@"operation"];
|
|
3931
|
+
NSString* path = payload[@"path"];
|
|
3932
|
+
NSError* error;
|
|
3933
|
+
if (![gNativeRoutes navigate:operation path:path error:&error])
|
|
3934
|
+
emitRouteText(@"routeNavigateError", error.localizedDescription);
|
|
3935
|
+
} else if ([name isEqualToString:@"completeAction"]) {
|
|
3829
3936
|
NSString* identifier = [payload[@"id"] isKindOfClass:NSString.class] ? payload[@"id"] : @"";
|
|
3830
3937
|
NSDictionary* result = [payload[@"result"] isKindOfClass:NSDictionary.class]
|
|
3831
3938
|
? payload[@"result"]
|