@builder.io/sdk-react-native 0.0.1-31 → 0.0.1-35
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 +1 -1
- package/src/blocks/button.js +22 -66
- package/src/blocks/button.lite.tsx +4 -4
- package/src/blocks/columns.js +36 -247
- package/src/blocks/columns.lite.tsx +7 -7
- package/src/blocks/custom-code.js +47 -73
- package/src/blocks/custom-code.lite.tsx +16 -12
- package/src/blocks/embed.js +47 -66
- package/src/blocks/embed.lite.tsx +13 -11
- package/src/blocks/form.js +195 -436
- package/src/blocks/form.lite.tsx +72 -65
- package/src/blocks/fragment.js +8 -16
- package/src/blocks/fragment.lite.tsx +3 -3
- package/src/blocks/image.js +80 -88
- package/src/blocks/image.lite.tsx +16 -17
- package/src/blocks/img.js +28 -45
- package/src/blocks/img.lite.tsx +7 -7
- package/src/blocks/input.js +28 -93
- package/src/blocks/input.lite.tsx +7 -5
- package/src/blocks/raw-text.js +12 -16
- package/src/blocks/raw-text.lite.tsx +3 -3
- package/src/blocks/section.js +23 -66
- package/src/blocks/section.lite.tsx +4 -4
- package/src/blocks/select.js +28 -67
- package/src/blocks/select.lite.tsx +8 -6
- package/src/blocks/submit-button.js +21 -41
- package/src/blocks/submit-button.lite.tsx +3 -3
- package/src/blocks/symbol.js +16 -18
- package/src/blocks/symbol.lite.tsx +5 -5
- package/src/blocks/text.js +27 -29
- package/src/blocks/text.lite.tsx +9 -4
- package/src/blocks/textarea.js +24 -53
- package/src/blocks/textarea.lite.tsx +3 -3
- package/src/blocks/video.js +60 -81
- package/src/blocks/video.lite.tsx +6 -6
- package/src/components/block-styles.js +4 -2
- package/src/components/block-styles.lite.tsx +3 -3
- package/src/components/error-boundary.js +9 -11
- package/src/components/error-boundary.lite.tsx +3 -3
- package/src/components/render-block.js +40 -85
- package/src/components/render-block.lite.tsx +25 -17
- package/src/components/render-blocks.js +32 -56
- package/src/components/render-blocks.lite.tsx +14 -14
- package/src/components/render-content.js +52 -100
- package/src/components/render-content.lite.tsx +41 -32
- package/src/constants/device-sizes.js +11 -8
- package/src/context/builder.context.js +4 -2
- package/src/functions/evaluate.js +9 -17
- package/src/functions/get-block-actions.js +10 -9
- package/src/functions/get-block-component-options.js +10 -11
- package/src/functions/get-block-properties.js +17 -15
- package/src/functions/get-block-styles.js +17 -20
- package/src/functions/get-block-tag.js +4 -2
- package/src/functions/get-content.js +30 -39
- package/src/functions/get-content.test.js +28 -37
- package/src/functions/get-fetch.js +7 -5
- package/src/functions/get-global-this.js +7 -5
- package/src/functions/get-processed-block.js +13 -11
- package/src/functions/get-processed-block.test.js +14 -14
- package/src/functions/get-target.js +4 -2
- package/src/functions/if-target.js +3 -1
- package/src/functions/is-browser.js +5 -3
- package/src/functions/is-editing.js +5 -3
- package/src/functions/is-iframe.js +4 -2
- package/src/functions/is-previewing.js +6 -4
- package/src/functions/is-react-native.js +4 -2
- package/src/functions/macro-eval.js +5 -2
- package/src/functions/on-change.js +7 -4
- package/src/functions/on-change.test.js +10 -10
- package/src/functions/previewing-model-name.js +5 -3
- package/src/functions/register-component.js +28 -33
- package/src/functions/register.js +10 -8
- package/src/functions/set-editor-settings.js +7 -5
- package/src/functions/set.js +4 -10
- package/src/functions/set.test.js +14 -14
- package/src/functions/track.js +8 -6
- package/src/index.js +18 -20
- package/src/scripts/init-editing.js +40 -64
package/src/index.js
CHANGED
|
@@ -1,27 +1,25 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { isEditing } from
|
|
2
|
+
import { isEditing } from "./functions/is-editing";
|
|
3
3
|
if (isEditing()) {
|
|
4
|
-
import(
|
|
4
|
+
import("./scripts/init-editing");
|
|
5
5
|
}
|
|
6
|
-
import { default as default2 } from
|
|
7
|
-
import { default as default3 } from
|
|
8
|
-
import { default as default4 } from
|
|
9
|
-
import { default as default5 } from
|
|
10
|
-
import { default as default6 } from
|
|
11
|
-
import { default as default7 } from
|
|
12
|
-
import { default as default8 } from
|
|
13
|
-
|
|
14
|
-
export * from
|
|
15
|
-
export * from
|
|
16
|
-
export * from
|
|
17
|
-
export * from './functions/get-content';
|
|
6
|
+
import { default as default2 } from "./blocks/columns";
|
|
7
|
+
import { default as default3 } from "./blocks/image";
|
|
8
|
+
import { default as default4 } from "./blocks/text";
|
|
9
|
+
import { default as default5 } from "./blocks/symbol";
|
|
10
|
+
import { default as default6 } from "./blocks/section";
|
|
11
|
+
import { default as default7 } from "./blocks/fragment";
|
|
12
|
+
import { default as default8 } from "./components/render-content";
|
|
13
|
+
export * from "./functions/register-component";
|
|
14
|
+
export * from "./functions/register";
|
|
15
|
+
export * from "./functions/set-editor-settings";
|
|
16
|
+
export * from "./functions/get-content";
|
|
18
17
|
export {
|
|
19
18
|
default2 as Columns,
|
|
20
|
-
|
|
19
|
+
default7 as Fragment,
|
|
21
20
|
default3 as Image,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
default4 as Text
|
|
26
|
-
default5 as Video,
|
|
21
|
+
default8 as RenderContent,
|
|
22
|
+
default6 as Section,
|
|
23
|
+
default5 as Symbol,
|
|
24
|
+
default4 as Text
|
|
27
25
|
};
|
|
@@ -1,43 +1,36 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
var _a;
|
|
3
|
-
import { isBrowser } from
|
|
4
|
-
import { register } from
|
|
5
|
-
register(
|
|
6
|
-
name:
|
|
3
|
+
import { isBrowser } from "../functions/is-browser";
|
|
4
|
+
import { register } from "../functions/register";
|
|
5
|
+
register("insertMenu", {
|
|
6
|
+
name: "_default",
|
|
7
7
|
default: true,
|
|
8
8
|
items: [
|
|
9
|
-
{ name:
|
|
10
|
-
{ name:
|
|
11
|
-
{ name:
|
|
12
|
-
{ name:
|
|
13
|
-
...
|
|
14
|
-
|
|
15
|
-
:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
]),
|
|
21
|
-
],
|
|
9
|
+
{ name: "Box" },
|
|
10
|
+
{ name: "Text" },
|
|
11
|
+
{ name: "Image" },
|
|
12
|
+
{ name: "Columns" },
|
|
13
|
+
...true ? [] : [
|
|
14
|
+
{ name: "Core:Section" },
|
|
15
|
+
{ name: "Core:Button" },
|
|
16
|
+
{ name: "Embed" },
|
|
17
|
+
{ name: "Custom Code" }
|
|
18
|
+
]
|
|
19
|
+
]
|
|
22
20
|
});
|
|
23
21
|
if (isBrowser()) {
|
|
24
|
-
(_a = window.parent) == null
|
|
25
|
-
|
|
26
|
-
:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
'*'
|
|
35
|
-
);
|
|
36
|
-
window.addEventListener('message', ({ data }) => {
|
|
22
|
+
(_a = window.parent) == null ? void 0 : _a.postMessage({
|
|
23
|
+
type: "builder.sdkInfo",
|
|
24
|
+
data: {
|
|
25
|
+
target: "reactNative",
|
|
26
|
+
supportsPatchUpdates: false
|
|
27
|
+
}
|
|
28
|
+
}, "*");
|
|
29
|
+
window.addEventListener("message", ({ data }) => {
|
|
37
30
|
var _a2, _b;
|
|
38
31
|
if (data) {
|
|
39
32
|
switch (data.type) {
|
|
40
|
-
case
|
|
33
|
+
case "builder.evaluate": {
|
|
41
34
|
const text = data.data.text;
|
|
42
35
|
const args = data.data.arguments || [];
|
|
43
36
|
const id = data.data.id;
|
|
@@ -50,41 +43,24 @@ if (isBrowser()) {
|
|
|
50
43
|
error = err;
|
|
51
44
|
}
|
|
52
45
|
if (error) {
|
|
53
|
-
(_a2 = window.parent) == null
|
|
54
|
-
|
|
55
|
-
:
|
|
56
|
-
|
|
57
|
-
type: 'builder.evaluateError',
|
|
58
|
-
data: { id, error: error.message },
|
|
59
|
-
},
|
|
60
|
-
'*'
|
|
61
|
-
);
|
|
46
|
+
(_a2 = window.parent) == null ? void 0 : _a2.postMessage({
|
|
47
|
+
type: "builder.evaluateError",
|
|
48
|
+
data: { id, error: error.message }
|
|
49
|
+
}, "*");
|
|
62
50
|
} else {
|
|
63
|
-
if (result && typeof result.then ===
|
|
64
|
-
result
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
type: 'builder.evaluateResult',
|
|
72
|
-
data: { id, result: finalResult },
|
|
73
|
-
},
|
|
74
|
-
'*'
|
|
75
|
-
);
|
|
76
|
-
})
|
|
77
|
-
.catch(console.error);
|
|
51
|
+
if (result && typeof result.then === "function") {
|
|
52
|
+
result.then((finalResult) => {
|
|
53
|
+
var _a3;
|
|
54
|
+
(_a3 = window.parent) == null ? void 0 : _a3.postMessage({
|
|
55
|
+
type: "builder.evaluateResult",
|
|
56
|
+
data: { id, result: finalResult }
|
|
57
|
+
}, "*");
|
|
58
|
+
}).catch(console.error);
|
|
78
59
|
} else {
|
|
79
|
-
(_b = window.parent) == null
|
|
80
|
-
|
|
81
|
-
:
|
|
82
|
-
|
|
83
|
-
type: 'builder.evaluateResult',
|
|
84
|
-
data: { result, id },
|
|
85
|
-
},
|
|
86
|
-
'*'
|
|
87
|
-
);
|
|
60
|
+
(_b = window.parent) == null ? void 0 : _b.postMessage({
|
|
61
|
+
type: "builder.evaluateResult",
|
|
62
|
+
data: { result, id }
|
|
63
|
+
}, "*");
|
|
88
64
|
}
|
|
89
65
|
}
|
|
90
66
|
break;
|