@builder.io/sdk-react 0.1.4 → 0.1.6
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/button/component-info.js +0 -1
- package/dist/react/blocks/columns/columns.js +4 -4
- package/dist/react/blocks/columns/component-info.js +0 -1
- package/dist/react/blocks/custom-code/component-info.js +0 -1
- package/dist/react/blocks/embed/component-info.js +0 -1
- package/dist/react/blocks/form/component-info.js +0 -1
- package/dist/react/blocks/form/form.js +2 -2
- package/dist/react/blocks/fragment/component-info.js +0 -1
- package/dist/react/blocks/image/component-info.js +0 -1
- package/dist/react/blocks/image/image.js +6 -6
- package/dist/react/blocks/img/component-info.js +0 -1
- package/dist/react/blocks/input/component-info.js +0 -1
- package/dist/react/blocks/raw-text/component-info.js +0 -1
- package/dist/react/blocks/section/component-info.js +0 -1
- package/dist/react/blocks/select/component-info.js +0 -1
- package/dist/react/blocks/submit-button/component-info.js +0 -1
- package/dist/react/blocks/symbol/component-info.js +0 -1
- package/dist/react/blocks/text/component-info.js +0 -1
- package/dist/react/blocks/textarea/component-info.js +0 -1
- package/dist/react/blocks/video/component-info.js +0 -1
- package/dist/react/components/render-block/render-block.js +18 -1
- package/dist/react/components/render-block/render-repeated-block.js +1 -0
- package/dist/react/components/render-blocks.js +2 -2
- package/dist/react/components/render-content/components/render-styles.helpers.js +51 -0
- package/dist/react/components/render-content/components/render-styles.js +12 -54
- package/dist/react/components/render-content/render-content.helpers.js +38 -0
- package/dist/react/components/render-content/render-content.js +65 -62
- package/dist/react/components/render-content/render-content.types.js +1 -0
- package/dist/react/constants/builder-registered-components.js +7 -7
- package/dist/react/context/builder.context.js +2 -0
- package/dist/react/index-helpers/blocks-exports.js +10 -10
- package/dist/react/types/input.js +1 -0
- package/dist/rsc/blocks/button/button.js +2 -2
- package/dist/rsc/blocks/button/component-info.js +0 -1
- package/dist/rsc/blocks/columns/columns.js +4 -4
- package/dist/rsc/blocks/columns/component-info.js +0 -1
- package/dist/rsc/blocks/custom-code/component-info.js +0 -1
- package/dist/rsc/blocks/embed/component-info.js +0 -1
- package/dist/rsc/blocks/form/component-info.js +0 -1
- package/dist/rsc/blocks/form/form.js +2 -2
- package/dist/rsc/blocks/fragment/component-info.js +0 -1
- package/dist/rsc/blocks/image/component-info.js +0 -1
- package/dist/rsc/blocks/image/image.js +6 -6
- package/dist/rsc/blocks/img/component-info.js +0 -1
- package/dist/rsc/blocks/input/component-info.js +0 -1
- package/dist/rsc/blocks/raw-text/component-info.js +0 -1
- package/dist/rsc/blocks/section/component-info.js +0 -1
- package/dist/rsc/blocks/select/component-info.js +0 -1
- package/dist/rsc/blocks/submit-button/component-info.js +0 -1
- package/dist/rsc/blocks/symbol/component-info.js +0 -1
- package/dist/rsc/blocks/text/component-info.js +0 -1
- package/dist/rsc/blocks/textarea/component-info.js +0 -1
- package/dist/rsc/blocks/video/component-info.js +0 -1
- package/dist/rsc/components/render-block/render-block.js +18 -1
- package/dist/rsc/components/render-block/render-repeated-block.js +1 -0
- package/dist/rsc/components/render-blocks.js +2 -2
- 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 +11 -54
- package/dist/rsc/components/render-content/render-content.helpers.js +38 -0
- package/dist/rsc/components/render-content/render-content.js +43 -38
- package/dist/rsc/components/render-content/render-content.types.js +1 -0
- package/dist/rsc/constants/builder-registered-components.js +7 -7
- package/dist/rsc/context/builder.context.js +2 -0
- package/dist/rsc/index-helpers/blocks-exports.js +10 -10
- 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/button/component-info.js +0 -1
- package/packages/react/src/blocks/columns/columns.jsx +4 -4
- package/packages/react/src/blocks/columns/component-info.js +0 -1
- package/packages/react/src/blocks/custom-code/component-info.js +0 -1
- package/packages/react/src/blocks/embed/component-info.js +0 -1
- package/packages/react/src/blocks/form/component-info.js +0 -1
- package/packages/react/src/blocks/form/form.jsx +2 -2
- package/packages/react/src/blocks/fragment/component-info.js +0 -1
- package/packages/react/src/blocks/image/component-info.js +0 -1
- package/packages/react/src/blocks/image/image.jsx +6 -6
- package/packages/react/src/blocks/img/component-info.js +0 -1
- package/packages/react/src/blocks/input/component-info.js +0 -1
- package/packages/react/src/blocks/raw-text/component-info.js +0 -1
- package/packages/react/src/blocks/section/component-info.js +0 -1
- package/packages/react/src/blocks/select/component-info.js +0 -1
- package/packages/react/src/blocks/submit-button/component-info.js +0 -1
- package/packages/react/src/blocks/symbol/component-info.js +0 -1
- package/packages/react/src/blocks/text/component-info.js +0 -1
- package/packages/react/src/blocks/textarea/component-info.js +0 -1
- package/packages/react/src/blocks/video/component-info.js +0 -1
- package/packages/react/src/components/render-block/render-block.jsx +22 -1
- package/packages/react/src/components/render-block/render-repeated-block.jsx +1 -0
- package/packages/react/src/components/render-blocks.jsx +2 -2
- 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 +13 -56
- package/packages/react/src/components/render-content/render-content.helpers.js +48 -0
- package/packages/react/src/components/render-content/render-content.jsx +76 -67
- package/packages/{_rsc/src/components/render-block/types.js → react/src/components/render-content/render-content.types.js} +0 -0
- package/packages/react/src/constants/builder-registered-components.js +7 -7
- package/packages/react/src/context/builder.context.js +2 -0
- package/packages/react/src/index-helpers/blocks-exports.js +18 -18
- 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/button/component-info.js +0 -1
- package/packages/rsc/src/blocks/columns/columns.jsx +4 -4
- package/packages/rsc/src/blocks/columns/component-info.js +0 -1
- package/packages/rsc/src/blocks/custom-code/component-info.js +0 -1
- package/packages/rsc/src/blocks/embed/component-info.js +0 -1
- package/packages/rsc/src/blocks/form/component-info.js +0 -1
- package/packages/rsc/src/blocks/form/form.jsx +2 -2
- package/packages/rsc/src/blocks/fragment/component-info.js +0 -1
- package/packages/rsc/src/blocks/image/component-info.js +0 -1
- package/packages/rsc/src/blocks/image/image.jsx +6 -6
- package/packages/rsc/src/blocks/img/component-info.js +0 -1
- package/packages/rsc/src/blocks/input/component-info.js +0 -1
- package/packages/rsc/src/blocks/raw-text/component-info.js +0 -1
- package/packages/rsc/src/blocks/section/component-info.js +0 -1
- package/packages/rsc/src/blocks/select/component-info.js +0 -1
- package/packages/rsc/src/blocks/submit-button/component-info.js +0 -1
- package/packages/rsc/src/blocks/symbol/component-info.js +0 -1
- package/packages/rsc/src/blocks/text/component-info.js +0 -1
- package/packages/rsc/src/blocks/textarea/component-info.js +0 -1
- package/packages/rsc/src/blocks/video/component-info.js +0 -1
- package/packages/rsc/src/components/render-block/render-block.jsx +21 -1
- package/packages/rsc/src/components/render-block/render-repeated-block.jsx +1 -0
- package/packages/rsc/src/components/render-blocks.jsx +2 -2
- 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 +10 -56
- package/packages/rsc/src/components/render-content/render-content.helpers.js +48 -0
- package/packages/rsc/src/components/render-content/render-content.jsx +46 -37
- package/packages/{_rsc/src/functions/get-content/types.js → rsc/src/components/render-content/render-content.types.js} +0 -0
- package/packages/rsc/src/constants/builder-registered-components.js +7 -7
- package/packages/rsc/src/context/builder.context.js +2 -0
- package/packages/rsc/src/index-helpers/blocks-exports.js +18 -18
- 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
|
@@ -21,6 +21,10 @@ import {
|
|
|
21
21
|
} from "../../scripts/init-editing.js";
|
|
22
22
|
import { checkIsDefined } from "../../helpers/nullable.js";
|
|
23
23
|
import { getInteractionPropertiesForEvent } from "../../functions/track/interaction.js";
|
|
24
|
+
import {
|
|
25
|
+
getContentInitialValue,
|
|
26
|
+
getContextStateInitialValue,
|
|
27
|
+
} from "./render-content.helpers.js";
|
|
24
28
|
|
|
25
29
|
export default function RenderContent(props) {
|
|
26
30
|
const _context = { ...props["_context"] };
|
|
@@ -28,45 +32,46 @@ export default function RenderContent(props) {
|
|
|
28
32
|
const state = {
|
|
29
33
|
forceReRenderCount: 0,
|
|
30
34
|
overrideContent: null,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
...state.
|
|
35
|
+
useContent: getContentInitialValue({
|
|
36
|
+
content: props.content,
|
|
37
|
+
data: props.data,
|
|
38
|
+
}),
|
|
39
|
+
mergeNewContent(newContent) {
|
|
40
|
+
state.useContent = {
|
|
41
|
+
...state.useContent,
|
|
42
|
+
...newContent,
|
|
38
43
|
data: {
|
|
39
|
-
...
|
|
40
|
-
...
|
|
41
|
-
...state.overrideContent?.data,
|
|
44
|
+
...state.useContent?.data,
|
|
45
|
+
...newContent?.data,
|
|
42
46
|
},
|
|
43
47
|
meta: {
|
|
44
|
-
...
|
|
45
|
-
...
|
|
48
|
+
...state.useContent?.meta,
|
|
49
|
+
...newContent?.meta,
|
|
46
50
|
breakpoints:
|
|
47
|
-
|
|
48
|
-
state.
|
|
49
|
-
|
|
51
|
+
newContent?.meta?.breakpoints ||
|
|
52
|
+
state.useContent?.meta?.breakpoints,
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
setBreakpoints(breakpoints) {
|
|
57
|
+
state.useContent = {
|
|
58
|
+
...state.useContent,
|
|
59
|
+
meta: {
|
|
60
|
+
...state.useContent?.meta,
|
|
61
|
+
breakpoints,
|
|
50
62
|
},
|
|
51
63
|
};
|
|
52
64
|
},
|
|
53
65
|
update: 0,
|
|
54
|
-
useBreakpoints: null,
|
|
55
66
|
canTrackToUse: checkIsDefined(props.canTrack) ? props.canTrack : true,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
locale: props.locale,
|
|
64
|
-
}
|
|
65
|
-
: {}),
|
|
66
|
-
...state.overrideState,
|
|
67
|
-
};
|
|
67
|
+
contentState: getContextStateInitialValue({
|
|
68
|
+
content: props.content,
|
|
69
|
+
data: props.data,
|
|
70
|
+
locale: props.locale,
|
|
71
|
+
}),
|
|
72
|
+
setContextState(newState) {
|
|
73
|
+
state.contentState = newState;
|
|
68
74
|
},
|
|
69
|
-
contextContext: props.context || {},
|
|
70
75
|
allRegisteredComponents: [
|
|
71
76
|
...getDefaultRegisteredComponents(),
|
|
72
77
|
// While this `components` object is deprecated, we must maintain support for it.
|
|
@@ -93,7 +98,9 @@ export default function RenderContent(props) {
|
|
|
93
98
|
if (!contentId || contentId !== state.useContent?.id) {
|
|
94
99
|
return;
|
|
95
100
|
}
|
|
96
|
-
|
|
101
|
+
if (breakpoints) {
|
|
102
|
+
state.setBreakpoints(breakpoints);
|
|
103
|
+
}
|
|
97
104
|
state.forceReRenderCount = state.forceReRenderCount + 1; // This is a hack to force Qwik to re-render.
|
|
98
105
|
break;
|
|
99
106
|
}
|
|
@@ -106,7 +113,7 @@ export default function RenderContent(props) {
|
|
|
106
113
|
messageContent.modelName;
|
|
107
114
|
const contentData = messageContent.data;
|
|
108
115
|
if (key === props.model) {
|
|
109
|
-
state.
|
|
116
|
+
state.mergeNewContent(contentData);
|
|
110
117
|
state.forceReRenderCount = state.forceReRenderCount + 1; // This is a hack to force Qwik to re-render.
|
|
111
118
|
}
|
|
112
119
|
|
|
@@ -125,7 +132,7 @@ export default function RenderContent(props) {
|
|
|
125
132
|
if (jsCode) {
|
|
126
133
|
evaluate({
|
|
127
134
|
code: jsCode,
|
|
128
|
-
context:
|
|
135
|
+
context: props.context || {},
|
|
129
136
|
state: state.contentState,
|
|
130
137
|
});
|
|
131
138
|
}
|
|
@@ -154,7 +161,7 @@ export default function RenderContent(props) {
|
|
|
154
161
|
return expression.replace(/{{([^}]+)}}/g, (_match, group) =>
|
|
155
162
|
evaluate({
|
|
156
163
|
code: group,
|
|
157
|
-
context:
|
|
164
|
+
context: props.context || {},
|
|
158
165
|
state: state.contentState,
|
|
159
166
|
})
|
|
160
167
|
);
|
|
@@ -163,11 +170,11 @@ export default function RenderContent(props) {
|
|
|
163
170
|
fetch(url)
|
|
164
171
|
.then((response) => response.json())
|
|
165
172
|
.then((json) => {
|
|
166
|
-
const
|
|
167
|
-
...state.
|
|
173
|
+
const newState = {
|
|
174
|
+
...state.contentState,
|
|
168
175
|
[key]: json,
|
|
169
176
|
};
|
|
170
|
-
state.
|
|
177
|
+
state.setContextState(newState);
|
|
171
178
|
})
|
|
172
179
|
.catch((err) => {
|
|
173
180
|
console.log("error fetching dynamic data", url, err);
|
|
@@ -211,7 +218,8 @@ export default function RenderContent(props) {
|
|
|
211
218
|
_context.builderContext = {
|
|
212
219
|
content: state.useContent,
|
|
213
220
|
state: state.contentState,
|
|
214
|
-
|
|
221
|
+
setState: state.setContextState,
|
|
222
|
+
context: props.context || {},
|
|
215
223
|
apiKey: props.apiKey,
|
|
216
224
|
registeredComponents: state.allRegisteredComponents,
|
|
217
225
|
};
|
|
@@ -226,6 +234,7 @@ export default function RenderContent(props) {
|
|
|
226
234
|
>
|
|
227
235
|
{state.shouldRenderContentStyles ? (
|
|
228
236
|
<RenderContentStyles
|
|
237
|
+
contentId={state.useContent?.id}
|
|
229
238
|
cssCode={state.useContent?.data?.cssCode}
|
|
230
239
|
customFonts={state.useContent?.data?.customFonts}
|
|
231
240
|
_context={_context}
|
|
File without changes
|
|
@@ -37,17 +37,17 @@ import { componentInfo as imgComponentInfo } from "../blocks/img/component-info.
|
|
|
37
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 "../
|
|
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
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 "../
|
|
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
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import BuilderContext from "../context/builder.context.js";
|
|
3
|
-
|
|
4
|
-
export default function BaseText(props) {
|
|
5
|
-
const _context = { ...props["_context"] };
|
|
6
|
-
|
|
7
|
-
const builderContext = _context["BuilderContext"];
|
|
8
|
-
|
|
9
|
-
return <span style={builderContext.inheritedStyles}>{props.text}</span>;
|
|
10
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
|
|
3
|
-
export default function Button(props) {
|
|
4
|
-
const _context = { ...props["_context"] };
|
|
5
|
-
|
|
6
|
-
return (
|
|
7
|
-
<>
|
|
8
|
-
{props.link ? (
|
|
9
|
-
<>
|
|
10
|
-
<a
|
|
11
|
-
role="button"
|
|
12
|
-
{...props.attributes}
|
|
13
|
-
href={props.link}
|
|
14
|
-
target={props.openLinkInNewTab ? "_blank" : undefined}
|
|
15
|
-
>
|
|
16
|
-
{props.text}
|
|
17
|
-
</a>
|
|
18
|
-
</>
|
|
19
|
-
) : (
|
|
20
|
-
<button className="button-12870b9c" {...props.attributes}>
|
|
21
|
-
{props.text}
|
|
22
|
-
</button>
|
|
23
|
-
)}
|
|
24
|
-
<style>{`.button-12870b9c {
|
|
25
|
-
all: unset;
|
|
26
|
-
}`}</style>
|
|
27
|
-
</>
|
|
28
|
-
);
|
|
29
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
const componentInfo = {
|
|
2
|
-
name: "Core:Button",
|
|
3
|
-
builtIn: true,
|
|
4
|
-
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F81a15681c3e74df09677dfc57a615b13",
|
|
5
|
-
defaultStyles: {
|
|
6
|
-
appearance: "none",
|
|
7
|
-
paddingTop: "15px",
|
|
8
|
-
paddingBottom: "15px",
|
|
9
|
-
paddingLeft: "25px",
|
|
10
|
-
paddingRight: "25px",
|
|
11
|
-
backgroundColor: "#000000",
|
|
12
|
-
color: "white",
|
|
13
|
-
borderRadius: "4px",
|
|
14
|
-
textAlign: "center",
|
|
15
|
-
cursor: "pointer"
|
|
16
|
-
},
|
|
17
|
-
inputs: [
|
|
18
|
-
{
|
|
19
|
-
name: "text",
|
|
20
|
-
type: "text",
|
|
21
|
-
defaultValue: "Click me!",
|
|
22
|
-
bubble: true
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
name: "link",
|
|
26
|
-
type: "url",
|
|
27
|
-
bubble: true
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
name: "openLinkInNewTab",
|
|
31
|
-
type: "boolean",
|
|
32
|
-
defaultValue: false,
|
|
33
|
-
friendlyName: "Open link in new tab"
|
|
34
|
-
}
|
|
35
|
-
],
|
|
36
|
-
static: true,
|
|
37
|
-
noWrap: true
|
|
38
|
-
};
|
|
39
|
-
export {
|
|
40
|
-
componentInfo
|
|
41
|
-
};
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import RenderBlocks from "../../components/render-blocks.js";
|
|
3
|
-
import { getSizesForBreakpoints } from "../../constants/device-sizes";
|
|
4
|
-
import RenderInlinedStyles from "../../components/render-inlined-styles.js";
|
|
5
|
-
import { TARGET } from "../../constants/target.js";
|
|
6
|
-
import { convertStyleMapToCSS } from "../../helpers/css";
|
|
7
|
-
|
|
8
|
-
export default function Columns(props) {
|
|
9
|
-
const _context = { ...props["_context"] };
|
|
10
|
-
|
|
11
|
-
const state = {
|
|
12
|
-
getGutterSize() {
|
|
13
|
-
return typeof props.space === "number" ? props.space || 0 : 20;
|
|
14
|
-
},
|
|
15
|
-
getColumns() {
|
|
16
|
-
return props.columns || [];
|
|
17
|
-
},
|
|
18
|
-
getWidth(index) {
|
|
19
|
-
const columns = state.getColumns();
|
|
20
|
-
return columns[index]?.width || 100 / columns.length;
|
|
21
|
-
},
|
|
22
|
-
getColumnCssWidth(index) {
|
|
23
|
-
const columns = state.getColumns();
|
|
24
|
-
const gutterSize = state.getGutterSize();
|
|
25
|
-
const subtractWidth =
|
|
26
|
-
(gutterSize * (columns.length - 1)) / columns.length;
|
|
27
|
-
return `calc(${state.getWidth(index)}% - ${subtractWidth}px)`;
|
|
28
|
-
},
|
|
29
|
-
maybeApplyForTablet(prop) {
|
|
30
|
-
const _stackColumnsAt = props.stackColumnsAt || "tablet";
|
|
31
|
-
return _stackColumnsAt === "tablet" ? prop : "inherit";
|
|
32
|
-
},
|
|
33
|
-
get columnsCssVars() {
|
|
34
|
-
const flexDir =
|
|
35
|
-
props.stackColumnsAt === "never"
|
|
36
|
-
? "inherit"
|
|
37
|
-
: props.reverseColumnsWhenStacked
|
|
38
|
-
? "column-reverse"
|
|
39
|
-
: "column";
|
|
40
|
-
return {
|
|
41
|
-
"--flex-dir": flexDir,
|
|
42
|
-
"--flex-dir-tablet": state.maybeApplyForTablet(flexDir),
|
|
43
|
-
};
|
|
44
|
-
},
|
|
45
|
-
get columnCssVars() {
|
|
46
|
-
const width = "100%";
|
|
47
|
-
const marginLeft = "0";
|
|
48
|
-
return {
|
|
49
|
-
"--column-width": width,
|
|
50
|
-
"--column-margin-left": marginLeft,
|
|
51
|
-
"--column-width-tablet": state.maybeApplyForTablet(width),
|
|
52
|
-
"--column-margin-left-tablet": state.maybeApplyForTablet(marginLeft),
|
|
53
|
-
};
|
|
54
|
-
},
|
|
55
|
-
getWidthForBreakpointSize(size) {
|
|
56
|
-
const breakpointSizes = getSizesForBreakpoints(
|
|
57
|
-
props.customBreakpoints || {}
|
|
58
|
-
);
|
|
59
|
-
return breakpointSizes[size].max;
|
|
60
|
-
},
|
|
61
|
-
get columnStyleObjects() {
|
|
62
|
-
return {
|
|
63
|
-
columns: {
|
|
64
|
-
small: {
|
|
65
|
-
flexDirection: "var(--flex-dir)",
|
|
66
|
-
alignItems: "stretch",
|
|
67
|
-
},
|
|
68
|
-
medium: {
|
|
69
|
-
flexDirection: "var(--flex-dir-tablet)",
|
|
70
|
-
alignItems: "stretch",
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
column: {
|
|
74
|
-
small: {
|
|
75
|
-
width: "var(--column-width) !important",
|
|
76
|
-
marginLeft: "var(--column-margin-left) !important",
|
|
77
|
-
},
|
|
78
|
-
medium: {
|
|
79
|
-
width: "var(--column-width-tablet) !important",
|
|
80
|
-
marginLeft: "var(--column-margin-left-tablet) !important",
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
};
|
|
84
|
-
},
|
|
85
|
-
get columnsStyles() {
|
|
86
|
-
return `
|
|
87
|
-
@media (max-width: ${state.getWidthForBreakpointSize("medium")}px) {
|
|
88
|
-
.${props.builderBlock.id}-breakpoints {
|
|
89
|
-
${convertStyleMapToCSS(state.columnStyleObjects.columns.medium)}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
.${props.builderBlock.id}-breakpoints > .builder-column {
|
|
93
|
-
${convertStyleMapToCSS(state.columnStyleObjects.column.medium)}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
@media (max-width: ${state.getWidthForBreakpointSize("small")}px) {
|
|
98
|
-
.${props.builderBlock.id}-breakpoints {
|
|
99
|
-
${convertStyleMapToCSS(state.columnStyleObjects.columns.small)}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.${props.builderBlock.id}-breakpoints > .builder-column {
|
|
103
|
-
${convertStyleMapToCSS(state.columnStyleObjects.column.small)}
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
`;
|
|
107
|
-
},
|
|
108
|
-
get reactNativeColumnsStyles() {
|
|
109
|
-
return this.columnStyleObjects.columns.small;
|
|
110
|
-
},
|
|
111
|
-
get reactNativeColumnStyles() {
|
|
112
|
-
return this.columnStyleObjects.column.small;
|
|
113
|
-
},
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
return (
|
|
117
|
-
<>
|
|
118
|
-
<div
|
|
119
|
-
className={
|
|
120
|
-
`builder-columns ${props.builderBlock.id}-breakpoints` +
|
|
121
|
-
" div-540739f0"
|
|
122
|
-
}
|
|
123
|
-
style={{
|
|
124
|
-
...(TARGET === "reactNative" ? state.reactNativeColumnsStyles : {}),
|
|
125
|
-
...state.columnsCssVars,
|
|
126
|
-
}}
|
|
127
|
-
>
|
|
128
|
-
{TARGET !== "reactNative" ? (
|
|
129
|
-
<>
|
|
130
|
-
<RenderInlinedStyles
|
|
131
|
-
styles={state.columnsStyles}
|
|
132
|
-
_context={_context}
|
|
133
|
-
/>
|
|
134
|
-
</>
|
|
135
|
-
) : null}
|
|
136
|
-
|
|
137
|
-
{props.columns?.map((column, index) => (
|
|
138
|
-
<div
|
|
139
|
-
className="builder-column div-540739f0-2"
|
|
140
|
-
style={{
|
|
141
|
-
width: state.getColumnCssWidth(index),
|
|
142
|
-
marginLeft: `${index === 0 ? 0 : state.getGutterSize()}px`,
|
|
143
|
-
...(TARGET === "reactNative"
|
|
144
|
-
? state.reactNativeColumnStyles
|
|
145
|
-
: {}),
|
|
146
|
-
...state.columnCssVars,
|
|
147
|
-
}}
|
|
148
|
-
key={index}
|
|
149
|
-
>
|
|
150
|
-
<RenderBlocks
|
|
151
|
-
blocks={column.blocks}
|
|
152
|
-
path={`component.options.columns.${index}.blocks`}
|
|
153
|
-
parent={props.builderBlock.id}
|
|
154
|
-
styleProp={{
|
|
155
|
-
flexGrow: "1",
|
|
156
|
-
}}
|
|
157
|
-
_context={_context}
|
|
158
|
-
/>
|
|
159
|
-
</div>
|
|
160
|
-
))}
|
|
161
|
-
</div>
|
|
162
|
-
<style>{`.div-540739f0 {
|
|
163
|
-
display: flex;
|
|
164
|
-
line-height: normal;
|
|
165
|
-
}.div-540739f0-2 {
|
|
166
|
-
display: flex;
|
|
167
|
-
flex-direction: column;
|
|
168
|
-
align-items: stretch;
|
|
169
|
-
}`}</style>
|
|
170
|
-
</>
|
|
171
|
-
);
|
|
172
|
-
}
|