@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/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createComponent, spread, mergeProps, insert, effect, setAttribute, className, style, template, Dynamic, memo, use } from 'solid-js/web';
|
|
2
|
-
import { createContext, useContext, Show, For, createSignal, onMount, createEffect, on } from 'solid-js';
|
|
2
|
+
import { createContext, useContext, Show, For, createSignal, createMemo, onMount, createEffect, on } from 'solid-js';
|
|
3
3
|
import { css } from 'solid-styled-components';
|
|
4
4
|
|
|
5
5
|
// src/blocks/button/button.tsx
|
|
@@ -279,7 +279,7 @@ function flattenState({
|
|
|
279
279
|
return localState[prop];
|
|
280
280
|
}
|
|
281
281
|
const val = target[prop];
|
|
282
|
-
if (typeof val === "object") {
|
|
282
|
+
if (typeof val === "object" && val !== null) {
|
|
283
283
|
return flattenState({
|
|
284
284
|
rootState: val,
|
|
285
285
|
localState: void 0,
|
|
@@ -331,6 +331,30 @@ var shouldForceBrowserRuntimeInNode = () => {
|
|
|
331
331
|
var chooseBrowserOrServerEval = (args) => isBrowser() || shouldForceBrowserRuntimeInNode() ? runInBrowser(args) : runInBrowser(args);
|
|
332
332
|
|
|
333
333
|
// src/functions/evaluate/evaluate.ts
|
|
334
|
+
var EvalCache = class _EvalCache {
|
|
335
|
+
static cacheLimit = 20;
|
|
336
|
+
static cache = /* @__PURE__ */ new Map();
|
|
337
|
+
static getCacheKey(args) {
|
|
338
|
+
return JSON.stringify({
|
|
339
|
+
...args,
|
|
340
|
+
// replace the event with a random number to break cache
|
|
341
|
+
// thats because we can't serialize the event object due to circular refs in DOM node refs.
|
|
342
|
+
event: args.event ? Math.random() : void 0
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
static getCachedValue(key) {
|
|
346
|
+
const cachedVal = _EvalCache.cache.get(key);
|
|
347
|
+
return cachedVal;
|
|
348
|
+
}
|
|
349
|
+
static setCachedValue(key, value) {
|
|
350
|
+
if (_EvalCache.cache.size > 20) {
|
|
351
|
+
_EvalCache.cache.delete(_EvalCache.cache.keys().next().value);
|
|
352
|
+
}
|
|
353
|
+
_EvalCache.cache.set(key, {
|
|
354
|
+
value
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
};
|
|
334
358
|
function evaluate({
|
|
335
359
|
code,
|
|
336
360
|
context,
|
|
@@ -338,11 +362,12 @@ function evaluate({
|
|
|
338
362
|
rootState,
|
|
339
363
|
rootSetState,
|
|
340
364
|
event,
|
|
341
|
-
isExpression = true
|
|
365
|
+
isExpression = true,
|
|
366
|
+
enableCache
|
|
342
367
|
}) {
|
|
343
368
|
if (code === "") {
|
|
344
369
|
logger.warn("Skipping evaluation of empty code block.");
|
|
345
|
-
return;
|
|
370
|
+
return void 0;
|
|
346
371
|
}
|
|
347
372
|
const args = {
|
|
348
373
|
code: parseCode(code, {
|
|
@@ -355,8 +380,20 @@ function evaluate({
|
|
|
355
380
|
rootState,
|
|
356
381
|
localState
|
|
357
382
|
};
|
|
383
|
+
if (enableCache) {
|
|
384
|
+
const cacheKey = EvalCache.getCacheKey(args);
|
|
385
|
+
const cachedValue = EvalCache.getCachedValue(cacheKey);
|
|
386
|
+
if (cachedValue) {
|
|
387
|
+
return cachedValue.value;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
358
390
|
try {
|
|
359
|
-
|
|
391
|
+
const newEval = chooseBrowserOrServerEval(args);
|
|
392
|
+
if (enableCache) {
|
|
393
|
+
const cacheKey = EvalCache.getCacheKey(args);
|
|
394
|
+
EvalCache.setCachedValue(cacheKey, newEval);
|
|
395
|
+
}
|
|
396
|
+
return newEval;
|
|
360
397
|
} catch (e) {
|
|
361
398
|
logger.error("Failed code evaluation: " + e.message, {
|
|
362
399
|
code
|
|
@@ -411,7 +448,8 @@ var evaluateBindings = ({
|
|
|
411
448
|
localState,
|
|
412
449
|
rootState,
|
|
413
450
|
rootSetState,
|
|
414
|
-
context
|
|
451
|
+
context,
|
|
452
|
+
enableCache: true
|
|
415
453
|
});
|
|
416
454
|
set(copied, binding, value);
|
|
417
455
|
}
|
|
@@ -644,6 +682,70 @@ function bindScrollInViewAnimation(animation) {
|
|
|
644
682
|
});
|
|
645
683
|
}
|
|
646
684
|
|
|
685
|
+
// src/functions/camel-to-kebab-case.ts
|
|
686
|
+
var camelToKebabCase = (string) => string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
|
|
687
|
+
|
|
688
|
+
// src/helpers/css.ts
|
|
689
|
+
var convertStyleMapToCSSArray = (style) => {
|
|
690
|
+
const cssProps = Object.entries(style).map(([key, value]) => {
|
|
691
|
+
if (typeof value === "string") {
|
|
692
|
+
return `${camelToKebabCase(key)}: ${value};`;
|
|
693
|
+
} else {
|
|
694
|
+
return void 0;
|
|
695
|
+
}
|
|
696
|
+
});
|
|
697
|
+
return cssProps.filter(checkIsDefined);
|
|
698
|
+
};
|
|
699
|
+
var convertStyleMapToCSS = (style) => convertStyleMapToCSSArray(style).join("\n");
|
|
700
|
+
var createCssClass = ({
|
|
701
|
+
mediaQuery,
|
|
702
|
+
className,
|
|
703
|
+
styles
|
|
704
|
+
}) => {
|
|
705
|
+
const cssClass = `.${className} {
|
|
706
|
+
${convertStyleMapToCSS(styles)}
|
|
707
|
+
}`;
|
|
708
|
+
if (mediaQuery) {
|
|
709
|
+
return `${mediaQuery} {
|
|
710
|
+
${cssClass}
|
|
711
|
+
}`;
|
|
712
|
+
} else {
|
|
713
|
+
return cssClass;
|
|
714
|
+
}
|
|
715
|
+
};
|
|
716
|
+
|
|
717
|
+
// src/functions/transform-style-property.ts
|
|
718
|
+
function transformStyleProperty({
|
|
719
|
+
style
|
|
720
|
+
}) {
|
|
721
|
+
return style;
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
// src/functions/get-style.ts
|
|
725
|
+
var getStyle = ({
|
|
726
|
+
block,
|
|
727
|
+
context
|
|
728
|
+
}) => {
|
|
729
|
+
return mapStyleObjToStrIfNeeded(transformStyleProperty({
|
|
730
|
+
style: block.style || {},
|
|
731
|
+
context,
|
|
732
|
+
block
|
|
733
|
+
}));
|
|
734
|
+
};
|
|
735
|
+
function mapStyleObjToStrIfNeeded(style) {
|
|
736
|
+
switch (TARGET) {
|
|
737
|
+
case "svelte":
|
|
738
|
+
case "vue":
|
|
739
|
+
case "solid":
|
|
740
|
+
return convertStyleMapToCSSArray(style).join(" ");
|
|
741
|
+
case "qwik":
|
|
742
|
+
case "reactNative":
|
|
743
|
+
case "react":
|
|
744
|
+
case "rsc":
|
|
745
|
+
return style;
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
|
|
647
749
|
// src/components/block/block.helpers.ts
|
|
648
750
|
var getComponent = ({
|
|
649
751
|
block,
|
|
@@ -684,7 +786,8 @@ var getRepeatItemData = ({
|
|
|
684
786
|
localState: context.localState,
|
|
685
787
|
rootState: context.rootState,
|
|
686
788
|
rootSetState: context.rootSetState,
|
|
687
|
-
context: context.context
|
|
789
|
+
context: context.context,
|
|
790
|
+
enableCache: true
|
|
688
791
|
});
|
|
689
792
|
if (!Array.isArray(itemsArray)) {
|
|
690
793
|
return void 0;
|
|
@@ -755,38 +858,6 @@ var getSizesForBreakpoints = ({
|
|
|
755
858
|
};
|
|
756
859
|
return newSizes;
|
|
757
860
|
};
|
|
758
|
-
|
|
759
|
-
// src/functions/camel-to-kebab-case.ts
|
|
760
|
-
var camelToKebabCase = (string) => string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
|
|
761
|
-
|
|
762
|
-
// src/helpers/css.ts
|
|
763
|
-
var convertStyleMapToCSSArray = (style) => {
|
|
764
|
-
const cssProps = Object.entries(style).map(([key, value]) => {
|
|
765
|
-
if (typeof value === "string") {
|
|
766
|
-
return `${camelToKebabCase(key)}: ${value};`;
|
|
767
|
-
} else {
|
|
768
|
-
return void 0;
|
|
769
|
-
}
|
|
770
|
-
});
|
|
771
|
-
return cssProps.filter(checkIsDefined);
|
|
772
|
-
};
|
|
773
|
-
var convertStyleMapToCSS = (style) => convertStyleMapToCSSArray(style).join("\n");
|
|
774
|
-
var createCssClass = ({
|
|
775
|
-
mediaQuery,
|
|
776
|
-
className,
|
|
777
|
-
styles
|
|
778
|
-
}) => {
|
|
779
|
-
const cssClass = `.${className} {
|
|
780
|
-
${convertStyleMapToCSS(styles)}
|
|
781
|
-
}`;
|
|
782
|
-
if (mediaQuery) {
|
|
783
|
-
return `${mediaQuery} {
|
|
784
|
-
${cssClass}
|
|
785
|
-
}`;
|
|
786
|
-
} else {
|
|
787
|
-
return cssClass;
|
|
788
|
-
}
|
|
789
|
-
};
|
|
790
861
|
var _tmpl$ = /* @__PURE__ */ template(`<style>`);
|
|
791
862
|
function InlinedStyles(props) {
|
|
792
863
|
return (() => {
|
|
@@ -807,7 +878,7 @@ var inlined_styles_default = InlinedStyles;
|
|
|
807
878
|
|
|
808
879
|
// src/components/block/components/block-styles.tsx
|
|
809
880
|
function BlockStyles(props) {
|
|
810
|
-
|
|
881
|
+
const canShowBlock = createMemo(() => {
|
|
811
882
|
const processedBlock = getProcessedBlock({
|
|
812
883
|
block: props.block,
|
|
813
884
|
localState: props.context.localState,
|
|
@@ -823,8 +894,8 @@ function BlockStyles(props) {
|
|
|
823
894
|
return processedBlock.show;
|
|
824
895
|
}
|
|
825
896
|
return true;
|
|
826
|
-
}
|
|
827
|
-
|
|
897
|
+
});
|
|
898
|
+
const css5 = createMemo(() => {
|
|
828
899
|
const processedBlock = getProcessedBlock({
|
|
829
900
|
block: props.block,
|
|
830
901
|
localState: props.context.localState,
|
|
@@ -858,7 +929,7 @@ function BlockStyles(props) {
|
|
|
858
929
|
mediaQuery: getMaxWidthQueryForSize("small", sizesWithUpdatedBreakpoints)
|
|
859
930
|
}) : "";
|
|
860
931
|
return [largeStylesClass, mediumStylesClass, smallStylesClass].join(" ");
|
|
861
|
-
}
|
|
932
|
+
});
|
|
862
933
|
return createComponent(Show, {
|
|
863
934
|
get when() {
|
|
864
935
|
return memo(() => !!(TARGET !== "reactNative" && css5()))() && canShowBlock();
|
|
@@ -888,7 +959,8 @@ var createEventHandler = (value, options) => (event) => evaluate({
|
|
|
888
959
|
rootState: options.rootState,
|
|
889
960
|
rootSetState: options.rootSetState,
|
|
890
961
|
event,
|
|
891
|
-
isExpression: false
|
|
962
|
+
isExpression: false,
|
|
963
|
+
enableCache: true
|
|
892
964
|
});
|
|
893
965
|
|
|
894
966
|
// src/functions/get-block-actions.ts
|
|
@@ -916,38 +988,6 @@ function getBlockActions(options) {
|
|
|
916
988
|
return obj;
|
|
917
989
|
}
|
|
918
990
|
|
|
919
|
-
// src/functions/transform-style-property.ts
|
|
920
|
-
function transformStyleProperty({
|
|
921
|
-
style
|
|
922
|
-
}) {
|
|
923
|
-
return style;
|
|
924
|
-
}
|
|
925
|
-
|
|
926
|
-
// src/functions/get-style.ts
|
|
927
|
-
var getStyle = ({
|
|
928
|
-
block,
|
|
929
|
-
context
|
|
930
|
-
}) => {
|
|
931
|
-
return mapStyleObjToStrIfNeeded(transformStyleProperty({
|
|
932
|
-
style: block.style || {},
|
|
933
|
-
context,
|
|
934
|
-
block
|
|
935
|
-
}));
|
|
936
|
-
};
|
|
937
|
-
function mapStyleObjToStrIfNeeded(style) {
|
|
938
|
-
switch (TARGET) {
|
|
939
|
-
case "svelte":
|
|
940
|
-
case "vue":
|
|
941
|
-
case "solid":
|
|
942
|
-
return convertStyleMapToCSSArray(style).join(" ");
|
|
943
|
-
case "qwik":
|
|
944
|
-
case "reactNative":
|
|
945
|
-
case "react":
|
|
946
|
-
case "rsc":
|
|
947
|
-
return style;
|
|
948
|
-
}
|
|
949
|
-
}
|
|
950
|
-
|
|
951
991
|
// src/functions/transform-block-properties.ts
|
|
952
992
|
function transformBlockProperties({
|
|
953
993
|
properties
|
|
@@ -1149,21 +1189,20 @@ var repeated_block_default = RepeatedBlock;
|
|
|
1149
1189
|
|
|
1150
1190
|
// src/components/block/block.tsx
|
|
1151
1191
|
function Block(props) {
|
|
1152
|
-
const
|
|
1153
|
-
function blockComponent() {
|
|
1192
|
+
const blockComponent = createMemo(() => {
|
|
1154
1193
|
return getComponent({
|
|
1155
1194
|
block: props.block,
|
|
1156
1195
|
context: props.context,
|
|
1157
1196
|
registeredComponents: props.registeredComponents
|
|
1158
1197
|
});
|
|
1159
|
-
}
|
|
1160
|
-
|
|
1198
|
+
});
|
|
1199
|
+
const repeatItem = createMemo(() => {
|
|
1161
1200
|
return getRepeatItemData({
|
|
1162
1201
|
block: props.block,
|
|
1163
1202
|
context: props.context
|
|
1164
1203
|
});
|
|
1165
|
-
}
|
|
1166
|
-
|
|
1204
|
+
});
|
|
1205
|
+
const processedBlock = createMemo(() => {
|
|
1167
1206
|
return props.block.repeat?.collection ? props.block : getProcessedBlock({
|
|
1168
1207
|
block: props.block,
|
|
1169
1208
|
localState: props.context.localState,
|
|
@@ -1172,15 +1211,15 @@ function Block(props) {
|
|
|
1172
1211
|
context: props.context.context,
|
|
1173
1212
|
shouldEvaluateBindings: true
|
|
1174
1213
|
});
|
|
1175
|
-
}
|
|
1176
|
-
|
|
1214
|
+
});
|
|
1215
|
+
const Tag = createMemo(() => {
|
|
1177
1216
|
const shouldUseLink = props.block.tagName === "a" || processedBlock().properties?.href || processedBlock().href;
|
|
1178
1217
|
if (shouldUseLink) {
|
|
1179
1218
|
return props.linkComponent || "a";
|
|
1180
1219
|
}
|
|
1181
1220
|
return props.block.tagName || "div";
|
|
1182
|
-
}
|
|
1183
|
-
|
|
1221
|
+
});
|
|
1222
|
+
const canShowBlock = createMemo(() => {
|
|
1184
1223
|
if (props.block.repeat?.collection) {
|
|
1185
1224
|
if (repeatItem()?.length)
|
|
1186
1225
|
return true;
|
|
@@ -1189,12 +1228,12 @@ function Block(props) {
|
|
|
1189
1228
|
const shouldHide = "hide" in processedBlock() ? processedBlock().hide : false;
|
|
1190
1229
|
const shouldShow = "show" in processedBlock() ? processedBlock().show : true;
|
|
1191
1230
|
return shouldShow && !shouldHide;
|
|
1192
|
-
}
|
|
1193
|
-
|
|
1231
|
+
});
|
|
1232
|
+
const childrenWithoutParentComponent = createMemo(() => {
|
|
1194
1233
|
const shouldRenderChildrenOutsideRef = !blockComponent()?.component && !repeatItem();
|
|
1195
1234
|
return shouldRenderChildrenOutsideRef ? processedBlock().children ?? [] : [];
|
|
1196
|
-
}
|
|
1197
|
-
|
|
1235
|
+
});
|
|
1236
|
+
const componentRefProps = createMemo(() => {
|
|
1198
1237
|
return {
|
|
1199
1238
|
blockChildren: processedBlock().children ?? [],
|
|
1200
1239
|
componentRef: blockComponent()?.component,
|
|
@@ -1208,14 +1247,14 @@ function Block(props) {
|
|
|
1208
1247
|
builderComponents: props.registeredComponents
|
|
1209
1248
|
} : {}
|
|
1210
1249
|
},
|
|
1211
|
-
context:
|
|
1250
|
+
context: props.context,
|
|
1212
1251
|
linkComponent: props.linkComponent,
|
|
1213
1252
|
registeredComponents: props.registeredComponents,
|
|
1214
1253
|
builderBlock: processedBlock(),
|
|
1215
1254
|
includeBlockProps: blockComponent()?.noWrap === true,
|
|
1216
1255
|
isInteractive: !blockComponent()?.isRSC
|
|
1217
1256
|
};
|
|
1218
|
-
}
|
|
1257
|
+
});
|
|
1219
1258
|
onMount(() => {
|
|
1220
1259
|
const blockId = processedBlock().id;
|
|
1221
1260
|
const animations = processedBlock().animations;
|
|
@@ -1357,14 +1396,14 @@ function Block(props) {
|
|
|
1357
1396
|
return child.id;
|
|
1358
1397
|
},
|
|
1359
1398
|
block: child,
|
|
1360
|
-
get context() {
|
|
1361
|
-
return childrenContext();
|
|
1362
|
-
},
|
|
1363
1399
|
get registeredComponents() {
|
|
1364
1400
|
return props.registeredComponents;
|
|
1365
1401
|
},
|
|
1366
1402
|
get linkComponent() {
|
|
1367
1403
|
return props.linkComponent;
|
|
1404
|
+
},
|
|
1405
|
+
get context() {
|
|
1406
|
+
return props.context;
|
|
1368
1407
|
}
|
|
1369
1408
|
});
|
|
1370
1409
|
}
|
|
@@ -1380,9 +1419,9 @@ function Block(props) {
|
|
|
1380
1419
|
}
|
|
1381
1420
|
var block_default = Block;
|
|
1382
1421
|
function BlocksWrapper(props) {
|
|
1383
|
-
|
|
1422
|
+
const className = createMemo(() => {
|
|
1384
1423
|
return "builder-blocks" + (!props.blocks?.length ? " no-blocks" : "");
|
|
1385
|
-
}
|
|
1424
|
+
});
|
|
1386
1425
|
function onClick() {
|
|
1387
1426
|
if (isEditing() && !props.blocks?.length) {
|
|
1388
1427
|
window.parent?.postMessage({
|
|
@@ -1522,7 +1561,7 @@ function Columns(props) {
|
|
|
1522
1561
|
}) {
|
|
1523
1562
|
return stackAt() === "never" ? desktopStyle : stackedStyle;
|
|
1524
1563
|
}
|
|
1525
|
-
|
|
1564
|
+
const columnsCssVars = createMemo(() => {
|
|
1526
1565
|
return {
|
|
1527
1566
|
"--flex-dir": flexDir(),
|
|
1528
1567
|
"--flex-dir-tablet": getTabletStyle({
|
|
@@ -1530,7 +1569,7 @@ function Columns(props) {
|
|
|
1530
1569
|
desktopStyle: "row"
|
|
1531
1570
|
})
|
|
1532
1571
|
};
|
|
1533
|
-
}
|
|
1572
|
+
});
|
|
1534
1573
|
function columnCssVars(index) {
|
|
1535
1574
|
const gutter = index === 0 ? 0 : gutterSize();
|
|
1536
1575
|
const width = getColumnCssWidth(index);
|
|
@@ -1569,7 +1608,7 @@ function Columns(props) {
|
|
|
1569
1608
|
const breakpointSizes = getSizesForBreakpoints(props.builderContext.content?.meta?.breakpoints || {});
|
|
1570
1609
|
return breakpointSizes[size].max;
|
|
1571
1610
|
}
|
|
1572
|
-
|
|
1611
|
+
const columnsStyles = createMemo(() => {
|
|
1573
1612
|
return `
|
|
1574
1613
|
@media (max-width: ${getWidthForBreakpointSize("medium")}px) {
|
|
1575
1614
|
.${props.builderBlock.id}-breakpoints {
|
|
@@ -1595,7 +1634,7 @@ function Columns(props) {
|
|
|
1595
1634
|
}
|
|
1596
1635
|
},
|
|
1597
1636
|
`;
|
|
1598
|
-
}
|
|
1637
|
+
});
|
|
1599
1638
|
return (() => {
|
|
1600
1639
|
const _el$ = _tmpl$2();
|
|
1601
1640
|
spread(_el$, mergeProps({
|
|
@@ -1733,7 +1772,7 @@ var _tmpl$4 = /* @__PURE__ */ template(`<source type=image/webp>`);
|
|
|
1733
1772
|
var _tmpl$22 = /* @__PURE__ */ template(`<picture><img loading=lazy>`);
|
|
1734
1773
|
var _tmpl$32 = /* @__PURE__ */ template(`<div>`);
|
|
1735
1774
|
function Image(props) {
|
|
1736
|
-
|
|
1775
|
+
const srcSetToUse = createMemo(() => {
|
|
1737
1776
|
const imageToUse = props.image || props.src;
|
|
1738
1777
|
const url = imageToUse;
|
|
1739
1778
|
if (!url || // We can auto add srcset for cdn.builder.io and shopify
|
|
@@ -1749,15 +1788,15 @@ function Image(props) {
|
|
|
1749
1788
|
return getSrcSet(url);
|
|
1750
1789
|
}
|
|
1751
1790
|
return getSrcSet(url);
|
|
1752
|
-
}
|
|
1753
|
-
|
|
1791
|
+
});
|
|
1792
|
+
const webpSrcSet = createMemo(() => {
|
|
1754
1793
|
if (srcSetToUse()?.match(/builder\.io/) && !props.noWebp) {
|
|
1755
1794
|
return srcSetToUse().replace(/\?/g, "?format=webp&");
|
|
1756
1795
|
} else {
|
|
1757
1796
|
return "";
|
|
1758
1797
|
}
|
|
1759
|
-
}
|
|
1760
|
-
|
|
1798
|
+
});
|
|
1799
|
+
const aspectRatioCss = createMemo(() => {
|
|
1761
1800
|
const aspectRatioStyles = {
|
|
1762
1801
|
position: "absolute",
|
|
1763
1802
|
height: "100%",
|
|
@@ -1767,7 +1806,7 @@ function Image(props) {
|
|
|
1767
1806
|
};
|
|
1768
1807
|
const out = props.aspectRatio ? aspectRatioStyles : void 0;
|
|
1769
1808
|
return out;
|
|
1770
|
-
}
|
|
1809
|
+
});
|
|
1771
1810
|
return [(() => {
|
|
1772
1811
|
const _el$ = _tmpl$22(), _el$3 = _el$.firstChild;
|
|
1773
1812
|
insert(_el$, createComponent(Show, {
|
|
@@ -1784,7 +1823,7 @@ function Image(props) {
|
|
|
1784
1823
|
const _v$ = "builder-image" + (props.className ? " " + props.className : "") + " " + css({
|
|
1785
1824
|
opacity: "1",
|
|
1786
1825
|
transition: "opacity 0.2s ease-in-out"
|
|
1787
|
-
}), _v$2 = props.altText, _v$3 = props.altText ? "presentation"
|
|
1826
|
+
}), _v$2 = props.altText, _v$3 = props.altText ? void 0 : "presentation", _v$4 = {
|
|
1788
1827
|
"object-position": props.backgroundPosition || "center",
|
|
1789
1828
|
"object-fit": props.backgroundSize || "cover",
|
|
1790
1829
|
...aspectRatioCss()
|
|
@@ -2757,13 +2796,15 @@ function Embed(props) {
|
|
|
2757
2796
|
}
|
|
2758
2797
|
}
|
|
2759
2798
|
let elem;
|
|
2799
|
+
const onUpdateFn_0_elem = createMemo(() => elem);
|
|
2800
|
+
const onUpdateFn_0_ranInitFn__ = createMemo(() => ranInitFn());
|
|
2760
2801
|
function onUpdateFn_0() {
|
|
2761
2802
|
if (elem && !ranInitFn()) {
|
|
2762
2803
|
setRanInitFn(true);
|
|
2763
2804
|
findAndRunScripts();
|
|
2764
2805
|
}
|
|
2765
2806
|
}
|
|
2766
|
-
createEffect(on(() => [
|
|
2807
|
+
createEffect(on(() => [onUpdateFn_0_elem(), onUpdateFn_0_ranInitFn__()], onUpdateFn_0));
|
|
2767
2808
|
return (() => {
|
|
2768
2809
|
const _el$ = _tmpl$9();
|
|
2769
2810
|
const _ref$ = elem;
|
|
@@ -3657,7 +3698,7 @@ var _tmpl$15 = /* @__PURE__ */ template(`<source type=video/mp4>`);
|
|
|
3657
3698
|
var _tmpl$25 = /* @__PURE__ */ template(`<div>`);
|
|
3658
3699
|
var _tmpl$33 = /* @__PURE__ */ template(`<div><video class=builder-video>`);
|
|
3659
3700
|
function Video(props) {
|
|
3660
|
-
|
|
3701
|
+
const videoProps = createMemo(() => {
|
|
3661
3702
|
return {
|
|
3662
3703
|
...props.autoPlay === true ? {
|
|
3663
3704
|
autoPlay: true
|
|
@@ -3675,12 +3716,12 @@ function Video(props) {
|
|
|
3675
3716
|
playsInline: true
|
|
3676
3717
|
} : {}
|
|
3677
3718
|
};
|
|
3678
|
-
}
|
|
3679
|
-
|
|
3719
|
+
});
|
|
3720
|
+
const spreadProps = createMemo(() => {
|
|
3680
3721
|
return {
|
|
3681
3722
|
...videoProps()
|
|
3682
3723
|
};
|
|
3683
|
-
}
|
|
3724
|
+
});
|
|
3684
3725
|
return (() => {
|
|
3685
3726
|
const _el$ = _tmpl$33(), _el$2 = _el$.firstChild;
|
|
3686
3727
|
_el$.style.setProperty("position", "relative");
|
|
@@ -4390,7 +4431,7 @@ function isFromTrustedHost(trustedHosts, e) {
|
|
|
4390
4431
|
}
|
|
4391
4432
|
|
|
4392
4433
|
// src/constants/sdk-version.ts
|
|
4393
|
-
var SDK_VERSION = "0.
|
|
4434
|
+
var SDK_VERSION = "1.0.12";
|
|
4394
4435
|
|
|
4395
4436
|
// src/functions/register.ts
|
|
4396
4437
|
var registry = {};
|
|
@@ -4668,7 +4709,11 @@ function EnableEditor(props) {
|
|
|
4668
4709
|
context: props.context || {},
|
|
4669
4710
|
localState: void 0,
|
|
4670
4711
|
rootState: props.builderContextSignal.rootState,
|
|
4671
|
-
rootSetState: props.builderContextSignal.rootSetState
|
|
4712
|
+
rootSetState: props.builderContextSignal.rootSetState,
|
|
4713
|
+
/**
|
|
4714
|
+
* We don't want to cache the result of the JS code, since it's arbitrary side effect code.
|
|
4715
|
+
*/
|
|
4716
|
+
enableCache: false
|
|
4672
4717
|
});
|
|
4673
4718
|
}
|
|
4674
4719
|
}
|
|
@@ -4691,13 +4736,14 @@ function EnableEditor(props) {
|
|
|
4691
4736
|
}
|
|
4692
4737
|
}
|
|
4693
4738
|
function evalExpression(expression) {
|
|
4694
|
-
return expression.replace(/{{([^}]+)}}/g, (_match, group) => evaluate({
|
|
4739
|
+
return expression.replace(/{{([^}]+)}}/g, (_match, group) => String(evaluate({
|
|
4695
4740
|
code: group,
|
|
4696
4741
|
context: props.context || {},
|
|
4697
4742
|
localState: void 0,
|
|
4698
4743
|
rootState: props.builderContextSignal.rootState,
|
|
4699
|
-
rootSetState: props.builderContextSignal.rootSetState
|
|
4700
|
-
|
|
4744
|
+
rootSetState: props.builderContextSignal.rootSetState,
|
|
4745
|
+
enableCache: true
|
|
4746
|
+
})));
|
|
4701
4747
|
}
|
|
4702
4748
|
function handleRequest({
|
|
4703
4749
|
url,
|
|
@@ -4801,33 +4847,40 @@ function EnableEditor(props) {
|
|
|
4801
4847
|
runHttpRequests();
|
|
4802
4848
|
emitStateUpdate();
|
|
4803
4849
|
});
|
|
4850
|
+
const onUpdateFn_0_props_content = createMemo(() => props.content);
|
|
4804
4851
|
function onUpdateFn_0() {
|
|
4805
4852
|
if (props.content) {
|
|
4806
4853
|
mergeNewContent(props.content);
|
|
4807
4854
|
}
|
|
4808
4855
|
}
|
|
4809
|
-
createEffect(on(() => [
|
|
4856
|
+
createEffect(on(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
|
|
4857
|
+
const onUpdateFn_1_shouldSendResetCookie__ = createMemo(() => shouldSendResetCookie());
|
|
4810
4858
|
function onUpdateFn_1() {
|
|
4811
4859
|
}
|
|
4812
|
-
createEffect(on(() => [
|
|
4860
|
+
createEffect(on(() => [onUpdateFn_1_shouldSendResetCookie__()], onUpdateFn_1));
|
|
4861
|
+
const onUpdateFn_2_props_builderContextSignal_content__data__jsCode = createMemo(() => props.builderContextSignal.content?.data?.jsCode);
|
|
4813
4862
|
function onUpdateFn_2() {
|
|
4814
4863
|
evaluateJsCode();
|
|
4815
4864
|
}
|
|
4816
|
-
createEffect(on(() => [
|
|
4865
|
+
createEffect(on(() => [onUpdateFn_2_props_builderContextSignal_content__data__jsCode()], onUpdateFn_2));
|
|
4866
|
+
const onUpdateFn_3_props_builderContextSignal_content__data__httpRequests = createMemo(() => props.builderContextSignal.content?.data?.httpRequests);
|
|
4817
4867
|
function onUpdateFn_3() {
|
|
4818
4868
|
runHttpRequests();
|
|
4819
4869
|
}
|
|
4820
|
-
createEffect(on(() => [
|
|
4870
|
+
createEffect(on(() => [onUpdateFn_3_props_builderContextSignal_content__data__httpRequests()], onUpdateFn_3));
|
|
4871
|
+
const onUpdateFn_4_props_builderContextSignal_rootState = createMemo(() => props.builderContextSignal.rootState);
|
|
4821
4872
|
function onUpdateFn_4() {
|
|
4822
4873
|
emitStateUpdate();
|
|
4823
4874
|
}
|
|
4824
|
-
createEffect(on(() => [
|
|
4875
|
+
createEffect(on(() => [onUpdateFn_4_props_builderContextSignal_rootState()], onUpdateFn_4));
|
|
4876
|
+
const onUpdateFn_5_props_data = createMemo(() => props.data);
|
|
4825
4877
|
function onUpdateFn_5() {
|
|
4826
4878
|
if (props.data) {
|
|
4827
4879
|
mergeNewRootState(props.data);
|
|
4828
4880
|
}
|
|
4829
4881
|
}
|
|
4830
|
-
createEffect(on(() => [
|
|
4882
|
+
createEffect(on(() => [onUpdateFn_5_props_data()], onUpdateFn_5));
|
|
4883
|
+
const onUpdateFn_6_props_locale = createMemo(() => props.locale);
|
|
4831
4884
|
function onUpdateFn_6() {
|
|
4832
4885
|
if (props.locale) {
|
|
4833
4886
|
mergeNewRootState({
|
|
@@ -4835,7 +4888,7 @@ function EnableEditor(props) {
|
|
|
4835
4888
|
});
|
|
4836
4889
|
}
|
|
4837
4890
|
}
|
|
4838
|
-
createEffect(on(() => [
|
|
4891
|
+
createEffect(on(() => [onUpdateFn_6_props_locale()], onUpdateFn_6));
|
|
4839
4892
|
return createComponent(builder_context_default.Provider, {
|
|
4840
4893
|
get value() {
|
|
4841
4894
|
return props.builderContextSignal;
|
|
@@ -5167,16 +5220,16 @@ function ContentVariants(props) {
|
|
|
5167
5220
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
5168
5221
|
content: props.content
|
|
5169
5222
|
}));
|
|
5170
|
-
|
|
5223
|
+
const updateCookieAndStylesScriptStr = createMemo(() => {
|
|
5171
5224
|
return getUpdateCookieAndStylesScript(getVariants(props.content).map((value) => ({
|
|
5172
5225
|
id: value.testVariationId,
|
|
5173
5226
|
testRatio: value.testRatio
|
|
5174
5227
|
})), props.content?.id || "");
|
|
5175
|
-
}
|
|
5176
|
-
|
|
5228
|
+
});
|
|
5229
|
+
const hideVariantsStyleString = createMemo(() => {
|
|
5177
5230
|
return getVariants(props.content).map((value) => `.variant-${value.testVariationId} { display: none; } `).join("");
|
|
5178
|
-
}
|
|
5179
|
-
|
|
5231
|
+
});
|
|
5232
|
+
const defaultContent = createMemo(() => {
|
|
5180
5233
|
return shouldRenderVariants() ? {
|
|
5181
5234
|
...props.content,
|
|
5182
5235
|
testVariationId: props.content?.id
|
|
@@ -5184,7 +5237,7 @@ function ContentVariants(props) {
|
|
|
5184
5237
|
item: props.content,
|
|
5185
5238
|
canTrack: getDefaultCanTrack(props.canTrack)
|
|
5186
5239
|
});
|
|
5187
|
-
}
|
|
5240
|
+
});
|
|
5188
5241
|
onMount(() => {
|
|
5189
5242
|
setShouldRenderVariants(false);
|
|
5190
5243
|
});
|
|
@@ -5364,9 +5417,9 @@ var fetchSymbolContent = async ({
|
|
|
5364
5417
|
var _tmpl$17 = /* @__PURE__ */ template(`<div>`);
|
|
5365
5418
|
function Symbol(props) {
|
|
5366
5419
|
const [contentToUse, setContentToUse] = createSignal(props.symbol?.content);
|
|
5367
|
-
|
|
5420
|
+
const className = createMemo(() => {
|
|
5368
5421
|
return [...[props.attributes[getClassPropName()]], "builder-symbol", props.symbol?.inline ? "builder-inline-symbol" : void 0, props.symbol?.dynamic || props.dynamic ? "builder-dynamic-symbol" : void 0].filter(Boolean).join(" ");
|
|
5369
|
-
}
|
|
5422
|
+
});
|
|
5370
5423
|
function setContent() {
|
|
5371
5424
|
if (contentToUse())
|
|
5372
5425
|
return;
|
|
@@ -5380,12 +5433,12 @@ function Symbol(props) {
|
|
|
5380
5433
|
});
|
|
5381
5434
|
}
|
|
5382
5435
|
onMount(() => {
|
|
5383
|
-
setContent();
|
|
5384
5436
|
});
|
|
5437
|
+
const onUpdateFn_0_props_symbol = createMemo(() => props.symbol);
|
|
5385
5438
|
function onUpdateFn_0() {
|
|
5386
5439
|
setContent();
|
|
5387
5440
|
}
|
|
5388
|
-
createEffect(on(() => [
|
|
5441
|
+
createEffect(on(() => [onUpdateFn_0_props_symbol()], onUpdateFn_0));
|
|
5389
5442
|
return (() => {
|
|
5390
5443
|
const _el$ = _tmpl$17();
|
|
5391
5444
|
spread(_el$, mergeProps({
|