@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.
@@ -3906,25 +3906,15 @@ function ComponentRef(props) {
3906
3906
  contextValue: props.context
3907
3907
  })}
3908
3908
  component={Wrapper()}
3909
- >
3910
- <For each={props.blockChildren}>{(child, _index) => {
3911
- const index = _index();
3912
- return <Block_default
3913
- key={"block-" + child.id}
3914
- block={child}
3915
- context={props.context}
3916
- registeredComponents={props.registeredComponents}
3917
- />;
3918
- }}</For>
3919
- <For each={props.blockChildren}>{(child, _index) => {
3920
- const index = _index();
3921
- return <Block_styles_default
3922
- key={"block-style-" + child.id}
3923
- block={child}
3924
- context={props.context}
3925
- />;
3926
- }}</For>
3927
- </Dynamic3></Show4>;
3909
+ ><For each={props.blockChildren}>{(child, _index) => {
3910
+ const index = _index();
3911
+ return <Block_default
3912
+ key={child.id}
3913
+ block={child}
3914
+ context={props.context}
3915
+ registeredComponents={props.registeredComponents}
3916
+ />;
3917
+ }}</For></Dynamic3></Show4>;
3928
3918
  }
3929
3919
  var Component_ref_default = ComponentRef;
3930
3920
 
@@ -4001,41 +3991,10 @@ function Block(props) {
4001
3991
  isInteractive: !blockComponent()?.isRSC
4002
3992
  };
4003
3993
  }
4004
- return <Show5 when={canShowBlock()}><Show5
4005
- fallback={<Component_ref_default
4006
- componentRef={componentRefProps().componentRef}
4007
- componentOptions={componentRefProps().componentOptions}
4008
- blockChildren={componentRefProps().blockChildren}
4009
- context={componentRefProps().context}
4010
- registeredComponents={componentRefProps().registeredComponents}
4011
- builderBlock={componentRefProps().builderBlock}
4012
- includeBlockProps={componentRefProps().includeBlockProps}
4013
- isInteractive={componentRefProps().isInteractive}
4014
- />}
4015
- when={!blockComponent()?.noWrap}
4016
- >
4017
- <Show5 when={isEmptyHtmlElement(Tag())}><Block_wrapper_default
4018
- Wrapper={Tag()}
4019
- block={processedBlock()}
4020
- context={props.context}
4021
- hasChildren={false}
4022
- /></Show5>
4023
- <Show5 when={!isEmptyHtmlElement(Tag()) && repeatItem()}><For2 each={repeatItem()}>{(data, _index) => {
4024
- const index = _index();
4025
- return <Repeated_block_default
4026
- key={index}
4027
- repeatContext={data.context}
4028
- block={data.block}
4029
- registeredComponents={props.registeredComponents}
4030
- />;
4031
- }}</For2></Show5>
4032
- <Show5 when={!isEmptyHtmlElement(Tag()) && !repeatItem()}><Block_wrapper_default
4033
- Wrapper={Tag()}
4034
- block={processedBlock()}
4035
- context={props.context}
4036
- hasChildren={true}
4037
- >
4038
- <Component_ref_default
3994
+ return <Show5 when={canShowBlock()}>
3995
+ <Block_styles_default block={props.block} context={props.context} />
3996
+ <Show5
3997
+ fallback={<Component_ref_default
4039
3998
  componentRef={componentRefProps().componentRef}
4040
3999
  componentOptions={componentRefProps().componentOptions}
4041
4000
  blockChildren={componentRefProps().blockChildren}
@@ -4044,26 +4003,52 @@ function Block(props) {
4044
4003
  builderBlock={componentRefProps().builderBlock}
4045
4004
  includeBlockProps={componentRefProps().includeBlockProps}
4046
4005
  isInteractive={componentRefProps().isInteractive}
4047
- />
4048
- <For2 each={childrenWithoutParentComponent()}>{(child, _index) => {
4006
+ />}
4007
+ when={!blockComponent()?.noWrap}
4008
+ >
4009
+ <Show5 when={isEmptyHtmlElement(Tag())}><Block_wrapper_default
4010
+ Wrapper={Tag()}
4011
+ block={processedBlock()}
4012
+ context={props.context}
4013
+ hasChildren={false}
4014
+ /></Show5>
4015
+ <Show5 when={!isEmptyHtmlElement(Tag()) && repeatItem()}><For2 each={repeatItem()}>{(data, _index) => {
4049
4016
  const index = _index();
4050
- return <Block
4051
- key={"block-" + child.id}
4052
- block={child}
4053
- context={childrenContext()}
4017
+ return <Repeated_block_default
4018
+ key={index}
4019
+ repeatContext={data.context}
4020
+ block={data.block}
4054
4021
  registeredComponents={props.registeredComponents}
4055
4022
  />;
4056
- }}</For2>
4057
- <For2 each={childrenWithoutParentComponent()}>{(child, _index) => {
4058
- const index = _index();
4059
- return <Block_styles_default
4060
- key={"block-style-" + child.id}
4061
- block={child}
4062
- context={childrenContext()}
4063
- />;
4064
- }}</For2>
4065
- </Block_wrapper_default></Show5>
4066
- </Show5></Show5>;
4023
+ }}</For2></Show5>
4024
+ <Show5 when={!isEmptyHtmlElement(Tag()) && !repeatItem()}><Block_wrapper_default
4025
+ Wrapper={Tag()}
4026
+ block={processedBlock()}
4027
+ context={props.context}
4028
+ hasChildren={true}
4029
+ >
4030
+ <Component_ref_default
4031
+ componentRef={componentRefProps().componentRef}
4032
+ componentOptions={componentRefProps().componentOptions}
4033
+ blockChildren={componentRefProps().blockChildren}
4034
+ context={componentRefProps().context}
4035
+ registeredComponents={componentRefProps().registeredComponents}
4036
+ builderBlock={componentRefProps().builderBlock}
4037
+ includeBlockProps={componentRefProps().includeBlockProps}
4038
+ isInteractive={componentRefProps().isInteractive}
4039
+ />
4040
+ <For2 each={childrenWithoutParentComponent()}>{(child, _index) => {
4041
+ const index = _index();
4042
+ return <Block
4043
+ key={child.id}
4044
+ block={child}
4045
+ context={childrenContext()}
4046
+ registeredComponents={props.registeredComponents}
4047
+ />;
4048
+ }}</For2>
4049
+ </Block_wrapper_default></Show5>
4050
+ </Show5>
4051
+ </Show5>;
4067
4052
  }
4068
4053
  var Block_default = Block;
4069
4054
 
@@ -4132,25 +4117,15 @@ function Blocks(props) {
4132
4117
  styleProp={props.styleProp}
4133
4118
  BlocksWrapper={props.context?.BlocksWrapper}
4134
4119
  BlocksWrapperProps={props.context?.BlocksWrapperProps}
4135
- >
4136
- <Show6 when={props.blocks}><For3 each={props.blocks}>{(block, _index) => {
4137
- const index = _index();
4138
- return <Block_default
4139
- key={"render-block-" + block.id}
4140
- block={block}
4141
- context={props.context || builderContext}
4142
- registeredComponents={props.registeredComponents || componentsContext.registeredComponents}
4143
- />;
4144
- }}</For3></Show6>
4145
- <Show6 when={props.blocks}><For3 each={props.blocks}>{(block, _index) => {
4146
- const index = _index();
4147
- return <Block_styles_default
4148
- key={"block-style-" + block.id}
4149
- block={block}
4150
- context={props.context || builderContext}
4151
- />;
4152
- }}</For3></Show6>
4153
- </Blocks_wrapper_default>;
4120
+ ><Show6 when={props.blocks}><For3 each={props.blocks}>{(block, _index) => {
4121
+ const index = _index();
4122
+ return <Block_default
4123
+ key={block.id}
4124
+ block={block}
4125
+ context={props.context || builderContext}
4126
+ registeredComponents={props.registeredComponents || componentsContext.registeredComponents}
4127
+ />;
4128
+ }}</For3></Show6></Blocks_wrapper_default>;
4154
4129
  }
4155
4130
  var Blocks_default = Blocks;
4156
4131
 
@@ -6104,7 +6079,7 @@ var getInteractionPropertiesForEvent = (event) => {
6104
6079
  };
6105
6080
 
6106
6081
  // src/constants/sdk-version.ts
6107
- var SDK_VERSION = "0.11.2";
6082
+ var SDK_VERSION = "0.11.4";
6108
6083
 
6109
6084
  // src/functions/register.ts
6110
6085
  var registry = {};
@@ -6239,6 +6214,7 @@ var setupBrowserForEditing = (options = {}) => {
6239
6214
  // src/components/content/components/enable-editor.tsx
6240
6215
  function EnableEditor(props) {
6241
6216
  const [forceReRenderCount, setForceReRenderCount] = createSignal10(0);
6217
+ const [firstRender, setFirstRender] = createSignal10(true);
6242
6218
  const [lastUpdated, setLastUpdated] = createSignal10(0);
6243
6219
  const [shouldSendResetCookie, setShouldSendResetCookie] = createSignal10(false);
6244
6220
  const [ContentWrapper, setContentWrapper] = createSignal10(
@@ -6246,6 +6222,20 @@ function EnableEditor(props) {
6246
6222
  );
6247
6223
  const [httpReqsData, setHttpReqsData] = createSignal10({});
6248
6224
  const [clicked, setClicked] = createSignal10(false);
6225
+ function mergeNewRootState(newData) {
6226
+ const combinedState = {
6227
+ ...props.builderContextSignal.rootState,
6228
+ ...newData
6229
+ };
6230
+ if (props.builderContextSignal.rootSetState) {
6231
+ props.builderContextSignal.rootSetState?.(combinedState);
6232
+ } else {
6233
+ props.setBuilderContextSignal((PREVIOUS_VALUE) => ({
6234
+ ...PREVIOUS_VALUE,
6235
+ rootState: combinedState
6236
+ }));
6237
+ }
6238
+ }
6249
6239
  function mergeNewContent(newContent) {
6250
6240
  const newContentValue = {
6251
6241
  ...props.builderContextSignal.content,
@@ -6487,6 +6477,20 @@ function EnableEditor(props) {
6487
6477
  emitStateUpdate();
6488
6478
  }
6489
6479
  createEffect2(on2(() => [props.builderContextSignal.rootState], onUpdateFn_4));
6480
+ function onUpdateFn_5() {
6481
+ if (props.data) {
6482
+ mergeNewRootState(props.data);
6483
+ }
6484
+ }
6485
+ createEffect2(on2(() => [props.data], onUpdateFn_5));
6486
+ function onUpdateFn_6() {
6487
+ if (props.locale) {
6488
+ mergeNewRootState({
6489
+ locale: props.locale
6490
+ });
6491
+ }
6492
+ }
6493
+ createEffect2(on2(() => [props.locale], onUpdateFn_6));
6490
6494
  return <builder_context_default.Provider value={props.builderContextSignal}><Show10 when={props.builderContextSignal.content}><Dynamic5
6491
6495
  class={`variant-${props.content?.testVariationId || props.content?.id}`}
6492
6496
  {...{}}
@@ -6595,7 +6599,7 @@ ${getFontCss({
6595
6599
  var Styles_default = ContentStyles;
6596
6600
 
6597
6601
  // src/components/content/content.helpers.ts
6598
- var getContextStateInitialValue = ({
6602
+ var getRootStateInitialValue = ({
6599
6603
  content,
6600
6604
  data,
6601
6605
  locale
@@ -6667,7 +6671,7 @@ function ContentComponent(props) {
6667
6671
  data: props.data
6668
6672
  }),
6669
6673
  localState: void 0,
6670
- rootState: getContextStateInitialValue({
6674
+ rootState: getRootStateInitialValue({
6671
6675
  content: props.content,
6672
6676
  data: props.data,
6673
6677
  locale: props.locale
@@ -6708,6 +6712,7 @@ function ContentComponent(props) {
6708
6712
  }}
6709
6713
  ><Enable_editor_default
6710
6714
  content={props.content}
6715
+ data={props.data}
6711
6716
  model={props.model}
6712
6717
  context={props.context}
6713
6718
  apiKey={props.apiKey}
package/lib/node/dev.js CHANGED
@@ -909,7 +909,7 @@ function ComponentRef(props) {
909
909
  return Wrapper();
910
910
  },
911
911
  get children() {
912
- return [createComponent(For, {
912
+ return createComponent(For, {
913
913
  get each() {
914
914
  return props.blockChildren;
915
915
  },
@@ -917,7 +917,7 @@ function ComponentRef(props) {
917
917
  _index();
918
918
  return createComponent(block_default, {
919
919
  get key() {
920
- return "block-" + child.id;
920
+ return child.id;
921
921
  },
922
922
  block: child,
923
923
  get context() {
@@ -928,23 +928,7 @@ function ComponentRef(props) {
928
928
  }
929
929
  });
930
930
  }
931
- }), createComponent(For, {
932
- get each() {
933
- return props.blockChildren;
934
- },
935
- children: (child, _index) => {
936
- _index();
937
- return createComponent(block_styles_default, {
938
- get key() {
939
- return "block-style-" + child.id;
940
- },
941
- block: child,
942
- get context() {
943
- return props.context;
944
- }
945
- });
946
- }
947
- })];
931
+ });
948
932
  }
949
933
  }));
950
934
  }
@@ -1040,7 +1024,14 @@ function Block(props) {
1040
1024
  return canShowBlock();
1041
1025
  },
1042
1026
  get children() {
1043
- return createComponent(Show, {
1027
+ return [createComponent(block_styles_default, {
1028
+ get block() {
1029
+ return props.block;
1030
+ },
1031
+ get context() {
1032
+ return props.context;
1033
+ }
1034
+ }), createComponent(Show, {
1044
1035
  get fallback() {
1045
1036
  return createComponent(component_ref_default, {
1046
1037
  get componentRef() {
@@ -1167,7 +1158,7 @@ function Block(props) {
1167
1158
  _index();
1168
1159
  return createComponent(Block, {
1169
1160
  get key() {
1170
- return "block-" + child.id;
1161
+ return child.id;
1171
1162
  },
1172
1163
  block: child,
1173
1164
  get context() {
@@ -1178,29 +1169,13 @@ function Block(props) {
1178
1169
  }
1179
1170
  });
1180
1171
  }
1181
- }), createComponent(For, {
1182
- get each() {
1183
- return childrenWithoutParentComponent();
1184
- },
1185
- children: (child, _index) => {
1186
- _index();
1187
- return createComponent(block_styles_default, {
1188
- get key() {
1189
- return "block-style-" + child.id;
1190
- },
1191
- block: child,
1192
- get context() {
1193
- return childrenContext();
1194
- }
1195
- });
1196
- }
1197
1172
  })];
1198
1173
  }
1199
1174
  });
1200
1175
  }
1201
1176
  })];
1202
1177
  }
1203
- });
1178
+ })];
1204
1179
  }
1205
1180
  });
1206
1181
  }
@@ -1287,7 +1262,7 @@ function Blocks(props) {
1287
1262
  return props.context?.BlocksWrapperProps;
1288
1263
  },
1289
1264
  get children() {
1290
- return [createComponent(Show, {
1265
+ return createComponent(Show, {
1291
1266
  get when() {
1292
1267
  return props.blocks;
1293
1268
  },
@@ -1300,7 +1275,7 @@ function Blocks(props) {
1300
1275
  _index();
1301
1276
  return createComponent(block_default, {
1302
1277
  get key() {
1303
- return "render-block-" + block.id;
1278
+ return block.id;
1304
1279
  },
1305
1280
  block,
1306
1281
  get context() {
@@ -1313,30 +1288,7 @@ function Blocks(props) {
1313
1288
  }
1314
1289
  });
1315
1290
  }
1316
- }), createComponent(Show, {
1317
- get when() {
1318
- return props.blocks;
1319
- },
1320
- get children() {
1321
- return createComponent(For, {
1322
- get each() {
1323
- return props.blocks;
1324
- },
1325
- children: (block, _index) => {
1326
- _index();
1327
- return createComponent(block_styles_default, {
1328
- get key() {
1329
- return "block-style-" + block.id;
1330
- },
1331
- block,
1332
- get context() {
1333
- return props.context || builderContext;
1334
- }
1335
- });
1336
- }
1337
- });
1338
- }
1339
- })];
1291
+ });
1340
1292
  }
1341
1293
  });
1342
1294
  }
@@ -3422,7 +3374,7 @@ var getInteractionPropertiesForEvent = (event) => {
3422
3374
  };
3423
3375
 
3424
3376
  // src/constants/sdk-version.ts
3425
- var SDK_VERSION = "0.11.2";
3377
+ var SDK_VERSION = "0.11.4";
3426
3378
 
3427
3379
  // src/functions/register.ts
3428
3380
  var registry = {};
@@ -3558,11 +3510,26 @@ var setupBrowserForEditing = (options = {}) => {
3558
3510
  // src/components/content/components/enable-editor.tsx
3559
3511
  function EnableEditor(props) {
3560
3512
  const [forceReRenderCount, setForceReRenderCount] = createSignal(0);
3513
+ createSignal(true);
3561
3514
  createSignal(0);
3562
3515
  const [shouldSendResetCookie, setShouldSendResetCookie] = createSignal(false);
3563
3516
  const [ContentWrapper, setContentWrapper] = createSignal(props.contentWrapper || "div");
3564
3517
  const [httpReqsData, setHttpReqsData] = createSignal({});
3565
3518
  const [clicked, setClicked] = createSignal(false);
3519
+ function mergeNewRootState(newData) {
3520
+ const combinedState = {
3521
+ ...props.builderContextSignal.rootState,
3522
+ ...newData
3523
+ };
3524
+ if (props.builderContextSignal.rootSetState) {
3525
+ props.builderContextSignal.rootSetState?.(combinedState);
3526
+ } else {
3527
+ props.setBuilderContextSignal((PREVIOUS_VALUE) => ({
3528
+ ...PREVIOUS_VALUE,
3529
+ rootState: combinedState
3530
+ }));
3531
+ }
3532
+ }
3566
3533
  function mergeNewContent(newContent) {
3567
3534
  const newContentValue = {
3568
3535
  ...props.builderContextSignal.content,
@@ -3783,6 +3750,20 @@ function EnableEditor(props) {
3783
3750
  emitStateUpdate();
3784
3751
  }
3785
3752
  createEffect(on(() => [props.builderContextSignal.rootState], onUpdateFn_4));
3753
+ function onUpdateFn_5() {
3754
+ if (props.data) {
3755
+ mergeNewRootState(props.data);
3756
+ }
3757
+ }
3758
+ createEffect(on(() => [props.data], onUpdateFn_5));
3759
+ function onUpdateFn_6() {
3760
+ if (props.locale) {
3761
+ mergeNewRootState({
3762
+ locale: props.locale
3763
+ });
3764
+ }
3765
+ }
3766
+ createEffect(on(() => [props.locale], onUpdateFn_6));
3786
3767
  return createComponent(builder_context_default.Provider, {
3787
3768
  get value() {
3788
3769
  return props.builderContextSignal;
@@ -3918,7 +3899,7 @@ ${getFontCss({
3918
3899
  var styles_default = ContentStyles;
3919
3900
 
3920
3901
  // src/components/content/content.helpers.ts
3921
- var getContextStateInitialValue = ({
3902
+ var getRootStateInitialValue = ({
3922
3903
  content,
3923
3904
  data,
3924
3905
  locale
@@ -3986,7 +3967,7 @@ function ContentComponent(props) {
3986
3967
  data: props.data
3987
3968
  }),
3988
3969
  localState: void 0,
3989
- rootState: getContextStateInitialValue({
3970
+ rootState: getRootStateInitialValue({
3990
3971
  content: props.content,
3991
3972
  data: props.data,
3992
3973
  locale: props.locale
@@ -4032,6 +4013,9 @@ function ContentComponent(props) {
4032
4013
  get content() {
4033
4014
  return props.content;
4034
4015
  },
4016
+ get data() {
4017
+ return props.data;
4018
+ },
4035
4019
  get model() {
4036
4020
  return props.model;
4037
4021
  },