@datarecce/ui 0.1.28 → 0.1.29
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/{RecceCheckContext-CiG9fGRW.mjs → RecceCheckContext-PT4-g1bW.mjs} +2 -2
- package/dist/{RecceCheckContext-CiG9fGRW.mjs.map → RecceCheckContext-PT4-g1bW.mjs.map} +1 -1
- package/dist/{RecceCheckContext-tUxygNmN.js → RecceCheckContext-fAKHgsGz.js} +2 -2
- package/dist/{RecceCheckContext-tUxygNmN.js.map → RecceCheckContext-fAKHgsGz.js.map} +1 -1
- package/dist/api.d.mts +1 -1
- package/dist/api.js +2 -2
- package/dist/api.mjs +2 -2
- package/dist/{components-Cvfq_6t4.js → components-B9F5oJbK.js} +4 -4
- package/dist/{components-Cvfq_6t4.js.map → components-B9F5oJbK.js.map} +1 -1
- package/dist/{components-Bt0G4cpr.mjs → components-gDC1ucjo.mjs} +4 -4
- package/dist/{components-Bt0G4cpr.mjs.map → components-gDC1ucjo.mjs.map} +1 -1
- package/dist/components.d.mts +1 -1
- package/dist/components.js +4 -4
- package/dist/components.mjs +4 -4
- package/dist/hooks-4hRUjy9Q.mjs +34 -0
- package/dist/hooks-4hRUjy9Q.mjs.map +1 -0
- package/dist/hooks-C2jUJ9EN.js +40 -0
- package/dist/hooks-C2jUJ9EN.js.map +1 -0
- package/dist/hooks.d.mts +1 -1
- package/dist/hooks.js +11 -11
- package/dist/hooks.mjs +3 -3
- package/dist/{index-OJCzYajo.d.mts → index-Bv5R8iLo.d.mts} +70 -70
- package/dist/{index-OJCzYajo.d.mts.map → index-Bv5R8iLo.d.mts.map} +1 -1
- package/dist/index-CUtFlKOo.d.ts.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.js +13 -13
- package/dist/index.mjs +5 -5
- package/dist/{state-DyHCt6IJ.mjs → state-CELzQ0tM.mjs} +183 -20
- package/dist/state-CELzQ0tM.mjs.map +1 -0
- package/dist/{state-FkYREAs-.js → state-CemiRRon.js} +223 -18
- package/dist/state-CemiRRon.js.map +1 -0
- package/dist/types.d.mts +1 -1
- package/dist/{version-BGNaeW6k.js → version-bWg7XwOu.js} +2 -2
- package/dist/{version-BGNaeW6k.js.map → version-bWg7XwOu.js.map} +1 -1
- package/dist/{version-Dav28qEz.mjs → version-paZ9esBk.mjs} +2 -2
- package/dist/{version-Dav28qEz.mjs.map → version-paZ9esBk.mjs.map} +1 -1
- package/package.json +1 -1
- package/dist/hooks-BxV6qN9q.mjs +0 -233
- package/dist/hooks-BxV6qN9q.mjs.map +0 -1
- package/dist/hooks-CriUVJO1.js +0 -287
- package/dist/hooks-CriUVJO1.js.map +0 -1
- package/dist/state-DyHCt6IJ.mjs.map +0 -1
- package/dist/state-FkYREAs-.js.map +0 -1
|
@@ -1905,7 +1905,7 @@ async function getRecceInstanceInfo(client = axiosClient) {
|
|
|
1905
1905
|
|
|
1906
1906
|
//#endregion
|
|
1907
1907
|
//#region recce-source/js/src/lib/hooks/ApiConfigContext.tsx
|
|
1908
|
-
const defaultConfig = {
|
|
1908
|
+
const defaultConfig$1 = {
|
|
1909
1909
|
apiPrefix: "",
|
|
1910
1910
|
authToken: void 0,
|
|
1911
1911
|
baseUrl: void 0
|
|
@@ -1938,7 +1938,7 @@ function createApiClient(config) {
|
|
|
1938
1938
|
});
|
|
1939
1939
|
return client;
|
|
1940
1940
|
}
|
|
1941
|
-
function ApiConfigProvider({ children, apiPrefix = defaultConfig.apiPrefix, authToken = defaultConfig.authToken, baseUrl = defaultConfig.baseUrl }) {
|
|
1941
|
+
function ApiConfigProvider({ children, apiPrefix = defaultConfig$1.apiPrefix, authToken = defaultConfig$1.authToken, baseUrl = defaultConfig$1.baseUrl }) {
|
|
1942
1942
|
const config = (0, react.useMemo)(() => ({
|
|
1943
1943
|
apiPrefix,
|
|
1944
1944
|
authToken,
|
|
@@ -5542,21 +5542,76 @@ const RunModal = ({ isOpen, onClose, onExecute, type, title, params: defaultPara
|
|
|
5542
5542
|
};
|
|
5543
5543
|
|
|
5544
5544
|
//#endregion
|
|
5545
|
-
//#region
|
|
5545
|
+
//#region src/lib/hooks/RouteConfigContext.ts
|
|
5546
|
+
const defaultConfig = { basePath: "" };
|
|
5547
|
+
const RouteConfigContext = (0, react.createContext)(null);
|
|
5546
5548
|
/**
|
|
5547
|
-
*
|
|
5549
|
+
* Provider for route configuration.
|
|
5548
5550
|
*
|
|
5549
|
-
*
|
|
5550
|
-
*
|
|
5551
|
-
* and useSearchParams into a unified interface.
|
|
5551
|
+
* Wrap your application (or RecceContextProvider) with this provider
|
|
5552
|
+
* to configure path prefixes for navigation.
|
|
5552
5553
|
*
|
|
5553
|
-
*
|
|
5554
|
-
*
|
|
5555
|
-
*
|
|
5556
|
-
*
|
|
5554
|
+
* @example
|
|
5555
|
+
* // In recce-cloud
|
|
5556
|
+
* <RouteConfigProvider basePath={`/oss/${sessionId}`}>
|
|
5557
|
+
* <RecceContextProvider>
|
|
5558
|
+
* {children}
|
|
5559
|
+
* </RecceContextProvider>
|
|
5560
|
+
* </RouteConfigProvider>
|
|
5561
|
+
*/
|
|
5562
|
+
function RouteConfigProvider({ children, basePath = defaultConfig.basePath }) {
|
|
5563
|
+
const resolvePath = (0, react.useCallback)((path$2) => {
|
|
5564
|
+
if (!basePath) return path$2;
|
|
5565
|
+
if (path$2.startsWith(basePath)) return path$2;
|
|
5566
|
+
if (path$2.match(/^https?:\/\//)) return path$2;
|
|
5567
|
+
if (path$2.startsWith("#")) return path$2;
|
|
5568
|
+
return `${basePath.endsWith("/") ? basePath.slice(0, -1) : basePath}${path$2.startsWith("/") ? path$2 : `/${path$2}`}`;
|
|
5569
|
+
}, [basePath]);
|
|
5570
|
+
const contextValue = (0, react.useMemo)(() => ({
|
|
5571
|
+
basePath,
|
|
5572
|
+
resolvePath
|
|
5573
|
+
}), [basePath, resolvePath]);
|
|
5574
|
+
return react.default.createElement(RouteConfigContext.Provider, { value: contextValue }, children);
|
|
5575
|
+
}
|
|
5576
|
+
const defaultRouteConfigContext = {
|
|
5577
|
+
basePath: "",
|
|
5578
|
+
resolvePath: (path$2) => path$2
|
|
5579
|
+
};
|
|
5580
|
+
/**
|
|
5581
|
+
* Hook to access route configuration.
|
|
5582
|
+
*
|
|
5583
|
+
* When used outside RouteConfigProvider, returns default config
|
|
5584
|
+
* (for OSS backward compatibility).
|
|
5585
|
+
*
|
|
5586
|
+
* @returns RouteConfigContextType with basePath and resolvePath function
|
|
5587
|
+
*/
|
|
5588
|
+
function useRouteConfig() {
|
|
5589
|
+
return (0, react.useContext)(RouteConfigContext) ?? defaultRouteConfigContext;
|
|
5590
|
+
}
|
|
5591
|
+
/**
|
|
5592
|
+
* Safe hook that returns null if context not available.
|
|
5593
|
+
* Useful for components that need to detect if RouteConfigProvider is present.
|
|
5594
|
+
*/
|
|
5595
|
+
function useRouteConfigSafe() {
|
|
5596
|
+
return (0, react.useContext)(RouteConfigContext);
|
|
5597
|
+
}
|
|
5598
|
+
|
|
5599
|
+
//#endregion
|
|
5600
|
+
//#region src/lib/hooks/useAppRouter.ts
|
|
5601
|
+
/**
|
|
5602
|
+
* useAppRouter - Navigation utilities for Next.js App Router with RouteConfig support
|
|
5603
|
+
*
|
|
5604
|
+
* This is a custom version that wraps the OSS useAppRouter to add
|
|
5605
|
+
* RouteConfigContext support for path prefixing in recce-cloud.
|
|
5606
|
+
*
|
|
5607
|
+
* The key difference from OSS:
|
|
5608
|
+
* - setLocation() automatically prefixes paths with the configured basePath
|
|
5609
|
+
* - This allows OSS components to use setLocation("/query") while
|
|
5610
|
+
* recce-cloud can configure basePath="/oss/abc123" to get "/oss/abc123/query"
|
|
5557
5611
|
*/
|
|
5558
5612
|
/**
|
|
5559
5613
|
* Hook that provides Wouter-compatible location API using Next.js App Router
|
|
5614
|
+
* with RouteConfigContext support for path prefixing.
|
|
5560
5615
|
*
|
|
5561
5616
|
* NOTE: This returns only the pathname (not search params) to avoid
|
|
5562
5617
|
* triggering Suspense boundaries on every navigation.
|
|
@@ -5565,15 +5620,123 @@ const RunModal = ({ isOpen, onClose, onExecute, type, title, params: defaultPara
|
|
|
5565
5620
|
*
|
|
5566
5621
|
* @example
|
|
5567
5622
|
* const [location, setLocation] = useAppLocation();
|
|
5568
|
-
* setLocation("/checks?id=123"); //
|
|
5569
|
-
*
|
|
5623
|
+
* setLocation("/checks?id=123"); // In cloud mode with basePath="/oss/abc123"
|
|
5624
|
+
* // navigates to "/oss/abc123/checks?id=123"
|
|
5570
5625
|
*/
|
|
5571
5626
|
function useAppLocation() {
|
|
5572
5627
|
const router = (0, next_navigation.useRouter)();
|
|
5573
|
-
|
|
5574
|
-
|
|
5575
|
-
|
|
5576
|
-
|
|
5628
|
+
const pathname = (0, next_navigation.usePathname)();
|
|
5629
|
+
const { resolvePath } = useRouteConfig();
|
|
5630
|
+
return [pathname, (0, react.useCallback)((to, options) => {
|
|
5631
|
+
const [pathPart, queryPart] = to.split("?");
|
|
5632
|
+
const resolvedPath = resolvePath(pathPart);
|
|
5633
|
+
const fullPath = queryPart ? `${resolvedPath}?${queryPart}` : resolvedPath;
|
|
5634
|
+
if (options?.replace) router.replace(fullPath, { scroll: options?.scroll ?? true });
|
|
5635
|
+
else router.push(fullPath, { scroll: options?.scroll ?? true });
|
|
5636
|
+
}, [router, resolvePath])];
|
|
5637
|
+
}
|
|
5638
|
+
/**
|
|
5639
|
+
* Hook that includes search params in the location string.
|
|
5640
|
+
* Also supports RouteConfigContext path prefixing.
|
|
5641
|
+
*
|
|
5642
|
+
* WARNING: This hook uses useSearchParams() which triggers Suspense.
|
|
5643
|
+
* Only use this in components that are wrapped in a <Suspense> boundary,
|
|
5644
|
+
* or in leaf components where suspension is acceptable.
|
|
5645
|
+
*
|
|
5646
|
+
* @returns [fullLocation, setLocation] tuple with search params included
|
|
5647
|
+
*/
|
|
5648
|
+
function useAppLocationWithSearch() {
|
|
5649
|
+
const router = (0, next_navigation.useRouter)();
|
|
5650
|
+
const pathname = (0, next_navigation.usePathname)();
|
|
5651
|
+
const searchParams = (0, next_navigation.useSearchParams)();
|
|
5652
|
+
const { resolvePath } = useRouteConfig();
|
|
5653
|
+
return [(0, react.useMemo)(() => {
|
|
5654
|
+
const search = searchParams?.toString();
|
|
5655
|
+
return search ? `${pathname}?${search}` : pathname;
|
|
5656
|
+
}, [pathname, searchParams]), (0, react.useCallback)((to, options) => {
|
|
5657
|
+
const [pathPart, queryPart] = to.split("?");
|
|
5658
|
+
const resolvedPath = resolvePath(pathPart);
|
|
5659
|
+
const fullPath = queryPart ? `${resolvedPath}?${queryPart}` : resolvedPath;
|
|
5660
|
+
if (options?.replace) router.replace(fullPath, { scroll: options?.scroll ?? true });
|
|
5661
|
+
else router.push(fullPath, { scroll: options?.scroll ?? true });
|
|
5662
|
+
}, [router, resolvePath])];
|
|
5663
|
+
}
|
|
5664
|
+
/**
|
|
5665
|
+
* Hook to check if current path matches a pattern
|
|
5666
|
+
* Similar to Wouter's useRoute
|
|
5667
|
+
*
|
|
5668
|
+
* @param pattern - The route pattern to match (e.g., "/checks/:checkId")
|
|
5669
|
+
* @returns [isMatch, params] tuple
|
|
5670
|
+
*
|
|
5671
|
+
* @example
|
|
5672
|
+
* const [isMatch, params] = useAppRoute("/checks/:checkId");
|
|
5673
|
+
* if (isMatch) {
|
|
5674
|
+
* console.log(params.checkId); // "abc-123"
|
|
5675
|
+
* }
|
|
5676
|
+
*/
|
|
5677
|
+
function useAppRoute(pattern) {
|
|
5678
|
+
const pathname = (0, next_navigation.usePathname)();
|
|
5679
|
+
const params = (0, next_navigation.useParams)();
|
|
5680
|
+
return [(0, react.useMemo)(() => {
|
|
5681
|
+
const regexPattern = pattern.replace(/:\w+/g, "([^/]+)").replace(/\*/g, ".*");
|
|
5682
|
+
return (/* @__PURE__ */ new RegExp(`^${regexPattern}$`)).test(pathname);
|
|
5683
|
+
}, [pattern, pathname]), (0, react.useMemo)(() => {
|
|
5684
|
+
if (!params) return {};
|
|
5685
|
+
return Object.fromEntries(Object.entries(params).map(([key, value]) => [key, Array.isArray(value) ? value.join("/") : value]));
|
|
5686
|
+
}, [params])];
|
|
5687
|
+
}
|
|
5688
|
+
/**
|
|
5689
|
+
* Imperative navigation function for use outside React components
|
|
5690
|
+
* Use sparingly - prefer useAppLocation hook in components
|
|
5691
|
+
*
|
|
5692
|
+
* NOTE: This function does NOT support RouteConfigContext because
|
|
5693
|
+
* it's used outside of React component tree. If you need path prefixing,
|
|
5694
|
+
* use useAppLocation hook instead.
|
|
5695
|
+
*
|
|
5696
|
+
* @example
|
|
5697
|
+
* // In an event handler or utility function
|
|
5698
|
+
* import { navigateTo } from "@/lib/hooks/useAppRouter";
|
|
5699
|
+
* navigateTo("/checks?id=123");
|
|
5700
|
+
*/
|
|
5701
|
+
function navigateTo(path$2, replace = false) {
|
|
5702
|
+
if (typeof window !== "undefined") {
|
|
5703
|
+
if (replace) window.history.replaceState(null, "", path$2);
|
|
5704
|
+
else window.history.pushState(null, "", path$2);
|
|
5705
|
+
window.dispatchEvent(new PopStateEvent("popstate"));
|
|
5706
|
+
}
|
|
5707
|
+
}
|
|
5708
|
+
/**
|
|
5709
|
+
* Hook for programmatic navigation with more options
|
|
5710
|
+
* Provides direct access to Next.js router methods with RouteConfigContext support
|
|
5711
|
+
*
|
|
5712
|
+
* NOTE: Does not include searchParams to avoid Suspense.
|
|
5713
|
+
* Use useSearchParams() directly in components that need it.
|
|
5714
|
+
*/
|
|
5715
|
+
function useAppNavigation() {
|
|
5716
|
+
const router = (0, next_navigation.useRouter)();
|
|
5717
|
+
const pathname = (0, next_navigation.usePathname)();
|
|
5718
|
+
const params = (0, next_navigation.useParams)();
|
|
5719
|
+
const { resolvePath } = useRouteConfig();
|
|
5720
|
+
return {
|
|
5721
|
+
pathname,
|
|
5722
|
+
params,
|
|
5723
|
+
push: (0, react.useCallback)((href, options) => {
|
|
5724
|
+
const [pathPart, queryPart] = href.split("?");
|
|
5725
|
+
const resolvedPath = resolvePath(pathPart);
|
|
5726
|
+
const fullPath = queryPart ? `${resolvedPath}?${queryPart}` : resolvedPath;
|
|
5727
|
+
router.push(fullPath, options);
|
|
5728
|
+
}, [router, resolvePath]),
|
|
5729
|
+
replace: (0, react.useCallback)((href, options) => {
|
|
5730
|
+
const [pathPart, queryPart] = href.split("?");
|
|
5731
|
+
const resolvedPath = resolvePath(pathPart);
|
|
5732
|
+
const fullPath = queryPart ? `${resolvedPath}?${queryPart}` : resolvedPath;
|
|
5733
|
+
router.replace(fullPath, options);
|
|
5734
|
+
}, [router, resolvePath]),
|
|
5735
|
+
back: router.back,
|
|
5736
|
+
forward: router.forward,
|
|
5737
|
+
refresh: router.refresh,
|
|
5738
|
+
prefetch: router.prefetch
|
|
5739
|
+
};
|
|
5577
5740
|
}
|
|
5578
5741
|
|
|
5579
5742
|
//#endregion
|
|
@@ -8457,6 +8620,12 @@ Object.defineProperty(exports, 'RecceInstanceInfoProvider', {
|
|
|
8457
8620
|
return RecceInstanceInfoProvider;
|
|
8458
8621
|
}
|
|
8459
8622
|
});
|
|
8623
|
+
Object.defineProperty(exports, 'RouteConfigProvider', {
|
|
8624
|
+
enumerable: true,
|
|
8625
|
+
get: function () {
|
|
8626
|
+
return RouteConfigProvider;
|
|
8627
|
+
}
|
|
8628
|
+
});
|
|
8460
8629
|
Object.defineProperty(exports, 'RowCountDiffResultView', {
|
|
8461
8630
|
enumerable: true,
|
|
8462
8631
|
get: function () {
|
|
@@ -8841,6 +9010,12 @@ Object.defineProperty(exports, 'mergeKeysWithStatus', {
|
|
|
8841
9010
|
return mergeKeysWithStatus;
|
|
8842
9011
|
}
|
|
8843
9012
|
});
|
|
9013
|
+
Object.defineProperty(exports, 'navigateTo', {
|
|
9014
|
+
enumerable: true,
|
|
9015
|
+
get: function () {
|
|
9016
|
+
return navigateTo;
|
|
9017
|
+
}
|
|
9018
|
+
});
|
|
8844
9019
|
Object.defineProperty(exports, 'queryModelRowCount', {
|
|
8845
9020
|
enumerable: true,
|
|
8846
9021
|
get: function () {
|
|
@@ -9117,6 +9292,24 @@ Object.defineProperty(exports, 'useAppLocation', {
|
|
|
9117
9292
|
return useAppLocation;
|
|
9118
9293
|
}
|
|
9119
9294
|
});
|
|
9295
|
+
Object.defineProperty(exports, 'useAppLocationWithSearch', {
|
|
9296
|
+
enumerable: true,
|
|
9297
|
+
get: function () {
|
|
9298
|
+
return useAppLocationWithSearch;
|
|
9299
|
+
}
|
|
9300
|
+
});
|
|
9301
|
+
Object.defineProperty(exports, 'useAppNavigation', {
|
|
9302
|
+
enumerable: true,
|
|
9303
|
+
get: function () {
|
|
9304
|
+
return useAppNavigation;
|
|
9305
|
+
}
|
|
9306
|
+
});
|
|
9307
|
+
Object.defineProperty(exports, 'useAppRoute', {
|
|
9308
|
+
enumerable: true,
|
|
9309
|
+
get: function () {
|
|
9310
|
+
return useAppRoute;
|
|
9311
|
+
}
|
|
9312
|
+
});
|
|
9120
9313
|
Object.defineProperty(exports, 'useChecks', {
|
|
9121
9314
|
enumerable: true,
|
|
9122
9315
|
get: function () {
|
|
@@ -9183,6 +9376,18 @@ Object.defineProperty(exports, 'useRecceServerFlag', {
|
|
|
9183
9376
|
return useRecceServerFlag;
|
|
9184
9377
|
}
|
|
9185
9378
|
});
|
|
9379
|
+
Object.defineProperty(exports, 'useRouteConfig', {
|
|
9380
|
+
enumerable: true,
|
|
9381
|
+
get: function () {
|
|
9382
|
+
return useRouteConfig;
|
|
9383
|
+
}
|
|
9384
|
+
});
|
|
9385
|
+
Object.defineProperty(exports, 'useRouteConfigSafe', {
|
|
9386
|
+
enumerable: true,
|
|
9387
|
+
get: function () {
|
|
9388
|
+
return useRouteConfigSafe;
|
|
9389
|
+
}
|
|
9390
|
+
});
|
|
9186
9391
|
Object.defineProperty(exports, 'useRunsAggregated', {
|
|
9187
9392
|
enumerable: true,
|
|
9188
9393
|
get: function () {
|
|
@@ -9201,4 +9406,4 @@ Object.defineProperty(exports, 'waitRun', {
|
|
|
9201
9406
|
return waitRun;
|
|
9202
9407
|
}
|
|
9203
9408
|
});
|
|
9204
|
-
//# sourceMappingURL=state-
|
|
9409
|
+
//# sourceMappingURL=state-CemiRRon.js.map
|