@nextsparkjs/core 0.1.0-beta.143 → 0.1.0-beta.145

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.
@@ -1,5 +1,5 @@
1
1
  {
2
- "generated": "2026-04-15T14:10:16.186Z",
2
+ "generated": "2026-04-15T18:22:50.192Z",
3
3
  "totalClasses": 1078,
4
4
  "classes": [
5
5
  "!text-2xl",
@@ -1,3 +1,4 @@
1
+ import { connection } from 'next/server'
1
2
  import { notFound } from 'next/navigation'
2
3
  import { DOCS_REGISTRY } from '@nextsparkjs/registries/docs-registry'
3
4
  import { parseMarkdownFile } from '@nextsparkjs/core/lib/docs/parser'
@@ -14,21 +15,6 @@ interface SuperadminDocsPageProps {
14
15
  }>
15
16
  }
16
17
 
17
- export async function generateStaticParams() {
18
- const params = []
19
-
20
- for (const section of DOCS_REGISTRY.superadmin) {
21
- for (const page of section.pages) {
22
- params.push({
23
- section: section.slug,
24
- page: page.slug
25
- })
26
- }
27
- }
28
-
29
- return params
30
- }
31
-
32
18
  export async function generateMetadata({ params }: SuperadminDocsPageProps): Promise<Metadata> {
33
19
  const resolvedParams = await params
34
20
  const { section: sectionSlug, page: pageSlug } = resolvedParams
@@ -48,6 +34,7 @@ export async function generateMetadata({ params }: SuperadminDocsPageProps): Pro
48
34
  }
49
35
 
50
36
  export default async function SuperadminDocsDetailPage({ params }: SuperadminDocsPageProps) {
37
+ await connection()
51
38
  const resolvedParams = await params
52
39
  const { section: sectionSlug, page: pageSlug } = resolvedParams
53
40
 
@@ -1,6 +1,10 @@
1
+ import { Suspense } from 'react'
2
+ import { NextIntlClientProvider } from 'next-intl'
3
+ import { getMessages } from 'next-intl/server'
1
4
  import { SuperAdminGuard } from "@nextsparkjs/core/components/app/guards/SuperAdminGuard";
2
5
  import { DashboardProviders } from "@nextsparkjs/core/providers/DashboardProviders";
3
6
  import { SuperadminSidebar } from "@nextsparkjs/core/components/superadmin/layouts/SuperadminSidebar";
7
+ import { Loader2 } from 'lucide-react'
4
8
  import { Metadata } from "next";
5
9
  import { getTemplateOrDefault, getMetadataOrDefault } from '@nextsparkjs/core/lib/template-resolver'
6
10
  import { getPluginNavItems } from '@nextsparkjs/registries/plugin-registry'
@@ -21,52 +25,72 @@ interface SuperadminLayoutProps {
21
25
  }
22
26
 
23
27
  /**
24
- * Superadmin Layout
28
+ * Inner async component that loads translations server-side.
29
+ * Wrapped in Suspense so PPR doesn't fail during prerender.
25
30
  *
26
- * Protected layout for superadmin-only sections with dedicated sidebar navigation.
27
- * Applies SuperAdminGuard protection to all child routes.
28
- * Includes responsive design for mobile and desktop.
31
+ * Loads ALL translations (core + theme + entity + plugin) via getMessages()
32
+ * so plugin settings pages can use useTranslations() for their namespaces.
29
33
  */
30
- function SuperadminLayout({ children }: SuperadminLayoutProps) {
34
+ async function SuperadminWithTranslations({ children }: SuperadminLayoutProps) {
35
+ const messages = await getMessages()
31
36
  const pluginNavItems = getPluginNavItems('superadmin')
37
+
32
38
  return (
33
39
  <DashboardProviders>
34
- <SuperAdminGuard>
35
- <div className="flex h-screen bg-background" data-cy="superadmin-container">
36
- {/* Sidebar - Hidden on mobile, visible on desktop */}
37
- <div className="hidden lg:block">
38
- <SuperadminSidebar pluginItems={pluginNavItems} />
39
- </div>
40
+ <NextIntlClientProvider messages={messages}>
41
+ <SuperAdminGuard>
42
+ <div className="flex h-screen bg-background" data-cy="superadmin-container">
43
+ {/* Sidebar - Hidden on mobile, visible on desktop */}
44
+ <div className="hidden lg:block">
45
+ <SuperadminSidebar pluginItems={pluginNavItems} />
46
+ </div>
40
47
 
41
- {/* Main content area */}
42
- <div className="flex-1 flex flex-col overflow-hidden">
43
- {/* Mobile header for Superadmin - Only visible on mobile */}
44
- <div className="lg:hidden bg-card border-b border-border p-4">
45
- <div className="flex items-center gap-2">
46
- <div className="flex items-center justify-center w-8 h-8 bg-red-100 rounded-lg">
47
- <div className="h-5 w-5 bg-red-600 rounded-sm"></div>
48
+ {/* Main content area */}
49
+ <div className="flex-1 flex flex-col overflow-hidden">
50
+ {/* Mobile header for Superadmin - Only visible on mobile */}
51
+ <div className="lg:hidden bg-card border-b border-border p-4">
52
+ <div className="flex items-center gap-2">
53
+ <div className="flex items-center justify-center w-8 h-8 bg-red-100 rounded-lg">
54
+ <div className="h-5 w-5 bg-red-600 rounded-sm"></div>
55
+ </div>
56
+ <div>
57
+ <h1 className="text-lg font-bold text-red-600">Super Admin</h1>
58
+ <p className="text-xs text-muted-foreground">Super Admin Area</p>
59
+ </div>
60
+ </div>
48
61
  </div>
49
- <div>
50
- <h1 className="text-lg font-bold text-red-600">Super Admin</h1>
51
- <p className="text-xs text-muted-foreground">Super Admin Area</p>
52
- </div>
53
- </div>
54
- </div>
55
62
 
56
- {/* Content area with scrolling */}
57
- <main className="flex-1 overflow-y-auto">
58
- <div className="container mx-auto p-6 max-w-7xl">
59
- {children}
63
+ {/* Content area with scrolling */}
64
+ <main className="flex-1 overflow-y-auto">
65
+ <div className="container mx-auto p-6 max-w-7xl">
66
+ {children}
67
+ </div>
68
+ </main>
60
69
  </div>
61
- </main>
62
- </div>
70
+ </div>
71
+ </SuperAdminGuard>
72
+ </NextIntlClientProvider>
73
+ </DashboardProviders>
74
+ )
75
+ }
63
76
 
64
- {/* Mobile sidebar overlay (future enhancement) */}
65
- {/* Could add a mobile drawer/overlay sidebar here if needed */}
77
+ /**
78
+ * Superadmin Layout
79
+ *
80
+ * Protected layout for superadmin-only sections with dedicated sidebar navigation.
81
+ * Loads ALL translations (core + theme + entity + plugin) server-side via
82
+ * NextIntlClientProvider so plugin settings pages can use useTranslations().
83
+ */
84
+ function SuperadminLayout({ children }: SuperadminLayoutProps) {
85
+ return (
86
+ <Suspense fallback={
87
+ <div className="min-h-screen flex items-center justify-center">
88
+ <Loader2 className="h-8 w-8 animate-spin text-muted-foreground" />
66
89
  </div>
67
- </SuperAdminGuard>
68
- </DashboardProviders>
69
- );
90
+ }>
91
+ <SuperadminWithTranslations>{children}</SuperadminWithTranslations>
92
+ </Suspense>
93
+ )
70
94
  }
71
95
 
72
- export default getTemplateOrDefault('app/superadmin/layout.tsx', SuperadminLayout)
96
+ export default getTemplateOrDefault('app/superadmin/layout.tsx', SuperadminLayout)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextsparkjs/core",
3
- "version": "0.1.0-beta.143",
3
+ "version": "0.1.0-beta.145",
4
4
  "description": "NextSpark - The complete SaaS framework for Next.js",
5
5
  "license": "MIT",
6
6
  "author": "NextSpark <hello@nextspark.dev>",
@@ -463,7 +463,7 @@
463
463
  "tailwind-merge": "^3.3.1",
464
464
  "uuid": "^13.0.0",
465
465
  "zod": "^4.1.5",
466
- "@nextsparkjs/testing": "0.1.0-beta.143"
466
+ "@nextsparkjs/testing": "0.1.0-beta.145"
467
467
  },
468
468
  "scripts": {
469
469
  "postinstall": "node scripts/postinstall.mjs || true",
@@ -218,12 +218,23 @@ export async function buildRegistries(projectRoot = null) {
218
218
  })
219
219
 
220
220
  // Merge all entities with priority: plugins < core < themes
221
- const allEntities = [
221
+ // Theme entities override core entities with the same slug (e.g., patterns)
222
+ const mergedEntities = [
222
223
  ...pluginEntities, // Lowest priority
223
224
  ...coreEntities, // Core framework entities
224
225
  ...themeEntities // Highest priority (can override core)
225
226
  ]
226
227
 
228
+ // Deduplicate: later entries (theme) win over earlier (core/plugin) with same name
229
+ const entityMap = new Map()
230
+ for (const entity of mergedEntities) {
231
+ if (entityMap.has(entity.name)) {
232
+ log(` ↳ Theme override: "${entity.name}" (${entity.source || 'theme'} replaces ${entityMap.get(entity.name).source || 'core'})`, 'info')
233
+ }
234
+ entityMap.set(entity.name, entity)
235
+ }
236
+ const allEntities = Array.from(entityMap.values())
237
+
227
238
  // PHASE 3 VALIDATION: Ensure all entities have access.shared defined
228
239
  await validateEntityConfigurations(allEntities)
229
240
 
@@ -1,3 +1,4 @@
1
+ import { connection } from 'next/server'
1
2
  import { notFound } from 'next/navigation'
2
3
  import { DOCS_REGISTRY } from '@nextsparkjs/registries/docs-registry'
3
4
  import { parseMarkdownFile } from '@nextsparkjs/core/lib/docs/parser'
@@ -14,21 +15,6 @@ interface SuperadminDocsPageProps {
14
15
  }>
15
16
  }
16
17
 
17
- export async function generateStaticParams() {
18
- const params = []
19
-
20
- for (const section of DOCS_REGISTRY.superadmin) {
21
- for (const page of section.pages) {
22
- params.push({
23
- section: section.slug,
24
- page: page.slug
25
- })
26
- }
27
- }
28
-
29
- return params
30
- }
31
-
32
18
  export async function generateMetadata({ params }: SuperadminDocsPageProps): Promise<Metadata> {
33
19
  const resolvedParams = await params
34
20
  const { section: sectionSlug, page: pageSlug } = resolvedParams
@@ -48,6 +34,7 @@ export async function generateMetadata({ params }: SuperadminDocsPageProps): Pro
48
34
  }
49
35
 
50
36
  export default async function SuperadminDocsDetailPage({ params }: SuperadminDocsPageProps) {
37
+ await connection()
51
38
  const resolvedParams = await params
52
39
  const { section: sectionSlug, page: pageSlug } = resolvedParams
53
40
 
@@ -1,6 +1,10 @@
1
+ import { Suspense } from 'react'
2
+ import { NextIntlClientProvider } from 'next-intl'
3
+ import { getMessages } from 'next-intl/server'
1
4
  import { SuperAdminGuard } from "@nextsparkjs/core/components/app/guards/SuperAdminGuard";
2
5
  import { DashboardProviders } from "@nextsparkjs/core/providers/DashboardProviders";
3
6
  import { SuperadminSidebar } from "@nextsparkjs/core/components/superadmin/layouts/SuperadminSidebar";
7
+ import { Loader2 } from 'lucide-react'
4
8
  import { Metadata } from "next";
5
9
  import { getTemplateOrDefault, getMetadataOrDefault } from '@nextsparkjs/core/lib/template-resolver'
6
10
  import { getPluginNavItems } from '@nextsparkjs/registries/plugin-registry'
@@ -21,52 +25,72 @@ interface SuperadminLayoutProps {
21
25
  }
22
26
 
23
27
  /**
24
- * Superadmin Layout
28
+ * Inner async component that loads translations server-side.
29
+ * Wrapped in Suspense so PPR doesn't fail during prerender.
25
30
  *
26
- * Protected layout for superadmin-only sections with dedicated sidebar navigation.
27
- * Applies SuperAdminGuard protection to all child routes.
28
- * Includes responsive design for mobile and desktop.
31
+ * Loads ALL translations (core + theme + entity + plugin) via getMessages()
32
+ * so plugin settings pages can use useTranslations() for their namespaces.
29
33
  */
30
- function SuperadminLayout({ children }: SuperadminLayoutProps) {
34
+ async function SuperadminWithTranslations({ children }: SuperadminLayoutProps) {
35
+ const messages = await getMessages()
31
36
  const pluginNavItems = getPluginNavItems('superadmin')
37
+
32
38
  return (
33
39
  <DashboardProviders>
34
- <SuperAdminGuard>
35
- <div className="flex h-screen bg-background" data-cy="superadmin-container">
36
- {/* Sidebar - Hidden on mobile, visible on desktop */}
37
- <div className="hidden lg:block">
38
- <SuperadminSidebar pluginItems={pluginNavItems} />
39
- </div>
40
+ <NextIntlClientProvider messages={messages}>
41
+ <SuperAdminGuard>
42
+ <div className="flex h-screen bg-background" data-cy="superadmin-container">
43
+ {/* Sidebar - Hidden on mobile, visible on desktop */}
44
+ <div className="hidden lg:block">
45
+ <SuperadminSidebar pluginItems={pluginNavItems} />
46
+ </div>
40
47
 
41
- {/* Main content area */}
42
- <div className="flex-1 flex flex-col overflow-hidden">
43
- {/* Mobile header for Superadmin - Only visible on mobile */}
44
- <div className="lg:hidden bg-card border-b border-border p-4">
45
- <div className="flex items-center gap-2">
46
- <div className="flex items-center justify-center w-8 h-8 bg-red-100 rounded-lg">
47
- <div className="h-5 w-5 bg-red-600 rounded-sm"></div>
48
+ {/* Main content area */}
49
+ <div className="flex-1 flex flex-col overflow-hidden">
50
+ {/* Mobile header for Superadmin - Only visible on mobile */}
51
+ <div className="lg:hidden bg-card border-b border-border p-4">
52
+ <div className="flex items-center gap-2">
53
+ <div className="flex items-center justify-center w-8 h-8 bg-red-100 rounded-lg">
54
+ <div className="h-5 w-5 bg-red-600 rounded-sm"></div>
55
+ </div>
56
+ <div>
57
+ <h1 className="text-lg font-bold text-red-600">Super Admin</h1>
58
+ <p className="text-xs text-muted-foreground">Super Admin Area</p>
59
+ </div>
60
+ </div>
48
61
  </div>
49
- <div>
50
- <h1 className="text-lg font-bold text-red-600">Super Admin</h1>
51
- <p className="text-xs text-muted-foreground">Super Admin Area</p>
52
- </div>
53
- </div>
54
- </div>
55
62
 
56
- {/* Content area with scrolling */}
57
- <main className="flex-1 overflow-y-auto">
58
- <div className="container mx-auto p-6 max-w-7xl">
59
- {children}
63
+ {/* Content area with scrolling */}
64
+ <main className="flex-1 overflow-y-auto">
65
+ <div className="container mx-auto p-6 max-w-7xl">
66
+ {children}
67
+ </div>
68
+ </main>
60
69
  </div>
61
- </main>
62
- </div>
70
+ </div>
71
+ </SuperAdminGuard>
72
+ </NextIntlClientProvider>
73
+ </DashboardProviders>
74
+ )
75
+ }
63
76
 
64
- {/* Mobile sidebar overlay (future enhancement) */}
65
- {/* Could add a mobile drawer/overlay sidebar here if needed */}
77
+ /**
78
+ * Superadmin Layout
79
+ *
80
+ * Protected layout for superadmin-only sections with dedicated sidebar navigation.
81
+ * Loads ALL translations (core + theme + entity + plugin) server-side via
82
+ * NextIntlClientProvider so plugin settings pages can use useTranslations().
83
+ */
84
+ function SuperadminLayout({ children }: SuperadminLayoutProps) {
85
+ return (
86
+ <Suspense fallback={
87
+ <div className="min-h-screen flex items-center justify-center">
88
+ <Loader2 className="h-8 w-8 animate-spin text-muted-foreground" />
66
89
  </div>
67
- </SuperAdminGuard>
68
- </DashboardProviders>
69
- );
90
+ }>
91
+ <SuperadminWithTranslations>{children}</SuperadminWithTranslations>
92
+ </Suspense>
93
+ )
70
94
  }
71
95
 
72
- export default getTemplateOrDefault('app/superadmin/layout.tsx', SuperadminLayout)
96
+ export default getTemplateOrDefault('app/superadmin/layout.tsx', SuperadminLayout)