@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/edge/dev.jsx CHANGED
@@ -3911,25 +3911,15 @@ function ComponentRef(props) {
3911
3911
  contextValue: props.context
3912
3912
  })}
3913
3913
  component={Wrapper()}
3914
- >
3915
- <For each={props.blockChildren}>{(child, _index) => {
3916
- const index = _index();
3917
- return <Block_default
3918
- key={"block-" + child.id}
3919
- block={child}
3920
- context={props.context}
3921
- registeredComponents={props.registeredComponents}
3922
- />;
3923
- }}</For>
3924
- <For each={props.blockChildren}>{(child, _index) => {
3925
- const index = _index();
3926
- return <Block_styles_default
3927
- key={"block-style-" + child.id}
3928
- block={child}
3929
- context={props.context}
3930
- />;
3931
- }}</For>
3932
- </Dynamic3></Show4>;
3914
+ ><For each={props.blockChildren}>{(child, _index) => {
3915
+ const index = _index();
3916
+ return <Block_default
3917
+ key={child.id}
3918
+ block={child}
3919
+ context={props.context}
3920
+ registeredComponents={props.registeredComponents}
3921
+ />;
3922
+ }}</For></Dynamic3></Show4>;
3933
3923
  }
3934
3924
  var Component_ref_default = ComponentRef;
3935
3925
 
@@ -4006,41 +3996,10 @@ function Block(props) {
4006
3996
  isInteractive: !blockComponent()?.isRSC
4007
3997
  };
4008
3998
  }
4009
- return <Show5 when={canShowBlock()}><Show5
4010
- fallback={<Component_ref_default
4011
- componentRef={componentRefProps().componentRef}
4012
- componentOptions={componentRefProps().componentOptions}
4013
- blockChildren={componentRefProps().blockChildren}
4014
- context={componentRefProps().context}
4015
- registeredComponents={componentRefProps().registeredComponents}
4016
- builderBlock={componentRefProps().builderBlock}
4017
- includeBlockProps={componentRefProps().includeBlockProps}
4018
- isInteractive={componentRefProps().isInteractive}
4019
- />}
4020
- when={!blockComponent()?.noWrap}
4021
- >
4022
- <Show5 when={isEmptyHtmlElement(Tag())}><Block_wrapper_default
4023
- Wrapper={Tag()}
4024
- block={processedBlock()}
4025
- context={props.context}
4026
- hasChildren={false}
4027
- /></Show5>
4028
- <Show5 when={!isEmptyHtmlElement(Tag()) && repeatItem()}><For2 each={repeatItem()}>{(data, _index) => {
4029
- const index = _index();
4030
- return <Repeated_block_default
4031
- key={index}
4032
- repeatContext={data.context}
4033
- block={data.block}
4034
- registeredComponents={props.registeredComponents}
4035
- />;
4036
- }}</For2></Show5>
4037
- <Show5 when={!isEmptyHtmlElement(Tag()) && !repeatItem()}><Block_wrapper_default
4038
- Wrapper={Tag()}
4039
- block={processedBlock()}
4040
- context={props.context}
4041
- hasChildren={true}
4042
- >
4043
- <Component_ref_default
3999
+ return <Show5 when={canShowBlock()}>
4000
+ <Block_styles_default block={props.block} context={props.context} />
4001
+ <Show5
4002
+ fallback={<Component_ref_default
4044
4003
  componentRef={componentRefProps().componentRef}
4045
4004
  componentOptions={componentRefProps().componentOptions}
4046
4005
  blockChildren={componentRefProps().blockChildren}
@@ -4049,26 +4008,52 @@ function Block(props) {
4049
4008
  builderBlock={componentRefProps().builderBlock}
4050
4009
  includeBlockProps={componentRefProps().includeBlockProps}
4051
4010
  isInteractive={componentRefProps().isInteractive}
4052
- />
4053
- <For2 each={childrenWithoutParentComponent()}>{(child, _index) => {
4011
+ />}
4012
+ when={!blockComponent()?.noWrap}
4013
+ >
4014
+ <Show5 when={isEmptyHtmlElement(Tag())}><Block_wrapper_default
4015
+ Wrapper={Tag()}
4016
+ block={processedBlock()}
4017
+ context={props.context}
4018
+ hasChildren={false}
4019
+ /></Show5>
4020
+ <Show5 when={!isEmptyHtmlElement(Tag()) && repeatItem()}><For2 each={repeatItem()}>{(data, _index) => {
4054
4021
  const index = _index();
4055
- return <Block
4056
- key={"block-" + child.id}
4057
- block={child}
4058
- context={childrenContext()}
4022
+ return <Repeated_block_default
4023
+ key={index}
4024
+ repeatContext={data.context}
4025
+ block={data.block}
4059
4026
  registeredComponents={props.registeredComponents}
4060
4027
  />;
4061
- }}</For2>
4062
- <For2 each={childrenWithoutParentComponent()}>{(child, _index) => {
4063
- const index = _index();
4064
- return <Block_styles_default
4065
- key={"block-style-" + child.id}
4066
- block={child}
4067
- context={childrenContext()}
4068
- />;
4069
- }}</For2>
4070
- </Block_wrapper_default></Show5>
4071
- </Show5></Show5>;
4028
+ }}</For2></Show5>
4029
+ <Show5 when={!isEmptyHtmlElement(Tag()) && !repeatItem()}><Block_wrapper_default
4030
+ Wrapper={Tag()}
4031
+ block={processedBlock()}
4032
+ context={props.context}
4033
+ hasChildren={true}
4034
+ >
4035
+ <Component_ref_default
4036
+ componentRef={componentRefProps().componentRef}
4037
+ componentOptions={componentRefProps().componentOptions}
4038
+ blockChildren={componentRefProps().blockChildren}
4039
+ context={componentRefProps().context}
4040
+ registeredComponents={componentRefProps().registeredComponents}
4041
+ builderBlock={componentRefProps().builderBlock}
4042
+ includeBlockProps={componentRefProps().includeBlockProps}
4043
+ isInteractive={componentRefProps().isInteractive}
4044
+ />
4045
+ <For2 each={childrenWithoutParentComponent()}>{(child, _index) => {
4046
+ const index = _index();
4047
+ return <Block
4048
+ key={child.id}
4049
+ block={child}
4050
+ context={childrenContext()}
4051
+ registeredComponents={props.registeredComponents}
4052
+ />;
4053
+ }}</For2>
4054
+ </Block_wrapper_default></Show5>
4055
+ </Show5>
4056
+ </Show5>;
4072
4057
  }
4073
4058
  var Block_default = Block;
4074
4059
 
@@ -4137,25 +4122,15 @@ function Blocks(props) {
4137
4122
  styleProp={props.styleProp}
4138
4123
  BlocksWrapper={props.context?.BlocksWrapper}
4139
4124
  BlocksWrapperProps={props.context?.BlocksWrapperProps}
4140
- >
4141
- <Show6 when={props.blocks}><For3 each={props.blocks}>{(block, _index) => {
4142
- const index = _index();
4143
- return <Block_default
4144
- key={"render-block-" + block.id}
4145
- block={block}
4146
- context={props.context || builderContext}
4147
- registeredComponents={props.registeredComponents || componentsContext.registeredComponents}
4148
- />;
4149
- }}</For3></Show6>
4150
- <Show6 when={props.blocks}><For3 each={props.blocks}>{(block, _index) => {
4151
- const index = _index();
4152
- return <Block_styles_default
4153
- key={"block-style-" + block.id}
4154
- block={block}
4155
- context={props.context || builderContext}
4156
- />;
4157
- }}</For3></Show6>
4158
- </Blocks_wrapper_default>;
4125
+ ><Show6 when={props.blocks}><For3 each={props.blocks}>{(block, _index) => {
4126
+ const index = _index();
4127
+ return <Block_default
4128
+ key={block.id}
4129
+ block={block}
4130
+ context={props.context || builderContext}
4131
+ registeredComponents={props.registeredComponents || componentsContext.registeredComponents}
4132
+ />;
4133
+ }}</For3></Show6></Blocks_wrapper_default>;
4159
4134
  }
4160
4135
  var Blocks_default = Blocks;
4161
4136
 
@@ -6118,7 +6093,7 @@ var getInteractionPropertiesForEvent = (event) => {
6118
6093
  };
6119
6094
 
6120
6095
  // src/constants/sdk-version.ts
6121
- var SDK_VERSION = "0.11.2";
6096
+ var SDK_VERSION = "0.11.4";
6122
6097
 
6123
6098
  // src/functions/register.ts
6124
6099
  var registry = {};
@@ -6254,6 +6229,7 @@ var setupBrowserForEditing = (options = {}) => {
6254
6229
  // src/components/content/components/enable-editor.tsx
6255
6230
  function EnableEditor(props) {
6256
6231
  const [forceReRenderCount, setForceReRenderCount] = createSignal10(0);
6232
+ const [firstRender, setFirstRender] = createSignal10(true);
6257
6233
  const [lastUpdated, setLastUpdated] = createSignal10(0);
6258
6234
  const [shouldSendResetCookie, setShouldSendResetCookie] = createSignal10(false);
6259
6235
  const [ContentWrapper, setContentWrapper] = createSignal10(
@@ -6261,6 +6237,20 @@ function EnableEditor(props) {
6261
6237
  );
6262
6238
  const [httpReqsData, setHttpReqsData] = createSignal10({});
6263
6239
  const [clicked, setClicked] = createSignal10(false);
6240
+ function mergeNewRootState(newData) {
6241
+ const combinedState = {
6242
+ ...props.builderContextSignal.rootState,
6243
+ ...newData
6244
+ };
6245
+ if (props.builderContextSignal.rootSetState) {
6246
+ props.builderContextSignal.rootSetState?.(combinedState);
6247
+ } else {
6248
+ props.setBuilderContextSignal((PREVIOUS_VALUE) => ({
6249
+ ...PREVIOUS_VALUE,
6250
+ rootState: combinedState
6251
+ }));
6252
+ }
6253
+ }
6264
6254
  function mergeNewContent(newContent) {
6265
6255
  const newContentValue = {
6266
6256
  ...props.builderContextSignal.content,
@@ -6503,6 +6493,20 @@ function EnableEditor(props) {
6503
6493
  emitStateUpdate();
6504
6494
  }
6505
6495
  createEffect2(on2(() => [props.builderContextSignal.rootState], onUpdateFn_4));
6496
+ function onUpdateFn_5() {
6497
+ if (props.data) {
6498
+ mergeNewRootState(props.data);
6499
+ }
6500
+ }
6501
+ createEffect2(on2(() => [props.data], onUpdateFn_5));
6502
+ function onUpdateFn_6() {
6503
+ if (props.locale) {
6504
+ mergeNewRootState({
6505
+ locale: props.locale
6506
+ });
6507
+ }
6508
+ }
6509
+ createEffect2(on2(() => [props.locale], onUpdateFn_6));
6506
6510
  return <builder_context_default.Provider value={props.builderContextSignal}><Show10 when={props.builderContextSignal.content}><Dynamic5
6507
6511
  class={`variant-${props.content?.testVariationId || props.content?.id}`}
6508
6512
  {...{}}
@@ -6611,7 +6615,7 @@ ${getFontCss({
6611
6615
  var Styles_default = ContentStyles;
6612
6616
 
6613
6617
  // src/components/content/content.helpers.ts
6614
- var getContextStateInitialValue = ({
6618
+ var getRootStateInitialValue = ({
6615
6619
  content,
6616
6620
  data,
6617
6621
  locale
@@ -6683,7 +6687,7 @@ function ContentComponent(props) {
6683
6687
  data: props.data
6684
6688
  }),
6685
6689
  localState: void 0,
6686
- rootState: getContextStateInitialValue({
6690
+ rootState: getRootStateInitialValue({
6687
6691
  content: props.content,
6688
6692
  data: props.data,
6689
6693
  locale: props.locale
@@ -6724,6 +6728,7 @@ function ContentComponent(props) {
6724
6728
  }}
6725
6729
  ><Enable_editor_default
6726
6730
  content={props.content}
6731
+ data={props.data}
6727
6732
  model={props.model}
6728
6733
  context={props.context}
6729
6734
  apiKey={props.apiKey}
package/lib/edge/index.js CHANGED
@@ -3933,7 +3933,7 @@ function ComponentRef(props) {
3933
3933
  return Wrapper();
3934
3934
  },
3935
3935
  get children() {
3936
- return [createComponent(For, {
3936
+ return createComponent(For, {
3937
3937
  get each() {
3938
3938
  return props.blockChildren;
3939
3939
  },
@@ -3941,7 +3941,7 @@ function ComponentRef(props) {
3941
3941
  _index();
3942
3942
  return createComponent(block_default, {
3943
3943
  get key() {
3944
- return "block-" + child.id;
3944
+ return child.id;
3945
3945
  },
3946
3946
  block: child,
3947
3947
  get context() {
@@ -3952,23 +3952,7 @@ function ComponentRef(props) {
3952
3952
  }
3953
3953
  });
3954
3954
  }
3955
- }), createComponent(For, {
3956
- get each() {
3957
- return props.blockChildren;
3958
- },
3959
- children: (child, _index) => {
3960
- _index();
3961
- return createComponent(block_styles_default, {
3962
- get key() {
3963
- return "block-style-" + child.id;
3964
- },
3965
- block: child,
3966
- get context() {
3967
- return props.context;
3968
- }
3969
- });
3970
- }
3971
- })];
3955
+ });
3972
3956
  }
3973
3957
  }));
3974
3958
  }
@@ -4064,7 +4048,14 @@ function Block(props) {
4064
4048
  return canShowBlock();
4065
4049
  },
4066
4050
  get children() {
4067
- return createComponent(Show, {
4051
+ return [createComponent(block_styles_default, {
4052
+ get block() {
4053
+ return props.block;
4054
+ },
4055
+ get context() {
4056
+ return props.context;
4057
+ }
4058
+ }), createComponent(Show, {
4068
4059
  get fallback() {
4069
4060
  return createComponent(component_ref_default, {
4070
4061
  get componentRef() {
@@ -4191,7 +4182,7 @@ function Block(props) {
4191
4182
  _index();
4192
4183
  return createComponent(Block, {
4193
4184
  get key() {
4194
- return "block-" + child.id;
4185
+ return child.id;
4195
4186
  },
4196
4187
  block: child,
4197
4188
  get context() {
@@ -4202,29 +4193,13 @@ function Block(props) {
4202
4193
  }
4203
4194
  });
4204
4195
  }
4205
- }), createComponent(For, {
4206
- get each() {
4207
- return childrenWithoutParentComponent();
4208
- },
4209
- children: (child, _index) => {
4210
- _index();
4211
- return createComponent(block_styles_default, {
4212
- get key() {
4213
- return "block-style-" + child.id;
4214
- },
4215
- block: child,
4216
- get context() {
4217
- return childrenContext();
4218
- }
4219
- });
4220
- }
4221
4196
  })];
4222
4197
  }
4223
4198
  });
4224
4199
  }
4225
4200
  })];
4226
4201
  }
4227
- });
4202
+ })];
4228
4203
  }
4229
4204
  });
4230
4205
  }
@@ -4311,7 +4286,7 @@ function Blocks(props) {
4311
4286
  return props.context?.BlocksWrapperProps;
4312
4287
  },
4313
4288
  get children() {
4314
- return [createComponent(Show, {
4289
+ return createComponent(Show, {
4315
4290
  get when() {
4316
4291
  return props.blocks;
4317
4292
  },
@@ -4324,7 +4299,7 @@ function Blocks(props) {
4324
4299
  _index();
4325
4300
  return createComponent(block_default, {
4326
4301
  get key() {
4327
- return "render-block-" + block.id;
4302
+ return block.id;
4328
4303
  },
4329
4304
  block,
4330
4305
  get context() {
@@ -4337,30 +4312,7 @@ function Blocks(props) {
4337
4312
  }
4338
4313
  });
4339
4314
  }
4340
- }), createComponent(Show, {
4341
- get when() {
4342
- return props.blocks;
4343
- },
4344
- get children() {
4345
- return createComponent(For, {
4346
- get each() {
4347
- return props.blocks;
4348
- },
4349
- children: (block, _index) => {
4350
- _index();
4351
- return createComponent(block_styles_default, {
4352
- get key() {
4353
- return "block-style-" + block.id;
4354
- },
4355
- block,
4356
- get context() {
4357
- return props.context || builderContext;
4358
- }
4359
- });
4360
- }
4361
- });
4362
- }
4363
- })];
4315
+ });
4364
4316
  }
4365
4317
  });
4366
4318
  }
@@ -6437,7 +6389,7 @@ var getInteractionPropertiesForEvent = (event) => {
6437
6389
  };
6438
6390
 
6439
6391
  // src/constants/sdk-version.ts
6440
- var SDK_VERSION = "0.11.2";
6392
+ var SDK_VERSION = "0.11.4";
6441
6393
 
6442
6394
  // src/functions/register.ts
6443
6395
  var registry = {};
@@ -6572,11 +6524,26 @@ var setupBrowserForEditing = (options = {}) => {
6572
6524
  // src/components/content/components/enable-editor.tsx
6573
6525
  function EnableEditor(props) {
6574
6526
  const [forceReRenderCount, setForceReRenderCount] = createSignal(0);
6527
+ createSignal(true);
6575
6528
  createSignal(0);
6576
6529
  const [shouldSendResetCookie, setShouldSendResetCookie] = createSignal(false);
6577
6530
  const [ContentWrapper, setContentWrapper] = createSignal(props.contentWrapper || "div");
6578
6531
  const [httpReqsData, setHttpReqsData] = createSignal({});
6579
6532
  const [clicked, setClicked] = createSignal(false);
6533
+ function mergeNewRootState(newData) {
6534
+ const combinedState = {
6535
+ ...props.builderContextSignal.rootState,
6536
+ ...newData
6537
+ };
6538
+ if (props.builderContextSignal.rootSetState) {
6539
+ props.builderContextSignal.rootSetState?.(combinedState);
6540
+ } else {
6541
+ props.setBuilderContextSignal((PREVIOUS_VALUE) => ({
6542
+ ...PREVIOUS_VALUE,
6543
+ rootState: combinedState
6544
+ }));
6545
+ }
6546
+ }
6580
6547
  function mergeNewContent(newContent) {
6581
6548
  const newContentValue = {
6582
6549
  ...props.builderContextSignal.content,
@@ -6796,6 +6763,20 @@ function EnableEditor(props) {
6796
6763
  emitStateUpdate();
6797
6764
  }
6798
6765
  createEffect(on(() => [props.builderContextSignal.rootState], onUpdateFn_4));
6766
+ function onUpdateFn_5() {
6767
+ if (props.data) {
6768
+ mergeNewRootState(props.data);
6769
+ }
6770
+ }
6771
+ createEffect(on(() => [props.data], onUpdateFn_5));
6772
+ function onUpdateFn_6() {
6773
+ if (props.locale) {
6774
+ mergeNewRootState({
6775
+ locale: props.locale
6776
+ });
6777
+ }
6778
+ }
6779
+ createEffect(on(() => [props.locale], onUpdateFn_6));
6799
6780
  return createComponent(builder_context_default.Provider, {
6800
6781
  get value() {
6801
6782
  return props.builderContextSignal;
@@ -6931,7 +6912,7 @@ ${getFontCss({
6931
6912
  var styles_default = ContentStyles;
6932
6913
 
6933
6914
  // src/components/content/content.helpers.ts
6934
- var getContextStateInitialValue = ({
6915
+ var getRootStateInitialValue = ({
6935
6916
  content,
6936
6917
  data,
6937
6918
  locale
@@ -6999,7 +6980,7 @@ function ContentComponent(props) {
6999
6980
  data: props.data
7000
6981
  }),
7001
6982
  localState: void 0,
7002
- rootState: getContextStateInitialValue({
6983
+ rootState: getRootStateInitialValue({
7003
6984
  content: props.content,
7004
6985
  data: props.data,
7005
6986
  locale: props.locale
@@ -7045,6 +7026,9 @@ function ContentComponent(props) {
7045
7026
  get content() {
7046
7027
  return props.content;
7047
7028
  },
7029
+ get data() {
7030
+ return props.data;
7031
+ },
7048
7032
  get model() {
7049
7033
  return props.model;
7050
7034
  },