@builder.io/sdk-react-native 0.0.1-68 → 0.0.1-69

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 (96) hide show
  1. package/package.json +1 -1
  2. package/src/blocks/button/component-info.js +0 -1
  3. package/src/blocks/columns/component-info.js +3 -3
  4. package/src/blocks/custom-code/component-info.js +0 -1
  5. package/src/blocks/embed/component-info.js +3 -3
  6. package/src/blocks/embed/helpers.js +0 -1
  7. package/src/blocks/form/component-info.js +0 -1
  8. package/src/blocks/form/form.js +5 -2
  9. package/src/blocks/fragment/component-info.js +0 -1
  10. package/src/blocks/image/component-info.js +3 -3
  11. package/src/blocks/image/image.helpers.js +0 -1
  12. package/src/blocks/image/image.js +0 -1
  13. package/src/blocks/img/component-info.js +0 -1
  14. package/src/blocks/img/img.js +1 -1
  15. package/src/blocks/input/component-info.js +0 -1
  16. package/src/blocks/raw-text/component-info.js +0 -1
  17. package/src/blocks/section/component-info.js +0 -1
  18. package/src/blocks/select/component-info.js +0 -1
  19. package/src/blocks/submit-button/component-info.js +0 -1
  20. package/src/blocks/symbol/component-info.js +0 -1
  21. package/src/blocks/text/component-info.js +0 -1
  22. package/src/blocks/text/text.js +0 -1
  23. package/src/blocks/textarea/component-info.js +0 -1
  24. package/src/blocks/util.js +7 -0
  25. package/src/blocks/video/component-info.js +0 -1
  26. package/src/blocks/video/video.js +0 -1
  27. package/src/components/render-block/block-styles.js +5 -8
  28. package/src/components/render-block/render-block.helpers.js +0 -1
  29. package/src/components/render-block/render-block.js +22 -20
  30. package/src/components/render-block/render-component.js +4 -2
  31. package/src/components/render-block/render-repeated-block.js +2 -1
  32. package/src/components/render-block/types.js +0 -1
  33. package/src/components/render-blocks.js +7 -2
  34. package/src/components/render-content/index.js +0 -1
  35. package/src/components/render-content/render-content.js +13 -2
  36. package/src/constants/builder-registered-components.js +0 -1
  37. package/src/constants/device-sizes.js +0 -1
  38. package/src/constants/target.js +0 -1
  39. package/src/functions/camel-to-kebab-case.js +0 -1
  40. package/src/functions/convert-style-object.js +0 -1
  41. package/src/functions/evaluate.js +0 -1
  42. package/src/functions/event-handler-name.js +0 -1
  43. package/src/functions/get-block-actions.js +0 -1
  44. package/src/functions/get-block-component-options.js +0 -1
  45. package/src/functions/get-block-properties.js +0 -1
  46. package/src/functions/get-block-styles.js +0 -1
  47. package/src/functions/get-block-tag.js +0 -1
  48. package/src/functions/get-builder-search-params/fn.test.js +0 -1
  49. package/src/functions/get-builder-search-params/index.js +0 -1
  50. package/src/functions/get-content/ab-testing.js +0 -1
  51. package/src/functions/get-content/fn.test.js +0 -1
  52. package/src/functions/get-content/index.js +0 -1
  53. package/src/functions/get-content/types.js +0 -1
  54. package/src/functions/get-fetch.js +2 -3
  55. package/src/functions/get-global-this.js +0 -1
  56. package/src/functions/get-processed-block.js +10 -7
  57. package/src/functions/get-processed-block.test.js +1 -2
  58. package/src/functions/if-target.js +0 -1
  59. package/src/functions/is-browser.js +0 -1
  60. package/src/functions/is-editing.js +0 -1
  61. package/src/functions/is-iframe.js +0 -1
  62. package/src/functions/is-previewing.js +0 -1
  63. package/src/functions/is-react-native.js +0 -1
  64. package/src/functions/on-change.js +0 -1
  65. package/src/functions/on-change.test.js +0 -1
  66. package/src/functions/register-component.js +0 -1
  67. package/src/functions/register.js +0 -1
  68. package/src/functions/sanitize-styles.js +0 -1
  69. package/src/functions/set-editor-settings.js +0 -1
  70. package/src/functions/set.js +0 -1
  71. package/src/functions/set.test.js +0 -1
  72. package/src/functions/track.js +0 -1
  73. package/src/functions/transform-block.js +0 -1
  74. package/src/helpers/cookie.js +0 -1
  75. package/src/helpers/css.js +0 -1
  76. package/src/helpers/flatten.js +0 -1
  77. package/src/helpers/localStorage.js +0 -1
  78. package/src/helpers/nullable.js +0 -1
  79. package/src/helpers/sessionId.js +0 -1
  80. package/src/helpers/time.js +0 -1
  81. package/src/helpers/url.js +0 -1
  82. package/src/helpers/url.test.js +0 -1
  83. package/src/helpers/uuid.js +0 -1
  84. package/src/helpers/visitorId.js +0 -1
  85. package/src/index-helpers/blocks-exports.js +0 -1
  86. package/src/index-helpers/top-of-file.js +0 -1
  87. package/src/index.js +0 -1
  88. package/src/scripts/init-editing.js +4 -6
  89. package/src/types/builder-block.js +0 -1
  90. package/src/types/builder-content.js +0 -1
  91. package/src/types/can-track.js +0 -1
  92. package/src/types/components.js +0 -1
  93. package/src/types/deep-partial.js +0 -1
  94. package/src/types/element.js +0 -1
  95. package/src/types/targets.js +0 -1
  96. package/src/types/typescript.js +0 -1
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-68",
4
+ "version": "0.0.1-69",
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,4 +1,3 @@
1
- import * as React from 'react';
2
1
  const componentInfo = {
3
2
  name: "Core:Button",
4
3
  builtIn: true,
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import { markSerializable } from "../util";
2
2
  const componentInfo = {
3
3
  name: "Columns",
4
4
  builtIn: true,
@@ -187,7 +187,7 @@ const componentInfo = {
187
187
  ]
188
188
  }
189
189
  ],
190
- onChange(options) {
190
+ onChange: markSerializable((options) => {
191
191
  function clearWidths() {
192
192
  columns.forEach((col) => {
193
193
  col.delete("width");
@@ -211,7 +211,7 @@ const componentInfo = {
211
211
  }
212
212
  }
213
213
  }
214
- }
214
+ })
215
215
  },
216
216
  {
217
217
  name: "space",
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  const componentInfo = {
3
2
  name: "Custom Code",
4
3
  static: true,
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import { markSerializable } from "../util";
2
2
  const componentInfo = {
3
3
  name: "Embed",
4
4
  static: true,
@@ -10,7 +10,7 @@ const componentInfo = {
10
10
  required: true,
11
11
  defaultValue: "",
12
12
  helperText: "e.g. enter a youtube url, google map, etc",
13
- onChange(options) {
13
+ onChange: markSerializable((options) => {
14
14
  const url = options.get("url");
15
15
  if (url) {
16
16
  options.set("content", "Loading...");
@@ -29,7 +29,7 @@ const componentInfo = {
29
29
  } else {
30
30
  options.delete("content");
31
31
  }
32
- }
32
+ })
33
33
  },
34
34
  {
35
35
  name: "content",
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  const SCRIPT_MIME_TYPES = [
3
2
  "text/javascript",
4
3
  "application/javascript",
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  const componentInfo = {
3
2
  name: "Form:Form",
4
3
  builtIn: true,
@@ -39,8 +39,9 @@ var __async = (__this, __arguments, generator) => {
39
39
  };
40
40
  import * as React from "react";
41
41
  import { View, StyleSheet, Text } from "react-native";
42
- import { useState, useRef } from "react";
42
+ import { useState, useContext, useRef } from "react";
43
43
  import RenderBlock from "../../components/render-block/render-block.js";
44
+ import BuilderBlocks from "../../components/render-blocks.js";
44
45
  import { isEditing } from "../../functions/is-editing.js";
45
46
  function FormComponent(props) {
46
47
  var _a, _b;
@@ -191,6 +192,7 @@ function FormComponent(props) {
191
192
  });
192
193
  }
193
194
  }
195
+ const builderContext = useContext(BuilderContext);
194
196
  return /* @__PURE__ */ React.createElement(View, __spreadProps(__spreadValues({}, props.attributes), {
195
197
  validate: props.validate,
196
198
  ref: formRef,
@@ -199,7 +201,8 @@ function FormComponent(props) {
199
201
  name: props.name,
200
202
  onSubmit: (event) => onSubmit(event)
201
203
  }), " ", props.builderBlock && props.builderBlock.children ? /* @__PURE__ */ React.createElement(React.Fragment, null, (_b = (_a = props.builderBlock) == null ? void 0 : _a.children) == null ? void 0 : _b.map((block) => /* @__PURE__ */ React.createElement(RenderBlock, {
202
- block
204
+ block,
205
+ context: builderContext
203
206
  }))) : null, " ", submissionState() === "error" ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(BuilderBlocks, {
204
207
  dataPath: "errorMessage",
205
208
  blocks: props.errorMessage
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  const componentInfo = {
3
2
  name: "Fragment",
4
3
  static: true,
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import { markSerializable } from "../util";
2
2
  const componentInfo = {
3
3
  name: "Image",
4
4
  static: true,
@@ -19,7 +19,7 @@ const componentInfo = {
19
19
  allowedFileTypes: ["jpeg", "jpg", "png", "svg"],
20
20
  required: true,
21
21
  defaultValue: "https://cdn.builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
22
- onChange(options) {
22
+ onChange: markSerializable((options) => {
23
23
  const DEFAULT_ASPECT_RATIO = 0.7041;
24
24
  options.delete("srcset");
25
25
  options.delete("noWebp");
@@ -65,7 +65,7 @@ const componentInfo = {
65
65
  }
66
66
  });
67
67
  }
68
- }
68
+ })
69
69
  },
70
70
  {
71
71
  name: "backgroundSize",
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  function removeProtocol(path) {
3
2
  return path.replace(/http(s)?:/, "");
4
3
  }
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
4
3
  var __hasOwnProp = Object.prototype.hasOwnProperty;
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  const componentInfo = {
3
2
  name: "Raw:Img",
4
3
  hideFromInsertMenu: true,
@@ -28,7 +28,7 @@ function ImgComponent(props) {
28
28
  },
29
29
  key: isEditing() && props.imgSrc || "default-key",
30
30
  alt: props.altText,
31
- src: props.imgSrc
31
+ src: props.imgSrc || props.image
32
32
  }));
33
33
  }
34
34
  export {
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  const componentInfo = {
3
2
  name: "Form:Input",
4
3
  builtIn: true,
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  const componentInfo = {
3
2
  name: "Builder:RawText",
4
3
  hideFromInsertMenu: true,
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  const componentInfo = {
3
2
  name: "Core:Section",
4
3
  static: true,
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  const componentInfo = {
3
2
  name: "Form:Select",
4
3
  builtIn: true,
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  const componentInfo = {
3
2
  name: "Form:SubmitButton",
4
3
  builtIn: true,
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  const componentInfo = {
3
2
  name: "Symbol",
4
3
  noWrap: true,
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  const componentInfo = {
3
2
  name: "Text",
4
3
  static: true,
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
4
3
  var __hasOwnProp = Object.prototype.hasOwnProperty;
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  const componentInfo = {
3
2
  name: "Form:TextArea",
4
3
  builtIn: true,
@@ -0,0 +1,7 @@
1
+ function markSerializable(fn) {
2
+ fn.__qwik_serializable__ = true;
3
+ return fn;
4
+ }
5
+ export {
6
+ markSerializable
7
+ };
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  const componentInfo = {
3
2
  name: "Video",
4
3
  canHaveChildren: true,
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  import { View } from "react-native";
3
2
  import ReactVideo from "react-native-video";
4
3
  function Video(props) {
@@ -1,18 +1,16 @@
1
1
  import * as React from "react";
2
- import { useContext } from "react";
2
+ import { getMaxWidthQueryForSize } from "../../constants/device-sizes.js";
3
3
  import { TARGET } from "../../constants/target.js";
4
- import BuilderContext from "../../context/builder.context";
5
4
  import { getProcessedBlock } from "../../functions/get-processed-block.js";
6
- import RenderInlinedStyles from "../render-inlined-styles.js";
7
5
  import { convertStyleMaptoCSS } from "../../helpers/css.js";
8
- import { getMaxWidthQueryForSize } from "../../constants/device-sizes.js";
6
+ import RenderInlinedStyles from "../render-inlined-styles.js";
9
7
  function BlockStyles(props) {
10
8
  function useBlock() {
11
9
  return getProcessedBlock({
12
10
  block: props.block,
13
- state: builderContext.state,
14
- context: builderContext.context,
15
- evaluateBindings: true
11
+ state: props.context.state,
12
+ context: props.context.context,
13
+ shouldEvaluateBindings: true
16
14
  });
17
15
  }
18
16
  function css() {
@@ -30,7 +28,6 @@ function BlockStyles(props) {
30
28
  }` : ""}
31
29
  }`;
32
30
  }
33
- const builderContext = useContext(BuilderContext);
34
31
  return /* @__PURE__ */ React.createElement(React.Fragment, null, TARGET === "vue2" || TARGET === "vue3" || TARGET === "svelte" ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(RenderInlinedStyles, {
35
32
  styles: css()
36
33
  })) : null);
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  const EMPTY_HTML_ELEMENTS = [
3
2
  "area",
4
3
  "base",
@@ -30,8 +30,6 @@ var __objRest = (source, exclude) => {
30
30
  return target;
31
31
  };
32
32
  import * as React from "react";
33
- import { useContext } from "react";
34
- import BuilderContext from "../../context/builder.context";
35
33
  import { getBlockActions } from "../../functions/get-block-actions.js";
36
34
  import { getBlockComponentOptions } from "../../functions/get-block-component-options.js";
37
35
  import { getBlockProperties } from "../../functions/get-block-properties.js";
@@ -49,14 +47,14 @@ function RenderBlock(props) {
49
47
  var _a2;
50
48
  const componentName = (_a2 = getProcessedBlock({
51
49
  block: props.block,
52
- state: builderContext.state,
53
- context: builderContext.context,
54
- evaluateBindings: false
50
+ state: props.context.state,
51
+ context: props.context.context,
52
+ shouldEvaluateBindings: false
55
53
  }).component) == null ? void 0 : _a2.name;
56
54
  if (!componentName) {
57
55
  return null;
58
56
  }
59
- const ref = builderContext.registeredComponents[componentName];
57
+ const ref = props.context.registeredComponents[componentName];
60
58
  if (!ref) {
61
59
  console.warn(`
62
60
  Could not find a registered component named "${componentName}".
@@ -84,16 +82,16 @@ function RenderBlock(props) {
84
82
  function useBlock() {
85
83
  return repeatItemData() ? props.block : getProcessedBlock({
86
84
  block: props.block,
87
- state: builderContext.state,
88
- context: builderContext.context,
89
- evaluateBindings: true
85
+ state: props.context.state,
86
+ context: props.context.context,
87
+ shouldEvaluateBindings: true
90
88
  });
91
89
  }
92
90
  function attributes() {
93
91
  return __spreadProps(__spreadValues(__spreadValues({}, getBlockProperties(useBlock())), getBlockActions({
94
92
  block: useBlock(),
95
- state: builderContext.state,
96
- context: builderContext.context
93
+ state: props.context.state,
94
+ context: props.context.context
97
95
  })), {
98
96
  style: getBlockStyles(useBlock())
99
97
  });
@@ -111,7 +109,8 @@ function RenderBlock(props) {
111
109
  return {
112
110
  blockChildren: children(),
113
111
  componentRef: componentRef(),
114
- componentOptions: componentOptions()
112
+ componentOptions: componentOptions(),
113
+ context: props.context
115
114
  };
116
115
  }
117
116
  function children() {
@@ -129,8 +128,8 @@ function RenderBlock(props) {
129
128
  }
130
129
  const itemsArray = evaluate({
131
130
  code: repeat.collection,
132
- state: builderContext.state,
133
- context: builderContext.context
131
+ state: props.context.state,
132
+ context: props.context.context
134
133
  });
135
134
  if (!Array.isArray(itemsArray)) {
136
135
  return void 0;
@@ -138,8 +137,8 @@ function RenderBlock(props) {
138
137
  const collectionName = repeat.collection.split(".").pop();
139
138
  const itemNameToUse = repeat.itemName || (collectionName ? collectionName + "Item" : "item");
140
139
  const repeatArray = itemsArray.map((item, index) => ({
141
- context: __spreadProps(__spreadValues({}, builderContext), {
142
- state: __spreadProps(__spreadValues({}, builderContext.state), {
140
+ context: __spreadProps(__spreadValues({}, props.context), {
141
+ state: __spreadProps(__spreadValues({}, props.context.state), {
143
142
  $index: index,
144
143
  $item: item,
145
144
  [itemNameToUse]: item,
@@ -150,7 +149,6 @@ function RenderBlock(props) {
150
149
  }));
151
150
  return repeatArray;
152
151
  }
153
- const builderContext = useContext(BuilderContext);
154
152
  const TagNameRef = tagName();
155
153
  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()), repeatItemData() ? /* @__PURE__ */ React.createElement(React.Fragment, null, (_a = repeatItemData()) == null ? void 0 : _a.map((data, index) => /* @__PURE__ */ React.createElement(RenderRepeatedBlock, {
156
154
  key: index,
@@ -158,11 +156,15 @@ function RenderBlock(props) {
158
156
  block: data.block
159
157
  }))) : null, !repeatItemData() ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(RenderComponent, __spreadValues({}, renderComponentProps()))) : null, (_b = childrenWithoutParentComponent()) == null ? void 0 : _b.map((child) => /* @__PURE__ */ React.createElement(RenderBlock, {
160
158
  key: "render-block-" + child.id,
161
- block: child
159
+ block: child,
160
+ context: props.context
162
161
  })), (_c = childrenWithoutParentComponent()) == null ? void 0 : _c.map((child) => /* @__PURE__ */ React.createElement(BlockStyles, {
163
162
  key: "block-style-" + child.id,
164
- block: child
165
- })))) : /* @__PURE__ */ React.createElement(TagNameRef, __spreadValues({}, attributes()))) : /* @__PURE__ */ React.createElement(RenderComponent, __spreadValues({}, renderComponentProps())));
163
+ block: child,
164
+ context: props.context
165
+ })))) : /* @__PURE__ */ React.createElement(TagNameRef, __spreadValues({}, attributes()))) : /* @__PURE__ */ React.createElement(RenderComponent, __spreadProps(__spreadValues({}, renderComponentProps()), {
166
+ context: props.context
167
+ })));
166
168
  }
167
169
  export {
168
170
  RenderBlock as default
@@ -22,10 +22,12 @@ function RenderComponent(props) {
22
22
  const ComponentRefRef = props.componentRef;
23
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
24
  key: "render-block-" + child.id,
25
- block: child
25
+ block: child,
26
+ context: props.context
26
27
  })), (_b = props.blockChildren) == null ? void 0 : _b.map((child) => /* @__PURE__ */ React.createElement(BlockStyles, {
27
28
  key: "block-style-" + child.id,
28
- block: child
29
+ block: child,
30
+ context: props.context
29
31
  })))) : null);
30
32
  }
31
33
  export {
@@ -21,7 +21,8 @@ function RenderRepeatedBlock(props) {
21
21
  }
22
22
  }
23
23
  }, /* @__PURE__ */ React.createElement(RenderBlock, {
24
- block: props.block
24
+ block: props.block,
25
+ context: props.repeatContext
25
26
  }));
26
27
  }
27
28
  export {
@@ -1 +0,0 @@
1
- import * as React from 'react';
@@ -1,5 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { View, StyleSheet } from "react-native";
3
+ import { useContext } from "react";
4
+ import BuilderContext from "../context/builder.context";
3
5
  import { isEditing } from "../functions/is-editing.js";
4
6
  import BlockStyles from "./render-block/block-styles.js";
5
7
  import RenderBlock from "./render-block/render-block.js";
@@ -33,6 +35,7 @@ function RenderBlocks(props) {
33
35
  }, "*");
34
36
  }
35
37
  }
38
+ const builderContext = useContext(BuilderContext);
36
39
  return /* @__PURE__ */ React.createElement(View, {
37
40
  "builder-path": props.path,
38
41
  "builder-parent-id": props.parent,
@@ -44,10 +47,12 @@ function RenderBlocks(props) {
44
47
  style: styles.view1
45
48
  }, props.blocks ? /* @__PURE__ */ React.createElement(React.Fragment, null, (_a = props.blocks) == null ? void 0 : _a.map((block) => /* @__PURE__ */ React.createElement(RenderBlock, {
46
49
  key: "render-block-" + block.id,
47
- block
50
+ block,
51
+ context: builderContext
48
52
  }))) : null, props.blocks ? /* @__PURE__ */ React.createElement(React.Fragment, null, (_b = props.blocks) == null ? void 0 : _b.map((block) => /* @__PURE__ */ React.createElement(BlockStyles, {
49
53
  key: "block-style-" + block.id,
50
- block
54
+ block,
55
+ context: builderContext
51
56
  }))) : null);
52
57
  }
53
58
  const styles = StyleSheet.create({
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  import { default as default2 } from "./render-content.js";
3
2
  export {
4
3
  default2 as default
@@ -39,7 +39,7 @@ var __async = (__this, __arguments, generator) => {
39
39
  };
40
40
  import * as React from "react";
41
41
  import { View } from "react-native";
42
- import { useState, useEffect } from "react";
42
+ import { useState, useRef, useEffect } from "react";
43
43
  import { getDefaultRegisteredComponents } from "../../constants/builder-registered-components.js";
44
44
  import { TARGET } from "../../constants/target.js";
45
45
  import BuilderContext from "../../context/builder.context";
@@ -56,8 +56,14 @@ import {
56
56
  import { track } from "../../functions/track.js";
57
57
  import RenderBlocks from "../render-blocks.js";
58
58
  import RenderContentStyles from "./components/render-styles.js";
59
+ import {
60
+ registerInsertMenu,
61
+ setupBrowserForEditing
62
+ } from "../../scripts/init-editing.js";
59
63
  function RenderContent(props) {
60
64
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
65
+ const elementRef = useRef(null);
66
+ const [forceReRenderCount, setForceReRenderCount] = useState(() => 0);
61
67
  function useContent() {
62
68
  var _a2;
63
69
  const mergedContent = __spreadProps(__spreadValues(__spreadValues({}, props.content), overrideContent), {
@@ -179,6 +185,9 @@ function RenderContent(props) {
179
185
  useEffect(() => {
180
186
  if (isBrowser()) {
181
187
  if (isEditing()) {
188
+ setForceReRenderCount(forceReRenderCount + 1);
189
+ registerInsertMenu();
190
+ setupBrowserForEditing();
182
191
  Object.values(allRegisteredComponents()).forEach((registeredComponent) => {
183
192
  var _a2;
184
193
  const message = createRegisterComponentMessage(registeredComponent);
@@ -252,13 +261,15 @@ function RenderContent(props) {
252
261
  }
253
262
  }
254
263
  }, useContent() ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(View, {
264
+ ref: elementRef,
255
265
  onClick: (event) => onClick(event),
256
266
  "builder-content-id": (_e = useContent == null ? void 0 : useContent()) == null ? void 0 : _e.id
257
267
  }, shouldRenderContentStyles() ? /* @__PURE__ */ React.createElement(RenderContentStyles, {
258
268
  cssCode: (_g = (_f = useContent == null ? void 0 : useContent()) == null ? void 0 : _f.data) == null ? void 0 : _g.cssCode,
259
269
  customFonts: (_i = (_h = useContent == null ? void 0 : useContent()) == null ? void 0 : _h.data) == null ? void 0 : _i.customFonts
260
270
  }) : null, /* @__PURE__ */ React.createElement(RenderBlocks, {
261
- blocks: (_k = (_j = useContent == null ? void 0 : useContent()) == null ? void 0 : _j.data) == null ? void 0 : _k.blocks
271
+ blocks: (_k = (_j = useContent == null ? void 0 : useContent()) == null ? void 0 : _j.data) == null ? void 0 : _k.blocks,
272
+ key: forceReRenderCount
262
273
  }))) : null);
263
274
  }
264
275
  export {
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
4
3
  var __hasOwnProp = Object.prototype.hasOwnProperty;
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  const SIZES = {
3
2
  small: {
4
3
  min: 320,
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  const TARGET = "reactNative";
3
2
  export {
4
3
  TARGET
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  const camelToKebabCase = (string) => string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
3
2
  export {
4
3
  camelToKebabCase
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  const convertStyleObject = (obj) => {
3
2
  return obj;
4
3
  };
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  import { isBrowser } from "./is-browser.js";
3
2
  import { isEditing } from "./is-editing.js";
4
3
  function evaluate({
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  function capitalizeFirstLetter(string) {
3
2
  return string.charAt(0).toUpperCase() + string.slice(1);
4
3
  }
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  import { evaluate } from "./evaluate.js";
3
2
  import { getEventHandlerName } from "./event-handler-name.js";
4
3
  function getBlockActions(options) {
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  var __defProp = Object.defineProperty;
3
2
  var __defProps = Object.defineProperties;
4
3
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  var __defProp = Object.defineProperty;
3
2
  var __defProps = Object.defineProperties;
4
3
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
4
3
  var __hasOwnProp = Object.prototype.hasOwnProperty;
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  import { View } from "react-native";
3
2
  function getBlockTag(_block) {
4
3
  return View;
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  import { convertSearchParamsToQueryObject, getBuilderSearchParams } from ".";
3
2
  const querystring = "someotherValue=jklsjfdal&abc=klfdjklgfds&builder.cachebust=true&builder.preview=page&builder.noCache=true&__builder_editing__=true&builder.overrides.page=037948e52eaf4743afed464f02c70da4&builder.overrides.037948e52eaf4743afed464f02c70da4=037948e52eaf4743afed464f02c70da4&builder.overrides.page%3A%2F=037948e52eaf4743afed464f02c70da4&preview_theme_id=128854393017";
4
3
  const url = new URL(`localhost:3000/about-us?${querystring}`);
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  import { isBrowser } from "../is-browser";
3
2
  const BUILDER_SEARCHPARAMS_PREFIX = "builder.";
4
3
  const convertSearchParamsToQueryObject = (searchParams) => {
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  const handleABTesting = (item, testGroups) => {
3
2
  if (item.variations && Object.keys(item.variations).length) {
4
3
  const testGroup = item.id ? testGroups[item.id] : void 0;
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  import { generateContentUrl } from ".";
3
2
  const testKey = "YJIGb4i01jvw0SRdL5Bt";
4
3
  const testModel = "page";
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  var __defProp = Object.defineProperty;
3
2
  var __defProps = Object.defineProperties;
4
3
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
@@ -1 +0,0 @@
1
- import * as React from 'react';
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  var __async = (__this, __arguments, generator) => {
3
2
  return new Promise((resolve, reject) => {
4
3
  var fulfilled = (value) => {
@@ -25,9 +24,9 @@ function getFetch() {
25
24
  const globalFetch = getGlobalThis().fetch;
26
25
  if (typeof globalFetch === "undefined" && typeof global !== "undefined") {
27
26
  const nodeFetch = import("node-fetch").then((d) => d.default);
28
- return nodeFetch;
27
+ return nodeFetch.default || nodeFetch;
29
28
  }
30
- return globalFetch;
29
+ return globalFetch.default || globalFetch;
31
30
  });
32
31
  }
33
32
  export {
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  function getGlobalThis() {
3
2
  if (typeof globalThis !== "undefined") {
4
3
  return globalThis;
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  var __defProp = Object.defineProperty;
3
2
  var __defProps = Object.defineProperties;
4
3
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
@@ -40,13 +39,17 @@ const evaluateBindings = ({
40
39
  }
41
40
  return copied;
42
41
  };
43
- function getProcessedBlock(options) {
44
- const { state, context } = options;
45
- const block = transformBlock(options.block);
46
- if (evaluateBindings) {
47
- return evaluateBindings({ block, state, context });
42
+ function getProcessedBlock({
43
+ block,
44
+ context,
45
+ shouldEvaluateBindings,
46
+ state
47
+ }) {
48
+ const transformedBlock = transformBlock(block);
49
+ if (shouldEvaluateBindings) {
50
+ return evaluateBindings({ block: transformedBlock, state, context });
48
51
  } else {
49
- return block;
52
+ return transformedBlock;
50
53
  }
51
54
  }
52
55
  export {
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  import { getProcessedBlock } from "./get-processed-block.js";
3
2
  test("Can process bindings", () => {
4
3
  var _a, _b, _c, _d, _e, _f;
@@ -22,7 +21,7 @@ test("Can process bindings", () => {
22
21
  block,
23
22
  context: {},
24
23
  state: { test: "hello" },
25
- evaluateBindings: true
24
+ shouldEvaluateBindings: true
26
25
  });
27
26
  expect(processed).not.toEqual(block);
28
27
  expect((_a = processed.properties) == null ? void 0 : _a.foo).toEqual("baz");
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  import { TARGET } from "../constants/target.js";
3
2
  function ifTarget({
4
3
  targets,
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  function isBrowser() {
3
2
  return typeof window !== "undefined" && typeof document !== "undefined";
4
3
  }
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  import { isIframe } from "./is-iframe.js";
3
2
  function isEditing() {
4
3
  return isIframe() && window.location.search.indexOf("builder.frameEditing=") !== -1;
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  import { isBrowser } from "./is-browser.js";
3
2
  function isIframe() {
4
3
  return isBrowser() && window.self !== window.top;
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  import { isBrowser } from "./is-browser.js";
3
2
  import { isEditing } from "./is-editing.js";
4
3
  function isPreviewing() {
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  function isReactNative() {
3
2
  return true;
4
3
  }
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  const onChangeProxySymbol = Symbol("onChangeProxySymbol");
3
2
  function onChange(obj, cb) {
4
3
  return new Proxy(obj, {
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  import { onChange } from "./on-change.js";
3
2
  test("onChange can observe a shallow change", () => {
4
3
  let changeHappend = false;
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  var __defProp = Object.defineProperty;
3
2
  var __defProps = Object.defineProperties;
4
3
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  import { isBrowser } from "./is-browser.js";
3
2
  const registry = {};
4
3
  function register(type, info) {
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  const propertiesThatMustBeNumber = new Set(["lineHeight"]);
3
2
  const displayValues = new Set(["flex", "none"]);
4
3
  const SHOW_WARNINGS = false;
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  import { isBrowser } from "./is-browser.js";
3
2
  const settings = {};
4
3
  function setEditorSettings(newSettings) {
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  const set = (obj, _path, value) => {
3
2
  if (Object(obj) !== obj) {
4
3
  return obj;
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  import { set } from "./set.js";
3
2
  test("can shallow set a property", () => {
4
3
  const obj = { foo: "bar" };
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  var __defProp = Object.defineProperty;
3
2
  var __defProps = Object.defineProperties;
4
3
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  var __defProp = Object.defineProperty;
3
2
  var __defProps = Object.defineProperties;
4
3
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  import { isBrowser } from "../functions/is-browser";
3
2
  import { getTopLevelDomain } from "./url";
4
3
  const getCookie = ({
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  import { camelToKebabCase } from "../functions/camel-to-kebab-case";
3
2
  const convertStyleMaptoCSS = (style) => {
4
3
  const cssProps = Object.entries(style).map(([key, value]) => {
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  var __defProp = Object.defineProperty;
3
2
  var __defProps = Object.defineProperties;
4
3
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  import { isBrowser } from "../functions/is-browser";
3
2
  const getLocalStorage = () => isBrowser() && typeof localStorage !== "undefined" ? localStorage : void 0;
4
3
  const getLocalStorageItem = ({
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  const checkIsDefined = (maybeT) => maybeT !== null && maybeT !== void 0;
3
2
  export {
4
3
  checkIsDefined
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  import { getCookie, setCookie } from "./cookie";
3
2
  import { checkIsDefined } from "./nullable";
4
3
  import { uuid } from "./uuid";
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  const MINUTE_TO_MILLESECONDS_MULTIPLIER = 6e4;
3
2
  const getCurrentDatePlusMinutes = (minutes = 30) => new Date(Date.now() + minutes * MINUTE_TO_MILLESECONDS_MULTIPLIER);
4
3
  export {
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  const getTopLevelDomain = (host) => {
3
2
  const parts = host.split(".");
4
3
  if (parts.length > 2) {
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  import { getTopLevelDomain } from "./url.js";
3
2
  describe("getTopLevelDomain", () => {
4
3
  test("handles root domain", () => {
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  function uuidv4() {
3
2
  return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
4
3
  const r = Math.random() * 16 | 0, v = c == "x" ? r : r & 3 | 8;
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  import { getLocalStorageItem, setLocalStorageItem } from "./localStorage";
3
2
  import { checkIsDefined } from "./nullable";
4
3
  import { uuid } from "./uuid";
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  import { default as default2 } from "../blocks/columns/columns.js";
3
2
  import { default as default3 } from "../blocks/image/image.js";
4
3
  import { default as default4 } from "../blocks/text/text.js";
@@ -1,2 +1 @@
1
- import * as React from 'react';
2
1
  import "react-native-url-polyfill/auto";
package/src/index.js CHANGED
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  import "./index-helpers/top-of-file.js";
3
2
  import "./scripts/init-editing.js";
4
3
  export * from "./index-helpers/blocks-exports.js";
@@ -1,7 +1,5 @@
1
- import * as React from 'react';
2
1
  import { TARGET } from "../constants/target.js";
3
2
  import { isBrowser } from "../functions/is-browser.js";
4
- import { isEditing } from "../functions/is-editing.js";
5
3
  import { register } from "../functions/register.js";
6
4
  const registerInsertMenu = () => {
7
5
  register("insertMenu", {
@@ -75,7 +73,7 @@ const setupBrowserForEditing = () => {
75
73
  });
76
74
  }
77
75
  };
78
- if (isEditing()) {
79
- registerInsertMenu();
80
- setupBrowserForEditing();
81
- }
76
+ export {
77
+ registerInsertMenu,
78
+ setupBrowserForEditing
79
+ };
@@ -1 +0,0 @@
1
- import * as React from 'react';
@@ -1 +0,0 @@
1
- import * as React from 'react';
@@ -1 +0,0 @@
1
- import * as React from 'react';
@@ -1 +0,0 @@
1
- import * as React from 'react';
@@ -1 +0,0 @@
1
- import * as React from 'react';
@@ -1 +0,0 @@
1
- import * as React from 'react';
@@ -1 +0,0 @@
1
- import * as React from 'react';
@@ -1 +0,0 @@
1
- import * as React from 'react';