@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.
@@ -756,25 +756,15 @@ function ComponentRef(props) {
756
756
  contextValue: props.context
757
757
  })}
758
758
  component={Wrapper()}
759
- >
760
- <For each={props.blockChildren}>{(child, _index) => {
761
- const index = _index();
762
- return <Block_default
763
- key={"block-" + child.id}
764
- block={child}
765
- context={props.context}
766
- registeredComponents={props.registeredComponents}
767
- />;
768
- }}</For>
769
- <For each={props.blockChildren}>{(child, _index) => {
770
- const index = _index();
771
- return <Block_styles_default
772
- key={"block-style-" + child.id}
773
- block={child}
774
- context={props.context}
775
- />;
776
- }}</For>
777
- </Dynamic3></Show4>;
759
+ ><For each={props.blockChildren}>{(child, _index) => {
760
+ const index = _index();
761
+ return <Block_default
762
+ key={child.id}
763
+ block={child}
764
+ context={props.context}
765
+ registeredComponents={props.registeredComponents}
766
+ />;
767
+ }}</For></Dynamic3></Show4>;
778
768
  }
779
769
  var Component_ref_default = ComponentRef;
780
770
 
@@ -851,41 +841,10 @@ function Block(props) {
851
841
  isInteractive: !blockComponent()?.isRSC
852
842
  };
853
843
  }
854
- return <Show5 when={canShowBlock()}><Show5
855
- fallback={<Component_ref_default
856
- componentRef={componentRefProps().componentRef}
857
- componentOptions={componentRefProps().componentOptions}
858
- blockChildren={componentRefProps().blockChildren}
859
- context={componentRefProps().context}
860
- registeredComponents={componentRefProps().registeredComponents}
861
- builderBlock={componentRefProps().builderBlock}
862
- includeBlockProps={componentRefProps().includeBlockProps}
863
- isInteractive={componentRefProps().isInteractive}
864
- />}
865
- when={!blockComponent()?.noWrap}
866
- >
867
- <Show5 when={isEmptyHtmlElement(Tag())}><Block_wrapper_default
868
- Wrapper={Tag()}
869
- block={processedBlock()}
870
- context={props.context}
871
- hasChildren={false}
872
- /></Show5>
873
- <Show5 when={!isEmptyHtmlElement(Tag()) && repeatItem()}><For2 each={repeatItem()}>{(data, _index) => {
874
- const index = _index();
875
- return <Repeated_block_default
876
- key={index}
877
- repeatContext={data.context}
878
- block={data.block}
879
- registeredComponents={props.registeredComponents}
880
- />;
881
- }}</For2></Show5>
882
- <Show5 when={!isEmptyHtmlElement(Tag()) && !repeatItem()}><Block_wrapper_default
883
- Wrapper={Tag()}
884
- block={processedBlock()}
885
- context={props.context}
886
- hasChildren={true}
887
- >
888
- <Component_ref_default
844
+ return <Show5 when={canShowBlock()}>
845
+ <Block_styles_default block={props.block} context={props.context} />
846
+ <Show5
847
+ fallback={<Component_ref_default
889
848
  componentRef={componentRefProps().componentRef}
890
849
  componentOptions={componentRefProps().componentOptions}
891
850
  blockChildren={componentRefProps().blockChildren}
@@ -894,26 +853,52 @@ function Block(props) {
894
853
  builderBlock={componentRefProps().builderBlock}
895
854
  includeBlockProps={componentRefProps().includeBlockProps}
896
855
  isInteractive={componentRefProps().isInteractive}
897
- />
898
- <For2 each={childrenWithoutParentComponent()}>{(child, _index) => {
856
+ />}
857
+ when={!blockComponent()?.noWrap}
858
+ >
859
+ <Show5 when={isEmptyHtmlElement(Tag())}><Block_wrapper_default
860
+ Wrapper={Tag()}
861
+ block={processedBlock()}
862
+ context={props.context}
863
+ hasChildren={false}
864
+ /></Show5>
865
+ <Show5 when={!isEmptyHtmlElement(Tag()) && repeatItem()}><For2 each={repeatItem()}>{(data, _index) => {
899
866
  const index = _index();
900
- return <Block
901
- key={"block-" + child.id}
902
- block={child}
903
- context={childrenContext()}
867
+ return <Repeated_block_default
868
+ key={index}
869
+ repeatContext={data.context}
870
+ block={data.block}
904
871
  registeredComponents={props.registeredComponents}
905
872
  />;
906
- }}</For2>
907
- <For2 each={childrenWithoutParentComponent()}>{(child, _index) => {
908
- const index = _index();
909
- return <Block_styles_default
910
- key={"block-style-" + child.id}
911
- block={child}
912
- context={childrenContext()}
913
- />;
914
- }}</For2>
915
- </Block_wrapper_default></Show5>
916
- </Show5></Show5>;
873
+ }}</For2></Show5>
874
+ <Show5 when={!isEmptyHtmlElement(Tag()) && !repeatItem()}><Block_wrapper_default
875
+ Wrapper={Tag()}
876
+ block={processedBlock()}
877
+ context={props.context}
878
+ hasChildren={true}
879
+ >
880
+ <Component_ref_default
881
+ componentRef={componentRefProps().componentRef}
882
+ componentOptions={componentRefProps().componentOptions}
883
+ blockChildren={componentRefProps().blockChildren}
884
+ context={componentRefProps().context}
885
+ registeredComponents={componentRefProps().registeredComponents}
886
+ builderBlock={componentRefProps().builderBlock}
887
+ includeBlockProps={componentRefProps().includeBlockProps}
888
+ isInteractive={componentRefProps().isInteractive}
889
+ />
890
+ <For2 each={childrenWithoutParentComponent()}>{(child, _index) => {
891
+ const index = _index();
892
+ return <Block
893
+ key={child.id}
894
+ block={child}
895
+ context={childrenContext()}
896
+ registeredComponents={props.registeredComponents}
897
+ />;
898
+ }}</For2>
899
+ </Block_wrapper_default></Show5>
900
+ </Show5>
901
+ </Show5>;
917
902
  }
918
903
  var Block_default = Block;
919
904
 
@@ -982,25 +967,15 @@ function Blocks(props) {
982
967
  styleProp={props.styleProp}
983
968
  BlocksWrapper={props.context?.BlocksWrapper}
984
969
  BlocksWrapperProps={props.context?.BlocksWrapperProps}
985
- >
986
- <Show6 when={props.blocks}><For3 each={props.blocks}>{(block, _index) => {
987
- const index = _index();
988
- return <Block_default
989
- key={"render-block-" + block.id}
990
- block={block}
991
- context={props.context || builderContext}
992
- registeredComponents={props.registeredComponents || componentsContext.registeredComponents}
993
- />;
994
- }}</For3></Show6>
995
- <Show6 when={props.blocks}><For3 each={props.blocks}>{(block, _index) => {
996
- const index = _index();
997
- return <Block_styles_default
998
- key={"block-style-" + block.id}
999
- block={block}
1000
- context={props.context || builderContext}
1001
- />;
1002
- }}</For3></Show6>
1003
- </Blocks_wrapper_default>;
970
+ ><Show6 when={props.blocks}><For3 each={props.blocks}>{(block, _index) => {
971
+ const index = _index();
972
+ return <Block_default
973
+ key={block.id}
974
+ block={block}
975
+ context={props.context || builderContext}
976
+ registeredComponents={props.registeredComponents || componentsContext.registeredComponents}
977
+ />;
978
+ }}</For3></Show6></Blocks_wrapper_default>;
1004
979
  }
1005
980
  var Blocks_default = Blocks;
1006
981
 
@@ -2963,7 +2938,7 @@ var getInteractionPropertiesForEvent = (event) => {
2963
2938
  };
2964
2939
 
2965
2940
  // src/constants/sdk-version.ts
2966
- var SDK_VERSION = "0.11.2";
2941
+ var SDK_VERSION = "0.11.4";
2967
2942
 
2968
2943
  // src/functions/register.ts
2969
2944
  var registry = {};
@@ -3099,6 +3074,7 @@ var setupBrowserForEditing = (options = {}) => {
3099
3074
  // src/components/content/components/enable-editor.tsx
3100
3075
  function EnableEditor(props) {
3101
3076
  const [forceReRenderCount, setForceReRenderCount] = createSignal10(0);
3077
+ const [firstRender, setFirstRender] = createSignal10(true);
3102
3078
  const [lastUpdated, setLastUpdated] = createSignal10(0);
3103
3079
  const [shouldSendResetCookie, setShouldSendResetCookie] = createSignal10(false);
3104
3080
  const [ContentWrapper, setContentWrapper] = createSignal10(
@@ -3106,6 +3082,20 @@ function EnableEditor(props) {
3106
3082
  );
3107
3083
  const [httpReqsData, setHttpReqsData] = createSignal10({});
3108
3084
  const [clicked, setClicked] = createSignal10(false);
3085
+ function mergeNewRootState(newData) {
3086
+ const combinedState = {
3087
+ ...props.builderContextSignal.rootState,
3088
+ ...newData
3089
+ };
3090
+ if (props.builderContextSignal.rootSetState) {
3091
+ props.builderContextSignal.rootSetState?.(combinedState);
3092
+ } else {
3093
+ props.setBuilderContextSignal((PREVIOUS_VALUE) => ({
3094
+ ...PREVIOUS_VALUE,
3095
+ rootState: combinedState
3096
+ }));
3097
+ }
3098
+ }
3109
3099
  function mergeNewContent(newContent) {
3110
3100
  const newContentValue = {
3111
3101
  ...props.builderContextSignal.content,
@@ -3348,6 +3338,20 @@ function EnableEditor(props) {
3348
3338
  emitStateUpdate();
3349
3339
  }
3350
3340
  createEffect2(on2(() => [props.builderContextSignal.rootState], onUpdateFn_4));
3341
+ function onUpdateFn_5() {
3342
+ if (props.data) {
3343
+ mergeNewRootState(props.data);
3344
+ }
3345
+ }
3346
+ createEffect2(on2(() => [props.data], onUpdateFn_5));
3347
+ function onUpdateFn_6() {
3348
+ if (props.locale) {
3349
+ mergeNewRootState({
3350
+ locale: props.locale
3351
+ });
3352
+ }
3353
+ }
3354
+ createEffect2(on2(() => [props.locale], onUpdateFn_6));
3351
3355
  return <builder_context_default.Provider value={props.builderContextSignal}><Show10 when={props.builderContextSignal.content}><Dynamic5
3352
3356
  class={`variant-${props.content?.testVariationId || props.content?.id}`}
3353
3357
  {...{}}
@@ -3456,7 +3460,7 @@ ${getFontCss({
3456
3460
  var Styles_default = ContentStyles;
3457
3461
 
3458
3462
  // src/components/content/content.helpers.ts
3459
- var getContextStateInitialValue = ({
3463
+ var getRootStateInitialValue = ({
3460
3464
  content,
3461
3465
  data,
3462
3466
  locale
@@ -3528,7 +3532,7 @@ function ContentComponent(props) {
3528
3532
  data: props.data
3529
3533
  }),
3530
3534
  localState: void 0,
3531
- rootState: getContextStateInitialValue({
3535
+ rootState: getRootStateInitialValue({
3532
3536
  content: props.content,
3533
3537
  data: props.data,
3534
3538
  locale: props.locale
@@ -3569,6 +3573,7 @@ function ContentComponent(props) {
3569
3573
  }}
3570
3574
  ><Enable_editor_default
3571
3575
  content={props.content}
3576
+ data={props.data}
3572
3577
  model={props.model}
3573
3578
  context={props.context}
3574
3579
  apiKey={props.apiKey}
@@ -780,7 +780,7 @@ function ComponentRef(props) {
780
780
  return Wrapper();
781
781
  },
782
782
  get children() {
783
- return [createComponent(For, {
783
+ return createComponent(For, {
784
784
  get each() {
785
785
  return props.blockChildren;
786
786
  },
@@ -788,7 +788,7 @@ function ComponentRef(props) {
788
788
  _index();
789
789
  return createComponent(block_default, {
790
790
  get key() {
791
- return "block-" + child.id;
791
+ return child.id;
792
792
  },
793
793
  block: child,
794
794
  get context() {
@@ -799,23 +799,7 @@ function ComponentRef(props) {
799
799
  }
800
800
  });
801
801
  }
802
- }), createComponent(For, {
803
- get each() {
804
- return props.blockChildren;
805
- },
806
- children: (child, _index) => {
807
- _index();
808
- return createComponent(block_styles_default, {
809
- get key() {
810
- return "block-style-" + child.id;
811
- },
812
- block: child,
813
- get context() {
814
- return props.context;
815
- }
816
- });
817
- }
818
- })];
802
+ });
819
803
  }
820
804
  }));
821
805
  }
@@ -911,7 +895,14 @@ function Block(props) {
911
895
  return canShowBlock();
912
896
  },
913
897
  get children() {
914
- return createComponent(Show, {
898
+ return [createComponent(block_styles_default, {
899
+ get block() {
900
+ return props.block;
901
+ },
902
+ get context() {
903
+ return props.context;
904
+ }
905
+ }), createComponent(Show, {
915
906
  get fallback() {
916
907
  return createComponent(component_ref_default, {
917
908
  get componentRef() {
@@ -1038,7 +1029,7 @@ function Block(props) {
1038
1029
  _index();
1039
1030
  return createComponent(Block, {
1040
1031
  get key() {
1041
- return "block-" + child.id;
1032
+ return child.id;
1042
1033
  },
1043
1034
  block: child,
1044
1035
  get context() {
@@ -1049,29 +1040,13 @@ function Block(props) {
1049
1040
  }
1050
1041
  });
1051
1042
  }
1052
- }), createComponent(For, {
1053
- get each() {
1054
- return childrenWithoutParentComponent();
1055
- },
1056
- children: (child, _index) => {
1057
- _index();
1058
- return createComponent(block_styles_default, {
1059
- get key() {
1060
- return "block-style-" + child.id;
1061
- },
1062
- block: child,
1063
- get context() {
1064
- return childrenContext();
1065
- }
1066
- });
1067
- }
1068
1043
  })];
1069
1044
  }
1070
1045
  });
1071
1046
  }
1072
1047
  })];
1073
1048
  }
1074
- });
1049
+ })];
1075
1050
  }
1076
1051
  });
1077
1052
  }
@@ -1158,7 +1133,7 @@ function Blocks(props) {
1158
1133
  return props.context?.BlocksWrapperProps;
1159
1134
  },
1160
1135
  get children() {
1161
- return [createComponent(Show, {
1136
+ return createComponent(Show, {
1162
1137
  get when() {
1163
1138
  return props.blocks;
1164
1139
  },
@@ -1171,7 +1146,7 @@ function Blocks(props) {
1171
1146
  _index();
1172
1147
  return createComponent(block_default, {
1173
1148
  get key() {
1174
- return "render-block-" + block.id;
1149
+ return block.id;
1175
1150
  },
1176
1151
  block,
1177
1152
  get context() {
@@ -1184,30 +1159,7 @@ function Blocks(props) {
1184
1159
  }
1185
1160
  });
1186
1161
  }
1187
- }), createComponent(Show, {
1188
- get when() {
1189
- return props.blocks;
1190
- },
1191
- get children() {
1192
- return createComponent(For, {
1193
- get each() {
1194
- return props.blocks;
1195
- },
1196
- children: (block, _index) => {
1197
- _index();
1198
- return createComponent(block_styles_default, {
1199
- get key() {
1200
- return "block-style-" + block.id;
1201
- },
1202
- block,
1203
- get context() {
1204
- return props.context || builderContext;
1205
- }
1206
- });
1207
- }
1208
- });
1209
- }
1210
- })];
1162
+ });
1211
1163
  }
1212
1164
  });
1213
1165
  }
@@ -3284,7 +3236,7 @@ var getInteractionPropertiesForEvent = (event) => {
3284
3236
  };
3285
3237
 
3286
3238
  // src/constants/sdk-version.ts
3287
- var SDK_VERSION = "0.11.2";
3239
+ var SDK_VERSION = "0.11.4";
3288
3240
 
3289
3241
  // src/functions/register.ts
3290
3242
  var registry = {};
@@ -3419,11 +3371,26 @@ var setupBrowserForEditing = (options = {}) => {
3419
3371
  // src/components/content/components/enable-editor.tsx
3420
3372
  function EnableEditor(props) {
3421
3373
  const [forceReRenderCount, setForceReRenderCount] = createSignal(0);
3374
+ createSignal(true);
3422
3375
  createSignal(0);
3423
3376
  const [shouldSendResetCookie, setShouldSendResetCookie] = createSignal(false);
3424
3377
  const [ContentWrapper, setContentWrapper] = createSignal(props.contentWrapper || "div");
3425
3378
  const [httpReqsData, setHttpReqsData] = createSignal({});
3426
3379
  const [clicked, setClicked] = createSignal(false);
3380
+ function mergeNewRootState(newData) {
3381
+ const combinedState = {
3382
+ ...props.builderContextSignal.rootState,
3383
+ ...newData
3384
+ };
3385
+ if (props.builderContextSignal.rootSetState) {
3386
+ props.builderContextSignal.rootSetState?.(combinedState);
3387
+ } else {
3388
+ props.setBuilderContextSignal((PREVIOUS_VALUE) => ({
3389
+ ...PREVIOUS_VALUE,
3390
+ rootState: combinedState
3391
+ }));
3392
+ }
3393
+ }
3427
3394
  function mergeNewContent(newContent) {
3428
3395
  const newContentValue = {
3429
3396
  ...props.builderContextSignal.content,
@@ -3643,6 +3610,20 @@ function EnableEditor(props) {
3643
3610
  emitStateUpdate();
3644
3611
  }
3645
3612
  createEffect(on(() => [props.builderContextSignal.rootState], onUpdateFn_4));
3613
+ function onUpdateFn_5() {
3614
+ if (props.data) {
3615
+ mergeNewRootState(props.data);
3616
+ }
3617
+ }
3618
+ createEffect(on(() => [props.data], onUpdateFn_5));
3619
+ function onUpdateFn_6() {
3620
+ if (props.locale) {
3621
+ mergeNewRootState({
3622
+ locale: props.locale
3623
+ });
3624
+ }
3625
+ }
3626
+ createEffect(on(() => [props.locale], onUpdateFn_6));
3646
3627
  return createComponent(builder_context_default.Provider, {
3647
3628
  get value() {
3648
3629
  return props.builderContextSignal;
@@ -3778,7 +3759,7 @@ ${getFontCss({
3778
3759
  var styles_default = ContentStyles;
3779
3760
 
3780
3761
  // src/components/content/content.helpers.ts
3781
- var getContextStateInitialValue = ({
3762
+ var getRootStateInitialValue = ({
3782
3763
  content,
3783
3764
  data,
3784
3765
  locale
@@ -3846,7 +3827,7 @@ function ContentComponent(props) {
3846
3827
  data: props.data
3847
3828
  }),
3848
3829
  localState: void 0,
3849
- rootState: getContextStateInitialValue({
3830
+ rootState: getRootStateInitialValue({
3850
3831
  content: props.content,
3851
3832
  data: props.data,
3852
3833
  locale: props.locale
@@ -3892,6 +3873,9 @@ function ContentComponent(props) {
3892
3873
  get content() {
3893
3874
  return props.content;
3894
3875
  },
3876
+ get data() {
3877
+ return props.data;
3878
+ },
3895
3879
  get model() {
3896
3880
  return props.model;
3897
3881
  },