@builder.io/sdk-solid 0.8.1 → 0.9.0

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.
@@ -41,7 +41,9 @@ var builder_context_default = createContext({
41
41
  apiKey: null,
42
42
  apiVersion: void 0,
43
43
  componentInfos: {},
44
- inheritedStyles: {}
44
+ inheritedStyles: {},
45
+ BlocksWrapper: "div",
46
+ BlocksWrapperProps: {}
45
47
  });
46
48
 
47
49
  // src/context/components.context.ts
@@ -718,83 +720,10 @@ function getBlockActions(options) {
718
720
  return obj;
719
721
  }
720
722
 
721
- // src/functions/sanitize-react-native-block-styles.ts
722
- var propertiesThatMustBeNumber = /* @__PURE__ */ new Set(["lineHeight"]);
723
- var displayValues = /* @__PURE__ */ new Set(["flex", "none"]);
724
- var SHOW_WARNINGS = false;
725
- var normalizeNumber = (value) => {
726
- if (Number.isNaN(value)) {
727
- return void 0;
728
- } else if (value < 0) {
729
- return 0;
730
- } else {
731
- return value;
732
- }
733
- };
734
- var sanitizeReactNativeBlockStyles = (styles) => {
735
- return Object.keys(styles).reduce((acc, key) => {
736
- const propertyValue = styles[key];
737
- if (key === "display" && !displayValues.has(propertyValue)) {
738
- if (SHOW_WARNINGS) {
739
- }
740
- return acc;
741
- }
742
- if (propertiesThatMustBeNumber.has(key) && typeof propertyValue !== "number") {
743
- if (SHOW_WARNINGS) {
744
- }
745
- return acc;
746
- }
747
- if (typeof propertyValue === "string") {
748
- const isPixelUnit = propertyValue.match(/^-?(\d*)(\.?)(\d*)*px$/);
749
- if (isPixelUnit) {
750
- const newValue = parseFloat(propertyValue);
751
- const normalizedValue = normalizeNumber(newValue);
752
- if (normalizedValue) {
753
- return {
754
- ...acc,
755
- [key]: normalizedValue
756
- };
757
- } else {
758
- return acc;
759
- }
760
- } else if (propertyValue === "0") {
761
- return {
762
- ...acc,
763
- [key]: 0
764
- };
765
- }
766
- }
767
- return {
768
- ...acc,
769
- [key]: propertyValue
770
- };
771
- }, {});
772
- };
773
-
774
- // src/functions/get-react-native-block-styles.ts
775
- function getReactNativeBlockStyles({
776
- block,
777
- context,
778
- blockStyles
779
- }) {
780
- const responsiveStyles = block.responsiveStyles;
781
- if (!responsiveStyles) {
782
- return {};
783
- }
784
- const styles = {
785
- // recursively apply inherited styles so that they can be passed down to children `Text` blocks
786
- ...context.inheritedStyles,
787
- ...responsiveStyles.large || {},
788
- ...responsiveStyles.medium || {},
789
- ...responsiveStyles.small || {},
790
- ...blockStyles
791
- };
792
- const newStyles = sanitizeReactNativeBlockStyles(styles);
793
- return newStyles;
794
- }
795
-
796
723
  // src/functions/transform-block-properties.ts
797
- function transformBlockProperties(properties) {
724
+ function transformBlockProperties({
725
+ properties
726
+ }) {
798
727
  return properties;
799
728
  }
800
729
 
@@ -815,14 +744,11 @@ function getBlockProperties({
815
744
  style: block.style ? getStyleAttribute(block.style) : void 0,
816
745
  class: [block.id, "builder-block", block.class, block.properties?.class].filter(Boolean).join(" ")
817
746
  };
818
- if (TARGET === "reactNative") {
819
- properties.style = getReactNativeBlockStyles({
820
- block,
821
- context,
822
- blockStyles: properties.style
823
- });
824
- }
825
- return transformBlockProperties(properties);
747
+ return transformBlockProperties({
748
+ properties,
749
+ context,
750
+ block
751
+ });
826
752
  }
827
753
  function getStyleAttribute(style) {
828
754
  switch (TARGET) {
@@ -1112,6 +1038,7 @@ function Block(props) {
1112
1038
  var Block_default = Block;
1113
1039
 
1114
1040
  // src/components/blocks/blocks-wrapper.tsx
1041
+ import { Dynamic as Dynamic4 } from "solid-js/web";
1115
1042
  import { css as css2 } from "solid-styled-components";
1116
1043
  function BlocksWrapper(props) {
1117
1044
  function className() {
@@ -1145,7 +1072,7 @@ function BlocksWrapper(props) {
1145
1072
  );
1146
1073
  }
1147
1074
  }
1148
- return <div
1075
+ return <Dynamic4
1149
1076
  class={className() + " " + css2({
1150
1077
  display: "flex",
1151
1078
  flexDirection: "column",
@@ -1158,7 +1085,9 @@ function BlocksWrapper(props) {
1158
1085
  onClick={(event) => onClick()}
1159
1086
  onMouseEnter={(event) => onMouseEnter()}
1160
1087
  onKeyPress={(event) => onClick()}
1161
- >{props.children}</div>;
1088
+ {...props.BlocksWrapperProps}
1089
+ component={props.BlocksWrapper}
1090
+ >{props.children}</Dynamic4>;
1162
1091
  }
1163
1092
  var Blocks_wrapper_default = BlocksWrapper;
1164
1093
 
@@ -1171,6 +1100,8 @@ function Blocks(props) {
1171
1100
  parent={props.parent}
1172
1101
  path={props.path}
1173
1102
  styleProp={props.styleProp}
1103
+ BlocksWrapper={props.context?.BlocksWrapper}
1104
+ BlocksWrapperProps={props.context?.BlocksWrapperProps}
1174
1105
  >
1175
1106
  <Show6 when={props.blocks}><For3 each={props.blocks}>{(block, _index) => {
1176
1107
  const index = _index();
@@ -2661,6 +2592,7 @@ var Inlined_script_default = InlinedScript;
2661
2592
 
2662
2593
  // src/components/content/components/enable-editor.tsx
2663
2594
  import { Show as Show10, onMount as onMount2, on as on2, createEffect as createEffect2, createSignal as createSignal10 } from "solid-js";
2595
+ import { Dynamic as Dynamic5 } from "solid-js/web";
2664
2596
 
2665
2597
  // src/helpers/preview-lru-cache/get.ts
2666
2598
  function getPreviewContent(_searchParams) {
@@ -3142,7 +3074,7 @@ var getInteractionPropertiesForEvent = (event) => {
3142
3074
  };
3143
3075
 
3144
3076
  // src/constants/sdk-version.ts
3145
- var SDK_VERSION = "0.8.1";
3077
+ var SDK_VERSION = "0.9.0";
3146
3078
 
3147
3079
  // src/functions/register.ts
3148
3080
  var registry = {};
@@ -3279,6 +3211,9 @@ function EnableEditor(props) {
3279
3211
  const [forceReRenderCount, setForceReRenderCount] = createSignal10(0);
3280
3212
  const [lastUpdated, setLastUpdated] = createSignal10(0);
3281
3213
  const [shouldSendResetCookie, setShouldSendResetCookie] = createSignal10(false);
3214
+ const [ContentWrapper, setContentWrapper] = createSignal10(
3215
+ props.contentWrapper || "div"
3216
+ );
3282
3217
  const [httpReqsData, setHttpReqsData] = createSignal10({});
3283
3218
  const [clicked, setClicked] = createSignal10(false);
3284
3219
  function mergeNewContent(newContent) {
@@ -3522,7 +3457,7 @@ function EnableEditor(props) {
3522
3457
  emitStateUpdate();
3523
3458
  }
3524
3459
  createEffect2(on2(() => [props.builderContextSignal.rootState], onUpdateFn_4));
3525
- return <builder_context_default.Provider value={props.builderContextSignal}><Show10 when={props.builderContextSignal.content}><div
3460
+ return <builder_context_default.Provider value={props.builderContextSignal}><Show10 when={props.builderContextSignal.content}><Dynamic5
3526
3461
  class={`variant-${props.content?.testVariationId || props.content?.id}`}
3527
3462
  {...{}}
3528
3463
  key={forceReRenderCount()}
@@ -3535,7 +3470,9 @@ function EnableEditor(props) {
3535
3470
  hidden: true,
3536
3471
  "aria-hidden": true
3537
3472
  }}
3538
- >{props.children}</div></Show10></builder_context_default.Provider>;
3473
+ {...props.contentWrapperProps}
3474
+ component={ContentWrapper()}
3475
+ >{props.children}</Dynamic5></Show10></builder_context_default.Provider>;
3539
3476
  }
3540
3477
  var Enable_editor_default = EnableEditor;
3541
3478
 
@@ -3725,7 +3662,9 @@ function ContentComponent(props) {
3725
3662
  }),
3726
3663
  {}
3727
3664
  ),
3728
- inheritedStyles: {}
3665
+ inheritedStyles: {},
3666
+ BlocksWrapper: props.blocksWrapper || "div",
3667
+ BlocksWrapperProps: props.blocksWrapperProps || {}
3729
3668
  });
3730
3669
  function contentSetState(newRootState) {
3731
3670
  setBuilderContextSignal((PREVIOUS_VALUE) => ({
@@ -3748,6 +3687,8 @@ function ContentComponent(props) {
3748
3687
  enrich={props.enrich}
3749
3688
  showContent={props.showContent}
3750
3689
  builderContextSignal={builderContextSignal()}
3690
+ contentWrapper={props.contentWrapper}
3691
+ contentWrapperProps={props.contentWrapperProps}
3751
3692
  {...{
3752
3693
  setBuilderContextSignal
3753
3694
  }}
@@ -3826,6 +3767,10 @@ function ContentVariants(props) {
3826
3767
  includeRefs={props.includeRefs}
3827
3768
  enrich={props.enrich}
3828
3769
  isSsrAbTest={shouldRenderVariants()}
3770
+ blocksWrapper={props.blocksWrapper}
3771
+ blocksWrapperProps={props.blocksWrapperProps}
3772
+ contentWrapper={props.contentWrapper}
3773
+ contentWrapperProps={props.contentWrapperProps}
3829
3774
  />;
3830
3775
  }}</For5>
3831
3776
  </Show12>
@@ -3844,6 +3789,10 @@ function ContentVariants(props) {
3844
3789
  includeRefs={props.includeRefs}
3845
3790
  enrich={props.enrich}
3846
3791
  isSsrAbTest={shouldRenderVariants()}
3792
+ blocksWrapper={props.blocksWrapper}
3793
+ blocksWrapperProps={props.blocksWrapperProps}
3794
+ contentWrapper={props.contentWrapper}
3795
+ contentWrapperProps={props.contentWrapperProps}
3847
3796
  />
3848
3797
  </>;
3849
3798
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builder.io/sdk-solid",
3
- "version": "0.8.1",
3
+ "version": "0.9.0",
4
4
  "description": "",
5
5
  "files": [
6
6
  "dist",