@uzum-tech/ui 2.0.2 → 2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -5772,22 +5772,24 @@
5772
5772
  const instance = vue.getCurrentInstance();
5773
5773
  const config = instance ? findConfig(instance) : null;
5774
5774
  const componentRef = vue.ref(null);
5775
- const mergedProps = vue.computed(() => {
5776
- if (!config) return props;
5777
- const defaults = config.mergedComponentPropsRef?.value?.[component.name] ?? {};
5778
- return {
5779
- ...defaults,
5780
- ...props
5781
- };
5782
- });
5783
5775
  if (ctx.expose) {
5784
5776
  ctx.expose(useExposeProxy(componentRef));
5785
5777
  }
5786
- return () => vue.h(component, {
5787
- ref: componentRef,
5788
- ...mergedProps.value,
5789
- ...ctx.attrs
5790
- }, ctx.slots);
5778
+ return () => {
5779
+ let finalProps = props;
5780
+ if (config) {
5781
+ const defaults = config.mergedComponentPropsRef?.value?.[component.name] ?? {};
5782
+ finalProps = {
5783
+ ...defaults,
5784
+ ...props
5785
+ };
5786
+ }
5787
+ return vue.h(component, {
5788
+ ref: componentRef,
5789
+ ...finalProps,
5790
+ ...ctx.attrs
5791
+ }, ctx.slots);
5792
+ };
5791
5793
  }
5792
5794
  });
5793
5795
  wrapped.__wrapped__ = true;
@@ -111399,6 +111401,7 @@
111399
111401
  const notificationEnvOptions = {
111400
111402
  ...notificationProps,
111401
111403
  duration: Number,
111404
+ pauseOnVisibilityChange: Boolean,
111402
111405
  onClose: Function,
111403
111406
  onLeave: Function,
111404
111407
  onAfterEnter: Function,
@@ -111428,10 +111431,45 @@
111428
111431
  const { wipTransitionCountRef } = vue.inject(notificationProviderInjectionKey);
111429
111432
  const showRef = vue.ref(true);
111430
111433
  let timerId = null;
111434
+ let remainingDuration = null;
111435
+ let timerStartedAt = null;
111436
+ let timerPausedForVisibility = false;
111437
+ function clearTimer() {
111438
+ if (timerId !== null) {
111439
+ window.clearTimeout(timerId);
111440
+ timerId = null;
111441
+ }
111442
+ }
111431
111443
  function hide() {
111432
111444
  showRef.value = false;
111433
- if (timerId) {
111434
- window.clearTimeout(timerId);
111445
+ clearTimer();
111446
+ }
111447
+ function startTimer(duration) {
111448
+ clearTimer();
111449
+ remainingDuration = duration;
111450
+ timerStartedAt = Date.now();
111451
+ timerId = window.setTimeout(hide, duration);
111452
+ }
111453
+ function handleVisibilityChange() {
111454
+ if (document.visibilityState === "hidden") {
111455
+ if (timerId !== null) {
111456
+ clearTimer();
111457
+ if (timerStartedAt !== null && remainingDuration !== null) {
111458
+ remainingDuration = Math.max(
111459
+ 0,
111460
+ remainingDuration - (Date.now() - timerStartedAt)
111461
+ );
111462
+ }
111463
+ timerStartedAt = null;
111464
+ timerPausedForVisibility = true;
111465
+ }
111466
+ } else if (timerPausedForVisibility) {
111467
+ timerPausedForVisibility = false;
111468
+ if (remainingDuration !== null && remainingDuration > 0) {
111469
+ startTimer(remainingDuration);
111470
+ } else {
111471
+ hide();
111472
+ }
111435
111473
  }
111436
111474
  }
111437
111475
  function handleBeforeEnter(el) {
@@ -111480,16 +111518,13 @@
111480
111518
  function setHideTimeout() {
111481
111519
  const { duration } = props;
111482
111520
  if (duration) {
111483
- timerId = window.setTimeout(hide, duration);
111521
+ startTimer(duration);
111484
111522
  }
111485
111523
  }
111486
111524
  function handleMouseenter(e) {
111487
111525
  if (e.currentTarget !== e.target)
111488
111526
  return;
111489
- if (timerId !== null) {
111490
- window.clearTimeout(timerId);
111491
- timerId = null;
111492
- }
111527
+ clearTimer();
111493
111528
  }
111494
111529
  function handleMouseleave(e) {
111495
111530
  if (e.currentTarget !== e.target)
@@ -111510,9 +111545,15 @@
111510
111545
  }
111511
111546
  vue.onMounted(() => {
111512
111547
  if (props.duration) {
111513
- timerId = window.setTimeout(hide, props.duration);
111548
+ startTimer(props.duration);
111549
+ }
111550
+ if (props.pauseOnVisibilityChange) {
111551
+ document.addEventListener("visibilitychange", handleVisibilityChange);
111514
111552
  }
111515
111553
  });
111554
+ vue.onBeforeUnmount(() => {
111555
+ document.removeEventListener("visibilitychange", handleVisibilityChange);
111556
+ });
111516
111557
  return {
111517
111558
  show: showRef,
111518
111559
  hide,
@@ -111558,12 +111599,16 @@
111558
111599
  var style = c$1([cB("notification-container", `
111559
111600
  z-index: 4000;
111560
111601
  position: fixed;
111602
+ left: 0;
111603
+ right: 0;
111561
111604
  overflow: visible;
111562
111605
  display: flex;
111563
111606
  flex-direction: column;
111564
111607
  align-items: flex-end;
111608
+ pointer-events: none;
111565
111609
  `, [c$1(">", [cB("scrollbar", `
111566
- width: initial;
111610
+ width: -moz-fit-content;
111611
+ width: fit-content;
111567
111612
  overflow: visible;
111568
111613
  height: -moz-fit-content !important;
111569
111614
  height: fit-content !important;
@@ -111589,8 +111634,7 @@
111589
111634
  margin-bottom: 0;
111590
111635
  margin-top: 12px;
111591
111636
  `)]), cM("top, bottom", `
111592
- left: 50%;
111593
- transform: translateX(-50%);
111637
+ align-items: center;
111594
111638
  `, [cB("notification-wrapper", [c$1("&.notification-transition-enter-from, &.notification-transition-leave-to", `
111595
111639
  transform: scale(0.85);
111596
111640
  `), c$1("&.notification-transition-leave-from, &.notification-transition-enter-to", `
@@ -111599,15 +111643,11 @@
111599
111643
  transform-origin: top center;
111600
111644
  `)]), cM("bottom", [cB("notification-wrapper", `
111601
111645
  transform-origin: bottom center;
111602
- `)]), cM("top-right", `
111603
- right: 0;
111604
- `, [placementTransformStyle("top-right")]), cM("top-left", `
111605
- left: 0;
111606
- `, [placementTransformStyle("top-left")]), cM("bottom-right", `
111607
- right: 0;
111608
- `, [placementTransformStyle("bottom-right")]), cM("bottom-left", `
111609
- left: 0;
111610
- `, [placementTransformStyle("bottom-left")]), cM("scrollable", [cM("top-right", `
111646
+ `)]), cM("top-right, bottom-right", `
111647
+ align-items: flex-end;
111648
+ `), cM("top-left, bottom-left", `
111649
+ align-items: flex-start;
111650
+ `), cM("scrollable", [cM("top-right", `
111611
111651
  top: 0;
111612
111652
  `), cM("top-left", `
111613
111653
  top: 0;
@@ -111644,6 +111684,7 @@
111644
111684
  `)]), cB("notification", `
111645
111685
  background-color: var(--u-color);
111646
111686
  color: var(--u-text-color);
111687
+ pointer-events: auto;
111647
111688
  transition:
111648
111689
  background-color .3s var(--u-bezier),
111649
111690
  color .3s var(--u-bezier),
@@ -111742,16 +111783,6 @@
111742
111783
  `, [c$1("&:first-child", {
111743
111784
  margin: 0
111744
111785
  })])])])])]);
111745
- function placementTransformStyle(placement) {
111746
- const direction = placement.split("-")[1];
111747
- const transformXEnter = direction === "left" ? "calc(-100%)" : "calc(100%)";
111748
- const transformXLeave = "0";
111749
- return cB("notification-wrapper", [c$1("&.notification-transition-enter-from, &.notification-transition-leave-to", `
111750
- transform: translate(${transformXEnter}, 0);
111751
- `), c$1("&.notification-transition-leave-from, &.notification-transition-enter-to", `
111752
- transform: translate(${transformXLeave}, 0);
111753
- `)]);
111754
- }
111755
111786
 
111756
111787
  const notificationApiInjectionKey = createInjectionKey("u-notification-api");
111757
111788
  const notificationProviderProps = {
@@ -112596,7 +112627,7 @@
112596
112627
  });
112597
112628
  }
112598
112629
 
112599
- var version = "2.0.2";
112630
+ var version = "2.0.4";
112600
112631
 
112601
112632
  function create({
112602
112633
  componentPrefix = "U",
package/dist/index.mjs CHANGED
@@ -5768,22 +5768,24 @@ function wrap(component) {
5768
5768
  const instance = getCurrentInstance();
5769
5769
  const config = instance ? findConfig(instance) : null;
5770
5770
  const componentRef = ref(null);
5771
- const mergedProps = computed(() => {
5772
- if (!config) return props;
5773
- const defaults = config.mergedComponentPropsRef?.value?.[component.name] ?? {};
5774
- return {
5775
- ...defaults,
5776
- ...props
5777
- };
5778
- });
5779
5771
  if (ctx.expose) {
5780
5772
  ctx.expose(useExposeProxy(componentRef));
5781
5773
  }
5782
- return () => h(component, {
5783
- ref: componentRef,
5784
- ...mergedProps.value,
5785
- ...ctx.attrs
5786
- }, ctx.slots);
5774
+ return () => {
5775
+ let finalProps = props;
5776
+ if (config) {
5777
+ const defaults = config.mergedComponentPropsRef?.value?.[component.name] ?? {};
5778
+ finalProps = {
5779
+ ...defaults,
5780
+ ...props
5781
+ };
5782
+ }
5783
+ return h(component, {
5784
+ ref: componentRef,
5785
+ ...finalProps,
5786
+ ...ctx.attrs
5787
+ }, ctx.slots);
5788
+ };
5787
5789
  }
5788
5790
  });
5789
5791
  wrapped.__wrapped__ = true;
@@ -111395,6 +111397,7 @@ const Notification = defineComponent({
111395
111397
  const notificationEnvOptions = {
111396
111398
  ...notificationProps,
111397
111399
  duration: Number,
111400
+ pauseOnVisibilityChange: Boolean,
111398
111401
  onClose: Function,
111399
111402
  onLeave: Function,
111400
111403
  onAfterEnter: Function,
@@ -111424,10 +111427,45 @@ const NotificationEnvironment = defineComponent({
111424
111427
  const { wipTransitionCountRef } = inject(notificationProviderInjectionKey);
111425
111428
  const showRef = ref(true);
111426
111429
  let timerId = null;
111430
+ let remainingDuration = null;
111431
+ let timerStartedAt = null;
111432
+ let timerPausedForVisibility = false;
111433
+ function clearTimer() {
111434
+ if (timerId !== null) {
111435
+ window.clearTimeout(timerId);
111436
+ timerId = null;
111437
+ }
111438
+ }
111427
111439
  function hide() {
111428
111440
  showRef.value = false;
111429
- if (timerId) {
111430
- window.clearTimeout(timerId);
111441
+ clearTimer();
111442
+ }
111443
+ function startTimer(duration) {
111444
+ clearTimer();
111445
+ remainingDuration = duration;
111446
+ timerStartedAt = Date.now();
111447
+ timerId = window.setTimeout(hide, duration);
111448
+ }
111449
+ function handleVisibilityChange() {
111450
+ if (document.visibilityState === "hidden") {
111451
+ if (timerId !== null) {
111452
+ clearTimer();
111453
+ if (timerStartedAt !== null && remainingDuration !== null) {
111454
+ remainingDuration = Math.max(
111455
+ 0,
111456
+ remainingDuration - (Date.now() - timerStartedAt)
111457
+ );
111458
+ }
111459
+ timerStartedAt = null;
111460
+ timerPausedForVisibility = true;
111461
+ }
111462
+ } else if (timerPausedForVisibility) {
111463
+ timerPausedForVisibility = false;
111464
+ if (remainingDuration !== null && remainingDuration > 0) {
111465
+ startTimer(remainingDuration);
111466
+ } else {
111467
+ hide();
111468
+ }
111431
111469
  }
111432
111470
  }
111433
111471
  function handleBeforeEnter(el) {
@@ -111476,16 +111514,13 @@ const NotificationEnvironment = defineComponent({
111476
111514
  function setHideTimeout() {
111477
111515
  const { duration } = props;
111478
111516
  if (duration) {
111479
- timerId = window.setTimeout(hide, duration);
111517
+ startTimer(duration);
111480
111518
  }
111481
111519
  }
111482
111520
  function handleMouseenter(e) {
111483
111521
  if (e.currentTarget !== e.target)
111484
111522
  return;
111485
- if (timerId !== null) {
111486
- window.clearTimeout(timerId);
111487
- timerId = null;
111488
- }
111523
+ clearTimer();
111489
111524
  }
111490
111525
  function handleMouseleave(e) {
111491
111526
  if (e.currentTarget !== e.target)
@@ -111506,9 +111541,15 @@ const NotificationEnvironment = defineComponent({
111506
111541
  }
111507
111542
  onMounted(() => {
111508
111543
  if (props.duration) {
111509
- timerId = window.setTimeout(hide, props.duration);
111544
+ startTimer(props.duration);
111545
+ }
111546
+ if (props.pauseOnVisibilityChange) {
111547
+ document.addEventListener("visibilitychange", handleVisibilityChange);
111510
111548
  }
111511
111549
  });
111550
+ onBeforeUnmount(() => {
111551
+ document.removeEventListener("visibilitychange", handleVisibilityChange);
111552
+ });
111512
111553
  return {
111513
111554
  show: showRef,
111514
111555
  hide,
@@ -111554,12 +111595,16 @@ const NotificationEnvironment = defineComponent({
111554
111595
  var style = c$1([cB("notification-container", `
111555
111596
  z-index: 4000;
111556
111597
  position: fixed;
111598
+ left: 0;
111599
+ right: 0;
111557
111600
  overflow: visible;
111558
111601
  display: flex;
111559
111602
  flex-direction: column;
111560
111603
  align-items: flex-end;
111604
+ pointer-events: none;
111561
111605
  `, [c$1(">", [cB("scrollbar", `
111562
- width: initial;
111606
+ width: -moz-fit-content;
111607
+ width: fit-content;
111563
111608
  overflow: visible;
111564
111609
  height: -moz-fit-content !important;
111565
111610
  height: fit-content !important;
@@ -111585,8 +111630,7 @@ var style = c$1([cB("notification-container", `
111585
111630
  margin-bottom: 0;
111586
111631
  margin-top: 12px;
111587
111632
  `)]), cM("top, bottom", `
111588
- left: 50%;
111589
- transform: translateX(-50%);
111633
+ align-items: center;
111590
111634
  `, [cB("notification-wrapper", [c$1("&.notification-transition-enter-from, &.notification-transition-leave-to", `
111591
111635
  transform: scale(0.85);
111592
111636
  `), c$1("&.notification-transition-leave-from, &.notification-transition-enter-to", `
@@ -111595,15 +111639,11 @@ var style = c$1([cB("notification-container", `
111595
111639
  transform-origin: top center;
111596
111640
  `)]), cM("bottom", [cB("notification-wrapper", `
111597
111641
  transform-origin: bottom center;
111598
- `)]), cM("top-right", `
111599
- right: 0;
111600
- `, [placementTransformStyle("top-right")]), cM("top-left", `
111601
- left: 0;
111602
- `, [placementTransformStyle("top-left")]), cM("bottom-right", `
111603
- right: 0;
111604
- `, [placementTransformStyle("bottom-right")]), cM("bottom-left", `
111605
- left: 0;
111606
- `, [placementTransformStyle("bottom-left")]), cM("scrollable", [cM("top-right", `
111642
+ `)]), cM("top-right, bottom-right", `
111643
+ align-items: flex-end;
111644
+ `), cM("top-left, bottom-left", `
111645
+ align-items: flex-start;
111646
+ `), cM("scrollable", [cM("top-right", `
111607
111647
  top: 0;
111608
111648
  `), cM("top-left", `
111609
111649
  top: 0;
@@ -111640,6 +111680,7 @@ var style = c$1([cB("notification-container", `
111640
111680
  `)]), cB("notification", `
111641
111681
  background-color: var(--u-color);
111642
111682
  color: var(--u-text-color);
111683
+ pointer-events: auto;
111643
111684
  transition:
111644
111685
  background-color .3s var(--u-bezier),
111645
111686
  color .3s var(--u-bezier),
@@ -111738,16 +111779,6 @@ var style = c$1([cB("notification-container", `
111738
111779
  `, [c$1("&:first-child", {
111739
111780
  margin: 0
111740
111781
  })])])])])]);
111741
- function placementTransformStyle(placement) {
111742
- const direction = placement.split("-")[1];
111743
- const transformXEnter = direction === "left" ? "calc(-100%)" : "calc(100%)";
111744
- const transformXLeave = "0";
111745
- return cB("notification-wrapper", [c$1("&.notification-transition-enter-from, &.notification-transition-leave-to", `
111746
- transform: translate(${transformXEnter}, 0);
111747
- `), c$1("&.notification-transition-leave-from, &.notification-transition-enter-to", `
111748
- transform: translate(${transformXLeave}, 0);
111749
- `)]);
111750
- }
111751
111782
 
111752
111783
  const notificationApiInjectionKey = createInjectionKey("u-notification-api");
111753
111784
  const notificationProviderProps = {
@@ -112592,7 +112623,7 @@ function useThemeVars() {
112592
112623
  });
112593
112624
  }
112594
112625
 
112595
- var version = "2.0.2";
112626
+ var version = "2.0.4";
112596
112627
 
112597
112628
  function create({
112598
112629
  componentPrefix = "U",