@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/dev.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) {
|
|
@@ -268,7 +268,7 @@ function flattenState({
|
|
|
268
268
|
return localState[prop];
|
|
269
269
|
}
|
|
270
270
|
const val = target[prop];
|
|
271
|
-
if (typeof val === "object") {
|
|
271
|
+
if (typeof val === "object" && val !== null) {
|
|
272
272
|
return flattenState({
|
|
273
273
|
rootState: val,
|
|
274
274
|
localState: void 0,
|
|
@@ -460,6 +460,30 @@ var shouldForceBrowserRuntimeInNode = () => {
|
|
|
460
460
|
var chooseBrowserOrServerEval = (args) => isBrowser() || shouldForceBrowserRuntimeInNode() ? runInBrowser(args) : runInNode(args);
|
|
461
461
|
|
|
462
462
|
// src/functions/evaluate/evaluate.ts
|
|
463
|
+
var EvalCache = class _EvalCache {
|
|
464
|
+
static cacheLimit = 20;
|
|
465
|
+
static cache = /* @__PURE__ */ new Map();
|
|
466
|
+
static getCacheKey(args) {
|
|
467
|
+
return JSON.stringify({
|
|
468
|
+
...args,
|
|
469
|
+
// replace the event with a random number to break cache
|
|
470
|
+
// thats because we can't serialize the event object due to circular refs in DOM node refs.
|
|
471
|
+
event: args.event ? Math.random() : void 0
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
static getCachedValue(key) {
|
|
475
|
+
const cachedVal = _EvalCache.cache.get(key);
|
|
476
|
+
return cachedVal;
|
|
477
|
+
}
|
|
478
|
+
static setCachedValue(key, value) {
|
|
479
|
+
if (_EvalCache.cache.size > 20) {
|
|
480
|
+
_EvalCache.cache.delete(_EvalCache.cache.keys().next().value);
|
|
481
|
+
}
|
|
482
|
+
_EvalCache.cache.set(key, {
|
|
483
|
+
value
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
};
|
|
463
487
|
function evaluate({
|
|
464
488
|
code,
|
|
465
489
|
context,
|
|
@@ -467,11 +491,12 @@ function evaluate({
|
|
|
467
491
|
rootState,
|
|
468
492
|
rootSetState,
|
|
469
493
|
event,
|
|
470
|
-
isExpression = true
|
|
494
|
+
isExpression = true,
|
|
495
|
+
enableCache
|
|
471
496
|
}) {
|
|
472
497
|
if (code === "") {
|
|
473
498
|
logger.warn("Skipping evaluation of empty code block.");
|
|
474
|
-
return;
|
|
499
|
+
return void 0;
|
|
475
500
|
}
|
|
476
501
|
const args = {
|
|
477
502
|
code: parseCode(code, {
|
|
@@ -484,8 +509,20 @@ function evaluate({
|
|
|
484
509
|
rootState,
|
|
485
510
|
localState
|
|
486
511
|
};
|
|
512
|
+
if (enableCache) {
|
|
513
|
+
const cacheKey = EvalCache.getCacheKey(args);
|
|
514
|
+
const cachedValue = EvalCache.getCachedValue(cacheKey);
|
|
515
|
+
if (cachedValue) {
|
|
516
|
+
return cachedValue.value;
|
|
517
|
+
}
|
|
518
|
+
}
|
|
487
519
|
try {
|
|
488
|
-
|
|
520
|
+
const newEval = chooseBrowserOrServerEval(args);
|
|
521
|
+
if (enableCache) {
|
|
522
|
+
const cacheKey = EvalCache.getCacheKey(args);
|
|
523
|
+
EvalCache.setCachedValue(cacheKey, newEval);
|
|
524
|
+
}
|
|
525
|
+
return newEval;
|
|
489
526
|
} catch (e) {
|
|
490
527
|
logger.error("Failed code evaluation: " + e.message, {
|
|
491
528
|
code
|
|
@@ -527,7 +564,8 @@ var evaluateBindings = ({
|
|
|
527
564
|
localState,
|
|
528
565
|
rootState,
|
|
529
566
|
rootSetState,
|
|
530
|
-
context
|
|
567
|
+
context,
|
|
568
|
+
enableCache: true
|
|
531
569
|
});
|
|
532
570
|
set(copied, binding, value);
|
|
533
571
|
}
|
|
@@ -761,6 +799,70 @@ function bindScrollInViewAnimation(animation) {
|
|
|
761
799
|
});
|
|
762
800
|
}
|
|
763
801
|
|
|
802
|
+
// src/functions/camel-to-kebab-case.ts
|
|
803
|
+
var camelToKebabCase = (string) => string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
|
|
804
|
+
|
|
805
|
+
// src/helpers/css.ts
|
|
806
|
+
var convertStyleMapToCSSArray = (style) => {
|
|
807
|
+
const cssProps = Object.entries(style).map(([key, value]) => {
|
|
808
|
+
if (typeof value === "string") {
|
|
809
|
+
return `${camelToKebabCase(key)}: ${value};`;
|
|
810
|
+
} else {
|
|
811
|
+
return void 0;
|
|
812
|
+
}
|
|
813
|
+
});
|
|
814
|
+
return cssProps.filter(checkIsDefined);
|
|
815
|
+
};
|
|
816
|
+
var convertStyleMapToCSS = (style) => convertStyleMapToCSSArray(style).join("\n");
|
|
817
|
+
var createCssClass = ({
|
|
818
|
+
mediaQuery,
|
|
819
|
+
className,
|
|
820
|
+
styles
|
|
821
|
+
}) => {
|
|
822
|
+
const cssClass = `.${className} {
|
|
823
|
+
${convertStyleMapToCSS(styles)}
|
|
824
|
+
}`;
|
|
825
|
+
if (mediaQuery) {
|
|
826
|
+
return `${mediaQuery} {
|
|
827
|
+
${cssClass}
|
|
828
|
+
}`;
|
|
829
|
+
} else {
|
|
830
|
+
return cssClass;
|
|
831
|
+
}
|
|
832
|
+
};
|
|
833
|
+
|
|
834
|
+
// src/functions/transform-style-property.ts
|
|
835
|
+
function transformStyleProperty({
|
|
836
|
+
style
|
|
837
|
+
}) {
|
|
838
|
+
return style;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
// src/functions/get-style.ts
|
|
842
|
+
var getStyle = ({
|
|
843
|
+
block,
|
|
844
|
+
context
|
|
845
|
+
}) => {
|
|
846
|
+
return mapStyleObjToStrIfNeeded(transformStyleProperty({
|
|
847
|
+
style: block.style || {},
|
|
848
|
+
context,
|
|
849
|
+
block
|
|
850
|
+
}));
|
|
851
|
+
};
|
|
852
|
+
function mapStyleObjToStrIfNeeded(style) {
|
|
853
|
+
switch (TARGET) {
|
|
854
|
+
case "svelte":
|
|
855
|
+
case "vue":
|
|
856
|
+
case "solid":
|
|
857
|
+
return convertStyleMapToCSSArray(style).join(" ");
|
|
858
|
+
case "qwik":
|
|
859
|
+
case "reactNative":
|
|
860
|
+
case "react":
|
|
861
|
+
case "rsc":
|
|
862
|
+
return style;
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
|
|
764
866
|
// src/components/block/block.helpers.ts
|
|
765
867
|
var getComponent = ({
|
|
766
868
|
block,
|
|
@@ -804,7 +906,8 @@ var getRepeatItemData = ({
|
|
|
804
906
|
localState: context.localState,
|
|
805
907
|
rootState: context.rootState,
|
|
806
908
|
rootSetState: context.rootSetState,
|
|
807
|
-
context: context.context
|
|
909
|
+
context: context.context,
|
|
910
|
+
enableCache: true
|
|
808
911
|
});
|
|
809
912
|
if (!Array.isArray(itemsArray)) {
|
|
810
913
|
return void 0;
|
|
@@ -828,7 +931,7 @@ var getRepeatItemData = ({
|
|
|
828
931
|
};
|
|
829
932
|
|
|
830
933
|
// src/components/block/components/block-styles.tsx
|
|
831
|
-
import { Show as Show2 } from "solid-js";
|
|
934
|
+
import { Show as Show2, createMemo } from "solid-js";
|
|
832
935
|
|
|
833
936
|
// src/constants/device-sizes.ts
|
|
834
937
|
var SIZES = {
|
|
@@ -879,38 +982,6 @@ var getSizesForBreakpoints = ({
|
|
|
879
982
|
return newSizes;
|
|
880
983
|
};
|
|
881
984
|
|
|
882
|
-
// src/functions/camel-to-kebab-case.ts
|
|
883
|
-
var camelToKebabCase = (string) => string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
|
|
884
|
-
|
|
885
|
-
// src/helpers/css.ts
|
|
886
|
-
var convertStyleMapToCSSArray = (style) => {
|
|
887
|
-
const cssProps = Object.entries(style).map(([key, value]) => {
|
|
888
|
-
if (typeof value === "string") {
|
|
889
|
-
return `${camelToKebabCase(key)}: ${value};`;
|
|
890
|
-
} else {
|
|
891
|
-
return void 0;
|
|
892
|
-
}
|
|
893
|
-
});
|
|
894
|
-
return cssProps.filter(checkIsDefined);
|
|
895
|
-
};
|
|
896
|
-
var convertStyleMapToCSS = (style) => convertStyleMapToCSSArray(style).join("\n");
|
|
897
|
-
var createCssClass = ({
|
|
898
|
-
mediaQuery,
|
|
899
|
-
className,
|
|
900
|
-
styles
|
|
901
|
-
}) => {
|
|
902
|
-
const cssClass = `.${className} {
|
|
903
|
-
${convertStyleMapToCSS(styles)}
|
|
904
|
-
}`;
|
|
905
|
-
if (mediaQuery) {
|
|
906
|
-
return `${mediaQuery} {
|
|
907
|
-
${cssClass}
|
|
908
|
-
}`;
|
|
909
|
-
} else {
|
|
910
|
-
return cssClass;
|
|
911
|
-
}
|
|
912
|
-
};
|
|
913
|
-
|
|
914
985
|
// src/components/inlined-styles.tsx
|
|
915
986
|
function InlinedStyles(props) {
|
|
916
987
|
return <style innerHTML={props.styles} id={props.id} />;
|
|
@@ -919,7 +990,7 @@ var Inlined_styles_default = InlinedStyles;
|
|
|
919
990
|
|
|
920
991
|
// src/components/block/components/block-styles.tsx
|
|
921
992
|
function BlockStyles(props) {
|
|
922
|
-
|
|
993
|
+
const canShowBlock = createMemo(() => {
|
|
923
994
|
const processedBlock = getProcessedBlock({
|
|
924
995
|
block: props.block,
|
|
925
996
|
localState: props.context.localState,
|
|
@@ -935,8 +1006,8 @@ function BlockStyles(props) {
|
|
|
935
1006
|
return processedBlock.show;
|
|
936
1007
|
}
|
|
937
1008
|
return true;
|
|
938
|
-
}
|
|
939
|
-
|
|
1009
|
+
});
|
|
1010
|
+
const css5 = createMemo(() => {
|
|
940
1011
|
const processedBlock = getProcessedBlock({
|
|
941
1012
|
block: props.block,
|
|
942
1013
|
localState: props.context.localState,
|
|
@@ -978,7 +1049,7 @@ function BlockStyles(props) {
|
|
|
978
1049
|
)
|
|
979
1050
|
}) : "";
|
|
980
1051
|
return [largeStylesClass, mediumStylesClass, smallStylesClass].join(" ");
|
|
981
|
-
}
|
|
1052
|
+
});
|
|
982
1053
|
return <Show2 when={TARGET !== "reactNative" && css5() && canShowBlock()}><Inlined_styles_default styles={css5()} /></Show2>;
|
|
983
1054
|
}
|
|
984
1055
|
var Block_styles_default = BlockStyles;
|
|
@@ -997,7 +1068,8 @@ var createEventHandler = (value, options) => (event) => evaluate({
|
|
|
997
1068
|
rootState: options.rootState,
|
|
998
1069
|
rootSetState: options.rootSetState,
|
|
999
1070
|
event,
|
|
1000
|
-
isExpression: false
|
|
1071
|
+
isExpression: false,
|
|
1072
|
+
enableCache: true
|
|
1001
1073
|
});
|
|
1002
1074
|
|
|
1003
1075
|
// src/functions/get-block-actions.ts
|
|
@@ -1025,38 +1097,6 @@ function getBlockActions(options) {
|
|
|
1025
1097
|
return obj;
|
|
1026
1098
|
}
|
|
1027
1099
|
|
|
1028
|
-
// src/functions/transform-style-property.ts
|
|
1029
|
-
function transformStyleProperty({
|
|
1030
|
-
style
|
|
1031
|
-
}) {
|
|
1032
|
-
return style;
|
|
1033
|
-
}
|
|
1034
|
-
|
|
1035
|
-
// src/functions/get-style.ts
|
|
1036
|
-
var getStyle = ({
|
|
1037
|
-
block,
|
|
1038
|
-
context
|
|
1039
|
-
}) => {
|
|
1040
|
-
return mapStyleObjToStrIfNeeded(transformStyleProperty({
|
|
1041
|
-
style: block.style || {},
|
|
1042
|
-
context,
|
|
1043
|
-
block
|
|
1044
|
-
}));
|
|
1045
|
-
};
|
|
1046
|
-
function mapStyleObjToStrIfNeeded(style) {
|
|
1047
|
-
switch (TARGET) {
|
|
1048
|
-
case "svelte":
|
|
1049
|
-
case "vue":
|
|
1050
|
-
case "solid":
|
|
1051
|
-
return convertStyleMapToCSSArray(style).join(" ");
|
|
1052
|
-
case "qwik":
|
|
1053
|
-
case "reactNative":
|
|
1054
|
-
case "react":
|
|
1055
|
-
case "rsc":
|
|
1056
|
-
return style;
|
|
1057
|
-
}
|
|
1058
|
-
}
|
|
1059
|
-
|
|
1060
1100
|
// src/functions/transform-block-properties.ts
|
|
1061
1101
|
function transformBlockProperties({
|
|
1062
1102
|
properties
|
|
@@ -1216,21 +1256,20 @@ var Repeated_block_default = RepeatedBlock;
|
|
|
1216
1256
|
|
|
1217
1257
|
// src/components/block/block.tsx
|
|
1218
1258
|
function Block(props) {
|
|
1219
|
-
const
|
|
1220
|
-
function blockComponent() {
|
|
1259
|
+
const blockComponent = createMemo4(() => {
|
|
1221
1260
|
return getComponent({
|
|
1222
1261
|
block: props.block,
|
|
1223
1262
|
context: props.context,
|
|
1224
1263
|
registeredComponents: props.registeredComponents
|
|
1225
1264
|
});
|
|
1226
|
-
}
|
|
1227
|
-
|
|
1265
|
+
});
|
|
1266
|
+
const repeatItem = createMemo4(() => {
|
|
1228
1267
|
return getRepeatItemData({
|
|
1229
1268
|
block: props.block,
|
|
1230
1269
|
context: props.context
|
|
1231
1270
|
});
|
|
1232
|
-
}
|
|
1233
|
-
|
|
1271
|
+
});
|
|
1272
|
+
const processedBlock = createMemo4(() => {
|
|
1234
1273
|
return props.block.repeat?.collection ? props.block : getProcessedBlock({
|
|
1235
1274
|
block: props.block,
|
|
1236
1275
|
localState: props.context.localState,
|
|
@@ -1239,15 +1278,15 @@ function Block(props) {
|
|
|
1239
1278
|
context: props.context.context,
|
|
1240
1279
|
shouldEvaluateBindings: true
|
|
1241
1280
|
});
|
|
1242
|
-
}
|
|
1243
|
-
|
|
1281
|
+
});
|
|
1282
|
+
const Tag = createMemo4(() => {
|
|
1244
1283
|
const shouldUseLink = props.block.tagName === "a" || processedBlock().properties?.href || processedBlock().href;
|
|
1245
1284
|
if (shouldUseLink) {
|
|
1246
1285
|
return props.linkComponent || "a";
|
|
1247
1286
|
}
|
|
1248
1287
|
return props.block.tagName || "div";
|
|
1249
|
-
}
|
|
1250
|
-
|
|
1288
|
+
});
|
|
1289
|
+
const canShowBlock = createMemo4(() => {
|
|
1251
1290
|
if (props.block.repeat?.collection) {
|
|
1252
1291
|
if (repeatItem()?.length)
|
|
1253
1292
|
return true;
|
|
@@ -1256,12 +1295,12 @@ function Block(props) {
|
|
|
1256
1295
|
const shouldHide = "hide" in processedBlock() ? processedBlock().hide : false;
|
|
1257
1296
|
const shouldShow = "show" in processedBlock() ? processedBlock().show : true;
|
|
1258
1297
|
return shouldShow && !shouldHide;
|
|
1259
|
-
}
|
|
1260
|
-
|
|
1298
|
+
});
|
|
1299
|
+
const childrenWithoutParentComponent = createMemo4(() => {
|
|
1261
1300
|
const shouldRenderChildrenOutsideRef = !blockComponent()?.component && !repeatItem();
|
|
1262
1301
|
return shouldRenderChildrenOutsideRef ? processedBlock().children ?? [] : [];
|
|
1263
|
-
}
|
|
1264
|
-
|
|
1302
|
+
});
|
|
1303
|
+
const componentRefProps = createMemo4(() => {
|
|
1265
1304
|
return {
|
|
1266
1305
|
blockChildren: processedBlock().children ?? [],
|
|
1267
1306
|
componentRef: blockComponent()?.component,
|
|
@@ -1275,14 +1314,14 @@ function Block(props) {
|
|
|
1275
1314
|
builderComponents: props.registeredComponents
|
|
1276
1315
|
} : {}
|
|
1277
1316
|
},
|
|
1278
|
-
context:
|
|
1317
|
+
context: props.context,
|
|
1279
1318
|
linkComponent: props.linkComponent,
|
|
1280
1319
|
registeredComponents: props.registeredComponents,
|
|
1281
1320
|
builderBlock: processedBlock(),
|
|
1282
1321
|
includeBlockProps: blockComponent()?.noWrap === true,
|
|
1283
1322
|
isInteractive: !blockComponent()?.isRSC
|
|
1284
1323
|
};
|
|
1285
|
-
}
|
|
1324
|
+
});
|
|
1286
1325
|
onMount(() => {
|
|
1287
1326
|
const blockId = processedBlock().id;
|
|
1288
1327
|
const animations = processedBlock().animations;
|
|
@@ -1344,9 +1383,9 @@ function Block(props) {
|
|
|
1344
1383
|
return <Block
|
|
1345
1384
|
key={child.id}
|
|
1346
1385
|
block={child}
|
|
1347
|
-
context={childrenContext()}
|
|
1348
1386
|
registeredComponents={props.registeredComponents}
|
|
1349
1387
|
linkComponent={props.linkComponent}
|
|
1388
|
+
context={props.context}
|
|
1350
1389
|
/>;
|
|
1351
1390
|
}}</For2>
|
|
1352
1391
|
</Block_wrapper_default></Show4></Show4>
|
|
@@ -1355,12 +1394,13 @@ function Block(props) {
|
|
|
1355
1394
|
var Block_default = Block;
|
|
1356
1395
|
|
|
1357
1396
|
// src/components/blocks/blocks-wrapper.tsx
|
|
1397
|
+
import { createMemo as createMemo5 } from "solid-js";
|
|
1358
1398
|
import { Dynamic as Dynamic4 } from "solid-js/web";
|
|
1359
1399
|
import { css } from "solid-styled-components";
|
|
1360
1400
|
function BlocksWrapper(props) {
|
|
1361
|
-
|
|
1401
|
+
const className = createMemo5(() => {
|
|
1362
1402
|
return "builder-blocks" + (!props.blocks?.length ? " no-blocks" : "");
|
|
1363
|
-
}
|
|
1403
|
+
});
|
|
1364
1404
|
function onClick() {
|
|
1365
1405
|
if (isEditing() && !props.blocks?.length) {
|
|
1366
1406
|
window.parent?.postMessage(
|
|
@@ -1434,12 +1474,12 @@ var Blocks_default = Blocks;
|
|
|
1434
1474
|
|
|
1435
1475
|
// src/blocks/columns/columns.tsx
|
|
1436
1476
|
function Columns(props) {
|
|
1437
|
-
const [gutterSize, setGutterSize] =
|
|
1477
|
+
const [gutterSize, setGutterSize] = createSignal6(
|
|
1438
1478
|
typeof props.space === "number" ? props.space || 0 : 20
|
|
1439
1479
|
);
|
|
1440
|
-
const [cols, setCols] =
|
|
1441
|
-
const [stackAt, setStackAt] =
|
|
1442
|
-
const [flexDir, setFlexDir] =
|
|
1480
|
+
const [cols, setCols] = createSignal6(props.columns || []);
|
|
1481
|
+
const [stackAt, setStackAt] = createSignal6(props.stackColumnsAt || "tablet");
|
|
1482
|
+
const [flexDir, setFlexDir] = createSignal6(
|
|
1443
1483
|
props.stackColumnsAt === "never" ? "row" : props.reverseColumnsWhenStacked ? "column-reverse" : "column"
|
|
1444
1484
|
);
|
|
1445
1485
|
function getWidth(index) {
|
|
@@ -1461,7 +1501,7 @@ function Columns(props) {
|
|
|
1461
1501
|
}) {
|
|
1462
1502
|
return stackAt() === "never" ? desktopStyle : stackedStyle;
|
|
1463
1503
|
}
|
|
1464
|
-
|
|
1504
|
+
const columnsCssVars = createMemo6(() => {
|
|
1465
1505
|
return {
|
|
1466
1506
|
"--flex-dir": flexDir(),
|
|
1467
1507
|
"--flex-dir-tablet": getTabletStyle({
|
|
@@ -1469,7 +1509,7 @@ function Columns(props) {
|
|
|
1469
1509
|
desktopStyle: "row"
|
|
1470
1510
|
})
|
|
1471
1511
|
};
|
|
1472
|
-
}
|
|
1512
|
+
});
|
|
1473
1513
|
function columnCssVars(index) {
|
|
1474
1514
|
const gutter = index === 0 ? 0 : gutterSize();
|
|
1475
1515
|
const width = getColumnCssWidth(index);
|
|
@@ -1510,7 +1550,7 @@ function Columns(props) {
|
|
|
1510
1550
|
);
|
|
1511
1551
|
return breakpointSizes[size].max;
|
|
1512
1552
|
}
|
|
1513
|
-
|
|
1553
|
+
const columnsStyles = createMemo6(() => {
|
|
1514
1554
|
return `
|
|
1515
1555
|
@media (max-width: ${getWidthForBreakpointSize("medium")}px) {
|
|
1516
1556
|
.${props.builderBlock.id}-breakpoints {
|
|
@@ -1536,7 +1576,7 @@ function Columns(props) {
|
|
|
1536
1576
|
}
|
|
1537
1577
|
},
|
|
1538
1578
|
`;
|
|
1539
|
-
}
|
|
1579
|
+
});
|
|
1540
1580
|
return <div
|
|
1541
1581
|
class={`builder-columns ${props.builderBlock.id}-breakpoints ` + css2({
|
|
1542
1582
|
display: "flex",
|
|
@@ -1583,7 +1623,7 @@ function FragmentComponent(props) {
|
|
|
1583
1623
|
var fragment_default = FragmentComponent;
|
|
1584
1624
|
|
|
1585
1625
|
// src/blocks/image/image.tsx
|
|
1586
|
-
import { Show as Show7 } from "solid-js";
|
|
1626
|
+
import { Show as Show7, createMemo as createMemo7 } from "solid-js";
|
|
1587
1627
|
import { css as css3 } from "solid-styled-components";
|
|
1588
1628
|
|
|
1589
1629
|
// src/blocks/image/image.helpers.ts
|
|
@@ -1635,7 +1675,7 @@ function getSrcSet(url) {
|
|
|
1635
1675
|
|
|
1636
1676
|
// src/blocks/image/image.tsx
|
|
1637
1677
|
function Image(props) {
|
|
1638
|
-
|
|
1678
|
+
const srcSetToUse = createMemo7(() => {
|
|
1639
1679
|
const imageToUse = props.image || props.src;
|
|
1640
1680
|
const url = imageToUse;
|
|
1641
1681
|
if (!url || // We can auto add srcset for cdn.builder.io and shopify
|
|
@@ -1652,15 +1692,15 @@ function Image(props) {
|
|
|
1652
1692
|
return getSrcSet(url);
|
|
1653
1693
|
}
|
|
1654
1694
|
return getSrcSet(url);
|
|
1655
|
-
}
|
|
1656
|
-
|
|
1695
|
+
});
|
|
1696
|
+
const webpSrcSet = createMemo7(() => {
|
|
1657
1697
|
if (srcSetToUse()?.match(/builder\.io/) && !props.noWebp) {
|
|
1658
1698
|
return srcSetToUse().replace(/\?/g, "?format=webp&");
|
|
1659
1699
|
} else {
|
|
1660
1700
|
return "";
|
|
1661
1701
|
}
|
|
1662
|
-
}
|
|
1663
|
-
|
|
1702
|
+
});
|
|
1703
|
+
const aspectRatioCss = createMemo7(() => {
|
|
1664
1704
|
const aspectRatioStyles = {
|
|
1665
1705
|
position: "absolute",
|
|
1666
1706
|
height: "100%",
|
|
@@ -1670,7 +1710,7 @@ function Image(props) {
|
|
|
1670
1710
|
};
|
|
1671
1711
|
const out = props.aspectRatio ? aspectRatioStyles : void 0;
|
|
1672
1712
|
return out;
|
|
1673
|
-
}
|
|
1713
|
+
});
|
|
1674
1714
|
return <>
|
|
1675
1715
|
<picture>
|
|
1676
1716
|
<Show7 when={webpSrcSet()}><source type="image/webp" srcset={webpSrcSet()} /></Show7>
|
|
@@ -1743,10 +1783,10 @@ function SectionComponent(props) {
|
|
|
1743
1783
|
var section_default = SectionComponent;
|
|
1744
1784
|
|
|
1745
1785
|
// src/blocks/symbol/symbol.tsx
|
|
1746
|
-
import { onMount as onMount5, on as on3, createEffect as createEffect3, createSignal as
|
|
1786
|
+
import { onMount as onMount5, on as on3, createEffect as createEffect3, createMemo as createMemo16, createSignal as createSignal16 } from "solid-js";
|
|
1747
1787
|
|
|
1748
1788
|
// src/components/content-variants/content-variants.tsx
|
|
1749
|
-
import { Show as Show12, For as For7, onMount as onMount4, createSignal as
|
|
1789
|
+
import { Show as Show12, For as For7, onMount as onMount4, createSignal as createSignal15, createMemo as createMemo15 } from "solid-js";
|
|
1750
1790
|
|
|
1751
1791
|
// src/helpers/url.ts
|
|
1752
1792
|
var getTopLevelDomain = (host) => {
|
|
@@ -1940,7 +1980,7 @@ var handleABTesting = async ({
|
|
|
1940
1980
|
var getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : true;
|
|
1941
1981
|
|
|
1942
1982
|
// src/components/content/content.tsx
|
|
1943
|
-
import { Show as Show11, createSignal as
|
|
1983
|
+
import { Show as Show11, createSignal as createSignal14 } from "solid-js";
|
|
1944
1984
|
|
|
1945
1985
|
// src/blocks/button/component-info.ts
|
|
1946
1986
|
var componentInfo = {
|
|
@@ -2501,10 +2541,10 @@ var componentInfo9 = {
|
|
|
2501
2541
|
};
|
|
2502
2542
|
|
|
2503
2543
|
// src/blocks/custom-code/custom-code.tsx
|
|
2504
|
-
import { onMount as onMount2, createSignal as
|
|
2544
|
+
import { onMount as onMount2, createSignal as createSignal8 } from "solid-js";
|
|
2505
2545
|
function CustomCode(props) {
|
|
2506
|
-
const [scriptsInserted, setScriptsInserted] =
|
|
2507
|
-
const [scriptsRun, setScriptsRun] =
|
|
2546
|
+
const [scriptsInserted, setScriptsInserted] = createSignal8([]);
|
|
2547
|
+
const [scriptsRun, setScriptsRun] = createSignal8([]);
|
|
2508
2548
|
let elementRef;
|
|
2509
2549
|
onMount2(() => {
|
|
2510
2550
|
if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
|
|
@@ -2586,7 +2626,7 @@ var componentInfo10 = {
|
|
|
2586
2626
|
};
|
|
2587
2627
|
|
|
2588
2628
|
// src/blocks/embed/embed.tsx
|
|
2589
|
-
import { on, createEffect, createSignal as
|
|
2629
|
+
import { on, createEffect, createMemo as createMemo9, createSignal as createSignal9 } from "solid-js";
|
|
2590
2630
|
|
|
2591
2631
|
// src/blocks/embed/helpers.ts
|
|
2592
2632
|
var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"];
|
|
@@ -2594,9 +2634,9 @@ var isJsScript = (script) => SCRIPT_MIME_TYPES.includes(script.type);
|
|
|
2594
2634
|
|
|
2595
2635
|
// src/blocks/embed/embed.tsx
|
|
2596
2636
|
function Embed(props) {
|
|
2597
|
-
const [scriptsInserted, setScriptsInserted] =
|
|
2598
|
-
const [scriptsRun, setScriptsRun] =
|
|
2599
|
-
const [ranInitFn, setRanInitFn] =
|
|
2637
|
+
const [scriptsInserted, setScriptsInserted] = createSignal9([]);
|
|
2638
|
+
const [scriptsRun, setScriptsRun] = createSignal9([]);
|
|
2639
|
+
const [ranInitFn, setRanInitFn] = createSignal9(false);
|
|
2600
2640
|
function findAndRunScripts() {
|
|
2601
2641
|
if (!elem || !elem.getElementsByTagName)
|
|
2602
2642
|
return;
|
|
@@ -2620,13 +2660,17 @@ function Embed(props) {
|
|
|
2620
2660
|
}
|
|
2621
2661
|
}
|
|
2622
2662
|
let elem;
|
|
2663
|
+
const onUpdateFn_0_elem = createMemo9(() => elem);
|
|
2664
|
+
const onUpdateFn_0_ranInitFn__ = createMemo9(() => ranInitFn());
|
|
2623
2665
|
function onUpdateFn_0() {
|
|
2624
2666
|
if (elem && !ranInitFn()) {
|
|
2625
2667
|
setRanInitFn(true);
|
|
2626
2668
|
findAndRunScripts();
|
|
2627
2669
|
}
|
|
2628
2670
|
}
|
|
2629
|
-
createEffect(
|
|
2671
|
+
createEffect(
|
|
2672
|
+
on(() => [onUpdateFn_0_elem(), onUpdateFn_0_ranInitFn__()], onUpdateFn_0)
|
|
2673
|
+
);
|
|
2630
2674
|
return <div class="builder-embed" ref={elem} innerHTML={props.content} />;
|
|
2631
2675
|
}
|
|
2632
2676
|
var embed_default = Embed;
|
|
@@ -2866,7 +2910,7 @@ var componentInfo11 = {
|
|
|
2866
2910
|
};
|
|
2867
2911
|
|
|
2868
2912
|
// src/blocks/form/form/form.tsx
|
|
2869
|
-
import { Show as Show8, For as For5, createSignal as
|
|
2913
|
+
import { Show as Show8, For as For5, createSignal as createSignal10 } from "solid-js";
|
|
2870
2914
|
import { css as css4 } from "solid-styled-components";
|
|
2871
2915
|
|
|
2872
2916
|
// src/functions/get-env.ts
|
|
@@ -2884,9 +2928,9 @@ var get = (obj, path, defaultValue) => {
|
|
|
2884
2928
|
|
|
2885
2929
|
// src/blocks/form/form/form.tsx
|
|
2886
2930
|
function FormComponent(props) {
|
|
2887
|
-
const [formState, setFormState] =
|
|
2888
|
-
const [responseData, setResponseData] =
|
|
2889
|
-
const [formErrorMessage, setFormErrorMessage] =
|
|
2931
|
+
const [formState, setFormState] = createSignal10("unsubmitted");
|
|
2932
|
+
const [responseData, setResponseData] = createSignal10(null);
|
|
2933
|
+
const [formErrorMessage, setFormErrorMessage] = createSignal10("");
|
|
2890
2934
|
function mergeNewRootState(newData) {
|
|
2891
2935
|
const combinedState = {
|
|
2892
2936
|
...props.builderContext.rootState,
|
|
@@ -3402,9 +3446,9 @@ var componentInfo16 = {
|
|
|
3402
3446
|
};
|
|
3403
3447
|
|
|
3404
3448
|
// src/blocks/video/video.tsx
|
|
3405
|
-
import { Show as Show9 } from "solid-js";
|
|
3449
|
+
import { Show as Show9, createMemo as createMemo11 } from "solid-js";
|
|
3406
3450
|
function Video(props) {
|
|
3407
|
-
|
|
3451
|
+
const videoProps = createMemo11(() => {
|
|
3408
3452
|
return {
|
|
3409
3453
|
...props.autoPlay === true ? {
|
|
3410
3454
|
autoPlay: true
|
|
@@ -3422,12 +3466,12 @@ function Video(props) {
|
|
|
3422
3466
|
playsInline: true
|
|
3423
3467
|
} : {}
|
|
3424
3468
|
};
|
|
3425
|
-
}
|
|
3426
|
-
|
|
3469
|
+
});
|
|
3470
|
+
const spreadProps = createMemo11(() => {
|
|
3427
3471
|
return {
|
|
3428
3472
|
...videoProps()
|
|
3429
3473
|
};
|
|
3430
|
-
}
|
|
3474
|
+
});
|
|
3431
3475
|
return <div
|
|
3432
3476
|
style={{
|
|
3433
3477
|
position: "relative"
|
|
@@ -3617,7 +3661,14 @@ function InlinedScript(props) {
|
|
|
3617
3661
|
var Inlined_script_default = InlinedScript;
|
|
3618
3662
|
|
|
3619
3663
|
// src/components/content/components/enable-editor.tsx
|
|
3620
|
-
import {
|
|
3664
|
+
import {
|
|
3665
|
+
Show as Show10,
|
|
3666
|
+
onMount as onMount3,
|
|
3667
|
+
on as on2,
|
|
3668
|
+
createEffect as createEffect2,
|
|
3669
|
+
createMemo as createMemo12,
|
|
3670
|
+
createSignal as createSignal12
|
|
3671
|
+
} from "solid-js";
|
|
3621
3672
|
import { Dynamic as Dynamic5 } from "solid-js/web";
|
|
3622
3673
|
|
|
3623
3674
|
// src/helpers/preview-lru-cache/get.ts
|
|
@@ -4105,7 +4156,7 @@ function isFromTrustedHost(trustedHosts, e) {
|
|
|
4105
4156
|
}
|
|
4106
4157
|
|
|
4107
4158
|
// src/constants/sdk-version.ts
|
|
4108
|
-
var SDK_VERSION = "0.
|
|
4159
|
+
var SDK_VERSION = "1.0.13";
|
|
4109
4160
|
|
|
4110
4161
|
// src/functions/register.ts
|
|
4111
4162
|
var registry = {};
|
|
@@ -4304,15 +4355,15 @@ var subscribeToEditor = (model, callback, options) => {
|
|
|
4304
4355
|
|
|
4305
4356
|
// src/components/content/components/enable-editor.tsx
|
|
4306
4357
|
function EnableEditor(props) {
|
|
4307
|
-
const [forceReRenderCount, setForceReRenderCount] =
|
|
4308
|
-
const [firstRender, setFirstRender] =
|
|
4309
|
-
const [lastUpdated, setLastUpdated] =
|
|
4310
|
-
const [shouldSendResetCookie, setShouldSendResetCookie] =
|
|
4311
|
-
const [ContentWrapper, setContentWrapper] =
|
|
4358
|
+
const [forceReRenderCount, setForceReRenderCount] = createSignal12(0);
|
|
4359
|
+
const [firstRender, setFirstRender] = createSignal12(true);
|
|
4360
|
+
const [lastUpdated, setLastUpdated] = createSignal12(0);
|
|
4361
|
+
const [shouldSendResetCookie, setShouldSendResetCookie] = createSignal12(false);
|
|
4362
|
+
const [ContentWrapper, setContentWrapper] = createSignal12(
|
|
4312
4363
|
props.contentWrapper || "div"
|
|
4313
4364
|
);
|
|
4314
|
-
const [httpReqsData, setHttpReqsData] =
|
|
4315
|
-
const [clicked, setClicked] =
|
|
4365
|
+
const [httpReqsData, setHttpReqsData] = createSignal12({});
|
|
4366
|
+
const [clicked, setClicked] = createSignal12(false);
|
|
4316
4367
|
function mergeNewRootState(newData) {
|
|
4317
4368
|
const combinedState = {
|
|
4318
4369
|
...props.builderContextSignal.rootState,
|
|
@@ -4383,7 +4434,11 @@ function EnableEditor(props) {
|
|
|
4383
4434
|
context: props.context || {},
|
|
4384
4435
|
localState: void 0,
|
|
4385
4436
|
rootState: props.builderContextSignal.rootState,
|
|
4386
|
-
rootSetState: props.builderContextSignal.rootSetState
|
|
4437
|
+
rootSetState: props.builderContextSignal.rootSetState,
|
|
4438
|
+
/**
|
|
4439
|
+
* We don't want to cache the result of the JS code, since it's arbitrary side effect code.
|
|
4440
|
+
*/
|
|
4441
|
+
enableCache: false
|
|
4387
4442
|
});
|
|
4388
4443
|
}
|
|
4389
4444
|
}
|
|
@@ -4408,13 +4463,16 @@ function EnableEditor(props) {
|
|
|
4408
4463
|
function evalExpression(expression) {
|
|
4409
4464
|
return expression.replace(
|
|
4410
4465
|
/{{([^}]+)}}/g,
|
|
4411
|
-
(_match, group) =>
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
4466
|
+
(_match, group) => String(
|
|
4467
|
+
evaluate({
|
|
4468
|
+
code: group,
|
|
4469
|
+
context: props.context || {},
|
|
4470
|
+
localState: void 0,
|
|
4471
|
+
rootState: props.builderContextSignal.rootState,
|
|
4472
|
+
rootSetState: props.builderContextSignal.rootSetState,
|
|
4473
|
+
enableCache: true
|
|
4474
|
+
})
|
|
4475
|
+
)
|
|
4418
4476
|
);
|
|
4419
4477
|
}
|
|
4420
4478
|
function handleRequest({ url, key }) {
|
|
@@ -4531,40 +4589,63 @@ function EnableEditor(props) {
|
|
|
4531
4589
|
runHttpRequests();
|
|
4532
4590
|
emitStateUpdate();
|
|
4533
4591
|
});
|
|
4592
|
+
const onUpdateFn_0_props_content = createMemo12(() => props.content);
|
|
4534
4593
|
function onUpdateFn_0() {
|
|
4535
4594
|
if (props.content) {
|
|
4536
4595
|
mergeNewContent(props.content);
|
|
4537
4596
|
}
|
|
4538
4597
|
}
|
|
4539
|
-
createEffect2(on2(() => [
|
|
4598
|
+
createEffect2(on2(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
|
|
4599
|
+
const onUpdateFn_1_shouldSendResetCookie__ = createMemo12(
|
|
4600
|
+
() => shouldSendResetCookie()
|
|
4601
|
+
);
|
|
4540
4602
|
function onUpdateFn_1() {
|
|
4541
4603
|
}
|
|
4542
|
-
createEffect2(
|
|
4604
|
+
createEffect2(
|
|
4605
|
+
on2(() => [onUpdateFn_1_shouldSendResetCookie__()], onUpdateFn_1)
|
|
4606
|
+
);
|
|
4607
|
+
const onUpdateFn_2_props_builderContextSignal_content__data__jsCode = createMemo12(() => props.builderContextSignal.content?.data?.jsCode);
|
|
4543
4608
|
function onUpdateFn_2() {
|
|
4544
4609
|
evaluateJsCode();
|
|
4545
4610
|
}
|
|
4546
4611
|
createEffect2(
|
|
4547
|
-
on2(
|
|
4612
|
+
on2(
|
|
4613
|
+
() => [onUpdateFn_2_props_builderContextSignal_content__data__jsCode()],
|
|
4614
|
+
onUpdateFn_2
|
|
4615
|
+
)
|
|
4548
4616
|
);
|
|
4617
|
+
const onUpdateFn_3_props_builderContextSignal_content__data__httpRequests = createMemo12(() => props.builderContextSignal.content?.data?.httpRequests);
|
|
4549
4618
|
function onUpdateFn_3() {
|
|
4550
4619
|
runHttpRequests();
|
|
4551
4620
|
}
|
|
4552
4621
|
createEffect2(
|
|
4553
4622
|
on2(
|
|
4554
|
-
() => [
|
|
4623
|
+
() => [
|
|
4624
|
+
onUpdateFn_3_props_builderContextSignal_content__data__httpRequests()
|
|
4625
|
+
],
|
|
4555
4626
|
onUpdateFn_3
|
|
4556
4627
|
)
|
|
4557
4628
|
);
|
|
4629
|
+
const onUpdateFn_4_props_builderContextSignal_rootState = createMemo12(
|
|
4630
|
+
() => props.builderContextSignal.rootState
|
|
4631
|
+
);
|
|
4558
4632
|
function onUpdateFn_4() {
|
|
4559
4633
|
emitStateUpdate();
|
|
4560
4634
|
}
|
|
4561
|
-
createEffect2(
|
|
4635
|
+
createEffect2(
|
|
4636
|
+
on2(
|
|
4637
|
+
() => [onUpdateFn_4_props_builderContextSignal_rootState()],
|
|
4638
|
+
onUpdateFn_4
|
|
4639
|
+
)
|
|
4640
|
+
);
|
|
4641
|
+
const onUpdateFn_5_props_data = createMemo12(() => props.data);
|
|
4562
4642
|
function onUpdateFn_5() {
|
|
4563
4643
|
if (props.data) {
|
|
4564
4644
|
mergeNewRootState(props.data);
|
|
4565
4645
|
}
|
|
4566
4646
|
}
|
|
4567
|
-
createEffect2(on2(() => [
|
|
4647
|
+
createEffect2(on2(() => [onUpdateFn_5_props_data()], onUpdateFn_5));
|
|
4648
|
+
const onUpdateFn_6_props_locale = createMemo12(() => props.locale);
|
|
4568
4649
|
function onUpdateFn_6() {
|
|
4569
4650
|
if (props.locale) {
|
|
4570
4651
|
mergeNewRootState({
|
|
@@ -4572,7 +4653,7 @@ function EnableEditor(props) {
|
|
|
4572
4653
|
});
|
|
4573
4654
|
}
|
|
4574
4655
|
}
|
|
4575
|
-
createEffect2(on2(() => [
|
|
4656
|
+
createEffect2(on2(() => [onUpdateFn_6_props_locale()], onUpdateFn_6));
|
|
4576
4657
|
return <builder_context_default.Provider value={props.builderContextSignal}><Show10 when={props.builderContextSignal.content}><Dynamic5
|
|
4577
4658
|
class={`variant-${props.content?.testVariationId || props.content?.id}`}
|
|
4578
4659
|
{...{}}
|
|
@@ -4593,7 +4674,7 @@ function EnableEditor(props) {
|
|
|
4593
4674
|
var Enable_editor_default = EnableEditor;
|
|
4594
4675
|
|
|
4595
4676
|
// src/components/content/components/styles.tsx
|
|
4596
|
-
import { createSignal as
|
|
4677
|
+
import { createSignal as createSignal13 } from "solid-js";
|
|
4597
4678
|
|
|
4598
4679
|
// src/components/content/components/styles.helpers.ts
|
|
4599
4680
|
var getCssFromFont = (font) => {
|
|
@@ -4649,19 +4730,7 @@ var getCss = ({
|
|
|
4649
4730
|
}
|
|
4650
4731
|
return cssCode?.replace(/&/g, `div[builder-content-id="${contentId}"]`) || "";
|
|
4651
4732
|
};
|
|
4652
|
-
|
|
4653
|
-
// src/components/content/components/styles.tsx
|
|
4654
|
-
function ContentStyles(props) {
|
|
4655
|
-
const [injectedStyles, setInjectedStyles] = createSignal12(
|
|
4656
|
-
`
|
|
4657
|
-
${getCss({
|
|
4658
|
-
cssCode: props.cssCode,
|
|
4659
|
-
contentId: props.contentId
|
|
4660
|
-
})}
|
|
4661
|
-
${getFontCss({
|
|
4662
|
-
customFonts: props.customFonts
|
|
4663
|
-
})}
|
|
4664
|
-
|
|
4733
|
+
var DEFAULT_STYLES = `
|
|
4665
4734
|
.builder-button {
|
|
4666
4735
|
all: unset;
|
|
4667
4736
|
}
|
|
@@ -4678,6 +4747,23 @@ ${getFontCss({
|
|
|
4678
4747
|
text-align: inherit;
|
|
4679
4748
|
font-family: inherit;
|
|
4680
4749
|
}
|
|
4750
|
+
`;
|
|
4751
|
+
var getDefaultStyles = (isNested) => {
|
|
4752
|
+
return !isNested ? DEFAULT_STYLES : "";
|
|
4753
|
+
};
|
|
4754
|
+
|
|
4755
|
+
// src/components/content/components/styles.tsx
|
|
4756
|
+
function ContentStyles(props) {
|
|
4757
|
+
const [injectedStyles, setInjectedStyles] = createSignal13(
|
|
4758
|
+
`
|
|
4759
|
+
${getCss({
|
|
4760
|
+
cssCode: props.cssCode,
|
|
4761
|
+
contentId: props.contentId
|
|
4762
|
+
})}
|
|
4763
|
+
${getFontCss({
|
|
4764
|
+
customFonts: props.customFonts
|
|
4765
|
+
})}
|
|
4766
|
+
${getDefaultStyles(props.isNestedRender)}
|
|
4681
4767
|
`.trim()
|
|
4682
4768
|
);
|
|
4683
4769
|
return <Inlined_styles_default styles={injectedStyles()} />;
|
|
@@ -4722,7 +4808,7 @@ var getContentInitialValue = ({
|
|
|
4722
4808
|
|
|
4723
4809
|
// src/components/content/content.tsx
|
|
4724
4810
|
function ContentComponent(props) {
|
|
4725
|
-
const [scriptStr, setScriptStr] =
|
|
4811
|
+
const [scriptStr, setScriptStr] = createSignal14(
|
|
4726
4812
|
getUpdateVariantVisibilityScript({
|
|
4727
4813
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
4728
4814
|
variationId: props.content?.testVariationId,
|
|
@@ -4730,7 +4816,7 @@ function ContentComponent(props) {
|
|
|
4730
4816
|
contentId: props.content?.id
|
|
4731
4817
|
})
|
|
4732
4818
|
);
|
|
4733
|
-
const [registeredComponents, setRegisteredComponents] =
|
|
4819
|
+
const [registeredComponents, setRegisteredComponents] = createSignal14(
|
|
4734
4820
|
[
|
|
4735
4821
|
...getDefaultRegisteredComponents(),
|
|
4736
4822
|
...props.customComponents || []
|
|
@@ -4745,7 +4831,7 @@ function ContentComponent(props) {
|
|
|
4745
4831
|
{}
|
|
4746
4832
|
)
|
|
4747
4833
|
);
|
|
4748
|
-
const [builderContextSignal, setBuilderContextSignal] =
|
|
4834
|
+
const [builderContextSignal, setBuilderContextSignal] = createSignal14({
|
|
4749
4835
|
content: getContentInitialValue({
|
|
4750
4836
|
content: props.content,
|
|
4751
4837
|
data: props.data
|
|
@@ -4805,6 +4891,7 @@ function ContentComponent(props) {
|
|
|
4805
4891
|
>
|
|
4806
4892
|
<Show11 when={props.isSsrAbTest}><Inlined_script_default scriptStr={scriptStr()} /></Show11>
|
|
4807
4893
|
<Show11 when={TARGET !== "reactNative"}><Styles_default
|
|
4894
|
+
isNestedRender={props.isNestedRender}
|
|
4808
4895
|
contentId={builderContextSignal().content?.id}
|
|
4809
4896
|
cssCode={builderContextSignal().content?.data?.cssCode}
|
|
4810
4897
|
customFonts={builderContextSignal().content?.data?.customFonts}
|
|
@@ -4821,13 +4908,13 @@ var Content_default = ContentComponent;
|
|
|
4821
4908
|
|
|
4822
4909
|
// src/components/content-variants/content-variants.tsx
|
|
4823
4910
|
function ContentVariants(props) {
|
|
4824
|
-
const [shouldRenderVariants, setShouldRenderVariants] =
|
|
4911
|
+
const [shouldRenderVariants, setShouldRenderVariants] = createSignal15(
|
|
4825
4912
|
checkShouldRenderVariants({
|
|
4826
4913
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
4827
4914
|
content: props.content
|
|
4828
4915
|
})
|
|
4829
4916
|
);
|
|
4830
|
-
|
|
4917
|
+
const updateCookieAndStylesScriptStr = createMemo15(() => {
|
|
4831
4918
|
return getUpdateCookieAndStylesScript(
|
|
4832
4919
|
getVariants(props.content).map((value) => ({
|
|
4833
4920
|
id: value.testVariationId,
|
|
@@ -4835,11 +4922,11 @@ function ContentVariants(props) {
|
|
|
4835
4922
|
})),
|
|
4836
4923
|
props.content?.id || ""
|
|
4837
4924
|
);
|
|
4838
|
-
}
|
|
4839
|
-
|
|
4925
|
+
});
|
|
4926
|
+
const hideVariantsStyleString = createMemo15(() => {
|
|
4840
4927
|
return getVariants(props.content).map((value) => `.variant-${value.testVariationId} { display: none; } `).join("");
|
|
4841
|
-
}
|
|
4842
|
-
|
|
4928
|
+
});
|
|
4929
|
+
const defaultContent = createMemo15(() => {
|
|
4843
4930
|
return shouldRenderVariants() ? {
|
|
4844
4931
|
...props.content,
|
|
4845
4932
|
testVariationId: props.content?.id
|
|
@@ -4847,12 +4934,12 @@ function ContentVariants(props) {
|
|
|
4847
4934
|
item: props.content,
|
|
4848
4935
|
canTrack: getDefaultCanTrack(props.canTrack)
|
|
4849
4936
|
});
|
|
4850
|
-
}
|
|
4937
|
+
});
|
|
4851
4938
|
onMount4(() => {
|
|
4852
4939
|
setShouldRenderVariants(false);
|
|
4853
4940
|
});
|
|
4854
4941
|
return <>
|
|
4855
|
-
<Show12 when={!props.
|
|
4942
|
+
<Show12 when={!props.isNestedRender && TARGET !== "reactNative"}><Inlined_script_default scriptStr={getScriptString()} /></Show12>
|
|
4856
4943
|
<Show12 when={shouldRenderVariants()}>
|
|
4857
4944
|
<Inlined_styles_default
|
|
4858
4945
|
id={`variants-styles-${props.content?.id}`}
|
|
@@ -4864,6 +4951,7 @@ function ContentVariants(props) {
|
|
|
4864
4951
|
<For7 each={getVariants(props.content)}>{(variant, _index) => {
|
|
4865
4952
|
const index = _index();
|
|
4866
4953
|
return <Content_default
|
|
4954
|
+
isNestedRender={props.isNestedRender}
|
|
4867
4955
|
key={variant.testVariationId}
|
|
4868
4956
|
content={variant}
|
|
4869
4957
|
showContent={false}
|
|
@@ -4887,6 +4975,7 @@ function ContentVariants(props) {
|
|
|
4887
4975
|
}}</For7>
|
|
4888
4976
|
</Show12>
|
|
4889
4977
|
<Content_default
|
|
4978
|
+
isNestedRender={props.isNestedRender}
|
|
4890
4979
|
{...{}}
|
|
4891
4980
|
content={defaultContent()}
|
|
4892
4981
|
showContent={true}
|
|
@@ -4937,15 +5026,15 @@ var fetchSymbolContent = async ({
|
|
|
4937
5026
|
|
|
4938
5027
|
// src/blocks/symbol/symbol.tsx
|
|
4939
5028
|
function Symbol(props) {
|
|
4940
|
-
const [contentToUse, setContentToUse] =
|
|
4941
|
-
|
|
5029
|
+
const [contentToUse, setContentToUse] = createSignal16(props.symbol?.content);
|
|
5030
|
+
const className = createMemo16(() => {
|
|
4942
5031
|
return [
|
|
4943
5032
|
...[props.attributes[getClassPropName()]],
|
|
4944
5033
|
"builder-symbol",
|
|
4945
5034
|
props.symbol?.inline ? "builder-inline-symbol" : void 0,
|
|
4946
5035
|
props.symbol?.dynamic || props.dynamic ? "builder-dynamic-symbol" : void 0
|
|
4947
5036
|
].filter(Boolean).join(" ");
|
|
4948
|
-
}
|
|
5037
|
+
});
|
|
4949
5038
|
function setContent() {
|
|
4950
5039
|
if (contentToUse())
|
|
4951
5040
|
return;
|
|
@@ -4959,14 +5048,14 @@ function Symbol(props) {
|
|
|
4959
5048
|
});
|
|
4960
5049
|
}
|
|
4961
5050
|
onMount5(() => {
|
|
4962
|
-
setContent();
|
|
4963
5051
|
});
|
|
5052
|
+
const onUpdateFn_0_props_symbol = createMemo16(() => props.symbol);
|
|
4964
5053
|
function onUpdateFn_0() {
|
|
4965
5054
|
setContent();
|
|
4966
5055
|
}
|
|
4967
|
-
createEffect3(on3(() => [
|
|
5056
|
+
createEffect3(on3(() => [onUpdateFn_0_props_symbol()], onUpdateFn_0));
|
|
4968
5057
|
return <div class={className()} {...{}} {...props.attributes} {...{}}><Content_variants_default
|
|
4969
|
-
|
|
5058
|
+
isNestedRender={true}
|
|
4970
5059
|
apiVersion={props.builderContext.apiVersion}
|
|
4971
5060
|
apiKey={props.builderContext.apiKey}
|
|
4972
5061
|
context={{
|