@builder.io/sdk-svelte 0.0.1-20 → 0.0.1-23
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/columns/component-info.js +25 -1
- package/src/blocks/custom-code/custom-code.svelte +59 -61
- package/src/blocks/embed/component-info.js +20 -1
- package/src/blocks/embed/embed.svelte +38 -56
- package/src/blocks/embed/helpers.js +9 -0
- package/src/blocks/form/form.svelte +264 -294
- package/src/blocks/fragment/fragment.svelte +1 -26
- package/src/blocks/image/component-info.js +47 -1
- package/src/blocks/image/image.helpers.js +48 -0
- package/src/blocks/image/image.svelte +121 -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 +57 -57
- 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 +252 -241
- package/src/components/render-inlined-styles.svelte +15 -45
- package/src/constants/builder-registered-components.js +4 -1
- 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/register-component.js +10 -18
- package/src/functions/sanitize-styles.js +5 -0
- package/src/functions/fast-clone.js +0 -4
|
@@ -1,59 +1,59 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
|
|
37
|
-
entry: symbolToUse.entry
|
|
2
|
+
import { onMount } from "svelte";
|
|
3
|
+
import { afterUpdate } from "svelte";
|
|
4
|
+
|
|
5
|
+
import RenderContent from "../../components/render-content/render-content.svelte";
|
|
6
|
+
import BuilderContext from "../../context/builder.context";
|
|
7
|
+
import { getContent } from "../../functions/get-content/index.js";
|
|
8
|
+
|
|
9
|
+
import { getContext, setContext } from "svelte";
|
|
10
|
+
|
|
11
|
+
export let attributes;
|
|
12
|
+
export let symbol;
|
|
13
|
+
|
|
14
|
+
let builderContext = getContext(BuilderContext.key);
|
|
15
|
+
|
|
16
|
+
let className = "builder-symbol";
|
|
17
|
+
let content = null;
|
|
18
|
+
|
|
19
|
+
onMount(() => {
|
|
20
|
+
content = symbol?.content;
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
function onUpdateFn_0() {
|
|
24
|
+
const symbolToUse = symbol;
|
|
25
|
+
|
|
26
|
+
if (symbolToUse && !symbolToUse.content && !content && symbolToUse.model) {
|
|
27
|
+
getContent({
|
|
28
|
+
model: symbolToUse.model,
|
|
29
|
+
apiKey: builderContext.apiKey,
|
|
30
|
+
options: {
|
|
31
|
+
entry: symbolToUse.entry,
|
|
32
|
+
},
|
|
33
|
+
}).then((response) => {
|
|
34
|
+
content = response;
|
|
35
|
+
});
|
|
36
|
+
}
|
|
38
37
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
...
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
38
|
+
$: onUpdateFn_0(...[symbol?.content, symbol?.model, symbol?.entry, content]);
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<div
|
|
42
|
+
{...attributes}
|
|
43
|
+
dataSet={{
|
|
44
|
+
class: className,
|
|
45
|
+
}}
|
|
46
|
+
class={className}
|
|
47
|
+
>
|
|
48
|
+
<RenderContent
|
|
49
|
+
apiKey={builderContext.apiKey}
|
|
50
|
+
context={builderContext.context}
|
|
51
|
+
data={{
|
|
52
|
+
...symbol?.data,
|
|
53
|
+
...builderContext.state,
|
|
54
|
+
...symbol?.content?.data?.state,
|
|
55
|
+
}}
|
|
56
|
+
model={symbol?.model}
|
|
57
|
+
{content}
|
|
58
|
+
/>
|
|
59
|
+
</div>
|
|
@@ -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
|
+
src={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}
|