@rpcbase/client 0.301.0 → 0.302.0
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/RootProvider/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAOjC,KAAK,iBAAiB,GAAG;IACvB,QAAQ,EAAE,SAAS,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,YAAY,GAAI,cAAY,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/RootProvider/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAOjC,KAAK,iBAAiB,GAAG;IACvB,QAAQ,EAAE,SAAS,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,YAAY,GAAI,cAAY,iBAAiB,4CAQzD,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
type Rect = {
|
|
2
2
|
x: number;
|
|
3
3
|
y: number;
|
|
4
4
|
width: number;
|
|
@@ -7,5 +7,7 @@ export declare const useThrottledMeasure: (throttleDuration?: number) => (import
|
|
|
7
7
|
left: number;
|
|
8
8
|
bottom: number;
|
|
9
9
|
right: number;
|
|
10
|
-
}
|
|
10
|
+
};
|
|
11
|
+
export declare const useThrottledMeasure: (throttleDuration?: number) => (Rect | ((el: HTMLElement | null) => void))[];
|
|
12
|
+
export {};
|
|
11
13
|
//# sourceMappingURL=useThrottledMeasure.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useThrottledMeasure.d.ts","sourceRoot":"","sources":["../../src/hooks/useThrottledMeasure.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useThrottledMeasure.d.ts","sourceRoot":"","sources":["../../src/hooks/useThrottledMeasure.ts"],"names":[],"mappings":"AAKA,KAAK,IAAI,GAAG;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAC,CAAA;AA+B3H,eAAO,MAAM,mBAAmB,GAAI,yBAAwC,mBAvB7C,WAAW,GAAG,IAAI,aA2DhD,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import env from "@rpcbase/env";
|
|
2
|
-
import { jsx, jsxs
|
|
3
|
-
import { StrictMode, useRef, useEffect, useCallback, useState, useSyncExternalStore } from "react";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { StrictMode, useRef, useEffect, useCallback, useState, useLayoutEffect, useSyncExternalStore } from "react";
|
|
4
4
|
import posthog from "posthog-js";
|
|
5
5
|
import { createRoutesFromElements, createBrowserRouter, RouterProvider, useLocation, useRouteError, isRouteErrorResponse } from "@rpcbase/router";
|
|
6
6
|
import { hydrateRoot } from "react-dom/client";
|
|
7
|
-
import
|
|
7
|
+
import { PostHogProvider } from "posthog-js/react/dist/esm/index.js";
|
|
8
8
|
let apiClient;
|
|
9
9
|
const initApiClient = async (args) => {
|
|
10
10
|
if (env.SSR) {
|
|
@@ -125,7 +125,6 @@ const SsrErrorFallback = ({ state, renderErrorExtra }) => {
|
|
|
125
125
|
] }) });
|
|
126
126
|
};
|
|
127
127
|
const isProduction = env.MODE === "production";
|
|
128
|
-
console.log("IS PRODUCTION CHECK SEE HERE:", env.MODE, globalThis.__rb_env__.MODE === "production", isProduction, env.MODE, env.DEV);
|
|
129
128
|
const showErrorOverlay = (err) => {
|
|
130
129
|
const ErrorOverlay = customElements.get("vite-error-overlay");
|
|
131
130
|
if (!ErrorOverlay) {
|
|
@@ -918,7 +917,7 @@ function useApplyScroll() {
|
|
|
918
917
|
}
|
|
919
918
|
const RootProvider = ({ children }) => {
|
|
920
919
|
useApplyScroll();
|
|
921
|
-
return /* @__PURE__ */ jsx(
|
|
920
|
+
return /* @__PURE__ */ jsx(PostHogProvider, { client: posthog, children });
|
|
922
921
|
};
|
|
923
922
|
var isObject_1;
|
|
924
923
|
var hasRequiredIsObject;
|
|
@@ -1529,14 +1528,31 @@ function createCustomEqual(options) {
|
|
|
1529
1528
|
var equals = createCustomInternalComparator ? createCustomInternalComparator(comparator) : createInternalEqualityComparator(comparator);
|
|
1530
1529
|
return createIsEqual({ circular, comparator, createState, equals, strict });
|
|
1531
1530
|
}
|
|
1532
|
-
const
|
|
1531
|
+
const defaultRect = { x: 0, y: 0, width: 0, height: 0, top: 0, left: 0, bottom: 0, right: 0 };
|
|
1532
|
+
const useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect;
|
|
1533
|
+
const useLocalMeasure = () => {
|
|
1534
|
+
const [node, setNode] = useState(null);
|
|
1535
|
+
const ref = useCallback((el) => setNode(el), []);
|
|
1536
|
+
const [rect, setRect] = useState(defaultRect);
|
|
1537
|
+
useIsomorphicLayoutEffect(() => {
|
|
1538
|
+
if (typeof window === "undefined" || typeof ResizeObserver === "undefined") return;
|
|
1539
|
+
if (!node) return;
|
|
1540
|
+
const observer = new ResizeObserver((entries) => {
|
|
1541
|
+
const entry = entries[0];
|
|
1542
|
+
if (!entry?.contentRect) return;
|
|
1543
|
+
const { x, y, width, height, top, left, bottom, right } = entry.contentRect;
|
|
1544
|
+
setRect({ x, y, width, height, top, left, bottom, right });
|
|
1545
|
+
});
|
|
1546
|
+
observer.observe(node);
|
|
1547
|
+
return () => observer.disconnect();
|
|
1548
|
+
}, [node]);
|
|
1549
|
+
return [ref, rect];
|
|
1550
|
+
};
|
|
1533
1551
|
const DEFAULT_THROTTLE_TIME = 16;
|
|
1534
1552
|
const useThrottledMeasure = (throttleDuration = DEFAULT_THROTTLE_TIME) => {
|
|
1535
1553
|
const hasInitialMeasure = useRef(false);
|
|
1536
|
-
const [ref, measuredRect] =
|
|
1537
|
-
const [rect, setRect] = useState(() =>
|
|
1538
|
-
return { x: 0, y: 0, width: 0, height: 0, top: 0, left: 0, bottom: 0, right: 0 };
|
|
1539
|
-
});
|
|
1554
|
+
const [ref, measuredRect] = useLocalMeasure();
|
|
1555
|
+
const [rect, setRect] = useState(() => defaultRect);
|
|
1540
1556
|
const throttledSetRect = useCallback(
|
|
1541
1557
|
_throttle(
|
|
1542
1558
|
(newRect) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initWithRoutes.d.ts","sourceRoot":"","sources":["../src/initWithRoutes.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAc,MAAM,OAAO,CAAA;AAE7C,OAAO,EAAsB,wBAAwB,EAAiB,MAAM,iBAAiB,CAAA;AAK7F,OAAO,EAGL,oBAAoB,EACrB,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"initWithRoutes.d.ts","sourceRoot":"","sources":["../src/initWithRoutes.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAc,MAAM,OAAO,CAAA;AAE7C,OAAO,EAAsB,wBAAwB,EAAiB,MAAM,iBAAiB,CAAA;AAK7F,OAAO,EAGL,oBAAoB,EACrB,MAAM,iBAAiB,CAAA;AAkCxB,KAAK,qBAAqB,GAAG;IAC3B,0BAA0B,CAAC,EAAE,OAAO,CAAA;IACpC,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,oBAAoB,KAAK,SAAS,CAAA;CAC9D,CAAA;AAED,KAAK,aAAa,GAAG,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC,CAAC,CAAC,CAAA;AA8BnE,eAAO,MAAM,cAAc,GACzB,eAAe,aAAa,EAC5B,OAAO,qBAAqB,kBA+E7B,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rpcbase/client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.302.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -57,8 +57,7 @@
|
|
|
57
57
|
}
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
|
-
"axios": "^1.13"
|
|
61
|
-
"react-use": "17.6.0"
|
|
60
|
+
"axios": "^1.13"
|
|
62
61
|
},
|
|
63
62
|
"devDependencies": {
|
|
64
63
|
"fast-equals": "5.2.2",
|