@varlet/cli 1.27.17 → 1.27.20-alpha.1660211980346
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/generators/config/default/base/package.json +7 -1
- package/generators/config/i18n/base/package.json +7 -1
- package/lib/commands/commitLint.js +1 -1
- package/lib/commands/release.js +7 -6
- package/lib/config/vite.config.js +1 -1
- package/package.json +10 -11
- package/site/pc/pages/index/index.less +91 -161
- package/site/pc/pages/index/index.vue +38 -63
- package/site/pc/pages/index/locale/en-US.ts +1 -5
- package/site/pc/pages/index/locale/zh-CN.ts +1 -5
- package/varlet.default.config.js +83 -10
|
@@ -15,6 +15,12 @@
|
|
|
15
15
|
"UI"
|
|
16
16
|
],
|
|
17
17
|
"license": "MIT",
|
|
18
|
+
"sideEffects": [
|
|
19
|
+
"es/**/style/*",
|
|
20
|
+
"lib/**/style/*",
|
|
21
|
+
"*.css",
|
|
22
|
+
"*.less"
|
|
23
|
+
],
|
|
18
24
|
"scripts": {
|
|
19
25
|
"preinstall": "npx only-allow pnpm",
|
|
20
26
|
"dev": "varlet-cli dev",
|
|
@@ -95,5 +101,5 @@
|
|
|
95
101
|
"Chrome >= 51",
|
|
96
102
|
"iOS >= 10"
|
|
97
103
|
],
|
|
98
|
-
"packageManager": "pnpm@
|
|
104
|
+
"packageManager": "pnpm@7.9.0"
|
|
99
105
|
}
|
|
@@ -15,6 +15,12 @@
|
|
|
15
15
|
"UI"
|
|
16
16
|
],
|
|
17
17
|
"license": "MIT",
|
|
18
|
+
"sideEffects": [
|
|
19
|
+
"es/**/style/*",
|
|
20
|
+
"lib/**/style/*",
|
|
21
|
+
"*.css",
|
|
22
|
+
"*.less"
|
|
23
|
+
],
|
|
18
24
|
"scripts": {
|
|
19
25
|
"preinstall": "npx only-allow pnpm",
|
|
20
26
|
"dev": "varlet-cli dev",
|
|
@@ -95,5 +101,5 @@
|
|
|
95
101
|
"Chrome >= 51",
|
|
96
102
|
"iOS >= 10"
|
|
97
103
|
],
|
|
98
|
-
"packageManager": "pnpm@
|
|
104
|
+
"packageManager": "pnpm@7.9.0"
|
|
99
105
|
}
|
|
@@ -11,7 +11,7 @@ function isVersion(message) {
|
|
|
11
11
|
}
|
|
12
12
|
function commitLint(gitParams) {
|
|
13
13
|
var message = require('fs').readFileSync(gitParams, 'utf-8').trim();
|
|
14
|
-
var COMMIT_MESSAGE_RE = /^(revert|fix|feat|docs|perf|test|types|style|build|chore|release|refactor)(\(.+\))
|
|
14
|
+
var COMMIT_MESSAGE_RE = /^(revert|fix|feat|docs|perf|test|types|style|build|chore|release|refactor)(\(.+\))?!?: (.|\n)+/;
|
|
15
15
|
if (!isVersion(message) && !COMMIT_MESSAGE_RE.test(message)) {
|
|
16
16
|
logger_1.default.error("Commit message invalid");
|
|
17
17
|
logger_1.default.warning("The rules for commit messages are as follows\n\nExample:\n\nfeat: add a new feature\nfeat(ui/button): add a new feature in the ui/button scope\n\nfix: fix a bug\nfix(ui/button): fix a bug in the ui/button scope\n\ndocs: fix an error in the documentation\ndocs(ui/button): fix a documentation error in the ui/button scope\n\nAllowed types:\n- fix\n- feat\n- docs\n- perf\n- test\n- types\n- style\n- build\n- chore\n- release\n- refactor\n- revert\n\nCommit message reference: https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y\n\u53C2\u8003\u962E\u4E00\u5CF0Commit message\u7F16\u5199\u6307\u5357: https://www.ruanyifeng.com/blog/2016/01/commit_message_change_log.html");
|
package/lib/commands/release.js
CHANGED
|
@@ -228,17 +228,18 @@ function release(cmd) {
|
|
|
228
228
|
return [2 /*return*/];
|
|
229
229
|
}
|
|
230
230
|
updateVersion(expectVersion);
|
|
231
|
-
|
|
232
|
-
return [4 /*yield*/, (0, changelog_1.changelog)()];
|
|
231
|
+
return [4 /*yield*/, publish(isPreRelease)];
|
|
233
232
|
case 5:
|
|
234
233
|
_b.sent();
|
|
235
|
-
return [
|
|
234
|
+
if (!!isPreRelease) return [3 /*break*/, 8];
|
|
235
|
+
return [4 /*yield*/, (0, changelog_1.changelog)()];
|
|
236
236
|
case 6:
|
|
237
237
|
_b.sent();
|
|
238
|
-
|
|
239
|
-
case 7:
|
|
240
|
-
case 8:
|
|
238
|
+
return [4 /*yield*/, pushGit(expectVersion, cmd.remote)];
|
|
239
|
+
case 7:
|
|
241
240
|
_b.sent();
|
|
241
|
+
_b.label = 8;
|
|
242
|
+
case 8:
|
|
242
243
|
logger_1.default.success("Release version ".concat(expectVersion, " successfully!"));
|
|
243
244
|
if (!isPreRelease) return [3 /*break*/, 13];
|
|
244
245
|
_b.label = 9;
|
|
@@ -64,7 +64,7 @@ function getBuildConfig(varletConfig) {
|
|
|
64
64
|
var devConfig = getDevConfig(varletConfig);
|
|
65
65
|
return __assign(__assign({}, devConfig), { base: './', build: {
|
|
66
66
|
outDir: constant_1.SITE_OUTPUT_PATH,
|
|
67
|
-
|
|
67
|
+
reportCompressedSize: false,
|
|
68
68
|
emptyOutDir: true,
|
|
69
69
|
cssTarget: 'chrome61',
|
|
70
70
|
rollupOptions: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@varlet/cli",
|
|
3
|
-
"version": "1.27.
|
|
3
|
+
"version": "1.27.20-alpha.1660211980346",
|
|
4
4
|
"description": "cli of varlet",
|
|
5
5
|
"bin": {
|
|
6
6
|
"varlet-cli": "./lib/index.js"
|
|
@@ -28,16 +28,16 @@
|
|
|
28
28
|
"url": "https://github.com/varletjs/varlet/issues"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@varlet/icons": "1.27.
|
|
32
|
-
"@varlet/shared": "1.27.
|
|
33
|
-
"@varlet/markdown-vite-plugin": "1.27.
|
|
34
|
-
"@varlet/touch-emulator": "1.27.
|
|
31
|
+
"@varlet/icons": "1.27.20-alpha.1660211980346",
|
|
32
|
+
"@varlet/shared": "1.27.20-alpha.1660211980346",
|
|
33
|
+
"@varlet/markdown-vite-plugin": "1.27.20-alpha.1660211980346",
|
|
34
|
+
"@varlet/touch-emulator": "1.27.20-alpha.1660211980346",
|
|
35
35
|
"@babel/core": "^7.14.8",
|
|
36
36
|
"@babel/helper-plugin-utils": "^7.14.5",
|
|
37
37
|
"@babel/preset-env": "^7.14.8",
|
|
38
38
|
"@babel/preset-typescript": "^7.14.5",
|
|
39
|
-
"@vitejs/plugin-vue": "
|
|
40
|
-
"@vitejs/plugin-vue-jsx": "
|
|
39
|
+
"@vitejs/plugin-vue": "3.0.1",
|
|
40
|
+
"@vitejs/plugin-vue-jsx": "2.0.0",
|
|
41
41
|
"@vue/babel-plugin-jsx": "1.1.1",
|
|
42
42
|
"@vue/compiler-sfc": "3.2.25",
|
|
43
43
|
"@vue/runtime-core": "3.2.25",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"slash": "^3.0.0",
|
|
61
61
|
"ts-jest": "^26.5.1",
|
|
62
62
|
"typescript": "^4.4.4",
|
|
63
|
-
"vite": "
|
|
63
|
+
"vite": "3.0.4",
|
|
64
64
|
"vite-plugin-html": "^2.1.0",
|
|
65
65
|
"vue": "3.2.25",
|
|
66
66
|
"vue-jest": "^5.0.0-alpha.8"
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"@types/semver": "^7.3.9"
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|
|
79
|
-
"@varlet/touch-emulator": "1.27.
|
|
79
|
+
"@varlet/touch-emulator": "1.27.20-alpha.1660211980346",
|
|
80
80
|
"@vue/test-utils": "^2.0.0-rc.6",
|
|
81
81
|
"clipboard": "^2.0.6",
|
|
82
82
|
"live-server": "^1.2.1",
|
|
@@ -88,6 +88,5 @@
|
|
|
88
88
|
"scripts": {
|
|
89
89
|
"dev": "tsc --watch",
|
|
90
90
|
"build": "tsc"
|
|
91
|
-
}
|
|
92
|
-
"readme": "# @varlet/cli\n\n开箱即用的 `Vue3组件库` 快速成型工具,提供了一系列命令和工具去解决组件库开发上的问题\n\n### 特性\n\n- 1.开箱即用的组件库开发环境\n- 2.开箱即用的组件库编译工具,支持导出 `esm` 和 `umd` 两种模块代码\n- 3.基于配置文件的组件库文档站点,支持百度统计和主题定制\n- 4.支持 `单文件组件(sfc)` 和 `tsx,jsx` 两种风格的组件库编写风格\n- 5.开箱即用的代码检查工具\n- 6.开箱即用的单元测试工具\n- 7.开箱即用的代码发布工具,发布到 npm 和 github, 并自动生成更新日志\n- 8.支持 `Typescript`\n- 9.支持 `暗黑模式`\n- 10.基于 `pnpm`\n\n### 快速开始\n\n`@varlet/cli` 内置了 `单文件组件(sfc)` 和 `tsx, jsx` 两种风格的组件库项目模板,可以通过 `gen` 命令直接生成。\n帮助用户直接进入组件本身的开发,推荐使用 `pnpm` 作为包管理工具。\n\n```shell\n# 安装命令行工具\npnpm add @varlet/cli -g\n# 使用 gen 命令生成项目\nvarlet-cli gen 项目名\ncd 项目名\npnpm install\npnpm dev\n```\n\n然后通过简单修改一些组件库模板的基础信息,就可以开始组件库的开发了\n\n## 高级定制\n\n### 配置文件\n\n项目根目录下的 `varlet.config.js` 用来管理整个组件库项目的具体细节\n\n| 参数 | 说明 | 类型 | 默认值 |\n| ----- | -------------- | -------- | ---------- |\n| `host` | 开发服务器主机 | _number_ | `localhost` |\n| `port` | 开发服务器端口 | _number_ | `8080` |\n| `name` | 组件库全名\t| _string_ | `Varlet` |\n| `namespace` | 组件库命名空间, 会作为组件前缀 | _string_ | `var` |\n| `title` | 文档中组件库的标题 | _string_ | `VARLET` |\n| `logo` | 文档中组件库的logo | _string_ | `-` |\n| `defaultLanguage` | 文档默认语言 | _string_ | `zh-CN` |\n| `useMobile` | 是否显示右侧手机预览 | _boolean_ | `false` |\n| `themes` | 文档主题 | _SiteThemes_ | `-` |\n| `darkThemes` | 暗黑模式文档主题 | _SiteThemes_ | `-` |\n| `highlight` | 文档代码片段样式相关 | _SiteHighlight_ | `-` |\n| `analysis` | 文档统计相关 | _SiteAnalysis_ | `-` |\n| `pc` | pc端文档结构配置 | _SitePC_ | `-` |\n| `mobile` | mobile端文档结构配置 | _SiteMobile_ | `-` |\n| `moduleCompatible` | 模块兼容配置 | _Record<string, string>_ | `-` |\n\n#### 模块适配对象\n\n一些外部依赖可能需要进行模块语法的适配,以达到可以正确编译到 `commonjs` 和 `esmodule` 的目的,例如 `dayjs` 的 `esmodule` 写法是\n\n```js\nimport dayjs from 'dayjs/esm'\n```\n\n而为了构建 `commonjs` 时的写法是\n\n```js\nimport * as dayjs from 'dayjs'\n```\n\n在项目中我们拥抱 `esmodule` 模块使用第一种写法,并做如下配置进行适配\n\n```js\n// varlet.config.js\nmodule.exports = {\n moduleCompatible: {\n \"import dayjs from 'dayjs/esm'\\n\": \"import * as dayjs from 'dayjs'\\n\"\n }\n}\n```\n\n#### SiteThemes\n\n主题变量相关,由于默认的主题变量可能时常修改,以 `varlet` 官方文档的主题为准\n\n| 参数 |\n| ----- |\n| `color-body` |\n| `color-bar` |\n| `color-sub-bar` |\n| `color-text` |\n| `color-sub-text` |\n| `color-border` |\n| `color-shadow` |\n| `color-introduce-border` |\n| `color-primary` |\n| `color-link` |\n| `color-type` |\n| `color-progress` |\n| `color-progress-track` |\n| `color-side-bar` |\n| `color-side-bar-active-background` |\n| `color-app-bar` |\n| `color-nav-button-hover-background` |\n| `color-mobile-cell-hover` |\n| `color-pc-language-active` |\n| `color-pc-language-active-background` |\n| `color-mobile-language-active` |\n| `color-mobile-language-active-background` |\n| `color-hl-background` |\n| `color-hl-code` |\n| `color-hl-border` |\n| `color-hl-group-a` |\n| `color-hl-group-b` |\n| `color-hl-group-c` |\n| `color-hl-group-d` |\n| `color-hl-group-e` |\n| `color-hl-group-f` |\n| `color-hl-group-g` |\n| `color-hl-group-h` |\n| `color-hl-group-i` |\n\n#### SiteHighlight\n\n代码片段高亮,基于[highlight.js](https://highlightjs.org/)\n\n| 参数 | 说明 | 类型 | 默认值 |\n| ----- | -------------- | -------- | ---------- |\n| `style` | highlight的css地址 | _string_ | `-` |\n\n#### SiteAnalysis\n\n统计埋点相关\n\n| 参数 | 说明 | 类型 | 默认值 |\n| ----- | -------------- | -------- | ---------- |\n| `baidu` | 百度统计脚本地址 | _string_ | `-` |\n\n#### SitePC, SiteMobile\n\n文档结构部分相关,示例配置如下\n\n```js\nmodule.exports = {\n pc: {\n redirect: '/home',\n title: {\n 'zh-CN': '一个组件库',\n },\n header: {\n darkMode: null,\n i18n: null,\n github: 'https://github.com/varletjs/varlet',\n },\n menu: [\n {\n text: {\n 'zh-CN': '开发指南',\n },\n // 侧边栏菜单目录\n type: 1,\n },\n {\n text: {\n 'zh-CN': '基本介绍',\n },\n doc: 'home',\n // 索引项目根目录下的md文档\n type: 3,\n },\n {\n text: {\n 'zh-CN': '基础组件',\n },\n type: 1,\n },\n {\n text: {\n 'zh-CN': 'Button 按钮',\n },\n doc: 'button',\n // 索引组件根目录下的md文档\n type: 2,\n },\n ],\n },\n mobile: {\n redirect: '/home',\n title: {\n 'zh-CN': '一个组件库',\n },\n header: {\n darkMode: null,\n i18n: null,\n playground: null,\n github: 'https://github.com/varletjs/varlet',\n },\n },\n}\n```\n\n### 命令相关\n\n#### 启动开发服务器\n\n```shell\nvarlet-cli dev\n```\n\n#### 构建文档站点\n\n```shell\nvarlet-cli build\n```\n\n#### 预览文档站点\n\n```shell\nvarlet-cli preview\n```\n\n#### 构建组件库代码\n\n```shell\nvarlet-cli compile\n```\n\n#### 执行所有的单元测试\n\n```shell\nvarlet-cli test\n```\n\n#### 以 watch 模式执行单元测试\n\n```shell\nvarlet-cli test -w\nor\nvarlet-cli test -wa\n```\n\n#### 检查代码\n\n```shell\nvarlet-cli lint\n```\n\n#### 校验提交信息\n\n```shell\nvarlet-cli commit-lint\n```\n\n#### 生成更新日志\n\n```shell\nvarlet-cli changelog\n```\n\n#### 发布组件库\n\n```shell\nvarlet-cli release\n```\n\n#### 生成一个项目模板\n```shell\nvarlet-cli gen <projectName>\n```\n\n### babel\n\n对 `babel` 进行配置,首先在 `package.json` 中指定目标浏览器\n\n```json\n{\n \"browserslist\": [\n \"Chrome >= 51\",\n \"iOS >= 10\"\n ]\n}\n```\n\n创建 `babel.config,js`\n\n```js\n// babel.config.js\nmodule.exports = {\n presets: [\n [\n '@varlet/cli/preset',\n {\n loose: process.env.NODE_ENV === 'compile',\n },\n ],\n ],\n}\n```\n\n### git 和 npm\n\n#### git-hook\n\n`simple-git-hooks`,`lint-staged` 配合 `eslint`,`stylelint`,`varlet-cli commit-lint` 做commit前的检查,`package.json` 配置如下\n\n```json\n{\n \"simple-git-hooks\": {\n \"pre-commit\": \"pnpm exec lint-staged --allow-empty --concurrent false\",\n \"commit-msg\": \"npx --no-install varlet-cli commit-lint $1\"\n },\n \"lint-staged\": {\n \"*.{ts,tsx,js,vue,less}\": \"prettier --write\",\n \"*.{ts,tsx,js,vue}\": \"eslint --fix\",\n \"*.{vue,css,less}\": \"stylelint --fix\"\n },\n \"eslintConfig\": {\n \"root\": true,\n \"ignorePatterns\": [\n \"es/**\",\n \"umd/**\",\n \"site/**\",\n \"public/**\",\n \"src/*/__tests__/**\",\n \".varlet/**\"\n ],\n \"extends\": [\n \"@varlet\"\n ]\n },\n \"stylelint\": {\n \"extends\": [\n \"@varlet/stylelint-config\"\n ],\n \"ignoreFiles\": [\n \"es/**\",\n \"umd/**\",\n \"site/**\",\n \"coverage/**\",\n \"public/**\",\n \"highlight/**\"\n ]\n }\n}\n```\n\n挂载钩子\n\n```shell\nnpx simple-git-hooks\n```\n\n创建 `.prettierignore`\n\n```text\n// .prettierignore\ncoverage/**\nes/**\numd/**\nsite/**\npublic/**\nsrc/*/__tests__/**\n*.md\n```\n\n### typescript\n\n创建 `tsconfig.json`\n\n```json\n{\n \"compilerOptions\": {\n \"strict\": true,\n \"downlevelIteration\": true,\n \"declaration\": true,\n \"skipLibCheck\": true,\n \"esModuleInterop\": true,\n \"allowJs\": true,\n \"lib\": [\"esnext\", \"dom\"],\n \"allowSyntheticDefaultImports\": true,\n \"jsx\": \"preserve\"\n }\n}\n```\n\n#### 发布前注意\n\n1. `npm` 的仓库源必须指向 `npm` 官方镜像\n2. 执行 `npm login` 进行登录\n\n### Contributors\n\n<a href=\"https://github.com/varletjs/varlet/graphs/contributors\">\n <img src=\"https://contrib.rocks/image?repo=haoziqaq/varlet\" />\n</a>"
|
|
91
|
+
}
|
|
93
92
|
}
|
|
@@ -1,194 +1,124 @@
|
|
|
1
|
-
|
|
2
|
-
position: relative;
|
|
3
|
-
width: 100vw;
|
|
4
|
-
height: 100vh;
|
|
5
|
-
box-sizing: border-box;
|
|
6
|
-
min-width: 1200px;
|
|
7
|
-
background: var(--site-config-color-home-page-background);
|
|
8
|
-
overflow: hidden;
|
|
9
|
-
display: flex;
|
|
10
|
-
align-items: center;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
@keyframes fade-in {
|
|
1
|
+
@keyframes logo-wave {
|
|
14
2
|
0% {
|
|
15
|
-
|
|
16
|
-
transform: translateX(-100%);
|
|
3
|
+
transform: translate(8%, 8%);
|
|
17
4
|
}
|
|
18
5
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
opacity: 1;
|
|
22
|
-
transform: translateX(0%);
|
|
6
|
+
20% {
|
|
7
|
+
transform: translate(-8%, 8%);
|
|
23
8
|
}
|
|
24
|
-
}
|
|
25
9
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
transform: rotate(90deg);
|
|
29
|
-
;
|
|
10
|
+
40% {
|
|
11
|
+
transform: translate(-8%, -8%);
|
|
30
12
|
}
|
|
31
13
|
|
|
32
|
-
|
|
33
|
-
transform:
|
|
14
|
+
60% {
|
|
15
|
+
transform: translate(-2%, 8%);
|
|
34
16
|
}
|
|
35
|
-
}
|
|
36
17
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
transform: rotate(90deg);
|
|
40
|
-
;
|
|
18
|
+
80% {
|
|
19
|
+
transform: translate(8%, -8%);
|
|
41
20
|
}
|
|
42
21
|
|
|
43
|
-
|
|
44
|
-
transform:
|
|
22
|
+
100% {
|
|
23
|
+
transform: translate(8%, 8%);
|
|
45
24
|
}
|
|
46
25
|
}
|
|
47
26
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
27
|
+
.varlet-doc-index {
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
align-items: center;
|
|
31
|
+
min-height: 100vh;
|
|
32
|
+
box-sizing: border-box;
|
|
33
|
+
background: var(--site-config-color-index-page-background);
|
|
34
|
+
|
|
35
|
+
&__layout {
|
|
36
|
+
display: flex;
|
|
37
|
+
flex-direction: column;
|
|
38
|
+
align-items: center;
|
|
39
|
+
padding: 100px;
|
|
40
|
+
max-width: 1200px;
|
|
52
41
|
}
|
|
53
42
|
|
|
54
|
-
|
|
55
|
-
|
|
43
|
+
&__logo {
|
|
44
|
+
width: 100%;
|
|
45
|
+
height: 100%;
|
|
46
|
+
flex-shrink: 0;
|
|
47
|
+
z-index: 2;
|
|
56
48
|
}
|
|
57
|
-
}
|
|
58
49
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
;
|
|
50
|
+
&__logo-container {
|
|
51
|
+
position: relative;
|
|
52
|
+
display: flex;
|
|
53
|
+
justify-content: center;
|
|
54
|
+
width: 160px;
|
|
55
|
+
height: 160px;
|
|
63
56
|
}
|
|
64
57
|
|
|
65
|
-
|
|
66
|
-
|
|
58
|
+
&__logo-background-mask {
|
|
59
|
+
position: absolute;
|
|
60
|
+
left: -40px;
|
|
61
|
+
top: -40px;
|
|
62
|
+
bottom: -40px;
|
|
63
|
+
right: -40px;
|
|
64
|
+
background: var(--site-config-color-index-page-logo-mask-background);
|
|
65
|
+
transition: background-color .2s;
|
|
66
|
+
filter: blur(45px);
|
|
67
|
+
border-radius: 50%;
|
|
68
|
+
animation: logo-wave 6s infinite linear;
|
|
67
69
|
}
|
|
68
|
-
}
|
|
69
70
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
;
|
|
71
|
+
&__title {
|
|
72
|
+
font-size: 54px;
|
|
73
|
+
margin-top: 60px;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
&__description {
|
|
77
|
+
width: 700px;
|
|
78
|
+
font-size: 16px;
|
|
79
|
+
line-height: 28px;
|
|
80
|
+
letter-spacing: 1px;
|
|
81
|
+
margin-top: 30px;
|
|
82
|
+
text-align: center;
|
|
83
|
+
color: var(--site-config-color-index-page-second-text-color);
|
|
78
84
|
}
|
|
79
|
-
}
|
|
80
85
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
right: 52%;
|
|
87
|
-
transform-origin: bottom right;
|
|
88
|
-
transition: box-shadow 0.5s;
|
|
89
|
-
box-shadow: -20px 0 20px var(--site-config-color-home-page-slash);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
.box-1 {
|
|
93
|
-
animation: slash-1 .75s forwards;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.box-2 {
|
|
97
|
-
animation: slash-2 .75s forwards;
|
|
98
|
-
}
|
|
86
|
+
&__link-button-group {
|
|
87
|
+
display: flex;
|
|
88
|
+
justify-content: space-around;
|
|
89
|
+
margin-top: 30px;
|
|
90
|
+
}
|
|
99
91
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
92
|
+
&__link-button {
|
|
93
|
+
height: 44px;
|
|
94
|
+
font-size: 18px;
|
|
95
|
+
transition: all .25s;
|
|
96
|
+
margin: 0 10px;
|
|
97
|
+
}
|
|
103
98
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
99
|
+
&__link-button-text {
|
|
100
|
+
margin-right: 4px;
|
|
101
|
+
}
|
|
107
102
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
103
|
+
&__features {
|
|
104
|
+
display: flex;
|
|
105
|
+
justify-content: center;
|
|
106
|
+
flex-wrap: wrap;
|
|
107
|
+
margin-top: 60px;
|
|
108
|
+
}
|
|
111
109
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
110
|
+
&__feature {
|
|
111
|
+
width: 280px;
|
|
112
|
+
margin: 10px;
|
|
113
|
+
padding: 20px;
|
|
114
|
+
border-radius: 4px;
|
|
115
|
+
background: var(--site-config-color-index-page-feature-background);
|
|
116
|
+
box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12);
|
|
117
|
+
}
|
|
118
118
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
.description-container {
|
|
124
|
-
display: flex;
|
|
125
|
-
margin-bottom: 35px;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
.logo-container {
|
|
129
|
-
margin-right: 20px;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
.button-group {
|
|
133
|
-
display: flex;
|
|
134
|
-
margin-top: 25px;
|
|
135
|
-
align-items: center;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
.block-button-content {
|
|
139
|
-
display: flex;
|
|
140
|
-
align-items: center;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
.common-button {
|
|
144
|
-
height: 52px;
|
|
145
|
-
font-size: 18px;
|
|
146
|
-
transition: all .25s;
|
|
147
|
-
animation: fade-in .75s forwards;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
.extra-button {
|
|
151
|
-
flex-shrink: 0;
|
|
152
|
-
background-color: var(--site-config-color-home-page-extra-button-background);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
.github-button {
|
|
156
|
-
background-color: var(--site-config-color-home-page-github-button-background);
|
|
157
|
-
color: #fff;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
.primary-button {
|
|
161
|
-
background-color: var(--site-config-color-home-page-primary-button-background);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
.margin-left {
|
|
165
|
-
margin-left: 10px;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
.base-title {
|
|
169
|
-
font-size: 84px;
|
|
170
|
-
line-height: 72px;
|
|
171
|
-
font-weight: 500;
|
|
172
|
-
margin-top: 8px;
|
|
173
|
-
animation: fade-in .75s forwards;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
.base-description {
|
|
177
|
-
font-size: 16px;
|
|
178
|
-
line-height: 28px;
|
|
179
|
-
padding-left: 4px;
|
|
180
|
-
font-weight: 500;
|
|
181
|
-
margin-bottom: 45px;
|
|
182
|
-
letter-spacing: 1px;
|
|
183
|
-
animation: fade-in .75s forwards;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
.logo {
|
|
187
|
-
width: 90px;
|
|
188
|
-
height: 90px;
|
|
189
|
-
flex-shrink: 0;
|
|
190
|
-
margin-right: 25px;
|
|
191
|
-
z-index: 2;
|
|
192
|
-
}
|
|
119
|
+
&__feature-description {
|
|
120
|
+
color: var(--site-config-color-index-page-second-text-color);
|
|
121
|
+
font-size: 14px;
|
|
122
|
+
margin-top: 10px;
|
|
193
123
|
}
|
|
194
124
|
}
|
|
@@ -4,20 +4,14 @@ import config from '@config'
|
|
|
4
4
|
import VarSiteButton from '../../../components/button'
|
|
5
5
|
import VarSiteIcon from '../../../components/icon'
|
|
6
6
|
import { get } from 'lodash-es'
|
|
7
|
-
import { ref, watch
|
|
7
|
+
import { ref, watch } from 'vue'
|
|
8
8
|
import { useRoute, useRouter } from 'vue-router'
|
|
9
9
|
import { getBrowserThemes, setThemes } from '../../../utils'
|
|
10
10
|
import { getPCLocationInfo, watchThemes } from '@varlet/cli/site/utils'
|
|
11
|
-
import
|
|
12
|
-
import zh_CN from './locale/zh-CN'
|
|
13
|
-
import type { Ref, ComputedRef } from 'vue'
|
|
11
|
+
import type { Ref } from 'vue'
|
|
14
12
|
|
|
15
13
|
const route = useRoute()
|
|
16
14
|
const router = useRouter()
|
|
17
|
-
const packs = {
|
|
18
|
-
'zh-CN': zh_CN,
|
|
19
|
-
'en-US': en_US,
|
|
20
|
-
} as any
|
|
21
15
|
|
|
22
16
|
const github = get(config, 'pc.header.github')
|
|
23
17
|
const themesKey = get(config, 'themesKey')
|
|
@@ -26,19 +20,7 @@ const darkMode: Ref<boolean> = ref(get(config, 'pc.header.darkMode'))
|
|
|
26
20
|
const title: Ref<string> = ref(get(config, 'title'))
|
|
27
21
|
const language: Ref<string> = ref(get(config, 'defaultLanguage'))
|
|
28
22
|
const languages: Ref<Record<string, string>> = ref(get(config, 'pc.header.i18n'))
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
const description: ComputedRef<string> = computed(() => {
|
|
32
|
-
const { indexPage = {} } = get(config, 'pc')
|
|
33
|
-
|
|
34
|
-
return indexPage?.description?.[language.value] || pack.value.description
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
const started: ComputedRef<string> = computed(() => {
|
|
38
|
-
const { indexPage = {} } = get(config, 'pc')
|
|
39
|
-
|
|
40
|
-
return indexPage?.started?.[language.value] || pack.value.started
|
|
41
|
-
})
|
|
23
|
+
const indexPage: Ref<Record<string, any>> = get(config, 'pc.indexPage')
|
|
42
24
|
|
|
43
25
|
const goGithub = () => {
|
|
44
26
|
window.open(github)
|
|
@@ -59,7 +41,7 @@ const setCurrentThemes = (themes: 'themes' | 'darkThemes') => {
|
|
|
59
41
|
const toggleTheme = () => {
|
|
60
42
|
setCurrentThemes(currentThemes.value === 'darkThemes' ? 'themes' : 'darkThemes')
|
|
61
43
|
window.postMessage(getThemesMessage(), '*')
|
|
62
|
-
|
|
44
|
+
;(document.getElementById('mobile') as HTMLIFrameElement)?.contentWindow!.postMessage(getThemesMessage(), '*')
|
|
63
45
|
}
|
|
64
46
|
|
|
65
47
|
const setLocale = () => {
|
|
@@ -67,7 +49,6 @@ const setLocale = () => {
|
|
|
67
49
|
if (!lang) return
|
|
68
50
|
|
|
69
51
|
language.value = lang
|
|
70
|
-
pack.value = packs[lang]
|
|
71
52
|
document.title = get(config, 'pc.title')[lang] as string
|
|
72
53
|
}
|
|
73
54
|
|
|
@@ -93,47 +74,41 @@ watch(() => route.path, setLocale, { immediate: true })
|
|
|
93
74
|
</script>
|
|
94
75
|
|
|
95
76
|
<template>
|
|
96
|
-
<div class="
|
|
97
|
-
<div class="
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
<div class="
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
</
|
|
77
|
+
<div class="varlet-doc-index">
|
|
78
|
+
<div class="varlet-doc-index__layout">
|
|
79
|
+
<div class="varlet-doc-index__logo-container">
|
|
80
|
+
<div class="varlet-doc-index__logo-background-mask"></div>
|
|
81
|
+
<animation-box class="varlet-doc-index__logo" />
|
|
82
|
+
</div>
|
|
83
|
+
|
|
84
|
+
<div class="varlet-doc-index__title">{{ title }}</div>
|
|
85
|
+
<div class="varlet-doc-index__description">{{ indexPage.description[language] }}</div>
|
|
86
|
+
<div class="varlet-doc-index__link-button-group">
|
|
87
|
+
<var-site-button class="varlet-doc-index__link-button" text outline @click="goGithub">
|
|
88
|
+
<var-site-icon name="github" size="24px" />
|
|
89
|
+
</var-site-button>
|
|
90
|
+
<var-site-button class="varlet-doc-index__link-button" text outline v-if="darkMode" @click="toggleTheme">
|
|
91
|
+
<var-site-icon size="24px" :name="currentThemes === 'themes' ? 'white-balance-sunny' : 'weather-night'" />
|
|
92
|
+
</var-site-button>
|
|
93
|
+
<var-site-button
|
|
94
|
+
class="varlet-doc-index__link-button"
|
|
95
|
+
text
|
|
96
|
+
outline
|
|
97
|
+
v-if="languages"
|
|
98
|
+
@click="toggleLanguages"
|
|
99
|
+
>
|
|
100
|
+
<var-site-icon name="translate" size="24px" />
|
|
101
|
+
</var-site-button>
|
|
102
|
+
<var-site-button class="varlet-doc-index__link-button" type="primary" @click="getStar">
|
|
103
|
+
<span class="varlet-doc-index__link-button-text">{{ indexPage.started[language] }}</span>
|
|
104
|
+
<var-site-icon style="transform: rotate(-90deg)" name="arrow-down" size="24px" />
|
|
105
|
+
</var-site-button>
|
|
106
|
+
</div>
|
|
121
107
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
<var-site-icon style="margin-left: 10px; transform: rotate(-90deg)" name="arrow-down" size="24px" />
|
|
127
|
-
</div>
|
|
128
|
-
</var-site-button>
|
|
129
|
-
<var-site-button
|
|
130
|
-
class="common-button extra-button margin-left"
|
|
131
|
-
text
|
|
132
|
-
v-if="languages"
|
|
133
|
-
@click="toggleLanguages"
|
|
134
|
-
>
|
|
135
|
-
<var-site-icon name="translate" size="24px" />
|
|
136
|
-
</var-site-button>
|
|
108
|
+
<div class="varlet-doc-index__features">
|
|
109
|
+
<div class="varlet-doc-index__feature" v-for="feature in indexPage.features">
|
|
110
|
+
<div class="varlet-doc-index__feature-name">{{ feature.name[language] }}</div>
|
|
111
|
+
<div class="varlet-doc-index__feature-description">{{ feature.description[language] }}</div>
|
|
137
112
|
</div>
|
|
138
113
|
</div>
|
|
139
114
|
</div>
|
|
@@ -1,5 +1 @@
|
|
|
1
|
-
|
|
2
|
-
started: 'GET STARTED',
|
|
3
|
-
description: 'Varlet is a Material design mobile component library developed based on Vue3, developed and maintained by partners in the community. ' +
|
|
4
|
-
'Support Typescript, import on demand, dark mode, theme customization, internationalization, and provide VSCode plugin to ensure a good development experience',
|
|
5
|
-
}
|
|
1
|
+
// this file used to generate route path ('/en-US/index')
|
package/varlet.default.config.js
CHANGED
|
@@ -20,6 +20,81 @@ module.exports = {
|
|
|
20
20
|
pc: {
|
|
21
21
|
menu: [],
|
|
22
22
|
redirect: '/index',
|
|
23
|
+
indexPage: {
|
|
24
|
+
description: {
|
|
25
|
+
'zh-CN':
|
|
26
|
+
'Varlet 是一个基于 Vue3 开发的 Material 风格移动端组件库,全面拥抱 Vue3 生态,由社区团队维护。支持 Typescript、按需引入、暗黑模式、主题定制、国际化,并提供 VSCode 插件保障良好的开发体验',
|
|
27
|
+
'en-US':
|
|
28
|
+
'Varlet is a Material design mobile component library developed based on Vue3, developed and maintained by partners in the community. Support Typescript, import on demand, dark mode, theme customization, internationalization, and provide VSCode plugin to ensure a good development experience',
|
|
29
|
+
},
|
|
30
|
+
started: {
|
|
31
|
+
'zh-CN': '起步',
|
|
32
|
+
'en-US': 'GET STARTED',
|
|
33
|
+
},
|
|
34
|
+
features: [
|
|
35
|
+
{
|
|
36
|
+
name: {
|
|
37
|
+
'zh-CN': '组件丰富',
|
|
38
|
+
'en-US': 'Rich components',
|
|
39
|
+
},
|
|
40
|
+
description: {
|
|
41
|
+
'zh-CN': '提供50个高质量通用组件',
|
|
42
|
+
'en-US': 'Provide 50 high quality general purpose components',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: {
|
|
47
|
+
'zh-CN': '按需引入',
|
|
48
|
+
'en-US': 'On-Demand',
|
|
49
|
+
},
|
|
50
|
+
description: {
|
|
51
|
+
'zh-CN': '每一个组件都可单独引入,并有着良好的 tree-shaking 优化',
|
|
52
|
+
'en-US': 'Each component can be imported separately and has good tree-shaking optimization',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: {
|
|
57
|
+
'zh-CN': '国人开发',
|
|
58
|
+
'en-US': 'Developed by Chinese',
|
|
59
|
+
},
|
|
60
|
+
description: {
|
|
61
|
+
'zh-CN': '由国人开发,完善的中英文文档和后勤保障',
|
|
62
|
+
'en-US': 'Complete Chinese and English documentation and logistics support',
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: {
|
|
67
|
+
'zh-CN': '国际化',
|
|
68
|
+
'en-US': 'Locale',
|
|
69
|
+
},
|
|
70
|
+
description: {
|
|
71
|
+
'zh-CN': '内置国际化 API,默认支持中英两国语言',
|
|
72
|
+
'en-US': 'Built-in i18n API, which supports both Chinese and English languages by default',
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
name: {
|
|
77
|
+
'zh-CN': '开发工具支持',
|
|
78
|
+
'en-US': 'IDE Code Support',
|
|
79
|
+
},
|
|
80
|
+
description: {
|
|
81
|
+
'zh-CN': '支持 webstorm,vscode 组件属性高亮, 提供vscode插件为开发提升效率',
|
|
82
|
+
'en-US':
|
|
83
|
+
'Supports to highlight the component syntax for webstorm and vscode, and provides a separate helper plugin for vscode',
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
name: {
|
|
88
|
+
'zh-CN': 'Typescript + SSR',
|
|
89
|
+
'en-US': 'Typescript + SSR',
|
|
90
|
+
},
|
|
91
|
+
description: {
|
|
92
|
+
'zh-CN': '对 TypeScript 使用者十分友好,并且支持服务端渲染',
|
|
93
|
+
'en-US': 'Develop with TypeScript, and support SSR',
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
},
|
|
23
98
|
title: {
|
|
24
99
|
'zh-CN': '面向 Vue3 的 Material 风格移动端组件库',
|
|
25
100
|
'en-US': 'Material design mobile components built for Vue3',
|
|
@@ -60,11 +135,10 @@ module.exports = {
|
|
|
60
135
|
},
|
|
61
136
|
themes: {
|
|
62
137
|
'color-body': '#fff',
|
|
63
|
-
'color-
|
|
64
|
-
'color-
|
|
65
|
-
'color-
|
|
66
|
-
'color-
|
|
67
|
-
'color-home-page-github-button-background': '#212121',
|
|
138
|
+
'color-index-page-background': '#fff',
|
|
139
|
+
'color-index-page-feature-background': '#fff',
|
|
140
|
+
'color-index-page-logo-mask-background': 'linear-gradient(-45deg, #8baff8 50%, #84e0ff 50%)',
|
|
141
|
+
'color-index-page-second-text-color': 'rgba(60, 60, 60, .7)',
|
|
68
142
|
'color-bar': '#fff',
|
|
69
143
|
'color-sub-bar': '#f5f5f5',
|
|
70
144
|
'color-text': '#555',
|
|
@@ -102,11 +176,10 @@ module.exports = {
|
|
|
102
176
|
},
|
|
103
177
|
darkThemes: {
|
|
104
178
|
'color-body': '#121212',
|
|
105
|
-
'color-
|
|
106
|
-
'color-
|
|
107
|
-
'color-
|
|
108
|
-
'color-
|
|
109
|
-
'color-home-page-github-button-background': '#303030',
|
|
179
|
+
'color-index-page-background': '#272727',
|
|
180
|
+
'color-index-page-feature-background': '#303030',
|
|
181
|
+
'color-index-page-logo-mask-background': 'linear-gradient(-45deg, #729dfc 50%, #6859f4 50%)',
|
|
182
|
+
'color-index-page-second-text-color': 'rgba(255, 255, 255, .75)',
|
|
110
183
|
'color-bar': '#1e1e1e',
|
|
111
184
|
'color-sub-bar': '#272727',
|
|
112
185
|
'color-text': '#fff',
|