@builder.io/sdk-svelte 0.0.1-19 → 0.0.1-21
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 +1 -1
- package/src/blocks/button/button.svelte +17 -48
- package/src/blocks/columns/columns.svelte +110 -102
- package/src/blocks/custom-code/custom-code.svelte +59 -61
- package/src/blocks/embed/embed.svelte +50 -57
- package/src/blocks/form/form.svelte +264 -294
- package/src/blocks/fragment/fragment.svelte +1 -26
- package/src/blocks/image/image.svelte +85 -117
- package/src/blocks/img/img.svelte +22 -32
- package/src/blocks/input/input.svelte +17 -30
- package/src/blocks/raw-text/raw-text.svelte +4 -26
- package/src/blocks/section/section.svelte +20 -36
- package/src/blocks/select/select.svelte +16 -36
- package/src/blocks/submit-button/submit-button.svelte +4 -30
- package/src/blocks/symbol/symbol.svelte +64 -52
- package/src/blocks/text/text.svelte +1 -25
- package/src/blocks/textarea/textarea.svelte +5 -29
- package/src/blocks/video/video.svelte +35 -43
- package/src/components/render-block/block-styles.svelte +49 -59
- package/src/components/render-block/render-block.svelte +197 -167
- package/src/components/render-block/render-component.svelte +13 -51
- package/src/components/render-block/render-repeated-block.svelte +29 -0
- package/src/components/render-blocks.svelte +74 -98
- package/src/components/render-content/components/render-styles.svelte +42 -62
- package/src/components/render-content/render-content.svelte +257 -231
- package/src/components/render-inlined-styles.svelte +15 -45
- package/src/context/builder.context.js +7 -1
- package/src/functions/convert-style-object.js +6 -0
- package/src/functions/get-block-styles.js +6 -3
- package/src/functions/get-processed-block.js +15 -8
- package/src/functions/get-processed-block.test.js +2 -1
- package/src/functions/sanitize-styles.js +5 -0
|
@@ -1,33 +1,9 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
2
|
export let attributes;
|
|
14
|
-
export let placeholder;
|
|
15
|
-
export let name;
|
|
16
|
-
export let value;
|
|
17
|
-
export let defaultValue;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
3
|
+
export let placeholder;
|
|
4
|
+
export let name;
|
|
5
|
+
export let value;
|
|
6
|
+
export let defaultValue;
|
|
31
7
|
</script>
|
|
32
8
|
|
|
33
|
-
<textarea {...attributes}
|
|
9
|
+
<textarea {...attributes} {placeholder} {name} {value} {defaultValue} />
|
|
@@ -1,46 +1,38 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
export let attributes;
|
|
3
|
+
export let fit;
|
|
4
|
+
export let position;
|
|
5
|
+
export let video;
|
|
6
|
+
export let posterImage;
|
|
7
|
+
export let autoPlay;
|
|
8
|
+
export let muted;
|
|
9
|
+
export let controls;
|
|
10
|
+
export let loop;
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
function mitosis_styling(node, vars) {
|
|
13
|
+
Object.entries(vars).forEach(([p, v]) => {
|
|
14
|
+
node.style[p] = v;
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
</script>
|
|
11
18
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
</script>
|
|
36
|
-
|
|
37
|
-
<video {...attributes} preload="none" style={{
|
|
38
|
-
width: '100%',
|
|
39
|
-
height: '100%',
|
|
40
|
-
...attributes?.style,
|
|
41
|
-
objectFit: fit,
|
|
42
|
-
objectPosition: position,
|
|
43
|
-
// Hack to get object fit to work as expected and
|
|
44
|
-
// not have the video overflow
|
|
45
|
-
borderRadius: 1
|
|
46
|
-
}} key={video || 'no-src'} poster={posterImage} autoPlay={autoPlay} muted={muted} controls={controls} loop={loop} ></video>
|
|
19
|
+
<video
|
|
20
|
+
{...attributes}
|
|
21
|
+
use:mitosis_styling={{
|
|
22
|
+
width: "100%",
|
|
23
|
+
height: "100%",
|
|
24
|
+
...attributes?.style,
|
|
25
|
+
objectFit: fit,
|
|
26
|
+
objectPosition: position,
|
|
27
|
+
// Hack to get object fit to work as expected and
|
|
28
|
+
// not have the video overflow
|
|
29
|
+
borderRadius: 1,
|
|
30
|
+
}}
|
|
31
|
+
preload="none"
|
|
32
|
+
key={video || "no-src"}
|
|
33
|
+
poster={posterImage}
|
|
34
|
+
{autoPlay}
|
|
35
|
+
{muted}
|
|
36
|
+
{controls}
|
|
37
|
+
{loop}
|
|
38
|
+
/>
|
|
@@ -1,65 +1,55 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
${mediumStyles ? `${getMaxWidthQueryForSize('medium')} {
|
|
2
|
+
import { TARGET } from "../../constants/target.js";
|
|
3
|
+
import BuilderContext from "../../context/builder.context";
|
|
4
|
+
import { getProcessedBlock } from "../../functions/get-processed-block.js";
|
|
5
|
+
import RenderInlinedStyles from "../render-inlined-styles.svelte";
|
|
6
|
+
import { convertStyleMaptoCSS } from "../../helpers/css.js";
|
|
7
|
+
import { getMaxWidthQueryForSize } from "../../constants/device-sizes.js";
|
|
8
|
+
|
|
9
|
+
import { getContext, setContext } from "svelte";
|
|
10
|
+
|
|
11
|
+
export let block;
|
|
12
|
+
|
|
13
|
+
$: useBlock = () => {
|
|
14
|
+
return getProcessedBlock({
|
|
15
|
+
block: block,
|
|
16
|
+
state: builderContext.state,
|
|
17
|
+
context: builderContext.context,
|
|
18
|
+
evaluateBindings: true,
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
$: css = () => {
|
|
23
|
+
const styles = useBlock().responsiveStyles;
|
|
24
|
+
const largeStyles = styles?.large;
|
|
25
|
+
const mediumStyles = styles?.medium;
|
|
26
|
+
const smallStyles = styles?.small;
|
|
27
|
+
return `
|
|
28
|
+
${
|
|
29
|
+
largeStyles
|
|
30
|
+
? `.${useBlock().id} {${convertStyleMaptoCSS(largeStyles)}}`
|
|
31
|
+
: ""
|
|
32
|
+
}
|
|
33
|
+
${
|
|
34
|
+
mediumStyles
|
|
35
|
+
? `${getMaxWidthQueryForSize("medium")} {
|
|
37
36
|
.${useBlock().id} {${convertStyleMaptoCSS(mediumStyles)}}
|
|
38
|
-
}`
|
|
39
|
-
|
|
37
|
+
}`
|
|
38
|
+
: ""
|
|
39
|
+
}
|
|
40
|
+
${
|
|
41
|
+
smallStyles
|
|
42
|
+
? `${getMaxWidthQueryForSize("small")} {
|
|
40
43
|
.${useBlock().id} {${convertStyleMaptoCSS(smallStyles)}}
|
|
41
|
-
}`
|
|
44
|
+
}`
|
|
45
|
+
: ""
|
|
46
|
+
}
|
|
42
47
|
}`;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
let builderContext = getContext(BuilderContext.key);
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
</script>
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
{#if TARGET === 'vue2' || TARGET === 'vue3' || TARGET === 'svelte' }
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
<RenderInlinedStyles styles={css()} ></RenderInlinedStyles>
|
|
61
|
-
|
|
62
|
-
|
|
48
|
+
};
|
|
63
49
|
|
|
50
|
+
let builderContext = getContext(BuilderContext.key);
|
|
51
|
+
</script>
|
|
64
52
|
|
|
65
|
-
{
|
|
53
|
+
{#if TARGET === "vue2" || TARGET === "vue3" || TARGET === "svelte"}
|
|
54
|
+
<RenderInlinedStyles styles={css()} />
|
|
55
|
+
{/if}
|
|
@@ -1,172 +1,202 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
|
|
15
|
-
import
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
console.warn(`
|
|
2
|
+
import BuilderContext from "../../context/builder.context";
|
|
3
|
+
import { getBlockActions } from "../../functions/get-block-actions.js";
|
|
4
|
+
import { getBlockComponentOptions } from "../../functions/get-block-component-options.js";
|
|
5
|
+
import { getBlockProperties } from "../../functions/get-block-properties.js";
|
|
6
|
+
import { getBlockStyles } from "../../functions/get-block-styles.js";
|
|
7
|
+
import { getBlockTag } from "../../functions/get-block-tag.js";
|
|
8
|
+
import { getProcessedBlock } from "../../functions/get-processed-block.js";
|
|
9
|
+
import { evaluate } from "../../functions/evaluate.js";
|
|
10
|
+
import BlockStyles from "./block-styles.svelte";
|
|
11
|
+
import { isEmptyHtmlElement } from "./render-block.helpers.js";
|
|
12
|
+
import RenderComponent from "./render-component.svelte";
|
|
13
|
+
import RenderRepeatedBlock from "./render-repeated-block.svelte";
|
|
14
|
+
|
|
15
|
+
import { getContext, setContext } from "svelte";
|
|
16
|
+
|
|
17
|
+
export let block;
|
|
18
|
+
|
|
19
|
+
$: component = () => {
|
|
20
|
+
const componentName = getProcessedBlock({
|
|
21
|
+
block: block,
|
|
22
|
+
state: builderContext.state,
|
|
23
|
+
context: builderContext.context,
|
|
24
|
+
evaluateBindings: false,
|
|
25
|
+
}).component?.name;
|
|
26
|
+
|
|
27
|
+
if (!componentName) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const ref = builderContext.registeredComponents[componentName];
|
|
32
|
+
|
|
33
|
+
if (!ref) {
|
|
34
|
+
// TODO: Public doc page with more info about this message
|
|
35
|
+
console.warn(`
|
|
37
36
|
Could not find a registered component named "${componentName}".
|
|
38
37
|
If you registered it, is the file that registered it imported by the file that needs to render it?`);
|
|
39
|
-
|
|
40
|
-
} else {
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
$: componentInfo = () => {
|
|
46
|
-
if (component()) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
});
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
$: attributes = () => {
|
|
74
|
-
return {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
return
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
38
|
+
return undefined;
|
|
39
|
+
} else {
|
|
40
|
+
return ref;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
$: componentInfo = () => {
|
|
45
|
+
if (component()) {
|
|
46
|
+
const { component: _, ...info } = component();
|
|
47
|
+
return info;
|
|
48
|
+
} else {
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
$: componentRef = () => {
|
|
54
|
+
return component?.()?.component;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
$: tagName = () => {
|
|
58
|
+
return getBlockTag(useBlock());
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
$: useBlock = () => {
|
|
62
|
+
return repeatItemData()
|
|
63
|
+
? block
|
|
64
|
+
: getProcessedBlock({
|
|
65
|
+
block: block,
|
|
66
|
+
state: builderContext.state,
|
|
67
|
+
context: builderContext.context,
|
|
68
|
+
evaluateBindings: true,
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
$: attributes = () => {
|
|
73
|
+
return {
|
|
74
|
+
...getBlockProperties(useBlock()),
|
|
75
|
+
...getBlockActions({
|
|
76
|
+
block: useBlock(),
|
|
77
|
+
state: builderContext.state,
|
|
78
|
+
context: builderContext.context,
|
|
79
|
+
}),
|
|
80
|
+
style: getBlockStyles(useBlock()),
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
$: shouldWrap = () => {
|
|
85
|
+
return !componentInfo?.()?.noWrap;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
$: componentOptions = () => {
|
|
89
|
+
return {
|
|
90
|
+
...getBlockComponentOptions(useBlock()),
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* These attributes are passed to the wrapper element when there is one. If `noWrap` is set to true, then
|
|
94
|
+
* they are provided to the component itself directly.
|
|
95
|
+
*/
|
|
96
|
+
...(shouldWrap()
|
|
97
|
+
? {}
|
|
98
|
+
: {
|
|
99
|
+
attributes: attributes(),
|
|
100
|
+
}),
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
$: renderComponentProps = () => {
|
|
105
|
+
return {
|
|
106
|
+
blockChildren: children(),
|
|
107
|
+
componentRef: componentRef(),
|
|
108
|
+
componentOptions: componentOptions(),
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
$: children = () => {
|
|
113
|
+
// TO-DO: When should `canHaveChildren` dictate rendering?
|
|
114
|
+
// This is currently commented out because some Builder components (e.g. Box) do not have `canHaveChildren: true`,
|
|
115
|
+
// but still receive and need to render children.
|
|
116
|
+
// return componentInfo?.()?.canHaveChildren ? useBlock().children : [];
|
|
117
|
+
return useBlock().children ?? [];
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
$: childrenWithoutParentComponent = () => {
|
|
121
|
+
/**
|
|
122
|
+
* When there is no `componentRef`, there might still be children that need to be rendered. In this case,
|
|
123
|
+
* we render them outside of `componentRef`.
|
|
124
|
+
* NOTE: We make sure not to render this if `repeatItemData` is non-null, because that means we are rendering an array of
|
|
125
|
+
* blocks, and the children will be repeated within those blocks.
|
|
126
|
+
*/
|
|
127
|
+
const shouldRenderChildrenOutsideRef = !componentRef() && !repeatItemData();
|
|
128
|
+
return shouldRenderChildrenOutsideRef ? children() : [];
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
$: repeatItemData = () => {
|
|
132
|
+
/**
|
|
133
|
+
* we don't use `useBlock()` here because the processing done within its logic includes evaluating the block's bindings,
|
|
134
|
+
* which will not work if there is a repeat.
|
|
135
|
+
*/
|
|
136
|
+
const { repeat, ...blockWithoutRepeat } = block;
|
|
137
|
+
|
|
138
|
+
if (!repeat?.collection) {
|
|
139
|
+
return undefined;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const { collection, itemName } = repeat;
|
|
143
|
+
const itemsArray = evaluate({
|
|
144
|
+
code: collection,
|
|
145
|
+
state: builderContext.state,
|
|
146
|
+
context: builderContext.context,
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
if (Array.isArray(itemsArray)) {
|
|
150
|
+
const collectionName = collection.split(".").pop();
|
|
151
|
+
const itemNameToUse =
|
|
152
|
+
itemName || (collectionName ? collectionName + "Item" : "item");
|
|
153
|
+
const repeatArray = itemsArray.map((item, index) => ({
|
|
154
|
+
context: {
|
|
155
|
+
...builderContext,
|
|
156
|
+
state: {
|
|
157
|
+
...builderContext.state,
|
|
158
|
+
$index: index,
|
|
159
|
+
$item: item,
|
|
160
|
+
[itemNameToUse]: item,
|
|
161
|
+
[`$${itemNameToUse}Index`]: index,
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
block: blockWithoutRepeat,
|
|
165
|
+
}));
|
|
166
|
+
return repeatArray;
|
|
167
|
+
} else {
|
|
168
|
+
return undefined;
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
let builderContext = getContext(BuilderContext.key);
|
|
173
|
+
</script>
|
|
174
|
+
|
|
175
|
+
{#if shouldWrap()}
|
|
176
|
+
{#if !isEmptyHtmlElement(tagName())}
|
|
177
|
+
<svelte:element this={tagName()} {...attributes()}>
|
|
178
|
+
{#if repeatItemData()}
|
|
179
|
+
{#each repeatItemData() as data, index (index)}
|
|
180
|
+
<RenderRepeatedBlock
|
|
181
|
+
repeatContext={data.context}
|
|
182
|
+
block={data.block}
|
|
183
|
+
/>
|
|
184
|
+
{/each}
|
|
185
|
+
{:else}
|
|
186
|
+
<RenderComponent {...renderComponentProps()} />
|
|
187
|
+
{/if}
|
|
188
|
+
|
|
189
|
+
{#each childrenWithoutParentComponent() as child, undefined ("render-block-" + child.id)}
|
|
190
|
+
<svelte:self block={child} />
|
|
191
|
+
{/each}
|
|
192
|
+
|
|
193
|
+
{#each childrenWithoutParentComponent() as child, undefined ("block-style-" + child.id)}
|
|
194
|
+
<BlockStyles block={child} />
|
|
195
|
+
{/each}
|
|
196
|
+
</svelte:element>
|
|
197
|
+
{:else}
|
|
198
|
+
<svelte:element this={tagName()} {...attributes()} />
|
|
199
|
+
{/if}
|
|
161
200
|
{:else}
|
|
162
|
-
<
|
|
163
|
-
|
|
201
|
+
<RenderComponent {...renderComponentProps()} />
|
|
164
202
|
{/if}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
{:else}
|
|
170
|
-
<RenderComponent blockChildren={children()} componentRef={componentRef()} componentOptions={componentOptions()} ></RenderComponent>
|
|
171
|
-
|
|
172
|
-
{/if}
|
|
@@ -1,58 +1,20 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import BlockStyles from './block-styles.svelte';
|
|
7
|
-
import RenderBlock from './render-block.svelte';
|
|
2
|
+
import BlockStyles from "./block-styles.svelte";
|
|
3
|
+
import RenderBlock from "./render-block.svelte";
|
|
8
4
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
5
|
export let componentRef;
|
|
15
|
-
export let componentOptions;
|
|
16
|
-
export let blockChildren;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
6
|
+
export let componentOptions;
|
|
7
|
+
export let blockChildren;
|
|
30
8
|
</script>
|
|
31
9
|
|
|
10
|
+
{#if componentRef}
|
|
11
|
+
<svelte:component this={componentRef} {...componentOptions}>
|
|
12
|
+
{#each blockChildren as child, undefined ("render-block-" + child.id)}
|
|
13
|
+
<RenderBlock block={child} />
|
|
14
|
+
{/each}
|
|
32
15
|
|
|
33
|
-
{#
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
<svelte:component {...componentOptions} this={componentRef} >
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
{#each blockChildren as child, index }
|
|
42
|
-
<RenderBlock key={'render-block-' + child.id} block={child} ></RenderBlock>
|
|
43
|
-
{/each}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
{#each blockChildren as child, index }
|
|
49
|
-
<BlockStyles key={'block-style-' + child.id} block={child} ></BlockStyles>
|
|
50
|
-
{/each}
|
|
51
|
-
|
|
52
|
-
|
|
16
|
+
{#each blockChildren as child, undefined ("block-style-" + child.id)}
|
|
17
|
+
<BlockStyles block={child} />
|
|
18
|
+
{/each}
|
|
53
19
|
</svelte:component>
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
{/if}
|
|
20
|
+
{/if}
|