one 1.2.47 → 1.2.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Root.js +6 -1
- package/dist/cjs/Root.js.map +1 -1
- package/dist/cjs/Root.native.js.map +1 -1
- package/dist/cjs/babel-plugins/one-router-metro.js +4 -1
- package/dist/cjs/babel-plugins/one-router-metro.js.map +1 -1
- package/dist/cjs/babel-plugins/one-router-metro.native.js.map +1 -1
- package/dist/cjs/babel-plugins/remove-server-code.js +3 -1
- package/dist/cjs/babel-plugins/remove-server-code.js.map +1 -1
- package/dist/cjs/babel-plugins/remove-server-code.native.js.map +1 -1
- package/dist/cjs/cli/build.js +31 -8
- package/dist/cjs/cli/build.js.map +1 -1
- package/dist/cjs/cli/build.native.js.map +1 -1
- package/dist/cjs/cli/buildPage.js +14 -4
- package/dist/cjs/cli/buildPage.js.map +1 -1
- package/dist/cjs/cli/buildPage.native.js.map +1 -1
- package/dist/cjs/cli/generateRoutes.js +3 -1
- package/dist/cjs/cli/generateRoutes.js.map +1 -1
- package/dist/cjs/cli/generateRoutes.native.js.map +1 -1
- package/dist/cjs/cli/generateSitemap.js.map +1 -1
- package/dist/cjs/cli/generateSitemap.native.js.map +1 -1
- package/dist/cjs/cli/generateSitemap.test.js +14 -4
- package/dist/cjs/cli/generateSitemap.test.js.map +1 -1
- package/dist/cjs/cli/generateSitemap.test.native.js.map +1 -1
- package/dist/cjs/cli/main.js +4 -2
- package/dist/cjs/cli/main.js.map +1 -1
- package/dist/cjs/cli/main.native.js.map +1 -1
- package/dist/cjs/cli/prebuild.js.map +1 -1
- package/dist/cjs/cli/prebuild.native.js.map +1 -1
- package/dist/cjs/clientLoaderResolver.js.map +1 -1
- package/dist/cjs/clientLoaderResolver.native.js.map +1 -1
- package/dist/cjs/config.js +3 -1
- package/dist/cjs/config.js.map +1 -1
- package/dist/cjs/config.native.js.map +1 -1
- package/dist/cjs/constants.js.map +1 -1
- package/dist/cjs/constants.native.js.map +1 -1
- package/dist/cjs/createApp.js +9 -1
- package/dist/cjs/createApp.js.map +1 -1
- package/dist/cjs/createHandleRequest.js +9 -3
- package/dist/cjs/createHandleRequest.js.map +1 -1
- package/dist/cjs/createHandleRequest.native.js.map +1 -1
- package/dist/cjs/fork/__tests__/getPathFromState.test.js +90 -88
- package/dist/cjs/fork/__tests__/getPathFromState.test.js.map +1 -1
- package/dist/cjs/fork/__tests__/getPathFromState.test.native.js.map +1 -1
- package/dist/cjs/fork/__tests__/getStateFromPath.test.js +163 -86
- package/dist/cjs/fork/__tests__/getStateFromPath.test.js.map +1 -1
- package/dist/cjs/fork/__tests__/getStateFromPath.test.native.js.map +1 -1
- package/dist/cjs/fork/_shared.js.map +1 -1
- package/dist/cjs/fork/_shared.native.js.map +1 -1
- package/dist/cjs/fork/extractPathFromURL.js.map +1 -1
- package/dist/cjs/fork/extractPathFromURL.native.js.map +1 -1
- package/dist/cjs/fork/getPathFromState-mods.js +4 -1
- package/dist/cjs/fork/getPathFromState-mods.js.map +1 -1
- package/dist/cjs/fork/getPathFromState-mods.native.js.map +1 -1
- package/dist/cjs/fork/getPathFromState.js +3 -1
- package/dist/cjs/fork/getPathFromState.js.map +1 -1
- package/dist/cjs/fork/getPathFromState.native.js.map +1 -1
- package/dist/cjs/fork/getStateFromPath-mods.js.map +1 -1
- package/dist/cjs/fork/getStateFromPath-mods.native.js.map +1 -1
- package/dist/cjs/fork/getStateFromPath.js +7 -1
- package/dist/cjs/fork/getStateFromPath.js.map +1 -1
- package/dist/cjs/fork/getStateFromPath.native.js.map +1 -1
- package/dist/cjs/fork/getStateFromPath.test.js +21 -8
- package/dist/cjs/fork/getStateFromPath.test.js.map +1 -1
- package/dist/cjs/fork/getStateFromPath.test.native.js.map +1 -1
- package/dist/cjs/fork/useBackButton.js.map +1 -1
- package/dist/cjs/fork/useDocumentTitle.js +4 -1
- package/dist/cjs/fork/useDocumentTitle.js.map +1 -1
- package/dist/cjs/fork/useLinking.js +4 -1
- package/dist/cjs/fork/useLinking.js.map +1 -1
- package/dist/cjs/fork/validatePathConfig.js.map +1 -1
- package/dist/cjs/fork/validatePathConfig.native.js.map +1 -1
- package/dist/cjs/hooks.js.map +1 -1
- package/dist/cjs/hooks.native.js.map +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/layouts/Tabs.js.map +1 -1
- package/dist/cjs/layouts/Tabs.native.js.map +1 -1
- package/dist/cjs/layouts/withLayoutContext.js +10 -8
- package/dist/cjs/layouts/withLayoutContext.js.map +1 -1
- package/dist/cjs/layouts/withLayoutContext.native.js.map +1 -1
- package/dist/cjs/link/Link.js.map +1 -1
- package/dist/cjs/link/Link.native.js.map +1 -1
- package/dist/cjs/link/linking.js +3 -1
- package/dist/cjs/link/linking.js.map +1 -1
- package/dist/cjs/link/linking.native.js.map +1 -1
- package/dist/cjs/link/useLinkTo.js.map +1 -1
- package/dist/cjs/link/useLinkTo.native.js.map +1 -1
- package/dist/cjs/link/useLoadedNavigation.js.map +1 -1
- package/dist/cjs/link/useLoadedNavigation.native.js.map +1 -1
- package/dist/cjs/metro-config/getViteMetroPluginOptions.cjs +6 -8
- package/dist/cjs/metro-config/getViteMetroPluginOptions.js +8 -10
- package/dist/cjs/metro-config/getViteMetroPluginOptions.js.map +1 -1
- package/dist/cjs/metro-config/getViteMetroPluginOptions.native.js +9 -11
- package/dist/cjs/metro-config/getViteMetroPluginOptions.native.js.map +1 -1
- package/dist/cjs/router/Route.js.map +1 -1
- package/dist/cjs/router/Route.native.js.map +1 -1
- package/dist/cjs/router/RouteInfoContext.js +7 -1
- package/dist/cjs/router/RouteInfoContext.js.map +1 -1
- package/dist/cjs/router/RouteInfoContext.native.js.map +1 -1
- package/dist/cjs/router/filterRootHTML.js.map +1 -1
- package/dist/cjs/router/filterRootHTML.native.js.map +1 -1
- package/dist/cjs/router/getLinkingConfig.js.map +1 -1
- package/dist/cjs/router/getLinkingConfig.native.js.map +1 -1
- package/dist/cjs/router/getNormalizedStatePath.js.map +1 -1
- package/dist/cjs/router/getNormalizedStatePath.native.js.map +1 -1
- package/dist/cjs/router/getRoutes.js +3 -1
- package/dist/cjs/router/getRoutes.js.map +1 -1
- package/dist/cjs/router/getRoutes.native.js.map +1 -1
- package/dist/cjs/router/linkingConfig.js.map +1 -1
- package/dist/cjs/router/linkingConfig.native.js.map +1 -1
- package/dist/cjs/router/matchers.cjs +1 -1
- package/dist/cjs/router/matchers.js +1 -1
- package/dist/cjs/router/matchers.js.map +1 -1
- package/dist/cjs/router/matchers.native.js +1 -1
- package/dist/cjs/router/matchers.native.js.map +1 -1
- package/dist/cjs/router/matchers.test.js +6 -2
- package/dist/cjs/router/matchers.test.js.map +1 -1
- package/dist/cjs/router/matchers.test.native.js.map +1 -1
- package/dist/cjs/router/router.js +13 -3
- package/dist/cjs/router/router.js.map +1 -1
- package/dist/cjs/router/router.native.js.map +1 -1
- package/dist/cjs/router/useNavigation.js.map +1 -1
- package/dist/cjs/router/useNavigation.native.js.map +1 -1
- package/dist/cjs/router/useScreens.js +13 -11
- package/dist/cjs/router/useScreens.js.map +1 -1
- package/dist/cjs/router/useScreens.native.js.map +1 -1
- package/dist/cjs/router/useViteRoutes.js.map +1 -1
- package/dist/cjs/router/useViteRoutes.native.js.map +1 -1
- package/dist/cjs/router/utils/getNavigateAction.js.map +1 -1
- package/dist/cjs/router/utils/getNavigateAction.native.js.map +1 -1
- package/dist/cjs/server/createRoutesManifest.js.map +1 -1
- package/dist/cjs/server/createRoutesManifest.native.js.map +1 -1
- package/dist/cjs/server/getServerManifest.js +3 -1
- package/dist/cjs/server/getServerManifest.js.map +1 -1
- package/dist/cjs/server/getServerManifest.native.js.map +1 -1
- package/dist/cjs/server/oneServe.js +9 -2
- package/dist/cjs/server/oneServe.js.map +1 -1
- package/dist/cjs/server/oneServe.native.js.map +1 -1
- package/dist/cjs/server/setupBuildOptions.js.map +1 -1
- package/dist/cjs/server/setupBuildOptions.native.js.map +1 -1
- package/dist/cjs/server/staticHtmlFetcher.js.map +1 -1
- package/dist/cjs/server/staticHtmlFetcher.native.js.map +1 -1
- package/dist/cjs/server-render.js.map +1 -1
- package/dist/cjs/server-render.native.js.map +1 -1
- package/dist/cjs/typed-routes/getTypedRoutesDeclarationFile.js +14 -2
- package/dist/cjs/typed-routes/getTypedRoutesDeclarationFile.js.map +1 -1
- package/dist/cjs/typed-routes/getTypedRoutesDeclarationFile.native.js.map +1 -1
- package/dist/cjs/typed-routes/injectRouteHelpers.js +4 -1
- package/dist/cjs/typed-routes/injectRouteHelpers.js.map +1 -1
- package/dist/cjs/typed-routes/injectRouteHelpers.native.js.map +1 -1
- package/dist/cjs/ui/Slot.js.map +1 -1
- package/dist/cjs/ui/Slot.native.js.map +1 -1
- package/dist/cjs/ui/TabContext.js +3 -1
- package/dist/cjs/ui/TabContext.js.map +1 -1
- package/dist/cjs/ui/TabContext.native.js.map +1 -1
- package/dist/cjs/ui/TabRouter.js.map +1 -1
- package/dist/cjs/ui/TabRouter.native.js.map +1 -1
- package/dist/cjs/ui/TabTrigger.js +17 -2
- package/dist/cjs/ui/TabTrigger.js.map +1 -1
- package/dist/cjs/ui/TabTrigger.native.js.map +1 -1
- package/dist/cjs/ui/Tabs.js +5 -1
- package/dist/cjs/ui/Tabs.js.map +1 -1
- package/dist/cjs/ui/Tabs.native.js.map +1 -1
- package/dist/cjs/ui/common.js +3 -1
- package/dist/cjs/ui/common.js.map +1 -1
- package/dist/cjs/ui/common.native.js.map +1 -1
- package/dist/cjs/useLoader.js +4 -1
- package/dist/cjs/useLoader.js.map +1 -1
- package/dist/cjs/useLoader.native.js.map +1 -1
- package/dist/cjs/utils/cleanUrl.js.map +1 -1
- package/dist/cjs/utils/cleanUrl.native.js.map +1 -1
- package/dist/cjs/utils/url.js +3 -1
- package/dist/cjs/utils/url.js.map +1 -1
- package/dist/cjs/utils/url.native.js.map +1 -1
- package/dist/cjs/vercel/build/buildVercelOutputDirectory.js +29 -10
- package/dist/cjs/vercel/build/buildVercelOutputDirectory.js.map +1 -1
- package/dist/cjs/vercel/build/buildVercelOutputDirectory.native.js.map +1 -1
- package/dist/cjs/vercel/build/generate/createApiServerlessFunction.js +11 -3
- package/dist/cjs/vercel/build/generate/createApiServerlessFunction.js.map +1 -1
- package/dist/cjs/vercel/build/generate/createApiServerlessFunction.native.js.map +1 -1
- package/dist/cjs/vercel/build/generate/createSsrServerlessFunction.js +9 -2
- package/dist/cjs/vercel/build/generate/createSsrServerlessFunction.js.map +1 -1
- package/dist/cjs/vercel/build/generate/createSsrServerlessFunction.native.js.map +1 -1
- package/dist/cjs/vercel/build/getPathFromRoute.js +4 -1
- package/dist/cjs/vercel/build/getPathFromRoute.js.map +1 -1
- package/dist/cjs/vercel/build/getPathFromRoute.native.js.map +1 -1
- package/dist/cjs/views/Navigator.js +16 -8
- package/dist/cjs/views/Navigator.js.map +1 -1
- package/dist/cjs/views/Navigator.native.js.map +1 -1
- package/dist/cjs/views/RootErrorBoundary.js +4 -2
- package/dist/cjs/views/RootErrorBoundary.js.map +1 -1
- package/dist/cjs/views/RootErrorBoundary.native.js.map +1 -1
- package/dist/cjs/views/Screen.js +4 -1
- package/dist/cjs/views/Screen.js.map +1 -1
- package/dist/cjs/views/Screen.native.js.map +1 -1
- package/dist/cjs/vite/loadConfig.js +6 -2
- package/dist/cjs/vite/loadConfig.js.map +1 -1
- package/dist/cjs/vite/loadConfig.native.js.map +1 -1
- package/dist/cjs/vite/one-server-only.js +3 -1
- package/dist/cjs/vite/one-server-only.js.map +1 -1
- package/dist/cjs/vite/one.js +9 -3
- package/dist/cjs/vite/one.js.map +1 -1
- package/dist/cjs/vite/one.native.js.map +1 -1
- package/dist/cjs/vite/plugins/SSRCSSPlugin.js +5 -1
- package/dist/cjs/vite/plugins/SSRCSSPlugin.js.map +1 -1
- package/dist/cjs/vite/plugins/SSRCSSPlugin.native.js.map +1 -1
- package/dist/cjs/vite/plugins/clientTreeShakePlugin.js +8 -2
- package/dist/cjs/vite/plugins/clientTreeShakePlugin.js.map +1 -1
- package/dist/cjs/vite/plugins/clientTreeShakePlugin.native.js.map +1 -1
- package/dist/cjs/vite/plugins/fileSystemRouterPlugin.js +11 -4
- package/dist/cjs/vite/plugins/fileSystemRouterPlugin.js.map +1 -1
- package/dist/cjs/vite/plugins/fileSystemRouterPlugin.native.js.map +1 -1
- package/dist/cjs/vite/plugins/generateFileSystemRouteTypesPlugin.js.map +1 -1
- package/dist/cjs/vite/plugins/generateFileSystemRouteTypesPlugin.native.js.map +1 -1
- package/dist/cjs/vite/plugins/removeReactNativeWebAnimatedPlugin.js.map +1 -1
- package/dist/cjs/vite/plugins/removeReactNativeWebAnimatedPlugin.native.js.map +1 -1
- package/dist/cjs/vite/plugins/virtualEntryPlugin.js +13 -3
- package/dist/cjs/vite/plugins/virtualEntryPlugin.js.map +1 -1
- package/dist/cjs/vite/plugins/virtualEntryPlugin.native.js.map +1 -1
- package/dist/cjs/vite/replaceLoader.js +4 -1
- package/dist/cjs/vite/replaceLoader.js.map +1 -1
- package/dist/cjs/vite/replaceLoader.native.js.map +1 -1
- package/dist/cjs/vite/resolveResponse.js.map +1 -1
- package/dist/cjs/vite/resolveResponse.native.js.map +1 -1
- package/dist/cjs/zero/subscribeToQuery.js.map +1 -1
- package/dist/cjs/zero/subscribeToQuery.native.js.map +1 -1
- package/dist/cjs/zero/useQueryZero.js +3 -1
- package/dist/cjs/zero/useQueryZero.js.map +1 -1
- package/dist/cjs/zero/useQueryZero.native.js.map +1 -1
- package/dist/esm/Root.js +6 -1
- package/dist/esm/Root.js.map +1 -1
- package/dist/esm/Root.mjs.map +1 -1
- package/dist/esm/Root.native.js.map +1 -1
- package/dist/esm/babel-plugins/one-router-metro.js +4 -1
- package/dist/esm/babel-plugins/one-router-metro.js.map +1 -1
- package/dist/esm/babel-plugins/one-router-metro.mjs.map +1 -1
- package/dist/esm/babel-plugins/one-router-metro.native.js.map +1 -1
- package/dist/esm/babel-plugins/remove-server-code.js +7 -2
- package/dist/esm/babel-plugins/remove-server-code.js.map +1 -1
- package/dist/esm/babel-plugins/remove-server-code.mjs.map +1 -1
- package/dist/esm/babel-plugins/remove-server-code.native.js.map +1 -1
- package/dist/esm/cli/build.js +31 -8
- package/dist/esm/cli/build.js.map +1 -1
- package/dist/esm/cli/build.mjs.map +1 -1
- package/dist/esm/cli/build.native.js.map +1 -1
- package/dist/esm/cli/buildPage.js +14 -4
- package/dist/esm/cli/buildPage.js.map +1 -1
- package/dist/esm/cli/buildPage.mjs.map +1 -1
- package/dist/esm/cli/buildPage.native.js.map +1 -1
- package/dist/esm/cli/generateRoutes.js +3 -1
- package/dist/esm/cli/generateRoutes.js.map +1 -1
- package/dist/esm/cli/generateRoutes.mjs.map +1 -1
- package/dist/esm/cli/generateRoutes.native.js.map +1 -1
- package/dist/esm/cli/generateSitemap.js.map +1 -1
- package/dist/esm/cli/generateSitemap.mjs.map +1 -1
- package/dist/esm/cli/generateSitemap.native.js.map +1 -1
- package/dist/esm/cli/generateSitemap.test.js +14 -4
- package/dist/esm/cli/generateSitemap.test.js.map +1 -1
- package/dist/esm/cli/generateSitemap.test.mjs.map +1 -1
- package/dist/esm/cli/generateSitemap.test.native.js.map +1 -1
- package/dist/esm/cli/main.js +4 -2
- package/dist/esm/cli/main.js.map +1 -1
- package/dist/esm/cli/main.mjs.map +1 -1
- package/dist/esm/cli/main.native.js.map +1 -1
- package/dist/esm/cli/prebuild.js.map +1 -1
- package/dist/esm/cli/prebuild.mjs.map +1 -1
- package/dist/esm/cli/prebuild.native.js.map +1 -1
- package/dist/esm/clientLoaderResolver.js.map +1 -1
- package/dist/esm/clientLoaderResolver.mjs.map +1 -1
- package/dist/esm/clientLoaderResolver.native.js.map +1 -1
- package/dist/esm/config.js +3 -1
- package/dist/esm/config.js.map +1 -1
- package/dist/esm/config.mjs.map +1 -1
- package/dist/esm/config.native.js.map +1 -1
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/constants.mjs.map +1 -1
- package/dist/esm/constants.native.js.map +1 -1
- package/dist/esm/createApp.js +9 -1
- package/dist/esm/createApp.js.map +1 -1
- package/dist/esm/createApp.mjs.map +1 -1
- package/dist/esm/createHandleRequest.js +9 -3
- package/dist/esm/createHandleRequest.js.map +1 -1
- package/dist/esm/createHandleRequest.mjs.map +1 -1
- package/dist/esm/createHandleRequest.native.js.map +1 -1
- package/dist/esm/fork/__tests__/getPathFromState.test.js +90 -88
- package/dist/esm/fork/__tests__/getPathFromState.test.js.map +1 -1
- package/dist/esm/fork/__tests__/getPathFromState.test.mjs.map +1 -1
- package/dist/esm/fork/__tests__/getPathFromState.test.native.js.map +1 -1
- package/dist/esm/fork/__tests__/getStateFromPath.test.js +163 -86
- package/dist/esm/fork/__tests__/getStateFromPath.test.js.map +1 -1
- package/dist/esm/fork/__tests__/getStateFromPath.test.mjs.map +1 -1
- package/dist/esm/fork/__tests__/getStateFromPath.test.native.js.map +1 -1
- package/dist/esm/fork/_shared.js.map +1 -1
- package/dist/esm/fork/_shared.mjs.map +1 -1
- package/dist/esm/fork/_shared.native.js.map +1 -1
- package/dist/esm/fork/extractPathFromURL.js.map +1 -1
- package/dist/esm/fork/extractPathFromURL.mjs.map +1 -1
- package/dist/esm/fork/extractPathFromURL.native.js.map +1 -1
- package/dist/esm/fork/getPathFromState-mods.js +4 -1
- package/dist/esm/fork/getPathFromState-mods.js.map +1 -1
- package/dist/esm/fork/getPathFromState-mods.mjs.map +1 -1
- package/dist/esm/fork/getPathFromState-mods.native.js.map +1 -1
- package/dist/esm/fork/getPathFromState.js +3 -1
- package/dist/esm/fork/getPathFromState.js.map +1 -1
- package/dist/esm/fork/getPathFromState.mjs.map +1 -1
- package/dist/esm/fork/getPathFromState.native.js.map +1 -1
- package/dist/esm/fork/getStateFromPath-mods.js.map +1 -1
- package/dist/esm/fork/getStateFromPath-mods.mjs.map +1 -1
- package/dist/esm/fork/getStateFromPath-mods.native.js.map +1 -1
- package/dist/esm/fork/getStateFromPath.js +7 -1
- package/dist/esm/fork/getStateFromPath.js.map +1 -1
- package/dist/esm/fork/getStateFromPath.mjs.map +1 -1
- package/dist/esm/fork/getStateFromPath.native.js.map +1 -1
- package/dist/esm/fork/getStateFromPath.test.js +25 -9
- package/dist/esm/fork/getStateFromPath.test.js.map +1 -1
- package/dist/esm/fork/getStateFromPath.test.mjs.map +1 -1
- package/dist/esm/fork/getStateFromPath.test.native.js.map +1 -1
- package/dist/esm/fork/useBackButton.js.map +1 -1
- package/dist/esm/fork/useBackButton.mjs.map +1 -1
- package/dist/esm/fork/useDocumentTitle.js +4 -1
- package/dist/esm/fork/useDocumentTitle.js.map +1 -1
- package/dist/esm/fork/useDocumentTitle.mjs.map +1 -1
- package/dist/esm/fork/useLinking.js +4 -1
- package/dist/esm/fork/useLinking.js.map +1 -1
- package/dist/esm/fork/useLinking.mjs.map +1 -1
- package/dist/esm/fork/validatePathConfig.js.map +1 -1
- package/dist/esm/fork/validatePathConfig.mjs.map +1 -1
- package/dist/esm/fork/validatePathConfig.native.js.map +1 -1
- package/dist/esm/hooks.js.map +1 -1
- package/dist/esm/hooks.mjs.map +1 -1
- package/dist/esm/hooks.native.js.map +1 -1
- package/dist/esm/index.js +3 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/layouts/Tabs.js.map +1 -1
- package/dist/esm/layouts/Tabs.mjs.map +1 -1
- package/dist/esm/layouts/Tabs.native.js.map +1 -1
- package/dist/esm/layouts/withLayoutContext.js +10 -8
- package/dist/esm/layouts/withLayoutContext.js.map +1 -1
- package/dist/esm/layouts/withLayoutContext.mjs.map +1 -1
- package/dist/esm/layouts/withLayoutContext.native.js.map +1 -1
- package/dist/esm/link/Link.js.map +1 -1
- package/dist/esm/link/Link.mjs.map +1 -1
- package/dist/esm/link/Link.native.js.map +1 -1
- package/dist/esm/link/linking.js +3 -1
- package/dist/esm/link/linking.js.map +1 -1
- package/dist/esm/link/linking.mjs.map +1 -1
- package/dist/esm/link/linking.native.js.map +1 -1
- package/dist/esm/link/useLinkTo.js.map +1 -1
- package/dist/esm/link/useLinkTo.mjs.map +1 -1
- package/dist/esm/link/useLinkTo.native.js.map +1 -1
- package/dist/esm/link/useLoadedNavigation.js +3 -1
- package/dist/esm/link/useLoadedNavigation.js.map +1 -1
- package/dist/esm/link/useLoadedNavigation.mjs.map +1 -1
- package/dist/esm/link/useLoadedNavigation.native.js.map +1 -1
- package/dist/esm/metro-config/getViteMetroPluginOptions.js +8 -10
- package/dist/esm/metro-config/getViteMetroPluginOptions.js.map +1 -1
- package/dist/esm/metro-config/getViteMetroPluginOptions.mjs +6 -8
- package/dist/esm/metro-config/getViteMetroPluginOptions.mjs.map +1 -1
- package/dist/esm/metro-config/getViteMetroPluginOptions.native.js +9 -11
- package/dist/esm/metro-config/getViteMetroPluginOptions.native.js.map +1 -1
- package/dist/esm/router/Route.js.map +1 -1
- package/dist/esm/router/Route.mjs.map +1 -1
- package/dist/esm/router/Route.native.js.map +1 -1
- package/dist/esm/router/RouteInfoContext.js +7 -1
- package/dist/esm/router/RouteInfoContext.js.map +1 -1
- package/dist/esm/router/RouteInfoContext.mjs.map +1 -1
- package/dist/esm/router/RouteInfoContext.native.js.map +1 -1
- package/dist/esm/router/filterRootHTML.js.map +1 -1
- package/dist/esm/router/filterRootHTML.mjs.map +1 -1
- package/dist/esm/router/filterRootHTML.native.js.map +1 -1
- package/dist/esm/router/getLinkingConfig.js.map +1 -1
- package/dist/esm/router/getLinkingConfig.mjs.map +1 -1
- package/dist/esm/router/getLinkingConfig.native.js.map +1 -1
- package/dist/esm/router/getNormalizedStatePath.js.map +1 -1
- package/dist/esm/router/getNormalizedStatePath.mjs.map +1 -1
- package/dist/esm/router/getNormalizedStatePath.native.js.map +1 -1
- package/dist/esm/router/getRoutes.js +3 -1
- package/dist/esm/router/getRoutes.js.map +1 -1
- package/dist/esm/router/getRoutes.mjs.map +1 -1
- package/dist/esm/router/getRoutes.native.js.map +1 -1
- package/dist/esm/router/linkingConfig.js +3 -1
- package/dist/esm/router/linkingConfig.js.map +1 -1
- package/dist/esm/router/linkingConfig.mjs.map +1 -1
- package/dist/esm/router/linkingConfig.native.js.map +1 -1
- package/dist/esm/router/matchers.js +1 -1
- package/dist/esm/router/matchers.js.map +1 -1
- package/dist/esm/router/matchers.mjs +1 -1
- package/dist/esm/router/matchers.mjs.map +1 -1
- package/dist/esm/router/matchers.native.js +1 -1
- package/dist/esm/router/matchers.native.js.map +1 -1
- package/dist/esm/router/matchers.test.js +6 -2
- package/dist/esm/router/matchers.test.js.map +1 -1
- package/dist/esm/router/matchers.test.mjs.map +1 -1
- package/dist/esm/router/router.js +16 -4
- package/dist/esm/router/router.js.map +1 -1
- package/dist/esm/router/router.mjs.map +1 -1
- package/dist/esm/router/router.native.js.map +1 -1
- package/dist/esm/router/useNavigation.js.map +1 -1
- package/dist/esm/router/useNavigation.mjs.map +1 -1
- package/dist/esm/router/useNavigation.native.js.map +1 -1
- package/dist/esm/router/useScreens.js +13 -11
- package/dist/esm/router/useScreens.js.map +1 -1
- package/dist/esm/router/useScreens.mjs.map +1 -1
- package/dist/esm/router/useScreens.native.js.map +1 -1
- package/dist/esm/router/useViteRoutes.js.map +1 -1
- package/dist/esm/router/useViteRoutes.mjs.map +1 -1
- package/dist/esm/router/useViteRoutes.native.js.map +1 -1
- package/dist/esm/router/utils/getNavigateAction.js.map +1 -1
- package/dist/esm/router/utils/getNavigateAction.mjs.map +1 -1
- package/dist/esm/router/utils/getNavigateAction.native.js.map +1 -1
- package/dist/esm/server/createRoutesManifest.js.map +1 -1
- package/dist/esm/server/createRoutesManifest.mjs.map +1 -1
- package/dist/esm/server/createRoutesManifest.native.js.map +1 -1
- package/dist/esm/server/getServerManifest.js +3 -1
- package/dist/esm/server/getServerManifest.js.map +1 -1
- package/dist/esm/server/getServerManifest.mjs.map +1 -1
- package/dist/esm/server/getServerManifest.native.js.map +1 -1
- package/dist/esm/server/oneServe.js +9 -2
- package/dist/esm/server/oneServe.js.map +1 -1
- package/dist/esm/server/oneServe.mjs.map +1 -1
- package/dist/esm/server/oneServe.native.js.map +1 -1
- package/dist/esm/server/setupBuildOptions.js.map +1 -1
- package/dist/esm/server/setupBuildOptions.mjs.map +1 -1
- package/dist/esm/server/setupBuildOptions.native.js.map +1 -1
- package/dist/esm/server/staticHtmlFetcher.js.map +1 -1
- package/dist/esm/server/staticHtmlFetcher.mjs.map +1 -1
- package/dist/esm/server/staticHtmlFetcher.native.js.map +1 -1
- package/dist/esm/server-render.js.map +1 -1
- package/dist/esm/server-render.mjs.map +1 -1
- package/dist/esm/server-render.native.js.map +1 -1
- package/dist/esm/typed-routes/getTypedRoutesDeclarationFile.js +14 -2
- package/dist/esm/typed-routes/getTypedRoutesDeclarationFile.js.map +1 -1
- package/dist/esm/typed-routes/getTypedRoutesDeclarationFile.mjs.map +1 -1
- package/dist/esm/typed-routes/getTypedRoutesDeclarationFile.native.js.map +1 -1
- package/dist/esm/typed-routes/injectRouteHelpers.js +4 -1
- package/dist/esm/typed-routes/injectRouteHelpers.js.map +1 -1
- package/dist/esm/typed-routes/injectRouteHelpers.mjs.map +1 -1
- package/dist/esm/typed-routes/injectRouteHelpers.native.js.map +1 -1
- package/dist/esm/ui/Slot.js.map +1 -1
- package/dist/esm/ui/Slot.mjs.map +1 -1
- package/dist/esm/ui/Slot.native.js.map +1 -1
- package/dist/esm/ui/TabContext.js +3 -1
- package/dist/esm/ui/TabContext.js.map +1 -1
- package/dist/esm/ui/TabContext.mjs.map +1 -1
- package/dist/esm/ui/TabContext.native.js.map +1 -1
- package/dist/esm/ui/TabRouter.js.map +1 -1
- package/dist/esm/ui/TabRouter.mjs.map +1 -1
- package/dist/esm/ui/TabRouter.native.js.map +1 -1
- package/dist/esm/ui/TabTrigger.js +21 -3
- package/dist/esm/ui/TabTrigger.js.map +1 -1
- package/dist/esm/ui/TabTrigger.mjs.map +1 -1
- package/dist/esm/ui/TabTrigger.native.js.map +1 -1
- package/dist/esm/ui/Tabs.js +5 -1
- package/dist/esm/ui/Tabs.js.map +1 -1
- package/dist/esm/ui/Tabs.mjs.map +1 -1
- package/dist/esm/ui/Tabs.native.js.map +1 -1
- package/dist/esm/ui/common.js +8 -2
- package/dist/esm/ui/common.js.map +1 -1
- package/dist/esm/ui/common.mjs.map +1 -1
- package/dist/esm/ui/common.native.js.map +1 -1
- package/dist/esm/useLoader.js +4 -1
- package/dist/esm/useLoader.js.map +1 -1
- package/dist/esm/useLoader.mjs.map +1 -1
- package/dist/esm/useLoader.native.js.map +1 -1
- package/dist/esm/utils/cleanUrl.js.map +1 -1
- package/dist/esm/utils/cleanUrl.mjs.map +1 -1
- package/dist/esm/utils/cleanUrl.native.js.map +1 -1
- package/dist/esm/utils/url.js +3 -1
- package/dist/esm/utils/url.js.map +1 -1
- package/dist/esm/utils/url.mjs.map +1 -1
- package/dist/esm/utils/url.native.js.map +1 -1
- package/dist/esm/vercel/build/buildVercelOutputDirectory.js +29 -10
- package/dist/esm/vercel/build/buildVercelOutputDirectory.js.map +1 -1
- package/dist/esm/vercel/build/buildVercelOutputDirectory.mjs.map +1 -1
- package/dist/esm/vercel/build/buildVercelOutputDirectory.native.js.map +1 -1
- package/dist/esm/vercel/build/generate/createApiServerlessFunction.js +11 -3
- package/dist/esm/vercel/build/generate/createApiServerlessFunction.js.map +1 -1
- package/dist/esm/vercel/build/generate/createApiServerlessFunction.mjs.map +1 -1
- package/dist/esm/vercel/build/generate/createApiServerlessFunction.native.js.map +1 -1
- package/dist/esm/vercel/build/generate/createSsrServerlessFunction.js +9 -2
- package/dist/esm/vercel/build/generate/createSsrServerlessFunction.js.map +1 -1
- package/dist/esm/vercel/build/generate/createSsrServerlessFunction.mjs.map +1 -1
- package/dist/esm/vercel/build/generate/createSsrServerlessFunction.native.js.map +1 -1
- package/dist/esm/vercel/build/getPathFromRoute.js +4 -1
- package/dist/esm/vercel/build/getPathFromRoute.js.map +1 -1
- package/dist/esm/vercel/build/getPathFromRoute.mjs.map +1 -1
- package/dist/esm/vercel/build/getPathFromRoute.native.js.map +1 -1
- package/dist/esm/views/Navigator.js +20 -9
- package/dist/esm/views/Navigator.js.map +1 -1
- package/dist/esm/views/Navigator.mjs.map +1 -1
- package/dist/esm/views/Navigator.native.js.map +1 -1
- package/dist/esm/views/RootErrorBoundary.js +4 -2
- package/dist/esm/views/RootErrorBoundary.js.map +1 -1
- package/dist/esm/views/RootErrorBoundary.mjs.map +1 -1
- package/dist/esm/views/RootErrorBoundary.native.js.map +1 -1
- package/dist/esm/views/Screen.js +4 -1
- package/dist/esm/views/Screen.js.map +1 -1
- package/dist/esm/views/Screen.mjs.map +1 -1
- package/dist/esm/views/Screen.native.js.map +1 -1
- package/dist/esm/vite/loadConfig.js +6 -2
- package/dist/esm/vite/loadConfig.js.map +1 -1
- package/dist/esm/vite/loadConfig.mjs.map +1 -1
- package/dist/esm/vite/loadConfig.native.js.map +1 -1
- package/dist/esm/vite/one-server-only.js +3 -1
- package/dist/esm/vite/one-server-only.js.map +1 -1
- package/dist/esm/vite/one-server-only.mjs.map +1 -1
- package/dist/esm/vite/one.js +9 -3
- package/dist/esm/vite/one.js.map +1 -1
- package/dist/esm/vite/one.mjs.map +1 -1
- package/dist/esm/vite/one.native.js.map +1 -1
- package/dist/esm/vite/plugins/SSRCSSPlugin.js +5 -1
- package/dist/esm/vite/plugins/SSRCSSPlugin.js.map +1 -1
- package/dist/esm/vite/plugins/SSRCSSPlugin.mjs.map +1 -1
- package/dist/esm/vite/plugins/SSRCSSPlugin.native.js.map +1 -1
- package/dist/esm/vite/plugins/clientTreeShakePlugin.js +12 -3
- package/dist/esm/vite/plugins/clientTreeShakePlugin.js.map +1 -1
- package/dist/esm/vite/plugins/clientTreeShakePlugin.mjs.map +1 -1
- package/dist/esm/vite/plugins/clientTreeShakePlugin.native.js.map +1 -1
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.js +11 -4
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.js.map +1 -1
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.mjs.map +1 -1
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.native.js.map +1 -1
- package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.js.map +1 -1
- package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.mjs.map +1 -1
- package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.native.js.map +1 -1
- package/dist/esm/vite/plugins/removeReactNativeWebAnimatedPlugin.js.map +1 -1
- package/dist/esm/vite/plugins/removeReactNativeWebAnimatedPlugin.mjs.map +1 -1
- package/dist/esm/vite/plugins/removeReactNativeWebAnimatedPlugin.native.js.map +1 -1
- package/dist/esm/vite/plugins/virtualEntryPlugin.js +13 -3
- package/dist/esm/vite/plugins/virtualEntryPlugin.js.map +1 -1
- package/dist/esm/vite/plugins/virtualEntryPlugin.mjs.map +1 -1
- package/dist/esm/vite/plugins/virtualEntryPlugin.native.js.map +1 -1
- package/dist/esm/vite/replaceLoader.js +4 -1
- package/dist/esm/vite/replaceLoader.js.map +1 -1
- package/dist/esm/vite/replaceLoader.mjs.map +1 -1
- package/dist/esm/vite/replaceLoader.native.js.map +1 -1
- package/dist/esm/vite/resolveResponse.js +5 -1
- package/dist/esm/vite/resolveResponse.js.map +1 -1
- package/dist/esm/vite/resolveResponse.mjs.map +1 -1
- package/dist/esm/vite/resolveResponse.native.js.map +1 -1
- package/dist/esm/zero/subscribeToQuery.js.map +1 -1
- package/dist/esm/zero/subscribeToQuery.mjs.map +1 -1
- package/dist/esm/zero/subscribeToQuery.native.js.map +1 -1
- package/dist/esm/zero/useQueryZero.js +3 -1
- package/dist/esm/zero/useQueryZero.js.map +1 -1
- package/dist/esm/zero/useQueryZero.mjs.map +1 -1
- package/dist/esm/zero/useQueryZero.native.js.map +1 -1
- package/metro-entry-ctx.js +2 -1
- package/package.json +10 -10
- package/src/Root.tsx +14 -5
- package/src/babel-plugins/one-router-metro.ts +4 -1
- package/src/babel-plugins/remove-server-code.ts +15 -4
- package/src/cli/build.ts +33 -8
- package/src/cli/buildPage.ts +15 -4
- package/src/cli/generateRoutes.ts +3 -1
- package/src/cli/generateSitemap.test.ts +14 -4
- package/src/cli/generateSitemap.ts +7 -2
- package/src/cli/main.ts +3 -1
- package/src/cli/prebuild.ts +5 -1
- package/src/clientLoaderResolver.ts +4 -1
- package/src/config.ts +6 -2
- package/src/constants.ts +4 -2
- package/src/createApp.tsx +11 -3
- package/src/createHandleRequest.ts +17 -6
- package/src/fork/__tests__/getPathFromState.test.tsx +128 -107
- package/src/fork/__tests__/getStateFromPath.test.tsx +181 -95
- package/src/fork/_shared.ts +2 -1
- package/src/fork/extractPathFromURL.ts +2 -1
- package/src/fork/getPathFromState-mods.ts +8 -2
- package/src/fork/getPathFromState.ts +16 -5
- package/src/fork/getStateFromPath-mods.ts +13 -3
- package/src/fork/getStateFromPath.test.ts +25 -9
- package/src/fork/getStateFromPath.ts +21 -5
- package/src/fork/useBackButton.native.tsx +3 -1
- package/src/fork/useBackButton.tsx +3 -1
- package/src/fork/useDocumentTitle.tsx +4 -1
- package/src/fork/useLinking.native.ts +3 -1
- package/src/fork/useLinking.ts +9 -3
- package/src/fork/validatePathConfig.ts +6 -1
- package/src/head/Head.ios.tsx +3 -1
- package/src/hooks.tsx +4 -2
- package/src/index.ts +4 -1
- package/src/interfaces/router.ts +29 -13
- package/src/layouts/Tabs.tsx +5 -1
- package/src/layouts/withLayoutContext.tsx +24 -21
- package/src/link/Link.tsx +3 -1
- package/src/link/linking.ts +3 -1
- package/src/link/useLinkTo.tsx +3 -1
- package/src/link/useLoadedNavigation.ts +5 -1
- package/src/metro-config/getViteMetroPluginOptions.ts +20 -22
- package/src/router/Route.tsx +3 -1
- package/src/router/RouteInfoContext.tsx +3 -1
- package/src/router/filterRootHTML.ts +5 -1
- package/src/router/getLinkingConfig.ts +4 -1
- package/src/router/getNormalizedStatePath.tsx +4 -1
- package/src/router/getRoutes.ts +13 -4
- package/src/router/linkingConfig.ts +4 -1
- package/src/router/matchers.test.ts +6 -2
- package/src/router/matchers.ts +1 -1
- package/src/router/router.ts +25 -6
- package/src/router/useNavigation.ts +4 -1
- package/src/router/useScreens.tsx +27 -14
- package/src/router/useViteRoutes.tsx +2 -1
- package/src/router/utils/getNavigateAction.ts +4 -2
- package/src/server/createRoutesManifest.ts +4 -1
- package/src/server/getServerManifest.ts +7 -2
- package/src/server/oneServe.ts +21 -8
- package/src/server/setupBuildOptions.ts +2 -1
- package/src/server/staticHtmlFetcher.ts +3 -1
- package/src/server-render.tsx +4 -1
- package/src/typed-routes/getTypedRoutesDeclarationFile.ts +20 -4
- package/src/typed-routes/injectRouteHelpers.ts +12 -3
- package/src/types.ts +2 -2
- package/src/ui/Slot.tsx +4 -2
- package/src/ui/TabContext.tsx +3 -1
- package/src/ui/TabRouter.tsx +7 -2
- package/src/ui/TabTrigger.tsx +20 -3
- package/src/ui/Tabs.tsx +8 -2
- package/src/ui/common.tsx +19 -5
- package/src/useLoader.ts +9 -4
- package/src/utils/cleanUrl.ts +5 -1
- package/src/utils/url.ts +3 -1
- package/src/vercel/build/buildVercelOutputDirectory.ts +31 -10
- package/src/vercel/build/generate/createApiServerlessFunction.ts +11 -3
- package/src/vercel/build/generate/createSsrServerlessFunction.ts +10 -3
- package/src/vercel/build/getPathFromRoute.ts +4 -1
- package/src/views/Navigator.tsx +21 -9
- package/src/views/RootErrorBoundary.tsx +3 -1
- package/src/views/Screen.tsx +4 -1
- package/src/vite/loadConfig.ts +6 -2
- package/src/vite/one-server-only.tsx +10 -4
- package/src/vite/one.ts +61 -46
- package/src/vite/plugins/SSRCSSPlugin.ts +9 -2
- package/src/vite/plugins/clientTreeShakePlugin.ts +22 -6
- package/src/vite/plugins/fileSystemRouterPlugin.tsx +10 -3
- package/src/vite/plugins/generateFileSystemRouteTypesPlugin.tsx +2 -1
- package/src/vite/plugins/removeReactNativeWebAnimatedPlugin.ts +3 -1
- package/src/vite/plugins/virtualEntryPlugin.ts +22 -5
- package/src/vite/replaceLoader.ts +7 -1
- package/src/vite/resolveResponse.ts +6 -2
- package/src/vite/types.ts +6 -3
- package/src/zero/subscribeToQuery.ts +4 -1
- package/src/zero/types.ts +8 -9
- package/src/zero/useQuery.ts +1 -1
- package/src/zero/useQueryZero.ts +3 -1
- package/types/Root.d.ts.map +1 -1
- package/types/babel-plugins/one-router-metro.d.ts.map +1 -1
- package/types/babel-plugins/remove-server-code.d.ts.map +1 -1
- package/types/cli/build.d.ts.map +1 -1
- package/types/cli/buildPage.d.ts.map +1 -1
- package/types/cli/generateRoutes.d.ts.map +1 -1
- package/types/cli/generateSitemap.d.ts.map +1 -1
- package/types/cli/main.d.ts.map +1 -1
- package/types/cli/prebuild.d.ts.map +1 -1
- package/types/clientLoaderResolver.d.ts.map +1 -1
- package/types/config.d.ts.map +1 -1
- package/types/constants.d.ts.map +1 -1
- package/types/createApp.d.ts.map +1 -1
- package/types/createHandleRequest.d.ts +1 -1
- package/types/createHandleRequest.d.ts.map +1 -1
- package/types/fork/_shared.d.ts.map +1 -1
- package/types/fork/extractPathFromURL.d.ts.map +1 -1
- package/types/fork/getPathFromState.d.ts.map +1 -1
- package/types/fork/getStateFromPath-mods.d.ts.map +1 -1
- package/types/fork/getStateFromPath.d.ts.map +1 -1
- package/types/fork/useBackButton.d.ts.map +1 -1
- package/types/fork/useBackButton.native.d.ts.map +1 -1
- package/types/fork/useDocumentTitle.d.ts.map +1 -1
- package/types/fork/useLinking.d.ts.map +1 -1
- package/types/fork/useLinking.native.d.ts.map +1 -1
- package/types/fork/validatePathConfig.d.ts.map +1 -1
- package/types/head/Head.ios.d.ts.map +1 -1
- package/types/hooks.d.ts +2 -2
- package/types/hooks.d.ts.map +1 -1
- package/types/index.d.ts +1 -1
- package/types/index.d.ts.map +1 -1
- package/types/interfaces/router.d.ts.map +1 -1
- package/types/layouts/Tabs.d.ts.map +1 -1
- package/types/layouts/withLayoutContext.d.ts.map +1 -1
- package/types/link/Link.d.ts.map +1 -1
- package/types/link/linking.d.ts.map +1 -1
- package/types/link/useLinkTo.d.ts.map +1 -1
- package/types/link/useLoadedNavigation.d.ts.map +1 -1
- package/types/metro-config/getViteMetroPluginOptions.d.ts.map +1 -1
- package/types/router/Route.d.ts.map +1 -1
- package/types/router/RouteInfoContext.d.ts.map +1 -1
- package/types/router/filterRootHTML.d.ts.map +1 -1
- package/types/router/getNormalizedStatePath.d.ts.map +1 -1
- package/types/router/getRoutes.d.ts.map +1 -1
- package/types/router/linkingConfig.d.ts.map +1 -1
- package/types/router/router.d.ts.map +1 -1
- package/types/router/useNavigation.d.ts.map +1 -1
- package/types/router/useScreens.d.ts.map +1 -1
- package/types/router/useViteRoutes.d.ts.map +1 -1
- package/types/router/utils/getNavigateAction.d.ts.map +1 -1
- package/types/server/createRoutesManifest.d.ts.map +1 -1
- package/types/server/getServerManifest.d.ts.map +1 -1
- package/types/server/oneServe.d.ts.map +1 -1
- package/types/server/setupBuildOptions.d.ts.map +1 -1
- package/types/server/staticHtmlFetcher.d.ts.map +1 -1
- package/types/server-render.d.ts.map +1 -1
- package/types/types.d.ts +2 -2
- package/types/ui/Slot.d.ts.map +1 -1
- package/types/ui/TabContext.d.ts.map +1 -1
- package/types/ui/TabRouter.d.ts.map +1 -1
- package/types/ui/TabTrigger.d.ts.map +1 -1
- package/types/ui/Tabs.d.ts.map +1 -1
- package/types/ui/common.d.ts.map +1 -1
- package/types/useLoader.d.ts.map +1 -1
- package/types/utils/cleanUrl.d.ts.map +1 -1
- package/types/utils/url.d.ts.map +1 -1
- package/types/vercel/build/buildVercelOutputDirectory.d.ts.map +1 -1
- package/types/vercel/build/generate/createApiServerlessFunction.d.ts.map +1 -1
- package/types/vercel/build/generate/createSsrServerlessFunction.d.ts.map +1 -1
- package/types/vercel/build/getPathFromRoute.d.ts.map +1 -1
- package/types/views/Navigator.d.ts +1 -1
- package/types/views/Navigator.d.ts.map +1 -1
- package/types/views/RootErrorBoundary.d.ts.map +1 -1
- package/types/views/Screen.d.ts +1 -1
- package/types/views/Screen.d.ts.map +1 -1
- package/types/vite/loadConfig.d.ts.map +1 -1
- package/types/vite/one-server-only.d.ts +2 -2
- package/types/vite/one-server-only.d.ts.map +1 -1
- package/types/vite/one.d.ts.map +1 -1
- package/types/vite/plugins/SSRCSSPlugin.d.ts.map +1 -1
- package/types/vite/plugins/clientTreeShakePlugin.d.ts.map +1 -1
- package/types/vite/plugins/fileSystemRouterPlugin.d.ts.map +1 -1
- package/types/vite/plugins/generateFileSystemRouteTypesPlugin.d.ts.map +1 -1
- package/types/vite/plugins/removeReactNativeWebAnimatedPlugin.d.ts.map +1 -1
- package/types/vite/plugins/virtualEntryPlugin.d.ts.map +1 -1
- package/types/vite/replaceLoader.d.ts +2 -2
- package/types/vite/replaceLoader.d.ts.map +1 -1
- package/types/vite/resolveResponse.d.ts.map +1 -1
- package/types/vite/types.d.ts +1 -1
- package/types/vite/types.d.ts.map +1 -1
- package/types/zero/subscribeToQuery.d.ts.map +1 -1
- package/types/zero/types.d.ts.map +1 -1
- package/types/zero/useQueryZero.d.ts.map +1 -1
- package/vendor/react/cjs/react-jsx-dev-runtime.development.js +1230 -1078
- package/vendor/react/cjs/react-jsx-dev-runtime.production.min.js +4 -1
- package/vendor/react/cjs/react-jsx-dev-runtime.profiling.min.js +4 -1
- package/vendor/react/cjs/react-jsx-runtime.development.js +1244 -1092
- package/vendor/react/cjs/react-jsx-runtime.production.min.js +23 -2
- package/vendor/react/cjs/react-jsx-runtime.profiling.min.js +23 -2
- package/vendor/react/cjs/react.development.js +2604 -2324
- package/vendor/react/cjs/react.production.min.js +360 -17
- package/vendor/react/cjs/react.shared-subset.development.js +9 -7
- package/vendor/react/cjs/react.shared-subset.production.min.js +2 -1
- package/vendor/react/index.js +3 -3
- package/vendor/react/jsx-dev-runtime.js +3 -3
- package/vendor/react/jsx-runtime.js +3 -3
- package/vendor/react/react.shared-subset.js +3 -3
- package/vendor/react/umd/react.development.js +1430 -1152
- package/vendor/react/umd/react.production.min.js +657 -22
- package/vendor/react/umd/react.profiling.min.js +657 -22
- package/vendor/react-dom/cjs/react-dom-server-legacy.browser.development.js +7183 -5938
- package/vendor/react-dom/cjs/react-dom-server-legacy.browser.production.min.js +1941 -84
- package/vendor/react-dom/cjs/react-dom-server-legacy.node.development.js +7239 -5986
- package/vendor/react-dom/cjs/react-dom-server-legacy.node.production.min.js +2055 -92
- package/vendor/react-dom/cjs/react-dom-server.browser.development.js +7146 -5924
- package/vendor/react-dom/cjs/react-dom-server.browser.production.min.js +1997 -87
- package/vendor/react-dom/cjs/react-dom-server.node.development.js +7210 -5976
- package/vendor/react-dom/cjs/react-dom-server.node.production.min.js +2075 -93
- package/vendor/react-dom/cjs/react-dom-test-utils.development.js +1700 -1487
- package/vendor/react-dom/cjs/react-dom-test-utils.production.min.js +653 -31
- package/vendor/react-dom/cjs/react-dom.development.js +29568 -25248
- package/vendor/react-dom/cjs/react-dom.production.min.js +8208 -310
- package/vendor/react-dom/cjs/react-dom.profiling.min.js +8750 -343
- package/vendor/react-dom/client.js +15 -15
- package/vendor/react-dom/index.js +8 -8
- package/vendor/react-dom/profiling.js +8 -8
- package/vendor/react-dom/server.browser.js +12 -12
- package/vendor/react-dom/server.js +2 -2
- package/vendor/react-dom/server.node.js +12 -12
- package/vendor/react-dom/test-utils.js +3 -3
- package/vendor/react-dom/umd/react-dom-server-legacy.browser.development.js +3735 -2502
- package/vendor/react-dom/umd/react-dom-server-legacy.browser.production.min.js +1964 -66
- package/vendor/react-dom/umd/react-dom-server.browser.development.js +3724 -2511
- package/vendor/react-dom/umd/react-dom-server.browser.production.min.js +2017 -67
- package/vendor/react-dom/umd/react-dom-test-utils.development.js +777 -563
- package/vendor/react-dom/umd/react-dom-test-utils.production.min.js +678 -24
- package/vendor/react-dom/umd/react-dom.development.js +15978 -11854
- package/vendor/react-dom/umd/react-dom.production.min.js +8328 -256
- package/vendor/react-dom/umd/react-dom.profiling.min.js +8868 -274
|
@@ -7,45 +7,50 @@
|
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
9
|
*/
|
|
10
|
-
(function (global, factory) {
|
|
11
|
-
typeof exports === 'object' && typeof module !== 'undefined'
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
;(function (global, factory) {
|
|
11
|
+
typeof exports === 'object' && typeof module !== 'undefined'
|
|
12
|
+
? factory(exports)
|
|
13
|
+
: typeof define === 'function' && define.amd
|
|
14
|
+
? define(['exports'], factory)
|
|
15
|
+
: ((global = global || self), factory((global.React = {})))
|
|
16
|
+
})(this, function (exports) {
|
|
17
|
+
'use strict'
|
|
15
18
|
|
|
16
|
-
var ReactVersion = '18.3.1'
|
|
19
|
+
var ReactVersion = '18.3.1'
|
|
17
20
|
|
|
18
21
|
// ATTENTION
|
|
19
22
|
// When adding new symbols to this file,
|
|
20
23
|
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
|
|
21
24
|
// The Symbol used to tag the ReactElement-like types.
|
|
22
|
-
var REACT_ELEMENT_TYPE = Symbol.for('react.element')
|
|
23
|
-
var REACT_PORTAL_TYPE = Symbol.for('react.portal')
|
|
24
|
-
var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment')
|
|
25
|
-
var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode')
|
|
26
|
-
var REACT_PROFILER_TYPE = Symbol.for('react.profiler')
|
|
27
|
-
var REACT_PROVIDER_TYPE = Symbol.for('react.provider')
|
|
28
|
-
var REACT_CONTEXT_TYPE = Symbol.for('react.context')
|
|
29
|
-
var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref')
|
|
30
|
-
var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense')
|
|
31
|
-
var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list')
|
|
32
|
-
var REACT_MEMO_TYPE = Symbol.for('react.memo')
|
|
33
|
-
var REACT_LAZY_TYPE = Symbol.for('react.lazy')
|
|
34
|
-
var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen')
|
|
35
|
-
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator
|
|
36
|
-
var FAUX_ITERATOR_SYMBOL = '@@iterator'
|
|
25
|
+
var REACT_ELEMENT_TYPE = Symbol.for('react.element')
|
|
26
|
+
var REACT_PORTAL_TYPE = Symbol.for('react.portal')
|
|
27
|
+
var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment')
|
|
28
|
+
var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode')
|
|
29
|
+
var REACT_PROFILER_TYPE = Symbol.for('react.profiler')
|
|
30
|
+
var REACT_PROVIDER_TYPE = Symbol.for('react.provider')
|
|
31
|
+
var REACT_CONTEXT_TYPE = Symbol.for('react.context')
|
|
32
|
+
var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref')
|
|
33
|
+
var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense')
|
|
34
|
+
var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list')
|
|
35
|
+
var REACT_MEMO_TYPE = Symbol.for('react.memo')
|
|
36
|
+
var REACT_LAZY_TYPE = Symbol.for('react.lazy')
|
|
37
|
+
var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen')
|
|
38
|
+
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator
|
|
39
|
+
var FAUX_ITERATOR_SYMBOL = '@@iterator'
|
|
37
40
|
function getIteratorFn(maybeIterable) {
|
|
38
41
|
if (maybeIterable === null || typeof maybeIterable !== 'object') {
|
|
39
|
-
return null
|
|
42
|
+
return null
|
|
40
43
|
}
|
|
41
44
|
|
|
42
|
-
var maybeIterator =
|
|
45
|
+
var maybeIterator =
|
|
46
|
+
(MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) ||
|
|
47
|
+
maybeIterable[FAUX_ITERATOR_SYMBOL]
|
|
43
48
|
|
|
44
49
|
if (typeof maybeIterator === 'function') {
|
|
45
|
-
return maybeIterator
|
|
50
|
+
return maybeIterator
|
|
46
51
|
}
|
|
47
52
|
|
|
48
|
-
return null
|
|
53
|
+
return null
|
|
49
54
|
}
|
|
50
55
|
|
|
51
56
|
/**
|
|
@@ -56,23 +61,23 @@
|
|
|
56
61
|
* @internal
|
|
57
62
|
* @type {ReactComponent}
|
|
58
63
|
*/
|
|
59
|
-
current: null
|
|
60
|
-
}
|
|
64
|
+
current: null,
|
|
65
|
+
}
|
|
61
66
|
|
|
62
67
|
/**
|
|
63
68
|
* Keeps track of the current batch's configuration such as how long an update
|
|
64
69
|
* should suspend for if it needs to.
|
|
65
70
|
*/
|
|
66
71
|
var ReactCurrentBatchConfig = {
|
|
67
|
-
transition: null
|
|
68
|
-
}
|
|
72
|
+
transition: null,
|
|
73
|
+
}
|
|
69
74
|
|
|
70
75
|
var ReactCurrentActQueue = {
|
|
71
76
|
current: null,
|
|
72
77
|
// Used to reproduce behavior of `batchedUpdates` in legacy mode.
|
|
73
78
|
isBatchingLegacy: false,
|
|
74
|
-
didScheduleLegacyUpdate: false
|
|
75
|
-
}
|
|
79
|
+
didScheduleLegacyUpdate: false,
|
|
80
|
+
}
|
|
76
81
|
|
|
77
82
|
/**
|
|
78
83
|
* Keeps track of the current owner.
|
|
@@ -85,66 +90,64 @@
|
|
|
85
90
|
* @internal
|
|
86
91
|
* @type {ReactComponent}
|
|
87
92
|
*/
|
|
88
|
-
current: null
|
|
89
|
-
}
|
|
93
|
+
current: null,
|
|
94
|
+
}
|
|
90
95
|
|
|
91
|
-
var ReactDebugCurrentFrame = {}
|
|
92
|
-
var currentExtraStackFrame = null
|
|
96
|
+
var ReactDebugCurrentFrame = {}
|
|
97
|
+
var currentExtraStackFrame = null
|
|
93
98
|
function setExtraStackFrame(stack) {
|
|
94
99
|
{
|
|
95
|
-
currentExtraStackFrame = stack
|
|
100
|
+
currentExtraStackFrame = stack
|
|
96
101
|
}
|
|
97
102
|
}
|
|
98
103
|
|
|
99
104
|
{
|
|
100
105
|
ReactDebugCurrentFrame.setExtraStackFrame = function (stack) {
|
|
101
106
|
{
|
|
102
|
-
currentExtraStackFrame = stack
|
|
107
|
+
currentExtraStackFrame = stack
|
|
103
108
|
}
|
|
104
|
-
}
|
|
109
|
+
} // Stack implementation injected by the current renderer.
|
|
105
110
|
|
|
106
|
-
|
|
107
|
-
ReactDebugCurrentFrame.getCurrentStack = null;
|
|
111
|
+
ReactDebugCurrentFrame.getCurrentStack = null
|
|
108
112
|
|
|
109
113
|
ReactDebugCurrentFrame.getStackAddendum = function () {
|
|
110
|
-
var stack = ''
|
|
114
|
+
var stack = '' // Add an extra top frame while an element is being validated
|
|
111
115
|
|
|
112
116
|
if (currentExtraStackFrame) {
|
|
113
|
-
stack += currentExtraStackFrame
|
|
117
|
+
stack += currentExtraStackFrame
|
|
114
118
|
} // Delegate to the injected renderer-specific implementation
|
|
115
119
|
|
|
116
|
-
|
|
117
|
-
var impl = ReactDebugCurrentFrame.getCurrentStack;
|
|
120
|
+
var impl = ReactDebugCurrentFrame.getCurrentStack
|
|
118
121
|
|
|
119
122
|
if (impl) {
|
|
120
|
-
stack += impl() || ''
|
|
123
|
+
stack += impl() || ''
|
|
121
124
|
}
|
|
122
125
|
|
|
123
|
-
return stack
|
|
124
|
-
}
|
|
126
|
+
return stack
|
|
127
|
+
}
|
|
125
128
|
}
|
|
126
129
|
|
|
127
130
|
// -----------------------------------------------------------------------------
|
|
128
131
|
|
|
129
|
-
var enableScopeAPI = false
|
|
130
|
-
var enableCacheElement = false
|
|
131
|
-
var enableTransitionTracing = false
|
|
132
|
+
var enableScopeAPI = false // Experimental Create Event Handle API.
|
|
133
|
+
var enableCacheElement = false
|
|
134
|
+
var enableTransitionTracing = false // No known bugs, but needs performance testing
|
|
132
135
|
|
|
133
|
-
var enableLegacyHidden = false
|
|
136
|
+
var enableLegacyHidden = false // Enables unstable_avoidThisFallback feature in Fiber
|
|
134
137
|
// stuff. Intended to enable React core members to more easily debug scheduling
|
|
135
138
|
// issues in DEV builds.
|
|
136
139
|
|
|
137
|
-
var enableDebugTracing = false
|
|
140
|
+
var enableDebugTracing = false // Track which Fiber(s) schedule render work.
|
|
138
141
|
|
|
139
142
|
var ReactSharedInternals = {
|
|
140
143
|
ReactCurrentDispatcher: ReactCurrentDispatcher,
|
|
141
144
|
ReactCurrentBatchConfig: ReactCurrentBatchConfig,
|
|
142
|
-
ReactCurrentOwner: ReactCurrentOwner
|
|
143
|
-
}
|
|
145
|
+
ReactCurrentOwner: ReactCurrentOwner,
|
|
146
|
+
}
|
|
144
147
|
|
|
145
148
|
{
|
|
146
|
-
ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame
|
|
147
|
-
ReactSharedInternals.ReactCurrentActQueue = ReactCurrentActQueue
|
|
149
|
+
ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame
|
|
150
|
+
ReactSharedInternals.ReactCurrentActQueue = ReactCurrentActQueue
|
|
148
151
|
}
|
|
149
152
|
|
|
150
153
|
// by calls to these methods by a Babel plugin.
|
|
@@ -155,22 +158,34 @@
|
|
|
155
158
|
function warn(format) {
|
|
156
159
|
{
|
|
157
160
|
{
|
|
158
|
-
for (
|
|
159
|
-
|
|
161
|
+
for (
|
|
162
|
+
var _len = arguments.length,
|
|
163
|
+
args = new Array(_len > 1 ? _len - 1 : 0),
|
|
164
|
+
_key = 1;
|
|
165
|
+
_key < _len;
|
|
166
|
+
_key++
|
|
167
|
+
) {
|
|
168
|
+
args[_key - 1] = arguments[_key]
|
|
160
169
|
}
|
|
161
170
|
|
|
162
|
-
printWarning('warn', format, args)
|
|
171
|
+
printWarning('warn', format, args)
|
|
163
172
|
}
|
|
164
173
|
}
|
|
165
174
|
}
|
|
166
175
|
function error(format) {
|
|
167
176
|
{
|
|
168
177
|
{
|
|
169
|
-
for (
|
|
170
|
-
|
|
178
|
+
for (
|
|
179
|
+
var _len2 = arguments.length,
|
|
180
|
+
args = new Array(_len2 > 1 ? _len2 - 1 : 0),
|
|
181
|
+
_key2 = 1;
|
|
182
|
+
_key2 < _len2;
|
|
183
|
+
_key2++
|
|
184
|
+
) {
|
|
185
|
+
args[_key2 - 1] = arguments[_key2]
|
|
171
186
|
}
|
|
172
187
|
|
|
173
|
-
printWarning('error', format, args)
|
|
188
|
+
printWarning('error', format, args)
|
|
174
189
|
}
|
|
175
190
|
}
|
|
176
191
|
}
|
|
@@ -179,49 +194,55 @@
|
|
|
179
194
|
// When changing this logic, you might want to also
|
|
180
195
|
// update consoleWithStackDev.www.js as well.
|
|
181
196
|
{
|
|
182
|
-
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame
|
|
183
|
-
var stack = ReactDebugCurrentFrame.getStackAddendum()
|
|
197
|
+
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame
|
|
198
|
+
var stack = ReactDebugCurrentFrame.getStackAddendum()
|
|
184
199
|
|
|
185
200
|
if (stack !== '') {
|
|
186
|
-
format += '%s'
|
|
187
|
-
args = args.concat([stack])
|
|
201
|
+
format += '%s'
|
|
202
|
+
args = args.concat([stack])
|
|
188
203
|
} // eslint-disable-next-line react-internal/safe-string-coercion
|
|
189
204
|
|
|
190
|
-
|
|
191
205
|
var argsWithFormat = args.map(function (item) {
|
|
192
|
-
return String(item)
|
|
193
|
-
})
|
|
206
|
+
return String(item)
|
|
207
|
+
}) // Careful: RN currently depends on this prefix
|
|
194
208
|
|
|
195
|
-
argsWithFormat.unshift('Warning: ' + format)
|
|
209
|
+
argsWithFormat.unshift('Warning: ' + format) // We intentionally don't use spread (or .apply) directly because it
|
|
196
210
|
// breaks IE9: https://github.com/facebook/react/issues/13610
|
|
197
211
|
// eslint-disable-next-line react-internal/no-production-logging
|
|
198
212
|
|
|
199
|
-
Function.prototype.apply.call(console[level], console, argsWithFormat)
|
|
213
|
+
Function.prototype.apply.call(console[level], console, argsWithFormat)
|
|
200
214
|
}
|
|
201
215
|
}
|
|
202
216
|
|
|
203
|
-
var didWarnStateUpdateForUnmountedComponent = {}
|
|
217
|
+
var didWarnStateUpdateForUnmountedComponent = {}
|
|
204
218
|
|
|
205
219
|
function warnNoop(publicInstance, callerName) {
|
|
206
220
|
{
|
|
207
|
-
var _constructor = publicInstance.constructor
|
|
208
|
-
var componentName =
|
|
209
|
-
|
|
221
|
+
var _constructor = publicInstance.constructor
|
|
222
|
+
var componentName =
|
|
223
|
+
(_constructor && (_constructor.displayName || _constructor.name)) || 'ReactClass'
|
|
224
|
+
var warningKey = componentName + '.' + callerName
|
|
210
225
|
|
|
211
226
|
if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
|
|
212
|
-
return
|
|
227
|
+
return
|
|
213
228
|
}
|
|
214
229
|
|
|
215
|
-
error(
|
|
230
|
+
error(
|
|
231
|
+
"Can't call %s on a component that is not yet mounted. " +
|
|
232
|
+
'This is a no-op, but it might indicate a bug in your application. ' +
|
|
233
|
+
'Instead, assign to `this.state` directly or define a `state = {};` ' +
|
|
234
|
+
'class property with the desired state in the %s component.',
|
|
235
|
+
callerName,
|
|
236
|
+
componentName
|
|
237
|
+
)
|
|
216
238
|
|
|
217
|
-
didWarnStateUpdateForUnmountedComponent[warningKey] = true
|
|
239
|
+
didWarnStateUpdateForUnmountedComponent[warningKey] = true
|
|
218
240
|
}
|
|
219
241
|
}
|
|
220
242
|
/**
|
|
221
243
|
* This is the abstract API for an update queue.
|
|
222
244
|
*/
|
|
223
245
|
|
|
224
|
-
|
|
225
246
|
var ReactNoopUpdateQueue = {
|
|
226
247
|
/**
|
|
227
248
|
* Checks whether or not this composite component is mounted.
|
|
@@ -231,7 +252,7 @@
|
|
|
231
252
|
* @final
|
|
232
253
|
*/
|
|
233
254
|
isMounted: function (publicInstance) {
|
|
234
|
-
return false
|
|
255
|
+
return false
|
|
235
256
|
},
|
|
236
257
|
|
|
237
258
|
/**
|
|
@@ -250,7 +271,7 @@
|
|
|
250
271
|
* @internal
|
|
251
272
|
*/
|
|
252
273
|
enqueueForceUpdate: function (publicInstance, callback, callerName) {
|
|
253
|
-
warnNoop(publicInstance, 'forceUpdate')
|
|
274
|
+
warnNoop(publicInstance, 'forceUpdate')
|
|
254
275
|
},
|
|
255
276
|
|
|
256
277
|
/**
|
|
@@ -267,7 +288,7 @@
|
|
|
267
288
|
* @internal
|
|
268
289
|
*/
|
|
269
290
|
enqueueReplaceState: function (publicInstance, completeState, callback, callerName) {
|
|
270
|
-
warnNoop(publicInstance, 'replaceState')
|
|
291
|
+
warnNoop(publicInstance, 'replaceState')
|
|
271
292
|
},
|
|
272
293
|
|
|
273
294
|
/**
|
|
@@ -283,33 +304,32 @@
|
|
|
283
304
|
* @internal
|
|
284
305
|
*/
|
|
285
306
|
enqueueSetState: function (publicInstance, partialState, callback, callerName) {
|
|
286
|
-
warnNoop(publicInstance, 'setState')
|
|
287
|
-
}
|
|
288
|
-
}
|
|
307
|
+
warnNoop(publicInstance, 'setState')
|
|
308
|
+
},
|
|
309
|
+
}
|
|
289
310
|
|
|
290
|
-
var assign = Object.assign
|
|
311
|
+
var assign = Object.assign
|
|
291
312
|
|
|
292
|
-
var emptyObject = {}
|
|
313
|
+
var emptyObject = {}
|
|
293
314
|
|
|
294
315
|
{
|
|
295
|
-
Object.freeze(emptyObject)
|
|
316
|
+
Object.freeze(emptyObject)
|
|
296
317
|
}
|
|
297
318
|
/**
|
|
298
319
|
* Base class helpers for the updating state of a component.
|
|
299
320
|
*/
|
|
300
321
|
|
|
301
|
-
|
|
302
322
|
function Component(props, context, updater) {
|
|
303
|
-
this.props = props
|
|
304
|
-
this.context = context
|
|
323
|
+
this.props = props
|
|
324
|
+
this.context = context // If a component has string refs, we will assign a different object later.
|
|
305
325
|
|
|
306
|
-
this.refs = emptyObject
|
|
326
|
+
this.refs = emptyObject // We initialize the default updater but the real one gets injected by the
|
|
307
327
|
// renderer.
|
|
308
328
|
|
|
309
|
-
this.updater = updater || ReactNoopUpdateQueue
|
|
329
|
+
this.updater = updater || ReactNoopUpdateQueue
|
|
310
330
|
}
|
|
311
331
|
|
|
312
|
-
Component.prototype.isReactComponent = {}
|
|
332
|
+
Component.prototype.isReactComponent = {}
|
|
313
333
|
/**
|
|
314
334
|
* Sets a subset of the state. Always use this to mutate
|
|
315
335
|
* state. You should treat `this.state` as immutable.
|
|
@@ -337,12 +357,19 @@
|
|
|
337
357
|
*/
|
|
338
358
|
|
|
339
359
|
Component.prototype.setState = function (partialState, callback) {
|
|
340
|
-
if (
|
|
341
|
-
|
|
360
|
+
if (
|
|
361
|
+
typeof partialState !== 'object' &&
|
|
362
|
+
typeof partialState !== 'function' &&
|
|
363
|
+
partialState != null
|
|
364
|
+
) {
|
|
365
|
+
throw new Error(
|
|
366
|
+
'setState(...): takes an object of state variables to update or a ' +
|
|
367
|
+
'function which returns an object of state variables.'
|
|
368
|
+
)
|
|
342
369
|
}
|
|
343
370
|
|
|
344
|
-
this.updater.enqueueSetState(this, partialState, callback, 'setState')
|
|
345
|
-
}
|
|
371
|
+
this.updater.enqueueSetState(this, partialState, callback, 'setState')
|
|
372
|
+
}
|
|
346
373
|
/**
|
|
347
374
|
* Forces an update. This should only be invoked when it is known with
|
|
348
375
|
* certainty that we are **not** in a DOM transaction.
|
|
@@ -358,78 +385,88 @@
|
|
|
358
385
|
* @protected
|
|
359
386
|
*/
|
|
360
387
|
|
|
361
|
-
|
|
362
388
|
Component.prototype.forceUpdate = function (callback) {
|
|
363
|
-
this.updater.enqueueForceUpdate(this, callback, 'forceUpdate')
|
|
364
|
-
}
|
|
389
|
+
this.updater.enqueueForceUpdate(this, callback, 'forceUpdate')
|
|
390
|
+
}
|
|
365
391
|
/**
|
|
366
392
|
* Deprecated APIs. These APIs used to exist on classic React classes but since
|
|
367
393
|
* we would like to deprecate them, we're not going to move them over to this
|
|
368
394
|
* modern base class. Instead, we define a getter that warns if it's accessed.
|
|
369
395
|
*/
|
|
370
396
|
|
|
371
|
-
|
|
372
397
|
{
|
|
373
398
|
var deprecatedAPIs = {
|
|
374
|
-
isMounted: [
|
|
375
|
-
|
|
376
|
-
|
|
399
|
+
isMounted: [
|
|
400
|
+
'isMounted',
|
|
401
|
+
'Instead, make sure to clean up subscriptions and pending requests in ' +
|
|
402
|
+
'componentWillUnmount to prevent memory leaks.',
|
|
403
|
+
],
|
|
404
|
+
replaceState: [
|
|
405
|
+
'replaceState',
|
|
406
|
+
'Refactor your code to use setState instead (see ' +
|
|
407
|
+
'https://github.com/facebook/react/issues/3236).',
|
|
408
|
+
],
|
|
409
|
+
}
|
|
377
410
|
|
|
378
411
|
var defineDeprecationWarning = function (methodName, info) {
|
|
379
412
|
Object.defineProperty(Component.prototype, methodName, {
|
|
380
413
|
get: function () {
|
|
381
|
-
warn(
|
|
414
|
+
warn(
|
|
415
|
+
'%s(...) is deprecated in plain JavaScript React classes. %s',
|
|
416
|
+
info[0],
|
|
417
|
+
info[1]
|
|
418
|
+
)
|
|
382
419
|
|
|
383
|
-
return undefined
|
|
384
|
-
}
|
|
385
|
-
})
|
|
386
|
-
}
|
|
420
|
+
return undefined
|
|
421
|
+
},
|
|
422
|
+
})
|
|
423
|
+
}
|
|
387
424
|
|
|
388
425
|
for (var fnName in deprecatedAPIs) {
|
|
389
426
|
if (deprecatedAPIs.hasOwnProperty(fnName)) {
|
|
390
|
-
defineDeprecationWarning(fnName, deprecatedAPIs[fnName])
|
|
427
|
+
defineDeprecationWarning(fnName, deprecatedAPIs[fnName])
|
|
391
428
|
}
|
|
392
429
|
}
|
|
393
430
|
}
|
|
394
431
|
|
|
395
432
|
function ComponentDummy() {}
|
|
396
433
|
|
|
397
|
-
ComponentDummy.prototype = Component.prototype
|
|
434
|
+
ComponentDummy.prototype = Component.prototype
|
|
398
435
|
/**
|
|
399
436
|
* Convenience component with default shallow equality check for sCU.
|
|
400
437
|
*/
|
|
401
438
|
|
|
402
439
|
function PureComponent(props, context, updater) {
|
|
403
|
-
this.props = props
|
|
404
|
-
this.context = context
|
|
440
|
+
this.props = props
|
|
441
|
+
this.context = context // If a component has string refs, we will assign a different object later.
|
|
405
442
|
|
|
406
|
-
this.refs = emptyObject
|
|
407
|
-
this.updater = updater || ReactNoopUpdateQueue
|
|
443
|
+
this.refs = emptyObject
|
|
444
|
+
this.updater = updater || ReactNoopUpdateQueue
|
|
408
445
|
}
|
|
409
446
|
|
|
410
|
-
var pureComponentPrototype = PureComponent.prototype = new ComponentDummy()
|
|
411
|
-
pureComponentPrototype.constructor = PureComponent
|
|
447
|
+
var pureComponentPrototype = (PureComponent.prototype = new ComponentDummy())
|
|
448
|
+
pureComponentPrototype.constructor = PureComponent // Avoid an extra prototype jump for these methods.
|
|
412
449
|
|
|
413
|
-
assign(pureComponentPrototype, Component.prototype)
|
|
414
|
-
pureComponentPrototype.isPureReactComponent = true
|
|
450
|
+
assign(pureComponentPrototype, Component.prototype)
|
|
451
|
+
pureComponentPrototype.isPureReactComponent = true
|
|
415
452
|
|
|
416
453
|
// an immutable object with a single mutable value
|
|
417
454
|
function createRef() {
|
|
418
455
|
var refObject = {
|
|
419
|
-
current: null
|
|
420
|
-
}
|
|
456
|
+
current: null,
|
|
457
|
+
}
|
|
421
458
|
|
|
422
459
|
{
|
|
423
|
-
Object.seal(refObject)
|
|
460
|
+
Object.seal(refObject)
|
|
424
461
|
}
|
|
425
462
|
|
|
426
|
-
return refObject
|
|
463
|
+
return refObject
|
|
427
464
|
}
|
|
428
465
|
|
|
429
|
-
var isArrayImpl = Array.isArray
|
|
466
|
+
var isArrayImpl = Array.isArray // eslint-disable-next-line no-redeclare
|
|
430
467
|
|
|
431
468
|
function isArray(a) {
|
|
432
|
-
return isArrayImpl(a)
|
|
469
|
+
return isArrayImpl(a)
|
|
433
470
|
}
|
|
434
471
|
|
|
435
472
|
/*
|
|
@@ -445,20 +482,22 @@
|
|
|
445
482
|
function typeName(value) {
|
|
446
483
|
{
|
|
447
484
|
// toStringTag is needed for namespaced types like Temporal.Instant
|
|
448
|
-
var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag
|
|
449
|
-
var type =
|
|
450
|
-
|
|
485
|
+
var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag
|
|
486
|
+
var type =
|
|
487
|
+
(hasToStringTag && value[Symbol.toStringTag]) ||
|
|
488
|
+
value.constructor.name ||
|
|
489
|
+
'Object'
|
|
490
|
+
return type
|
|
451
491
|
}
|
|
452
492
|
} // $FlowFixMe only called in DEV, so void return is not possible.
|
|
453
493
|
|
|
454
|
-
|
|
455
494
|
function willCoercionThrow(value) {
|
|
456
495
|
{
|
|
457
496
|
try {
|
|
458
|
-
testStringCoercion(value)
|
|
459
|
-
return false
|
|
497
|
+
testStringCoercion(value)
|
|
498
|
+
return false
|
|
460
499
|
} catch (e) {
|
|
461
|
-
return true
|
|
500
|
+
return true
|
|
462
501
|
}
|
|
463
502
|
}
|
|
464
503
|
}
|
|
@@ -487,205 +526,234 @@
|
|
|
487
526
|
// ancestor components where the exception happened.
|
|
488
527
|
//
|
|
489
528
|
// eslint-disable-next-line react-internal/safe-string-coercion
|
|
490
|
-
return '' + value
|
|
529
|
+
return '' + value
|
|
491
530
|
}
|
|
492
531
|
function checkKeyStringCoercion(value) {
|
|
493
532
|
{
|
|
494
533
|
if (willCoercionThrow(value)) {
|
|
495
|
-
error(
|
|
534
|
+
error(
|
|
535
|
+
'The provided key is an unsupported type %s.' +
|
|
536
|
+
' This value must be coerced to a string before before using it here.',
|
|
537
|
+
typeName(value)
|
|
538
|
+
)
|
|
496
539
|
|
|
497
|
-
return testStringCoercion(value)
|
|
540
|
+
return testStringCoercion(value) // throw (to help callers find troubleshooting comments)
|
|
498
541
|
}
|
|
499
542
|
}
|
|
500
543
|
}
|
|
501
544
|
|
|
502
545
|
function getWrappedName(outerType, innerType, wrapperName) {
|
|
503
|
-
var displayName = outerType.displayName
|
|
546
|
+
var displayName = outerType.displayName
|
|
504
547
|
|
|
505
548
|
if (displayName) {
|
|
506
|
-
return displayName
|
|
549
|
+
return displayName
|
|
507
550
|
}
|
|
508
551
|
|
|
509
|
-
var functionName = innerType.displayName || innerType.name || ''
|
|
510
|
-
return functionName !== '' ? wrapperName +
|
|
552
|
+
var functionName = innerType.displayName || innerType.name || ''
|
|
553
|
+
return functionName !== '' ? wrapperName + '(' + functionName + ')' : wrapperName
|
|
511
554
|
} // Keep in sync with react-reconciler/getComponentNameFromFiber
|
|
512
555
|
|
|
513
|
-
|
|
514
556
|
function getContextName(type) {
|
|
515
|
-
return type.displayName || 'Context'
|
|
557
|
+
return type.displayName || 'Context'
|
|
516
558
|
} // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
|
|
517
559
|
|
|
518
|
-
|
|
519
560
|
function getComponentNameFromType(type) {
|
|
520
561
|
if (type == null) {
|
|
521
562
|
// Host root, text node or just invalid type.
|
|
522
|
-
return null
|
|
563
|
+
return null
|
|
523
564
|
}
|
|
524
565
|
|
|
525
566
|
{
|
|
526
567
|
if (typeof type.tag === 'number') {
|
|
527
|
-
error(
|
|
568
|
+
error(
|
|
569
|
+
'Received an unexpected object in getComponentNameFromType(). ' +
|
|
570
|
+
'This is likely a bug in React. Please file an issue.'
|
|
571
|
+
)
|
|
528
572
|
}
|
|
529
573
|
}
|
|
530
574
|
|
|
531
575
|
if (typeof type === 'function') {
|
|
532
|
-
return type.displayName || type.name || null
|
|
576
|
+
return type.displayName || type.name || null
|
|
533
577
|
}
|
|
534
578
|
|
|
535
579
|
if (typeof type === 'string') {
|
|
536
|
-
return type
|
|
580
|
+
return type
|
|
537
581
|
}
|
|
538
582
|
|
|
539
583
|
switch (type) {
|
|
540
584
|
case REACT_FRAGMENT_TYPE:
|
|
541
|
-
return 'Fragment'
|
|
585
|
+
return 'Fragment'
|
|
542
586
|
|
|
543
587
|
case REACT_PORTAL_TYPE:
|
|
544
|
-
return 'Portal'
|
|
588
|
+
return 'Portal'
|
|
545
589
|
|
|
546
590
|
case REACT_PROFILER_TYPE:
|
|
547
|
-
return 'Profiler'
|
|
591
|
+
return 'Profiler'
|
|
548
592
|
|
|
549
593
|
case REACT_STRICT_MODE_TYPE:
|
|
550
|
-
return 'StrictMode'
|
|
594
|
+
return 'StrictMode'
|
|
551
595
|
|
|
552
596
|
case REACT_SUSPENSE_TYPE:
|
|
553
|
-
return 'Suspense'
|
|
597
|
+
return 'Suspense'
|
|
554
598
|
|
|
555
599
|
case REACT_SUSPENSE_LIST_TYPE:
|
|
556
|
-
return 'SuspenseList'
|
|
557
|
-
|
|
600
|
+
return 'SuspenseList'
|
|
558
601
|
}
|
|
559
602
|
|
|
560
603
|
if (typeof type === 'object') {
|
|
561
604
|
switch (type.$$typeof) {
|
|
562
605
|
case REACT_CONTEXT_TYPE:
|
|
563
|
-
var context = type
|
|
564
|
-
return getContextName(context) + '.Consumer'
|
|
606
|
+
var context = type
|
|
607
|
+
return getContextName(context) + '.Consumer'
|
|
565
608
|
|
|
566
609
|
case REACT_PROVIDER_TYPE:
|
|
567
|
-
var provider = type
|
|
568
|
-
return getContextName(provider._context) + '.Provider'
|
|
610
|
+
var provider = type
|
|
611
|
+
return getContextName(provider._context) + '.Provider'
|
|
569
612
|
|
|
570
613
|
case REACT_FORWARD_REF_TYPE:
|
|
571
|
-
return getWrappedName(type, type.render, 'ForwardRef')
|
|
614
|
+
return getWrappedName(type, type.render, 'ForwardRef')
|
|
572
615
|
|
|
573
616
|
case REACT_MEMO_TYPE:
|
|
574
|
-
var outerName = type.displayName || null
|
|
617
|
+
var outerName = type.displayName || null
|
|
575
618
|
|
|
576
619
|
if (outerName !== null) {
|
|
577
|
-
return outerName
|
|
620
|
+
return outerName
|
|
578
621
|
}
|
|
579
622
|
|
|
580
|
-
return getComponentNameFromType(type.type) || 'Memo'
|
|
623
|
+
return getComponentNameFromType(type.type) || 'Memo'
|
|
581
624
|
|
|
582
|
-
case REACT_LAZY_TYPE:
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
return null;
|
|
592
|
-
}
|
|
625
|
+
case REACT_LAZY_TYPE: {
|
|
626
|
+
var lazyComponent = type
|
|
627
|
+
var payload = lazyComponent._payload
|
|
628
|
+
var init = lazyComponent._init
|
|
629
|
+
|
|
630
|
+
try {
|
|
631
|
+
return getComponentNameFromType(init(payload))
|
|
632
|
+
} catch (x) {
|
|
633
|
+
return null
|
|
593
634
|
}
|
|
635
|
+
}
|
|
594
636
|
|
|
595
637
|
// eslint-disable-next-line no-fallthrough
|
|
596
638
|
}
|
|
597
639
|
}
|
|
598
640
|
|
|
599
|
-
return null
|
|
641
|
+
return null
|
|
600
642
|
}
|
|
601
643
|
|
|
602
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty
|
|
644
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty
|
|
603
645
|
|
|
604
646
|
var RESERVED_PROPS = {
|
|
605
647
|
key: true,
|
|
606
648
|
ref: true,
|
|
607
649
|
__self: true,
|
|
608
|
-
__source: true
|
|
609
|
-
}
|
|
610
|
-
var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs
|
|
650
|
+
__source: true,
|
|
651
|
+
}
|
|
652
|
+
var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs
|
|
611
653
|
|
|
612
654
|
{
|
|
613
|
-
didWarnAboutStringRefs = {}
|
|
655
|
+
didWarnAboutStringRefs = {}
|
|
614
656
|
}
|
|
615
657
|
|
|
616
658
|
function hasValidRef(config) {
|
|
617
659
|
{
|
|
618
660
|
if (hasOwnProperty.call(config, 'ref')) {
|
|
619
|
-
var getter = Object.getOwnPropertyDescriptor(config, 'ref').get
|
|
661
|
+
var getter = Object.getOwnPropertyDescriptor(config, 'ref').get
|
|
620
662
|
|
|
621
663
|
if (getter && getter.isReactWarning) {
|
|
622
|
-
return false
|
|
664
|
+
return false
|
|
623
665
|
}
|
|
624
666
|
}
|
|
625
667
|
}
|
|
626
668
|
|
|
627
|
-
return config.ref !== undefined
|
|
669
|
+
return config.ref !== undefined
|
|
628
670
|
}
|
|
629
671
|
|
|
630
672
|
function hasValidKey(config) {
|
|
631
673
|
{
|
|
632
674
|
if (hasOwnProperty.call(config, 'key')) {
|
|
633
|
-
var getter = Object.getOwnPropertyDescriptor(config, 'key').get
|
|
675
|
+
var getter = Object.getOwnPropertyDescriptor(config, 'key').get
|
|
634
676
|
|
|
635
677
|
if (getter && getter.isReactWarning) {
|
|
636
|
-
return false
|
|
678
|
+
return false
|
|
637
679
|
}
|
|
638
680
|
}
|
|
639
681
|
}
|
|
640
682
|
|
|
641
|
-
return config.key !== undefined
|
|
683
|
+
return config.key !== undefined
|
|
642
684
|
}
|
|
643
685
|
|
|
644
686
|
function defineKeyPropWarningGetter(props, displayName) {
|
|
645
687
|
var warnAboutAccessingKey = function () {
|
|
646
688
|
{
|
|
647
689
|
if (!specialPropKeyWarningShown) {
|
|
648
|
-
specialPropKeyWarningShown = true
|
|
649
|
-
|
|
650
|
-
error(
|
|
690
|
+
specialPropKeyWarningShown = true
|
|
691
|
+
|
|
692
|
+
error(
|
|
693
|
+
'%s: `key` is not a prop. Trying to access it will result ' +
|
|
694
|
+
'in `undefined` being returned. If you need to access the same ' +
|
|
695
|
+
'value within the child component, you should pass it as a different ' +
|
|
696
|
+
'prop. (https://reactjs.org/link/special-props)',
|
|
697
|
+
displayName
|
|
698
|
+
)
|
|
651
699
|
}
|
|
652
700
|
}
|
|
653
|
-
}
|
|
701
|
+
}
|
|
654
702
|
|
|
655
|
-
warnAboutAccessingKey.isReactWarning = true
|
|
703
|
+
warnAboutAccessingKey.isReactWarning = true
|
|
656
704
|
Object.defineProperty(props, 'key', {
|
|
657
705
|
get: warnAboutAccessingKey,
|
|
658
|
-
configurable: true
|
|
659
|
-
})
|
|
706
|
+
configurable: true,
|
|
707
|
+
})
|
|
660
708
|
}
|
|
661
709
|
|
|
662
710
|
function defineRefPropWarningGetter(props, displayName) {
|
|
663
711
|
var warnAboutAccessingRef = function () {
|
|
664
712
|
{
|
|
665
713
|
if (!specialPropRefWarningShown) {
|
|
666
|
-
specialPropRefWarningShown = true
|
|
667
|
-
|
|
668
|
-
error(
|
|
714
|
+
specialPropRefWarningShown = true
|
|
715
|
+
|
|
716
|
+
error(
|
|
717
|
+
'%s: `ref` is not a prop. Trying to access it will result ' +
|
|
718
|
+
'in `undefined` being returned. If you need to access the same ' +
|
|
719
|
+
'value within the child component, you should pass it as a different ' +
|
|
720
|
+
'prop. (https://reactjs.org/link/special-props)',
|
|
721
|
+
displayName
|
|
722
|
+
)
|
|
669
723
|
}
|
|
670
724
|
}
|
|
671
|
-
}
|
|
725
|
+
}
|
|
672
726
|
|
|
673
|
-
warnAboutAccessingRef.isReactWarning = true
|
|
727
|
+
warnAboutAccessingRef.isReactWarning = true
|
|
674
728
|
Object.defineProperty(props, 'ref', {
|
|
675
729
|
get: warnAboutAccessingRef,
|
|
676
|
-
configurable: true
|
|
677
|
-
})
|
|
730
|
+
configurable: true,
|
|
731
|
+
})
|
|
678
732
|
}
|
|
679
733
|
|
|
680
734
|
function warnIfStringRefCannotBeAutoConverted(config) {
|
|
681
735
|
{
|
|
682
|
-
if (
|
|
683
|
-
|
|
736
|
+
if (
|
|
737
|
+
typeof config.ref === 'string' &&
|
|
738
|
+
ReactCurrentOwner.current &&
|
|
739
|
+
config.__self &&
|
|
740
|
+
ReactCurrentOwner.current.stateNode !== config.__self
|
|
741
|
+
) {
|
|
742
|
+
var componentName = getComponentNameFromType(ReactCurrentOwner.current.type)
|
|
684
743
|
|
|
685
744
|
if (!didWarnAboutStringRefs[componentName]) {
|
|
686
|
-
error(
|
|
687
|
-
|
|
688
|
-
|
|
745
|
+
error(
|
|
746
|
+
'Component "%s" contains the string ref "%s". ' +
|
|
747
|
+
'Support for string refs will be removed in a future major release. ' +
|
|
748
|
+
'This case cannot be automatically converted to an arrow function. ' +
|
|
749
|
+
'We ask you to manually fix this case by using useRef() or createRef() instead. ' +
|
|
750
|
+
'Learn more about using refs safely here: ' +
|
|
751
|
+
'https://reactjs.org/link/strict-mode-string-ref',
|
|
752
|
+
componentName,
|
|
753
|
+
config.ref
|
|
754
|
+
)
|
|
755
|
+
|
|
756
|
+
didWarnAboutStringRefs[componentName] = true
|
|
689
757
|
}
|
|
690
758
|
}
|
|
691
759
|
}
|
|
@@ -711,7 +779,6 @@
|
|
|
711
779
|
* @internal
|
|
712
780
|
*/
|
|
713
781
|
|
|
714
|
-
|
|
715
782
|
var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
716
783
|
var element = {
|
|
717
784
|
// This tag allows us to uniquely identify this as a React Element
|
|
@@ -722,15 +789,15 @@
|
|
|
722
789
|
ref: ref,
|
|
723
790
|
props: props,
|
|
724
791
|
// Record the component responsible for creating this element.
|
|
725
|
-
_owner: owner
|
|
726
|
-
}
|
|
792
|
+
_owner: owner,
|
|
793
|
+
}
|
|
727
794
|
|
|
728
795
|
{
|
|
729
796
|
// The validation flag is currently mutative. We put it on
|
|
730
797
|
// an external backing store so that we can freeze the whole object.
|
|
731
798
|
// This can be replaced with a WeakMap once they are implemented in
|
|
732
799
|
// commonly used development environments.
|
|
733
|
-
element._store = {}
|
|
800
|
+
element._store = {} // To make comparing ReactElements easier for testing purposes, we make
|
|
734
801
|
// the validation flag non-enumerable (where possible, which should
|
|
735
802
|
// include every environment we run tests in), so the test framework
|
|
736
803
|
// ignores it.
|
|
@@ -739,125 +806,135 @@
|
|
|
739
806
|
configurable: false,
|
|
740
807
|
enumerable: false,
|
|
741
808
|
writable: true,
|
|
742
|
-
value: false
|
|
743
|
-
})
|
|
809
|
+
value: false,
|
|
810
|
+
}) // self and source are DEV only properties.
|
|
744
811
|
|
|
745
812
|
Object.defineProperty(element, '_self', {
|
|
746
813
|
configurable: false,
|
|
747
814
|
enumerable: false,
|
|
748
815
|
writable: false,
|
|
749
|
-
value: self
|
|
750
|
-
})
|
|
816
|
+
value: self,
|
|
817
|
+
}) // Two elements created in two different places should be considered
|
|
751
818
|
// equal for testing purposes and therefore we hide it from enumeration.
|
|
752
819
|
|
|
753
820
|
Object.defineProperty(element, '_source', {
|
|
754
821
|
configurable: false,
|
|
755
822
|
enumerable: false,
|
|
756
823
|
writable: false,
|
|
757
|
-
value: source
|
|
758
|
-
})
|
|
824
|
+
value: source,
|
|
825
|
+
})
|
|
759
826
|
|
|
760
827
|
if (Object.freeze) {
|
|
761
|
-
Object.freeze(element.props)
|
|
762
|
-
Object.freeze(element)
|
|
828
|
+
Object.freeze(element.props)
|
|
829
|
+
Object.freeze(element)
|
|
763
830
|
}
|
|
764
831
|
}
|
|
765
832
|
|
|
766
|
-
return element
|
|
767
|
-
}
|
|
833
|
+
return element
|
|
834
|
+
}
|
|
768
835
|
/**
|
|
769
836
|
* Create and return a new ReactElement of the given type.
|
|
770
837
|
* See https://reactjs.org/docs/react-api.html#createelement
|
|
771
838
|
*/
|
|
772
839
|
|
|
773
840
|
function createElement(type, config, children) {
|
|
774
|
-
var propName
|
|
841
|
+
var propName // Reserved names are extracted
|
|
775
842
|
|
|
776
|
-
var props = {}
|
|
777
|
-
var key = null
|
|
778
|
-
var ref = null
|
|
779
|
-
var self = null
|
|
780
|
-
var source = null
|
|
843
|
+
var props = {}
|
|
844
|
+
var key = null
|
|
845
|
+
var ref = null
|
|
846
|
+
var self = null
|
|
847
|
+
var source = null
|
|
781
848
|
|
|
782
849
|
if (config != null) {
|
|
783
850
|
if (hasValidRef(config)) {
|
|
784
|
-
ref = config.ref
|
|
851
|
+
ref = config.ref
|
|
785
852
|
|
|
786
853
|
{
|
|
787
|
-
warnIfStringRefCannotBeAutoConverted(config)
|
|
854
|
+
warnIfStringRefCannotBeAutoConverted(config)
|
|
788
855
|
}
|
|
789
856
|
}
|
|
790
857
|
|
|
791
858
|
if (hasValidKey(config)) {
|
|
792
859
|
{
|
|
793
|
-
checkKeyStringCoercion(config.key)
|
|
860
|
+
checkKeyStringCoercion(config.key)
|
|
794
861
|
}
|
|
795
862
|
|
|
796
|
-
key = '' + config.key
|
|
863
|
+
key = '' + config.key
|
|
797
864
|
}
|
|
798
865
|
|
|
799
|
-
self = config.__self === undefined ? null : config.__self
|
|
800
|
-
source = config.__source === undefined ? null : config.__source
|
|
866
|
+
self = config.__self === undefined ? null : config.__self
|
|
867
|
+
source = config.__source === undefined ? null : config.__source // Remaining properties are added to a new props object
|
|
801
868
|
|
|
802
869
|
for (propName in config) {
|
|
803
|
-
if (
|
|
804
|
-
|
|
870
|
+
if (
|
|
871
|
+
hasOwnProperty.call(config, propName) &&
|
|
872
|
+
!RESERVED_PROPS.hasOwnProperty(propName)
|
|
873
|
+
) {
|
|
874
|
+
props[propName] = config[propName]
|
|
805
875
|
}
|
|
806
876
|
}
|
|
807
877
|
} // Children can be more than one argument, and those are transferred onto
|
|
808
878
|
// the newly allocated props object.
|
|
809
879
|
|
|
810
|
-
|
|
811
|
-
var childrenLength = arguments.length - 2;
|
|
880
|
+
var childrenLength = arguments.length - 2
|
|
812
881
|
|
|
813
882
|
if (childrenLength === 1) {
|
|
814
|
-
props.children = children
|
|
883
|
+
props.children = children
|
|
815
884
|
} else if (childrenLength > 1) {
|
|
816
|
-
var childArray = Array(childrenLength)
|
|
885
|
+
var childArray = Array(childrenLength)
|
|
817
886
|
|
|
818
887
|
for (var i = 0; i < childrenLength; i++) {
|
|
819
|
-
childArray[i] = arguments[i + 2]
|
|
888
|
+
childArray[i] = arguments[i + 2]
|
|
820
889
|
}
|
|
821
890
|
|
|
822
891
|
{
|
|
823
892
|
if (Object.freeze) {
|
|
824
|
-
Object.freeze(childArray)
|
|
893
|
+
Object.freeze(childArray)
|
|
825
894
|
}
|
|
826
895
|
}
|
|
827
896
|
|
|
828
|
-
props.children = childArray
|
|
897
|
+
props.children = childArray
|
|
829
898
|
} // Resolve default props
|
|
830
899
|
|
|
831
|
-
|
|
832
900
|
if (type && type.defaultProps) {
|
|
833
|
-
var defaultProps = type.defaultProps
|
|
901
|
+
var defaultProps = type.defaultProps
|
|
834
902
|
|
|
835
903
|
for (propName in defaultProps) {
|
|
836
904
|
if (props[propName] === undefined) {
|
|
837
|
-
props[propName] = defaultProps[propName]
|
|
905
|
+
props[propName] = defaultProps[propName]
|
|
838
906
|
}
|
|
839
907
|
}
|
|
840
908
|
}
|
|
841
909
|
|
|
842
910
|
{
|
|
843
911
|
if (key || ref) {
|
|
844
|
-
var displayName =
|
|
912
|
+
var displayName =
|
|
913
|
+
typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type
|
|
845
914
|
|
|
846
915
|
if (key) {
|
|
847
|
-
defineKeyPropWarningGetter(props, displayName)
|
|
916
|
+
defineKeyPropWarningGetter(props, displayName)
|
|
848
917
|
}
|
|
849
918
|
|
|
850
919
|
if (ref) {
|
|
851
|
-
defineRefPropWarningGetter(props, displayName)
|
|
920
|
+
defineRefPropWarningGetter(props, displayName)
|
|
852
921
|
}
|
|
853
922
|
}
|
|
854
923
|
}
|
|
855
924
|
|
|
856
|
-
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props)
|
|
925
|
+
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props)
|
|
857
926
|
}
|
|
858
927
|
function cloneAndReplaceKey(oldElement, newKey) {
|
|
859
|
-
var newElement = ReactElement(
|
|
860
|
-
|
|
928
|
+
var newElement = ReactElement(
|
|
929
|
+
oldElement.type,
|
|
930
|
+
newKey,
|
|
931
|
+
oldElement.ref,
|
|
932
|
+
oldElement._self,
|
|
933
|
+
oldElement._source,
|
|
934
|
+
oldElement._owner,
|
|
935
|
+
oldElement.props
|
|
936
|
+
)
|
|
937
|
+
return newElement
|
|
861
938
|
}
|
|
862
939
|
/**
|
|
863
940
|
* Clone and return a new ReactElement using element as the starting point.
|
|
@@ -866,75 +943,80 @@
|
|
|
866
943
|
|
|
867
944
|
function cloneElement(element, config, children) {
|
|
868
945
|
if (element === null || element === undefined) {
|
|
869
|
-
throw new Error(
|
|
946
|
+
throw new Error(
|
|
947
|
+
'React.cloneElement(...): The argument must be a React element, but you passed ' +
|
|
948
|
+
element +
|
|
949
|
+
'.'
|
|
950
|
+
)
|
|
870
951
|
}
|
|
871
952
|
|
|
872
|
-
var propName
|
|
953
|
+
var propName // Original props are copied
|
|
873
954
|
|
|
874
|
-
var props = assign({}, element.props)
|
|
955
|
+
var props = assign({}, element.props) // Reserved names are extracted
|
|
875
956
|
|
|
876
|
-
var key = element.key
|
|
877
|
-
var ref = element.ref
|
|
957
|
+
var key = element.key
|
|
958
|
+
var ref = element.ref // Self is preserved since the owner is preserved.
|
|
878
959
|
|
|
879
|
-
var self = element._self
|
|
960
|
+
var self = element._self // Source is preserved since cloneElement is unlikely to be targeted by a
|
|
880
961
|
// transpiler, and the original source is probably a better indicator of the
|
|
881
962
|
// true owner.
|
|
882
963
|
|
|
883
|
-
var source = element._source
|
|
964
|
+
var source = element._source // Owner will be preserved, unless ref is overridden
|
|
884
965
|
|
|
885
|
-
var owner = element._owner
|
|
966
|
+
var owner = element._owner
|
|
886
967
|
|
|
887
968
|
if (config != null) {
|
|
888
969
|
if (hasValidRef(config)) {
|
|
889
970
|
// Silently steal the ref from the parent.
|
|
890
|
-
ref = config.ref
|
|
891
|
-
owner = ReactCurrentOwner.current
|
|
971
|
+
ref = config.ref
|
|
972
|
+
owner = ReactCurrentOwner.current
|
|
892
973
|
}
|
|
893
974
|
|
|
894
975
|
if (hasValidKey(config)) {
|
|
895
976
|
{
|
|
896
|
-
checkKeyStringCoercion(config.key)
|
|
977
|
+
checkKeyStringCoercion(config.key)
|
|
897
978
|
}
|
|
898
979
|
|
|
899
|
-
key = '' + config.key
|
|
980
|
+
key = '' + config.key
|
|
900
981
|
} // Remaining properties override existing props
|
|
901
982
|
|
|
902
|
-
|
|
903
|
-
var defaultProps;
|
|
983
|
+
var defaultProps
|
|
904
984
|
|
|
905
985
|
if (element.type && element.type.defaultProps) {
|
|
906
|
-
defaultProps = element.type.defaultProps
|
|
986
|
+
defaultProps = element.type.defaultProps
|
|
907
987
|
}
|
|
908
988
|
|
|
909
989
|
for (propName in config) {
|
|
910
|
-
if (
|
|
990
|
+
if (
|
|
991
|
+
hasOwnProperty.call(config, propName) &&
|
|
992
|
+
!RESERVED_PROPS.hasOwnProperty(propName)
|
|
993
|
+
) {
|
|
911
994
|
if (config[propName] === undefined && defaultProps !== undefined) {
|
|
912
995
|
// Resolve default props
|
|
913
|
-
props[propName] = defaultProps[propName]
|
|
996
|
+
props[propName] = defaultProps[propName]
|
|
914
997
|
} else {
|
|
915
|
-
props[propName] = config[propName]
|
|
998
|
+
props[propName] = config[propName]
|
|
916
999
|
}
|
|
917
1000
|
}
|
|
918
1001
|
}
|
|
919
1002
|
} // Children can be more than one argument, and those are transferred onto
|
|
920
1003
|
// the newly allocated props object.
|
|
921
1004
|
|
|
922
|
-
|
|
923
|
-
var childrenLength = arguments.length - 2;
|
|
1005
|
+
var childrenLength = arguments.length - 2
|
|
924
1006
|
|
|
925
1007
|
if (childrenLength === 1) {
|
|
926
|
-
props.children = children
|
|
1008
|
+
props.children = children
|
|
927
1009
|
} else if (childrenLength > 1) {
|
|
928
|
-
var childArray = Array(childrenLength)
|
|
1010
|
+
var childArray = Array(childrenLength)
|
|
929
1011
|
|
|
930
1012
|
for (var i = 0; i < childrenLength; i++) {
|
|
931
|
-
childArray[i] = arguments[i + 2]
|
|
1013
|
+
childArray[i] = arguments[i + 2]
|
|
932
1014
|
}
|
|
933
1015
|
|
|
934
|
-
props.children = childArray
|
|
1016
|
+
props.children = childArray
|
|
935
1017
|
}
|
|
936
1018
|
|
|
937
|
-
return ReactElement(element.type, key, ref, self, source, owner, props)
|
|
1019
|
+
return ReactElement(element.type, key, ref, self, source, owner, props)
|
|
938
1020
|
}
|
|
939
1021
|
/**
|
|
940
1022
|
* Verifies the object is a ReactElement.
|
|
@@ -945,11 +1027,15 @@
|
|
|
945
1027
|
*/
|
|
946
1028
|
|
|
947
1029
|
function isValidElement(object) {
|
|
948
|
-
return
|
|
1030
|
+
return (
|
|
1031
|
+
typeof object === 'object' &&
|
|
1032
|
+
object !== null &&
|
|
1033
|
+
object.$$typeof === REACT_ELEMENT_TYPE
|
|
1034
|
+
)
|
|
949
1035
|
}
|
|
950
1036
|
|
|
951
|
-
var SEPARATOR = '.'
|
|
952
|
-
var SUBSEPARATOR = ':'
|
|
1037
|
+
var SEPARATOR = '.'
|
|
1038
|
+
var SUBSEPARATOR = ':'
|
|
953
1039
|
/**
|
|
954
1040
|
* Escape and wrap key so it is safe to use as a reactid
|
|
955
1041
|
*
|
|
@@ -958,27 +1044,26 @@
|
|
|
958
1044
|
*/
|
|
959
1045
|
|
|
960
1046
|
function escape(key) {
|
|
961
|
-
var escapeRegex = /[=:]/g
|
|
1047
|
+
var escapeRegex = /[=:]/g
|
|
962
1048
|
var escaperLookup = {
|
|
963
1049
|
'=': '=0',
|
|
964
|
-
':': '=2'
|
|
965
|
-
}
|
|
1050
|
+
':': '=2',
|
|
1051
|
+
}
|
|
966
1052
|
var escapedString = key.replace(escapeRegex, function (match) {
|
|
967
|
-
return escaperLookup[match]
|
|
968
|
-
})
|
|
969
|
-
return '$' + escapedString
|
|
1053
|
+
return escaperLookup[match]
|
|
1054
|
+
})
|
|
1055
|
+
return '$' + escapedString
|
|
970
1056
|
}
|
|
971
1057
|
/**
|
|
972
1058
|
* TODO: Test that a single child and an array with one item have the same key
|
|
973
1059
|
* pattern.
|
|
974
1060
|
*/
|
|
975
1061
|
|
|
976
|
-
|
|
977
|
-
var
|
|
978
|
-
var userProvidedKeyEscapeRegex = /\/+/g;
|
|
1062
|
+
var didWarnAboutMaps = false
|
|
1063
|
+
var userProvidedKeyEscapeRegex = /\/+/g
|
|
979
1064
|
|
|
980
1065
|
function escapeUserProvidedKey(text) {
|
|
981
|
-
return text.replace(userProvidedKeyEscapeRegex, '$&/')
|
|
1066
|
+
return text.replace(userProvidedKeyEscapeRegex, '$&/')
|
|
982
1067
|
}
|
|
983
1068
|
/**
|
|
984
1069
|
* Generate a key string that identifies a element within a set.
|
|
@@ -988,69 +1073,66 @@
|
|
|
988
1073
|
* @return {string}
|
|
989
1074
|
*/
|
|
990
1075
|
|
|
991
|
-
|
|
992
1076
|
function getElementKey(element, index) {
|
|
993
1077
|
// Do some typechecking here since we call this blindly. We want to ensure
|
|
994
1078
|
// that we don't block potential future ES APIs.
|
|
995
1079
|
if (typeof element === 'object' && element !== null && element.key != null) {
|
|
996
1080
|
// Explicit key
|
|
997
1081
|
{
|
|
998
|
-
checkKeyStringCoercion(element.key)
|
|
1082
|
+
checkKeyStringCoercion(element.key)
|
|
999
1083
|
}
|
|
1000
1084
|
|
|
1001
|
-
return escape('' + element.key)
|
|
1085
|
+
return escape('' + element.key)
|
|
1002
1086
|
} // Implicit key determined by the index in the set
|
|
1003
1087
|
|
|
1004
|
-
|
|
1005
|
-
return index.toString(36);
|
|
1088
|
+
return index.toString(36)
|
|
1006
1089
|
}
|
|
1007
1090
|
|
|
1008
1091
|
function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
|
|
1009
|
-
var type = typeof children
|
|
1092
|
+
var type = typeof children
|
|
1010
1093
|
|
|
1011
1094
|
if (type === 'undefined' || type === 'boolean') {
|
|
1012
1095
|
// All of the above are perceived as null.
|
|
1013
|
-
children = null
|
|
1096
|
+
children = null
|
|
1014
1097
|
}
|
|
1015
1098
|
|
|
1016
|
-
var invokeCallback = false
|
|
1099
|
+
var invokeCallback = false
|
|
1017
1100
|
|
|
1018
1101
|
if (children === null) {
|
|
1019
|
-
invokeCallback = true
|
|
1102
|
+
invokeCallback = true
|
|
1020
1103
|
} else {
|
|
1021
1104
|
switch (type) {
|
|
1022
1105
|
case 'string':
|
|
1023
1106
|
case 'number':
|
|
1024
|
-
invokeCallback = true
|
|
1025
|
-
break
|
|
1107
|
+
invokeCallback = true
|
|
1108
|
+
break
|
|
1026
1109
|
|
|
1027
1110
|
case 'object':
|
|
1028
1111
|
switch (children.$$typeof) {
|
|
1029
1112
|
case REACT_ELEMENT_TYPE:
|
|
1030
1113
|
case REACT_PORTAL_TYPE:
|
|
1031
|
-
invokeCallback = true
|
|
1114
|
+
invokeCallback = true
|
|
1032
1115
|
}
|
|
1033
|
-
|
|
1034
1116
|
}
|
|
1035
1117
|
}
|
|
1036
1118
|
|
|
1037
1119
|
if (invokeCallback) {
|
|
1038
|
-
var _child = children
|
|
1039
|
-
var mappedChild = callback(_child)
|
|
1120
|
+
var _child = children
|
|
1121
|
+
var mappedChild = callback(_child) // If it's the only child, treat the name as if it was wrapped in an array
|
|
1040
1122
|
// so that it's consistent if the number of children grows:
|
|
1041
1123
|
|
|
1042
|
-
var childKey = nameSoFar === '' ? SEPARATOR + getElementKey(_child, 0) : nameSoFar
|
|
1124
|
+
var childKey = nameSoFar === '' ? SEPARATOR + getElementKey(_child, 0) : nameSoFar
|
|
1043
1125
|
|
|
1044
1126
|
if (isArray(mappedChild)) {
|
|
1045
|
-
var escapedChildKey = ''
|
|
1127
|
+
var escapedChildKey = ''
|
|
1046
1128
|
|
|
1047
1129
|
if (childKey != null) {
|
|
1048
|
-
escapedChildKey = escapeUserProvidedKey(childKey) + '/'
|
|
1130
|
+
escapedChildKey = escapeUserProvidedKey(childKey) + '/'
|
|
1049
1131
|
}
|
|
1050
1132
|
|
|
1051
1133
|
mapIntoArray(mappedChild, array, escapedChildKey, '', function (c) {
|
|
1052
|
-
return c
|
|
1053
|
-
})
|
|
1134
|
+
return c
|
|
1135
|
+
})
|
|
1054
1136
|
} else if (mappedChild != null) {
|
|
1055
1137
|
if (isValidElement(mappedChild)) {
|
|
1056
1138
|
{
|
|
@@ -1058,70 +1140,85 @@
|
|
|
1058
1140
|
// coercion ESLint rule, so we must manually disable it below.
|
|
1059
1141
|
// $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key
|
|
1060
1142
|
if (mappedChild.key && (!_child || _child.key !== mappedChild.key)) {
|
|
1061
|
-
checkKeyStringCoercion(mappedChild.key)
|
|
1143
|
+
checkKeyStringCoercion(mappedChild.key)
|
|
1062
1144
|
}
|
|
1063
1145
|
}
|
|
1064
1146
|
|
|
1065
|
-
mappedChild = cloneAndReplaceKey(
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1147
|
+
mappedChild = cloneAndReplaceKey(
|
|
1148
|
+
mappedChild, // Keep both the (mapped) and old keys if they differ, just as
|
|
1149
|
+
// traverseAllChildren used to do for objects as children
|
|
1150
|
+
escapedPrefix + // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key
|
|
1151
|
+
(mappedChild.key && (!_child || _child.key !== mappedChild.key) // $FlowFixMe Flow incorrectly thinks existing element's key can be a number
|
|
1152
|
+
? // eslint-disable-next-line react-internal/safe-string-coercion
|
|
1153
|
+
escapeUserProvidedKey('' + mappedChild.key) + '/'
|
|
1154
|
+
: '') +
|
|
1155
|
+
childKey
|
|
1156
|
+
)
|
|
1071
1157
|
}
|
|
1072
1158
|
|
|
1073
|
-
array.push(mappedChild)
|
|
1159
|
+
array.push(mappedChild)
|
|
1074
1160
|
}
|
|
1075
1161
|
|
|
1076
|
-
return 1
|
|
1162
|
+
return 1
|
|
1077
1163
|
}
|
|
1078
1164
|
|
|
1079
|
-
var child
|
|
1080
|
-
var nextName
|
|
1081
|
-
var subtreeCount = 0
|
|
1165
|
+
var child
|
|
1166
|
+
var nextName
|
|
1167
|
+
var subtreeCount = 0 // Count of children found in the current subtree.
|
|
1082
1168
|
|
|
1083
|
-
var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR
|
|
1169
|
+
var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR
|
|
1084
1170
|
|
|
1085
1171
|
if (isArray(children)) {
|
|
1086
1172
|
for (var i = 0; i < children.length; i++) {
|
|
1087
|
-
child = children[i]
|
|
1088
|
-
nextName = nextNamePrefix + getElementKey(child, i)
|
|
1089
|
-
subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback)
|
|
1173
|
+
child = children[i]
|
|
1174
|
+
nextName = nextNamePrefix + getElementKey(child, i)
|
|
1175
|
+
subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback)
|
|
1090
1176
|
}
|
|
1091
1177
|
} else {
|
|
1092
|
-
var iteratorFn = getIteratorFn(children)
|
|
1178
|
+
var iteratorFn = getIteratorFn(children)
|
|
1093
1179
|
|
|
1094
1180
|
if (typeof iteratorFn === 'function') {
|
|
1095
|
-
var iterableChildren = children
|
|
1181
|
+
var iterableChildren = children
|
|
1096
1182
|
|
|
1097
1183
|
{
|
|
1098
1184
|
// Warn about using Maps as children
|
|
1099
1185
|
if (iteratorFn === iterableChildren.entries) {
|
|
1100
1186
|
if (!didWarnAboutMaps) {
|
|
1101
|
-
warn(
|
|
1187
|
+
warn(
|
|
1188
|
+
'Using Maps as children is not supported. ' +
|
|
1189
|
+
'Use an array of keyed ReactElements instead.'
|
|
1190
|
+
)
|
|
1102
1191
|
}
|
|
1103
1192
|
|
|
1104
|
-
didWarnAboutMaps = true
|
|
1193
|
+
didWarnAboutMaps = true
|
|
1105
1194
|
}
|
|
1106
1195
|
}
|
|
1107
1196
|
|
|
1108
|
-
var iterator = iteratorFn.call(iterableChildren)
|
|
1109
|
-
var step
|
|
1110
|
-
var ii = 0
|
|
1197
|
+
var iterator = iteratorFn.call(iterableChildren)
|
|
1198
|
+
var step
|
|
1199
|
+
var ii = 0
|
|
1111
1200
|
|
|
1112
1201
|
while (!(step = iterator.next()).done) {
|
|
1113
|
-
child = step.value
|
|
1114
|
-
nextName = nextNamePrefix + getElementKey(child, ii++)
|
|
1115
|
-
subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback)
|
|
1202
|
+
child = step.value
|
|
1203
|
+
nextName = nextNamePrefix + getElementKey(child, ii++)
|
|
1204
|
+
subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback)
|
|
1116
1205
|
}
|
|
1117
1206
|
} else if (type === 'object') {
|
|
1118
1207
|
// eslint-disable-next-line react-internal/safe-string-coercion
|
|
1119
|
-
var childrenString = String(children)
|
|
1120
|
-
throw new Error(
|
|
1208
|
+
var childrenString = String(children)
|
|
1209
|
+
throw new Error(
|
|
1210
|
+
'Objects are not valid as a React child (found: ' +
|
|
1211
|
+
(childrenString === '[object Object]'
|
|
1212
|
+
? 'object with keys {' + Object.keys(children).join(', ') + '}'
|
|
1213
|
+
: childrenString) +
|
|
1214
|
+
'). ' +
|
|
1215
|
+
'If you meant to render a collection of children, use an array ' +
|
|
1216
|
+
'instead.'
|
|
1217
|
+
)
|
|
1121
1218
|
}
|
|
1122
1219
|
}
|
|
1123
1220
|
|
|
1124
|
-
return subtreeCount
|
|
1221
|
+
return subtreeCount
|
|
1125
1222
|
}
|
|
1126
1223
|
|
|
1127
1224
|
/**
|
|
@@ -1139,15 +1236,15 @@
|
|
|
1139
1236
|
*/
|
|
1140
1237
|
function mapChildren(children, func, context) {
|
|
1141
1238
|
if (children == null) {
|
|
1142
|
-
return children
|
|
1239
|
+
return children
|
|
1143
1240
|
}
|
|
1144
1241
|
|
|
1145
|
-
var result = []
|
|
1146
|
-
var count = 0
|
|
1242
|
+
var result = []
|
|
1243
|
+
var count = 0
|
|
1147
1244
|
mapIntoArray(children, result, '', '', function (child) {
|
|
1148
|
-
return func.call(context, child, count++)
|
|
1149
|
-
})
|
|
1150
|
-
return result
|
|
1245
|
+
return func.call(context, child, count++)
|
|
1246
|
+
})
|
|
1247
|
+
return result
|
|
1151
1248
|
}
|
|
1152
1249
|
/**
|
|
1153
1250
|
* Count the number of children that are typically specified as
|
|
@@ -1159,13 +1256,12 @@
|
|
|
1159
1256
|
* @return {number} The number of children.
|
|
1160
1257
|
*/
|
|
1161
1258
|
|
|
1162
|
-
|
|
1163
1259
|
function countChildren(children) {
|
|
1164
|
-
var n = 0
|
|
1260
|
+
var n = 0
|
|
1165
1261
|
mapChildren(children, function () {
|
|
1166
|
-
n
|
|
1167
|
-
})
|
|
1168
|
-
return n
|
|
1262
|
+
n++ // Don't return anything
|
|
1263
|
+
})
|
|
1264
|
+
return n
|
|
1169
1265
|
}
|
|
1170
1266
|
|
|
1171
1267
|
/**
|
|
@@ -1181,9 +1277,13 @@
|
|
|
1181
1277
|
* @param {*} forEachContext Context for forEachContext.
|
|
1182
1278
|
*/
|
|
1183
1279
|
function forEachChildren(children, forEachFunc, forEachContext) {
|
|
1184
|
-
mapChildren(
|
|
1185
|
-
|
|
1186
|
-
|
|
1280
|
+
mapChildren(
|
|
1281
|
+
children,
|
|
1282
|
+
function () {
|
|
1283
|
+
forEachFunc.apply(this, arguments) // Don't return anything.
|
|
1284
|
+
},
|
|
1285
|
+
forEachContext
|
|
1286
|
+
)
|
|
1187
1287
|
}
|
|
1188
1288
|
/**
|
|
1189
1289
|
* Flatten a children object (typically specified as `props.children`) and
|
|
@@ -1192,11 +1292,12 @@
|
|
|
1192
1292
|
* See https://reactjs.org/docs/react-api.html#reactchildrentoarray
|
|
1193
1293
|
*/
|
|
1194
1294
|
|
|
1195
|
-
|
|
1196
1295
|
function toArray(children) {
|
|
1197
|
-
return
|
|
1198
|
-
|
|
1199
|
-
|
|
1296
|
+
return (
|
|
1297
|
+
mapChildren(children, function (child) {
|
|
1298
|
+
return child
|
|
1299
|
+
}) || []
|
|
1300
|
+
)
|
|
1200
1301
|
}
|
|
1201
1302
|
/**
|
|
1202
1303
|
* Returns the first child in a collection of children and verifies that there
|
|
@@ -1213,13 +1314,14 @@
|
|
|
1213
1314
|
* structure.
|
|
1214
1315
|
*/
|
|
1215
1316
|
|
|
1216
|
-
|
|
1217
1317
|
function onlyChild(children) {
|
|
1218
1318
|
if (!isValidElement(children)) {
|
|
1219
|
-
throw new Error(
|
|
1319
|
+
throw new Error(
|
|
1320
|
+
'React.Children.only expected to receive a single React element child.'
|
|
1321
|
+
)
|
|
1220
1322
|
}
|
|
1221
1323
|
|
|
1222
|
-
return children
|
|
1324
|
+
return children
|
|
1223
1325
|
}
|
|
1224
1326
|
|
|
1225
1327
|
function createContext(defaultValue) {
|
|
@@ -1242,15 +1344,15 @@
|
|
|
1242
1344
|
Consumer: null,
|
|
1243
1345
|
// Add these to use same hidden class in VM as ServerContext
|
|
1244
1346
|
_defaultValue: null,
|
|
1245
|
-
_globalName: null
|
|
1246
|
-
}
|
|
1347
|
+
_globalName: null,
|
|
1348
|
+
}
|
|
1247
1349
|
context.Provider = {
|
|
1248
1350
|
$$typeof: REACT_PROVIDER_TYPE,
|
|
1249
|
-
_context: context
|
|
1250
|
-
}
|
|
1251
|
-
var hasWarnedAboutUsingNestedContextConsumers = false
|
|
1252
|
-
var hasWarnedAboutUsingConsumerProvider = false
|
|
1253
|
-
var hasWarnedAboutDisplayNameOnConsumer = false
|
|
1351
|
+
_context: context,
|
|
1352
|
+
}
|
|
1353
|
+
var hasWarnedAboutUsingNestedContextConsumers = false
|
|
1354
|
+
var hasWarnedAboutUsingConsumerProvider = false
|
|
1355
|
+
var hasWarnedAboutDisplayNameOnConsumer = false
|
|
1254
1356
|
|
|
1255
1357
|
{
|
|
1256
1358
|
// A separate object, but proxies back to the original context object for
|
|
@@ -1258,143 +1360,169 @@
|
|
|
1258
1360
|
// warn for the incorrect usage of Context as a Consumer.
|
|
1259
1361
|
var Consumer = {
|
|
1260
1362
|
$$typeof: REACT_CONTEXT_TYPE,
|
|
1261
|
-
_context: context
|
|
1262
|
-
}
|
|
1363
|
+
_context: context,
|
|
1364
|
+
} // $FlowFixMe: Flow complains about not setting a value, which is intentional here
|
|
1263
1365
|
|
|
1264
1366
|
Object.defineProperties(Consumer, {
|
|
1265
1367
|
Provider: {
|
|
1266
1368
|
get: function () {
|
|
1267
1369
|
if (!hasWarnedAboutUsingConsumerProvider) {
|
|
1268
|
-
hasWarnedAboutUsingConsumerProvider = true
|
|
1370
|
+
hasWarnedAboutUsingConsumerProvider = true
|
|
1269
1371
|
|
|
1270
|
-
error(
|
|
1372
|
+
error(
|
|
1373
|
+
'Rendering <Context.Consumer.Provider> is not supported and will be removed in ' +
|
|
1374
|
+
'a future major release. Did you mean to render <Context.Provider> instead?'
|
|
1375
|
+
)
|
|
1271
1376
|
}
|
|
1272
1377
|
|
|
1273
|
-
return context.Provider
|
|
1378
|
+
return context.Provider
|
|
1274
1379
|
},
|
|
1275
1380
|
set: function (_Provider) {
|
|
1276
|
-
context.Provider = _Provider
|
|
1277
|
-
}
|
|
1381
|
+
context.Provider = _Provider
|
|
1382
|
+
},
|
|
1278
1383
|
},
|
|
1279
1384
|
_currentValue: {
|
|
1280
1385
|
get: function () {
|
|
1281
|
-
return context._currentValue
|
|
1386
|
+
return context._currentValue
|
|
1282
1387
|
},
|
|
1283
1388
|
set: function (_currentValue) {
|
|
1284
|
-
context._currentValue = _currentValue
|
|
1285
|
-
}
|
|
1389
|
+
context._currentValue = _currentValue
|
|
1390
|
+
},
|
|
1286
1391
|
},
|
|
1287
1392
|
_currentValue2: {
|
|
1288
1393
|
get: function () {
|
|
1289
|
-
return context._currentValue2
|
|
1394
|
+
return context._currentValue2
|
|
1290
1395
|
},
|
|
1291
1396
|
set: function (_currentValue2) {
|
|
1292
|
-
context._currentValue2 = _currentValue2
|
|
1293
|
-
}
|
|
1397
|
+
context._currentValue2 = _currentValue2
|
|
1398
|
+
},
|
|
1294
1399
|
},
|
|
1295
1400
|
_threadCount: {
|
|
1296
1401
|
get: function () {
|
|
1297
|
-
return context._threadCount
|
|
1402
|
+
return context._threadCount
|
|
1298
1403
|
},
|
|
1299
1404
|
set: function (_threadCount) {
|
|
1300
|
-
context._threadCount = _threadCount
|
|
1301
|
-
}
|
|
1405
|
+
context._threadCount = _threadCount
|
|
1406
|
+
},
|
|
1302
1407
|
},
|
|
1303
1408
|
Consumer: {
|
|
1304
1409
|
get: function () {
|
|
1305
1410
|
if (!hasWarnedAboutUsingNestedContextConsumers) {
|
|
1306
|
-
hasWarnedAboutUsingNestedContextConsumers = true
|
|
1411
|
+
hasWarnedAboutUsingNestedContextConsumers = true
|
|
1307
1412
|
|
|
1308
|
-
error(
|
|
1413
|
+
error(
|
|
1414
|
+
'Rendering <Context.Consumer.Consumer> is not supported and will be removed in ' +
|
|
1415
|
+
'a future major release. Did you mean to render <Context.Consumer> instead?'
|
|
1416
|
+
)
|
|
1309
1417
|
}
|
|
1310
1418
|
|
|
1311
|
-
return context.Consumer
|
|
1312
|
-
}
|
|
1419
|
+
return context.Consumer
|
|
1420
|
+
},
|
|
1313
1421
|
},
|
|
1314
1422
|
displayName: {
|
|
1315
1423
|
get: function () {
|
|
1316
|
-
return context.displayName
|
|
1424
|
+
return context.displayName
|
|
1317
1425
|
},
|
|
1318
1426
|
set: function (displayName) {
|
|
1319
1427
|
if (!hasWarnedAboutDisplayNameOnConsumer) {
|
|
1320
|
-
warn(
|
|
1428
|
+
warn(
|
|
1429
|
+
'Setting `displayName` on Context.Consumer has no effect. ' +
|
|
1430
|
+
"You should set it directly on the context with Context.displayName = '%s'.",
|
|
1431
|
+
displayName
|
|
1432
|
+
)
|
|
1321
1433
|
|
|
1322
|
-
hasWarnedAboutDisplayNameOnConsumer = true
|
|
1434
|
+
hasWarnedAboutDisplayNameOnConsumer = true
|
|
1323
1435
|
}
|
|
1324
|
-
}
|
|
1325
|
-
}
|
|
1326
|
-
})
|
|
1436
|
+
},
|
|
1437
|
+
},
|
|
1438
|
+
}) // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty
|
|
1327
1439
|
|
|
1328
|
-
context.Consumer = Consumer
|
|
1440
|
+
context.Consumer = Consumer
|
|
1329
1441
|
}
|
|
1330
1442
|
|
|
1331
1443
|
{
|
|
1332
|
-
context._currentRenderer = null
|
|
1333
|
-
context._currentRenderer2 = null
|
|
1444
|
+
context._currentRenderer = null
|
|
1445
|
+
context._currentRenderer2 = null
|
|
1334
1446
|
}
|
|
1335
1447
|
|
|
1336
|
-
return context
|
|
1448
|
+
return context
|
|
1337
1449
|
}
|
|
1338
1450
|
|
|
1339
|
-
var Uninitialized = -1
|
|
1340
|
-
var Pending = 0
|
|
1341
|
-
var Resolved = 1
|
|
1342
|
-
var Rejected = 2
|
|
1451
|
+
var Uninitialized = -1
|
|
1452
|
+
var Pending = 0
|
|
1453
|
+
var Resolved = 1
|
|
1454
|
+
var Rejected = 2
|
|
1343
1455
|
|
|
1344
1456
|
function lazyInitializer(payload) {
|
|
1345
1457
|
if (payload._status === Uninitialized) {
|
|
1346
|
-
var ctor = payload._result
|
|
1347
|
-
var thenable = ctor()
|
|
1458
|
+
var ctor = payload._result
|
|
1459
|
+
var thenable = ctor() // Transition to the next state.
|
|
1348
1460
|
// This might throw either because it's missing or throws. If so, we treat it
|
|
1349
1461
|
// as still uninitialized and try again next time. Which is the same as what
|
|
1350
1462
|
// happens if the ctor or any wrappers processing the ctor throws. This might
|
|
1351
1463
|
// end up fixing it if the resolution was a concurrency bug.
|
|
1352
1464
|
|
|
1353
|
-
thenable.then(
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1465
|
+
thenable.then(
|
|
1466
|
+
function (moduleObject) {
|
|
1467
|
+
if (payload._status === Pending || payload._status === Uninitialized) {
|
|
1468
|
+
// Transition to the next state.
|
|
1469
|
+
var resolved = payload
|
|
1470
|
+
resolved._status = Resolved
|
|
1471
|
+
resolved._result = moduleObject
|
|
1472
|
+
}
|
|
1473
|
+
},
|
|
1474
|
+
function (error) {
|
|
1475
|
+
if (payload._status === Pending || payload._status === Uninitialized) {
|
|
1476
|
+
// Transition to the next state.
|
|
1477
|
+
var rejected = payload
|
|
1478
|
+
rejected._status = Rejected
|
|
1479
|
+
rejected._result = error
|
|
1480
|
+
}
|
|
1366
1481
|
}
|
|
1367
|
-
|
|
1482
|
+
)
|
|
1368
1483
|
|
|
1369
1484
|
if (payload._status === Uninitialized) {
|
|
1370
1485
|
// In case, we're still uninitialized, then we're waiting for the thenable
|
|
1371
1486
|
// to resolve. Set it as pending in the meantime.
|
|
1372
|
-
var pending = payload
|
|
1373
|
-
pending._status = Pending
|
|
1374
|
-
pending._result = thenable
|
|
1487
|
+
var pending = payload
|
|
1488
|
+
pending._status = Pending
|
|
1489
|
+
pending._result = thenable
|
|
1375
1490
|
}
|
|
1376
1491
|
}
|
|
1377
1492
|
|
|
1378
1493
|
if (payload._status === Resolved) {
|
|
1379
|
-
var moduleObject = payload._result
|
|
1494
|
+
var moduleObject = payload._result
|
|
1380
1495
|
|
|
1381
1496
|
{
|
|
1382
1497
|
if (moduleObject === undefined) {
|
|
1383
|
-
error(
|
|
1384
|
-
|
|
1498
|
+
error(
|
|
1499
|
+
'lazy: Expected the result of a dynamic imp' +
|
|
1500
|
+
'ort() call. ' +
|
|
1501
|
+
'Instead received: %s\n\nYour code should look like: \n ' + // Break up imports to avoid accidentally parsing them as dependencies.
|
|
1502
|
+
'const MyComponent = lazy(() => imp' +
|
|
1503
|
+
"ort('./MyComponent'))\n\n" +
|
|
1504
|
+
'Did you accidentally put curly braces around the import?',
|
|
1505
|
+
moduleObject
|
|
1506
|
+
)
|
|
1385
1507
|
}
|
|
1386
1508
|
}
|
|
1387
1509
|
|
|
1388
1510
|
{
|
|
1389
1511
|
if (!('default' in moduleObject)) {
|
|
1390
|
-
error(
|
|
1391
|
-
|
|
1512
|
+
error(
|
|
1513
|
+
'lazy: Expected the result of a dynamic imp' +
|
|
1514
|
+
'ort() call. ' +
|
|
1515
|
+
'Instead received: %s\n\nYour code should look like: \n ' + // Break up imports to avoid accidentally parsing them as dependencies.
|
|
1516
|
+
'const MyComponent = lazy(() => imp' +
|
|
1517
|
+
"ort('./MyComponent'))",
|
|
1518
|
+
moduleObject
|
|
1519
|
+
)
|
|
1392
1520
|
}
|
|
1393
1521
|
}
|
|
1394
1522
|
|
|
1395
|
-
return moduleObject.default
|
|
1523
|
+
return moduleObject.default
|
|
1396
1524
|
} else {
|
|
1397
|
-
throw payload._result
|
|
1525
|
+
throw payload._result
|
|
1398
1526
|
}
|
|
1399
1527
|
}
|
|
1400
1528
|
|
|
@@ -1402,92 +1530,115 @@
|
|
|
1402
1530
|
var payload = {
|
|
1403
1531
|
// We use these fields to store the result.
|
|
1404
1532
|
_status: Uninitialized,
|
|
1405
|
-
_result: ctor
|
|
1406
|
-
}
|
|
1533
|
+
_result: ctor,
|
|
1534
|
+
}
|
|
1407
1535
|
var lazyType = {
|
|
1408
1536
|
$$typeof: REACT_LAZY_TYPE,
|
|
1409
1537
|
_payload: payload,
|
|
1410
|
-
_init: lazyInitializer
|
|
1411
|
-
}
|
|
1538
|
+
_init: lazyInitializer,
|
|
1539
|
+
}
|
|
1412
1540
|
|
|
1413
1541
|
{
|
|
1414
1542
|
// In production, this would just set it on the object.
|
|
1415
|
-
var defaultProps
|
|
1416
|
-
var propTypes
|
|
1543
|
+
var defaultProps
|
|
1544
|
+
var propTypes // $FlowFixMe
|
|
1417
1545
|
|
|
1418
1546
|
Object.defineProperties(lazyType, {
|
|
1419
1547
|
defaultProps: {
|
|
1420
1548
|
configurable: true,
|
|
1421
1549
|
get: function () {
|
|
1422
|
-
return defaultProps
|
|
1550
|
+
return defaultProps
|
|
1423
1551
|
},
|
|
1424
1552
|
set: function (newDefaultProps) {
|
|
1425
|
-
error(
|
|
1553
|
+
error(
|
|
1554
|
+
'React.lazy(...): It is not supported to assign `defaultProps` to ' +
|
|
1555
|
+
'a lazy component import. Either specify them where the component ' +
|
|
1556
|
+
'is defined, or create a wrapping component around it.'
|
|
1557
|
+
)
|
|
1426
1558
|
|
|
1427
|
-
defaultProps = newDefaultProps
|
|
1559
|
+
defaultProps = newDefaultProps // Match production behavior more closely:
|
|
1428
1560
|
// $FlowFixMe
|
|
1429
1561
|
|
|
1430
1562
|
Object.defineProperty(lazyType, 'defaultProps', {
|
|
1431
|
-
enumerable: true
|
|
1432
|
-
})
|
|
1433
|
-
}
|
|
1563
|
+
enumerable: true,
|
|
1564
|
+
})
|
|
1565
|
+
},
|
|
1434
1566
|
},
|
|
1435
1567
|
propTypes: {
|
|
1436
1568
|
configurable: true,
|
|
1437
1569
|
get: function () {
|
|
1438
|
-
return propTypes
|
|
1570
|
+
return propTypes
|
|
1439
1571
|
},
|
|
1440
1572
|
set: function (newPropTypes) {
|
|
1441
|
-
error(
|
|
1573
|
+
error(
|
|
1574
|
+
'React.lazy(...): It is not supported to assign `propTypes` to ' +
|
|
1575
|
+
'a lazy component import. Either specify them where the component ' +
|
|
1576
|
+
'is defined, or create a wrapping component around it.'
|
|
1577
|
+
)
|
|
1442
1578
|
|
|
1443
|
-
propTypes = newPropTypes
|
|
1579
|
+
propTypes = newPropTypes // Match production behavior more closely:
|
|
1444
1580
|
// $FlowFixMe
|
|
1445
1581
|
|
|
1446
1582
|
Object.defineProperty(lazyType, 'propTypes', {
|
|
1447
|
-
enumerable: true
|
|
1448
|
-
})
|
|
1449
|
-
}
|
|
1450
|
-
}
|
|
1451
|
-
})
|
|
1583
|
+
enumerable: true,
|
|
1584
|
+
})
|
|
1585
|
+
},
|
|
1586
|
+
},
|
|
1587
|
+
})
|
|
1452
1588
|
}
|
|
1453
1589
|
|
|
1454
|
-
return lazyType
|
|
1590
|
+
return lazyType
|
|
1455
1591
|
}
|
|
1456
1592
|
|
|
1457
1593
|
function forwardRef(render) {
|
|
1458
1594
|
{
|
|
1459
1595
|
if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
|
|
1460
|
-
error(
|
|
1596
|
+
error(
|
|
1597
|
+
'forwardRef requires a render function but received a `memo` ' +
|
|
1598
|
+
'component. Instead of forwardRef(memo(...)), use ' +
|
|
1599
|
+
'memo(forwardRef(...)).'
|
|
1600
|
+
)
|
|
1461
1601
|
} else if (typeof render !== 'function') {
|
|
1462
|
-
error(
|
|
1602
|
+
error(
|
|
1603
|
+
'forwardRef requires a render function but was given %s.',
|
|
1604
|
+
render === null ? 'null' : typeof render
|
|
1605
|
+
)
|
|
1463
1606
|
} else {
|
|
1464
1607
|
if (render.length !== 0 && render.length !== 2) {
|
|
1465
|
-
error(
|
|
1608
|
+
error(
|
|
1609
|
+
'forwardRef render functions accept exactly two parameters: props and ref. %s',
|
|
1610
|
+
render.length === 1
|
|
1611
|
+
? 'Did you forget to use the ref parameter?'
|
|
1612
|
+
: 'Any additional parameter will be undefined.'
|
|
1613
|
+
)
|
|
1466
1614
|
}
|
|
1467
1615
|
}
|
|
1468
1616
|
|
|
1469
1617
|
if (render != null) {
|
|
1470
1618
|
if (render.defaultProps != null || render.propTypes != null) {
|
|
1471
|
-
error(
|
|
1619
|
+
error(
|
|
1620
|
+
'forwardRef render functions do not support propTypes or defaultProps. ' +
|
|
1621
|
+
'Did you accidentally pass a React component?'
|
|
1622
|
+
)
|
|
1472
1623
|
}
|
|
1473
1624
|
}
|
|
1474
1625
|
}
|
|
1475
1626
|
|
|
1476
1627
|
var elementType = {
|
|
1477
1628
|
$$typeof: REACT_FORWARD_REF_TYPE,
|
|
1478
|
-
render: render
|
|
1479
|
-
}
|
|
1629
|
+
render: render,
|
|
1630
|
+
}
|
|
1480
1631
|
|
|
1481
1632
|
{
|
|
1482
|
-
var ownName
|
|
1633
|
+
var ownName
|
|
1483
1634
|
Object.defineProperty(elementType, 'displayName', {
|
|
1484
1635
|
enumerable: false,
|
|
1485
1636
|
configurable: true,
|
|
1486
1637
|
get: function () {
|
|
1487
|
-
return ownName
|
|
1638
|
+
return ownName
|
|
1488
1639
|
},
|
|
1489
1640
|
set: function (name) {
|
|
1490
|
-
ownName = name
|
|
1641
|
+
ownName = name // The inner component shouldn't inherit this display name in most cases,
|
|
1491
1642
|
// because the component may be used elsewhere.
|
|
1492
1643
|
// But it's nice for anonymous functions to inherit the name,
|
|
1493
1644
|
// so that our component-stack generation logic will display their frames.
|
|
@@ -1496,67 +1647,88 @@
|
|
|
1496
1647
|
// This kind of inner function is not used elsewhere so the side effect is okay.
|
|
1497
1648
|
|
|
1498
1649
|
if (!render.name && !render.displayName) {
|
|
1499
|
-
render.displayName = name
|
|
1650
|
+
render.displayName = name
|
|
1500
1651
|
}
|
|
1501
|
-
}
|
|
1502
|
-
})
|
|
1652
|
+
},
|
|
1653
|
+
})
|
|
1503
1654
|
}
|
|
1504
1655
|
|
|
1505
|
-
return elementType
|
|
1656
|
+
return elementType
|
|
1506
1657
|
}
|
|
1507
1658
|
|
|
1508
|
-
var REACT_MODULE_REFERENCE
|
|
1659
|
+
var REACT_MODULE_REFERENCE
|
|
1509
1660
|
|
|
1510
1661
|
{
|
|
1511
|
-
REACT_MODULE_REFERENCE = Symbol.for('react.module.reference')
|
|
1662
|
+
REACT_MODULE_REFERENCE = Symbol.for('react.module.reference')
|
|
1512
1663
|
}
|
|
1513
1664
|
|
|
1514
1665
|
function isValidElementType(type) {
|
|
1515
1666
|
if (typeof type === 'string' || typeof type === 'function') {
|
|
1516
|
-
return true
|
|
1667
|
+
return true
|
|
1517
1668
|
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
|
|
1518
1669
|
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1670
|
+
if (
|
|
1671
|
+
type === REACT_FRAGMENT_TYPE ||
|
|
1672
|
+
type === REACT_PROFILER_TYPE ||
|
|
1673
|
+
enableDebugTracing ||
|
|
1674
|
+
type === REACT_STRICT_MODE_TYPE ||
|
|
1675
|
+
type === REACT_SUSPENSE_TYPE ||
|
|
1676
|
+
type === REACT_SUSPENSE_LIST_TYPE ||
|
|
1677
|
+
enableLegacyHidden ||
|
|
1678
|
+
type === REACT_OFFSCREEN_TYPE ||
|
|
1679
|
+
enableScopeAPI ||
|
|
1680
|
+
enableCacheElement ||
|
|
1681
|
+
enableTransitionTracing
|
|
1682
|
+
) {
|
|
1683
|
+
return true
|
|
1522
1684
|
}
|
|
1523
1685
|
|
|
1524
1686
|
if (typeof type === 'object' && type !== null) {
|
|
1525
|
-
if (
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1687
|
+
if (
|
|
1688
|
+
type.$$typeof === REACT_LAZY_TYPE ||
|
|
1689
|
+
type.$$typeof === REACT_MEMO_TYPE ||
|
|
1690
|
+
type.$$typeof === REACT_PROVIDER_TYPE ||
|
|
1691
|
+
type.$$typeof === REACT_CONTEXT_TYPE ||
|
|
1692
|
+
type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
|
|
1693
|
+
// types supported by any Flight configuration anywhere since
|
|
1694
|
+
// we don't know which Flight build this will end up being used
|
|
1695
|
+
// with.
|
|
1696
|
+
type.$$typeof === REACT_MODULE_REFERENCE ||
|
|
1697
|
+
type.getModuleId !== undefined
|
|
1698
|
+
) {
|
|
1699
|
+
return true
|
|
1531
1700
|
}
|
|
1532
1701
|
}
|
|
1533
1702
|
|
|
1534
|
-
return false
|
|
1703
|
+
return false
|
|
1535
1704
|
}
|
|
1536
1705
|
|
|
1537
1706
|
function memo(type, compare) {
|
|
1538
1707
|
{
|
|
1539
1708
|
if (!isValidElementType(type)) {
|
|
1540
|
-
error(
|
|
1709
|
+
error(
|
|
1710
|
+
'memo: The first argument must be a component. Instead ' + 'received: %s',
|
|
1711
|
+
type === null ? 'null' : typeof type
|
|
1712
|
+
)
|
|
1541
1713
|
}
|
|
1542
1714
|
}
|
|
1543
1715
|
|
|
1544
1716
|
var elementType = {
|
|
1545
1717
|
$$typeof: REACT_MEMO_TYPE,
|
|
1546
1718
|
type: type,
|
|
1547
|
-
compare: compare === undefined ? null : compare
|
|
1548
|
-
}
|
|
1719
|
+
compare: compare === undefined ? null : compare,
|
|
1720
|
+
}
|
|
1549
1721
|
|
|
1550
1722
|
{
|
|
1551
|
-
var ownName
|
|
1723
|
+
var ownName
|
|
1552
1724
|
Object.defineProperty(elementType, 'displayName', {
|
|
1553
1725
|
enumerable: false,
|
|
1554
1726
|
configurable: true,
|
|
1555
1727
|
get: function () {
|
|
1556
|
-
return ownName
|
|
1728
|
+
return ownName
|
|
1557
1729
|
},
|
|
1558
1730
|
set: function (name) {
|
|
1559
|
-
ownName = name
|
|
1731
|
+
ownName = name // The inner component shouldn't inherit this display name in most cases,
|
|
1560
1732
|
// because the component may be used elsewhere.
|
|
1561
1733
|
// But it's nice for anonymous functions to inherit the name,
|
|
1562
1734
|
// so that our component-stack generation logic will display their frames.
|
|
@@ -1565,141 +1737,153 @@
|
|
|
1565
1737
|
// This kind of inner function is not used elsewhere so the side effect is okay.
|
|
1566
1738
|
|
|
1567
1739
|
if (!type.name && !type.displayName) {
|
|
1568
|
-
type.displayName = name
|
|
1740
|
+
type.displayName = name
|
|
1569
1741
|
}
|
|
1570
|
-
}
|
|
1571
|
-
})
|
|
1742
|
+
},
|
|
1743
|
+
})
|
|
1572
1744
|
}
|
|
1573
1745
|
|
|
1574
|
-
return elementType
|
|
1746
|
+
return elementType
|
|
1575
1747
|
}
|
|
1576
1748
|
|
|
1577
1749
|
function resolveDispatcher() {
|
|
1578
|
-
var dispatcher = ReactCurrentDispatcher.current
|
|
1750
|
+
var dispatcher = ReactCurrentDispatcher.current
|
|
1579
1751
|
|
|
1580
1752
|
{
|
|
1581
1753
|
if (dispatcher === null) {
|
|
1582
|
-
error(
|
|
1754
|
+
error(
|
|
1755
|
+
'Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for' +
|
|
1756
|
+
' one of the following reasons:\n' +
|
|
1757
|
+
'1. You might have mismatching versions of React and the renderer (such as React DOM)\n' +
|
|
1758
|
+
'2. You might be breaking the Rules of Hooks\n' +
|
|
1759
|
+
'3. You might have more than one copy of React in the same app\n' +
|
|
1760
|
+
'See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.'
|
|
1761
|
+
)
|
|
1583
1762
|
}
|
|
1584
1763
|
} // Will result in a null access error if accessed outside render phase. We
|
|
1585
1764
|
// intentionally don't throw our own error because this is in a hot path.
|
|
1586
1765
|
// Also helps ensure this is inlined.
|
|
1587
1766
|
|
|
1588
|
-
|
|
1589
|
-
return dispatcher;
|
|
1767
|
+
return dispatcher
|
|
1590
1768
|
}
|
|
1591
1769
|
function useContext(Context) {
|
|
1592
|
-
var dispatcher = resolveDispatcher()
|
|
1770
|
+
var dispatcher = resolveDispatcher()
|
|
1593
1771
|
|
|
1594
1772
|
{
|
|
1595
1773
|
// TODO: add a more generic warning for invalid values.
|
|
1596
1774
|
if (Context._context !== undefined) {
|
|
1597
|
-
var realContext = Context._context
|
|
1775
|
+
var realContext = Context._context // Don't deduplicate because this legitimately causes bugs
|
|
1598
1776
|
// and nobody should be using this in existing code.
|
|
1599
1777
|
|
|
1600
1778
|
if (realContext.Consumer === Context) {
|
|
1601
|
-
error(
|
|
1779
|
+
error(
|
|
1780
|
+
'Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be ' +
|
|
1781
|
+
'removed in a future major release. Did you mean to call useContext(Context) instead?'
|
|
1782
|
+
)
|
|
1602
1783
|
} else if (realContext.Provider === Context) {
|
|
1603
|
-
error(
|
|
1784
|
+
error(
|
|
1785
|
+
'Calling useContext(Context.Provider) is not supported. ' +
|
|
1786
|
+
'Did you mean to call useContext(Context) instead?'
|
|
1787
|
+
)
|
|
1604
1788
|
}
|
|
1605
1789
|
}
|
|
1606
1790
|
}
|
|
1607
1791
|
|
|
1608
|
-
return dispatcher.useContext(Context)
|
|
1792
|
+
return dispatcher.useContext(Context)
|
|
1609
1793
|
}
|
|
1610
1794
|
function useState(initialState) {
|
|
1611
|
-
var dispatcher = resolveDispatcher()
|
|
1612
|
-
return dispatcher.useState(initialState)
|
|
1795
|
+
var dispatcher = resolveDispatcher()
|
|
1796
|
+
return dispatcher.useState(initialState)
|
|
1613
1797
|
}
|
|
1614
1798
|
function useReducer(reducer, initialArg, init) {
|
|
1615
|
-
var dispatcher = resolveDispatcher()
|
|
1616
|
-
return dispatcher.useReducer(reducer, initialArg, init)
|
|
1799
|
+
var dispatcher = resolveDispatcher()
|
|
1800
|
+
return dispatcher.useReducer(reducer, initialArg, init)
|
|
1617
1801
|
}
|
|
1618
1802
|
function useRef(initialValue) {
|
|
1619
|
-
var dispatcher = resolveDispatcher()
|
|
1620
|
-
return dispatcher.useRef(initialValue)
|
|
1803
|
+
var dispatcher = resolveDispatcher()
|
|
1804
|
+
return dispatcher.useRef(initialValue)
|
|
1621
1805
|
}
|
|
1622
1806
|
function useEffect(create, deps) {
|
|
1623
|
-
var dispatcher = resolveDispatcher()
|
|
1624
|
-
return dispatcher.useEffect(create, deps)
|
|
1807
|
+
var dispatcher = resolveDispatcher()
|
|
1808
|
+
return dispatcher.useEffect(create, deps)
|
|
1625
1809
|
}
|
|
1626
1810
|
function useInsertionEffect(create, deps) {
|
|
1627
|
-
var dispatcher = resolveDispatcher()
|
|
1628
|
-
return dispatcher.useInsertionEffect(create, deps)
|
|
1811
|
+
var dispatcher = resolveDispatcher()
|
|
1812
|
+
return dispatcher.useInsertionEffect(create, deps)
|
|
1629
1813
|
}
|
|
1630
1814
|
function useLayoutEffect(create, deps) {
|
|
1631
|
-
var dispatcher = resolveDispatcher()
|
|
1632
|
-
return dispatcher.useLayoutEffect(create, deps)
|
|
1815
|
+
var dispatcher = resolveDispatcher()
|
|
1816
|
+
return dispatcher.useLayoutEffect(create, deps)
|
|
1633
1817
|
}
|
|
1634
1818
|
function useCallback(callback, deps) {
|
|
1635
|
-
var dispatcher = resolveDispatcher()
|
|
1636
|
-
return dispatcher.useCallback(callback, deps)
|
|
1819
|
+
var dispatcher = resolveDispatcher()
|
|
1820
|
+
return dispatcher.useCallback(callback, deps)
|
|
1637
1821
|
}
|
|
1638
1822
|
function useMemo(create, deps) {
|
|
1639
|
-
var dispatcher = resolveDispatcher()
|
|
1640
|
-
return dispatcher.useMemo(create, deps)
|
|
1823
|
+
var dispatcher = resolveDispatcher()
|
|
1824
|
+
return dispatcher.useMemo(create, deps)
|
|
1641
1825
|
}
|
|
1642
1826
|
function useImperativeHandle(ref, create, deps) {
|
|
1643
|
-
var dispatcher = resolveDispatcher()
|
|
1644
|
-
return dispatcher.useImperativeHandle(ref, create, deps)
|
|
1827
|
+
var dispatcher = resolveDispatcher()
|
|
1828
|
+
return dispatcher.useImperativeHandle(ref, create, deps)
|
|
1645
1829
|
}
|
|
1646
1830
|
function useDebugValue(value, formatterFn) {
|
|
1647
1831
|
{
|
|
1648
|
-
var dispatcher = resolveDispatcher()
|
|
1649
|
-
return dispatcher.useDebugValue(value, formatterFn)
|
|
1832
|
+
var dispatcher = resolveDispatcher()
|
|
1833
|
+
return dispatcher.useDebugValue(value, formatterFn)
|
|
1650
1834
|
}
|
|
1651
1835
|
}
|
|
1652
1836
|
function useTransition() {
|
|
1653
|
-
var dispatcher = resolveDispatcher()
|
|
1654
|
-
return dispatcher.useTransition()
|
|
1837
|
+
var dispatcher = resolveDispatcher()
|
|
1838
|
+
return dispatcher.useTransition()
|
|
1655
1839
|
}
|
|
1656
1840
|
function useDeferredValue(value) {
|
|
1657
|
-
var dispatcher = resolveDispatcher()
|
|
1658
|
-
return dispatcher.useDeferredValue(value)
|
|
1841
|
+
var dispatcher = resolveDispatcher()
|
|
1842
|
+
return dispatcher.useDeferredValue(value)
|
|
1659
1843
|
}
|
|
1660
1844
|
function useId() {
|
|
1661
|
-
var dispatcher = resolveDispatcher()
|
|
1662
|
-
return dispatcher.useId()
|
|
1845
|
+
var dispatcher = resolveDispatcher()
|
|
1846
|
+
return dispatcher.useId()
|
|
1663
1847
|
}
|
|
1664
1848
|
function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
|
1665
|
-
var dispatcher = resolveDispatcher()
|
|
1666
|
-
return dispatcher.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot)
|
|
1849
|
+
var dispatcher = resolveDispatcher()
|
|
1850
|
+
return dispatcher.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot)
|
|
1667
1851
|
}
|
|
1668
1852
|
|
|
1669
1853
|
// Helpers to patch console.logs to avoid logging during side-effect free
|
|
1670
1854
|
// replaying on render function. This currently only patches the object
|
|
1671
1855
|
// lazily which won't cover if the log function was extracted eagerly.
|
|
1672
1856
|
// We could also eagerly patch the method.
|
|
1673
|
-
var disabledDepth = 0
|
|
1674
|
-
var prevLog
|
|
1675
|
-
var prevInfo
|
|
1676
|
-
var prevWarn
|
|
1677
|
-
var prevError
|
|
1678
|
-
var prevGroup
|
|
1679
|
-
var prevGroupCollapsed
|
|
1680
|
-
var prevGroupEnd
|
|
1857
|
+
var disabledDepth = 0
|
|
1858
|
+
var prevLog
|
|
1859
|
+
var prevInfo
|
|
1860
|
+
var prevWarn
|
|
1861
|
+
var prevError
|
|
1862
|
+
var prevGroup
|
|
1863
|
+
var prevGroupCollapsed
|
|
1864
|
+
var prevGroupEnd
|
|
1681
1865
|
|
|
1682
1866
|
function disabledLog() {}
|
|
1683
1867
|
|
|
1684
|
-
disabledLog.__reactDisabledLog = true
|
|
1868
|
+
disabledLog.__reactDisabledLog = true
|
|
1685
1869
|
function disableLogs() {
|
|
1686
1870
|
{
|
|
1687
1871
|
if (disabledDepth === 0) {
|
|
1688
1872
|
/* eslint-disable react-internal/no-production-logging */
|
|
1689
|
-
prevLog = console.log
|
|
1690
|
-
prevInfo = console.info
|
|
1691
|
-
prevWarn = console.warn
|
|
1692
|
-
prevError = console.error
|
|
1693
|
-
prevGroup = console.group
|
|
1694
|
-
prevGroupCollapsed = console.groupCollapsed
|
|
1695
|
-
prevGroupEnd = console.groupEnd
|
|
1873
|
+
prevLog = console.log
|
|
1874
|
+
prevInfo = console.info
|
|
1875
|
+
prevWarn = console.warn
|
|
1876
|
+
prevError = console.error
|
|
1877
|
+
prevGroup = console.group
|
|
1878
|
+
prevGroupCollapsed = console.groupCollapsed
|
|
1879
|
+
prevGroupEnd = console.groupEnd // https://github.com/facebook/react/issues/19099
|
|
1696
1880
|
|
|
1697
1881
|
var props = {
|
|
1698
1882
|
configurable: true,
|
|
1699
1883
|
enumerable: true,
|
|
1700
1884
|
value: disabledLog,
|
|
1701
|
-
writable: true
|
|
1702
|
-
}
|
|
1885
|
+
writable: true,
|
|
1886
|
+
} // $FlowFixMe Flow thinks console is immutable.
|
|
1703
1887
|
|
|
1704
1888
|
Object.defineProperties(console, {
|
|
1705
1889
|
info: props,
|
|
@@ -1708,111 +1892,113 @@
|
|
|
1708
1892
|
error: props,
|
|
1709
1893
|
group: props,
|
|
1710
1894
|
groupCollapsed: props,
|
|
1711
|
-
groupEnd: props
|
|
1712
|
-
})
|
|
1895
|
+
groupEnd: props,
|
|
1896
|
+
})
|
|
1713
1897
|
/* eslint-enable react-internal/no-production-logging */
|
|
1714
1898
|
}
|
|
1715
1899
|
|
|
1716
|
-
disabledDepth
|
|
1900
|
+
disabledDepth++
|
|
1717
1901
|
}
|
|
1718
1902
|
}
|
|
1719
1903
|
function reenableLogs() {
|
|
1720
1904
|
{
|
|
1721
|
-
disabledDepth
|
|
1905
|
+
disabledDepth--
|
|
1722
1906
|
|
|
1723
1907
|
if (disabledDepth === 0) {
|
|
1724
1908
|
/* eslint-disable react-internal/no-production-logging */
|
|
1725
1909
|
var props = {
|
|
1726
1910
|
configurable: true,
|
|
1727
1911
|
enumerable: true,
|
|
1728
|
-
writable: true
|
|
1729
|
-
}
|
|
1912
|
+
writable: true,
|
|
1913
|
+
} // $FlowFixMe Flow thinks console is immutable.
|
|
1730
1914
|
|
|
1731
1915
|
Object.defineProperties(console, {
|
|
1732
1916
|
log: assign({}, props, {
|
|
1733
|
-
value: prevLog
|
|
1917
|
+
value: prevLog,
|
|
1734
1918
|
}),
|
|
1735
1919
|
info: assign({}, props, {
|
|
1736
|
-
value: prevInfo
|
|
1920
|
+
value: prevInfo,
|
|
1737
1921
|
}),
|
|
1738
1922
|
warn: assign({}, props, {
|
|
1739
|
-
value: prevWarn
|
|
1923
|
+
value: prevWarn,
|
|
1740
1924
|
}),
|
|
1741
1925
|
error: assign({}, props, {
|
|
1742
|
-
value: prevError
|
|
1926
|
+
value: prevError,
|
|
1743
1927
|
}),
|
|
1744
1928
|
group: assign({}, props, {
|
|
1745
|
-
value: prevGroup
|
|
1929
|
+
value: prevGroup,
|
|
1746
1930
|
}),
|
|
1747
1931
|
groupCollapsed: assign({}, props, {
|
|
1748
|
-
value: prevGroupCollapsed
|
|
1932
|
+
value: prevGroupCollapsed,
|
|
1749
1933
|
}),
|
|
1750
1934
|
groupEnd: assign({}, props, {
|
|
1751
|
-
value: prevGroupEnd
|
|
1752
|
-
})
|
|
1753
|
-
})
|
|
1935
|
+
value: prevGroupEnd,
|
|
1936
|
+
}),
|
|
1937
|
+
})
|
|
1754
1938
|
/* eslint-enable react-internal/no-production-logging */
|
|
1755
1939
|
}
|
|
1756
1940
|
|
|
1757
1941
|
if (disabledDepth < 0) {
|
|
1758
|
-
error(
|
|
1942
|
+
error(
|
|
1943
|
+
'disabledDepth fell below zero. ' +
|
|
1944
|
+
'This is a bug in React. Please file an issue.'
|
|
1945
|
+
)
|
|
1759
1946
|
}
|
|
1760
1947
|
}
|
|
1761
1948
|
}
|
|
1762
1949
|
|
|
1763
|
-
var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher
|
|
1764
|
-
var prefix
|
|
1950
|
+
var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher
|
|
1951
|
+
var prefix
|
|
1765
1952
|
function describeBuiltInComponentFrame(name, source, ownerFn) {
|
|
1766
1953
|
{
|
|
1767
1954
|
if (prefix === undefined) {
|
|
1768
1955
|
// Extract the VM specific prefix used by each line.
|
|
1769
1956
|
try {
|
|
1770
|
-
throw Error()
|
|
1957
|
+
throw Error()
|
|
1771
1958
|
} catch (x) {
|
|
1772
|
-
var match = x.stack.trim().match(/\n( *(at )?)/)
|
|
1773
|
-
prefix = match && match[1] || ''
|
|
1959
|
+
var match = x.stack.trim().match(/\n( *(at )?)/)
|
|
1960
|
+
prefix = (match && match[1]) || ''
|
|
1774
1961
|
}
|
|
1775
1962
|
} // We use the prefix to ensure our stacks line up with native stack frames.
|
|
1776
1963
|
|
|
1777
|
-
|
|
1778
|
-
return '\n' + prefix + name;
|
|
1964
|
+
return '\n' + prefix + name
|
|
1779
1965
|
}
|
|
1780
1966
|
}
|
|
1781
|
-
var reentry = false
|
|
1782
|
-
var componentFrameCache
|
|
1967
|
+
var reentry = false
|
|
1968
|
+
var componentFrameCache
|
|
1783
1969
|
|
|
1784
1970
|
{
|
|
1785
|
-
var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map
|
|
1786
|
-
componentFrameCache = new PossiblyWeakMap()
|
|
1971
|
+
var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map
|
|
1972
|
+
componentFrameCache = new PossiblyWeakMap()
|
|
1787
1973
|
}
|
|
1788
1974
|
|
|
1789
1975
|
function describeNativeComponentFrame(fn, construct) {
|
|
1790
1976
|
// If something asked for a stack inside a fake render, it should get ignored.
|
|
1791
|
-
if (
|
|
1792
|
-
return ''
|
|
1977
|
+
if (!fn || reentry) {
|
|
1978
|
+
return ''
|
|
1793
1979
|
}
|
|
1794
1980
|
|
|
1795
1981
|
{
|
|
1796
|
-
var frame = componentFrameCache.get(fn)
|
|
1982
|
+
var frame = componentFrameCache.get(fn)
|
|
1797
1983
|
|
|
1798
1984
|
if (frame !== undefined) {
|
|
1799
|
-
return frame
|
|
1985
|
+
return frame
|
|
1800
1986
|
}
|
|
1801
1987
|
}
|
|
1802
1988
|
|
|
1803
|
-
var control
|
|
1804
|
-
reentry = true
|
|
1805
|
-
var previousPrepareStackTrace = Error.prepareStackTrace
|
|
1989
|
+
var control
|
|
1990
|
+
reentry = true
|
|
1991
|
+
var previousPrepareStackTrace = Error.prepareStackTrace // $FlowFixMe It does accept undefined.
|
|
1806
1992
|
|
|
1807
|
-
Error.prepareStackTrace = undefined
|
|
1808
|
-
var previousDispatcher
|
|
1993
|
+
Error.prepareStackTrace = undefined
|
|
1994
|
+
var previousDispatcher
|
|
1809
1995
|
|
|
1810
1996
|
{
|
|
1811
|
-
previousDispatcher = ReactCurrentDispatcher$1.current
|
|
1997
|
+
previousDispatcher = ReactCurrentDispatcher$1.current // Set the dispatcher in DEV because this might be call in the render function
|
|
1812
1998
|
// for warnings.
|
|
1813
1999
|
|
|
1814
|
-
ReactCurrentDispatcher$1.current = null
|
|
1815
|
-
disableLogs()
|
|
2000
|
+
ReactCurrentDispatcher$1.current = null
|
|
2001
|
+
disableLogs()
|
|
1816
2002
|
}
|
|
1817
2003
|
|
|
1818
2004
|
try {
|
|
@@ -1820,55 +2006,54 @@
|
|
|
1820
2006
|
if (construct) {
|
|
1821
2007
|
// Something should be setting the props in the constructor.
|
|
1822
2008
|
var Fake = function () {
|
|
1823
|
-
throw Error()
|
|
1824
|
-
}
|
|
1825
|
-
|
|
2009
|
+
throw Error()
|
|
2010
|
+
} // $FlowFixMe
|
|
1826
2011
|
|
|
1827
2012
|
Object.defineProperty(Fake.prototype, 'props', {
|
|
1828
2013
|
set: function () {
|
|
1829
2014
|
// We use a throwing setter instead of frozen or non-writable props
|
|
1830
2015
|
// because that won't throw in a non-strict mode function.
|
|
1831
|
-
throw Error()
|
|
1832
|
-
}
|
|
1833
|
-
})
|
|
2016
|
+
throw Error()
|
|
2017
|
+
},
|
|
2018
|
+
})
|
|
1834
2019
|
|
|
1835
2020
|
if (typeof Reflect === 'object' && Reflect.construct) {
|
|
1836
2021
|
// We construct a different control for this case to include any extra
|
|
1837
2022
|
// frames added by the construct call.
|
|
1838
2023
|
try {
|
|
1839
|
-
Reflect.construct(Fake, [])
|
|
2024
|
+
Reflect.construct(Fake, [])
|
|
1840
2025
|
} catch (x) {
|
|
1841
|
-
control = x
|
|
2026
|
+
control = x
|
|
1842
2027
|
}
|
|
1843
2028
|
|
|
1844
|
-
Reflect.construct(fn, [], Fake)
|
|
2029
|
+
Reflect.construct(fn, [], Fake)
|
|
1845
2030
|
} else {
|
|
1846
2031
|
try {
|
|
1847
|
-
Fake.call()
|
|
2032
|
+
Fake.call()
|
|
1848
2033
|
} catch (x) {
|
|
1849
|
-
control = x
|
|
2034
|
+
control = x
|
|
1850
2035
|
}
|
|
1851
2036
|
|
|
1852
|
-
fn.call(Fake.prototype)
|
|
2037
|
+
fn.call(Fake.prototype)
|
|
1853
2038
|
}
|
|
1854
2039
|
} else {
|
|
1855
2040
|
try {
|
|
1856
|
-
throw Error()
|
|
2041
|
+
throw Error()
|
|
1857
2042
|
} catch (x) {
|
|
1858
|
-
control = x
|
|
2043
|
+
control = x
|
|
1859
2044
|
}
|
|
1860
2045
|
|
|
1861
|
-
fn()
|
|
2046
|
+
fn()
|
|
1862
2047
|
}
|
|
1863
2048
|
} catch (sample) {
|
|
1864
2049
|
// This is inlined manually because closure doesn't do it for us.
|
|
1865
2050
|
if (sample && control && typeof sample.stack === 'string') {
|
|
1866
2051
|
// This extracts the first frame from the sample that isn't also in the control.
|
|
1867
2052
|
// Skipping one frame that we assume is the frame that calls the two.
|
|
1868
|
-
var sampleLines = sample.stack.split('\n')
|
|
1869
|
-
var controlLines = control.stack.split('\n')
|
|
1870
|
-
var s = sampleLines.length - 1
|
|
1871
|
-
var c = controlLines.length - 1
|
|
2053
|
+
var sampleLines = sample.stack.split('\n')
|
|
2054
|
+
var controlLines = control.stack.split('\n')
|
|
2055
|
+
var s = sampleLines.length - 1
|
|
2056
|
+
var c = controlLines.length - 1
|
|
1872
2057
|
|
|
1873
2058
|
while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
|
|
1874
2059
|
// We expect at least one stack frame to be shared.
|
|
@@ -1877,7 +2062,7 @@
|
|
|
1877
2062
|
// earlier than the other. We assume that the sample is longer or the same
|
|
1878
2063
|
// and there for cut off earlier. So we should find the root most frame in
|
|
1879
2064
|
// the sample somewhere in the control.
|
|
1880
|
-
c
|
|
2065
|
+
c--
|
|
1881
2066
|
}
|
|
1882
2067
|
|
|
1883
2068
|
for (; s >= 1 && c >= 0; s--, c--) {
|
|
@@ -1891,132 +2076,131 @@
|
|
|
1891
2076
|
// This can happen if you passed a class to function component, or non-function.
|
|
1892
2077
|
if (s !== 1 || c !== 1) {
|
|
1893
2078
|
do {
|
|
1894
|
-
s
|
|
1895
|
-
c
|
|
2079
|
+
s--
|
|
2080
|
+
c-- // We may still have similar intermediate frames from the construct call.
|
|
1896
2081
|
// The next one that isn't the same should be our match though.
|
|
1897
2082
|
|
|
1898
2083
|
if (c < 0 || sampleLines[s] !== controlLines[c]) {
|
|
1899
2084
|
// V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
|
|
1900
|
-
var _frame = '\n' + sampleLines[s].replace(' at new ', ' at ')
|
|
2085
|
+
var _frame = '\n' + sampleLines[s].replace(' at new ', ' at ') // If our component frame is labeled "<anonymous>"
|
|
1901
2086
|
// but we have a user-provided "displayName"
|
|
1902
2087
|
// splice it in to make the stack more readable.
|
|
1903
2088
|
|
|
1904
|
-
|
|
1905
2089
|
if (fn.displayName && _frame.includes('<anonymous>')) {
|
|
1906
|
-
_frame = _frame.replace('<anonymous>', fn.displayName)
|
|
2090
|
+
_frame = _frame.replace('<anonymous>', fn.displayName)
|
|
1907
2091
|
}
|
|
1908
2092
|
|
|
1909
2093
|
{
|
|
1910
2094
|
if (typeof fn === 'function') {
|
|
1911
|
-
componentFrameCache.set(fn, _frame)
|
|
2095
|
+
componentFrameCache.set(fn, _frame)
|
|
1912
2096
|
}
|
|
1913
2097
|
} // Return the line we found.
|
|
1914
2098
|
|
|
1915
|
-
|
|
1916
|
-
return _frame;
|
|
2099
|
+
return _frame
|
|
1917
2100
|
}
|
|
1918
|
-
} while (s >= 1 && c >= 0)
|
|
2101
|
+
} while (s >= 1 && c >= 0)
|
|
1919
2102
|
}
|
|
1920
2103
|
|
|
1921
|
-
break
|
|
2104
|
+
break
|
|
1922
2105
|
}
|
|
1923
2106
|
}
|
|
1924
2107
|
}
|
|
1925
2108
|
} finally {
|
|
1926
|
-
reentry = false
|
|
2109
|
+
reentry = false
|
|
1927
2110
|
|
|
1928
2111
|
{
|
|
1929
|
-
ReactCurrentDispatcher$1.current = previousDispatcher
|
|
1930
|
-
reenableLogs()
|
|
2112
|
+
ReactCurrentDispatcher$1.current = previousDispatcher
|
|
2113
|
+
reenableLogs()
|
|
1931
2114
|
}
|
|
1932
2115
|
|
|
1933
|
-
Error.prepareStackTrace = previousPrepareStackTrace
|
|
2116
|
+
Error.prepareStackTrace = previousPrepareStackTrace
|
|
1934
2117
|
} // Fallback to just using the name if we couldn't make it throw.
|
|
1935
2118
|
|
|
1936
|
-
|
|
1937
|
-
var
|
|
1938
|
-
var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
|
|
2119
|
+
var name = fn ? fn.displayName || fn.name : ''
|
|
2120
|
+
var syntheticFrame = name ? describeBuiltInComponentFrame(name) : ''
|
|
1939
2121
|
|
|
1940
2122
|
{
|
|
1941
2123
|
if (typeof fn === 'function') {
|
|
1942
|
-
componentFrameCache.set(fn, syntheticFrame)
|
|
2124
|
+
componentFrameCache.set(fn, syntheticFrame)
|
|
1943
2125
|
}
|
|
1944
2126
|
}
|
|
1945
2127
|
|
|
1946
|
-
return syntheticFrame
|
|
2128
|
+
return syntheticFrame
|
|
1947
2129
|
}
|
|
1948
2130
|
function describeFunctionComponentFrame(fn, source, ownerFn) {
|
|
1949
2131
|
{
|
|
1950
|
-
return describeNativeComponentFrame(fn, false)
|
|
2132
|
+
return describeNativeComponentFrame(fn, false)
|
|
1951
2133
|
}
|
|
1952
2134
|
}
|
|
1953
2135
|
|
|
1954
2136
|
function shouldConstruct(Component) {
|
|
1955
|
-
var prototype = Component.prototype
|
|
1956
|
-
return !!(prototype && prototype.isReactComponent)
|
|
2137
|
+
var prototype = Component.prototype
|
|
2138
|
+
return !!(prototype && prototype.isReactComponent)
|
|
1957
2139
|
}
|
|
1958
2140
|
|
|
1959
2141
|
function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
|
1960
|
-
|
|
1961
2142
|
if (type == null) {
|
|
1962
|
-
return ''
|
|
2143
|
+
return ''
|
|
1963
2144
|
}
|
|
1964
2145
|
|
|
1965
2146
|
if (typeof type === 'function') {
|
|
1966
2147
|
{
|
|
1967
|
-
return describeNativeComponentFrame(type, shouldConstruct(type))
|
|
2148
|
+
return describeNativeComponentFrame(type, shouldConstruct(type))
|
|
1968
2149
|
}
|
|
1969
2150
|
}
|
|
1970
2151
|
|
|
1971
2152
|
if (typeof type === 'string') {
|
|
1972
|
-
return describeBuiltInComponentFrame(type)
|
|
2153
|
+
return describeBuiltInComponentFrame(type)
|
|
1973
2154
|
}
|
|
1974
2155
|
|
|
1975
2156
|
switch (type) {
|
|
1976
2157
|
case REACT_SUSPENSE_TYPE:
|
|
1977
|
-
return describeBuiltInComponentFrame('Suspense')
|
|
2158
|
+
return describeBuiltInComponentFrame('Suspense')
|
|
1978
2159
|
|
|
1979
2160
|
case REACT_SUSPENSE_LIST_TYPE:
|
|
1980
|
-
return describeBuiltInComponentFrame('SuspenseList')
|
|
2161
|
+
return describeBuiltInComponentFrame('SuspenseList')
|
|
1981
2162
|
}
|
|
1982
2163
|
|
|
1983
2164
|
if (typeof type === 'object') {
|
|
1984
2165
|
switch (type.$$typeof) {
|
|
1985
2166
|
case REACT_FORWARD_REF_TYPE:
|
|
1986
|
-
return describeFunctionComponentFrame(type.render)
|
|
2167
|
+
return describeFunctionComponentFrame(type.render)
|
|
1987
2168
|
|
|
1988
2169
|
case REACT_MEMO_TYPE:
|
|
1989
2170
|
// Memo may contain any component type so we recursively resolve it.
|
|
1990
|
-
return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn)
|
|
2171
|
+
return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn)
|
|
1991
2172
|
|
|
1992
|
-
case REACT_LAZY_TYPE:
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
}
|
|
2173
|
+
case REACT_LAZY_TYPE: {
|
|
2174
|
+
var lazyComponent = type
|
|
2175
|
+
var payload = lazyComponent._payload
|
|
2176
|
+
var init = lazyComponent._init
|
|
2177
|
+
|
|
2178
|
+
try {
|
|
2179
|
+
// Lazy may contain any component type so we recursively resolve it.
|
|
2180
|
+
return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn)
|
|
2181
|
+
} catch (x) {}
|
|
2182
|
+
}
|
|
2003
2183
|
}
|
|
2004
2184
|
}
|
|
2005
2185
|
|
|
2006
|
-
return ''
|
|
2186
|
+
return ''
|
|
2007
2187
|
}
|
|
2008
2188
|
|
|
2009
|
-
var loggedTypeFailures = {}
|
|
2010
|
-
var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame
|
|
2189
|
+
var loggedTypeFailures = {}
|
|
2190
|
+
var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame
|
|
2011
2191
|
|
|
2012
2192
|
function setCurrentlyValidatingElement(element) {
|
|
2013
2193
|
{
|
|
2014
2194
|
if (element) {
|
|
2015
|
-
var owner = element._owner
|
|
2016
|
-
var stack = describeUnknownElementTypeFrameInDEV(
|
|
2017
|
-
|
|
2195
|
+
var owner = element._owner
|
|
2196
|
+
var stack = describeUnknownElementTypeFrameInDEV(
|
|
2197
|
+
element.type,
|
|
2198
|
+
element._source,
|
|
2199
|
+
owner ? owner.type : null
|
|
2200
|
+
)
|
|
2201
|
+
ReactDebugCurrentFrame$1.setExtraStackFrame(stack)
|
|
2018
2202
|
} else {
|
|
2019
|
-
ReactDebugCurrentFrame$1.setExtraStackFrame(null)
|
|
2203
|
+
ReactDebugCurrentFrame$1.setExtraStackFrame(null)
|
|
2020
2204
|
}
|
|
2021
2205
|
}
|
|
2022
2206
|
}
|
|
@@ -2024,11 +2208,11 @@
|
|
|
2024
2208
|
function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
|
2025
2209
|
{
|
|
2026
2210
|
// $FlowFixMe This is okay but Flow doesn't know it.
|
|
2027
|
-
var has = Function.call.bind(hasOwnProperty)
|
|
2211
|
+
var has = Function.call.bind(hasOwnProperty)
|
|
2028
2212
|
|
|
2029
2213
|
for (var typeSpecName in typeSpecs) {
|
|
2030
2214
|
if (has(typeSpecs, typeSpecName)) {
|
|
2031
|
-
var error$1 = void 0
|
|
2215
|
+
var error$1 = void 0 // Prop type validation may throw. In case they do, we don't want to
|
|
2032
2216
|
// fail the render phase where it didn't fail before. So we log it.
|
|
2033
2217
|
// After these have been cleaned up, we'll let them throw.
|
|
2034
2218
|
|
|
@@ -2037,33 +2221,62 @@
|
|
|
2037
2221
|
// behavior as without this statement except with a better message.
|
|
2038
2222
|
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
|
2039
2223
|
// eslint-disable-next-line react-internal/prod-error-codes
|
|
2040
|
-
var err = Error(
|
|
2041
|
-
|
|
2042
|
-
|
|
2224
|
+
var err = Error(
|
|
2225
|
+
(componentName || 'React class') +
|
|
2226
|
+
': ' +
|
|
2227
|
+
location +
|
|
2228
|
+
' type `' +
|
|
2229
|
+
typeSpecName +
|
|
2230
|
+
'` is invalid; ' +
|
|
2231
|
+
'it must be a function, usually from the `prop-types` package, but received `' +
|
|
2232
|
+
typeof typeSpecs[typeSpecName] +
|
|
2233
|
+
'`.' +
|
|
2234
|
+
'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'
|
|
2235
|
+
)
|
|
2236
|
+
err.name = 'Invariant Violation'
|
|
2237
|
+
throw err
|
|
2043
2238
|
}
|
|
2044
2239
|
|
|
2045
|
-
error$1 = typeSpecs[typeSpecName](
|
|
2240
|
+
error$1 = typeSpecs[typeSpecName](
|
|
2241
|
+
values,
|
|
2242
|
+
typeSpecName,
|
|
2243
|
+
componentName,
|
|
2244
|
+
location,
|
|
2245
|
+
null,
|
|
2246
|
+
'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'
|
|
2247
|
+
)
|
|
2046
2248
|
} catch (ex) {
|
|
2047
|
-
error$1 = ex
|
|
2249
|
+
error$1 = ex
|
|
2048
2250
|
}
|
|
2049
2251
|
|
|
2050
2252
|
if (error$1 && !(error$1 instanceof Error)) {
|
|
2051
|
-
setCurrentlyValidatingElement(element)
|
|
2052
|
-
|
|
2053
|
-
error(
|
|
2054
|
-
|
|
2055
|
-
|
|
2253
|
+
setCurrentlyValidatingElement(element)
|
|
2254
|
+
|
|
2255
|
+
error(
|
|
2256
|
+
'%s: type specification of %s' +
|
|
2257
|
+
' `%s` is invalid; the type checker ' +
|
|
2258
|
+
'function must return `null` or an `Error` but returned a %s. ' +
|
|
2259
|
+
'You may have forgotten to pass an argument to the type checker ' +
|
|
2260
|
+
'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
|
|
2261
|
+
'shape all require an argument).',
|
|
2262
|
+
componentName || 'React class',
|
|
2263
|
+
location,
|
|
2264
|
+
typeSpecName,
|
|
2265
|
+
typeof error$1
|
|
2266
|
+
)
|
|
2267
|
+
|
|
2268
|
+
setCurrentlyValidatingElement(null)
|
|
2056
2269
|
}
|
|
2057
2270
|
|
|
2058
2271
|
if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
|
|
2059
2272
|
// Only monitor this failure once because there tends to be a lot of the
|
|
2060
2273
|
// same error.
|
|
2061
|
-
loggedTypeFailures[error$1.message] = true
|
|
2062
|
-
setCurrentlyValidatingElement(element)
|
|
2274
|
+
loggedTypeFailures[error$1.message] = true
|
|
2275
|
+
setCurrentlyValidatingElement(element)
|
|
2063
2276
|
|
|
2064
|
-
error('Failed %s type: %s', location, error$1.message)
|
|
2277
|
+
error('Failed %s type: %s', location, error$1.message)
|
|
2065
2278
|
|
|
2066
|
-
setCurrentlyValidatingElement(null)
|
|
2279
|
+
setCurrentlyValidatingElement(null)
|
|
2067
2280
|
}
|
|
2068
2281
|
}
|
|
2069
2282
|
}
|
|
@@ -2073,49 +2286,53 @@
|
|
|
2073
2286
|
function setCurrentlyValidatingElement$1(element) {
|
|
2074
2287
|
{
|
|
2075
2288
|
if (element) {
|
|
2076
|
-
var owner = element._owner
|
|
2077
|
-
var stack = describeUnknownElementTypeFrameInDEV(
|
|
2078
|
-
|
|
2289
|
+
var owner = element._owner
|
|
2290
|
+
var stack = describeUnknownElementTypeFrameInDEV(
|
|
2291
|
+
element.type,
|
|
2292
|
+
element._source,
|
|
2293
|
+
owner ? owner.type : null
|
|
2294
|
+
)
|
|
2295
|
+
setExtraStackFrame(stack)
|
|
2079
2296
|
} else {
|
|
2080
|
-
setExtraStackFrame(null)
|
|
2297
|
+
setExtraStackFrame(null)
|
|
2081
2298
|
}
|
|
2082
2299
|
}
|
|
2083
2300
|
}
|
|
2084
2301
|
|
|
2085
|
-
var propTypesMisspellWarningShown
|
|
2302
|
+
var propTypesMisspellWarningShown
|
|
2086
2303
|
|
|
2087
2304
|
{
|
|
2088
|
-
propTypesMisspellWarningShown = false
|
|
2305
|
+
propTypesMisspellWarningShown = false
|
|
2089
2306
|
}
|
|
2090
2307
|
|
|
2091
2308
|
function getDeclarationErrorAddendum() {
|
|
2092
2309
|
if (ReactCurrentOwner.current) {
|
|
2093
|
-
var name = getComponentNameFromType(ReactCurrentOwner.current.type)
|
|
2310
|
+
var name = getComponentNameFromType(ReactCurrentOwner.current.type)
|
|
2094
2311
|
|
|
2095
2312
|
if (name) {
|
|
2096
|
-
return '\n\nCheck the render method of `' + name + '`.'
|
|
2313
|
+
return '\n\nCheck the render method of `' + name + '`.'
|
|
2097
2314
|
}
|
|
2098
2315
|
}
|
|
2099
2316
|
|
|
2100
|
-
return ''
|
|
2317
|
+
return ''
|
|
2101
2318
|
}
|
|
2102
2319
|
|
|
2103
2320
|
function getSourceInfoErrorAddendum(source) {
|
|
2104
2321
|
if (source !== undefined) {
|
|
2105
|
-
var fileName = source.fileName.replace(/^.*[\\\/]/, '')
|
|
2106
|
-
var lineNumber = source.lineNumber
|
|
2107
|
-
return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.'
|
|
2322
|
+
var fileName = source.fileName.replace(/^.*[\\\/]/, '')
|
|
2323
|
+
var lineNumber = source.lineNumber
|
|
2324
|
+
return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.'
|
|
2108
2325
|
}
|
|
2109
2326
|
|
|
2110
|
-
return ''
|
|
2327
|
+
return ''
|
|
2111
2328
|
}
|
|
2112
2329
|
|
|
2113
2330
|
function getSourceInfoErrorAddendumForProps(elementProps) {
|
|
2114
2331
|
if (elementProps !== null && elementProps !== undefined) {
|
|
2115
|
-
return getSourceInfoErrorAddendum(elementProps.__source)
|
|
2332
|
+
return getSourceInfoErrorAddendum(elementProps.__source)
|
|
2116
2333
|
}
|
|
2117
2334
|
|
|
2118
|
-
return ''
|
|
2335
|
+
return ''
|
|
2119
2336
|
}
|
|
2120
2337
|
/**
|
|
2121
2338
|
* Warn if there's no key explicitly set on dynamic arrays of children or
|
|
@@ -2123,21 +2340,23 @@
|
|
|
2123
2340
|
* updates.
|
|
2124
2341
|
*/
|
|
2125
2342
|
|
|
2126
|
-
|
|
2127
|
-
var ownerHasKeyUseWarning = {};
|
|
2343
|
+
var ownerHasKeyUseWarning = {}
|
|
2128
2344
|
|
|
2129
2345
|
function getCurrentComponentErrorInfo(parentType) {
|
|
2130
|
-
var info = getDeclarationErrorAddendum()
|
|
2346
|
+
var info = getDeclarationErrorAddendum()
|
|
2131
2347
|
|
|
2132
2348
|
if (!info) {
|
|
2133
|
-
var parentName =
|
|
2349
|
+
var parentName =
|
|
2350
|
+
typeof parentType === 'string'
|
|
2351
|
+
? parentType
|
|
2352
|
+
: parentType.displayName || parentType.name
|
|
2134
2353
|
|
|
2135
2354
|
if (parentName) {
|
|
2136
|
-
info =
|
|
2355
|
+
info = '\n\nCheck the top-level render call using <' + parentName + '>.'
|
|
2137
2356
|
}
|
|
2138
2357
|
}
|
|
2139
2358
|
|
|
2140
|
-
return info
|
|
2359
|
+
return info
|
|
2141
2360
|
}
|
|
2142
2361
|
/**
|
|
2143
2362
|
* Warn if the element doesn't have an explicit key assigned to it.
|
|
@@ -2151,36 +2370,43 @@
|
|
|
2151
2370
|
* @param {*} parentType element's parent's type.
|
|
2152
2371
|
*/
|
|
2153
2372
|
|
|
2154
|
-
|
|
2155
2373
|
function validateExplicitKey(element, parentType) {
|
|
2156
2374
|
if (!element._store || element._store.validated || element.key != null) {
|
|
2157
|
-
return
|
|
2375
|
+
return
|
|
2158
2376
|
}
|
|
2159
2377
|
|
|
2160
|
-
element._store.validated = true
|
|
2161
|
-
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType)
|
|
2378
|
+
element._store.validated = true
|
|
2379
|
+
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType)
|
|
2162
2380
|
|
|
2163
2381
|
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
|
2164
|
-
return
|
|
2382
|
+
return
|
|
2165
2383
|
}
|
|
2166
2384
|
|
|
2167
|
-
ownerHasKeyUseWarning[currentComponentErrorInfo] = true
|
|
2385
|
+
ownerHasKeyUseWarning[currentComponentErrorInfo] = true // Usually the current owner is the offender, but if it accepts children as a
|
|
2168
2386
|
// property, it may be the creator of the child that's responsible for
|
|
2169
2387
|
// assigning it a key.
|
|
2170
2388
|
|
|
2171
|
-
var childOwner = ''
|
|
2389
|
+
var childOwner = ''
|
|
2172
2390
|
|
|
2173
2391
|
if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
|
|
2174
2392
|
// Give the component that originally created this child.
|
|
2175
|
-
childOwner =
|
|
2393
|
+
childOwner =
|
|
2394
|
+
' It was passed a child from ' +
|
|
2395
|
+
getComponentNameFromType(element._owner.type) +
|
|
2396
|
+
'.'
|
|
2176
2397
|
}
|
|
2177
2398
|
|
|
2178
2399
|
{
|
|
2179
|
-
setCurrentlyValidatingElement$1(element)
|
|
2400
|
+
setCurrentlyValidatingElement$1(element)
|
|
2180
2401
|
|
|
2181
|
-
error(
|
|
2402
|
+
error(
|
|
2403
|
+
'Each child in a list should have a unique "key" prop.' +
|
|
2404
|
+
'%s%s See https://reactjs.org/link/warning-keys for more information.',
|
|
2405
|
+
currentComponentErrorInfo,
|
|
2406
|
+
childOwner
|
|
2407
|
+
)
|
|
2182
2408
|
|
|
2183
|
-
setCurrentlyValidatingElement$1(null)
|
|
2409
|
+
setCurrentlyValidatingElement$1(null)
|
|
2184
2410
|
}
|
|
2185
2411
|
}
|
|
2186
2412
|
/**
|
|
@@ -2193,38 +2419,37 @@
|
|
|
2193
2419
|
* @param {*} parentType node's parent's type.
|
|
2194
2420
|
*/
|
|
2195
2421
|
|
|
2196
|
-
|
|
2197
2422
|
function validateChildKeys(node, parentType) {
|
|
2198
2423
|
if (typeof node !== 'object') {
|
|
2199
|
-
return
|
|
2424
|
+
return
|
|
2200
2425
|
}
|
|
2201
2426
|
|
|
2202
2427
|
if (isArray(node)) {
|
|
2203
2428
|
for (var i = 0; i < node.length; i++) {
|
|
2204
|
-
var child = node[i]
|
|
2429
|
+
var child = node[i]
|
|
2205
2430
|
|
|
2206
2431
|
if (isValidElement(child)) {
|
|
2207
|
-
validateExplicitKey(child, parentType)
|
|
2432
|
+
validateExplicitKey(child, parentType)
|
|
2208
2433
|
}
|
|
2209
2434
|
}
|
|
2210
2435
|
} else if (isValidElement(node)) {
|
|
2211
2436
|
// This element was passed in a valid location.
|
|
2212
2437
|
if (node._store) {
|
|
2213
|
-
node._store.validated = true
|
|
2438
|
+
node._store.validated = true
|
|
2214
2439
|
}
|
|
2215
2440
|
} else if (node) {
|
|
2216
|
-
var iteratorFn = getIteratorFn(node)
|
|
2441
|
+
var iteratorFn = getIteratorFn(node)
|
|
2217
2442
|
|
|
2218
2443
|
if (typeof iteratorFn === 'function') {
|
|
2219
2444
|
// Entry iterators used to provide implicit keys,
|
|
2220
2445
|
// but now we print a separate warning for them later.
|
|
2221
2446
|
if (iteratorFn !== node.entries) {
|
|
2222
|
-
var iterator = iteratorFn.call(node)
|
|
2223
|
-
var step
|
|
2447
|
+
var iterator = iteratorFn.call(node)
|
|
2448
|
+
var step
|
|
2224
2449
|
|
|
2225
2450
|
while (!(step = iterator.next()).done) {
|
|
2226
2451
|
if (isValidElement(step.value)) {
|
|
2227
|
-
validateExplicitKey(step.value, parentType)
|
|
2452
|
+
validateExplicitKey(step.value, parentType)
|
|
2228
2453
|
}
|
|
2229
2454
|
}
|
|
2230
2455
|
}
|
|
@@ -2238,41 +2463,52 @@
|
|
|
2238
2463
|
* @param {ReactElement} element
|
|
2239
2464
|
*/
|
|
2240
2465
|
|
|
2241
|
-
|
|
2242
2466
|
function validatePropTypes(element) {
|
|
2243
2467
|
{
|
|
2244
|
-
var type = element.type
|
|
2468
|
+
var type = element.type
|
|
2245
2469
|
|
|
2246
2470
|
if (type === null || type === undefined || typeof type === 'string') {
|
|
2247
|
-
return
|
|
2471
|
+
return
|
|
2248
2472
|
}
|
|
2249
2473
|
|
|
2250
|
-
var propTypes
|
|
2474
|
+
var propTypes
|
|
2251
2475
|
|
|
2252
2476
|
if (typeof type === 'function') {
|
|
2253
|
-
propTypes = type.propTypes
|
|
2254
|
-
} else if (
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2477
|
+
propTypes = type.propTypes
|
|
2478
|
+
} else if (
|
|
2479
|
+
typeof type === 'object' &&
|
|
2480
|
+
(type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
|
|
2481
|
+
// Inner props are checked in the reconciler.
|
|
2482
|
+
type.$$typeof === REACT_MEMO_TYPE)
|
|
2483
|
+
) {
|
|
2484
|
+
propTypes = type.propTypes
|
|
2258
2485
|
} else {
|
|
2259
|
-
return
|
|
2486
|
+
return
|
|
2260
2487
|
}
|
|
2261
2488
|
|
|
2262
2489
|
if (propTypes) {
|
|
2263
2490
|
// Intentionally inside to avoid triggering lazy initializers:
|
|
2264
|
-
var name = getComponentNameFromType(type)
|
|
2265
|
-
checkPropTypes(propTypes, element.props, 'prop', name, element)
|
|
2491
|
+
var name = getComponentNameFromType(type)
|
|
2492
|
+
checkPropTypes(propTypes, element.props, 'prop', name, element)
|
|
2266
2493
|
} else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
|
2267
|
-
propTypesMisspellWarningShown = true
|
|
2494
|
+
propTypesMisspellWarningShown = true // Intentionally inside to avoid triggering lazy initializers:
|
|
2268
2495
|
|
|
2269
|
-
var _name = getComponentNameFromType(type)
|
|
2496
|
+
var _name = getComponentNameFromType(type)
|
|
2270
2497
|
|
|
2271
|
-
error(
|
|
2498
|
+
error(
|
|
2499
|
+
'Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?',
|
|
2500
|
+
_name || 'Unknown'
|
|
2501
|
+
)
|
|
2272
2502
|
}
|
|
2273
2503
|
|
|
2274
|
-
if (
|
|
2275
|
-
|
|
2504
|
+
if (
|
|
2505
|
+
typeof type.getDefaultProps === 'function' &&
|
|
2506
|
+
!type.getDefaultProps.isReactClassApproved
|
|
2507
|
+
) {
|
|
2508
|
+
error(
|
|
2509
|
+
'getDefaultProps is only used on classic React.createClass ' +
|
|
2510
|
+
'definitions. Use a static property named `defaultProps` instead.'
|
|
2511
|
+
)
|
|
2276
2512
|
}
|
|
2277
2513
|
}
|
|
2278
2514
|
}
|
|
@@ -2281,406 +2517,428 @@
|
|
|
2281
2517
|
* @param {ReactElement} fragment
|
|
2282
2518
|
*/
|
|
2283
2519
|
|
|
2284
|
-
|
|
2285
2520
|
function validateFragmentProps(fragment) {
|
|
2286
2521
|
{
|
|
2287
|
-
var keys = Object.keys(fragment.props)
|
|
2522
|
+
var keys = Object.keys(fragment.props)
|
|
2288
2523
|
|
|
2289
2524
|
for (var i = 0; i < keys.length; i++) {
|
|
2290
|
-
var key = keys[i]
|
|
2525
|
+
var key = keys[i]
|
|
2291
2526
|
|
|
2292
2527
|
if (key !== 'children' && key !== 'key') {
|
|
2293
|
-
setCurrentlyValidatingElement$1(fragment)
|
|
2528
|
+
setCurrentlyValidatingElement$1(fragment)
|
|
2294
2529
|
|
|
2295
|
-
error(
|
|
2530
|
+
error(
|
|
2531
|
+
'Invalid prop `%s` supplied to `React.Fragment`. ' +
|
|
2532
|
+
'React.Fragment can only have `key` and `children` props.',
|
|
2533
|
+
key
|
|
2534
|
+
)
|
|
2296
2535
|
|
|
2297
|
-
setCurrentlyValidatingElement$1(null)
|
|
2298
|
-
break
|
|
2536
|
+
setCurrentlyValidatingElement$1(null)
|
|
2537
|
+
break
|
|
2299
2538
|
}
|
|
2300
2539
|
}
|
|
2301
2540
|
|
|
2302
2541
|
if (fragment.ref !== null) {
|
|
2303
|
-
setCurrentlyValidatingElement$1(fragment)
|
|
2542
|
+
setCurrentlyValidatingElement$1(fragment)
|
|
2304
2543
|
|
|
2305
|
-
error('Invalid attribute `ref` supplied to `React.Fragment`.')
|
|
2544
|
+
error('Invalid attribute `ref` supplied to `React.Fragment`.')
|
|
2306
2545
|
|
|
2307
|
-
setCurrentlyValidatingElement$1(null)
|
|
2546
|
+
setCurrentlyValidatingElement$1(null)
|
|
2308
2547
|
}
|
|
2309
2548
|
}
|
|
2310
2549
|
}
|
|
2311
2550
|
function createElementWithValidation(type, props, children) {
|
|
2312
|
-
var validType = isValidElementType(type)
|
|
2551
|
+
var validType = isValidElementType(type) // We warn in this case but don't throw. We expect the element creation to
|
|
2313
2552
|
// succeed and there will likely be errors in render.
|
|
2314
2553
|
|
|
2315
2554
|
if (!validType) {
|
|
2316
|
-
var info = ''
|
|
2555
|
+
var info = ''
|
|
2317
2556
|
|
|
2318
|
-
if (
|
|
2319
|
-
|
|
2557
|
+
if (
|
|
2558
|
+
type === undefined ||
|
|
2559
|
+
(typeof type === 'object' && type !== null && Object.keys(type).length === 0)
|
|
2560
|
+
) {
|
|
2561
|
+
info +=
|
|
2562
|
+
' You likely forgot to export your component from the file ' +
|
|
2563
|
+
"it's defined in, or you might have mixed up default and named imports."
|
|
2320
2564
|
}
|
|
2321
2565
|
|
|
2322
|
-
var sourceInfo = getSourceInfoErrorAddendumForProps(props)
|
|
2566
|
+
var sourceInfo = getSourceInfoErrorAddendumForProps(props)
|
|
2323
2567
|
|
|
2324
2568
|
if (sourceInfo) {
|
|
2325
|
-
info += sourceInfo
|
|
2569
|
+
info += sourceInfo
|
|
2326
2570
|
} else {
|
|
2327
|
-
info += getDeclarationErrorAddendum()
|
|
2571
|
+
info += getDeclarationErrorAddendum()
|
|
2328
2572
|
}
|
|
2329
2573
|
|
|
2330
|
-
var typeString
|
|
2574
|
+
var typeString
|
|
2331
2575
|
|
|
2332
2576
|
if (type === null) {
|
|
2333
|
-
typeString = 'null'
|
|
2577
|
+
typeString = 'null'
|
|
2334
2578
|
} else if (isArray(type)) {
|
|
2335
|
-
typeString = 'array'
|
|
2579
|
+
typeString = 'array'
|
|
2336
2580
|
} else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
|
2337
|
-
typeString =
|
|
2338
|
-
info = ' Did you accidentally export a JSX literal instead of a component?'
|
|
2581
|
+
typeString = '<' + (getComponentNameFromType(type.type) || 'Unknown') + ' />'
|
|
2582
|
+
info = ' Did you accidentally export a JSX literal instead of a component?'
|
|
2339
2583
|
} else {
|
|
2340
|
-
typeString = typeof type
|
|
2584
|
+
typeString = typeof type
|
|
2341
2585
|
}
|
|
2342
2586
|
|
|
2343
2587
|
{
|
|
2344
|
-
error(
|
|
2588
|
+
error(
|
|
2589
|
+
'React.createElement: type is invalid -- expected a string (for ' +
|
|
2590
|
+
'built-in components) or a class/function (for composite ' +
|
|
2591
|
+
'components) but got: %s.%s',
|
|
2592
|
+
typeString,
|
|
2593
|
+
info
|
|
2594
|
+
)
|
|
2345
2595
|
}
|
|
2346
2596
|
}
|
|
2347
2597
|
|
|
2348
|
-
var element = createElement.apply(this, arguments)
|
|
2598
|
+
var element = createElement.apply(this, arguments) // The result can be nullish if a mock or a custom function is used.
|
|
2349
2599
|
// TODO: Drop this when these are no longer allowed as the type argument.
|
|
2350
2600
|
|
|
2351
2601
|
if (element == null) {
|
|
2352
|
-
return element
|
|
2602
|
+
return element
|
|
2353
2603
|
} // Skip key warning if the type isn't valid since our key validation logic
|
|
2354
2604
|
// doesn't expect a non-string/function type and can throw confusing errors.
|
|
2355
2605
|
// We don't want exception behavior to differ between dev and prod.
|
|
2356
2606
|
// (Rendering will throw with a helpful message and as soon as the type is
|
|
2357
2607
|
// fixed, the key warnings will appear.)
|
|
2358
2608
|
|
|
2359
|
-
|
|
2360
2609
|
if (validType) {
|
|
2361
2610
|
for (var i = 2; i < arguments.length; i++) {
|
|
2362
|
-
validateChildKeys(arguments[i], type)
|
|
2611
|
+
validateChildKeys(arguments[i], type)
|
|
2363
2612
|
}
|
|
2364
2613
|
}
|
|
2365
2614
|
|
|
2366
2615
|
if (type === REACT_FRAGMENT_TYPE) {
|
|
2367
|
-
validateFragmentProps(element)
|
|
2616
|
+
validateFragmentProps(element)
|
|
2368
2617
|
} else {
|
|
2369
|
-
validatePropTypes(element)
|
|
2618
|
+
validatePropTypes(element)
|
|
2370
2619
|
}
|
|
2371
2620
|
|
|
2372
|
-
return element
|
|
2621
|
+
return element
|
|
2373
2622
|
}
|
|
2374
|
-
var didWarnAboutDeprecatedCreateFactory = false
|
|
2623
|
+
var didWarnAboutDeprecatedCreateFactory = false
|
|
2375
2624
|
function createFactoryWithValidation(type) {
|
|
2376
|
-
var validatedFactory = createElementWithValidation.bind(null, type)
|
|
2377
|
-
validatedFactory.type = type
|
|
2625
|
+
var validatedFactory = createElementWithValidation.bind(null, type)
|
|
2626
|
+
validatedFactory.type = type
|
|
2378
2627
|
|
|
2379
2628
|
{
|
|
2380
2629
|
if (!didWarnAboutDeprecatedCreateFactory) {
|
|
2381
|
-
didWarnAboutDeprecatedCreateFactory = true
|
|
2630
|
+
didWarnAboutDeprecatedCreateFactory = true
|
|
2382
2631
|
|
|
2383
|
-
warn(
|
|
2632
|
+
warn(
|
|
2633
|
+
'React.createFactory() is deprecated and will be removed in ' +
|
|
2634
|
+
'a future major release. Consider using JSX ' +
|
|
2635
|
+
'or use React.createElement() directly instead.'
|
|
2636
|
+
)
|
|
2384
2637
|
} // Legacy hook: remove it
|
|
2385
2638
|
|
|
2386
|
-
|
|
2387
2639
|
Object.defineProperty(validatedFactory, 'type', {
|
|
2388
2640
|
enumerable: false,
|
|
2389
2641
|
get: function () {
|
|
2390
|
-
warn(
|
|
2642
|
+
warn(
|
|
2643
|
+
'Factory.type is deprecated. Access the class directly ' +
|
|
2644
|
+
'before passing it to createFactory.'
|
|
2645
|
+
)
|
|
2391
2646
|
|
|
2392
2647
|
Object.defineProperty(this, 'type', {
|
|
2393
|
-
value: type
|
|
2394
|
-
})
|
|
2395
|
-
return type
|
|
2396
|
-
}
|
|
2397
|
-
})
|
|
2648
|
+
value: type,
|
|
2649
|
+
})
|
|
2650
|
+
return type
|
|
2651
|
+
},
|
|
2652
|
+
})
|
|
2398
2653
|
}
|
|
2399
2654
|
|
|
2400
|
-
return validatedFactory
|
|
2655
|
+
return validatedFactory
|
|
2401
2656
|
}
|
|
2402
2657
|
function cloneElementWithValidation(element, props, children) {
|
|
2403
|
-
var newElement = cloneElement.apply(this, arguments)
|
|
2658
|
+
var newElement = cloneElement.apply(this, arguments)
|
|
2404
2659
|
|
|
2405
2660
|
for (var i = 2; i < arguments.length; i++) {
|
|
2406
|
-
validateChildKeys(arguments[i], newElement.type)
|
|
2661
|
+
validateChildKeys(arguments[i], newElement.type)
|
|
2407
2662
|
}
|
|
2408
2663
|
|
|
2409
|
-
validatePropTypes(newElement)
|
|
2410
|
-
return newElement
|
|
2664
|
+
validatePropTypes(newElement)
|
|
2665
|
+
return newElement
|
|
2411
2666
|
}
|
|
2412
2667
|
|
|
2413
|
-
var enableSchedulerDebugging = false
|
|
2414
|
-
var enableProfiling = false
|
|
2415
|
-
var frameYieldMs = 5
|
|
2668
|
+
var enableSchedulerDebugging = false
|
|
2669
|
+
var enableProfiling = false
|
|
2670
|
+
var frameYieldMs = 5
|
|
2416
2671
|
|
|
2417
2672
|
function push(heap, node) {
|
|
2418
|
-
var index = heap.length
|
|
2419
|
-
heap.push(node)
|
|
2420
|
-
siftUp(heap, node, index)
|
|
2673
|
+
var index = heap.length
|
|
2674
|
+
heap.push(node)
|
|
2675
|
+
siftUp(heap, node, index)
|
|
2421
2676
|
}
|
|
2422
2677
|
function peek(heap) {
|
|
2423
|
-
return heap.length === 0 ? null : heap[0]
|
|
2678
|
+
return heap.length === 0 ? null : heap[0]
|
|
2424
2679
|
}
|
|
2425
2680
|
function pop(heap) {
|
|
2426
2681
|
if (heap.length === 0) {
|
|
2427
|
-
return null
|
|
2682
|
+
return null
|
|
2428
2683
|
}
|
|
2429
2684
|
|
|
2430
|
-
var first = heap[0]
|
|
2431
|
-
var last = heap.pop()
|
|
2685
|
+
var first = heap[0]
|
|
2686
|
+
var last = heap.pop()
|
|
2432
2687
|
|
|
2433
2688
|
if (last !== first) {
|
|
2434
|
-
heap[0] = last
|
|
2435
|
-
siftDown(heap, last, 0)
|
|
2689
|
+
heap[0] = last
|
|
2690
|
+
siftDown(heap, last, 0)
|
|
2436
2691
|
}
|
|
2437
2692
|
|
|
2438
|
-
return first
|
|
2693
|
+
return first
|
|
2439
2694
|
}
|
|
2440
2695
|
|
|
2441
2696
|
function siftUp(heap, node, i) {
|
|
2442
|
-
var index = i
|
|
2697
|
+
var index = i
|
|
2443
2698
|
|
|
2444
2699
|
while (index > 0) {
|
|
2445
|
-
var parentIndex = index - 1 >>> 1
|
|
2446
|
-
var parent = heap[parentIndex]
|
|
2700
|
+
var parentIndex = (index - 1) >>> 1
|
|
2701
|
+
var parent = heap[parentIndex]
|
|
2447
2702
|
|
|
2448
2703
|
if (compare(parent, node) > 0) {
|
|
2449
2704
|
// The parent is larger. Swap positions.
|
|
2450
|
-
heap[parentIndex] = node
|
|
2451
|
-
heap[index] = parent
|
|
2452
|
-
index = parentIndex
|
|
2705
|
+
heap[parentIndex] = node
|
|
2706
|
+
heap[index] = parent
|
|
2707
|
+
index = parentIndex
|
|
2453
2708
|
} else {
|
|
2454
2709
|
// The parent is smaller. Exit.
|
|
2455
|
-
return
|
|
2710
|
+
return
|
|
2456
2711
|
}
|
|
2457
2712
|
}
|
|
2458
2713
|
}
|
|
2459
2714
|
|
|
2460
2715
|
function siftDown(heap, node, i) {
|
|
2461
|
-
var index = i
|
|
2462
|
-
var length = heap.length
|
|
2463
|
-
var halfLength = length >>> 1
|
|
2716
|
+
var index = i
|
|
2717
|
+
var length = heap.length
|
|
2718
|
+
var halfLength = length >>> 1
|
|
2464
2719
|
|
|
2465
2720
|
while (index < halfLength) {
|
|
2466
|
-
var leftIndex = (index + 1) * 2 - 1
|
|
2467
|
-
var left = heap[leftIndex]
|
|
2468
|
-
var rightIndex = leftIndex + 1
|
|
2469
|
-
var right = heap[rightIndex]
|
|
2721
|
+
var leftIndex = (index + 1) * 2 - 1
|
|
2722
|
+
var left = heap[leftIndex]
|
|
2723
|
+
var rightIndex = leftIndex + 1
|
|
2724
|
+
var right = heap[rightIndex] // If the left or right node is smaller, swap with the smaller of those.
|
|
2470
2725
|
|
|
2471
2726
|
if (compare(left, node) < 0) {
|
|
2472
2727
|
if (rightIndex < length && compare(right, left) < 0) {
|
|
2473
|
-
heap[index] = right
|
|
2474
|
-
heap[rightIndex] = node
|
|
2475
|
-
index = rightIndex
|
|
2728
|
+
heap[index] = right
|
|
2729
|
+
heap[rightIndex] = node
|
|
2730
|
+
index = rightIndex
|
|
2476
2731
|
} else {
|
|
2477
|
-
heap[index] = left
|
|
2478
|
-
heap[leftIndex] = node
|
|
2479
|
-
index = leftIndex
|
|
2732
|
+
heap[index] = left
|
|
2733
|
+
heap[leftIndex] = node
|
|
2734
|
+
index = leftIndex
|
|
2480
2735
|
}
|
|
2481
2736
|
} else if (rightIndex < length && compare(right, node) < 0) {
|
|
2482
|
-
heap[index] = right
|
|
2483
|
-
heap[rightIndex] = node
|
|
2484
|
-
index = rightIndex
|
|
2737
|
+
heap[index] = right
|
|
2738
|
+
heap[rightIndex] = node
|
|
2739
|
+
index = rightIndex
|
|
2485
2740
|
} else {
|
|
2486
2741
|
// Neither child is smaller. Exit.
|
|
2487
|
-
return
|
|
2742
|
+
return
|
|
2488
2743
|
}
|
|
2489
2744
|
}
|
|
2490
2745
|
}
|
|
2491
2746
|
|
|
2492
2747
|
function compare(a, b) {
|
|
2493
2748
|
// Compare sort index first, then task id.
|
|
2494
|
-
var diff = a.sortIndex - b.sortIndex
|
|
2495
|
-
return diff !== 0 ? diff : a.id - b.id
|
|
2749
|
+
var diff = a.sortIndex - b.sortIndex
|
|
2750
|
+
return diff !== 0 ? diff : a.id - b.id
|
|
2496
2751
|
}
|
|
2497
2752
|
|
|
2498
2753
|
// TODO: Use symbols?
|
|
2499
|
-
var ImmediatePriority = 1
|
|
2500
|
-
var UserBlockingPriority = 2
|
|
2501
|
-
var NormalPriority = 3
|
|
2502
|
-
var LowPriority = 4
|
|
2503
|
-
var IdlePriority = 5
|
|
2754
|
+
var ImmediatePriority = 1
|
|
2755
|
+
var UserBlockingPriority = 2
|
|
2756
|
+
var NormalPriority = 3
|
|
2757
|
+
var LowPriority = 4
|
|
2758
|
+
var IdlePriority = 5
|
|
2504
2759
|
|
|
2505
|
-
function markTaskErrored(task, ms) {
|
|
2506
|
-
}
|
|
2760
|
+
function markTaskErrored(task, ms) {}
|
|
2507
2761
|
|
|
2508
2762
|
/* eslint-disable no-var */
|
|
2509
|
-
var getCurrentTime
|
|
2510
|
-
var hasPerformanceNow =
|
|
2763
|
+
var getCurrentTime
|
|
2764
|
+
var hasPerformanceNow =
|
|
2765
|
+
typeof performance === 'object' && typeof performance.now === 'function'
|
|
2511
2766
|
|
|
2512
2767
|
if (hasPerformanceNow) {
|
|
2513
|
-
var localPerformance = performance
|
|
2768
|
+
var localPerformance = performance
|
|
2514
2769
|
|
|
2515
2770
|
getCurrentTime = function () {
|
|
2516
|
-
return localPerformance.now()
|
|
2517
|
-
}
|
|
2771
|
+
return localPerformance.now()
|
|
2772
|
+
}
|
|
2518
2773
|
} else {
|
|
2519
|
-
var localDate = Date
|
|
2520
|
-
var initialTime = localDate.now()
|
|
2774
|
+
var localDate = Date
|
|
2775
|
+
var initialTime = localDate.now()
|
|
2521
2776
|
|
|
2522
2777
|
getCurrentTime = function () {
|
|
2523
|
-
return localDate.now() - initialTime
|
|
2524
|
-
}
|
|
2778
|
+
return localDate.now() - initialTime
|
|
2779
|
+
}
|
|
2525
2780
|
} // Max 31 bit integer. The max integer size in V8 for 32-bit systems.
|
|
2526
2781
|
// Math.pow(2, 30) - 1
|
|
2527
2782
|
// 0b111111111111111111111111111111
|
|
2528
2783
|
|
|
2784
|
+
var maxSigned31BitInt = 1073741823 // Times out immediately
|
|
2529
2785
|
|
|
2530
|
-
var
|
|
2531
|
-
|
|
2532
|
-
var IMMEDIATE_PRIORITY_TIMEOUT = -1; // Eventually times out
|
|
2786
|
+
var IMMEDIATE_PRIORITY_TIMEOUT = -1 // Eventually times out
|
|
2533
2787
|
|
|
2534
|
-
var USER_BLOCKING_PRIORITY_TIMEOUT = 250
|
|
2535
|
-
var NORMAL_PRIORITY_TIMEOUT = 5000
|
|
2536
|
-
var LOW_PRIORITY_TIMEOUT = 10000
|
|
2788
|
+
var USER_BLOCKING_PRIORITY_TIMEOUT = 250
|
|
2789
|
+
var NORMAL_PRIORITY_TIMEOUT = 5000
|
|
2790
|
+
var LOW_PRIORITY_TIMEOUT = 10000 // Never times out
|
|
2537
2791
|
|
|
2538
|
-
var IDLE_PRIORITY_TIMEOUT = maxSigned31BitInt
|
|
2792
|
+
var IDLE_PRIORITY_TIMEOUT = maxSigned31BitInt // Tasks are stored on a min heap
|
|
2539
2793
|
|
|
2540
|
-
var taskQueue = []
|
|
2541
|
-
var timerQueue = []
|
|
2794
|
+
var taskQueue = []
|
|
2795
|
+
var timerQueue = [] // Incrementing id counter. Used to maintain insertion order.
|
|
2542
2796
|
|
|
2543
|
-
var taskIdCounter = 1
|
|
2544
|
-
var currentTask = null
|
|
2545
|
-
var currentPriorityLevel = NormalPriority
|
|
2797
|
+
var taskIdCounter = 1 // Pausing the scheduler is useful for debugging.
|
|
2798
|
+
var currentTask = null
|
|
2799
|
+
var currentPriorityLevel = NormalPriority // This is set while performing work, to prevent re-entrance.
|
|
2546
2800
|
|
|
2547
|
-
var isPerformingWork = false
|
|
2548
|
-
var isHostCallbackScheduled = false
|
|
2549
|
-
var isHostTimeoutScheduled = false
|
|
2801
|
+
var isPerformingWork = false
|
|
2802
|
+
var isHostCallbackScheduled = false
|
|
2803
|
+
var isHostTimeoutScheduled = false // Capture local references to native APIs, in case a polyfill overrides them.
|
|
2550
2804
|
|
|
2551
|
-
var localSetTimeout = typeof setTimeout === 'function' ? setTimeout : null
|
|
2552
|
-
var localClearTimeout = typeof clearTimeout === 'function' ? clearTimeout : null
|
|
2553
|
-
var localSetImmediate = typeof setImmediate !== 'undefined' ? setImmediate : null
|
|
2805
|
+
var localSetTimeout = typeof setTimeout === 'function' ? setTimeout : null
|
|
2806
|
+
var localClearTimeout = typeof clearTimeout === 'function' ? clearTimeout : null
|
|
2807
|
+
var localSetImmediate = typeof setImmediate !== 'undefined' ? setImmediate : null // IE and Node.js + jsdom
|
|
2554
2808
|
|
|
2555
|
-
var isInputPending =
|
|
2809
|
+
var isInputPending =
|
|
2810
|
+
typeof navigator !== 'undefined' &&
|
|
2811
|
+
navigator.scheduling !== undefined &&
|
|
2812
|
+
navigator.scheduling.isInputPending !== undefined
|
|
2813
|
+
? navigator.scheduling.isInputPending.bind(navigator.scheduling)
|
|
2814
|
+
: null
|
|
2556
2815
|
|
|
2557
2816
|
function advanceTimers(currentTime) {
|
|
2558
2817
|
// Check for tasks that are no longer delayed and add them to the queue.
|
|
2559
|
-
var timer = peek(timerQueue)
|
|
2818
|
+
var timer = peek(timerQueue)
|
|
2560
2819
|
|
|
2561
2820
|
while (timer !== null) {
|
|
2562
2821
|
if (timer.callback === null) {
|
|
2563
2822
|
// Timer was cancelled.
|
|
2564
|
-
pop(timerQueue)
|
|
2823
|
+
pop(timerQueue)
|
|
2565
2824
|
} else if (timer.startTime <= currentTime) {
|
|
2566
2825
|
// Timer fired. Transfer to the task queue.
|
|
2567
|
-
pop(timerQueue)
|
|
2568
|
-
timer.sortIndex = timer.expirationTime
|
|
2569
|
-
push(taskQueue, timer)
|
|
2826
|
+
pop(timerQueue)
|
|
2827
|
+
timer.sortIndex = timer.expirationTime
|
|
2828
|
+
push(taskQueue, timer)
|
|
2570
2829
|
} else {
|
|
2571
2830
|
// Remaining timers are pending.
|
|
2572
|
-
return
|
|
2831
|
+
return
|
|
2573
2832
|
}
|
|
2574
2833
|
|
|
2575
|
-
timer = peek(timerQueue)
|
|
2834
|
+
timer = peek(timerQueue)
|
|
2576
2835
|
}
|
|
2577
2836
|
}
|
|
2578
2837
|
|
|
2579
2838
|
function handleTimeout(currentTime) {
|
|
2580
|
-
isHostTimeoutScheduled = false
|
|
2581
|
-
advanceTimers(currentTime)
|
|
2839
|
+
isHostTimeoutScheduled = false
|
|
2840
|
+
advanceTimers(currentTime)
|
|
2582
2841
|
|
|
2583
2842
|
if (!isHostCallbackScheduled) {
|
|
2584
2843
|
if (peek(taskQueue) !== null) {
|
|
2585
|
-
isHostCallbackScheduled = true
|
|
2586
|
-
requestHostCallback(flushWork)
|
|
2844
|
+
isHostCallbackScheduled = true
|
|
2845
|
+
requestHostCallback(flushWork)
|
|
2587
2846
|
} else {
|
|
2588
|
-
var firstTimer = peek(timerQueue)
|
|
2847
|
+
var firstTimer = peek(timerQueue)
|
|
2589
2848
|
|
|
2590
2849
|
if (firstTimer !== null) {
|
|
2591
|
-
requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime)
|
|
2850
|
+
requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime)
|
|
2592
2851
|
}
|
|
2593
2852
|
}
|
|
2594
2853
|
}
|
|
2595
2854
|
}
|
|
2596
2855
|
|
|
2597
2856
|
function flushWork(hasTimeRemaining, initialTime) {
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
isHostCallbackScheduled = false;
|
|
2857
|
+
isHostCallbackScheduled = false
|
|
2601
2858
|
|
|
2602
2859
|
if (isHostTimeoutScheduled) {
|
|
2603
2860
|
// We scheduled a timeout but it's no longer needed. Cancel it.
|
|
2604
|
-
isHostTimeoutScheduled = false
|
|
2605
|
-
cancelHostTimeout()
|
|
2861
|
+
isHostTimeoutScheduled = false
|
|
2862
|
+
cancelHostTimeout()
|
|
2606
2863
|
}
|
|
2607
2864
|
|
|
2608
|
-
isPerformingWork = true
|
|
2609
|
-
var previousPriorityLevel = currentPriorityLevel
|
|
2865
|
+
isPerformingWork = true
|
|
2866
|
+
var previousPriorityLevel = currentPriorityLevel
|
|
2610
2867
|
|
|
2611
2868
|
try {
|
|
2612
2869
|
if (enableProfiling) {
|
|
2613
2870
|
try {
|
|
2614
|
-
return workLoop(hasTimeRemaining, initialTime)
|
|
2871
|
+
return workLoop(hasTimeRemaining, initialTime)
|
|
2615
2872
|
} catch (error) {
|
|
2616
2873
|
if (currentTask !== null) {
|
|
2617
|
-
var currentTime = getCurrentTime()
|
|
2618
|
-
markTaskErrored(currentTask, currentTime)
|
|
2619
|
-
currentTask.isQueued = false
|
|
2874
|
+
var currentTime = getCurrentTime()
|
|
2875
|
+
markTaskErrored(currentTask, currentTime)
|
|
2876
|
+
currentTask.isQueued = false
|
|
2620
2877
|
}
|
|
2621
2878
|
|
|
2622
|
-
throw error
|
|
2879
|
+
throw error
|
|
2623
2880
|
}
|
|
2624
2881
|
} else {
|
|
2625
2882
|
// No catch in prod code path.
|
|
2626
|
-
return workLoop(hasTimeRemaining, initialTime)
|
|
2883
|
+
return workLoop(hasTimeRemaining, initialTime)
|
|
2627
2884
|
}
|
|
2628
2885
|
} finally {
|
|
2629
|
-
currentTask = null
|
|
2630
|
-
currentPriorityLevel = previousPriorityLevel
|
|
2631
|
-
isPerformingWork = false
|
|
2886
|
+
currentTask = null
|
|
2887
|
+
currentPriorityLevel = previousPriorityLevel
|
|
2888
|
+
isPerformingWork = false
|
|
2632
2889
|
}
|
|
2633
2890
|
}
|
|
2634
2891
|
|
|
2635
2892
|
function workLoop(hasTimeRemaining, initialTime) {
|
|
2636
|
-
var currentTime = initialTime
|
|
2637
|
-
advanceTimers(currentTime)
|
|
2638
|
-
currentTask = peek(taskQueue)
|
|
2639
|
-
|
|
2640
|
-
while (currentTask !== null && !
|
|
2641
|
-
if (
|
|
2893
|
+
var currentTime = initialTime
|
|
2894
|
+
advanceTimers(currentTime)
|
|
2895
|
+
currentTask = peek(taskQueue)
|
|
2896
|
+
|
|
2897
|
+
while (currentTask !== null && !enableSchedulerDebugging) {
|
|
2898
|
+
if (
|
|
2899
|
+
currentTask.expirationTime > currentTime &&
|
|
2900
|
+
(!hasTimeRemaining || shouldYieldToHost())
|
|
2901
|
+
) {
|
|
2642
2902
|
// This currentTask hasn't expired, and we've reached the deadline.
|
|
2643
|
-
break
|
|
2903
|
+
break
|
|
2644
2904
|
}
|
|
2645
2905
|
|
|
2646
|
-
var callback = currentTask.callback
|
|
2906
|
+
var callback = currentTask.callback
|
|
2647
2907
|
|
|
2648
2908
|
if (typeof callback === 'function') {
|
|
2649
|
-
currentTask.callback = null
|
|
2650
|
-
currentPriorityLevel = currentTask.priorityLevel
|
|
2651
|
-
var didUserCallbackTimeout = currentTask.expirationTime <= currentTime
|
|
2909
|
+
currentTask.callback = null
|
|
2910
|
+
currentPriorityLevel = currentTask.priorityLevel
|
|
2911
|
+
var didUserCallbackTimeout = currentTask.expirationTime <= currentTime
|
|
2652
2912
|
|
|
2653
|
-
var continuationCallback = callback(didUserCallbackTimeout)
|
|
2654
|
-
currentTime = getCurrentTime()
|
|
2913
|
+
var continuationCallback = callback(didUserCallbackTimeout)
|
|
2914
|
+
currentTime = getCurrentTime()
|
|
2655
2915
|
|
|
2656
2916
|
if (typeof continuationCallback === 'function') {
|
|
2657
|
-
currentTask.callback = continuationCallback
|
|
2917
|
+
currentTask.callback = continuationCallback
|
|
2658
2918
|
} else {
|
|
2659
|
-
|
|
2660
2919
|
if (currentTask === peek(taskQueue)) {
|
|
2661
|
-
pop(taskQueue)
|
|
2920
|
+
pop(taskQueue)
|
|
2662
2921
|
}
|
|
2663
2922
|
}
|
|
2664
2923
|
|
|
2665
|
-
advanceTimers(currentTime)
|
|
2924
|
+
advanceTimers(currentTime)
|
|
2666
2925
|
} else {
|
|
2667
|
-
pop(taskQueue)
|
|
2926
|
+
pop(taskQueue)
|
|
2668
2927
|
}
|
|
2669
2928
|
|
|
2670
|
-
currentTask = peek(taskQueue)
|
|
2929
|
+
currentTask = peek(taskQueue)
|
|
2671
2930
|
} // Return whether there's additional work
|
|
2672
2931
|
|
|
2673
|
-
|
|
2674
2932
|
if (currentTask !== null) {
|
|
2675
|
-
return true
|
|
2933
|
+
return true
|
|
2676
2934
|
} else {
|
|
2677
|
-
var firstTimer = peek(timerQueue)
|
|
2935
|
+
var firstTimer = peek(timerQueue)
|
|
2678
2936
|
|
|
2679
2937
|
if (firstTimer !== null) {
|
|
2680
|
-
requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime)
|
|
2938
|
+
requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime)
|
|
2681
2939
|
}
|
|
2682
2940
|
|
|
2683
|
-
return false
|
|
2941
|
+
return false
|
|
2684
2942
|
}
|
|
2685
2943
|
}
|
|
2686
2944
|
|
|
@@ -2691,249 +2949,244 @@
|
|
|
2691
2949
|
case NormalPriority:
|
|
2692
2950
|
case LowPriority:
|
|
2693
2951
|
case IdlePriority:
|
|
2694
|
-
break
|
|
2952
|
+
break
|
|
2695
2953
|
|
|
2696
2954
|
default:
|
|
2697
|
-
priorityLevel = NormalPriority
|
|
2955
|
+
priorityLevel = NormalPriority
|
|
2698
2956
|
}
|
|
2699
2957
|
|
|
2700
|
-
var previousPriorityLevel = currentPriorityLevel
|
|
2701
|
-
currentPriorityLevel = priorityLevel
|
|
2958
|
+
var previousPriorityLevel = currentPriorityLevel
|
|
2959
|
+
currentPriorityLevel = priorityLevel
|
|
2702
2960
|
|
|
2703
2961
|
try {
|
|
2704
|
-
return eventHandler()
|
|
2962
|
+
return eventHandler()
|
|
2705
2963
|
} finally {
|
|
2706
|
-
currentPriorityLevel = previousPriorityLevel
|
|
2964
|
+
currentPriorityLevel = previousPriorityLevel
|
|
2707
2965
|
}
|
|
2708
2966
|
}
|
|
2709
2967
|
|
|
2710
2968
|
function unstable_next(eventHandler) {
|
|
2711
|
-
var priorityLevel
|
|
2969
|
+
var priorityLevel
|
|
2712
2970
|
|
|
2713
2971
|
switch (currentPriorityLevel) {
|
|
2714
2972
|
case ImmediatePriority:
|
|
2715
2973
|
case UserBlockingPriority:
|
|
2716
2974
|
case NormalPriority:
|
|
2717
2975
|
// Shift down to normal priority
|
|
2718
|
-
priorityLevel = NormalPriority
|
|
2719
|
-
break
|
|
2976
|
+
priorityLevel = NormalPriority
|
|
2977
|
+
break
|
|
2720
2978
|
|
|
2721
2979
|
default:
|
|
2722
2980
|
// Anything lower than normal priority should remain at the current level.
|
|
2723
|
-
priorityLevel = currentPriorityLevel
|
|
2724
|
-
break
|
|
2981
|
+
priorityLevel = currentPriorityLevel
|
|
2982
|
+
break
|
|
2725
2983
|
}
|
|
2726
2984
|
|
|
2727
|
-
var previousPriorityLevel = currentPriorityLevel
|
|
2728
|
-
currentPriorityLevel = priorityLevel
|
|
2985
|
+
var previousPriorityLevel = currentPriorityLevel
|
|
2986
|
+
currentPriorityLevel = priorityLevel
|
|
2729
2987
|
|
|
2730
2988
|
try {
|
|
2731
|
-
return eventHandler()
|
|
2989
|
+
return eventHandler()
|
|
2732
2990
|
} finally {
|
|
2733
|
-
currentPriorityLevel = previousPriorityLevel
|
|
2991
|
+
currentPriorityLevel = previousPriorityLevel
|
|
2734
2992
|
}
|
|
2735
2993
|
}
|
|
2736
2994
|
|
|
2737
2995
|
function unstable_wrapCallback(callback) {
|
|
2738
|
-
var parentPriorityLevel = currentPriorityLevel
|
|
2996
|
+
var parentPriorityLevel = currentPriorityLevel
|
|
2739
2997
|
return function () {
|
|
2740
2998
|
// This is a fork of runWithPriority, inlined for performance.
|
|
2741
|
-
var previousPriorityLevel = currentPriorityLevel
|
|
2742
|
-
currentPriorityLevel = parentPriorityLevel
|
|
2999
|
+
var previousPriorityLevel = currentPriorityLevel
|
|
3000
|
+
currentPriorityLevel = parentPriorityLevel
|
|
2743
3001
|
|
|
2744
3002
|
try {
|
|
2745
|
-
return callback.apply(this, arguments)
|
|
3003
|
+
return callback.apply(this, arguments)
|
|
2746
3004
|
} finally {
|
|
2747
|
-
currentPriorityLevel = previousPriorityLevel
|
|
3005
|
+
currentPriorityLevel = previousPriorityLevel
|
|
2748
3006
|
}
|
|
2749
|
-
}
|
|
3007
|
+
}
|
|
2750
3008
|
}
|
|
2751
3009
|
|
|
2752
3010
|
function unstable_scheduleCallback(priorityLevel, callback, options) {
|
|
2753
|
-
var currentTime = getCurrentTime()
|
|
2754
|
-
var startTime
|
|
3011
|
+
var currentTime = getCurrentTime()
|
|
3012
|
+
var startTime
|
|
2755
3013
|
|
|
2756
3014
|
if (typeof options === 'object' && options !== null) {
|
|
2757
|
-
var delay = options.delay
|
|
3015
|
+
var delay = options.delay
|
|
2758
3016
|
|
|
2759
3017
|
if (typeof delay === 'number' && delay > 0) {
|
|
2760
|
-
startTime = currentTime + delay
|
|
3018
|
+
startTime = currentTime + delay
|
|
2761
3019
|
} else {
|
|
2762
|
-
startTime = currentTime
|
|
3020
|
+
startTime = currentTime
|
|
2763
3021
|
}
|
|
2764
3022
|
} else {
|
|
2765
|
-
startTime = currentTime
|
|
3023
|
+
startTime = currentTime
|
|
2766
3024
|
}
|
|
2767
3025
|
|
|
2768
|
-
var timeout
|
|
3026
|
+
var timeout
|
|
2769
3027
|
|
|
2770
3028
|
switch (priorityLevel) {
|
|
2771
3029
|
case ImmediatePriority:
|
|
2772
|
-
timeout = IMMEDIATE_PRIORITY_TIMEOUT
|
|
2773
|
-
break
|
|
3030
|
+
timeout = IMMEDIATE_PRIORITY_TIMEOUT
|
|
3031
|
+
break
|
|
2774
3032
|
|
|
2775
3033
|
case UserBlockingPriority:
|
|
2776
|
-
timeout = USER_BLOCKING_PRIORITY_TIMEOUT
|
|
2777
|
-
break
|
|
3034
|
+
timeout = USER_BLOCKING_PRIORITY_TIMEOUT
|
|
3035
|
+
break
|
|
2778
3036
|
|
|
2779
3037
|
case IdlePriority:
|
|
2780
|
-
timeout = IDLE_PRIORITY_TIMEOUT
|
|
2781
|
-
break
|
|
3038
|
+
timeout = IDLE_PRIORITY_TIMEOUT
|
|
3039
|
+
break
|
|
2782
3040
|
|
|
2783
3041
|
case LowPriority:
|
|
2784
|
-
timeout = LOW_PRIORITY_TIMEOUT
|
|
2785
|
-
break
|
|
3042
|
+
timeout = LOW_PRIORITY_TIMEOUT
|
|
3043
|
+
break
|
|
2786
3044
|
|
|
2787
3045
|
case NormalPriority:
|
|
2788
3046
|
default:
|
|
2789
|
-
timeout = NORMAL_PRIORITY_TIMEOUT
|
|
2790
|
-
break
|
|
3047
|
+
timeout = NORMAL_PRIORITY_TIMEOUT
|
|
3048
|
+
break
|
|
2791
3049
|
}
|
|
2792
3050
|
|
|
2793
|
-
var expirationTime = startTime + timeout
|
|
3051
|
+
var expirationTime = startTime + timeout
|
|
2794
3052
|
var newTask = {
|
|
2795
3053
|
id: taskIdCounter++,
|
|
2796
3054
|
callback: callback,
|
|
2797
3055
|
priorityLevel: priorityLevel,
|
|
2798
3056
|
startTime: startTime,
|
|
2799
3057
|
expirationTime: expirationTime,
|
|
2800
|
-
sortIndex: -1
|
|
2801
|
-
}
|
|
3058
|
+
sortIndex: -1,
|
|
3059
|
+
}
|
|
2802
3060
|
|
|
2803
3061
|
if (startTime > currentTime) {
|
|
2804
3062
|
// This is a delayed task.
|
|
2805
|
-
newTask.sortIndex = startTime
|
|
2806
|
-
push(timerQueue, newTask)
|
|
3063
|
+
newTask.sortIndex = startTime
|
|
3064
|
+
push(timerQueue, newTask)
|
|
2807
3065
|
|
|
2808
3066
|
if (peek(taskQueue) === null && newTask === peek(timerQueue)) {
|
|
2809
3067
|
// All tasks are delayed, and this is the task with the earliest delay.
|
|
2810
3068
|
if (isHostTimeoutScheduled) {
|
|
2811
3069
|
// Cancel an existing timeout.
|
|
2812
|
-
cancelHostTimeout()
|
|
3070
|
+
cancelHostTimeout()
|
|
2813
3071
|
} else {
|
|
2814
|
-
isHostTimeoutScheduled = true
|
|
3072
|
+
isHostTimeoutScheduled = true
|
|
2815
3073
|
} // Schedule a timeout.
|
|
2816
3074
|
|
|
2817
|
-
|
|
2818
|
-
requestHostTimeout(handleTimeout, startTime - currentTime);
|
|
3075
|
+
requestHostTimeout(handleTimeout, startTime - currentTime)
|
|
2819
3076
|
}
|
|
2820
3077
|
} else {
|
|
2821
|
-
newTask.sortIndex = expirationTime
|
|
2822
|
-
push(taskQueue, newTask)
|
|
3078
|
+
newTask.sortIndex = expirationTime
|
|
3079
|
+
push(taskQueue, newTask)
|
|
2823
3080
|
// wait until the next time we yield.
|
|
2824
3081
|
|
|
2825
|
-
|
|
2826
3082
|
if (!isHostCallbackScheduled && !isPerformingWork) {
|
|
2827
|
-
isHostCallbackScheduled = true
|
|
2828
|
-
requestHostCallback(flushWork)
|
|
3083
|
+
isHostCallbackScheduled = true
|
|
3084
|
+
requestHostCallback(flushWork)
|
|
2829
3085
|
}
|
|
2830
3086
|
}
|
|
2831
3087
|
|
|
2832
|
-
return newTask
|
|
3088
|
+
return newTask
|
|
2833
3089
|
}
|
|
2834
3090
|
|
|
2835
|
-
function unstable_pauseExecution() {
|
|
2836
|
-
}
|
|
3091
|
+
function unstable_pauseExecution() {}
|
|
2837
3092
|
|
|
2838
3093
|
function unstable_continueExecution() {
|
|
2839
|
-
|
|
2840
3094
|
if (!isHostCallbackScheduled && !isPerformingWork) {
|
|
2841
|
-
isHostCallbackScheduled = true
|
|
2842
|
-
requestHostCallback(flushWork)
|
|
3095
|
+
isHostCallbackScheduled = true
|
|
3096
|
+
requestHostCallback(flushWork)
|
|
2843
3097
|
}
|
|
2844
3098
|
}
|
|
2845
3099
|
|
|
2846
3100
|
function unstable_getFirstCallbackNode() {
|
|
2847
|
-
return peek(taskQueue)
|
|
3101
|
+
return peek(taskQueue)
|
|
2848
3102
|
}
|
|
2849
3103
|
|
|
2850
3104
|
function unstable_cancelCallback(task) {
|
|
2851
3105
|
// remove from the queue because you can't remove arbitrary nodes from an
|
|
2852
3106
|
// array based heap, only the first one.)
|
|
2853
3107
|
|
|
2854
|
-
|
|
2855
|
-
task.callback = null;
|
|
3108
|
+
task.callback = null
|
|
2856
3109
|
}
|
|
2857
3110
|
|
|
2858
3111
|
function unstable_getCurrentPriorityLevel() {
|
|
2859
|
-
return currentPriorityLevel
|
|
3112
|
+
return currentPriorityLevel
|
|
2860
3113
|
}
|
|
2861
3114
|
|
|
2862
|
-
var isMessageLoopRunning = false
|
|
2863
|
-
var scheduledHostCallback = null
|
|
2864
|
-
var taskTimeoutID = -1
|
|
3115
|
+
var isMessageLoopRunning = false
|
|
3116
|
+
var scheduledHostCallback = null
|
|
3117
|
+
var taskTimeoutID = -1 // Scheduler periodically yields in case there is other work on the main
|
|
2865
3118
|
// thread, like user events. By default, it yields multiple times per frame.
|
|
2866
3119
|
// It does not attempt to align with frame boundaries, since most tasks don't
|
|
2867
3120
|
// need to be frame aligned; for those that do, use requestAnimationFrame.
|
|
2868
3121
|
|
|
2869
|
-
var frameInterval = frameYieldMs
|
|
2870
|
-
var startTime = -1
|
|
3122
|
+
var frameInterval = frameYieldMs
|
|
3123
|
+
var startTime = -1
|
|
2871
3124
|
|
|
2872
3125
|
function shouldYieldToHost() {
|
|
2873
|
-
var timeElapsed = getCurrentTime() - startTime
|
|
3126
|
+
var timeElapsed = getCurrentTime() - startTime
|
|
2874
3127
|
|
|
2875
3128
|
if (timeElapsed < frameInterval) {
|
|
2876
3129
|
// The main thread has only been blocked for a really short amount of time;
|
|
2877
3130
|
// smaller than a single frame. Don't yield yet.
|
|
2878
|
-
return false
|
|
3131
|
+
return false
|
|
2879
3132
|
} // The main thread has been blocked for a non-negligible amount of time. We
|
|
2880
3133
|
|
|
2881
|
-
|
|
2882
|
-
return true;
|
|
3134
|
+
return true
|
|
2883
3135
|
}
|
|
2884
3136
|
|
|
2885
|
-
function requestPaint() {
|
|
2886
|
-
|
|
2887
|
-
}
|
|
3137
|
+
function requestPaint() {}
|
|
2888
3138
|
|
|
2889
3139
|
function forceFrameRate(fps) {
|
|
2890
3140
|
if (fps < 0 || fps > 125) {
|
|
2891
3141
|
// Using console['error'] to evade Babel and ESLint
|
|
2892
|
-
console['error'](
|
|
2893
|
-
|
|
3142
|
+
console['error'](
|
|
3143
|
+
'forceFrameRate takes a positive int between 0 and 125, ' +
|
|
3144
|
+
'forcing frame rates higher than 125 fps is not supported'
|
|
3145
|
+
)
|
|
3146
|
+
return
|
|
2894
3147
|
}
|
|
2895
3148
|
|
|
2896
3149
|
if (fps > 0) {
|
|
2897
|
-
frameInterval = Math.floor(1000 / fps)
|
|
3150
|
+
frameInterval = Math.floor(1000 / fps)
|
|
2898
3151
|
} else {
|
|
2899
3152
|
// reset the framerate
|
|
2900
|
-
frameInterval = frameYieldMs
|
|
3153
|
+
frameInterval = frameYieldMs
|
|
2901
3154
|
}
|
|
2902
3155
|
}
|
|
2903
3156
|
|
|
2904
3157
|
var performWorkUntilDeadline = function () {
|
|
2905
3158
|
if (scheduledHostCallback !== null) {
|
|
2906
|
-
var currentTime = getCurrentTime()
|
|
3159
|
+
var currentTime = getCurrentTime() // Keep track of the start time so we can measure how long the main thread
|
|
2907
3160
|
// has been blocked.
|
|
2908
3161
|
|
|
2909
|
-
startTime = currentTime
|
|
2910
|
-
var hasTimeRemaining = true
|
|
3162
|
+
startTime = currentTime
|
|
3163
|
+
var hasTimeRemaining = true // If a scheduler task throws, exit the current browser task so the
|
|
2911
3164
|
// error can be observed.
|
|
2912
3165
|
//
|
|
2913
3166
|
// Intentionally not using a try-catch, since that makes some debugging
|
|
2914
3167
|
// techniques harder. Instead, if `scheduledHostCallback` errors, then
|
|
2915
3168
|
// `hasMoreWork` will remain true, and we'll continue the work loop.
|
|
2916
3169
|
|
|
2917
|
-
var hasMoreWork = true
|
|
3170
|
+
var hasMoreWork = true
|
|
2918
3171
|
|
|
2919
3172
|
try {
|
|
2920
|
-
hasMoreWork = scheduledHostCallback(hasTimeRemaining, currentTime)
|
|
3173
|
+
hasMoreWork = scheduledHostCallback(hasTimeRemaining, currentTime)
|
|
2921
3174
|
} finally {
|
|
2922
3175
|
if (hasMoreWork) {
|
|
2923
3176
|
// If there's more work, schedule the next message event at the end
|
|
2924
3177
|
// of the preceding one.
|
|
2925
|
-
schedulePerformWorkUntilDeadline()
|
|
3178
|
+
schedulePerformWorkUntilDeadline()
|
|
2926
3179
|
} else {
|
|
2927
|
-
isMessageLoopRunning = false
|
|
2928
|
-
scheduledHostCallback = null
|
|
3180
|
+
isMessageLoopRunning = false
|
|
3181
|
+
scheduledHostCallback = null
|
|
2929
3182
|
}
|
|
2930
3183
|
}
|
|
2931
3184
|
} else {
|
|
2932
|
-
isMessageLoopRunning = false
|
|
3185
|
+
isMessageLoopRunning = false
|
|
2933
3186
|
} // Yielding to the browser will give it a chance to paint, so we can
|
|
2934
|
-
}
|
|
3187
|
+
}
|
|
2935
3188
|
|
|
2936
|
-
var schedulePerformWorkUntilDeadline
|
|
3189
|
+
var schedulePerformWorkUntilDeadline
|
|
2937
3190
|
|
|
2938
3191
|
if (typeof localSetImmediate === 'function') {
|
|
2939
3192
|
// Node.js and old IE.
|
|
@@ -2948,51 +3201,49 @@
|
|
|
2948
3201
|
// If other browsers ever implement it, it's better to use it.
|
|
2949
3202
|
// Although both of these would be inferior to native scheduling.
|
|
2950
3203
|
schedulePerformWorkUntilDeadline = function () {
|
|
2951
|
-
localSetImmediate(performWorkUntilDeadline)
|
|
2952
|
-
}
|
|
3204
|
+
localSetImmediate(performWorkUntilDeadline)
|
|
3205
|
+
}
|
|
2953
3206
|
} else if (typeof MessageChannel !== 'undefined') {
|
|
2954
3207
|
// DOM and Worker environments.
|
|
2955
3208
|
// We prefer MessageChannel because of the 4ms setTimeout clamping.
|
|
2956
|
-
var channel = new MessageChannel()
|
|
2957
|
-
var port = channel.port2
|
|
2958
|
-
channel.port1.onmessage = performWorkUntilDeadline
|
|
3209
|
+
var channel = new MessageChannel()
|
|
3210
|
+
var port = channel.port2
|
|
3211
|
+
channel.port1.onmessage = performWorkUntilDeadline
|
|
2959
3212
|
|
|
2960
3213
|
schedulePerformWorkUntilDeadline = function () {
|
|
2961
|
-
port.postMessage(null)
|
|
2962
|
-
}
|
|
3214
|
+
port.postMessage(null)
|
|
3215
|
+
}
|
|
2963
3216
|
} else {
|
|
2964
3217
|
// We should only fallback here in non-browser environments.
|
|
2965
3218
|
schedulePerformWorkUntilDeadline = function () {
|
|
2966
|
-
localSetTimeout(performWorkUntilDeadline, 0)
|
|
2967
|
-
}
|
|
3219
|
+
localSetTimeout(performWorkUntilDeadline, 0)
|
|
3220
|
+
}
|
|
2968
3221
|
}
|
|
2969
3222
|
|
|
2970
3223
|
function requestHostCallback(callback) {
|
|
2971
|
-
scheduledHostCallback = callback
|
|
3224
|
+
scheduledHostCallback = callback
|
|
2972
3225
|
|
|
2973
3226
|
if (!isMessageLoopRunning) {
|
|
2974
|
-
isMessageLoopRunning = true
|
|
2975
|
-
schedulePerformWorkUntilDeadline()
|
|
3227
|
+
isMessageLoopRunning = true
|
|
3228
|
+
schedulePerformWorkUntilDeadline()
|
|
2976
3229
|
}
|
|
2977
3230
|
}
|
|
2978
3231
|
|
|
2979
3232
|
function requestHostTimeout(callback, ms) {
|
|
2980
3233
|
taskTimeoutID = localSetTimeout(function () {
|
|
2981
|
-
callback(getCurrentTime())
|
|
2982
|
-
}, ms)
|
|
3234
|
+
callback(getCurrentTime())
|
|
3235
|
+
}, ms)
|
|
2983
3236
|
}
|
|
2984
3237
|
|
|
2985
3238
|
function cancelHostTimeout() {
|
|
2986
|
-
localClearTimeout(taskTimeoutID)
|
|
2987
|
-
taskTimeoutID = -1
|
|
3239
|
+
localClearTimeout(taskTimeoutID)
|
|
3240
|
+
taskTimeoutID = -1
|
|
2988
3241
|
}
|
|
2989
3242
|
|
|
2990
|
-
var unstable_requestPaint = requestPaint
|
|
2991
|
-
var unstable_Profiling =
|
|
2992
|
-
|
|
2993
|
-
|
|
3243
|
+
var unstable_requestPaint = requestPaint
|
|
3244
|
+
var unstable_Profiling = null
|
|
2994
3245
|
|
|
2995
|
-
var Scheduler = /*#__PURE__*/Object.freeze({
|
|
3246
|
+
var Scheduler = /*#__PURE__*/ Object.freeze({
|
|
2996
3247
|
__proto__: null,
|
|
2997
3248
|
unstable_ImmediatePriority: ImmediatePriority,
|
|
2998
3249
|
unstable_UserBlockingPriority: UserBlockingPriority,
|
|
@@ -3010,10 +3261,12 @@
|
|
|
3010
3261
|
unstable_continueExecution: unstable_continueExecution,
|
|
3011
3262
|
unstable_pauseExecution: unstable_pauseExecution,
|
|
3012
3263
|
unstable_getFirstCallbackNode: unstable_getFirstCallbackNode,
|
|
3013
|
-
get unstable_now
|
|
3264
|
+
get unstable_now() {
|
|
3265
|
+
return getCurrentTime
|
|
3266
|
+
},
|
|
3014
3267
|
unstable_forceFrameRate: forceFrameRate,
|
|
3015
|
-
unstable_Profiling: unstable_Profiling
|
|
3016
|
-
})
|
|
3268
|
+
unstable_Profiling: unstable_Profiling,
|
|
3269
|
+
})
|
|
3017
3270
|
|
|
3018
3271
|
var ReactSharedInternals$1 = {
|
|
3019
3272
|
ReactCurrentDispatcher: ReactCurrentDispatcher,
|
|
@@ -3024,54 +3277,58 @@
|
|
|
3024
3277
|
// Since that would be a breaking change (e.g. for all existing CodeSandboxes).
|
|
3025
3278
|
// This re-export is only required for UMD bundles;
|
|
3026
3279
|
// CJS bundles use the shared NPM package.
|
|
3027
|
-
Scheduler: Scheduler
|
|
3028
|
-
}
|
|
3280
|
+
Scheduler: Scheduler,
|
|
3281
|
+
}
|
|
3029
3282
|
|
|
3030
3283
|
{
|
|
3031
|
-
ReactSharedInternals$1.ReactCurrentActQueue = ReactCurrentActQueue
|
|
3032
|
-
ReactSharedInternals$1.ReactDebugCurrentFrame = ReactDebugCurrentFrame
|
|
3284
|
+
ReactSharedInternals$1.ReactCurrentActQueue = ReactCurrentActQueue
|
|
3285
|
+
ReactSharedInternals$1.ReactDebugCurrentFrame = ReactDebugCurrentFrame
|
|
3033
3286
|
}
|
|
3034
3287
|
|
|
3035
3288
|
function startTransition(scope, options) {
|
|
3036
|
-
var prevTransition = ReactCurrentBatchConfig.transition
|
|
3037
|
-
ReactCurrentBatchConfig.transition = {}
|
|
3038
|
-
var currentTransition = ReactCurrentBatchConfig.transition
|
|
3289
|
+
var prevTransition = ReactCurrentBatchConfig.transition
|
|
3290
|
+
ReactCurrentBatchConfig.transition = {}
|
|
3291
|
+
var currentTransition = ReactCurrentBatchConfig.transition
|
|
3039
3292
|
|
|
3040
3293
|
{
|
|
3041
|
-
ReactCurrentBatchConfig.transition._updatedFibers = new Set()
|
|
3294
|
+
ReactCurrentBatchConfig.transition._updatedFibers = new Set()
|
|
3042
3295
|
}
|
|
3043
3296
|
|
|
3044
3297
|
try {
|
|
3045
|
-
scope()
|
|
3298
|
+
scope()
|
|
3046
3299
|
} finally {
|
|
3047
|
-
ReactCurrentBatchConfig.transition = prevTransition
|
|
3300
|
+
ReactCurrentBatchConfig.transition = prevTransition
|
|
3048
3301
|
|
|
3049
3302
|
{
|
|
3050
3303
|
if (prevTransition === null && currentTransition._updatedFibers) {
|
|
3051
|
-
var updatedFibersCount = currentTransition._updatedFibers.size
|
|
3304
|
+
var updatedFibersCount = currentTransition._updatedFibers.size
|
|
3052
3305
|
|
|
3053
3306
|
if (updatedFibersCount > 10) {
|
|
3054
|
-
warn(
|
|
3307
|
+
warn(
|
|
3308
|
+
'Detected a large number of updates inside startTransition. ' +
|
|
3309
|
+
'If this is due to a subscription please re-write it to use React provided hooks. ' +
|
|
3310
|
+
'Otherwise concurrent mode guarantees are off the table.'
|
|
3311
|
+
)
|
|
3055
3312
|
}
|
|
3056
3313
|
|
|
3057
|
-
currentTransition._updatedFibers.clear()
|
|
3314
|
+
currentTransition._updatedFibers.clear()
|
|
3058
3315
|
}
|
|
3059
3316
|
}
|
|
3060
3317
|
}
|
|
3061
3318
|
}
|
|
3062
3319
|
|
|
3063
|
-
var didWarnAboutMessageChannel = false
|
|
3064
|
-
var enqueueTaskImpl = null
|
|
3320
|
+
var didWarnAboutMessageChannel = false
|
|
3321
|
+
var enqueueTaskImpl = null
|
|
3065
3322
|
function enqueueTask(task) {
|
|
3066
3323
|
if (enqueueTaskImpl === null) {
|
|
3067
3324
|
try {
|
|
3068
3325
|
// read require off the module object to get around the bundlers.
|
|
3069
3326
|
// we don't want them to detect a require and bundle a Node polyfill.
|
|
3070
|
-
var requireString = ('require' + Math.random()).slice(0, 7)
|
|
3071
|
-
var nodeRequire = module && module[requireString]
|
|
3327
|
+
var requireString = ('require' + Math.random()).slice(0, 7)
|
|
3328
|
+
var nodeRequire = module && module[requireString] // assuming we're in node, let's try to get node's
|
|
3072
3329
|
// version of setImmediate, bypassing fake timers if any.
|
|
3073
3330
|
|
|
3074
|
-
enqueueTaskImpl = nodeRequire.call(module, 'timers').setImmediate
|
|
3331
|
+
enqueueTaskImpl = nodeRequire.call(module, 'timers').setImmediate
|
|
3075
3332
|
} catch (_err) {
|
|
3076
3333
|
// we're in a browser
|
|
3077
3334
|
// we can't use regular timers because they may still be faked
|
|
@@ -3079,124 +3336,143 @@
|
|
|
3079
3336
|
enqueueTaskImpl = function (callback) {
|
|
3080
3337
|
{
|
|
3081
3338
|
if (didWarnAboutMessageChannel === false) {
|
|
3082
|
-
didWarnAboutMessageChannel = true
|
|
3339
|
+
didWarnAboutMessageChannel = true
|
|
3083
3340
|
|
|
3084
3341
|
if (typeof MessageChannel === 'undefined') {
|
|
3085
|
-
error(
|
|
3342
|
+
error(
|
|
3343
|
+
'This browser does not have a MessageChannel implementation, ' +
|
|
3344
|
+
'so enqueuing tasks via await act(async () => ...) will fail. ' +
|
|
3345
|
+
'Please file an issue at https://github.com/facebook/react/issues ' +
|
|
3346
|
+
'if you encounter this warning.'
|
|
3347
|
+
)
|
|
3086
3348
|
}
|
|
3087
3349
|
}
|
|
3088
3350
|
}
|
|
3089
3351
|
|
|
3090
|
-
var channel = new MessageChannel()
|
|
3091
|
-
channel.port1.onmessage = callback
|
|
3092
|
-
channel.port2.postMessage(undefined)
|
|
3093
|
-
}
|
|
3352
|
+
var channel = new MessageChannel()
|
|
3353
|
+
channel.port1.onmessage = callback
|
|
3354
|
+
channel.port2.postMessage(undefined)
|
|
3355
|
+
}
|
|
3094
3356
|
}
|
|
3095
3357
|
}
|
|
3096
3358
|
|
|
3097
|
-
return enqueueTaskImpl(task)
|
|
3359
|
+
return enqueueTaskImpl(task)
|
|
3098
3360
|
}
|
|
3099
3361
|
|
|
3100
|
-
var actScopeDepth = 0
|
|
3101
|
-
var didWarnNoAwaitAct = false
|
|
3362
|
+
var actScopeDepth = 0
|
|
3363
|
+
var didWarnNoAwaitAct = false
|
|
3102
3364
|
function act(callback) {
|
|
3103
3365
|
{
|
|
3104
3366
|
// `act` calls can be nested, so we track the depth. This represents the
|
|
3105
3367
|
// number of `act` scopes on the stack.
|
|
3106
|
-
var prevActScopeDepth = actScopeDepth
|
|
3107
|
-
actScopeDepth
|
|
3368
|
+
var prevActScopeDepth = actScopeDepth
|
|
3369
|
+
actScopeDepth++
|
|
3108
3370
|
|
|
3109
3371
|
if (ReactCurrentActQueue.current === null) {
|
|
3110
3372
|
// This is the outermost `act` scope. Initialize the queue. The reconciler
|
|
3111
3373
|
// will detect the queue and use it instead of Scheduler.
|
|
3112
|
-
ReactCurrentActQueue.current = []
|
|
3374
|
+
ReactCurrentActQueue.current = []
|
|
3113
3375
|
}
|
|
3114
3376
|
|
|
3115
|
-
var prevIsBatchingLegacy = ReactCurrentActQueue.isBatchingLegacy
|
|
3116
|
-
var result
|
|
3377
|
+
var prevIsBatchingLegacy = ReactCurrentActQueue.isBatchingLegacy
|
|
3378
|
+
var result
|
|
3117
3379
|
|
|
3118
3380
|
try {
|
|
3119
3381
|
// Used to reproduce behavior of `batchedUpdates` in legacy mode. Only
|
|
3120
3382
|
// set to `true` while the given callback is executed, not for updates
|
|
3121
3383
|
// triggered during an async event, because this is how the legacy
|
|
3122
3384
|
// implementation of `act` behaved.
|
|
3123
|
-
ReactCurrentActQueue.isBatchingLegacy = true
|
|
3124
|
-
result = callback()
|
|
3385
|
+
ReactCurrentActQueue.isBatchingLegacy = true
|
|
3386
|
+
result = callback() // Replicate behavior of original `act` implementation in legacy mode,
|
|
3125
3387
|
// which flushed updates immediately after the scope function exits, even
|
|
3126
3388
|
// if it's an async function.
|
|
3127
3389
|
|
|
3128
3390
|
if (!prevIsBatchingLegacy && ReactCurrentActQueue.didScheduleLegacyUpdate) {
|
|
3129
|
-
var queue = ReactCurrentActQueue.current
|
|
3391
|
+
var queue = ReactCurrentActQueue.current
|
|
3130
3392
|
|
|
3131
3393
|
if (queue !== null) {
|
|
3132
|
-
ReactCurrentActQueue.didScheduleLegacyUpdate = false
|
|
3133
|
-
flushActQueue(queue)
|
|
3394
|
+
ReactCurrentActQueue.didScheduleLegacyUpdate = false
|
|
3395
|
+
flushActQueue(queue)
|
|
3134
3396
|
}
|
|
3135
3397
|
}
|
|
3136
3398
|
} catch (error) {
|
|
3137
|
-
popActScope(prevActScopeDepth)
|
|
3138
|
-
throw error
|
|
3399
|
+
popActScope(prevActScopeDepth)
|
|
3400
|
+
throw error
|
|
3139
3401
|
} finally {
|
|
3140
|
-
ReactCurrentActQueue.isBatchingLegacy = prevIsBatchingLegacy
|
|
3402
|
+
ReactCurrentActQueue.isBatchingLegacy = prevIsBatchingLegacy
|
|
3141
3403
|
}
|
|
3142
3404
|
|
|
3143
|
-
if (
|
|
3144
|
-
|
|
3405
|
+
if (
|
|
3406
|
+
result !== null &&
|
|
3407
|
+
typeof result === 'object' &&
|
|
3408
|
+
typeof result.then === 'function'
|
|
3409
|
+
) {
|
|
3410
|
+
var thenableResult = result // The callback is an async function (i.e. returned a promise). Wait
|
|
3145
3411
|
// for it to resolve before exiting the current scope.
|
|
3146
3412
|
|
|
3147
|
-
var wasAwaited = false
|
|
3413
|
+
var wasAwaited = false
|
|
3148
3414
|
var thenable = {
|
|
3149
3415
|
then: function (resolve, reject) {
|
|
3150
|
-
wasAwaited = true
|
|
3151
|
-
thenableResult.then(
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3416
|
+
wasAwaited = true
|
|
3417
|
+
thenableResult.then(
|
|
3418
|
+
function (returnValue) {
|
|
3419
|
+
popActScope(prevActScopeDepth)
|
|
3420
|
+
|
|
3421
|
+
if (actScopeDepth === 0) {
|
|
3422
|
+
// We've exited the outermost act scope. Recursively flush the
|
|
3423
|
+
// queue until there's no remaining work.
|
|
3424
|
+
recursivelyFlushAsyncActWork(returnValue, resolve, reject)
|
|
3425
|
+
} else {
|
|
3426
|
+
resolve(returnValue)
|
|
3427
|
+
}
|
|
3428
|
+
},
|
|
3429
|
+
function (error) {
|
|
3430
|
+
// The callback threw an error.
|
|
3431
|
+
popActScope(prevActScopeDepth)
|
|
3432
|
+
reject(error)
|
|
3160
3433
|
}
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
reject(error);
|
|
3165
|
-
});
|
|
3166
|
-
}
|
|
3167
|
-
};
|
|
3434
|
+
)
|
|
3435
|
+
},
|
|
3436
|
+
}
|
|
3168
3437
|
|
|
3169
3438
|
{
|
|
3170
3439
|
if (!didWarnNoAwaitAct && typeof Promise !== 'undefined') {
|
|
3171
3440
|
// eslint-disable-next-line no-undef
|
|
3172
|
-
Promise.resolve()
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3441
|
+
Promise.resolve()
|
|
3442
|
+
.then(function () {})
|
|
3443
|
+
.then(function () {
|
|
3444
|
+
if (!wasAwaited) {
|
|
3445
|
+
didWarnNoAwaitAct = true
|
|
3446
|
+
|
|
3447
|
+
error(
|
|
3448
|
+
'You called act(async () => ...) without await. ' +
|
|
3449
|
+
'This could lead to unexpected testing behaviour, ' +
|
|
3450
|
+
'interleaving multiple act calls and mixing their ' +
|
|
3451
|
+
'scopes. ' +
|
|
3452
|
+
'You should - await act(async () => ...);'
|
|
3453
|
+
)
|
|
3454
|
+
}
|
|
3455
|
+
})
|
|
3179
3456
|
}
|
|
3180
3457
|
}
|
|
3181
3458
|
|
|
3182
|
-
return thenable
|
|
3459
|
+
return thenable
|
|
3183
3460
|
} else {
|
|
3184
|
-
var returnValue = result
|
|
3461
|
+
var returnValue = result // The callback is not an async function. Exit the current scope
|
|
3185
3462
|
// immediately, without awaiting.
|
|
3186
3463
|
|
|
3187
|
-
popActScope(prevActScopeDepth)
|
|
3464
|
+
popActScope(prevActScopeDepth)
|
|
3188
3465
|
|
|
3189
3466
|
if (actScopeDepth === 0) {
|
|
3190
3467
|
// Exiting the outermost act scope. Flush the queue.
|
|
3191
|
-
var _queue = ReactCurrentActQueue.current
|
|
3468
|
+
var _queue = ReactCurrentActQueue.current
|
|
3192
3469
|
|
|
3193
3470
|
if (_queue !== null) {
|
|
3194
|
-
flushActQueue(_queue)
|
|
3195
|
-
ReactCurrentActQueue.current = null
|
|
3471
|
+
flushActQueue(_queue)
|
|
3472
|
+
ReactCurrentActQueue.current = null
|
|
3196
3473
|
} // Return a thenable. If the user awaits it, we'll flush again in
|
|
3197
3474
|
// case additional work was scheduled by a microtask.
|
|
3198
3475
|
|
|
3199
|
-
|
|
3200
3476
|
var _thenable = {
|
|
3201
3477
|
then: function (resolve, reject) {
|
|
3202
3478
|
// Confirm we haven't re-entered another `act` scope, in case
|
|
@@ -3204,23 +3480,23 @@
|
|
|
3204
3480
|
// multiple times.
|
|
3205
3481
|
if (ReactCurrentActQueue.current === null) {
|
|
3206
3482
|
// Recursively flush the queue until there's no remaining work.
|
|
3207
|
-
ReactCurrentActQueue.current = []
|
|
3208
|
-
recursivelyFlushAsyncActWork(returnValue, resolve, reject)
|
|
3483
|
+
ReactCurrentActQueue.current = []
|
|
3484
|
+
recursivelyFlushAsyncActWork(returnValue, resolve, reject)
|
|
3209
3485
|
} else {
|
|
3210
|
-
resolve(returnValue)
|
|
3486
|
+
resolve(returnValue)
|
|
3211
3487
|
}
|
|
3212
|
-
}
|
|
3213
|
-
}
|
|
3214
|
-
return _thenable
|
|
3488
|
+
},
|
|
3489
|
+
}
|
|
3490
|
+
return _thenable
|
|
3215
3491
|
} else {
|
|
3216
3492
|
// Since we're inside a nested `act` scope, the returned thenable
|
|
3217
3493
|
// immediately resolves. The outer scope will flush the queue.
|
|
3218
3494
|
var _thenable2 = {
|
|
3219
3495
|
then: function (resolve, reject) {
|
|
3220
|
-
resolve(returnValue)
|
|
3221
|
-
}
|
|
3222
|
-
}
|
|
3223
|
-
return _thenable2
|
|
3496
|
+
resolve(returnValue)
|
|
3497
|
+
},
|
|
3498
|
+
}
|
|
3499
|
+
return _thenable2
|
|
3224
3500
|
}
|
|
3225
3501
|
}
|
|
3226
3502
|
}
|
|
@@ -3229,115 +3505,117 @@
|
|
|
3229
3505
|
function popActScope(prevActScopeDepth) {
|
|
3230
3506
|
{
|
|
3231
3507
|
if (prevActScopeDepth !== actScopeDepth - 1) {
|
|
3232
|
-
error(
|
|
3508
|
+
error(
|
|
3509
|
+
'You seem to have overlapping act() calls, this is not supported. ' +
|
|
3510
|
+
'Be sure to await previous act() calls before making a new one. '
|
|
3511
|
+
)
|
|
3233
3512
|
}
|
|
3234
3513
|
|
|
3235
|
-
actScopeDepth = prevActScopeDepth
|
|
3514
|
+
actScopeDepth = prevActScopeDepth
|
|
3236
3515
|
}
|
|
3237
3516
|
}
|
|
3238
3517
|
|
|
3239
3518
|
function recursivelyFlushAsyncActWork(returnValue, resolve, reject) {
|
|
3240
3519
|
{
|
|
3241
|
-
var queue = ReactCurrentActQueue.current
|
|
3520
|
+
var queue = ReactCurrentActQueue.current
|
|
3242
3521
|
|
|
3243
3522
|
if (queue !== null) {
|
|
3244
3523
|
try {
|
|
3245
|
-
flushActQueue(queue)
|
|
3524
|
+
flushActQueue(queue)
|
|
3246
3525
|
enqueueTask(function () {
|
|
3247
3526
|
if (queue.length === 0) {
|
|
3248
3527
|
// No additional work was scheduled. Finish.
|
|
3249
|
-
ReactCurrentActQueue.current = null
|
|
3250
|
-
resolve(returnValue)
|
|
3528
|
+
ReactCurrentActQueue.current = null
|
|
3529
|
+
resolve(returnValue)
|
|
3251
3530
|
} else {
|
|
3252
3531
|
// Keep flushing work until there's none left.
|
|
3253
|
-
recursivelyFlushAsyncActWork(returnValue, resolve, reject)
|
|
3532
|
+
recursivelyFlushAsyncActWork(returnValue, resolve, reject)
|
|
3254
3533
|
}
|
|
3255
|
-
})
|
|
3534
|
+
})
|
|
3256
3535
|
} catch (error) {
|
|
3257
|
-
reject(error)
|
|
3536
|
+
reject(error)
|
|
3258
3537
|
}
|
|
3259
3538
|
} else {
|
|
3260
|
-
resolve(returnValue)
|
|
3539
|
+
resolve(returnValue)
|
|
3261
3540
|
}
|
|
3262
3541
|
}
|
|
3263
3542
|
}
|
|
3264
3543
|
|
|
3265
|
-
var isFlushing = false
|
|
3544
|
+
var isFlushing = false
|
|
3266
3545
|
|
|
3267
3546
|
function flushActQueue(queue) {
|
|
3268
3547
|
{
|
|
3269
3548
|
if (!isFlushing) {
|
|
3270
3549
|
// Prevent re-entrance.
|
|
3271
|
-
isFlushing = true
|
|
3272
|
-
var i = 0
|
|
3550
|
+
isFlushing = true
|
|
3551
|
+
var i = 0
|
|
3273
3552
|
|
|
3274
3553
|
try {
|
|
3275
3554
|
for (; i < queue.length; i++) {
|
|
3276
|
-
var callback = queue[i]
|
|
3555
|
+
var callback = queue[i]
|
|
3277
3556
|
|
|
3278
3557
|
do {
|
|
3279
|
-
callback = callback(true)
|
|
3280
|
-
} while (callback !== null)
|
|
3558
|
+
callback = callback(true)
|
|
3559
|
+
} while (callback !== null)
|
|
3281
3560
|
}
|
|
3282
3561
|
|
|
3283
|
-
queue.length = 0
|
|
3562
|
+
queue.length = 0
|
|
3284
3563
|
} catch (error) {
|
|
3285
3564
|
// If something throws, leave the remaining callbacks on the queue.
|
|
3286
|
-
queue = queue.slice(i + 1)
|
|
3287
|
-
throw error
|
|
3565
|
+
queue = queue.slice(i + 1)
|
|
3566
|
+
throw error
|
|
3288
3567
|
} finally {
|
|
3289
|
-
isFlushing = false
|
|
3568
|
+
isFlushing = false
|
|
3290
3569
|
}
|
|
3291
3570
|
}
|
|
3292
3571
|
}
|
|
3293
3572
|
}
|
|
3294
3573
|
|
|
3295
|
-
var createElement$1 =
|
|
3296
|
-
var cloneElement$1 =
|
|
3297
|
-
var createFactory =
|
|
3574
|
+
var createElement$1 = createElementWithValidation
|
|
3575
|
+
var cloneElement$1 = cloneElementWithValidation
|
|
3576
|
+
var createFactory = createFactoryWithValidation
|
|
3298
3577
|
var Children = {
|
|
3299
3578
|
map: mapChildren,
|
|
3300
3579
|
forEach: forEachChildren,
|
|
3301
3580
|
count: countChildren,
|
|
3302
3581
|
toArray: toArray,
|
|
3303
|
-
only: onlyChild
|
|
3304
|
-
}
|
|
3305
|
-
|
|
3306
|
-
exports.Children = Children
|
|
3307
|
-
exports.Component = Component
|
|
3308
|
-
exports.Fragment = REACT_FRAGMENT_TYPE
|
|
3309
|
-
exports.Profiler = REACT_PROFILER_TYPE
|
|
3310
|
-
exports.PureComponent = PureComponent
|
|
3311
|
-
exports.StrictMode = REACT_STRICT_MODE_TYPE
|
|
3312
|
-
exports.Suspense = REACT_SUSPENSE_TYPE
|
|
3313
|
-
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals$1
|
|
3314
|
-
exports.act = act
|
|
3315
|
-
exports.cloneElement = cloneElement$1
|
|
3316
|
-
exports.createContext = createContext
|
|
3317
|
-
exports.createElement = createElement$1
|
|
3318
|
-
exports.createFactory = createFactory
|
|
3319
|
-
exports.createRef = createRef
|
|
3320
|
-
exports.forwardRef = forwardRef
|
|
3321
|
-
exports.isValidElement = isValidElement
|
|
3322
|
-
exports.lazy = lazy
|
|
3323
|
-
exports.memo = memo
|
|
3324
|
-
exports.startTransition = startTransition
|
|
3325
|
-
exports.unstable_act = act
|
|
3326
|
-
exports.useCallback = useCallback
|
|
3327
|
-
exports.useContext = useContext
|
|
3328
|
-
exports.useDebugValue = useDebugValue
|
|
3329
|
-
exports.useDeferredValue = useDeferredValue
|
|
3330
|
-
exports.useEffect = useEffect
|
|
3331
|
-
exports.useId = useId
|
|
3332
|
-
exports.useImperativeHandle = useImperativeHandle
|
|
3333
|
-
exports.useInsertionEffect = useInsertionEffect
|
|
3334
|
-
exports.useLayoutEffect = useLayoutEffect
|
|
3335
|
-
exports.useMemo = useMemo
|
|
3336
|
-
exports.useReducer = useReducer
|
|
3337
|
-
exports.useRef = useRef
|
|
3338
|
-
exports.useState = useState
|
|
3339
|
-
exports.useSyncExternalStore = useSyncExternalStore
|
|
3340
|
-
exports.useTransition = useTransition
|
|
3341
|
-
exports.version = ReactVersion
|
|
3342
|
-
|
|
3343
|
-
})));
|
|
3582
|
+
only: onlyChild,
|
|
3583
|
+
}
|
|
3584
|
+
|
|
3585
|
+
exports.Children = Children
|
|
3586
|
+
exports.Component = Component
|
|
3587
|
+
exports.Fragment = REACT_FRAGMENT_TYPE
|
|
3588
|
+
exports.Profiler = REACT_PROFILER_TYPE
|
|
3589
|
+
exports.PureComponent = PureComponent
|
|
3590
|
+
exports.StrictMode = REACT_STRICT_MODE_TYPE
|
|
3591
|
+
exports.Suspense = REACT_SUSPENSE_TYPE
|
|
3592
|
+
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals$1
|
|
3593
|
+
exports.act = act
|
|
3594
|
+
exports.cloneElement = cloneElement$1
|
|
3595
|
+
exports.createContext = createContext
|
|
3596
|
+
exports.createElement = createElement$1
|
|
3597
|
+
exports.createFactory = createFactory
|
|
3598
|
+
exports.createRef = createRef
|
|
3599
|
+
exports.forwardRef = forwardRef
|
|
3600
|
+
exports.isValidElement = isValidElement
|
|
3601
|
+
exports.lazy = lazy
|
|
3602
|
+
exports.memo = memo
|
|
3603
|
+
exports.startTransition = startTransition
|
|
3604
|
+
exports.unstable_act = act
|
|
3605
|
+
exports.useCallback = useCallback
|
|
3606
|
+
exports.useContext = useContext
|
|
3607
|
+
exports.useDebugValue = useDebugValue
|
|
3608
|
+
exports.useDeferredValue = useDeferredValue
|
|
3609
|
+
exports.useEffect = useEffect
|
|
3610
|
+
exports.useId = useId
|
|
3611
|
+
exports.useImperativeHandle = useImperativeHandle
|
|
3612
|
+
exports.useInsertionEffect = useInsertionEffect
|
|
3613
|
+
exports.useLayoutEffect = useLayoutEffect
|
|
3614
|
+
exports.useMemo = useMemo
|
|
3615
|
+
exports.useReducer = useReducer
|
|
3616
|
+
exports.useRef = useRef
|
|
3617
|
+
exports.useState = useState
|
|
3618
|
+
exports.useSyncExternalStore = useSyncExternalStore
|
|
3619
|
+
exports.useTransition = useTransition
|
|
3620
|
+
exports.version = ReactVersion
|
|
3621
|
+
})
|