@builder.io/sdk-solid 2.0.16 → 2.0.21

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/edge/dev.jsx CHANGED
@@ -83,10 +83,10 @@ function Button(props) {
83
83
  var button_default = Button;
84
84
 
85
85
  // src/blocks/columns/columns.tsx
86
- import { Show as Show6, For as For4, createSignal as createSignal7 } from "solid-js";
86
+ import { Show as Show7, For as For4, createSignal as createSignal7 } from "solid-js";
87
87
 
88
88
  // src/components/blocks/blocks.tsx
89
- import { useContext, Show as Show5, For as For3 } from "solid-js";
89
+ import { useContext, Show as Show6, For as For3 } from "solid-js";
90
90
 
91
91
  // src/context/builder.context.ts
92
92
  import { createContext } from "solid-js";
@@ -112,9 +112,9 @@ var components_context_default = createContext2({ registeredComponents: {} });
112
112
 
113
113
  // src/components/block/block.tsx
114
114
  import {
115
- Show as Show4,
115
+ Show as Show5,
116
116
  For as For2,
117
- onMount,
117
+ onMount as onMount2,
118
118
  createMemo as createMemo5,
119
119
  createSignal as createSignal5
120
120
  } from "solid-js";
@@ -258,29 +258,6 @@ var parseCode = (code, {
258
258
  const useCode = useReturn ? `return (${code});` : code;
259
259
  return useCode;
260
260
  };
261
-
262
- // src/functions/evaluate/browser-runtime/browser.ts
263
- var runInBrowser = ({
264
- code,
265
- builder,
266
- context,
267
- event,
268
- localState,
269
- rootSetState,
270
- rootState
271
- }) => {
272
- const functionArgs = getFunctionArguments({
273
- builder,
274
- context,
275
- event,
276
- state: flattenState({
277
- rootState,
278
- localState,
279
- rootSetState
280
- })
281
- });
282
- return new Function(...functionArgs.map(([name]) => name), code)(...functionArgs.map(([, value]) => value));
283
- };
284
261
  function flattenState({
285
262
  rootState,
286
263
  localState,
@@ -315,14 +292,27 @@ function flattenState({
315
292
  });
316
293
  }
317
294
 
318
- // src/functions/set.ts
319
- var set = (obj, _path, value) => {
320
- if (Object(obj) !== obj) {
321
- return obj;
322
- }
323
- const path = Array.isArray(_path) ? _path : _path.toString().match(/[^.[\]]+/g);
324
- path.slice(0, -1).reduce((a, c, i) => Object(a[c]) === a[c] ? a[c] : a[c] = Math.abs(Number(path[i + 1])) >> 0 === +path[i + 1] ? [] : {}, obj)[path[path.length - 1]] = value;
325
- return obj;
295
+ // src/functions/evaluate/browser-runtime/browser.ts
296
+ var runInBrowser = ({
297
+ code,
298
+ builder,
299
+ context,
300
+ event,
301
+ localState,
302
+ rootSetState,
303
+ rootState
304
+ }) => {
305
+ const functionArgs = getFunctionArguments({
306
+ builder,
307
+ context,
308
+ event,
309
+ state: flattenState({
310
+ rootState,
311
+ localState,
312
+ rootSetState
313
+ })
314
+ });
315
+ return new Function(...functionArgs.map(([name]) => name), code)(...functionArgs.map(([, value]) => value));
326
316
  };
327
317
 
328
318
  // src/functions/evaluate/edge-runtime/acorn-interpreter.ts
@@ -3394,22 +3384,56 @@ t.VALUE_IN_DESCRIPTOR = Ia;
3394
3384
  var acorn_interpreter_default = t;
3395
3385
 
3396
3386
  // src/functions/evaluate/edge-runtime/edge-runtime.ts
3387
+ function patchInterpreter() {
3388
+ const originalGetProperty = acorn_interpreter_default.prototype.getProperty;
3389
+ const originalSetProperty = acorn_interpreter_default.prototype.setProperty;
3390
+ function newGetProperty(obj, name) {
3391
+ if (obj == null || !obj._connected) {
3392
+ return originalGetProperty.call(this, obj, name);
3393
+ }
3394
+ const value = obj._connected[name];
3395
+ if (Array.isArray(value)) {
3396
+ return this.nativeToPseudo(value);
3397
+ }
3398
+ if (typeof value === "object") {
3399
+ return this.createConnectedObject(value);
3400
+ }
3401
+ return value;
3402
+ }
3403
+ function newSetProperty(obj, name, value, opt_descriptor) {
3404
+ if (obj == null || !obj._connected) {
3405
+ return originalSetProperty.call(this, obj, name, value, opt_descriptor);
3406
+ }
3407
+ obj._connected[name] = this.pseudoToNative(value);
3408
+ }
3409
+ const getKeys = [];
3410
+ const setKeys = [];
3411
+ for (const key of Object.keys(acorn_interpreter_default.prototype)) {
3412
+ if (acorn_interpreter_default.prototype[key] === originalGetProperty) {
3413
+ getKeys.push(key);
3414
+ }
3415
+ if (acorn_interpreter_default.prototype[key] === originalSetProperty) {
3416
+ setKeys.push(key);
3417
+ }
3418
+ }
3419
+ for (const key of getKeys) {
3420
+ acorn_interpreter_default.prototype[key] = newGetProperty;
3421
+ }
3422
+ for (const key of setKeys) {
3423
+ acorn_interpreter_default.prototype[key] = newSetProperty;
3424
+ }
3425
+ acorn_interpreter_default.prototype.createConnectedObject = function(obj) {
3426
+ const connectedObject = this.createObject(this.OBJECT);
3427
+ connectedObject._connected = obj;
3428
+ return connectedObject;
3429
+ };
3430
+ }
3431
+ patchInterpreter();
3397
3432
  var processCode = (code) => {
3398
- return code.split("\n").map((line) => {
3399
- const trimmed = line.trim();
3400
- if (line.includes("__awaiter"))
3401
- return void 0;
3402
- const isStateSetter = trimmed.startsWith("state.");
3403
- if (!isStateSetter)
3404
- return line;
3405
- const [lhs, rhs] = trimmed.split("=");
3406
- const setStr = lhs.replace("state.", "").trim();
3407
- const setExpr = `setRootState('${setStr}', ${rhs.trim()})`;
3408
- return `
3409
- ${line}
3410
- ${setExpr}
3411
- `;
3412
- }).filter(Boolean).join("\n");
3433
+ return code.replace(/^.*?function main\(\)/, `
3434
+ var __awaiter = function (e, t, n, r) {return r()},
3435
+ __generator = function (e, t) { return t() };
3436
+ function main()`).replace(/\?\./g, ".");
3413
3437
  };
3414
3438
  var getJSONValName = (val) => val + "JSON";
3415
3439
  var runInEdge = ({
@@ -3421,10 +3445,11 @@ var runInEdge = ({
3421
3445
  rootSetState,
3422
3446
  code
3423
3447
  }) => {
3424
- const state = {
3425
- ...rootState,
3426
- ...localState
3427
- };
3448
+ const state = flattenState({
3449
+ rootState,
3450
+ localState,
3451
+ rootSetState
3452
+ });
3428
3453
  const properties = getFunctionArguments({
3429
3454
  builder,
3430
3455
  context,
@@ -3433,6 +3458,9 @@ var runInEdge = ({
3433
3458
  });
3434
3459
  const prependedCode = properties.map(([key]) => {
3435
3460
  const jsonValName = getJSONValName(key);
3461
+ if (key === "state") {
3462
+ return ``;
3463
+ }
3436
3464
  return `var ${key} = ${jsonValName} === undefined ? undefined : JSON.parse(${jsonValName});`;
3437
3465
  }).join("\n");
3438
3466
  const cleanedCode = processCode(code);
@@ -3448,16 +3476,15 @@ function theFunction() {
3448
3476
  }
3449
3477
  theFunction();
3450
3478
  `;
3451
- const setRootState = (prop, value) => {
3452
- const newState = set(state, prop, value);
3453
- rootSetState?.(newState);
3454
- };
3455
3479
  const initFunc = function(interpreter, globalObject) {
3456
3480
  properties.forEach(([key, val]) => {
3457
- const jsonVal = JSON.stringify(val);
3458
- interpreter.setProperty(globalObject, getJSONValName(key), jsonVal);
3481
+ if (key === "state") {
3482
+ interpreter.setProperty(globalObject, key, interpreter.createConnectedObject(val), interpreter.READONLY_DESCRIPTOR);
3483
+ } else {
3484
+ const jsonVal = JSON.stringify(val);
3485
+ interpreter.setProperty(globalObject, getJSONValName(key), jsonVal);
3486
+ }
3459
3487
  });
3460
- interpreter.setProperty(globalObject, "setRootState", interpreter.createNativeFunction(setRootState));
3461
3488
  };
3462
3489
  const myInterpreter = new acorn_interpreter_default(transformed, initFunc);
3463
3490
  myInterpreter.run();
@@ -3574,6 +3601,16 @@ function evaluate({
3574
3601
  // src/functions/fast-clone.ts
3575
3602
  var fastClone = (obj) => JSON.parse(JSON.stringify(obj));
3576
3603
 
3604
+ // src/functions/set.ts
3605
+ var set = (obj, _path, value) => {
3606
+ if (Object(obj) !== obj) {
3607
+ return obj;
3608
+ }
3609
+ const path = Array.isArray(_path) ? _path : _path.toString().match(/[^.[\]]+/g);
3610
+ path.slice(0, -1).reduce((a, c, i) => Object(a[c]) === a[c] ? a[c] : a[c] = Math.abs(Number(path[i + 1])) >> 0 === +path[i + 1] ? [] : {}, obj)[path[path.length - 1]] = value;
3611
+ return obj;
3612
+ };
3613
+
3577
3614
  // src/functions/transform-block.ts
3578
3615
  function transformBlock(block) {
3579
3616
  return block;
@@ -4240,12 +4277,23 @@ function BlockWrapper(props) {
4240
4277
  var Block_wrapper_default = BlockWrapper;
4241
4278
 
4242
4279
  // src/components/block/components/component-ref/component-ref.tsx
4243
- import { Show as Show3, For, createSignal as createSignal3 } from "solid-js";
4280
+ import { Show as Show4, For, createSignal as createSignal3 } from "solid-js";
4244
4281
  import { Dynamic as Dynamic3 } from "solid-js/web";
4245
4282
 
4246
4283
  // src/components/block/components/interactive-element.tsx
4247
- import { createMemo as createMemo2 } from "solid-js";
4284
+ import { Show as Show3, createMemo as createMemo2 } from "solid-js";
4248
4285
  import { Dynamic as Dynamic2 } from "solid-js/web";
4286
+
4287
+ // src/components/awaiter.tsx
4288
+ import { onMount } from "solid-js";
4289
+ function Awaiter(props) {
4290
+ onMount(() => {
4291
+ });
4292
+ return <><>{props.children}</></>;
4293
+ }
4294
+ var Awaiter_default = Awaiter;
4295
+
4296
+ // src/components/block/components/interactive-element.tsx
4249
4297
  function InteractiveElement(props) {
4250
4298
  const attributes = createMemo2(() => {
4251
4299
  return props.includeBlockProps ? {
@@ -4262,11 +4310,19 @@ function InteractiveElement(props) {
4262
4310
  })
4263
4311
  } : {};
4264
4312
  });
4265
- return <><Dynamic2
4266
- {...props.wrapperProps}
4313
+ return <><Show3
4314
+ fallback={<Dynamic2
4315
+ {...props.wrapperProps}
4316
+ attributes={attributes()}
4317
+ component={props.Wrapper}
4318
+ >{props.children}</Dynamic2>}
4319
+ when={props.Wrapper.load}
4320
+ ><Awaiter_default
4321
+ load={props.Wrapper.load}
4322
+ fallback={props.Wrapper.fallback}
4323
+ props={props.wrapperProps}
4267
4324
  attributes={attributes()}
4268
- component={props.Wrapper}
4269
- >{props.children}</Dynamic2></>;
4325
+ >{props.children}</Awaiter_default></Show3></>;
4270
4326
  }
4271
4327
  var interactive_element_default = InteractiveElement;
4272
4328
 
@@ -4308,7 +4364,7 @@ function ComponentRef(props) {
4308
4364
  const [Wrapper, setWrapper] = createSignal3(
4309
4365
  props.isInteractive ? interactive_element_default : props.componentRef
4310
4366
  );
4311
- return <><Show3 when={props.componentRef}><Dynamic3
4367
+ return <><Show4 when={props.componentRef}><Dynamic3
4312
4368
  {...getWrapperProps({
4313
4369
  componentOptions: props.componentOptions,
4314
4370
  builderBlock: props.builderBlock,
@@ -4329,7 +4385,7 @@ function ComponentRef(props) {
4329
4385
  registeredComponents={props.registeredComponents}
4330
4386
  linkComponent={props.linkComponent}
4331
4387
  />;
4332
- }}</For></Dynamic3></Show3></>;
4388
+ }}</For></Dynamic3></Show4></>;
4333
4389
  }
4334
4390
  var Component_ref_default = ComponentRef;
4335
4391
 
@@ -4418,7 +4474,7 @@ function Block(props) {
4418
4474
  isInteractive: !(blockComponent()?.isRSC && TARGET === "rsc")
4419
4475
  };
4420
4476
  });
4421
- onMount(() => {
4477
+ onMount2(() => {
4422
4478
  const blockId = processedBlock().id;
4423
4479
  const animations = processedBlock().animations;
4424
4480
  if (animations && blockId) {
@@ -4430,13 +4486,13 @@ function Block(props) {
4430
4486
  );
4431
4487
  }
4432
4488
  });
4433
- return <><Show4 when={canShowBlock()}>
4489
+ return <><Show5 when={canShowBlock()}>
4434
4490
  <Block_styles_default
4435
4491
  block={processedBlock()}
4436
4492
  context={props.context}
4437
4493
  />
4438
- <Show4
4439
- fallback={<Show4
4494
+ <Show5
4495
+ fallback={<Show5
4440
4496
  fallback={<For2 each={repeatItem()}>{(data, _index) => {
4441
4497
  const index = _index();
4442
4498
  return <Repeated_block_default
@@ -4458,9 +4514,9 @@ function Block(props) {
4458
4514
  builderBlock={componentRefProps().builderBlock}
4459
4515
  includeBlockProps={componentRefProps().includeBlockProps}
4460
4516
  isInteractive={componentRefProps().isInteractive}
4461
- /></Show4>}
4517
+ /></Show5>}
4462
4518
  when={!blockComponent()?.noWrap}
4463
- ><Show4
4519
+ ><Show5
4464
4520
  fallback={<For2 each={repeatItem()}>{(data, _index) => {
4465
4521
  const index = _index();
4466
4522
  return <Repeated_block_default
@@ -4498,13 +4554,13 @@ function Block(props) {
4498
4554
  context={props.context}
4499
4555
  />;
4500
4556
  }}</For2>
4501
- </Block_wrapper_default></Show4></Show4>
4502
- </Show4></>;
4557
+ </Block_wrapper_default></Show5></Show5>
4558
+ </Show5></>;
4503
4559
  }
4504
4560
  var Block_default = Block;
4505
4561
 
4506
4562
  // src/components/blocks/blocks-wrapper.tsx
4507
- import { onMount as onMount2, createMemo as createMemo6 } from "solid-js";
4563
+ import { onMount as onMount3, createMemo as createMemo6 } from "solid-js";
4508
4564
  import { Dynamic as Dynamic4 } from "solid-js/web";
4509
4565
  function BlocksWrapper(props) {
4510
4566
  const className = createMemo6(() => {
@@ -4539,11 +4595,11 @@ function BlocksWrapper(props) {
4539
4595
  }
4540
4596
  }
4541
4597
  let blocksWrapperRef;
4542
- onMount2(() => {
4598
+ onMount3(() => {
4543
4599
  });
4544
4600
  return <>
4545
4601
  <Dynamic4
4546
- class={className() + " dynamic-4da8c6f4"}
4602
+ class={className() + " dynamic-68b2d7fe"}
4547
4603
  ref={blocksWrapperRef}
4548
4604
  builder-path={props.path}
4549
4605
  builder-parent-id={props.parent}
@@ -4555,7 +4611,7 @@ function BlocksWrapper(props) {
4555
4611
  {...props.BlocksWrapperProps}
4556
4612
  component={props.BlocksWrapper}
4557
4613
  >{props.children}</Dynamic4>
4558
- <style>{`.dynamic-4da8c6f4 {
4614
+ <style>{`.dynamic-68b2d7fe {
4559
4615
  display: flex;
4560
4616
  flex-direction: column;
4561
4617
  align-items: stretch;
@@ -4575,7 +4631,7 @@ function Blocks(props) {
4575
4631
  styleProp={props.styleProp}
4576
4632
  BlocksWrapper={props.context?.BlocksWrapper || builderContext.BlocksWrapper}
4577
4633
  BlocksWrapperProps={props.context?.BlocksWrapperProps || builderContext.BlocksWrapperProps}
4578
- ><Show5 when={props.blocks}><For3 each={props.blocks}>{(block, _index) => {
4634
+ ><Show6 when={props.blocks}><For3 each={props.blocks}>{(block, _index) => {
4579
4635
  const index = _index();
4580
4636
  return <Block_default
4581
4637
  key={block.id}
@@ -4584,7 +4640,7 @@ function Blocks(props) {
4584
4640
  context={props.context || builderContext}
4585
4641
  registeredComponents={props.registeredComponents || componentsContext.registeredComponents}
4586
4642
  />;
4587
- }}</For3></Show5></Blocks_wrapper_default></>;
4643
+ }}</For3></Show6></Blocks_wrapper_default></>;
4588
4644
  }
4589
4645
  var Blocks_default = Blocks;
4590
4646
 
@@ -4715,15 +4771,15 @@ function Columns(props) {
4715
4771
  }
4716
4772
  return <>
4717
4773
  <div
4718
- class={getColumnsClass(props.builderBlock?.id) + " div-3ff242de"}
4774
+ class={getColumnsClass(props.builderBlock?.id) + " div-46766f1c"}
4719
4775
  style={columnsCssVars()}
4720
4776
  {...{}}
4721
4777
  >
4722
- <Show6 when={TARGET !== "reactNative"}><Inlined_styles_default
4778
+ <Show7 when={TARGET !== "reactNative"}><Inlined_styles_default
4723
4779
  id="builderio-columns"
4724
4780
  styles={columnsStyles()}
4725
4781
  nonce={props.builderContext.nonce}
4726
- /></Show6>
4782
+ /></Show7>
4727
4783
  <For4 each={props.columns}>{(column, _index) => {
4728
4784
  const index = _index();
4729
4785
  return <Dynamic_renderer_default
@@ -4744,7 +4800,7 @@ function Columns(props) {
4744
4800
  /></Dynamic_renderer_default>;
4745
4801
  }}</For4>
4746
4802
  </div>
4747
- <style>{`.div-3ff242de {
4803
+ <style>{`.div-46766f1c {
4748
4804
  display: flex;
4749
4805
  line-height: normal;
4750
4806
  }`}</style>
@@ -4759,7 +4815,7 @@ function FragmentComponent(props) {
4759
4815
  var fragment_default = FragmentComponent;
4760
4816
 
4761
4817
  // src/blocks/image/image.tsx
4762
- import { Show as Show7, onMount as onMount3, createMemo as createMemo8 } from "solid-js";
4818
+ import { Show as Show8, onMount as onMount4, createMemo as createMemo8 } from "solid-js";
4763
4819
 
4764
4820
  // src/blocks/image/image.helpers.ts
4765
4821
  function removeProtocol(path) {
@@ -4849,14 +4905,14 @@ function Image(props) {
4849
4905
  const out = props.aspectRatio ? aspectRatioStyles : void 0;
4850
4906
  return out;
4851
4907
  });
4852
- onMount3(() => {
4908
+ onMount4(() => {
4853
4909
  });
4854
4910
  return <>
4855
4911
  <>
4856
4912
  <picture>
4857
- <Show7 when={webpSrcSet()}><source type="image/webp" srcset={webpSrcSet()} /></Show7>
4913
+ <Show8 when={webpSrcSet()}><source type="image/webp" srcset={webpSrcSet()} /></Show8>
4858
4914
  <img
4859
- class={"builder-image" + (props.className ? " " + props.className : "") + " img-4512e110"}
4915
+ class={"builder-image" + (props.className ? " " + props.className : "") + " img-7e6ffddc"}
4860
4916
  loading={props.highPriority ? "eager" : "lazy"}
4861
4917
  fetchpriority={props.highPriority ? "high" : "auto"}
4862
4918
  alt={props.altText}
@@ -4871,25 +4927,25 @@ function Image(props) {
4871
4927
  sizes={props.sizes}
4872
4928
  />
4873
4929
  </picture>
4874
- <Show7
4930
+ <Show8
4875
4931
  when={props.aspectRatio && !(props.builderBlock?.children?.length && props.fitContent)}
4876
4932
  ><div
4877
- class="builder-image-sizer div-4512e110"
4933
+ class="builder-image-sizer div-7e6ffddc"
4878
4934
  style={{
4879
4935
  "padding-top": props.aspectRatio * 100 + "%"
4880
4936
  }}
4881
- /></Show7>
4882
- <Show7 when={props.builderBlock?.children?.length && props.fitContent}>{props.children}</Show7>
4883
- <Show7 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-4512e110-2">{props.children}</div></Show7>
4937
+ /></Show8>
4938
+ <Show8 when={props.builderBlock?.children?.length && props.fitContent}>{props.children}</Show8>
4939
+ <Show8 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-7e6ffddc-2">{props.children}</div></Show8>
4884
4940
  </>
4885
- <style>{`.img-4512e110 {
4941
+ <style>{`.img-7e6ffddc {
4886
4942
  opacity: 1;
4887
4943
  transition: opacity 0.2s ease-in-out;
4888
- }.div-4512e110 {
4944
+ }.div-7e6ffddc {
4889
4945
  width: 100%;
4890
4946
  pointer-events: none;
4891
4947
  font-size: 0;
4892
- }.div-4512e110-2 {
4948
+ }.div-7e6ffddc-2 {
4893
4949
  display: flex;
4894
4950
  flex-direction: column;
4895
4951
  align-items: stretch;
@@ -4925,10 +4981,10 @@ function SectionComponent(props) {
4925
4981
  var section_default = SectionComponent;
4926
4982
 
4927
4983
  // src/blocks/symbol/symbol.tsx
4928
- import { onMount as onMount7, on as on4, createEffect as createEffect4, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
4984
+ import { onMount as onMount8, on as on4, createEffect as createEffect4, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
4929
4985
 
4930
4986
  // src/components/content-variants/content-variants.tsx
4931
- import { Show as Show14, For as For9, onMount as onMount6, createSignal as createSignal19, createMemo as createMemo19 } from "solid-js";
4987
+ import { Show as Show15, For as For9, onMount as onMount7, createSignal as createSignal19, createMemo as createMemo19 } from "solid-js";
4932
4988
 
4933
4989
  // src/helpers/url.ts
4934
4990
  var getTopLevelDomain = (host) => {
@@ -5122,7 +5178,7 @@ var handleABTesting = async ({
5122
5178
  var getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : true;
5123
5179
 
5124
5180
  // src/components/content/content.tsx
5125
- import { Show as Show13, createSignal as createSignal18 } from "solid-js";
5181
+ import { Show as Show14, createSignal as createSignal18 } from "solid-js";
5126
5182
 
5127
5183
  // src/blocks/accordion/component-info.ts
5128
5184
  var defaultTitle = {
@@ -5256,7 +5312,7 @@ var componentInfo = {
5256
5312
  };
5257
5313
 
5258
5314
  // src/blocks/accordion/accordion.tsx
5259
- import { Show as Show8, For as For5, createSignal as createSignal9, createMemo as createMemo9 } from "solid-js";
5315
+ import { Show as Show9, For as For5, createSignal as createSignal9, createMemo as createMemo9 } from "solid-js";
5260
5316
 
5261
5317
  // src/blocks/accordion/helpers.ts
5262
5318
  var convertOrderNumberToString = (order) => {
@@ -5390,7 +5446,7 @@ function Accordion(props) {
5390
5446
  registeredComponents={props.builderComponents}
5391
5447
  linkComponent={props.builderLinkComponent}
5392
5448
  /></div>
5393
- <Show8 when={open().includes(index)}><div
5449
+ <Show9 when={open().includes(index)}><div
5394
5450
  class={getAccordionDetailClassName(index)}
5395
5451
  style={accordionDetailStyles()}
5396
5452
  ><Blocks_default
@@ -5400,7 +5456,7 @@ function Accordion(props) {
5400
5456
  context={props.builderContext}
5401
5457
  registeredComponents={props.builderComponents}
5402
5458
  linkComponent={props.builderLinkComponent}
5403
- /></div></Show8>
5459
+ /></div></Show9>
5404
5460
  </>;
5405
5461
  }}</For5></div></>;
5406
5462
  }
@@ -6081,7 +6137,7 @@ var componentInfo9 = {
6081
6137
  };
6082
6138
 
6083
6139
  // src/blocks/tabs/tabs.tsx
6084
- import { Show as Show9, For as For6, createSignal as createSignal10 } from "solid-js";
6140
+ import { Show as Show10, For as For6, createSignal as createSignal10 } from "solid-js";
6085
6141
  function Tabs(props) {
6086
6142
  const [activeTab, setActiveTab] = createSignal10(
6087
6143
  props.defaultActiveTab ? props.defaultActiveTab - 1 : 0
@@ -6123,14 +6179,14 @@ function Tabs(props) {
6123
6179
  linkComponent={props.builderLinkComponent}
6124
6180
  /></span>;
6125
6181
  }}</For6></div>
6126
- <Show9 when={activeTabContent(activeTab())}><div><Blocks_default
6182
+ <Show10 when={activeTabContent(activeTab())}><div><Blocks_default
6127
6183
  parent={props.builderBlock.id}
6128
6184
  path={`component.options.tabs.${activeTab()}.content`}
6129
6185
  blocks={activeTabContent(activeTab())}
6130
6186
  context={props.builderContext}
6131
6187
  registeredComponents={props.builderComponents}
6132
6188
  linkComponent={props.builderLinkComponent}
6133
- /></div></Show9>
6189
+ /></div></Show10>
6134
6190
  </div></>;
6135
6191
  }
6136
6192
  var tabs_default = Tabs;
@@ -6219,12 +6275,12 @@ var componentInfo11 = {
6219
6275
  };
6220
6276
 
6221
6277
  // src/blocks/custom-code/custom-code.tsx
6222
- import { onMount as onMount4, createSignal as createSignal12 } from "solid-js";
6278
+ import { onMount as onMount5, createSignal as createSignal12 } from "solid-js";
6223
6279
  function CustomCode(props) {
6224
6280
  const [scriptsInserted, setScriptsInserted] = createSignal12([]);
6225
6281
  const [scriptsRun, setScriptsRun] = createSignal12([]);
6226
6282
  let elementRef;
6227
- onMount4(() => {
6283
+ onMount5(() => {
6228
6284
  if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
6229
6285
  return;
6230
6286
  }
@@ -6574,7 +6630,7 @@ var componentInfo13 = {
6574
6630
  };
6575
6631
 
6576
6632
  // src/blocks/form/form/form.tsx
6577
- import { Show as Show10, For as For7, createSignal as createSignal14 } from "solid-js";
6633
+ import { Show as Show11, For as For7, createSignal as createSignal14 } from "solid-js";
6578
6634
 
6579
6635
  // src/functions/get-env.ts
6580
6636
  var validEnvList = ["production", "qa", "test", "development", "dev", "cdn-qa", "cloud", "fast", "cdn2", "cdn-prod"];
@@ -6789,7 +6845,7 @@ function FormComponent(props) {
6789
6845
  {...{}}
6790
6846
  {...props.attributes}
6791
6847
  >
6792
- <Show10 when={props.builderBlock && props.builderBlock.children}><For7 each={props.builderBlock?.children}>{(block, _index) => {
6848
+ <Show11 when={props.builderBlock && props.builderBlock.children}><For7 each={props.builderBlock?.children}>{(block, _index) => {
6793
6849
  const idx = _index();
6794
6850
  return <Block_default
6795
6851
  key={`form-block-${idx}`}
@@ -6798,23 +6854,23 @@ function FormComponent(props) {
6798
6854
  registeredComponents={props.builderComponents}
6799
6855
  linkComponent={props.builderLinkComponent}
6800
6856
  />;
6801
- }}</For7></Show10>
6802
- <Show10 when={submissionState() === "error"}><Blocks_default
6857
+ }}</For7></Show11>
6858
+ <Show11 when={submissionState() === "error"}><Blocks_default
6803
6859
  path="errorMessage"
6804
6860
  blocks={props.errorMessage}
6805
6861
  context={props.builderContext}
6806
- /></Show10>
6807
- <Show10 when={submissionState() === "sending"}><Blocks_default
6862
+ /></Show11>
6863
+ <Show11 when={submissionState() === "sending"}><Blocks_default
6808
6864
  path="sendingMessage"
6809
6865
  blocks={props.sendingMessage}
6810
6866
  context={props.builderContext}
6811
- /></Show10>
6812
- <Show10 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-2e825338">{JSON.stringify(responseData(), null, 2)}</pre></Show10>
6813
- <Show10 when={submissionState() === "success"}><Blocks_default
6867
+ /></Show11>
6868
+ <Show11 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-2e825338">{JSON.stringify(responseData(), null, 2)}</pre></Show11>
6869
+ <Show11 when={submissionState() === "success"}><Blocks_default
6814
6870
  path="successMessage"
6815
6871
  blocks={props.successMessage}
6816
6872
  context={props.builderContext}
6817
- /></Show10>
6873
+ /></Show11>
6818
6874
  </form>
6819
6875
  <style>{`.pre-2e825338 {
6820
6876
  padding: 10px;
@@ -7166,7 +7222,7 @@ var componentInfo19 = {
7166
7222
  };
7167
7223
 
7168
7224
  // src/blocks/video/video.tsx
7169
- import { Show as Show11, createMemo as createMemo15 } from "solid-js";
7225
+ import { Show as Show12, createMemo as createMemo15 } from "solid-js";
7170
7226
  function Video(props) {
7171
7227
  const videoProps = createMemo15(() => {
7172
7228
  return {
@@ -7217,8 +7273,8 @@ function Video(props) {
7217
7273
  }}
7218
7274
  src={props.video || "no-src"}
7219
7275
  poster={props.posterImage}
7220
- ><Show11 when={!props.lazyLoad}><source type="video/mp4" src={props.video} /></Show11></video>
7221
- <Show11
7276
+ ><Show12 when={!props.lazyLoad}><source type="video/mp4" src={props.video} /></Show12></video>
7277
+ <Show12
7222
7278
  when={props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length)}
7223
7279
  ><div
7224
7280
  style={{
@@ -7227,15 +7283,15 @@ function Video(props) {
7227
7283
  "pointer-events": "none",
7228
7284
  "font-size": "0px"
7229
7285
  }}
7230
- /></Show11>
7231
- <Show11 when={props.builderBlock?.children?.length && props.fitContent}><div
7286
+ /></Show12>
7287
+ <Show12 when={props.builderBlock?.children?.length && props.fitContent}><div
7232
7288
  style={{
7233
7289
  display: "flex",
7234
7290
  "flex-direction": "column",
7235
7291
  "align-items": "stretch"
7236
7292
  }}
7237
- >{props.children}</div></Show11>
7238
- <Show11 when={props.builderBlock?.children?.length && !props.fitContent}><div
7293
+ >{props.children}</div></Show12>
7294
+ <Show12 when={props.builderBlock?.children?.length && !props.fitContent}><div
7239
7295
  style={{
7240
7296
  "pointer-events": "none",
7241
7297
  display: "flex",
@@ -7247,7 +7303,7 @@ function Video(props) {
7247
7303
  width: "100%",
7248
7304
  height: "100%"
7249
7305
  }}
7250
- >{props.children}</div></Show11>
7306
+ >{props.children}</div></Show12>
7251
7307
  </div></>;
7252
7308
  }
7253
7309
  var video_default = Video;
@@ -7392,8 +7448,8 @@ var Inlined_script_default = InlinedScript;
7392
7448
 
7393
7449
  // src/components/content/components/enable-editor.tsx
7394
7450
  import {
7395
- Show as Show12,
7396
- onMount as onMount5,
7451
+ Show as Show13,
7452
+ onMount as onMount6,
7397
7453
  on as on3,
7398
7454
  createEffect as createEffect3,
7399
7455
  createMemo as createMemo16,
@@ -7900,7 +7956,7 @@ function isFromTrustedHost(trustedHosts, e) {
7900
7956
  }
7901
7957
 
7902
7958
  // src/constants/sdk-version.ts
7903
- var SDK_VERSION = "2.0.16";
7959
+ var SDK_VERSION = "2.0.21";
7904
7960
 
7905
7961
  // src/functions/register.ts
7906
7962
  var registry = {};
@@ -8253,22 +8309,6 @@ function EnableEditor(props) {
8253
8309
  }
8254
8310
  })(event);
8255
8311
  }
8256
- function evaluateJsCode() {
8257
- const jsCode = props.builderContextSignal.content?.data?.jsCode;
8258
- if (jsCode) {
8259
- evaluate({
8260
- code: jsCode,
8261
- context: props.context || {},
8262
- localState: void 0,
8263
- rootState: props.builderContextSignal.rootState,
8264
- rootSetState: props.builderContextSignal.rootSetState,
8265
- /**
8266
- * We don't want to cache the result of the JS code, since it's arbitrary side effect code.
8267
- */
8268
- enableCache: false
8269
- });
8270
- }
8271
- }
8272
8312
  function onClick(event) {
8273
8313
  if (props.builderContextSignal.content) {
8274
8314
  const variationId = props.builderContextSignal.content?.testVariationId;
@@ -8310,7 +8350,7 @@ function EnableEditor(props) {
8310
8350
  })
8311
8351
  )
8312
8352
  );
8313
- fetch2(evaluatedUrl).then((response) => response.json()).then((json) => {
8353
+ fetch(evaluatedUrl).then((response) => response.json()).then((json) => {
8314
8354
  mergeNewRootState({
8315
8355
  [key]: json
8316
8356
  });
@@ -8340,7 +8380,9 @@ function EnableEditor(props) {
8340
8380
  }
8341
8381
  }
8342
8382
  let elementRef;
8343
- onMount5(() => {
8383
+ runHttpRequests();
8384
+ emitStateUpdate();
8385
+ onMount6(() => {
8344
8386
  if (isBrowser()) {
8345
8387
  if (isEditing()) {
8346
8388
  window.addEventListener("message", processMessage);
@@ -8401,16 +8443,6 @@ function EnableEditor(props) {
8401
8443
  }
8402
8444
  }
8403
8445
  });
8404
- onMount5(() => {
8405
- if (!props.apiKey) {
8406
- logger.error(
8407
- "No API key provided to `Content` component. This can cause issues. Please provide an API key using the `apiKey` prop."
8408
- );
8409
- }
8410
- evaluateJsCode();
8411
- runHttpRequests();
8412
- emitStateUpdate();
8413
- });
8414
8446
  const onUpdateFn_0_props_content = createMemo16(() => props.content);
8415
8447
  function onUpdateFn_0() {
8416
8448
  if (props.content) {
@@ -8418,57 +8450,35 @@ function EnableEditor(props) {
8418
8450
  }
8419
8451
  }
8420
8452
  createEffect3(on3(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
8421
- const onUpdateFn_1_props_builderContextSignal_content__data__jsCode = createMemo16(() => props.builderContextSignal.content?.data?.jsCode);
8422
- function onUpdateFn_1() {
8423
- evaluateJsCode();
8424
- }
8425
- createEffect3(
8426
- on3(
8427
- () => [onUpdateFn_1_props_builderContextSignal_content__data__jsCode()],
8428
- onUpdateFn_1
8429
- )
8430
- );
8431
- const onUpdateFn_2_props_builderContextSignal_content__data__httpRequests = createMemo16(() => props.builderContextSignal.content?.data?.httpRequests);
8432
- function onUpdateFn_2() {
8433
- runHttpRequests();
8434
- }
8435
- createEffect3(
8436
- on3(
8437
- () => [
8438
- onUpdateFn_2_props_builderContextSignal_content__data__httpRequests()
8439
- ],
8440
- onUpdateFn_2
8441
- )
8442
- );
8443
- const onUpdateFn_3_props_builderContextSignal_rootState = createMemo16(
8453
+ const onUpdateFn_1_props_builderContextSignal_rootState = createMemo16(
8444
8454
  () => props.builderContextSignal.rootState
8445
8455
  );
8446
- function onUpdateFn_3() {
8456
+ function onUpdateFn_1() {
8447
8457
  emitStateUpdate();
8448
8458
  }
8449
8459
  createEffect3(
8450
8460
  on3(
8451
- () => [onUpdateFn_3_props_builderContextSignal_rootState()],
8452
- onUpdateFn_3
8461
+ () => [onUpdateFn_1_props_builderContextSignal_rootState()],
8462
+ onUpdateFn_1
8453
8463
  )
8454
8464
  );
8455
- const onUpdateFn_4_props_data = createMemo16(() => props.data);
8456
- function onUpdateFn_4() {
8465
+ const onUpdateFn_2_props_data = createMemo16(() => props.data);
8466
+ function onUpdateFn_2() {
8457
8467
  if (props.data) {
8458
8468
  mergeNewRootState(props.data);
8459
8469
  }
8460
8470
  }
8461
- createEffect3(on3(() => [onUpdateFn_4_props_data()], onUpdateFn_4));
8462
- const onUpdateFn_5_props_locale = createMemo16(() => props.locale);
8463
- function onUpdateFn_5() {
8471
+ createEffect3(on3(() => [onUpdateFn_2_props_data()], onUpdateFn_2));
8472
+ const onUpdateFn_3_props_locale = createMemo16(() => props.locale);
8473
+ function onUpdateFn_3() {
8464
8474
  if (props.locale) {
8465
8475
  mergeNewRootState({
8466
8476
  locale: props.locale
8467
8477
  });
8468
8478
  }
8469
8479
  }
8470
- createEffect3(on3(() => [onUpdateFn_5_props_locale()], onUpdateFn_5));
8471
- return <><builder_context_default.Provider value={props.builderContextSignal}><Show12 when={props.builderContextSignal.content}><Dynamic5
8480
+ createEffect3(on3(() => [onUpdateFn_3_props_locale()], onUpdateFn_3));
8481
+ return <><builder_context_default.Provider value={props.builderContextSignal}><Show13 when={props.builderContextSignal.content}><Dynamic5
8472
8482
  class={getWrapperClassName(
8473
8483
  props.content?.testVariationId || props.content?.id
8474
8484
  )}
@@ -8481,7 +8491,7 @@ function EnableEditor(props) {
8481
8491
  {...showContentProps()}
8482
8492
  {...props.contentWrapperProps}
8483
8493
  component={ContentWrapper()}
8484
- >{props.children}</Dynamic5></Show12></builder_context_default.Provider></>;
8494
+ >{props.children}</Dynamic5></Show13></builder_context_default.Provider></>;
8485
8495
  }
8486
8496
  var Enable_editor_default = EnableEditor;
8487
8497
 
@@ -8618,6 +8628,31 @@ function ContentComponent(props) {
8618
8628
  rootState: newRootState
8619
8629
  }));
8620
8630
  }
8631
+ if (!props.apiKey) {
8632
+ logger.error(
8633
+ "No API key provided to `Content` component. This can cause issues. Please provide an API key using the `apiKey` prop."
8634
+ );
8635
+ }
8636
+ const jsCode = builderContextSignal().content?.data?.jsCode;
8637
+ if (jsCode) {
8638
+ evaluate({
8639
+ code: jsCode,
8640
+ context: props.context || {},
8641
+ localState: void 0,
8642
+ rootState: builderContextSignal().rootState,
8643
+ rootSetState: (newState) => {
8644
+ setBuilderContextSignal((PREVIOUS_VALUE) => ({
8645
+ ...PREVIOUS_VALUE,
8646
+ rootState: newState
8647
+ }));
8648
+ },
8649
+ isExpression: false,
8650
+ /**
8651
+ * We don't want to cache the result of the JS code, since it's arbitrary side effect code.
8652
+ */
8653
+ enableCache: false
8654
+ });
8655
+ }
8621
8656
  return <><components_context_default.Provider
8622
8657
  value={{
8623
8658
  registeredComponents: registeredComponents()
@@ -8641,18 +8676,18 @@ function ContentComponent(props) {
8641
8676
  setBuilderContextSignal
8642
8677
  }}
8643
8678
  >
8644
- <Show13 when={props.isSsrAbTest}><Inlined_script_default
8679
+ <Show14 when={props.isSsrAbTest}><Inlined_script_default
8645
8680
  id="builderio-variant-visibility"
8646
8681
  scriptStr={scriptStr()}
8647
8682
  nonce={props.nonce || ""}
8648
- /></Show13>
8649
- <Show13 when={TARGET !== "reactNative"}><Styles_default
8683
+ /></Show14>
8684
+ <Show14 when={TARGET !== "reactNative"}><Styles_default
8650
8685
  nonce={props.nonce || ""}
8651
8686
  isNestedRender={props.isNestedRender}
8652
8687
  contentId={builderContextSignal().content?.id}
8653
8688
  cssCode={builderContextSignal().content?.data?.cssCode}
8654
8689
  customFonts={builderContextSignal().content?.data?.customFonts}
8655
- /></Show13>
8690
+ /></Show14>
8656
8691
  <Blocks_default
8657
8692
  blocks={builderContextSignal().content?.data?.blocks}
8658
8693
  context={builderContextSignal()}
@@ -8692,16 +8727,16 @@ function ContentVariants(props) {
8692
8727
  canTrack: getDefaultCanTrack(props.canTrack)
8693
8728
  });
8694
8729
  });
8695
- onMount6(() => {
8730
+ onMount7(() => {
8696
8731
  setShouldRenderVariants(false);
8697
8732
  });
8698
8733
  return <><>
8699
- <Show14 when={!props.isNestedRender && TARGET !== "reactNative"}><Inlined_script_default
8734
+ <Show15 when={!props.isNestedRender && TARGET !== "reactNative"}><Inlined_script_default
8700
8735
  id="builderio-init-variants-fns"
8701
8736
  scriptStr={getInitVariantsFnsScriptString()}
8702
8737
  nonce={props.nonce || ""}
8703
- /></Show14>
8704
- <Show14 when={shouldRenderVariants()}>
8738
+ /></Show15>
8739
+ <Show15 when={shouldRenderVariants()}>
8705
8740
  <Inlined_styles_default
8706
8741
  id="builderio-variants"
8707
8742
  styles={hideVariantsStyleString()}
@@ -8739,7 +8774,7 @@ function ContentVariants(props) {
8739
8774
  {...{}}
8740
8775
  />;
8741
8776
  }}</For9>
8742
- </Show14>
8777
+ </Show15>
8743
8778
  <Content_default
8744
8779
  nonce={props.nonce}
8745
8780
  isNestedRender={props.isNestedRender}
@@ -8820,7 +8855,7 @@ function Symbol2(props) {
8820
8855
  }
8821
8856
  });
8822
8857
  }
8823
- onMount7(() => {
8858
+ onMount8(() => {
8824
8859
  });
8825
8860
  const onUpdateFn_0_props_symbol = createMemo20(() => props.symbol);
8826
8861
  function onUpdateFn_0() {