@builder.io/sdk 1.1.29 → 1.1.30
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/CHANGELOG.md +7 -0
- package/dist/index.browser.js +1 -1
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs.js +32 -7
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +32 -7
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +32 -7
- package/dist/index.umd.js.map +1 -1
- package/dist/package.json +1 -1
- package/dist/src/builder.class.js +10 -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 +21 -6
- package/dist/src/classes/animator.class.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -123,7 +123,7 @@ function assertAllowedPropertyName(name) {
|
|
|
123
123
|
throw new Error("Property name \"".concat(name, "\" is not allowed"));
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
var version = "1.1.
|
|
126
|
+
var version = "1.1.30-1";
|
|
127
127
|
|
|
128
128
|
var Subscription = /** @class */ (function () {
|
|
129
129
|
function Subscription(listeners, listener) {
|
|
@@ -660,18 +660,33 @@ var Animator = /** @class */ (function () {
|
|
|
660
660
|
Array.from(elements).forEach(function (element) {
|
|
661
661
|
_this.augmentAnimation(animation, element);
|
|
662
662
|
var triggered = false;
|
|
663
|
+
var pendingAnimation = false;
|
|
663
664
|
function immediateOnScroll() {
|
|
664
665
|
if (!triggered && isScrolledIntoView(element)) {
|
|
665
666
|
triggered = true;
|
|
667
|
+
pendingAnimation = true;
|
|
666
668
|
setTimeout(function () {
|
|
667
669
|
assign(element.style, animation.steps[1].styles);
|
|
668
|
-
|
|
670
|
+
if (!animation.repeat) {
|
|
671
|
+
document.removeEventListener('scroll', onScroll);
|
|
672
|
+
}
|
|
669
673
|
setTimeout(function () {
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
674
|
+
pendingAnimation = false;
|
|
675
|
+
if (!animation.repeat) {
|
|
676
|
+
element.style.transition = '';
|
|
677
|
+
element.style.transitionDelay = '';
|
|
678
|
+
}
|
|
679
|
+
}, (animation.duration + (animation.delay || 0)) * 1000 + 100);
|
|
673
680
|
});
|
|
674
681
|
}
|
|
682
|
+
else if (animation.repeat &&
|
|
683
|
+
triggered &&
|
|
684
|
+
!pendingAnimation &&
|
|
685
|
+
!isScrolledIntoView(element)) {
|
|
686
|
+
// we want to repeat the animation every time the the element is out of view and back again
|
|
687
|
+
triggered = false;
|
|
688
|
+
assign(element.style, animation.steps[0].styles);
|
|
689
|
+
}
|
|
675
690
|
}
|
|
676
691
|
// TODO: roll all of these in one for more efficiency of checking all the rects
|
|
677
692
|
var onScroll = throttle(immediateOnScroll, 200, { leading: false });
|
|
@@ -679,8 +694,8 @@ var Animator = /** @class */ (function () {
|
|
|
679
694
|
function isScrolledIntoView(elem) {
|
|
680
695
|
var rect = elem.getBoundingClientRect();
|
|
681
696
|
var windowHeight = window.innerHeight;
|
|
682
|
-
var
|
|
683
|
-
var threshold =
|
|
697
|
+
var thresholdPercent = (animation.thresholdPercent || 0) / 100;
|
|
698
|
+
var threshold = thresholdPercent * windowHeight;
|
|
684
699
|
// TODO: partial in view? or what if element is larger than screen itself
|
|
685
700
|
return (rect.bottom > threshold && rect.top < windowHeight - threshold // Element is peeking top or bottom
|
|
686
701
|
// (rect.top > 0 && rect.bottom < window.innerHeight) || // element fits within the screen and is fully on screen (not hanging off at all)
|
|
@@ -1129,6 +1144,16 @@ var Builder = /** @class */ (function () {
|
|
|
1129
1144
|
}
|
|
1130
1145
|
if (isBrowser) {
|
|
1131
1146
|
this.bindMessageListeners();
|
|
1147
|
+
if (Builder.isEditing) {
|
|
1148
|
+
parent.postMessage({
|
|
1149
|
+
type: 'builder.animatorOptions',
|
|
1150
|
+
data: {
|
|
1151
|
+
options: {
|
|
1152
|
+
version: 2,
|
|
1153
|
+
},
|
|
1154
|
+
},
|
|
1155
|
+
}, '*');
|
|
1156
|
+
}
|
|
1132
1157
|
// TODO: postmessage to parent the builder info for every package
|
|
1133
1158
|
// type: 'builder.sdk', data: { name: '@builder.io/react', version: '0.1.23' }
|
|
1134
1159
|
// (window as any).BUILDER_VERSION = Builder.VERSION;
|