@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/dist/index.d.ts +1 -1
- package/lib/browser/dev.js +41 -24
- package/lib/browser/dev.jsx +40 -33
- package/lib/browser/index.js +41 -24
- package/lib/browser/index.jsx +40 -33
- package/lib/edge/dev.js +41 -24
- package/lib/edge/dev.jsx +40 -33
- package/lib/edge/index.js +41 -24
- package/lib/edge/index.jsx +40 -33
- package/lib/node/dev.js +41 -24
- package/lib/node/dev.jsx +40 -33
- package/lib/node/index.js +41 -24
- package/lib/node/index.jsx +40 -33
- package/package.json +1 -1
package/lib/node/dev.jsx
CHANGED
|
@@ -1636,6 +1636,7 @@ function Columns(props) {
|
|
|
1636
1636
|
return breakpointSizes[size].max;
|
|
1637
1637
|
}
|
|
1638
1638
|
function columnsStyles() {
|
|
1639
|
+
const childColumnDiv = `.${props.builderBlock.id}-breakpoints > .builder-column`;
|
|
1639
1640
|
return `
|
|
1640
1641
|
@media (max-width: ${getWidthForBreakpointSize("medium")}px) {
|
|
1641
1642
|
.${props.builderBlock.id}-breakpoints {
|
|
@@ -1643,7 +1644,7 @@ function Columns(props) {
|
|
|
1643
1644
|
align-items: stretch;
|
|
1644
1645
|
}
|
|
1645
1646
|
|
|
1646
|
-
|
|
1647
|
+
${childColumnDiv} {
|
|
1647
1648
|
width: var(--column-width-tablet) !important;
|
|
1648
1649
|
margin-left: var(--column-margin-left-tablet) !important;
|
|
1649
1650
|
}
|
|
@@ -1655,7 +1656,7 @@ function Columns(props) {
|
|
|
1655
1656
|
align-items: stretch;
|
|
1656
1657
|
}
|
|
1657
1658
|
|
|
1658
|
-
|
|
1659
|
+
${childColumnDiv} {
|
|
1659
1660
|
width: var(--column-width-mobile) !important;
|
|
1660
1661
|
margin-left: var(--column-margin-left-mobile) !important;
|
|
1661
1662
|
}
|
|
@@ -1674,7 +1675,7 @@ function Columns(props) {
|
|
|
1674
1675
|
}
|
|
1675
1676
|
return <>
|
|
1676
1677
|
<div
|
|
1677
|
-
class={getColumnsClass(props.builderBlock?.id) + " div-
|
|
1678
|
+
class={getColumnsClass(props.builderBlock?.id) + " div-3ff242de"}
|
|
1678
1679
|
style={columnsCssVars()}
|
|
1679
1680
|
{...{}}
|
|
1680
1681
|
>
|
|
@@ -1703,7 +1704,7 @@ function Columns(props) {
|
|
|
1703
1704
|
/></Dynamic_renderer_default>;
|
|
1704
1705
|
}}</For4>
|
|
1705
1706
|
</div>
|
|
1706
|
-
<style>{`.div-
|
|
1707
|
+
<style>{`.div-3ff242de {
|
|
1707
1708
|
display: flex;
|
|
1708
1709
|
line-height: normal;
|
|
1709
1710
|
}`}</style>
|
|
@@ -1777,6 +1778,9 @@ function Image(props) {
|
|
|
1777
1778
|
!(url.match(/builder\.io/) || url.match(/cdn\.shopify\.com/))) {
|
|
1778
1779
|
return props.srcset;
|
|
1779
1780
|
}
|
|
1781
|
+
if (props.noWebp) {
|
|
1782
|
+
return void 0;
|
|
1783
|
+
}
|
|
1780
1784
|
if (props.srcset && props.image?.includes("builder.io/api/v1/image")) {
|
|
1781
1785
|
if (!props.srcset.includes(props.image.split("?")[0])) {
|
|
1782
1786
|
console.debug("Removed given srcset");
|
|
@@ -1810,7 +1814,7 @@ function Image(props) {
|
|
|
1810
1814
|
<picture>
|
|
1811
1815
|
<Show7 when={webpSrcSet()}><source type="image/webp" srcset={webpSrcSet()} /></Show7>
|
|
1812
1816
|
<img
|
|
1813
|
-
class={"builder-image" + (props.className ? " " + props.className : "") + " img-
|
|
1817
|
+
class={"builder-image" + (props.className ? " " + props.className : "") + " img-e3b1053e"}
|
|
1814
1818
|
loading={props.highPriority ? "eager" : "lazy"}
|
|
1815
1819
|
fetchpriority={props.highPriority ? "high" : "auto"}
|
|
1816
1820
|
alt={props.altText}
|
|
@@ -1828,22 +1832,22 @@ function Image(props) {
|
|
|
1828
1832
|
<Show7
|
|
1829
1833
|
when={props.aspectRatio && !(props.builderBlock?.children?.length && props.fitContent)}
|
|
1830
1834
|
><div
|
|
1831
|
-
class="builder-image-sizer div-
|
|
1835
|
+
class="builder-image-sizer div-e3b1053e"
|
|
1832
1836
|
style={{
|
|
1833
1837
|
"padding-top": props.aspectRatio * 100 + "%"
|
|
1834
1838
|
}}
|
|
1835
1839
|
/></Show7>
|
|
1836
1840
|
<Show7 when={props.builderBlock?.children?.length && props.fitContent}>{props.children}</Show7>
|
|
1837
|
-
<Show7 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-
|
|
1841
|
+
<Show7 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-e3b1053e-2">{props.children}</div></Show7>
|
|
1838
1842
|
</>
|
|
1839
|
-
<style>{`.img-
|
|
1843
|
+
<style>{`.img-e3b1053e {
|
|
1840
1844
|
opacity: 1;
|
|
1841
1845
|
transition: opacity 0.2s ease-in-out;
|
|
1842
|
-
}.div-
|
|
1846
|
+
}.div-e3b1053e {
|
|
1843
1847
|
width: 100%;
|
|
1844
1848
|
pointer-events: none;
|
|
1845
1849
|
font-size: 0;
|
|
1846
|
-
}.div-
|
|
1850
|
+
}.div-e3b1053e-2 {
|
|
1847
1851
|
display: flex;
|
|
1848
1852
|
flex-direction: column;
|
|
1849
1853
|
align-items: stretch;
|
|
@@ -1879,16 +1883,10 @@ function SectionComponent(props) {
|
|
|
1879
1883
|
var section_default = SectionComponent;
|
|
1880
1884
|
|
|
1881
1885
|
// src/blocks/symbol/symbol.tsx
|
|
1882
|
-
import { onMount as onMount5, on as
|
|
1886
|
+
import { onMount as onMount5, on as on3, createEffect as createEffect3, createMemo as createMemo19, createSignal as createSignal19 } from "solid-js";
|
|
1883
1887
|
|
|
1884
1888
|
// src/components/content-variants/content-variants.tsx
|
|
1885
|
-
import {
|
|
1886
|
-
Show as Show14,
|
|
1887
|
-
For as For9,
|
|
1888
|
-
onMount as onMount4,
|
|
1889
|
-
createMemo as createMemo18,
|
|
1890
|
-
createSignal as createSignal18
|
|
1891
|
-
} from "solid-js";
|
|
1889
|
+
import { Show as Show14, For as For9, onMount as onMount4, createSignal as createSignal18, createMemo as createMemo18 } from "solid-js";
|
|
1892
1890
|
|
|
1893
1891
|
// src/helpers/url.ts
|
|
1894
1892
|
var getTopLevelDomain = (host) => {
|
|
@@ -4261,17 +4259,14 @@ var serializeFn = (fnValue) => {
|
|
|
4261
4259
|
const appendFunction = !fnStr.startsWith("function") && !fnStr.startsWith("(");
|
|
4262
4260
|
return `return (${appendFunction ? "function " : ""}${fnStr}).apply(this, arguments)`;
|
|
4263
4261
|
};
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
}
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
[key]: serializeValue(value)
|
|
4273
|
-
}), {}))
|
|
4274
|
-
});
|
|
4262
|
+
function serializeComponentInfo(info) {
|
|
4263
|
+
return JSON.parse(JSON.stringify(info, (key, value) => {
|
|
4264
|
+
if (typeof value === "function") {
|
|
4265
|
+
return serializeFn(value);
|
|
4266
|
+
}
|
|
4267
|
+
return value;
|
|
4268
|
+
}));
|
|
4269
|
+
}
|
|
4275
4270
|
|
|
4276
4271
|
// src/components/content-variants/inlined-fns.ts
|
|
4277
4272
|
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}";
|
|
@@ -4839,7 +4834,7 @@ function isFromTrustedHost(trustedHosts, e) {
|
|
|
4839
4834
|
}
|
|
4840
4835
|
|
|
4841
4836
|
// src/constants/sdk-version.ts
|
|
4842
|
-
var SDK_VERSION = "2.0.
|
|
4837
|
+
var SDK_VERSION = "2.0.3";
|
|
4843
4838
|
|
|
4844
4839
|
// src/functions/register.ts
|
|
4845
4840
|
var registry = {};
|
|
@@ -5493,7 +5488,13 @@ function ContentComponent(props) {
|
|
|
5493
5488
|
const [registeredComponents, setRegisteredComponents] = createSignal17(
|
|
5494
5489
|
[
|
|
5495
5490
|
...getDefaultRegisteredComponents(),
|
|
5496
|
-
...props.customComponents
|
|
5491
|
+
...props.customComponents?.filter(({ models }) => {
|
|
5492
|
+
if (!models?.length)
|
|
5493
|
+
return true;
|
|
5494
|
+
if (!props.model)
|
|
5495
|
+
return true;
|
|
5496
|
+
return models.includes(props.model);
|
|
5497
|
+
}) || []
|
|
5497
5498
|
].reduce(
|
|
5498
5499
|
(acc, { component, ...info }) => ({
|
|
5499
5500
|
...acc,
|
|
@@ -5523,7 +5524,13 @@ function ContentComponent(props) {
|
|
|
5523
5524
|
apiVersion: props.apiVersion,
|
|
5524
5525
|
componentInfos: [
|
|
5525
5526
|
...getDefaultRegisteredComponents(),
|
|
5526
|
-
...props.customComponents
|
|
5527
|
+
...props.customComponents?.filter(({ models }) => {
|
|
5528
|
+
if (!models?.length)
|
|
5529
|
+
return true;
|
|
5530
|
+
if (!props.model)
|
|
5531
|
+
return true;
|
|
5532
|
+
return models.includes(props.model);
|
|
5533
|
+
}) || []
|
|
5527
5534
|
].reduce(
|
|
5528
5535
|
(acc, { component: _, ...info }) => ({
|
|
5529
5536
|
...acc,
|
|
@@ -5749,7 +5756,7 @@ function Symbol(props) {
|
|
|
5749
5756
|
function onUpdateFn_0() {
|
|
5750
5757
|
setContent();
|
|
5751
5758
|
}
|
|
5752
|
-
|
|
5759
|
+
createEffect3(on3(() => [onUpdateFn_0_props_symbol()], onUpdateFn_0));
|
|
5753
5760
|
return <><div class={className()} {...{}} {...props.attributes} {...{}}><Content_variants_default
|
|
5754
5761
|
nonce={props.builderContext.nonce}
|
|
5755
5762
|
isNestedRender={true}
|
package/lib/node/index.js
CHANGED
|
@@ -1727,7 +1727,7 @@ var getColumnsClass = (id) => {
|
|
|
1727
1727
|
|
|
1728
1728
|
// src/blocks/columns/columns.tsx
|
|
1729
1729
|
var _tmpl$3 = /* @__PURE__ */ template(`<div>`);
|
|
1730
|
-
var _tmpl$22 = /* @__PURE__ */ template(`<style>.div-
|
|
1730
|
+
var _tmpl$22 = /* @__PURE__ */ template(`<style>.div-3ff242de {
|
|
1731
1731
|
display: flex;
|
|
1732
1732
|
line-height: normal;
|
|
1733
1733
|
}`);
|
|
@@ -1807,6 +1807,7 @@ function Columns(props) {
|
|
|
1807
1807
|
return breakpointSizes[size].max;
|
|
1808
1808
|
}
|
|
1809
1809
|
function columnsStyles() {
|
|
1810
|
+
const childColumnDiv = `.${props.builderBlock.id}-breakpoints > .builder-column`;
|
|
1810
1811
|
return `
|
|
1811
1812
|
@media (max-width: ${getWidthForBreakpointSize("medium")}px) {
|
|
1812
1813
|
.${props.builderBlock.id}-breakpoints {
|
|
@@ -1814,7 +1815,7 @@ function Columns(props) {
|
|
|
1814
1815
|
align-items: stretch;
|
|
1815
1816
|
}
|
|
1816
1817
|
|
|
1817
|
-
|
|
1818
|
+
${childColumnDiv} {
|
|
1818
1819
|
width: var(--column-width-tablet) !important;
|
|
1819
1820
|
margin-left: var(--column-margin-left-tablet) !important;
|
|
1820
1821
|
}
|
|
@@ -1826,7 +1827,7 @@ function Columns(props) {
|
|
|
1826
1827
|
align-items: stretch;
|
|
1827
1828
|
}
|
|
1828
1829
|
|
|
1829
|
-
|
|
1830
|
+
${childColumnDiv} {
|
|
1830
1831
|
width: var(--column-width-mobile) !important;
|
|
1831
1832
|
margin-left: var(--column-margin-left-mobile) !important;
|
|
1832
1833
|
}
|
|
@@ -1847,7 +1848,7 @@ function Columns(props) {
|
|
|
1847
1848
|
const _el$ = _tmpl$3();
|
|
1848
1849
|
spread(_el$, mergeProps({
|
|
1849
1850
|
get ["class"]() {
|
|
1850
|
-
return getColumnsClass(props.builderBlock?.id) + " div-
|
|
1851
|
+
return getColumnsClass(props.builderBlock?.id) + " div-3ff242de";
|
|
1851
1852
|
},
|
|
1852
1853
|
get style() {
|
|
1853
1854
|
return columnsCssVars();
|
|
@@ -1972,16 +1973,16 @@ function getSrcSet(url) {
|
|
|
1972
1973
|
// src/blocks/image/image.tsx
|
|
1973
1974
|
var _tmpl$5 = /* @__PURE__ */ template(`<source type=image/webp>`);
|
|
1974
1975
|
var _tmpl$23 = /* @__PURE__ */ template(`<picture><img>`);
|
|
1975
|
-
var _tmpl$32 = /* @__PURE__ */ template(`<div class="builder-image-sizer div-
|
|
1976
|
-
var _tmpl$42 = /* @__PURE__ */ template(`<div class=div-
|
|
1977
|
-
var _tmpl$52 = /* @__PURE__ */ template(`<style>.img-
|
|
1976
|
+
var _tmpl$32 = /* @__PURE__ */ template(`<div class="builder-image-sizer div-e3b1053e">`);
|
|
1977
|
+
var _tmpl$42 = /* @__PURE__ */ template(`<div class=div-e3b1053e-2>`);
|
|
1978
|
+
var _tmpl$52 = /* @__PURE__ */ template(`<style>.img-e3b1053e {
|
|
1978
1979
|
opacity: 1;
|
|
1979
1980
|
transition: opacity 0.2s ease-in-out;
|
|
1980
|
-
}.div-
|
|
1981
|
+
}.div-e3b1053e {
|
|
1981
1982
|
width: 100%;
|
|
1982
1983
|
pointer-events: none;
|
|
1983
1984
|
font-size: 0;
|
|
1984
|
-
}.div-
|
|
1985
|
+
}.div-e3b1053e-2 {
|
|
1985
1986
|
display: flex;
|
|
1986
1987
|
flex-direction: column;
|
|
1987
1988
|
align-items: stretch;
|
|
@@ -2000,6 +2001,9 @@ function Image(props) {
|
|
|
2000
2001
|
!(url.match(/builder\.io/) || url.match(/cdn\.shopify\.com/))) {
|
|
2001
2002
|
return props.srcset;
|
|
2002
2003
|
}
|
|
2004
|
+
if (props.noWebp) {
|
|
2005
|
+
return void 0;
|
|
2006
|
+
}
|
|
2003
2007
|
if (props.srcset && props.image?.includes("builder.io/api/v1/image")) {
|
|
2004
2008
|
if (!props.srcset.includes(props.image.split("?")[0])) {
|
|
2005
2009
|
return getSrcSet(url);
|
|
@@ -2040,7 +2044,7 @@ function Image(props) {
|
|
|
2040
2044
|
}
|
|
2041
2045
|
}), _el$3);
|
|
2042
2046
|
effect((_p$) => {
|
|
2043
|
-
const _v$ = "builder-image" + (props.className ? " " + props.className : "") + " img-
|
|
2047
|
+
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 = {
|
|
2044
2048
|
"object-position": props.backgroundPosition || "center",
|
|
2045
2049
|
"object-fit": props.backgroundSize || "cover",
|
|
2046
2050
|
...aspectRatioCss()
|
|
@@ -4732,17 +4736,14 @@ var serializeFn = (fnValue) => {
|
|
|
4732
4736
|
const appendFunction = !fnStr.startsWith("function") && !fnStr.startsWith("(");
|
|
4733
4737
|
return `return (${appendFunction ? "function " : ""}${fnStr}).apply(this, arguments)`;
|
|
4734
4738
|
};
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
}
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
[key]: serializeValue(value)
|
|
4744
|
-
}), {}))
|
|
4745
|
-
});
|
|
4739
|
+
function serializeComponentInfo(info) {
|
|
4740
|
+
return JSON.parse(JSON.stringify(info, (key, value) => {
|
|
4741
|
+
if (typeof value === "function") {
|
|
4742
|
+
return serializeFn(value);
|
|
4743
|
+
}
|
|
4744
|
+
return value;
|
|
4745
|
+
}));
|
|
4746
|
+
}
|
|
4746
4747
|
|
|
4747
4748
|
// src/components/content-variants/inlined-fns.ts
|
|
4748
4749
|
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}";
|
|
@@ -5303,7 +5304,7 @@ function isFromTrustedHost(trustedHosts, e) {
|
|
|
5303
5304
|
}
|
|
5304
5305
|
|
|
5305
5306
|
// src/constants/sdk-version.ts
|
|
5306
|
-
var SDK_VERSION = "2.0.
|
|
5307
|
+
var SDK_VERSION = "2.0.3";
|
|
5307
5308
|
|
|
5308
5309
|
// src/functions/register.ts
|
|
5309
5310
|
var registry = {};
|
|
@@ -5936,7 +5937,15 @@ function ContentComponent(props) {
|
|
|
5936
5937
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
5937
5938
|
contentId: props.content?.id
|
|
5938
5939
|
}));
|
|
5939
|
-
const [registeredComponents, setRegisteredComponents] = createSignal([...getDefaultRegisteredComponents(), ...props.customComponents
|
|
5940
|
+
const [registeredComponents, setRegisteredComponents] = createSignal([...getDefaultRegisteredComponents(), ...props.customComponents?.filter(({
|
|
5941
|
+
models
|
|
5942
|
+
}) => {
|
|
5943
|
+
if (!models?.length)
|
|
5944
|
+
return true;
|
|
5945
|
+
if (!props.model)
|
|
5946
|
+
return true;
|
|
5947
|
+
return models.includes(props.model);
|
|
5948
|
+
}) || []].reduce((acc, {
|
|
5940
5949
|
component,
|
|
5941
5950
|
...info
|
|
5942
5951
|
}) => ({
|
|
@@ -5962,7 +5971,15 @@ function ContentComponent(props) {
|
|
|
5962
5971
|
canTrack: props.canTrack,
|
|
5963
5972
|
apiKey: props.apiKey,
|
|
5964
5973
|
apiVersion: props.apiVersion,
|
|
5965
|
-
componentInfos: [...getDefaultRegisteredComponents(), ...props.customComponents
|
|
5974
|
+
componentInfos: [...getDefaultRegisteredComponents(), ...props.customComponents?.filter(({
|
|
5975
|
+
models
|
|
5976
|
+
}) => {
|
|
5977
|
+
if (!models?.length)
|
|
5978
|
+
return true;
|
|
5979
|
+
if (!props.model)
|
|
5980
|
+
return true;
|
|
5981
|
+
return models.includes(props.model);
|
|
5982
|
+
}) || []].reduce((acc, {
|
|
5966
5983
|
component: _,
|
|
5967
5984
|
...info
|
|
5968
5985
|
}) => ({
|
package/lib/node/index.jsx
CHANGED
|
@@ -1630,6 +1630,7 @@ function Columns(props) {
|
|
|
1630
1630
|
return breakpointSizes[size].max;
|
|
1631
1631
|
}
|
|
1632
1632
|
function columnsStyles() {
|
|
1633
|
+
const childColumnDiv = `.${props.builderBlock.id}-breakpoints > .builder-column`;
|
|
1633
1634
|
return `
|
|
1634
1635
|
@media (max-width: ${getWidthForBreakpointSize("medium")}px) {
|
|
1635
1636
|
.${props.builderBlock.id}-breakpoints {
|
|
@@ -1637,7 +1638,7 @@ function Columns(props) {
|
|
|
1637
1638
|
align-items: stretch;
|
|
1638
1639
|
}
|
|
1639
1640
|
|
|
1640
|
-
|
|
1641
|
+
${childColumnDiv} {
|
|
1641
1642
|
width: var(--column-width-tablet) !important;
|
|
1642
1643
|
margin-left: var(--column-margin-left-tablet) !important;
|
|
1643
1644
|
}
|
|
@@ -1649,7 +1650,7 @@ function Columns(props) {
|
|
|
1649
1650
|
align-items: stretch;
|
|
1650
1651
|
}
|
|
1651
1652
|
|
|
1652
|
-
|
|
1653
|
+
${childColumnDiv} {
|
|
1653
1654
|
width: var(--column-width-mobile) !important;
|
|
1654
1655
|
margin-left: var(--column-margin-left-mobile) !important;
|
|
1655
1656
|
}
|
|
@@ -1668,7 +1669,7 @@ function Columns(props) {
|
|
|
1668
1669
|
}
|
|
1669
1670
|
return <>
|
|
1670
1671
|
<div
|
|
1671
|
-
class={getColumnsClass(props.builderBlock?.id) + " div-
|
|
1672
|
+
class={getColumnsClass(props.builderBlock?.id) + " div-3ff242de"}
|
|
1672
1673
|
style={columnsCssVars()}
|
|
1673
1674
|
{...{}}
|
|
1674
1675
|
>
|
|
@@ -1697,7 +1698,7 @@ function Columns(props) {
|
|
|
1697
1698
|
/></Dynamic_renderer_default>;
|
|
1698
1699
|
}}</For4>
|
|
1699
1700
|
</div>
|
|
1700
|
-
<style>{`.div-
|
|
1701
|
+
<style>{`.div-3ff242de {
|
|
1701
1702
|
display: flex;
|
|
1702
1703
|
line-height: normal;
|
|
1703
1704
|
}`}</style>
|
|
@@ -1771,6 +1772,9 @@ function Image(props) {
|
|
|
1771
1772
|
!(url.match(/builder\.io/) || url.match(/cdn\.shopify\.com/))) {
|
|
1772
1773
|
return props.srcset;
|
|
1773
1774
|
}
|
|
1775
|
+
if (props.noWebp) {
|
|
1776
|
+
return void 0;
|
|
1777
|
+
}
|
|
1774
1778
|
if (props.srcset && props.image?.includes("builder.io/api/v1/image")) {
|
|
1775
1779
|
if (!props.srcset.includes(props.image.split("?")[0])) {
|
|
1776
1780
|
return getSrcSet(url);
|
|
@@ -1803,7 +1807,7 @@ function Image(props) {
|
|
|
1803
1807
|
<picture>
|
|
1804
1808
|
<Show7 when={webpSrcSet()}><source type="image/webp" srcset={webpSrcSet()} /></Show7>
|
|
1805
1809
|
<img
|
|
1806
|
-
class={"builder-image" + (props.className ? " " + props.className : "") + " img-
|
|
1810
|
+
class={"builder-image" + (props.className ? " " + props.className : "") + " img-e3b1053e"}
|
|
1807
1811
|
loading={props.highPriority ? "eager" : "lazy"}
|
|
1808
1812
|
fetchpriority={props.highPriority ? "high" : "auto"}
|
|
1809
1813
|
alt={props.altText}
|
|
@@ -1821,22 +1825,22 @@ function Image(props) {
|
|
|
1821
1825
|
<Show7
|
|
1822
1826
|
when={props.aspectRatio && !(props.builderBlock?.children?.length && props.fitContent)}
|
|
1823
1827
|
><div
|
|
1824
|
-
class="builder-image-sizer div-
|
|
1828
|
+
class="builder-image-sizer div-e3b1053e"
|
|
1825
1829
|
style={{
|
|
1826
1830
|
"padding-top": props.aspectRatio * 100 + "%"
|
|
1827
1831
|
}}
|
|
1828
1832
|
/></Show7>
|
|
1829
1833
|
<Show7 when={props.builderBlock?.children?.length && props.fitContent}>{props.children}</Show7>
|
|
1830
|
-
<Show7 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-
|
|
1834
|
+
<Show7 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-e3b1053e-2">{props.children}</div></Show7>
|
|
1831
1835
|
</>
|
|
1832
|
-
<style>{`.img-
|
|
1836
|
+
<style>{`.img-e3b1053e {
|
|
1833
1837
|
opacity: 1;
|
|
1834
1838
|
transition: opacity 0.2s ease-in-out;
|
|
1835
|
-
}.div-
|
|
1839
|
+
}.div-e3b1053e {
|
|
1836
1840
|
width: 100%;
|
|
1837
1841
|
pointer-events: none;
|
|
1838
1842
|
font-size: 0;
|
|
1839
|
-
}.div-
|
|
1843
|
+
}.div-e3b1053e-2 {
|
|
1840
1844
|
display: flex;
|
|
1841
1845
|
flex-direction: column;
|
|
1842
1846
|
align-items: stretch;
|
|
@@ -1872,16 +1876,10 @@ function SectionComponent(props) {
|
|
|
1872
1876
|
var section_default = SectionComponent;
|
|
1873
1877
|
|
|
1874
1878
|
// src/blocks/symbol/symbol.tsx
|
|
1875
|
-
import { onMount as onMount5, on as
|
|
1879
|
+
import { onMount as onMount5, on as on3, createEffect as createEffect3, createMemo as createMemo19, createSignal as createSignal19 } from "solid-js";
|
|
1876
1880
|
|
|
1877
1881
|
// src/components/content-variants/content-variants.tsx
|
|
1878
|
-
import {
|
|
1879
|
-
Show as Show14,
|
|
1880
|
-
For as For9,
|
|
1881
|
-
onMount as onMount4,
|
|
1882
|
-
createMemo as createMemo18,
|
|
1883
|
-
createSignal as createSignal18
|
|
1884
|
-
} from "solid-js";
|
|
1882
|
+
import { Show as Show14, For as For9, onMount as onMount4, createSignal as createSignal18, createMemo as createMemo18 } from "solid-js";
|
|
1885
1883
|
|
|
1886
1884
|
// src/helpers/url.ts
|
|
1887
1885
|
var getTopLevelDomain = (host) => {
|
|
@@ -4251,17 +4249,14 @@ var serializeFn = (fnValue) => {
|
|
|
4251
4249
|
const appendFunction = !fnStr.startsWith("function") && !fnStr.startsWith("(");
|
|
4252
4250
|
return `return (${appendFunction ? "function " : ""}${fnStr}).apply(this, arguments)`;
|
|
4253
4251
|
};
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
}
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
[key]: serializeValue(value)
|
|
4263
|
-
}), {}))
|
|
4264
|
-
});
|
|
4252
|
+
function serializeComponentInfo(info) {
|
|
4253
|
+
return JSON.parse(JSON.stringify(info, (key, value) => {
|
|
4254
|
+
if (typeof value === "function") {
|
|
4255
|
+
return serializeFn(value);
|
|
4256
|
+
}
|
|
4257
|
+
return value;
|
|
4258
|
+
}));
|
|
4259
|
+
}
|
|
4265
4260
|
|
|
4266
4261
|
// src/components/content-variants/inlined-fns.ts
|
|
4267
4262
|
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}";
|
|
@@ -4824,7 +4819,7 @@ function isFromTrustedHost(trustedHosts, e) {
|
|
|
4824
4819
|
}
|
|
4825
4820
|
|
|
4826
4821
|
// src/constants/sdk-version.ts
|
|
4827
|
-
var SDK_VERSION = "2.0.
|
|
4822
|
+
var SDK_VERSION = "2.0.3";
|
|
4828
4823
|
|
|
4829
4824
|
// src/functions/register.ts
|
|
4830
4825
|
var registry = {};
|
|
@@ -5476,7 +5471,13 @@ function ContentComponent(props) {
|
|
|
5476
5471
|
const [registeredComponents, setRegisteredComponents] = createSignal17(
|
|
5477
5472
|
[
|
|
5478
5473
|
...getDefaultRegisteredComponents(),
|
|
5479
|
-
...props.customComponents
|
|
5474
|
+
...props.customComponents?.filter(({ models }) => {
|
|
5475
|
+
if (!models?.length)
|
|
5476
|
+
return true;
|
|
5477
|
+
if (!props.model)
|
|
5478
|
+
return true;
|
|
5479
|
+
return models.includes(props.model);
|
|
5480
|
+
}) || []
|
|
5480
5481
|
].reduce(
|
|
5481
5482
|
(acc, { component, ...info }) => ({
|
|
5482
5483
|
...acc,
|
|
@@ -5506,7 +5507,13 @@ function ContentComponent(props) {
|
|
|
5506
5507
|
apiVersion: props.apiVersion,
|
|
5507
5508
|
componentInfos: [
|
|
5508
5509
|
...getDefaultRegisteredComponents(),
|
|
5509
|
-
...props.customComponents
|
|
5510
|
+
...props.customComponents?.filter(({ models }) => {
|
|
5511
|
+
if (!models?.length)
|
|
5512
|
+
return true;
|
|
5513
|
+
if (!props.model)
|
|
5514
|
+
return true;
|
|
5515
|
+
return models.includes(props.model);
|
|
5516
|
+
}) || []
|
|
5510
5517
|
].reduce(
|
|
5511
5518
|
(acc, { component: _, ...info }) => ({
|
|
5512
5519
|
...acc,
|
|
@@ -5732,7 +5739,7 @@ function Symbol(props) {
|
|
|
5732
5739
|
function onUpdateFn_0() {
|
|
5733
5740
|
setContent();
|
|
5734
5741
|
}
|
|
5735
|
-
|
|
5742
|
+
createEffect3(on3(() => [onUpdateFn_0_props_symbol()], onUpdateFn_0));
|
|
5736
5743
|
return <><div class={className()} {...{}} {...props.attributes} {...{}}><Content_variants_default
|
|
5737
5744
|
nonce={props.builderContext.nonce}
|
|
5738
5745
|
isNestedRender={true}
|