@builder.io/sdk-solid 0.8.0 → 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.
- package/dist/index.d.ts +48 -19
- package/lib/browser/dev.js +118 -149
- package/lib/browser/dev.jsx +40 -93
- package/lib/browser/index.js +118 -142
- package/lib/browser/index.jsx +40 -91
- package/lib/edge/dev.js +118 -149
- package/lib/edge/dev.jsx +40 -93
- package/lib/edge/index.js +118 -142
- package/lib/edge/index.jsx +40 -91
- package/lib/node/dev.js +134 -160
- package/lib/node/dev.jsx +56 -104
- package/lib/node/index.js +132 -151
- package/lib/node/index.jsx +54 -100
- package/package.json +1 -1
package/lib/edge/index.jsx
CHANGED
|
@@ -49,7 +49,9 @@ var builder_context_default = createContext({
|
|
|
49
49
|
apiKey: null,
|
|
50
50
|
apiVersion: void 0,
|
|
51
51
|
componentInfos: {},
|
|
52
|
-
inheritedStyles: {}
|
|
52
|
+
inheritedStyles: {},
|
|
53
|
+
BlocksWrapper: "div",
|
|
54
|
+
BlocksWrapperProps: {}
|
|
53
55
|
});
|
|
54
56
|
|
|
55
57
|
// src/context/components.context.ts
|
|
@@ -3748,83 +3750,10 @@ function getBlockActions(options) {
|
|
|
3748
3750
|
return obj;
|
|
3749
3751
|
}
|
|
3750
3752
|
|
|
3751
|
-
// src/functions/sanitize-react-native-block-styles.ts
|
|
3752
|
-
var propertiesThatMustBeNumber = /* @__PURE__ */ new Set(["lineHeight"]);
|
|
3753
|
-
var displayValues = /* @__PURE__ */ new Set(["flex", "none"]);
|
|
3754
|
-
var SHOW_WARNINGS = false;
|
|
3755
|
-
var normalizeNumber = (value) => {
|
|
3756
|
-
if (Number.isNaN(value)) {
|
|
3757
|
-
return void 0;
|
|
3758
|
-
} else if (value < 0) {
|
|
3759
|
-
return 0;
|
|
3760
|
-
} else {
|
|
3761
|
-
return value;
|
|
3762
|
-
}
|
|
3763
|
-
};
|
|
3764
|
-
var sanitizeReactNativeBlockStyles = (styles) => {
|
|
3765
|
-
return Object.keys(styles).reduce((acc, key) => {
|
|
3766
|
-
const propertyValue = styles[key];
|
|
3767
|
-
if (key === "display" && !displayValues.has(propertyValue)) {
|
|
3768
|
-
if (SHOW_WARNINGS) {
|
|
3769
|
-
}
|
|
3770
|
-
return acc;
|
|
3771
|
-
}
|
|
3772
|
-
if (propertiesThatMustBeNumber.has(key) && typeof propertyValue !== "number") {
|
|
3773
|
-
if (SHOW_WARNINGS) {
|
|
3774
|
-
}
|
|
3775
|
-
return acc;
|
|
3776
|
-
}
|
|
3777
|
-
if (typeof propertyValue === "string") {
|
|
3778
|
-
const isPixelUnit = propertyValue.match(/^-?(\d*)(\.?)(\d*)*px$/);
|
|
3779
|
-
if (isPixelUnit) {
|
|
3780
|
-
const newValue = parseFloat(propertyValue);
|
|
3781
|
-
const normalizedValue = normalizeNumber(newValue);
|
|
3782
|
-
if (normalizedValue) {
|
|
3783
|
-
return {
|
|
3784
|
-
...acc,
|
|
3785
|
-
[key]: normalizedValue
|
|
3786
|
-
};
|
|
3787
|
-
} else {
|
|
3788
|
-
return acc;
|
|
3789
|
-
}
|
|
3790
|
-
} else if (propertyValue === "0") {
|
|
3791
|
-
return {
|
|
3792
|
-
...acc,
|
|
3793
|
-
[key]: 0
|
|
3794
|
-
};
|
|
3795
|
-
}
|
|
3796
|
-
}
|
|
3797
|
-
return {
|
|
3798
|
-
...acc,
|
|
3799
|
-
[key]: propertyValue
|
|
3800
|
-
};
|
|
3801
|
-
}, {});
|
|
3802
|
-
};
|
|
3803
|
-
|
|
3804
|
-
// src/functions/get-react-native-block-styles.ts
|
|
3805
|
-
function getReactNativeBlockStyles({
|
|
3806
|
-
block,
|
|
3807
|
-
context,
|
|
3808
|
-
blockStyles
|
|
3809
|
-
}) {
|
|
3810
|
-
const responsiveStyles = block.responsiveStyles;
|
|
3811
|
-
if (!responsiveStyles) {
|
|
3812
|
-
return {};
|
|
3813
|
-
}
|
|
3814
|
-
const styles = {
|
|
3815
|
-
// recursively apply inherited styles so that they can be passed down to children `Text` blocks
|
|
3816
|
-
...context.inheritedStyles,
|
|
3817
|
-
...responsiveStyles.large || {},
|
|
3818
|
-
...responsiveStyles.medium || {},
|
|
3819
|
-
...responsiveStyles.small || {},
|
|
3820
|
-
...blockStyles
|
|
3821
|
-
};
|
|
3822
|
-
const newStyles = sanitizeReactNativeBlockStyles(styles);
|
|
3823
|
-
return newStyles;
|
|
3824
|
-
}
|
|
3825
|
-
|
|
3826
3753
|
// src/functions/transform-block-properties.ts
|
|
3827
|
-
function transformBlockProperties(
|
|
3754
|
+
function transformBlockProperties({
|
|
3755
|
+
properties
|
|
3756
|
+
}) {
|
|
3828
3757
|
return properties;
|
|
3829
3758
|
}
|
|
3830
3759
|
|
|
@@ -3845,14 +3774,11 @@ function getBlockProperties({
|
|
|
3845
3774
|
style: block.style ? getStyleAttribute(block.style) : void 0,
|
|
3846
3775
|
class: [block.id, "builder-block", block.class, block.properties?.class].filter(Boolean).join(" ")
|
|
3847
3776
|
};
|
|
3848
|
-
|
|
3849
|
-
properties
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
});
|
|
3854
|
-
}
|
|
3855
|
-
return transformBlockProperties(properties);
|
|
3777
|
+
return transformBlockProperties({
|
|
3778
|
+
properties,
|
|
3779
|
+
context,
|
|
3780
|
+
block
|
|
3781
|
+
});
|
|
3856
3782
|
}
|
|
3857
3783
|
function getStyleAttribute(style) {
|
|
3858
3784
|
switch (TARGET) {
|
|
@@ -4142,6 +4068,7 @@ function Block(props) {
|
|
|
4142
4068
|
var Block_default = Block;
|
|
4143
4069
|
|
|
4144
4070
|
// src/components/blocks/blocks-wrapper.tsx
|
|
4071
|
+
import { Dynamic as Dynamic4 } from "solid-js/web";
|
|
4145
4072
|
import { css as css2 } from "solid-styled-components";
|
|
4146
4073
|
function BlocksWrapper(props) {
|
|
4147
4074
|
function className() {
|
|
@@ -4175,7 +4102,7 @@ function BlocksWrapper(props) {
|
|
|
4175
4102
|
);
|
|
4176
4103
|
}
|
|
4177
4104
|
}
|
|
4178
|
-
return <
|
|
4105
|
+
return <Dynamic4
|
|
4179
4106
|
class={className() + " " + css2({
|
|
4180
4107
|
display: "flex",
|
|
4181
4108
|
flexDirection: "column",
|
|
@@ -4188,7 +4115,9 @@ function BlocksWrapper(props) {
|
|
|
4188
4115
|
onClick={(event) => onClick()}
|
|
4189
4116
|
onMouseEnter={(event) => onMouseEnter()}
|
|
4190
4117
|
onKeyPress={(event) => onClick()}
|
|
4191
|
-
|
|
4118
|
+
{...props.BlocksWrapperProps}
|
|
4119
|
+
component={props.BlocksWrapper}
|
|
4120
|
+
>{props.children}</Dynamic4>;
|
|
4192
4121
|
}
|
|
4193
4122
|
var Blocks_wrapper_default = BlocksWrapper;
|
|
4194
4123
|
|
|
@@ -4201,6 +4130,8 @@ function Blocks(props) {
|
|
|
4201
4130
|
parent={props.parent}
|
|
4202
4131
|
path={props.path}
|
|
4203
4132
|
styleProp={props.styleProp}
|
|
4133
|
+
BlocksWrapper={props.context?.BlocksWrapper}
|
|
4134
|
+
BlocksWrapperProps={props.context?.BlocksWrapperProps}
|
|
4204
4135
|
>
|
|
4205
4136
|
<Show6 when={props.blocks}><For3 each={props.blocks}>{(block, _index) => {
|
|
4206
4137
|
const index = _index();
|
|
@@ -5691,6 +5622,7 @@ var Inlined_script_default = InlinedScript;
|
|
|
5691
5622
|
|
|
5692
5623
|
// src/components/content/components/enable-editor.tsx
|
|
5693
5624
|
import { Show as Show10, onMount as onMount2, on as on2, createEffect as createEffect2, createSignal as createSignal10 } from "solid-js";
|
|
5625
|
+
import { Dynamic as Dynamic5 } from "solid-js/web";
|
|
5694
5626
|
|
|
5695
5627
|
// src/helpers/preview-lru-cache/get.ts
|
|
5696
5628
|
function getPreviewContent(_searchParams) {
|
|
@@ -6172,7 +6104,7 @@ var getInteractionPropertiesForEvent = (event) => {
|
|
|
6172
6104
|
};
|
|
6173
6105
|
|
|
6174
6106
|
// src/constants/sdk-version.ts
|
|
6175
|
-
var SDK_VERSION = "0.
|
|
6107
|
+
var SDK_VERSION = "0.9.0";
|
|
6176
6108
|
|
|
6177
6109
|
// src/functions/register.ts
|
|
6178
6110
|
var registry = {};
|
|
@@ -6309,6 +6241,9 @@ function EnableEditor(props) {
|
|
|
6309
6241
|
const [forceReRenderCount, setForceReRenderCount] = createSignal10(0);
|
|
6310
6242
|
const [lastUpdated, setLastUpdated] = createSignal10(0);
|
|
6311
6243
|
const [shouldSendResetCookie, setShouldSendResetCookie] = createSignal10(false);
|
|
6244
|
+
const [ContentWrapper, setContentWrapper] = createSignal10(
|
|
6245
|
+
props.contentWrapper || "div"
|
|
6246
|
+
);
|
|
6312
6247
|
const [httpReqsData, setHttpReqsData] = createSignal10({});
|
|
6313
6248
|
const [clicked, setClicked] = createSignal10(false);
|
|
6314
6249
|
function mergeNewContent(newContent) {
|
|
@@ -6552,7 +6487,7 @@ function EnableEditor(props) {
|
|
|
6552
6487
|
emitStateUpdate();
|
|
6553
6488
|
}
|
|
6554
6489
|
createEffect2(on2(() => [props.builderContextSignal.rootState], onUpdateFn_4));
|
|
6555
|
-
return <builder_context_default.Provider value={props.builderContextSignal}><Show10 when={props.builderContextSignal.content}><
|
|
6490
|
+
return <builder_context_default.Provider value={props.builderContextSignal}><Show10 when={props.builderContextSignal.content}><Dynamic5
|
|
6556
6491
|
class={`variant-${props.content?.testVariationId || props.content?.id}`}
|
|
6557
6492
|
{...{}}
|
|
6558
6493
|
key={forceReRenderCount()}
|
|
@@ -6565,7 +6500,9 @@ function EnableEditor(props) {
|
|
|
6565
6500
|
hidden: true,
|
|
6566
6501
|
"aria-hidden": true
|
|
6567
6502
|
}}
|
|
6568
|
-
|
|
6503
|
+
{...props.contentWrapperProps}
|
|
6504
|
+
component={ContentWrapper()}
|
|
6505
|
+
>{props.children}</Dynamic5></Show10></builder_context_default.Provider>;
|
|
6569
6506
|
}
|
|
6570
6507
|
var Enable_editor_default = EnableEditor;
|
|
6571
6508
|
|
|
@@ -6755,7 +6692,9 @@ function ContentComponent(props) {
|
|
|
6755
6692
|
}),
|
|
6756
6693
|
{}
|
|
6757
6694
|
),
|
|
6758
|
-
inheritedStyles: {}
|
|
6695
|
+
inheritedStyles: {},
|
|
6696
|
+
BlocksWrapper: props.blocksWrapper || "div",
|
|
6697
|
+
BlocksWrapperProps: props.blocksWrapperProps || {}
|
|
6759
6698
|
});
|
|
6760
6699
|
function contentSetState(newRootState) {
|
|
6761
6700
|
setBuilderContextSignal((PREVIOUS_VALUE) => ({
|
|
@@ -6778,6 +6717,8 @@ function ContentComponent(props) {
|
|
|
6778
6717
|
enrich={props.enrich}
|
|
6779
6718
|
showContent={props.showContent}
|
|
6780
6719
|
builderContextSignal={builderContextSignal()}
|
|
6720
|
+
contentWrapper={props.contentWrapper}
|
|
6721
|
+
contentWrapperProps={props.contentWrapperProps}
|
|
6781
6722
|
{...{
|
|
6782
6723
|
setBuilderContextSignal
|
|
6783
6724
|
}}
|
|
@@ -6856,6 +6797,10 @@ function ContentVariants(props) {
|
|
|
6856
6797
|
includeRefs={props.includeRefs}
|
|
6857
6798
|
enrich={props.enrich}
|
|
6858
6799
|
isSsrAbTest={shouldRenderVariants()}
|
|
6800
|
+
blocksWrapper={props.blocksWrapper}
|
|
6801
|
+
blocksWrapperProps={props.blocksWrapperProps}
|
|
6802
|
+
contentWrapper={props.contentWrapper}
|
|
6803
|
+
contentWrapperProps={props.contentWrapperProps}
|
|
6859
6804
|
/>;
|
|
6860
6805
|
}}</For5>
|
|
6861
6806
|
</Show12>
|
|
@@ -6874,6 +6819,10 @@ function ContentVariants(props) {
|
|
|
6874
6819
|
includeRefs={props.includeRefs}
|
|
6875
6820
|
enrich={props.enrich}
|
|
6876
6821
|
isSsrAbTest={shouldRenderVariants()}
|
|
6822
|
+
blocksWrapper={props.blocksWrapper}
|
|
6823
|
+
blocksWrapperProps={props.blocksWrapperProps}
|
|
6824
|
+
contentWrapper={props.contentWrapper}
|
|
6825
|
+
contentWrapperProps={props.contentWrapperProps}
|
|
6877
6826
|
/>
|
|
6878
6827
|
</>;
|
|
6879
6828
|
}
|