@shellui/core 0.2.0-beta.0 → 0.2.0-beta.1
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/package.json +2 -2
- package/src/app.tsx +1 -1
- package/src/components/ContentView.tsx +26 -58
- package/src/components/LoadingOverlay.tsx +1 -1
- package/src/components/ui/sidebar.tsx +2 -124
- package/src/features/layouts/AppLayout.tsx +22 -19
- package/src/features/layouts/LayoutFallback.tsx +8 -0
- package/src/features/layouts/OverlayShell.tsx +21 -40
- package/src/features/layouts/{AppBarLayout.tsx → appbar/AppBarLayout.tsx} +72 -78
- package/src/features/layouts/{FullscreenLayout.tsx → fullscreen/FullscreenLayout.tsx} +5 -11
- package/src/features/layouts/sidebar/BottomNavItem.tsx +88 -0
- package/src/features/layouts/sidebar/MobileBottomNav.tsx +168 -0
- package/src/features/layouts/sidebar/NavigationContent.tsx +159 -0
- package/src/features/layouts/sidebar/SidebarIcons.tsx +93 -0
- package/src/features/layouts/sidebar/SidebarInner.tsx +48 -0
- package/src/features/layouts/sidebar/SidebarLayout.tsx +86 -0
- package/src/features/layouts/sidebar/sidebarUtils.ts +23 -0
- package/src/features/layouts/sidebar/types.ts +8 -0
- package/src/features/layouts/utils.ts +1 -1
- package/src/features/layouts/{WindowsLayout.tsx → windows/WindowsLayout.tsx} +199 -204
- package/src/features/settings/SettingsView.tsx +177 -180
- package/src/{components → routes/components}/HomeView.tsx +1 -1
- package/src/{components → routes/components}/IndexRoute.tsx +4 -4
- package/src/routes/components/NavigationItemRoute.tsx +19 -0
- package/src/{components → routes/components}/NotFoundView.tsx +3 -3
- package/src/{components → routes/components}/RouteErrorBoundary.tsx +1 -1
- package/src/routes/components/RouteFallback.tsx +8 -0
- package/src/routes/hooks/useNavigationItems.ts +84 -0
- package/src/{router → routes}/routes.tsx +10 -18
- package/src/components/ViewRoute.tsx +0 -74
- package/src/dist/CookiePreferencesView.52b5aec8.js +0 -1182
- package/src/dist/CookiePreferencesView.52b5aec8.js.map +0 -1
- package/src/dist/DefaultLayout.045a82ff.js +0 -1964
- package/src/dist/DefaultLayout.045a82ff.js.map +0 -1
- package/src/dist/DefaultLayout.4454f259.js +0 -4414
- package/src/dist/DefaultLayout.4454f259.js.map +0 -1
- package/src/dist/FullscreenLayout.555c4987.js +0 -1054
- package/src/dist/FullscreenLayout.555c4987.js.map +0 -1
- package/src/dist/HomeView.ddfa7b68.js +0 -771
- package/src/dist/HomeView.ddfa7b68.js.map +0 -1
- package/src/dist/NotFoundView.c75be4f1.js +0 -811
- package/src/dist/NotFoundView.c75be4f1.js.map +0 -1
- package/src/dist/SettingsView.052b03a6.js +0 -4965
- package/src/dist/SettingsView.052b03a6.js.map +0 -1
- package/src/dist/ViewRoute.e6e3b142.js +0 -1042
- package/src/dist/ViewRoute.e6e3b142.js.map +0 -1
- package/src/dist/WindowsLayout.08724167.js +0 -1762
- package/src/dist/WindowsLayout.08724167.js.map +0 -1
- package/src/dist/esm.f0d741e6.js +0 -29520
- package/src/dist/esm.f0d741e6.js.map +0 -1
- package/src/dist/favicon.4367ac1e.svg +0 -14
- package/src/dist/index.parcel.36d65383.js +0 -54089
- package/src/dist/index.parcel.36d65383.js.map +0 -1
- package/src/dist/index.parcel.ca6d8a47.css +0 -3493
- package/src/dist/index.parcel.ca6d8a47.css.map +0 -1
- package/src/dist/index.parcel.html +0 -88
- package/src/features/layouts/DefaultLayout.tsx +0 -670
- package/src/features/layouts/LayoutProviders.tsx +0 -20
- /package/src/{constants.ts → constants/loading.ts} +0 -0
- /package/src/{router → routes}/router.tsx +0 -0
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { useMemo } from 'react';
|
|
2
|
-
import { Navigate, useLocation } from 'react-router';
|
|
3
|
-
import {
|
|
4
|
-
getNavPathPrefix,
|
|
5
|
-
isHashRouterNavItem,
|
|
6
|
-
getBaseUrlWithoutHash,
|
|
7
|
-
getHashPathFromUrl,
|
|
8
|
-
} from '../features/layouts/utils';
|
|
9
|
-
import { ContentView } from './ContentView';
|
|
10
|
-
import type { NavigationItem } from '../features/config/types';
|
|
11
|
-
|
|
12
|
-
interface ViewRouteProps {
|
|
13
|
-
navigation: NavigationItem[];
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export const ViewRoute = ({ navigation }: ViewRouteProps) => {
|
|
17
|
-
const location = useLocation();
|
|
18
|
-
const pathname = location.pathname;
|
|
19
|
-
|
|
20
|
-
const navItem = useMemo(() => {
|
|
21
|
-
return navigation.find((item) => {
|
|
22
|
-
const pathPrefix = getNavPathPrefix(item);
|
|
23
|
-
return pathname === pathPrefix || pathname.startsWith(`${pathPrefix}/`);
|
|
24
|
-
});
|
|
25
|
-
}, [navigation, pathname]);
|
|
26
|
-
|
|
27
|
-
// When no nav matches (e.g. /layout on refresh): use root item (path '' or '/') with pathname as hash subpath to avoid 404
|
|
28
|
-
const rootItem = useMemo(
|
|
29
|
-
() => navigation.find((item) => item.path === '' || item.path === '/'),
|
|
30
|
-
[navigation],
|
|
31
|
-
);
|
|
32
|
-
const useRootFallback = !navItem && rootItem && pathname !== '/';
|
|
33
|
-
const actualNavItem = navItem ?? (useRootFallback ? rootItem : null);
|
|
34
|
-
const actualSubPath = useRootFallback
|
|
35
|
-
? pathname.replace(/^\//, '')
|
|
36
|
-
: actualNavItem
|
|
37
|
-
? pathname.length > getNavPathPrefix(actualNavItem).length
|
|
38
|
-
? pathname.slice(getNavPathPrefix(actualNavItem).length + 1)
|
|
39
|
-
: ''
|
|
40
|
-
: '';
|
|
41
|
-
|
|
42
|
-
if (!actualNavItem) {
|
|
43
|
-
return (
|
|
44
|
-
<Navigate
|
|
45
|
-
to="/"
|
|
46
|
-
replace
|
|
47
|
-
/>
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
const subPath = actualSubPath;
|
|
51
|
-
|
|
52
|
-
// Construct the final URL for the iframe (non-hash: base + path; hash app: preserve nav url hash path + subPath)
|
|
53
|
-
let finalUrl: string;
|
|
54
|
-
if (isHashRouterNavItem(actualNavItem)) {
|
|
55
|
-
const base = getBaseUrlWithoutHash(actualNavItem.url).replace(/\/$/, '');
|
|
56
|
-
const navHashPath = getHashPathFromUrl(actualNavItem.url).replace(/^\/+|\/+$/g, '');
|
|
57
|
-
const segments = [navHashPath, subPath].filter(Boolean);
|
|
58
|
-
const fullHashPath = `/${segments.join('/')}`;
|
|
59
|
-
finalUrl = `${base}#${fullHashPath}`;
|
|
60
|
-
} else {
|
|
61
|
-
finalUrl = actualNavItem.url;
|
|
62
|
-
if (subPath) {
|
|
63
|
-
const baseUrl = actualNavItem.url.endsWith('/') ? actualNavItem.url : `${actualNavItem.url}/`;
|
|
64
|
-
finalUrl = `${baseUrl}${subPath}`;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return (
|
|
68
|
-
<ContentView
|
|
69
|
-
url={finalUrl}
|
|
70
|
-
pathPrefix={actualNavItem.path}
|
|
71
|
-
navItem={actualNavItem}
|
|
72
|
-
/>
|
|
73
|
-
);
|
|
74
|
-
};
|