@builder.io/sdk-react-native 0.0.1-4 → 0.0.1-40

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 +6 -4
  2. package/src/blocks/button.js +73 -24
  3. package/src/blocks/button.lite.tsx +10 -14
  4. package/src/blocks/columns.js +258 -40
  5. package/src/blocks/columns.lite.tsx +7 -13
  6. package/src/blocks/custom-code.js +76 -47
  7. package/src/blocks/custom-code.lite.tsx +12 -12
  8. package/src/blocks/embed.js +69 -47
  9. package/src/blocks/embed.lite.tsx +11 -11
  10. package/src/blocks/form.js +491 -198
  11. package/src/blocks/form.lite.tsx +52 -56
  12. package/src/blocks/fragment.js +21 -0
  13. package/src/blocks/fragment.lite.tsx +10 -0
  14. package/src/blocks/image.js +89 -83
  15. package/src/blocks/image.lite.tsx +47 -14
  16. package/src/blocks/img.js +51 -28
  17. package/src/blocks/img.lite.tsx +6 -7
  18. package/src/blocks/input.js +100 -28
  19. package/src/blocks/input.lite.tsx +4 -7
  20. package/src/blocks/raw-text.js +16 -12
  21. package/src/blocks/raw-text.lite.tsx +2 -3
  22. package/src/blocks/section.js +71 -23
  23. package/src/blocks/section.lite.tsx +4 -5
  24. package/src/blocks/select.js +78 -27
  25. package/src/blocks/select.lite.tsx +8 -9
  26. package/src/blocks/submit-button.js +47 -21
  27. package/src/blocks/submit-button.lite.tsx +3 -4
  28. package/src/blocks/symbol.js +18 -16
  29. package/src/blocks/symbol.lite.tsx +5 -5
  30. package/src/blocks/text.js +85 -16
  31. package/src/blocks/text.lite.tsx +3 -4
  32. package/src/blocks/textarea.js +60 -24
  33. package/src/blocks/textarea.lite.tsx +2 -3
  34. package/src/blocks/video.js +97 -46
  35. package/src/blocks/video.lite.tsx +5 -6
  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 +123 -38
  41. package/src/components/render-block.lite.tsx +70 -33
  42. package/src/components/render-blocks.js +61 -35
  43. package/src/components/render-blocks.lite.tsx +17 -14
  44. package/src/components/render-content.js +185 -36
  45. package/src/components/render-content.lite.tsx +144 -32
  46. package/src/constants/device-sizes.js +8 -11
  47. package/src/context/builder.context.js +2 -4
  48. package/src/functions/evaluate.js +18 -9
  49. package/src/functions/event-handler-name.js +6 -0
  50. package/src/functions/get-block-actions.js +13 -13
  51. package/src/functions/get-block-component-options.js +27 -4
  52. package/src/functions/get-block-properties.js +24 -16
  53. package/src/functions/get-block-styles.js +56 -9
  54. package/src/functions/get-block-tag.js +2 -4
  55. package/src/functions/get-content.js +72 -25
  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 +19 -13
  60. package/src/functions/get-processed-block.test.js +18 -14
  61. package/src/functions/get-target.js +3 -5
  62. package/src/functions/if-target.js +1 -3
  63. package/src/functions/is-browser.js +7 -5
  64. package/src/functions/is-editing.js +5 -5
  65. package/src/functions/is-iframe.js +2 -4
  66. package/src/functions/is-previewing.js +13 -0
  67. package/src/functions/is-react-native.js +2 -4
  68. package/src/functions/macro-eval.js +2 -5
  69. package/src/functions/on-change.js +4 -7
  70. package/src/functions/on-change.test.js +10 -10
  71. package/src/functions/previewing-model-name.js +10 -0
  72. package/src/functions/register-component.js +39 -27
  73. package/src/functions/register.js +28 -0
  74. package/src/functions/set-editor-settings.js +14 -0
  75. package/src/functions/set.js +14 -5
  76. package/src/functions/set.test.js +14 -14
  77. package/src/functions/track.js +6 -8
  78. package/src/functions/transform-block.js +40 -0
  79. package/src/index.js +18 -16
  80. package/src/scripts/init-editing.js +67 -29
  81. package/src/types/deep-partial.js +1 -0
  82. package/index.js +0 -11
  83. package/src/package.json +0 -18
@@ -1,12 +1,17 @@
1
- import * as React from "react";
2
- import { View } from "react-native";
3
- import { useState, useEffect } from "react";
4
- import { isBrowser } from "../functions/is-browser";
5
- import RenderBlock from "./render-block";
6
- import BuilderContext from "../context/builder.context";
7
- import { track } from "../functions/track";
1
+ import * as React from 'react';
2
+ import { View, Text } from 'react-native';
3
+ import { useState, useEffect } from 'react';
4
+ import { isBrowser } from '../functions/is-browser';
5
+ import RenderBlock from './render-block';
6
+ import BuilderContext from '../context/builder.context';
7
+ import { track } from '../functions/track';
8
+ import { isReactNative } from '../functions/is-react-native';
9
+ import { isEditing } from '../functions/is-editing';
10
+ import { isPreviewing } from '../functions/is-previewing';
11
+ import { previewingModelName } from '../functions/previewing-model-name';
12
+ import { getContent } from '../functions/get-content';
8
13
  function RenderContent(props) {
9
- var _a, _b, _c, _d, _e;
14
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
10
15
  function useContent() {
11
16
  return overrideContent || props.content;
12
17
  }
@@ -14,19 +19,71 @@ function RenderContent(props) {
14
19
  const [state, setState] = useState(() => ({}));
15
20
  const [context, setContext] = useState(() => ({}));
16
21
  const [overrideContent, setOverrideContent] = useState(() => null);
22
+ function getCssFromFont(font, data) {
23
+ const family =
24
+ font.family +
25
+ (font.kind && !font.kind.includes('#') ? ', ' + font.kind : '');
26
+ const name = family.split(',')[0];
27
+ const url = font.fileUrl ? font.fileUrl : font.files && font.files.regular;
28
+ let str = '';
29
+ if (url && family && name) {
30
+ str += `
31
+ @font-face {
32
+ font-family: "${family}";
33
+ src: local("${name}"), url('${url}') format('woff2');
34
+ font-display: fallback;
35
+ font-weight: 400;
36
+ }
37
+ `.trim();
38
+ }
39
+ if (font.files) {
40
+ for (const weight in font.files) {
41
+ const isNumber = String(Number(weight)) === weight;
42
+ if (!isNumber) {
43
+ continue;
44
+ }
45
+ const weightUrl = font.files[weight];
46
+ if (weightUrl && weightUrl !== url) {
47
+ str += `
48
+ @font-face {
49
+ font-family: "${family}";
50
+ src: url('${weightUrl}') format('woff2');
51
+ font-display: fallback;
52
+ font-weight: ${weight};
53
+ }
54
+ `.trim();
55
+ }
56
+ }
57
+ }
58
+ return str;
59
+ }
60
+ function getFontCss(data) {
61
+ return (
62
+ ((data == null ? void 0 : data.customFonts) &&
63
+ data.customFonts.length &&
64
+ data.customFonts
65
+ .map((font) => this.getCssFromFont(font, data))
66
+ .join(' ')) ||
67
+ ''
68
+ );
69
+ }
17
70
  function processMessage(event) {
18
71
  const { data } = event;
19
72
  if (data) {
20
73
  switch (data.type) {
21
- case "builder.contentUpdate": {
22
- const key = data.data.key || data.data.alias || data.data.entry || data.data.modelName;
74
+ case 'builder.contentUpdate': {
75
+ const key =
76
+ data.data.key ||
77
+ data.data.alias ||
78
+ data.data.entry ||
79
+ data.data.modelName;
23
80
  const contentData = data.data.data;
24
81
  if (key === props.model) {
25
82
  setOverrideContent(contentData);
26
83
  }
27
84
  break;
28
85
  }
29
- case "builder.patchUpdates": {
86
+ case 'builder.patchUpdates': {
30
87
  break;
31
88
  }
32
89
  }
@@ -34,33 +91,125 @@ function RenderContent(props) {
34
91
  }
35
92
  useEffect(() => {
36
93
  if (isBrowser()) {
37
- window.addEventListener("message", processMessage);
94
+ if (isEditing()) {
95
+ window.addEventListener('message', processMessage);
96
+ }
97
+ if (useContent() && !isEditing()) {
98
+ track('impression', {
99
+ contentId: useContent().id,
100
+ });
101
+ }
102
+ if (isPreviewing()) {
103
+ if (props.model && previewingModelName() === props.model) {
104
+ const options = {};
105
+ const currentUrl = new URL(location.href);
106
+ const apiKey = currentUrl.searchParams.get('apiKey');
107
+ if (apiKey) {
108
+ const builderPrefix = 'builder.';
109
+ currentUrl.searchParams.forEach((value, key) => {
110
+ if (key.startsWith(builderPrefix)) {
111
+ options[key.replace(builderPrefix, '')] = value;
112
+ }
113
+ });
114
+ getContent({
115
+ model: props.model,
116
+ apiKey,
117
+ options,
118
+ }).then((content) => {
119
+ if (content) {
120
+ setOverrideContent(content);
121
+ }
122
+ });
123
+ }
124
+ }
125
+ }
38
126
  }
39
127
  }, []);
40
- return /* @__PURE__ */ React.createElement(BuilderContext.Provider, {
41
- value: {
42
- get content() {
43
- return props.content;
128
+ return /* @__PURE__ */ React.createElement(
129
+ BuilderContext.Provider,
130
+ {
131
+ value: {
132
+ get content() {
133
+ return useContent();
134
+ },
135
+ get state() {
136
+ return state;
137
+ },
138
+ get context() {
139
+ return context;
140
+ },
44
141
  },
45
- get state() {
46
- return state;
47
- },
48
- get context() {
49
- return context;
50
- }
51
- }
52
- }, /* @__PURE__ */ React.createElement(View, {
53
- onClick: (event) => {
54
- track("click", {
55
- contentId: props.content.id
56
- });
57
142
  },
58
- "data-builder-content-id": (_a = props.content) == null ? void 0 : _a.id
59
- }, ((_c = (_b = useContent == null ? void 0 : useContent()) == null ? void 0 : _b.data) == null ? void 0 : _c.cssCode) && /* @__PURE__ */ React.createElement(View, null, useContent().data.cssCode), (_e = (_d = useContent == null ? void 0 : useContent()) == null ? void 0 : _d.data) == null ? void 0 : _e.blocks.map((block) => /* @__PURE__ */ React.createElement(RenderBlock, {
60
- key: block.id,
61
- block
62
- }))));
143
+ useContent()
144
+ ? /* @__PURE__ */ React.createElement(
145
+ React.Fragment,
146
+ null,
147
+ /* @__PURE__ */ React.createElement(
148
+ View,
149
+ {
150
+ onClick: (event) => {
151
+ if (!isEditing()) {
152
+ track('click', {
153
+ contentId: useContent().id,
154
+ });
155
+ }
156
+ },
157
+ 'data-builder-content-id':
158
+ (_a = useContent == null ? void 0 : useContent()) == null
159
+ ? void 0
160
+ : _a.id,
161
+ },
162
+ (((_c =
163
+ (_b = useContent == null ? void 0 : useContent()) == null
164
+ ? void 0
165
+ : _b.data) == null
166
+ ? void 0
167
+ : _c.cssCode) ||
168
+ (((_e =
169
+ (_d = useContent == null ? void 0 : useContent()) == null
170
+ ? void 0
171
+ : _d.data) == null
172
+ ? void 0
173
+ : _e.customFonts) &&
174
+ ((_g =
175
+ (_f = useContent == null ? void 0 : useContent()) == null
176
+ ? void 0
177
+ : _f.data) == null
178
+ ? void 0
179
+ : _g.customFonts.length))) &&
180
+ !isReactNative()
181
+ ? /* @__PURE__ */ React.createElement(
182
+ View,
183
+ null,
184
+ /* @__PURE__ */ React.createElement(
185
+ Text,
186
+ null,
187
+ useContent().data.cssCode
188
+ ),
189
+ /* @__PURE__ */ React.createElement(
190
+ Text,
191
+ null,
192
+ getFontCss(useContent().data)
193
+ )
194
+ )
195
+ : null,
196
+ (_j =
197
+ (_i =
198
+ (_h = useContent == null ? void 0 : useContent()) == null
199
+ ? void 0
200
+ : _h.data) == null
201
+ ? void 0
202
+ : _i.blocks) == null
203
+ ? void 0
204
+ : _j.map((block) =>
205
+ /* @__PURE__ */ React.createElement(RenderBlock, {
206
+ key: block.id,
207
+ block,
208
+ })
209
+ )
210
+ )
211
+ )
212
+ : null
213
+ );
63
214
  }
64
- export {
65
- RenderContent as default
66
- };
215
+ export { RenderContent as default };
@@ -1,12 +1,17 @@
1
- import * as React from "react";
2
- import { View, StyleSheet, Image, Text } from "react-native";
3
- import { useState, useContext, useEffect } from "react";
4
- import { isBrowser } from "../functions/is-browser";
5
- import RenderBlock from "./render-block.lite";
6
- import BuilderContext from "../context/builder.context.lite";
7
- import { track } from "../functions/track";
8
- import { ifTarget } from "../functions/if-target";
9
- import { onChange } from "../functions/on-change";
1
+ import * as React from 'react';
2
+ import { View, StyleSheet, Image, Text } from 'react-native';
3
+ import { useState, useContext, useEffect } from 'react';
4
+ import { isBrowser } from '../functions/is-browser';
5
+ import RenderBlock from './render-block.lite';
6
+ import BuilderContext from '../context/builder.context.lite';
7
+ import { track } from '../functions/track';
8
+ import { ifTarget } from '../functions/if-target';
9
+ import { onChange } from '../functions/on-change';
10
+ import { isReactNative } from '../functions/is-react-native';
11
+ import { isEditing } from '../functions/is-editing';
12
+ import { isPreviewing } from '../functions/is-previewing';
13
+ import { previewingModelName } from '../functions/previewing-model-name';
14
+ import { getContent } from '../functions/get-content';
10
15
 
11
16
  export default function RenderContent(props) {
12
17
  function useContent() {
@@ -21,12 +26,74 @@ export default function RenderContent(props) {
21
26
 
22
27
  const [overrideContent, setOverrideContent] = useState(() => null);
23
28
 
29
+ function getCssFromFont(font, data) {
30
+ // TODO: compute what font sizes are used and only load those.......
31
+ const family =
32
+ font.family +
33
+ (font.kind && !font.kind.includes('#') ? ', ' + font.kind : '');
34
+ const name = family.split(',')[0];
35
+ const url = font.fileUrl ? font.fileUrl : font.files && font.files.regular;
36
+ let str = '';
37
+
38
+ if (url && family && name) {
39
+ str += `
40
+ @font-face {
41
+ font-family: "${family}";
42
+ src: local("${name}"), url('${url}') format('woff2');
43
+ font-display: fallback;
44
+ font-weight: 400;
45
+ }
46
+ `.trim();
47
+ }
48
+
49
+ if (font.files) {
50
+ for (const weight in font.files) {
51
+ const isNumber = String(Number(weight)) === weight;
52
+
53
+ if (!isNumber) {
54
+ continue;
55
+ } // TODO: maybe limit number loaded
56
+
57
+ const weightUrl = font.files[weight];
58
+
59
+ if (weightUrl && weightUrl !== url) {
60
+ str += `
61
+ @font-face {
62
+ font-family: "${family}";
63
+ src: url('${weightUrl}') format('woff2');
64
+ font-display: fallback;
65
+ font-weight: ${weight};
66
+ }
67
+ `.trim();
68
+ }
69
+ }
70
+ }
71
+
72
+ return str;
73
+ }
74
+
75
+ function getFontCss(data) {
76
+ // TODO: flag for this
77
+ // if (!this.builder.allowCustomFonts) {
78
+ // return '';
79
+ // }
80
+ // TODO: separate internal data from external
81
+ return (
82
+ (data?.customFonts &&
83
+ data.customFonts.length &&
84
+ data.customFonts
85
+ .map((font) => this.getCssFromFont(font, data))
86
+ .join(' ')) ||
87
+ ''
88
+ );
89
+ }
90
+
24
91
  function processMessage(event) {
25
92
  const { data } = event;
26
93
 
27
94
  if (data) {
28
95
  switch (data.type) {
29
- case "builder.contentUpdate": {
96
+ case 'builder.contentUpdate': {
30
97
  const key =
31
98
  data.data.key ||
32
99
  data.data.alias ||
@@ -41,7 +108,7 @@ export default function RenderContent(props) {
41
108
  break;
42
109
  }
43
110
 
44
- case "builder.patchUpdates": {
111
+ case 'builder.patchUpdates': {
45
112
  // TODO
46
113
  break;
47
114
  }
@@ -51,10 +118,42 @@ export default function RenderContent(props) {
51
118
 
52
119
  useEffect(() => {
53
120
  if (isBrowser()) {
54
- window.addEventListener("message", processMessage); // TODO: run this when content is defined
55
- // track('impression', {
56
- // contentId: props.content!.id,
57
- // });
121
+ if (isEditing()) {
122
+ window.addEventListener('message', processMessage);
123
+ }
124
+
125
+ if (useContent() && !isEditing()) {
126
+ track('impression', {
127
+ contentId: useContent().id,
128
+ });
129
+ }
130
+
131
+ if (isPreviewing()) {
132
+ if (props.model && previewingModelName() === props.model) {
133
+ const options = {};
134
+ const currentUrl = new URL(location.href);
135
+ const apiKey = currentUrl.searchParams.get('apiKey');
136
+
137
+ if (apiKey) {
138
+ const builderPrefix = 'builder.';
139
+ currentUrl.searchParams.forEach((value, key) => {
140
+ if (key.startsWith(builderPrefix)) {
141
+ options[key.replace(builderPrefix, '')] = value;
142
+ }
143
+ }); // TODO: need access to API key
144
+
145
+ getContent({
146
+ model: props.model,
147
+ apiKey,
148
+ options,
149
+ }).then((content) => {
150
+ if (content) {
151
+ setOverrideContent(content);
152
+ }
153
+ });
154
+ } // TODO: fetch content and override. Forward all builder.* params
155
+ }
156
+ }
58
157
  }
59
158
  }, []);
60
159
 
@@ -62,7 +161,7 @@ export default function RenderContent(props) {
62
161
  <BuilderContext.Provider
63
162
  value={{
64
163
  get content() {
65
- return props.content;
164
+ return useContent();
66
165
  },
67
166
 
68
167
  get state() {
@@ -74,22 +173,35 @@ export default function RenderContent(props) {
74
173
  },
75
174
  }}
76
175
  >
77
- <View
78
- onClick={(event) => {
79
- track("click", {
80
- contentId: props.content.id,
81
- });
82
- }}
83
- data-builder-content-id={props.content?.id}
84
- >
85
- {useContent?.()?.data?.cssCode && (
86
- <View>{useContent().data.cssCode}</View>
87
- )}
88
-
89
- {useContent?.()?.data?.blocks.map((block) => (
90
- <RenderBlock key={block.id} block={block} />
91
- ))}
92
- </View>
176
+ {useContent() ? (
177
+ <>
178
+ <View
179
+ onClick={(event) => {
180
+ if (!isEditing()) {
181
+ track('click', {
182
+ contentId: useContent().id,
183
+ });
184
+ }
185
+ }}
186
+ data-builder-content-id={useContent?.()?.id}
187
+ >
188
+ {(useContent?.()?.data?.cssCode ||
189
+ (useContent?.()?.data?.customFonts &&
190
+ useContent?.()?.data?.customFonts.length)) &&
191
+ !isReactNative() ? (
192
+ <View>
193
+ <Text>{useContent().data.cssCode}</Text>
194
+
195
+ <Text>{getFontCss(useContent().data)}</Text>
196
+ </View>
197
+ ) : null}
198
+
199
+ {useContent?.()?.data?.blocks?.map((block) => (
200
+ <RenderBlock key={block.id} block={block} />
201
+ ))}
202
+ </View>
203
+ </>
204
+ ) : null}
93
205
  </BuilderContext.Provider>
94
206
  );
95
207
  }
@@ -1,25 +1,25 @@
1
1
  import * as React from 'react';
2
- const sizeNames = ["xsmall", "small", "medium", "large"];
2
+ const sizeNames = ['xsmall', 'small', 'medium', 'large'];
3
3
  const sizes = {
4
4
  xsmall: {
5
5
  min: 0,
6
6
  default: 0,
7
- max: 0
7
+ max: 0,
8
8
  },
9
9
  small: {
10
10
  min: 320,
11
11
  default: 321,
12
- max: 640
12
+ max: 640,
13
13
  },
14
14
  medium: {
15
15
  min: 641,
16
16
  default: 642,
17
- max: 991
17
+ max: 991,
18
18
  },
19
19
  large: {
20
20
  min: 990,
21
21
  default: 991,
22
- max: 1200
22
+ max: 1200,
23
23
  },
24
24
  getWidthForSize(size) {
25
25
  return this[size].default;
@@ -31,10 +31,7 @@ const sizes = {
31
31
  return size;
32
32
  }
33
33
  }
34
- return "large";
35
- }
36
- };
37
- export {
38
- sizeNames,
39
- sizes
34
+ return 'large';
35
+ },
40
36
  };
37
+ export { sizeNames, sizes };
@@ -1,5 +1,3 @@
1
- import { createContext } from "react";
1
+ import { createContext } from 'react';
2
2
  var stdin_default = createContext({ content: null, context: {}, state: {} });
3
- export {
4
- stdin_default as default
5
- };
3
+ export { stdin_default as default };
@@ -1,20 +1,29 @@
1
1
  import * as React from 'react';
2
- import { isBrowser } from "./is-browser";
3
- import { isEditing } from "./is-editing";
2
+ import { isBrowser } from './is-browser';
3
+ import { isEditing } from './is-editing';
4
4
  function evaluate(options) {
5
5
  const { code } = options;
6
6
  const builder = {
7
7
  isEditing: isEditing(),
8
- isBrowser: isBrowser()
8
+ isBrowser: isBrowser(),
9
9
  };
10
- const useReturn = !(code.includes(";") || code.includes(" return ") || code.trim().startsWith("return "));
10
+ const useReturn = !(
11
+ code.includes(';') ||
12
+ code.includes(' return ') ||
13
+ code.trim().startsWith('return ')
14
+ );
11
15
  const useCode = `${useReturn ? `return (${code});` : code}`;
12
16
  try {
13
- return new Function("builder", "Builder", "state", "context", "event", useCode)(builder, builder, options.state, options.context, options.event);
17
+ return new Function(
18
+ 'builder',
19
+ 'Builder',
20
+ 'state',
21
+ 'context',
22
+ 'event',
23
+ useCode
24
+ )(builder, builder, options.state, options.context, options.event);
14
25
  } catch (e) {
15
- console.warn("Builder custom code error", e);
26
+ console.warn('Builder custom code error: ', e);
16
27
  }
17
28
  }
18
- export {
19
- evaluate
20
- };
29
+ export { evaluate };
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ function capitalizeFirstLetter(string) {
3
+ return string.charAt(0).toUpperCase() + string.slice(1);
4
+ }
5
+ const getEventHandlerName = (key) => `on${capitalizeFirstLetter(key)}`;
6
+ export { getEventHandlerName };
@@ -1,23 +1,23 @@
1
1
  import * as React from 'react';
2
- import { evaluate } from "./evaluate";
3
- function capitalizeFirstLetter(string) {
4
- return string.charAt(0).toUpperCase() + string.slice(1);
5
- }
2
+ import { evaluate } from './evaluate';
3
+ import { getEventHandlerName } from './event-handler-name';
6
4
  function getBlockActions(options) {
7
5
  const obj = {};
8
6
  if (options.block.actions) {
9
7
  for (const key in options.block.actions) {
8
+ if (!options.block.actions.hasOwnProperty(key)) {
9
+ continue;
10
+ }
10
11
  const value = options.block.actions[key];
11
- obj["on" + capitalizeFirstLetter(key)] = (event) => evaluate({
12
- code: value,
13
- context: options.context,
14
- state: options.state,
15
- event
16
- });
12
+ obj[getEventHandlerName(key)] = (event) =>
13
+ evaluate({
14
+ code: value,
15
+ context: options.context,
16
+ state: options.state,
17
+ event,
18
+ });
17
19
  }
18
20
  }
19
21
  return obj;
20
22
  }
21
- export {
22
- getBlockActions
23
- };
23
+ export { getBlockActions };
@@ -1,8 +1,31 @@
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) =>
7
+ key in obj
8
+ ? __defProp(obj, key, {
9
+ enumerable: true,
10
+ configurable: true,
11
+ writable: true,
12
+ value,
13
+ })
14
+ : (obj[key] = value);
15
+ var __spreadValues = (a, b) => {
16
+ for (var prop in b || (b = {}))
17
+ if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
18
+ if (__getOwnPropSymbols)
19
+ for (var prop of __getOwnPropSymbols(b)) {
20
+ if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
21
+ }
22
+ return a;
23
+ };
2
24
  function getBlockComponentOptions(block) {
3
25
  var _a;
4
- return (_a = block.component) == null ? void 0 : _a.options;
26
+ return __spreadValues(
27
+ __spreadValues({}, (_a = block.component) == null ? void 0 : _a.options),
28
+ block.options
29
+ );
5
30
  }
6
- export {
7
- getBlockComponentOptions
8
- };
31
+ export { getBlockComponentOptions };