@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/lib/node/dev.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
  import { createRequire } from 'node:module';
5
5
 
@@ -282,7 +282,7 @@ function flattenState({
282
282
  return localState[prop];
283
283
  }
284
284
  const val = target[prop];
285
- if (typeof val === "object") {
285
+ if (typeof val === "object" && val !== null) {
286
286
  return flattenState({
287
287
  rootState: val,
288
288
  localState: void 0,
@@ -471,6 +471,30 @@ var shouldForceBrowserRuntimeInNode = () => {
471
471
  var chooseBrowserOrServerEval = (args) => isBrowser() || shouldForceBrowserRuntimeInNode() ? runInBrowser(args) : runInNode(args);
472
472
 
473
473
  // src/functions/evaluate/evaluate.ts
474
+ var EvalCache = class _EvalCache {
475
+ static cacheLimit = 20;
476
+ static cache = /* @__PURE__ */ new Map();
477
+ static getCacheKey(args) {
478
+ return JSON.stringify({
479
+ ...args,
480
+ // replace the event with a random number to break cache
481
+ // thats because we can't serialize the event object due to circular refs in DOM node refs.
482
+ event: args.event ? Math.random() : void 0
483
+ });
484
+ }
485
+ static getCachedValue(key) {
486
+ const cachedVal = _EvalCache.cache.get(key);
487
+ return cachedVal;
488
+ }
489
+ static setCachedValue(key, value) {
490
+ if (_EvalCache.cache.size > 20) {
491
+ _EvalCache.cache.delete(_EvalCache.cache.keys().next().value);
492
+ }
493
+ _EvalCache.cache.set(key, {
494
+ value
495
+ });
496
+ }
497
+ };
474
498
  function evaluate({
475
499
  code,
476
500
  context,
@@ -478,11 +502,12 @@ function evaluate({
478
502
  rootState,
479
503
  rootSetState,
480
504
  event,
481
- isExpression = true
505
+ isExpression = true,
506
+ enableCache
482
507
  }) {
483
508
  if (code === "") {
484
509
  logger.warn("Skipping evaluation of empty code block.");
485
- return;
510
+ return void 0;
486
511
  }
487
512
  const args = {
488
513
  code: parseCode(code, {
@@ -495,8 +520,20 @@ function evaluate({
495
520
  rootState,
496
521
  localState
497
522
  };
523
+ if (enableCache) {
524
+ const cacheKey = EvalCache.getCacheKey(args);
525
+ const cachedValue = EvalCache.getCachedValue(cacheKey);
526
+ if (cachedValue) {
527
+ return cachedValue.value;
528
+ }
529
+ }
498
530
  try {
499
- return chooseBrowserOrServerEval(args);
531
+ const newEval = chooseBrowserOrServerEval(args);
532
+ if (enableCache) {
533
+ const cacheKey = EvalCache.getCacheKey(args);
534
+ EvalCache.setCachedValue(cacheKey, newEval);
535
+ }
536
+ return newEval;
500
537
  } catch (e) {
501
538
  logger.error("Failed code evaluation: " + e.message, {
502
539
  code
@@ -538,7 +575,8 @@ var evaluateBindings = ({
538
575
  localState,
539
576
  rootState,
540
577
  rootSetState,
541
- context
578
+ context,
579
+ enableCache: true
542
580
  });
543
581
  set(copied, binding, value);
544
582
  }
@@ -772,6 +810,70 @@ function bindScrollInViewAnimation(animation) {
772
810
  });
773
811
  }
774
812
 
813
+ // src/functions/camel-to-kebab-case.ts
814
+ var camelToKebabCase = (string) => string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
815
+
816
+ // src/helpers/css.ts
817
+ var convertStyleMapToCSSArray = (style) => {
818
+ const cssProps = Object.entries(style).map(([key, value]) => {
819
+ if (typeof value === "string") {
820
+ return `${camelToKebabCase(key)}: ${value};`;
821
+ } else {
822
+ return void 0;
823
+ }
824
+ });
825
+ return cssProps.filter(checkIsDefined);
826
+ };
827
+ var convertStyleMapToCSS = (style) => convertStyleMapToCSSArray(style).join("\n");
828
+ var createCssClass = ({
829
+ mediaQuery,
830
+ className,
831
+ styles
832
+ }) => {
833
+ const cssClass = `.${className} {
834
+ ${convertStyleMapToCSS(styles)}
835
+ }`;
836
+ if (mediaQuery) {
837
+ return `${mediaQuery} {
838
+ ${cssClass}
839
+ }`;
840
+ } else {
841
+ return cssClass;
842
+ }
843
+ };
844
+
845
+ // src/functions/transform-style-property.ts
846
+ function transformStyleProperty({
847
+ style
848
+ }) {
849
+ return style;
850
+ }
851
+
852
+ // src/functions/get-style.ts
853
+ var getStyle = ({
854
+ block,
855
+ context
856
+ }) => {
857
+ return mapStyleObjToStrIfNeeded(transformStyleProperty({
858
+ style: block.style || {},
859
+ context,
860
+ block
861
+ }));
862
+ };
863
+ function mapStyleObjToStrIfNeeded(style) {
864
+ switch (TARGET) {
865
+ case "svelte":
866
+ case "vue":
867
+ case "solid":
868
+ return convertStyleMapToCSSArray(style).join(" ");
869
+ case "qwik":
870
+ case "reactNative":
871
+ case "react":
872
+ case "rsc":
873
+ return style;
874
+ }
875
+ }
876
+
775
877
  // src/components/block/block.helpers.ts
776
878
  var getComponent = ({
777
879
  block,
@@ -815,7 +917,8 @@ var getRepeatItemData = ({
815
917
  localState: context.localState,
816
918
  rootState: context.rootState,
817
919
  rootSetState: context.rootSetState,
818
- context: context.context
920
+ context: context.context,
921
+ enableCache: true
819
922
  });
820
923
  if (!Array.isArray(itemsArray)) {
821
924
  return void 0;
@@ -886,38 +989,6 @@ var getSizesForBreakpoints = ({
886
989
  };
887
990
  return newSizes;
888
991
  };
889
-
890
- // src/functions/camel-to-kebab-case.ts
891
- var camelToKebabCase = (string) => string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
892
-
893
- // src/helpers/css.ts
894
- var convertStyleMapToCSSArray = (style) => {
895
- const cssProps = Object.entries(style).map(([key, value]) => {
896
- if (typeof value === "string") {
897
- return `${camelToKebabCase(key)}: ${value};`;
898
- } else {
899
- return void 0;
900
- }
901
- });
902
- return cssProps.filter(checkIsDefined);
903
- };
904
- var convertStyleMapToCSS = (style) => convertStyleMapToCSSArray(style).join("\n");
905
- var createCssClass = ({
906
- mediaQuery,
907
- className,
908
- styles
909
- }) => {
910
- const cssClass = `.${className} {
911
- ${convertStyleMapToCSS(styles)}
912
- }`;
913
- if (mediaQuery) {
914
- return `${mediaQuery} {
915
- ${cssClass}
916
- }`;
917
- } else {
918
- return cssClass;
919
- }
920
- };
921
992
  var _tmpl$ = /* @__PURE__ */ template(`<style>`);
922
993
  function InlinedStyles(props) {
923
994
  return (() => {
@@ -938,7 +1009,7 @@ var inlined_styles_default = InlinedStyles;
938
1009
 
939
1010
  // src/components/block/components/block-styles.tsx
940
1011
  function BlockStyles(props) {
941
- function canShowBlock() {
1012
+ const canShowBlock = createMemo(() => {
942
1013
  const processedBlock = getProcessedBlock({
943
1014
  block: props.block,
944
1015
  localState: props.context.localState,
@@ -954,8 +1025,8 @@ function BlockStyles(props) {
954
1025
  return processedBlock.show;
955
1026
  }
956
1027
  return true;
957
- }
958
- function css5() {
1028
+ });
1029
+ const css5 = createMemo(() => {
959
1030
  const processedBlock = getProcessedBlock({
960
1031
  block: props.block,
961
1032
  localState: props.context.localState,
@@ -989,7 +1060,7 @@ function BlockStyles(props) {
989
1060
  mediaQuery: getMaxWidthQueryForSize("small", sizesWithUpdatedBreakpoints)
990
1061
  }) : "";
991
1062
  return [largeStylesClass, mediumStylesClass, smallStylesClass].join(" ");
992
- }
1063
+ });
993
1064
  return createComponent(Show, {
994
1065
  get when() {
995
1066
  return memo(() => !!(TARGET !== "reactNative" && css5()))() && canShowBlock();
@@ -1019,7 +1090,8 @@ var createEventHandler = (value, options) => (event) => evaluate({
1019
1090
  rootState: options.rootState,
1020
1091
  rootSetState: options.rootSetState,
1021
1092
  event,
1022
- isExpression: false
1093
+ isExpression: false,
1094
+ enableCache: true
1023
1095
  });
1024
1096
 
1025
1097
  // src/functions/get-block-actions.ts
@@ -1047,38 +1119,6 @@ function getBlockActions(options) {
1047
1119
  return obj;
1048
1120
  }
1049
1121
 
1050
- // src/functions/transform-style-property.ts
1051
- function transformStyleProperty({
1052
- style
1053
- }) {
1054
- return style;
1055
- }
1056
-
1057
- // src/functions/get-style.ts
1058
- var getStyle = ({
1059
- block,
1060
- context
1061
- }) => {
1062
- return mapStyleObjToStrIfNeeded(transformStyleProperty({
1063
- style: block.style || {},
1064
- context,
1065
- block
1066
- }));
1067
- };
1068
- function mapStyleObjToStrIfNeeded(style) {
1069
- switch (TARGET) {
1070
- case "svelte":
1071
- case "vue":
1072
- case "solid":
1073
- return convertStyleMapToCSSArray(style).join(" ");
1074
- case "qwik":
1075
- case "reactNative":
1076
- case "react":
1077
- case "rsc":
1078
- return style;
1079
- }
1080
- }
1081
-
1082
1122
  // src/functions/transform-block-properties.ts
1083
1123
  function transformBlockProperties({
1084
1124
  properties
@@ -1280,21 +1320,20 @@ var repeated_block_default = RepeatedBlock;
1280
1320
 
1281
1321
  // src/components/block/block.tsx
1282
1322
  function Block(props) {
1283
- const [childrenContext, setChildrenContext] = createSignal(props.context);
1284
- function blockComponent() {
1323
+ const blockComponent = createMemo(() => {
1285
1324
  return getComponent({
1286
1325
  block: props.block,
1287
1326
  context: props.context,
1288
1327
  registeredComponents: props.registeredComponents
1289
1328
  });
1290
- }
1291
- function repeatItem() {
1329
+ });
1330
+ const repeatItem = createMemo(() => {
1292
1331
  return getRepeatItemData({
1293
1332
  block: props.block,
1294
1333
  context: props.context
1295
1334
  });
1296
- }
1297
- function processedBlock() {
1335
+ });
1336
+ const processedBlock = createMemo(() => {
1298
1337
  return props.block.repeat?.collection ? props.block : getProcessedBlock({
1299
1338
  block: props.block,
1300
1339
  localState: props.context.localState,
@@ -1303,15 +1342,15 @@ function Block(props) {
1303
1342
  context: props.context.context,
1304
1343
  shouldEvaluateBindings: true
1305
1344
  });
1306
- }
1307
- function Tag() {
1345
+ });
1346
+ const Tag = createMemo(() => {
1308
1347
  const shouldUseLink = props.block.tagName === "a" || processedBlock().properties?.href || processedBlock().href;
1309
1348
  if (shouldUseLink) {
1310
1349
  return props.linkComponent || "a";
1311
1350
  }
1312
1351
  return props.block.tagName || "div";
1313
- }
1314
- function canShowBlock() {
1352
+ });
1353
+ const canShowBlock = createMemo(() => {
1315
1354
  if (props.block.repeat?.collection) {
1316
1355
  if (repeatItem()?.length)
1317
1356
  return true;
@@ -1320,12 +1359,12 @@ function Block(props) {
1320
1359
  const shouldHide = "hide" in processedBlock() ? processedBlock().hide : false;
1321
1360
  const shouldShow = "show" in processedBlock() ? processedBlock().show : true;
1322
1361
  return shouldShow && !shouldHide;
1323
- }
1324
- function childrenWithoutParentComponent() {
1362
+ });
1363
+ const childrenWithoutParentComponent = createMemo(() => {
1325
1364
  const shouldRenderChildrenOutsideRef = !blockComponent()?.component && !repeatItem();
1326
1365
  return shouldRenderChildrenOutsideRef ? processedBlock().children ?? [] : [];
1327
- }
1328
- function componentRefProps() {
1366
+ });
1367
+ const componentRefProps = createMemo(() => {
1329
1368
  return {
1330
1369
  blockChildren: processedBlock().children ?? [],
1331
1370
  componentRef: blockComponent()?.component,
@@ -1339,14 +1378,14 @@ function Block(props) {
1339
1378
  builderComponents: props.registeredComponents
1340
1379
  } : {}
1341
1380
  },
1342
- context: childrenContext(),
1381
+ context: props.context,
1343
1382
  linkComponent: props.linkComponent,
1344
1383
  registeredComponents: props.registeredComponents,
1345
1384
  builderBlock: processedBlock(),
1346
1385
  includeBlockProps: blockComponent()?.noWrap === true,
1347
1386
  isInteractive: !blockComponent()?.isRSC
1348
1387
  };
1349
- }
1388
+ });
1350
1389
  onMount(() => {
1351
1390
  const blockId = processedBlock().id;
1352
1391
  const animations = processedBlock().animations;
@@ -1488,14 +1527,14 @@ function Block(props) {
1488
1527
  return child.id;
1489
1528
  },
1490
1529
  block: child,
1491
- get context() {
1492
- return childrenContext();
1493
- },
1494
1530
  get registeredComponents() {
1495
1531
  return props.registeredComponents;
1496
1532
  },
1497
1533
  get linkComponent() {
1498
1534
  return props.linkComponent;
1535
+ },
1536
+ get context() {
1537
+ return props.context;
1499
1538
  }
1500
1539
  });
1501
1540
  }
@@ -1511,9 +1550,9 @@ function Block(props) {
1511
1550
  }
1512
1551
  var block_default = Block;
1513
1552
  function BlocksWrapper(props) {
1514
- function className() {
1553
+ const className = createMemo(() => {
1515
1554
  return "builder-blocks" + (!props.blocks?.length ? " no-blocks" : "");
1516
- }
1555
+ });
1517
1556
  function onClick() {
1518
1557
  if (isEditing() && !props.blocks?.length) {
1519
1558
  window.parent?.postMessage({
@@ -1653,7 +1692,7 @@ function Columns(props) {
1653
1692
  }) {
1654
1693
  return stackAt() === "never" ? desktopStyle : stackedStyle;
1655
1694
  }
1656
- function columnsCssVars() {
1695
+ const columnsCssVars = createMemo(() => {
1657
1696
  return {
1658
1697
  "--flex-dir": flexDir(),
1659
1698
  "--flex-dir-tablet": getTabletStyle({
@@ -1661,7 +1700,7 @@ function Columns(props) {
1661
1700
  desktopStyle: "row"
1662
1701
  })
1663
1702
  };
1664
- }
1703
+ });
1665
1704
  function columnCssVars(index) {
1666
1705
  const gutter = index === 0 ? 0 : gutterSize();
1667
1706
  const width = getColumnCssWidth(index);
@@ -1700,7 +1739,7 @@ function Columns(props) {
1700
1739
  const breakpointSizes = getSizesForBreakpoints(props.builderContext.content?.meta?.breakpoints || {});
1701
1740
  return breakpointSizes[size].max;
1702
1741
  }
1703
- function columnsStyles() {
1742
+ const columnsStyles = createMemo(() => {
1704
1743
  return `
1705
1744
  @media (max-width: ${getWidthForBreakpointSize("medium")}px) {
1706
1745
  .${props.builderBlock.id}-breakpoints {
@@ -1726,7 +1765,7 @@ function Columns(props) {
1726
1765
  }
1727
1766
  },
1728
1767
  `;
1729
- }
1768
+ });
1730
1769
  return (() => {
1731
1770
  const _el$ = _tmpl$2();
1732
1771
  spread(_el$, mergeProps({
@@ -1864,7 +1903,7 @@ var _tmpl$4 = /* @__PURE__ */ template(`<source type=image/webp>`);
1864
1903
  var _tmpl$22 = /* @__PURE__ */ template(`<picture><img loading=lazy>`);
1865
1904
  var _tmpl$32 = /* @__PURE__ */ template(`<div>`);
1866
1905
  function Image(props) {
1867
- function srcSetToUse() {
1906
+ const srcSetToUse = createMemo(() => {
1868
1907
  const imageToUse = props.image || props.src;
1869
1908
  const url = imageToUse;
1870
1909
  if (!url || // We can auto add srcset for cdn.builder.io and shopify
@@ -1881,15 +1920,15 @@ function Image(props) {
1881
1920
  return getSrcSet(url);
1882
1921
  }
1883
1922
  return getSrcSet(url);
1884
- }
1885
- function webpSrcSet() {
1923
+ });
1924
+ const webpSrcSet = createMemo(() => {
1886
1925
  if (srcSetToUse()?.match(/builder\.io/) && !props.noWebp) {
1887
1926
  return srcSetToUse().replace(/\?/g, "?format=webp&");
1888
1927
  } else {
1889
1928
  return "";
1890
1929
  }
1891
- }
1892
- function aspectRatioCss() {
1930
+ });
1931
+ const aspectRatioCss = createMemo(() => {
1893
1932
  const aspectRatioStyles = {
1894
1933
  position: "absolute",
1895
1934
  height: "100%",
@@ -1899,7 +1938,7 @@ function Image(props) {
1899
1938
  };
1900
1939
  const out = props.aspectRatio ? aspectRatioStyles : void 0;
1901
1940
  return out;
1902
- }
1941
+ });
1903
1942
  return [(() => {
1904
1943
  const _el$ = _tmpl$22(), _el$3 = _el$.firstChild;
1905
1944
  insert(_el$, createComponent(Show, {
@@ -2892,13 +2931,15 @@ function Embed(props) {
2892
2931
  }
2893
2932
  }
2894
2933
  let elem;
2934
+ const onUpdateFn_0_elem = createMemo(() => elem);
2935
+ const onUpdateFn_0_ranInitFn__ = createMemo(() => ranInitFn());
2895
2936
  function onUpdateFn_0() {
2896
2937
  if (elem && !ranInitFn()) {
2897
2938
  setRanInitFn(true);
2898
2939
  findAndRunScripts();
2899
2940
  }
2900
2941
  }
2901
- createEffect(on(() => [elem, ranInitFn()], onUpdateFn_0));
2942
+ createEffect(on(() => [onUpdateFn_0_elem(), onUpdateFn_0_ranInitFn__()], onUpdateFn_0));
2902
2943
  return (() => {
2903
2944
  const _el$ = _tmpl$9();
2904
2945
  const _ref$ = elem;
@@ -3792,7 +3833,7 @@ var _tmpl$15 = /* @__PURE__ */ template(`<source type=video/mp4>`);
3792
3833
  var _tmpl$25 = /* @__PURE__ */ template(`<div>`);
3793
3834
  var _tmpl$33 = /* @__PURE__ */ template(`<div><video class=builder-video>`);
3794
3835
  function Video(props) {
3795
- function videoProps() {
3836
+ const videoProps = createMemo(() => {
3796
3837
  return {
3797
3838
  ...props.autoPlay === true ? {
3798
3839
  autoPlay: true
@@ -3810,12 +3851,12 @@ function Video(props) {
3810
3851
  playsInline: true
3811
3852
  } : {}
3812
3853
  };
3813
- }
3814
- function spreadProps() {
3854
+ });
3855
+ const spreadProps = createMemo(() => {
3815
3856
  return {
3816
3857
  ...videoProps()
3817
3858
  };
3818
- }
3859
+ });
3819
3860
  return (() => {
3820
3861
  const _el$ = _tmpl$33(), _el$2 = _el$.firstChild;
3821
3862
  _el$.style.setProperty("position", "relative");
@@ -4530,7 +4571,7 @@ function isFromTrustedHost(trustedHosts, e) {
4530
4571
  }
4531
4572
 
4532
4573
  // src/constants/sdk-version.ts
4533
- var SDK_VERSION = "0.14.6";
4574
+ var SDK_VERSION = "1.0.13";
4534
4575
 
4535
4576
  // src/functions/register.ts
4536
4577
  var registry = {};
@@ -4809,7 +4850,11 @@ function EnableEditor(props) {
4809
4850
  context: props.context || {},
4810
4851
  localState: void 0,
4811
4852
  rootState: props.builderContextSignal.rootState,
4812
- rootSetState: props.builderContextSignal.rootSetState
4853
+ rootSetState: props.builderContextSignal.rootSetState,
4854
+ /**
4855
+ * We don't want to cache the result of the JS code, since it's arbitrary side effect code.
4856
+ */
4857
+ enableCache: false
4813
4858
  });
4814
4859
  }
4815
4860
  }
@@ -4832,13 +4877,14 @@ function EnableEditor(props) {
4832
4877
  }
4833
4878
  }
4834
4879
  function evalExpression(expression) {
4835
- return expression.replace(/{{([^}]+)}}/g, (_match, group) => evaluate({
4880
+ return expression.replace(/{{([^}]+)}}/g, (_match, group) => String(evaluate({
4836
4881
  code: group,
4837
4882
  context: props.context || {},
4838
4883
  localState: void 0,
4839
4884
  rootState: props.builderContextSignal.rootState,
4840
- rootSetState: props.builderContextSignal.rootSetState
4841
- }));
4885
+ rootSetState: props.builderContextSignal.rootSetState,
4886
+ enableCache: true
4887
+ })));
4842
4888
  }
4843
4889
  function handleRequest({
4844
4890
  url,
@@ -4943,33 +4989,40 @@ function EnableEditor(props) {
4943
4989
  runHttpRequests();
4944
4990
  emitStateUpdate();
4945
4991
  });
4992
+ const onUpdateFn_0_props_content = createMemo(() => props.content);
4946
4993
  function onUpdateFn_0() {
4947
4994
  if (props.content) {
4948
4995
  mergeNewContent(props.content);
4949
4996
  }
4950
4997
  }
4951
- createEffect(on(() => [props.content], onUpdateFn_0));
4998
+ createEffect(on(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
4999
+ const onUpdateFn_1_shouldSendResetCookie__ = createMemo(() => shouldSendResetCookie());
4952
5000
  function onUpdateFn_1() {
4953
5001
  }
4954
- createEffect(on(() => [shouldSendResetCookie()], onUpdateFn_1));
5002
+ createEffect(on(() => [onUpdateFn_1_shouldSendResetCookie__()], onUpdateFn_1));
5003
+ const onUpdateFn_2_props_builderContextSignal_content__data__jsCode = createMemo(() => props.builderContextSignal.content?.data?.jsCode);
4955
5004
  function onUpdateFn_2() {
4956
5005
  evaluateJsCode();
4957
5006
  }
4958
- createEffect(on(() => [props.builderContextSignal.content?.data?.jsCode], onUpdateFn_2));
5007
+ createEffect(on(() => [onUpdateFn_2_props_builderContextSignal_content__data__jsCode()], onUpdateFn_2));
5008
+ const onUpdateFn_3_props_builderContextSignal_content__data__httpRequests = createMemo(() => props.builderContextSignal.content?.data?.httpRequests);
4959
5009
  function onUpdateFn_3() {
4960
5010
  runHttpRequests();
4961
5011
  }
4962
- createEffect(on(() => [props.builderContextSignal.content?.data?.httpRequests], onUpdateFn_3));
5012
+ createEffect(on(() => [onUpdateFn_3_props_builderContextSignal_content__data__httpRequests()], onUpdateFn_3));
5013
+ const onUpdateFn_4_props_builderContextSignal_rootState = createMemo(() => props.builderContextSignal.rootState);
4963
5014
  function onUpdateFn_4() {
4964
5015
  emitStateUpdate();
4965
5016
  }
4966
- createEffect(on(() => [props.builderContextSignal.rootState], onUpdateFn_4));
5017
+ createEffect(on(() => [onUpdateFn_4_props_builderContextSignal_rootState()], onUpdateFn_4));
5018
+ const onUpdateFn_5_props_data = createMemo(() => props.data);
4967
5019
  function onUpdateFn_5() {
4968
5020
  if (props.data) {
4969
5021
  mergeNewRootState(props.data);
4970
5022
  }
4971
5023
  }
4972
- createEffect(on(() => [props.data], onUpdateFn_5));
5024
+ createEffect(on(() => [onUpdateFn_5_props_data()], onUpdateFn_5));
5025
+ const onUpdateFn_6_props_locale = createMemo(() => props.locale);
4973
5026
  function onUpdateFn_6() {
4974
5027
  if (props.locale) {
4975
5028
  mergeNewRootState({
@@ -4977,7 +5030,7 @@ function EnableEditor(props) {
4977
5030
  });
4978
5031
  }
4979
5032
  }
4980
- createEffect(on(() => [props.locale], onUpdateFn_6));
5033
+ createEffect(on(() => [onUpdateFn_6_props_locale()], onUpdateFn_6));
4981
5034
  return createComponent(builder_context_default.Provider, {
4982
5035
  get value() {
4983
5036
  return props.builderContextSignal;
@@ -5079,18 +5132,7 @@ var getCss = ({
5079
5132
  }
5080
5133
  return cssCode?.replace(/&/g, `div[builder-content-id="${contentId}"]`) || "";
5081
5134
  };
5082
-
5083
- // src/components/content/components/styles.tsx
5084
- function ContentStyles(props) {
5085
- const [injectedStyles, setInjectedStyles] = createSignal(`
5086
- ${getCss({
5087
- cssCode: props.cssCode,
5088
- contentId: props.contentId
5089
- })}
5090
- ${getFontCss({
5091
- customFonts: props.customFonts
5092
- })}
5093
-
5135
+ var DEFAULT_STYLES = `
5094
5136
  .builder-button {
5095
5137
  all: unset;
5096
5138
  }
@@ -5107,6 +5149,22 @@ ${getFontCss({
5107
5149
  text-align: inherit;
5108
5150
  font-family: inherit;
5109
5151
  }
5152
+ `;
5153
+ var getDefaultStyles = (isNested) => {
5154
+ return !isNested ? DEFAULT_STYLES : "";
5155
+ };
5156
+
5157
+ // src/components/content/components/styles.tsx
5158
+ function ContentStyles(props) {
5159
+ const [injectedStyles, setInjectedStyles] = createSignal(`
5160
+ ${getCss({
5161
+ cssCode: props.cssCode,
5162
+ contentId: props.contentId
5163
+ })}
5164
+ ${getFontCss({
5165
+ customFonts: props.customFonts
5166
+ })}
5167
+ ${getDefaultStyles(props.isNestedRender)}
5110
5168
  `.trim());
5111
5169
  return createComponent(inlined_styles_default, {
5112
5170
  get styles() {
@@ -5271,6 +5329,9 @@ function ContentComponent(props) {
5271
5329
  when: TARGET !== "reactNative",
5272
5330
  get children() {
5273
5331
  return createComponent(styles_default, {
5332
+ get isNestedRender() {
5333
+ return props.isNestedRender;
5334
+ },
5274
5335
  get contentId() {
5275
5336
  return builderContextSignal().content?.id;
5276
5337
  },
@@ -5309,16 +5370,16 @@ function ContentVariants(props) {
5309
5370
  canTrack: getDefaultCanTrack(props.canTrack),
5310
5371
  content: props.content
5311
5372
  }));
5312
- function updateCookieAndStylesScriptStr() {
5373
+ const updateCookieAndStylesScriptStr = createMemo(() => {
5313
5374
  return getUpdateCookieAndStylesScript(getVariants(props.content).map((value) => ({
5314
5375
  id: value.testVariationId,
5315
5376
  testRatio: value.testRatio
5316
5377
  })), props.content?.id || "");
5317
- }
5318
- function hideVariantsStyleString() {
5378
+ });
5379
+ const hideVariantsStyleString = createMemo(() => {
5319
5380
  return getVariants(props.content).map((value) => `.variant-${value.testVariationId} { display: none; } `).join("");
5320
- }
5321
- function defaultContent() {
5381
+ });
5382
+ const defaultContent = createMemo(() => {
5322
5383
  return shouldRenderVariants() ? {
5323
5384
  ...props.content,
5324
5385
  testVariationId: props.content?.id
@@ -5326,13 +5387,13 @@ function ContentVariants(props) {
5326
5387
  item: props.content,
5327
5388
  canTrack: getDefaultCanTrack(props.canTrack)
5328
5389
  });
5329
- }
5390
+ });
5330
5391
  onMount(() => {
5331
5392
  setShouldRenderVariants(false);
5332
5393
  });
5333
5394
  return [createComponent(Show, {
5334
5395
  get when() {
5335
- return !props.__isNestedRender && TARGET !== "reactNative";
5396
+ return !props.isNestedRender && TARGET !== "reactNative";
5336
5397
  },
5337
5398
  get children() {
5338
5399
  return createComponent(inlined_script_default, {
@@ -5364,6 +5425,9 @@ function ContentVariants(props) {
5364
5425
  children: (variant, _index) => {
5365
5426
  _index();
5366
5427
  return createComponent(content_default, {
5428
+ get isNestedRender() {
5429
+ return props.isNestedRender;
5430
+ },
5367
5431
  get key() {
5368
5432
  return variant.testVariationId;
5369
5433
  },
@@ -5421,7 +5485,11 @@ function ContentVariants(props) {
5421
5485
  }
5422
5486
  })];
5423
5487
  }
5424
- }), createComponent(content_default, mergeProps({}, {
5488
+ }), createComponent(content_default, mergeProps({
5489
+ get isNestedRender() {
5490
+ return props.isNestedRender;
5491
+ }
5492
+ }, {}, {
5425
5493
  get content() {
5426
5494
  return defaultContent();
5427
5495
  },
@@ -5506,9 +5574,9 @@ var fetchSymbolContent = async ({
5506
5574
  var _tmpl$17 = /* @__PURE__ */ template(`<div>`);
5507
5575
  function Symbol(props) {
5508
5576
  const [contentToUse, setContentToUse] = createSignal(props.symbol?.content);
5509
- function className() {
5577
+ const className = createMemo(() => {
5510
5578
  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(" ");
5511
- }
5579
+ });
5512
5580
  function setContent() {
5513
5581
  if (contentToUse())
5514
5582
  return;
@@ -5522,12 +5590,12 @@ function Symbol(props) {
5522
5590
  });
5523
5591
  }
5524
5592
  onMount(() => {
5525
- setContent();
5526
5593
  });
5594
+ const onUpdateFn_0_props_symbol = createMemo(() => props.symbol);
5527
5595
  function onUpdateFn_0() {
5528
5596
  setContent();
5529
5597
  }
5530
- createEffect(on(() => [props.symbol], onUpdateFn_0));
5598
+ createEffect(on(() => [onUpdateFn_0_props_symbol()], onUpdateFn_0));
5531
5599
  return (() => {
5532
5600
  const _el$ = _tmpl$17();
5533
5601
  spread(_el$, mergeProps({
@@ -5536,7 +5604,7 @@ function Symbol(props) {
5536
5604
  }
5537
5605
  }, {}, () => props.attributes, {}), false, true);
5538
5606
  insert(_el$, createComponent(content_variants_default, {
5539
- __isNestedRender: true,
5607
+ isNestedRender: true,
5540
5608
  get apiVersion() {
5541
5609
  return props.builderContext.apiVersion;
5542
5610
  },