@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/browser/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,
|
|
@@ -318,6 +318,30 @@ var shouldForceBrowserRuntimeInNode = () => {
|
|
|
318
318
|
var chooseBrowserOrServerEval = (args) => isBrowser() || shouldForceBrowserRuntimeInNode() ? runInBrowser(args) : runInBrowser(args);
|
|
319
319
|
|
|
320
320
|
// src/functions/evaluate/evaluate.ts
|
|
321
|
+
var EvalCache = class _EvalCache {
|
|
322
|
+
static cacheLimit = 20;
|
|
323
|
+
static cache = /* @__PURE__ */ new Map();
|
|
324
|
+
static getCacheKey(args) {
|
|
325
|
+
return JSON.stringify({
|
|
326
|
+
...args,
|
|
327
|
+
// replace the event with a random number to break cache
|
|
328
|
+
// thats because we can't serialize the event object due to circular refs in DOM node refs.
|
|
329
|
+
event: args.event ? Math.random() : void 0
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
static getCachedValue(key) {
|
|
333
|
+
const cachedVal = _EvalCache.cache.get(key);
|
|
334
|
+
return cachedVal;
|
|
335
|
+
}
|
|
336
|
+
static setCachedValue(key, value) {
|
|
337
|
+
if (_EvalCache.cache.size > 20) {
|
|
338
|
+
_EvalCache.cache.delete(_EvalCache.cache.keys().next().value);
|
|
339
|
+
}
|
|
340
|
+
_EvalCache.cache.set(key, {
|
|
341
|
+
value
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
};
|
|
321
345
|
function evaluate({
|
|
322
346
|
code,
|
|
323
347
|
context,
|
|
@@ -325,11 +349,12 @@ function evaluate({
|
|
|
325
349
|
rootState,
|
|
326
350
|
rootSetState,
|
|
327
351
|
event,
|
|
328
|
-
isExpression = true
|
|
352
|
+
isExpression = true,
|
|
353
|
+
enableCache
|
|
329
354
|
}) {
|
|
330
355
|
if (code === "") {
|
|
331
356
|
logger.warn("Skipping evaluation of empty code block.");
|
|
332
|
-
return;
|
|
357
|
+
return void 0;
|
|
333
358
|
}
|
|
334
359
|
const args = {
|
|
335
360
|
code: parseCode(code, {
|
|
@@ -342,8 +367,20 @@ function evaluate({
|
|
|
342
367
|
rootState,
|
|
343
368
|
localState
|
|
344
369
|
};
|
|
370
|
+
if (enableCache) {
|
|
371
|
+
const cacheKey = EvalCache.getCacheKey(args);
|
|
372
|
+
const cachedValue = EvalCache.getCachedValue(cacheKey);
|
|
373
|
+
if (cachedValue) {
|
|
374
|
+
return cachedValue.value;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
345
377
|
try {
|
|
346
|
-
|
|
378
|
+
const newEval = chooseBrowserOrServerEval(args);
|
|
379
|
+
if (enableCache) {
|
|
380
|
+
const cacheKey = EvalCache.getCacheKey(args);
|
|
381
|
+
EvalCache.setCachedValue(cacheKey, newEval);
|
|
382
|
+
}
|
|
383
|
+
return newEval;
|
|
347
384
|
} catch (e) {
|
|
348
385
|
logger.error("Failed code evaluation: " + e.message, {
|
|
349
386
|
code
|
|
@@ -398,7 +435,8 @@ var evaluateBindings = ({
|
|
|
398
435
|
localState,
|
|
399
436
|
rootState,
|
|
400
437
|
rootSetState,
|
|
401
|
-
context
|
|
438
|
+
context,
|
|
439
|
+
enableCache: true
|
|
402
440
|
});
|
|
403
441
|
set(copied, binding, value);
|
|
404
442
|
}
|
|
@@ -631,6 +669,70 @@ function bindScrollInViewAnimation(animation) {
|
|
|
631
669
|
});
|
|
632
670
|
}
|
|
633
671
|
|
|
672
|
+
// src/functions/camel-to-kebab-case.ts
|
|
673
|
+
var camelToKebabCase = (string) => string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
|
|
674
|
+
|
|
675
|
+
// src/helpers/css.ts
|
|
676
|
+
var convertStyleMapToCSSArray = (style) => {
|
|
677
|
+
const cssProps = Object.entries(style).map(([key, value]) => {
|
|
678
|
+
if (typeof value === "string") {
|
|
679
|
+
return `${camelToKebabCase(key)}: ${value};`;
|
|
680
|
+
} else {
|
|
681
|
+
return void 0;
|
|
682
|
+
}
|
|
683
|
+
});
|
|
684
|
+
return cssProps.filter(checkIsDefined);
|
|
685
|
+
};
|
|
686
|
+
var convertStyleMapToCSS = (style) => convertStyleMapToCSSArray(style).join("\n");
|
|
687
|
+
var createCssClass = ({
|
|
688
|
+
mediaQuery,
|
|
689
|
+
className,
|
|
690
|
+
styles
|
|
691
|
+
}) => {
|
|
692
|
+
const cssClass = `.${className} {
|
|
693
|
+
${convertStyleMapToCSS(styles)}
|
|
694
|
+
}`;
|
|
695
|
+
if (mediaQuery) {
|
|
696
|
+
return `${mediaQuery} {
|
|
697
|
+
${cssClass}
|
|
698
|
+
}`;
|
|
699
|
+
} else {
|
|
700
|
+
return cssClass;
|
|
701
|
+
}
|
|
702
|
+
};
|
|
703
|
+
|
|
704
|
+
// src/functions/transform-style-property.ts
|
|
705
|
+
function transformStyleProperty({
|
|
706
|
+
style
|
|
707
|
+
}) {
|
|
708
|
+
return style;
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
// src/functions/get-style.ts
|
|
712
|
+
var getStyle = ({
|
|
713
|
+
block,
|
|
714
|
+
context
|
|
715
|
+
}) => {
|
|
716
|
+
return mapStyleObjToStrIfNeeded(transformStyleProperty({
|
|
717
|
+
style: block.style || {},
|
|
718
|
+
context,
|
|
719
|
+
block
|
|
720
|
+
}));
|
|
721
|
+
};
|
|
722
|
+
function mapStyleObjToStrIfNeeded(style) {
|
|
723
|
+
switch (TARGET) {
|
|
724
|
+
case "svelte":
|
|
725
|
+
case "vue":
|
|
726
|
+
case "solid":
|
|
727
|
+
return convertStyleMapToCSSArray(style).join(" ");
|
|
728
|
+
case "qwik":
|
|
729
|
+
case "reactNative":
|
|
730
|
+
case "react":
|
|
731
|
+
case "rsc":
|
|
732
|
+
return style;
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
|
|
634
736
|
// src/components/block/block.helpers.ts
|
|
635
737
|
var getComponent = ({
|
|
636
738
|
block,
|
|
@@ -671,7 +773,8 @@ var getRepeatItemData = ({
|
|
|
671
773
|
localState: context.localState,
|
|
672
774
|
rootState: context.rootState,
|
|
673
775
|
rootSetState: context.rootSetState,
|
|
674
|
-
context: context.context
|
|
776
|
+
context: context.context,
|
|
777
|
+
enableCache: true
|
|
675
778
|
});
|
|
676
779
|
if (!Array.isArray(itemsArray)) {
|
|
677
780
|
return void 0;
|
|
@@ -695,7 +798,7 @@ var getRepeatItemData = ({
|
|
|
695
798
|
};
|
|
696
799
|
|
|
697
800
|
// src/components/block/components/block-styles.tsx
|
|
698
|
-
import { Show as Show2 } from "solid-js";
|
|
801
|
+
import { Show as Show2, createMemo } from "solid-js";
|
|
699
802
|
|
|
700
803
|
// src/constants/device-sizes.ts
|
|
701
804
|
var SIZES = {
|
|
@@ -746,38 +849,6 @@ var getSizesForBreakpoints = ({
|
|
|
746
849
|
return newSizes;
|
|
747
850
|
};
|
|
748
851
|
|
|
749
|
-
// src/functions/camel-to-kebab-case.ts
|
|
750
|
-
var camelToKebabCase = (string) => string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
|
|
751
|
-
|
|
752
|
-
// src/helpers/css.ts
|
|
753
|
-
var convertStyleMapToCSSArray = (style) => {
|
|
754
|
-
const cssProps = Object.entries(style).map(([key, value]) => {
|
|
755
|
-
if (typeof value === "string") {
|
|
756
|
-
return `${camelToKebabCase(key)}: ${value};`;
|
|
757
|
-
} else {
|
|
758
|
-
return void 0;
|
|
759
|
-
}
|
|
760
|
-
});
|
|
761
|
-
return cssProps.filter(checkIsDefined);
|
|
762
|
-
};
|
|
763
|
-
var convertStyleMapToCSS = (style) => convertStyleMapToCSSArray(style).join("\n");
|
|
764
|
-
var createCssClass = ({
|
|
765
|
-
mediaQuery,
|
|
766
|
-
className,
|
|
767
|
-
styles
|
|
768
|
-
}) => {
|
|
769
|
-
const cssClass = `.${className} {
|
|
770
|
-
${convertStyleMapToCSS(styles)}
|
|
771
|
-
}`;
|
|
772
|
-
if (mediaQuery) {
|
|
773
|
-
return `${mediaQuery} {
|
|
774
|
-
${cssClass}
|
|
775
|
-
}`;
|
|
776
|
-
} else {
|
|
777
|
-
return cssClass;
|
|
778
|
-
}
|
|
779
|
-
};
|
|
780
|
-
|
|
781
852
|
// src/components/inlined-styles.tsx
|
|
782
853
|
function InlinedStyles(props) {
|
|
783
854
|
return <style innerHTML={props.styles} id={props.id} />;
|
|
@@ -786,7 +857,7 @@ var Inlined_styles_default = InlinedStyles;
|
|
|
786
857
|
|
|
787
858
|
// src/components/block/components/block-styles.tsx
|
|
788
859
|
function BlockStyles(props) {
|
|
789
|
-
|
|
860
|
+
const canShowBlock = createMemo(() => {
|
|
790
861
|
const processedBlock = getProcessedBlock({
|
|
791
862
|
block: props.block,
|
|
792
863
|
localState: props.context.localState,
|
|
@@ -802,8 +873,8 @@ function BlockStyles(props) {
|
|
|
802
873
|
return processedBlock.show;
|
|
803
874
|
}
|
|
804
875
|
return true;
|
|
805
|
-
}
|
|
806
|
-
|
|
876
|
+
});
|
|
877
|
+
const css5 = createMemo(() => {
|
|
807
878
|
const processedBlock = getProcessedBlock({
|
|
808
879
|
block: props.block,
|
|
809
880
|
localState: props.context.localState,
|
|
@@ -845,7 +916,7 @@ function BlockStyles(props) {
|
|
|
845
916
|
)
|
|
846
917
|
}) : "";
|
|
847
918
|
return [largeStylesClass, mediumStylesClass, smallStylesClass].join(" ");
|
|
848
|
-
}
|
|
919
|
+
});
|
|
849
920
|
return <Show2 when={TARGET !== "reactNative" && css5() && canShowBlock()}><Inlined_styles_default styles={css5()} /></Show2>;
|
|
850
921
|
}
|
|
851
922
|
var Block_styles_default = BlockStyles;
|
|
@@ -864,7 +935,8 @@ var createEventHandler = (value, options) => (event) => evaluate({
|
|
|
864
935
|
rootState: options.rootState,
|
|
865
936
|
rootSetState: options.rootSetState,
|
|
866
937
|
event,
|
|
867
|
-
isExpression: false
|
|
938
|
+
isExpression: false,
|
|
939
|
+
enableCache: true
|
|
868
940
|
});
|
|
869
941
|
|
|
870
942
|
// src/functions/get-block-actions.ts
|
|
@@ -892,38 +964,6 @@ function getBlockActions(options) {
|
|
|
892
964
|
return obj;
|
|
893
965
|
}
|
|
894
966
|
|
|
895
|
-
// src/functions/transform-style-property.ts
|
|
896
|
-
function transformStyleProperty({
|
|
897
|
-
style
|
|
898
|
-
}) {
|
|
899
|
-
return style;
|
|
900
|
-
}
|
|
901
|
-
|
|
902
|
-
// src/functions/get-style.ts
|
|
903
|
-
var getStyle = ({
|
|
904
|
-
block,
|
|
905
|
-
context
|
|
906
|
-
}) => {
|
|
907
|
-
return mapStyleObjToStrIfNeeded(transformStyleProperty({
|
|
908
|
-
style: block.style || {},
|
|
909
|
-
context,
|
|
910
|
-
block
|
|
911
|
-
}));
|
|
912
|
-
};
|
|
913
|
-
function mapStyleObjToStrIfNeeded(style) {
|
|
914
|
-
switch (TARGET) {
|
|
915
|
-
case "svelte":
|
|
916
|
-
case "vue":
|
|
917
|
-
case "solid":
|
|
918
|
-
return convertStyleMapToCSSArray(style).join(" ");
|
|
919
|
-
case "qwik":
|
|
920
|
-
case "reactNative":
|
|
921
|
-
case "react":
|
|
922
|
-
case "rsc":
|
|
923
|
-
return style;
|
|
924
|
-
}
|
|
925
|
-
}
|
|
926
|
-
|
|
927
967
|
// src/functions/transform-block-properties.ts
|
|
928
968
|
function transformBlockProperties({
|
|
929
969
|
properties
|
|
@@ -1083,21 +1123,20 @@ var Repeated_block_default = RepeatedBlock;
|
|
|
1083
1123
|
|
|
1084
1124
|
// src/components/block/block.tsx
|
|
1085
1125
|
function Block(props) {
|
|
1086
|
-
const
|
|
1087
|
-
function blockComponent() {
|
|
1126
|
+
const blockComponent = createMemo4(() => {
|
|
1088
1127
|
return getComponent({
|
|
1089
1128
|
block: props.block,
|
|
1090
1129
|
context: props.context,
|
|
1091
1130
|
registeredComponents: props.registeredComponents
|
|
1092
1131
|
});
|
|
1093
|
-
}
|
|
1094
|
-
|
|
1132
|
+
});
|
|
1133
|
+
const repeatItem = createMemo4(() => {
|
|
1095
1134
|
return getRepeatItemData({
|
|
1096
1135
|
block: props.block,
|
|
1097
1136
|
context: props.context
|
|
1098
1137
|
});
|
|
1099
|
-
}
|
|
1100
|
-
|
|
1138
|
+
});
|
|
1139
|
+
const processedBlock = createMemo4(() => {
|
|
1101
1140
|
return props.block.repeat?.collection ? props.block : getProcessedBlock({
|
|
1102
1141
|
block: props.block,
|
|
1103
1142
|
localState: props.context.localState,
|
|
@@ -1106,15 +1145,15 @@ function Block(props) {
|
|
|
1106
1145
|
context: props.context.context,
|
|
1107
1146
|
shouldEvaluateBindings: true
|
|
1108
1147
|
});
|
|
1109
|
-
}
|
|
1110
|
-
|
|
1148
|
+
});
|
|
1149
|
+
const Tag = createMemo4(() => {
|
|
1111
1150
|
const shouldUseLink = props.block.tagName === "a" || processedBlock().properties?.href || processedBlock().href;
|
|
1112
1151
|
if (shouldUseLink) {
|
|
1113
1152
|
return props.linkComponent || "a";
|
|
1114
1153
|
}
|
|
1115
1154
|
return props.block.tagName || "div";
|
|
1116
|
-
}
|
|
1117
|
-
|
|
1155
|
+
});
|
|
1156
|
+
const canShowBlock = createMemo4(() => {
|
|
1118
1157
|
if (props.block.repeat?.collection) {
|
|
1119
1158
|
if (repeatItem()?.length)
|
|
1120
1159
|
return true;
|
|
@@ -1123,12 +1162,12 @@ function Block(props) {
|
|
|
1123
1162
|
const shouldHide = "hide" in processedBlock() ? processedBlock().hide : false;
|
|
1124
1163
|
const shouldShow = "show" in processedBlock() ? processedBlock().show : true;
|
|
1125
1164
|
return shouldShow && !shouldHide;
|
|
1126
|
-
}
|
|
1127
|
-
|
|
1165
|
+
});
|
|
1166
|
+
const childrenWithoutParentComponent = createMemo4(() => {
|
|
1128
1167
|
const shouldRenderChildrenOutsideRef = !blockComponent()?.component && !repeatItem();
|
|
1129
1168
|
return shouldRenderChildrenOutsideRef ? processedBlock().children ?? [] : [];
|
|
1130
|
-
}
|
|
1131
|
-
|
|
1169
|
+
});
|
|
1170
|
+
const componentRefProps = createMemo4(() => {
|
|
1132
1171
|
return {
|
|
1133
1172
|
blockChildren: processedBlock().children ?? [],
|
|
1134
1173
|
componentRef: blockComponent()?.component,
|
|
@@ -1142,14 +1181,14 @@ function Block(props) {
|
|
|
1142
1181
|
builderComponents: props.registeredComponents
|
|
1143
1182
|
} : {}
|
|
1144
1183
|
},
|
|
1145
|
-
context:
|
|
1184
|
+
context: props.context,
|
|
1146
1185
|
linkComponent: props.linkComponent,
|
|
1147
1186
|
registeredComponents: props.registeredComponents,
|
|
1148
1187
|
builderBlock: processedBlock(),
|
|
1149
1188
|
includeBlockProps: blockComponent()?.noWrap === true,
|
|
1150
1189
|
isInteractive: !blockComponent()?.isRSC
|
|
1151
1190
|
};
|
|
1152
|
-
}
|
|
1191
|
+
});
|
|
1153
1192
|
onMount(() => {
|
|
1154
1193
|
const blockId = processedBlock().id;
|
|
1155
1194
|
const animations = processedBlock().animations;
|
|
@@ -1211,9 +1250,9 @@ function Block(props) {
|
|
|
1211
1250
|
return <Block
|
|
1212
1251
|
key={child.id}
|
|
1213
1252
|
block={child}
|
|
1214
|
-
context={childrenContext()}
|
|
1215
1253
|
registeredComponents={props.registeredComponents}
|
|
1216
1254
|
linkComponent={props.linkComponent}
|
|
1255
|
+
context={props.context}
|
|
1217
1256
|
/>;
|
|
1218
1257
|
}}</For2>
|
|
1219
1258
|
</Block_wrapper_default></Show4></Show4>
|
|
@@ -1222,12 +1261,13 @@ function Block(props) {
|
|
|
1222
1261
|
var Block_default = Block;
|
|
1223
1262
|
|
|
1224
1263
|
// src/components/blocks/blocks-wrapper.tsx
|
|
1264
|
+
import { createMemo as createMemo5 } from "solid-js";
|
|
1225
1265
|
import { Dynamic as Dynamic4 } from "solid-js/web";
|
|
1226
1266
|
import { css } from "solid-styled-components";
|
|
1227
1267
|
function BlocksWrapper(props) {
|
|
1228
|
-
|
|
1268
|
+
const className = createMemo5(() => {
|
|
1229
1269
|
return "builder-blocks" + (!props.blocks?.length ? " no-blocks" : "");
|
|
1230
|
-
}
|
|
1270
|
+
});
|
|
1231
1271
|
function onClick() {
|
|
1232
1272
|
if (isEditing() && !props.blocks?.length) {
|
|
1233
1273
|
window.parent?.postMessage(
|
|
@@ -1301,12 +1341,12 @@ var Blocks_default = Blocks;
|
|
|
1301
1341
|
|
|
1302
1342
|
// src/blocks/columns/columns.tsx
|
|
1303
1343
|
function Columns(props) {
|
|
1304
|
-
const [gutterSize, setGutterSize] =
|
|
1344
|
+
const [gutterSize, setGutterSize] = createSignal6(
|
|
1305
1345
|
typeof props.space === "number" ? props.space || 0 : 20
|
|
1306
1346
|
);
|
|
1307
|
-
const [cols, setCols] =
|
|
1308
|
-
const [stackAt, setStackAt] =
|
|
1309
|
-
const [flexDir, setFlexDir] =
|
|
1347
|
+
const [cols, setCols] = createSignal6(props.columns || []);
|
|
1348
|
+
const [stackAt, setStackAt] = createSignal6(props.stackColumnsAt || "tablet");
|
|
1349
|
+
const [flexDir, setFlexDir] = createSignal6(
|
|
1310
1350
|
props.stackColumnsAt === "never" ? "row" : props.reverseColumnsWhenStacked ? "column-reverse" : "column"
|
|
1311
1351
|
);
|
|
1312
1352
|
function getWidth(index) {
|
|
@@ -1328,7 +1368,7 @@ function Columns(props) {
|
|
|
1328
1368
|
}) {
|
|
1329
1369
|
return stackAt() === "never" ? desktopStyle : stackedStyle;
|
|
1330
1370
|
}
|
|
1331
|
-
|
|
1371
|
+
const columnsCssVars = createMemo6(() => {
|
|
1332
1372
|
return {
|
|
1333
1373
|
"--flex-dir": flexDir(),
|
|
1334
1374
|
"--flex-dir-tablet": getTabletStyle({
|
|
@@ -1336,7 +1376,7 @@ function Columns(props) {
|
|
|
1336
1376
|
desktopStyle: "row"
|
|
1337
1377
|
})
|
|
1338
1378
|
};
|
|
1339
|
-
}
|
|
1379
|
+
});
|
|
1340
1380
|
function columnCssVars(index) {
|
|
1341
1381
|
const gutter = index === 0 ? 0 : gutterSize();
|
|
1342
1382
|
const width = getColumnCssWidth(index);
|
|
@@ -1377,7 +1417,7 @@ function Columns(props) {
|
|
|
1377
1417
|
);
|
|
1378
1418
|
return breakpointSizes[size].max;
|
|
1379
1419
|
}
|
|
1380
|
-
|
|
1420
|
+
const columnsStyles = createMemo6(() => {
|
|
1381
1421
|
return `
|
|
1382
1422
|
@media (max-width: ${getWidthForBreakpointSize("medium")}px) {
|
|
1383
1423
|
.${props.builderBlock.id}-breakpoints {
|
|
@@ -1403,7 +1443,7 @@ function Columns(props) {
|
|
|
1403
1443
|
}
|
|
1404
1444
|
},
|
|
1405
1445
|
`;
|
|
1406
|
-
}
|
|
1446
|
+
});
|
|
1407
1447
|
return <div
|
|
1408
1448
|
class={`builder-columns ${props.builderBlock.id}-breakpoints ` + css2({
|
|
1409
1449
|
display: "flex",
|
|
@@ -1450,7 +1490,7 @@ function FragmentComponent(props) {
|
|
|
1450
1490
|
var fragment_default = FragmentComponent;
|
|
1451
1491
|
|
|
1452
1492
|
// src/blocks/image/image.tsx
|
|
1453
|
-
import { Show as Show7 } from "solid-js";
|
|
1493
|
+
import { Show as Show7, createMemo as createMemo7 } from "solid-js";
|
|
1454
1494
|
import { css as css3 } from "solid-styled-components";
|
|
1455
1495
|
|
|
1456
1496
|
// src/blocks/image/image.helpers.ts
|
|
@@ -1502,7 +1542,7 @@ function getSrcSet(url) {
|
|
|
1502
1542
|
|
|
1503
1543
|
// src/blocks/image/image.tsx
|
|
1504
1544
|
function Image(props) {
|
|
1505
|
-
|
|
1545
|
+
const srcSetToUse = createMemo7(() => {
|
|
1506
1546
|
const imageToUse = props.image || props.src;
|
|
1507
1547
|
const url = imageToUse;
|
|
1508
1548
|
if (!url || // We can auto add srcset for cdn.builder.io and shopify
|
|
@@ -1518,15 +1558,15 @@ function Image(props) {
|
|
|
1518
1558
|
return getSrcSet(url);
|
|
1519
1559
|
}
|
|
1520
1560
|
return getSrcSet(url);
|
|
1521
|
-
}
|
|
1522
|
-
|
|
1561
|
+
});
|
|
1562
|
+
const webpSrcSet = createMemo7(() => {
|
|
1523
1563
|
if (srcSetToUse()?.match(/builder\.io/) && !props.noWebp) {
|
|
1524
1564
|
return srcSetToUse().replace(/\?/g, "?format=webp&");
|
|
1525
1565
|
} else {
|
|
1526
1566
|
return "";
|
|
1527
1567
|
}
|
|
1528
|
-
}
|
|
1529
|
-
|
|
1568
|
+
});
|
|
1569
|
+
const aspectRatioCss = createMemo7(() => {
|
|
1530
1570
|
const aspectRatioStyles = {
|
|
1531
1571
|
position: "absolute",
|
|
1532
1572
|
height: "100%",
|
|
@@ -1536,7 +1576,7 @@ function Image(props) {
|
|
|
1536
1576
|
};
|
|
1537
1577
|
const out = props.aspectRatio ? aspectRatioStyles : void 0;
|
|
1538
1578
|
return out;
|
|
1539
|
-
}
|
|
1579
|
+
});
|
|
1540
1580
|
return <>
|
|
1541
1581
|
<picture>
|
|
1542
1582
|
<Show7 when={webpSrcSet()}><source type="image/webp" srcset={webpSrcSet()} /></Show7>
|
|
@@ -1609,10 +1649,10 @@ function SectionComponent(props) {
|
|
|
1609
1649
|
var section_default = SectionComponent;
|
|
1610
1650
|
|
|
1611
1651
|
// src/blocks/symbol/symbol.tsx
|
|
1612
|
-
import { onMount as onMount5, on as on3, createEffect as createEffect3, createSignal as
|
|
1652
|
+
import { onMount as onMount5, on as on3, createEffect as createEffect3, createMemo as createMemo16, createSignal as createSignal16 } from "solid-js";
|
|
1613
1653
|
|
|
1614
1654
|
// src/components/content-variants/content-variants.tsx
|
|
1615
|
-
import { Show as Show12, For as For7, onMount as onMount4, createSignal as
|
|
1655
|
+
import { Show as Show12, For as For7, onMount as onMount4, createSignal as createSignal15, createMemo as createMemo15 } from "solid-js";
|
|
1616
1656
|
|
|
1617
1657
|
// src/helpers/url.ts
|
|
1618
1658
|
var getTopLevelDomain = (host) => {
|
|
@@ -1806,7 +1846,7 @@ var handleABTesting = async ({
|
|
|
1806
1846
|
var getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : true;
|
|
1807
1847
|
|
|
1808
1848
|
// src/components/content/content.tsx
|
|
1809
|
-
import { Show as Show11, createSignal as
|
|
1849
|
+
import { Show as Show11, createSignal as createSignal14 } from "solid-js";
|
|
1810
1850
|
|
|
1811
1851
|
// src/blocks/button/component-info.ts
|
|
1812
1852
|
var componentInfo = {
|
|
@@ -2366,10 +2406,10 @@ var componentInfo9 = {
|
|
|
2366
2406
|
};
|
|
2367
2407
|
|
|
2368
2408
|
// src/blocks/custom-code/custom-code.tsx
|
|
2369
|
-
import { onMount as onMount2, createSignal as
|
|
2409
|
+
import { onMount as onMount2, createSignal as createSignal8 } from "solid-js";
|
|
2370
2410
|
function CustomCode(props) {
|
|
2371
|
-
const [scriptsInserted, setScriptsInserted] =
|
|
2372
|
-
const [scriptsRun, setScriptsRun] =
|
|
2411
|
+
const [scriptsInserted, setScriptsInserted] = createSignal8([]);
|
|
2412
|
+
const [scriptsRun, setScriptsRun] = createSignal8([]);
|
|
2373
2413
|
let elementRef;
|
|
2374
2414
|
onMount2(() => {
|
|
2375
2415
|
if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
|
|
@@ -2450,7 +2490,7 @@ var componentInfo10 = {
|
|
|
2450
2490
|
};
|
|
2451
2491
|
|
|
2452
2492
|
// src/blocks/embed/embed.tsx
|
|
2453
|
-
import { on, createEffect, createSignal as
|
|
2493
|
+
import { on, createEffect, createMemo as createMemo9, createSignal as createSignal9 } from "solid-js";
|
|
2454
2494
|
|
|
2455
2495
|
// src/blocks/embed/helpers.ts
|
|
2456
2496
|
var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"];
|
|
@@ -2458,9 +2498,9 @@ var isJsScript = (script) => SCRIPT_MIME_TYPES.includes(script.type);
|
|
|
2458
2498
|
|
|
2459
2499
|
// src/blocks/embed/embed.tsx
|
|
2460
2500
|
function Embed(props) {
|
|
2461
|
-
const [scriptsInserted, setScriptsInserted] =
|
|
2462
|
-
const [scriptsRun, setScriptsRun] =
|
|
2463
|
-
const [ranInitFn, setRanInitFn] =
|
|
2501
|
+
const [scriptsInserted, setScriptsInserted] = createSignal9([]);
|
|
2502
|
+
const [scriptsRun, setScriptsRun] = createSignal9([]);
|
|
2503
|
+
const [ranInitFn, setRanInitFn] = createSignal9(false);
|
|
2464
2504
|
function findAndRunScripts() {
|
|
2465
2505
|
if (!elem || !elem.getElementsByTagName)
|
|
2466
2506
|
return;
|
|
@@ -2483,13 +2523,17 @@ function Embed(props) {
|
|
|
2483
2523
|
}
|
|
2484
2524
|
}
|
|
2485
2525
|
let elem;
|
|
2526
|
+
const onUpdateFn_0_elem = createMemo9(() => elem);
|
|
2527
|
+
const onUpdateFn_0_ranInitFn__ = createMemo9(() => ranInitFn());
|
|
2486
2528
|
function onUpdateFn_0() {
|
|
2487
2529
|
if (elem && !ranInitFn()) {
|
|
2488
2530
|
setRanInitFn(true);
|
|
2489
2531
|
findAndRunScripts();
|
|
2490
2532
|
}
|
|
2491
2533
|
}
|
|
2492
|
-
createEffect(
|
|
2534
|
+
createEffect(
|
|
2535
|
+
on(() => [onUpdateFn_0_elem(), onUpdateFn_0_ranInitFn__()], onUpdateFn_0)
|
|
2536
|
+
);
|
|
2493
2537
|
return <div class="builder-embed" ref={elem} innerHTML={props.content} />;
|
|
2494
2538
|
}
|
|
2495
2539
|
var embed_default = Embed;
|
|
@@ -2729,7 +2773,7 @@ var componentInfo11 = {
|
|
|
2729
2773
|
};
|
|
2730
2774
|
|
|
2731
2775
|
// src/blocks/form/form/form.tsx
|
|
2732
|
-
import { Show as Show8, For as For5, createSignal as
|
|
2776
|
+
import { Show as Show8, For as For5, createSignal as createSignal10 } from "solid-js";
|
|
2733
2777
|
import { css as css4 } from "solid-styled-components";
|
|
2734
2778
|
|
|
2735
2779
|
// src/functions/get-env.ts
|
|
@@ -2747,9 +2791,9 @@ var get = (obj, path, defaultValue) => {
|
|
|
2747
2791
|
|
|
2748
2792
|
// src/blocks/form/form/form.tsx
|
|
2749
2793
|
function FormComponent(props) {
|
|
2750
|
-
const [formState, setFormState] =
|
|
2751
|
-
const [responseData, setResponseData] =
|
|
2752
|
-
const [formErrorMessage, setFormErrorMessage] =
|
|
2794
|
+
const [formState, setFormState] = createSignal10("unsubmitted");
|
|
2795
|
+
const [responseData, setResponseData] = createSignal10(null);
|
|
2796
|
+
const [formErrorMessage, setFormErrorMessage] = createSignal10("");
|
|
2753
2797
|
function mergeNewRootState(newData) {
|
|
2754
2798
|
const combinedState = {
|
|
2755
2799
|
...props.builderContext.rootState,
|
|
@@ -3265,9 +3309,9 @@ var componentInfo16 = {
|
|
|
3265
3309
|
};
|
|
3266
3310
|
|
|
3267
3311
|
// src/blocks/video/video.tsx
|
|
3268
|
-
import { Show as Show9 } from "solid-js";
|
|
3312
|
+
import { Show as Show9, createMemo as createMemo11 } from "solid-js";
|
|
3269
3313
|
function Video(props) {
|
|
3270
|
-
|
|
3314
|
+
const videoProps = createMemo11(() => {
|
|
3271
3315
|
return {
|
|
3272
3316
|
...props.autoPlay === true ? {
|
|
3273
3317
|
autoPlay: true
|
|
@@ -3285,12 +3329,12 @@ function Video(props) {
|
|
|
3285
3329
|
playsInline: true
|
|
3286
3330
|
} : {}
|
|
3287
3331
|
};
|
|
3288
|
-
}
|
|
3289
|
-
|
|
3332
|
+
});
|
|
3333
|
+
const spreadProps = createMemo11(() => {
|
|
3290
3334
|
return {
|
|
3291
3335
|
...videoProps()
|
|
3292
3336
|
};
|
|
3293
|
-
}
|
|
3337
|
+
});
|
|
3294
3338
|
return <div
|
|
3295
3339
|
style={{
|
|
3296
3340
|
position: "relative"
|
|
@@ -3480,7 +3524,14 @@ function InlinedScript(props) {
|
|
|
3480
3524
|
var Inlined_script_default = InlinedScript;
|
|
3481
3525
|
|
|
3482
3526
|
// src/components/content/components/enable-editor.tsx
|
|
3483
|
-
import {
|
|
3527
|
+
import {
|
|
3528
|
+
Show as Show10,
|
|
3529
|
+
onMount as onMount3,
|
|
3530
|
+
on as on2,
|
|
3531
|
+
createEffect as createEffect2,
|
|
3532
|
+
createMemo as createMemo12,
|
|
3533
|
+
createSignal as createSignal12
|
|
3534
|
+
} from "solid-js";
|
|
3484
3535
|
import { Dynamic as Dynamic5 } from "solid-js/web";
|
|
3485
3536
|
|
|
3486
3537
|
// src/helpers/preview-lru-cache/get.ts
|
|
@@ -3963,7 +4014,7 @@ function isFromTrustedHost(trustedHosts, e) {
|
|
|
3963
4014
|
}
|
|
3964
4015
|
|
|
3965
4016
|
// src/constants/sdk-version.ts
|
|
3966
|
-
var SDK_VERSION = "0.
|
|
4017
|
+
var SDK_VERSION = "1.0.13";
|
|
3967
4018
|
|
|
3968
4019
|
// src/functions/register.ts
|
|
3969
4020
|
var registry = {};
|
|
@@ -4161,15 +4212,15 @@ var subscribeToEditor = (model, callback, options) => {
|
|
|
4161
4212
|
|
|
4162
4213
|
// src/components/content/components/enable-editor.tsx
|
|
4163
4214
|
function EnableEditor(props) {
|
|
4164
|
-
const [forceReRenderCount, setForceReRenderCount] =
|
|
4165
|
-
const [firstRender, setFirstRender] =
|
|
4166
|
-
const [lastUpdated, setLastUpdated] =
|
|
4167
|
-
const [shouldSendResetCookie, setShouldSendResetCookie] =
|
|
4168
|
-
const [ContentWrapper, setContentWrapper] =
|
|
4215
|
+
const [forceReRenderCount, setForceReRenderCount] = createSignal12(0);
|
|
4216
|
+
const [firstRender, setFirstRender] = createSignal12(true);
|
|
4217
|
+
const [lastUpdated, setLastUpdated] = createSignal12(0);
|
|
4218
|
+
const [shouldSendResetCookie, setShouldSendResetCookie] = createSignal12(false);
|
|
4219
|
+
const [ContentWrapper, setContentWrapper] = createSignal12(
|
|
4169
4220
|
props.contentWrapper || "div"
|
|
4170
4221
|
);
|
|
4171
|
-
const [httpReqsData, setHttpReqsData] =
|
|
4172
|
-
const [clicked, setClicked] =
|
|
4222
|
+
const [httpReqsData, setHttpReqsData] = createSignal12({});
|
|
4223
|
+
const [clicked, setClicked] = createSignal12(false);
|
|
4173
4224
|
function mergeNewRootState(newData) {
|
|
4174
4225
|
const combinedState = {
|
|
4175
4226
|
...props.builderContextSignal.rootState,
|
|
@@ -4240,7 +4291,11 @@ function EnableEditor(props) {
|
|
|
4240
4291
|
context: props.context || {},
|
|
4241
4292
|
localState: void 0,
|
|
4242
4293
|
rootState: props.builderContextSignal.rootState,
|
|
4243
|
-
rootSetState: props.builderContextSignal.rootSetState
|
|
4294
|
+
rootSetState: props.builderContextSignal.rootSetState,
|
|
4295
|
+
/**
|
|
4296
|
+
* We don't want to cache the result of the JS code, since it's arbitrary side effect code.
|
|
4297
|
+
*/
|
|
4298
|
+
enableCache: false
|
|
4244
4299
|
});
|
|
4245
4300
|
}
|
|
4246
4301
|
}
|
|
@@ -4265,13 +4320,16 @@ function EnableEditor(props) {
|
|
|
4265
4320
|
function evalExpression(expression) {
|
|
4266
4321
|
return expression.replace(
|
|
4267
4322
|
/{{([^}]+)}}/g,
|
|
4268
|
-
(_match, group) =>
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4323
|
+
(_match, group) => String(
|
|
4324
|
+
evaluate({
|
|
4325
|
+
code: group,
|
|
4326
|
+
context: props.context || {},
|
|
4327
|
+
localState: void 0,
|
|
4328
|
+
rootState: props.builderContextSignal.rootState,
|
|
4329
|
+
rootSetState: props.builderContextSignal.rootSetState,
|
|
4330
|
+
enableCache: true
|
|
4331
|
+
})
|
|
4332
|
+
)
|
|
4275
4333
|
);
|
|
4276
4334
|
}
|
|
4277
4335
|
function handleRequest({ url, key }) {
|
|
@@ -4387,40 +4445,63 @@ function EnableEditor(props) {
|
|
|
4387
4445
|
runHttpRequests();
|
|
4388
4446
|
emitStateUpdate();
|
|
4389
4447
|
});
|
|
4448
|
+
const onUpdateFn_0_props_content = createMemo12(() => props.content);
|
|
4390
4449
|
function onUpdateFn_0() {
|
|
4391
4450
|
if (props.content) {
|
|
4392
4451
|
mergeNewContent(props.content);
|
|
4393
4452
|
}
|
|
4394
4453
|
}
|
|
4395
|
-
createEffect2(on2(() => [
|
|
4454
|
+
createEffect2(on2(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
|
|
4455
|
+
const onUpdateFn_1_shouldSendResetCookie__ = createMemo12(
|
|
4456
|
+
() => shouldSendResetCookie()
|
|
4457
|
+
);
|
|
4396
4458
|
function onUpdateFn_1() {
|
|
4397
4459
|
}
|
|
4398
|
-
createEffect2(
|
|
4460
|
+
createEffect2(
|
|
4461
|
+
on2(() => [onUpdateFn_1_shouldSendResetCookie__()], onUpdateFn_1)
|
|
4462
|
+
);
|
|
4463
|
+
const onUpdateFn_2_props_builderContextSignal_content__data__jsCode = createMemo12(() => props.builderContextSignal.content?.data?.jsCode);
|
|
4399
4464
|
function onUpdateFn_2() {
|
|
4400
4465
|
evaluateJsCode();
|
|
4401
4466
|
}
|
|
4402
4467
|
createEffect2(
|
|
4403
|
-
on2(
|
|
4468
|
+
on2(
|
|
4469
|
+
() => [onUpdateFn_2_props_builderContextSignal_content__data__jsCode()],
|
|
4470
|
+
onUpdateFn_2
|
|
4471
|
+
)
|
|
4404
4472
|
);
|
|
4473
|
+
const onUpdateFn_3_props_builderContextSignal_content__data__httpRequests = createMemo12(() => props.builderContextSignal.content?.data?.httpRequests);
|
|
4405
4474
|
function onUpdateFn_3() {
|
|
4406
4475
|
runHttpRequests();
|
|
4407
4476
|
}
|
|
4408
4477
|
createEffect2(
|
|
4409
4478
|
on2(
|
|
4410
|
-
() => [
|
|
4479
|
+
() => [
|
|
4480
|
+
onUpdateFn_3_props_builderContextSignal_content__data__httpRequests()
|
|
4481
|
+
],
|
|
4411
4482
|
onUpdateFn_3
|
|
4412
4483
|
)
|
|
4413
4484
|
);
|
|
4485
|
+
const onUpdateFn_4_props_builderContextSignal_rootState = createMemo12(
|
|
4486
|
+
() => props.builderContextSignal.rootState
|
|
4487
|
+
);
|
|
4414
4488
|
function onUpdateFn_4() {
|
|
4415
4489
|
emitStateUpdate();
|
|
4416
4490
|
}
|
|
4417
|
-
createEffect2(
|
|
4491
|
+
createEffect2(
|
|
4492
|
+
on2(
|
|
4493
|
+
() => [onUpdateFn_4_props_builderContextSignal_rootState()],
|
|
4494
|
+
onUpdateFn_4
|
|
4495
|
+
)
|
|
4496
|
+
);
|
|
4497
|
+
const onUpdateFn_5_props_data = createMemo12(() => props.data);
|
|
4418
4498
|
function onUpdateFn_5() {
|
|
4419
4499
|
if (props.data) {
|
|
4420
4500
|
mergeNewRootState(props.data);
|
|
4421
4501
|
}
|
|
4422
4502
|
}
|
|
4423
|
-
createEffect2(on2(() => [
|
|
4503
|
+
createEffect2(on2(() => [onUpdateFn_5_props_data()], onUpdateFn_5));
|
|
4504
|
+
const onUpdateFn_6_props_locale = createMemo12(() => props.locale);
|
|
4424
4505
|
function onUpdateFn_6() {
|
|
4425
4506
|
if (props.locale) {
|
|
4426
4507
|
mergeNewRootState({
|
|
@@ -4428,7 +4509,7 @@ function EnableEditor(props) {
|
|
|
4428
4509
|
});
|
|
4429
4510
|
}
|
|
4430
4511
|
}
|
|
4431
|
-
createEffect2(on2(() => [
|
|
4512
|
+
createEffect2(on2(() => [onUpdateFn_6_props_locale()], onUpdateFn_6));
|
|
4432
4513
|
return <builder_context_default.Provider value={props.builderContextSignal}><Show10 when={props.builderContextSignal.content}><Dynamic5
|
|
4433
4514
|
class={`variant-${props.content?.testVariationId || props.content?.id}`}
|
|
4434
4515
|
{...{}}
|
|
@@ -4449,7 +4530,7 @@ function EnableEditor(props) {
|
|
|
4449
4530
|
var Enable_editor_default = EnableEditor;
|
|
4450
4531
|
|
|
4451
4532
|
// src/components/content/components/styles.tsx
|
|
4452
|
-
import { createSignal as
|
|
4533
|
+
import { createSignal as createSignal13 } from "solid-js";
|
|
4453
4534
|
|
|
4454
4535
|
// src/components/content/components/styles.helpers.ts
|
|
4455
4536
|
var getCssFromFont = (font) => {
|
|
@@ -4505,19 +4586,7 @@ var getCss = ({
|
|
|
4505
4586
|
}
|
|
4506
4587
|
return cssCode?.replace(/&/g, `div[builder-content-id="${contentId}"]`) || "";
|
|
4507
4588
|
};
|
|
4508
|
-
|
|
4509
|
-
// src/components/content/components/styles.tsx
|
|
4510
|
-
function ContentStyles(props) {
|
|
4511
|
-
const [injectedStyles, setInjectedStyles] = createSignal12(
|
|
4512
|
-
`
|
|
4513
|
-
${getCss({
|
|
4514
|
-
cssCode: props.cssCode,
|
|
4515
|
-
contentId: props.contentId
|
|
4516
|
-
})}
|
|
4517
|
-
${getFontCss({
|
|
4518
|
-
customFonts: props.customFonts
|
|
4519
|
-
})}
|
|
4520
|
-
|
|
4589
|
+
var DEFAULT_STYLES = `
|
|
4521
4590
|
.builder-button {
|
|
4522
4591
|
all: unset;
|
|
4523
4592
|
}
|
|
@@ -4534,6 +4603,23 @@ ${getFontCss({
|
|
|
4534
4603
|
text-align: inherit;
|
|
4535
4604
|
font-family: inherit;
|
|
4536
4605
|
}
|
|
4606
|
+
`;
|
|
4607
|
+
var getDefaultStyles = (isNested) => {
|
|
4608
|
+
return !isNested ? DEFAULT_STYLES : "";
|
|
4609
|
+
};
|
|
4610
|
+
|
|
4611
|
+
// src/components/content/components/styles.tsx
|
|
4612
|
+
function ContentStyles(props) {
|
|
4613
|
+
const [injectedStyles, setInjectedStyles] = createSignal13(
|
|
4614
|
+
`
|
|
4615
|
+
${getCss({
|
|
4616
|
+
cssCode: props.cssCode,
|
|
4617
|
+
contentId: props.contentId
|
|
4618
|
+
})}
|
|
4619
|
+
${getFontCss({
|
|
4620
|
+
customFonts: props.customFonts
|
|
4621
|
+
})}
|
|
4622
|
+
${getDefaultStyles(props.isNestedRender)}
|
|
4537
4623
|
`.trim()
|
|
4538
4624
|
);
|
|
4539
4625
|
return <Inlined_styles_default styles={injectedStyles()} />;
|
|
@@ -4578,7 +4664,7 @@ var getContentInitialValue = ({
|
|
|
4578
4664
|
|
|
4579
4665
|
// src/components/content/content.tsx
|
|
4580
4666
|
function ContentComponent(props) {
|
|
4581
|
-
const [scriptStr, setScriptStr] =
|
|
4667
|
+
const [scriptStr, setScriptStr] = createSignal14(
|
|
4582
4668
|
getUpdateVariantVisibilityScript({
|
|
4583
4669
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
4584
4670
|
variationId: props.content?.testVariationId,
|
|
@@ -4586,7 +4672,7 @@ function ContentComponent(props) {
|
|
|
4586
4672
|
contentId: props.content?.id
|
|
4587
4673
|
})
|
|
4588
4674
|
);
|
|
4589
|
-
const [registeredComponents, setRegisteredComponents] =
|
|
4675
|
+
const [registeredComponents, setRegisteredComponents] = createSignal14(
|
|
4590
4676
|
[
|
|
4591
4677
|
...getDefaultRegisteredComponents(),
|
|
4592
4678
|
...props.customComponents || []
|
|
@@ -4601,7 +4687,7 @@ function ContentComponent(props) {
|
|
|
4601
4687
|
{}
|
|
4602
4688
|
)
|
|
4603
4689
|
);
|
|
4604
|
-
const [builderContextSignal, setBuilderContextSignal] =
|
|
4690
|
+
const [builderContextSignal, setBuilderContextSignal] = createSignal14({
|
|
4605
4691
|
content: getContentInitialValue({
|
|
4606
4692
|
content: props.content,
|
|
4607
4693
|
data: props.data
|
|
@@ -4661,6 +4747,7 @@ function ContentComponent(props) {
|
|
|
4661
4747
|
>
|
|
4662
4748
|
<Show11 when={props.isSsrAbTest}><Inlined_script_default scriptStr={scriptStr()} /></Show11>
|
|
4663
4749
|
<Show11 when={TARGET !== "reactNative"}><Styles_default
|
|
4750
|
+
isNestedRender={props.isNestedRender}
|
|
4664
4751
|
contentId={builderContextSignal().content?.id}
|
|
4665
4752
|
cssCode={builderContextSignal().content?.data?.cssCode}
|
|
4666
4753
|
customFonts={builderContextSignal().content?.data?.customFonts}
|
|
@@ -4677,13 +4764,13 @@ var Content_default = ContentComponent;
|
|
|
4677
4764
|
|
|
4678
4765
|
// src/components/content-variants/content-variants.tsx
|
|
4679
4766
|
function ContentVariants(props) {
|
|
4680
|
-
const [shouldRenderVariants, setShouldRenderVariants] =
|
|
4767
|
+
const [shouldRenderVariants, setShouldRenderVariants] = createSignal15(
|
|
4681
4768
|
checkShouldRenderVariants({
|
|
4682
4769
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
4683
4770
|
content: props.content
|
|
4684
4771
|
})
|
|
4685
4772
|
);
|
|
4686
|
-
|
|
4773
|
+
const updateCookieAndStylesScriptStr = createMemo15(() => {
|
|
4687
4774
|
return getUpdateCookieAndStylesScript(
|
|
4688
4775
|
getVariants(props.content).map((value) => ({
|
|
4689
4776
|
id: value.testVariationId,
|
|
@@ -4691,11 +4778,11 @@ function ContentVariants(props) {
|
|
|
4691
4778
|
})),
|
|
4692
4779
|
props.content?.id || ""
|
|
4693
4780
|
);
|
|
4694
|
-
}
|
|
4695
|
-
|
|
4781
|
+
});
|
|
4782
|
+
const hideVariantsStyleString = createMemo15(() => {
|
|
4696
4783
|
return getVariants(props.content).map((value) => `.variant-${value.testVariationId} { display: none; } `).join("");
|
|
4697
|
-
}
|
|
4698
|
-
|
|
4784
|
+
});
|
|
4785
|
+
const defaultContent = createMemo15(() => {
|
|
4699
4786
|
return shouldRenderVariants() ? {
|
|
4700
4787
|
...props.content,
|
|
4701
4788
|
testVariationId: props.content?.id
|
|
@@ -4703,12 +4790,12 @@ function ContentVariants(props) {
|
|
|
4703
4790
|
item: props.content,
|
|
4704
4791
|
canTrack: getDefaultCanTrack(props.canTrack)
|
|
4705
4792
|
});
|
|
4706
|
-
}
|
|
4793
|
+
});
|
|
4707
4794
|
onMount4(() => {
|
|
4708
4795
|
setShouldRenderVariants(false);
|
|
4709
4796
|
});
|
|
4710
4797
|
return <>
|
|
4711
|
-
<Show12 when={!props.
|
|
4798
|
+
<Show12 when={!props.isNestedRender && TARGET !== "reactNative"}><Inlined_script_default scriptStr={getScriptString()} /></Show12>
|
|
4712
4799
|
<Show12 when={shouldRenderVariants()}>
|
|
4713
4800
|
<Inlined_styles_default
|
|
4714
4801
|
id={`variants-styles-${props.content?.id}`}
|
|
@@ -4720,6 +4807,7 @@ function ContentVariants(props) {
|
|
|
4720
4807
|
<For7 each={getVariants(props.content)}>{(variant, _index) => {
|
|
4721
4808
|
const index = _index();
|
|
4722
4809
|
return <Content_default
|
|
4810
|
+
isNestedRender={props.isNestedRender}
|
|
4723
4811
|
key={variant.testVariationId}
|
|
4724
4812
|
content={variant}
|
|
4725
4813
|
showContent={false}
|
|
@@ -4743,6 +4831,7 @@ function ContentVariants(props) {
|
|
|
4743
4831
|
}}</For7>
|
|
4744
4832
|
</Show12>
|
|
4745
4833
|
<Content_default
|
|
4834
|
+
isNestedRender={props.isNestedRender}
|
|
4746
4835
|
{...{}}
|
|
4747
4836
|
content={defaultContent()}
|
|
4748
4837
|
showContent={true}
|
|
@@ -4793,15 +4882,15 @@ var fetchSymbolContent = async ({
|
|
|
4793
4882
|
|
|
4794
4883
|
// src/blocks/symbol/symbol.tsx
|
|
4795
4884
|
function Symbol(props) {
|
|
4796
|
-
const [contentToUse, setContentToUse] =
|
|
4797
|
-
|
|
4885
|
+
const [contentToUse, setContentToUse] = createSignal16(props.symbol?.content);
|
|
4886
|
+
const className = createMemo16(() => {
|
|
4798
4887
|
return [
|
|
4799
4888
|
...[props.attributes[getClassPropName()]],
|
|
4800
4889
|
"builder-symbol",
|
|
4801
4890
|
props.symbol?.inline ? "builder-inline-symbol" : void 0,
|
|
4802
4891
|
props.symbol?.dynamic || props.dynamic ? "builder-dynamic-symbol" : void 0
|
|
4803
4892
|
].filter(Boolean).join(" ");
|
|
4804
|
-
}
|
|
4893
|
+
});
|
|
4805
4894
|
function setContent() {
|
|
4806
4895
|
if (contentToUse())
|
|
4807
4896
|
return;
|
|
@@ -4815,14 +4904,14 @@ function Symbol(props) {
|
|
|
4815
4904
|
});
|
|
4816
4905
|
}
|
|
4817
4906
|
onMount5(() => {
|
|
4818
|
-
setContent();
|
|
4819
4907
|
});
|
|
4908
|
+
const onUpdateFn_0_props_symbol = createMemo16(() => props.symbol);
|
|
4820
4909
|
function onUpdateFn_0() {
|
|
4821
4910
|
setContent();
|
|
4822
4911
|
}
|
|
4823
|
-
createEffect3(on3(() => [
|
|
4912
|
+
createEffect3(on3(() => [onUpdateFn_0_props_symbol()], onUpdateFn_0));
|
|
4824
4913
|
return <div class={className()} {...{}} {...props.attributes} {...{}}><Content_variants_default
|
|
4825
|
-
|
|
4914
|
+
isNestedRender={true}
|
|
4826
4915
|
apiVersion={props.builderContext.apiVersion}
|
|
4827
4916
|
apiKey={props.builderContext.apiKey}
|
|
4828
4917
|
context={{
|