@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.
package/lib/node/dev.jsx CHANGED
@@ -882,25 +882,15 @@ function ComponentRef(props) {
882
882
  contextValue: props.context
883
883
  })}
884
884
  component={Wrapper()}
885
- >
886
- <For each={props.blockChildren}>{(child, _index) => {
887
- const index = _index();
888
- return <Block_default
889
- key={"block-" + child.id}
890
- block={child}
891
- context={props.context}
892
- registeredComponents={props.registeredComponents}
893
- />;
894
- }}</For>
895
- <For each={props.blockChildren}>{(child, _index) => {
896
- const index = _index();
897
- return <Block_styles_default
898
- key={"block-style-" + child.id}
899
- block={child}
900
- context={props.context}
901
- />;
902
- }}</For>
903
- </Dynamic3></Show4>;
885
+ ><For each={props.blockChildren}>{(child, _index) => {
886
+ const index = _index();
887
+ return <Block_default
888
+ key={child.id}
889
+ block={child}
890
+ context={props.context}
891
+ registeredComponents={props.registeredComponents}
892
+ />;
893
+ }}</For></Dynamic3></Show4>;
904
894
  }
905
895
  var Component_ref_default = ComponentRef;
906
896
 
@@ -977,41 +967,10 @@ function Block(props) {
977
967
  isInteractive: !blockComponent()?.isRSC
978
968
  };
979
969
  }
980
- return <Show5 when={canShowBlock()}><Show5
981
- fallback={<Component_ref_default
982
- componentRef={componentRefProps().componentRef}
983
- componentOptions={componentRefProps().componentOptions}
984
- blockChildren={componentRefProps().blockChildren}
985
- context={componentRefProps().context}
986
- registeredComponents={componentRefProps().registeredComponents}
987
- builderBlock={componentRefProps().builderBlock}
988
- includeBlockProps={componentRefProps().includeBlockProps}
989
- isInteractive={componentRefProps().isInteractive}
990
- />}
991
- when={!blockComponent()?.noWrap}
992
- >
993
- <Show5 when={isEmptyHtmlElement(Tag())}><Block_wrapper_default
994
- Wrapper={Tag()}
995
- block={processedBlock()}
996
- context={props.context}
997
- hasChildren={false}
998
- /></Show5>
999
- <Show5 when={!isEmptyHtmlElement(Tag()) && repeatItem()}><For2 each={repeatItem()}>{(data, _index) => {
1000
- const index = _index();
1001
- return <Repeated_block_default
1002
- key={index}
1003
- repeatContext={data.context}
1004
- block={data.block}
1005
- registeredComponents={props.registeredComponents}
1006
- />;
1007
- }}</For2></Show5>
1008
- <Show5 when={!isEmptyHtmlElement(Tag()) && !repeatItem()}><Block_wrapper_default
1009
- Wrapper={Tag()}
1010
- block={processedBlock()}
1011
- context={props.context}
1012
- hasChildren={true}
1013
- >
1014
- <Component_ref_default
970
+ return <Show5 when={canShowBlock()}>
971
+ <Block_styles_default block={props.block} context={props.context} />
972
+ <Show5
973
+ fallback={<Component_ref_default
1015
974
  componentRef={componentRefProps().componentRef}
1016
975
  componentOptions={componentRefProps().componentOptions}
1017
976
  blockChildren={componentRefProps().blockChildren}
@@ -1020,26 +979,52 @@ function Block(props) {
1020
979
  builderBlock={componentRefProps().builderBlock}
1021
980
  includeBlockProps={componentRefProps().includeBlockProps}
1022
981
  isInteractive={componentRefProps().isInteractive}
1023
- />
1024
- <For2 each={childrenWithoutParentComponent()}>{(child, _index) => {
982
+ />}
983
+ when={!blockComponent()?.noWrap}
984
+ >
985
+ <Show5 when={isEmptyHtmlElement(Tag())}><Block_wrapper_default
986
+ Wrapper={Tag()}
987
+ block={processedBlock()}
988
+ context={props.context}
989
+ hasChildren={false}
990
+ /></Show5>
991
+ <Show5 when={!isEmptyHtmlElement(Tag()) && repeatItem()}><For2 each={repeatItem()}>{(data, _index) => {
1025
992
  const index = _index();
1026
- return <Block
1027
- key={"block-" + child.id}
1028
- block={child}
1029
- context={childrenContext()}
993
+ return <Repeated_block_default
994
+ key={index}
995
+ repeatContext={data.context}
996
+ block={data.block}
1030
997
  registeredComponents={props.registeredComponents}
1031
998
  />;
1032
- }}</For2>
1033
- <For2 each={childrenWithoutParentComponent()}>{(child, _index) => {
1034
- const index = _index();
1035
- return <Block_styles_default
1036
- key={"block-style-" + child.id}
1037
- block={child}
1038
- context={childrenContext()}
1039
- />;
1040
- }}</For2>
1041
- </Block_wrapper_default></Show5>
1042
- </Show5></Show5>;
999
+ }}</For2></Show5>
1000
+ <Show5 when={!isEmptyHtmlElement(Tag()) && !repeatItem()}><Block_wrapper_default
1001
+ Wrapper={Tag()}
1002
+ block={processedBlock()}
1003
+ context={props.context}
1004
+ hasChildren={true}
1005
+ >
1006
+ <Component_ref_default
1007
+ componentRef={componentRefProps().componentRef}
1008
+ componentOptions={componentRefProps().componentOptions}
1009
+ blockChildren={componentRefProps().blockChildren}
1010
+ context={componentRefProps().context}
1011
+ registeredComponents={componentRefProps().registeredComponents}
1012
+ builderBlock={componentRefProps().builderBlock}
1013
+ includeBlockProps={componentRefProps().includeBlockProps}
1014
+ isInteractive={componentRefProps().isInteractive}
1015
+ />
1016
+ <For2 each={childrenWithoutParentComponent()}>{(child, _index) => {
1017
+ const index = _index();
1018
+ return <Block
1019
+ key={child.id}
1020
+ block={child}
1021
+ context={childrenContext()}
1022
+ registeredComponents={props.registeredComponents}
1023
+ />;
1024
+ }}</For2>
1025
+ </Block_wrapper_default></Show5>
1026
+ </Show5>
1027
+ </Show5>;
1043
1028
  }
1044
1029
  var Block_default = Block;
1045
1030
 
@@ -1108,25 +1093,15 @@ function Blocks(props) {
1108
1093
  styleProp={props.styleProp}
1109
1094
  BlocksWrapper={props.context?.BlocksWrapper}
1110
1095
  BlocksWrapperProps={props.context?.BlocksWrapperProps}
1111
- >
1112
- <Show6 when={props.blocks}><For3 each={props.blocks}>{(block, _index) => {
1113
- const index = _index();
1114
- return <Block_default
1115
- key={"render-block-" + block.id}
1116
- block={block}
1117
- context={props.context || builderContext}
1118
- registeredComponents={props.registeredComponents || componentsContext.registeredComponents}
1119
- />;
1120
- }}</For3></Show6>
1121
- <Show6 when={props.blocks}><For3 each={props.blocks}>{(block, _index) => {
1122
- const index = _index();
1123
- return <Block_styles_default
1124
- key={"block-style-" + block.id}
1125
- block={block}
1126
- context={props.context || builderContext}
1127
- />;
1128
- }}</For3></Show6>
1129
- </Blocks_wrapper_default>;
1096
+ ><Show6 when={props.blocks}><For3 each={props.blocks}>{(block, _index) => {
1097
+ const index = _index();
1098
+ return <Block_default
1099
+ key={block.id}
1100
+ block={block}
1101
+ context={props.context || builderContext}
1102
+ registeredComponents={props.registeredComponents || componentsContext.registeredComponents}
1103
+ />;
1104
+ }}</For3></Show6></Blocks_wrapper_default>;
1130
1105
  }
1131
1106
  var Blocks_default = Blocks;
1132
1107
 
@@ -3089,7 +3064,7 @@ var getInteractionPropertiesForEvent = (event) => {
3089
3064
  };
3090
3065
 
3091
3066
  // src/constants/sdk-version.ts
3092
- var SDK_VERSION = "0.11.2";
3067
+ var SDK_VERSION = "0.11.4";
3093
3068
 
3094
3069
  // src/functions/register.ts
3095
3070
  var registry = {};
@@ -3225,6 +3200,7 @@ var setupBrowserForEditing = (options = {}) => {
3225
3200
  // src/components/content/components/enable-editor.tsx
3226
3201
  function EnableEditor(props) {
3227
3202
  const [forceReRenderCount, setForceReRenderCount] = createSignal10(0);
3203
+ const [firstRender, setFirstRender] = createSignal10(true);
3228
3204
  const [lastUpdated, setLastUpdated] = createSignal10(0);
3229
3205
  const [shouldSendResetCookie, setShouldSendResetCookie] = createSignal10(false);
3230
3206
  const [ContentWrapper, setContentWrapper] = createSignal10(
@@ -3232,6 +3208,20 @@ function EnableEditor(props) {
3232
3208
  );
3233
3209
  const [httpReqsData, setHttpReqsData] = createSignal10({});
3234
3210
  const [clicked, setClicked] = createSignal10(false);
3211
+ function mergeNewRootState(newData) {
3212
+ const combinedState = {
3213
+ ...props.builderContextSignal.rootState,
3214
+ ...newData
3215
+ };
3216
+ if (props.builderContextSignal.rootSetState) {
3217
+ props.builderContextSignal.rootSetState?.(combinedState);
3218
+ } else {
3219
+ props.setBuilderContextSignal((PREVIOUS_VALUE) => ({
3220
+ ...PREVIOUS_VALUE,
3221
+ rootState: combinedState
3222
+ }));
3223
+ }
3224
+ }
3235
3225
  function mergeNewContent(newContent) {
3236
3226
  const newContentValue = {
3237
3227
  ...props.builderContextSignal.content,
@@ -3474,6 +3464,20 @@ function EnableEditor(props) {
3474
3464
  emitStateUpdate();
3475
3465
  }
3476
3466
  createEffect2(on2(() => [props.builderContextSignal.rootState], onUpdateFn_4));
3467
+ function onUpdateFn_5() {
3468
+ if (props.data) {
3469
+ mergeNewRootState(props.data);
3470
+ }
3471
+ }
3472
+ createEffect2(on2(() => [props.data], onUpdateFn_5));
3473
+ function onUpdateFn_6() {
3474
+ if (props.locale) {
3475
+ mergeNewRootState({
3476
+ locale: props.locale
3477
+ });
3478
+ }
3479
+ }
3480
+ createEffect2(on2(() => [props.locale], onUpdateFn_6));
3477
3481
  return <builder_context_default.Provider value={props.builderContextSignal}><Show10 when={props.builderContextSignal.content}><Dynamic5
3478
3482
  class={`variant-${props.content?.testVariationId || props.content?.id}`}
3479
3483
  {...{}}
@@ -3582,7 +3586,7 @@ ${getFontCss({
3582
3586
  var Styles_default = ContentStyles;
3583
3587
 
3584
3588
  // src/components/content/content.helpers.ts
3585
- var getContextStateInitialValue = ({
3589
+ var getRootStateInitialValue = ({
3586
3590
  content,
3587
3591
  data,
3588
3592
  locale
@@ -3654,7 +3658,7 @@ function ContentComponent(props) {
3654
3658
  data: props.data
3655
3659
  }),
3656
3660
  localState: void 0,
3657
- rootState: getContextStateInitialValue({
3661
+ rootState: getRootStateInitialValue({
3658
3662
  content: props.content,
3659
3663
  data: props.data,
3660
3664
  locale: props.locale
@@ -3695,6 +3699,7 @@ function ContentComponent(props) {
3695
3699
  }}
3696
3700
  ><Enable_editor_default
3697
3701
  content={props.content}
3702
+ data={props.data}
3698
3703
  model={props.model}
3699
3704
  context={props.context}
3700
3705
  apiKey={props.apiKey}
package/lib/node/index.js CHANGED
@@ -903,7 +903,7 @@ function ComponentRef(props) {
903
903
  return Wrapper();
904
904
  },
905
905
  get children() {
906
- return [createComponent(For, {
906
+ return createComponent(For, {
907
907
  get each() {
908
908
  return props.blockChildren;
909
909
  },
@@ -911,7 +911,7 @@ function ComponentRef(props) {
911
911
  _index();
912
912
  return createComponent(block_default, {
913
913
  get key() {
914
- return "block-" + child.id;
914
+ return child.id;
915
915
  },
916
916
  block: child,
917
917
  get context() {
@@ -922,23 +922,7 @@ function ComponentRef(props) {
922
922
  }
923
923
  });
924
924
  }
925
- }), createComponent(For, {
926
- get each() {
927
- return props.blockChildren;
928
- },
929
- children: (child, _index) => {
930
- _index();
931
- return createComponent(block_styles_default, {
932
- get key() {
933
- return "block-style-" + child.id;
934
- },
935
- block: child,
936
- get context() {
937
- return props.context;
938
- }
939
- });
940
- }
941
- })];
925
+ });
942
926
  }
943
927
  }));
944
928
  }
@@ -1034,7 +1018,14 @@ function Block(props) {
1034
1018
  return canShowBlock();
1035
1019
  },
1036
1020
  get children() {
1037
- return createComponent(Show, {
1021
+ return [createComponent(block_styles_default, {
1022
+ get block() {
1023
+ return props.block;
1024
+ },
1025
+ get context() {
1026
+ return props.context;
1027
+ }
1028
+ }), createComponent(Show, {
1038
1029
  get fallback() {
1039
1030
  return createComponent(component_ref_default, {
1040
1031
  get componentRef() {
@@ -1161,7 +1152,7 @@ function Block(props) {
1161
1152
  _index();
1162
1153
  return createComponent(Block, {
1163
1154
  get key() {
1164
- return "block-" + child.id;
1155
+ return child.id;
1165
1156
  },
1166
1157
  block: child,
1167
1158
  get context() {
@@ -1172,29 +1163,13 @@ function Block(props) {
1172
1163
  }
1173
1164
  });
1174
1165
  }
1175
- }), createComponent(For, {
1176
- get each() {
1177
- return childrenWithoutParentComponent();
1178
- },
1179
- children: (child, _index) => {
1180
- _index();
1181
- return createComponent(block_styles_default, {
1182
- get key() {
1183
- return "block-style-" + child.id;
1184
- },
1185
- block: child,
1186
- get context() {
1187
- return childrenContext();
1188
- }
1189
- });
1190
- }
1191
1166
  })];
1192
1167
  }
1193
1168
  });
1194
1169
  }
1195
1170
  })];
1196
1171
  }
1197
- });
1172
+ })];
1198
1173
  }
1199
1174
  });
1200
1175
  }
@@ -1281,7 +1256,7 @@ function Blocks(props) {
1281
1256
  return props.context?.BlocksWrapperProps;
1282
1257
  },
1283
1258
  get children() {
1284
- return [createComponent(Show, {
1259
+ return createComponent(Show, {
1285
1260
  get when() {
1286
1261
  return props.blocks;
1287
1262
  },
@@ -1294,7 +1269,7 @@ function Blocks(props) {
1294
1269
  _index();
1295
1270
  return createComponent(block_default, {
1296
1271
  get key() {
1297
- return "render-block-" + block.id;
1272
+ return block.id;
1298
1273
  },
1299
1274
  block,
1300
1275
  get context() {
@@ -1307,30 +1282,7 @@ function Blocks(props) {
1307
1282
  }
1308
1283
  });
1309
1284
  }
1310
- }), createComponent(Show, {
1311
- get when() {
1312
- return props.blocks;
1313
- },
1314
- get children() {
1315
- return createComponent(For, {
1316
- get each() {
1317
- return props.blocks;
1318
- },
1319
- children: (block, _index) => {
1320
- _index();
1321
- return createComponent(block_styles_default, {
1322
- get key() {
1323
- return "block-style-" + block.id;
1324
- },
1325
- block,
1326
- get context() {
1327
- return props.context || builderContext;
1328
- }
1329
- });
1330
- }
1331
- });
1332
- }
1333
- })];
1285
+ });
1334
1286
  }
1335
1287
  });
1336
1288
  }
@@ -3407,7 +3359,7 @@ var getInteractionPropertiesForEvent = (event) => {
3407
3359
  };
3408
3360
 
3409
3361
  // src/constants/sdk-version.ts
3410
- var SDK_VERSION = "0.11.2";
3362
+ var SDK_VERSION = "0.11.4";
3411
3363
 
3412
3364
  // src/functions/register.ts
3413
3365
  var registry = {};
@@ -3542,11 +3494,26 @@ var setupBrowserForEditing = (options = {}) => {
3542
3494
  // src/components/content/components/enable-editor.tsx
3543
3495
  function EnableEditor(props) {
3544
3496
  const [forceReRenderCount, setForceReRenderCount] = createSignal(0);
3497
+ createSignal(true);
3545
3498
  createSignal(0);
3546
3499
  const [shouldSendResetCookie, setShouldSendResetCookie] = createSignal(false);
3547
3500
  const [ContentWrapper, setContentWrapper] = createSignal(props.contentWrapper || "div");
3548
3501
  const [httpReqsData, setHttpReqsData] = createSignal({});
3549
3502
  const [clicked, setClicked] = createSignal(false);
3503
+ function mergeNewRootState(newData) {
3504
+ const combinedState = {
3505
+ ...props.builderContextSignal.rootState,
3506
+ ...newData
3507
+ };
3508
+ if (props.builderContextSignal.rootSetState) {
3509
+ props.builderContextSignal.rootSetState?.(combinedState);
3510
+ } else {
3511
+ props.setBuilderContextSignal((PREVIOUS_VALUE) => ({
3512
+ ...PREVIOUS_VALUE,
3513
+ rootState: combinedState
3514
+ }));
3515
+ }
3516
+ }
3550
3517
  function mergeNewContent(newContent) {
3551
3518
  const newContentValue = {
3552
3519
  ...props.builderContextSignal.content,
@@ -3766,6 +3733,20 @@ function EnableEditor(props) {
3766
3733
  emitStateUpdate();
3767
3734
  }
3768
3735
  createEffect(on(() => [props.builderContextSignal.rootState], onUpdateFn_4));
3736
+ function onUpdateFn_5() {
3737
+ if (props.data) {
3738
+ mergeNewRootState(props.data);
3739
+ }
3740
+ }
3741
+ createEffect(on(() => [props.data], onUpdateFn_5));
3742
+ function onUpdateFn_6() {
3743
+ if (props.locale) {
3744
+ mergeNewRootState({
3745
+ locale: props.locale
3746
+ });
3747
+ }
3748
+ }
3749
+ createEffect(on(() => [props.locale], onUpdateFn_6));
3769
3750
  return createComponent(builder_context_default.Provider, {
3770
3751
  get value() {
3771
3752
  return props.builderContextSignal;
@@ -3901,7 +3882,7 @@ ${getFontCss({
3901
3882
  var styles_default = ContentStyles;
3902
3883
 
3903
3884
  // src/components/content/content.helpers.ts
3904
- var getContextStateInitialValue = ({
3885
+ var getRootStateInitialValue = ({
3905
3886
  content,
3906
3887
  data,
3907
3888
  locale
@@ -3969,7 +3950,7 @@ function ContentComponent(props) {
3969
3950
  data: props.data
3970
3951
  }),
3971
3952
  localState: void 0,
3972
- rootState: getContextStateInitialValue({
3953
+ rootState: getRootStateInitialValue({
3973
3954
  content: props.content,
3974
3955
  data: props.data,
3975
3956
  locale: props.locale
@@ -4015,6 +3996,9 @@ function ContentComponent(props) {
4015
3996
  get content() {
4016
3997
  return props.content;
4017
3998
  },
3999
+ get data() {
4000
+ return props.data;
4001
+ },
4018
4002
  get model() {
4019
4003
  return props.model;
4020
4004
  },