@builder.io/sdk-qwik 0.14.15 → 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.15";
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.15";
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.15";
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.15";
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()) {
@@ -539,9 +540,6 @@ function bindAnimations(animations) {
539
540
  case "pageLoad":
540
541
  triggerAnimation(animation);
541
542
  break;
542
- case "hover":
543
- bindHoverAnimation(animation);
544
- break;
545
543
  case "scrollInView":
546
544
  bindScrollInViewAnimation(animation);
547
545
  break;
@@ -597,32 +595,6 @@ function triggerAnimation(animation) {
597
595
  });
598
596
  });
599
597
  }
600
- function bindHoverAnimation(animation) {
601
- const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
602
- if (!elements.length) {
603
- warnElementNotPresent(animation.elementId || animation.id || "");
604
- return;
605
- }
606
- Array.from(elements).forEach((element) => {
607
- augmentAnimation(animation, element);
608
- const defaultState = animation.steps[0].styles;
609
- const hoverState = animation.steps[1].styles;
610
- function attachDefaultState() {
611
- assign(element.style, defaultState);
612
- }
613
- function attachHoverState() {
614
- assign(element.style, hoverState);
615
- }
616
- attachDefaultState();
617
- element.addEventListener("mouseenter", attachHoverState);
618
- element.addEventListener("mouseleave", attachDefaultState);
619
- setTimeout(() => {
620
- element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
621
- if (animation.delay)
622
- element.style.transitionDelay = animation.delay + "s";
623
- });
624
- });
625
- }
626
598
  function bindScrollInViewAnimation(animation) {
627
599
  const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
628
600
  if (!elements.length) {
@@ -852,7 +824,7 @@ const BlockStyles = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlin
852
824
  props
853
825
  ]));
854
826
  const css = qwik.useComputedQrl(/* @__PURE__ */ qwik.inlinedQrl(() => {
855
- var _a;
827
+ var _a, _b, _c;
856
828
  const [props2] = qwik.useLexicalScope();
857
829
  const processedBlock = getProcessedBlock({
858
830
  block: props2.block,
@@ -885,10 +857,24 @@ const BlockStyles = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlin
885
857
  styles: smallStyles,
886
858
  mediaQuery: getMaxWidthQueryForSize("small", sizesWithUpdatedBreakpoints)
887
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
+ }
888
873
  return [
889
874
  largeStylesClass,
890
875
  mediumStylesClass,
891
- smallStylesClass
876
+ smallStylesClass,
877
+ hoverStylesClass
892
878
  ].join(" ");
893
879
  }, "BlockStyles_component_css_useComputed_b9Ru8qTcNik", [
894
880
  props
@@ -1232,7 +1218,7 @@ const Block = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl(
1232
1218
  const blockId = processedBlock2.value.id;
1233
1219
  const animations = processedBlock2.value.animations;
1234
1220
  if (animations && blockId)
1235
- bindAnimations(animations.filter((item) => item.trigger !== "hover").map((animation) => ({
1221
+ bindAnimations(animations.map((animation) => ({
1236
1222
  ...animation,
1237
1223
  elementId: blockId
1238
1224
  })));
@@ -4310,12 +4296,11 @@ async function fetchEntries(options) {
4310
4296
  return null;
4311
4297
  }
4312
4298
  }
4313
- function isPreviewing(search) {
4314
- if (!isBrowser())
4315
- return false;
4316
- const normalizedSearch = getSearchString(search || window.location.search);
4317
- if (isEditing(normalizedSearch))
4299
+ function isPreviewing(_search) {
4300
+ const search = _search || (isBrowser() ? window.location.search : void 0);
4301
+ if (!search)
4318
4302
  return false;
4303
+ const normalizedSearch = getSearchString(search);
4319
4304
  return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
4320
4305
  }
4321
4306
  function uuidv4() {
@@ -4521,7 +4506,7 @@ function isFromTrustedHost(trustedHosts, e) {
4521
4506
  const url = new URL(e.origin), hostname = url.hostname;
4522
4507
  return (trustedHosts || DEFAULT_TRUSTED_HOSTS).findIndex((trustedHost) => trustedHost.startsWith("*.") ? hostname.endsWith(trustedHost.slice(1)) : trustedHost === hostname) > -1;
4523
4508
  }
4524
- const SDK_VERSION = "0.14.15";
4509
+ const SDK_VERSION = "0.14.16";
4525
4510
  const registry = {};
4526
4511
  function register(type, info) {
4527
4512
  let typeList = registry[type];
@@ -4911,7 +4896,7 @@ const EnableEditor = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inli
4911
4896
  variationId: variationId !== contentId ? variationId : void 0
4912
4897
  });
4913
4898
  }
4914
- if (isPreviewing()) {
4899
+ if (isPreviewing() && !isEditing()) {
4915
4900
  if (element)
4916
4901
  element.dispatchEvent(new CustomEvent("initpreviewingbldr"));
4917
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()) {
@@ -537,9 +538,6 @@ function bindAnimations(animations) {
537
538
  case "pageLoad":
538
539
  triggerAnimation(animation);
539
540
  break;
540
- case "hover":
541
- bindHoverAnimation(animation);
542
- break;
543
541
  case "scrollInView":
544
542
  bindScrollInViewAnimation(animation);
545
543
  break;
@@ -595,32 +593,6 @@ function triggerAnimation(animation) {
595
593
  });
596
594
  });
597
595
  }
598
- function bindHoverAnimation(animation) {
599
- const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
600
- if (!elements.length) {
601
- warnElementNotPresent(animation.elementId || animation.id || "");
602
- return;
603
- }
604
- Array.from(elements).forEach((element) => {
605
- augmentAnimation(animation, element);
606
- const defaultState = animation.steps[0].styles;
607
- const hoverState = animation.steps[1].styles;
608
- function attachDefaultState() {
609
- assign(element.style, defaultState);
610
- }
611
- function attachHoverState() {
612
- assign(element.style, hoverState);
613
- }
614
- attachDefaultState();
615
- element.addEventListener("mouseenter", attachHoverState);
616
- element.addEventListener("mouseleave", attachDefaultState);
617
- setTimeout(() => {
618
- element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
619
- if (animation.delay)
620
- element.style.transitionDelay = animation.delay + "s";
621
- });
622
- });
623
- }
624
596
  function bindScrollInViewAnimation(animation) {
625
597
  const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
626
598
  if (!elements.length) {
@@ -850,7 +822,7 @@ const BlockStyles = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pro
850
822
  props
851
823
  ]));
852
824
  const css = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
853
- var _a;
825
+ var _a, _b, _c;
854
826
  const [props2] = useLexicalScope();
855
827
  const processedBlock = getProcessedBlock({
856
828
  block: props2.block,
@@ -883,10 +855,24 @@ const BlockStyles = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pro
883
855
  styles: smallStyles,
884
856
  mediaQuery: getMaxWidthQueryForSize("small", sizesWithUpdatedBreakpoints)
885
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
+ }
886
871
  return [
887
872
  largeStylesClass,
888
873
  mediumStylesClass,
889
- smallStylesClass
874
+ smallStylesClass,
875
+ hoverStylesClass
890
876
  ].join(" ");
891
877
  }, "BlockStyles_component_css_useComputed_b9Ru8qTcNik", [
892
878
  props
@@ -1230,7 +1216,7 @@ const Block = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
1230
1216
  const blockId = processedBlock2.value.id;
1231
1217
  const animations = processedBlock2.value.animations;
1232
1218
  if (animations && blockId)
1233
- bindAnimations(animations.filter((item) => item.trigger !== "hover").map((animation) => ({
1219
+ bindAnimations(animations.map((animation) => ({
1234
1220
  ...animation,
1235
1221
  elementId: blockId
1236
1222
  })));
@@ -4308,12 +4294,11 @@ async function fetchEntries(options) {
4308
4294
  return null;
4309
4295
  }
4310
4296
  }
4311
- function isPreviewing(search) {
4312
- if (!isBrowser())
4313
- return false;
4314
- const normalizedSearch = getSearchString(search || window.location.search);
4315
- if (isEditing(normalizedSearch))
4297
+ function isPreviewing(_search) {
4298
+ const search = _search || (isBrowser() ? window.location.search : void 0);
4299
+ if (!search)
4316
4300
  return false;
4301
+ const normalizedSearch = getSearchString(search);
4317
4302
  return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
4318
4303
  }
4319
4304
  function uuidv4() {
@@ -4519,7 +4504,7 @@ function isFromTrustedHost(trustedHosts, e) {
4519
4504
  const url = new URL(e.origin), hostname = url.hostname;
4520
4505
  return (trustedHosts || DEFAULT_TRUSTED_HOSTS).findIndex((trustedHost) => trustedHost.startsWith("*.") ? hostname.endsWith(trustedHost.slice(1)) : trustedHost === hostname) > -1;
4521
4506
  }
4522
- const SDK_VERSION = "0.14.15";
4507
+ const SDK_VERSION = "0.14.16";
4523
4508
  const registry = {};
4524
4509
  function register(type, info) {
4525
4510
  let typeList = registry[type];
@@ -4909,7 +4894,7 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
4909
4894
  variationId: variationId !== contentId ? variationId : void 0
4910
4895
  });
4911
4896
  }
4912
- if (isPreviewing()) {
4897
+ if (isPreviewing() && !isEditing()) {
4913
4898
  if (element)
4914
4899
  element.dispatchEvent(new CustomEvent("initpreviewingbldr"));
4915
4900
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builder.io/sdk-qwik",
3
- "version": "0.14.15",
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.15";
1
+ export declare const SDK_VERSION = "0.14.16";
@@ -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;