@builder.io/sdk-solid 0.14.6 → 1.0.13
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 +217 -149
- package/lib/browser/dev.jsx +276 -187
- package/lib/browser/index.js +217 -149
- package/lib/browser/index.jsx +276 -187
- package/lib/edge/dev.js +217 -149
- package/lib/edge/dev.jsx +276 -187
- package/lib/edge/index.js +217 -149
- package/lib/edge/index.jsx +276 -187
- package/lib/node/dev.js +217 -149
- package/lib/node/dev.jsx +276 -187
- package/lib/node/index.js +217 -149
- package/lib/node/index.jsx +276 -187
- package/package.json +1 -1
package/lib/node/index.jsx
CHANGED
|
@@ -71,7 +71,7 @@ function Button(props) {
|
|
|
71
71
|
var button_default = Button;
|
|
72
72
|
|
|
73
73
|
// src/blocks/columns/columns.tsx
|
|
74
|
-
import { Show as Show6, For as For4, createSignal as
|
|
74
|
+
import { Show as Show6, For as For4, createSignal as createSignal6, createMemo as createMemo6 } from "solid-js";
|
|
75
75
|
import { css as css2 } from "solid-styled-components";
|
|
76
76
|
|
|
77
77
|
// src/components/blocks/blocks.tsx
|
|
@@ -99,7 +99,7 @@ import { createContext as createContext2 } from "solid-js";
|
|
|
99
99
|
var components_context_default = createContext2({ registeredComponents: {} });
|
|
100
100
|
|
|
101
101
|
// src/components/block/block.tsx
|
|
102
|
-
import { Show as Show4, For as For2, onMount,
|
|
102
|
+
import { Show as Show4, For as For2, onMount, createMemo as createMemo4 } from "solid-js";
|
|
103
103
|
|
|
104
104
|
// src/functions/get-block-component-options.ts
|
|
105
105
|
function getBlockComponentOptions(block) {
|
|
@@ -266,7 +266,7 @@ function flattenState({
|
|
|
266
266
|
return localState[prop];
|
|
267
267
|
}
|
|
268
268
|
const val = target[prop];
|
|
269
|
-
if (typeof val === "object") {
|
|
269
|
+
if (typeof val === "object" && val !== null) {
|
|
270
270
|
return flattenState({
|
|
271
271
|
rootState: val,
|
|
272
272
|
localState: void 0,
|
|
@@ -457,6 +457,30 @@ var shouldForceBrowserRuntimeInNode = () => {
|
|
|
457
457
|
var chooseBrowserOrServerEval = (args) => isBrowser() || shouldForceBrowserRuntimeInNode() ? runInBrowser(args) : runInNode(args);
|
|
458
458
|
|
|
459
459
|
// src/functions/evaluate/evaluate.ts
|
|
460
|
+
var EvalCache = class _EvalCache {
|
|
461
|
+
static cacheLimit = 20;
|
|
462
|
+
static cache = /* @__PURE__ */ new Map();
|
|
463
|
+
static getCacheKey(args) {
|
|
464
|
+
return JSON.stringify({
|
|
465
|
+
...args,
|
|
466
|
+
// replace the event with a random number to break cache
|
|
467
|
+
// thats because we can't serialize the event object due to circular refs in DOM node refs.
|
|
468
|
+
event: args.event ? Math.random() : void 0
|
|
469
|
+
});
|
|
470
|
+
}
|
|
471
|
+
static getCachedValue(key) {
|
|
472
|
+
const cachedVal = _EvalCache.cache.get(key);
|
|
473
|
+
return cachedVal;
|
|
474
|
+
}
|
|
475
|
+
static setCachedValue(key, value) {
|
|
476
|
+
if (_EvalCache.cache.size > 20) {
|
|
477
|
+
_EvalCache.cache.delete(_EvalCache.cache.keys().next().value);
|
|
478
|
+
}
|
|
479
|
+
_EvalCache.cache.set(key, {
|
|
480
|
+
value
|
|
481
|
+
});
|
|
482
|
+
}
|
|
483
|
+
};
|
|
460
484
|
function evaluate({
|
|
461
485
|
code,
|
|
462
486
|
context,
|
|
@@ -464,11 +488,12 @@ function evaluate({
|
|
|
464
488
|
rootState,
|
|
465
489
|
rootSetState,
|
|
466
490
|
event,
|
|
467
|
-
isExpression = true
|
|
491
|
+
isExpression = true,
|
|
492
|
+
enableCache
|
|
468
493
|
}) {
|
|
469
494
|
if (code === "") {
|
|
470
495
|
logger.warn("Skipping evaluation of empty code block.");
|
|
471
|
-
return;
|
|
496
|
+
return void 0;
|
|
472
497
|
}
|
|
473
498
|
const args = {
|
|
474
499
|
code: parseCode(code, {
|
|
@@ -481,8 +506,20 @@ function evaluate({
|
|
|
481
506
|
rootState,
|
|
482
507
|
localState
|
|
483
508
|
};
|
|
509
|
+
if (enableCache) {
|
|
510
|
+
const cacheKey = EvalCache.getCacheKey(args);
|
|
511
|
+
const cachedValue = EvalCache.getCachedValue(cacheKey);
|
|
512
|
+
if (cachedValue) {
|
|
513
|
+
return cachedValue.value;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
484
516
|
try {
|
|
485
|
-
|
|
517
|
+
const newEval = chooseBrowserOrServerEval(args);
|
|
518
|
+
if (enableCache) {
|
|
519
|
+
const cacheKey = EvalCache.getCacheKey(args);
|
|
520
|
+
EvalCache.setCachedValue(cacheKey, newEval);
|
|
521
|
+
}
|
|
522
|
+
return newEval;
|
|
486
523
|
} catch (e) {
|
|
487
524
|
logger.error("Failed code evaluation: " + e.message, {
|
|
488
525
|
code
|
|
@@ -524,7 +561,8 @@ var evaluateBindings = ({
|
|
|
524
561
|
localState,
|
|
525
562
|
rootState,
|
|
526
563
|
rootSetState,
|
|
527
|
-
context
|
|
564
|
+
context,
|
|
565
|
+
enableCache: true
|
|
528
566
|
});
|
|
529
567
|
set(copied, binding, value);
|
|
530
568
|
}
|
|
@@ -757,6 +795,70 @@ function bindScrollInViewAnimation(animation) {
|
|
|
757
795
|
});
|
|
758
796
|
}
|
|
759
797
|
|
|
798
|
+
// src/functions/camel-to-kebab-case.ts
|
|
799
|
+
var camelToKebabCase = (string) => string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
|
|
800
|
+
|
|
801
|
+
// src/helpers/css.ts
|
|
802
|
+
var convertStyleMapToCSSArray = (style) => {
|
|
803
|
+
const cssProps = Object.entries(style).map(([key, value]) => {
|
|
804
|
+
if (typeof value === "string") {
|
|
805
|
+
return `${camelToKebabCase(key)}: ${value};`;
|
|
806
|
+
} else {
|
|
807
|
+
return void 0;
|
|
808
|
+
}
|
|
809
|
+
});
|
|
810
|
+
return cssProps.filter(checkIsDefined);
|
|
811
|
+
};
|
|
812
|
+
var convertStyleMapToCSS = (style) => convertStyleMapToCSSArray(style).join("\n");
|
|
813
|
+
var createCssClass = ({
|
|
814
|
+
mediaQuery,
|
|
815
|
+
className,
|
|
816
|
+
styles
|
|
817
|
+
}) => {
|
|
818
|
+
const cssClass = `.${className} {
|
|
819
|
+
${convertStyleMapToCSS(styles)}
|
|
820
|
+
}`;
|
|
821
|
+
if (mediaQuery) {
|
|
822
|
+
return `${mediaQuery} {
|
|
823
|
+
${cssClass}
|
|
824
|
+
}`;
|
|
825
|
+
} else {
|
|
826
|
+
return cssClass;
|
|
827
|
+
}
|
|
828
|
+
};
|
|
829
|
+
|
|
830
|
+
// src/functions/transform-style-property.ts
|
|
831
|
+
function transformStyleProperty({
|
|
832
|
+
style
|
|
833
|
+
}) {
|
|
834
|
+
return style;
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
// src/functions/get-style.ts
|
|
838
|
+
var getStyle = ({
|
|
839
|
+
block,
|
|
840
|
+
context
|
|
841
|
+
}) => {
|
|
842
|
+
return mapStyleObjToStrIfNeeded(transformStyleProperty({
|
|
843
|
+
style: block.style || {},
|
|
844
|
+
context,
|
|
845
|
+
block
|
|
846
|
+
}));
|
|
847
|
+
};
|
|
848
|
+
function mapStyleObjToStrIfNeeded(style) {
|
|
849
|
+
switch (TARGET) {
|
|
850
|
+
case "svelte":
|
|
851
|
+
case "vue":
|
|
852
|
+
case "solid":
|
|
853
|
+
return convertStyleMapToCSSArray(style).join(" ");
|
|
854
|
+
case "qwik":
|
|
855
|
+
case "reactNative":
|
|
856
|
+
case "react":
|
|
857
|
+
case "rsc":
|
|
858
|
+
return style;
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
|
|
760
862
|
// src/components/block/block.helpers.ts
|
|
761
863
|
var getComponent = ({
|
|
762
864
|
block,
|
|
@@ -797,7 +899,8 @@ var getRepeatItemData = ({
|
|
|
797
899
|
localState: context.localState,
|
|
798
900
|
rootState: context.rootState,
|
|
799
901
|
rootSetState: context.rootSetState,
|
|
800
|
-
context: context.context
|
|
902
|
+
context: context.context,
|
|
903
|
+
enableCache: true
|
|
801
904
|
});
|
|
802
905
|
if (!Array.isArray(itemsArray)) {
|
|
803
906
|
return void 0;
|
|
@@ -821,7 +924,7 @@ var getRepeatItemData = ({
|
|
|
821
924
|
};
|
|
822
925
|
|
|
823
926
|
// src/components/block/components/block-styles.tsx
|
|
824
|
-
import { Show as Show2 } from "solid-js";
|
|
927
|
+
import { Show as Show2, createMemo } from "solid-js";
|
|
825
928
|
|
|
826
929
|
// src/constants/device-sizes.ts
|
|
827
930
|
var SIZES = {
|
|
@@ -872,38 +975,6 @@ var getSizesForBreakpoints = ({
|
|
|
872
975
|
return newSizes;
|
|
873
976
|
};
|
|
874
977
|
|
|
875
|
-
// src/functions/camel-to-kebab-case.ts
|
|
876
|
-
var camelToKebabCase = (string) => string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
|
|
877
|
-
|
|
878
|
-
// src/helpers/css.ts
|
|
879
|
-
var convertStyleMapToCSSArray = (style) => {
|
|
880
|
-
const cssProps = Object.entries(style).map(([key, value]) => {
|
|
881
|
-
if (typeof value === "string") {
|
|
882
|
-
return `${camelToKebabCase(key)}: ${value};`;
|
|
883
|
-
} else {
|
|
884
|
-
return void 0;
|
|
885
|
-
}
|
|
886
|
-
});
|
|
887
|
-
return cssProps.filter(checkIsDefined);
|
|
888
|
-
};
|
|
889
|
-
var convertStyleMapToCSS = (style) => convertStyleMapToCSSArray(style).join("\n");
|
|
890
|
-
var createCssClass = ({
|
|
891
|
-
mediaQuery,
|
|
892
|
-
className,
|
|
893
|
-
styles
|
|
894
|
-
}) => {
|
|
895
|
-
const cssClass = `.${className} {
|
|
896
|
-
${convertStyleMapToCSS(styles)}
|
|
897
|
-
}`;
|
|
898
|
-
if (mediaQuery) {
|
|
899
|
-
return `${mediaQuery} {
|
|
900
|
-
${cssClass}
|
|
901
|
-
}`;
|
|
902
|
-
} else {
|
|
903
|
-
return cssClass;
|
|
904
|
-
}
|
|
905
|
-
};
|
|
906
|
-
|
|
907
978
|
// src/components/inlined-styles.tsx
|
|
908
979
|
function InlinedStyles(props) {
|
|
909
980
|
return <style innerHTML={props.styles} id={props.id} />;
|
|
@@ -912,7 +983,7 @@ var Inlined_styles_default = InlinedStyles;
|
|
|
912
983
|
|
|
913
984
|
// src/components/block/components/block-styles.tsx
|
|
914
985
|
function BlockStyles(props) {
|
|
915
|
-
|
|
986
|
+
const canShowBlock = createMemo(() => {
|
|
916
987
|
const processedBlock = getProcessedBlock({
|
|
917
988
|
block: props.block,
|
|
918
989
|
localState: props.context.localState,
|
|
@@ -928,8 +999,8 @@ function BlockStyles(props) {
|
|
|
928
999
|
return processedBlock.show;
|
|
929
1000
|
}
|
|
930
1001
|
return true;
|
|
931
|
-
}
|
|
932
|
-
|
|
1002
|
+
});
|
|
1003
|
+
const css5 = createMemo(() => {
|
|
933
1004
|
const processedBlock = getProcessedBlock({
|
|
934
1005
|
block: props.block,
|
|
935
1006
|
localState: props.context.localState,
|
|
@@ -971,7 +1042,7 @@ function BlockStyles(props) {
|
|
|
971
1042
|
)
|
|
972
1043
|
}) : "";
|
|
973
1044
|
return [largeStylesClass, mediumStylesClass, smallStylesClass].join(" ");
|
|
974
|
-
}
|
|
1045
|
+
});
|
|
975
1046
|
return <Show2 when={TARGET !== "reactNative" && css5() && canShowBlock()}><Inlined_styles_default styles={css5()} /></Show2>;
|
|
976
1047
|
}
|
|
977
1048
|
var Block_styles_default = BlockStyles;
|
|
@@ -990,7 +1061,8 @@ var createEventHandler = (value, options) => (event) => evaluate({
|
|
|
990
1061
|
rootState: options.rootState,
|
|
991
1062
|
rootSetState: options.rootSetState,
|
|
992
1063
|
event,
|
|
993
|
-
isExpression: false
|
|
1064
|
+
isExpression: false,
|
|
1065
|
+
enableCache: true
|
|
994
1066
|
});
|
|
995
1067
|
|
|
996
1068
|
// src/functions/get-block-actions.ts
|
|
@@ -1018,38 +1090,6 @@ function getBlockActions(options) {
|
|
|
1018
1090
|
return obj;
|
|
1019
1091
|
}
|
|
1020
1092
|
|
|
1021
|
-
// src/functions/transform-style-property.ts
|
|
1022
|
-
function transformStyleProperty({
|
|
1023
|
-
style
|
|
1024
|
-
}) {
|
|
1025
|
-
return style;
|
|
1026
|
-
}
|
|
1027
|
-
|
|
1028
|
-
// src/functions/get-style.ts
|
|
1029
|
-
var getStyle = ({
|
|
1030
|
-
block,
|
|
1031
|
-
context
|
|
1032
|
-
}) => {
|
|
1033
|
-
return mapStyleObjToStrIfNeeded(transformStyleProperty({
|
|
1034
|
-
style: block.style || {},
|
|
1035
|
-
context,
|
|
1036
|
-
block
|
|
1037
|
-
}));
|
|
1038
|
-
};
|
|
1039
|
-
function mapStyleObjToStrIfNeeded(style) {
|
|
1040
|
-
switch (TARGET) {
|
|
1041
|
-
case "svelte":
|
|
1042
|
-
case "vue":
|
|
1043
|
-
case "solid":
|
|
1044
|
-
return convertStyleMapToCSSArray(style).join(" ");
|
|
1045
|
-
case "qwik":
|
|
1046
|
-
case "reactNative":
|
|
1047
|
-
case "react":
|
|
1048
|
-
case "rsc":
|
|
1049
|
-
return style;
|
|
1050
|
-
}
|
|
1051
|
-
}
|
|
1052
|
-
|
|
1053
1093
|
// src/functions/transform-block-properties.ts
|
|
1054
1094
|
function transformBlockProperties({
|
|
1055
1095
|
properties
|
|
@@ -1209,21 +1249,20 @@ var Repeated_block_default = RepeatedBlock;
|
|
|
1209
1249
|
|
|
1210
1250
|
// src/components/block/block.tsx
|
|
1211
1251
|
function Block(props) {
|
|
1212
|
-
const
|
|
1213
|
-
function blockComponent() {
|
|
1252
|
+
const blockComponent = createMemo4(() => {
|
|
1214
1253
|
return getComponent({
|
|
1215
1254
|
block: props.block,
|
|
1216
1255
|
context: props.context,
|
|
1217
1256
|
registeredComponents: props.registeredComponents
|
|
1218
1257
|
});
|
|
1219
|
-
}
|
|
1220
|
-
|
|
1258
|
+
});
|
|
1259
|
+
const repeatItem = createMemo4(() => {
|
|
1221
1260
|
return getRepeatItemData({
|
|
1222
1261
|
block: props.block,
|
|
1223
1262
|
context: props.context
|
|
1224
1263
|
});
|
|
1225
|
-
}
|
|
1226
|
-
|
|
1264
|
+
});
|
|
1265
|
+
const processedBlock = createMemo4(() => {
|
|
1227
1266
|
return props.block.repeat?.collection ? props.block : getProcessedBlock({
|
|
1228
1267
|
block: props.block,
|
|
1229
1268
|
localState: props.context.localState,
|
|
@@ -1232,15 +1271,15 @@ function Block(props) {
|
|
|
1232
1271
|
context: props.context.context,
|
|
1233
1272
|
shouldEvaluateBindings: true
|
|
1234
1273
|
});
|
|
1235
|
-
}
|
|
1236
|
-
|
|
1274
|
+
});
|
|
1275
|
+
const Tag = createMemo4(() => {
|
|
1237
1276
|
const shouldUseLink = props.block.tagName === "a" || processedBlock().properties?.href || processedBlock().href;
|
|
1238
1277
|
if (shouldUseLink) {
|
|
1239
1278
|
return props.linkComponent || "a";
|
|
1240
1279
|
}
|
|
1241
1280
|
return props.block.tagName || "div";
|
|
1242
|
-
}
|
|
1243
|
-
|
|
1281
|
+
});
|
|
1282
|
+
const canShowBlock = createMemo4(() => {
|
|
1244
1283
|
if (props.block.repeat?.collection) {
|
|
1245
1284
|
if (repeatItem()?.length)
|
|
1246
1285
|
return true;
|
|
@@ -1249,12 +1288,12 @@ function Block(props) {
|
|
|
1249
1288
|
const shouldHide = "hide" in processedBlock() ? processedBlock().hide : false;
|
|
1250
1289
|
const shouldShow = "show" in processedBlock() ? processedBlock().show : true;
|
|
1251
1290
|
return shouldShow && !shouldHide;
|
|
1252
|
-
}
|
|
1253
|
-
|
|
1291
|
+
});
|
|
1292
|
+
const childrenWithoutParentComponent = createMemo4(() => {
|
|
1254
1293
|
const shouldRenderChildrenOutsideRef = !blockComponent()?.component && !repeatItem();
|
|
1255
1294
|
return shouldRenderChildrenOutsideRef ? processedBlock().children ?? [] : [];
|
|
1256
|
-
}
|
|
1257
|
-
|
|
1295
|
+
});
|
|
1296
|
+
const componentRefProps = createMemo4(() => {
|
|
1258
1297
|
return {
|
|
1259
1298
|
blockChildren: processedBlock().children ?? [],
|
|
1260
1299
|
componentRef: blockComponent()?.component,
|
|
@@ -1268,14 +1307,14 @@ function Block(props) {
|
|
|
1268
1307
|
builderComponents: props.registeredComponents
|
|
1269
1308
|
} : {}
|
|
1270
1309
|
},
|
|
1271
|
-
context:
|
|
1310
|
+
context: props.context,
|
|
1272
1311
|
linkComponent: props.linkComponent,
|
|
1273
1312
|
registeredComponents: props.registeredComponents,
|
|
1274
1313
|
builderBlock: processedBlock(),
|
|
1275
1314
|
includeBlockProps: blockComponent()?.noWrap === true,
|
|
1276
1315
|
isInteractive: !blockComponent()?.isRSC
|
|
1277
1316
|
};
|
|
1278
|
-
}
|
|
1317
|
+
});
|
|
1279
1318
|
onMount(() => {
|
|
1280
1319
|
const blockId = processedBlock().id;
|
|
1281
1320
|
const animations = processedBlock().animations;
|
|
@@ -1337,9 +1376,9 @@ function Block(props) {
|
|
|
1337
1376
|
return <Block
|
|
1338
1377
|
key={child.id}
|
|
1339
1378
|
block={child}
|
|
1340
|
-
context={childrenContext()}
|
|
1341
1379
|
registeredComponents={props.registeredComponents}
|
|
1342
1380
|
linkComponent={props.linkComponent}
|
|
1381
|
+
context={props.context}
|
|
1343
1382
|
/>;
|
|
1344
1383
|
}}</For2>
|
|
1345
1384
|
</Block_wrapper_default></Show4></Show4>
|
|
@@ -1348,12 +1387,13 @@ function Block(props) {
|
|
|
1348
1387
|
var Block_default = Block;
|
|
1349
1388
|
|
|
1350
1389
|
// src/components/blocks/blocks-wrapper.tsx
|
|
1390
|
+
import { createMemo as createMemo5 } from "solid-js";
|
|
1351
1391
|
import { Dynamic as Dynamic4 } from "solid-js/web";
|
|
1352
1392
|
import { css } from "solid-styled-components";
|
|
1353
1393
|
function BlocksWrapper(props) {
|
|
1354
|
-
|
|
1394
|
+
const className = createMemo5(() => {
|
|
1355
1395
|
return "builder-blocks" + (!props.blocks?.length ? " no-blocks" : "");
|
|
1356
|
-
}
|
|
1396
|
+
});
|
|
1357
1397
|
function onClick() {
|
|
1358
1398
|
if (isEditing() && !props.blocks?.length) {
|
|
1359
1399
|
window.parent?.postMessage(
|
|
@@ -1427,12 +1467,12 @@ var Blocks_default = Blocks;
|
|
|
1427
1467
|
|
|
1428
1468
|
// src/blocks/columns/columns.tsx
|
|
1429
1469
|
function Columns(props) {
|
|
1430
|
-
const [gutterSize, setGutterSize] =
|
|
1470
|
+
const [gutterSize, setGutterSize] = createSignal6(
|
|
1431
1471
|
typeof props.space === "number" ? props.space || 0 : 20
|
|
1432
1472
|
);
|
|
1433
|
-
const [cols, setCols] =
|
|
1434
|
-
const [stackAt, setStackAt] =
|
|
1435
|
-
const [flexDir, setFlexDir] =
|
|
1473
|
+
const [cols, setCols] = createSignal6(props.columns || []);
|
|
1474
|
+
const [stackAt, setStackAt] = createSignal6(props.stackColumnsAt || "tablet");
|
|
1475
|
+
const [flexDir, setFlexDir] = createSignal6(
|
|
1436
1476
|
props.stackColumnsAt === "never" ? "row" : props.reverseColumnsWhenStacked ? "column-reverse" : "column"
|
|
1437
1477
|
);
|
|
1438
1478
|
function getWidth(index) {
|
|
@@ -1454,7 +1494,7 @@ function Columns(props) {
|
|
|
1454
1494
|
}) {
|
|
1455
1495
|
return stackAt() === "never" ? desktopStyle : stackedStyle;
|
|
1456
1496
|
}
|
|
1457
|
-
|
|
1497
|
+
const columnsCssVars = createMemo6(() => {
|
|
1458
1498
|
return {
|
|
1459
1499
|
"--flex-dir": flexDir(),
|
|
1460
1500
|
"--flex-dir-tablet": getTabletStyle({
|
|
@@ -1462,7 +1502,7 @@ function Columns(props) {
|
|
|
1462
1502
|
desktopStyle: "row"
|
|
1463
1503
|
})
|
|
1464
1504
|
};
|
|
1465
|
-
}
|
|
1505
|
+
});
|
|
1466
1506
|
function columnCssVars(index) {
|
|
1467
1507
|
const gutter = index === 0 ? 0 : gutterSize();
|
|
1468
1508
|
const width = getColumnCssWidth(index);
|
|
@@ -1503,7 +1543,7 @@ function Columns(props) {
|
|
|
1503
1543
|
);
|
|
1504
1544
|
return breakpointSizes[size].max;
|
|
1505
1545
|
}
|
|
1506
|
-
|
|
1546
|
+
const columnsStyles = createMemo6(() => {
|
|
1507
1547
|
return `
|
|
1508
1548
|
@media (max-width: ${getWidthForBreakpointSize("medium")}px) {
|
|
1509
1549
|
.${props.builderBlock.id}-breakpoints {
|
|
@@ -1529,7 +1569,7 @@ function Columns(props) {
|
|
|
1529
1569
|
}
|
|
1530
1570
|
},
|
|
1531
1571
|
`;
|
|
1532
|
-
}
|
|
1572
|
+
});
|
|
1533
1573
|
return <div
|
|
1534
1574
|
class={`builder-columns ${props.builderBlock.id}-breakpoints ` + css2({
|
|
1535
1575
|
display: "flex",
|
|
@@ -1576,7 +1616,7 @@ function FragmentComponent(props) {
|
|
|
1576
1616
|
var fragment_default = FragmentComponent;
|
|
1577
1617
|
|
|
1578
1618
|
// src/blocks/image/image.tsx
|
|
1579
|
-
import { Show as Show7 } from "solid-js";
|
|
1619
|
+
import { Show as Show7, createMemo as createMemo7 } from "solid-js";
|
|
1580
1620
|
import { css as css3 } from "solid-styled-components";
|
|
1581
1621
|
|
|
1582
1622
|
// src/blocks/image/image.helpers.ts
|
|
@@ -1628,7 +1668,7 @@ function getSrcSet(url) {
|
|
|
1628
1668
|
|
|
1629
1669
|
// src/blocks/image/image.tsx
|
|
1630
1670
|
function Image(props) {
|
|
1631
|
-
|
|
1671
|
+
const srcSetToUse = createMemo7(() => {
|
|
1632
1672
|
const imageToUse = props.image || props.src;
|
|
1633
1673
|
const url = imageToUse;
|
|
1634
1674
|
if (!url || // We can auto add srcset for cdn.builder.io and shopify
|
|
@@ -1644,15 +1684,15 @@ function Image(props) {
|
|
|
1644
1684
|
return getSrcSet(url);
|
|
1645
1685
|
}
|
|
1646
1686
|
return getSrcSet(url);
|
|
1647
|
-
}
|
|
1648
|
-
|
|
1687
|
+
});
|
|
1688
|
+
const webpSrcSet = createMemo7(() => {
|
|
1649
1689
|
if (srcSetToUse()?.match(/builder\.io/) && !props.noWebp) {
|
|
1650
1690
|
return srcSetToUse().replace(/\?/g, "?format=webp&");
|
|
1651
1691
|
} else {
|
|
1652
1692
|
return "";
|
|
1653
1693
|
}
|
|
1654
|
-
}
|
|
1655
|
-
|
|
1694
|
+
});
|
|
1695
|
+
const aspectRatioCss = createMemo7(() => {
|
|
1656
1696
|
const aspectRatioStyles = {
|
|
1657
1697
|
position: "absolute",
|
|
1658
1698
|
height: "100%",
|
|
@@ -1662,7 +1702,7 @@ function Image(props) {
|
|
|
1662
1702
|
};
|
|
1663
1703
|
const out = props.aspectRatio ? aspectRatioStyles : void 0;
|
|
1664
1704
|
return out;
|
|
1665
|
-
}
|
|
1705
|
+
});
|
|
1666
1706
|
return <>
|
|
1667
1707
|
<picture>
|
|
1668
1708
|
<Show7 when={webpSrcSet()}><source type="image/webp" srcset={webpSrcSet()} /></Show7>
|
|
@@ -1735,10 +1775,10 @@ function SectionComponent(props) {
|
|
|
1735
1775
|
var section_default = SectionComponent;
|
|
1736
1776
|
|
|
1737
1777
|
// src/blocks/symbol/symbol.tsx
|
|
1738
|
-
import { onMount as onMount5, on as on3, createEffect as createEffect3, createSignal as
|
|
1778
|
+
import { onMount as onMount5, on as on3, createEffect as createEffect3, createMemo as createMemo16, createSignal as createSignal16 } from "solid-js";
|
|
1739
1779
|
|
|
1740
1780
|
// src/components/content-variants/content-variants.tsx
|
|
1741
|
-
import { Show as Show12, For as For7, onMount as onMount4, createSignal as
|
|
1781
|
+
import { Show as Show12, For as For7, onMount as onMount4, createSignal as createSignal15, createMemo as createMemo15 } from "solid-js";
|
|
1742
1782
|
|
|
1743
1783
|
// src/helpers/url.ts
|
|
1744
1784
|
var getTopLevelDomain = (host) => {
|
|
@@ -1932,7 +1972,7 @@ var handleABTesting = async ({
|
|
|
1932
1972
|
var getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : true;
|
|
1933
1973
|
|
|
1934
1974
|
// src/components/content/content.tsx
|
|
1935
|
-
import { Show as Show11, createSignal as
|
|
1975
|
+
import { Show as Show11, createSignal as createSignal14 } from "solid-js";
|
|
1936
1976
|
|
|
1937
1977
|
// src/blocks/button/component-info.ts
|
|
1938
1978
|
var componentInfo = {
|
|
@@ -2492,10 +2532,10 @@ var componentInfo9 = {
|
|
|
2492
2532
|
};
|
|
2493
2533
|
|
|
2494
2534
|
// src/blocks/custom-code/custom-code.tsx
|
|
2495
|
-
import { onMount as onMount2, createSignal as
|
|
2535
|
+
import { onMount as onMount2, createSignal as createSignal8 } from "solid-js";
|
|
2496
2536
|
function CustomCode(props) {
|
|
2497
|
-
const [scriptsInserted, setScriptsInserted] =
|
|
2498
|
-
const [scriptsRun, setScriptsRun] =
|
|
2537
|
+
const [scriptsInserted, setScriptsInserted] = createSignal8([]);
|
|
2538
|
+
const [scriptsRun, setScriptsRun] = createSignal8([]);
|
|
2499
2539
|
let elementRef;
|
|
2500
2540
|
onMount2(() => {
|
|
2501
2541
|
if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
|
|
@@ -2576,7 +2616,7 @@ var componentInfo10 = {
|
|
|
2576
2616
|
};
|
|
2577
2617
|
|
|
2578
2618
|
// src/blocks/embed/embed.tsx
|
|
2579
|
-
import { on, createEffect, createSignal as
|
|
2619
|
+
import { on, createEffect, createMemo as createMemo9, createSignal as createSignal9 } from "solid-js";
|
|
2580
2620
|
|
|
2581
2621
|
// src/blocks/embed/helpers.ts
|
|
2582
2622
|
var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"];
|
|
@@ -2584,9 +2624,9 @@ var isJsScript = (script) => SCRIPT_MIME_TYPES.includes(script.type);
|
|
|
2584
2624
|
|
|
2585
2625
|
// src/blocks/embed/embed.tsx
|
|
2586
2626
|
function Embed(props) {
|
|
2587
|
-
const [scriptsInserted, setScriptsInserted] =
|
|
2588
|
-
const [scriptsRun, setScriptsRun] =
|
|
2589
|
-
const [ranInitFn, setRanInitFn] =
|
|
2627
|
+
const [scriptsInserted, setScriptsInserted] = createSignal9([]);
|
|
2628
|
+
const [scriptsRun, setScriptsRun] = createSignal9([]);
|
|
2629
|
+
const [ranInitFn, setRanInitFn] = createSignal9(false);
|
|
2590
2630
|
function findAndRunScripts() {
|
|
2591
2631
|
if (!elem || !elem.getElementsByTagName)
|
|
2592
2632
|
return;
|
|
@@ -2609,13 +2649,17 @@ function Embed(props) {
|
|
|
2609
2649
|
}
|
|
2610
2650
|
}
|
|
2611
2651
|
let elem;
|
|
2652
|
+
const onUpdateFn_0_elem = createMemo9(() => elem);
|
|
2653
|
+
const onUpdateFn_0_ranInitFn__ = createMemo9(() => ranInitFn());
|
|
2612
2654
|
function onUpdateFn_0() {
|
|
2613
2655
|
if (elem && !ranInitFn()) {
|
|
2614
2656
|
setRanInitFn(true);
|
|
2615
2657
|
findAndRunScripts();
|
|
2616
2658
|
}
|
|
2617
2659
|
}
|
|
2618
|
-
createEffect(
|
|
2660
|
+
createEffect(
|
|
2661
|
+
on(() => [onUpdateFn_0_elem(), onUpdateFn_0_ranInitFn__()], onUpdateFn_0)
|
|
2662
|
+
);
|
|
2619
2663
|
return <div class="builder-embed" ref={elem} innerHTML={props.content} />;
|
|
2620
2664
|
}
|
|
2621
2665
|
var embed_default = Embed;
|
|
@@ -2855,7 +2899,7 @@ var componentInfo11 = {
|
|
|
2855
2899
|
};
|
|
2856
2900
|
|
|
2857
2901
|
// src/blocks/form/form/form.tsx
|
|
2858
|
-
import { Show as Show8, For as For5, createSignal as
|
|
2902
|
+
import { Show as Show8, For as For5, createSignal as createSignal10 } from "solid-js";
|
|
2859
2903
|
import { css as css4 } from "solid-styled-components";
|
|
2860
2904
|
|
|
2861
2905
|
// src/functions/get-env.ts
|
|
@@ -2873,9 +2917,9 @@ var get = (obj, path, defaultValue) => {
|
|
|
2873
2917
|
|
|
2874
2918
|
// src/blocks/form/form/form.tsx
|
|
2875
2919
|
function FormComponent(props) {
|
|
2876
|
-
const [formState, setFormState] =
|
|
2877
|
-
const [responseData, setResponseData] =
|
|
2878
|
-
const [formErrorMessage, setFormErrorMessage] =
|
|
2920
|
+
const [formState, setFormState] = createSignal10("unsubmitted");
|
|
2921
|
+
const [responseData, setResponseData] = createSignal10(null);
|
|
2922
|
+
const [formErrorMessage, setFormErrorMessage] = createSignal10("");
|
|
2879
2923
|
function mergeNewRootState(newData) {
|
|
2880
2924
|
const combinedState = {
|
|
2881
2925
|
...props.builderContext.rootState,
|
|
@@ -3391,9 +3435,9 @@ var componentInfo16 = {
|
|
|
3391
3435
|
};
|
|
3392
3436
|
|
|
3393
3437
|
// src/blocks/video/video.tsx
|
|
3394
|
-
import { Show as Show9 } from "solid-js";
|
|
3438
|
+
import { Show as Show9, createMemo as createMemo11 } from "solid-js";
|
|
3395
3439
|
function Video(props) {
|
|
3396
|
-
|
|
3440
|
+
const videoProps = createMemo11(() => {
|
|
3397
3441
|
return {
|
|
3398
3442
|
...props.autoPlay === true ? {
|
|
3399
3443
|
autoPlay: true
|
|
@@ -3411,12 +3455,12 @@ function Video(props) {
|
|
|
3411
3455
|
playsInline: true
|
|
3412
3456
|
} : {}
|
|
3413
3457
|
};
|
|
3414
|
-
}
|
|
3415
|
-
|
|
3458
|
+
});
|
|
3459
|
+
const spreadProps = createMemo11(() => {
|
|
3416
3460
|
return {
|
|
3417
3461
|
...videoProps()
|
|
3418
3462
|
};
|
|
3419
|
-
}
|
|
3463
|
+
});
|
|
3420
3464
|
return <div
|
|
3421
3465
|
style={{
|
|
3422
3466
|
position: "relative"
|
|
@@ -3606,7 +3650,14 @@ function InlinedScript(props) {
|
|
|
3606
3650
|
var Inlined_script_default = InlinedScript;
|
|
3607
3651
|
|
|
3608
3652
|
// src/components/content/components/enable-editor.tsx
|
|
3609
|
-
import {
|
|
3653
|
+
import {
|
|
3654
|
+
Show as Show10,
|
|
3655
|
+
onMount as onMount3,
|
|
3656
|
+
on as on2,
|
|
3657
|
+
createEffect as createEffect2,
|
|
3658
|
+
createMemo as createMemo12,
|
|
3659
|
+
createSignal as createSignal12
|
|
3660
|
+
} from "solid-js";
|
|
3610
3661
|
import { Dynamic as Dynamic5 } from "solid-js/web";
|
|
3611
3662
|
|
|
3612
3663
|
// src/helpers/preview-lru-cache/get.ts
|
|
@@ -4089,7 +4140,7 @@ function isFromTrustedHost(trustedHosts, e) {
|
|
|
4089
4140
|
}
|
|
4090
4141
|
|
|
4091
4142
|
// src/constants/sdk-version.ts
|
|
4092
|
-
var SDK_VERSION = "0.
|
|
4143
|
+
var SDK_VERSION = "1.0.13";
|
|
4093
4144
|
|
|
4094
4145
|
// src/functions/register.ts
|
|
4095
4146
|
var registry = {};
|
|
@@ -4287,15 +4338,15 @@ var subscribeToEditor = (model, callback, options) => {
|
|
|
4287
4338
|
|
|
4288
4339
|
// src/components/content/components/enable-editor.tsx
|
|
4289
4340
|
function EnableEditor(props) {
|
|
4290
|
-
const [forceReRenderCount, setForceReRenderCount] =
|
|
4291
|
-
const [firstRender, setFirstRender] =
|
|
4292
|
-
const [lastUpdated, setLastUpdated] =
|
|
4293
|
-
const [shouldSendResetCookie, setShouldSendResetCookie] =
|
|
4294
|
-
const [ContentWrapper, setContentWrapper] =
|
|
4341
|
+
const [forceReRenderCount, setForceReRenderCount] = createSignal12(0);
|
|
4342
|
+
const [firstRender, setFirstRender] = createSignal12(true);
|
|
4343
|
+
const [lastUpdated, setLastUpdated] = createSignal12(0);
|
|
4344
|
+
const [shouldSendResetCookie, setShouldSendResetCookie] = createSignal12(false);
|
|
4345
|
+
const [ContentWrapper, setContentWrapper] = createSignal12(
|
|
4295
4346
|
props.contentWrapper || "div"
|
|
4296
4347
|
);
|
|
4297
|
-
const [httpReqsData, setHttpReqsData] =
|
|
4298
|
-
const [clicked, setClicked] =
|
|
4348
|
+
const [httpReqsData, setHttpReqsData] = createSignal12({});
|
|
4349
|
+
const [clicked, setClicked] = createSignal12(false);
|
|
4299
4350
|
function mergeNewRootState(newData) {
|
|
4300
4351
|
const combinedState = {
|
|
4301
4352
|
...props.builderContextSignal.rootState,
|
|
@@ -4366,7 +4417,11 @@ function EnableEditor(props) {
|
|
|
4366
4417
|
context: props.context || {},
|
|
4367
4418
|
localState: void 0,
|
|
4368
4419
|
rootState: props.builderContextSignal.rootState,
|
|
4369
|
-
rootSetState: props.builderContextSignal.rootSetState
|
|
4420
|
+
rootSetState: props.builderContextSignal.rootSetState,
|
|
4421
|
+
/**
|
|
4422
|
+
* We don't want to cache the result of the JS code, since it's arbitrary side effect code.
|
|
4423
|
+
*/
|
|
4424
|
+
enableCache: false
|
|
4370
4425
|
});
|
|
4371
4426
|
}
|
|
4372
4427
|
}
|
|
@@ -4391,13 +4446,16 @@ function EnableEditor(props) {
|
|
|
4391
4446
|
function evalExpression(expression) {
|
|
4392
4447
|
return expression.replace(
|
|
4393
4448
|
/{{([^}]+)}}/g,
|
|
4394
|
-
(_match, group) =>
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4449
|
+
(_match, group) => String(
|
|
4450
|
+
evaluate({
|
|
4451
|
+
code: group,
|
|
4452
|
+
context: props.context || {},
|
|
4453
|
+
localState: void 0,
|
|
4454
|
+
rootState: props.builderContextSignal.rootState,
|
|
4455
|
+
rootSetState: props.builderContextSignal.rootSetState,
|
|
4456
|
+
enableCache: true
|
|
4457
|
+
})
|
|
4458
|
+
)
|
|
4401
4459
|
);
|
|
4402
4460
|
}
|
|
4403
4461
|
function handleRequest({ url, key }) {
|
|
@@ -4513,40 +4571,63 @@ function EnableEditor(props) {
|
|
|
4513
4571
|
runHttpRequests();
|
|
4514
4572
|
emitStateUpdate();
|
|
4515
4573
|
});
|
|
4574
|
+
const onUpdateFn_0_props_content = createMemo12(() => props.content);
|
|
4516
4575
|
function onUpdateFn_0() {
|
|
4517
4576
|
if (props.content) {
|
|
4518
4577
|
mergeNewContent(props.content);
|
|
4519
4578
|
}
|
|
4520
4579
|
}
|
|
4521
|
-
createEffect2(on2(() => [
|
|
4580
|
+
createEffect2(on2(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
|
|
4581
|
+
const onUpdateFn_1_shouldSendResetCookie__ = createMemo12(
|
|
4582
|
+
() => shouldSendResetCookie()
|
|
4583
|
+
);
|
|
4522
4584
|
function onUpdateFn_1() {
|
|
4523
4585
|
}
|
|
4524
|
-
createEffect2(
|
|
4586
|
+
createEffect2(
|
|
4587
|
+
on2(() => [onUpdateFn_1_shouldSendResetCookie__()], onUpdateFn_1)
|
|
4588
|
+
);
|
|
4589
|
+
const onUpdateFn_2_props_builderContextSignal_content__data__jsCode = createMemo12(() => props.builderContextSignal.content?.data?.jsCode);
|
|
4525
4590
|
function onUpdateFn_2() {
|
|
4526
4591
|
evaluateJsCode();
|
|
4527
4592
|
}
|
|
4528
4593
|
createEffect2(
|
|
4529
|
-
on2(
|
|
4594
|
+
on2(
|
|
4595
|
+
() => [onUpdateFn_2_props_builderContextSignal_content__data__jsCode()],
|
|
4596
|
+
onUpdateFn_2
|
|
4597
|
+
)
|
|
4530
4598
|
);
|
|
4599
|
+
const onUpdateFn_3_props_builderContextSignal_content__data__httpRequests = createMemo12(() => props.builderContextSignal.content?.data?.httpRequests);
|
|
4531
4600
|
function onUpdateFn_3() {
|
|
4532
4601
|
runHttpRequests();
|
|
4533
4602
|
}
|
|
4534
4603
|
createEffect2(
|
|
4535
4604
|
on2(
|
|
4536
|
-
() => [
|
|
4605
|
+
() => [
|
|
4606
|
+
onUpdateFn_3_props_builderContextSignal_content__data__httpRequests()
|
|
4607
|
+
],
|
|
4537
4608
|
onUpdateFn_3
|
|
4538
4609
|
)
|
|
4539
4610
|
);
|
|
4611
|
+
const onUpdateFn_4_props_builderContextSignal_rootState = createMemo12(
|
|
4612
|
+
() => props.builderContextSignal.rootState
|
|
4613
|
+
);
|
|
4540
4614
|
function onUpdateFn_4() {
|
|
4541
4615
|
emitStateUpdate();
|
|
4542
4616
|
}
|
|
4543
|
-
createEffect2(
|
|
4617
|
+
createEffect2(
|
|
4618
|
+
on2(
|
|
4619
|
+
() => [onUpdateFn_4_props_builderContextSignal_rootState()],
|
|
4620
|
+
onUpdateFn_4
|
|
4621
|
+
)
|
|
4622
|
+
);
|
|
4623
|
+
const onUpdateFn_5_props_data = createMemo12(() => props.data);
|
|
4544
4624
|
function onUpdateFn_5() {
|
|
4545
4625
|
if (props.data) {
|
|
4546
4626
|
mergeNewRootState(props.data);
|
|
4547
4627
|
}
|
|
4548
4628
|
}
|
|
4549
|
-
createEffect2(on2(() => [
|
|
4629
|
+
createEffect2(on2(() => [onUpdateFn_5_props_data()], onUpdateFn_5));
|
|
4630
|
+
const onUpdateFn_6_props_locale = createMemo12(() => props.locale);
|
|
4550
4631
|
function onUpdateFn_6() {
|
|
4551
4632
|
if (props.locale) {
|
|
4552
4633
|
mergeNewRootState({
|
|
@@ -4554,7 +4635,7 @@ function EnableEditor(props) {
|
|
|
4554
4635
|
});
|
|
4555
4636
|
}
|
|
4556
4637
|
}
|
|
4557
|
-
createEffect2(on2(() => [
|
|
4638
|
+
createEffect2(on2(() => [onUpdateFn_6_props_locale()], onUpdateFn_6));
|
|
4558
4639
|
return <builder_context_default.Provider value={props.builderContextSignal}><Show10 when={props.builderContextSignal.content}><Dynamic5
|
|
4559
4640
|
class={`variant-${props.content?.testVariationId || props.content?.id}`}
|
|
4560
4641
|
{...{}}
|
|
@@ -4575,7 +4656,7 @@ function EnableEditor(props) {
|
|
|
4575
4656
|
var Enable_editor_default = EnableEditor;
|
|
4576
4657
|
|
|
4577
4658
|
// src/components/content/components/styles.tsx
|
|
4578
|
-
import { createSignal as
|
|
4659
|
+
import { createSignal as createSignal13 } from "solid-js";
|
|
4579
4660
|
|
|
4580
4661
|
// src/components/content/components/styles.helpers.ts
|
|
4581
4662
|
var getCssFromFont = (font) => {
|
|
@@ -4631,19 +4712,7 @@ var getCss = ({
|
|
|
4631
4712
|
}
|
|
4632
4713
|
return cssCode?.replace(/&/g, `div[builder-content-id="${contentId}"]`) || "";
|
|
4633
4714
|
};
|
|
4634
|
-
|
|
4635
|
-
// src/components/content/components/styles.tsx
|
|
4636
|
-
function ContentStyles(props) {
|
|
4637
|
-
const [injectedStyles, setInjectedStyles] = createSignal12(
|
|
4638
|
-
`
|
|
4639
|
-
${getCss({
|
|
4640
|
-
cssCode: props.cssCode,
|
|
4641
|
-
contentId: props.contentId
|
|
4642
|
-
})}
|
|
4643
|
-
${getFontCss({
|
|
4644
|
-
customFonts: props.customFonts
|
|
4645
|
-
})}
|
|
4646
|
-
|
|
4715
|
+
var DEFAULT_STYLES = `
|
|
4647
4716
|
.builder-button {
|
|
4648
4717
|
all: unset;
|
|
4649
4718
|
}
|
|
@@ -4660,6 +4729,23 @@ ${getFontCss({
|
|
|
4660
4729
|
text-align: inherit;
|
|
4661
4730
|
font-family: inherit;
|
|
4662
4731
|
}
|
|
4732
|
+
`;
|
|
4733
|
+
var getDefaultStyles = (isNested) => {
|
|
4734
|
+
return !isNested ? DEFAULT_STYLES : "";
|
|
4735
|
+
};
|
|
4736
|
+
|
|
4737
|
+
// src/components/content/components/styles.tsx
|
|
4738
|
+
function ContentStyles(props) {
|
|
4739
|
+
const [injectedStyles, setInjectedStyles] = createSignal13(
|
|
4740
|
+
`
|
|
4741
|
+
${getCss({
|
|
4742
|
+
cssCode: props.cssCode,
|
|
4743
|
+
contentId: props.contentId
|
|
4744
|
+
})}
|
|
4745
|
+
${getFontCss({
|
|
4746
|
+
customFonts: props.customFonts
|
|
4747
|
+
})}
|
|
4748
|
+
${getDefaultStyles(props.isNestedRender)}
|
|
4663
4749
|
`.trim()
|
|
4664
4750
|
);
|
|
4665
4751
|
return <Inlined_styles_default styles={injectedStyles()} />;
|
|
@@ -4704,7 +4790,7 @@ var getContentInitialValue = ({
|
|
|
4704
4790
|
|
|
4705
4791
|
// src/components/content/content.tsx
|
|
4706
4792
|
function ContentComponent(props) {
|
|
4707
|
-
const [scriptStr, setScriptStr] =
|
|
4793
|
+
const [scriptStr, setScriptStr] = createSignal14(
|
|
4708
4794
|
getUpdateVariantVisibilityScript({
|
|
4709
4795
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
4710
4796
|
variationId: props.content?.testVariationId,
|
|
@@ -4712,7 +4798,7 @@ function ContentComponent(props) {
|
|
|
4712
4798
|
contentId: props.content?.id
|
|
4713
4799
|
})
|
|
4714
4800
|
);
|
|
4715
|
-
const [registeredComponents, setRegisteredComponents] =
|
|
4801
|
+
const [registeredComponents, setRegisteredComponents] = createSignal14(
|
|
4716
4802
|
[
|
|
4717
4803
|
...getDefaultRegisteredComponents(),
|
|
4718
4804
|
...props.customComponents || []
|
|
@@ -4727,7 +4813,7 @@ function ContentComponent(props) {
|
|
|
4727
4813
|
{}
|
|
4728
4814
|
)
|
|
4729
4815
|
);
|
|
4730
|
-
const [builderContextSignal, setBuilderContextSignal] =
|
|
4816
|
+
const [builderContextSignal, setBuilderContextSignal] = createSignal14({
|
|
4731
4817
|
content: getContentInitialValue({
|
|
4732
4818
|
content: props.content,
|
|
4733
4819
|
data: props.data
|
|
@@ -4787,6 +4873,7 @@ function ContentComponent(props) {
|
|
|
4787
4873
|
>
|
|
4788
4874
|
<Show11 when={props.isSsrAbTest}><Inlined_script_default scriptStr={scriptStr()} /></Show11>
|
|
4789
4875
|
<Show11 when={TARGET !== "reactNative"}><Styles_default
|
|
4876
|
+
isNestedRender={props.isNestedRender}
|
|
4790
4877
|
contentId={builderContextSignal().content?.id}
|
|
4791
4878
|
cssCode={builderContextSignal().content?.data?.cssCode}
|
|
4792
4879
|
customFonts={builderContextSignal().content?.data?.customFonts}
|
|
@@ -4803,13 +4890,13 @@ var Content_default = ContentComponent;
|
|
|
4803
4890
|
|
|
4804
4891
|
// src/components/content-variants/content-variants.tsx
|
|
4805
4892
|
function ContentVariants(props) {
|
|
4806
|
-
const [shouldRenderVariants, setShouldRenderVariants] =
|
|
4893
|
+
const [shouldRenderVariants, setShouldRenderVariants] = createSignal15(
|
|
4807
4894
|
checkShouldRenderVariants({
|
|
4808
4895
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
4809
4896
|
content: props.content
|
|
4810
4897
|
})
|
|
4811
4898
|
);
|
|
4812
|
-
|
|
4899
|
+
const updateCookieAndStylesScriptStr = createMemo15(() => {
|
|
4813
4900
|
return getUpdateCookieAndStylesScript(
|
|
4814
4901
|
getVariants(props.content).map((value) => ({
|
|
4815
4902
|
id: value.testVariationId,
|
|
@@ -4817,11 +4904,11 @@ function ContentVariants(props) {
|
|
|
4817
4904
|
})),
|
|
4818
4905
|
props.content?.id || ""
|
|
4819
4906
|
);
|
|
4820
|
-
}
|
|
4821
|
-
|
|
4907
|
+
});
|
|
4908
|
+
const hideVariantsStyleString = createMemo15(() => {
|
|
4822
4909
|
return getVariants(props.content).map((value) => `.variant-${value.testVariationId} { display: none; } `).join("");
|
|
4823
|
-
}
|
|
4824
|
-
|
|
4910
|
+
});
|
|
4911
|
+
const defaultContent = createMemo15(() => {
|
|
4825
4912
|
return shouldRenderVariants() ? {
|
|
4826
4913
|
...props.content,
|
|
4827
4914
|
testVariationId: props.content?.id
|
|
@@ -4829,12 +4916,12 @@ function ContentVariants(props) {
|
|
|
4829
4916
|
item: props.content,
|
|
4830
4917
|
canTrack: getDefaultCanTrack(props.canTrack)
|
|
4831
4918
|
});
|
|
4832
|
-
}
|
|
4919
|
+
});
|
|
4833
4920
|
onMount4(() => {
|
|
4834
4921
|
setShouldRenderVariants(false);
|
|
4835
4922
|
});
|
|
4836
4923
|
return <>
|
|
4837
|
-
<Show12 when={!props.
|
|
4924
|
+
<Show12 when={!props.isNestedRender && TARGET !== "reactNative"}><Inlined_script_default scriptStr={getScriptString()} /></Show12>
|
|
4838
4925
|
<Show12 when={shouldRenderVariants()}>
|
|
4839
4926
|
<Inlined_styles_default
|
|
4840
4927
|
id={`variants-styles-${props.content?.id}`}
|
|
@@ -4846,6 +4933,7 @@ function ContentVariants(props) {
|
|
|
4846
4933
|
<For7 each={getVariants(props.content)}>{(variant, _index) => {
|
|
4847
4934
|
const index = _index();
|
|
4848
4935
|
return <Content_default
|
|
4936
|
+
isNestedRender={props.isNestedRender}
|
|
4849
4937
|
key={variant.testVariationId}
|
|
4850
4938
|
content={variant}
|
|
4851
4939
|
showContent={false}
|
|
@@ -4869,6 +4957,7 @@ function ContentVariants(props) {
|
|
|
4869
4957
|
}}</For7>
|
|
4870
4958
|
</Show12>
|
|
4871
4959
|
<Content_default
|
|
4960
|
+
isNestedRender={props.isNestedRender}
|
|
4872
4961
|
{...{}}
|
|
4873
4962
|
content={defaultContent()}
|
|
4874
4963
|
showContent={true}
|
|
@@ -4919,15 +5008,15 @@ var fetchSymbolContent = async ({
|
|
|
4919
5008
|
|
|
4920
5009
|
// src/blocks/symbol/symbol.tsx
|
|
4921
5010
|
function Symbol(props) {
|
|
4922
|
-
const [contentToUse, setContentToUse] =
|
|
4923
|
-
|
|
5011
|
+
const [contentToUse, setContentToUse] = createSignal16(props.symbol?.content);
|
|
5012
|
+
const className = createMemo16(() => {
|
|
4924
5013
|
return [
|
|
4925
5014
|
...[props.attributes[getClassPropName()]],
|
|
4926
5015
|
"builder-symbol",
|
|
4927
5016
|
props.symbol?.inline ? "builder-inline-symbol" : void 0,
|
|
4928
5017
|
props.symbol?.dynamic || props.dynamic ? "builder-dynamic-symbol" : void 0
|
|
4929
5018
|
].filter(Boolean).join(" ");
|
|
4930
|
-
}
|
|
5019
|
+
});
|
|
4931
5020
|
function setContent() {
|
|
4932
5021
|
if (contentToUse())
|
|
4933
5022
|
return;
|
|
@@ -4941,14 +5030,14 @@ function Symbol(props) {
|
|
|
4941
5030
|
});
|
|
4942
5031
|
}
|
|
4943
5032
|
onMount5(() => {
|
|
4944
|
-
setContent();
|
|
4945
5033
|
});
|
|
5034
|
+
const onUpdateFn_0_props_symbol = createMemo16(() => props.symbol);
|
|
4946
5035
|
function onUpdateFn_0() {
|
|
4947
5036
|
setContent();
|
|
4948
5037
|
}
|
|
4949
|
-
createEffect3(on3(() => [
|
|
5038
|
+
createEffect3(on3(() => [onUpdateFn_0_props_symbol()], onUpdateFn_0));
|
|
4950
5039
|
return <div class={className()} {...{}} {...props.attributes} {...{}}><Content_variants_default
|
|
4951
|
-
|
|
5040
|
+
isNestedRender={true}
|
|
4952
5041
|
apiVersion={props.builderContext.apiVersion}
|
|
4953
5042
|
apiKey={props.builderContext.apiKey}
|
|
4954
5043
|
context={{
|