expo-router 7.0.0-canary-20251127-587bc53 → 7.0.0-canary-20251205-a1dedc6
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/android/build.gradle +2 -2
- package/build/fork/getStateFromPath-forks.d.ts +5 -10
- package/build/fork/getStateFromPath-forks.d.ts.map +1 -1
- package/build/fork/getStateFromPath-forks.js +14 -13
- package/build/fork/getStateFromPath-forks.js.map +1 -1
- package/build/fork/getStateFromPath.js +3 -3
- package/build/fork/getStateFromPath.js.map +1 -1
- package/build/fork/native-stack/createNativeStackNavigator.d.ts.map +1 -1
- package/build/fork/native-stack/createNativeStackNavigator.js +12 -3
- package/build/fork/native-stack/createNativeStackNavigator.js.map +1 -1
- package/build/fork/native-stack/descriptors-context.d.ts +8 -0
- package/build/fork/native-stack/descriptors-context.d.ts.map +1 -0
- package/build/fork/native-stack/descriptors-context.js +6 -0
- package/build/fork/native-stack/descriptors-context.js.map +1 -0
- package/build/internal/utils.d.ts +1 -0
- package/build/internal/utils.d.ts.map +1 -1
- package/build/internal/utils.js +3 -1
- package/build/internal/utils.js.map +1 -1
- package/build/layouts/StackClient.d.ts.map +1 -1
- package/build/layouts/StackClient.js +34 -1
- package/build/layouts/StackClient.js.map +1 -1
- package/build/link/ExpoLink.d.ts.map +1 -1
- package/build/link/ExpoLink.js +12 -4
- package/build/link/ExpoLink.js.map +1 -1
- package/build/link/Link.d.ts +2 -0
- package/build/link/Link.d.ts.map +1 -1
- package/build/link/Link.js +2 -0
- package/build/link/Link.js.map +1 -1
- package/build/link/LinkWithPreview.d.ts +6 -1
- package/build/link/LinkWithPreview.d.ts.map +1 -1
- package/build/link/LinkWithPreview.js +6 -5
- package/build/link/LinkWithPreview.js.map +1 -1
- package/build/link/elements.d.ts +8 -0
- package/build/link/elements.d.ts.map +1 -1
- package/build/link/elements.js +7 -2
- package/build/link/elements.js.map +1 -1
- package/build/link/preview/native.d.ts +17 -0
- package/build/link/preview/native.d.ts.map +1 -1
- package/build/link/preview/native.js +22 -0
- package/build/link/preview/native.js.map +1 -1
- package/build/link/zoom/ZoomTransitionEnabler.d.ts +5 -0
- package/build/link/zoom/ZoomTransitionEnabler.d.ts.map +1 -0
- package/build/link/zoom/ZoomTransitionEnabler.ios.d.ts +5 -0
- package/build/link/zoom/ZoomTransitionEnabler.ios.d.ts.map +1 -0
- package/build/link/zoom/ZoomTransitionEnabler.ios.js +44 -0
- package/build/link/zoom/ZoomTransitionEnabler.ios.js.map +1 -0
- package/build/link/zoom/ZoomTransitionEnabler.js +13 -0
- package/build/link/zoom/ZoomTransitionEnabler.js.map +1 -0
- package/build/link/zoom/ZoomTransitionEnabler.types.d.ts +4 -0
- package/build/link/zoom/ZoomTransitionEnabler.types.d.ts.map +1 -0
- package/build/link/zoom/ZoomTransitionEnabler.types.js +3 -0
- package/build/link/zoom/ZoomTransitionEnabler.types.js.map +1 -0
- package/build/link/zoom/link-apple-zoom.d.ts +23 -0
- package/build/link/zoom/link-apple-zoom.d.ts.map +1 -0
- package/build/link/zoom/link-apple-zoom.js +40 -0
- package/build/link/zoom/link-apple-zoom.js.map +1 -0
- package/build/link/zoom/useZoomTransitionPrimitives.d.ts +6 -0
- package/build/link/zoom/useZoomTransitionPrimitives.d.ts.map +1 -0
- package/build/link/zoom/useZoomTransitionPrimitives.ios.d.ts +11 -0
- package/build/link/zoom/useZoomTransitionPrimitives.ios.d.ts.map +1 -0
- package/build/link/zoom/useZoomTransitionPrimitives.ios.js +66 -0
- package/build/link/zoom/useZoomTransitionPrimitives.ios.js.map +1 -0
- package/build/link/zoom/useZoomTransitionPrimitives.js +9 -0
- package/build/link/zoom/useZoomTransitionPrimitives.js.map +1 -0
- package/build/link/zoom/zoom-transition-context.d.ts +7 -0
- package/build/link/zoom/zoom-transition-context.d.ts.map +1 -0
- package/build/link/zoom/zoom-transition-context.js +6 -0
- package/build/link/zoom/zoom-transition-context.js.map +1 -0
- package/build/native-tabs/NativeBottomTabsNavigator.d.ts +3 -15
- package/build/native-tabs/NativeBottomTabsNavigator.d.ts.map +1 -1
- package/build/native-tabs/NativeBottomTabsNavigator.js +10 -2
- package/build/native-tabs/NativeBottomTabsNavigator.js.map +1 -1
- package/build/native-tabs/NativeBottomTabsRouter.d.ts.map +1 -1
- package/build/native-tabs/NativeBottomTabsRouter.js +12 -1
- package/build/native-tabs/NativeBottomTabsRouter.js.map +1 -1
- package/build/native-tabs/NativeTabTrigger.d.ts +1 -1
- package/build/native-tabs/NativeTabTrigger.d.ts.map +1 -1
- package/build/native-tabs/NativeTabTrigger.js +3 -1
- package/build/native-tabs/NativeTabTrigger.js.map +1 -1
- package/build/native-tabs/NativeTabs.d.ts +6 -3
- package/build/native-tabs/NativeTabs.d.ts.map +1 -1
- package/build/native-tabs/NativeTabs.js +7 -2
- package/build/native-tabs/NativeTabs.js.map +1 -1
- package/build/native-tabs/NativeTabsView.d.ts.map +1 -1
- package/build/native-tabs/NativeTabsView.js +26 -3
- package/build/native-tabs/NativeTabsView.js.map +1 -1
- package/build/native-tabs/common/elements.d.ts +25 -0
- package/build/native-tabs/common/elements.d.ts.map +1 -1
- package/build/native-tabs/common/elements.js +26 -1
- package/build/native-tabs/common/elements.js.map +1 -1
- package/build/native-tabs/hooks.d.ts +45 -0
- package/build/native-tabs/hooks.d.ts.map +1 -0
- package/build/native-tabs/hooks.js +57 -0
- package/build/native-tabs/hooks.js.map +1 -0
- package/build/native-tabs/types.d.ts +36 -2
- package/build/native-tabs/types.d.ts.map +1 -1
- package/build/native-tabs/types.js.map +1 -1
- package/build/native-tabs/utils/bottomAccessory.d.ts +9 -0
- package/build/native-tabs/utils/bottomAccessory.d.ts.map +1 -0
- package/build/native-tabs/utils/bottomAccessory.js +17 -0
- package/build/native-tabs/utils/bottomAccessory.js.map +1 -0
- package/build/navigationParams.d.ts +3 -1
- package/build/navigationParams.d.ts.map +1 -1
- package/build/navigationParams.js +5 -1
- package/build/navigationParams.js.map +1 -1
- package/build/toolbar/elements.d.ts +24 -0
- package/build/toolbar/elements.d.ts.map +1 -0
- package/build/toolbar/elements.js +36 -0
- package/build/toolbar/elements.js.map +1 -0
- package/build/toolbar/index.d.ts +9 -0
- package/build/toolbar/index.d.ts.map +1 -0
- package/build/toolbar/index.js +12 -0
- package/build/toolbar/index.js.map +1 -0
- package/build/toolbar/native.d.ts +4 -0
- package/build/toolbar/native.d.ts.map +1 -0
- package/build/toolbar/native.ios.d.ts +4 -0
- package/build/toolbar/native.ios.d.ts.map +1 -0
- package/build/toolbar/native.ios.js +21 -0
- package/build/toolbar/native.ios.js.map +1 -0
- package/build/toolbar/native.js +11 -0
- package/build/toolbar/native.js.map +1 -0
- package/build/toolbar/native.types.d.ts +30 -0
- package/build/toolbar/native.types.d.ts.map +1 -0
- package/build/toolbar/native.types.js +3 -0
- package/build/toolbar/native.types.js.map +1 -0
- package/build/useScreens.d.ts.map +1 -1
- package/build/useScreens.js +13 -5
- package/build/useScreens.js.map +1 -1
- package/build/views/Sitemap.js +3 -2
- package/build/views/Sitemap.js.map +1 -1
- package/expo-module.config.json +2 -2
- package/ios/LinkPreview/LinkPreviewNativeActionView.swift +1 -0
- package/ios/LinkPreview/LinkPreviewNativeModule.swift +49 -1
- package/ios/LinkPreview/LinkPreviewNativeNavigation.swift +132 -70
- package/ios/LinkPreview/LinkPreviewNativeView.swift +28 -14
- package/ios/LinkPreview/LinkZoomTransition.swift +227 -0
- package/ios/Toolbar/RouterToolbarHostView.swift +140 -0
- package/ios/Toolbar/RouterToolbarItemView.swift +171 -0
- package/ios/Toolbar/RouterToolbarModule.swift +102 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251127-587bc53/expo.modules.router-7.0.0-canary-20251127-587bc53.module → 7.0.0-canary-20251205-a1dedc6/expo.modules.router-7.0.0-canary-20251205-a1dedc6.module} +7 -7
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251205-a1dedc6/expo.modules.router-7.0.0-canary-20251205-a1dedc6.module.md5 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251205-a1dedc6/expo.modules.router-7.0.0-canary-20251205-a1dedc6.module.sha1 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251205-a1dedc6/expo.modules.router-7.0.0-canary-20251205-a1dedc6.module.sha256 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251205-a1dedc6/expo.modules.router-7.0.0-canary-20251205-a1dedc6.module.sha512 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251127-587bc53/expo.modules.router-7.0.0-canary-20251127-587bc53.pom → 7.0.0-canary-20251205-a1dedc6/expo.modules.router-7.0.0-canary-20251205-a1dedc6.pom} +1 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251205-a1dedc6/expo.modules.router-7.0.0-canary-20251205-a1dedc6.pom.md5 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251205-a1dedc6/expo.modules.router-7.0.0-canary-20251205-a1dedc6.pom.sha1 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251205-a1dedc6/expo.modules.router-7.0.0-canary-20251205-a1dedc6.pom.sha256 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251205-a1dedc6/expo.modules.router-7.0.0-canary-20251205-a1dedc6.pom.sha512 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml +4 -4
- package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.md5 +1 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.sha1 +1 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.sha256 +1 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.sha512 +1 -1
- package/package.json +14 -12
- package/unstable-toolbar.d.ts +1 -0
- package/unstable-toolbar.js +1 -0
- package/ios/LinkPreview/LinkPreviewNativeNavigation.h +0 -50
- package/ios/LinkPreview/LinkPreviewNativeNavigation.mm +0 -164
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251127-587bc53/expo.modules.router-7.0.0-canary-20251127-587bc53.module.md5 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251127-587bc53/expo.modules.router-7.0.0-canary-20251127-587bc53.module.sha1 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251127-587bc53/expo.modules.router-7.0.0-canary-20251127-587bc53.module.sha256 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251127-587bc53/expo.modules.router-7.0.0-canary-20251127-587bc53.module.sha512 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251127-587bc53/expo.modules.router-7.0.0-canary-20251127-587bc53.pom.md5 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251127-587bc53/expo.modules.router-7.0.0-canary-20251127-587bc53.pom.sha1 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251127-587bc53/expo.modules.router-7.0.0-canary-20251127-587bc53.pom.sha256 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251127-587bc53/expo.modules.router-7.0.0-canary-20251127-587bc53.pom.sha512 +0 -1
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251127-587bc53/expo.modules.router-7.0.0-canary-20251127-587bc53-sources.jar → 7.0.0-canary-20251205-a1dedc6/expo.modules.router-7.0.0-canary-20251205-a1dedc6-sources.jar} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251127-587bc53/expo.modules.router-7.0.0-canary-20251127-587bc53-sources.jar.md5 → 7.0.0-canary-20251205-a1dedc6/expo.modules.router-7.0.0-canary-20251205-a1dedc6-sources.jar.md5} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251127-587bc53/expo.modules.router-7.0.0-canary-20251127-587bc53-sources.jar.sha1 → 7.0.0-canary-20251205-a1dedc6/expo.modules.router-7.0.0-canary-20251205-a1dedc6-sources.jar.sha1} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251127-587bc53/expo.modules.router-7.0.0-canary-20251127-587bc53-sources.jar.sha256 → 7.0.0-canary-20251205-a1dedc6/expo.modules.router-7.0.0-canary-20251205-a1dedc6-sources.jar.sha256} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251127-587bc53/expo.modules.router-7.0.0-canary-20251127-587bc53-sources.jar.sha512 → 7.0.0-canary-20251205-a1dedc6/expo.modules.router-7.0.0-canary-20251205-a1dedc6-sources.jar.sha512} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251127-587bc53/expo.modules.router-7.0.0-canary-20251127-587bc53.aar → 7.0.0-canary-20251205-a1dedc6/expo.modules.router-7.0.0-canary-20251205-a1dedc6.aar} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251127-587bc53/expo.modules.router-7.0.0-canary-20251127-587bc53.aar.md5 → 7.0.0-canary-20251205-a1dedc6/expo.modules.router-7.0.0-canary-20251205-a1dedc6.aar.md5} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251127-587bc53/expo.modules.router-7.0.0-canary-20251127-587bc53.aar.sha1 → 7.0.0-canary-20251205-a1dedc6/expo.modules.router-7.0.0-canary-20251205-a1dedc6.aar.sha1} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251127-587bc53/expo.modules.router-7.0.0-canary-20251127-587bc53.aar.sha256 → 7.0.0-canary-20251205-a1dedc6/expo.modules.router-7.0.0-canary-20251205-a1dedc6.aar.sha256} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251127-587bc53/expo.modules.router-7.0.0-canary-20251127-587bc53.aar.sha512 → 7.0.0-canary-20251205-a1dedc6/expo.modules.router-7.0.0-canary-20251205-a1dedc6.aar.sha512} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"elements.js","sourceRoot":"","sources":["../../src/link/elements.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyDb,wCAYC;AA8HD,kCAwBC;AAuBD,kCAYC;AA5PD,+CAA8F;AAI9F,6EAA0E;AAC1E,uDAAoD;AACpD,uEAA6D;AAC7D,6CAAqF;AACrF,qCAAkC;AAuClC;;;;;;;GAOG;AACH,SAAgB,cAAc,CAAC,KAA0B;IACvD,IAAI,IAAA,kCAAY,GAAE,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK,KAAK,IAAI,CAAC,IAAA,WAAG,EAAC,uDAA0B,CAAC,EAAE,CAAC;QACxF,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,EAAE,sBAAsB,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IAC3D,OAAO,CACL,CAAC,gCAAuB,CACtB,IAAI,IAAI,CAAC,CACT,UAAU,CAAC,CAAC,OAAO,CAAC,CACpB,aAAa,CAAC,CAAC,sBAAsB,CAAC,EACtC,CACH,CAAC;AACJ,CAAC;AAkCD;;;;;;;;;;;;;;;;;GAiBG;AACI,MAAM,QAAQ,GAA4B,CAAC,KAAK,EAAE,EAAE;IACzD,IAAI,IAAA,kCAAY,GAAE,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK,KAAK,IAAI,CAAC,IAAA,WAAG,EAAC,uDAA0B,CAAC,EAAE,CAAC;QACxF,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,QAAQ,GAAG,eAAK,CAAC,QAAQ,CAAC,OAAO,CAAC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;SAAM,CAAC;QACN,OAAO,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,yBAAW,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAG,CAAC,CAAC,CAAC,IAAI,CAAC;IAC3D,CAAC;IAED,OAAO,CACL,CAAC,iCAAwB,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,CAAC,oBAAoB,CAAC,CAAC,WAAW,CAAC,CAC9E;MAAA,CAAC,OAAO,CACV;IAAA,EAAE,iCAAwB,CAAC,CAC5B,CAAC;AACJ,CAAC;AAID;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,WAAW,CAAC,KAAuB;IACjD,IAAI,eAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,IAAA,sBAAc,EAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;QAChF,6EAA6E;QAC7E,qGAAqG;QACrG,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,SAAS,IAAI,KAAK,EAAE,CAAC;YAC7D,MAAM,IAAI,KAAK,CACb,gHAAgH,CACjH,CAAC;QACJ,CAAC;QACD,OAAO,KAAK,CAAC,QAAQ,CAAC;IACxB,CAAC;IACD,OAAO,CAAC,WAAI,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;AAC7B,CAAC","sourcesContent":["'use client';\n\nimport React, { isValidElement, use, type PropsWithChildren, type ReactElement } from 'react';\nimport type { ViewStyle } from 'react-native';\nimport type { SFSymbol } from 'sf-symbols-typescript';\n\nimport { InternalLinkPreviewContext } from './InternalLinkPreviewContext';\nimport { HrefPreview } from './preview/HrefPreview';\nimport { useIsPreview } from './preview/PreviewRouteContext';\nimport { NativeLinkPreviewAction, NativeLinkPreviewContent } from './preview/native';\nimport { Slot } from '../ui/Slot';\n\nexport interface LinkMenuActionProps {\n /**\n * The title of the menu item.\n */\n title: string;\n /**\n * Optional SF Symbol displayed alongside the menu item.\n */\n icon?: SFSymbol;\n /**\n * If `true`, the menu item will be disabled and not selectable.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenuelement/attributes/disabled) for more information.\n */\n disabled?: boolean;\n /**\n * If `true`, the menu item will be displayed as destructive.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenuelement/attributes/destructive) for more information.\n */\n destructive?: boolean;\n /**\n * If `true`, the menu will be kept presented after the action is selected.\n *\n * This is marked as unstable, because when action is selected it will recreate the menu,\n * which will close all opened submenus and reset the scroll position.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenuelement/attributes/keepsmenupresented) for more information.\n */\n unstable_keepPresented?: boolean;\n /**\n * If `true`, the menu item will be displayed as selected.\n */\n isOn?: boolean;\n onPress: () => void;\n}\n\n/**\n * This component renders a context menu action for a link.\n * It should only be used as a child of `Link.Menu` or `LinkMenu`.\n *\n * > **Note**: You can use the alias `Link.MenuAction` for this component.\n *\n * @platform ios\n */\nexport function LinkMenuAction(props: LinkMenuActionProps) {\n if (useIsPreview() || process.env.EXPO_OS !== 'ios' || !use(InternalLinkPreviewContext)) {\n return null;\n }\n const { unstable_keepPresented, onPress, ...rest } = props;\n return (\n <NativeLinkPreviewAction\n {...rest}\n onSelected={onPress}\n keepPresented={unstable_keepPresented}\n />\n );\n}\n\nexport interface LinkMenuProps {\n /**\n * The title of the menu item\n */\n title?: string;\n /**\n * Optional SF Symbol displayed alongside the menu item.\n */\n icon?: string;\n /**\n * If `true`, the menu will be displayed as a palette.\n * This means that the menu will be displayed as one row\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenu/options-swift.struct/displayaspalette) for more information.\n */\n displayAsPalette?: boolean;\n /**\n * If `true`, the menu will be displayed inline.\n * This means that the menu will not be collapsed\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenu/options-swift.struct/displayinline) for more information.\n */\n displayInline?: boolean;\n /**\n * If `true`, the menu item will be displayed as destructive.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenu/options-swift.struct/destructive) for more information.\n */\n destructive?: boolean;\n children: ReactElement<LinkMenuActionProps> | ReactElement<LinkMenuActionProps>[];\n}\n\n/**\n * Groups context menu actions for a link.\n *\n * If multiple `Link.Menu` components are used within a single `Link`, only the first will be rendered.\n * Only `Link.MenuAction` and `LinkMenuAction` components are allowed as children.\n *\n * @example\n * ```tsx\n * <Link.Menu>\n * <Link.MenuAction title=\"Action 1\" onPress={() => {}} />\n * <Link.MenuAction title=\"Action 2\" onPress={() => {}} />\n * </Link.Menu>\n * ```\n *\n * > **Note**: You can use the alias `Link.Menu` for this component.\n *\n * @platform ios\n */\nexport const LinkMenu: React.FC<LinkMenuProps> = (props) => {\n if (useIsPreview() || process.env.EXPO_OS !== 'ios' || !use(InternalLinkPreviewContext)) {\n return null;\n }\n const children = React.Children.toArray(props.children).filter(\n (child) => isValidElement(child) && (child.type === LinkMenuAction || child.type === LinkMenu)\n );\n return (\n <NativeLinkPreviewAction\n {...props}\n title={props.title ?? ''}\n onSelected={() => {}}\n children={children}\n />\n );\n};\n\nexport type LinkPreviewStyle = Omit<ViewStyle, 'position' | 'width' | 'height'> & {\n /**\n * Sets the preferred width of the preview.\n * If not set, full width of the screen will be used.\n *\n * This is only **preferred** width, the actual width may be different\n */\n width?: number;\n\n /**\n * Sets the preferred height of the preview.\n * If not set, full height of the screen will be used.\n *\n * This is only **preferred** height, the actual height may be different\n */\n height?: number;\n};\n\nexport interface LinkPreviewProps {\n children?: React.ReactNode;\n /**\n * Custom styles for the preview container.\n *\n * Note that some styles may not work, as they are limited or reset by the native view\n */\n style?: LinkPreviewStyle;\n}\n\n/**\n * A component used to render and customize the link preview.\n *\n * If `Link.Preview` is used without any props, it will render a preview of the `href` passed to the `Link`.\n *\n * If multiple `Link.Preview` components are used within a single `Link`, only the first one will be rendered.\n *\n * To customize the preview, you can pass custom content as children.\n *\n * @example\n * ```tsx\n * <Link href=\"/about\">\n * <Link.Preview>\n * <Text>Custom Preview Content</Text>\n * </Link.Preview>\n * </Link>\n * ```\n *\n * @example\n * ```tsx\n * <Link href=\"/about\">\n * <Link.Preview />\n * </Link>\n * ```\n *\n * > **Note**: You can use the alias `Link.Preview` for this component.\n *\n * @platform ios\n */\nexport function LinkPreview(props: LinkPreviewProps) {\n const { children, style } = props;\n const internalPreviewContext = use(InternalLinkPreviewContext);\n if (useIsPreview() || process.env.EXPO_OS !== 'ios' || !internalPreviewContext) {\n return null;\n }\n const { isVisible, href } = internalPreviewContext;\n const { width, height, ...restOfStyle } = style ?? {};\n const contentSize = {\n width: width ?? 0,\n height: height ?? 0,\n };\n let content: React.ReactNode;\n if (children) {\n content = isVisible ? children : null;\n } else {\n content = isVisible ? <HrefPreview href={href} /> : null;\n }\n\n return (\n <NativeLinkPreviewContent style={restOfStyle} preferredContentSize={contentSize}>\n {content}\n </NativeLinkPreviewContent>\n );\n}\n\nexport type LinkTriggerProps = PropsWithChildren;\n\n/**\n * Serves as the trigger for a link.\n * The content inside this component will be rendered as part of the base link.\n *\n * If multiple `Link.Trigger` components are used within a single `Link`, only the first will be rendered.\n *\n * @example\n * ```tsx\n * <Link href=\"/about\">\n * <Link.Trigger>\n * Trigger\n * </Link.Trigger>\n * </Link>\n * ```\n *\n * > **Note**: You can use the alias `Link.Trigger` for this component.\n *\n * @platform ios\n */\nexport function LinkTrigger(props: LinkTriggerProps) {\n if (React.Children.count(props.children) > 1 || !isValidElement(props.children)) {\n // If onPress is passed, this means that Link passed props to this component.\n // We can assume that asChild is used, so we throw an error, because link will not work in this case.\n if (props && typeof props === 'object' && 'onPress' in props) {\n throw new Error(\n 'When using Link.Trigger in an asChild Link, you must pass a single child element that will emit onPress event.'\n );\n }\n return props.children;\n }\n return <Slot {...props} />;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"elements.js","sourceRoot":"","sources":["../../src/link/elements.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,KAAK,IAAI,CAAC;QACjB,MAAM,EAAE,MAAM,IAAI,CAAC;KACpB,CAAC;IACF,IAAI,OAAwB,CAAC;IAC7B,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO,GAAG,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;IACxC,CAAC;SAAM,CAAC;QACN,OAAO,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,yBAAW,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAG,CAAC,CAAC,CAAC,IAAI,CAAC;IAC3D,CAAC;IAED,OAAO,CACL,CAAC,iCAAwB,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,CAAC,oBAAoB,CAAC,CAAC,WAAW,CAAC,CAC9E;MAAA,CAAC,OAAO,CACV;IAAA,EAAE,iCAAwB,CAAC,CAC5B,CAAC;AACJ,CAAC;AAID;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,WAAW,CAAC,KAAuB;IACjD,IAAI,eAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,IAAA,sBAAc,EAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;QAChF,6EAA6E;QAC7E,qGAAqG;QACrG,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,SAAS,IAAI,KAAK,EAAE,CAAC;YAC7D,MAAM,IAAI,KAAK,CACb,gHAAgH,CACjH,CAAC;QACJ,CAAC;QACD,OAAO,KAAK,CAAC,QAAQ,CAAC;IACxB,CAAC;IACD,OAAO,CAAC,WAAI,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;AAC7B,CAAC","sourcesContent":["'use client';\n\nimport { nanoid } from 'nanoid/non-secure';\nimport React, {\n isValidElement,\n use,\n useMemo,\n type PropsWithChildren,\n type ReactElement,\n} from 'react';\nimport type { ViewStyle } from 'react-native';\nimport type { SFSymbol } from 'sf-symbols-typescript';\n\nimport { InternalLinkPreviewContext } from './InternalLinkPreviewContext';\nimport { HrefPreview } from './preview/HrefPreview';\nimport { useIsPreview } from './preview/PreviewRouteContext';\nimport { NativeLinkPreviewAction, NativeLinkPreviewContent } from './preview/native';\nimport { Slot } from '../ui/Slot';\n\nexport interface LinkMenuActionProps {\n /**\n * The title of the menu item.\n */\n title: string;\n /**\n * Optional SF Symbol displayed alongside the menu item.\n */\n icon?: SFSymbol;\n /**\n * If `true`, the menu item will be disabled and not selectable.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenuelement/attributes/disabled) for more information.\n */\n disabled?: boolean;\n /**\n * If `true`, the menu item will be displayed as destructive.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenuelement/attributes/destructive) for more information.\n */\n destructive?: boolean;\n /**\n * If `true`, the menu will be kept presented after the action is selected.\n *\n * This is marked as unstable, because when action is selected it will recreate the menu,\n * which will close all opened submenus and reset the scroll position.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenuelement/attributes/keepsmenupresented) for more information.\n */\n unstable_keepPresented?: boolean;\n /**\n * If `true`, the menu item will be displayed as selected.\n */\n isOn?: boolean;\n onPress: () => void;\n}\n\n/**\n * This component renders a context menu action for a link.\n * It should only be used as a child of `Link.Menu` or `LinkMenu`.\n *\n * > **Note**: You can use the alias `Link.MenuAction` for this component.\n *\n * @platform ios\n */\nexport function LinkMenuAction(props: LinkMenuActionProps) {\n const identifier = useMemo(() => nanoid(), []);\n if (useIsPreview() || process.env.EXPO_OS !== 'ios' || !use(InternalLinkPreviewContext)) {\n return null;\n }\n const { unstable_keepPresented, onPress, ...rest } = props;\n return (\n <NativeLinkPreviewAction\n {...rest}\n onSelected={onPress}\n keepPresented={unstable_keepPresented}\n identifier={identifier}\n />\n );\n}\n\nexport interface LinkMenuProps {\n /**\n * The title of the menu item\n */\n title?: string;\n /**\n * Optional SF Symbol displayed alongside the menu item.\n */\n icon?: string;\n /**\n * If `true`, the menu will be displayed as a palette.\n * This means that the menu will be displayed as one row\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenu/options-swift.struct/displayaspalette) for more information.\n */\n palette?: boolean;\n /**\n * @deprecated Use `palette` prop instead.\n */\n displayAsPalette?: boolean;\n /**\n * If `true`, the menu will be displayed inline.\n * This means that the menu will not be collapsed\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenu/options-swift.struct/displayinline) for more information.\n */\n inline?: boolean;\n /**\n * @deprecated Use `inline` prop instead.\n */\n displayInline?: boolean;\n /**\n * If `true`, the menu item will be displayed as destructive.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uimenu/options-swift.struct/destructive) for more information.\n */\n destructive?: boolean;\n children: ReactElement<LinkMenuActionProps> | ReactElement<LinkMenuActionProps>[];\n}\n\n/**\n * Groups context menu actions for a link.\n *\n * If multiple `Link.Menu` components are used within a single `Link`, only the first will be rendered.\n * Only `Link.MenuAction` and `LinkMenuAction` components are allowed as children.\n *\n * @example\n * ```tsx\n * <Link.Menu>\n * <Link.MenuAction title=\"Action 1\" onPress={() => {}} />\n * <Link.MenuAction title=\"Action 2\" onPress={() => {}} />\n * </Link.Menu>\n * ```\n *\n * > **Note**: You can use the alias `Link.Menu` for this component.\n *\n * @platform ios\n */\nexport const LinkMenu: React.FC<LinkMenuProps> = (props) => {\n const identifier = useMemo(() => nanoid(), []);\n if (useIsPreview() || process.env.EXPO_OS !== 'ios' || !use(InternalLinkPreviewContext)) {\n return null;\n }\n const children = React.Children.toArray(props.children).filter(\n (child) => isValidElement(child) && (child.type === LinkMenuAction || child.type === LinkMenu)\n );\n const displayAsPalette = props.palette ?? props.displayAsPalette;\n const displayInline = props.inline ?? props.displayInline;\n return (\n <NativeLinkPreviewAction\n {...props}\n displayAsPalette={displayAsPalette}\n displayInline={displayInline}\n title={props.title ?? ''}\n onSelected={() => {}}\n children={children}\n identifier={identifier}\n />\n );\n};\n\nexport type LinkPreviewStyle = Omit<ViewStyle, 'position' | 'width' | 'height'> & {\n /**\n * Sets the preferred width of the preview.\n * If not set, full width of the screen will be used.\n *\n * This is only **preferred** width, the actual width may be different\n */\n width?: number;\n\n /**\n * Sets the preferred height of the preview.\n * If not set, full height of the screen will be used.\n *\n * This is only **preferred** height, the actual height may be different\n */\n height?: number;\n};\n\nexport interface LinkPreviewProps {\n children?: React.ReactNode;\n /**\n * Custom styles for the preview container.\n *\n * Note that some styles may not work, as they are limited or reset by the native view\n */\n style?: LinkPreviewStyle;\n}\n\n/**\n * A component used to render and customize the link preview.\n *\n * If `Link.Preview` is used without any props, it will render a preview of the `href` passed to the `Link`.\n *\n * If multiple `Link.Preview` components are used within a single `Link`, only the first one will be rendered.\n *\n * To customize the preview, you can pass custom content as children.\n *\n * @example\n * ```tsx\n * <Link href=\"/about\">\n * <Link.Preview>\n * <Text>Custom Preview Content</Text>\n * </Link.Preview>\n * </Link>\n * ```\n *\n * @example\n * ```tsx\n * <Link href=\"/about\">\n * <Link.Preview />\n * </Link>\n * ```\n *\n * > **Note**: You can use the alias `Link.Preview` for this component.\n *\n * @platform ios\n */\nexport function LinkPreview(props: LinkPreviewProps) {\n const { children, style } = props;\n const internalPreviewContext = use(InternalLinkPreviewContext);\n if (useIsPreview() || process.env.EXPO_OS !== 'ios' || !internalPreviewContext) {\n return null;\n }\n const { isVisible, href } = internalPreviewContext;\n const { width, height, ...restOfStyle } = style ?? {};\n const contentSize = {\n width: width ?? 0,\n height: height ?? 0,\n };\n let content: React.ReactNode;\n if (children) {\n content = isVisible ? children : null;\n } else {\n content = isVisible ? <HrefPreview href={href} /> : null;\n }\n\n return (\n <NativeLinkPreviewContent style={restOfStyle} preferredContentSize={contentSize}>\n {content}\n </NativeLinkPreviewContent>\n );\n}\n\nexport type LinkTriggerProps = PropsWithChildren;\n\n/**\n * Serves as the trigger for a link.\n * The content inside this component will be rendered as part of the base link.\n *\n * If multiple `Link.Trigger` components are used within a single `Link`, only the first will be rendered.\n *\n * @example\n * ```tsx\n * <Link href=\"/about\">\n * <Link.Trigger>\n * Trigger\n * </Link.Trigger>\n * </Link>\n * ```\n *\n * > **Note**: You can use the alias `Link.Trigger` for this component.\n *\n * @platform ios\n */\nexport function LinkTrigger(props: LinkTriggerProps) {\n if (React.Children.count(props.children) > 1 || !isValidElement(props.children)) {\n // If onPress is passed, this means that Link passed props to this component.\n // We can assume that asChild is used, so we throw an error, because link will not work in this case.\n if (props && typeof props === 'object' && 'onPress' in props) {\n throw new Error(\n 'When using Link.Trigger in an asChild Link, you must pass a single child element that will emit onPress event.'\n );\n }\n return props.children;\n }\n return <Slot {...props} />;\n}\n"]}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import type { PropsWithChildren } from 'react';
|
|
1
2
|
import { type ViewProps } from 'react-native';
|
|
2
3
|
export interface NativeLinkPreviewActionProps {
|
|
4
|
+
identifier: string;
|
|
3
5
|
title: string;
|
|
4
6
|
icon?: string;
|
|
5
7
|
children?: React.ReactNode;
|
|
@@ -38,4 +40,19 @@ export interface NativeLinkPreviewContentProps extends ViewProps {
|
|
|
38
40
|
};
|
|
39
41
|
}
|
|
40
42
|
export declare function NativeLinkPreviewContent(props: NativeLinkPreviewContentProps): import("react").JSX.Element | null;
|
|
43
|
+
export declare function LinkZoomTransitionEnabler(props: {
|
|
44
|
+
zoomTransitionSourceIdentifier: string;
|
|
45
|
+
preventInteractiveDismissal?: boolean;
|
|
46
|
+
}): import("react").JSX.Element | null;
|
|
47
|
+
interface LinkSourceAlignmentRect {
|
|
48
|
+
x: number;
|
|
49
|
+
y: number;
|
|
50
|
+
width: number;
|
|
51
|
+
height: number;
|
|
52
|
+
}
|
|
53
|
+
export declare function LinkZoomTransitionSource(props: PropsWithChildren<{
|
|
54
|
+
identifier: string;
|
|
55
|
+
alignment?: LinkSourceAlignmentRect;
|
|
56
|
+
}>): import("react").JSX.Element | null;
|
|
57
|
+
export {};
|
|
41
58
|
//# sourceMappingURL=native.d.ts.map
|
|
@@ -1 +1 @@
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EAAE,MAAM,IAAI,CAAC;IAC/B,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;IAChC,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC/B,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,iCAAiC,CAAC,EAAE,MAAM,IAAI,CAAC;IAC/C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAKD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,sCAK9D;AAID,MAAM,WAAW,6BAA8B,SAAQ,SAAS;IAC9D,oBAAoB,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAC1D;AAMD,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,6BAA6B,sCAa5E;AASD,wBAAgB,yBAAyB,CAAC,KAAK,EAAE;IAC/C,8BAA8B,EAAE,MAAM,CAAC;IACvC,2BAA2B,CAAC,EAAE,OAAO,CAAC;CACvC,sCAWA;AAED,UAAU,uBAAuB;IAC/B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAWD,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,iBAAiB,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,uBAAuB,CAAA;CAAE,CAAC,sCAYtF"}
|
|
@@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.NativeLinkPreviewAction = NativeLinkPreviewAction;
|
|
5
5
|
exports.NativeLinkPreview = NativeLinkPreview;
|
|
6
6
|
exports.NativeLinkPreviewContent = NativeLinkPreviewContent;
|
|
7
|
+
exports.LinkZoomTransitionEnabler = LinkZoomTransitionEnabler;
|
|
8
|
+
exports.LinkZoomTransitionSource = LinkZoomTransitionSource;
|
|
7
9
|
const expo_1 = require("expo");
|
|
8
10
|
const react_native_1 = require("react-native");
|
|
9
11
|
const areNativeViewsAvailable = process.env.EXPO_OS === 'ios' && !react_native_1.Platform.isTV && global.RN$Bridgeless === true;
|
|
@@ -43,4 +45,24 @@ function NativeLinkPreviewContent(props) {
|
|
|
43
45
|
return <NativeLinkPreviewContentView {...props} style={style}/>;
|
|
44
46
|
}
|
|
45
47
|
// #endregion
|
|
48
|
+
// #region Zoom transition
|
|
49
|
+
const LinkZoomTransitionEnablerNativeView = areNativeViewsAvailable
|
|
50
|
+
? (0, expo_1.requireNativeView)('ExpoRouterNativeLinkPreview', 'LinkZoomTransitionEnabler')
|
|
51
|
+
: null;
|
|
52
|
+
function LinkZoomTransitionEnabler(props) {
|
|
53
|
+
if (!LinkZoomTransitionEnablerNativeView) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
return (<LinkZoomTransitionEnablerNativeView {...props} disableForceFlatten style={{ display: 'contents' }}/>);
|
|
57
|
+
}
|
|
58
|
+
const LinkZoomTransitionSourceNativeView = areNativeViewsAvailable
|
|
59
|
+
? (0, expo_1.requireNativeView)('ExpoRouterNativeLinkPreview', 'LinkZoomTransitionSource')
|
|
60
|
+
: null;
|
|
61
|
+
function LinkZoomTransitionSource(props) {
|
|
62
|
+
if (!LinkZoomTransitionSourceNativeView) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
return (<LinkZoomTransitionSourceNativeView {...props} disableForceFlatten style={{ display: 'contents' }}/>);
|
|
66
|
+
}
|
|
67
|
+
// #endregion
|
|
46
68
|
//# sourceMappingURL=native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native.js","sourceRoot":"","sources":["../../../src/link/preview/native.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;
|
|
1
|
+
{"version":3,"file":"native.js","sourceRoot":"","sources":["../../../src/link/preview/native.tsx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X;YACE,QAAQ,EAAE,UAAU;YACpB,GAAG,EAAE,CAAC;YACN,IAAI,EAAE,CAAC;SACC;KACX,CAAC,CAAC;IACH,OAAO,CAAC,4BAA4B,CAAC,IAAI,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,EAAG,CAAC;AACnE,CAAC;AACD,aAAa;AAEb,0BAA0B;AAC1B,MAAM,mCAAmC,GAE9B,uBAAuB;IAChC,CAAC,CAAC,IAAA,wBAAiB,EAAC,6BAA6B,EAAE,2BAA2B,CAAC;IAC/E,CAAC,CAAC,IAAI,CAAC;AACT,SAAgB,yBAAyB,CAAC,KAGzC;IACC,IAAI,CAAC,mCAAmC,EAAE,CAAC;QACzC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,CACL,CAAC,mCAAmC,CAClC,IAAI,KAAK,CAAC,CACV,mBAAmB,CACnB,KAAK,CAAC,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,EAC/B,CACH,CAAC;AACJ,CAAC;AASD,MAAM,kCAAkC,GAM7B,uBAAuB;IAChC,CAAC,CAAC,IAAA,wBAAiB,EAAC,6BAA6B,EAAE,0BAA0B,CAAC;IAC9E,CAAC,CAAC,IAAI,CAAC;AACT,SAAgB,wBAAwB,CACtC,KAAqF;IAErF,IAAI,CAAC,kCAAkC,EAAE,CAAC;QACxC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,CACL,CAAC,kCAAkC,CACjC,IAAI,KAAK,CAAC,CACV,mBAAmB,CACnB,KAAK,CAAC,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,EAC/B,CACH,CAAC;AACJ,CAAC;AACD,aAAa","sourcesContent":["'use client';\n\nimport { requireNativeView } from 'expo';\nimport type { PropsWithChildren } from 'react';\nimport { Platform, StyleSheet, type ViewProps } from 'react-native';\n\nconst areNativeViewsAvailable =\n process.env.EXPO_OS === 'ios' && !Platform.isTV && global.RN$Bridgeless === true;\n\n// #region Action View\nexport interface NativeLinkPreviewActionProps {\n identifier: string;\n title: string;\n icon?: string;\n children?: React.ReactNode;\n disabled?: boolean;\n destructive?: boolean;\n // This may lead to race conditions, when two menu actions are on at the same time.\n // The logic should be enforced in the JS code, rather than in the native code.\n // singleSelection?: boolean;\n displayAsPalette?: boolean;\n displayInline?: boolean;\n isOn?: boolean;\n // There are issues with menu state updates when keep presented is set to true.\n // When updating the context menu state, it will either not update or it will recreate the menu. The latter is a problem,\n // because it will close all opened submenus and reset the scroll position.\n // TODO: (@ubax) find a way to fix this.\n keepPresented?: boolean;\n onSelected: () => void;\n}\nconst LinkPreviewNativeActionView: React.ComponentType<NativeLinkPreviewActionProps> | null =\n areNativeViewsAvailable\n ? requireNativeView('ExpoRouterNativeLinkPreview', 'LinkPreviewNativeActionView')\n : null;\nexport function NativeLinkPreviewAction(props: NativeLinkPreviewActionProps) {\n if (!LinkPreviewNativeActionView) {\n return null;\n }\n return <LinkPreviewNativeActionView {...props} />;\n}\n// #endregion\n\n// #region Preview View\nexport interface TabPath {\n oldTabKey: string;\n newTabKey: string;\n}\nexport interface NativeLinkPreviewProps extends ViewProps {\n nextScreenId: string | undefined;\n tabPath:\n | {\n path: TabPath[];\n }\n | undefined;\n disableForceFlatten?: boolean;\n onWillPreviewOpen?: () => void;\n onDidPreviewOpen?: () => void;\n onPreviewWillClose?: () => void;\n onPreviewDidClose?: () => void;\n onPreviewTapped?: () => void;\n onPreviewTappedAnimationCompleted?: () => void;\n children: React.ReactNode;\n}\nconst NativeLinkPreviewView: React.ComponentType<NativeLinkPreviewProps> | null =\n areNativeViewsAvailable\n ? requireNativeView('ExpoRouterNativeLinkPreview', 'NativeLinkPreviewView')\n : null;\nexport function NativeLinkPreview(props: NativeLinkPreviewProps) {\n if (!NativeLinkPreviewView) {\n return null;\n }\n return <NativeLinkPreviewView {...props} />;\n}\n// #endregion\n\n// #region Preview Content View\nexport interface NativeLinkPreviewContentProps extends ViewProps {\n preferredContentSize?: { width: number; height: number };\n}\nconst NativeLinkPreviewContentView: React.ComponentType<NativeLinkPreviewContentProps> | null =\n areNativeViewsAvailable\n ? requireNativeView('ExpoRouterNativeLinkPreview', 'NativeLinkPreviewContentView')\n : null;\n\nexport function NativeLinkPreviewContent(props: NativeLinkPreviewContentProps) {\n if (!NativeLinkPreviewContentView) {\n return null;\n }\n const style = StyleSheet.flatten([\n props.style,\n {\n position: 'absolute',\n top: 0,\n left: 0,\n } as const,\n ]);\n return <NativeLinkPreviewContentView {...props} style={style} />;\n}\n// #endregion\n\n// #region Zoom transition\nconst LinkZoomTransitionEnablerNativeView: React.ComponentType<\n ViewProps & { zoomTransitionSourceIdentifier: string; disableForceFlatten?: boolean }\n> | null = areNativeViewsAvailable\n ? requireNativeView('ExpoRouterNativeLinkPreview', 'LinkZoomTransitionEnabler')\n : null;\nexport function LinkZoomTransitionEnabler(props: {\n zoomTransitionSourceIdentifier: string;\n preventInteractiveDismissal?: boolean;\n}) {\n if (!LinkZoomTransitionEnablerNativeView) {\n return null;\n }\n return (\n <LinkZoomTransitionEnablerNativeView\n {...props}\n disableForceFlatten\n style={{ display: 'contents' }}\n />\n );\n}\n\ninterface LinkSourceAlignmentRect {\n x: number;\n y: number;\n width: number;\n height: number;\n}\n\nconst LinkZoomTransitionSourceNativeView: React.ComponentType<\n ViewProps & {\n identifier: string;\n disableForceFlatten?: boolean;\n alignment?: LinkSourceAlignmentRect;\n }\n> | null = areNativeViewsAvailable\n ? requireNativeView('ExpoRouterNativeLinkPreview', 'LinkZoomTransitionSource')\n : null;\nexport function LinkZoomTransitionSource(\n props: PropsWithChildren<{ identifier: string; alignment?: LinkSourceAlignmentRect }>\n) {\n if (!LinkZoomTransitionSourceNativeView) {\n return null;\n }\n return (\n <LinkZoomTransitionSourceNativeView\n {...props}\n disableForceFlatten\n style={{ display: 'contents' }}\n />\n );\n}\n// #endregion\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ZoomTransitionEnablerProps } from './ZoomTransitionEnabler.types';
|
|
2
|
+
export declare function enableZoomTransition(): void;
|
|
3
|
+
export declare function isZoomTransitionEnabled(): boolean;
|
|
4
|
+
export declare function ZoomTransitionEnabler(props: ZoomTransitionEnablerProps): null;
|
|
5
|
+
//# sourceMappingURL=ZoomTransitionEnabler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ZoomTransitionEnabler.d.ts","sourceRoot":"","sources":["../../../src/link/zoom/ZoomTransitionEnabler.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAEhF,wBAAgB,oBAAoB,SAAK;AAEzC,wBAAgB,uBAAuB,YAEtC;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,0BAA0B,QAEtE"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ZoomTransitionEnablerProps } from './ZoomTransitionEnabler.types';
|
|
2
|
+
export declare function enableZoomTransition(): void;
|
|
3
|
+
export declare function isZoomTransitionEnabled(): boolean;
|
|
4
|
+
export declare function ZoomTransitionEnabler({ route }: ZoomTransitionEnablerProps): import("react").JSX.Element | null;
|
|
5
|
+
//# sourceMappingURL=ZoomTransitionEnabler.ios.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ZoomTransitionEnabler.ios.d.ts","sourceRoot":"","sources":["../../../src/link/zoom/ZoomTransitionEnabler.ios.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAahF,wBAAgB,oBAAoB,SAGnC;AAED,wBAAgB,uBAAuB,YAEtC;AAED,wBAAgB,qBAAqB,CAAC,EAAE,KAAK,EAAE,EAAE,0BAA0B,sCAmC1E"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.enableZoomTransition = enableZoomTransition;
|
|
4
|
+
exports.isZoomTransitionEnabled = isZoomTransitionEnabled;
|
|
5
|
+
exports.ZoomTransitionEnabler = ZoomTransitionEnabler;
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const descriptors_context_1 = require("../../fork/native-stack/descriptors-context");
|
|
8
|
+
const navigationParams_1 = require("../../navigationParams");
|
|
9
|
+
const PreviewRouteContext_1 = require("../preview/PreviewRouteContext");
|
|
10
|
+
const native_1 = require("../preview/native");
|
|
11
|
+
let _isZoomTransitionEnabled = false;
|
|
12
|
+
function enableZoomTransition() {
|
|
13
|
+
console.warn('[expo-router] Zoom transition is an experimental feature. Use at your own risk.');
|
|
14
|
+
_isZoomTransitionEnabled = true;
|
|
15
|
+
}
|
|
16
|
+
function isZoomTransitionEnabled() {
|
|
17
|
+
return _isZoomTransitionEnabled;
|
|
18
|
+
}
|
|
19
|
+
function ZoomTransitionEnabler({ route }) {
|
|
20
|
+
const isPreview = (0, PreviewRouteContext_1.useIsPreview)();
|
|
21
|
+
if (isZoomTransitionEnabled() &&
|
|
22
|
+
!isPreview &&
|
|
23
|
+
route &&
|
|
24
|
+
typeof route === 'object' &&
|
|
25
|
+
'params' in route &&
|
|
26
|
+
typeof route.params === 'object' &&
|
|
27
|
+
'key' in route &&
|
|
28
|
+
typeof route.key === 'string') {
|
|
29
|
+
const params = route.params ?? {};
|
|
30
|
+
const internalParams = (0, navigationParams_1.getInternalExpoRouterParams)(params);
|
|
31
|
+
const zoomTransitionId = internalParams[navigationParams_1.INTERNAL_EXPO_ROUTER_ZOOM_TRANSITION_SOURCE_ID_PARAM_NAME];
|
|
32
|
+
const zoomTransitionScreenId = internalParams[navigationParams_1.INTERNAL_EXPO_ROUTER_ZOOM_TRANSITION_SCREEN_ID_PARAM_NAME];
|
|
33
|
+
const isLinkPreviewNavigation = !!internalParams[navigationParams_1.INTERNAL_EXPO_ROUTER_IS_PREVIEW_NAVIGATION_PARAM_NAME];
|
|
34
|
+
const hasZoomTransition = !!zoomTransitionId && zoomTransitionScreenId === route.key && !isLinkPreviewNavigation;
|
|
35
|
+
if (hasZoomTransition && typeof zoomTransitionId === 'string') {
|
|
36
|
+
const descriptorsMap = (0, react_1.use)(descriptors_context_1.DescriptorsContext);
|
|
37
|
+
const currentDescriptor = descriptorsMap[route.key];
|
|
38
|
+
const preventInteractiveDismissal = currentDescriptor?.options?.gestureEnabled === false;
|
|
39
|
+
return (<native_1.LinkZoomTransitionEnabler zoomTransitionSourceIdentifier={zoomTransitionId} preventInteractiveDismissal={preventInteractiveDismissal}/>);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=ZoomTransitionEnabler.ios.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ZoomTransitionEnabler.ios.js","sourceRoot":"","sources":["../../../src/link/zoom/ZoomTransitionEnabler.ios.tsx"],"names":[],"mappings":";;AAeA,oDAGC;AAED,0DAEC;AAED,sDAmCC;AA3DD,iCAA4B;AAG5B,qFAAiF;AACjF,6DAKgC;AAChC,wEAA8D;AAC9D,8CAA8D;AAE9D,IAAI,wBAAwB,GAAG,KAAK,CAAC;AAErC,SAAgB,oBAAoB;IAClC,OAAO,CAAC,IAAI,CAAC,iFAAiF,CAAC,CAAC;IAChG,wBAAwB,GAAG,IAAI,CAAC;AAClC,CAAC;AAED,SAAgB,uBAAuB;IACrC,OAAO,wBAAwB,CAAC;AAClC,CAAC;AAED,SAAgB,qBAAqB,CAAC,EAAE,KAAK,EAA8B;IACzE,MAAM,SAAS,GAAG,IAAA,kCAAY,GAAE,CAAC;IACjC,IACE,uBAAuB,EAAE;QACzB,CAAC,SAAS;QACV,KAAK;QACL,OAAO,KAAK,KAAK,QAAQ;QACzB,QAAQ,IAAI,KAAK;QACjB,OAAO,KAAK,CAAC,MAAM,KAAK,QAAQ;QAChC,KAAK,IAAI,KAAK;QACd,OAAO,KAAK,CAAC,GAAG,KAAK,QAAQ,EAC7B,CAAC;QACD,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,IAAI,EAAE,CAAC;QAClC,MAAM,cAAc,GAAG,IAAA,8CAA2B,EAAC,MAAM,CAAC,CAAC;QAC3D,MAAM,gBAAgB,GACpB,cAAc,CAAC,4EAAyD,CAAC,CAAC;QAC5E,MAAM,sBAAsB,GAC1B,cAAc,CAAC,4EAAyD,CAAC,CAAC;QAC5E,MAAM,uBAAuB,GAC3B,CAAC,CAAC,cAAc,CAAC,wEAAqD,CAAC,CAAC;QAC1E,MAAM,iBAAiB,GACrB,CAAC,CAAC,gBAAgB,IAAI,sBAAsB,KAAK,KAAK,CAAC,GAAG,IAAI,CAAC,uBAAuB,CAAC;QACzF,IAAI,iBAAiB,IAAI,OAAO,gBAAgB,KAAK,QAAQ,EAAE,CAAC;YAC9D,MAAM,cAAc,GAAG,IAAA,WAAG,EAAC,wCAAkB,CAAC,CAAC;YAC/C,MAAM,iBAAiB,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACpD,MAAM,2BAA2B,GAAG,iBAAiB,EAAE,OAAO,EAAE,cAAc,KAAK,KAAK,CAAC;YACzF,OAAO,CACL,CAAC,kCAAyB,CACxB,8BAA8B,CAAC,CAAC,gBAAgB,CAAC,CACjD,2BAA2B,CAAC,CAAC,2BAA2B,CAAC,EACzD,CACH,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { use } from 'react';\n\nimport type { ZoomTransitionEnablerProps } from './ZoomTransitionEnabler.types';\nimport { DescriptorsContext } from '../../fork/native-stack/descriptors-context';\nimport {\n getInternalExpoRouterParams,\n INTERNAL_EXPO_ROUTER_IS_PREVIEW_NAVIGATION_PARAM_NAME,\n INTERNAL_EXPO_ROUTER_ZOOM_TRANSITION_SCREEN_ID_PARAM_NAME,\n INTERNAL_EXPO_ROUTER_ZOOM_TRANSITION_SOURCE_ID_PARAM_NAME,\n} from '../../navigationParams';\nimport { useIsPreview } from '../preview/PreviewRouteContext';\nimport { LinkZoomTransitionEnabler } from '../preview/native';\n\nlet _isZoomTransitionEnabled = false;\n\nexport function enableZoomTransition() {\n console.warn('[expo-router] Zoom transition is an experimental feature. Use at your own risk.');\n _isZoomTransitionEnabled = true;\n}\n\nexport function isZoomTransitionEnabled() {\n return _isZoomTransitionEnabled;\n}\n\nexport function ZoomTransitionEnabler({ route }: ZoomTransitionEnablerProps) {\n const isPreview = useIsPreview();\n if (\n isZoomTransitionEnabled() &&\n !isPreview &&\n route &&\n typeof route === 'object' &&\n 'params' in route &&\n typeof route.params === 'object' &&\n 'key' in route &&\n typeof route.key === 'string'\n ) {\n const params = route.params ?? {};\n const internalParams = getInternalExpoRouterParams(params);\n const zoomTransitionId =\n internalParams[INTERNAL_EXPO_ROUTER_ZOOM_TRANSITION_SOURCE_ID_PARAM_NAME];\n const zoomTransitionScreenId =\n internalParams[INTERNAL_EXPO_ROUTER_ZOOM_TRANSITION_SCREEN_ID_PARAM_NAME];\n const isLinkPreviewNavigation =\n !!internalParams[INTERNAL_EXPO_ROUTER_IS_PREVIEW_NAVIGATION_PARAM_NAME];\n const hasZoomTransition =\n !!zoomTransitionId && zoomTransitionScreenId === route.key && !isLinkPreviewNavigation;\n if (hasZoomTransition && typeof zoomTransitionId === 'string') {\n const descriptorsMap = use(DescriptorsContext);\n const currentDescriptor = descriptorsMap[route.key];\n const preventInteractiveDismissal = currentDescriptor?.options?.gestureEnabled === false;\n return (\n <LinkZoomTransitionEnabler\n zoomTransitionSourceIdentifier={zoomTransitionId}\n preventInteractiveDismissal={preventInteractiveDismissal}\n />\n );\n }\n }\n return null;\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.enableZoomTransition = enableZoomTransition;
|
|
4
|
+
exports.isZoomTransitionEnabled = isZoomTransitionEnabled;
|
|
5
|
+
exports.ZoomTransitionEnabler = ZoomTransitionEnabler;
|
|
6
|
+
function enableZoomTransition() { }
|
|
7
|
+
function isZoomTransitionEnabled() {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
function ZoomTransitionEnabler(props) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=ZoomTransitionEnabler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ZoomTransitionEnabler.js","sourceRoot":"","sources":["../../../src/link/zoom/ZoomTransitionEnabler.tsx"],"names":[],"mappings":";;AAEA,oDAAyC;AAEzC,0DAEC;AAED,sDAEC;AARD,SAAgB,oBAAoB,KAAI,CAAC;AAEzC,SAAgB,uBAAuB;IACrC,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAgB,qBAAqB,CAAC,KAAiC;IACrE,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import type { ZoomTransitionEnablerProps } from './ZoomTransitionEnabler.types';\n\nexport function enableZoomTransition() {}\n\nexport function isZoomTransitionEnabled() {\n return false;\n}\n\nexport function ZoomTransitionEnabler(props: ZoomTransitionEnablerProps) {\n return null;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ZoomTransitionEnabler.types.d.ts","sourceRoot":"","sources":["../../../src/link/zoom/ZoomTransitionEnabler.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,0BAA0B;IACzC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ZoomTransitionEnabler.types.js","sourceRoot":"","sources":["../../../src/link/zoom/ZoomTransitionEnabler.types.ts"],"names":[],"mappings":"","sourcesContent":["export interface ZoomTransitionEnablerProps {\n route?: unknown;\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type PropsWithChildren } from 'react';
|
|
2
|
+
interface LinkAppleZoomProps extends PropsWithChildren {
|
|
3
|
+
/**
|
|
4
|
+
* Defines the rectangle used for the zoom transition's alignment. This rectangle is specified in the zoomed screen's coordinate space.
|
|
5
|
+
*
|
|
6
|
+
* @platform ios 18+
|
|
7
|
+
*/
|
|
8
|
+
alignmentRect?: {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* When this component is used inside a Link, [zoom transition](https://developer.apple.com/documentation/uikit/enhancing-your-app-with-fluid-transitions?language=objc)
|
|
17
|
+
* will be used when navigating to the link's href.
|
|
18
|
+
*
|
|
19
|
+
* @platform ios 18+
|
|
20
|
+
*/
|
|
21
|
+
export declare function LinkAppleZoom(props: LinkAppleZoomProps): import("react").JSX.Element;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=link-apple-zoom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link-apple-zoom.d.ts","sourceRoot":"","sources":["../../../src/link/zoom/link-apple-zoom.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA4B,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAOzE,UAAU,kBAAmB,SAAQ,iBAAiB;IACpD;;;;OAIG;IACH,aAAa,CAAC,EAAE;QACd,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;QACV,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,+BAKtD"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.LinkAppleZoom = LinkAppleZoom;
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const ZoomTransitionEnabler_ios_1 = require("./ZoomTransitionEnabler.ios");
|
|
7
|
+
const zoom_transition_context_1 = require("./zoom-transition-context");
|
|
8
|
+
const Slot_1 = require("../../ui/Slot");
|
|
9
|
+
const native_1 = require("../preview/native");
|
|
10
|
+
/**
|
|
11
|
+
* When this component is used inside a Link, [zoom transition](https://developer.apple.com/documentation/uikit/enhancing-your-app-with-fluid-transitions?language=objc)
|
|
12
|
+
* will be used when navigating to the link's href.
|
|
13
|
+
*
|
|
14
|
+
* @platform ios 18+
|
|
15
|
+
*/
|
|
16
|
+
function LinkAppleZoom(props) {
|
|
17
|
+
if (!(0, ZoomTransitionEnabler_ios_1.isZoomTransitionEnabled)()) {
|
|
18
|
+
return <Slot_1.Slot {...props}/>;
|
|
19
|
+
}
|
|
20
|
+
return <LinkAppleZoomImpl {...props}/>;
|
|
21
|
+
}
|
|
22
|
+
function LinkAppleZoomImpl({ children, alignmentRect, ...rest }) {
|
|
23
|
+
const value = (0, react_1.use)(zoom_transition_context_1.ZoomTransitionSourceContext);
|
|
24
|
+
if (!value) {
|
|
25
|
+
throw new Error('[expo-router] Link.ZoomTransitionSource must be used within a Link');
|
|
26
|
+
}
|
|
27
|
+
const { identifier, addSource, removeSource } = value;
|
|
28
|
+
(0, react_1.useEffect)(() => {
|
|
29
|
+
addSource();
|
|
30
|
+
return removeSource;
|
|
31
|
+
}, [addSource, removeSource]);
|
|
32
|
+
if (react_1.Children.count(children) > 1) {
|
|
33
|
+
console.warn('[expo-router] Link.ZoomTransitionSource only accepts a single child component. Please wrap multiple children in a View or another container component.');
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
return (<native_1.LinkZoomTransitionSource identifier={identifier} alignment={alignmentRect}>
|
|
37
|
+
<Slot_1.Slot {...rest}>{children}</Slot_1.Slot>
|
|
38
|
+
</native_1.LinkZoomTransitionSource>);
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=link-apple-zoom.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link-apple-zoom.js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AAA,EAAE,iCAAwB,CAAC,CAC5B,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n\nimport { Children, use, useEffect, type PropsWithChildren } from 'react';\n\nimport { isZoomTransitionEnabled } from './ZoomTransitionEnabler.ios';\nimport { ZoomTransitionSourceContext } from './zoom-transition-context';\nimport { Slot } from '../../ui/Slot';\nimport { LinkZoomTransitionSource } from '../preview/native';\n\ninterface LinkAppleZoomProps extends PropsWithChildren {\n /**\n * Defines the rectangle used for the zoom transition's alignment. This rectangle is specified in the zoomed screen's coordinate space.\n *\n * @platform ios 18+\n */\n alignmentRect?: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n}\n\n/**\n * When this component is used inside a Link, [zoom transition](https://developer.apple.com/documentation/uikit/enhancing-your-app-with-fluid-transitions?language=objc)\n * will be used when navigating to the link's href.\n *\n * @platform ios 18+\n */\nexport function LinkAppleZoom(props: LinkAppleZoomProps) {\n if (!isZoomTransitionEnabled()) {\n return <Slot {...props} />;\n }\n return <LinkAppleZoomImpl {...props} />;\n}\n\ntype LinkAppleZoomImplProps = LinkAppleZoomProps & {\n onPress?: () => void;\n};\n\nfunction LinkAppleZoomImpl({ children, alignmentRect, ...rest }: LinkAppleZoomImplProps) {\n const value = use(ZoomTransitionSourceContext);\n if (!value) {\n throw new Error('[expo-router] Link.ZoomTransitionSource must be used within a Link');\n }\n const { identifier, addSource, removeSource } = value;\n\n useEffect(() => {\n addSource();\n return removeSource;\n }, [addSource, removeSource]);\n\n if (Children.count(children) > 1) {\n console.warn(\n '[expo-router] Link.ZoomTransitionSource only accepts a single child component. Please wrap multiple children in a View or another container component.'\n );\n return null;\n }\n\n return (\n <LinkZoomTransitionSource identifier={identifier} alignment={alignmentRect}>\n <Slot {...rest}>{children}</Slot>\n </LinkZoomTransitionSource>\n );\n}\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { LinkProps } from '../useLinkHooks';
|
|
2
|
+
export declare function useZoomTransitionPrimitives({ href }: LinkProps): {
|
|
3
|
+
zoomTransitionSourceContextValue: undefined;
|
|
4
|
+
href: string | import("../..").HrefObject;
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=useZoomTransitionPrimitives.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useZoomTransitionPrimitives.d.ts","sourceRoot":"","sources":["../../../src/link/zoom/useZoomTransitionPrimitives.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C,wBAAgB,2BAA2B,CAAC,EAAE,IAAI,EAAE,EAAE,SAAS;;;EAG9D"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { LinkProps } from '../useLinkHooks';
|
|
2
|
+
export declare function useZoomTransitionPrimitives({ href, asChild }: LinkProps): {
|
|
3
|
+
zoomTransitionSourceContextValue: {
|
|
4
|
+
identifier: string;
|
|
5
|
+
addSource: () => void;
|
|
6
|
+
removeSource: () => void;
|
|
7
|
+
canAddSource: boolean;
|
|
8
|
+
} | undefined;
|
|
9
|
+
href: string | import("../..").HrefObject;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=useZoomTransitionPrimitives.ios.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useZoomTransitionPrimitives.ios.d.ts","sourceRoot":"","sources":["../../../src/link/zoom/useZoomTransitionPrimitives.ios.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,wBAAgB,2BAA2B,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,SAAS;;;;;;;;EAqEvE"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.useZoomTransitionPrimitives = useZoomTransitionPrimitives;
|
|
5
|
+
const non_secure_1 = require("nanoid/non-secure");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const ZoomTransitionEnabler_1 = require("./ZoomTransitionEnabler");
|
|
8
|
+
const navigationParams_1 = require("../../navigationParams");
|
|
9
|
+
const PreviewRouteContext_1 = require("../preview/PreviewRouteContext");
|
|
10
|
+
function useZoomTransitionPrimitives({ href, asChild }) {
|
|
11
|
+
const isPreview = (0, PreviewRouteContext_1.useIsPreview)();
|
|
12
|
+
const zoomTransitionId = (0, react_1.useMemo)(() => !isPreview && process.env.EXPO_OS === 'ios' && (0, ZoomTransitionEnabler_1.isZoomTransitionEnabled)()
|
|
13
|
+
? (0, non_secure_1.nanoid)()
|
|
14
|
+
: undefined, []);
|
|
15
|
+
const [numberOfSources, setNumberOfSources] = (0, react_1.useState)(0);
|
|
16
|
+
const addSource = (0, react_1.useCallback)(() => {
|
|
17
|
+
setNumberOfSources((prev) => prev + 1);
|
|
18
|
+
}, []);
|
|
19
|
+
const removeSource = (0, react_1.useCallback)(() => {
|
|
20
|
+
setNumberOfSources((prev) => prev - 1);
|
|
21
|
+
}, []);
|
|
22
|
+
const hasZoomSource = numberOfSources > 0;
|
|
23
|
+
(0, react_1.useEffect)(() => {
|
|
24
|
+
if (numberOfSources > 1) {
|
|
25
|
+
throw new Error('[expo-router] Only one Link.ZoomTransitionSource can be used within a single Link component.');
|
|
26
|
+
}
|
|
27
|
+
}, [numberOfSources]);
|
|
28
|
+
(0, react_1.useEffect)(() => {
|
|
29
|
+
if (hasZoomSource && !asChild) {
|
|
30
|
+
console.warn('[expo-router] Using zoom transition links without `asChild` prop may lead to unexpected behavior. Please ensure to set `asChild` when using zoom transitions.');
|
|
31
|
+
}
|
|
32
|
+
}, [hasZoomSource, asChild]);
|
|
33
|
+
const zoomTransitionSourceContextValue = (0, react_1.useMemo)(() => {
|
|
34
|
+
if (!zoomTransitionId) {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
identifier: zoomTransitionId,
|
|
39
|
+
addSource,
|
|
40
|
+
removeSource,
|
|
41
|
+
canAddSource: !hasZoomSource,
|
|
42
|
+
};
|
|
43
|
+
}, [zoomTransitionId, addSource, removeSource, hasZoomSource]);
|
|
44
|
+
const computedHref = (0, react_1.useMemo)(() => {
|
|
45
|
+
if (!hasZoomSource || !zoomTransitionId) {
|
|
46
|
+
return href;
|
|
47
|
+
}
|
|
48
|
+
if (typeof href === 'string') {
|
|
49
|
+
return {
|
|
50
|
+
pathname: href,
|
|
51
|
+
params: {
|
|
52
|
+
[navigationParams_1.INTERNAL_EXPO_ROUTER_ZOOM_TRANSITION_SOURCE_ID_PARAM_NAME]: zoomTransitionId,
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
pathname: href.pathname,
|
|
58
|
+
params: {
|
|
59
|
+
...(href.params ?? {}),
|
|
60
|
+
[navigationParams_1.INTERNAL_EXPO_ROUTER_ZOOM_TRANSITION_SOURCE_ID_PARAM_NAME]: zoomTransitionId,
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
}, [href, zoomTransitionId, hasZoomSource]);
|
|
64
|
+
return { zoomTransitionSourceContextValue, href: computedHref };
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=useZoomTransitionPrimitives.ios.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useZoomTransitionPrimitives.ios.js","sourceRoot":"","sources":["../../../src/link/zoom/useZoomTransitionPrimitives.ios.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AAUb,kEAqEC;AA7ED,kDAA2C;AAC3C,iCAAkE;AAElE,mEAAkE;AAClE,6DAAmG;AACnG,wEAA8D;AAG9D,SAAgB,2BAA2B,CAAC,EAAE,IAAI,EAAE,OAAO,EAAa;IACtE,MAAM,SAAS,GAAG,IAAA,kCAAY,GAAE,CAAC;IACjC,MAAM,gBAAgB,GAAG,IAAA,eAAO,EAC9B,GAAG,EAAE,CACH,CAAC,SAAS,IA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AY,EAAE,CAAC,aAAa;SAC7B,CAAC;IACJ,CAAC,EAAE,CAAC,gBAAgB,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,CAAC,CAAC,CAAC;IAE/D,MAAM,YAAY,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE;QAChC,IAAI,CAAC,aAAa,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACxC,OAAO,IAAI,CAAC;QACd,CAAC;QACD,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC7B,OAAO;gBACL,QAAQ,EAAE,IAAI;gBACd,MAAM,EAAE;oBACN,CAAC,4EAAyD,CAAC,EAAE,gBAAgB;iBAC9E;aACF,CAAC;QACJ,CAAC;QACD,OAAO;YACL,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,MAAM,EAAE;gBACN,GAAG,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC;gBACtB,CAAC,4EAAyD,CAAC,EAAE,gBAAgB;aAC9E;SACF,CAAC;IACJ,CAAC,EAAE,CAAC,IAAI,EAAE,gBAAgB,EAAE,aAAa,CAAC,CAAC,CAAC;IAC5C,OAAO,EAAE,gCAAgC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;AAClE,CAAC","sourcesContent":["'use client';\n\nimport { nanoid } from 'nanoid/non-secure';\nimport { useCallback, useEffect, useMemo, useState } from 'react';\n\nimport { isZoomTransitionEnabled } from './ZoomTransitionEnabler';\nimport { INTERNAL_EXPO_ROUTER_ZOOM_TRANSITION_SOURCE_ID_PARAM_NAME } from '../../navigationParams';\nimport { useIsPreview } from '../preview/PreviewRouteContext';\nimport { LinkProps } from '../useLinkHooks';\n\nexport function useZoomTransitionPrimitives({ href, asChild }: LinkProps) {\n const isPreview = useIsPreview();\n const zoomTransitionId = useMemo(\n () =>\n !isPreview && process.env.EXPO_OS === 'ios' && isZoomTransitionEnabled()\n ? nanoid()\n : undefined,\n []\n );\n\n const [numberOfSources, setNumberOfSources] = useState(0);\n const addSource = useCallback(() => {\n setNumberOfSources((prev) => prev + 1);\n }, []);\n const removeSource = useCallback(() => {\n setNumberOfSources((prev) => prev - 1);\n }, []);\n\n const hasZoomSource = numberOfSources > 0;\n\n useEffect(() => {\n if (numberOfSources > 1) {\n throw new Error(\n '[expo-router] Only one Link.ZoomTransitionSource can be used within a single Link component.'\n );\n }\n }, [numberOfSources]);\n\n useEffect(() => {\n if (hasZoomSource && !asChild) {\n console.warn(\n '[expo-router] Using zoom transition links without `asChild` prop may lead to unexpected behavior. Please ensure to set `asChild` when using zoom transitions.'\n );\n }\n }, [hasZoomSource, asChild]);\n\n const zoomTransitionSourceContextValue = useMemo(() => {\n if (!zoomTransitionId) {\n return undefined;\n }\n return {\n identifier: zoomTransitionId,\n addSource,\n removeSource,\n canAddSource: !hasZoomSource,\n };\n }, [zoomTransitionId, addSource, removeSource, hasZoomSource]);\n\n const computedHref = useMemo(() => {\n if (!hasZoomSource || !zoomTransitionId) {\n return href;\n }\n if (typeof href === 'string') {\n return {\n pathname: href,\n params: {\n [INTERNAL_EXPO_ROUTER_ZOOM_TRANSITION_SOURCE_ID_PARAM_NAME]: zoomTransitionId,\n },\n };\n }\n return {\n pathname: href.pathname,\n params: {\n ...(href.params ?? {}),\n [INTERNAL_EXPO_ROUTER_ZOOM_TRANSITION_SOURCE_ID_PARAM_NAME]: zoomTransitionId,\n },\n };\n }, [href, zoomTransitionId, hasZoomSource]);\n return { zoomTransitionSourceContextValue, href: computedHref };\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.useZoomTransitionPrimitives = useZoomTransitionPrimitives;
|
|
5
|
+
function useZoomTransitionPrimitives({ href }) {
|
|
6
|
+
const zoomTransitionSourceContextValue = undefined;
|
|
7
|
+
return { zoomTransitionSourceContextValue, href };
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=useZoomTransitionPrimitives.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useZoomTransitionPrimitives.js","sourceRoot":"","sources":["../../../src/link/zoom/useZoomTransitionPrimitives.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AAKb,kEAGC;AAHD,SAAgB,2BAA2B,CAAC,EAAE,IAAI,EAAa;IAC7D,MAAM,gCAAgC,GAAyC,SAAS,CAAC;IACzF,OAAO,EAAE,gCAAgC,EAAE,IAAI,EAAE,CAAC;AACpD,CAAC","sourcesContent":["'use client';\n\nimport { LinkProps } from '../useLinkHooks';\nimport type { ZoomTransitionSourceContextValueType } from './zoom-transition-context';\n\nexport function useZoomTransitionPrimitives({ href }: LinkProps) {\n const zoomTransitionSourceContextValue: ZoomTransitionSourceContextValueType = undefined;\n return { zoomTransitionSourceContextValue, href };\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type ZoomTransitionSourceContextValueType = {
|
|
2
|
+
identifier: string;
|
|
3
|
+
addSource: () => void;
|
|
4
|
+
removeSource: () => void;
|
|
5
|
+
} | undefined;
|
|
6
|
+
export declare const ZoomTransitionSourceContext: import("react").Context<ZoomTransitionSourceContextValueType>;
|
|
7
|
+
//# sourceMappingURL=zoom-transition-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zoom-transition-context.d.ts","sourceRoot":"","sources":["../../../src/link/zoom/zoom-transition-context.tsx"],"names":[],"mappings":"AAEA,MAAM,MAAM,oCAAoC,GAC5C;IACE,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,YAAY,EAAE,MAAM,IAAI,CAAC;CAC1B,GACD,SAAS,CAAC;AAEd,eAAO,MAAM,2BAA2B,+DACwB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ZoomTransitionSourceContext = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
exports.ZoomTransitionSourceContext = (0, react_1.createContext)(undefined);
|
|
6
|
+
//# sourceMappingURL=zoom-transition-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zoom-transition-context.js","sourceRoot":"","sources":["../../../src/link/zoom/zoom-transition-context.tsx"],"names":[],"mappings":";;;AAAA,iCAAsC;AAUzB,QAAA,2BAA2B,GACtC,IAAA,qBAAa,EAAuC,SAAS,CAAC,CAAC","sourcesContent":["import { createContext } from 'react';\n\nexport type ZoomTransitionSourceContextValueType =\n | {\n identifier: string;\n addSource: () => void;\n removeSource: () => void;\n }\n | undefined;\n\nexport const ZoomTransitionSourceContext =\n createContext<ZoomTransitionSourceContextValueType>(undefined);\n"]}
|
|
@@ -1,18 +1,6 @@
|
|
|
1
|
-
import { ParamListBase, type EventMapBase } from '@react-navigation/native';
|
|
2
1
|
import React from 'react';
|
|
3
|
-
import type {
|
|
2
|
+
import type { InternalNativeTabsProps, NativeTabsProps } from './types';
|
|
4
3
|
export declare const NativeTabsContext: React.Context<boolean>;
|
|
5
|
-
export declare function NativeTabsNavigator({ children, backBehavior, labelStyle, iconColor, blurEffect, backgroundColor, badgeBackgroundColor, indicatorColor, badgeTextColor, ...rest }:
|
|
6
|
-
export declare
|
|
7
|
-
Screen: (props: import("..").ScreenProps<NativeTabOptions, Readonly<{
|
|
8
|
-
key: string;
|
|
9
|
-
index: number;
|
|
10
|
-
routeNames: string[];
|
|
11
|
-
history?: unknown[];
|
|
12
|
-
routes: import("@react-navigation/native").NavigationRoute<ParamListBase, string>[];
|
|
13
|
-
type: string;
|
|
14
|
-
stale: false;
|
|
15
|
-
}>, EventMapBase>) => null;
|
|
16
|
-
Protected: typeof import("../views/Protected").Protected;
|
|
17
|
-
};
|
|
4
|
+
export declare function NativeTabsNavigator({ children, backBehavior, labelStyle, iconColor, blurEffect, backgroundColor, badgeBackgroundColor, indicatorColor, badgeTextColor, ...rest }: InternalNativeTabsProps): React.JSX.Element;
|
|
5
|
+
export declare function NativeTabsNavigatorWrapper(props: NativeTabsProps): React.JSX.Element;
|
|
18
6
|
//# sourceMappingURL=NativeBottomTabsNavigator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeBottomTabsNavigator.d.ts","sourceRoot":"","sources":["../../src/native-tabs/NativeBottomTabsNavigator.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NativeBottomTabsNavigator.d.ts","sourceRoot":"","sources":["../../src/native-tabs/NativeBottomTabsNavigator.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAKzD,OAAO,KAAK,EACV,uBAAuB,EAEvB,eAAe,EAEhB,MAAM,SAAS,CAAC;AAQjB,eAAO,MAAM,iBAAiB,wBAAsC,CAAC;AAErE,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,YAAkC,EAClC,UAAU,EACV,SAAS,EACT,UAAU,EACV,eAAe,EACf,oBAAoB,EACpB,cAAc,EACd,cAAc,EACd,GAAG,IAAI,EACR,EAAE,uBAAuB,qBA4GzB;AAWD,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,eAAe,qBAiBhE"}
|
|
@@ -34,15 +34,18 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
};
|
|
35
35
|
})();
|
|
36
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
-
exports.
|
|
37
|
+
exports.NativeTabsContext = void 0;
|
|
38
38
|
exports.NativeTabsNavigator = NativeTabsNavigator;
|
|
39
|
+
exports.NativeTabsNavigatorWrapper = NativeTabsNavigatorWrapper;
|
|
39
40
|
const native_1 = require("@react-navigation/native");
|
|
40
41
|
const react_1 = __importStar(require("react"));
|
|
41
42
|
const NativeBottomTabsRouter_1 = require("./NativeBottomTabsRouter");
|
|
43
|
+
const NativeTabTrigger_1 = require("./NativeTabTrigger");
|
|
42
44
|
const NativeTabsView_1 = require("./NativeTabsView");
|
|
43
45
|
const utils_1 = require("./utils");
|
|
44
46
|
const withLayoutContext_1 = require("../layouts/withLayoutContext");
|
|
45
47
|
const linking_1 = require("../link/linking");
|
|
48
|
+
const children_1 = require("../utils/children");
|
|
46
49
|
// In Jetpack Compose, the default back behavior is to go back to the initial route.
|
|
47
50
|
const defaultBackBehavior = 'initialRoute';
|
|
48
51
|
exports.NativeTabsContext = react_1.default.createContext(false);
|
|
@@ -119,5 +122,10 @@ function NativeTabsNavigator({ children, backBehavior = defaultBackBehavior, lab
|
|
|
119
122
|
</NavigationContent>);
|
|
120
123
|
}
|
|
121
124
|
const createNativeTabNavigator = (0, native_1.createNavigatorFactory)(NativeTabsNavigator);
|
|
122
|
-
|
|
125
|
+
const NativeTabsNavigatorWithContext = (0, withLayoutContext_1.withLayoutContext)(createNativeTabNavigator().Navigator, undefined, true);
|
|
126
|
+
function NativeTabsNavigatorWrapper(props) {
|
|
127
|
+
const triggerChildren = (0, react_1.useMemo)(() => (0, children_1.getAllChildrenOfType)(props.children, NativeTabTrigger_1.NativeTabTrigger), [props.children]);
|
|
128
|
+
const nonTriggerChildren = (0, react_1.useMemo)(() => (0, children_1.getAllChildrenNotOfType)(props.children, NativeTabTrigger_1.NativeTabTrigger), [props.children]);
|
|
129
|
+
return (<NativeTabsNavigatorWithContext {...props} children={triggerChildren} nonTriggerChildren={nonTriggerChildren}/>);
|
|
130
|
+
}
|
|
123
131
|
//# sourceMappingURL=NativeBottomTabsNavigator.js.map
|