@builder.io/sdk-react-native 0.0.1-55 โ 0.0.1-56
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/CHANGELOG.md +5 -0
- package/package.json +1 -1
- package/src/components/render-block/block-styles.js +16 -4
- package/src/components/render-block/block-styles.lite.tsx +25 -3
- package/src/components/render-block/render-block.js +26 -29
- package/src/components/render-block/render-block.lite.tsx +40 -36
- package/src/components/render-block/render-component.js +33 -0
- package/src/components/render-block/render-component.lite.tsx +26 -0
- package/src/components/render-blocks.js +10 -6
- package/src/components/render-blocks.lite.tsx +10 -1
- package/src/functions/get-block-component-options.js +6 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
### 0.0.1-55
|
|
2
|
+
|
|
3
|
+
๐ Fix: custom components were not rendering correctly
|
|
4
|
+
๐ Fix: Image component's `srcSet` was not being set correctly
|
|
5
|
+
|
|
1
6
|
### 0.0.1-52
|
|
2
7
|
|
|
3
8
|
๐งจ Breaking change: the format of the `customComponents` prop has changed from `[{ component, info }]` to `[{ component, ...info }]`.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@builder.io/sdk-react-native",
|
|
3
3
|
"description": "Builder.io SDK for React Native",
|
|
4
|
-
"version": "0.0.1-
|
|
4
|
+
"version": "0.0.1-56",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"release:dev": "npm version prerelease --no-git-tag-version && npm publish --tag dev --access public"
|
|
@@ -1,16 +1,27 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { useContext } from "react";
|
|
3
|
+
import { TARGET } from "../../constants/target.js";
|
|
4
|
+
import BuilderContext from "../../context/builder.context";
|
|
5
|
+
import { getProcessedBlock } from "../../functions/get-processed-block.js";
|
|
2
6
|
import RenderInlinedStyles from "../render-inlined-styles.js";
|
|
3
7
|
function BlockStyles(props) {
|
|
8
|
+
function useBlock() {
|
|
9
|
+
return getProcessedBlock({
|
|
10
|
+
block: props.block,
|
|
11
|
+
state: builderContext.state,
|
|
12
|
+
context: builderContext.context
|
|
13
|
+
});
|
|
14
|
+
}
|
|
4
15
|
function camelToKebabCase(string) {
|
|
5
16
|
return string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
|
|
6
17
|
}
|
|
7
18
|
function css() {
|
|
8
19
|
var _a;
|
|
9
|
-
const styleObject = (_a =
|
|
20
|
+
const styleObject = (_a = useBlock().responsiveStyles) == null ? void 0 : _a.large;
|
|
10
21
|
if (!styleObject) {
|
|
11
22
|
return "";
|
|
12
23
|
}
|
|
13
|
-
let str = `.${
|
|
24
|
+
let str = `.${useBlock().id} {`;
|
|
14
25
|
for (const key in styleObject) {
|
|
15
26
|
const value = styleObject[key];
|
|
16
27
|
if (typeof value === "string") {
|
|
@@ -20,9 +31,10 @@ function BlockStyles(props) {
|
|
|
20
31
|
str += "}";
|
|
21
32
|
return str;
|
|
22
33
|
}
|
|
23
|
-
|
|
34
|
+
const builderContext = useContext(BuilderContext);
|
|
35
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, TARGET === "vue" || TARGET === "svelte" ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(RenderInlinedStyles, {
|
|
24
36
|
styles: css()
|
|
25
|
-
});
|
|
37
|
+
})) : null);
|
|
26
38
|
}
|
|
27
39
|
export {
|
|
28
40
|
BlockStyles as default
|
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { View, StyleSheet, Image, Text } from "react-native";
|
|
3
|
+
import { useContext } from "react";
|
|
4
|
+
import { TARGET } from "../../constants/target.js";
|
|
5
|
+
import BuilderContext from "../../context/builder.context";
|
|
6
|
+
import { getProcessedBlock } from "../../functions/get-processed-block.js";
|
|
3
7
|
import RenderInlinedStyles from "../render-inlined-styles.lite";
|
|
4
8
|
|
|
5
9
|
export default function BlockStyles(props) {
|
|
10
|
+
function useBlock() {
|
|
11
|
+
return getProcessedBlock({
|
|
12
|
+
block: props.block,
|
|
13
|
+
state: builderContext.state,
|
|
14
|
+
context: builderContext.context,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
6
18
|
function camelToKebabCase(string) {
|
|
7
19
|
return string
|
|
8
20
|
.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2")
|
|
@@ -11,13 +23,13 @@ export default function BlockStyles(props) {
|
|
|
11
23
|
|
|
12
24
|
function css() {
|
|
13
25
|
// TODO: media queries
|
|
14
|
-
const styleObject =
|
|
26
|
+
const styleObject = useBlock().responsiveStyles?.large;
|
|
15
27
|
|
|
16
28
|
if (!styleObject) {
|
|
17
29
|
return "";
|
|
18
30
|
}
|
|
19
31
|
|
|
20
|
-
let str = `.${
|
|
32
|
+
let str = `.${useBlock().id} {`;
|
|
21
33
|
|
|
22
34
|
for (const key in styleObject) {
|
|
23
35
|
const value = styleObject[key];
|
|
@@ -31,5 +43,15 @@ export default function BlockStyles(props) {
|
|
|
31
43
|
return str;
|
|
32
44
|
}
|
|
33
45
|
|
|
34
|
-
|
|
46
|
+
const builderContext = useContext(BuilderContext);
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<>
|
|
50
|
+
{TARGET === "vue" || TARGET === "svelte" ? (
|
|
51
|
+
<>
|
|
52
|
+
<RenderInlinedStyles styles={css()} />
|
|
53
|
+
</>
|
|
54
|
+
) : null}
|
|
55
|
+
</>
|
|
56
|
+
);
|
|
35
57
|
}
|
|
@@ -31,7 +31,6 @@ var __objRest = (source, exclude) => {
|
|
|
31
31
|
};
|
|
32
32
|
import * as React from "react";
|
|
33
33
|
import { useContext } from "react";
|
|
34
|
-
import { TARGET } from "../../constants/target.js";
|
|
35
34
|
import BuilderContext from "../../context/builder.context";
|
|
36
35
|
import { getBlockActions } from "../../functions/get-block-actions.js";
|
|
37
36
|
import { getBlockComponentOptions } from "../../functions/get-block-component-options.js";
|
|
@@ -41,8 +40,9 @@ import { getBlockTag } from "../../functions/get-block-tag.js";
|
|
|
41
40
|
import { getProcessedBlock } from "../../functions/get-processed-block.js";
|
|
42
41
|
import BlockStyles from "./block-styles.js";
|
|
43
42
|
import { isEmptyHtmlElement } from "./render-block.helpers.js";
|
|
43
|
+
import RenderComponent from "./render-component.js";
|
|
44
44
|
function RenderBlock(props) {
|
|
45
|
-
var _a, _b
|
|
45
|
+
var _a, _b;
|
|
46
46
|
function component() {
|
|
47
47
|
var _a2;
|
|
48
48
|
const componentName = (_a2 = useBlock().component) == null ? void 0 : _a2.name;
|
|
@@ -81,18 +81,23 @@ function RenderBlock(props) {
|
|
|
81
81
|
context: builderContext.context
|
|
82
82
|
});
|
|
83
83
|
}
|
|
84
|
-
function
|
|
85
|
-
return __spreadValues(__spreadValues({}, getBlockProperties(useBlock())), getBlockActions({
|
|
84
|
+
function attributes() {
|
|
85
|
+
return __spreadProps(__spreadValues(__spreadValues({}, getBlockProperties(useBlock())), getBlockActions({
|
|
86
86
|
block: useBlock(),
|
|
87
87
|
state: builderContext.state,
|
|
88
88
|
context: builderContext.context
|
|
89
|
-
}))
|
|
89
|
+
})), {
|
|
90
|
+
style: getBlockStyles(useBlock())
|
|
91
|
+
});
|
|
90
92
|
}
|
|
91
|
-
function
|
|
92
|
-
|
|
93
|
+
function shouldWrap() {
|
|
94
|
+
var _a2;
|
|
95
|
+
return !((_a2 = componentInfo == null ? void 0 : componentInfo()) == null ? void 0 : _a2.noWrap);
|
|
93
96
|
}
|
|
94
97
|
function componentOptions() {
|
|
95
|
-
return getBlockComponentOptions(useBlock())
|
|
98
|
+
return __spreadValues(__spreadValues({}, getBlockComponentOptions(useBlock())), shouldWrap() ? {} : {
|
|
99
|
+
attributes: attributes()
|
|
100
|
+
});
|
|
96
101
|
}
|
|
97
102
|
function children() {
|
|
98
103
|
var _a2;
|
|
@@ -102,30 +107,22 @@ function RenderBlock(props) {
|
|
|
102
107
|
return componentRef() ? [] : children();
|
|
103
108
|
}
|
|
104
109
|
const builderContext = useContext(BuilderContext);
|
|
105
|
-
const ComponentRefRef = componentRef();
|
|
106
110
|
const TagNameRef = tagName();
|
|
107
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null,
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}))
|
|
112
|
-
|
|
113
|
-
}), (_b = children()) == null ? void 0 : _b.map((child) => /* @__PURE__ */ React.createElement(RenderBlock, {
|
|
114
|
-
key: child.id,
|
|
115
|
-
block: child
|
|
116
|
-
}))) : null, (_c = noCompRefChildren()) == null ? void 0 : _c.map((child) => /* @__PURE__ */ React.createElement(RenderBlock, {
|
|
117
|
-
key: child.id,
|
|
111
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, shouldWrap() ? /* @__PURE__ */ React.createElement(React.Fragment, null, !isEmptyHtmlElement(tagName()) ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(TagNameRef, __spreadValues({}, attributes()), /* @__PURE__ */ React.createElement(RenderComponent, {
|
|
112
|
+
blockChildren: children(),
|
|
113
|
+
componentRef: componentRef(),
|
|
114
|
+
componentOptions: componentOptions()
|
|
115
|
+
}), (_a = noCompRefChildren()) == null ? void 0 : _a.map((child) => /* @__PURE__ */ React.createElement(RenderBlock, {
|
|
116
|
+
key: "render-block-" + child.id,
|
|
118
117
|
block: child
|
|
119
|
-
})))) : /* @__PURE__ */ React.createElement(
|
|
120
|
-
|
|
121
|
-
}))) : /* @__PURE__ */ React.createElement(ComponentRefRef, __spreadProps(__spreadValues({}, componentOptions()), {
|
|
122
|
-
attributes: propertiesAndActions(),
|
|
123
|
-
builderBlock: useBlock(),
|
|
124
|
-
style: css()
|
|
125
|
-
}), (_d = children()) == null ? void 0 : _d.map((child) => /* @__PURE__ */ React.createElement(RenderBlock, {
|
|
126
|
-
key: child.id,
|
|
118
|
+
})), (_b = noCompRefChildren()) == null ? void 0 : _b.map((child) => /* @__PURE__ */ React.createElement(BlockStyles, {
|
|
119
|
+
key: "block-style-" + child.id,
|
|
127
120
|
block: child
|
|
128
|
-
}))))
|
|
121
|
+
})))) : /* @__PURE__ */ React.createElement(TagNameRef, __spreadValues({}, attributes()))) : /* @__PURE__ */ React.createElement(RenderComponent, {
|
|
122
|
+
blockChildren: children(),
|
|
123
|
+
componentRef: componentRef(),
|
|
124
|
+
componentOptions: componentOptions()
|
|
125
|
+
}));
|
|
129
126
|
}
|
|
130
127
|
export {
|
|
131
128
|
RenderBlock as default
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { View, StyleSheet, Image, Text } from "react-native";
|
|
3
3
|
import { useContext } from "react";
|
|
4
|
-
import { TARGET } from "../../constants/target.js";
|
|
5
4
|
import BuilderContext from "../../context/builder.context";
|
|
6
5
|
import { getBlockActions } from "../../functions/get-block-actions.js";
|
|
7
6
|
import { getBlockComponentOptions } from "../../functions/get-block-component-options.js";
|
|
@@ -11,6 +10,7 @@ import { getBlockTag } from "../../functions/get-block-tag.js";
|
|
|
11
10
|
import { getProcessedBlock } from "../../functions/get-processed-block.js";
|
|
12
11
|
import BlockStyles from "./block-styles.lite";
|
|
13
12
|
import { isEmptyHtmlElement } from "./render-block.helpers.js";
|
|
13
|
+
import RenderComponent from "./render-component.lite";
|
|
14
14
|
|
|
15
15
|
export default function RenderBlock(props) {
|
|
16
16
|
function component() {
|
|
@@ -58,7 +58,7 @@ export default function RenderBlock(props) {
|
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
function
|
|
61
|
+
function attributes() {
|
|
62
62
|
return {
|
|
63
63
|
...getBlockProperties(useBlock()),
|
|
64
64
|
...getBlockActions({
|
|
@@ -66,15 +66,28 @@ export default function RenderBlock(props) {
|
|
|
66
66
|
state: builderContext.state,
|
|
67
67
|
context: builderContext.context,
|
|
68
68
|
}),
|
|
69
|
+
style: getBlockStyles(useBlock()),
|
|
69
70
|
};
|
|
70
71
|
}
|
|
71
72
|
|
|
72
|
-
function
|
|
73
|
-
return
|
|
73
|
+
function shouldWrap() {
|
|
74
|
+
return !componentInfo?.()?.noWrap;
|
|
74
75
|
}
|
|
75
76
|
|
|
76
77
|
function componentOptions() {
|
|
77
|
-
return
|
|
78
|
+
return {
|
|
79
|
+
...getBlockComponentOptions(useBlock()),
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* These attributes are passed to the wrapper element when there is one. If `noWrap` is set to true, then
|
|
83
|
+
* they are provided to the component itself directly.
|
|
84
|
+
*/
|
|
85
|
+
...(shouldWrap()
|
|
86
|
+
? {}
|
|
87
|
+
: {
|
|
88
|
+
attributes: attributes(),
|
|
89
|
+
}),
|
|
90
|
+
};
|
|
78
91
|
}
|
|
79
92
|
|
|
80
93
|
function children() {
|
|
@@ -86,58 +99,49 @@ export default function RenderBlock(props) {
|
|
|
86
99
|
}
|
|
87
100
|
|
|
88
101
|
function noCompRefChildren() {
|
|
102
|
+
/**
|
|
103
|
+
* When there is no `componentRef`, there might still be children that need to be rendered. In this case,
|
|
104
|
+
* we render them outside of `componentRef`
|
|
105
|
+
*/
|
|
89
106
|
return componentRef() ? [] : children();
|
|
90
107
|
}
|
|
91
108
|
|
|
92
109
|
const builderContext = useContext(BuilderContext);
|
|
93
110
|
|
|
94
|
-
const ComponentRefRef = componentRef();
|
|
95
111
|
const TagNameRef = tagName();
|
|
96
112
|
|
|
97
113
|
return (
|
|
98
114
|
<>
|
|
99
|
-
{
|
|
115
|
+
{shouldWrap() ? (
|
|
100
116
|
<>
|
|
101
117
|
{!isEmptyHtmlElement(tagName()) ? (
|
|
102
118
|
<>
|
|
103
|
-
<TagNameRef {...
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
{
|
|
111
|
-
<
|
|
112
|
-
|
|
113
|
-
builderBlock={useBlock()}
|
|
114
|
-
>
|
|
115
|
-
{children()?.map((child) => (
|
|
116
|
-
<RenderBlock key={child.id} block={child} />
|
|
117
|
-
))}
|
|
118
|
-
</ComponentRefRef>
|
|
119
|
-
) : null}
|
|
119
|
+
<TagNameRef {...attributes()}>
|
|
120
|
+
<RenderComponent
|
|
121
|
+
blockChildren={children()}
|
|
122
|
+
componentRef={componentRef()}
|
|
123
|
+
componentOptions={componentOptions()}
|
|
124
|
+
/>
|
|
125
|
+
|
|
126
|
+
{noCompRefChildren()?.map((child) => (
|
|
127
|
+
<RenderBlock key={"render-block-" + child.id} block={child} />
|
|
128
|
+
))}
|
|
120
129
|
|
|
121
130
|
{noCompRefChildren()?.map((child) => (
|
|
122
|
-
<
|
|
131
|
+
<BlockStyles key={"block-style-" + child.id} block={child} />
|
|
123
132
|
))}
|
|
124
133
|
</TagNameRef>
|
|
125
134
|
</>
|
|
126
135
|
) : (
|
|
127
|
-
<TagNameRef {...
|
|
136
|
+
<TagNameRef {...attributes()} />
|
|
128
137
|
)}
|
|
129
138
|
</>
|
|
130
139
|
) : (
|
|
131
|
-
<
|
|
132
|
-
{
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
>
|
|
137
|
-
{children()?.map((child) => (
|
|
138
|
-
<RenderBlock key={child.id} block={child} />
|
|
139
|
-
))}
|
|
140
|
-
</ComponentRefRef>
|
|
140
|
+
<RenderComponent
|
|
141
|
+
blockChildren={children()}
|
|
142
|
+
componentRef={componentRef()}
|
|
143
|
+
componentOptions={componentOptions()}
|
|
144
|
+
/>
|
|
141
145
|
)}
|
|
142
146
|
</>
|
|
143
147
|
);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
17
|
+
import * as React from "react";
|
|
18
|
+
import BlockStyles from "./block-styles.js";
|
|
19
|
+
import RenderBlock from "./render-block.js";
|
|
20
|
+
function RenderComponent(props) {
|
|
21
|
+
var _a, _b;
|
|
22
|
+
const ComponentRefRef = props.componentRef;
|
|
23
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, props.componentRef ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ComponentRefRef, __spreadValues({}, props.componentOptions), (_a = props.blockChildren) == null ? void 0 : _a.map((child) => /* @__PURE__ */ React.createElement(RenderBlock, {
|
|
24
|
+
key: "render-block-" + child.id,
|
|
25
|
+
block: child
|
|
26
|
+
})), (_b = props.blockChildren) == null ? void 0 : _b.map((child) => /* @__PURE__ */ React.createElement(BlockStyles, {
|
|
27
|
+
key: "block-style-" + child.id,
|
|
28
|
+
block: child
|
|
29
|
+
})))) : null);
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
RenderComponent as default
|
|
33
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { View, StyleSheet, Image, Text } from "react-native";
|
|
3
|
+
import BlockStyles from "./block-styles.lite";
|
|
4
|
+
import RenderBlock from "./render-block.lite";
|
|
5
|
+
|
|
6
|
+
export default function RenderComponent(props) {
|
|
7
|
+
const ComponentRefRef = props.componentRef;
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<>
|
|
11
|
+
{props.componentRef ? (
|
|
12
|
+
<>
|
|
13
|
+
<ComponentRefRef {...props.componentOptions}>
|
|
14
|
+
{props.blockChildren?.map((child) => (
|
|
15
|
+
<RenderBlock key={"render-block-" + child.id} block={child} />
|
|
16
|
+
))}
|
|
17
|
+
|
|
18
|
+
{props.blockChildren?.map((child) => (
|
|
19
|
+
<BlockStyles key={"block-style-" + child.id} block={child} />
|
|
20
|
+
))}
|
|
21
|
+
</ComponentRefRef>
|
|
22
|
+
</>
|
|
23
|
+
) : null}
|
|
24
|
+
</>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { View, StyleSheet } from "react-native";
|
|
3
3
|
import { isEditing } from "../functions/is-editing.js";
|
|
4
|
+
import BlockStyles from "./render-block/block-styles.js";
|
|
4
5
|
import RenderBlock from "./render-block/render-block.js";
|
|
5
6
|
function RenderBlocks(props) {
|
|
6
|
-
var _a;
|
|
7
|
+
var _a, _b;
|
|
7
8
|
function className() {
|
|
8
9
|
var _a2;
|
|
9
10
|
return "builder-blocks" + (!((_a2 = props.blocks) == null ? void 0 : _a2.length) ? " no-blocks" : "");
|
|
10
11
|
}
|
|
11
12
|
function onClick() {
|
|
12
|
-
var _a2,
|
|
13
|
+
var _a2, _b2;
|
|
13
14
|
if (isEditing() && !((_a2 = props.blocks) == null ? void 0 : _a2.length)) {
|
|
14
|
-
(
|
|
15
|
+
(_b2 = window.parent) == null ? void 0 : _b2.postMessage({
|
|
15
16
|
type: "builder.clickEmptyBlocks",
|
|
16
17
|
data: {
|
|
17
18
|
parentElementId: props.parent,
|
|
@@ -21,9 +22,9 @@ function RenderBlocks(props) {
|
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
24
|
function onMouseEnter() {
|
|
24
|
-
var _a2,
|
|
25
|
+
var _a2, _b2;
|
|
25
26
|
if (isEditing() && !((_a2 = props.blocks) == null ? void 0 : _a2.length)) {
|
|
26
|
-
(
|
|
27
|
+
(_b2 = window.parent) == null ? void 0 : _b2.postMessage({
|
|
27
28
|
type: "builder.hoverEmptyBlocks",
|
|
28
29
|
data: {
|
|
29
30
|
parentElementId: props.parent,
|
|
@@ -42,7 +43,10 @@ function RenderBlocks(props) {
|
|
|
42
43
|
onMouseEnter: (event) => onMouseEnter(),
|
|
43
44
|
style: styles.view1
|
|
44
45
|
}, props.blocks ? /* @__PURE__ */ React.createElement(React.Fragment, null, (_a = props.blocks) == null ? void 0 : _a.map((block) => /* @__PURE__ */ React.createElement(RenderBlock, {
|
|
45
|
-
key: block.id,
|
|
46
|
+
key: "render-block-" + block.id,
|
|
47
|
+
block
|
|
48
|
+
}))) : null, props.blocks ? /* @__PURE__ */ React.createElement(React.Fragment, null, (_b = props.blocks) == null ? void 0 : _b.map((block) => /* @__PURE__ */ React.createElement(BlockStyles, {
|
|
49
|
+
key: "block-style-" + block.id,
|
|
46
50
|
block
|
|
47
51
|
}))) : null);
|
|
48
52
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { View, StyleSheet, Image, Text } from "react-native";
|
|
3
3
|
import { isEditing } from "../functions/is-editing.js";
|
|
4
|
+
import BlockStyles from "./render-block/block-styles.lite";
|
|
4
5
|
import RenderBlock from "./render-block/render-block.lite";
|
|
5
6
|
|
|
6
7
|
export default function RenderBlocks(props) {
|
|
@@ -52,7 +53,15 @@ export default function RenderBlocks(props) {
|
|
|
52
53
|
{props.blocks ? (
|
|
53
54
|
<>
|
|
54
55
|
{props.blocks?.map((block) => (
|
|
55
|
-
<RenderBlock key={block.id} block={block} />
|
|
56
|
+
<RenderBlock key={"render-block-" + block.id} block={block} />
|
|
57
|
+
))}
|
|
58
|
+
</>
|
|
59
|
+
) : null}
|
|
60
|
+
|
|
61
|
+
{props.blocks ? (
|
|
62
|
+
<>
|
|
63
|
+
{props.blocks?.map((block) => (
|
|
64
|
+
<BlockStyles key={"block-style-" + block.id} block={block} />
|
|
56
65
|
))}
|
|
57
66
|
</>
|
|
58
67
|
) : null}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
3
5
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
4
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
7
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
@@ -15,9 +17,12 @@ var __spreadValues = (a, b) => {
|
|
|
15
17
|
}
|
|
16
18
|
return a;
|
|
17
19
|
};
|
|
20
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
18
21
|
function getBlockComponentOptions(block) {
|
|
19
22
|
var _a;
|
|
20
|
-
return __spreadValues(__spreadValues({}, (_a = block.component) == null ? void 0 : _a.options), block.options)
|
|
23
|
+
return __spreadProps(__spreadValues(__spreadValues({}, (_a = block.component) == null ? void 0 : _a.options), block.options), {
|
|
24
|
+
builderBlock: block
|
|
25
|
+
});
|
|
21
26
|
}
|
|
22
27
|
export {
|
|
23
28
|
getBlockComponentOptions
|