@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/dist/index.d.ts
CHANGED
package/lib/browser/dev.js
CHANGED
|
@@ -1563,7 +1563,7 @@ var getColumnsClass = (id) => {
|
|
|
1563
1563
|
|
|
1564
1564
|
// src/blocks/columns/columns.tsx
|
|
1565
1565
|
var _tmpl$3 = /* @__PURE__ */ template(`<div>`);
|
|
1566
|
-
var _tmpl$22 = /* @__PURE__ */ template(`<style>.div-
|
|
1566
|
+
var _tmpl$22 = /* @__PURE__ */ template(`<style>.div-3ff242de {
|
|
1567
1567
|
display: flex;
|
|
1568
1568
|
line-height: normal;
|
|
1569
1569
|
}`);
|
|
@@ -1643,6 +1643,7 @@ function Columns(props) {
|
|
|
1643
1643
|
return breakpointSizes[size].max;
|
|
1644
1644
|
}
|
|
1645
1645
|
function columnsStyles() {
|
|
1646
|
+
const childColumnDiv = `.${props.builderBlock.id}-breakpoints > .builder-column`;
|
|
1646
1647
|
return `
|
|
1647
1648
|
@media (max-width: ${getWidthForBreakpointSize("medium")}px) {
|
|
1648
1649
|
.${props.builderBlock.id}-breakpoints {
|
|
@@ -1650,7 +1651,7 @@ function Columns(props) {
|
|
|
1650
1651
|
align-items: stretch;
|
|
1651
1652
|
}
|
|
1652
1653
|
|
|
1653
|
-
|
|
1654
|
+
${childColumnDiv} {
|
|
1654
1655
|
width: var(--column-width-tablet) !important;
|
|
1655
1656
|
margin-left: var(--column-margin-left-tablet) !important;
|
|
1656
1657
|
}
|
|
@@ -1662,7 +1663,7 @@ function Columns(props) {
|
|
|
1662
1663
|
align-items: stretch;
|
|
1663
1664
|
}
|
|
1664
1665
|
|
|
1665
|
-
|
|
1666
|
+
${childColumnDiv} {
|
|
1666
1667
|
width: var(--column-width-mobile) !important;
|
|
1667
1668
|
margin-left: var(--column-margin-left-mobile) !important;
|
|
1668
1669
|
}
|
|
@@ -1683,7 +1684,7 @@ function Columns(props) {
|
|
|
1683
1684
|
const _el$ = _tmpl$3();
|
|
1684
1685
|
spread(_el$, mergeProps({
|
|
1685
1686
|
get ["class"]() {
|
|
1686
|
-
return getColumnsClass(props.builderBlock?.id) + " div-
|
|
1687
|
+
return getColumnsClass(props.builderBlock?.id) + " div-3ff242de";
|
|
1687
1688
|
},
|
|
1688
1689
|
get style() {
|
|
1689
1690
|
return columnsCssVars();
|
|
@@ -1808,16 +1809,16 @@ function getSrcSet(url) {
|
|
|
1808
1809
|
// src/blocks/image/image.tsx
|
|
1809
1810
|
var _tmpl$5 = /* @__PURE__ */ template(`<source type=image/webp>`);
|
|
1810
1811
|
var _tmpl$23 = /* @__PURE__ */ template(`<picture><img>`);
|
|
1811
|
-
var _tmpl$32 = /* @__PURE__ */ template(`<div class="builder-image-sizer div-
|
|
1812
|
-
var _tmpl$42 = /* @__PURE__ */ template(`<div class=div-
|
|
1813
|
-
var _tmpl$52 = /* @__PURE__ */ template(`<style>.img-
|
|
1812
|
+
var _tmpl$32 = /* @__PURE__ */ template(`<div class="builder-image-sizer div-e3b1053e">`);
|
|
1813
|
+
var _tmpl$42 = /* @__PURE__ */ template(`<div class=div-e3b1053e-2>`);
|
|
1814
|
+
var _tmpl$52 = /* @__PURE__ */ template(`<style>.img-e3b1053e {
|
|
1814
1815
|
opacity: 1;
|
|
1815
1816
|
transition: opacity 0.2s ease-in-out;
|
|
1816
|
-
}.div-
|
|
1817
|
+
}.div-e3b1053e {
|
|
1817
1818
|
width: 100%;
|
|
1818
1819
|
pointer-events: none;
|
|
1819
1820
|
font-size: 0;
|
|
1820
|
-
}.div-
|
|
1821
|
+
}.div-e3b1053e-2 {
|
|
1821
1822
|
display: flex;
|
|
1822
1823
|
flex-direction: column;
|
|
1823
1824
|
align-items: stretch;
|
|
@@ -1836,6 +1837,9 @@ function Image(props) {
|
|
|
1836
1837
|
!(url.match(/builder\.io/) || url.match(/cdn\.shopify\.com/))) {
|
|
1837
1838
|
return props.srcset;
|
|
1838
1839
|
}
|
|
1840
|
+
if (props.noWebp) {
|
|
1841
|
+
return void 0;
|
|
1842
|
+
}
|
|
1839
1843
|
if (props.srcset && props.image?.includes("builder.io/api/v1/image")) {
|
|
1840
1844
|
if (!props.srcset.includes(props.image.split("?")[0])) {
|
|
1841
1845
|
console.debug("Removed given srcset");
|
|
@@ -1877,7 +1881,7 @@ function Image(props) {
|
|
|
1877
1881
|
}
|
|
1878
1882
|
}), _el$3);
|
|
1879
1883
|
effect((_p$) => {
|
|
1880
|
-
const _v$ = "builder-image" + (props.className ? " " + props.className : "") + " img-
|
|
1884
|
+
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 = {
|
|
1881
1885
|
"object-position": props.backgroundPosition || "center",
|
|
1882
1886
|
"object-fit": props.backgroundSize || "cover",
|
|
1883
1887
|
...aspectRatioCss()
|
|
@@ -4572,17 +4576,14 @@ var serializeFn = (fnValue) => {
|
|
|
4572
4576
|
const appendFunction = !fnStr.startsWith("function") && !fnStr.startsWith("(");
|
|
4573
4577
|
return `return (${appendFunction ? "function " : ""}${fnStr}).apply(this, arguments)`;
|
|
4574
4578
|
};
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
|
|
4579
|
-
}
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
[key]: serializeValue(value)
|
|
4584
|
-
}), {}))
|
|
4585
|
-
});
|
|
4579
|
+
function serializeComponentInfo(info) {
|
|
4580
|
+
return JSON.parse(JSON.stringify(info, (key, value) => {
|
|
4581
|
+
if (typeof value === "function") {
|
|
4582
|
+
return serializeFn(value);
|
|
4583
|
+
}
|
|
4584
|
+
return value;
|
|
4585
|
+
}));
|
|
4586
|
+
}
|
|
4586
4587
|
|
|
4587
4588
|
// src/components/content-variants/inlined-fns.ts
|
|
4588
4589
|
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}";
|
|
@@ -5148,7 +5149,7 @@ function isFromTrustedHost(trustedHosts, e) {
|
|
|
5148
5149
|
}
|
|
5149
5150
|
|
|
5150
5151
|
// src/constants/sdk-version.ts
|
|
5151
|
-
var SDK_VERSION = "2.0.
|
|
5152
|
+
var SDK_VERSION = "2.0.3";
|
|
5152
5153
|
|
|
5153
5154
|
// src/functions/register.ts
|
|
5154
5155
|
var registry = {};
|
|
@@ -5783,7 +5784,15 @@ function ContentComponent(props) {
|
|
|
5783
5784
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
5784
5785
|
contentId: props.content?.id
|
|
5785
5786
|
}));
|
|
5786
|
-
const [registeredComponents, setRegisteredComponents] = createSignal([...getDefaultRegisteredComponents(), ...props.customComponents
|
|
5787
|
+
const [registeredComponents, setRegisteredComponents] = createSignal([...getDefaultRegisteredComponents(), ...props.customComponents?.filter(({
|
|
5788
|
+
models
|
|
5789
|
+
}) => {
|
|
5790
|
+
if (!models?.length)
|
|
5791
|
+
return true;
|
|
5792
|
+
if (!props.model)
|
|
5793
|
+
return true;
|
|
5794
|
+
return models.includes(props.model);
|
|
5795
|
+
}) || []].reduce((acc, {
|
|
5787
5796
|
component,
|
|
5788
5797
|
...info
|
|
5789
5798
|
}) => ({
|
|
@@ -5809,7 +5818,15 @@ function ContentComponent(props) {
|
|
|
5809
5818
|
canTrack: props.canTrack,
|
|
5810
5819
|
apiKey: props.apiKey,
|
|
5811
5820
|
apiVersion: props.apiVersion,
|
|
5812
|
-
componentInfos: [...getDefaultRegisteredComponents(), ...props.customComponents
|
|
5821
|
+
componentInfos: [...getDefaultRegisteredComponents(), ...props.customComponents?.filter(({
|
|
5822
|
+
models
|
|
5823
|
+
}) => {
|
|
5824
|
+
if (!models?.length)
|
|
5825
|
+
return true;
|
|
5826
|
+
if (!props.model)
|
|
5827
|
+
return true;
|
|
5828
|
+
return models.includes(props.model);
|
|
5829
|
+
}) || []].reduce((acc, {
|
|
5813
5830
|
component: _,
|
|
5814
5831
|
...info
|
|
5815
5832
|
}) => ({
|
package/lib/browser/dev.jsx
CHANGED
|
@@ -1464,6 +1464,7 @@ function Columns(props) {
|
|
|
1464
1464
|
return breakpointSizes[size].max;
|
|
1465
1465
|
}
|
|
1466
1466
|
function columnsStyles() {
|
|
1467
|
+
const childColumnDiv = `.${props.builderBlock.id}-breakpoints > .builder-column`;
|
|
1467
1468
|
return `
|
|
1468
1469
|
@media (max-width: ${getWidthForBreakpointSize("medium")}px) {
|
|
1469
1470
|
.${props.builderBlock.id}-breakpoints {
|
|
@@ -1471,7 +1472,7 @@ function Columns(props) {
|
|
|
1471
1472
|
align-items: stretch;
|
|
1472
1473
|
}
|
|
1473
1474
|
|
|
1474
|
-
|
|
1475
|
+
${childColumnDiv} {
|
|
1475
1476
|
width: var(--column-width-tablet) !important;
|
|
1476
1477
|
margin-left: var(--column-margin-left-tablet) !important;
|
|
1477
1478
|
}
|
|
@@ -1483,7 +1484,7 @@ function Columns(props) {
|
|
|
1483
1484
|
align-items: stretch;
|
|
1484
1485
|
}
|
|
1485
1486
|
|
|
1486
|
-
|
|
1487
|
+
${childColumnDiv} {
|
|
1487
1488
|
width: var(--column-width-mobile) !important;
|
|
1488
1489
|
margin-left: var(--column-margin-left-mobile) !important;
|
|
1489
1490
|
}
|
|
@@ -1502,7 +1503,7 @@ function Columns(props) {
|
|
|
1502
1503
|
}
|
|
1503
1504
|
return <>
|
|
1504
1505
|
<div
|
|
1505
|
-
class={getColumnsClass(props.builderBlock?.id) + " div-
|
|
1506
|
+
class={getColumnsClass(props.builderBlock?.id) + " div-3ff242de"}
|
|
1506
1507
|
style={columnsCssVars()}
|
|
1507
1508
|
{...{}}
|
|
1508
1509
|
>
|
|
@@ -1531,7 +1532,7 @@ function Columns(props) {
|
|
|
1531
1532
|
/></Dynamic_renderer_default>;
|
|
1532
1533
|
}}</For4>
|
|
1533
1534
|
</div>
|
|
1534
|
-
<style>{`.div-
|
|
1535
|
+
<style>{`.div-3ff242de {
|
|
1535
1536
|
display: flex;
|
|
1536
1537
|
line-height: normal;
|
|
1537
1538
|
}`}</style>
|
|
@@ -1605,6 +1606,9 @@ function Image(props) {
|
|
|
1605
1606
|
!(url.match(/builder\.io/) || url.match(/cdn\.shopify\.com/))) {
|
|
1606
1607
|
return props.srcset;
|
|
1607
1608
|
}
|
|
1609
|
+
if (props.noWebp) {
|
|
1610
|
+
return void 0;
|
|
1611
|
+
}
|
|
1608
1612
|
if (props.srcset && props.image?.includes("builder.io/api/v1/image")) {
|
|
1609
1613
|
if (!props.srcset.includes(props.image.split("?")[0])) {
|
|
1610
1614
|
console.debug("Removed given srcset");
|
|
@@ -1638,7 +1642,7 @@ function Image(props) {
|
|
|
1638
1642
|
<picture>
|
|
1639
1643
|
<Show7 when={webpSrcSet()}><source type="image/webp" srcset={webpSrcSet()} /></Show7>
|
|
1640
1644
|
<img
|
|
1641
|
-
class={"builder-image" + (props.className ? " " + props.className : "") + " img-
|
|
1645
|
+
class={"builder-image" + (props.className ? " " + props.className : "") + " img-e3b1053e"}
|
|
1642
1646
|
loading={props.highPriority ? "eager" : "lazy"}
|
|
1643
1647
|
fetchpriority={props.highPriority ? "high" : "auto"}
|
|
1644
1648
|
alt={props.altText}
|
|
@@ -1656,22 +1660,22 @@ function Image(props) {
|
|
|
1656
1660
|
<Show7
|
|
1657
1661
|
when={props.aspectRatio && !(props.builderBlock?.children?.length && props.fitContent)}
|
|
1658
1662
|
><div
|
|
1659
|
-
class="builder-image-sizer div-
|
|
1663
|
+
class="builder-image-sizer div-e3b1053e"
|
|
1660
1664
|
style={{
|
|
1661
1665
|
"padding-top": props.aspectRatio * 100 + "%"
|
|
1662
1666
|
}}
|
|
1663
1667
|
/></Show7>
|
|
1664
1668
|
<Show7 when={props.builderBlock?.children?.length && props.fitContent}>{props.children}</Show7>
|
|
1665
|
-
<Show7 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-
|
|
1669
|
+
<Show7 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-e3b1053e-2">{props.children}</div></Show7>
|
|
1666
1670
|
</>
|
|
1667
|
-
<style>{`.img-
|
|
1671
|
+
<style>{`.img-e3b1053e {
|
|
1668
1672
|
opacity: 1;
|
|
1669
1673
|
transition: opacity 0.2s ease-in-out;
|
|
1670
|
-
}.div-
|
|
1674
|
+
}.div-e3b1053e {
|
|
1671
1675
|
width: 100%;
|
|
1672
1676
|
pointer-events: none;
|
|
1673
1677
|
font-size: 0;
|
|
1674
|
-
}.div-
|
|
1678
|
+
}.div-e3b1053e-2 {
|
|
1675
1679
|
display: flex;
|
|
1676
1680
|
flex-direction: column;
|
|
1677
1681
|
align-items: stretch;
|
|
@@ -1707,16 +1711,10 @@ function SectionComponent(props) {
|
|
|
1707
1711
|
var section_default = SectionComponent;
|
|
1708
1712
|
|
|
1709
1713
|
// src/blocks/symbol/symbol.tsx
|
|
1710
|
-
import { onMount as onMount5, on as
|
|
1714
|
+
import { onMount as onMount5, on as on3, createEffect as createEffect3, createMemo as createMemo19, createSignal as createSignal19 } from "solid-js";
|
|
1711
1715
|
|
|
1712
1716
|
// src/components/content-variants/content-variants.tsx
|
|
1713
|
-
import {
|
|
1714
|
-
Show as Show14,
|
|
1715
|
-
For as For9,
|
|
1716
|
-
onMount as onMount4,
|
|
1717
|
-
createMemo as createMemo18,
|
|
1718
|
-
createSignal as createSignal18
|
|
1719
|
-
} from "solid-js";
|
|
1717
|
+
import { Show as Show14, For as For9, onMount as onMount4, createSignal as createSignal18, createMemo as createMemo18 } from "solid-js";
|
|
1720
1718
|
|
|
1721
1719
|
// src/helpers/url.ts
|
|
1722
1720
|
var getTopLevelDomain = (host) => {
|
|
@@ -4089,17 +4087,14 @@ var serializeFn = (fnValue) => {
|
|
|
4089
4087
|
const appendFunction = !fnStr.startsWith("function") && !fnStr.startsWith("(");
|
|
4090
4088
|
return `return (${appendFunction ? "function " : ""}${fnStr}).apply(this, arguments)`;
|
|
4091
4089
|
};
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
}
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
[key]: serializeValue(value)
|
|
4101
|
-
}), {}))
|
|
4102
|
-
});
|
|
4090
|
+
function serializeComponentInfo(info) {
|
|
4091
|
+
return JSON.parse(JSON.stringify(info, (key, value) => {
|
|
4092
|
+
if (typeof value === "function") {
|
|
4093
|
+
return serializeFn(value);
|
|
4094
|
+
}
|
|
4095
|
+
return value;
|
|
4096
|
+
}));
|
|
4097
|
+
}
|
|
4103
4098
|
|
|
4104
4099
|
// src/components/content-variants/inlined-fns.ts
|
|
4105
4100
|
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}";
|
|
@@ -4667,7 +4662,7 @@ function isFromTrustedHost(trustedHosts, e) {
|
|
|
4667
4662
|
}
|
|
4668
4663
|
|
|
4669
4664
|
// src/constants/sdk-version.ts
|
|
4670
|
-
var SDK_VERSION = "2.0.
|
|
4665
|
+
var SDK_VERSION = "2.0.3";
|
|
4671
4666
|
|
|
4672
4667
|
// src/functions/register.ts
|
|
4673
4668
|
var registry = {};
|
|
@@ -5321,7 +5316,13 @@ function ContentComponent(props) {
|
|
|
5321
5316
|
const [registeredComponents, setRegisteredComponents] = createSignal17(
|
|
5322
5317
|
[
|
|
5323
5318
|
...getDefaultRegisteredComponents(),
|
|
5324
|
-
...props.customComponents
|
|
5319
|
+
...props.customComponents?.filter(({ models }) => {
|
|
5320
|
+
if (!models?.length)
|
|
5321
|
+
return true;
|
|
5322
|
+
if (!props.model)
|
|
5323
|
+
return true;
|
|
5324
|
+
return models.includes(props.model);
|
|
5325
|
+
}) || []
|
|
5325
5326
|
].reduce(
|
|
5326
5327
|
(acc, { component, ...info }) => ({
|
|
5327
5328
|
...acc,
|
|
@@ -5351,7 +5352,13 @@ function ContentComponent(props) {
|
|
|
5351
5352
|
apiVersion: props.apiVersion,
|
|
5352
5353
|
componentInfos: [
|
|
5353
5354
|
...getDefaultRegisteredComponents(),
|
|
5354
|
-
...props.customComponents
|
|
5355
|
+
...props.customComponents?.filter(({ models }) => {
|
|
5356
|
+
if (!models?.length)
|
|
5357
|
+
return true;
|
|
5358
|
+
if (!props.model)
|
|
5359
|
+
return true;
|
|
5360
|
+
return models.includes(props.model);
|
|
5361
|
+
}) || []
|
|
5355
5362
|
].reduce(
|
|
5356
5363
|
(acc, { component: _, ...info }) => ({
|
|
5357
5364
|
...acc,
|
|
@@ -5577,7 +5584,7 @@ function Symbol(props) {
|
|
|
5577
5584
|
function onUpdateFn_0() {
|
|
5578
5585
|
setContent();
|
|
5579
5586
|
}
|
|
5580
|
-
|
|
5587
|
+
createEffect3(on3(() => [onUpdateFn_0_props_symbol()], onUpdateFn_0));
|
|
5581
5588
|
return <><div class={className()} {...{}} {...props.attributes} {...{}}><Content_variants_default
|
|
5582
5589
|
nonce={props.builderContext.nonce}
|
|
5583
5590
|
isNestedRender={true}
|
package/lib/browser/index.js
CHANGED
|
@@ -1557,7 +1557,7 @@ var getColumnsClass = (id) => {
|
|
|
1557
1557
|
|
|
1558
1558
|
// src/blocks/columns/columns.tsx
|
|
1559
1559
|
var _tmpl$3 = /* @__PURE__ */ template(`<div>`);
|
|
1560
|
-
var _tmpl$22 = /* @__PURE__ */ template(`<style>.div-
|
|
1560
|
+
var _tmpl$22 = /* @__PURE__ */ template(`<style>.div-3ff242de {
|
|
1561
1561
|
display: flex;
|
|
1562
1562
|
line-height: normal;
|
|
1563
1563
|
}`);
|
|
@@ -1637,6 +1637,7 @@ function Columns(props) {
|
|
|
1637
1637
|
return breakpointSizes[size].max;
|
|
1638
1638
|
}
|
|
1639
1639
|
function columnsStyles() {
|
|
1640
|
+
const childColumnDiv = `.${props.builderBlock.id}-breakpoints > .builder-column`;
|
|
1640
1641
|
return `
|
|
1641
1642
|
@media (max-width: ${getWidthForBreakpointSize("medium")}px) {
|
|
1642
1643
|
.${props.builderBlock.id}-breakpoints {
|
|
@@ -1644,7 +1645,7 @@ function Columns(props) {
|
|
|
1644
1645
|
align-items: stretch;
|
|
1645
1646
|
}
|
|
1646
1647
|
|
|
1647
|
-
|
|
1648
|
+
${childColumnDiv} {
|
|
1648
1649
|
width: var(--column-width-tablet) !important;
|
|
1649
1650
|
margin-left: var(--column-margin-left-tablet) !important;
|
|
1650
1651
|
}
|
|
@@ -1656,7 +1657,7 @@ function Columns(props) {
|
|
|
1656
1657
|
align-items: stretch;
|
|
1657
1658
|
}
|
|
1658
1659
|
|
|
1659
|
-
|
|
1660
|
+
${childColumnDiv} {
|
|
1660
1661
|
width: var(--column-width-mobile) !important;
|
|
1661
1662
|
margin-left: var(--column-margin-left-mobile) !important;
|
|
1662
1663
|
}
|
|
@@ -1677,7 +1678,7 @@ function Columns(props) {
|
|
|
1677
1678
|
const _el$ = _tmpl$3();
|
|
1678
1679
|
spread(_el$, mergeProps({
|
|
1679
1680
|
get ["class"]() {
|
|
1680
|
-
return getColumnsClass(props.builderBlock?.id) + " div-
|
|
1681
|
+
return getColumnsClass(props.builderBlock?.id) + " div-3ff242de";
|
|
1681
1682
|
},
|
|
1682
1683
|
get style() {
|
|
1683
1684
|
return columnsCssVars();
|
|
@@ -1802,16 +1803,16 @@ function getSrcSet(url) {
|
|
|
1802
1803
|
// src/blocks/image/image.tsx
|
|
1803
1804
|
var _tmpl$5 = /* @__PURE__ */ template(`<source type=image/webp>`);
|
|
1804
1805
|
var _tmpl$23 = /* @__PURE__ */ template(`<picture><img>`);
|
|
1805
|
-
var _tmpl$32 = /* @__PURE__ */ template(`<div class="builder-image-sizer div-
|
|
1806
|
-
var _tmpl$42 = /* @__PURE__ */ template(`<div class=div-
|
|
1807
|
-
var _tmpl$52 = /* @__PURE__ */ template(`<style>.img-
|
|
1806
|
+
var _tmpl$32 = /* @__PURE__ */ template(`<div class="builder-image-sizer div-e3b1053e">`);
|
|
1807
|
+
var _tmpl$42 = /* @__PURE__ */ template(`<div class=div-e3b1053e-2>`);
|
|
1808
|
+
var _tmpl$52 = /* @__PURE__ */ template(`<style>.img-e3b1053e {
|
|
1808
1809
|
opacity: 1;
|
|
1809
1810
|
transition: opacity 0.2s ease-in-out;
|
|
1810
|
-
}.div-
|
|
1811
|
+
}.div-e3b1053e {
|
|
1811
1812
|
width: 100%;
|
|
1812
1813
|
pointer-events: none;
|
|
1813
1814
|
font-size: 0;
|
|
1814
|
-
}.div-
|
|
1815
|
+
}.div-e3b1053e-2 {
|
|
1815
1816
|
display: flex;
|
|
1816
1817
|
flex-direction: column;
|
|
1817
1818
|
align-items: stretch;
|
|
@@ -1830,6 +1831,9 @@ function Image(props) {
|
|
|
1830
1831
|
!(url.match(/builder\.io/) || url.match(/cdn\.shopify\.com/))) {
|
|
1831
1832
|
return props.srcset;
|
|
1832
1833
|
}
|
|
1834
|
+
if (props.noWebp) {
|
|
1835
|
+
return void 0;
|
|
1836
|
+
}
|
|
1833
1837
|
if (props.srcset && props.image?.includes("builder.io/api/v1/image")) {
|
|
1834
1838
|
if (!props.srcset.includes(props.image.split("?")[0])) {
|
|
1835
1839
|
return getSrcSet(url);
|
|
@@ -1870,7 +1874,7 @@ function Image(props) {
|
|
|
1870
1874
|
}
|
|
1871
1875
|
}), _el$3);
|
|
1872
1876
|
effect((_p$) => {
|
|
1873
|
-
const _v$ = "builder-image" + (props.className ? " " + props.className : "") + " img-
|
|
1877
|
+
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 = {
|
|
1874
1878
|
"object-position": props.backgroundPosition || "center",
|
|
1875
1879
|
"object-fit": props.backgroundSize || "cover",
|
|
1876
1880
|
...aspectRatioCss()
|
|
@@ -4562,17 +4566,14 @@ var serializeFn = (fnValue) => {
|
|
|
4562
4566
|
const appendFunction = !fnStr.startsWith("function") && !fnStr.startsWith("(");
|
|
4563
4567
|
return `return (${appendFunction ? "function " : ""}${fnStr}).apply(this, arguments)`;
|
|
4564
4568
|
};
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
}
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
[key]: serializeValue(value)
|
|
4574
|
-
}), {}))
|
|
4575
|
-
});
|
|
4569
|
+
function serializeComponentInfo(info) {
|
|
4570
|
+
return JSON.parse(JSON.stringify(info, (key, value) => {
|
|
4571
|
+
if (typeof value === "function") {
|
|
4572
|
+
return serializeFn(value);
|
|
4573
|
+
}
|
|
4574
|
+
return value;
|
|
4575
|
+
}));
|
|
4576
|
+
}
|
|
4576
4577
|
|
|
4577
4578
|
// src/components/content-variants/inlined-fns.ts
|
|
4578
4579
|
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}";
|
|
@@ -5133,7 +5134,7 @@ function isFromTrustedHost(trustedHosts, e) {
|
|
|
5133
5134
|
}
|
|
5134
5135
|
|
|
5135
5136
|
// src/constants/sdk-version.ts
|
|
5136
|
-
var SDK_VERSION = "2.0.
|
|
5137
|
+
var SDK_VERSION = "2.0.3";
|
|
5137
5138
|
|
|
5138
5139
|
// src/functions/register.ts
|
|
5139
5140
|
var registry = {};
|
|
@@ -5766,7 +5767,15 @@ function ContentComponent(props) {
|
|
|
5766
5767
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
5767
5768
|
contentId: props.content?.id
|
|
5768
5769
|
}));
|
|
5769
|
-
const [registeredComponents, setRegisteredComponents] = createSignal([...getDefaultRegisteredComponents(), ...props.customComponents
|
|
5770
|
+
const [registeredComponents, setRegisteredComponents] = createSignal([...getDefaultRegisteredComponents(), ...props.customComponents?.filter(({
|
|
5771
|
+
models
|
|
5772
|
+
}) => {
|
|
5773
|
+
if (!models?.length)
|
|
5774
|
+
return true;
|
|
5775
|
+
if (!props.model)
|
|
5776
|
+
return true;
|
|
5777
|
+
return models.includes(props.model);
|
|
5778
|
+
}) || []].reduce((acc, {
|
|
5770
5779
|
component,
|
|
5771
5780
|
...info
|
|
5772
5781
|
}) => ({
|
|
@@ -5792,7 +5801,15 @@ function ContentComponent(props) {
|
|
|
5792
5801
|
canTrack: props.canTrack,
|
|
5793
5802
|
apiKey: props.apiKey,
|
|
5794
5803
|
apiVersion: props.apiVersion,
|
|
5795
|
-
componentInfos: [...getDefaultRegisteredComponents(), ...props.customComponents
|
|
5804
|
+
componentInfos: [...getDefaultRegisteredComponents(), ...props.customComponents?.filter(({
|
|
5805
|
+
models
|
|
5806
|
+
}) => {
|
|
5807
|
+
if (!models?.length)
|
|
5808
|
+
return true;
|
|
5809
|
+
if (!props.model)
|
|
5810
|
+
return true;
|
|
5811
|
+
return models.includes(props.model);
|
|
5812
|
+
}) || []].reduce((acc, {
|
|
5796
5813
|
component: _,
|
|
5797
5814
|
...info
|
|
5798
5815
|
}) => ({
|