clear-react-router 1.9.4 → 1.9.5
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/index.js +12 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -44,7 +44,7 @@ var createCommitState = ({ routeItemDataState, pendingState }) => (nextLocation,
|
|
|
44
44
|
//#region constants.ts
|
|
45
45
|
var emptyLoaderState = {};
|
|
46
46
|
//#endregion
|
|
47
|
-
//#region \0@oxc-project+runtime@0.
|
|
47
|
+
//#region \0@oxc-project+runtime@0.143.0/helpers/esm/typeof.js
|
|
48
48
|
function _typeof(o) {
|
|
49
49
|
"@babel/helpers - typeof";
|
|
50
50
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -54,7 +54,7 @@ function _typeof(o) {
|
|
|
54
54
|
}, _typeof(o);
|
|
55
55
|
}
|
|
56
56
|
//#endregion
|
|
57
|
-
//#region \0@oxc-project+runtime@0.
|
|
57
|
+
//#region \0@oxc-project+runtime@0.143.0/helpers/esm/toPrimitive.js
|
|
58
58
|
function toPrimitive(t, r) {
|
|
59
59
|
if ("object" != _typeof(t) || !t) return t;
|
|
60
60
|
var e = t[Symbol.toPrimitive];
|
|
@@ -66,13 +66,13 @@ function toPrimitive(t, r) {
|
|
|
66
66
|
return ("string" === r ? String : Number)(t);
|
|
67
67
|
}
|
|
68
68
|
//#endregion
|
|
69
|
-
//#region \0@oxc-project+runtime@0.
|
|
69
|
+
//#region \0@oxc-project+runtime@0.143.0/helpers/esm/toPropertyKey.js
|
|
70
70
|
function toPropertyKey(t) {
|
|
71
71
|
var i = toPrimitive(t, "string");
|
|
72
72
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
73
73
|
}
|
|
74
74
|
//#endregion
|
|
75
|
-
//#region \0@oxc-project+runtime@0.
|
|
75
|
+
//#region \0@oxc-project+runtime@0.143.0/helpers/esm/defineProperty.js
|
|
76
76
|
function _defineProperty(e, r, t) {
|
|
77
77
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
78
78
|
value: t,
|
|
@@ -133,7 +133,8 @@ var createIsCacheItemFresh = (loaderMap) => ({ routeItem, pathname }) => {
|
|
|
133
133
|
* LICENSE file in the root directory of this source tree.
|
|
134
134
|
*/
|
|
135
135
|
var require_react_jsx_runtime_production = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
136
|
-
var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element")
|
|
136
|
+
var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element");
|
|
137
|
+
var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
|
|
137
138
|
function jsxProd(type, config, maybeKey) {
|
|
138
139
|
var key = null;
|
|
139
140
|
void 0 !== maybeKey && (key = "" + maybeKey);
|
|
@@ -792,7 +793,8 @@ var Link = ({ children, to, as = defaultAs, prefetch: prefetchLink, hoverPrefetc
|
|
|
792
793
|
if (prefetch !== "viewport") return;
|
|
793
794
|
const element = elementRef.current;
|
|
794
795
|
if (!element) return;
|
|
795
|
-
const observer = new IntersectionObserver(async () => {
|
|
796
|
+
const observer = new IntersectionObserver(async ([entry]) => {
|
|
797
|
+
if (!entry.isIntersecting) return;
|
|
796
798
|
await router.runtime.prefetch(to);
|
|
797
799
|
observer.disconnect();
|
|
798
800
|
});
|
|
@@ -990,8 +992,10 @@ var useSearchParams = () => {
|
|
|
990
992
|
currentParams.delete(param);
|
|
991
993
|
(Array.isArray(value) ? value : [value]).forEach((v) => currentParams.append(param, v));
|
|
992
994
|
navigateWithSearchParams(currentParams);
|
|
993
|
-
} else if (typeof param === "function")
|
|
994
|
-
|
|
995
|
+
} else if (typeof param === "function") {
|
|
996
|
+
const newParams = param(currentParams);
|
|
997
|
+
navigateWithSearchParams(newParams);
|
|
998
|
+
} else throw new Error("useSearchParams first argument must be either function or string");
|
|
995
999
|
}, [navigateWithSearchParams, search])
|
|
996
1000
|
};
|
|
997
1001
|
};
|