@builder.io/sdk-react-native 0.5.0 → 0.5.2
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/components/blocks/blocks.js +8 -2
- package/dist/components/content/content.js +10 -6
- package/dist/constants/sdk-version.js +1 -1
- package/dist/context/components.context.js +6 -0
- package/package.json +4 -2
- package/src/components/blocks/blocks.jsx +13 -3
- package/src/components/content/content.jsx +42 -35
- package/src/constants/sdk-version.js +1 -1
- package/src/context/components.context.js +5 -0
- package/dist/blocks/util.js +0 -9
- package/dist/components/block/components/block-wrapper/block-wrapper.js +0 -41
- package/dist/components/block/components/component-ref.js +0 -81
- package/dist/components/block/components/component.js +0 -41
- package/dist/components/block/components/interactive-element/interactive-element.helpers.js +0 -35
- package/dist/components/block/components/interactive-element/interactive-element.js +0 -36
- package/dist/components/content/builder-editing.js +0 -32
- package/dist/components/content/components/content-styles.helpers.js +0 -55
- package/dist/components/content/components/content-styles.js +0 -61
- package/dist/components/render-block/block-styles.js +0 -96
- package/dist/components/render-block/render-block.helpers.js +0 -113
- package/dist/components/render-block/render-block.js +0 -162
- package/dist/components/render-block/render-component.js +0 -52
- package/dist/components/render-block/render-repeated-block.js +0 -40
- package/dist/components/render-block/types.js +0 -1
- package/dist/components/render-blocks.js +0 -81
- package/dist/components/render-content/builder-editing.js +0 -32
- package/dist/components/render-content/components/render-styles.helpers.js +0 -55
- package/dist/components/render-content/components/render-styles.js +0 -61
- package/dist/components/render-content/index.js +0 -8
- package/dist/components/render-content/render-content.helpers.js +0 -42
- package/dist/components/render-content/render-content.js +0 -375
- package/dist/components/render-content/render-content.types.js +0 -1
- package/dist/components/render-content/wrap-component-ref.js +0 -5
- package/dist/components/render-content-variants/helpers.js +0 -168
- package/dist/components/render-content-variants/render-content-variants.js +0 -78
- package/dist/components/render-content-variants/render-content-variants.types.js +0 -1
- package/dist/functions/apply-patch-with-mutation.test.js +0 -55
- package/dist/functions/evaluate.js +0 -47
- package/dist/functions/evaluate.test.js +0 -25
- package/dist/functions/get-builder-search-params/fn.test.js +0 -15
- package/dist/functions/get-content/generate-content-url.test.js +0 -113
- package/dist/functions/get-content/processCookies.js +0 -7
- package/dist/functions/get-processed-block.test.js +0 -38
- package/dist/functions/on-change.test.js +0 -31
- package/dist/functions/set.test.js +0 -24
- package/dist/helpers/url.test.js +0 -23
|
@@ -29,13 +29,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
30
|
const React = __importStar(require("react"));
|
|
31
31
|
const react_native_1 = require("react-native");
|
|
32
|
+
const react_1 = require("react");
|
|
32
33
|
const block_styles_1 = __importDefault(require("../block/components/block-styles"));
|
|
33
34
|
const block_1 = __importDefault(require("../block/block"));
|
|
34
35
|
const blocks_wrapper_1 = __importDefault(require("./blocks-wrapper"));
|
|
36
|
+
const builder_context_1 = __importDefault(require("../../context/builder.context"));
|
|
37
|
+
const components_context_1 = __importDefault(require("../../context/components.context"));
|
|
35
38
|
function Blocks(props) {
|
|
36
39
|
var _a, _b;
|
|
40
|
+
const builderContext = (0, react_1.useContext)(builder_context_1.default);
|
|
41
|
+
const componentsContext = (0, react_1.useContext)(components_context_1.default);
|
|
37
42
|
return (React.createElement(blocks_wrapper_1.default, { blocks: props.blocks, parent: props.parent, path: props.path, styleProp: props.styleProp },
|
|
38
|
-
props.blocks ? (React.createElement(React.Fragment, null, (_a = props.blocks) === null || _a === void 0 ? void 0 : _a.map((block) => (React.createElement(block_1.default, { key: "render-block-" + block.id, block: block, context: props.context, registeredComponents: props.registeredComponents
|
|
39
|
-
|
|
43
|
+
props.blocks ? (React.createElement(React.Fragment, null, (_a = props.blocks) === null || _a === void 0 ? void 0 : _a.map((block) => (React.createElement(block_1.default, { key: "render-block-" + block.id, block: block, context: props.context || builderContext, registeredComponents: props.registeredComponents ||
|
|
44
|
+
componentsContext.registeredComponents }))))) : null,
|
|
45
|
+
props.blocks ? (React.createElement(React.Fragment, null, (_b = props.blocks) === null || _b === void 0 ? void 0 : _b.map((block) => (React.createElement(block_styles_1.default, { key: "block-style-" + block.id, block: block, context: props.context || builderContext }))))) : null));
|
|
40
46
|
}
|
|
41
47
|
exports.default = Blocks;
|
|
@@ -40,6 +40,7 @@ const helpers_js_1 = require("../content-variants/helpers.js");
|
|
|
40
40
|
const enable_editor_1 = __importDefault(require("./components/enable-editor"));
|
|
41
41
|
const inlined_script_1 = __importDefault(require("../inlined-script"));
|
|
42
42
|
const wrap_component_ref_js_1 = require("./wrap-component-ref.js");
|
|
43
|
+
const components_context_1 = __importDefault(require("../../context/components.context"));
|
|
43
44
|
function ContentComponent(props) {
|
|
44
45
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
45
46
|
const [scriptStr, setScriptStr] = (0, react_1.useState)(() => {
|
|
@@ -100,11 +101,14 @@ function ContentComponent(props) {
|
|
|
100
101
|
}), {}),
|
|
101
102
|
inheritedStyles: {},
|
|
102
103
|
}));
|
|
103
|
-
return (React.createElement(
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
104
|
+
return (React.createElement(components_context_1.default.Provider, { value: {
|
|
105
|
+
registeredComponents: registeredComponents,
|
|
106
|
+
} },
|
|
107
|
+
React.createElement(enable_editor_1.default, { content: props.content, model: props.model, context: props.context, apiKey: props.apiKey, canTrack: props.canTrack, locale: props.locale, includeRefs: props.includeRefs, enrich: props.enrich, classNameProp: props.classNameProp, showContent: props.showContent, builderContextSignal: builderContextSignal, setBuilderContextSignal: setBuilderContextSignal },
|
|
108
|
+
props.isSsrAbTest ? (React.createElement(React.Fragment, null,
|
|
109
|
+
React.createElement(inlined_script_1.default, { scriptStr: scriptStr }))) : null,
|
|
110
|
+
target_js_1.TARGET !== "reactNative" ? (React.createElement(React.Fragment, null,
|
|
111
|
+
React.createElement(styles_1.default, { contentId: (_a = builderContextSignal.content) === null || _a === void 0 ? void 0 : _a.id, cssCode: (_c = (_b = builderContextSignal.content) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.cssCode, customFonts: (_e = (_d = builderContextSignal.content) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.customFonts }))) : null,
|
|
112
|
+
React.createElement(blocks_1.default, { blocks: (_g = (_f = builderContextSignal.content) === null || _f === void 0 ? void 0 : _f.data) === null || _g === void 0 ? void 0 : _g.blocks, context: builderContextSignal, registeredComponents: registeredComponents }))));
|
|
109
113
|
}
|
|
110
114
|
exports.default = ContentComponent;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@builder.io/sdk-react-native",
|
|
3
3
|
"description": "Builder.io SDK for React Native",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"module": "./dist/index.js",
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
"dist"
|
|
14
14
|
],
|
|
15
15
|
"scripts": {
|
|
16
|
-
"
|
|
16
|
+
"clean": "rimraf dist",
|
|
17
|
+
"build": "yarn clean && tsc"
|
|
17
18
|
},
|
|
18
19
|
"dependencies": {
|
|
19
20
|
"@react-native-async-storage/async-storage": "^1.17.10",
|
|
@@ -29,6 +30,7 @@
|
|
|
29
30
|
"@tsconfig/react-native": "^2.0.3",
|
|
30
31
|
"@types/react-native-video": "^5.0.9",
|
|
31
32
|
"react-native-url-polyfill": "^1.3.0",
|
|
33
|
+
"rimraf": "^3.0.2",
|
|
32
34
|
"typescript": "^5.1.6"
|
|
33
35
|
}
|
|
34
36
|
}
|
|
@@ -8,11 +8,18 @@ import {
|
|
|
8
8
|
Image,
|
|
9
9
|
Text,
|
|
10
10
|
} from "react-native";
|
|
11
|
+
import { useContext } from "react";
|
|
11
12
|
import BlockStyles from "../block/components/block-styles";
|
|
12
13
|
import Block from "../block/block";
|
|
13
14
|
import BlocksWrapper from "./blocks-wrapper";
|
|
15
|
+
import BuilderContext from "../../context/builder.context";
|
|
16
|
+
import ComponentsContext from "../../context/components.context";
|
|
14
17
|
|
|
15
18
|
function Blocks(props) {
|
|
19
|
+
const builderContext = useContext(BuilderContext);
|
|
20
|
+
|
|
21
|
+
const componentsContext = useContext(ComponentsContext);
|
|
22
|
+
|
|
16
23
|
return (
|
|
17
24
|
<BlocksWrapper
|
|
18
25
|
blocks={props.blocks}
|
|
@@ -26,8 +33,11 @@ function Blocks(props) {
|
|
|
26
33
|
<Block
|
|
27
34
|
key={"render-block-" + block.id}
|
|
28
35
|
block={block}
|
|
29
|
-
context={props.context}
|
|
30
|
-
registeredComponents={
|
|
36
|
+
context={props.context || builderContext}
|
|
37
|
+
registeredComponents={
|
|
38
|
+
props.registeredComponents ||
|
|
39
|
+
componentsContext.registeredComponents
|
|
40
|
+
}
|
|
31
41
|
/>
|
|
32
42
|
))}
|
|
33
43
|
</>
|
|
@@ -39,7 +49,7 @@ function Blocks(props) {
|
|
|
39
49
|
<BlockStyles
|
|
40
50
|
key={"block-style-" + block.id}
|
|
41
51
|
block={block}
|
|
42
|
-
context={props.context}
|
|
52
|
+
context={props.context || builderContext}
|
|
43
53
|
/>
|
|
44
54
|
))}
|
|
45
55
|
</>
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
Image,
|
|
9
9
|
Text,
|
|
10
10
|
} from "react-native";
|
|
11
|
-
import { useState } from "react";
|
|
11
|
+
import { useState, useContext } from "react";
|
|
12
12
|
import { getDefaultRegisteredComponents } from "../../constants/builder-registered-components.js";
|
|
13
13
|
import {
|
|
14
14
|
components,
|
|
@@ -25,6 +25,7 @@ import { getRenderContentScriptString } from "../content-variants/helpers.js";
|
|
|
25
25
|
import EnableEditor from "./components/enable-editor";
|
|
26
26
|
import InlinedScript from "../inlined-script";
|
|
27
27
|
import { wrapComponentRef } from "./wrap-component-ref.js";
|
|
28
|
+
import ComponentsContext from "../../context/components.context";
|
|
28
29
|
|
|
29
30
|
function ContentComponent(props) {
|
|
30
31
|
const [scriptStr, setScriptStr] = useState(() =>
|
|
@@ -97,44 +98,50 @@ function ContentComponent(props) {
|
|
|
97
98
|
}));
|
|
98
99
|
|
|
99
100
|
return (
|
|
100
|
-
<
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
context={props.context}
|
|
104
|
-
apiKey={props.apiKey}
|
|
105
|
-
canTrack={props.canTrack}
|
|
106
|
-
locale={props.locale}
|
|
107
|
-
includeRefs={props.includeRefs}
|
|
108
|
-
enrich={props.enrich}
|
|
109
|
-
classNameProp={props.classNameProp}
|
|
110
|
-
showContent={props.showContent}
|
|
111
|
-
builderContextSignal={builderContextSignal}
|
|
112
|
-
{...{
|
|
113
|
-
setBuilderContextSignal: setBuilderContextSignal,
|
|
101
|
+
<ComponentsContext.Provider
|
|
102
|
+
value={{
|
|
103
|
+
registeredComponents: registeredComponents,
|
|
114
104
|
}}
|
|
115
105
|
>
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
106
|
+
<EnableEditor
|
|
107
|
+
content={props.content}
|
|
108
|
+
model={props.model}
|
|
109
|
+
context={props.context}
|
|
110
|
+
apiKey={props.apiKey}
|
|
111
|
+
canTrack={props.canTrack}
|
|
112
|
+
locale={props.locale}
|
|
113
|
+
includeRefs={props.includeRefs}
|
|
114
|
+
enrich={props.enrich}
|
|
115
|
+
classNameProp={props.classNameProp}
|
|
116
|
+
showContent={props.showContent}
|
|
117
|
+
builderContextSignal={builderContextSignal}
|
|
118
|
+
{...{
|
|
119
|
+
setBuilderContextSignal: setBuilderContextSignal,
|
|
120
|
+
}}
|
|
121
|
+
>
|
|
122
|
+
{props.isSsrAbTest ? (
|
|
123
|
+
<>
|
|
124
|
+
<InlinedScript scriptStr={scriptStr} />
|
|
125
|
+
</>
|
|
126
|
+
) : null}
|
|
121
127
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
128
|
+
{TARGET !== "reactNative" ? (
|
|
129
|
+
<>
|
|
130
|
+
<ContentStyles
|
|
131
|
+
contentId={builderContextSignal.content?.id}
|
|
132
|
+
cssCode={builderContextSignal.content?.data?.cssCode}
|
|
133
|
+
customFonts={builderContextSignal.content?.data?.customFonts}
|
|
134
|
+
/>
|
|
135
|
+
</>
|
|
136
|
+
) : null}
|
|
131
137
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
+
<Blocks
|
|
139
|
+
blocks={builderContextSignal.content?.data?.blocks}
|
|
140
|
+
context={builderContextSignal}
|
|
141
|
+
registeredComponents={registeredComponents}
|
|
142
|
+
/>
|
|
143
|
+
</EnableEditor>
|
|
144
|
+
</ComponentsContext.Provider>
|
|
138
145
|
);
|
|
139
146
|
}
|
|
140
147
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.5.
|
|
1
|
+
export const SDK_VERSION = "0.5.2"
|
package/dist/blocks/util.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
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;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
'use client';
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
-
if (mod && mod.__esModule) return mod;
|
|
21
|
-
var result = {};
|
|
22
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
-
__setModuleDefault(result, mod);
|
|
24
|
-
return result;
|
|
25
|
-
};
|
|
26
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
const React = __importStar(require("react"));
|
|
28
|
-
const react_native_1 = require("react-native");
|
|
29
|
-
const interactive_element_helpers_js_1 = require("../interactive-element/interactive-element.helpers.js");
|
|
30
|
-
function BlockWrapper(props) {
|
|
31
|
-
return (React.createElement(React.Fragment, null, props.hasChildren ? (React.createElement(React.Fragment, null,
|
|
32
|
-
React.createElement(props.Wrapper, { ...(0, interactive_element_helpers_js_1.getBlockProps)({
|
|
33
|
-
block: props.block,
|
|
34
|
-
contextValue: props.context,
|
|
35
|
-
}) }, props.children))) : (React.createElement(React.Fragment, null,
|
|
36
|
-
React.createElement(props.Wrapper, { ...(0, interactive_element_helpers_js_1.getBlockProps)({
|
|
37
|
-
block: props.block,
|
|
38
|
-
contextValue: props.context,
|
|
39
|
-
}) })))));
|
|
40
|
-
}
|
|
41
|
-
exports.default = BlockWrapper;
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
'use client';
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
-
if (mod && mod.__esModule) return mod;
|
|
21
|
-
var result = {};
|
|
22
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
-
__setModuleDefault(result, mod);
|
|
24
|
-
return result;
|
|
25
|
-
};
|
|
26
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
|
-
};
|
|
29
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
const React = __importStar(require("react"));
|
|
31
|
-
const react_native_1 = require("react-native");
|
|
32
|
-
const react_1 = require("react");
|
|
33
|
-
const block_styles_1 = __importDefault(require("./block-styles"));
|
|
34
|
-
const block_1 = __importDefault(require("../block"));
|
|
35
|
-
const get_block_properties_js_1 = require("../../../functions/get-block-properties.js");
|
|
36
|
-
const block_wrapper_1 = __importDefault(require("./block-wrapper"));
|
|
37
|
-
const builder_context_js_1 = __importDefault(require("../../../context/builder.context.js"));
|
|
38
|
-
function ComponentRef(props) {
|
|
39
|
-
var _a, _b;
|
|
40
|
-
const [Wrapper, setWrapper] = (0, react_1.useState)(() => props.isRSC ? props.componentRef : block_wrapper_1.default);
|
|
41
|
-
function wrapperProps() {
|
|
42
|
-
const blockWrapperProps = {
|
|
43
|
-
Wrapper: props.componentRef,
|
|
44
|
-
block: props.builderBlock,
|
|
45
|
-
context: props.context,
|
|
46
|
-
wrapperProps: props.componentOptions,
|
|
47
|
-
shouldNestAttributes: true,
|
|
48
|
-
};
|
|
49
|
-
return props.isRSC
|
|
50
|
-
? {
|
|
51
|
-
...props.componentOptions,
|
|
52
|
-
/**
|
|
53
|
-
* If `noWrap` is set to `true`, then the block's props/attributes are provided to the * component itself directly. Otherwise, they are provided to the wrapper element. */ ...(props.includeBlockProps
|
|
54
|
-
? {
|
|
55
|
-
attributes: (0, get_block_properties_js_1.getBlockProperties)({
|
|
56
|
-
block: props.builderBlock,
|
|
57
|
-
context: props.context,
|
|
58
|
-
}),
|
|
59
|
-
}
|
|
60
|
-
: {}),
|
|
61
|
-
}
|
|
62
|
-
: blockWrapperProps;
|
|
63
|
-
}
|
|
64
|
-
return (React.createElement(builder_context_js_1.default.Provider, { value: {
|
|
65
|
-
content: props.context.content,
|
|
66
|
-
rootState: props.context.rootState,
|
|
67
|
-
localState: props.context.localState,
|
|
68
|
-
context: props.context.context,
|
|
69
|
-
apiKey: props.context.apiKey,
|
|
70
|
-
componentInfos: props.context.componentInfos,
|
|
71
|
-
inheritedStyles: props.context.inheritedStyles,
|
|
72
|
-
apiVersion: props.context.apiVersion,
|
|
73
|
-
} },
|
|
74
|
-
React.createElement(Wrapper, { ...wrapperProps() },
|
|
75
|
-
" ", (_a = props.blockChildren) === null || _a === void 0 ? void 0 :
|
|
76
|
-
_a.map((child) => (React.createElement(block_1.default, { key: "block-" + child.id, block: child, context: props.context, registeredComponents: props.registeredComponents }))),
|
|
77
|
-
" ", (_b = props.blockChildren) === null || _b === void 0 ? void 0 :
|
|
78
|
-
_b.map((child) => (React.createElement(block_styles_1.default, { key: "block-style-" + child.id, block: child, context: props.context }))),
|
|
79
|
-
" ")));
|
|
80
|
-
}
|
|
81
|
-
exports.default = ComponentRef;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
'use client';
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
-
if (mod && mod.__esModule) return mod;
|
|
21
|
-
var result = {};
|
|
22
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
-
__setModuleDefault(result, mod);
|
|
24
|
-
return result;
|
|
25
|
-
};
|
|
26
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
|
-
};
|
|
29
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
const React = __importStar(require("react"));
|
|
31
|
-
const react_native_1 = require("react-native");
|
|
32
|
-
const block_styles_1 = __importDefault(require("./block-styles"));
|
|
33
|
-
const block_1 = __importDefault(require("../block"));
|
|
34
|
-
function Component(props) {
|
|
35
|
-
var _a, _b;
|
|
36
|
-
return (React.createElement(React.Fragment, null, props.componentRef ? (React.createElement(React.Fragment, null,
|
|
37
|
-
React.createElement(props.componentRef, { ...props.componentOptions }, (_a = props.blockChildren) === null || _a === void 0 ? void 0 :
|
|
38
|
-
_a.map((child) => (React.createElement(block_1.default, { key: "render-block-" + child.id, block: child, context: props.context, components: props.components }))), (_b = props.blockChildren) === null || _b === void 0 ? void 0 :
|
|
39
|
-
_b.map((child) => (React.createElement(block_styles_1.default, { key: "block-style-" + child.id, block: child, context: props.context })))))) : null));
|
|
40
|
-
}
|
|
41
|
-
exports.default = Component;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getBlockProps = void 0;
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
-
var __spreadValues = (a, b) => {
|
|
10
|
-
for (var prop in b || (b = {}))
|
|
11
|
-
if (__hasOwnProp.call(b, prop))
|
|
12
|
-
__defNormalProp(a, prop, b[prop]);
|
|
13
|
-
if (__getOwnPropSymbols)
|
|
14
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
-
if (__propIsEnum.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
}
|
|
18
|
-
return a;
|
|
19
|
-
};
|
|
20
|
-
const get_block_actions_1 = require("../../../../functions/get-block-actions");
|
|
21
|
-
const get_block_properties_1 = require("../../../../functions/get-block-properties");
|
|
22
|
-
const getBlockProps = ({ block, contextValue }) => {
|
|
23
|
-
const blockProps = __spreadValues(__spreadValues({}, (0, get_block_properties_1.getBlockProperties)({
|
|
24
|
-
block,
|
|
25
|
-
context: contextValue
|
|
26
|
-
})), (0, get_block_actions_1.getBlockActions)({
|
|
27
|
-
block,
|
|
28
|
-
rootState: contextValue.rootState,
|
|
29
|
-
rootSetState: contextValue.rootSetState,
|
|
30
|
-
localState: contextValue.localState,
|
|
31
|
-
context: contextValue.context
|
|
32
|
-
}));
|
|
33
|
-
return blockProps;
|
|
34
|
-
};
|
|
35
|
-
exports.getBlockProps = getBlockProps;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
'use client';
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
-
if (mod && mod.__esModule) return mod;
|
|
21
|
-
var result = {};
|
|
22
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
-
__setModuleDefault(result, mod);
|
|
24
|
-
return result;
|
|
25
|
-
};
|
|
26
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
const React = __importStar(require("react"));
|
|
28
|
-
const react_native_1 = require("react-native");
|
|
29
|
-
const interactive_element_helpers_js_1 = require("./interactive-element.helpers.js");
|
|
30
|
-
function InteractiveElement(props) {
|
|
31
|
-
return (React.createElement(props.Wrapper, { ...props.wrapperProps, attributes: (0, interactive_element_helpers_js_1.getBlockProps)({
|
|
32
|
-
block: props.block,
|
|
33
|
-
contextValue: props.context,
|
|
34
|
-
}) }, props.children));
|
|
35
|
-
}
|
|
36
|
-
exports.default = InteractiveElement;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
'use client';
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
-
if (mod && mod.__esModule) return mod;
|
|
21
|
-
var result = {};
|
|
22
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
-
__setModuleDefault(result, mod);
|
|
24
|
-
return result;
|
|
25
|
-
};
|
|
26
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
const React = __importStar(require("react"));
|
|
28
|
-
const react_native_1 = require("react-native");
|
|
29
|
-
function BuilderEditing(props) {
|
|
30
|
-
return React.createElement(react_native_1.View, null);
|
|
31
|
-
}
|
|
32
|
-
exports.default = BuilderEditing;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getFontCss = exports.getCss = void 0;
|
|
4
|
-
const getCssFromFont = (font) => {
|
|
5
|
-
var _a, _b;
|
|
6
|
-
const family = font.family + (font.kind && !font.kind.includes("#") ? ", " + font.kind : "");
|
|
7
|
-
const name = family.split(",")[0];
|
|
8
|
-
const url = (_b = font.fileUrl) != null ? _b : (_a = font == null ? void 0 : font.files) == null ? void 0 : _a.regular;
|
|
9
|
-
let str = "";
|
|
10
|
-
if (url && family && name) {
|
|
11
|
-
str += `
|
|
12
|
-
@font-face {
|
|
13
|
-
font-family: "${family}";
|
|
14
|
-
src: local("${name}"), url('${url}') format('woff2');
|
|
15
|
-
font-display: fallback;
|
|
16
|
-
font-weight: 400;
|
|
17
|
-
}
|
|
18
|
-
`.trim();
|
|
19
|
-
}
|
|
20
|
-
if (font.files) {
|
|
21
|
-
for (const weight in font.files) {
|
|
22
|
-
const isNumber = String(Number(weight)) === weight;
|
|
23
|
-
if (!isNumber) {
|
|
24
|
-
continue;
|
|
25
|
-
}
|
|
26
|
-
const weightUrl = font.files[weight];
|
|
27
|
-
if (weightUrl && weightUrl !== url) {
|
|
28
|
-
str += `
|
|
29
|
-
@font-face {
|
|
30
|
-
font-family: "${family}";
|
|
31
|
-
src: url('${weightUrl}') format('woff2');
|
|
32
|
-
font-display: fallback;
|
|
33
|
-
font-weight: ${weight};
|
|
34
|
-
}
|
|
35
|
-
`.trim();
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return str;
|
|
40
|
-
};
|
|
41
|
-
const getFontCss = ({ customFonts }) => {
|
|
42
|
-
var _a;
|
|
43
|
-
return ((_a = customFonts == null ? void 0 : customFonts.map((font) => getCssFromFont(font))) == null ? void 0 : _a.join(" ")) || "";
|
|
44
|
-
};
|
|
45
|
-
exports.getFontCss = getFontCss;
|
|
46
|
-
const getCss = ({ cssCode, contentId }) => {
|
|
47
|
-
if (!cssCode) {
|
|
48
|
-
return "";
|
|
49
|
-
}
|
|
50
|
-
if (!contentId) {
|
|
51
|
-
return cssCode;
|
|
52
|
-
}
|
|
53
|
-
return (cssCode == null ? void 0 : cssCode.replace(/&/g, `div[builder-content-id="${contentId}"]`)) || "";
|
|
54
|
-
};
|
|
55
|
-
exports.getCss = getCss;
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
'use client';
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
-
if (mod && mod.__esModule) return mod;
|
|
21
|
-
var result = {};
|
|
22
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
-
__setModuleDefault(result, mod);
|
|
24
|
-
return result;
|
|
25
|
-
};
|
|
26
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
|
-
};
|
|
29
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
const React = __importStar(require("react"));
|
|
31
|
-
const react_native_1 = require("react-native");
|
|
32
|
-
const react_1 = require("react");
|
|
33
|
-
const inlined_styles_1 = __importDefault(require("../../inlined-styles"));
|
|
34
|
-
const content_styles_helpers_1 = require("./content-styles.helpers");
|
|
35
|
-
const content_styles_helpers_2 = require("./content-styles.helpers");
|
|
36
|
-
function ContentStyles(props) {
|
|
37
|
-
const [injectedStyles, setInjectedStyles] = (0, react_1.useState)(() => `
|
|
38
|
-
${(0, content_styles_helpers_1.getCss)({
|
|
39
|
-
cssCode: props.cssCode,
|
|
40
|
-
contentId: props.contentId,
|
|
41
|
-
})}
|
|
42
|
-
${(0, content_styles_helpers_2.getFontCss)({
|
|
43
|
-
customFonts: props.customFonts,
|
|
44
|
-
})}
|
|
45
|
-
|
|
46
|
-
.builder-text > p:first-of-type, .builder-text > .builder-paragraph:first-of-type {
|
|
47
|
-
margin: 0;
|
|
48
|
-
}
|
|
49
|
-
.builder-text > p, .builder-text > .builder-paragraph {
|
|
50
|
-
color: inherit;
|
|
51
|
-
line-height: inherit;
|
|
52
|
-
letter-spacing: inherit;
|
|
53
|
-
font-weight: inherit;
|
|
54
|
-
font-size: inherit;
|
|
55
|
-
text-align: inherit;
|
|
56
|
-
font-family: inherit;
|
|
57
|
-
}
|
|
58
|
-
`.trim());
|
|
59
|
-
return React.createElement(inlined_styles_1.default, { styles: injectedStyles });
|
|
60
|
-
}
|
|
61
|
-
exports.default = ContentStyles;
|