@builder.io/sdk-react-native 0.0.1-9 → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +42 -0
- package/README.md +19 -0
- package/package.json +7 -4
- package/src/blocks/button/button.js +34 -0
- package/src/blocks/button/component-info.js +41 -0
- package/src/blocks/columns/columns.js +62 -0
- package/src/blocks/columns/component-info.js +242 -0
- package/src/blocks/custom-code/component-info.js +31 -0
- package/src/blocks/{custom-code.lite.tsx → custom-code/custom-code.js} +16 -33
- package/src/blocks/embed/component-info.js +44 -0
- package/src/blocks/embed/embed.js +43 -0
- package/src/blocks/embed/helpers.js +9 -0
- package/src/blocks/form/component-info.js +262 -0
- package/src/blocks/form/form.js +224 -0
- package/src/blocks/fragment/component-info.js +11 -0
- package/src/blocks/fragment/fragment.js +8 -0
- package/src/blocks/image/component-info.js +151 -0
- package/src/blocks/image/image.helpers.js +48 -0
- package/src/blocks/image/image.js +77 -0
- package/src/blocks/img/component-info.js +20 -0
- package/src/blocks/img/img.js +36 -0
- package/src/blocks/input/component-info.js +74 -0
- package/src/blocks/input/input.js +36 -0
- package/src/blocks/raw-text/component-info.js +16 -0
- package/src/blocks/raw-text/raw-text.js +10 -0
- package/src/blocks/section/component-info.js +49 -0
- package/src/blocks/section/section.js +31 -0
- package/src/blocks/select/component-info.js +59 -0
- package/src/blocks/select/select.js +36 -0
- package/src/blocks/submit-button/component-info.js +28 -0
- package/src/blocks/submit-button/submit-button.js +29 -0
- package/src/blocks/symbol/component-info.js +43 -0
- package/src/blocks/symbol/symbol.js +65 -0
- package/src/blocks/{text.js → text/component-info.js} +4 -11
- package/src/blocks/text/text.js +10 -0
- package/src/blocks/textarea/component-info.js +47 -0
- package/src/blocks/textarea/textarea.js +32 -0
- package/src/blocks/util.js +7 -0
- package/src/blocks/video/component-info.js +106 -0
- package/src/blocks/video/video.js +52 -0
- package/src/components/render-block/block-styles.js +37 -0
- package/src/components/render-block/render-block.helpers.js +23 -0
- package/src/components/render-block/render-block.js +171 -0
- package/src/components/render-block/render-component.js +36 -0
- package/src/components/render-block/render-repeated-block.js +30 -0
- package/src/components/render-block/types.js +0 -0
- package/src/components/render-blocks.js +29 -13
- package/src/components/render-content/components/render-styles.js +58 -0
- package/src/components/render-content/index.js +4 -0
- package/src/components/render-content/render-content.js +262 -0
- package/src/components/render-inlined-styles.js +18 -0
- package/src/constants/builder-registered-components.js +42 -0
- package/src/constants/device-sizes.js +3 -22
- package/src/constants/target.js +4 -0
- package/src/context/builder.context.js +7 -1
- package/src/context/types.js +0 -0
- package/src/functions/camel-to-kebab-case.js +4 -0
- package/src/functions/convert-style-object.js +6 -0
- package/src/functions/evaluate.js +17 -9
- package/src/functions/event-handler-name.js +7 -0
- package/src/functions/get-block-actions.js +14 -14
- package/src/functions/get-block-component-options.js +22 -2
- package/src/functions/get-block-properties.js +2 -4
- package/src/functions/get-block-styles.js +9 -28
- package/src/functions/get-block-tag.js +1 -2
- package/src/functions/get-builder-search-params/fn.test.js +13 -0
- package/src/functions/get-builder-search-params/index.js +37 -0
- package/src/functions/get-content/ab-testing.js +38 -0
- package/src/functions/get-content/fn.test.js +31 -0
- package/src/functions/get-content/index.js +95 -0
- package/src/functions/get-content/types.js +0 -0
- package/src/functions/get-fetch.js +34 -0
- package/src/functions/get-global-this.js +18 -0
- package/src/functions/get-processed-block.js +22 -10
- package/src/functions/get-processed-block.test.js +14 -9
- package/src/functions/if-target.js +11 -3
- package/src/functions/is-browser.js +1 -3
- package/src/functions/is-editing.js +1 -2
- package/src/functions/is-iframe.js +1 -2
- package/src/functions/is-previewing.js +14 -0
- package/src/functions/mark-mutable.js +10 -0
- package/src/functions/on-change.js +0 -1
- package/src/functions/on-change.test.js +1 -3
- package/src/functions/register-component.js +46 -27
- package/src/functions/register.js +29 -0
- package/src/functions/sanitize-styles.js +32 -0
- package/src/functions/set-editor-settings.js +15 -0
- package/src/functions/set.js +0 -1
- package/src/functions/set.test.js +1 -3
- package/src/functions/track.js +109 -13
- package/src/functions/transform-block.js +37 -0
- package/src/helpers/cookie.js +59 -0
- package/src/helpers/css.js +12 -0
- package/src/helpers/flatten.js +34 -0
- package/src/helpers/localStorage.js +34 -0
- package/src/helpers/nullable.js +4 -0
- package/src/helpers/sessionId.js +26 -0
- package/src/helpers/time.js +5 -0
- package/src/helpers/url.js +10 -0
- package/src/helpers/url.test.js +15 -0
- package/src/helpers/uuid.js +13 -0
- package/src/helpers/visitorId.js +33 -0
- package/src/index-helpers/blocks-exports.js +18 -0
- package/src/index-helpers/top-of-file.js +1 -0
- package/src/index.js +10 -26
- package/src/scripts/init-editing.js +73 -51
- package/src/types/builder-block.js +0 -1
- package/src/types/builder-content.js +0 -1
- package/src/types/can-track.js +0 -0
- package/src/types/components.js +0 -0
- package/src/types/deep-partial.js +0 -0
- package/src/types/element.js +0 -0
- package/src/types/targets.js +0 -0
- package/src/types/typescript.js +0 -0
- package/src/blocks/button.js +0 -37
- package/src/blocks/button.lite.tsx +0 -29
- package/src/blocks/columns.js +0 -42
- package/src/blocks/columns.lite.tsx +0 -41
- package/src/blocks/custom-code.js +0 -56
- package/src/blocks/embed.js +0 -56
- package/src/blocks/embed.lite.tsx +0 -65
- package/src/blocks/form.js +0 -229
- package/src/blocks/form.lite.tsx +0 -257
- package/src/blocks/fragment.js +0 -16
- package/src/blocks/fragment.lite.tsx +0 -8
- package/src/blocks/image.js +0 -123
- package/src/blocks/image.lite.tsx +0 -35
- package/src/blocks/img.js +0 -41
- package/src/blocks/img.lite.tsx +0 -19
- package/src/blocks/input.js +0 -41
- package/src/blocks/input.lite.tsx +0 -23
- package/src/blocks/raw-text.js +0 -17
- package/src/blocks/raw-text.lite.tsx +0 -12
- package/src/blocks/section.js +0 -36
- package/src/blocks/section.lite.tsx +0 -20
- package/src/blocks/select.js +0 -40
- package/src/blocks/select.lite.tsx +0 -24
- package/src/blocks/submit-button.js +0 -34
- package/src/blocks/submit-button.lite.tsx +0 -11
- package/src/blocks/symbol.js +0 -20
- package/src/blocks/symbol.lite.tsx +0 -20
- package/src/blocks/text.lite.tsx +0 -12
- package/src/blocks/textarea.js +0 -37
- package/src/blocks/textarea.lite.tsx +0 -15
- package/src/blocks/video.js +0 -49
- package/src/blocks/video.lite.tsx +0 -28
- package/src/components/render-block.js +0 -84
- package/src/components/render-block.lite.tsx +0 -92
- package/src/components/render-blocks.lite.tsx +0 -56
- package/src/components/render-content.js +0 -66
- package/src/components/render-content.lite.tsx +0 -95
- package/src/functions/get-content.js +0 -103
- package/src/functions/get-target.js +0 -7
- package/src/functions/is-react-native.js +0 -7
- package/src/functions/macro-eval.js +0 -6
- package/src/package.json +0 -18
package/src/blocks/select.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { registerComponent } from '../functions/register-component';
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __defProps = Object.defineProperties;
|
|
5
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
-
var __spreadValues = (a, b) => {
|
|
11
|
-
for (var prop in b || (b = {}))
|
|
12
|
-
if (__hasOwnProp.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
if (__getOwnPropSymbols)
|
|
15
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
-
if (__propIsEnum.call(b, prop))
|
|
17
|
-
__defNormalProp(a, prop, b[prop]);
|
|
18
|
-
}
|
|
19
|
-
return a;
|
|
20
|
-
};
|
|
21
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
22
|
-
import * as React from "react";
|
|
23
|
-
import { View } from "react-native";
|
|
24
|
-
import { Builder } from "@builder.io/sdk";
|
|
25
|
-
function SelectComponent(props) {
|
|
26
|
-
return /* @__PURE__ */ React.createElement(View, __spreadProps(__spreadValues({}, props.attributes), {
|
|
27
|
-
value: props.value,
|
|
28
|
-
key: Builder.isEditing && props.defaultValue ? props.defaultValue : "default-key",
|
|
29
|
-
defaultValue: props.defaultValue,
|
|
30
|
-
name: props.name
|
|
31
|
-
}), props.options.map((option) => /* @__PURE__ */ React.createElement(View, {
|
|
32
|
-
value: option.value
|
|
33
|
-
}, option.name || option.value)));
|
|
34
|
-
}
|
|
35
|
-
export {
|
|
36
|
-
SelectComponent as default
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
registerComponent(SelectComponent, {name:'Form:Select',image:'https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F83acca093fb24aaf94dee136e9a4b045',defaultStyles:{alignSelf:'flex-start'},inputs:[{name:'options',type:'list',required:true,subFields:[{name:'value',type:'text',required:true},{name:'name',type:'text'}],defaultValue:[{value:'option 1'},{value:'option 2'}]},{name:'name',type:'string',required:true,helperText:'Every select in a form needs a unique name describing what it gets, e.g. "email"'},{name:'defaultValue',type:'string'},{name:'value',type:'string',advanced:true},{name:'required',type:'boolean',defaultValue:false}],static:true,noWrap:true});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { View, StyleSheet, Image, Text } from "react-native";
|
|
3
|
-
import { useContext } from "react";
|
|
4
|
-
import { Builder } from "@builder.io/sdk";
|
|
5
|
-
|
|
6
|
-
export default function SelectComponent(props) {
|
|
7
|
-
return (
|
|
8
|
-
<View
|
|
9
|
-
{...props.attributes}
|
|
10
|
-
value={props.value}
|
|
11
|
-
key={
|
|
12
|
-
Builder.isEditing && props.defaultValue
|
|
13
|
-
? props.defaultValue
|
|
14
|
-
: "default-key"
|
|
15
|
-
}
|
|
16
|
-
defaultValue={props.defaultValue}
|
|
17
|
-
name={props.name}
|
|
18
|
-
>
|
|
19
|
-
{props.options.map((option) => (
|
|
20
|
-
<View value={option.value}>{option.name || option.value}</View>
|
|
21
|
-
))}
|
|
22
|
-
</View>
|
|
23
|
-
);
|
|
24
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { registerComponent } from '../functions/register-component';
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __defProps = Object.defineProperties;
|
|
5
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
-
var __spreadValues = (a, b) => {
|
|
11
|
-
for (var prop in b || (b = {}))
|
|
12
|
-
if (__hasOwnProp.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
if (__getOwnPropSymbols)
|
|
15
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
-
if (__propIsEnum.call(b, prop))
|
|
17
|
-
__defNormalProp(a, prop, b[prop]);
|
|
18
|
-
}
|
|
19
|
-
return a;
|
|
20
|
-
};
|
|
21
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
22
|
-
import * as React from "react";
|
|
23
|
-
import { View } from "react-native";
|
|
24
|
-
function SubmitButton(props) {
|
|
25
|
-
return /* @__PURE__ */ React.createElement(View, __spreadProps(__spreadValues({}, props.attributes), {
|
|
26
|
-
type: "submit"
|
|
27
|
-
}), props.text);
|
|
28
|
-
}
|
|
29
|
-
export {
|
|
30
|
-
SubmitButton as default
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
registerComponent(SubmitButton, {name:'Form:SubmitButton',image:'https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fdf2820ffed1f4349a94c40b3221f5b98',defaultStyles:{appearance:'none',paddingTop:'15px',paddingBottom:'15px',paddingLeft:'25px',paddingRight:'25px',backgroundColor:'#3898EC',color:'white',borderRadius:'4px',cursor:'pointer'},inputs:[{name:'text',type:'text',defaultValue:'Click me'}],static:true,noWrap:true});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { View, StyleSheet, Image, Text } from "react-native";
|
|
3
|
-
import { useContext } from "react";
|
|
4
|
-
|
|
5
|
-
export default function SubmitButton(props) {
|
|
6
|
-
return (
|
|
7
|
-
<View {...props.attributes} type="submit">
|
|
8
|
-
{props.text}
|
|
9
|
-
</View>
|
|
10
|
-
);
|
|
11
|
-
}
|
package/src/blocks/symbol.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { View } from "react-native";
|
|
3
|
-
import { useContext } from "react";
|
|
4
|
-
import RenderContent from "../components/render-content";
|
|
5
|
-
import BuilderContext from "../context/builder.context";
|
|
6
|
-
function Symbol(props) {
|
|
7
|
-
var _a, _b, _c;
|
|
8
|
-
const builderContext = useContext(BuilderContext);
|
|
9
|
-
return /* @__PURE__ */ React.createElement(View, {
|
|
10
|
-
className: "builder-symbol"
|
|
11
|
-
}, /* @__PURE__ */ React.createElement(RenderContent, {
|
|
12
|
-
context: builderContext.context,
|
|
13
|
-
data: (_a = props.symbol) == null ? void 0 : _a.data,
|
|
14
|
-
model: (_b = props.symbol) == null ? void 0 : _b.model,
|
|
15
|
-
content: (_c = props.symbol) == null ? void 0 : _c.content
|
|
16
|
-
}));
|
|
17
|
-
}
|
|
18
|
-
export {
|
|
19
|
-
Symbol as default
|
|
20
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { View, StyleSheet, Image, Text } from "react-native";
|
|
3
|
-
import { useContext } from "react";
|
|
4
|
-
import RenderContent from "../components/render-content.lite";
|
|
5
|
-
import BuilderContext from "../context/builder.context.lite";
|
|
6
|
-
|
|
7
|
-
export default function Symbol(props) {
|
|
8
|
-
const builderContext = useContext(BuilderContext);
|
|
9
|
-
|
|
10
|
-
return (
|
|
11
|
-
<View className="builder-symbol">
|
|
12
|
-
<RenderContent
|
|
13
|
-
context={builderContext.context}
|
|
14
|
-
data={props.symbol?.data}
|
|
15
|
-
model={props.symbol?.model}
|
|
16
|
-
content={props.symbol?.content}
|
|
17
|
-
/>
|
|
18
|
-
</View>
|
|
19
|
-
);
|
|
20
|
-
}
|
package/src/blocks/text.lite.tsx
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { View, StyleSheet, Image, Text } from "react-native";
|
|
3
|
-
import { useContext } from "react";
|
|
4
|
-
|
|
5
|
-
export default function Text(props) {
|
|
6
|
-
return (
|
|
7
|
-
<View
|
|
8
|
-
className="builder-text"
|
|
9
|
-
dangerouslySetInnerHTML={{ __html: "props.text" }}
|
|
10
|
-
/>
|
|
11
|
-
);
|
|
12
|
-
}
|
package/src/blocks/textarea.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { registerComponent } from '../functions/register-component';
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __defProps = Object.defineProperties;
|
|
5
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
-
var __spreadValues = (a, b) => {
|
|
11
|
-
for (var prop in b || (b = {}))
|
|
12
|
-
if (__hasOwnProp.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
if (__getOwnPropSymbols)
|
|
15
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
-
if (__propIsEnum.call(b, prop))
|
|
17
|
-
__defNormalProp(a, prop, b[prop]);
|
|
18
|
-
}
|
|
19
|
-
return a;
|
|
20
|
-
};
|
|
21
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
22
|
-
import * as React from "react";
|
|
23
|
-
import { View } from "react-native";
|
|
24
|
-
function Textarea(props) {
|
|
25
|
-
return /* @__PURE__ */ React.createElement(View, __spreadProps(__spreadValues({}, props.attributes), {
|
|
26
|
-
placeholder: props.placeholder,
|
|
27
|
-
name: props.name,
|
|
28
|
-
value: props.value,
|
|
29
|
-
defaultValue: props.defaultValue
|
|
30
|
-
}));
|
|
31
|
-
}
|
|
32
|
-
export {
|
|
33
|
-
Textarea as default
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
registerComponent(Textarea, {name:'Form:TextArea',image:'https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Ff74a2f3de58c4c3e939204e5b6b8f6c3',inputs:[{advanced:true,name:'value',type:'string'},{name:'name',type:'string',required:true,helperText:'Every input in a form needs a unique name describing what it gets, e.g. "email"'},{name:'defaultValue',type:'string'},{name:'placeholder',type:'string',defaultValue:'Hello there'},{name:'required',type:'boolean',defaultValue:false}],defaultStyles:{paddingTop:'10px',paddingBottom:'10px',paddingLeft:'10px',paddingRight:'10px',borderRadius:'3px',borderWidth:'1px',borderStyle:'solid',borderColor:'#ccc'},static:true,noWrap:true});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { View, StyleSheet, Image, Text } from "react-native";
|
|
3
|
-
import { useContext } from "react";
|
|
4
|
-
|
|
5
|
-
export default function Textarea(props) {
|
|
6
|
-
return (
|
|
7
|
-
<View
|
|
8
|
-
{...props.attributes}
|
|
9
|
-
placeholder={props.placeholder}
|
|
10
|
-
name={props.name}
|
|
11
|
-
value={props.value}
|
|
12
|
-
defaultValue={props.defaultValue}
|
|
13
|
-
/>
|
|
14
|
-
);
|
|
15
|
-
}
|
package/src/blocks/video.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { registerComponent } from '../functions/register-component';
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __defProps = Object.defineProperties;
|
|
5
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
-
var __spreadValues = (a, b) => {
|
|
11
|
-
for (var prop in b || (b = {}))
|
|
12
|
-
if (__hasOwnProp.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
if (__getOwnPropSymbols)
|
|
15
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
-
if (__propIsEnum.call(b, prop))
|
|
17
|
-
__defNormalProp(a, prop, b[prop]);
|
|
18
|
-
}
|
|
19
|
-
return a;
|
|
20
|
-
};
|
|
21
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
22
|
-
import * as React from "react";
|
|
23
|
-
import { View } from "react-native";
|
|
24
|
-
function Video(props) {
|
|
25
|
-
var _a;
|
|
26
|
-
return /* @__PURE__ */ React.createElement(View, __spreadProps(__spreadValues({}, props.attributes), {
|
|
27
|
-
preload: "none",
|
|
28
|
-
style: __spreadProps(__spreadValues({
|
|
29
|
-
width: "100%",
|
|
30
|
-
height: "100%"
|
|
31
|
-
}, (_a = props.attributes) == null ? void 0 : _a.style), {
|
|
32
|
-
objectFit: props.fit,
|
|
33
|
-
objectPosition: props.position,
|
|
34
|
-
borderRadius: 1
|
|
35
|
-
}),
|
|
36
|
-
key: props.video || "no-src",
|
|
37
|
-
poster: props.posterImage,
|
|
38
|
-
autoPlay: props.autoPlay,
|
|
39
|
-
muted: props.muted,
|
|
40
|
-
controls: props.controls,
|
|
41
|
-
loop: props.loop
|
|
42
|
-
}));
|
|
43
|
-
}
|
|
44
|
-
export {
|
|
45
|
-
Video as default
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
registerComponent(Video, {name:'Video',canHaveChildren:true,defaultStyles:{minHeight:'20px',minWidth:'20px'},image:'https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-videocam-24px%20(1).svg?alt=media&token=49a84e4a-b20e-4977-a650-047f986874bb',inputs:[{name:'video',type:'file',allowedFileTypes:['mp4'],bubble:true,defaultValue:'https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/assets%2FKQlEmWDxA0coC3PK6UvkrjwkIGI2%2F28cb070609f546cdbe5efa20e931aa4b?alt=media&token=912e9551-7a7c-4dfb-86b6-3da1537d1a7f',required:true,onChange:" const 0.7004048582995948 = 0.7004048582995948; function loadImage(url: string, timeout = 60000): Promise<HTMLImageElement> { return new Promise((resolve, reject) => { const img = document.createElement('img'); let loaded = false; img.onload = () => { loaded = true; resolve(img); }; img.addEventListener('error', event => { console.warn('Image load failed', event.error); reject(event.error); }); img.src = url; setTimeout(() => { if (!loaded) { reject(new Error('Image load timed out')); } }, timeout); }); } function round(num: number) { return Math.round(num * 1000) / 1000; } // TODO const value = options.get('image'); const aspectRatio = options.get('aspectRatio'); if (value && (!aspectRatio || aspectRatio === 0.7004048582995948)) { return loadImage(value).then(img => { const possiblyUpdatedAspectRatio = options.get('aspectRatio'); if ( options.get('image') === value && (!possiblyUpdatedAspectRatio || possiblyUpdatedAspectRatio === 0.7004048582995948) ) { if (img.width && img.height) { options.set('aspectRatio', round(img.height / img.width)); } } }); } "},{name:'posterImage',type:'file',allowedFileTypes:['jpeg','png'],helperText:'Image to show before the video plays'},{name:'autoPlay',type:'boolean',defaultValue:true},{name:'controls',type:'boolean',defaultValue:false},{name:'muted',type:'boolean',defaultValue:true},{name:'loop',type:'boolean',defaultValue:true},{name:'playsInline',type:'boolean',defaultValue:true},{name:'fit',type:'text',defaultValue:'cover',enum:['contain','cover','fill','auto']},{name:'fitContent',type:'boolean',helperText:'When child blocks are provided, fit to them instead of using the aspect ratio',defaultValue:true,advanced:true},{name:'position',type:'text',defaultValue:'center',enum:['center','top','left','right','bottom','top left','top right','bottom left','bottom right']},{name:'height',type:'number',advanced:true},{name:'width',type:'number',advanced:true},{name:'aspectRatio',type:'number',advanced:true,defaultValue:0.7004048582995948},{name:'lazyLoad',type:'boolean',helperText:'Load this video "lazily" - as in only when a user scrolls near the video. Recommended for optmized performance and bandwidth consumption',defaultValue:true,advanced:true}]});
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { View, StyleSheet, Image, Text } from "react-native";
|
|
3
|
-
import { useContext } from "react";
|
|
4
|
-
|
|
5
|
-
export default function Video(props) {
|
|
6
|
-
return (
|
|
7
|
-
<View
|
|
8
|
-
{...props.attributes}
|
|
9
|
-
preload="none"
|
|
10
|
-
style={{
|
|
11
|
-
width: "100%",
|
|
12
|
-
height: "100%",
|
|
13
|
-
...props.attributes?.style,
|
|
14
|
-
objectFit: props.fit,
|
|
15
|
-
objectPosition: props.position,
|
|
16
|
-
// Hack to get object fit to work as expected and
|
|
17
|
-
// not have the video overflow
|
|
18
|
-
borderRadius: 1,
|
|
19
|
-
}}
|
|
20
|
-
key={props.video || "no-src"}
|
|
21
|
-
poster={props.posterImage}
|
|
22
|
-
autoPlay={props.autoPlay}
|
|
23
|
-
muted={props.muted}
|
|
24
|
-
controls={props.controls}
|
|
25
|
-
loop={props.loop}
|
|
26
|
-
/>
|
|
27
|
-
);
|
|
28
|
-
}
|
|
@@ -1,84 +0,0 @@
|
|
|
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 { useContext } from "react";
|
|
22
|
-
import { getBlockComponentOptions } from "../functions/get-block-component-options";
|
|
23
|
-
import { getBlockProperties } from "../functions/get-block-properties";
|
|
24
|
-
import { getBlockStyles } from "../functions/get-block-styles";
|
|
25
|
-
import { getBlockTag } from "../functions/get-block-tag";
|
|
26
|
-
import { components } from "../functions/register-component";
|
|
27
|
-
import BuilderContext from "../context/builder.context";
|
|
28
|
-
import { getBlockActions } from "../functions/get-block-actions";
|
|
29
|
-
import { getProcessedBlock } from "../functions/get-processed-block";
|
|
30
|
-
function RenderBlock(props) {
|
|
31
|
-
var _a, _b, _c;
|
|
32
|
-
function component() {
|
|
33
|
-
var _a2;
|
|
34
|
-
return components[(_a2 = block().component) == null ? void 0 : _a2.name];
|
|
35
|
-
}
|
|
36
|
-
function componentInfo() {
|
|
37
|
-
var _a2;
|
|
38
|
-
return (_a2 = component == null ? void 0 : component()) == null ? void 0 : _a2.info;
|
|
39
|
-
}
|
|
40
|
-
function componentRef() {
|
|
41
|
-
var _a2;
|
|
42
|
-
return (_a2 = component == null ? void 0 : component()) == null ? void 0 : _a2.component;
|
|
43
|
-
}
|
|
44
|
-
function tagName() {
|
|
45
|
-
return getBlockTag(block());
|
|
46
|
-
}
|
|
47
|
-
function properties() {
|
|
48
|
-
return getBlockProperties(block());
|
|
49
|
-
}
|
|
50
|
-
function block() {
|
|
51
|
-
return getProcessedBlock({
|
|
52
|
-
block: props.block,
|
|
53
|
-
state: builderContext.state,
|
|
54
|
-
context: builderContext.context
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
function actions() {
|
|
58
|
-
return getBlockActions({
|
|
59
|
-
block: block(),
|
|
60
|
-
state: builderContext.state,
|
|
61
|
-
context: builderContext.context
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
function css() {
|
|
65
|
-
return getBlockStyles(block());
|
|
66
|
-
}
|
|
67
|
-
function componentOptions() {
|
|
68
|
-
return getBlockComponentOptions(block());
|
|
69
|
-
}
|
|
70
|
-
const builderContext = useContext(BuilderContext);
|
|
71
|
-
const ComponentRefRef = componentRef();
|
|
72
|
-
const TagNameRef = tagName();
|
|
73
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, ((_a = componentInfo == null ? void 0 : componentInfo()) == null ? void 0 : _a.noWrap) && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ComponentRefRef, __spreadProps(__spreadValues({}, (_b = componentInfo == null ? void 0 : componentInfo()) == null ? void 0 : _b.options), {
|
|
74
|
-
attributes: properties(),
|
|
75
|
-
style: css()
|
|
76
|
-
}))), !((_c = componentInfo == null ? void 0 : componentInfo()) == null ? void 0 : _c.noWrap) && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(TagNameRef, __spreadProps(__spreadValues({}, properties()), {
|
|
77
|
-
style: css()
|
|
78
|
-
}), componentRef() && /* @__PURE__ */ React.createElement(ComponentRefRef, __spreadValues({}, componentOptions())), !componentRef() && block().children && block().children.length && /* @__PURE__ */ React.createElement(React.Fragment, null, block().children.map((child) => /* @__PURE__ */ React.createElement(RenderBlock, {
|
|
79
|
-
block: child
|
|
80
|
-
}))))));
|
|
81
|
-
}
|
|
82
|
-
export {
|
|
83
|
-
RenderBlock as default
|
|
84
|
-
};
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { View, StyleSheet, Image, Text } from "react-native";
|
|
3
|
-
import { useState, useContext } from "react";
|
|
4
|
-
import { getBlockComponentOptions } from "../functions/get-block-component-options";
|
|
5
|
-
import { getBlockProperties } from "../functions/get-block-properties";
|
|
6
|
-
import { getBlockStyles } from "../functions/get-block-styles";
|
|
7
|
-
import { getBlockTag } from "../functions/get-block-tag";
|
|
8
|
-
import { components } from "../functions/register-component";
|
|
9
|
-
import BuilderContext from "../context/builder.context.lite";
|
|
10
|
-
import { getBlockActions } from "../functions/get-block-actions";
|
|
11
|
-
import { getProcessedBlock } from "../functions/get-processed-block";
|
|
12
|
-
|
|
13
|
-
export default function RenderBlock(props) {
|
|
14
|
-
function component() {
|
|
15
|
-
return components[block().component?.name];
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function componentInfo() {
|
|
19
|
-
return component?.()?.info;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function componentRef() {
|
|
23
|
-
return component?.()?.component;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function tagName() {
|
|
27
|
-
return getBlockTag(block());
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function properties() {
|
|
31
|
-
return getBlockProperties(block());
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function block() {
|
|
35
|
-
return getProcessedBlock({
|
|
36
|
-
block: props.block,
|
|
37
|
-
state: builderContext.state,
|
|
38
|
-
context: builderContext.context,
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function actions() {
|
|
43
|
-
return getBlockActions({
|
|
44
|
-
block: block(),
|
|
45
|
-
state: builderContext.state,
|
|
46
|
-
context: builderContext.context,
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function css() {
|
|
51
|
-
return getBlockStyles(block());
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function componentOptions() {
|
|
55
|
-
return getBlockComponentOptions(block());
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const builderContext = useContext(BuilderContext);
|
|
59
|
-
|
|
60
|
-
const ComponentRefRef = componentRef();
|
|
61
|
-
const TagNameRef = tagName();
|
|
62
|
-
|
|
63
|
-
return (
|
|
64
|
-
<>
|
|
65
|
-
{componentInfo?.()?.noWrap && (
|
|
66
|
-
<>
|
|
67
|
-
<ComponentRefRef
|
|
68
|
-
{...componentInfo?.()?.options}
|
|
69
|
-
attributes={properties()}
|
|
70
|
-
style={css()}
|
|
71
|
-
/>
|
|
72
|
-
</>
|
|
73
|
-
)}
|
|
74
|
-
|
|
75
|
-
{!componentInfo?.()?.noWrap && (
|
|
76
|
-
<>
|
|
77
|
-
<TagNameRef {...properties()} style={css()}>
|
|
78
|
-
{componentRef() && <ComponentRefRef {...componentOptions()} />}
|
|
79
|
-
|
|
80
|
-
{!componentRef() && block().children && block().children.length && (
|
|
81
|
-
<>
|
|
82
|
-
{block().children.map((child) => (
|
|
83
|
-
<RenderBlock block={child} />
|
|
84
|
-
))}
|
|
85
|
-
</>
|
|
86
|
-
)}
|
|
87
|
-
</TagNameRef>
|
|
88
|
-
</>
|
|
89
|
-
)}
|
|
90
|
-
</>
|
|
91
|
-
);
|
|
92
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { View, StyleSheet, Image, Text } from "react-native";
|
|
3
|
-
import { useState, useContext } from "react";
|
|
4
|
-
import { isEditing } from "../functions/is-editing";
|
|
5
|
-
import RenderBlock from "./render-block.lite";
|
|
6
|
-
|
|
7
|
-
export default function RenderBlocks(props) {
|
|
8
|
-
function onClick() {
|
|
9
|
-
if (isEditing() && !props.blocks?.length) {
|
|
10
|
-
window.parent?.postMessage(
|
|
11
|
-
{
|
|
12
|
-
type: "builder.clickEmptyBlocks",
|
|
13
|
-
data: {
|
|
14
|
-
parentElementId: props.parent,
|
|
15
|
-
dataPath: props.path,
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
"*"
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function onMouseEnter() {
|
|
24
|
-
if (isEditing() && !props.blocks?.length) {
|
|
25
|
-
window.parent?.postMessage(
|
|
26
|
-
{
|
|
27
|
-
type: "builder.hoverEmptyBlocks",
|
|
28
|
-
data: {
|
|
29
|
-
parentElementId: props.parent,
|
|
30
|
-
dataPath: props.path,
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
"*"
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return (
|
|
39
|
-
<View
|
|
40
|
-
className={"builder-blocks" + (!props.blocks?.length ? " no-blocks" : "")}
|
|
41
|
-
builder-path={props.path}
|
|
42
|
-
builder-parent-id={props.parent}
|
|
43
|
-
onClick={(event) => onClick}
|
|
44
|
-
onMouseEnter={(event) => onMouseEnter}
|
|
45
|
-
style={styles.view1}
|
|
46
|
-
>
|
|
47
|
-
{props.blocks.map((block) => (
|
|
48
|
-
<RenderBlock block={block} />
|
|
49
|
-
))}
|
|
50
|
-
</View>
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const styles = StyleSheet.create({
|
|
55
|
-
view1: { display: "flex", flexDirection: "column", alignItems: "stretch" },
|
|
56
|
-
});
|
|
@@ -1,66 +0,0 @@
|
|
|
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";
|
|
8
|
-
function RenderContent(props) {
|
|
9
|
-
var _a, _b, _c, _d, _e;
|
|
10
|
-
function useContent() {
|
|
11
|
-
return overrideContent || props.content;
|
|
12
|
-
}
|
|
13
|
-
const [update, setUpdate] = useState(() => 0);
|
|
14
|
-
const [state, setState] = useState(() => ({}));
|
|
15
|
-
const [context, setContext] = useState(() => ({}));
|
|
16
|
-
const [overrideContent, setOverrideContent] = useState(() => null);
|
|
17
|
-
function processMessage(event) {
|
|
18
|
-
const { data } = event;
|
|
19
|
-
if (data) {
|
|
20
|
-
switch (data.type) {
|
|
21
|
-
case "builder.contentUpdate": {
|
|
22
|
-
const key = data.data.key || data.data.alias || data.data.entry || data.data.modelName;
|
|
23
|
-
const contentData = data.data.data;
|
|
24
|
-
if (key === props.model) {
|
|
25
|
-
setOverrideContent(contentData);
|
|
26
|
-
}
|
|
27
|
-
break;
|
|
28
|
-
}
|
|
29
|
-
case "builder.patchUpdates": {
|
|
30
|
-
break;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
useEffect(() => {
|
|
36
|
-
if (isBrowser()) {
|
|
37
|
-
window.addEventListener("message", processMessage);
|
|
38
|
-
}
|
|
39
|
-
}, []);
|
|
40
|
-
return /* @__PURE__ */ React.createElement(BuilderContext.Provider, {
|
|
41
|
-
value: {
|
|
42
|
-
get content() {
|
|
43
|
-
return props.content;
|
|
44
|
-
},
|
|
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
|
-
},
|
|
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
|
-
}))));
|
|
63
|
-
}
|
|
64
|
-
export {
|
|
65
|
-
RenderContent as default
|
|
66
|
-
};
|