@coreframe/dashboard 0.4.0-next.2 → 0.4.0-next.4
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 +12 -2
- package/dist/package/build.js +2 -2
- package/dist/package/config.d.ts +6 -1
- package/dist/package/web-shell/shell.js +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -26,8 +26,18 @@ Removing `diagnostics()` removes the feature's root navigation entry and its run
|
|
|
26
26
|
Plugins are never discovered or installed at runtime.
|
|
27
27
|
|
|
28
28
|
Add app-owned routes at `dashboard/pages/<slug>/route.tsx`. An optional adjacent `page.yaml` may
|
|
29
|
-
define `title` and `
|
|
30
|
-
|
|
29
|
+
define `title`, `description`, and `layout`. Set `layout: standalone` when a page owns its full
|
|
30
|
+
viewport presentation and should render without the dashboard navigation, heading, or shell spacing.
|
|
31
|
+
|
|
32
|
+
```yaml
|
|
33
|
+
title: Moderation
|
|
34
|
+
layout: standalone
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Omitting `layout`, or setting it to `default`, retains the standard shell. Standalone pages remain in
|
|
38
|
+
the dashboard route, build, authentication, query-client, and error-handling boundaries. Build-time
|
|
39
|
+
composition validates slugs, metadata, route modules, identifiers, and paths before generating the
|
|
40
|
+
React Router route graph and navigation manifest.
|
|
31
41
|
|
|
32
42
|
The generated dashboard does not need route adapters, a document root, a query-client module, or an
|
|
33
43
|
entry file. Keep those defaults in the package unless the dashboard build contract itself must
|
package/dist/package/build.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{getDashboardPluginBuild as e}from"./config.js";import{createRequire as t}from"node:module";import{readFile as n,readdir as r}from"node:fs/promises";import{isAbsolute as i,join as a,resolve as o}from"node:path";import{parseDocument as s}from"yaml";import{z as c}from"zod";const l=/^[a-z0-9]+(?:-[a-z0-9]+)*$/u,u=c.object({title:c.string().trim().min(1,`title must not be empty`).optional(),description:c.string().trim().min(1,`description must not be empty`).optional()}).strict(),d=c.object({id:c.string(),path:c.string(),title:c.string(),description:c.string().optional(),routeModule:c.string(),environments:c.array(c.enum([`local`,`deployed`])).optional()}).strict(),f=c.string().trim().min(1,`module reference must not be empty`),p=c.object({path:c.string(),title:c.string(),description:c.string().optional(),environments:c.array(c.enum([`local`,`deployed`])).optional()}).strict(),m=c.object({document:f.optional(),plugins:c.array(c.object({id:c.string(),navigation:p,pageModule:f,api:c.unknown().optional()}).strict()).optional()}).strict();async function h(e={}){let t=a(o(e.dashboardDirectory??a(process.cwd(),`dashboard`)),`pages`),i;try{i=await r(t,{withFileTypes:!0})}catch(e){if(N(e)&&e.code===`ENOENT`)return[];throw new S(t,`could not read the pages directory`,e)}let s=i.filter(e=>e.isDirectory()&&!e.name.startsWith(`.`)).sort((e,t)=>M(e.name,t.name));return Promise.all(s.map(async({name:e})=>{let r=a(t,e);A(e,r,`page directory`);let i=a(r,`route.tsx`);try{await n(i)}catch(e){throw N(e)&&e.code===`ENOENT`?new S(i,`missing required React Router route.tsx`):new S(i,`could not read route.tsx`,e)}let o=await C(a(r,`page.yaml`));return{id:e,path:e,title:o?.title??j(e),...o?.description?{description:o.description}:{},routeModule:`pages/${e}/route.tsx`}}))}function g(e,t,n={}){let r=n.environment??`local`,i=new Set,a=[],o=O(e);for(let e of o.plugins??[]){if(A(e.id,`dashboard.config.ts plugin "${e.id}"`,`plugin id`),i.has(e.id))throw new S(`dashboard.config.ts`,`duplicate plugin id "${e.id}"`);i.add(e.id);let t=T(e,`plugin`,r);t&&a.push(t)}let s=t.map(e=>({page:e,normalizedPage:w(e,`app`)})).sort((e,t)=>M(e.normalizedPage.path,t.normalizedPage.path));for(let{page:e,normalizedPage:t}of s)D(e,r)&&a.push(t);return E(a),a}function _(e,t){let n=O(e),r=new Set,i=[];for(let e of n.plugins??[]){if(A(e.id,`dashboard.config.ts plugin "${e.id}"`,`plugin id`),r.has(e.id))throw new S(`dashboard.config.ts`,`duplicate plugin id "${e.id}"`);if(r.add(e.id),!e.api)continue;let n=k(e,`dashboard API`),a=t===`local`?n.localImplementationModule:n.deployedImplementationModule;a&&i.push({pluginId:e.id,apiModule:n.apiModule,implementationModule:a})}return i}function v(e){let t=[],n=[];for(let[r,i]of e.entries())t.push(`import api${r} from ${JSON.stringify(i.apiModule)}`,`import { createImplementation as createImplementation${r} } from ${JSON.stringify(i.implementationModule)}`),n.push(`{ api: api${r}, createImplementation: createImplementation${r} }`);return`${t.join(`
|
|
1
|
+
import{getDashboardPluginBuild as e}from"./config.js";import{createRequire as t}from"node:module";import{readFile as n,readdir as r}from"node:fs/promises";import{isAbsolute as i,join as a,resolve as o}from"node:path";import{parseDocument as s}from"yaml";import{z as c}from"zod";const l=/^[a-z0-9]+(?:-[a-z0-9]+)*$/u,u=c.object({title:c.string().trim().min(1,`title must not be empty`).optional(),description:c.string().trim().min(1,`description must not be empty`).optional(),layout:c.enum([`default`,`standalone`]).optional()}).strict(),d=c.object({id:c.string(),path:c.string(),title:c.string(),description:c.string().optional(),layout:c.enum([`default`,`standalone`]).optional(),routeModule:c.string(),environments:c.array(c.enum([`local`,`deployed`])).optional()}).strict(),f=c.string().trim().min(1,`module reference must not be empty`),p=c.object({path:c.string(),title:c.string(),description:c.string().optional(),environments:c.array(c.enum([`local`,`deployed`])).optional()}).strict(),m=c.object({document:f.optional(),plugins:c.array(c.object({id:c.string(),navigation:p,pageModule:f,api:c.unknown().optional()}).strict()).optional()}).strict();async function h(e={}){let t=a(o(e.dashboardDirectory??a(process.cwd(),`dashboard`)),`pages`),i;try{i=await r(t,{withFileTypes:!0})}catch(e){if(N(e)&&e.code===`ENOENT`)return[];throw new S(t,`could not read the pages directory`,e)}let s=i.filter(e=>e.isDirectory()&&!e.name.startsWith(`.`)).sort((e,t)=>M(e.name,t.name));return Promise.all(s.map(async({name:e})=>{let r=a(t,e);A(e,r,`page directory`);let i=a(r,`route.tsx`);try{await n(i)}catch(e){throw N(e)&&e.code===`ENOENT`?new S(i,`missing required React Router route.tsx`):new S(i,`could not read route.tsx`,e)}let o=await C(a(r,`page.yaml`));return{id:e,path:e,title:o?.title??j(e),...o?.description?{description:o.description}:{},...o?.layout?{layout:o.layout}:{},routeModule:`pages/${e}/route.tsx`}}))}function g(e,t,n={}){let r=n.environment??`local`,i=new Set,a=[],o=O(e);for(let e of o.plugins??[]){if(A(e.id,`dashboard.config.ts plugin "${e.id}"`,`plugin id`),i.has(e.id))throw new S(`dashboard.config.ts`,`duplicate plugin id "${e.id}"`);i.add(e.id);let t=T(e,`plugin`,r);t&&a.push(t)}let s=t.map(e=>({page:e,normalizedPage:w(e,`app`)})).sort((e,t)=>M(e.normalizedPage.path,t.normalizedPage.path));for(let{page:e,normalizedPage:t}of s)D(e,r)&&a.push(t);return E(a),a}function _(e,t){let n=O(e),r=new Set,i=[];for(let e of n.plugins??[]){if(A(e.id,`dashboard.config.ts plugin "${e.id}"`,`plugin id`),r.has(e.id))throw new S(`dashboard.config.ts`,`duplicate plugin id "${e.id}"`);if(r.add(e.id),!e.api)continue;let n=k(e,`dashboard API`),a=t===`local`?n.localImplementationModule:n.deployedImplementationModule;a&&i.push({pluginId:e.id,apiModule:n.apiModule,implementationModule:a})}return i}function v(e){let t=[],n=[];for(let[r,i]of e.entries())t.push(`import api${r} from ${JSON.stringify(i.apiModule)}`,`import { createImplementation as createImplementation${r} } from ${JSON.stringify(i.implementationModule)}`),n.push(`{ api: api${r}, createImplementation: createImplementation${r} }`);return`${t.join(`
|
|
2
2
|
`)}\n\nexport const dashboardPlugins = [\n${n.map(e=>` ${e},`).join(`
|
|
3
|
-
`)}\n]\n`}function y(e,t){let n=[e.length>0?{index:!0,file:t.indexRoute}:{index:!0,file:t.emptyRoute},...e.map(e=>({id:`dashboard-page-${e.id}`,path:e.path,file:e.routeModule})),...t.notFoundRoute?[{path:`*`,file:t.notFoundRoute}]:[]];return[{id:`dashboard-shell`,file:t.shellRoute,children:n}]}function b(e,t={}){let n=o(t.dashboardDirectory??a(process.cwd(),`dashboard`));return e.map(e=>({...e,routeModule:e.source===`app`?o(n,e.routeModule):x(e.routeModule,t)}))}function x(e,n={}){let r=o(n.dashboardDirectory??a(process.cwd(),`dashboard`)),s=t(a(o(n.projectRoot??a(r,`..`)),`package.json`));if(i(e)||e.startsWith(`.`))return o(r,e);try{return s.resolve(e)}catch(t){throw new S(e,`could not resolve dashboard module`,t)}}var S=class extends Error{file;constructor(e,t,n){super(`${e}: ${t}`,{cause:n}),this.name=`DashboardCompositionError`,this.file=e}};async function C(e){let t;try{t=await n(e,`utf8`)}catch(t){if(N(t)&&t.code===`ENOENT`)return;throw new S(e,`could not read page metadata`,t)}let r=s(t,{prettyErrors:!0,strict:!0,uniqueKeys:!0});if(r.errors.length>0)throw new S(e,r.errors[0]?.message??`invalid YAML`);let i=u.safeParse(r.toJS());if(!i.success)throw new S(e,c.prettifyError(i.error));return i.data}function w(e,t,n){let r=t===`plugin`?`dashboard.config.ts plugin "${n??`unknown`}" page "${e.id}"`:e.routeModule,i=d.safeParse(e);if(!i.success)throw new S(r,c.prettifyError(i.error));let a=i.data;A(a.id,r,`page id`),A(a.path,r,`page path`);let o=a.title.trim();if(!o)throw new S(r,`page title must not be empty`);if(!a.routeModule.trim())throw new S(r,`page routeModule must not be empty`);let s=a.description?.trim();if(a.description!==void 0&&!s)throw new S(r,`page description must not be empty`);return{id:a.id,path:a.path,title:o,...s?{description:s}:{},routeModule:a.routeModule,source:t,...n?{pluginId:n}:{}}}function T(e,t,n){let r=`dashboard.config.ts plugin "${e.id}"`,i=p.safeParse(e.navigation);if(!i.success)throw new S(r,c.prettifyError(i.error));let a=i.data;if(A(e.id,r,`plugin id`),A(a.path,r,`navigation path`),!a.title.trim())throw new S(r,`navigation title must not be empty`);if(a.description!==void 0&&!a.description.trim())throw new S(r,`navigation description must not be empty`);if(!e.pageModule.trim())throw new S(r,`pageModule must not be empty`);if(!(a.environments&&!a.environments.includes(n))){if(e.api){let t=k(e,`dashboard API`);if(n===`local`&&!t.localImplementationModule||n===`deployed`&&!t.deployedImplementationModule)return}return w({id:e.id,path:a.path,title:a.title,...a.description?{description:a.description}:{},routeModule:e.pageModule,...a.environments?{environments:a.environments}:{}},t,e.id)}}function E(e){let t=new Map,n=new Map;for(let r of e){let e=t.get(r.id);if(e)throw new S(r.routeModule,`duplicate page id "${r.id}" also contributed by ${e.routeModule}`);t.set(r.id,r);let i=n.get(r.path);if(i)throw new S(r.routeModule,`duplicate page path "${r.path}" also contributed by ${i.routeModule}`);n.set(r.path,r)}}function D(e,t){return e.environments?e.environments.includes(t):!0}function O(e){let t=m.safeParse(e);if(!t.success)throw new S(`dashboard.config.ts`,c.prettifyError(t.error));return e}function k(t,n){let r=e(t);if(!r)throw new S(`dashboard.config.ts plugin "${t.id}"`,`${n} is missing its package-owned build descriptor`);if(t.api&&t.api.id!==t.id)throw new S(`dashboard.config.ts plugin "${t.id}"`,`API id "${t.api.id}" does not match the plugin id`);for(let e of[`apiModule`,`localImplementationModule`]){let n=r[e];if(typeof n!=`string`||!n.trim())throw new S(`dashboard.config.ts plugin "${t.id}"`,`build descriptor field "${e}" must be a non-empty module reference`)}if(r.deployedImplementationModule!==void 0&&(typeof r.deployedImplementationModule!=`string`||!r.deployedImplementationModule.trim()))throw new S(`dashboard.config.ts plugin "${t.id}"`,`build descriptor field "deployedImplementationModule" must be a non-empty module reference`);return r}function A(e,t,n){if(!l.test(e))throw new S(t,`${n} "${e}" must contain only lowercase letters, numbers, and single hyphens`)}function j(e){let t=e.split(`-`).join(` `);return`${t.charAt(0).toUpperCase()}${t.slice(1)}`}function M(e,t){return e<t?-1:+(e>t)}function N(e){return e instanceof Error&&`code`in e}export{S as DashboardCompositionError,g as composeDashboardManifest,_ as composeDashboardPluginTarget,y as composeDashboardRoutes,h as discoverDashboardPages,v as renderDashboardPluginTargetModule,x as resolveDashboardModuleReference,b as resolveDashboardRouteModules};
|
|
3
|
+
`)}\n]\n`}function y(e,t){let n=[e.length>0?{index:!0,file:t.indexRoute}:{index:!0,file:t.emptyRoute},...e.map(e=>({id:`dashboard-page-${e.id}`,path:e.path,file:e.routeModule})),...t.notFoundRoute?[{path:`*`,file:t.notFoundRoute}]:[]];return[{id:`dashboard-shell`,file:t.shellRoute,children:n}]}function b(e,t={}){let n=o(t.dashboardDirectory??a(process.cwd(),`dashboard`));return e.map(e=>({...e,routeModule:e.source===`app`?o(n,e.routeModule):x(e.routeModule,t)}))}function x(e,n={}){let r=o(n.dashboardDirectory??a(process.cwd(),`dashboard`)),s=t(a(o(n.projectRoot??a(r,`..`)),`package.json`));if(i(e)||e.startsWith(`.`))return o(r,e);try{return s.resolve(e)}catch(t){throw new S(e,`could not resolve dashboard module`,t)}}var S=class extends Error{file;constructor(e,t,n){super(`${e}: ${t}`,{cause:n}),this.name=`DashboardCompositionError`,this.file=e}};async function C(e){let t;try{t=await n(e,`utf8`)}catch(t){if(N(t)&&t.code===`ENOENT`)return;throw new S(e,`could not read page metadata`,t)}let r=s(t,{prettyErrors:!0,strict:!0,uniqueKeys:!0});if(r.errors.length>0)throw new S(e,r.errors[0]?.message??`invalid YAML`);let i=u.safeParse(r.toJS());if(!i.success)throw new S(e,c.prettifyError(i.error));return i.data}function w(e,t,n){let r=t===`plugin`?`dashboard.config.ts plugin "${n??`unknown`}" page "${e.id}"`:e.routeModule,i=d.safeParse(e);if(!i.success)throw new S(r,c.prettifyError(i.error));let a=i.data;A(a.id,r,`page id`),A(a.path,r,`page path`);let o=a.title.trim();if(!o)throw new S(r,`page title must not be empty`);if(!a.routeModule.trim())throw new S(r,`page routeModule must not be empty`);let s=a.description?.trim();if(a.description!==void 0&&!s)throw new S(r,`page description must not be empty`);return{id:a.id,path:a.path,title:o,...s?{description:s}:{},...a.layout?{layout:a.layout}:{},routeModule:a.routeModule,source:t,...n?{pluginId:n}:{}}}function T(e,t,n){let r=`dashboard.config.ts plugin "${e.id}"`,i=p.safeParse(e.navigation);if(!i.success)throw new S(r,c.prettifyError(i.error));let a=i.data;if(A(e.id,r,`plugin id`),A(a.path,r,`navigation path`),!a.title.trim())throw new S(r,`navigation title must not be empty`);if(a.description!==void 0&&!a.description.trim())throw new S(r,`navigation description must not be empty`);if(!e.pageModule.trim())throw new S(r,`pageModule must not be empty`);if(!(a.environments&&!a.environments.includes(n))){if(e.api){let t=k(e,`dashboard API`);if(n===`local`&&!t.localImplementationModule||n===`deployed`&&!t.deployedImplementationModule)return}return w({id:e.id,path:a.path,title:a.title,...a.description?{description:a.description}:{},routeModule:e.pageModule,...a.environments?{environments:a.environments}:{}},t,e.id)}}function E(e){let t=new Map,n=new Map;for(let r of e){let e=t.get(r.id);if(e)throw new S(r.routeModule,`duplicate page id "${r.id}" also contributed by ${e.routeModule}`);t.set(r.id,r);let i=n.get(r.path);if(i)throw new S(r.routeModule,`duplicate page path "${r.path}" also contributed by ${i.routeModule}`);n.set(r.path,r)}}function D(e,t){return e.environments?e.environments.includes(t):!0}function O(e){let t=m.safeParse(e);if(!t.success)throw new S(`dashboard.config.ts`,c.prettifyError(t.error));return e}function k(t,n){let r=e(t);if(!r)throw new S(`dashboard.config.ts plugin "${t.id}"`,`${n} is missing its package-owned build descriptor`);if(t.api&&t.api.id!==t.id)throw new S(`dashboard.config.ts plugin "${t.id}"`,`API id "${t.api.id}" does not match the plugin id`);for(let e of[`apiModule`,`localImplementationModule`]){let n=r[e];if(typeof n!=`string`||!n.trim())throw new S(`dashboard.config.ts plugin "${t.id}"`,`build descriptor field "${e}" must be a non-empty module reference`)}if(r.deployedImplementationModule!==void 0&&(typeof r.deployedImplementationModule!=`string`||!r.deployedImplementationModule.trim()))throw new S(`dashboard.config.ts plugin "${t.id}"`,`build descriptor field "deployedImplementationModule" must be a non-empty module reference`);return r}function A(e,t,n){if(!l.test(e))throw new S(t,`${n} "${e}" must contain only lowercase letters, numbers, and single hyphens`)}function j(e){let t=e.split(`-`).join(` `);return`${t.charAt(0).toUpperCase()}${t.slice(1)}`}function M(e,t){return e<t?-1:+(e>t)}function N(e){return e instanceof Error&&`code`in e}export{S as DashboardCompositionError,g as composeDashboardManifest,_ as composeDashboardPluginTarget,y as composeDashboardRoutes,h as discoverDashboardPages,v as renderDashboardPluginTargetModule,x as resolveDashboardModuleReference,b as resolveDashboardRouteModules};
|
package/dist/package/config.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import { DashboardPluginApi } from "./api/contract.js";
|
|
|
2
2
|
|
|
3
3
|
//#region src/config.d.ts
|
|
4
4
|
type DashboardEnvironment = "local" | "deployed";
|
|
5
|
+
/** Presentation supplied around a dashboard page route. */
|
|
6
|
+
type DashboardPageLayout = "default" | "standalone";
|
|
5
7
|
interface DashboardPageContribution {
|
|
6
8
|
/** Stable page identity. It must be a lowercase, URL-safe slug. */
|
|
7
9
|
id: string;
|
|
@@ -9,6 +11,8 @@ interface DashboardPageContribution {
|
|
|
9
11
|
path: string;
|
|
10
12
|
title: string;
|
|
11
13
|
description?: string;
|
|
14
|
+
/** Presentation supplied around the route. Defaults to the dashboard shell. */
|
|
15
|
+
layout?: DashboardPageLayout;
|
|
12
16
|
/** React Router framework route module, resolved by the dashboard build. */
|
|
13
17
|
routeModule: string;
|
|
14
18
|
/** Environments where the page can be included. Defaults to both. */
|
|
@@ -57,6 +61,7 @@ interface DashboardPageManifestEntry {
|
|
|
57
61
|
path: string;
|
|
58
62
|
title: string;
|
|
59
63
|
description?: string;
|
|
64
|
+
layout?: DashboardPageLayout;
|
|
60
65
|
routeModule: string;
|
|
61
66
|
source: "app" | "plugin";
|
|
62
67
|
pluginId?: string;
|
|
@@ -72,4 +77,4 @@ declare function definePlugin<const Plugin extends DashboardPlugin>(plugin: Plug
|
|
|
72
77
|
/** @internal Used by the dashboard build composer to read package-owned target metadata. */
|
|
73
78
|
declare function getDashboardPluginBuild(plugin: DashboardPlugin): DashboardPluginBuild | undefined;
|
|
74
79
|
//#endregion
|
|
75
|
-
export { DashboardConfig, DashboardEnvironment, DashboardPageContribution, DashboardPageManifestEntry, DashboardPlugin, DashboardPluginBuild, DashboardPluginNavigation, defineConfig, definePlugin, getDashboardPluginBuild };
|
|
80
|
+
export { DashboardConfig, DashboardEnvironment, DashboardPageContribution, DashboardPageLayout, DashboardPageManifestEntry, DashboardPlugin, DashboardPluginBuild, DashboardPluginNavigation, defineConfig, definePlugin, getDashboardPluginBuild };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useEffect as e,useRef as t,useState as n}from"react";import{Link as r,NavLink as i,Navigate as a,Outlet as o,isRouteErrorResponse as s,useLocation as c,useNavigation as l,useRouteError as u}from"react-router";import{jsx as d,jsxs as f}from"react/jsx-runtime";function p({pages:
|
|
1
|
+
import{useEffect as e,useRef as t,useState as n}from"react";import{Link as r,NavLink as i,Navigate as a,Outlet as o,isRouteErrorResponse as s,useLocation as c,useNavigation as l,useRouteError as u}from"react-router";import{jsx as d,jsxs as f}from"react/jsx-runtime";function p({pages:e}){let t=v(e,c().pathname);return t?.layout===`standalone`?d(o,{}):d(m,{activePage:t,pages:e})}function m({activePage:r,pages:a}){let s=l(),[c,u]=n(()=>globalThis.window!==void 0&&globalThis.matchMedia(`(max-width: 47.999rem)`).matches),[p,m]=n(!1),[h,g]=n(!1),_=t(null),v=t(null),y=t(!1);e(()=>{let e=globalThis.matchMedia(`(max-width: 47.999rem)`),t=()=>u(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),e(()=>{c&&(p?v.current?.focus():y.current&&_.current?.focus(),y.current=p)},[c,p]),e(()=>{if(!p)return;let e=e=>{e.key===`Escape`&&m(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[p]);let b=c?p:!h;return f(`div`,{className:`coreframe-dashboard`,"data-collapsed":!c&&h?`true`:`false`,"data-drawer-open":c&&p?`true`:`false`,children:[d(`button`,{ref:_,type:`button`,className:`coreframe-dashboard__toggle`,"aria-controls":`coreframe-dashboard-navigation`,"aria-expanded":b,"aria-label":b?`Collapse dashboard navigation`:`Expand dashboard navigation`,onClick:()=>{c?m(e=>!e):g(e=>!e)},children:d(`span`,{"aria-hidden":`true`,children:b?`←`:`☰`})}),d(`button`,{type:`button`,className:`coreframe-dashboard__backdrop`,"aria-label":`Close dashboard navigation`,tabIndex:c&&p?0:-1,onClick:()=>m(!1)}),d(`aside`,{className:`coreframe-dashboard__sidebar`,role:c?`dialog`:void 0,"aria-label":c?`Dashboard navigation`:void 0,"aria-modal":c&&p?!0:void 0,"aria-hidden":c&&!p?!0:void 0,inert:c&&!p?!0:void 0,children:f(`nav`,{ref:v,id:`coreframe-dashboard-navigation`,className:`coreframe-dashboard__navigation`,"aria-label":`Dashboard`,tabIndex:c?-1:void 0,children:[f(`div`,{className:`coreframe-dashboard__brand`,"aria-label":`Coreframe Dashboard`,children:[d(`span`,{"aria-hidden":`true`,className:`coreframe-dashboard__mark`,children:`C`}),d(`span`,{className:`coreframe-dashboard__navigation-text`,children:`Coreframe`})]}),a.length>0?d(`ul`,{className:`coreframe-dashboard__navigation-list`,children:a.map(e=>d(`li`,{children:f(i,{className:`coreframe-dashboard__navigation-link`,to:`/${e.path}`,onClick:()=>m(!1),children:[d(`span`,{"aria-hidden":`true`,className:`coreframe-dashboard__navigation-dot`}),d(`span`,{className:`coreframe-dashboard__navigation-text`,children:e.title})]})},e.id))}):d(`p`,{className:`coreframe-dashboard__navigation-empty`,children:`No pages`})]})}),f(`main`,{className:`coreframe-dashboard__main`,children:[r?f(`header`,{className:`coreframe-dashboard__page-header`,children:[d(`p`,{className:`coreframe-dashboard__eyebrow`,children:`Dashboard`}),d(`h1`,{children:r.title}),r.description?d(`p`,{children:r.description}):null]}):null,s.state===`idle`?null:d(`div`,{className:`coreframe-dashboard__pending`,role:`status`,children:`Loading page…`}),d(`div`,{className:`coreframe-dashboard__content`,children:d(o,{})})]})]})}function h({pages:e}){let t=e[0];return t?d(a,{replace:!0,to:`/${t.path}`}):d(g,{})}function g(){return f(`section`,{className:`coreframe-dashboard__state`,"aria-labelledby":`dashboard-empty-title`,children:[d(`p`,{className:`coreframe-dashboard__eyebrow`,children:`Dashboard`}),d(`h1`,{id:`dashboard-empty-title`,children:`No dashboard pages yet`}),f(`p`,{children:[`Add a page under `,d(`code`,{children:`dashboard/pages/`}),` or register a plugin in`,` `,d(`code`,{children:`dashboard.config.ts`}),`.`]})]})}function _(){let e=u(),t=s(e)&&e.status===404,n=import.meta.env.DEV&&e instanceof Error?e.message:t?`The requested dashboard page does not exist.`:`The dashboard hit an unexpected error.`;return f(`main`,{className:`coreframe-dashboard__state`,children:[d(`p`,{className:`coreframe-dashboard__eyebrow`,children:`Coreframe Dashboard`}),d(`h1`,{children:t?`Page not found`:`Dashboard unavailable`}),d(`p`,{children:n}),d(r,{className:`coreframe-dashboard__button`,to:`/`,children:`Go to dashboard`})]})}function v(e,t){let n=t.split(`/`).filter(Boolean)[0];return e.find(e=>e.path===n)??(n?void 0:e[0])}export{g as DashboardEmptyState,_ as DashboardErrorBoundary,h as DashboardIndexRedirect,p as DashboardShell};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coreframe/dashboard",
|
|
3
|
-
"version": "0.4.0-next.
|
|
3
|
+
"version": "0.4.0-next.4",
|
|
4
4
|
"description": "Reusable dashboard composition, shell, plugin, and authenticated runtime for Coreframe apps",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -87,9 +87,9 @@
|
|
|
87
87
|
"rouzer": "^6.0.1",
|
|
88
88
|
"yaml": "^2.9.0",
|
|
89
89
|
"zod": "^4.4.3",
|
|
90
|
+
"@coreframe/deploy": "0.1.15-next.3",
|
|
90
91
|
"@coreframe/diagnostics": "0.2.4-next.0",
|
|
91
|
-
"@coreframe/lib": "^0.2.16-next.
|
|
92
|
-
"@coreframe/deploy": "0.1.15-next.1"
|
|
92
|
+
"@coreframe/lib": "^0.2.16-next.3"
|
|
93
93
|
},
|
|
94
94
|
"devDependencies": {
|
|
95
95
|
"@pandacss/dev": "2.0.0-beta.8",
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
"typescript": "6.0.3",
|
|
104
104
|
"vite": "^8.1.4",
|
|
105
105
|
"vitest": "^4.1.10",
|
|
106
|
-
"@coreframe/panda": "0.1.10-next.
|
|
106
|
+
"@coreframe/panda": "0.1.10-next.3"
|
|
107
107
|
},
|
|
108
108
|
"scripts": {
|
|
109
109
|
"build": "pnpm --dir ../diagnostics build && pnpm build:server",
|