@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,15 @@
|
|
|
1
|
+
import { getTopLevelDomain } from "./url.js";
|
|
2
|
+
describe("getTopLevelDomain", () => {
|
|
3
|
+
test("handles root domain", () => {
|
|
4
|
+
const output = getTopLevelDomain("example.com");
|
|
5
|
+
expect(output).toBe("example.com");
|
|
6
|
+
});
|
|
7
|
+
test("handles subdomain", () => {
|
|
8
|
+
const output = getTopLevelDomain("wwww.example.com");
|
|
9
|
+
expect(output).toBe("example.com");
|
|
10
|
+
});
|
|
11
|
+
test("handles subdomain with long suffix", () => {
|
|
12
|
+
const output = getTopLevelDomain("www.example.co.uk");
|
|
13
|
+
expect(output).toBe("example.co.uk");
|
|
14
|
+
});
|
|
15
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
function uuidv4() {
|
|
2
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
|
|
3
|
+
const r = Math.random() * 16 | 0, v = c == "x" ? r : r & 3 | 8;
|
|
4
|
+
return v.toString(16);
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
function uuid() {
|
|
8
|
+
return uuidv4().replace(/-/g, "");
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
uuid,
|
|
12
|
+
uuidv4
|
|
13
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { getLocalStorageItem, setLocalStorageItem } from "./localStorage.js";
|
|
2
|
+
import { checkIsDefined } from "./nullable.js";
|
|
3
|
+
import { uuid } from "./uuid.js";
|
|
4
|
+
const VISITOR_LOCAL_STORAGE_KEY = "builderVisitorId";
|
|
5
|
+
const getVisitorId = ({ canTrack }) => {
|
|
6
|
+
if (!canTrack) {
|
|
7
|
+
return void 0;
|
|
8
|
+
}
|
|
9
|
+
const visitorId = getLocalStorageItem({
|
|
10
|
+
key: VISITOR_LOCAL_STORAGE_KEY,
|
|
11
|
+
canTrack
|
|
12
|
+
});
|
|
13
|
+
if (checkIsDefined(visitorId)) {
|
|
14
|
+
return visitorId;
|
|
15
|
+
} else {
|
|
16
|
+
const newVisitorId = createVisitorId();
|
|
17
|
+
setVisitorId({ id: newVisitorId, canTrack });
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
const createVisitorId = () => uuid();
|
|
21
|
+
const setVisitorId = ({
|
|
22
|
+
id,
|
|
23
|
+
canTrack
|
|
24
|
+
}) => setLocalStorageItem({
|
|
25
|
+
key: VISITOR_LOCAL_STORAGE_KEY,
|
|
26
|
+
value: id,
|
|
27
|
+
canTrack
|
|
28
|
+
});
|
|
29
|
+
export {
|
|
30
|
+
createVisitorId,
|
|
31
|
+
getVisitorId,
|
|
32
|
+
setVisitorId
|
|
33
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { default as default2 } from "../blocks/columns/columns.js";
|
|
2
|
+
import { default as default3 } from "../blocks/image/image.js";
|
|
3
|
+
import { default as default4 } from "../blocks/text/text.js";
|
|
4
|
+
import { default as default5 } from "../blocks/video/video.js";
|
|
5
|
+
import { default as default6 } from "../blocks/symbol/symbol.js";
|
|
6
|
+
import { default as default7 } from "../blocks/button/button.js";
|
|
7
|
+
import { default as default8 } from "../blocks/section/section.js";
|
|
8
|
+
import { default as default9 } from "../blocks/fragment/fragment.js";
|
|
9
|
+
import { default as default10 } from "../components/render-content/render-content.js";
|
|
10
|
+
import { default as default11 } from "../components/render-blocks.js";
|
|
11
|
+
export {
|
|
12
|
+
default7 as Button,
|
|
13
|
+
default2 as Columns,
|
|
14
|
+
default9 as Fragment,
|
|
15
|
+
default3 as Image,
|
|
16
|
+
default11 as RenderBlocks,
|
|
17
|
+
default10 as RenderContent,
|
|
18
|
+
default8 as Section,
|
|
19
|
+
default6 as Symbol,
|
|
20
|
+
default4 as Text,
|
|
21
|
+
default5 as Video
|
|
22
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from "./index-helpers/top-of-file.js";
|
|
2
|
+
import "./scripts/init-editing.js";
|
|
3
|
+
export * from "./index-helpers/blocks-exports.js";
|
|
4
|
+
export * from "./functions/is-editing.js";
|
|
5
|
+
export * from "./functions/is-previewing.js";
|
|
6
|
+
export * from "./functions/register-component.js";
|
|
7
|
+
export * from "./functions/register.js";
|
|
8
|
+
export * from "./functions/set-editor-settings.js";
|
|
9
|
+
export * from "./functions/get-content/index.js";
|
|
10
|
+
export * from "./functions/get-builder-search-params/index.js";
|
|
11
|
+
import { track } from "./functions/track";
|
|
12
|
+
export {
|
|
13
|
+
track
|
|
14
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { TARGET } from "../constants/target.js";
|
|
2
|
+
import { isBrowser } from "../functions/is-browser.js";
|
|
3
|
+
import { register } from "../functions/register.js";
|
|
4
|
+
const registerInsertMenu = () => {
|
|
5
|
+
register("insertMenu", {
|
|
6
|
+
name: "_default",
|
|
7
|
+
default: true,
|
|
8
|
+
items: [
|
|
9
|
+
{ name: "Box" },
|
|
10
|
+
{ name: "Text" },
|
|
11
|
+
{ name: "Image" },
|
|
12
|
+
{ name: "Columns" },
|
|
13
|
+
...TARGET === "reactNative" ? [] : [
|
|
14
|
+
{ name: "Core:Section" },
|
|
15
|
+
{ name: "Core:Button" },
|
|
16
|
+
{ name: "Embed" },
|
|
17
|
+
{ name: "Custom Code" }
|
|
18
|
+
]
|
|
19
|
+
]
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
let isSetupForEditing = false;
|
|
23
|
+
const setupBrowserForEditing = (options = {}) => {
|
|
24
|
+
var _a, _b;
|
|
25
|
+
if (isSetupForEditing) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
isSetupForEditing = true;
|
|
29
|
+
if (isBrowser()) {
|
|
30
|
+
(_a = window.parent) == null ? void 0 : _a.postMessage({
|
|
31
|
+
type: "builder.sdkInfo",
|
|
32
|
+
data: {
|
|
33
|
+
target: TARGET,
|
|
34
|
+
supportsPatchUpdates: false,
|
|
35
|
+
supportsAddBlockScoping: true,
|
|
36
|
+
supportsCustomBreakpoints: true
|
|
37
|
+
}
|
|
38
|
+
}, "*");
|
|
39
|
+
(_b = window.parent) == null ? void 0 : _b.postMessage({
|
|
40
|
+
type: "builder.updateContent",
|
|
41
|
+
data: {
|
|
42
|
+
options
|
|
43
|
+
}
|
|
44
|
+
}, "*");
|
|
45
|
+
window.addEventListener("message", ({ data }) => {
|
|
46
|
+
var _a2, _b2;
|
|
47
|
+
if (!(data == null ? void 0 : data.type)) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
switch (data.type) {
|
|
51
|
+
case "builder.evaluate": {
|
|
52
|
+
const text = data.data.text;
|
|
53
|
+
const args = data.data.arguments || [];
|
|
54
|
+
const id = data.data.id;
|
|
55
|
+
const fn = new Function(text);
|
|
56
|
+
let result;
|
|
57
|
+
let error = null;
|
|
58
|
+
try {
|
|
59
|
+
result = fn.apply(null, args);
|
|
60
|
+
} catch (err) {
|
|
61
|
+
error = err;
|
|
62
|
+
}
|
|
63
|
+
if (error) {
|
|
64
|
+
(_a2 = window.parent) == null ? void 0 : _a2.postMessage({
|
|
65
|
+
type: "builder.evaluateError",
|
|
66
|
+
data: { id, error: error.message }
|
|
67
|
+
}, "*");
|
|
68
|
+
} else {
|
|
69
|
+
if (result && typeof result.then === "function") {
|
|
70
|
+
result.then((finalResult) => {
|
|
71
|
+
var _a3;
|
|
72
|
+
(_a3 = window.parent) == null ? void 0 : _a3.postMessage({
|
|
73
|
+
type: "builder.evaluateResult",
|
|
74
|
+
data: { id, result: finalResult }
|
|
75
|
+
}, "*");
|
|
76
|
+
}).catch(console.error);
|
|
77
|
+
} else {
|
|
78
|
+
(_b2 = window.parent) == null ? void 0 : _b2.postMessage({
|
|
79
|
+
type: "builder.evaluateResult",
|
|
80
|
+
data: { result, id }
|
|
81
|
+
}, "*");
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
export {
|
|
91
|
+
registerInsertMenu,
|
|
92
|
+
setupBrowserForEditing
|
|
93
|
+
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -19,13 +19,14 @@ var __spreadValues = (a, b) => {
|
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
20
|
import * as React from "react";
|
|
21
21
|
function Button(props) {
|
|
22
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, props.link ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("a", __spreadProps(__spreadValues({
|
|
23
|
-
role: "button"
|
|
22
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, props.link ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("a", __spreadProps(__spreadValues({
|
|
23
|
+
role: "button"
|
|
24
|
+
}, props.attributes), {
|
|
24
25
|
href: props.link,
|
|
25
26
|
target: props.openLinkInNewTab ? "_blank" : void 0
|
|
26
|
-
}), props.text)) : /* @__PURE__ */ React.createElement("button",
|
|
27
|
-
className: "button-
|
|
28
|
-
}), props.text), /* @__PURE__ */ React.createElement("style", null, `.button-
|
|
27
|
+
}), props.text)) : /* @__PURE__ */ React.createElement("button", __spreadValues({
|
|
28
|
+
className: "button-7028b0a4"
|
|
29
|
+
}, props.attributes), props.text), /* @__PURE__ */ React.createElement("style", null, `.button-7028b0a4 {
|
|
29
30
|
all: unset; }`));
|
|
30
31
|
}
|
|
31
32
|
export {
|
|
@@ -16,7 +16,6 @@ var __spreadValues = (a, b) => {
|
|
|
16
16
|
};
|
|
17
17
|
import * as React from "react";
|
|
18
18
|
import RenderBlocks from "../../components/render-blocks.jsx";
|
|
19
|
-
import { markMutable } from "../../functions/mark-mutable";
|
|
20
19
|
function Columns(props) {
|
|
21
20
|
var _a;
|
|
22
21
|
function getGutterSize() {
|
|
@@ -58,33 +57,33 @@ function Columns(props) {
|
|
|
58
57
|
};
|
|
59
58
|
}
|
|
60
59
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
|
|
61
|
-
className: "builder-columns div-
|
|
60
|
+
className: "builder-columns div-48253552",
|
|
62
61
|
style: columnsCssVars()
|
|
63
62
|
}, (_a = props.columns) == null ? void 0 : _a.map((column, index) => /* @__PURE__ */ React.createElement("div", {
|
|
64
|
-
className: "builder-column div-
|
|
63
|
+
className: "builder-column div-48253552-2",
|
|
65
64
|
style: __spreadValues({
|
|
66
65
|
width: getColumnCssWidth(index),
|
|
67
66
|
marginLeft: `${index === 0 ? 0 : getGutterSize()}px`
|
|
68
67
|
}, columnCssVars()),
|
|
69
68
|
key: index
|
|
70
69
|
}, /* @__PURE__ */ React.createElement(RenderBlocks, {
|
|
71
|
-
blocks:
|
|
70
|
+
blocks: column.blocks,
|
|
72
71
|
path: `component.options.columns.${index}.blocks`,
|
|
73
72
|
parent: props.builderBlock.id,
|
|
74
73
|
styleProp: {
|
|
75
74
|
flexGrow: "1"
|
|
76
75
|
}
|
|
77
|
-
})))), /* @__PURE__ */ React.createElement("style", null, `.div-
|
|
76
|
+
})))), /* @__PURE__ */ React.createElement("style", null, `.div-48253552 {
|
|
78
77
|
display: flex;
|
|
79
78
|
align-items: stretch;
|
|
80
|
-
line-height: normal; }@media (max-width: 991px) { .div-
|
|
81
|
-
flex-direction: var(--flex-dir-tablet); } }@media (max-width: 639px) { .div-
|
|
82
|
-
flex-direction: var(--flex-dir); } }.div-
|
|
79
|
+
line-height: normal; }@media (max-width: 991px) { .div-48253552 {
|
|
80
|
+
flex-direction: var(--flex-dir-tablet); } }@media (max-width: 639px) { .div-48253552 {
|
|
81
|
+
flex-direction: var(--flex-dir); } }.div-48253552-2 {
|
|
83
82
|
display: flex;
|
|
84
83
|
flex-direction: column;
|
|
85
|
-
align-items: stretch; }@media (max-width: 991px) { .div-
|
|
84
|
+
align-items: stretch; }@media (max-width: 991px) { .div-48253552-2 {
|
|
86
85
|
width: var(--column-width-tablet) !important;
|
|
87
|
-
margin-left: var(--column-margin-left-tablet) !important; } }@media (max-width: 639px) { .div-
|
|
86
|
+
margin-left: var(--column-margin-left-tablet) !important; } }@media (max-width: 639px) { .div-48253552-2 {
|
|
88
87
|
width: var(--column-width) !important;
|
|
89
88
|
margin-left: var(--column-margin-left) !important; } }`));
|
|
90
89
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { serializeFn } from "../util.js";
|
|
2
2
|
const componentInfo = {
|
|
3
3
|
name: "Columns",
|
|
4
4
|
builtIn: true,
|
|
@@ -187,7 +187,7 @@ const componentInfo = {
|
|
|
187
187
|
]
|
|
188
188
|
}
|
|
189
189
|
],
|
|
190
|
-
onChange:
|
|
190
|
+
onChange: serializeFn((options) => {
|
|
191
191
|
function clearWidths() {
|
|
192
192
|
columns.forEach((col) => {
|
|
193
193
|
col.delete("width");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { serializeFn } from "../util.js";
|
|
2
2
|
const componentInfo = {
|
|
3
3
|
name: "Embed",
|
|
4
4
|
static: true,
|
|
@@ -10,7 +10,7 @@ const componentInfo = {
|
|
|
10
10
|
required: true,
|
|
11
11
|
defaultValue: "",
|
|
12
12
|
helperText: "e.g. enter a youtube url, google map, etc",
|
|
13
|
-
onChange:
|
|
13
|
+
onChange: serializeFn((options) => {
|
|
14
14
|
const url = options.get("url");
|
|
15
15
|
if (url) {
|
|
16
16
|
options.set("content", "Loading...");
|
package/src/blocks/form/form.jsx
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
2
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
3
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
4
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
@@ -16,7 +14,6 @@ var __spreadValues = (a, b) => {
|
|
|
16
14
|
}
|
|
17
15
|
return a;
|
|
18
16
|
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
17
|
var __async = (__this, __arguments, generator) => {
|
|
21
18
|
return new Promise((resolve, reject) => {
|
|
22
19
|
var fulfilled = (value) => {
|
|
@@ -192,14 +189,14 @@ function FormComponent(props) {
|
|
|
192
189
|
}
|
|
193
190
|
}
|
|
194
191
|
const builderContext = useContext(BuilderContext);
|
|
195
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, " ", /* @__PURE__ */ React.createElement("form",
|
|
192
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, " ", /* @__PURE__ */ React.createElement("form", __spreadValues({
|
|
196
193
|
validate: props.validate,
|
|
197
194
|
ref: formRef,
|
|
198
195
|
action: !props.sendWithJs && props.action,
|
|
199
196
|
method: props.method,
|
|
200
197
|
name: props.name,
|
|
201
198
|
onSubmit: (event) => onSubmit(event)
|
|
202
|
-
}), " ", props.builderBlock && props.builderBlock.children ? /* @__PURE__ */ React.createElement(React.Fragment, null, (_b = (_a = props.builderBlock) == null ? void 0 : _a.children) == null ? void 0 : _b.map((block) => /* @__PURE__ */ React.createElement(RenderBlock, {
|
|
199
|
+
}, props.attributes), " ", props.builderBlock && props.builderBlock.children ? /* @__PURE__ */ React.createElement(React.Fragment, null, (_b = (_a = props.builderBlock) == null ? void 0 : _a.children) == null ? void 0 : _b.map((block) => /* @__PURE__ */ React.createElement(RenderBlock, {
|
|
203
200
|
block,
|
|
204
201
|
context: builderContext
|
|
205
202
|
}))) : null, " ", submissionState() === "error" ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(BuilderBlocks, {
|
|
@@ -209,11 +206,11 @@ function FormComponent(props) {
|
|
|
209
206
|
dataPath: "sendingMessage",
|
|
210
207
|
blocks: props.sendingMessage
|
|
211
208
|
})) : null, " ", submissionState() === "error" && responseData ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("pre", {
|
|
212
|
-
className: "builder-form-error-text pre-
|
|
209
|
+
className: "builder-form-error-text pre-bdd3175a"
|
|
213
210
|
}, " ", JSON.stringify(responseData, null, 2), " ")) : null, " ", submissionState() === "success" ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(BuilderBlocks, {
|
|
214
211
|
dataPath: "successMessage",
|
|
215
212
|
blocks: props.successMessage
|
|
216
|
-
})) : null, " "), " ", /* @__PURE__ */ React.createElement("style", null, `.pre-
|
|
213
|
+
})) : null, " "), " ", /* @__PURE__ */ React.createElement("style", null, `.pre-bdd3175a { padding: 10px; color: red; text-align: center; }`), " ");
|
|
217
214
|
}
|
|
218
215
|
export {
|
|
219
216
|
FormComponent as default
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { serializeFn } from "../util.js";
|
|
2
2
|
const componentInfo = {
|
|
3
3
|
name: "Image",
|
|
4
4
|
static: true,
|
|
@@ -19,7 +19,7 @@ const componentInfo = {
|
|
|
19
19
|
allowedFileTypes: ["jpeg", "jpg", "png", "svg"],
|
|
20
20
|
required: true,
|
|
21
21
|
defaultValue: "https://cdn.builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
|
|
22
|
-
onChange:
|
|
22
|
+
onChange: serializeFn((options) => {
|
|
23
23
|
const DEFAULT_ASPECT_RATIO = 0.7041;
|
|
24
24
|
options.delete("srcset");
|
|
25
25
|
options.delete("noWebp");
|
|
@@ -1,3 +1,19 @@
|
|
|
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
|
+
};
|
|
1
17
|
import * as React from "react";
|
|
2
18
|
import { getSrcSet } from "./image.helpers.js";
|
|
3
19
|
function Image(props) {
|
|
@@ -27,6 +43,17 @@ function Image(props) {
|
|
|
27
43
|
return "";
|
|
28
44
|
}
|
|
29
45
|
}
|
|
46
|
+
function aspectRatioCss() {
|
|
47
|
+
const aspectRatioStyles = {
|
|
48
|
+
position: "absolute",
|
|
49
|
+
height: "100%",
|
|
50
|
+
width: "100%",
|
|
51
|
+
left: "0px",
|
|
52
|
+
top: "0px"
|
|
53
|
+
};
|
|
54
|
+
const out = props.aspectRatio ? aspectRatioStyles : void 0;
|
|
55
|
+
return out;
|
|
56
|
+
}
|
|
30
57
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("picture", null, webpSrcSet() ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("source", {
|
|
31
58
|
type: "image/webp",
|
|
32
59
|
srcSet: webpSrcSet()
|
|
@@ -34,34 +61,29 @@ function Image(props) {
|
|
|
34
61
|
loading: "lazy",
|
|
35
62
|
alt: props.altText,
|
|
36
63
|
role: props.altText ? "presentation" : void 0,
|
|
37
|
-
style: {
|
|
38
|
-
objectPosition: props.
|
|
64
|
+
style: __spreadValues({
|
|
65
|
+
objectPosition: props.backgroundPosition || "center",
|
|
39
66
|
objectFit: props.backgroundSize || "cover"
|
|
40
|
-
},
|
|
41
|
-
className: "builder-image" + (props.className ? " " + props.className : "") + " img-
|
|
67
|
+
}, aspectRatioCss()),
|
|
68
|
+
className: "builder-image" + (props.className ? " " + props.className : "") + " img-35d6dc22",
|
|
42
69
|
src: props.image,
|
|
43
70
|
srcSet: srcSetToUse(),
|
|
44
71
|
sizes: props.sizes
|
|
45
72
|
}), /* @__PURE__ */ React.createElement("source", {
|
|
46
73
|
srcSet: srcSetToUse()
|
|
47
74
|
})), props.aspectRatio && !(((_b = (_a = props.builderBlock) == null ? void 0 : _a.children) == null ? void 0 : _b.length) && props.fitContent) ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
|
|
48
|
-
className: "builder-image-sizer div-
|
|
75
|
+
className: "builder-image-sizer div-35d6dc22",
|
|
49
76
|
style: {
|
|
50
77
|
paddingTop: props.aspectRatio * 100 + "%"
|
|
51
78
|
}
|
|
52
79
|
})) : null, ((_d = (_c = props.builderBlock) == null ? void 0 : _c.children) == null ? void 0 : _d.length) && props.fitContent ? /* @__PURE__ */ React.createElement(React.Fragment, null, props.children) : null, !props.fitContent && props.children ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
|
|
53
|
-
className: "div-
|
|
54
|
-
}, props.children)) : null), /* @__PURE__ */ React.createElement("style", null, `.img-
|
|
80
|
+
className: "div-35d6dc22-2"
|
|
81
|
+
}, props.children)) : null), /* @__PURE__ */ React.createElement("style", null, `.img-35d6dc22 {
|
|
55
82
|
opacity: 1;
|
|
56
|
-
transition: opacity 0.2s ease-in-out;
|
|
57
|
-
position: absolute;
|
|
58
|
-
height: 100%;
|
|
59
|
-
width: 100%;
|
|
60
|
-
top: 0px;
|
|
61
|
-
left: 0px; }.div-6cfc0cdc {
|
|
83
|
+
transition: opacity 0.2s ease-in-out; }.div-35d6dc22 {
|
|
62
84
|
width: 100%;
|
|
63
85
|
pointer-events: none;
|
|
64
|
-
font-size: 0; }.div-
|
|
86
|
+
font-size: 0; }.div-35d6dc22-2 {
|
|
65
87
|
display: flex;
|
|
66
88
|
flex-direction: column;
|
|
67
89
|
align-items: stretch;
|
package/src/blocks/img/img.jsx
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
2
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
3
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
4
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
@@ -16,11 +14,10 @@ var __spreadValues = (a, b) => {
|
|
|
16
14
|
}
|
|
17
15
|
return a;
|
|
18
16
|
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
17
|
import * as React from "react";
|
|
21
18
|
import { isEditing } from "../../functions/is-editing.js";
|
|
22
19
|
function ImgComponent(props) {
|
|
23
|
-
return /* @__PURE__ */ React.createElement("img",
|
|
20
|
+
return /* @__PURE__ */ React.createElement("img", __spreadValues({
|
|
24
21
|
style: {
|
|
25
22
|
objectFit: props.backgroundSize || "cover",
|
|
26
23
|
objectPosition: props.backgroundPosition || "center"
|
|
@@ -28,7 +25,7 @@ function ImgComponent(props) {
|
|
|
28
25
|
key: isEditing() && props.imgSrc || "default-key",
|
|
29
26
|
alt: props.altText,
|
|
30
27
|
src: props.imgSrc || props.image
|
|
31
|
-
}));
|
|
28
|
+
}, props.attributes));
|
|
32
29
|
}
|
|
33
30
|
export {
|
|
34
31
|
ImgComponent as default
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
2
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
3
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
4
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
@@ -16,12 +14,11 @@ var __spreadValues = (a, b) => {
|
|
|
16
14
|
}
|
|
17
15
|
return a;
|
|
18
16
|
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
17
|
import * as React from "react";
|
|
21
18
|
function SubmitButton(props) {
|
|
22
|
-
return /* @__PURE__ */ React.createElement("button",
|
|
19
|
+
return /* @__PURE__ */ React.createElement("button", __spreadValues({
|
|
23
20
|
type: "submit"
|
|
24
|
-
}), props.text);
|
|
21
|
+
}, props.attributes), props.text);
|
|
25
22
|
}
|
|
26
23
|
export {
|
|
27
24
|
SubmitButton as default
|
|
@@ -22,7 +22,6 @@ import { useState, useContext, useEffect } from "react";
|
|
|
22
22
|
import RenderContent from "../../components/render-content/render-content.jsx";
|
|
23
23
|
import BuilderContext from "../../context/builder.context.js";
|
|
24
24
|
import { getContent } from "../../functions/get-content/index.js";
|
|
25
|
-
import { markMutable } from "../../functions/mark-mutable";
|
|
26
25
|
function Symbol(props) {
|
|
27
26
|
var _a, _b, _c, _d, _e;
|
|
28
27
|
const [className, setClassName] = useState(() => "builder-symbol");
|
|
@@ -54,10 +53,10 @@ function Symbol(props) {
|
|
|
54
53
|
}), /* @__PURE__ */ React.createElement(RenderContent, {
|
|
55
54
|
apiKey: builderContext.apiKey,
|
|
56
55
|
context: builderContext.context,
|
|
57
|
-
customComponents:
|
|
58
|
-
data:
|
|
56
|
+
customComponents: Object.values(builderContext.registeredComponents),
|
|
57
|
+
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),
|
|
59
58
|
model: (_e = props.symbol) == null ? void 0 : _e.model,
|
|
60
|
-
content:
|
|
59
|
+
content: contentToUse()
|
|
61
60
|
}));
|
|
62
61
|
}
|
|
63
62
|
export {
|
package/src/blocks/util.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
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
|
+
};
|
|
5
6
|
export {
|
|
6
|
-
|
|
7
|
+
serializeFn
|
|
7
8
|
};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
getMaxWidthQueryForSize,
|
|
4
|
+
getSizesForBreakpoints
|
|
5
|
+
} from "../../constants/device-sizes.js";
|
|
3
6
|
import { TARGET } from "../../constants/target.js";
|
|
4
7
|
import { getProcessedBlock } from "../../functions/get-processed-block.js";
|
|
5
8
|
import { createCssClass } from "../../helpers/css.js";
|
|
@@ -14,7 +17,10 @@ function BlockStyles(props) {
|
|
|
14
17
|
});
|
|
15
18
|
}
|
|
16
19
|
function css() {
|
|
20
|
+
var _a;
|
|
17
21
|
const styles = useBlock().responsiveStyles;
|
|
22
|
+
const content = props.context.content;
|
|
23
|
+
const sizesWithUpdatedBreakpoints = getSizesForBreakpoints(((_a = content == null ? void 0 : content.meta) == null ? void 0 : _a.breakpoints) || {});
|
|
18
24
|
const largeStyles = styles == null ? void 0 : styles.large;
|
|
19
25
|
const mediumStyles = styles == null ? void 0 : styles.medium;
|
|
20
26
|
const smallStyles = styles == null ? void 0 : styles.small;
|
|
@@ -26,12 +32,12 @@ function BlockStyles(props) {
|
|
|
26
32
|
const mediumStylesClass = mediumStyles ? createCssClass({
|
|
27
33
|
className,
|
|
28
34
|
styles: mediumStyles,
|
|
29
|
-
mediaQuery: getMaxWidthQueryForSize("medium")
|
|
35
|
+
mediaQuery: getMaxWidthQueryForSize("medium", sizesWithUpdatedBreakpoints)
|
|
30
36
|
}) : "";
|
|
31
37
|
const smallStylesClass = smallStyles ? createCssClass({
|
|
32
38
|
className,
|
|
33
39
|
styles: smallStyles,
|
|
34
|
-
mediaQuery: getMaxWidthQueryForSize("small")
|
|
40
|
+
mediaQuery: getMaxWidthQueryForSize("small", sizesWithUpdatedBreakpoints)
|
|
35
41
|
}) : "";
|
|
36
42
|
return [largeStylesClass, mediumStylesClass, smallStylesClass].join(" ");
|
|
37
43
|
}
|