@varlet/cli 1.20.0 → 1.21.1-alpha.64
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/CHANGELOG.md +8 -0
- package/README.en-US.md +11 -0
- package/README.md +11 -0
- package/generators/sfc/package.json +3 -2
- package/generators/sfc/varlet.config.js +5 -0
- package/generators/tsx/package.json +3 -2
- package/generators/tsx/varlet.config.js +5 -0
- package/lib/commands/build.js +19 -15
- package/lib/commands/dev.d.ts +3 -2
- package/lib/commands/dev.js +23 -34
- package/lib/commands/jest.d.ts +3 -3
- package/lib/commands/preview.d.ts +1 -0
- package/lib/commands/preview.js +65 -0
- package/lib/compiler/compileModule.js +7 -14
- package/lib/compiler/compileSFC.js +7 -2
- package/lib/compiler/compileSiteEntry.d.ts +1 -4
- package/lib/compiler/compileSiteEntry.js +10 -20
- package/lib/compiler/compileStyle.js +1 -60
- package/lib/config/babel.config.js +0 -9
- package/lib/config/jest.config.js +1 -1
- package/lib/config/jest.lib.mock.d.ts +0 -0
- package/lib/config/jest.lib.mock.js +2 -0
- package/lib/config/postcss.config.d.ts +4 -1
- package/lib/config/postcss.config.js +14 -38
- package/lib/config/varlet.config.d.ts +1 -1
- package/lib/config/vite.config.d.ts +4 -0
- package/lib/config/vite.config.js +128 -0
- package/lib/config/webpack.base.config.js +1 -1
- package/lib/index.js +7 -2
- package/lib/shared/constant.d.ts +2 -8
- package/lib/shared/constant.js +3 -9
- package/lib/site/components/app-bar/index.d.ts +3 -0
- package/lib/site/components/app-bar/index.js +12 -0
- package/lib/site/components/app-bar/props.d.ts +21 -0
- package/lib/site/components/app-bar/props.js +28 -0
- package/lib/site/components/button/index.d.ts +3 -0
- package/lib/site/components/button/index.js +12 -0
- package/lib/site/components/button/props.d.ts +62 -0
- package/lib/site/components/button/props.js +69 -0
- package/lib/site/components/cell/index.d.ts +3 -0
- package/lib/site/components/cell/index.js +12 -0
- package/lib/site/components/cell/props.d.ts +27 -0
- package/lib/site/components/cell/props.js +30 -0
- package/lib/site/components/context/index.d.ts +15 -0
- package/lib/site/components/context/index.js +11 -0
- package/lib/site/components/context/lock.d.ts +10 -0
- package/lib/site/components/context/lock.js +94 -0
- package/lib/site/components/context/zIndex.d.ts +4 -0
- package/lib/site/components/context/zIndex.js +19 -0
- package/lib/site/components/icon/index.d.ts +3 -0
- package/lib/site/components/icon/index.js +12 -0
- package/lib/site/components/icon/props.d.ts +23 -0
- package/lib/site/components/icon/props.js +25 -0
- package/lib/site/components/loading/index.d.ts +3 -0
- package/lib/site/components/loading/index.js +12 -0
- package/lib/site/components/loading/props.d.ts +26 -0
- package/lib/site/components/loading/props.js +34 -0
- package/lib/site/components/menu/index.d.ts +3 -0
- package/lib/site/components/menu/index.js +12 -0
- package/lib/site/components/menu/props.d.ts +40 -0
- package/lib/site/components/menu/props.js +43 -0
- package/lib/site/components/progress/index.d.ts +3 -0
- package/lib/site/components/progress/index.js +12 -0
- package/lib/site/components/progress/props.d.ts +43 -0
- package/lib/site/components/progress/props.js +57 -0
- package/lib/site/components/ripple/index.d.ts +8 -0
- package/lib/site/components/ripple/index.js +125 -0
- package/lib/site/components/utils/components.d.ts +53 -0
- package/lib/site/components/utils/components.js +279 -0
- package/lib/site/components/utils/elements.d.ts +30 -0
- package/lib/site/components/utils/elements.js +240 -0
- package/lib/site/components/utils/shared.d.ts +36 -0
- package/lib/site/components/utils/shared.js +181 -0
- package/lib/site/mobile/main.d.ts +3 -0
- package/lib/site/mobile/main.js +93 -0
- package/lib/site/pc/main.d.ts +3 -0
- package/lib/site/pc/main.js +69 -0
- package/lib/site/useProgress.d.ts +4 -0
- package/lib/site/useProgress.js +58 -0
- package/lib/site/utils.d.ts +24 -0
- package/lib/site/utils.js +133 -0
- package/package.json +16 -30
- package/site/.DS_Store +0 -0
- package/site/components/app-bar/AppBar.vue +45 -0
- package/site/components/app-bar/appBar.less +66 -0
- package/site/components/app-bar/index.ts +10 -0
- package/site/components/app-bar/props.ts +25 -0
- package/site/components/button/Button.vue +84 -0
- package/site/components/button/button.less +183 -0
- package/site/components/button/index.ts +10 -0
- package/site/components/button/props.ts +70 -0
- package/site/components/cell/Cell.vue +42 -0
- package/site/components/cell/cell.less +74 -0
- package/site/components/cell/index.ts +10 -0
- package/site/components/cell/props.ts +27 -0
- package/site/components/context/index.ts +17 -0
- package/site/components/context/lock.ts +103 -0
- package/site/components/context/zIndex.ts +20 -0
- package/site/components/icon/Icon.vue +68 -0
- package/site/components/icon/icon.less +25 -0
- package/site/components/icon/index.ts +10 -0
- package/site/components/icon/props.ts +24 -0
- package/site/components/loading/Loading.vue +55 -0
- package/site/components/loading/index.ts +10 -0
- package/site/components/loading/loading.less +420 -0
- package/site/components/loading/props.ts +37 -0
- package/site/components/menu/Menu.vue +113 -0
- package/site/components/menu/index.ts +10 -0
- package/site/components/menu/menu.less +27 -0
- package/site/components/menu/props.ts +43 -0
- package/site/components/progress/Progress.vue +108 -0
- package/site/components/progress/index.ts +10 -0
- package/site/components/progress/progress.less +98 -0
- package/site/components/progress/props.ts +55 -0
- package/site/components/ripple/index.ts +167 -0
- package/site/components/ripple/ripple.less +17 -0
- package/site/components/styles/common.less +64 -0
- package/site/components/styles/elevation.less +126 -0
- package/site/components/styles/var.less +27 -0
- package/site/components/utils/components.ts +53 -0
- package/site/components/utils/elements.ts +83 -0
- package/site/components/utils/shared.ts +27 -0
- package/site/{pc/index.html → index.html} +6 -4
- package/site/mobile/App.vue +20 -18
- package/site/mobile/components/AppHome.vue +6 -8
- package/site/mobile/main.ts +17 -2
- package/site/{mobile/mobile.html → mobile.html} +6 -5
- package/site/pc/App.vue +16 -11
- package/site/pc/components/AppHeader.vue +15 -13
- package/site/pc/components/AppMobile.vue +3 -3
- package/site/pc/components/AppSidebar.vue +17 -23
- package/site/pc/main.ts +10 -2
- package/site/useProgress.ts +11 -9
- package/site/utils.ts +14 -3
- package/varlet.default.config.js +3 -2
- package/generators/sfc/yarn.lock +0 -11231
- package/generators/tsx/yarn.lock +0 -11231
|
@@ -1,42 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
14
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
15
|
-
if (!m) return o;
|
|
16
|
-
var i = m.call(o), r, ar = [], e;
|
|
17
|
-
try {
|
|
18
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
19
|
-
}
|
|
20
|
-
catch (error) { e = { error: error }; }
|
|
21
|
-
finally {
|
|
22
|
-
try {
|
|
23
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
24
|
-
}
|
|
25
|
-
finally { if (e) throw e.error; }
|
|
26
|
-
}
|
|
27
|
-
return ar;
|
|
28
|
-
};
|
|
29
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
30
|
-
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
31
|
-
to[j] = from[i];
|
|
32
|
-
return to;
|
|
33
|
-
};
|
|
34
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.
|
|
3
|
+
exports.getPostcssOptions = exports.defaultConfig = void 0;
|
|
4
|
+
var lodash_1 = require("lodash");
|
|
36
5
|
var fs_extra_1 = require("fs-extra");
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
6
|
+
var constant_1 = require("../shared/constant");
|
|
7
|
+
exports.defaultConfig = {
|
|
8
|
+
plugins: [require.resolve('postcss-preset-env')],
|
|
9
|
+
};
|
|
10
|
+
function getPostcssOptions() {
|
|
11
|
+
var config = {};
|
|
12
|
+
if (fs_extra_1.pathExistsSync(constant_1.POSTCSS_CONFIG)) {
|
|
13
|
+
delete require.cache[require.resolve(constant_1.POSTCSS_CONFIG)];
|
|
14
|
+
config = require(constant_1.POSTCSS_CONFIG);
|
|
15
|
+
}
|
|
16
|
+
return lodash_1.merge(exports.defaultConfig, config);
|
|
41
17
|
}
|
|
42
|
-
exports.
|
|
18
|
+
exports.getPostcssOptions = getPostcssOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function getVarletConfig(): any
|
|
1
|
+
export declare function getVarletConfig(): Record<string, any>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { InlineConfig } from 'vite';
|
|
2
|
+
export declare function getDevConfig(varletConfig: Record<string, any>): InlineConfig;
|
|
3
|
+
export declare function getBuildConfig(varletConfig: Record<string, any>): InlineConfig;
|
|
4
|
+
export declare function getUMDConfig(varletConfig: Record<string, any>): InlineConfig;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.getUMDConfig = exports.getBuildConfig = exports.getDevConfig = void 0;
|
|
18
|
+
var plugin_vue_1 = __importDefault(require("@vitejs/plugin-vue"));
|
|
19
|
+
var markdown_vite_plugin_1 = __importDefault(require("@varlet/markdown-vite-plugin"));
|
|
20
|
+
var plugin_vue_jsx_1 = __importDefault(require("@vitejs/plugin-vue-jsx"));
|
|
21
|
+
var vite_plugin_html_1 = require("vite-plugin-html");
|
|
22
|
+
var constant_1 = require("../shared/constant");
|
|
23
|
+
var lodash_1 = require("lodash");
|
|
24
|
+
var path_1 = require("path");
|
|
25
|
+
var fs_extra_1 = require("fs-extra");
|
|
26
|
+
function getDevConfig(varletConfig) {
|
|
27
|
+
var defaultLanguage = lodash_1.get(varletConfig, 'defaultLanguage');
|
|
28
|
+
var host = lodash_1.get(varletConfig, 'host');
|
|
29
|
+
return {
|
|
30
|
+
root: constant_1.SITE_DIR,
|
|
31
|
+
resolve: {
|
|
32
|
+
extensions: constant_1.VITE_RESOLVE_EXTENSIONS,
|
|
33
|
+
alias: {
|
|
34
|
+
'@config': constant_1.SITE_CONFIG,
|
|
35
|
+
'@pc-routes': constant_1.SITE_PC_ROUTES,
|
|
36
|
+
'@mobile-routes': constant_1.SITE_MOBILE_ROUTES,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
server: {
|
|
40
|
+
port: lodash_1.get(varletConfig, 'port'),
|
|
41
|
+
host: host === 'localhost' ? '0.0.0.0' : host,
|
|
42
|
+
},
|
|
43
|
+
publicDir: constant_1.SITE_PUBLIC_PATH,
|
|
44
|
+
plugins: [
|
|
45
|
+
plugin_vue_1.default({
|
|
46
|
+
include: [/\.vue$/, /\.md$/],
|
|
47
|
+
}),
|
|
48
|
+
markdown_vite_plugin_1.default({ style: lodash_1.get(varletConfig, 'highlight.style') }),
|
|
49
|
+
plugin_vue_jsx_1.default(),
|
|
50
|
+
vite_plugin_html_1.injectHtml({
|
|
51
|
+
data: {
|
|
52
|
+
pcTitle: lodash_1.get(varletConfig, "pc.title['" + defaultLanguage + "']"),
|
|
53
|
+
mobileTitle: lodash_1.get(varletConfig, "mobile.title['" + defaultLanguage + "']"),
|
|
54
|
+
logo: lodash_1.get(varletConfig, "logo"),
|
|
55
|
+
baidu: lodash_1.get(varletConfig, "analysis.baidu", ''),
|
|
56
|
+
},
|
|
57
|
+
}),
|
|
58
|
+
],
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
exports.getDevConfig = getDevConfig;
|
|
62
|
+
function getBuildConfig(varletConfig) {
|
|
63
|
+
var devConfig = getDevConfig(varletConfig);
|
|
64
|
+
return __assign(__assign({}, devConfig), { base: './', build: {
|
|
65
|
+
outDir: constant_1.SITE_OUTPUT_PATH,
|
|
66
|
+
brotliSize: false,
|
|
67
|
+
emptyOutDir: true,
|
|
68
|
+
rollupOptions: {
|
|
69
|
+
input: {
|
|
70
|
+
main: path_1.resolve(constant_1.SITE_DIR, 'index.html'),
|
|
71
|
+
mobile: path_1.resolve(constant_1.SITE_DIR, 'mobile.html'),
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
} });
|
|
75
|
+
}
|
|
76
|
+
exports.getBuildConfig = getBuildConfig;
|
|
77
|
+
function inlineCSS(fileName, dir) {
|
|
78
|
+
return {
|
|
79
|
+
name: 'varlet-inline-css-vite-plugin',
|
|
80
|
+
apply: 'build',
|
|
81
|
+
closeBundle: function () {
|
|
82
|
+
var cssFile = path_1.resolve(dir, 'style.css');
|
|
83
|
+
var jsFile = path_1.resolve(dir, fileName);
|
|
84
|
+
var cssCode = fs_extra_1.readFileSync(cssFile, 'utf-8');
|
|
85
|
+
var jsCode = fs_extra_1.readFileSync(jsFile, 'utf-8');
|
|
86
|
+
var injectCode = ";(function(){var style=document.createElement('style');style.type='text/css';style.rel='stylesheet';style.appendChild(document.createTextNode(`" + cssCode.replace(/\\/g, '\\\\') + "`));var head=document.querySelector('head');head.appendChild(style)})();";
|
|
87
|
+
fs_extra_1.removeSync(cssFile);
|
|
88
|
+
fs_extra_1.writeFileSync(jsFile, "" + injectCode + jsCode);
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
function clear() {
|
|
93
|
+
return {
|
|
94
|
+
name: 'varlet-clear-vite-plugin',
|
|
95
|
+
apply: 'build',
|
|
96
|
+
closeBundle: function () {
|
|
97
|
+
fs_extra_1.removeSync(path_1.resolve(constant_1.CWD, 'dist'));
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function getUMDConfig(varletConfig) {
|
|
102
|
+
var name = lodash_1.get(varletConfig, 'name');
|
|
103
|
+
var fileName = lodash_1.kebabCase(name) + ".js";
|
|
104
|
+
return {
|
|
105
|
+
logLevel: 'silent',
|
|
106
|
+
build: {
|
|
107
|
+
emptyOutDir: true,
|
|
108
|
+
lib: {
|
|
109
|
+
name: name,
|
|
110
|
+
formats: ['umd'],
|
|
111
|
+
fileName: function () { return fileName; },
|
|
112
|
+
entry: path_1.resolve(constant_1.ES_DIR, 'umdIndex.js'),
|
|
113
|
+
},
|
|
114
|
+
rollupOptions: {
|
|
115
|
+
external: ['vue'],
|
|
116
|
+
output: {
|
|
117
|
+
dir: constant_1.UMD_DIR,
|
|
118
|
+
exports: 'named',
|
|
119
|
+
globals: {
|
|
120
|
+
vue: 'Vue',
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
plugins: [inlineCSS(fileName, constant_1.UMD_DIR), clear()],
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
exports.getUMDConfig = getUMDConfig;
|
|
@@ -34,7 +34,7 @@ exports.CSS_LOADERS = [
|
|
|
34
34
|
require.resolve('css-loader'),
|
|
35
35
|
{
|
|
36
36
|
loader: require.resolve('postcss-loader'),
|
|
37
|
-
options: { postcssOptions: postcss_config_1.
|
|
37
|
+
options: { postcssOptions: postcss_config_1.getPostcssOptions() },
|
|
38
38
|
},
|
|
39
39
|
];
|
|
40
40
|
function createBasePlugins() {
|
package/lib/index.js
CHANGED
|
@@ -20,6 +20,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
20
20
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
21
21
|
};
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
var logger_1 = __importDefault(require("./shared/logger"));
|
|
23
24
|
var commander_1 = require("commander");
|
|
24
25
|
var dev_1 = require("./commands/dev");
|
|
25
26
|
var build_1 = require("./commands/build");
|
|
@@ -28,10 +29,14 @@ var create_1 = require("./commands/create");
|
|
|
28
29
|
var jest_1 = require("./commands/jest");
|
|
29
30
|
var lint_1 = require("./commands/lint");
|
|
30
31
|
var gen_1 = require("./commands/gen");
|
|
31
|
-
var
|
|
32
|
+
var preview_1 = require("./commands/preview");
|
|
32
33
|
commander_1.version("varlet-cli " + require('../package.json').version).usage('<command> [options]');
|
|
33
|
-
commander_1.command('dev')
|
|
34
|
+
commander_1.command('dev')
|
|
35
|
+
.option('-f --force', 'Force dep pre-optimization regardless of whether deps have changed')
|
|
36
|
+
.description('Run varlet development environment')
|
|
37
|
+
.action(dev_1.dev);
|
|
34
38
|
commander_1.command('build').description('Build varlet site for production').action(build_1.build);
|
|
39
|
+
commander_1.command('preview').description('Preview varlet site for production').action(preview_1.preview);
|
|
35
40
|
commander_1.command('compile')
|
|
36
41
|
.description('Compile varlet components library code')
|
|
37
42
|
.option('-nu, --noUmd', 'Do not compile umd target code')
|
package/lib/shared/constant.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
export declare const CWD: string;
|
|
2
|
-
export declare const POSTCSS_CONFIG: string;
|
|
3
|
-
export declare const TS_CONFIG: string;
|
|
4
2
|
export declare const VARLET_CONFIG: string;
|
|
5
3
|
export declare const SRC_DIR: string;
|
|
6
4
|
export declare const ES_DIR: string;
|
|
@@ -8,7 +6,7 @@ export declare const UMD_DIR: string;
|
|
|
8
6
|
export declare const TYPES_DIR: string;
|
|
9
7
|
export declare const ROOT_DOCS_DIR: string;
|
|
10
8
|
export declare const ESLINT_EXTENSIONS: string[];
|
|
11
|
-
export declare const
|
|
9
|
+
export declare const VITE_RESOLVE_EXTENSIONS: string[];
|
|
12
10
|
export declare const SCRIPTS_EXTENSIONS: string[];
|
|
13
11
|
export declare const PUBLIC_DIR_INDEXES: string[];
|
|
14
12
|
export declare const STYLE_DIR_NAME = "style";
|
|
@@ -19,17 +17,13 @@ export declare const EXAMPLE_DIR_INDEX = "index.vue";
|
|
|
19
17
|
export declare const TESTS_DIR_NAME = "__tests__";
|
|
20
18
|
export declare const GENERATORS_DIR: string;
|
|
21
19
|
export declare const CLI_PACKAGE_JSON: string;
|
|
22
|
-
export declare const PRIMARY_COLOR = "#3a7afe";
|
|
23
|
-
export declare const SITE_MOBILE_MAIN: string;
|
|
24
|
-
export declare const SITE_PC_MAIN: string;
|
|
25
20
|
export declare const SITE: string;
|
|
26
21
|
export declare const SITE_OUTPUT_PATH: string;
|
|
27
22
|
export declare const SITE_PUBLIC_PATH: string;
|
|
23
|
+
export declare const SITE_DIR: string;
|
|
28
24
|
export declare const SITE_PC_ROUTES: string;
|
|
29
25
|
export declare const SITE_MOBILE_ROUTES: string;
|
|
30
26
|
export declare const SITE_CONFIG: string;
|
|
31
|
-
export declare const SITE_DOCS_GLOB: string;
|
|
32
|
-
export declare const SITE_EXAMPLE_GLOB: string;
|
|
33
27
|
export declare const HL_COMPONENT_NAME_RE: RegExp;
|
|
34
28
|
export declare const HL_API_RE: RegExp;
|
|
35
29
|
export declare const HL_TITLE_ATTRIBUTES_RE: RegExp;
|
package/lib/shared/constant.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.JEST_STYLE_MOCK = exports.JEST_MEDIA_MOCK = exports.JEST_CONFIG = exports.HL_WEB_TYPES_JSON = exports.HL_ATTRIBUTES_JSON = exports.HL_TAGS_JSON = exports.HL_DIR = exports.HL_MD = exports.HL_TITLE_SLOTS_RE = exports.HL_TITLE_EVENTS_RE = exports.HL_TITLE_ATTRIBUTES_RE = exports.HL_API_RE = exports.HL_COMPONENT_NAME_RE = exports.
|
|
3
|
+
exports.JEST_STYLE_MOCK = exports.JEST_MEDIA_MOCK = exports.JEST_CONFIG = exports.HL_WEB_TYPES_JSON = exports.HL_ATTRIBUTES_JSON = exports.HL_TAGS_JSON = exports.HL_DIR = exports.HL_MD = exports.HL_TITLE_SLOTS_RE = exports.HL_TITLE_EVENTS_RE = exports.HL_TITLE_ATTRIBUTES_RE = exports.HL_API_RE = exports.HL_COMPONENT_NAME_RE = exports.SITE_CONFIG = exports.SITE_MOBILE_ROUTES = exports.SITE_PC_ROUTES = exports.SITE_DIR = exports.SITE_PUBLIC_PATH = exports.SITE_OUTPUT_PATH = exports.SITE = exports.CLI_PACKAGE_JSON = exports.GENERATORS_DIR = exports.TESTS_DIR_NAME = exports.EXAMPLE_DIR_INDEX = exports.DOCS_DIR_NAME = exports.EXAMPLE_LOCALE_DIR_NAME = exports.EXAMPLE_DIR_NAME = exports.STYLE_DIR_NAME = exports.PUBLIC_DIR_INDEXES = exports.SCRIPTS_EXTENSIONS = exports.VITE_RESOLVE_EXTENSIONS = exports.ESLINT_EXTENSIONS = exports.ROOT_DOCS_DIR = exports.TYPES_DIR = exports.UMD_DIR = exports.ES_DIR = exports.SRC_DIR = exports.VARLET_CONFIG = exports.CWD = void 0;
|
|
4
4
|
var path_1 = require("path");
|
|
5
5
|
exports.CWD = process.cwd();
|
|
6
|
-
exports.POSTCSS_CONFIG = path_1.resolve(exports.CWD, 'postcss.config.js');
|
|
7
|
-
exports.TS_CONFIG = path_1.resolve(exports.CWD, 'tsconfig.json');
|
|
8
6
|
exports.VARLET_CONFIG = path_1.resolve(exports.CWD, 'varlet.config.js');
|
|
9
7
|
exports.SRC_DIR = path_1.resolve(exports.CWD, 'src');
|
|
10
8
|
exports.ES_DIR = path_1.resolve(exports.CWD, 'es');
|
|
@@ -12,7 +10,7 @@ exports.UMD_DIR = path_1.resolve(exports.CWD, 'umd');
|
|
|
12
10
|
exports.TYPES_DIR = path_1.resolve(exports.CWD, 'types');
|
|
13
11
|
exports.ROOT_DOCS_DIR = path_1.resolve(exports.CWD, 'docs');
|
|
14
12
|
exports.ESLINT_EXTENSIONS = ['.vue', '.ts', '.js', '.mjs', '.tsx', '.jsx'];
|
|
15
|
-
exports.
|
|
13
|
+
exports.VITE_RESOLVE_EXTENSIONS = ['.vue', '.tsx', '.ts', '.jsx', '.js', '.less', '.css'];
|
|
16
14
|
exports.SCRIPTS_EXTENSIONS = ['.tsx', '.ts', '.jsx', '.js'];
|
|
17
15
|
exports.PUBLIC_DIR_INDEXES = ['index.vue', 'index.tsx', 'index.ts', 'index.jsx', 'index.js'];
|
|
18
16
|
exports.STYLE_DIR_NAME = 'style';
|
|
@@ -23,18 +21,14 @@ exports.EXAMPLE_DIR_INDEX = 'index.vue';
|
|
|
23
21
|
exports.TESTS_DIR_NAME = '__tests__';
|
|
24
22
|
exports.GENERATORS_DIR = path_1.resolve(__dirname, '../../generators');
|
|
25
23
|
exports.CLI_PACKAGE_JSON = path_1.resolve(__dirname, '../../package.json');
|
|
26
|
-
exports.PRIMARY_COLOR = '#3a7afe';
|
|
27
24
|
// site
|
|
28
|
-
exports.SITE_MOBILE_MAIN = path_1.resolve(__dirname, '../../site/mobile/main.ts');
|
|
29
|
-
exports.SITE_PC_MAIN = path_1.resolve(__dirname, '../../site/pc/main.ts');
|
|
30
25
|
exports.SITE = path_1.resolve(__dirname, '../../site');
|
|
31
26
|
exports.SITE_OUTPUT_PATH = path_1.resolve(exports.CWD, 'site');
|
|
32
27
|
exports.SITE_PUBLIC_PATH = path_1.resolve(exports.CWD, 'public');
|
|
28
|
+
exports.SITE_DIR = path_1.resolve(exports.CWD, '.varlet/site');
|
|
33
29
|
exports.SITE_PC_ROUTES = path_1.resolve(exports.CWD, '.varlet/pc.routes.ts');
|
|
34
30
|
exports.SITE_MOBILE_ROUTES = path_1.resolve(exports.CWD, '.varlet/mobile.routes.ts');
|
|
35
31
|
exports.SITE_CONFIG = path_1.resolve(exports.CWD, '.varlet/site.config.json');
|
|
36
|
-
exports.SITE_DOCS_GLOB = path_1.resolve(exports.CWD, './docs/**');
|
|
37
|
-
exports.SITE_EXAMPLE_GLOB = path_1.resolve(exports.CWD, './src/**/example/**');
|
|
38
32
|
// template highlight
|
|
39
33
|
exports.HL_COMPONENT_NAME_RE = /.*(\/|\\)(.+)(\/|\\)docs(\/|\\)/;
|
|
40
34
|
exports.HL_API_RE = /##\s*API\n+/;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports._AppBarComponent = void 0;
|
|
7
|
+
var AppBar_vue_1 = __importDefault(require("./AppBar.vue"));
|
|
8
|
+
AppBar_vue_1.default.install = function (app) {
|
|
9
|
+
app.component(AppBar_vue_1.default.name, AppBar_vue_1.default);
|
|
10
|
+
};
|
|
11
|
+
exports._AppBarComponent = AppBar_vue_1.default;
|
|
12
|
+
exports.default = AppBar_vue_1.default;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare function positionValidator(position: string): boolean;
|
|
2
|
+
export declare const props: {
|
|
3
|
+
color: {
|
|
4
|
+
type: StringConstructor;
|
|
5
|
+
};
|
|
6
|
+
textColor: {
|
|
7
|
+
type: StringConstructor;
|
|
8
|
+
};
|
|
9
|
+
title: {
|
|
10
|
+
type: StringConstructor;
|
|
11
|
+
};
|
|
12
|
+
titlePosition: {
|
|
13
|
+
type: StringConstructor;
|
|
14
|
+
default: string;
|
|
15
|
+
validator: typeof positionValidator;
|
|
16
|
+
};
|
|
17
|
+
elevation: {
|
|
18
|
+
type: BooleanConstructor;
|
|
19
|
+
default: boolean;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.props = exports.positionValidator = void 0;
|
|
4
|
+
function positionValidator(position) {
|
|
5
|
+
var validPositions = ['left', 'center', 'right'];
|
|
6
|
+
return validPositions.includes(position);
|
|
7
|
+
}
|
|
8
|
+
exports.positionValidator = positionValidator;
|
|
9
|
+
exports.props = {
|
|
10
|
+
color: {
|
|
11
|
+
type: String,
|
|
12
|
+
},
|
|
13
|
+
textColor: {
|
|
14
|
+
type: String,
|
|
15
|
+
},
|
|
16
|
+
title: {
|
|
17
|
+
type: String,
|
|
18
|
+
},
|
|
19
|
+
titlePosition: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: 'left',
|
|
22
|
+
validator: positionValidator,
|
|
23
|
+
},
|
|
24
|
+
elevation: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: true,
|
|
27
|
+
},
|
|
28
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports._ButtonComponent = void 0;
|
|
7
|
+
var Button_vue_1 = __importDefault(require("./Button.vue"));
|
|
8
|
+
Button_vue_1.default.install = function (app) {
|
|
9
|
+
app.component(Button_vue_1.default.name, Button_vue_1.default);
|
|
10
|
+
};
|
|
11
|
+
exports._ButtonComponent = Button_vue_1.default;
|
|
12
|
+
exports.default = Button_vue_1.default;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { PropType } from 'vue';
|
|
2
|
+
declare function typeValidator(type: string): boolean;
|
|
3
|
+
declare function sizeValidator(size: string): boolean;
|
|
4
|
+
export declare const props: {
|
|
5
|
+
type: {
|
|
6
|
+
type: PropType<"default" | "primary" | "info" | "success" | "warning" | "danger">;
|
|
7
|
+
default: string;
|
|
8
|
+
validator: typeof typeValidator;
|
|
9
|
+
};
|
|
10
|
+
size: {
|
|
11
|
+
type: PropType<"small" | "normal" | "mini" | "large">;
|
|
12
|
+
default: string;
|
|
13
|
+
validator: typeof sizeValidator;
|
|
14
|
+
};
|
|
15
|
+
loading: {
|
|
16
|
+
type: BooleanConstructor;
|
|
17
|
+
default: boolean;
|
|
18
|
+
};
|
|
19
|
+
round: {
|
|
20
|
+
type: BooleanConstructor;
|
|
21
|
+
default: boolean;
|
|
22
|
+
};
|
|
23
|
+
block: {
|
|
24
|
+
type: BooleanConstructor;
|
|
25
|
+
default: boolean;
|
|
26
|
+
};
|
|
27
|
+
text: {
|
|
28
|
+
type: BooleanConstructor;
|
|
29
|
+
default: boolean;
|
|
30
|
+
};
|
|
31
|
+
outline: {
|
|
32
|
+
type: BooleanConstructor;
|
|
33
|
+
default: boolean;
|
|
34
|
+
};
|
|
35
|
+
disabled: {
|
|
36
|
+
type: BooleanConstructor;
|
|
37
|
+
default: boolean;
|
|
38
|
+
};
|
|
39
|
+
ripple: {
|
|
40
|
+
type: BooleanConstructor;
|
|
41
|
+
default: boolean;
|
|
42
|
+
};
|
|
43
|
+
color: {
|
|
44
|
+
type: StringConstructor;
|
|
45
|
+
};
|
|
46
|
+
textColor: {
|
|
47
|
+
type: StringConstructor;
|
|
48
|
+
};
|
|
49
|
+
loadingRadius: {
|
|
50
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
51
|
+
default: number;
|
|
52
|
+
};
|
|
53
|
+
loadingType: any;
|
|
54
|
+
loadingSize: any;
|
|
55
|
+
onClick: {
|
|
56
|
+
type: PropType<(e: Event) => void>;
|
|
57
|
+
};
|
|
58
|
+
onTouchstart: {
|
|
59
|
+
type: PropType<(e: Event) => void>;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
export {};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.props = void 0;
|
|
4
|
+
var props_1 = require("../loading/props");
|
|
5
|
+
var components_1 = require("../utils/components");
|
|
6
|
+
function typeValidator(type) {
|
|
7
|
+
return ['default', 'primary', 'info', 'success', 'warning', 'danger'].includes(type);
|
|
8
|
+
}
|
|
9
|
+
function sizeValidator(size) {
|
|
10
|
+
return ['normal', 'mini', 'small', 'large'].includes(size);
|
|
11
|
+
}
|
|
12
|
+
exports.props = {
|
|
13
|
+
type: {
|
|
14
|
+
type: String,
|
|
15
|
+
default: 'default',
|
|
16
|
+
validator: typeValidator,
|
|
17
|
+
},
|
|
18
|
+
size: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: 'normal',
|
|
21
|
+
validator: sizeValidator,
|
|
22
|
+
},
|
|
23
|
+
loading: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: false,
|
|
26
|
+
},
|
|
27
|
+
round: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
default: false,
|
|
30
|
+
},
|
|
31
|
+
block: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
default: false,
|
|
34
|
+
},
|
|
35
|
+
text: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
default: false,
|
|
38
|
+
},
|
|
39
|
+
outline: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: false,
|
|
42
|
+
},
|
|
43
|
+
disabled: {
|
|
44
|
+
type: Boolean,
|
|
45
|
+
default: false,
|
|
46
|
+
},
|
|
47
|
+
ripple: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
default: true,
|
|
50
|
+
},
|
|
51
|
+
color: {
|
|
52
|
+
type: String,
|
|
53
|
+
},
|
|
54
|
+
textColor: {
|
|
55
|
+
type: String,
|
|
56
|
+
},
|
|
57
|
+
loadingRadius: {
|
|
58
|
+
type: [Number, String],
|
|
59
|
+
default: 12,
|
|
60
|
+
},
|
|
61
|
+
loadingType: components_1.pickProps(props_1.props, 'type'),
|
|
62
|
+
loadingSize: components_1.pickProps(props_1.props, 'size'),
|
|
63
|
+
onClick: {
|
|
64
|
+
type: Function,
|
|
65
|
+
},
|
|
66
|
+
onTouchstart: {
|
|
67
|
+
type: Function,
|
|
68
|
+
},
|
|
69
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports._CellComponent = void 0;
|
|
7
|
+
var Cell_vue_1 = __importDefault(require("./Cell.vue"));
|
|
8
|
+
Cell_vue_1.default.install = function (app) {
|
|
9
|
+
app.component(Cell_vue_1.default.name, Cell_vue_1.default);
|
|
10
|
+
};
|
|
11
|
+
exports._CellComponent = Cell_vue_1.default;
|
|
12
|
+
exports.default = Cell_vue_1.default;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare const props: {
|
|
2
|
+
title: {
|
|
3
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
4
|
+
};
|
|
5
|
+
icon: {
|
|
6
|
+
type: StringConstructor;
|
|
7
|
+
};
|
|
8
|
+
desc: {
|
|
9
|
+
type: StringConstructor;
|
|
10
|
+
};
|
|
11
|
+
border: {
|
|
12
|
+
type: BooleanConstructor;
|
|
13
|
+
default: boolean;
|
|
14
|
+
};
|
|
15
|
+
iconClass: {
|
|
16
|
+
type: StringConstructor;
|
|
17
|
+
};
|
|
18
|
+
titleClass: {
|
|
19
|
+
type: StringConstructor;
|
|
20
|
+
};
|
|
21
|
+
descClass: {
|
|
22
|
+
type: StringConstructor;
|
|
23
|
+
};
|
|
24
|
+
extraClass: {
|
|
25
|
+
type: StringConstructor;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.props = void 0;
|
|
4
|
+
exports.props = {
|
|
5
|
+
title: {
|
|
6
|
+
type: [Number, String],
|
|
7
|
+
},
|
|
8
|
+
icon: {
|
|
9
|
+
type: String,
|
|
10
|
+
},
|
|
11
|
+
desc: {
|
|
12
|
+
type: String,
|
|
13
|
+
},
|
|
14
|
+
border: {
|
|
15
|
+
type: Boolean,
|
|
16
|
+
default: false,
|
|
17
|
+
},
|
|
18
|
+
iconClass: {
|
|
19
|
+
type: String,
|
|
20
|
+
},
|
|
21
|
+
titleClass: {
|
|
22
|
+
type: String,
|
|
23
|
+
},
|
|
24
|
+
descClass: {
|
|
25
|
+
type: String,
|
|
26
|
+
},
|
|
27
|
+
extraClass: {
|
|
28
|
+
type: String,
|
|
29
|
+
},
|
|
30
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const _ContextComponent: {
|
|
2
|
+
locks: {
|
|
3
|
+
[x: string]: number;
|
|
4
|
+
};
|
|
5
|
+
zIndex: number;
|
|
6
|
+
touchmoveForbid: boolean;
|
|
7
|
+
};
|
|
8
|
+
declare const _default: {
|
|
9
|
+
locks: {
|
|
10
|
+
[x: string]: number;
|
|
11
|
+
};
|
|
12
|
+
zIndex: number;
|
|
13
|
+
touchmoveForbid: boolean;
|
|
14
|
+
};
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports._ContextComponent = void 0;
|
|
4
|
+
var vue_1 = require("vue");
|
|
5
|
+
var context = {
|
|
6
|
+
locks: {},
|
|
7
|
+
zIndex: 2000,
|
|
8
|
+
touchmoveForbid: true,
|
|
9
|
+
};
|
|
10
|
+
exports._ContextComponent = vue_1.reactive(context);
|
|
11
|
+
exports.default = vue_1.reactive(context);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare function resolveLock(): void;
|
|
2
|
+
export declare function addLock(uid: number): void;
|
|
3
|
+
export declare function releaseLock(uid: number): void;
|
|
4
|
+
/**
|
|
5
|
+
* 组件锁操作
|
|
6
|
+
* @param props 组件props
|
|
7
|
+
* @param state 组件props中控制组件加锁的开关对应的key值
|
|
8
|
+
* @param use 组件props中控制组件加锁的开关是否可用对应的key值
|
|
9
|
+
*/
|
|
10
|
+
export declare function useLock(props: any, state: string, use?: string): void;
|