web-component-gallery 2.1.22 → 2.2.0
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/extensions/BuildTheme.js +9 -7
- package/extensions/UpdateTheme.js +11 -4
- package/extensions/index.js +2 -2
- package/lib/style/page.less +0 -3
- package/package.json +1 -1
package/extensions/BuildTheme.js
CHANGED
|
@@ -103,12 +103,12 @@ async function processLessFiles(theme) {
|
|
|
103
103
|
fs.writeFileSync(outputPath, processedContent)
|
|
104
104
|
|
|
105
105
|
// 转换为 "xxx:111;" 格式
|
|
106
|
-
const formattedString = Object.entries(fileAVariables)
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
// const formattedString = Object.entries(fileAVariables)
|
|
107
|
+
// .map(([key, value]) => `${key}: ${value};`)
|
|
108
|
+
// .join('\n') // 每行一个键值对
|
|
109
109
|
|
|
110
|
-
const themeOutputPath = path.join(basePath, `${theme}.less`)
|
|
111
|
-
fs.writeFileSync(themeOutputPath, formattedString)
|
|
110
|
+
// const themeOutputPath = path.join(basePath, `${theme}.less`)
|
|
111
|
+
// fs.writeFileSync(themeOutputPath, formattedString)
|
|
112
112
|
|
|
113
113
|
return fileAVariables
|
|
114
114
|
} catch (error) {
|
|
@@ -203,9 +203,11 @@ function createGeneratorTheme(theme) {
|
|
|
203
203
|
const options = {
|
|
204
204
|
antDir: path.join(hostPath, 'ant-design-vue'),
|
|
205
205
|
// 指定项目自定义样式文件目录
|
|
206
|
-
stylesDir: path.join(hostPath, '
|
|
206
|
+
stylesDir: path.join(hostPath, 'ant-design-vue/lib/style/themes'),
|
|
207
|
+
// 指定项目自定义样式文件目录
|
|
208
|
+
// stylesDir: path.join(hostPath, '../src/styles'),
|
|
207
209
|
// 指定自定义主题变量文件路径
|
|
208
|
-
varFile: path.join(hostPath, `../src/styles/${resetTheme}.less`),
|
|
210
|
+
// varFile: path.join(hostPath, `../src/styles/${resetTheme}.less`),
|
|
209
211
|
// 列出需要动态替换的主题变量
|
|
210
212
|
themeVariables: Object.keys(themeVariables).filter(key => !notIncludes.includes(key)),
|
|
211
213
|
outputFilePath: path.join(hostPath, '../public/static/style/antdVue.less')
|
|
@@ -7,14 +7,21 @@ const colorPalette = require('../utils/ColorPalette')
|
|
|
7
7
|
|
|
8
8
|
// 获取并解析LESS文件
|
|
9
9
|
async function fetchAndParseLessFile(fileName, isParseVariables) {
|
|
10
|
-
//
|
|
11
|
-
let origin =
|
|
10
|
+
// 确定请求源地址
|
|
11
|
+
let origin = 'http://qxfnkj.com'
|
|
12
|
+
|
|
13
|
+
// 浏览器环境:使用当前页面的origin
|
|
14
|
+
if (typeof window !== 'undefined' && window.location && window.location.origin && process.env.NODE_ENV !== 'development') origin = window.location.origin
|
|
15
|
+
|
|
12
16
|
const response = await fetch(`${origin}/base-subject/themes/${fileName}.less`)
|
|
17
|
+
|
|
18
|
+
if (!response.ok) throw new Error(`${fileName}文件请求失败!`)
|
|
19
|
+
|
|
13
20
|
const responseText = await response.text()
|
|
14
21
|
|
|
15
22
|
return isParseVariables
|
|
16
|
-
|
|
17
|
-
|
|
23
|
+
? await parseLessVariables(responseText)
|
|
24
|
+
: responseText
|
|
18
25
|
}
|
|
19
26
|
|
|
20
27
|
// 解析LESS变量
|
package/extensions/index.js
CHANGED
|
@@ -22,7 +22,7 @@ import PageLoading from "./PageLoading"
|
|
|
22
22
|
* 全局切换主题
|
|
23
23
|
* @theme 主题key 使用方法: this.$setTheme(@theme)
|
|
24
24
|
* */
|
|
25
|
-
|
|
25
|
+
import { updateTheme } from './UpdateTheme'
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* 全局挂载组件自定义指令
|
|
@@ -57,7 +57,7 @@ export default {
|
|
|
57
57
|
/** 加载便捷弹窗等 */
|
|
58
58
|
Vue.use(Dialog)
|
|
59
59
|
Vue.use(PageLoading)
|
|
60
|
-
|
|
60
|
+
Vue.prototype.$setTheme = updateTheme
|
|
61
61
|
|
|
62
62
|
// 指令注册
|
|
63
63
|
Object.keys(Directives).forEach(key => {
|
package/lib/style/page.less
CHANGED