@1337exp/taoui 1.10.3 → 1.11.0

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.d.ts CHANGED
@@ -606,6 +606,8 @@ modelValue: number | string;
606
606
  disabled?: boolean;
607
607
  /** `medium` — форм-контрол. `small` — тонкий трек (seek, громкость). */
608
608
  size?: "small" | "medium";
609
+ /** Шаг изменения значения при прокрутке колёсика мыши. 0 — отключено. */
610
+ wheel?: number;
609
611
  }>, {
610
612
  min: number;
611
613
  max: number;
@@ -614,6 +616,7 @@ showValue: boolean;
614
616
  placeholder: string;
615
617
  disabled: boolean;
616
618
  size: string;
619
+ wheel: number;
617
620
  }>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
618
621
  "update:modelValue": (...args: any[]) => void;
619
622
  }, string, PublicProps, Readonly<ExtractPropTypes<__VLS_WithDefaults_29<__VLS_TypePropsToRuntimeProps_31<{
@@ -626,6 +629,8 @@ modelValue: number | string;
626
629
  disabled?: boolean;
627
630
  /** `medium` — форм-контрол. `small` — тонкий трек (seek, громкость). */
628
631
  size?: "small" | "medium";
632
+ /** Шаг изменения значения при прокрутке колёсика мыши. 0 — отключено. */
633
+ wheel?: number;
629
634
  }>, {
630
635
  min: number;
631
636
  max: number;
@@ -634,6 +639,7 @@ showValue: boolean;
634
639
  placeholder: string;
635
640
  disabled: boolean;
636
641
  size: string;
642
+ wheel: number;
637
643
  }>>> & Readonly<{
638
644
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
639
645
  }>, {
@@ -642,6 +648,7 @@ disabled: boolean;
642
648
  max: number;
643
649
  step: number;
644
650
  placeholder: string;
651
+ wheel: number;
645
652
  min: number;
646
653
  showValue: boolean;
647
654
  }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
@@ -1545,7 +1552,7 @@ peek?: number;
1545
1552
  /** How many slides fit in the viewport. 5 = product strip. 1 = one card. */
1546
1553
  perView?: number;
1547
1554
  controls?: boolean;
1548
- /** Interval in ms. 0 — off. Pauses on hover, focus, drag, and reduced motion. */
1555
+ /** Interval in ms. 0 — off. Pauses on hover, keyboard focus, drag, and reduced motion. */
1549
1556
  autoplay?: number;
1550
1557
  loop?: boolean;
1551
1558
  /** Pips under the track: one per snap. Inactive are dots, the current one stretches into a pill. */
@@ -1578,7 +1585,7 @@ peek?: number;
1578
1585
  /** How many slides fit in the viewport. 5 = product strip. 1 = one card. */
1579
1586
  perView?: number;
1580
1587
  controls?: boolean;
1581
- /** Interval in ms. 0 — off. Pauses on hover, focus, drag, and reduced motion. */
1588
+ /** Interval in ms. 0 — off. Pauses on hover, keyboard focus, drag, and reduced motion. */
1582
1589
  autoplay?: number;
1583
1590
  loop?: boolean;
1584
1591
  /** Pips under the track: one per snap. Inactive are dots, the current one stretches into a pill. */
package/dist/index.mjs CHANGED
@@ -2414,7 +2414,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
2414
2414
  };
2415
2415
  }
2416
2416
  });
2417
- const TaoCheckbox = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__scopeId", "data-v-f6b0e565"]]);
2417
+ const TaoCheckbox = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__scopeId", "data-v-bb1ea2fb"]]);
2418
2418
  const _hoisted_1$z = {
2419
2419
  key: 0,
2420
2420
  class: "tao-tag__prefix"
@@ -2964,7 +2964,8 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
2964
2964
  placeholder: { default: "" },
2965
2965
  modelValue: {},
2966
2966
  disabled: { type: Boolean, default: false },
2967
- size: { default: "medium" }
2967
+ size: { default: "medium" },
2968
+ wheel: { default: 0 }
2968
2969
  },
2969
2970
  emits: ["update:modelValue"],
2970
2971
  setup(__props, { emit: __emit }) {
@@ -3091,6 +3092,14 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
3091
3092
  commit(props.max);
3092
3093
  }
3093
3094
  }
3095
+ function onWheel(event) {
3096
+ if (props.disabled || props.wheel <= 0 || showShadowModel.value) {
3097
+ return;
3098
+ }
3099
+ event.preventDefault();
3100
+ const delta = event.deltaY < 0 ? props.wheel : -props.wheel;
3101
+ commit(current.value + delta);
3102
+ }
3094
3103
  function onBlurShadowModel() {
3095
3104
  if (shadowModel.value) {
3096
3105
  const newValue = packModelValue(clampValue(parseFloat(shadowModel.value) || 0));
@@ -3146,7 +3155,8 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
3146
3155
  onPointerup: onPointerEnd,
3147
3156
  onPointercancel: onPointerEnd,
3148
3157
  onLostpointercapture: onLostPointerCapture,
3149
- onKeydown
3158
+ onKeydown,
3159
+ onWheel
3150
3160
  }, [
3151
3161
  _cache[2] || (_cache[2] = createElementVNode("div", { class: "tao-slider__track" }, null, -1)),
3152
3162
  createElementVNode("div", {
@@ -3181,7 +3191,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
3181
3191
  };
3182
3192
  }
3183
3193
  });
3184
- const TaoSlider = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["__scopeId", "data-v-24a38782"]]);
3194
+ const TaoSlider = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["__scopeId", "data-v-a0a9cca1"]]);
3185
3195
  const _hoisted_1$s = { class: "tao-file-drop" };
3186
3196
  const _hoisted_2$p = { class: "tao-file-drop__row" };
3187
3197
  const _hoisted_3$k = ["aria-label"];
@@ -7256,6 +7266,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
7256
7266
  let dragMoved = 0;
7257
7267
  let dragPointer = -1;
7258
7268
  let scrollFrame = 0;
7269
+ let focusFrame = 0;
7259
7270
  let autoplayTimer = 0;
7260
7271
  const step = computed(() => Math.max(1, Math.round(props.perView)));
7261
7272
  const lastIndex = computed(() => Math.max(count.value - step.value, 0));
@@ -7364,18 +7375,32 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
7364
7375
  hoverPaused.value = false;
7365
7376
  syncAutoplay();
7366
7377
  }
7367
- function onFocusIn() {
7368
- focusPaused.value = true;
7369
- stopAutoplay();
7378
+ function hasKeyboardFocus(root) {
7379
+ const active = document.activeElement;
7380
+ if (!(active instanceof HTMLElement) || !root.contains(active)) {
7381
+ return false;
7382
+ }
7383
+ try {
7384
+ return active.matches(":focus-visible");
7385
+ } catch {
7386
+ return true;
7387
+ }
7370
7388
  }
7371
- function onFocusOut(event) {
7389
+ function scheduleFocusPause(event) {
7372
7390
  const root = event.currentTarget;
7373
- const next = event.relatedTarget;
7374
- if (next && root.contains(next)) {
7375
- return;
7376
- }
7377
- focusPaused.value = false;
7378
- syncAutoplay();
7391
+ cancelAnimationFrame(focusFrame);
7392
+ focusFrame = requestAnimationFrame(() => {
7393
+ if (!track.value) {
7394
+ return;
7395
+ }
7396
+ const next = hasKeyboardFocus(root);
7397
+ focusPaused.value = next;
7398
+ if (next) {
7399
+ stopAutoplay();
7400
+ return;
7401
+ }
7402
+ syncAutoplay();
7403
+ });
7379
7404
  }
7380
7405
  function onScroll() {
7381
7406
  if (dragging.value) {
@@ -7512,6 +7537,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
7512
7537
  onBeforeUnmount(() => {
7513
7538
  endDrag();
7514
7539
  cancelAnimationFrame(scrollFrame);
7540
+ cancelAnimationFrame(focusFrame);
7515
7541
  stopAutoplay();
7516
7542
  document.removeEventListener("visibilitychange", onVisibilityChange);
7517
7543
  window.removeEventListener("blur", onWindowBlur);
@@ -7523,8 +7549,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
7523
7549
  style: normalizeStyle(trackStyle.value),
7524
7550
  onMouseenter: onMouseEnter,
7525
7551
  onMouseleave: onMouseLeave,
7526
- onFocusin: onFocusIn,
7527
- onFocusout: onFocusOut
7552
+ onFocusin: scheduleFocusPause,
7553
+ onFocusout: scheduleFocusPause
7528
7554
  }, [
7529
7555
  createElementVNode("div", _hoisted_1$4, [
7530
7556
  renderSlot(_ctx.$slots, "prev", {
@@ -7647,7 +7673,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
7647
7673
  };
7648
7674
  }
7649
7675
  });
7650
- const TaoCarousel = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-bc396e5d"]]);
7676
+ const TaoCarousel = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-b4139b57"]]);
7651
7677
  const _hoisted_1$3 = ["aria-label"];
7652
7678
  const _hoisted_2$2 = ["aria-label"];
7653
7679
  const _hoisted_3$2 = {