@builder.io/sdk-solid 1.0.15 → 1.0.17
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/browser/dev.js +38 -40
- package/lib/browser/dev.jsx +53 -43
- package/lib/browser/index.js +37 -39
- package/lib/browser/index.jsx +52 -42
- package/lib/edge/dev.js +38 -40
- package/lib/edge/dev.jsx +53 -43
- package/lib/edge/index.js +37 -39
- package/lib/edge/index.jsx +52 -42
- package/lib/node/dev.js +38 -40
- package/lib/node/dev.jsx +53 -43
- package/lib/node/index.js +37 -39
- package/lib/node/index.jsx +52 -42
- package/package.json +1 -1
package/lib/edge/dev.js
CHANGED
|
@@ -4024,7 +4024,7 @@ function InlinedStyles(props) {
|
|
|
4024
4024
|
effect((_p$) => {
|
|
4025
4025
|
const _v$ = props.styles, _v$2 = props.id;
|
|
4026
4026
|
_v$ !== _p$._v$ && (_el$.innerHTML = _p$._v$ = _v$);
|
|
4027
|
-
_v$2 !== _p$._v$2 && setAttribute(_el$, "id", _p$._v$2 = _v$2);
|
|
4027
|
+
_v$2 !== _p$._v$2 && setAttribute(_el$, "data-id", _p$._v$2 = _v$2);
|
|
4028
4028
|
return _p$;
|
|
4029
4029
|
}, {
|
|
4030
4030
|
_v$: void 0,
|
|
@@ -4095,6 +4095,7 @@ function BlockStyles(props) {
|
|
|
4095
4095
|
},
|
|
4096
4096
|
get children() {
|
|
4097
4097
|
return createComponent(inlined_styles_default, {
|
|
4098
|
+
id: "builderio-block",
|
|
4098
4099
|
get styles() {
|
|
4099
4100
|
return css5();
|
|
4100
4101
|
}
|
|
@@ -4811,6 +4812,7 @@ function Columns(props) {
|
|
|
4811
4812
|
when: TARGET !== "reactNative",
|
|
4812
4813
|
get children() {
|
|
4813
4814
|
return createComponent(inlined_styles_default, {
|
|
4815
|
+
id: "builderio-columns",
|
|
4814
4816
|
get styles() {
|
|
4815
4817
|
return columnsStyles();
|
|
4816
4818
|
}
|
|
@@ -7082,7 +7084,7 @@ var checkShouldRenderVariants = ({
|
|
|
7082
7084
|
};
|
|
7083
7085
|
var getIsHydrationTarget = (target) => target === "react" || target === "reactNative";
|
|
7084
7086
|
var isHydrationTarget = getIsHydrationTarget(TARGET);
|
|
7085
|
-
var
|
|
7087
|
+
var getInitVariantsFnsScriptString = () => `
|
|
7086
7088
|
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
|
|
7087
7089
|
window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${UPDATE_VARIANT_VISIBILITY_SCRIPT}
|
|
7088
7090
|
`;
|
|
@@ -7101,9 +7103,9 @@ function InlinedScript(props) {
|
|
|
7101
7103
|
return (() => {
|
|
7102
7104
|
const _el$ = _tmpl$16();
|
|
7103
7105
|
effect((_p$) => {
|
|
7104
|
-
const _v$ = props.scriptStr, _v$2 = props.id
|
|
7106
|
+
const _v$ = props.scriptStr, _v$2 = props.id;
|
|
7105
7107
|
_v$ !== _p$._v$ && (_el$.innerHTML = _p$._v$ = _v$);
|
|
7106
|
-
_v$2 !== _p$._v$2 && setAttribute(_el$, "id", _p$._v$2 = _v$2);
|
|
7108
|
+
_v$2 !== _p$._v$2 && setAttribute(_el$, "data-id", _p$._v$2 = _v$2);
|
|
7107
7109
|
return _p$;
|
|
7108
7110
|
}, {
|
|
7109
7111
|
_v$: void 0,
|
|
@@ -7600,7 +7602,7 @@ function isFromTrustedHost(trustedHosts, e) {
|
|
|
7600
7602
|
}
|
|
7601
7603
|
|
|
7602
7604
|
// src/constants/sdk-version.ts
|
|
7603
|
-
var SDK_VERSION = "1.0.
|
|
7605
|
+
var SDK_VERSION = "1.0.17";
|
|
7604
7606
|
|
|
7605
7607
|
// src/functions/register.ts
|
|
7606
7608
|
var registry = {};
|
|
@@ -7801,6 +7803,7 @@ var subscribeToEditor = (model, callback, options) => {
|
|
|
7801
7803
|
function EnableEditor(props) {
|
|
7802
7804
|
const [ContentWrapper, setContentWrapper] = createSignal(props.contentWrapper || "div");
|
|
7803
7805
|
const [httpReqsData, setHttpReqsData] = createSignal({});
|
|
7806
|
+
const [httpReqsPending, setHttpReqsPending] = createSignal({});
|
|
7804
7807
|
const [clicked, setClicked] = createSignal(false);
|
|
7805
7808
|
function mergeNewRootState(newData) {
|
|
7806
7809
|
const combinedState = {
|
|
@@ -7899,41 +7902,34 @@ function EnableEditor(props) {
|
|
|
7899
7902
|
setClicked(true);
|
|
7900
7903
|
}
|
|
7901
7904
|
}
|
|
7902
|
-
function evalExpression(expression) {
|
|
7903
|
-
return expression.replace(/{{([^}]+)}}/g, (_match, group) => String(evaluate({
|
|
7904
|
-
code: group,
|
|
7905
|
-
context: props.context || {},
|
|
7906
|
-
localState: void 0,
|
|
7907
|
-
rootState: props.builderContextSignal.rootState,
|
|
7908
|
-
rootSetState: props.builderContextSignal.rootSetState,
|
|
7909
|
-
enableCache: true
|
|
7910
|
-
})));
|
|
7911
|
-
}
|
|
7912
|
-
function handleRequest({
|
|
7913
|
-
url,
|
|
7914
|
-
key
|
|
7915
|
-
}) {
|
|
7916
|
-
fetch2(url).then((response) => response.json()).then((json) => {
|
|
7917
|
-
const newState = {
|
|
7918
|
-
...props.builderContextSignal.rootState,
|
|
7919
|
-
[key]: json
|
|
7920
|
-
};
|
|
7921
|
-
props.builderContextSignal.rootSetState?.(newState);
|
|
7922
|
-
httpReqsData()[key] = true;
|
|
7923
|
-
}).catch((err) => {
|
|
7924
|
-
console.error("error fetching dynamic data", url, err);
|
|
7925
|
-
});
|
|
7926
|
-
}
|
|
7927
7905
|
function runHttpRequests() {
|
|
7928
7906
|
const requests = props.builderContextSignal.content?.data?.httpRequests ?? {};
|
|
7929
7907
|
Object.entries(requests).forEach(([key, url]) => {
|
|
7930
|
-
if (url
|
|
7931
|
-
|
|
7932
|
-
|
|
7933
|
-
|
|
7934
|
-
|
|
7908
|
+
if (!url)
|
|
7909
|
+
return;
|
|
7910
|
+
if (httpReqsPending()[key])
|
|
7911
|
+
return;
|
|
7912
|
+
if (httpReqsData()[key] && !isEditing())
|
|
7913
|
+
return;
|
|
7914
|
+
httpReqsPending()[key] = true;
|
|
7915
|
+
const evaluatedUrl = url.replace(/{{([^}]+)}}/g, (_match, group) => String(evaluate({
|
|
7916
|
+
code: group,
|
|
7917
|
+
context: props.context || {},
|
|
7918
|
+
localState: void 0,
|
|
7919
|
+
rootState: props.builderContextSignal.rootState,
|
|
7920
|
+
rootSetState: props.builderContextSignal.rootSetState,
|
|
7921
|
+
enableCache: true
|
|
7922
|
+
})));
|
|
7923
|
+
fetch2(evaluatedUrl).then((response) => response.json()).then((json) => {
|
|
7924
|
+
mergeNewRootState({
|
|
7925
|
+
[key]: json
|
|
7935
7926
|
});
|
|
7936
|
-
|
|
7927
|
+
httpReqsData()[key] = true;
|
|
7928
|
+
}).catch((err) => {
|
|
7929
|
+
console.error("error fetching dynamic data", url, err);
|
|
7930
|
+
}).finally(() => {
|
|
7931
|
+
httpReqsPending()[key] = false;
|
|
7932
|
+
});
|
|
7937
7933
|
});
|
|
7938
7934
|
}
|
|
7939
7935
|
function emitStateUpdate() {
|
|
@@ -8182,6 +8178,7 @@ ${getFontCss({
|
|
|
8182
8178
|
${getDefaultStyles(props.isNestedRender)}
|
|
8183
8179
|
`.trim());
|
|
8184
8180
|
return createComponent(inlined_styles_default, {
|
|
8181
|
+
id: "builderio-content",
|
|
8185
8182
|
get styles() {
|
|
8186
8183
|
return injectedStyles();
|
|
8187
8184
|
}
|
|
@@ -8335,6 +8332,7 @@ function ContentComponent(props) {
|
|
|
8335
8332
|
},
|
|
8336
8333
|
get children() {
|
|
8337
8334
|
return createComponent(inlined_script_default, {
|
|
8335
|
+
id: "builderio-variant-visibility",
|
|
8338
8336
|
get scriptStr() {
|
|
8339
8337
|
return scriptStr();
|
|
8340
8338
|
}
|
|
@@ -8412,8 +8410,9 @@ function ContentVariants(props) {
|
|
|
8412
8410
|
},
|
|
8413
8411
|
get children() {
|
|
8414
8412
|
return createComponent(inlined_script_default, {
|
|
8413
|
+
id: "builderio-init-variants-fns",
|
|
8415
8414
|
get scriptStr() {
|
|
8416
|
-
return
|
|
8415
|
+
return getInitVariantsFnsScriptString();
|
|
8417
8416
|
}
|
|
8418
8417
|
});
|
|
8419
8418
|
}
|
|
@@ -8423,13 +8422,12 @@ function ContentVariants(props) {
|
|
|
8423
8422
|
},
|
|
8424
8423
|
get children() {
|
|
8425
8424
|
return [createComponent(inlined_styles_default, {
|
|
8426
|
-
|
|
8427
|
-
return `variants-styles-${props.content?.id}`;
|
|
8428
|
-
},
|
|
8425
|
+
id: "builderio-variants",
|
|
8429
8426
|
get styles() {
|
|
8430
8427
|
return hideVariantsStyleString();
|
|
8431
8428
|
}
|
|
8432
8429
|
}), createComponent(inlined_script_default, {
|
|
8430
|
+
id: "builderio-variants-visibility",
|
|
8433
8431
|
get scriptStr() {
|
|
8434
8432
|
return updateCookieAndStylesScriptStr();
|
|
8435
8433
|
}
|
package/lib/edge/dev.jsx
CHANGED
|
@@ -4012,7 +4012,7 @@ var getSizesForBreakpoints = ({
|
|
|
4012
4012
|
|
|
4013
4013
|
// src/components/inlined-styles.tsx
|
|
4014
4014
|
function InlinedStyles(props) {
|
|
4015
|
-
return <style innerHTML={props.styles} id={props.id} />;
|
|
4015
|
+
return <style innerHTML={props.styles} data-id={props.id} />;
|
|
4016
4016
|
}
|
|
4017
4017
|
var Inlined_styles_default = InlinedStyles;
|
|
4018
4018
|
|
|
@@ -4078,7 +4078,7 @@ function BlockStyles(props) {
|
|
|
4078
4078
|
}) : "";
|
|
4079
4079
|
return [largeStylesClass, mediumStylesClass, smallStylesClass].join(" ");
|
|
4080
4080
|
});
|
|
4081
|
-
return <Show2 when={TARGET !== "reactNative" && css5() && canShowBlock()}><Inlined_styles_default styles={css5()} /></Show2>;
|
|
4081
|
+
return <Show2 when={TARGET !== "reactNative" && css5() && canShowBlock()}><Inlined_styles_default id="builderio-block" styles={css5()} /></Show2>;
|
|
4082
4082
|
}
|
|
4083
4083
|
var Block_styles_default = BlockStyles;
|
|
4084
4084
|
|
|
@@ -4613,7 +4613,10 @@ function Columns(props) {
|
|
|
4613
4613
|
style={columnsCssVars()}
|
|
4614
4614
|
{...{}}
|
|
4615
4615
|
>
|
|
4616
|
-
<Show6 when={TARGET !== "reactNative"}><Inlined_styles_default
|
|
4616
|
+
<Show6 when={TARGET !== "reactNative"}><Inlined_styles_default
|
|
4617
|
+
id="builderio-columns"
|
|
4618
|
+
styles={columnsStyles()}
|
|
4619
|
+
/></Show6>
|
|
4617
4620
|
<For4 each={props.columns}>{(column, _index) => {
|
|
4618
4621
|
const index = _index();
|
|
4619
4622
|
return <Dynamic_renderer_default
|
|
@@ -6667,7 +6670,7 @@ var checkShouldRenderVariants = ({
|
|
|
6667
6670
|
};
|
|
6668
6671
|
var getIsHydrationTarget = (target) => target === "react" || target === "reactNative";
|
|
6669
6672
|
var isHydrationTarget = getIsHydrationTarget(TARGET);
|
|
6670
|
-
var
|
|
6673
|
+
var getInitVariantsFnsScriptString = () => `
|
|
6671
6674
|
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
|
|
6672
6675
|
window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${UPDATE_VARIANT_VISIBILITY_SCRIPT}
|
|
6673
6676
|
`;
|
|
@@ -6684,7 +6687,7 @@ var getUpdateVariantVisibilityScript = ({
|
|
|
6684
6687
|
|
|
6685
6688
|
// src/components/inlined-script.tsx
|
|
6686
6689
|
function InlinedScript(props) {
|
|
6687
|
-
return <script innerHTML={props.scriptStr} id={props.id
|
|
6690
|
+
return <script innerHTML={props.scriptStr} data-id={props.id} />;
|
|
6688
6691
|
}
|
|
6689
6692
|
var Inlined_script_default = InlinedScript;
|
|
6690
6693
|
|
|
@@ -7185,7 +7188,7 @@ function isFromTrustedHost(trustedHosts, e) {
|
|
|
7185
7188
|
}
|
|
7186
7189
|
|
|
7187
7190
|
// src/constants/sdk-version.ts
|
|
7188
|
-
var SDK_VERSION = "1.0.
|
|
7191
|
+
var SDK_VERSION = "1.0.17";
|
|
7189
7192
|
|
|
7190
7193
|
// src/functions/register.ts
|
|
7191
7194
|
var registry = {};
|
|
@@ -7388,6 +7391,7 @@ function EnableEditor(props) {
|
|
|
7388
7391
|
props.contentWrapper || "div"
|
|
7389
7392
|
);
|
|
7390
7393
|
const [httpReqsData, setHttpReqsData] = createSignal12({});
|
|
7394
|
+
const [httpReqsPending, setHttpReqsPending] = createSignal12({});
|
|
7391
7395
|
const [clicked, setClicked] = createSignal12(false);
|
|
7392
7396
|
function mergeNewRootState(newData) {
|
|
7393
7397
|
const combinedState = {
|
|
@@ -7483,43 +7487,39 @@ function EnableEditor(props) {
|
|
|
7483
7487
|
setClicked(true);
|
|
7484
7488
|
}
|
|
7485
7489
|
}
|
|
7486
|
-
function evalExpression(expression) {
|
|
7487
|
-
return expression.replace(
|
|
7488
|
-
/{{([^}]+)}}/g,
|
|
7489
|
-
(_match, group) => String(
|
|
7490
|
-
evaluate({
|
|
7491
|
-
code: group,
|
|
7492
|
-
context: props.context || {},
|
|
7493
|
-
localState: void 0,
|
|
7494
|
-
rootState: props.builderContextSignal.rootState,
|
|
7495
|
-
rootSetState: props.builderContextSignal.rootSetState,
|
|
7496
|
-
enableCache: true
|
|
7497
|
-
})
|
|
7498
|
-
)
|
|
7499
|
-
);
|
|
7500
|
-
}
|
|
7501
|
-
function handleRequest({ url, key }) {
|
|
7502
|
-
fetch2(url).then((response) => response.json()).then((json) => {
|
|
7503
|
-
const newState = {
|
|
7504
|
-
...props.builderContextSignal.rootState,
|
|
7505
|
-
[key]: json
|
|
7506
|
-
};
|
|
7507
|
-
props.builderContextSignal.rootSetState?.(newState);
|
|
7508
|
-
httpReqsData()[key] = true;
|
|
7509
|
-
}).catch((err) => {
|
|
7510
|
-
console.error("error fetching dynamic data", url, err);
|
|
7511
|
-
});
|
|
7512
|
-
}
|
|
7513
7490
|
function runHttpRequests() {
|
|
7514
7491
|
const requests = props.builderContextSignal.content?.data?.httpRequests ?? {};
|
|
7515
7492
|
Object.entries(requests).forEach(([key, url]) => {
|
|
7516
|
-
if (url
|
|
7517
|
-
|
|
7518
|
-
|
|
7519
|
-
|
|
7520
|
-
|
|
7493
|
+
if (!url)
|
|
7494
|
+
return;
|
|
7495
|
+
if (httpReqsPending()[key])
|
|
7496
|
+
return;
|
|
7497
|
+
if (httpReqsData()[key] && !isEditing())
|
|
7498
|
+
return;
|
|
7499
|
+
httpReqsPending()[key] = true;
|
|
7500
|
+
const evaluatedUrl = url.replace(
|
|
7501
|
+
/{{([^}]+)}}/g,
|
|
7502
|
+
(_match, group) => String(
|
|
7503
|
+
evaluate({
|
|
7504
|
+
code: group,
|
|
7505
|
+
context: props.context || {},
|
|
7506
|
+
localState: void 0,
|
|
7507
|
+
rootState: props.builderContextSignal.rootState,
|
|
7508
|
+
rootSetState: props.builderContextSignal.rootSetState,
|
|
7509
|
+
enableCache: true
|
|
7510
|
+
})
|
|
7511
|
+
)
|
|
7512
|
+
);
|
|
7513
|
+
fetch2(evaluatedUrl).then((response) => response.json()).then((json) => {
|
|
7514
|
+
mergeNewRootState({
|
|
7515
|
+
[key]: json
|
|
7521
7516
|
});
|
|
7522
|
-
|
|
7517
|
+
httpReqsData()[key] = true;
|
|
7518
|
+
}).catch((err) => {
|
|
7519
|
+
console.error("error fetching dynamic data", url, err);
|
|
7520
|
+
}).finally(() => {
|
|
7521
|
+
httpReqsPending()[key] = false;
|
|
7522
|
+
});
|
|
7523
7523
|
});
|
|
7524
7524
|
}
|
|
7525
7525
|
function emitStateUpdate() {
|
|
@@ -7779,7 +7779,10 @@ ${getFontCss({
|
|
|
7779
7779
|
${getDefaultStyles(props.isNestedRender)}
|
|
7780
7780
|
`.trim()
|
|
7781
7781
|
);
|
|
7782
|
-
return <Inlined_styles_default
|
|
7782
|
+
return <Inlined_styles_default
|
|
7783
|
+
id="builderio-content"
|
|
7784
|
+
styles={injectedStyles()}
|
|
7785
|
+
/>;
|
|
7783
7786
|
}
|
|
7784
7787
|
var Styles_default = ContentStyles;
|
|
7785
7788
|
|
|
@@ -7902,7 +7905,10 @@ function ContentComponent(props) {
|
|
|
7902
7905
|
setBuilderContextSignal
|
|
7903
7906
|
}}
|
|
7904
7907
|
>
|
|
7905
|
-
<Show11 when={props.isSsrAbTest}><Inlined_script_default
|
|
7908
|
+
<Show11 when={props.isSsrAbTest}><Inlined_script_default
|
|
7909
|
+
id="builderio-variant-visibility"
|
|
7910
|
+
scriptStr={scriptStr()}
|
|
7911
|
+
/></Show11>
|
|
7906
7912
|
<Show11 when={TARGET !== "reactNative"}><Styles_default
|
|
7907
7913
|
isNestedRender={props.isNestedRender}
|
|
7908
7914
|
contentId={builderContextSignal().content?.id}
|
|
@@ -7952,13 +7958,17 @@ function ContentVariants(props) {
|
|
|
7952
7958
|
setShouldRenderVariants(false);
|
|
7953
7959
|
});
|
|
7954
7960
|
return <>
|
|
7955
|
-
<Show12 when={!props.isNestedRender && TARGET !== "reactNative"}><Inlined_script_default
|
|
7961
|
+
<Show12 when={!props.isNestedRender && TARGET !== "reactNative"}><Inlined_script_default
|
|
7962
|
+
id="builderio-init-variants-fns"
|
|
7963
|
+
scriptStr={getInitVariantsFnsScriptString()}
|
|
7964
|
+
/></Show12>
|
|
7956
7965
|
<Show12 when={shouldRenderVariants()}>
|
|
7957
7966
|
<Inlined_styles_default
|
|
7958
|
-
id=
|
|
7967
|
+
id="builderio-variants"
|
|
7959
7968
|
styles={hideVariantsStyleString()}
|
|
7960
7969
|
/>
|
|
7961
7970
|
<Inlined_script_default
|
|
7971
|
+
id="builderio-variants-visibility"
|
|
7962
7972
|
scriptStr={updateCookieAndStylesScriptStr()}
|
|
7963
7973
|
/>
|
|
7964
7974
|
<For7 each={getVariants(props.content)}>{(variant, _index) => {
|
package/lib/edge/index.js
CHANGED
|
@@ -4018,7 +4018,7 @@ function InlinedStyles(props) {
|
|
|
4018
4018
|
effect((_p$) => {
|
|
4019
4019
|
const _v$ = props.styles, _v$2 = props.id;
|
|
4020
4020
|
_v$ !== _p$._v$ && (_el$.innerHTML = _p$._v$ = _v$);
|
|
4021
|
-
_v$2 !== _p$._v$2 && setAttribute(_el$, "id", _p$._v$2 = _v$2);
|
|
4021
|
+
_v$2 !== _p$._v$2 && setAttribute(_el$, "data-id", _p$._v$2 = _v$2);
|
|
4022
4022
|
return _p$;
|
|
4023
4023
|
}, {
|
|
4024
4024
|
_v$: void 0,
|
|
@@ -4089,6 +4089,7 @@ function BlockStyles(props) {
|
|
|
4089
4089
|
},
|
|
4090
4090
|
get children() {
|
|
4091
4091
|
return createComponent(inlined_styles_default, {
|
|
4092
|
+
id: "builderio-block",
|
|
4092
4093
|
get styles() {
|
|
4093
4094
|
return css5();
|
|
4094
4095
|
}
|
|
@@ -4805,6 +4806,7 @@ function Columns(props) {
|
|
|
4805
4806
|
when: TARGET !== "reactNative",
|
|
4806
4807
|
get children() {
|
|
4807
4808
|
return createComponent(inlined_styles_default, {
|
|
4809
|
+
id: "builderio-columns",
|
|
4808
4810
|
get styles() {
|
|
4809
4811
|
return columnsStyles();
|
|
4810
4812
|
}
|
|
@@ -7072,7 +7074,7 @@ var checkShouldRenderVariants = ({
|
|
|
7072
7074
|
};
|
|
7073
7075
|
var getIsHydrationTarget = (target) => target === "react" || target === "reactNative";
|
|
7074
7076
|
var isHydrationTarget = getIsHydrationTarget(TARGET);
|
|
7075
|
-
var
|
|
7077
|
+
var getInitVariantsFnsScriptString = () => `
|
|
7076
7078
|
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
|
|
7077
7079
|
window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${UPDATE_VARIANT_VISIBILITY_SCRIPT}
|
|
7078
7080
|
`;
|
|
@@ -7091,9 +7093,9 @@ function InlinedScript(props) {
|
|
|
7091
7093
|
return (() => {
|
|
7092
7094
|
const _el$ = _tmpl$16();
|
|
7093
7095
|
effect((_p$) => {
|
|
7094
|
-
const _v$ = props.scriptStr, _v$2 = props.id
|
|
7096
|
+
const _v$ = props.scriptStr, _v$2 = props.id;
|
|
7095
7097
|
_v$ !== _p$._v$ && (_el$.innerHTML = _p$._v$ = _v$);
|
|
7096
|
-
_v$2 !== _p$._v$2 && setAttribute(_el$, "id", _p$._v$2 = _v$2);
|
|
7098
|
+
_v$2 !== _p$._v$2 && setAttribute(_el$, "data-id", _p$._v$2 = _v$2);
|
|
7097
7099
|
return _p$;
|
|
7098
7100
|
}, {
|
|
7099
7101
|
_v$: void 0,
|
|
@@ -7585,7 +7587,7 @@ function isFromTrustedHost(trustedHosts, e) {
|
|
|
7585
7587
|
}
|
|
7586
7588
|
|
|
7587
7589
|
// src/constants/sdk-version.ts
|
|
7588
|
-
var SDK_VERSION = "1.0.
|
|
7590
|
+
var SDK_VERSION = "1.0.17";
|
|
7589
7591
|
|
|
7590
7592
|
// src/functions/register.ts
|
|
7591
7593
|
var registry = {};
|
|
@@ -7785,6 +7787,7 @@ var subscribeToEditor = (model, callback, options) => {
|
|
|
7785
7787
|
function EnableEditor(props) {
|
|
7786
7788
|
const [ContentWrapper, setContentWrapper] = createSignal(props.contentWrapper || "div");
|
|
7787
7789
|
const [httpReqsData, setHttpReqsData] = createSignal({});
|
|
7790
|
+
const [httpReqsPending, setHttpReqsPending] = createSignal({});
|
|
7788
7791
|
const [clicked, setClicked] = createSignal(false);
|
|
7789
7792
|
function mergeNewRootState(newData) {
|
|
7790
7793
|
const combinedState = {
|
|
@@ -7883,40 +7886,33 @@ function EnableEditor(props) {
|
|
|
7883
7886
|
setClicked(true);
|
|
7884
7887
|
}
|
|
7885
7888
|
}
|
|
7886
|
-
function evalExpression(expression) {
|
|
7887
|
-
return expression.replace(/{{([^}]+)}}/g, (_match, group) => String(evaluate({
|
|
7888
|
-
code: group,
|
|
7889
|
-
context: props.context || {},
|
|
7890
|
-
localState: void 0,
|
|
7891
|
-
rootState: props.builderContextSignal.rootState,
|
|
7892
|
-
rootSetState: props.builderContextSignal.rootSetState,
|
|
7893
|
-
enableCache: true
|
|
7894
|
-
})));
|
|
7895
|
-
}
|
|
7896
|
-
function handleRequest({
|
|
7897
|
-
url,
|
|
7898
|
-
key
|
|
7899
|
-
}) {
|
|
7900
|
-
fetch2(url).then((response) => response.json()).then((json) => {
|
|
7901
|
-
const newState = {
|
|
7902
|
-
...props.builderContextSignal.rootState,
|
|
7903
|
-
[key]: json
|
|
7904
|
-
};
|
|
7905
|
-
props.builderContextSignal.rootSetState?.(newState);
|
|
7906
|
-
httpReqsData()[key] = true;
|
|
7907
|
-
}).catch((err) => {
|
|
7908
|
-
});
|
|
7909
|
-
}
|
|
7910
7889
|
function runHttpRequests() {
|
|
7911
7890
|
const requests = props.builderContextSignal.content?.data?.httpRequests ?? {};
|
|
7912
7891
|
Object.entries(requests).forEach(([key, url]) => {
|
|
7913
|
-
if (url
|
|
7914
|
-
|
|
7915
|
-
|
|
7916
|
-
|
|
7917
|
-
|
|
7892
|
+
if (!url)
|
|
7893
|
+
return;
|
|
7894
|
+
if (httpReqsPending()[key])
|
|
7895
|
+
return;
|
|
7896
|
+
if (httpReqsData()[key] && !isEditing())
|
|
7897
|
+
return;
|
|
7898
|
+
httpReqsPending()[key] = true;
|
|
7899
|
+
const evaluatedUrl = url.replace(/{{([^}]+)}}/g, (_match, group) => String(evaluate({
|
|
7900
|
+
code: group,
|
|
7901
|
+
context: props.context || {},
|
|
7902
|
+
localState: void 0,
|
|
7903
|
+
rootState: props.builderContextSignal.rootState,
|
|
7904
|
+
rootSetState: props.builderContextSignal.rootSetState,
|
|
7905
|
+
enableCache: true
|
|
7906
|
+
})));
|
|
7907
|
+
fetch2(evaluatedUrl).then((response) => response.json()).then((json) => {
|
|
7908
|
+
mergeNewRootState({
|
|
7909
|
+
[key]: json
|
|
7918
7910
|
});
|
|
7919
|
-
|
|
7911
|
+
httpReqsData()[key] = true;
|
|
7912
|
+
}).catch((err) => {
|
|
7913
|
+
}).finally(() => {
|
|
7914
|
+
httpReqsPending()[key] = false;
|
|
7915
|
+
});
|
|
7920
7916
|
});
|
|
7921
7917
|
}
|
|
7922
7918
|
function emitStateUpdate() {
|
|
@@ -8165,6 +8161,7 @@ ${getFontCss({
|
|
|
8165
8161
|
${getDefaultStyles(props.isNestedRender)}
|
|
8166
8162
|
`.trim());
|
|
8167
8163
|
return createComponent(inlined_styles_default, {
|
|
8164
|
+
id: "builderio-content",
|
|
8168
8165
|
get styles() {
|
|
8169
8166
|
return injectedStyles();
|
|
8170
8167
|
}
|
|
@@ -8318,6 +8315,7 @@ function ContentComponent(props) {
|
|
|
8318
8315
|
},
|
|
8319
8316
|
get children() {
|
|
8320
8317
|
return createComponent(inlined_script_default, {
|
|
8318
|
+
id: "builderio-variant-visibility",
|
|
8321
8319
|
get scriptStr() {
|
|
8322
8320
|
return scriptStr();
|
|
8323
8321
|
}
|
|
@@ -8395,8 +8393,9 @@ function ContentVariants(props) {
|
|
|
8395
8393
|
},
|
|
8396
8394
|
get children() {
|
|
8397
8395
|
return createComponent(inlined_script_default, {
|
|
8396
|
+
id: "builderio-init-variants-fns",
|
|
8398
8397
|
get scriptStr() {
|
|
8399
|
-
return
|
|
8398
|
+
return getInitVariantsFnsScriptString();
|
|
8400
8399
|
}
|
|
8401
8400
|
});
|
|
8402
8401
|
}
|
|
@@ -8406,13 +8405,12 @@ function ContentVariants(props) {
|
|
|
8406
8405
|
},
|
|
8407
8406
|
get children() {
|
|
8408
8407
|
return [createComponent(inlined_styles_default, {
|
|
8409
|
-
|
|
8410
|
-
return `variants-styles-${props.content?.id}`;
|
|
8411
|
-
},
|
|
8408
|
+
id: "builderio-variants",
|
|
8412
8409
|
get styles() {
|
|
8413
8410
|
return hideVariantsStyleString();
|
|
8414
8411
|
}
|
|
8415
8412
|
}), createComponent(inlined_script_default, {
|
|
8413
|
+
id: "builderio-variants-visibility",
|
|
8416
8414
|
get scriptStr() {
|
|
8417
8415
|
return updateCookieAndStylesScriptStr();
|
|
8418
8416
|
}
|
package/lib/edge/index.jsx
CHANGED
|
@@ -4006,7 +4006,7 @@ var getSizesForBreakpoints = ({
|
|
|
4006
4006
|
|
|
4007
4007
|
// src/components/inlined-styles.tsx
|
|
4008
4008
|
function InlinedStyles(props) {
|
|
4009
|
-
return <style innerHTML={props.styles} id={props.id} />;
|
|
4009
|
+
return <style innerHTML={props.styles} data-id={props.id} />;
|
|
4010
4010
|
}
|
|
4011
4011
|
var Inlined_styles_default = InlinedStyles;
|
|
4012
4012
|
|
|
@@ -4072,7 +4072,7 @@ function BlockStyles(props) {
|
|
|
4072
4072
|
}) : "";
|
|
4073
4073
|
return [largeStylesClass, mediumStylesClass, smallStylesClass].join(" ");
|
|
4074
4074
|
});
|
|
4075
|
-
return <Show2 when={TARGET !== "reactNative" && css5() && canShowBlock()}><Inlined_styles_default styles={css5()} /></Show2>;
|
|
4075
|
+
return <Show2 when={TARGET !== "reactNative" && css5() && canShowBlock()}><Inlined_styles_default id="builderio-block" styles={css5()} /></Show2>;
|
|
4076
4076
|
}
|
|
4077
4077
|
var Block_styles_default = BlockStyles;
|
|
4078
4078
|
|
|
@@ -4607,7 +4607,10 @@ function Columns(props) {
|
|
|
4607
4607
|
style={columnsCssVars()}
|
|
4608
4608
|
{...{}}
|
|
4609
4609
|
>
|
|
4610
|
-
<Show6 when={TARGET !== "reactNative"}><Inlined_styles_default
|
|
4610
|
+
<Show6 when={TARGET !== "reactNative"}><Inlined_styles_default
|
|
4611
|
+
id="builderio-columns"
|
|
4612
|
+
styles={columnsStyles()}
|
|
4613
|
+
/></Show6>
|
|
4611
4614
|
<For4 each={props.columns}>{(column, _index) => {
|
|
4612
4615
|
const index = _index();
|
|
4613
4616
|
return <Dynamic_renderer_default
|
|
@@ -6657,7 +6660,7 @@ var checkShouldRenderVariants = ({
|
|
|
6657
6660
|
};
|
|
6658
6661
|
var getIsHydrationTarget = (target) => target === "react" || target === "reactNative";
|
|
6659
6662
|
var isHydrationTarget = getIsHydrationTarget(TARGET);
|
|
6660
|
-
var
|
|
6663
|
+
var getInitVariantsFnsScriptString = () => `
|
|
6661
6664
|
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
|
|
6662
6665
|
window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${UPDATE_VARIANT_VISIBILITY_SCRIPT}
|
|
6663
6666
|
`;
|
|
@@ -6674,7 +6677,7 @@ var getUpdateVariantVisibilityScript = ({
|
|
|
6674
6677
|
|
|
6675
6678
|
// src/components/inlined-script.tsx
|
|
6676
6679
|
function InlinedScript(props) {
|
|
6677
|
-
return <script innerHTML={props.scriptStr} id={props.id
|
|
6680
|
+
return <script innerHTML={props.scriptStr} data-id={props.id} />;
|
|
6678
6681
|
}
|
|
6679
6682
|
var Inlined_script_default = InlinedScript;
|
|
6680
6683
|
|
|
@@ -7170,7 +7173,7 @@ function isFromTrustedHost(trustedHosts, e) {
|
|
|
7170
7173
|
}
|
|
7171
7174
|
|
|
7172
7175
|
// src/constants/sdk-version.ts
|
|
7173
|
-
var SDK_VERSION = "1.0.
|
|
7176
|
+
var SDK_VERSION = "1.0.17";
|
|
7174
7177
|
|
|
7175
7178
|
// src/functions/register.ts
|
|
7176
7179
|
var registry = {};
|
|
@@ -7372,6 +7375,7 @@ function EnableEditor(props) {
|
|
|
7372
7375
|
props.contentWrapper || "div"
|
|
7373
7376
|
);
|
|
7374
7377
|
const [httpReqsData, setHttpReqsData] = createSignal12({});
|
|
7378
|
+
const [httpReqsPending, setHttpReqsPending] = createSignal12({});
|
|
7375
7379
|
const [clicked, setClicked] = createSignal12(false);
|
|
7376
7380
|
function mergeNewRootState(newData) {
|
|
7377
7381
|
const combinedState = {
|
|
@@ -7467,42 +7471,38 @@ function EnableEditor(props) {
|
|
|
7467
7471
|
setClicked(true);
|
|
7468
7472
|
}
|
|
7469
7473
|
}
|
|
7470
|
-
function evalExpression(expression) {
|
|
7471
|
-
return expression.replace(
|
|
7472
|
-
/{{([^}]+)}}/g,
|
|
7473
|
-
(_match, group) => String(
|
|
7474
|
-
evaluate({
|
|
7475
|
-
code: group,
|
|
7476
|
-
context: props.context || {},
|
|
7477
|
-
localState: void 0,
|
|
7478
|
-
rootState: props.builderContextSignal.rootState,
|
|
7479
|
-
rootSetState: props.builderContextSignal.rootSetState,
|
|
7480
|
-
enableCache: true
|
|
7481
|
-
})
|
|
7482
|
-
)
|
|
7483
|
-
);
|
|
7484
|
-
}
|
|
7485
|
-
function handleRequest({ url, key }) {
|
|
7486
|
-
fetch2(url).then((response) => response.json()).then((json) => {
|
|
7487
|
-
const newState = {
|
|
7488
|
-
...props.builderContextSignal.rootState,
|
|
7489
|
-
[key]: json
|
|
7490
|
-
};
|
|
7491
|
-
props.builderContextSignal.rootSetState?.(newState);
|
|
7492
|
-
httpReqsData()[key] = true;
|
|
7493
|
-
}).catch((err) => {
|
|
7494
|
-
});
|
|
7495
|
-
}
|
|
7496
7474
|
function runHttpRequests() {
|
|
7497
7475
|
const requests = props.builderContextSignal.content?.data?.httpRequests ?? {};
|
|
7498
7476
|
Object.entries(requests).forEach(([key, url]) => {
|
|
7499
|
-
if (url
|
|
7500
|
-
|
|
7501
|
-
|
|
7502
|
-
|
|
7503
|
-
|
|
7477
|
+
if (!url)
|
|
7478
|
+
return;
|
|
7479
|
+
if (httpReqsPending()[key])
|
|
7480
|
+
return;
|
|
7481
|
+
if (httpReqsData()[key] && !isEditing())
|
|
7482
|
+
return;
|
|
7483
|
+
httpReqsPending()[key] = true;
|
|
7484
|
+
const evaluatedUrl = url.replace(
|
|
7485
|
+
/{{([^}]+)}}/g,
|
|
7486
|
+
(_match, group) => String(
|
|
7487
|
+
evaluate({
|
|
7488
|
+
code: group,
|
|
7489
|
+
context: props.context || {},
|
|
7490
|
+
localState: void 0,
|
|
7491
|
+
rootState: props.builderContextSignal.rootState,
|
|
7492
|
+
rootSetState: props.builderContextSignal.rootSetState,
|
|
7493
|
+
enableCache: true
|
|
7494
|
+
})
|
|
7495
|
+
)
|
|
7496
|
+
);
|
|
7497
|
+
fetch2(evaluatedUrl).then((response) => response.json()).then((json) => {
|
|
7498
|
+
mergeNewRootState({
|
|
7499
|
+
[key]: json
|
|
7504
7500
|
});
|
|
7505
|
-
|
|
7501
|
+
httpReqsData()[key] = true;
|
|
7502
|
+
}).catch((err) => {
|
|
7503
|
+
}).finally(() => {
|
|
7504
|
+
httpReqsPending()[key] = false;
|
|
7505
|
+
});
|
|
7506
7506
|
});
|
|
7507
7507
|
}
|
|
7508
7508
|
function emitStateUpdate() {
|
|
@@ -7762,7 +7762,10 @@ ${getFontCss({
|
|
|
7762
7762
|
${getDefaultStyles(props.isNestedRender)}
|
|
7763
7763
|
`.trim()
|
|
7764
7764
|
);
|
|
7765
|
-
return <Inlined_styles_default
|
|
7765
|
+
return <Inlined_styles_default
|
|
7766
|
+
id="builderio-content"
|
|
7767
|
+
styles={injectedStyles()}
|
|
7768
|
+
/>;
|
|
7766
7769
|
}
|
|
7767
7770
|
var Styles_default = ContentStyles;
|
|
7768
7771
|
|
|
@@ -7885,7 +7888,10 @@ function ContentComponent(props) {
|
|
|
7885
7888
|
setBuilderContextSignal
|
|
7886
7889
|
}}
|
|
7887
7890
|
>
|
|
7888
|
-
<Show11 when={props.isSsrAbTest}><Inlined_script_default
|
|
7891
|
+
<Show11 when={props.isSsrAbTest}><Inlined_script_default
|
|
7892
|
+
id="builderio-variant-visibility"
|
|
7893
|
+
scriptStr={scriptStr()}
|
|
7894
|
+
/></Show11>
|
|
7889
7895
|
<Show11 when={TARGET !== "reactNative"}><Styles_default
|
|
7890
7896
|
isNestedRender={props.isNestedRender}
|
|
7891
7897
|
contentId={builderContextSignal().content?.id}
|
|
@@ -7935,13 +7941,17 @@ function ContentVariants(props) {
|
|
|
7935
7941
|
setShouldRenderVariants(false);
|
|
7936
7942
|
});
|
|
7937
7943
|
return <>
|
|
7938
|
-
<Show12 when={!props.isNestedRender && TARGET !== "reactNative"}><Inlined_script_default
|
|
7944
|
+
<Show12 when={!props.isNestedRender && TARGET !== "reactNative"}><Inlined_script_default
|
|
7945
|
+
id="builderio-init-variants-fns"
|
|
7946
|
+
scriptStr={getInitVariantsFnsScriptString()}
|
|
7947
|
+
/></Show12>
|
|
7939
7948
|
<Show12 when={shouldRenderVariants()}>
|
|
7940
7949
|
<Inlined_styles_default
|
|
7941
|
-
id=
|
|
7950
|
+
id="builderio-variants"
|
|
7942
7951
|
styles={hideVariantsStyleString()}
|
|
7943
7952
|
/>
|
|
7944
7953
|
<Inlined_script_default
|
|
7954
|
+
id="builderio-variants-visibility"
|
|
7945
7955
|
scriptStr={updateCookieAndStylesScriptStr()}
|
|
7946
7956
|
/>
|
|
7947
7957
|
<For7 each={getVariants(props.content)}>{(variant, _index) => {
|