@varlet/cli 1.21.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.
Files changed (133) hide show
  1. package/README.en-US.md +11 -0
  2. package/README.md +11 -0
  3. package/generators/sfc/package.json +3 -2
  4. package/generators/sfc/varlet.config.js +5 -0
  5. package/generators/tsx/package.json +3 -2
  6. package/generators/tsx/varlet.config.js +5 -0
  7. package/lib/commands/build.js +19 -15
  8. package/lib/commands/dev.d.ts +3 -2
  9. package/lib/commands/dev.js +23 -34
  10. package/lib/commands/jest.d.ts +3 -3
  11. package/lib/commands/preview.d.ts +1 -0
  12. package/lib/commands/preview.js +65 -0
  13. package/lib/compiler/compileModule.js +7 -14
  14. package/lib/compiler/compileSFC.js +7 -2
  15. package/lib/compiler/compileSiteEntry.d.ts +1 -4
  16. package/lib/compiler/compileSiteEntry.js +10 -20
  17. package/lib/compiler/compileStyle.js +1 -60
  18. package/lib/config/babel.config.js +0 -9
  19. package/lib/config/jest.config.js +1 -1
  20. package/lib/config/jest.lib.mock.d.ts +0 -0
  21. package/lib/config/jest.lib.mock.js +2 -0
  22. package/lib/config/varlet.config.d.ts +1 -1
  23. package/lib/config/vite.config.d.ts +4 -0
  24. package/lib/config/vite.config.js +128 -0
  25. package/lib/index.js +7 -2
  26. package/lib/shared/constant.d.ts +2 -8
  27. package/lib/shared/constant.js +3 -9
  28. package/lib/site/components/app-bar/index.d.ts +3 -0
  29. package/lib/site/components/app-bar/index.js +12 -0
  30. package/lib/site/components/app-bar/props.d.ts +21 -0
  31. package/lib/site/components/app-bar/props.js +28 -0
  32. package/lib/site/components/button/index.d.ts +3 -0
  33. package/lib/site/components/button/index.js +12 -0
  34. package/lib/site/components/button/props.d.ts +62 -0
  35. package/lib/site/components/button/props.js +69 -0
  36. package/lib/site/components/cell/index.d.ts +3 -0
  37. package/lib/site/components/cell/index.js +12 -0
  38. package/lib/site/components/cell/props.d.ts +27 -0
  39. package/lib/site/components/cell/props.js +30 -0
  40. package/lib/site/components/context/index.d.ts +15 -0
  41. package/lib/site/components/context/index.js +11 -0
  42. package/lib/site/components/context/lock.d.ts +10 -0
  43. package/lib/site/components/context/lock.js +94 -0
  44. package/lib/site/components/context/zIndex.d.ts +4 -0
  45. package/lib/site/components/context/zIndex.js +19 -0
  46. package/lib/site/components/icon/index.d.ts +3 -0
  47. package/lib/site/components/icon/index.js +12 -0
  48. package/lib/site/components/icon/props.d.ts +23 -0
  49. package/lib/site/components/icon/props.js +25 -0
  50. package/lib/site/components/loading/index.d.ts +3 -0
  51. package/lib/site/components/loading/index.js +12 -0
  52. package/lib/site/components/loading/props.d.ts +26 -0
  53. package/lib/site/components/loading/props.js +34 -0
  54. package/lib/site/components/menu/index.d.ts +3 -0
  55. package/lib/site/components/menu/index.js +12 -0
  56. package/lib/site/components/menu/props.d.ts +40 -0
  57. package/lib/site/components/menu/props.js +43 -0
  58. package/lib/site/components/progress/index.d.ts +3 -0
  59. package/lib/site/components/progress/index.js +12 -0
  60. package/lib/site/components/progress/props.d.ts +43 -0
  61. package/lib/site/components/progress/props.js +57 -0
  62. package/lib/site/components/ripple/index.d.ts +8 -0
  63. package/lib/site/components/ripple/index.js +125 -0
  64. package/lib/site/components/utils/components.d.ts +53 -0
  65. package/lib/site/components/utils/components.js +279 -0
  66. package/lib/site/components/utils/elements.d.ts +30 -0
  67. package/lib/site/components/utils/elements.js +240 -0
  68. package/lib/site/components/utils/shared.d.ts +36 -0
  69. package/lib/site/components/utils/shared.js +181 -0
  70. package/lib/site/mobile/main.d.ts +3 -0
  71. package/lib/site/mobile/main.js +93 -0
  72. package/lib/site/pc/main.d.ts +3 -0
  73. package/lib/site/pc/main.js +69 -0
  74. package/lib/site/useProgress.d.ts +4 -0
  75. package/lib/site/useProgress.js +58 -0
  76. package/lib/site/utils.d.ts +24 -0
  77. package/lib/site/utils.js +133 -0
  78. package/package.json +16 -30
  79. package/site/.DS_Store +0 -0
  80. package/site/components/app-bar/AppBar.vue +45 -0
  81. package/site/components/app-bar/appBar.less +66 -0
  82. package/site/components/app-bar/index.ts +10 -0
  83. package/site/components/app-bar/props.ts +25 -0
  84. package/site/components/button/Button.vue +84 -0
  85. package/site/components/button/button.less +183 -0
  86. package/site/components/button/index.ts +10 -0
  87. package/site/components/button/props.ts +70 -0
  88. package/site/components/cell/Cell.vue +42 -0
  89. package/site/components/cell/cell.less +74 -0
  90. package/site/components/cell/index.ts +10 -0
  91. package/site/components/cell/props.ts +27 -0
  92. package/site/components/context/index.ts +17 -0
  93. package/site/components/context/lock.ts +103 -0
  94. package/site/components/context/zIndex.ts +20 -0
  95. package/site/components/icon/Icon.vue +68 -0
  96. package/site/components/icon/icon.less +25 -0
  97. package/site/components/icon/index.ts +10 -0
  98. package/site/components/icon/props.ts +24 -0
  99. package/site/components/loading/Loading.vue +55 -0
  100. package/site/components/loading/index.ts +10 -0
  101. package/site/components/loading/loading.less +420 -0
  102. package/site/components/loading/props.ts +37 -0
  103. package/site/components/menu/Menu.vue +113 -0
  104. package/site/components/menu/index.ts +10 -0
  105. package/site/components/menu/menu.less +27 -0
  106. package/site/components/menu/props.ts +43 -0
  107. package/site/components/progress/Progress.vue +108 -0
  108. package/site/components/progress/index.ts +10 -0
  109. package/site/components/progress/progress.less +98 -0
  110. package/site/components/progress/props.ts +55 -0
  111. package/site/components/ripple/index.ts +167 -0
  112. package/site/components/ripple/ripple.less +17 -0
  113. package/site/components/styles/common.less +64 -0
  114. package/site/components/styles/elevation.less +126 -0
  115. package/site/components/styles/var.less +27 -0
  116. package/site/components/utils/components.ts +53 -0
  117. package/site/components/utils/elements.ts +83 -0
  118. package/site/components/utils/shared.ts +27 -0
  119. package/site/{pc/index.html → index.html} +6 -4
  120. package/site/mobile/App.vue +20 -18
  121. package/site/mobile/components/AppHome.vue +6 -8
  122. package/site/mobile/main.ts +17 -2
  123. package/site/{mobile/mobile.html → mobile.html} +6 -5
  124. package/site/pc/App.vue +16 -11
  125. package/site/pc/components/AppHeader.vue +15 -13
  126. package/site/pc/components/AppMobile.vue +3 -3
  127. package/site/pc/components/AppSidebar.vue +17 -23
  128. package/site/pc/main.ts +10 -2
  129. package/site/useProgress.ts +11 -9
  130. package/site/utils.ts +14 -3
  131. package/varlet.default.config.js +3 -2
  132. package/generators/sfc/yarn.lock +0 -11231
  133. package/generators/tsx/yarn.lock +0 -11231
@@ -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;
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 logger_1 = __importDefault(require("./shared/logger"));
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').description('Run varlet development environment').action(dev_1.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')
@@ -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 WEBPACK_RESOLVE_EXTENSIONS: string[];
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;
@@ -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.SITE_EXAMPLE_GLOB = exports.SITE_DOCS_GLOB = exports.SITE_CONFIG = exports.SITE_MOBILE_ROUTES = exports.SITE_PC_ROUTES = exports.SITE_PUBLIC_PATH = exports.SITE_OUTPUT_PATH = exports.SITE = exports.SITE_PC_MAIN = exports.SITE_MOBILE_MAIN = exports.PRIMARY_COLOR = 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.WEBPACK_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.TS_CONFIG = exports.POSTCSS_CONFIG = exports.CWD = void 0;
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.WEBPACK_RESOLVE_EXTENSIONS = ['.js', '.jsx', '.vue', '.ts', '.tsx', '.css', '.less'];
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,3 @@
1
+ import AppBar from './AppBar.vue';
2
+ export declare const _AppBarComponent: any;
3
+ export default AppBar;
@@ -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,3 @@
1
+ import Button from './Button.vue';
2
+ export declare const _ButtonComponent: any;
3
+ export default Button;
@@ -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,3 @@
1
+ import Cell from './Cell.vue';
2
+ export declare const _CellComponent: any;
3
+ export default Cell;
@@ -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;
@@ -0,0 +1,94 @@
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.useLock = exports.releaseLock = exports.addLock = exports.resolveLock = void 0;
7
+ var vue_1 = require("vue");
8
+ var _1 = __importDefault(require("."));
9
+ function resolveLock() {
10
+ var lockCounts = Object.keys(_1.default.locks).length;
11
+ lockCounts <= 0 ? document.body.classList.remove('var-site--lock') : document.body.classList.add('var-site--lock');
12
+ }
13
+ exports.resolveLock = resolveLock;
14
+ function addLock(uid) {
15
+ _1.default.locks[uid] = 1;
16
+ resolveLock();
17
+ }
18
+ exports.addLock = addLock;
19
+ function releaseLock(uid) {
20
+ delete _1.default.locks[uid];
21
+ resolveLock();
22
+ }
23
+ exports.releaseLock = releaseLock;
24
+ /**
25
+ * 组件锁操作
26
+ * @param props 组件props
27
+ * @param state 组件props中控制组件加锁的开关对应的key值
28
+ * @param use 组件props中控制组件加锁的开关是否可用对应的key值
29
+ */
30
+ function useLock(props, state, use) {
31
+ var uid = vue_1.getCurrentInstance().uid;
32
+ if (use) {
33
+ vue_1.watch(function () { return props[use]; }, function (newValue) {
34
+ if (newValue === false) {
35
+ // 改变为禁用状态 组件解锁
36
+ releaseLock(uid);
37
+ }
38
+ else if (newValue === true && props[state] === true) {
39
+ // 改变为启用状态 并且popup处于开启状态 组件加锁
40
+ addLock(uid);
41
+ }
42
+ });
43
+ }
44
+ vue_1.watch(function () { return props[state]; }, function (newValue) {
45
+ if (use && props[use] === false) {
46
+ return;
47
+ }
48
+ if (newValue === true) {
49
+ // popup开启 组件加锁
50
+ addLock(uid);
51
+ }
52
+ else {
53
+ // popup关闭 组件解锁
54
+ releaseLock(uid);
55
+ }
56
+ });
57
+ vue_1.onBeforeMount(function () {
58
+ if (use && props[use] === false) {
59
+ return;
60
+ }
61
+ if (props[state] === true) {
62
+ // popup处于开启状态 组件挂载 组件加锁
63
+ addLock(uid);
64
+ }
65
+ });
66
+ vue_1.onUnmounted(function () {
67
+ if (use && props[use] === false) {
68
+ return;
69
+ }
70
+ if (props[state] === true) {
71
+ // popup处于开启状态 组件卸载 组件解锁
72
+ releaseLock(uid);
73
+ }
74
+ });
75
+ vue_1.onActivated(function () {
76
+ if (use && props[use] === false) {
77
+ return;
78
+ }
79
+ if (props[state] === true) {
80
+ // popup处于开启状态 组件处于keepalive前台 组件加锁
81
+ addLock(uid);
82
+ }
83
+ });
84
+ vue_1.onDeactivated(function () {
85
+ if (use && props[use] === false) {
86
+ return;
87
+ }
88
+ if (props[state] === true) {
89
+ // popup处于开启状态 组件处于keepalive后台 组件解锁
90
+ releaseLock(uid);
91
+ }
92
+ });
93
+ }
94
+ exports.useLock = useLock;
@@ -0,0 +1,4 @@
1
+ import type { Ref } from 'vue';
2
+ export declare function useZIndex(source: any, count: number): {
3
+ zIndex: Ref<number>;
4
+ };