@deot/vc 1.0.43 → 1.0.45

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.
@@ -127,6 +127,222 @@
127
127
  return parent;
128
128
  };
129
129
 
130
+ const IS_SERVER$2 = typeof window === "undefined";
131
+
132
+ const hasClass = (el, cls) => {
133
+ if (IS_SERVER$2 || !cls) return false;
134
+ if (cls.includes(" ")) {
135
+ throw new Error("[@deot/helper-dom]: 类名不应该包含空格");
136
+ }
137
+ if (el.classList) {
138
+ return el.classList.contains(cls);
139
+ } else {
140
+ return (" " + el.className + " ").indexOf(" " + cls + " ") > -1;
141
+ }
142
+ };
143
+
144
+ const addClass = (el, cls) => {
145
+ if (IS_SERVER$2 || !cls) return;
146
+ let curClass = el.className;
147
+ const classes = cls.split(" ");
148
+ for (let i = 0, j = classes.length; i < j; i++) {
149
+ const clsName = classes[i];
150
+ if (clsName) {
151
+ if (el.classList) {
152
+ el.classList.add(clsName);
153
+ } else if (!hasClass(el, clsName)) {
154
+ curClass += " " + clsName;
155
+ }
156
+ }
157
+ }
158
+ if (!el.classList) {
159
+ el.className = curClass;
160
+ }
161
+ };
162
+
163
+ const composedPath = (e) => {
164
+ const path = e.composedPath && e.composedPath() || [];
165
+ if (path.length) return path;
166
+ let parent = e.target?.parentNode;
167
+ /* istanbul ignore next -- @preserve */
168
+ while (parent) {
169
+ path.push(parent);
170
+ parent = parent.parentNode;
171
+ }
172
+ return path;
173
+ };
174
+
175
+ const contains$1 = (el, child) => {
176
+ if (IS_SERVER$2 || !child) return false;
177
+ const childRect = child.getBoundingClientRect();
178
+ let elRect;
179
+ if (!el || [window, document, document.documentElement].includes(el)) {
180
+ elRect = {
181
+ top: 0,
182
+ right: window.innerWidth,
183
+ bottom: window.innerHeight,
184
+ left: 0
185
+ };
186
+ } else {
187
+ elRect = el.getBoundingClientRect();
188
+ }
189
+ return childRect.top < elRect.bottom && childRect.bottom > elRect.top && childRect.right > elRect.left && childRect.left < elRect.right;
190
+ };
191
+
192
+ const el$1 = (v) => {
193
+ if (IS_SERVER$2) return null;
194
+ let target;
195
+ if (typeof v === "object") {
196
+ target = v;
197
+ } else {
198
+ target = document.querySelector(v);
199
+ }
200
+ if (!target) {
201
+ throw new Error("[@deot/helper-dom]: el缺失");
202
+ }
203
+ return target;
204
+ };
205
+
206
+ const getStyle$1 = (el, name) => {
207
+ if (IS_SERVER$2 || !name) return "";
208
+ if (name === "float") {
209
+ name = "cssFloat";
210
+ }
211
+ try {
212
+ const computed = document.defaultView.getComputedStyle(el, "");
213
+ return el.style[name] || (computed?.[name] || "");
214
+ } catch (e) {
215
+ return el.style[name] || "";
216
+ }
217
+ };
218
+
219
+ const isScroller = (el, options) => {
220
+ if (IS_SERVER$2 || !el) return false;
221
+ const { className, direction } = options || {};
222
+ let overflow = getStyle$1(el, `overflow-${direction ? "y" : "x"}`);
223
+ overflow = overflow || getStyle$1(el, "overflow");
224
+ return !!(overflow.match(/(scroll|auto)/) || className?.test(el.className));
225
+ };
226
+
227
+ const getScroller = (el, options) => {
228
+ if (IS_SERVER$2 || !el) return null;
229
+ let parent = el;
230
+ while (parent) {
231
+ if ([window, document, document.documentElement].includes(parent)) {
232
+ return window;
233
+ }
234
+ if (isScroller(parent, options)) {
235
+ return parent;
236
+ }
237
+ parent = parent?.parentNode;
238
+ }
239
+ return parent;
240
+ };
241
+
242
+ const off = (el, event, handler, options) => {
243
+ if (IS_SERVER$2) return;
244
+ el.removeEventListener(event, handler, false);
245
+ };
246
+
247
+ const on = (el, event, handler, options) => {
248
+ if (IS_SERVER$2) return () => {
249
+ };
250
+ el.addEventListener(event, handler, false);
251
+ return () => {
252
+ el.removeEventListener(event, handler, false);
253
+ };
254
+ };
255
+
256
+ const $target = IS_SERVER$2 ? {} : document.createElement("div").style;
257
+ const prefix$1 = (() => {
258
+ const keys = {
259
+ webkit: "webkitTransform",
260
+ Moz: "MozTransform",
261
+ O: "OTransform",
262
+ ms: "msTransform",
263
+ standard: "transform"
264
+ };
265
+ const values = {
266
+ webkit: "-webkit-",
267
+ Moz: "-moz-",
268
+ O: "-o-",
269
+ ms: "-ms-",
270
+ standard: ""
271
+ };
272
+ for (const key in keys) {
273
+ if ($target[keys[key]] !== void 0) {
274
+ return {
275
+ camel: key,
276
+ kebab: values[key]
277
+ };
278
+ }
279
+ }
280
+ return false;
281
+ })();
282
+ const prefixStyle = (v) => {
283
+ if (IS_SERVER$2 || prefix$1 === false) {
284
+ return {
285
+ camel: v,
286
+ kebab: v
287
+ };
288
+ }
289
+ return {
290
+ camel: prefix$1.camel + v.charAt(0).toUpperCase() + v.substr(1),
291
+ kebab: prefix$1.kebab + v
292
+ };
293
+ };
294
+
295
+ const removeClass = (el, cls) => {
296
+ if (IS_SERVER$2 || !cls) return;
297
+ const classes = cls.split(" ");
298
+ let curClass = " " + el.className + " ";
299
+ for (let i = 0, j = classes.length; i < j; i++) {
300
+ const clsName = classes[i];
301
+ if (clsName) {
302
+ if (el.classList) {
303
+ el.classList.remove(clsName);
304
+ continue;
305
+ }
306
+ /* istanbul ignore next -- @preserve */
307
+ if (hasClass(el, clsName)) {
308
+ curClass = curClass.replace(" " + clsName + " ", " ");
309
+ }
310
+ }
311
+ }
312
+ if (!el.classList) {
313
+ el.className = curClass.trim();
314
+ }
315
+ };
316
+
317
+ const scrollIntoView = async (el, options) => {
318
+ if (IS_SERVER$2) return;
319
+ const { from = 0, to = 0, duration = 300 } = options || {};
320
+ const difference = Math.abs(from - to);
321
+ const step = Math.ceil(difference / duration * 50);
322
+ let onResolve;
323
+ const target = new Promise((resolve) => {
324
+ onResolve = resolve;
325
+ });
326
+ const scroll = (start, end) => {
327
+ if (start === end) {
328
+ onResolve();
329
+ return;
330
+ }
331
+ let d = start + step > end ? end : start + step;
332
+ if (start > end) {
333
+ d = start - step < end ? end : start - step;
334
+ }
335
+ if (el === window) {
336
+ window.scrollTo(d, d);
337
+ } else {
338
+ el.scrollTop = d;
339
+ }
340
+ window.requestAnimationFrame(() => scroll(d, end));
341
+ };
342
+ scroll(from, to);
343
+ return target;
344
+ };
345
+
130
346
  const debounce$1 = (original, wait, options) => {
131
347
  const { leading, trailing = true, throttle } = options || {};
132
348
  let timer;
@@ -222,7 +438,7 @@
222
438
  );
223
439
  };
224
440
 
225
- const flatten$1 = (value, parser) => {
441
+ const flatten$1 = (value, parser, exit) => {
226
442
  let need = true;
227
443
  let safeCount = 1;
228
444
  let parseValue = value;
@@ -232,7 +448,7 @@
232
448
  }
233
449
  try {
234
450
  const next = (parser || decodeURIComponent)(parseValue);
235
- if (parseValue === next) {
451
+ if (parseValue === next || typeof exit === "function" && exit(next)) {
236
452
  need = false;
237
453
  }
238
454
  parseValue = next;
@@ -245,8 +461,7 @@
245
461
  };
246
462
 
247
463
  const flattenJSONParse = (value) => {
248
- if (value === null)
249
- return null;
464
+ if (value === null) return null;
250
465
  const regex = /^\d+$/;
251
466
  if (regex.test(value) && value.length >= 16 && +value > Number.MAX_SAFE_INTEGER) {
252
467
  return value;
@@ -2591,7 +2806,7 @@
2591
2806
  function castSlice(array, start, end) {
2592
2807
  var length = array.length;
2593
2808
  end = end === undefined ? length : end;
2594
- return (false && end >= length) ? array : baseSlice(array, start, end);
2809
+ return (!start && end >= length) ? array : baseSlice(array, start, end);
2595
2810
  }
2596
2811
 
2597
2812
  /** Used to compose unicode character classes. */
@@ -5292,233 +5507,6 @@
5292
5507
  });
5293
5508
  }
5294
5509
 
5295
- const IS_SERVER$2 = typeof window === "undefined";
5296
-
5297
- const hasClass = (el, cls) => {
5298
- if (IS_SERVER$2 || !cls)
5299
- return false;
5300
- if (cls.includes(" ")) {
5301
- throw new Error("[@deot/helper-dom]: 类名不应该包含空格");
5302
- }
5303
- if (el.classList) {
5304
- return el.classList.contains(cls);
5305
- } else {
5306
- return (" " + el.className + " ").indexOf(" " + cls + " ") > -1;
5307
- }
5308
- };
5309
-
5310
- const addClass = (el, cls) => {
5311
- if (IS_SERVER$2 || !cls)
5312
- return;
5313
- let curClass = el.className;
5314
- let classes = cls.split(" ");
5315
- for (let i = 0, j = classes.length; i < j; i++) {
5316
- let clsName = classes[i];
5317
- if (clsName) {
5318
- if (el.classList) {
5319
- el.classList.add(clsName);
5320
- } else if (!hasClass(el, clsName)) {
5321
- curClass += " " + clsName;
5322
- }
5323
- }
5324
- }
5325
- if (!el.classList) {
5326
- el.className = curClass;
5327
- }
5328
- };
5329
-
5330
- const composedPath = (e) => {
5331
- let path = e.composedPath && e.composedPath() || [];
5332
- if (path.length)
5333
- return path;
5334
- let parent = e.target?.parentNode;
5335
- /* istanbul ignore next -- @preserve */
5336
- while (parent) {
5337
- path.push(parent);
5338
- parent = parent.parentNode;
5339
- }
5340
- return path;
5341
- };
5342
-
5343
- const contains$1 = (el, child) => {
5344
- if (IS_SERVER$2 || !child)
5345
- return false;
5346
- let childRect = child.getBoundingClientRect();
5347
- let elRect;
5348
- if (!el || [window, document, document.documentElement].includes(el)) {
5349
- elRect = {
5350
- top: 0,
5351
- right: window.innerWidth,
5352
- bottom: window.innerHeight,
5353
- left: 0
5354
- };
5355
- } else {
5356
- elRect = el.getBoundingClientRect();
5357
- }
5358
- return childRect.top < elRect.bottom && childRect.bottom > elRect.top && childRect.right > elRect.left && childRect.left < elRect.right;
5359
- };
5360
-
5361
- const el$1 = (v) => {
5362
- if (IS_SERVER$2)
5363
- return null;
5364
- let target;
5365
- if (typeof v === "object") {
5366
- target = v;
5367
- } else {
5368
- target = document.querySelector(v);
5369
- }
5370
- if (!target) {
5371
- throw new Error("[@deot/helper-dom]: el缺失");
5372
- }
5373
- return target;
5374
- };
5375
-
5376
- const getStyle$1 = (el, name) => {
5377
- if (IS_SERVER$2 || !name)
5378
- return "";
5379
- if (name === "float") {
5380
- name = "cssFloat";
5381
- }
5382
- try {
5383
- let computed = document.defaultView.getComputedStyle(el, "");
5384
- return el.style[name] || (computed?.[name] || "");
5385
- } catch (e) {
5386
- return el.style[name] || "";
5387
- }
5388
- };
5389
-
5390
- const isScroll = (el, direction) => {
5391
- if (IS_SERVER$2 || !el)
5392
- return false;
5393
- let overflow = getStyle$1(el, `overflow-${"x"}`);
5394
- overflow = overflow || getStyle$1(el, "overflow");
5395
- return !!overflow.match(/(scroll|auto)/);
5396
- };
5397
-
5398
- const getScroller = (el, direction) => {
5399
- if (IS_SERVER$2 || !el)
5400
- return null;
5401
- let parent = el;
5402
- while (parent) {
5403
- if ([window, document, document.documentElement].includes(parent)) {
5404
- return window;
5405
- }
5406
- if (isScroll(parent)) {
5407
- return parent;
5408
- }
5409
- parent = parent?.parentNode;
5410
- }
5411
- return parent;
5412
- };
5413
-
5414
- const off = (el, event, handler, options) => {
5415
- if (IS_SERVER$2)
5416
- return;
5417
- el.removeEventListener(event, handler, false);
5418
- };
5419
-
5420
- const on = (el, event, handler, options) => {
5421
- if (IS_SERVER$2)
5422
- return () => {
5423
- };
5424
- el.addEventListener(event, handler, false);
5425
- return () => {
5426
- el.removeEventListener(event, handler, false);
5427
- };
5428
- };
5429
-
5430
- const $target = IS_SERVER$2 ? {} : document.createElement("div").style;
5431
- const prefix$1 = (() => {
5432
- let keys = {
5433
- webkit: "webkitTransform",
5434
- Moz: "MozTransform",
5435
- O: "OTransform",
5436
- ms: "msTransform",
5437
- standard: "transform"
5438
- };
5439
- let values = {
5440
- webkit: "-webkit-",
5441
- Moz: "-moz-",
5442
- O: "-o-",
5443
- ms: "-ms-",
5444
- standard: ""
5445
- };
5446
- for (let key in keys) {
5447
- if ($target[keys[key]] !== void 0) {
5448
- return {
5449
- camel: key,
5450
- kebab: values[key]
5451
- };
5452
- }
5453
- }
5454
- return false;
5455
- })();
5456
- const prefixStyle = (v) => {
5457
- if (IS_SERVER$2 || prefix$1 === false) {
5458
- return {
5459
- camel: v,
5460
- kebab: v
5461
- };
5462
- }
5463
- return {
5464
- camel: prefix$1.camel + v.charAt(0).toUpperCase() + v.substr(1),
5465
- kebab: prefix$1.kebab + v
5466
- };
5467
- };
5468
-
5469
- const removeClass = (el, cls) => {
5470
- if (IS_SERVER$2 || !cls)
5471
- return;
5472
- let classes = cls.split(" ");
5473
- let curClass = " " + el.className + " ";
5474
- for (let i = 0, j = classes.length; i < j; i++) {
5475
- let clsName = classes[i];
5476
- if (clsName) {
5477
- if (el.classList) {
5478
- el.classList.remove(clsName);
5479
- continue;
5480
- }
5481
- /* istanbul ignore next -- @preserve */
5482
- if (hasClass(el, clsName)) {
5483
- curClass = curClass.replace(" " + clsName + " ", " ");
5484
- }
5485
- }
5486
- }
5487
- if (!el.classList) {
5488
- el.className = curClass.trim();
5489
- }
5490
- };
5491
-
5492
- const scrollIntoView = async (el, options) => {
5493
- if (IS_SERVER$2)
5494
- return;
5495
- let { from = 0, to = 0, duration = 300 } = options || {};
5496
- let difference = Math.abs(from - to);
5497
- let step = Math.ceil(difference / duration * 50);
5498
- let onResolve;
5499
- let target = new Promise((resolve) => {
5500
- onResolve = resolve;
5501
- });
5502
- const scroll = (start, end) => {
5503
- if (start === end) {
5504
- onResolve();
5505
- return;
5506
- }
5507
- let d = start + step > end ? end : start + step;
5508
- if (start > end) {
5509
- d = start - step < end ? end : start - step;
5510
- }
5511
- if (el === window) {
5512
- window.scrollTo(d, d);
5513
- } else {
5514
- el.scrollTop = d;
5515
- }
5516
- window.requestAnimationFrame(() => scroll(d, end));
5517
- };
5518
- scroll(from, to);
5519
- return target;
5520
- };
5521
-
5522
5510
  class Resize {
5523
5511
  el;
5524
5512
  static of(el) {
@@ -9143,16 +9131,16 @@
9143
9131
  }
9144
9132
  }
9145
9133
  const VcInstance = new Instance();
9146
- const props$1s = {
9134
+ const props$1t = {
9147
9135
  tag: {
9148
9136
  type: String,
9149
9137
  default: "div"
9150
9138
  }
9151
9139
  };
9152
- const COMPONENT_NAME$27 = "vc-action-sheet";
9140
+ const COMPONENT_NAME$28 = "vc-action-sheet";
9153
9141
  const ActionSheet = /* @__PURE__ */ vue.defineComponent({
9154
- name: COMPONENT_NAME$27,
9155
- props: props$1s,
9142
+ name: COMPONENT_NAME$28,
9143
+ props: props$1t,
9156
9144
  setup(props2, {
9157
9145
  slots
9158
9146
  }) {
@@ -9164,6 +9152,176 @@
9164
9152
  }
9165
9153
  });
9166
9154
  const MActionSheet = ActionSheet;
9155
+ const props$1s = {
9156
+ zIndex: {
9157
+ type: [Number, String],
9158
+ default: 1
9159
+ },
9160
+ // TODO: left/right
9161
+ placement: {
9162
+ type: String,
9163
+ default: "top"
9164
+ },
9165
+ disabled: {
9166
+ type: Boolean,
9167
+ default: false
9168
+ },
9169
+ fixed: {
9170
+ type: Boolean,
9171
+ default: true
9172
+ },
9173
+ offset: {
9174
+ type: Number,
9175
+ default: 0
9176
+ },
9177
+ // -> 固钉始终保持在容器内, 超过范围则隐藏(请注意容器避免出现滚动条) 仅fixed为true有效
9178
+ target: {
9179
+ type: String
9180
+ }
9181
+ };
9182
+ const COMPONENT_NAME$27 = "vc-affix";
9183
+ const SCROLLER_WHEEL_REG = /vc-scroller-wheel/;
9184
+ const Affix = /* @__PURE__ */ vue.defineComponent({
9185
+ name: COMPONENT_NAME$27,
9186
+ props: props$1s,
9187
+ setup(props2, {
9188
+ slots,
9189
+ expose
9190
+ }) {
9191
+ const scrollerInstance = vue.inject("vc-scroller", null);
9192
+ const scroller = vue.shallowRef();
9193
+ const base = vue.shallowRef();
9194
+ const current = vue.shallowRef();
9195
+ const currentRect = vue.reactive({
9196
+ top: 0,
9197
+ bottom: 0,
9198
+ width: 0,
9199
+ height: 0
9200
+ });
9201
+ const isActive = vue.ref(false);
9202
+ const transformY = vue.ref(0);
9203
+ const windowHeight = vue.ref(window.innerHeight);
9204
+ const isVcScrollerWheel = vue.computed(() => {
9205
+ return SCROLLER_WHEEL_REG.test(scroller.value?.className || "");
9206
+ });
9207
+ const currentStyle = vue.computed(() => {
9208
+ if (!isActive.value) return {};
9209
+ return {
9210
+ height: `${currentRect.height}px`,
9211
+ width: `${currentRect.width}px`
9212
+ };
9213
+ });
9214
+ const contentStyle = vue.computed(() => {
9215
+ if (!isActive.value) return {};
9216
+ const offset = `${props2.offset}px`;
9217
+ return {
9218
+ height: `${currentRect.height}px`,
9219
+ width: `${currentRect.width}px`,
9220
+ top: props2.placement === "top" ? offset : "",
9221
+ bottom: props2.placement === "bottom" ? offset : "",
9222
+ zIndex: props2.zIndex,
9223
+ transform: transformY.value ? `translateY(${transformY.value}px)` : ""
9224
+ };
9225
+ });
9226
+ const setCurrentRect = () => {
9227
+ const rect = current.value.getBoundingClientRect();
9228
+ Object.assign(currentRect, {
9229
+ top: rect.top,
9230
+ bottom: rect.bottom,
9231
+ width: rect.width,
9232
+ height: rect.height
9233
+ });
9234
+ };
9235
+ const setAbsoluteStatus = () => {
9236
+ const {
9237
+ placement,
9238
+ offset
9239
+ } = props2;
9240
+ const currentHeightOffset = offset + currentRect.height;
9241
+ const containerRect = scroller.value.getBoundingClientRect();
9242
+ let transformOffsetY = 0;
9243
+ if (scrollerInstance && isVcScrollerWheel.value) {
9244
+ const maxMoveY = scrollerInstance.scrollHeight - scrollerInstance.clientHeight;
9245
+ transformOffsetY = scrollerInstance.scrollTop >= maxMoveY ? maxMoveY : scrollerInstance.scrollTop;
9246
+ }
9247
+ if (placement === "top") {
9248
+ isActive.value = currentRect.top - containerRect.top <= props2.offset;
9249
+ transformY.value = Math.min(containerRect.bottom - currentHeightOffset, 0) + transformOffsetY;
9250
+ } else {
9251
+ isActive.value = currentRect.bottom - containerRect.top >= containerRect.height - props2.offset;
9252
+ transformY.value = Math.max(containerRect.height - containerRect.top - currentHeightOffset, 0) + transformOffsetY;
9253
+ }
9254
+ };
9255
+ const setFixedStatus = () => {
9256
+ const {
9257
+ placement,
9258
+ target,
9259
+ offset
9260
+ } = props2;
9261
+ const currentHeightOffset = offset + currentRect.height;
9262
+ const containerRect = target && base.value.getBoundingClientRect();
9263
+ if (placement === "top") {
9264
+ if (target) {
9265
+ isActive.value = offset > currentRect.top && containerRect.bottom > 0;
9266
+ transformY.value = Math.min(containerRect.bottom - currentHeightOffset, 0);
9267
+ } else {
9268
+ isActive.value = offset > currentRect.top;
9269
+ }
9270
+ } else {
9271
+ if (target) {
9272
+ isActive.value = windowHeight.value - offset < currentRect.bottom && windowHeight.value > containerRect.top;
9273
+ transformY.value = -Math.min(windowHeight.value - containerRect.top - currentHeightOffset, 0);
9274
+ } else {
9275
+ isActive.value = windowHeight.value - offset < currentRect.bottom;
9276
+ }
9277
+ }
9278
+ };
9279
+ const refresh = () => {
9280
+ setCurrentRect();
9281
+ scroller.value instanceof Window || props2.fixed ? setFixedStatus() : setAbsoluteStatus();
9282
+ };
9283
+ vue.onMounted(() => {
9284
+ if (typeof props2.target === "string") {
9285
+ base.value = document.querySelector(props2.target) ?? void 0;
9286
+ }
9287
+ !base.value && (base.value = document.documentElement);
9288
+ scroller.value = getScroller(current.value, {
9289
+ className: SCROLLER_WHEEL_REG
9290
+ });
9291
+ if (isVcScrollerWheel.value) {
9292
+ scrollerInstance?.on(refresh);
9293
+ } else {
9294
+ scroller.value?.addEventListener("scroll", refresh);
9295
+ }
9296
+ refresh();
9297
+ });
9298
+ vue.onBeforeUnmount(() => {
9299
+ if (isVcScrollerWheel.value) {
9300
+ scrollerInstance?.off(refresh);
9301
+ } else {
9302
+ scroller.value?.removeEventListener("scroll", refresh);
9303
+ }
9304
+ });
9305
+ expose({
9306
+ refresh
9307
+ });
9308
+ return () => {
9309
+ return vue.createVNode("div", {
9310
+ "ref": current,
9311
+ "class": "vc-affix",
9312
+ "style": currentStyle.value
9313
+ }, [vue.createVNode("div", {
9314
+ "class": {
9315
+ [`vc-affix__${props2.fixed ? "fixed" : "absolute"}`]: isActive.value
9316
+ },
9317
+ "style": contentStyle.value
9318
+ }, [slots?.default?.({
9319
+ active: isActive.value
9320
+ })])]);
9321
+ };
9322
+ }
9323
+ });
9324
+ const MAffix = Affix;
9167
9325
  const props$1r = {
9168
9326
  modelValue: {
9169
9327
  type: Boolean,
@@ -9832,7 +9990,7 @@
9832
9990
  });
9833
9991
  const COMPONENT_NAME$1$ = "vc-alert";
9834
9992
  const THEME_MAP = {
9835
- info: ["#2B72FD", "#91d5ff", "#e6f7ff"],
9993
+ info: ["#456CF6", "#91d5ff", "#e6f7ff"],
9836
9994
  success: ["#52c41a", "#b7eb8f", "#f6ffed"],
9837
9995
  error: ["#ed4014", "#ffb08f", "#fbe9e9"],
9838
9996
  warning: ["#ffbf00", "#ffe58f", "#fffbe6"]
@@ -17729,6 +17887,7 @@
17729
17887
  refreshSize();
17730
17888
  refreshPosition(options);
17731
17889
  };
17890
+ const listeners = [];
17732
17891
  const triggerScrollDelegate = (options) => {
17733
17892
  const delegates = {
17734
17893
  scrollLeft: (options && options.x) ?? scrollX.value,
@@ -17736,12 +17895,15 @@
17736
17895
  clientWidth: wrapperW.value,
17737
17896
  clientHeight: wrapperH.value,
17738
17897
  scrollWidth: contentW.value,
17739
- scrollHeight: contentH.value
17898
+ scrollHeight: contentH.value,
17899
+ getBoundingClientRect: () => wrapper.value?.getBoundingClientRect()
17740
17900
  };
17741
- instance.emit("scroll", {
17901
+ const e = {
17742
17902
  target: delegates,
17743
17903
  currentTarget: delegates
17744
- });
17904
+ };
17905
+ instance.emit("scroll", e);
17906
+ listeners.forEach((listener) => listener(e));
17745
17907
  };
17746
17908
  const scrollTo = (options) => {
17747
17909
  refreshPosition(options);
@@ -17768,8 +17930,9 @@
17768
17930
  Resize.off(wrapper.value, refresh);
17769
17931
  Resize.off(content.value, refresh);
17770
17932
  }
17933
+ listeners.splice(0, listeners.length);
17771
17934
  });
17772
- expose({
17935
+ const exposed = {
17773
17936
  wrapper,
17774
17937
  content,
17775
17938
  scrollTo,
@@ -17785,8 +17948,16 @@
17785
17948
  },
17786
17949
  setScrollLeft: (value) => {
17787
17950
  scrollTo({ x: value });
17951
+ },
17952
+ on: (listener) => {
17953
+ listeners.push(listener);
17954
+ },
17955
+ off: (listener) => {
17956
+ listeners.splice(listeners.indexOf(listener), 1);
17788
17957
  }
17789
- });
17958
+ };
17959
+ expose(exposed);
17960
+ vue.provide("vc-scroller", vue.reactive(exposed));
17790
17961
  return {
17791
17962
  bar,
17792
17963
  wrapper,
@@ -23099,7 +23270,7 @@
23099
23270
  color: {
23100
23271
  type: [Object, String],
23101
23272
  default: () => ({
23102
- normal: "#2B72FD",
23273
+ normal: "#456CF6",
23103
23274
  success: "#52c41a",
23104
23275
  error: "#f5222d"
23105
23276
  })
@@ -27824,6 +27995,7 @@
27824
27995
  emit("update:modelValue", currentValue.value);
27825
27996
  emit("change", currentValue.value);
27826
27997
  emit("click", currentValue.value);
27998
+ nav.anchor && document.querySelector(nav.anchor)?.scrollIntoView?.({ behavior: "smooth" });
27827
27999
  };
27828
28000
  const handleResize = () => {
27829
28001
  if (instance.isUnmounted) return;
@@ -28053,12 +28225,16 @@
28053
28225
  });
28054
28226
  const props$b = {
28055
28227
  value: {
28056
- type: [String, Number, Boolean]
28228
+ type: [String, Number, Boolean],
28229
+ default: void 0
28057
28230
  },
28058
28231
  label: {
28059
28232
  type: [String, Function],
28060
28233
  default: ""
28061
28234
  },
28235
+ anchor: {
28236
+ type: String
28237
+ },
28062
28238
  /**
28063
28239
  * 服务端渲染时,lazy设置为false,可以把内容渲染出来;
28064
28240
  * 不能设置为!IS_SERVER, 会影响客服端激活,不一样会存在问题
@@ -28359,7 +28535,7 @@
28359
28535
  "class": [{
28360
28536
  "is-fixed": isFixed
28361
28537
  }, "vcm-tabs__bar"]
28362
- }, [vue.createVNode("slot", {
28538
+ }, [vue.createVNode(vue.resolveComponent("slot"), {
28363
28539
  "name": "prepend"
28364
28540
  }, null), slots.prepend?.(), props2.showStep && tabs.scrollable.value && vue.createVNode("div", {
28365
28541
  "class": "vcm-tabs__step is-left",
@@ -28468,6 +28644,10 @@
28468
28644
  default: (props$) => {
28469
28645
  return props$.value;
28470
28646
  }
28647
+ },
28648
+ theme: {
28649
+ type: String,
28650
+ default: "dark"
28471
28651
  }
28472
28652
  };
28473
28653
  const COMPONENT_NAME$e = "vc-text";
@@ -28517,7 +28697,7 @@
28517
28697
  // 确保不重复创建
28518
28698
  triggerEl: e.target,
28519
28699
  hover: true,
28520
- theme: "dark",
28700
+ theme: props2.theme,
28521
28701
  placement: props2.placement,
28522
28702
  portalClass: props2.portalClass,
28523
28703
  portalStyle: [props2.portalStyle || `width: ${e.target.clientWidth}px`, "word-break: break-all"],
@@ -31404,6 +31584,8 @@
31404
31584
  const Components = {
31405
31585
  ActionSheet,
31406
31586
  MActionSheet,
31587
+ Affix,
31588
+ MAffix,
31407
31589
  Alert,
31408
31590
  MAlert,
31409
31591
  Artboard,
@@ -34729,10 +34911,10 @@
34729
34911
  var _v1 = create$2();
34730
34912
  var _v2 = create$2();
34731
34913
  function isAroundZero$1(val) {
34732
- return val > -1e-8 && val < EPSILON$4;
34914
+ return val > -EPSILON$4 && val < EPSILON$4;
34733
34915
  }
34734
34916
  function isNotAroundZero$1(val) {
34735
- return val > EPSILON$4 || val < -1e-8;
34917
+ return val > EPSILON$4 || val < -EPSILON$4;
34736
34918
  }
34737
34919
  function cubicAt(p0, p1, p2, p3, t) {
34738
34920
  var onet = 1 - t;
@@ -35719,7 +35901,7 @@
35719
35901
  }
35720
35902
  var EPSILON$3 = 1e-4;
35721
35903
  function isAroundZero(transform) {
35722
- return transform < EPSILON$3 && transform > -1e-4;
35904
+ return transform < EPSILON$3 && transform > -EPSILON$3;
35723
35905
  }
35724
35906
  function round3(transform) {
35725
35907
  return mathRound$1(transform * 1e3) / 1e3;
@@ -37000,7 +37182,7 @@
37000
37182
  var mIdentity = identity;
37001
37183
  var EPSILON$2 = 5e-5;
37002
37184
  function isNotAroundZero(val) {
37003
- return val > EPSILON$2 || val < -5e-5;
37185
+ return val > EPSILON$2 || val < -EPSILON$2;
37004
37186
  }
37005
37187
  var scaleTmp = [];
37006
37188
  var tmpTransform = [];
@@ -37718,7 +37900,7 @@
37718
37900
  this.markRedraw();
37719
37901
  if (!useHoverLayer && this.__inHover) {
37720
37902
  this._toggleHoverLayerFlag(false);
37721
- this.__dirty &= -2;
37903
+ this.__dirty &= ~REDRAW_BIT;
37722
37904
  }
37723
37905
  return state;
37724
37906
  };
@@ -37776,7 +37958,7 @@
37776
37958
  this.markRedraw();
37777
37959
  if (!useHoverLayer && this.__inHover) {
37778
37960
  this._toggleHoverLayerFlag(false);
37779
- this.__dirty &= -2;
37961
+ this.__dirty &= ~REDRAW_BIT;
37780
37962
  }
37781
37963
  }
37782
37964
  };
@@ -39099,7 +39281,7 @@
39099
39281
  * @return {boolean}
39100
39282
  */
39101
39283
  function isRadianAroundZero(val) {
39102
- return val > -1e-4 && val < RADIAN_EPSILON;
39284
+ return val > -RADIAN_EPSILON && val < RADIAN_EPSILON;
39103
39285
  }
39104
39286
  // eslint-disable-next-line
39105
39287
  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
@@ -40693,7 +40875,7 @@
40693
40875
  return !!(this.__dirty & STYLE_CHANGED_BIT);
40694
40876
  };
40695
40877
  Displayable.prototype.styleUpdated = function () {
40696
- this.__dirty &= -3;
40878
+ this.__dirty &= ~STYLE_CHANGED_BIT;
40697
40879
  };
40698
40880
  Displayable.prototype.createStyle = function (obj) {
40699
40881
  return createObject(DEFAULT_COMMON_STYLE, obj);
@@ -42202,7 +42384,7 @@
42202
42384
  };
42203
42385
  Path.prototype.buildPath = function (ctx, shapeCfg, inBatch) { };
42204
42386
  Path.prototype.pathUpdated = function () {
42205
- this.__dirty &= -5;
42387
+ this.__dirty &= ~SHAPE_CHANGED_BIT;
42206
42388
  };
42207
42389
  Path.prototype.getUpdatedPathProxy = function (inBatch) {
42208
42390
  !this.path && this.createPathProxy();
@@ -54788,7 +54970,7 @@
54788
54970
  function brush$1(ctx, el, scope, isLast) {
54789
54971
  var m = el.transform;
54790
54972
  if (!el.shouldBePainted(scope.viewWidth, scope.viewHeight, false, false)) {
54791
- el.__dirty &= -2;
54973
+ el.__dirty &= ~REDRAW_BIT;
54792
54974
  el.__isRendered = false;
54793
54975
  return;
54794
54976
  }
@@ -113057,7 +113239,7 @@
113057
113239
  // and velocity is close to 0
113058
113240
  //
113059
113241
 
113060
- if (velocity.x < -0.5 && currentSlideVisibilityRatio < 0 || velocity.x < 0.1 && currentSlideVisibilityRatio < -0.5) {
113242
+ if (velocity.x < -MIN_NEXT_SLIDE_SPEED && currentSlideVisibilityRatio < 0 || velocity.x < 0.1 && currentSlideVisibilityRatio < -0.5) {
113061
113243
  // Go to next slide
113062
113244
  indexDiff = 1;
113063
113245
  velocity.x = Math.min(velocity.x, 0);
@@ -113121,7 +113303,7 @@
113121
113303
  // or if we are below and moving downwards
113122
113304
 
113123
113305
 
113124
- if (vDragRatio < 0 && projectedVDragRatio < -0.4 || vDragRatio > 0 && projectedVDragRatio > MIN_RATIO_TO_CLOSE) {
113306
+ if (vDragRatio < 0 && projectedVDragRatio < -MIN_RATIO_TO_CLOSE || vDragRatio > 0 && projectedVDragRatio > MIN_RATIO_TO_CLOSE) {
113125
113307
  this.pswp.close();
113126
113308
  return;
113127
113309
  }
@@ -131839,6 +132021,7 @@
131839
132021
  }, Symbol.toStringTag, { value: 'Module' }));
131840
132022
 
131841
132023
  exports.ActionSheet = ActionSheet;
132024
+ exports.Affix = Affix;
131842
132025
  exports.Alert = Alert;
131843
132026
  exports.Artboard = Artboard;
131844
132027
  exports.Button = Button;
@@ -131884,6 +132067,7 @@
131884
132067
  exports.List = MList;
131885
132068
  exports.ListItem = MListItem;
131886
132069
  exports.MActionSheet = MActionSheet;
132070
+ exports.MAffix = MAffix;
131887
132071
  exports.MAlert = MAlert;
131888
132072
  exports.MArtboard = MArtboard;
131889
132073
  exports.MButton = MButton;