create-lumen 1.1.4 → 1.2.0
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/README.md +41 -34
- package/package.json +5 -1
- package/src/configure.js +6 -2
- package/src/css.js +71 -24
- package/src/dependencies.js +15 -6
- package/src/injector.js +116 -24
- package/src/main.js +3 -1
- package/src/readme.js +64 -22
- package/templates/architectures/component-based/src/App.jsx +6 -3
- package/templates/architectures/component-based/src/App.tsx +6 -3
- package/templates/architectures/component-based/src/components/common/Button.jsx +5 -2
- package/templates/architectures/component-based/src/components/common/Button.tsx +5 -2
- package/templates/architectures/component-based/src/hooks/useApp.js +10 -0
- package/templates/architectures/component-based/src/hooks/useApp.ts +10 -0
- package/templates/architectures/component-based/src/layouts/MainLayout.jsx +12 -4
- package/templates/architectures/component-based/src/layouts/MainLayout.tsx +12 -4
- package/templates/architectures/component-based/src/pages/Home/Home.jsx +6 -1
- package/templates/architectures/component-based/src/pages/Home/Home.tsx +6 -1
- package/templates/architectures/component-based/src/providers/AppProvider.jsx +20 -0
- package/templates/architectures/component-based/src/providers/AppProvider.tsx +24 -0
- package/templates/architectures/component-based/src/providers/appcontext.js +3 -0
- package/templates/architectures/component-based/src/{context/app-context.ts → providers/appcontext.ts} +1 -3
- package/templates/architectures/{feature-based → component-based}/src/types/index.js +7 -0
- package/templates/architectures/{feature-based → component-based}/src/types/index.ts +5 -0
- package/templates/architectures/feature-based/main.jsx +1 -1
- package/templates/architectures/feature-based/main.tsx +1 -1
- package/templates/architectures/feature-based/scripts/create-feature.mjs +2 -2
- package/templates/architectures/feature-based/src/app/App.jsx +15 -4
- package/templates/architectures/feature-based/src/app/App.tsx +15 -4
- package/templates/architectures/feature-based/src/app/contexts/themecontext.js +3 -0
- package/templates/architectures/feature-based/src/app/contexts/themecontext.ts +8 -0
- package/templates/architectures/feature-based/src/app/hooks/useTheme.js +10 -0
- package/templates/architectures/feature-based/src/app/hooks/useTheme.ts +10 -0
- package/templates/architectures/feature-based/src/app/providers/ThemeProvider.jsx +18 -1
- package/templates/architectures/feature-based/src/app/providers/ThemeProvider.tsx +19 -2
- package/templates/architectures/feature-based/src/features/home/pages/HomePage.jsx +18 -4
- package/templates/architectures/feature-based/src/features/home/pages/HomePage.tsx +18 -4
- package/templates/architectures/feature-based/src/shared/components/ui/Button.jsx +31 -0
- package/templates/architectures/feature-based/src/shared/components/ui/Button.tsx +36 -0
- package/templates/architectures/feature-based/src/shared/layouts/.gitkeep +0 -0
- package/templates/architectures/feature-based/src/shared/stores/.gitkeep +0 -0
- package/templates/architectures/feature-based/src/shared/styles/.gitkeep +0 -0
- package/templates/architectures/feature-based/src/shared/types/index.js +20 -0
- package/templates/architectures/feature-based/src/shared/types/index.ts +16 -0
- package/templates/conditional/axios/component-based/src/config/axios.config.js +7 -0
- package/templates/conditional/axios/component-based/src/config/axios.config.ts +7 -0
- package/templates/conditional/axios/component-based/src/services/axios.client.js +24 -0
- package/templates/conditional/axios/component-based/src/services/axios.client.ts +24 -0
- package/templates/conditional/axios/component-based/src/services/user.service.js +33 -0
- package/templates/conditional/axios/component-based/src/services/user.service.ts +29 -0
- package/templates/conditional/axios/feature-based/src/features/home/services/user.service.js +33 -0
- package/templates/conditional/axios/feature-based/src/features/home/services/user.service.ts +29 -0
- package/templates/conditional/axios/feature-based/src/shared/lib/axios/api.client.js +24 -0
- package/templates/conditional/axios/feature-based/src/shared/lib/axios/api.client.ts +24 -0
- package/templates/conditional/axios/feature-based/src/shared/lib/axios/api.config.js +7 -0
- package/templates/conditional/axios/feature-based/src/shared/lib/axios/api.config.ts +7 -0
- package/templates/conditional/axios/feature-based/src/shared/lib/axios/index.js +1 -0
- package/templates/conditional/axios/feature-based/src/shared/lib/axios/index.ts +1 -0
- package/templates/conditional/fetch/component-based/src/config/api.config.js +7 -0
- package/templates/conditional/fetch/component-based/src/config/api.config.ts +7 -0
- package/templates/conditional/fetch/component-based/src/services/api.client.js +51 -0
- package/templates/conditional/fetch/component-based/src/services/api.client.ts +55 -0
- package/templates/conditional/fetch/component-based/src/services/user.service.js +33 -0
- package/templates/conditional/fetch/component-based/src/services/user.service.ts +29 -0
- package/templates/conditional/fetch/feature-based/src/features/home/services/user.service.js +33 -0
- package/templates/conditional/fetch/feature-based/src/features/home/services/user.service.ts +29 -0
- package/templates/conditional/fetch/feature-based/src/shared/api/api.client.js +51 -0
- package/templates/conditional/fetch/feature-based/src/shared/api/api.client.ts +55 -0
- package/templates/conditional/fetch/feature-based/src/shared/api/api.config.js +7 -0
- package/templates/conditional/fetch/feature-based/src/shared/api/api.config.ts +7 -0
- package/templates/conditional/fetch/feature-based/src/shared/api/index.js +1 -0
- package/templates/conditional/fetch/feature-based/src/shared/api/index.ts +1 -0
- package/templates/conditional/icons/huge/component-based/bootstrap/src/pages/Home/Home.jsx +20 -0
- package/templates/conditional/icons/huge/component-based/bootstrap/src/pages/Home/Home.tsx +20 -0
- package/templates/conditional/icons/huge/component-based/src/pages/Home/Home.jsx +24 -8
- package/templates/conditional/icons/huge/component-based/src/pages/Home/Home.tsx +24 -8
- package/templates/conditional/icons/huge/component-based/tailwind/src/pages/Home/Home.jsx +20 -0
- package/templates/conditional/icons/huge/component-based/tailwind/src/pages/Home/Home.tsx +20 -0
- package/templates/conditional/icons/huge/feature-based/bootstrap/src/features/home/pages/HomePage.jsx +20 -0
- package/templates/conditional/icons/huge/feature-based/bootstrap/src/features/home/pages/HomePage.tsx +20 -0
- package/templates/conditional/icons/huge/feature-based/src/features/home/pages/HomePage.jsx +25 -9
- package/templates/conditional/icons/huge/feature-based/src/features/home/pages/HomePage.tsx +25 -9
- package/templates/conditional/icons/huge/feature-based/tailwind/src/features/home/pages/HomePage.jsx +20 -0
- package/templates/conditional/icons/huge/feature-based/tailwind/src/features/home/pages/HomePage.tsx +20 -0
- package/templates/conditional/icons/lucide/component-based/bootstrap/src/pages/Home/Home.jsx +19 -0
- package/templates/conditional/icons/lucide/component-based/bootstrap/src/pages/Home/Home.tsx +19 -0
- package/templates/conditional/icons/lucide/component-based/src/pages/Home/Home.jsx +24 -8
- package/templates/conditional/icons/lucide/component-based/src/pages/Home/Home.tsx +24 -8
- package/templates/conditional/icons/lucide/component-based/tailwind/src/pages/Home/Home.jsx +19 -0
- package/templates/conditional/icons/lucide/component-based/tailwind/src/pages/Home/Home.tsx +19 -0
- package/templates/conditional/icons/lucide/feature-based/bootstrap/src/features/home/pages/HomePage.jsx +19 -0
- package/templates/conditional/icons/lucide/feature-based/bootstrap/src/features/home/pages/HomePage.tsx +19 -0
- package/templates/conditional/icons/lucide/feature-based/src/features/home/pages/HomePage.jsx +25 -9
- package/templates/conditional/icons/lucide/feature-based/src/features/home/pages/HomePage.tsx +25 -9
- package/templates/conditional/icons/lucide/feature-based/tailwind/src/features/home/pages/HomePage.jsx +19 -0
- package/templates/conditional/icons/lucide/feature-based/tailwind/src/features/home/pages/HomePage.tsx +19 -0
- package/templates/conditional/router/component-based/bootstrap/src/layouts/MainLayout.jsx +17 -0
- package/templates/conditional/router/component-based/bootstrap/src/layouts/MainLayout.tsx +17 -0
- package/templates/conditional/router/component-based/src/App.jsx +4 -4
- package/templates/conditional/router/component-based/src/App.tsx +4 -4
- package/templates/conditional/router/component-based/src/layouts/MainLayout.jsx +39 -0
- package/templates/conditional/router/component-based/src/layouts/MainLayout.tsx +39 -0
- package/templates/conditional/router/component-based/src/router/guards/AuthGuard.jsx +8 -0
- package/templates/conditional/router/component-based/src/router/guards/AuthGuard.tsx +14 -0
- package/templates/conditional/router/component-based/src/router/guards/GuestGuard.jsx +8 -0
- package/templates/conditional/router/component-based/src/router/guards/GuestGuard.tsx +14 -0
- package/templates/conditional/router/component-based/src/router/index.jsx +44 -0
- package/templates/conditional/router/component-based/src/router/index.tsx +44 -0
- package/templates/conditional/router/component-based/tailwind/src/layouts/MainLayout.jsx +17 -0
- package/templates/conditional/router/component-based/tailwind/src/layouts/MainLayout.tsx +17 -0
- package/templates/conditional/router/feature-based/bootstrap/src/shared/layouts/RootLayout.jsx +9 -0
- package/templates/conditional/router/feature-based/bootstrap/src/shared/layouts/RootLayout.tsx +9 -0
- package/templates/conditional/router/feature-based/src/app/App.jsx +6 -1
- package/templates/conditional/router/feature-based/src/app/App.tsx +6 -1
- package/templates/conditional/router/feature-based/src/app/router/guards/AuthGuard.jsx +8 -0
- package/templates/conditional/router/feature-based/src/app/router/guards/AuthGuard.tsx +14 -0
- package/templates/conditional/router/feature-based/src/app/router/guards/RoleGuard.jsx +8 -0
- package/templates/conditional/router/feature-based/src/app/router/guards/RoleGuard.tsx +15 -0
- package/templates/conditional/router/feature-based/src/app/router/index.jsx +16 -0
- package/templates/conditional/router/feature-based/src/app/router/index.tsx +16 -0
- package/templates/conditional/router/feature-based/src/app/router/routes/auth.routes.jsx +18 -0
- package/templates/conditional/router/feature-based/src/app/router/routes/auth.routes.tsx +18 -0
- package/templates/conditional/router/feature-based/src/app/router/routes/home.routes.jsx +8 -0
- package/templates/conditional/router/feature-based/src/app/router/routes/home.routes.tsx +8 -0
- package/templates/conditional/router/feature-based/src/shared/layouts/RootLayout.jsx +17 -0
- package/templates/conditional/router/feature-based/src/shared/layouts/RootLayout.tsx +17 -0
- package/templates/conditional/router/feature-based/tailwind/src/shared/layouts/RootLayout.jsx +9 -0
- package/templates/conditional/router/feature-based/tailwind/src/shared/layouts/RootLayout.tsx +9 -0
- package/templates/conditional/state/redux/feature-based/src/app/providers/StoreProvider.jsx +1 -1
- package/templates/conditional/state/redux/feature-based/src/app/providers/StoreProvider.tsx +1 -1
- package/templates/css/bootstrap/src/themes.css +14 -0
- package/templates/css/component-styles/bootstrap/component-based/src/components/common/Button.jsx +17 -0
- package/templates/css/component-styles/bootstrap/component-based/src/components/common/Button.tsx +22 -0
- package/templates/css/component-styles/bootstrap/component-based/src/layouts/MainLayout.jsx +15 -0
- package/templates/css/component-styles/bootstrap/component-based/src/layouts/MainLayout.tsx +19 -0
- package/templates/css/component-styles/bootstrap/component-based/src/pages/Home/Home.jsx +13 -0
- package/templates/css/component-styles/bootstrap/component-based/src/pages/Home/Home.tsx +13 -0
- package/templates/css/component-styles/bootstrap/feature-based/src/app/App.jsx +9 -0
- package/templates/css/component-styles/bootstrap/feature-based/src/app/App.tsx +9 -0
- package/templates/css/component-styles/bootstrap/feature-based/src/features/home/pages/HomePage.jsx +13 -0
- package/templates/css/component-styles/bootstrap/feature-based/src/features/home/pages/HomePage.tsx +13 -0
- package/templates/css/component-styles/bootstrap/feature-based/src/shared/components/ui/Button.jsx +17 -0
- package/templates/css/component-styles/bootstrap/feature-based/src/shared/components/ui/Button.tsx +22 -0
- package/templates/{architectures/feature-based/src/components/ui → css/component-styles/tailwind/component-based/src/components/common}/Button.jsx +1 -1
- package/templates/{architectures/feature-based/src/components/ui → css/component-styles/tailwind/component-based/src/components/common}/Button.tsx +1 -1
- package/templates/css/component-styles/tailwind/component-based/src/layouts/MainLayout.jsx +15 -0
- package/templates/css/component-styles/tailwind/component-based/src/layouts/MainLayout.tsx +19 -0
- package/templates/css/component-styles/tailwind/component-based/src/pages/Home/Home.jsx +13 -0
- package/templates/css/component-styles/tailwind/component-based/src/pages/Home/Home.tsx +13 -0
- package/templates/css/component-styles/tailwind/feature-based/src/app/App.jsx +9 -0
- package/templates/css/component-styles/tailwind/feature-based/src/app/App.tsx +9 -0
- package/templates/css/component-styles/tailwind/feature-based/src/features/home/pages/HomePage.jsx +13 -0
- package/templates/css/component-styles/tailwind/feature-based/src/features/home/pages/HomePage.tsx +13 -0
- package/templates/css/component-styles/tailwind/feature-based/src/shared/components/ui/Button.jsx +21 -0
- package/templates/css/component-styles/tailwind/feature-based/src/shared/components/ui/Button.tsx +26 -0
- package/templates/css/none/src/{index.css → main.css} +2 -0
- package/templates/css/none/src/themes.css +19 -0
- package/templates/css/tailwind/src/themes.css +9 -0
- package/templates/architectures/component-based/src/config/constants.js +0 -1
- package/templates/architectures/component-based/src/config/constants.ts +0 -1
- package/templates/architectures/component-based/src/config/routes.js +0 -7
- package/templates/architectures/component-based/src/config/routes.ts +0 -7
- package/templates/architectures/component-based/src/context/AppContext.jsx +0 -12
- package/templates/architectures/component-based/src/context/AppContext.tsx +0 -18
- package/templates/architectures/component-based/src/context/app-context.js +0 -5
- package/templates/architectures/component-based/src/hooks/index.js +0 -1
- package/templates/architectures/component-based/src/hooks/index.ts +0 -1
- package/templates/architectures/component-based/src/layouts/index.js +0 -1
- package/templates/architectures/component-based/src/layouts/index.ts +0 -1
- package/templates/architectures/component-based/src/styles/globals.css +0 -7
- package/templates/architectures/component-based/src/utils/index.js +0 -1
- package/templates/architectures/component-based/src/utils/index.ts +0 -1
- package/templates/architectures/feature-based/src/config/constants.js +0 -1
- package/templates/architectures/feature-based/src/config/constants.ts +0 -1
- package/templates/architectures/feature-based/src/hooks/index.js +0 -1
- package/templates/architectures/feature-based/src/hooks/index.ts +0 -1
- package/templates/architectures/feature-based/src/utils/index.js +0 -1
- package/templates/architectures/feature-based/src/utils/index.ts +0 -1
- package/templates/conditional/axios/component-based/src/services/axios.jsx +0 -19
- package/templates/conditional/axios/component-based/src/services/axios.ts +0 -19
- package/templates/conditional/axios/component-based/src/services/index.js +0 -1
- package/templates/conditional/axios/component-based/src/services/index.ts +0 -1
- package/templates/conditional/axios/feature-based/src/lib/axios.jsx +0 -19
- package/templates/conditional/axios/feature-based/src/lib/axios.ts +0 -19
- package/templates/conditional/axios/feature-based/src/lib/index.js +0 -1
- package/templates/conditional/axios/feature-based/src/lib/index.ts +0 -1
- package/templates/conditional/fetch/component-based/src/services/api.jsx +0 -27
- package/templates/conditional/fetch/component-based/src/services/api.ts +0 -27
- package/templates/conditional/fetch/component-based/src/services/index.js +0 -1
- package/templates/conditional/fetch/component-based/src/services/index.ts +0 -1
- package/templates/conditional/fetch/feature-based/src/lib/api.jsx +0 -27
- package/templates/conditional/fetch/feature-based/src/lib/api.ts +0 -27
- package/templates/conditional/fetch/feature-based/src/lib/index.js +0 -1
- package/templates/conditional/fetch/feature-based/src/lib/index.ts +0 -1
- package/templates/conditional/router/component-based/src/routes/index.jsx +0 -12
- package/templates/conditional/router/component-based/src/routes/index.tsx +0 -12
- package/templates/conditional/router/feature-based/src/app/router.jsx +0 -13
- package/templates/conditional/router/feature-based/src/app/router.tsx +0 -13
- package/templates/css/tailwind/src/index.css +0 -1
- /package/templates/architectures/component-based/src/{components/layout → config}/.gitkeep +0 -0
- /package/templates/architectures/{feature-based/src/features/home/interfaces → component-based/src/providers}/.gitkeep +0 -0
- /package/templates/architectures/{feature-based/src/lib → component-based/src/styles}/.gitkeep +0 -0
- /package/templates/architectures/feature-based/src/{stores → features/home/types}/.gitkeep +0 -0
- /package/templates/architectures/feature-based/src/{components → shared/components}/ui/index.js +0 -0
- /package/templates/architectures/feature-based/src/{components → shared/components}/ui/index.ts +0 -0
- /package/templates/architectures/feature-based/src/{hooks → shared/hooks}/useLocalStorage.jsx +0 -0
- /package/templates/architectures/feature-based/src/{hooks → shared/hooks}/useLocalStorage.ts +0 -0
- /package/templates/architectures/feature-based/src/{utils → shared/utils}/cn.jsx +0 -0
- /package/templates/architectures/feature-based/src/{utils → shared/utils}/cn.ts +0 -0
- /package/templates/conditional/state/redux/component-based/src/{context → providers}/StoreProvider.jsx +0 -0
- /package/templates/conditional/state/redux/component-based/src/{context → providers}/StoreProvider.tsx +0 -0
- /package/templates/conditional/state/redux/feature-based/src/{stores → shared/stores}/hooks.js +0 -0
- /package/templates/conditional/state/redux/feature-based/src/{stores → shared/stores}/hooks.ts +0 -0
- /package/templates/conditional/state/redux/feature-based/src/{stores → shared/stores}/index.js +0 -0
- /package/templates/conditional/state/redux/feature-based/src/{stores → shared/stores}/index.ts +0 -0
- /package/templates/css/bootstrap/src/{index.css → globals.css} +0 -0
- /package/templates/{architectures/feature-based/src/styles → css/tailwind/src}/globals.css +0 -0
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import { AppProvider } from "@/providers/AppProvider";
|
|
1
2
|
import { MainLayout } from "@/layouts/MainLayout";
|
|
2
3
|
import { HomePage } from "@/pages/Home/Home";
|
|
3
4
|
|
|
4
5
|
export default function App() {
|
|
5
6
|
return (
|
|
6
|
-
<
|
|
7
|
-
<
|
|
8
|
-
|
|
7
|
+
<AppProvider>
|
|
8
|
+
<MainLayout>
|
|
9
|
+
<HomePage />
|
|
10
|
+
</MainLayout>
|
|
11
|
+
</AppProvider>
|
|
9
12
|
);
|
|
10
13
|
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import { AppProvider } from "@/providers/AppProvider";
|
|
1
2
|
import { MainLayout } from "@/layouts/MainLayout";
|
|
2
3
|
import { HomePage } from "@/pages/Home/Home";
|
|
3
4
|
|
|
4
5
|
export default function App() {
|
|
5
6
|
return (
|
|
6
|
-
<
|
|
7
|
-
<
|
|
8
|
-
|
|
7
|
+
<AppProvider>
|
|
8
|
+
<MainLayout>
|
|
9
|
+
<HomePage />
|
|
10
|
+
</MainLayout>
|
|
11
|
+
</AppProvider>
|
|
9
12
|
);
|
|
10
13
|
}
|
|
@@ -5,8 +5,11 @@ export function Button({
|
|
|
5
5
|
...props
|
|
6
6
|
}) {
|
|
7
7
|
const styles = {
|
|
8
|
-
primary: { backgroundColor: "
|
|
9
|
-
secondary: {
|
|
8
|
+
primary: { backgroundColor: "var(--color-primary)", color: "white" },
|
|
9
|
+
secondary: {
|
|
10
|
+
backgroundColor: "var(--color-border)",
|
|
11
|
+
color: "var(--color-fg)",
|
|
12
|
+
},
|
|
10
13
|
};
|
|
11
14
|
|
|
12
15
|
return (
|
|
@@ -10,8 +10,11 @@ export function Button({
|
|
|
10
10
|
...props
|
|
11
11
|
}: ButtonProps) {
|
|
12
12
|
const styles = {
|
|
13
|
-
primary: { backgroundColor: "
|
|
14
|
-
secondary: {
|
|
13
|
+
primary: { backgroundColor: "var(--color-primary)", color: "white" },
|
|
14
|
+
secondary: {
|
|
15
|
+
backgroundColor: "var(--color-border)",
|
|
16
|
+
color: "var(--color-fg)",
|
|
17
|
+
},
|
|
15
18
|
};
|
|
16
19
|
|
|
17
20
|
return (
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useContext } from "react";
|
|
2
|
+
import { AppContext, type AppContextValue } from "@/providers/appcontext";
|
|
3
|
+
|
|
4
|
+
export function useApp(): AppContextValue {
|
|
5
|
+
const ctx = useContext(AppContext);
|
|
6
|
+
if (!ctx) {
|
|
7
|
+
throw new Error("useApp must be used within an AppProvider");
|
|
8
|
+
}
|
|
9
|
+
return ctx;
|
|
10
|
+
}
|
|
@@ -4,20 +4,28 @@ export function MainLayout({ children }) {
|
|
|
4
4
|
<header
|
|
5
5
|
style={{
|
|
6
6
|
padding: "16px 24px",
|
|
7
|
-
borderBottom: "1px solid
|
|
7
|
+
borderBottom: "1px solid var(--color-border)",
|
|
8
8
|
}}
|
|
9
9
|
>
|
|
10
10
|
<h2 style={{ fontSize: "1.25rem", fontWeight: 600 }}>Lumen</h2>
|
|
11
11
|
</header>
|
|
12
|
-
<main
|
|
12
|
+
<main
|
|
13
|
+
style={{
|
|
14
|
+
flex: 1,
|
|
15
|
+
padding: "24px",
|
|
16
|
+
display: "flex",
|
|
17
|
+
alignItems: "center",
|
|
18
|
+
justifyContent: "center",
|
|
19
|
+
}}
|
|
20
|
+
>
|
|
13
21
|
{children}
|
|
14
22
|
</main>
|
|
15
23
|
<footer
|
|
16
24
|
style={{
|
|
17
25
|
padding: "16px 24px",
|
|
18
|
-
borderTop: "1px solid
|
|
26
|
+
borderTop: "1px solid var(--color-border)",
|
|
19
27
|
textAlign: "center",
|
|
20
|
-
color: "
|
|
28
|
+
color: "var(--color-muted)",
|
|
21
29
|
}}
|
|
22
30
|
>
|
|
23
31
|
<p>Built with Lumen</p>
|
|
@@ -8,20 +8,28 @@ export function MainLayout({ children }: MainLayoutProps) {
|
|
|
8
8
|
<header
|
|
9
9
|
style={{
|
|
10
10
|
padding: "16px 24px",
|
|
11
|
-
borderBottom: "1px solid
|
|
11
|
+
borderBottom: "1px solid var(--color-border)",
|
|
12
12
|
}}
|
|
13
13
|
>
|
|
14
14
|
<h2 style={{ fontSize: "1.25rem", fontWeight: 600 }}>Lumen</h2>
|
|
15
15
|
</header>
|
|
16
|
-
<main
|
|
16
|
+
<main
|
|
17
|
+
style={{
|
|
18
|
+
flex: 1,
|
|
19
|
+
padding: "24px",
|
|
20
|
+
display: "flex",
|
|
21
|
+
alignItems: "center",
|
|
22
|
+
justifyContent: "center",
|
|
23
|
+
}}
|
|
24
|
+
>
|
|
17
25
|
{children}
|
|
18
26
|
</main>
|
|
19
27
|
<footer
|
|
20
28
|
style={{
|
|
21
29
|
padding: "16px 24px",
|
|
22
|
-
borderTop: "1px solid
|
|
30
|
+
borderTop: "1px solid var(--color-border)",
|
|
23
31
|
textAlign: "center",
|
|
24
|
-
color: "
|
|
32
|
+
color: "var(--color-muted)",
|
|
25
33
|
}}
|
|
26
34
|
>
|
|
27
35
|
<p>Built with Lumen</p>
|
|
@@ -6,7 +6,12 @@ export function HomePage() {
|
|
|
6
6
|
<h1 style={{ fontSize: "2.25rem", fontWeight: 700, marginBottom: "1rem" }}>
|
|
7
7
|
Welcome to Lumen
|
|
8
8
|
</h1>
|
|
9
|
-
<p
|
|
9
|
+
<p
|
|
10
|
+
style={{
|
|
11
|
+
color: "var(--color-muted)",
|
|
12
|
+
marginBottom: "2rem",
|
|
13
|
+
}}
|
|
14
|
+
>
|
|
10
15
|
Your React + Vite project is ready. Start building!
|
|
11
16
|
</p>
|
|
12
17
|
<Button>Get Started</Button>
|
|
@@ -6,7 +6,12 @@ export function HomePage() {
|
|
|
6
6
|
<h1 style={{ fontSize: "2.25rem", fontWeight: 700, marginBottom: "1rem" }}>
|
|
7
7
|
Welcome to Lumen
|
|
8
8
|
</h1>
|
|
9
|
-
<p
|
|
9
|
+
<p
|
|
10
|
+
style={{
|
|
11
|
+
color: "var(--color-muted)",
|
|
12
|
+
marginBottom: "2rem",
|
|
13
|
+
}}
|
|
14
|
+
>
|
|
10
15
|
Your React + Vite project is ready. Start building!
|
|
11
16
|
</p>
|
|
12
17
|
<Button>Get Started</Button>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import { AppContext } from "./appcontext";
|
|
3
|
+
|
|
4
|
+
export function AppProvider({ children }) {
|
|
5
|
+
const [theme, setTheme] = useState(
|
|
6
|
+
() => localStorage.getItem("theme") ?? "light"
|
|
7
|
+
);
|
|
8
|
+
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
localStorage.setItem("theme", theme);
|
|
11
|
+
document.documentElement.dataset.theme =
|
|
12
|
+
theme === "dark" ? "dark" : "light";
|
|
13
|
+
}, [theme]);
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<AppContext.Provider value={{ theme, setTheme }}>
|
|
17
|
+
{children}
|
|
18
|
+
</AppContext.Provider>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useEffect,
|
|
3
|
+
useState,
|
|
4
|
+
type ReactNode,
|
|
5
|
+
} from "react";
|
|
6
|
+
import { AppContext } from "./appcontext";
|
|
7
|
+
|
|
8
|
+
export function AppProvider({ children }: { children: ReactNode }) {
|
|
9
|
+
const [theme, setTheme] = useState(
|
|
10
|
+
() => localStorage.getItem("theme") ?? "light"
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
localStorage.setItem("theme", theme);
|
|
15
|
+
document.documentElement.dataset.theme =
|
|
16
|
+
theme === "dark" ? "dark" : "light";
|
|
17
|
+
}, [theme]);
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<AppContext.Provider value={{ theme, setTheme }}>
|
|
21
|
+
{children}
|
|
22
|
+
</AppContext.Provider>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { createContext } from "react";
|
|
2
2
|
|
|
3
|
-
// React Fast Refresh requires contexts to live in a separate file from
|
|
4
|
-
// components, so the AppProvider component exports from AppContext.tsx.
|
|
5
3
|
export interface AppContextValue {
|
|
6
4
|
theme: string;
|
|
7
5
|
setTheme: (theme: string) => void;
|
|
8
6
|
}
|
|
9
7
|
|
|
10
|
-
export const AppContext = createContext<AppContextValue | null>(null);
|
|
8
|
+
export const AppContext = createContext<AppContextValue | null>(null);
|
|
@@ -19,19 +19,19 @@ const featureDir = path.join(process.cwd(), "src", "features", formattedName);
|
|
|
19
19
|
const subdirectories = [
|
|
20
20
|
"components",
|
|
21
21
|
"hooks",
|
|
22
|
-
"interfaces",
|
|
23
22
|
"layouts",
|
|
24
23
|
"pages",
|
|
25
24
|
"services",
|
|
26
25
|
"store",
|
|
26
|
+
"types",
|
|
27
27
|
];
|
|
28
28
|
|
|
29
29
|
// 3. Initial files with starter content
|
|
30
30
|
const initialFiles = {
|
|
31
|
-
"interfaces/index.ts": `// Types and contracts for the ${formattedName} module\n`,
|
|
32
31
|
"services/index.ts": `// Endpoints and async calls for the ${formattedName} module\n`,
|
|
33
32
|
"store/index.ts": `// State for the ${formattedName} module\n`,
|
|
34
33
|
"pages/index.ts": `// Page components for the ${formattedName} module\n`,
|
|
34
|
+
"types/index.ts": `// Types exclusive to the ${formattedName} module\n`,
|
|
35
35
|
};
|
|
36
36
|
|
|
37
37
|
// 4. Create the feature
|
|
@@ -1,9 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ThemeProvider } from "@/app/providers/ThemeProvider";
|
|
2
|
+
import { HomePage } from "@/features/home";
|
|
2
3
|
|
|
3
4
|
export default function App() {
|
|
4
5
|
return (
|
|
5
|
-
<
|
|
6
|
-
<
|
|
7
|
-
|
|
6
|
+
<ThemeProvider>
|
|
7
|
+
<div
|
|
8
|
+
style={{
|
|
9
|
+
minHeight: "100vh",
|
|
10
|
+
display: "flex",
|
|
11
|
+
alignItems: "center",
|
|
12
|
+
justifyContent: "center",
|
|
13
|
+
backgroundColor: "var(--color-bg)",
|
|
14
|
+
}}
|
|
15
|
+
>
|
|
16
|
+
<HomePage />
|
|
17
|
+
</div>
|
|
18
|
+
</ThemeProvider>
|
|
8
19
|
);
|
|
9
20
|
}
|
|
@@ -1,9 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ThemeProvider } from "@/app/providers/ThemeProvider";
|
|
2
|
+
import { HomePage } from "@/features/home";
|
|
2
3
|
|
|
3
4
|
export default function App() {
|
|
4
5
|
return (
|
|
5
|
-
<
|
|
6
|
-
<
|
|
7
|
-
|
|
6
|
+
<ThemeProvider>
|
|
7
|
+
<div
|
|
8
|
+
style={{
|
|
9
|
+
minHeight: "100vh",
|
|
10
|
+
display: "flex",
|
|
11
|
+
alignItems: "center",
|
|
12
|
+
justifyContent: "center",
|
|
13
|
+
backgroundColor: "var(--color-bg)",
|
|
14
|
+
}}
|
|
15
|
+
>
|
|
16
|
+
<HomePage />
|
|
17
|
+
</div>
|
|
18
|
+
</ThemeProvider>
|
|
8
19
|
);
|
|
9
20
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useContext } from "react";
|
|
2
|
+
import { ThemeContext } from "../contexts/themecontext";
|
|
3
|
+
|
|
4
|
+
export function useTheme() {
|
|
5
|
+
const ctx = useContext(ThemeContext);
|
|
6
|
+
if (!ctx) {
|
|
7
|
+
throw new Error("useTheme must be used within a ThemeProvider");
|
|
8
|
+
}
|
|
9
|
+
return ctx;
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useContext } from "react";
|
|
2
|
+
import { ThemeContext, type ThemeContextValue } from "../contexts/themecontext";
|
|
3
|
+
|
|
4
|
+
export function useTheme(): ThemeContextValue {
|
|
5
|
+
const ctx = useContext(ThemeContext);
|
|
6
|
+
if (!ctx) {
|
|
7
|
+
throw new Error("useTheme must be used within a ThemeProvider");
|
|
8
|
+
}
|
|
9
|
+
return ctx;
|
|
10
|
+
}
|
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import { ThemeContext } from "../contexts/themecontext";
|
|
3
|
+
|
|
1
4
|
export function ThemeProvider({ children }) {
|
|
2
|
-
|
|
5
|
+
const [theme, setTheme] = useState(
|
|
6
|
+
() => localStorage.getItem("theme") ?? "light"
|
|
7
|
+
);
|
|
8
|
+
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
localStorage.setItem("theme", theme);
|
|
11
|
+
document.documentElement.dataset.theme =
|
|
12
|
+
theme === "dark" ? "dark" : "light";
|
|
13
|
+
}, [theme]);
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<ThemeContext.Provider value={{ theme, setTheme }}>
|
|
17
|
+
{children}
|
|
18
|
+
</ThemeContext.Provider>
|
|
19
|
+
);
|
|
3
20
|
}
|
|
@@ -1,5 +1,22 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
useEffect,
|
|
3
|
+
useState,
|
|
4
|
+
type ReactNode,
|
|
5
|
+
} from "react";
|
|
6
|
+
import { ThemeContext, type ThemeContextValue } from "../contexts/themecontext";
|
|
2
7
|
|
|
3
8
|
export function ThemeProvider({ children }: { children: ReactNode }) {
|
|
4
|
-
|
|
9
|
+
const [theme, setTheme] = useState(
|
|
10
|
+
() => localStorage.getItem("theme") ?? "light"
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
localStorage.setItem("theme", theme);
|
|
15
|
+
document.documentElement.dataset.theme =
|
|
16
|
+
theme === "dark" ? "dark" : "light";
|
|
17
|
+
}, [theme]);
|
|
18
|
+
|
|
19
|
+
const value: ThemeContextValue = { theme, setTheme };
|
|
20
|
+
|
|
21
|
+
return <ThemeContext.Provider value={value}>{children}</ThemeContext.Provider>;
|
|
5
22
|
}
|
|
@@ -1,10 +1,24 @@
|
|
|
1
|
-
import { Button } from "@/components/ui";
|
|
1
|
+
import { Button } from "@/shared/components/ui";
|
|
2
2
|
|
|
3
3
|
export function HomePage() {
|
|
4
4
|
return (
|
|
5
|
-
<div
|
|
6
|
-
<h1
|
|
7
|
-
|
|
5
|
+
<div style={{ textAlign: "center" }}>
|
|
6
|
+
<h1
|
|
7
|
+
style={{
|
|
8
|
+
fontSize: "2.25rem",
|
|
9
|
+
fontWeight: 700,
|
|
10
|
+
color: "var(--color-fg)",
|
|
11
|
+
marginBottom: "1rem",
|
|
12
|
+
}}
|
|
13
|
+
>
|
|
14
|
+
Welcome to Lumen
|
|
15
|
+
</h1>
|
|
16
|
+
<p
|
|
17
|
+
style={{
|
|
18
|
+
color: "var(--color-muted)",
|
|
19
|
+
marginBottom: "2rem",
|
|
20
|
+
}}
|
|
21
|
+
>
|
|
8
22
|
Your React + Vite project is ready. Start building!
|
|
9
23
|
</p>
|
|
10
24
|
<Button>Get Started</Button>
|
|
@@ -1,10 +1,24 @@
|
|
|
1
|
-
import { Button } from "@/components/ui";
|
|
1
|
+
import { Button } from "@/shared/components/ui";
|
|
2
2
|
|
|
3
3
|
export function HomePage() {
|
|
4
4
|
return (
|
|
5
|
-
<div
|
|
6
|
-
<h1
|
|
7
|
-
|
|
5
|
+
<div style={{ textAlign: "center" }}>
|
|
6
|
+
<h1
|
|
7
|
+
style={{
|
|
8
|
+
fontSize: "2.25rem",
|
|
9
|
+
fontWeight: 700,
|
|
10
|
+
color: "var(--color-fg)",
|
|
11
|
+
marginBottom: "1rem",
|
|
12
|
+
}}
|
|
13
|
+
>
|
|
14
|
+
Welcome to Lumen
|
|
15
|
+
</h1>
|
|
16
|
+
<p
|
|
17
|
+
style={{
|
|
18
|
+
color: "var(--color-muted)",
|
|
19
|
+
marginBottom: "2rem",
|
|
20
|
+
}}
|
|
21
|
+
>
|
|
8
22
|
Your React + Vite project is ready. Start building!
|
|
9
23
|
</p>
|
|
10
24
|
<Button>Get Started</Button>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export function Button({
|
|
2
|
+
variant = "primary",
|
|
3
|
+
children,
|
|
4
|
+
className,
|
|
5
|
+
...props
|
|
6
|
+
}) {
|
|
7
|
+
const styles = {
|
|
8
|
+
primary: { backgroundColor: "var(--color-primary)", color: "white" },
|
|
9
|
+
secondary: {
|
|
10
|
+
backgroundColor: "var(--color-border)",
|
|
11
|
+
color: "var(--color-fg)",
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<button
|
|
17
|
+
style={{
|
|
18
|
+
padding: "8px 16px",
|
|
19
|
+
borderRadius: "8px",
|
|
20
|
+
fontWeight: 500,
|
|
21
|
+
border: "none",
|
|
22
|
+
cursor: "pointer",
|
|
23
|
+
...styles[variant],
|
|
24
|
+
}}
|
|
25
|
+
className={className}
|
|
26
|
+
{...props}
|
|
27
|
+
>
|
|
28
|
+
{children}
|
|
29
|
+
</button>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
2
|
+
variant?: "primary" | "secondary";
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export function Button({
|
|
7
|
+
variant = "primary",
|
|
8
|
+
children,
|
|
9
|
+
className,
|
|
10
|
+
...props
|
|
11
|
+
}: ButtonProps) {
|
|
12
|
+
const styles = {
|
|
13
|
+
primary: { backgroundColor: "var(--color-primary)", color: "white" },
|
|
14
|
+
secondary: {
|
|
15
|
+
backgroundColor: "var(--color-border)",
|
|
16
|
+
color: "var(--color-fg)",
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<button
|
|
22
|
+
style={{
|
|
23
|
+
padding: "8px 16px",
|
|
24
|
+
borderRadius: "8px",
|
|
25
|
+
fontWeight: 500,
|
|
26
|
+
border: "none",
|
|
27
|
+
cursor: "pointer",
|
|
28
|
+
...styles[variant],
|
|
29
|
+
}}
|
|
30
|
+
className={className}
|
|
31
|
+
{...props}
|
|
32
|
+
>
|
|
33
|
+
{children}
|
|
34
|
+
</button>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} User
|
|
3
|
+
* @property {string} id
|
|
4
|
+
* @property {string} email
|
|
5
|
+
* @property {string} name
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @typedef {Object} ApiResponse
|
|
10
|
+
* @property {*} data
|
|
11
|
+
* @property {string} message
|
|
12
|
+
* @property {boolean} success
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @typedef {Object} CreateUserPayload
|
|
17
|
+
* @property {string} email
|
|
18
|
+
* @property {string} name
|
|
19
|
+
*/
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface User {
|
|
2
|
+
id: string;
|
|
3
|
+
email: string;
|
|
4
|
+
name: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface ApiResponse<T> {
|
|
8
|
+
data: T;
|
|
9
|
+
message: string;
|
|
10
|
+
success: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface CreateUserPayload {
|
|
14
|
+
email: string;
|
|
15
|
+
name: string;
|
|
16
|
+
}
|