@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.
@@ -876,25 +876,15 @@ function ComponentRef(props) {
876
876
  contextValue: props.context
877
877
  })}
878
878
  component={Wrapper()}
879
- >
880
- <For each={props.blockChildren}>{(child, _index) => {
881
- const index = _index();
882
- return <Block_default
883
- key={"block-" + child.id}
884
- block={child}
885
- context={props.context}
886
- registeredComponents={props.registeredComponents}
887
- />;
888
- }}</For>
889
- <For each={props.blockChildren}>{(child, _index) => {
890
- const index = _index();
891
- return <Block_styles_default
892
- key={"block-style-" + child.id}
893
- block={child}
894
- context={props.context}
895
- />;
896
- }}</For>
897
- </Dynamic3></Show4>;
879
+ ><For each={props.blockChildren}>{(child, _index) => {
880
+ const index = _index();
881
+ return <Block_default
882
+ key={child.id}
883
+ block={child}
884
+ context={props.context}
885
+ registeredComponents={props.registeredComponents}
886
+ />;
887
+ }}</For></Dynamic3></Show4>;
898
888
  }
899
889
  var Component_ref_default = ComponentRef;
900
890
 
@@ -971,41 +961,10 @@ function Block(props) {
971
961
  isInteractive: !blockComponent()?.isRSC
972
962
  };
973
963
  }
974
- return <Show5 when={canShowBlock()}><Show5
975
- fallback={<Component_ref_default
976
- componentRef={componentRefProps().componentRef}
977
- componentOptions={componentRefProps().componentOptions}
978
- blockChildren={componentRefProps().blockChildren}
979
- context={componentRefProps().context}
980
- registeredComponents={componentRefProps().registeredComponents}
981
- builderBlock={componentRefProps().builderBlock}
982
- includeBlockProps={componentRefProps().includeBlockProps}
983
- isInteractive={componentRefProps().isInteractive}
984
- />}
985
- when={!blockComponent()?.noWrap}
986
- >
987
- <Show5 when={isEmptyHtmlElement(Tag())}><Block_wrapper_default
988
- Wrapper={Tag()}
989
- block={processedBlock()}
990
- context={props.context}
991
- hasChildren={false}
992
- /></Show5>
993
- <Show5 when={!isEmptyHtmlElement(Tag()) && repeatItem()}><For2 each={repeatItem()}>{(data, _index) => {
994
- const index = _index();
995
- return <Repeated_block_default
996
- key={index}
997
- repeatContext={data.context}
998
- block={data.block}
999
- registeredComponents={props.registeredComponents}
1000
- />;
1001
- }}</For2></Show5>
1002
- <Show5 when={!isEmptyHtmlElement(Tag()) && !repeatItem()}><Block_wrapper_default
1003
- Wrapper={Tag()}
1004
- block={processedBlock()}
1005
- context={props.context}
1006
- hasChildren={true}
1007
- >
1008
- <Component_ref_default
964
+ return <Show5 when={canShowBlock()}>
965
+ <Block_styles_default block={props.block} context={props.context} />
966
+ <Show5
967
+ fallback={<Component_ref_default
1009
968
  componentRef={componentRefProps().componentRef}
1010
969
  componentOptions={componentRefProps().componentOptions}
1011
970
  blockChildren={componentRefProps().blockChildren}
@@ -1014,26 +973,52 @@ function Block(props) {
1014
973
  builderBlock={componentRefProps().builderBlock}
1015
974
  includeBlockProps={componentRefProps().includeBlockProps}
1016
975
  isInteractive={componentRefProps().isInteractive}
1017
- />
1018
- <For2 each={childrenWithoutParentComponent()}>{(child, _index) => {
976
+ />}
977
+ when={!blockComponent()?.noWrap}
978
+ >
979
+ <Show5 when={isEmptyHtmlElement(Tag())}><Block_wrapper_default
980
+ Wrapper={Tag()}
981
+ block={processedBlock()}
982
+ context={props.context}
983
+ hasChildren={false}
984
+ /></Show5>
985
+ <Show5 when={!isEmptyHtmlElement(Tag()) && repeatItem()}><For2 each={repeatItem()}>{(data, _index) => {
1019
986
  const index = _index();
1020
- return <Block
1021
- key={"block-" + child.id}
1022
- block={child}
1023
- context={childrenContext()}
987
+ return <Repeated_block_default
988
+ key={index}
989
+ repeatContext={data.context}
990
+ block={data.block}
1024
991
  registeredComponents={props.registeredComponents}
1025
992
  />;
1026
- }}</For2>
1027
- <For2 each={childrenWithoutParentComponent()}>{(child, _index) => {
1028
- const index = _index();
1029
- return <Block_styles_default
1030
- key={"block-style-" + child.id}
1031
- block={child}
1032
- context={childrenContext()}
1033
- />;
1034
- }}</For2>
1035
- </Block_wrapper_default></Show5>
1036
- </Show5></Show5>;
993
+ }}</For2></Show5>
994
+ <Show5 when={!isEmptyHtmlElement(Tag()) && !repeatItem()}><Block_wrapper_default
995
+ Wrapper={Tag()}
996
+ block={processedBlock()}
997
+ context={props.context}
998
+ hasChildren={true}
999
+ >
1000
+ <Component_ref_default
1001
+ componentRef={componentRefProps().componentRef}
1002
+ componentOptions={componentRefProps().componentOptions}
1003
+ blockChildren={componentRefProps().blockChildren}
1004
+ context={componentRefProps().context}
1005
+ registeredComponents={componentRefProps().registeredComponents}
1006
+ builderBlock={componentRefProps().builderBlock}
1007
+ includeBlockProps={componentRefProps().includeBlockProps}
1008
+ isInteractive={componentRefProps().isInteractive}
1009
+ />
1010
+ <For2 each={childrenWithoutParentComponent()}>{(child, _index) => {
1011
+ const index = _index();
1012
+ return <Block
1013
+ key={child.id}
1014
+ block={child}
1015
+ context={childrenContext()}
1016
+ registeredComponents={props.registeredComponents}
1017
+ />;
1018
+ }}</For2>
1019
+ </Block_wrapper_default></Show5>
1020
+ </Show5>
1021
+ </Show5>;
1037
1022
  }
1038
1023
  var Block_default = Block;
1039
1024
 
@@ -1102,25 +1087,15 @@ function Blocks(props) {
1102
1087
  styleProp={props.styleProp}
1103
1088
  BlocksWrapper={props.context?.BlocksWrapper}
1104
1089
  BlocksWrapperProps={props.context?.BlocksWrapperProps}
1105
- >
1106
- <Show6 when={props.blocks}><For3 each={props.blocks}>{(block, _index) => {
1107
- const index = _index();
1108
- return <Block_default
1109
- key={"render-block-" + block.id}
1110
- block={block}
1111
- context={props.context || builderContext}
1112
- registeredComponents={props.registeredComponents || componentsContext.registeredComponents}
1113
- />;
1114
- }}</For3></Show6>
1115
- <Show6 when={props.blocks}><For3 each={props.blocks}>{(block, _index) => {
1116
- const index = _index();
1117
- return <Block_styles_default
1118
- key={"block-style-" + block.id}
1119
- block={block}
1120
- context={props.context || builderContext}
1121
- />;
1122
- }}</For3></Show6>
1123
- </Blocks_wrapper_default>;
1090
+ ><Show6 when={props.blocks}><For3 each={props.blocks}>{(block, _index) => {
1091
+ const index = _index();
1092
+ return <Block_default
1093
+ key={block.id}
1094
+ block={block}
1095
+ context={props.context || builderContext}
1096
+ registeredComponents={props.registeredComponents || componentsContext.registeredComponents}
1097
+ />;
1098
+ }}</For3></Show6></Blocks_wrapper_default>;
1124
1099
  }
1125
1100
  var Blocks_default = Blocks;
1126
1101
 
@@ -3074,7 +3049,7 @@ var getInteractionPropertiesForEvent = (event) => {
3074
3049
  };
3075
3050
 
3076
3051
  // src/constants/sdk-version.ts
3077
- var SDK_VERSION = "0.11.2";
3052
+ var SDK_VERSION = "0.11.4";
3078
3053
 
3079
3054
  // src/functions/register.ts
3080
3055
  var registry = {};
@@ -3209,6 +3184,7 @@ var setupBrowserForEditing = (options = {}) => {
3209
3184
  // src/components/content/components/enable-editor.tsx
3210
3185
  function EnableEditor(props) {
3211
3186
  const [forceReRenderCount, setForceReRenderCount] = createSignal10(0);
3187
+ const [firstRender, setFirstRender] = createSignal10(true);
3212
3188
  const [lastUpdated, setLastUpdated] = createSignal10(0);
3213
3189
  const [shouldSendResetCookie, setShouldSendResetCookie] = createSignal10(false);
3214
3190
  const [ContentWrapper, setContentWrapper] = createSignal10(
@@ -3216,6 +3192,20 @@ function EnableEditor(props) {
3216
3192
  );
3217
3193
  const [httpReqsData, setHttpReqsData] = createSignal10({});
3218
3194
  const [clicked, setClicked] = createSignal10(false);
3195
+ function mergeNewRootState(newData) {
3196
+ const combinedState = {
3197
+ ...props.builderContextSignal.rootState,
3198
+ ...newData
3199
+ };
3200
+ if (props.builderContextSignal.rootSetState) {
3201
+ props.builderContextSignal.rootSetState?.(combinedState);
3202
+ } else {
3203
+ props.setBuilderContextSignal((PREVIOUS_VALUE) => ({
3204
+ ...PREVIOUS_VALUE,
3205
+ rootState: combinedState
3206
+ }));
3207
+ }
3208
+ }
3219
3209
  function mergeNewContent(newContent) {
3220
3210
  const newContentValue = {
3221
3211
  ...props.builderContextSignal.content,
@@ -3457,6 +3447,20 @@ function EnableEditor(props) {
3457
3447
  emitStateUpdate();
3458
3448
  }
3459
3449
  createEffect2(on2(() => [props.builderContextSignal.rootState], onUpdateFn_4));
3450
+ function onUpdateFn_5() {
3451
+ if (props.data) {
3452
+ mergeNewRootState(props.data);
3453
+ }
3454
+ }
3455
+ createEffect2(on2(() => [props.data], onUpdateFn_5));
3456
+ function onUpdateFn_6() {
3457
+ if (props.locale) {
3458
+ mergeNewRootState({
3459
+ locale: props.locale
3460
+ });
3461
+ }
3462
+ }
3463
+ createEffect2(on2(() => [props.locale], onUpdateFn_6));
3460
3464
  return <builder_context_default.Provider value={props.builderContextSignal}><Show10 when={props.builderContextSignal.content}><Dynamic5
3461
3465
  class={`variant-${props.content?.testVariationId || props.content?.id}`}
3462
3466
  {...{}}
@@ -3565,7 +3569,7 @@ ${getFontCss({
3565
3569
  var Styles_default = ContentStyles;
3566
3570
 
3567
3571
  // src/components/content/content.helpers.ts
3568
- var getContextStateInitialValue = ({
3572
+ var getRootStateInitialValue = ({
3569
3573
  content,
3570
3574
  data,
3571
3575
  locale
@@ -3637,7 +3641,7 @@ function ContentComponent(props) {
3637
3641
  data: props.data
3638
3642
  }),
3639
3643
  localState: void 0,
3640
- rootState: getContextStateInitialValue({
3644
+ rootState: getRootStateInitialValue({
3641
3645
  content: props.content,
3642
3646
  data: props.data,
3643
3647
  locale: props.locale
@@ -3678,6 +3682,7 @@ function ContentComponent(props) {
3678
3682
  }}
3679
3683
  ><Enable_editor_default
3680
3684
  content={props.content}
3685
+ data={props.data}
3681
3686
  model={props.model}
3682
3687
  context={props.context}
3683
3688
  apiKey={props.apiKey}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builder.io/sdk-solid",
3
- "version": "0.11.2",
3
+ "version": "0.11.4",
4
4
  "description": "",
5
5
  "files": [
6
6
  "dist",