@gx-design-vue/create-gx-cli 0.1.19 → 0.1.21

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 (181) hide show
  1. package/README.md +1 -4
  2. package/dist/index.js +36 -48
  3. package/package.json +5 -3
  4. package/template-mobile-vant-cli/.editorconfig +19 -0
  5. package/template-mobile-vant-cli/.env +3 -0
  6. package/template-mobile-vant-cli/.env.development +17 -0
  7. package/template-mobile-vant-cli/.env.pro +28 -0
  8. package/template-mobile-vant-cli/.env.production +31 -0
  9. package/template-mobile-vant-cli/.eslintignore +15 -0
  10. package/template-mobile-vant-cli/.prettierignore +9 -0
  11. package/template-mobile-vant-cli/README.md +1 -0
  12. package/template-mobile-vant-cli/commitlint.config.cjs +32 -0
  13. package/template-mobile-vant-cli/config/default/defaultSettings.ts +70 -0
  14. package/template-mobile-vant-cli/config/default/network.ts +10 -0
  15. package/template-mobile-vant-cli/config/default/proxy.ts +50 -0
  16. package/template-mobile-vant-cli/config/default/theme.ts +3 -0
  17. package/template-mobile-vant-cli/config/index.ts +11 -0
  18. package/template-mobile-vant-cli/eslint.config.js +58 -0
  19. package/template-mobile-vant-cli/index.html +25 -0
  20. package/template-mobile-vant-cli/internal/vite-config/generate/generateModifyVars.ts +7 -0
  21. package/template-mobile-vant-cli/internal/vite-config/rollupOptions/index.ts +22 -0
  22. package/template-mobile-vant-cli/internal/vite-config/util/hash.ts +17 -0
  23. package/template-mobile-vant-cli/internal/vite-config/util/index.ts +132 -0
  24. package/template-mobile-vant-cli/internal/vite-config/vite/cdn.ts +65 -0
  25. package/template-mobile-vant-cli/internal/vite-config/vite/optimizer.ts +26 -0
  26. package/template-mobile-vant-cli/internal/vite-config/vite/plugin/appConfig.ts +91 -0
  27. package/template-mobile-vant-cli/internal/vite-config/vite/plugin/autoImport.ts +28 -0
  28. package/template-mobile-vant-cli/internal/vite-config/vite/plugin/compress.ts +31 -0
  29. package/template-mobile-vant-cli/internal/vite-config/vite/plugin/html.ts +32 -0
  30. package/template-mobile-vant-cli/internal/vite-config/vite/plugin/index.ts +74 -0
  31. package/template-mobile-vant-cli/internal/vite-config/vite/plugin/visualizer.ts +14 -0
  32. package/template-mobile-vant-cli/internal/vite-config/vite/plugin/viteNotice.ts +40 -0
  33. package/template-mobile-vant-cli/mock/config/permissions.ts +15 -0
  34. package/template-mobile-vant-cli/mock/config/user/id.ts +5 -0
  35. package/template-mobile-vant-cli/mock/config/user/index.ts +96 -0
  36. package/template-mobile-vant-cli/mock/index.ts +55 -0
  37. package/template-mobile-vant-cli/mock/routers/table/index.fake.ts +22 -0
  38. package/template-mobile-vant-cli/mock/routers/user/account.fake.ts +52 -0
  39. package/template-mobile-vant-cli/mock/routers/user/index.fake.ts +46 -0
  40. package/template-mobile-vant-cli/mock/utils/crypto.ts +21 -0
  41. package/template-mobile-vant-cli/mock/utils/table.ts +96 -0
  42. package/template-mobile-vant-cli/mock/utils/util.ts +91 -0
  43. package/template-mobile-vant-cli/package.json +74 -0
  44. package/template-mobile-vant-cli/public/css/default.css +54 -0
  45. package/template-mobile-vant-cli/public/favicon.ico +0 -0
  46. package/template-mobile-vant-cli/src/App.vue +8 -0
  47. package/template-mobile-vant-cli/src/assets/logo.png +0 -0
  48. package/template-mobile-vant-cli/src/components/PageContainer/ProSkeleton.tsx +29 -0
  49. package/template-mobile-vant-cli/src/components/PageContainer/index.tsx +207 -0
  50. package/template-mobile-vant-cli/src/components/PageContainer/style.module.less +17 -0
  51. package/template-mobile-vant-cli/src/components/TabsMenu/index.vue +45 -0
  52. package/template-mobile-vant-cli/src/core/gx-design/index.ts +7 -0
  53. package/template-mobile-vant-cli/src/core/index.ts +5 -0
  54. package/template-mobile-vant-cli/src/design/color.less +1 -0
  55. package/template-mobile-vant-cli/src/design/config.less +5 -0
  56. package/template-mobile-vant-cli/src/design/index.less +3 -0
  57. package/template-mobile-vant-cli/src/design/mixin.less +65 -0
  58. package/template-mobile-vant-cli/src/design/reset.less +39 -0
  59. package/template-mobile-vant-cli/src/design/root.less +3 -0
  60. package/template-mobile-vant-cli/src/design/vant/index.less +0 -0
  61. package/template-mobile-vant-cli/src/hooks/web/index.ts +5 -0
  62. package/template-mobile-vant-cli/src/hooks/web/usePageLoading.ts +56 -0
  63. package/template-mobile-vant-cli/src/layout/BasicLayout/index.vue +18 -0
  64. package/template-mobile-vant-cli/src/layout/BasicLayout/style.less +3 -0
  65. package/template-mobile-vant-cli/src/layout/UserLayout/index.vue +18 -0
  66. package/template-mobile-vant-cli/src/layout/UserLayout/style.module.less +36 -0
  67. package/template-mobile-vant-cli/src/main.ts +34 -0
  68. package/template-mobile-vant-cli/src/pages/Account/details.vue +13 -0
  69. package/template-mobile-vant-cli/src/pages/Account/index.vue +102 -0
  70. package/template-mobile-vant-cli/src/pages/Home/index.vue +71 -0
  71. package/template-mobile-vant-cli/src/pages/user/login/index.vue +76 -0
  72. package/template-mobile-vant-cli/src/plugins/dayjs/index.ts +3 -0
  73. package/template-mobile-vant-cli/src/plugins/index.ts +2 -0
  74. package/template-mobile-vant-cli/src/router/guard/index.ts +18 -0
  75. package/template-mobile-vant-cli/src/router/guard/permissions.ts +41 -0
  76. package/template-mobile-vant-cli/src/router/guard/stateGuard.ts +10 -0
  77. package/template-mobile-vant-cli/src/router/index.ts +31 -0
  78. package/template-mobile-vant-cli/src/router/routes/index.ts +46 -0
  79. package/template-mobile-vant-cli/src/router/routes/modules/dataSource.ts +32 -0
  80. package/template-mobile-vant-cli/src/services/index.ts +31 -0
  81. package/template-mobile-vant-cli/src/services/userCenter/account.ts +42 -0
  82. package/template-mobile-vant-cli/src/services/userCenter/index.ts +28 -0
  83. package/template-mobile-vant-cli/src/store/index.ts +20 -0
  84. package/template-mobile-vant-cli/src/store/modules/global.ts +23 -0
  85. package/template-mobile-vant-cli/src/store/modules/user.ts +107 -0
  86. package/template-mobile-vant-cli/src/utils/accessToken.ts +97 -0
  87. package/template-mobile-vant-cli/src/utils/crypto/index.ts +56 -0
  88. package/template-mobile-vant-cli/src/utils/env.ts +50 -0
  89. package/template-mobile-vant-cli/src/utils/pageTitle.ts +20 -0
  90. package/template-mobile-vant-cli/src/utils/request/XHR.ts +137 -0
  91. package/template-mobile-vant-cli/src/utils/request/axiosCancel.ts +69 -0
  92. package/template-mobile-vant-cli/src/utils/request/checkStatus.ts +25 -0
  93. package/template-mobile-vant-cli/src/utils/request/index.ts +155 -0
  94. package/template-mobile-vant-cli/src/utils/request/typings.ts +171 -0
  95. package/template-mobile-vant-cli/src/utils/storage.ts +215 -0
  96. package/template-mobile-vant-cli/src/utils/util.ts +27 -0
  97. package/template-mobile-vant-cli/src/utils/validate.ts +211 -0
  98. package/template-mobile-vant-cli/tsconfig.json +50 -0
  99. package/template-mobile-vant-cli/types/auto-imports.d.ts +80 -0
  100. package/template-mobile-vant-cli/types/components.d.ts +7 -0
  101. package/template-mobile-vant-cli/types/config.d.ts +56 -0
  102. package/template-mobile-vant-cli/types/global.d.ts +80 -0
  103. package/template-mobile-vant-cli/types/mock.d.ts +34 -0
  104. package/template-mobile-vant-cli/types/module.d.ts +61 -0
  105. package/template-mobile-vant-cli/types/response.d.ts +17 -0
  106. package/template-mobile-vant-cli/types/system.d.ts +58 -0
  107. package/template-mobile-vant-cli/types/vant-import.d.ts +25 -0
  108. package/template-mobile-vant-cli/unocss.config.ts +161 -0
  109. package/template-mobile-vant-cli/vite.config.ts +142 -0
  110. package/template-mobile-vant-html/README.md +4 -0
  111. package/template-mobile-vant-html/css/global.css +293 -0
  112. package/template-mobile-vant-html/css/global.css.map +1 -0
  113. package/template-mobile-vant-html/css/global.less +293 -0
  114. package/template-mobile-vant-html/css/index.css +20 -0
  115. package/template-mobile-vant-html/css/index.css.map +1 -0
  116. package/template-mobile-vant-html/css/index.less +21 -0
  117. package/template-mobile-vant-html/image/disconnected.svg +60 -0
  118. package/template-mobile-vant-html/image/empty.svg +52 -0
  119. package/template-mobile-vant-html/image/error.svg +53 -0
  120. package/template-mobile-vant-html/image/loading.svg +1 -0
  121. package/template-mobile-vant-html/index.html +91 -0
  122. package/template-mobile-vant-html/js/index.js +29 -0
  123. package/template-mobile-vant-html/js/plugin/day.min.js +1 -0
  124. package/template-mobile-vant-html/js/plugin/fastclick.js +730 -0
  125. package/template-mobile-vant-html/js/plugin/jquery.min.js +2 -0
  126. package/template-mobile-vant-html/js/plugin/rem.js +28 -0
  127. package/template-mobile-vant-html/js/utils/appUtil.js +70 -0
  128. package/template-mobile-vant-html/js/utils/config.js +3 -0
  129. package/template-mobile-vant-html/js/utils/request.js +61 -0
  130. package/template-mobile-vant-html/js/utils/utils.js +65 -0
  131. package/template-mobile-vant-html/js/utils/validate.js +292 -0
  132. package/template-vite-project/.env +5 -0
  133. package/template-vite-project/.env.development +5 -0
  134. package/template-vite-project/.env.pro +5 -0
  135. package/template-vite-project/.env.production +5 -0
  136. package/template-vite-project/README.md +5 -0
  137. package/template-vite-project/_gitignore +24 -0
  138. package/template-vite-project/index.html +46 -0
  139. package/template-vite-project/internal/proxy/index.ts +47 -0
  140. package/template-vite-project/internal/vite/generate/generateModifyVars.ts +9 -0
  141. package/template-vite-project/internal/vite/rollupOptions/index.ts +18 -0
  142. package/template-vite-project/internal/vite/util/hash.ts +17 -0
  143. package/template-vite-project/internal/vite/util/index.ts +132 -0
  144. package/template-vite-project/internal/vite/vite/cdn.ts +65 -0
  145. package/template-vite-project/internal/vite/vite/plugin/appConfig.ts +91 -0
  146. package/template-vite-project/internal/vite/vite/plugin/autoImport.ts +28 -0
  147. package/template-vite-project/internal/vite/vite/plugin/compress.ts +31 -0
  148. package/template-vite-project/internal/vite/vite/plugin/html.ts +24 -0
  149. package/template-vite-project/internal/vite/vite/plugin/index.ts +72 -0
  150. package/template-vite-project/internal/vite/vite/plugin/visualizer.ts +14 -0
  151. package/template-vite-project/internal/vite/vite/plugin/viteNotice.ts +40 -0
  152. package/template-vite-project/node_modules/.bin/cross-env +21 -0
  153. package/template-vite-project/node_modules/.bin/cross-env-shell +21 -0
  154. package/template-vite-project/node_modules/.bin/esbuild +21 -0
  155. package/template-vite-project/node_modules/.bin/jiti +21 -0
  156. package/template-vite-project/node_modules/.bin/lessc +21 -0
  157. package/template-vite-project/node_modules/.bin/parser +21 -0
  158. package/template-vite-project/node_modules/.bin/rollup +21 -0
  159. package/template-vite-project/node_modules/.bin/terser +21 -0
  160. package/template-vite-project/node_modules/.bin/tsc +21 -0
  161. package/template-vite-project/node_modules/.bin/tsserver +21 -0
  162. package/template-vite-project/node_modules/.bin/vite +21 -0
  163. package/template-vite-project/node_modules/.bin/vue-tsc +21 -0
  164. package/template-vite-project/node_modules/.bin/yaml +21 -0
  165. package/template-vite-project/package.json +38 -0
  166. package/template-vite-project/public/css/index.css +89 -0
  167. package/template-vite-project/public/css/normalize.css +396 -0
  168. package/template-vite-project/public/vite.svg +1 -0
  169. package/template-vite-project/src/App.vue +30 -0
  170. package/template-vite-project/src/assets/vue.svg +1 -0
  171. package/template-vite-project/src/components/HelloWorld.vue +41 -0
  172. package/template-vite-project/src/design/config.less +0 -0
  173. package/template-vite-project/src/design/index.less +0 -0
  174. package/template-vite-project/src/main.ts +14 -0
  175. package/template-vite-project/src/utils/env.ts +50 -0
  176. package/template-vite-project/tsconfig.app.json +59 -0
  177. package/template-vite-project/tsconfig.json +7 -0
  178. package/template-vite-project/tsconfig.node.json +28 -0
  179. package/template-vite-project/types/global.d.ts +33 -0
  180. package/template-vite-project/unocss.config.ts +208 -0
  181. package/template-vite-project/vite.config.ts +88 -0
@@ -0,0 +1,59 @@
1
+ {
2
+ "compilerOptions": {
3
+ // Base
4
+ "composite": false,
5
+ "target": "ESNext",
6
+
7
+ "moduleDetection": "force",
8
+ "experimentalDecorators": true,
9
+
10
+ "baseUrl": ".",
11
+ "module": "ESNext",
12
+
13
+ "resolveJsonModule": true,
14
+
15
+ "strict": true,
16
+ "strictNullChecks": true,
17
+ "noFallthroughCasesInSwitch": true,
18
+ "noImplicitAny": false,
19
+ "noImplicitOverride": true,
20
+ "noImplicitThis": true,
21
+ "noUnusedLocals": true,
22
+ "noUnusedParameters": true,
23
+
24
+ "inlineSources": false,
25
+ "noEmit": true,
26
+ "removeComments": true,
27
+ "sourceMap": false,
28
+ "allowSyntheticDefaultImports": true,
29
+ "esModuleInterop": true,
30
+ "forceConsistentCasingInFileNames": true,
31
+ "isolatedModules": true,
32
+ "verbatimModuleSyntax": true,
33
+ "skipLibCheck": true,
34
+ "preserveWatchOutput": true,
35
+
36
+ // Web App
37
+ "types": ["vite/client", "unplugin-turbo-console/client"],
38
+
39
+ // Web
40
+ "jsx": "preserve",
41
+ "jsxImportSource": "vue",
42
+ "lib": ["ESNext", "DOM", "DOM.Iterable"],
43
+ "useDefineForClassFields": true,
44
+ "moduleResolution": "bundler",
45
+ "declaration": false,
46
+
47
+ "paths": {
48
+ "@/*": ["src/*"]
49
+ }
50
+ },
51
+ "include": [
52
+ "src/**/*.ts",
53
+ "src/**/*.d.ts",
54
+ "src/**/*.tsx",
55
+ "src/**/*.vue",
56
+ "types/*.d.ts",
57
+ ],
58
+ "exclude": ["node_modules", "dist", "**/*.js"]
59
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "files": [],
3
+ "references": [
4
+ { "path": "./tsconfig.app.json" },
5
+ { "path": "./tsconfig.node.json" }
6
+ ]
7
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ESNext",
4
+ "lib": ["ESNext"],
5
+ "module": "ESNext",
6
+ "skipLibCheck": true,
7
+ /* Bundler mode */
8
+ "moduleResolution": "bundler",
9
+ "allowImportingTsExtensions": true,
10
+ "verbatimModuleSyntax": true,
11
+ "moduleDetection": "force",
12
+ "noEmit": true,
13
+
14
+ /* Linting */
15
+ "noUnusedLocals": true,
16
+ "noUnusedParameters": true,
17
+ "erasableSyntaxOnly": true,
18
+ "noFallthroughCasesInSwitch": true,
19
+ "noUncheckedSideEffectImports": true
20
+ },
21
+ "include": [
22
+ "internal/**/*.ts",
23
+ "internal/**/*.d.ts",
24
+ "types/*.d.ts",
25
+ "vite.config.ts"
26
+ ],
27
+ "exclude": ["node_modules", "**/*.js"]
28
+ }
@@ -0,0 +1,33 @@
1
+ declare const __APP_INFO__: {
2
+ pkg: {
3
+ name: string;
4
+ version: string;
5
+ dependencies: Recordable<string>;
6
+ devDependencies: Recordable<string>;
7
+ };
8
+ lastBuildTime: string;
9
+ }
10
+
11
+ declare type Recordable<T = any> = Record<string, T>
12
+
13
+ declare type StringNumber = string | number
14
+
15
+ declare type DefaultToT<T, R> = R extends undefined ? T : R
16
+
17
+ declare type DefaultToAndT<T, R> = R extends undefined ? T : T & R
18
+
19
+ declare interface Fn<T = any, R = T> {
20
+ (...arg: T[]): R;
21
+ }
22
+
23
+ declare interface ViteEnv {
24
+ VITE_USE_MODE: 'development' | 'production' | 'pro' | 'sit' | 'uat'
25
+ VITE_NODE_ENV: 'development' | 'production';
26
+ VITE_APP_ENV: 'dev' | 'pro'
27
+ VITE_BASE_URL: string;
28
+ // proxy 配置
29
+ VITE_PROXY_PREFIX: string;
30
+ }
31
+
32
+ declare interface Window {
33
+ }
@@ -0,0 +1,208 @@
1
+ import {
2
+ defineConfig,
3
+ presetAttributify,
4
+ presetUno,
5
+ transformerDirectives,
6
+ transformerVariantGroup
7
+ } from 'unocss'
8
+
9
+ function colorCssVar(val: string) {
10
+ let color = val.includes('rgb') || val.includes('#') ? val : `#${val}`
11
+ if (val === 'main') color = 'var(--gx-primary-color)'
12
+ if (val === 'error') color = 'var(--gx-error-color)'
13
+ if (val === 'split') color = 'var(--gx-split-color)'
14
+ if (val === 'border') color = 'var(--gx-color-border)'
15
+ return color
16
+ }
17
+
18
+ export default defineConfig({
19
+ presets: [
20
+ presetUno(),
21
+ presetAttributify()
22
+ ],
23
+ theme: {
24
+ breakpoints: {
25
+ sm: '600px',
26
+ md: '768px',
27
+ lg: '992px',
28
+ xl: '1200px',
29
+ xxl: '1600px'
30
+ }
31
+ },
32
+ transformers: [ transformerDirectives({
33
+ applyVariable: [ '--at-apply' ]
34
+ }), transformerVariantGroup() ],
35
+ shortcuts: [
36
+ {
37
+ 'w-h-full': 'w-full h-full',
38
+ 'flex-y': 'flex flex-col',
39
+ 'flex-x-center': 'flex items-center',
40
+ 'flex-y-center': 'flex items-center flex-col',
41
+ 'flex-center': 'flex items-center justify-center',
42
+ 'flex-col-center': 'flex items-center justify-center flex-col',
43
+ 'flex-between': 'flex items-center justify-between',
44
+ },
45
+ [ /^mobile-(.*)$/, ([ , str ]) => {
46
+ const pattern = /(\d+)px/
47
+ const match = str.match(pattern)
48
+ const pixelValue = match?.[1] // 提取到的像素值
49
+
50
+ if (pixelValue) {
51
+ const num = Number(pixelValue)
52
+ const replacement = `${num / 37.5}rem` // 要替换的像素值
53
+ const result = str.replace(pattern, replacement)
54
+ return result
55
+ }
56
+ return str
57
+ }],
58
+ ],
59
+ rules: [
60
+ [ /^text-rgba-(.*)$/, ([ , str ]) => {
61
+ const regex = /\[([^[\]]*)\]/
62
+ const match = str.match(regex)
63
+
64
+ if (match && match.length > 1) {
65
+ const contentInsideBrackets = match[1]
66
+ return {
67
+ color: `rgba(${contentInsideBrackets.split('-').join(',')})`
68
+ }
69
+ } else {
70
+ return {}
71
+ }
72
+ } ],
73
+ [ /^bg-rgba-(.*)$/, ([ , str ]) => {
74
+ const regex = /\[([^[\]]*)\]/
75
+ const match = str.match(regex)
76
+
77
+ if (match && match.length > 1) {
78
+ const contentInsideBrackets = match[1]
79
+ return {
80
+ 'background-color': `rgba(${contentInsideBrackets.split('-').join(',')})`
81
+ }
82
+ } else {
83
+ return {}
84
+ }
85
+ } ],
86
+ [ /^text-g-(.*)$/, ([ , str ]) => {
87
+ const regex = /\[([^[\]]*)\]/
88
+ const match = str.match(regex)
89
+
90
+ if (match && match.length > 1) {
91
+ const contentInsideBrackets = match[1]
92
+ if (contentInsideBrackets) {
93
+ const contents = contentInsideBrackets.split('-')
94
+ const size = contents[0] ? { 'font-size': `${contents[0]}px` } : {}
95
+ const lineHeight = contents[1] ? { 'line-height': `${contents[1]}px` } : {}
96
+ const font = contents[2] ? { 'font-weight': `${contents[2]}` } : {}
97
+ const color = contents[3]
98
+ ? { color: contents[3] === 'base' ? `var(--gx-color-text)` : contents[3] }
99
+ : {}
100
+ return {
101
+ ...size,
102
+ ...lineHeight,
103
+ ...font,
104
+ ...color
105
+ } as any
106
+ }
107
+ return {}
108
+ } else {
109
+ return {}
110
+ }
111
+ } ],
112
+ [
113
+ /^bd-(.*)$/,
114
+ ([, str]) => {
115
+ return {
116
+ 'border': `1px solid ${colorCssVar(str)}`
117
+ }
118
+ }
119
+ ],
120
+ [
121
+ /^bd-t-(.*)$/,
122
+ ([, str]) => {
123
+ return {
124
+ 'border-top': `1px solid ${colorCssVar(str)}`
125
+ }
126
+ }
127
+ ],
128
+ [
129
+ /^bd-b-(.*)$/,
130
+ ([, str]) => {
131
+ return {
132
+ 'border-bottom': `1px solid ${colorCssVar(str)}`
133
+ }
134
+ }
135
+ ],
136
+ [
137
+ /^bd-l-(.*)$/,
138
+ ([, str]) => {
139
+ return {
140
+ 'border-left': `1px solid ${colorCssVar(str)}`
141
+ }
142
+ }
143
+ ],
144
+ [
145
+ /^bd-r-(.*)$/,
146
+ ([, str]) => {
147
+ return {
148
+ 'border-right': `1px solid ${colorCssVar(str)}`
149
+ }
150
+ }
151
+ ],
152
+ [ /^text-hidden-(\d+)$/, ([ , d ]) => ({
153
+ 'overflow': 'hidden',
154
+ 'text-overflow': 'ellipsis',
155
+ 'display': '-webkit-box',
156
+ '-webkit-line-clamp': d,
157
+ 'line-clamp': d,
158
+ '-webkit-box-orient': 'vertical',
159
+ 'word-break': 'break-word'
160
+ }) ],
161
+ [ 'p-base', { 'padding': 'var(--base-padding)' } ],
162
+ [ 'p-base-2', { 'padding': 'calc(var(--base-padding) * 2)' } ],
163
+ [ 'c-content', { 'max-width': 'calc(var(--gx-pro-content-max-width) + var(--base-padding) * 2)', 'min-width': 'var(--gx-pro-content-min-width)' } ],
164
+ [ 'max-c-content', { 'max-width': 'calc(var(--gx-pro-content-max-width) + var(--base-padding) * 2)' } ],
165
+ [ 'max-c-p-content', { 'max-width': 'calc(var(--gx-pro-content-max-width) + var(--base-padding) * 2)', 'padding-inline': 'var(--base-padding)' } ],
166
+ [ 'op-visible', { 'opacity': '1', 'visibility': 'visible' } ],
167
+ [ 'hidden-none', { 'opacity': '0', 'visibility': 'hidden' } ],
168
+ [ /^flex-main-(\d+)$/, ([ , d ]) => ({
169
+ 'flex': `0 0 ${d}px`
170
+ }) ],
171
+ [ /^shrink-(\d+)$/, ([ , d ]) => ({
172
+ 'flex-shrink': d
173
+ }) ],
174
+ [ 'text-base', { 'color': 'var(--gx-color-text)' } ],
175
+ [ 'text-quaternary', { 'color': 'var(--gx-color-text-quaternary)' } ],
176
+ [ 'text-description', { 'color': 'var(--gx-color-text-description)' } ],
177
+ [ 'text-hex-main', { 'color': 'var(--gx-primary-color)' } ],
178
+ [ 'text-hex-error', { 'color': 'var(--gx-error-color)' } ],
179
+ [ 'rd-base', { 'border-radius': 'var(--gx-border-radius)' } ],
180
+ [ 'bg-hex-main', { 'background': 'var(--gx-primary-color)' } ],
181
+ [ 'bg-split', { 'background': 'var(--gx-split-color)' } ],
182
+ [ 'word-break-all', { 'word-break': 'break-all' } ],
183
+ [ 'word-break-word', { 'word-break': 'break-word' } ],
184
+ [ 'truncate', { 'text-overflow': 'ellipsis', 'overflow': 'hidden', 'white-space': 'nowrap' } ],
185
+ [ 'flex-main', { 'flex': '1' } ],
186
+ [ 'position-all', { 'position': 'absolute', 'top': '0', 'bottom': '0', 'left': '0', 'right': '0' } ],
187
+ [ 'image-event-none', { 'user-select': 'none', 'pointer-events': 'none' } ],
188
+ [
189
+ 'position-center', {
190
+ 'left': '50%',
191
+ 'top': '50%',
192
+ 'transform': 'translate(-50%, -50%)'
193
+ }
194
+ ],
195
+ [
196
+ 'position-center-x', {
197
+ 'left': '50%',
198
+ 'transform': 'translateX(-50%)'
199
+ }
200
+ ],
201
+ [
202
+ 'position-center-y', {
203
+ 'top': '50%',
204
+ 'transform': 'translateY(-50%)'
205
+ }
206
+ ]
207
+ ]
208
+ })
@@ -0,0 +1,88 @@
1
+ import type { ConfigEnv, UserConfig } from 'vite'
2
+ import autoprefixer from 'autoprefixer'
3
+ import dayjs from 'dayjs'
4
+ import { loadEnv } from 'vite'
5
+
6
+ import { createProxy } from './internal/proxy'
7
+ import { generateModifyVars } from './internal/vite/generate/generateModifyVars'
8
+ import createRollupOptions from './internal/vite/rollupOptions'
9
+ import { pathResolve, wrapperEnv } from './internal/vite/util'
10
+
11
+ import { createVitePlugins } from './internal/vite/vite/plugin'
12
+
13
+ import pkg from './package.json'
14
+
15
+ const { dependencies, devDependencies, name, version } = pkg
16
+
17
+ const __APP_INFO__ = {
18
+ pkg: { dependencies, devDependencies, name, version },
19
+ lastBuildTime: dayjs().format('YYYY-MM-DD HH:mm:ss')
20
+ }
21
+
22
+ process.env.VUE_APP_VERSION = version
23
+
24
+ export default async ({ command, mode }: ConfigEnv): Promise<UserConfig> => {
25
+ const root = process.cwd()
26
+
27
+ const env = loadEnv(mode, root)
28
+
29
+ // The boolean type read by loadEnv is a string. This function can be converted to boolean type
30
+ const viteEnv = wrapperEnv(env)
31
+
32
+ const { VITE_APP_ENV, VITE_PROXY_PREFIX } = viteEnv
33
+
34
+ const isBuild = command === 'build'
35
+
36
+ return {
37
+ base: './',
38
+ root,
39
+ resolve: {
40
+ alias: [
41
+ {
42
+ find: '@',
43
+ replacement: pathResolve('src') + '/'
44
+ }
45
+ ]
46
+ },
47
+ server: {
48
+ open: false,
49
+ host: true,
50
+ proxy: createProxy(VITE_PROXY_PREFIX)[VITE_APP_ENV]
51
+ },
52
+ build: {
53
+ chunkSizeWarningLimit: 4000,
54
+ rollupOptions: createRollupOptions()
55
+ },
56
+ define: {
57
+ __INTLIFY_PROD_DEVTOOLS__: false,
58
+ __APP_INFO__: JSON.stringify(__APP_INFO__)
59
+ },
60
+ css: {
61
+ postcss: {
62
+ plugins: [
63
+ autoprefixer({
64
+ grid: true
65
+ }),
66
+ ]
67
+ },
68
+ modules: {
69
+ generateScopedName: 'gx-pro-[local]-[hash:base64:5]'
70
+ },
71
+ preprocessorOptions: {
72
+ less: {
73
+ modifyVars: generateModifyVars(),
74
+ javascriptEnabled: true
75
+ }
76
+ }
77
+ },
78
+
79
+ plugins: await createVitePlugins(viteEnv, isBuild),
80
+
81
+ optimizeDeps: {
82
+ include: [
83
+ 'dayjs',
84
+ '@vueuse/core'
85
+ ]
86
+ }
87
+ }
88
+ }