@builder.io/sdk-svelte 0.7.4 → 0.7.6
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/lib/browser/components/block/block.svelte +8 -7
- package/lib/browser/components/content/content.helpers.d.ts +1 -1
- package/lib/browser/components/content/content.helpers.js +5 -7
- package/lib/browser/constants/sdk-version.d.ts +1 -1
- package/lib/browser/constants/sdk-version.js +1 -1
- package/lib/edge/components/block/block.svelte +8 -7
- package/lib/edge/components/content/content.helpers.d.ts +1 -1
- package/lib/edge/components/content/content.helpers.js +5 -7
- package/lib/edge/constants/sdk-version.d.ts +1 -1
- package/lib/edge/constants/sdk-version.js +1 -1
- package/lib/node/components/block/block.svelte +8 -7
- package/lib/node/components/content/content.helpers.d.ts +1 -1
- package/lib/node/components/content/content.helpers.js +5 -7
- package/lib/node/constants/sdk-version.d.ts +1 -1
- package/lib/node/constants/sdk-version.js +1 -1
- package/package.json +1 -1
- package/src/components/block/block.svelte +9 -7
- package/src/components/content/content.helpers.ts +5 -7
- package/src/constants/sdk-version.ts +1 -1
|
@@ -27,7 +27,7 @@ $: repeatItem = () => {
|
|
|
27
27
|
});
|
|
28
28
|
};
|
|
29
29
|
$: processedBlock = () => {
|
|
30
|
-
return
|
|
30
|
+
return block.repeat?.collection
|
|
31
31
|
? block
|
|
32
32
|
: getProcessedBlock({
|
|
33
33
|
block: block,
|
|
@@ -42,13 +42,14 @@ $: Tag = () => {
|
|
|
42
42
|
return block.tagName || "div";
|
|
43
43
|
};
|
|
44
44
|
$: canShowBlock = () => {
|
|
45
|
-
if (
|
|
46
|
-
|
|
45
|
+
if (block.repeat?.collection) {
|
|
46
|
+
if (repeatItem?.()?.length)
|
|
47
|
+
return true;
|
|
48
|
+
return false;
|
|
47
49
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return true;
|
|
50
|
+
const shouldHide = "hide" in processedBlock() ? processedBlock().hide : false;
|
|
51
|
+
const shouldShow = "show" in processedBlock() ? processedBlock().show : true;
|
|
52
|
+
return shouldShow && !shouldHide;
|
|
52
53
|
};
|
|
53
54
|
$: childrenWithoutParentComponent = () => {
|
|
54
55
|
/**
|
|
@@ -2,6 +2,6 @@ import type { BuilderContent } from '../../types/builder-content.js';
|
|
|
2
2
|
import type { Nullable } from '../../types/typescript.js';
|
|
3
3
|
import type { ContentProps } from './content.types.js';
|
|
4
4
|
export declare const getContextStateInitialValue: ({ content, data, locale }: Pick<ContentProps, 'content' | 'data' | 'locale'>) => {
|
|
5
|
-
|
|
5
|
+
locale?: string | undefined;
|
|
6
6
|
};
|
|
7
7
|
export declare const getContentInitialValue: ({ content, data }: Pick<ContentProps, 'content' | 'data'>) => Nullable<BuilderContent>;
|
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
export const getContextStateInitialValue = ({ content, data, locale }) => {
|
|
2
2
|
const defaultValues = {};
|
|
3
|
+
const initialState = content?.data?.state || {};
|
|
3
4
|
// set default values for content state inputs
|
|
4
5
|
content?.data?.inputs?.forEach(input => {
|
|
5
|
-
if (input.name && input.defaultValue !== undefined
|
|
6
|
+
if (input.name && input.defaultValue !== undefined) {
|
|
6
7
|
defaultValues[input.name] = input.defaultValue;
|
|
7
8
|
}
|
|
8
9
|
});
|
|
9
|
-
|
|
10
|
-
...
|
|
10
|
+
return {
|
|
11
|
+
...defaultValues,
|
|
12
|
+
...initialState,
|
|
11
13
|
...data,
|
|
12
14
|
...(locale ? {
|
|
13
15
|
locale
|
|
14
16
|
} : {})
|
|
15
17
|
};
|
|
16
|
-
return {
|
|
17
|
-
...defaultValues,
|
|
18
|
-
...stateToUse
|
|
19
|
-
};
|
|
20
18
|
};
|
|
21
19
|
export const getContentInitialValue = ({ content, data }) => {
|
|
22
20
|
return !content ? undefined : {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.7.
|
|
1
|
+
export declare const SDK_VERSION = "0.7.6";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.7.
|
|
1
|
+
export const SDK_VERSION = "0.7.6";
|
|
@@ -27,7 +27,7 @@ $: repeatItem = () => {
|
|
|
27
27
|
});
|
|
28
28
|
};
|
|
29
29
|
$: processedBlock = () => {
|
|
30
|
-
return
|
|
30
|
+
return block.repeat?.collection
|
|
31
31
|
? block
|
|
32
32
|
: getProcessedBlock({
|
|
33
33
|
block: block,
|
|
@@ -42,13 +42,14 @@ $: Tag = () => {
|
|
|
42
42
|
return block.tagName || "div";
|
|
43
43
|
};
|
|
44
44
|
$: canShowBlock = () => {
|
|
45
|
-
if (
|
|
46
|
-
|
|
45
|
+
if (block.repeat?.collection) {
|
|
46
|
+
if (repeatItem?.()?.length)
|
|
47
|
+
return true;
|
|
48
|
+
return false;
|
|
47
49
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return true;
|
|
50
|
+
const shouldHide = "hide" in processedBlock() ? processedBlock().hide : false;
|
|
51
|
+
const shouldShow = "show" in processedBlock() ? processedBlock().show : true;
|
|
52
|
+
return shouldShow && !shouldHide;
|
|
52
53
|
};
|
|
53
54
|
$: childrenWithoutParentComponent = () => {
|
|
54
55
|
/**
|
|
@@ -2,6 +2,6 @@ import type { BuilderContent } from '../../types/builder-content.js';
|
|
|
2
2
|
import type { Nullable } from '../../types/typescript.js';
|
|
3
3
|
import type { ContentProps } from './content.types.js';
|
|
4
4
|
export declare const getContextStateInitialValue: ({ content, data, locale }: Pick<ContentProps, 'content' | 'data' | 'locale'>) => {
|
|
5
|
-
|
|
5
|
+
locale?: string | undefined;
|
|
6
6
|
};
|
|
7
7
|
export declare const getContentInitialValue: ({ content, data }: Pick<ContentProps, 'content' | 'data'>) => Nullable<BuilderContent>;
|
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
export const getContextStateInitialValue = ({ content, data, locale }) => {
|
|
2
2
|
const defaultValues = {};
|
|
3
|
+
const initialState = content?.data?.state || {};
|
|
3
4
|
// set default values for content state inputs
|
|
4
5
|
content?.data?.inputs?.forEach(input => {
|
|
5
|
-
if (input.name && input.defaultValue !== undefined
|
|
6
|
+
if (input.name && input.defaultValue !== undefined) {
|
|
6
7
|
defaultValues[input.name] = input.defaultValue;
|
|
7
8
|
}
|
|
8
9
|
});
|
|
9
|
-
|
|
10
|
-
...
|
|
10
|
+
return {
|
|
11
|
+
...defaultValues,
|
|
12
|
+
...initialState,
|
|
11
13
|
...data,
|
|
12
14
|
...(locale ? {
|
|
13
15
|
locale
|
|
14
16
|
} : {})
|
|
15
17
|
};
|
|
16
|
-
return {
|
|
17
|
-
...defaultValues,
|
|
18
|
-
...stateToUse
|
|
19
|
-
};
|
|
20
18
|
};
|
|
21
19
|
export const getContentInitialValue = ({ content, data }) => {
|
|
22
20
|
return !content ? undefined : {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.7.
|
|
1
|
+
export declare const SDK_VERSION = "0.7.6";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.7.
|
|
1
|
+
export const SDK_VERSION = "0.7.6";
|
|
@@ -27,7 +27,7 @@ $: repeatItem = () => {
|
|
|
27
27
|
});
|
|
28
28
|
};
|
|
29
29
|
$: processedBlock = () => {
|
|
30
|
-
return
|
|
30
|
+
return block.repeat?.collection
|
|
31
31
|
? block
|
|
32
32
|
: getProcessedBlock({
|
|
33
33
|
block: block,
|
|
@@ -42,13 +42,14 @@ $: Tag = () => {
|
|
|
42
42
|
return block.tagName || "div";
|
|
43
43
|
};
|
|
44
44
|
$: canShowBlock = () => {
|
|
45
|
-
if (
|
|
46
|
-
|
|
45
|
+
if (block.repeat?.collection) {
|
|
46
|
+
if (repeatItem?.()?.length)
|
|
47
|
+
return true;
|
|
48
|
+
return false;
|
|
47
49
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return true;
|
|
50
|
+
const shouldHide = "hide" in processedBlock() ? processedBlock().hide : false;
|
|
51
|
+
const shouldShow = "show" in processedBlock() ? processedBlock().show : true;
|
|
52
|
+
return shouldShow && !shouldHide;
|
|
52
53
|
};
|
|
53
54
|
$: childrenWithoutParentComponent = () => {
|
|
54
55
|
/**
|
|
@@ -2,6 +2,6 @@ import type { BuilderContent } from '../../types/builder-content.js';
|
|
|
2
2
|
import type { Nullable } from '../../types/typescript.js';
|
|
3
3
|
import type { ContentProps } from './content.types.js';
|
|
4
4
|
export declare const getContextStateInitialValue: ({ content, data, locale }: Pick<ContentProps, 'content' | 'data' | 'locale'>) => {
|
|
5
|
-
|
|
5
|
+
locale?: string | undefined;
|
|
6
6
|
};
|
|
7
7
|
export declare const getContentInitialValue: ({ content, data }: Pick<ContentProps, 'content' | 'data'>) => Nullable<BuilderContent>;
|
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
export const getContextStateInitialValue = ({ content, data, locale }) => {
|
|
2
2
|
const defaultValues = {};
|
|
3
|
+
const initialState = content?.data?.state || {};
|
|
3
4
|
// set default values for content state inputs
|
|
4
5
|
content?.data?.inputs?.forEach(input => {
|
|
5
|
-
if (input.name && input.defaultValue !== undefined
|
|
6
|
+
if (input.name && input.defaultValue !== undefined) {
|
|
6
7
|
defaultValues[input.name] = input.defaultValue;
|
|
7
8
|
}
|
|
8
9
|
});
|
|
9
|
-
|
|
10
|
-
...
|
|
10
|
+
return {
|
|
11
|
+
...defaultValues,
|
|
12
|
+
...initialState,
|
|
11
13
|
...data,
|
|
12
14
|
...(locale ? {
|
|
13
15
|
locale
|
|
14
16
|
} : {})
|
|
15
17
|
};
|
|
16
|
-
return {
|
|
17
|
-
...defaultValues,
|
|
18
|
-
...stateToUse
|
|
19
|
-
};
|
|
20
18
|
};
|
|
21
19
|
export const getContentInitialValue = ({ content, data }) => {
|
|
22
20
|
return !content ? undefined : {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.7.
|
|
1
|
+
export declare const SDK_VERSION = "0.7.6";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.7.
|
|
1
|
+
export const SDK_VERSION = "0.7.6";
|
package/package.json
CHANGED
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
});
|
|
49
49
|
};
|
|
50
50
|
$: processedBlock = () => {
|
|
51
|
-
return
|
|
51
|
+
return block.repeat?.collection
|
|
52
52
|
? block
|
|
53
53
|
: getProcessedBlock({
|
|
54
54
|
block: block,
|
|
@@ -63,13 +63,15 @@
|
|
|
63
63
|
return block.tagName || "div";
|
|
64
64
|
};
|
|
65
65
|
$: canShowBlock = () => {
|
|
66
|
-
if (
|
|
67
|
-
|
|
66
|
+
if (block.repeat?.collection) {
|
|
67
|
+
if (repeatItem?.()?.length) return true;
|
|
68
|
+
return false;
|
|
68
69
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
const shouldHide =
|
|
71
|
+
"hide" in processedBlock() ? processedBlock().hide : false;
|
|
72
|
+
const shouldShow =
|
|
73
|
+
"show" in processedBlock() ? processedBlock().show : true;
|
|
74
|
+
return shouldShow && !shouldHide;
|
|
73
75
|
};
|
|
74
76
|
$: childrenWithoutParentComponent = () => {
|
|
75
77
|
/**
|
|
@@ -8,24 +8,22 @@ export const getContextStateInitialValue = ({
|
|
|
8
8
|
locale
|
|
9
9
|
}: Pick<ContentProps, 'content' | 'data' | 'locale'>) => {
|
|
10
10
|
const defaultValues: BuilderRenderState = {};
|
|
11
|
+
const initialState = content?.data?.state || {};
|
|
11
12
|
|
|
12
13
|
// set default values for content state inputs
|
|
13
14
|
content?.data?.inputs?.forEach(input => {
|
|
14
|
-
if (input.name && input.defaultValue !== undefined
|
|
15
|
+
if (input.name && input.defaultValue !== undefined) {
|
|
15
16
|
defaultValues[input.name] = input.defaultValue;
|
|
16
17
|
}
|
|
17
18
|
});
|
|
18
|
-
|
|
19
|
-
...
|
|
19
|
+
return {
|
|
20
|
+
...defaultValues,
|
|
21
|
+
...initialState,
|
|
20
22
|
...data,
|
|
21
23
|
...(locale ? {
|
|
22
24
|
locale
|
|
23
25
|
} : {})
|
|
24
26
|
};
|
|
25
|
-
return {
|
|
26
|
-
...defaultValues,
|
|
27
|
-
...stateToUse
|
|
28
|
-
};
|
|
29
27
|
};
|
|
30
28
|
export const getContentInitialValue = ({
|
|
31
29
|
content,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.7.
|
|
1
|
+
export const SDK_VERSION = "0.7.6"
|