@builder.io/sdk-react-native 0.0.1-49 → 0.0.1-51

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 (142) hide show
  1. package/CHANGELOG.md +11 -2
  2. package/package.json +1 -1
  3. package/src/blocks/button/button.js +31 -0
  4. package/src/blocks/{button.lite.tsx → button/button.lite.tsx} +3 -3
  5. package/src/blocks/button/component-info.js +42 -0
  6. package/src/blocks/columns/columns.js +59 -0
  7. package/src/blocks/{columns.lite.tsx → columns/columns.lite.tsx} +22 -21
  8. package/src/blocks/columns/component-info.js +218 -0
  9. package/src/blocks/custom-code/component-info.js +32 -0
  10. package/src/blocks/custom-code/custom-code.js +50 -0
  11. package/src/blocks/{custom-code.lite.tsx → custom-code/custom-code.lite.tsx} +11 -11
  12. package/src/blocks/embed/component-info.js +25 -0
  13. package/src/blocks/embed/embed.js +50 -0
  14. package/src/blocks/{embed.lite.tsx → embed/embed.lite.tsx} +11 -11
  15. package/src/blocks/form/component-info.js +263 -0
  16. package/src/blocks/form/form.js +221 -0
  17. package/src/blocks/{form.lite.tsx → form/form.lite.tsx} +51 -50
  18. package/src/blocks/fragment/component-info.js +12 -0
  19. package/src/blocks/fragment/fragment.js +8 -0
  20. package/src/blocks/{fragment.lite.tsx → fragment/fragment.lite.tsx} +2 -2
  21. package/src/blocks/image/component-info.js +105 -0
  22. package/src/blocks/image/image.js +41 -0
  23. package/src/blocks/{image.lite.tsx → image/image.lite.tsx} +11 -11
  24. package/src/blocks/img/component-info.js +21 -0
  25. package/src/blocks/img/img.js +36 -0
  26. package/src/blocks/img/img.lite.tsx +18 -0
  27. package/src/blocks/input/component-info.js +75 -0
  28. package/src/blocks/input/input.js +36 -0
  29. package/src/blocks/{input.lite.tsx → input/input.lite.tsx} +4 -4
  30. package/src/blocks/raw-text/component-info.js +17 -0
  31. package/src/blocks/raw-text/raw-text.js +10 -0
  32. package/src/blocks/raw-text/raw-text.lite.tsx +6 -0
  33. package/src/blocks/section/component-info.js +50 -0
  34. package/src/blocks/section/section.js +31 -0
  35. package/src/blocks/{section.lite.tsx → section/section.lite.tsx} +3 -3
  36. package/src/blocks/select/component-info.js +60 -0
  37. package/src/blocks/select/select.js +36 -0
  38. package/src/blocks/{select.lite.tsx → select/select.lite.tsx} +4 -4
  39. package/src/blocks/submit-button/component-info.js +29 -0
  40. package/src/blocks/submit-button/submit-button.js +29 -0
  41. package/src/blocks/{submit-button.lite.tsx → submit-button/submit-button.lite.tsx} +2 -2
  42. package/src/blocks/symbol/component-info.js +43 -0
  43. package/src/blocks/symbol/symbol.js +68 -0
  44. package/src/blocks/symbol/symbol.lite.tsx +60 -0
  45. package/src/blocks/text/component-info.js +25 -0
  46. package/src/blocks/text/text.js +65 -0
  47. package/src/blocks/text/text.lite.tsx +6 -0
  48. package/src/blocks/textarea/component-info.js +48 -0
  49. package/src/blocks/textarea/textarea.js +32 -0
  50. package/src/blocks/{textarea.lite.tsx → textarea/textarea.lite.tsx} +2 -2
  51. package/src/blocks/video/component-info.js +107 -0
  52. package/src/blocks/video/video.js +33 -0
  53. package/src/blocks/{video.lite.tsx → video/video.lite.tsx} +5 -5
  54. package/src/components/error-boundary.js +9 -11
  55. package/src/components/error-boundary.lite.tsx +2 -2
  56. package/src/components/render-block/block-styles.js +29 -0
  57. package/src/components/render-block/block-styles.lite.tsx +35 -0
  58. package/src/components/render-block/render-block.helpers.js +24 -0
  59. package/src/components/render-block/render-block.js +116 -0
  60. package/src/components/render-block/render-block.lite.tsx +139 -0
  61. package/src/components/render-blocks.js +35 -61
  62. package/src/components/render-blocks.lite.tsx +11 -11
  63. package/src/components/render-content/components/render-styles.js +58 -0
  64. package/src/components/render-content/components/render-styles.lite.tsx +70 -0
  65. package/src/components/render-content/index.js +5 -0
  66. package/src/components/render-content/render-content.js +254 -0
  67. package/src/components/render-content/render-content.lite.tsx +283 -0
  68. package/src/components/render-inlined-styles.js +18 -0
  69. package/src/components/render-inlined-styles.lite.tsx +31 -0
  70. package/src/constants/builder-registered-components.js +27 -0
  71. package/src/constants/device-sizes.js +11 -8
  72. package/src/constants/target.js +5 -0
  73. package/src/context/builder.context.js +11 -3
  74. package/src/functions/evaluate.js +20 -20
  75. package/src/functions/event-handler-name.js +3 -1
  76. package/src/functions/fast-clone.js +5 -0
  77. package/src/functions/get-block-actions.js +17 -16
  78. package/src/functions/get-block-component-options.js +9 -16
  79. package/src/functions/get-block-properties.js +14 -18
  80. package/src/functions/get-block-styles.js +17 -34
  81. package/src/functions/get-block-tag.js +4 -2
  82. package/src/functions/get-builder-search-params/fn.test.js +6 -10
  83. package/src/functions/get-builder-search-params/index.js +6 -3
  84. package/src/functions/get-content/fn.test.js +15 -17
  85. package/src/functions/get-content/index.js +25 -42
  86. package/src/functions/get-fetch.js +32 -8
  87. package/src/functions/get-global-this.js +7 -5
  88. package/src/functions/get-processed-block.js +13 -17
  89. package/src/functions/get-processed-block.test.js +16 -27
  90. package/src/functions/if-target.js +14 -3
  91. package/src/functions/is-browser.js +4 -2
  92. package/src/functions/is-editing.js +5 -5
  93. package/src/functions/is-iframe.js +4 -2
  94. package/src/functions/is-previewing.js +6 -4
  95. package/src/functions/is-react-native.js +3 -1
  96. package/src/functions/macro-eval.js +5 -2
  97. package/src/functions/on-change.js +7 -4
  98. package/src/functions/on-change.test.js +9 -10
  99. package/src/functions/previewing-model-name.js +5 -3
  100. package/src/functions/register-component.js +33 -44
  101. package/src/functions/register.js +10 -8
  102. package/src/functions/set-editor-settings.js +7 -5
  103. package/src/functions/set.js +5 -14
  104. package/src/functions/set.test.js +13 -14
  105. package/src/functions/track.js +13 -7
  106. package/src/functions/transform-block.js +13 -17
  107. package/src/index-helpers/blocks-exports.js +9 -9
  108. package/src/index-helpers/top-of-file.js +1 -1
  109. package/src/index.js +10 -12
  110. package/src/scripts/init-editing.js +74 -88
  111. package/src/types/components.js +1 -0
  112. package/src/types/element.js +1 -0
  113. package/src/types/targets.js +1 -0
  114. package/src/types/typescript.js +1 -0
  115. package/src/blocks/button.js +0 -86
  116. package/src/blocks/columns.js +0 -293
  117. package/src/blocks/custom-code.js +0 -83
  118. package/src/blocks/embed.js +0 -77
  119. package/src/blocks/form.js +0 -521
  120. package/src/blocks/fragment.js +0 -21
  121. package/src/blocks/image.js +0 -165
  122. package/src/blocks/img.js +0 -64
  123. package/src/blocks/img.lite.tsx +0 -18
  124. package/src/blocks/input.js +0 -113
  125. package/src/blocks/raw-text.js +0 -17
  126. package/src/blocks/raw-text.lite.tsx +0 -6
  127. package/src/blocks/section.js +0 -84
  128. package/src/blocks/select.js +0 -91
  129. package/src/blocks/submit-button.js +0 -60
  130. package/src/blocks/symbol.js +0 -20
  131. package/src/blocks/symbol.lite.tsx +0 -20
  132. package/src/blocks/text.js +0 -100
  133. package/src/blocks/text.lite.tsx +0 -6
  134. package/src/blocks/textarea.js +0 -73
  135. package/src/blocks/video.js +0 -100
  136. package/src/components/block-styles.js +0 -5
  137. package/src/components/block-styles.lite.tsx +0 -6
  138. package/src/components/render-block.js +0 -164
  139. package/src/components/render-block.lite.tsx +0 -132
  140. package/src/components/render-content.js +0 -220
  141. package/src/components/render-content.lite.tsx +0 -206
  142. package/src/functions/get-target.js +0 -5
@@ -0,0 +1,36 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ import * as React from "react";
21
+ import { View } from "react-native";
22
+ import { isEditing } from "../../functions/is-editing.js";
23
+ function FormInputComponent(props) {
24
+ return /* @__PURE__ */ React.createElement(View, __spreadProps(__spreadValues({}, props.attributes), {
25
+ key: isEditing() && props.defaultValue ? props.defaultValue : "default-key",
26
+ placeholder: props.placeholder,
27
+ type: props.type,
28
+ name: props.name,
29
+ value: props.value,
30
+ defaultValue: props.defaultValue,
31
+ required: props.required
32
+ }));
33
+ }
34
+ export {
35
+ FormInputComponent as default
36
+ };
@@ -1,13 +1,13 @@
1
- import * as React from 'react';
2
- import { View, StyleSheet, Image, Text } from 'react-native';
3
- import { isEditing } from '../functions/is-editing';
1
+ import * as React from "react";
2
+ import { View, StyleSheet, Image, Text } from "react-native";
3
+ import { isEditing } from "../../functions/is-editing.js";
4
4
 
5
5
  export default function FormInputComponent(props) {
6
6
  return (
7
7
  <View
8
8
  {...props.attributes}
9
9
  key={
10
- isEditing() && props.defaultValue ? props.defaultValue : 'default-key'
10
+ isEditing() && props.defaultValue ? props.defaultValue : "default-key"
11
11
  }
12
12
  placeholder={props.placeholder}
13
13
  type={props.type}
@@ -0,0 +1,17 @@
1
+ import * as React from 'react';
2
+ const componentInfo = {
3
+ name: "Builder:RawText",
4
+ hideFromInsertMenu: true,
5
+ builtIn: true,
6
+ inputs: [
7
+ {
8
+ name: "text",
9
+ bubble: true,
10
+ type: "longText",
11
+ required: true
12
+ }
13
+ ]
14
+ };
15
+ export {
16
+ componentInfo
17
+ };
@@ -0,0 +1,10 @@
1
+ import * as React from "react";
2
+ import { View } from "react-native";
3
+ function RawText(props) {
4
+ return /* @__PURE__ */ React.createElement(View, {
5
+ dangerouslySetInnerHTML: { __html: props.text || "" }
6
+ });
7
+ }
8
+ export {
9
+ RawText as default
10
+ };
@@ -0,0 +1,6 @@
1
+ import * as React from "react";
2
+ import { View, StyleSheet, Image, Text } from "react-native";
3
+
4
+ export default function RawText(props) {
5
+ return <View dangerouslySetInnerHTML={{ __html: props.text || "" }} />;
6
+ }
@@ -0,0 +1,50 @@
1
+ import * as React from 'react';
2
+ const componentInfo = {
3
+ name: "Core:Section",
4
+ static: true,
5
+ builtIn: true,
6
+ image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a",
7
+ inputs: [
8
+ {
9
+ name: "maxWidth",
10
+ type: "number",
11
+ defaultValue: 1200
12
+ },
13
+ {
14
+ name: "lazyLoad",
15
+ type: "boolean",
16
+ defaultValue: false,
17
+ advanced: true,
18
+ description: "Only render this section when in view"
19
+ }
20
+ ],
21
+ defaultStyles: {
22
+ paddingLeft: "20px",
23
+ paddingRight: "20px",
24
+ paddingTop: "50px",
25
+ paddingBottom: "50px",
26
+ marginTop: "0px",
27
+ width: "100vw",
28
+ marginLeft: "calc(50% - 50vw)"
29
+ },
30
+ canHaveChildren: true,
31
+ defaultChildren: [
32
+ {
33
+ "@type": "@builder.io/sdk:Element",
34
+ responsiveStyles: {
35
+ large: {
36
+ textAlign: "center"
37
+ }
38
+ },
39
+ component: {
40
+ name: "Text",
41
+ options: {
42
+ text: "<p><b>I am a section! My content keeps from getting too wide, so that it's easy to read even on big screens.</b></p><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur</p>"
43
+ }
44
+ }
45
+ }
46
+ ]
47
+ };
48
+ export {
49
+ componentInfo
50
+ };
@@ -0,0 +1,31 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ import * as React from "react";
21
+ import { View, Text } from "react-native";
22
+ function SectionComponent(props) {
23
+ return /* @__PURE__ */ React.createElement(View, __spreadProps(__spreadValues({}, props.attributes), {
24
+ style: props.maxWidth && typeof props.maxWidth === "number" ? {
25
+ maxWidth: props.maxWidth
26
+ } : void 0
27
+ }), /* @__PURE__ */ React.createElement(Text, null, props.children));
28
+ }
29
+ export {
30
+ SectionComponent as default
31
+ };
@@ -1,12 +1,12 @@
1
- import * as React from 'react';
2
- import { View, StyleSheet, Image, Text } from 'react-native';
1
+ import * as React from "react";
2
+ import { View, StyleSheet, Image, Text } from "react-native";
3
3
 
4
4
  export default function SectionComponent(props) {
5
5
  return (
6
6
  <View
7
7
  {...props.attributes}
8
8
  style={
9
- props.maxWidth && typeof props.maxWidth === 'number'
9
+ props.maxWidth && typeof props.maxWidth === "number"
10
10
  ? {
11
11
  maxWidth: props.maxWidth,
12
12
  }
@@ -0,0 +1,60 @@
1
+ import * as React from 'react';
2
+ const componentInfo = {
3
+ name: "Form:Select",
4
+ builtIn: true,
5
+ image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F83acca093fb24aaf94dee136e9a4b045",
6
+ defaultStyles: {
7
+ alignSelf: "flex-start"
8
+ },
9
+ inputs: [
10
+ {
11
+ name: "options",
12
+ type: "list",
13
+ required: true,
14
+ subFields: [
15
+ {
16
+ name: "value",
17
+ type: "text",
18
+ required: true
19
+ },
20
+ {
21
+ name: "name",
22
+ type: "text"
23
+ }
24
+ ],
25
+ defaultValue: [
26
+ {
27
+ value: "option 1"
28
+ },
29
+ {
30
+ value: "option 2"
31
+ }
32
+ ]
33
+ },
34
+ {
35
+ name: "name",
36
+ type: "string",
37
+ required: true,
38
+ helperText: 'Every select in a form needs a unique name describing what it gets, e.g. "email"'
39
+ },
40
+ {
41
+ name: "defaultValue",
42
+ type: "string"
43
+ },
44
+ {
45
+ name: "value",
46
+ type: "string",
47
+ advanced: true
48
+ },
49
+ {
50
+ name: "required",
51
+ type: "boolean",
52
+ defaultValue: false
53
+ }
54
+ ],
55
+ static: true,
56
+ noWrap: true
57
+ };
58
+ export {
59
+ componentInfo
60
+ };
@@ -0,0 +1,36 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ import * as React from "react";
21
+ import { View, Text } from "react-native";
22
+ import { isEditing } from "../../functions/is-editing.js";
23
+ function SelectComponent(props) {
24
+ var _a;
25
+ return /* @__PURE__ */ React.createElement(View, __spreadProps(__spreadValues({}, props.attributes), {
26
+ value: props.value,
27
+ key: isEditing() && props.defaultValue ? props.defaultValue : "default-key",
28
+ defaultValue: props.defaultValue,
29
+ name: props.name
30
+ }), (_a = props.options) == null ? void 0 : _a.map((option) => /* @__PURE__ */ React.createElement(View, {
31
+ value: option.value
32
+ }, /* @__PURE__ */ React.createElement(Text, null, option.name || option.value))));
33
+ }
34
+ export {
35
+ SelectComponent as default
36
+ };
@@ -1,6 +1,6 @@
1
- import * as React from 'react';
2
- import { View, StyleSheet, Image, Text } from 'react-native';
3
- import { isEditing } from '../functions/is-editing';
1
+ import * as React from "react";
2
+ import { View, StyleSheet, Image, Text } from "react-native";
3
+ import { isEditing } from "../../functions/is-editing.js";
4
4
 
5
5
  export default function SelectComponent(props) {
6
6
  return (
@@ -8,7 +8,7 @@ export default function SelectComponent(props) {
8
8
  {...props.attributes}
9
9
  value={props.value}
10
10
  key={
11
- isEditing() && props.defaultValue ? props.defaultValue : 'default-key'
11
+ isEditing() && props.defaultValue ? props.defaultValue : "default-key"
12
12
  }
13
13
  defaultValue={props.defaultValue}
14
14
  name={props.name}
@@ -0,0 +1,29 @@
1
+ import * as React from 'react';
2
+ const componentInfo = {
3
+ name: "Form:SubmitButton",
4
+ builtIn: true,
5
+ image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fdf2820ffed1f4349a94c40b3221f5b98",
6
+ defaultStyles: {
7
+ appearance: "none",
8
+ paddingTop: "15px",
9
+ paddingBottom: "15px",
10
+ paddingLeft: "25px",
11
+ paddingRight: "25px",
12
+ backgroundColor: "#3898EC",
13
+ color: "white",
14
+ borderRadius: "4px",
15
+ cursor: "pointer"
16
+ },
17
+ inputs: [
18
+ {
19
+ name: "text",
20
+ type: "text",
21
+ defaultValue: "Click me"
22
+ }
23
+ ],
24
+ static: true,
25
+ noWrap: true
26
+ };
27
+ export {
28
+ componentInfo
29
+ };
@@ -0,0 +1,29 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ import * as React from "react";
21
+ import { View, Text } from "react-native";
22
+ function SubmitButton(props) {
23
+ return /* @__PURE__ */ React.createElement(View, __spreadProps(__spreadValues({}, props.attributes), {
24
+ type: "submit"
25
+ }), /* @__PURE__ */ React.createElement(Text, null, props.text));
26
+ }
27
+ export {
28
+ SubmitButton as default
29
+ };
@@ -1,5 +1,5 @@
1
- import * as React from 'react';
2
- import { View, StyleSheet, Image, Text } from 'react-native';
1
+ import * as React from "react";
2
+ import { View, StyleSheet, Image, Text } from "react-native";
3
3
 
4
4
  export default function SubmitButton(props) {
5
5
  return (
@@ -0,0 +1,43 @@
1
+ import * as React from 'react';
2
+ const componentInfo = {
3
+ name: "Symbol",
4
+ noWrap: true,
5
+ static: true,
6
+ inputs: [
7
+ {
8
+ name: "symbol",
9
+ type: "uiSymbol"
10
+ },
11
+ {
12
+ name: "dataOnly",
13
+ helperText: "Make this a data symbol that doesn't display any UI",
14
+ type: "boolean",
15
+ defaultValue: false,
16
+ advanced: true,
17
+ hideFromUI: true
18
+ },
19
+ {
20
+ name: "inheritState",
21
+ helperText: "Inherit the parent component state and data",
22
+ type: "boolean",
23
+ defaultValue: false,
24
+ advanced: true
25
+ },
26
+ {
27
+ name: "renderToLiquid",
28
+ helperText: "Render this symbols contents to liquid. Turn off to fetch with javascript and use custom targeting",
29
+ type: "boolean",
30
+ defaultValue: false,
31
+ advanced: true,
32
+ hideFromUI: true
33
+ },
34
+ {
35
+ name: "useChildren",
36
+ hideFromUI: true,
37
+ type: "boolean"
38
+ }
39
+ ]
40
+ };
41
+ export {
42
+ componentInfo
43
+ };
@@ -0,0 +1,68 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ import * as React from "react";
21
+ import { View } from "react-native";
22
+ import { useState, useContext, useEffect } from "react";
23
+ import RenderContent from "../../components/render-content/render-content.js";
24
+ import BuilderContext from "../../context/builder.context";
25
+ import { getContent } from "../../functions/get-content/index.js";
26
+ function Symbol(props) {
27
+ var _a, _b, _c, _d, _e, _f, _g, _h;
28
+ const [className, setClassName] = useState(() => "builder-symbol");
29
+ const [content, setContent] = useState(() => null);
30
+ const builderContext = useContext(BuilderContext);
31
+ useEffect(() => {
32
+ var _a2;
33
+ setContent((_a2 = props.symbol) == null ? void 0 : _a2.content);
34
+ }, []);
35
+ useEffect(() => {
36
+ const symbolToUse = props.symbol;
37
+ if (symbolToUse && !symbolToUse.content && !content && symbolToUse.model) {
38
+ getContent({
39
+ model: symbolToUse.model,
40
+ apiKey: builderContext.apiKey,
41
+ options: {
42
+ entry: symbolToUse.entry
43
+ }
44
+ }).then((response) => {
45
+ setContent(response);
46
+ });
47
+ }
48
+ }, [
49
+ (_a = props.symbol) == null ? void 0 : _a.content,
50
+ (_b = props.symbol) == null ? void 0 : _b.model,
51
+ (_c = props.symbol) == null ? void 0 : _c.entry,
52
+ content
53
+ ]);
54
+ return /* @__PURE__ */ React.createElement(View, __spreadProps(__spreadValues({}, props.attributes), {
55
+ dataSet: {
56
+ class: className
57
+ }
58
+ }), /* @__PURE__ */ React.createElement(RenderContent, {
59
+ apiKey: builderContext.apiKey,
60
+ context: builderContext.context,
61
+ data: __spreadValues(__spreadValues(__spreadValues({}, (_d = props.symbol) == null ? void 0 : _d.data), builderContext.state), (_g = (_f = (_e = props.symbol) == null ? void 0 : _e.content) == null ? void 0 : _f.data) == null ? void 0 : _g.state),
62
+ model: (_h = props.symbol) == null ? void 0 : _h.model,
63
+ content
64
+ }));
65
+ }
66
+ export {
67
+ Symbol as default
68
+ };
@@ -0,0 +1,60 @@
1
+ import * as React from "react";
2
+ import { View, StyleSheet, Image, Text } from "react-native";
3
+ import { useState, useContext, useEffect } from "react";
4
+ import RenderContent from "../../components/render-content/render-content.lite";
5
+ import BuilderContext from "../../context/builder.context";
6
+ import { getContent } from "../../functions/get-content/index.js";
7
+
8
+ export default function Symbol(props) {
9
+ const [className, setClassName] = useState(() => "builder-symbol");
10
+
11
+ const [content, setContent] = useState(() => null);
12
+
13
+ const builderContext = useContext(BuilderContext);
14
+
15
+ useEffect(() => {
16
+ setContent(props.symbol?.content);
17
+ }, []);
18
+
19
+ useEffect(() => {
20
+ const symbolToUse = props.symbol;
21
+
22
+ if (symbolToUse && !symbolToUse.content && !content && symbolToUse.model) {
23
+ getContent({
24
+ model: symbolToUse.model,
25
+ apiKey: builderContext.apiKey,
26
+ options: {
27
+ entry: symbolToUse.entry,
28
+ },
29
+ }).then((response) => {
30
+ setContent(response);
31
+ });
32
+ }
33
+ }, [
34
+ props.symbol?.content,
35
+ props.symbol?.model,
36
+ props.symbol?.entry,
37
+ content,
38
+ ]);
39
+
40
+ return (
41
+ <View
42
+ {...props.attributes}
43
+ dataSet={{
44
+ class: className,
45
+ }}
46
+ >
47
+ <RenderContent
48
+ apiKey={builderContext.apiKey}
49
+ context={builderContext.context}
50
+ data={{
51
+ ...props.symbol?.data,
52
+ ...builderContext.state,
53
+ ...props.symbol?.content?.data?.state,
54
+ }}
55
+ model={props.symbol?.model}
56
+ content={content}
57
+ />
58
+ </View>
59
+ );
60
+ }
@@ -0,0 +1,25 @@
1
+ import * as React from 'react';
2
+ const componentInfo = {
3
+ name: "Text",
4
+ static: true,
5
+ builtIn: true,
6
+ image: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-text_fields-24px%20(1).svg?alt=media&token=12177b73-0ee3-42ca-98c6-0dd003de1929",
7
+ inputs: [
8
+ {
9
+ name: "text",
10
+ type: "html",
11
+ required: true,
12
+ autoFocus: true,
13
+ bubble: true,
14
+ defaultValue: "Enter some text..."
15
+ }
16
+ ],
17
+ defaultStyles: {
18
+ lineHeight: "normal",
19
+ height: "auto",
20
+ textAlign: "center"
21
+ }
22
+ };
23
+ export {
24
+ componentInfo
25
+ };
@@ -0,0 +1,65 @@
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) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7
+ var __spreadValues = (a, b) => {
8
+ for (var prop in b || (b = {}))
9
+ if (__hasOwnProp.call(b, prop))
10
+ __defNormalProp(a, prop, b[prop]);
11
+ if (__getOwnPropSymbols)
12
+ for (var prop of __getOwnPropSymbols(b)) {
13
+ if (__propIsEnum.call(b, prop))
14
+ __defNormalProp(a, prop, b[prop]);
15
+ }
16
+ return a;
17
+ };
18
+ import HTML from "react-native-render-html";
19
+ function camelToKebabCase(string) {
20
+ return string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
21
+ }
22
+ function pick(object, keys) {
23
+ return keys.reduce((obj, key) => {
24
+ if (object && object.hasOwnProperty(key)) {
25
+ obj[key] = object[key];
26
+ }
27
+ return obj;
28
+ }, {});
29
+ }
30
+ const PICK_STYLES = ["textAlign"];
31
+ function getBlockStyles(block) {
32
+ var _a, _b, _c;
33
+ const styles = __spreadValues(__spreadValues({}, (_a = block.responsiveStyles) == null ? void 0 : _a.large), block.styles);
34
+ if ((_b = block.responsiveStyles) == null ? void 0 : _b.medium) {
35
+ Object.assign(styles, block.responsiveStyles.medium);
36
+ }
37
+ if ((_c = block.responsiveStyles) == null ? void 0 : _c.small) {
38
+ Object.assign(styles, block.responsiveStyles.small);
39
+ }
40
+ return styles;
41
+ }
42
+ function getCss(block) {
43
+ const styleObject = pick(getBlockStyles(block), PICK_STYLES);
44
+ if (!styleObject) {
45
+ return "";
46
+ }
47
+ let str = ``;
48
+ for (const key in styleObject) {
49
+ const value = styleObject[key];
50
+ if (typeof value === "string") {
51
+ str += `${camelToKebabCase(key)}: ${value};`;
52
+ }
53
+ }
54
+ return str;
55
+ }
56
+ function Text(props) {
57
+ return /* @__PURE__ */ React.createElement(HTML, {
58
+ source: {
59
+ html: `<div style="${getCss(props.builderBlock)}">${props.text || ""}</div>`
60
+ }
61
+ });
62
+ }
63
+ export {
64
+ Text as default
65
+ };
@@ -0,0 +1,6 @@
1
+ import * as React from "react";
2
+ import { View, StyleSheet, Image, Text } from "react-native";
3
+
4
+ export default function Text(props) {
5
+ return <View dangerouslySetInnerHTML={{ __html: props.text }} />;
6
+ }