@decafhub/decaf-react-webapp 0.0.4 → 0.0.6
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/CHANGELOG.md +22 -0
- package/dist/Layout.d.ts.map +1 -1
- package/dist/components/Page404.d.ts +3 -0
- package/dist/components/Page404.d.ts.map +1 -0
- package/dist/components/PageAbout.d.ts +9 -0
- package/dist/components/PageAbout.d.ts.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +1 -1
- package/dist/index.modern.mjs.map +1 -1
- package/dist/index.module.js +1 -1
- package/dist/index.module.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/theme.d.ts.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.6](https://github.com/teloscube/decaf-react-webapp/compare/v0.0.5...v0.0.6) (2022-12-01)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add 404 page ([d1f4cd1](https://github.com/teloscube/decaf-react-webapp/commit/d1f4cd1c9773cae742c3662eeaddacc1fa20e491))
|
|
9
|
+
* add about page initially ([ff72e02](https://github.com/teloscube/decaf-react-webapp/commit/ff72e024fa80cb882f0b81e0385a83c721a224d1))
|
|
10
|
+
* better coloring for inputs ([7f4b646](https://github.com/teloscube/decaf-react-webapp/commit/7f4b646747a467c2cc9fca3039e881c7ab880efe))
|
|
11
|
+
* get app description as prop ([3c1ec4d](https://github.com/teloscube/decaf-react-webapp/commit/3c1ec4ddaa8082a4a049b5464ea2877cc6d7dbd4))
|
|
12
|
+
|
|
13
|
+
## [0.0.5](https://github.com/teloscube/decaf-react-webapp/compare/v0.0.4...v0.0.5) (2022-11-30)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* use lato font ([6bd8fe0](https://github.com/teloscube/decaf-react-webapp/commit/6bd8fe03d2655ac9cff6f41047a691b9b969a4b1))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
* menu renders mobile version on desktop app even for a few items ([9af83d6](https://github.com/teloscube/decaf-react-webapp/commit/9af83d6764d91fdfc05a416bc0338f188e31eba2))
|
|
24
|
+
|
|
3
25
|
## [0.0.4](https://github.com/teloscube/decaf-react-webapp/compare/v0.0.3...v0.0.4) (2022-11-29)
|
|
4
26
|
|
|
5
27
|
|
package/dist/Layout.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Layout.d.ts","sourceRoot":"","sources":["../src/Layout.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAe,MAAM,6BAA6B,CAAC;AACpE,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,UAAU,iBAAiB;IACzB,KAAK,EAAE,GAAG,CAAC;IACX,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,QAAQ,CAAC,EAAE,aAAa,EAAE,CAAC;CAC5B;AAED,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAAG,CAAC;IAAE,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAEtF,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,aAAa,EAAE,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"Layout.d.ts","sourceRoot":"","sources":["../src/Layout.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAe,MAAM,6BAA6B,CAAC;AACpE,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,UAAU,iBAAiB;IACzB,KAAK,EAAE,GAAG,CAAC;IACX,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,QAAQ,CAAC,EAAE,aAAa,EAAE,CAAC;CAC5B;AAED,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAAG,CAAC;IAAE,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAEtF,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,aAAa,EAAE,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,QAAQ,EAAE,CAwBnE;AAED,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,KAAK,EAAE,gBAAgB,eA2B1D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Page404.d.ts","sourceRoot":"","sources":["../../src/components/Page404.tsx"],"names":[],"mappings":";AAGA,MAAM,CAAC,OAAO,UAAU,OAAO,gBAE9B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface AboutPageProps {
|
|
3
|
+
appName?: string;
|
|
4
|
+
appVersion?: string;
|
|
5
|
+
appDescription?: string;
|
|
6
|
+
content?: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export default function PageAbout(props: AboutPageProps): JSX.Element;
|
|
9
|
+
//# sourceMappingURL=PageAbout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PageAbout.d.ts","sourceRoot":"","sources":["../../src/components/PageAbout.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAEnD,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AACD,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,KAAK,EAAE,cAAc,eAmBtD"}
|
package/dist/index.d.ts
CHANGED
|
@@ -12,10 +12,24 @@ export interface DecafWebappProps {
|
|
|
12
12
|
config?: DecafAppConfig;
|
|
13
13
|
controller?: DecafAppController;
|
|
14
14
|
theme?: ThemeConfig;
|
|
15
|
+
/**
|
|
16
|
+
* App routes.<br />
|
|
17
|
+
* About page and 404 page will be added automatically.<br />
|
|
18
|
+
* See https://reactrouter.com/en/main/routers/create-browser-router#routes
|
|
19
|
+
*/
|
|
15
20
|
routes: DecafRoute[];
|
|
21
|
+
/**
|
|
22
|
+
* App menu.<br />
|
|
23
|
+
* About page will be added automatically.
|
|
24
|
+
*/
|
|
16
25
|
menuItems: DecafMenuItem[];
|
|
17
26
|
appName: string;
|
|
27
|
+
appDescription?: string;
|
|
18
28
|
appIcon?: React.ReactNode;
|
|
29
|
+
/**
|
|
30
|
+
* The extra content to show on the about page.
|
|
31
|
+
*/
|
|
32
|
+
aboutPageContent?: React.ReactNode;
|
|
19
33
|
}
|
|
20
34
|
declare function DecafWebapp(props: DecafWebappProps): JSX.Element;
|
|
21
35
|
export { DecafWebapp, Global as GlobalStyle, css, styled, decafTheme };
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAY,cAAc,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AACrF,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,OAAO,qBAAqB,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAA+B,WAAW,EAAkB,MAAM,kBAAkB,CAAC;AAE5F,OAAoB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,MAAM,MAAM,UAAU,GAAG,WAAW,CAAC;AAErC,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,UAAU,CAAC,EAAE,kBAAkB,CAAC;IAChC,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB;;;;OAIG;IACH,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB;;;OAGG;IACH,SAAS,EAAE,aAAa,EAAE,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;OAEG;IACH,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACpC;AAoCD,iBAAS,WAAW,CAAC,KAAK,EAAE,gBAAgB,eAqE3C;AAED,OAAO,EAAE,WAAW,EAAE,MAAM,IAAI,WAAW,EAAE,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e=require("@decafhub/decaf-react"),
|
|
1
|
+
var e=require("@ant-design/icons"),t=require("@decafhub/decaf-react"),n=require("@emotion/react"),r=require("@emotion/styled"),o=require("antd");require("antd/dist/reset.css");var a=require("react"),l=require("react-router-dom");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=/*#__PURE__*/c(r),u=/*#__PURE__*/c(a);function d(){return d=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},d.apply(this,arguments)}function s(e){var n=t.useDecaf().client,r=a.useState(void 0),l=r[0],c=r[1];return a.useEffect(function(){n.barista.get("/version/").then(function(e){return c(e.data.version)})},[n]),u.default.createElement(o.Space,{direction:"vertical",size:"middle",style:{width:"100%"}},u.default.createElement(o.Descriptions,{title:"About",column:1,bordered:!0},u.default.createElement(o.Descriptions.Item,{label:"Web Application Name"},e.appName),u.default.createElement(o.Descriptions.Item,{label:"Web Application Description"},e.appDescription),u.default.createElement(o.Descriptions.Item,{label:"Web Application Version"},"v"+e.appVersion),u.default.createElement(o.Descriptions.Item,{label:"DECAF Barista Version"},"v"+l)),e.content)}function f(){return u.default.createElement(o.Result,{status:"404",title:"404",subTitle:"Sorry, the page you visited does not exist."})}function p(e){var t=[];return e.forEach(function(e){var n={key:"to"in e?e.to:e.label,label:e.label,icon:e.icon};"to"in e&&e.to?n.label=u.default.createElement(l.NavLink,{to:e.to,end:"/"===e.to},e.label):"href"in e&&e.href?n.label=u.default.createElement("a",{href:e.href},e.label):e.children&&(n.label=e.label,n.children=p(e.children||[])),t.push(n)}),t}function m(e){var t=p(e.menu),n=l.useMatches().map(function(e){return e.pathname});return u.default.createElement(o.Layout,{style:{height:"100%"}},u.default.createElement(o.Layout.Header,{style:{paddingInline:0}},u.default.createElement("div",{style:{paddingInline:20,display:"flex",justifyContent:"space-between",alignItems:"center"}},u.default.createElement(l.Link,{to:"/",style:{display:"flex",alignItems:"center",gap:10}},e.appIcon,u.default.createElement(o.Typography.Title,{level:4,style:{margin:0}},e.appName)),u.default.createElement(o.Menu,{style:{justifyContent:"flex-end",backgroundColor:"transparent",border:"none",flex:1},mode:"horizontal",items:t,selectedKeys:n}))),u.default.createElement(o.Layout.Content,{style:{padding:"20px 50px"}},e.children),u.default.createElement(o.Layout.Footer,{style:{textAlign:"center"}}))}var b={colorBorder:"#10161d",colorBorderSecondary:"#10161d"},h={hashed:!0,components:{Layout:{colorBgHeader:"#10161d"},Button:{boxShadow:"none",boxShadowSecondary:"none",colorBgContainer:"#2c3d50"},Input:d({},b,{colorBgContainer:"#2c3d50"}),Select:d({},b,{colorBgContainer:"#2c3d50"}),Dropdown:d({},b,{colorBgElevated:"#2c3d50",controlItemBgActive:"#2c3d50"}),DatePicker:d({},b,{colorBgContainer:"#2c3d50",colorBgElevated:"#2c3d50"}),InputNumber:d({},b,{colorBgContainer:"#2c3d50"}),Checkbox:d({},b,{colorBgContainer:"#2c3d50"})},token:{fontFamily:"Lato, sans-serif",colorPrimary:"#344961",colorBgBase:"#1a242f",colorBgContainer:"#10161d",colorBgElevated:"#1a242f",colorBorderSecondary:"#1a242f",colorBorder:"#1a242f",colorBgLayout:"#1a242f",borderRadius:0,green:"#48734d",red:"#b03a38",blue:"#0d6efd",yellow:"#ffc107",colorWhite:"#fff"},algorithm:[o.theme.darkAlgorithm]};function g(e,t){var n=[];return t.forEach(function(t){var r,o=d({},t);t.children?(o.element=null!=(r=t.element)?r:u.default.createElement(l.Outlet,null),o.children=g(e,t.children)):o.element=u.default.createElement(m,{menu:e.menuItems,appName:e.appName,appIcon:e.appIcon},t.element),n.push(o)}),n}function y(e,t,n){var r=[].concat(e);return t.forEach(function(e){var t=r.findIndex(function(t){return t[n]===e[n]});t>=0?r[t]=e:r.push(e)}),r}Object.defineProperty(exports,"GlobalStyle",{enumerable:!0,get:function(){return n.Global}}),Object.defineProperty(exports,"css",{enumerable:!0,get:function(){return n.css}}),Object.defineProperty(exports,"styled",{enumerable:!0,get:function(){return i.default}}),exports.DecafWebapp=function(r){var a,c,i,p,m,b,v,E=y(r.routes,[{path:"/about",element:u.default.createElement(s,{appName:r.appName,appVersion:null==(a=r.config)?void 0:a.currentVersion,appDescription:r.appDescription,content:r.aboutPageContent})},{path:"*",element:u.default.createElement(f,null)}],"path");E=g(d({},r,{menuItems:y(r.menuItems,[{label:"About",to:"/about",icon:u.default.createElement(e.InfoCircleOutlined,null)}],"to")}),E);var B=l.createBrowserRouter(E,{basename:null==(c=r.config)?void 0:c.basePath}),I=null!=(i=r.theme)?i:h;return u.default.createElement(o.ConfigProvider,{theme:I},u.default.createElement(n.Global,{styles:{"@font-face":{fontFamily:"Lato, sans-serif",src:"url(https://fonts.googleapis.com/css2?family=Lato:wght@400;700&display=swap)"},body:{background:null==(p=I.token)?void 0:p.colorBgBase,fontFamily:null==(m=I.token)?void 0:m.fontFamily,margin:0},button:{boxShadow:"none !important"},".ant-page-header-back-button, .ant-page-header-heading-title":{color:(null==(b=I.token)?void 0:b.colorWhite)+" !important"},".ant-badge-count":{color:(null==(v=I.token)?void 0:v.colorWhite)+" !important"}}}),u.default.createElement(t.DecafApp,{config:r.config,controller:r.controller},u.default.createElement(l.RouterProvider,{router:B})))},exports.decafTheme=h;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/Layout.tsx","../src/theme.ts","../src/index.tsx"],"sourcesContent":["import { Layout, Menu, Typography } from 'antd';\nimport { ItemType, SubMenuType } from 'antd/es/menu/hooks/useItems';\nimport React from 'react';\nimport { Link, NavLink, useMatches } from 'react-router-dom';\n\ninterface BaseDecafMenuItem {\n label: any;\n icon?: React.ReactNode;\n children?: DecafMenuItem[];\n}\n\nexport type DecafMenuItem = BaseDecafMenuItem & ({ to?: string } | { href?: string });\n\nexport interface DecafLayoutProps {\n menu: DecafMenuItem[];\n appName: string;\n appIcon?: React.ReactNode;\n children: React.ReactNode;\n}\n\nexport function routesToAntMenu(routes: DecafMenuItem[]): ItemType[] {\n const result: ItemType[] = [];\n\n routes.forEach((route) => {\n const item: ItemType = {\n key: 'to' in route ? route.to : route.label,\n label: route.label,\n icon: route.icon,\n };\n if ('to' in route && route.to) {\n item.label = (\n <NavLink to={route.to} end={route.to === '/'}>\n {route.label}\n </NavLink>\n );\n } else if ('href' in route && route.href) {\n item.label = <a href={route.href}>{route.label}</a>;\n } else if (route.children) {\n item.label = route.label;\n (item as SubMenuType).children = routesToAntMenu(route.children || []);\n }\n result.push(item);\n });\n\n return result;\n}\n\nexport default function DecafLayout(props: DecafLayoutProps) {\n const menuItems = routesToAntMenu(props.menu);\n const matches = useMatches();\n const matchedMenuItems = matches.map((match) => match.pathname);\n\n return (\n <Layout style={{ height: '100%' }}>\n <Layout.Header style={{ paddingInline: 0 }}>\n <div style={{ paddingInline: 20, display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>\n <Link to=\"/\" style={{ display: 'flex', alignItems: 'center', gap: 10 }}>\n {props.appIcon}\n <Typography.Title level={4} style={{ margin: 0 }}>\n {props.appName}\n </Typography.Title>\n </Link>\n <Menu\n style={{ justifyContent: 'flex-end', backgroundColor: 'transparent', border: 'none' }}\n mode=\"horizontal\"\n items={menuItems}\n selectedKeys={matchedMenuItems}\n />\n </div>\n </Layout.Header>\n <Layout.Content style={{ padding: '20px 50px' }}>{props.children}</Layout.Content>\n </Layout>\n );\n}\n","import { theme } from 'antd';\nimport { ThemeConfig } from 'antd/es/config-provider/context';\n\nexport const decafTheme: ThemeConfig = {\n hashed: true,\n components: {\n Layout: {\n colorBgHeader: '#10161d',\n },\n Button: {\n boxShadow: 'none',\n boxShadowSecondary: 'none',\n },\n },\n token: {\n fontFamily:\n '\"Inter\",system-ui,-apple-system,\"Segoe UI\",Roboto,\"Helvetica Neue\",Arial,\"Noto Sans\",\"Liberation Sans\",sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\"',\n colorPrimary: '#344961',\n colorBgBase: '#1a242f',\n colorBgLayout: '#1a242f',\n borderRadius: 0,\n // colorError: '#b03a38',\n // colorSuccess: '#48734d',\n // colorWarning: '#ffc107',\n // colorInfo: '#4694ab',\n green: '#48734d',\n red: '#b03a38',\n blue: '#0d6efd',\n yellow: '#ffc107',\n colorWhite: '#fff',\n },\n\n algorithm: [theme.darkAlgorithm],\n};\n","import { DecafApp, DecafAppConfig, DecafAppController } from '@decafhub/decaf-react';\nimport { css, Global } from '@emotion/react';\nimport styled from '@emotion/styled';\nimport { ConfigProvider } from 'antd';\nimport 'antd/dist/reset.css';\nimport { ThemeConfig } from 'antd/es/config-provider/context';\nimport React from 'react';\nimport { createBrowserRouter, Outlet, RouteObject, RouterProvider } from 'react-router-dom';\nimport DecafLayout, { DecafMenuItem } from './Layout';\nimport { decafTheme } from './theme';\n\nexport type DecafRoute = RouteObject;\n\nexport interface DecafWebappProps {\n config?: DecafAppConfig;\n controller?: DecafAppController;\n theme?: ThemeConfig;\n routes: DecafRoute[];\n menuItems: DecafMenuItem[];\n appName: string;\n appIcon?: React.ReactNode;\n}\n\nfunction buildRoutes(props: DecafWebappProps, routes: DecafRoute[]): RouteObject[] {\n const result: RouteObject[] = [];\n\n routes.forEach((route) => {\n const item: RouteObject = { ...route };\n if (route.children) {\n item.element = route.element ?? <Outlet />;\n item.children = buildRoutes(props, route.children);\n } else {\n item.element = (\n <DecafLayout menu={props.menuItems} appName={props.appName} appIcon={props.appIcon}>\n {route.element}\n </DecafLayout>\n );\n }\n result.push(item);\n });\n\n return result;\n}\n\nfunction DecafWebapp(props: DecafWebappProps) {\n const routes = buildRoutes(props, props.routes);\n const router = createBrowserRouter(routes, {\n basename: props.config?.basePath,\n });\n\n const theme = props.theme ?? decafTheme;\n\n return (\n <ConfigProvider theme={theme}>\n <Global\n styles={{\n body: {\n background: theme.token?.colorBgBase,\n fontFamily: theme.token?.fontFamily,\n margin: 0,\n },\n // antd overrides\n button: {\n boxShadow: 'none !important',\n },\n '.ant-page-header-back-button, .ant-page-header-heading-title': {\n color: `${theme.token?.colorWhite} !important`,\n },\n '.ant-badge-count': {\n color: `${theme.token?.colorWhite} !important`,\n },\n // end antd overrides\n }}\n />\n <DecafApp config={props.config} controller={props.controller}>\n <RouterProvider router={router} />\n </DecafApp>\n </ConfigProvider>\n );\n}\n\nexport { DecafWebapp, Global as GlobalStyle, css, styled, decafTheme };\n"],"names":["routesToAntMenu","routes","result","forEach","route","item","key","to","label","icon","React","createElement","NavLink","end","href","children","push","DecafLayout","props","menuItems","menu","matchedMenuItems","useMatches","map","match","pathname","Layout","style","height","Header","paddingInline","display","justifyContent","alignItems","Link","gap","appIcon","Typography","Title","level","margin","appName","Menu","backgroundColor","border","mode","items","selectedKeys","Content","padding","decafTheme","hashed","components","colorBgHeader","Button","boxShadow","boxShadowSecondary","token","fontFamily","colorPrimary","colorBgBase","colorBgLayout","borderRadius","green","red","blue","yellow","colorWhite","algorithm","theme","darkAlgorithm","buildRoutes","_route$element","element","Outlet","_props$config","_props$theme","_theme$token","_theme$token2","_theme$token3","_theme$token4","router","createBrowserRouter","basename","config","basePath","ConfigProvider","Global","styles","body","background","button","color","DecafApp","controller","RouterProvider"],"mappings":"uiBAoB+BA,EAACC,GAC9B,IAAYC,EAAe,GAuB3B,OArBAD,EAAOE,QAAQ,SAACC,GACd,IAAUC,EAAa,CACrBC,IAAK,OAAaF,EAAGA,EAAMG,GAAKH,EAAMI,MACtCA,MAAOJ,EAAMI,MACbC,KAAML,EAAMK,MAEV,OAAaL,GAAIA,EAAMG,GACzBF,EAAKG,MACHE,EAAA,QAAAC,cAACC,EAAAA,QAAO,CAACL,GAAIH,EAAMG,GAAIM,IAAkB,MAAbT,EAAMG,IAC/BH,EAAMI,OAGF,SAAeJ,GAAIA,EAAMU,KAClCT,EAAKG,MAAQE,UAAAC,cAAA,IAAA,CAAGG,KAAMV,EAAMU,MAAOV,EAAMI,OAChCJ,EAAMW,WACfV,EAAKG,MAAQJ,EAAMI,MAClBH,EAAqBU,SAAWf,EAAgBI,EAAMW,UA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C,GACd,IACoBoE,IADWpE,EAAAA,GAAAA,GAC3BA,EAAMW,UACRV,EAAKoE,QAAuB,OAAbrE,EAAAA,EAAMqE,SAAOD,EAAI9D,UAAAC,cAAC+D,EAAMA,OAAA,MACvCrE,EAAKU,SAAWwD,EAAYrD,EAAOd,EAAMW,WAEzCV,EAAKoE,QACH/D,EAAAA,QAACC,cAAAM,EAAY,CAAAG,KAAMF,EAAMC,UAAWsB,QAASvB,EAAMuB,QAASL,QAASlB,EAAMkB,SACxEhC,EAAMqE,SAIbvE,EAAOc,KAAKX,EACd,GAEOH,CACT,6RAEA,SAAqBgB,GACnB,IAAAyD,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,IAAeT,EAAYrD,EAAOA,EAAMjB,QAClCgF,EAASC,sBAAoBjF,EAAQ,CACzCkF,SAAU,OAAFR,EAAEzD,EAAMkE,aAAN,EAAAT,EAAcU,WAGpBhB,EAAmB,SAAXnD,EAAMmD,OAAKO,EAAI1B,EAE7B,iBACGvC,cAAA2E,EAAcA,eAAC,CAAAjB,MAAOA,GACrB3D,UAACC,cAAA4E,EAAMA,OACL,CAAAC,OAAQ,CACNC,KAAM,CACJC,WAAY,OAAFb,EAAER,EAAMZ,YAAN,EAAAoB,EAAajB,YACzBF,WAAuB,SAAXW,EAAMZ,YAAK,EAAXqB,EAAapB,WACzBlB,OAAQ,GAGVmD,OAAQ,CACNpC,UAAW,mBAEb,+DAAgE,CAC9DqC,cAAKb,EAAKV,EAAMZ,cAANsB,EAAaZ,2BAEzB,mBAAoB,CAClByB,cAAKZ,EAAKX,EAAMZ,cAANuB,EAAab,YACxB,kBAILzD,UAAAC,cAACkF,EAAQA,SAAA,CAACT,OAAQlE,EAAMkE,OAAQU,WAAY5E,EAAM4E,YAChDpF,UAACC,cAAAoF,EAAcA,gBAACd,OAAQA,KAIhC"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/components/PageAbout.tsx","../src/components/Page404.tsx","../src/Layout.tsx","../src/theme.ts","../src/index.tsx"],"sourcesContent":["import { useDecaf } from '@decafhub/decaf-react';\nimport { Descriptions, Space } from 'antd';\nimport React, { useEffect, useState } from 'react';\n\nexport interface AboutPageProps {\n appName?: string;\n appVersion?: string;\n appDescription?: string;\n content?: React.ReactNode;\n}\nexport default function PageAbout(props: AboutPageProps) {\n const { client } = useDecaf();\n const [versionBarista, setVersionBarista] = useState<string | undefined>(undefined);\n\n useEffect(() => {\n client.barista.get<{ version: string }>('/version/').then(({ data }) => setVersionBarista(data.version));\n }, [client]);\n\n return (\n <Space direction=\"vertical\" size=\"middle\" style={{ width: '100%' }}>\n <Descriptions title=\"About\" column={1} bordered>\n <Descriptions.Item label=\"Web Application Name\">{props.appName}</Descriptions.Item>\n <Descriptions.Item label=\"Web Application Description\">{props.appDescription}</Descriptions.Item>\n <Descriptions.Item label=\"Web Application Version\">{`v${props.appVersion}`}</Descriptions.Item>\n <Descriptions.Item label=\"DECAF Barista Version\">{`v${versionBarista}`}</Descriptions.Item>\n </Descriptions>\n {props.content}\n </Space>\n );\n}\n","import { Result } from 'antd';\nimport React from 'react';\n\nexport default function Page404() {\n return <Result status=\"404\" title={'404'} subTitle={'Sorry, the page you visited does not exist.'} />;\n}\n","import { Layout, Menu, Typography } from 'antd';\nimport { ItemType, SubMenuType } from 'antd/es/menu/hooks/useItems';\nimport React from 'react';\nimport { Link, NavLink, useMatches } from 'react-router-dom';\n\ninterface BaseDecafMenuItem {\n label: any;\n icon?: React.ReactNode;\n children?: DecafMenuItem[];\n}\n\nexport type DecafMenuItem = BaseDecafMenuItem & ({ to?: string } | { href?: string });\n\nexport interface DecafLayoutProps {\n menu: DecafMenuItem[];\n appName: string;\n appIcon?: React.ReactNode;\n children: React.ReactNode;\n}\n\nexport function routesToAntMenu(routes: DecafMenuItem[]): ItemType[] {\n const result: ItemType[] = [];\n routes.forEach((route) => {\n const item: ItemType = {\n key: 'to' in route ? route.to : route.label,\n label: route.label,\n icon: route.icon,\n };\n if ('to' in route && route.to) {\n item.label = (\n <NavLink to={route.to} end={route.to === '/'}>\n {route.label}\n </NavLink>\n );\n } else if ('href' in route && route.href) {\n item.label = <a href={route.href}>{route.label}</a>;\n } else if (route.children) {\n item.label = route.label;\n (item as SubMenuType).children = routesToAntMenu(route.children || []);\n }\n result.push(item);\n });\n\n return result;\n}\n\nexport default function DecafLayout(props: DecafLayoutProps) {\n const menuItems = routesToAntMenu(props.menu);\n const matches = useMatches();\n const matchedMenuItems = matches.map((match) => match.pathname);\n\n return (\n <Layout style={{ height: '100%' }}>\n <Layout.Header style={{ paddingInline: 0 }}>\n <div style={{ paddingInline: 20, display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>\n <Link to=\"/\" style={{ display: 'flex', alignItems: 'center', gap: 10 }}>\n {props.appIcon}\n <Typography.Title level={4} style={{ margin: 0 }}>\n {props.appName}\n </Typography.Title>\n </Link>\n <Menu\n style={{ justifyContent: 'flex-end', backgroundColor: 'transparent', border: 'none', flex: 1 }}\n mode=\"horizontal\"\n items={menuItems}\n selectedKeys={matchedMenuItems}\n />\n </div>\n </Layout.Header>\n <Layout.Content style={{ padding: '20px 50px' }}>{props.children}</Layout.Content>\n <Layout.Footer style={{ textAlign: 'center' }}></Layout.Footer>\n </Layout>\n );\n}\n","import { theme } from 'antd';\nimport { ThemeConfig } from 'antd/es/config-provider/context';\n\nconst BORDER_COLORS_TRANSPARENT = {\n colorBorder: '#10161d',\n colorBorderSecondary: '#10161d',\n};\n\nconst INPUT_BG_COLOR = '#2c3d50';\n\nexport const decafTheme: ThemeConfig = {\n hashed: true,\n components: {\n Layout: {\n colorBgHeader: '#10161d',\n },\n Button: {\n boxShadow: 'none',\n boxShadowSecondary: 'none',\n colorBgContainer: INPUT_BG_COLOR,\n },\n Input: {\n ...BORDER_COLORS_TRANSPARENT,\n colorBgContainer: INPUT_BG_COLOR,\n },\n Select: {\n ...BORDER_COLORS_TRANSPARENT,\n colorBgContainer: INPUT_BG_COLOR,\n },\n Dropdown: {\n ...BORDER_COLORS_TRANSPARENT,\n colorBgElevated: INPUT_BG_COLOR,\n controlItemBgActive: INPUT_BG_COLOR,\n },\n DatePicker: {\n ...BORDER_COLORS_TRANSPARENT,\n colorBgContainer: INPUT_BG_COLOR,\n colorBgElevated: INPUT_BG_COLOR,\n },\n InputNumber: {\n ...BORDER_COLORS_TRANSPARENT,\n colorBgContainer: INPUT_BG_COLOR,\n },\n Checkbox: {\n ...BORDER_COLORS_TRANSPARENT,\n colorBgContainer: INPUT_BG_COLOR,\n },\n },\n token: {\n fontFamily: 'Lato, sans-serif',\n colorPrimary: '#344961',\n colorBgBase: '#1a242f',\n colorBgContainer: '#10161d',\n colorBgElevated: '#1a242f',\n colorBorderSecondary: '#1a242f',\n colorBorder: '#1a242f',\n colorBgLayout: '#1a242f',\n borderRadius: 0,\n green: '#48734d',\n red: '#b03a38',\n blue: '#0d6efd',\n yellow: '#ffc107',\n colorWhite: '#fff',\n },\n\n algorithm: [theme.darkAlgorithm],\n};\n","import { InfoCircleOutlined } from '@ant-design/icons';\nimport { DecafApp, DecafAppConfig, DecafAppController } from '@decafhub/decaf-react';\nimport { css, Global } from '@emotion/react';\nimport styled from '@emotion/styled';\nimport { ConfigProvider } from 'antd';\nimport 'antd/dist/reset.css';\nimport { ThemeConfig } from 'antd/es/config-provider/context';\nimport PageAbout from 'components/PageAbout';\nimport React from 'react';\nimport { createBrowserRouter, Outlet, RouteObject, RouterProvider } from 'react-router-dom';\nimport Page404 from './components/Page404';\nimport DecafLayout, { DecafMenuItem } from './Layout';\nimport { decafTheme } from './theme';\n\nexport type DecafRoute = RouteObject;\n\nexport interface DecafWebappProps {\n config?: DecafAppConfig;\n controller?: DecafAppController;\n theme?: ThemeConfig;\n /**\n * App routes.<br />\n * About page and 404 page will be added automatically.<br />\n * See https://reactrouter.com/en/main/routers/create-browser-router#routes\n */\n routes: DecafRoute[];\n /**\n * App menu.<br />\n * About page will be added automatically.\n */\n menuItems: DecafMenuItem[];\n appName: string;\n appDescription?: string;\n appIcon?: React.ReactNode;\n /**\n * The extra content to show on the about page.\n */\n aboutPageContent?: React.ReactNode;\n}\n\nfunction buildRoutes(props: DecafWebappProps, routes: DecafRoute[]): RouteObject[] {\n const result: RouteObject[] = [];\n\n routes.forEach((route) => {\n const item: RouteObject = { ...route };\n if (route.children) {\n item.element = route.element ?? <Outlet />;\n item.children = buildRoutes(props, route.children);\n } else {\n item.element = (\n <DecafLayout menu={props.menuItems} appName={props.appName} appIcon={props.appIcon}>\n {route.element}\n </DecafLayout>\n );\n }\n result.push(item);\n });\n\n return result;\n}\n\nfunction addTo<T>(array: T[], items: T[], key: keyof T): T[] {\n const result: T[] = [...array];\n items.forEach((item) => {\n const index = result.findIndex((r) => r[key] === item[key]);\n if (index >= 0) {\n result[index] = item;\n } else {\n result.push(item);\n }\n });\n return result;\n}\n\nfunction DecafWebapp(props: DecafWebappProps) {\n let routes = addTo<RouteObject>(\n props.routes,\n [\n {\n path: '/about',\n element: (\n <PageAbout\n appName={props.appName}\n appVersion={props.config?.currentVersion}\n appDescription={props.appDescription}\n content={props.aboutPageContent}\n />\n ),\n },\n { path: '*', element: <Page404 /> },\n ],\n 'path'\n );\n const menuWithAboutPage = addTo(\n props.menuItems,\n [\n {\n label: 'About',\n to: '/about',\n icon: <InfoCircleOutlined />,\n },\n ],\n 'to' as any\n );\n routes = buildRoutes({ ...props, menuItems: menuWithAboutPage }, routes);\n\n const router = createBrowserRouter(routes, {\n basename: props.config?.basePath,\n });\n\n const theme = props.theme ?? decafTheme;\n\n return (\n <ConfigProvider theme={theme}>\n <Global\n styles={{\n '@font-face': {\n fontFamily: 'Lato, sans-serif',\n src: 'url(https://fonts.googleapis.com/css2?family=Lato:wght@400;700&display=swap)',\n },\n body: {\n background: theme.token?.colorBgBase,\n fontFamily: theme.token?.fontFamily,\n margin: 0,\n },\n // antd overrides\n button: {\n boxShadow: 'none !important',\n },\n '.ant-page-header-back-button, .ant-page-header-heading-title': {\n color: `${theme.token?.colorWhite} !important`,\n },\n '.ant-badge-count': {\n color: `${theme.token?.colorWhite} !important`,\n },\n // end antd overrides\n }}\n />\n <DecafApp config={props.config} controller={props.controller}>\n <RouterProvider router={router} />\n </DecafApp>\n </ConfigProvider>\n );\n}\n\nexport { DecafWebapp, Global as GlobalStyle, css, styled, decafTheme };\n"],"names":["PageAbout","props","client","useDecaf","_useState","useState","undefined","versionBarista","setVersionBarista","useEffect","barista","get","then","data","version","React","createElement","Space","direction","size","style","width","Descriptions","title","column","bordered","Item","label","appName","appDescription","appVersion","content","Page404","Result","status","subTitle","routesToAntMenu","routes","result","forEach","route","item","key","to","icon","NavLink","end","href","children","push","DecafLayout","menuItems","menu","matchedMenuItems","useMatches","map","match","pathname","Layout","height","Header","paddingInline","display","justifyContent","alignItems","Link","gap","appIcon","Typography","Title","level","margin","Menu","backgroundColor","border","flex","mode","items","selectedKeys","Content","padding","Footer","textAlign","BORDER_COLORS_TRANSPARENT","colorBorder","colorBorderSecondary","decafTheme","hashed","components","colorBgHeader","Button","boxShadow","boxShadowSecondary","colorBgContainer","Input","Select","Dropdown","colorBgElevated","controlItemBgActive","DatePicker","_extends","InputNumber","Checkbox","token","fontFamily","colorPrimary","colorBgBase","colorBgLayout","borderRadius","green","red","blue","yellow","colorWhite","algorithm","theme","darkAlgorithm","_route$element","element","Outlet","buildRoutes","addTo","array","index","findIndex","r","_props$config","_props$config2","_props$theme","_theme$token","_theme$token2","_theme$token3","_theme$token4","path","config","currentVersion","aboutPageContent","InfoCircleOutlined","router","createBrowserRouter","basename","basePath","ConfigProvider","Global","styles","src","body","background","button","color","DecafApp","controller","RouterProvider"],"mappings":"6jBAUwBA,SAAAA,EAAUC,GAChC,IAAQC,EAAWC,EAAAA,WAAXD,OACRE,EAA4CC,EAAQA,cAAqBC,GAAlEC,OAAgBC,EAAiBJ,EAAA,GAMxC,OAJAK,EAAAA,UAAU,WACRP,EAAOQ,QAAQC,IAAyB,aAAaC,KAAK,SAAGC,GAAI,WAAJA,KAAkCC,QAAQ,EACzG,EAA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gBAAed,OAAQA,KAIhC"}
|
package/dist/index.modern.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{InfoCircleOutlined as e}from"@ant-design/icons";import{useDecaf as t,DecafApp as o}from"@decafhub/decaf-react";import{Global as n}from"@emotion/react";export{Global as GlobalStyle,css}from"@emotion/react";export{default as styled}from"@emotion/styled";import{Space as r,Descriptions as a,Result as l,Layout as c,Typography as i,Menu as m,theme as s,ConfigProvider as d}from"antd";import"antd/dist/reset.css";import p,{useState as u,useEffect as f}from"react";import{useMatches as b,Link as h,NavLink as g,createBrowserRouter as y,RouterProvider as E,Outlet as v}from"react-router-dom";function B(){return B=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e},B.apply(this,arguments)}function I(e){const{client:o}=t(),[n,l]=u(void 0);return f(()=>{o.barista.get("/version/").then(({data:e})=>l(e.version))},[o]),p.createElement(r,{direction:"vertical",size:"middle",style:{width:"100%"}},p.createElement(a,{title:"About",column:1,bordered:!0},p.createElement(a.Item,{label:"Web Application Name"},e.appName),p.createElement(a.Item,{label:"Web Application Description"},e.appDescription),p.createElement(a.Item,{label:"Web Application Version"},`v${e.appVersion}`),p.createElement(a.Item,{label:"DECAF Barista Version"},`v${n}`)),e.content)}function x(){return p.createElement(l,{status:"404",title:"404",subTitle:"Sorry, the page you visited does not exist."})}function C(e){const t=[];return e.forEach(e=>{const o={key:"to"in e?e.to:e.label,label:e.label,icon:e.icon};"to"in e&&e.to?o.label=p.createElement(g,{to:e.to,end:"/"===e.to},e.label):"href"in e&&e.href?o.label=p.createElement("a",{href:e.href},e.label):e.children&&(o.label=e.label,o.children=C(e.children||[])),t.push(o)}),t}function k(e){const t=C(e.menu),o=b().map(e=>e.pathname);return p.createElement(c,{style:{height:"100%"}},p.createElement(c.Header,{style:{paddingInline:0}},p.createElement("div",{style:{paddingInline:20,display:"flex",justifyContent:"space-between",alignItems:"center"}},p.createElement(h,{to:"/",style:{display:"flex",alignItems:"center",gap:10}},e.appIcon,p.createElement(i.Title,{level:4,style:{margin:0}},e.appName)),p.createElement(m,{style:{justifyContent:"flex-end",backgroundColor:"transparent",border:"none",flex:1},mode:"horizontal",items:t,selectedKeys:o}))),p.createElement(c.Content,{style:{padding:"20px 50px"}},e.children),p.createElement(c.Footer,{style:{textAlign:"center"}}))}const w={colorBorder:"#10161d",colorBorderSecondary:"#10161d"},A={hashed:!0,components:{Layout:{colorBgHeader:"#10161d"},Button:{boxShadow:"none",boxShadowSecondary:"none",colorBgContainer:"#2c3d50"},Input:B({},w,{colorBgContainer:"#2c3d50"}),Select:B({},w,{colorBgContainer:"#2c3d50"}),Dropdown:B({},w,{colorBgElevated:"#2c3d50",controlItemBgActive:"#2c3d50"}),DatePicker:B({},w,{colorBgContainer:"#2c3d50",colorBgElevated:"#2c3d50"}),InputNumber:B({},w,{colorBgContainer:"#2c3d50"}),Checkbox:B({},w,{colorBgContainer:"#2c3d50"})},token:{fontFamily:"Lato, sans-serif",colorPrimary:"#344961",colorBgBase:"#1a242f",colorBgContainer:"#10161d",colorBgElevated:"#1a242f",colorBorderSecondary:"#1a242f",colorBorder:"#1a242f",colorBgLayout:"#1a242f",borderRadius:0,green:"#48734d",red:"#b03a38",blue:"#0d6efd",yellow:"#ffc107",colorWhite:"#fff"},algorithm:[s.darkAlgorithm]};function S(e,t){const o=[];return t.forEach(t=>{const n=B({},t);var r;t.children?(n.element=null!=(r=t.element)?r:p.createElement(v,null),n.children=S(e,t.children)):n.element=p.createElement(k,{menu:e.menuItems,appName:e.appName,appIcon:e.appIcon},t.element),o.push(n)}),o}function N(e,t,o){const n=[...e];return t.forEach(e=>{const t=n.findIndex(t=>t[o]===e[o]);t>=0?n[t]=e:n.push(e)}),n}function D(t){var r,a,l,c,i,m,s;let u=N(t.routes,[{path:"/about",element:p.createElement(I,{appName:t.appName,appVersion:null==(r=t.config)?void 0:r.currentVersion,appDescription:t.appDescription,content:t.aboutPageContent})},{path:"*",element:p.createElement(x,null)}],"path");u=S(B({},t,{menuItems:N(t.menuItems,[{label:"About",to:"/about",icon:p.createElement(e,null)}],"to")}),u);const f=y(u,{basename:null==(a=t.config)?void 0:a.basePath}),b=null!=(l=t.theme)?l:A;return p.createElement(d,{theme:b},p.createElement(n,{styles:{"@font-face":{fontFamily:"Lato, sans-serif",src:"url(https://fonts.googleapis.com/css2?family=Lato:wght@400;700&display=swap)"},body:{background:null==(c=b.token)?void 0:c.colorBgBase,fontFamily:null==(i=b.token)?void 0:i.fontFamily,margin:0},button:{boxShadow:"none !important"},".ant-page-header-back-button, .ant-page-header-heading-title":{color:`${null==(m=b.token)?void 0:m.colorWhite} !important`},".ant-badge-count":{color:`${null==(s=b.token)?void 0:s.colorWhite} !important`}}}),p.createElement(o,{config:t.config,controller:t.controller},p.createElement(E,{router:f})))}export{D as DecafWebapp,A as decafTheme};
|
|
2
2
|
//# sourceMappingURL=index.modern.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.modern.mjs","sources":["../src/Layout.tsx","../src/theme.ts","../src/index.tsx"],"sourcesContent":["import { Layout, Menu, Typography } from 'antd';\nimport { ItemType, SubMenuType } from 'antd/es/menu/hooks/useItems';\nimport React from 'react';\nimport { Link, NavLink, useMatches } from 'react-router-dom';\n\ninterface BaseDecafMenuItem {\n label: any;\n icon?: React.ReactNode;\n children?: DecafMenuItem[];\n}\n\nexport type DecafMenuItem = BaseDecafMenuItem & ({ to?: string } | { href?: string });\n\nexport interface DecafLayoutProps {\n menu: DecafMenuItem[];\n appName: string;\n appIcon?: React.ReactNode;\n children: React.ReactNode;\n}\n\nexport function routesToAntMenu(routes: DecafMenuItem[]): ItemType[] {\n const result: ItemType[] = [];\n\n routes.forEach((route) => {\n const item: ItemType = {\n key: 'to' in route ? route.to : route.label,\n label: route.label,\n icon: route.icon,\n };\n if ('to' in route && route.to) {\n item.label = (\n <NavLink to={route.to} end={route.to === '/'}>\n {route.label}\n </NavLink>\n );\n } else if ('href' in route && route.href) {\n item.label = <a href={route.href}>{route.label}</a>;\n } else if (route.children) {\n item.label = route.label;\n (item as SubMenuType).children = routesToAntMenu(route.children || []);\n }\n result.push(item);\n });\n\n return result;\n}\n\nexport default function DecafLayout(props: DecafLayoutProps) {\n const menuItems = routesToAntMenu(props.menu);\n const matches = useMatches();\n const matchedMenuItems = matches.map((match) => match.pathname);\n\n return (\n <Layout style={{ height: '100%' }}>\n <Layout.Header style={{ paddingInline: 0 }}>\n <div style={{ paddingInline: 20, display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>\n <Link to=\"/\" style={{ display: 'flex', alignItems: 'center', gap: 10 }}>\n {props.appIcon}\n <Typography.Title level={4} style={{ margin: 0 }}>\n {props.appName}\n </Typography.Title>\n </Link>\n <Menu\n style={{ justifyContent: 'flex-end', backgroundColor: 'transparent', border: 'none' }}\n mode=\"horizontal\"\n items={menuItems}\n selectedKeys={matchedMenuItems}\n />\n </div>\n </Layout.Header>\n <Layout.Content style={{ padding: '20px 50px' }}>{props.children}</Layout.Content>\n </Layout>\n );\n}\n","import { theme } from 'antd';\nimport { ThemeConfig } from 'antd/es/config-provider/context';\n\nexport const decafTheme: ThemeConfig = {\n hashed: true,\n components: {\n Layout: {\n colorBgHeader: '#10161d',\n },\n Button: {\n boxShadow: 'none',\n boxShadowSecondary: 'none',\n },\n },\n token: {\n fontFamily:\n '\"Inter\",system-ui,-apple-system,\"Segoe UI\",Roboto,\"Helvetica Neue\",Arial,\"Noto Sans\",\"Liberation Sans\",sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\"',\n colorPrimary: '#344961',\n colorBgBase: '#1a242f',\n colorBgLayout: '#1a242f',\n borderRadius: 0,\n // colorError: '#b03a38',\n // colorSuccess: '#48734d',\n // colorWarning: '#ffc107',\n // colorInfo: '#4694ab',\n green: '#48734d',\n red: '#b03a38',\n blue: '#0d6efd',\n yellow: '#ffc107',\n colorWhite: '#fff',\n },\n\n algorithm: [theme.darkAlgorithm],\n};\n","import { DecafApp, DecafAppConfig, DecafAppController } from '@decafhub/decaf-react';\nimport { css, Global } from '@emotion/react';\nimport styled from '@emotion/styled';\nimport { ConfigProvider } from 'antd';\nimport 'antd/dist/reset.css';\nimport { ThemeConfig } from 'antd/es/config-provider/context';\nimport React from 'react';\nimport { createBrowserRouter, Outlet, RouteObject, RouterProvider } from 'react-router-dom';\nimport DecafLayout, { DecafMenuItem } from './Layout';\nimport { decafTheme } from './theme';\n\nexport type DecafRoute = RouteObject;\n\nexport interface DecafWebappProps {\n config?: DecafAppConfig;\n controller?: DecafAppController;\n theme?: ThemeConfig;\n routes: DecafRoute[];\n menuItems: DecafMenuItem[];\n appName: string;\n appIcon?: React.ReactNode;\n}\n\nfunction buildRoutes(props: DecafWebappProps, routes: DecafRoute[]): RouteObject[] {\n const result: RouteObject[] = [];\n\n routes.forEach((route) => {\n const item: RouteObject = { ...route };\n if (route.children) {\n item.element = route.element ?? <Outlet />;\n item.children = buildRoutes(props, route.children);\n } else {\n item.element = (\n <DecafLayout menu={props.menuItems} appName={props.appName} appIcon={props.appIcon}>\n {route.element}\n </DecafLayout>\n );\n }\n result.push(item);\n });\n\n return result;\n}\n\nfunction DecafWebapp(props: DecafWebappProps) {\n const routes = buildRoutes(props, props.routes);\n const router = createBrowserRouter(routes, {\n basename: props.config?.basePath,\n });\n\n const theme = props.theme ?? decafTheme;\n\n return (\n <ConfigProvider theme={theme}>\n <Global\n styles={{\n body: {\n background: theme.token?.colorBgBase,\n fontFamily: theme.token?.fontFamily,\n margin: 0,\n },\n // antd overrides\n button: {\n boxShadow: 'none !important',\n },\n '.ant-page-header-back-button, .ant-page-header-heading-title': {\n color: `${theme.token?.colorWhite} !important`,\n },\n '.ant-badge-count': {\n color: `${theme.token?.colorWhite} !important`,\n },\n // end antd overrides\n }}\n />\n <DecafApp config={props.config} controller={props.controller}>\n <RouterProvider router={router} />\n </DecafApp>\n </ConfigProvider>\n );\n}\n\nexport { DecafWebapp, Global as GlobalStyle, css, styled, decafTheme };\n"],"names":["routesToAntMenu","routes","result","forEach","route","key","to","label","icon","item","React","createElement","NavLink","end","href","children","push","DecafLayout","props","menuItems","menu","matchedMenuItems","useMatches","map","match","pathname","Layout","style","height","Header","paddingInline","display","justifyContent","alignItems","Link","gap","appIcon","Typography","Title","level","margin","appName","Menu","backgroundColor","border","mode","items","selectedKeys","Content","padding","decafTheme","hashed","components","colorBgHeader","Button","boxShadow","boxShadowSecondary","token","fontFamily","colorPrimary","colorBgBase","colorBgLayout","borderRadius","green","red","blue","yellow","colorWhite","algorithm","theme","darkAlgorithm","buildRoutes","element","_route$element","Outlet","DecafWebapp","router","createBrowserRouter","basename","config","_props$config","basePath","_props$theme","ConfigProvider","Global","styles","body","background","_theme$token","_theme$token2","button","color","_theme$token3","_theme$token4","DecafApp","controller","RouterProvider"],"mappings":"irBAoB+BA,EAACC,GAC9B,MAAYC,EAAe,GAuB3B,OArBAD,EAAOE,QAASC,IACd,QAAuB,CACrBC,IAAK,SAAgBD,EAAME,GAAKF,EAAMG,MACtCA,MAAOH,EAAMG,MACbC,KAAMJ,EAAMI,MAEV,UAAiBJ,EAAME,GACzBG,EAAKF,MACHG,EAAAC,cAACC,EAAO,CAACN,GAAIF,EAAME,GAAIO,IAAkB,MAAbT,EAAME,IAC/BF,EAAMG,OAGF,SAAeH,GAAIA,EAAMU,KAClCL,EAAKF,MAAQG,EAAAC,cAAA,IAAA,CAAGG,KAAMV,EAAMU,MAAOV,EAAMG,OAChCH,EAAMW,WACfN,EAAKF,MAAQH,EAAMG,MAClBE,EAAqBM,SAAWf,EAAgBI,EAAMW,UAAY,KAErEb,EAAOc,KAAKP,EAAI,GAIpBP,CAAA,CAEwB,SAAWe,EAACC,GAClC,MAAeC,EAAGnB,EAAgBkB,EAAME,MAElBC,EADNC,IACiBC,IAAKC,GAAUA,EAAMC,UAEtD,O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EAAMC,UAAWsB,QAASvB,EAAMuB,QAASL,QAASlB,EAAMkB,SACxEhC,EAAMoE,SAIbtE,EAAOc,KAAKP,EAAI,GAIpBP,CAAA,CAEA,SAASyE,EAAYzD,mBACnB,MAAMjB,EAASsE,EAAYrD,EAAOA,EAAMjB,QAC5B2E,EAAGC,EAAoB5E,EAAQ,CACzC6E,SAAsB,OAAZ5D,EAAAA,EAAM6D,aAAM,EAAZC,EAAcC,WAGfZ,EAAkBnB,OAAlBgC,EAAGhE,EAAMmD,OAASnB,EAAAA,EAE7B,OACExC,EAACC,cAAAwE,EAAe,CAAAd,MAAOA,GACrB3D,EAACC,cAAAyE,EACC,CAAAC,OAAQ,CACNC,KAAM,CACJC,kBAAYlB,EAAAA,EAAMZ,cAAN+B,EAAa5B,YACzBF,WAAY,OAAF+B,EAAEpB,EAAMZ,YAAN,EAAAgC,EAAa/B,WACzBlB,OAAQ,GAGVkD,OAAQ,CACNnC,UAAW,mBAEb,+DAAgE,CAC9DoC,MAAU,UAAAC,EAAAvB,EAAMZ,cAANmC,EAAazB,yBAEzB,mBAAoB,CAClBwB,MAAU,GAAA,SAAAtB,EAAMZ,YAAN,EAAAoC,EAAa1B,4BAK7BzD,EAAAC,cAACmF,EAAQ,CAACf,OAAQ7D,EAAM6D,OAAQgB,WAAY7E,EAAM6E,YAChDrF,EAACC,cAAAqF,GAAepB,OAAQA,KAIhC"}
|
|
1
|
+
{"version":3,"file":"index.modern.mjs","sources":["../src/components/PageAbout.tsx","../src/components/Page404.tsx","../src/Layout.tsx","../src/theme.ts","../src/index.tsx"],"sourcesContent":["import { useDecaf } from '@decafhub/decaf-react';\nimport { Descriptions, Space } from 'antd';\nimport React, { useEffect, useState } from 'react';\n\nexport interface AboutPageProps {\n appName?: string;\n appVersion?: string;\n appDescription?: string;\n content?: React.ReactNode;\n}\nexport default function PageAbout(props: AboutPageProps) {\n const { client } = useDecaf();\n const [versionBarista, setVersionBarista] = useState<string | undefined>(undefined);\n\n useEffect(() => {\n client.barista.get<{ version: string }>('/version/').then(({ data }) => setVersionBarista(data.version));\n }, [client]);\n\n return (\n <Space direction=\"vertical\" size=\"middle\" style={{ width: '100%' }}>\n <Descriptions title=\"About\" column={1} bordered>\n <Descriptions.Item label=\"Web Application Name\">{props.appName}</Descriptions.Item>\n <Descriptions.Item label=\"Web Application Description\">{props.appDescription}</Descriptions.Item>\n <Descriptions.Item label=\"Web Application Version\">{`v${props.appVersion}`}</Descriptions.Item>\n <Descriptions.Item label=\"DECAF Barista Version\">{`v${versionBarista}`}</Descriptions.Item>\n </Descriptions>\n {props.content}\n </Space>\n );\n}\n","import { Result } from 'antd';\nimport React from 'react';\n\nexport default function Page404() {\n return <Result status=\"404\" title={'404'} subTitle={'Sorry, the page you visited does not exist.'} />;\n}\n","import { Layout, Menu, Typography } from 'antd';\nimport { ItemType, SubMenuType } from 'antd/es/menu/hooks/useItems';\nimport React from 'react';\nimport { Link, NavLink, useMatches } from 'react-router-dom';\n\ninterface BaseDecafMenuItem {\n label: any;\n icon?: React.ReactNode;\n children?: DecafMenuItem[];\n}\n\nexport type DecafMenuItem = BaseDecafMenuItem & ({ to?: string } | { href?: string });\n\nexport interface DecafLayoutProps {\n menu: DecafMenuItem[];\n appName: string;\n appIcon?: React.ReactNode;\n children: React.ReactNode;\n}\n\nexport function routesToAntMenu(routes: DecafMenuItem[]): ItemType[] {\n const result: ItemType[] = [];\n routes.forEach((route) => {\n const item: ItemType = {\n key: 'to' in route ? route.to : route.label,\n label: route.label,\n icon: route.icon,\n };\n if ('to' in route && route.to) {\n item.label = (\n <NavLink to={route.to} end={route.to === '/'}>\n {route.label}\n </NavLink>\n );\n } else if ('href' in route && route.href) {\n item.label = <a href={route.href}>{route.label}</a>;\n } else if (route.children) {\n item.label = route.label;\n (item as SubMenuType).children = routesToAntMenu(route.children || []);\n }\n result.push(item);\n });\n\n return result;\n}\n\nexport default function DecafLayout(props: DecafLayoutProps) {\n const menuItems = routesToAntMenu(props.menu);\n const matches = useMatches();\n const matchedMenuItems = matches.map((match) => match.pathname);\n\n return (\n <Layout style={{ height: '100%' }}>\n <Layout.Header style={{ paddingInline: 0 }}>\n <div style={{ paddingInline: 20, display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>\n <Link to=\"/\" style={{ display: 'flex', alignItems: 'center', gap: 10 }}>\n {props.appIcon}\n <Typography.Title level={4} style={{ margin: 0 }}>\n {props.appName}\n </Typography.Title>\n </Link>\n <Menu\n style={{ justifyContent: 'flex-end', backgroundColor: 'transparent', border: 'none', flex: 1 }}\n mode=\"horizontal\"\n items={menuItems}\n selectedKeys={matchedMenuItems}\n />\n </div>\n </Layout.Header>\n <Layout.Content style={{ padding: '20px 50px' }}>{props.children}</Layout.Content>\n <Layout.Footer style={{ textAlign: 'center' }}></Layout.Footer>\n </Layout>\n );\n}\n","import { theme } from 'antd';\nimport { ThemeConfig } from 'antd/es/config-provider/context';\n\nconst BORDER_COLORS_TRANSPARENT = {\n colorBorder: '#10161d',\n colorBorderSecondary: '#10161d',\n};\n\nconst INPUT_BG_COLOR = '#2c3d50';\n\nexport const decafTheme: ThemeConfig = {\n hashed: true,\n components: {\n Layout: {\n colorBgHeader: '#10161d',\n },\n Button: {\n boxShadow: 'none',\n boxShadowSecondary: 'none',\n colorBgContainer: INPUT_BG_COLOR,\n },\n Input: {\n ...BORDER_COLORS_TRANSPARENT,\n colorBgContainer: INPUT_BG_COLOR,\n },\n Select: {\n ...BORDER_COLORS_TRANSPARENT,\n colorBgContainer: INPUT_BG_COLOR,\n },\n Dropdown: {\n ...BORDER_COLORS_TRANSPARENT,\n colorBgElevated: INPUT_BG_COLOR,\n controlItemBgActive: INPUT_BG_COLOR,\n },\n DatePicker: {\n ...BORDER_COLORS_TRANSPARENT,\n colorBgContainer: INPUT_BG_COLOR,\n colorBgElevated: INPUT_BG_COLOR,\n },\n InputNumber: {\n ...BORDER_COLORS_TRANSPARENT,\n colorBgContainer: INPUT_BG_COLOR,\n },\n Checkbox: {\n ...BORDER_COLORS_TRANSPARENT,\n colorBgContainer: INPUT_BG_COLOR,\n },\n },\n token: {\n fontFamily: 'Lato, sans-serif',\n colorPrimary: '#344961',\n colorBgBase: '#1a242f',\n colorBgContainer: '#10161d',\n colorBgElevated: '#1a242f',\n colorBorderSecondary: '#1a242f',\n colorBorder: '#1a242f',\n colorBgLayout: '#1a242f',\n borderRadius: 0,\n green: '#48734d',\n red: '#b03a38',\n blue: '#0d6efd',\n yellow: '#ffc107',\n colorWhite: '#fff',\n },\n\n algorithm: [theme.darkAlgorithm],\n};\n","import { InfoCircleOutlined } from '@ant-design/icons';\nimport { DecafApp, DecafAppConfig, DecafAppController } from '@decafhub/decaf-react';\nimport { css, Global } from '@emotion/react';\nimport styled from '@emotion/styled';\nimport { ConfigProvider } from 'antd';\nimport 'antd/dist/reset.css';\nimport { ThemeConfig } from 'antd/es/config-provider/context';\nimport PageAbout from 'components/PageAbout';\nimport React from 'react';\nimport { createBrowserRouter, Outlet, RouteObject, RouterProvider } from 'react-router-dom';\nimport Page404 from './components/Page404';\nimport DecafLayout, { DecafMenuItem } from './Layout';\nimport { decafTheme } from './theme';\n\nexport type DecafRoute = RouteObject;\n\nexport interface DecafWebappProps {\n config?: DecafAppConfig;\n controller?: DecafAppController;\n theme?: ThemeConfig;\n /**\n * App routes.<br />\n * About page and 404 page will be added automatically.<br />\n * See https://reactrouter.com/en/main/routers/create-browser-router#routes\n */\n routes: DecafRoute[];\n /**\n * App menu.<br />\n * About page will be added automatically.\n */\n menuItems: DecafMenuItem[];\n appName: string;\n appDescription?: string;\n appIcon?: React.ReactNode;\n /**\n * The extra content to show on the about page.\n */\n aboutPageContent?: React.ReactNode;\n}\n\nfunction buildRoutes(props: DecafWebappProps, routes: DecafRoute[]): RouteObject[] {\n const result: RouteObject[] = [];\n\n routes.forEach((route) => {\n const item: RouteObject = { ...route };\n if (route.children) {\n item.element = route.element ?? <Outlet />;\n item.children = buildRoutes(props, route.children);\n } else {\n item.element = (\n <DecafLayout menu={props.menuItems} appName={props.appName} appIcon={props.appIcon}>\n {route.element}\n </DecafLayout>\n );\n }\n result.push(item);\n });\n\n return result;\n}\n\nfunction addTo<T>(array: T[], items: T[], key: keyof T): T[] {\n const result: T[] = [...array];\n items.forEach((item) => {\n const index = result.findIndex((r) => r[key] === item[key]);\n if (index >= 0) {\n result[index] = item;\n } else {\n result.push(item);\n }\n });\n return result;\n}\n\nfunction DecafWebapp(props: DecafWebappProps) {\n let routes = addTo<RouteObject>(\n props.routes,\n [\n {\n path: '/about',\n element: (\n <PageAbout\n appName={props.appName}\n appVersion={props.config?.currentVersion}\n appDescription={props.appDescription}\n content={props.aboutPageContent}\n />\n ),\n },\n { path: '*', element: <Page404 /> },\n ],\n 'path'\n );\n const menuWithAboutPage = addTo(\n props.menuItems,\n [\n {\n label: 'About',\n to: '/about',\n icon: <InfoCircleOutlined />,\n },\n ],\n 'to' as any\n );\n routes = buildRoutes({ ...props, menuItems: menuWithAboutPage }, routes);\n\n const router = createBrowserRouter(routes, {\n basename: props.config?.basePath,\n });\n\n const theme = props.theme ?? decafTheme;\n\n return (\n <ConfigProvider theme={theme}>\n <Global\n styles={{\n '@font-face': {\n fontFamily: 'Lato, sans-serif',\n src: 'url(https://fonts.googleapis.com/css2?family=Lato:wght@400;700&display=swap)',\n },\n body: {\n background: theme.token?.colorBgBase,\n fontFamily: theme.token?.fontFamily,\n margin: 0,\n },\n // antd overrides\n button: {\n boxShadow: 'none !important',\n },\n '.ant-page-header-back-button, .ant-page-header-heading-title': {\n color: `${theme.token?.colorWhite} !important`,\n },\n '.ant-badge-count': {\n color: `${theme.token?.colorWhite} !important`,\n },\n // end antd overrides\n }}\n />\n <DecafApp config={props.config} controller={props.controller}>\n <RouterProvider router={router} />\n </DecafApp>\n </ConfigProvider>\n );\n}\n\nexport { DecafWebapp, Global as GlobalStyle, css, styled, decafTheme };\n"],"names":["PageAbout","props","client","useDecaf","versionBarista","setVersionBarista","useState","undefined","useEffect","barista","get","then","data","version","React","createElement","Space","direction","size","style","width","Descriptions","title","column","bordered","Item","label","appName","appDescription","appVersion","content","Page404","Result","status","subTitle","routesToAntMenu","routes","result","forEach","route","item","key","to","icon","NavLink","end","href","children","push","DecafLayout","menuItems","menu","matchedMenuItems","useMatches","map","match","pathname","Layout","height","Header","paddingInline","display","justifyContent","alignItems","Link","gap","appIcon","Typography","Title","level","margin","Menu","backgroundColor","border","flex","mode","items","selectedKeys","Content","padding","Footer","textAlign","BORDER_COLORS_TRANSPARENT","colorBorder","colorBorderSecondary","decafTheme","hashed","components","colorBgHeader","Button","boxShadow","boxShadowSecondary","colorBgContainer","Input","Select","Dropdown","colorBgElevated","controlItemBgActive","DatePicker","_extends","InputNumber","Checkbox","token","fontFamily","colorPrimary","colorBgBase","colorBgLayout","borderRadius","green","red","blue","yellow","colorWhite","algorithm","theme","darkAlgorithm","_route$element","element","Outlet","buildRoutes","addTo","array","index","findIndex","r","DecafWebapp","_props$config","_props$config2","_props$theme","_theme$token","_theme$token2","_theme$token3","_theme$token4","path","config","currentVersion","aboutPageContent","InfoCircleOutlined","createBrowserRouter","basename","basePath","ConfigProvider","Global","styles","src","body","background","button","color","DecafApp","controller","RouterProvider","router"],"mappings":"ozBAUwB,SAASA,EAACC,GAChC,MAAMC,OAAEA,GAAWC,KACZC,EAAgBC,GAAqBC,OAA6BC,GAMzE,OAJAC,EAAU,KACRN,EAAOO,QAAQC,IAAyB,aAAaC,KAAK,EAAGC,UAAWP,EAAkBO,EAAKC,SACjG,EAAG,CAACX,IAGFY,EAACC,cAAAC,GAAMC,UAAU,WAAWC,KAAK,SAASC,MAAO,CAAEC,MAAO,SACxDN,EAACC,cAAAM,EAAa,CAAAC,MAAM,QAAQC,OAAQ,EAAGC,UAAQ,GAC7CV,EAACC,cAAAM,EAAaI,KAAK,CAAAC,MAAM,wBAAwBzB,EAAM0B,SACvDb,EAACC,cAAAM,EAAaI,KAAK,CAAAC,MAAM,+BAA+BzB,EAAM2B,gBAC9Dd,EAAAC,cAACM,EAAaI,KA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pB1B,EAAuB7B,OAAfpF,EAAAA,EAAMiH,OAAS7B,EAAAA,EAE7B,OACEvE,EAACC,cAAA8H,EAAe,CAAA3B,MAAOA,GACrBpG,EAACC,cAAA+H,EACC,CAAAC,OAAQ,CACN,aAAc,CACZxC,WAAY,mBACZyC,IAAK,gFAEPC,KAAM,CACJC,WAAY,OAAFjB,EAAEf,EAAMZ,YAAN,EAAA2B,EAAaxB,YACzBF,WAAuB,OAAb2B,EAAEhB,EAAMZ,YAAK,EAAX4B,EAAa3B,WACzBjC,OAAQ,GAGV6E,OAAQ,CACNzD,UAAW,mBAEb,+DAAgE,CAC9D0D,MAAU,GAAA,OAAAjB,EAAAjB,EAAMZ,YAAN,EAAA6B,EAAanB,yBAEzB,mBAAoB,CAClBoC,MAAU,GAAW,OAAXhB,EAAAlB,EAAMZ,YAAK,EAAX8B,EAAapB,4BAK7BlG,EAAAC,cAACsI,EAAQ,CAACf,OAAQrI,EAAMqI,OAAQgB,WAAYrJ,EAAMqJ,YAChDxI,EAACC,cAAAwI,GAAeC,OAAQA,KAIhC"}
|
package/dist/index.module.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{InfoCircleOutlined as e}from"@ant-design/icons";import{useDecaf as t,DecafApp as n}from"@decafhub/decaf-react";import{Global as o}from"@emotion/react";export{Global as GlobalStyle,css}from"@emotion/react";export{default as styled}from"@emotion/styled";import{Space as r,Descriptions as a,Result as l,Layout as c,Typography as i,Menu as m,theme as d,ConfigProvider as s}from"antd";import"antd/dist/reset.css";import p,{useState as u,useEffect as f}from"react";import{useMatches as b,Link as h,NavLink as g,createBrowserRouter as y,RouterProvider as v,Outlet as E}from"react-router-dom";function B(){return B=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},B.apply(this,arguments)}function I(e){var n=t().client,o=u(void 0),l=o[0],c=o[1];return f(function(){n.barista.get("/version/").then(function(e){return c(e.data.version)})},[n]),p.createElement(r,{direction:"vertical",size:"middle",style:{width:"100%"}},p.createElement(a,{title:"About",column:1,bordered:!0},p.createElement(a.Item,{label:"Web Application Name"},e.appName),p.createElement(a.Item,{label:"Web Application Description"},e.appDescription),p.createElement(a.Item,{label:"Web Application Version"},"v"+e.appVersion),p.createElement(a.Item,{label:"DECAF Barista Version"},"v"+l)),e.content)}function x(){return p.createElement(l,{status:"404",title:"404",subTitle:"Sorry, the page you visited does not exist."})}function C(e){var t=[];return e.forEach(function(e){var n={key:"to"in e?e.to:e.label,label:e.label,icon:e.icon};"to"in e&&e.to?n.label=p.createElement(g,{to:e.to,end:"/"===e.to},e.label):"href"in e&&e.href?n.label=p.createElement("a",{href:e.href},e.label):e.children&&(n.label=e.label,n.children=C(e.children||[])),t.push(n)}),t}function k(e){var t=C(e.menu),n=b().map(function(e){return e.pathname});return p.createElement(c,{style:{height:"100%"}},p.createElement(c.Header,{style:{paddingInline:0}},p.createElement("div",{style:{paddingInline:20,display:"flex",justifyContent:"space-between",alignItems:"center"}},p.createElement(h,{to:"/",style:{display:"flex",alignItems:"center",gap:10}},e.appIcon,p.createElement(i.Title,{level:4,style:{margin:0}},e.appName)),p.createElement(m,{style:{justifyContent:"flex-end",backgroundColor:"transparent",border:"none",flex:1},mode:"horizontal",items:t,selectedKeys:n}))),p.createElement(c.Content,{style:{padding:"20px 50px"}},e.children),p.createElement(c.Footer,{style:{textAlign:"center"}}))}var w={colorBorder:"#10161d",colorBorderSecondary:"#10161d"},A={hashed:!0,components:{Layout:{colorBgHeader:"#10161d"},Button:{boxShadow:"none",boxShadowSecondary:"none",colorBgContainer:"#2c3d50"},Input:B({},w,{colorBgContainer:"#2c3d50"}),Select:B({},w,{colorBgContainer:"#2c3d50"}),Dropdown:B({},w,{colorBgElevated:"#2c3d50",controlItemBgActive:"#2c3d50"}),DatePicker:B({},w,{colorBgContainer:"#2c3d50",colorBgElevated:"#2c3d50"}),InputNumber:B({},w,{colorBgContainer:"#2c3d50"}),Checkbox:B({},w,{colorBgContainer:"#2c3d50"})},token:{fontFamily:"Lato, sans-serif",colorPrimary:"#344961",colorBgBase:"#1a242f",colorBgContainer:"#10161d",colorBgElevated:"#1a242f",colorBorderSecondary:"#1a242f",colorBorder:"#1a242f",colorBgLayout:"#1a242f",borderRadius:0,green:"#48734d",red:"#b03a38",blue:"#0d6efd",yellow:"#ffc107",colorWhite:"#fff"},algorithm:[d.darkAlgorithm]};function S(e,t){var n=[];return t.forEach(function(t){var o,r=B({},t);t.children?(r.element=null!=(o=t.element)?o:p.createElement(E,null),r.children=S(e,t.children)):r.element=p.createElement(k,{menu:e.menuItems,appName:e.appName,appIcon:e.appIcon},t.element),n.push(r)}),n}function N(e,t,n){var o=[].concat(e);return t.forEach(function(e){var t=o.findIndex(function(t){return t[n]===e[n]});t>=0?o[t]=e:o.push(e)}),o}function D(t){var r,a,l,c,i,m,d,u=N(t.routes,[{path:"/about",element:p.createElement(I,{appName:t.appName,appVersion:null==(r=t.config)?void 0:r.currentVersion,appDescription:t.appDescription,content:t.aboutPageContent})},{path:"*",element:p.createElement(x,null)}],"path");u=S(B({},t,{menuItems:N(t.menuItems,[{label:"About",to:"/about",icon:p.createElement(e,null)}],"to")}),u);var f=y(u,{basename:null==(a=t.config)?void 0:a.basePath}),b=null!=(l=t.theme)?l:A;return p.createElement(s,{theme:b},p.createElement(o,{styles:{"@font-face":{fontFamily:"Lato, sans-serif",src:"url(https://fonts.googleapis.com/css2?family=Lato:wght@400;700&display=swap)"},body:{background:null==(c=b.token)?void 0:c.colorBgBase,fontFamily:null==(i=b.token)?void 0:i.fontFamily,margin:0},button:{boxShadow:"none !important"},".ant-page-header-back-button, .ant-page-header-heading-title":{color:(null==(m=b.token)?void 0:m.colorWhite)+" !important"},".ant-badge-count":{color:(null==(d=b.token)?void 0:d.colorWhite)+" !important"}}}),p.createElement(n,{config:t.config,controller:t.controller},p.createElement(v,{router:f})))}export{D as DecafWebapp,A as decafTheme};
|
|
2
2
|
//# sourceMappingURL=index.module.js.map
|
package/dist/index.module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.module.js","sources":["../src/Layout.tsx","../src/theme.ts","../src/index.tsx"],"sourcesContent":["import { Layout, Menu, Typography } from 'antd';\nimport { ItemType, SubMenuType } from 'antd/es/menu/hooks/useItems';\nimport React from 'react';\nimport { Link, NavLink, useMatches } from 'react-router-dom';\n\ninterface BaseDecafMenuItem {\n label: any;\n icon?: React.ReactNode;\n children?: DecafMenuItem[];\n}\n\nexport type DecafMenuItem = BaseDecafMenuItem & ({ to?: string } | { href?: string });\n\nexport interface DecafLayoutProps {\n menu: DecafMenuItem[];\n appName: string;\n appIcon?: React.ReactNode;\n children: React.ReactNode;\n}\n\nexport function routesToAntMenu(routes: DecafMenuItem[]): ItemType[] {\n const result: ItemType[] = [];\n\n routes.forEach((route) => {\n const item: ItemType = {\n key: 'to' in route ? route.to : route.label,\n label: route.label,\n icon: route.icon,\n };\n if ('to' in route && route.to) {\n item.label = (\n <NavLink to={route.to} end={route.to === '/'}>\n {route.label}\n </NavLink>\n );\n } else if ('href' in route && route.href) {\n item.label = <a href={route.href}>{route.label}</a>;\n } else if (route.children) {\n item.label = route.label;\n (item as SubMenuType).children = routesToAntMenu(route.children || []);\n }\n result.push(item);\n });\n\n return result;\n}\n\nexport default function DecafLayout(props: DecafLayoutProps) {\n const menuItems = routesToAntMenu(props.menu);\n const matches = useMatches();\n const matchedMenuItems = matches.map((match) => match.pathname);\n\n return (\n <Layout style={{ height: '100%' }}>\n <Layout.Header style={{ paddingInline: 0 }}>\n <div style={{ paddingInline: 20, display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>\n <Link to=\"/\" style={{ display: 'flex', alignItems: 'center', gap: 10 }}>\n {props.appIcon}\n <Typography.Title level={4} style={{ margin: 0 }}>\n {props.appName}\n </Typography.Title>\n </Link>\n <Menu\n style={{ justifyContent: 'flex-end', backgroundColor: 'transparent', border: 'none' }}\n mode=\"horizontal\"\n items={menuItems}\n selectedKeys={matchedMenuItems}\n />\n </div>\n </Layout.Header>\n <Layout.Content style={{ padding: '20px 50px' }}>{props.children}</Layout.Content>\n </Layout>\n );\n}\n","import { theme } from 'antd';\nimport { ThemeConfig } from 'antd/es/config-provider/context';\n\nexport const decafTheme: ThemeConfig = {\n hashed: true,\n components: {\n Layout: {\n colorBgHeader: '#10161d',\n },\n Button: {\n boxShadow: 'none',\n boxShadowSecondary: 'none',\n },\n },\n token: {\n fontFamily:\n '\"Inter\",system-ui,-apple-system,\"Segoe UI\",Roboto,\"Helvetica Neue\",Arial,\"Noto Sans\",\"Liberation Sans\",sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\"',\n colorPrimary: '#344961',\n colorBgBase: '#1a242f',\n colorBgLayout: '#1a242f',\n borderRadius: 0,\n // colorError: '#b03a38',\n // colorSuccess: '#48734d',\n // colorWarning: '#ffc107',\n // colorInfo: '#4694ab',\n green: '#48734d',\n red: '#b03a38',\n blue: '#0d6efd',\n yellow: '#ffc107',\n colorWhite: '#fff',\n },\n\n algorithm: [theme.darkAlgorithm],\n};\n","import { DecafApp, DecafAppConfig, DecafAppController } from '@decafhub/decaf-react';\nimport { css, Global } from '@emotion/react';\nimport styled from '@emotion/styled';\nimport { ConfigProvider } from 'antd';\nimport 'antd/dist/reset.css';\nimport { ThemeConfig } from 'antd/es/config-provider/context';\nimport React from 'react';\nimport { createBrowserRouter, Outlet, RouteObject, RouterProvider } from 'react-router-dom';\nimport DecafLayout, { DecafMenuItem } from './Layout';\nimport { decafTheme } from './theme';\n\nexport type DecafRoute = RouteObject;\n\nexport interface DecafWebappProps {\n config?: DecafAppConfig;\n controller?: DecafAppController;\n theme?: ThemeConfig;\n routes: DecafRoute[];\n menuItems: DecafMenuItem[];\n appName: string;\n appIcon?: React.ReactNode;\n}\n\nfunction buildRoutes(props: DecafWebappProps, routes: DecafRoute[]): RouteObject[] {\n const result: RouteObject[] = [];\n\n routes.forEach((route) => {\n const item: RouteObject = { ...route };\n if (route.children) {\n item.element = route.element ?? <Outlet />;\n item.children = buildRoutes(props, route.children);\n } else {\n item.element = (\n <DecafLayout menu={props.menuItems} appName={props.appName} appIcon={props.appIcon}>\n {route.element}\n </DecafLayout>\n );\n }\n result.push(item);\n });\n\n return result;\n}\n\nfunction DecafWebapp(props: DecafWebappProps) {\n const routes = buildRoutes(props, props.routes);\n const router = createBrowserRouter(routes, {\n basename: props.config?.basePath,\n });\n\n const theme = props.theme ?? decafTheme;\n\n return (\n <ConfigProvider theme={theme}>\n <Global\n styles={{\n body: {\n background: theme.token?.colorBgBase,\n fontFamily: theme.token?.fontFamily,\n margin: 0,\n },\n // antd overrides\n button: {\n boxShadow: 'none !important',\n },\n '.ant-page-header-back-button, .ant-page-header-heading-title': {\n color: `${theme.token?.colorWhite} !important`,\n },\n '.ant-badge-count': {\n color: `${theme.token?.colorWhite} !important`,\n },\n // end antd overrides\n }}\n />\n <DecafApp config={props.config} controller={props.controller}>\n <RouterProvider router={router} />\n </DecafApp>\n </ConfigProvider>\n );\n}\n\nexport { DecafWebapp, Global as GlobalStyle, css, styled, decafTheme };\n"],"names":["routesToAntMenu","routes","result","forEach","route","item","key","to","label","icon","React","createElement","NavLink","end","href","children","push","DecafLayout","props","menuItems","menu","matchedMenuItems","useMatches","map","match","pathname","Layout","style","height","Header","paddingInline","display","justifyContent","alignItems","Link","gap","appIcon","Typography","Title","level","margin","appName","Menu","backgroundColor","border","mode","items","selectedKeys","Content","padding","decafTheme","hashed","components","colorBgHeader","Button","boxShadow","boxShadowSecondary","token","fontFamily","colorPrimary","colorBgBase","colorBgLayout","borderRadius","green","red","blue","yellow","colorWhite","algorithm","theme","darkAlgorithm","buildRoutes","_route$element","element","Outlet","_props$config","_props$theme","_theme$token","_theme$token2","_theme$token3","_theme$token4","router","createBrowserRouter","basename","config","basePath","ConfigProvider","Global","styles","body","background","button","color","D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AK,EAAXqB,EAAapB,WACzBlB,OAAQ,GAGVmD,OAAQ,CACNpC,UAAW,mBAEb,+DAAgE,CAC9DqC,cAAKb,EAAKV,EAAMZ,cAANsB,EAAaZ,2BAEzB,mBAAoB,CAClByB,cAAKZ,EAAKX,EAAMZ,cAANuB,EAAab,YACxB,kBAILzD,EAAAC,cAACkF,EAAQ,CAACT,OAAQlE,EAAMkE,OAAQU,WAAY5E,EAAM4E,YAChDpF,EAACC,cAAAoF,GAAed,OAAQA,KAIhC"}
|
|
1
|
+
{"version":3,"file":"index.module.js","sources":["../src/components/PageAbout.tsx","../src/components/Page404.tsx","../src/Layout.tsx","../src/theme.ts","../src/index.tsx"],"sourcesContent":["import { useDecaf } from '@decafhub/decaf-react';\nimport { Descriptions, Space } from 'antd';\nimport React, { useEffect, useState } from 'react';\n\nexport interface AboutPageProps {\n appName?: string;\n appVersion?: string;\n appDescription?: string;\n content?: React.ReactNode;\n}\nexport default function PageAbout(props: AboutPageProps) {\n const { client } = useDecaf();\n const [versionBarista, setVersionBarista] = useState<string | undefined>(undefined);\n\n useEffect(() => {\n client.barista.get<{ version: string }>('/version/').then(({ data }) => setVersionBarista(data.version));\n }, [client]);\n\n return (\n <Space direction=\"vertical\" size=\"middle\" style={{ width: '100%' }}>\n <Descriptions title=\"About\" column={1} bordered>\n <Descriptions.Item label=\"Web Application Name\">{props.appName}</Descriptions.Item>\n <Descriptions.Item label=\"Web Application Description\">{props.appDescription}</Descriptions.Item>\n <Descriptions.Item label=\"Web Application Version\">{`v${props.appVersion}`}</Descriptions.Item>\n <Descriptions.Item label=\"DECAF Barista Version\">{`v${versionBarista}`}</Descriptions.Item>\n </Descriptions>\n {props.content}\n </Space>\n );\n}\n","import { Result } from 'antd';\nimport React from 'react';\n\nexport default function Page404() {\n return <Result status=\"404\" title={'404'} subTitle={'Sorry, the page you visited does not exist.'} />;\n}\n","import { Layout, Menu, Typography } from 'antd';\nimport { ItemType, SubMenuType } from 'antd/es/menu/hooks/useItems';\nimport React from 'react';\nimport { Link, NavLink, useMatches } from 'react-router-dom';\n\ninterface BaseDecafMenuItem {\n label: any;\n icon?: React.ReactNode;\n children?: DecafMenuItem[];\n}\n\nexport type DecafMenuItem = BaseDecafMenuItem & ({ to?: string } | { href?: string });\n\nexport interface DecafLayoutProps {\n menu: DecafMenuItem[];\n appName: string;\n appIcon?: React.ReactNode;\n children: React.ReactNode;\n}\n\nexport function routesToAntMenu(routes: DecafMenuItem[]): ItemType[] {\n const result: ItemType[] = [];\n routes.forEach((route) => {\n const item: ItemType = {\n key: 'to' in route ? route.to : route.label,\n label: route.label,\n icon: route.icon,\n };\n if ('to' in route && route.to) {\n item.label = (\n <NavLink to={route.to} end={route.to === '/'}>\n {route.label}\n </NavLink>\n );\n } else if ('href' in route && route.href) {\n item.label = <a href={route.href}>{route.label}</a>;\n } else if (route.children) {\n item.label = route.label;\n (item as SubMenuType).children = routesToAntMenu(route.children || []);\n }\n result.push(item);\n });\n\n return result;\n}\n\nexport default function DecafLayout(props: DecafLayoutProps) {\n const menuItems = routesToAntMenu(props.menu);\n const matches = useMatches();\n const matchedMenuItems = matches.map((match) => match.pathname);\n\n return (\n <Layout style={{ height: '100%' }}>\n <Layout.Header style={{ paddingInline: 0 }}>\n <div style={{ paddingInline: 20, display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>\n <Link to=\"/\" style={{ display: 'flex', alignItems: 'center', gap: 10 }}>\n {props.appIcon}\n <Typography.Title level={4} style={{ margin: 0 }}>\n {props.appName}\n </Typography.Title>\n </Link>\n <Menu\n style={{ justifyContent: 'flex-end', backgroundColor: 'transparent', border: 'none', flex: 1 }}\n mode=\"horizontal\"\n items={menuItems}\n selectedKeys={matchedMenuItems}\n />\n </div>\n </Layout.Header>\n <Layout.Content style={{ padding: '20px 50px' }}>{props.children}</Layout.Content>\n <Layout.Footer style={{ textAlign: 'center' }}></Layout.Footer>\n </Layout>\n );\n}\n","import { theme } from 'antd';\nimport { ThemeConfig } from 'antd/es/config-provider/context';\n\nconst BORDER_COLORS_TRANSPARENT = {\n colorBorder: '#10161d',\n colorBorderSecondary: '#10161d',\n};\n\nconst INPUT_BG_COLOR = '#2c3d50';\n\nexport const decafTheme: ThemeConfig = {\n hashed: true,\n components: {\n Layout: {\n colorBgHeader: '#10161d',\n },\n Button: {\n boxShadow: 'none',\n boxShadowSecondary: 'none',\n colorBgContainer: INPUT_BG_COLOR,\n },\n Input: {\n ...BORDER_COLORS_TRANSPARENT,\n colorBgContainer: INPUT_BG_COLOR,\n },\n Select: {\n ...BORDER_COLORS_TRANSPARENT,\n colorBgContainer: INPUT_BG_COLOR,\n },\n Dropdown: {\n ...BORDER_COLORS_TRANSPARENT,\n colorBgElevated: INPUT_BG_COLOR,\n controlItemBgActive: INPUT_BG_COLOR,\n },\n DatePicker: {\n ...BORDER_COLORS_TRANSPARENT,\n colorBgContainer: INPUT_BG_COLOR,\n colorBgElevated: INPUT_BG_COLOR,\n },\n InputNumber: {\n ...BORDER_COLORS_TRANSPARENT,\n colorBgContainer: INPUT_BG_COLOR,\n },\n Checkbox: {\n ...BORDER_COLORS_TRANSPARENT,\n colorBgContainer: INPUT_BG_COLOR,\n },\n },\n token: {\n fontFamily: 'Lato, sans-serif',\n colorPrimary: '#344961',\n colorBgBase: '#1a242f',\n colorBgContainer: '#10161d',\n colorBgElevated: '#1a242f',\n colorBorderSecondary: '#1a242f',\n colorBorder: '#1a242f',\n colorBgLayout: '#1a242f',\n borderRadius: 0,\n green: '#48734d',\n red: '#b03a38',\n blue: '#0d6efd',\n yellow: '#ffc107',\n colorWhite: '#fff',\n },\n\n algorithm: [theme.darkAlgorithm],\n};\n","import { InfoCircleOutlined } from '@ant-design/icons';\nimport { DecafApp, DecafAppConfig, DecafAppController } from '@decafhub/decaf-react';\nimport { css, Global } from '@emotion/react';\nimport styled from '@emotion/styled';\nimport { ConfigProvider } from 'antd';\nimport 'antd/dist/reset.css';\nimport { ThemeConfig } from 'antd/es/config-provider/context';\nimport PageAbout from 'components/PageAbout';\nimport React from 'react';\nimport { createBrowserRouter, Outlet, RouteObject, RouterProvider } from 'react-router-dom';\nimport Page404 from './components/Page404';\nimport DecafLayout, { DecafMenuItem } from './Layout';\nimport { decafTheme } from './theme';\n\nexport type DecafRoute = RouteObject;\n\nexport interface DecafWebappProps {\n config?: DecafAppConfig;\n controller?: DecafAppController;\n theme?: ThemeConfig;\n /**\n * App routes.<br />\n * About page and 404 page will be added automatically.<br />\n * See https://reactrouter.com/en/main/routers/create-browser-router#routes\n */\n routes: DecafRoute[];\n /**\n * App menu.<br />\n * About page will be added automatically.\n */\n menuItems: DecafMenuItem[];\n appName: string;\n appDescription?: string;\n appIcon?: React.ReactNode;\n /**\n * The extra content to show on the about page.\n */\n aboutPageContent?: React.ReactNode;\n}\n\nfunction buildRoutes(props: DecafWebappProps, routes: DecafRoute[]): RouteObject[] {\n const result: RouteObject[] = [];\n\n routes.forEach((route) => {\n const item: RouteObject = { ...route };\n if (route.children) {\n item.element = route.element ?? <Outlet />;\n item.children = buildRoutes(props, route.children);\n } else {\n item.element = (\n <DecafLayout menu={props.menuItems} appName={props.appName} appIcon={props.appIcon}>\n {route.element}\n </DecafLayout>\n );\n }\n result.push(item);\n });\n\n return result;\n}\n\nfunction addTo<T>(array: T[], items: T[], key: keyof T): T[] {\n const result: T[] = [...array];\n items.forEach((item) => {\n const index = result.findIndex((r) => r[key] === item[key]);\n if (index >= 0) {\n result[index] = item;\n } else {\n result.push(item);\n }\n });\n return result;\n}\n\nfunction DecafWebapp(props: DecafWebappProps) {\n let routes = addTo<RouteObject>(\n props.routes,\n [\n {\n path: '/about',\n element: (\n <PageAbout\n appName={props.appName}\n appVersion={props.config?.currentVersion}\n appDescription={props.appDescription}\n content={props.aboutPageContent}\n />\n ),\n },\n { path: '*', element: <Page404 /> },\n ],\n 'path'\n );\n const menuWithAboutPage = addTo(\n props.menuItems,\n [\n {\n label: 'About',\n to: '/about',\n icon: <InfoCircleOutlined />,\n },\n ],\n 'to' as any\n );\n routes = buildRoutes({ ...props, menuItems: menuWithAboutPage }, routes);\n\n const router = createBrowserRouter(routes, {\n basename: props.config?.basePath,\n });\n\n const theme = props.theme ?? decafTheme;\n\n return (\n <ConfigProvider theme={theme}>\n <Global\n styles={{\n '@font-face': {\n fontFamily: 'Lato, sans-serif',\n src: 'url(https://fonts.googleapis.com/css2?family=Lato:wght@400;700&display=swap)',\n },\n body: {\n background: theme.token?.colorBgBase,\n fontFamily: theme.token?.fontFamily,\n margin: 0,\n },\n // antd overrides\n button: {\n boxShadow: 'none !important',\n },\n '.ant-page-header-back-button, .ant-page-header-heading-title': {\n color: `${theme.token?.colorWhite} !important`,\n },\n '.ant-badge-count': {\n color: `${theme.token?.colorWhite} !important`,\n },\n // end antd overrides\n }}\n />\n <DecafApp config={props.config} controller={props.controller}>\n <RouterProvider router={router} />\n </DecafApp>\n </ConfigProvider>\n );\n}\n\nexport { DecafWebapp, Global as GlobalStyle, css, styled, decafTheme };\n"],"names":["PageAbout","props","client","useDecaf","_useState","useState","undefined","versionBarista","setVersionBarista","useEffect","barista","get","then","data","version","React","createElement","Space","direction","size","style","width","Descriptions","title","column","bordered","Item","label","appName","appDescription","appVersion","content","Page404","Result","status","subTitle","routesToAntMenu","routes","result","forEach","route","item","key","to","icon","NavLink","end","href","children","push","DecafLayout","menuItems","menu","matchedMenuItems","useMatches","map","match","pathname","Layout","height","Header","paddingInline","display","justifyContent","alignItems","Link","gap","appIcon","Typography","Title","level","margin","Menu","backgroundColor","border","flex","mode","items","selectedKeys","Content","padding","Footer","textAlign","BORDER_COLORS_TRANSPARENT","colorBorder","colorBorderSecondary","decafTheme","hashed","components","colorBgHeader","Button","boxShadow","boxShadowSecondary","colorBgContainer","Input","Select","Dropdown","colorBgElevated","controlItemBgActive","DatePicker","_extends","InputNumber","Checkbox","token","fontFamily","colorPrimary","colorBgBase","colorBgLayout","borderRadius","green","red","blue","yellow","colorWhite","algorithm","theme","darkAlgorithm","_route$element","element","Outlet","buildRoutes","addTo","array","index","findIndex","r","DecafWebapp","_props$config","_props$config2","_props$theme","_theme$token","_theme$token2","_theme$token3","_theme$token4","path","config","currentVersion","aboutPageContent","InfoCircleOutlined","router","createBrowserRouter","basename","basePath","ConfigProvider","Global","styles","src","body","background","button","color","DecafApp","controller","RouterProvider"],"mappings":"ozBAUwBA,SAAAA,EAAUC,GAChC,IAAQC,EAAWC,IAAXD,OACRE,EAA4CC,OAA6BC,GAAlEC,OAAgBC,EAAiBJ,EAAA,GAMxC,OAJAK,EAAU,WACRP,EAAOQ,QAAQC,IAAyB,aAAaC,KAAK,SAAGC,GAAI,WAAJA,KAAkCC,QAAQ,EACzG,EAAG,CAACZ,IAGFa,EAACC,cAAAC,GAAMC,UAAU,WAAWC,KAAK,SAASC,MAAO,CAAEC,MAAO,SACxDN,EAACC,cAAAM,EAAa,CAAAC,MAAM,QAAQC,OAAQ,EAAGC,UAAQ,GAC7CV,EAACC,cAAAM,EAAaI,KAAK,CAAAC,MAAM,wBAAwB1B,EAAM2B,SACvDb,EAACC,cAAAM,EAAaI,KAAK,CAAAC,MAAM,+BAA+B1B,EAAM4B,gBAC9Dd,EAAAC,cAACM,EAAaI,KAAI,CAACC,MAAM,2BAAyB,IAAM1B,EAAM6B,YAC9Df,EAAAC,cAACM,EAAaI,KAAI,CAACC,MAAM,6BAA6BpB,IAEvDN,EAAM8B,QAGb,CC1BwBC,SAAAA,IACtB,OAAQjB,EAAAC,cAAAiB,EAAO,CAAAC,OAAO,MAAMX,MAAO,MAAOY,SAAU,+CACtD,CCegBC,SAAAA,EAAgBC,GAC9B,IAAMC,EAAqB,GAsB3B,OArBAD,EAAOE,QAAQ,SAACC,GACd,IAAUC,EAAa,CACrBC,IAAK,OAAaF,EAAGA,EAAMG,GAAKH,EAAMb,MACtCA,MAAOa,EAAMb,MACbiB,KAAMJ,EAAMI,MAEV,OAAQJ,GAASA,EAAMG,GACzBF,EAAKd,MACHZ,EAAAC,cAAC6B,EAAO,CAACF,GAAIH,EAAMG,GAAIG,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,EAAMZ,YAAK,EAAX8B,EAAapB,YAAU,kBAKvClG,EAAAC,cAACuI,EAAQ,CAAChB,OAAQtI,EAAMsI,OAAQiB,WAAYvJ,EAAMuJ,YAChDzI,EAACC,cAAAyI,GAAed,OAAQA,KAIhC"}
|
package/dist/index.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@decafhub/decaf-react"),require("@emotion/react"),require("@emotion/styled"),require("antd"),require("antd/dist/reset.css"),require("react"),require("react-router-dom")):"function"==typeof define&&define.amd?define(["exports","@decafhub/decaf-react","@emotion/react","@emotion/styled","antd","antd/dist/reset.css","react","react-router-dom"],t):t((e||self).decafReactWebapp={},e.decafReact,e.react,e.styled,e.antd,0,e.react,e.reactRouterDom)}(this,function(e,t,n,a,
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@ant-design/icons"),require("@decafhub/decaf-react"),require("@emotion/react"),require("@emotion/styled"),require("antd"),require("antd/dist/reset.css"),require("react"),require("react-router-dom")):"function"==typeof define&&define.amd?define(["exports","@ant-design/icons","@decafhub/decaf-react","@emotion/react","@emotion/styled","antd","antd/dist/reset.css","react","react-router-dom"],t):t((e||self).decafReactWebapp={},e.icons,e.decafReact,e.react,e.styled,e.antd,0,e.react,e.reactRouterDom)}(this,function(e,t,n,o,a,r,l,i,c){function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=/*#__PURE__*/u(a),f=/*#__PURE__*/u(i);function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},s.apply(this,arguments)}function p(e){var t=n.useDecaf().client,o=i.useState(void 0),a=o[0],l=o[1];return i.useEffect(function(){t.barista.get("/version/").then(function(e){return l(e.data.version)})},[t]),f.default.createElement(r.Space,{direction:"vertical",size:"middle",style:{width:"100%"}},f.default.createElement(r.Descriptions,{title:"About",column:1,bordered:!0},f.default.createElement(r.Descriptions.Item,{label:"Web Application Name"},e.appName),f.default.createElement(r.Descriptions.Item,{label:"Web Application Description"},e.appDescription),f.default.createElement(r.Descriptions.Item,{label:"Web Application Version"},"v"+e.appVersion),f.default.createElement(r.Descriptions.Item,{label:"DECAF Barista Version"},"v"+a)),e.content)}function m(){return f.default.createElement(r.Result,{status:"404",title:"404",subTitle:"Sorry, the page you visited does not exist."})}function b(e){var t=[];return e.forEach(function(e){var n={key:"to"in e?e.to:e.label,label:e.label,icon:e.icon};"to"in e&&e.to?n.label=f.default.createElement(c.NavLink,{to:e.to,end:"/"===e.to},e.label):"href"in e&&e.href?n.label=f.default.createElement("a",{href:e.href},e.label):e.children&&(n.label=e.label,n.children=b(e.children||[])),t.push(n)}),t}function h(e){var t=b(e.menu),n=c.useMatches().map(function(e){return e.pathname});return f.default.createElement(r.Layout,{style:{height:"100%"}},f.default.createElement(r.Layout.Header,{style:{paddingInline:0}},f.default.createElement("div",{style:{paddingInline:20,display:"flex",justifyContent:"space-between",alignItems:"center"}},f.default.createElement(c.Link,{to:"/",style:{display:"flex",alignItems:"center",gap:10}},e.appIcon,f.default.createElement(r.Typography.Title,{level:4,style:{margin:0}},e.appName)),f.default.createElement(r.Menu,{style:{justifyContent:"flex-end",backgroundColor:"transparent",border:"none",flex:1},mode:"horizontal",items:t,selectedKeys:n}))),f.default.createElement(r.Layout.Content,{style:{padding:"20px 50px"}},e.children),f.default.createElement(r.Layout.Footer,{style:{textAlign:"center"}}))}var g={colorBorder:"#10161d",colorBorderSecondary:"#10161d"},y="#2c3d50",v={hashed:!0,components:{Layout:{colorBgHeader:"#10161d"},Button:{boxShadow:"none",boxShadowSecondary:"none",colorBgContainer:y},Input:s({},g,{colorBgContainer:y}),Select:s({},g,{colorBgContainer:y}),Dropdown:s({},g,{colorBgElevated:y,controlItemBgActive:y}),DatePicker:s({},g,{colorBgContainer:y,colorBgElevated:y}),InputNumber:s({},g,{colorBgContainer:y}),Checkbox:s({},g,{colorBgContainer:y})},token:{fontFamily:"Lato, sans-serif",colorPrimary:"#344961",colorBgBase:"#1a242f",colorBgContainer:"#10161d",colorBgElevated:"#1a242f",colorBorderSecondary:"#1a242f",colorBorder:"#1a242f",colorBgLayout:"#1a242f",borderRadius:0,green:"#48734d",red:"#b03a38",blue:"#0d6efd",yellow:"#ffc107",colorWhite:"#fff"},algorithm:[r.theme.darkAlgorithm]};function E(e,t){var n=[];return t.forEach(function(t){var o,a=s({},t);t.children?(a.element=null!=(o=t.element)?o:f.default.createElement(c.Outlet,null),a.children=E(e,t.children)):a.element=f.default.createElement(h,{menu:e.menuItems,appName:e.appName,appIcon:e.appIcon},t.element),n.push(a)}),n}function B(e,t,n){var o=[].concat(e);return t.forEach(function(e){var t=o.findIndex(function(t){return t[n]===e[n]});t>=0?o[t]=e:o.push(e)}),o}Object.defineProperty(e,"GlobalStyle",{enumerable:!0,get:function(){return o.Global}}),Object.defineProperty(e,"css",{enumerable:!0,get:function(){return o.css}}),Object.defineProperty(e,"styled",{enumerable:!0,get:function(){return d.default}}),e.DecafWebapp=function(e){var a,l,i,u,d,b,h,g=B(e.routes,[{path:"/about",element:f.default.createElement(p,{appName:e.appName,appVersion:null==(a=e.config)?void 0:a.currentVersion,appDescription:e.appDescription,content:e.aboutPageContent})},{path:"*",element:f.default.createElement(m,null)}],"path");g=E(s({},e,{menuItems:B(e.menuItems,[{label:"About",to:"/about",icon:f.default.createElement(t.InfoCircleOutlined,null)}],"to")}),g);var y=c.createBrowserRouter(g,{basename:null==(l=e.config)?void 0:l.basePath}),I=null!=(i=e.theme)?i:v;return f.default.createElement(r.ConfigProvider,{theme:I},f.default.createElement(o.Global,{styles:{"@font-face":{fontFamily:"Lato, sans-serif",src:"url(https://fonts.googleapis.com/css2?family=Lato:wght@400;700&display=swap)"},body:{background:null==(u=I.token)?void 0:u.colorBgBase,fontFamily:null==(d=I.token)?void 0:d.fontFamily,margin:0},button:{boxShadow:"none !important"},".ant-page-header-back-button, .ant-page-header-heading-title":{color:(null==(b=I.token)?void 0:b.colorWhite)+" !important"},".ant-badge-count":{color:(null==(h=I.token)?void 0:h.colorWhite)+" !important"}}}),f.default.createElement(n.DecafApp,{config:e.config,controller:e.controller},f.default.createElement(c.RouterProvider,{router:y})))},e.decafTheme=v});
|
|
2
2
|
//# sourceMappingURL=index.umd.js.map
|
package/dist/index.umd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.umd.js","sources":["../src/Layout.tsx","../src/theme.ts","../src/index.tsx"],"sourcesContent":["import { Layout, Menu, Typography } from 'antd';\nimport { ItemType, SubMenuType } from 'antd/es/menu/hooks/useItems';\nimport React from 'react';\nimport { Link, NavLink, useMatches } from 'react-router-dom';\n\ninterface BaseDecafMenuItem {\n label: any;\n icon?: React.ReactNode;\n children?: DecafMenuItem[];\n}\n\nexport type DecafMenuItem = BaseDecafMenuItem & ({ to?: string } | { href?: string });\n\nexport interface DecafLayoutProps {\n menu: DecafMenuItem[];\n appName: string;\n appIcon?: React.ReactNode;\n children: React.ReactNode;\n}\n\nexport function routesToAntMenu(routes: DecafMenuItem[]): ItemType[] {\n const result: ItemType[] = [];\n\n routes.forEach((route) => {\n const item: ItemType = {\n key: 'to' in route ? route.to : route.label,\n label: route.label,\n icon: route.icon,\n };\n if ('to' in route && route.to) {\n item.label = (\n <NavLink to={route.to} end={route.to === '/'}>\n {route.label}\n </NavLink>\n );\n } else if ('href' in route && route.href) {\n item.label = <a href={route.href}>{route.label}</a>;\n } else if (route.children) {\n item.label = route.label;\n (item as SubMenuType).children = routesToAntMenu(route.children || []);\n }\n result.push(item);\n });\n\n return result;\n}\n\nexport default function DecafLayout(props: DecafLayoutProps) {\n const menuItems = routesToAntMenu(props.menu);\n const matches = useMatches();\n const matchedMenuItems = matches.map((match) => match.pathname);\n\n return (\n <Layout style={{ height: '100%' }}>\n <Layout.Header style={{ paddingInline: 0 }}>\n <div style={{ paddingInline: 20, display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>\n <Link to=\"/\" style={{ display: 'flex', alignItems: 'center', gap: 10 }}>\n {props.appIcon}\n <Typography.Title level={4} style={{ margin: 0 }}>\n {props.appName}\n </Typography.Title>\n </Link>\n <Menu\n style={{ justifyContent: 'flex-end', backgroundColor: 'transparent', border: 'none' }}\n mode=\"horizontal\"\n items={menuItems}\n selectedKeys={matchedMenuItems}\n />\n </div>\n </Layout.Header>\n <Layout.Content style={{ padding: '20px 50px' }}>{props.children}</Layout.Content>\n </Layout>\n );\n}\n","import { theme } from 'antd';\nimport { ThemeConfig } from 'antd/es/config-provider/context';\n\nexport const decafTheme: ThemeConfig = {\n hashed: true,\n components: {\n Layout: {\n colorBgHeader: '#10161d',\n },\n Button: {\n boxShadow: 'none',\n boxShadowSecondary: 'none',\n },\n },\n token: {\n fontFamily:\n '\"Inter\",system-ui,-apple-system,\"Segoe UI\",Roboto,\"Helvetica Neue\",Arial,\"Noto Sans\",\"Liberation Sans\",sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\"',\n colorPrimary: '#344961',\n colorBgBase: '#1a242f',\n colorBgLayout: '#1a242f',\n borderRadius: 0,\n // colorError: '#b03a38',\n // colorSuccess: '#48734d',\n // colorWarning: '#ffc107',\n // colorInfo: '#4694ab',\n green: '#48734d',\n red: '#b03a38',\n blue: '#0d6efd',\n yellow: '#ffc107',\n colorWhite: '#fff',\n },\n\n algorithm: [theme.darkAlgorithm],\n};\n","import { DecafApp, DecafAppConfig, DecafAppController } from '@decafhub/decaf-react';\nimport { css, Global } from '@emotion/react';\nimport styled from '@emotion/styled';\nimport { ConfigProvider } from 'antd';\nimport 'antd/dist/reset.css';\nimport { ThemeConfig } from 'antd/es/config-provider/context';\nimport React from 'react';\nimport { createBrowserRouter, Outlet, RouteObject, RouterProvider } from 'react-router-dom';\nimport DecafLayout, { DecafMenuItem } from './Layout';\nimport { decafTheme } from './theme';\n\nexport type DecafRoute = RouteObject;\n\nexport interface DecafWebappProps {\n config?: DecafAppConfig;\n controller?: DecafAppController;\n theme?: ThemeConfig;\n routes: DecafRoute[];\n menuItems: DecafMenuItem[];\n appName: string;\n appIcon?: React.ReactNode;\n}\n\nfunction buildRoutes(props: DecafWebappProps, routes: DecafRoute[]): RouteObject[] {\n const result: RouteObject[] = [];\n\n routes.forEach((route) => {\n const item: RouteObject = { ...route };\n if (route.children) {\n item.element = route.element ?? <Outlet />;\n item.children = buildRoutes(props, route.children);\n } else {\n item.element = (\n <DecafLayout menu={props.menuItems} appName={props.appName} appIcon={props.appIcon}>\n {route.element}\n </DecafLayout>\n );\n }\n result.push(item);\n });\n\n return result;\n}\n\nfunction DecafWebapp(props: DecafWebappProps) {\n const routes = buildRoutes(props, props.routes);\n const router = createBrowserRouter(routes, {\n basename: props.config?.basePath,\n });\n\n const theme = props.theme ?? decafTheme;\n\n return (\n <ConfigProvider theme={theme}>\n <Global\n styles={{\n body: {\n background: theme.token?.colorBgBase,\n fontFamily: theme.token?.fontFamily,\n margin: 0,\n },\n // antd overrides\n button: {\n boxShadow: 'none !important',\n },\n '.ant-page-header-back-button, .ant-page-header-heading-title': {\n color: `${theme.token?.colorWhite} !important`,\n },\n '.ant-badge-count': {\n color: `${theme.token?.colorWhite} !important`,\n },\n // end antd overrides\n }}\n />\n <DecafApp config={props.config} controller={props.controller}>\n <RouterProvider router={router} />\n </DecafApp>\n </ConfigProvider>\n );\n}\n\nexport { DecafWebapp, Global as GlobalStyle, css, styled, decafTheme };\n"],"names":["routesToAntMenu","routes","result","forEach","route","item","key","to","label","icon","React","createElement","NavLink","end","href","children","push","DecafLayout","props","menuItems","menu","matchedMenuItems","useMatches","map","match","pathname","Layout","style","height","Header","paddingInline","display","justifyContent","alignItems","Link","gap","appIcon","Typography","Title","level","margin","appName","Menu","backgroundColor","border","mode","items","selectedKeys","Content","padding","decafTheme","hashed","components","colorBgHeader","Button","boxShadow","boxShadowSecondary","token","fontFamily","colorPrimary","colorBgBase","colorBgLayout","borderRadius","green","red","blue","yellow","colorWhite","algorithm","theme","darkAlgorithm","buildRoutes","_route$element","element","Outlet","_props$config","_props$theme","_theme$token","_theme$token2","_theme$token3","_theme$token4","router","createBrowserRouter","basename","config","basePath","ConfigProvider","Global","styles","body","background","button","color","DecafApp","controller","RouterProvider"],"mappings":"87BAoB+BA,EAACC,GAC9B,IAAYC,EAAe,GAuB3B,OArBAD,EAAOE,QAAQ,SAACC,GACd,IAAUC,EAAa,CACrBC,IAAK,OAAaF,EAAGA,EAAMG,GAAKH,EAAMI,MACtCA,MAAOJ,EAAMI,MACbC,KAAML,EAAMK,MAEV,OAAaL,GAAIA,EAAMG,GACzBF,EAAKG,MACHE,EAAA,QAAAC,cAACC,EAAAA,QAAO,CAACL,GAAIH,EAAMG,GAAIM,IAAkB,MAAbT,EAAMG,IAC/BH,EAAMI,OAGF,SAAeJ,GAAIA,EAAMU,KAClCT,EAAKG,MAAQE,UAAAC,cAAA,IAAA,CAAGG,KAAMV,EAAMU,MAAOV,EAAMI,OAChCJ,EAAMW,WACfV,EAAKG,MAAQJ,EAAMI,MAClBH,EAAqBU,SAAWf,EAAgBI,EAAMW,UAAY,KAErEb,EAAOc,KAAKX,EACd,GAGFH,CAAA,CAEwB,SAAWe,EAACC,GAClC,IAAeC,EAAGnB,EAAgBkB,EAAME,MAElBC,EADNC,EAAAA,aACiBC,IAAI,SAACC,UAAeA,EAACC,QAAQ,GAE9D,OACEf,EAAAA,QAACC,cAAAe,SAAO,CAAAC,MAAO,CAAEC,OAAQ,SACvBlB,UAACC,cAAAe,EAAMA,OAACG,OAAO,CAAAF,MAAO,CAAEG,cAAe,IACrCpB,EAAA,QAAAC,cAAA,MAAA,CAAKgB,MAAO,CAAEG,cAAe,GAAIC,QAAS,OAAQC,eAAgB,gBAAiBC,WAAY,WAC7FvB,UAACC,cAAAuB,EAAIA,MAAC3B,GAAG,IAAIoB,MAAO,CAAEI,QAAS,OAAQE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AAoBjF,EAAQ,CACzCkF,SAAU,OAAFR,EAAEzD,EAAMkE,aAAN,EAAAT,EAAcU,WAGpBhB,EAAmB,SAAXnD,EAAMmD,OAAKO,EAAI1B,EAE7B,iBACGvC,cAAA2E,EAAcA,eAAC,CAAAjB,MAAOA,GACrB3D,UAACC,cAAA4E,EAAMA,OACL,CAAAC,OAAQ,CACNC,KAAM,CACJC,WAAY,OAAFb,EAAER,EAAMZ,YAAN,EAAAoB,EAAajB,YACzBF,WAAuB,SAAXW,EAAMZ,YAAK,EAAXqB,EAAapB,WACzBlB,OAAQ,GAGVmD,OAAQ,CACNpC,UAAW,mBAEb,+DAAgE,CAC9DqC,cAAKb,EAAKV,EAAMZ,cAANsB,EAAaZ,2BAEzB,mBAAoB,CAClByB,cAAKZ,EAAKX,EAAMZ,cAANuB,EAAab,YACxB,kBAILzD,UAAAC,cAACkF,EAAQA,SAAA,CAACT,OAAQlE,EAAMkE,OAAQU,WAAY5E,EAAM4E,YAChDpF,UAACC,cAAAoF,EAAcA,gBAACd,OAAQA,KAIhC"}
|
|
1
|
+
{"version":3,"file":"index.umd.js","sources":["../src/components/PageAbout.tsx","../src/components/Page404.tsx","../src/Layout.tsx","../src/theme.ts","../src/index.tsx"],"sourcesContent":["import { useDecaf } from '@decafhub/decaf-react';\nimport { Descriptions, Space } from 'antd';\nimport React, { useEffect, useState } from 'react';\n\nexport interface AboutPageProps {\n appName?: string;\n appVersion?: string;\n appDescription?: string;\n content?: React.ReactNode;\n}\nexport default function PageAbout(props: AboutPageProps) {\n const { client } = useDecaf();\n const [versionBarista, setVersionBarista] = useState<string | undefined>(undefined);\n\n useEffect(() => {\n client.barista.get<{ version: string }>('/version/').then(({ data }) => setVersionBarista(data.version));\n }, [client]);\n\n return (\n <Space direction=\"vertical\" size=\"middle\" style={{ width: '100%' }}>\n <Descriptions title=\"About\" column={1} bordered>\n <Descriptions.Item label=\"Web Application Name\">{props.appName}</Descriptions.Item>\n <Descriptions.Item label=\"Web Application Description\">{props.appDescription}</Descriptions.Item>\n <Descriptions.Item label=\"Web Application Version\">{`v${props.appVersion}`}</Descriptions.Item>\n <Descriptions.Item label=\"DECAF Barista Version\">{`v${versionBarista}`}</Descriptions.Item>\n </Descriptions>\n {props.content}\n </Space>\n );\n}\n","import { Result } from 'antd';\nimport React from 'react';\n\nexport default function Page404() {\n return <Result status=\"404\" title={'404'} subTitle={'Sorry, the page you visited does not exist.'} />;\n}\n","import { Layout, Menu, Typography } from 'antd';\nimport { ItemType, SubMenuType } from 'antd/es/menu/hooks/useItems';\nimport React from 'react';\nimport { Link, NavLink, useMatches } from 'react-router-dom';\n\ninterface BaseDecafMenuItem {\n label: any;\n icon?: React.ReactNode;\n children?: DecafMenuItem[];\n}\n\nexport type DecafMenuItem = BaseDecafMenuItem & ({ to?: string } | { href?: string });\n\nexport interface DecafLayoutProps {\n menu: DecafMenuItem[];\n appName: string;\n appIcon?: React.ReactNode;\n children: React.ReactNode;\n}\n\nexport function routesToAntMenu(routes: DecafMenuItem[]): ItemType[] {\n const result: ItemType[] = [];\n routes.forEach((route) => {\n const item: ItemType = {\n key: 'to' in route ? route.to : route.label,\n label: route.label,\n icon: route.icon,\n };\n if ('to' in route && route.to) {\n item.label = (\n <NavLink to={route.to} end={route.to === '/'}>\n {route.label}\n </NavLink>\n );\n } else if ('href' in route && route.href) {\n item.label = <a href={route.href}>{route.label}</a>;\n } else if (route.children) {\n item.label = route.label;\n (item as SubMenuType).children = routesToAntMenu(route.children || []);\n }\n result.push(item);\n });\n\n return result;\n}\n\nexport default function DecafLayout(props: DecafLayoutProps) {\n const menuItems = routesToAntMenu(props.menu);\n const matches = useMatches();\n const matchedMenuItems = matches.map((match) => match.pathname);\n\n return (\n <Layout style={{ height: '100%' }}>\n <Layout.Header style={{ paddingInline: 0 }}>\n <div style={{ paddingInline: 20, display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>\n <Link to=\"/\" style={{ display: 'flex', alignItems: 'center', gap: 10 }}>\n {props.appIcon}\n <Typography.Title level={4} style={{ margin: 0 }}>\n {props.appName}\n </Typography.Title>\n </Link>\n <Menu\n style={{ justifyContent: 'flex-end', backgroundColor: 'transparent', border: 'none', flex: 1 }}\n mode=\"horizontal\"\n items={menuItems}\n selectedKeys={matchedMenuItems}\n />\n </div>\n </Layout.Header>\n <Layout.Content style={{ padding: '20px 50px' }}>{props.children}</Layout.Content>\n <Layout.Footer style={{ textAlign: 'center' }}></Layout.Footer>\n </Layout>\n );\n}\n","import { theme } from 'antd';\nimport { ThemeConfig } from 'antd/es/config-provider/context';\n\nconst BORDER_COLORS_TRANSPARENT = {\n colorBorder: '#10161d',\n colorBorderSecondary: '#10161d',\n};\n\nconst INPUT_BG_COLOR = '#2c3d50';\n\nexport const decafTheme: ThemeConfig = {\n hashed: true,\n components: {\n Layout: {\n colorBgHeader: '#10161d',\n },\n Button: {\n boxShadow: 'none',\n boxShadowSecondary: 'none',\n colorBgContainer: INPUT_BG_COLOR,\n },\n Input: {\n ...BORDER_COLORS_TRANSPARENT,\n colorBgContainer: INPUT_BG_COLOR,\n },\n Select: {\n ...BORDER_COLORS_TRANSPARENT,\n colorBgContainer: INPUT_BG_COLOR,\n },\n Dropdown: {\n ...BORDER_COLORS_TRANSPARENT,\n colorBgElevated: INPUT_BG_COLOR,\n controlItemBgActive: INPUT_BG_COLOR,\n },\n DatePicker: {\n ...BORDER_COLORS_TRANSPARENT,\n colorBgContainer: INPUT_BG_COLOR,\n colorBgElevated: INPUT_BG_COLOR,\n },\n InputNumber: {\n ...BORDER_COLORS_TRANSPARENT,\n colorBgContainer: INPUT_BG_COLOR,\n },\n Checkbox: {\n ...BORDER_COLORS_TRANSPARENT,\n colorBgContainer: INPUT_BG_COLOR,\n },\n },\n token: {\n fontFamily: 'Lato, sans-serif',\n colorPrimary: '#344961',\n colorBgBase: '#1a242f',\n colorBgContainer: '#10161d',\n colorBgElevated: '#1a242f',\n colorBorderSecondary: '#1a242f',\n colorBorder: '#1a242f',\n colorBgLayout: '#1a242f',\n borderRadius: 0,\n green: '#48734d',\n red: '#b03a38',\n blue: '#0d6efd',\n yellow: '#ffc107',\n colorWhite: '#fff',\n },\n\n algorithm: [theme.darkAlgorithm],\n};\n","import { InfoCircleOutlined } from '@ant-design/icons';\nimport { DecafApp, DecafAppConfig, DecafAppController } from '@decafhub/decaf-react';\nimport { css, Global } from '@emotion/react';\nimport styled from '@emotion/styled';\nimport { ConfigProvider } from 'antd';\nimport 'antd/dist/reset.css';\nimport { ThemeConfig } from 'antd/es/config-provider/context';\nimport PageAbout from 'components/PageAbout';\nimport React from 'react';\nimport { createBrowserRouter, Outlet, RouteObject, RouterProvider } from 'react-router-dom';\nimport Page404 from './components/Page404';\nimport DecafLayout, { DecafMenuItem } from './Layout';\nimport { decafTheme } from './theme';\n\nexport type DecafRoute = RouteObject;\n\nexport interface DecafWebappProps {\n config?: DecafAppConfig;\n controller?: DecafAppController;\n theme?: ThemeConfig;\n /**\n * App routes.<br />\n * About page and 404 page will be added automatically.<br />\n * See https://reactrouter.com/en/main/routers/create-browser-router#routes\n */\n routes: DecafRoute[];\n /**\n * App menu.<br />\n * About page will be added automatically.\n */\n menuItems: DecafMenuItem[];\n appName: string;\n appDescription?: string;\n appIcon?: React.ReactNode;\n /**\n * The extra content to show on the about page.\n */\n aboutPageContent?: React.ReactNode;\n}\n\nfunction buildRoutes(props: DecafWebappProps, routes: DecafRoute[]): RouteObject[] {\n const result: RouteObject[] = [];\n\n routes.forEach((route) => {\n const item: RouteObject = { ...route };\n if (route.children) {\n item.element = route.element ?? <Outlet />;\n item.children = buildRoutes(props, route.children);\n } else {\n item.element = (\n <DecafLayout menu={props.menuItems} appName={props.appName} appIcon={props.appIcon}>\n {route.element}\n </DecafLayout>\n );\n }\n result.push(item);\n });\n\n return result;\n}\n\nfunction addTo<T>(array: T[], items: T[], key: keyof T): T[] {\n const result: T[] = [...array];\n items.forEach((item) => {\n const index = result.findIndex((r) => r[key] === item[key]);\n if (index >= 0) {\n result[index] = item;\n } else {\n result.push(item);\n }\n });\n return result;\n}\n\nfunction DecafWebapp(props: DecafWebappProps) {\n let routes = addTo<RouteObject>(\n props.routes,\n [\n {\n path: '/about',\n element: (\n <PageAbout\n appName={props.appName}\n appVersion={props.config?.currentVersion}\n appDescription={props.appDescription}\n content={props.aboutPageContent}\n />\n ),\n },\n { path: '*', element: <Page404 /> },\n ],\n 'path'\n );\n const menuWithAboutPage = addTo(\n props.menuItems,\n [\n {\n label: 'About',\n to: '/about',\n icon: <InfoCircleOutlined />,\n },\n ],\n 'to' as any\n );\n routes = buildRoutes({ ...props, menuItems: menuWithAboutPage }, routes);\n\n const router = createBrowserRouter(routes, {\n basename: props.config?.basePath,\n });\n\n const theme = props.theme ?? decafTheme;\n\n return (\n <ConfigProvider theme={theme}>\n <Global\n styles={{\n '@font-face': {\n fontFamily: 'Lato, sans-serif',\n src: 'url(https://fonts.googleapis.com/css2?family=Lato:wght@400;700&display=swap)',\n },\n body: {\n background: theme.token?.colorBgBase,\n fontFamily: theme.token?.fontFamily,\n margin: 0,\n },\n // antd overrides\n button: {\n boxShadow: 'none !important',\n },\n '.ant-page-header-back-button, .ant-page-header-heading-title': {\n color: `${theme.token?.colorWhite} !important`,\n },\n '.ant-badge-count': {\n color: `${theme.token?.colorWhite} !important`,\n },\n // end antd overrides\n }}\n />\n <DecafApp config={props.config} controller={props.controller}>\n <RouterProvider router={router} />\n </DecafApp>\n </ConfigProvider>\n );\n}\n\nexport { DecafWebapp, Global as GlobalStyle, css, styled, decafTheme };\n"],"names":["PageAbout","props","client","useDecaf","_useState","useState","undefined","versionBarista","setVersionBarista","useEffect","barista","get","then","data","version","React","createElement","Space","direction","size","style","width","Descriptions","title","column","bordered","Item","label","appName","appDescription","appVersion","content","Page404","Result","status","subTitle","routesToAntMenu","routes","result","forEach","route","item","key","to","icon","NavLink","end","href","children","push","DecafLayout","menuItems","menu","matchedMenuItems","useMatches","map","match","pathname","Layout","height","Header","paddingInline","display","justifyContent","alignItems","Link","gap","appIcon","Typography","Title","level","margin","Menu","backgroundColor","border","flex","mode","items","selectedKeys","Content","padding","Footer","textAlign","BORDER_COLORS_TRANSPARENT","colorBorder","colorBorderSecondary","INPUT_BG_COLOR","decafTheme","hashed","components","colorBgHeader","Button","boxShadow","boxShadowSecondary","colorBgContainer","Input","Select","Dropdown","colorBgElevated","controlItemBgActive","DatePicker","_extends","InputNumber","Checkbox","token","fontFamily","colorPrimary","colorBgBase","colorBgLayout","borderRadius","green","red","blue","yellow","colorWhite","algorithm","theme","darkAlgorithm","_route$element","element","Outlet","buildRoutes","addTo","array","index","findIndex","r","_props$config","_props$config2","_props$theme","_theme$token","_theme$token2","_theme$token3","_theme$token4","path","config","currentVersion","aboutPageContent","InfoCircleOutlined","router","createBrowserRouter","basename","basePath","ConfigProvider","Global","styles","src","body","background","button","color","DecafApp","controller","RouterProvider"],"mappings":"g/BAUwBA,SAAAA,EAAUC,GAChC,IAAQC,EAAWC,EAAAA,WAAXD,OACRE,EAA4CC,EAAQA,cAAqBC,GAAlEC,OAAgBC,EAAiBJ,EAAA,GAMxC,OAJAK,EAAAA,UAAU,WACRP,EAAOQ,QAAQC,IAAyB,aAAaC,KAAK,SAAGC,GAAI,WAAJA,KAAkCC,QAAQ,EACzG,EAAG,CAACZ,IAGFa,EAAAA,QAACC,cAAAC,EAAKA,OAACC,UAAU,WAAWC,KAAK,SAASC,MAAO,CAAEC,MAAO,SACxDN,EAAAA,QAACC,cAAAM,eAAa,CAAAC,MAAM,QAAQC,OAAQ,EAAGC,UAAQ,GAC7CV,EAAC,QAAAC,cAAAM,eAAaI,KAAK,CAAAC,MAAM,wBAAwB1B,EAAM2B,SACvDb,EAAAA,QAACC,cAAAM,EAAAA,aAAaI,KAAK,CAAAC,MAAM,+BAA+B1B,EAAM4B,gBAC9Dd,EAAA,QAAAC,cAACM,EAAYA,aAACI,KAAI,CAACC,MAAM,2BAAyB,IAAM1B,EAAM6B,YAC9Df,EAAAA,QAAAC,cAACM,eAAaI,KAAI,CAACC,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G,GAEjE,IAAMsG,EAASC,EAAmBA,oBAACvG,EAAQ,CACzCwG,SAAsB,OAAdb,EAAE/H,EAAMsI,aAAM,EAAZP,EAAcc,WAGpB1B,SAAQnH,EAAAA,EAAMmH,SAAS7B,EAE7B,OACExE,EAAAA,QAACC,cAAA+H,EAAAA,eAAe,CAAA3B,MAAOA,GACrBrG,EAAC,QAAAC,cAAAgI,EAAAA,OACC,CAAAC,OAAQ,CACN,aAAc,CACZxC,WAAY,mBACZyC,IAAK,gFAEPC,KAAM,CACJC,WAAY,OAAFlB,EAAEd,EAAMZ,YAAN,EAAA0B,EAAavB,YACzBF,WAAuB,OAAb0B,EAAEf,EAAMZ,YAAK,EAAX2B,EAAa1B,WACzBlC,OAAQ,GAGV8E,OAAQ,CACNzD,UAAW,mBAEb,+DAAgE,CAC9D0D,OAAqB,OAAXlC,EAAAA,EAAMZ,YAAK,EAAX4B,EAAalB,YACxB,eACD,mBAAoB,CAClBoC,OAAqB,OAAhBjB,EAAKjB,EAAMZ,YAAK,EAAX6B,EAAanB,YAAU,kBAKvCnG,EAAA,QAAAC,cAACuI,WAAQ,CAAChB,OAAQtI,EAAMsI,OAAQiB,WAAYvJ,EAAMuJ,YAChDzI,EAAC,QAAAC,cAAAyI,EAAAA,gBAAed,OAAQA,KAIhC"}
|
package/dist/theme.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAS9D,eAAO,MAAM,UAAU,EAAE,WAwDxB,CAAC"}
|