@builder.io/sdk-react 0.1.3 → 0.1.5
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/react/blocks/button/button.js +2 -2
- package/dist/react/blocks/columns/columns.js +6 -6
- package/dist/react/blocks/form/form.js +4 -4
- package/dist/react/blocks/image/image.js +6 -6
- package/dist/react/blocks/symbol/symbol.js +1 -1
- package/dist/react/components/render-block/block-styles.js +1 -1
- package/dist/react/components/render-block/render-block.js +21 -4
- package/dist/react/components/render-block/render-component.js +2 -2
- package/dist/react/components/render-block/render-repeated-block.js +2 -1
- package/dist/react/components/render-blocks.js +4 -4
- package/dist/react/components/render-content/components/render-styles.helpers.js +51 -0
- package/dist/react/components/render-content/components/render-styles.js +13 -55
- package/dist/react/components/render-content/index.js +1 -1
- package/dist/react/components/render-content/render-content.helpers.js +38 -0
- package/dist/react/components/render-content/render-content.js +67 -64
- package/dist/react/components/render-content/render-content.types.js +1 -0
- package/dist/react/components/render-inlined-styles.js +2 -2
- package/dist/react/constants/builder-registered-components.js +18 -18
- package/dist/react/context/builder.context.js +2 -0
- package/dist/react/index-helpers/blocks-exports.js +11 -11
- package/dist/react/types/input.js +1 -0
- package/dist/rsc/blocks/button/button.js +2 -2
- package/dist/rsc/blocks/columns/columns.js +6 -6
- package/dist/rsc/blocks/form/form.js +4 -4
- package/dist/rsc/blocks/image/image.js +6 -6
- package/dist/rsc/blocks/symbol/symbol.js +1 -1
- package/dist/rsc/components/render-block/block-styles.js +1 -1
- package/dist/rsc/components/render-block/render-block.js +21 -4
- package/dist/rsc/components/render-block/render-component.js +2 -2
- package/dist/rsc/components/render-block/render-repeated-block.js +2 -1
- package/dist/rsc/components/render-blocks.js +4 -4
- package/dist/rsc/components/render-content/builder-editing.js +47 -4
- package/dist/rsc/components/render-content/components/render-styles.helpers.js +51 -0
- package/dist/rsc/components/render-content/components/render-styles.js +12 -55
- package/dist/rsc/components/render-content/index.js +1 -1
- package/dist/rsc/components/render-content/render-content.helpers.js +38 -0
- package/dist/rsc/components/render-content/render-content.js +45 -40
- package/dist/rsc/components/render-content/render-content.types.js +1 -0
- package/dist/rsc/components/render-inlined-styles.js +2 -2
- package/dist/rsc/constants/builder-registered-components.js +18 -18
- package/dist/rsc/context/builder.context.js +2 -0
- package/dist/rsc/index-helpers/blocks-exports.js +11 -11
- package/dist/rsc/types/input.js +1 -0
- package/package.json +1 -1
- package/packages/react/src/blocks/button/button.jsx +2 -2
- package/packages/react/src/blocks/columns/columns.jsx +6 -6
- package/packages/react/src/blocks/form/form.jsx +4 -4
- package/packages/react/src/blocks/image/image.jsx +6 -6
- package/packages/react/src/blocks/symbol/symbol.jsx +1 -1
- package/packages/react/src/components/render-block/block-styles.jsx +1 -1
- package/packages/react/src/components/render-block/render-block.jsx +25 -4
- package/packages/react/src/components/render-block/render-component.jsx +2 -2
- package/packages/react/src/components/render-block/render-repeated-block.jsx +2 -1
- package/packages/react/src/components/render-blocks.jsx +4 -4
- package/packages/react/src/components/render-content/components/render-styles.helpers.js +57 -0
- package/packages/react/src/components/render-content/components/render-styles.jsx +14 -57
- package/packages/react/src/components/render-content/index.js +1 -1
- package/packages/react/src/components/render-content/render-content.helpers.js +48 -0
- package/packages/react/src/components/render-content/render-content.jsx +78 -69
- package/packages/{_rsc/src/components/render-block/types.js → react/src/components/render-content/render-content.types.js} +0 -0
- package/packages/react/src/components/render-inlined-styles.jsx +2 -2
- package/packages/react/src/constants/builder-registered-components.js +18 -18
- package/packages/react/src/context/builder.context.js +2 -0
- package/packages/react/src/index-helpers/blocks-exports.js +19 -19
- package/packages/{_rsc/src/context/types.js → react/src/types/input.js} +0 -0
- package/packages/rsc/src/blocks/button/button.jsx +2 -2
- package/packages/rsc/src/blocks/columns/columns.jsx +6 -6
- package/packages/rsc/src/blocks/form/form.jsx +4 -4
- package/packages/rsc/src/blocks/image/image.jsx +6 -6
- package/packages/rsc/src/blocks/symbol/symbol.jsx +1 -1
- package/packages/rsc/src/components/render-block/block-styles.jsx +1 -1
- package/packages/rsc/src/components/render-block/render-block.jsx +24 -4
- package/packages/rsc/src/components/render-block/render-component.jsx +2 -2
- package/packages/rsc/src/components/render-block/render-repeated-block.jsx +2 -1
- package/packages/rsc/src/components/render-blocks.jsx +4 -4
- package/packages/rsc/src/components/render-content/builder-editing.jsx +61 -4
- package/packages/rsc/src/components/render-content/components/render-styles.helpers.js +57 -0
- package/packages/rsc/src/components/render-content/components/render-styles.jsx +11 -57
- package/packages/rsc/src/components/render-content/index.js +1 -1
- package/packages/rsc/src/components/render-content/render-content.helpers.js +48 -0
- package/packages/rsc/src/components/render-content/render-content.jsx +48 -39
- package/packages/{_rsc/src/functions/get-content/types.js → rsc/src/components/render-content/render-content.types.js} +0 -0
- package/packages/rsc/src/components/render-inlined-styles.jsx +2 -4
- package/packages/rsc/src/constants/builder-registered-components.js +18 -18
- package/packages/rsc/src/context/builder.context.js +2 -0
- package/packages/rsc/src/index-helpers/blocks-exports.js +19 -19
- package/packages/{_rsc/src/types/builder-block.js → rsc/src/types/input.js} +0 -0
- package/packages/_rsc/src/blocks/BaseText.jsx +0 -10
- package/packages/_rsc/src/blocks/button/button.jsx +0 -29
- package/packages/_rsc/src/blocks/button/component-info.js +0 -41
- package/packages/_rsc/src/blocks/columns/columns.jsx +0 -172
- package/packages/_rsc/src/blocks/columns/component-info.js +0 -242
- package/packages/_rsc/src/blocks/custom-code/component-info.js +0 -31
- package/packages/_rsc/src/blocks/custom-code/custom-code.jsx +0 -55
- package/packages/_rsc/src/blocks/embed/component-info.js +0 -44
- package/packages/_rsc/src/blocks/embed/embed.jsx +0 -43
- package/packages/_rsc/src/blocks/embed/helpers.js +0 -9
- package/packages/_rsc/src/blocks/form/component-info.js +0 -262
- package/packages/_rsc/src/blocks/form/form.jsx +0 -259
- package/packages/_rsc/src/blocks/fragment/component-info.js +0 -11
- package/packages/_rsc/src/blocks/fragment/fragment.jsx +0 -7
- package/packages/_rsc/src/blocks/image/component-info.js +0 -151
- package/packages/_rsc/src/blocks/image/image.helpers.js +0 -48
- package/packages/_rsc/src/blocks/image/image.jsx +0 -124
- package/packages/_rsc/src/blocks/img/component-info.js +0 -20
- package/packages/_rsc/src/blocks/img/img.jsx +0 -19
- package/packages/_rsc/src/blocks/input/component-info.js +0 -74
- package/packages/_rsc/src/blocks/input/input.jsx +0 -21
- package/packages/_rsc/src/blocks/raw-text/component-info.js +0 -16
- package/packages/_rsc/src/blocks/raw-text/raw-text.jsx +0 -12
- package/packages/_rsc/src/blocks/section/component-info.js +0 -49
- package/packages/_rsc/src/blocks/section/section.jsx +0 -29
- package/packages/_rsc/src/blocks/select/component-info.js +0 -59
- package/packages/_rsc/src/blocks/select/select.jsx +0 -22
- package/packages/_rsc/src/blocks/submit-button/component-info.js +0 -28
- package/packages/_rsc/src/blocks/submit-button/submit-button.jsx +0 -11
- package/packages/_rsc/src/blocks/symbol/component-info.js +0 -43
- package/packages/_rsc/src/blocks/symbol/symbol.jsx +0 -56
- package/packages/_rsc/src/blocks/text/component-info.js +0 -24
- package/packages/_rsc/src/blocks/text/text.jsx +0 -12
- package/packages/_rsc/src/blocks/textarea/component-info.js +0 -47
- package/packages/_rsc/src/blocks/textarea/textarea.jsx +0 -15
- package/packages/_rsc/src/blocks/util.js +0 -8
- package/packages/_rsc/src/blocks/video/component-info.js +0 -106
- package/packages/_rsc/src/blocks/video/video.jsx +0 -61
- package/packages/_rsc/src/components/render-block/block-styles.jsx +0 -72
- package/packages/_rsc/src/components/render-block/render-block.helpers.js +0 -23
- package/packages/_rsc/src/components/render-block/render-block.jsx +0 -251
- package/packages/_rsc/src/components/render-block/render-component-with-context.jsx +0 -38
- package/packages/_rsc/src/components/render-block/render-component.jsx +0 -37
- package/packages/_rsc/src/components/render-block/render-repeated-block.jsx +0 -36
- package/packages/_rsc/src/components/render-blocks.jsx +0 -90
- package/packages/_rsc/src/components/render-content/builder-editing.jsx +0 -7
- package/packages/_rsc/src/components/render-content/components/render-styles.jsx +0 -70
- package/packages/_rsc/src/components/render-content/index.js +0 -4
- package/packages/_rsc/src/components/render-content/render-content.jsx +0 -259
- package/packages/_rsc/src/components/render-inlined-styles.jsx +0 -33
- package/packages/_rsc/src/constants/builder-registered-components.js +0 -54
- package/packages/_rsc/src/constants/device-sizes.js +0 -48
- package/packages/_rsc/src/constants/target.js +0 -4
- package/packages/_rsc/src/context/builder.context.js +0 -11
- package/packages/_rsc/src/functions/camel-to-kebab-case.js +0 -4
- package/packages/_rsc/src/functions/evaluate.js +0 -6
- package/packages/_rsc/src/functions/event-handler-name.js +0 -7
- package/packages/_rsc/src/functions/extract-text-styles.js +0 -22
- package/packages/_rsc/src/functions/fast-clone.js +0 -4
- package/packages/_rsc/src/functions/get-block-actions-handler.js +0 -11
- package/packages/_rsc/src/functions/get-block-actions.js +0 -18
- package/packages/_rsc/src/functions/get-block-component-options.js +0 -28
- package/packages/_rsc/src/functions/get-block-properties.js +0 -50
- package/packages/_rsc/src/functions/get-block-tag.js +0 -6
- package/packages/_rsc/src/functions/get-builder-search-params/fn.test.js +0 -13
- package/packages/_rsc/src/functions/get-builder-search-params/index.js +0 -38
- package/packages/_rsc/src/functions/get-content/ab-testing.js +0 -99
- package/packages/_rsc/src/functions/get-content/generate-content-url.js +0 -55
- package/packages/_rsc/src/functions/get-content/generate-content-url.test.js +0 -31
- package/packages/_rsc/src/functions/get-content/index.js +0 -65
- package/packages/_rsc/src/functions/get-fetch.js +0 -14
- package/packages/_rsc/src/functions/get-global-this.js +0 -18
- package/packages/_rsc/src/functions/get-processed-block.js +0 -59
- package/packages/_rsc/src/functions/get-processed-block.test.js +0 -32
- package/packages/_rsc/src/functions/get-react-native-block-styles.js +0 -33
- package/packages/_rsc/src/functions/if-target.js +0 -15
- package/packages/_rsc/src/functions/is-browser.js +0 -6
- package/packages/_rsc/src/functions/is-editing.js +0 -7
- package/packages/_rsc/src/functions/is-iframe.js +0 -7
- package/packages/_rsc/src/functions/is-previewing.js +0 -14
- package/packages/_rsc/src/functions/on-change.js +0 -27
- package/packages/_rsc/src/functions/on-change.test.js +0 -19
- package/packages/_rsc/src/functions/register-component.js +0 -68
- package/packages/_rsc/src/functions/register.js +0 -29
- package/packages/_rsc/src/functions/sanitize-react-native-block-styles.js +0 -66
- package/packages/_rsc/src/functions/set-editor-settings.js +0 -15
- package/packages/_rsc/src/functions/set.js +0 -11
- package/packages/_rsc/src/functions/set.test.js +0 -16
- package/packages/_rsc/src/functions/track.js +0 -124
- package/packages/_rsc/src/functions/transform-block-properties.js +0 -6
- package/packages/_rsc/src/functions/transform-block.js +0 -6
- package/packages/_rsc/src/helpers/ab-tests.js +0 -16
- package/packages/_rsc/src/helpers/cookie.js +0 -81
- package/packages/_rsc/src/helpers/css.js +0 -34
- package/packages/_rsc/src/helpers/flatten.js +0 -34
- package/packages/_rsc/src/helpers/localStorage.js +0 -35
- package/packages/_rsc/src/helpers/nullable.js +0 -4
- package/packages/_rsc/src/helpers/sessionId.js +0 -52
- package/packages/_rsc/src/helpers/time.js +0 -5
- package/packages/_rsc/src/helpers/url.js +0 -13
- package/packages/_rsc/src/helpers/url.test.js +0 -21
- package/packages/_rsc/src/helpers/uuid.js +0 -13
- package/packages/_rsc/src/helpers/visitorId.js +0 -34
- package/packages/_rsc/src/index-helpers/blocks-exports.js +0 -22
- package/packages/_rsc/src/index-helpers/top-of-file.js +0 -2
- package/packages/_rsc/src/index.js +0 -14
- package/packages/_rsc/src/scripts/init-editing.js +0 -93
- 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
|
@@ -14,40 +14,40 @@ var __spreadValues = (a, b) => {
|
|
|
14
14
|
}
|
|
15
15
|
return a;
|
|
16
16
|
};
|
|
17
|
-
import { default as Button } from "../blocks/button/button
|
|
17
|
+
import { default as Button } from "../blocks/button/button";
|
|
18
18
|
import { componentInfo as buttonComponentInfo } from "../blocks/button/component-info.js";
|
|
19
|
-
import { default as Columns } from "../blocks/columns/columns
|
|
19
|
+
import { default as Columns } from "../blocks/columns/columns";
|
|
20
20
|
import { componentInfo as columnsComponentInfo } from "../blocks/columns/component-info.js";
|
|
21
21
|
import { componentInfo as fragmentComponentInfo } from "../blocks/fragment/component-info.js";
|
|
22
|
-
import { default as Fragment } from "../blocks/fragment/fragment
|
|
22
|
+
import { default as Fragment } from "../blocks/fragment/fragment";
|
|
23
23
|
import { componentInfo as imageComponentInfo } from "../blocks/image/component-info.js";
|
|
24
|
-
import { default as Image } from "../blocks/image/image
|
|
24
|
+
import { default as Image } from "../blocks/image/image";
|
|
25
25
|
import { componentInfo as sectionComponentInfo } from "../blocks/section/component-info.js";
|
|
26
|
-
import { default as Section } from "../blocks/section/section
|
|
26
|
+
import { default as Section } from "../blocks/section/section";
|
|
27
27
|
import { componentInfo as symbolComponentInfo } from "../blocks/symbol/component-info.js";
|
|
28
|
-
import { default as Symbol } from "../blocks/symbol/symbol
|
|
28
|
+
import { default as Symbol } from "../blocks/symbol/symbol";
|
|
29
29
|
import { componentInfo as textComponentInfo } from "../blocks/text/component-info.js";
|
|
30
|
-
import { default as Text } from "../blocks/text/text
|
|
30
|
+
import { default as Text } from "../blocks/text/text";
|
|
31
31
|
import { componentInfo as videoComponentInfo } from "../blocks/video/component-info.js";
|
|
32
|
-
import { default as Video } from "../blocks/video/video
|
|
32
|
+
import { default as Video } from "../blocks/video/video";
|
|
33
33
|
import { componentInfo as embedComponentInfo } from "../blocks/embed/component-info.js";
|
|
34
|
-
import { default as embed } from "../blocks/embed/embed
|
|
35
|
-
import { default as Img } from "../blocks/img/img
|
|
34
|
+
import { default as embed } from "../blocks/embed/embed";
|
|
35
|
+
import { default as Img } from "../blocks/img/img";
|
|
36
36
|
import { componentInfo as imgComponentInfo } from "../blocks/img/component-info.js";
|
|
37
|
-
import { default as customCode } from "../blocks/custom-code/custom-code
|
|
37
|
+
import { default as customCode } from "../blocks/custom-code/custom-code";
|
|
38
38
|
import { componentInfo as customCodeInfo } from "../blocks/custom-code/component-info.js";
|
|
39
39
|
const getDefaultRegisteredComponents = () => [
|
|
40
|
+
__spreadValues({ component: Button }, buttonComponentInfo),
|
|
40
41
|
__spreadValues({ component: Columns }, columnsComponentInfo),
|
|
42
|
+
__spreadValues({ component: customCode }, customCodeInfo),
|
|
43
|
+
__spreadValues({ component: embed }, embedComponentInfo),
|
|
44
|
+
__spreadValues({ component: Fragment }, fragmentComponentInfo),
|
|
41
45
|
__spreadValues({ component: Image }, imageComponentInfo),
|
|
42
46
|
__spreadValues({ component: Img }, imgComponentInfo),
|
|
43
|
-
__spreadValues({ component: Text }, textComponentInfo),
|
|
44
|
-
__spreadValues({ component: Video }, videoComponentInfo),
|
|
45
|
-
__spreadValues({ component: Symbol }, symbolComponentInfo),
|
|
46
|
-
__spreadValues({ component: Button }, buttonComponentInfo),
|
|
47
47
|
__spreadValues({ component: Section }, sectionComponentInfo),
|
|
48
|
-
__spreadValues({ component:
|
|
49
|
-
__spreadValues({ component:
|
|
50
|
-
__spreadValues({ component:
|
|
48
|
+
__spreadValues({ component: Symbol }, symbolComponentInfo),
|
|
49
|
+
__spreadValues({ component: Text }, textComponentInfo),
|
|
50
|
+
__spreadValues({ component: Video }, videoComponentInfo)
|
|
51
51
|
];
|
|
52
52
|
export {
|
|
53
53
|
getDefaultRegisteredComponents
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { default as default2 } from "../blocks/
|
|
2
|
-
import { default as default3 } from "../blocks/
|
|
3
|
-
import { default as default4 } from "../blocks/
|
|
4
|
-
import { default as default5 } from "../blocks/
|
|
5
|
-
import { default as default6 } from "../blocks
|
|
6
|
-
import { default as default7 } from "../
|
|
7
|
-
import { default as default8 } from "../blocks/section/section
|
|
8
|
-
import { default as default9 } from "../blocks/
|
|
9
|
-
import { default as default10 } from "../
|
|
10
|
-
import { default as default11 } from "../
|
|
1
|
+
import { default as default2 } from "../blocks/button/button";
|
|
2
|
+
import { default as default3 } from "../blocks/columns/columns";
|
|
3
|
+
import { default as default4 } from "../blocks/fragment/fragment";
|
|
4
|
+
import { default as default5 } from "../blocks/image/image";
|
|
5
|
+
import { default as default6 } from "../components/render-blocks";
|
|
6
|
+
import { default as default7 } from "../components/render-content/render-content";
|
|
7
|
+
import { default as default8 } from "../blocks/section/section";
|
|
8
|
+
import { default as default9 } from "../blocks/symbol/symbol";
|
|
9
|
+
import { default as default10 } from "../blocks/text/text";
|
|
10
|
+
import { default as default11 } from "../blocks/video/video";
|
|
11
11
|
export {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
default2 as Button,
|
|
13
|
+
default3 as Columns,
|
|
14
|
+
default4 as Fragment,
|
|
15
|
+
default5 as Image,
|
|
16
|
+
default6 as RenderBlocks,
|
|
17
|
+
default7 as RenderContent,
|
|
18
18
|
default8 as Section,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
default9 as Symbol,
|
|
20
|
+
default10 as Text,
|
|
21
|
+
default11 as Video
|
|
22
22
|
};
|
|
File without changes
|
|
@@ -17,11 +17,11 @@ export default function Button(props) {
|
|
|
17
17
|
</a>
|
|
18
18
|
</>
|
|
19
19
|
) : (
|
|
20
|
-
<button className="button-
|
|
20
|
+
<button className="button-b25d5310" {...props.attributes}>
|
|
21
21
|
{props.text}
|
|
22
22
|
</button>
|
|
23
23
|
)}
|
|
24
|
-
<style>{`.button-
|
|
24
|
+
<style>{`.button-b25d5310 {
|
|
25
25
|
all: unset;
|
|
26
26
|
}`}</style>
|
|
27
27
|
</>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import RenderBlocks from "../../components/render-blocks
|
|
2
|
+
import RenderBlocks from "../../components/render-blocks";
|
|
3
3
|
import { getSizesForBreakpoints } from "../../constants/device-sizes";
|
|
4
|
-
import RenderInlinedStyles from "../../components/render-inlined-styles
|
|
4
|
+
import RenderInlinedStyles from "../../components/render-inlined-styles";
|
|
5
5
|
import { TARGET } from "../../constants/target.js";
|
|
6
6
|
import { convertStyleMapToCSS } from "../../helpers/css";
|
|
7
7
|
|
|
@@ -118,7 +118,7 @@ export default function Columns(props) {
|
|
|
118
118
|
<div
|
|
119
119
|
className={
|
|
120
120
|
`builder-columns ${props.builderBlock.id}-breakpoints` +
|
|
121
|
-
" div-
|
|
121
|
+
" div-ca644030"
|
|
122
122
|
}
|
|
123
123
|
style={{
|
|
124
124
|
...(TARGET === "reactNative" ? state.reactNativeColumnsStyles : {}),
|
|
@@ -136,7 +136,7 @@ export default function Columns(props) {
|
|
|
136
136
|
|
|
137
137
|
{props.columns?.map((column, index) => (
|
|
138
138
|
<div
|
|
139
|
-
className="builder-column div-
|
|
139
|
+
className="builder-column div-ca644030-2"
|
|
140
140
|
style={{
|
|
141
141
|
width: state.getColumnCssWidth(index),
|
|
142
142
|
marginLeft: `${index === 0 ? 0 : state.getGutterSize()}px`,
|
|
@@ -159,10 +159,10 @@ export default function Columns(props) {
|
|
|
159
159
|
</div>
|
|
160
160
|
))}
|
|
161
161
|
</div>
|
|
162
|
-
<style>{`.div-
|
|
162
|
+
<style>{`.div-ca644030 {
|
|
163
163
|
display: flex;
|
|
164
164
|
line-height: normal;
|
|
165
|
-
}.div-
|
|
165
|
+
}.div-ca644030-2 {
|
|
166
166
|
display: flex;
|
|
167
167
|
flex-direction: column;
|
|
168
168
|
align-items: stretch;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import RenderBlock from "../../components/render-block/render-block
|
|
3
|
-
import BuilderBlocks from "../../components/render-blocks
|
|
2
|
+
import RenderBlock from "../../components/render-block/render-block";
|
|
3
|
+
import BuilderBlocks from "../../components/render-blocks";
|
|
4
4
|
import { isEditing } from "../../functions/is-editing.js";
|
|
5
5
|
|
|
6
6
|
export default function FormComponent(props) {
|
|
@@ -237,7 +237,7 @@ export default function FormComponent(props) {
|
|
|
237
237
|
) : null}{" "}
|
|
238
238
|
{state.submissionState === "error" && state.responseData ? (
|
|
239
239
|
<>
|
|
240
|
-
<pre className="builder-form-error-text pre-
|
|
240
|
+
<pre className="builder-form-error-text pre-41e7c77e">
|
|
241
241
|
{" "}
|
|
242
242
|
{JSON.stringify(state.responseData, null, 2)}{" "}
|
|
243
243
|
</pre>
|
|
@@ -253,7 +253,7 @@ export default function FormComponent(props) {
|
|
|
253
253
|
</>
|
|
254
254
|
) : null}{" "}
|
|
255
255
|
</form>{" "}
|
|
256
|
-
<style>{`.pre-
|
|
256
|
+
<style>{`.pre-41e7c77e { padding: 10px; color: red; text-align: center; }`}</style>{" "}
|
|
257
257
|
</>
|
|
258
258
|
);
|
|
259
259
|
}
|
|
@@ -68,7 +68,7 @@ export default function Image(props) {
|
|
|
68
68
|
className={
|
|
69
69
|
"builder-image" +
|
|
70
70
|
(props.className ? " " + props.className : "") +
|
|
71
|
-
" img-
|
|
71
|
+
" img-5aa89e3a"
|
|
72
72
|
}
|
|
73
73
|
src={props.image}
|
|
74
74
|
srcSet={state.srcSetToUse}
|
|
@@ -80,7 +80,7 @@ export default function Image(props) {
|
|
|
80
80
|
!(props.builderBlock?.children?.length && props.fitContent) ? (
|
|
81
81
|
<>
|
|
82
82
|
<div
|
|
83
|
-
className="builder-image-sizer div-
|
|
83
|
+
className="builder-image-sizer div-5aa89e3a"
|
|
84
84
|
style={{
|
|
85
85
|
paddingTop:
|
|
86
86
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
@@ -96,18 +96,18 @@ export default function Image(props) {
|
|
|
96
96
|
|
|
97
97
|
{!props.fitContent && props.children ? (
|
|
98
98
|
<>
|
|
99
|
-
<div className="div-
|
|
99
|
+
<div className="div-5aa89e3a-2">{props.children}</div>
|
|
100
100
|
</>
|
|
101
101
|
) : null}
|
|
102
102
|
</>
|
|
103
|
-
<style>{`.img-
|
|
103
|
+
<style>{`.img-5aa89e3a {
|
|
104
104
|
opacity: 1;
|
|
105
105
|
transition: opacity 0.2s ease-in-out;
|
|
106
|
-
}.div-
|
|
106
|
+
}.div-5aa89e3a {
|
|
107
107
|
width: 100%;
|
|
108
108
|
pointer-events: none;
|
|
109
109
|
font-size: 0;
|
|
110
|
-
}.div-
|
|
110
|
+
}.div-5aa89e3a-2 {
|
|
111
111
|
display: flex;
|
|
112
112
|
flex-direction: column;
|
|
113
113
|
align-items: stretch;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import RenderContent from "../../components/render-content/render-content
|
|
2
|
+
import RenderContent from "../../components/render-content/render-content";
|
|
3
3
|
import BuilderContext from "../../context/builder.context.js";
|
|
4
4
|
import { getContent } from "../../functions/get-content/index.js";
|
|
5
5
|
import { TARGET } from "../../constants/target";
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
import { TARGET } from "../../constants/target.js";
|
|
7
7
|
import { getProcessedBlock } from "../../functions/get-processed-block.js";
|
|
8
8
|
import { createCssClass } from "../../helpers/css.js";
|
|
9
|
-
import RenderInlinedStyles from "../render-inlined-styles
|
|
9
|
+
import RenderInlinedStyles from "../render-inlined-styles";
|
|
10
10
|
|
|
11
11
|
export default function BlockStyles(props) {
|
|
12
12
|
const _context = { ...props["_context"] };
|
|
@@ -4,16 +4,16 @@ import { getBlockComponentOptions } from "../../functions/get-block-component-op
|
|
|
4
4
|
import { getBlockProperties } from "../../functions/get-block-properties.js";
|
|
5
5
|
import { getBlockTag } from "../../functions/get-block-tag.js";
|
|
6
6
|
import { getProcessedBlock } from "../../functions/get-processed-block.js";
|
|
7
|
-
import BlockStyles from "./block-styles
|
|
7
|
+
import BlockStyles from "./block-styles";
|
|
8
8
|
import {
|
|
9
9
|
getComponent,
|
|
10
10
|
getRepeatItemData,
|
|
11
11
|
isEmptyHtmlElement,
|
|
12
12
|
} from "./render-block.helpers.js";
|
|
13
|
-
import RenderRepeatedBlock from "./render-repeated-block
|
|
13
|
+
import RenderRepeatedBlock from "./render-repeated-block";
|
|
14
14
|
import { TARGET } from "../../constants/target.js";
|
|
15
15
|
import { extractTextStyles } from "../../functions/extract-text-styles.js";
|
|
16
|
-
import RenderComponent from "./render-component
|
|
16
|
+
import RenderComponent from "./render-component";
|
|
17
17
|
import { getReactNativeBlockStyles } from "../../functions/get-react-native-block-styles.js";
|
|
18
18
|
|
|
19
19
|
export default function RenderBlock(props) {
|
|
@@ -37,10 +37,29 @@ export default function RenderBlock(props) {
|
|
|
37
37
|
shouldEvaluateBindings: true,
|
|
38
38
|
});
|
|
39
39
|
},
|
|
40
|
+
get proxyState() {
|
|
41
|
+
if (typeof Proxy === "undefined") {
|
|
42
|
+
console.error(
|
|
43
|
+
"no Proxy available in this environment, cannot proxy state."
|
|
44
|
+
);
|
|
45
|
+
return props.context.state;
|
|
46
|
+
}
|
|
47
|
+
const useState = new Proxy(props.context.state, {
|
|
48
|
+
set: (obj, prop, value) => {
|
|
49
|
+
// set the value on the state object, so that the event handler instantly gets the update.
|
|
50
|
+
obj[prop] = value;
|
|
51
|
+
|
|
52
|
+
// set the value in the context, so that the rest of the app gets the update.
|
|
53
|
+
props.context.setState?.(obj);
|
|
54
|
+
return true;
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
return useState;
|
|
58
|
+
},
|
|
40
59
|
get actions() {
|
|
41
60
|
return getBlockActions({
|
|
42
61
|
block: state.useBlock,
|
|
43
|
-
state:
|
|
62
|
+
state: state.proxyState,
|
|
44
63
|
context: props.context.context,
|
|
45
64
|
});
|
|
46
65
|
},
|
|
@@ -117,6 +136,7 @@ export default function RenderBlock(props) {
|
|
|
117
136
|
state: props.context.state,
|
|
118
137
|
content: props.context.content,
|
|
119
138
|
context: props.context.context,
|
|
139
|
+
setState: props.context.setState,
|
|
120
140
|
registeredComponents: props.context.registeredComponents,
|
|
121
141
|
inheritedStyles: getInheritedTextStyles(),
|
|
122
142
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import BlockStyles from "./block-styles
|
|
3
|
-
import RenderBlock from "./render-block
|
|
2
|
+
import BlockStyles from "./block-styles";
|
|
3
|
+
import RenderBlock from "./render-block";
|
|
4
4
|
|
|
5
5
|
export default function RenderComponent(props) {
|
|
6
6
|
const _context = { ...props["_context"] };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import BuilderContext from "../../context/builder.context.js";
|
|
3
|
-
import RenderBlock from "./render-block
|
|
3
|
+
import RenderBlock from "./render-block";
|
|
4
4
|
|
|
5
5
|
export default function RenderRepeatedBlock(props) {
|
|
6
6
|
const _context = { ...props["_context"] };
|
|
@@ -8,6 +8,7 @@ export default function RenderRepeatedBlock(props) {
|
|
|
8
8
|
_context.BuilderContext = {
|
|
9
9
|
content: props.repeatContext.content,
|
|
10
10
|
state: props.repeatContext.state,
|
|
11
|
+
setState: props.repeatContext.setState,
|
|
11
12
|
context: props.repeatContext.context,
|
|
12
13
|
apiKey: props.repeatContext.apiKey,
|
|
13
14
|
registeredComponents: props.repeatContext.registeredComponents,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import BuilderContext from "../context/builder.context.js";
|
|
3
3
|
import { isEditing } from "../functions/is-editing.js";
|
|
4
|
-
import BlockStyles from "./render-block/block-styles
|
|
5
|
-
import RenderBlock from "./render-block/render-block
|
|
4
|
+
import BlockStyles from "./render-block/block-styles";
|
|
5
|
+
import RenderBlock from "./render-block/render-block";
|
|
6
6
|
|
|
7
7
|
export default function RenderBlocks(props) {
|
|
8
8
|
const _context = { ...props["_context"] };
|
|
@@ -46,7 +46,7 @@ export default function RenderBlocks(props) {
|
|
|
46
46
|
return (
|
|
47
47
|
<>
|
|
48
48
|
<div
|
|
49
|
-
className={state.className + " div-
|
|
49
|
+
className={state.className + " div-d19f7a9a"}
|
|
50
50
|
builder-path={props.path}
|
|
51
51
|
builder-parent-id={props.parent}
|
|
52
52
|
dataSet={{
|
|
@@ -80,7 +80,7 @@ export default function RenderBlocks(props) {
|
|
|
80
80
|
</>
|
|
81
81
|
) : null}
|
|
82
82
|
</div>
|
|
83
|
-
<style>{`.div-
|
|
83
|
+
<style>{`.div-d19f7a9a {
|
|
84
84
|
display: flex;
|
|
85
85
|
flex-direction: column;
|
|
86
86
|
align-items: stretch;
|
|
@@ -1,7 +1,64 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { setupBrowserForEditing } from '../../scripts/init-editing.js';
|
|
3
|
+
// import type { RegisteredComponent } from '../../context/types.js';
|
|
4
|
+
// import type { BuilderContent } from '../../types/builder-content.js';
|
|
2
5
|
|
|
3
|
-
|
|
4
|
-
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {object} RegisteredComponent
|
|
8
|
+
* @typedef {object} BuilderContent
|
|
9
|
+
* @typedef {(data: {data: object, key: string }) => void} OnUpdateCallback
|
|
10
|
+
* @typedef {{
|
|
11
|
+
* model: string,
|
|
12
|
+
* components?: RegisteredComponent[],
|
|
13
|
+
* children: any,
|
|
14
|
+
* onUpdate?: OnUpdateCallback,
|
|
15
|
+
* }} BuilderEditingProps
|
|
16
|
+
*/
|
|
5
17
|
|
|
6
|
-
|
|
18
|
+
/**
|
|
19
|
+
* @param {BuilderEditingProps} props
|
|
20
|
+
*/
|
|
21
|
+
export function BuilderEditingWrapper(props) {
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
setupBrowserForEditing();
|
|
24
|
+
|
|
25
|
+
if (props.components) {
|
|
26
|
+
for (const component of props.components) {
|
|
27
|
+
window.parent.postMessage(
|
|
28
|
+
{
|
|
29
|
+
type: 'builder.registerComponent',
|
|
30
|
+
data: component,
|
|
31
|
+
},
|
|
32
|
+
'*'
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
*
|
|
39
|
+
* @param {MessageEvent} e
|
|
40
|
+
*/
|
|
41
|
+
function onMessage(e) {
|
|
42
|
+
switch (e.data?.type) {
|
|
43
|
+
case 'builder.contentUpdate': {
|
|
44
|
+
props.onUpdate?.(e.data.data);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
addEventListener('message', onMessage);
|
|
50
|
+
|
|
51
|
+
return () => window.removeEventListener('message', onMessage);
|
|
52
|
+
}, [props.model]);
|
|
53
|
+
return (
|
|
54
|
+
<div
|
|
55
|
+
onMouseDown={(e) => e.preventDefault()}
|
|
56
|
+
onClickCapture={(e) => {
|
|
57
|
+
e.stopPropagation();
|
|
58
|
+
e.preventDefault();
|
|
59
|
+
}}
|
|
60
|
+
>
|
|
61
|
+
{props.children}
|
|
62
|
+
</div>
|
|
63
|
+
);
|
|
7
64
|
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
const getCssFromFont = (font) => {
|
|
2
|
+
var _a, _b;
|
|
3
|
+
const family = font.family + (font.kind && !font.kind.includes("#") ? ", " + font.kind : "");
|
|
4
|
+
const name = family.split(",")[0];
|
|
5
|
+
const url = (_b = font.fileUrl) != null ? _b : (_a = font == null ? void 0 : font.files) == null ? void 0 : _a.regular;
|
|
6
|
+
let str = "";
|
|
7
|
+
if (url && family && name) {
|
|
8
|
+
str += `
|
|
9
|
+
@font-face {
|
|
10
|
+
font-family: "${family}";
|
|
11
|
+
src: local("${name}"), url('${url}') format('woff2');
|
|
12
|
+
font-display: fallback;
|
|
13
|
+
font-weight: 400;
|
|
14
|
+
}
|
|
15
|
+
`.trim();
|
|
16
|
+
}
|
|
17
|
+
if (font.files) {
|
|
18
|
+
for (const weight in font.files) {
|
|
19
|
+
const isNumber = String(Number(weight)) === weight;
|
|
20
|
+
if (!isNumber) {
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
const weightUrl = font.files[weight];
|
|
24
|
+
if (weightUrl && weightUrl !== url) {
|
|
25
|
+
str += `
|
|
26
|
+
@font-face {
|
|
27
|
+
font-family: "${family}";
|
|
28
|
+
src: url('${weightUrl}') format('woff2');
|
|
29
|
+
font-display: fallback;
|
|
30
|
+
font-weight: ${weight};
|
|
31
|
+
}
|
|
32
|
+
`.trim();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return str;
|
|
37
|
+
};
|
|
38
|
+
const getFontCss = ({ customFonts }) => {
|
|
39
|
+
var _a;
|
|
40
|
+
return ((_a = customFonts == null ? void 0 : customFonts.map((font) => getCssFromFont(font))) == null ? void 0 : _a.join(" ")) || "";
|
|
41
|
+
};
|
|
42
|
+
const getCss = ({
|
|
43
|
+
cssCode,
|
|
44
|
+
contentId
|
|
45
|
+
}) => {
|
|
46
|
+
if (!cssCode) {
|
|
47
|
+
return "";
|
|
48
|
+
}
|
|
49
|
+
if (!contentId) {
|
|
50
|
+
return cssCode;
|
|
51
|
+
}
|
|
52
|
+
return (cssCode == null ? void 0 : cssCode.replace(/&/g, `div[builder-content-id="${contentId}"]`)) || "";
|
|
53
|
+
};
|
|
54
|
+
export {
|
|
55
|
+
getCss,
|
|
56
|
+
getFontCss
|
|
57
|
+
};
|
|
@@ -1,67 +1,21 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import RenderInlinedStyles from "../../render-inlined-styles
|
|
2
|
+
import RenderInlinedStyles from "../../render-inlined-styles";
|
|
3
|
+
import { getCss } from "./render-styles.helpers";
|
|
4
|
+
import { getFontCss } from "./render-styles.helpers";
|
|
3
5
|
|
|
4
6
|
export default function RenderContentStyles(props) {
|
|
5
7
|
const _context = { ...props["_context"] };
|
|
6
8
|
|
|
7
9
|
const state = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const url = font.fileUrl ?? font?.files?.regular;
|
|
15
|
-
let str = "";
|
|
16
|
-
if (url && family && name) {
|
|
17
|
-
str += `
|
|
18
|
-
@font-face {
|
|
19
|
-
font-family: "${family}";
|
|
20
|
-
src: local("${name}"), url('${url}') format('woff2');
|
|
21
|
-
font-display: fallback;
|
|
22
|
-
font-weight: 400;
|
|
23
|
-
}
|
|
24
|
-
`.trim();
|
|
25
|
-
}
|
|
26
|
-
if (font.files) {
|
|
27
|
-
for (const weight in font.files) {
|
|
28
|
-
const isNumber = String(Number(weight)) === weight;
|
|
29
|
-
if (!isNumber) {
|
|
30
|
-
continue;
|
|
31
|
-
}
|
|
32
|
-
// TODO: maybe limit number loaded
|
|
33
|
-
const weightUrl = font.files[weight];
|
|
34
|
-
if (weightUrl && weightUrl !== url) {
|
|
35
|
-
str += `
|
|
36
|
-
@font-face {
|
|
37
|
-
font-family: "${family}";
|
|
38
|
-
src: url('${weightUrl}') format('woff2');
|
|
39
|
-
font-display: fallback;
|
|
40
|
-
font-weight: ${weight};
|
|
41
|
-
}
|
|
42
|
-
`.trim();
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return str;
|
|
47
|
-
},
|
|
48
|
-
getFontCss({ customFonts }) {
|
|
49
|
-
// TODO: flag for this
|
|
50
|
-
// if (!this.builder.allowCustomFonts) {
|
|
51
|
-
// return '';
|
|
52
|
-
// }
|
|
53
|
-
// TODO: separate internal data from external
|
|
54
|
-
return (
|
|
55
|
-
customFonts?.map((font) => this.getCssFromFont(font))?.join(" ") || ""
|
|
56
|
-
);
|
|
57
|
-
},
|
|
58
|
-
get injectedStyles() {
|
|
59
|
-
return `
|
|
60
|
-
${props.cssCode || ""}
|
|
61
|
-
${state.getFontCss({
|
|
10
|
+
injectedStyles: `
|
|
11
|
+
${getCss({
|
|
12
|
+
cssCode: props.cssCode,
|
|
13
|
+
contentId: props.contentId,
|
|
14
|
+
})}
|
|
15
|
+
${getFontCss({
|
|
62
16
|
customFonts: props.customFonts,
|
|
63
|
-
})}
|
|
64
|
-
|
|
17
|
+
})}
|
|
18
|
+
`,
|
|
65
19
|
};
|
|
66
20
|
|
|
67
21
|
return (
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
const getContextStateInitialValue = ({
|
|
21
|
+
content,
|
|
22
|
+
data,
|
|
23
|
+
locale
|
|
24
|
+
}) => {
|
|
25
|
+
var _a, _b, _c;
|
|
26
|
+
const defaultValues = {};
|
|
27
|
+
(_b = (_a = content == null ? void 0 : content.data) == null ? void 0 : _a.inputs) == null ? void 0 : _b.forEach((input) => {
|
|
28
|
+
var _a2;
|
|
29
|
+
if (input.name && input.defaultValue !== void 0 && ((_a2 = content == null ? void 0 : content.data) == null ? void 0 : _a2.state) && content.data.state[input.name] === void 0) {
|
|
30
|
+
defaultValues[input.name] = input.defaultValue;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
const stateToUse = __spreadValues(__spreadValues(__spreadValues({}, (_c = content == null ? void 0 : content.data) == null ? void 0 : _c.state), data), locale ? { locale } : {});
|
|
34
|
+
return __spreadValues(__spreadValues({}, defaultValues), stateToUse);
|
|
35
|
+
};
|
|
36
|
+
const getContentInitialValue = ({
|
|
37
|
+
content,
|
|
38
|
+
data
|
|
39
|
+
}) => {
|
|
40
|
+
return !content ? void 0 : __spreadProps(__spreadValues({}, content), {
|
|
41
|
+
data: __spreadValues(__spreadValues({}, content == null ? void 0 : content.data), data),
|
|
42
|
+
meta: content == null ? void 0 : content.meta
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
export {
|
|
46
|
+
getContentInitialValue,
|
|
47
|
+
getContextStateInitialValue
|
|
48
|
+
};
|