@builder.io/sdk-react-native 0.5.1 → 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/constants/sdk-version.js +1 -1
- package/package.json +4 -2
- package/src/constants/sdk-version.js +1 -1
- 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
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
|
}
|
|
@@ -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;
|
|
@@ -1,96 +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 device_sizes_js_1 = require("../../constants/device-sizes.js");
|
|
33
|
-
const target_js_1 = require("../../constants/target.js");
|
|
34
|
-
const get_processed_block_js_1 = require("../../functions/get-processed-block.js");
|
|
35
|
-
const css_js_1 = require("../../helpers/css.js");
|
|
36
|
-
const nullable_js_1 = require("../../helpers/nullable.js");
|
|
37
|
-
const inlined_styles_1 = __importDefault(require("../inlined-styles"));
|
|
38
|
-
function BlockStyles(props) {
|
|
39
|
-
function useBlock() {
|
|
40
|
-
return (0, get_processed_block_js_1.getProcessedBlock)({
|
|
41
|
-
block: props.block,
|
|
42
|
-
localState: props.context.localState,
|
|
43
|
-
rootState: props.context.rootState,
|
|
44
|
-
rootSetState: props.context.rootSetState,
|
|
45
|
-
context: props.context.context,
|
|
46
|
-
shouldEvaluateBindings: true,
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
function canShowBlock() {
|
|
50
|
-
// only render styles for blocks that are visible
|
|
51
|
-
if ((0, nullable_js_1.checkIsDefined)(useBlock().hide)) {
|
|
52
|
-
return !useBlock().hide;
|
|
53
|
-
}
|
|
54
|
-
if ((0, nullable_js_1.checkIsDefined)(useBlock().show)) {
|
|
55
|
-
return useBlock().show;
|
|
56
|
-
}
|
|
57
|
-
return true;
|
|
58
|
-
}
|
|
59
|
-
function css() {
|
|
60
|
-
var _a;
|
|
61
|
-
const styles = useBlock().responsiveStyles;
|
|
62
|
-
const content = props.context.content;
|
|
63
|
-
const sizesWithUpdatedBreakpoints = (0, device_sizes_js_1.getSizesForBreakpoints)(((_a = content === null || content === void 0 ? void 0 : content.meta) === null || _a === void 0 ? void 0 : _a.breakpoints) || {});
|
|
64
|
-
const largeStyles = styles === null || styles === void 0 ? void 0 : styles.large;
|
|
65
|
-
const mediumStyles = styles === null || styles === void 0 ? void 0 : styles.medium;
|
|
66
|
-
const smallStyles = styles === null || styles === void 0 ? void 0 : styles.small;
|
|
67
|
-
const className = useBlock().id;
|
|
68
|
-
if (!className) {
|
|
69
|
-
return "";
|
|
70
|
-
}
|
|
71
|
-
const largeStylesClass = largeStyles
|
|
72
|
-
? (0, css_js_1.createCssClass)({
|
|
73
|
-
className,
|
|
74
|
-
styles: largeStyles,
|
|
75
|
-
})
|
|
76
|
-
: "";
|
|
77
|
-
const mediumStylesClass = mediumStyles
|
|
78
|
-
? (0, css_js_1.createCssClass)({
|
|
79
|
-
className,
|
|
80
|
-
styles: mediumStyles,
|
|
81
|
-
mediaQuery: (0, device_sizes_js_1.getMaxWidthQueryForSize)("medium", sizesWithUpdatedBreakpoints),
|
|
82
|
-
})
|
|
83
|
-
: "";
|
|
84
|
-
const smallStylesClass = smallStyles
|
|
85
|
-
? (0, css_js_1.createCssClass)({
|
|
86
|
-
className,
|
|
87
|
-
styles: smallStyles,
|
|
88
|
-
mediaQuery: (0, device_sizes_js_1.getMaxWidthQueryForSize)("small", sizesWithUpdatedBreakpoints),
|
|
89
|
-
})
|
|
90
|
-
: "";
|
|
91
|
-
return [largeStylesClass, mediumStylesClass, smallStylesClass].join(" ");
|
|
92
|
-
}
|
|
93
|
-
return (React.createElement(React.Fragment, null, target_js_1.TARGET !== "reactNative" && css() && canShowBlock() ? (React.createElement(React.Fragment, null,
|
|
94
|
-
React.createElement(inlined_styles_1.default, { styles: css() }))) : null));
|
|
95
|
-
}
|
|
96
|
-
exports.default = BlockStyles;
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isEmptyHtmlElement = exports.getRepeatItemData = exports.getComponent = void 0;
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __defProps = Object.defineProperties;
|
|
6
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
-
var __spreadValues = (a, b) => {
|
|
12
|
-
for (var prop in b || (b = {}))
|
|
13
|
-
if (__hasOwnProp.call(b, prop))
|
|
14
|
-
__defNormalProp(a, prop, b[prop]);
|
|
15
|
-
if (__getOwnPropSymbols)
|
|
16
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
-
if (__propIsEnum.call(b, prop))
|
|
18
|
-
__defNormalProp(a, prop, b[prop]);
|
|
19
|
-
}
|
|
20
|
-
return a;
|
|
21
|
-
};
|
|
22
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
23
|
-
var __objRest = (source, exclude) => {
|
|
24
|
-
var target = {};
|
|
25
|
-
for (var prop in source)
|
|
26
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
27
|
-
target[prop] = source[prop];
|
|
28
|
-
if (source != null && __getOwnPropSymbols)
|
|
29
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
30
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
31
|
-
target[prop] = source[prop];
|
|
32
|
-
}
|
|
33
|
-
return target;
|
|
34
|
-
};
|
|
35
|
-
const evaluate_1 = require("../../functions/evaluate");
|
|
36
|
-
const get_processed_block_1 = require("../../functions/get-processed-block");
|
|
37
|
-
const EMPTY_HTML_ELEMENTS = [
|
|
38
|
-
"area",
|
|
39
|
-
"base",
|
|
40
|
-
"br",
|
|
41
|
-
"col",
|
|
42
|
-
"embed",
|
|
43
|
-
"hr",
|
|
44
|
-
"img",
|
|
45
|
-
"input",
|
|
46
|
-
"keygen",
|
|
47
|
-
"link",
|
|
48
|
-
"meta",
|
|
49
|
-
"param",
|
|
50
|
-
"source",
|
|
51
|
-
"track",
|
|
52
|
-
"wbr"
|
|
53
|
-
];
|
|
54
|
-
const isEmptyHtmlElement = (tagName) => {
|
|
55
|
-
return typeof tagName === "string" && EMPTY_HTML_ELEMENTS.includes(tagName.toLowerCase());
|
|
56
|
-
};
|
|
57
|
-
exports.isEmptyHtmlElement = isEmptyHtmlElement;
|
|
58
|
-
const getComponent = ({ block, context }) => {
|
|
59
|
-
var _a;
|
|
60
|
-
const componentName = (_a = (0, get_processed_block_1.getProcessedBlock)({
|
|
61
|
-
block,
|
|
62
|
-
localState: context.localState,
|
|
63
|
-
rootState: context.rootState,
|
|
64
|
-
rootSetState: context.rootSetState,
|
|
65
|
-
context: context.context,
|
|
66
|
-
shouldEvaluateBindings: false
|
|
67
|
-
}).component) == null ? void 0 : _a.name;
|
|
68
|
-
if (!componentName) {
|
|
69
|
-
return null;
|
|
70
|
-
}
|
|
71
|
-
const ref = context.registeredComponents[componentName];
|
|
72
|
-
if (!ref) {
|
|
73
|
-
console.warn(`
|
|
74
|
-
Could not find a registered component named "${componentName}".
|
|
75
|
-
If you registered it, is the file that registered it imported by the file that needs to render it?`);
|
|
76
|
-
return void 0;
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
return ref;
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
exports.getComponent = getComponent;
|
|
83
|
-
const getRepeatItemData = ({ block, context }) => {
|
|
84
|
-
const _a = block, { repeat } = _a, blockWithoutRepeat = __objRest(_a, ["repeat"]);
|
|
85
|
-
if (!(repeat == null ? void 0 : repeat.collection)) {
|
|
86
|
-
return void 0;
|
|
87
|
-
}
|
|
88
|
-
const itemsArray = (0, evaluate_1.evaluate)({
|
|
89
|
-
code: repeat.collection,
|
|
90
|
-
localState: context.localState,
|
|
91
|
-
rootState: context.rootState,
|
|
92
|
-
rootSetState: context.rootSetState,
|
|
93
|
-
context: context.context
|
|
94
|
-
});
|
|
95
|
-
if (!Array.isArray(itemsArray)) {
|
|
96
|
-
return void 0;
|
|
97
|
-
}
|
|
98
|
-
const collectionName = repeat.collection.split(".").pop();
|
|
99
|
-
const itemNameToUse = repeat.itemName || (collectionName ? collectionName + "Item" : "item");
|
|
100
|
-
const repeatArray = itemsArray.map((item, index) => ({
|
|
101
|
-
context: __spreadProps(__spreadValues({}, context), {
|
|
102
|
-
localState: __spreadProps(__spreadValues({}, context.localState), {
|
|
103
|
-
$index: index,
|
|
104
|
-
$item: item,
|
|
105
|
-
[itemNameToUse]: item,
|
|
106
|
-
[`$${itemNameToUse}Index`]: index
|
|
107
|
-
})
|
|
108
|
-
}),
|
|
109
|
-
block: blockWithoutRepeat
|
|
110
|
-
}));
|
|
111
|
-
return repeatArray;
|
|
112
|
-
};
|
|
113
|
-
exports.getRepeatItemData = getRepeatItemData;
|