@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
@@ -1,3 +1,7 @@
1
+ ### 0.5.1
2
+
3
+ - Fix: make `RenderBlocks` properties `context` and `registeredComponents` optional for external use.
4
+
1
5
  ### 0.5.0
2
6
 
3
7
  - Feature: Added support for rudimentary data-bindings in Non-Node.js (edge, serverless, etc.) server runtimes.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builder.io/sdk-solid",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "./solid-index.jsx",
@@ -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={props.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
- <EnableEditor
95
- content={props.content}
96
- model={props.model}
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
- <Show when={props.isSsrAbTest}>
111
- <InlinedScript scriptStr={scriptStr()}></InlinedScript>
112
- </Show>
113
- <Show when={TARGET !== "reactNative"}>
114
- <ContentStyles
115
- contentId={builderContextSignal().content?.id}
116
- cssCode={builderContextSignal().content?.data?.cssCode}
117
- customFonts={builderContextSignal().content?.data?.customFonts}
118
- ></ContentStyles>
119
- </Show>
120
- <Blocks
121
- blocks={builderContextSignal().content?.data?.blocks}
122
- context={builderContextSignal()}
123
- registeredComponents={registeredComponents()}
124
- ></Blocks>
125
- </EnableEditor>
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.0"
1
+ export const SDK_VERSION = "0.5.1"
@@ -0,0 +1,5 @@
1
+ import { createContext } from "solid-js";
2
+ var stdin_default = createContext({ registeredComponents: {} });
3
+ export {
4
+ stdin_default as default
5
+ };