@builder.io/sdk-qwik 0.14.5 → 0.14.7

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.
@@ -211,7 +211,7 @@ function flattenState({ rootState, localState, rootSetState }) {
211
211
  if (localState && prop in localState)
212
212
  return localState[prop];
213
213
  const val = target[prop];
214
- if (typeof val === "object")
214
+ if (typeof val === "object" && val !== null)
215
215
  return flattenState({
216
216
  rootState: val,
217
217
  localState: void 0,
@@ -3491,10 +3491,34 @@ const shouldForceBrowserRuntimeInNode = () => {
3491
3491
  return false;
3492
3492
  };
3493
3493
  const chooseBrowserOrServerEval = (args) => build.isBrowser || shouldForceBrowserRuntimeInNode() ? runInBrowser(args) : runInEdge(args);
3494
- function evaluate({ code, context, localState, rootState, rootSetState, event, isExpression = true }) {
3494
+ const _EvalCache = class _EvalCache2 {
3495
+ static getCacheKey(args) {
3496
+ return JSON.stringify({
3497
+ ...args,
3498
+ // replace the event with a random number to break cache
3499
+ // thats because we can't serialize the event object due to circular refs in DOM node refs.
3500
+ event: args.event ? Math.random() : void 0
3501
+ });
3502
+ }
3503
+ static getCachedValue(key) {
3504
+ const cachedVal = _EvalCache2.cache.get(key);
3505
+ return cachedVal;
3506
+ }
3507
+ static setCachedValue(key, value) {
3508
+ if (_EvalCache2.cache.size > 20)
3509
+ _EvalCache2.cache.delete(_EvalCache2.cache.keys().next().value);
3510
+ _EvalCache2.cache.set(key, {
3511
+ value
3512
+ });
3513
+ }
3514
+ };
3515
+ _EvalCache.cacheLimit = 20;
3516
+ _EvalCache.cache = /* @__PURE__ */ new Map();
3517
+ let EvalCache = _EvalCache;
3518
+ function evaluate({ code, context, localState, rootState, rootSetState, event, isExpression = true, enableCache }) {
3495
3519
  if (code === "") {
3496
3520
  logger.warn("Skipping evaluation of empty code block.");
3497
- return;
3521
+ return void 0;
3498
3522
  }
3499
3523
  const args = {
3500
3524
  code: parseCode(code, {
@@ -3507,8 +3531,19 @@ function evaluate({ code, context, localState, rootState, rootSetState, event, i
3507
3531
  rootState,
3508
3532
  localState
3509
3533
  };
3534
+ if (enableCache) {
3535
+ const cacheKey = EvalCache.getCacheKey(args);
3536
+ const cachedValue = EvalCache.getCachedValue(cacheKey);
3537
+ if (cachedValue)
3538
+ return cachedValue.value;
3539
+ }
3510
3540
  try {
3511
- return chooseBrowserOrServerEval(args);
3541
+ const newEval = chooseBrowserOrServerEval(args);
3542
+ if (enableCache) {
3543
+ const cacheKey = EvalCache.getCacheKey(args);
3544
+ EvalCache.setCachedValue(cacheKey, newEval);
3545
+ }
3546
+ return newEval;
3512
3547
  } catch (e) {
3513
3548
  logger.error("Failed code evaluation: " + e.message, {
3514
3549
  code
@@ -3540,7 +3575,8 @@ const evaluateBindings = ({ block, context, localState, rootState, rootSetState
3540
3575
  localState,
3541
3576
  rootState,
3542
3577
  rootSetState,
3543
- context
3578
+ context,
3579
+ enableCache: true
3544
3580
  });
3545
3581
  set(copied, binding, value);
3546
3582
  }
@@ -3754,6 +3790,51 @@ function bindScrollInViewAnimation(animation) {
3754
3790
  immediateOnScroll();
3755
3791
  });
3756
3792
  }
3793
+ const camelToKebabCase = (string) => string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
3794
+ const convertStyleMapToCSSArray = (style) => {
3795
+ const cssProps = Object.entries(style).map(([key, value]) => {
3796
+ if (typeof value === "string")
3797
+ return `${camelToKebabCase(key)}: ${value};`;
3798
+ else
3799
+ return void 0;
3800
+ });
3801
+ return cssProps.filter(checkIsDefined);
3802
+ };
3803
+ const convertStyleMapToCSS = (style) => convertStyleMapToCSSArray(style).join("\n");
3804
+ const createCssClass = ({ mediaQuery, className, styles }) => {
3805
+ const cssClass = `.${className} {
3806
+ ${convertStyleMapToCSS(styles)}
3807
+ }`;
3808
+ if (mediaQuery)
3809
+ return `${mediaQuery} {
3810
+ ${cssClass}
3811
+ }`;
3812
+ else
3813
+ return cssClass;
3814
+ };
3815
+ function transformStyleProperty({ style }) {
3816
+ return style;
3817
+ }
3818
+ const getStyle = ({ block, context }) => {
3819
+ return mapStyleObjToStrIfNeeded(transformStyleProperty({
3820
+ style: block.style || {},
3821
+ context,
3822
+ block
3823
+ }));
3824
+ };
3825
+ function mapStyleObjToStrIfNeeded(style) {
3826
+ switch (TARGET) {
3827
+ case "svelte":
3828
+ case "vue":
3829
+ case "solid":
3830
+ return convertStyleMapToCSSArray(style).join(" ");
3831
+ case "qwik":
3832
+ case "reactNative":
3833
+ case "react":
3834
+ case "rsc":
3835
+ return style;
3836
+ }
3837
+ }
3757
3838
  const getComponent = ({ block, context, registeredComponents }) => {
3758
3839
  var _a;
3759
3840
  const componentName = (_a = getProcessedBlock({
@@ -3784,7 +3865,8 @@ const getRepeatItemData = ({ block, context }) => {
3784
3865
  localState: context.localState,
3785
3866
  rootState: context.rootState,
3786
3867
  rootSetState: context.rootSetState,
3787
- context: context.context
3868
+ context: context.context,
3869
+ enableCache: true
3788
3870
  });
3789
3871
  if (!Array.isArray(itemsArray))
3790
3872
  return void 0;
@@ -3848,28 +3930,6 @@ const getSizesForBreakpoints = ({ small, medium }) => {
3848
3930
  };
3849
3931
  return newSizes;
3850
3932
  };
3851
- const camelToKebabCase = (string) => string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
3852
- const convertStyleMapToCSSArray = (style) => {
3853
- const cssProps = Object.entries(style).map(([key, value]) => {
3854
- if (typeof value === "string")
3855
- return `${camelToKebabCase(key)}: ${value};`;
3856
- else
3857
- return void 0;
3858
- });
3859
- return cssProps.filter(checkIsDefined);
3860
- };
3861
- const convertStyleMapToCSS = (style) => convertStyleMapToCSSArray(style).join("\n");
3862
- const createCssClass = ({ mediaQuery, className, styles }) => {
3863
- const cssClass = `.${className} {
3864
- ${convertStyleMapToCSS(styles)}
3865
- }`;
3866
- if (mediaQuery)
3867
- return `${mediaQuery} {
3868
- ${cssClass}
3869
- }`;
3870
- else
3871
- return cssClass;
3872
- };
3873
3933
  const InlinedStyles = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl((props) => {
3874
3934
  return /* @__PURE__ */ qwik._jsxQ("style", null, {
3875
3935
  dangerouslySetInnerHTML: qwik._fnSignal((p0) => p0.styles, [
@@ -3968,7 +4028,8 @@ function createEventHandler(value, options) {
3968
4028
  localState: options2.localState,
3969
4029
  rootState: options2.rootState,
3970
4030
  rootSetState: options2.rootSetState,
3971
- event
4031
+ event,
4032
+ enableCache: true
3972
4033
  });
3973
4034
  }, "createEventHandler_7wCAiJVliNE", [
3974
4035
  options,
@@ -3996,29 +4057,6 @@ function getBlockActions(options) {
3996
4057
  }
3997
4058
  return obj;
3998
4059
  }
3999
- function transformStyleProperty({ style }) {
4000
- return style;
4001
- }
4002
- const getStyle = ({ block, context }) => {
4003
- return mapStyleObjToStrIfNeeded(transformStyleProperty({
4004
- style: block.style || {},
4005
- context,
4006
- block
4007
- }));
4008
- };
4009
- function mapStyleObjToStrIfNeeded(style) {
4010
- switch (TARGET) {
4011
- case "svelte":
4012
- case "vue":
4013
- case "solid":
4014
- return convertStyleMapToCSSArray(style).join(" ");
4015
- case "qwik":
4016
- case "reactNative":
4017
- case "react":
4018
- case "rsc":
4019
- return style;
4020
- }
4021
- }
4022
4060
  function transformBlockProperties({ properties }) {
4023
4061
  return properties;
4024
4062
  }
@@ -4198,9 +4236,6 @@ const RepeatedBlock = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inl
4198
4236
  const Block = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl((props) => {
4199
4237
  var _a;
4200
4238
  qwik._jsxBranch();
4201
- const state = qwik.useStore({
4202
- childrenContext: props.context
4203
- });
4204
4239
  const blockComponent = qwik.useComputedQrl(/* @__PURE__ */ qwik.inlinedQrl(() => {
4205
4240
  const [props2] = qwik.useLexicalScope();
4206
4241
  return getComponent({
@@ -4273,7 +4308,7 @@ const Block = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl(
4273
4308
  ]));
4274
4309
  const componentRefProps = qwik.useComputedQrl(/* @__PURE__ */ qwik.inlinedQrl(() => {
4275
4310
  var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
4276
- const [blockComponent2, processedBlock2, props2, state2] = qwik.useLexicalScope();
4311
+ const [blockComponent2, processedBlock2, props2] = qwik.useLexicalScope();
4277
4312
  return {
4278
4313
  blockChildren: processedBlock2.value.children ?? [],
4279
4314
  componentRef: (_a2 = blockComponent2.value) == null ? void 0 : _a2.component,
@@ -4287,7 +4322,7 @@ const Block = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl(
4287
4322
  builderComponents: props2.registeredComponents
4288
4323
  } : {}
4289
4324
  },
4290
- context: state2.childrenContext,
4325
+ context: props2.context,
4291
4326
  linkComponent: props2.linkComponent,
4292
4327
  registeredComponents: props2.registeredComponents,
4293
4328
  builderBlock: processedBlock2.value,
@@ -4297,8 +4332,7 @@ const Block = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl(
4297
4332
  }, "Block_component_componentRefProps_useComputed_Ikbl8VO04ho", [
4298
4333
  blockComponent,
4299
4334
  processedBlock,
4300
- props,
4301
- state
4335
+ props
4302
4336
  ]));
4303
4337
  qwik.useVisibleTaskQrl(/* @__PURE__ */ qwik.inlinedQrl(() => {
4304
4338
  const [processedBlock2] = qwik.useLexicalScope();
@@ -4406,19 +4440,19 @@ const Block = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl(
4406
4440
  (childrenWithoutParentComponent.value || []).map((child) => {
4407
4441
  return /* @__PURE__ */ qwik._jsxC(Block, {
4408
4442
  block: child,
4409
- get context() {
4410
- return state.childrenContext;
4411
- },
4412
4443
  get registeredComponents() {
4413
4444
  return props.registeredComponents;
4414
4445
  },
4415
4446
  get linkComponent() {
4416
4447
  return props.linkComponent;
4417
4448
  },
4449
+ get context() {
4450
+ return props.context;
4451
+ },
4418
4452
  [qwik._IMMUTABLE]: {
4419
- context: qwik._fnSignal((p0) => p0.childrenContext, [
4420
- state
4421
- ], "p0.childrenContext"),
4453
+ context: qwik._fnSignal((p0) => p0.context, [
4454
+ props
4455
+ ], "p0.context"),
4422
4456
  linkComponent: qwik._fnSignal((p0) => p0.linkComponent, [
4423
4457
  props
4424
4458
  ], "p0.linkComponent"),
@@ -5012,9 +5046,9 @@ const Image = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl(
5012
5046
  props
5013
5047
  ], '"builder-image"+(p0.className?" "+p0.className:"")+" img-Image"'),
5014
5048
  loading: "lazy",
5015
- role: qwik._fnSignal((p0) => p0.altText ? "presentation" : void 0, [
5049
+ role: qwik._fnSignal((p0) => p0.altText ? void 0 : "presentation", [
5016
5050
  props
5017
- ], 'p0.altText?"presentation":undefined'),
5051
+ ], 'p0.altText?undefined:"presentation"'),
5018
5052
  sizes: qwik._fnSignal((p0) => p0.sizes, [
5019
5053
  props
5020
5054
  ], "p0.sizes"),
@@ -7591,7 +7625,7 @@ function isFromTrustedHost(trustedHosts, e) {
7591
7625
  const url = new URL(e.origin), hostname = url.hostname;
7592
7626
  return (trustedHosts || DEFAULT_TRUSTED_HOSTS).findIndex((trustedHost) => trustedHost.startsWith("*.") ? hostname.endsWith(trustedHost.slice(1)) : trustedHost === hostname) > -1;
7593
7627
  }
7594
- const SDK_VERSION = "0.14.5";
7628
+ const SDK_VERSION = "0.14.7";
7595
7629
  const registry = {};
7596
7630
  function register(type, info) {
7597
7631
  let typeList = registry[type];
@@ -7840,7 +7874,11 @@ const evaluateJsCode = function evaluateJsCode2(props, state, elementRef) {
7840
7874
  context: props.context || {},
7841
7875
  localState: void 0,
7842
7876
  rootState: props.builderContextSignal.rootState,
7843
- rootSetState: props.builderContextSignal.rootSetState
7877
+ rootSetState: props.builderContextSignal.rootSetState,
7878
+ /**
7879
+ * We don't want to cache the result of the JS code, since it's arbitrary side effect code.
7880
+ */
7881
+ enableCache: false
7844
7882
  });
7845
7883
  };
7846
7884
  const onClick = function onClick22(props, state, elementRef, event) {
@@ -7862,13 +7900,14 @@ const onClick = function onClick22(props, state, elementRef, event) {
7862
7900
  state.clicked = true;
7863
7901
  };
7864
7902
  const evalExpression = function evalExpression2(props, state, elementRef, expression) {
7865
- return expression.replace(/{{([^}]+)}}/g, (_match, group) => evaluate({
7903
+ return expression.replace(/{{([^}]+)}}/g, (_match, group) => String(evaluate({
7866
7904
  code: group,
7867
7905
  context: props.context || {},
7868
7906
  localState: void 0,
7869
7907
  rootState: props.builderContextSignal.rootState,
7870
- rootSetState: props.builderContextSignal.rootSetState
7871
- }));
7908
+ rootSetState: props.builderContextSignal.rootSetState,
7909
+ enableCache: true
7910
+ })));
7872
7911
  };
7873
7912
  const handleRequest = function handleRequest2(props, state, elementRef, { url, key }) {
7874
7913
  fetch$1(url).then((response) => response.json()).then((json) => {
@@ -209,7 +209,7 @@ function flattenState({ rootState, localState, rootSetState }) {
209
209
  if (localState && prop in localState)
210
210
  return localState[prop];
211
211
  const val = target[prop];
212
- if (typeof val === "object")
212
+ if (typeof val === "object" && val !== null)
213
213
  return flattenState({
214
214
  rootState: val,
215
215
  localState: void 0,
@@ -3489,10 +3489,34 @@ const shouldForceBrowserRuntimeInNode = () => {
3489
3489
  return false;
3490
3490
  };
3491
3491
  const chooseBrowserOrServerEval = (args) => isBrowser$1 || shouldForceBrowserRuntimeInNode() ? runInBrowser(args) : runInEdge(args);
3492
- function evaluate({ code, context, localState, rootState, rootSetState, event, isExpression = true }) {
3492
+ const _EvalCache = class _EvalCache2 {
3493
+ static getCacheKey(args) {
3494
+ return JSON.stringify({
3495
+ ...args,
3496
+ // replace the event with a random number to break cache
3497
+ // thats because we can't serialize the event object due to circular refs in DOM node refs.
3498
+ event: args.event ? Math.random() : void 0
3499
+ });
3500
+ }
3501
+ static getCachedValue(key) {
3502
+ const cachedVal = _EvalCache2.cache.get(key);
3503
+ return cachedVal;
3504
+ }
3505
+ static setCachedValue(key, value) {
3506
+ if (_EvalCache2.cache.size > 20)
3507
+ _EvalCache2.cache.delete(_EvalCache2.cache.keys().next().value);
3508
+ _EvalCache2.cache.set(key, {
3509
+ value
3510
+ });
3511
+ }
3512
+ };
3513
+ _EvalCache.cacheLimit = 20;
3514
+ _EvalCache.cache = /* @__PURE__ */ new Map();
3515
+ let EvalCache = _EvalCache;
3516
+ function evaluate({ code, context, localState, rootState, rootSetState, event, isExpression = true, enableCache }) {
3493
3517
  if (code === "") {
3494
3518
  logger.warn("Skipping evaluation of empty code block.");
3495
- return;
3519
+ return void 0;
3496
3520
  }
3497
3521
  const args = {
3498
3522
  code: parseCode(code, {
@@ -3505,8 +3529,19 @@ function evaluate({ code, context, localState, rootState, rootSetState, event, i
3505
3529
  rootState,
3506
3530
  localState
3507
3531
  };
3532
+ if (enableCache) {
3533
+ const cacheKey = EvalCache.getCacheKey(args);
3534
+ const cachedValue = EvalCache.getCachedValue(cacheKey);
3535
+ if (cachedValue)
3536
+ return cachedValue.value;
3537
+ }
3508
3538
  try {
3509
- return chooseBrowserOrServerEval(args);
3539
+ const newEval = chooseBrowserOrServerEval(args);
3540
+ if (enableCache) {
3541
+ const cacheKey = EvalCache.getCacheKey(args);
3542
+ EvalCache.setCachedValue(cacheKey, newEval);
3543
+ }
3544
+ return newEval;
3510
3545
  } catch (e) {
3511
3546
  logger.error("Failed code evaluation: " + e.message, {
3512
3547
  code
@@ -3538,7 +3573,8 @@ const evaluateBindings = ({ block, context, localState, rootState, rootSetState
3538
3573
  localState,
3539
3574
  rootState,
3540
3575
  rootSetState,
3541
- context
3576
+ context,
3577
+ enableCache: true
3542
3578
  });
3543
3579
  set(copied, binding, value);
3544
3580
  }
@@ -3752,6 +3788,51 @@ function bindScrollInViewAnimation(animation) {
3752
3788
  immediateOnScroll();
3753
3789
  });
3754
3790
  }
3791
+ const camelToKebabCase = (string) => string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
3792
+ const convertStyleMapToCSSArray = (style) => {
3793
+ const cssProps = Object.entries(style).map(([key, value]) => {
3794
+ if (typeof value === "string")
3795
+ return `${camelToKebabCase(key)}: ${value};`;
3796
+ else
3797
+ return void 0;
3798
+ });
3799
+ return cssProps.filter(checkIsDefined);
3800
+ };
3801
+ const convertStyleMapToCSS = (style) => convertStyleMapToCSSArray(style).join("\n");
3802
+ const createCssClass = ({ mediaQuery, className, styles }) => {
3803
+ const cssClass = `.${className} {
3804
+ ${convertStyleMapToCSS(styles)}
3805
+ }`;
3806
+ if (mediaQuery)
3807
+ return `${mediaQuery} {
3808
+ ${cssClass}
3809
+ }`;
3810
+ else
3811
+ return cssClass;
3812
+ };
3813
+ function transformStyleProperty({ style }) {
3814
+ return style;
3815
+ }
3816
+ const getStyle = ({ block, context }) => {
3817
+ return mapStyleObjToStrIfNeeded(transformStyleProperty({
3818
+ style: block.style || {},
3819
+ context,
3820
+ block
3821
+ }));
3822
+ };
3823
+ function mapStyleObjToStrIfNeeded(style) {
3824
+ switch (TARGET) {
3825
+ case "svelte":
3826
+ case "vue":
3827
+ case "solid":
3828
+ return convertStyleMapToCSSArray(style).join(" ");
3829
+ case "qwik":
3830
+ case "reactNative":
3831
+ case "react":
3832
+ case "rsc":
3833
+ return style;
3834
+ }
3835
+ }
3755
3836
  const getComponent = ({ block, context, registeredComponents }) => {
3756
3837
  var _a;
3757
3838
  const componentName = (_a = getProcessedBlock({
@@ -3782,7 +3863,8 @@ const getRepeatItemData = ({ block, context }) => {
3782
3863
  localState: context.localState,
3783
3864
  rootState: context.rootState,
3784
3865
  rootSetState: context.rootSetState,
3785
- context: context.context
3866
+ context: context.context,
3867
+ enableCache: true
3786
3868
  });
3787
3869
  if (!Array.isArray(itemsArray))
3788
3870
  return void 0;
@@ -3846,28 +3928,6 @@ const getSizesForBreakpoints = ({ small, medium }) => {
3846
3928
  };
3847
3929
  return newSizes;
3848
3930
  };
3849
- const camelToKebabCase = (string) => string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
3850
- const convertStyleMapToCSSArray = (style) => {
3851
- const cssProps = Object.entries(style).map(([key, value]) => {
3852
- if (typeof value === "string")
3853
- return `${camelToKebabCase(key)}: ${value};`;
3854
- else
3855
- return void 0;
3856
- });
3857
- return cssProps.filter(checkIsDefined);
3858
- };
3859
- const convertStyleMapToCSS = (style) => convertStyleMapToCSSArray(style).join("\n");
3860
- const createCssClass = ({ mediaQuery, className, styles }) => {
3861
- const cssClass = `.${className} {
3862
- ${convertStyleMapToCSS(styles)}
3863
- }`;
3864
- if (mediaQuery)
3865
- return `${mediaQuery} {
3866
- ${cssClass}
3867
- }`;
3868
- else
3869
- return cssClass;
3870
- };
3871
3931
  const InlinedStyles = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
3872
3932
  return /* @__PURE__ */ _jsxQ("style", null, {
3873
3933
  dangerouslySetInnerHTML: _fnSignal((p0) => p0.styles, [
@@ -3966,7 +4026,8 @@ function createEventHandler(value, options) {
3966
4026
  localState: options2.localState,
3967
4027
  rootState: options2.rootState,
3968
4028
  rootSetState: options2.rootSetState,
3969
- event
4029
+ event,
4030
+ enableCache: true
3970
4031
  });
3971
4032
  }, "createEventHandler_7wCAiJVliNE", [
3972
4033
  options,
@@ -3994,29 +4055,6 @@ function getBlockActions(options) {
3994
4055
  }
3995
4056
  return obj;
3996
4057
  }
3997
- function transformStyleProperty({ style }) {
3998
- return style;
3999
- }
4000
- const getStyle = ({ block, context }) => {
4001
- return mapStyleObjToStrIfNeeded(transformStyleProperty({
4002
- style: block.style || {},
4003
- context,
4004
- block
4005
- }));
4006
- };
4007
- function mapStyleObjToStrIfNeeded(style) {
4008
- switch (TARGET) {
4009
- case "svelte":
4010
- case "vue":
4011
- case "solid":
4012
- return convertStyleMapToCSSArray(style).join(" ");
4013
- case "qwik":
4014
- case "reactNative":
4015
- case "react":
4016
- case "rsc":
4017
- return style;
4018
- }
4019
- }
4020
4058
  function transformBlockProperties({ properties }) {
4021
4059
  return properties;
4022
4060
  }
@@ -4196,9 +4234,6 @@ const RepeatedBlock = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((p
4196
4234
  const Block = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
4197
4235
  var _a;
4198
4236
  _jsxBranch();
4199
- const state = useStore({
4200
- childrenContext: props.context
4201
- });
4202
4237
  const blockComponent = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
4203
4238
  const [props2] = useLexicalScope();
4204
4239
  return getComponent({
@@ -4271,7 +4306,7 @@ const Block = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
4271
4306
  ]));
4272
4307
  const componentRefProps = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
4273
4308
  var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
4274
- const [blockComponent2, processedBlock2, props2, state2] = useLexicalScope();
4309
+ const [blockComponent2, processedBlock2, props2] = useLexicalScope();
4275
4310
  return {
4276
4311
  blockChildren: processedBlock2.value.children ?? [],
4277
4312
  componentRef: (_a2 = blockComponent2.value) == null ? void 0 : _a2.component,
@@ -4285,7 +4320,7 @@ const Block = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
4285
4320
  builderComponents: props2.registeredComponents
4286
4321
  } : {}
4287
4322
  },
4288
- context: state2.childrenContext,
4323
+ context: props2.context,
4289
4324
  linkComponent: props2.linkComponent,
4290
4325
  registeredComponents: props2.registeredComponents,
4291
4326
  builderBlock: processedBlock2.value,
@@ -4295,8 +4330,7 @@ const Block = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
4295
4330
  }, "Block_component_componentRefProps_useComputed_Ikbl8VO04ho", [
4296
4331
  blockComponent,
4297
4332
  processedBlock,
4298
- props,
4299
- state
4333
+ props
4300
4334
  ]));
4301
4335
  useVisibleTaskQrl(/* @__PURE__ */ inlinedQrl(() => {
4302
4336
  const [processedBlock2] = useLexicalScope();
@@ -4404,19 +4438,19 @@ const Block = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
4404
4438
  (childrenWithoutParentComponent.value || []).map((child) => {
4405
4439
  return /* @__PURE__ */ _jsxC(Block, {
4406
4440
  block: child,
4407
- get context() {
4408
- return state.childrenContext;
4409
- },
4410
4441
  get registeredComponents() {
4411
4442
  return props.registeredComponents;
4412
4443
  },
4413
4444
  get linkComponent() {
4414
4445
  return props.linkComponent;
4415
4446
  },
4447
+ get context() {
4448
+ return props.context;
4449
+ },
4416
4450
  [_IMMUTABLE]: {
4417
- context: _fnSignal((p0) => p0.childrenContext, [
4418
- state
4419
- ], "p0.childrenContext"),
4451
+ context: _fnSignal((p0) => p0.context, [
4452
+ props
4453
+ ], "p0.context"),
4420
4454
  linkComponent: _fnSignal((p0) => p0.linkComponent, [
4421
4455
  props
4422
4456
  ], "p0.linkComponent"),
@@ -5010,9 +5044,9 @@ const Image = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
5010
5044
  props
5011
5045
  ], '"builder-image"+(p0.className?" "+p0.className:"")+" img-Image"'),
5012
5046
  loading: "lazy",
5013
- role: _fnSignal((p0) => p0.altText ? "presentation" : void 0, [
5047
+ role: _fnSignal((p0) => p0.altText ? void 0 : "presentation", [
5014
5048
  props
5015
- ], 'p0.altText?"presentation":undefined'),
5049
+ ], 'p0.altText?undefined:"presentation"'),
5016
5050
  sizes: _fnSignal((p0) => p0.sizes, [
5017
5051
  props
5018
5052
  ], "p0.sizes"),
@@ -7589,7 +7623,7 @@ function isFromTrustedHost(trustedHosts, e) {
7589
7623
  const url = new URL(e.origin), hostname = url.hostname;
7590
7624
  return (trustedHosts || DEFAULT_TRUSTED_HOSTS).findIndex((trustedHost) => trustedHost.startsWith("*.") ? hostname.endsWith(trustedHost.slice(1)) : trustedHost === hostname) > -1;
7591
7625
  }
7592
- const SDK_VERSION = "0.14.5";
7626
+ const SDK_VERSION = "0.14.7";
7593
7627
  const registry = {};
7594
7628
  function register(type, info) {
7595
7629
  let typeList = registry[type];
@@ -7838,7 +7872,11 @@ const evaluateJsCode = function evaluateJsCode2(props, state, elementRef) {
7838
7872
  context: props.context || {},
7839
7873
  localState: void 0,
7840
7874
  rootState: props.builderContextSignal.rootState,
7841
- rootSetState: props.builderContextSignal.rootSetState
7875
+ rootSetState: props.builderContextSignal.rootSetState,
7876
+ /**
7877
+ * We don't want to cache the result of the JS code, since it's arbitrary side effect code.
7878
+ */
7879
+ enableCache: false
7842
7880
  });
7843
7881
  };
7844
7882
  const onClick = function onClick22(props, state, elementRef, event) {
@@ -7860,13 +7898,14 @@ const onClick = function onClick22(props, state, elementRef, event) {
7860
7898
  state.clicked = true;
7861
7899
  };
7862
7900
  const evalExpression = function evalExpression2(props, state, elementRef, expression) {
7863
- return expression.replace(/{{([^}]+)}}/g, (_match, group) => evaluate({
7901
+ return expression.replace(/{{([^}]+)}}/g, (_match, group) => String(evaluate({
7864
7902
  code: group,
7865
7903
  context: props.context || {},
7866
7904
  localState: void 0,
7867
7905
  rootState: props.builderContextSignal.rootState,
7868
- rootSetState: props.builderContextSignal.rootSetState
7869
- }));
7906
+ rootSetState: props.builderContextSignal.rootSetState,
7907
+ enableCache: true
7908
+ })));
7870
7909
  };
7871
7910
  const handleRequest = function handleRequest2(props, state, elementRef, { url, key }) {
7872
7911
  fetch$1(url).then((response) => response.json()).then((json) => {