@deot/vc 1.0.43 → 1.0.44
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/dist/index.cjs +2 -0
- package/dist/index.d.ts +283 -167
- package/dist/index.iife.js +431 -257
- package/dist/index.js +3 -1
- package/dist/index.umd.cjs +431 -257
- package/package.json +4 -4
package/dist/index.iife.js
CHANGED
|
@@ -124,6 +124,222 @@ var Vc = (function (exports, vue) {
|
|
|
124
124
|
return parent;
|
|
125
125
|
};
|
|
126
126
|
|
|
127
|
+
const IS_SERVER$2 = typeof window === "undefined";
|
|
128
|
+
|
|
129
|
+
const hasClass = (el, cls) => {
|
|
130
|
+
if (IS_SERVER$2 || !cls) return false;
|
|
131
|
+
if (cls.includes(" ")) {
|
|
132
|
+
throw new Error("[@deot/helper-dom]: 类名不应该包含空格");
|
|
133
|
+
}
|
|
134
|
+
if (el.classList) {
|
|
135
|
+
return el.classList.contains(cls);
|
|
136
|
+
} else {
|
|
137
|
+
return (" " + el.className + " ").indexOf(" " + cls + " ") > -1;
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
const addClass = (el, cls) => {
|
|
142
|
+
if (IS_SERVER$2 || !cls) return;
|
|
143
|
+
let curClass = el.className;
|
|
144
|
+
const classes = cls.split(" ");
|
|
145
|
+
for (let i = 0, j = classes.length; i < j; i++) {
|
|
146
|
+
const clsName = classes[i];
|
|
147
|
+
if (clsName) {
|
|
148
|
+
if (el.classList) {
|
|
149
|
+
el.classList.add(clsName);
|
|
150
|
+
} else if (!hasClass(el, clsName)) {
|
|
151
|
+
curClass += " " + clsName;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
if (!el.classList) {
|
|
156
|
+
el.className = curClass;
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
const composedPath = (e) => {
|
|
161
|
+
const path = e.composedPath && e.composedPath() || [];
|
|
162
|
+
if (path.length) return path;
|
|
163
|
+
let parent = e.target?.parentNode;
|
|
164
|
+
/* istanbul ignore next -- @preserve */
|
|
165
|
+
while (parent) {
|
|
166
|
+
path.push(parent);
|
|
167
|
+
parent = parent.parentNode;
|
|
168
|
+
}
|
|
169
|
+
return path;
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
const contains$1 = (el, child) => {
|
|
173
|
+
if (IS_SERVER$2 || !child) return false;
|
|
174
|
+
const childRect = child.getBoundingClientRect();
|
|
175
|
+
let elRect;
|
|
176
|
+
if (!el || [window, document, document.documentElement].includes(el)) {
|
|
177
|
+
elRect = {
|
|
178
|
+
top: 0,
|
|
179
|
+
right: window.innerWidth,
|
|
180
|
+
bottom: window.innerHeight,
|
|
181
|
+
left: 0
|
|
182
|
+
};
|
|
183
|
+
} else {
|
|
184
|
+
elRect = el.getBoundingClientRect();
|
|
185
|
+
}
|
|
186
|
+
return childRect.top < elRect.bottom && childRect.bottom > elRect.top && childRect.right > elRect.left && childRect.left < elRect.right;
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
const el$1 = (v) => {
|
|
190
|
+
if (IS_SERVER$2) return null;
|
|
191
|
+
let target;
|
|
192
|
+
if (typeof v === "object") {
|
|
193
|
+
target = v;
|
|
194
|
+
} else {
|
|
195
|
+
target = document.querySelector(v);
|
|
196
|
+
}
|
|
197
|
+
if (!target) {
|
|
198
|
+
throw new Error("[@deot/helper-dom]: el缺失");
|
|
199
|
+
}
|
|
200
|
+
return target;
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
const getStyle$1 = (el, name) => {
|
|
204
|
+
if (IS_SERVER$2 || !name) return "";
|
|
205
|
+
if (name === "float") {
|
|
206
|
+
name = "cssFloat";
|
|
207
|
+
}
|
|
208
|
+
try {
|
|
209
|
+
const computed = document.defaultView.getComputedStyle(el, "");
|
|
210
|
+
return el.style[name] || (computed?.[name] || "");
|
|
211
|
+
} catch (e) {
|
|
212
|
+
return el.style[name] || "";
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
const isScroller = (el, options) => {
|
|
217
|
+
if (IS_SERVER$2 || !el) return false;
|
|
218
|
+
const { className, direction } = options || {};
|
|
219
|
+
let overflow = getStyle$1(el, `overflow-${direction ? "y" : "x"}`);
|
|
220
|
+
overflow = overflow || getStyle$1(el, "overflow");
|
|
221
|
+
return !!(overflow.match(/(scroll|auto)/) || className?.test(el.className));
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
const getScroller = (el, options) => {
|
|
225
|
+
if (IS_SERVER$2 || !el) return null;
|
|
226
|
+
let parent = el;
|
|
227
|
+
while (parent) {
|
|
228
|
+
if ([window, document, document.documentElement].includes(parent)) {
|
|
229
|
+
return window;
|
|
230
|
+
}
|
|
231
|
+
if (isScroller(parent, options)) {
|
|
232
|
+
return parent;
|
|
233
|
+
}
|
|
234
|
+
parent = parent?.parentNode;
|
|
235
|
+
}
|
|
236
|
+
return parent;
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
const off = (el, event, handler, options) => {
|
|
240
|
+
if (IS_SERVER$2) return;
|
|
241
|
+
el.removeEventListener(event, handler, false);
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
const on = (el, event, handler, options) => {
|
|
245
|
+
if (IS_SERVER$2) return () => {
|
|
246
|
+
};
|
|
247
|
+
el.addEventListener(event, handler, false);
|
|
248
|
+
return () => {
|
|
249
|
+
el.removeEventListener(event, handler, false);
|
|
250
|
+
};
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
const $target = IS_SERVER$2 ? {} : document.createElement("div").style;
|
|
254
|
+
const prefix$1 = (() => {
|
|
255
|
+
const keys = {
|
|
256
|
+
webkit: "webkitTransform",
|
|
257
|
+
Moz: "MozTransform",
|
|
258
|
+
O: "OTransform",
|
|
259
|
+
ms: "msTransform",
|
|
260
|
+
standard: "transform"
|
|
261
|
+
};
|
|
262
|
+
const values = {
|
|
263
|
+
webkit: "-webkit-",
|
|
264
|
+
Moz: "-moz-",
|
|
265
|
+
O: "-o-",
|
|
266
|
+
ms: "-ms-",
|
|
267
|
+
standard: ""
|
|
268
|
+
};
|
|
269
|
+
for (const key in keys) {
|
|
270
|
+
if ($target[keys[key]] !== void 0) {
|
|
271
|
+
return {
|
|
272
|
+
camel: key,
|
|
273
|
+
kebab: values[key]
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
return false;
|
|
278
|
+
})();
|
|
279
|
+
const prefixStyle = (v) => {
|
|
280
|
+
if (IS_SERVER$2 || prefix$1 === false) {
|
|
281
|
+
return {
|
|
282
|
+
camel: v,
|
|
283
|
+
kebab: v
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
return {
|
|
287
|
+
camel: prefix$1.camel + v.charAt(0).toUpperCase() + v.substr(1),
|
|
288
|
+
kebab: prefix$1.kebab + v
|
|
289
|
+
};
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
const removeClass = (el, cls) => {
|
|
293
|
+
if (IS_SERVER$2 || !cls) return;
|
|
294
|
+
const classes = cls.split(" ");
|
|
295
|
+
let curClass = " " + el.className + " ";
|
|
296
|
+
for (let i = 0, j = classes.length; i < j; i++) {
|
|
297
|
+
const clsName = classes[i];
|
|
298
|
+
if (clsName) {
|
|
299
|
+
if (el.classList) {
|
|
300
|
+
el.classList.remove(clsName);
|
|
301
|
+
continue;
|
|
302
|
+
}
|
|
303
|
+
/* istanbul ignore next -- @preserve */
|
|
304
|
+
if (hasClass(el, clsName)) {
|
|
305
|
+
curClass = curClass.replace(" " + clsName + " ", " ");
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
if (!el.classList) {
|
|
310
|
+
el.className = curClass.trim();
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
const scrollIntoView = async (el, options) => {
|
|
315
|
+
if (IS_SERVER$2) return;
|
|
316
|
+
const { from = 0, to = 0, duration = 300 } = options || {};
|
|
317
|
+
const difference = Math.abs(from - to);
|
|
318
|
+
const step = Math.ceil(difference / duration * 50);
|
|
319
|
+
let onResolve;
|
|
320
|
+
const target = new Promise((resolve) => {
|
|
321
|
+
onResolve = resolve;
|
|
322
|
+
});
|
|
323
|
+
const scroll = (start, end) => {
|
|
324
|
+
if (start === end) {
|
|
325
|
+
onResolve();
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
let d = start + step > end ? end : start + step;
|
|
329
|
+
if (start > end) {
|
|
330
|
+
d = start - step < end ? end : start - step;
|
|
331
|
+
}
|
|
332
|
+
if (el === window) {
|
|
333
|
+
window.scrollTo(d, d);
|
|
334
|
+
} else {
|
|
335
|
+
el.scrollTop = d;
|
|
336
|
+
}
|
|
337
|
+
window.requestAnimationFrame(() => scroll(d, end));
|
|
338
|
+
};
|
|
339
|
+
scroll(from, to);
|
|
340
|
+
return target;
|
|
341
|
+
};
|
|
342
|
+
|
|
127
343
|
const debounce$1 = (original, wait, options) => {
|
|
128
344
|
const { leading, trailing = true, throttle } = options || {};
|
|
129
345
|
let timer;
|
|
@@ -219,7 +435,7 @@ var Vc = (function (exports, vue) {
|
|
|
219
435
|
);
|
|
220
436
|
};
|
|
221
437
|
|
|
222
|
-
const flatten$1 = (value, parser) => {
|
|
438
|
+
const flatten$1 = (value, parser, exit) => {
|
|
223
439
|
let need = true;
|
|
224
440
|
let safeCount = 1;
|
|
225
441
|
let parseValue = value;
|
|
@@ -229,7 +445,7 @@ var Vc = (function (exports, vue) {
|
|
|
229
445
|
}
|
|
230
446
|
try {
|
|
231
447
|
const next = (parser || decodeURIComponent)(parseValue);
|
|
232
|
-
if (parseValue === next) {
|
|
448
|
+
if (parseValue === next || typeof exit === "function" && exit(next)) {
|
|
233
449
|
need = false;
|
|
234
450
|
}
|
|
235
451
|
parseValue = next;
|
|
@@ -242,8 +458,7 @@ var Vc = (function (exports, vue) {
|
|
|
242
458
|
};
|
|
243
459
|
|
|
244
460
|
const flattenJSONParse = (value) => {
|
|
245
|
-
if (value === null)
|
|
246
|
-
return null;
|
|
461
|
+
if (value === null) return null;
|
|
247
462
|
const regex = /^\d+$/;
|
|
248
463
|
if (regex.test(value) && value.length >= 16 && +value > Number.MAX_SAFE_INTEGER) {
|
|
249
464
|
return value;
|
|
@@ -2588,7 +2803,7 @@ var Vc = (function (exports, vue) {
|
|
|
2588
2803
|
function castSlice(array, start, end) {
|
|
2589
2804
|
var length = array.length;
|
|
2590
2805
|
end = end === undefined ? length : end;
|
|
2591
|
-
return (
|
|
2806
|
+
return (!start && end >= length) ? array : baseSlice(array, start, end);
|
|
2592
2807
|
}
|
|
2593
2808
|
|
|
2594
2809
|
/** Used to compose unicode character classes. */
|
|
@@ -5289,233 +5504,6 @@ var Vc = (function (exports, vue) {
|
|
|
5289
5504
|
});
|
|
5290
5505
|
}
|
|
5291
5506
|
|
|
5292
|
-
const IS_SERVER$2 = typeof window === "undefined";
|
|
5293
|
-
|
|
5294
|
-
const hasClass = (el, cls) => {
|
|
5295
|
-
if (IS_SERVER$2 || !cls)
|
|
5296
|
-
return false;
|
|
5297
|
-
if (cls.includes(" ")) {
|
|
5298
|
-
throw new Error("[@deot/helper-dom]: 类名不应该包含空格");
|
|
5299
|
-
}
|
|
5300
|
-
if (el.classList) {
|
|
5301
|
-
return el.classList.contains(cls);
|
|
5302
|
-
} else {
|
|
5303
|
-
return (" " + el.className + " ").indexOf(" " + cls + " ") > -1;
|
|
5304
|
-
}
|
|
5305
|
-
};
|
|
5306
|
-
|
|
5307
|
-
const addClass = (el, cls) => {
|
|
5308
|
-
if (IS_SERVER$2 || !cls)
|
|
5309
|
-
return;
|
|
5310
|
-
let curClass = el.className;
|
|
5311
|
-
let classes = cls.split(" ");
|
|
5312
|
-
for (let i = 0, j = classes.length; i < j; i++) {
|
|
5313
|
-
let clsName = classes[i];
|
|
5314
|
-
if (clsName) {
|
|
5315
|
-
if (el.classList) {
|
|
5316
|
-
el.classList.add(clsName);
|
|
5317
|
-
} else if (!hasClass(el, clsName)) {
|
|
5318
|
-
curClass += " " + clsName;
|
|
5319
|
-
}
|
|
5320
|
-
}
|
|
5321
|
-
}
|
|
5322
|
-
if (!el.classList) {
|
|
5323
|
-
el.className = curClass;
|
|
5324
|
-
}
|
|
5325
|
-
};
|
|
5326
|
-
|
|
5327
|
-
const composedPath = (e) => {
|
|
5328
|
-
let path = e.composedPath && e.composedPath() || [];
|
|
5329
|
-
if (path.length)
|
|
5330
|
-
return path;
|
|
5331
|
-
let parent = e.target?.parentNode;
|
|
5332
|
-
/* istanbul ignore next -- @preserve */
|
|
5333
|
-
while (parent) {
|
|
5334
|
-
path.push(parent);
|
|
5335
|
-
parent = parent.parentNode;
|
|
5336
|
-
}
|
|
5337
|
-
return path;
|
|
5338
|
-
};
|
|
5339
|
-
|
|
5340
|
-
const contains$1 = (el, child) => {
|
|
5341
|
-
if (IS_SERVER$2 || !child)
|
|
5342
|
-
return false;
|
|
5343
|
-
let childRect = child.getBoundingClientRect();
|
|
5344
|
-
let elRect;
|
|
5345
|
-
if (!el || [window, document, document.documentElement].includes(el)) {
|
|
5346
|
-
elRect = {
|
|
5347
|
-
top: 0,
|
|
5348
|
-
right: window.innerWidth,
|
|
5349
|
-
bottom: window.innerHeight,
|
|
5350
|
-
left: 0
|
|
5351
|
-
};
|
|
5352
|
-
} else {
|
|
5353
|
-
elRect = el.getBoundingClientRect();
|
|
5354
|
-
}
|
|
5355
|
-
return childRect.top < elRect.bottom && childRect.bottom > elRect.top && childRect.right > elRect.left && childRect.left < elRect.right;
|
|
5356
|
-
};
|
|
5357
|
-
|
|
5358
|
-
const el$1 = (v) => {
|
|
5359
|
-
if (IS_SERVER$2)
|
|
5360
|
-
return null;
|
|
5361
|
-
let target;
|
|
5362
|
-
if (typeof v === "object") {
|
|
5363
|
-
target = v;
|
|
5364
|
-
} else {
|
|
5365
|
-
target = document.querySelector(v);
|
|
5366
|
-
}
|
|
5367
|
-
if (!target) {
|
|
5368
|
-
throw new Error("[@deot/helper-dom]: el缺失");
|
|
5369
|
-
}
|
|
5370
|
-
return target;
|
|
5371
|
-
};
|
|
5372
|
-
|
|
5373
|
-
const getStyle$1 = (el, name) => {
|
|
5374
|
-
if (IS_SERVER$2 || !name)
|
|
5375
|
-
return "";
|
|
5376
|
-
if (name === "float") {
|
|
5377
|
-
name = "cssFloat";
|
|
5378
|
-
}
|
|
5379
|
-
try {
|
|
5380
|
-
let computed = document.defaultView.getComputedStyle(el, "");
|
|
5381
|
-
return el.style[name] || (computed?.[name] || "");
|
|
5382
|
-
} catch (e) {
|
|
5383
|
-
return el.style[name] || "";
|
|
5384
|
-
}
|
|
5385
|
-
};
|
|
5386
|
-
|
|
5387
|
-
const isScroll = (el, direction) => {
|
|
5388
|
-
if (IS_SERVER$2 || !el)
|
|
5389
|
-
return false;
|
|
5390
|
-
let overflow = getStyle$1(el, `overflow-${"x"}`);
|
|
5391
|
-
overflow = overflow || getStyle$1(el, "overflow");
|
|
5392
|
-
return !!overflow.match(/(scroll|auto)/);
|
|
5393
|
-
};
|
|
5394
|
-
|
|
5395
|
-
const getScroller = (el, direction) => {
|
|
5396
|
-
if (IS_SERVER$2 || !el)
|
|
5397
|
-
return null;
|
|
5398
|
-
let parent = el;
|
|
5399
|
-
while (parent) {
|
|
5400
|
-
if ([window, document, document.documentElement].includes(parent)) {
|
|
5401
|
-
return window;
|
|
5402
|
-
}
|
|
5403
|
-
if (isScroll(parent)) {
|
|
5404
|
-
return parent;
|
|
5405
|
-
}
|
|
5406
|
-
parent = parent?.parentNode;
|
|
5407
|
-
}
|
|
5408
|
-
return parent;
|
|
5409
|
-
};
|
|
5410
|
-
|
|
5411
|
-
const off = (el, event, handler, options) => {
|
|
5412
|
-
if (IS_SERVER$2)
|
|
5413
|
-
return;
|
|
5414
|
-
el.removeEventListener(event, handler, false);
|
|
5415
|
-
};
|
|
5416
|
-
|
|
5417
|
-
const on = (el, event, handler, options) => {
|
|
5418
|
-
if (IS_SERVER$2)
|
|
5419
|
-
return () => {
|
|
5420
|
-
};
|
|
5421
|
-
el.addEventListener(event, handler, false);
|
|
5422
|
-
return () => {
|
|
5423
|
-
el.removeEventListener(event, handler, false);
|
|
5424
|
-
};
|
|
5425
|
-
};
|
|
5426
|
-
|
|
5427
|
-
const $target = IS_SERVER$2 ? {} : document.createElement("div").style;
|
|
5428
|
-
const prefix$1 = (() => {
|
|
5429
|
-
let keys = {
|
|
5430
|
-
webkit: "webkitTransform",
|
|
5431
|
-
Moz: "MozTransform",
|
|
5432
|
-
O: "OTransform",
|
|
5433
|
-
ms: "msTransform",
|
|
5434
|
-
standard: "transform"
|
|
5435
|
-
};
|
|
5436
|
-
let values = {
|
|
5437
|
-
webkit: "-webkit-",
|
|
5438
|
-
Moz: "-moz-",
|
|
5439
|
-
O: "-o-",
|
|
5440
|
-
ms: "-ms-",
|
|
5441
|
-
standard: ""
|
|
5442
|
-
};
|
|
5443
|
-
for (let key in keys) {
|
|
5444
|
-
if ($target[keys[key]] !== void 0) {
|
|
5445
|
-
return {
|
|
5446
|
-
camel: key,
|
|
5447
|
-
kebab: values[key]
|
|
5448
|
-
};
|
|
5449
|
-
}
|
|
5450
|
-
}
|
|
5451
|
-
return false;
|
|
5452
|
-
})();
|
|
5453
|
-
const prefixStyle = (v) => {
|
|
5454
|
-
if (IS_SERVER$2 || prefix$1 === false) {
|
|
5455
|
-
return {
|
|
5456
|
-
camel: v,
|
|
5457
|
-
kebab: v
|
|
5458
|
-
};
|
|
5459
|
-
}
|
|
5460
|
-
return {
|
|
5461
|
-
camel: prefix$1.camel + v.charAt(0).toUpperCase() + v.substr(1),
|
|
5462
|
-
kebab: prefix$1.kebab + v
|
|
5463
|
-
};
|
|
5464
|
-
};
|
|
5465
|
-
|
|
5466
|
-
const removeClass = (el, cls) => {
|
|
5467
|
-
if (IS_SERVER$2 || !cls)
|
|
5468
|
-
return;
|
|
5469
|
-
let classes = cls.split(" ");
|
|
5470
|
-
let curClass = " " + el.className + " ";
|
|
5471
|
-
for (let i = 0, j = classes.length; i < j; i++) {
|
|
5472
|
-
let clsName = classes[i];
|
|
5473
|
-
if (clsName) {
|
|
5474
|
-
if (el.classList) {
|
|
5475
|
-
el.classList.remove(clsName);
|
|
5476
|
-
continue;
|
|
5477
|
-
}
|
|
5478
|
-
/* istanbul ignore next -- @preserve */
|
|
5479
|
-
if (hasClass(el, clsName)) {
|
|
5480
|
-
curClass = curClass.replace(" " + clsName + " ", " ");
|
|
5481
|
-
}
|
|
5482
|
-
}
|
|
5483
|
-
}
|
|
5484
|
-
if (!el.classList) {
|
|
5485
|
-
el.className = curClass.trim();
|
|
5486
|
-
}
|
|
5487
|
-
};
|
|
5488
|
-
|
|
5489
|
-
const scrollIntoView = async (el, options) => {
|
|
5490
|
-
if (IS_SERVER$2)
|
|
5491
|
-
return;
|
|
5492
|
-
let { from = 0, to = 0, duration = 300 } = options || {};
|
|
5493
|
-
let difference = Math.abs(from - to);
|
|
5494
|
-
let step = Math.ceil(difference / duration * 50);
|
|
5495
|
-
let onResolve;
|
|
5496
|
-
let target = new Promise((resolve) => {
|
|
5497
|
-
onResolve = resolve;
|
|
5498
|
-
});
|
|
5499
|
-
const scroll = (start, end) => {
|
|
5500
|
-
if (start === end) {
|
|
5501
|
-
onResolve();
|
|
5502
|
-
return;
|
|
5503
|
-
}
|
|
5504
|
-
let d = start + step > end ? end : start + step;
|
|
5505
|
-
if (start > end) {
|
|
5506
|
-
d = start - step < end ? end : start - step;
|
|
5507
|
-
}
|
|
5508
|
-
if (el === window) {
|
|
5509
|
-
window.scrollTo(d, d);
|
|
5510
|
-
} else {
|
|
5511
|
-
el.scrollTop = d;
|
|
5512
|
-
}
|
|
5513
|
-
window.requestAnimationFrame(() => scroll(d, end));
|
|
5514
|
-
};
|
|
5515
|
-
scroll(from, to);
|
|
5516
|
-
return target;
|
|
5517
|
-
};
|
|
5518
|
-
|
|
5519
5507
|
class Resize {
|
|
5520
5508
|
el;
|
|
5521
5509
|
static of(el) {
|
|
@@ -9140,16 +9128,16 @@ var Vc = (function (exports, vue) {
|
|
|
9140
9128
|
}
|
|
9141
9129
|
}
|
|
9142
9130
|
const VcInstance = new Instance();
|
|
9143
|
-
const props$
|
|
9131
|
+
const props$1t = {
|
|
9144
9132
|
tag: {
|
|
9145
9133
|
type: String,
|
|
9146
9134
|
default: "div"
|
|
9147
9135
|
}
|
|
9148
9136
|
};
|
|
9149
|
-
const COMPONENT_NAME$
|
|
9137
|
+
const COMPONENT_NAME$28 = "vc-action-sheet";
|
|
9150
9138
|
const ActionSheet = /* @__PURE__ */ vue.defineComponent({
|
|
9151
|
-
name: COMPONENT_NAME$
|
|
9152
|
-
props: props$
|
|
9139
|
+
name: COMPONENT_NAME$28,
|
|
9140
|
+
props: props$1t,
|
|
9153
9141
|
setup(props2, {
|
|
9154
9142
|
slots
|
|
9155
9143
|
}) {
|
|
@@ -9161,6 +9149,174 @@ var Vc = (function (exports, vue) {
|
|
|
9161
9149
|
}
|
|
9162
9150
|
});
|
|
9163
9151
|
const MActionSheet = ActionSheet;
|
|
9152
|
+
const props$1s = {
|
|
9153
|
+
zIndex: {
|
|
9154
|
+
type: [Number, String],
|
|
9155
|
+
default: 1
|
|
9156
|
+
},
|
|
9157
|
+
// TODO: left/right
|
|
9158
|
+
placement: {
|
|
9159
|
+
type: String,
|
|
9160
|
+
default: "top"
|
|
9161
|
+
},
|
|
9162
|
+
disabled: {
|
|
9163
|
+
type: Boolean,
|
|
9164
|
+
default: false
|
|
9165
|
+
},
|
|
9166
|
+
fixed: {
|
|
9167
|
+
type: Boolean,
|
|
9168
|
+
default: true
|
|
9169
|
+
},
|
|
9170
|
+
offset: {
|
|
9171
|
+
type: Number,
|
|
9172
|
+
default: 0
|
|
9173
|
+
},
|
|
9174
|
+
// -> 固钉始终保持在容器内, 超过范围则隐藏(请注意容器避免出现滚动条) 仅fixed为true有效
|
|
9175
|
+
target: {
|
|
9176
|
+
type: String
|
|
9177
|
+
}
|
|
9178
|
+
};
|
|
9179
|
+
const COMPONENT_NAME$27 = "vc-affix";
|
|
9180
|
+
const SCROLLER_WHEEL_REG = /vc-scroller-wheel/;
|
|
9181
|
+
const Affix = /* @__PURE__ */ vue.defineComponent({
|
|
9182
|
+
name: COMPONENT_NAME$27,
|
|
9183
|
+
props: props$1s,
|
|
9184
|
+
setup(props2, {
|
|
9185
|
+
slots,
|
|
9186
|
+
expose
|
|
9187
|
+
}) {
|
|
9188
|
+
const scrollerInstance = vue.inject("vc-scroller", null);
|
|
9189
|
+
const scroller = vue.shallowRef();
|
|
9190
|
+
const base = vue.shallowRef();
|
|
9191
|
+
const current = vue.shallowRef();
|
|
9192
|
+
const currentRect = vue.reactive({
|
|
9193
|
+
top: 0,
|
|
9194
|
+
bottom: 0,
|
|
9195
|
+
width: 0,
|
|
9196
|
+
height: 0
|
|
9197
|
+
});
|
|
9198
|
+
const isActive = vue.ref(false);
|
|
9199
|
+
const transformY = vue.ref(0);
|
|
9200
|
+
const windowHeight = vue.ref(window.innerHeight);
|
|
9201
|
+
const isVcScrollerWheel = vue.computed(() => {
|
|
9202
|
+
return SCROLLER_WHEEL_REG.test(scroller.value?.className || "");
|
|
9203
|
+
});
|
|
9204
|
+
const currentStyle = vue.computed(() => {
|
|
9205
|
+
if (!isActive.value) return {};
|
|
9206
|
+
return {
|
|
9207
|
+
height: `${currentRect.height}px`,
|
|
9208
|
+
width: `${currentRect.width}px`
|
|
9209
|
+
};
|
|
9210
|
+
});
|
|
9211
|
+
const contentStyle = vue.computed(() => {
|
|
9212
|
+
if (!isActive.value) return {};
|
|
9213
|
+
const offset = `${props2.offset}px`;
|
|
9214
|
+
return {
|
|
9215
|
+
height: `${currentRect.height}px`,
|
|
9216
|
+
width: `${currentRect.width}px`,
|
|
9217
|
+
top: props2.placement === "top" ? offset : "",
|
|
9218
|
+
bottom: props2.placement === "bottom" ? offset : "",
|
|
9219
|
+
zIndex: props2.zIndex,
|
|
9220
|
+
transform: transformY.value ? `translateY(${transformY.value}px)` : ""
|
|
9221
|
+
};
|
|
9222
|
+
});
|
|
9223
|
+
const setCurrentRect = () => {
|
|
9224
|
+
const rect = current.value.getBoundingClientRect();
|
|
9225
|
+
Object.assign(currentRect, {
|
|
9226
|
+
top: rect.top,
|
|
9227
|
+
bottom: rect.bottom,
|
|
9228
|
+
width: rect.width,
|
|
9229
|
+
height: rect.height
|
|
9230
|
+
});
|
|
9231
|
+
};
|
|
9232
|
+
const setAbsoluteStatus = () => {
|
|
9233
|
+
const {
|
|
9234
|
+
placement,
|
|
9235
|
+
offset
|
|
9236
|
+
} = props2;
|
|
9237
|
+
const currentHeightOffset = offset + currentRect.height;
|
|
9238
|
+
const containerRect = scroller.value.getBoundingClientRect();
|
|
9239
|
+
let transformOffsetY = 0;
|
|
9240
|
+
if (scrollerInstance && isVcScrollerWheel.value) {
|
|
9241
|
+
const maxMoveY = scrollerInstance.scrollHeight - scrollerInstance.clientHeight;
|
|
9242
|
+
transformOffsetY = scrollerInstance.scrollTop >= maxMoveY ? maxMoveY : scrollerInstance.scrollTop;
|
|
9243
|
+
}
|
|
9244
|
+
if (placement === "top") {
|
|
9245
|
+
isActive.value = currentRect.top - containerRect.top <= props2.offset;
|
|
9246
|
+
transformY.value = Math.min(containerRect.bottom - currentHeightOffset, 0) + transformOffsetY;
|
|
9247
|
+
} else {
|
|
9248
|
+
isActive.value = currentRect.bottom - containerRect.top >= containerRect.height - props2.offset;
|
|
9249
|
+
transformY.value = Math.max(containerRect.height - containerRect.top - currentHeightOffset, 0) + transformOffsetY;
|
|
9250
|
+
}
|
|
9251
|
+
};
|
|
9252
|
+
const setFixedStatus = () => {
|
|
9253
|
+
const {
|
|
9254
|
+
placement,
|
|
9255
|
+
target,
|
|
9256
|
+
offset
|
|
9257
|
+
} = props2;
|
|
9258
|
+
const currentHeightOffset = offset + currentRect.height;
|
|
9259
|
+
const containerRect = target && base.value.getBoundingClientRect();
|
|
9260
|
+
if (placement === "top") {
|
|
9261
|
+
if (target) {
|
|
9262
|
+
isActive.value = offset > currentRect.top && containerRect.bottom > 0;
|
|
9263
|
+
transformY.value = Math.min(containerRect.bottom - currentHeightOffset, 0);
|
|
9264
|
+
} else {
|
|
9265
|
+
isActive.value = offset > currentRect.top;
|
|
9266
|
+
}
|
|
9267
|
+
} else {
|
|
9268
|
+
if (target) {
|
|
9269
|
+
isActive.value = windowHeight.value - offset < currentRect.bottom && windowHeight.value > containerRect.top;
|
|
9270
|
+
transformY.value = -Math.min(windowHeight.value - containerRect.top - currentHeightOffset, 0);
|
|
9271
|
+
} else {
|
|
9272
|
+
isActive.value = windowHeight.value - offset < currentRect.bottom;
|
|
9273
|
+
}
|
|
9274
|
+
}
|
|
9275
|
+
};
|
|
9276
|
+
const refresh = () => {
|
|
9277
|
+
setCurrentRect();
|
|
9278
|
+
scroller.value instanceof Window || props2.fixed ? setFixedStatus() : setAbsoluteStatus();
|
|
9279
|
+
};
|
|
9280
|
+
vue.onMounted(() => {
|
|
9281
|
+
if (typeof props2.target === "string") {
|
|
9282
|
+
base.value = document.querySelector(props2.target) ?? void 0;
|
|
9283
|
+
}
|
|
9284
|
+
!base.value && (base.value = document.documentElement);
|
|
9285
|
+
scroller.value = getScroller(current.value, {
|
|
9286
|
+
className: SCROLLER_WHEEL_REG
|
|
9287
|
+
});
|
|
9288
|
+
if (isVcScrollerWheel.value) {
|
|
9289
|
+
scrollerInstance?.on(refresh);
|
|
9290
|
+
} else {
|
|
9291
|
+
scroller.value?.addEventListener("scroll", refresh);
|
|
9292
|
+
}
|
|
9293
|
+
refresh();
|
|
9294
|
+
});
|
|
9295
|
+
vue.onBeforeUnmount(() => {
|
|
9296
|
+
if (isVcScrollerWheel.value) {
|
|
9297
|
+
scrollerInstance?.off(refresh);
|
|
9298
|
+
} else {
|
|
9299
|
+
scroller.value?.removeEventListener("scroll", refresh);
|
|
9300
|
+
}
|
|
9301
|
+
});
|
|
9302
|
+
expose({
|
|
9303
|
+
refresh
|
|
9304
|
+
});
|
|
9305
|
+
return () => {
|
|
9306
|
+
return vue.createVNode("div", {
|
|
9307
|
+
"ref": current,
|
|
9308
|
+
"class": "vc-affix",
|
|
9309
|
+
"style": currentStyle.value
|
|
9310
|
+
}, [vue.createVNode("div", {
|
|
9311
|
+
"class": {
|
|
9312
|
+
[`vc-affix__${props2.fixed ? "fixed" : "absolute"}`]: isActive.value
|
|
9313
|
+
},
|
|
9314
|
+
"style": contentStyle.value
|
|
9315
|
+
}, [slots?.default?.()])]);
|
|
9316
|
+
};
|
|
9317
|
+
}
|
|
9318
|
+
});
|
|
9319
|
+
const MAffix = Affix;
|
|
9164
9320
|
const props$1r = {
|
|
9165
9321
|
modelValue: {
|
|
9166
9322
|
type: Boolean,
|
|
@@ -9829,7 +9985,7 @@ var Vc = (function (exports, vue) {
|
|
|
9829
9985
|
});
|
|
9830
9986
|
const COMPONENT_NAME$1$ = "vc-alert";
|
|
9831
9987
|
const THEME_MAP = {
|
|
9832
|
-
info: ["#
|
|
9988
|
+
info: ["#456CF6", "#91d5ff", "#e6f7ff"],
|
|
9833
9989
|
success: ["#52c41a", "#b7eb8f", "#f6ffed"],
|
|
9834
9990
|
error: ["#ed4014", "#ffb08f", "#fbe9e9"],
|
|
9835
9991
|
warning: ["#ffbf00", "#ffe58f", "#fffbe6"]
|
|
@@ -17726,6 +17882,7 @@ var Vc = (function (exports, vue) {
|
|
|
17726
17882
|
refreshSize();
|
|
17727
17883
|
refreshPosition(options);
|
|
17728
17884
|
};
|
|
17885
|
+
const listeners = [];
|
|
17729
17886
|
const triggerScrollDelegate = (options) => {
|
|
17730
17887
|
const delegates = {
|
|
17731
17888
|
scrollLeft: (options && options.x) ?? scrollX.value,
|
|
@@ -17733,12 +17890,15 @@ var Vc = (function (exports, vue) {
|
|
|
17733
17890
|
clientWidth: wrapperW.value,
|
|
17734
17891
|
clientHeight: wrapperH.value,
|
|
17735
17892
|
scrollWidth: contentW.value,
|
|
17736
|
-
scrollHeight: contentH.value
|
|
17893
|
+
scrollHeight: contentH.value,
|
|
17894
|
+
getBoundingClientRect: () => wrapper.value?.getBoundingClientRect()
|
|
17737
17895
|
};
|
|
17738
|
-
|
|
17896
|
+
const e = {
|
|
17739
17897
|
target: delegates,
|
|
17740
17898
|
currentTarget: delegates
|
|
17741
|
-
}
|
|
17899
|
+
};
|
|
17900
|
+
instance.emit("scroll", e);
|
|
17901
|
+
listeners.forEach((listener) => listener(e));
|
|
17742
17902
|
};
|
|
17743
17903
|
const scrollTo = (options) => {
|
|
17744
17904
|
refreshPosition(options);
|
|
@@ -17765,8 +17925,9 @@ var Vc = (function (exports, vue) {
|
|
|
17765
17925
|
Resize.off(wrapper.value, refresh);
|
|
17766
17926
|
Resize.off(content.value, refresh);
|
|
17767
17927
|
}
|
|
17928
|
+
listeners.splice(0, listeners.length);
|
|
17768
17929
|
});
|
|
17769
|
-
|
|
17930
|
+
const exposed = {
|
|
17770
17931
|
wrapper,
|
|
17771
17932
|
content,
|
|
17772
17933
|
scrollTo,
|
|
@@ -17782,8 +17943,16 @@ var Vc = (function (exports, vue) {
|
|
|
17782
17943
|
},
|
|
17783
17944
|
setScrollLeft: (value) => {
|
|
17784
17945
|
scrollTo({ x: value });
|
|
17946
|
+
},
|
|
17947
|
+
on: (listener) => {
|
|
17948
|
+
listeners.push(listener);
|
|
17949
|
+
},
|
|
17950
|
+
off: (listener) => {
|
|
17951
|
+
listeners.splice(listeners.indexOf(listener), 1);
|
|
17785
17952
|
}
|
|
17786
|
-
}
|
|
17953
|
+
};
|
|
17954
|
+
expose(exposed);
|
|
17955
|
+
vue.provide("vc-scroller", vue.reactive(exposed));
|
|
17787
17956
|
return {
|
|
17788
17957
|
bar,
|
|
17789
17958
|
wrapper,
|
|
@@ -23096,7 +23265,7 @@ var Vc = (function (exports, vue) {
|
|
|
23096
23265
|
color: {
|
|
23097
23266
|
type: [Object, String],
|
|
23098
23267
|
default: () => ({
|
|
23099
|
-
normal: "#
|
|
23268
|
+
normal: "#456CF6",
|
|
23100
23269
|
success: "#52c41a",
|
|
23101
23270
|
error: "#f5222d"
|
|
23102
23271
|
})
|
|
@@ -28050,7 +28219,8 @@ var Vc = (function (exports, vue) {
|
|
|
28050
28219
|
});
|
|
28051
28220
|
const props$b = {
|
|
28052
28221
|
value: {
|
|
28053
|
-
type: [String, Number, Boolean]
|
|
28222
|
+
type: [String, Number, Boolean],
|
|
28223
|
+
default: void 0
|
|
28054
28224
|
},
|
|
28055
28225
|
label: {
|
|
28056
28226
|
type: [String, Function],
|
|
@@ -28356,7 +28526,7 @@ var Vc = (function (exports, vue) {
|
|
|
28356
28526
|
"class": [{
|
|
28357
28527
|
"is-fixed": isFixed
|
|
28358
28528
|
}, "vcm-tabs__bar"]
|
|
28359
|
-
}, [vue.createVNode("slot", {
|
|
28529
|
+
}, [vue.createVNode(vue.resolveComponent("slot"), {
|
|
28360
28530
|
"name": "prepend"
|
|
28361
28531
|
}, null), slots.prepend?.(), props2.showStep && tabs.scrollable.value && vue.createVNode("div", {
|
|
28362
28532
|
"class": "vcm-tabs__step is-left",
|
|
@@ -31401,6 +31571,8 @@ var Vc = (function (exports, vue) {
|
|
|
31401
31571
|
const Components = {
|
|
31402
31572
|
ActionSheet,
|
|
31403
31573
|
MActionSheet,
|
|
31574
|
+
Affix,
|
|
31575
|
+
MAffix,
|
|
31404
31576
|
Alert,
|
|
31405
31577
|
MAlert,
|
|
31406
31578
|
Artboard,
|
|
@@ -34726,10 +34898,10 @@ var Vc = (function (exports, vue) {
|
|
|
34726
34898
|
var _v1 = create$2();
|
|
34727
34899
|
var _v2 = create$2();
|
|
34728
34900
|
function isAroundZero$1(val) {
|
|
34729
|
-
return val > -
|
|
34901
|
+
return val > -EPSILON$4 && val < EPSILON$4;
|
|
34730
34902
|
}
|
|
34731
34903
|
function isNotAroundZero$1(val) {
|
|
34732
|
-
return val > EPSILON$4 || val < -
|
|
34904
|
+
return val > EPSILON$4 || val < -EPSILON$4;
|
|
34733
34905
|
}
|
|
34734
34906
|
function cubicAt(p0, p1, p2, p3, t) {
|
|
34735
34907
|
var onet = 1 - t;
|
|
@@ -35716,7 +35888,7 @@ var Vc = (function (exports, vue) {
|
|
|
35716
35888
|
}
|
|
35717
35889
|
var EPSILON$3 = 1e-4;
|
|
35718
35890
|
function isAroundZero(transform) {
|
|
35719
|
-
return transform < EPSILON$3 && transform > -
|
|
35891
|
+
return transform < EPSILON$3 && transform > -EPSILON$3;
|
|
35720
35892
|
}
|
|
35721
35893
|
function round3(transform) {
|
|
35722
35894
|
return mathRound$1(transform * 1e3) / 1e3;
|
|
@@ -36997,7 +37169,7 @@ var Vc = (function (exports, vue) {
|
|
|
36997
37169
|
var mIdentity = identity;
|
|
36998
37170
|
var EPSILON$2 = 5e-5;
|
|
36999
37171
|
function isNotAroundZero(val) {
|
|
37000
|
-
return val > EPSILON$2 || val < -
|
|
37172
|
+
return val > EPSILON$2 || val < -EPSILON$2;
|
|
37001
37173
|
}
|
|
37002
37174
|
var scaleTmp = [];
|
|
37003
37175
|
var tmpTransform = [];
|
|
@@ -37715,7 +37887,7 @@ var Vc = (function (exports, vue) {
|
|
|
37715
37887
|
this.markRedraw();
|
|
37716
37888
|
if (!useHoverLayer && this.__inHover) {
|
|
37717
37889
|
this._toggleHoverLayerFlag(false);
|
|
37718
|
-
this.__dirty &=
|
|
37890
|
+
this.__dirty &= ~REDRAW_BIT;
|
|
37719
37891
|
}
|
|
37720
37892
|
return state;
|
|
37721
37893
|
};
|
|
@@ -37773,7 +37945,7 @@ var Vc = (function (exports, vue) {
|
|
|
37773
37945
|
this.markRedraw();
|
|
37774
37946
|
if (!useHoverLayer && this.__inHover) {
|
|
37775
37947
|
this._toggleHoverLayerFlag(false);
|
|
37776
|
-
this.__dirty &=
|
|
37948
|
+
this.__dirty &= ~REDRAW_BIT;
|
|
37777
37949
|
}
|
|
37778
37950
|
}
|
|
37779
37951
|
};
|
|
@@ -39096,7 +39268,7 @@ var Vc = (function (exports, vue) {
|
|
|
39096
39268
|
* @return {boolean}
|
|
39097
39269
|
*/
|
|
39098
39270
|
function isRadianAroundZero(val) {
|
|
39099
|
-
return val > -
|
|
39271
|
+
return val > -RADIAN_EPSILON && val < RADIAN_EPSILON;
|
|
39100
39272
|
}
|
|
39101
39273
|
// eslint-disable-next-line
|
|
39102
39274
|
var TIME_REG = /^(?:(\d{4})(?:[-\/](\d{1,2})(?:[-\/](\d{1,2})(?:[T ](\d{1,2})(?::(\d{1,2})(?::(\d{1,2})(?:[.,](\d+))?)?)?(Z|[\+\-]\d\d:?\d\d)?)?)?)?)?$/; // jshint ignore:line
|
|
@@ -40690,7 +40862,7 @@ var Vc = (function (exports, vue) {
|
|
|
40690
40862
|
return !!(this.__dirty & STYLE_CHANGED_BIT);
|
|
40691
40863
|
};
|
|
40692
40864
|
Displayable.prototype.styleUpdated = function () {
|
|
40693
|
-
this.__dirty &=
|
|
40865
|
+
this.__dirty &= ~STYLE_CHANGED_BIT;
|
|
40694
40866
|
};
|
|
40695
40867
|
Displayable.prototype.createStyle = function (obj) {
|
|
40696
40868
|
return createObject(DEFAULT_COMMON_STYLE, obj);
|
|
@@ -42199,7 +42371,7 @@ var Vc = (function (exports, vue) {
|
|
|
42199
42371
|
};
|
|
42200
42372
|
Path.prototype.buildPath = function (ctx, shapeCfg, inBatch) { };
|
|
42201
42373
|
Path.prototype.pathUpdated = function () {
|
|
42202
|
-
this.__dirty &=
|
|
42374
|
+
this.__dirty &= ~SHAPE_CHANGED_BIT;
|
|
42203
42375
|
};
|
|
42204
42376
|
Path.prototype.getUpdatedPathProxy = function (inBatch) {
|
|
42205
42377
|
!this.path && this.createPathProxy();
|
|
@@ -54785,7 +54957,7 @@ var Vc = (function (exports, vue) {
|
|
|
54785
54957
|
function brush$1(ctx, el, scope, isLast) {
|
|
54786
54958
|
var m = el.transform;
|
|
54787
54959
|
if (!el.shouldBePainted(scope.viewWidth, scope.viewHeight, false, false)) {
|
|
54788
|
-
el.__dirty &=
|
|
54960
|
+
el.__dirty &= ~REDRAW_BIT;
|
|
54789
54961
|
el.__isRendered = false;
|
|
54790
54962
|
return;
|
|
54791
54963
|
}
|
|
@@ -113054,7 +113226,7 @@ var Vc = (function (exports, vue) {
|
|
|
113054
113226
|
// and velocity is close to 0
|
|
113055
113227
|
//
|
|
113056
113228
|
|
|
113057
|
-
if (velocity.x < -
|
|
113229
|
+
if (velocity.x < -MIN_NEXT_SLIDE_SPEED && currentSlideVisibilityRatio < 0 || velocity.x < 0.1 && currentSlideVisibilityRatio < -0.5) {
|
|
113058
113230
|
// Go to next slide
|
|
113059
113231
|
indexDiff = 1;
|
|
113060
113232
|
velocity.x = Math.min(velocity.x, 0);
|
|
@@ -113118,7 +113290,7 @@ var Vc = (function (exports, vue) {
|
|
|
113118
113290
|
// or if we are below and moving downwards
|
|
113119
113291
|
|
|
113120
113292
|
|
|
113121
|
-
if (vDragRatio < 0 && projectedVDragRatio < -
|
|
113293
|
+
if (vDragRatio < 0 && projectedVDragRatio < -MIN_RATIO_TO_CLOSE || vDragRatio > 0 && projectedVDragRatio > MIN_RATIO_TO_CLOSE) {
|
|
113122
113294
|
this.pswp.close();
|
|
113123
113295
|
return;
|
|
113124
113296
|
}
|
|
@@ -131836,6 +132008,7 @@ var Vc = (function (exports, vue) {
|
|
|
131836
132008
|
}, Symbol.toStringTag, { value: 'Module' }));
|
|
131837
132009
|
|
|
131838
132010
|
exports.ActionSheet = ActionSheet;
|
|
132011
|
+
exports.Affix = Affix;
|
|
131839
132012
|
exports.Alert = Alert;
|
|
131840
132013
|
exports.Artboard = Artboard;
|
|
131841
132014
|
exports.Button = Button;
|
|
@@ -131881,6 +132054,7 @@ var Vc = (function (exports, vue) {
|
|
|
131881
132054
|
exports.List = MList;
|
|
131882
132055
|
exports.ListItem = MListItem;
|
|
131883
132056
|
exports.MActionSheet = MActionSheet;
|
|
132057
|
+
exports.MAffix = MAffix;
|
|
131884
132058
|
exports.MAlert = MAlert;
|
|
131885
132059
|
exports.MArtboard = MArtboard;
|
|
131886
132060
|
exports.MButton = MButton;
|