@moneko/core 2.0.0-beta.22 → 2.0.0-beta.25
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/build/antd-config.d.ts +2 -0
- package/build/antd-config.js +1 -0
- package/build/common.js +1 -1
- package/build/modifyVars.d.ts +2 -0
- package/build/modifyVars.js +1 -0
- package/build/module.config.js +1 -1
- package/build/swcrc.js +1 -1
- package/build/webpack.common.js +1 -1
- package/lib/components/app-router/index.d.ts +3 -2
- package/lib/components/app-router/index.js +1 -1
- package/lib/components/app-router/index.js.map +1 -1
- package/lib/components/fallback/index.js +1 -1
- package/lib/components/fallback/index.js.map +1 -1
- package/lib/components/readme/index.d.ts +3 -0
- package/lib/components/readme/index.js +2 -0
- package/lib/components/readme/index.js.map +1 -0
- package/lib/components/readme/index.less +4 -0
- package/lib/packages/back-stage/app.js +1 -1
- package/lib/packages/back-stage/app.js.map +1 -1
- package/lib/packages/back-stage/bootstrap.d.ts +4 -0
- package/lib/packages/back-stage/bootstrap.js +1 -1
- package/lib/packages/back-stage/bootstrap.js.map +1 -1
- package/lib/packages/library/app.d.ts +4 -0
- package/lib/packages/library/app.js +1 -1
- package/lib/packages/library/app.js.map +1 -1
- package/lib/packages/mobile/app.d.ts +4 -0
- package/lib/packages/mobile/app.js +1 -1
- package/lib/packages/mobile/app.js.map +1 -1
- package/lib/packages/single-spa/app.d.ts +4 -0
- package/lib/packages/single-spa/app.js +1 -1
- package/lib/packages/single-spa/app.js.map +1 -1
- package/lib/packages/site/app.d.ts +4 -0
- package/lib/packages/site/app.js +1 -1
- package/lib/packages/site/app.js.map +1 -1
- package/lib/router/index.d.ts +3 -5
- package/lib/router/index.js +1 -1
- package/lib/router/index.js.map +1 -1
- package/lib/styles/animation.css +58 -0
- package/lib/styles/global.css +124 -0
- package/lib/styles/normalize.css +174 -0
- package/lib/styles/variables.css +40 -0
- package/lib/styles/vars.d.ts +0 -2
- package/lib/styles/vars.js +1 -1
- package/lib/styles/vars.js.map +1 -1
- package/lib/utils/index.d.ts +0 -1
- package/lib/utils/index.js +1 -1
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/lazy-import.d.ts +34 -0
- package/lib/utils/lazy-import.js +2 -0
- package/lib/utils/lazy-import.js.map +1 -0
- package/package.json +11 -8
- package/typings/global.d.ts +2 -0
- package/lib/styles/animation.d.ts +0 -5
- package/lib/styles/animation.js +0 -2
- package/lib/styles/animation.js.map +0 -1
- package/lib/styles/normalize.d.ts +0 -2
- package/lib/styles/normalize.js +0 -2
- package/lib/styles/normalize.js.map +0 -1
package/lib/router/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/router/index.ts"],"sourcesContent":["import { pathToRegexp } from 'path-to-regexp';\nimport { createElement, lazy, type ReactElement, type ReactNode } from 'react';\nimport type { RouteObject } from 'react-router-dom';\n\nexport interface RouterProps extends Omit<RouteObject, 'index' | 'children'> {\n key: string;\n alive?: boolean;\n icon?: ReactNode;\n dynamicTitle?: string;\n i18n?: string | null;\n hideMenu?: boolean;\n hideTabs?: boolean;\n onlyLogin?: boolean;\n root?: boolean;\n path?: string;\n element?: ReactElement;\n fallback?: ReactElement;\n /** 可否关闭标签 */\n closable?: boolean;\n children?: RouterProps[];\n}\nexport const lazyImport = (filePath: string): React.LazyExoticComponent<React.ComponentType> => {\n return lazy(\n () =>\n import(\n /* webpackChunkName: \"[request]\" */\n '@/pages/' + filePath.replace(/^\\//, '')\n )\n );\n};\n\nexport const myPkgs: RouterProps[] = [];\nif (APPTYPE === 'library') {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n // const Readme = require('@moneko/core/lib/components/readme').default;\n const models = require.context('@pkg/', true, /README\\.mdx?$/, 'lazy');\n\n models.keys().map((item: string) => {\n const key = item.substring(2).split('/').slice(0, -1).join('/');\n\n console.log(item);\n myPkgs.push({\n key: key,\n path: key,\n element: createElement(\n lazy(\n () =>\n import(\n /* webpackChunkName: \"[request]\" */\n '@pkg/' + key + '/' + 'README.mdx'\n )\n )\n ),\n });\n });\n}\n\nlet list: RouterProps[] = [];\n\ntry {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n list = require('@/router').default;\n} catch (error) {\n // eslint-disable-next-line no-console\n console.info('自定义路由请在 router 目录下新建 index.ts, 类型: RouterProps[]');\n}\n\nconst predixKey = (path?: string, prev?: string) =>\n // eslint-disable-next-line no-undefined\n [prev === '*' && path !== '*' ? undefined : prev, path].filter(Boolean).join('/');\n\nconst models = require.context('@/pages/', true, /\\.(t|j)sx$/, 'lazy');\n\nconst pathToTree = (input: string[]) => {\n const root: RouterProps[] = [];\n\n for (let i = 0; i < input.length; i++) {\n const chain = input[i].split('/').slice(0, -1);\n let curr = root;\n\n for (let j = 0; j < chain.length; j++) {\n let pathRule = chain[j];\n\n if (pathRule === '') continue;\n if (pathRule === '.') pathRule = '*';\n const lastHierarchy = curr;\n\n // 遍历root是否已有该层级\n if (Array.isArray(curr)) {\n for (let k = 0; k < curr.length; k++) {\n if (curr[k].path === pathRule) {\n curr = curr[k].children as RouterProps[];\n break;\n }\n }\n }\n\n if (lastHierarchy === curr) {\n let key: string = j === chain.length - 1 ? input[i] : chain.slice(0, j + 1).join('/') + '/';\n\n // 截取最后一个 / 前面的数据\n key = key.substring(2, key.lastIndexOf('/'));\n\n const node: RouterProps = {\n key: key,\n path: pathRule,\n i18n: 'route-' + key,\n children: [],\n alive: false,\n element: createElement(lazyImport(key.replace(/:/g, '$'))),\n hideMenu: key.includes(':'),\n };\n\n // 文件,最后一个字符不是\"/“符号\n // if (j === chain.length - 1) delete node.children;\n if (Array.isArray(curr)) curr.push(node);\n curr = node.children as RouterProps[];\n }\n }\n }\n\n return root;\n};\nconst routers: RouterProps[] = pathToTree(\n models.keys().map((item: string) => item.replace(/\\$/g, ':'))\n);\n\nfunction merge(source: RouterProps[], child: RouterProps, prev?: string) {\n const _ = source.find((item) => item.path === child.path);\n\n if (!_) {\n source.push(child);\n } else {\n // 处理key\n _.key = predixKey(_.path, prev);\n if (typeof _.i18n === 'undefined') {\n _.i18n = 'route-' + _.key;\n }\n if (typeof _.alive === 'undefined') {\n _.alive = false;\n }\n if (typeof _.element === 'undefined' && child.element) {\n _.element = child.element;\n }\n if (typeof _.hideMenu === 'undefined') {\n _.hideMenu = _.path === '*' ? true : _.key.includes(':');\n }\n\n Object.assign(_, {\n ...child,\n ..._,\n });\n if (child.children) {\n if (!_.children && Array.isArray(child.children)) {\n _.children = child.children;\n }\n child.children?.forEach((childData) => {\n merge(_?.children as RouterProps[], childData, _?.key);\n });\n }\n }\n}\nconst findLogin = (rs: RouterProps[] = [], onlyLogin: boolean, prevKey?: string): RouterProps[] => {\n return rs\n .map((e) => {\n const _ = { ...e };\n\n if (typeof _.key === 'undefined') {\n _.key = predixKey(e.path, prevKey);\n }\n if (typeof _.i18n === 'undefined') {\n _.i18n = 'route-' + _.key;\n }\n if (typeof _.alive === 'undefined') {\n _.alive = false;\n }\n if (_.path === '*' && typeof _.hideMenu === 'undefined') {\n _.hideMenu = true;\n }\n if (Array.isArray(_.children)) {\n // eslint-disable-next-line no-undefined\n _.children = _.children.length ? findLogin(_.children, onlyLogin, _.key) : undefined;\n }\n if (!_.element) {\n _.element = createElement(lazyImport(_.key.replace(/:/g, '$')));\n }\n return !!_.onlyLogin === onlyLogin && !_.root ? null : _;\n })\n .filter(Boolean) as RouterProps[];\n};\nconst _router: RouterProps[] = [...list];\n\nrouters.forEach((item: RouterProps) => merge(_router, item));\n\n/* 登录前注册的路由 */\nexport const onlyLoginRouter = findLogin(_router, false);\n/* 登录后注册的路由 */\nexport const router = findLogin(_router, true);\n\nexport const matchUtil = (pathname: string) => {\n let p: RouterProps = { key: '' };\n const findPath = (rs: RouterProps[]): void => {\n rs.forEach((item) => {\n if (item.path && item.path !== '*' && item.key) {\n try {\n if (pathToRegexp(item.key).exec(pathname.substring(1) as string)) {\n p = item;\n return;\n }\n // eslint-disable-next-line no-empty\n } catch (error) {}\n }\n if (Array.isArray(item.children)) findPath(item.children);\n });\n };\n\n findPath(router);\n return p;\n};\n"],"names":["pathToRegexp","createElement","lazy","lazyImport","filePath","replace","myPkgs","APPTYPE","models","require","context","keys","map","item","key","substring","split","slice","join","console","log","push","path","element","list","default","error","info","predixKey","prev","undefined","filter","Boolean","pathToTree","input","root","i","length","chain","curr","j","pathRule","lastHierarchy","Array","isArray","k","children","lastIndexOf","node","i18n","alive","hideMenu","includes","routers","merge","source","child","_","find","Object","assign","forEach","childData","findLogin","rs","onlyLogin","prevKey","e","_router","onlyLoginRouter","router","matchUtil","pathname","p","findPath","exec"],"mappings":"AAAA,wpDAAA,OAASA,YAAY,KAAQ,gBAAiB,AAC9C,QAASC,aAAa,CAAEC,IAAI,KAA2C,OAAQ,AAoB/E,QAAO,IAAMC,WAAa,SAACC,SAAqE,CAC9F,OAAOF,KACL,kBACE,MAAM,CAEJ,WAAaE,SAASC,OAAO,CAAC,MAAO,MAG7C,CAAE,AAEF,QAAO,IAAMC,OAAwB,EAAE,AAAC,CACxC,GAAIC,UAAY,UAAW,CAGzB,IAAMC,OAASC,QAAQC,OAAO,CAAC,QAAS,IAAI,CAAE,gBAAiB,QAE/DF,OAAOG,IAAI,GAAGC,GAAG,CAAC,SAACC,KAAiB,CAClC,IAAMC,IAAMD,KAAKE,SAAS,CAAC,GAAGC,KAAK,CAAC,KAAKC,KAAK,CAAC,EAAG,CAAC,GAAGC,IAAI,CAAC,KAE3DC,QAAQC,GAAG,CAACP,MACZP,OAAOe,IAAI,CAAC,CACVP,IAAKA,IACLQ,KAAMR,IACNS,QAAStB,cACPC,KACE,kBACE,MAAM,CAEJ,QAAUY,IAAM,IAAM,gBAIhC,EACF,EACF,CAAC,AAED,IAAIU,KAAsB,EAAE,CAE5B,GAAI,CAEFA,KAAOf,QAAQ,YAAYgB,OAAO,AACpC,CAAE,MAAOC,MAAO,CAEdP,QAAQQ,IAAI,CAAC,mDACf,CAEA,IAAMC,UAAY,SAACN,KAAeO,YAEhC,CAACA,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C,CAACoD,EAAEQ,SAAS,GAAKA,WAAa,CAACR,EAAEtB,IAAI,CAAG,IAAI,CAAGsB,CAAC,AAC1D,GACC1B,MAAM,CAACC,QACZ,EACA,IAAMoC,QAA0B,mBAAG5C,MAEnC6B,QAAQQ,OAAO,CAAC,SAAChD,aAAsByC,MAAMc,QAASvD,OAGtD,QAAO,IAAMwD,gBAAkBN,UAAUK,QAAS,KAAK,CAAE,AAEzD,QAAO,IAAME,OAASP,UAAUK,QAAS,IAAI,CAAE,AAE/C,QAAO,IAAMG,UAAY,SAACC,SAAqB,CAC7C,IAAIC,EAAiB,CAAE3D,IAAK,EAAG,EAC/B,IAAM4D,SAAW,SAACV,GAA4B,CAC5CA,GAAGH,OAAO,CAAC,SAAChD,KAAS,CACnB,GAAIA,KAAKS,IAAI,EAAIT,KAAKS,IAAI,GAAK,KAAOT,KAAKC,GAAG,CAAE,CAC9C,GAAI,CACF,GAAId,aAAaa,KAAKC,GAAG,EAAE6D,IAAI,CAACH,SAASzD,SAAS,CAAC,IAAe,CAChE0D,EAAI5D,KACJ,MACF,CAAC,AAEH,CAAE,MAAOa,MAAO,CAAC,CACnB,CAAC,AACD,GAAIiB,MAAMC,OAAO,CAAC/B,KAAKiC,QAAQ,EAAG4B,SAAS7D,KAAKiC,QAAQ,CAAE,AAC5D,EACF,EAEA4B,SAASJ,QACT,OAAOG,CACT,CAAE"}
|
|
1
|
+
{"version":3,"sources":["../../src/router/index.ts"],"sourcesContent":["// import * as React from 'react';\n// import { lazyImport } from '../utils/lazy-import';\n// import { pathToRegexp } from 'path-to-regexp';\n// import type { ReactNode } from 'react';\n// import type { RouteObject } from 'react-router-dom';\n// import type { KeepAliveProps } from 'react-activation';\n\n// export interface RouterProps extends Omit<RouteObject, 'index' | 'children'> {\n// key: string;\n// alive?: KeepAliveProps | boolean;\n// icon?: ReactNode;\n// dynamicTitle?: string;\n// i18n?: string | null;\n// hideMenu?: boolean;\n// hideTabs?: boolean;\n// onlyLogin?: boolean;\n// root?: boolean;\n// path?: string;\n// element?: ReactNode;\n// /** 可否关闭标签 */\n// closable?: boolean;\n// children?: RouterProps[];\n// }\n\n// export const myPkgs: RouterProps[] = [];\n// if (APPTYPE === 'library') {\n// // eslint-disable-next-line @typescript-eslint/no-var-requires\n// const Readme = require('../components/readme').default;\n// const models = require.context('@pkg/', true, /README\\.mdx?$/);\n\n// models.keys().map((item: string) => {\n// const key = item.substring(2).split('/').slice(0, -1).join('/');\n\n// myPkgs.push({\n// key: key,\n// path: key,\n// element: React.createElement(Readme),\n// });\n// });\n// }\n\n// let list: RouterProps[] = [];\n\n// try {\n// // eslint-disable-next-line @typescript-eslint/no-var-requires\n// list = require('@/router').default;\n// } catch (error) {\n// // eslint-disable-next-line no-console\n// console.info('自定义路由请在 router 目录下新建 index.ts, 类型: RouterProps[]');\n// }\n\n// const predixKey = (path?: string, prev?: string) =>\n// // eslint-disable-next-line no-undefined\n// [prev === '*' && path !== '*' ? undefined : prev, path].filter(Boolean).join('/');\n\n// const models = require.context('@/pages/', true, /\\.(t|j)sx$/, 'lazy');\n\n// const pathToTree = (input: string[]) => {\n// const root: RouterProps[] = [];\n\n// for (let i = 0; i < input.length; i++) {\n// const chain = input[i].split('/').slice(0, -1);\n// let curr = root;\n\n// for (let j = 0; j < chain.length; j++) {\n// let pathRule = chain[j];\n\n// if (pathRule === '') continue;\n// if (pathRule === '.') pathRule = '*';\n// const lastHierarchy = curr;\n\n// // 遍历root是否已有该层级\n// if (Array.isArray(curr)) {\n// for (let k = 0; k < curr.length; k++) {\n// if (curr[k].path === pathRule) {\n// curr = curr[k].children as RouterProps[];\n// break;\n// }\n// }\n// }\n\n// if (lastHierarchy === curr) {\n// let key: string = j === chain.length - 1 ? input[i] : chain.slice(0, j + 1).join('/') + '/';\n\n// // 截取最后一个 / 前面的数据\n// key = key.substring(2, key.lastIndexOf('/'));\n\n// const node: RouterProps = {\n// key: key,\n// path: pathRule,\n// i18n: 'route-' + key,\n// children: [],\n// alive: false,\n// element: React.createElement(lazyImport(key.replace(/:/g, '$'))),\n// hideMenu: key.includes(':'),\n// };\n\n// // 文件,最后一个字符不是\"/“符号\n// // if (j === chain.length - 1) delete node.children;\n// if (Array.isArray(curr)) curr.push(node);\n// curr = node.children as RouterProps[];\n// }\n// }\n// }\n\n// return root;\n// };\n// const routers: RouterProps[] = pathToTree(\n// models.keys().map((item: string) => item.replace(/\\$/g, ':'))\n// );\n\n// function merge(source: RouterProps[], child: RouterProps, prev?: string) {\n// const _ = source.find((item) => item.path === child.path);\n\n// if (!_) {\n// source.push(child);\n// } else {\n// // 处理key\n// _.key = predixKey(_.path, prev);\n// if (typeof _.i18n === 'undefined') {\n// _.i18n = 'route-' + _.key;\n// }\n// if (typeof _.alive === 'undefined') {\n// _.alive = false;\n// }\n// if (typeof _.element === 'undefined' && child.element) {\n// _.element = child.element;\n// }\n// if (typeof _.hideMenu === 'undefined') {\n// _.hideMenu = _.path === '*' ? true : _.key.includes(':');\n// }\n\n// Object.assign(_, {\n// ...child,\n// ..._,\n// });\n// if (child.children) {\n// if (!_.children && Array.isArray(child.children)) {\n// _.children = child.children;\n// }\n// child.children?.forEach((childData) => {\n// merge(_?.children as RouterProps[], childData, _?.key);\n// });\n// }\n// }\n// }\n// const findLogin = (rs: RouterProps[] = [], onlyLogin: boolean, prevKey?: string): RouterProps[] => {\n// return rs\n// .map((e) => {\n// const _ = { ...e };\n\n// if (typeof _.key === 'undefined') {\n// _.key = predixKey(e.path, prevKey);\n// }\n// if (typeof _.i18n === 'undefined') {\n// _.i18n = 'route-' + _.key;\n// }\n// if (typeof _.alive === 'undefined') {\n// _.alive = false;\n// }\n// if (_.path === '*' && typeof _.hideMenu === 'undefined') {\n// _.hideMenu = true;\n// }\n// if (Array.isArray(_.children)) {\n// // eslint-disable-next-line no-undefined\n// _.children = _.children.length ? findLogin(_.children, onlyLogin, _.key) : undefined;\n// }\n// if (!_.element) {\n// _.element = React.createElement(lazyImport(_.key.replace(/:/g, '$')));\n// }\n// return !!_.onlyLogin === onlyLogin && !_.root ? null : _;\n// })\n// .filter(Boolean) as RouterProps[];\n// };\n// const _router: RouterProps[] = [...list];\n\n// routers.forEach((item: RouterProps) => merge(_router, item));\n\n// /* 登录前注册的路由 */\n// export const onlyLoginRouter = findLogin(_router, false);\n// /* 登录后注册的路由 */\n// export const router = findLogin(_router, true);\n\n// export const matchUtil = (pathname: string) => {\n// let p: RouterProps = { key: '' };\n// const findPath = (rs: RouterProps[]): void => {\n// rs.forEach((item) => {\n// if (item.path && item.path !== '*' && item.key) {\n// try {\n// if (pathToRegexp(item.key).exec(pathname.substring(1) as string)) {\n// p = item;\n// return;\n// }\n// // eslint-disable-next-line no-empty\n// } catch (error) {}\n// }\n// if (Array.isArray(item.children)) findPath(item.children);\n// });\n// };\n\n// findPath(router);\n// return p;\n// };\n\nimport { pathToRegexp } from 'path-to-regexp';\nimport { createElement, type ReactElement } from 'react';\nimport { lazyImport } from '../utils/lazy-import';\n\nexport interface RouterProps {\n key: string;\n alive?: boolean;\n icon?: ReactElement;\n dynamicTitle?: string;\n i18n?: string | null;\n hideMenu?: boolean;\n hideTabs?: boolean;\n onlyLogin?: boolean;\n root?: boolean;\n path?: string;\n element?: ReactElement;\n fallback?: ReactElement;\n /** 可否关闭标签 */\n closable?: boolean;\n children?: RouterProps[];\n}\n// export const lazyImport = (filePath: string) => {\n// return lazy(\n// () =>\n// import(\n// /* webpackChunkName: \"[request]\" */\n// '@/pages/' + filePath.replace(/^\\//, '')\n// )\n// );\n// };\n\nexport const myPkgs: RouterProps[] = [];\nif (APPTYPE === 'library') {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const Readme = require('@moneko/core/lib/components/readme').default;\n const models = require.context('@pkg/', true, /README\\.mdx?$/, 'lazy');\n\n models.keys().map((item: string) => {\n const key = item.substring(2).split('/').slice(0, -1).join('/');\n\n myPkgs.push({\n key: key,\n path: key,\n element: createElement(Readme),\n // element: createElement(\n // lazy(\n // () =>\n // import(\n // /* webpackChunkName: \"[request]\" */\n // '@pkg/' + key + '/' + 'README.mdx'\n // )\n // )\n // ),\n });\n });\n}\n\nlet list: RouterProps[] = [];\n\ntry {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n list = require('@/router').default;\n} catch (error) {\n // eslint-disable-next-line no-console\n console.info('自定义路由请在 router 目录下新建 index.ts, 类型: RouterProps[]');\n}\n\nconst predixKey = (path?: string, prev?: string) =>\n // eslint-disable-next-line no-undefined\n [prev === '*' && path !== '*' ? undefined : prev, path].filter(Boolean).join('/');\n\nconst models = require.context('@/pages/', true, /\\.(t|j)sx$/, 'lazy');\n\nconst pathToTree = (input: string[]) => {\n const root: RouterProps[] = [];\n\n for (let i = 0; i < input.length; i++) {\n const chain = input[i].split('/').slice(0, -1);\n let curr = root;\n\n for (let j = 0; j < chain.length; j++) {\n let pathRule = chain[j];\n\n if (pathRule === '') continue;\n if (pathRule === '.') pathRule = '*';\n const lastHierarchy = curr;\n\n // 遍历root是否已有该层级\n if (Array.isArray(curr)) {\n for (let k = 0; k < curr.length; k++) {\n if (curr[k].path === pathRule) {\n curr = curr[k].children as RouterProps[];\n break;\n }\n }\n }\n\n if (lastHierarchy === curr) {\n let key: string = j === chain.length - 1 ? input[i] : chain.slice(0, j + 1).join('/') + '/';\n\n // 截取最后一个 / 前面的数据\n key = key.substring(2, key.lastIndexOf('/'));\n\n const node: RouterProps = {\n key: key,\n path: pathRule,\n i18n: 'route-' + key,\n children: [],\n alive: false,\n element: createElement(lazyImport(key.replace(/:/g, '$'))),\n hideMenu: key.includes(':'),\n };\n\n // 文件,最后一个字符不是\"/“符号\n // if (j === chain.length - 1) delete node.children;\n if (Array.isArray(curr)) curr.push(node);\n curr = node.children as RouterProps[];\n }\n }\n }\n\n return root;\n};\nconst routers: RouterProps[] = pathToTree(\n models.keys().map((item: string) => item.replace(/\\$/g, ':'))\n);\n\nfunction merge(source: RouterProps[], child: RouterProps, prev?: string) {\n const _ = source.find((item) => item.path === child.path);\n\n if (!_) {\n source.push(child);\n } else {\n // 处理key\n _.key = predixKey(_.path, prev);\n if (typeof _.i18n === 'undefined') {\n _.i18n = 'route-' + _.key;\n }\n if (typeof _.alive === 'undefined') {\n _.alive = false;\n }\n if (typeof _.element === 'undefined' && child.element) {\n _.element = child.element;\n }\n if (typeof _.hideMenu === 'undefined') {\n _.hideMenu = _.path === '*' ? true : _.key.includes(':');\n }\n\n Object.assign(_, {\n ...child,\n ..._,\n });\n if (child.children) {\n if (!_.children && Array.isArray(child.children)) {\n _.children = child.children;\n }\n child.children?.forEach((childData) => {\n merge(_?.children as RouterProps[], childData, _?.key);\n });\n }\n }\n}\nconst findLogin = (rs: RouterProps[] = [], onlyLogin: boolean, prevKey?: string): RouterProps[] => {\n return rs\n .map((e) => {\n const _ = { ...e };\n\n if (typeof _.key === 'undefined') {\n _.key = predixKey(e.path, prevKey);\n }\n if (typeof _.i18n === 'undefined') {\n _.i18n = 'route-' + _.key;\n }\n if (typeof _.alive === 'undefined') {\n _.alive = false;\n }\n if (_.path === '*' && typeof _.hideMenu === 'undefined') {\n _.hideMenu = true;\n }\n if (Array.isArray(_.children)) {\n // eslint-disable-next-line no-undefined\n _.children = _.children.length ? findLogin(_.children, onlyLogin, _.key) : undefined;\n }\n if (!_.element) {\n _.element = createElement(lazyImport(_.key.replace(/:/g, '$')));\n }\n return !!_.onlyLogin === onlyLogin && !_.root ? null : _;\n })\n .filter(Boolean) as RouterProps[];\n};\nconst _router: RouterProps[] = [...list];\n\nrouters.forEach((item: RouterProps) => merge(_router, item));\n\n/* 登录前注册的路由 */\nexport const onlyLoginRouter = findLogin(_router, false);\n/* 登录后注册的路由 */\nexport const router = findLogin(_router, true);\n\nexport const matchUtil = (pathname: string) => {\n let p: RouterProps = { key: '' };\n const findPath = (rs: RouterProps[]): void => {\n rs.forEach((item) => {\n if (item.path && item.path !== '*' && item.key) {\n try {\n if (pathToRegexp(item.key).exec(pathname.substring(1) as string)) {\n p = item;\n return;\n }\n // eslint-disable-next-line no-empty\n } catch (error) {}\n }\n if (Array.isArray(item.children)) findPath(item.children);\n });\n };\n\n findPath(router);\n return p;\n};\n"],"names":["pathToRegexp","createElement","lazyImport","myPkgs","APPTYPE","Readme","require","default","models","context","keys","map","item","key","substring","split","slice","join","push","path","element","list","error","console","info","predixKey","prev","undefined","filter","Boolean","pathToTree","input","root","i","length","chain","curr","j","pathRule","lastHierarchy","Array","isArray","k","children","lastIndexOf","node","i18n","alive","replace","hideMenu","includes","routers","merge","source","child","_","find","Object","assign","forEach","childData","findLogin","rs","onlyLogin","prevKey","e","_router","onlyLoginRouter","router","matchUtil","pathname","p","findPath","exec"],"mappings":"AA4MA,wpDAAA,OAASA,YAAY,KAAQ,gBAAiB,AAC9C,QAASC,aAAa,KAA2B,OAAQ,AACzD,QAASC,UAAU,KAAQ,sBAAuB,AA6BlD,QAAO,IAAMC,OAAwB,EAAE,AAAC,CACxC,GAAIC,UAAY,UAAW,CAEzB,IAAMC,OAASC,QAAQ,sCAAsCC,OAAO,CACpE,IAAMC,OAASF,QAAQG,OAAO,CAAC,QAAS,IAAI,CAAE,gBAAiB,QAE/DD,OAAOE,IAAI,GAAGC,GAAG,CAAC,SAACC,KAAiB,CAClC,IAAMC,IAAMD,KAAKE,SAAS,CAAC,GAAGC,KAAK,CAAC,KAAKC,KAAK,CAAC,EAAG,CAAC,GAAGC,IAAI,CAAC,KAE3Dd,OAAOe,IAAI,CAAC,CACVL,IAAKA,IACLM,KAAMN,IACNO,QAASnB,cAAcI,OAUzB,EACF,EACF,CAAC,AAED,IAAIgB,KAAsB,EAAE,CAE5B,GAAI,CAEFA,KAAOf,QAAQ,YAAYC,OAAO,AACpC,CAAE,MAAOe,MAAO,CAEdC,QAAQC,IAAI,CAAC,mDACf,CAEA,IAAMC,UAAY,SAACN,KAAeO,YAEhC,CAACA,OAAS,KAAOP,OAAS,IAAMQ,UAAYD,IAAI,CAAEP,KAAK,CAACS,MAAM,CAACC,SAASZ,IAAI,CAAC,MAE/E,IAAMT,QAASF,QAAQG,OAA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ACA,IAAMqC,QAA0B,mBAAG7C,MAEnC8B,QAAQQ,OAAO,CAAC,SAAC/C,aAAsBwC,MAAMc,QAAStD,OAGtD,QAAO,IAAMuD,gBAAkBN,UAAUK,QAAS,KAAK,CAAE,AAEzD,QAAO,IAAME,OAASP,UAAUK,QAAS,IAAI,CAAE,AAE/C,QAAO,IAAMG,UAAY,SAACC,SAAqB,CAC7C,IAAIC,EAAiB,CAAE1D,IAAK,EAAG,EAC/B,IAAM2D,SAAW,SAACV,GAA4B,CAC5CA,GAAGH,OAAO,CAAC,SAAC/C,KAAS,CACnB,GAAIA,KAAKO,IAAI,EAAIP,KAAKO,IAAI,GAAK,KAAOP,KAAKC,GAAG,CAAE,CAC9C,GAAI,CACF,GAAIb,aAAaY,KAAKC,GAAG,EAAE4D,IAAI,CAACH,SAASxD,SAAS,CAAC,IAAe,CAChEyD,EAAI3D,KACJ,MACF,CAAC,AAEH,CAAE,MAAOU,MAAO,CAAC,CACnB,CAAC,AACD,GAAIkB,MAAMC,OAAO,CAAC7B,KAAK+B,QAAQ,EAAG6B,SAAS5D,KAAK+B,QAAQ,CAAE,AAC5D,EACF,EAEA6B,SAASJ,QACT,OAAOG,CACT,CAAE"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
@keyframes avatar-in {
|
|
2
|
+
0% {
|
|
3
|
+
transform: scale(30);
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
20% {
|
|
7
|
+
transform: scale(30);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
100% {
|
|
11
|
+
transform: scale(1);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@keyframes route-in {
|
|
16
|
+
from {
|
|
17
|
+
transform: translate3d(0, 16px, 0);
|
|
18
|
+
opacity: 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
to {
|
|
22
|
+
transform: translate3d(0, 0, 0);
|
|
23
|
+
opacity: 1;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@keyframes route-out {
|
|
28
|
+
from {
|
|
29
|
+
transform: translate3d(0, 0, 0);
|
|
30
|
+
opacity: 1;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
to {
|
|
34
|
+
z-index: -1;
|
|
35
|
+
transform: translate3d(0, 1rem, 0);
|
|
36
|
+
opacity: 0;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@keyframes fade-in {
|
|
41
|
+
from {
|
|
42
|
+
opacity: 0;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
to {
|
|
46
|
+
opacity: 1;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@keyframes fade-out {
|
|
51
|
+
from {
|
|
52
|
+
opacity: 1;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
to {
|
|
56
|
+
opacity: 0;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
html,
|
|
2
|
+
body {
|
|
3
|
+
width: 100vw;
|
|
4
|
+
height: 100vh;
|
|
5
|
+
padding: 0;
|
|
6
|
+
overflow: hidden;
|
|
7
|
+
margin: 0;
|
|
8
|
+
color: var(--text-color);
|
|
9
|
+
font-size: var(--font-size-base);
|
|
10
|
+
font-family: var(--font-family);
|
|
11
|
+
line-height: 1.8;
|
|
12
|
+
background-color: var(--body-background);
|
|
13
|
+
transition-duration: var(--transition-duration);
|
|
14
|
+
transition-property: background-color, color;
|
|
15
|
+
transition-timing-function: var(--transition-timing-function);
|
|
16
|
+
/* stylelint-disable-next-line property-no-vendor-prefix */
|
|
17
|
+
-webkit-text-size-adjust: 100%;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
#root {
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
width: 100%;
|
|
24
|
+
height: 100%;
|
|
25
|
+
-webkit-overflow-scrolling: touch;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
main {
|
|
29
|
+
display: block;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
#root > main {
|
|
33
|
+
flex: 1;
|
|
34
|
+
width: 100%;
|
|
35
|
+
overflow-y: auto;
|
|
36
|
+
animation: route-in var(--transition-duration);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
input,
|
|
40
|
+
textarea {
|
|
41
|
+
caret-color: plum;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
:-webkit-autofill,
|
|
45
|
+
:-webkit-autofill:hover,
|
|
46
|
+
:-webkit-autofill:focus {
|
|
47
|
+
font-weight: 400;
|
|
48
|
+
border: none;
|
|
49
|
+
border-radius: 5px;
|
|
50
|
+
box-shadow: 0 0 0 1000px transparent inset;
|
|
51
|
+
transition: background-color var(--transition-duration) var(--transition-timing-function);
|
|
52
|
+
-webkit-text-fill-color: var(--text-color);
|
|
53
|
+
caret-color: transparent;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
::-webkit-scrollbar {
|
|
57
|
+
width: 5px;
|
|
58
|
+
height: 5px;
|
|
59
|
+
opacity: 0;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
::-webkit-scrollbar-track {
|
|
63
|
+
background-color: transparent;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
::-webkit-scrollbar-thumb {
|
|
67
|
+
background-color: transparent;
|
|
68
|
+
border-radius: 5px;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
:hover::-webkit-scrollbar-thumb {
|
|
72
|
+
background-color: rgba(78, 78, 78, 0.15);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
::-webkit-scrollbar-thumb:hover {
|
|
76
|
+
background-color: rgba(176, 139, 227, 0.5);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
::-webkit-scrollbar-thumb:active {
|
|
80
|
+
background-color: rgba(247, 138, 224, 0.5);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
::-webkit-scrollbar-button {
|
|
84
|
+
display: none;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.text-ellipsis,
|
|
88
|
+
.text-ellipsis-2 {
|
|
89
|
+
overflow: hidden;
|
|
90
|
+
text-overflow: ellipsis;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.text-ellipsis {
|
|
94
|
+
white-space: nowrap;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.text-ellipsis-2 {
|
|
98
|
+
/* stylelint-disable-next-line value-no-vendor-prefix */
|
|
99
|
+
display: -webkit-box;
|
|
100
|
+
-webkit-line-clamp: 2;
|
|
101
|
+
/*! autoprefixer: off */
|
|
102
|
+
-webkit-box-orient: vertical;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.df {
|
|
106
|
+
display: flex;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.fd-row {
|
|
110
|
+
flex-direction: row;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.f-a-c {
|
|
114
|
+
align-items: center;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.mr5 {
|
|
118
|
+
margin-right: 5px;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.pos-r-0 {
|
|
122
|
+
position: absolute;
|
|
123
|
+
right: 0;
|
|
124
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
h1 {
|
|
2
|
+
font-size: 2em;
|
|
3
|
+
margin: 0.67em 0;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
hr {
|
|
7
|
+
box-sizing: content-box;
|
|
8
|
+
height: 0;
|
|
9
|
+
overflow: visible;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
pre {
|
|
13
|
+
font-family: monospace;
|
|
14
|
+
font-size: 1em;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
a {
|
|
18
|
+
background-color: transparent;
|
|
19
|
+
text-decoration: none;
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
abbr[title] {
|
|
24
|
+
border-bottom: none;
|
|
25
|
+
text-decoration: underline;
|
|
26
|
+
text-decoration: underline dotted;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
b,
|
|
30
|
+
strong {
|
|
31
|
+
font-weight: bolder;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
code,
|
|
35
|
+
kbd,
|
|
36
|
+
samp {
|
|
37
|
+
font-family: monospace;
|
|
38
|
+
font-size: 1em;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
small {
|
|
42
|
+
font-size: 80%;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
sub,
|
|
46
|
+
sup {
|
|
47
|
+
font-size: 75%;
|
|
48
|
+
line-height: 0;
|
|
49
|
+
position: relative;
|
|
50
|
+
vertical-align: baseline;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
sub {
|
|
54
|
+
bottom: -0.25em;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
sup {
|
|
58
|
+
top: -0.5em;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
img {
|
|
62
|
+
border-style: none;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
img,
|
|
66
|
+
button {
|
|
67
|
+
/* 消除锯齿 */
|
|
68
|
+
outline: 1px solid transparent;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
button,
|
|
72
|
+
input,
|
|
73
|
+
optgroup,
|
|
74
|
+
select,
|
|
75
|
+
textarea {
|
|
76
|
+
font-family: inherit;
|
|
77
|
+
font-size: 100%;
|
|
78
|
+
line-height: 1.15;
|
|
79
|
+
margin: 0;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
button,
|
|
83
|
+
input {
|
|
84
|
+
overflow: visible;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
button,
|
|
88
|
+
select {
|
|
89
|
+
text-transform: none;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
button,
|
|
93
|
+
[type='button'],
|
|
94
|
+
[type='reset'],
|
|
95
|
+
[type='submit'] {
|
|
96
|
+
appearance: button;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
button::-moz-focus-inner,
|
|
100
|
+
[type='button']::-moz-focus-inner,
|
|
101
|
+
[type='reset']::-moz-focus-inner,
|
|
102
|
+
[type='submit']::-moz-focus-inner {
|
|
103
|
+
border-style: none;
|
|
104
|
+
padding: 0;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
button:-moz-focusring,
|
|
108
|
+
[type='button']:-moz-focusring,
|
|
109
|
+
[type='reset']:-moz-focusring,
|
|
110
|
+
[type='submit']:-moz-focusring {
|
|
111
|
+
outline: 1px dotted ButtonText;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
fieldset {
|
|
115
|
+
padding: 0.35em 0.75em 0.625em;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
legend {
|
|
119
|
+
box-sizing: border-box;
|
|
120
|
+
color: inherit;
|
|
121
|
+
display: table;
|
|
122
|
+
max-width: 100%;
|
|
123
|
+
padding: 0;
|
|
124
|
+
white-space: normal;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
progress {
|
|
128
|
+
vertical-align: baseline;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
textarea {
|
|
132
|
+
overflow: auto;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
[type='checkbox'],
|
|
136
|
+
[type='radio'] {
|
|
137
|
+
box-sizing: border-box;
|
|
138
|
+
padding: 0;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
[type='number']::-webkit-inner-spin-button,
|
|
142
|
+
[type='number']::-webkit-outer-spin-button {
|
|
143
|
+
height: auto;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
[type='search'] {
|
|
147
|
+
appearance: textfield;
|
|
148
|
+
outline-offset: -2px;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
[type='search']::-webkit-search-decoration {
|
|
152
|
+
appearance: none;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
::-webkit-file-upload-button {
|
|
156
|
+
appearance: button;
|
|
157
|
+
font: inherit;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
details {
|
|
161
|
+
display: block;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
summary {
|
|
165
|
+
display: list-item;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
template {
|
|
169
|
+
display: none;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
[hidden] {
|
|
173
|
+
display: none;
|
|
174
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--text-shadow-color: rgba(0, 0, 0, 0.1);
|
|
3
|
+
--font-size-base: 14px;
|
|
4
|
+
--border-color-base: #d9d9d9;
|
|
5
|
+
--border-radius-base: 4px;
|
|
6
|
+
--body-background: #f8f8f8;
|
|
7
|
+
--component-background: #fff;
|
|
8
|
+
--table-header-bg: rgba(0, 0, 0, 0.02);
|
|
9
|
+
--text-color: rgba(0, 0, 0, 0.65);
|
|
10
|
+
--text-color-secondary: rgba(0, 0, 0, 0.45);
|
|
11
|
+
--heading-color: rgba(0, 0, 0, 0.85);
|
|
12
|
+
--text-selection-bg: var(--primary-color-deprecated-bg);
|
|
13
|
+
--box-shadow-small: 0 0 12px rgba(0, 0, 0, 0.1);
|
|
14
|
+
--box-shadow-base: 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 6px 16px 0 rgba(0, 0, 0, 0.08),
|
|
15
|
+
0 9px 28px 8px rgba(0, 0, 0, 0.05);
|
|
16
|
+
--font-family: -apple-system, 'BlinkMacSystemFont', 'Segoe UI', 'Roboto', 'Helvetica Neue', 'Arial',
|
|
17
|
+
'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
|
|
18
|
+
'Noto Color Emoji', 'Helvetica', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans';
|
|
19
|
+
--transition-duration: 0.3s;
|
|
20
|
+
--transition-timing-function: cubic-bezier(0.94, -0.1, 0.1, 1.2);
|
|
21
|
+
--antd-wave-shadow-color: var(--primary-color-outline);
|
|
22
|
+
--disable-color: rgba(0, 0, 0, 0.25);
|
|
23
|
+
--btn-disable-bg: var(--disable-color);
|
|
24
|
+
--btn-disable-border: var(--disable-color);
|
|
25
|
+
--menu-dark-item-active-bg: #0e3ab3;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
[data-theme='dark'] {
|
|
29
|
+
--text-selection-bg: var(--primary-color-deprecated-bg);
|
|
30
|
+
--text-color-secondary: rgba(255, 255, 255, 0.25);
|
|
31
|
+
--text-shadow-color: rgba(255, 255, 255, 0.1);
|
|
32
|
+
--header-shadow: rgba(255, 255, 255, 0.05);
|
|
33
|
+
--body-background: #000;
|
|
34
|
+
--component-background: #141414;
|
|
35
|
+
--header-bg: rgba(20, 20, 20, 0.9);
|
|
36
|
+
--text-color: #ffffffd9;
|
|
37
|
+
--border-color-base: #303030;
|
|
38
|
+
--heading-color: rgba(255, 255, 255, 0.85);
|
|
39
|
+
--disabled-color: rgba(255, 255, 255, 0.3);
|
|
40
|
+
}
|
package/lib/styles/vars.d.ts
CHANGED
|
@@ -13,5 +13,3 @@ export declare type ThemeColorOptions<T = 'light' | 'dark'> = {
|
|
|
13
13
|
};
|
|
14
14
|
export declare const setThemeColor: (options: ThemeColorOptions) => void;
|
|
15
15
|
export declare const rootVariables: string;
|
|
16
|
-
export declare const globalStyles = "\n html,\n body {\n width: 100vw;\n height: 100vh;\n padding: 0;\n overflow: hidden;\n margin: 0;\n color: var(--text-color);\n font-size: var(--font-size-base);\n font-family: var(--font-family);\n line-height: 1.8;\n background-color: var(--body-background);\n transition-duration: var(--transition-duration);\n transition-property: background-color, color;\n transition-timing-function: var(--transition-timing-function);\n -webkit-text-size-adjust: 100%;\n }\n main {\n display: block;\n }\n input,\n textarea {\n caret-color: plum;\n }\n\n :-webkit-autofill,\n :-webkit-autofill:hover,\n :-webkit-autofill:focus {\n font-weight: 400;\n border: none;\n border-radius: 5px;\n box-shadow: 0 0 0 1000px transparent inset;\n transition: background-color var(--transition-duration) var(--transition-timing-function);\n -webkit-text-fill-color: var(--text-color);\n caret-color: transparent;\n }\n\n ::-webkit-scrollbar {\n width: 5px;\n height: 5px;\n opacity: 0;\n }\n\n ::-webkit-scrollbar-track {\n background-color: transparent;\n }\n\n ::-webkit-scrollbar-thumb {\n background-color: transparent;\n border-radius: 5px;\n }\n\n :hover::-webkit-scrollbar-thumb {\n background-color: rgba(78, 78, 78, 0.15);\n }\n\n ::-webkit-scrollbar-thumb:hover {\n background-color: rgba(176, 139, 227, 0.5);\n }\n\n ::-webkit-scrollbar-thumb:active {\n background-color: rgba(247, 138, 224, 0.5);\n }\n\n ::-webkit-scrollbar-button {\n display: none;\n }\n\n .text-ellipsis,\n .text-ellipsis-2 {\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n .text-ellipsis {\n white-space: nowrap;\n }\n\n .text-ellipsis-2 {\n display: -webkit-box;\n -webkit-line-clamp: 2;\n /*! autoprefixer: off */\n -webkit-box-orient: vertical;\n }\n\n .flex {\n display: flex;\n }\n\n .f-row {\n flex-direction: row;\n }\n\n .f-a-c {\n align-items: center;\n }\n\n .mr5 {\n margin-right: 5px;\n }\n\n .pos-r-0 {\n position: absolute;\n right: 0;\n }\n\n .login-toolbox {\n height: 64px;\n\n button {\n margin-right: 16px;\n }\n }\n";
|
|
17
|
-
export declare const rootStyle: string;
|
package/lib/styles/vars.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))}ownKeys.forEach(function(key){_defineProperty(target,key,source[key])})}return target}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})}keys.push.apply(keys,symbols)}return keys}function _objectSpreadProps(target,source){source=source!=null?source:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}return target}import
|
|
1
|
+
function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))}ownKeys.forEach(function(key){_defineProperty(target,key,source[key])})}return target}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})}keys.push.apply(keys,symbols)}return keys}function _objectSpreadProps(target,source){source=source!=null?source:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source))}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}return target}import tinycolor from"tinycolor2";import colorPalette from"../utils/color-palette";export var menuDarkBg="#1C222E";export var getColorPalette=function(name,color){var type=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"light",bg=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"#fff";var vars={};if(type==="light"){var i=1;while(i<=7){vars["--".concat(name,"-").concat(i)]=colorPalette(color,i);i++}}else{var _obj;Object.assign(vars,(_obj={},_defineProperty(_obj,"--".concat(name,"-1"),tinycolor.mix(colorPalette(color,8),bg,.15)),_defineProperty(_obj,"--".concat(name,"-2"),tinycolor.mix(colorPalette(color,7),bg,.25)),_defineProperty(_obj,"--".concat(name,"-3"),tinycolor.mix(color,bg,.3)),_defineProperty(_obj,"--".concat(name,"-4"),tinycolor.mix(color,bg,.45)),_defineProperty(_obj,"--".concat(name,"-5"),tinycolor.mix(color,bg,.65)),_defineProperty(_obj,"--".concat(name,"-6"),color),_defineProperty(_obj,"--".concat(name,"-7"),tinycolor.mix(colorPalette(color,5),bg,.9)),_obj))}var _obj1;return _objectSpreadProps(_objectSpread({},vars),(_obj1={},_defineProperty(_obj1,"--".concat(name,"-color-deprecated-bg"),"var(--".concat(name,"-1)")),_defineProperty(_obj1,"--".concat(name,"-color-deprecated-border"),"var(--".concat(name,"-3)")),_defineProperty(_obj1,"--".concat(name,"-color-hover"),"var(--".concat(name,"-5)")),_defineProperty(_obj1,"--".concat(name,"-color"),color),_defineProperty(_obj1,"--".concat(name,"-color-outline"),tinycolor(color).setAlpha(.2).toRgbString()),_defineProperty(_obj1,"--".concat(name,"-color-active"),"var(--".concat(name,"-7)")),_obj1))};var keyword=["primary","warning","error","success"];export var setThemeColor=function(options){keyword.forEach(function(name){var color=options[name];if(color){var colors=getColorPalette(name,color,options.type,options.componentBackground);if(name==="primary"||name==="error"){Object.assign(colors,_defineProperty({},name==="primary"?"--menu-dark-item-active-bg":"--menu-dark-item-active-danger-bg",tinycolor.mix(colorPalette(color,8),menuDarkBg||"#141414",.15).toRgbString()))}for(var key in colors){if(Object.prototype.hasOwnProperty.call(colors,key)){var newColor=colors[key];if(getComputedStyle(document.documentElement).getPropertyValue(key)!==newColor){document.documentElement.style.setProperty(key,newColor)}}}}});if(options.tableHeaderBg){document.documentElement.style.setProperty("--table-header-bg",options.tableHeaderBg)}};var rootStatusColor=_objectSpread({},getColorPalette("normal","rgba(0, 0, 0, 0.85)","light","#fff"),getColorPalette("primary","#1890ff","light","#fff"),getColorPalette("success","#52c41a","light","#fff"),getColorPalette("warning","#faad14","light","#fff"),getColorPalette("error","#ff4d4f","light","#fff"));var rootStatusColorVariables="";Object.entries(rootStatusColor).forEach(function(e){rootStatusColorVariables+="".concat(e.join(": "),";\n")});var rootStatusColorDark=_objectSpread({},getColorPalette("normal","rgba(255, 255, 255, 0.85)","dark","#141414"),getColorPalette("primary","#177ddc","dark","#141414"),getColorPalette("success","#49aa19","dark","#141414"),getColorPalette("warning","#d89614","dark","#141414"),getColorPalette("error","#a61d24","dark","#141414"));var rootStatusColorDarkVariables="";Object.entries(rootStatusColorDark).forEach(function(e){rootStatusColorDarkVariables+="".concat(e.join(": "),";\n")});export var rootVariables="\n :root {\n ".concat(rootStatusColorVariables,"\n }\n [data-theme='dark'] {\n ").concat(rootStatusColorDarkVariables,"\n }\n");
|
|
2
2
|
//# sourceMappingURL=vars.js.map
|
package/lib/styles/vars.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/styles/vars.ts"],"sourcesContent":["import { routeInKeyframes } from './animation';\nimport tinycolor from 'tinycolor2';\nimport colorPalette from '../utils/color-palette';\n\nexport const menuDarkBg = '#1C222E';\nexport const getColorPalette = (\n name: string,\n color: string,\n type: 'light' | 'dark' = 'light',\n bg = '#fff'\n) => {\n const vars: Record<string, string> = {};\n\n if (type === 'light') {\n let i = 1;\n\n while (i <= 7) {\n vars[`--${name}-${i}`] = colorPalette(color, i);\n i++;\n }\n } else {\n Object.assign(vars, {\n [`--${name}-1`]: tinycolor.mix(colorPalette(color, 8), bg, 0.15),\n [`--${name}-2`]: tinycolor.mix(colorPalette(color, 7), bg, 0.25),\n [`--${name}-3`]: tinycolor.mix(color, bg, 0.3),\n [`--${name}-4`]: tinycolor.mix(color, bg, 0.45),\n [`--${name}-5`]: tinycolor.mix(color, bg, 0.65),\n [`--${name}-6`]: color,\n [`--${name}-7`]: tinycolor.mix(colorPalette(color, 5), bg, 0.9),\n });\n }\n\n return {\n ...vars,\n [`--${name}-color-deprecated-bg`]: `var(--${name}-1)`,\n [`--${name}-color-deprecated-border`]: `var(--${name}-3)`,\n [`--${name}-color-hover`]: `var(--${name}-5)`,\n [`--${name}-color`]: color,\n [`--${name}-color-outline`]: tinycolor(color).setAlpha(0.2).toRgbString(),\n [`--${name}-color-active`]: `var(--${name}-7)`,\n };\n};\n\nexport type ThemeColorOptions<T = 'light' | 'dark'> = {\n primary?: string;\n warning?: string;\n error?: string;\n success?: string;\n componentBackground?: string;\n tableHeaderBg?: string;\n type?: T;\n};\n\nconst keyword = ['primary', 'warning', 'error', 'success'];\n\nexport const setThemeColor = (options: ThemeColorOptions) => {\n keyword.forEach((name) => {\n const color = options[name as 'primary' | 'warning' | 'error' | 'success'];\n\n if (color) {\n const colors = getColorPalette(name, color, options.type, options.componentBackground);\n\n if (name === 'primary' || name === 'error') {\n Object.assign(colors, {\n [name === 'primary' ? '--menu-dark-item-active-bg' : '--menu-dark-item-active-danger-bg']:\n tinycolor.mix(colorPalette(color, 8), menuDarkBg || '#141414', 0.15).toRgbString(),\n });\n }\n for (const key in colors) {\n if (Object.prototype.hasOwnProperty.call(colors, key)) {\n const newColor = colors[key as keyof typeof colors];\n\n if (getComputedStyle(document.documentElement).getPropertyValue(key) !== newColor) {\n document.documentElement.style.setProperty(key, newColor);\n }\n }\n }\n }\n });\n if (options.tableHeaderBg) {\n document.documentElement.style.setProperty('--table-header-bg', options.tableHeaderBg);\n }\n};\n\nconst rootStatusColor = {\n ...getColorPalette('normal', 'rgba(0, 0, 0, 0.85)', 'light', '#fff'),\n ...getColorPalette('primary', '#1890ff', 'light', '#fff'),\n ...getColorPalette('success', '#52c41a', 'light', '#fff'),\n ...getColorPalette('warning', '#faad14', 'light', '#fff'),\n ...getColorPalette('error', '#ff4d4f', 'light', '#fff'),\n};\nlet rootStatusColorVariables = '';\n\nObject.entries(rootStatusColor).forEach((e) => {\n rootStatusColorVariables += `${e.join(': ')};\\n`;\n});\nconst rootStatusColorDark = {\n ...getColorPalette('normal', 'rgba(255, 255, 255, 0.85)', 'dark', '#141414'),\n ...getColorPalette('primary', '#177ddc', 'dark', '#141414'),\n ...getColorPalette('success', '#49aa19', 'dark', '#141414'),\n ...getColorPalette('warning', '#d89614', 'dark', '#141414'),\n ...getColorPalette('error', '#a61d24', 'dark', '#141414'),\n};\nlet rootStatusColorDarkVariables = '';\n\nObject.entries(rootStatusColorDark).forEach((e) => {\n rootStatusColorDarkVariables += `${e.join(': ')};\\n`;\n});\n\nexport const rootVariables = `\n :root {\n --text-shadow-color: rgba(0, 0, 0, 0.1);\n --font-size-base: 14px;\n --border-color-base: #d9d9d9;\n --border-radius-base: 4px;\n --body-background: #f8f8f8;\n --component-background: #fff;\n --table-header-bg: rgba(0, 0, 0, 0.02);\n --text-color: rgba(0, 0, 0, 0.65);\n --text-color-secondary: rgba(0, 0, 0, 0.45);\n --heading-color: rgba(0, 0, 0, 0.85);\n --text-selection-bg: var(--primary-color-deprecated-bg);\n --box-shadow-small: 0 0 12px rgba(0, 0, 0, 0.1);\n --box-shadow-base: 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 6px 16px 0 rgba(0, 0, 0, 0.08),\n 0 9px 28px 8px rgba(0, 0, 0, 0.05);\n --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,\n 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',\n 'Noto Color Emoji', 'Helvetica', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans';\n --transition-duration: 0.3s;\n --transition-timing-function: cubic-bezier(0.94, -0.1, 0.1, 1.2);\n --antd-wave-shadow-color: var(--primary-color-outline);\n --disable-color: rgba(0, 0, 0, 0.25);\n --btn-disable-bg: var(--disable-color);\n --btn-disable-border: var(--disable-color);\n --menu-dark-item-active-bg: #0e3ab3;\n ${rootStatusColorVariables}\n }\n [data-theme='dark'] {\n --text-selection-bg: var(--primary-color-deprecated-bg);\n --text-color-secondary: rgba(255, 255, 255, 0.25);\n --text-shadow-color: rgba(255, 255, 255, 0.1);\n --header-shadow: rgba(255, 255, 255, 0.05);\n --body-background: #000;\n --component-background: #141414;\n --header-bg: rgba(20, 20, 20, 0.9);\n --text-color: #ffffffd9;\n --border-color-base: #303030;\n --heading-color: rgba(255, 255, 255, 0.85);\n --disabled-color: rgba(255, 255, 255, 0.3);\n ${rootStatusColorDarkVariables}\n }\n`;\n\nexport const globalStyles = `\n html,\n body {\n width: 100vw;\n height: 100vh;\n padding: 0;\n overflow: hidden;\n margin: 0;\n color: var(--text-color);\n font-size: var(--font-size-base);\n font-family: var(--font-family);\n line-height: 1.8;\n background-color: var(--body-background);\n transition-duration: var(--transition-duration);\n transition-property: background-color, color;\n transition-timing-function: var(--transition-timing-function);\n -webkit-text-size-adjust: 100%;\n }\n main {\n display: block;\n }\n input,\n textarea {\n caret-color: plum;\n }\n\n :-webkit-autofill,\n :-webkit-autofill:hover,\n :-webkit-autofill:focus {\n font-weight: 400;\n border: none;\n border-radius: 5px;\n box-shadow: 0 0 0 1000px transparent inset;\n transition: background-color var(--transition-duration) var(--transition-timing-function);\n -webkit-text-fill-color: var(--text-color);\n caret-color: transparent;\n }\n\n ::-webkit-scrollbar {\n width: 5px;\n height: 5px;\n opacity: 0;\n }\n\n ::-webkit-scrollbar-track {\n background-color: transparent;\n }\n\n ::-webkit-scrollbar-thumb {\n background-color: transparent;\n border-radius: 5px;\n }\n\n :hover::-webkit-scrollbar-thumb {\n background-color: rgba(78, 78, 78, 0.15);\n }\n\n ::-webkit-scrollbar-thumb:hover {\n background-color: rgba(176, 139, 227, 0.5);\n }\n\n ::-webkit-scrollbar-thumb:active {\n background-color: rgba(247, 138, 224, 0.5);\n }\n\n ::-webkit-scrollbar-button {\n display: none;\n }\n\n .text-ellipsis,\n .text-ellipsis-2 {\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n .text-ellipsis {\n white-space: nowrap;\n }\n\n .text-ellipsis-2 {\n display: -webkit-box;\n -webkit-line-clamp: 2;\n /*! autoprefixer: off */\n -webkit-box-orient: vertical;\n }\n\n .flex {\n display: flex;\n }\n\n .f-row {\n flex-direction: row;\n }\n\n .f-a-c {\n align-items: center;\n }\n\n .mr5 {\n margin-right: 5px;\n }\n\n .pos-r-0 {\n position: absolute;\n right: 0;\n }\n\n .login-toolbox {\n height: 64px;\n\n button {\n margin-right: 16px;\n }\n }\n`;\nexport const rootStyle = `\n #root {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n -webkit-overflow-scrolling: touch;\n\n > main {\n display: block;\n flex: 1;\n width: 100%;\n overflow-y: auto;\n animation: ${routeInKeyframes} var(--transition-duration);\n }\n }\n`;\n"],"names":["routeInKeyframes","tinycolor","colorPalette","menuDarkBg","getColorPalette","name","color","type","bg","vars","i","Object","assign","mix","setAlpha","toRgbString","keyword","setThemeColor","options","forEach","colors","componentBackground","key","prototype","hasOwnProperty","call","newColor","getComputedStyle","document","documentElement","getPropertyValue","style","setProperty","tableHeaderBg","rootStatusColor","rootStatusColorVariables","entries","e","join","rootStatusColorDark","rootStatusColorDarkVariables","rootVariables","globalStyles","rootStyle"],"mappings":"AAAA,kuCAAA,OAASA,gBAAgB,KAAQ,aAAc,AAC/C,QAAOC,cAAe,YAAa,AACnC,QAAOC,iBAAkB,wBAAyB,AAElD,QAAO,IAAMC,WAAa,SAAU,AACpC,QAAO,IAAMC,gBAAkB,SAC7BC,KACAC,MAGG,KAFHC,4DAAyB,QACzBC,0DAAK,OAEL,IAAMC,KAA+B,CAAC,EAEtC,GAAIF,OAAS,QAAS,CACpB,IAAIG,EAAI,EAER,MAAOA,GAAK,EAA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EAAEC,IAAI,CAAC,MAAM,MAC9C,GACA,IAAMC,oBAAsB,iBACvBnC,gBAAgB,SAAU,4BAA6B,OAAQ,WAC/DA,gBAAgB,UAAW,UAAW,OAAQ,WAC9CA,gBAAgB,UAAW,UAAW,OAAQ,WAC9CA,gBAAgB,UAAW,UAAW,OAAQ,WAC9CA,gBAAgB,QAAS,UAAW,OAAQ,YAEjD,IAAIoC,6BAA+B,GAEnC7B,OAAOyB,OAAO,CAACG,qBAAqBpB,OAAO,CAAC,SAACkB,EAAM,CACjDG,8BAAgC,AAAC,GAAe,OAAbH,EAAEC,IAAI,CAAC,MAAM,MAClD,EAEA,QAAO,IAAMG,cAAgB,AAAC,gxCAwCxBD,OAdAL,yBAAyB,mhBAcI,OAA7BK,6BAA6B,UAEjC,AAEF,QAAO,IAAME,aAAgB,ypEAkH3B,AACF,QAAO,IAAMC,UAAY,AAAC,mQAaU,OAAjB3C,iBAAiB,6CAGlC"}
|
|
1
|
+
{"version":3,"sources":["../../src/styles/vars.ts"],"sourcesContent":["import tinycolor from 'tinycolor2';\nimport colorPalette from '../utils/color-palette';\n\nexport const menuDarkBg = '#1C222E';\nexport const getColorPalette = (\n name: string,\n color: string,\n type: 'light' | 'dark' = 'light',\n bg = '#fff'\n) => {\n const vars: Record<string, string> = {};\n\n if (type === 'light') {\n let i = 1;\n\n while (i <= 7) {\n vars[`--${name}-${i}`] = colorPalette(color, i);\n i++;\n }\n } else {\n Object.assign(vars, {\n [`--${name}-1`]: tinycolor.mix(colorPalette(color, 8), bg, 0.15),\n [`--${name}-2`]: tinycolor.mix(colorPalette(color, 7), bg, 0.25),\n [`--${name}-3`]: tinycolor.mix(color, bg, 0.3),\n [`--${name}-4`]: tinycolor.mix(color, bg, 0.45),\n [`--${name}-5`]: tinycolor.mix(color, bg, 0.65),\n [`--${name}-6`]: color,\n [`--${name}-7`]: tinycolor.mix(colorPalette(color, 5), bg, 0.9),\n });\n }\n\n return {\n ...vars,\n [`--${name}-color-deprecated-bg`]: `var(--${name}-1)`,\n [`--${name}-color-deprecated-border`]: `var(--${name}-3)`,\n [`--${name}-color-hover`]: `var(--${name}-5)`,\n [`--${name}-color`]: color,\n [`--${name}-color-outline`]: tinycolor(color).setAlpha(0.2).toRgbString(),\n [`--${name}-color-active`]: `var(--${name}-7)`,\n };\n};\n\nexport type ThemeColorOptions<T = 'light' | 'dark'> = {\n primary?: string;\n warning?: string;\n error?: string;\n success?: string;\n componentBackground?: string;\n tableHeaderBg?: string;\n type?: T;\n};\n\nconst keyword = ['primary', 'warning', 'error', 'success'];\n\nexport const setThemeColor = (options: ThemeColorOptions) => {\n keyword.forEach((name) => {\n const color = options[name as 'primary' | 'warning' | 'error' | 'success'];\n\n if (color) {\n const colors = getColorPalette(name, color, options.type, options.componentBackground);\n\n if (name === 'primary' || name === 'error') {\n Object.assign(colors, {\n [name === 'primary' ? '--menu-dark-item-active-bg' : '--menu-dark-item-active-danger-bg']:\n tinycolor.mix(colorPalette(color, 8), menuDarkBg || '#141414', 0.15).toRgbString(),\n });\n }\n for (const key in colors) {\n if (Object.prototype.hasOwnProperty.call(colors, key)) {\n const newColor = colors[key as keyof typeof colors];\n\n if (getComputedStyle(document.documentElement).getPropertyValue(key) !== newColor) {\n document.documentElement.style.setProperty(key, newColor);\n }\n }\n }\n }\n });\n if (options.tableHeaderBg) {\n document.documentElement.style.setProperty('--table-header-bg', options.tableHeaderBg);\n }\n};\n\nconst rootStatusColor = {\n ...getColorPalette('normal', 'rgba(0, 0, 0, 0.85)', 'light', '#fff'),\n ...getColorPalette('primary', '#1890ff', 'light', '#fff'),\n ...getColorPalette('success', '#52c41a', 'light', '#fff'),\n ...getColorPalette('warning', '#faad14', 'light', '#fff'),\n ...getColorPalette('error', '#ff4d4f', 'light', '#fff'),\n};\nlet rootStatusColorVariables = '';\n\nObject.entries(rootStatusColor).forEach((e) => {\n rootStatusColorVariables += `${e.join(': ')};\\n`;\n});\nconst rootStatusColorDark = {\n ...getColorPalette('normal', 'rgba(255, 255, 255, 0.85)', 'dark', '#141414'),\n ...getColorPalette('primary', '#177ddc', 'dark', '#141414'),\n ...getColorPalette('success', '#49aa19', 'dark', '#141414'),\n ...getColorPalette('warning', '#d89614', 'dark', '#141414'),\n ...getColorPalette('error', '#a61d24', 'dark', '#141414'),\n};\nlet rootStatusColorDarkVariables = '';\n\nObject.entries(rootStatusColorDark).forEach((e) => {\n rootStatusColorDarkVariables += `${e.join(': ')};\\n`;\n});\n\nexport const rootVariables = `\n :root {\n ${rootStatusColorVariables}\n }\n [data-theme='dark'] {\n ${rootStatusColorDarkVariables}\n }\n`;\n"],"names":["tinycolor","colorPalette","menuDarkBg","getColorPalette","name","color","type","bg","vars","i","Object","assign","mix","setAlpha","toRgbString","keyword","setThemeColor","options","forEach","colors","componentBackground","key","prototype","hasOwnProperty","call","newColor","getComputedStyle","document","documentElement","getPropertyValue","style","setProperty","tableHeaderBg","rootStatusColor","rootStatusColorVariables","entries","e","join","rootStatusColorDark","rootStatusColorDarkVariables","rootVariables"],"mappings":"AAAA,kuCAAA,OAAOA,cAAe,YAAa,AACnC,QAAOC,iBAAkB,wBAAyB,AAElD,QAAO,IAAMC,WAAa,SAAU,AACpC,QAAO,IAAMC,gBAAkB,SAC7BC,KACAC,MAGG,KAFHC,4DAAyB,QACzBC,0DAAK,OAEL,IAAMC,KAA+B,CAAC,EAEtC,GAAIF,OAAS,QAAS,CACpB,IAAIG,EAAI,EAER,MAAOA,GAAK,EAAG,CACbD,IAAI,CAAC,AAAC,KAAYC,OAARL,KAAK,KAAK,OAAFK,GAAI,CAAGR,aAAaI,MAAOI,EAC7CA,CAAAA,GACF,CACF,KAAO,KACe,KAApBC,OAAOC,MAAM,CAACH,MAAM,QAClB,gBADkB,KACjB,AAAC,KAAS,OAALJ,KAAK,MAAMJ,UAAUY,GAAG,CAACX,aAAaI,MAAO,GAAIE,GAAI,MAC3D,gBAFkB,KAEjB,AAAC,KAAS,OAALH,KAAK,MAAMJ,UAAUY,GAAG,CAACX,aAA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G,8BAAgC,AAAC,GAAe,OAAbH,EAAEC,IAAI,CAAC,MAAM,MAClD,EAEA,QAAO,IAAMG,cAAgB,AAAC,oBAKxBD,OAHAL,yBAAyB,wCAGI,OAA7BK,6BAA6B,UAEjC"}
|
package/lib/utils/index.d.ts
CHANGED
package/lib/utils/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export var
|
|
1
|
+
export var watermark=function(param){var text=param.text,_param_x=param.x,x=_param_x===void 0?19.5:_param_x,_param_y=param.y,y=_param_y===void 0?55:_param_y,_param_width=param.width,width=_param_width===void 0?100:_param_width,_param_height=param.height,height=_param_height===void 0?100:_param_height,_param_fontSize=param.fontSize,fontSize=_param_fontSize===void 0?14:_param_fontSize,_param_angle=param.angle,angle=_param_angle===void 0?-45:_param_angle,_param_opacity=param.opacity,opacity=_param_opacity===void 0?.1:_param_opacity,_param_color=param.color,color=_param_color===void 0?"#000":_param_color;var svgStr='<svg xmlns="http://www.w3.org/2000/svg" width="'+width+'" height="'+height+'"><g><title>Layer 1</title><text x="'+x+'" y="'+y+'" textAnchor="middle" dominantBaseline="middle" stroke-opacity="'+opacity+'" stroke="'+color+'" fill="none" transform="rotate('+angle+" "+width/2+","+height/2+')" font-size="'+fontSize+'" font-family="-apple-system, BlinkMacSystemFont, '+"'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji', 'Helvetica', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans'"+'">'+text+"</text></g></svg>";return"data:image/svg+xml;base64,"+window.btoa(decodeURIComponent(encodeURIComponent(svgStr)))};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/lib/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/index.ts"],"sourcesContent":["export const translatFunction = (func: string, val?: number | string | any): string => {\n
|
|
1
|
+
{"version":3,"sources":["../../src/utils/index.ts"],"sourcesContent":["// export const translatFunction = (func: string, val?: number | string | any): string => {\n// try {\n// if (typeof val !== 'undefined') {\n// return eval(func);\n// }\n// } catch (error) {\n// // eslint-disable-next-line no-console\n// console.warn(error);\n// }\n// return func;\n// };\n\nexport type WatermarkParamsType = {\n text: string;\n x?: number;\n y?: number;\n width?: number;\n height?: number;\n fontSize?: number;\n angle?: number;\n opacity?: number;\n color?: string;\n};\n\nexport const watermark = ({\n text,\n x = 19.5,\n y = 55,\n width = 100,\n height = 100,\n fontSize = 14,\n angle = -45,\n opacity = 0.1,\n color = '#000',\n}: WatermarkParamsType): string => {\n const svgStr =\n '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"' +\n width +\n '\" height=\"' +\n height +\n '\"><g><title>Layer 1</title><text x=\"' +\n x +\n '\" y=\"' +\n y +\n '\" textAnchor=\"middle\" dominantBaseline=\"middle\" stroke-opacity=\"' +\n opacity +\n '\" stroke=\"' +\n color +\n '\" fill=\"none\" transform=\"rotate(' +\n angle +\n ' ' +\n width / 2 +\n ',' +\n height / 2 +\n ')\" font-size=\"' +\n fontSize +\n '\" font-family=\"-apple-system, BlinkMacSystemFont, ' +\n \"'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji', 'Helvetica', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans'\" +\n '\">' +\n text +\n '</text></g></svg>';\n\n return 'data:image/svg+xml;base64,' + window.btoa(decodeURIComponent(encodeURIComponent(svgStr)));\n};\n"],"names":["watermark","text","x","y","width","height","fontSize","angle","opacity","color","svgStr","window","btoa","decodeURIComponent","encodeURIComponent"],"mappings":"AAwBA,OAAO,IAAMA,UAAY,eAUU,KATjCC,WAAAA,oBACAC,EAAAA,oBAAI,6BACJC,EAAAA,oBAAI,+BACJC,MAAAA,4BAAQ,qCACRC,OAAAA,8BAAS,wCACTC,SAAAA,kCAAW,sCACXC,MAAAA,4BAAQ,CAAC,qCACTC,QAAAA,gCAAU,qCACVC,MAAAA,4BAAQ,oBAER,IAAMC,OACJ,kDACAN,MACA,aACAC,OACA,uCACAH,EACA,QACAC,EACA,mEACAK,QACA,aACAC,MACA,mCACAF,MACA,IACAH,MAAQ,EACR,IACAC,OAAS,EACT,iBACAC,SACA,qDACA,8NACA,KACAL,KACA,oBAEF,MAAO,6BAA+BU,OAAOC,IAAI,CAACC,mBAAmBC,mBAAmBJ,SAC1F,CAAE"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare type SafeImportParams = {
|
|
3
|
+
/** 文件路径 */
|
|
4
|
+
filePath: string;
|
|
5
|
+
/** src目录下的文件夹路径 ['src/pages' === 'pages'] */
|
|
6
|
+
directory?: string;
|
|
7
|
+
/** 重试次数 默认:2 */
|
|
8
|
+
retriesLeft?: number;
|
|
9
|
+
/** 加载错误时的回调 */
|
|
10
|
+
onError?: () => void;
|
|
11
|
+
/** 降级 */
|
|
12
|
+
fallback?: any;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* 安全的import
|
|
16
|
+
* @param {string} filePath 路径
|
|
17
|
+
* @param {string} directory src目录下的文件夹路径 ['src/pages' === 'pages']
|
|
18
|
+
* @param {number} [retriesLeft=2] 重试次数
|
|
19
|
+
* @param {Function} onError 加载错误时的回调
|
|
20
|
+
* @param {any} fallback 降级
|
|
21
|
+
* @returns {Promise} LazyExoticComponent
|
|
22
|
+
* */
|
|
23
|
+
export declare const safeImport: ({ filePath, directory, retriesLeft, onError, fallback, }: SafeImportParams) => Promise<{
|
|
24
|
+
default: any;
|
|
25
|
+
}>;
|
|
26
|
+
/**
|
|
27
|
+
* 动态引入
|
|
28
|
+
* @param {string} filePath 文件路径
|
|
29
|
+
* @param {string} directory 文件夹路径
|
|
30
|
+
* @param {Function} onError 加载错误时的回调
|
|
31
|
+
* @returns {Promise} LazyExoticComponent
|
|
32
|
+
* */
|
|
33
|
+
export declare const lazyImport: (filePath: string, directory?: string, onError?: () => void) => React.LazyExoticComponent<React.ComponentType>;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import React from"react";import{Outlet}from"react-router-dom";export var safeImport=function(param){var filePath=param.filePath,directory=param.directory,_param_retriesLeft=param.retriesLeft,retriesLeft=_param_retriesLeft===void 0?2:_param_retriesLeft,onError=param.onError,fallback=param.fallback;var filePaths=filePath.startsWith("/")?filePath.slice(1):filePath;var _directory=directory||"pages";return new Promise(function(resolve){return import("@/"+_directory+(_directory===""?"":"/")+filePaths).then(resolve).catch(function(){if(retriesLeft===1){if(onError){onError()}return Promise.resolve({default:fallback})}return safeImport({filePath:filePath,retriesLeft:retriesLeft-1,directory:directory,onError:onError,fallback:fallback})})})};export var lazyImport=function(filePath,directory,onError){var filePaths=filePath.startsWith("/")?filePath.slice(1):filePath;var _directory=directory||"pages";return React.lazy(function(){return safeImport({filePath:filePath,directory:directory,onError:onError,fallback:React.createElement("div",{path:_directory+"/"+filePaths},React.createElement(Outlet))})})};
|
|
2
|
+
//# sourceMappingURL=lazy-import.js.map
|