@apexnative/navigation 1.0.0-alpha.1 → 1.0.0-alpha.11
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/ApexNavigation.podspec +2 -1
- package/CHANGELOG.md +132 -0
- package/README.md +147 -51
- package/android/CLAUDE.md +78 -25
- package/android/CORE.md +49 -25
- package/android/RECIPES.md +13 -6
- package/android/consumer-rules.pro +6 -0
- package/android/src/main/java/dev/apexnative/navigation/NavigationActivity.kt +85 -10
- package/android/src/main/java/dev/apexnative/navigation/NavigationApplication.kt +34 -13
- package/android/src/main/java/dev/apexnative/navigation/layout/LayoutChecks.kt +5 -1
- package/android/src/main/java/dev/apexnative/navigation/layout/LayoutNode.kt +6 -2
- package/android/src/main/java/dev/apexnative/navigation/nativescreen/NativeScreenContext.kt +2 -2
- package/android/src/main/java/dev/apexnative/navigation/options/AnimationsOptions.kt +2 -2
- package/android/src/main/java/dev/apexnative/navigation/options/BottomTabOptions.kt +1 -1
- package/android/src/main/java/dev/apexnative/navigation/options/BottomTabsOptions.kt +13 -8
- package/android/src/main/java/dev/apexnative/navigation/options/ButtonMenuOptions.kt +2 -2
- package/android/src/main/java/dev/apexnative/navigation/options/ButtonOptions.kt +3 -3
- package/android/src/main/java/dev/apexnative/navigation/options/HardwareBackButtonOptions.kt +9 -1
- package/android/src/main/java/dev/apexnative/navigation/options/LargeTitleOptions.kt +1 -1
- package/android/src/main/java/dev/apexnative/navigation/options/LayoutAnimation.kt +1 -1
- package/android/src/main/java/dev/apexnative/navigation/options/OptionKey.kt +18 -0
- package/android/src/main/java/dev/apexnative/navigation/options/OptionPaths.kt +91 -0
- package/android/src/main/java/dev/apexnative/navigation/options/OptionsCache.kt +8 -4
- package/android/src/main/java/dev/apexnative/navigation/options/SheetOptions.kt +7 -4
- package/android/src/main/java/dev/apexnative/navigation/options/SideMenuOptions.kt +6 -1
- package/android/src/main/java/dev/apexnative/navigation/options/StackAnimationOptions.kt +40 -2
- package/android/src/main/java/dev/apexnative/navigation/options/StatusBarOptions.kt +7 -3
- package/android/src/main/java/dev/apexnative/navigation/options/TitleOptions.kt +2 -2
- package/android/src/main/java/dev/apexnative/navigation/options/TopBarAppearanceOptions.kt +1 -1
- package/android/src/main/java/dev/apexnative/navigation/options/TopBarOptions.kt +16 -7
- package/android/src/main/java/dev/apexnative/navigation/options/UserChoices.kt +159 -0
- package/android/src/main/java/dev/apexnative/navigation/react/CommandAnswer.kt +29 -36
- package/android/src/main/java/dev/apexnative/navigation/react/CommandContract.kt +59 -0
- package/android/src/main/java/dev/apexnative/navigation/react/ContentHeights.kt +95 -0
- package/android/src/main/java/dev/apexnative/navigation/react/ContentMounts.kt +66 -0
- package/android/src/main/java/dev/apexnative/navigation/react/ErrorTexts.kt +75 -60
- package/android/src/main/java/dev/apexnative/navigation/react/Hinge.kt +35 -23
- package/android/src/main/java/dev/apexnative/navigation/react/NavigationTurboModule.kt +12 -7
- package/android/src/main/java/dev/apexnative/navigation/react/OptionsCommands.kt +42 -4
- package/android/src/main/java/dev/apexnative/navigation/react/PendingCalls.kt +48 -0
- package/android/src/main/java/dev/apexnative/navigation/react/ReactView.kt +54 -20
- package/android/src/main/java/dev/apexnative/navigation/react/ReloadCoordinator.kt +7 -6
- package/android/src/main/java/dev/apexnative/navigation/react/ScreenEnvironment.kt +177 -0
- package/android/src/main/java/dev/apexnative/navigation/react/ScreenRegions.kt +19 -50
- package/android/src/main/java/dev/apexnative/navigation/react/ScrollEvents.kt +49 -128
- package/android/src/main/java/dev/apexnative/navigation/react/events/AppearanceDispatcher.kt +50 -81
- package/android/src/main/java/dev/apexnative/navigation/react/events/EventContract.kt +226 -0
- package/android/src/main/java/dev/apexnative/navigation/react/events/EventEmitter.kt +135 -94
- package/android/src/main/java/dev/apexnative/navigation/react/events/NavigationState.kt +154 -0
- package/android/src/main/java/dev/apexnative/navigation/react/events/ScreenAppearance.kt +0 -6
- package/android/src/main/java/dev/apexnative/navigation/safearea/SafeAreaView.kt +12 -10
- package/android/src/main/java/dev/apexnative/navigation/slots/SlotContainers.kt +10 -7
- package/android/src/main/java/dev/apexnative/navigation/slots/SlotScreenView.kt +39 -19
- package/android/src/main/java/dev/apexnative/navigation/slots/SlotView.kt +16 -4
- package/android/src/main/java/dev/apexnative/navigation/slots/SlotViews.kt +40 -0
- package/android/src/main/java/dev/apexnative/navigation/utils/ImageKey.kt +66 -0
- package/android/src/main/java/dev/apexnative/navigation/utils/ImageLoader.kt +7 -89
- package/android/src/main/java/dev/apexnative/navigation/utils/ImageRequests.kt +76 -0
- package/android/src/main/java/dev/apexnative/navigation/utils/MaterialTheme.kt +5 -6
- package/android/src/main/java/dev/apexnative/navigation/utils/OptionImages.kt +262 -0
- package/android/src/main/java/dev/apexnative/navigation/utils/SystemAnimations.kt +36 -0
- package/android/src/main/java/dev/apexnative/navigation/utils/UiUtils.kt +3 -3
- package/android/src/main/java/dev/apexnative/navigation/utils/ViewController.kt +3 -1
- package/android/src/main/java/dev/apexnative/navigation/utils/ViewExtensions.kt +0 -13
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/arrangement/ArrangementController.kt +10 -7
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/arrangement/ArrangementDefinition.kt +9 -3
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/arrangement/ArrangementPlanner.kt +20 -15
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/arrangement/SecondaryScreenPresenter.kt +13 -5
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/bottomtabs/AppliedTabCalls.kt +49 -0
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/bottomtabs/BottomTabsCollapseBehavior.kt +5 -3
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/bottomtabs/BottomTabsController.kt +108 -34
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/bottomtabs/BottomTabsPresenter.kt +25 -24
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/bottomtabs/CustomTabRowGeometry.kt +22 -0
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/bottomtabs/TabItems.kt +3 -3
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/bottomtabs/TabsRoom.kt +0 -5
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/component/ComponentPresenter.kt +28 -7
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/component/ComponentViewController.kt +12 -9
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/component/ContentReadiness.kt +2 -2
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/component/RenderWait.kt +27 -7
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/component/ScreenFrame.kt +1 -1
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/component/ScreenReadiness.kt +103 -56
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/component/ScreenSafeArea.kt +29 -11
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/externalcomponent/ExternalComponentViewController.kt +2 -6
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/modal/ModalAnimations.kt +22 -24
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/modal/ModalCoordinator.kt +109 -21
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/modal/ModalRecord.kt +21 -6
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/modal/ModalSheet.kt +476 -73
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/modal/ModalViews.kt +57 -25
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/modal/SheetBack.kt +42 -0
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/modal/SheetStops.kt +83 -0
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/navigator/BackCallbackCheck.kt +50 -0
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/navigator/BackCallbackState.kt +49 -14
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/navigator/Navigator.kt +71 -12
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/navigator/RootCoordinator.kt +37 -11
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/overlay/OverlayCoordinator.kt +10 -8
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/parent/Capabilities.kt +11 -4
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/parent/ContainerBackground.kt +3 -3
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/parent/ParentController.kt +6 -6
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/sidemenu/SideMenuController.kt +42 -9
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/sidemenu/SideMenuMotion.kt +19 -8
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/sidemenu/SideMenuPresenter.kt +16 -7
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/sidemenu/SideMenuRules.kt +43 -4
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/splitview/SplitPanes.kt +23 -0
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/splitview/SplitViewController.kt +77 -17
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/BackPreview.kt +315 -0
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/PreparedFrame.kt +3 -3
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/StackCommands.kt +30 -20
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/StackController.kt +216 -18
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/StackDisplay.kt +26 -1
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/StackQueue.kt +149 -41
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/StackTransitions.kt +26 -8
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/StackViews.kt +115 -6
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/fab/FabMotion.kt +142 -0
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/fab/FabPresenter.kt +222 -48
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/search/ScreenSearch.kt +3 -5
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/search/StackSearchPresenter.kt +30 -34
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/topbar/BarComponents.kt +5 -51
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/topbar/BarRowTransition.kt +3 -2
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/topbar/ButtonPlaces.kt +11 -5
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/topbar/MenuChecks.kt +13 -56
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/topbar/TopBarPresenter.kt +219 -54
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/topbar/TopBarVisibility.kt +9 -2
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/viewcontroller/ScrollEventListener.kt +6 -9
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/viewcontroller/ViewController.kt +75 -21
- package/android/src/main/java/dev/apexnative/navigation/views/animations/AnimationLayer.kt +73 -0
- package/android/src/main/java/dev/apexnative/navigation/views/animations/Curves.kt +29 -11
- package/android/src/main/java/dev/apexnative/navigation/views/animations/ValueInterpolation.kt +14 -0
- package/android/src/main/java/dev/apexnative/navigation/views/bottomtabs/BottomTabs.kt +9 -7
- package/android/src/main/java/dev/apexnative/navigation/views/bottomtabs/BottomTabsLayout.kt +61 -2
- package/android/src/main/java/dev/apexnative/navigation/views/bottomtabs/CustomBottomTabItemView.kt +0 -5
- package/android/src/main/java/dev/apexnative/navigation/views/bottomtabs/CustomTabRow.kt +72 -10
- package/android/src/main/java/dev/apexnative/navigation/views/element/ElementStep.kt +31 -0
- package/android/src/main/java/dev/apexnative/navigation/views/element/ElementTransitions.kt +143 -135
- package/android/src/main/java/dev/apexnative/navigation/views/element/TargetsWait.kt +13 -5
- package/android/src/main/java/dev/apexnative/navigation/views/element/TransitionLayer.kt +37 -112
- package/android/src/main/java/dev/apexnative/navigation/views/element/TransitionTargets.kt +9 -6
- package/android/src/main/java/dev/apexnative/navigation/views/element/TransitionViews.kt +100 -0
- package/android/src/main/java/dev/apexnative/navigation/views/element/animators/ElementPictures.kt +112 -4
- package/android/src/main/java/dev/apexnative/navigation/views/element/animators/FlightGeometry.kt +346 -36
- package/android/src/main/java/dev/apexnative/navigation/views/element/animators/ImageMorph.kt +199 -0
- package/android/src/main/java/dev/apexnative/navigation/views/element/animators/SharedAnimatorFactory.kt +56 -41
- package/android/src/main/java/dev/apexnative/navigation/views/element/animators/TextMorph.kt +176 -0
- package/android/src/main/java/dev/apexnative/navigation/views/element/animators/ViewMorph.kt +108 -0
- package/android/src/main/java/dev/apexnative/navigation/views/sidemenu/SideMenuView.kt +12 -3
- package/android/src/main/java/dev/apexnative/navigation/views/stack/ScreenEdge.kt +45 -0
- package/android/src/main/java/dev/apexnative/navigation/views/stack/StackLayout.kt +140 -1
- package/android/src/main/java/dev/apexnative/navigation/views/stack/fab/Fab.kt +14 -10
- package/android/src/main/java/dev/apexnative/navigation/views/stack/fab/FabCopy.kt +85 -0
- package/android/src/main/java/dev/apexnative/navigation/views/stack/fab/FabMenu.kt +13 -0
- package/android/src/main/java/dev/apexnative/navigation/views/stack/topbar/TitleBar.kt +5 -17
- package/android/src/main/java/dev/apexnative/navigation/views/stack/topbar/TopBar.kt +73 -34
- package/android/src/main/java/dev/apexnative/navigation/views/stack/topbar/titlebar/BarButtonComponentCell.kt +6 -6
- package/android/src/main/java/dev/apexnative/navigation/views/stack/topbar/titlebar/BarButtonView.kt +113 -0
- package/android/src/main/java/dev/apexnative/navigation/views/stack/topbar/titlebar/BarMenu.kt +219 -0
- package/android/src/main/java/dev/apexnative/navigation/views/stack/topbar/titlebar/ButtonBar.kt +125 -178
- package/android/src/main/java/dev/apexnative/navigation/views/stack/topbar/titlebar/ButtonMenus.kt +34 -64
- package/android/src/main/java/dev/apexnative/navigation/views/stack/topbar/titlebar/ButtonRow.kt +216 -0
- package/android/src/main/jni/ANNContentHeights.cpp +82 -0
- package/android/src/main/res/drawable/apex_navigation_ic_arrow_right.xml +14 -0
- package/android/src/main/res/layout/apex_navigation_menu_header.xml +19 -0
- package/android/src/main/res/layout/apex_navigation_menu_item.xml +68 -0
- package/android/src/main/res/values/styles.xml +1 -1
- package/android/src/main/res/values-night/styles.xml +1 -1
- package/cli/app.js +1 -1
- package/cli/doctor/checks/app.js +77 -14
- package/cli/doctor/checks/splash.js +4 -22
- package/cli/migrate/native.js +18 -0
- package/cli/project.js +10 -2
- package/cli/setup/index.js +18 -0
- package/cli/setup/source.js +2 -1
- package/cli/setup/steps/appDelegate.js +66 -11
- package/cli/setup/steps/mainApplication.js +134 -19
- package/cli/setup/steps/metro.js +46 -0
- package/cli/setup/steps/sceneDelegate.js +108 -0
- package/cli/splash/index.js +3 -1
- package/docs-md/architecture/native-screens.md +4 -0
- package/docs-md/architecture/theme-and-context.md +131 -12
- package/docs-md/architecture/transitions.md +58 -12
- package/docs-md/containers/arrangement.md +17 -1
- package/docs-md/containers/modals.md +8 -4
- package/docs-md/containers/overlays.md +3 -1
- package/docs-md/containers/side-menu.md +19 -2
- package/docs-md/containers/tabs.md +5 -1
- package/docs-md/flows/bottom-sheets.md +4 -2
- package/docs-md/flows/forms-in-a-modal.md +1 -1
- package/docs-md/fundamentals/screens-and-props.md +9 -1
- package/docs-md/fundamentals/starting-the-app.md +1 -1
- package/docs-md/guides/cli.md +4 -3
- package/docs-md/guides/deep-links.md +15 -33
- package/docs-md/help/glossary.md +4 -4
- package/docs-md/help/troubleshooting.md +44 -6
- package/docs-md/index.json +61 -1
- package/docs-md/migration/from-expo-router.md +1 -1
- package/docs-md/migration/from-react-native-navigation.md +9 -3
- package/docs-md/migration/from-react-navigation.md +2 -2
- package/docs-md/screen-ui/back-and-gestures.md +46 -2
- package/docs-md/screen-ui/bar-buttons.md +5 -5
- package/docs-md/screen-ui/search.md +1 -1
- package/docs-md/screen-ui/system-ui.md +17 -12
- package/docs-md/screen-ui/toolbar-and-fab.md +4 -2
- package/docs-md/screen-ui/top-bar.md +8 -4
- package/docs-md/start/installation.md +21 -3
- package/ios/Animations/ANNFrameDriver.h +55 -15
- package/ios/Animations/ANNFrameDriver.mm +216 -60
- package/ios/Animations/ANNTransitionAnimator.h +26 -5
- package/ios/Animations/ANNTransitionAnimator.mm +61 -13
- package/ios/Animations/ANNTransitionPlan.h +2 -2
- package/ios/Animations/ANNTransitionPlan.mm +10 -0
- package/ios/Animations/ANNTransitionWait.mm +6 -7
- package/ios/Animations/Elements/ANNElementFinder.h +57 -0
- package/ios/Animations/Elements/ANNElementFinder.mm +174 -2
- package/ios/Animations/Elements/ANNElementTransition.h +10 -8
- package/ios/Animations/Elements/ANNElementTransition.mm +19 -21
- package/ios/Animations/Elements/ANNSharedElementFlight.h +16 -11
- package/ios/Animations/Elements/ANNSharedElementFlight.mm +308 -69
- package/ios/Animations/Interpolators/ANNInterpolate.h +2 -30
- package/ios/Animations/Interpolators/ANNTransformParts.h +48 -0
- package/ios/Animations/Interpolators/ANNTransformParts.mm +507 -0
- package/ios/Animations/Interpolators/ANNViewTracks.h +9 -6
- package/ios/Animations/Interpolators/ANNViewTracks.mm +100 -30
- package/ios/CLAUDE.md +60 -24
- package/ios/CORE.md +44 -34
- package/ios/Contract/ANNCommandAnswer.h +13 -5
- package/ios/Contract/ANNCommandAnswer.mm +40 -32
- package/ios/Contract/ANNCommandContract.h +15 -0
- package/ios/Contract/ANNCommandContract.mm +78 -0
- package/ios/Contract/ANNCommandRunner.h +10 -9
- package/ios/Contract/ANNCommandRunner.mm +22 -28
- package/ios/Contract/ANNErrorTexts.h +6 -2
- package/ios/Contract/ANNErrorTexts.mm +18 -10
- package/ios/Contract/ANNLayoutNode.h +3 -3
- package/ios/Contract/ANNLayoutReader.h +3 -3
- package/ios/Core/ANNAppDelegate.mm +0 -2
- package/ios/Core/ANNAppearanceDispatcher.h +5 -4
- package/ios/Core/ANNAppearanceDispatcher.mm +12 -1
- package/ios/Core/ANNDeepLinkQueue.h +22 -2
- package/ios/Core/ANNDeepLinkQueue.mm +121 -14
- package/ios/Core/ANNErrorHandler.h +9 -4
- package/ios/Core/ANNErrorHandler.mm +20 -2
- package/ios/Core/ANNEventContract.h +246 -0
- package/ios/Core/ANNEventContract.mm +225 -0
- package/ios/Core/ANNEventEmitter.h +6 -2
- package/ios/Core/ANNEventEmitter.mm +117 -80
- package/ios/Core/ANNHinge.h +6 -0
- package/ios/Core/ANNHinge.mm +15 -4
- package/ios/Core/ANNJavaScriptCalls.h +33 -0
- package/ios/Core/ANNJavaScriptCalls.mm +52 -0
- package/ios/Core/ANNLayoutProtocol.h +5 -5
- package/ios/Core/ANNNavigationState.h +7 -5
- package/ios/Core/ANNNavigationState.mm +8 -7
- package/ios/Core/ANNNodeHelper.h +32 -12
- package/ios/Core/ANNNodeHelper.mm +100 -3
- package/ios/Core/ANNParking.h +5 -4
- package/ios/Core/ANNReloadCoordinator.mm +5 -12
- package/ios/Core/ANNRenderWait.h +20 -6
- package/ios/Core/ANNRenderWait.mm +143 -56
- package/ios/Core/ANNSceneDelegate.mm +25 -15
- package/ios/Core/ANNSystemUI.h +3 -2
- package/ios/Core/ANNSystemUI.mm +7 -0
- package/ios/Core/ANNUtils.h +7 -0
- package/ios/Core/ANNUtils.mm +10 -0
- package/ios/Core/ApexNavigation+Internal.h +1 -1
- package/ios/Core/ApexNavigation.mm +7 -6
- package/ios/Core/UIViewController+LayoutProtocol.h +9 -2
- package/ios/Core/UIViewController+LayoutProtocol.mm +8 -0
- package/ios/Layouts/Arrangement/ANNArrangementState.h +2 -17
- package/ios/Layouts/Arrangement/ANNArrangementState.mm +0 -38
- package/ios/Layouts/Arrangement/ANNArrangementViewController.mm +195 -21
- package/ios/Layouts/Modal/ANNModalCoordinator.h +1 -1
- package/ios/Layouts/Modal/ANNModalCoordinator.mm +57 -16
- package/ios/Layouts/Modal/ANNModalPresentation.h +8 -5
- package/ios/Layouts/Modal/ANNModalPresentation.mm +12 -12
- package/ios/Layouts/Modal/ANNSheetPresenter.mm +83 -1
- package/ios/Layouts/Overlay/ANNOverlayCoordinator.mm +2 -8
- package/ios/Layouts/Root/ANNRootCoordinator.mm +58 -19
- package/ios/Layouts/Root/ANNSplashViewController.h +5 -3
- package/ios/Layouts/Root/ANNSplashViewController.mm +147 -0
- package/ios/Layouts/Screen/ANNComponentPresenter.h +11 -3
- package/ios/Layouts/Screen/ANNComponentPresenter.mm +34 -6
- package/ios/Layouts/Screen/ANNComponentViewController.h +15 -13
- package/ios/Layouts/Screen/ANNComponentViewController.mm +130 -75
- package/ios/Layouts/Screen/ANNNativeScreenContext.mm +7 -5
- package/ios/Layouts/Screen/ANNPreviewInteraction.h +7 -4
- package/ios/Layouts/Screen/ANNPreviewInteraction.mm +72 -10
- package/ios/Layouts/Screen/ANNScreenEnvironment.h +63 -0
- package/ios/Layouts/Screen/ANNScreenEnvironment.mm +181 -0
- package/ios/Layouts/Screen/ANNScreenPlace.h +53 -0
- package/ios/Layouts/Screen/ANNScreenPlace.mm +205 -0
- package/ios/Layouts/Screen/ANNScreenRegions.h +3 -18
- package/ios/Layouts/Screen/ANNScreenRegions.mm +9 -44
- package/ios/Layouts/Screen/ANNScreenSafeArea.h +4 -9
- package/ios/Layouts/Screen/ANNScreenSafeArea.mm +14 -16
- package/ios/Layouts/Screen/ANNScreenSettling.h +34 -0
- package/ios/Layouts/Screen/ANNScreenSettling.mm +171 -0
- package/ios/Layouts/SideMenu/ANNSideMenuTypes.h +8 -0
- package/ios/Layouts/SideMenu/ANNSideMenuViewController.mm +83 -14
- package/ios/Layouts/SplitView/ANNSplitViewCommands.h +3 -2
- package/ios/Layouts/SplitView/ANNSplitViewCommands.mm +105 -39
- package/ios/Layouts/SplitView/ANNSplitViewController.mm +7 -8
- package/ios/Layouts/Stack/ANNPreviewPush.h +7 -6
- package/ios/Layouts/Stack/ANNPreviewPush.mm +142 -27
- package/ios/Layouts/Stack/ANNStackAnimatingDelegate.h +11 -2
- package/ios/Layouts/Stack/ANNStackAnimatingDelegate.mm +14 -7
- package/ios/Layouts/Stack/ANNStackCommands.mm +1 -0
- package/ios/Layouts/Stack/ANNStackController.h +8 -0
- package/ios/Layouts/Stack/ANNStackController.mm +184 -16
- package/ios/Layouts/Stack/ANNStackQueue.h +5 -2
- package/ios/Layouts/Stack/ANNStackQueue.mm +56 -43
- package/ios/Layouts/Stack/ANNSwipePopInteraction.h +26 -0
- package/ios/Layouts/Stack/ANNSwipePopInteraction.mm +185 -0
- package/ios/Layouts/Stack/InteractivePopGestureDelegate.mm +28 -4
- package/ios/Layouts/Stack/UINavigationController+ANNCommands.h +4 -2
- package/ios/Layouts/Stack/UINavigationController+ANNCommands.mm +2 -3
- package/ios/Layouts/Tabs/ANNBottomTabItemBuilder.h +4 -0
- package/ios/Layouts/Tabs/ANNBottomTabItemBuilder.mm +11 -0
- package/ios/Layouts/Tabs/ANNBottomTabsAccessoryView.h +12 -1
- package/ios/Layouts/Tabs/ANNBottomTabsAccessoryView.mm +23 -0
- package/ios/Layouts/Tabs/ANNBottomTabsController.h +3 -0
- package/ios/Layouts/Tabs/ANNBottomTabsController.mm +237 -57
- package/ios/Layouts/Tabs/ANNBottomTabsCustomRow.mm +8 -3
- package/ios/Layouts/Tabs/ANNBottomTabsPresenter.h +6 -2
- package/ios/Layouts/Tabs/ANNBottomTabsPresenter.mm +232 -43
- package/ios/Layouts/Tabs/ANNTabsDesign.h +6 -5
- package/ios/Layouts/Tabs/ANNTabsDesign.mm +9 -1
- package/ios/Layouts/Tabs/UITabBar+utils.h +5 -5
- package/ios/Layouts/Tabs/UITabBar+utils.mm +32 -13
- package/ios/Options/ANNAnimationOptions.h +2 -1
- package/ios/Options/ANNAnimationOptions.mm +1 -1
- package/ios/Options/ANNBottomTabsOptions.h +2 -0
- package/ios/Options/ANNBottomTabsOptions.mm +1 -0
- package/ios/Options/ANNOptions.h +25 -0
- package/ios/Options/ANNOptions.mm +157 -1
- package/ios/Options/ANNOptionsCache.h +7 -6
- package/ios/Options/ANNOptionsReader.mm +108 -0
- package/ios/Options/ANNSearchBarOptions.h +4 -3
- package/ios/Options/ANNSheetOptions.h +4 -1
- package/ios/Options/ANNSideMenuOptions.h +2 -0
- package/ios/Options/ANNSideMenuOptions.mm +2 -0
- package/ios/Options/ANNStackPopAnimationOptions.h +13 -0
- package/ios/Options/ANNStackPopAnimationOptions.mm +11 -0
- package/ios/Options/ANNUserChoice.h +57 -0
- package/ios/Options/ANNUserChoice.mm +44 -0
- package/ios/Options/Params/ANNImageSource.h +61 -0
- package/ios/Options/Params/ANNImageSource.mm +101 -0
- package/ios/Options/Params/ANNOptionImages.h +37 -0
- package/ios/Options/Params/ANNOptionImages.mm +284 -0
- package/ios/Options/Params/ANNParam.h +15 -0
- package/ios/Options/Params/ANNParam.mm +61 -0
- package/ios/Options/Params/Color.h +3 -0
- package/ios/Options/Params/Color.mm +21 -0
- package/ios/Options/Params/ColorParser.h +4 -3
- package/ios/Options/Params/ColorParser.mm +22 -4
- package/ios/Options/Params/Image.h +15 -2
- package/ios/Options/Params/Image.mm +35 -2
- package/ios/Options/Params/ImageParser.h +5 -5
- package/ios/Options/Params/ImageParser.mm +28 -46
- package/ios/Public/ApexNavigation/ANNSceneDelegate.h +3 -0
- package/ios/Public/ApexNavigation/ApexNavigation.h +1 -1
- package/ios/RECIPES.md +13 -6
- package/ios/React/ANNReactView.mm +6 -25
- package/ios/React/ANNSafeAreaViewComponentView.mm +28 -17
- package/ios/React/ANNSurfaceHostingView.h +14 -0
- package/ios/React/ANNSurfaceHostingView.mm +144 -1
- package/ios/React/Slots/ANNSlotComponentView.mm +24 -17
- package/ios/React/Slots/ANNSlotContainers.h +14 -6
- package/ios/React/Slots/ANNSlotContainers.mm +75 -2
- package/ios/React/Slots/ANNSlotHost.mm +1 -3
- package/ios/React/Slots/ANNSlotScreenView.mm +8 -2
- package/ios/TopBar/ANNBackButtonPresenter.mm +6 -5
- package/ios/TopBar/ANNBarAppearance.h +2 -1
- package/ios/TopBar/ANNBarAppearance.mm +111 -30
- package/ios/TopBar/ANNBarBackgroundComponent.mm +16 -0
- package/ios/TopBar/ANNBarButtonComponentView.h +4 -4
- package/ios/TopBar/ANNBarButtonComponentView.mm +1 -1
- package/ios/TopBar/ANNBarButtons.h +14 -8
- package/ios/TopBar/ANNBarButtons.mm +397 -80
- package/ios/TopBar/ANNIconButtonImage.h +1 -0
- package/ios/TopBar/ANNIconButtonImage.mm +34 -1
- package/ios/TopBar/ANNLargeTitlePresenter.h +13 -0
- package/ios/TopBar/ANNLargeTitlePresenter.mm +50 -7
- package/ios/TopBar/ANNMainList.h +3 -0
- package/ios/TopBar/ANNMainList.mm +4 -0
- package/ios/TopBar/ANNScrollEdgeEffects.h +22 -6
- package/ios/TopBar/ANNScrollEdgeEffects.mm +123 -16
- package/ios/TopBar/ANNSearchPresenter.mm +172 -21
- package/ios/TopBar/ANNSearchResultsViewController.mm +29 -6
- package/ios/TopBar/ANNTopBarPresenter.h +8 -2
- package/ios/TopBar/ANNTopBarPresenter.mm +155 -33
- package/ios/TurboModules/ANNTurboEventEmitter.mm +4 -35
- package/ios/TurboModules/ANNTurboModule.mm +104 -33
- package/ios/cpp/react/renderer/components/ApexNavigationSpec/ANNSlotState.cpp +20 -0
- package/ios/cpp/react/renderer/components/ApexNavigationSpec/ANNSlotState.h +5 -14
- package/lib/module/ARCHITECTURE.md +40 -27
- package/lib/module/adapters/NativeANNTurboModule.js.map +1 -1
- package/lib/module/api/app/AppRegistry.js +14 -2
- package/lib/module/api/app/AppRegistry.js.map +1 -1
- package/lib/module/api/app/createNavigation.js +190 -66
- package/lib/module/api/app/createNavigation.js.map +1 -1
- package/lib/module/api/commands/commands.js +54 -6
- package/lib/module/api/commands/commands.js.map +1 -1
- package/lib/module/api/events/navigationEvents.js +6 -2
- package/lib/module/api/events/navigationEvents.js.map +1 -1
- package/lib/module/api/hooks/useNavigation.js +8 -3
- package/lib/module/api/hooks/useNavigation.js.map +1 -1
- package/lib/module/api/hooks/useSafeAreaInsets.js +4 -3
- package/lib/module/api/hooks/useSafeAreaInsets.js.map +1 -1
- package/lib/module/api/linking/dispatchedLinks.js +23 -0
- package/lib/module/api/linking/dispatchedLinks.js.map +1 -0
- package/lib/module/api/linking/linking.js +11 -0
- package/lib/module/api/linking/linking.js.map +1 -1
- package/lib/module/api/navigation.js.map +1 -1
- package/lib/module/api/options/OptionsChain.js +2 -2
- package/lib/module/api/screens/arrangement.js +5 -2
- package/lib/module/api/screens/arrangement.js.map +1 -1
- package/lib/module/api/screens/defineScreen.js +45 -3
- package/lib/module/api/screens/defineScreen.js.map +1 -1
- package/lib/module/api/screens/nativeScreens.js +31 -6
- package/lib/module/api/screens/nativeScreens.js.map +1 -1
- package/lib/module/api/screens/registerScreens.js +193 -35
- package/lib/module/api/screens/registerScreens.js.map +1 -1
- package/lib/module/api/theme/theme.js +5 -0
- package/lib/module/api/theme/theme.js.map +1 -1
- package/lib/module/engine/commands.js +51 -9
- package/lib/module/engine/commands.js.map +1 -1
- package/lib/module/engine/layout.js +20 -11
- package/lib/module/engine/layout.js.map +1 -1
- package/lib/module/engine/nativeScreens.js +9 -0
- package/lib/module/engine/nativeScreens.js.map +1 -1
- package/lib/module/engine/options.js +49 -15
- package/lib/module/engine/options.js.map +1 -1
- package/lib/module/engine/optionsChange.js +102 -0
- package/lib/module/engine/optionsChange.js.map +1 -0
- package/lib/module/engine/places.js +52 -7
- package/lib/module/engine/places.js.map +1 -1
- package/lib/module/engine/props.js +30 -1
- package/lib/module/engine/props.js.map +1 -1
- package/lib/module/engine/refresh.js +85 -0
- package/lib/module/engine/refresh.js.map +1 -0
- package/lib/module/engine/rememberedOptions.js +61 -1
- package/lib/module/engine/rememberedOptions.js.map +1 -1
- package/lib/module/engine/screens.js +77 -16
- package/lib/module/engine/screens.js.map +1 -1
- package/lib/module/interfaces/contract/commands.json +101 -0
- package/lib/module/interfaces/contract/errors.json +275 -0
- package/lib/typescript/adapters/NativeANNTurboModule.d.ts +12 -2
- package/lib/typescript/adapters/NativeANNTurboModule.d.ts.map +1 -1
- package/lib/typescript/api/app/AppRegistry.d.ts.map +1 -1
- package/lib/typescript/api/app/createNavigation.d.ts +8 -3
- package/lib/typescript/api/app/createNavigation.d.ts.map +1 -1
- package/lib/typescript/api/commands/commands.d.ts.map +1 -1
- package/lib/typescript/api/commands/presentation.d.ts +4 -3
- package/lib/typescript/api/commands/presentation.d.ts.map +1 -1
- package/lib/typescript/api/events/navigationEvents.d.ts +3 -3
- package/lib/typescript/api/events/navigationEvents.d.ts.map +1 -1
- package/lib/typescript/api/hooks/useNavigation.d.ts +1 -1
- package/lib/typescript/api/hooks/useNavigation.d.ts.map +1 -1
- package/lib/typescript/api/hooks/useSafeAreaInsets.d.ts +4 -3
- package/lib/typescript/api/hooks/useSafeAreaInsets.d.ts.map +1 -1
- package/lib/typescript/api/index.d.ts +1 -1
- package/lib/typescript/api/index.d.ts.map +1 -1
- package/lib/typescript/api/linking/dispatchedLinks.d.ts +7 -0
- package/lib/typescript/api/linking/dispatchedLinks.d.ts.map +1 -0
- package/lib/typescript/api/linking/linking.d.ts +8 -0
- package/lib/typescript/api/linking/linking.d.ts.map +1 -1
- package/lib/typescript/api/navigation.d.ts +4 -1
- package/lib/typescript/api/navigation.d.ts.map +1 -1
- package/lib/typescript/api/options/OptionsChain.d.ts +2 -2
- package/lib/typescript/api/screens/arrangement.d.ts +12 -2
- package/lib/typescript/api/screens/arrangement.d.ts.map +1 -1
- package/lib/typescript/api/screens/defineScreen.d.ts +23 -4
- package/lib/typescript/api/screens/defineScreen.d.ts.map +1 -1
- package/lib/typescript/api/screens/nativeScreens.d.ts +8 -1
- package/lib/typescript/api/screens/nativeScreens.d.ts.map +1 -1
- package/lib/typescript/api/screens/registerScreens.d.ts.map +1 -1
- package/lib/typescript/api/theme/theme.d.ts +2 -0
- package/lib/typescript/api/theme/theme.d.ts.map +1 -1
- package/lib/typescript/engine/commands.d.ts +5 -0
- package/lib/typescript/engine/commands.d.ts.map +1 -1
- package/lib/typescript/engine/layout.d.ts.map +1 -1
- package/lib/typescript/engine/nativeScreens.d.ts +5 -0
- package/lib/typescript/engine/nativeScreens.d.ts.map +1 -1
- package/lib/typescript/engine/options.d.ts +5 -2
- package/lib/typescript/engine/options.d.ts.map +1 -1
- package/lib/typescript/engine/optionsChange.d.ts +28 -0
- package/lib/typescript/engine/optionsChange.d.ts.map +1 -0
- package/lib/typescript/engine/places.d.ts +7 -2
- package/lib/typescript/engine/places.d.ts.map +1 -1
- package/lib/typescript/engine/props.d.ts +8 -1
- package/lib/typescript/engine/props.d.ts.map +1 -1
- package/lib/typescript/engine/refresh.d.ts +35 -0
- package/lib/typescript/engine/refresh.d.ts.map +1 -0
- package/lib/typescript/engine/rememberedOptions.d.ts +13 -0
- package/lib/typescript/engine/rememberedOptions.d.ts.map +1 -1
- package/lib/typescript/engine/screens.d.ts +27 -6
- package/lib/typescript/engine/screens.d.ts.map +1 -1
- package/lib/typescript/interfaces/ComponentEvents.d.ts +4 -4
- package/lib/typescript/interfaces/ComponentEvents.d.ts.map +1 -1
- package/lib/typescript/interfaces/Events.d.ts +28 -10
- package/lib/typescript/interfaces/Events.d.ts.map +1 -1
- package/lib/typescript/interfaces/Options.d.ts +1 -1
- package/lib/typescript/interfaces/Options.d.ts.map +1 -1
- package/lib/typescript/interfaces/options/animations.d.ts +80 -22
- package/lib/typescript/interfaces/options/animations.d.ts.map +1 -1
- package/lib/typescript/interfaces/options/bottomTabs.d.ts +21 -7
- package/lib/typescript/interfaces/options/bottomTabs.d.ts.map +1 -1
- package/lib/typescript/interfaces/options/buttons.d.ts +23 -15
- package/lib/typescript/interfaces/options/buttons.d.ts.map +1 -1
- package/lib/typescript/interfaces/options/modals.d.ts +34 -26
- package/lib/typescript/interfaces/options/modals.d.ts.map +1 -1
- package/lib/typescript/interfaces/options/sideMenu.d.ts +23 -6
- package/lib/typescript/interfaces/options/sideMenu.d.ts.map +1 -1
- package/lib/typescript/interfaces/options/stack.d.ts +17 -3
- package/lib/typescript/interfaces/options/stack.d.ts.map +1 -1
- package/lib/typescript/interfaces/options/system.d.ts +18 -11
- package/lib/typescript/interfaces/options/system.d.ts.map +1 -1
- package/lib/typescript/interfaces/options/toolbar.d.ts +2 -2
- package/lib/typescript/interfaces/options/topBar.d.ts +68 -38
- package/lib/typescript/interfaces/options/topBar.d.ts.map +1 -1
- package/metro/acceptPlugin.js +57 -0
- package/metro/babelTransformer.js +45 -0
- package/metro/index.js +36 -0
- package/package.json +3 -1
- package/src/ARCHITECTURE.md +40 -27
- package/src/adapters/NativeANNTurboModule.ts +12 -2
- package/src/api/app/AppRegistry.ts +16 -2
- package/src/api/app/createNavigation.ts +203 -69
- package/src/api/commands/commands.ts +48 -7
- package/src/api/commands/presentation.ts +4 -3
- package/src/api/events/navigationEvents.ts +10 -4
- package/src/api/hooks/useNavigation.ts +9 -4
- package/src/api/hooks/useSafeAreaInsets.ts +4 -3
- package/src/api/index.ts +1 -0
- package/src/api/linking/dispatchedLinks.ts +18 -0
- package/src/api/linking/linking.ts +22 -1
- package/src/api/navigation.ts +4 -1
- package/src/api/options/OptionsChain.ts +2 -2
- package/src/api/screens/arrangement.ts +17 -4
- package/src/api/screens/defineScreen.ts +49 -5
- package/src/api/screens/nativeScreens.ts +40 -4
- package/src/api/screens/registerScreens.tsx +185 -42
- package/src/api/theme/theme.ts +5 -0
- package/src/engine/commands.ts +70 -13
- package/src/engine/layout.ts +27 -11
- package/src/engine/nativeScreens.ts +10 -1
- package/src/engine/options.ts +45 -19
- package/src/engine/optionsChange.ts +107 -0
- package/src/engine/places.ts +65 -7
- package/src/engine/props.ts +30 -1
- package/src/engine/refresh.ts +97 -0
- package/src/engine/rememberedOptions.ts +74 -1
- package/src/engine/screens.tsx +76 -21
- package/src/interfaces/ComponentEvents.ts +4 -4
- package/src/interfaces/Events.ts +29 -10
- package/src/interfaces/Options.ts +1 -0
- package/src/interfaces/contract/commands.json +101 -0
- package/src/interfaces/contract/errors.json +275 -0
- package/src/interfaces/options/animations.ts +81 -22
- package/src/interfaces/options/bottomTabs.ts +21 -7
- package/src/interfaces/options/buttons.ts +23 -15
- package/src/interfaces/options/modals.ts +34 -26
- package/src/interfaces/options/sideMenu.ts +24 -6
- package/src/interfaces/options/stack.ts +17 -3
- package/src/interfaces/options/system.ts +18 -11
- package/src/interfaces/options/toolbar.ts +2 -2
- package/src/interfaces/options/topBar.ts +68 -38
- package/android/src/main/java/dev/apexnative/navigation/react/ArrangementStates.kt +0 -41
- package/android/src/main/java/dev/apexnative/navigation/react/ScreenInsets.kt +0 -69
- package/android/src/main/java/dev/apexnative/navigation/react/events/NavigationStateReporter.kt +0 -62
- package/android/src/main/java/dev/apexnative/navigation/react/events/StateHold.kt +0 -62
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/bottomtabs/CustomTabRowPlacer.kt +0 -223
- package/android/src/main/java/dev/apexnative/navigation/views/element/ElementStub.kt +0 -31
- package/android/src/main/java/dev/apexnative/navigation/views/element/animators/ImageMatrixAnimator.kt +0 -138
- package/android/src/main/java/dev/apexnative/navigation/views/element/animators/PlainViewAnimator.kt +0 -88
- package/android/src/main/java/dev/apexnative/navigation/views/element/animators/PropertyAnimatorCreator.kt +0 -33
- package/android/src/main/java/dev/apexnative/navigation/views/element/animators/ReactImageAnimator.kt +0 -66
- package/android/src/main/java/dev/apexnative/navigation/views/element/animators/TextChangeAnimator.kt +0 -179
- package/android/src/main/java/dev/apexnative/navigation/views/element/animators/ViewChangeAnimator.kt +0 -139
- package/ios/Layouts/Screen/ANNScreenInsets.h +0 -30
- package/ios/Layouts/Screen/ANNScreenInsets.mm +0 -68
- package/ios/Layouts/Tabs/ANNTabsPreloadWindow.h +0 -27
- package/ios/Layouts/Tabs/ANNTabsPreloadWindow.mm +0 -55
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { onNativeEvent } from "./native.js";
|
|
4
|
+
import { forgetProps } from "./props.js";
|
|
4
5
|
import { screenNameOf } from "./slots.js";
|
|
5
6
|
|
|
6
7
|
// Where each screen is, noted as the engine builds the layouts of the commands: what it shows in and its place in its
|
|
@@ -28,6 +29,11 @@ const stackedSplits = new Set();
|
|
|
28
29
|
let listeningToSplitViews = false;
|
|
29
30
|
// The primaries of pairs shown alone, noted as their node is built, until their place is noted.
|
|
30
31
|
const alone = new Set();
|
|
32
|
+
// The layouts each screen shows in (its stack, pair, tabs, menu, split view, and the root of its layer), and how many
|
|
33
|
+
// live screens each layout holds. A layout whose last screen went is gone, and with it the props of the components the
|
|
34
|
+
// library named in its options: they stay as long as any of its screens may show them again.
|
|
35
|
+
const layoutsOfScreen = new Map();
|
|
36
|
+
const screensInLayout = new Map();
|
|
31
37
|
// The last screens that went, so a command from one of them can say so; a screen the engine never saw is not one.
|
|
32
38
|
const gone = new Set();
|
|
33
39
|
const GONE_KEPT = 200;
|
|
@@ -35,6 +41,14 @@ export function placeOf(screenId) {
|
|
|
35
41
|
return places.get(screenId);
|
|
36
42
|
}
|
|
37
43
|
|
|
44
|
+
/** The first screen of a stack, as the engine noted it; with a pair first, its primary. */
|
|
45
|
+
export function firstScreenOf(stack) {
|
|
46
|
+
for (const [id, place] of places) {
|
|
47
|
+
if (place.stack === stack && place.index === 0 && place.arrangement?.placement !== 'secondary') return id;
|
|
48
|
+
}
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
|
|
38
52
|
/** Notes that a screen is the primary of a pair shown alone, where the native side shows no pairs. */
|
|
39
53
|
export function noteAlone(screenId) {
|
|
40
54
|
alone.add(screenId);
|
|
@@ -45,15 +59,22 @@ export function isGone(screenId) {
|
|
|
45
59
|
return gone.has(screenId);
|
|
46
60
|
}
|
|
47
61
|
|
|
62
|
+
/** The layouts the screen shows in, outermost first: those whose screens come with it in a command go in it too. */
|
|
63
|
+
export function layoutsOf(screenId) {
|
|
64
|
+
return layoutsOfScreen.get(screenId) ?? [];
|
|
65
|
+
}
|
|
66
|
+
|
|
48
67
|
/**
|
|
49
68
|
* Notes the screens of a layout, the first of a stack at `index`. A modal or an overlay given as a whole is a layer of
|
|
50
|
-
* its own; screens added to one, such as a push, take the layer of the screen they come from
|
|
69
|
+
* its own; screens added to one, such as a push, take the layer of the screen they come from, and `within`, the
|
|
70
|
+
* layouts they show in (`layoutsOf` that screen).
|
|
51
71
|
*/
|
|
52
|
-
export function notePlaces(node, container, stack = null, index = 0, menu, layer = container === 'root' ? 'root' : node.id) {
|
|
72
|
+
export function notePlaces(node, container, stack = null, index = 0, menu, layer = container === 'root' ? 'root' : node.id, within = []) {
|
|
53
73
|
if (node.type === 'Component' || node.type === 'ExternalComponent') {
|
|
54
74
|
const name = node.data.name ?? '';
|
|
55
75
|
gone.delete(node.id);
|
|
56
76
|
columnOfScreen.delete(node.id);
|
|
77
|
+
noteLayouts(node.id, within);
|
|
57
78
|
places.set(node.id, {
|
|
58
79
|
name: screenNameOf(name),
|
|
59
80
|
container,
|
|
@@ -74,7 +95,7 @@ export function notePlaces(node, container, stack = null, index = 0, menu, layer
|
|
|
74
95
|
} else if (node.type === 'Arrangement') {
|
|
75
96
|
// One entry of its stack: both screens have its place there, and each knows the pair.
|
|
76
97
|
node.children.forEach((child, childIndex) => {
|
|
77
|
-
notePlaces(child, container, stack, index, menu, layer);
|
|
98
|
+
notePlaces(child, container, stack, index, menu, layer, [...within, node.id]);
|
|
78
99
|
const place = places.get(child.id);
|
|
79
100
|
if (place) {
|
|
80
101
|
const placement = childIndex === 0 ? 'primary' : 'secondary';
|
|
@@ -89,7 +110,7 @@ export function notePlaces(node, container, stack = null, index = 0, menu, layer
|
|
|
89
110
|
});
|
|
90
111
|
} else if (node.type === 'Stack') {
|
|
91
112
|
columnOfStack.delete(node.id);
|
|
92
|
-
node.children.forEach((child, childIndex) => notePlaces(child, container, node.id, childIndex, menu, layer));
|
|
113
|
+
node.children.forEach((child, childIndex) => notePlaces(child, container, node.id, childIndex, menu, layer, [...within, node.id]));
|
|
93
114
|
} else if (node.type === 'SplitView') {
|
|
94
115
|
// A split view sent again with its id starts anew: its columns are noted again, and it isn't one stack until the
|
|
95
116
|
// native side says so.
|
|
@@ -97,7 +118,7 @@ export function notePlaces(node, container, stack = null, index = 0, menu, layer
|
|
|
97
118
|
const columns = node.data.columns ?? [];
|
|
98
119
|
const stacks = {};
|
|
99
120
|
node.children.forEach((child, childIndex) => {
|
|
100
|
-
notePlaces(child, container, null, 0, menu, layer);
|
|
121
|
+
notePlaces(child, container, null, 0, menu, layer, [...within, node.id]);
|
|
101
122
|
const column = columns[childIndex];
|
|
102
123
|
if (!column) return;
|
|
103
124
|
if (child.type === 'Stack') stacks[column] = child.id;
|
|
@@ -110,13 +131,36 @@ export function notePlaces(node, container, stack = null, index = 0, menu, layer
|
|
|
110
131
|
} else if (node.type === 'SideMenuRoot') {
|
|
111
132
|
for (const part of node.children) {
|
|
112
133
|
const side = MENU_PARTS[part.type];
|
|
134
|
+
const parts = [...within, node.id, part.id];
|
|
113
135
|
part.children.forEach(child => notePlaces(child, container, null, 0, side ? {
|
|
114
136
|
id: node.id,
|
|
115
137
|
part: side
|
|
116
|
-
} : menu, layer));
|
|
138
|
+
} : menu, layer, parts));
|
|
117
139
|
}
|
|
118
140
|
} else {
|
|
119
|
-
node.children.forEach(child => notePlaces(child, container, null, 0, menu, layer));
|
|
141
|
+
node.children.forEach(child => notePlaces(child, container, null, 0, menu, layer, [...within, node.id]));
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// A screen noted again under its id (a layout sent again) leaves the layouts it was in before.
|
|
146
|
+
function noteLayouts(screenId, within) {
|
|
147
|
+
leaveLayouts(screenId);
|
|
148
|
+
const layouts = [...new Set(within)];
|
|
149
|
+
layoutsOfScreen.set(screenId, layouts);
|
|
150
|
+
for (const layout of layouts) screensInLayout.set(layout, (screensInLayout.get(layout) ?? 0) + 1);
|
|
151
|
+
}
|
|
152
|
+
function leaveLayouts(screenId) {
|
|
153
|
+
const layouts = layoutsOfScreen.get(screenId);
|
|
154
|
+
if (!layouts) return;
|
|
155
|
+
layoutsOfScreen.delete(screenId);
|
|
156
|
+
for (const layout of layouts) {
|
|
157
|
+
const count = (screensInLayout.get(layout) ?? 1) - 1;
|
|
158
|
+
if (count > 0) {
|
|
159
|
+
screensInLayout.set(layout, count);
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
screensInLayout.delete(layout);
|
|
163
|
+
forgetProps(layout);
|
|
120
164
|
}
|
|
121
165
|
}
|
|
122
166
|
|
|
@@ -170,6 +214,7 @@ export function listenToSplitViews() {
|
|
|
170
214
|
|
|
171
215
|
/** The screen is gone. */
|
|
172
216
|
export function forgetPlace(screenId) {
|
|
217
|
+
leaveLayouts(screenId);
|
|
173
218
|
places.delete(screenId);
|
|
174
219
|
columnOfScreen.delete(screenId);
|
|
175
220
|
gone.add(screenId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["onNativeEvent","screenNameOf","MENU_PARTS","SideMenuLeft","SideMenuCenter","SideMenuRight","places","Map","columnOfStack","columnOfScreen","stacksOfSplit","stackedSplits","Set","listeningToSplitViews","alone","gone","GONE_KEPT","placeOf","screenId","get","noteAlone","add","isGone","has","notePlaces","node","container","
|
|
1
|
+
{"version":3,"names":["onNativeEvent","forgetProps","screenNameOf","MENU_PARTS","SideMenuLeft","SideMenuCenter","SideMenuRight","places","Map","columnOfStack","columnOfScreen","stacksOfSplit","stackedSplits","Set","listeningToSplitViews","alone","layoutsOfScreen","screensInLayout","gone","GONE_KEPT","placeOf","screenId","get","firstScreenOf","stack","id","place","index","arrangement","placement","undefined","noteAlone","add","isGone","has","layoutsOf","notePlaces","node","container","menu","layer","within","type","name","data","delete","noteLayouts","set","children","forEach","child","childIndex","forgetSplit","columns","stacks","column","noteColumn","split","part","side","parts","leaveLayouts","layouts","layout","count","columnOf","stackOfColumn","coversColumn","listenToSplitViews","componentId","stacked","forgetPlace","size","values","next","value"],"sourceRoot":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AACc,GAAG,CAACX,QAAQ,CAAC;EAClB,IAAIH,IAAI,CAACsD,IAAI,GAAGrD,SAAS,EAAED,IAAI,CAAC2B,MAAM,CAAC3B,IAAI,CAACuD,MAAM,CAAC,CAAC,CAACC,IAAI,CAAC,CAAC,CAACC,KAAM,CAAC;AACrE","ignoreList":[]}
|
|
@@ -9,6 +9,11 @@ const watchers = new Map();
|
|
|
9
9
|
const none = {};
|
|
10
10
|
// The roots that are the components of bar buttons: their wrapper centers the content in the button's slot.
|
|
11
11
|
const buttonRoots = new Set();
|
|
12
|
+
// The ids the library gave components in options, by the node whose options they are in. Such an id stays the same
|
|
13
|
+
// for every show of the node and may have several roots at once (a component of the default or a stack's options):
|
|
14
|
+
// its props go with the node, not with a root.
|
|
15
|
+
const optionComponents = new Map();
|
|
16
|
+
const optionComponentIds = new Set();
|
|
12
17
|
export function setProps(id, props) {
|
|
13
18
|
if (props === undefined) byId.delete(id);else byId.set(id, props);
|
|
14
19
|
watchers.get(id)?.forEach(watcher => watcher());
|
|
@@ -36,9 +41,33 @@ export function isButtonRoot(id) {
|
|
|
36
41
|
return buttonRoots.has(id);
|
|
37
42
|
}
|
|
38
43
|
|
|
39
|
-
/**
|
|
44
|
+
/** Notes an id the library gave a component in the options of the node `owner`. */
|
|
45
|
+
export function rememberOptionsComponent(owner, id) {
|
|
46
|
+
let ids = optionComponents.get(owner);
|
|
47
|
+
if (!ids) optionComponents.set(owner, ids = new Set());
|
|
48
|
+
ids.add(id);
|
|
49
|
+
optionComponentIds.add(id);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** Whether the library gave the id to a component in options: its props go with the node, not with a root. */
|
|
53
|
+
export function isOptionsComponent(id) {
|
|
54
|
+
return optionComponentIds.has(id);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The view is gone: its props, and whether it is a button's root, are not needed again; nor are those of the
|
|
59
|
+
* components the library named in its options.
|
|
60
|
+
*/
|
|
40
61
|
export function forgetProps(id) {
|
|
41
62
|
byId.delete(id);
|
|
42
63
|
buttonRoots.delete(id);
|
|
64
|
+
const ids = optionComponents.get(id);
|
|
65
|
+
if (!ids) return;
|
|
66
|
+
optionComponents.delete(id);
|
|
67
|
+
for (const component of ids) {
|
|
68
|
+
byId.delete(component);
|
|
69
|
+
buttonRoots.delete(component);
|
|
70
|
+
optionComponentIds.delete(component);
|
|
71
|
+
}
|
|
43
72
|
}
|
|
44
73
|
//# sourceMappingURL=props.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["byId","Map","watchers","none","buttonRoots","Set","setProps","id","props","undefined","delete","set","get","forEach","watcher","propsOf","watchProps","add","size","rememberButtonRoot","isButtonRoot","has","forgetProps"],"sourceRoot":"../../../src","sources":["engine/props.ts"],"mappings":";;AAAA;AACA;AACA;AACA,MAAMA,IAAI,GAAG,IAAIC,GAAG,CAAiB,CAAC;AACtC,MAAMC,QAAQ,GAAG,IAAID,GAAG,CAA0B,CAAC;AACnD;AACA,MAAME,IAAI,GAAG,CAAC,CAAC;AACf;AACA,MAAMC,WAAW,GAAG,IAAIC,GAAG,CAAS,CAAC;
|
|
1
|
+
{"version":3,"names":["byId","Map","watchers","none","buttonRoots","Set","optionComponents","optionComponentIds","setProps","id","props","undefined","delete","set","get","forEach","watcher","propsOf","watchProps","add","size","rememberButtonRoot","isButtonRoot","has","rememberOptionsComponent","owner","ids","isOptionsComponent","forgetProps","component"],"sourceRoot":"../../../src","sources":["engine/props.ts"],"mappings":";;AAAA;AACA;AACA;AACA,MAAMA,IAAI,GAAG,IAAIC,GAAG,CAAiB,CAAC;AACtC,MAAMC,QAAQ,GAAG,IAAID,GAAG,CAA0B,CAAC;AACnD;AACA,MAAME,IAAI,GAAG,CAAC,CAAC;AACf;AACA,MAAMC,WAAW,GAAG,IAAIC,GAAG,CAAS,CAAC;AACrC;AACA;AACA;AACA,MAAMC,gBAAgB,GAAG,IAAIL,GAAG,CAAsB,CAAC;AACvD,MAAMM,k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AAG,CAACW,KAAK,CAAC;EACrC,IAAI,CAACC,GAAG,EAAEpB,gBAAgB,CAACO,GAAG,CAACY,KAAK,EAAGC,GAAG,GAAG,IAAIrB,GAAG,CAAC,CAAE,CAAC;EACxDqB,GAAG,CAACP,GAAG,CAACV,EAAE,CAAC;EACXF,kBAAkB,CAACY,GAAG,CAACV,EAAE,CAAC;AAC5B;;AAEA;AACA,OAAO,SAASkB,kBAAkBA,CAAClB,EAAU,EAAW;EACtD,OAAOF,kBAAkB,CAACgB,GAAG,CAACd,EAAE,CAAC;AACnC;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASmB,WAAWA,CAACnB,EAAU,EAAQ;EAC5CT,IAAI,CAACY,MAAM,CAACH,EAAE,CAAC;EACfL,WAAW,CAACQ,MAAM,CAACH,EAAE,CAAC;EACtB,MAAMiB,GAAG,GAAGpB,gBAAgB,CAACQ,GAAG,CAACL,EAAE,CAAC;EACpC,IAAI,CAACiB,GAAG,EAAE;EACVpB,gBAAgB,CAACM,MAAM,CAACH,EAAE,CAAC;EAC3B,KAAK,MAAMoB,SAAS,IAAIH,GAAG,EAAE;IAC3B1B,IAAI,CAACY,MAAM,CAACiB,SAAS,CAAC;IACtBzB,WAAW,CAACQ,MAAM,CAACiB,SAAS,CAAC;IAC7BtB,kBAAkB,CAACK,MAAM,CAACiB,SAAS,CAAC;EACtC;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// Fast Refresh runs an edited module again, and every component it exports is a new function. React Refresh keeps
|
|
4
|
+
// the versions of one component in a family: Metro registers each export under its module and name, and React renders
|
|
5
|
+
// the newest version of the family in place of the old one. What the library keeps of a screen (its options, its key,
|
|
6
|
+
// its pair) is read through the same family, so an edit reaches it without a reload.
|
|
7
|
+
|
|
8
|
+
/** The versions of one component React Refresh keeps, `current` the newest. */
|
|
9
|
+
|
|
10
|
+
// React Native puts React Refresh where Metro's module system finds it, in development only.
|
|
11
|
+
function reactRefresh() {
|
|
12
|
+
if (!__DEV__) return undefined;
|
|
13
|
+
const global = globalThis;
|
|
14
|
+
return global[`${global.__METRO_GLOBAL_PREFIX__ ?? ''}__ReactRefresh`];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** Whether React Refresh runs: development with Metro. */
|
|
18
|
+
export function refreshRuns() {
|
|
19
|
+
return reactRefresh()?.getFamilyByType !== undefined;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** The family a component's versions are kept in; undefined in a release build or for a value Metro didn't export. */
|
|
23
|
+
export function familyOf(type) {
|
|
24
|
+
return reactRefresh()?.getFamilyByType?.(type);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* The newest version of a component after Fast Refresh ran its module again; the component itself when there is none
|
|
29
|
+
* newer, and in a release build.
|
|
30
|
+
*/
|
|
31
|
+
export function newestType(type) {
|
|
32
|
+
return familyOf(type)?.current ?? type;
|
|
33
|
+
}
|
|
34
|
+
let redefinedListener;
|
|
35
|
+
|
|
36
|
+
/** Sets what runs when a module makes a screen again: Fast Refresh ran it after an edit. */
|
|
37
|
+
export function onRedefined(listener) {
|
|
38
|
+
redefinedListener = listener;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Tells about a screen a module made, once the module ran: Metro registers its exports after it, so the family of the
|
|
43
|
+
* screen is known by then, and a new version of a screen that shows is found by it. Development only.
|
|
44
|
+
*/
|
|
45
|
+
export function redefined(screen) {
|
|
46
|
+
if (!__DEV__ || !redefinedListener) return;
|
|
47
|
+
const listener = redefinedListener;
|
|
48
|
+
Promise.resolve().then(() => listener(screen));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// The id each family of screens gives the components they render, so their versions join one family too.
|
|
52
|
+
const innerIds = new WeakMap();
|
|
53
|
+
let innerCount = 0;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Puts a component a screen or the app renders (`owner`: the screen, or the app made by createNavigation; `role`: which
|
|
57
|
+
* of its components) in a family of its own, once the owner's module ran and Metro has given the owner its family: the
|
|
58
|
+
* next version of the owner registers its component under the same id, so React Refresh keeps the component's state
|
|
59
|
+
* when the module runs again, also when the module doesn't export it. A component React Refresh knows already (its
|
|
60
|
+
* module exports it, or Babel registered it) keeps its own family. Development only.
|
|
61
|
+
*/
|
|
62
|
+
export function keepStateOf(owner, component, role = 'component') {
|
|
63
|
+
const refresh = reactRefresh();
|
|
64
|
+
if (!refresh?.register || component === undefined) return;
|
|
65
|
+
const register = refresh.register;
|
|
66
|
+
Promise.resolve().then(() => {
|
|
67
|
+
const family = familyOf(owner);
|
|
68
|
+
if (!family) return;
|
|
69
|
+
let id = innerIds.get(family);
|
|
70
|
+
if (id === undefined) {
|
|
71
|
+
id = `apexnative.navigation#${++innerCount}`;
|
|
72
|
+
innerIds.set(family, id);
|
|
73
|
+
}
|
|
74
|
+
register(component, `${id}.${role}`);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Makes React Refresh mount a component of the library again, not keep its state, when a new version of it comes: its
|
|
80
|
+
* hooks are the app's, which may have changed, and the library's code has no signature of them. Development only.
|
|
81
|
+
*/
|
|
82
|
+
export function resetOnEdit(type) {
|
|
83
|
+
reactRefresh()?.createSignatureFunctionForTransform?.()(type, 'apexnative.navigation', true);
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=refresh.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["reactRefresh","__DEV__","undefined","global","globalThis","__METRO_GLOBAL_PREFIX__","refreshRuns","getFamilyByType","familyOf","type","newestType","current","redefinedListener","onRedefined","listener","redefined","screen","Promise","resolve","then","innerIds","WeakMap","innerCount","keepStateOf","owner","component","role","refresh","register","family","id","get","set","resetOnEdit","createSignatureFunctionForTransform"],"sourceRoot":"../../../src","sources":["engine/refresh.ts"],"mappings":";;AAAA;AACA;AACA;AACA;;A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,IAAIH,SAAS,KAAKvB,SAAS,EAAE;EACnD,MAAM0B,QAAQ,GAAGD,OAAO,CAACC,QAAQ;EACjCX,OAAO,CAACC,OAAO,CAAC,CAAC,CAACC,IAAI,CAAC,MAAM;IAC3B,MAAMU,MAAM,GAAGrB,QAAQ,CAACgB,KAAK,CAAC;IAC9B,IAAI,CAACK,MAAM,EAAE;IACb,IAAIC,EAAE,GAAGV,QAAQ,CAACW,GAAG,CAACF,MAAM,CAAC;IAC7B,IAAIC,EAAE,KAAK5B,SAAS,EAAE;MACpB4B,EAAE,GAAG,yBAAyB,EAAER,UAAU,EAAE;MAC5CF,QAAQ,CAACY,GAAG,CAACH,MAAM,EAAEC,EAAE,CAAC;IAC1B;IACAF,QAAQ,CAACH,SAAS,EAAE,GAAGK,EAAE,IAAIJ,IAAI,EAAE,CAAC;EACtC,CAAC,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASO,WAAWA,CAACxB,IAAY,EAAQ;EAC9CT,YAAY,CAAC,CAAC,EAAEkC,mCAAmC,GAAG,CAAC,CAACzB,IAAI,EAAE,uBAAuB,EAAE,IAAI,CAAC;AAC9F","ignoreList":[]}
|
|
@@ -25,9 +25,67 @@ export function rememberMergedOptions(id, options) {
|
|
|
25
25
|
remembered.set(id, before ? mergeOptions(before, kept) : kept);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
/** Takes the options at the paths, such as `['topBar', 'subtitle']`, out of those remembered for the node with the id. */
|
|
29
|
+
export function forgetMergedPaths(id, paths) {
|
|
30
|
+
const own = ownOptions.get(id);
|
|
31
|
+
if (own) own.options = withoutPaths(own.options, paths);
|
|
32
|
+
const options = remembered.get(id);
|
|
33
|
+
if (options) remembered.set(id, withoutPaths(options, paths));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// A copy of the options without the values at the paths.
|
|
37
|
+
function withoutPaths(options, paths) {
|
|
38
|
+
const kept = structuredCopy(options);
|
|
39
|
+
for (const path of paths) {
|
|
40
|
+
const parent = path.slice(0, -1).reduce((group, key) => group?.[key], kept);
|
|
41
|
+
if (parent) delete parent[path[path.length - 1]];
|
|
42
|
+
}
|
|
43
|
+
return kept;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// A copy of the plain objects of options, the other values shared.
|
|
47
|
+
function structuredCopy(options) {
|
|
48
|
+
return Object.fromEntries(Object.entries(options).map(([key, value]) => [key, isGroup(value) ? structuredCopy(value) : value]));
|
|
49
|
+
}
|
|
50
|
+
function isGroup(value) {
|
|
51
|
+
return typeof value === 'object' && value !== null && Object.getPrototypeOf(value) === Object.prototype;
|
|
52
|
+
}
|
|
53
|
+
|
|
28
54
|
/** Forgets the merged options of a node that went; a node of the last root keeps them until another root goes out. */
|
|
29
55
|
export function forgetMergedOptions(id) {
|
|
30
56
|
if (!lastRoot?.ids.has(id)) remembered.delete(id);
|
|
57
|
+
ownOptions.delete(id);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// The own options of each screen as JavaScript sent them, in development: those it showed with, and every merge and
|
|
61
|
+
// clear since. An edit of a screen's options (Fast Refresh) changes only what still has the old definition's value.
|
|
62
|
+
const ownOptions = new Map();
|
|
63
|
+
|
|
64
|
+
/** Notes the own options a screen of the name shows with (development). */
|
|
65
|
+
export function noteOwnOptions(id, name, options) {
|
|
66
|
+
if (__DEV__) ownOptions.set(id, {
|
|
67
|
+
name,
|
|
68
|
+
options
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** Notes a merge into a screen's own options (development). */
|
|
73
|
+
export function noteMergedOwnOptions(id, options) {
|
|
74
|
+
const noted = __DEV__ ? ownOptions.get(id) : undefined;
|
|
75
|
+
if (noted) noted.options = mergeOptions(noted.options, options);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** The own options of a screen as JavaScript sent them (development); undefined for a screen it didn't note. */
|
|
79
|
+
export function ownOptionsOf(id) {
|
|
80
|
+
return ownOptions.get(id)?.options;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* The ids of the screens of the name the native side has, mounted in React or not yet (a tab not selected yet), as
|
|
85
|
+
* development notes them.
|
|
86
|
+
*/
|
|
87
|
+
export function notedScreens(name) {
|
|
88
|
+
return [...ownOptions].filter(([, noted]) => noted.name === name).map(([id]) => id);
|
|
31
89
|
}
|
|
32
90
|
|
|
33
91
|
/** The options merged into the node with the id, as remembered; undefined without any. */
|
|
@@ -54,12 +112,14 @@ export function rootGoesOut(nodes, again) {
|
|
|
54
112
|
ids: new Set(nodes.flatMap(idsOf))
|
|
55
113
|
};
|
|
56
114
|
if (!before) return;
|
|
115
|
+
// The screens of the root before go with it, the tabs React never mounted too.
|
|
116
|
+
for (const id of before.ids) if (!lastRoot.ids.has(id)) ownOptions.delete(id);
|
|
57
117
|
const moved = new Map();
|
|
58
118
|
if (again === before) {
|
|
59
119
|
pairNodes(before.nodes, nodes, (old, node) => {
|
|
60
120
|
const options = remembered.get(old.id);
|
|
61
121
|
if (!options) return;
|
|
62
|
-
node.data.options = mergeNativeOptions(node.data.options ?? {}, toNativeOptions(options));
|
|
122
|
+
node.data.options = mergeNativeOptions(node.data.options ?? {}, toNativeOptions(options, node.id));
|
|
63
123
|
moved.set(node.id, options);
|
|
64
124
|
});
|
|
65
125
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["mergeOptions","mergeNativeOptions","toNativeOptions","remembered","Map","lastRoot","rememberMergedOptions","id","options","ids","has","kept","withoutOneTimeOptions","before","get","set","forgetMergedOptions","delete","mergedOptionsOf","sentRoot","rootGoesOut","nodes","again","Set","flatMap","idsOf","moved","pairNodes","old","node","data","forEach","children","after","pair","index","type","
|
|
1
|
+
{"version":3,"names":["mergeOptions","mergeNativeOptions","toNativeOptions","remembered","Map","lastRoot","rememberMergedOptions","id","options","ids","has","kept","withoutOneTimeOptions","before","get","set","forgetMergedPaths","paths","own","ownOptions","withoutPaths","structuredCopy","path","parent","slice","reduce","group","key","length","Object","fromEntries","entries","map","value","isGroup","getPrototypeOf","prototype","forgetMergedOptions","delete","noteOwnOptions","name","__DEV__","noteMergedOwnOptions","noted","undefined","ownOptionsOf","notedScreens","filter","mergedOptionsOf","sentRoot","rootGoesOut","nodes","again","Set","flatMap","idsOf","moved","pairNodes","old","node","data","forEach","children","after","pair","index","type","result","bottomTabs","currentTabIndex","currentTabId","sideMenu","side","settings","visible"],"sourceRoot":"../../../src","sources":["engine/rememberedOptions.ts"],"mappings":";;AAEA,SAASA,YAAY,QAAQ,mBAAgB;AAC7C,SAASC,kBAAkB,EAAEC,eAAe,QAAQ,cAAW;;AAE/D;AACA;AACA;AACA;;AAEA;;AAMA,MAAMC,UAAU,GAAG,IAAIC,GAAG,CAAkB,CAAC;AAC7C,IAAIC,QAA8B;;AAElC;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,qBAAqBA,CAACC,EAAU,EAAEC,OAAgB,EAAQ;EACxE,IAAI,CAACH,QAAQ,EAAEI,GAAG,CAACC,GAAG,CAACH,EAAE,CAAC,EAAE;EAC5B,MAAMI,IAAI,GAAGC,qBAAqB,CAACJ,OAAO,CAAC;EAC3C,MAAMK,MAAM,GAAGV,UAAU,CAACW,GAAG,CAACP,EAAE,CAAC;EACjCJ,UAAU,CAACY,GAAG,CAACR,EAAE,EAAEM,MAAM,GAAGb,YAAY,CAACa,MAAM,EAAEF,IAAI,CAAC,GAAGA,IAAI,CAAC;AAChE;;AAEA;AACA,OAAO,SAASK,iBAAiBA,CAACT,EAAU,EAAEU,KAA0B,EAAQ;EAC9E,MAAMC,GAAG,GAAGC,UAAU,CAACL,GAAG,CAACP,EAAE,CAAC;EAC9B,IAAIW,GAAG,EAAEA,GAAG,CAACV,OAAO,GAAGY,YAAY,CAACF,GAAG,CAACV,OAAO,EAAES,KAAK,CAAC;EACvD,MAAMT,OAAO,GAAGL,UAAU,CAACW,GAAG,CAACP,EAAE,CAAC;EAClC,IAAIC,OAAO,EAAEL,UAAU,CAACY,GAA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AQ,CAACC,OAAO;MACvBH,QAAQ,CAACC,IAAI,CAAC,GAAGC,QAAQ;IAC3B;IACAN,MAAM,GAAG;MAAE,GAAGA,MAAM;MAAEI;IAAS,CAAC;EAClC;EACA,OAAOJ,MAAM;AACf","ignoreList":[]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import React, { useCallback, useEffect, useSyncExternalStore } from 'react';
|
|
4
4
|
import { AppRegistry } from 'react-native';
|
|
5
5
|
import { forgetPlace } from "./places.js";
|
|
6
|
-
import { forgetProps, propsOf, watchProps } from "./props.js";
|
|
6
|
+
import { forgetProps, isOptionsComponent, propsOf, watchProps } from "./props.js";
|
|
7
7
|
import { forgetMergedOptions } from "./rememberedOptions.js";
|
|
8
8
|
import { hasSlot } from "./slots.js";
|
|
9
9
|
|
|
@@ -15,15 +15,52 @@ import { hasSlot } from "./slots.js";
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
/** What the root of a React screen renders: the screen's id, and the props the command gave it. */
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* What React Native gives the root of a React screen: the screen's id, its root tag (none in a slot of the app's one
|
|
21
|
+
* tree), and the props the native side gives that root, a tab cell's `tabIndex`, `selected`, `badge`, `dot` and
|
|
22
|
+
* `dotColor`.
|
|
23
|
+
*/
|
|
18
24
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
25
|
const screens = new Map();
|
|
20
26
|
const roots = new Map();
|
|
21
27
|
let unmounted;
|
|
22
|
-
// The React
|
|
23
|
-
// the old screens again in the new runtime, under the ids the new screens get too, and
|
|
24
|
-
//
|
|
25
|
-
//
|
|
28
|
+
// The React roots mounted under each id, by their root tags. One id can have several: after a JavaScript reload React
|
|
29
|
+
// Native starts the roots of the old screens again in the new runtime, under the ids the new screens get too, and
|
|
30
|
+
// unmounts them once the new ones show; a component of the default or a stack's options has one id and a root in the
|
|
31
|
+
// bar of every screen that shows it. The id lets its props go only with the last of them. A slot of the app's one tree
|
|
32
|
+
// has no tag: while the one tree shows a screen with the id, no root of that id lets it go.
|
|
26
33
|
const owners = new Map();
|
|
34
|
+
// The screens that show by their ids: the name, and how many roots or slots of the id are mounted (a component of the
|
|
35
|
+
// options has a root in the bar of every screen that shows it).
|
|
36
|
+
const shown = new Map();
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Notes a screen as shown, a React root or slot of it or the controller of a native screen, until the function it
|
|
40
|
+
* gives is called.
|
|
41
|
+
*/
|
|
42
|
+
export function noteShown(componentId, name) {
|
|
43
|
+
const entry = shown.get(componentId);
|
|
44
|
+
if (entry?.name === name) entry.mounts++;else shown.set(componentId, {
|
|
45
|
+
name,
|
|
46
|
+
mounts: 1
|
|
47
|
+
});
|
|
48
|
+
return () => {
|
|
49
|
+
const current = shown.get(componentId);
|
|
50
|
+
if (current?.name !== name) return;
|
|
51
|
+
if (--current.mounts === 0) shown.delete(componentId);
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** The ids of the screens with the name that show now. */
|
|
56
|
+
export function shownScreens(name) {
|
|
57
|
+
return [...shown].filter(([, entry]) => entry.name === name).map(([id]) => id);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** Whether a React root of the screen with the id is mounted now (a slot of the app's one tree doesn't count). */
|
|
61
|
+
export function hasRoot(componentId) {
|
|
62
|
+
return owners.has(componentId);
|
|
63
|
+
}
|
|
27
64
|
|
|
28
65
|
/** What runs when the root of a screen unmounts: the screen is gone. */
|
|
29
66
|
export function onScreenUnmounted(listener) {
|
|
@@ -145,10 +182,25 @@ export function isReactScreen(name) {
|
|
|
145
182
|
return screen !== undefined && 'component' in screen;
|
|
146
183
|
}
|
|
147
184
|
|
|
185
|
+
/**
|
|
186
|
+
* The props a screen's component renders with: those a command left under its id ([stored]), the props the native side
|
|
187
|
+
* gave its root over them ([root]: a tab cell's state, which the docs promise arrives on top of `passProps`), and its
|
|
188
|
+
* id. The root tag stays with the root.
|
|
189
|
+
*/
|
|
190
|
+
export function screenProps(stored, root) {
|
|
191
|
+
const props = {
|
|
192
|
+
...stored,
|
|
193
|
+
...root,
|
|
194
|
+
componentId: root.componentId
|
|
195
|
+
};
|
|
196
|
+
delete props.rootTag;
|
|
197
|
+
return props;
|
|
198
|
+
}
|
|
199
|
+
|
|
148
200
|
/**
|
|
149
201
|
* The root a React screen runs in: the screen with the props a command left for it under its id, and the new ones when
|
|
150
|
-
* options give its id new props
|
|
151
|
-
*
|
|
202
|
+
* options give its id new props, under the props the native side gives the root ([screenProps]). The slot of the app's
|
|
203
|
+
* one tree renders the same root.
|
|
152
204
|
*/
|
|
153
205
|
export function screenRoot(name) {
|
|
154
206
|
const screen = screens.get(name);
|
|
@@ -164,26 +216,35 @@ export function screenRoot(name) {
|
|
|
164
216
|
} = rootProps;
|
|
165
217
|
const watch = useCallback(watcher => watchProps(componentId, watcher), [componentId]);
|
|
166
218
|
const props = useSyncExternalStore(watch, () => propsOf(componentId));
|
|
219
|
+
useEffect(() => noteShown(componentId, name), [componentId]);
|
|
167
220
|
useEffect(() => {
|
|
168
|
-
if (rootTag !== undefined
|
|
169
|
-
owners.
|
|
221
|
+
if (rootTag !== undefined) {
|
|
222
|
+
const tags = owners.get(componentId) ?? new Set();
|
|
223
|
+
tags.add(rootTag);
|
|
224
|
+
owners.set(componentId, tags);
|
|
170
225
|
}
|
|
171
226
|
return () => {
|
|
172
|
-
//
|
|
173
|
-
// with the id: a later screen under the id, the restarted root of a screen after a
|
|
174
|
-
// (its slot may mount only once the app's provider lets it), the screen rendering
|
|
175
|
-
|
|
227
|
+
// A root while another root of the id is mounted leaves the screen alone, and so does any root while the one
|
|
228
|
+
// tree still has a slot with the id: a later screen under the id, the restarted root of a screen after a
|
|
229
|
+
// reload into the one tree (its slot may mount only once the app's provider lets it), the screen rendering
|
|
230
|
+
// again under the provider.
|
|
231
|
+
const tags = owners.get(componentId);
|
|
232
|
+
if (rootTag !== undefined && tags) {
|
|
233
|
+
tags.delete(rootTag);
|
|
234
|
+
if (tags.size > 0) return;
|
|
235
|
+
}
|
|
176
236
|
if (hasSlot(componentId)) return;
|
|
177
237
|
owners.delete(componentId);
|
|
178
|
-
|
|
238
|
+
// A component the library named in options keeps its props for the next root under its id (the node shows
|
|
239
|
+
// it again, or another screen shows the same default): they go with the node.
|
|
240
|
+
if (!isOptionsComponent(componentId)) forgetProps(componentId);
|
|
179
241
|
forgetPlace(componentId);
|
|
180
242
|
forgetMergedOptions(componentId);
|
|
181
243
|
unmounted?.(componentId);
|
|
182
244
|
};
|
|
183
245
|
}, [componentId, rootTag]);
|
|
184
246
|
return /*#__PURE__*/_jsx(Screen, {
|
|
185
|
-
...props,
|
|
186
|
-
componentId: componentId
|
|
247
|
+
...screenProps(props, rootProps)
|
|
187
248
|
});
|
|
188
249
|
};
|
|
189
250
|
root.displayName = `ScreenRoot(${name})`;
|