@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.
@@ -4656,9 +4656,10 @@ function Block(props) {
4656
4656
  var Block_default = Block;
4657
4657
 
4658
4658
  // src/components/blocks/blocks-wrapper.tsx
4659
- import { onMount as onMount3, createMemo as createMemo6 } from "solid-js";
4659
+ import { onMount as onMount3, on as on2, createEffect as createEffect2, createMemo as createMemo6, createSignal as createSignal6 } from "solid-js";
4660
4660
  import { Dynamic as Dynamic4 } from "solid-js/web";
4661
4661
  function BlocksWrapper(props) {
4662
+ const [shouldUpdate, setShouldUpdate] = createSignal6(false);
4662
4663
  const className = createMemo6(() => {
4663
4664
  return [
4664
4665
  "builder-blocks",
@@ -4705,9 +4706,13 @@ function BlocksWrapper(props) {
4705
4706
  let blocksWrapperRef;
4706
4707
  onMount3(() => {
4707
4708
  });
4709
+ const onUpdateFn_0_props_blocks = createMemo6(() => props.blocks);
4710
+ function onUpdateFn_0() {
4711
+ }
4712
+ createEffect2(on2(() => [onUpdateFn_0_props_blocks()], onUpdateFn_0));
4708
4713
  return <>
4709
4714
  <Dynamic4
4710
- class={className() + " dynamic-3d7ff108"}
4715
+ class={className() + " dynamic-023c60f2"}
4711
4716
  ref={blocksWrapperRef}
4712
4717
  builder-path={dataPath()}
4713
4718
  builder-parent-id={props.parent}
@@ -4719,7 +4724,7 @@ function BlocksWrapper(props) {
4719
4724
  {...props.BlocksWrapperProps}
4720
4725
  component={props.BlocksWrapper}
4721
4726
  >{props.children}</Dynamic4>
4722
- <style>{`.dynamic-3d7ff108 {
4727
+ <style>{`.dynamic-023c60f2 {
4723
4728
  display: flex;
4724
4729
  flex-direction: column;
4725
4730
  align-items: stretch;
@@ -5022,10 +5027,11 @@ function Image(props) {
5022
5027
  <picture>
5023
5028
  <Show8 when={webpSrcSet()}><source type="image/webp" srcset={webpSrcSet()} /></Show8>
5024
5029
  <img
5025
- class={"builder-image" + (props.className ? " " + props.className : "") + " img-dc6700b4"}
5030
+ class={"builder-image" + (props.className ? " " + props.className : "") + " img-040e729e"}
5026
5031
  loading={props.highPriority ? "eager" : "lazy"}
5027
5032
  fetchpriority={props.highPriority ? "high" : "auto"}
5028
5033
  alt={props.altText}
5034
+ title={props.title}
5029
5035
  role={props.altText ? void 0 : "presentation"}
5030
5036
  style={{
5031
5037
  "object-position": props.backgroundPosition || "center",
@@ -5040,22 +5046,22 @@ function Image(props) {
5040
5046
  <Show8
5041
5047
  when={props.aspectRatio && !(props.builderBlock?.children?.length && props.fitContent)}
5042
5048
  ><div
5043
- class="builder-image-sizer div-dc6700b4"
5049
+ class="builder-image-sizer div-040e729e"
5044
5050
  style={{
5045
5051
  "padding-top": props.aspectRatio * 100 + "%"
5046
5052
  }}
5047
5053
  /></Show8>
5048
5054
  <Show8 when={props.builderBlock?.children?.length && props.fitContent}>{props.children}</Show8>
5049
- <Show8 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-dc6700b4-2">{props.children}</div></Show8>
5055
+ <Show8 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-040e729e-2">{props.children}</div></Show8>
5050
5056
  </>
5051
- <style>{`.img-dc6700b4 {
5057
+ <style>{`.img-040e729e {
5052
5058
  opacity: 1;
5053
5059
  transition: opacity 0.2s ease-in-out;
5054
- }.div-dc6700b4 {
5060
+ }.div-040e729e {
5055
5061
  width: 100%;
5056
5062
  pointer-events: none;
5057
5063
  font-size: 0;
5058
- }.div-dc6700b4-2 {
5064
+ }.div-040e729e-2 {
5059
5065
  display: flex;
5060
5066
  flex-direction: column;
5061
5067
  align-items: stretch;
@@ -5091,7 +5097,7 @@ function SectionComponent(props) {
5091
5097
  var section_default = SectionComponent;
5092
5098
 
5093
5099
  // src/blocks/symbol/symbol.tsx
5094
- import { onMount as onMount9, on as on4, createEffect as createEffect4, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
5100
+ import { onMount as onMount9, on as on6, createEffect as createEffect6, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
5095
5101
 
5096
5102
  // src/components/content-variants/content-variants.tsx
5097
5103
  import { Show as Show16, For as For9, onMount as onMount8, createSignal as createSignal19, createMemo as createMemo19 } from "solid-js";
@@ -5989,6 +5995,10 @@ var componentInfo5 = {
5989
5995
  name: "altText",
5990
5996
  type: "string",
5991
5997
  helperText: "Text to display when the user has images off"
5998
+ }, {
5999
+ name: "title",
6000
+ type: "string",
6001
+ helperText: "Text to display when hovering over the asset"
5992
6002
  }, {
5993
6003
  name: "height",
5994
6004
  type: "number",
@@ -6799,13 +6809,12 @@ var componentInfo12 = {
6799
6809
  };
6800
6810
 
6801
6811
  // src/blocks/custom-code/custom-code.tsx
6802
- import { onMount as onMount5, createSignal as createSignal12 } from "solid-js";
6812
+ import { onMount as onMount5, on as on3, createEffect as createEffect3, createMemo as createMemo12, createSignal as createSignal12 } from "solid-js";
6803
6813
  function CustomCode(props) {
6804
6814
  const [scriptsInserted, setScriptsInserted] = createSignal12([]);
6805
6815
  const [scriptsRun, setScriptsRun] = createSignal12([]);
6806
- let elementRef;
6807
- onMount5(() => {
6808
- if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
6816
+ function runScripts() {
6817
+ if (!elementRef || !elementRef?.getElementsByTagName || typeof window === "undefined") {
6809
6818
  return;
6810
6819
  }
6811
6820
  const scripts = elementRef.getElementsByTagName("script");
@@ -6832,10 +6841,25 @@ function CustomCode(props) {
6832
6841
  scriptsRun().push(script.innerText);
6833
6842
  new Function(script.innerText)();
6834
6843
  } catch (error) {
6844
+ logger.warn(
6845
+ "[BUILDER.IO] `CustomCode`: Error running script:",
6846
+ error
6847
+ );
6835
6848
  }
6836
6849
  }
6837
6850
  }
6851
+ }
6852
+ let elementRef;
6853
+ onMount5(() => {
6854
+ runScripts();
6838
6855
  });
6856
+ const onUpdateFn_0_props_code = createMemo12(() => props.code);
6857
+ function onUpdateFn_0() {
6858
+ if (isEditing()) {
6859
+ runScripts();
6860
+ }
6861
+ }
6862
+ createEffect3(on3(() => [onUpdateFn_0_props_code()], onUpdateFn_0));
6839
6863
  return <><div
6840
6864
  class={"builder-custom-code" + (props.replaceNodes ? " replace-nodes" : "")}
6841
6865
  ref={elementRef}
@@ -6863,7 +6887,7 @@ var componentInfo13 = {
6863
6887
  };
6864
6888
 
6865
6889
  // src/blocks/embed/embed.tsx
6866
- import { on as on2, createEffect as createEffect2, createMemo as createMemo13, createSignal as createSignal13 } from "solid-js";
6890
+ import { on as on4, createEffect as createEffect4, createMemo as createMemo13, createSignal as createSignal13 } from "solid-js";
6867
6891
 
6868
6892
  // src/blocks/embed/helpers.ts
6869
6893
  var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"];
@@ -6891,6 +6915,7 @@ function Embed(props) {
6891
6915
  scriptsRun().push(script.innerText);
6892
6916
  new Function(script.innerText)();
6893
6917
  } catch (error) {
6918
+ logger.warn("[BUILDER.IO] `Embed`: Error running script:", error);
6894
6919
  }
6895
6920
  }
6896
6921
  }
@@ -6904,8 +6929,8 @@ function Embed(props) {
6904
6929
  findAndRunScripts();
6905
6930
  }
6906
6931
  }
6907
- createEffect2(
6908
- on2(() => [onUpdateFn_0_elem(), onUpdateFn_0_ranInitFn__()], onUpdateFn_0)
6932
+ createEffect4(
6933
+ on4(() => [onUpdateFn_0_elem(), onUpdateFn_0_ranInitFn__()], onUpdateFn_0)
6909
6934
  );
6910
6935
  return <><div class="builder-embed" ref={elem} innerHTML={props.content} /></>;
6911
6936
  }
@@ -7946,7 +7971,7 @@ function serializeIncludingFunctions(info) {
7946
7971
  }
7947
7972
 
7948
7973
  // src/components/content-variants/inlined-fns.ts
7949
- 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}";
7974
+ 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}";
7950
7975
  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}";
7951
7976
 
7952
7977
  // src/components/content-variants/helpers.ts
@@ -7975,6 +8000,7 @@ var checkShouldRenderVariants2 = ({
7975
8000
  return true;
7976
8001
  };
7977
8002
  var getIsHydrationTarget = (target) => target === "react" || target === "reactNative";
8003
+ var isAngularSDK = TARGET === "angular";
7978
8004
  var isHydrationTarget = getIsHydrationTarget(TARGET);
7979
8005
  var getInitVariantsFnsScriptString = () => `
7980
8006
  window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
@@ -7982,7 +8008,7 @@ var getInitVariantsFnsScriptString = () => `
7982
8008
  `;
7983
8009
  var getUpdateCookieAndStylesScript = (variants, contentId) => `
7984
8010
  window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME}(
7985
- "${contentId}",${JSON.stringify(variants)}, ${isHydrationTarget}
8011
+ "${contentId}",${JSON.stringify(variants)}, ${isHydrationTarget}, ${isAngularSDK}
7986
8012
  )`;
7987
8013
  var getUpdateVariantVisibilityScript = ({
7988
8014
  contentId,
@@ -7995,8 +8021,8 @@ var getUpdateVariantVisibilityScript = ({
7995
8021
  import {
7996
8022
  Show as Show14,
7997
8023
  onMount as onMount7,
7998
- on as on3,
7999
- createEffect as createEffect3,
8024
+ on as on5,
8025
+ createEffect as createEffect5,
8000
8026
  createMemo as createMemo16,
8001
8027
  createSignal as createSignal16
8002
8028
  } from "solid-js";
@@ -8008,7 +8034,7 @@ function getPreviewContent(_searchParams) {
8008
8034
  }
8009
8035
 
8010
8036
  // src/constants/sdk-version.ts
8011
- var SDK_VERSION = "4.0.2";
8037
+ var SDK_VERSION = "4.0.4";
8012
8038
 
8013
8039
  // src/helpers/sdk-headers.ts
8014
8040
  var getSdkHeaders = () => ({
@@ -9093,15 +9119,15 @@ function EnableEditor(props) {
9093
9119
  mergeNewContent(props.content);
9094
9120
  }
9095
9121
  }
9096
- createEffect3(on3(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
9122
+ createEffect5(on5(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
9097
9123
  const onUpdateFn_1_props_builderContextSignal_rootState = createMemo16(
9098
9124
  () => props.builderContextSignal.rootState
9099
9125
  );
9100
9126
  function onUpdateFn_1() {
9101
9127
  emitStateUpdate();
9102
9128
  }
9103
- createEffect3(
9104
- on3(
9129
+ createEffect5(
9130
+ on5(
9105
9131
  () => [onUpdateFn_1_props_builderContextSignal_rootState()],
9106
9132
  onUpdateFn_1
9107
9133
  )
@@ -9112,7 +9138,7 @@ function EnableEditor(props) {
9112
9138
  mergeNewRootState(props.data);
9113
9139
  }
9114
9140
  }
9115
- createEffect3(on3(() => [onUpdateFn_2_props_data()], onUpdateFn_2));
9141
+ createEffect5(on5(() => [onUpdateFn_2_props_data()], onUpdateFn_2));
9116
9142
  const onUpdateFn_3_props_locale = createMemo16(() => props.locale);
9117
9143
  function onUpdateFn_3() {
9118
9144
  if (props.locale) {
@@ -9121,7 +9147,7 @@ function EnableEditor(props) {
9121
9147
  });
9122
9148
  }
9123
9149
  }
9124
- createEffect3(on3(() => [onUpdateFn_3_props_locale()], onUpdateFn_3));
9150
+ createEffect5(on5(() => [onUpdateFn_3_props_locale()], onUpdateFn_3));
9125
9151
  return <><builder_context_default.Provider value={props.builderContextSignal}><Show14
9126
9152
  when={props.builderContextSignal.content || needsElementRefDivForEditing()}
9127
9153
  ><Dynamic5
@@ -9499,7 +9525,7 @@ function Symbol2(props) {
9499
9525
  function onUpdateFn_0() {
9500
9526
  setContent();
9501
9527
  }
9502
- createEffect4(on4(() => [onUpdateFn_0_props_symbol()], onUpdateFn_0));
9528
+ createEffect6(on6(() => [onUpdateFn_0_props_symbol()], onUpdateFn_0));
9503
9529
  return <><div class={className()} {...{}} {...props.attributes} {...{}}><Content_variants_default
9504
9530
  nonce={props.builderContext.nonce}
9505
9531
  isNestedRender={true}
package/lib/node/dev.js CHANGED
@@ -1810,12 +1810,13 @@ function Block(props) {
1810
1810
  });
1811
1811
  }
1812
1812
  var block_default = Block;
1813
- var _tmpl$2 = /* @__PURE__ */ template(`<style>.dynamic-3d7ff108 {
1813
+ var _tmpl$2 = /* @__PURE__ */ template(`<style>.dynamic-023c60f2 {
1814
1814
  display: flex;
1815
1815
  flex-direction: column;
1816
1816
  align-items: stretch;
1817
1817
  }`);
1818
1818
  function BlocksWrapper(props) {
1819
+ createSignal(false);
1819
1820
  const className = createMemo(() => {
1820
1821
  return ["builder-blocks", !props.blocks?.length ? "no-blocks" : "", props.classNameProp].filter(Boolean).join(" ");
1821
1822
  });
@@ -1852,9 +1853,13 @@ function BlocksWrapper(props) {
1852
1853
  let blocksWrapperRef;
1853
1854
  onMount(() => {
1854
1855
  });
1856
+ const onUpdateFn_0_props_blocks = createMemo(() => props.blocks);
1857
+ function onUpdateFn_0() {
1858
+ }
1859
+ createEffect(on(() => [onUpdateFn_0_props_blocks()], onUpdateFn_0));
1855
1860
  return [createComponent(Dynamic, mergeProps({
1856
1861
  get ["class"]() {
1857
- return className() + " dynamic-3d7ff108";
1862
+ return className() + " dynamic-023c60f2";
1858
1863
  },
1859
1864
  ref(r$) {
1860
1865
  const _ref$ = blocksWrapperRef;
@@ -2207,16 +2212,16 @@ function getSrcSet(url) {
2207
2212
  // src/blocks/image/image.tsx
2208
2213
  var _tmpl$5 = /* @__PURE__ */ template(`<source type=image/webp>`);
2209
2214
  var _tmpl$23 = /* @__PURE__ */ template(`<picture><img>`);
2210
- var _tmpl$32 = /* @__PURE__ */ template(`<div class="builder-image-sizer div-dc6700b4">`);
2211
- var _tmpl$42 = /* @__PURE__ */ template(`<div class=div-dc6700b4-2>`);
2212
- var _tmpl$52 = /* @__PURE__ */ template(`<style>.img-dc6700b4 {
2215
+ var _tmpl$32 = /* @__PURE__ */ template(`<div class="builder-image-sizer div-040e729e">`);
2216
+ var _tmpl$42 = /* @__PURE__ */ template(`<div class=div-040e729e-2>`);
2217
+ var _tmpl$52 = /* @__PURE__ */ template(`<style>.img-040e729e {
2213
2218
  opacity: 1;
2214
2219
  transition: opacity 0.2s ease-in-out;
2215
- }.div-dc6700b4 {
2220
+ }.div-040e729e {
2216
2221
  width: 100%;
2217
2222
  pointer-events: none;
2218
2223
  font-size: 0;
2219
- }.div-dc6700b4-2 {
2224
+ }.div-040e729e-2 {
2220
2225
  display: flex;
2221
2226
  flex-direction: column;
2222
2227
  align-items: stretch;
@@ -2279,20 +2284,21 @@ function Image(props) {
2279
2284
  }
2280
2285
  }), _el$3);
2281
2286
  effect((_p$) => {
2282
- 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 = {
2287
+ 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 = {
2283
2288
  "object-position": props.backgroundPosition || "center",
2284
2289
  "object-fit": props.backgroundSize || "cover",
2285
2290
  ...aspectRatioCss()
2286
- }, _v$7 = props.image, _v$8 = srcSetToUse(), _v$9 = props.sizes;
2291
+ }, _v$8 = props.image, _v$9 = srcSetToUse(), _v$10 = props.sizes;
2287
2292
  _v$ !== _p$._v$ && className(_el$3, _p$._v$ = _v$);
2288
2293
  _v$2 !== _p$._v$2 && setAttribute(_el$3, "loading", _p$._v$2 = _v$2);
2289
2294
  _v$3 !== _p$._v$3 && setAttribute(_el$3, "fetchpriority", _p$._v$3 = _v$3);
2290
2295
  _v$4 !== _p$._v$4 && setAttribute(_el$3, "alt", _p$._v$4 = _v$4);
2291
- _v$5 !== _p$._v$5 && setAttribute(_el$3, "role", _p$._v$5 = _v$5);
2292
- _p$._v$6 = style(_el$3, _v$6, _p$._v$6);
2293
- _v$7 !== _p$._v$7 && setAttribute(_el$3, "src", _p$._v$7 = _v$7);
2294
- _v$8 !== _p$._v$8 && setAttribute(_el$3, "srcset", _p$._v$8 = _v$8);
2295
- _v$9 !== _p$._v$9 && setAttribute(_el$3, "sizes", _p$._v$9 = _v$9);
2296
+ _v$5 !== _p$._v$5 && setAttribute(_el$3, "title", _p$._v$5 = _v$5);
2297
+ _v$6 !== _p$._v$6 && setAttribute(_el$3, "role", _p$._v$6 = _v$6);
2298
+ _p$._v$7 = style(_el$3, _v$7, _p$._v$7);
2299
+ _v$8 !== _p$._v$8 && setAttribute(_el$3, "src", _p$._v$8 = _v$8);
2300
+ _v$9 !== _p$._v$9 && setAttribute(_el$3, "srcset", _p$._v$9 = _v$9);
2301
+ _v$10 !== _p$._v$10 && setAttribute(_el$3, "sizes", _p$._v$10 = _v$10);
2296
2302
  return _p$;
2297
2303
  }, {
2298
2304
  _v$: void 0,
@@ -2303,7 +2309,8 @@ function Image(props) {
2303
2309
  _v$6: void 0,
2304
2310
  _v$7: void 0,
2305
2311
  _v$8: void 0,
2306
- _v$9: void 0
2312
+ _v$9: void 0,
2313
+ _v$10: void 0
2307
2314
  });
2308
2315
  return _el$;
2309
2316
  })(), createComponent(Show, {
@@ -3287,6 +3294,10 @@ var componentInfo5 = {
3287
3294
  name: "altText",
3288
3295
  type: "string",
3289
3296
  helperText: "Text to display when the user has images off"
3297
+ }, {
3298
+ name: "title",
3299
+ type: "string",
3300
+ helperText: "Text to display when hovering over the asset"
3290
3301
  }, {
3291
3302
  name: "height",
3292
3303
  type: "number",
@@ -4170,9 +4181,8 @@ var _tmpl$13 = /* @__PURE__ */ template(`<div>`);
4170
4181
  function CustomCode(props) {
4171
4182
  const [scriptsInserted, setScriptsInserted] = createSignal([]);
4172
4183
  const [scriptsRun, setScriptsRun] = createSignal([]);
4173
- let elementRef;
4174
- onMount(() => {
4175
- if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
4184
+ function runScripts() {
4185
+ if (!elementRef || !elementRef?.getElementsByTagName || typeof window === "undefined") {
4176
4186
  return;
4177
4187
  }
4178
4188
  const scripts = elementRef.getElementsByTagName("script");
@@ -4195,11 +4205,22 @@ function CustomCode(props) {
4195
4205
  scriptsRun().push(script.innerText);
4196
4206
  new Function(script.innerText)();
4197
4207
  } catch (error2) {
4198
- console.warn("`CustomCode`: Error running script:", error2);
4208
+ logger.warn("[BUILDER.IO] `CustomCode`: Error running script:", error2);
4199
4209
  }
4200
4210
  }
4201
4211
  }
4212
+ }
4213
+ let elementRef;
4214
+ onMount(() => {
4215
+ runScripts();
4202
4216
  });
4217
+ const onUpdateFn_0_props_code = createMemo(() => props.code);
4218
+ function onUpdateFn_0() {
4219
+ if (isEditing()) {
4220
+ runScripts();
4221
+ }
4222
+ }
4223
+ createEffect(on(() => [onUpdateFn_0_props_code()], onUpdateFn_0));
4203
4224
  return (() => {
4204
4225
  const _el$ = _tmpl$13();
4205
4226
  const _ref$ = elementRef;
@@ -4263,7 +4284,7 @@ function Embed(props) {
4263
4284
  scriptsRun().push(script.innerText);
4264
4285
  new Function(script.innerText)();
4265
4286
  } catch (error2) {
4266
- console.warn("`Embed`: Error running script:", error2);
4287
+ logger.warn("[BUILDER.IO] `Embed`: Error running script:", error2);
4267
4288
  }
4268
4289
  }
4269
4290
  }
@@ -5448,7 +5469,7 @@ function serializeIncludingFunctions(info) {
5448
5469
  }
5449
5470
 
5450
5471
  // src/components/content-variants/inlined-fns.ts
5451
- 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}";
5472
+ 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}";
5452
5473
  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}";
5453
5474
 
5454
5475
  // src/components/content-variants/helpers.ts
@@ -5477,6 +5498,7 @@ var checkShouldRenderVariants2 = ({
5477
5498
  return true;
5478
5499
  };
5479
5500
  var getIsHydrationTarget = (target) => target === "react" || target === "reactNative";
5501
+ var isAngularSDK = TARGET === "angular";
5480
5502
  var isHydrationTarget = getIsHydrationTarget(TARGET);
5481
5503
  var getInitVariantsFnsScriptString = () => `
5482
5504
  window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
@@ -5484,7 +5506,7 @@ var getInitVariantsFnsScriptString = () => `
5484
5506
  `;
5485
5507
  var getUpdateCookieAndStylesScript = (variants, contentId) => `
5486
5508
  window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME}(
5487
- "${contentId}",${JSON.stringify(variants)}, ${isHydrationTarget}
5509
+ "${contentId}",${JSON.stringify(variants)}, ${isHydrationTarget}, ${isAngularSDK}
5488
5510
  )`;
5489
5511
  var getUpdateVariantVisibilityScript = ({
5490
5512
  contentId,
@@ -5499,7 +5521,7 @@ function getPreviewContent(_searchParams) {
5499
5521
  }
5500
5522
 
5501
5523
  // src/constants/sdk-version.ts
5502
- var SDK_VERSION = "4.0.2";
5524
+ var SDK_VERSION = "4.0.4";
5503
5525
 
5504
5526
  // src/helpers/sdk-headers.ts
5505
5527
  var getSdkHeaders = () => ({