@builder.io/sdk-solid 2.0.1 → 2.0.3

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/index.js CHANGED
@@ -4703,7 +4703,7 @@ var getColumnsClass = (id2) => {
4703
4703
 
4704
4704
  // src/blocks/columns/columns.tsx
4705
4705
  var _tmpl$3 = /* @__PURE__ */ template(`<div>`);
4706
- var _tmpl$22 = /* @__PURE__ */ template(`<style>.div-5b8fb3ac {
4706
+ var _tmpl$22 = /* @__PURE__ */ template(`<style>.div-3ff242de {
4707
4707
  display: flex;
4708
4708
  line-height: normal;
4709
4709
  }`);
@@ -4783,6 +4783,7 @@ function Columns(props) {
4783
4783
  return breakpointSizes[size].max;
4784
4784
  }
4785
4785
  function columnsStyles() {
4786
+ const childColumnDiv = `.${props.builderBlock.id}-breakpoints > .builder-column`;
4786
4787
  return `
4787
4788
  @media (max-width: ${getWidthForBreakpointSize("medium")}px) {
4788
4789
  .${props.builderBlock.id}-breakpoints {
@@ -4790,7 +4791,7 @@ function Columns(props) {
4790
4791
  align-items: stretch;
4791
4792
  }
4792
4793
 
4793
- .${props.builderBlock.id}-breakpoints > .builder-column {
4794
+ ${childColumnDiv} {
4794
4795
  width: var(--column-width-tablet) !important;
4795
4796
  margin-left: var(--column-margin-left-tablet) !important;
4796
4797
  }
@@ -4802,7 +4803,7 @@ function Columns(props) {
4802
4803
  align-items: stretch;
4803
4804
  }
4804
4805
 
4805
- .${props.builderBlock.id}-breakpoints > .builder-column {
4806
+ ${childColumnDiv} {
4806
4807
  width: var(--column-width-mobile) !important;
4807
4808
  margin-left: var(--column-margin-left-mobile) !important;
4808
4809
  }
@@ -4823,7 +4824,7 @@ function Columns(props) {
4823
4824
  const _el$ = _tmpl$3();
4824
4825
  spread(_el$, mergeProps({
4825
4826
  get ["class"]() {
4826
- return getColumnsClass(props.builderBlock?.id) + " div-5b8fb3ac";
4827
+ return getColumnsClass(props.builderBlock?.id) + " div-3ff242de";
4827
4828
  },
4828
4829
  get style() {
4829
4830
  return columnsCssVars();
@@ -4948,16 +4949,16 @@ function getSrcSet(url) {
4948
4949
  // src/blocks/image/image.tsx
4949
4950
  var _tmpl$5 = /* @__PURE__ */ template(`<source type=image/webp>`);
4950
4951
  var _tmpl$23 = /* @__PURE__ */ template(`<picture><img>`);
4951
- var _tmpl$32 = /* @__PURE__ */ template(`<div class="builder-image-sizer div-54b38751">`);
4952
- var _tmpl$42 = /* @__PURE__ */ template(`<div class=div-54b38751-2>`);
4953
- var _tmpl$52 = /* @__PURE__ */ template(`<style>.img-54b38751 {
4952
+ var _tmpl$32 = /* @__PURE__ */ template(`<div class="builder-image-sizer div-e3b1053e">`);
4953
+ var _tmpl$42 = /* @__PURE__ */ template(`<div class=div-e3b1053e-2>`);
4954
+ var _tmpl$52 = /* @__PURE__ */ template(`<style>.img-e3b1053e {
4954
4955
  opacity: 1;
4955
4956
  transition: opacity 0.2s ease-in-out;
4956
- }.div-54b38751 {
4957
+ }.div-e3b1053e {
4957
4958
  width: 100%;
4958
4959
  pointer-events: none;
4959
4960
  font-size: 0;
4960
- }.div-54b38751-2 {
4961
+ }.div-e3b1053e-2 {
4961
4962
  display: flex;
4962
4963
  flex-direction: column;
4963
4964
  align-items: stretch;
@@ -4976,6 +4977,9 @@ function Image(props) {
4976
4977
  !(url.match(/builder\.io/) || url.match(/cdn\.shopify\.com/))) {
4977
4978
  return props.srcset;
4978
4979
  }
4980
+ if (props.noWebp) {
4981
+ return void 0;
4982
+ }
4979
4983
  if (props.srcset && props.image?.includes("builder.io/api/v1/image")) {
4980
4984
  if (!props.srcset.includes(props.image.split("?")[0])) {
4981
4985
  return getSrcSet(url);
@@ -5016,7 +5020,7 @@ function Image(props) {
5016
5020
  }
5017
5021
  }), _el$3);
5018
5022
  effect((_p$) => {
5019
- const _v$ = "builder-image" + (props.className ? " " + props.className : "") + " img-54b38751", _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 = {
5023
+ const _v$ = "builder-image" + (props.className ? " " + props.className : "") + " img-e3b1053e", _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 = {
5020
5024
  "object-position": props.backgroundPosition || "center",
5021
5025
  "object-fit": props.backgroundSize || "cover",
5022
5026
  ...aspectRatioCss()
@@ -7708,17 +7712,14 @@ var serializeFn = (fnValue) => {
7708
7712
  const appendFunction = !fnStr.startsWith("function") && !fnStr.startsWith("(");
7709
7713
  return `return (${appendFunction ? "function " : ""}${fnStr}).apply(this, arguments)`;
7710
7714
  };
7711
- var serializeValue = (value) => typeof value === "function" ? serializeFn(value) : fastClone(value);
7712
- var serializeComponentInfo = ({
7713
- inputs,
7714
- ...info
7715
- }) => ({
7716
- ...fastClone(info),
7717
- inputs: inputs?.map((input) => Object.entries(input).reduce((acc, [key, value]) => ({
7718
- ...acc,
7719
- [key]: serializeValue(value)
7720
- }), {}))
7721
- });
7715
+ function serializeComponentInfo(info) {
7716
+ return JSON.parse(JSON.stringify(info, (key, value) => {
7717
+ if (typeof value === "function") {
7718
+ return serializeFn(value);
7719
+ }
7720
+ return value;
7721
+ }));
7722
+ }
7722
7723
 
7723
7724
  // src/components/content-variants/inlined-fns.ts
7724
7725
  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}";
@@ -8279,7 +8280,7 @@ function isFromTrustedHost(trustedHosts, e) {
8279
8280
  }
8280
8281
 
8281
8282
  // src/constants/sdk-version.ts
8282
- var SDK_VERSION = "2.0.1";
8283
+ var SDK_VERSION = "2.0.3";
8283
8284
 
8284
8285
  // src/functions/register.ts
8285
8286
  var registry = {};
@@ -8912,7 +8913,15 @@ function ContentComponent(props) {
8912
8913
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
8913
8914
  contentId: props.content?.id
8914
8915
  }));
8915
- const [registeredComponents, setRegisteredComponents] = createSignal([...getDefaultRegisteredComponents(), ...props.customComponents || []].reduce((acc, {
8916
+ const [registeredComponents, setRegisteredComponents] = createSignal([...getDefaultRegisteredComponents(), ...props.customComponents?.filter(({
8917
+ models
8918
+ }) => {
8919
+ if (!models?.length)
8920
+ return true;
8921
+ if (!props.model)
8922
+ return true;
8923
+ return models.includes(props.model);
8924
+ }) || []].reduce((acc, {
8916
8925
  component,
8917
8926
  ...info
8918
8927
  }) => ({
@@ -8938,7 +8947,15 @@ function ContentComponent(props) {
8938
8947
  canTrack: props.canTrack,
8939
8948
  apiKey: props.apiKey,
8940
8949
  apiVersion: props.apiVersion,
8941
- componentInfos: [...getDefaultRegisteredComponents(), ...props.customComponents || []].reduce((acc, {
8950
+ componentInfos: [...getDefaultRegisteredComponents(), ...props.customComponents?.filter(({
8951
+ models
8952
+ }) => {
8953
+ if (!models?.length)
8954
+ return true;
8955
+ if (!props.model)
8956
+ return true;
8957
+ return models.includes(props.model);
8958
+ }) || []].reduce((acc, {
8942
8959
  component: _,
8943
8960
  ...info
8944
8961
  }) => ({
@@ -4606,6 +4606,7 @@ function Columns(props) {
4606
4606
  return breakpointSizes[size].max;
4607
4607
  }
4608
4608
  function columnsStyles() {
4609
+ const childColumnDiv = `.${props.builderBlock.id}-breakpoints > .builder-column`;
4609
4610
  return `
4610
4611
  @media (max-width: ${getWidthForBreakpointSize("medium")}px) {
4611
4612
  .${props.builderBlock.id}-breakpoints {
@@ -4613,7 +4614,7 @@ function Columns(props) {
4613
4614
  align-items: stretch;
4614
4615
  }
4615
4616
 
4616
- .${props.builderBlock.id}-breakpoints > .builder-column {
4617
+ ${childColumnDiv} {
4617
4618
  width: var(--column-width-tablet) !important;
4618
4619
  margin-left: var(--column-margin-left-tablet) !important;
4619
4620
  }
@@ -4625,7 +4626,7 @@ function Columns(props) {
4625
4626
  align-items: stretch;
4626
4627
  }
4627
4628
 
4628
- .${props.builderBlock.id}-breakpoints > .builder-column {
4629
+ ${childColumnDiv} {
4629
4630
  width: var(--column-width-mobile) !important;
4630
4631
  margin-left: var(--column-margin-left-mobile) !important;
4631
4632
  }
@@ -4644,7 +4645,7 @@ function Columns(props) {
4644
4645
  }
4645
4646
  return <>
4646
4647
  <div
4647
- class={getColumnsClass(props.builderBlock?.id) + " div-5b8fb3ac"}
4648
+ class={getColumnsClass(props.builderBlock?.id) + " div-3ff242de"}
4648
4649
  style={columnsCssVars()}
4649
4650
  {...{}}
4650
4651
  >
@@ -4673,7 +4674,7 @@ function Columns(props) {
4673
4674
  /></Dynamic_renderer_default>;
4674
4675
  }}</For4>
4675
4676
  </div>
4676
- <style>{`.div-5b8fb3ac {
4677
+ <style>{`.div-3ff242de {
4677
4678
  display: flex;
4678
4679
  line-height: normal;
4679
4680
  }`}</style>
@@ -4747,6 +4748,9 @@ function Image(props) {
4747
4748
  !(url.match(/builder\.io/) || url.match(/cdn\.shopify\.com/))) {
4748
4749
  return props.srcset;
4749
4750
  }
4751
+ if (props.noWebp) {
4752
+ return void 0;
4753
+ }
4750
4754
  if (props.srcset && props.image?.includes("builder.io/api/v1/image")) {
4751
4755
  if (!props.srcset.includes(props.image.split("?")[0])) {
4752
4756
  return getSrcSet(url);
@@ -4779,7 +4783,7 @@ function Image(props) {
4779
4783
  <picture>
4780
4784
  <Show7 when={webpSrcSet()}><source type="image/webp" srcset={webpSrcSet()} /></Show7>
4781
4785
  <img
4782
- class={"builder-image" + (props.className ? " " + props.className : "") + " img-54b38751"}
4786
+ class={"builder-image" + (props.className ? " " + props.className : "") + " img-e3b1053e"}
4783
4787
  loading={props.highPriority ? "eager" : "lazy"}
4784
4788
  fetchpriority={props.highPriority ? "high" : "auto"}
4785
4789
  alt={props.altText}
@@ -4797,22 +4801,22 @@ function Image(props) {
4797
4801
  <Show7
4798
4802
  when={props.aspectRatio && !(props.builderBlock?.children?.length && props.fitContent)}
4799
4803
  ><div
4800
- class="builder-image-sizer div-54b38751"
4804
+ class="builder-image-sizer div-e3b1053e"
4801
4805
  style={{
4802
4806
  "padding-top": props.aspectRatio * 100 + "%"
4803
4807
  }}
4804
4808
  /></Show7>
4805
4809
  <Show7 when={props.builderBlock?.children?.length && props.fitContent}>{props.children}</Show7>
4806
- <Show7 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-54b38751-2">{props.children}</div></Show7>
4810
+ <Show7 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-e3b1053e-2">{props.children}</div></Show7>
4807
4811
  </>
4808
- <style>{`.img-54b38751 {
4812
+ <style>{`.img-e3b1053e {
4809
4813
  opacity: 1;
4810
4814
  transition: opacity 0.2s ease-in-out;
4811
- }.div-54b38751 {
4815
+ }.div-e3b1053e {
4812
4816
  width: 100%;
4813
4817
  pointer-events: none;
4814
4818
  font-size: 0;
4815
- }.div-54b38751-2 {
4819
+ }.div-e3b1053e-2 {
4816
4820
  display: flex;
4817
4821
  flex-direction: column;
4818
4822
  align-items: stretch;
@@ -4848,16 +4852,10 @@ function SectionComponent(props) {
4848
4852
  var section_default = SectionComponent;
4849
4853
 
4850
4854
  // src/blocks/symbol/symbol.tsx
4851
- import { onMount as onMount5, on as on4, createEffect as createEffect4, createMemo as createMemo19, createSignal as createSignal19 } from "solid-js";
4855
+ import { onMount as onMount5, on as on3, createEffect as createEffect3, createMemo as createMemo19, createSignal as createSignal19 } from "solid-js";
4852
4856
 
4853
4857
  // src/components/content-variants/content-variants.tsx
4854
- import {
4855
- Show as Show14,
4856
- For as For9,
4857
- onMount as onMount4,
4858
- createMemo as createMemo18,
4859
- createSignal as createSignal18
4860
- } from "solid-js";
4858
+ import { Show as Show14, For as For9, onMount as onMount4, createSignal as createSignal18, createMemo as createMemo18 } from "solid-js";
4861
4859
 
4862
4860
  // src/helpers/url.ts
4863
4861
  var getTopLevelDomain = (host) => {
@@ -7227,17 +7225,14 @@ var serializeFn = (fnValue) => {
7227
7225
  const appendFunction = !fnStr.startsWith("function") && !fnStr.startsWith("(");
7228
7226
  return `return (${appendFunction ? "function " : ""}${fnStr}).apply(this, arguments)`;
7229
7227
  };
7230
- var serializeValue = (value) => typeof value === "function" ? serializeFn(value) : fastClone(value);
7231
- var serializeComponentInfo = ({
7232
- inputs,
7233
- ...info
7234
- }) => ({
7235
- ...fastClone(info),
7236
- inputs: inputs?.map((input) => Object.entries(input).reduce((acc, [key, value]) => ({
7237
- ...acc,
7238
- [key]: serializeValue(value)
7239
- }), {}))
7240
- });
7228
+ function serializeComponentInfo(info) {
7229
+ return JSON.parse(JSON.stringify(info, (key, value) => {
7230
+ if (typeof value === "function") {
7231
+ return serializeFn(value);
7232
+ }
7233
+ return value;
7234
+ }));
7235
+ }
7241
7236
 
7242
7237
  // src/components/content-variants/inlined-fns.ts
7243
7238
  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}";
@@ -7800,7 +7795,7 @@ function isFromTrustedHost(trustedHosts, e) {
7800
7795
  }
7801
7796
 
7802
7797
  // src/constants/sdk-version.ts
7803
- var SDK_VERSION = "2.0.1";
7798
+ var SDK_VERSION = "2.0.3";
7804
7799
 
7805
7800
  // src/functions/register.ts
7806
7801
  var registry = {};
@@ -8452,7 +8447,13 @@ function ContentComponent(props) {
8452
8447
  const [registeredComponents, setRegisteredComponents] = createSignal17(
8453
8448
  [
8454
8449
  ...getDefaultRegisteredComponents(),
8455
- ...props.customComponents || []
8450
+ ...props.customComponents?.filter(({ models }) => {
8451
+ if (!models?.length)
8452
+ return true;
8453
+ if (!props.model)
8454
+ return true;
8455
+ return models.includes(props.model);
8456
+ }) || []
8456
8457
  ].reduce(
8457
8458
  (acc, { component, ...info }) => ({
8458
8459
  ...acc,
@@ -8482,7 +8483,13 @@ function ContentComponent(props) {
8482
8483
  apiVersion: props.apiVersion,
8483
8484
  componentInfos: [
8484
8485
  ...getDefaultRegisteredComponents(),
8485
- ...props.customComponents || []
8486
+ ...props.customComponents?.filter(({ models }) => {
8487
+ if (!models?.length)
8488
+ return true;
8489
+ if (!props.model)
8490
+ return true;
8491
+ return models.includes(props.model);
8492
+ }) || []
8486
8493
  ].reduce(
8487
8494
  (acc, { component: _, ...info }) => ({
8488
8495
  ...acc,
@@ -8708,7 +8715,7 @@ function Symbol2(props) {
8708
8715
  function onUpdateFn_0() {
8709
8716
  setContent();
8710
8717
  }
8711
- createEffect4(on4(() => [onUpdateFn_0_props_symbol()], onUpdateFn_0));
8718
+ createEffect3(on3(() => [onUpdateFn_0_props_symbol()], onUpdateFn_0));
8712
8719
  return <><div class={className()} {...{}} {...props.attributes} {...{}}><Content_variants_default
8713
8720
  nonce={props.builderContext.nonce}
8714
8721
  isNestedRender={true}
package/lib/node/dev.js CHANGED
@@ -1733,7 +1733,7 @@ var getColumnsClass = (id) => {
1733
1733
 
1734
1734
  // src/blocks/columns/columns.tsx
1735
1735
  var _tmpl$3 = /* @__PURE__ */ template(`<div>`);
1736
- var _tmpl$22 = /* @__PURE__ */ template(`<style>.div-5b8fb3ac {
1736
+ var _tmpl$22 = /* @__PURE__ */ template(`<style>.div-3ff242de {
1737
1737
  display: flex;
1738
1738
  line-height: normal;
1739
1739
  }`);
@@ -1813,6 +1813,7 @@ function Columns(props) {
1813
1813
  return breakpointSizes[size].max;
1814
1814
  }
1815
1815
  function columnsStyles() {
1816
+ const childColumnDiv = `.${props.builderBlock.id}-breakpoints > .builder-column`;
1816
1817
  return `
1817
1818
  @media (max-width: ${getWidthForBreakpointSize("medium")}px) {
1818
1819
  .${props.builderBlock.id}-breakpoints {
@@ -1820,7 +1821,7 @@ function Columns(props) {
1820
1821
  align-items: stretch;
1821
1822
  }
1822
1823
 
1823
- .${props.builderBlock.id}-breakpoints > .builder-column {
1824
+ ${childColumnDiv} {
1824
1825
  width: var(--column-width-tablet) !important;
1825
1826
  margin-left: var(--column-margin-left-tablet) !important;
1826
1827
  }
@@ -1832,7 +1833,7 @@ function Columns(props) {
1832
1833
  align-items: stretch;
1833
1834
  }
1834
1835
 
1835
- .${props.builderBlock.id}-breakpoints > .builder-column {
1836
+ ${childColumnDiv} {
1836
1837
  width: var(--column-width-mobile) !important;
1837
1838
  margin-left: var(--column-margin-left-mobile) !important;
1838
1839
  }
@@ -1853,7 +1854,7 @@ function Columns(props) {
1853
1854
  const _el$ = _tmpl$3();
1854
1855
  spread(_el$, mergeProps({
1855
1856
  get ["class"]() {
1856
- return getColumnsClass(props.builderBlock?.id) + " div-5b8fb3ac";
1857
+ return getColumnsClass(props.builderBlock?.id) + " div-3ff242de";
1857
1858
  },
1858
1859
  get style() {
1859
1860
  return columnsCssVars();
@@ -1978,16 +1979,16 @@ function getSrcSet(url) {
1978
1979
  // src/blocks/image/image.tsx
1979
1980
  var _tmpl$5 = /* @__PURE__ */ template(`<source type=image/webp>`);
1980
1981
  var _tmpl$23 = /* @__PURE__ */ template(`<picture><img>`);
1981
- var _tmpl$32 = /* @__PURE__ */ template(`<div class="builder-image-sizer div-54b38751">`);
1982
- var _tmpl$42 = /* @__PURE__ */ template(`<div class=div-54b38751-2>`);
1983
- var _tmpl$52 = /* @__PURE__ */ template(`<style>.img-54b38751 {
1982
+ var _tmpl$32 = /* @__PURE__ */ template(`<div class="builder-image-sizer div-e3b1053e">`);
1983
+ var _tmpl$42 = /* @__PURE__ */ template(`<div class=div-e3b1053e-2>`);
1984
+ var _tmpl$52 = /* @__PURE__ */ template(`<style>.img-e3b1053e {
1984
1985
  opacity: 1;
1985
1986
  transition: opacity 0.2s ease-in-out;
1986
- }.div-54b38751 {
1987
+ }.div-e3b1053e {
1987
1988
  width: 100%;
1988
1989
  pointer-events: none;
1989
1990
  font-size: 0;
1990
- }.div-54b38751-2 {
1991
+ }.div-e3b1053e-2 {
1991
1992
  display: flex;
1992
1993
  flex-direction: column;
1993
1994
  align-items: stretch;
@@ -2006,6 +2007,9 @@ function Image(props) {
2006
2007
  !(url.match(/builder\.io/) || url.match(/cdn\.shopify\.com/))) {
2007
2008
  return props.srcset;
2008
2009
  }
2010
+ if (props.noWebp) {
2011
+ return void 0;
2012
+ }
2009
2013
  if (props.srcset && props.image?.includes("builder.io/api/v1/image")) {
2010
2014
  if (!props.srcset.includes(props.image.split("?")[0])) {
2011
2015
  console.debug("Removed given srcset");
@@ -2047,7 +2051,7 @@ function Image(props) {
2047
2051
  }
2048
2052
  }), _el$3);
2049
2053
  effect((_p$) => {
2050
- const _v$ = "builder-image" + (props.className ? " " + props.className : "") + " img-54b38751", _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 = {
2054
+ const _v$ = "builder-image" + (props.className ? " " + props.className : "") + " img-e3b1053e", _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 = {
2051
2055
  "object-position": props.backgroundPosition || "center",
2052
2056
  "object-fit": props.backgroundSize || "cover",
2053
2057
  ...aspectRatioCss()
@@ -4742,17 +4746,14 @@ var serializeFn = (fnValue) => {
4742
4746
  const appendFunction = !fnStr.startsWith("function") && !fnStr.startsWith("(");
4743
4747
  return `return (${appendFunction ? "function " : ""}${fnStr}).apply(this, arguments)`;
4744
4748
  };
4745
- var serializeValue = (value) => typeof value === "function" ? serializeFn(value) : fastClone(value);
4746
- var serializeComponentInfo = ({
4747
- inputs,
4748
- ...info
4749
- }) => ({
4750
- ...fastClone(info),
4751
- inputs: inputs?.map((input) => Object.entries(input).reduce((acc, [key, value]) => ({
4752
- ...acc,
4753
- [key]: serializeValue(value)
4754
- }), {}))
4755
- });
4749
+ function serializeComponentInfo(info) {
4750
+ return JSON.parse(JSON.stringify(info, (key, value) => {
4751
+ if (typeof value === "function") {
4752
+ return serializeFn(value);
4753
+ }
4754
+ return value;
4755
+ }));
4756
+ }
4756
4757
 
4757
4758
  // src/components/content-variants/inlined-fns.ts
4758
4759
  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}";
@@ -5318,7 +5319,7 @@ function isFromTrustedHost(trustedHosts, e) {
5318
5319
  }
5319
5320
 
5320
5321
  // src/constants/sdk-version.ts
5321
- var SDK_VERSION = "2.0.1";
5322
+ var SDK_VERSION = "2.0.3";
5322
5323
 
5323
5324
  // src/functions/register.ts
5324
5325
  var registry = {};
@@ -5953,7 +5954,15 @@ function ContentComponent(props) {
5953
5954
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
5954
5955
  contentId: props.content?.id
5955
5956
  }));
5956
- const [registeredComponents, setRegisteredComponents] = createSignal([...getDefaultRegisteredComponents(), ...props.customComponents || []].reduce((acc, {
5957
+ const [registeredComponents, setRegisteredComponents] = createSignal([...getDefaultRegisteredComponents(), ...props.customComponents?.filter(({
5958
+ models
5959
+ }) => {
5960
+ if (!models?.length)
5961
+ return true;
5962
+ if (!props.model)
5963
+ return true;
5964
+ return models.includes(props.model);
5965
+ }) || []].reduce((acc, {
5957
5966
  component,
5958
5967
  ...info
5959
5968
  }) => ({
@@ -5979,7 +5988,15 @@ function ContentComponent(props) {
5979
5988
  canTrack: props.canTrack,
5980
5989
  apiKey: props.apiKey,
5981
5990
  apiVersion: props.apiVersion,
5982
- componentInfos: [...getDefaultRegisteredComponents(), ...props.customComponents || []].reduce((acc, {
5991
+ componentInfos: [...getDefaultRegisteredComponents(), ...props.customComponents?.filter(({
5992
+ models
5993
+ }) => {
5994
+ if (!models?.length)
5995
+ return true;
5996
+ if (!props.model)
5997
+ return true;
5998
+ return models.includes(props.model);
5999
+ }) || []].reduce((acc, {
5983
6000
  component: _,
5984
6001
  ...info
5985
6002
  }) => ({