@builder.io/sdk-solid 4.0.2 → 4.0.4

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
@@ -4663,9 +4663,10 @@ function Block(props) {
4663
4663
  var Block_default = Block;
4664
4664
 
4665
4665
  // src/components/blocks/blocks-wrapper.tsx
4666
- import { onMount as onMount3, createMemo as createMemo6 } from "solid-js";
4666
+ import { onMount as onMount3, on as on2, createEffect as createEffect2, createMemo as createMemo6, createSignal as createSignal6 } from "solid-js";
4667
4667
  import { Dynamic as Dynamic4 } from "solid-js/web";
4668
4668
  function BlocksWrapper(props) {
4669
+ const [shouldUpdate, setShouldUpdate] = createSignal6(false);
4669
4670
  const className = createMemo6(() => {
4670
4671
  return [
4671
4672
  "builder-blocks",
@@ -4712,9 +4713,13 @@ function BlocksWrapper(props) {
4712
4713
  let blocksWrapperRef;
4713
4714
  onMount3(() => {
4714
4715
  });
4716
+ const onUpdateFn_0_props_blocks = createMemo6(() => props.blocks);
4717
+ function onUpdateFn_0() {
4718
+ }
4719
+ createEffect2(on2(() => [onUpdateFn_0_props_blocks()], onUpdateFn_0));
4715
4720
  return <>
4716
4721
  <Dynamic4
4717
- class={className() + " dynamic-3d7ff108"}
4722
+ class={className() + " dynamic-023c60f2"}
4718
4723
  ref={blocksWrapperRef}
4719
4724
  builder-path={dataPath()}
4720
4725
  builder-parent-id={props.parent}
@@ -4726,7 +4731,7 @@ function BlocksWrapper(props) {
4726
4731
  {...props.BlocksWrapperProps}
4727
4732
  component={props.BlocksWrapper}
4728
4733
  >{props.children}</Dynamic4>
4729
- <style>{`.dynamic-3d7ff108 {
4734
+ <style>{`.dynamic-023c60f2 {
4730
4735
  display: flex;
4731
4736
  flex-direction: column;
4732
4737
  align-items: stretch;
@@ -5030,10 +5035,11 @@ function Image(props) {
5030
5035
  <picture>
5031
5036
  <Show8 when={webpSrcSet()}><source type="image/webp" srcset={webpSrcSet()} /></Show8>
5032
5037
  <img
5033
- class={"builder-image" + (props.className ? " " + props.className : "") + " img-dc6700b4"}
5038
+ class={"builder-image" + (props.className ? " " + props.className : "") + " img-040e729e"}
5034
5039
  loading={props.highPriority ? "eager" : "lazy"}
5035
5040
  fetchpriority={props.highPriority ? "high" : "auto"}
5036
5041
  alt={props.altText}
5042
+ title={props.title}
5037
5043
  role={props.altText ? void 0 : "presentation"}
5038
5044
  style={{
5039
5045
  "object-position": props.backgroundPosition || "center",
@@ -5048,22 +5054,22 @@ function Image(props) {
5048
5054
  <Show8
5049
5055
  when={props.aspectRatio && !(props.builderBlock?.children?.length && props.fitContent)}
5050
5056
  ><div
5051
- class="builder-image-sizer div-dc6700b4"
5057
+ class="builder-image-sizer div-040e729e"
5052
5058
  style={{
5053
5059
  "padding-top": props.aspectRatio * 100 + "%"
5054
5060
  }}
5055
5061
  /></Show8>
5056
5062
  <Show8 when={props.builderBlock?.children?.length && props.fitContent}>{props.children}</Show8>
5057
- <Show8 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-dc6700b4-2">{props.children}</div></Show8>
5063
+ <Show8 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-040e729e-2">{props.children}</div></Show8>
5058
5064
  </>
5059
- <style>{`.img-dc6700b4 {
5065
+ <style>{`.img-040e729e {
5060
5066
  opacity: 1;
5061
5067
  transition: opacity 0.2s ease-in-out;
5062
- }.div-dc6700b4 {
5068
+ }.div-040e729e {
5063
5069
  width: 100%;
5064
5070
  pointer-events: none;
5065
5071
  font-size: 0;
5066
- }.div-dc6700b4-2 {
5072
+ }.div-040e729e-2 {
5067
5073
  display: flex;
5068
5074
  flex-direction: column;
5069
5075
  align-items: stretch;
@@ -5099,7 +5105,7 @@ function SectionComponent(props) {
5099
5105
  var section_default = SectionComponent;
5100
5106
 
5101
5107
  // src/blocks/symbol/symbol.tsx
5102
- import { onMount as onMount9, on as on4, createEffect as createEffect4, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
5108
+ import { onMount as onMount9, on as on6, createEffect as createEffect6, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
5103
5109
 
5104
5110
  // src/components/content-variants/content-variants.tsx
5105
5111
  import { Show as Show16, For as For9, onMount as onMount8, createSignal as createSignal19, createMemo as createMemo19 } from "solid-js";
@@ -5998,6 +6004,10 @@ var componentInfo5 = {
5998
6004
  name: "altText",
5999
6005
  type: "string",
6000
6006
  helperText: "Text to display when the user has images off"
6007
+ }, {
6008
+ name: "title",
6009
+ type: "string",
6010
+ helperText: "Text to display when hovering over the asset"
6001
6011
  }, {
6002
6012
  name: "height",
6003
6013
  type: "number",
@@ -6808,13 +6818,12 @@ var componentInfo12 = {
6808
6818
  };
6809
6819
 
6810
6820
  // src/blocks/custom-code/custom-code.tsx
6811
- import { onMount as onMount5, createSignal as createSignal12 } from "solid-js";
6821
+ import { onMount as onMount5, on as on3, createEffect as createEffect3, createMemo as createMemo12, createSignal as createSignal12 } from "solid-js";
6812
6822
  function CustomCode(props) {
6813
6823
  const [scriptsInserted, setScriptsInserted] = createSignal12([]);
6814
6824
  const [scriptsRun, setScriptsRun] = createSignal12([]);
6815
- let elementRef;
6816
- onMount5(() => {
6817
- if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
6825
+ function runScripts() {
6826
+ if (!elementRef || !elementRef?.getElementsByTagName || typeof window === "undefined") {
6818
6827
  return;
6819
6828
  }
6820
6829
  const scripts = elementRef.getElementsByTagName("script");
@@ -6841,11 +6850,25 @@ function CustomCode(props) {
6841
6850
  scriptsRun().push(script.innerText);
6842
6851
  new Function(script.innerText)();
6843
6852
  } catch (error) {
6844
- console.warn("`CustomCode`: Error running script:", error);
6853
+ logger.warn(
6854
+ "[BUILDER.IO] `CustomCode`: Error running script:",
6855
+ error
6856
+ );
6845
6857
  }
6846
6858
  }
6847
6859
  }
6860
+ }
6861
+ let elementRef;
6862
+ onMount5(() => {
6863
+ runScripts();
6848
6864
  });
6865
+ const onUpdateFn_0_props_code = createMemo12(() => props.code);
6866
+ function onUpdateFn_0() {
6867
+ if (isEditing()) {
6868
+ runScripts();
6869
+ }
6870
+ }
6871
+ createEffect3(on3(() => [onUpdateFn_0_props_code()], onUpdateFn_0));
6849
6872
  return <><div
6850
6873
  class={"builder-custom-code" + (props.replaceNodes ? " replace-nodes" : "")}
6851
6874
  ref={elementRef}
@@ -6873,7 +6896,7 @@ var componentInfo13 = {
6873
6896
  };
6874
6897
 
6875
6898
  // src/blocks/embed/embed.tsx
6876
- import { on as on2, createEffect as createEffect2, createMemo as createMemo13, createSignal as createSignal13 } from "solid-js";
6899
+ import { on as on4, createEffect as createEffect4, createMemo as createMemo13, createSignal as createSignal13 } from "solid-js";
6877
6900
 
6878
6901
  // src/blocks/embed/helpers.ts
6879
6902
  var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"];
@@ -6901,7 +6924,7 @@ function Embed(props) {
6901
6924
  scriptsRun().push(script.innerText);
6902
6925
  new Function(script.innerText)();
6903
6926
  } catch (error) {
6904
- console.warn("`Embed`: Error running script:", error);
6927
+ logger.warn("[BUILDER.IO] `Embed`: Error running script:", error);
6905
6928
  }
6906
6929
  }
6907
6930
  }
@@ -6915,8 +6938,8 @@ function Embed(props) {
6915
6938
  findAndRunScripts();
6916
6939
  }
6917
6940
  }
6918
- createEffect2(
6919
- on2(() => [onUpdateFn_0_elem(), onUpdateFn_0_ranInitFn__()], onUpdateFn_0)
6941
+ createEffect4(
6942
+ on4(() => [onUpdateFn_0_elem(), onUpdateFn_0_ranInitFn__()], onUpdateFn_0)
6920
6943
  );
6921
6944
  return <><div class="builder-embed" ref={elem} innerHTML={props.content} /></>;
6922
6945
  }
@@ -7958,7 +7981,7 @@ function serializeIncludingFunctions(info) {
7958
7981
  }
7959
7982
 
7960
7983
  // src/components/content-variants/inlined-fns.ts
7961
- var UPDATE_COOKIES_AND_STYLES_SCRIPT = "function updateCookiesAndStyles(contentId, variants, isHydrationTarget) {\n function getAndSetVariantId() {\n function setCookie(name, value, days) {\n let expires = '';\n if (days) {\n const date = new Date();\n date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);\n expires = '; expires=' + date.toUTCString();\n }\n document.cookie = name + '=' + (value || '') + expires + '; path=/' + '; Secure; SameSite=None';\n }\n function getCookie(name) {\n const nameEQ = name + '=';\n const ca = document.cookie.split(';');\n for (let i = 0; i < ca.length; i++) {\n let c = ca[i];\n while (c.charAt(0) === ' ') c = c.substring(1, c.length);\n if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);\n }\n return null;\n }\n const cookieName = `builder.tests.${contentId}`;\n const variantInCookie = getCookie(cookieName);\n const availableIDs = variants.map(vr => vr.id).concat(contentId);\n if (variantInCookie && availableIDs.includes(variantInCookie)) {\n return variantInCookie;\n }\n let n = 0;\n const random = Math.random();\n for (let i = 0; i < variants.length; i++) {\n const variant = variants[i];\n const testRatio = variant.testRatio;\n n += testRatio;\n if (random < n) {\n setCookie(cookieName, variant.id);\n return variant.id;\n }\n }\n setCookie(cookieName, contentId);\n return contentId;\n }\n const winningVariantId = getAndSetVariantId();\n const styleEl = document.currentScript?.previousElementSibling;\n if (isHydrationTarget) {\n styleEl.remove();\n const thisScriptEl = document.currentScript;\n thisScriptEl?.remove();\n } else {\n const newStyleStr = variants.concat({\n id: contentId\n }).filter(variant => variant.id !== winningVariantId).map(value => {\n return `.variant-${value.id} { display: none; }\n `;\n }).join('');\n styleEl.innerHTML = newStyleStr;\n }\n}";
7984
+ var UPDATE_COOKIES_AND_STYLES_SCRIPT = "function updateCookiesAndStyles(contentId, variants, isHydrationTarget, isAngularSDK) {\n function getAndSetVariantId() {\n function setCookie(name, value, days) {\n let expires = '';\n if (days) {\n const date = new Date();\n date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);\n expires = '; expires=' + date.toUTCString();\n }\n document.cookie = name + '=' + (value || '') + expires + '; path=/' + '; Secure; SameSite=None';\n }\n function getCookie(name) {\n const nameEQ = name + '=';\n const ca = document.cookie.split(';');\n for (let i = 0; i < ca.length; i++) {\n let c = ca[i];\n while (c.charAt(0) === ' ') c = c.substring(1, c.length);\n if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);\n }\n return null;\n }\n const cookieName = `builder.tests.${contentId}`;\n const variantInCookie = getCookie(cookieName);\n const availableIDs = variants.map(vr => vr.id).concat(contentId);\n if (variantInCookie && availableIDs.includes(variantInCookie)) {\n return variantInCookie;\n }\n let n = 0;\n const random = Math.random();\n for (let i = 0; i < variants.length; i++) {\n const variant = variants[i];\n const testRatio = variant.testRatio;\n n += testRatio;\n if (random < n) {\n setCookie(cookieName, variant.id);\n return variant.id;\n }\n }\n setCookie(cookieName, contentId);\n return contentId;\n }\n const winningVariantId = getAndSetVariantId();\n let styleEl = document.currentScript?.previousElementSibling;\n if (isAngularSDK) {\n styleEl = document.currentScript?.parentElement?.previousElementSibling?.querySelector('style');\n }\n if (isHydrationTarget) {\n styleEl.remove();\n const thisScriptEl = document.currentScript;\n thisScriptEl?.remove();\n } else {\n const newStyleStr = variants.concat({\n id: contentId\n }).filter(variant => variant.id !== winningVariantId).map(value => {\n return `.variant-${value.id} { display: none; }\n `;\n }).join('');\n styleEl.innerHTML = newStyleStr;\n }\n}";
7962
7985
  var UPDATE_VARIANT_VISIBILITY_SCRIPT = "function updateVariantVisibility(variantContentId, defaultContentId, isHydrationTarget) {\n if (!navigator.cookieEnabled) {\n return;\n }\n function getCookie(name) {\n const nameEQ = name + '=';\n const ca = document.cookie.split(';');\n for (let i = 0; i < ca.length; i++) {\n let c = ca[i];\n while (c.charAt(0) === ' ') c = c.substring(1, c.length);\n if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);\n }\n return null;\n }\n const cookieName = `builder.tests.${defaultContentId}`;\n const winningVariant = getCookie(cookieName);\n const parentDiv = document.currentScript?.parentElement;\n const isDefaultContent = variantContentId === defaultContentId;\n const isWinningVariant = winningVariant === variantContentId;\n if (isWinningVariant && !isDefaultContent) {\n parentDiv?.removeAttribute('hidden');\n parentDiv?.removeAttribute('aria-hidden');\n } else if (!isWinningVariant && isDefaultContent) {\n parentDiv?.setAttribute('hidden', 'true');\n parentDiv?.setAttribute('aria-hidden', 'true');\n }\n if (isHydrationTarget) {\n if (!isWinningVariant) {\n parentDiv?.remove();\n }\n const thisScriptEl = document.currentScript;\n thisScriptEl?.remove();\n }\n return;\n}";
7963
7986
 
7964
7987
  // src/components/content-variants/helpers.ts
@@ -7987,6 +8010,7 @@ var checkShouldRenderVariants2 = ({
7987
8010
  return true;
7988
8011
  };
7989
8012
  var getIsHydrationTarget = (target) => target === "react" || target === "reactNative";
8013
+ var isAngularSDK = TARGET === "angular";
7990
8014
  var isHydrationTarget = getIsHydrationTarget(TARGET);
7991
8015
  var getInitVariantsFnsScriptString = () => `
7992
8016
  window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
@@ -7994,7 +8018,7 @@ var getInitVariantsFnsScriptString = () => `
7994
8018
  `;
7995
8019
  var getUpdateCookieAndStylesScript = (variants, contentId) => `
7996
8020
  window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME}(
7997
- "${contentId}",${JSON.stringify(variants)}, ${isHydrationTarget}
8021
+ "${contentId}",${JSON.stringify(variants)}, ${isHydrationTarget}, ${isAngularSDK}
7998
8022
  )`;
7999
8023
  var getUpdateVariantVisibilityScript = ({
8000
8024
  contentId,
@@ -8007,8 +8031,8 @@ var getUpdateVariantVisibilityScript = ({
8007
8031
  import {
8008
8032
  Show as Show14,
8009
8033
  onMount as onMount7,
8010
- on as on3,
8011
- createEffect as createEffect3,
8034
+ on as on5,
8035
+ createEffect as createEffect5,
8012
8036
  createMemo as createMemo16,
8013
8037
  createSignal as createSignal16
8014
8038
  } from "solid-js";
@@ -8020,7 +8044,7 @@ function getPreviewContent(_searchParams) {
8020
8044
  }
8021
8045
 
8022
8046
  // src/constants/sdk-version.ts
8023
- var SDK_VERSION = "4.0.2";
8047
+ var SDK_VERSION = "4.0.4";
8024
8048
 
8025
8049
  // src/helpers/sdk-headers.ts
8026
8050
  var getSdkHeaders = () => ({
@@ -9112,15 +9136,15 @@ function EnableEditor(props) {
9112
9136
  mergeNewContent(props.content);
9113
9137
  }
9114
9138
  }
9115
- createEffect3(on3(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
9139
+ createEffect5(on5(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
9116
9140
  const onUpdateFn_1_props_builderContextSignal_rootState = createMemo16(
9117
9141
  () => props.builderContextSignal.rootState
9118
9142
  );
9119
9143
  function onUpdateFn_1() {
9120
9144
  emitStateUpdate();
9121
9145
  }
9122
- createEffect3(
9123
- on3(
9146
+ createEffect5(
9147
+ on5(
9124
9148
  () => [onUpdateFn_1_props_builderContextSignal_rootState()],
9125
9149
  onUpdateFn_1
9126
9150
  )
@@ -9131,7 +9155,7 @@ function EnableEditor(props) {
9131
9155
  mergeNewRootState(props.data);
9132
9156
  }
9133
9157
  }
9134
- createEffect3(on3(() => [onUpdateFn_2_props_data()], onUpdateFn_2));
9158
+ createEffect5(on5(() => [onUpdateFn_2_props_data()], onUpdateFn_2));
9135
9159
  const onUpdateFn_3_props_locale = createMemo16(() => props.locale);
9136
9160
  function onUpdateFn_3() {
9137
9161
  if (props.locale) {
@@ -9140,7 +9164,7 @@ function EnableEditor(props) {
9140
9164
  });
9141
9165
  }
9142
9166
  }
9143
- createEffect3(on3(() => [onUpdateFn_3_props_locale()], onUpdateFn_3));
9167
+ createEffect5(on5(() => [onUpdateFn_3_props_locale()], onUpdateFn_3));
9144
9168
  return <><builder_context_default.Provider value={props.builderContextSignal}><Show14
9145
9169
  when={props.builderContextSignal.content || needsElementRefDivForEditing()}
9146
9170
  ><Dynamic5
@@ -9518,7 +9542,7 @@ function Symbol2(props) {
9518
9542
  function onUpdateFn_0() {
9519
9543
  setContent();
9520
9544
  }
9521
- createEffect4(on4(() => [onUpdateFn_0_props_symbol()], onUpdateFn_0));
9545
+ createEffect6(on6(() => [onUpdateFn_0_props_symbol()], onUpdateFn_0));
9522
9546
  return <><div class={className()} {...{}} {...props.attributes} {...{}}><Content_variants_default
9523
9547
  nonce={props.builderContext.nonce}
9524
9548
  isNestedRender={true}
package/lib/edge/index.js CHANGED
@@ -4813,12 +4813,13 @@ function Block(props) {
4813
4813
  });
4814
4814
  }
4815
4815
  var block_default = Block;
4816
- var _tmpl$2 = /* @__PURE__ */ template(`<style>.dynamic-3d7ff108 {
4816
+ var _tmpl$2 = /* @__PURE__ */ template(`<style>.dynamic-023c60f2 {
4817
4817
  display: flex;
4818
4818
  flex-direction: column;
4819
4819
  align-items: stretch;
4820
4820
  }`);
4821
4821
  function BlocksWrapper(props) {
4822
+ createSignal(false);
4822
4823
  const className = createMemo(() => {
4823
4824
  return ["builder-blocks", !props.blocks?.length ? "no-blocks" : "", props.classNameProp].filter(Boolean).join(" ");
4824
4825
  });
@@ -4855,9 +4856,13 @@ function BlocksWrapper(props) {
4855
4856
  let blocksWrapperRef;
4856
4857
  onMount(() => {
4857
4858
  });
4859
+ const onUpdateFn_0_props_blocks = createMemo(() => props.blocks);
4860
+ function onUpdateFn_0() {
4861
+ }
4862
+ createEffect(on(() => [onUpdateFn_0_props_blocks()], onUpdateFn_0));
4858
4863
  return [createComponent(Dynamic, mergeProps({
4859
4864
  get ["class"]() {
4860
- return className() + " dynamic-3d7ff108";
4865
+ return className() + " dynamic-023c60f2";
4861
4866
  },
4862
4867
  ref(r$) {
4863
4868
  const _ref$ = blocksWrapperRef;
@@ -5210,16 +5215,16 @@ function getSrcSet(url) {
5210
5215
  // src/blocks/image/image.tsx
5211
5216
  var _tmpl$5 = /* @__PURE__ */ template(`<source type=image/webp>`);
5212
5217
  var _tmpl$23 = /* @__PURE__ */ template(`<picture><img>`);
5213
- var _tmpl$32 = /* @__PURE__ */ template(`<div class="builder-image-sizer div-dc6700b4">`);
5214
- var _tmpl$42 = /* @__PURE__ */ template(`<div class=div-dc6700b4-2>`);
5215
- var _tmpl$52 = /* @__PURE__ */ template(`<style>.img-dc6700b4 {
5218
+ var _tmpl$32 = /* @__PURE__ */ template(`<div class="builder-image-sizer div-040e729e">`);
5219
+ var _tmpl$42 = /* @__PURE__ */ template(`<div class=div-040e729e-2>`);
5220
+ var _tmpl$52 = /* @__PURE__ */ template(`<style>.img-040e729e {
5216
5221
  opacity: 1;
5217
5222
  transition: opacity 0.2s ease-in-out;
5218
- }.div-dc6700b4 {
5223
+ }.div-040e729e {
5219
5224
  width: 100%;
5220
5225
  pointer-events: none;
5221
5226
  font-size: 0;
5222
- }.div-dc6700b4-2 {
5227
+ }.div-040e729e-2 {
5223
5228
  display: flex;
5224
5229
  flex-direction: column;
5225
5230
  align-items: stretch;
@@ -5281,20 +5286,21 @@ function Image(props) {
5281
5286
  }
5282
5287
  }), _el$3);
5283
5288
  effect((_p$) => {
5284
- const _v$ = "builder-image" + (props.className ? " " + props.className : "") + " img-dc6700b4", _v$2 = props.highPriority ? "eager" : "lazy", _v$3 = props.highPriority ? "high" : "auto", _v$4 = props.altText, _v$5 = props.altText ? void 0 : "presentation", _v$6 = {
5289
+ const _v$ = "builder-image" + (props.className ? " " + props.className : "") + " img-040e729e", _v$2 = props.highPriority ? "eager" : "lazy", _v$3 = props.highPriority ? "high" : "auto", _v$4 = props.altText, _v$5 = props.title, _v$6 = props.altText ? void 0 : "presentation", _v$7 = {
5285
5290
  "object-position": props.backgroundPosition || "center",
5286
5291
  "object-fit": props.backgroundSize || "cover",
5287
5292
  ...aspectRatioCss()
5288
- }, _v$7 = props.image, _v$8 = srcSetToUse(), _v$9 = props.sizes;
5293
+ }, _v$8 = props.image, _v$9 = srcSetToUse(), _v$10 = props.sizes;
5289
5294
  _v$ !== _p$._v$ && className(_el$3, _p$._v$ = _v$);
5290
5295
  _v$2 !== _p$._v$2 && setAttribute(_el$3, "loading", _p$._v$2 = _v$2);
5291
5296
  _v$3 !== _p$._v$3 && setAttribute(_el$3, "fetchpriority", _p$._v$3 = _v$3);
5292
5297
  _v$4 !== _p$._v$4 && setAttribute(_el$3, "alt", _p$._v$4 = _v$4);
5293
- _v$5 !== _p$._v$5 && setAttribute(_el$3, "role", _p$._v$5 = _v$5);
5294
- _p$._v$6 = style(_el$3, _v$6, _p$._v$6);
5295
- _v$7 !== _p$._v$7 && setAttribute(_el$3, "src", _p$._v$7 = _v$7);
5296
- _v$8 !== _p$._v$8 && setAttribute(_el$3, "srcset", _p$._v$8 = _v$8);
5297
- _v$9 !== _p$._v$9 && setAttribute(_el$3, "sizes", _p$._v$9 = _v$9);
5298
+ _v$5 !== _p$._v$5 && setAttribute(_el$3, "title", _p$._v$5 = _v$5);
5299
+ _v$6 !== _p$._v$6 && setAttribute(_el$3, "role", _p$._v$6 = _v$6);
5300
+ _p$._v$7 = style(_el$3, _v$7, _p$._v$7);
5301
+ _v$8 !== _p$._v$8 && setAttribute(_el$3, "src", _p$._v$8 = _v$8);
5302
+ _v$9 !== _p$._v$9 && setAttribute(_el$3, "srcset", _p$._v$9 = _v$9);
5303
+ _v$10 !== _p$._v$10 && setAttribute(_el$3, "sizes", _p$._v$10 = _v$10);
5298
5304
  return _p$;
5299
5305
  }, {
5300
5306
  _v$: void 0,
@@ -5305,7 +5311,8 @@ function Image(props) {
5305
5311
  _v$6: void 0,
5306
5312
  _v$7: void 0,
5307
5313
  _v$8: void 0,
5308
- _v$9: void 0
5314
+ _v$9: void 0,
5315
+ _v$10: void 0
5309
5316
  });
5310
5317
  return _el$;
5311
5318
  })(), createComponent(Show, {
@@ -6288,6 +6295,10 @@ var componentInfo5 = {
6288
6295
  name: "altText",
6289
6296
  type: "string",
6290
6297
  helperText: "Text to display when the user has images off"
6298
+ }, {
6299
+ name: "title",
6300
+ type: "string",
6301
+ helperText: "Text to display when hovering over the asset"
6291
6302
  }, {
6292
6303
  name: "height",
6293
6304
  type: "number",
@@ -7171,9 +7182,8 @@ var _tmpl$13 = /* @__PURE__ */ template(`<div>`);
7171
7182
  function CustomCode(props) {
7172
7183
  const [scriptsInserted, setScriptsInserted] = createSignal([]);
7173
7184
  const [scriptsRun, setScriptsRun] = createSignal([]);
7174
- let elementRef;
7175
- onMount(() => {
7176
- if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
7185
+ function runScripts() {
7186
+ if (!elementRef || !elementRef?.getElementsByTagName || typeof window === "undefined") {
7177
7187
  return;
7178
7188
  }
7179
7189
  const scripts = elementRef.getElementsByTagName("script");
@@ -7196,10 +7206,22 @@ function CustomCode(props) {
7196
7206
  scriptsRun().push(script.innerText);
7197
7207
  new Function(script.innerText)();
7198
7208
  } catch (error) {
7209
+ logger.warn("[BUILDER.IO] `CustomCode`: Error running script:", error);
7199
7210
  }
7200
7211
  }
7201
7212
  }
7213
+ }
7214
+ let elementRef;
7215
+ onMount(() => {
7216
+ runScripts();
7202
7217
  });
7218
+ const onUpdateFn_0_props_code = createMemo(() => props.code);
7219
+ function onUpdateFn_0() {
7220
+ if (isEditing()) {
7221
+ runScripts();
7222
+ }
7223
+ }
7224
+ createEffect(on(() => [onUpdateFn_0_props_code()], onUpdateFn_0));
7203
7225
  return (() => {
7204
7226
  const _el$ = _tmpl$13();
7205
7227
  const _ref$ = elementRef;
@@ -7263,6 +7285,7 @@ function Embed(props) {
7263
7285
  scriptsRun().push(script.innerText);
7264
7286
  new Function(script.innerText)();
7265
7287
  } catch (error) {
7288
+ logger.warn("[BUILDER.IO] `Embed`: Error running script:", error);
7266
7289
  }
7267
7290
  }
7268
7291
  }
@@ -8446,7 +8469,7 @@ function serializeIncludingFunctions(info) {
8446
8469
  }
8447
8470
 
8448
8471
  // src/components/content-variants/inlined-fns.ts
8449
- var UPDATE_COOKIES_AND_STYLES_SCRIPT = "function updateCookiesAndStyles(contentId, variants, isHydrationTarget) {\n function getAndSetVariantId() {\n function setCookie(name, value, days) {\n let expires = '';\n if (days) {\n const date = new Date();\n date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);\n expires = '; expires=' + date.toUTCString();\n }\n document.cookie = name + '=' + (value || '') + expires + '; path=/' + '; Secure; SameSite=None';\n }\n function getCookie(name) {\n const nameEQ = name + '=';\n const ca = document.cookie.split(';');\n for (let i = 0; i < ca.length; i++) {\n let c = ca[i];\n while (c.charAt(0) === ' ') c = c.substring(1, c.length);\n if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);\n }\n return null;\n }\n const cookieName = `builder.tests.${contentId}`;\n const variantInCookie = getCookie(cookieName);\n const availableIDs = variants.map(vr => vr.id).concat(contentId);\n if (variantInCookie && availableIDs.includes(variantInCookie)) {\n return variantInCookie;\n }\n let n = 0;\n const random = Math.random();\n for (let i = 0; i < variants.length; i++) {\n const variant = variants[i];\n const testRatio = variant.testRatio;\n n += testRatio;\n if (random < n) {\n setCookie(cookieName, variant.id);\n return variant.id;\n }\n }\n setCookie(cookieName, contentId);\n return contentId;\n }\n const winningVariantId = getAndSetVariantId();\n const styleEl = document.currentScript?.previousElementSibling;\n if (isHydrationTarget) {\n styleEl.remove();\n const thisScriptEl = document.currentScript;\n thisScriptEl?.remove();\n } else {\n const newStyleStr = variants.concat({\n id: contentId\n }).filter(variant => variant.id !== winningVariantId).map(value => {\n return `.variant-${value.id} { display: none; }\n `;\n }).join('');\n styleEl.innerHTML = newStyleStr;\n }\n}";
8472
+ var UPDATE_COOKIES_AND_STYLES_SCRIPT = "function updateCookiesAndStyles(contentId, variants, isHydrationTarget, isAngularSDK) {\n function getAndSetVariantId() {\n function setCookie(name, value, days) {\n let expires = '';\n if (days) {\n const date = new Date();\n date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);\n expires = '; expires=' + date.toUTCString();\n }\n document.cookie = name + '=' + (value || '') + expires + '; path=/' + '; Secure; SameSite=None';\n }\n function getCookie(name) {\n const nameEQ = name + '=';\n const ca = document.cookie.split(';');\n for (let i = 0; i < ca.length; i++) {\n let c = ca[i];\n while (c.charAt(0) === ' ') c = c.substring(1, c.length);\n if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);\n }\n return null;\n }\n const cookieName = `builder.tests.${contentId}`;\n const variantInCookie = getCookie(cookieName);\n const availableIDs = variants.map(vr => vr.id).concat(contentId);\n if (variantInCookie && availableIDs.includes(variantInCookie)) {\n return variantInCookie;\n }\n let n = 0;\n const random = Math.random();\n for (let i = 0; i < variants.length; i++) {\n const variant = variants[i];\n const testRatio = variant.testRatio;\n n += testRatio;\n if (random < n) {\n setCookie(cookieName, variant.id);\n return variant.id;\n }\n }\n setCookie(cookieName, contentId);\n return contentId;\n }\n const winningVariantId = getAndSetVariantId();\n let styleEl = document.currentScript?.previousElementSibling;\n if (isAngularSDK) {\n styleEl = document.currentScript?.parentElement?.previousElementSibling?.querySelector('style');\n }\n if (isHydrationTarget) {\n styleEl.remove();\n const thisScriptEl = document.currentScript;\n thisScriptEl?.remove();\n } else {\n const newStyleStr = variants.concat({\n id: contentId\n }).filter(variant => variant.id !== winningVariantId).map(value => {\n return `.variant-${value.id} { display: none; }\n `;\n }).join('');\n styleEl.innerHTML = newStyleStr;\n }\n}";
8450
8473
  var UPDATE_VARIANT_VISIBILITY_SCRIPT = "function updateVariantVisibility(variantContentId, defaultContentId, isHydrationTarget) {\n if (!navigator.cookieEnabled) {\n return;\n }\n function getCookie(name) {\n const nameEQ = name + '=';\n const ca = document.cookie.split(';');\n for (let i = 0; i < ca.length; i++) {\n let c = ca[i];\n while (c.charAt(0) === ' ') c = c.substring(1, c.length);\n if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);\n }\n return null;\n }\n const cookieName = `builder.tests.${defaultContentId}`;\n const winningVariant = getCookie(cookieName);\n const parentDiv = document.currentScript?.parentElement;\n const isDefaultContent = variantContentId === defaultContentId;\n const isWinningVariant = winningVariant === variantContentId;\n if (isWinningVariant && !isDefaultContent) {\n parentDiv?.removeAttribute('hidden');\n parentDiv?.removeAttribute('aria-hidden');\n } else if (!isWinningVariant && isDefaultContent) {\n parentDiv?.setAttribute('hidden', 'true');\n parentDiv?.setAttribute('aria-hidden', 'true');\n }\n if (isHydrationTarget) {\n if (!isWinningVariant) {\n parentDiv?.remove();\n }\n const thisScriptEl = document.currentScript;\n thisScriptEl?.remove();\n }\n return;\n}";
8451
8474
 
8452
8475
  // src/components/content-variants/helpers.ts
@@ -8475,6 +8498,7 @@ var checkShouldRenderVariants2 = ({
8475
8498
  return true;
8476
8499
  };
8477
8500
  var getIsHydrationTarget = (target) => target === "react" || target === "reactNative";
8501
+ var isAngularSDK = TARGET === "angular";
8478
8502
  var isHydrationTarget = getIsHydrationTarget(TARGET);
8479
8503
  var getInitVariantsFnsScriptString = () => `
8480
8504
  window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
@@ -8482,7 +8506,7 @@ var getInitVariantsFnsScriptString = () => `
8482
8506
  `;
8483
8507
  var getUpdateCookieAndStylesScript = (variants, contentId) => `
8484
8508
  window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME}(
8485
- "${contentId}",${JSON.stringify(variants)}, ${isHydrationTarget}
8509
+ "${contentId}",${JSON.stringify(variants)}, ${isHydrationTarget}, ${isAngularSDK}
8486
8510
  )`;
8487
8511
  var getUpdateVariantVisibilityScript = ({
8488
8512
  contentId,
@@ -8497,7 +8521,7 @@ function getPreviewContent(_searchParams) {
8497
8521
  }
8498
8522
 
8499
8523
  // src/constants/sdk-version.ts
8500
- var SDK_VERSION = "4.0.2";
8524
+ var SDK_VERSION = "4.0.4";
8501
8525
 
8502
8526
  // src/helpers/sdk-headers.ts
8503
8527
  var getSdkHeaders = () => ({