@coreframe/dashboard 0.4.0-next.4 → 0.4.1
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 +230 -25
- package/dist/package/access.d.ts +7 -0
- package/dist/package/access.js +30 -0
- package/dist/package/app/client-route.d.ts +7 -0
- package/dist/package/app/client-route.js +1 -0
- package/dist/package/app/entry.browser.d.ts +1 -0
- package/dist/package/app/entry.browser.js +1 -0
- package/dist/package/app/not-found.js +1 -1
- package/dist/package/app/providers.js +1 -0
- package/dist/package/app/root.js +1 -1
- package/dist/package/app/sculpted-runtime.js +1 -0
- package/dist/package/app/shell.js +1 -1
- package/dist/package/app-client.d.ts +5 -4
- package/dist/package/app-client.js +1 -1
- package/dist/package/build.js +2 -2
- package/dist/package/config.d.ts +15 -3
- package/dist/package/index.d.ts +3 -3
- package/dist/package/node-fetch-adapter.js +1 -1
- package/dist/package/server.d.ts +8 -2
- package/dist/package/server.js +1 -1
- package/dist/package/types.d.ts +1 -17
- package/dist/package/web/styled-system/css/conditions.js +1 -1
- package/dist/package/web/styled-system/helpers.js +1 -1
- package/dist/package/web/styled-system/recipes/dashboard-button.js +1 -1
- package/dist/package/web/styled-system/recipes/dashboard-status.js +1 -1
- package/dist/package/web/styled-system/recipes/runtime.js +1 -1
- package/dist/package/web/ui/index.d.ts +1 -1
- package/dist/package/web/ui/styles.js +1 -1
- package/dist/package/web-shell/index.d.ts +2 -1
- package/dist/package/web-shell/index.js +1 -1
- package/dist/package/web-shell/menu.d.ts +19 -0
- package/dist/package/web-shell/menu.js +1 -0
- package/dist/package/web-shell/shell.d.ts +7 -6
- package/dist/package/web-shell/shell.js +6 -1
- package/dist/package/worker.d.ts +3 -3
- package/dist/package/worker.js +1 -1
- package/package.json +16 -33
- package/dist/package/plugins/diagnostics/api/contract.d.ts +0 -10
- package/dist/package/plugins/diagnostics/api/contract.js +0 -1
- package/dist/package/plugins/diagnostics/api/local.d.ts +0 -10
- package/dist/package/plugins/diagnostics/api/local.js +0 -1
- package/dist/package/plugins/diagnostics/api/worker.d.ts +0 -8
- package/dist/package/plugins/diagnostics/api/worker.js +0 -1
- package/dist/package/plugins/diagnostics/index.d.ts +0 -30
- package/dist/package/plugins/diagnostics/index.js +0 -1
- package/dist/package/plugins/diagnostics/web/queries.js +0 -1
- package/dist/package/plugins/diagnostics/web.d.ts +0 -4
- package/dist/package/plugins/diagnostics/web.js +0 -1
- package/dist/package/shell.css +0 -390
- package/dist/package/styled-css.js +0 -1
- package/dist/package/web/dashboard/dashboard-page.js +0 -1
- package/dist/package/web/dashboard/dashboard-section.js +0 -1
- package/dist/package/web/dashboard/dashboard.style.js +0 -1
- package/dist/package/web/dashboard/deployed-dashboard-page.js +0 -1
- package/dist/package/web/dashboard/findings.js +0 -1
- package/dist/package/web/dashboard/worker-environment.js +0 -1
- package/dist/package/web/root.style.js +0 -1
- package/dist/package/web/styled-system/css/css.js +0 -1
package/dist/package/server.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{dashboardAccessResponse as e}from"./access.js";import{createDashboardPluginDispatcher as t}from"./api/dispatcher.js";import{DashboardRequestError as n}from"./request-error.js";import{assertDashboardApiRequestOrigin as r,assertLocalDashboardHost as i,getDashboardRequestId as a}from"./host-policy.js";import{handleFetchRequest as o}from"./node-fetch-adapter.js";import{readFile as s,stat as c}from"node:fs/promises";import{extname as l,isAbsolute as u,join as d,relative as f,resolve as p,sep as m}from"node:path";import{createServer as h,request as g}from"node:http";import{request as _}from"node:https";function v(e){let t=y(e),n=h(async(e,n)=>{await t.handle(e,n)});return n.on(`close`,()=>{t.dispose()}),n}function y(s){let c=t(s.plugins,{host:Object.freeze({projectRoot:s.projectRoot}),getRequestId:a});async function l(t,a){try{i(t);let n=s.getAccess?await s.getAccess(t):`unauthenticated`,o=String(t.headers[`x-forwarded-proto`]??``).split(`,`)[0]?.trim()===`https`?`https`:`http`,c=new URL(t.url??`/`,`${o}://${t.headers.host}`),l=e(new Request(c,{method:t.method,headers:{accept:t.headers.accept??``,"sec-fetch-dest":String(t.headers[`sec-fetch-dest`]??``)}}),n);if(!l)return r(t,c),!0;a.writeHead(l.status,Object.fromEntries(l.headers)),a.end(Buffer.from(await l.arrayBuffer()))}catch(e){x(a,e instanceof n?e.status:503,{error:`Dashboard access unavailable`})}return!1}return{authorize:l,dispose:async()=>void 0,async handle(e,t){try{i(e);let n=String(e.headers[`x-forwarded-proto`]??``).split(`,`)[0]?.trim()===`https`?`https`:`http`,r=new URL(e.url??`/`,`${n}://${e.headers.host??`127.0.0.1`}`);if(!await l(e,t))return;if(r.pathname.startsWith(`/__dashboard/api/plugins/`)){await o(e,t,c);return}if(r.pathname===`/__dashboard/api`||r.pathname.startsWith(`/__dashboard/api/`)){x(t,404,{error:`Not found`});return}if(!s.clientDist){x(t,404,{error:`Not found`});return}if(r.pathname===`/__dashboard`){t.writeHead(302,{location:`/__dashboard/`}),t.end();return}if(r.pathname.startsWith(`/__dashboard/`)){if(e.method!==`GET`&&e.method!==`HEAD`){x(t,405,{error:`Method not allowed`});return}await b(e,t,r.pathname.slice(12)||`/`,s.clientDist);return}x(t,404,{error:`Not found`})}catch(e){x(t,e instanceof n?e.status:500,{error:e instanceof Error?e.message:String(e)})}}}}async function b(e,t,n,r){let i=S(r,n);if(!i){x(t,404,{error:`Client asset not found`});return}let a=await C(i),o=!a&&l(n)===``,s=d(r,`index.html`),c=o?await C(s):void 0,u=a?i:s,f=a??c;if(!f){x(t,404,{error:`Client asset not found`});return}t.writeHead(200,{"content-type":w(u),"cache-control":`private, no-store`}),t.end(e.method===`HEAD`?void 0:f)}function x(e,t,n){e.writeHead(t,{"content-type":`application/json; charset=utf-8`,"cache-control":`no-store`}),e.end(JSON.stringify(n))}function S(e,t){let r;try{r=decodeURIComponent(t)}catch{throw new n(`Dashboard request path is invalid.`,400)}if(r.includes(`\0`))throw new n(`Dashboard request path is invalid.`,400);let i=p(e,r===`/`?`index.html`:r.slice(1)),a=f(e,i);if(!(a===``||a===`..`||a.startsWith(`..${m}`)||u(a)))return i}async function C(e){try{return(await c(e)).isFile()?await s(e):void 0}catch(e){if(T(e)&&(e.code===`ENOENT`||e.code===`ENOTDIR`))return;throw e}}function w(e){switch(l(e)){case`.css`:return`text/css; charset=utf-8`;case`.html`:return`text/html; charset=utf-8`;case`.ico`:return`image/x-icon`;case`.jpeg`:case`.jpg`:return`image/jpeg`;case`.js`:case`.mjs`:return`text/javascript; charset=utf-8`;case`.json`:case`.map`:return`application/json; charset=utf-8`;case`.png`:return`image/png`;case`.svg`:return`image/svg+xml`;case`.ttf`:return`font/ttf`;case`.wasm`:return`application/wasm`;case`.webp`:return`image/webp`;case`.woff`:return`font/woff`;case`.woff2`:return`font/woff2`;default:return`application/octet-stream`}}function T(e){return e instanceof Error&&`code`in e}function E(e,t={}){return async r=>{let i=e();if(!i)throw new n(`Dashboard app origin is unavailable.`,503);let a=new URL(`/api/dashboard/access`,i);if(a.protocol!==`http:`&&a.protocol!==`https:`)throw new n(`Dashboard app origin is invalid.`,503);return new Promise((e,i)=>{let o=a.protocol===`https:`?_:g,s=String(r.headers[`x-forwarded-proto`]??a.protocol.slice(0,-1)).split(`,`)[0].trim(),c=r.headers.origin??(r.headers.host?`${s}://${r.headers.host}`:a.origin),l=o(a,{...t,allowPartialTrustChain:!!t.ca,method:`GET`,headers:{cookie:r.headers.cookie??``,origin:c},timeout:1e4},t=>{let r=[],a=0;t.on(`data`,e=>{a+=e.length,a>1024?t.destroy(Error(`Invalid dashboard access response.`)):r.push(e)}),t.on(`error`,i),t.on(`end`,()=>{try{let{access:a}=JSON.parse(Buffer.concat(r).toString(`utf8`));t.statusCode===200&&a===`admin`?e(`admin`):t.statusCode===401&&a===`unauthenticated`?e(`unauthenticated`):t.statusCode===403&&a===`forbidden`?e(`forbidden`):i(new n(`Dashboard access check failed.`,503))}catch{i(new n(`Dashboard access check failed.`,503))}})});l.on(`timeout`,()=>l.destroy(Error(`Dashboard access check timed out.`))),l.on(`error`,()=>i(new n(`Dashboard access check failed.`,503))),l.end()})}}export{E as createAppAccessResolver,y as createNodeHandler,v as createNodeServer};
|
package/dist/package/types.d.ts
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
import { WorkerEnvironmentStatus } from "@coreframe/deploy";
|
|
2
|
-
import { DiagnosticResult } from "@coreframe/diagnostics";
|
|
3
|
-
|
|
4
1
|
//#region src/types.d.ts
|
|
5
|
-
type LocalDashboardPayload = {
|
|
6
|
-
mode: "local";
|
|
7
|
-
diagnostics: DiagnosticResult;
|
|
8
|
-
workerEnvironment: WorkerEnvironmentStatus;
|
|
9
|
-
};
|
|
10
2
|
type DeployedConfigurationEntry = {
|
|
11
3
|
description: string;
|
|
12
4
|
kind: "secret" | "variable";
|
|
@@ -28,13 +20,5 @@ type DashboardReleaseIdentity = {
|
|
|
28
20
|
coreframeVersion?: string;
|
|
29
21
|
releaseName?: string;
|
|
30
22
|
};
|
|
31
|
-
type DeployedDashboardPayload = {
|
|
32
|
-
mode: "deployed";
|
|
33
|
-
environment: "production" | "staging";
|
|
34
|
-
release: DashboardReleaseIdentity;
|
|
35
|
-
configuration: DeployedConfigurationEntry[];
|
|
36
|
-
links: DashboardLink[];
|
|
37
|
-
};
|
|
38
|
-
type DashboardPayload = LocalDashboardPayload | DeployedDashboardPayload;
|
|
39
23
|
//#endregion
|
|
40
|
-
export { DashboardLink,
|
|
24
|
+
export { DashboardLink, DashboardReleaseIdentity, DeployedConfigurationEntry };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{withoutSpace as e}from"../helpers.js";const t=new Set(`2xl,2xlDown,2xlOnly,@/2xl,@/2xlDown,@/2xlOnly,@/2xlTo3xl,@/2xlTo4xl,@/2xlTo5xl,@/2xlTo6xl,@/2xlTo7xl,@/2xlTo8xl,@/2xs,@/2xsDown,@/2xsOnly,@/2xsTo2xl,@/2xsTo3xl,@/2xsTo4xl,@/2xsTo5xl,@/2xsTo6xl,@/2xsTo7xl,@/2xsTo8xl,@/2xsToLg,@/2xsToMd,@/2xsToSm,@/2xsToXl,@/2xsToXs,@/3xl,@/3xlDown,@/3xlOnly,@/3xlTo4xl,@/3xlTo5xl,@/3xlTo6xl,@/3xlTo7xl,@/3xlTo8xl,@/3xs,@/3xsDown,@/3xsOnly,@/3xsTo2xl,@/3xsTo2xs,@/3xsTo3xl,@/3xsTo4xl,@/3xsTo5xl,@/3xsTo6xl,@/3xsTo7xl,@/3xsTo8xl,@/3xsToLg,@/3xsToMd,@/3xsToSm,@/3xsToXl,@/3xsToXs,@/4xl,@/4xlDown,@/4xlOnly,@/4xlTo5xl,@/4xlTo6xl,@/4xlTo7xl,@/4xlTo8xl,@/5xl,@/5xlDown,@/5xlOnly,@/5xlTo6xl,@/5xlTo7xl,@/5xlTo8xl,@/6xl,@/6xlDown,@/6xlOnly,@/6xlTo7xl,@/6xlTo8xl,@/7xl,@/7xlDown,@/7xlOnly,@/7xlTo8xl,@/8xl,@/8xlDown,@/8xlOnly,@/lg,@/lgDown,@/lgOnly,@/lgTo2xl,@/lgTo3xl,@/lgTo4xl,@/lgTo5xl,@/lgTo6xl,@/lgTo7xl,@/lgTo8xl,@/lgToXl,@/md,@/mdDown,@/mdOnly,@/mdTo2xl,@/mdTo3xl,@/mdTo4xl,@/mdTo5xl,@/mdTo6xl,@/mdTo7xl,@/mdTo8xl,@/mdToLg,@/mdToXl,@/sm,@/smDown,@/smOnly,@/smTo2xl,@/smTo3xl,@/smTo4xl,@/smTo5xl,@/smTo6xl,@/smTo7xl,@/smTo8xl,@/smToLg,@/smToMd,@/smToXl,@/xl,@/xlDown,@/xlOnly,@/xlTo2xl,@/xlTo3xl,@/xlTo4xl,@/xlTo5xl,@/xlTo6xl,@/xlTo7xl,@/xlTo8xl,@/xs,@/xsDown,@/xsOnly,@/xsTo2xl,@/xsTo3xl,@/xsTo4xl,@/xsTo5xl,@/xsTo6xl,@/xsTo7xl,@/xsTo8xl,@/xsToLg,@/xsToMd,@/xsToSm,@/xsToXl,_active,_after,_atValue,_autofill,_backdrop,_before,_checked,_closed,_complete,_current,_currentPage,_currentStep,_dark,_default,_disabled,_dragging,_empty,_enabled,_even,_expanded,_file,_first,_firstLetter,_firstLine,_firstOfType,_focus,_focusVisible,_focusWithin,_fullscreen,_grabbed,_groupActive,_groupChecked,_groupDisabled,_groupExpanded,_groupFocus,_groupFocusVisible,_groupFocusWithin,_groupHover,_groupInvalid,_hidden,_highContrast,_highlighted,_horizontal,_hover,_icon,_inRange,_incomplete,_indeterminate,_invalid,_invertedColors,_landscape,_last,_lastOfType,_lessContrast,_light,_loading,_ltr,_marker,_moreContrast,_motionReduce,_motionSafe,_noscript,_now,_odd,_only,_onlyOfType,_open,_optional,_osDark,_osLight,_outOfRange,_overValue,_peerActive,_peerChecked,_peerDisabled,_peerExpanded,_peerFocus,_peerFocusVisible,_peerFocusWithin,_peerHover,_peerInvalid,_peerPlaceholderShown,_placeholder,_placeholderShown,_portrait,_pressed,_print,_rangeEnd,_rangeStart,_readOnly,_readWrite,_required,_rtl,_scrollbar,_scrollbarThumb,_scrollbarTrack,_selected,_selection,_starting,_target,_today,_topmost,_unavailable,_underValue,_valid,_vertical,_visited,base,lg,lgDown,lgOnly,lgTo2xl,lgToXl,md,mdDown,mdOnly,mdTo2xl,mdToLg,mdToXl,sm,smDown,smOnly,smTo2xl,smToLg,smToMd,smToXl,xl,xlDown,xlOnly,xlTo2xl`.split(`,`)),n=/^@|&/,r=/^_/,i=/&|@/,a=[`base`,`sm`,`md`,`lg`,`xl`,`2xl`];function o(e){return t.has(e)||n.test(e)}function s(n){return n.map(n=>t.has(n)?n.replace(r,``):i.test(n)?`[${e(n.trim())}]`:n)}function c(e){return[...e].sort((e,t)=>{let n=o(e),r=o(t);return n&&!r?1:!n&&r?-1:0})}export{a as breakpointKeys,s as finalizeConditions,o as isCondition,c as sortConditions};
|
|
1
|
+
import{withoutSpace as e}from"../helpers.js";const t=new Set(`2xl,2xlDown,2xlOnly,@/2xl,@/2xlDown,@/2xlOnly,@/2xlTo3xl,@/2xlTo4xl,@/2xlTo5xl,@/2xlTo6xl,@/2xlTo7xl,@/2xlTo8xl,@/2xs,@/2xsDown,@/2xsOnly,@/2xsTo2xl,@/2xsTo3xl,@/2xsTo4xl,@/2xsTo5xl,@/2xsTo6xl,@/2xsTo7xl,@/2xsTo8xl,@/2xsToLg,@/2xsToMd,@/2xsToSm,@/2xsToXl,@/2xsToXs,@/3xl,@/3xlDown,@/3xlOnly,@/3xlTo4xl,@/3xlTo5xl,@/3xlTo6xl,@/3xlTo7xl,@/3xlTo8xl,@/3xs,@/3xsDown,@/3xsOnly,@/3xsTo2xl,@/3xsTo2xs,@/3xsTo3xl,@/3xsTo4xl,@/3xsTo5xl,@/3xsTo6xl,@/3xsTo7xl,@/3xsTo8xl,@/3xsToLg,@/3xsToMd,@/3xsToSm,@/3xsToXl,@/3xsToXs,@/4xl,@/4xlDown,@/4xlOnly,@/4xlTo5xl,@/4xlTo6xl,@/4xlTo7xl,@/4xlTo8xl,@/5xl,@/5xlDown,@/5xlOnly,@/5xlTo6xl,@/5xlTo7xl,@/5xlTo8xl,@/6xl,@/6xlDown,@/6xlOnly,@/6xlTo7xl,@/6xlTo8xl,@/7xl,@/7xlDown,@/7xlOnly,@/7xlTo8xl,@/8xl,@/8xlDown,@/8xlOnly,@/lg,@/lgDown,@/lgOnly,@/lgTo2xl,@/lgTo3xl,@/lgTo4xl,@/lgTo5xl,@/lgTo6xl,@/lgTo7xl,@/lgTo8xl,@/lgToXl,@/md,@/mdDown,@/mdOnly,@/mdTo2xl,@/mdTo3xl,@/mdTo4xl,@/mdTo5xl,@/mdTo6xl,@/mdTo7xl,@/mdTo8xl,@/mdToLg,@/mdToXl,@/sm,@/smDown,@/smOnly,@/smTo2xl,@/smTo3xl,@/smTo4xl,@/smTo5xl,@/smTo6xl,@/smTo7xl,@/smTo8xl,@/smToLg,@/smToMd,@/smToXl,@/xl,@/xlDown,@/xlOnly,@/xlTo2xl,@/xlTo3xl,@/xlTo4xl,@/xlTo5xl,@/xlTo6xl,@/xlTo7xl,@/xlTo8xl,@/xs,@/xsDown,@/xsOnly,@/xsTo2xl,@/xsTo3xl,@/xsTo4xl,@/xsTo5xl,@/xsTo6xl,@/xsTo7xl,@/xsTo8xl,@/xsToLg,@/xsToMd,@/xsToSm,@/xsToXl,_active,_after,_anyPointerCoarse,_anyPointerFine,_anyPointerNone,_atValue,_autofill,_backdrop,_before,_checked,_closed,_complete,_current,_currentPage,_currentStep,_dark,_default,_disabled,_dragging,_empty,_enabled,_even,_expanded,_file,_first,_firstLetter,_firstLine,_firstOfType,_focus,_focusVisible,_focusWithin,_fullscreen,_grabbed,_groupActive,_groupChecked,_groupDisabled,_groupExpanded,_groupFocus,_groupFocusVisible,_groupFocusWithin,_groupHover,_groupInvalid,_hidden,_highContrast,_highlighted,_horizontal,_hover,_icon,_inRange,_incomplete,_indeterminate,_inert,_invalid,_invertedColors,_landscape,_last,_lastOfType,_lessContrast,_light,_loading,_ltr,_marker,_moreContrast,_motionReduce,_motionSafe,_noscript,_now,_odd,_only,_onlyOfType,_open,_optional,_osDark,_osLight,_outOfRange,_overValue,_peerActive,_peerChecked,_peerDisabled,_peerExpanded,_peerFocus,_peerFocusVisible,_peerFocusWithin,_peerHover,_peerInvalid,_peerPlaceholderShown,_placeholder,_placeholderShown,_pointerCoarse,_pointerFine,_pointerNone,_portrait,_pressed,_print,_rangeEnd,_rangeStart,_readOnly,_readWrite,_required,_rtl,_scrollbar,_scrollbarThumb,_scrollbarTrack,_selected,_selection,_starting,_target,_today,_topmost,_unavailable,_underValue,_userInvalid,_userValid,_valid,_vertical,_visited,base,lg,lgDown,lgOnly,lgTo2xl,lgToXl,md,mdDown,mdOnly,mdTo2xl,mdToLg,mdToXl,sm,smDown,smOnly,smTo2xl,smToLg,smToMd,smToXl,xl,xlDown,xlOnly,xlTo2xl`.split(`,`)),n=/^@|&/,r=/^_/,i=/&|@/,a=[`base`,`sm`,`md`,`lg`,`xl`,`2xl`];function o(e){return t.has(e)||n.test(e)}function s(n){return n.map(n=>t.has(n)?n.replace(r,``):i.test(n)?`[${e(n.trim())}]`:n)}function c(e){return[...e].sort((e,t)=>{let n=o(e),r=o(t);return n&&!r?1:!n&&r?-1:0})}export{a as breakpointKeys,s as finalizeConditions,o as isCondition,c as sortConditions};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const e=Object.prototype.hasOwnProperty;function t(e){return e===`base`}function n(e){let n=[];for(let r=0;r<e.length;r++)t(e[r])||n.push(e[r]);return n}function r(e){let t=5381;for(let n=e.length;n;)t=t*33^e.charCodeAt(--n);let n=t>>>0,r=``;for(;n>52;n=n/52|0){let e=n%52;r=String.fromCharCode(e+(e>25?39:97))+r}let i=n%52;return String.fromCharCode(i+(i>25?39:97))+r}function i(e){let t={};if(!e)return t;for(let n in e)e[n]!==void 0&&(t[n]=e[n]);return t}function a(e,t){return{...e,...i(t)}}function o(e,t){for(let n in e){if(n===`css`||n===`className`||n===`classNames`)continue;let r=e[n],i=t[n];if(Array.isArray(r)?!r.includes(i):i!==r)return!1}return!0}function s(e,t,n){let r=[];for(let i of e)o(i,t)&&i.className&&r.push(n?n(i.className):i.className);return r.join(` `)}function c(e,t){let n=[];for(let r of e){let e=r.css?.[t],i=r.classNames?.[t]??r.className;if(!e&&!i)continue;let a=e?{css:e}:{};for(let e in r)e===`css`||e===`className`||e===`classNames`||(a[e]=r[e]);i&&(a.className=i),n.push(a)}return n}function l(e,t){let n={};for(let r=0;r<e.length;r++)e[r]!=null&&(n[t[r]]=e[r]);return n}function u(t,n,r){r||={};let{stop:i,getKey:a}=r,o=(t,r=[])=>{if(!t||typeof t!=`object`||i?.(t,r))return n(t,r);let s=Array.isArray(t)?[]:{};for(let n in t){if(!e.call(t,n)||n===`__proto__`)continue;let i=a?.(n,t[n])??n;r.push(i);let c=o(t[n],r);r.pop(),c!=null&&(s[i]=c)}return s};return o(t)}function d(e,t,n){let{utility:r,conditions:i}=t,{hasShorthand:a,resolveShorthand:o}=r;return n=n!==!1,u(e,e=>Array.isArray(e)?l(e,i.breakpoints.keys):e,{stop:Array.isArray,getKey:n?e=>a?o(e):e:void 0})}function f(e){let t=5381;for(let n=0;n<e.length;n++){let r=e[n];if(typeof r!=`object`||!r){t=t*33^1;continue}for(let e in r){let n=r[e],i=typeof n;if(n!==null&&i===`object`)return null;for(let n=0;n<e.length;n++)t=t*33^e.charCodeAt(n);if(i===`string`)for(let e=0;e<n.length;e++)t=t*33^n.charCodeAt(e);else t=i===`number`?t*33^(n|0):i===`boolean`?t*33^(n?991:997):t*33^2}}return t>>>0}function p(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r===i)continue;if(r===null||i===null||typeof r!=`object`||typeof i!=`object`)return!1;let a=0;for(let e in r){if(r[e]!==i[e])return!1;a++}if(a!==Object.keys(i).length)return!1}return!0}function m(e){let t=new Map,n=new Map,r=new WeakSet,i=()=>({objects:new WeakMap,prims:new Map,out:void 0,has:!1}),a=i(),o,s,c,l=!1,u=0,d=(e,t)=>{if(typeof t==`object`&&t){let n=e.objects.get(t);return n===void 0&&(n=i(),e.objects.set(t,n)),n}let n=e.prims.get(t);return n===void 0&&(e.prims.size>64&&e.prims.clear(),n=i(),e.prims.set(t,n)),n},m=(e,t)=>{if(Array.isArray(t)){e=d(e,`\0[`);for(let n=0;n<t.length;n++)e=m(e,t[n]);return d(e,`\0]`)}return d(e,t)},h=(e,t)=>{if(e!==void 0){if(Array.isArray(t)){e=e.prims.get(`\0[`);for(let n=0;n<t.length&&e!==void 0;n++)e=h(e,t[n]);return e===void 0?void 0:e.prims.get(`\0]`)}return typeof t==`object`&&t?e.objects.get(t):e.prims.get(t)}},g=e=>{if(Array.isArray(e)){let t=!0;for(let n=0;n<e.length;n++)g(e[n])||(t=!1);return t}return typeof e!=`object`||!e||r.has(e)?!0:(r.add(e),!1)};return((...r)=>{let i=!1;for(let e=0;e<r.length;e++)if(Array.isArray(r[e])){i=!0;break}if(i){let t=a;for(let e=0;e<r.length&&t!==void 0;e++)t=h(t,r[e]);if(t!==void 0&&t.has)return t.out;let i=JSON.stringify(r),d=l&&o===void 0&&i===s?c:n.get(i);d===void 0&&(d=e(...r),n.set(i,d),n.size>500&&n.delete(n.keys().next().value));let f=!1;if(!(++u&3)){f=!0;for(let e=0;e<r.length;e++)g(r[e])||(f=!1)}if(f){let e=a;for(let t=0;t<r.length;t++)e=m(e,r[t]);e.out=d,e.has=!0}return o=void 0,s=i,c=d,l=!0,d}let d=f(r);if(d!==null){if(l&&o===d&&p(r,s))return c;let n=t.get(d);if(n){for(let e=0;e<n.length;e++)if(p(r,n[e].args))return o=d,s=r,c=n[e].out,l=!0,n[e].out}let i=e(...r);return n||(n=[],t.set(d,n)),n.push({args:r,out:i}),n.length>8&&n.shift(),t.size>500&&t.delete(t.keys().next().value),o=d,s=r,c=i,l=!0,i}let _=JSON.stringify(r);if(l&&o===void 0&&_===s)return c;let v=n.get(_);if(v!==void 0)return o=void 0,s=_,c=v,l=!0,v;let y=e(...r);return n.set(_,y),n.size>500&&n.delete(n.keys().next().value),o=void 0,s=_,c=y,l=!0,y})}function h(e){let t=new WeakMap;return(n=>{if(!n||typeof n!=`object`)return e(n);if(t.has(n))return t.get(n);let r=e(n);return t.set(n,r),r})}const g=/[\n\s]+/g,_=e=>typeof e==`string`?e.replace(g,` `):e;function v(e){let t=e.utility,i=e.conditions,a=e.hash,o=e=>t.prefix?t.prefix+`-`+e:e,s=(e,n)=>{let s=i.finalize(e);return s.push(a?n:o(n)),a?o(t.toHash(s,r)):s.join(`:`)};return h(m(function({base:r,...a}={}){let o=d(r?Object.assign(a,r):a,e),c=new Set;u(o,(e,r)=>{if(e==null)return;let a=E(e),[o,...l]=i.shift(r),u=n(l),d=t.transform(o,w(D(_(e)))),f=s(u,d.className);a&&(f+=`!`),c.add(f)});let l=``;for(let e of c)l+=l?` `+e:e;return l}))}const y=new WeakMap;function b(e){let t=y.get(e);if(t)return t;t=Object.create(null);for(let n=0;n<e.length;n++)t[e[n]]=!0;return y.set(e,t),t}function x(e,t,n){let r=Object.getOwnPropertyDescriptor(e,n);if(r?.get||r?.set){Object.defineProperty(t,n,r);return}t[n]=e[n]}function S(e,...t){let n=Object.keys(e),r=t.length;if(r===1){let r=t[0],i={},a={};if(Array.isArray(r)){let t=b(r);for(let r=0;r<n.length;r++){let o=n[r];t[o]===!0?x(e,i,o):x(e,a,o)}return[i,a]}for(let t=0;t<n.length;t++){let o=n[t];r(o)?x(e,i,o):x(e,a,o)}return[i,a]}let i=Array(r);for(let e=0;e<r;e++){let n=t[e];i[e]=Array.isArray(n)?b(n):n}let a=Array(r+1);for(let e=0;e<=r;e++)a[e]={};let o=a[r];for(let t=0;t<n.length;t++){let s=n[t],c=!1;for(let t=0;t<r;t++){let n=i[t];if(typeof n==`function`?n(s):n[s]===!0){x(e,a[t],s),c=!0;break}}c||x(e,o,s)}return a}function C(...e){let t=new Set;for(let n of e)if(n)for(let e=0;e<n.length;e++)t.add(n[e]);return Array.from(t)}function w(e){return typeof e==`string`&&e.indexOf(` `)>=0?e.replaceAll(` `,`_`):e}const T=/\s*!(important)?\s*$/i;function E(e){return typeof e==`string`?T.test(e):!1}function D(e){return typeof e==`string`?e.replace(T,``).trim():e}export{i as compact,v as createSerializeCss,n as filterBaseConditions,s as getCompoundVariantClassNames,c as getSlotCompoundVariant,t as isBaseCondition,E as isImportant,m as memo,d as normalizeStyleObject,S as splitProps,r as toHash,l as toResponsiveObject,C as uniq,u as walkObject,h as weakMemo,a as withDefaults,D as withoutImportant,w as withoutSpace};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createRecipe as e}from"./runtime.js";const t=e({name:`dashboardButton`,className:`dashboard-button`,defaultVariants:{size:`md`,tone:`accent`,variant:`solid`},compoundVariants:[{tone:`neutral`,variant:`solid`,className:`dashboard-button--compound__tone_neutral__variant_solid`},{tone:`accent`,variant:`solid`,className:`dashboard-button--compound__tone_accent__variant_solid`},{tone:`danger`,variant:`solid`,className:`dashboard-button--compound__tone_danger__variant_solid`},{tone:`accent`,variant:`outline`,className:`dashboard-button--compound__tone_accent__variant_outline`},{tone:`danger`,variant:`outline`,className:`dashboard-button--compound__tone_danger__variant_outline`},{tone:`accent`,variant:`quiet`,className:`dashboard-button--compound__tone_accent__variant_quiet`},{tone:`danger`,variant:`quiet`,className:`dashboard-button--compound__tone_danger__variant_quiet`}],variantMap:{
|
|
1
|
+
import{createRecipe as e}from"./runtime.js";const t=e({name:`dashboardButton`,className:`dashboard-button`,defaultVariants:{size:`md`,tone:`accent`,variant:`solid`},compoundVariants:[{tone:`neutral`,variant:`solid`,className:`dashboard-button--compound__tone_neutral__variant_solid`},{tone:`accent`,variant:`solid`,className:`dashboard-button--compound__tone_accent__variant_solid`},{tone:`danger`,variant:`solid`,className:`dashboard-button--compound__tone_danger__variant_solid`},{tone:`accent`,variant:`outline`,className:`dashboard-button--compound__tone_accent__variant_outline`},{tone:`danger`,variant:`outline`,className:`dashboard-button--compound__tone_danger__variant_outline`},{tone:`accent`,variant:`quiet`,className:`dashboard-button--compound__tone_accent__variant_quiet`},{tone:`danger`,variant:`quiet`,className:`dashboard-button--compound__tone_danger__variant_quiet`}],variantMap:{variant:[`solid`,`outline`,`quiet`],tone:[`neutral`,`accent`,`danger`],size:[`sm`,`md`,`lg`]}});export{t as dashboardButton};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createRecipe as e}from"./runtime.js";const t=e({name:`dashboardStatus`,className:`dashboard-status`,defaultVariants:{tone:`neutral`},variantMap:{tone:[`
|
|
1
|
+
import{createRecipe as e}from"./runtime.js";const t=e({name:`dashboardStatus`,className:`dashboard-status`,defaultVariants:{tone:`neutral`},variantMap:{tone:[`neutral`,`info`,`success`,`warning`,`danger`]}});export{t as dashboardStatus};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{createSerializeCss as e,getCompoundVariantClassNames as t,getSlotCompoundVariant as n,memo as r,splitProps as i,uniq as a,withDefaults as o,withoutSpace as s}from"../helpers.js";import{breakpointKeys as c,finalizeConditions as l,sortConditions as u}from"../css/conditions.js";import{cx as d}from"../css/cx.js";function f(e){let t=e.variantMap??{};return{name:e.name,className:e.className??e.name,slots:e.slots??[],variantMap:t,variantKeys:Object.keys(t),defaults:e.defaultVariants??{},compounds:e.compoundVariants??[]}}function p(n){let{name:i,className:a,variantMap:p,variantKeys:m,defaults:_,compounds:v}=f(n),y=e({hash:!1,conditions:{shift:u,finalize:l,breakpoints:{keys:c}},utility:{prefix:null,toHash(e,t){return t(e.join(`:`))},transform(e,t){return{className:t===`__ignore__`?a:`${a}--${e}_${s(t)}`}}}}),b=e=>e;function x(e={}){return{[a]:`__ignore__`,...o(_,e)}}function S(e){if(v.length!==0)for(let t of m){let n=e[t];if(typeof n==`object`&&n)throw Error(`[recipe:${a}:${t}] Conditions are not supported when using compound variants.`)}}function C(e){return t(v,x(e),b)}let w=g(r(function(e={},t=!0){S(e);let n=y(x(e));return t?d(n,C(e)):n}),i,m,p,x);return w.__recipe__=!0,w.__getCompoundVariantClasses__=C,w.merge=function(e){return h(w,e)},w}function m(e){let{name:t,className:i,slots:a,variantMap:s,variantKeys:c,defaults:l,compounds:u}=f(e),d=a.map(function(e){return[e,p({name:t,className:`${i}__${e}`,variantMap:s,defaultVariants:l,compoundVariants:n(u,e)})]}),m=r(function(e={}){let t={};for(let[n,r]of d)t[n]=r(e);return t});return g(m,t,c,s,function(e={}){return o(l,e)}),m.__recipe__=!1,m.classNameMap={},m}function h(e,t){if(e&&!t)return e;if(!e&&t)return t;function n(...n){let r=e(...n),i=t(...n);return r&&i?`${r} ${i}`:r||i}let r=a(e.variantKeys,t.variantKeys),i={};for(let n of r)i[n]=a(e.variantMap[n],t.variantMap[n]);return g(n,`${e.__name__} ${t.__name__}`,r,i,function(e){return e}),n.__recipe__=!0,n}function g(e,t,n,r,a){return e.__name__=t,e.raw=function(e){return e},e.variantKeys=n,e.variantMap=r,e.splitVariantProps=function(e){return i(e,n)},e.getVariantProps=a,e}export{p as createRecipe,m as createSlotRecipe};
|
|
@@ -2,7 +2,7 @@ import { AnchorHTMLAttributes, ButtonHTMLAttributes, HTMLAttributes, ReactElemen
|
|
|
2
2
|
|
|
3
3
|
//#region src/web/ui/index.d.ts
|
|
4
4
|
interface PageProps extends HTMLAttributes<HTMLDivElement> {}
|
|
5
|
-
/**
|
|
5
|
+
/** Optional content layout for a dashboard route. Pages own their headings and content insets. */
|
|
6
6
|
declare function Page({
|
|
7
7
|
className,
|
|
8
8
|
...props
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cx as e}from"../styled-system/css/cx.js";import
|
|
1
|
+
import{cx as e}from"../styled-system/css/cx.js";import{dashboardButton as t}from"../styled-system/recipes/dashboard-button.js";import{dashboardConfirmDialog as n}from"../styled-system/recipes/dashboard-confirm-dialog.js";import{dashboardEmptyState as r}from"../styled-system/recipes/dashboard-empty-state.js";import{dashboardErrorState as i}from"../styled-system/recipes/dashboard-error-state.js";import{dashboardField as a}from"../styled-system/recipes/dashboard-field.js";import{dashboardPage as o}from"../styled-system/recipes/dashboard-page.js";import{dashboardSection as s}from"../styled-system/recipes/dashboard-section.js";import{dashboardStatus as c}from"../styled-system/recipes/dashboard-status.js";import{dashboardTabs as l}from"../styled-system/recipes/dashboard-tabs.js";const u={button:t,confirmDialog:n,emptyState:r,errorState:i,field:a,page:o,section:s,status:c,tabs:l};export{e as cx,u as styles};
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
import { DashboardMenu, DashboardMenuProps } from "./menu.js";
|
|
1
2
|
import { DashboardEmptyState, DashboardErrorBoundary, DashboardIndexRedirect, DashboardShell, DashboardShellProps } from "./shell.js";
|
|
2
|
-
export { DashboardEmptyState, DashboardErrorBoundary, DashboardIndexRedirect, DashboardShell, type DashboardShellProps };
|
|
3
|
+
export { DashboardEmptyState, DashboardErrorBoundary, DashboardIndexRedirect, DashboardMenu, type DashboardMenuProps, DashboardShell, type DashboardShellProps };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DashboardEmptyState as
|
|
1
|
+
import{DashboardMenu as e}from"./menu.js";import{DashboardEmptyState as t,DashboardErrorBoundary as n,DashboardIndexRedirect as r,DashboardShell as i}from"./shell.js";export{t as DashboardEmptyState,n as DashboardErrorBoundary,r as DashboardIndexRedirect,e as DashboardMenu,i as DashboardShell};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { DashboardPageManifestEntry } from "../config.js";
|
|
2
|
+
|
|
3
|
+
//#region src/web-shell/menu.d.ts
|
|
4
|
+
interface DashboardNavigation {
|
|
5
|
+
application?: {
|
|
6
|
+
name: string;
|
|
7
|
+
favicon: string;
|
|
8
|
+
};
|
|
9
|
+
pages: readonly DashboardPageManifestEntry[];
|
|
10
|
+
}
|
|
11
|
+
interface DashboardMenuProps {
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
/** App home link and navigation popover. Place inside a dashboard page to own its position. */
|
|
15
|
+
declare function DashboardMenu({
|
|
16
|
+
className
|
|
17
|
+
}: DashboardMenuProps): import("react").JSX.Element;
|
|
18
|
+
//#endregion
|
|
19
|
+
export { DashboardMenu, DashboardMenuProps, DashboardNavigation };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{NavLink as e,useLocation as t}from"react-router";import{createContext as n,useContext as r,useEffect as i,useId as a,useRef as o,useState as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";const u=n(void 0);function d({className:e}){let n=r(u),i=t();if(!n)throw Error(`DashboardMenu must be rendered inside a dashboard page.`);return c(f,{navigation:n,className:e},i.key)}function f({navigation:t,className:n}){let r=a(),u=o(null),d=o(null),f=o(null),p=o(void 0),[m,h]=s(!1);i(()=>{if(!m)return;if(p.current){let e=f.current?.querySelectorAll(`a`);(p.current===`first`?e?.[0]:e?.[e.length-1])?.focus(),p.current=void 0}function e(e){e.target instanceof Node&&!u.current?.contains(e.target)&&h(!1)}function t(e){e.key===`Escape`&&(h(!1),u.current?.contains(document.activeElement)&&d.current?.focus())}return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[m]);let{application:g,pages:_}=t,v=_.length>1;return l(`div`,{ref:u,className:[`coreframe-dashboard__menu`,n].filter(Boolean).join(` `),onPointerEnter:e=>{v&&e.pointerType!==`touch`&&h(!0)},onPointerLeave:()=>{u.current?.contains(document.activeElement)||h(!1)},onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||h(!1)},children:[c(`a`,{href:`/`,className:`coreframe-dashboard__logo`,"aria-label":g?`${g.name} home`:`App home`,children:g?c(`img`,{src:g.favicon,alt:``,className:`coreframe-dashboard__mark`}):c(`span`,{"aria-hidden":`true`,children:`C`})}),v?c(`button`,{ref:d,type:`button`,className:`coreframe-dashboard__menu-toggle`,"aria-label":`Dashboard navigation`,"aria-controls":r,"aria-expanded":m,onClick:()=>h(e=>!e),onKeyDown:e=>{if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;e.preventDefault();let t=e.key===`ArrowDown`?`first`:`last`;if(m){let e=f.current?.querySelectorAll(`a`);(t===`first`?e?.[0]:e?.[e.length-1])?.focus()}else p.current=t,h(!0)},children:c(`svg`,{"aria-hidden":`true`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:c(`path`,{d:`m6 9 6 6 6-6`})})}):null,m?c(`div`,{className:`coreframe-dashboard__popover`,children:c(`nav`,{ref:f,id:r,className:`coreframe-dashboard__navigation`,"aria-label":`Dashboard`,children:c(`ul`,{className:`coreframe-dashboard__navigation-list`,children:_.map(t=>{let n=t.iconData;return c(`li`,{children:l(e,{className:`coreframe-dashboard__navigation-link`,to:`/${t.path}`,onClick:()=>{h(!1),d.current?.focus()},children:[c(`svg`,{"aria-hidden":`true`,className:`coreframe-dashboard__navigation-icon`,width:`20`,height:`20`,viewBox:`0 0 ${n.width} ${n.height}`,fill:`currentColor`,dangerouslySetInnerHTML:{__html:n.body}}),c(`span`,{className:`coreframe-dashboard__navigation-text`,children:t.title})]})},t.id)})})})}):null]})}export{d as DashboardMenu,u as DashboardNavigationContext};
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DashboardNavigation } from "./menu.js";
|
|
2
2
|
|
|
3
3
|
//#region src/web-shell/shell.d.ts
|
|
4
|
-
interface DashboardShellProps {
|
|
5
|
-
pages: readonly DashboardPageManifestEntry[];
|
|
6
|
-
}
|
|
4
|
+
interface DashboardShellProps extends DashboardNavigation {}
|
|
7
5
|
declare function DashboardShell({
|
|
8
|
-
pages
|
|
6
|
+
pages,
|
|
7
|
+
application
|
|
9
8
|
}: DashboardShellProps): import("react").JSX.Element;
|
|
10
9
|
declare function DashboardIndexRedirect({
|
|
11
10
|
pages
|
|
12
11
|
}: DashboardShellProps): import("react").JSX.Element;
|
|
13
|
-
declare function DashboardEmptyState(
|
|
12
|
+
declare function DashboardEmptyState({
|
|
13
|
+
pages
|
|
14
|
+
}: Partial<DashboardShellProps>): import("react").JSX.Element;
|
|
14
15
|
declare function DashboardErrorBoundary(): import("react").JSX.Element;
|
|
15
16
|
//#endregion
|
|
16
17
|
export { DashboardEmptyState, DashboardErrorBoundary, DashboardIndexRedirect, DashboardShell, DashboardShellProps };
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{DashboardMenu as e,DashboardNavigationContext as t}from"./menu.js";import{Link as n,Navigate as r,Outlet as i,isRouteErrorResponse as a,useLocation as o,useRouteError as s}from"react-router";import{jsx as c,jsxs as l}from"react/jsx-runtime";function u({pages:n,application:r}){let a=o().pathname.split(`/`).filter(Boolean)[0],s=n.find(e=>e.path===a)??(a?void 0:n[0]);return l(t,{value:{pages:n,application:r},children:[s?.layout===`standalone`?null:c(e,{className:`coreframe-dashboard__floating-navigation`}),c(i,{})]})}function d({pages:e}){let t=e[0];return t&&e.some(e=>e.source===`app`)?c(r,{replace:!0,to:`/${t.path}`}):c(f,{pages:e})}function f({pages:e=[]}){return l(`main`,{className:`coreframe-dashboard__introduction`,children:[c(`p`,{className:`coreframe-dashboard__eyebrow`,children:`Coreframe Dashboard`}),c(`h1`,{children:`Your dashboard starts here`}),c(`p`,{children:`A space for your app’s internal tools. Build ordinary React Router pages with your own content, layout, and API access.`}),e.length>0?l(`section`,{children:[c(`h2`,{children:`Installed tools`}),c(`ul`,{children:e.map(e=>c(`li`,{children:c(n,{to:`/${e.path}`,children:e.title})},e.id))})]}):null,l(`section`,{children:[c(`h2`,{children:`Add your first page`}),l(`p`,{children:[`Create `,c(`code`,{children:`dashboard/pages/overview/route.tsx`}),`:`]}),c(`pre`,{children:c(`code`,{children:`export default function Overview() {
|
|
2
|
+
return <main><h1>Overview</h1></main>
|
|
3
|
+
}`})}),l(`p`,{children:[`Add an adjacent `,c(`code`,{children:`page.yaml`}),` with a`,` `,c(`a`,{href:`https://icones.js.org/collection/tabler`,children:`Tabler icon`}),` and optional title:`]}),c(`pre`,{children:c(`code`,{children:`icon: home
|
|
4
|
+
title: Overview`})}),l(`p`,{children:[`The page becomes available at `,c(`code`,{children:`/__dashboard/overview`}),`. This introduction disappears once an app-owned page exists.`]})]}),l(`section`,{children:[c(`h2`,{children:`Make it yours`}),l(`p`,{children:[`Pages own their headings and spacing. Customize default styles in`,` `,c(`code`,{children:`dashboard/panda.config.ts`}),`. The logo links to your app’s home page. A navigation menu appears beside it when there is more than one page.`]}),l(`p`,{children:[`Register optional reusable plugins in `,c(`code`,{children:`dashboard/dashboard.config.ts`}),`. App-owned pages are discovered automatically and do not need registration.`]})]}),l(`section`,{children:[c(`h2`,{children:`Disable the dashboard build`}),l(`p`,{children:[`If you do not need the dashboard, add this setting to the existing`,` `,c(`code`,{children:`defineConfig`}),` call in your project’s `,c(`code`,{children:`coreframe.config.ts`}),`:`]}),c(`pre`,{children:c(`code`,{children:`dashboard: {
|
|
5
|
+
enabled: false,
|
|
6
|
+
},`})}),c(`p`,{children:`This skips the dashboard bundle and its local development server. Remove the setting to enable the dashboard again.`})]})]})}function p(){let e=s(),t=a(e)&&e.status===404,r=import.meta.env.DEV&&e instanceof Error?e.message:t?`The requested dashboard page does not exist.`:`The dashboard hit an unexpected error.`;return l(`main`,{className:`coreframe-dashboard__state`,children:[c(`p`,{className:`coreframe-dashboard__eyebrow`,children:`Coreframe Dashboard`}),c(`h1`,{children:t?`Page not found`:`Dashboard unavailable`}),c(`p`,{children:r}),c(n,{className:`coreframe-dashboard__button`,to:`/`,children:`Go to dashboard`})]})}export{f as DashboardEmptyState,p as DashboardErrorBoundary,d as DashboardIndexRedirect,u as DashboardShell};
|
package/dist/package/worker.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DashboardAccess } from "./access.js";
|
|
1
2
|
import { DashboardPluginRegistration } from "./api/contract.js";
|
|
2
3
|
import { DashboardLink, DashboardReleaseIdentity, DeployedConfigurationEntry } from "./types.js";
|
|
3
4
|
|
|
@@ -11,7 +12,6 @@ type DashboardWorkerEnv = {
|
|
|
11
12
|
tag?: string;
|
|
12
13
|
timestamp?: string;
|
|
13
14
|
};
|
|
14
|
-
DASHBOARD_PASSWORD?: string;
|
|
15
15
|
DEPLOY_ENV?: "production" | "staging";
|
|
16
16
|
POSTHOG_RELEASE?: string;
|
|
17
17
|
};
|
|
@@ -31,7 +31,7 @@ type DashboardBuildMetadata = {
|
|
|
31
31
|
type DashboardWorkerOptions = {
|
|
32
32
|
plugins: readonly DashboardPluginRegistration<DashboardWorkerHostData>[];
|
|
33
33
|
};
|
|
34
|
-
type DashboardWorkerHandler = (request: Request, env: DashboardWorkerEnv) => Promise<Response> | null;
|
|
34
|
+
type DashboardWorkerHandler = (request: Request, env: DashboardWorkerEnv, access: DashboardAccess) => Promise<Response> | null;
|
|
35
35
|
type DashboardWorkerHostData = {
|
|
36
36
|
environment: "production" | "staging";
|
|
37
37
|
release: DashboardReleaseIdentity;
|
|
@@ -39,6 +39,6 @@ type DashboardWorkerHostData = {
|
|
|
39
39
|
links: readonly DashboardLink[];
|
|
40
40
|
};
|
|
41
41
|
declare function createWorkerHandler(options: DashboardWorkerOptions): DashboardWorkerHandler;
|
|
42
|
-
declare function handleDashboardRequest<Env extends DashboardWorkerEnv>(request: Request, env: Env, options: DashboardWorkerOptions): Promise<Response> | null;
|
|
42
|
+
declare function handleDashboardRequest<Env extends DashboardWorkerEnv>(request: Request, env: Env, options: DashboardWorkerOptions, access: DashboardAccess): Promise<Response> | null;
|
|
43
43
|
//#endregion
|
|
44
44
|
export { DashboardBuildMetadata, DashboardWorkerEnv, DashboardWorkerHandler, DashboardWorkerHostData, DashboardWorkerOptions, createWorkerHandler, handleDashboardRequest };
|
package/dist/package/worker.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{dashboardAccessResponse as e}from"./access.js";import{createDashboardPluginDispatcher as t}from"./api/dispatcher.js";import{getDashboardRequestId as n,isSameOriginDashboardMutation as r}from"./host-policy.js";const i=`/__dashboard`,a=`${i}/api`,o=new WeakMap;function s(e){let r=t(e.plugins,{getRequestId:n});return(e,t,n)=>{let i=new URL(e.url);return!f(i.pathname)||!t.DEPLOY_ENV?null:l(e,t,i,t.DEPLOY_ENV,r,n)}}function c(e,t,n,r){if(!f(new URL(e.url).pathname)||!t.DEPLOY_ENV)return null;let i=n.plugins,a=o.get(i);return a||(a=s(n),o.set(i,a)),a(e,t,r)}async function l(t,n,o,s,c,l){let d=e(t,l);if(d)return d;if(!r(t.method,t.headers.get(`origin`),o.origin))return m({error:{code:`invalid_input`}},403);if(o.pathname.startsWith(`${a}/plugins/`))return c(t,u(t,n,s));if(o.pathname===a||o.pathname.startsWith(`${a}/`))return m({error:`Not found`},404);if(o.pathname===i)return o.pathname=`${i}/`,Response.redirect(o,302);if(t.method!==`GET`&&t.method!==`HEAD`)return new Response(`Method not allowed`,{headers:{"cache-control":`no-store`},status:405});if(!n.ASSETS)return new Response(`Dashboard unavailable`,{headers:{"cache-control":`no-store`},status:503});(o.pathname===`${i}/`||!o.pathname.slice(13).includes(`.`))&&(o.pathname=`${i}/index.html`);let f=await n.ASSETS.fetch(new Request(o,t));if(o.pathname===`${i}/index.html`&&f.status===307){let e=f.headers.get(`location`),r=e?new URL(e,o):void 0;r?.origin===o.origin&&(r.pathname===i||r.pathname===`${i}/`)&&(await f.body?.cancel(),f=await n.ASSETS.fetch(new Request(r,t)))}let p=new Headers(f.headers);return p.set(`cache-control`,`private, no-store`),new Response(t.method===`HEAD`?null:f.body,{headers:p,status:f.status,statusText:f.statusText})}function u(e,t,n){let r=d(),i=t,a=r.configuration.filter(e=>e.requiredIn.includes(n)).map(e=>({description:e.description,kind:e.kind,name:e.name,status:p(i[e.name])?`configured`:`missing`})),o=[],s=r.deployUrls[n];return s?o.push({href:s,id:`application`,label:`Application`}):o.push({href:new URL(`/`,e.url).href,id:`application`,label:`Application`}),{environment:n,release:{applicationName:r.applicationName,applicationVersion:r.applicationVersion,cloudflareVersionId:t.CF_VERSION_METADATA?.id,cloudflareVersionTag:t.CF_VERSION_METADATA?.tag,cloudflareVersionTimestamp:t.CF_VERSION_METADATA?.timestamp,commit:r.commit,coreframeVersion:r.coreframeVersion,releaseName:t.POSTHOG_RELEASE},configuration:a,links:o}}function d(){return typeof __COREFRAME_DASHBOARD_BUILD__<`u`?__COREFRAME_DASHBOARD_BUILD__:{applicationName:`Coreframe application`,configuration:[],deployUrls:{}}}function f(e){return e===i||e.startsWith(`${i}/`)}function p(e){return typeof e==`string`?e.trim().length>0:e!=null}function m(e,t=200){return Response.json(e,{headers:{"cache-control":`no-store`},status:t})}export{s as createWorkerHandler,c as handleDashboardRequest};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coreframe/dashboard",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Reusable dashboard composition, shell, plugin, and authenticated runtime for Coreframe apps",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -56,30 +56,14 @@
|
|
|
56
56
|
"types": "./dist/package/app/index.d.ts",
|
|
57
57
|
"default": "./dist/package/app/index.js"
|
|
58
58
|
},
|
|
59
|
-
"./
|
|
60
|
-
"types": "./dist/package/
|
|
61
|
-
"default": "./dist/package/
|
|
62
|
-
}
|
|
63
|
-
"./plugins/diagnostics/web": {
|
|
64
|
-
"types": "./dist/package/plugins/diagnostics/web.d.ts",
|
|
65
|
-
"default": "./dist/package/plugins/diagnostics/web.js"
|
|
66
|
-
},
|
|
67
|
-
"./plugins/diagnostics/api/contract": {
|
|
68
|
-
"types": "./dist/package/plugins/diagnostics/api/contract.d.ts",
|
|
69
|
-
"default": "./dist/package/plugins/diagnostics/api/contract.js"
|
|
70
|
-
},
|
|
71
|
-
"./plugins/diagnostics/api/local": {
|
|
72
|
-
"types": "./dist/package/plugins/diagnostics/api/local.d.ts",
|
|
73
|
-
"default": "./dist/package/plugins/diagnostics/api/local.js"
|
|
74
|
-
},
|
|
75
|
-
"./plugins/diagnostics/api/worker": {
|
|
76
|
-
"types": "./dist/package/plugins/diagnostics/api/worker.d.ts",
|
|
77
|
-
"default": "./dist/package/plugins/diagnostics/api/worker.js"
|
|
78
|
-
},
|
|
79
|
-
"./shell.css": "./dist/package/shell.css"
|
|
59
|
+
"./access": {
|
|
60
|
+
"types": "./dist/package/access.d.ts",
|
|
61
|
+
"default": "./dist/package/access.js"
|
|
62
|
+
}
|
|
80
63
|
},
|
|
81
64
|
"dependencies": {
|
|
82
65
|
"@fontsource-variable/inter": "^5.2.8",
|
|
66
|
+
"@iconify-json/tabler": "^1.2.43",
|
|
83
67
|
"@tanstack/react-query": "^5.101.2",
|
|
84
68
|
"react": "19.2.8",
|
|
85
69
|
"react-dom": "19.2.8",
|
|
@@ -87,29 +71,28 @@
|
|
|
87
71
|
"rouzer": "^6.0.1",
|
|
88
72
|
"yaml": "^2.9.0",
|
|
89
73
|
"zod": "^4.4.3",
|
|
90
|
-
"@coreframe/
|
|
91
|
-
"@coreframe/diagnostics": "0.2.4-next.0",
|
|
92
|
-
"@coreframe/lib": "^0.2.16-next.3"
|
|
74
|
+
"@coreframe/lib": "^0.3.0"
|
|
93
75
|
},
|
|
94
76
|
"devDependencies": {
|
|
95
|
-
"@pandacss/dev": "2.
|
|
96
|
-
"@pandacss/preset-base": "2.
|
|
97
|
-
"@pandacss/preset-panda": "2.
|
|
77
|
+
"@pandacss/dev": "2.4.0",
|
|
78
|
+
"@pandacss/preset-base": "2.4.0",
|
|
79
|
+
"@pandacss/preset-panda": "2.4.0",
|
|
98
80
|
"@types/node": "^26.1.0",
|
|
99
81
|
"@types/react": "19.2.18",
|
|
100
82
|
"@types/react-dom": "19.2.4",
|
|
101
83
|
"jsdom": "^29.1.1",
|
|
84
|
+
"miniflare": "4.20260730.0",
|
|
102
85
|
"tsdown": "0.22.3",
|
|
103
86
|
"typescript": "6.0.3",
|
|
104
|
-
"vite": "^8.
|
|
87
|
+
"vite": "^8.3.5",
|
|
105
88
|
"vitest": "^4.1.10",
|
|
106
|
-
"@coreframe/panda": "0.1.
|
|
89
|
+
"@coreframe/panda": "0.1.16"
|
|
107
90
|
},
|
|
108
91
|
"scripts": {
|
|
109
|
-
"build": "pnpm
|
|
92
|
+
"build": "pnpm build:server",
|
|
110
93
|
"codegen": "panda codegen",
|
|
111
|
-
"build:server": "tsdown
|
|
112
|
-
"test": "vitest run --reporter=minimal",
|
|
94
|
+
"build:server": "tsdown",
|
|
95
|
+
"test": "NODE_OPTIONS=--no-experimental-webstorage vitest run --reporter=minimal",
|
|
113
96
|
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
114
97
|
"format": "oxlint --fix && oxfmt",
|
|
115
98
|
"lint": "oxlint"
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { DashboardPluginApi, DashboardQuery } from "../../../api/contract.js";
|
|
2
|
-
import { DashboardPayload } from "../../../types.js";
|
|
3
|
-
//#region src/plugins/diagnostics/api/contract.d.ts
|
|
4
|
-
/** The typed operation contract shared by the diagnostics page and runtime targets. */
|
|
5
|
-
declare const diagnosticsApi: DashboardPluginApi<"diagnostics", {
|
|
6
|
-
readonly overview: DashboardQuery<undefined, DashboardPayload>;
|
|
7
|
-
}, {}>;
|
|
8
|
-
type DiagnosticsApi = typeof diagnosticsApi;
|
|
9
|
-
//#endregion
|
|
10
|
-
export { DiagnosticsApi, diagnosticsApi as default };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{api as e,query as t}from"../../../api/contract.js";import{z as n}from"zod";const r=e({id:`diagnostics`,queries:{overview:t({output:n.custom()})},commands:{}});export{r as default};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { DashboardInitializationContext, DashboardPluginImplementation } from "../../../api/contract.js";
|
|
2
|
-
import { DashboardLocalHostData } from "../../../server.js";
|
|
3
|
-
import { DiagnosticsApi } from "./contract.js";
|
|
4
|
-
|
|
5
|
-
//#region src/plugins/diagnostics/api/local.d.ts
|
|
6
|
-
declare function createImplementation({
|
|
7
|
-
host
|
|
8
|
-
}: DashboardInitializationContext<DashboardLocalHostData>): DashboardPluginImplementation<DiagnosticsApi, DashboardLocalHostData>;
|
|
9
|
-
//#endregion
|
|
10
|
-
export { createImplementation };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{defineImplementation as e}from"../../../api/contract.js";import t from"./contract.js";import{inspectWorkerEnvironment as n}from"@coreframe/deploy";import{runDiagnostics as r}from"@coreframe/diagnostics";function i({host:i}){return e(t,{queries:{async overview(){let[e,t]=await Promise.all([r({projectRoot:i.projectRoot,environment:`development`,env:process.env}),n({cwd:i.projectRoot})]);return{mode:`local`,diagnostics:e,workerEnvironment:t}}},commands:{}})}export{i as createImplementation};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { DashboardInitializationContext, DashboardPluginImplementation } from "../../../api/contract.js";
|
|
2
|
-
import { DashboardWorkerHostData } from "../../../worker.js";
|
|
3
|
-
import { DiagnosticsApi } from "./contract.js";
|
|
4
|
-
|
|
5
|
-
//#region src/plugins/diagnostics/api/worker.d.ts
|
|
6
|
-
declare function createImplementation(_context: DashboardInitializationContext<DashboardWorkerHostData>): DashboardPluginImplementation<DiagnosticsApi, DashboardWorkerHostData>;
|
|
7
|
-
//#endregion
|
|
8
|
-
export { createImplementation };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{defineImplementation as e}from"../../../api/contract.js";import t from"./contract.js";function n(n){return e(t,{queries:{overview({host:e}){return{mode:`deployed`,environment:e.environment,release:e.release,configuration:[...e.configuration],links:[...e.links]}}},commands:{}})}export{n as createImplementation};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { DashboardPluginApi, DashboardQuery } from "../../api/contract.js";
|
|
2
|
-
import { DashboardPayload } from "../../types.js";
|
|
3
|
-
//#region src/plugins/diagnostics/index.d.ts
|
|
4
|
-
declare const diagnosticsPlugin: {
|
|
5
|
-
readonly id: "diagnostics";
|
|
6
|
-
readonly navigation: {
|
|
7
|
-
readonly path: "diagnostics";
|
|
8
|
-
readonly title: "Production readiness";
|
|
9
|
-
readonly description: "Review launch readiness, deployment configuration, and project health.";
|
|
10
|
-
};
|
|
11
|
-
readonly pageModule: "@coreframe/dashboard/plugins/diagnostics/web";
|
|
12
|
-
readonly api: DashboardPluginApi<"diagnostics", {
|
|
13
|
-
readonly overview: DashboardQuery<undefined, DashboardPayload>;
|
|
14
|
-
}, {}>;
|
|
15
|
-
};
|
|
16
|
-
/** Registers Coreframe's built-in production-readiness dashboard. */
|
|
17
|
-
declare function diagnostics(): {
|
|
18
|
-
readonly id: "diagnostics";
|
|
19
|
-
readonly navigation: {
|
|
20
|
-
readonly path: "diagnostics";
|
|
21
|
-
readonly title: "Production readiness";
|
|
22
|
-
readonly description: "Review launch readiness, deployment configuration, and project health.";
|
|
23
|
-
};
|
|
24
|
-
readonly pageModule: "@coreframe/dashboard/plugins/diagnostics/web";
|
|
25
|
-
readonly api: DashboardPluginApi<"diagnostics", {
|
|
26
|
-
readonly overview: DashboardQuery<undefined, DashboardPayload>;
|
|
27
|
-
}, {}>;
|
|
28
|
-
};
|
|
29
|
-
//#endregion
|
|
30
|
-
export { diagnostics, diagnosticsPlugin };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{definePlugin as e}from"../../config.js";import t from"./api/contract.js";const n=e({id:`diagnostics`,navigation:{path:`diagnostics`,title:`Production readiness`,description:`Review launch readiness, deployment configuration, and project health.`},pageModule:`@coreframe/dashboard/plugins/diagnostics/web`,api:t},{apiModule:`@coreframe/dashboard/plugins/diagnostics/api/contract`,localImplementationModule:`@coreframe/dashboard/plugins/diagnostics/api/local`,deployedImplementationModule:`@coreframe/dashboard/plugins/diagnostics/api/worker`});function r(){return n}export{r as diagnostics,n as diagnosticsPlugin};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createClient as e}from"../../../api/client.js";import t from"../api/contract.js";import{queryOptions as n}from"@tanstack/react-query";const r={overview:()=>n({queryKey:[`dashboard`,`plugins`,`diagnostics`,`overview`],queryFn:()=>e(t).queries.overview()})};export{r as diagnosticsQueries};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Button as e,EmptyState as t,ErrorState as n}from"../../web/ui/index.js";import{DashboardPage as r}from"../../web/dashboard/dashboard-page.js";import{DeployedDashboardPage as i}from"../../web/dashboard/deployed-dashboard-page.js";import a from"../../web/root.style.js";import{diagnosticsQueries as o}from"./web/queries.js";import{useQuery as s}from"@tanstack/react-query";import{jsx as c}from"react/jsx-runtime";function l(){let t=s(o.overview());return t.isPending?c(u,{title:`Loading dashboard`,message:`Reading the latest project diagnostics.`}):t.isError?c(u,{error:!0,title:`Dashboard unavailable`,message:t.error.message,action:c(e,{className:a.button,onClick:()=>void t.refetch(),children:`Retry`})}):t.data.mode===`deployed`?c(i,{payload:t.data,onRefresh:()=>void t.refetch()}):c(r,{payload:t.data,onRefresh:()=>void t.refetch()})}function u({title:e,message:r,action:i,error:o=!1}){return c(o?n:t,{action:i,className:a.statePage,message:r,title:e})}export{l as default};
|