@donotdev/ui 0.0.18 → 0.0.20
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/components/auth/AuthMenu.d.ts.map +1 -1
- package/dist/components/auth/AuthMenu.js +8 -3
- package/dist/crud/components/EntityDisplayRenderer.d.ts.map +1 -1
- package/dist/crud/components/EntityDisplayRenderer.js +4 -1
- package/dist/crud/components/EntityFormRenderer.d.ts.map +1 -1
- package/dist/crud/components/EntityFormRenderer.js +2 -1
- package/dist/crud/components/EntityList.d.ts.map +1 -1
- package/dist/crud/components/EntityList.js +7 -4
- package/dist/crud/components/EntityWorkflow.d.ts.map +1 -1
- package/dist/crud/components/EntityWorkflow.js +4 -1
- package/dist/dndev.css +559 -120
- package/dist/index.js +4 -4
- package/dist/internal/common/RouteErrorFallback.js +1 -1
- package/dist/internal/devtools/DebugTools.d.ts.map +1 -1
- package/dist/internal/devtools/DebugTools.js +7 -2
- package/dist/internal/initializers/NextJsStoresInitializer.d.ts.map +1 -1
- package/dist/internal/initializers/NextJsStoresInitializer.js +8 -1
- package/dist/internal/layout/DnDevLayout.d.ts.map +1 -1
- package/dist/internal/layout/DnDevLayout.js +4 -2
- package/dist/providers/NextJsAppProviders.d.ts.map +1 -1
- package/dist/providers/NextJsAppProviders.js +14 -11
- package/dist/routing/DnDevNavigationMenu.d.ts.map +1 -1
- package/dist/routing/DnDevNavigationMenu.js +3 -2
- package/dist/routing/GoToWrapper.d.ts.map +1 -1
- package/dist/routing/GoToWrapper.js +7 -0
- package/dist/routing/Link.d.ts.map +1 -1
- package/dist/routing/Link.js +2 -1
- package/dist/routing/hooks/hooks.next.js +1 -1
- package/dist/routing/hooks/useLocation.next.d.ts +1 -1
- package/dist/routing/hooks/useLocation.next.d.ts.map +1 -1
- package/dist/routing/hooks/useLocation.next.js +2 -1
- package/dist/routing/hooks/useParams.next.d.ts.map +1 -1
- package/dist/routing/hooks/useParams.next.js +4 -1
- package/dist/routing/hooks/useRedirectGuard.next.js +3 -3
- package/dist/styles/index.css +559 -120
- package/dist/utils/assetResolver.d.ts +6 -0
- package/dist/utils/assetResolver.d.ts.map +1 -1
- package/dist/utils/assetResolver.js +9 -3
- package/dist/utils/sanitizeSvg.js +1 -1
- package/dist/vite-routing/AppRoutes.d.ts.map +1 -1
- package/dist/vite-routing/AppRoutes.js +11 -2
- package/dist/vite-routing/RootLayout.d.ts.map +1 -1
- package/dist/vite-routing/RootLayout.js +5 -4
- package/package.json +10 -10
|
@@ -112,7 +112,7 @@ export const RouteErrorFallback = ({ error, resetError, componentStack, eventId,
|
|
|
112
112
|
fontSize: 'var(--font-size-lg)',
|
|
113
113
|
color: 'var(--muted-foreground)',
|
|
114
114
|
margin: 0,
|
|
115
|
-
}, children: t('routeError.description', 'We encountered an error while loading this page.') }), _jsx(Alert, { variant: ALERT_VARIANT.
|
|
115
|
+
}, children: t('routeError.description', 'We encountered an error while loading this page.') }), _jsx(Alert, { variant: ALERT_VARIANT.INFO, hideIcon: true, children: _jsx("div", { style: { fontSize: 'var(--font-size-sm)', textAlign: 'center' }, children: t('routeError.dataSafe', "Don't worry, your data is safe.") }) })] }), eventId && (_jsxs("code", { style: {
|
|
116
116
|
padding: 'var(--gap-sm) var(--gap-md)',
|
|
117
117
|
background: 'var(--muted)',
|
|
118
118
|
borderRadius: 'var(--radius-full)',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DebugTools.d.ts","sourceRoot":"","sources":["../../../src/internal/devtools/DebugTools.tsx"],"names":[],"mappings":"AAgCA,UAAU,eAAe;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,QAAA,MAAM,UAAU,GAAI,eAAe,eAAe,
|
|
1
|
+
{"version":3,"file":"DebugTools.d.ts","sourceRoot":"","sources":["../../../src/internal/devtools/DebugTools.tsx"],"names":[],"mappings":"AAgCA,UAAU,eAAe;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,QAAA,MAAM,UAAU,GAAI,eAAe,eAAe,4CAmOjD,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -97,8 +97,13 @@ const DebugTools = ({ className }) => {
|
|
|
97
97
|
await Promise.all(keys.map((key) => caches.delete(key)));
|
|
98
98
|
}
|
|
99
99
|
if ('indexedDB' in window && 'databases' in indexedDB) {
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
try {
|
|
101
|
+
const databases = await indexedDB.databases();
|
|
102
|
+
await Promise.all(databases.map((db) => db.name && indexedDB.deleteDatabase(db.name)));
|
|
103
|
+
}
|
|
104
|
+
catch (dbError) {
|
|
105
|
+
console.error('Failed to clear IndexedDB:', dbError);
|
|
106
|
+
}
|
|
102
107
|
}
|
|
103
108
|
// Clear store registry (DEV mode: HMR preserves globalThis, prevents re-init)
|
|
104
109
|
if (typeof globalThis !== 'undefined' &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NextJsStoresInitializer.d.ts","sourceRoot":"","sources":["../../../src/internal/initializers/NextJsStoresInitializer.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAOxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,UAAU,4BAA4B;IACpC,QAAQ,EAAE,SAAS,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,iBAAiB,EAAE,CAAC;IACnC,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAQD;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,QAAQ,EACR,aAAa,EACb,YAAY,EACZ,aAAa,GACd,EAAE,4BAA4B,
|
|
1
|
+
{"version":3,"file":"NextJsStoresInitializer.d.ts","sourceRoot":"","sources":["../../../src/internal/initializers/NextJsStoresInitializer.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAOxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,UAAU,4BAA4B;IACpC,QAAQ,EAAE,SAAS,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,iBAAiB,EAAE,CAAC;IACnC,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAQD;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,QAAQ,EACR,aAAa,EACb,YAAY,EACZ,aAAa,GACd,EAAE,4BAA4B,kDAiE9B"}
|
|
@@ -54,7 +54,14 @@ export function NextJsStoresInitializer({ children, serverCookies, customStores,
|
|
|
54
54
|
try {
|
|
55
55
|
const cookieValue = themeCookie.split('=')[1]?.trim();
|
|
56
56
|
if (cookieValue) {
|
|
57
|
-
|
|
57
|
+
let theme;
|
|
58
|
+
try {
|
|
59
|
+
theme = decodeURIComponent(cookieValue);
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
// Malformed URI encoding in cookie value — skip hydration
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
58
65
|
// Validate theme exists in available themes (build-time config is available synchronously)
|
|
59
66
|
if (themeData.some((t) => t.name === theme)) {
|
|
60
67
|
useThemeStore.setState({ currentTheme: theme });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DnDevLayout.d.ts","sourceRoot":"","sources":["../../../src/internal/layout/DnDevLayout.tsx"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AAEH,OAAO,EAQL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAIV,YAAY,EACb,MAAM,gBAAgB,CAAC;AA0CxB,UAAU,yBAAyB;IACjC,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,WAAW,GAAI,kCAIzB,yBAAyB,
|
|
1
|
+
{"version":3,"file":"DnDevLayout.d.ts","sourceRoot":"","sources":["../../../src/internal/layout/DnDevLayout.tsx"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AAEH,OAAO,EAQL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAIV,YAAY,EACb,MAAM,gBAAgB,CAAC;AA0CxB,UAAU,yBAAyB;IACjC,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,WAAW,GAAI,kCAIzB,yBAAyB,4CA4T3B,CAAC"}
|
|
@@ -64,12 +64,14 @@ export const DnDevLayout = ({ children, layout, className, }) => {
|
|
|
64
64
|
const preset = useLayout('layoutPreset');
|
|
65
65
|
const routePresetOverride = useLayout('routePresetOverride');
|
|
66
66
|
const isMobile = useBreakpoint('isMobileOrTablet');
|
|
67
|
-
const app = useAppConfig(
|
|
67
|
+
const { app, features } = useAppConfig();
|
|
68
|
+
const debugEnabled = isDev() && features?.debug === true;
|
|
68
69
|
// Subscribe to language changes for zone re-renders
|
|
69
70
|
useTranslation('dndev');
|
|
70
71
|
// Layout config props
|
|
71
72
|
const breadcrumbs = layout?.breadcrumbs ?? 'smart';
|
|
72
73
|
const footerMode = layout?.footerMode;
|
|
74
|
+
const footerInline = footerMode === 'scroll' || isMobile;
|
|
73
75
|
// Route detection for animations
|
|
74
76
|
const location = useLocation();
|
|
75
77
|
const pathname = location.pathname;
|
|
@@ -248,5 +250,5 @@ export const DnDevLayout = ({ children, layout, className, }) => {
|
|
|
248
250
|
};
|
|
249
251
|
startTransition(updateDOM);
|
|
250
252
|
}, [effectivePreset]);
|
|
251
|
-
return (_jsxs("div", { className: cn('dndev-layout', className), "data-footer-
|
|
253
|
+
return (_jsxs("div", { className: cn('dndev-layout', className), "data-footer-inline": footerInline || undefined, children: [resolvedHeader, resolvedSidebar, _jsxs("main", { ref: mainRef, role: "main", className: "main", children: [breadcrumbs !== 'never' && (_jsx("div", { className: "breadcrumbs-container", children: _jsx(Breadcrumbs, { variant: breadcrumbs === 'always' ? 'default' : 'smart' }) })), debugEnabled && (_jsx(Suspense, { fallback: null, children: _jsx(DebugTools, {}) })), layout?.wrapper ? layout.wrapper({ children: content }) : content, footerInline && resolvedFooter] }), !footerInline && resolvedFooter, resolvedMergedBar, _jsx(GoToWrapper, {})] }));
|
|
252
254
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NextJsAppProviders.d.ts","sourceRoot":"","sources":["../../src/providers/NextJsAppProviders.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"NextJsAppProviders.d.ts","sourceRoot":"","sources":["../../src/providers/NextJsAppProviders.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AA6DxD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,WAAW,uBAAwB,SAAQ,iBAAiB;IAChE,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,2CAiDhE"}
|
|
@@ -20,17 +20,20 @@ import PerformanceHints from '../internal/layout/components/PerformanceHints';
|
|
|
20
20
|
import { DnDevLayout } from '../internal/layout/DnDevLayout';
|
|
21
21
|
import { SentryInitializer } from '../internal/providers/SentryInitializer';
|
|
22
22
|
import { UIProviders } from '../internal/providers/UIProviders';
|
|
23
|
-
//
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
})));
|
|
28
|
-
const
|
|
29
|
-
default: m.
|
|
30
|
-
})));
|
|
31
|
-
const
|
|
32
|
-
default: m.
|
|
33
|
-
})));
|
|
23
|
+
// Null fallback for lazy components that fail to load (e.g., optional auth dependency absent)
|
|
24
|
+
const NullFallback = () => null;
|
|
25
|
+
// Lazy load client-only components — each wrapped with catch to prevent hanging
|
|
26
|
+
// if an optional dependency (e.g., @donotdev/auth) is not installed.
|
|
27
|
+
const CookieConsent = lazy(() => import('../components/cookie-consent/CookieConsent').catch(() => ({ default: NullFallback })));
|
|
28
|
+
const PWAUpdateNotification = lazy(() => import('../internal/layout/components/PWAUpdateNotification')
|
|
29
|
+
.then((m) => ({ default: m.default }))
|
|
30
|
+
.catch(() => ({ default: NullFallback })));
|
|
31
|
+
const LicenseWatermark = lazy(() => import('../components/license/LicenseWatermark')
|
|
32
|
+
.then((m) => ({ default: m.LicenseWatermark }))
|
|
33
|
+
.catch(() => ({ default: NullFallback })));
|
|
34
|
+
const RedirectOverlay = lazy(() => import('../components/common/RedirectOverlay')
|
|
35
|
+
.then((m) => ({ default: m.RedirectOverlay }))
|
|
36
|
+
.catch(() => ({ default: NullFallback })));
|
|
34
37
|
/**
|
|
35
38
|
* ConsentBanner - Lazy loaded consent component
|
|
36
39
|
* Only shows if user hasn't consented yet
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DnDevNavigationMenu.d.ts","sourceRoot":"","sources":["../../src/routing/DnDevNavigationMenu.tsx"],"names":[],"mappings":"AAoBA,OAAO,EAKL,KAAK,aAAa,EACnB,MAAM,OAAO,CAAC;AAEf,OAAO,EAOL,OAAO,EACR,MAAM,sBAAsB,CAAC;AAW9B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD,MAAM,WAAW,wBAAwB;IACvC,kEAAkE;IAClE,MAAM,CAAC,EAAE,cAAc,EAAE,CAAC;IAC1B,mEAAmE;IACnE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,+EAA+E;IAC/E,OAAO,CAAC,EAAE,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,OAAO,OAAO,CAAC,CAAC;IACjD,mEAAmE;IACnE,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,4BAA4B;IAC5B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oBAAoB;IACpB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,mBAAmB,EAAE,aAAa,CAAC,wBAAwB,
|
|
1
|
+
{"version":3,"file":"DnDevNavigationMenu.d.ts","sourceRoot":"","sources":["../../src/routing/DnDevNavigationMenu.tsx"],"names":[],"mappings":"AAoBA,OAAO,EAKL,KAAK,aAAa,EACnB,MAAM,OAAO,CAAC;AAEf,OAAO,EAOL,OAAO,EACR,MAAM,sBAAsB,CAAC;AAW9B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD,MAAM,WAAW,wBAAwB;IACvC,kEAAkE;IAClE,MAAM,CAAC,EAAE,cAAc,EAAE,CAAC;IAC1B,mEAAmE;IACnE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,+EAA+E;IAC/E,OAAO,CAAC,EAAE,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,OAAO,OAAO,CAAC,CAAC;IACjD,mEAAmE;IACnE,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,4BAA4B;IAC5B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oBAAoB;IACpB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,mBAAmB,EAAE,aAAa,CAAC,wBAAwB,CA8KvE,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -114,8 +114,9 @@ export const DnDevNavigationMenu = ({ routes, vertical = false, display = DISPLA
|
|
|
114
114
|
return null;
|
|
115
115
|
}
|
|
116
116
|
if (overflowDetection && !vertical) {
|
|
117
|
-
const
|
|
118
|
-
const
|
|
117
|
+
const boundedVisibleCount = Math.min(visibleCount, items.length);
|
|
118
|
+
const visibleItems = items.slice(0, boundedVisibleCount);
|
|
119
|
+
const overflowItems = items.slice(boundedVisibleCount);
|
|
119
120
|
return (_jsx(NavigationMenu, { className: cn(className), style: style || { flex: 1 }, children: _jsxs(NavigationMenuListPrimitive, { ref: containerRef, "data-vertical": "false", style: {
|
|
120
121
|
display: 'flex',
|
|
121
122
|
alignItems: 'center',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GoToWrapper.d.ts","sourceRoot":"","sources":["../../src/routing/GoToWrapper.tsx"],"names":[],"mappings":"AAuBA;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,WAAW,+
|
|
1
|
+
{"version":3,"file":"GoToWrapper.d.ts","sourceRoot":"","sources":["../../src/routing/GoToWrapper.tsx"],"names":[],"mappings":"AAuBA;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,WAAW,+CAmChB,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -34,6 +34,13 @@ const GoToWrapper = () => {
|
|
|
34
34
|
// Cmd+K keyboard shortcut
|
|
35
35
|
useEventListener('keydown', (event) => {
|
|
36
36
|
if ((event.metaKey || event.ctrlKey) && event.key === 'k') {
|
|
37
|
+
// Don't intercept Cmd+K in form fields where it may have native meaning
|
|
38
|
+
const target = event.target;
|
|
39
|
+
if (target.tagName === 'INPUT' ||
|
|
40
|
+
target.tagName === 'TEXTAREA' ||
|
|
41
|
+
target.isContentEditable) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
37
44
|
event.preventDefault();
|
|
38
45
|
openCommandDialog();
|
|
39
46
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../src/routing/Link.tsx"],"names":[],"mappings":"AAaA,OAAO,EACL,KAAK,SAAS,EACd,KAAK,aAAa,EAElB,KAAK,oBAAoB,EAC1B,MAAM,OAAO,CAAC;AASf;;;;;;GAMG;AACH,MAAM,WAAW,SAAU,SAAQ,oBAAoB,CAAC,iBAAiB,CAAC;IACxE,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,oCAAoC;IACpC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,gDAAgD;IAChD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;GAMG;AACH,eAAO,MAAM,IAAI,EAAE,aAAa,CAAC,SAAS,
|
|
1
|
+
{"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../src/routing/Link.tsx"],"names":[],"mappings":"AAaA,OAAO,EACL,KAAK,SAAS,EACd,KAAK,aAAa,EAElB,KAAK,oBAAoB,EAC1B,MAAM,OAAO,CAAC;AASf;;;;;;GAMG;AACH,MAAM,WAAW,SAAU,SAAQ,oBAAoB,CAAC,iBAAiB,CAAC;IACxE,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,oCAAoC;IACpC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,gDAAgD;IAChD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;GAMG;AACH,eAAO,MAAM,IAAI,EAAE,aAAa,CAAC,SAAS,CAyIzC,CAAC"}
|
package/dist/routing/Link.js
CHANGED
|
@@ -67,7 +67,8 @@ export const Link = ({ path, replace, prefetch = true, children, icon, label, on
|
|
|
67
67
|
onClick(e);
|
|
68
68
|
}
|
|
69
69
|
// Ensure path is absolute (starts with /) to prevent relative navigation issues
|
|
70
|
-
|
|
70
|
+
// but preserve intentional relative paths (starting with '.' or '..')
|
|
71
|
+
const absolutePath = path.startsWith('/') || path.startsWith('.') ? path : `/${path}`;
|
|
71
72
|
navigate(absolutePath, { replace });
|
|
72
73
|
};
|
|
73
74
|
const accessibilityProps = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useRouter as f}from"next/navigation";import{useCallback as h}from"react";import{isClient as S,useOverlayStore as y}from"@donotdev/core";function d(){let e=f(),
|
|
1
|
+
"use client";import{useRouter as f}from"next/navigation";import{useCallback as h}from"react";import{isClient as S,useOverlayStore as y}from"@donotdev/core";function d(){let e=f(),r=y(t=>t.closeAll);return h((t,s)=>{if(t==="back")return r(),e.back();if(r(),s?.preserveScroll&&S()){let o=window.scrollY;s?.replace?e.replace(t):e.push(t),requestAnimationFrame(()=>{window.scrollTo({top:o,behavior:"auto"})});return}return s?.replace?e.replace(t):e.push(t)},[e,r])}function k(){let e=f();return h(()=>e.back(),[e])}function T(){let e=f();return h(()=>e.refresh(),[e])}function v(){let e=f();return h(r=>e.prefetch(r),[e])}import{usePathname as b,useSearchParams as N}from"next/navigation";function m(){let e=b(),t=N().toString(),s=t?`?${t}`:void 0;return{pathname:e||"/",search:s,hash:"",state:null}}import{useParams as w}from"next/navigation";function g(){let e=w();return e||{}}function C(e){let t=g()[e];if(typeof t=="string")return t;if(Array.isArray(t)&&t.length>0)return t[0]}import{useSearchParams as I}from"next/navigation";function R(){return I()}import{usePathname as G}from"next/navigation";function $(e){let r=G(),t=e.replace(/:[^/]+/g,"([^/]+)").replace(/\*/g,".*"),s=new RegExp(`^${t}$`),o=r.match(s);if(!o)return null;let n=e.match(/:[^/]+/g)?.map(u=>u.slice(1))||[],a={};return n.forEach((u,c)=>{a[u]=o[c+1]||""}),{params:a,pathname:r,pattern:e}}import{useCallback as P}from"react";function K(){let e=R(),r=d(),t=m(),s=P((a,u)=>{let c=new URLSearchParams(e.toString());c.set(a,u);let l=c.toString(),x=`${t.pathname||"/"}${l?`?${l}`:""}`;r(x)},[e,r,t.pathname]),o=P(a=>{let u=new URLSearchParams(e.toString());u.delete(a);let c=u.toString(),i=`${t.pathname||"/"}${c?`?${c}`:""}`;r(i)},[e,r,t.pathname]),n=P(()=>{let a=t.pathname||"/";r(a)},[r,t.pathname]);return{query:e,setQuery:s,removeQuery:o,clearQueries:n}}import{useMemo as E}from"react";import{isClient as Q,FEATURE_STATUS as F}from"@donotdev/core";import{useAuthConfig as M}from"@donotdev/core";import*as O from"@donotdev/auth";import{DEGRADED_AUTH_API as U}from"@donotdev/core";var A=O?.useAuth;function L(e){return U[e]}function p(e){return A?A(e):L(e)}function j(e={}){let{auth:r,redirectTo:t,condition:s}=e,o=m(),n=M(),a=p("user"),u=p("can"),c=p("status");return E(()=>{if(!Q())return{shouldRedirect:!1,redirectTo:null,isChecking:!1};if(c===F.INITIALIZING)return{shouldRedirect:!1,redirectTo:null,isChecking:!0};if(s){let i=s(a,c);return{shouldRedirect:i,redirectTo:i&&t||null,isChecking:!1}}if(r!==!1&&r!==void 0){if(!u)return{shouldRedirect:!1,redirectTo:null,isChecking:!1};if(!u.navigate(r)){let i=null;return typeof r=="object"&&r.required&&!a?o.search?.includes("code=")||o.search?.includes("state=")||o.search?.includes("error=")?i=`${n.authRoute}${o.search}`:i=n.authRoute:typeof r=="object"&&r.role?i=n.roleRoute:typeof r=="object"&&r.tier?i=n.tierRoute:i=n.roleRoute,{shouldRedirect:!0,redirectTo:t||i,isChecking:!1}}}return{shouldRedirect:!1,redirectTo:null,isChecking:!1}},[r,c,a,u,s,t,o.search,n.authRoute,n.roleRoute,n.tierRoute])}export{k as useBack,m as useLocation,$ as useMatch,d as useNavigate,g as useParams,v as usePrefetch,K as useQueryParams,j as useRedirectGuard,T as useRefresh,C as useRouteParam,R as useSearchParams};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLocation.next.d.ts","sourceRoot":"","sources":["../../../src/routing/hooks/useLocation.next.ts"],"names":[],"mappings":"AAgBA,wBAAgB,WAAW;;;;;
|
|
1
|
+
{"version":3,"file":"useLocation.next.d.ts","sourceRoot":"","sources":["../../../src/routing/hooks/useLocation.next.ts"],"names":[],"mappings":"AAgBA,wBAAgB,WAAW;;;;;EAY1B"}
|
|
@@ -11,7 +11,8 @@ import { usePathname, useSearchParams as useNextSearchParams, } from 'next/navig
|
|
|
11
11
|
export function useLocation() {
|
|
12
12
|
const pathname = usePathname();
|
|
13
13
|
const searchParams = useNextSearchParams();
|
|
14
|
-
const
|
|
14
|
+
const searchString = searchParams.toString();
|
|
15
|
+
const search = searchString ? `?${searchString}` : undefined;
|
|
15
16
|
return {
|
|
16
17
|
pathname: pathname || '/',
|
|
17
18
|
search,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useParams.next.d.ts","sourceRoot":"","sources":["../../../src/routing/hooks/useParams.next.ts"],"names":[],"mappings":"AAKA,wBAAgB,SAAS,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,
|
|
1
|
+
{"version":3,"file":"useParams.next.d.ts","sourceRoot":"","sources":["../../../src/routing/hooks/useParams.next.ts"],"names":[],"mappings":"AAKA,wBAAgB,SAAS,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAIzE"}
|
|
@@ -72,9 +72,9 @@ export function useRedirectGuard(options = {}) {
|
|
|
72
72
|
// Authentication failure (not logged in)
|
|
73
73
|
if (typeof auth === 'object' && auth.required && !user) {
|
|
74
74
|
// Check if we have OAuth parameters that need to be preserved
|
|
75
|
-
const hasOAuthParams = location.search
|
|
76
|
-
location.search
|
|
77
|
-
location.search
|
|
75
|
+
const hasOAuthParams = location.search?.includes('code=') ||
|
|
76
|
+
location.search?.includes('state=') ||
|
|
77
|
+
location.search?.includes('error=');
|
|
78
78
|
if (hasOAuthParams) {
|
|
79
79
|
targetRoute = `${authConfig.authRoute}${location.search}`;
|
|
80
80
|
}
|