@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.
Files changed (137) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.en-US.md +11 -0
  3. package/README.md +11 -0
  4. package/generators/sfc/package.json +3 -2
  5. package/generators/sfc/varlet.config.js +5 -0
  6. package/generators/tsx/package.json +3 -2
  7. package/generators/tsx/varlet.config.js +5 -0
  8. package/lib/commands/build.js +19 -15
  9. package/lib/commands/dev.d.ts +3 -2
  10. package/lib/commands/dev.js +23 -34
  11. package/lib/commands/jest.d.ts +3 -3
  12. package/lib/commands/preview.d.ts +1 -0
  13. package/lib/commands/preview.js +65 -0
  14. package/lib/compiler/compileModule.js +7 -14
  15. package/lib/compiler/compileSFC.js +7 -2
  16. package/lib/compiler/compileSiteEntry.d.ts +1 -4
  17. package/lib/compiler/compileSiteEntry.js +10 -20
  18. package/lib/compiler/compileStyle.js +1 -60
  19. package/lib/config/babel.config.js +0 -9
  20. package/lib/config/jest.config.js +1 -1
  21. package/lib/config/jest.lib.mock.d.ts +0 -0
  22. package/lib/config/jest.lib.mock.js +2 -0
  23. package/lib/config/postcss.config.d.ts +4 -1
  24. package/lib/config/postcss.config.js +14 -38
  25. package/lib/config/varlet.config.d.ts +1 -1
  26. package/lib/config/vite.config.d.ts +4 -0
  27. package/lib/config/vite.config.js +128 -0
  28. package/lib/config/webpack.base.config.js +1 -1
  29. package/lib/index.js +7 -2
  30. package/lib/shared/constant.d.ts +2 -8
  31. package/lib/shared/constant.js +3 -9
  32. package/lib/site/components/app-bar/index.d.ts +3 -0
  33. package/lib/site/components/app-bar/index.js +12 -0
  34. package/lib/site/components/app-bar/props.d.ts +21 -0
  35. package/lib/site/components/app-bar/props.js +28 -0
  36. package/lib/site/components/button/index.d.ts +3 -0
  37. package/lib/site/components/button/index.js +12 -0
  38. package/lib/site/components/button/props.d.ts +62 -0
  39. package/lib/site/components/button/props.js +69 -0
  40. package/lib/site/components/cell/index.d.ts +3 -0
  41. package/lib/site/components/cell/index.js +12 -0
  42. package/lib/site/components/cell/props.d.ts +27 -0
  43. package/lib/site/components/cell/props.js +30 -0
  44. package/lib/site/components/context/index.d.ts +15 -0
  45. package/lib/site/components/context/index.js +11 -0
  46. package/lib/site/components/context/lock.d.ts +10 -0
  47. package/lib/site/components/context/lock.js +94 -0
  48. package/lib/site/components/context/zIndex.d.ts +4 -0
  49. package/lib/site/components/context/zIndex.js +19 -0
  50. package/lib/site/components/icon/index.d.ts +3 -0
  51. package/lib/site/components/icon/index.js +12 -0
  52. package/lib/site/components/icon/props.d.ts +23 -0
  53. package/lib/site/components/icon/props.js +25 -0
  54. package/lib/site/components/loading/index.d.ts +3 -0
  55. package/lib/site/components/loading/index.js +12 -0
  56. package/lib/site/components/loading/props.d.ts +26 -0
  57. package/lib/site/components/loading/props.js +34 -0
  58. package/lib/site/components/menu/index.d.ts +3 -0
  59. package/lib/site/components/menu/index.js +12 -0
  60. package/lib/site/components/menu/props.d.ts +40 -0
  61. package/lib/site/components/menu/props.js +43 -0
  62. package/lib/site/components/progress/index.d.ts +3 -0
  63. package/lib/site/components/progress/index.js +12 -0
  64. package/lib/site/components/progress/props.d.ts +43 -0
  65. package/lib/site/components/progress/props.js +57 -0
  66. package/lib/site/components/ripple/index.d.ts +8 -0
  67. package/lib/site/components/ripple/index.js +125 -0
  68. package/lib/site/components/utils/components.d.ts +53 -0
  69. package/lib/site/components/utils/components.js +279 -0
  70. package/lib/site/components/utils/elements.d.ts +30 -0
  71. package/lib/site/components/utils/elements.js +240 -0
  72. package/lib/site/components/utils/shared.d.ts +36 -0
  73. package/lib/site/components/utils/shared.js +181 -0
  74. package/lib/site/mobile/main.d.ts +3 -0
  75. package/lib/site/mobile/main.js +93 -0
  76. package/lib/site/pc/main.d.ts +3 -0
  77. package/lib/site/pc/main.js +69 -0
  78. package/lib/site/useProgress.d.ts +4 -0
  79. package/lib/site/useProgress.js +58 -0
  80. package/lib/site/utils.d.ts +24 -0
  81. package/lib/site/utils.js +133 -0
  82. package/package.json +16 -30
  83. package/site/.DS_Store +0 -0
  84. package/site/components/app-bar/AppBar.vue +45 -0
  85. package/site/components/app-bar/appBar.less +66 -0
  86. package/site/components/app-bar/index.ts +10 -0
  87. package/site/components/app-bar/props.ts +25 -0
  88. package/site/components/button/Button.vue +84 -0
  89. package/site/components/button/button.less +183 -0
  90. package/site/components/button/index.ts +10 -0
  91. package/site/components/button/props.ts +70 -0
  92. package/site/components/cell/Cell.vue +42 -0
  93. package/site/components/cell/cell.less +74 -0
  94. package/site/components/cell/index.ts +10 -0
  95. package/site/components/cell/props.ts +27 -0
  96. package/site/components/context/index.ts +17 -0
  97. package/site/components/context/lock.ts +103 -0
  98. package/site/components/context/zIndex.ts +20 -0
  99. package/site/components/icon/Icon.vue +68 -0
  100. package/site/components/icon/icon.less +25 -0
  101. package/site/components/icon/index.ts +10 -0
  102. package/site/components/icon/props.ts +24 -0
  103. package/site/components/loading/Loading.vue +55 -0
  104. package/site/components/loading/index.ts +10 -0
  105. package/site/components/loading/loading.less +420 -0
  106. package/site/components/loading/props.ts +37 -0
  107. package/site/components/menu/Menu.vue +113 -0
  108. package/site/components/menu/index.ts +10 -0
  109. package/site/components/menu/menu.less +27 -0
  110. package/site/components/menu/props.ts +43 -0
  111. package/site/components/progress/Progress.vue +108 -0
  112. package/site/components/progress/index.ts +10 -0
  113. package/site/components/progress/progress.less +98 -0
  114. package/site/components/progress/props.ts +55 -0
  115. package/site/components/ripple/index.ts +167 -0
  116. package/site/components/ripple/ripple.less +17 -0
  117. package/site/components/styles/common.less +64 -0
  118. package/site/components/styles/elevation.less +126 -0
  119. package/site/components/styles/var.less +27 -0
  120. package/site/components/utils/components.ts +53 -0
  121. package/site/components/utils/elements.ts +83 -0
  122. package/site/components/utils/shared.ts +27 -0
  123. package/site/{pc/index.html → index.html} +6 -4
  124. package/site/mobile/App.vue +20 -18
  125. package/site/mobile/components/AppHome.vue +6 -8
  126. package/site/mobile/main.ts +17 -2
  127. package/site/{mobile/mobile.html → mobile.html} +6 -5
  128. package/site/pc/App.vue +16 -11
  129. package/site/pc/components/AppHeader.vue +15 -13
  130. package/site/pc/components/AppMobile.vue +3 -3
  131. package/site/pc/components/AppSidebar.vue +17 -23
  132. package/site/pc/main.ts +10 -2
  133. package/site/useProgress.ts +11 -9
  134. package/site/utils.ts +14 -3
  135. package/varlet.default.config.js +3 -2
  136. package/generators/sfc/yarn.lock +0 -11231
  137. package/generators/tsx/yarn.lock +0 -11231
@@ -0,0 +1,181 @@
1
+ "use strict";
2
+ var __read = (this && this.__read) || function (o, n) {
3
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
4
+ if (!m) return o;
5
+ var i = m.call(o), r, ar = [], e;
6
+ try {
7
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
8
+ }
9
+ catch (error) { e = { error: error }; }
10
+ finally {
11
+ try {
12
+ if (r && !r.done && (m = i["return"])) m.call(i);
13
+ }
14
+ finally { if (e) throw e.error; }
15
+ }
16
+ return ar;
17
+ };
18
+ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
19
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
20
+ to[j] = from[i];
21
+ return to;
22
+ };
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.kebabCase = exports.uniq = exports.inBrowser = exports.dt = exports.parseFormat = exports.easeInOutCubic = exports.cubic = exports.linear = exports.createCache = exports.debounce = exports.throttle = exports.removeItem = exports.isEmpty = exports.isURL = exports.isArray = exports.isPlainObject = exports.isNumber = exports.isBool = exports.isString = exports.isHTMLSupportVideo = exports.isHTMLSupportImage = exports.toNumber = void 0;
25
+ var toNumber = function (val) {
26
+ if (val == null)
27
+ return 0;
28
+ if (exports.isString(val)) {
29
+ val = parseFloat(val);
30
+ val = Number.isNaN(val) ? 0 : val;
31
+ return val;
32
+ }
33
+ if (exports.isBool(val))
34
+ return Number(val);
35
+ return val;
36
+ };
37
+ exports.toNumber = toNumber;
38
+ var isHTMLSupportImage = function (val) { return val.startsWith('data:image') || /\.(png|jpg|gif|jpeg|svg)$/.test(val); };
39
+ exports.isHTMLSupportImage = isHTMLSupportImage;
40
+ var isHTMLSupportVideo = function (val) { return val.startsWith('data:video') || /\.(mp4|webm|ogg)$/.test(val); };
41
+ exports.isHTMLSupportVideo = isHTMLSupportVideo;
42
+ var isString = function (val) { return typeof val === 'string'; };
43
+ exports.isString = isString;
44
+ var isBool = function (val) { return typeof val === 'boolean'; };
45
+ exports.isBool = isBool;
46
+ var isNumber = function (val) { return typeof val === 'number'; };
47
+ exports.isNumber = isNumber;
48
+ var isPlainObject = function (val) {
49
+ return Object.prototype.toString.call(val) === '[object Object]';
50
+ };
51
+ exports.isPlainObject = isPlainObject;
52
+ var isArray = function (val) { return Array.isArray(val); };
53
+ exports.isArray = isArray;
54
+ var isURL = function (val) { return /^(http)|(\.*\/)/.test(val); };
55
+ exports.isURL = isURL;
56
+ var isEmpty = function (val) {
57
+ return val === undefined || val === null || val === '' || (Array.isArray(val) && !val.length);
58
+ };
59
+ exports.isEmpty = isEmpty;
60
+ var removeItem = function (arr, item) {
61
+ if (arr.length) {
62
+ var index = arr.indexOf(item);
63
+ if (index > -1) {
64
+ return arr.splice(index, 1);
65
+ }
66
+ }
67
+ };
68
+ exports.removeItem = removeItem;
69
+ var throttle = function (method, mustRunDelay) {
70
+ if (mustRunDelay === void 0) { mustRunDelay = 200; }
71
+ var timer;
72
+ var start;
73
+ return function loop() {
74
+ var _this = this;
75
+ var args = [];
76
+ for (var _i = 0; _i < arguments.length; _i++) {
77
+ args[_i] = arguments[_i];
78
+ }
79
+ var now = Date.now();
80
+ if (!start) {
81
+ start = now;
82
+ }
83
+ if (timer) {
84
+ window.clearTimeout(timer);
85
+ }
86
+ if (now - start >= mustRunDelay) {
87
+ method.apply(this, args);
88
+ start = now;
89
+ }
90
+ else {
91
+ timer = window.setTimeout(function () {
92
+ loop.apply(_this, args);
93
+ }, 50);
94
+ }
95
+ };
96
+ };
97
+ exports.throttle = throttle;
98
+ var debounce = function (method, delay) {
99
+ if (delay === void 0) { delay = 200; }
100
+ var timer;
101
+ return function () {
102
+ var _this = this;
103
+ var args = [];
104
+ for (var _i = 0; _i < arguments.length; _i++) {
105
+ args[_i] = arguments[_i];
106
+ }
107
+ timer && window.clearTimeout(timer);
108
+ timer = window.setTimeout(function () {
109
+ method.apply(_this, args);
110
+ }, delay);
111
+ };
112
+ };
113
+ exports.debounce = debounce;
114
+ var createCache = function (max) {
115
+ var cache = [];
116
+ return {
117
+ cache: cache,
118
+ has: function (key) {
119
+ return this.cache.includes(key);
120
+ },
121
+ add: function (key) {
122
+ if (this.has(key)) {
123
+ return;
124
+ }
125
+ this.cache.length === max && cache.shift();
126
+ this.cache.push(key);
127
+ },
128
+ remove: function (key) {
129
+ this.has(key) && exports.removeItem(this.cache, key);
130
+ },
131
+ clear: function () {
132
+ this.cache.length = 0;
133
+ },
134
+ };
135
+ };
136
+ exports.createCache = createCache;
137
+ var linear = function (value) { return value; };
138
+ exports.linear = linear;
139
+ var cubic = function (value) { return Math.pow(value, 3); };
140
+ exports.cubic = cubic;
141
+ var easeInOutCubic = function (value) {
142
+ return value < 0.5 ? exports.cubic(value * 2) / 2 : 1 - exports.cubic((1 - value) * 2) / 2;
143
+ };
144
+ exports.easeInOutCubic = easeInOutCubic;
145
+ function parseFormat(format, time) {
146
+ var scannedTimes = Object.values(time);
147
+ var scannedFormats = ['DD', 'HH', 'mm', 'ss'];
148
+ var padValues = [24, 60, 60, 1000];
149
+ scannedFormats.forEach(function (scannedFormat, index) {
150
+ if (!format.includes(scannedFormat)) {
151
+ scannedTimes[index + 1] += scannedTimes[index] * padValues[index];
152
+ }
153
+ else {
154
+ format = format.replace(scannedFormat, String(scannedTimes[index]).padStart(2, '0'));
155
+ }
156
+ });
157
+ if (format.includes('S')) {
158
+ var ms = String(scannedTimes[scannedTimes.length - 1]).padStart(3, '0');
159
+ if (format.includes('SSS')) {
160
+ format = format.replace('SSS', ms);
161
+ }
162
+ else if (format.includes('SS')) {
163
+ format = format.replace('SS', ms.slice(0, 2));
164
+ }
165
+ else {
166
+ format = format.replace('S', ms.slice(0, 1));
167
+ }
168
+ }
169
+ return format;
170
+ }
171
+ exports.parseFormat = parseFormat;
172
+ var dt = function (value, defaultText) { return (value == null ? defaultText : value); };
173
+ exports.dt = dt;
174
+ exports.inBrowser = typeof window !== 'undefined';
175
+ var uniq = function (arr) { return __spreadArray([], __read(new Set(arr))); };
176
+ exports.uniq = uniq;
177
+ function kebabCase(str) {
178
+ var reg = /([^-])([A-Z])/g;
179
+ return str.replace(reg, '$1-$2').replace(reg, '$1-$2').toLowerCase();
180
+ }
181
+ exports.kebabCase = kebabCase;
@@ -0,0 +1,3 @@
1
+ import '@varlet/touch-emulator';
2
+ import '../components/styles/common.less';
3
+ import '../components/styles/elevation.less';
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ var __importDefault = (this && this.__importDefault) || function (mod) {
22
+ return (mod && mod.__esModule) ? mod : { "default": mod };
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ // @ts-ignore
26
+ var _mobile_routes_1 = __importDefault(require("@mobile-routes"));
27
+ // @ts-ignore
28
+ var _config_1 = __importDefault(require("@config"));
29
+ var App_vue_1 = __importDefault(require("./App.vue"));
30
+ require("@varlet/touch-emulator");
31
+ var vue_1 = require("vue");
32
+ var vue_router_1 = require("vue-router");
33
+ var icon_1 = __importDefault(require("../components/icon"));
34
+ var app_bar_1 = __importDefault(require("../components/app-bar"));
35
+ var button_1 = __importDefault(require("../components/button"));
36
+ var menu_1 = __importDefault(require("../components/menu"));
37
+ var cell_1 = __importDefault(require("../components/cell"));
38
+ var ripple_1 = __importDefault(require("../components/ripple"));
39
+ require("../components/styles/common.less");
40
+ require("../components/styles/elevation.less");
41
+ var lodash_es_1 = require("lodash-es");
42
+ var utils_1 = require("../utils");
43
+ var redirect = lodash_es_1.get(_config_1.default, 'mobile.redirect');
44
+ var defaultLanguage = lodash_es_1.get(_config_1.default, 'defaultLanguage');
45
+ redirect &&
46
+ _mobile_routes_1.default.push({
47
+ path: '/:pathMatch(.*)',
48
+ redirect: redirect,
49
+ });
50
+ _mobile_routes_1.default.push({
51
+ path: '/home',
52
+ component: function () { return Promise.resolve().then(function () { return __importStar(require('./components/AppHome.vue')); }); }
53
+ });
54
+ var router = vue_router_1.createRouter({
55
+ history: vue_router_1.createWebHashHistory(),
56
+ scrollBehavior: function (to, from, savedPosition) { return savedPosition || { left: 0, top: 0 }; },
57
+ routes: _mobile_routes_1.default,
58
+ });
59
+ router.beforeEach(function (to, from) {
60
+ var _a;
61
+ var language = (_a = to.query.language) !== null && _a !== void 0 ? _a : defaultLanguage;
62
+ var path = to.path;
63
+ var replace = to.query.replace;
64
+ if (!utils_1.isPhone() && !utils_1.inIframe()) {
65
+ window.location.href = "./#/" + language + path;
66
+ }
67
+ if (!utils_1.isPhone() && utils_1.inIframe()) {
68
+ // @ts-ignore
69
+ window.top.onMobileRouteChange(path, language, replace);
70
+ }
71
+ // @ts-ignore
72
+ if (window._hmt) {
73
+ if (to.path) {
74
+ // @ts-ignore
75
+ window._hmt.push(['_trackPageview', "/#" + to.fullPath]);
76
+ }
77
+ }
78
+ });
79
+ // @ts-ignore
80
+ vue_1.createApp(App_vue_1.default)
81
+ .use(router)
82
+ // @ts-ignore
83
+ .use(icon_1.default)
84
+ // @ts-ignore
85
+ .use(app_bar_1.default)
86
+ // @ts-ignore
87
+ .use(cell_1.default)
88
+ .use(ripple_1.default)
89
+ // @ts-ignore
90
+ .use(button_1.default)
91
+ // @ts-ignore
92
+ .use(menu_1.default)
93
+ .mount('#app');
@@ -0,0 +1,3 @@
1
+ import '@varlet/touch-emulator';
2
+ import '../components/styles/common.less';
3
+ import '../components/styles/elevation.less';
@@ -0,0 +1,69 @@
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
+ var App_vue_1 = __importDefault(require("./App.vue"));
7
+ require("@varlet/touch-emulator");
8
+ // @ts-ignore
9
+ var _pc_routes_1 = __importDefault(require("@pc-routes"));
10
+ // @ts-ignore
11
+ var _config_1 = __importDefault(require("@config"));
12
+ var icon_1 = __importDefault(require("../components/icon"));
13
+ var cell_1 = __importDefault(require("../components/cell"));
14
+ var ripple_1 = __importDefault(require("../components/ripple"));
15
+ require("../components/styles/common.less");
16
+ require("../components/styles/elevation.less");
17
+ var vue_1 = require("vue");
18
+ var vue_router_1 = require("vue-router");
19
+ var lodash_es_1 = require("lodash-es");
20
+ var useProgress_1 = require("../useProgress");
21
+ var defaultLanguage = lodash_es_1.get(_config_1.default, 'defaultLanguage');
22
+ var redirect = lodash_es_1.get(_config_1.default, 'pc.redirect');
23
+ var mobileRedirect = lodash_es_1.get(_config_1.default, 'mobile.redirect');
24
+ redirect &&
25
+ _pc_routes_1.default.push({
26
+ path: '/:pathMatch(.*)*',
27
+ redirect: "/" + defaultLanguage + redirect,
28
+ });
29
+ var router = vue_router_1.createRouter({
30
+ history: vue_router_1.createWebHashHistory(),
31
+ routes: _pc_routes_1.default,
32
+ });
33
+ var isEnd = true;
34
+ var _a = useProgress_1.useProgress(), start = _a.start, end = _a.end;
35
+ router.beforeEach(function (to, from) {
36
+ if (to.path === from.path) {
37
+ return false;
38
+ }
39
+ isEnd = false;
40
+ setTimeout(function () { return !isEnd && start(); }, 200);
41
+ // @ts-ignore
42
+ if (window._hmt) {
43
+ if (to.path) {
44
+ // @ts-ignore
45
+ window._hmt.push(['_trackPageview', "/#" + to.fullPath]);
46
+ }
47
+ }
48
+ });
49
+ router.afterEach(function () {
50
+ isEnd = true;
51
+ end();
52
+ });
53
+ Object.defineProperty(window, 'onMobileRouteChange', {
54
+ value: function (path, language, replace) {
55
+ if (path === mobileRedirect) {
56
+ router.replace("/" + language + "/" + replace);
57
+ return;
58
+ }
59
+ router.replace("/" + language + path);
60
+ }
61
+ });
62
+ vue_1.createApp(App_vue_1.default)
63
+ .use(router)
64
+ // @ts-ignore
65
+ .use(cell_1.default)
66
+ .use(ripple_1.default)
67
+ // @ts-ignore
68
+ .use(icon_1.default)
69
+ .mount('#app');
@@ -0,0 +1,4 @@
1
+ export declare function useProgress(): {
2
+ start: () => void;
3
+ end: () => void;
4
+ };
@@ -0,0 +1,58 @@
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.useProgress = void 0;
7
+ var progress_1 = __importDefault(require("./components/progress"));
8
+ var vue_1 = require("vue");
9
+ // @ts-ignore
10
+ var _config_1 = __importDefault(require("@config"));
11
+ // @ts-ignore
12
+ var utils_1 = require("./utils");
13
+ var lodash_es_1 = require("lodash-es");
14
+ function useProgress() {
15
+ var timer;
16
+ var trackColor = lodash_es_1.get(_config_1.default, 'themes.color-progress-track');
17
+ var color = lodash_es_1.get(_config_1.default, 'themes.color-progress');
18
+ var props = vue_1.reactive({
19
+ style: {
20
+ position: 'fixed',
21
+ width: '100%',
22
+ left: 0,
23
+ top: 0,
24
+ zIndex: 10086,
25
+ },
26
+ trackColor: trackColor,
27
+ color: color,
28
+ lineWidth: 3,
29
+ value: 0,
30
+ });
31
+ var changeValue = function () {
32
+ timer = window.setTimeout(function () {
33
+ if (props.value >= 95)
34
+ return;
35
+ var num = Math.random();
36
+ if (props.value < 70)
37
+ num = Math.round(5 * Math.random());
38
+ props.value += num;
39
+ changeValue();
40
+ }, 200);
41
+ };
42
+ var start = function () {
43
+ props.value = 0;
44
+ setTimeout(function () { return (props.color = color); }, 200);
45
+ changeValue();
46
+ };
47
+ var end = function () {
48
+ props.value = 100;
49
+ setTimeout(function () { return (props.color = trackColor); }, 300);
50
+ window.clearTimeout(timer);
51
+ };
52
+ utils_1.mountInstance(progress_1.default, props);
53
+ return {
54
+ start: start,
55
+ end: end,
56
+ };
57
+ }
58
+ exports.useProgress = useProgress;
@@ -0,0 +1,24 @@
1
+ export * from './components/utils/components';
2
+ export * from './components/utils/elements';
3
+ export * from './components/utils/shared';
4
+ export declare type StyleVars = Record<string, string>;
5
+ export declare function camelize(str: string): string;
6
+ export declare function bigCamelize(str: string): string;
7
+ export interface PCLocationInfo {
8
+ language: string;
9
+ menuName: string;
10
+ }
11
+ export declare function getPCLocationInfo(): PCLocationInfo;
12
+ export declare function isPhone(): boolean;
13
+ export declare enum MenuTypes {
14
+ TITLE = 1,
15
+ COMPONENT = 2,
16
+ DOCUMENTATION = 3
17
+ }
18
+ export declare function inIframe(): boolean;
19
+ export declare function removeEmpty(object?: Record<string, string>): Record<string, string>;
20
+ export declare function getHashSearch(): URLSearchParams;
21
+ export declare function watchLang(cb: (lang: string) => void, platform?: 'pc' | 'mobile'): void;
22
+ export declare function watchPlatform(cb: (platform: string) => void): void;
23
+ export declare function addRouteListener(cb: () => void): void;
24
+ export declare function setThemes(config: Record<string, any>): void;
@@ -0,0 +1,133 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ var __read = (this && this.__read) || function (o, n) {
13
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
14
+ if (!m) return o;
15
+ var i = m.call(o), r, ar = [], e;
16
+ try {
17
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
18
+ }
19
+ catch (error) { e = { error: error }; }
20
+ finally {
21
+ try {
22
+ if (r && !r.done && (m = i["return"])) m.call(i);
23
+ }
24
+ finally { if (e) throw e.error; }
25
+ }
26
+ return ar;
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.setThemes = exports.addRouteListener = exports.watchPlatform = exports.watchLang = exports.getHashSearch = exports.removeEmpty = exports.inIframe = exports.MenuTypes = exports.isPhone = exports.getPCLocationInfo = exports.bigCamelize = exports.camelize = void 0;
30
+ var vue_1 = require("vue");
31
+ var lodash_es_1 = require("lodash-es");
32
+ var elements_1 = require("./components/utils/elements");
33
+ __exportStar(require("./components/utils/components"), exports);
34
+ __exportStar(require("./components/utils/elements"), exports);
35
+ __exportStar(require("./components/utils/shared"), exports);
36
+ function StyleProvider(styleVars) {
37
+ if (styleVars === void 0) { styleVars = {}; }
38
+ var styles = elements_1.formatStyleVars(styleVars);
39
+ Object.entries(styles).forEach(function (_a) {
40
+ var _b = __read(_a, 2), key = _b[0], value = _b[1];
41
+ return document.documentElement.style.setProperty(key, value);
42
+ });
43
+ }
44
+ function camelize(str) {
45
+ return str.replace(/-(\w)/g, function (_, p) { return p.toUpperCase(); });
46
+ }
47
+ exports.camelize = camelize;
48
+ function bigCamelize(str) {
49
+ return camelize(str).replace(str.charAt(0), str.charAt(0).toUpperCase());
50
+ }
51
+ exports.bigCamelize = bigCamelize;
52
+ function getPCLocationInfo() {
53
+ var _a = __read(window.location.hash.split('/'), 3), language = _a[1], menuName = _a[2];
54
+ return {
55
+ language: language,
56
+ menuName: menuName
57
+ };
58
+ }
59
+ exports.getPCLocationInfo = getPCLocationInfo;
60
+ function isPhone() {
61
+ return /Android|webOS|iPhone|iPod|BlackBerry|Pad/i.test(navigator.userAgent);
62
+ }
63
+ exports.isPhone = isPhone;
64
+ var MenuTypes;
65
+ (function (MenuTypes) {
66
+ MenuTypes[MenuTypes["TITLE"] = 1] = "TITLE";
67
+ MenuTypes[MenuTypes["COMPONENT"] = 2] = "COMPONENT";
68
+ MenuTypes[MenuTypes["DOCUMENTATION"] = 3] = "DOCUMENTATION";
69
+ })(MenuTypes = exports.MenuTypes || (exports.MenuTypes = {}));
70
+ function inIframe() {
71
+ return window.self !== window.top;
72
+ }
73
+ exports.inIframe = inIframe;
74
+ function removeEmpty(object) {
75
+ if (object === void 0) { object = {}; }
76
+ return Object.keys(object).reduce(function (record, key) {
77
+ var value = object[key];
78
+ value && (record[key] = value);
79
+ return record;
80
+ }, {});
81
+ }
82
+ exports.removeEmpty = removeEmpty;
83
+ function getHashSearch() {
84
+ var href = window.location.href;
85
+ var hashSearch = href.slice(href.indexOf('?'));
86
+ return new URLSearchParams(hashSearch);
87
+ }
88
+ exports.getHashSearch = getHashSearch;
89
+ function watchLang(cb, platform) {
90
+ if (platform === void 0) { platform = 'mobile'; }
91
+ var handleHashchange = function () {
92
+ var _a;
93
+ var language = platform === 'mobile'
94
+ ? ((_a = getHashSearch().get('language')) !== null && _a !== void 0 ? _a : 'zh-CN')
95
+ : getPCLocationInfo().language;
96
+ cb(language);
97
+ };
98
+ addRouteListener(handleHashchange);
99
+ handleHashchange();
100
+ }
101
+ exports.watchLang = watchLang;
102
+ function watchPlatform(cb) {
103
+ var handleHashchange = function () {
104
+ var _a;
105
+ var platform = (_a = getHashSearch().get('platform')) !== null && _a !== void 0 ? _a : 'mobile';
106
+ cb(platform);
107
+ };
108
+ addRouteListener(handleHashchange);
109
+ handleHashchange();
110
+ }
111
+ exports.watchPlatform = watchPlatform;
112
+ function addRouteListener(cb) {
113
+ vue_1.onMounted(function () {
114
+ window.addEventListener('hashchange', cb);
115
+ window.addEventListener('popstate', cb);
116
+ });
117
+ vue_1.onUnmounted(function () {
118
+ window.removeEventListener('hashchange', cb);
119
+ window.removeEventListener('popstate', cb);
120
+ });
121
+ }
122
+ exports.addRouteListener = addRouteListener;
123
+ function setThemes(config) {
124
+ var themes = lodash_es_1.get(config, 'themes', {});
125
+ Object.keys(themes).forEach(function (key) {
126
+ var _a;
127
+ var theme = themes[key];
128
+ StyleProvider((_a = {},
129
+ _a["--site-config-" + key] = theme,
130
+ _a));
131
+ });
132
+ }
133
+ exports.setThemes = setThemes;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@varlet/cli",
3
- "version": "1.20.0",
3
+ "version": "1.21.1-alpha.64+4e9f81da",
4
4
  "description": "cli of varlet",
5
5
  "bin": {
6
6
  "varlet-cli": "./lib/index.js"
@@ -31,7 +31,7 @@
31
31
  "dev": "tsc --watch",
32
32
  "build": "tsc"
33
33
  },
34
- "gitHead": "ec0aa70ef11d945d8dfb7cf88879e1447b3de9d9",
34
+ "gitHead": "4e9f81dabf854961e3bd99c445a0a8566b26db66",
35
35
  "dependencies": {
36
36
  "@babel/core": "^7.14.8",
37
37
  "@babel/preset-env": "^7.14.8",
@@ -41,69 +41,55 @@
41
41
  "@release-it/conventional-changelog": "^3.3.0",
42
42
  "@varlet/eslint-config": "^1.13.0",
43
43
  "@varlet/icons": "^1.0.0",
44
- "@varlet/markdown-loader": "^1.20.0",
44
+ "@varlet/markdown-vite-plugin": "^1.20.0",
45
45
  "@varlet/stylelint-config": "^1.9.0",
46
46
  "@varlet/touch-emulator": "^1.0.1",
47
- "@varlet/ui": "^1.20.0",
48
- "@vue/babel-plugin-jsx": "^1.0.6",
49
- "@vue/compiler-sfc": "3.1.4",
47
+ "@vitejs/plugin-vue": "1.9.2",
48
+ "@vitejs/plugin-vue-jsx": "1.1.8",
49
+ "@vue/babel-plugin-jsx": "^1.0.7",
50
+ "@vue/compiler-sfc": "3.2.16",
50
51
  "@vue/test-utils": "^2.0.0-rc.6",
51
- "autoprefixer": "9",
52
+ "address": "^1.1.2",
52
53
  "babel-jest": "26.6.3",
53
- "babel-loader": "^8.2.2",
54
- "babel-plugin-import": "^1.13.3",
55
54
  "chalk": "^4.1.0",
56
- "chokidar": "^3.5.2",
57
- "clean-webpack-plugin": "^3.0.0",
58
55
  "clipboard": "^2.0.6",
59
56
  "commander": "^6.2.0",
60
57
  "commitizen": "^4.2.2",
61
58
  "conventional-changelog-cli": "^2.1.1",
62
- "copy-webpack-plugin": "^9.0.1",
63
- "css-loader": "^5.0.0",
64
59
  "cz-conventional-changelog": "^3.3.0",
65
60
  "eslint": "^7.30.0",
66
61
  "execa": "^5.0.0",
67
- "fork-ts-checker-webpack-plugin": "^5.2.1",
68
62
  "fs-extra": "^9.0.1",
69
63
  "hash-sum": "^2.0.0",
70
- "html-webpack-plugin": "^5.1.0",
71
64
  "husky": "^7.0.1",
72
65
  "inquirer": "^8.1.2",
73
66
  "jest": "^26.6.3",
74
67
  "less": "^3.12.2",
75
- "less-loader": "^7.0.2",
76
68
  "lint-staged": "^10.5.0",
69
+ "live-server": "^1.2.1",
77
70
  "lodash": "^4.17.21",
71
+ "lodash-es": "^4.17.21",
78
72
  "ora": "^5.4.0",
79
- "portfinder": "^1.0.28",
80
- "postcss": "7",
81
- "postcss-loader": "^4.0.4",
82
73
  "prettier": "^2.3.2",
83
74
  "release-it": "^14.11.5",
84
75
  "slash": "^3.0.0",
85
- "style-loader": "^2.0.0",
86
76
  "stylelint": "^13.13.1",
87
77
  "ts-jest": "^26.5.1",
88
78
  "typescript": "^4.3.5",
79
+ "vite": "2.6.2",
80
+ "vite-plugin-html": "^2.1.0",
89
81
  "vue-jest": "^5.0.0-alpha.8",
90
- "vue-loader": "16.5.0",
91
- "vue-router": "4.0.0-rc.1",
92
- "webpack": "^5.23.0",
93
- "webpack-dev-server": "^4.2.0",
94
- "webpack-merge": "^5.3.0",
95
- "webpackbar": "^5.0.0-3"
82
+ "vue-router": "4.0.0-rc.1"
96
83
  },
97
84
  "devDependencies": {
98
85
  "@types/babel__core": "^7.1.12",
99
- "@types/copy-webpack-plugin": "^8.0.1",
100
86
  "@types/fs-extra": "^9.0.2",
101
87
  "@types/hash-sum": "^1.0.0",
102
88
  "@types/jest": "^26.0.15",
103
- "@types/lodash": "^4.14.168",
104
- "@types/webpack-dev-server": "^4.1.0"
89
+ "@types/lodash": "^4.14.174",
90
+ "@types/lodash-es": "^4.17.5"
105
91
  },
106
92
  "peerDependencies": {
107
- "vue": "3.1.4"
93
+ "vue": "3.2.16"
108
94
  }
109
95
  }
package/site/.DS_Store ADDED
Binary file