@thinkpixellab-public/px-vue 4.1.18 → 4.1.19
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/components/PxFloat.vue
CHANGED
|
@@ -368,13 +368,15 @@ export default {
|
|
|
368
368
|
setTimeout(() => {
|
|
369
369
|
// floating-ui
|
|
370
370
|
|
|
371
|
+
this.popupPositioned = true;
|
|
372
|
+
|
|
371
373
|
if (nv) {
|
|
372
374
|
let reference = this.getReferenceElement();
|
|
373
375
|
let popup = this.$refs.popup;
|
|
374
376
|
|
|
375
377
|
this.updatePosition(reference, popup);
|
|
376
378
|
|
|
377
|
-
if (this.autoUpdate) {
|
|
379
|
+
if (this.autoUpdate && reference && popup) {
|
|
378
380
|
this.cleanup = autoUpdate(reference, popup, () =>
|
|
379
381
|
this.updatePosition(reference, popup),
|
|
380
382
|
);
|
|
@@ -420,8 +422,6 @@ export default {
|
|
|
420
422
|
// see watcher for transitionVisible
|
|
421
423
|
}
|
|
422
424
|
|
|
423
|
-
this.popupPositioned = true;
|
|
424
|
-
|
|
425
425
|
// show and hide events (also see beforeshow/beforehide in visibleValue watcher)
|
|
426
426
|
|
|
427
427
|
if (nv) {
|
|
@@ -37,8 +37,12 @@ export default {
|
|
|
37
37
|
|
|
38
38
|
// TODO rtlAdjust: {type: Boolean, default: false }
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
// if null, use --px-slide-transition-duration variable
|
|
41
|
+
duration: { type: Number, default: null },
|
|
42
|
+
|
|
41
43
|
ease: { type: String, default: 'power3.out' },
|
|
44
|
+
|
|
45
|
+
// if null, use --px-slide-transition-slide-amount variable
|
|
42
46
|
slideAmount: { default: '40vw' },
|
|
43
47
|
},
|
|
44
48
|
|
|
@@ -46,15 +50,36 @@ export default {
|
|
|
46
50
|
return { initialized: false };
|
|
47
51
|
},
|
|
48
52
|
computed: {
|
|
49
|
-
|
|
53
|
+
calcDuration() {
|
|
50
54
|
if (this.disableAnimations || !this.initialized) {
|
|
51
55
|
return 0;
|
|
52
56
|
}
|
|
53
|
-
|
|
57
|
+
|
|
58
|
+
if (this.duration !== null) {
|
|
59
|
+
return this.duration;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const duration = getComputedStyle(this.$el).getPropertyValue(
|
|
63
|
+
'--px-slide-transition-duration',
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
return parseFloat(duration);
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
calcSlideAmount() {
|
|
70
|
+
if (this.slideAmount !== null) {
|
|
71
|
+
return this.slideAmount;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const slideAmount = getComputedStyle(this.$el).getPropertyValue(
|
|
75
|
+
'--px-slide-transition-slide-amount',
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
return slideAmount;
|
|
54
79
|
},
|
|
55
80
|
tweenShared() {
|
|
56
81
|
return {
|
|
57
|
-
duration: this.
|
|
82
|
+
duration: this.calcDuration,
|
|
58
83
|
ease: this.ease,
|
|
59
84
|
};
|
|
60
85
|
},
|
|
@@ -88,7 +113,7 @@ export default {
|
|
|
88
113
|
dir = direction < 0 ? '-' : '';
|
|
89
114
|
}
|
|
90
115
|
|
|
91
|
-
return dir + this.
|
|
116
|
+
return dir + this.calcSlideAmount;
|
|
92
117
|
},
|
|
93
118
|
slideElements(element) {
|
|
94
119
|
if (!element) {
|
|
@@ -138,7 +163,7 @@ export default {
|
|
|
138
163
|
// fade
|
|
139
164
|
gsap.to(element, {
|
|
140
165
|
opacity: 1,
|
|
141
|
-
duration: this.
|
|
166
|
+
duration: this.calcDuration,
|
|
142
167
|
ease: this.ease,
|
|
143
168
|
onStart: () => {
|
|
144
169
|
this.$emit('before-enter');
|
|
@@ -194,7 +219,7 @@ export default {
|
|
|
194
219
|
|
|
195
220
|
gsap.to(element, {
|
|
196
221
|
opacity: 0,
|
|
197
|
-
duration: this.
|
|
222
|
+
duration: this.calcDuration,
|
|
198
223
|
ease: this.ease,
|
|
199
224
|
onStart: () => {
|
|
200
225
|
this.$emit('before-leave');
|
|
@@ -222,6 +247,14 @@ export default {
|
|
|
222
247
|
|
|
223
248
|
<style lang="scss">
|
|
224
249
|
@use '../styles/px.scss' as *;
|
|
250
|
+
|
|
251
|
+
@at-root {
|
|
252
|
+
:root {
|
|
253
|
+
--px-slide-transition-duration: 1s;
|
|
254
|
+
--px-slide-transition-slide-amount: 40vw;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
225
258
|
.px-slides-transition {
|
|
226
259
|
opacity: 0;
|
|
227
260
|
width: 100%;
|