@builder.io/sdk-react 0.1.9 → 0.1.11
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/react/blocks/BaseText.js +2 -1
- package/dist/react/blocks/button/button.js +2 -1
- package/dist/react/blocks/columns/columns.js +18 -17
- package/dist/react/blocks/custom-code/custom-code.js +2 -1
- package/dist/react/blocks/embed/embed.js +2 -1
- package/dist/react/blocks/form/form.js +3 -2
- package/dist/react/blocks/fragment/fragment.js +2 -1
- package/dist/react/blocks/image/component-info.js +1 -1
- package/dist/react/blocks/image/image.js +2 -1
- package/dist/react/blocks/img/img.js +2 -1
- package/dist/react/blocks/input/input.js +2 -1
- package/dist/react/blocks/raw-text/raw-text.js +2 -1
- package/dist/react/blocks/section/section.js +2 -1
- package/dist/react/blocks/select/select.js +2 -1
- package/dist/react/blocks/submit-button/submit-button.js +2 -1
- package/dist/react/blocks/symbol/symbol.js +2 -1
- package/dist/react/blocks/text/text.js +5 -2
- package/dist/react/blocks/textarea/textarea.js +2 -1
- package/dist/react/blocks/video/video.js +2 -1
- package/dist/react/components/render-block/block-styles.js +2 -1
- package/dist/react/components/render-block/render-block.js +2 -1
- package/dist/react/components/render-block/render-component.js +2 -1
- package/dist/react/components/render-block/render-repeated-block.js +2 -1
- package/dist/react/components/render-blocks.js +2 -1
- package/dist/react/components/render-content/builder-editing.js +2 -1
- package/dist/react/components/render-content/components/render-styles.js +15 -1
- package/dist/react/components/render-content/render-content.js +6 -8
- package/dist/react/components/render-inlined-styles.js +2 -1
- package/dist/react/functions/is-editing.js +2 -1
- package/dist/react/index.js +0 -1
- package/dist/rsc/blocks/BaseText.js +2 -1
- package/dist/rsc/blocks/button/button.js +2 -1
- package/dist/rsc/blocks/columns/columns.js +18 -17
- package/dist/rsc/blocks/custom-code/custom-code.js +2 -1
- package/dist/rsc/blocks/embed/embed.js +2 -1
- package/dist/rsc/blocks/form/form.js +3 -2
- package/dist/rsc/blocks/fragment/fragment.js +2 -1
- package/dist/rsc/blocks/image/component-info.js +1 -1
- package/dist/rsc/blocks/image/image.js +2 -1
- package/dist/rsc/blocks/img/img.js +2 -1
- package/dist/rsc/blocks/input/input.js +2 -1
- package/dist/rsc/blocks/raw-text/raw-text.js +2 -1
- package/dist/rsc/blocks/section/section.js +2 -1
- package/dist/rsc/blocks/select/select.js +2 -1
- package/dist/rsc/blocks/submit-button/submit-button.js +2 -1
- package/dist/rsc/blocks/symbol/symbol.js +2 -1
- package/dist/rsc/blocks/text/text.js +5 -2
- package/dist/rsc/blocks/textarea/textarea.js +2 -1
- package/dist/rsc/blocks/video/video.js +2 -1
- package/dist/rsc/components/render-block/block-styles.js +2 -1
- package/dist/rsc/components/render-block/render-block.js +2 -1
- package/dist/rsc/components/render-block/render-component.js +2 -1
- package/dist/rsc/components/render-block/render-repeated-block.js +2 -1
- package/dist/rsc/components/render-blocks.js +2 -1
- package/dist/rsc/components/render-content/components/render-styles.js +15 -1
- package/dist/rsc/components/render-content/render-content.js +5 -8
- package/dist/rsc/components/render-inlined-styles.js +2 -1
- package/dist/rsc/functions/is-editing.js +2 -1
- package/dist/rsc/index.js +0 -1
- package/package.json +1 -1
- package/packages/react/src/blocks/BaseText.jsx +3 -1
- package/packages/react/src/blocks/button/button.jsx +3 -1
- package/packages/react/src/blocks/columns/columns.jsx +19 -17
- package/packages/react/src/blocks/custom-code/custom-code.jsx +3 -1
- package/packages/react/src/blocks/embed/embed.jsx +3 -1
- package/packages/react/src/blocks/form/form.jsx +3 -2
- package/packages/react/src/blocks/fragment/fragment.jsx +3 -1
- package/packages/react/src/blocks/image/component-info.js +1 -1
- package/packages/react/src/blocks/image/image.jsx +3 -1
- package/packages/react/src/blocks/img/img.jsx +3 -1
- package/packages/react/src/blocks/input/input.jsx +3 -1
- package/packages/react/src/blocks/raw-text/raw-text.jsx +3 -1
- package/packages/react/src/blocks/section/section.jsx +3 -1
- package/packages/react/src/blocks/select/select.jsx +3 -1
- package/packages/react/src/blocks/submit-button/submit-button.jsx +3 -1
- package/packages/react/src/blocks/symbol/symbol.jsx +3 -1
- package/packages/react/src/blocks/text/text.jsx +6 -1
- package/packages/react/src/blocks/textarea/textarea.jsx +3 -1
- package/packages/react/src/blocks/video/video.jsx +3 -1
- package/packages/react/src/components/render-block/block-styles.jsx +3 -1
- package/packages/react/src/components/render-block/render-block.jsx +3 -1
- package/packages/react/src/components/render-block/render-component.jsx +3 -1
- package/packages/react/src/components/render-block/render-repeated-block.jsx +3 -1
- package/packages/react/src/components/render-blocks.jsx +3 -1
- package/packages/react/src/components/render-content/builder-editing.jsx +3 -1
- package/packages/react/src/components/render-content/components/render-styles.jsx +16 -1
- package/packages/react/src/components/render-content/render-content.jsx +13 -16
- package/packages/react/src/components/render-inlined-styles.jsx +3 -1
- package/packages/react/src/functions/is-editing.js +2 -1
- package/packages/react/src/index.js +0 -1
- package/packages/rsc/src/blocks/BaseText.jsx +3 -1
- package/packages/rsc/src/blocks/button/button.jsx +3 -1
- package/packages/rsc/src/blocks/columns/columns.jsx +19 -17
- package/packages/rsc/src/blocks/custom-code/custom-code.jsx +3 -1
- package/packages/rsc/src/blocks/embed/embed.jsx +3 -1
- package/packages/rsc/src/blocks/form/form.jsx +3 -2
- package/packages/rsc/src/blocks/fragment/fragment.jsx +3 -1
- package/packages/rsc/src/blocks/image/component-info.js +1 -1
- package/packages/rsc/src/blocks/image/image.jsx +3 -1
- package/packages/rsc/src/blocks/img/img.jsx +3 -1
- package/packages/rsc/src/blocks/input/input.jsx +3 -1
- package/packages/rsc/src/blocks/raw-text/raw-text.jsx +3 -1
- package/packages/rsc/src/blocks/section/section.jsx +3 -1
- package/packages/rsc/src/blocks/select/select.jsx +3 -1
- package/packages/rsc/src/blocks/submit-button/submit-button.jsx +3 -1
- package/packages/rsc/src/blocks/symbol/symbol.jsx +3 -1
- package/packages/rsc/src/blocks/text/text.jsx +6 -1
- package/packages/rsc/src/blocks/textarea/textarea.jsx +3 -1
- package/packages/rsc/src/blocks/video/video.jsx +3 -1
- package/packages/rsc/src/components/render-block/block-styles.jsx +3 -1
- package/packages/rsc/src/components/render-block/render-block.jsx +3 -1
- package/packages/rsc/src/components/render-block/render-component.jsx +3 -1
- package/packages/rsc/src/components/render-block/render-repeated-block.jsx +3 -1
- package/packages/rsc/src/components/render-blocks.jsx +3 -1
- package/packages/rsc/src/components/render-content/components/render-styles.jsx +16 -1
- package/packages/rsc/src/components/render-content/render-content.jsx +13 -16
- package/packages/rsc/src/components/render-inlined-styles.jsx +3 -1
- package/packages/rsc/src/functions/is-editing.js +2 -1
- package/packages/rsc/src/index.js +0 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { isEditing } from "../../functions/is-editing.js";
|
|
3
|
-
|
|
3
|
+
function ImgComponent(props) {
|
|
4
4
|
const _context = { ...props["_context"] };
|
|
5
5
|
return (React.createElement("img", { style: {
|
|
6
6
|
objectFit: props.backgroundSize || "cover",
|
|
7
7
|
objectPosition: props.backgroundPosition || "center",
|
|
8
8
|
}, key: (isEditing() && props.imgSrc) || "default-key", alt: props.altText, src: props.imgSrc || props.image, ...props.attributes }));
|
|
9
9
|
}
|
|
10
|
+
export default ImgComponent;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { isEditing } from "../../functions/is-editing.js";
|
|
3
|
-
|
|
3
|
+
function FormInputComponent(props) {
|
|
4
4
|
const _context = { ...props["_context"] };
|
|
5
5
|
return (React.createElement("input", { ...props.attributes, key: isEditing() && props.defaultValue ? props.defaultValue : "default-key", placeholder: props.placeholder, type: props.type, name: props.name, value: props.value, defaultValue: props.defaultValue, required: props.required }));
|
|
6
6
|
}
|
|
7
|
+
export default FormInputComponent;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
|
|
2
|
+
function RawText(props) {
|
|
3
3
|
const _context = { ...props["_context"] };
|
|
4
4
|
return (React.createElement("span", { className: props.attributes?.class || props.attributes?.className, dangerouslySetInnerHTML: { __html: props.text || "" } }));
|
|
5
5
|
}
|
|
6
|
+
export default RawText;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
|
|
2
|
+
function SectionComponent(props) {
|
|
3
3
|
const _context = { ...props["_context"] };
|
|
4
4
|
return (React.createElement("section", { ...props.attributes, style: {
|
|
5
5
|
width: "100%",
|
|
@@ -14,3 +14,4 @@ export default function SectionComponent(props) {
|
|
|
14
14
|
marginRight: "auto",
|
|
15
15
|
} }, props.children));
|
|
16
16
|
}
|
|
17
|
+
export default SectionComponent;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { isEditing } from "../../functions/is-editing.js";
|
|
3
|
-
|
|
3
|
+
function SelectComponent(props) {
|
|
4
4
|
const _context = { ...props["_context"] };
|
|
5
5
|
return (React.createElement("select", { ...props.attributes, value: props.value, key: isEditing() && props.defaultValue ? props.defaultValue : "default-key", defaultValue: props.defaultValue, name: props.name }, props.options?.map((option) => (React.createElement("option", { value: option.value }, option.name || option.value)))));
|
|
6
6
|
}
|
|
7
|
+
export default SelectComponent;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
|
|
2
|
+
function SubmitButton(props) {
|
|
3
3
|
const _context = { ...props["_context"] };
|
|
4
4
|
return (React.createElement("button", { type: "submit", ...props.attributes }, props.text));
|
|
5
5
|
}
|
|
6
|
+
export default SubmitButton;
|
|
@@ -3,7 +3,7 @@ import RenderContent from "../../components/render-content/render-content";
|
|
|
3
3
|
import BuilderContext from "../../context/builder.context.js";
|
|
4
4
|
import { getContent } from "../../functions/get-content/index.js";
|
|
5
5
|
import { TARGET } from "../../constants/target";
|
|
6
|
-
|
|
6
|
+
function Symbol(props) {
|
|
7
7
|
const _context = { ...props["_context"] };
|
|
8
8
|
const state = {
|
|
9
9
|
get className() {
|
|
@@ -35,3 +35,4 @@ export default function Symbol(props) {
|
|
|
35
35
|
...props.symbol?.content?.data?.state,
|
|
36
36
|
}, model: props.symbol?.model, content: state.contentToUse, _context: _context })));
|
|
37
37
|
}
|
|
38
|
+
export default Symbol;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
|
|
2
|
+
function Text(props) {
|
|
3
3
|
const _context = { ...props["_context"] };
|
|
4
|
-
return (React.createElement("span", { className: "builder-text", dangerouslySetInnerHTML: { __html: props.text }
|
|
4
|
+
return (React.createElement("span", { className: "builder-text", dangerouslySetInnerHTML: { __html: props.text }, style: {
|
|
5
|
+
outline: "none",
|
|
6
|
+
} }));
|
|
5
7
|
}
|
|
8
|
+
export default Text;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
|
|
2
|
+
function Textarea(props) {
|
|
3
3
|
const _context = { ...props["_context"] };
|
|
4
4
|
return (React.createElement("textarea", { ...props.attributes, placeholder: props.placeholder, name: props.name, value: props.value, defaultValue: props.defaultValue }));
|
|
5
5
|
}
|
|
6
|
+
export default Textarea;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
|
|
2
|
+
function Video(props) {
|
|
3
3
|
const _context = { ...props["_context"] };
|
|
4
4
|
const state = {
|
|
5
5
|
get videoProps() {
|
|
@@ -49,3 +49,4 @@ export default function Video(props) {
|
|
|
49
49
|
borderRadius: 1,
|
|
50
50
|
}, src: props.video || "no-src", poster: props.posterImage }));
|
|
51
51
|
}
|
|
52
|
+
export default Video;
|
|
@@ -5,7 +5,7 @@ import { getProcessedBlock } from "../../functions/get-processed-block.js";
|
|
|
5
5
|
import { createCssClass } from "../../helpers/css.js";
|
|
6
6
|
import { checkIsDefined } from "../../helpers/nullable.js";
|
|
7
7
|
import RenderInlinedStyles from "../render-inlined-styles";
|
|
8
|
-
|
|
8
|
+
function BlockStyles(props) {
|
|
9
9
|
const _context = { ...props["_context"] };
|
|
10
10
|
const state = {
|
|
11
11
|
get useBlock() {
|
|
@@ -60,3 +60,4 @@ export default function BlockStyles(props) {
|
|
|
60
60
|
return (React.createElement(React.Fragment, null, TARGET !== "reactNative" && state.css && state.canShowBlock ? (React.createElement(React.Fragment, null,
|
|
61
61
|
React.createElement(RenderInlinedStyles, { styles: state.css, _context: _context }))) : null));
|
|
62
62
|
}
|
|
63
|
+
export default BlockStyles;
|
|
@@ -12,7 +12,7 @@ import { extractTextStyles } from "../../functions/extract-text-styles.js";
|
|
|
12
12
|
import RenderComponent from "./render-component";
|
|
13
13
|
import { getReactNativeBlockStyles } from "../../functions/get-react-native-block-styles.js";
|
|
14
14
|
import { checkIsDefined } from "../../helpers/nullable.js";
|
|
15
|
-
|
|
15
|
+
function RenderBlock(props) {
|
|
16
16
|
const _context = { ...props["_context"] };
|
|
17
17
|
const state = {
|
|
18
18
|
component: getComponent({
|
|
@@ -150,3 +150,4 @@ export default function RenderBlock(props) {
|
|
|
150
150
|
state.childrenWithoutParentComponent?.map((child) => (React.createElement(RenderBlock, { key: "render-block-" + child.id, block: child, context: state.childrenContext, _context: _context }))),
|
|
151
151
|
state.childrenWithoutParentComponent?.map((child) => (React.createElement(BlockStyles, { key: "block-style-" + child.id, block: child, context: state.childrenContext, _context: _context })))))) : null)) : (React.createElement(RenderComponent, { ...state.renderComponentProps, _context: _context })))) : null));
|
|
152
152
|
}
|
|
153
|
+
export default RenderBlock;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import BlockStyles from "./block-styles";
|
|
3
3
|
import RenderBlock from "./render-block";
|
|
4
|
-
|
|
4
|
+
function RenderComponent(props) {
|
|
5
5
|
const _context = { ...props["_context"] };
|
|
6
6
|
const ComponentRefRef = props.componentRef;
|
|
7
7
|
return (React.createElement(React.Fragment, null, props.componentRef ? (React.createElement(React.Fragment, null,
|
|
@@ -9,3 +9,4 @@ export default function RenderComponent(props) {
|
|
|
9
9
|
props.blockChildren?.map((child) => (React.createElement(RenderBlock, { key: "render-block-" + child.id, block: child, context: props.context, _context: _context }))),
|
|
10
10
|
props.blockChildren?.map((child) => (React.createElement(BlockStyles, { key: "block-style-" + child.id, block: child, context: props.context, _context: _context })))))) : null));
|
|
11
11
|
}
|
|
12
|
+
export default RenderComponent;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import BuilderContext from "../../context/builder.context.js";
|
|
3
3
|
import RenderBlock from "./render-block";
|
|
4
|
-
|
|
4
|
+
function RenderRepeatedBlock(props) {
|
|
5
5
|
const _context = { ...props["_context"] };
|
|
6
6
|
_context.BuilderContext = {
|
|
7
7
|
content: props.repeatContext.content,
|
|
@@ -14,3 +14,4 @@ export default function RenderRepeatedBlock(props) {
|
|
|
14
14
|
};
|
|
15
15
|
return (React.createElement(RenderBlock, { block: props.block, context: props.repeatContext, _context: _context }));
|
|
16
16
|
}
|
|
17
|
+
export default RenderRepeatedBlock;
|
|
@@ -3,7 +3,7 @@ import BuilderContext from "../context/builder.context.js";
|
|
|
3
3
|
import { isEditing } from "../functions/is-editing.js";
|
|
4
4
|
import BlockStyles from "./render-block/block-styles";
|
|
5
5
|
import RenderBlock from "./render-block/render-block";
|
|
6
|
-
|
|
6
|
+
function RenderBlocks(props) {
|
|
7
7
|
const _context = { ...props["_context"] };
|
|
8
8
|
const state = {
|
|
9
9
|
get className() {
|
|
@@ -45,3 +45,4 @@ flex-direction: column;
|
|
|
45
45
|
align-items: stretch;
|
|
46
46
|
}`)));
|
|
47
47
|
}
|
|
48
|
+
export default RenderBlocks;
|
|
@@ -2,7 +2,7 @@ import * as React from "react";
|
|
|
2
2
|
import RenderInlinedStyles from "../../render-inlined-styles";
|
|
3
3
|
import { getCss } from "./render-styles.helpers";
|
|
4
4
|
import { getFontCss } from "./render-styles.helpers";
|
|
5
|
-
|
|
5
|
+
function RenderContentStyles(props) {
|
|
6
6
|
const _context = { ...props["_context"] };
|
|
7
7
|
const state = {
|
|
8
8
|
injectedStyles: `
|
|
@@ -13,7 +13,21 @@ ${getCss({
|
|
|
13
13
|
${getFontCss({
|
|
14
14
|
customFonts: props.customFonts,
|
|
15
15
|
})}
|
|
16
|
+
|
|
17
|
+
.builder-text > p:first-of-type, .builder-text > .builder-paragraph:first-of-type {
|
|
18
|
+
margin: 0;
|
|
19
|
+
}
|
|
20
|
+
.builder-text > p, .builder-text > .builder-paragraph {
|
|
21
|
+
color: inherit;
|
|
22
|
+
line-height: inherit;
|
|
23
|
+
letter-spacing: inherit;
|
|
24
|
+
font-weight: inherit;
|
|
25
|
+
font-size: inherit;
|
|
26
|
+
text-align: inherit;
|
|
27
|
+
font-family: inherit;
|
|
28
|
+
}
|
|
16
29
|
`,
|
|
17
30
|
};
|
|
18
31
|
return (React.createElement(RenderInlinedStyles, { styles: state.injectedStyles, _context: _context }));
|
|
19
32
|
}
|
|
33
|
+
export default RenderContentStyles;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { getDefaultRegisteredComponents } from "../../constants/builder-registered-components.js";
|
|
3
|
-
import { TARGET } from "../../constants/target.js";
|
|
4
3
|
import { evaluate } from "../../functions/evaluate.js";
|
|
5
4
|
import { getContent } from "../../functions/get-content/index.js";
|
|
6
5
|
import { fetch } from "../../functions/get-fetch.js";
|
|
@@ -16,7 +15,8 @@ import { registerInsertMenu, setupBrowserForEditing, } from "../../scripts/init-
|
|
|
16
15
|
import { checkIsDefined } from "../../helpers/nullable.js";
|
|
17
16
|
import { getInteractionPropertiesForEvent } from "../../functions/track/interaction.js";
|
|
18
17
|
import { getContentInitialValue, getContextStateInitialValue, } from "./render-content.helpers.js";
|
|
19
|
-
|
|
18
|
+
import { TARGET } from "../../constants/target.js";
|
|
19
|
+
function RenderContent(props) {
|
|
20
20
|
const _context = { ...props["_context"] };
|
|
21
21
|
const state = {
|
|
22
22
|
forceReRenderCount: 0,
|
|
@@ -185,11 +185,6 @@ export default function RenderContent(props) {
|
|
|
185
185
|
}));
|
|
186
186
|
}
|
|
187
187
|
},
|
|
188
|
-
get shouldRenderContentStyles() {
|
|
189
|
-
return Boolean((state.useContent?.data?.cssCode ||
|
|
190
|
-
state.useContent?.data?.customFonts?.length) &&
|
|
191
|
-
TARGET !== "reactNative");
|
|
192
|
-
},
|
|
193
188
|
};
|
|
194
189
|
_context.builderContext = {
|
|
195
190
|
content: state.useContent,
|
|
@@ -201,6 +196,8 @@ export default function RenderContent(props) {
|
|
|
201
196
|
};
|
|
202
197
|
return (React.createElement(React.Fragment, null, state.useContent ? (React.createElement(React.Fragment, null,
|
|
203
198
|
React.createElement("div", { "builder-content-id": state.useContent?.id, "builder-model": props.model },
|
|
204
|
-
|
|
199
|
+
TARGET !== "reactNative" ? (React.createElement(React.Fragment, null,
|
|
200
|
+
React.createElement(RenderContentStyles, { contentId: state.useContent?.id, cssCode: state.useContent?.data?.cssCode, customFonts: state.useContent?.data?.customFonts, _context: _context }))) : null,
|
|
205
201
|
React.createElement(RenderBlocks, { blocks: state.useContent?.data?.blocks, key: state.forceReRenderCount, _context: _context })))) : null));
|
|
206
202
|
}
|
|
203
|
+
export default RenderContent;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { TARGET } from "../constants/target.js";
|
|
3
|
-
|
|
3
|
+
function RenderInlinedStyles(props) {
|
|
4
4
|
const _context = { ...props["_context"] };
|
|
5
5
|
const state = {
|
|
6
6
|
get injectedStyleScript() {
|
|
@@ -16,3 +16,4 @@ export default function RenderInlinedStyles(props) {
|
|
|
16
16
|
return (React.createElement(React.Fragment, null, TARGET === "svelte" || TARGET === "qwik" ? (React.createElement(React.Fragment, null,
|
|
17
17
|
React.createElement(TagRef, { dangerouslySetInnerHTML: { __html: props.styles } }))) : (React.createElement(TagRef, null, props.styles))));
|
|
18
18
|
}
|
|
19
|
+
export default RenderInlinedStyles;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { TARGET } from "../constants/target.js";
|
|
1
2
|
import { isIframe } from "./is-iframe.js";
|
|
2
3
|
function isEditing() {
|
|
3
|
-
return isIframe() && window.location.search.indexOf("builder.frameEditing=") !== -1;
|
|
4
|
+
return isIframe() && (TARGET === "reactNative" || window.location.search.indexOf("builder.frameEditing=") !== -1);
|
|
4
5
|
}
|
|
5
6
|
export { isEditing };
|
package/dist/rsc/index.js
CHANGED
package/package.json
CHANGED
|
@@ -2,8 +2,10 @@ import * as React from "react";
|
|
|
2
2
|
import { useContext } from "react";
|
|
3
3
|
import BuilderContext from "../context/builder.context.js";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
function BaseText(props) {
|
|
6
6
|
const builderContext = useContext(BuilderContext);
|
|
7
7
|
|
|
8
8
|
return <span style={builderContext.inheritedStyles}>{props.text}</span>;
|
|
9
9
|
}
|
|
10
|
+
|
|
11
|
+
export default BaseText;
|
|
@@ -7,7 +7,7 @@ import { TARGET } from "../../constants/target.js";
|
|
|
7
7
|
import { convertStyleMapToCSS } from "../../helpers/css";
|
|
8
8
|
import BuilderContext from "../../context/builder.context.js";
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
function Columns(props) {
|
|
11
11
|
function getGutterSize() {
|
|
12
12
|
return typeof props.space === "number" ? props.space || 0 : 20;
|
|
13
13
|
}
|
|
@@ -91,26 +91,26 @@ export default function Columns(props) {
|
|
|
91
91
|
|
|
92
92
|
function columnsStyles() {
|
|
93
93
|
return `
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
94
|
+
@media (max-width: ${getWidthForBreakpointSize("medium")}px) {
|
|
95
|
+
.${props.builderBlock.id}-breakpoints {
|
|
96
|
+
${convertStyleMapToCSS(columnStyleObjects().columns.medium)}
|
|
97
|
+
}
|
|
98
98
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
99
|
+
.${props.builderBlock.id}-breakpoints > .builder-column {
|
|
100
|
+
${convertStyleMapToCSS(columnStyleObjects().column.medium)}
|
|
102
101
|
}
|
|
102
|
+
}
|
|
103
103
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
104
|
+
@media (max-width: ${getWidthForBreakpointSize("small")}px) {
|
|
105
|
+
.${props.builderBlock.id}-breakpoints {
|
|
106
|
+
${convertStyleMapToCSS(columnStyleObjects().columns.small)}
|
|
107
|
+
}
|
|
108
108
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
109
|
+
.${props.builderBlock.id}-breakpoints > .builder-column {
|
|
110
|
+
${convertStyleMapToCSS(columnStyleObjects().column.small)}
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
`;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
function reactNativeColumnsStyles() {
|
|
@@ -174,3 +174,5 @@ align-items: stretch;
|
|
|
174
174
|
</>
|
|
175
175
|
);
|
|
176
176
|
}
|
|
177
|
+
|
|
178
|
+
export default Columns;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { useState, useRef, useEffect } from "react";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
function CustomCode(props) {
|
|
5
5
|
const elem = useRef(null);
|
|
6
6
|
const [scriptsInserted, setScriptsInserted] = useState(() => []);
|
|
7
7
|
|
|
@@ -62,3 +62,5 @@ export default function CustomCode(props) {
|
|
|
62
62
|
/>
|
|
63
63
|
);
|
|
64
64
|
}
|
|
65
|
+
|
|
66
|
+
export default CustomCode;
|
|
@@ -2,7 +2,7 @@ import * as React from "react";
|
|
|
2
2
|
import { useState, useRef, useEffect } from "react";
|
|
3
3
|
import { isJsScript } from "./helpers.js";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
function Embed(props) {
|
|
6
6
|
const elem = useRef(null);
|
|
7
7
|
const [scriptsInserted, setScriptsInserted] = useState(() => []);
|
|
8
8
|
|
|
@@ -47,3 +47,5 @@ export default function Embed(props) {
|
|
|
47
47
|
/>
|
|
48
48
|
);
|
|
49
49
|
}
|
|
50
|
+
|
|
51
|
+
export default Embed;
|
|
@@ -4,7 +4,7 @@ import RenderBlock from "../../components/render-block/render-block";
|
|
|
4
4
|
import BuilderBlocks from "../../components/render-blocks";
|
|
5
5
|
import { isEditing } from "../../functions/is-editing.js";
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
function FormComponent(props) {
|
|
8
8
|
const formRef = useRef(null);
|
|
9
9
|
const [formState, setFormState] = useState(() => "unsubmitted");
|
|
10
10
|
|
|
@@ -137,7 +137,7 @@ export default function FormComponent(props) {
|
|
|
137
137
|
get(body, props.errorMessagePath);
|
|
138
138
|
if (message) {
|
|
139
139
|
if (typeof message !== "string") {
|
|
140
|
-
/* TODO: ideally convert json to yaml so it woul dbe like
|
|
140
|
+
/* TODO: ideally convert json to yaml so it woul dbe like error: - email has been taken */ message =
|
|
141
141
|
JSON.stringify(message);
|
|
142
142
|
}
|
|
143
143
|
setFormErrorMessage(message);
|
|
@@ -251,3 +251,4 @@ export default function FormComponent(props) {
|
|
|
251
251
|
</>
|
|
252
252
|
);
|
|
253
253
|
}
|
|
254
|
+
export default FormComponent;
|
|
@@ -17,7 +17,7 @@ const componentInfo = {
|
|
|
17
17
|
bubble: true,
|
|
18
18
|
allowedFileTypes: ["jpeg", "jpg", "png", "svg"],
|
|
19
19
|
required: true,
|
|
20
|
-
defaultValue: "https://cdn.builder.io/api/v1/image/assets%
|
|
20
|
+
defaultValue: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F72c80f114dc149019051b6852a9e3b7a",
|
|
21
21
|
onChange: serializeFn((options) => {
|
|
22
22
|
const DEFAULT_ASPECT_RATIO = 0.7041;
|
|
23
23
|
options.delete("srcset");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { getSrcSet } from "./image.helpers.js";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
function Image(props) {
|
|
5
5
|
function srcSetToUse() {
|
|
6
6
|
const imageToUse = props.image || props.src;
|
|
7
7
|
const url = imageToUse;
|
|
@@ -118,3 +118,5 @@ height: 100%;
|
|
|
118
118
|
</>
|
|
119
119
|
);
|
|
120
120
|
}
|
|
121
|
+
|
|
122
|
+
export default Image;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { isEditing } from "../../functions/is-editing.js";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
function ImgComponent(props) {
|
|
5
5
|
return (
|
|
6
6
|
<img
|
|
7
7
|
style={{
|
|
@@ -15,3 +15,5 @@ export default function ImgComponent(props) {
|
|
|
15
15
|
/>
|
|
16
16
|
);
|
|
17
17
|
}
|
|
18
|
+
|
|
19
|
+
export default ImgComponent;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { isEditing } from "../../functions/is-editing.js";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
function FormInputComponent(props) {
|
|
5
5
|
return (
|
|
6
6
|
<input
|
|
7
7
|
{...props.attributes}
|
|
@@ -17,3 +17,5 @@ export default function FormInputComponent(props) {
|
|
|
17
17
|
/>
|
|
18
18
|
);
|
|
19
19
|
}
|
|
20
|
+
|
|
21
|
+
export default FormInputComponent;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
function RawText(props) {
|
|
4
4
|
return (
|
|
5
5
|
<span
|
|
6
6
|
className={props.attributes?.class || props.attributes?.className}
|
|
@@ -8,3 +8,5 @@ export default function RawText(props) {
|
|
|
8
8
|
/>
|
|
9
9
|
);
|
|
10
10
|
}
|
|
11
|
+
|
|
12
|
+
export default RawText;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
function SectionComponent(props) {
|
|
4
4
|
return (
|
|
5
5
|
<section
|
|
6
6
|
{...props.attributes}
|
|
@@ -21,3 +21,5 @@ export default function SectionComponent(props) {
|
|
|
21
21
|
</section>
|
|
22
22
|
);
|
|
23
23
|
}
|
|
24
|
+
|
|
25
|
+
export default SectionComponent;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { isEditing } from "../../functions/is-editing.js";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
function SelectComponent(props) {
|
|
5
5
|
return (
|
|
6
6
|
<select
|
|
7
7
|
{...props.attributes}
|
|
@@ -18,3 +18,5 @@ export default function SelectComponent(props) {
|
|
|
18
18
|
</select>
|
|
19
19
|
);
|
|
20
20
|
}
|
|
21
|
+
|
|
22
|
+
export default SelectComponent;
|
|
@@ -5,7 +5,7 @@ import BuilderContext from "../../context/builder.context.js";
|
|
|
5
5
|
import { getContent } from "../../functions/get-content/index.js";
|
|
6
6
|
import { TARGET } from "../../constants/target";
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
function Symbol(props) {
|
|
9
9
|
function className() {
|
|
10
10
|
return [
|
|
11
11
|
...(TARGET === "vue2" || TARGET === "vue3"
|
|
@@ -84,3 +84,5 @@ export default function Symbol(props) {
|
|
|
84
84
|
</div>
|
|
85
85
|
);
|
|
86
86
|
}
|
|
87
|
+
|
|
88
|
+
export default Symbol;
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
function Text(props) {
|
|
4
4
|
return (
|
|
5
5
|
<span
|
|
6
6
|
className="builder-text"
|
|
7
7
|
dangerouslySetInnerHTML={{ __html: props.text }}
|
|
8
|
+
style={{
|
|
9
|
+
outline: "none",
|
|
10
|
+
}}
|
|
8
11
|
/>
|
|
9
12
|
);
|
|
10
13
|
}
|
|
14
|
+
|
|
15
|
+
export default Text;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
function Textarea(props) {
|
|
4
4
|
return (
|
|
5
5
|
<textarea
|
|
6
6
|
{...props.attributes}
|
|
@@ -11,3 +11,5 @@ export default function Textarea(props) {
|
|
|
11
11
|
/>
|
|
12
12
|
);
|
|
13
13
|
}
|
|
14
|
+
|
|
15
|
+
export default Textarea;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
function Video(props) {
|
|
4
4
|
function videoProps() {
|
|
5
5
|
return {
|
|
6
6
|
...(props.autoPlay === true
|
|
@@ -56,3 +56,5 @@ export default function Video(props) {
|
|
|
56
56
|
/>
|
|
57
57
|
);
|
|
58
58
|
}
|
|
59
|
+
|
|
60
|
+
export default Video;
|
|
@@ -9,7 +9,7 @@ import { createCssClass } from "../../helpers/css.js";
|
|
|
9
9
|
import { checkIsDefined } from "../../helpers/nullable.js";
|
|
10
10
|
import RenderInlinedStyles from "../render-inlined-styles";
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
function BlockStyles(props) {
|
|
13
13
|
function useBlock() {
|
|
14
14
|
return getProcessedBlock({
|
|
15
15
|
block: props.block,
|
|
@@ -79,3 +79,5 @@ export default function BlockStyles(props) {
|
|
|
79
79
|
</>
|
|
80
80
|
);
|
|
81
81
|
}
|
|
82
|
+
|
|
83
|
+
export default BlockStyles;
|