@varlet/ui 3.6.4-alpha.1730207839062 → 3.6.5
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/es/index.bundle.mjs +1 -1
- package/es/index.mjs +1 -1
- package/es/snackbar/style/index.mjs +1 -1
- package/es/varlet.esm.js +2527 -2520
- package/highlight/web-types.en-US.json +1 -1
- package/highlight/web-types.zh-CN.json +1 -1
- package/lib/varlet.cjs.js +143 -136
- package/package.json +8 -8
- package/umd/varlet.js +7 -7
package/lib/varlet.cjs.js
CHANGED
|
@@ -27,20 +27,49 @@ var __spreadValues$z = (a, b) => {
|
|
|
27
27
|
return a;
|
|
28
28
|
};
|
|
29
29
|
var __spreadProps$d = (a, b) => __defProps$d(a, __getOwnPropDescs$d(b));
|
|
30
|
-
function
|
|
31
|
-
return
|
|
30
|
+
function clamp$1(num, min2, max2) {
|
|
31
|
+
return Math.min(max2, Math.max(min2, num));
|
|
32
|
+
}
|
|
33
|
+
function clampArrayRange(index, arr) {
|
|
34
|
+
return clamp$1(index, 0, arr.length - 1);
|
|
35
|
+
}
|
|
36
|
+
function inBrowser() {
|
|
37
|
+
return typeof window !== "undefined";
|
|
38
|
+
}
|
|
39
|
+
function getGlobalThis() {
|
|
40
|
+
if (typeof globalThis !== "undefined") {
|
|
41
|
+
return globalThis;
|
|
42
|
+
}
|
|
43
|
+
if (inBrowser()) {
|
|
44
|
+
return window;
|
|
45
|
+
}
|
|
46
|
+
return typeof global !== "undefined" ? global : self;
|
|
47
|
+
}
|
|
48
|
+
var { hasOwnProperty } = Object.prototype;
|
|
49
|
+
function hasOwn(val, key3) {
|
|
50
|
+
return hasOwnProperty.call(val, key3);
|
|
51
|
+
}
|
|
52
|
+
function inMobile() {
|
|
53
|
+
return inBrowser() && /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
|
54
|
+
}
|
|
55
|
+
function isArray(val) {
|
|
56
|
+
return Array.isArray(val);
|
|
57
|
+
}
|
|
58
|
+
var objectToString = Object.prototype.toString;
|
|
59
|
+
function toTypeString(value) {
|
|
60
|
+
return objectToString.call(value);
|
|
61
|
+
}
|
|
62
|
+
function toRawType(value) {
|
|
63
|
+
return toTypeString(value).slice(8, -1);
|
|
32
64
|
}
|
|
33
65
|
function isBoolean(val) {
|
|
34
66
|
return typeof val === "boolean";
|
|
35
67
|
}
|
|
36
|
-
function
|
|
37
|
-
return
|
|
38
|
-
}
|
|
39
|
-
function isNumeric(val) {
|
|
40
|
-
return isNumber(val) || isString(val) && /^[-+]?\d+$/.test(val);
|
|
68
|
+
function isEmpty(val) {
|
|
69
|
+
return val === void 0 || val === null || val === "" || isArray(val) && !val.length;
|
|
41
70
|
}
|
|
42
71
|
function isPlainObject(val) {
|
|
43
|
-
return
|
|
72
|
+
return toRawType(val) === "Object";
|
|
44
73
|
}
|
|
45
74
|
function isObject(val) {
|
|
46
75
|
return typeof val === "object" && val !== null;
|
|
@@ -48,11 +77,14 @@ function isObject(val) {
|
|
|
48
77
|
function isFunction(val) {
|
|
49
78
|
return typeof val === "function";
|
|
50
79
|
}
|
|
51
|
-
function
|
|
52
|
-
return
|
|
80
|
+
function isNumber(val) {
|
|
81
|
+
return typeof val === "number";
|
|
53
82
|
}
|
|
54
|
-
function
|
|
55
|
-
return
|
|
83
|
+
function isString(val) {
|
|
84
|
+
return typeof val === "string";
|
|
85
|
+
}
|
|
86
|
+
function isNumeric(val) {
|
|
87
|
+
return isNumber(val) || isString(val) && /^[-+]?\d+$/.test(val);
|
|
56
88
|
}
|
|
57
89
|
function isWindow(val) {
|
|
58
90
|
return val === window;
|
|
@@ -60,30 +92,19 @@ function isWindow(val) {
|
|
|
60
92
|
function supportTouch() {
|
|
61
93
|
return inBrowser() && "ontouchstart" in window;
|
|
62
94
|
}
|
|
63
|
-
function
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
function inMobile() {
|
|
67
|
-
return inBrowser() && /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
|
68
|
-
}
|
|
69
|
-
var { hasOwnProperty } = Object.prototype;
|
|
70
|
-
function hasOwn(val, key3) {
|
|
71
|
-
return hasOwnProperty.call(val, key3);
|
|
72
|
-
}
|
|
73
|
-
function getGlobalThis() {
|
|
74
|
-
if (typeof globalThis !== "undefined") {
|
|
75
|
-
return globalThis;
|
|
95
|
+
function toNumber(val) {
|
|
96
|
+
if (val == null) {
|
|
97
|
+
return 0;
|
|
76
98
|
}
|
|
77
|
-
if (
|
|
78
|
-
|
|
99
|
+
if (isString(val)) {
|
|
100
|
+
val = parseFloat(val);
|
|
101
|
+
val = Number.isNaN(val) ? 0 : val;
|
|
102
|
+
return val;
|
|
79
103
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
return
|
|
84
|
-
}
|
|
85
|
-
function normalizeToArray(value) {
|
|
86
|
-
return isArray(value) ? value : [value];
|
|
104
|
+
if (isBoolean(val)) {
|
|
105
|
+
return Number(val);
|
|
106
|
+
}
|
|
107
|
+
return val;
|
|
87
108
|
}
|
|
88
109
|
function removeItem(arr, item) {
|
|
89
110
|
if (arr.length) {
|
|
@@ -93,8 +114,8 @@ function removeItem(arr, item) {
|
|
|
93
114
|
}
|
|
94
115
|
}
|
|
95
116
|
}
|
|
96
|
-
function
|
|
97
|
-
return arr
|
|
117
|
+
function uniq(arr) {
|
|
118
|
+
return [...new Set(arr)];
|
|
98
119
|
}
|
|
99
120
|
function find(arr, fn2, from = "start") {
|
|
100
121
|
let i = from === "start" ? 0 : arr.length - 1;
|
|
@@ -107,8 +128,24 @@ function find(arr, fn2, from = "start") {
|
|
|
107
128
|
}
|
|
108
129
|
return [null, -1];
|
|
109
130
|
}
|
|
110
|
-
function
|
|
111
|
-
return
|
|
131
|
+
function removeArrayBlank(arr) {
|
|
132
|
+
return arr.filter((item) => item != null);
|
|
133
|
+
}
|
|
134
|
+
function normalizeToArray(value) {
|
|
135
|
+
return isArray(value) ? value : [value];
|
|
136
|
+
}
|
|
137
|
+
function cancelAnimationFrame(handle) {
|
|
138
|
+
const globalThis2 = getGlobalThis();
|
|
139
|
+
globalThis2.cancelAnimationFrame ? globalThis2.cancelAnimationFrame(handle) : globalThis2.clearTimeout(handle);
|
|
140
|
+
}
|
|
141
|
+
function classes$1d(...classes2) {
|
|
142
|
+
return classes2.map((className) => {
|
|
143
|
+
if (isArray(className)) {
|
|
144
|
+
const [condition, truthy, falsy = null] = className;
|
|
145
|
+
return condition ? truthy : falsy;
|
|
146
|
+
}
|
|
147
|
+
return className;
|
|
148
|
+
});
|
|
112
149
|
}
|
|
113
150
|
function camelize(s) {
|
|
114
151
|
s = s.replace(/-(\w)/g, (_, p) => p.toUpperCase());
|
|
@@ -118,19 +155,32 @@ function kebabCase(s) {
|
|
|
118
155
|
const ret = s.replace(/([A-Z])/g, " $1").trim();
|
|
119
156
|
return ret.split(" ").join("-").toLowerCase();
|
|
120
157
|
}
|
|
158
|
+
function pascalCase(s) {
|
|
159
|
+
return camelize(s).replace(s.charAt(0), s.charAt(0).toUpperCase());
|
|
160
|
+
}
|
|
161
|
+
function createNamespaceFn(namespace) {
|
|
162
|
+
return (name2) => {
|
|
163
|
+
const componentName = `${namespace}-${name2}`;
|
|
164
|
+
const createBEM = (suffix) => {
|
|
165
|
+
if (!suffix) {
|
|
166
|
+
return componentName;
|
|
167
|
+
}
|
|
168
|
+
if (suffix[0] === "$") {
|
|
169
|
+
return suffix.replace("$", namespace);
|
|
170
|
+
}
|
|
171
|
+
return suffix.startsWith("--") ? `${componentName}${suffix}` : `${componentName}__${suffix}`;
|
|
172
|
+
};
|
|
173
|
+
return {
|
|
174
|
+
name: pascalCase(componentName),
|
|
175
|
+
n: createBEM,
|
|
176
|
+
classes: classes$1d
|
|
177
|
+
};
|
|
178
|
+
};
|
|
179
|
+
}
|
|
121
180
|
function requestAnimationFrame$1(fn2) {
|
|
122
181
|
const globalThis2 = getGlobalThis();
|
|
123
182
|
return globalThis2.requestAnimationFrame ? globalThis2.requestAnimationFrame(fn2) : globalThis2.setTimeout(fn2);
|
|
124
183
|
}
|
|
125
|
-
function cancelAnimationFrame(handle) {
|
|
126
|
-
const globalThis2 = getGlobalThis();
|
|
127
|
-
globalThis2.cancelAnimationFrame ? globalThis2.cancelAnimationFrame(handle) : globalThis2.clearTimeout(handle);
|
|
128
|
-
}
|
|
129
|
-
function raf() {
|
|
130
|
-
return new Promise((resolve) => {
|
|
131
|
-
requestAnimationFrame$1(resolve);
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
184
|
function doubleRaf() {
|
|
135
185
|
return new Promise((resolve) => {
|
|
136
186
|
requestAnimationFrame$1(() => {
|
|
@@ -161,6 +211,14 @@ function getRect(element) {
|
|
|
161
211
|
}
|
|
162
212
|
return element.getBoundingClientRect();
|
|
163
213
|
}
|
|
214
|
+
function getScrollLeft(element) {
|
|
215
|
+
const left2 = "scrollLeft" in element ? element.scrollLeft : element.scrollX;
|
|
216
|
+
return Math.max(left2, 0);
|
|
217
|
+
}
|
|
218
|
+
function getScrollTop(element) {
|
|
219
|
+
const top2 = "scrollTop" in element ? element.scrollTop : element.scrollY;
|
|
220
|
+
return Math.max(top2, 0);
|
|
221
|
+
}
|
|
164
222
|
function inViewport(element) {
|
|
165
223
|
const { top: top2, bottom: bottom2, left: left2, right: right2 } = getRect(element);
|
|
166
224
|
const { width, height } = getRect(window);
|
|
@@ -174,43 +232,46 @@ function preventDefault(event) {
|
|
|
174
232
|
}
|
|
175
233
|
event.preventDefault();
|
|
176
234
|
}
|
|
177
|
-
function
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
}
|
|
181
|
-
function getScrollLeft(element) {
|
|
182
|
-
const left2 = "scrollLeft" in element ? element.scrollLeft : element.scrollX;
|
|
183
|
-
return Math.max(left2, 0);
|
|
184
|
-
}
|
|
185
|
-
function classes$1d(...classes2) {
|
|
186
|
-
return classes2.map((className) => {
|
|
187
|
-
if (isArray(className)) {
|
|
188
|
-
const [condition, truthy, falsy = null] = className;
|
|
189
|
-
return condition ? truthy : falsy;
|
|
190
|
-
}
|
|
191
|
-
return className;
|
|
235
|
+
function raf() {
|
|
236
|
+
return new Promise((resolve) => {
|
|
237
|
+
requestAnimationFrame$1(resolve);
|
|
192
238
|
});
|
|
193
239
|
}
|
|
194
|
-
function
|
|
195
|
-
return (
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
return componentName;
|
|
240
|
+
function createStorage(storage) {
|
|
241
|
+
return __spreadProps$d(__spreadValues$z({}, storage), {
|
|
242
|
+
set(key3, value) {
|
|
243
|
+
if (value == null) {
|
|
244
|
+
return;
|
|
200
245
|
}
|
|
201
|
-
if (
|
|
202
|
-
|
|
246
|
+
if (!isString(value)) {
|
|
247
|
+
value = JSON.stringify(value);
|
|
203
248
|
}
|
|
204
|
-
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
249
|
+
storage.setItem(key3, value);
|
|
250
|
+
},
|
|
251
|
+
get(key3) {
|
|
252
|
+
const data = storage.getItem(key3);
|
|
253
|
+
try {
|
|
254
|
+
return JSON.parse(data);
|
|
255
|
+
} catch (err) {
|
|
256
|
+
return data;
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
remove(key3) {
|
|
260
|
+
storage.removeItem(key3);
|
|
261
|
+
}
|
|
262
|
+
});
|
|
212
263
|
}
|
|
213
|
-
|
|
264
|
+
createStorage(getGlobalThis().sessionStorage);
|
|
265
|
+
createStorage(getGlobalThis().localStorage);
|
|
266
|
+
function call(fn2, ...args) {
|
|
267
|
+
if (isArray(fn2)) {
|
|
268
|
+
return fn2.map((f) => f(...args));
|
|
269
|
+
}
|
|
270
|
+
if (fn2) {
|
|
271
|
+
return fn2(...args);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
function throttle(fn2, delay2 = 200) {
|
|
214
275
|
let timer;
|
|
215
276
|
let start2 = 0;
|
|
216
277
|
return function loop(...args) {
|
|
@@ -222,44 +283,16 @@ function throttle(fn2, delay = 200) {
|
|
|
222
283
|
if (timer) {
|
|
223
284
|
clearTimeout(timer);
|
|
224
285
|
}
|
|
225
|
-
if (elapsed >=
|
|
286
|
+
if (elapsed >= delay2) {
|
|
226
287
|
fn2.apply(this, args);
|
|
227
288
|
start2 = now;
|
|
228
289
|
} else {
|
|
229
290
|
timer = setTimeout(() => {
|
|
230
291
|
loop.apply(this, args);
|
|
231
|
-
},
|
|
292
|
+
}, delay2 - elapsed);
|
|
232
293
|
}
|
|
233
294
|
};
|
|
234
295
|
}
|
|
235
|
-
function call(fn2, ...args) {
|
|
236
|
-
if (isArray(fn2)) {
|
|
237
|
-
return fn2.map((f) => f(...args));
|
|
238
|
-
}
|
|
239
|
-
if (fn2) {
|
|
240
|
-
return fn2(...args);
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
function toNumber(val) {
|
|
244
|
-
if (val == null) {
|
|
245
|
-
return 0;
|
|
246
|
-
}
|
|
247
|
-
if (isString(val)) {
|
|
248
|
-
val = parseFloat(val);
|
|
249
|
-
val = Number.isNaN(val) ? 0 : val;
|
|
250
|
-
return val;
|
|
251
|
-
}
|
|
252
|
-
if (isBoolean(val)) {
|
|
253
|
-
return Number(val);
|
|
254
|
-
}
|
|
255
|
-
return val;
|
|
256
|
-
}
|
|
257
|
-
function clamp$1(num, min2, max2) {
|
|
258
|
-
return Math.min(max2, Math.max(min2, num));
|
|
259
|
-
}
|
|
260
|
-
function clampArrayRange(index, arr) {
|
|
261
|
-
return clamp$1(index, 0, arr.length - 1);
|
|
262
|
-
}
|
|
263
296
|
function toDataURL(file) {
|
|
264
297
|
return new Promise((resolve) => {
|
|
265
298
|
const fileReader = new FileReader();
|
|
@@ -269,32 +302,6 @@ function toDataURL(file) {
|
|
|
269
302
|
fileReader.readAsDataURL(file);
|
|
270
303
|
});
|
|
271
304
|
}
|
|
272
|
-
function createStorage(storage) {
|
|
273
|
-
return __spreadProps$d(__spreadValues$z({}, storage), {
|
|
274
|
-
set(key3, value) {
|
|
275
|
-
if (value == null) {
|
|
276
|
-
return;
|
|
277
|
-
}
|
|
278
|
-
if (!isString(value)) {
|
|
279
|
-
value = JSON.stringify(value);
|
|
280
|
-
}
|
|
281
|
-
storage.setItem(key3, value);
|
|
282
|
-
},
|
|
283
|
-
get(key3) {
|
|
284
|
-
const data = storage.getItem(key3);
|
|
285
|
-
try {
|
|
286
|
-
return JSON.parse(data);
|
|
287
|
-
} catch (err) {
|
|
288
|
-
return data;
|
|
289
|
-
}
|
|
290
|
-
},
|
|
291
|
-
remove(key3) {
|
|
292
|
-
storage.removeItem(key3);
|
|
293
|
-
}
|
|
294
|
-
});
|
|
295
|
-
}
|
|
296
|
-
createStorage(globalThis.sessionStorage);
|
|
297
|
-
createStorage(globalThis.localStorage);
|
|
298
305
|
var isURL = (val) => {
|
|
299
306
|
if (!val) {
|
|
300
307
|
return false;
|
|
@@ -29783,7 +29790,7 @@ withInstall(stdin_default$1);
|
|
|
29783
29790
|
withPropsDefaultsSetter(stdin_default$1, props);
|
|
29784
29791
|
const _WatermarkComponent = stdin_default$1;
|
|
29785
29792
|
var stdin_default = stdin_default$1;
|
|
29786
|
-
const version = "3.6.
|
|
29793
|
+
const version = "3.6.5";
|
|
29787
29794
|
function install(app) {
|
|
29788
29795
|
stdin_default$5U.install && app.use(stdin_default$5U);
|
|
29789
29796
|
stdin_default$5S.install && app.use(stdin_default$5S);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@varlet/ui",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.5",
|
|
4
4
|
"description": "A material like components library",
|
|
5
5
|
"main": "lib/varlet.cjs.js",
|
|
6
6
|
"module": "es/index.mjs",
|
|
@@ -48,9 +48,9 @@
|
|
|
48
48
|
"@popperjs/core": "^2.11.6",
|
|
49
49
|
"dayjs": "^1.10.4",
|
|
50
50
|
"decimal.js": "^10.2.1",
|
|
51
|
-
"@varlet/icons": "3.6.
|
|
52
|
-
"@varlet/shared": "3.6.
|
|
53
|
-
"@varlet/use": "3.6.
|
|
51
|
+
"@varlet/icons": "3.6.5",
|
|
52
|
+
"@varlet/shared": "3.6.5",
|
|
53
|
+
"@varlet/use": "3.6.5"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@types/node": "^18.7.18",
|
|
@@ -61,14 +61,14 @@
|
|
|
61
61
|
"jsdom": "24.1.1",
|
|
62
62
|
"live-server": "^1.2.1",
|
|
63
63
|
"shiki": "^1.21.0",
|
|
64
|
-
"typescript": "
|
|
64
|
+
"typescript": "5.4.0",
|
|
65
65
|
"vitest": "2.0.5",
|
|
66
66
|
"vue": "3.4.21",
|
|
67
67
|
"vue-router": "4.2.0",
|
|
68
68
|
"zod": "^3.23.8",
|
|
69
|
-
"@varlet/cli": "3.6.
|
|
70
|
-
"@varlet/
|
|
71
|
-
"@varlet/
|
|
69
|
+
"@varlet/cli": "3.6.5",
|
|
70
|
+
"@varlet/touch-emulator": "3.6.5",
|
|
71
|
+
"@varlet/ui": "3.6.5"
|
|
72
72
|
},
|
|
73
73
|
"scripts": {
|
|
74
74
|
"dev": "varlet-cli dev",
|