create-nextjs-cms 0.5.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/LICENSE +21 -0
- package/README.md +71 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +395 -0
- package/dist/lib/utils.d.ts +11 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +48 -0
- package/package.json +44 -0
- package/templates/default/.env +24 -0
- package/templates/default/.env.development +8 -0
- package/templates/default/.eslintrc.json +5 -0
- package/templates/default/.prettierignore +7 -0
- package/templates/default/.prettierrc.json +19 -0
- package/templates/default/CHANGELOG.md +77 -0
- package/templates/default/README.md +45 -0
- package/templates/default/app/(auth)/auth/login/LoginPage.tsx +175 -0
- package/templates/default/app/(auth)/auth/login/page.tsx +12 -0
- package/templates/default/app/(rootLayout)/admins/page.tsx +5 -0
- package/templates/default/app/(rootLayout)/advanced/page.tsx +5 -0
- package/templates/default/app/(rootLayout)/analytics/page.tsx +7 -0
- package/templates/default/app/(rootLayout)/browse/[section]/[page]/page.tsx +7 -0
- package/templates/default/app/(rootLayout)/categorized/[section]/page.tsx +7 -0
- package/templates/default/app/(rootLayout)/dashboard/page.tsx +7 -0
- package/templates/default/app/(rootLayout)/edit/[section]/[itemId]/page.tsx +7 -0
- package/templates/default/app/(rootLayout)/emails/page.tsx +6 -0
- package/templates/default/app/(rootLayout)/layout.tsx +5 -0
- package/templates/default/app/(rootLayout)/loading.tsx +10 -0
- package/templates/default/app/(rootLayout)/log/page.tsx +7 -0
- package/templates/default/app/(rootLayout)/new/[section]/page.tsx +7 -0
- package/templates/default/app/(rootLayout)/page.tsx +9 -0
- package/templates/default/app/(rootLayout)/section/[section]/page.tsx +7 -0
- package/templates/default/app/(rootLayout)/settings/page.tsx +7 -0
- package/templates/default/app/_trpc/client.ts +4 -0
- package/templates/default/app/api/auth/csrf/route.ts +25 -0
- package/templates/default/app/api/auth/refresh/route.ts +10 -0
- package/templates/default/app/api/auth/route.ts +23 -0
- package/templates/default/app/api/auth/session/route.ts +20 -0
- package/templates/default/app/api/editor/photo/route.ts +42 -0
- package/templates/default/app/api/photo/route.ts +27 -0
- package/templates/default/app/api/placeholder/route.ts +7 -0
- package/templates/default/app/api/submit/section/item/[slug]/route.ts +63 -0
- package/templates/default/app/api/submit/section/item/route.ts +53 -0
- package/templates/default/app/api/submit/section/simple/route.ts +54 -0
- package/templates/default/app/api/trpc/[trpc]/route.ts +33 -0
- package/templates/default/app/api/video/route.ts +174 -0
- package/templates/default/app/dictionaries.ts +14 -0
- package/templates/default/app/layout.tsx +28 -0
- package/templates/default/app/providers.tsx +151 -0
- package/templates/default/cli.ts +4 -0
- package/templates/default/components/AdminCard.tsx +163 -0
- package/templates/default/components/AdminEditPage.tsx +123 -0
- package/templates/default/components/AdminPrivilegeCard.tsx +184 -0
- package/templates/default/components/AdminsPage.tsx +43 -0
- package/templates/default/components/AdvancedSettingsPage.tsx +167 -0
- package/templates/default/components/AnalyticsPage.tsx +127 -0
- package/templates/default/components/BarChartBox.tsx +43 -0
- package/templates/default/components/BrowsePage.tsx +119 -0
- package/templates/default/components/CategorizedSectionPage.tsx +36 -0
- package/templates/default/components/CategoryDeleteConfirmPage.tsx +129 -0
- package/templates/default/components/CategorySectionSelectInput.tsx +139 -0
- package/templates/default/components/ConditionalFields.tsx +49 -0
- package/templates/default/components/ContainerBox.tsx +24 -0
- package/templates/default/components/DashboardPage.tsx +187 -0
- package/templates/default/components/DashboardPageAlt.tsx +43 -0
- package/templates/default/components/DefaultNavItems.tsx +3 -0
- package/templates/default/components/Dropzone.tsx +153 -0
- package/templates/default/components/EmailCard.tsx +137 -0
- package/templates/default/components/EmailPasswordForm.tsx +84 -0
- package/templates/default/components/EmailQuotaForm.tsx +72 -0
- package/templates/default/components/EmailsPage.tsx +48 -0
- package/templates/default/components/GalleryPhoto.tsx +93 -0
- package/templates/default/components/InfoCard.tsx +94 -0
- package/templates/default/components/ItemEditPage.tsx +217 -0
- package/templates/default/components/Layout.tsx +70 -0
- package/templates/default/components/LoadingSpinners.tsx +67 -0
- package/templates/default/components/LogPage.tsx +17 -0
- package/templates/default/components/Modal.tsx +99 -0
- package/templates/default/components/Navbar.tsx +29 -0
- package/templates/default/components/NavbarAlt.tsx +182 -0
- package/templates/default/components/NewAdminForm.tsx +172 -0
- package/templates/default/components/NewEmailForm.tsx +131 -0
- package/templates/default/components/NewPage.tsx +206 -0
- package/templates/default/components/NewVariantComponent.tsx +228 -0
- package/templates/default/components/PhotoGallery.tsx +35 -0
- package/templates/default/components/PieChartBox.tsx +101 -0
- package/templates/default/components/ProgressBar.tsx +24 -0
- package/templates/default/components/ProtectedDocument.tsx +78 -0
- package/templates/default/components/ProtectedImage.tsx +143 -0
- package/templates/default/components/ProtectedVideo.tsx +76 -0
- package/templates/default/components/SectionItemCard.tsx +143 -0
- package/templates/default/components/SectionItemStatusBadge.tsx +16 -0
- package/templates/default/components/SectionPage.tsx +124 -0
- package/templates/default/components/SelectBox.tsx +99 -0
- package/templates/default/components/SelectInputButtons.tsx +124 -0
- package/templates/default/components/SettingsPage.tsx +238 -0
- package/templates/default/components/Sidebar.tsx +209 -0
- package/templates/default/components/SidebarDropdownItem.tsx +74 -0
- package/templates/default/components/SidebarItem.tsx +19 -0
- package/templates/default/components/TempPage.tsx +12 -0
- package/templates/default/components/ThemeProvider.tsx +8 -0
- package/templates/default/components/TooltipComponent.tsx +27 -0
- package/templates/default/components/VariantCard.tsx +123 -0
- package/templates/default/components/VariantEditPage.tsx +229 -0
- package/templates/default/components/analytics/BounceRate.tsx +69 -0
- package/templates/default/components/analytics/LivePageViews.tsx +54 -0
- package/templates/default/components/analytics/LiveUsersCount.tsx +32 -0
- package/templates/default/components/analytics/MonthlyPageViews.tsx +41 -0
- package/templates/default/components/analytics/TopCountries.tsx +51 -0
- package/templates/default/components/analytics/TopDevices.tsx +45 -0
- package/templates/default/components/analytics/TopMediums.tsx +57 -0
- package/templates/default/components/analytics/TopSources.tsx +44 -0
- package/templates/default/components/analytics/TotalPageViews.tsx +40 -0
- package/templates/default/components/analytics/TotalSessions.tsx +40 -0
- package/templates/default/components/analytics/TotalUniqueUsers.tsx +40 -0
- package/templates/default/components/custom/RightHomeRoomVariantCard.tsx +137 -0
- package/templates/default/components/dndKit/Draggable.tsx +21 -0
- package/templates/default/components/dndKit/Droppable.tsx +20 -0
- package/templates/default/components/dndKit/SortableItem.tsx +18 -0
- package/templates/default/components/form/DateRangeFormInput.tsx +55 -0
- package/templates/default/components/form/Form.tsx +298 -0
- package/templates/default/components/form/FormInputElement.tsx +68 -0
- package/templates/default/components/form/FormInputs.tsx +108 -0
- package/templates/default/components/form/helpers/util.ts +20 -0
- package/templates/default/components/form/inputs/CheckboxFormInput.tsx +33 -0
- package/templates/default/components/form/inputs/ColorFormInput.tsx +44 -0
- package/templates/default/components/form/inputs/DateFormInput.tsx +107 -0
- package/templates/default/components/form/inputs/DocumentFormInput.tsx +124 -0
- package/templates/default/components/form/inputs/MapFormInput.tsx +139 -0
- package/templates/default/components/form/inputs/MultipleSelectFormInput.tsx +150 -0
- package/templates/default/components/form/inputs/NumberFormInput.tsx +42 -0
- package/templates/default/components/form/inputs/PasswordFormInput.tsx +47 -0
- package/templates/default/components/form/inputs/PhotoFormInput.tsx +218 -0
- package/templates/default/components/form/inputs/RichTextFormInput.tsx +133 -0
- package/templates/default/components/form/inputs/SelectFormInput.tsx +164 -0
- package/templates/default/components/form/inputs/TagsFormInput.tsx +63 -0
- package/templates/default/components/form/inputs/TextFormInput.tsx +48 -0
- package/templates/default/components/form/inputs/TextareaFormInput.tsx +47 -0
- package/templates/default/components/form/inputs/VideoFormInput.tsx +117 -0
- package/templates/default/components/pagination/Pagination.tsx +36 -0
- package/templates/default/components/pagination/PaginationButtons.tsx +145 -0
- package/templates/default/components/ui/accordion.tsx +57 -0
- package/templates/default/components/ui/alert.tsx +46 -0
- package/templates/default/components/ui/badge.tsx +33 -0
- package/templates/default/components/ui/button.tsx +57 -0
- package/templates/default/components/ui/calendar.tsx +68 -0
- package/templates/default/components/ui/card.tsx +76 -0
- package/templates/default/components/ui/checkbox.tsx +29 -0
- package/templates/default/components/ui/dropdown-menu.tsx +205 -0
- package/templates/default/components/ui/input.tsx +25 -0
- package/templates/default/components/ui/label.tsx +26 -0
- package/templates/default/components/ui/popover.tsx +31 -0
- package/templates/default/components/ui/scroll-area.tsx +42 -0
- package/templates/default/components/ui/select.tsx +164 -0
- package/templates/default/components/ui/sheet.tsx +107 -0
- package/templates/default/components/ui/switch.tsx +29 -0
- package/templates/default/components/ui/table.tsx +120 -0
- package/templates/default/components/ui/tabs.tsx +55 -0
- package/templates/default/components/ui/toast.tsx +113 -0
- package/templates/default/components/ui/toaster.tsx +35 -0
- package/templates/default/components/ui/tooltip.tsx +30 -0
- package/templates/default/components/ui/use-toast.ts +188 -0
- package/templates/default/components.json +16 -0
- package/templates/default/context/ModalProvider.tsx +53 -0
- package/templates/default/drizzle.config.ts +4 -0
- package/templates/default/dynamic-schemas/schema.ts +373 -0
- package/templates/default/env/env.js +130 -0
- package/templates/default/envConfig.ts +4 -0
- package/templates/default/hooks/useModal.ts +8 -0
- package/templates/default/lib/apiHelpers.ts +106 -0
- package/templates/default/lz.config.ts +40 -0
- package/templates/default/middleware.ts +33 -0
- package/templates/default/next.config.ts +46 -0
- package/templates/default/package.json +134 -0
- package/templates/default/postcss.config.js +6 -0
- package/templates/default/postinstall.js +14 -0
- package/templates/default/public/blank_avatar.png +0 -0
- package/templates/default/public/favicon.ico +0 -0
- package/templates/default/public/img/placeholder.svg +1 -0
- package/templates/default/public/lazemni_logo.png +0 -0
- package/templates/default/public/next.svg +1 -0
- package/templates/default/public/vercel.svg +1 -0
- package/templates/default/section-tests.ts +92 -0
- package/templates/default/styles/globals.css +88 -0
- package/templates/default/tailwind.config.js +95 -0
- package/templates/default/test.ts +77 -0
- package/templates/default/tsconfig.json +44 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { NextRequest } from 'next/server'
|
|
2
|
+
import { validateCSRFToken } from 'nextjs-cms/auth/actions'
|
|
3
|
+
|
|
4
|
+
export async function middleware(request: NextRequest) {
|
|
5
|
+
/**
|
|
6
|
+
* If the request is a POST request, we will check if the request body is empty.
|
|
7
|
+
*/
|
|
8
|
+
if (['POST', 'PUT', 'DELETE'].includes(request.method)) {
|
|
9
|
+
/**
|
|
10
|
+
* Check for csrf token in the request body
|
|
11
|
+
*/
|
|
12
|
+
const csrfToken = request.cookies.get('csrf_token')
|
|
13
|
+
const csrfTokenHeader = request.headers.get('x-csrf-token') ?? undefined
|
|
14
|
+
const csrfValid = await validateCSRFToken({ cookieValue: csrfToken?.value, bodyValue: csrfTokenHeader })
|
|
15
|
+
if (!csrfValid) {
|
|
16
|
+
return Response.json({ success: false, message: 'Invalid CSRF token' }, { status: 400 })
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const config = {
|
|
22
|
+
runtime: 'nodejs', // Specify the runtime environment as Node.js
|
|
23
|
+
matcher: [
|
|
24
|
+
/*
|
|
25
|
+
* Match all request paths except for the ones starting with:
|
|
26
|
+
* - api (API routes)
|
|
27
|
+
* - _next/static (static files)
|
|
28
|
+
* - _next/image (image optimization files)
|
|
29
|
+
* - favicon.ico (favicon file)
|
|
30
|
+
*/
|
|
31
|
+
'/((?!_next/static|_next/image|favicon.ico).*)',
|
|
32
|
+
],
|
|
33
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { NextConfig } from "next";
|
|
2
|
+
|
|
3
|
+
const nextConfig: NextConfig = {
|
|
4
|
+
typescript: {
|
|
5
|
+
// !! WARN !!
|
|
6
|
+
// Dangerously allow production builds to successfully complete even if
|
|
7
|
+
// your project has type errors.
|
|
8
|
+
// !! WARN !!
|
|
9
|
+
ignoreBuildErrors: true,
|
|
10
|
+
},
|
|
11
|
+
reactStrictMode: true,
|
|
12
|
+
async rewrites() {
|
|
13
|
+
return [
|
|
14
|
+
{
|
|
15
|
+
source: '/browse/:section',
|
|
16
|
+
destination: '/browse/:section/1',
|
|
17
|
+
},
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
images: {
|
|
21
|
+
formats: ['image/avif', 'image/webp'],
|
|
22
|
+
unoptimized: true,
|
|
23
|
+
remotePatterns: [
|
|
24
|
+
{
|
|
25
|
+
protocol: 'https',
|
|
26
|
+
hostname: 'lazemnicms.com',
|
|
27
|
+
port: '',
|
|
28
|
+
pathname: '/**',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
protocol: 'https',
|
|
32
|
+
hostname: 'api.lazemnicms.com',
|
|
33
|
+
port: '',
|
|
34
|
+
pathname: '/**',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
protocol: 'https',
|
|
38
|
+
hostname: 'images.lazemnicms.com',
|
|
39
|
+
port: '',
|
|
40
|
+
pathname: '/**',
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export default nextConfig;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "cms",
|
|
3
|
+
"version": "0.5.8",
|
|
4
|
+
"private": true,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "next dev --turbopack",
|
|
7
|
+
"build": "next build",
|
|
8
|
+
"start": "next start",
|
|
9
|
+
"lint": "next lint",
|
|
10
|
+
"typecheck": "tsc --noEmit",
|
|
11
|
+
"postinstall": "node ./postinstall.js",
|
|
12
|
+
"db:gen": "drizzle-kit generate",
|
|
13
|
+
"db:push": "drizzle-kit push --config=db/drizzle.config.ts",
|
|
14
|
+
"db:mig": "tsx db/migrate.ts",
|
|
15
|
+
"next-cms-kit": "tsx --env-file=.env cli.ts",
|
|
16
|
+
"next-cms-kit:dev": "tsx --env-file=.env.development cli.ts --dev"
|
|
17
|
+
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@clack/prompts": "^0.10.0",
|
|
20
|
+
"@dnd-kit/core": "^6.3.1",
|
|
21
|
+
"@dnd-kit/sortable": "^10.0.0",
|
|
22
|
+
"@dnd-kit/utilities": "^3.2.2",
|
|
23
|
+
"@emotion/react": "^11.14.0",
|
|
24
|
+
"@emotion/styled": "^11.14.1",
|
|
25
|
+
"@formkit/auto-animate": "^0.8.2",
|
|
26
|
+
"@google-analytics/data": "^4.12.0",
|
|
27
|
+
"@headlessui/react": "^2.2.0",
|
|
28
|
+
"@hookform/resolvers": "^5.2.2",
|
|
29
|
+
"@material-tailwind/react": "^2.1.10",
|
|
30
|
+
"@mui/material": "^6.4.3",
|
|
31
|
+
"@next/env": "^15.1.6",
|
|
32
|
+
"@radix-ui/react-accordion": "^1.2.3",
|
|
33
|
+
"@radix-ui/react-aspect-ratio": "^1.1.2",
|
|
34
|
+
"@radix-ui/react-checkbox": "^1.1.4",
|
|
35
|
+
"@radix-ui/react-dialog": "^1.1.6",
|
|
36
|
+
"@radix-ui/react-dropdown-menu": "^2.1.6",
|
|
37
|
+
"@radix-ui/react-icons": "^1.3.2",
|
|
38
|
+
"@radix-ui/react-label": "^2.1.2",
|
|
39
|
+
"@radix-ui/react-popover": "^1.1.6",
|
|
40
|
+
"@radix-ui/react-scroll-area": "^1.2.3",
|
|
41
|
+
"@radix-ui/react-select": "^2.1.6",
|
|
42
|
+
"@radix-ui/react-slot": "^1.1.2",
|
|
43
|
+
"@radix-ui/react-switch": "^1.1.3",
|
|
44
|
+
"@radix-ui/react-tabs": "^1.1.3",
|
|
45
|
+
"@radix-ui/react-toast": "^1.2.6",
|
|
46
|
+
"@radix-ui/react-tooltip": "^1.1.8",
|
|
47
|
+
"@tanstack/react-query": "^5.66.0",
|
|
48
|
+
"@tanstack/react-query-devtools": "^5.66.0",
|
|
49
|
+
"@tinymce/tinymce-react": "^5.1.1",
|
|
50
|
+
"@trpc/client": "^11.0.0-rc.477",
|
|
51
|
+
"@trpc/next": "^11.0.0-rc.477",
|
|
52
|
+
"@trpc/react-query": "^11.0.0-rc.477",
|
|
53
|
+
"@trpc/server": "^11.0.0-rc.477",
|
|
54
|
+
"@typescript-eslint/eslint-plugin": "^8.23.0",
|
|
55
|
+
"@typescript-eslint/parser": "^8.23.0",
|
|
56
|
+
"@vis.gl/react-google-maps": "^0.5.0",
|
|
57
|
+
"app-root-path": "^3.1.0",
|
|
58
|
+
"axios": "^1.8.4",
|
|
59
|
+
"bcrypt": "^6.0.0",
|
|
60
|
+
"chalk": "^5.4.1",
|
|
61
|
+
"chart.js": "^4.4.7",
|
|
62
|
+
"class-variance-authority": "^0.7.1",
|
|
63
|
+
"classnames": "^2.5.1",
|
|
64
|
+
"clsx": "^2.1.1",
|
|
65
|
+
"commander": "^13.1.0",
|
|
66
|
+
"cosmiconfig": "^9.0.0",
|
|
67
|
+
"date-fns": "^4.1.0",
|
|
68
|
+
"dayjs": "^1.11.13",
|
|
69
|
+
"deepmerge": "^4.3.1",
|
|
70
|
+
"dotenv": "^16.4.7",
|
|
71
|
+
"drizzle-orm": "^0.44.6",
|
|
72
|
+
"drizzle-zod": "^0.7.0",
|
|
73
|
+
"esbuild-register": "^3.6.0",
|
|
74
|
+
"eslint-plugin-drizzle": "^0.2.3",
|
|
75
|
+
"file-type": "^20.1.0",
|
|
76
|
+
"fs-extra": "^11.3.0",
|
|
77
|
+
"gradient-string": "^3.0.0",
|
|
78
|
+
"isomorphic-dompurify": "^2.21.0",
|
|
79
|
+
"jsonwebtoken": "^9.0.2",
|
|
80
|
+
"lodash-es": "^4.17.21",
|
|
81
|
+
"lucide-react": "^0.475.0",
|
|
82
|
+
"mysql2": "^3.12.0",
|
|
83
|
+
"nanoid": "^5.1.2",
|
|
84
|
+
"next": "^15.5.5",
|
|
85
|
+
"next-themes": "^0.4.4",
|
|
86
|
+
"nextjs-cms": "0.5.8",
|
|
87
|
+
"plaiceholder": "^3.0.0",
|
|
88
|
+
"prettier-plugin-tailwindcss": "^0.6.11",
|
|
89
|
+
"qrcode": "^1.5.4",
|
|
90
|
+
"react": "19.0.0",
|
|
91
|
+
"react-day-picker": "^8.10.1",
|
|
92
|
+
"react-dom": "19.0.0",
|
|
93
|
+
"react-dropzone": "^14.3.5",
|
|
94
|
+
"react-hook-form": "^7.66.1",
|
|
95
|
+
"read-chunk": "^5.0.0",
|
|
96
|
+
"recharts": "^2.15.1",
|
|
97
|
+
"remove": "^0.1.5",
|
|
98
|
+
"require-main-filename": "^2.0.0",
|
|
99
|
+
"server-only": "^0.0.1",
|
|
100
|
+
"sharp": "^0.33.5",
|
|
101
|
+
"superjson": "^2.2.2",
|
|
102
|
+
"tailwind-merge": "^3.0.1",
|
|
103
|
+
"tailwindcss-animate": "^1.0.7",
|
|
104
|
+
"through2": "^4.0.2",
|
|
105
|
+
"tinymce": "^7.6.1",
|
|
106
|
+
"tsx": "^4.20.6",
|
|
107
|
+
"zod": "4.1.12"
|
|
108
|
+
},
|
|
109
|
+
"devDependencies": {
|
|
110
|
+
"@types/bcrypt": "^6.0.0",
|
|
111
|
+
"@types/express-session": "^1.18.1",
|
|
112
|
+
"@types/jsonwebtoken": "^9.0.9",
|
|
113
|
+
"@types/lodash-es": "^4.17.12",
|
|
114
|
+
"@types/node": "22.13.8",
|
|
115
|
+
"@types/react": "19.0.10",
|
|
116
|
+
"@types/react-dom": "19.0.4",
|
|
117
|
+
"@types/through2": "^2.0.41",
|
|
118
|
+
"autoprefixer": "^10.4.20",
|
|
119
|
+
"cross-env": "^7.0.3",
|
|
120
|
+
"drizzle-kit": "^0.31.5",
|
|
121
|
+
"eslint": "^9.20.0",
|
|
122
|
+
"eslint-config-next": "^15.3.0",
|
|
123
|
+
"eslint-config-prettier": "^10.0.1",
|
|
124
|
+
"eslint-plugin-prettier": "^5.2.3",
|
|
125
|
+
"hanji": "^0.0.5",
|
|
126
|
+
"nextjs-cms-kit": "0.5.8",
|
|
127
|
+
"postcss": "^8.5.1",
|
|
128
|
+
"prettier": "3.5.0",
|
|
129
|
+
"tailwindcss": "^3.4.16",
|
|
130
|
+
"ts-node": "^10.9.2",
|
|
131
|
+
"tsup": "^8.3.6",
|
|
132
|
+
"typescript": "^5.7.3"
|
|
133
|
+
}
|
|
134
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const fse = require('fs-extra')
|
|
2
|
+
const path = require('path')
|
|
3
|
+
|
|
4
|
+
// Resolve the TinyMCE package path
|
|
5
|
+
const tinymcePath = path.dirname(require.resolve('tinymce/package.json'))
|
|
6
|
+
|
|
7
|
+
// Define the target directory
|
|
8
|
+
const targetDir = path.join(__dirname, 'public', 'tinymce')
|
|
9
|
+
|
|
10
|
+
// Empty and copy the directory
|
|
11
|
+
fse.emptyDirSync(targetDir)
|
|
12
|
+
fse.copySync(tinymcePath, targetDir, { overwrite: true })
|
|
13
|
+
|
|
14
|
+
console.log('Successfully copied TinyMCE to public directory')
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="1200" fill="none"><rect width="1200" height="1200" fill="#EAEAEA" rx="3"/><g opacity=".5"><g opacity=".5"><path fill="#FAFAFA" d="M600.709 736.5c-75.454 0-136.621-61.167-136.621-136.62 0-75.454 61.167-136.621 136.621-136.621 75.453 0 136.62 61.167 136.62 136.621 0 75.453-61.167 136.62-136.62 136.62Z"/><path stroke="#C9C9C9" stroke-width="2.418" d="M600.709 736.5c-75.454 0-136.621-61.167-136.621-136.62 0-75.454 61.167-136.621 136.621-136.621 75.453 0 136.62 61.167 136.62 136.621 0 75.453-61.167 136.62-136.62 136.62Z"/></g><path stroke="url(#a)" stroke-width="2.418" d="M0-1.209h553.581" transform="scale(1 -1) rotate(45 1163.11 91.165)"/><path stroke="url(#b)" stroke-width="2.418" d="M404.846 598.671h391.726"/><path stroke="url(#c)" stroke-width="2.418" d="M599.5 795.742V404.017"/><path stroke="url(#d)" stroke-width="2.418" d="m795.717 796.597-391.441-391.44"/><path fill="#fff" d="M600.709 656.704c-31.384 0-56.825-25.441-56.825-56.824 0-31.384 25.441-56.825 56.825-56.825 31.383 0 56.824 25.441 56.824 56.825 0 31.383-25.441 56.824-56.824 56.824Z"/><g clip-path="url(#e)"><path fill="#666" fill-rule="evenodd" d="M616.426 586.58h-31.434v16.176l3.553-3.554.531-.531h9.068l.074-.074 8.463-8.463h2.565l7.18 7.181V586.58Zm-15.715 14.654 3.698 3.699 1.283 1.282-2.565 2.565-1.282-1.283-5.2-5.199h-6.066l-5.514 5.514-.073.073v2.876a2.418 2.418 0 0 0 2.418 2.418h26.598a2.418 2.418 0 0 0 2.418-2.418v-8.317l-8.463-8.463-7.181 7.181-.071.072Zm-19.347 5.442v4.085a6.045 6.045 0 0 0 6.046 6.045h26.598a6.044 6.044 0 0 0 6.045-6.045v-7.108l1.356-1.355-1.282-1.283-.074-.073v-17.989h-38.689v23.43l-.146.146.146.147Z" clip-rule="evenodd"/></g><path stroke="#C9C9C9" stroke-width="2.418" d="M600.709 656.704c-31.384 0-56.825-25.441-56.825-56.824 0-31.384 25.441-56.825 56.825-56.825 31.383 0 56.824 25.441 56.824 56.825 0 31.383-25.441 56.824-56.824 56.824Z"/></g><defs><linearGradient id="a" x1="554.061" x2="-.48" y1=".083" y2=".087" gradientUnits="userSpaceOnUse"><stop stop-color="#C9C9C9" stop-opacity="0"/><stop offset=".208" stop-color="#C9C9C9"/><stop offset=".792" stop-color="#C9C9C9"/><stop offset="1" stop-color="#C9C9C9" stop-opacity="0"/></linearGradient><linearGradient id="b" x1="796.912" x2="404.507" y1="599.963" y2="599.965" gradientUnits="userSpaceOnUse"><stop stop-color="#C9C9C9" stop-opacity="0"/><stop offset=".208" stop-color="#C9C9C9"/><stop offset=".792" stop-color="#C9C9C9"/><stop offset="1" stop-color="#C9C9C9" stop-opacity="0"/></linearGradient><linearGradient id="c" x1="600.792" x2="600.794" y1="403.677" y2="796.082" gradientUnits="userSpaceOnUse"><stop stop-color="#C9C9C9" stop-opacity="0"/><stop offset=".208" stop-color="#C9C9C9"/><stop offset=".792" stop-color="#C9C9C9"/><stop offset="1" stop-color="#C9C9C9" stop-opacity="0"/></linearGradient><linearGradient id="d" x1="404.85" x2="796.972" y1="403.903" y2="796.02" gradientUnits="userSpaceOnUse"><stop stop-color="#C9C9C9" stop-opacity="0"/><stop offset=".208" stop-color="#C9C9C9"/><stop offset=".792" stop-color="#C9C9C9"/><stop offset="1" stop-color="#C9C9C9" stop-opacity="0"/></linearGradient><clipPath id="e"><path fill="#fff" d="M581.364 580.535h38.689v38.689h-38.689z"/></clipPath></defs></svg>
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 394 80"><path fill="#000" d="M262 0h68.5v12.7h-27.2v66.6h-13.6V12.7H262V0ZM149 0v12.7H94v20.4h44.3v12.6H94v21h55v12.6H80.5V0h68.7zm34.3 0h-17.8l63.8 79.4h17.9l-32-39.7 32-39.6h-17.9l-23 28.6-23-28.6zm18.3 56.7-9-11-27.1 33.7h17.8l18.3-22.7z"/><path fill="#000" d="M81 79.3 17 0H0v79.3h13.6V17l50.2 62.3H81Zm252.6-.4c-1 0-1.8-.4-2.5-1s-1.1-1.6-1.1-2.6.3-1.8 1-2.5 1.6-1 2.6-1 1.8.3 2.5 1a3.4 3.4 0 0 1 .6 4.3 3.7 3.7 0 0 1-3 1.8zm23.2-33.5h6v23.3c0 2.1-.4 4-1.3 5.5a9.1 9.1 0 0 1-3.8 3.5c-1.6.8-3.5 1.3-5.7 1.3-2 0-3.7-.4-5.3-1s-2.8-1.8-3.7-3.2c-.9-1.3-1.4-3-1.4-5h6c.1.8.3 1.6.7 2.2s1 1.2 1.6 1.5c.7.4 1.5.5 2.4.5 1 0 1.8-.2 2.4-.6a4 4 0 0 0 1.6-1.8c.3-.8.5-1.8.5-3V45.5zm30.9 9.1a4.4 4.4 0 0 0-2-3.3 7.5 7.5 0 0 0-4.3-1.1c-1.3 0-2.4.2-3.3.5-.9.4-1.6 1-2 1.6a3.5 3.5 0 0 0-.3 4c.3.5.7.9 1.3 1.2l1.8 1 2 .5 3.2.8c1.3.3 2.5.7 3.7 1.2a13 13 0 0 1 3.2 1.8 8.1 8.1 0 0 1 3 6.5c0 2-.5 3.7-1.5 5.1a10 10 0 0 1-4.4 3.5c-1.8.8-4.1 1.2-6.8 1.2-2.6 0-4.9-.4-6.8-1.2-2-.8-3.4-2-4.5-3.5a10 10 0 0 1-1.7-5.6h6a5 5 0 0 0 3.5 4.6c1 .4 2.2.6 3.4.6 1.3 0 2.5-.2 3.5-.6 1-.4 1.8-1 2.4-1.7a4 4 0 0 0 .8-2.4c0-.9-.2-1.6-.7-2.2a11 11 0 0 0-2.1-1.4l-3.2-1-3.8-1c-2.8-.7-5-1.7-6.6-3.2a7.2 7.2 0 0 1-2.4-5.7 8 8 0 0 1 1.7-5 10 10 0 0 1 4.3-3.5c2-.8 4-1.2 6.4-1.2 2.3 0 4.4.4 6.2 1.2 1.8.8 3.2 2 4.3 3.4 1 1.4 1.5 3 1.5 5h-5.8z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 283 64"><path fill="black" d="M141 16c-11 0-19 7-19 18s9 18 20 18c7 0 13-3 16-7l-7-5c-2 3-6 4-9 4-5 0-9-3-10-7h28v-3c0-11-8-18-19-18zm-9 15c1-4 4-7 9-7s8 3 9 7h-18zm117-15c-11 0-19 7-19 18s9 18 20 18c6 0 12-3 16-7l-8-5c-2 3-5 4-8 4-5 0-9-3-11-7h28l1-3c0-11-8-18-19-18zm-10 15c2-4 5-7 10-7s8 3 9 7h-19zm-39 3c0 6 4 10 10 10 4 0 7-2 9-5l8 5c-3 5-9 8-17 8-11 0-19-7-19-18s8-18 19-18c8 0 14 3 17 8l-8 5c-2-3-5-5-9-5-6 0-10 4-10 10zm83-29v46h-9V5h9zM37 0l37 64H0L37 0zm92 5-27 48L74 5h10l18 30 17-30h10zm59 12v10l-3-1c-6 0-10 4-10 10v15h-9V17h9v9c0-5 6-9 13-9z"/></svg>
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/*
|
|
2
|
+
import { FieldType, SectionInputBuilderBaseConfig, SectionInputBuilderRuntimeConfig } from 'nextjs-cms/core/inputs-builder'
|
|
3
|
+
import { entityKind } from 'nextjs-cms/core/helpers'
|
|
4
|
+
|
|
5
|
+
export interface SectionInputBaseConfig<TInputType extends FieldType>
|
|
6
|
+
extends SectionInputBuilderBaseConfig<TInputType> {
|
|
7
|
+
sectionName: string
|
|
8
|
+
notNull: boolean
|
|
9
|
+
hasDefault: boolean
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type SectionInputTypeConfig<T extends SectionInputBaseConfig<FieldType>, TTypeConfig extends object> = T & {
|
|
13
|
+
brand: 'SectionInput'
|
|
14
|
+
tableName: T['tableName']
|
|
15
|
+
name: T['name']
|
|
16
|
+
dataType: T['dataType']
|
|
17
|
+
columnType: T['columnType']
|
|
18
|
+
data: T['data']
|
|
19
|
+
driverParam: T['driverParam']
|
|
20
|
+
notNull: T['notNull']
|
|
21
|
+
hasDefault: T['hasDefault']
|
|
22
|
+
enumValues: T['enumValues']
|
|
23
|
+
baseColumn: T extends {
|
|
24
|
+
baseColumn: infer U
|
|
25
|
+
}
|
|
26
|
+
? U
|
|
27
|
+
: unknown
|
|
28
|
+
} & TTypeConfig
|
|
29
|
+
|
|
30
|
+
export type InputRuntimeConfig<TData, TRuntimeConfig extends object> = SectionInputBuilderRuntimeConfig<
|
|
31
|
+
TData,
|
|
32
|
+
TRuntimeConfig
|
|
33
|
+
>
|
|
34
|
+
|
|
35
|
+
export declare abstract class SectionInput<
|
|
36
|
+
T extends SectionInputBaseConfig<FieldType> = SectionInputBaseConfig<FieldType>,
|
|
37
|
+
TRuntimeConfig extends object = object,
|
|
38
|
+
TTypeConfig extends object = object,
|
|
39
|
+
> {
|
|
40
|
+
// implements DriverValueMapper<T['data'], T['driverParam']>
|
|
41
|
+
readonly section: Section
|
|
42
|
+
static readonly [entityKind]: string
|
|
43
|
+
readonly _: SectionInputTypeConfig<T, TTypeConfig>
|
|
44
|
+
readonly name: string
|
|
45
|
+
readonly primary: boolean
|
|
46
|
+
readonly notNull: boolean
|
|
47
|
+
// readonly default: T['data'] | SQL | undefined
|
|
48
|
+
// readonly defaultFn: (() => T['data'] | SQL) | undefined
|
|
49
|
+
// readonly onUpdateFn: (() => T['data'] | SQL) | undefined
|
|
50
|
+
readonly hasDefault: boolean
|
|
51
|
+
readonly isUnique: boolean
|
|
52
|
+
readonly uniqueName: string | undefined
|
|
53
|
+
readonly uniqueType: string | undefined
|
|
54
|
+
readonly dataType: T['dataType']
|
|
55
|
+
readonly columnType: T['columnType']
|
|
56
|
+
readonly enumValues: T['enumValues']
|
|
57
|
+
protected config: InputRuntimeConfig<T['data'], TRuntimeConfig>
|
|
58
|
+
constructor(section: Section, config: InputRuntimeConfig<T['data'], TRuntimeConfig>)
|
|
59
|
+
// abstract getSQLType(): string
|
|
60
|
+
// mapFromDriverValue(value: unknown): unknown
|
|
61
|
+
// mapToDriverValue(value: unknown): unknown
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface SectionConfigBase<TInput extends SectionInput = SectionInput<any>> {
|
|
65
|
+
name: string
|
|
66
|
+
inputs: Record<string, TInput>
|
|
67
|
+
test?: string
|
|
68
|
+
}
|
|
69
|
+
export type Writable<T> = {
|
|
70
|
+
-readonly [P in keyof T]: T[P]
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export declare class Section<T extends SectionConfigBase = SectionConfigBase> {
|
|
74
|
+
static readonly [entityKind]: string
|
|
75
|
+
readonly name: T['name']
|
|
76
|
+
readonly inputs: T['inputs']
|
|
77
|
+
readonly test: T['test']
|
|
78
|
+
readonly _: {
|
|
79
|
+
readonly brand: 'Section'
|
|
80
|
+
readonly config: T
|
|
81
|
+
readonly name: T['name']
|
|
82
|
+
// readonly schema: T['schema']
|
|
83
|
+
readonly inputs: T['inputs']
|
|
84
|
+
// readonly inferSelect: InferSelectModel<Table<T>>
|
|
85
|
+
// readonly inferInsert: InferInsertModel<Table<T>>
|
|
86
|
+
}
|
|
87
|
+
// readonly $inferSelect: InferSelectModel<Table<T>>
|
|
88
|
+
// readonly $inferInsert: InferInsertModel<Table<T>>;
|
|
89
|
+
// [IsDrizzleTable]: boolean
|
|
90
|
+
constructor(name: string, inputs: T['inputs'])
|
|
91
|
+
}
|
|
92
|
+
*/
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
@tailwind base;
|
|
2
|
+
@tailwind components;
|
|
3
|
+
@tailwind utilities;
|
|
4
|
+
|
|
5
|
+
@layer base {
|
|
6
|
+
:root {
|
|
7
|
+
--background: 0 0% 100%;
|
|
8
|
+
--foreground: 222.2 84% 4.9%;
|
|
9
|
+
|
|
10
|
+
--card: 0 0% 100%;
|
|
11
|
+
--card-foreground: 222.2 84% 4.9%;
|
|
12
|
+
|
|
13
|
+
--popover: 0 0% 100%;
|
|
14
|
+
--popover-foreground: 222.2 84% 4.9%;
|
|
15
|
+
|
|
16
|
+
--primary: 222.2 47.4% 11.2%;
|
|
17
|
+
--primary-foreground: 210 40% 98%;
|
|
18
|
+
|
|
19
|
+
--success: 122.7 39.5% 49.6%;
|
|
20
|
+
--success-foreground: 210 40% 98%;
|
|
21
|
+
|
|
22
|
+
--warning: 45 100% 50%;
|
|
23
|
+
--warning-foreground: 210 40% 98%;
|
|
24
|
+
|
|
25
|
+
--secondary: 210 40% 96.1%;
|
|
26
|
+
--secondary-foreground: 222.2 47.4% 11.2%;
|
|
27
|
+
|
|
28
|
+
--muted: 210 40% 96.1%;
|
|
29
|
+
--muted-foreground: 215.4 16.3% 46.9%;
|
|
30
|
+
|
|
31
|
+
--accent: 210 40% 96.1%;
|
|
32
|
+
--accent-foreground: 222.2 47.4% 11.2%;
|
|
33
|
+
|
|
34
|
+
--destructive: 0 84.2% 60.2%;
|
|
35
|
+
--destructive-foreground: 210 40% 98%;
|
|
36
|
+
|
|
37
|
+
--border: 214.3 31.8% 91.4%;
|
|
38
|
+
--input: 214.3 31.8% 96.4%;
|
|
39
|
+
--ring: 222.2 84% 4.9%;
|
|
40
|
+
|
|
41
|
+
--radius: 0.5rem;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.dark {
|
|
45
|
+
--background: 999 84% 4.9%;
|
|
46
|
+
--foreground: 210 40% 98%;
|
|
47
|
+
|
|
48
|
+
--card: 222.2 84% 4.9%;
|
|
49
|
+
--card-foreground: 210 40% 98%;
|
|
50
|
+
|
|
51
|
+
--popover: 222.2 84% 4.9%;
|
|
52
|
+
--popover-foreground: 210 40% 98%;
|
|
53
|
+
|
|
54
|
+
--primary: 210 40% 98%;
|
|
55
|
+
--primary-foreground: 222.2 47.4% 11.2%;
|
|
56
|
+
|
|
57
|
+
--secondary: 217.2 32.6% 17.5%;
|
|
58
|
+
--secondary-foreground: 210 40% 98%;
|
|
59
|
+
|
|
60
|
+
--success: 122.7 39.5% 49.6%;
|
|
61
|
+
--success-foreground: 210 40% 98%;
|
|
62
|
+
|
|
63
|
+
--warning: 45 100% 50%;
|
|
64
|
+
--warning-foreground: 210 40% 98%;
|
|
65
|
+
|
|
66
|
+
--muted: 217.2 32.6% 17.5%;
|
|
67
|
+
--muted-foreground: 215 20.2% 65.1%;
|
|
68
|
+
|
|
69
|
+
--accent: 217.2 32.6% 17.5%;
|
|
70
|
+
--accent-foreground: 210 40% 98%;
|
|
71
|
+
|
|
72
|
+
--destructive: 0 62.8% 30.6%;
|
|
73
|
+
--destructive-foreground: 210 40% 98%;
|
|
74
|
+
|
|
75
|
+
--border: 217.2 32.6% 17.5%;
|
|
76
|
+
--input: 217.2 32.6% 17.5%;
|
|
77
|
+
--ring: 212.7 26.8% 83.9%;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@layer base {
|
|
82
|
+
* {
|
|
83
|
+
@apply border-border;
|
|
84
|
+
}
|
|
85
|
+
body {
|
|
86
|
+
@apply bg-background text-foreground;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
const { fontFamily } = require('tailwindcss/defaultTheme')
|
|
2
|
+
|
|
3
|
+
/** @type {import('tailwindcss').Config} */
|
|
4
|
+
module.exports = {
|
|
5
|
+
darkMode: ['class'],
|
|
6
|
+
content: ['./pages/**/*.{ts,tsx}', './components/**/*.{ts,tsx}', './app/**/*.{ts,tsx}', './src/**/*.{ts,tsx}'],
|
|
7
|
+
theme: {
|
|
8
|
+
container: {
|
|
9
|
+
center: true,
|
|
10
|
+
padding: '2rem',
|
|
11
|
+
screens: {
|
|
12
|
+
'2xl': '1400px',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
extend: {
|
|
16
|
+
screens: {
|
|
17
|
+
'sm-sidebar': '768px',
|
|
18
|
+
'md-sidebar': '1024px',
|
|
19
|
+
'lg-sidebar': '1280px',
|
|
20
|
+
'xl-sidebar': '1536px',
|
|
21
|
+
'2xl-sidebar': '1920px',
|
|
22
|
+
},
|
|
23
|
+
fontFamily: {
|
|
24
|
+
sans: ['var(--font-sans)', ...fontFamily.sans],
|
|
25
|
+
},
|
|
26
|
+
colors: {
|
|
27
|
+
border: 'hsl(var(--border))',
|
|
28
|
+
input: 'hsl(var(--input))',
|
|
29
|
+
ring: 'hsl(var(--ring))',
|
|
30
|
+
background: 'hsl(var(--background))',
|
|
31
|
+
foreground: 'hsl(var(--foreground))',
|
|
32
|
+
primary: {
|
|
33
|
+
DEFAULT: 'hsl(var(--primary))',
|
|
34
|
+
foreground: 'hsl(var(--primary-foreground))',
|
|
35
|
+
},
|
|
36
|
+
secondary: {
|
|
37
|
+
DEFAULT: 'hsl(var(--secondary))',
|
|
38
|
+
foreground: 'hsl(var(--secondary-foreground))',
|
|
39
|
+
},
|
|
40
|
+
success: {
|
|
41
|
+
DEFAULT: 'hsl(var(--success))',
|
|
42
|
+
foreground: 'hsl(var(--success-foreground))',
|
|
43
|
+
},
|
|
44
|
+
warning: {
|
|
45
|
+
DEFAULT: 'hsl(var(--warning))',
|
|
46
|
+
foreground: 'hsl(var(--warning-foreground))',
|
|
47
|
+
},
|
|
48
|
+
destructive: {
|
|
49
|
+
DEFAULT: 'hsl(var(--destructive))',
|
|
50
|
+
foreground: 'hsl(var(--destructive-foreground))',
|
|
51
|
+
},
|
|
52
|
+
muted: {
|
|
53
|
+
DEFAULT: 'hsl(var(--muted))',
|
|
54
|
+
foreground: 'hsl(var(--muted-foreground))',
|
|
55
|
+
},
|
|
56
|
+
accent: {
|
|
57
|
+
DEFAULT: 'hsl(var(--accent))',
|
|
58
|
+
foreground: 'hsl(var(--accent-foreground))',
|
|
59
|
+
},
|
|
60
|
+
popover: {
|
|
61
|
+
DEFAULT: 'hsl(var(--popover))',
|
|
62
|
+
foreground: 'hsl(var(--popover-foreground))',
|
|
63
|
+
},
|
|
64
|
+
card: {
|
|
65
|
+
DEFAULT: 'hsl(var(--card))',
|
|
66
|
+
foreground: 'hsl(var(--card-foreground))',
|
|
67
|
+
},
|
|
68
|
+
disabled: {
|
|
69
|
+
DEFAULT: 'hsl(var(--disabled))',
|
|
70
|
+
foreground: 'hsl(var(--disabled-foreground))',
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
borderRadius: {
|
|
74
|
+
lg: 'var(--radius)',
|
|
75
|
+
md: 'calc(var(--radius) - 2px)',
|
|
76
|
+
sm: 'calc(var(--radius) - 4px)',
|
|
77
|
+
},
|
|
78
|
+
keyframes: {
|
|
79
|
+
'accordion-down': {
|
|
80
|
+
from: { height: 0 },
|
|
81
|
+
to: { height: 'var(--radix-accordion-content-height)' },
|
|
82
|
+
},
|
|
83
|
+
'accordion-up': {
|
|
84
|
+
from: { height: 'var(--radix-accordion-content-height)' },
|
|
85
|
+
to: { height: 0 },
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
animation: {
|
|
89
|
+
'accordion-down': 'accordion-down 0.2s ease-out',
|
|
90
|
+
'accordion-up': 'accordion-up 0.2s ease-out',
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
plugins: [require('tailwindcss-animate')],
|
|
95
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/*
|
|
2
|
+
import { BaseField } from '@/lz/types'
|
|
3
|
+
|
|
4
|
+
type Person = {
|
|
5
|
+
name: string
|
|
6
|
+
job: string
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
type Result<T> = {
|
|
10
|
+
[K in keyof T]: T[K]
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
type ExtraConfig<T> = (inputs: Result<T>) => Person
|
|
14
|
+
|
|
15
|
+
type HasItemsSection<T> = {
|
|
16
|
+
name: string
|
|
17
|
+
car: string
|
|
18
|
+
inputs: Result<T>
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
declare class PrimaryKey {
|
|
22
|
+
private field: BaseField
|
|
23
|
+
constructor(field: BaseField)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Overload signatures
|
|
27
|
+
export function hasItemsSection<T extends Record<string, Person>>(
|
|
28
|
+
section: HasItemsSection<T> & { db: { table: string; setPrimaryKey?: undefined } },
|
|
29
|
+
): { section: HasItemsSection<T> & { db: { table: string } } }
|
|
30
|
+
|
|
31
|
+
export function hasItemsSection<T extends Record<string, Person>>(
|
|
32
|
+
section: HasItemsSection<T> & { db: { table: string; setPrimaryKey?: ExtraConfig<T> } },
|
|
33
|
+
): { section: HasItemsSection<T> & { db: { table: string; primaryKey: Person | null } } }
|
|
34
|
+
|
|
35
|
+
export function hasItemsSection<T extends Record<string, Person>>(
|
|
36
|
+
section: HasItemsSection<T> & { db: { table: string; setPrimaryKey?: ExtraConfig<T> } },
|
|
37
|
+
): {
|
|
38
|
+
section: HasItemsSection<T> & { db: { table: string; primaryKey: Person | null } }
|
|
39
|
+
} {
|
|
40
|
+
let primaryKey = null
|
|
41
|
+
|
|
42
|
+
if (section.db?.setPrimaryKey) {
|
|
43
|
+
primaryKey = section.db.setPrimaryKey(section.inputs)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
section: {
|
|
48
|
+
...section,
|
|
49
|
+
db: {
|
|
50
|
+
...section.db,
|
|
51
|
+
primaryKey: primaryKey,
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const p1: Person = { name: 'Fadi', job: 'dev' }
|
|
58
|
+
const p2: Person = { name: 'Abdo', job: 'dev' }
|
|
59
|
+
|
|
60
|
+
const x = hasItemsSection({
|
|
61
|
+
name: 'asd',
|
|
62
|
+
car: 'asd',
|
|
63
|
+
inputs: {
|
|
64
|
+
fadi: p1,
|
|
65
|
+
abdo: p2,
|
|
66
|
+
},
|
|
67
|
+
db: {
|
|
68
|
+
table: 'asd',
|
|
69
|
+
setPrimaryKey: (inputs) => {
|
|
70
|
+
return inputs.fadi
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
})
|
|
74
|
+
x.section.db.primaryKey
|
|
75
|
+
x.section.db.primaryKey
|
|
76
|
+
// Now `x.section.inputs` will have autocompletion
|
|
77
|
+
*/
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"lib": [
|
|
5
|
+
"dom",
|
|
6
|
+
"dom.iterable",
|
|
7
|
+
"esnext"
|
|
8
|
+
],
|
|
9
|
+
"allowJs": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"strict": true,
|
|
12
|
+
"strictNullChecks": true,
|
|
13
|
+
"noEmit": true,
|
|
14
|
+
"esModuleInterop": true,
|
|
15
|
+
"forceConsistentCasingInFileNames": true,
|
|
16
|
+
"module": "esnext",
|
|
17
|
+
"moduleResolution": "bundler",
|
|
18
|
+
"resolveJsonModule": true,
|
|
19
|
+
"isolatedModules": true,
|
|
20
|
+
"noImplicitOverride": true,
|
|
21
|
+
"noUncheckedIndexedAccess": true,
|
|
22
|
+
"jsx": "preserve",
|
|
23
|
+
"plugins": [
|
|
24
|
+
{
|
|
25
|
+
"name": "next"
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
"paths": {
|
|
29
|
+
"@/*": [
|
|
30
|
+
"./*"
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
"incremental": true
|
|
34
|
+
},
|
|
35
|
+
"include": [
|
|
36
|
+
"next-env.d.ts",
|
|
37
|
+
"**/*.ts",
|
|
38
|
+
"**/*.tsx",
|
|
39
|
+
".next/types/**/*.ts"
|
|
40
|
+
],
|
|
41
|
+
"exclude": [
|
|
42
|
+
"node_modules"
|
|
43
|
+
]
|
|
44
|
+
}
|