@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.
Files changed (60) hide show
  1. package/package.json +2 -2
  2. package/src/app.tsx +1 -1
  3. package/src/components/ContentView.tsx +26 -58
  4. package/src/components/LoadingOverlay.tsx +1 -1
  5. package/src/components/ui/sidebar.tsx +2 -124
  6. package/src/features/layouts/AppLayout.tsx +22 -19
  7. package/src/features/layouts/LayoutFallback.tsx +8 -0
  8. package/src/features/layouts/OverlayShell.tsx +21 -40
  9. package/src/features/layouts/{AppBarLayout.tsx → appbar/AppBarLayout.tsx} +72 -78
  10. package/src/features/layouts/{FullscreenLayout.tsx → fullscreen/FullscreenLayout.tsx} +5 -11
  11. package/src/features/layouts/sidebar/BottomNavItem.tsx +88 -0
  12. package/src/features/layouts/sidebar/MobileBottomNav.tsx +168 -0
  13. package/src/features/layouts/sidebar/NavigationContent.tsx +159 -0
  14. package/src/features/layouts/sidebar/SidebarIcons.tsx +93 -0
  15. package/src/features/layouts/sidebar/SidebarInner.tsx +48 -0
  16. package/src/features/layouts/sidebar/SidebarLayout.tsx +86 -0
  17. package/src/features/layouts/sidebar/sidebarUtils.ts +23 -0
  18. package/src/features/layouts/sidebar/types.ts +8 -0
  19. package/src/features/layouts/utils.ts +1 -1
  20. package/src/features/layouts/{WindowsLayout.tsx → windows/WindowsLayout.tsx} +199 -204
  21. package/src/features/settings/SettingsView.tsx +177 -180
  22. package/src/{components → routes/components}/HomeView.tsx +1 -1
  23. package/src/{components → routes/components}/IndexRoute.tsx +4 -4
  24. package/src/routes/components/NavigationItemRoute.tsx +19 -0
  25. package/src/{components → routes/components}/NotFoundView.tsx +3 -3
  26. package/src/{components → routes/components}/RouteErrorBoundary.tsx +1 -1
  27. package/src/routes/components/RouteFallback.tsx +8 -0
  28. package/src/routes/hooks/useNavigationItems.ts +84 -0
  29. package/src/{router → routes}/routes.tsx +10 -18
  30. package/src/components/ViewRoute.tsx +0 -74
  31. package/src/dist/CookiePreferencesView.52b5aec8.js +0 -1182
  32. package/src/dist/CookiePreferencesView.52b5aec8.js.map +0 -1
  33. package/src/dist/DefaultLayout.045a82ff.js +0 -1964
  34. package/src/dist/DefaultLayout.045a82ff.js.map +0 -1
  35. package/src/dist/DefaultLayout.4454f259.js +0 -4414
  36. package/src/dist/DefaultLayout.4454f259.js.map +0 -1
  37. package/src/dist/FullscreenLayout.555c4987.js +0 -1054
  38. package/src/dist/FullscreenLayout.555c4987.js.map +0 -1
  39. package/src/dist/HomeView.ddfa7b68.js +0 -771
  40. package/src/dist/HomeView.ddfa7b68.js.map +0 -1
  41. package/src/dist/NotFoundView.c75be4f1.js +0 -811
  42. package/src/dist/NotFoundView.c75be4f1.js.map +0 -1
  43. package/src/dist/SettingsView.052b03a6.js +0 -4965
  44. package/src/dist/SettingsView.052b03a6.js.map +0 -1
  45. package/src/dist/ViewRoute.e6e3b142.js +0 -1042
  46. package/src/dist/ViewRoute.e6e3b142.js.map +0 -1
  47. package/src/dist/WindowsLayout.08724167.js +0 -1762
  48. package/src/dist/WindowsLayout.08724167.js.map +0 -1
  49. package/src/dist/esm.f0d741e6.js +0 -29520
  50. package/src/dist/esm.f0d741e6.js.map +0 -1
  51. package/src/dist/favicon.4367ac1e.svg +0 -14
  52. package/src/dist/index.parcel.36d65383.js +0 -54089
  53. package/src/dist/index.parcel.36d65383.js.map +0 -1
  54. package/src/dist/index.parcel.ca6d8a47.css +0 -3493
  55. package/src/dist/index.parcel.ca6d8a47.css.map +0 -1
  56. package/src/dist/index.parcel.html +0 -88
  57. package/src/features/layouts/DefaultLayout.tsx +0 -670
  58. package/src/features/layouts/LayoutProviders.tsx +0 -20
  59. /package/src/{constants.ts → constants/loading.ts} +0 -0
  60. /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
- };