@remix-run/react
Advanced tools
Comparing version 0.0.0-experimental-149e932f to 0.0.0-experimental-2ca98589
/** | ||
* @remix-run/react v0.0.0-experimental-149e932f | ||
* @remix-run/react v0.0.0-experimental-2ca98589 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/react v0.0.0-experimental-149e932f | ||
* @remix-run/react v0.0.0-experimental-2ca98589 | ||
* | ||
@@ -19,5 +19,21 @@ * Copyright (c) Remix Software Inc. | ||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
function _interopNamespace(e) { | ||
if (e && e.__esModule) return e; | ||
var n = Object.create(null); | ||
if (e) { | ||
Object.keys(e).forEach(function (k) { | ||
if (k !== 'default') { | ||
var d = Object.getOwnPropertyDescriptor(e, k); | ||
Object.defineProperty(n, k, d.get ? d : { | ||
enumerable: true, | ||
get: function () { return e[k]; } | ||
}); | ||
} | ||
}); | ||
} | ||
n["default"] = e; | ||
return Object.freeze(n); | ||
} | ||
var React__default = /*#__PURE__*/_interopDefaultLegacy(React); | ||
var React__namespace = /*#__PURE__*/_interopNamespace(React); | ||
@@ -30,3 +46,3 @@ /** | ||
function RemixBrowser(_props) { | ||
let historyRef = React__default["default"].useRef(); | ||
let historyRef = React__namespace.useRef(); | ||
@@ -40,7 +56,7 @@ if (historyRef.current == null) { | ||
let history$1 = historyRef.current; | ||
let [state, dispatch] = React__default["default"].useReducer((_, update) => update, { | ||
let [state, dispatch] = React__namespace.useReducer((_, update) => update, { | ||
action: history$1.action, | ||
location: history$1.location | ||
}); | ||
React__default["default"].useLayoutEffect(() => history$1.listen(dispatch), [history$1]); | ||
React__namespace.useLayoutEffect(() => history$1.listen(dispatch), [history$1]); | ||
let entryContext = window.__remixContext; | ||
@@ -54,3 +70,3 @@ entryContext.manifest = window.__remixManifest; | ||
entryContext.appState.trackCatchBoundaries = false; | ||
return /*#__PURE__*/React__default["default"].createElement(components.RemixEntry, { | ||
return /*#__PURE__*/React__namespace.createElement(components.RemixEntry, { | ||
context: entryContext, | ||
@@ -57,0 +73,0 @@ action: state.action, |
import type { Action, Location } from "history"; | ||
import type { FormHTMLAttributes } from "react"; | ||
import React from "react"; | ||
import * as React from "react"; | ||
import type { Navigator } from "react-router"; | ||
@@ -173,2 +173,3 @@ import type { LinkProps, NavLinkProps } from "react-router-dom"; | ||
export declare function useMatches(): { | ||
id: string; | ||
pathname: string; | ||
@@ -175,0 +176,0 @@ params: import("react-router").Params<string>; |
/** | ||
* @remix-run/react v0.0.0-experimental-149e932f | ||
* @remix-run/react v0.0.0-experimental-2ca98589 | ||
* | ||
@@ -26,10 +26,26 @@ * Copyright (c) Remix Software Inc. | ||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
function _interopNamespace(e) { | ||
if (e && e.__esModule) return e; | ||
var n = Object.create(null); | ||
if (e) { | ||
Object.keys(e).forEach(function (k) { | ||
if (k !== 'default') { | ||
var d = Object.getOwnPropertyDescriptor(e, k); | ||
Object.defineProperty(n, k, d.get ? d : { | ||
enumerable: true, | ||
get: function () { return e[k]; } | ||
}); | ||
} | ||
}); | ||
} | ||
n["default"] = e; | ||
return Object.freeze(n); | ||
} | ||
var React__default = /*#__PURE__*/_interopDefaultLegacy(React); | ||
var React__namespace = /*#__PURE__*/_interopNamespace(React); | ||
const RemixEntryContext = /*#__PURE__*/React__default["default"].createContext(undefined); | ||
const RemixEntryContext = /*#__PURE__*/React__namespace.createContext(undefined); | ||
function useRemixEntryContext() { | ||
let context = React__default["default"].useContext(RemixEntryContext); | ||
let context = React__namespace.useContext(RemixEntryContext); | ||
invariant(context, "You must render this element inside a <Remix> element"); | ||
@@ -54,5 +70,5 @@ return context; | ||
} = entryContext; | ||
let clientRoutes = React__default["default"].useMemo(() => routes.createClientRoutes(manifest.routes, routeModules, RemixRoute), [manifest, routeModules]); | ||
let [clientState, setClientState] = React__default["default"].useState(entryComponentDidCatchEmulator); | ||
let [transitionManager] = React__default["default"].useState(() => { | ||
let clientRoutes = React__namespace.useMemo(() => routes.createClientRoutes(manifest.routes, routeModules, RemixRoute), [manifest, routeModules]); | ||
let [clientState, setClientState] = React__namespace.useState(entryComponentDidCatchEmulator); | ||
let [transitionManager] = React__namespace.useState(() => { | ||
return transition.createTransitionManager({ | ||
@@ -81,3 +97,3 @@ routes: clientRoutes, | ||
let navigator = React__default["default"].useMemo(() => { | ||
let navigator = React__namespace.useMemo(() => { | ||
let push = (to, state) => { | ||
@@ -98,3 +114,3 @@ return transitionManager.getState().transition.state !== "idle" ? _navigator.replace(to, state) : _navigator.push(to, state); | ||
React__default["default"].useEffect(() => { | ||
React__namespace.useEffect(() => { | ||
let { | ||
@@ -116,3 +132,3 @@ location | ||
let ssrCatchBeforeRoutesRendered = clientState.catch && clientState.catchBoundaryRouteId === null ? clientState.catch : undefined; | ||
return /*#__PURE__*/React__default["default"].createElement(RemixEntryContext.Provider, { | ||
return /*#__PURE__*/React__namespace.createElement(RemixEntryContext.Provider, { | ||
value: { | ||
@@ -129,11 +145,11 @@ matches, | ||
} | ||
}, /*#__PURE__*/React__default["default"].createElement(errorBoundaries.RemixErrorBoundary, { | ||
}, /*#__PURE__*/React__namespace.createElement(errorBoundaries.RemixErrorBoundary, { | ||
location: location, | ||
component: errorBoundaries.RemixRootDefaultErrorBoundary, | ||
error: ssrErrorBeforeRoutesRendered | ||
}, /*#__PURE__*/React__default["default"].createElement(errorBoundaries.RemixCatchBoundary, { | ||
}, /*#__PURE__*/React__namespace.createElement(errorBoundaries.RemixCatchBoundary, { | ||
location: location, | ||
component: errorBoundaries.RemixRootDefaultCatchBoundary, | ||
catch: ssrCatchBeforeRoutesRendered | ||
}, /*#__PURE__*/React__default["default"].createElement(reactRouterDom.Router, { | ||
}, /*#__PURE__*/React__namespace.createElement(reactRouterDom.Router, { | ||
navigationType: action, | ||
@@ -143,3 +159,3 @@ location: location, | ||
static: staticProp | ||
}, /*#__PURE__*/React__default["default"].createElement(Routes, null))))); | ||
}, /*#__PURE__*/React__namespace.createElement(Routes, null))))); | ||
} | ||
@@ -166,6 +182,6 @@ | ||
const RemixRouteContext = /*#__PURE__*/React__default["default"].createContext(undefined); | ||
const RemixRouteContext = /*#__PURE__*/React__namespace.createContext(undefined); | ||
function useRemixRouteContext() { | ||
let context = React__default["default"].useContext(RemixRouteContext); | ||
let context = React__namespace.useContext(RemixRouteContext); | ||
invariant(context, "You must render this element in a remix route element"); | ||
@@ -196,3 +212,3 @@ return context; | ||
} = routeModules[id]; | ||
let element = Component ? /*#__PURE__*/React__default["default"].createElement(Component, null) : /*#__PURE__*/React__default["default"].createElement(DefaultRouteComponent, { | ||
let element = Component ? /*#__PURE__*/React__namespace.createElement(Component, null) : /*#__PURE__*/React__namespace.createElement(DefaultRouteComponent, { | ||
id: id | ||
@@ -228,3 +244,3 @@ }); | ||
}; | ||
element = /*#__PURE__*/React__default["default"].createElement(errorBoundaries.RemixCatchBoundary, { | ||
element = /*#__PURE__*/React__namespace.createElement(errorBoundaries.RemixCatchBoundary, { | ||
location: location, | ||
@@ -272,3 +288,3 @@ component: CatchBoundary, | ||
}; | ||
element = /*#__PURE__*/React__default["default"].createElement(errorBoundaries.RemixErrorBoundary, { | ||
element = /*#__PURE__*/React__namespace.createElement(errorBoundaries.RemixErrorBoundary, { | ||
location: location, | ||
@@ -282,3 +298,3 @@ component: ErrorBoundary, | ||
return /*#__PURE__*/React__default["default"].createElement(RemixRouteContext.Provider, { | ||
return /*#__PURE__*/React__namespace.createElement(RemixRouteContext.Provider, { | ||
value: context | ||
@@ -298,4 +314,4 @@ }, element); | ||
function usePrefetchBehavior(prefetch, theirElementProps) { | ||
let [maybePrefetch, setMaybePrefetch] = React__default["default"].useState(false); | ||
let [shouldPrefetch, setShouldPrefetch] = React__default["default"].useState(false); | ||
let [maybePrefetch, setMaybePrefetch] = React__namespace.useState(false); | ||
let [shouldPrefetch, setShouldPrefetch] = React__namespace.useState(false); | ||
let { | ||
@@ -308,3 +324,3 @@ onFocus, | ||
} = theirElementProps; | ||
React__default["default"].useEffect(() => { | ||
React__namespace.useEffect(() => { | ||
if (prefetch === "render") { | ||
@@ -327,3 +343,3 @@ setShouldPrefetch(true); | ||
React__default["default"].useEffect(() => { | ||
React__namespace.useEffect(() => { | ||
if (maybePrefetch) { | ||
@@ -347,3 +363,3 @@ let id = setTimeout(() => { | ||
let NavLink = /*#__PURE__*/React__default["default"].forwardRef(({ | ||
let NavLink = /*#__PURE__*/React__namespace.forwardRef(({ | ||
to, | ||
@@ -355,10 +371,10 @@ prefetch = "none", | ||
let [shouldPrefetch, prefetchHandlers] = usePrefetchBehavior(prefetch, props); | ||
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(reactRouterDom.NavLink, _rollupPluginBabelHelpers["extends"]({ | ||
return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(reactRouterDom.NavLink, _rollupPluginBabelHelpers["extends"]({ | ||
ref: forwardedRef, | ||
to: to | ||
}, prefetchHandlers, props)), shouldPrefetch ? /*#__PURE__*/React__default["default"].createElement(PrefetchPageLinks, { | ||
}, prefetchHandlers, props)), shouldPrefetch ? /*#__PURE__*/React__namespace.createElement(PrefetchPageLinks, { | ||
page: href | ||
}) : null); | ||
}); | ||
let Link = /*#__PURE__*/React__default["default"].forwardRef(({ | ||
let Link = /*#__PURE__*/React__namespace.forwardRef(({ | ||
to, | ||
@@ -370,6 +386,6 @@ prefetch = "none", | ||
let [shouldPrefetch, prefetchHandlers] = usePrefetchBehavior(prefetch, props); | ||
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(reactRouterDom.Link, _rollupPluginBabelHelpers["extends"]({ | ||
return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(reactRouterDom.Link, _rollupPluginBabelHelpers["extends"]({ | ||
ref: forwardedRef, | ||
to: to | ||
}, prefetchHandlers, props)), shouldPrefetch ? /*#__PURE__*/React__default["default"].createElement(PrefetchPageLinks, { | ||
}, prefetchHandlers, props)), shouldPrefetch ? /*#__PURE__*/React__namespace.createElement(PrefetchPageLinks, { | ||
page: href | ||
@@ -397,6 +413,6 @@ }) : null); | ||
} = useRemixEntryContext(); | ||
let links$1 = React__default["default"].useMemo(() => links.getLinksForMatches(matches, routeModules, manifest), [matches, routeModules, manifest]); | ||
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, links$1.map(link => links.isPageLinkDescriptor(link) ? /*#__PURE__*/React__default["default"].createElement(PrefetchPageLinks, _rollupPluginBabelHelpers["extends"]({ | ||
let links$1 = React__namespace.useMemo(() => links.getLinksForMatches(matches, routeModules, manifest), [matches, routeModules, manifest]); | ||
return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, links$1.map(link => links.isPageLinkDescriptor(link) ? /*#__PURE__*/React__namespace.createElement(PrefetchPageLinks, _rollupPluginBabelHelpers["extends"]({ | ||
key: link.page | ||
}, link)) : /*#__PURE__*/React__default["default"].createElement("link", _rollupPluginBabelHelpers["extends"]({ | ||
}, link)) : /*#__PURE__*/React__namespace.createElement("link", _rollupPluginBabelHelpers["extends"]({ | ||
key: link.rel + link.href | ||
@@ -412,3 +428,3 @@ }, link)))); | ||
} = useRemixEntryContext(); | ||
let matches = React__default["default"].useMemo(() => routeMatching.matchClientRoutes(clientRoutes, page), [clientRoutes, page]); | ||
let matches = React__namespace.useMemo(() => routeMatching.matchClientRoutes(clientRoutes, page), [clientRoutes, page]); | ||
@@ -420,3 +436,3 @@ if (!matches) { | ||
return /*#__PURE__*/React__default["default"].createElement(PrefetchPageLinksImpl, _rollupPluginBabelHelpers["extends"]({ | ||
return /*#__PURE__*/React__namespace.createElement(PrefetchPageLinksImpl, _rollupPluginBabelHelpers["extends"]({ | ||
page: page, | ||
@@ -431,4 +447,4 @@ matches: matches | ||
} = useRemixEntryContext(); | ||
let [styleLinks, setStyleLinks] = React__default["default"].useState([]); | ||
React__default["default"].useEffect(() => { | ||
let [styleLinks, setStyleLinks] = React__namespace.useState([]); | ||
React__namespace.useEffect(() => { | ||
let interrupted = false; | ||
@@ -455,10 +471,10 @@ links.getStylesheetPrefetchLinks(matches, routeModules).then(links => { | ||
} = useRemixEntryContext(); | ||
let newMatchesForData = React__default["default"].useMemo(() => links.getNewMatchesForLinks(page, nextMatches, matches, location, "data"), [page, nextMatches, matches, location]); | ||
let newMatchesForAssets = React__default["default"].useMemo(() => links.getNewMatchesForLinks(page, nextMatches, matches, location, "assets"), [page, nextMatches, matches, location]); | ||
let dataHrefs = React__default["default"].useMemo(() => links.getDataLinkHrefs(page, newMatchesForData, manifest), [newMatchesForData, page, manifest]); | ||
let moduleHrefs = React__default["default"].useMemo(() => links.getModuleLinkHrefs(newMatchesForAssets, manifest), [newMatchesForAssets, manifest]); // needs to be a hook with async behavior because we need the modules, not | ||
let newMatchesForData = React__namespace.useMemo(() => links.getNewMatchesForLinks(page, nextMatches, matches, location, "data"), [page, nextMatches, matches, location]); | ||
let newMatchesForAssets = React__namespace.useMemo(() => links.getNewMatchesForLinks(page, nextMatches, matches, location, "assets"), [page, nextMatches, matches, location]); | ||
let dataHrefs = React__namespace.useMemo(() => links.getDataLinkHrefs(page, newMatchesForData, manifest), [newMatchesForData, page, manifest]); | ||
let moduleHrefs = React__namespace.useMemo(() => links.getModuleLinkHrefs(newMatchesForAssets, manifest), [newMatchesForAssets, manifest]); // needs to be a hook with async behavior because we need the modules, not | ||
// just the manifest like the other links in here. | ||
let styleLinks = usePrefetchedStylesheets(newMatchesForAssets); | ||
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, dataHrefs.map(href => /*#__PURE__*/React__default["default"].createElement("link", _rollupPluginBabelHelpers["extends"]({ | ||
return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, dataHrefs.map(href => /*#__PURE__*/React__namespace.createElement("link", _rollupPluginBabelHelpers["extends"]({ | ||
key: href, | ||
@@ -468,3 +484,3 @@ rel: "prefetch", | ||
href: href | ||
}, linkProps))), moduleHrefs.map(href => /*#__PURE__*/React__default["default"].createElement("link", _rollupPluginBabelHelpers["extends"]({ | ||
}, linkProps))), moduleHrefs.map(href => /*#__PURE__*/React__namespace.createElement("link", _rollupPluginBabelHelpers["extends"]({ | ||
key: href, | ||
@@ -477,3 +493,3 @@ rel: "modulepreload", | ||
// already with their own props | ||
React__default["default"].createElement("link", _rollupPluginBabelHelpers["extends"]({ | ||
React__namespace.createElement("link", _rollupPluginBabelHelpers["extends"]({ | ||
key: link.href | ||
@@ -516,21 +532,21 @@ }, link)))); | ||
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, Object.entries(meta).map(([name, value]) => { | ||
return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, Object.entries(meta).map(([name, value]) => { | ||
// Open Graph tags use the `property` attribute, while other meta tags | ||
// use `name`. See https://ogp.me/ | ||
let isOpenGraphTag = name.startsWith("og:"); | ||
return name === "title" ? /*#__PURE__*/React__default["default"].createElement("title", { | ||
return name === "title" ? /*#__PURE__*/React__namespace.createElement("title", { | ||
key: "title" | ||
}, value) : Array.isArray(value) ? value.map(content => isOpenGraphTag ? /*#__PURE__*/React__default["default"].createElement("meta", { | ||
}, value) : Array.isArray(value) ? value.map(content => isOpenGraphTag ? /*#__PURE__*/React__namespace.createElement("meta", { | ||
key: name + content, | ||
property: name, | ||
content: content | ||
}) : /*#__PURE__*/React__default["default"].createElement("meta", { | ||
}) : /*#__PURE__*/React__namespace.createElement("meta", { | ||
key: name + content, | ||
name: name, | ||
content: content | ||
})) : isOpenGraphTag ? /*#__PURE__*/React__default["default"].createElement("meta", { | ||
})) : isOpenGraphTag ? /*#__PURE__*/React__namespace.createElement("meta", { | ||
key: name, | ||
property: name, | ||
content: value | ||
}) : /*#__PURE__*/React__default["default"].createElement("meta", { | ||
}) : /*#__PURE__*/React__namespace.createElement("meta", { | ||
key: name, | ||
@@ -565,18 +581,18 @@ name: name, | ||
} = useRemixEntryContext(); | ||
React__default["default"].useEffect(() => { | ||
React__namespace.useEffect(() => { | ||
isHydrated = true; | ||
}, []); | ||
let initialScripts = React__default["default"].useMemo(() => { | ||
let initialScripts = React__namespace.useMemo(() => { | ||
let contextScript = serverHandoffString ? `window.__remixContext = ${serverHandoffString};` : ""; | ||
let routeModulesScript = `${matches.map((match, index) => `import * as route${index} from ${JSON.stringify(manifest.routes[match.route.id].module)};`).join("\n")} | ||
window.__remixRouteModules = {${matches.map((match, index) => `${JSON.stringify(match.route.id)}:route${index}`).join(",")}};`; | ||
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("script", _rollupPluginBabelHelpers["extends"]({}, props, { | ||
return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement("script", _rollupPluginBabelHelpers["extends"]({}, props, { | ||
suppressHydrationWarning: true, | ||
dangerouslySetInnerHTML: markup.createHtml(contextScript) | ||
})), /*#__PURE__*/React__default["default"].createElement("script", _rollupPluginBabelHelpers["extends"]({}, props, { | ||
})), /*#__PURE__*/React__namespace.createElement("script", _rollupPluginBabelHelpers["extends"]({}, props, { | ||
src: manifest.url | ||
})), /*#__PURE__*/React__default["default"].createElement("script", _rollupPluginBabelHelpers["extends"]({}, props, { | ||
})), /*#__PURE__*/React__namespace.createElement("script", _rollupPluginBabelHelpers["extends"]({}, props, { | ||
dangerouslySetInnerHTML: markup.createHtml(routeModulesScript), | ||
type: "module" | ||
})), /*#__PURE__*/React__default["default"].createElement("script", _rollupPluginBabelHelpers["extends"]({}, props, { | ||
})), /*#__PURE__*/React__namespace.createElement("script", _rollupPluginBabelHelpers["extends"]({}, props, { | ||
src: manifest.entry.module, | ||
@@ -590,3 +606,3 @@ type: "module" | ||
let nextMatches = React__default["default"].useMemo(() => { | ||
let nextMatches = React__namespace.useMemo(() => { | ||
if (pendingLocation) { | ||
@@ -606,3 +622,3 @@ // FIXME: can probably use transitionManager `nextMatches` | ||
let preloads = manifest.entry.imports.concat(routePreloads); | ||
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, dedupe(preloads).map(path => /*#__PURE__*/React__default["default"].createElement("link", { | ||
return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, dedupe(preloads).map(path => /*#__PURE__*/React__namespace.createElement("link", { | ||
key: path, | ||
@@ -625,8 +641,8 @@ rel: "modulepreload", | ||
*/ | ||
let Form = /*#__PURE__*/React__default["default"].forwardRef((props, ref) => { | ||
return /*#__PURE__*/React__default["default"].createElement(FormImpl, _rollupPluginBabelHelpers["extends"]({}, props, { | ||
let Form = /*#__PURE__*/React__namespace.forwardRef((props, ref) => { | ||
return /*#__PURE__*/React__namespace.createElement(FormImpl, _rollupPluginBabelHelpers["extends"]({}, props, { | ||
ref: ref | ||
})); | ||
}); | ||
let FormImpl = /*#__PURE__*/React__default["default"].forwardRef(({ | ||
let FormImpl = /*#__PURE__*/React__namespace.forwardRef(({ | ||
reloadDocument = false, | ||
@@ -644,3 +660,3 @@ replace = false, | ||
let formAction = useFormAction(action, formMethod); | ||
let formRef = React__default["default"].useRef(); | ||
let formRef = React__namespace.useRef(); | ||
let ref = useComposedRefs(forwardedRef, formRef); // When calling `submit` on the form element itself, we don't get data from | ||
@@ -662,4 +678,4 @@ // the button that submitted the event. For example: | ||
let clickedButtonRef = React__default["default"].useRef(); | ||
React__default["default"].useEffect(() => { | ||
let clickedButtonRef = React__namespace.useRef(); | ||
React__namespace.useEffect(() => { | ||
let form = formRef.current; | ||
@@ -682,3 +698,3 @@ if (!form) return; | ||
}, []); | ||
return /*#__PURE__*/React__default["default"].createElement("form", _rollupPluginBabelHelpers["extends"]({ | ||
return /*#__PURE__*/React__namespace.createElement("form", _rollupPluginBabelHelpers["extends"]({ | ||
ref: ref, | ||
@@ -738,3 +754,3 @@ method: formMethod, | ||
} = useRemixEntryContext(); | ||
return React__default["default"].useCallback((target, options = {}) => { | ||
return React__namespace.useCallback((target, options = {}) => { | ||
let method; | ||
@@ -875,3 +891,3 @@ let action; | ||
function useBeforeUnload(callback) { | ||
React__default["default"].useEffect(() => { | ||
React__namespace.useEffect(() => { | ||
window.addEventListener("beforeunload", callback); | ||
@@ -890,2 +906,4 @@ return () => { | ||
return matches.map(match => { | ||
var _routeModules$match$r; | ||
let { | ||
@@ -896,6 +914,9 @@ pathname, | ||
return { | ||
id: match.route.id, | ||
pathname, | ||
params, | ||
data: routeData[match.route.id], | ||
handle: routeModules[match.route.id].handle | ||
// if the module fails to load or an error/response is thrown, the module | ||
// won't be defined. | ||
handle: (_routeModules$match$r = routeModules[match.route.id]) === null || _routeModules$match$r === void 0 ? void 0 : _routeModules$match$r.handle | ||
}; | ||
@@ -931,5 +952,5 @@ }); | ||
function createFetcherForm(fetchKey) { | ||
return /*#__PURE__*/React__default["default"].forwardRef((props, ref) => { | ||
return /*#__PURE__*/React__namespace.forwardRef((props, ref) => { | ||
// TODO: make ANOTHER form w/o a fetchKey prop | ||
return /*#__PURE__*/React__default["default"].createElement(FormImpl, _rollupPluginBabelHelpers["extends"]({}, props, { | ||
return /*#__PURE__*/React__namespace.createElement(FormImpl, _rollupPluginBabelHelpers["extends"]({}, props, { | ||
ref: ref, | ||
@@ -951,5 +972,5 @@ fetchKey: fetchKey | ||
} = useRemixEntryContext(); | ||
let [key] = React__default["default"].useState(() => String(++fetcherId)); | ||
let [Form] = React__default["default"].useState(() => createFetcherForm(key)); | ||
let [load] = React__default["default"].useState(() => href => { | ||
let [key] = React__namespace.useState(() => String(++fetcherId)); | ||
let [Form] = React__namespace.useState(() => createFetcherForm(key)); | ||
let [load] = React__namespace.useState(() => href => { | ||
transitionManager.send({ | ||
@@ -963,3 +984,3 @@ type: "fetcher", | ||
let fetcher = transitionManager.getFetcher(key); | ||
let fetcherWithComponents = React__default["default"].useMemo(() => ({ | ||
let fetcherWithComponents = React__namespace.useMemo(() => ({ | ||
Form, | ||
@@ -970,3 +991,3 @@ submit, | ||
}), [fetcher, Form, submit, load]); | ||
React__default["default"].useEffect(() => { | ||
React__namespace.useEffect(() => { | ||
// Is this busted when the React team gets real weird and calls effects | ||
@@ -997,3 +1018,3 @@ // twice on mount? We really just need to garbage collect here when this | ||
if (process.env.NODE_ENV !== "development") return null; | ||
return /*#__PURE__*/React__default["default"].createElement("script", { | ||
return /*#__PURE__*/React__namespace.createElement("script", { | ||
dangerouslySetInnerHTML: { | ||
@@ -1022,3 +1043,3 @@ __html: ` | ||
function useComposedRefs(...refs) { | ||
return React__default["default"].useCallback(node => { | ||
return React__namespace.useCallback(node => { | ||
for (let ref of refs) { | ||
@@ -1025,0 +1046,0 @@ if (ref == null) continue; |
/** | ||
* @remix-run/react v0.0.0-experimental-149e932f | ||
* @remix-run/react v0.0.0-experimental-2ca98589 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/react v0.0.0-experimental-149e932f | ||
* @remix-run/react v0.0.0-experimental-2ca98589 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/react v0.0.0-experimental-149e932f | ||
* @remix-run/react v0.0.0-experimental-2ca98589 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/react v0.0.0-experimental-149e932f | ||
* @remix-run/react v0.0.0-experimental-2ca98589 | ||
* | ||
@@ -12,3 +12,3 @@ * Copyright (c) Remix Software Inc. | ||
import { createBrowserHistory } from 'history'; | ||
import React__default from 'react'; | ||
import * as React from 'react'; | ||
import { RemixEntry } from './components.js'; | ||
@@ -22,3 +22,3 @@ | ||
function RemixBrowser(_props) { | ||
let historyRef = React__default.useRef(); | ||
let historyRef = React.useRef(); | ||
@@ -32,7 +32,7 @@ if (historyRef.current == null) { | ||
let history = historyRef.current; | ||
let [state, dispatch] = React__default.useReducer((_, update) => update, { | ||
let [state, dispatch] = React.useReducer((_, update) => update, { | ||
action: history.action, | ||
location: history.location | ||
}); | ||
React__default.useLayoutEffect(() => history.listen(dispatch), [history]); | ||
React.useLayoutEffect(() => history.listen(dispatch), [history]); | ||
let entryContext = window.__remixContext; | ||
@@ -46,3 +46,3 @@ entryContext.manifest = window.__remixManifest; | ||
entryContext.appState.trackCatchBoundaries = false; | ||
return /*#__PURE__*/React__default.createElement(RemixEntry, { | ||
return /*#__PURE__*/React.createElement(RemixEntry, { | ||
context: entryContext, | ||
@@ -49,0 +49,0 @@ action: state.action, |
/** | ||
* @remix-run/react v0.0.0-experimental-149e932f | ||
* @remix-run/react v0.0.0-experimental-2ca98589 | ||
* | ||
@@ -12,3 +12,3 @@ * Copyright (c) Remix Software Inc. | ||
import { extends as _extends } from './_virtual/_rollupPluginBabelHelpers.js'; | ||
import React__default from 'react'; | ||
import * as React from 'react'; | ||
import { useHref, NavLink as NavLink$1, Link as Link$1, useLocation, useResolvedPath, useNavigate, Router, useRoutes } from 'react-router-dom'; | ||
@@ -23,6 +23,6 @@ import { RemixErrorBoundary, RemixRootDefaultErrorBoundary, RemixCatchBoundary, RemixRootDefaultCatchBoundary } from './errorBoundaries.js'; | ||
const RemixEntryContext = /*#__PURE__*/React__default.createContext(undefined); | ||
const RemixEntryContext = /*#__PURE__*/React.createContext(undefined); | ||
function useRemixEntryContext() { | ||
let context = React__default.useContext(RemixEntryContext); | ||
let context = React.useContext(RemixEntryContext); | ||
invariant(context, "You must render this element inside a <Remix> element"); | ||
@@ -47,5 +47,5 @@ return context; | ||
} = entryContext; | ||
let clientRoutes = React__default.useMemo(() => createClientRoutes(manifest.routes, routeModules, RemixRoute), [manifest, routeModules]); | ||
let [clientState, setClientState] = React__default.useState(entryComponentDidCatchEmulator); | ||
let [transitionManager] = React__default.useState(() => { | ||
let clientRoutes = React.useMemo(() => createClientRoutes(manifest.routes, routeModules, RemixRoute), [manifest, routeModules]); | ||
let [clientState, setClientState] = React.useState(entryComponentDidCatchEmulator); | ||
let [transitionManager] = React.useState(() => { | ||
return createTransitionManager({ | ||
@@ -74,3 +74,3 @@ routes: clientRoutes, | ||
let navigator = React__default.useMemo(() => { | ||
let navigator = React.useMemo(() => { | ||
let push = (to, state) => { | ||
@@ -91,3 +91,3 @@ return transitionManager.getState().transition.state !== "idle" ? _navigator.replace(to, state) : _navigator.push(to, state); | ||
React__default.useEffect(() => { | ||
React.useEffect(() => { | ||
let { | ||
@@ -109,3 +109,3 @@ location | ||
let ssrCatchBeforeRoutesRendered = clientState.catch && clientState.catchBoundaryRouteId === null ? clientState.catch : undefined; | ||
return /*#__PURE__*/React__default.createElement(RemixEntryContext.Provider, { | ||
return /*#__PURE__*/React.createElement(RemixEntryContext.Provider, { | ||
value: { | ||
@@ -122,11 +122,11 @@ matches, | ||
} | ||
}, /*#__PURE__*/React__default.createElement(RemixErrorBoundary, { | ||
}, /*#__PURE__*/React.createElement(RemixErrorBoundary, { | ||
location: location, | ||
component: RemixRootDefaultErrorBoundary, | ||
error: ssrErrorBeforeRoutesRendered | ||
}, /*#__PURE__*/React__default.createElement(RemixCatchBoundary, { | ||
}, /*#__PURE__*/React.createElement(RemixCatchBoundary, { | ||
location: location, | ||
component: RemixRootDefaultCatchBoundary, | ||
catch: ssrCatchBeforeRoutesRendered | ||
}, /*#__PURE__*/React__default.createElement(Router, { | ||
}, /*#__PURE__*/React.createElement(Router, { | ||
navigationType: action, | ||
@@ -136,3 +136,3 @@ location: location, | ||
static: staticProp | ||
}, /*#__PURE__*/React__default.createElement(Routes, null))))); | ||
}, /*#__PURE__*/React.createElement(Routes, null))))); | ||
} | ||
@@ -159,6 +159,6 @@ | ||
const RemixRouteContext = /*#__PURE__*/React__default.createContext(undefined); | ||
const RemixRouteContext = /*#__PURE__*/React.createContext(undefined); | ||
function useRemixRouteContext() { | ||
let context = React__default.useContext(RemixRouteContext); | ||
let context = React.useContext(RemixRouteContext); | ||
invariant(context, "You must render this element in a remix route element"); | ||
@@ -189,3 +189,3 @@ return context; | ||
} = routeModules[id]; | ||
let element = Component ? /*#__PURE__*/React__default.createElement(Component, null) : /*#__PURE__*/React__default.createElement(DefaultRouteComponent, { | ||
let element = Component ? /*#__PURE__*/React.createElement(Component, null) : /*#__PURE__*/React.createElement(DefaultRouteComponent, { | ||
id: id | ||
@@ -221,3 +221,3 @@ }); | ||
}; | ||
element = /*#__PURE__*/React__default.createElement(RemixCatchBoundary, { | ||
element = /*#__PURE__*/React.createElement(RemixCatchBoundary, { | ||
location: location, | ||
@@ -265,3 +265,3 @@ component: CatchBoundary, | ||
}; | ||
element = /*#__PURE__*/React__default.createElement(RemixErrorBoundary, { | ||
element = /*#__PURE__*/React.createElement(RemixErrorBoundary, { | ||
location: location, | ||
@@ -275,3 +275,3 @@ component: ErrorBoundary, | ||
return /*#__PURE__*/React__default.createElement(RemixRouteContext.Provider, { | ||
return /*#__PURE__*/React.createElement(RemixRouteContext.Provider, { | ||
value: context | ||
@@ -291,4 +291,4 @@ }, element); | ||
function usePrefetchBehavior(prefetch, theirElementProps) { | ||
let [maybePrefetch, setMaybePrefetch] = React__default.useState(false); | ||
let [shouldPrefetch, setShouldPrefetch] = React__default.useState(false); | ||
let [maybePrefetch, setMaybePrefetch] = React.useState(false); | ||
let [shouldPrefetch, setShouldPrefetch] = React.useState(false); | ||
let { | ||
@@ -301,3 +301,3 @@ onFocus, | ||
} = theirElementProps; | ||
React__default.useEffect(() => { | ||
React.useEffect(() => { | ||
if (prefetch === "render") { | ||
@@ -320,3 +320,3 @@ setShouldPrefetch(true); | ||
React__default.useEffect(() => { | ||
React.useEffect(() => { | ||
if (maybePrefetch) { | ||
@@ -340,3 +340,3 @@ let id = setTimeout(() => { | ||
let NavLink = /*#__PURE__*/React__default.forwardRef(({ | ||
let NavLink = /*#__PURE__*/React.forwardRef(({ | ||
to, | ||
@@ -348,10 +348,10 @@ prefetch = "none", | ||
let [shouldPrefetch, prefetchHandlers] = usePrefetchBehavior(prefetch, props); | ||
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(NavLink$1, _extends({ | ||
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(NavLink$1, _extends({ | ||
ref: forwardedRef, | ||
to: to | ||
}, prefetchHandlers, props)), shouldPrefetch ? /*#__PURE__*/React__default.createElement(PrefetchPageLinks, { | ||
}, prefetchHandlers, props)), shouldPrefetch ? /*#__PURE__*/React.createElement(PrefetchPageLinks, { | ||
page: href | ||
}) : null); | ||
}); | ||
let Link = /*#__PURE__*/React__default.forwardRef(({ | ||
let Link = /*#__PURE__*/React.forwardRef(({ | ||
to, | ||
@@ -363,6 +363,6 @@ prefetch = "none", | ||
let [shouldPrefetch, prefetchHandlers] = usePrefetchBehavior(prefetch, props); | ||
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Link$1, _extends({ | ||
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Link$1, _extends({ | ||
ref: forwardedRef, | ||
to: to | ||
}, prefetchHandlers, props)), shouldPrefetch ? /*#__PURE__*/React__default.createElement(PrefetchPageLinks, { | ||
}, prefetchHandlers, props)), shouldPrefetch ? /*#__PURE__*/React.createElement(PrefetchPageLinks, { | ||
page: href | ||
@@ -390,6 +390,6 @@ }) : null); | ||
} = useRemixEntryContext(); | ||
let links = React__default.useMemo(() => getLinksForMatches(matches, routeModules, manifest), [matches, routeModules, manifest]); | ||
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, links.map(link => isPageLinkDescriptor(link) ? /*#__PURE__*/React__default.createElement(PrefetchPageLinks, _extends({ | ||
let links = React.useMemo(() => getLinksForMatches(matches, routeModules, manifest), [matches, routeModules, manifest]); | ||
return /*#__PURE__*/React.createElement(React.Fragment, null, links.map(link => isPageLinkDescriptor(link) ? /*#__PURE__*/React.createElement(PrefetchPageLinks, _extends({ | ||
key: link.page | ||
}, link)) : /*#__PURE__*/React__default.createElement("link", _extends({ | ||
}, link)) : /*#__PURE__*/React.createElement("link", _extends({ | ||
key: link.rel + link.href | ||
@@ -405,3 +405,3 @@ }, link)))); | ||
} = useRemixEntryContext(); | ||
let matches = React__default.useMemo(() => matchClientRoutes(clientRoutes, page), [clientRoutes, page]); | ||
let matches = React.useMemo(() => matchClientRoutes(clientRoutes, page), [clientRoutes, page]); | ||
@@ -413,3 +413,3 @@ if (!matches) { | ||
return /*#__PURE__*/React__default.createElement(PrefetchPageLinksImpl, _extends({ | ||
return /*#__PURE__*/React.createElement(PrefetchPageLinksImpl, _extends({ | ||
page: page, | ||
@@ -424,4 +424,4 @@ matches: matches | ||
} = useRemixEntryContext(); | ||
let [styleLinks, setStyleLinks] = React__default.useState([]); | ||
React__default.useEffect(() => { | ||
let [styleLinks, setStyleLinks] = React.useState([]); | ||
React.useEffect(() => { | ||
let interrupted = false; | ||
@@ -448,10 +448,10 @@ getStylesheetPrefetchLinks(matches, routeModules).then(links => { | ||
} = useRemixEntryContext(); | ||
let newMatchesForData = React__default.useMemo(() => getNewMatchesForLinks(page, nextMatches, matches, location, "data"), [page, nextMatches, matches, location]); | ||
let newMatchesForAssets = React__default.useMemo(() => getNewMatchesForLinks(page, nextMatches, matches, location, "assets"), [page, nextMatches, matches, location]); | ||
let dataHrefs = React__default.useMemo(() => getDataLinkHrefs(page, newMatchesForData, manifest), [newMatchesForData, page, manifest]); | ||
let moduleHrefs = React__default.useMemo(() => getModuleLinkHrefs(newMatchesForAssets, manifest), [newMatchesForAssets, manifest]); // needs to be a hook with async behavior because we need the modules, not | ||
let newMatchesForData = React.useMemo(() => getNewMatchesForLinks(page, nextMatches, matches, location, "data"), [page, nextMatches, matches, location]); | ||
let newMatchesForAssets = React.useMemo(() => getNewMatchesForLinks(page, nextMatches, matches, location, "assets"), [page, nextMatches, matches, location]); | ||
let dataHrefs = React.useMemo(() => getDataLinkHrefs(page, newMatchesForData, manifest), [newMatchesForData, page, manifest]); | ||
let moduleHrefs = React.useMemo(() => getModuleLinkHrefs(newMatchesForAssets, manifest), [newMatchesForAssets, manifest]); // needs to be a hook with async behavior because we need the modules, not | ||
// just the manifest like the other links in here. | ||
let styleLinks = usePrefetchedStylesheets(newMatchesForAssets); | ||
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, dataHrefs.map(href => /*#__PURE__*/React__default.createElement("link", _extends({ | ||
return /*#__PURE__*/React.createElement(React.Fragment, null, dataHrefs.map(href => /*#__PURE__*/React.createElement("link", _extends({ | ||
key: href, | ||
@@ -461,3 +461,3 @@ rel: "prefetch", | ||
href: href | ||
}, linkProps))), moduleHrefs.map(href => /*#__PURE__*/React__default.createElement("link", _extends({ | ||
}, linkProps))), moduleHrefs.map(href => /*#__PURE__*/React.createElement("link", _extends({ | ||
key: href, | ||
@@ -470,3 +470,3 @@ rel: "modulepreload", | ||
// already with their own props | ||
React__default.createElement("link", _extends({ | ||
React.createElement("link", _extends({ | ||
key: link.href | ||
@@ -509,21 +509,21 @@ }, link)))); | ||
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, Object.entries(meta).map(([name, value]) => { | ||
return /*#__PURE__*/React.createElement(React.Fragment, null, Object.entries(meta).map(([name, value]) => { | ||
// Open Graph tags use the `property` attribute, while other meta tags | ||
// use `name`. See https://ogp.me/ | ||
let isOpenGraphTag = name.startsWith("og:"); | ||
return name === "title" ? /*#__PURE__*/React__default.createElement("title", { | ||
return name === "title" ? /*#__PURE__*/React.createElement("title", { | ||
key: "title" | ||
}, value) : Array.isArray(value) ? value.map(content => isOpenGraphTag ? /*#__PURE__*/React__default.createElement("meta", { | ||
}, value) : Array.isArray(value) ? value.map(content => isOpenGraphTag ? /*#__PURE__*/React.createElement("meta", { | ||
key: name + content, | ||
property: name, | ||
content: content | ||
}) : /*#__PURE__*/React__default.createElement("meta", { | ||
}) : /*#__PURE__*/React.createElement("meta", { | ||
key: name + content, | ||
name: name, | ||
content: content | ||
})) : isOpenGraphTag ? /*#__PURE__*/React__default.createElement("meta", { | ||
})) : isOpenGraphTag ? /*#__PURE__*/React.createElement("meta", { | ||
key: name, | ||
property: name, | ||
content: value | ||
}) : /*#__PURE__*/React__default.createElement("meta", { | ||
}) : /*#__PURE__*/React.createElement("meta", { | ||
key: name, | ||
@@ -558,18 +558,18 @@ name: name, | ||
} = useRemixEntryContext(); | ||
React__default.useEffect(() => { | ||
React.useEffect(() => { | ||
isHydrated = true; | ||
}, []); | ||
let initialScripts = React__default.useMemo(() => { | ||
let initialScripts = React.useMemo(() => { | ||
let contextScript = serverHandoffString ? `window.__remixContext = ${serverHandoffString};` : ""; | ||
let routeModulesScript = `${matches.map((match, index) => `import * as route${index} from ${JSON.stringify(manifest.routes[match.route.id].module)};`).join("\n")} | ||
window.__remixRouteModules = {${matches.map((match, index) => `${JSON.stringify(match.route.id)}:route${index}`).join(",")}};`; | ||
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("script", _extends({}, props, { | ||
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("script", _extends({}, props, { | ||
suppressHydrationWarning: true, | ||
dangerouslySetInnerHTML: createHtml(contextScript) | ||
})), /*#__PURE__*/React__default.createElement("script", _extends({}, props, { | ||
})), /*#__PURE__*/React.createElement("script", _extends({}, props, { | ||
src: manifest.url | ||
})), /*#__PURE__*/React__default.createElement("script", _extends({}, props, { | ||
})), /*#__PURE__*/React.createElement("script", _extends({}, props, { | ||
dangerouslySetInnerHTML: createHtml(routeModulesScript), | ||
type: "module" | ||
})), /*#__PURE__*/React__default.createElement("script", _extends({}, props, { | ||
})), /*#__PURE__*/React.createElement("script", _extends({}, props, { | ||
src: manifest.entry.module, | ||
@@ -583,3 +583,3 @@ type: "module" | ||
let nextMatches = React__default.useMemo(() => { | ||
let nextMatches = React.useMemo(() => { | ||
if (pendingLocation) { | ||
@@ -599,3 +599,3 @@ // FIXME: can probably use transitionManager `nextMatches` | ||
let preloads = manifest.entry.imports.concat(routePreloads); | ||
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, dedupe(preloads).map(path => /*#__PURE__*/React__default.createElement("link", { | ||
return /*#__PURE__*/React.createElement(React.Fragment, null, dedupe(preloads).map(path => /*#__PURE__*/React.createElement("link", { | ||
key: path, | ||
@@ -618,8 +618,8 @@ rel: "modulepreload", | ||
*/ | ||
let Form = /*#__PURE__*/React__default.forwardRef((props, ref) => { | ||
return /*#__PURE__*/React__default.createElement(FormImpl, _extends({}, props, { | ||
let Form = /*#__PURE__*/React.forwardRef((props, ref) => { | ||
return /*#__PURE__*/React.createElement(FormImpl, _extends({}, props, { | ||
ref: ref | ||
})); | ||
}); | ||
let FormImpl = /*#__PURE__*/React__default.forwardRef(({ | ||
let FormImpl = /*#__PURE__*/React.forwardRef(({ | ||
reloadDocument = false, | ||
@@ -637,3 +637,3 @@ replace = false, | ||
let formAction = useFormAction(action, formMethod); | ||
let formRef = React__default.useRef(); | ||
let formRef = React.useRef(); | ||
let ref = useComposedRefs(forwardedRef, formRef); // When calling `submit` on the form element itself, we don't get data from | ||
@@ -655,4 +655,4 @@ // the button that submitted the event. For example: | ||
let clickedButtonRef = React__default.useRef(); | ||
React__default.useEffect(() => { | ||
let clickedButtonRef = React.useRef(); | ||
React.useEffect(() => { | ||
let form = formRef.current; | ||
@@ -675,3 +675,3 @@ if (!form) return; | ||
}, []); | ||
return /*#__PURE__*/React__default.createElement("form", _extends({ | ||
return /*#__PURE__*/React.createElement("form", _extends({ | ||
ref: ref, | ||
@@ -731,3 +731,3 @@ method: formMethod, | ||
} = useRemixEntryContext(); | ||
return React__default.useCallback((target, options = {}) => { | ||
return React.useCallback((target, options = {}) => { | ||
let method; | ||
@@ -868,3 +868,3 @@ let action; | ||
function useBeforeUnload(callback) { | ||
React__default.useEffect(() => { | ||
React.useEffect(() => { | ||
window.addEventListener("beforeunload", callback); | ||
@@ -883,2 +883,4 @@ return () => { | ||
return matches.map(match => { | ||
var _routeModules$match$r; | ||
let { | ||
@@ -889,6 +891,9 @@ pathname, | ||
return { | ||
id: match.route.id, | ||
pathname, | ||
params, | ||
data: routeData[match.route.id], | ||
handle: routeModules[match.route.id].handle | ||
// if the module fails to load or an error/response is thrown, the module | ||
// won't be defined. | ||
handle: (_routeModules$match$r = routeModules[match.route.id]) === null || _routeModules$match$r === void 0 ? void 0 : _routeModules$match$r.handle | ||
}; | ||
@@ -924,5 +929,5 @@ }); | ||
function createFetcherForm(fetchKey) { | ||
return /*#__PURE__*/React__default.forwardRef((props, ref) => { | ||
return /*#__PURE__*/React.forwardRef((props, ref) => { | ||
// TODO: make ANOTHER form w/o a fetchKey prop | ||
return /*#__PURE__*/React__default.createElement(FormImpl, _extends({}, props, { | ||
return /*#__PURE__*/React.createElement(FormImpl, _extends({}, props, { | ||
ref: ref, | ||
@@ -944,5 +949,5 @@ fetchKey: fetchKey | ||
} = useRemixEntryContext(); | ||
let [key] = React__default.useState(() => String(++fetcherId)); | ||
let [Form] = React__default.useState(() => createFetcherForm(key)); | ||
let [load] = React__default.useState(() => href => { | ||
let [key] = React.useState(() => String(++fetcherId)); | ||
let [Form] = React.useState(() => createFetcherForm(key)); | ||
let [load] = React.useState(() => href => { | ||
transitionManager.send({ | ||
@@ -956,3 +961,3 @@ type: "fetcher", | ||
let fetcher = transitionManager.getFetcher(key); | ||
let fetcherWithComponents = React__default.useMemo(() => ({ | ||
let fetcherWithComponents = React.useMemo(() => ({ | ||
Form, | ||
@@ -963,3 +968,3 @@ submit, | ||
}), [fetcher, Form, submit, load]); | ||
React__default.useEffect(() => { | ||
React.useEffect(() => { | ||
// Is this busted when the React team gets real weird and calls effects | ||
@@ -990,3 +995,3 @@ // twice on mount? We really just need to garbage collect here when this | ||
if (process.env.NODE_ENV !== "development") return null; | ||
return /*#__PURE__*/React__default.createElement("script", { | ||
return /*#__PURE__*/React.createElement("script", { | ||
dangerouslySetInnerHTML: { | ||
@@ -1015,3 +1020,3 @@ __html: ` | ||
function useComposedRefs(...refs) { | ||
return React__default.useCallback(node => { | ||
return React.useCallback(node => { | ||
for (let ref of refs) { | ||
@@ -1018,0 +1023,0 @@ if (ref == null) continue; |
/** | ||
* @remix-run/react v0.0.0-experimental-149e932f | ||
* @remix-run/react v0.0.0-experimental-2ca98589 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/react v0.0.0-experimental-149e932f | ||
* @remix-run/react v0.0.0-experimental-2ca98589 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/react v0.0.0-experimental-149e932f | ||
* @remix-run/react v0.0.0-experimental-2ca98589 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/react v0.0.0-experimental-149e932f | ||
* @remix-run/react v0.0.0-experimental-2ca98589 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/react v0.0.0-experimental-149e932f | ||
* @remix-run/react v0.0.0-experimental-2ca98589 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/react v0.0.0-experimental-149e932f | ||
* @remix-run/react v0.0.0-experimental-2ca98589 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/react v0.0.0-experimental-149e932f | ||
* @remix-run/react v0.0.0-experimental-2ca98589 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/react v0.0.0-experimental-149e932f | ||
* @remix-run/react v0.0.0-experimental-2ca98589 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/react v0.0.0-experimental-149e932f | ||
* @remix-run/react v0.0.0-experimental-2ca98589 | ||
* | ||
@@ -11,3 +11,3 @@ * Copyright (c) Remix Software Inc. | ||
*/ | ||
import React__default from 'react'; | ||
import * as React from 'react'; | ||
import { loadRouteModule } from './routeModules.js'; | ||
@@ -22,3 +22,3 @@ import { fetchData, isCatchResponse, extractData, isRedirectResponse } from './data.js'; | ||
caseSensitive: !!entryRoute.caseSensitive, | ||
element: /*#__PURE__*/React__default.createElement(Component, { | ||
element: /*#__PURE__*/React.createElement(Component, { | ||
id: entryRoute.id | ||
@@ -25,0 +25,0 @@ }), |
/** | ||
* @remix-run/react v0.0.0-experimental-149e932f | ||
* @remix-run/react v0.0.0-experimental-2ca98589 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/react v0.0.0-experimental-149e932f | ||
* @remix-run/react v0.0.0-experimental-2ca98589 | ||
* | ||
@@ -12,3 +12,3 @@ * Copyright (c) Remix Software Inc. | ||
import { Action, createPath } from 'history'; | ||
import React__default from 'react'; | ||
import * as React from 'react'; | ||
import { RemixEntry } from './components.js'; | ||
@@ -66,3 +66,3 @@ | ||
}; | ||
return /*#__PURE__*/React__default.createElement(RemixEntry, { | ||
return /*#__PURE__*/React.createElement(RemixEntry, { | ||
context: context, | ||
@@ -69,0 +69,0 @@ action: Action.Pop, |
/** | ||
* @remix-run/react v0.0.0-experimental-149e932f | ||
* @remix-run/react v0.0.0-experimental-2ca98589 | ||
* | ||
@@ -215,2 +215,3 @@ * Copyright (c) Remix Software Inc. | ||
async function handleActionFetchSubmission(key, submission, match) { | ||
let currentFetcher = state.fetchers.get(key); | ||
let fetcher = { | ||
@@ -220,3 +221,3 @@ state: "submitting", | ||
submission, | ||
data: undefined | ||
data: (currentFetcher === null || currentFetcher === void 0 ? void 0 : currentFetcher.data) || undefined | ||
}; | ||
@@ -376,2 +377,3 @@ state.fetchers.set(key, fetcher); | ||
async function handleLoaderFetchSubmission(href, key, submission, match) { | ||
let currentFetcher = state.fetchers.get(key); | ||
let fetcher = { | ||
@@ -381,3 +383,3 @@ state: "submitting", | ||
submission, | ||
data: undefined | ||
data: (currentFetcher === null || currentFetcher === void 0 ? void 0 : currentFetcher.data) || undefined | ||
}; | ||
@@ -427,2 +429,3 @@ state.fetchers.set(key, fetcher); | ||
async function handleLoaderFetch(href, key, match) { | ||
let currentFetcher = state.fetchers.get(key); | ||
let fetcher = { | ||
@@ -432,3 +435,3 @@ state: "loading", | ||
submission: undefined, | ||
data: undefined | ||
data: (currentFetcher === null || currentFetcher === void 0 ? void 0 : currentFetcher.data) || undefined | ||
}; | ||
@@ -435,0 +438,0 @@ state.fetchers.set(key, fetcher); |
/** | ||
* @remix-run/react v0.0.0-experimental-149e932f | ||
* @remix-run/react v0.0.0-experimental-2ca98589 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/react v0.0.0-experimental-149e932f | ||
* @remix-run/react v0.0.0-experimental-2ca98589 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/react v0.0.0-experimental-149e932f | ||
* @remix-run/react v0.0.0-experimental-2ca98589 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/react v0.0.0-experimental-149e932f | ||
* @remix-run/react v0.0.0-experimental-2ca98589 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/react v0.0.0-experimental-149e932f | ||
* @remix-run/react v0.0.0-experimental-2ca98589 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/react v0.0.0-experimental-149e932f | ||
* @remix-run/react v0.0.0-experimental-2ca98589 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
{ | ||
"name": "@remix-run/react", | ||
"description": "React DOM bindings for Remix", | ||
"version": "0.0.0-experimental-149e932f", | ||
"version": "0.0.0-experimental-2ca98589", | ||
"license": "MIT", | ||
@@ -17,3 +17,3 @@ "repository": { | ||
"dependencies": { | ||
"react-router-dom": "^6.1.1" | ||
"react-router-dom": "^6.2.1" | ||
}, | ||
@@ -20,0 +20,0 @@ "peerDependencies": { |
/** | ||
* @remix-run/react v0.0.0-experimental-149e932f | ||
* @remix-run/react v0.0.0-experimental-2ca98589 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/react v0.0.0-experimental-149e932f | ||
* @remix-run/react v0.0.0-experimental-2ca98589 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/react v0.0.0-experimental-149e932f | ||
* @remix-run/react v0.0.0-experimental-2ca98589 | ||
* | ||
@@ -22,5 +22,21 @@ * Copyright (c) Remix Software Inc. | ||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
function _interopNamespace(e) { | ||
if (e && e.__esModule) return e; | ||
var n = Object.create(null); | ||
if (e) { | ||
Object.keys(e).forEach(function (k) { | ||
if (k !== 'default') { | ||
var d = Object.getOwnPropertyDescriptor(e, k); | ||
Object.defineProperty(n, k, d.get ? d : { | ||
enumerable: true, | ||
get: function () { return e[k]; } | ||
}); | ||
} | ||
}); | ||
} | ||
n["default"] = e; | ||
return Object.freeze(n); | ||
} | ||
var React__default = /*#__PURE__*/_interopDefaultLegacy(React); | ||
var React__namespace = /*#__PURE__*/_interopNamespace(React); | ||
@@ -30,3 +46,3 @@ function createClientRoute(entryRoute, routeModulesCache, Component) { | ||
caseSensitive: !!entryRoute.caseSensitive, | ||
element: /*#__PURE__*/React__default["default"].createElement(Component, { | ||
element: /*#__PURE__*/React__namespace.createElement(Component, { | ||
id: entryRoute.id | ||
@@ -33,0 +49,0 @@ }), |
/** | ||
* @remix-run/react v0.0.0-experimental-149e932f | ||
* @remix-run/react v0.0.0-experimental-2ca98589 | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
/** | ||
* @remix-run/react v0.0.0-experimental-149e932f | ||
* @remix-run/react v0.0.0-experimental-2ca98589 | ||
* | ||
@@ -19,5 +19,21 @@ * Copyright (c) Remix Software Inc. | ||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
function _interopNamespace(e) { | ||
if (e && e.__esModule) return e; | ||
var n = Object.create(null); | ||
if (e) { | ||
Object.keys(e).forEach(function (k) { | ||
if (k !== 'default') { | ||
var d = Object.getOwnPropertyDescriptor(e, k); | ||
Object.defineProperty(n, k, d.get ? d : { | ||
enumerable: true, | ||
get: function () { return e[k]; } | ||
}); | ||
} | ||
}); | ||
} | ||
n["default"] = e; | ||
return Object.freeze(n); | ||
} | ||
var React__default = /*#__PURE__*/_interopDefaultLegacy(React); | ||
var React__namespace = /*#__PURE__*/_interopNamespace(React); | ||
@@ -74,3 +90,3 @@ /** | ||
}; | ||
return /*#__PURE__*/React__default["default"].createElement(components.RemixEntry, { | ||
return /*#__PURE__*/React__namespace.createElement(components.RemixEntry, { | ||
context: context, | ||
@@ -77,0 +93,0 @@ action: history.Action.Pop, |
@@ -186,3 +186,3 @@ import { Action } from "history"; | ||
submission: LoaderSubmission; | ||
data: undefined; | ||
data: TData | undefined; | ||
}; | ||
@@ -199,3 +199,3 @@ ReloadingAction: { | ||
submission: undefined; | ||
data: undefined; | ||
data: TData | undefined; | ||
}; | ||
@@ -202,0 +202,0 @@ Done: { |
/** | ||
* @remix-run/react v0.0.0-experimental-149e932f | ||
* @remix-run/react v0.0.0-experimental-2ca98589 | ||
* | ||
@@ -219,2 +219,3 @@ * Copyright (c) Remix Software Inc. | ||
async function handleActionFetchSubmission(key, submission, match) { | ||
let currentFetcher = state.fetchers.get(key); | ||
let fetcher = { | ||
@@ -224,3 +225,3 @@ state: "submitting", | ||
submission, | ||
data: undefined | ||
data: (currentFetcher === null || currentFetcher === void 0 ? void 0 : currentFetcher.data) || undefined | ||
}; | ||
@@ -380,2 +381,3 @@ state.fetchers.set(key, fetcher); | ||
async function handleLoaderFetchSubmission(href, key, submission, match) { | ||
let currentFetcher = state.fetchers.get(key); | ||
let fetcher = { | ||
@@ -385,3 +387,3 @@ state: "submitting", | ||
submission, | ||
data: undefined | ||
data: (currentFetcher === null || currentFetcher === void 0 ? void 0 : currentFetcher.data) || undefined | ||
}; | ||
@@ -431,2 +433,3 @@ state.fetchers.set(key, fetcher); | ||
async function handleLoaderFetch(href, key, match) { | ||
let currentFetcher = state.fetchers.get(key); | ||
let fetcher = { | ||
@@ -436,3 +439,3 @@ state: "loading", | ||
submission: undefined, | ||
data: undefined | ||
data: (currentFetcher === null || currentFetcher === void 0 ? void 0 : currentFetcher.data) || undefined | ||
}; | ||
@@ -439,0 +442,0 @@ state.fetchers.set(key, fetcher); |
238015
6796
Updatedreact-router-dom@^6.2.1