@builder.io/sdk-react 0.0.2 → 0.0.4
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/package.json +6 -1
- package/packages/_rsc/src/blocks/BaseText.js +27 -0
- package/packages/_rsc/src/blocks/button/button.js +35 -0
- package/packages/_rsc/src/blocks/button/component-info.js +41 -0
- package/packages/_rsc/src/blocks/columns/columns.js +96 -0
- package/packages/_rsc/src/blocks/columns/component-info.js +242 -0
- package/packages/_rsc/src/blocks/custom-code/component-info.js +31 -0
- package/packages/_rsc/src/blocks/custom-code/custom-code.js +63 -0
- package/packages/_rsc/src/blocks/embed/component-info.js +44 -0
- package/packages/_rsc/src/blocks/embed/embed.js +55 -0
- package/packages/_rsc/src/blocks/embed/helpers.js +9 -0
- package/packages/_rsc/src/blocks/form/component-info.js +262 -0
- package/packages/_rsc/src/blocks/form/form.js +222 -0
- package/packages/_rsc/src/blocks/fragment/component-info.js +11 -0
- package/packages/_rsc/src/blocks/fragment/fragment.js +24 -0
- package/packages/_rsc/src/blocks/image/component-info.js +151 -0
- package/packages/_rsc/src/blocks/image/image.helpers.js +48 -0
- package/packages/_rsc/src/blocks/image/image.js +101 -0
- package/packages/_rsc/src/blocks/img/component-info.js +20 -0
- package/packages/_rsc/src/blocks/img/img.js +33 -0
- package/packages/_rsc/src/blocks/input/component-info.js +74 -0
- package/packages/_rsc/src/blocks/input/input.js +36 -0
- package/packages/_rsc/src/blocks/raw-text/component-info.js +16 -0
- package/packages/_rsc/src/blocks/raw-text/raw-text.js +28 -0
- package/packages/_rsc/src/blocks/section/component-info.js +49 -0
- package/packages/_rsc/src/blocks/section/section.js +31 -0
- package/packages/_rsc/src/blocks/select/component-info.js +59 -0
- package/packages/_rsc/src/blocks/select/select.js +36 -0
- package/packages/_rsc/src/blocks/submit-button/component-info.js +28 -0
- package/packages/_rsc/src/blocks/submit-button/submit-button.js +26 -0
- package/packages/_rsc/src/blocks/symbol/component-info.js +43 -0
- package/packages/_rsc/src/blocks/symbol/symbol.js +51 -0
- package/packages/_rsc/src/blocks/text/component-info.js +24 -0
- package/packages/_rsc/src/blocks/text/text.js +27 -0
- package/packages/_rsc/src/blocks/textarea/component-info.js +47 -0
- package/packages/_rsc/src/blocks/textarea/textarea.js +32 -0
- package/packages/_rsc/src/blocks/util.js +8 -0
- package/packages/_rsc/src/blocks/video/component-info.js +106 -0
- package/packages/_rsc/src/blocks/video/video.js +57 -0
- package/packages/_rsc/src/components/render-block/block-styles.js +70 -0
- package/packages/_rsc/src/components/render-block/render-block.helpers.js +23 -0
- package/packages/_rsc/src/components/render-block/render-block.js +206 -0
- package/packages/_rsc/src/components/render-block/render-component-with-context.js +51 -0
- package/packages/_rsc/src/components/render-block/render-component.js +43 -0
- package/packages/_rsc/src/components/render-block/render-repeated-block.js +49 -0
- package/packages/_rsc/src/components/render-block/types.js +0 -0
- package/packages/_rsc/src/components/render-blocks.js +80 -0
- package/packages/_rsc/src/components/render-content/builder-editing.js +35 -0
- package/packages/_rsc/src/components/render-content/components/render-styles.js +78 -0
- package/packages/_rsc/src/components/render-content/index.js +4 -0
- package/packages/_rsc/src/components/render-content/render-content.js +200 -0
- package/packages/_rsc/src/components/render-inlined-styles.js +36 -0
- package/packages/_rsc/src/constants/builder-registered-components.js +54 -0
- package/packages/_rsc/src/constants/device-sizes.js +48 -0
- package/packages/_rsc/src/constants/target.js +4 -0
- package/packages/_rsc/src/context/builder.context.js +11 -0
- package/packages/_rsc/src/context/types.js +0 -0
- package/packages/_rsc/src/functions/camel-to-kebab-case.js +4 -0
- package/packages/_rsc/src/functions/evaluate.js +6 -0
- package/packages/_rsc/src/functions/event-handler-name.js +7 -0
- package/packages/_rsc/src/functions/extract-text-styles.js +22 -0
- package/packages/_rsc/src/functions/fast-clone.js +4 -0
- package/packages/_rsc/src/functions/get-block-actions-handler.js +11 -0
- package/packages/_rsc/src/functions/get-block-actions.js +18 -0
- package/packages/_rsc/src/functions/get-block-component-options.js +28 -0
- package/packages/_rsc/src/functions/get-block-properties.js +29 -0
- package/packages/_rsc/src/functions/get-block-tag.js +6 -0
- package/packages/_rsc/src/functions/get-builder-search-params/fn.test.js +13 -0
- package/packages/_rsc/src/functions/get-builder-search-params/index.js +38 -0
- package/packages/_rsc/src/functions/get-content/ab-testing.js +99 -0
- package/packages/_rsc/src/functions/get-content/fn.test.js +31 -0
- package/packages/_rsc/src/functions/get-content/index.js +101 -0
- package/packages/_rsc/src/functions/get-content/types.js +0 -0
- package/packages/_rsc/src/functions/get-fetch.js +34 -0
- package/packages/_rsc/src/functions/get-global-this.js +18 -0
- package/packages/_rsc/src/functions/get-processed-block.js +59 -0
- package/packages/_rsc/src/functions/get-processed-block.test.js +32 -0
- package/packages/_rsc/src/functions/get-react-native-block-styles.js +32 -0
- package/packages/_rsc/src/functions/if-target.js +15 -0
- package/packages/_rsc/src/functions/is-browser.js +6 -0
- package/packages/_rsc/src/functions/is-editing.js +7 -0
- package/packages/_rsc/src/functions/is-iframe.js +7 -0
- package/packages/_rsc/src/functions/is-previewing.js +14 -0
- package/packages/_rsc/src/functions/on-change.js +27 -0
- package/packages/_rsc/src/functions/on-change.test.js +19 -0
- package/packages/_rsc/src/functions/register-component.js +68 -0
- package/packages/_rsc/src/functions/register.js +29 -0
- package/packages/_rsc/src/functions/sanitize-react-native-block-styles.js +66 -0
- package/packages/_rsc/src/functions/set-editor-settings.js +15 -0
- package/packages/_rsc/src/functions/set.js +11 -0
- package/packages/_rsc/src/functions/set.test.js +16 -0
- package/packages/_rsc/src/functions/track.js +124 -0
- package/packages/_rsc/src/functions/transform-block.js +6 -0
- package/packages/_rsc/src/helpers/ab-tests.js +16 -0
- package/packages/_rsc/src/helpers/cookie.js +79 -0
- package/packages/_rsc/src/helpers/css.js +28 -0
- package/packages/_rsc/src/helpers/flatten.js +34 -0
- package/packages/_rsc/src/helpers/localStorage.js +34 -0
- package/packages/_rsc/src/helpers/nullable.js +4 -0
- package/packages/_rsc/src/helpers/sessionId.js +49 -0
- package/packages/_rsc/src/helpers/time.js +5 -0
- package/packages/_rsc/src/helpers/url.js +10 -0
- package/packages/_rsc/src/helpers/url.test.js +15 -0
- package/packages/_rsc/src/helpers/uuid.js +13 -0
- package/packages/_rsc/src/helpers/visitorId.js +33 -0
- package/packages/_rsc/src/index-helpers/blocks-exports.js +22 -0
- package/packages/_rsc/src/index-helpers/top-of-file.js +2 -0
- package/packages/_rsc/src/index.js +14 -0
- package/packages/_rsc/src/scripts/init-editing.js +93 -0
- package/packages/_rsc/src/types/builder-block.js +0 -0
- package/packages/_rsc/src/types/builder-content.js +0 -0
- package/packages/_rsc/src/types/can-track.js +0 -0
- package/packages/_rsc/src/types/components.js +0 -0
- package/packages/_rsc/src/types/deep-partial.js +0 -0
- package/packages/_rsc/src/types/element.js +0 -0
- package/packages/_rsc/src/types/targets.js +0 -0
- package/packages/_rsc/src/types/typescript.js +0 -0
- package/src/blocks/button/button.jsx +6 -5
- package/src/blocks/columns/columns.jsx +9 -10
- package/src/blocks/columns/component-info.js +2 -2
- package/src/blocks/embed/component-info.js +2 -2
- package/src/blocks/form/form.jsx +4 -7
- package/src/blocks/image/component-info.js +2 -2
- package/src/blocks/image/image.jsx +36 -14
- package/src/blocks/img/img.jsx +2 -5
- package/src/blocks/submit-button/submit-button.jsx +2 -5
- package/src/blocks/symbol/symbol.jsx +3 -4
- package/src/blocks/util.js +6 -5
- package/src/components/render-block/block-styles.jsx +9 -3
- package/src/components/render-block/render-block.jsx +14 -11
- package/src/components/render-block/render-component.jsx +1 -2
- package/src/components/render-content/builder-editing.jsx +7 -0
- package/src/components/render-content/render-content.jsx +14 -6
- package/src/components/render-inlined-styles.jsx +4 -4
- package/src/constants/device-sizes.js +29 -2
- package/src/constants/target.js +1 -1
- package/src/functions/evaluate.js +4 -3
- package/src/functions/get-block-actions-handler.js +8 -9
- package/src/functions/get-block-actions.js +2 -2
- package/src/functions/get-builder-search-params/index.js +2 -1
- package/src/functions/get-content/index.js +8 -3
- package/src/functions/register-component.js +1 -5
- package/src/functions/track.js +4 -0
- package/src/index.js +1 -1
- package/src/scripts/init-editing.js +17 -5
- package/src/functions/mark-mutable.js +0 -10
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
import * as React from "react";
|
|
21
|
+
import RenderContent from "../../components/render-content/render-content.js";
|
|
22
|
+
function Symbol(props) {
|
|
23
|
+
var _a, _b, _c, _d, _e;
|
|
24
|
+
const _context = __spreadValues({}, props["_context"]);
|
|
25
|
+
const state = {
|
|
26
|
+
className: "builder-symbol",
|
|
27
|
+
fetchedContent: null,
|
|
28
|
+
get contentToUse() {
|
|
29
|
+
var _a2;
|
|
30
|
+
return ((_a2 = props.symbol) == null ? void 0 : _a2.content) || state.fetchedContent;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
const builderContext = _context["BuilderContext"];
|
|
34
|
+
return /* @__PURE__ */ React.createElement("div", __spreadProps(__spreadValues({}, props.attributes), {
|
|
35
|
+
dataSet: {
|
|
36
|
+
class: state.className
|
|
37
|
+
},
|
|
38
|
+
className: state.className
|
|
39
|
+
}), /* @__PURE__ */ React.createElement(RenderContent, {
|
|
40
|
+
apiKey: builderContext.apiKey,
|
|
41
|
+
context: builderContext.context,
|
|
42
|
+
customComponents: Object.values(builderContext.registeredComponents),
|
|
43
|
+
data: __spreadValues(__spreadValues(__spreadValues({}, (_a = props.symbol) == null ? void 0 : _a.data), builderContext.state), (_d = (_c = (_b = props.symbol) == null ? void 0 : _b.content) == null ? void 0 : _c.data) == null ? void 0 : _d.state),
|
|
44
|
+
model: (_e = props.symbol) == null ? void 0 : _e.model,
|
|
45
|
+
content: state.contentToUse,
|
|
46
|
+
_context
|
|
47
|
+
}));
|
|
48
|
+
}
|
|
49
|
+
export {
|
|
50
|
+
Symbol as default
|
|
51
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const componentInfo = {
|
|
2
|
+
name: "Text",
|
|
3
|
+
static: true,
|
|
4
|
+
builtIn: true,
|
|
5
|
+
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",
|
|
6
|
+
inputs: [
|
|
7
|
+
{
|
|
8
|
+
name: "text",
|
|
9
|
+
type: "html",
|
|
10
|
+
required: true,
|
|
11
|
+
autoFocus: true,
|
|
12
|
+
bubble: true,
|
|
13
|
+
defaultValue: "Enter some text..."
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
defaultStyles: {
|
|
17
|
+
lineHeight: "normal",
|
|
18
|
+
height: "auto",
|
|
19
|
+
textAlign: "center"
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
componentInfo
|
|
24
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
17
|
+
import * as React from "react";
|
|
18
|
+
function Text(props) {
|
|
19
|
+
const _context = __spreadValues({}, props["_context"]);
|
|
20
|
+
return /* @__PURE__ */ React.createElement("span", {
|
|
21
|
+
className: "builder-text",
|
|
22
|
+
dangerouslySetInnerHTML: { __html: props.text }
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
Text as default
|
|
27
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
const componentInfo = {
|
|
2
|
+
name: "Form:TextArea",
|
|
3
|
+
builtIn: true,
|
|
4
|
+
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Ff74a2f3de58c4c3e939204e5b6b8f6c3",
|
|
5
|
+
inputs: [
|
|
6
|
+
{
|
|
7
|
+
advanced: true,
|
|
8
|
+
name: "value",
|
|
9
|
+
type: "string"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
name: "name",
|
|
13
|
+
type: "string",
|
|
14
|
+
required: true,
|
|
15
|
+
helperText: 'Every input in a form needs a unique name describing what it gets, e.g. "email"'
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: "defaultValue",
|
|
19
|
+
type: "string"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
name: "placeholder",
|
|
23
|
+
type: "string",
|
|
24
|
+
defaultValue: "Hello there"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: "required",
|
|
28
|
+
type: "boolean",
|
|
29
|
+
defaultValue: false
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
defaultStyles: {
|
|
33
|
+
paddingTop: "10px",
|
|
34
|
+
paddingBottom: "10px",
|
|
35
|
+
paddingLeft: "10px",
|
|
36
|
+
paddingRight: "10px",
|
|
37
|
+
borderRadius: "3px",
|
|
38
|
+
borderWidth: "1px",
|
|
39
|
+
borderStyle: "solid",
|
|
40
|
+
borderColor: "#ccc"
|
|
41
|
+
},
|
|
42
|
+
static: true,
|
|
43
|
+
noWrap: true
|
|
44
|
+
};
|
|
45
|
+
export {
|
|
46
|
+
componentInfo
|
|
47
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
import * as React from "react";
|
|
21
|
+
function Textarea(props) {
|
|
22
|
+
const _context = __spreadValues({}, props["_context"]);
|
|
23
|
+
return /* @__PURE__ */ React.createElement("textarea", __spreadProps(__spreadValues({}, props.attributes), {
|
|
24
|
+
placeholder: props.placeholder,
|
|
25
|
+
name: props.name,
|
|
26
|
+
value: props.value,
|
|
27
|
+
defaultValue: props.defaultValue
|
|
28
|
+
}));
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
Textarea as default
|
|
32
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const serializeFn = (fnValue) => {
|
|
2
|
+
const fnStr = fnValue.toString().trim();
|
|
3
|
+
const appendFunction = !fnStr.startsWith("function") && !fnStr.startsWith("(");
|
|
4
|
+
return `return (${appendFunction ? "function " : ""}${fnStr}).apply(this, arguments)`;
|
|
5
|
+
};
|
|
6
|
+
export {
|
|
7
|
+
serializeFn
|
|
8
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
const componentInfo = {
|
|
2
|
+
name: "Video",
|
|
3
|
+
canHaveChildren: true,
|
|
4
|
+
builtIn: true,
|
|
5
|
+
defaultStyles: {
|
|
6
|
+
minHeight: "20px",
|
|
7
|
+
minWidth: "20px"
|
|
8
|
+
},
|
|
9
|
+
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",
|
|
10
|
+
inputs: [
|
|
11
|
+
{
|
|
12
|
+
name: "video",
|
|
13
|
+
type: "file",
|
|
14
|
+
allowedFileTypes: ["mp4"],
|
|
15
|
+
bubble: true,
|
|
16
|
+
defaultValue: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/assets%2FKQlEmWDxA0coC3PK6UvkrjwkIGI2%2F28cb070609f546cdbe5efa20e931aa4b?alt=media&token=912e9551-7a7c-4dfb-86b6-3da1537d1a7f",
|
|
17
|
+
required: true
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: "posterImage",
|
|
21
|
+
type: "file",
|
|
22
|
+
allowedFileTypes: ["jpeg", "png"],
|
|
23
|
+
helperText: "Image to show before the video plays"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: "autoPlay",
|
|
27
|
+
type: "boolean",
|
|
28
|
+
defaultValue: true
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: "controls",
|
|
32
|
+
type: "boolean",
|
|
33
|
+
defaultValue: false
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: "muted",
|
|
37
|
+
type: "boolean",
|
|
38
|
+
defaultValue: true
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: "loop",
|
|
42
|
+
type: "boolean",
|
|
43
|
+
defaultValue: true
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: "playsInline",
|
|
47
|
+
type: "boolean",
|
|
48
|
+
defaultValue: true
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: "fit",
|
|
52
|
+
type: "text",
|
|
53
|
+
defaultValue: "cover",
|
|
54
|
+
enum: ["contain", "cover", "fill", "auto"]
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: "fitContent",
|
|
58
|
+
type: "boolean",
|
|
59
|
+
helperText: "When child blocks are provided, fit to them instead of using the aspect ratio",
|
|
60
|
+
defaultValue: true,
|
|
61
|
+
advanced: true
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: "position",
|
|
65
|
+
type: "text",
|
|
66
|
+
defaultValue: "center",
|
|
67
|
+
enum: [
|
|
68
|
+
"center",
|
|
69
|
+
"top",
|
|
70
|
+
"left",
|
|
71
|
+
"right",
|
|
72
|
+
"bottom",
|
|
73
|
+
"top left",
|
|
74
|
+
"top right",
|
|
75
|
+
"bottom left",
|
|
76
|
+
"bottom right"
|
|
77
|
+
]
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: "height",
|
|
81
|
+
type: "number",
|
|
82
|
+
advanced: true
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: "width",
|
|
86
|
+
type: "number",
|
|
87
|
+
advanced: true
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
name: "aspectRatio",
|
|
91
|
+
type: "number",
|
|
92
|
+
advanced: true,
|
|
93
|
+
defaultValue: 0.7004048582995948
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: "lazyLoad",
|
|
97
|
+
type: "boolean",
|
|
98
|
+
helperText: 'Load this video "lazily" - as in only when a user scrolls near the video. Recommended for optmized performance and bandwidth consumption',
|
|
99
|
+
defaultValue: true,
|
|
100
|
+
advanced: true
|
|
101
|
+
}
|
|
102
|
+
]
|
|
103
|
+
};
|
|
104
|
+
export {
|
|
105
|
+
componentInfo
|
|
106
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
import * as React from "react";
|
|
21
|
+
function Video(props) {
|
|
22
|
+
var _a;
|
|
23
|
+
const _context = __spreadValues({}, props["_context"]);
|
|
24
|
+
const state = {
|
|
25
|
+
get videoProps() {
|
|
26
|
+
return __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, props.autoPlay === true ? {
|
|
27
|
+
autoPlay: true
|
|
28
|
+
} : {}), props.muted === true ? {
|
|
29
|
+
muted: true
|
|
30
|
+
} : {}), props.controls === true ? {
|
|
31
|
+
controls: true
|
|
32
|
+
} : {}), props.loop === true ? {
|
|
33
|
+
loop: true
|
|
34
|
+
} : {}), props.playsInline === true ? {
|
|
35
|
+
playsInline: true
|
|
36
|
+
} : {});
|
|
37
|
+
},
|
|
38
|
+
get spreadProps() {
|
|
39
|
+
return __spreadValues(__spreadValues({}, props.attributes), state.videoProps);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
return /* @__PURE__ */ React.createElement("video", __spreadProps(__spreadValues({}, state.spreadProps), {
|
|
43
|
+
style: __spreadProps(__spreadValues({
|
|
44
|
+
width: "100%",
|
|
45
|
+
height: "100%"
|
|
46
|
+
}, (_a = props.attributes) == null ? void 0 : _a.style), {
|
|
47
|
+
objectFit: props.fit,
|
|
48
|
+
objectPosition: props.position,
|
|
49
|
+
borderRadius: 1
|
|
50
|
+
}),
|
|
51
|
+
src: props.video || "no-src",
|
|
52
|
+
poster: props.posterImage
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
export {
|
|
56
|
+
Video as default
|
|
57
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
17
|
+
import * as React from "react";
|
|
18
|
+
import {
|
|
19
|
+
getMaxWidthQueryForSize,
|
|
20
|
+
getSizesForBreakpoints
|
|
21
|
+
} from "../../constants/device-sizes.js";
|
|
22
|
+
import { TARGET } from "../../constants/target.js";
|
|
23
|
+
import { getProcessedBlock } from "../../functions/get-processed-block.js";
|
|
24
|
+
import { createCssClass } from "../../helpers/css.js";
|
|
25
|
+
import RenderInlinedStyles from "../render-inlined-styles.js";
|
|
26
|
+
function BlockStyles(props) {
|
|
27
|
+
const _context = __spreadValues({}, props["_context"]);
|
|
28
|
+
const state = {
|
|
29
|
+
get useBlock() {
|
|
30
|
+
return getProcessedBlock({
|
|
31
|
+
block: props.block,
|
|
32
|
+
state: props.context.state,
|
|
33
|
+
context: props.context.context,
|
|
34
|
+
shouldEvaluateBindings: true
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
get css() {
|
|
38
|
+
var _a;
|
|
39
|
+
const styles = state.useBlock.responsiveStyles;
|
|
40
|
+
const content = props.context.content;
|
|
41
|
+
const sizesWithUpdatedBreakpoints = getSizesForBreakpoints(((_a = content == null ? void 0 : content.meta) == null ? void 0 : _a.breakpoints) || {});
|
|
42
|
+
const largeStyles = styles == null ? void 0 : styles.large;
|
|
43
|
+
const mediumStyles = styles == null ? void 0 : styles.medium;
|
|
44
|
+
const smallStyles = styles == null ? void 0 : styles.small;
|
|
45
|
+
const className = state.useBlock.id;
|
|
46
|
+
const largeStylesClass = largeStyles ? createCssClass({
|
|
47
|
+
className,
|
|
48
|
+
styles: largeStyles
|
|
49
|
+
}) : "";
|
|
50
|
+
const mediumStylesClass = mediumStyles ? createCssClass({
|
|
51
|
+
className,
|
|
52
|
+
styles: mediumStyles,
|
|
53
|
+
mediaQuery: getMaxWidthQueryForSize("medium", sizesWithUpdatedBreakpoints)
|
|
54
|
+
}) : "";
|
|
55
|
+
const smallStylesClass = smallStyles ? createCssClass({
|
|
56
|
+
className,
|
|
57
|
+
styles: smallStyles,
|
|
58
|
+
mediaQuery: getMaxWidthQueryForSize("small", sizesWithUpdatedBreakpoints)
|
|
59
|
+
}) : "";
|
|
60
|
+
return [largeStylesClass, mediumStylesClass, smallStylesClass].join(" ");
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, TARGET !== "reactNative" && state.css ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(RenderInlinedStyles, {
|
|
64
|
+
styles: state.css,
|
|
65
|
+
_context
|
|
66
|
+
})) : null);
|
|
67
|
+
}
|
|
68
|
+
export {
|
|
69
|
+
BlockStyles as default
|
|
70
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const EMPTY_HTML_ELEMENTS = [
|
|
2
|
+
"area",
|
|
3
|
+
"base",
|
|
4
|
+
"br",
|
|
5
|
+
"col",
|
|
6
|
+
"embed",
|
|
7
|
+
"hr",
|
|
8
|
+
"img",
|
|
9
|
+
"input",
|
|
10
|
+
"keygen",
|
|
11
|
+
"link",
|
|
12
|
+
"meta",
|
|
13
|
+
"param",
|
|
14
|
+
"source",
|
|
15
|
+
"track",
|
|
16
|
+
"wbr"
|
|
17
|
+
];
|
|
18
|
+
const isEmptyHtmlElement = (tagName) => {
|
|
19
|
+
return typeof tagName === "string" && EMPTY_HTML_ELEMENTS.includes(tagName.toLowerCase());
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
isEmptyHtmlElement
|
|
23
|
+
};
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
32
|
+
import * as React from "react";
|
|
33
|
+
import { getBlockActions } from "../../functions/get-block-actions.js";
|
|
34
|
+
import { getBlockComponentOptions } from "../../functions/get-block-component-options.js";
|
|
35
|
+
import { getBlockProperties } from "../../functions/get-block-properties.js";
|
|
36
|
+
import { getBlockTag } from "../../functions/get-block-tag.js";
|
|
37
|
+
import { getProcessedBlock } from "../../functions/get-processed-block.js";
|
|
38
|
+
import { evaluate } from "../../functions/evaluate.js";
|
|
39
|
+
import BlockStyles from "./block-styles.js";
|
|
40
|
+
import { isEmptyHtmlElement } from "./render-block.helpers.js";
|
|
41
|
+
import RenderRepeatedBlock from "./render-repeated-block.js";
|
|
42
|
+
import { TARGET } from "../../constants/target.js";
|
|
43
|
+
import { extractTextStyles } from "../../functions/extract-text-styles.js";
|
|
44
|
+
import RenderComponentWithContext from "./render-component-with-context.js";
|
|
45
|
+
import RenderComponent from "./render-component.js";
|
|
46
|
+
import { getReactNativeBlockStyles } from "../../functions/get-react-native-block-styles.js";
|
|
47
|
+
function RenderBlock(props) {
|
|
48
|
+
var _a, _b, _c;
|
|
49
|
+
const _context = __spreadValues({}, props["_context"]);
|
|
50
|
+
const state = {
|
|
51
|
+
get component() {
|
|
52
|
+
var _a2;
|
|
53
|
+
const componentName = (_a2 = getProcessedBlock({
|
|
54
|
+
block: props.block,
|
|
55
|
+
state: props.context.state,
|
|
56
|
+
context: props.context.context,
|
|
57
|
+
shouldEvaluateBindings: false
|
|
58
|
+
}).component) == null ? void 0 : _a2.name;
|
|
59
|
+
if (!componentName) {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
const ref = props.context.registeredComponents[componentName];
|
|
63
|
+
if (!ref) {
|
|
64
|
+
console.warn(`
|
|
65
|
+
Could not find a registered component named "${componentName}".
|
|
66
|
+
If you registered it, is the file that registered it imported by the file that needs to render it?`);
|
|
67
|
+
return void 0;
|
|
68
|
+
} else {
|
|
69
|
+
return ref;
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
get tag() {
|
|
73
|
+
return getBlockTag(state.useBlock);
|
|
74
|
+
},
|
|
75
|
+
get useBlock() {
|
|
76
|
+
return state.repeatItemData ? props.block : getProcessedBlock({
|
|
77
|
+
block: props.block,
|
|
78
|
+
state: props.context.state,
|
|
79
|
+
context: props.context.context,
|
|
80
|
+
shouldEvaluateBindings: true
|
|
81
|
+
});
|
|
82
|
+
},
|
|
83
|
+
get actions() {
|
|
84
|
+
return getBlockActions({
|
|
85
|
+
block: state.useBlock,
|
|
86
|
+
state: props.context.state,
|
|
87
|
+
context: props.context.context
|
|
88
|
+
});
|
|
89
|
+
},
|
|
90
|
+
get attributes() {
|
|
91
|
+
return __spreadValues(__spreadValues({}, getBlockProperties(state.useBlock)), TARGET === "reactNative" ? {
|
|
92
|
+
style: getReactNativeBlockStyles({
|
|
93
|
+
block: state.useBlock,
|
|
94
|
+
context: props.context
|
|
95
|
+
})
|
|
96
|
+
} : {});
|
|
97
|
+
},
|
|
98
|
+
get shouldWrap() {
|
|
99
|
+
var _a2;
|
|
100
|
+
return !((_a2 = state.component) == null ? void 0 : _a2.noWrap);
|
|
101
|
+
},
|
|
102
|
+
get renderComponentProps() {
|
|
103
|
+
var _a2;
|
|
104
|
+
return {
|
|
105
|
+
blockChildren: state.useChildren,
|
|
106
|
+
componentRef: (_a2 = state.component) == null ? void 0 : _a2.component,
|
|
107
|
+
componentOptions: __spreadValues(__spreadValues({}, getBlockComponentOptions(state.useBlock)), state.shouldWrap ? {} : {
|
|
108
|
+
attributes: __spreadValues(__spreadValues({}, state.attributes), state.actions)
|
|
109
|
+
}),
|
|
110
|
+
context: state.childrenContext
|
|
111
|
+
};
|
|
112
|
+
},
|
|
113
|
+
get useChildren() {
|
|
114
|
+
var _a2;
|
|
115
|
+
return (_a2 = state.useBlock.children) != null ? _a2 : [];
|
|
116
|
+
},
|
|
117
|
+
get childrenWithoutParentComponent() {
|
|
118
|
+
var _a2;
|
|
119
|
+
const shouldRenderChildrenOutsideRef = !((_a2 = state.component) == null ? void 0 : _a2.component) && !state.repeatItemData;
|
|
120
|
+
return shouldRenderChildrenOutsideRef ? state.useChildren : [];
|
|
121
|
+
},
|
|
122
|
+
get repeatItemData() {
|
|
123
|
+
const _a2 = props.block, { repeat } = _a2, blockWithoutRepeat = __objRest(_a2, ["repeat"]);
|
|
124
|
+
if (!(repeat == null ? void 0 : repeat.collection)) {
|
|
125
|
+
return void 0;
|
|
126
|
+
}
|
|
127
|
+
const itemsArray = evaluate({
|
|
128
|
+
code: repeat.collection,
|
|
129
|
+
state: props.context.state,
|
|
130
|
+
context: props.context.context
|
|
131
|
+
});
|
|
132
|
+
if (!Array.isArray(itemsArray)) {
|
|
133
|
+
return void 0;
|
|
134
|
+
}
|
|
135
|
+
const collectionName = repeat.collection.split(".").pop();
|
|
136
|
+
const itemNameToUse = repeat.itemName || (collectionName ? collectionName + "Item" : "item");
|
|
137
|
+
const repeatArray = itemsArray.map((item, index) => ({
|
|
138
|
+
context: __spreadProps(__spreadValues({}, props.context), {
|
|
139
|
+
state: __spreadProps(__spreadValues({}, props.context.state), {
|
|
140
|
+
$index: index,
|
|
141
|
+
$item: item,
|
|
142
|
+
[itemNameToUse]: item,
|
|
143
|
+
[`$${itemNameToUse}Index`]: index
|
|
144
|
+
})
|
|
145
|
+
}),
|
|
146
|
+
block: blockWithoutRepeat
|
|
147
|
+
}));
|
|
148
|
+
return repeatArray;
|
|
149
|
+
},
|
|
150
|
+
get inheritedTextStyles() {
|
|
151
|
+
if (TARGET !== "reactNative") {
|
|
152
|
+
return {};
|
|
153
|
+
}
|
|
154
|
+
const styles = getReactNativeBlockStyles({
|
|
155
|
+
block: state.useBlock,
|
|
156
|
+
context: props.context
|
|
157
|
+
});
|
|
158
|
+
return extractTextStyles(styles);
|
|
159
|
+
},
|
|
160
|
+
get childrenContext() {
|
|
161
|
+
return {
|
|
162
|
+
apiKey: props.context.apiKey,
|
|
163
|
+
state: props.context.state,
|
|
164
|
+
content: props.context.content,
|
|
165
|
+
context: props.context.context,
|
|
166
|
+
registeredComponents: props.context.registeredComponents,
|
|
167
|
+
inheritedStyles: state.inheritedTextStyles
|
|
168
|
+
};
|
|
169
|
+
},
|
|
170
|
+
get renderComponentTag() {
|
|
171
|
+
if (TARGET === "reactNative") {
|
|
172
|
+
return RenderComponentWithContext;
|
|
173
|
+
} else if (TARGET === "vue3") {
|
|
174
|
+
return "RenderComponent";
|
|
175
|
+
} else {
|
|
176
|
+
return RenderComponent;
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
componentInfo: null
|
|
180
|
+
};
|
|
181
|
+
const RenderComponentTagRef = state.renderComponentTag;
|
|
182
|
+
const TagRef = state.tag;
|
|
183
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, state.shouldWrap ? /* @__PURE__ */ React.createElement(React.Fragment, null, isEmptyHtmlElement(state.tag) ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(TagRef, __spreadValues(__spreadValues({}, state.attributes), state.actions))) : null, !isEmptyHtmlElement(state.tag) && state.repeatItemData ? /* @__PURE__ */ React.createElement(React.Fragment, null, (_a = state.repeatItemData) == null ? void 0 : _a.map((data, index) => /* @__PURE__ */ React.createElement(RenderRepeatedBlock, {
|
|
184
|
+
key: index,
|
|
185
|
+
repeatContext: data.context,
|
|
186
|
+
block: data.block,
|
|
187
|
+
_context
|
|
188
|
+
}))) : null, !isEmptyHtmlElement(state.tag) && !state.repeatItemData ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(TagRef, __spreadValues(__spreadValues({}, state.attributes), state.actions), /* @__PURE__ */ React.createElement(RenderComponentTagRef, __spreadProps(__spreadValues({}, state.renderComponentProps), {
|
|
189
|
+
_context
|
|
190
|
+
})), (_b = state.childrenWithoutParentComponent) == null ? void 0 : _b.map((child) => /* @__PURE__ */ React.createElement(RenderBlock, {
|
|
191
|
+
key: "render-block-" + child.id,
|
|
192
|
+
block: child,
|
|
193
|
+
context: state.childrenContext,
|
|
194
|
+
_context
|
|
195
|
+
})), (_c = state.childrenWithoutParentComponent) == null ? void 0 : _c.map((child) => /* @__PURE__ */ React.createElement(BlockStyles, {
|
|
196
|
+
key: "block-style-" + child.id,
|
|
197
|
+
block: child,
|
|
198
|
+
context: state.childrenContext,
|
|
199
|
+
_context
|
|
200
|
+
})))) : null) : /* @__PURE__ */ React.createElement(RenderComponentTagRef, __spreadProps(__spreadValues({}, state.renderComponentProps), {
|
|
201
|
+
_context
|
|
202
|
+
})));
|
|
203
|
+
}
|
|
204
|
+
export {
|
|
205
|
+
RenderBlock as default
|
|
206
|
+
};
|