@builder.io/sdk-solid 4.0.2 → 4.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -0
- package/lib/browser/dev.js +45 -23
- package/lib/browser/dev.jsx +54 -30
- package/lib/browser/index.js +45 -21
- package/lib/browser/index.jsx +54 -28
- package/lib/edge/dev.js +45 -23
- package/lib/edge/dev.jsx +54 -30
- package/lib/edge/index.js +45 -21
- package/lib/edge/index.jsx +54 -28
- package/lib/node/dev.js +45 -23
- package/lib/node/dev.jsx +54 -30
- package/lib/node/index.js +45 -21
- package/lib/node/index.jsx +54 -28
- package/package.json +1 -1
package/lib/browser/index.jsx
CHANGED
|
@@ -1473,9 +1473,10 @@ function Block(props) {
|
|
|
1473
1473
|
var Block_default = Block;
|
|
1474
1474
|
|
|
1475
1475
|
// src/components/blocks/blocks-wrapper.tsx
|
|
1476
|
-
import { onMount as onMount3, createMemo as createMemo6 } from "solid-js";
|
|
1476
|
+
import { onMount as onMount3, on as on2, createEffect as createEffect2, createMemo as createMemo6, createSignal as createSignal6 } from "solid-js";
|
|
1477
1477
|
import { Dynamic as Dynamic4 } from "solid-js/web";
|
|
1478
1478
|
function BlocksWrapper(props) {
|
|
1479
|
+
const [shouldUpdate, setShouldUpdate] = createSignal6(false);
|
|
1479
1480
|
const className = createMemo6(() => {
|
|
1480
1481
|
return [
|
|
1481
1482
|
"builder-blocks",
|
|
@@ -1522,9 +1523,13 @@ function BlocksWrapper(props) {
|
|
|
1522
1523
|
let blocksWrapperRef;
|
|
1523
1524
|
onMount3(() => {
|
|
1524
1525
|
});
|
|
1526
|
+
const onUpdateFn_0_props_blocks = createMemo6(() => props.blocks);
|
|
1527
|
+
function onUpdateFn_0() {
|
|
1528
|
+
}
|
|
1529
|
+
createEffect2(on2(() => [onUpdateFn_0_props_blocks()], onUpdateFn_0));
|
|
1525
1530
|
return <>
|
|
1526
1531
|
<Dynamic4
|
|
1527
|
-
class={className() + " dynamic-
|
|
1532
|
+
class={className() + " dynamic-023c60f2"}
|
|
1528
1533
|
ref={blocksWrapperRef}
|
|
1529
1534
|
builder-path={dataPath()}
|
|
1530
1535
|
builder-parent-id={props.parent}
|
|
@@ -1536,7 +1541,7 @@ function BlocksWrapper(props) {
|
|
|
1536
1541
|
{...props.BlocksWrapperProps}
|
|
1537
1542
|
component={props.BlocksWrapper}
|
|
1538
1543
|
>{props.children}</Dynamic4>
|
|
1539
|
-
<style>{`.dynamic-
|
|
1544
|
+
<style>{`.dynamic-023c60f2 {
|
|
1540
1545
|
display: flex;
|
|
1541
1546
|
flex-direction: column;
|
|
1542
1547
|
align-items: stretch;
|
|
@@ -1839,10 +1844,11 @@ function Image(props) {
|
|
|
1839
1844
|
<picture>
|
|
1840
1845
|
<Show8 when={webpSrcSet()}><source type="image/webp" srcset={webpSrcSet()} /></Show8>
|
|
1841
1846
|
<img
|
|
1842
|
-
class={"builder-image" + (props.className ? " " + props.className : "") + " img-
|
|
1847
|
+
class={"builder-image" + (props.className ? " " + props.className : "") + " img-040e729e"}
|
|
1843
1848
|
loading={props.highPriority ? "eager" : "lazy"}
|
|
1844
1849
|
fetchpriority={props.highPriority ? "high" : "auto"}
|
|
1845
1850
|
alt={props.altText}
|
|
1851
|
+
title={props.title}
|
|
1846
1852
|
role={props.altText ? void 0 : "presentation"}
|
|
1847
1853
|
style={{
|
|
1848
1854
|
"object-position": props.backgroundPosition || "center",
|
|
@@ -1857,22 +1863,22 @@ function Image(props) {
|
|
|
1857
1863
|
<Show8
|
|
1858
1864
|
when={props.aspectRatio && !(props.builderBlock?.children?.length && props.fitContent)}
|
|
1859
1865
|
><div
|
|
1860
|
-
class="builder-image-sizer div-
|
|
1866
|
+
class="builder-image-sizer div-040e729e"
|
|
1861
1867
|
style={{
|
|
1862
1868
|
"padding-top": props.aspectRatio * 100 + "%"
|
|
1863
1869
|
}}
|
|
1864
1870
|
/></Show8>
|
|
1865
1871
|
<Show8 when={props.builderBlock?.children?.length && props.fitContent}>{props.children}</Show8>
|
|
1866
|
-
<Show8 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-
|
|
1872
|
+
<Show8 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-040e729e-2">{props.children}</div></Show8>
|
|
1867
1873
|
</>
|
|
1868
|
-
<style>{`.img-
|
|
1874
|
+
<style>{`.img-040e729e {
|
|
1869
1875
|
opacity: 1;
|
|
1870
1876
|
transition: opacity 0.2s ease-in-out;
|
|
1871
|
-
}.div-
|
|
1877
|
+
}.div-040e729e {
|
|
1872
1878
|
width: 100%;
|
|
1873
1879
|
pointer-events: none;
|
|
1874
1880
|
font-size: 0;
|
|
1875
|
-
}.div-
|
|
1881
|
+
}.div-040e729e-2 {
|
|
1876
1882
|
display: flex;
|
|
1877
1883
|
flex-direction: column;
|
|
1878
1884
|
align-items: stretch;
|
|
@@ -1908,7 +1914,7 @@ function SectionComponent(props) {
|
|
|
1908
1914
|
var section_default = SectionComponent;
|
|
1909
1915
|
|
|
1910
1916
|
// src/blocks/symbol/symbol.tsx
|
|
1911
|
-
import { onMount as onMount9, on as
|
|
1917
|
+
import { onMount as onMount9, on as on6, createEffect as createEffect6, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
|
|
1912
1918
|
|
|
1913
1919
|
// src/components/content-variants/content-variants.tsx
|
|
1914
1920
|
import { Show as Show16, For as For9, onMount as onMount8, createSignal as createSignal19, createMemo as createMemo19 } from "solid-js";
|
|
@@ -2806,6 +2812,10 @@ var componentInfo5 = {
|
|
|
2806
2812
|
name: "altText",
|
|
2807
2813
|
type: "string",
|
|
2808
2814
|
helperText: "Text to display when the user has images off"
|
|
2815
|
+
}, {
|
|
2816
|
+
name: "title",
|
|
2817
|
+
type: "string",
|
|
2818
|
+
helperText: "Text to display when hovering over the asset"
|
|
2809
2819
|
}, {
|
|
2810
2820
|
name: "height",
|
|
2811
2821
|
type: "number",
|
|
@@ -3616,13 +3626,12 @@ var componentInfo12 = {
|
|
|
3616
3626
|
};
|
|
3617
3627
|
|
|
3618
3628
|
// src/blocks/custom-code/custom-code.tsx
|
|
3619
|
-
import { onMount as onMount5, createSignal as createSignal12 } from "solid-js";
|
|
3629
|
+
import { onMount as onMount5, on as on3, createEffect as createEffect3, createMemo as createMemo12, createSignal as createSignal12 } from "solid-js";
|
|
3620
3630
|
function CustomCode(props) {
|
|
3621
3631
|
const [scriptsInserted, setScriptsInserted] = createSignal12([]);
|
|
3622
3632
|
const [scriptsRun, setScriptsRun] = createSignal12([]);
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
|
|
3633
|
+
function runScripts() {
|
|
3634
|
+
if (!elementRef || !elementRef?.getElementsByTagName || typeof window === "undefined") {
|
|
3626
3635
|
return;
|
|
3627
3636
|
}
|
|
3628
3637
|
const scripts = elementRef.getElementsByTagName("script");
|
|
@@ -3649,10 +3658,25 @@ function CustomCode(props) {
|
|
|
3649
3658
|
scriptsRun().push(script.innerText);
|
|
3650
3659
|
new Function(script.innerText)();
|
|
3651
3660
|
} catch (error) {
|
|
3661
|
+
logger.warn(
|
|
3662
|
+
"[BUILDER.IO] `CustomCode`: Error running script:",
|
|
3663
|
+
error
|
|
3664
|
+
);
|
|
3652
3665
|
}
|
|
3653
3666
|
}
|
|
3654
3667
|
}
|
|
3668
|
+
}
|
|
3669
|
+
let elementRef;
|
|
3670
|
+
onMount5(() => {
|
|
3671
|
+
runScripts();
|
|
3655
3672
|
});
|
|
3673
|
+
const onUpdateFn_0_props_code = createMemo12(() => props.code);
|
|
3674
|
+
function onUpdateFn_0() {
|
|
3675
|
+
if (isEditing()) {
|
|
3676
|
+
runScripts();
|
|
3677
|
+
}
|
|
3678
|
+
}
|
|
3679
|
+
createEffect3(on3(() => [onUpdateFn_0_props_code()], onUpdateFn_0));
|
|
3656
3680
|
return <><div
|
|
3657
3681
|
class={"builder-custom-code" + (props.replaceNodes ? " replace-nodes" : "")}
|
|
3658
3682
|
ref={elementRef}
|
|
@@ -3680,7 +3704,7 @@ var componentInfo13 = {
|
|
|
3680
3704
|
};
|
|
3681
3705
|
|
|
3682
3706
|
// src/blocks/embed/embed.tsx
|
|
3683
|
-
import { on as
|
|
3707
|
+
import { on as on4, createEffect as createEffect4, createMemo as createMemo13, createSignal as createSignal13 } from "solid-js";
|
|
3684
3708
|
|
|
3685
3709
|
// src/blocks/embed/helpers.ts
|
|
3686
3710
|
var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"];
|
|
@@ -3708,6 +3732,7 @@ function Embed(props) {
|
|
|
3708
3732
|
scriptsRun().push(script.innerText);
|
|
3709
3733
|
new Function(script.innerText)();
|
|
3710
3734
|
} catch (error) {
|
|
3735
|
+
logger.warn("[BUILDER.IO] `Embed`: Error running script:", error);
|
|
3711
3736
|
}
|
|
3712
3737
|
}
|
|
3713
3738
|
}
|
|
@@ -3721,8 +3746,8 @@ function Embed(props) {
|
|
|
3721
3746
|
findAndRunScripts();
|
|
3722
3747
|
}
|
|
3723
3748
|
}
|
|
3724
|
-
|
|
3725
|
-
|
|
3749
|
+
createEffect4(
|
|
3750
|
+
on4(() => [onUpdateFn_0_elem(), onUpdateFn_0_ranInitFn__()], onUpdateFn_0)
|
|
3726
3751
|
);
|
|
3727
3752
|
return <><div class="builder-embed" ref={elem} innerHTML={props.content} /></>;
|
|
3728
3753
|
}
|
|
@@ -4763,7 +4788,7 @@ function serializeIncludingFunctions(info) {
|
|
|
4763
4788
|
}
|
|
4764
4789
|
|
|
4765
4790
|
// src/components/content-variants/inlined-fns.ts
|
|
4766
|
-
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
|
|
4791
|
+
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}";
|
|
4767
4792
|
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}";
|
|
4768
4793
|
|
|
4769
4794
|
// src/components/content-variants/helpers.ts
|
|
@@ -4792,6 +4817,7 @@ var checkShouldRenderVariants2 = ({
|
|
|
4792
4817
|
return true;
|
|
4793
4818
|
};
|
|
4794
4819
|
var getIsHydrationTarget = (target) => target === "react" || target === "reactNative";
|
|
4820
|
+
var isAngularSDK = TARGET === "angular";
|
|
4795
4821
|
var isHydrationTarget = getIsHydrationTarget(TARGET);
|
|
4796
4822
|
var getInitVariantsFnsScriptString = () => `
|
|
4797
4823
|
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
|
|
@@ -4799,7 +4825,7 @@ var getInitVariantsFnsScriptString = () => `
|
|
|
4799
4825
|
`;
|
|
4800
4826
|
var getUpdateCookieAndStylesScript = (variants, contentId) => `
|
|
4801
4827
|
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME}(
|
|
4802
|
-
"${contentId}",${JSON.stringify(variants)}, ${isHydrationTarget}
|
|
4828
|
+
"${contentId}",${JSON.stringify(variants)}, ${isHydrationTarget}, ${isAngularSDK}
|
|
4803
4829
|
)`;
|
|
4804
4830
|
var getUpdateVariantVisibilityScript = ({
|
|
4805
4831
|
contentId,
|
|
@@ -4812,8 +4838,8 @@ var getUpdateVariantVisibilityScript = ({
|
|
|
4812
4838
|
import {
|
|
4813
4839
|
Show as Show14,
|
|
4814
4840
|
onMount as onMount7,
|
|
4815
|
-
on as
|
|
4816
|
-
createEffect as
|
|
4841
|
+
on as on5,
|
|
4842
|
+
createEffect as createEffect5,
|
|
4817
4843
|
createMemo as createMemo16,
|
|
4818
4844
|
createSignal as createSignal16
|
|
4819
4845
|
} from "solid-js";
|
|
@@ -4825,7 +4851,7 @@ function getPreviewContent(_searchParams) {
|
|
|
4825
4851
|
}
|
|
4826
4852
|
|
|
4827
4853
|
// src/constants/sdk-version.ts
|
|
4828
|
-
var SDK_VERSION = "4.0.
|
|
4854
|
+
var SDK_VERSION = "4.0.4";
|
|
4829
4855
|
|
|
4830
4856
|
// src/helpers/sdk-headers.ts
|
|
4831
4857
|
var getSdkHeaders = () => ({
|
|
@@ -5910,15 +5936,15 @@ function EnableEditor(props) {
|
|
|
5910
5936
|
mergeNewContent(props.content);
|
|
5911
5937
|
}
|
|
5912
5938
|
}
|
|
5913
|
-
|
|
5939
|
+
createEffect5(on5(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
|
|
5914
5940
|
const onUpdateFn_1_props_builderContextSignal_rootState = createMemo16(
|
|
5915
5941
|
() => props.builderContextSignal.rootState
|
|
5916
5942
|
);
|
|
5917
5943
|
function onUpdateFn_1() {
|
|
5918
5944
|
emitStateUpdate();
|
|
5919
5945
|
}
|
|
5920
|
-
|
|
5921
|
-
|
|
5946
|
+
createEffect5(
|
|
5947
|
+
on5(
|
|
5922
5948
|
() => [onUpdateFn_1_props_builderContextSignal_rootState()],
|
|
5923
5949
|
onUpdateFn_1
|
|
5924
5950
|
)
|
|
@@ -5929,7 +5955,7 @@ function EnableEditor(props) {
|
|
|
5929
5955
|
mergeNewRootState(props.data);
|
|
5930
5956
|
}
|
|
5931
5957
|
}
|
|
5932
|
-
|
|
5958
|
+
createEffect5(on5(() => [onUpdateFn_2_props_data()], onUpdateFn_2));
|
|
5933
5959
|
const onUpdateFn_3_props_locale = createMemo16(() => props.locale);
|
|
5934
5960
|
function onUpdateFn_3() {
|
|
5935
5961
|
if (props.locale) {
|
|
@@ -5938,7 +5964,7 @@ function EnableEditor(props) {
|
|
|
5938
5964
|
});
|
|
5939
5965
|
}
|
|
5940
5966
|
}
|
|
5941
|
-
|
|
5967
|
+
createEffect5(on5(() => [onUpdateFn_3_props_locale()], onUpdateFn_3));
|
|
5942
5968
|
return <><builder_context_default.Provider value={props.builderContextSignal}><Show14
|
|
5943
5969
|
when={props.builderContextSignal.content || needsElementRefDivForEditing()}
|
|
5944
5970
|
><Dynamic5
|
|
@@ -6316,7 +6342,7 @@ function Symbol(props) {
|
|
|
6316
6342
|
function onUpdateFn_0() {
|
|
6317
6343
|
setContent();
|
|
6318
6344
|
}
|
|
6319
|
-
|
|
6345
|
+
createEffect6(on6(() => [onUpdateFn_0_props_symbol()], onUpdateFn_0));
|
|
6320
6346
|
return <><div class={className()} {...{}} {...props.attributes} {...{}}><Content_variants_default
|
|
6321
6347
|
nonce={props.builderContext.nonce}
|
|
6322
6348
|
isNestedRender={true}
|
package/lib/edge/dev.js
CHANGED
|
@@ -4822,12 +4822,13 @@ function Block(props) {
|
|
|
4822
4822
|
});
|
|
4823
4823
|
}
|
|
4824
4824
|
var block_default = Block;
|
|
4825
|
-
var _tmpl$2 = /* @__PURE__ */ template(`<style>.dynamic-
|
|
4825
|
+
var _tmpl$2 = /* @__PURE__ */ template(`<style>.dynamic-023c60f2 {
|
|
4826
4826
|
display: flex;
|
|
4827
4827
|
flex-direction: column;
|
|
4828
4828
|
align-items: stretch;
|
|
4829
4829
|
}`);
|
|
4830
4830
|
function BlocksWrapper(props) {
|
|
4831
|
+
createSignal(false);
|
|
4831
4832
|
const className = createMemo(() => {
|
|
4832
4833
|
return ["builder-blocks", !props.blocks?.length ? "no-blocks" : "", props.classNameProp].filter(Boolean).join(" ");
|
|
4833
4834
|
});
|
|
@@ -4864,9 +4865,13 @@ function BlocksWrapper(props) {
|
|
|
4864
4865
|
let blocksWrapperRef;
|
|
4865
4866
|
onMount(() => {
|
|
4866
4867
|
});
|
|
4868
|
+
const onUpdateFn_0_props_blocks = createMemo(() => props.blocks);
|
|
4869
|
+
function onUpdateFn_0() {
|
|
4870
|
+
}
|
|
4871
|
+
createEffect(on(() => [onUpdateFn_0_props_blocks()], onUpdateFn_0));
|
|
4867
4872
|
return [createComponent(Dynamic, mergeProps({
|
|
4868
4873
|
get ["class"]() {
|
|
4869
|
-
return className() + " dynamic-
|
|
4874
|
+
return className() + " dynamic-023c60f2";
|
|
4870
4875
|
},
|
|
4871
4876
|
ref(r$) {
|
|
4872
4877
|
const _ref$ = blocksWrapperRef;
|
|
@@ -5219,16 +5224,16 @@ function getSrcSet(url) {
|
|
|
5219
5224
|
// src/blocks/image/image.tsx
|
|
5220
5225
|
var _tmpl$5 = /* @__PURE__ */ template(`<source type=image/webp>`);
|
|
5221
5226
|
var _tmpl$23 = /* @__PURE__ */ template(`<picture><img>`);
|
|
5222
|
-
var _tmpl$32 = /* @__PURE__ */ template(`<div class="builder-image-sizer div-
|
|
5223
|
-
var _tmpl$42 = /* @__PURE__ */ template(`<div class=div-
|
|
5224
|
-
var _tmpl$52 = /* @__PURE__ */ template(`<style>.img-
|
|
5227
|
+
var _tmpl$32 = /* @__PURE__ */ template(`<div class="builder-image-sizer div-040e729e">`);
|
|
5228
|
+
var _tmpl$42 = /* @__PURE__ */ template(`<div class=div-040e729e-2>`);
|
|
5229
|
+
var _tmpl$52 = /* @__PURE__ */ template(`<style>.img-040e729e {
|
|
5225
5230
|
opacity: 1;
|
|
5226
5231
|
transition: opacity 0.2s ease-in-out;
|
|
5227
|
-
}.div-
|
|
5232
|
+
}.div-040e729e {
|
|
5228
5233
|
width: 100%;
|
|
5229
5234
|
pointer-events: none;
|
|
5230
5235
|
font-size: 0;
|
|
5231
|
-
}.div-
|
|
5236
|
+
}.div-040e729e-2 {
|
|
5232
5237
|
display: flex;
|
|
5233
5238
|
flex-direction: column;
|
|
5234
5239
|
align-items: stretch;
|
|
@@ -5291,20 +5296,21 @@ function Image(props) {
|
|
|
5291
5296
|
}
|
|
5292
5297
|
}), _el$3);
|
|
5293
5298
|
effect((_p$) => {
|
|
5294
|
-
const _v$ = "builder-image" + (props.className ? " " + props.className : "") + " img-
|
|
5299
|
+
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 = {
|
|
5295
5300
|
"object-position": props.backgroundPosition || "center",
|
|
5296
5301
|
"object-fit": props.backgroundSize || "cover",
|
|
5297
5302
|
...aspectRatioCss()
|
|
5298
|
-
}, _v$
|
|
5303
|
+
}, _v$8 = props.image, _v$9 = srcSetToUse(), _v$10 = props.sizes;
|
|
5299
5304
|
_v$ !== _p$._v$ && className(_el$3, _p$._v$ = _v$);
|
|
5300
5305
|
_v$2 !== _p$._v$2 && setAttribute(_el$3, "loading", _p$._v$2 = _v$2);
|
|
5301
5306
|
_v$3 !== _p$._v$3 && setAttribute(_el$3, "fetchpriority", _p$._v$3 = _v$3);
|
|
5302
5307
|
_v$4 !== _p$._v$4 && setAttribute(_el$3, "alt", _p$._v$4 = _v$4);
|
|
5303
|
-
_v$5 !== _p$._v$5 && setAttribute(_el$3, "
|
|
5304
|
-
_p$._v$6
|
|
5305
|
-
|
|
5306
|
-
_v$8 !== _p$._v$8 && setAttribute(_el$3, "
|
|
5307
|
-
_v$9 !== _p$._v$9 && setAttribute(_el$3, "
|
|
5308
|
+
_v$5 !== _p$._v$5 && setAttribute(_el$3, "title", _p$._v$5 = _v$5);
|
|
5309
|
+
_v$6 !== _p$._v$6 && setAttribute(_el$3, "role", _p$._v$6 = _v$6);
|
|
5310
|
+
_p$._v$7 = style(_el$3, _v$7, _p$._v$7);
|
|
5311
|
+
_v$8 !== _p$._v$8 && setAttribute(_el$3, "src", _p$._v$8 = _v$8);
|
|
5312
|
+
_v$9 !== _p$._v$9 && setAttribute(_el$3, "srcset", _p$._v$9 = _v$9);
|
|
5313
|
+
_v$10 !== _p$._v$10 && setAttribute(_el$3, "sizes", _p$._v$10 = _v$10);
|
|
5308
5314
|
return _p$;
|
|
5309
5315
|
}, {
|
|
5310
5316
|
_v$: void 0,
|
|
@@ -5315,7 +5321,8 @@ function Image(props) {
|
|
|
5315
5321
|
_v$6: void 0,
|
|
5316
5322
|
_v$7: void 0,
|
|
5317
5323
|
_v$8: void 0,
|
|
5318
|
-
_v$9: void 0
|
|
5324
|
+
_v$9: void 0,
|
|
5325
|
+
_v$10: void 0
|
|
5319
5326
|
});
|
|
5320
5327
|
return _el$;
|
|
5321
5328
|
})(), createComponent(Show, {
|
|
@@ -6299,6 +6306,10 @@ var componentInfo5 = {
|
|
|
6299
6306
|
name: "altText",
|
|
6300
6307
|
type: "string",
|
|
6301
6308
|
helperText: "Text to display when the user has images off"
|
|
6309
|
+
}, {
|
|
6310
|
+
name: "title",
|
|
6311
|
+
type: "string",
|
|
6312
|
+
helperText: "Text to display when hovering over the asset"
|
|
6302
6313
|
}, {
|
|
6303
6314
|
name: "height",
|
|
6304
6315
|
type: "number",
|
|
@@ -7182,9 +7193,8 @@ var _tmpl$13 = /* @__PURE__ */ template(`<div>`);
|
|
|
7182
7193
|
function CustomCode(props) {
|
|
7183
7194
|
const [scriptsInserted, setScriptsInserted] = createSignal([]);
|
|
7184
7195
|
const [scriptsRun, setScriptsRun] = createSignal([]);
|
|
7185
|
-
|
|
7186
|
-
|
|
7187
|
-
if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
|
|
7196
|
+
function runScripts() {
|
|
7197
|
+
if (!elementRef || !elementRef?.getElementsByTagName || typeof window === "undefined") {
|
|
7188
7198
|
return;
|
|
7189
7199
|
}
|
|
7190
7200
|
const scripts = elementRef.getElementsByTagName("script");
|
|
@@ -7207,11 +7217,22 @@ function CustomCode(props) {
|
|
|
7207
7217
|
scriptsRun().push(script.innerText);
|
|
7208
7218
|
new Function(script.innerText)();
|
|
7209
7219
|
} catch (error) {
|
|
7210
|
-
|
|
7220
|
+
logger.warn("[BUILDER.IO] `CustomCode`: Error running script:", error);
|
|
7211
7221
|
}
|
|
7212
7222
|
}
|
|
7213
7223
|
}
|
|
7224
|
+
}
|
|
7225
|
+
let elementRef;
|
|
7226
|
+
onMount(() => {
|
|
7227
|
+
runScripts();
|
|
7214
7228
|
});
|
|
7229
|
+
const onUpdateFn_0_props_code = createMemo(() => props.code);
|
|
7230
|
+
function onUpdateFn_0() {
|
|
7231
|
+
if (isEditing()) {
|
|
7232
|
+
runScripts();
|
|
7233
|
+
}
|
|
7234
|
+
}
|
|
7235
|
+
createEffect(on(() => [onUpdateFn_0_props_code()], onUpdateFn_0));
|
|
7215
7236
|
return (() => {
|
|
7216
7237
|
const _el$ = _tmpl$13();
|
|
7217
7238
|
const _ref$ = elementRef;
|
|
@@ -7275,7 +7296,7 @@ function Embed(props) {
|
|
|
7275
7296
|
scriptsRun().push(script.innerText);
|
|
7276
7297
|
new Function(script.innerText)();
|
|
7277
7298
|
} catch (error) {
|
|
7278
|
-
|
|
7299
|
+
logger.warn("[BUILDER.IO] `Embed`: Error running script:", error);
|
|
7279
7300
|
}
|
|
7280
7301
|
}
|
|
7281
7302
|
}
|
|
@@ -8460,7 +8481,7 @@ function serializeIncludingFunctions(info) {
|
|
|
8460
8481
|
}
|
|
8461
8482
|
|
|
8462
8483
|
// src/components/content-variants/inlined-fns.ts
|
|
8463
|
-
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
|
|
8484
|
+
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}";
|
|
8464
8485
|
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}";
|
|
8465
8486
|
|
|
8466
8487
|
// src/components/content-variants/helpers.ts
|
|
@@ -8489,6 +8510,7 @@ var checkShouldRenderVariants2 = ({
|
|
|
8489
8510
|
return true;
|
|
8490
8511
|
};
|
|
8491
8512
|
var getIsHydrationTarget = (target) => target === "react" || target === "reactNative";
|
|
8513
|
+
var isAngularSDK = TARGET === "angular";
|
|
8492
8514
|
var isHydrationTarget = getIsHydrationTarget(TARGET);
|
|
8493
8515
|
var getInitVariantsFnsScriptString = () => `
|
|
8494
8516
|
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
|
|
@@ -8496,7 +8518,7 @@ var getInitVariantsFnsScriptString = () => `
|
|
|
8496
8518
|
`;
|
|
8497
8519
|
var getUpdateCookieAndStylesScript = (variants, contentId) => `
|
|
8498
8520
|
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME}(
|
|
8499
|
-
"${contentId}",${JSON.stringify(variants)}, ${isHydrationTarget}
|
|
8521
|
+
"${contentId}",${JSON.stringify(variants)}, ${isHydrationTarget}, ${isAngularSDK}
|
|
8500
8522
|
)`;
|
|
8501
8523
|
var getUpdateVariantVisibilityScript = ({
|
|
8502
8524
|
contentId,
|
|
@@ -8511,7 +8533,7 @@ function getPreviewContent(_searchParams) {
|
|
|
8511
8533
|
}
|
|
8512
8534
|
|
|
8513
8535
|
// src/constants/sdk-version.ts
|
|
8514
|
-
var SDK_VERSION = "4.0.
|
|
8536
|
+
var SDK_VERSION = "4.0.4";
|
|
8515
8537
|
|
|
8516
8538
|
// src/helpers/sdk-headers.ts
|
|
8517
8539
|
var getSdkHeaders = () => ({
|