@gx-design-vue/create-gx-cli 0.1.14 → 0.1.16

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.
Files changed (124) hide show
  1. package/package.json +1 -1
  2. package/src/cli.js +7 -4
  3. package/src/main.js +7 -7
  4. package/template-mobile-vant-cli/.env +3 -0
  5. package/template-mobile-vant-cli/.env.development +4 -6
  6. package/template-mobile-vant-cli/.env.pro +16 -7
  7. package/template-mobile-vant-cli/.env.production +21 -9
  8. package/template-mobile-vant-cli/commitlint.config.cjs +32 -0
  9. package/template-mobile-vant-cli/config/default/defaultSettings.ts +70 -0
  10. package/template-mobile-vant-cli/config/default/network.ts +10 -0
  11. package/template-mobile-vant-cli/config/default/proxy.ts +50 -0
  12. package/template-mobile-vant-cli/config/default/theme.ts +3 -0
  13. package/template-mobile-vant-cli/config/index.ts +11 -0
  14. package/template-mobile-vant-cli/eslint.config.js +10 -2
  15. package/template-mobile-vant-cli/index.html +22 -21
  16. package/template-mobile-vant-cli/{build → internal/vite-config/generate}/generateModifyVars.ts +1 -1
  17. package/template-mobile-vant-cli/internal/vite-config/rollupOptions/index.ts +22 -0
  18. package/template-mobile-vant-cli/internal/vite-config/util/hash.ts +17 -0
  19. package/template-mobile-vant-cli/internal/vite-config/util/index.ts +132 -0
  20. package/template-mobile-vant-cli/internal/vite-config/vite/cdn.ts +65 -0
  21. package/template-mobile-vant-cli/{build → internal/vite-config/vite}/optimizer.ts +9 -1
  22. package/template-mobile-vant-cli/internal/vite-config/vite/plugin/appConfig.ts +91 -0
  23. package/template-mobile-vant-cli/{build → internal/vite-config/vite}/plugin/autoImport.ts +7 -3
  24. package/template-mobile-vant-cli/internal/vite-config/vite/plugin/compress.ts +31 -0
  25. package/template-mobile-vant-cli/internal/vite-config/vite/plugin/html.ts +32 -0
  26. package/template-mobile-vant-cli/internal/vite-config/vite/plugin/index.ts +74 -0
  27. package/template-mobile-vant-cli/internal/vite-config/vite/plugin/visualizer.ts +14 -0
  28. package/template-mobile-vant-cli/internal/vite-config/vite/plugin/viteNotice.ts +40 -0
  29. package/template-mobile-vant-cli/mock/config/permissions.ts +15 -0
  30. package/template-mobile-vant-cli/mock/config/user/id.ts +5 -0
  31. package/template-mobile-vant-cli/mock/config/user/index.ts +96 -0
  32. package/template-mobile-vant-cli/mock/index.ts +55 -0
  33. package/template-mobile-vant-cli/mock/routers/table/index.fake.ts +22 -0
  34. package/template-mobile-vant-cli/mock/routers/user/account.fake.ts +52 -0
  35. package/template-mobile-vant-cli/mock/routers/user/index.fake.ts +46 -0
  36. package/template-mobile-vant-cli/mock/utils/crypto.ts +21 -0
  37. package/template-mobile-vant-cli/mock/utils/table.ts +96 -0
  38. package/template-mobile-vant-cli/mock/utils/util.ts +91 -0
  39. package/template-mobile-vant-cli/package.json +51 -34
  40. package/template-mobile-vant-cli/public/css/default.css +54 -0
  41. package/template-mobile-vant-cli/src/App.vue +6 -2
  42. package/template-mobile-vant-cli/src/assets/logo.png +0 -0
  43. package/template-mobile-vant-cli/src/components/PageContainer/ProSkeleton.tsx +1 -1
  44. package/template-mobile-vant-cli/src/components/PageContainer/index.tsx +108 -16
  45. package/template-mobile-vant-cli/src/components/PageContainer/style.module.less +5 -2
  46. package/template-mobile-vant-cli/src/components/TabsMenu/index.vue +45 -0
  47. package/template-mobile-vant-cli/src/core/gx-design/index.ts +1 -1
  48. package/template-mobile-vant-cli/src/core/index.ts +0 -7
  49. package/template-mobile-vant-cli/src/design/color.less +1 -0
  50. package/template-mobile-vant-cli/src/design/config.less +5 -0
  51. package/template-mobile-vant-cli/src/design/index.less +1 -1
  52. package/template-mobile-vant-cli/src/design/mixin.less +65 -0
  53. package/template-mobile-vant-cli/src/design/reset.less +16 -132
  54. package/template-mobile-vant-cli/src/hooks/web/usePageLoading.ts +7 -9
  55. package/template-mobile-vant-cli/src/layout/{BasicLayout.vue → BasicLayout/index.vue} +3 -1
  56. package/template-mobile-vant-cli/src/layout/BasicLayout/style.less +3 -0
  57. package/template-mobile-vant-cli/src/layout/UserLayout/index.vue +18 -0
  58. package/template-mobile-vant-cli/src/layout/UserLayout/style.module.less +36 -0
  59. package/template-mobile-vant-cli/src/main.ts +16 -9
  60. package/template-mobile-vant-cli/src/pages/Account/details.vue +13 -0
  61. package/template-mobile-vant-cli/src/pages/Account/index.vue +102 -0
  62. package/template-mobile-vant-cli/src/pages/{home.vue → Home/index.vue} +5 -5
  63. package/template-mobile-vant-cli/src/pages/user/login/index.vue +74 -0
  64. package/template-mobile-vant-cli/src/plugins/dayjs/index.ts +3 -0
  65. package/template-mobile-vant-cli/src/plugins/index.ts +2 -0
  66. package/template-mobile-vant-cli/src/router/guard/index.ts +18 -0
  67. package/template-mobile-vant-cli/src/router/guard/permissions.ts +41 -0
  68. package/template-mobile-vant-cli/src/router/guard/stateGuard.ts +10 -0
  69. package/template-mobile-vant-cli/src/router/index.ts +21 -15
  70. package/template-mobile-vant-cli/src/router/routes/index.ts +46 -0
  71. package/template-mobile-vant-cli/src/router/routes/modules/dataSource.ts +32 -0
  72. package/template-mobile-vant-cli/src/services/userCenter/account.ts +42 -0
  73. package/template-mobile-vant-cli/src/services/userCenter/index.ts +28 -0
  74. package/template-mobile-vant-cli/src/store/index.ts +4 -1
  75. package/template-mobile-vant-cli/src/store/modules/global.ts +6 -13
  76. package/template-mobile-vant-cli/src/store/modules/user.ts +107 -0
  77. package/template-mobile-vant-cli/src/utils/accessToken.ts +97 -0
  78. package/template-mobile-vant-cli/src/utils/crypto/index.ts +3 -4
  79. package/template-mobile-vant-cli/src/utils/env.ts +2 -2
  80. package/template-mobile-vant-cli/src/utils/pageTitle.ts +12 -6
  81. package/template-mobile-vant-cli/src/utils/request/XHR.ts +9 -11
  82. package/template-mobile-vant-cli/src/utils/request/axiosCancel.ts +5 -5
  83. package/template-mobile-vant-cli/src/utils/request/checkStatus.ts +18 -2
  84. package/template-mobile-vant-cli/src/utils/request/index.ts +36 -23
  85. package/template-mobile-vant-cli/src/utils/storage.ts +49 -32
  86. package/template-mobile-vant-cli/src/utils/validate.ts +31 -36
  87. package/template-mobile-vant-cli/tsconfig.json +17 -9
  88. package/template-mobile-vant-cli/types/auto-imports.d.ts +18 -2
  89. package/template-mobile-vant-cli/types/components.d.ts +2 -7
  90. package/template-mobile-vant-cli/types/config.d.ts +56 -0
  91. package/template-mobile-vant-cli/types/global.d.ts +62 -21
  92. package/template-mobile-vant-cli/types/mock.d.ts +34 -0
  93. package/template-mobile-vant-cli/types/module.d.ts +33 -0
  94. package/template-mobile-vant-cli/types/response.d.ts +3 -1
  95. package/template-mobile-vant-cli/types/system.d.ts +58 -0
  96. package/template-mobile-vant-cli/types/vant-import.d.ts +16 -5
  97. package/template-mobile-vant-cli/unocss.config.ts +120 -66
  98. package/template-mobile-vant-cli/vite.config.ts +78 -81
  99. package/template-mobile-vant-cli/build/cdn.ts +0 -5
  100. package/template-mobile-vant-cli/build/plugin/html.ts +0 -26
  101. package/template-mobile-vant-cli/build/plugin/index.ts +0 -42
  102. package/template-mobile-vant-cli/build/plugin/mock.ts +0 -14
  103. package/template-mobile-vant-cli/build/plugin/viteMock/client.ts +0 -88
  104. package/template-mobile-vant-cli/build/plugin/viteMock/createMockServer.ts +0 -271
  105. package/template-mobile-vant-cli/build/plugin/viteMock/index.ts +0 -69
  106. package/template-mobile-vant-cli/build/plugin/viteMock/types.ts +0 -48
  107. package/template-mobile-vant-cli/build/plugin/viteMock/utils.ts +0 -48
  108. package/template-mobile-vant-cli/build/script/postBuild.ts +0 -14
  109. package/template-mobile-vant-cli/mock/_createProductionServer.ts +0 -19
  110. package/template-mobile-vant-cli/mock/utils.ts +0 -9
  111. package/template-mobile-vant-cli/postcss.config.cjs +0 -8
  112. package/template-mobile-vant-cli/prettier.config.cjs +0 -18
  113. package/template-mobile-vant-cli/public/js/flexible.js +0 -44
  114. package/template-mobile-vant-cli/src/core/vant-design/index.ts +0 -4
  115. package/template-mobile-vant-cli/src/design/vant.less +0 -2
  116. package/template-mobile-vant-cli/src/global.less +0 -1
  117. package/template-mobile-vant-cli/src/layout/basicLayout.less +0 -11
  118. package/template-mobile-vant-cli/src/router/routes.ts +0 -20
  119. package/template-mobile-vant-cli/src/router/typings.ts +0 -8
  120. package/template-mobile-vant-cli/src/settings/index.ts +0 -10
  121. package/template-mobile-vant-cli/src/utils/crypto/base64.ts +0 -101
  122. package/template-mobile-vant-cli/types/ant-design-import.d.ts +0 -13
  123. package/template-mobile-vant-cli/types/plugins-auto-import.d.ts +0 -14
  124. /package/template-mobile-vant-cli/{mock/datasSource/api/index.ts → src/design/vant/index.less} +0 -0
@@ -0,0 +1,56 @@
1
+ declare interface CdnModuleList {
2
+ name: string;
3
+ globalName: string;
4
+ path: string;
5
+ css?: string;
6
+ }
7
+
8
+ declare interface SettingConfig {
9
+ servive: {
10
+ port: number;
11
+ };
12
+ build: {
13
+ publicPath: string;
14
+ outputDir: string;
15
+ assetsDir: string;
16
+ };
17
+ system: {
18
+ title: string;
19
+ shortName: string;
20
+ titleSeparator: string;
21
+ titleReverse: boolean;
22
+ routerMode: string;
23
+ appInit: {
24
+ loading: false | {
25
+ text: string;
26
+ }
27
+ };
28
+ routesWhiteList: string[];
29
+ loginInterception: boolean;
30
+ loginRSA: boolean;
31
+ };
32
+ cdn: {
33
+ use: boolean;
34
+ url: string;
35
+ modules?: CdnModuleList[]
36
+ };
37
+ proxy: {
38
+ use: boolean;
39
+ target: string | Record<string, any>;
40
+ };
41
+ mock: {
42
+ prefix: string;
43
+ // 0 校验是否有token值 1 校验是否有token值且token时有效的(mock用户) -1 不校验
44
+ checkToken: -1 | 0 | 1;
45
+ };
46
+ token: {
47
+ name: string;
48
+ storage: 'localStorage' | 'sessionStorage' | 'cookie';
49
+ storageName: string;
50
+ };
51
+ }
52
+
53
+ declare interface NetworkConfig {
54
+ requestTimeout: number;
55
+ successCode: (string | number)[];
56
+ }
@@ -1,39 +1,80 @@
1
+ import type { DeepPartial, ProAliasToken as GProAliasToken } from '@gx-design-vue/pro-provider'
2
+ import type {
3
+ CustomRenderResult as GCustomRenderResult,
4
+ ProColumnsType as GProColumnsType,
5
+ ProColumnType as GProColumnType,
6
+ ProTableBodyCellProps as GProTableBodyCellProps
7
+ } from '@gx-design-vue/pro-table'
8
+ import type { RecordType } from '@gx-design-vue/pro-utils'
1
9
  import type { PropType, CSSProperties as VueCSSProperties } from 'vue'
2
- import type { CSSObject as ProCssObject } from 'ant-design-vue'
3
10
 
4
11
  declare global {
5
12
  const __APP_INFO__: {
6
13
  pkg: {
7
- name: string;
8
- version: string;
9
- dependencies: RecordType;
10
- devDependencies: RecordType;
11
- };
12
- lastBuildTime: string;
14
+ name: string
15
+ version: string
16
+ dependencies: Recordable<string>
17
+ devDependencies: Recordable<string>
18
+ }
19
+ lastBuildTime: string
13
20
  }
14
21
 
15
22
  declare interface LocalResult {
16
- value: any;
17
- time: string;
18
- expired: number;
23
+ value: any
24
+ time: string
25
+ expired: number
19
26
  }
20
27
 
28
+ declare type ProAliasToken = DeepPartial<GProAliasToken>
29
+ declare type ProColumnType<DataValue = any, SearchParama = RecordType> = GProColumnType<
30
+ DataValue,
31
+ SearchParama
32
+ >
33
+ declare type ProColumnsType<DataValue = any, SearchParama = RecordType> = GProColumnsType<
34
+ DataValue,
35
+ SearchParama
36
+ >
37
+ declare type ProTableBodyCellProps<T = Record<string, any>> = GProTableBodyCellProps<T>
38
+ declare type CustomRenderResult<T = Record<string, any>> = GCustomRenderResult<T>
39
+
40
+ // vue
21
41
  declare type VuePropType<T> = PropType<T>
22
- declare type CSSObject = ProCssObject
23
42
  declare type CSSProperties = VueCSSProperties
24
43
 
25
- declare type RecordType<T = string, K = any> = Record<T, K>
44
+ declare type Recordable<T = any> = Record<string, T>
45
+
46
+ declare interface Fn<T = any, R = T> {
47
+ (...arg: T[]): R
48
+ }
26
49
 
27
50
  declare interface ViteEnv {
28
- VITE_USE_MODE: string;
29
- VITE_USE_CDN: boolean;
30
- VITE_USE_MOCK: boolean;
31
- VITE_USE_V_CONSOLE: boolean;
32
- VITE_NODE_ENV: string;
33
- VITE_BASE_URL: string;
34
- VITE_APP_ENV: string;
35
- VITE_DROP_CONSOLE: boolean;
51
+ VITE_PORT: number
52
+ VITE_IP_ADRESS: string
53
+ VITE_USE_MODE: 'development' | 'production' | 'pro'
54
+ // proxy 配置
55
+ VITE_PROXY_PREFIX: string;
56
+ // 全局 mock 开关
57
+ VITE_IS_MOCK: boolean
58
+ // 是否使用vconsole
59
+ VITE_USE_V_CONSOLE: boolean
60
+ VITE_USE_MOCK: boolean
61
+ VITE_NODE_ENV: 'development' | 'production'
62
+ VITE_BASE_URL: string
63
+ VITE_UPLOAD_PATH: string
64
+ VITE_APP_ENV: 'dev' | 'pro'
65
+ VUE_APP_VERSION: string
66
+ VITE_PROXY: [ string, string ][]
67
+ VITE_DROP_CONSOLE: boolean
68
+ VITE_BUILD_COMPRESS: 'gzip' | 'brotli' | 'none'
69
+ VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE: boolean
70
+ VITE_LEGACY: boolean
71
+ VITE_HOME_PAGE: string // 主页
36
72
  }
37
73
 
38
- declare type ViteEnvKey = keyof ViteEnv
74
+ interface Window {
75
+ editorConfig: {
76
+ isFirstRenderCropUpdated?: boolean
77
+ }
78
+ FilerobotImageEditor?: any
79
+ }
39
80
  }
@@ -0,0 +1,34 @@
1
+ import { IncomingHttpHeaders, IncomingMessage as IncomingMessage$1, ServerResponse } from 'node:http'
2
+
3
+ interface IncomingMessage extends IncomingMessage$1 {
4
+ originalUrl?: IncomingMessage$1['url'];
5
+ }
6
+
7
+ type UppercaseHttpMethodType = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS' | 'CONNECT' | 'TRACE'
8
+ type lowercase<T extends string> = T extends Uppercase<T> ? Lowercase<T> : T
9
+ type LowercaseHttpMethod = lowercase<UppercaseHttpMethodType>
10
+
11
+ declare global {
12
+ type HttpMethodType = UppercaseHttpMethodType | LowercaseHttpMethod
13
+
14
+ export interface MockResponse {
15
+ body: any;
16
+ query: any;
17
+ headers: RequestHeater
18
+ }
19
+
20
+ interface RequestHeater extends IncomingHttpHeaders {
21
+ [key: string]: any;
22
+ }
23
+
24
+ interface FakeRouteConfig {
25
+ url: string;
26
+ method?: HttpMethodType;
27
+ timeout?: number;
28
+ statusCode?: number;
29
+ statusText?: string;
30
+ headers?: RequestHeater;
31
+ response?: (processedRequest: MockResponse, req: IncomingMessage, res: ServerResponse) => any;
32
+ rawResponse?: (req: IncomingMessage, res: ServerResponse) => void;
33
+ }
34
+ }
@@ -6,6 +6,8 @@ declare module '*.gif'
6
6
  declare module '*.bmp'
7
7
  declare module '*.tiff'
8
8
 
9
+ /// <reference types="unplugin-turbo-console/client" />
10
+
9
11
  /// <reference types="vite/client" />
10
12
  declare module '*.vue' {
11
13
  import type { DefineComponent } from 'vue'
@@ -14,7 +16,38 @@ declare module '*.vue' {
14
16
  export default component
15
17
  }
16
18
 
19
+ declare module 'diagram-js/lib/navigation/movecanvas' {}
20
+ declare module '@multiavatar/multiavatar/esm' {
21
+ export default function multiavatar(id: any): string;
22
+ }
23
+
24
+ declare module '*.tsx' {
25
+ import Vue from 'compatible-vue'
26
+
27
+ export default Vue
28
+ }
29
+
17
30
  declare module 'virtual:*' {
18
31
  const result: any
19
32
  export default result
20
33
  }
34
+
35
+ declare global {
36
+ namespace JSX {
37
+ interface Element extends VNode {}
38
+
39
+ interface ElementClass extends Vue {}
40
+
41
+ interface ElementAttributesProperty {
42
+ $props: any
43
+ }
44
+
45
+ interface IntrinsicElements {
46
+ [elem: string]: any
47
+ }
48
+
49
+ interface IntrinsicAttributes {
50
+ [elem: string]: any
51
+ }
52
+ }
53
+ }
@@ -2,7 +2,9 @@ declare interface DefaultResult<T> {
2
2
  code: number;
3
3
  msg?: string;
4
4
  message?: string;
5
- data?: T;
5
+ data: T;
6
+ rows: T[];
7
+ total?: number;
6
8
  }
7
9
 
8
10
  declare type ResponseResult<T = any, R = undefined> = R extends undefined
@@ -0,0 +1,58 @@
1
+ import type { RouteRecordRaw } from 'vue-router'
2
+
3
+ declare global {
4
+ interface UserInfo {
5
+ deptType?: 'government' | 'enterprise';
6
+ roles: string[];
7
+ permissions: string[];
8
+ user: UserDetails;
9
+ }
10
+
11
+ interface UserDetails {
12
+ createBy?: string
13
+ createTime?: string
14
+ updateBy?: string
15
+ updateTime?: string
16
+ remark?: string
17
+ userId?: number
18
+ deptId?: number
19
+ userName?: string
20
+ nickName: string
21
+ address: string
22
+ email: string
23
+ phonenumber: string
24
+ sex?: string // 假设 '1' 代表某种性别,可能需要进一步定义
25
+ avatar?: string
26
+ password?: string
27
+ status?: string
28
+ delFlag?: string
29
+ loginIp?: string
30
+ loginDate?: string // ISO 8601 格式
31
+ dept?: DepartBaseInfo
32
+ roles?: RoleInfo[] // 根据具体结构可进一步定义
33
+ roleIds?: number[]
34
+ postIds?: number[]
35
+ roleId?: number
36
+ admin?: boolean
37
+ }
38
+
39
+ interface AppRouteRecordRaw {
40
+ meta?: {
41
+ icon?: string;
42
+ name?: string;
43
+ isMenu?: boolean;
44
+ menuSelectKey?: string;
45
+ };
46
+ children?: AppRouteRecordRaw[];
47
+ }
48
+
49
+ export type AppRouteModule = AppRouteRecordRaw & RouteRecordRaw
50
+
51
+ interface DefaultTableRecord {
52
+ id: any;
53
+ uuid: string;
54
+ createTime?: string | null;
55
+ }
56
+
57
+ type TableRecord<T = undefined> = T extends undefined ? DefaultTableRecord : DefaultTableRecord & T
58
+ }
@@ -1,13 +1,24 @@
1
- // generated by unplugin-vue-components
2
- // We suggest you to commit this file into source control
1
+ /* eslint-disable */
2
+ // @ts-nocheck
3
+ // Generated by unplugin-vue-components
3
4
  // Read more: https://github.com/vuejs/core/pull/3399
4
- import '@vue/runtime-core'
5
-
6
5
  export {}
7
6
 
8
- declare module '@vue/runtime-core' {
7
+ /* prettier-ignore */
8
+ declare module 'vue' {
9
9
  export interface GlobalComponents {
10
10
  RouterLink: typeof import('vue-router')['RouterLink']
11
11
  RouterView: typeof import('vue-router')['RouterView']
12
+ TabsMenu: typeof import('./../src/components/TabsMenu/index.vue')['default']
13
+ VanButton: typeof import('vant/es')['Button']
14
+ VanConfigProvider: typeof import('vant/es')['ConfigProvider']
15
+ VanField: typeof import('vant/es')['Field']
16
+ VanForm: typeof import('vant/es')['Form']
17
+ VanIcon: typeof import('vant/es')['Icon']
18
+ VanImage: typeof import('vant/es')['Image']
19
+ VanProgress: typeof import('vant/es')['Progress']
20
+ VanTabbar: typeof import('vant/es')['Tabbar']
21
+ VanTabbarItem: typeof import('vant/es')['TabbarItem']
22
+ VanTag: typeof import('vant/es')['Tag']
12
23
  }
13
24
  }
@@ -1,6 +1,9 @@
1
+ import presetRemToPx from '@unocss/preset-rem-to-px'
1
2
  import {
2
3
  defineConfig,
3
4
  presetAttributify,
5
+ presetIcons,
6
+ presetMini,
4
7
  presetUno,
5
8
  transformerDirectives,
6
9
  transformerVariantGroup
@@ -8,94 +11,145 @@ import {
8
11
 
9
12
  export default defineConfig({
10
13
  presets: [
11
- presetUno(),
12
- presetAttributify()
14
+ presetUno,
15
+ presetAttributify,
16
+ presetIcons(),
17
+ // @ts-ignore
18
+ presetRemToPx({
19
+ baseFontSize: 4
20
+ }),
21
+ presetMini()
22
+ ],
23
+ transformers: [
24
+ transformerDirectives({
25
+ applyVariable: [ '--at-apply' ]
26
+ }),
27
+ transformerVariantGroup()
13
28
  ],
14
- theme: {
15
- breakpoints: {
16
- sm: '576px',
17
- md: '768px',
18
- lg: '992px',
19
- xl: '1200px',
20
- xxl: '1600px'
21
- }
22
- },
23
- transformers: [ transformerDirectives({
24
- applyVariable: [ '--at-apply' ]
25
- }), transformerVariantGroup() ],
26
29
  shortcuts: [
27
30
  {
28
31
  'flex-center': 'flex items-center justify-center'
29
32
  },
30
33
  ],
31
34
  rules: [
32
- [ /^text-rgba-(.*)$/, ([ , str ]) => {
33
- const regex = /\[([^[\]]*)\]/
34
- const match = str.match(regex)
35
+ [
36
+ /^text-rgba-(.*)$/,
37
+ ([ , str ]) => {
38
+ const regex = /\[([^[\]]*)\]/
39
+ const match = str.match(regex)
35
40
 
36
- if (match && match.length > 1) {
37
- const contentInsideBrackets = match[1]
38
- return {
39
- color: `rgba(${contentInsideBrackets.split('-').join(',')})`
41
+ if (match && match.length > 1) {
42
+ const contentInsideBrackets = match[1]
43
+ return {
44
+ color: `rgba(${contentInsideBrackets.split('-').join(',')})`
45
+ }
46
+ } else {
47
+ return {}
40
48
  }
41
- } else {
42
- return {}
43
49
  }
44
- } ],
45
- [ /^bg-rgba-(.*)$/, ([ , str ]) => {
46
- const regex = /\[([^[\]]*)\]/
47
- const match = str.match(regex)
50
+ ],
51
+ [
52
+ /^bg-rgba-(.*)$/,
53
+ ([ , str ]) => {
54
+ const regex = /\[([^[\]]*)\]/
55
+ const match = str.match(regex)
48
56
 
49
- if (match && match.length > 1) {
50
- const contentInsideBrackets = match[1]
57
+ if (match && match.length > 1) {
58
+ const contentInsideBrackets = match[1]
59
+ return {
60
+ 'background-color': `rgba(${contentInsideBrackets.split('-').join(',')})`
61
+ }
62
+ } else {
63
+ return {}
64
+ }
65
+ }
66
+ ],
67
+ [
68
+ /^bd-(.*)$/,
69
+ ([, str]) => {
70
+ return {
71
+ 'border': `1px solid ${str === 'main' ? 'var(--van-primary-color)' : str === 'error' ? 'var(--van-danger-color)' : `#${str}`}`
72
+ }
73
+ }
74
+ ],
75
+ [
76
+ /^bd-l-(.*)$/,
77
+ ([, str]) => {
78
+ return {
79
+ 'border-left': `1px solid ${str === 'main' ? 'rgba(5, 5, 5, 0.06)' : `#${str}`}`
80
+ }
81
+ }
82
+ ],
83
+ [
84
+ /^bd-t-(.*)$/,
85
+ ([, str]) => {
51
86
  return {
52
- 'background-color': `rgba(${contentInsideBrackets.split('-').join(',')})`
87
+ 'border-top': `1px solid ${str === 'main' ? 'rgba(5, 5, 5, 0.06)' : `#${str}`}`
53
88
  }
54
- } else {
55
- return {}
56
89
  }
57
- } ],
58
- [ /^text-hidden-(\d+)$/, ([ , d ]) => ({
59
- 'overflow': 'hidden',
60
- 'text-overflow': 'ellipsis',
61
- 'display': '-webkit-box',
62
- '-webkit-line-clamp': d,
63
- 'line-clamp': d,
64
- '-webkit-box-orient': 'vertical',
65
- 'word-break': 'break-word'
66
- }) ],
67
- [ 'hidden-none', { 'opacity': '0', 'visibility': 'hidden' } ],
68
- [ /^flex-main-(\d+)$/, ([ , d ]) => ({
69
- 'flex': `0 0 ${d}px`
70
- }) ],
71
- [ /^shrink-(\d+)$/, ([ , d ]) => ({
72
- 'flex-shrink': d
73
- }) ],
74
- [ 'text-hex-main', { 'color': 'var(--gx-primary-color)' } ],
75
- [ 'bg-hex-main', { 'background': 'var(--gx-primary-color)' } ],
90
+ ],
91
+ [
92
+ /^bd-b-(.*)$/,
93
+ ([, str]) => {
94
+ return {
95
+ 'border-bottom': `1px solid ${str === 'main' ? 'rgba(5, 5, 5, 0.06)' : `#${str}`}`
96
+ }
97
+ }
98
+ ],
99
+ [
100
+ /^text-hidden-(\d+)$/,
101
+ ([ , d ]) => ({
102
+ overflow: 'hidden',
103
+ 'text-overflow': 'ellipsis',
104
+ display: '-webkit-box',
105
+ '-webkit-line-clamp': d,
106
+ 'line-clamp': d,
107
+ '-webkit-box-orient': 'vertical',
108
+ 'word-break': 'break-word'
109
+ })
110
+ ],
111
+ [ 'hidden-none', { opacity: '0', visibility: 'hidden' } ],
112
+ [
113
+ /^flex-main-(\d+)$/,
114
+ ([ , d ]) => ({
115
+ flex: `0 0 ${d}px`
116
+ })
117
+ ],
118
+ [
119
+ /^shrink-(\d+)$/,
120
+ ([ , d ]) => ({
121
+ 'flex-shrink': d
122
+ })
123
+ ],
124
+ [ 'text-hex-main', { color: 'var(--gx-primary-color)' } ],
125
+ [ 'text-hex-error', { color: 'var(--gx-color-error)' } ],
126
+ [ 'bg-hex-main', { background: 'var(--gx-primary-color)' } ],
76
127
  [ 'word-break-all', { 'word-break': 'break-all' } ],
77
128
  [ 'word-break-word', { 'word-break': 'break-word' } ],
78
- [ 'flex-main', { 'flex': '1' } ],
79
- [ 'position-all', { 'position': 'absolute', 'top': '0', 'bottom': '0', 'left': '0', 'right': '0' } ],
129
+ [ 'flex-main', { flex: '1' } ],
130
+ [ 'position-all', { position: 'absolute', top: '0', bottom: '0', left: '0', right: '0' } ],
80
131
  [ 'image-event-none', { 'user-select': 'none', 'pointer-events': 'none' } ],
81
132
  [
82
- 'position-center', {
83
- 'left': '50%',
84
- 'top': '50%',
85
- 'transform': 'translate(-50%, -50%)'
86
- }
133
+ 'position-center',
134
+ {
135
+ left: '50%',
136
+ top: '50%',
137
+ transform: 'translate(-50%, -50%)'
138
+ }
87
139
  ],
88
140
  [
89
- 'position-center-x', {
90
- 'left': '50%',
91
- 'transform': 'translateX(-50%)'
92
- }
141
+ 'position-center-x',
142
+ {
143
+ left: '50%',
144
+ transform: 'translateX(-50%)'
145
+ }
93
146
  ],
94
147
  [
95
- 'position-center-y', {
96
- 'top': '50%',
97
- 'transform': 'translateY(-50%)'
98
- }
148
+ 'position-center-y',
149
+ {
150
+ top: '50%',
151
+ transform: 'translateY(-50%)'
152
+ }
99
153
  ]
100
154
  ]
101
155
  })