@builder.io/sdk-svelte 0.1.6 → 0.1.7
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/--package.json +1 -1
- package/package/CHANGELOG.md +4 -0
- package/package/blocks/columns/columns.svelte +5 -3
- package/package/blocks/columns/columns.svelte.d.ts +0 -3
- package/package/components/render-block/render-block.svelte +0 -1
- package/package/components/render-block/render-component.svelte.d.ts +0 -3
- package/package.json +1 -1
- package/src/blocks/columns/columns.svelte +8 -5
- package/src/components/render-block/render-block.svelte +0 -1
- package/src/components/render-block/render-component.svelte +0 -4
package/package/--package.json
CHANGED
package/package/CHANGELOG.md
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
<script context="module"></script>
|
|
2
2
|
|
|
3
|
-
<script>import
|
|
3
|
+
<script>import { getContext } from "svelte";
|
|
4
|
+
import RenderBlocks from "../../components/render-blocks.svelte";
|
|
4
5
|
import { getSizesForBreakpoints } from "../../constants/device-sizes";
|
|
5
6
|
import RenderInlinedStyles from "../../components/render-inlined-styles.svelte";
|
|
6
7
|
import { TARGET } from "../../constants/target.js";
|
|
7
8
|
import { convertStyleMapToCSS } from "../../helpers/css";
|
|
9
|
+
import BuilderContext from "../../context/builder.context.js";
|
|
8
10
|
export let space;
|
|
9
11
|
export let columns;
|
|
10
12
|
export let stackColumnsAt;
|
|
11
13
|
export let reverseColumnsWhenStacked;
|
|
12
|
-
export let customBreakpoints;
|
|
13
14
|
export let builderBlock;
|
|
14
15
|
function mitosis_styling(node, vars) {
|
|
15
16
|
Object.entries(vars || {}).forEach(([p, v]) => {
|
|
@@ -21,6 +22,7 @@ function mitosis_styling(node, vars) {
|
|
|
21
22
|
}
|
|
22
23
|
});
|
|
23
24
|
}
|
|
25
|
+
let builderContext = getContext(BuilderContext.key);
|
|
24
26
|
function getGutterSize() {
|
|
25
27
|
return typeof space === "number" ? space || 0 : 20;
|
|
26
28
|
}
|
|
@@ -42,7 +44,7 @@ function maybeApplyForTablet(prop) {
|
|
|
42
44
|
return _stackColumnsAt === "tablet" ? prop : "inherit";
|
|
43
45
|
}
|
|
44
46
|
function getWidthForBreakpointSize(size) {
|
|
45
|
-
const breakpointSizes = getSizesForBreakpoints(
|
|
47
|
+
const breakpointSizes = getSizesForBreakpoints(builderContext.content?.meta?.breakpoints || {});
|
|
46
48
|
return breakpointSizes[size].max;
|
|
47
49
|
}
|
|
48
50
|
$: columnsCssVars = () => {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
2
|
import type { BuilderBlock } from "../../types/builder-block";
|
|
3
|
-
import type { Breakpoints } from "../../types/builder-content";
|
|
4
3
|
declare type Column = {
|
|
5
4
|
blocks: any;
|
|
6
5
|
width?: number;
|
|
@@ -12,7 +11,6 @@ export interface ColumnProps {
|
|
|
12
11
|
space?: number;
|
|
13
12
|
stackColumnsAt?: StackColumnsAt;
|
|
14
13
|
reverseColumnsWhenStacked?: boolean;
|
|
15
|
-
customBreakpoints?: Breakpoints;
|
|
16
14
|
}
|
|
17
15
|
declare const __propDef: {
|
|
18
16
|
props: {
|
|
@@ -20,7 +18,6 @@ declare const __propDef: {
|
|
|
20
18
|
columns: ColumnProps["columns"];
|
|
21
19
|
stackColumnsAt: ColumnProps["stackColumnsAt"];
|
|
22
20
|
reverseColumnsWhenStacked: ColumnProps["reverseColumnsWhenStacked"];
|
|
23
|
-
customBreakpoints: ColumnProps["customBreakpoints"];
|
|
24
21
|
builderBlock: ColumnProps["builderBlock"];
|
|
25
22
|
};
|
|
26
23
|
events: {
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
2
|
import type { BuilderBlock } from "../../types/builder-block.js";
|
|
3
3
|
import type { BuilderContextInterface } from "../../context/types.js";
|
|
4
|
-
import type { Breakpoints } from "../../types/builder-content.js";
|
|
5
4
|
declare type ComponentOptions = {
|
|
6
5
|
[index: string]: any;
|
|
7
|
-
customBreakpoints?: Breakpoints;
|
|
8
6
|
attributes?: {
|
|
9
7
|
[index: string]: any;
|
|
10
8
|
};
|
|
@@ -14,7 +12,6 @@ export interface RenderComponentProps {
|
|
|
14
12
|
componentOptions: ComponentOptions;
|
|
15
13
|
blockChildren: BuilderBlock[];
|
|
16
14
|
context: BuilderContextInterface;
|
|
17
|
-
customBreakpoints?: Breakpoints;
|
|
18
15
|
}
|
|
19
16
|
declare const __propDef: {
|
|
20
17
|
props: {
|
package/package.json
CHANGED
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
|
|
4
4
|
import type { SizeName } from "../../constants/device-sizes";
|
|
5
5
|
|
|
6
|
-
import type { Breakpoints } from "../../types/builder-content";
|
|
7
|
-
|
|
8
6
|
type Column = {
|
|
9
7
|
blocks: any;
|
|
10
8
|
// TODO: Implement this when support for dynamic CSS lands
|
|
@@ -23,22 +21,23 @@
|
|
|
23
21
|
stackColumnsAt?: StackColumnsAt;
|
|
24
22
|
// TODO: Implement this when support for dynamic CSS lands
|
|
25
23
|
reverseColumnsWhenStacked?: boolean;
|
|
26
|
-
customBreakpoints?: Breakpoints;
|
|
27
24
|
}
|
|
28
25
|
</script>
|
|
29
26
|
|
|
30
27
|
<script lang="ts">
|
|
28
|
+
import { getContext } from "svelte";
|
|
29
|
+
|
|
31
30
|
import RenderBlocks from "../../components/render-blocks.svelte";
|
|
32
31
|
import { getSizesForBreakpoints } from "../../constants/device-sizes";
|
|
33
32
|
import RenderInlinedStyles from "../../components/render-inlined-styles.svelte";
|
|
34
33
|
import { TARGET } from "../../constants/target.js";
|
|
35
34
|
import { convertStyleMapToCSS } from "../../helpers/css";
|
|
35
|
+
import BuilderContext from "../../context/builder.context.js";
|
|
36
36
|
|
|
37
37
|
export let space: ColumnProps["space"];
|
|
38
38
|
export let columns: ColumnProps["columns"];
|
|
39
39
|
export let stackColumnsAt: ColumnProps["stackColumnsAt"];
|
|
40
40
|
export let reverseColumnsWhenStacked: ColumnProps["reverseColumnsWhenStacked"];
|
|
41
|
-
export let customBreakpoints: ColumnProps["customBreakpoints"];
|
|
42
41
|
export let builderBlock: ColumnProps["builderBlock"];
|
|
43
42
|
|
|
44
43
|
function mitosis_styling(node, vars) {
|
|
@@ -51,6 +50,8 @@
|
|
|
51
50
|
});
|
|
52
51
|
}
|
|
53
52
|
|
|
53
|
+
let builderContext = getContext(BuilderContext.key);
|
|
54
|
+
|
|
54
55
|
function getGutterSize() {
|
|
55
56
|
return typeof space === "number" ? space || 0 : 20;
|
|
56
57
|
}
|
|
@@ -72,7 +73,9 @@
|
|
|
72
73
|
return _stackColumnsAt === "tablet" ? prop : "inherit";
|
|
73
74
|
}
|
|
74
75
|
function getWidthForBreakpointSize(size) {
|
|
75
|
-
const breakpointSizes = getSizesForBreakpoints(
|
|
76
|
+
const breakpointSizes = getSizesForBreakpoints(
|
|
77
|
+
builderContext.content?.meta?.breakpoints || {}
|
|
78
|
+
);
|
|
76
79
|
return breakpointSizes[size].max;
|
|
77
80
|
}
|
|
78
81
|
$: columnsCssVars = () => {
|
|
@@ -3,11 +3,8 @@
|
|
|
3
3
|
|
|
4
4
|
import type { BuilderContextInterface } from "../../context/types.js";
|
|
5
5
|
|
|
6
|
-
import type { Breakpoints } from "../../types/builder-content.js";
|
|
7
|
-
|
|
8
6
|
type ComponentOptions = {
|
|
9
7
|
[index: string]: any;
|
|
10
|
-
customBreakpoints?: Breakpoints;
|
|
11
8
|
attributes?: {
|
|
12
9
|
[index: string]: any;
|
|
13
10
|
};
|
|
@@ -18,7 +15,6 @@
|
|
|
18
15
|
componentOptions: ComponentOptions;
|
|
19
16
|
blockChildren: BuilderBlock[];
|
|
20
17
|
context: BuilderContextInterface;
|
|
21
|
-
customBreakpoints?: Breakpoints;
|
|
22
18
|
}
|
|
23
19
|
</script>
|
|
24
20
|
|