@donotdev/ui 0.0.6 → 0.0.8
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/assets/fonts/fonts.css +4 -4
- package/dist/components/auth/AuthHeader.d.ts +5 -0
- package/dist/components/auth/AuthHeader.d.ts.map +1 -1
- package/dist/components/auth/AuthHeader.js +22 -8
- package/dist/components/auth/AuthMenu.d.ts +6 -2
- package/dist/components/auth/AuthMenu.d.ts.map +1 -1
- package/dist/components/auth/AuthMenu.js +2 -2
- package/dist/components/common/RedirectOverlay.d.ts +37 -0
- package/dist/components/common/RedirectOverlay.d.ts.map +1 -0
- package/dist/components/common/RedirectOverlay.js +243 -0
- package/dist/components/common/index.d.ts +1 -0
- package/dist/components/common/index.d.ts.map +1 -1
- package/dist/components/common/index.js +1 -0
- package/dist/components/layout/components/header/SettingsMenu.d.ts.map +1 -1
- package/dist/components/layout/components/header/SettingsMenu.js +1 -1
- package/dist/crud/components/DisplayFieldRenderer.js +1 -1
- package/dist/dndev.css +517 -90
- package/dist/index.js +4 -4
- package/dist/internal/devtools/components/DesignTab.d.ts.map +1 -1
- package/dist/internal/devtools/components/DesignTab.js +25 -3
- package/dist/internal/layout/components/PerformanceHints.d.ts +64 -0
- package/dist/internal/layout/components/PerformanceHints.d.ts.map +1 -0
- package/dist/internal/layout/components/PerformanceHints.js +88 -0
- package/dist/internal/layout/components/footer/FooterBranding.js +1 -1
- package/dist/internal/layout/config/presets/admin.d.ts +2 -2
- package/dist/internal/layout/config/presets/admin.d.ts.map +1 -1
- package/dist/internal/layout/config/presets/admin.js +8 -4
- package/dist/providers/NextJsAppProviders.d.ts.map +1 -1
- package/dist/providers/NextJsAppProviders.js +5 -1
- package/dist/providers/ViteAppProviders.d.ts.map +1 -1
- package/dist/providers/ViteAppProviders.js +4 -1
- package/dist/routing/hooks/hooks.next.d.ts +1 -0
- package/dist/routing/hooks/hooks.next.d.ts.map +1 -1
- package/dist/routing/hooks/hooks.next.js +1 -1
- package/dist/routing/hooks/hooks.vite.d.ts +1 -0
- package/dist/routing/hooks/hooks.vite.d.ts.map +1 -1
- package/dist/routing/hooks/hooks.vite.js +1 -1
- package/dist/routing/hooks/useRouteParam.next.d.ts +18 -0
- package/dist/routing/hooks/useRouteParam.next.d.ts.map +1 -0
- package/dist/routing/hooks/useRouteParam.next.js +38 -0
- package/dist/routing/hooks/useRouteParam.vite.d.ts +18 -0
- package/dist/routing/hooks/useRouteParam.vite.d.ts.map +1 -0
- package/dist/routing/hooks/useRouteParam.vite.js +38 -0
- package/dist/routing/index.d.ts +1 -1
- package/dist/routing/index.d.ts.map +1 -1
- package/dist/routing/index.js +1 -1
- package/dist/routing/useGoTo.d.ts +3 -4
- package/dist/routing/useGoTo.d.ts.map +1 -1
- package/dist/routing/useGoTo.js +16 -23
- package/dist/styles/index.css +513 -86
- package/dist/utils/useCrudSafe.d.ts.map +1 -1
- package/dist/utils/useCrudSafe.js +2 -1
- package/dist/vite-routing/RootLayout.d.ts.map +1 -1
- package/dist/vite-routing/RootLayout.js +4 -1
- package/package.json +10 -11
package/dist/routing/useGoTo.js
CHANGED
|
@@ -3,19 +3,15 @@
|
|
|
3
3
|
* @fileoverview useGoTo Hook - Navigation search logic
|
|
4
4
|
* @description Clean hook for Cmd+K navigation with favorites, recents, and filtering
|
|
5
5
|
*
|
|
6
|
-
* @version 0.0.
|
|
6
|
+
* @version 0.0.2
|
|
7
7
|
* @since 0.0.1
|
|
8
8
|
* @author AMBROISE PARK Consulting
|
|
9
9
|
*/
|
|
10
10
|
import { useCallback, useMemo } from 'react';
|
|
11
|
-
import {
|
|
11
|
+
import { useNavigationStore } from '@donotdev/core';
|
|
12
12
|
// Platform-specific hooks via conditional exports
|
|
13
13
|
import { useNavigate } from '@donotdev/ui/routing/hooks';
|
|
14
14
|
import { useNavigationItems } from './useNavigation';
|
|
15
|
-
const FAVORITES_KEY = 'nav_favorites';
|
|
16
|
-
const RECENT_KEY = 'nav_recent';
|
|
17
|
-
const MAX_RECENT = 8;
|
|
18
|
-
const EMPTY_ARRAY = [];
|
|
19
15
|
/**
|
|
20
16
|
* Hook for navigation with favorites and recents
|
|
21
17
|
* Command component handles search/filtering
|
|
@@ -23,15 +19,12 @@ const EMPTY_ARRAY = [];
|
|
|
23
19
|
export const useGoTo = () => {
|
|
24
20
|
const navigate = useNavigate();
|
|
25
21
|
const navigationItems = useNavigationItems() ?? [];
|
|
26
|
-
//
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
defaultValue: EMPTY_ARRAY,
|
|
33
|
-
syncAcrossTabs: false,
|
|
34
|
-
});
|
|
22
|
+
// Navigation store (favorites and recent persisted per computer)
|
|
23
|
+
const favorites = useNavigationStore((state) => state.favorites);
|
|
24
|
+
const recent = useNavigationStore((state) => state.recent);
|
|
25
|
+
const toggleFavoriteStore = useNavigationStore((state) => state.toggleFavorite);
|
|
26
|
+
const isFavoriteStore = useNavigationStore((state) => state.isFavorite);
|
|
27
|
+
const addRecentStore = useNavigationStore((state) => state.addRecent);
|
|
35
28
|
// Get favorite items
|
|
36
29
|
const favoriteItems = useMemo(() => {
|
|
37
30
|
if (!navigationItems.length)
|
|
@@ -45,16 +38,16 @@ export const useGoTo = () => {
|
|
|
45
38
|
const items = navigationItems.filter((item) => recent.includes(item.path));
|
|
46
39
|
return items.slice(0, 5);
|
|
47
40
|
}, [recent, navigationItems]);
|
|
48
|
-
// Toggle favorite
|
|
41
|
+
// Toggle favorite (delegates to navigation store)
|
|
49
42
|
const toggleFavorite = useCallback((path) => {
|
|
50
|
-
|
|
51
|
-
}, [
|
|
52
|
-
// Check if item is favorite
|
|
53
|
-
const isFavorite = useCallback((path) =>
|
|
54
|
-
// Add to recent
|
|
43
|
+
toggleFavoriteStore(path);
|
|
44
|
+
}, [toggleFavoriteStore]);
|
|
45
|
+
// Check if item is favorite (delegates to navigation store)
|
|
46
|
+
const isFavorite = useCallback((path) => isFavoriteStore(path), [isFavoriteStore]);
|
|
47
|
+
// Add to recent (delegates to navigation store)
|
|
55
48
|
const addRecent = useCallback((path) => {
|
|
56
|
-
|
|
57
|
-
}, [
|
|
49
|
+
addRecentStore(path);
|
|
50
|
+
}, [addRecentStore]);
|
|
58
51
|
// Navigate to item
|
|
59
52
|
const navigateToItem = useCallback((path) => {
|
|
60
53
|
addRecent(path);
|