@builder.io/sdk-solid 1.0.21 → 1.0.23

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/lib/edge/dev.jsx CHANGED
@@ -160,7 +160,8 @@ function isIframe() {
160
160
 
161
161
  // src/functions/is-editing.ts
162
162
  function isEditing(search) {
163
- return isIframe() && (TARGET === "reactNative" || getSearchString(search || window.location.search).indexOf("builder.frameEditing=") !== -1);
163
+ return isIframe() && (TARGET === "reactNative" || // accessing window.location.search is safe here because `isIframe()` is only `true` if we're in a browser.
164
+ getSearchString(search || window.location.search).indexOf("builder.frameEditing=") !== -1);
164
165
  }
165
166
 
166
167
  // src/functions/track/helpers.ts
@@ -3520,7 +3521,6 @@ function evaluate({
3520
3521
  enableCache
3521
3522
  }) {
3522
3523
  if (code === "") {
3523
- logger.warn("Skipping evaluation of empty code block.");
3524
3524
  return void 0;
3525
3525
  }
3526
3526
  const args = {
@@ -3678,9 +3678,6 @@ function bindAnimations(animations) {
3678
3678
  case "pageLoad":
3679
3679
  triggerAnimation(animation);
3680
3680
  break;
3681
- case "hover":
3682
- bindHoverAnimation(animation);
3683
- break;
3684
3681
  case "scrollInView":
3685
3682
  bindScrollInViewAnimation(animation);
3686
3683
  break;
@@ -3739,33 +3736,6 @@ function triggerAnimation(animation) {
3739
3736
  });
3740
3737
  });
3741
3738
  }
3742
- function bindHoverAnimation(animation) {
3743
- const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
3744
- if (!elements.length) {
3745
- warnElementNotPresent(animation.elementId || animation.id || "");
3746
- return;
3747
- }
3748
- Array.from(elements).forEach((element) => {
3749
- augmentAnimation(animation, element);
3750
- const defaultState = animation.steps[0].styles;
3751
- const hoverState = animation.steps[1].styles;
3752
- function attachDefaultState() {
3753
- assign(element.style, defaultState);
3754
- }
3755
- function attachHoverState() {
3756
- assign(element.style, hoverState);
3757
- }
3758
- attachDefaultState();
3759
- element.addEventListener("mouseenter", attachHoverState);
3760
- element.addEventListener("mouseleave", attachDefaultState);
3761
- setTimeout(() => {
3762
- element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
3763
- if (animation.delay) {
3764
- element.style.transitionDelay = animation.delay + "s";
3765
- }
3766
- });
3767
- });
3768
- }
3769
3739
  function bindScrollInViewAnimation(animation) {
3770
3740
  const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
3771
3741
  if (!elements.length) {
@@ -4076,7 +4046,27 @@ function BlockStyles(props) {
4076
4046
  sizesWithUpdatedBreakpoints
4077
4047
  )
4078
4048
  }) : "";
4079
- return [largeStylesClass, mediumStylesClass, smallStylesClass].join(" ");
4049
+ const hoverAnimation = processedBlock.animations && processedBlock.animations.find((item) => item.trigger === "hover");
4050
+ let hoverStylesClass = "";
4051
+ if (hoverAnimation) {
4052
+ const hoverStyles = hoverAnimation.steps?.[1]?.styles || {};
4053
+ hoverStylesClass = createCssClass({
4054
+ className: `${className}:hover`,
4055
+ styles: {
4056
+ ...hoverStyles,
4057
+ transition: `all ${hoverAnimation.duration}s ${camelCaseToKebabCase(
4058
+ hoverAnimation.easing
4059
+ )}`,
4060
+ transitionDelay: hoverAnimation.delay ? `${hoverAnimation.delay}s` : "0s"
4061
+ }
4062
+ }) || "";
4063
+ }
4064
+ return [
4065
+ largeStylesClass,
4066
+ mediumStylesClass,
4067
+ smallStylesClass,
4068
+ hoverStylesClass
4069
+ ].join(" ");
4080
4070
  });
4081
4071
  return <Show2 when={TARGET !== "reactNative" && css5() && canShowBlock()}><Inlined_styles_default id="builderio-block" styles={css5()} /></Show2>;
4082
4072
  }
@@ -4355,7 +4345,7 @@ function Block(props) {
4355
4345
  const animations = processedBlock().animations;
4356
4346
  if (animations && blockId) {
4357
4347
  bindAnimations(
4358
- animations.filter((item) => item.trigger !== "hover").map((animation) => ({
4348
+ animations.map((animation) => ({
4359
4349
  ...animation,
4360
4350
  elementId: blockId
4361
4351
  }))
@@ -6930,14 +6920,12 @@ async function fetchEntries(options) {
6930
6920
  }
6931
6921
 
6932
6922
  // src/functions/is-previewing.ts
6933
- function isPreviewing(search) {
6934
- if (!isBrowser()) {
6935
- return false;
6936
- }
6937
- const normalizedSearch = getSearchString(search || window.location.search);
6938
- if (isEditing(normalizedSearch)) {
6923
+ function isPreviewing(_search) {
6924
+ const search = _search || (isBrowser() ? window.location.search : void 0);
6925
+ if (!search) {
6939
6926
  return false;
6940
6927
  }
6928
+ const normalizedSearch = getSearchString(search);
6941
6929
  return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
6942
6930
  }
6943
6931
 
@@ -7188,7 +7176,7 @@ function isFromTrustedHost(trustedHosts, e) {
7188
7176
  }
7189
7177
 
7190
7178
  // src/constants/sdk-version.ts
7191
- var SDK_VERSION = "1.0.21";
7179
+ var SDK_VERSION = "1.0.23";
7192
7180
 
7193
7181
  // src/functions/register.ts
7194
7182
  var registry = {};
@@ -7580,7 +7568,7 @@ function EnableEditor(props) {
7580
7568
  variationId: variationId !== contentId ? variationId : void 0
7581
7569
  });
7582
7570
  }
7583
- if (isPreviewing()) {
7571
+ if (isPreviewing() && !isEditing()) {
7584
7572
  const searchParams = new URL(location.href).searchParams;
7585
7573
  const searchParamPreviewModel = searchParams.get("builder.preview");
7586
7574
  const searchParamPreviewId = searchParams.get(
package/lib/edge/index.js CHANGED
@@ -170,7 +170,8 @@ function isIframe() {
170
170
 
171
171
  // src/functions/is-editing.ts
172
172
  function isEditing(search) {
173
- return isIframe() && (TARGET === "reactNative" || getSearchString(search || window.location.search).indexOf("builder.frameEditing=") !== -1);
173
+ return isIframe() && (TARGET === "reactNative" || // accessing window.location.search is safe here because `isIframe()` is only `true` if we're in a browser.
174
+ getSearchString(search || window.location.search).indexOf("builder.frameEditing=") !== -1);
174
175
  }
175
176
 
176
177
  // src/functions/track/helpers.ts
@@ -3529,7 +3530,6 @@ function evaluate({
3529
3530
  enableCache
3530
3531
  }) {
3531
3532
  if (code === "") {
3532
- logger.warn("Skipping evaluation of empty code block.");
3533
3533
  return void 0;
3534
3534
  }
3535
3535
  const args = {
@@ -3687,9 +3687,6 @@ function bindAnimations(animations) {
3687
3687
  case "pageLoad":
3688
3688
  triggerAnimation(animation);
3689
3689
  break;
3690
- case "hover":
3691
- bindHoverAnimation(animation);
3692
- break;
3693
3690
  case "scrollInView":
3694
3691
  bindScrollInViewAnimation(animation);
3695
3692
  break;
@@ -3747,33 +3744,6 @@ function triggerAnimation(animation) {
3747
3744
  });
3748
3745
  });
3749
3746
  }
3750
- function bindHoverAnimation(animation) {
3751
- const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
3752
- if (!elements.length) {
3753
- warnElementNotPresent(animation.elementId || animation.id || "");
3754
- return;
3755
- }
3756
- Array.from(elements).forEach((element) => {
3757
- augmentAnimation(animation, element);
3758
- const defaultState = animation.steps[0].styles;
3759
- const hoverState = animation.steps[1].styles;
3760
- function attachDefaultState() {
3761
- assign(element.style, defaultState);
3762
- }
3763
- function attachHoverState() {
3764
- assign(element.style, hoverState);
3765
- }
3766
- attachDefaultState();
3767
- element.addEventListener("mouseenter", attachHoverState);
3768
- element.addEventListener("mouseleave", attachDefaultState);
3769
- setTimeout(() => {
3770
- element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
3771
- if (animation.delay) {
3772
- element.style.transitionDelay = animation.delay + "s";
3773
- }
3774
- });
3775
- });
3776
- }
3777
3747
  function bindScrollInViewAnimation(animation) {
3778
3748
  const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
3779
3749
  if (!elements.length) {
@@ -4081,7 +4051,20 @@ function BlockStyles(props) {
4081
4051
  styles: smallStyles,
4082
4052
  mediaQuery: getMaxWidthQueryForSize("small", sizesWithUpdatedBreakpoints)
4083
4053
  }) : "";
4084
- return [largeStylesClass, mediumStylesClass, smallStylesClass].join(" ");
4054
+ const hoverAnimation = processedBlock.animations && processedBlock.animations.find((item) => item.trigger === "hover");
4055
+ let hoverStylesClass = "";
4056
+ if (hoverAnimation) {
4057
+ const hoverStyles = hoverAnimation.steps?.[1]?.styles || {};
4058
+ hoverStylesClass = createCssClass({
4059
+ className: `${className}:hover`,
4060
+ styles: {
4061
+ ...hoverStyles,
4062
+ transition: `all ${hoverAnimation.duration}s ${camelCaseToKebabCase(hoverAnimation.easing)}`,
4063
+ transitionDelay: hoverAnimation.delay ? `${hoverAnimation.delay}s` : "0s"
4064
+ }
4065
+ }) || "";
4066
+ }
4067
+ return [largeStylesClass, mediumStylesClass, smallStylesClass, hoverStylesClass].join(" ");
4085
4068
  });
4086
4069
  return createComponent(Show, {
4087
4070
  get when() {
@@ -4413,7 +4396,7 @@ function Block(props) {
4413
4396
  const blockId = processedBlock().id;
4414
4397
  const animations = processedBlock().animations;
4415
4398
  if (animations && blockId) {
4416
- bindAnimations(animations.filter((item) => item.trigger !== "hover").map((animation) => ({
4399
+ bindAnimations(animations.map((animation) => ({
4417
4400
  ...animation,
4418
4401
  elementId: blockId
4419
4402
  })));
@@ -7333,14 +7316,12 @@ async function fetchEntries(options) {
7333
7316
  }
7334
7317
 
7335
7318
  // src/functions/is-previewing.ts
7336
- function isPreviewing(search) {
7337
- if (!isBrowser()) {
7338
- return false;
7339
- }
7340
- const normalizedSearch = getSearchString(search || window.location.search);
7341
- if (isEditing(normalizedSearch)) {
7319
+ function isPreviewing(_search) {
7320
+ const search = _search || (isBrowser() ? window.location.search : void 0);
7321
+ if (!search) {
7342
7322
  return false;
7343
7323
  }
7324
+ const normalizedSearch = getSearchString(search);
7344
7325
  return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
7345
7326
  }
7346
7327
 
@@ -7588,7 +7569,7 @@ function isFromTrustedHost(trustedHosts, e) {
7588
7569
  }
7589
7570
 
7590
7571
  // src/constants/sdk-version.ts
7591
- var SDK_VERSION = "1.0.21";
7572
+ var SDK_VERSION = "1.0.23";
7592
7573
 
7593
7574
  // src/functions/register.ts
7594
7575
  var registry = {};
@@ -7964,7 +7945,7 @@ function EnableEditor(props) {
7964
7945
  variationId: variationId !== contentId ? variationId : void 0
7965
7946
  });
7966
7947
  }
7967
- if (isPreviewing()) {
7948
+ if (isPreviewing() && !isEditing()) {
7968
7949
  const searchParams = new URL(location.href).searchParams;
7969
7950
  const searchParamPreviewModel = searchParams.get("builder.preview");
7970
7951
  const searchParamPreviewId = searchParams.get(`builder.preview.${searchParamPreviewModel}`);
@@ -159,7 +159,8 @@ function isIframe() {
159
159
 
160
160
  // src/functions/is-editing.ts
161
161
  function isEditing(search) {
162
- return isIframe() && (TARGET === "reactNative" || getSearchString(search || window.location.search).indexOf("builder.frameEditing=") !== -1);
162
+ return isIframe() && (TARGET === "reactNative" || // accessing window.location.search is safe here because `isIframe()` is only `true` if we're in a browser.
163
+ getSearchString(search || window.location.search).indexOf("builder.frameEditing=") !== -1);
163
164
  }
164
165
 
165
166
  // src/functions/track/helpers.ts
@@ -3518,7 +3519,6 @@ function evaluate({
3518
3519
  enableCache
3519
3520
  }) {
3520
3521
  if (code === "") {
3521
- logger.warn("Skipping evaluation of empty code block.");
3522
3522
  return void 0;
3523
3523
  }
3524
3524
  const args = {
@@ -3676,9 +3676,6 @@ function bindAnimations(animations) {
3676
3676
  case "pageLoad":
3677
3677
  triggerAnimation(animation);
3678
3678
  break;
3679
- case "hover":
3680
- bindHoverAnimation(animation);
3681
- break;
3682
3679
  case "scrollInView":
3683
3680
  bindScrollInViewAnimation(animation);
3684
3681
  break;
@@ -3736,33 +3733,6 @@ function triggerAnimation(animation) {
3736
3733
  });
3737
3734
  });
3738
3735
  }
3739
- function bindHoverAnimation(animation) {
3740
- const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
3741
- if (!elements.length) {
3742
- warnElementNotPresent(animation.elementId || animation.id || "");
3743
- return;
3744
- }
3745
- Array.from(elements).forEach((element) => {
3746
- augmentAnimation(animation, element);
3747
- const defaultState = animation.steps[0].styles;
3748
- const hoverState = animation.steps[1].styles;
3749
- function attachDefaultState() {
3750
- assign(element.style, defaultState);
3751
- }
3752
- function attachHoverState() {
3753
- assign(element.style, hoverState);
3754
- }
3755
- attachDefaultState();
3756
- element.addEventListener("mouseenter", attachHoverState);
3757
- element.addEventListener("mouseleave", attachDefaultState);
3758
- setTimeout(() => {
3759
- element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
3760
- if (animation.delay) {
3761
- element.style.transitionDelay = animation.delay + "s";
3762
- }
3763
- });
3764
- });
3765
- }
3766
3736
  function bindScrollInViewAnimation(animation) {
3767
3737
  const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
3768
3738
  if (!elements.length) {
@@ -4070,7 +4040,27 @@ function BlockStyles(props) {
4070
4040
  sizesWithUpdatedBreakpoints
4071
4041
  )
4072
4042
  }) : "";
4073
- return [largeStylesClass, mediumStylesClass, smallStylesClass].join(" ");
4043
+ const hoverAnimation = processedBlock.animations && processedBlock.animations.find((item) => item.trigger === "hover");
4044
+ let hoverStylesClass = "";
4045
+ if (hoverAnimation) {
4046
+ const hoverStyles = hoverAnimation.steps?.[1]?.styles || {};
4047
+ hoverStylesClass = createCssClass({
4048
+ className: `${className}:hover`,
4049
+ styles: {
4050
+ ...hoverStyles,
4051
+ transition: `all ${hoverAnimation.duration}s ${camelCaseToKebabCase(
4052
+ hoverAnimation.easing
4053
+ )}`,
4054
+ transitionDelay: hoverAnimation.delay ? `${hoverAnimation.delay}s` : "0s"
4055
+ }
4056
+ }) || "";
4057
+ }
4058
+ return [
4059
+ largeStylesClass,
4060
+ mediumStylesClass,
4061
+ smallStylesClass,
4062
+ hoverStylesClass
4063
+ ].join(" ");
4074
4064
  });
4075
4065
  return <Show2 when={TARGET !== "reactNative" && css5() && canShowBlock()}><Inlined_styles_default id="builderio-block" styles={css5()} /></Show2>;
4076
4066
  }
@@ -4349,7 +4339,7 @@ function Block(props) {
4349
4339
  const animations = processedBlock().animations;
4350
4340
  if (animations && blockId) {
4351
4341
  bindAnimations(
4352
- animations.filter((item) => item.trigger !== "hover").map((animation) => ({
4342
+ animations.map((animation) => ({
4353
4343
  ...animation,
4354
4344
  elementId: blockId
4355
4345
  }))
@@ -6918,14 +6908,12 @@ async function fetchEntries(options) {
6918
6908
  }
6919
6909
 
6920
6910
  // src/functions/is-previewing.ts
6921
- function isPreviewing(search) {
6922
- if (!isBrowser()) {
6923
- return false;
6924
- }
6925
- const normalizedSearch = getSearchString(search || window.location.search);
6926
- if (isEditing(normalizedSearch)) {
6911
+ function isPreviewing(_search) {
6912
+ const search = _search || (isBrowser() ? window.location.search : void 0);
6913
+ if (!search) {
6927
6914
  return false;
6928
6915
  }
6916
+ const normalizedSearch = getSearchString(search);
6929
6917
  return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
6930
6918
  }
6931
6919
 
@@ -7173,7 +7161,7 @@ function isFromTrustedHost(trustedHosts, e) {
7173
7161
  }
7174
7162
 
7175
7163
  // src/constants/sdk-version.ts
7176
- var SDK_VERSION = "1.0.21";
7164
+ var SDK_VERSION = "1.0.23";
7177
7165
 
7178
7166
  // src/functions/register.ts
7179
7167
  var registry = {};
@@ -7563,7 +7551,7 @@ function EnableEditor(props) {
7563
7551
  variationId: variationId !== contentId ? variationId : void 0
7564
7552
  });
7565
7553
  }
7566
- if (isPreviewing()) {
7554
+ if (isPreviewing() && !isEditing()) {
7567
7555
  const searchParams = new URL(location.href).searchParams;
7568
7556
  const searchParamPreviewModel = searchParams.get("builder.preview");
7569
7557
  const searchParamPreviewId = searchParams.get(
package/lib/node/dev.js CHANGED
@@ -166,7 +166,8 @@ function isIframe() {
166
166
 
167
167
  // src/functions/is-editing.ts
168
168
  function isEditing(search) {
169
- return isIframe() && (TARGET === "reactNative" || getSearchString(search || window.location.search).indexOf("builder.frameEditing=") !== -1);
169
+ return isIframe() && (TARGET === "reactNative" || // accessing window.location.search is safe here because `isIframe()` is only `true` if we're in a browser.
170
+ getSearchString(search || window.location.search).indexOf("builder.frameEditing=") !== -1);
170
171
  }
171
172
 
172
173
  // src/functions/track/helpers.ts
@@ -526,7 +527,6 @@ function evaluate({
526
527
  enableCache
527
528
  }) {
528
529
  if (code === "") {
529
- logger.warn("Skipping evaluation of empty code block.");
530
530
  return void 0;
531
531
  }
532
532
  const args = {
@@ -681,9 +681,6 @@ function bindAnimations(animations) {
681
681
  case "pageLoad":
682
682
  triggerAnimation(animation);
683
683
  break;
684
- case "hover":
685
- bindHoverAnimation(animation);
686
- break;
687
684
  case "scrollInView":
688
685
  bindScrollInViewAnimation(animation);
689
686
  break;
@@ -742,33 +739,6 @@ function triggerAnimation(animation) {
742
739
  });
743
740
  });
744
741
  }
745
- function bindHoverAnimation(animation) {
746
- const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
747
- if (!elements.length) {
748
- warnElementNotPresent(animation.elementId || animation.id || "");
749
- return;
750
- }
751
- Array.from(elements).forEach((element) => {
752
- augmentAnimation(animation, element);
753
- const defaultState = animation.steps[0].styles;
754
- const hoverState = animation.steps[1].styles;
755
- function attachDefaultState() {
756
- assign(element.style, defaultState);
757
- }
758
- function attachHoverState() {
759
- assign(element.style, hoverState);
760
- }
761
- attachDefaultState();
762
- element.addEventListener("mouseenter", attachHoverState);
763
- element.addEventListener("mouseleave", attachDefaultState);
764
- setTimeout(() => {
765
- element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
766
- if (animation.delay) {
767
- element.style.transitionDelay = animation.delay + "s";
768
- }
769
- });
770
- });
771
- }
772
742
  function bindScrollInViewAnimation(animation) {
773
743
  const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
774
744
  if (!elements.length) {
@@ -1079,7 +1049,20 @@ function BlockStyles(props) {
1079
1049
  styles: smallStyles,
1080
1050
  mediaQuery: getMaxWidthQueryForSize("small", sizesWithUpdatedBreakpoints)
1081
1051
  }) : "";
1082
- return [largeStylesClass, mediumStylesClass, smallStylesClass].join(" ");
1052
+ const hoverAnimation = processedBlock.animations && processedBlock.animations.find((item) => item.trigger === "hover");
1053
+ let hoverStylesClass = "";
1054
+ if (hoverAnimation) {
1055
+ const hoverStyles = hoverAnimation.steps?.[1]?.styles || {};
1056
+ hoverStylesClass = createCssClass({
1057
+ className: `${className}:hover`,
1058
+ styles: {
1059
+ ...hoverStyles,
1060
+ transition: `all ${hoverAnimation.duration}s ${camelCaseToKebabCase(hoverAnimation.easing)}`,
1061
+ transitionDelay: hoverAnimation.delay ? `${hoverAnimation.delay}s` : "0s"
1062
+ }
1063
+ }) || "";
1064
+ }
1065
+ return [largeStylesClass, mediumStylesClass, smallStylesClass, hoverStylesClass].join(" ");
1083
1066
  });
1084
1067
  return createComponent(Show, {
1085
1068
  get when() {
@@ -1411,7 +1394,7 @@ function Block(props) {
1411
1394
  const blockId = processedBlock().id;
1412
1395
  const animations = processedBlock().animations;
1413
1396
  if (animations && blockId) {
1414
- bindAnimations(animations.filter((item) => item.trigger !== "hover").map((animation) => ({
1397
+ bindAnimations(animations.map((animation) => ({
1415
1398
  ...animation,
1416
1399
  elementId: blockId
1417
1400
  })));
@@ -4337,14 +4320,12 @@ async function fetchEntries(options) {
4337
4320
  }
4338
4321
 
4339
4322
  // src/functions/is-previewing.ts
4340
- function isPreviewing(search) {
4341
- if (!isBrowser()) {
4342
- return false;
4343
- }
4344
- const normalizedSearch = getSearchString(search || window.location.search);
4345
- if (isEditing(normalizedSearch)) {
4323
+ function isPreviewing(_search) {
4324
+ const search = _search || (isBrowser() ? window.location.search : void 0);
4325
+ if (!search) {
4346
4326
  return false;
4347
4327
  }
4328
+ const normalizedSearch = getSearchString(search);
4348
4329
  return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
4349
4330
  }
4350
4331
 
@@ -4595,7 +4576,7 @@ function isFromTrustedHost(trustedHosts, e) {
4595
4576
  }
4596
4577
 
4597
4578
  // src/constants/sdk-version.ts
4598
- var SDK_VERSION = "1.0.21";
4579
+ var SDK_VERSION = "1.0.23";
4599
4580
 
4600
4581
  // src/functions/register.ts
4601
4582
  var registry = {};
@@ -4973,7 +4954,7 @@ function EnableEditor(props) {
4973
4954
  variationId: variationId !== contentId ? variationId : void 0
4974
4955
  });
4975
4956
  }
4976
- if (isPreviewing()) {
4957
+ if (isPreviewing() && !isEditing()) {
4977
4958
  const searchParams = new URL(location.href).searchParams;
4978
4959
  const searchParamPreviewModel = searchParams.get("builder.preview");
4979
4960
  const searchParamPreviewId = searchParams.get(`builder.preview.${searchParamPreviewModel}`);
package/lib/node/dev.jsx CHANGED
@@ -152,7 +152,8 @@ function isIframe() {
152
152
 
153
153
  // src/functions/is-editing.ts
154
154
  function isEditing(search) {
155
- return isIframe() && (TARGET === "reactNative" || getSearchString(search || window.location.search).indexOf("builder.frameEditing=") !== -1);
155
+ return isIframe() && (TARGET === "reactNative" || // accessing window.location.search is safe here because `isIframe()` is only `true` if we're in a browser.
156
+ getSearchString(search || window.location.search).indexOf("builder.frameEditing=") !== -1);
156
157
  }
157
158
 
158
159
  // src/functions/track/helpers.ts
@@ -515,7 +516,6 @@ function evaluate({
515
516
  enableCache
516
517
  }) {
517
518
  if (code === "") {
518
- logger.warn("Skipping evaluation of empty code block.");
519
519
  return void 0;
520
520
  }
521
521
  const args = {
@@ -670,9 +670,6 @@ function bindAnimations(animations) {
670
670
  case "pageLoad":
671
671
  triggerAnimation(animation);
672
672
  break;
673
- case "hover":
674
- bindHoverAnimation(animation);
675
- break;
676
673
  case "scrollInView":
677
674
  bindScrollInViewAnimation(animation);
678
675
  break;
@@ -731,33 +728,6 @@ function triggerAnimation(animation) {
731
728
  });
732
729
  });
733
730
  }
734
- function bindHoverAnimation(animation) {
735
- const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
736
- if (!elements.length) {
737
- warnElementNotPresent(animation.elementId || animation.id || "");
738
- return;
739
- }
740
- Array.from(elements).forEach((element) => {
741
- augmentAnimation(animation, element);
742
- const defaultState = animation.steps[0].styles;
743
- const hoverState = animation.steps[1].styles;
744
- function attachDefaultState() {
745
- assign(element.style, defaultState);
746
- }
747
- function attachHoverState() {
748
- assign(element.style, hoverState);
749
- }
750
- attachDefaultState();
751
- element.addEventListener("mouseenter", attachHoverState);
752
- element.addEventListener("mouseleave", attachDefaultState);
753
- setTimeout(() => {
754
- element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
755
- if (animation.delay) {
756
- element.style.transitionDelay = animation.delay + "s";
757
- }
758
- });
759
- });
760
- }
761
731
  function bindScrollInViewAnimation(animation) {
762
732
  const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
763
733
  if (!elements.length) {
@@ -1068,7 +1038,27 @@ function BlockStyles(props) {
1068
1038
  sizesWithUpdatedBreakpoints
1069
1039
  )
1070
1040
  }) : "";
1071
- return [largeStylesClass, mediumStylesClass, smallStylesClass].join(" ");
1041
+ const hoverAnimation = processedBlock.animations && processedBlock.animations.find((item) => item.trigger === "hover");
1042
+ let hoverStylesClass = "";
1043
+ if (hoverAnimation) {
1044
+ const hoverStyles = hoverAnimation.steps?.[1]?.styles || {};
1045
+ hoverStylesClass = createCssClass({
1046
+ className: `${className}:hover`,
1047
+ styles: {
1048
+ ...hoverStyles,
1049
+ transition: `all ${hoverAnimation.duration}s ${camelCaseToKebabCase(
1050
+ hoverAnimation.easing
1051
+ )}`,
1052
+ transitionDelay: hoverAnimation.delay ? `${hoverAnimation.delay}s` : "0s"
1053
+ }
1054
+ }) || "";
1055
+ }
1056
+ return [
1057
+ largeStylesClass,
1058
+ mediumStylesClass,
1059
+ smallStylesClass,
1060
+ hoverStylesClass
1061
+ ].join(" ");
1072
1062
  });
1073
1063
  return <Show2 when={TARGET !== "reactNative" && css5() && canShowBlock()}><Inlined_styles_default id="builderio-block" styles={css5()} /></Show2>;
1074
1064
  }
@@ -1347,7 +1337,7 @@ function Block(props) {
1347
1337
  const animations = processedBlock().animations;
1348
1338
  if (animations && blockId) {
1349
1339
  bindAnimations(
1350
- animations.filter((item) => item.trigger !== "hover").map((animation) => ({
1340
+ animations.map((animation) => ({
1351
1341
  ...animation,
1352
1342
  elementId: blockId
1353
1343
  }))
@@ -3922,14 +3912,12 @@ async function fetchEntries(options) {
3922
3912
  }
3923
3913
 
3924
3914
  // src/functions/is-previewing.ts
3925
- function isPreviewing(search) {
3926
- if (!isBrowser()) {
3927
- return false;
3928
- }
3929
- const normalizedSearch = getSearchString(search || window.location.search);
3930
- if (isEditing(normalizedSearch)) {
3915
+ function isPreviewing(_search) {
3916
+ const search = _search || (isBrowser() ? window.location.search : void 0);
3917
+ if (!search) {
3931
3918
  return false;
3932
3919
  }
3920
+ const normalizedSearch = getSearchString(search);
3933
3921
  return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
3934
3922
  }
3935
3923
 
@@ -4180,7 +4168,7 @@ function isFromTrustedHost(trustedHosts, e) {
4180
4168
  }
4181
4169
 
4182
4170
  // src/constants/sdk-version.ts
4183
- var SDK_VERSION = "1.0.21";
4171
+ var SDK_VERSION = "1.0.23";
4184
4172
 
4185
4173
  // src/functions/register.ts
4186
4174
  var registry = {};
@@ -4572,7 +4560,7 @@ function EnableEditor(props) {
4572
4560
  variationId: variationId !== contentId ? variationId : void 0
4573
4561
  });
4574
4562
  }
4575
- if (isPreviewing()) {
4563
+ if (isPreviewing() && !isEditing()) {
4576
4564
  const searchParams = new URL(location.href).searchParams;
4577
4565
  const searchParamPreviewModel = searchParams.get("builder.preview");
4578
4566
  const searchParamPreviewId = searchParams.get(