@builder.io/sdk-react-native 0.1.2 → 0.1.3
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/dist/blocks/BaseText.js +40 -0
- package/dist/blocks/button/button.js +39 -0
- package/dist/blocks/button/component-info.js +42 -0
- package/dist/blocks/columns/columns.js +149 -0
- package/dist/blocks/columns/component-info.js +244 -0
- package/dist/blocks/custom-code/component-info.js +32 -0
- package/dist/blocks/custom-code/custom-code.js +76 -0
- package/dist/blocks/embed/component-info.js +47 -0
- package/dist/blocks/embed/embed.js +67 -0
- package/dist/blocks/embed/helpers.js +10 -0
- package/dist/blocks/form/component-info.js +263 -0
- package/dist/blocks/form/form.js +232 -0
- package/dist/blocks/fragment/component-info.js +12 -0
- package/dist/blocks/fragment/fragment.js +36 -0
- package/dist/blocks/image/component-info.js +152 -0
- package/dist/blocks/image/image.helpers.js +49 -0
- package/dist/blocks/image/image.js +81 -0
- package/dist/blocks/img/component-info.js +21 -0
- package/dist/blocks/img/img.js +35 -0
- package/dist/blocks/input/component-info.js +75 -0
- package/dist/blocks/input/input.js +32 -0
- package/dist/blocks/raw-text/component-info.js +17 -0
- package/dist/blocks/raw-text/raw-text.js +31 -0
- package/dist/blocks/section/component-info.js +50 -0
- package/dist/blocks/section/section.js +49 -0
- package/dist/blocks/select/component-info.js +60 -0
- package/dist/blocks/select/select.js +38 -0
- package/dist/blocks/submit-button/component-info.js +29 -0
- package/dist/blocks/submit-button/submit-button.js +36 -0
- package/dist/blocks/symbol/component-info.js +44 -0
- package/dist/blocks/symbol/symbol.js +97 -0
- package/dist/blocks/text/component-info.js +25 -0
- package/dist/blocks/text/text.js +112 -0
- package/dist/blocks/textarea/component-info.js +48 -0
- package/dist/blocks/textarea/textarea.js +31 -0
- package/dist/blocks/util.js +9 -0
- package/dist/blocks/video/component-info.js +107 -0
- package/dist/blocks/video/video.js +81 -0
- package/dist/components/render-block/block-styles.js +79 -0
- package/dist/components/render-block/render-block.helpers.js +109 -0
- package/dist/components/render-block/render-block.js +154 -0
- package/dist/components/render-block/render-component-with-context.js +45 -0
- package/dist/components/render-block/render-component.js +50 -0
- package/dist/components/render-block/render-repeated-block.js +45 -0
- package/dist/components/render-block/types.js +1 -0
- package/dist/components/render-blocks.js +76 -0
- package/dist/components/render-content/builder-editing.js +31 -0
- package/dist/components/render-content/components/render-styles.js +91 -0
- package/dist/components/render-content/index.js +8 -0
- package/dist/components/render-content/render-content.js +325 -0
- package/dist/components/render-inlined-styles.js +42 -0
- package/dist/constants/builder-registered-components.js +46 -0
- package/dist/constants/device-sizes.js +49 -0
- package/dist/constants/target.js +5 -0
- package/dist/context/builder.context.js +13 -0
- package/dist/context/types.js +1 -0
- package/dist/functions/camel-to-kebab-case.js +5 -0
- package/dist/functions/evaluate.js +25 -0
- package/dist/functions/event-handler-name.js +8 -0
- package/dist/functions/extract-text-styles.js +23 -0
- package/dist/functions/fast-clone.js +5 -0
- package/dist/functions/get-block-actions-handler.js +12 -0
- package/dist/functions/get-block-actions.js +19 -0
- package/dist/functions/get-block-component-options.js +29 -0
- package/dist/functions/get-block-properties.js +51 -0
- package/dist/functions/get-block-tag.js +8 -0
- package/dist/functions/get-builder-search-params/fn.test.js +15 -0
- package/dist/functions/get-builder-search-params/index.js +39 -0
- package/dist/functions/get-content/ab-testing.js +89 -0
- package/dist/functions/get-content/generate-content-url.js +44 -0
- package/dist/functions/get-content/generate-content-url.test.js +33 -0
- package/dist/functions/get-content/index.js +68 -0
- package/dist/functions/get-content/types.js +1 -0
- package/dist/functions/get-fetch.js +15 -0
- package/dist/functions/get-global-this.js +19 -0
- package/dist/functions/get-processed-block.js +52 -0
- package/dist/functions/get-processed-block.test.js +34 -0
- package/dist/functions/get-react-native-block-styles.js +30 -0
- package/dist/functions/if-target.js +13 -0
- package/dist/functions/is-browser.js +7 -0
- package/dist/functions/is-editing.js +8 -0
- package/dist/functions/is-iframe.js +8 -0
- package/dist/functions/is-previewing.js +15 -0
- package/dist/functions/on-change.js +28 -0
- package/dist/functions/on-change.test.js +21 -0
- package/dist/functions/register-component.js +65 -0
- package/dist/functions/register.js +31 -0
- package/dist/functions/sanitize-react-native-block-styles.js +71 -0
- package/dist/functions/set-editor-settings.js +16 -0
- package/dist/functions/set.js +12 -0
- package/dist/functions/set.test.js +18 -0
- package/dist/functions/track/helpers.js +53 -0
- package/dist/functions/track/index.js +124 -0
- package/dist/functions/track/interaction.js +51 -0
- package/dist/functions/track.js +120 -0
- package/dist/functions/transform-block-properties.js +18 -0
- package/dist/functions/transform-block.js +38 -0
- package/dist/helpers/ab-tests.js +10 -0
- package/dist/helpers/cookie.js +70 -0
- package/dist/helpers/css.js +33 -0
- package/dist/helpers/flatten.js +35 -0
- package/dist/helpers/localStorage.js +31 -0
- package/dist/helpers/nullable.js +5 -0
- package/dist/helpers/sessionId.js +51 -0
- package/dist/helpers/time.js +6 -0
- package/dist/helpers/url.js +14 -0
- package/dist/helpers/url.test.js +23 -0
- package/dist/helpers/uuid.js +14 -0
- package/dist/helpers/visitorId.js +33 -0
- package/dist/index-helpers/blocks-exports.js +22 -0
- package/dist/index-helpers/top-of-file.js +3 -0
- package/dist/index.js +29 -0
- package/dist/scripts/init-editing.js +97 -0
- package/dist/types/builder-block.js +1 -0
- package/dist/types/builder-content.js +1 -0
- package/dist/types/can-track.js +1 -0
- package/dist/types/components.js +1 -0
- package/dist/types/deep-partial.js +1 -0
- package/dist/types/element.js +1 -0
- package/dist/types/targets.js +1 -0
- package/dist/types/typescript.js +1 -0
- package/package.json +13 -5
- package/src/blocks/BaseText.jsx +17 -0
- package/src/blocks/button/button.jsx +28 -0
- package/src/blocks/columns/{columns.js → columns.jsx} +59 -36
- package/src/blocks/custom-code/{custom-code.js → custom-code.jsx} +22 -15
- package/src/blocks/embed/{embed.js → embed.jsx} +12 -11
- package/src/blocks/form/form.jsx +251 -0
- package/src/blocks/fragment/fragment.jsx +11 -0
- package/src/blocks/image/image.jsx +78 -0
- package/src/blocks/img/img.jsx +18 -0
- package/src/blocks/input/input.jsx +20 -0
- package/src/blocks/raw-text/raw-text.jsx +6 -0
- package/src/blocks/section/section.jsx +29 -0
- package/src/blocks/select/select.jsx +24 -0
- package/src/blocks/submit-button/submit-button.jsx +11 -0
- package/src/blocks/symbol/symbol.jsx +86 -0
- package/src/blocks/text/text.jsx +100 -0
- package/src/blocks/textarea/textarea.jsx +14 -0
- package/src/blocks/video/video.jsx +70 -0
- package/src/components/render-block/block-styles.jsx +70 -0
- package/src/components/render-block/render-block.helpers.js +90 -0
- package/src/components/render-block/render-block.jsx +183 -0
- package/src/components/render-block/render-component.jsx +45 -0
- package/src/components/render-block/render-repeated-block.jsx +22 -0
- package/src/components/render-blocks.jsx +86 -0
- package/src/components/render-content/builder-editing.jsx +6 -0
- package/src/components/render-content/components/{render-styles.js → render-styles.jsx} +21 -14
- package/src/components/render-content/render-content.jsx +373 -0
- package/src/components/render-inlined-styles.jsx +29 -0
- package/src/functions/track/helpers.js +50 -0
- package/src/functions/{track.js → track/index.js} +10 -6
- package/src/functions/track/interaction.js +53 -0
- package/src/index.js +1 -1
- package/src/blocks/BaseText.js +0 -31
- package/src/blocks/button/button.js +0 -36
- package/src/blocks/form/form.js +0 -222
- package/src/blocks/fragment/fragment.js +0 -9
- package/src/blocks/image/image.js +0 -55
- package/src/blocks/img/img.js +0 -33
- package/src/blocks/input/input.js +0 -36
- package/src/blocks/raw-text/raw-text.js +0 -10
- package/src/blocks/section/section.js +0 -41
- package/src/blocks/select/select.js +0 -37
- package/src/blocks/submit-button/submit-button.js +0 -27
- package/src/blocks/symbol/symbol.js +0 -73
- package/src/blocks/text/text.js +0 -67
- package/src/blocks/textarea/textarea.js +0 -32
- package/src/blocks/video/video.js +0 -55
- package/src/components/render-block/block-styles.js +0 -50
- package/src/components/render-block/render-block.js +0 -202
- package/src/components/render-block/render-component-with-context.js +0 -35
- package/src/components/render-block/render-component.js +0 -35
- package/src/components/render-block/render-repeated-block.js +0 -33
- package/src/components/render-blocks.js +0 -63
- package/src/components/render-content/builder-editing.js +0 -8
- package/src/components/render-content/render-content.js +0 -297
- package/src/components/render-inlined-styles.js +0 -17
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const BaseText_1 = __importDefault(require("../BaseText"));
|
|
30
|
+
const React = __importStar(require("react"));
|
|
31
|
+
const react_native_1 = require("react-native");
|
|
32
|
+
const is_editing_js_1 = require("../../functions/is-editing.js");
|
|
33
|
+
function SelectComponent(props) {
|
|
34
|
+
var _a;
|
|
35
|
+
return (React.createElement(react_native_1.View, { ...props.attributes, value: props.value, key: (0, is_editing_js_1.isEditing)() && props.defaultValue ? props.defaultValue : "default-key", defaultValue: props.defaultValue, name: props.name }, (_a = props.options) === null || _a === void 0 ? void 0 : _a.map((option) => (React.createElement(react_native_1.View, { value: option.value },
|
|
36
|
+
React.createElement(BaseText_1.default, null, option.name || option.value))))));
|
|
37
|
+
}
|
|
38
|
+
exports.default = SelectComponent;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.componentInfo = void 0;
|
|
4
|
+
const componentInfo = {
|
|
5
|
+
name: "Form:SubmitButton",
|
|
6
|
+
builtIn: true,
|
|
7
|
+
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fdf2820ffed1f4349a94c40b3221f5b98",
|
|
8
|
+
defaultStyles: {
|
|
9
|
+
appearance: "none",
|
|
10
|
+
paddingTop: "15px",
|
|
11
|
+
paddingBottom: "15px",
|
|
12
|
+
paddingLeft: "25px",
|
|
13
|
+
paddingRight: "25px",
|
|
14
|
+
backgroundColor: "#3898EC",
|
|
15
|
+
color: "white",
|
|
16
|
+
borderRadius: "4px",
|
|
17
|
+
cursor: "pointer"
|
|
18
|
+
},
|
|
19
|
+
inputs: [
|
|
20
|
+
{
|
|
21
|
+
name: "text",
|
|
22
|
+
type: "text",
|
|
23
|
+
defaultValue: "Click me"
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
static: true,
|
|
27
|
+
noWrap: true
|
|
28
|
+
};
|
|
29
|
+
exports.componentInfo = componentInfo;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const BaseText_1 = __importDefault(require("../BaseText"));
|
|
30
|
+
const React = __importStar(require("react"));
|
|
31
|
+
const react_native_1 = require("react-native");
|
|
32
|
+
function SubmitButton(props) {
|
|
33
|
+
return (React.createElement(react_native_1.View, { type: "submit", ...props.attributes },
|
|
34
|
+
React.createElement(BaseText_1.default, null, props.text)));
|
|
35
|
+
}
|
|
36
|
+
exports.default = SubmitButton;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.componentInfo = void 0;
|
|
4
|
+
const componentInfo = {
|
|
5
|
+
name: "Symbol",
|
|
6
|
+
noWrap: true,
|
|
7
|
+
static: true,
|
|
8
|
+
builtIn: true,
|
|
9
|
+
inputs: [
|
|
10
|
+
{
|
|
11
|
+
name: "symbol",
|
|
12
|
+
type: "uiSymbol"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
name: "dataOnly",
|
|
16
|
+
helperText: "Make this a data symbol that doesn't display any UI",
|
|
17
|
+
type: "boolean",
|
|
18
|
+
defaultValue: false,
|
|
19
|
+
advanced: true,
|
|
20
|
+
hideFromUI: true
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: "inheritState",
|
|
24
|
+
helperText: "Inherit the parent component state and data",
|
|
25
|
+
type: "boolean",
|
|
26
|
+
defaultValue: false,
|
|
27
|
+
advanced: true
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: "renderToLiquid",
|
|
31
|
+
helperText: "Render this symbols contents to liquid. Turn off to fetch with javascript and use custom targeting",
|
|
32
|
+
type: "boolean",
|
|
33
|
+
defaultValue: false,
|
|
34
|
+
advanced: true,
|
|
35
|
+
hideFromUI: true
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: "useChildren",
|
|
39
|
+
hideFromUI: true,
|
|
40
|
+
type: "boolean"
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
};
|
|
44
|
+
exports.componentInfo = componentInfo;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const React = __importStar(require("react"));
|
|
30
|
+
const react_native_1 = require("react-native");
|
|
31
|
+
const react_1 = require("react");
|
|
32
|
+
const render_content_js_1 = __importDefault(require("../../components/render-content/render-content.js"));
|
|
33
|
+
const builder_context_js_1 = __importDefault(require("../../context/builder.context.js"));
|
|
34
|
+
const index_js_1 = require("../../functions/get-content/index.js");
|
|
35
|
+
const target_1 = require("../../constants/target");
|
|
36
|
+
function Symbol(props) {
|
|
37
|
+
var _a, _b, _c, _d, _e;
|
|
38
|
+
function className() {
|
|
39
|
+
var _a, _b;
|
|
40
|
+
return [
|
|
41
|
+
...(target_1.TARGET === "vue2" || target_1.TARGET === "vue3"
|
|
42
|
+
? Object.keys(props.attributes.class)
|
|
43
|
+
: [props.attributes.class]),
|
|
44
|
+
"builder-symbol",
|
|
45
|
+
((_a = props.symbol) === null || _a === void 0 ? void 0 : _a.inline) ? "builder-inline-symbol" : undefined,
|
|
46
|
+
((_b = props.symbol) === null || _b === void 0 ? void 0 : _b.dynamic) || props.dynamic
|
|
47
|
+
? "builder-dynamic-symbol"
|
|
48
|
+
: undefined,
|
|
49
|
+
]
|
|
50
|
+
.filter(Boolean)
|
|
51
|
+
.join(" ");
|
|
52
|
+
}
|
|
53
|
+
const [fetchedContent, setFetchedContent] = (0, react_1.useState)(() => null);
|
|
54
|
+
function contentToUse() {
|
|
55
|
+
var _a;
|
|
56
|
+
return ((_a = props.symbol) === null || _a === void 0 ? void 0 : _a.content) || fetchedContent;
|
|
57
|
+
}
|
|
58
|
+
const builderContext = (0, react_1.useContext)(builder_context_js_1.default);
|
|
59
|
+
(0, react_1.useEffect)(() => {
|
|
60
|
+
const symbolToUse = props.symbol;
|
|
61
|
+
/**
|
|
62
|
+
* If:
|
|
63
|
+
* - we have a symbol prop
|
|
64
|
+
* - yet it does not have any content
|
|
65
|
+
* - and we have not already stored content from before
|
|
66
|
+
* - and it has a model name
|
|
67
|
+
*
|
|
68
|
+
* then we want to re-fetch the symbol content.
|
|
69
|
+
*/
|
|
70
|
+
if (symbolToUse &&
|
|
71
|
+
!symbolToUse.content &&
|
|
72
|
+
!fetchedContent &&
|
|
73
|
+
symbolToUse.model &&
|
|
74
|
+
(
|
|
75
|
+
// This is a hack, we should not need to check for this, but it is needed for Svelte.
|
|
76
|
+
builderContext === null || builderContext === void 0 ? void 0 : builderContext.apiKey)) {
|
|
77
|
+
(0, index_js_1.getContent)({
|
|
78
|
+
model: symbolToUse.model,
|
|
79
|
+
apiKey: builderContext.apiKey,
|
|
80
|
+
query: {
|
|
81
|
+
id: symbolToUse.entry,
|
|
82
|
+
},
|
|
83
|
+
}).then((response) => {
|
|
84
|
+
setFetchedContent(response);
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}, [props.symbol, fetchedContent]);
|
|
88
|
+
return (React.createElement(react_native_1.View, { ...props.attributes, dataSet: {
|
|
89
|
+
class: className(),
|
|
90
|
+
} },
|
|
91
|
+
React.createElement(render_content_js_1.default, { apiKey: builderContext.apiKey, context: builderContext.context, customComponents: Object.values(builderContext.registeredComponents), data: {
|
|
92
|
+
...(_a = props.symbol) === null || _a === void 0 ? void 0 : _a.data,
|
|
93
|
+
...builderContext.state,
|
|
94
|
+
...(_d = (_c = (_b = props.symbol) === null || _b === void 0 ? void 0 : _b.content) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.state,
|
|
95
|
+
}, model: (_e = props.symbol) === null || _e === void 0 ? void 0 : _e.model, content: contentToUse() })));
|
|
96
|
+
}
|
|
97
|
+
exports.default = Symbol;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.componentInfo = void 0;
|
|
4
|
+
const componentInfo = {
|
|
5
|
+
name: "Text",
|
|
6
|
+
static: true,
|
|
7
|
+
builtIn: true,
|
|
8
|
+
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",
|
|
9
|
+
inputs: [
|
|
10
|
+
{
|
|
11
|
+
name: "text",
|
|
12
|
+
type: "html",
|
|
13
|
+
required: true,
|
|
14
|
+
autoFocus: true,
|
|
15
|
+
bubble: true,
|
|
16
|
+
defaultValue: "Enter some text..."
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
defaultStyles: {
|
|
20
|
+
lineHeight: "normal",
|
|
21
|
+
height: "auto",
|
|
22
|
+
textAlign: "center"
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
exports.componentInfo = componentInfo;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const React = __importStar(require("react"));
|
|
30
|
+
const react_native_render_html_1 = __importDefault(require("react-native-render-html"));
|
|
31
|
+
const builder_context_1 = __importDefault(require("../../context/builder.context"));
|
|
32
|
+
/**
|
|
33
|
+
* @typedef {{}} BuilderBlock
|
|
34
|
+
*/
|
|
35
|
+
/**
|
|
36
|
+
*
|
|
37
|
+
* @param {string} string
|
|
38
|
+
* @returns {string}
|
|
39
|
+
*/
|
|
40
|
+
function camelToKebabCase(string) {
|
|
41
|
+
return string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, '$1-$2').toLowerCase();
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
*
|
|
45
|
+
* @param {object} object
|
|
46
|
+
* @param {string[]} keys
|
|
47
|
+
* @returns {object}
|
|
48
|
+
*/
|
|
49
|
+
function pick(object, keys) {
|
|
50
|
+
return keys.reduce((obj, key) => {
|
|
51
|
+
// eslint-disable-next-line no-prototype-builtins
|
|
52
|
+
if (object && object.hasOwnProperty(key)) {
|
|
53
|
+
obj[key] = object[key];
|
|
54
|
+
}
|
|
55
|
+
return obj;
|
|
56
|
+
}, {});
|
|
57
|
+
}
|
|
58
|
+
const PICK_STYLES = ['textAlign'];
|
|
59
|
+
/**
|
|
60
|
+
* @param {BuilderBlock} block
|
|
61
|
+
* @returns
|
|
62
|
+
*/
|
|
63
|
+
function getBlockStyles(block) {
|
|
64
|
+
var _a, _b, _c;
|
|
65
|
+
// TODO: responsive CSS using react native viewport width hooks
|
|
66
|
+
const styles = {
|
|
67
|
+
...(_a = block.responsiveStyles) === null || _a === void 0 ? void 0 : _a.large,
|
|
68
|
+
...(block).styles,
|
|
69
|
+
};
|
|
70
|
+
if ((_b = block.responsiveStyles) === null || _b === void 0 ? void 0 : _b.medium) {
|
|
71
|
+
Object.assign(styles, block.responsiveStyles.medium);
|
|
72
|
+
}
|
|
73
|
+
if ((_c = block.responsiveStyles) === null || _c === void 0 ? void 0 : _c.small) {
|
|
74
|
+
Object.assign(styles, block.responsiveStyles.small);
|
|
75
|
+
}
|
|
76
|
+
return styles;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
*
|
|
80
|
+
* @param {BuilderBlock} block
|
|
81
|
+
* @param {any} inheritedStyles
|
|
82
|
+
* @returns
|
|
83
|
+
*/
|
|
84
|
+
function getCss(block, inheritedStyles) {
|
|
85
|
+
const styleObject = {
|
|
86
|
+
...inheritedStyles,
|
|
87
|
+
...pick(getBlockStyles(block), PICK_STYLES)
|
|
88
|
+
};
|
|
89
|
+
if (!styleObject) {
|
|
90
|
+
return '';
|
|
91
|
+
}
|
|
92
|
+
let str = ``;
|
|
93
|
+
for (const key in styleObject) {
|
|
94
|
+
const value = styleObject[key];
|
|
95
|
+
if (typeof value === 'string') {
|
|
96
|
+
str += `${camelToKebabCase(key)}: ${value};`;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return str;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
*
|
|
103
|
+
* @param {{ text: string; builderBlock: BuilderBlock}} props
|
|
104
|
+
* @returns
|
|
105
|
+
*/
|
|
106
|
+
function Text(props) {
|
|
107
|
+
const builderContext = React.useContext(builder_context_1.default);
|
|
108
|
+
return (React.createElement(react_native_render_html_1.default, { source: {
|
|
109
|
+
html: `<div style="${getCss(props.builderBlock, builderContext.inheritedStyles)}">${props.text || ''}</div>`,
|
|
110
|
+
} }));
|
|
111
|
+
}
|
|
112
|
+
exports.default = Text;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.componentInfo = void 0;
|
|
4
|
+
const componentInfo = {
|
|
5
|
+
name: "Form:TextArea",
|
|
6
|
+
builtIn: true,
|
|
7
|
+
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Ff74a2f3de58c4c3e939204e5b6b8f6c3",
|
|
8
|
+
inputs: [
|
|
9
|
+
{
|
|
10
|
+
advanced: true,
|
|
11
|
+
name: "value",
|
|
12
|
+
type: "string"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
name: "name",
|
|
16
|
+
type: "string",
|
|
17
|
+
required: true,
|
|
18
|
+
helperText: 'Every input in a form needs a unique name describing what it gets, e.g. "email"'
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: "defaultValue",
|
|
22
|
+
type: "string"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: "placeholder",
|
|
26
|
+
type: "string",
|
|
27
|
+
defaultValue: "Hello there"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: "required",
|
|
31
|
+
type: "boolean",
|
|
32
|
+
defaultValue: false
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
defaultStyles: {
|
|
36
|
+
paddingTop: "10px",
|
|
37
|
+
paddingBottom: "10px",
|
|
38
|
+
paddingLeft: "10px",
|
|
39
|
+
paddingRight: "10px",
|
|
40
|
+
borderRadius: "3px",
|
|
41
|
+
borderWidth: "1px",
|
|
42
|
+
borderStyle: "solid",
|
|
43
|
+
borderColor: "#ccc"
|
|
44
|
+
},
|
|
45
|
+
static: true,
|
|
46
|
+
noWrap: true
|
|
47
|
+
};
|
|
48
|
+
exports.componentInfo = componentInfo;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const React = __importStar(require("react"));
|
|
27
|
+
const react_native_1 = require("react-native");
|
|
28
|
+
function Textarea(props) {
|
|
29
|
+
return (React.createElement(react_native_1.View, { ...props.attributes, placeholder: props.placeholder, name: props.name, value: props.value, defaultValue: props.defaultValue }));
|
|
30
|
+
}
|
|
31
|
+
exports.default = Textarea;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.serializeFn = void 0;
|
|
4
|
+
const serializeFn = (fnValue) => {
|
|
5
|
+
const fnStr = fnValue.toString().trim();
|
|
6
|
+
const appendFunction = !fnStr.startsWith("function") && !fnStr.startsWith("(");
|
|
7
|
+
return `return (${appendFunction ? "function " : ""}${fnStr}).apply(this, arguments)`;
|
|
8
|
+
};
|
|
9
|
+
exports.serializeFn = serializeFn;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.componentInfo = void 0;
|
|
4
|
+
const componentInfo = {
|
|
5
|
+
name: "Video",
|
|
6
|
+
canHaveChildren: true,
|
|
7
|
+
builtIn: true,
|
|
8
|
+
defaultStyles: {
|
|
9
|
+
minHeight: "20px",
|
|
10
|
+
minWidth: "20px"
|
|
11
|
+
},
|
|
12
|
+
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",
|
|
13
|
+
inputs: [
|
|
14
|
+
{
|
|
15
|
+
name: "video",
|
|
16
|
+
type: "file",
|
|
17
|
+
allowedFileTypes: ["mp4"],
|
|
18
|
+
bubble: true,
|
|
19
|
+
defaultValue: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/assets%2FKQlEmWDxA0coC3PK6UvkrjwkIGI2%2F28cb070609f546cdbe5efa20e931aa4b?alt=media&token=912e9551-7a7c-4dfb-86b6-3da1537d1a7f",
|
|
20
|
+
required: true
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: "posterImage",
|
|
24
|
+
type: "file",
|
|
25
|
+
allowedFileTypes: ["jpeg", "png"],
|
|
26
|
+
helperText: "Image to show before the video plays"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: "autoPlay",
|
|
30
|
+
type: "boolean",
|
|
31
|
+
defaultValue: true
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: "controls",
|
|
35
|
+
type: "boolean",
|
|
36
|
+
defaultValue: false
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: "muted",
|
|
40
|
+
type: "boolean",
|
|
41
|
+
defaultValue: true
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: "loop",
|
|
45
|
+
type: "boolean",
|
|
46
|
+
defaultValue: true
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: "playsInline",
|
|
50
|
+
type: "boolean",
|
|
51
|
+
defaultValue: true
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: "fit",
|
|
55
|
+
type: "text",
|
|
56
|
+
defaultValue: "cover",
|
|
57
|
+
enum: ["contain", "cover", "fill", "auto"]
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: "fitContent",
|
|
61
|
+
type: "boolean",
|
|
62
|
+
helperText: "When child blocks are provided, fit to them instead of using the aspect ratio",
|
|
63
|
+
defaultValue: true,
|
|
64
|
+
advanced: true
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
name: "position",
|
|
68
|
+
type: "text",
|
|
69
|
+
defaultValue: "center",
|
|
70
|
+
enum: [
|
|
71
|
+
"center",
|
|
72
|
+
"top",
|
|
73
|
+
"left",
|
|
74
|
+
"right",
|
|
75
|
+
"bottom",
|
|
76
|
+
"top left",
|
|
77
|
+
"top right",
|
|
78
|
+
"bottom left",
|
|
79
|
+
"bottom right"
|
|
80
|
+
]
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: "height",
|
|
84
|
+
type: "number",
|
|
85
|
+
advanced: true
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
name: "width",
|
|
89
|
+
type: "number",
|
|
90
|
+
advanced: true
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name: "aspectRatio",
|
|
94
|
+
type: "number",
|
|
95
|
+
advanced: true,
|
|
96
|
+
defaultValue: 0.7004048582995948
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
name: "lazyLoad",
|
|
100
|
+
type: "boolean",
|
|
101
|
+
helperText: 'Load this video "lazily" - as in only when a user scrolls near the video. Recommended for optmized performance and bandwidth consumption',
|
|
102
|
+
defaultValue: true,
|
|
103
|
+
advanced: true
|
|
104
|
+
}
|
|
105
|
+
]
|
|
106
|
+
};
|
|
107
|
+
exports.componentInfo = componentInfo;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
// TO-DO: This file breaks due to this issue:
|
|
30
|
+
// https://github.com/expo/web-examples/issues/73
|
|
31
|
+
// For now, we do not import it elsewhere to avoid crashing Expo servers on web when importing the SDK.
|
|
32
|
+
const React = __importStar(require("react"));
|
|
33
|
+
const react_native_1 = require("react-native");
|
|
34
|
+
const react_native_video_1 = __importDefault(require("react-native-video"));
|
|
35
|
+
// Subset of Image props, many are irrelevant for native (such as altText, etc)
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
* @typedef {{
|
|
39
|
+
* attributes?: any;
|
|
40
|
+
* video?: string;
|
|
41
|
+
* autoPlay?: boolean;
|
|
42
|
+
* controls?: boolean;
|
|
43
|
+
* muted?: boolean;
|
|
44
|
+
* loop?: boolean;
|
|
45
|
+
* playsInline?: boolean;
|
|
46
|
+
* aspectRatio?: number;
|
|
47
|
+
* fit?: 'contain' | 'cover' | 'stretch';
|
|
48
|
+
* position?:
|
|
49
|
+
* | 'center'
|
|
50
|
+
* | 'top'
|
|
51
|
+
* | 'left'
|
|
52
|
+
* | 'right'
|
|
53
|
+
* | 'bottom'
|
|
54
|
+
* | 'top left'
|
|
55
|
+
* | 'top right'
|
|
56
|
+
* | 'bottom left'
|
|
57
|
+
* | 'bottom right';
|
|
58
|
+
* posterImage?: string;
|
|
59
|
+
* children?: any;
|
|
60
|
+
* }} VideoProps
|
|
61
|
+
*/
|
|
62
|
+
// TODO: support children by wrapping in a View
|
|
63
|
+
/**
|
|
64
|
+
* @param {VideoProps} props
|
|
65
|
+
*/
|
|
66
|
+
function Video(props) {
|
|
67
|
+
return (React.createElement(react_native_1.View, { style: { position: 'relative' } },
|
|
68
|
+
React.createElement(react_native_video_1.default, { paused: !props.autoPlay, controls: props.controls, muted: props.muted, repeat: props.loop, poster: props.posterImage, posterResizeMode: props.fit || 'contain', resizeMode: props.fit || ('contain'), style: {
|
|
69
|
+
position: 'absolute',
|
|
70
|
+
top: 0,
|
|
71
|
+
bottom: 0,
|
|
72
|
+
left: 0,
|
|
73
|
+
right: 0,
|
|
74
|
+
zIndex: 1,
|
|
75
|
+
}, source: { uri: props.video } }),
|
|
76
|
+
React.createElement(react_native_1.View, { style: {
|
|
77
|
+
width: '100%',
|
|
78
|
+
paddingTop: `${props.aspectRatio * 100}%`,
|
|
79
|
+
} })));
|
|
80
|
+
}
|
|
81
|
+
exports.default = Video;
|