@builder.io/sdk-solid 0.14.5 → 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/browser/dev.js +188 -135
- package/lib/browser/dev.jsx +255 -174
- package/lib/browser/index.js +188 -135
- package/lib/browser/index.jsx +255 -174
- package/lib/edge/dev.js +188 -135
- package/lib/edge/dev.jsx +255 -174
- package/lib/edge/index.js +188 -135
- package/lib/edge/index.jsx +255 -174
- package/lib/node/dev.js +188 -135
- package/lib/node/dev.jsx +255 -174
- package/lib/node/index.js +188 -135
- package/lib/node/index.jsx +255 -174
- package/package.json +1 -1
package/lib/browser/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,
|
|
@@ -320,6 +320,30 @@ var shouldForceBrowserRuntimeInNode = () => {
|
|
|
320
320
|
var chooseBrowserOrServerEval = (args) => isBrowser() || shouldForceBrowserRuntimeInNode() ? runInBrowser(args) : runInBrowser(args);
|
|
321
321
|
|
|
322
322
|
// src/functions/evaluate/evaluate.ts
|
|
323
|
+
var EvalCache = class _EvalCache {
|
|
324
|
+
static cacheLimit = 20;
|
|
325
|
+
static cache = /* @__PURE__ */ new Map();
|
|
326
|
+
static getCacheKey(args) {
|
|
327
|
+
return JSON.stringify({
|
|
328
|
+
...args,
|
|
329
|
+
// replace the event with a random number to break cache
|
|
330
|
+
// thats because we can't serialize the event object due to circular refs in DOM node refs.
|
|
331
|
+
event: args.event ? Math.random() : void 0
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
static getCachedValue(key) {
|
|
335
|
+
const cachedVal = _EvalCache.cache.get(key);
|
|
336
|
+
return cachedVal;
|
|
337
|
+
}
|
|
338
|
+
static setCachedValue(key, value) {
|
|
339
|
+
if (_EvalCache.cache.size > 20) {
|
|
340
|
+
_EvalCache.cache.delete(_EvalCache.cache.keys().next().value);
|
|
341
|
+
}
|
|
342
|
+
_EvalCache.cache.set(key, {
|
|
343
|
+
value
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
};
|
|
323
347
|
function evaluate({
|
|
324
348
|
code,
|
|
325
349
|
context,
|
|
@@ -327,11 +351,12 @@ function evaluate({
|
|
|
327
351
|
rootState,
|
|
328
352
|
rootSetState,
|
|
329
353
|
event,
|
|
330
|
-
isExpression = true
|
|
354
|
+
isExpression = true,
|
|
355
|
+
enableCache
|
|
331
356
|
}) {
|
|
332
357
|
if (code === "") {
|
|
333
358
|
logger.warn("Skipping evaluation of empty code block.");
|
|
334
|
-
return;
|
|
359
|
+
return void 0;
|
|
335
360
|
}
|
|
336
361
|
const args = {
|
|
337
362
|
code: parseCode(code, {
|
|
@@ -344,8 +369,20 @@ function evaluate({
|
|
|
344
369
|
rootState,
|
|
345
370
|
localState
|
|
346
371
|
};
|
|
372
|
+
if (enableCache) {
|
|
373
|
+
const cacheKey = EvalCache.getCacheKey(args);
|
|
374
|
+
const cachedValue = EvalCache.getCachedValue(cacheKey);
|
|
375
|
+
if (cachedValue) {
|
|
376
|
+
return cachedValue.value;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
347
379
|
try {
|
|
348
|
-
|
|
380
|
+
const newEval = chooseBrowserOrServerEval(args);
|
|
381
|
+
if (enableCache) {
|
|
382
|
+
const cacheKey = EvalCache.getCacheKey(args);
|
|
383
|
+
EvalCache.setCachedValue(cacheKey, newEval);
|
|
384
|
+
}
|
|
385
|
+
return newEval;
|
|
349
386
|
} catch (e) {
|
|
350
387
|
logger.error("Failed code evaluation: " + e.message, {
|
|
351
388
|
code
|
|
@@ -400,7 +437,8 @@ var evaluateBindings = ({
|
|
|
400
437
|
localState,
|
|
401
438
|
rootState,
|
|
402
439
|
rootSetState,
|
|
403
|
-
context
|
|
440
|
+
context,
|
|
441
|
+
enableCache: true
|
|
404
442
|
});
|
|
405
443
|
set(copied, binding, value);
|
|
406
444
|
}
|
|
@@ -634,6 +672,70 @@ function bindScrollInViewAnimation(animation) {
|
|
|
634
672
|
});
|
|
635
673
|
}
|
|
636
674
|
|
|
675
|
+
// src/functions/camel-to-kebab-case.ts
|
|
676
|
+
var camelToKebabCase = (string) => string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
|
|
677
|
+
|
|
678
|
+
// src/helpers/css.ts
|
|
679
|
+
var convertStyleMapToCSSArray = (style) => {
|
|
680
|
+
const cssProps = Object.entries(style).map(([key, value]) => {
|
|
681
|
+
if (typeof value === "string") {
|
|
682
|
+
return `${camelToKebabCase(key)}: ${value};`;
|
|
683
|
+
} else {
|
|
684
|
+
return void 0;
|
|
685
|
+
}
|
|
686
|
+
});
|
|
687
|
+
return cssProps.filter(checkIsDefined);
|
|
688
|
+
};
|
|
689
|
+
var convertStyleMapToCSS = (style) => convertStyleMapToCSSArray(style).join("\n");
|
|
690
|
+
var createCssClass = ({
|
|
691
|
+
mediaQuery,
|
|
692
|
+
className,
|
|
693
|
+
styles
|
|
694
|
+
}) => {
|
|
695
|
+
const cssClass = `.${className} {
|
|
696
|
+
${convertStyleMapToCSS(styles)}
|
|
697
|
+
}`;
|
|
698
|
+
if (mediaQuery) {
|
|
699
|
+
return `${mediaQuery} {
|
|
700
|
+
${cssClass}
|
|
701
|
+
}`;
|
|
702
|
+
} else {
|
|
703
|
+
return cssClass;
|
|
704
|
+
}
|
|
705
|
+
};
|
|
706
|
+
|
|
707
|
+
// src/functions/transform-style-property.ts
|
|
708
|
+
function transformStyleProperty({
|
|
709
|
+
style
|
|
710
|
+
}) {
|
|
711
|
+
return style;
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
// src/functions/get-style.ts
|
|
715
|
+
var getStyle = ({
|
|
716
|
+
block,
|
|
717
|
+
context
|
|
718
|
+
}) => {
|
|
719
|
+
return mapStyleObjToStrIfNeeded(transformStyleProperty({
|
|
720
|
+
style: block.style || {},
|
|
721
|
+
context,
|
|
722
|
+
block
|
|
723
|
+
}));
|
|
724
|
+
};
|
|
725
|
+
function mapStyleObjToStrIfNeeded(style) {
|
|
726
|
+
switch (TARGET) {
|
|
727
|
+
case "svelte":
|
|
728
|
+
case "vue":
|
|
729
|
+
case "solid":
|
|
730
|
+
return convertStyleMapToCSSArray(style).join(" ");
|
|
731
|
+
case "qwik":
|
|
732
|
+
case "reactNative":
|
|
733
|
+
case "react":
|
|
734
|
+
case "rsc":
|
|
735
|
+
return style;
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
|
|
637
739
|
// src/components/block/block.helpers.ts
|
|
638
740
|
var getComponent = ({
|
|
639
741
|
block,
|
|
@@ -677,7 +779,8 @@ var getRepeatItemData = ({
|
|
|
677
779
|
localState: context.localState,
|
|
678
780
|
rootState: context.rootState,
|
|
679
781
|
rootSetState: context.rootSetState,
|
|
680
|
-
context: context.context
|
|
782
|
+
context: context.context,
|
|
783
|
+
enableCache: true
|
|
681
784
|
});
|
|
682
785
|
if (!Array.isArray(itemsArray)) {
|
|
683
786
|
return void 0;
|
|
@@ -701,7 +804,7 @@ var getRepeatItemData = ({
|
|
|
701
804
|
};
|
|
702
805
|
|
|
703
806
|
// src/components/block/components/block-styles.tsx
|
|
704
|
-
import { Show as Show2 } from "solid-js";
|
|
807
|
+
import { Show as Show2, createMemo } from "solid-js";
|
|
705
808
|
|
|
706
809
|
// src/constants/device-sizes.ts
|
|
707
810
|
var SIZES = {
|
|
@@ -752,38 +855,6 @@ var getSizesForBreakpoints = ({
|
|
|
752
855
|
return newSizes;
|
|
753
856
|
};
|
|
754
857
|
|
|
755
|
-
// src/functions/camel-to-kebab-case.ts
|
|
756
|
-
var camelToKebabCase = (string) => string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
|
|
757
|
-
|
|
758
|
-
// src/helpers/css.ts
|
|
759
|
-
var convertStyleMapToCSSArray = (style) => {
|
|
760
|
-
const cssProps = Object.entries(style).map(([key, value]) => {
|
|
761
|
-
if (typeof value === "string") {
|
|
762
|
-
return `${camelToKebabCase(key)}: ${value};`;
|
|
763
|
-
} else {
|
|
764
|
-
return void 0;
|
|
765
|
-
}
|
|
766
|
-
});
|
|
767
|
-
return cssProps.filter(checkIsDefined);
|
|
768
|
-
};
|
|
769
|
-
var convertStyleMapToCSS = (style) => convertStyleMapToCSSArray(style).join("\n");
|
|
770
|
-
var createCssClass = ({
|
|
771
|
-
mediaQuery,
|
|
772
|
-
className,
|
|
773
|
-
styles
|
|
774
|
-
}) => {
|
|
775
|
-
const cssClass = `.${className} {
|
|
776
|
-
${convertStyleMapToCSS(styles)}
|
|
777
|
-
}`;
|
|
778
|
-
if (mediaQuery) {
|
|
779
|
-
return `${mediaQuery} {
|
|
780
|
-
${cssClass}
|
|
781
|
-
}`;
|
|
782
|
-
} else {
|
|
783
|
-
return cssClass;
|
|
784
|
-
}
|
|
785
|
-
};
|
|
786
|
-
|
|
787
858
|
// src/components/inlined-styles.tsx
|
|
788
859
|
function InlinedStyles(props) {
|
|
789
860
|
return <style innerHTML={props.styles} id={props.id} />;
|
|
@@ -792,7 +863,7 @@ var Inlined_styles_default = InlinedStyles;
|
|
|
792
863
|
|
|
793
864
|
// src/components/block/components/block-styles.tsx
|
|
794
865
|
function BlockStyles(props) {
|
|
795
|
-
|
|
866
|
+
const canShowBlock = createMemo(() => {
|
|
796
867
|
const processedBlock = getProcessedBlock({
|
|
797
868
|
block: props.block,
|
|
798
869
|
localState: props.context.localState,
|
|
@@ -808,8 +879,8 @@ function BlockStyles(props) {
|
|
|
808
879
|
return processedBlock.show;
|
|
809
880
|
}
|
|
810
881
|
return true;
|
|
811
|
-
}
|
|
812
|
-
|
|
882
|
+
});
|
|
883
|
+
const css5 = createMemo(() => {
|
|
813
884
|
const processedBlock = getProcessedBlock({
|
|
814
885
|
block: props.block,
|
|
815
886
|
localState: props.context.localState,
|
|
@@ -851,7 +922,7 @@ function BlockStyles(props) {
|
|
|
851
922
|
)
|
|
852
923
|
}) : "";
|
|
853
924
|
return [largeStylesClass, mediumStylesClass, smallStylesClass].join(" ");
|
|
854
|
-
}
|
|
925
|
+
});
|
|
855
926
|
return <Show2 when={TARGET !== "reactNative" && css5() && canShowBlock()}><Inlined_styles_default styles={css5()} /></Show2>;
|
|
856
927
|
}
|
|
857
928
|
var Block_styles_default = BlockStyles;
|
|
@@ -870,7 +941,8 @@ var createEventHandler = (value, options) => (event) => evaluate({
|
|
|
870
941
|
rootState: options.rootState,
|
|
871
942
|
rootSetState: options.rootSetState,
|
|
872
943
|
event,
|
|
873
|
-
isExpression: false
|
|
944
|
+
isExpression: false,
|
|
945
|
+
enableCache: true
|
|
874
946
|
});
|
|
875
947
|
|
|
876
948
|
// src/functions/get-block-actions.ts
|
|
@@ -898,38 +970,6 @@ function getBlockActions(options) {
|
|
|
898
970
|
return obj;
|
|
899
971
|
}
|
|
900
972
|
|
|
901
|
-
// src/functions/transform-style-property.ts
|
|
902
|
-
function transformStyleProperty({
|
|
903
|
-
style
|
|
904
|
-
}) {
|
|
905
|
-
return style;
|
|
906
|
-
}
|
|
907
|
-
|
|
908
|
-
// src/functions/get-style.ts
|
|
909
|
-
var getStyle = ({
|
|
910
|
-
block,
|
|
911
|
-
context
|
|
912
|
-
}) => {
|
|
913
|
-
return mapStyleObjToStrIfNeeded(transformStyleProperty({
|
|
914
|
-
style: block.style || {},
|
|
915
|
-
context,
|
|
916
|
-
block
|
|
917
|
-
}));
|
|
918
|
-
};
|
|
919
|
-
function mapStyleObjToStrIfNeeded(style) {
|
|
920
|
-
switch (TARGET) {
|
|
921
|
-
case "svelte":
|
|
922
|
-
case "vue":
|
|
923
|
-
case "solid":
|
|
924
|
-
return convertStyleMapToCSSArray(style).join(" ");
|
|
925
|
-
case "qwik":
|
|
926
|
-
case "reactNative":
|
|
927
|
-
case "react":
|
|
928
|
-
case "rsc":
|
|
929
|
-
return style;
|
|
930
|
-
}
|
|
931
|
-
}
|
|
932
|
-
|
|
933
973
|
// src/functions/transform-block-properties.ts
|
|
934
974
|
function transformBlockProperties({
|
|
935
975
|
properties
|
|
@@ -1089,21 +1129,20 @@ var Repeated_block_default = RepeatedBlock;
|
|
|
1089
1129
|
|
|
1090
1130
|
// src/components/block/block.tsx
|
|
1091
1131
|
function Block(props) {
|
|
1092
|
-
const
|
|
1093
|
-
function blockComponent() {
|
|
1132
|
+
const blockComponent = createMemo4(() => {
|
|
1094
1133
|
return getComponent({
|
|
1095
1134
|
block: props.block,
|
|
1096
1135
|
context: props.context,
|
|
1097
1136
|
registeredComponents: props.registeredComponents
|
|
1098
1137
|
});
|
|
1099
|
-
}
|
|
1100
|
-
|
|
1138
|
+
});
|
|
1139
|
+
const repeatItem = createMemo4(() => {
|
|
1101
1140
|
return getRepeatItemData({
|
|
1102
1141
|
block: props.block,
|
|
1103
1142
|
context: props.context
|
|
1104
1143
|
});
|
|
1105
|
-
}
|
|
1106
|
-
|
|
1144
|
+
});
|
|
1145
|
+
const processedBlock = createMemo4(() => {
|
|
1107
1146
|
return props.block.repeat?.collection ? props.block : getProcessedBlock({
|
|
1108
1147
|
block: props.block,
|
|
1109
1148
|
localState: props.context.localState,
|
|
@@ -1112,15 +1151,15 @@ function Block(props) {
|
|
|
1112
1151
|
context: props.context.context,
|
|
1113
1152
|
shouldEvaluateBindings: true
|
|
1114
1153
|
});
|
|
1115
|
-
}
|
|
1116
|
-
|
|
1154
|
+
});
|
|
1155
|
+
const Tag = createMemo4(() => {
|
|
1117
1156
|
const shouldUseLink = props.block.tagName === "a" || processedBlock().properties?.href || processedBlock().href;
|
|
1118
1157
|
if (shouldUseLink) {
|
|
1119
1158
|
return props.linkComponent || "a";
|
|
1120
1159
|
}
|
|
1121
1160
|
return props.block.tagName || "div";
|
|
1122
|
-
}
|
|
1123
|
-
|
|
1161
|
+
});
|
|
1162
|
+
const canShowBlock = createMemo4(() => {
|
|
1124
1163
|
if (props.block.repeat?.collection) {
|
|
1125
1164
|
if (repeatItem()?.length)
|
|
1126
1165
|
return true;
|
|
@@ -1129,12 +1168,12 @@ function Block(props) {
|
|
|
1129
1168
|
const shouldHide = "hide" in processedBlock() ? processedBlock().hide : false;
|
|
1130
1169
|
const shouldShow = "show" in processedBlock() ? processedBlock().show : true;
|
|
1131
1170
|
return shouldShow && !shouldHide;
|
|
1132
|
-
}
|
|
1133
|
-
|
|
1171
|
+
});
|
|
1172
|
+
const childrenWithoutParentComponent = createMemo4(() => {
|
|
1134
1173
|
const shouldRenderChildrenOutsideRef = !blockComponent()?.component && !repeatItem();
|
|
1135
1174
|
return shouldRenderChildrenOutsideRef ? processedBlock().children ?? [] : [];
|
|
1136
|
-
}
|
|
1137
|
-
|
|
1175
|
+
});
|
|
1176
|
+
const componentRefProps = createMemo4(() => {
|
|
1138
1177
|
return {
|
|
1139
1178
|
blockChildren: processedBlock().children ?? [],
|
|
1140
1179
|
componentRef: blockComponent()?.component,
|
|
@@ -1148,14 +1187,14 @@ function Block(props) {
|
|
|
1148
1187
|
builderComponents: props.registeredComponents
|
|
1149
1188
|
} : {}
|
|
1150
1189
|
},
|
|
1151
|
-
context:
|
|
1190
|
+
context: props.context,
|
|
1152
1191
|
linkComponent: props.linkComponent,
|
|
1153
1192
|
registeredComponents: props.registeredComponents,
|
|
1154
1193
|
builderBlock: processedBlock(),
|
|
1155
1194
|
includeBlockProps: blockComponent()?.noWrap === true,
|
|
1156
1195
|
isInteractive: !blockComponent()?.isRSC
|
|
1157
1196
|
};
|
|
1158
|
-
}
|
|
1197
|
+
});
|
|
1159
1198
|
onMount(() => {
|
|
1160
1199
|
const blockId = processedBlock().id;
|
|
1161
1200
|
const animations = processedBlock().animations;
|
|
@@ -1217,9 +1256,9 @@ function Block(props) {
|
|
|
1217
1256
|
return <Block
|
|
1218
1257
|
key={child.id}
|
|
1219
1258
|
block={child}
|
|
1220
|
-
context={childrenContext()}
|
|
1221
1259
|
registeredComponents={props.registeredComponents}
|
|
1222
1260
|
linkComponent={props.linkComponent}
|
|
1261
|
+
context={props.context}
|
|
1223
1262
|
/>;
|
|
1224
1263
|
}}</For2>
|
|
1225
1264
|
</Block_wrapper_default></Show4></Show4>
|
|
@@ -1228,12 +1267,13 @@ function Block(props) {
|
|
|
1228
1267
|
var Block_default = Block;
|
|
1229
1268
|
|
|
1230
1269
|
// src/components/blocks/blocks-wrapper.tsx
|
|
1270
|
+
import { createMemo as createMemo5 } from "solid-js";
|
|
1231
1271
|
import { Dynamic as Dynamic4 } from "solid-js/web";
|
|
1232
1272
|
import { css } from "solid-styled-components";
|
|
1233
1273
|
function BlocksWrapper(props) {
|
|
1234
|
-
|
|
1274
|
+
const className = createMemo5(() => {
|
|
1235
1275
|
return "builder-blocks" + (!props.blocks?.length ? " no-blocks" : "");
|
|
1236
|
-
}
|
|
1276
|
+
});
|
|
1237
1277
|
function onClick() {
|
|
1238
1278
|
if (isEditing() && !props.blocks?.length) {
|
|
1239
1279
|
window.parent?.postMessage(
|
|
@@ -1307,12 +1347,12 @@ var Blocks_default = Blocks;
|
|
|
1307
1347
|
|
|
1308
1348
|
// src/blocks/columns/columns.tsx
|
|
1309
1349
|
function Columns(props) {
|
|
1310
|
-
const [gutterSize, setGutterSize] =
|
|
1350
|
+
const [gutterSize, setGutterSize] = createSignal6(
|
|
1311
1351
|
typeof props.space === "number" ? props.space || 0 : 20
|
|
1312
1352
|
);
|
|
1313
|
-
const [cols, setCols] =
|
|
1314
|
-
const [stackAt, setStackAt] =
|
|
1315
|
-
const [flexDir, setFlexDir] =
|
|
1353
|
+
const [cols, setCols] = createSignal6(props.columns || []);
|
|
1354
|
+
const [stackAt, setStackAt] = createSignal6(props.stackColumnsAt || "tablet");
|
|
1355
|
+
const [flexDir, setFlexDir] = createSignal6(
|
|
1316
1356
|
props.stackColumnsAt === "never" ? "row" : props.reverseColumnsWhenStacked ? "column-reverse" : "column"
|
|
1317
1357
|
);
|
|
1318
1358
|
function getWidth(index) {
|
|
@@ -1334,7 +1374,7 @@ function Columns(props) {
|
|
|
1334
1374
|
}) {
|
|
1335
1375
|
return stackAt() === "never" ? desktopStyle : stackedStyle;
|
|
1336
1376
|
}
|
|
1337
|
-
|
|
1377
|
+
const columnsCssVars = createMemo6(() => {
|
|
1338
1378
|
return {
|
|
1339
1379
|
"--flex-dir": flexDir(),
|
|
1340
1380
|
"--flex-dir-tablet": getTabletStyle({
|
|
@@ -1342,7 +1382,7 @@ function Columns(props) {
|
|
|
1342
1382
|
desktopStyle: "row"
|
|
1343
1383
|
})
|
|
1344
1384
|
};
|
|
1345
|
-
}
|
|
1385
|
+
});
|
|
1346
1386
|
function columnCssVars(index) {
|
|
1347
1387
|
const gutter = index === 0 ? 0 : gutterSize();
|
|
1348
1388
|
const width = getColumnCssWidth(index);
|
|
@@ -1383,7 +1423,7 @@ function Columns(props) {
|
|
|
1383
1423
|
);
|
|
1384
1424
|
return breakpointSizes[size].max;
|
|
1385
1425
|
}
|
|
1386
|
-
|
|
1426
|
+
const columnsStyles = createMemo6(() => {
|
|
1387
1427
|
return `
|
|
1388
1428
|
@media (max-width: ${getWidthForBreakpointSize("medium")}px) {
|
|
1389
1429
|
.${props.builderBlock.id}-breakpoints {
|
|
@@ -1409,7 +1449,7 @@ function Columns(props) {
|
|
|
1409
1449
|
}
|
|
1410
1450
|
},
|
|
1411
1451
|
`;
|
|
1412
|
-
}
|
|
1452
|
+
});
|
|
1413
1453
|
return <div
|
|
1414
1454
|
class={`builder-columns ${props.builderBlock.id}-breakpoints ` + css2({
|
|
1415
1455
|
display: "flex",
|
|
@@ -1456,7 +1496,7 @@ function FragmentComponent(props) {
|
|
|
1456
1496
|
var fragment_default = FragmentComponent;
|
|
1457
1497
|
|
|
1458
1498
|
// src/blocks/image/image.tsx
|
|
1459
|
-
import { Show as Show7 } from "solid-js";
|
|
1499
|
+
import { Show as Show7, createMemo as createMemo7 } from "solid-js";
|
|
1460
1500
|
import { css as css3 } from "solid-styled-components";
|
|
1461
1501
|
|
|
1462
1502
|
// src/blocks/image/image.helpers.ts
|
|
@@ -1508,7 +1548,7 @@ function getSrcSet(url) {
|
|
|
1508
1548
|
|
|
1509
1549
|
// src/blocks/image/image.tsx
|
|
1510
1550
|
function Image(props) {
|
|
1511
|
-
|
|
1551
|
+
const srcSetToUse = createMemo7(() => {
|
|
1512
1552
|
const imageToUse = props.image || props.src;
|
|
1513
1553
|
const url = imageToUse;
|
|
1514
1554
|
if (!url || // We can auto add srcset for cdn.builder.io and shopify
|
|
@@ -1525,15 +1565,15 @@ function Image(props) {
|
|
|
1525
1565
|
return getSrcSet(url);
|
|
1526
1566
|
}
|
|
1527
1567
|
return getSrcSet(url);
|
|
1528
|
-
}
|
|
1529
|
-
|
|
1568
|
+
});
|
|
1569
|
+
const webpSrcSet = createMemo7(() => {
|
|
1530
1570
|
if (srcSetToUse()?.match(/builder\.io/) && !props.noWebp) {
|
|
1531
1571
|
return srcSetToUse().replace(/\?/g, "?format=webp&");
|
|
1532
1572
|
} else {
|
|
1533
1573
|
return "";
|
|
1534
1574
|
}
|
|
1535
|
-
}
|
|
1536
|
-
|
|
1575
|
+
});
|
|
1576
|
+
const aspectRatioCss = createMemo7(() => {
|
|
1537
1577
|
const aspectRatioStyles = {
|
|
1538
1578
|
position: "absolute",
|
|
1539
1579
|
height: "100%",
|
|
@@ -1543,7 +1583,7 @@ function Image(props) {
|
|
|
1543
1583
|
};
|
|
1544
1584
|
const out = props.aspectRatio ? aspectRatioStyles : void 0;
|
|
1545
1585
|
return out;
|
|
1546
|
-
}
|
|
1586
|
+
});
|
|
1547
1587
|
return <>
|
|
1548
1588
|
<picture>
|
|
1549
1589
|
<Show7 when={webpSrcSet()}><source type="image/webp" srcset={webpSrcSet()} /></Show7>
|
|
@@ -1554,7 +1594,7 @@ function Image(props) {
|
|
|
1554
1594
|
})}
|
|
1555
1595
|
loading="lazy"
|
|
1556
1596
|
alt={props.altText}
|
|
1557
|
-
role={props.altText ? "presentation"
|
|
1597
|
+
role={props.altText ? void 0 : "presentation"}
|
|
1558
1598
|
style={{
|
|
1559
1599
|
"object-position": props.backgroundPosition || "center",
|
|
1560
1600
|
"object-fit": props.backgroundSize || "cover",
|
|
@@ -1616,10 +1656,10 @@ function SectionComponent(props) {
|
|
|
1616
1656
|
var section_default = SectionComponent;
|
|
1617
1657
|
|
|
1618
1658
|
// src/blocks/symbol/symbol.tsx
|
|
1619
|
-
import { onMount as onMount5, on as on3, createEffect as createEffect3, createSignal as
|
|
1659
|
+
import { onMount as onMount5, on as on3, createEffect as createEffect3, createMemo as createMemo16, createSignal as createSignal16 } from "solid-js";
|
|
1620
1660
|
|
|
1621
1661
|
// src/components/content-variants/content-variants.tsx
|
|
1622
|
-
import { Show as Show12, For as For7, onMount as onMount4, createSignal as
|
|
1662
|
+
import { Show as Show12, For as For7, onMount as onMount4, createSignal as createSignal15, createMemo as createMemo15 } from "solid-js";
|
|
1623
1663
|
|
|
1624
1664
|
// src/helpers/url.ts
|
|
1625
1665
|
var getTopLevelDomain = (host) => {
|
|
@@ -1813,7 +1853,7 @@ var handleABTesting = async ({
|
|
|
1813
1853
|
var getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : true;
|
|
1814
1854
|
|
|
1815
1855
|
// src/components/content/content.tsx
|
|
1816
|
-
import { Show as Show11, createSignal as
|
|
1856
|
+
import { Show as Show11, createSignal as createSignal14 } from "solid-js";
|
|
1817
1857
|
|
|
1818
1858
|
// src/blocks/button/component-info.ts
|
|
1819
1859
|
var componentInfo = {
|
|
@@ -2374,10 +2414,10 @@ var componentInfo9 = {
|
|
|
2374
2414
|
};
|
|
2375
2415
|
|
|
2376
2416
|
// src/blocks/custom-code/custom-code.tsx
|
|
2377
|
-
import { onMount as onMount2, createSignal as
|
|
2417
|
+
import { onMount as onMount2, createSignal as createSignal8 } from "solid-js";
|
|
2378
2418
|
function CustomCode(props) {
|
|
2379
|
-
const [scriptsInserted, setScriptsInserted] =
|
|
2380
|
-
const [scriptsRun, setScriptsRun] =
|
|
2419
|
+
const [scriptsInserted, setScriptsInserted] = createSignal8([]);
|
|
2420
|
+
const [scriptsRun, setScriptsRun] = createSignal8([]);
|
|
2381
2421
|
let elementRef;
|
|
2382
2422
|
onMount2(() => {
|
|
2383
2423
|
if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
|
|
@@ -2459,7 +2499,7 @@ var componentInfo10 = {
|
|
|
2459
2499
|
};
|
|
2460
2500
|
|
|
2461
2501
|
// src/blocks/embed/embed.tsx
|
|
2462
|
-
import { on, createEffect, createSignal as
|
|
2502
|
+
import { on, createEffect, createMemo as createMemo9, createSignal as createSignal9 } from "solid-js";
|
|
2463
2503
|
|
|
2464
2504
|
// src/blocks/embed/helpers.ts
|
|
2465
2505
|
var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"];
|
|
@@ -2467,9 +2507,9 @@ var isJsScript = (script) => SCRIPT_MIME_TYPES.includes(script.type);
|
|
|
2467
2507
|
|
|
2468
2508
|
// src/blocks/embed/embed.tsx
|
|
2469
2509
|
function Embed(props) {
|
|
2470
|
-
const [scriptsInserted, setScriptsInserted] =
|
|
2471
|
-
const [scriptsRun, setScriptsRun] =
|
|
2472
|
-
const [ranInitFn, setRanInitFn] =
|
|
2510
|
+
const [scriptsInserted, setScriptsInserted] = createSignal9([]);
|
|
2511
|
+
const [scriptsRun, setScriptsRun] = createSignal9([]);
|
|
2512
|
+
const [ranInitFn, setRanInitFn] = createSignal9(false);
|
|
2473
2513
|
function findAndRunScripts() {
|
|
2474
2514
|
if (!elem || !elem.getElementsByTagName)
|
|
2475
2515
|
return;
|
|
@@ -2493,13 +2533,17 @@ function Embed(props) {
|
|
|
2493
2533
|
}
|
|
2494
2534
|
}
|
|
2495
2535
|
let elem;
|
|
2536
|
+
const onUpdateFn_0_elem = createMemo9(() => elem);
|
|
2537
|
+
const onUpdateFn_0_ranInitFn__ = createMemo9(() => ranInitFn());
|
|
2496
2538
|
function onUpdateFn_0() {
|
|
2497
2539
|
if (elem && !ranInitFn()) {
|
|
2498
2540
|
setRanInitFn(true);
|
|
2499
2541
|
findAndRunScripts();
|
|
2500
2542
|
}
|
|
2501
2543
|
}
|
|
2502
|
-
createEffect(
|
|
2544
|
+
createEffect(
|
|
2545
|
+
on(() => [onUpdateFn_0_elem(), onUpdateFn_0_ranInitFn__()], onUpdateFn_0)
|
|
2546
|
+
);
|
|
2503
2547
|
return <div class="builder-embed" ref={elem} innerHTML={props.content} />;
|
|
2504
2548
|
}
|
|
2505
2549
|
var embed_default = Embed;
|
|
@@ -2739,7 +2783,7 @@ var componentInfo11 = {
|
|
|
2739
2783
|
};
|
|
2740
2784
|
|
|
2741
2785
|
// src/blocks/form/form/form.tsx
|
|
2742
|
-
import { Show as Show8, For as For5, createSignal as
|
|
2786
|
+
import { Show as Show8, For as For5, createSignal as createSignal10 } from "solid-js";
|
|
2743
2787
|
import { css as css4 } from "solid-styled-components";
|
|
2744
2788
|
|
|
2745
2789
|
// src/functions/get-env.ts
|
|
@@ -2757,9 +2801,9 @@ var get = (obj, path, defaultValue) => {
|
|
|
2757
2801
|
|
|
2758
2802
|
// src/blocks/form/form/form.tsx
|
|
2759
2803
|
function FormComponent(props) {
|
|
2760
|
-
const [formState, setFormState] =
|
|
2761
|
-
const [responseData, setResponseData] =
|
|
2762
|
-
const [formErrorMessage, setFormErrorMessage] =
|
|
2804
|
+
const [formState, setFormState] = createSignal10("unsubmitted");
|
|
2805
|
+
const [responseData, setResponseData] = createSignal10(null);
|
|
2806
|
+
const [formErrorMessage, setFormErrorMessage] = createSignal10("");
|
|
2763
2807
|
function mergeNewRootState(newData) {
|
|
2764
2808
|
const combinedState = {
|
|
2765
2809
|
...props.builderContext.rootState,
|
|
@@ -3275,9 +3319,9 @@ var componentInfo16 = {
|
|
|
3275
3319
|
};
|
|
3276
3320
|
|
|
3277
3321
|
// src/blocks/video/video.tsx
|
|
3278
|
-
import { Show as Show9 } from "solid-js";
|
|
3322
|
+
import { Show as Show9, createMemo as createMemo11 } from "solid-js";
|
|
3279
3323
|
function Video(props) {
|
|
3280
|
-
|
|
3324
|
+
const videoProps = createMemo11(() => {
|
|
3281
3325
|
return {
|
|
3282
3326
|
...props.autoPlay === true ? {
|
|
3283
3327
|
autoPlay: true
|
|
@@ -3295,12 +3339,12 @@ function Video(props) {
|
|
|
3295
3339
|
playsInline: true
|
|
3296
3340
|
} : {}
|
|
3297
3341
|
};
|
|
3298
|
-
}
|
|
3299
|
-
|
|
3342
|
+
});
|
|
3343
|
+
const spreadProps = createMemo11(() => {
|
|
3300
3344
|
return {
|
|
3301
3345
|
...videoProps()
|
|
3302
3346
|
};
|
|
3303
|
-
}
|
|
3347
|
+
});
|
|
3304
3348
|
return <div
|
|
3305
3349
|
style={{
|
|
3306
3350
|
position: "relative"
|
|
@@ -3490,7 +3534,14 @@ function InlinedScript(props) {
|
|
|
3490
3534
|
var Inlined_script_default = InlinedScript;
|
|
3491
3535
|
|
|
3492
3536
|
// src/components/content/components/enable-editor.tsx
|
|
3493
|
-
import {
|
|
3537
|
+
import {
|
|
3538
|
+
Show as Show10,
|
|
3539
|
+
onMount as onMount3,
|
|
3540
|
+
on as on2,
|
|
3541
|
+
createEffect as createEffect2,
|
|
3542
|
+
createMemo as createMemo12,
|
|
3543
|
+
createSignal as createSignal12
|
|
3544
|
+
} from "solid-js";
|
|
3494
3545
|
import { Dynamic as Dynamic5 } from "solid-js/web";
|
|
3495
3546
|
|
|
3496
3547
|
// src/helpers/preview-lru-cache/get.ts
|
|
@@ -3978,7 +4029,7 @@ function isFromTrustedHost(trustedHosts, e) {
|
|
|
3978
4029
|
}
|
|
3979
4030
|
|
|
3980
4031
|
// src/constants/sdk-version.ts
|
|
3981
|
-
var SDK_VERSION = "0.
|
|
4032
|
+
var SDK_VERSION = "1.0.12";
|
|
3982
4033
|
|
|
3983
4034
|
// src/functions/register.ts
|
|
3984
4035
|
var registry = {};
|
|
@@ -4177,15 +4228,15 @@ var subscribeToEditor = (model, callback, options) => {
|
|
|
4177
4228
|
|
|
4178
4229
|
// src/components/content/components/enable-editor.tsx
|
|
4179
4230
|
function EnableEditor(props) {
|
|
4180
|
-
const [forceReRenderCount, setForceReRenderCount] =
|
|
4181
|
-
const [firstRender, setFirstRender] =
|
|
4182
|
-
const [lastUpdated, setLastUpdated] =
|
|
4183
|
-
const [shouldSendResetCookie, setShouldSendResetCookie] =
|
|
4184
|
-
const [ContentWrapper, setContentWrapper] =
|
|
4231
|
+
const [forceReRenderCount, setForceReRenderCount] = createSignal12(0);
|
|
4232
|
+
const [firstRender, setFirstRender] = createSignal12(true);
|
|
4233
|
+
const [lastUpdated, setLastUpdated] = createSignal12(0);
|
|
4234
|
+
const [shouldSendResetCookie, setShouldSendResetCookie] = createSignal12(false);
|
|
4235
|
+
const [ContentWrapper, setContentWrapper] = createSignal12(
|
|
4185
4236
|
props.contentWrapper || "div"
|
|
4186
4237
|
);
|
|
4187
|
-
const [httpReqsData, setHttpReqsData] =
|
|
4188
|
-
const [clicked, setClicked] =
|
|
4238
|
+
const [httpReqsData, setHttpReqsData] = createSignal12({});
|
|
4239
|
+
const [clicked, setClicked] = createSignal12(false);
|
|
4189
4240
|
function mergeNewRootState(newData) {
|
|
4190
4241
|
const combinedState = {
|
|
4191
4242
|
...props.builderContextSignal.rootState,
|
|
@@ -4256,7 +4307,11 @@ function EnableEditor(props) {
|
|
|
4256
4307
|
context: props.context || {},
|
|
4257
4308
|
localState: void 0,
|
|
4258
4309
|
rootState: props.builderContextSignal.rootState,
|
|
4259
|
-
rootSetState: props.builderContextSignal.rootSetState
|
|
4310
|
+
rootSetState: props.builderContextSignal.rootSetState,
|
|
4311
|
+
/**
|
|
4312
|
+
* We don't want to cache the result of the JS code, since it's arbitrary side effect code.
|
|
4313
|
+
*/
|
|
4314
|
+
enableCache: false
|
|
4260
4315
|
});
|
|
4261
4316
|
}
|
|
4262
4317
|
}
|
|
@@ -4281,13 +4336,16 @@ function EnableEditor(props) {
|
|
|
4281
4336
|
function evalExpression(expression) {
|
|
4282
4337
|
return expression.replace(
|
|
4283
4338
|
/{{([^}]+)}}/g,
|
|
4284
|
-
(_match, group) =>
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4339
|
+
(_match, group) => String(
|
|
4340
|
+
evaluate({
|
|
4341
|
+
code: group,
|
|
4342
|
+
context: props.context || {},
|
|
4343
|
+
localState: void 0,
|
|
4344
|
+
rootState: props.builderContextSignal.rootState,
|
|
4345
|
+
rootSetState: props.builderContextSignal.rootSetState,
|
|
4346
|
+
enableCache: true
|
|
4347
|
+
})
|
|
4348
|
+
)
|
|
4291
4349
|
);
|
|
4292
4350
|
}
|
|
4293
4351
|
function handleRequest({ url, key }) {
|
|
@@ -4404,40 +4462,63 @@ function EnableEditor(props) {
|
|
|
4404
4462
|
runHttpRequests();
|
|
4405
4463
|
emitStateUpdate();
|
|
4406
4464
|
});
|
|
4465
|
+
const onUpdateFn_0_props_content = createMemo12(() => props.content);
|
|
4407
4466
|
function onUpdateFn_0() {
|
|
4408
4467
|
if (props.content) {
|
|
4409
4468
|
mergeNewContent(props.content);
|
|
4410
4469
|
}
|
|
4411
4470
|
}
|
|
4412
|
-
createEffect2(on2(() => [
|
|
4471
|
+
createEffect2(on2(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
|
|
4472
|
+
const onUpdateFn_1_shouldSendResetCookie__ = createMemo12(
|
|
4473
|
+
() => shouldSendResetCookie()
|
|
4474
|
+
);
|
|
4413
4475
|
function onUpdateFn_1() {
|
|
4414
4476
|
}
|
|
4415
|
-
createEffect2(
|
|
4477
|
+
createEffect2(
|
|
4478
|
+
on2(() => [onUpdateFn_1_shouldSendResetCookie__()], onUpdateFn_1)
|
|
4479
|
+
);
|
|
4480
|
+
const onUpdateFn_2_props_builderContextSignal_content__data__jsCode = createMemo12(() => props.builderContextSignal.content?.data?.jsCode);
|
|
4416
4481
|
function onUpdateFn_2() {
|
|
4417
4482
|
evaluateJsCode();
|
|
4418
4483
|
}
|
|
4419
4484
|
createEffect2(
|
|
4420
|
-
on2(
|
|
4485
|
+
on2(
|
|
4486
|
+
() => [onUpdateFn_2_props_builderContextSignal_content__data__jsCode()],
|
|
4487
|
+
onUpdateFn_2
|
|
4488
|
+
)
|
|
4421
4489
|
);
|
|
4490
|
+
const onUpdateFn_3_props_builderContextSignal_content__data__httpRequests = createMemo12(() => props.builderContextSignal.content?.data?.httpRequests);
|
|
4422
4491
|
function onUpdateFn_3() {
|
|
4423
4492
|
runHttpRequests();
|
|
4424
4493
|
}
|
|
4425
4494
|
createEffect2(
|
|
4426
4495
|
on2(
|
|
4427
|
-
() => [
|
|
4496
|
+
() => [
|
|
4497
|
+
onUpdateFn_3_props_builderContextSignal_content__data__httpRequests()
|
|
4498
|
+
],
|
|
4428
4499
|
onUpdateFn_3
|
|
4429
4500
|
)
|
|
4430
4501
|
);
|
|
4502
|
+
const onUpdateFn_4_props_builderContextSignal_rootState = createMemo12(
|
|
4503
|
+
() => props.builderContextSignal.rootState
|
|
4504
|
+
);
|
|
4431
4505
|
function onUpdateFn_4() {
|
|
4432
4506
|
emitStateUpdate();
|
|
4433
4507
|
}
|
|
4434
|
-
createEffect2(
|
|
4508
|
+
createEffect2(
|
|
4509
|
+
on2(
|
|
4510
|
+
() => [onUpdateFn_4_props_builderContextSignal_rootState()],
|
|
4511
|
+
onUpdateFn_4
|
|
4512
|
+
)
|
|
4513
|
+
);
|
|
4514
|
+
const onUpdateFn_5_props_data = createMemo12(() => props.data);
|
|
4435
4515
|
function onUpdateFn_5() {
|
|
4436
4516
|
if (props.data) {
|
|
4437
4517
|
mergeNewRootState(props.data);
|
|
4438
4518
|
}
|
|
4439
4519
|
}
|
|
4440
|
-
createEffect2(on2(() => [
|
|
4520
|
+
createEffect2(on2(() => [onUpdateFn_5_props_data()], onUpdateFn_5));
|
|
4521
|
+
const onUpdateFn_6_props_locale = createMemo12(() => props.locale);
|
|
4441
4522
|
function onUpdateFn_6() {
|
|
4442
4523
|
if (props.locale) {
|
|
4443
4524
|
mergeNewRootState({
|
|
@@ -4445,7 +4526,7 @@ function EnableEditor(props) {
|
|
|
4445
4526
|
});
|
|
4446
4527
|
}
|
|
4447
4528
|
}
|
|
4448
|
-
createEffect2(on2(() => [
|
|
4529
|
+
createEffect2(on2(() => [onUpdateFn_6_props_locale()], onUpdateFn_6));
|
|
4449
4530
|
return <builder_context_default.Provider value={props.builderContextSignal}><Show10 when={props.builderContextSignal.content}><Dynamic5
|
|
4450
4531
|
class={`variant-${props.content?.testVariationId || props.content?.id}`}
|
|
4451
4532
|
{...{}}
|
|
@@ -4466,7 +4547,7 @@ function EnableEditor(props) {
|
|
|
4466
4547
|
var Enable_editor_default = EnableEditor;
|
|
4467
4548
|
|
|
4468
4549
|
// src/components/content/components/styles.tsx
|
|
4469
|
-
import { createSignal as
|
|
4550
|
+
import { createSignal as createSignal13 } from "solid-js";
|
|
4470
4551
|
|
|
4471
4552
|
// src/components/content/components/styles.helpers.ts
|
|
4472
4553
|
var getCssFromFont = (font) => {
|
|
@@ -4525,7 +4606,7 @@ var getCss = ({
|
|
|
4525
4606
|
|
|
4526
4607
|
// src/components/content/components/styles.tsx
|
|
4527
4608
|
function ContentStyles(props) {
|
|
4528
|
-
const [injectedStyles, setInjectedStyles] =
|
|
4609
|
+
const [injectedStyles, setInjectedStyles] = createSignal13(
|
|
4529
4610
|
`
|
|
4530
4611
|
${getCss({
|
|
4531
4612
|
cssCode: props.cssCode,
|
|
@@ -4595,7 +4676,7 @@ var getContentInitialValue = ({
|
|
|
4595
4676
|
|
|
4596
4677
|
// src/components/content/content.tsx
|
|
4597
4678
|
function ContentComponent(props) {
|
|
4598
|
-
const [scriptStr, setScriptStr] =
|
|
4679
|
+
const [scriptStr, setScriptStr] = createSignal14(
|
|
4599
4680
|
getUpdateVariantVisibilityScript({
|
|
4600
4681
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
4601
4682
|
variationId: props.content?.testVariationId,
|
|
@@ -4603,7 +4684,7 @@ function ContentComponent(props) {
|
|
|
4603
4684
|
contentId: props.content?.id
|
|
4604
4685
|
})
|
|
4605
4686
|
);
|
|
4606
|
-
const [registeredComponents, setRegisteredComponents] =
|
|
4687
|
+
const [registeredComponents, setRegisteredComponents] = createSignal14(
|
|
4607
4688
|
[
|
|
4608
4689
|
...getDefaultRegisteredComponents(),
|
|
4609
4690
|
...props.customComponents || []
|
|
@@ -4618,7 +4699,7 @@ function ContentComponent(props) {
|
|
|
4618
4699
|
{}
|
|
4619
4700
|
)
|
|
4620
4701
|
);
|
|
4621
|
-
const [builderContextSignal, setBuilderContextSignal] =
|
|
4702
|
+
const [builderContextSignal, setBuilderContextSignal] = createSignal14({
|
|
4622
4703
|
content: getContentInitialValue({
|
|
4623
4704
|
content: props.content,
|
|
4624
4705
|
data: props.data
|
|
@@ -4694,13 +4775,13 @@ var Content_default = ContentComponent;
|
|
|
4694
4775
|
|
|
4695
4776
|
// src/components/content-variants/content-variants.tsx
|
|
4696
4777
|
function ContentVariants(props) {
|
|
4697
|
-
const [shouldRenderVariants, setShouldRenderVariants] =
|
|
4778
|
+
const [shouldRenderVariants, setShouldRenderVariants] = createSignal15(
|
|
4698
4779
|
checkShouldRenderVariants({
|
|
4699
4780
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
4700
4781
|
content: props.content
|
|
4701
4782
|
})
|
|
4702
4783
|
);
|
|
4703
|
-
|
|
4784
|
+
const updateCookieAndStylesScriptStr = createMemo15(() => {
|
|
4704
4785
|
return getUpdateCookieAndStylesScript(
|
|
4705
4786
|
getVariants(props.content).map((value) => ({
|
|
4706
4787
|
id: value.testVariationId,
|
|
@@ -4708,11 +4789,11 @@ function ContentVariants(props) {
|
|
|
4708
4789
|
})),
|
|
4709
4790
|
props.content?.id || ""
|
|
4710
4791
|
);
|
|
4711
|
-
}
|
|
4712
|
-
|
|
4792
|
+
});
|
|
4793
|
+
const hideVariantsStyleString = createMemo15(() => {
|
|
4713
4794
|
return getVariants(props.content).map((value) => `.variant-${value.testVariationId} { display: none; } `).join("");
|
|
4714
|
-
}
|
|
4715
|
-
|
|
4795
|
+
});
|
|
4796
|
+
const defaultContent = createMemo15(() => {
|
|
4716
4797
|
return shouldRenderVariants() ? {
|
|
4717
4798
|
...props.content,
|
|
4718
4799
|
testVariationId: props.content?.id
|
|
@@ -4720,7 +4801,7 @@ function ContentVariants(props) {
|
|
|
4720
4801
|
item: props.content,
|
|
4721
4802
|
canTrack: getDefaultCanTrack(props.canTrack)
|
|
4722
4803
|
});
|
|
4723
|
-
}
|
|
4804
|
+
});
|
|
4724
4805
|
onMount4(() => {
|
|
4725
4806
|
setShouldRenderVariants(false);
|
|
4726
4807
|
});
|
|
@@ -4810,15 +4891,15 @@ var fetchSymbolContent = async ({
|
|
|
4810
4891
|
|
|
4811
4892
|
// src/blocks/symbol/symbol.tsx
|
|
4812
4893
|
function Symbol(props) {
|
|
4813
|
-
const [contentToUse, setContentToUse] =
|
|
4814
|
-
|
|
4894
|
+
const [contentToUse, setContentToUse] = createSignal16(props.symbol?.content);
|
|
4895
|
+
const className = createMemo16(() => {
|
|
4815
4896
|
return [
|
|
4816
4897
|
...[props.attributes[getClassPropName()]],
|
|
4817
4898
|
"builder-symbol",
|
|
4818
4899
|
props.symbol?.inline ? "builder-inline-symbol" : void 0,
|
|
4819
4900
|
props.symbol?.dynamic || props.dynamic ? "builder-dynamic-symbol" : void 0
|
|
4820
4901
|
].filter(Boolean).join(" ");
|
|
4821
|
-
}
|
|
4902
|
+
});
|
|
4822
4903
|
function setContent() {
|
|
4823
4904
|
if (contentToUse())
|
|
4824
4905
|
return;
|
|
@@ -4832,12 +4913,12 @@ function Symbol(props) {
|
|
|
4832
4913
|
});
|
|
4833
4914
|
}
|
|
4834
4915
|
onMount5(() => {
|
|
4835
|
-
setContent();
|
|
4836
4916
|
});
|
|
4917
|
+
const onUpdateFn_0_props_symbol = createMemo16(() => props.symbol);
|
|
4837
4918
|
function onUpdateFn_0() {
|
|
4838
4919
|
setContent();
|
|
4839
4920
|
}
|
|
4840
|
-
createEffect3(on3(() => [
|
|
4921
|
+
createEffect3(on3(() => [onUpdateFn_0_props_symbol()], onUpdateFn_0));
|
|
4841
4922
|
return <div class={className()} {...{}} {...props.attributes} {...{}}><Content_variants_default
|
|
4842
4923
|
__isNestedRender={true}
|
|
4843
4924
|
apiVersion={props.builderContext.apiVersion}
|