@decafhub/decaf-react-webapp 0.0.3 → 0.0.5
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 +24 -0
- package/dist/index.d.ts +2 -1
- 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,29 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.5](https://github.com/teloscube/decaf-react-webapp/compare/v0.0.4...v0.0.5) (2022-11-30)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* use lato font ([6bd8fe0](https://github.com/teloscube/decaf-react-webapp/commit/6bd8fe03d2655ac9cff6f41047a691b9b969a4b1))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* menu renders mobile version on desktop app even for a few items ([9af83d6](https://github.com/teloscube/decaf-react-webapp/commit/9af83d6764d91fdfc05a416bc0338f188e31eba2))
|
|
14
|
+
|
|
15
|
+
## [0.0.4](https://github.com/teloscube/decaf-react-webapp/compare/v0.0.3...v0.0.4) (2022-11-29)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* export decafTheme in case client wants to use or expand it ([3f86608](https://github.com/teloscube/decaf-react-webapp/commit/3f86608160fe9d8de41fea9a497e0595298435a2))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Bug Fixes
|
|
24
|
+
|
|
25
|
+
* update header and badge components' colors ([3d4ce9b](https://github.com/teloscube/decaf-react-webapp/commit/3d4ce9b04c01b937396d11c580354659f467f20f))
|
|
26
|
+
|
|
3
27
|
## [0.0.3](https://github.com/teloscube/decaf-react-webapp/compare/v0.0.2...v0.0.3) (2022-11-28)
|
|
4
28
|
|
|
5
29
|
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { ThemeConfig } from 'antd/es/config-provider/context';
|
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import { RouteObject } from 'react-router-dom';
|
|
8
8
|
import { DecafMenuItem } from './Layout';
|
|
9
|
+
import { decafTheme } from './theme';
|
|
9
10
|
export type DecafRoute = RouteObject;
|
|
10
11
|
export interface DecafWebappProps {
|
|
11
12
|
config?: DecafAppConfig;
|
|
@@ -17,5 +18,5 @@ export interface DecafWebappProps {
|
|
|
17
18
|
appIcon?: React.ReactNode;
|
|
18
19
|
}
|
|
19
20
|
declare function DecafWebapp(props: DecafWebappProps): JSX.Element;
|
|
20
|
-
export { DecafWebapp, Global as GlobalStyle, css, styled };
|
|
21
|
+
export { DecafWebapp, Global as GlobalStyle, css, styled, decafTheme };
|
|
21
22
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,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;AAC9D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAA+B,WAAW,EAAkB,MAAM,kBAAkB,CAAC;AAC5F,OAAoB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,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;AAC9D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAA+B,WAAW,EAAkB,MAAM,kBAAkB,CAAC;AAC5F,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,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,SAAS,EAAE,aAAa,EAAE,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAuBD,iBAAS,WAAW,CAAC,KAAK,EAAE,gBAAgB,eAuC3C;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"),t=require("@emotion/react"),
|
|
1
|
+
var e=require("@decafhub/decaf-react"),t=require("@emotion/react"),r=require("@emotion/styled"),n=require("antd");require("antd/dist/reset.css");var a=require("react"),o=require("react-router-dom");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=/*#__PURE__*/l(r),i=/*#__PURE__*/l(a);function d(){return d=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},d.apply(this,arguments)}function u(e){var t=[];return e.forEach(function(e){var r={key:"to"in e?e.to:e.label,label:e.label,icon:e.icon};"to"in e&&e.to?r.label=i.default.createElement(o.NavLink,{to:e.to,end:"/"===e.to},e.label):"href"in e&&e.href?r.label=i.default.createElement("a",{href:e.href},e.label):e.children&&(r.label=e.label,r.children=u(e.children||[])),t.push(r)}),t}function f(e){var t=u(e.menu),r=o.useMatches().map(function(e){return e.pathname});return i.default.createElement(n.Layout,{style:{height:"100%"}},i.default.createElement(n.Layout.Header,{style:{paddingInline:0}},i.default.createElement("div",{style:{paddingInline:20,display:"flex",justifyContent:"space-between",alignItems:"center"}},i.default.createElement(o.Link,{to:"/",style:{display:"flex",alignItems:"center",gap:10}},e.appIcon,i.default.createElement(n.Typography.Title,{level:4,style:{margin:0}},e.appName)),i.default.createElement(n.Menu,{style:{justifyContent:"flex-end",backgroundColor:"transparent",border:"none",flex:1},mode:"horizontal",items:t,selectedKeys:r}))),i.default.createElement(n.Layout.Content,{style:{padding:"20px 50px"}},e.children))}var s={colorBorder:"#10161d",colorBorderSecondary:"#10161d"},m={hashed:!0,components:{Layout:{colorBgHeader:"#10161d"},Button:{boxShadow:"none",boxShadowSecondary:"none"},Input:d({},s),Select:d({},s),Dropdown:d({},s)},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:[n.theme.darkAlgorithm]};function p(e,t){var r=[];return t.forEach(function(t){var n,a=d({},t);t.children?(a.element=null!=(n=t.element)?n:i.default.createElement(o.Outlet,null),a.children=p(e,t.children)):a.element=i.default.createElement(f,{menu:e.menuItems,appName:e.appName,appIcon:e.appIcon},t.element),r.push(a)}),r}Object.defineProperty(exports,"GlobalStyle",{enumerable:!0,get:function(){return t.Global}}),Object.defineProperty(exports,"css",{enumerable:!0,get:function(){return t.css}}),Object.defineProperty(exports,"styled",{enumerable:!0,get:function(){return c.default}}),exports.DecafWebapp=function(r){var a,l,c,d,u,f,s=p(r,r.routes),h=o.createBrowserRouter(s,{basename:null==(a=r.config)?void 0:a.basePath}),y=null!=(l=r.theme)?l:m;return i.default.createElement(n.ConfigProvider,{theme:y},i.default.createElement(t.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==(c=y.token)?void 0:c.colorBgBase,fontFamily:null==(d=y.token)?void 0:d.fontFamily,margin:0},button:{boxShadow:"none !important"},".ant-page-header-back-button, .ant-page-header-heading-title":{color:(null==(u=y.token)?void 0:u.colorWhite)+" !important"},".ant-badge-count":{color:(null==(f=y.token)?void 0:f.colorWhite)+" !important"}}}),i.default.createElement(e.DecafApp,{config:r.config,controller:r.controller},i.default.createElement(o.RouterProvider,{router:h})))},exports.decafTheme=m;
|
|
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 button: {\n // antd button has a default box shadow and we can't override it for now\n boxShadow: 'none !important',\n },\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 };\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","colorError","colorSuccess","colorWarning","colorInfo","green","red","blue","yellow","colorWhite","algorithm","theme","darkAlgorithm","buildRoutes","element","_route$element","Outlet","_props$config","_props$theme","_theme$token","_theme$token2","router","createBrowserRouter","basename","config","basePath","ConfigProvider","Global","styles","body","background","button","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,UAAY,KAErEb,E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,EAAwB,GAiB9B,OAfAD,EAAOE,QAAQ,SAACC,GACd,IAEEC,EAFIA,EAAyBD,EAAAA,CAAAA,EAAAA,GAC3BA,EAAMW,UACRV,EAAKuE,QAA2BlE,OAApBmE,EAAGzE,EAAMwE,SAAWlE,EAAAA,EAAAA,QAAAC,cAACmE,EAAMA,OAAA,MACvCzE,EAAKU,SAAW4D,EAAYzD,EAAOd,EAAMW,WAEzCV,EAAKuE,QACHlE,EAAC,QAAAC,cAAAM,EAAY,CAAAG,KAAMF,EAAMC,UAAWsB,QAASvB,EAAMuB,QAASL,QAASlB,EAAMkB,SACxEhC,EAAMwE,SAIb1E,EAAOc,KAAKX,EACd,GAEOH,CACT,6RAEA,SAAqBgB,GAAuB,IAAA6D,EAAAC,EAAAC,EAAAC,EAC9BjF,EAAG0E,EAAYzD,EAAOA,EAAMjB,QAC5BkF,EAAGC,EAAmBA,oBAACnF,EAAQ,CACzCoF,gBAAUnE,EAAAA,EAAMoE,eAANP,EAAcQ,WAGfd,EAAkBvB,OAAlB8B,EAAG9D,EAAMuD,OAASvB,EAAAA,EAE7B,OACExC,EAAAA,QAACC,cAAA6E,EAAcA,eAAC,CAAAf,MAAOA,GACrB/D,EAAC,QAAAC,cAAA8E,SACC,CAAAC,OAAQ,CACNC,KAAM,CACJC,WAAY,OAAAnB,EAAAA,EAAMhB,YAAN,EAAAwB,EAAarB,YACzBF,WAAuB,OAAXe,EAAAA,EAAMhB,YAAK,EAAXyB,EAAaxB,WACzBlB,OAAQ,GAEVqD,OAAQ,CAENtC,UAAW,sBAIjB7C,EAAA,QAAAC,cAACmF,EAAAA,SAAQ,CAACR,OAAQpE,EAAMoE,OAAQS,WAAY7E,EAAM6E,YAChDrF,EAAC,QAAAC,cAAAqF,EAAAA,gBAAeb,OAAQA,KAIhC"}
|
|
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', 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>\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\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 Input: {\n ...BORDER_COLORS_TRANSPARENT,\n },\n Select: {\n ...BORDER_COLORS_TRANSPARENT,\n },\n Dropdown: {\n ...BORDER_COLORS_TRANSPARENT,\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 { 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 '@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":["routes","forEach","route","key","to","label","icon","item","React","createElement","NavLink","end","href","children","routesToAntMenu","result","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","flex","mode","items","selectedKeys","Content","padding","BORDER_COLORS_TRANSPARENT","colorBorder","colorBorderSecondary","decafTheme","hashed","components","colorBgHeader","Button","boxShadow","boxShadowSecondary","Input","_extends","Select","Dropdown","token","fontFamily","colorPrimary","colorBgBase","colorBgContainer","colorBgElevated","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","src","body","background","button","color","DecafApp","controller","RouterProvider"],"mappings":"8hBAoBM,WAA0BA,GAC9B,MAA2B,GAuB3B,OArBAA,EAAOC,QAAQ,SAACC,GACd,MAAuB,CACrBC,IAAK,SAAgBD,EAAME,GAAKF,EAAMG,MACtCA,MAAOH,EAAMG,MACbC,KAAMJ,EAAMI,MAEV,UAAiBJ,EAAME,GACzBG,EAAKF,MACHG,EAAA,QAAAC,cAACC,EAAAA,QAAO,CAACN,GAAIF,EAAME,GAAIO,IAAkB,MAAbT,EAAME,IAC/BF,EAAMG,OAGF,YAAmBH,EAAMU,KAClCL,EAAKF,MAAQG,EAAAA,QAAAC,cAAA,IAAA,CAAGG,KAAMV,EAAMU,MAAOV,EAAMG,OAChCH,EAAMW,WACfN,EAAKF,MAAQH,EAAMG,MAClBE,EAAqBM,SAAWC,EAAgBZ,EAAMW,UAAY,KAErEE,EAAOC,KAAKT,EACd,IAGF,CAEwBU,SAAAA,EAAYC,GAClC,IAAeC,EAAGL,EAAgBI,EAAME,MAElCC,EADUC,eACiBC,IAAI,SAACC,UAAeA,EAACC,QAAQ,GAE9D,OACGjB,UAAAC,cAAAiB,EAAMA,OAAC,CAAAC,MAAO,CAAEC,OAAQ,SACvBpB,EAAC,QAAAC,cAAAiB,EAAAA,OAAOG,OAAO,CAAAF,MAAO,CAAEG,cAAe,IACrCtB,EAAA,QAAAC,cAAA,MAAA,CAAKkB,MAAO,CAAEG,cAAe,GAAIC,QAAS,OAAQC,eAAgB,gBAAiBC,WAAY,WAC7FzB,EAAAA,QAACC,cAAAyB,EAAIA,MAAC9B,GAAG,IAAIuB,MAAO,CAAEI,QAAS,OAAQE,WAAY,SAAUE,IAAK,KAC/DjB,EAAMkB,QACP5B,EAAC,QAAAC,cAAA4B,EAAAA,WAAWC,MAAK,CAACC,MAAO,EAAGZ,MAAO,CAAEa,OAAQ,IAC1CtB,EAAMuB,UAGXjC,EAAAA,QAAAC,cAACiC,OAAI,CACHf,MAAO,CAAEK,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,EAAGC,sBAAoB5F,EAAQ,CACzC6F,SAAsB,OAAZ3E,EAAAA,EAAM4E,aAAM,EAAZT,EAAcU,WAGfhB,SAAAO,EAAGpE,EAAM6D,SAASzB,EAE7B,OACG9C,EAAA,QAAAC,cAAAuF,EAAAA,eAAe,CAAAjB,MAAOA,GACrBvE,EAAC,QAAAC,cAAAwF,EAAAA,OACC,CAAAC,OAAQ,CACN,aAAc,CACZhC,WAAY,mBACZiC,IAAK,gFAEPC,KAAM,CACJC,WAAuB,OAAXtB,EAAAA,EAAMd,YAAK,EAAXsB,EAAanB,YACzBF,WAAuB,OAAXa,EAAAA,EAAMd,YAAK,EAAXuB,EAAatB,WACzB1B,OAAQ,GAGV8D,OAAQ,CACN3C,UAAW,mBAEb,+DAAgE,CAC9D4C,OAAqB,OAAXxB,EAAAA,EAAMd,YAAK,EAAXwB,EAAaZ,YAAU,eAEnC,mBAAoB,CAClB0B,OAAqB,OAAXxB,EAAAA,EAAMd,YAAK,EAAXyB,EAAab,8BAK7BrE,EAAA,QAAAC,cAAC+F,EAAAA,SAAQ,CAACV,OAAQ5E,EAAM4E,OAAQW,WAAYvF,EAAMuF,YAChDjG,UAACC,cAAAiG,EAAcA,gBAACf,OAAQA,KAIhC"}
|
package/dist/index.modern.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{DecafApp as e}from"@decafhub/decaf-react";import{Global as t}from"@emotion/react";export{Global as GlobalStyle,css}from"@emotion/react";export{default as styled}from"@emotion/styled";import{Layout as o,Typography as n,Menu as r,theme as
|
|
1
|
+
import{DecafApp as e}from"@decafhub/decaf-react";import{Global as t}from"@emotion/react";export{Global as GlobalStyle,css}from"@emotion/react";export{default as styled}from"@emotion/styled";import{Layout as o,Typography as n,Menu as r,theme as a,ConfigProvider as l}from"antd";import"antd/dist/reset.css";import c from"react";import{useMatches as i,Link as d,NavLink as s,createBrowserRouter as m,RouterProvider as f,Outlet as p}from"react-router-dom";function u(){return u=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},u.apply(this,arguments)}function h(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=c.createElement(s,{to:e.to,end:"/"===e.to},e.label):"href"in e&&e.href?o.label=c.createElement("a",{href:e.href},e.label):e.children&&(o.label=e.label,o.children=h(e.children||[])),t.push(o)}),t}function y(e){const t=h(e.menu),a=i().map(e=>e.pathname);return c.createElement(o,{style:{height:"100%"}},c.createElement(o.Header,{style:{paddingInline:0}},c.createElement("div",{style:{paddingInline:20,display:"flex",justifyContent:"space-between",alignItems:"center"}},c.createElement(d,{to:"/",style:{display:"flex",alignItems:"center",gap:10}},e.appIcon,c.createElement(n.Title,{level:4,style:{margin:0}},e.appName)),c.createElement(r,{style:{justifyContent:"flex-end",backgroundColor:"transparent",border:"none",flex:1},mode:"horizontal",items:t,selectedKeys:a}))),c.createElement(o.Content,{style:{padding:"20px 50px"}},e.children))}const b={colorBorder:"#10161d",colorBorderSecondary:"#10161d"},g={hashed:!0,components:{Layout:{colorBgHeader:"#10161d"},Button:{boxShadow:"none",boxShadowSecondary:"none"},Input:u({},b),Select:u({},b),Dropdown:u({},b)},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:[a.darkAlgorithm]};function E(e,t){const o=[];return t.forEach(t=>{const n=u({},t);var r;t.children?(n.element=null!=(r=t.element)?r:c.createElement(p,null),n.children=E(e,t.children)):n.element=c.createElement(y,{menu:e.menuItems,appName:e.appName,appIcon:e.appIcon},t.element),o.push(n)}),o}function v(o){var n,r,a,i,d,s;const p=E(o,o.routes),u=m(p,{basename:null==(n=o.config)?void 0:n.basePath}),h=null!=(r=o.theme)?r:g;return c.createElement(l,{theme:h},c.createElement(t,{styles:{"@font-face":{fontFamily:"Lato, sans-serif",src:"url(https://fonts.googleapis.com/css2?family=Lato:wght@400;700&display=swap)"},body:{background:null==(a=h.token)?void 0:a.colorBgBase,fontFamily:null==(i=h.token)?void 0:i.fontFamily,margin:0},button:{boxShadow:"none !important"},".ant-page-header-back-button, .ant-page-header-heading-title":{color:`${null==(d=h.token)?void 0:d.colorWhite} !important`},".ant-badge-count":{color:`${null==(s=h.token)?void 0:s.colorWhite} !important`}}}),c.createElement(e,{config:o.config,controller:o.controller},c.createElement(f,{router:u})))}export{v as DecafWebapp,g 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 button: {\n // antd button has a default box shadow and we can't override it for now\n boxShadow: 'none !important',\n },\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 };\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","colorError","colorSuccess","colorWarning","colorInfo","green","red","blue","yellow","colorWhite","algorithm","theme","darkAlgorithm","buildRoutes","_extends","_route$element","element","Outlet","_props$config","_props$theme","_theme$token","_theme$token2","router","createBrowserRouter","basename","config","basePath","ConfigProvider","Global","styles","body","background","button","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,OACGf,EAAAC,cAAAe,EAAO,CAAAC,MAAO,CAAEC,OAAQ,SACvBlB,EAACC,cAAAe,EAAOG,OAAO,CAAAF,MAAO,CAAEG,cAAe,IACrCpB,EAAAC,cAAA,MAAA,CAAKgB,MAAO,CAAEG,cAAe,GAAIC,QAAS,OAAQC,eAAgB,gBAAiBC,WAAY,WAC7FvB,EAACC,cAAAuB,G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AAG0E,EAAYzD,EAAOA,EAAMjB,QAC5BmF,EAAGC,EAAoBpF,EAAQ,CACzCqF,gBAAUpE,EAAAA,EAAMqE,eAANP,EAAcQ,WAGff,EAAkBvB,OAAlB+B,EAAG/D,EAAMuD,OAASvB,EAAAA,EAE7B,OACExC,EAACC,cAAA8E,EAAe,CAAAhB,MAAOA,GACrB/D,EAACC,cAAA+E,EACC,CAAAC,OAAQ,CACNC,KAAM,CACJC,WAAY,OAAApB,EAAAA,EAAMhB,YAAN,EAAAyB,EAAatB,YACzBF,WAAuB,OAAXe,EAAAA,EAAMhB,YAAK,EAAX0B,EAAazB,WACzBlB,OAAQ,GAEVsD,OAAQ,CAENvC,UAAW,sBAIjB7C,EAAAC,cAACoF,EAAQ,CAACR,OAAQrE,EAAMqE,OAAQS,WAAY9E,EAAM8E,YAChDtF,EAACC,cAAAsF,GAAeb,OAAQA,KAIhC"}
|
|
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', 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>\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\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 Input: {\n ...BORDER_COLORS_TRANSPARENT,\n },\n Select: {\n ...BORDER_COLORS_TRANSPARENT,\n },\n Dropdown: {\n ...BORDER_COLORS_TRANSPARENT,\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 { 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 '@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":["routes","forEach","route","item","key","to","label","icon","React","createElement","NavLink","end","href","children","routesToAntMenu","result","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","flex","mode","items","selectedKeys","Content","padding","BORDER_COLORS_TRANSPARENT","colorBorder","colorBorderSecondary","decafTheme","hashed","components","colorBgHeader","Button","boxShadow","boxShadowSecondary","Input","_extends","Select","Dropdown","token","fontFamily","colorPrimary","colorBgBase","colorBgContainer","colorBgElevated","colorBgLayout","borderRadius","green","red","blue","yellow","colorWhite","algorithm","theme","darkAlgorithm","buildRoutes","element","_route$element","Outlet","DecafWebapp","createBrowserRouter","basename","_props$config","config","basePath","_props$theme","ConfigProvider","Global","styles","src","body","background","_theme$token","_theme$token2","button","color","_theme$token3","_theme$token4","DecafApp","controller","RouterProvider","router"],"mappings":"wqBAoBM,WAA0BA,GAC9B,QAA2B,GAuB3B,OArBAA,EAAOC,QAASC,IACd,MAAMC,EAAiB,CACrBC,IAAK,OAAQF,EAAQA,EAAMG,GAAKH,EAAMI,MACtCA,MAAOJ,EAAMI,MACbC,KAAML,EAAMK,MAEV,OAAQL,GAASA,EAAMG,GACzBF,EAAKG,MACHE,EAAAC,cAACC,EAAO,CAACL,GAAIH,EAAMG,GAAIM,IAAkB,MAAbT,EAAMG,IAC/BH,EAAMI,OAGF,SAAUJ,GAASA,EAAMU,KAClCT,EAAKG,MAAQE,EAAAC,cAAA,IAAA,CAAGG,KAAMV,EAAMU,MAAOV,EAAMI,OAChCJ,EAAMW,WACfV,EAAKG,MAAQJ,EAAMI,MAClBH,EAAqBU,SAAWC,EAAgBZ,EAAM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C"}
|
package/dist/index.module.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{DecafApp as e}from"@decafhub/decaf-react";import{Global as t}from"@emotion/react";export{Global as GlobalStyle,css}from"@emotion/react";export{default as styled}from"@emotion/styled";import{Layout as o,Typography as n,Menu as r,theme as a,ConfigProvider as l}from"antd";import"antd/dist/reset.css";import c from"react";import{useMatches as i,Link as
|
|
1
|
+
import{DecafApp as e}from"@decafhub/decaf-react";import{Global as t}from"@emotion/react";export{Global as GlobalStyle,css}from"@emotion/react";export{default as styled}from"@emotion/styled";import{Layout as o,Typography as n,Menu as r,theme as a,ConfigProvider as l}from"antd";import"antd/dist/reset.css";import c from"react";import{useMatches as i,Link as d,NavLink as m,createBrowserRouter as s,RouterProvider as f,Outlet as p}from"react-router-dom";function u(){return u=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},u.apply(this,arguments)}function h(e){var t=[];return e.forEach(function(e){var o={key:"to"in e?e.to:e.label,label:e.label,icon:e.icon};"to"in e&&e.to?o.label=c.createElement(m,{to:e.to,end:"/"===e.to},e.label):"href"in e&&e.href?o.label=c.createElement("a",{href:e.href},e.label):e.children&&(o.label=e.label,o.children=h(e.children||[])),t.push(o)}),t}function y(e){var t=h(e.menu),a=i().map(function(e){return e.pathname});return c.createElement(o,{style:{height:"100%"}},c.createElement(o.Header,{style:{paddingInline:0}},c.createElement("div",{style:{paddingInline:20,display:"flex",justifyContent:"space-between",alignItems:"center"}},c.createElement(d,{to:"/",style:{display:"flex",alignItems:"center",gap:10}},e.appIcon,c.createElement(n.Title,{level:4,style:{margin:0}},e.appName)),c.createElement(r,{style:{justifyContent:"flex-end",backgroundColor:"transparent",border:"none",flex:1},mode:"horizontal",items:t,selectedKeys:a}))),c.createElement(o.Content,{style:{padding:"20px 50px"}},e.children))}var b={colorBorder:"#10161d",colorBorderSecondary:"#10161d"},g={hashed:!0,components:{Layout:{colorBgHeader:"#10161d"},Button:{boxShadow:"none",boxShadowSecondary:"none"},Input:u({},b),Select:u({},b),Dropdown:u({},b)},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:[a.darkAlgorithm]};function v(e,t){var o=[];return t.forEach(function(t){var n,r=u({},t);t.children?(r.element=null!=(n=t.element)?n:c.createElement(p,null),r.children=v(e,t.children)):r.element=c.createElement(y,{menu:e.menuItems,appName:e.appName,appIcon:e.appIcon},t.element),o.push(r)}),o}function E(o){var n,r,a,i,d,m,p=v(o,o.routes),u=s(p,{basename:null==(n=o.config)?void 0:n.basePath}),h=null!=(r=o.theme)?r:g;return c.createElement(l,{theme:h},c.createElement(t,{styles:{"@font-face":{fontFamily:"Lato, sans-serif",src:"url(https://fonts.googleapis.com/css2?family=Lato:wght@400;700&display=swap)"},body:{background:null==(a=h.token)?void 0:a.colorBgBase,fontFamily:null==(i=h.token)?void 0:i.fontFamily,margin:0},button:{boxShadow:"none !important"},".ant-page-header-back-button, .ant-page-header-heading-title":{color:(null==(d=h.token)?void 0:d.colorWhite)+" !important"},".ant-badge-count":{color:(null==(m=h.token)?void 0:m.colorWhite)+" !important"}}}),c.createElement(e,{config:o.config,controller:o.controller},c.createElement(f,{router:u})))}export{E as DecafWebapp,g 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 button: {\n // antd button has a default box shadow and we can't override it for now\n boxShadow: 'none !important',\n },\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 };\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","colorError","colorSuccess","colorWarning","colorInfo","green","red","blue","yellow","colorWhite","algorithm","theme","darkAlgorithm","buildRoutes","element","_route$element","Outlet","_props$config","_props$theme","_theme$token","_theme$token2","router","createBrowserRouter","basename","config","basePath","ConfigProvider","Global","styles","body","background","button","DecafApp","controller","RouterProvider"],"mappings":"irBAoB+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,EAAAC,cAACC,EAAO,CAACL,GAAIH,EAAMG,GAAIM,IAAkB,MAAbT,EAAMG,IAC/BH,EAAMI,OAGF,SAAeJ,GAA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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', 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>\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\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 Input: {\n ...BORDER_COLORS_TRANSPARENT,\n },\n Select: {\n ...BORDER_COLORS_TRANSPARENT,\n },\n Dropdown: {\n ...BORDER_COLORS_TRANSPARENT,\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 { 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 '@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":["routes","forEach","route","key","to","label","icon","item","React","createElement","NavLink","end","href","children","routesToAntMenu","result","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","flex","mode","items","selectedKeys","Content","padding","BORDER_COLORS_TRANSPARENT","colorBorder","colorBorderSecondary","decafTheme","hashed","components","colorBgHeader","Button","boxShadow","boxShadowSecondary","Input","_extends","Select","Dropdown","token","fontFamily","colorPrimary","colorBgBase","colorBgContainer","colorBgElevated","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","src","body","background","button","color","DecafApp","controller","RouterProvider"],"mappings":"wqBAoBM,WAA0BA,GAC9B,MAA2B,GAuB3B,OArBAA,EAAOC,QAAQ,SAACC,GACd,MAAuB,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,YAAmBH,EAAMU,KAClCL,EAAKF,MAAQG,EAAAC,cAAA,IAAA,CAAGG,KAAMV,EAAMU,MAAOV,EAAMG,OAChCH,EAAMW,WACfN,EAAKF,MAAQH,EAAMG,MAClBE,EAAqBM,SAAWC,EAAgBZ,EAAMW,UAAY,KAErEE,EAAOC,KAAKT,EACd,IAGF,CAEwBU,SAAAA,EAAYC,GAClC,IAAeC,EAAGL,EAAgBI,EAAME,MAElCC,EADUC,IACiBC,IAAI,SAACC,UAAeA,EAACC,QAAQ,GAE9D,OACGjB,EAAAC,cAAAiB,EAAO,CAAAC,MAAO,CAAEC,OAAQ,SACvBpB,EAACC,cAAAiB,EAAOG,OAAO,CAAAF,MAAO,CAAEG,cAAe,IACrCtB,EAAAC,cAAA,MAAA,CAAKkB,MAAO,CAAEG,cAAe,GAAIC,QAAS,OAAQC,eAAgB,gBAAiBC,WAAY,WAC7FzB,EAACC,cAAAyB,GAAK9B,GAAG,IAAIuB,MAAO,CAAEI,QAAS,OAAQE,WAAY,SAAUE,IAAK,KAC/DjB,EAAMkB,QACP5B,EAACC,cAAA4B,EAAWC,MAAK,CAACC,MAAO,EAAGZ,MAAO,CAAEa,OAAQ,IAC1CtB,EAAMuB,UAGXjC,EAAAC,cAACiC,EAAI,CACHf,MAAO,CAAEK,eAAgB,WAAYW,gBAAiB,cAAeC,OAAQ,OAAQC,KAAM,G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B,SAAAO,EAAGpE,EAAM6D,SAASzB,EAE7B,OACG9C,EAAAC,cAAAuF,EAAe,CAAAjB,MAAOA,GACrBvE,EAACC,cAAAwF,EACC,CAAAC,OAAQ,CACN,aAAc,CACZhC,WAAY,mBACZiC,IAAK,gFAEPC,KAAM,CACJC,WAAuB,OAAXtB,EAAAA,EAAMd,YAAK,EAAXsB,EAAanB,YACzBF,WAAuB,OAAXa,EAAAA,EAAMd,YAAK,EAAXuB,EAAatB,WACzB1B,OAAQ,GAGV8D,OAAQ,CACN3C,UAAW,mBAEb,+DAAgE,CAC9D4C,OAAqB,OAAXxB,EAAAA,EAAMd,YAAK,EAAXwB,EAAaZ,YAAU,eAEnC,mBAAoB,CAClB0B,OAAqB,OAAXxB,EAAAA,EAAMd,YAAK,EAAXyB,EAAab,8BAK7BrE,EAAAC,cAAC+F,EAAQ,CAACV,OAAQ5E,EAAM4E,OAAQW,WAAYvF,EAAMuF,YAChDjG,EAACC,cAAAiG,GAAef,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,o,r,
|
|
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,o,r,l,c){function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=/*#__PURE__*/d(a),u=/*#__PURE__*/d(l);function f(){return f=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},f.apply(this,arguments)}function s(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(c.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=s(e.children||[])),t.push(n)}),t}function m(e){var t=s(e.menu),n=c.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(c.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))}var p={colorBorder:"#10161d",colorBorderSecondary:"#10161d"},h={hashed:!0,components:{Layout:{colorBgHeader:"#10161d"},Button:{boxShadow:"none",boxShadowSecondary:"none"},Input:f({},p),Select:f({},p),Dropdown:f({},p)},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 y(e,t){var n=[];return t.forEach(function(t){var a,o=f({},t);t.children?(o.element=null!=(a=t.element)?a:u.default.createElement(c.Outlet,null),o.children=y(e,t.children)):o.element=u.default.createElement(m,{menu:e.menuItems,appName:e.appName,appIcon:e.appIcon},t.element),n.push(o)}),n}Object.defineProperty(e,"GlobalStyle",{enumerable:!0,get:function(){return n.Global}}),Object.defineProperty(e,"css",{enumerable:!0,get:function(){return n.css}}),Object.defineProperty(e,"styled",{enumerable:!0,get:function(){return i.default}}),e.DecafWebapp=function(e){var a,r,l,d,i,f,s=y(e,e.routes),m=c.createBrowserRouter(s,{basename:null==(a=e.config)?void 0:a.basePath}),p=null!=(r=e.theme)?r:h;return u.default.createElement(o.ConfigProvider,{theme:p},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==(l=p.token)?void 0:l.colorBgBase,fontFamily:null==(d=p.token)?void 0:d.fontFamily,margin:0},button:{boxShadow:"none !important"},".ant-page-header-back-button, .ant-page-header-heading-title":{color:(null==(i=p.token)?void 0:i.colorWhite)+" !important"},".ant-badge-count":{color:(null==(f=p.token)?void 0:f.colorWhite)+" !important"}}}),u.default.createElement(t.DecafApp,{config:e.config,controller:e.controller},u.default.createElement(c.RouterProvider,{router:m})))},e.decafTheme=h});
|
|
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 button: {\n // antd button has a default box shadow and we can't override it for now\n boxShadow: 'none !important',\n },\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 };\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","colorError","colorSuccess","colorWarning","colorInfo","green","red","blue","yellow","colorWhite","algorithm","theme","darkAlgorithm","buildRoutes","element","_route$element","Outlet","_props$config","_props$theme","_theme$token","_theme$token2","router","createBrowserRouter","basename","config","basePath","ConfigProvider","Global","styles","body","background","button","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,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}
|
|
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', 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>\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\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 Input: {\n ...BORDER_COLORS_TRANSPARENT,\n },\n Select: {\n ...BORDER_COLORS_TRANSPARENT,\n },\n Dropdown: {\n ...BORDER_COLORS_TRANSPARENT,\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 { 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 '@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":["routes","forEach","route","key","to","label","icon","item","React","createElement","NavLink","end","href","children","routesToAntMenu","result","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","flex","mode","items","selectedKeys","Content","padding","BORDER_COLORS_TRANSPARENT","colorBorder","colorBorderSecondary","decafTheme","hashed","components","colorBgHeader","Button","boxShadow","boxShadowSecondary","Input","_extends","Select","Dropdown","token","fontFamily","colorPrimary","colorBgBase","colorBgContainer","colorBgElevated","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","src","body","background","button","color","DecafApp","controller","RouterProvider"],"mappings":"q7BAoBM,WAA0BA,GAC9B,MAA2B,GAuB3B,OArBAA,EAAOC,QAAQ,SAACC,GACd,MAAuB,CACrBC,IAAK,SAAgBD,EAAME,GAAKF,EAAMG,MACtCA,MAAOH,EAAMG,MACbC,KAAMJ,EAAMI,MAEV,UAAiBJ,EAAME,GACzBG,EAAKF,MACHG,EAAA,QAAAC,cAACC,EAAAA,QAAO,CAACN,GAAIF,EAAME,GAAIO,IAAkB,MAAbT,EAAME,IAC/BF,EAAMG,OAGF,YAAmBH,EAAMU,KAClCL,EAAKF,MAAQG,EAAAA,QAAAC,cAAA,IAAA,CAAGG,KAAMV,EAAMU,MAAOV,EAAMG,OAChCH,EAAMW,WACfN,EAAKF,MAAQH,EAAMG,MAClBE,EAAqBM,SAAWC,EAAgBZ,EAAMW,UAAY,KAErEE,EAAOC,KAAKT,EACd,IAGF,CAEwBU,SAAAA,EAAYC,GAClC,IAAeC,EAAGL,EAAgBI,EAAME,MAElCC,EADUC,eACiBC,IAAI,SAACC,UAAeA,EAACC,QAAQ,GAE9D,OACGjB,UAAAC,cAAAiB,EAAMA,OAAC,CAAAC,MAAO,CAAEC,OAAQ,SACvBpB,EAAC,QAAAC,cAAAiB,EAAAA,OAAOG,OAAO,CAAAF,MAAO,CAAEG,cAAe,IACrCtB,EAAA,QAAAC,cAAA,MAAA,CAAKkB,MAAO,CAAEG,cAAe,GAAIC,QAAS,OAAQC,eAAgB,gBAAiBC,WAAY,WAC7FzB,EAAAA,QAACC,cAAAyB,EAAIA,MAAC9B,GAAG,IAAIuB,MAAO,CAAEI,QAAS,OAAQE,WAAY,SAAUE,IAAK,KAC/DjB,EAAMkB,QACP5B,EAAC,QAAAC,cAAA4B,EAAAA,WAAW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AAKT,EACd,IAGF,qQAEA,SAAqBW,GACnB,IAAAmE,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,IAAeT,EAAY/D,EAAOA,EAAMlB,QAC5B2F,EAAGC,sBAAoB5F,EAAQ,CACzC6F,SAAsB,OAAZ3E,EAAAA,EAAM4E,aAAM,EAAZT,EAAcU,WAGfhB,SAAAO,EAAGpE,EAAM6D,SAASzB,EAE7B,OACG9C,EAAA,QAAAC,cAAAuF,EAAAA,eAAe,CAAAjB,MAAOA,GACrBvE,EAAC,QAAAC,cAAAwF,EAAAA,OACC,CAAAC,OAAQ,CACN,aAAc,CACZhC,WAAY,mBACZiC,IAAK,gFAEPC,KAAM,CACJC,WAAuB,OAAXtB,EAAAA,EAAMd,YAAK,EAAXsB,EAAanB,YACzBF,WAAuB,OAAXa,EAAAA,EAAMd,YAAK,EAAXuB,EAAatB,WACzB1B,OAAQ,GAGV8D,OAAQ,CACN3C,UAAW,mBAEb,+DAAgE,CAC9D4C,OAAqB,OAAXxB,EAAAA,EAAMd,YAAK,EAAXwB,EAAaZ,YAAU,eAEnC,mBAAoB,CAClB0B,OAAqB,OAAXxB,EAAAA,EAAMd,YAAK,EAAXyB,EAAab,8BAK7BrE,EAAA,QAAAC,cAAC+F,EAAAA,SAAQ,CAACV,OAAQ5E,EAAM4E,OAAQW,WAAYvF,EAAMuF,YAChDjG,UAACC,cAAAiG,EAAcA,gBAACf,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;AAO9D,eAAO,MAAM,UAAU,EAAE,WAsCxB,CAAC"}
|