@builder.io/sdk-solid 0.1.7 → 0.1.8
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
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
import { TARGET } from "../../constants/target.js";
|
|
8
8
|
import { getProcessedBlock } from "../../functions/get-processed-block.js";
|
|
9
9
|
import { createCssClass } from "../../helpers/css.js";
|
|
10
|
+
import { checkIsDefined } from "../../helpers/nullable.js";
|
|
10
11
|
import RenderInlinedStyles from "../render-inlined-styles.jsx";
|
|
11
12
|
|
|
12
13
|
function BlockStyles(props) {
|
|
@@ -19,6 +20,17 @@ function BlockStyles(props) {
|
|
|
19
20
|
});
|
|
20
21
|
}
|
|
21
22
|
|
|
23
|
+
function canShowBlock() {
|
|
24
|
+
// only render styles for blocks that are visible
|
|
25
|
+
if (checkIsDefined(useBlock().hide)) {
|
|
26
|
+
return !useBlock().hide;
|
|
27
|
+
}
|
|
28
|
+
if (checkIsDefined(useBlock().show)) {
|
|
29
|
+
return useBlock().show;
|
|
30
|
+
}
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
|
|
22
34
|
function css() {
|
|
23
35
|
const styles = useBlock().responsiveStyles;
|
|
24
36
|
const content = props.context.content;
|
|
@@ -59,7 +71,7 @@ function BlockStyles(props) {
|
|
|
59
71
|
}
|
|
60
72
|
|
|
61
73
|
return (
|
|
62
|
-
<Show when={TARGET !== "reactNative" && css()}>
|
|
74
|
+
<Show when={TARGET !== "reactNative" && css() && canShowBlock()}>
|
|
63
75
|
<RenderInlinedStyles styles={css()}></RenderInlinedStyles>
|
|
64
76
|
</Show>
|
|
65
77
|
);
|
|
@@ -17,6 +17,7 @@ import { TARGET } from "../../constants/target.js";
|
|
|
17
17
|
import { extractTextStyles } from "../../functions/extract-text-styles.js";
|
|
18
18
|
import RenderComponent from "./render-component.jsx";
|
|
19
19
|
import { getReactNativeBlockStyles } from "../../functions/get-react-native-block-styles.js";
|
|
20
|
+
import { checkIsDefined } from "../../helpers/nullable.js";
|
|
20
21
|
|
|
21
22
|
function RenderBlock(props) {
|
|
22
23
|
const [component, setComponent] = createSignal(
|
|
@@ -48,6 +49,16 @@ function RenderBlock(props) {
|
|
|
48
49
|
});
|
|
49
50
|
}
|
|
50
51
|
|
|
52
|
+
function canShowBlock() {
|
|
53
|
+
if (checkIsDefined(useBlock().hide)) {
|
|
54
|
+
return !useBlock().hide;
|
|
55
|
+
}
|
|
56
|
+
if (checkIsDefined(useBlock().show)) {
|
|
57
|
+
return useBlock().show;
|
|
58
|
+
}
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
|
|
51
62
|
function proxyState() {
|
|
52
63
|
if (typeof Proxy === "undefined") {
|
|
53
64
|
console.error(
|
|
@@ -152,55 +163,59 @@ function RenderBlock(props) {
|
|
|
152
163
|
}
|
|
153
164
|
|
|
154
165
|
return (
|
|
155
|
-
<Show
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
>
|
|
159
|
-
<Show when={isEmptyHtmlElement(tag())}>
|
|
160
|
-
<Dynamic {...attributes()} {...actions()} component={tag()}></Dynamic>
|
|
161
|
-
</Show>
|
|
162
|
-
<Show when={!isEmptyHtmlElement(tag()) && repeatItemData()}>
|
|
163
|
-
<For each={repeatItemData()}>
|
|
164
|
-
{(data, _index) => {
|
|
165
|
-
const index = _index();
|
|
166
|
-
return (
|
|
167
|
-
<RenderRepeatedBlock
|
|
168
|
-
key={index}
|
|
169
|
-
repeatContext={data.context}
|
|
170
|
-
block={data.block}
|
|
171
|
-
></RenderRepeatedBlock>
|
|
172
|
-
);
|
|
173
|
-
}}
|
|
174
|
-
</For>
|
|
175
|
-
</Show>
|
|
176
|
-
<Show when={!isEmptyHtmlElement(tag()) && !repeatItemData()}>
|
|
177
|
-
<Dynamic {...attributes()} {...actions()} component={tag()}>
|
|
166
|
+
<Show when={canShowBlock()}>
|
|
167
|
+
<Show
|
|
168
|
+
fallback={
|
|
178
169
|
<RenderComponent {...renderComponentProps()}></RenderComponent>
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
);
|
|
189
|
-
}}
|
|
190
|
-
</For>
|
|
191
|
-
<For each={childrenWithoutParentComponent()}>
|
|
192
|
-
{(child, _index) => {
|
|
170
|
+
}
|
|
171
|
+
when={!component()?.noWrap}
|
|
172
|
+
>
|
|
173
|
+
<Show when={isEmptyHtmlElement(tag())}>
|
|
174
|
+
<Dynamic {...attributes()} {...actions()} component={tag()}></Dynamic>
|
|
175
|
+
</Show>
|
|
176
|
+
<Show when={!isEmptyHtmlElement(tag()) && repeatItemData()}>
|
|
177
|
+
<For each={repeatItemData()}>
|
|
178
|
+
{(data, _index) => {
|
|
193
179
|
const index = _index();
|
|
194
180
|
return (
|
|
195
|
-
<
|
|
196
|
-
key={
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
></
|
|
181
|
+
<RenderRepeatedBlock
|
|
182
|
+
key={index}
|
|
183
|
+
repeatContext={data.context}
|
|
184
|
+
block={data.block}
|
|
185
|
+
></RenderRepeatedBlock>
|
|
200
186
|
);
|
|
201
187
|
}}
|
|
202
188
|
</For>
|
|
203
|
-
</
|
|
189
|
+
</Show>
|
|
190
|
+
<Show when={!isEmptyHtmlElement(tag()) && !repeatItemData()}>
|
|
191
|
+
<Dynamic {...attributes()} {...actions()} component={tag()}>
|
|
192
|
+
<RenderComponent {...renderComponentProps()}></RenderComponent>
|
|
193
|
+
<For each={childrenWithoutParentComponent()}>
|
|
194
|
+
{(child, _index) => {
|
|
195
|
+
const index = _index();
|
|
196
|
+
return (
|
|
197
|
+
<RenderBlock
|
|
198
|
+
key={"render-block-" + child.id}
|
|
199
|
+
block={child}
|
|
200
|
+
context={childrenContext()}
|
|
201
|
+
></RenderBlock>
|
|
202
|
+
);
|
|
203
|
+
}}
|
|
204
|
+
</For>
|
|
205
|
+
<For each={childrenWithoutParentComponent()}>
|
|
206
|
+
{(child, _index) => {
|
|
207
|
+
const index = _index();
|
|
208
|
+
return (
|
|
209
|
+
<BlockStyles
|
|
210
|
+
key={"block-style-" + child.id}
|
|
211
|
+
block={child}
|
|
212
|
+
context={childrenContext()}
|
|
213
|
+
></BlockStyles>
|
|
214
|
+
);
|
|
215
|
+
}}
|
|
216
|
+
</For>
|
|
217
|
+
</Dynamic>
|
|
218
|
+
</Show>
|
|
204
219
|
</Show>
|
|
205
220
|
</Show>
|
|
206
221
|
);
|