@builder.io/sdk-solid 0.11.2 → 0.11.4

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.
@@ -751,25 +751,15 @@ function ComponentRef(props) {
751
751
  contextValue: props.context
752
752
  })}
753
753
  component={Wrapper()}
754
- >
755
- <For each={props.blockChildren}>{(child, _index) => {
756
- const index = _index();
757
- return <Block_default
758
- key={"block-" + child.id}
759
- block={child}
760
- context={props.context}
761
- registeredComponents={props.registeredComponents}
762
- />;
763
- }}</For>
764
- <For each={props.blockChildren}>{(child, _index) => {
765
- const index = _index();
766
- return <Block_styles_default
767
- key={"block-style-" + child.id}
768
- block={child}
769
- context={props.context}
770
- />;
771
- }}</For>
772
- </Dynamic3></Show4>;
754
+ ><For each={props.blockChildren}>{(child, _index) => {
755
+ const index = _index();
756
+ return <Block_default
757
+ key={child.id}
758
+ block={child}
759
+ context={props.context}
760
+ registeredComponents={props.registeredComponents}
761
+ />;
762
+ }}</For></Dynamic3></Show4>;
773
763
  }
774
764
  var Component_ref_default = ComponentRef;
775
765
 
@@ -846,41 +836,10 @@ function Block(props) {
846
836
  isInteractive: !blockComponent()?.isRSC
847
837
  };
848
838
  }
849
- return <Show5 when={canShowBlock()}><Show5
850
- fallback={<Component_ref_default
851
- componentRef={componentRefProps().componentRef}
852
- componentOptions={componentRefProps().componentOptions}
853
- blockChildren={componentRefProps().blockChildren}
854
- context={componentRefProps().context}
855
- registeredComponents={componentRefProps().registeredComponents}
856
- builderBlock={componentRefProps().builderBlock}
857
- includeBlockProps={componentRefProps().includeBlockProps}
858
- isInteractive={componentRefProps().isInteractive}
859
- />}
860
- when={!blockComponent()?.noWrap}
861
- >
862
- <Show5 when={isEmptyHtmlElement(Tag())}><Block_wrapper_default
863
- Wrapper={Tag()}
864
- block={processedBlock()}
865
- context={props.context}
866
- hasChildren={false}
867
- /></Show5>
868
- <Show5 when={!isEmptyHtmlElement(Tag()) && repeatItem()}><For2 each={repeatItem()}>{(data, _index) => {
869
- const index = _index();
870
- return <Repeated_block_default
871
- key={index}
872
- repeatContext={data.context}
873
- block={data.block}
874
- registeredComponents={props.registeredComponents}
875
- />;
876
- }}</For2></Show5>
877
- <Show5 when={!isEmptyHtmlElement(Tag()) && !repeatItem()}><Block_wrapper_default
878
- Wrapper={Tag()}
879
- block={processedBlock()}
880
- context={props.context}
881
- hasChildren={true}
882
- >
883
- <Component_ref_default
839
+ return <Show5 when={canShowBlock()}>
840
+ <Block_styles_default block={props.block} context={props.context} />
841
+ <Show5
842
+ fallback={<Component_ref_default
884
843
  componentRef={componentRefProps().componentRef}
885
844
  componentOptions={componentRefProps().componentOptions}
886
845
  blockChildren={componentRefProps().blockChildren}
@@ -889,26 +848,52 @@ function Block(props) {
889
848
  builderBlock={componentRefProps().builderBlock}
890
849
  includeBlockProps={componentRefProps().includeBlockProps}
891
850
  isInteractive={componentRefProps().isInteractive}
892
- />
893
- <For2 each={childrenWithoutParentComponent()}>{(child, _index) => {
851
+ />}
852
+ when={!blockComponent()?.noWrap}
853
+ >
854
+ <Show5 when={isEmptyHtmlElement(Tag())}><Block_wrapper_default
855
+ Wrapper={Tag()}
856
+ block={processedBlock()}
857
+ context={props.context}
858
+ hasChildren={false}
859
+ /></Show5>
860
+ <Show5 when={!isEmptyHtmlElement(Tag()) && repeatItem()}><For2 each={repeatItem()}>{(data, _index) => {
894
861
  const index = _index();
895
- return <Block
896
- key={"block-" + child.id}
897
- block={child}
898
- context={childrenContext()}
862
+ return <Repeated_block_default
863
+ key={index}
864
+ repeatContext={data.context}
865
+ block={data.block}
899
866
  registeredComponents={props.registeredComponents}
900
867
  />;
901
- }}</For2>
902
- <For2 each={childrenWithoutParentComponent()}>{(child, _index) => {
903
- const index = _index();
904
- return <Block_styles_default
905
- key={"block-style-" + child.id}
906
- block={child}
907
- context={childrenContext()}
908
- />;
909
- }}</For2>
910
- </Block_wrapper_default></Show5>
911
- </Show5></Show5>;
868
+ }}</For2></Show5>
869
+ <Show5 when={!isEmptyHtmlElement(Tag()) && !repeatItem()}><Block_wrapper_default
870
+ Wrapper={Tag()}
871
+ block={processedBlock()}
872
+ context={props.context}
873
+ hasChildren={true}
874
+ >
875
+ <Component_ref_default
876
+ componentRef={componentRefProps().componentRef}
877
+ componentOptions={componentRefProps().componentOptions}
878
+ blockChildren={componentRefProps().blockChildren}
879
+ context={componentRefProps().context}
880
+ registeredComponents={componentRefProps().registeredComponents}
881
+ builderBlock={componentRefProps().builderBlock}
882
+ includeBlockProps={componentRefProps().includeBlockProps}
883
+ isInteractive={componentRefProps().isInteractive}
884
+ />
885
+ <For2 each={childrenWithoutParentComponent()}>{(child, _index) => {
886
+ const index = _index();
887
+ return <Block
888
+ key={child.id}
889
+ block={child}
890
+ context={childrenContext()}
891
+ registeredComponents={props.registeredComponents}
892
+ />;
893
+ }}</For2>
894
+ </Block_wrapper_default></Show5>
895
+ </Show5>
896
+ </Show5>;
912
897
  }
913
898
  var Block_default = Block;
914
899
 
@@ -977,25 +962,15 @@ function Blocks(props) {
977
962
  styleProp={props.styleProp}
978
963
  BlocksWrapper={props.context?.BlocksWrapper}
979
964
  BlocksWrapperProps={props.context?.BlocksWrapperProps}
980
- >
981
- <Show6 when={props.blocks}><For3 each={props.blocks}>{(block, _index) => {
982
- const index = _index();
983
- return <Block_default
984
- key={"render-block-" + block.id}
985
- block={block}
986
- context={props.context || builderContext}
987
- registeredComponents={props.registeredComponents || componentsContext.registeredComponents}
988
- />;
989
- }}</For3></Show6>
990
- <Show6 when={props.blocks}><For3 each={props.blocks}>{(block, _index) => {
991
- const index = _index();
992
- return <Block_styles_default
993
- key={"block-style-" + block.id}
994
- block={block}
995
- context={props.context || builderContext}
996
- />;
997
- }}</For3></Show6>
998
- </Blocks_wrapper_default>;
965
+ ><Show6 when={props.blocks}><For3 each={props.blocks}>{(block, _index) => {
966
+ const index = _index();
967
+ return <Block_default
968
+ key={block.id}
969
+ block={block}
970
+ context={props.context || builderContext}
971
+ registeredComponents={props.registeredComponents || componentsContext.registeredComponents}
972
+ />;
973
+ }}</For3></Show6></Blocks_wrapper_default>;
999
974
  }
1000
975
  var Blocks_default = Blocks;
1001
976
 
@@ -2949,7 +2924,7 @@ var getInteractionPropertiesForEvent = (event) => {
2949
2924
  };
2950
2925
 
2951
2926
  // src/constants/sdk-version.ts
2952
- var SDK_VERSION = "0.11.2";
2927
+ var SDK_VERSION = "0.11.4";
2953
2928
 
2954
2929
  // src/functions/register.ts
2955
2930
  var registry = {};
@@ -3084,6 +3059,7 @@ var setupBrowserForEditing = (options = {}) => {
3084
3059
  // src/components/content/components/enable-editor.tsx
3085
3060
  function EnableEditor(props) {
3086
3061
  const [forceReRenderCount, setForceReRenderCount] = createSignal10(0);
3062
+ const [firstRender, setFirstRender] = createSignal10(true);
3087
3063
  const [lastUpdated, setLastUpdated] = createSignal10(0);
3088
3064
  const [shouldSendResetCookie, setShouldSendResetCookie] = createSignal10(false);
3089
3065
  const [ContentWrapper, setContentWrapper] = createSignal10(
@@ -3091,6 +3067,20 @@ function EnableEditor(props) {
3091
3067
  );
3092
3068
  const [httpReqsData, setHttpReqsData] = createSignal10({});
3093
3069
  const [clicked, setClicked] = createSignal10(false);
3070
+ function mergeNewRootState(newData) {
3071
+ const combinedState = {
3072
+ ...props.builderContextSignal.rootState,
3073
+ ...newData
3074
+ };
3075
+ if (props.builderContextSignal.rootSetState) {
3076
+ props.builderContextSignal.rootSetState?.(combinedState);
3077
+ } else {
3078
+ props.setBuilderContextSignal((PREVIOUS_VALUE) => ({
3079
+ ...PREVIOUS_VALUE,
3080
+ rootState: combinedState
3081
+ }));
3082
+ }
3083
+ }
3094
3084
  function mergeNewContent(newContent) {
3095
3085
  const newContentValue = {
3096
3086
  ...props.builderContextSignal.content,
@@ -3332,6 +3322,20 @@ function EnableEditor(props) {
3332
3322
  emitStateUpdate();
3333
3323
  }
3334
3324
  createEffect2(on2(() => [props.builderContextSignal.rootState], onUpdateFn_4));
3325
+ function onUpdateFn_5() {
3326
+ if (props.data) {
3327
+ mergeNewRootState(props.data);
3328
+ }
3329
+ }
3330
+ createEffect2(on2(() => [props.data], onUpdateFn_5));
3331
+ function onUpdateFn_6() {
3332
+ if (props.locale) {
3333
+ mergeNewRootState({
3334
+ locale: props.locale
3335
+ });
3336
+ }
3337
+ }
3338
+ createEffect2(on2(() => [props.locale], onUpdateFn_6));
3335
3339
  return <builder_context_default.Provider value={props.builderContextSignal}><Show10 when={props.builderContextSignal.content}><Dynamic5
3336
3340
  class={`variant-${props.content?.testVariationId || props.content?.id}`}
3337
3341
  {...{}}
@@ -3440,7 +3444,7 @@ ${getFontCss({
3440
3444
  var Styles_default = ContentStyles;
3441
3445
 
3442
3446
  // src/components/content/content.helpers.ts
3443
- var getContextStateInitialValue = ({
3447
+ var getRootStateInitialValue = ({
3444
3448
  content,
3445
3449
  data,
3446
3450
  locale
@@ -3512,7 +3516,7 @@ function ContentComponent(props) {
3512
3516
  data: props.data
3513
3517
  }),
3514
3518
  localState: void 0,
3515
- rootState: getContextStateInitialValue({
3519
+ rootState: getRootStateInitialValue({
3516
3520
  content: props.content,
3517
3521
  data: props.data,
3518
3522
  locale: props.locale
@@ -3553,6 +3557,7 @@ function ContentComponent(props) {
3553
3557
  }}
3554
3558
  ><Enable_editor_default
3555
3559
  content={props.content}
3560
+ data={props.data}
3556
3561
  model={props.model}
3557
3562
  context={props.context}
3558
3563
  apiKey={props.apiKey}
package/lib/edge/dev.js CHANGED
@@ -3938,7 +3938,7 @@ function ComponentRef(props) {
3938
3938
  return Wrapper();
3939
3939
  },
3940
3940
  get children() {
3941
- return [createComponent(For, {
3941
+ return createComponent(For, {
3942
3942
  get each() {
3943
3943
  return props.blockChildren;
3944
3944
  },
@@ -3946,7 +3946,7 @@ function ComponentRef(props) {
3946
3946
  _index();
3947
3947
  return createComponent(block_default, {
3948
3948
  get key() {
3949
- return "block-" + child.id;
3949
+ return child.id;
3950
3950
  },
3951
3951
  block: child,
3952
3952
  get context() {
@@ -3957,23 +3957,7 @@ function ComponentRef(props) {
3957
3957
  }
3958
3958
  });
3959
3959
  }
3960
- }), createComponent(For, {
3961
- get each() {
3962
- return props.blockChildren;
3963
- },
3964
- children: (child, _index) => {
3965
- _index();
3966
- return createComponent(block_styles_default, {
3967
- get key() {
3968
- return "block-style-" + child.id;
3969
- },
3970
- block: child,
3971
- get context() {
3972
- return props.context;
3973
- }
3974
- });
3975
- }
3976
- })];
3960
+ });
3977
3961
  }
3978
3962
  }));
3979
3963
  }
@@ -4069,7 +4053,14 @@ function Block(props) {
4069
4053
  return canShowBlock();
4070
4054
  },
4071
4055
  get children() {
4072
- return createComponent(Show, {
4056
+ return [createComponent(block_styles_default, {
4057
+ get block() {
4058
+ return props.block;
4059
+ },
4060
+ get context() {
4061
+ return props.context;
4062
+ }
4063
+ }), createComponent(Show, {
4073
4064
  get fallback() {
4074
4065
  return createComponent(component_ref_default, {
4075
4066
  get componentRef() {
@@ -4196,7 +4187,7 @@ function Block(props) {
4196
4187
  _index();
4197
4188
  return createComponent(Block, {
4198
4189
  get key() {
4199
- return "block-" + child.id;
4190
+ return child.id;
4200
4191
  },
4201
4192
  block: child,
4202
4193
  get context() {
@@ -4207,29 +4198,13 @@ function Block(props) {
4207
4198
  }
4208
4199
  });
4209
4200
  }
4210
- }), createComponent(For, {
4211
- get each() {
4212
- return childrenWithoutParentComponent();
4213
- },
4214
- children: (child, _index) => {
4215
- _index();
4216
- return createComponent(block_styles_default, {
4217
- get key() {
4218
- return "block-style-" + child.id;
4219
- },
4220
- block: child,
4221
- get context() {
4222
- return childrenContext();
4223
- }
4224
- });
4225
- }
4226
4201
  })];
4227
4202
  }
4228
4203
  });
4229
4204
  }
4230
4205
  })];
4231
4206
  }
4232
- });
4207
+ })];
4233
4208
  }
4234
4209
  });
4235
4210
  }
@@ -4316,7 +4291,7 @@ function Blocks(props) {
4316
4291
  return props.context?.BlocksWrapperProps;
4317
4292
  },
4318
4293
  get children() {
4319
- return [createComponent(Show, {
4294
+ return createComponent(Show, {
4320
4295
  get when() {
4321
4296
  return props.blocks;
4322
4297
  },
@@ -4329,7 +4304,7 @@ function Blocks(props) {
4329
4304
  _index();
4330
4305
  return createComponent(block_default, {
4331
4306
  get key() {
4332
- return "render-block-" + block.id;
4307
+ return block.id;
4333
4308
  },
4334
4309
  block,
4335
4310
  get context() {
@@ -4342,30 +4317,7 @@ function Blocks(props) {
4342
4317
  }
4343
4318
  });
4344
4319
  }
4345
- }), createComponent(Show, {
4346
- get when() {
4347
- return props.blocks;
4348
- },
4349
- get children() {
4350
- return createComponent(For, {
4351
- get each() {
4352
- return props.blocks;
4353
- },
4354
- children: (block, _index) => {
4355
- _index();
4356
- return createComponent(block_styles_default, {
4357
- get key() {
4358
- return "block-style-" + block.id;
4359
- },
4360
- block,
4361
- get context() {
4362
- return props.context || builderContext;
4363
- }
4364
- });
4365
- }
4366
- });
4367
- }
4368
- })];
4320
+ });
4369
4321
  }
4370
4322
  });
4371
4323
  }
@@ -6451,7 +6403,7 @@ var getInteractionPropertiesForEvent = (event) => {
6451
6403
  };
6452
6404
 
6453
6405
  // src/constants/sdk-version.ts
6454
- var SDK_VERSION = "0.11.2";
6406
+ var SDK_VERSION = "0.11.4";
6455
6407
 
6456
6408
  // src/functions/register.ts
6457
6409
  var registry = {};
@@ -6587,11 +6539,26 @@ var setupBrowserForEditing = (options = {}) => {
6587
6539
  // src/components/content/components/enable-editor.tsx
6588
6540
  function EnableEditor(props) {
6589
6541
  const [forceReRenderCount, setForceReRenderCount] = createSignal(0);
6542
+ createSignal(true);
6590
6543
  createSignal(0);
6591
6544
  const [shouldSendResetCookie, setShouldSendResetCookie] = createSignal(false);
6592
6545
  const [ContentWrapper, setContentWrapper] = createSignal(props.contentWrapper || "div");
6593
6546
  const [httpReqsData, setHttpReqsData] = createSignal({});
6594
6547
  const [clicked, setClicked] = createSignal(false);
6548
+ function mergeNewRootState(newData) {
6549
+ const combinedState = {
6550
+ ...props.builderContextSignal.rootState,
6551
+ ...newData
6552
+ };
6553
+ if (props.builderContextSignal.rootSetState) {
6554
+ props.builderContextSignal.rootSetState?.(combinedState);
6555
+ } else {
6556
+ props.setBuilderContextSignal((PREVIOUS_VALUE) => ({
6557
+ ...PREVIOUS_VALUE,
6558
+ rootState: combinedState
6559
+ }));
6560
+ }
6561
+ }
6595
6562
  function mergeNewContent(newContent) {
6596
6563
  const newContentValue = {
6597
6564
  ...props.builderContextSignal.content,
@@ -6812,6 +6779,20 @@ function EnableEditor(props) {
6812
6779
  emitStateUpdate();
6813
6780
  }
6814
6781
  createEffect(on(() => [props.builderContextSignal.rootState], onUpdateFn_4));
6782
+ function onUpdateFn_5() {
6783
+ if (props.data) {
6784
+ mergeNewRootState(props.data);
6785
+ }
6786
+ }
6787
+ createEffect(on(() => [props.data], onUpdateFn_5));
6788
+ function onUpdateFn_6() {
6789
+ if (props.locale) {
6790
+ mergeNewRootState({
6791
+ locale: props.locale
6792
+ });
6793
+ }
6794
+ }
6795
+ createEffect(on(() => [props.locale], onUpdateFn_6));
6815
6796
  return createComponent(builder_context_default.Provider, {
6816
6797
  get value() {
6817
6798
  return props.builderContextSignal;
@@ -6947,7 +6928,7 @@ ${getFontCss({
6947
6928
  var styles_default = ContentStyles;
6948
6929
 
6949
6930
  // src/components/content/content.helpers.ts
6950
- var getContextStateInitialValue = ({
6931
+ var getRootStateInitialValue = ({
6951
6932
  content,
6952
6933
  data,
6953
6934
  locale
@@ -7015,7 +6996,7 @@ function ContentComponent(props) {
7015
6996
  data: props.data
7016
6997
  }),
7017
6998
  localState: void 0,
7018
- rootState: getContextStateInitialValue({
6999
+ rootState: getRootStateInitialValue({
7019
7000
  content: props.content,
7020
7001
  data: props.data,
7021
7002
  locale: props.locale
@@ -7061,6 +7042,9 @@ function ContentComponent(props) {
7061
7042
  get content() {
7062
7043
  return props.content;
7063
7044
  },
7045
+ get data() {
7046
+ return props.data;
7047
+ },
7064
7048
  get model() {
7065
7049
  return props.model;
7066
7050
  },