@builder.io/sdk-qwik 0.14.15 → 0.14.17

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()) {
@@ -278,10 +279,8 @@ _EvalCache.cacheLimit = 20;
278
279
  _EvalCache.cache = /* @__PURE__ */ new Map();
279
280
  let EvalCache = _EvalCache;
280
281
  function evaluate({ code, context, localState, rootState, rootSetState, event, isExpression = true, enableCache }) {
281
- if (code === "") {
282
- logger.warn("Skipping evaluation of empty code block.");
282
+ if (code === "")
283
283
  return void 0;
284
- }
285
284
  const args = {
286
285
  code: parseCode(code, {
287
286
  isExpression
@@ -417,9 +416,6 @@ function bindAnimations(animations) {
417
416
  case "pageLoad":
418
417
  triggerAnimation(animation);
419
418
  break;
420
- case "hover":
421
- bindHoverAnimation(animation);
422
- break;
423
419
  case "scrollInView":
424
420
  bindScrollInViewAnimation(animation);
425
421
  break;
@@ -475,32 +471,6 @@ function triggerAnimation(animation) {
475
471
  });
476
472
  });
477
473
  }
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
474
  function bindScrollInViewAnimation(animation) {
505
475
  const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
506
476
  if (!elements.length) {
@@ -730,7 +700,7 @@ const BlockStyles = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlin
730
700
  props
731
701
  ]));
732
702
  const css = qwik.useComputedQrl(/* @__PURE__ */ qwik.inlinedQrl(() => {
733
- var _a;
703
+ var _a, _b, _c;
734
704
  const [props2] = qwik.useLexicalScope();
735
705
  const processedBlock = getProcessedBlock({
736
706
  block: props2.block,
@@ -763,10 +733,24 @@ const BlockStyles = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlin
763
733
  styles: smallStyles,
764
734
  mediaQuery: getMaxWidthQueryForSize("small", sizesWithUpdatedBreakpoints)
765
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
+ }
766
749
  return [
767
750
  largeStylesClass,
768
751
  mediumStylesClass,
769
- smallStylesClass
752
+ smallStylesClass,
753
+ hoverStylesClass
770
754
  ].join(" ");
771
755
  }, "BlockStyles_component_css_useComputed_b9Ru8qTcNik", [
772
756
  props
@@ -1110,7 +1094,7 @@ const Block = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl(
1110
1094
  const blockId = processedBlock2.value.id;
1111
1095
  const animations = processedBlock2.value.animations;
1112
1096
  if (animations && blockId)
1113
- bindAnimations(animations.filter((item) => item.trigger !== "hover").map((animation) => ({
1097
+ bindAnimations(animations.map((animation) => ({
1114
1098
  ...animation,
1115
1099
  elementId: blockId
1116
1100
  })));
@@ -4188,12 +4172,11 @@ async function fetchEntries(options) {
4188
4172
  return null;
4189
4173
  }
4190
4174
  }
4191
- function isPreviewing(search) {
4192
- if (!isBrowser())
4193
- return false;
4194
- const normalizedSearch = getSearchString(search || window.location.search);
4195
- if (isEditing(normalizedSearch))
4175
+ function isPreviewing(_search) {
4176
+ const search = _search || (isBrowser() ? window.location.search : void 0);
4177
+ if (!search)
4196
4178
  return false;
4179
+ const normalizedSearch = getSearchString(search);
4197
4180
  return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
4198
4181
  }
4199
4182
  function uuidv4() {
@@ -4399,7 +4382,7 @@ function isFromTrustedHost(trustedHosts, e) {
4399
4382
  const url = new URL(e.origin), hostname = url.hostname;
4400
4383
  return (trustedHosts || DEFAULT_TRUSTED_HOSTS).findIndex((trustedHost) => trustedHost.startsWith("*.") ? hostname.endsWith(trustedHost.slice(1)) : trustedHost === hostname) > -1;
4401
4384
  }
4402
- const SDK_VERSION = "0.14.15";
4385
+ const SDK_VERSION = "0.14.17";
4403
4386
  const registry = {};
4404
4387
  function register(type, info) {
4405
4388
  let typeList = registry[type];
@@ -4789,7 +4772,7 @@ const EnableEditor = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inli
4789
4772
  variationId: variationId !== contentId ? variationId : void 0
4790
4773
  });
4791
4774
  }
4792
- if (isPreviewing()) {
4775
+ if (isPreviewing() && !isEditing()) {
4793
4776
  if (element)
4794
4777
  element.dispatchEvent(new CustomEvent("initpreviewingbldr"));
4795
4778
  }
@@ -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()) {
@@ -276,10 +277,8 @@ _EvalCache.cacheLimit = 20;
276
277
  _EvalCache.cache = /* @__PURE__ */ new Map();
277
278
  let EvalCache = _EvalCache;
278
279
  function evaluate({ code, context, localState, rootState, rootSetState, event, isExpression = true, enableCache }) {
279
- if (code === "") {
280
- logger.warn("Skipping evaluation of empty code block.");
280
+ if (code === "")
281
281
  return void 0;
282
- }
283
282
  const args = {
284
283
  code: parseCode(code, {
285
284
  isExpression
@@ -415,9 +414,6 @@ function bindAnimations(animations) {
415
414
  case "pageLoad":
416
415
  triggerAnimation(animation);
417
416
  break;
418
- case "hover":
419
- bindHoverAnimation(animation);
420
- break;
421
417
  case "scrollInView":
422
418
  bindScrollInViewAnimation(animation);
423
419
  break;
@@ -473,32 +469,6 @@ function triggerAnimation(animation) {
473
469
  });
474
470
  });
475
471
  }
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
472
  function bindScrollInViewAnimation(animation) {
503
473
  const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
504
474
  if (!elements.length) {
@@ -728,7 +698,7 @@ const BlockStyles = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pro
728
698
  props
729
699
  ]));
730
700
  const css = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
731
- var _a;
701
+ var _a, _b, _c;
732
702
  const [props2] = useLexicalScope();
733
703
  const processedBlock = getProcessedBlock({
734
704
  block: props2.block,
@@ -761,10 +731,24 @@ const BlockStyles = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pro
761
731
  styles: smallStyles,
762
732
  mediaQuery: getMaxWidthQueryForSize("small", sizesWithUpdatedBreakpoints)
763
733
  }) : "";
734
+ const hoverAnimation = processedBlock.animations && processedBlock.animations.find((item) => item.trigger === "hover");
735
+ let hoverStylesClass = "";
736
+ if (hoverAnimation) {
737
+ const hoverStyles = ((_c = (_b = hoverAnimation.steps) == null ? void 0 : _b[1]) == null ? void 0 : _c.styles) || {};
738
+ hoverStylesClass = createCssClass({
739
+ className: `${className}:hover`,
740
+ styles: {
741
+ ...hoverStyles,
742
+ transition: `all ${hoverAnimation.duration}s ${camelCaseToKebabCase(hoverAnimation.easing)}`,
743
+ transitionDelay: hoverAnimation.delay ? `${hoverAnimation.delay}s` : "0s"
744
+ }
745
+ }) || "";
746
+ }
764
747
  return [
765
748
  largeStylesClass,
766
749
  mediumStylesClass,
767
- smallStylesClass
750
+ smallStylesClass,
751
+ hoverStylesClass
768
752
  ].join(" ");
769
753
  }, "BlockStyles_component_css_useComputed_b9Ru8qTcNik", [
770
754
  props
@@ -1108,7 +1092,7 @@ const Block = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
1108
1092
  const blockId = processedBlock2.value.id;
1109
1093
  const animations = processedBlock2.value.animations;
1110
1094
  if (animations && blockId)
1111
- bindAnimations(animations.filter((item) => item.trigger !== "hover").map((animation) => ({
1095
+ bindAnimations(animations.map((animation) => ({
1112
1096
  ...animation,
1113
1097
  elementId: blockId
1114
1098
  })));
@@ -4186,12 +4170,11 @@ async function fetchEntries(options) {
4186
4170
  return null;
4187
4171
  }
4188
4172
  }
4189
- function isPreviewing(search) {
4190
- if (!isBrowser())
4191
- return false;
4192
- const normalizedSearch = getSearchString(search || window.location.search);
4193
- if (isEditing(normalizedSearch))
4173
+ function isPreviewing(_search) {
4174
+ const search = _search || (isBrowser() ? window.location.search : void 0);
4175
+ if (!search)
4194
4176
  return false;
4177
+ const normalizedSearch = getSearchString(search);
4195
4178
  return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
4196
4179
  }
4197
4180
  function uuidv4() {
@@ -4397,7 +4380,7 @@ function isFromTrustedHost(trustedHosts, e) {
4397
4380
  const url = new URL(e.origin), hostname = url.hostname;
4398
4381
  return (trustedHosts || DEFAULT_TRUSTED_HOSTS).findIndex((trustedHost) => trustedHost.startsWith("*.") ? hostname.endsWith(trustedHost.slice(1)) : trustedHost === hostname) > -1;
4399
4382
  }
4400
- const SDK_VERSION = "0.14.15";
4383
+ const SDK_VERSION = "0.14.17";
4401
4384
  const registry = {};
4402
4385
  function register(type, info) {
4403
4386
  let typeList = registry[type];
@@ -4787,7 +4770,7 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
4787
4770
  variationId: variationId !== contentId ? variationId : void 0
4788
4771
  });
4789
4772
  }
4790
- if (isPreviewing()) {
4773
+ if (isPreviewing() && !isEditing()) {
4791
4774
  if (element)
4792
4775
  element.dispatchEvent(new CustomEvent("initpreviewingbldr"));
4793
4776
  }
@@ -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()) {
@@ -3516,10 +3517,8 @@ _EvalCache.cacheLimit = 20;
3516
3517
  _EvalCache.cache = /* @__PURE__ */ new Map();
3517
3518
  let EvalCache = _EvalCache;
3518
3519
  function evaluate({ code, context, localState, rootState, rootSetState, event, isExpression = true, enableCache }) {
3519
- if (code === "") {
3520
- logger.warn("Skipping evaluation of empty code block.");
3520
+ if (code === "")
3521
3521
  return void 0;
3522
- }
3523
3522
  const args = {
3524
3523
  code: parseCode(code, {
3525
3524
  isExpression
@@ -3648,9 +3647,6 @@ function bindAnimations(animations) {
3648
3647
  case "pageLoad":
3649
3648
  triggerAnimation(animation);
3650
3649
  break;
3651
- case "hover":
3652
- bindHoverAnimation(animation);
3653
- break;
3654
3650
  case "scrollInView":
3655
3651
  bindScrollInViewAnimation(animation);
3656
3652
  break;
@@ -3706,32 +3702,6 @@ function triggerAnimation(animation) {
3706
3702
  });
3707
3703
  });
3708
3704
  }
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
3705
  function bindScrollInViewAnimation(animation) {
3736
3706
  const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
3737
3707
  if (!elements.length) {
@@ -3961,7 +3931,7 @@ const BlockStyles = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlin
3961
3931
  props
3962
3932
  ]));
3963
3933
  const css = qwik.useComputedQrl(/* @__PURE__ */ qwik.inlinedQrl(() => {
3964
- var _a;
3934
+ var _a, _b, _c;
3965
3935
  const [props2] = qwik.useLexicalScope();
3966
3936
  const processedBlock = getProcessedBlock({
3967
3937
  block: props2.block,
@@ -3994,10 +3964,24 @@ const BlockStyles = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlin
3994
3964
  styles: smallStyles,
3995
3965
  mediaQuery: getMaxWidthQueryForSize("small", sizesWithUpdatedBreakpoints)
3996
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
+ }
3997
3980
  return [
3998
3981
  largeStylesClass,
3999
3982
  mediumStylesClass,
4000
- smallStylesClass
3983
+ smallStylesClass,
3984
+ hoverStylesClass
4001
3985
  ].join(" ");
4002
3986
  }, "BlockStyles_component_css_useComputed_b9Ru8qTcNik", [
4003
3987
  props
@@ -4341,7 +4325,7 @@ const Block = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl(
4341
4325
  const blockId = processedBlock2.value.id;
4342
4326
  const animations = processedBlock2.value.animations;
4343
4327
  if (animations && blockId)
4344
- bindAnimations(animations.filter((item) => item.trigger !== "hover").map((animation) => ({
4328
+ bindAnimations(animations.map((animation) => ({
4345
4329
  ...animation,
4346
4330
  elementId: blockId
4347
4331
  })));
@@ -7419,12 +7403,11 @@ async function fetchEntries(options) {
7419
7403
  return null;
7420
7404
  }
7421
7405
  }
7422
- function isPreviewing(search) {
7423
- if (!isBrowser())
7424
- return false;
7425
- const normalizedSearch = getSearchString(search || window.location.search);
7426
- if (isEditing(normalizedSearch))
7406
+ function isPreviewing(_search) {
7407
+ const search = _search || (isBrowser() ? window.location.search : void 0);
7408
+ if (!search)
7427
7409
  return false;
7410
+ const normalizedSearch = getSearchString(search);
7428
7411
  return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
7429
7412
  }
7430
7413
  function uuidv4() {
@@ -7630,7 +7613,7 @@ function isFromTrustedHost(trustedHosts, e) {
7630
7613
  const url = new URL(e.origin), hostname = url.hostname;
7631
7614
  return (trustedHosts || DEFAULT_TRUSTED_HOSTS).findIndex((trustedHost) => trustedHost.startsWith("*.") ? hostname.endsWith(trustedHost.slice(1)) : trustedHost === hostname) > -1;
7632
7615
  }
7633
- const SDK_VERSION = "0.14.15";
7616
+ const SDK_VERSION = "0.14.17";
7634
7617
  const registry = {};
7635
7618
  function register(type, info) {
7636
7619
  let typeList = registry[type];
@@ -8020,7 +8003,7 @@ const EnableEditor = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inli
8020
8003
  variationId: variationId !== contentId ? variationId : void 0
8021
8004
  });
8022
8005
  }
8023
- if (isPreviewing()) {
8006
+ if (isPreviewing() && !isEditing()) {
8024
8007
  if (element)
8025
8008
  element.dispatchEvent(new CustomEvent("initpreviewingbldr"));
8026
8009
  }
@@ -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()) {
@@ -3514,10 +3515,8 @@ _EvalCache.cacheLimit = 20;
3514
3515
  _EvalCache.cache = /* @__PURE__ */ new Map();
3515
3516
  let EvalCache = _EvalCache;
3516
3517
  function evaluate({ code, context, localState, rootState, rootSetState, event, isExpression = true, enableCache }) {
3517
- if (code === "") {
3518
- logger.warn("Skipping evaluation of empty code block.");
3518
+ if (code === "")
3519
3519
  return void 0;
3520
- }
3521
3520
  const args = {
3522
3521
  code: parseCode(code, {
3523
3522
  isExpression
@@ -3646,9 +3645,6 @@ function bindAnimations(animations) {
3646
3645
  case "pageLoad":
3647
3646
  triggerAnimation(animation);
3648
3647
  break;
3649
- case "hover":
3650
- bindHoverAnimation(animation);
3651
- break;
3652
3648
  case "scrollInView":
3653
3649
  bindScrollInViewAnimation(animation);
3654
3650
  break;
@@ -3704,32 +3700,6 @@ function triggerAnimation(animation) {
3704
3700
  });
3705
3701
  });
3706
3702
  }
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
3703
  function bindScrollInViewAnimation(animation) {
3734
3704
  const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
3735
3705
  if (!elements.length) {
@@ -3959,7 +3929,7 @@ const BlockStyles = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pro
3959
3929
  props
3960
3930
  ]));
3961
3931
  const css = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
3962
- var _a;
3932
+ var _a, _b, _c;
3963
3933
  const [props2] = useLexicalScope();
3964
3934
  const processedBlock = getProcessedBlock({
3965
3935
  block: props2.block,
@@ -3992,10 +3962,24 @@ const BlockStyles = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pro
3992
3962
  styles: smallStyles,
3993
3963
  mediaQuery: getMaxWidthQueryForSize("small", sizesWithUpdatedBreakpoints)
3994
3964
  }) : "";
3965
+ const hoverAnimation = processedBlock.animations && processedBlock.animations.find((item) => item.trigger === "hover");
3966
+ let hoverStylesClass = "";
3967
+ if (hoverAnimation) {
3968
+ const hoverStyles = ((_c = (_b = hoverAnimation.steps) == null ? void 0 : _b[1]) == null ? void 0 : _c.styles) || {};
3969
+ hoverStylesClass = createCssClass({
3970
+ className: `${className}:hover`,
3971
+ styles: {
3972
+ ...hoverStyles,
3973
+ transition: `all ${hoverAnimation.duration}s ${camelCaseToKebabCase(hoverAnimation.easing)}`,
3974
+ transitionDelay: hoverAnimation.delay ? `${hoverAnimation.delay}s` : "0s"
3975
+ }
3976
+ }) || "";
3977
+ }
3995
3978
  return [
3996
3979
  largeStylesClass,
3997
3980
  mediumStylesClass,
3998
- smallStylesClass
3981
+ smallStylesClass,
3982
+ hoverStylesClass
3999
3983
  ].join(" ");
4000
3984
  }, "BlockStyles_component_css_useComputed_b9Ru8qTcNik", [
4001
3985
  props
@@ -4339,7 +4323,7 @@ const Block = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
4339
4323
  const blockId = processedBlock2.value.id;
4340
4324
  const animations = processedBlock2.value.animations;
4341
4325
  if (animations && blockId)
4342
- bindAnimations(animations.filter((item) => item.trigger !== "hover").map((animation) => ({
4326
+ bindAnimations(animations.map((animation) => ({
4343
4327
  ...animation,
4344
4328
  elementId: blockId
4345
4329
  })));
@@ -7417,12 +7401,11 @@ async function fetchEntries(options) {
7417
7401
  return null;
7418
7402
  }
7419
7403
  }
7420
- function isPreviewing(search) {
7421
- if (!isBrowser())
7422
- return false;
7423
- const normalizedSearch = getSearchString(search || window.location.search);
7424
- if (isEditing(normalizedSearch))
7404
+ function isPreviewing(_search) {
7405
+ const search = _search || (isBrowser() ? window.location.search : void 0);
7406
+ if (!search)
7425
7407
  return false;
7408
+ const normalizedSearch = getSearchString(search);
7426
7409
  return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
7427
7410
  }
7428
7411
  function uuidv4() {
@@ -7628,7 +7611,7 @@ function isFromTrustedHost(trustedHosts, e) {
7628
7611
  const url = new URL(e.origin), hostname = url.hostname;
7629
7612
  return (trustedHosts || DEFAULT_TRUSTED_HOSTS).findIndex((trustedHost) => trustedHost.startsWith("*.") ? hostname.endsWith(trustedHost.slice(1)) : trustedHost === hostname) > -1;
7630
7613
  }
7631
- const SDK_VERSION = "0.14.15";
7614
+ const SDK_VERSION = "0.14.17";
7632
7615
  const registry = {};
7633
7616
  function register(type, info) {
7634
7617
  let typeList = registry[type];
@@ -8018,7 +8001,7 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
8018
8001
  variationId: variationId !== contentId ? variationId : void 0
8019
8002
  });
8020
8003
  }
8021
- if (isPreviewing()) {
8004
+ if (isPreviewing() && !isEditing()) {
8022
8005
  if (element)
8023
8006
  element.dispatchEvent(new CustomEvent("initpreviewingbldr"));
8024
8007
  }
@@ -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()) {
@@ -408,10 +409,8 @@ _EvalCache.cacheLimit = 20;
408
409
  _EvalCache.cache = /* @__PURE__ */ new Map();
409
410
  let EvalCache = _EvalCache;
410
411
  function evaluate({ code, context, localState, rootState, rootSetState, event, isExpression = true, enableCache }) {
411
- if (code === "") {
412
- logger.warn("Skipping evaluation of empty code block.");
412
+ if (code === "")
413
413
  return void 0;
414
- }
415
414
  const args = {
416
415
  code: parseCode(code, {
417
416
  isExpression
@@ -539,9 +538,6 @@ function bindAnimations(animations) {
539
538
  case "pageLoad":
540
539
  triggerAnimation(animation);
541
540
  break;
542
- case "hover":
543
- bindHoverAnimation(animation);
544
- break;
545
541
  case "scrollInView":
546
542
  bindScrollInViewAnimation(animation);
547
543
  break;
@@ -597,32 +593,6 @@ function triggerAnimation(animation) {
597
593
  });
598
594
  });
599
595
  }
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
596
  function bindScrollInViewAnimation(animation) {
627
597
  const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
628
598
  if (!elements.length) {
@@ -852,7 +822,7 @@ const BlockStyles = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlin
852
822
  props
853
823
  ]));
854
824
  const css = qwik.useComputedQrl(/* @__PURE__ */ qwik.inlinedQrl(() => {
855
- var _a;
825
+ var _a, _b, _c;
856
826
  const [props2] = qwik.useLexicalScope();
857
827
  const processedBlock = getProcessedBlock({
858
828
  block: props2.block,
@@ -885,10 +855,24 @@ const BlockStyles = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlin
885
855
  styles: smallStyles,
886
856
  mediaQuery: getMaxWidthQueryForSize("small", sizesWithUpdatedBreakpoints)
887
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
+ }
888
871
  return [
889
872
  largeStylesClass,
890
873
  mediumStylesClass,
891
- smallStylesClass
874
+ smallStylesClass,
875
+ hoverStylesClass
892
876
  ].join(" ");
893
877
  }, "BlockStyles_component_css_useComputed_b9Ru8qTcNik", [
894
878
  props
@@ -1232,7 +1216,7 @@ const Block = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl(
1232
1216
  const blockId = processedBlock2.value.id;
1233
1217
  const animations = processedBlock2.value.animations;
1234
1218
  if (animations && blockId)
1235
- bindAnimations(animations.filter((item) => item.trigger !== "hover").map((animation) => ({
1219
+ bindAnimations(animations.map((animation) => ({
1236
1220
  ...animation,
1237
1221
  elementId: blockId
1238
1222
  })));
@@ -4310,12 +4294,11 @@ async function fetchEntries(options) {
4310
4294
  return null;
4311
4295
  }
4312
4296
  }
4313
- function isPreviewing(search) {
4314
- if (!isBrowser())
4315
- return false;
4316
- const normalizedSearch = getSearchString(search || window.location.search);
4317
- if (isEditing(normalizedSearch))
4297
+ function isPreviewing(_search) {
4298
+ const search = _search || (isBrowser() ? window.location.search : void 0);
4299
+ if (!search)
4318
4300
  return false;
4301
+ const normalizedSearch = getSearchString(search);
4319
4302
  return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
4320
4303
  }
4321
4304
  function uuidv4() {
@@ -4521,7 +4504,7 @@ function isFromTrustedHost(trustedHosts, e) {
4521
4504
  const url = new URL(e.origin), hostname = url.hostname;
4522
4505
  return (trustedHosts || DEFAULT_TRUSTED_HOSTS).findIndex((trustedHost) => trustedHost.startsWith("*.") ? hostname.endsWith(trustedHost.slice(1)) : trustedHost === hostname) > -1;
4523
4506
  }
4524
- const SDK_VERSION = "0.14.15";
4507
+ const SDK_VERSION = "0.14.17";
4525
4508
  const registry = {};
4526
4509
  function register(type, info) {
4527
4510
  let typeList = registry[type];
@@ -4911,7 +4894,7 @@ const EnableEditor = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inli
4911
4894
  variationId: variationId !== contentId ? variationId : void 0
4912
4895
  });
4913
4896
  }
4914
- if (isPreviewing()) {
4897
+ if (isPreviewing() && !isEditing()) {
4915
4898
  if (element)
4916
4899
  element.dispatchEvent(new CustomEvent("initpreviewingbldr"));
4917
4900
  }
@@ -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()) {
@@ -406,10 +407,8 @@ _EvalCache.cacheLimit = 20;
406
407
  _EvalCache.cache = /* @__PURE__ */ new Map();
407
408
  let EvalCache = _EvalCache;
408
409
  function evaluate({ code, context, localState, rootState, rootSetState, event, isExpression = true, enableCache }) {
409
- if (code === "") {
410
- logger.warn("Skipping evaluation of empty code block.");
410
+ if (code === "")
411
411
  return void 0;
412
- }
413
412
  const args = {
414
413
  code: parseCode(code, {
415
414
  isExpression
@@ -537,9 +536,6 @@ function bindAnimations(animations) {
537
536
  case "pageLoad":
538
537
  triggerAnimation(animation);
539
538
  break;
540
- case "hover":
541
- bindHoverAnimation(animation);
542
- break;
543
539
  case "scrollInView":
544
540
  bindScrollInViewAnimation(animation);
545
541
  break;
@@ -595,32 +591,6 @@ function triggerAnimation(animation) {
595
591
  });
596
592
  });
597
593
  }
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
594
  function bindScrollInViewAnimation(animation) {
625
595
  const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
626
596
  if (!elements.length) {
@@ -850,7 +820,7 @@ const BlockStyles = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pro
850
820
  props
851
821
  ]));
852
822
  const css = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
853
- var _a;
823
+ var _a, _b, _c;
854
824
  const [props2] = useLexicalScope();
855
825
  const processedBlock = getProcessedBlock({
856
826
  block: props2.block,
@@ -883,10 +853,24 @@ const BlockStyles = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pro
883
853
  styles: smallStyles,
884
854
  mediaQuery: getMaxWidthQueryForSize("small", sizesWithUpdatedBreakpoints)
885
855
  }) : "";
856
+ const hoverAnimation = processedBlock.animations && processedBlock.animations.find((item) => item.trigger === "hover");
857
+ let hoverStylesClass = "";
858
+ if (hoverAnimation) {
859
+ const hoverStyles = ((_c = (_b = hoverAnimation.steps) == null ? void 0 : _b[1]) == null ? void 0 : _c.styles) || {};
860
+ hoverStylesClass = createCssClass({
861
+ className: `${className}:hover`,
862
+ styles: {
863
+ ...hoverStyles,
864
+ transition: `all ${hoverAnimation.duration}s ${camelCaseToKebabCase(hoverAnimation.easing)}`,
865
+ transitionDelay: hoverAnimation.delay ? `${hoverAnimation.delay}s` : "0s"
866
+ }
867
+ }) || "";
868
+ }
886
869
  return [
887
870
  largeStylesClass,
888
871
  mediumStylesClass,
889
- smallStylesClass
872
+ smallStylesClass,
873
+ hoverStylesClass
890
874
  ].join(" ");
891
875
  }, "BlockStyles_component_css_useComputed_b9Ru8qTcNik", [
892
876
  props
@@ -1230,7 +1214,7 @@ const Block = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
1230
1214
  const blockId = processedBlock2.value.id;
1231
1215
  const animations = processedBlock2.value.animations;
1232
1216
  if (animations && blockId)
1233
- bindAnimations(animations.filter((item) => item.trigger !== "hover").map((animation) => ({
1217
+ bindAnimations(animations.map((animation) => ({
1234
1218
  ...animation,
1235
1219
  elementId: blockId
1236
1220
  })));
@@ -4308,12 +4292,11 @@ async function fetchEntries(options) {
4308
4292
  return null;
4309
4293
  }
4310
4294
  }
4311
- function isPreviewing(search) {
4312
- if (!isBrowser())
4313
- return false;
4314
- const normalizedSearch = getSearchString(search || window.location.search);
4315
- if (isEditing(normalizedSearch))
4295
+ function isPreviewing(_search) {
4296
+ const search = _search || (isBrowser() ? window.location.search : void 0);
4297
+ if (!search)
4316
4298
  return false;
4299
+ const normalizedSearch = getSearchString(search);
4317
4300
  return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
4318
4301
  }
4319
4302
  function uuidv4() {
@@ -4519,7 +4502,7 @@ function isFromTrustedHost(trustedHosts, e) {
4519
4502
  const url = new URL(e.origin), hostname = url.hostname;
4520
4503
  return (trustedHosts || DEFAULT_TRUSTED_HOSTS).findIndex((trustedHost) => trustedHost.startsWith("*.") ? hostname.endsWith(trustedHost.slice(1)) : trustedHost === hostname) > -1;
4521
4504
  }
4522
- const SDK_VERSION = "0.14.15";
4505
+ const SDK_VERSION = "0.14.17";
4523
4506
  const registry = {};
4524
4507
  function register(type, info) {
4525
4508
  let typeList = registry[type];
@@ -4909,7 +4892,7 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
4909
4892
  variationId: variationId !== contentId ? variationId : void 0
4910
4893
  });
4911
4894
  }
4912
- if (isPreviewing()) {
4895
+ if (isPreviewing() && !isEditing()) {
4913
4896
  if (element)
4914
4897
  element.dispatchEvent(new CustomEvent("initpreviewingbldr"));
4915
4898
  }
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.17",
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.17";
@@ -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;