@builder.io/sdk-qwik 0.14.14 → 0.14.16

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.
@@ -124,7 +124,8 @@ function isIframe() {
124
124
  return isBrowser() && window.self !== window.top;
125
125
  }
126
126
  function isEditing(search) {
127
- return isIframe() && getSearchString(search || window.location.search).indexOf("builder.frameEditing=") !== -1;
127
+ return isIframe() && // accessing window.location.search is safe here because `isIframe()` is only `true` if we're in a browser.
128
+ getSearchString(search || window.location.search).indexOf("builder.frameEditing=") !== -1;
128
129
  }
129
130
  const getLocation = () => {
130
131
  if (isBrowser()) {
@@ -417,9 +418,6 @@ function bindAnimations(animations) {
417
418
  case "pageLoad":
418
419
  triggerAnimation(animation);
419
420
  break;
420
- case "hover":
421
- bindHoverAnimation(animation);
422
- break;
423
421
  case "scrollInView":
424
422
  bindScrollInViewAnimation(animation);
425
423
  break;
@@ -475,32 +473,6 @@ function triggerAnimation(animation) {
475
473
  });
476
474
  });
477
475
  }
478
- function bindHoverAnimation(animation) {
479
- const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
480
- if (!elements.length) {
481
- warnElementNotPresent(animation.elementId || animation.id || "");
482
- return;
483
- }
484
- Array.from(elements).forEach((element) => {
485
- augmentAnimation(animation, element);
486
- const defaultState = animation.steps[0].styles;
487
- const hoverState = animation.steps[1].styles;
488
- function attachDefaultState() {
489
- assign(element.style, defaultState);
490
- }
491
- function attachHoverState() {
492
- assign(element.style, hoverState);
493
- }
494
- attachDefaultState();
495
- element.addEventListener("mouseenter", attachHoverState);
496
- element.addEventListener("mouseleave", attachDefaultState);
497
- setTimeout(() => {
498
- element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
499
- if (animation.delay)
500
- element.style.transitionDelay = animation.delay + "s";
501
- });
502
- });
503
- }
504
476
  function bindScrollInViewAnimation(animation) {
505
477
  const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
506
478
  if (!elements.length) {
@@ -730,7 +702,7 @@ const BlockStyles = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlin
730
702
  props
731
703
  ]));
732
704
  const css = qwik.useComputedQrl(/* @__PURE__ */ qwik.inlinedQrl(() => {
733
- var _a;
705
+ var _a, _b, _c;
734
706
  const [props2] = qwik.useLexicalScope();
735
707
  const processedBlock = getProcessedBlock({
736
708
  block: props2.block,
@@ -763,10 +735,24 @@ const BlockStyles = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlin
763
735
  styles: smallStyles,
764
736
  mediaQuery: getMaxWidthQueryForSize("small", sizesWithUpdatedBreakpoints)
765
737
  }) : "";
738
+ const hoverAnimation = processedBlock.animations && processedBlock.animations.find((item) => item.trigger === "hover");
739
+ let hoverStylesClass = "";
740
+ if (hoverAnimation) {
741
+ const hoverStyles = ((_c = (_b = hoverAnimation.steps) == null ? void 0 : _b[1]) == null ? void 0 : _c.styles) || {};
742
+ hoverStylesClass = createCssClass({
743
+ className: `${className}:hover`,
744
+ styles: {
745
+ ...hoverStyles,
746
+ transition: `all ${hoverAnimation.duration}s ${camelCaseToKebabCase(hoverAnimation.easing)}`,
747
+ transitionDelay: hoverAnimation.delay ? `${hoverAnimation.delay}s` : "0s"
748
+ }
749
+ }) || "";
750
+ }
766
751
  return [
767
752
  largeStylesClass,
768
753
  mediumStylesClass,
769
- smallStylesClass
754
+ smallStylesClass,
755
+ hoverStylesClass
770
756
  ].join(" ");
771
757
  }, "BlockStyles_component_css_useComputed_b9Ru8qTcNik", [
772
758
  props
@@ -1110,7 +1096,7 @@ const Block = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl(
1110
1096
  const blockId = processedBlock2.value.id;
1111
1097
  const animations = processedBlock2.value.animations;
1112
1098
  if (animations && blockId)
1113
- bindAnimations(animations.filter((item) => item.trigger !== "hover").map((animation) => ({
1099
+ bindAnimations(animations.map((animation) => ({
1114
1100
  ...animation,
1115
1101
  elementId: blockId
1116
1102
  })));
@@ -4188,12 +4174,11 @@ async function fetchEntries(options) {
4188
4174
  return null;
4189
4175
  }
4190
4176
  }
4191
- function isPreviewing(search) {
4192
- if (!isBrowser())
4193
- return false;
4194
- const normalizedSearch = getSearchString(search || window.location.search);
4195
- if (isEditing(normalizedSearch))
4177
+ function isPreviewing(_search) {
4178
+ const search = _search || (isBrowser() ? window.location.search : void 0);
4179
+ if (!search)
4196
4180
  return false;
4181
+ const normalizedSearch = getSearchString(search);
4197
4182
  return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
4198
4183
  }
4199
4184
  function uuidv4() {
@@ -4399,7 +4384,7 @@ function isFromTrustedHost(trustedHosts, e) {
4399
4384
  const url = new URL(e.origin), hostname = url.hostname;
4400
4385
  return (trustedHosts || DEFAULT_TRUSTED_HOSTS).findIndex((trustedHost) => trustedHost.startsWith("*.") ? hostname.endsWith(trustedHost.slice(1)) : trustedHost === hostname) > -1;
4401
4386
  }
4402
- const SDK_VERSION = "0.14.14";
4387
+ const SDK_VERSION = "0.14.16";
4403
4388
  const registry = {};
4404
4389
  function register(type, info) {
4405
4390
  let typeList = registry[type];
@@ -4789,7 +4774,7 @@ const EnableEditor = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inli
4789
4774
  variationId: variationId !== contentId ? variationId : void 0
4790
4775
  });
4791
4776
  }
4792
- if (isPreviewing()) {
4777
+ if (isPreviewing() && !isEditing()) {
4793
4778
  if (element)
4794
4779
  element.dispatchEvent(new CustomEvent("initpreviewingbldr"));
4795
4780
  }
@@ -122,7 +122,8 @@ function isIframe() {
122
122
  return isBrowser() && window.self !== window.top;
123
123
  }
124
124
  function isEditing(search) {
125
- return isIframe() && getSearchString(search || window.location.search).indexOf("builder.frameEditing=") !== -1;
125
+ return isIframe() && // accessing window.location.search is safe here because `isIframe()` is only `true` if we're in a browser.
126
+ getSearchString(search || window.location.search).indexOf("builder.frameEditing=") !== -1;
126
127
  }
127
128
  const getLocation = () => {
128
129
  if (isBrowser()) {
@@ -415,9 +416,6 @@ function bindAnimations(animations) {
415
416
  case "pageLoad":
416
417
  triggerAnimation(animation);
417
418
  break;
418
- case "hover":
419
- bindHoverAnimation(animation);
420
- break;
421
419
  case "scrollInView":
422
420
  bindScrollInViewAnimation(animation);
423
421
  break;
@@ -473,32 +471,6 @@ function triggerAnimation(animation) {
473
471
  });
474
472
  });
475
473
  }
476
- function bindHoverAnimation(animation) {
477
- const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
478
- if (!elements.length) {
479
- warnElementNotPresent(animation.elementId || animation.id || "");
480
- return;
481
- }
482
- Array.from(elements).forEach((element) => {
483
- augmentAnimation(animation, element);
484
- const defaultState = animation.steps[0].styles;
485
- const hoverState = animation.steps[1].styles;
486
- function attachDefaultState() {
487
- assign(element.style, defaultState);
488
- }
489
- function attachHoverState() {
490
- assign(element.style, hoverState);
491
- }
492
- attachDefaultState();
493
- element.addEventListener("mouseenter", attachHoverState);
494
- element.addEventListener("mouseleave", attachDefaultState);
495
- setTimeout(() => {
496
- element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
497
- if (animation.delay)
498
- element.style.transitionDelay = animation.delay + "s";
499
- });
500
- });
501
- }
502
474
  function bindScrollInViewAnimation(animation) {
503
475
  const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
504
476
  if (!elements.length) {
@@ -728,7 +700,7 @@ const BlockStyles = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pro
728
700
  props
729
701
  ]));
730
702
  const css = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
731
- var _a;
703
+ var _a, _b, _c;
732
704
  const [props2] = useLexicalScope();
733
705
  const processedBlock = getProcessedBlock({
734
706
  block: props2.block,
@@ -761,10 +733,24 @@ const BlockStyles = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pro
761
733
  styles: smallStyles,
762
734
  mediaQuery: getMaxWidthQueryForSize("small", sizesWithUpdatedBreakpoints)
763
735
  }) : "";
736
+ const hoverAnimation = processedBlock.animations && processedBlock.animations.find((item) => item.trigger === "hover");
737
+ let hoverStylesClass = "";
738
+ if (hoverAnimation) {
739
+ const hoverStyles = ((_c = (_b = hoverAnimation.steps) == null ? void 0 : _b[1]) == null ? void 0 : _c.styles) || {};
740
+ hoverStylesClass = createCssClass({
741
+ className: `${className}:hover`,
742
+ styles: {
743
+ ...hoverStyles,
744
+ transition: `all ${hoverAnimation.duration}s ${camelCaseToKebabCase(hoverAnimation.easing)}`,
745
+ transitionDelay: hoverAnimation.delay ? `${hoverAnimation.delay}s` : "0s"
746
+ }
747
+ }) || "";
748
+ }
764
749
  return [
765
750
  largeStylesClass,
766
751
  mediumStylesClass,
767
- smallStylesClass
752
+ smallStylesClass,
753
+ hoverStylesClass
768
754
  ].join(" ");
769
755
  }, "BlockStyles_component_css_useComputed_b9Ru8qTcNik", [
770
756
  props
@@ -1108,7 +1094,7 @@ const Block = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
1108
1094
  const blockId = processedBlock2.value.id;
1109
1095
  const animations = processedBlock2.value.animations;
1110
1096
  if (animations && blockId)
1111
- bindAnimations(animations.filter((item) => item.trigger !== "hover").map((animation) => ({
1097
+ bindAnimations(animations.map((animation) => ({
1112
1098
  ...animation,
1113
1099
  elementId: blockId
1114
1100
  })));
@@ -4186,12 +4172,11 @@ async function fetchEntries(options) {
4186
4172
  return null;
4187
4173
  }
4188
4174
  }
4189
- function isPreviewing(search) {
4190
- if (!isBrowser())
4191
- return false;
4192
- const normalizedSearch = getSearchString(search || window.location.search);
4193
- if (isEditing(normalizedSearch))
4175
+ function isPreviewing(_search) {
4176
+ const search = _search || (isBrowser() ? window.location.search : void 0);
4177
+ if (!search)
4194
4178
  return false;
4179
+ const normalizedSearch = getSearchString(search);
4195
4180
  return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
4196
4181
  }
4197
4182
  function uuidv4() {
@@ -4397,7 +4382,7 @@ function isFromTrustedHost(trustedHosts, e) {
4397
4382
  const url = new URL(e.origin), hostname = url.hostname;
4398
4383
  return (trustedHosts || DEFAULT_TRUSTED_HOSTS).findIndex((trustedHost) => trustedHost.startsWith("*.") ? hostname.endsWith(trustedHost.slice(1)) : trustedHost === hostname) > -1;
4399
4384
  }
4400
- const SDK_VERSION = "0.14.14";
4385
+ const SDK_VERSION = "0.14.16";
4401
4386
  const registry = {};
4402
4387
  function register(type, info) {
4403
4388
  let typeList = registry[type];
@@ -4787,7 +4772,7 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
4787
4772
  variationId: variationId !== contentId ? variationId : void 0
4788
4773
  });
4789
4774
  }
4790
- if (isPreviewing()) {
4775
+ if (isPreviewing() && !isEditing()) {
4791
4776
  if (element)
4792
4777
  element.dispatchEvent(new CustomEvent("initpreviewingbldr"));
4793
4778
  }
@@ -124,7 +124,8 @@ function isIframe() {
124
124
  return isBrowser() && window.self !== window.top;
125
125
  }
126
126
  function isEditing(search) {
127
- return isIframe() && getSearchString(search || window.location.search).indexOf("builder.frameEditing=") !== -1;
127
+ return isIframe() && // accessing window.location.search is safe here because `isIframe()` is only `true` if we're in a browser.
128
+ getSearchString(search || window.location.search).indexOf("builder.frameEditing=") !== -1;
128
129
  }
129
130
  const getLocation = () => {
130
131
  if (isBrowser()) {
@@ -3648,9 +3649,6 @@ function bindAnimations(animations) {
3648
3649
  case "pageLoad":
3649
3650
  triggerAnimation(animation);
3650
3651
  break;
3651
- case "hover":
3652
- bindHoverAnimation(animation);
3653
- break;
3654
3652
  case "scrollInView":
3655
3653
  bindScrollInViewAnimation(animation);
3656
3654
  break;
@@ -3706,32 +3704,6 @@ function triggerAnimation(animation) {
3706
3704
  });
3707
3705
  });
3708
3706
  }
3709
- function bindHoverAnimation(animation) {
3710
- const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
3711
- if (!elements.length) {
3712
- warnElementNotPresent(animation.elementId || animation.id || "");
3713
- return;
3714
- }
3715
- Array.from(elements).forEach((element) => {
3716
- augmentAnimation(animation, element);
3717
- const defaultState = animation.steps[0].styles;
3718
- const hoverState = animation.steps[1].styles;
3719
- function attachDefaultState() {
3720
- assign(element.style, defaultState);
3721
- }
3722
- function attachHoverState() {
3723
- assign(element.style, hoverState);
3724
- }
3725
- attachDefaultState();
3726
- element.addEventListener("mouseenter", attachHoverState);
3727
- element.addEventListener("mouseleave", attachDefaultState);
3728
- setTimeout(() => {
3729
- element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
3730
- if (animation.delay)
3731
- element.style.transitionDelay = animation.delay + "s";
3732
- });
3733
- });
3734
- }
3735
3707
  function bindScrollInViewAnimation(animation) {
3736
3708
  const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
3737
3709
  if (!elements.length) {
@@ -3961,7 +3933,7 @@ const BlockStyles = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlin
3961
3933
  props
3962
3934
  ]));
3963
3935
  const css = qwik.useComputedQrl(/* @__PURE__ */ qwik.inlinedQrl(() => {
3964
- var _a;
3936
+ var _a, _b, _c;
3965
3937
  const [props2] = qwik.useLexicalScope();
3966
3938
  const processedBlock = getProcessedBlock({
3967
3939
  block: props2.block,
@@ -3994,10 +3966,24 @@ const BlockStyles = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlin
3994
3966
  styles: smallStyles,
3995
3967
  mediaQuery: getMaxWidthQueryForSize("small", sizesWithUpdatedBreakpoints)
3996
3968
  }) : "";
3969
+ const hoverAnimation = processedBlock.animations && processedBlock.animations.find((item) => item.trigger === "hover");
3970
+ let hoverStylesClass = "";
3971
+ if (hoverAnimation) {
3972
+ const hoverStyles = ((_c = (_b = hoverAnimation.steps) == null ? void 0 : _b[1]) == null ? void 0 : _c.styles) || {};
3973
+ hoverStylesClass = createCssClass({
3974
+ className: `${className}:hover`,
3975
+ styles: {
3976
+ ...hoverStyles,
3977
+ transition: `all ${hoverAnimation.duration}s ${camelCaseToKebabCase(hoverAnimation.easing)}`,
3978
+ transitionDelay: hoverAnimation.delay ? `${hoverAnimation.delay}s` : "0s"
3979
+ }
3980
+ }) || "";
3981
+ }
3997
3982
  return [
3998
3983
  largeStylesClass,
3999
3984
  mediumStylesClass,
4000
- smallStylesClass
3985
+ smallStylesClass,
3986
+ hoverStylesClass
4001
3987
  ].join(" ");
4002
3988
  }, "BlockStyles_component_css_useComputed_b9Ru8qTcNik", [
4003
3989
  props
@@ -4341,7 +4327,7 @@ const Block = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl(
4341
4327
  const blockId = processedBlock2.value.id;
4342
4328
  const animations = processedBlock2.value.animations;
4343
4329
  if (animations && blockId)
4344
- bindAnimations(animations.filter((item) => item.trigger !== "hover").map((animation) => ({
4330
+ bindAnimations(animations.map((animation) => ({
4345
4331
  ...animation,
4346
4332
  elementId: blockId
4347
4333
  })));
@@ -7419,12 +7405,11 @@ async function fetchEntries(options) {
7419
7405
  return null;
7420
7406
  }
7421
7407
  }
7422
- function isPreviewing(search) {
7423
- if (!isBrowser())
7424
- return false;
7425
- const normalizedSearch = getSearchString(search || window.location.search);
7426
- if (isEditing(normalizedSearch))
7408
+ function isPreviewing(_search) {
7409
+ const search = _search || (isBrowser() ? window.location.search : void 0);
7410
+ if (!search)
7427
7411
  return false;
7412
+ const normalizedSearch = getSearchString(search);
7428
7413
  return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
7429
7414
  }
7430
7415
  function uuidv4() {
@@ -7630,7 +7615,7 @@ function isFromTrustedHost(trustedHosts, e) {
7630
7615
  const url = new URL(e.origin), hostname = url.hostname;
7631
7616
  return (trustedHosts || DEFAULT_TRUSTED_HOSTS).findIndex((trustedHost) => trustedHost.startsWith("*.") ? hostname.endsWith(trustedHost.slice(1)) : trustedHost === hostname) > -1;
7632
7617
  }
7633
- const SDK_VERSION = "0.14.14";
7618
+ const SDK_VERSION = "0.14.16";
7634
7619
  const registry = {};
7635
7620
  function register(type, info) {
7636
7621
  let typeList = registry[type];
@@ -8020,7 +8005,7 @@ const EnableEditor = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inli
8020
8005
  variationId: variationId !== contentId ? variationId : void 0
8021
8006
  });
8022
8007
  }
8023
- if (isPreviewing()) {
8008
+ if (isPreviewing() && !isEditing()) {
8024
8009
  if (element)
8025
8010
  element.dispatchEvent(new CustomEvent("initpreviewingbldr"));
8026
8011
  }
@@ -122,7 +122,8 @@ function isIframe() {
122
122
  return isBrowser() && window.self !== window.top;
123
123
  }
124
124
  function isEditing(search) {
125
- return isIframe() && getSearchString(search || window.location.search).indexOf("builder.frameEditing=") !== -1;
125
+ return isIframe() && // accessing window.location.search is safe here because `isIframe()` is only `true` if we're in a browser.
126
+ getSearchString(search || window.location.search).indexOf("builder.frameEditing=") !== -1;
126
127
  }
127
128
  const getLocation = () => {
128
129
  if (isBrowser()) {
@@ -3646,9 +3647,6 @@ function bindAnimations(animations) {
3646
3647
  case "pageLoad":
3647
3648
  triggerAnimation(animation);
3648
3649
  break;
3649
- case "hover":
3650
- bindHoverAnimation(animation);
3651
- break;
3652
3650
  case "scrollInView":
3653
3651
  bindScrollInViewAnimation(animation);
3654
3652
  break;
@@ -3704,32 +3702,6 @@ function triggerAnimation(animation) {
3704
3702
  });
3705
3703
  });
3706
3704
  }
3707
- function bindHoverAnimation(animation) {
3708
- const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
3709
- if (!elements.length) {
3710
- warnElementNotPresent(animation.elementId || animation.id || "");
3711
- return;
3712
- }
3713
- Array.from(elements).forEach((element) => {
3714
- augmentAnimation(animation, element);
3715
- const defaultState = animation.steps[0].styles;
3716
- const hoverState = animation.steps[1].styles;
3717
- function attachDefaultState() {
3718
- assign(element.style, defaultState);
3719
- }
3720
- function attachHoverState() {
3721
- assign(element.style, hoverState);
3722
- }
3723
- attachDefaultState();
3724
- element.addEventListener("mouseenter", attachHoverState);
3725
- element.addEventListener("mouseleave", attachDefaultState);
3726
- setTimeout(() => {
3727
- element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
3728
- if (animation.delay)
3729
- element.style.transitionDelay = animation.delay + "s";
3730
- });
3731
- });
3732
- }
3733
3705
  function bindScrollInViewAnimation(animation) {
3734
3706
  const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
3735
3707
  if (!elements.length) {
@@ -3959,7 +3931,7 @@ const BlockStyles = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pro
3959
3931
  props
3960
3932
  ]));
3961
3933
  const css = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
3962
- var _a;
3934
+ var _a, _b, _c;
3963
3935
  const [props2] = useLexicalScope();
3964
3936
  const processedBlock = getProcessedBlock({
3965
3937
  block: props2.block,
@@ -3992,10 +3964,24 @@ const BlockStyles = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pro
3992
3964
  styles: smallStyles,
3993
3965
  mediaQuery: getMaxWidthQueryForSize("small", sizesWithUpdatedBreakpoints)
3994
3966
  }) : "";
3967
+ const hoverAnimation = processedBlock.animations && processedBlock.animations.find((item) => item.trigger === "hover");
3968
+ let hoverStylesClass = "";
3969
+ if (hoverAnimation) {
3970
+ const hoverStyles = ((_c = (_b = hoverAnimation.steps) == null ? void 0 : _b[1]) == null ? void 0 : _c.styles) || {};
3971
+ hoverStylesClass = createCssClass({
3972
+ className: `${className}:hover`,
3973
+ styles: {
3974
+ ...hoverStyles,
3975
+ transition: `all ${hoverAnimation.duration}s ${camelCaseToKebabCase(hoverAnimation.easing)}`,
3976
+ transitionDelay: hoverAnimation.delay ? `${hoverAnimation.delay}s` : "0s"
3977
+ }
3978
+ }) || "";
3979
+ }
3995
3980
  return [
3996
3981
  largeStylesClass,
3997
3982
  mediumStylesClass,
3998
- smallStylesClass
3983
+ smallStylesClass,
3984
+ hoverStylesClass
3999
3985
  ].join(" ");
4000
3986
  }, "BlockStyles_component_css_useComputed_b9Ru8qTcNik", [
4001
3987
  props
@@ -4339,7 +4325,7 @@ const Block = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
4339
4325
  const blockId = processedBlock2.value.id;
4340
4326
  const animations = processedBlock2.value.animations;
4341
4327
  if (animations && blockId)
4342
- bindAnimations(animations.filter((item) => item.trigger !== "hover").map((animation) => ({
4328
+ bindAnimations(animations.map((animation) => ({
4343
4329
  ...animation,
4344
4330
  elementId: blockId
4345
4331
  })));
@@ -7417,12 +7403,11 @@ async function fetchEntries(options) {
7417
7403
  return null;
7418
7404
  }
7419
7405
  }
7420
- function isPreviewing(search) {
7421
- if (!isBrowser())
7422
- return false;
7423
- const normalizedSearch = getSearchString(search || window.location.search);
7424
- if (isEditing(normalizedSearch))
7406
+ function isPreviewing(_search) {
7407
+ const search = _search || (isBrowser() ? window.location.search : void 0);
7408
+ if (!search)
7425
7409
  return false;
7410
+ const normalizedSearch = getSearchString(search);
7426
7411
  return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
7427
7412
  }
7428
7413
  function uuidv4() {
@@ -7628,7 +7613,7 @@ function isFromTrustedHost(trustedHosts, e) {
7628
7613
  const url = new URL(e.origin), hostname = url.hostname;
7629
7614
  return (trustedHosts || DEFAULT_TRUSTED_HOSTS).findIndex((trustedHost) => trustedHost.startsWith("*.") ? hostname.endsWith(trustedHost.slice(1)) : trustedHost === hostname) > -1;
7630
7615
  }
7631
- const SDK_VERSION = "0.14.14";
7616
+ const SDK_VERSION = "0.14.16";
7632
7617
  const registry = {};
7633
7618
  function register(type, info) {
7634
7619
  let typeList = registry[type];
@@ -8018,7 +8003,7 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
8018
8003
  variationId: variationId !== contentId ? variationId : void 0
8019
8004
  });
8020
8005
  }
8021
- if (isPreviewing()) {
8006
+ if (isPreviewing() && !isEditing()) {
8022
8007
  if (element)
8023
8008
  element.dispatchEvent(new CustomEvent("initpreviewingbldr"));
8024
8009
  }
@@ -126,7 +126,8 @@ function isIframe() {
126
126
  return isBrowser() && window.self !== window.top;
127
127
  }
128
128
  function isEditing(search) {
129
- return isIframe() && getSearchString(search || window.location.search).indexOf("builder.frameEditing=") !== -1;
129
+ return isIframe() && // accessing window.location.search is safe here because `isIframe()` is only `true` if we're in a browser.
130
+ getSearchString(search || window.location.search).indexOf("builder.frameEditing=") !== -1;
130
131
  }
131
132
  const getLocation = () => {
132
133
  if (isBrowser()) {
@@ -289,15 +290,35 @@ if (typeof output === 'object' && output !== null) {
289
290
  output;
290
291
  `;
291
292
  };
293
+ let IVM_INSTANCE = null;
294
+ const getIvm = () => {
295
+ try {
296
+ if (IVM_INSTANCE)
297
+ ;
298
+ const dynRequiredIvm = nodeEvaluate.safeDynamicRequire("isolated-vm");
299
+ if (dynRequiredIvm)
300
+ return dynRequiredIvm;
301
+ } catch (error) {
302
+ logger.error("isolated-vm import error.", error);
303
+ }
304
+ throw new Error(`${MSG_PREFIX}could not import \`isolated-vm\` module for safe script execution on Node server.
305
+
306
+ In certain Node environments, the SDK requires additional initialization steps. This can be achieved by
307
+ importing and calling \`initializeNodeRuntime()\` from "@builder.io/sdk-react/node/init". This must be done in
308
+ a server-only execution path within your application.
309
+
310
+ Please see the documentation for more information: https://builder.io/c/docs/integration-tips#enabling-data-bindings-in-node-environments
311
+ `);
312
+ };
292
313
  const getIsolateContext = () => {
293
- const ivm = nodeEvaluate.safeDynamicRequire("isolated-vm");
314
+ const ivm = getIvm();
294
315
  const isolate = new ivm.Isolate({
295
316
  memoryLimit: 128
296
317
  });
297
318
  return isolate.createContextSync();
298
319
  };
299
320
  const runInNode = ({ code, builder, context, event, localState, rootSetState, rootState }) => {
300
- const ivm = nodeEvaluate.safeDynamicRequire("isolated-vm");
321
+ const ivm = getIvm();
301
322
  const state = fastClone({
302
323
  ...rootState,
303
324
  ...localState
@@ -519,9 +540,6 @@ function bindAnimations(animations) {
519
540
  case "pageLoad":
520
541
  triggerAnimation(animation);
521
542
  break;
522
- case "hover":
523
- bindHoverAnimation(animation);
524
- break;
525
543
  case "scrollInView":
526
544
  bindScrollInViewAnimation(animation);
527
545
  break;
@@ -577,32 +595,6 @@ function triggerAnimation(animation) {
577
595
  });
578
596
  });
579
597
  }
580
- function bindHoverAnimation(animation) {
581
- const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
582
- if (!elements.length) {
583
- warnElementNotPresent(animation.elementId || animation.id || "");
584
- return;
585
- }
586
- Array.from(elements).forEach((element) => {
587
- augmentAnimation(animation, element);
588
- const defaultState = animation.steps[0].styles;
589
- const hoverState = animation.steps[1].styles;
590
- function attachDefaultState() {
591
- assign(element.style, defaultState);
592
- }
593
- function attachHoverState() {
594
- assign(element.style, hoverState);
595
- }
596
- attachDefaultState();
597
- element.addEventListener("mouseenter", attachHoverState);
598
- element.addEventListener("mouseleave", attachDefaultState);
599
- setTimeout(() => {
600
- element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
601
- if (animation.delay)
602
- element.style.transitionDelay = animation.delay + "s";
603
- });
604
- });
605
- }
606
598
  function bindScrollInViewAnimation(animation) {
607
599
  const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
608
600
  if (!elements.length) {
@@ -832,7 +824,7 @@ const BlockStyles = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlin
832
824
  props
833
825
  ]));
834
826
  const css = qwik.useComputedQrl(/* @__PURE__ */ qwik.inlinedQrl(() => {
835
- var _a;
827
+ var _a, _b, _c;
836
828
  const [props2] = qwik.useLexicalScope();
837
829
  const processedBlock = getProcessedBlock({
838
830
  block: props2.block,
@@ -865,10 +857,24 @@ const BlockStyles = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlin
865
857
  styles: smallStyles,
866
858
  mediaQuery: getMaxWidthQueryForSize("small", sizesWithUpdatedBreakpoints)
867
859
  }) : "";
860
+ const hoverAnimation = processedBlock.animations && processedBlock.animations.find((item) => item.trigger === "hover");
861
+ let hoverStylesClass = "";
862
+ if (hoverAnimation) {
863
+ const hoverStyles = ((_c = (_b = hoverAnimation.steps) == null ? void 0 : _b[1]) == null ? void 0 : _c.styles) || {};
864
+ hoverStylesClass = createCssClass({
865
+ className: `${className}:hover`,
866
+ styles: {
867
+ ...hoverStyles,
868
+ transition: `all ${hoverAnimation.duration}s ${camelCaseToKebabCase(hoverAnimation.easing)}`,
869
+ transitionDelay: hoverAnimation.delay ? `${hoverAnimation.delay}s` : "0s"
870
+ }
871
+ }) || "";
872
+ }
868
873
  return [
869
874
  largeStylesClass,
870
875
  mediumStylesClass,
871
- smallStylesClass
876
+ smallStylesClass,
877
+ hoverStylesClass
872
878
  ].join(" ");
873
879
  }, "BlockStyles_component_css_useComputed_b9Ru8qTcNik", [
874
880
  props
@@ -1212,7 +1218,7 @@ const Block = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl(
1212
1218
  const blockId = processedBlock2.value.id;
1213
1219
  const animations = processedBlock2.value.animations;
1214
1220
  if (animations && blockId)
1215
- bindAnimations(animations.filter((item) => item.trigger !== "hover").map((animation) => ({
1221
+ bindAnimations(animations.map((animation) => ({
1216
1222
  ...animation,
1217
1223
  elementId: blockId
1218
1224
  })));
@@ -4290,12 +4296,11 @@ async function fetchEntries(options) {
4290
4296
  return null;
4291
4297
  }
4292
4298
  }
4293
- function isPreviewing(search) {
4294
- if (!isBrowser())
4295
- return false;
4296
- const normalizedSearch = getSearchString(search || window.location.search);
4297
- if (isEditing(normalizedSearch))
4299
+ function isPreviewing(_search) {
4300
+ const search = _search || (isBrowser() ? window.location.search : void 0);
4301
+ if (!search)
4298
4302
  return false;
4303
+ const normalizedSearch = getSearchString(search);
4299
4304
  return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
4300
4305
  }
4301
4306
  function uuidv4() {
@@ -4501,7 +4506,7 @@ function isFromTrustedHost(trustedHosts, e) {
4501
4506
  const url = new URL(e.origin), hostname = url.hostname;
4502
4507
  return (trustedHosts || DEFAULT_TRUSTED_HOSTS).findIndex((trustedHost) => trustedHost.startsWith("*.") ? hostname.endsWith(trustedHost.slice(1)) : trustedHost === hostname) > -1;
4503
4508
  }
4504
- const SDK_VERSION = "0.14.14";
4509
+ const SDK_VERSION = "0.14.16";
4505
4510
  const registry = {};
4506
4511
  function register(type, info) {
4507
4512
  let typeList = registry[type];
@@ -4891,7 +4896,7 @@ const EnableEditor = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inli
4891
4896
  variationId: variationId !== contentId ? variationId : void 0
4892
4897
  });
4893
4898
  }
4894
- if (isPreviewing()) {
4899
+ if (isPreviewing() && !isEditing()) {
4895
4900
  if (element)
4896
4901
  element.dispatchEvent(new CustomEvent("initpreviewingbldr"));
4897
4902
  }
@@ -124,7 +124,8 @@ function isIframe() {
124
124
  return isBrowser() && window.self !== window.top;
125
125
  }
126
126
  function isEditing(search) {
127
- return isIframe() && getSearchString(search || window.location.search).indexOf("builder.frameEditing=") !== -1;
127
+ return isIframe() && // accessing window.location.search is safe here because `isIframe()` is only `true` if we're in a browser.
128
+ getSearchString(search || window.location.search).indexOf("builder.frameEditing=") !== -1;
128
129
  }
129
130
  const getLocation = () => {
130
131
  if (isBrowser()) {
@@ -287,15 +288,35 @@ if (typeof output === 'object' && output !== null) {
287
288
  output;
288
289
  `;
289
290
  };
291
+ let IVM_INSTANCE = null;
292
+ const getIvm = () => {
293
+ try {
294
+ if (IVM_INSTANCE)
295
+ ;
296
+ const dynRequiredIvm = safeDynamicRequire("isolated-vm");
297
+ if (dynRequiredIvm)
298
+ return dynRequiredIvm;
299
+ } catch (error) {
300
+ logger.error("isolated-vm import error.", error);
301
+ }
302
+ throw new Error(`${MSG_PREFIX}could not import \`isolated-vm\` module for safe script execution on Node server.
303
+
304
+ In certain Node environments, the SDK requires additional initialization steps. This can be achieved by
305
+ importing and calling \`initializeNodeRuntime()\` from "@builder.io/sdk-react/node/init". This must be done in
306
+ a server-only execution path within your application.
307
+
308
+ Please see the documentation for more information: https://builder.io/c/docs/integration-tips#enabling-data-bindings-in-node-environments
309
+ `);
310
+ };
290
311
  const getIsolateContext = () => {
291
- const ivm = safeDynamicRequire("isolated-vm");
312
+ const ivm = getIvm();
292
313
  const isolate = new ivm.Isolate({
293
314
  memoryLimit: 128
294
315
  });
295
316
  return isolate.createContextSync();
296
317
  };
297
318
  const runInNode = ({ code, builder, context, event, localState, rootSetState, rootState }) => {
298
- const ivm = safeDynamicRequire("isolated-vm");
319
+ const ivm = getIvm();
299
320
  const state = fastClone({
300
321
  ...rootState,
301
322
  ...localState
@@ -517,9 +538,6 @@ function bindAnimations(animations) {
517
538
  case "pageLoad":
518
539
  triggerAnimation(animation);
519
540
  break;
520
- case "hover":
521
- bindHoverAnimation(animation);
522
- break;
523
541
  case "scrollInView":
524
542
  bindScrollInViewAnimation(animation);
525
543
  break;
@@ -575,32 +593,6 @@ function triggerAnimation(animation) {
575
593
  });
576
594
  });
577
595
  }
578
- function bindHoverAnimation(animation) {
579
- const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
580
- if (!elements.length) {
581
- warnElementNotPresent(animation.elementId || animation.id || "");
582
- return;
583
- }
584
- Array.from(elements).forEach((element) => {
585
- augmentAnimation(animation, element);
586
- const defaultState = animation.steps[0].styles;
587
- const hoverState = animation.steps[1].styles;
588
- function attachDefaultState() {
589
- assign(element.style, defaultState);
590
- }
591
- function attachHoverState() {
592
- assign(element.style, hoverState);
593
- }
594
- attachDefaultState();
595
- element.addEventListener("mouseenter", attachHoverState);
596
- element.addEventListener("mouseleave", attachDefaultState);
597
- setTimeout(() => {
598
- element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
599
- if (animation.delay)
600
- element.style.transitionDelay = animation.delay + "s";
601
- });
602
- });
603
- }
604
596
  function bindScrollInViewAnimation(animation) {
605
597
  const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
606
598
  if (!elements.length) {
@@ -830,7 +822,7 @@ const BlockStyles = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pro
830
822
  props
831
823
  ]));
832
824
  const css = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
833
- var _a;
825
+ var _a, _b, _c;
834
826
  const [props2] = useLexicalScope();
835
827
  const processedBlock = getProcessedBlock({
836
828
  block: props2.block,
@@ -863,10 +855,24 @@ const BlockStyles = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pro
863
855
  styles: smallStyles,
864
856
  mediaQuery: getMaxWidthQueryForSize("small", sizesWithUpdatedBreakpoints)
865
857
  }) : "";
858
+ const hoverAnimation = processedBlock.animations && processedBlock.animations.find((item) => item.trigger === "hover");
859
+ let hoverStylesClass = "";
860
+ if (hoverAnimation) {
861
+ const hoverStyles = ((_c = (_b = hoverAnimation.steps) == null ? void 0 : _b[1]) == null ? void 0 : _c.styles) || {};
862
+ hoverStylesClass = createCssClass({
863
+ className: `${className}:hover`,
864
+ styles: {
865
+ ...hoverStyles,
866
+ transition: `all ${hoverAnimation.duration}s ${camelCaseToKebabCase(hoverAnimation.easing)}`,
867
+ transitionDelay: hoverAnimation.delay ? `${hoverAnimation.delay}s` : "0s"
868
+ }
869
+ }) || "";
870
+ }
866
871
  return [
867
872
  largeStylesClass,
868
873
  mediumStylesClass,
869
- smallStylesClass
874
+ smallStylesClass,
875
+ hoverStylesClass
870
876
  ].join(" ");
871
877
  }, "BlockStyles_component_css_useComputed_b9Ru8qTcNik", [
872
878
  props
@@ -1210,7 +1216,7 @@ const Block = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
1210
1216
  const blockId = processedBlock2.value.id;
1211
1217
  const animations = processedBlock2.value.animations;
1212
1218
  if (animations && blockId)
1213
- bindAnimations(animations.filter((item) => item.trigger !== "hover").map((animation) => ({
1219
+ bindAnimations(animations.map((animation) => ({
1214
1220
  ...animation,
1215
1221
  elementId: blockId
1216
1222
  })));
@@ -4288,12 +4294,11 @@ async function fetchEntries(options) {
4288
4294
  return null;
4289
4295
  }
4290
4296
  }
4291
- function isPreviewing(search) {
4292
- if (!isBrowser())
4293
- return false;
4294
- const normalizedSearch = getSearchString(search || window.location.search);
4295
- if (isEditing(normalizedSearch))
4297
+ function isPreviewing(_search) {
4298
+ const search = _search || (isBrowser() ? window.location.search : void 0);
4299
+ if (!search)
4296
4300
  return false;
4301
+ const normalizedSearch = getSearchString(search);
4297
4302
  return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
4298
4303
  }
4299
4304
  function uuidv4() {
@@ -4499,7 +4504,7 @@ function isFromTrustedHost(trustedHosts, e) {
4499
4504
  const url = new URL(e.origin), hostname = url.hostname;
4500
4505
  return (trustedHosts || DEFAULT_TRUSTED_HOSTS).findIndex((trustedHost) => trustedHost.startsWith("*.") ? hostname.endsWith(trustedHost.slice(1)) : trustedHost === hostname) > -1;
4501
4506
  }
4502
- const SDK_VERSION = "0.14.14";
4507
+ const SDK_VERSION = "0.14.16";
4503
4508
  const registry = {};
4504
4509
  function register(type, info) {
4505
4510
  let typeList = registry[type];
@@ -4889,7 +4894,7 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
4889
4894
  variationId: variationId !== contentId ? variationId : void 0
4890
4895
  });
4891
4896
  }
4892
- if (isPreviewing()) {
4897
+ if (isPreviewing() && !isEditing()) {
4893
4898
  if (element)
4894
4899
  element.dispatchEvent(new CustomEvent("initpreviewingbldr"));
4895
4900
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builder.io/sdk-qwik",
3
- "version": "0.14.14",
3
+ "version": "0.14.16",
4
4
  "homepage": "https://github.com/BuilderIO/builder/tree/main/packages/sdks/output/qwik",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,5 +1,5 @@
1
1
  import type { BuilderAnimation } from '../../types/builder-block';
2
+ export declare const camelCaseToKebabCase: (str?: string) => string;
2
3
  export declare function bindAnimations(animations: BuilderAnimation[]): void;
3
4
  export declare function triggerAnimation(animation: BuilderAnimation): void;
4
- export declare function bindHoverAnimation(animation: BuilderAnimation): void;
5
5
  export declare function bindScrollInViewAnimation(animation: BuilderAnimation): void;
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.14.14";
1
+ export declare const SDK_VERSION = "0.14.16";
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This function initializes the SDK on a Node server. It handles importing the
3
+ * `isolated-vm` package which is needed for dynamic bindings.
4
+ *
5
+ * NOTE: this function cannot be called on the client. You must call this function
6
+ * from a server-only location, such as:
7
+ * - The NextJS Pages router's `_document.tsx`
8
+ * - Your Remix route's `loader`
9
+ */
10
+ export declare const initializeNodeRuntime: () => void;
@@ -1,2 +1,8 @@
1
1
  import type { ExecutorArgs } from '../helpers';
2
+ /**
3
+ * Set the `isolated-vm` instance to be used by the node runtime.
4
+ * This is useful for environments that are not able to rely on our
5
+ * `safeDynamicRequire` trick to import the `isolated-vm` package.
6
+ */
7
+ export declare const setIvm: (ivm: typeof import('isolated-vm')) => void;
2
8
  export declare const runInNode: ({ code, builder, context, event, localState, rootSetState, rootState }: ExecutorArgs) => any;
@@ -131,9 +131,9 @@ export interface GetContentOptions {
131
131
  /**
132
132
  * Optional override of the `fetch` function. (Defaults to global `fetch`)
133
133
  */
134
- fetch?: typeof global.fetch;
134
+ fetch?: (input: string, init?: object) => Promise<any>;
135
135
  /**
136
- * Optional fetch options to be passed to the `fetch` function.
136
+ * Optional fetch options to be passed as the second argument to the `fetch` function.
137
137
  */
138
- fetchOptions?: RequestInit;
138
+ fetchOptions?: object;
139
139
  }
@@ -1,2 +1,2 @@
1
1
  import type { Search } from '../helpers/search/search';
2
- export declare function isPreviewing(search?: Search): boolean;
2
+ export declare function isPreviewing(_search?: Search): boolean;
@@ -1,3 +1,4 @@
1
+ export declare const MSG_PREFIX = "[Builder.io]: ";
1
2
  export declare const logger: {
2
3
  log: (...message: any[]) => void;
3
4
  error: (...message: any[]) => void;