@builder.io/sdk-svelte 0.1.5 → 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/button/component-info.js +0 -1
- package/package/blocks/columns/columns.svelte +5 -3
- package/package/blocks/columns/columns.svelte.d.ts +0 -3
- package/package/blocks/columns/component-info.js +0 -1
- package/package/blocks/custom-code/component-info.js +0 -1
- package/package/blocks/embed/component-info.js +0 -1
- package/package/blocks/form/component-info.js +0 -1
- package/package/blocks/fragment/component-info.js +0 -1
- package/package/blocks/image/component-info.js +0 -1
- package/package/blocks/img/component-info.js +0 -1
- package/package/blocks/input/component-info.js +0 -1
- package/package/blocks/raw-text/component-info.js +0 -1
- package/package/blocks/section/component-info.js +0 -1
- package/package/blocks/select/component-info.js +0 -1
- package/package/blocks/submit-button/component-info.js +0 -1
- package/package/blocks/symbol/component-info.js +0 -1
- package/package/blocks/text/component-info.js +0 -1
- package/package/blocks/textarea/component-info.js +0 -1
- package/package/blocks/video/component-info.js +0 -1
- package/package/components/render-block/render-block.svelte +0 -1
- package/package/components/render-block/render-component.svelte.d.ts +0 -3
- package/package/types/components.d.ts +0 -1
- package/package.json +1 -1
- package/src/blocks/button/component-info.ts +1 -1
- package/src/blocks/columns/columns.svelte +8 -5
- package/src/blocks/columns/component-info.ts +1 -1
- package/src/blocks/custom-code/component-info.ts +1 -1
- package/src/blocks/embed/component-info.ts +1 -1
- package/src/blocks/form/component-info.ts +1 -1
- package/src/blocks/fragment/component-info.ts +1 -1
- package/src/blocks/image/component-info.ts +1 -1
- package/src/blocks/img/component-info.ts +1 -1
- package/src/blocks/input/component-info.ts +1 -1
- package/src/blocks/raw-text/component-info.ts +1 -1
- package/src/blocks/section/component-info.ts +1 -1
- package/src/blocks/select/component-info.ts +1 -1
- package/src/blocks/submit-button/component-info.ts +1 -1
- package/src/blocks/symbol/component-info.ts +1 -1
- package/src/blocks/text/component-info.ts +1 -1
- package/src/blocks/textarea/component-info.ts +1 -1
- package/src/blocks/video/component-info.ts +1 -1
- package/src/components/render-block/render-block.svelte +0 -1
- package/src/components/render-block/render-component.svelte +0 -4
- package/src/types/components.ts +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: {
|
|
@@ -2,7 +2,6 @@ import { serializeFn } from '../util.js';
|
|
|
2
2
|
export const componentInfo = {
|
|
3
3
|
name: 'Image',
|
|
4
4
|
static: true,
|
|
5
|
-
builtIn: true,
|
|
6
5
|
image: 'https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4',
|
|
7
6
|
defaultStyles: {
|
|
8
7
|
position: 'relative',
|
|
@@ -2,7 +2,6 @@ export const componentInfo = {
|
|
|
2
2
|
// friendlyName?
|
|
3
3
|
name: 'Raw:Img',
|
|
4
4
|
hideFromInsertMenu: true,
|
|
5
|
-
builtIn: true,
|
|
6
5
|
image: 'https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4',
|
|
7
6
|
inputs: [
|
|
8
7
|
{
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export const componentInfo = {
|
|
2
2
|
name: 'Text',
|
|
3
3
|
static: true,
|
|
4
|
-
builtIn: true,
|
|
5
4
|
image: 'https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-text_fields-24px%20(1).svg?alt=media&token=12177b73-0ee3-42ca-98c6-0dd003de1929',
|
|
6
5
|
inputs: [
|
|
7
6
|
{
|
|
@@ -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: {
|
|
@@ -122,7 +122,6 @@ export interface ComponentInfo {
|
|
|
122
122
|
* Passing a list of model names will restrict using the component to only the models listed here, otherwise it'll be available for all models
|
|
123
123
|
*/
|
|
124
124
|
models?: string[];
|
|
125
|
-
builtIn: true;
|
|
126
125
|
/**
|
|
127
126
|
* Specify restrictions direct children must match
|
|
128
127
|
*/
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@ import type { ComponentInfo } from '../../types/components';
|
|
|
2
2
|
|
|
3
3
|
export const componentInfo: ComponentInfo = {
|
|
4
4
|
name: 'Core:Button',
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
image:
|
|
7
7
|
'https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F81a15681c3e74df09677dfc57a615b13',
|
|
8
8
|
defaultStyles: {
|
|
@@ -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 = () => {
|
|
@@ -4,7 +4,7 @@ import { serializeFn } from '../util.js';
|
|
|
4
4
|
export const componentInfo: ComponentInfo = {
|
|
5
5
|
name: 'Image',
|
|
6
6
|
static: true,
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
image:
|
|
9
9
|
'https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4',
|
|
10
10
|
defaultStyles: {
|
|
@@ -4,7 +4,7 @@ export const componentInfo: ComponentInfo = {
|
|
|
4
4
|
// friendlyName?
|
|
5
5
|
name: 'Raw:Img',
|
|
6
6
|
hideFromInsertMenu: true,
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
image:
|
|
9
9
|
'https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4',
|
|
10
10
|
inputs: [
|
|
@@ -2,7 +2,7 @@ import type { ComponentInfo } from '../../types/components';
|
|
|
2
2
|
|
|
3
3
|
export const componentInfo: ComponentInfo = {
|
|
4
4
|
name: 'Form:Input',
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
image:
|
|
7
7
|
'https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fad6f37889d9e40bbbbc72cdb5875d6ca',
|
|
8
8
|
inputs: [
|
|
@@ -3,7 +3,7 @@ import type { ComponentInfo } from '../../types/components';
|
|
|
3
3
|
export const componentInfo: ComponentInfo = {
|
|
4
4
|
name: 'Core:Section',
|
|
5
5
|
static: true,
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
image:
|
|
8
8
|
'https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a',
|
|
9
9
|
inputs: [
|
|
@@ -2,7 +2,7 @@ import type { ComponentInfo } from '../../types/components';
|
|
|
2
2
|
|
|
3
3
|
export const componentInfo: ComponentInfo = {
|
|
4
4
|
name: 'Form:Select',
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
image:
|
|
7
7
|
'https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F83acca093fb24aaf94dee136e9a4b045',
|
|
8
8
|
defaultStyles: {
|
|
@@ -2,7 +2,7 @@ import type { ComponentInfo } from '../../types/components';
|
|
|
2
2
|
|
|
3
3
|
export const componentInfo: ComponentInfo = {
|
|
4
4
|
name: 'Form:SubmitButton',
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
image:
|
|
7
7
|
'https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fdf2820ffed1f4349a94c40b3221f5b98',
|
|
8
8
|
defaultStyles: {
|
|
@@ -3,7 +3,7 @@ import type { ComponentInfo } from '../../types/components';
|
|
|
3
3
|
export const componentInfo: ComponentInfo = {
|
|
4
4
|
name: 'Text',
|
|
5
5
|
static: true,
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
image:
|
|
8
8
|
'https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-text_fields-24px%20(1).svg?alt=media&token=12177b73-0ee3-42ca-98c6-0dd003de1929',
|
|
9
9
|
inputs: [
|
|
@@ -2,7 +2,7 @@ import type { ComponentInfo } from '../../types/components';
|
|
|
2
2
|
|
|
3
3
|
export const componentInfo: ComponentInfo = {
|
|
4
4
|
name: 'Form:TextArea',
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
image:
|
|
7
7
|
'https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Ff74a2f3de58c4c3e939204e5b6b8f6c3',
|
|
8
8
|
inputs: [
|
|
@@ -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
|
|
package/src/types/components.ts
CHANGED
|
@@ -118,10 +118,6 @@ export interface ComponentInfo {
|
|
|
118
118
|
*/
|
|
119
119
|
models?: string[];
|
|
120
120
|
|
|
121
|
-
// TO-DO specific to new SDKs?
|
|
122
|
-
// not used in visual editor. Can likely be removed
|
|
123
|
-
builtIn: true;
|
|
124
|
-
|
|
125
121
|
/**
|
|
126
122
|
* Specify restrictions direct children must match
|
|
127
123
|
*/
|