@varlet/ui 3.6.3 → 3.6.4
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/action-sheet/style/index.mjs +1 -1
- 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 +3877 -3753
- package/highlight/web-types.en-US.json +1 -1
- package/highlight/web-types.zh-CN.json +1 -1
- package/lib/varlet.cjs.js +217 -129
- package/package.json +7 -7
- package/umd/varlet.js +7 -7
package/lib/varlet.cjs.js
CHANGED
|
@@ -14,7 +14,7 @@ var __getOwnPropDescs$d = Object.getOwnPropertyDescriptors;
|
|
|
14
14
|
var __getOwnPropSymbols$z = Object.getOwnPropertySymbols;
|
|
15
15
|
var __hasOwnProp$z = Object.prototype.hasOwnProperty;
|
|
16
16
|
var __propIsEnum$z = Object.prototype.propertyIsEnumerable;
|
|
17
|
-
var __defNormalProp$z = (obj,
|
|
17
|
+
var __defNormalProp$z = (obj, key3, value) => key3 in obj ? __defProp$z(obj, key3, { enumerable: true, configurable: true, writable: true, value }) : obj[key3] = value;
|
|
18
18
|
var __spreadValues$z = (a, b) => {
|
|
19
19
|
for (var prop in b || (b = {}))
|
|
20
20
|
if (__hasOwnProp$z.call(b, prop))
|
|
@@ -27,83 +27,171 @@ 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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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;
|
|
41
42
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
var inBrowser = () => typeof window !== "undefined";
|
|
48
|
-
var inMobile = () => inBrowser() && /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
|
43
|
+
if (inBrowser()) {
|
|
44
|
+
return window;
|
|
45
|
+
}
|
|
46
|
+
return typeof global !== "undefined" ? global : self;
|
|
47
|
+
}
|
|
49
48
|
var { hasOwnProperty } = Object.prototype;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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);
|
|
64
|
+
}
|
|
65
|
+
function isBoolean(val) {
|
|
66
|
+
return typeof val === "boolean";
|
|
67
|
+
}
|
|
68
|
+
function isEmpty(val) {
|
|
69
|
+
return val === void 0 || val === null || val === "" || isArray(val) && !val.length;
|
|
70
|
+
}
|
|
71
|
+
function isPlainObject(val) {
|
|
72
|
+
return toRawType(val) === "Object";
|
|
73
|
+
}
|
|
74
|
+
function isObject(val) {
|
|
75
|
+
return typeof val === "object" && val !== null;
|
|
76
|
+
}
|
|
77
|
+
function isFunction(val) {
|
|
78
|
+
return typeof val === "function";
|
|
79
|
+
}
|
|
80
|
+
function isNumber(val) {
|
|
81
|
+
return typeof val === "number";
|
|
82
|
+
}
|
|
83
|
+
function isString(val) {
|
|
84
|
+
return typeof val === "string";
|
|
85
|
+
}
|
|
86
|
+
function isNumeric(val) {
|
|
87
|
+
return isNumber(val) || isString(val) && /^[-+]?\d+$/.test(val);
|
|
88
|
+
}
|
|
89
|
+
function isWindow(val) {
|
|
90
|
+
return val === window;
|
|
91
|
+
}
|
|
92
|
+
function supportTouch() {
|
|
93
|
+
return inBrowser() && "ontouchstart" in window;
|
|
94
|
+
}
|
|
95
|
+
function toNumber(val) {
|
|
96
|
+
if (val == null) {
|
|
97
|
+
return 0;
|
|
98
|
+
}
|
|
99
|
+
if (isString(val)) {
|
|
100
|
+
val = parseFloat(val);
|
|
101
|
+
val = Number.isNaN(val) ? 0 : val;
|
|
102
|
+
return val;
|
|
103
|
+
}
|
|
104
|
+
if (isBoolean(val)) {
|
|
105
|
+
return Number(val);
|
|
106
|
+
}
|
|
107
|
+
return val;
|
|
108
|
+
}
|
|
109
|
+
function removeItem(arr, item) {
|
|
54
110
|
if (arr.length) {
|
|
55
111
|
const index = arr.indexOf(item);
|
|
56
112
|
if (index > -1) {
|
|
57
113
|
return arr.splice(index, 1);
|
|
58
114
|
}
|
|
59
115
|
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
116
|
+
}
|
|
117
|
+
function uniq(arr) {
|
|
118
|
+
return [...new Set(arr)];
|
|
119
|
+
}
|
|
120
|
+
function find(arr, fn2, from = "start") {
|
|
63
121
|
let i = from === "start" ? 0 : arr.length - 1;
|
|
64
122
|
while (arr.length > 0 && i >= 0 && i <= arr.length - 1) {
|
|
65
|
-
const flag =
|
|
123
|
+
const flag = fn2(arr[i], i, arr);
|
|
66
124
|
if (flag) {
|
|
67
125
|
return [arr[i], i];
|
|
68
126
|
}
|
|
69
127
|
from === "start" ? i++ : i--;
|
|
70
128
|
}
|
|
71
129
|
return [null, -1];
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
var getGlobalThis = () => {
|
|
81
|
-
if (typeof globalThis !== "undefined") {
|
|
82
|
-
return globalThis;
|
|
83
|
-
}
|
|
84
|
-
if (inBrowser()) {
|
|
85
|
-
return window;
|
|
86
|
-
}
|
|
87
|
-
return typeof global !== "undefined" ? global : self;
|
|
88
|
-
};
|
|
89
|
-
var requestAnimationFrame$1 = (fn2) => {
|
|
90
|
-
const globalThis2 = getGlobalThis();
|
|
91
|
-
return globalThis2.requestAnimationFrame ? globalThis2.requestAnimationFrame(fn2) : globalThis2.setTimeout(fn2);
|
|
92
|
-
};
|
|
93
|
-
var cancelAnimationFrame = (handle) => {
|
|
130
|
+
}
|
|
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) {
|
|
94
138
|
const globalThis2 = getGlobalThis();
|
|
95
139
|
globalThis2.cancelAnimationFrame ? globalThis2.cancelAnimationFrame(handle) : globalThis2.clearTimeout(handle);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
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;
|
|
103
148
|
});
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
|
|
149
|
+
}
|
|
150
|
+
function camelize(s) {
|
|
151
|
+
s = s.replace(/-(\w)/g, (_, p) => p.toUpperCase());
|
|
152
|
+
return s.replace(s.charAt(0), s.charAt(0).toLowerCase());
|
|
153
|
+
}
|
|
154
|
+
function kebabCase(s) {
|
|
155
|
+
const ret = s.replace(/([A-Z])/g, " $1").trim();
|
|
156
|
+
return ret.split(" ").join("-").toLowerCase();
|
|
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
|
+
}
|
|
180
|
+
function requestAnimationFrame$1(fn2) {
|
|
181
|
+
const globalThis2 = getGlobalThis();
|
|
182
|
+
return globalThis2.requestAnimationFrame ? globalThis2.requestAnimationFrame(fn2) : globalThis2.setTimeout(fn2);
|
|
183
|
+
}
|
|
184
|
+
function doubleRaf() {
|
|
185
|
+
return new Promise((resolve) => {
|
|
186
|
+
requestAnimationFrame$1(() => {
|
|
187
|
+
requestAnimationFrame$1(resolve);
|
|
188
|
+
});
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
function getStyle$1(element) {
|
|
192
|
+
return window.getComputedStyle(element);
|
|
193
|
+
}
|
|
194
|
+
function getRect(element) {
|
|
107
195
|
if (isWindow(element)) {
|
|
108
196
|
const width = element.innerWidth;
|
|
109
197
|
const height = element.innerHeight;
|
|
@@ -122,40 +210,72 @@ var getRect = (element) => {
|
|
|
122
210
|
});
|
|
123
211
|
}
|
|
124
212
|
return element.getBoundingClientRect();
|
|
125
|
-
}
|
|
126
|
-
|
|
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
|
+
}
|
|
222
|
+
function inViewport(element) {
|
|
127
223
|
const { top: top2, bottom: bottom2, left: left2, right: right2 } = getRect(element);
|
|
128
224
|
const { width, height } = getRect(window);
|
|
129
225
|
const xInViewport = left2 <= width && right2 >= 0;
|
|
130
226
|
const yInViewport = top2 <= height && bottom2 >= 0;
|
|
131
227
|
return xInViewport && yInViewport;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
const fileReader = new FileReader();
|
|
135
|
-
fileReader.onload = () => {
|
|
136
|
-
resolve(fileReader.result);
|
|
137
|
-
};
|
|
138
|
-
fileReader.readAsDataURL(file);
|
|
139
|
-
});
|
|
140
|
-
var preventDefault = (event) => {
|
|
228
|
+
}
|
|
229
|
+
function preventDefault(event) {
|
|
141
230
|
if (event.cancelable === false) {
|
|
142
231
|
return;
|
|
143
232
|
}
|
|
144
233
|
event.preventDefault();
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
return
|
|
153
|
-
|
|
154
|
-
|
|
234
|
+
}
|
|
235
|
+
function raf() {
|
|
236
|
+
return new Promise((resolve) => {
|
|
237
|
+
requestAnimationFrame$1(resolve);
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
function createStorage(storage) {
|
|
241
|
+
return __spreadProps$d(__spreadValues$z({}, storage), {
|
|
242
|
+
set(key3, value) {
|
|
243
|
+
if (value == null) {
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
if (!isString(value)) {
|
|
247
|
+
value = JSON.stringify(value);
|
|
248
|
+
}
|
|
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
|
+
});
|
|
263
|
+
}
|
|
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) {
|
|
155
275
|
let timer;
|
|
156
276
|
let start2 = 0;
|
|
157
277
|
return function loop(...args) {
|
|
158
|
-
const now =
|
|
278
|
+
const now = performance.now();
|
|
159
279
|
const elapsed = now - start2;
|
|
160
280
|
if (!start2) {
|
|
161
281
|
start2 = now;
|
|
@@ -163,63 +283,31 @@ var throttle = (fn2, delay = 200) => {
|
|
|
163
283
|
if (timer) {
|
|
164
284
|
clearTimeout(timer);
|
|
165
285
|
}
|
|
166
|
-
if (elapsed >=
|
|
286
|
+
if (elapsed >= delay2) {
|
|
167
287
|
fn2.apply(this, args);
|
|
168
288
|
start2 = now;
|
|
169
289
|
} else {
|
|
170
290
|
timer = setTimeout(() => {
|
|
171
291
|
loop.apply(this, args);
|
|
172
|
-
},
|
|
292
|
+
}, delay2 - elapsed);
|
|
173
293
|
}
|
|
174
294
|
};
|
|
175
|
-
};
|
|
176
|
-
function call(fn2, ...args) {
|
|
177
|
-
if (isArray(fn2)) {
|
|
178
|
-
return fn2.map((f) => f(...args));
|
|
179
|
-
}
|
|
180
|
-
if (fn2) {
|
|
181
|
-
return fn2(...args);
|
|
182
|
-
}
|
|
183
295
|
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
val = Number.isNaN(val) ? 0 : val;
|
|
190
|
-
return val;
|
|
191
|
-
}
|
|
192
|
-
if (isBoolean(val))
|
|
193
|
-
return Number(val);
|
|
194
|
-
return val;
|
|
195
|
-
};
|
|
196
|
-
var clamp$1 = (num, min2, max2) => Math.min(max2, Math.max(min2, num));
|
|
197
|
-
var clampArrayRange = (index, arr) => clamp$1(index, 0, arr.length - 1);
|
|
198
|
-
var bigCamelize = (s) => camelize(s).replace(s.charAt(0), s.charAt(0).toUpperCase());
|
|
199
|
-
var camelize = (s) => s.replace(/-(\w)/g, (_, p) => p.toUpperCase());
|
|
200
|
-
var kebabCase = (s) => {
|
|
201
|
-
const ret = s.replace(/([A-Z])/g, " $1").trim();
|
|
202
|
-
return ret.split(" ").join("-").toLowerCase();
|
|
203
|
-
};
|
|
204
|
-
function createNamespaceFn(namespace) {
|
|
205
|
-
return (name2) => {
|
|
206
|
-
const componentName = `${namespace}-${name2}`;
|
|
207
|
-
const createBEM = (suffix) => {
|
|
208
|
-
if (!suffix) {
|
|
209
|
-
return componentName;
|
|
210
|
-
}
|
|
211
|
-
if (suffix[0] === "$") {
|
|
212
|
-
return suffix.replace("$", namespace);
|
|
213
|
-
}
|
|
214
|
-
return suffix.startsWith("--") ? `${componentName}${suffix}` : `${componentName}__${suffix}`;
|
|
215
|
-
};
|
|
216
|
-
return {
|
|
217
|
-
name: bigCamelize(componentName),
|
|
218
|
-
n: createBEM,
|
|
219
|
-
classes: classes$1d
|
|
296
|
+
function toDataURL(file) {
|
|
297
|
+
return new Promise((resolve) => {
|
|
298
|
+
const fileReader = new FileReader();
|
|
299
|
+
fileReader.onload = () => {
|
|
300
|
+
resolve(fileReader.result);
|
|
220
301
|
};
|
|
221
|
-
|
|
302
|
+
fileReader.readAsDataURL(file);
|
|
303
|
+
});
|
|
222
304
|
}
|
|
305
|
+
var isURL = (val) => {
|
|
306
|
+
if (!val) {
|
|
307
|
+
return false;
|
|
308
|
+
}
|
|
309
|
+
return /^(http)|(\.*\/)/.test(val);
|
|
310
|
+
};
|
|
223
311
|
var __defProp$y = Object.defineProperty;
|
|
224
312
|
var __getOwnPropSymbols$y = Object.getOwnPropertySymbols;
|
|
225
313
|
var __hasOwnProp$y = Object.prototype.hasOwnProperty;
|
|
@@ -29702,7 +29790,7 @@ withInstall(stdin_default$1);
|
|
|
29702
29790
|
withPropsDefaultsSetter(stdin_default$1, props);
|
|
29703
29791
|
const _WatermarkComponent = stdin_default$1;
|
|
29704
29792
|
var stdin_default = stdin_default$1;
|
|
29705
|
-
const version = "3.6.
|
|
29793
|
+
const version = "3.6.4";
|
|
29706
29794
|
function install(app) {
|
|
29707
29795
|
stdin_default$5U.install && app.use(stdin_default$5U);
|
|
29708
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.4",
|
|
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/shared": "3.6.
|
|
52
|
-
"@varlet/
|
|
53
|
-
"@varlet/
|
|
51
|
+
"@varlet/shared": "3.6.4",
|
|
52
|
+
"@varlet/use": "3.6.4",
|
|
53
|
+
"@varlet/icons": "3.6.4"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@types/node": "^18.7.18",
|
|
@@ -66,9 +66,9 @@
|
|
|
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.4",
|
|
70
|
+
"@varlet/ui": "3.6.4",
|
|
71
|
+
"@varlet/touch-emulator": "3.6.4"
|
|
72
72
|
},
|
|
73
73
|
"scripts": {
|
|
74
74
|
"dev": "varlet-cli dev",
|