rockin 0.0.32 → 0.0.34
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/hooks/index.d.ts +2 -1
- package/dist/hooks/index.js +11 -8
- package/package.json +1 -1
package/dist/hooks/index.d.ts
CHANGED
|
@@ -60,7 +60,8 @@ declare function useSearchParams(): {
|
|
|
60
60
|
type SideRail = "left" | "right" | null;
|
|
61
61
|
/**
|
|
62
62
|
* Which screen edge has a wide, empty safe-area strip that can hold a vertical
|
|
63
|
-
* nav rail, such as the sensor column on the iPhone Duo.
|
|
63
|
+
* nav rail, such as the sensor column on the iPhone Duo. Only reported inside
|
|
64
|
+
* the native Capacitor app; `null` in every browser and on other screens.
|
|
64
65
|
*/
|
|
65
66
|
declare function useSideRail(): SideRail;
|
|
66
67
|
|
package/dist/hooks/index.js
CHANGED
|
@@ -18,13 +18,15 @@ import {
|
|
|
18
18
|
useMediaQuery,
|
|
19
19
|
useMounted
|
|
20
20
|
} from "../chunk-4KFB6AJH.js";
|
|
21
|
-
import
|
|
21
|
+
import {
|
|
22
|
+
isNativeApp
|
|
23
|
+
} from "../chunk-ATPUW3SQ.js";
|
|
22
24
|
|
|
23
25
|
// src/hooks/useSearchParams.ts
|
|
24
26
|
import {
|
|
27
|
+
useSearchParams as useNextSearchParams,
|
|
25
28
|
usePathname,
|
|
26
|
-
useRouter
|
|
27
|
-
useSearchParams as useNextSearchParams
|
|
29
|
+
useRouter
|
|
28
30
|
} from "next/navigation";
|
|
29
31
|
import {
|
|
30
32
|
debounce,
|
|
@@ -32,8 +34,8 @@ import {
|
|
|
32
34
|
} from "nuqs";
|
|
33
35
|
import { NuqsAdapter } from "nuqs/adapters/next/app";
|
|
34
36
|
import * as React from "react";
|
|
35
|
-
var SEARCH_DELAY =
|
|
36
|
-
var
|
|
37
|
+
var SEARCH_DELAY = 300;
|
|
38
|
+
var QUERY_SEARCH_DELAY = 300;
|
|
37
39
|
function isSearchPath(pathname) {
|
|
38
40
|
return pathname === "/" || pathname === "/pos" || pathname === "/orders" || pathname === "/bin" || pathname.startsWith("/pos/") || pathname.startsWith("/orders/") || pathname.startsWith("/bin/");
|
|
39
41
|
}
|
|
@@ -80,9 +82,7 @@ function useSearchParams() {
|
|
|
80
82
|
history: "replace",
|
|
81
83
|
scroll: false,
|
|
82
84
|
shallow: !onSearchPath,
|
|
83
|
-
limitUrlUpdates: debounce(
|
|
84
|
-
onSearchPath ? SEARCH_DELAY : PRODUCT_SEARCH_DELAY
|
|
85
|
-
)
|
|
85
|
+
limitUrlUpdates: debounce(QUERY_SEARCH_DELAY)
|
|
86
86
|
}
|
|
87
87
|
);
|
|
88
88
|
if (onSearchPath) return;
|
|
@@ -279,12 +279,15 @@ function readInsets() {
|
|
|
279
279
|
};
|
|
280
280
|
}
|
|
281
281
|
function getSnapshot() {
|
|
282
|
+
if (!isNativeApp()) return null;
|
|
282
283
|
const { left, right } = readInsets();
|
|
283
284
|
if (right >= RAIL_MIN_INSET && left <= RAIL_MAX_OPPOSITE) return "right";
|
|
284
285
|
if (left >= RAIL_MIN_INSET && right <= RAIL_MAX_OPPOSITE) return "left";
|
|
285
286
|
return null;
|
|
286
287
|
}
|
|
287
288
|
function subscribe(onChange) {
|
|
289
|
+
if (!isNativeApp()) return () => {
|
|
290
|
+
};
|
|
288
291
|
readInsets();
|
|
289
292
|
const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(onChange);
|
|
290
293
|
if (probe) observer?.observe(probe, { box: "border-box" });
|