@builder.io/sdk-solid 0.5.0 → 0.5.1
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/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import { Show, For } from "solid-js";
|
|
1
|
+
import { useContext, Show, For } from "solid-js";
|
|
2
2
|
|
|
3
3
|
import BlockStyles from "../block/components/block-styles.jsx";
|
|
4
4
|
import Block from "../block/block.jsx";
|
|
5
5
|
import BlocksWrapper from "./blocks-wrapper.jsx";
|
|
6
|
+
import BuilderContext from "../../context/builder.context";
|
|
7
|
+
import ComponentsContext from "../../context/components.context";
|
|
6
8
|
|
|
7
9
|
function Blocks(props) {
|
|
10
|
+
const builderContext = useContext(BuilderContext);
|
|
11
|
+
|
|
12
|
+
const componentsContext = useContext(ComponentsContext);
|
|
13
|
+
|
|
8
14
|
return (
|
|
9
15
|
<BlocksWrapper
|
|
10
16
|
blocks={props.blocks}
|
|
@@ -20,8 +26,11 @@ function Blocks(props) {
|
|
|
20
26
|
<Block
|
|
21
27
|
key={"render-block-" + block.id}
|
|
22
28
|
block={block}
|
|
23
|
-
context={props.context}
|
|
24
|
-
registeredComponents={
|
|
29
|
+
context={props.context || builderContext}
|
|
30
|
+
registeredComponents={
|
|
31
|
+
props.registeredComponents ||
|
|
32
|
+
componentsContext.registeredComponents
|
|
33
|
+
}
|
|
25
34
|
></Block>
|
|
26
35
|
);
|
|
27
36
|
}}
|
|
@@ -35,7 +44,7 @@ function Blocks(props) {
|
|
|
35
44
|
<BlockStyles
|
|
36
45
|
key={"block-style-" + block.id}
|
|
37
46
|
block={block}
|
|
38
|
-
context={props.context}
|
|
47
|
+
context={props.context || builderContext}
|
|
39
48
|
></BlockStyles>
|
|
40
49
|
);
|
|
41
50
|
}}
|
|
@@ -16,6 +16,7 @@ import { getRenderContentScriptString } from "../content-variants/helpers.js";
|
|
|
16
16
|
import EnableEditor from "./components/enable-editor.jsx";
|
|
17
17
|
import InlinedScript from "../inlined-script.jsx";
|
|
18
18
|
import { wrapComponentRef } from "./wrap-component-ref.js";
|
|
19
|
+
import ComponentsContext from "../../context/components.context";
|
|
19
20
|
|
|
20
21
|
function ContentComponent(props) {
|
|
21
22
|
const [scriptStr, setScriptStr] = createSignal(
|
|
@@ -91,38 +92,44 @@ function ContentComponent(props) {
|
|
|
91
92
|
}
|
|
92
93
|
|
|
93
94
|
return (
|
|
94
|
-
<
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
context={props.context}
|
|
98
|
-
apiKey={props.apiKey}
|
|
99
|
-
canTrack={props.canTrack}
|
|
100
|
-
locale={props.locale}
|
|
101
|
-
includeRefs={props.includeRefs}
|
|
102
|
-
enrich={props.enrich}
|
|
103
|
-
classNameProp={props.classNameProp}
|
|
104
|
-
showContent={props.showContent}
|
|
105
|
-
builderContextSignal={builderContextSignal()}
|
|
106
|
-
{...{
|
|
107
|
-
setBuilderContextSignal: setBuilderContextSignal,
|
|
95
|
+
<ComponentsContext.Provider
|
|
96
|
+
value={{
|
|
97
|
+
registeredComponents: registeredComponents(),
|
|
108
98
|
}}
|
|
109
99
|
>
|
|
110
|
-
<
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
100
|
+
<EnableEditor
|
|
101
|
+
content={props.content}
|
|
102
|
+
model={props.model}
|
|
103
|
+
context={props.context}
|
|
104
|
+
apiKey={props.apiKey}
|
|
105
|
+
canTrack={props.canTrack}
|
|
106
|
+
locale={props.locale}
|
|
107
|
+
includeRefs={props.includeRefs}
|
|
108
|
+
enrich={props.enrich}
|
|
109
|
+
classNameProp={props.classNameProp}
|
|
110
|
+
showContent={props.showContent}
|
|
111
|
+
builderContextSignal={builderContextSignal()}
|
|
112
|
+
{...{
|
|
113
|
+
setBuilderContextSignal: setBuilderContextSignal,
|
|
114
|
+
}}
|
|
115
|
+
>
|
|
116
|
+
<Show when={props.isSsrAbTest}>
|
|
117
|
+
<InlinedScript scriptStr={scriptStr()}></InlinedScript>
|
|
118
|
+
</Show>
|
|
119
|
+
<Show when={TARGET !== "reactNative"}>
|
|
120
|
+
<ContentStyles
|
|
121
|
+
contentId={builderContextSignal().content?.id}
|
|
122
|
+
cssCode={builderContextSignal().content?.data?.cssCode}
|
|
123
|
+
customFonts={builderContextSignal().content?.data?.customFonts}
|
|
124
|
+
></ContentStyles>
|
|
125
|
+
</Show>
|
|
126
|
+
<Blocks
|
|
127
|
+
blocks={builderContextSignal().content?.data?.blocks}
|
|
128
|
+
context={builderContextSignal()}
|
|
129
|
+
registeredComponents={registeredComponents()}
|
|
130
|
+
></Blocks>
|
|
131
|
+
</EnableEditor>
|
|
132
|
+
</ComponentsContext.Provider>
|
|
126
133
|
);
|
|
127
134
|
}
|
|
128
135
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.5.
|
|
1
|
+
export const SDK_VERSION = "0.5.1"
|