@builder.io/sdk 1.1.28 → 1.1.29-1
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.browser.js +1 -1
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs.js +17 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +17 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +17 -3
- package/dist/index.umd.js.map +1 -1
- package/dist/package.json +1 -1
- package/dist/src/builder.class.d.ts +4 -0
- package/dist/src/builder.class.js +5 -0
- package/dist/src/builder.class.js.map +1 -1
- package/dist/src/classes/animator.class.d.ts +2 -0
- package/dist/src/classes/animator.class.js +11 -2
- package/dist/src/classes/animator.class.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -129,7 +129,7 @@ function assertAllowedPropertyName(name) {
|
|
|
129
129
|
throw new Error("Property name \"".concat(name, "\" is not allowed"));
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
var version = "1.1.
|
|
132
|
+
var version = "1.1.29-0";
|
|
133
133
|
|
|
134
134
|
var Subscription = /** @class */ (function () {
|
|
135
135
|
function Subscription(listeners, listener) {
|
|
@@ -666,18 +666,27 @@ var Animator = /** @class */ (function () {
|
|
|
666
666
|
Array.from(elements).forEach(function (element) {
|
|
667
667
|
_this.augmentAnimation(animation, element);
|
|
668
668
|
var triggered = false;
|
|
669
|
+
var pendingAnimation = false;
|
|
669
670
|
function immediateOnScroll() {
|
|
670
671
|
if (!triggered && isScrolledIntoView(element)) {
|
|
671
672
|
triggered = true;
|
|
673
|
+
pendingAnimation = true;
|
|
672
674
|
setTimeout(function () {
|
|
673
675
|
assign(element.style, animation.steps[1].styles);
|
|
674
|
-
|
|
676
|
+
if (!animation.repeat) {
|
|
677
|
+
document.removeEventListener('scroll', onScroll);
|
|
678
|
+
}
|
|
675
679
|
setTimeout(function () {
|
|
680
|
+
pendingAnimation = false;
|
|
676
681
|
element.style.transition = '';
|
|
677
682
|
element.style.transitionDelay = '';
|
|
678
683
|
}, (animation.duration * 1000 + (animation.delay || 0)) * 1000 + 100);
|
|
679
684
|
});
|
|
680
685
|
}
|
|
686
|
+
else if (animation.repeat && triggered && !pendingAnimation && !isScrolledIntoView(element)) {
|
|
687
|
+
// we want to repeat the animation everytime the the element is out of vide and back again
|
|
688
|
+
triggered = false;
|
|
689
|
+
}
|
|
681
690
|
}
|
|
682
691
|
// TODO: roll all of these in one for more efficiency of checking all the rects
|
|
683
692
|
var onScroll = throttle(immediateOnScroll, 200, { leading: false });
|
|
@@ -685,7 +694,7 @@ var Animator = /** @class */ (function () {
|
|
|
685
694
|
function isScrolledIntoView(elem) {
|
|
686
695
|
var rect = elem.getBoundingClientRect();
|
|
687
696
|
var windowHeight = window.innerHeight;
|
|
688
|
-
var thresholdPrecent = 0;
|
|
697
|
+
var thresholdPrecent = animation.thresholdPrecent || 0;
|
|
689
698
|
var threshold = thresholdPrecent * windowHeight;
|
|
690
699
|
// TODO: partial in view? or what if element is larger than screen itself
|
|
691
700
|
return (rect.bottom > threshold && rect.top < windowHeight - threshold // Element is peeking top or bottom
|
|
@@ -1135,6 +1144,11 @@ var Builder = /** @class */ (function () {
|
|
|
1135
1144
|
}
|
|
1136
1145
|
if (isBrowser) {
|
|
1137
1146
|
this.bindMessageListeners();
|
|
1147
|
+
if (Builder.isEditing) {
|
|
1148
|
+
parent.postMessage({ type: 'builder.animatorOptions', data: { options: {
|
|
1149
|
+
version: 2
|
|
1150
|
+
} } }, '*');
|
|
1151
|
+
}
|
|
1138
1152
|
// TODO: postmessage to parent the builder info for every package
|
|
1139
1153
|
// type: 'builder.sdk', data: { name: '@builder.io/react', version: '0.1.23' }
|
|
1140
1154
|
// (window as any).BUILDER_VERSION = Builder.VERSION;
|