@nextsparkjs/core 0.1.0-beta.13 → 0.1.0-beta.15
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/dist/components/dashboard/layouts/DashboardShell.d.ts +1 -1
- package/dist/components/dashboard/layouts/DashboardShell.d.ts.map +1 -1
- package/dist/components/dashboard/layouts/DashboardShell.js +11 -0
- package/dist/lib/entities/queries.d.ts +6 -0
- package/dist/lib/entities/queries.d.ts.map +1 -1
- package/dist/lib/entities/queries.js +10 -27
- package/dist/lib/entities/registry.client.d.ts +1 -1
- package/dist/lib/entities/registry.client.d.ts.map +1 -1
- package/dist/lib/entities/registry.client.js +3 -22
- package/dist/lib/entities/registry.d.ts +1 -1
- package/dist/lib/entities/registry.d.ts.map +1 -1
- package/dist/lib/entities/registry.js +31 -14
- package/dist/styles/classes.json +1 -1
- package/dist/templates/app/dashboard/(main)/layout.tsx +8 -21
- package/package.json +1 -1
- package/templates/app/dashboard/(main)/layout.tsx +8 -21
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type SerializableEntityConfig } from '../../../lib/entities/serialization';
|
|
2
2
|
interface DashboardShellProps {
|
|
3
3
|
children: React.ReactNode;
|
|
4
4
|
entities: SerializableEntityConfig[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DashboardShell.d.ts","sourceRoot":"","sources":["../../../../src/components/dashboard/layouts/DashboardShell.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DashboardShell.d.ts","sourceRoot":"","sources":["../../../../src/components/dashboard/layouts/DashboardShell.tsx"],"names":[],"mappings":"AASA,OAAO,EAA2B,KAAK,wBAAwB,EAAE,MAAM,qCAAqC,CAAA;AAG5G,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,QAAQ,EAAE,wBAAwB,EAAE,CAAA;CACrC;AAgDD,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,mBAAmB,2CAQzE"}
|
|
@@ -1,13 +1,24 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useRef } from "react";
|
|
3
4
|
import { Sidebar } from "./Sidebar";
|
|
4
5
|
import { TopNavbar } from "./TopNavbar";
|
|
5
6
|
import { MobileTopBar } from "../mobile/MobileTopBar";
|
|
6
7
|
import { MobileBottomNav } from "../mobile/MobileBottomNav";
|
|
7
8
|
import { SidebarProvider, useSidebar } from "../../../contexts/sidebar-context";
|
|
8
9
|
import { cn } from "../../../lib/utils";
|
|
10
|
+
import { deserializeEntityConfig } from "../../../lib/entities/serialization";
|
|
11
|
+
import { setServerEntities } from "../../../lib/entities/registry.client";
|
|
9
12
|
function DashboardShellContent({ children, entities }) {
|
|
10
13
|
const { isCollapsed } = useSidebar();
|
|
14
|
+
const hydratedRef = useRef(false);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (!hydratedRef.current && entities.length > 0) {
|
|
17
|
+
const deserializedEntities = entities.map(deserializeEntityConfig);
|
|
18
|
+
setServerEntities(deserializedEntities);
|
|
19
|
+
hydratedRef.current = true;
|
|
20
|
+
}
|
|
21
|
+
}, [entities]);
|
|
11
22
|
return /* @__PURE__ */ jsxs("div", { className: "min-h-screen", children: [
|
|
12
23
|
/* @__PURE__ */ jsx(Sidebar, { className: "hidden lg:flex", entities }),
|
|
13
24
|
/* @__PURE__ */ jsx(TopNavbar, { className: "hidden lg:flex", entities }),
|
|
@@ -45,6 +45,12 @@ export interface EntityOwner {
|
|
|
45
45
|
type: 'plugin' | 'theme';
|
|
46
46
|
name: string;
|
|
47
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Register the entity registry from the project
|
|
50
|
+
* This should be called by the dashboard layout which imports the registry directly
|
|
51
|
+
* (webpack resolves the @nextsparkjs/registries alias at compile time)
|
|
52
|
+
*/
|
|
53
|
+
export declare function setEntityRegistry(registry: Record<string, EntityRegistryEntry>, metadata?: EntityRegistryMetadata): void;
|
|
48
54
|
/**
|
|
49
55
|
* Get all registered entity configs
|
|
50
56
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../src/lib/entities/queries.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAElE;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,YAAY,GAAG,qBAAqB,CAAA;IAC5C,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,aAAa,CAAC,EAAE;QACd,UAAU,EAAE,MAAM,CAAA;QAClB,SAAS,EAAE,MAAM,CAAA;KAClB,CAAA;IACD,YAAY,CAAC,EAAE;QACb,SAAS,EAAE,MAAM,CAAA;QACjB,QAAQ,EAAE,MAAM,CAAA;KACjB,CAAA;IACD,MAAM,CAAC,EAAE,GAAG,CAAA;IACZ,SAAS,CAAC,EAAE,GAAG,CAAA;CAChB;AAED,MAAM,WAAW,sBAAsB;IACrC,aAAa,EAAE,MAAM,CAAA;IACrB,YAAY,EAAE,MAAM,CAAA;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,MAAM,EAAE,CAAA;CACtB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAA;IACxB,IAAI,EAAE,MAAM,CAAA;CACb;
|
|
1
|
+
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../src/lib/entities/queries.ts"],"names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,33 +1,15 @@
|
|
|
1
1
|
let _cachedRegistry = null;
|
|
2
2
|
let _cachedMetadata = null;
|
|
3
|
+
function setEntityRegistry(registry, metadata) {
|
|
4
|
+
_cachedRegistry = registry;
|
|
5
|
+
_cachedMetadata = metadata || null;
|
|
6
|
+
const entityCount = Object.keys(registry || {}).length;
|
|
7
|
+
console.log(`[EntityQueries] Registry set with ${entityCount} entities`);
|
|
8
|
+
}
|
|
3
9
|
function getRegistry() {
|
|
4
|
-
var _a, _b, _c, _d, _e, _f;
|
|
5
10
|
if (_cachedRegistry) return _cachedRegistry;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const registryPath = path.join(process.cwd(), ".nextspark/registries/entity-registry");
|
|
9
|
-
const registry = require(registryPath);
|
|
10
|
-
_cachedRegistry = registry.ENTITY_REGISTRY;
|
|
11
|
-
_cachedMetadata = registry.ENTITY_METADATA;
|
|
12
|
-
const entityCount = Object.keys(_cachedRegistry || {}).length;
|
|
13
|
-
console.log(`[EntityQueries] Registry loaded successfully with ${entityCount} entities`);
|
|
14
|
-
if (entityCount > 0) {
|
|
15
|
-
const firstKey = Object.keys(_cachedRegistry)[0];
|
|
16
|
-
const firstEntry = _cachedRegistry[firstKey];
|
|
17
|
-
console.log(`[EntityQueries] First entity sample:`, {
|
|
18
|
-
name: firstEntry.name,
|
|
19
|
-
hasConfig: !!firstEntry.config,
|
|
20
|
-
configSlug: (_a = firstEntry.config) == null ? void 0 : _a.slug,
|
|
21
|
-
configEnabled: (_b = firstEntry.config) == null ? void 0 : _b.enabled,
|
|
22
|
-
hasUi: !!((_c = firstEntry.config) == null ? void 0 : _c.ui),
|
|
23
|
-
showInMenu: (_f = (_e = (_d = firstEntry.config) == null ? void 0 : _d.ui) == null ? void 0 : _e.dashboard) == null ? void 0 : _f.showInMenu
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
return _cachedRegistry;
|
|
27
|
-
} catch (error) {
|
|
28
|
-
console.error("[EntityQueries] Registry not available:", error);
|
|
29
|
-
return {};
|
|
30
|
-
}
|
|
11
|
+
console.log("[EntityQueries] Registry not yet initialized (will be set by layout)");
|
|
12
|
+
return {};
|
|
31
13
|
}
|
|
32
14
|
function getRegisteredEntities() {
|
|
33
15
|
return Object.values(getRegistry()).map((entry) => entry.config);
|
|
@@ -122,5 +104,6 @@ export {
|
|
|
122
104
|
getPluginEntities,
|
|
123
105
|
getRegisteredEntities,
|
|
124
106
|
getRootEntities,
|
|
125
|
-
getThemeEntities
|
|
107
|
+
getThemeEntities,
|
|
108
|
+
setEntityRegistry
|
|
126
109
|
};
|
|
@@ -39,7 +39,7 @@ export declare const clientEntityRegistry: ClientEntityRegistry;
|
|
|
39
39
|
export declare function setServerEntities(entities: EntityConfig[]): void;
|
|
40
40
|
/**
|
|
41
41
|
* Client-safe function to get all entity configurations
|
|
42
|
-
*
|
|
42
|
+
* Returns entities from the client registry (populated by DashboardShell)
|
|
43
43
|
*/
|
|
44
44
|
export declare function getAllEntityConfigs(): EntityConfig[];
|
|
45
45
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.client.d.ts","sourceRoot":"","sources":["../../../src/lib/entities/registry.client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAE3C;;GAEG;AACH,cAAM,oBAAoB;IACxB,OAAO,CAAC,QAAQ,CAAuC;IAEvD;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI;IAIpC;;OAEG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS;IAI3C;;OAEG;IACH,MAAM,IAAI,YAAY,EAAE;IAIxB;;OAEG;IACH,UAAU,IAAI,YAAY,EAAE;IAI5B;;OAEG;IACH,KAAK,IAAI,IAAI;CAGd;AAGD,eAAO,MAAM,oBAAoB,sBAA6B,CAAA;AAE9D;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG,IAAI,CAKhE;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"registry.client.d.ts","sourceRoot":"","sources":["../../../src/lib/entities/registry.client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAE3C;;GAEG;AACH,cAAM,oBAAoB;IACxB,OAAO,CAAC,QAAQ,CAAuC;IAEvD;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI;IAIpC;;OAEG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS;IAI3C;;OAEG;IACH,MAAM,IAAI,YAAY,EAAE;IAIxB;;OAEG;IACH,UAAU,IAAI,YAAY,EAAE;IAI5B;;OAEG;IACH,KAAK,IAAI,IAAI;CAGd;AAGD,eAAO,MAAM,oBAAoB,sBAA6B,CAAA;AAE9D;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG,IAAI,CAKhE;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,YAAY,EAAE,CAUpD;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,YAAY,EAAE,CAEnD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAEzD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAEtE"}
|
|
@@ -41,29 +41,10 @@ function setServerEntities(entities) {
|
|
|
41
41
|
}
|
|
42
42
|
function getAllEntityConfigs() {
|
|
43
43
|
const clientEntities = clientEntityRegistry.getAll();
|
|
44
|
-
if (clientEntities.length
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
try {
|
|
48
|
-
const { ENTITY_REGISTRY } = require("@nextsparkjs/registries/entity-registry");
|
|
49
|
-
const { Package } = require("lucide-react");
|
|
50
|
-
return Object.values(ENTITY_REGISTRY).map((entry) => {
|
|
51
|
-
const config = entry.config;
|
|
52
|
-
return {
|
|
53
|
-
...config,
|
|
54
|
-
icon: config.icon || Package,
|
|
55
|
-
// Use fallback icon if original is missing
|
|
56
|
-
i18n: config.i18n ? {
|
|
57
|
-
...config.i18n,
|
|
58
|
-
loaders: {}
|
|
59
|
-
// Remove loader functions (functions can't be serialized to client)
|
|
60
|
-
} : void 0
|
|
61
|
-
};
|
|
62
|
-
}).filter((config) => config.slug);
|
|
63
|
-
} catch (error) {
|
|
64
|
-
console.error("[EntityRegistry] Failed to load from build-time registry:", error);
|
|
65
|
-
return [];
|
|
44
|
+
if (clientEntities.length === 0) {
|
|
45
|
+
console.log("[EntityRegistry] Client registry empty - waiting for hydration from DashboardShell");
|
|
66
46
|
}
|
|
47
|
+
return clientEntities;
|
|
67
48
|
}
|
|
68
49
|
function getEnabledEntities() {
|
|
69
50
|
return clientEntityRegistry.getEnabled();
|
|
@@ -89,7 +89,7 @@ export declare class EntityRegistry {
|
|
|
89
89
|
* Loads from build-time registries (ENTITY_REGISTRY with static imports)
|
|
90
90
|
* PERFORMANCE: Zero runtime I/O, ~17,255x faster than old dynamic system
|
|
91
91
|
*
|
|
92
|
-
* Note: Uses
|
|
92
|
+
* Note: Uses require() for server-side loading (this file is server-only)
|
|
93
93
|
*/
|
|
94
94
|
private loadFromRegistriesServer;
|
|
95
95
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/lib/entities/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,aAAa,CAAA;AAEpB,OAAO,KAAK,EACV,YAAY,EAEZ,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACb,QAAQ,EACR,QAAQ,EACR,iBAAiB,EACjB,qBAAqB,EA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YD;;OAEG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI;IAoBhE;;OAEG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAOhC;;OAEG;IACH,aAAa,IAAI,YAAY,EAAE;IAI/B;;OAEG;IACH,aAAa,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,IAAI;IAI5C;;OAEG;IACH,aAAa,IAAI,OAAO;IAIxB;;OAEG;IACH,KAAK,IAAI,IAAI;IAIb;;OAEG;IACH,KAAK,IAAI,IAAI;CAId;AAGD,eAAO,MAAM,cAAc,gBAAuB,CAAA;AAMlD,wBAAgB,cAAc,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAEzD;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAEtE;AAED,wBAAgB,kBAAkB,IAAI,YAAY,EAAE,CAEnD;AAGD,wBAAgB,eAAe,CAC7B,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,QAAQ,EAClB,SAAS,GAAE,QAAQ,EAAO,GACzB,YAAY,CAEd;AAED;;;GAGG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAEvD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,YAAY,EAAE,CAEpD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB;;;;;EAO/B"}
|
|
@@ -217,23 +217,40 @@ class EntityRegistry {
|
|
|
217
217
|
* Loads from build-time registries (ENTITY_REGISTRY with static imports)
|
|
218
218
|
* PERFORMANCE: Zero runtime I/O, ~17,255x faster than old dynamic system
|
|
219
219
|
*
|
|
220
|
-
* Note: Uses
|
|
220
|
+
* Note: Uses require() for server-side loading (this file is server-only)
|
|
221
221
|
*/
|
|
222
222
|
loadFromRegistriesServer() {
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
223
|
+
try {
|
|
224
|
+
const { ENTITY_REGISTRY } = require("@nextsparkjs/registries/entity-registry");
|
|
225
|
+
const entities = Object.values(ENTITY_REGISTRY).map((entry) => entry.config);
|
|
226
|
+
console.log("[EntityRegistry] Loading entities from build-time registry:", entities.length);
|
|
227
|
+
entities.forEach((config, index) => {
|
|
228
|
+
const name = "slug" in config ? config.slug : `entity-${index}`;
|
|
229
|
+
console.log(`[EntityRegistry] Loading entity ${index + 1}/${entities.length}: ${name}`);
|
|
230
|
+
try {
|
|
231
|
+
this.register(config);
|
|
232
|
+
console.log(`[EntityRegistry] \u2705 Successfully registered: ${name}`);
|
|
233
|
+
} catch (error) {
|
|
234
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
235
|
+
console.error(`[EntityRegistry] \u274C Failed to register ${name}:`, errorMessage);
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
console.log("[EntityRegistry] Finished loading entities. Total registered:", this.entities.size);
|
|
239
|
+
} catch (error) {
|
|
240
|
+
console.error("[EntityRegistry] Error loading entity registry:", error);
|
|
241
|
+
const entities = getRegisteredEntities();
|
|
242
|
+
if (entities.length > 0) {
|
|
243
|
+
console.log("[EntityRegistry] Using fallback cached entities:", entities.length);
|
|
244
|
+
entities.forEach((config, index) => {
|
|
245
|
+
const name = "slug" in config ? config.slug : `entity-${index}`;
|
|
246
|
+
try {
|
|
247
|
+
this.register(config);
|
|
248
|
+
} catch (regError) {
|
|
249
|
+
console.error(`[EntityRegistry] Failed to register ${name}:`, regError);
|
|
250
|
+
}
|
|
251
|
+
});
|
|
234
252
|
}
|
|
235
|
-
}
|
|
236
|
-
console.log("[EntityRegistry] Finished loading entities. Total registered:", this.entities.size);
|
|
253
|
+
}
|
|
237
254
|
}
|
|
238
255
|
/**
|
|
239
256
|
* Get registry statistics
|
package/dist/styles/classes.json
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { DashboardShell } from '@nextsparkjs/core/components/dashboard/layouts/DashboardShell'
|
|
2
2
|
import { serializeEntityConfig, type SerializableEntityConfig } from '@nextsparkjs/core/lib/entities/serialization'
|
|
3
|
+
import { setEntityRegistry } from '@nextsparkjs/core/lib/entities/queries'
|
|
3
4
|
import { getTemplateOrDefault } from '@nextsparkjs/core/lib/template-resolver'
|
|
4
|
-
import { TemplateService } from '@nextsparkjs/core/lib/services/template.service'
|
|
5
5
|
import type { EntityConfig, ChildEntityDefinition } from '@nextsparkjs/core/lib/entities/types'
|
|
6
|
-
// Import registry directly - webpack resolves @nextsparkjs/registries alias
|
|
7
|
-
import { ENTITY_REGISTRY } from '@nextsparkjs/registries/entity-registry'
|
|
6
|
+
// Import registry directly - webpack resolves @nextsparkjs/registries alias at compile time
|
|
7
|
+
import { ENTITY_REGISTRY, ENTITY_METADATA } from '@nextsparkjs/registries/entity-registry'
|
|
8
8
|
|
|
9
|
-
//
|
|
10
|
-
|
|
11
|
-
console.log('[MainLayout] Checking template override for:', LAYOUT_PATH)
|
|
12
|
-
console.log('[MainLayout] hasTemplateOverride:', TemplateService.hasOverride(LAYOUT_PATH))
|
|
13
|
-
console.log('[MainLayout] templateEntry:', TemplateService.getEntry(LAYOUT_PATH)?.template?.themeName)
|
|
9
|
+
// Register entities globally so other parts of the app can access them via getRegisteredEntities()
|
|
10
|
+
setEntityRegistry(ENTITY_REGISTRY, ENTITY_METADATA)
|
|
14
11
|
|
|
15
12
|
// Type guard to check if entity is a full EntityConfig
|
|
16
13
|
function isEntityConfig(entity: EntityConfig | ChildEntityDefinition): entity is EntityConfig {
|
|
@@ -24,24 +21,14 @@ function DefaultMainDashboardLayout({
|
|
|
24
21
|
}: {
|
|
25
22
|
children: React.ReactNode
|
|
26
23
|
}) {
|
|
27
|
-
// Get entities directly from
|
|
24
|
+
// Get entities directly from the imported registry
|
|
28
25
|
const allEntities = Object.values(ENTITY_REGISTRY).map(entry => entry.config)
|
|
29
26
|
// Filter to only include full EntityConfig (not child entities)
|
|
30
27
|
const entities = allEntities.filter(isEntityConfig)
|
|
31
28
|
const serializedEntities: SerializableEntityConfig[] = entities.map(serializeEntityConfig)
|
|
32
29
|
|
|
33
|
-
// DEBUG: Log entity data
|
|
34
|
-
console.log('[MainLayout]
|
|
35
|
-
console.log('[MainLayout] Filtered entities count:', entities.length)
|
|
36
|
-
if (entities.length > 0) {
|
|
37
|
-
const first = entities[0]
|
|
38
|
-
console.log('[MainLayout] First entity sample:', {
|
|
39
|
-
slug: first.slug,
|
|
40
|
-
enabled: first.enabled,
|
|
41
|
-
hasUi: !!first.ui,
|
|
42
|
-
showInMenu: first.ui?.dashboard?.showInMenu
|
|
43
|
-
})
|
|
44
|
-
}
|
|
30
|
+
// DEBUG: Log entity data
|
|
31
|
+
console.log('[MainLayout] Entities count:', entities.length)
|
|
45
32
|
|
|
46
33
|
return (
|
|
47
34
|
<DashboardShell entities={serializedEntities}>
|
package/package.json
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { DashboardShell } from '@nextsparkjs/core/components/dashboard/layouts/DashboardShell'
|
|
2
2
|
import { serializeEntityConfig, type SerializableEntityConfig } from '@nextsparkjs/core/lib/entities/serialization'
|
|
3
|
+
import { setEntityRegistry } from '@nextsparkjs/core/lib/entities/queries'
|
|
3
4
|
import { getTemplateOrDefault } from '@nextsparkjs/core/lib/template-resolver'
|
|
4
|
-
import { TemplateService } from '@nextsparkjs/core/lib/services/template.service'
|
|
5
5
|
import type { EntityConfig, ChildEntityDefinition } from '@nextsparkjs/core/lib/entities/types'
|
|
6
|
-
// Import registry directly - webpack resolves @nextsparkjs/registries alias
|
|
7
|
-
import { ENTITY_REGISTRY } from '@nextsparkjs/registries/entity-registry'
|
|
6
|
+
// Import registry directly - webpack resolves @nextsparkjs/registries alias at compile time
|
|
7
|
+
import { ENTITY_REGISTRY, ENTITY_METADATA } from '@nextsparkjs/registries/entity-registry'
|
|
8
8
|
|
|
9
|
-
//
|
|
10
|
-
|
|
11
|
-
console.log('[MainLayout] Checking template override for:', LAYOUT_PATH)
|
|
12
|
-
console.log('[MainLayout] hasTemplateOverride:', TemplateService.hasOverride(LAYOUT_PATH))
|
|
13
|
-
console.log('[MainLayout] templateEntry:', TemplateService.getEntry(LAYOUT_PATH)?.template?.themeName)
|
|
9
|
+
// Register entities globally so other parts of the app can access them via getRegisteredEntities()
|
|
10
|
+
setEntityRegistry(ENTITY_REGISTRY, ENTITY_METADATA)
|
|
14
11
|
|
|
15
12
|
// Type guard to check if entity is a full EntityConfig
|
|
16
13
|
function isEntityConfig(entity: EntityConfig | ChildEntityDefinition): entity is EntityConfig {
|
|
@@ -24,24 +21,14 @@ function DefaultMainDashboardLayout({
|
|
|
24
21
|
}: {
|
|
25
22
|
children: React.ReactNode
|
|
26
23
|
}) {
|
|
27
|
-
// Get entities directly from
|
|
24
|
+
// Get entities directly from the imported registry
|
|
28
25
|
const allEntities = Object.values(ENTITY_REGISTRY).map(entry => entry.config)
|
|
29
26
|
// Filter to only include full EntityConfig (not child entities)
|
|
30
27
|
const entities = allEntities.filter(isEntityConfig)
|
|
31
28
|
const serializedEntities: SerializableEntityConfig[] = entities.map(serializeEntityConfig)
|
|
32
29
|
|
|
33
|
-
// DEBUG: Log entity data
|
|
34
|
-
console.log('[MainLayout]
|
|
35
|
-
console.log('[MainLayout] Filtered entities count:', entities.length)
|
|
36
|
-
if (entities.length > 0) {
|
|
37
|
-
const first = entities[0]
|
|
38
|
-
console.log('[MainLayout] First entity sample:', {
|
|
39
|
-
slug: first.slug,
|
|
40
|
-
enabled: first.enabled,
|
|
41
|
-
hasUi: !!first.ui,
|
|
42
|
-
showInMenu: first.ui?.dashboard?.showInMenu
|
|
43
|
-
})
|
|
44
|
-
}
|
|
30
|
+
// DEBUG: Log entity data
|
|
31
|
+
console.log('[MainLayout] Entities count:', entities.length)
|
|
45
32
|
|
|
46
33
|
return (
|
|
47
34
|
<DashboardShell entities={serializedEntities}>
|