@builder.io/sdk-react-native 0.0.1-34 → 0.0.1-38

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