@builder.io/sdk 1.1.28-6 → 1.1.29-0

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.umd.js CHANGED
@@ -152,7 +152,7 @@
152
152
  throw new Error("Property name \"".concat(name, "\" is not allowed"));
153
153
  }
154
154
 
155
- var version = "1.1.28-5";
155
+ var version = "1.1.28";
156
156
 
157
157
  var Subscription = /** @class */ (function () {
158
158
  function Subscription(listeners, listener) {
@@ -689,18 +689,25 @@
689
689
  Array.from(elements).forEach(function (element) {
690
690
  _this.augmentAnimation(animation, element);
691
691
  var triggered = false;
692
+ var pendingAnimation = false;
692
693
  function immediateOnScroll() {
693
694
  if (!triggered && isScrolledIntoView(element)) {
694
695
  triggered = true;
696
+ pendingAnimation = true;
695
697
  setTimeout(function () {
696
698
  assign(element.style, animation.steps[1].styles);
697
699
  document.removeEventListener('scroll', onScroll);
698
700
  setTimeout(function () {
701
+ pendingAnimation = false;
699
702
  element.style.transition = '';
700
703
  element.style.transitionDelay = '';
701
704
  }, (animation.duration * 1000 + (animation.delay || 0)) * 1000 + 100);
702
705
  });
703
706
  }
707
+ else if (animation.repeat && triggered && !pendingAnimation && !isScrolledIntoView(element)) {
708
+ // we want to repeat the animation everytime the the element is out of vide and back again
709
+ triggered = false;
710
+ }
704
711
  }
705
712
  // TODO: roll all of these in one for more efficiency of checking all the rects
706
713
  var onScroll = throttle(immediateOnScroll, 200, { leading: false });
@@ -708,7 +715,7 @@
708
715
  function isScrolledIntoView(elem) {
709
716
  var rect = elem.getBoundingClientRect();
710
717
  var windowHeight = window.innerHeight;
711
- var thresholdPrecent = 0;
718
+ var thresholdPrecent = animation.thresholdPrecent || 0;
712
719
  var threshold = thresholdPrecent * windowHeight;
713
720
  // TODO: partial in view? or what if element is larger than screen itself
714
721
  return (rect.bottom > threshold && rect.top < windowHeight - threshold // Element is peeking top or bottom
@@ -1204,6 +1211,7 @@
1204
1211
  this.observersByKey = {};
1205
1212
  this.noEditorUpdates = {};
1206
1213
  this.overrides = {};
1214
+ this.queryOptions = {};
1207
1215
  this.getContentQueue = null;
1208
1216
  this.priorContentQueue = null;
1209
1217
  this.testCookiePrefix = 'builder.tests';
@@ -1225,6 +1233,11 @@
1225
1233
  }
1226
1234
  if (isBrowser) {
1227
1235
  this.bindMessageListeners();
1236
+ if (Builder.isEditing) {
1237
+ parent.postMessage({ type: 'builder.animatorOptions', data: { options: {
1238
+ version: 2
1239
+ } } }, '*');
1240
+ }
1228
1241
  // TODO: postmessage to parent the builder info for every package
1229
1242
  // type: 'builder.sdk', data: { name: '@builder.io/react', version: '0.1.23' }
1230
1243
  // (window as any).BUILDER_VERSION = Builder.VERSION;
@@ -1815,10 +1828,14 @@
1815
1828
  var params = QueryString.parseDeep(this.modifySearch(location.search || '').substr(1));
1816
1829
  var builder = params.builder;
1817
1830
  if (builder) {
1818
- var userAttributes = builder.userAttributes, overrides = builder.overrides, env = builder.env, host = builder.host, api = builder.api, cachebust = builder.cachebust, noCache = builder.noCache, preview = builder.preview, editing = builder.editing, frameEditing = builder.frameEditing, overrideParams = builder.params;
1831
+ var userAttributes = builder.userAttributes, overrides = builder.overrides, env = builder.env, host = builder.host, api = builder.api, cachebust = builder.cachebust, noCache = builder.noCache, preview = builder.preview, editing = builder.editing, frameEditing = builder.frameEditing, options = builder.options, overrideParams = builder.params;
1819
1832
  if (userAttributes) {
1820
1833
  this.setUserAttributes(userAttributes);
1821
1834
  }
1835
+ if (options) {
1836
+ // picking only locale and includeRefs
1837
+ this.queryOptions = __assign(__assign({}, (options.locale && { locale: options.locale })), (options.includeRefs && { includeRefs: options.includeRefs }));
1838
+ }
1822
1839
  if (overrides) {
1823
1840
  this.overrides = overrides;
1824
1841
  }
@@ -2290,9 +2307,9 @@
2290
2307
  var queue = useQueue || (usePastQueue ? this.priorContentQueue : this.getContentQueue) || [];
2291
2308
  // TODO: do this on every request send?
2292
2309
  this.getOverridesFromQueryString();
2293
- var queryParams = __assign({
2310
+ var queryParams = __assign(__assign({
2294
2311
  // TODO: way to force a request to be in a separate queue. or just lower queue limit to be 1 by default
2295
- omit: queue[0].omit || 'meta.componentsUsed', apiKey: this.apiKey }, queue[0].options);
2312
+ omit: queue[0].omit || 'meta.componentsUsed', apiKey: this.apiKey }, queue[0].options), this.queryOptions);
2296
2313
  if (queue[0].fields) {
2297
2314
  queryParams.fields = queue[0].fields;
2298
2315
  }