@builder.io/sdk-react-native 0.0.9 → 0.0.10
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/package.json +5 -3
- package/src/blocks/columns/columns.js +1 -1
- package/src/blocks/symbol/symbol.js +9 -9
- package/src/blocks/video/video.js +4 -1
- package/src/components/render-block/render-block.js +10 -15
- package/src/components/render-block/render-component-with-context.js +6 -17
- package/src/components/render-content/render-content.js +8 -3
- package/src/functions/fast-clone.js +4 -0
- package/src/functions/get-processed-block.js +5 -3
- package/src/functions/get-react-native-block-styles.js +32 -0
- package/src/functions/register-component.js +1 -1
- package/src/functions/{sanitize-styles.js → sanitize-react-native-block-styles.js} +2 -2
- package/src/scripts/init-editing.js +36 -34
- package/src/functions/convert-style-object.js +0 -6
- package/src/functions/get-block-styles.js +0 -50
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.
|
|
4
|
+
"version": "0.0.10",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"files": [
|
|
7
7
|
"src"
|
|
@@ -17,10 +17,12 @@
|
|
|
17
17
|
"react-native-video": "^5.1.1"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
|
-
"react-native": "^0.64.3"
|
|
20
|
+
"react-native": "^0.64.3",
|
|
21
|
+
"react-native-url-polyfill": "^1.3.0"
|
|
21
22
|
},
|
|
22
23
|
"devDependencies": {
|
|
23
24
|
"@types/react-native-video": "^5.0.9",
|
|
24
|
-
"react-native": "^0.64.3"
|
|
25
|
+
"react-native": "^0.64.3",
|
|
26
|
+
"react-native-url-polyfill": "^1.3.0"
|
|
25
27
|
}
|
|
26
28
|
}
|
|
@@ -27,15 +27,15 @@ import { markMutable } from "../../functions/mark-mutable";
|
|
|
27
27
|
function Symbol(props) {
|
|
28
28
|
var _a, _b, _c, _d, _e;
|
|
29
29
|
const [className, setClassName] = useState(() => "builder-symbol");
|
|
30
|
-
const [
|
|
31
|
-
|
|
32
|
-
useEffect(() => {
|
|
30
|
+
const [fetchedContent, setFetchedContent] = useState(() => null);
|
|
31
|
+
function contentToUse() {
|
|
33
32
|
var _a2;
|
|
34
|
-
|
|
35
|
-
}
|
|
33
|
+
return ((_a2 = props.symbol) == null ? void 0 : _a2.content) || fetchedContent;
|
|
34
|
+
}
|
|
35
|
+
const builderContext = useContext(BuilderContext);
|
|
36
36
|
useEffect(() => {
|
|
37
37
|
const symbolToUse = props.symbol;
|
|
38
|
-
if (symbolToUse && !symbolToUse.content && !
|
|
38
|
+
if (symbolToUse && !symbolToUse.content && !fetchedContent && symbolToUse.model) {
|
|
39
39
|
getContent({
|
|
40
40
|
model: symbolToUse.model,
|
|
41
41
|
apiKey: builderContext.apiKey,
|
|
@@ -43,10 +43,10 @@ function Symbol(props) {
|
|
|
43
43
|
id: symbolToUse.entry
|
|
44
44
|
}
|
|
45
45
|
}).then((response) => {
|
|
46
|
-
|
|
46
|
+
setFetchedContent(response);
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
|
-
}, [props.symbol,
|
|
49
|
+
}, [props.symbol, fetchedContent]);
|
|
50
50
|
return /* @__PURE__ */ React.createElement(View, __spreadProps(__spreadValues({}, props.attributes), {
|
|
51
51
|
dataSet: {
|
|
52
52
|
class: className
|
|
@@ -57,7 +57,7 @@ function Symbol(props) {
|
|
|
57
57
|
customComponents: markMutable(Object.values(builderContext.registeredComponents)),
|
|
58
58
|
data: markMutable(__spreadValues(__spreadValues(__spreadValues({}, (_a = props.symbol) == null ? void 0 : _a.data), builderContext.state), (_d = (_c = (_b = props.symbol) == null ? void 0 : _b.content) == null ? void 0 : _c.data) == null ? void 0 : _d.state)),
|
|
59
59
|
model: (_e = props.symbol) == null ? void 0 : _e.model,
|
|
60
|
-
content: markMutable(
|
|
60
|
+
content: markMutable(contentToUse())
|
|
61
61
|
}));
|
|
62
62
|
}
|
|
63
63
|
export {
|
|
@@ -34,7 +34,10 @@ function Video(props) {
|
|
|
34
34
|
playsInline: true
|
|
35
35
|
} : {});
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
function spreadProps() {
|
|
38
|
+
return __spreadValues(__spreadValues({}, props.attributes), videoProps());
|
|
39
|
+
}
|
|
40
|
+
return /* @__PURE__ */ React.createElement(View, __spreadProps(__spreadValues({}, spreadProps()), {
|
|
38
41
|
style: __spreadProps(__spreadValues({
|
|
39
42
|
width: "100%",
|
|
40
43
|
height: "100%"
|
|
@@ -30,12 +30,10 @@ var __objRest = (source, exclude) => {
|
|
|
30
30
|
return target;
|
|
31
31
|
};
|
|
32
32
|
import * as React from "react";
|
|
33
|
-
import { View } from "react-native";
|
|
34
33
|
import { useState } from "react";
|
|
35
34
|
import { getBlockActions } from "../../functions/get-block-actions.js";
|
|
36
35
|
import { getBlockComponentOptions } from "../../functions/get-block-component-options.js";
|
|
37
36
|
import { getBlockProperties } from "../../functions/get-block-properties.js";
|
|
38
|
-
import { getBlockStyles } from "../../functions/get-block-styles.js";
|
|
39
37
|
import { getBlockTag } from "../../functions/get-block-tag.js";
|
|
40
38
|
import { getProcessedBlock } from "../../functions/get-processed-block.js";
|
|
41
39
|
import { evaluate } from "../../functions/evaluate.js";
|
|
@@ -46,8 +44,9 @@ import { TARGET } from "../../constants/target.js";
|
|
|
46
44
|
import { extractTextStyles } from "../../functions/extract-text-styles.js";
|
|
47
45
|
import RenderComponentWithContext from "./render-component-with-context.js";
|
|
48
46
|
import RenderComponent from "./render-component.js";
|
|
47
|
+
import { getReactNativeBlockStyles } from "../../functions/get-react-native-block-styles.js";
|
|
49
48
|
function RenderBlock(props) {
|
|
50
|
-
var _a, _b, _c
|
|
49
|
+
var _a, _b, _c;
|
|
51
50
|
function component() {
|
|
52
51
|
var _a2;
|
|
53
52
|
const componentName = (_a2 = getProcessedBlock({
|
|
@@ -81,16 +80,16 @@ function RenderBlock(props) {
|
|
|
81
80
|
});
|
|
82
81
|
}
|
|
83
82
|
function attributes() {
|
|
84
|
-
return
|
|
83
|
+
return __spreadValues(__spreadValues(__spreadValues({}, getBlockProperties(useBlock())), getBlockActions({
|
|
85
84
|
block: useBlock(),
|
|
86
85
|
state: props.context.state,
|
|
87
86
|
context: props.context.context
|
|
88
|
-
})), {
|
|
89
|
-
style:
|
|
87
|
+
})), TARGET === "reactNative" ? {
|
|
88
|
+
style: getReactNativeBlockStyles({
|
|
90
89
|
block: useBlock(),
|
|
91
90
|
context: props.context
|
|
92
91
|
})
|
|
93
|
-
});
|
|
92
|
+
} : {});
|
|
94
93
|
}
|
|
95
94
|
function shouldWrap() {
|
|
96
95
|
var _a2;
|
|
@@ -148,7 +147,7 @@ function RenderBlock(props) {
|
|
|
148
147
|
if (TARGET !== "reactNative") {
|
|
149
148
|
return {};
|
|
150
149
|
}
|
|
151
|
-
const styles =
|
|
150
|
+
const styles = getReactNativeBlockStyles({
|
|
152
151
|
block: useBlock(),
|
|
153
152
|
context: props.context
|
|
154
153
|
});
|
|
@@ -176,19 +175,15 @@ function RenderBlock(props) {
|
|
|
176
175
|
const [componentInfo, setComponentInfo] = useState(() => null);
|
|
177
176
|
const RenderComponentTagRef = renderComponentTag();
|
|
178
177
|
const TagNameRef = tagName();
|
|
179
|
-
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()))) : null, !isEmptyHtmlElement(tagName()) &&
|
|
180
|
-
key: index,
|
|
181
|
-
repeatContext: data.context,
|
|
182
|
-
block: data.block
|
|
183
|
-
})))) : null, !isEmptyHtmlElement(tagName()) && TARGET !== "vue2" && repeatItemData() ? /* @__PURE__ */ React.createElement(React.Fragment, null, (_b = repeatItemData()) == null ? void 0 : _b.map((data, index) => /* @__PURE__ */ React.createElement(RenderRepeatedBlock, {
|
|
178
|
+
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()))) : null, !isEmptyHtmlElement(tagName()) && repeatItemData() ? /* @__PURE__ */ React.createElement(React.Fragment, null, (_a = repeatItemData()) == null ? void 0 : _a.map((data, index) => /* @__PURE__ */ React.createElement(RenderRepeatedBlock, {
|
|
184
179
|
key: index,
|
|
185
180
|
repeatContext: data.context,
|
|
186
181
|
block: data.block
|
|
187
|
-
}))) : null, !isEmptyHtmlElement(tagName()) && !repeatItemData() ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(TagNameRef, __spreadValues({}, attributes()), /* @__PURE__ */ React.createElement(RenderComponentTagRef, __spreadValues({}, renderComponentProps())), (
|
|
182
|
+
}))) : null, !isEmptyHtmlElement(tagName()) && !repeatItemData() ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(TagNameRef, __spreadValues({}, attributes()), /* @__PURE__ */ React.createElement(RenderComponentTagRef, __spreadValues({}, renderComponentProps())), (_b = childrenWithoutParentComponent()) == null ? void 0 : _b.map((child) => /* @__PURE__ */ React.createElement(RenderBlock, {
|
|
188
183
|
key: "render-block-" + child.id,
|
|
189
184
|
block: child,
|
|
190
185
|
context: childrenContext()
|
|
191
|
-
})), (
|
|
186
|
+
})), (_c = childrenWithoutParentComponent()) == null ? void 0 : _c.map((child) => /* @__PURE__ */ React.createElement(BlockStyles, {
|
|
192
187
|
key: "block-style-" + child.id,
|
|
193
188
|
block: child,
|
|
194
189
|
context: childrenContext()
|
|
@@ -1,19 +1,3 @@
|
|
|
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
1
|
import * as React from "react";
|
|
18
2
|
import BuilderContext from "../../context/builder.context.js";
|
|
19
3
|
import RenderComponent from "./render-component.js";
|
|
@@ -39,7 +23,12 @@ function RenderComponentWithContext(props) {
|
|
|
39
23
|
return props.context.inheritedStyles;
|
|
40
24
|
}
|
|
41
25
|
}
|
|
42
|
-
}, /* @__PURE__ */ React.createElement(RenderComponent,
|
|
26
|
+
}, /* @__PURE__ */ React.createElement(RenderComponent, {
|
|
27
|
+
componentRef: props.componentRef,
|
|
28
|
+
componentOptions: props.componentOptions,
|
|
29
|
+
blockChildren: props.blockChildren,
|
|
30
|
+
context: props.context
|
|
31
|
+
}));
|
|
43
32
|
}
|
|
44
33
|
export {
|
|
45
34
|
RenderComponentWithContext as default
|
|
@@ -74,7 +74,9 @@ function RenderContent(props) {
|
|
|
74
74
|
...components,
|
|
75
75
|
...props.customComponents || []
|
|
76
76
|
];
|
|
77
|
-
const allComponents = allComponentsArray.reduce((acc, curr) => __spreadProps(__spreadValues({}, acc), {
|
|
77
|
+
const allComponents = allComponentsArray.reduce((acc, curr) => __spreadProps(__spreadValues({}, acc), {
|
|
78
|
+
[curr.name]: curr
|
|
79
|
+
}), {});
|
|
78
80
|
return allComponents;
|
|
79
81
|
}
|
|
80
82
|
function processMessage(event) {
|
|
@@ -131,7 +133,9 @@ function RenderContent(props) {
|
|
|
131
133
|
}
|
|
132
134
|
function handleRequest({ url, key }) {
|
|
133
135
|
getFetch().then((fetch) => fetch(url)).then((response) => response.json()).then((json) => {
|
|
134
|
-
const newOverrideState = __spreadProps(__spreadValues({}, overrideState), {
|
|
136
|
+
const newOverrideState = __spreadProps(__spreadValues({}, overrideState), {
|
|
137
|
+
[key]: json
|
|
138
|
+
});
|
|
135
139
|
setOverrideState(newOverrideState);
|
|
136
140
|
}).catch((err) => {
|
|
137
141
|
console.log("error fetching dynamic data", url, err);
|
|
@@ -248,7 +252,8 @@ function RenderContent(props) {
|
|
|
248
252
|
}, useContent() ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(View, {
|
|
249
253
|
ref: elementRef,
|
|
250
254
|
onClick: (event) => onClick(event),
|
|
251
|
-
"builder-content-id": (_e = useContent == null ? void 0 : useContent()) == null ? void 0 : _e.id
|
|
255
|
+
"builder-content-id": (_e = useContent == null ? void 0 : useContent()) == null ? void 0 : _e.id,
|
|
256
|
+
"builder-model": props.model
|
|
252
257
|
}, shouldRenderContentStyles() ? /* @__PURE__ */ React.createElement(RenderContentStyles, {
|
|
253
258
|
cssCode: (_g = (_f = useContent == null ? void 0 : useContent()) == null ? void 0 : _f.data) == null ? void 0 : _g.cssCode,
|
|
254
259
|
customFonts: (_i = (_h = useContent == null ? void 0 : useContent()) == null ? void 0 : _h.data) == null ? void 0 : _i.customFonts
|
|
@@ -18,6 +18,7 @@ var __spreadValues = (a, b) => {
|
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
20
|
import { evaluate } from "./evaluate.js";
|
|
21
|
+
import { fastClone } from "./fast-clone.js";
|
|
21
22
|
import { set } from "./set.js";
|
|
22
23
|
import { transformBlock } from "./transform-block.js";
|
|
23
24
|
const evaluateBindings = ({
|
|
@@ -28,9 +29,10 @@ const evaluateBindings = ({
|
|
|
28
29
|
if (!block.bindings) {
|
|
29
30
|
return block;
|
|
30
31
|
}
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
const copy = fastClone(block);
|
|
33
|
+
const copied = __spreadProps(__spreadValues({}, copy), {
|
|
34
|
+
properties: __spreadValues({}, copy.properties),
|
|
35
|
+
actions: __spreadValues({}, copy.actions)
|
|
34
36
|
});
|
|
35
37
|
for (const binding in block.bindings) {
|
|
36
38
|
const expression = block.bindings[binding];
|
|
@@ -0,0 +1,32 @@
|
|
|
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 { sanitizeReactNativeBlockStyles } from "./sanitize-react-native-block-styles.js";
|
|
18
|
+
function getReactNativeBlockStyles({
|
|
19
|
+
block,
|
|
20
|
+
context
|
|
21
|
+
}) {
|
|
22
|
+
const responsiveStyles = block.responsiveStyles;
|
|
23
|
+
if (!responsiveStyles) {
|
|
24
|
+
return {};
|
|
25
|
+
}
|
|
26
|
+
const styles = __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, context.inheritedStyles), responsiveStyles.large || {}), responsiveStyles.medium || {}), responsiveStyles.small || {});
|
|
27
|
+
const newStyles = sanitizeReactNativeBlockStyles(styles);
|
|
28
|
+
return newStyles;
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
getReactNativeBlockStyles
|
|
32
|
+
};
|
|
@@ -29,6 +29,7 @@ var __objRest = (source, exclude) => {
|
|
|
29
29
|
}
|
|
30
30
|
return target;
|
|
31
31
|
};
|
|
32
|
+
import { fastClone } from "./fast-clone.js";
|
|
32
33
|
const components = [];
|
|
33
34
|
function registerComponent(component, info) {
|
|
34
35
|
components.push(__spreadValues({ component }, info));
|
|
@@ -46,7 +47,6 @@ const createRegisterComponentMessage = (_a) => {
|
|
|
46
47
|
data: prepareComponentInfoToSend(info)
|
|
47
48
|
};
|
|
48
49
|
};
|
|
49
|
-
const fastClone = (obj) => JSON.parse(JSON.stringify(obj));
|
|
50
50
|
const serializeValue = (value) => typeof value === "function" ? serializeFn(value) : fastClone(value);
|
|
51
51
|
const serializeFn = (fnValue) => {
|
|
52
52
|
const fnStr = fnValue.toString().trim();
|
|
@@ -29,7 +29,7 @@ const normalizeNumber = (value) => {
|
|
|
29
29
|
return value;
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
|
-
const
|
|
32
|
+
const sanitizeReactNativeBlockStyles = (styles) => {
|
|
33
33
|
return Object.keys(styles).reduce((acc, key) => {
|
|
34
34
|
const propertyValue = styles[key];
|
|
35
35
|
if (key === "display" && !displayValues.has(propertyValue)) {
|
|
@@ -62,5 +62,5 @@ const sanitizeBlockStyles = (styles) => {
|
|
|
62
62
|
}, {});
|
|
63
63
|
};
|
|
64
64
|
export {
|
|
65
|
-
|
|
65
|
+
sanitizeReactNativeBlockStyles
|
|
66
66
|
};
|
|
@@ -26,48 +26,50 @@ const setupBrowserForEditing = () => {
|
|
|
26
26
|
type: "builder.sdkInfo",
|
|
27
27
|
data: {
|
|
28
28
|
target: TARGET,
|
|
29
|
-
supportsPatchUpdates: false
|
|
29
|
+
supportsPatchUpdates: false,
|
|
30
|
+
supportsAddBlockScoping: true
|
|
30
31
|
}
|
|
31
32
|
}, "*");
|
|
32
33
|
window.addEventListener("message", ({ data }) => {
|
|
33
34
|
var _a2, _b;
|
|
34
|
-
if (data) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}, "*");
|
|
61
|
-
}).catch(console.error);
|
|
62
|
-
} else {
|
|
63
|
-
(_b = window.parent) == null ? void 0 : _b.postMessage({
|
|
35
|
+
if (!(data == null ? void 0 : data.type)) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
switch (data.type) {
|
|
39
|
+
case "builder.evaluate": {
|
|
40
|
+
const text = data.data.text;
|
|
41
|
+
const args = data.data.arguments || [];
|
|
42
|
+
const id = data.data.id;
|
|
43
|
+
const fn = new Function(text);
|
|
44
|
+
let result;
|
|
45
|
+
let error = null;
|
|
46
|
+
try {
|
|
47
|
+
result = fn.apply(null, args);
|
|
48
|
+
} catch (err) {
|
|
49
|
+
error = err;
|
|
50
|
+
}
|
|
51
|
+
if (error) {
|
|
52
|
+
(_a2 = window.parent) == null ? void 0 : _a2.postMessage({
|
|
53
|
+
type: "builder.evaluateError",
|
|
54
|
+
data: { id, error: error.message }
|
|
55
|
+
}, "*");
|
|
56
|
+
} else {
|
|
57
|
+
if (result && typeof result.then === "function") {
|
|
58
|
+
result.then((finalResult) => {
|
|
59
|
+
var _a3;
|
|
60
|
+
(_a3 = window.parent) == null ? void 0 : _a3.postMessage({
|
|
64
61
|
type: "builder.evaluateResult",
|
|
65
|
-
data: {
|
|
62
|
+
data: { id, result: finalResult }
|
|
66
63
|
}, "*");
|
|
67
|
-
}
|
|
64
|
+
}).catch(console.error);
|
|
65
|
+
} else {
|
|
66
|
+
(_b = window.parent) == null ? void 0 : _b.postMessage({
|
|
67
|
+
type: "builder.evaluateResult",
|
|
68
|
+
data: { result, id }
|
|
69
|
+
}, "*");
|
|
68
70
|
}
|
|
69
|
-
break;
|
|
70
71
|
}
|
|
72
|
+
break;
|
|
71
73
|
}
|
|
72
74
|
}
|
|
73
75
|
});
|
|
@@ -1,50 +0,0 @@
|
|
|
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 { getMaxWidthQueryForSize } from "../constants/device-sizes.js";
|
|
18
|
-
import { TARGET } from "../constants/target.js";
|
|
19
|
-
import { convertStyleObject } from "./convert-style-object.js";
|
|
20
|
-
import { sanitizeBlockStyles } from "./sanitize-styles.js";
|
|
21
|
-
const getStyleForTarget = ({
|
|
22
|
-
styles,
|
|
23
|
-
context
|
|
24
|
-
}) => {
|
|
25
|
-
switch (TARGET) {
|
|
26
|
-
case "reactNative": {
|
|
27
|
-
return __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, context.inheritedStyles), styles.large ? convertStyleObject(styles.large) : {}), styles.medium ? convertStyleObject(styles.medium) : {}), styles.small ? convertStyleObject(styles.small) : {});
|
|
28
|
-
}
|
|
29
|
-
default:
|
|
30
|
-
return __spreadValues(__spreadValues(__spreadValues({}, styles.large ? convertStyleObject(styles.large) : {}), styles.medium ? {
|
|
31
|
-
[getMaxWidthQueryForSize("medium")]: convertStyleObject(styles.medium)
|
|
32
|
-
} : {}), styles.small ? {
|
|
33
|
-
[getMaxWidthQueryForSize("small")]: convertStyleObject(styles.small)
|
|
34
|
-
} : {});
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
function getBlockStyles({
|
|
38
|
-
block,
|
|
39
|
-
context
|
|
40
|
-
}) {
|
|
41
|
-
if (!block.responsiveStyles) {
|
|
42
|
-
return {};
|
|
43
|
-
}
|
|
44
|
-
const styles = getStyleForTarget({ styles: block.responsiveStyles, context });
|
|
45
|
-
const newStyles = sanitizeBlockStyles(styles);
|
|
46
|
-
return newStyles;
|
|
47
|
-
}
|
|
48
|
-
export {
|
|
49
|
-
getBlockStyles
|
|
50
|
-
};
|