@builder.io/sdk-react-native 0.0.1-53 โ 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 +10 -0
- package/package.json +1 -1
- package/src/blocks/image/image.lite.tsx +1 -1
- package/src/blocks/symbol/component-info.js +1 -0
- 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 +44 -31
- package/src/components/render-block/render-block.lite.tsx +46 -37
- 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/constants/builder-registered-components.js +23 -7
- package/src/functions/get-block-component-options.js +6 -1
- package/src/functions/get-block-styles.js +1 -1
- package/src/functions/macro-eval.js +0 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
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
|
+
|
|
6
|
+
### 0.0.1-52
|
|
7
|
+
|
|
8
|
+
๐งจ Breaking change: the format of the `customComponents` prop has changed from `[{ component, info }]` to `[{ component, ...info }]`.
|
|
9
|
+
See [builder-registered-components.ts](/packages/sdks/src/constants/builder-registered-components.ts) for examples of how to do so, or see the example provided for this SDK.
|
|
10
|
+
|
|
1
11
|
### 0.0.1-51
|
|
2
12
|
|
|
3
13
|
โ ๏ธ Deprecation notice: Registering components via `registerComponent(component, info)` is now deprecated.
|
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
|
}
|
|
@@ -17,9 +17,20 @@ var __spreadValues = (a, b) => {
|
|
|
17
17
|
return a;
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
20
32
|
import * as React from "react";
|
|
21
33
|
import { useContext } from "react";
|
|
22
|
-
import { TARGET } from "../../constants/target.js";
|
|
23
34
|
import BuilderContext from "../../context/builder.context";
|
|
24
35
|
import { getBlockActions } from "../../functions/get-block-actions.js";
|
|
25
36
|
import { getBlockComponentOptions } from "../../functions/get-block-component-options.js";
|
|
@@ -29,8 +40,9 @@ import { getBlockTag } from "../../functions/get-block-tag.js";
|
|
|
29
40
|
import { getProcessedBlock } from "../../functions/get-processed-block.js";
|
|
30
41
|
import BlockStyles from "./block-styles.js";
|
|
31
42
|
import { isEmptyHtmlElement } from "./render-block.helpers.js";
|
|
43
|
+
import RenderComponent from "./render-component.js";
|
|
32
44
|
function RenderBlock(props) {
|
|
33
|
-
var _a, _b
|
|
45
|
+
var _a, _b;
|
|
34
46
|
function component() {
|
|
35
47
|
var _a2;
|
|
36
48
|
const componentName = (_a2 = useBlock().component) == null ? void 0 : _a2.name;
|
|
@@ -48,8 +60,12 @@ function RenderBlock(props) {
|
|
|
48
60
|
}
|
|
49
61
|
}
|
|
50
62
|
function componentInfo() {
|
|
51
|
-
|
|
52
|
-
|
|
63
|
+
if (component()) {
|
|
64
|
+
const _a2 = component(), { component: _ } = _a2, info = __objRest(_a2, ["component"]);
|
|
65
|
+
return info;
|
|
66
|
+
} else {
|
|
67
|
+
return void 0;
|
|
68
|
+
}
|
|
53
69
|
}
|
|
54
70
|
function componentRef() {
|
|
55
71
|
var _a2;
|
|
@@ -65,18 +81,23 @@ function RenderBlock(props) {
|
|
|
65
81
|
context: builderContext.context
|
|
66
82
|
});
|
|
67
83
|
}
|
|
68
|
-
function
|
|
69
|
-
return __spreadValues(__spreadValues({}, getBlockProperties(useBlock())), getBlockActions({
|
|
84
|
+
function attributes() {
|
|
85
|
+
return __spreadProps(__spreadValues(__spreadValues({}, getBlockProperties(useBlock())), getBlockActions({
|
|
70
86
|
block: useBlock(),
|
|
71
87
|
state: builderContext.state,
|
|
72
88
|
context: builderContext.context
|
|
73
|
-
}))
|
|
89
|
+
})), {
|
|
90
|
+
style: getBlockStyles(useBlock())
|
|
91
|
+
});
|
|
74
92
|
}
|
|
75
|
-
function
|
|
76
|
-
|
|
93
|
+
function shouldWrap() {
|
|
94
|
+
var _a2;
|
|
95
|
+
return !((_a2 = componentInfo == null ? void 0 : componentInfo()) == null ? void 0 : _a2.noWrap);
|
|
77
96
|
}
|
|
78
97
|
function componentOptions() {
|
|
79
|
-
return getBlockComponentOptions(useBlock())
|
|
98
|
+
return __spreadValues(__spreadValues({}, getBlockComponentOptions(useBlock())), shouldWrap() ? {} : {
|
|
99
|
+
attributes: attributes()
|
|
100
|
+
});
|
|
80
101
|
}
|
|
81
102
|
function children() {
|
|
82
103
|
var _a2;
|
|
@@ -86,30 +107,22 @@ function RenderBlock(props) {
|
|
|
86
107
|
return componentRef() ? [] : children();
|
|
87
108
|
}
|
|
88
109
|
const builderContext = useContext(BuilderContext);
|
|
89
|
-
const ComponentRefRef = componentRef();
|
|
90
110
|
const TagNameRef = tagName();
|
|
91
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null,
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}))
|
|
96
|
-
|
|
97
|
-
}), (_b = children()) == null ? void 0 : _b.map((child) => /* @__PURE__ */ React.createElement(RenderBlock, {
|
|
98
|
-
key: child.id,
|
|
99
|
-
block: child
|
|
100
|
-
}))) : null, (_c = noCompRefChildren()) == null ? void 0 : _c.map((child) => /* @__PURE__ */ React.createElement(RenderBlock, {
|
|
101
|
-
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,
|
|
102
117
|
block: child
|
|
103
|
-
})))) : /* @__PURE__ */ React.createElement(
|
|
104
|
-
|
|
105
|
-
}))) : /* @__PURE__ */ React.createElement(ComponentRefRef, __spreadProps(__spreadValues({}, componentOptions()), {
|
|
106
|
-
attributes: propertiesAndActions(),
|
|
107
|
-
builderBlock: useBlock(),
|
|
108
|
-
style: css()
|
|
109
|
-
}), (_d = children()) == null ? void 0 : _d.map((child) => /* @__PURE__ */ React.createElement(RenderBlock, {
|
|
110
|
-
key: child.id,
|
|
118
|
+
})), (_b = noCompRefChildren()) == null ? void 0 : _b.map((child) => /* @__PURE__ */ React.createElement(BlockStyles, {
|
|
119
|
+
key: "block-style-" + child.id,
|
|
111
120
|
block: child
|
|
112
|
-
}))))
|
|
121
|
+
})))) : /* @__PURE__ */ React.createElement(TagNameRef, __spreadValues({}, attributes()))) : /* @__PURE__ */ React.createElement(RenderComponent, {
|
|
122
|
+
blockChildren: children(),
|
|
123
|
+
componentRef: componentRef(),
|
|
124
|
+
componentOptions: componentOptions()
|
|
125
|
+
}));
|
|
113
126
|
}
|
|
114
127
|
export {
|
|
115
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() {
|
|
@@ -34,7 +34,12 @@ export default function RenderBlock(props) {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
function componentInfo() {
|
|
37
|
-
|
|
37
|
+
if (component()) {
|
|
38
|
+
const { component: _, ...info } = component();
|
|
39
|
+
return info;
|
|
40
|
+
} else {
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
38
43
|
}
|
|
39
44
|
|
|
40
45
|
function componentRef() {
|
|
@@ -53,7 +58,7 @@ export default function RenderBlock(props) {
|
|
|
53
58
|
});
|
|
54
59
|
}
|
|
55
60
|
|
|
56
|
-
function
|
|
61
|
+
function attributes() {
|
|
57
62
|
return {
|
|
58
63
|
...getBlockProperties(useBlock()),
|
|
59
64
|
...getBlockActions({
|
|
@@ -61,15 +66,28 @@ export default function RenderBlock(props) {
|
|
|
61
66
|
state: builderContext.state,
|
|
62
67
|
context: builderContext.context,
|
|
63
68
|
}),
|
|
69
|
+
style: getBlockStyles(useBlock()),
|
|
64
70
|
};
|
|
65
71
|
}
|
|
66
72
|
|
|
67
|
-
function
|
|
68
|
-
return
|
|
73
|
+
function shouldWrap() {
|
|
74
|
+
return !componentInfo?.()?.noWrap;
|
|
69
75
|
}
|
|
70
76
|
|
|
71
77
|
function componentOptions() {
|
|
72
|
-
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
|
+
};
|
|
73
91
|
}
|
|
74
92
|
|
|
75
93
|
function children() {
|
|
@@ -81,58 +99,49 @@ export default function RenderBlock(props) {
|
|
|
81
99
|
}
|
|
82
100
|
|
|
83
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
|
+
*/
|
|
84
106
|
return componentRef() ? [] : children();
|
|
85
107
|
}
|
|
86
108
|
|
|
87
109
|
const builderContext = useContext(BuilderContext);
|
|
88
110
|
|
|
89
|
-
const ComponentRefRef = componentRef();
|
|
90
111
|
const TagNameRef = tagName();
|
|
91
112
|
|
|
92
113
|
return (
|
|
93
114
|
<>
|
|
94
|
-
{
|
|
115
|
+
{shouldWrap() ? (
|
|
95
116
|
<>
|
|
96
117
|
{!isEmptyHtmlElement(tagName()) ? (
|
|
97
118
|
<>
|
|
98
|
-
<TagNameRef {...
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
{
|
|
106
|
-
<
|
|
107
|
-
|
|
108
|
-
builderBlock={useBlock()}
|
|
109
|
-
>
|
|
110
|
-
{children()?.map((child) => (
|
|
111
|
-
<RenderBlock key={child.id} block={child} />
|
|
112
|
-
))}
|
|
113
|
-
</ComponentRefRef>
|
|
114
|
-
) : 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
|
+
))}
|
|
115
129
|
|
|
116
130
|
{noCompRefChildren()?.map((child) => (
|
|
117
|
-
<
|
|
131
|
+
<BlockStyles key={"block-style-" + child.id} block={child} />
|
|
118
132
|
))}
|
|
119
133
|
</TagNameRef>
|
|
120
134
|
</>
|
|
121
135
|
) : (
|
|
122
|
-
<TagNameRef {...
|
|
136
|
+
<TagNameRef {...attributes()} />
|
|
123
137
|
)}
|
|
124
138
|
</>
|
|
125
139
|
) : (
|
|
126
|
-
<
|
|
127
|
-
{
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
>
|
|
132
|
-
{children()?.map((child) => (
|
|
133
|
-
<RenderBlock key={child.id} block={child} />
|
|
134
|
-
))}
|
|
135
|
-
</ComponentRefRef>
|
|
140
|
+
<RenderComponent
|
|
141
|
+
blockChildren={children()}
|
|
142
|
+
componentRef={componentRef()}
|
|
143
|
+
componentOptions={componentOptions()}
|
|
144
|
+
/>
|
|
136
145
|
)}
|
|
137
146
|
</>
|
|
138
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,4 +1,20 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
6
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
|
+
var __spreadValues = (a, b) => {
|
|
8
|
+
for (var prop in b || (b = {}))
|
|
9
|
+
if (__hasOwnProp.call(b, prop))
|
|
10
|
+
__defNormalProp(a, prop, b[prop]);
|
|
11
|
+
if (__getOwnPropSymbols)
|
|
12
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
13
|
+
if (__propIsEnum.call(b, prop))
|
|
14
|
+
__defNormalProp(a, prop, b[prop]);
|
|
15
|
+
}
|
|
16
|
+
return a;
|
|
17
|
+
};
|
|
2
18
|
import { default as Button } from "../blocks/button/button.js";
|
|
3
19
|
import { componentInfo as buttonComponentInfo } from "../blocks/button/component-info";
|
|
4
20
|
import { default as Columns } from "../blocks/columns/columns.js";
|
|
@@ -14,13 +30,13 @@ import { default as Symbol } from "../blocks/symbol/symbol.js";
|
|
|
14
30
|
import { componentInfo as textComponentInfo } from "../blocks/text/component-info";
|
|
15
31
|
import { default as Text } from "../blocks/text/text.js";
|
|
16
32
|
const getDefaultRegisteredComponents = () => [
|
|
17
|
-
{ component: Columns,
|
|
18
|
-
{ component: Image,
|
|
19
|
-
{ component: Text,
|
|
20
|
-
{ component: Symbol,
|
|
21
|
-
{ component: Button,
|
|
22
|
-
{ component: Section,
|
|
23
|
-
{ component: Fragment,
|
|
33
|
+
__spreadValues({ component: Columns }, columnsComponentInfo),
|
|
34
|
+
__spreadValues({ component: Image }, imageComponentInfo),
|
|
35
|
+
__spreadValues({ component: Text }, textComponentInfo),
|
|
36
|
+
__spreadValues({ component: Symbol }, symbolComponentInfo),
|
|
37
|
+
__spreadValues({ component: Button }, buttonComponentInfo),
|
|
38
|
+
__spreadValues({ component: Section }, sectionComponentInfo),
|
|
39
|
+
__spreadValues({ component: Fragment }, fragmentComponentInfo)
|
|
24
40
|
];
|
|
25
41
|
export {
|
|
26
42
|
getDefaultRegisteredComponents
|
|
@@ -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
|
|
@@ -27,7 +27,7 @@ function validateReactNativeStyles(styles) {
|
|
|
27
27
|
}
|
|
28
28
|
delete styles[key];
|
|
29
29
|
}
|
|
30
|
-
if (typeof propertyValue === "string" && propertyValue.match(
|
|
30
|
+
if (typeof propertyValue === "string" && propertyValue.match(/^-?\d/)) {
|
|
31
31
|
const newValue = parseFloat(propertyValue);
|
|
32
32
|
if (!isNaN(newValue)) {
|
|
33
33
|
styles[key] = newValue;
|