@1337exp/taoui 1.3.3 → 1.3.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/dist/index.d.ts CHANGED
@@ -401,6 +401,8 @@ showValue?: boolean;
401
401
  placeholder?: string;
402
402
  modelValue: number | string;
403
403
  disabled?: boolean;
404
+ /** `medium` — форм-контрол. `small` — тонкий трек (seek, громкость). */
405
+ size?: "small" | "medium";
404
406
  }>, {
405
407
  min: number;
406
408
  max: number;
@@ -408,6 +410,7 @@ step: number;
408
410
  showValue: boolean;
409
411
  placeholder: string;
410
412
  disabled: boolean;
413
+ size: string;
411
414
  }>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
412
415
  "update:modelValue": (...args: any[]) => void;
413
416
  }, string, PublicProps, Readonly<ExtractPropTypes<__VLS_WithDefaults_27<__VLS_TypePropsToRuntimeProps_28<{
@@ -418,6 +421,8 @@ showValue?: boolean;
418
421
  placeholder?: string;
419
422
  modelValue: number | string;
420
423
  disabled?: boolean;
424
+ /** `medium` — форм-контрол. `small` — тонкий трек (seek, громкость). */
425
+ size?: "small" | "medium";
421
426
  }>, {
422
427
  min: number;
423
428
  max: number;
@@ -425,9 +430,11 @@ step: number;
425
430
  showValue: boolean;
426
431
  placeholder: string;
427
432
  disabled: boolean;
433
+ size: string;
428
434
  }>>> & Readonly<{
429
435
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
430
436
  }>, {
437
+ size: "small" | "medium";
431
438
  disabled: boolean;
432
439
  max: number;
433
440
  step: number;
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { defineComponent, openBlock, createElementBlock, normalizeClass, createCommentVNode, toDisplayString, createElementVNode, renderSlot, computed, normalizeStyle, inject, useId, ref, unref, watch, onBeforeUnmount, createBlock, Teleport, createVNode, Transition, withCtx, withModifiers, nextTick, Fragment, renderList, createTextVNode, provide, onMounted, resolveDynamicComponent, useCssVars, reactive, onBeforeMount, useSlots, withDirectives, vModelText, resolveComponent, mergeProps, TransitionGroup, onUpdated, createApp } from "vue";
1
+ import { defineComponent, openBlock, createElementBlock, normalizeClass, createCommentVNode, toDisplayString, createElementVNode, renderSlot, computed, normalizeStyle, inject, useId, ref, unref, watch, onBeforeUnmount, createBlock, Teleport, createVNode, Transition, withCtx, withModifiers, nextTick, Fragment, renderList, createTextVNode, onMounted, provide, resolveDynamicComponent, useCssVars, reactive, onBeforeMount, useSlots, withDirectives, vModelText, getCurrentInstance, mergeProps, TransitionGroup, onUpdated, createApp } from "vue";
2
2
  const _hoisted_1$J = ["type", "disabled"];
3
3
  const _hoisted_2$C = {
4
4
  key: 0,
@@ -62,7 +62,7 @@ const _export_sfc = (sfc, props) => {
62
62
  }
63
63
  return target;
64
64
  };
65
- const TaoButton = /* @__PURE__ */ _export_sfc(_sfc_main$S, [["__scopeId", "data-v-5a0fd489"]]);
65
+ const TaoButton = /* @__PURE__ */ _export_sfc(_sfc_main$S, [["__scopeId", "data-v-085cd74d"]]);
66
66
  const _sfc_main$R = /* @__PURE__ */ defineComponent({
67
67
  ...{ name: "TaoBlock" },
68
68
  __name: "TaoBlock",
@@ -965,6 +965,21 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
965
965
  }
966
966
  });
967
967
  const TaoTabs = /* @__PURE__ */ _export_sfc(_sfc_main$K, [["__scopeId", "data-v-bf16735e"]]);
968
+ function listenFocusLoss(onLoss) {
969
+ function onVisibilityChange() {
970
+ if (document.hidden) {
971
+ onLoss();
972
+ }
973
+ }
974
+ document.addEventListener("visibilitychange", onVisibilityChange);
975
+ window.addEventListener("blur", onLoss);
976
+ window.addEventListener("pagehide", onLoss);
977
+ return () => {
978
+ document.removeEventListener("visibilitychange", onVisibilityChange);
979
+ window.removeEventListener("blur", onLoss);
980
+ window.removeEventListener("pagehide", onLoss);
981
+ };
982
+ }
968
983
  const _sfc_main$J = /* @__PURE__ */ defineComponent({
969
984
  ...{ name: "TaoTooltip" },
970
985
  __name: "TaoTooltip",
@@ -974,6 +989,14 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
974
989
  },
975
990
  setup(__props) {
976
991
  const showTooltip = ref(false);
992
+ function hide() {
993
+ showTooltip.value = false;
994
+ }
995
+ let stopFocusLoss;
996
+ onMounted(() => {
997
+ stopFocusLoss = listenFocusLoss(hide);
998
+ });
999
+ onBeforeUnmount(() => stopFocusLoss == null ? void 0 : stopFocusLoss());
977
1000
  return (_ctx, _cache) => {
978
1001
  return openBlock(), createElementBlock("div", {
979
1002
  class: "tao-tooltip-wrapper",
@@ -997,7 +1020,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
997
1020
  };
998
1021
  }
999
1022
  });
1000
- const TaoTooltip = /* @__PURE__ */ _export_sfc(_sfc_main$J, [["__scopeId", "data-v-6f3b3c11"]]);
1023
+ const TaoTooltip = /* @__PURE__ */ _export_sfc(_sfc_main$J, [["__scopeId", "data-v-fa4a9dac"]]);
1001
1024
  const _hoisted_1$B = { class: "tao-popover" };
1002
1025
  const _sfc_main$I = /* @__PURE__ */ defineComponent({
1003
1026
  ...{ name: "TaoPopover" },
@@ -2259,7 +2282,8 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
2259
2282
  showValue: { type: Boolean, default: false },
2260
2283
  placeholder: { default: "" },
2261
2284
  modelValue: {},
2262
- disabled: { type: Boolean, default: false }
2285
+ disabled: { type: Boolean, default: false },
2286
+ size: { default: "medium" }
2263
2287
  },
2264
2288
  emits: ["update:modelValue"],
2265
2289
  setup(__props, { emit: __emit }) {
@@ -2279,6 +2303,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
2279
2303
  const current = computed(() => unpackModelValue());
2280
2304
  const trackRef = ref(null);
2281
2305
  const isDragging = ref(false);
2306
+ let dragPointer = -1;
2282
2307
  const shadowInputRef = ref(null);
2283
2308
  const shadowModel = ref("0");
2284
2309
  const showShadowModel = ref(false);
@@ -2300,42 +2325,63 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
2300
2325
  return props.min;
2301
2326
  }
2302
2327
  const rect = trackRef.value.getBoundingClientRect();
2303
- const clientX = "touches" in event ? event.touches[0].clientX : event.clientX;
2304
- const x = Math.min(Math.max(clientX - rect.left, 0), rect.width);
2328
+ const x = Math.min(Math.max(event.clientX - rect.left, 0), rect.width);
2305
2329
  const ratio = rect.width ? x / rect.width : 0;
2306
2330
  const v = props.min + ratio * (props.max - props.min);
2307
2331
  return clampValue(Math.round((v - props.min) / props.step) * props.step + props.min);
2308
2332
  }
2309
- function handleMove(event) {
2310
- if (props.disabled) {
2333
+ function releaseDragCapture() {
2334
+ const el = trackRef.value;
2335
+ const id = dragPointer;
2336
+ if (!el || id === -1) {
2311
2337
  return;
2312
2338
  }
2313
- commit(calculateValue(event));
2314
- }
2315
- function onMouseUp(event) {
2316
- const evBtn = "touches" in event ? void 0 : event.button;
2317
- if (typeof evBtn !== "undefined" && evBtn !== 0 || showShadowModel.value) {
2339
+ if (typeof el.hasPointerCapture === "function" && !el.hasPointerCapture(id)) {
2318
2340
  return;
2319
2341
  }
2320
- isDragging.value = false;
2342
+ try {
2343
+ el.releasePointerCapture(id);
2344
+ } catch {
2345
+ }
2321
2346
  }
2322
- function onMouseDown(event) {
2323
- if (props.disabled) {
2347
+ function endDrag() {
2348
+ if (!isDragging.value) {
2324
2349
  return;
2325
2350
  }
2326
- const evBtn = "touches" in event ? void 0 : event.button;
2327
- if (typeof evBtn !== "undefined" && evBtn !== 0 || showShadowModel.value) {
2351
+ isDragging.value = false;
2352
+ releaseDragCapture();
2353
+ dragPointer = -1;
2354
+ }
2355
+ function onPointerDown(event) {
2356
+ if (props.disabled || showShadowModel.value || event.button !== 0 || !trackRef.value) {
2328
2357
  return;
2329
2358
  }
2359
+ dragPointer = event.pointerId;
2330
2360
  isDragging.value = true;
2331
- handleMove(event);
2361
+ commit(calculateValue(event));
2332
2362
  event.preventDefault();
2363
+ try {
2364
+ trackRef.value.setPointerCapture(event.pointerId);
2365
+ } catch {
2366
+ }
2367
+ }
2368
+ function onPointerMove(event) {
2369
+ if (!isDragging.value || event.pointerId !== dragPointer) {
2370
+ return;
2371
+ }
2372
+ commit(calculateValue(event));
2333
2373
  }
2334
- function onMouseMove(event) {
2374
+ function onPointerEnd(event) {
2335
2375
  if (!isDragging.value) {
2336
2376
  return;
2337
2377
  }
2338
- handleMove(event);
2378
+ if (dragPointer !== -1 && event.pointerId !== dragPointer) {
2379
+ return;
2380
+ }
2381
+ endDrag();
2382
+ }
2383
+ function onLostPointerCapture() {
2384
+ endDrag();
2339
2385
  }
2340
2386
  function onKeydown(event) {
2341
2387
  if (props.disabled || showShadowModel.value) {
@@ -2389,26 +2435,23 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
2389
2435
  return (_a = shadowInputRef.value) == null ? void 0 : _a.focus();
2390
2436
  });
2391
2437
  }
2438
+ let stopFocusLoss;
2392
2439
  onMounted(() => {
2393
- window.addEventListener("mouseleave", onMouseUp);
2394
- window.addEventListener("mouseup", onMouseUp);
2395
- window.addEventListener("mousemove", onMouseMove);
2396
- window.addEventListener("touchend", onMouseUp);
2397
- window.addEventListener("touchmove", onMouseMove);
2440
+ stopFocusLoss = listenFocusLoss(endDrag);
2398
2441
  });
2399
2442
  onBeforeUnmount(() => {
2400
- window.removeEventListener("mouseleave", onMouseUp);
2401
- window.removeEventListener("mouseup", onMouseUp);
2402
- window.removeEventListener("mousemove", onMouseMove);
2403
- window.removeEventListener("touchend", onMouseUp);
2404
- window.removeEventListener("touchmove", onMouseMove);
2443
+ endDrag();
2444
+ stopFocusLoss == null ? void 0 : stopFocusLoss();
2405
2445
  });
2406
2446
  return (_ctx, _cache) => {
2407
2447
  return openBlock(), createElementBlock("div", {
2408
2448
  id: controlId.value,
2409
2449
  ref_key: "trackRef",
2410
2450
  ref: trackRef,
2411
- class: normalizeClass(["tao-slider", { "tao-slider--show-value": __props.showValue, "tao-slider--disabled": __props.disabled }]),
2451
+ class: normalizeClass(["tao-slider", [
2452
+ `tao-slider--${__props.size}`,
2453
+ { "tao-slider--show-value": __props.showValue, "tao-slider--disabled": __props.disabled }
2454
+ ]]),
2412
2455
  role: "slider",
2413
2456
  tabindex: __props.disabled ? -1 : 0,
2414
2457
  "aria-valuemin": __props.min,
@@ -2417,8 +2460,11 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
2417
2460
  "aria-disabled": __props.disabled || void 0,
2418
2461
  "aria-describedby": describedBy.value,
2419
2462
  onContextmenu: withModifiers(onContextMenu, ["prevent"]),
2420
- onMousedown: onMouseDown,
2421
- onTouchstart: onMouseDown,
2463
+ onPointerdown: onPointerDown,
2464
+ onPointermove: onPointerMove,
2465
+ onPointerup: onPointerEnd,
2466
+ onPointercancel: onPointerEnd,
2467
+ onLostpointercapture: onLostPointerCapture,
2422
2468
  onKeydown
2423
2469
  }, [
2424
2470
  _cache[2] || (_cache[2] = createElementVNode("div", { class: "tao-slider__track" }, null, -1)),
@@ -2441,7 +2487,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
2441
2487
  class: "tao-slider__shadow-input",
2442
2488
  onBlur: onBlurShadowModel,
2443
2489
  onKeydown: onShadowKeydown,
2444
- onMousedown: _cache[1] || (_cache[1] = withModifiers(() => {
2490
+ onPointerdown: _cache[1] || (_cache[1] = withModifiers(() => {
2445
2491
  }, ["stop"]))
2446
2492
  }, null, 40, _hoisted_2$m)), [
2447
2493
  [vModelText, shadowModel.value]
@@ -2454,7 +2500,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
2454
2500
  };
2455
2501
  }
2456
2502
  });
2457
- const TaoSlider = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["__scopeId", "data-v-241d1042"]]);
2503
+ const TaoSlider = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["__scopeId", "data-v-24a38782"]]);
2458
2504
  const _hoisted_1$o = { class: "tao-file-drop" };
2459
2505
  const _hoisted_2$l = { class: "tao-file-drop__row" };
2460
2506
  const _hoisted_3$i = ["accept", "multiple"];
@@ -2556,6 +2602,13 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
2556
2602
  function fileKey(file, index) {
2557
2603
  return `${file.name}-${file.size}-${file.lastModified}-${index}`;
2558
2604
  }
2605
+ let stopFocusLoss;
2606
+ onMounted(() => {
2607
+ stopFocusLoss = listenFocusLoss(() => {
2608
+ isDragging.value = false;
2609
+ });
2610
+ });
2611
+ onBeforeUnmount(() => stopFocusLoss == null ? void 0 : stopFocusLoss());
2559
2612
  return (_ctx, _cache) => {
2560
2613
  return openBlock(), createElementBlock("div", _hoisted_1$o, [
2561
2614
  createElementVNode("div", _hoisted_2$l, [
@@ -2609,7 +2662,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
2609
2662
  };
2610
2663
  }
2611
2664
  });
2612
- const TaoFileDrop = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__scopeId", "data-v-fbd848b0"]]);
2665
+ const TaoFileDrop = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__scopeId", "data-v-f97c4e91"]]);
2613
2666
  const _hoisted_1$n = ["aria-expanded"];
2614
2667
  const _hoisted_2$k = {
2615
2668
  key: 1,
@@ -2974,15 +3027,15 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
2974
3027
  exactPath: { type: Boolean, default: false }
2975
3028
  },
2976
3029
  setup(__props) {
3030
+ var _a;
2977
3031
  const props = __props;
2978
- const linkComponent = computed(() => {
2979
- const resolved = resolveComponent("NuxtLink");
2980
- return typeof resolved === "string" ? "a" : resolved;
2981
- });
3032
+ const globals = ((_a = getCurrentInstance()) == null ? void 0 : _a.appContext.components) ?? {};
3033
+ const linkKind = globals.NuxtLink ? "nuxt" : globals.RouterLink ? "router" : "a";
3034
+ const linkComponent = linkKind === "nuxt" ? globals.NuxtLink : linkKind === "router" ? globals.RouterLink : "a";
2982
3035
  const linkProps = computed(() => {
2983
3036
  const target = props.asNewTab ? "_blank" : void 0;
2984
3037
  const rel = props.private && "noopener noreferrer" || props.asNewTab && "noopener" || void 0;
2985
- if (linkComponent.value === "a") {
3038
+ if (linkKind === "a") {
2986
3039
  return {
2987
3040
  href: typeof props.to === "string" ? props.to : void 0,
2988
3041
  target,
@@ -2993,11 +3046,11 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
2993
3046
  to: props.to,
2994
3047
  target,
2995
3048
  rel,
2996
- exactPath: props.exactPath
3049
+ ...linkKind === "nuxt" ? { exactPath: props.exactPath } : {}
2997
3050
  };
2998
3051
  });
2999
3052
  return (_ctx, _cache) => {
3000
- return openBlock(), createBlock(resolveDynamicComponent(linkComponent.value), mergeProps(linkProps.value, { draggable: "false" }), {
3053
+ return openBlock(), createBlock(resolveDynamicComponent(unref(linkComponent)), mergeProps(linkProps.value, { draggable: "false" }), {
3001
3054
  default: withCtx(() => [
3002
3055
  renderSlot(_ctx.$slots, "default")
3003
3056
  ]),
@@ -3698,7 +3751,14 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
3698
3751
  window.removeEventListener("resize", onViewportChange);
3699
3752
  window.removeEventListener("scroll", onViewportChange, true);
3700
3753
  });
3754
+ let stopFocusLoss;
3755
+ onMounted(() => {
3756
+ stopFocusLoss = listenFocusLoss(() => {
3757
+ picking.value = false;
3758
+ });
3759
+ });
3701
3760
  onBeforeUnmount(() => {
3761
+ stopFocusLoss == null ? void 0 : stopFocusLoss();
3702
3762
  document.removeEventListener("pointerdown", onDocumentPointer);
3703
3763
  window.removeEventListener("resize", onViewportChange);
3704
3764
  window.removeEventListener("scroll", onViewportChange, true);
@@ -3802,7 +3862,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
3802
3862
  };
3803
3863
  }
3804
3864
  });
3805
- const TaoCombobox = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["__scopeId", "data-v-adeb76a4"]]);
3865
+ const TaoCombobox = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["__scopeId", "data-v-60be67d0"]]);
3806
3866
  const ISO_DATE = /^(\d{4})-(\d{2})-(\d{2})$/;
3807
3867
  function formatTaoDateIso(parts) {
3808
3868
  return `${String(parts.y).padStart(4, "0")}-${String(parts.m).padStart(2, "0")}-${String(parts.d).padStart(2, "0")}`;
@@ -4578,7 +4638,14 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
4578
4638
  window.removeEventListener("resize", onViewportChange);
4579
4639
  window.removeEventListener("scroll", onViewportChange, true);
4580
4640
  });
4641
+ let stopFocusLoss;
4642
+ onMounted(() => {
4643
+ stopFocusLoss = listenFocusLoss(() => {
4644
+ hoverIso.value = null;
4645
+ });
4646
+ });
4581
4647
  onBeforeUnmount(() => {
4648
+ stopFocusLoss == null ? void 0 : stopFocusLoss();
4582
4649
  document.removeEventListener("pointerdown", onDocumentPointer);
4583
4650
  window.removeEventListener("resize", onViewportChange);
4584
4651
  window.removeEventListener("scroll", onViewportChange, true);
@@ -4749,7 +4816,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
4749
4816
  };
4750
4817
  }
4751
4818
  });
4752
- const TaoDateRange = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-4e222262"]]);
4819
+ const TaoDateRange = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-3d067081"]]);
4753
4820
  const _hoisted_1$g = ["for"];
4754
4821
  const _hoisted_2$e = ["id", "checked", "disabled", "aria-checked"];
4755
4822
  const _hoisted_3$c = {
@@ -5982,10 +6049,13 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
5982
6049
  }
5983
6050
  function onWindowBlur() {
5984
6051
  endDrag();
6052
+ hoverPaused.value = false;
6053
+ syncAutoplay();
5985
6054
  }
5986
6055
  function onVisibilityChange() {
5987
6056
  if (document.hidden) {
5988
6057
  endDrag();
6058
+ hoverPaused.value = false;
5989
6059
  }
5990
6060
  syncAutoplay();
5991
6061
  }
@@ -6157,7 +6227,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
6157
6227
  };
6158
6228
  }
6159
6229
  });
6160
- const TaoCarousel = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-81afb8b0"]]);
6230
+ const TaoCarousel = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-4f6de725"]]);
6161
6231
  const _hoisted_1$3 = ["aria-label"];
6162
6232
  const _hoisted_2$2 = ["aria-label"];
6163
6233
  const _hoisted_3$2 = {
@@ -6465,7 +6535,12 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
6465
6535
  close();
6466
6536
  }
6467
6537
  startTimer();
6538
+ let stopFocusLoss;
6539
+ onMounted(() => {
6540
+ stopFocusLoss = listenFocusLoss(resume);
6541
+ });
6468
6542
  onBeforeUnmount(() => {
6543
+ stopFocusLoss == null ? void 0 : stopFocusLoss();
6469
6544
  clearTimer();
6470
6545
  });
6471
6546
  return (_ctx, _cache) => {
@@ -6590,7 +6665,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
6590
6665
  };
6591
6666
  }
6592
6667
  });
6593
- const TaoToastItem = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-c8a329f5"]]);
6668
+ const TaoToastItem = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-7c4692c0"]]);
6594
6669
  const _hoisted_1$1 = { class: "tao-toast-slot__inner" };
6595
6670
  const _sfc_main$1 = /* @__PURE__ */ defineComponent({
6596
6671
  ...{ name: "TaoToastViewport" },