@builder.io/sdk-svelte 2.0.1 → 2.0.3
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/blocks/columns/columns.svelte +3 -2
- package/lib/browser/blocks/image/image.svelte +3 -0
- package/lib/browser/components/content/content.svelte +15 -3
- package/lib/browser/components/content/content.svelte.d.ts +1 -1
- package/lib/browser/components/content-variants/content-variants.svelte +1 -2
- package/lib/browser/constants/sdk-version.d.ts +1 -1
- package/lib/browser/constants/sdk-version.js +1 -1
- package/lib/browser/functions/register-component.d.ts +2 -2
- package/lib/browser/functions/register-component.js +8 -9
- package/lib/edge/blocks/columns/columns.svelte +3 -2
- package/lib/edge/blocks/image/image.svelte +3 -0
- package/lib/edge/components/content/content.svelte +15 -3
- package/lib/edge/components/content/content.svelte.d.ts +1 -1
- package/lib/edge/components/content-variants/content-variants.svelte +1 -2
- package/lib/edge/constants/sdk-version.d.ts +1 -1
- package/lib/edge/constants/sdk-version.js +1 -1
- package/lib/edge/functions/register-component.d.ts +2 -2
- package/lib/edge/functions/register-component.js +8 -9
- package/lib/node/blocks/columns/columns.svelte +3 -2
- package/lib/node/blocks/image/image.svelte +3 -0
- package/lib/node/components/content/content.svelte +15 -3
- package/lib/node/components/content/content.svelte.d.ts +1 -1
- package/lib/node/components/content-variants/content-variants.svelte +1 -2
- package/lib/node/constants/sdk-version.d.ts +1 -1
- package/lib/node/constants/sdk-version.js +1 -1
- package/lib/node/functions/register-component.d.ts +2 -2
- package/lib/node/functions/register-component.js +8 -9
- package/package.json +1 -1
- package/src/blocks/columns/columns.svelte +3 -2
- package/src/blocks/image/image.svelte +3 -0
- package/src/components/content/content.svelte +11 -3
- package/src/components/content-variants/content-variants.svelte +1 -3
- package/src/constants/sdk-version.ts +1 -1
- package/src/functions/register-component.ts +8 -13
|
@@ -93,6 +93,7 @@ function getWidthForBreakpointSize(size) {
|
|
|
93
93
|
return breakpointSizes[size].max;
|
|
94
94
|
}
|
|
95
95
|
function columnsStyles() {
|
|
96
|
+
const childColumnDiv = `.${builderBlock.id}-breakpoints > .builder-column`;
|
|
96
97
|
return `
|
|
97
98
|
@media (max-width: ${getWidthForBreakpointSize("medium")}px) {
|
|
98
99
|
.${builderBlock.id}-breakpoints {
|
|
@@ -100,7 +101,7 @@ function columnsStyles() {
|
|
|
100
101
|
align-items: stretch;
|
|
101
102
|
}
|
|
102
103
|
|
|
103
|
-
|
|
104
|
+
${childColumnDiv} {
|
|
104
105
|
width: var(--column-width-tablet) !important;
|
|
105
106
|
margin-left: var(--column-margin-left-tablet) !important;
|
|
106
107
|
}
|
|
@@ -112,7 +113,7 @@ function columnsStyles() {
|
|
|
112
113
|
align-items: stretch;
|
|
113
114
|
}
|
|
114
115
|
|
|
115
|
-
|
|
116
|
+
${childColumnDiv} {
|
|
116
117
|
width: var(--column-width-mobile) !important;
|
|
117
118
|
margin-left: var(--column-margin-left-mobile) !important;
|
|
118
119
|
}
|
|
@@ -31,6 +31,9 @@ $: srcSetToUse = () => {
|
|
|
31
31
|
!(url.match(/builder\.io/) || url.match(/cdn\.shopify\.com/))) {
|
|
32
32
|
return srcset;
|
|
33
33
|
}
|
|
34
|
+
if (noWebp) {
|
|
35
|
+
return undefined; // no need to add srcset to svg images
|
|
36
|
+
}
|
|
34
37
|
if (srcset && image?.includes("builder.io/api/v1/image")) {
|
|
35
38
|
if (!srcset.includes(image.split("?")[0])) {
|
|
36
39
|
console.debug("Removed given srcset");
|
|
@@ -14,6 +14,7 @@ import { getContentInitialValue, getRootStateInitialValue, } from "./content.hel
|
|
|
14
14
|
import "./wrap-component-ref";
|
|
15
15
|
export let content = undefined;
|
|
16
16
|
export let customComponents = undefined;
|
|
17
|
+
export let model = undefined;
|
|
17
18
|
export let data = undefined;
|
|
18
19
|
export let locale = undefined;
|
|
19
20
|
export let context = undefined;
|
|
@@ -23,7 +24,6 @@ export let apiVersion = undefined;
|
|
|
23
24
|
export let blocksWrapper = undefined;
|
|
24
25
|
export let blocksWrapperProps = undefined;
|
|
25
26
|
export let nonce = undefined;
|
|
26
|
-
export let model = undefined;
|
|
27
27
|
export let enrich = undefined;
|
|
28
28
|
export let showContent;
|
|
29
29
|
export let contentWrapper = undefined;
|
|
@@ -43,7 +43,13 @@ let scriptStr = getUpdateVariantVisibilityScript({
|
|
|
43
43
|
});
|
|
44
44
|
let registeredComponents = [
|
|
45
45
|
...getDefaultRegisteredComponents(),
|
|
46
|
-
...(customComponents
|
|
46
|
+
...(customComponents?.filter(({ models }) => {
|
|
47
|
+
if (!models?.length)
|
|
48
|
+
return true;
|
|
49
|
+
if (!model)
|
|
50
|
+
return true;
|
|
51
|
+
return models.includes(model);
|
|
52
|
+
}) || []),
|
|
47
53
|
].reduce((acc, { component, ...info }) => ({
|
|
48
54
|
...acc,
|
|
49
55
|
[info.name]: {
|
|
@@ -69,7 +75,13 @@ let builderContextSignal = writable({
|
|
|
69
75
|
apiVersion: apiVersion,
|
|
70
76
|
componentInfos: [
|
|
71
77
|
...getDefaultRegisteredComponents(),
|
|
72
|
-
...(customComponents
|
|
78
|
+
...(customComponents?.filter(({ models }) => {
|
|
79
|
+
if (!models?.length)
|
|
80
|
+
return true;
|
|
81
|
+
if (!model)
|
|
82
|
+
return true;
|
|
83
|
+
return models.includes(model);
|
|
84
|
+
}) || []),
|
|
73
85
|
].reduce((acc, { component: _, ...info }) => ({
|
|
74
86
|
...acc,
|
|
75
87
|
[info.name]: serializeComponentInfo(info),
|
|
@@ -4,6 +4,7 @@ declare const __propDef: {
|
|
|
4
4
|
props: {
|
|
5
5
|
content?: ContentProps["content"];
|
|
6
6
|
customComponents?: ContentProps["customComponents"];
|
|
7
|
+
model?: ContentProps["model"];
|
|
7
8
|
data?: ContentProps["data"];
|
|
8
9
|
locale?: ContentProps["locale"];
|
|
9
10
|
context?: ContentProps["context"];
|
|
@@ -13,7 +14,6 @@ declare const __propDef: {
|
|
|
13
14
|
blocksWrapper?: ContentProps["blocksWrapper"];
|
|
14
15
|
blocksWrapperProps?: ContentProps["blocksWrapperProps"];
|
|
15
16
|
nonce?: ContentProps["nonce"];
|
|
16
|
-
model?: ContentProps["model"];
|
|
17
17
|
enrich?: ContentProps["enrich"];
|
|
18
18
|
showContent: ContentProps["showContent"];
|
|
19
19
|
contentWrapper?: ContentProps["contentWrapper"];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script context="module"></script>
|
|
2
2
|
|
|
3
|
-
<script>import {
|
|
3
|
+
<script>import { onMount } from "svelte";
|
|
4
4
|
import { TARGET } from "../../constants/target";
|
|
5
5
|
import { handleABTestingSync } from "../../helpers/ab-tests";
|
|
6
6
|
import { getDefaultCanTrack } from "../../helpers/canTrack";
|
|
@@ -58,7 +58,6 @@ onMount(() => {
|
|
|
58
58
|
*/
|
|
59
59
|
shouldRenderVariants = false;
|
|
60
60
|
});
|
|
61
|
-
afterUpdate(() => { });
|
|
62
61
|
</script>
|
|
63
62
|
|
|
64
63
|
{#if !isNestedRender && TARGET !== "reactNative"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "2.0.
|
|
1
|
+
export declare const SDK_VERSION = "2.0.3";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "2.0.
|
|
1
|
+
export const SDK_VERSION = "2.0.3";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ComponentInfo } from '../types/components';
|
|
2
2
|
export declare const createRegisterComponentMessage: (info: ComponentInfo) => {
|
|
3
3
|
type: string;
|
|
4
|
-
data:
|
|
4
|
+
data: any;
|
|
5
5
|
};
|
|
6
|
-
export declare
|
|
6
|
+
export declare function serializeComponentInfo(info: ComponentInfo): any;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { fastClone } from './fast-clone';
|
|
2
1
|
export const createRegisterComponentMessage = (info) => ({
|
|
3
2
|
type: 'builder.registerComponent',
|
|
4
3
|
data: serializeComponentInfo(info)
|
|
@@ -13,11 +12,11 @@ const serializeFn = (fnValue) => {
|
|
|
13
12
|
const appendFunction = !fnStr.startsWith('function') && !fnStr.startsWith('(');
|
|
14
13
|
return `return (${appendFunction ? 'function ' : ''}${fnStr}).apply(this, arguments)`;
|
|
15
14
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
})
|
|
23
|
-
}
|
|
15
|
+
export function serializeComponentInfo(info) {
|
|
16
|
+
return JSON.parse(JSON.stringify(info, (key, value) => {
|
|
17
|
+
if (typeof value === 'function') {
|
|
18
|
+
return serializeFn(value);
|
|
19
|
+
}
|
|
20
|
+
return value;
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
@@ -93,6 +93,7 @@ function getWidthForBreakpointSize(size) {
|
|
|
93
93
|
return breakpointSizes[size].max;
|
|
94
94
|
}
|
|
95
95
|
function columnsStyles() {
|
|
96
|
+
const childColumnDiv = `.${builderBlock.id}-breakpoints > .builder-column`;
|
|
96
97
|
return `
|
|
97
98
|
@media (max-width: ${getWidthForBreakpointSize("medium")}px) {
|
|
98
99
|
.${builderBlock.id}-breakpoints {
|
|
@@ -100,7 +101,7 @@ function columnsStyles() {
|
|
|
100
101
|
align-items: stretch;
|
|
101
102
|
}
|
|
102
103
|
|
|
103
|
-
|
|
104
|
+
${childColumnDiv} {
|
|
104
105
|
width: var(--column-width-tablet) !important;
|
|
105
106
|
margin-left: var(--column-margin-left-tablet) !important;
|
|
106
107
|
}
|
|
@@ -112,7 +113,7 @@ function columnsStyles() {
|
|
|
112
113
|
align-items: stretch;
|
|
113
114
|
}
|
|
114
115
|
|
|
115
|
-
|
|
116
|
+
${childColumnDiv} {
|
|
116
117
|
width: var(--column-width-mobile) !important;
|
|
117
118
|
margin-left: var(--column-margin-left-mobile) !important;
|
|
118
119
|
}
|
|
@@ -31,6 +31,9 @@ $: srcSetToUse = () => {
|
|
|
31
31
|
!(url.match(/builder\.io/) || url.match(/cdn\.shopify\.com/))) {
|
|
32
32
|
return srcset;
|
|
33
33
|
}
|
|
34
|
+
if (noWebp) {
|
|
35
|
+
return undefined; // no need to add srcset to svg images
|
|
36
|
+
}
|
|
34
37
|
if (srcset && image?.includes("builder.io/api/v1/image")) {
|
|
35
38
|
if (!srcset.includes(image.split("?")[0])) {
|
|
36
39
|
console.debug("Removed given srcset");
|
|
@@ -14,6 +14,7 @@ import { getContentInitialValue, getRootStateInitialValue, } from "./content.hel
|
|
|
14
14
|
import "./wrap-component-ref";
|
|
15
15
|
export let content = undefined;
|
|
16
16
|
export let customComponents = undefined;
|
|
17
|
+
export let model = undefined;
|
|
17
18
|
export let data = undefined;
|
|
18
19
|
export let locale = undefined;
|
|
19
20
|
export let context = undefined;
|
|
@@ -23,7 +24,6 @@ export let apiVersion = undefined;
|
|
|
23
24
|
export let blocksWrapper = undefined;
|
|
24
25
|
export let blocksWrapperProps = undefined;
|
|
25
26
|
export let nonce = undefined;
|
|
26
|
-
export let model = undefined;
|
|
27
27
|
export let enrich = undefined;
|
|
28
28
|
export let showContent;
|
|
29
29
|
export let contentWrapper = undefined;
|
|
@@ -43,7 +43,13 @@ let scriptStr = getUpdateVariantVisibilityScript({
|
|
|
43
43
|
});
|
|
44
44
|
let registeredComponents = [
|
|
45
45
|
...getDefaultRegisteredComponents(),
|
|
46
|
-
...(customComponents
|
|
46
|
+
...(customComponents?.filter(({ models }) => {
|
|
47
|
+
if (!models?.length)
|
|
48
|
+
return true;
|
|
49
|
+
if (!model)
|
|
50
|
+
return true;
|
|
51
|
+
return models.includes(model);
|
|
52
|
+
}) || []),
|
|
47
53
|
].reduce((acc, { component, ...info }) => ({
|
|
48
54
|
...acc,
|
|
49
55
|
[info.name]: {
|
|
@@ -69,7 +75,13 @@ let builderContextSignal = writable({
|
|
|
69
75
|
apiVersion: apiVersion,
|
|
70
76
|
componentInfos: [
|
|
71
77
|
...getDefaultRegisteredComponents(),
|
|
72
|
-
...(customComponents
|
|
78
|
+
...(customComponents?.filter(({ models }) => {
|
|
79
|
+
if (!models?.length)
|
|
80
|
+
return true;
|
|
81
|
+
if (!model)
|
|
82
|
+
return true;
|
|
83
|
+
return models.includes(model);
|
|
84
|
+
}) || []),
|
|
73
85
|
].reduce((acc, { component: _, ...info }) => ({
|
|
74
86
|
...acc,
|
|
75
87
|
[info.name]: serializeComponentInfo(info),
|
|
@@ -4,6 +4,7 @@ declare const __propDef: {
|
|
|
4
4
|
props: {
|
|
5
5
|
content?: ContentProps["content"];
|
|
6
6
|
customComponents?: ContentProps["customComponents"];
|
|
7
|
+
model?: ContentProps["model"];
|
|
7
8
|
data?: ContentProps["data"];
|
|
8
9
|
locale?: ContentProps["locale"];
|
|
9
10
|
context?: ContentProps["context"];
|
|
@@ -13,7 +14,6 @@ declare const __propDef: {
|
|
|
13
14
|
blocksWrapper?: ContentProps["blocksWrapper"];
|
|
14
15
|
blocksWrapperProps?: ContentProps["blocksWrapperProps"];
|
|
15
16
|
nonce?: ContentProps["nonce"];
|
|
16
|
-
model?: ContentProps["model"];
|
|
17
17
|
enrich?: ContentProps["enrich"];
|
|
18
18
|
showContent: ContentProps["showContent"];
|
|
19
19
|
contentWrapper?: ContentProps["contentWrapper"];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script context="module"></script>
|
|
2
2
|
|
|
3
|
-
<script>import {
|
|
3
|
+
<script>import { onMount } from "svelte";
|
|
4
4
|
import { TARGET } from "../../constants/target";
|
|
5
5
|
import { handleABTestingSync } from "../../helpers/ab-tests";
|
|
6
6
|
import { getDefaultCanTrack } from "../../helpers/canTrack";
|
|
@@ -58,7 +58,6 @@ onMount(() => {
|
|
|
58
58
|
*/
|
|
59
59
|
shouldRenderVariants = false;
|
|
60
60
|
});
|
|
61
|
-
afterUpdate(() => { });
|
|
62
61
|
</script>
|
|
63
62
|
|
|
64
63
|
{#if !isNestedRender && TARGET !== "reactNative"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "2.0.
|
|
1
|
+
export declare const SDK_VERSION = "2.0.3";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "2.0.
|
|
1
|
+
export const SDK_VERSION = "2.0.3";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ComponentInfo } from '../types/components';
|
|
2
2
|
export declare const createRegisterComponentMessage: (info: ComponentInfo) => {
|
|
3
3
|
type: string;
|
|
4
|
-
data:
|
|
4
|
+
data: any;
|
|
5
5
|
};
|
|
6
|
-
export declare
|
|
6
|
+
export declare function serializeComponentInfo(info: ComponentInfo): any;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { fastClone } from './fast-clone';
|
|
2
1
|
export const createRegisterComponentMessage = (info) => ({
|
|
3
2
|
type: 'builder.registerComponent',
|
|
4
3
|
data: serializeComponentInfo(info)
|
|
@@ -13,11 +12,11 @@ const serializeFn = (fnValue) => {
|
|
|
13
12
|
const appendFunction = !fnStr.startsWith('function') && !fnStr.startsWith('(');
|
|
14
13
|
return `return (${appendFunction ? 'function ' : ''}${fnStr}).apply(this, arguments)`;
|
|
15
14
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
})
|
|
23
|
-
}
|
|
15
|
+
export function serializeComponentInfo(info) {
|
|
16
|
+
return JSON.parse(JSON.stringify(info, (key, value) => {
|
|
17
|
+
if (typeof value === 'function') {
|
|
18
|
+
return serializeFn(value);
|
|
19
|
+
}
|
|
20
|
+
return value;
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
@@ -93,6 +93,7 @@ function getWidthForBreakpointSize(size) {
|
|
|
93
93
|
return breakpointSizes[size].max;
|
|
94
94
|
}
|
|
95
95
|
function columnsStyles() {
|
|
96
|
+
const childColumnDiv = `.${builderBlock.id}-breakpoints > .builder-column`;
|
|
96
97
|
return `
|
|
97
98
|
@media (max-width: ${getWidthForBreakpointSize("medium")}px) {
|
|
98
99
|
.${builderBlock.id}-breakpoints {
|
|
@@ -100,7 +101,7 @@ function columnsStyles() {
|
|
|
100
101
|
align-items: stretch;
|
|
101
102
|
}
|
|
102
103
|
|
|
103
|
-
|
|
104
|
+
${childColumnDiv} {
|
|
104
105
|
width: var(--column-width-tablet) !important;
|
|
105
106
|
margin-left: var(--column-margin-left-tablet) !important;
|
|
106
107
|
}
|
|
@@ -112,7 +113,7 @@ function columnsStyles() {
|
|
|
112
113
|
align-items: stretch;
|
|
113
114
|
}
|
|
114
115
|
|
|
115
|
-
|
|
116
|
+
${childColumnDiv} {
|
|
116
117
|
width: var(--column-width-mobile) !important;
|
|
117
118
|
margin-left: var(--column-margin-left-mobile) !important;
|
|
118
119
|
}
|
|
@@ -31,6 +31,9 @@ $: srcSetToUse = () => {
|
|
|
31
31
|
!(url.match(/builder\.io/) || url.match(/cdn\.shopify\.com/))) {
|
|
32
32
|
return srcset;
|
|
33
33
|
}
|
|
34
|
+
if (noWebp) {
|
|
35
|
+
return undefined; // no need to add srcset to svg images
|
|
36
|
+
}
|
|
34
37
|
if (srcset && image?.includes("builder.io/api/v1/image")) {
|
|
35
38
|
if (!srcset.includes(image.split("?")[0])) {
|
|
36
39
|
console.debug("Removed given srcset");
|
|
@@ -14,6 +14,7 @@ import { getContentInitialValue, getRootStateInitialValue, } from "./content.hel
|
|
|
14
14
|
import "./wrap-component-ref";
|
|
15
15
|
export let content = undefined;
|
|
16
16
|
export let customComponents = undefined;
|
|
17
|
+
export let model = undefined;
|
|
17
18
|
export let data = undefined;
|
|
18
19
|
export let locale = undefined;
|
|
19
20
|
export let context = undefined;
|
|
@@ -23,7 +24,6 @@ export let apiVersion = undefined;
|
|
|
23
24
|
export let blocksWrapper = undefined;
|
|
24
25
|
export let blocksWrapperProps = undefined;
|
|
25
26
|
export let nonce = undefined;
|
|
26
|
-
export let model = undefined;
|
|
27
27
|
export let enrich = undefined;
|
|
28
28
|
export let showContent;
|
|
29
29
|
export let contentWrapper = undefined;
|
|
@@ -43,7 +43,13 @@ let scriptStr = getUpdateVariantVisibilityScript({
|
|
|
43
43
|
});
|
|
44
44
|
let registeredComponents = [
|
|
45
45
|
...getDefaultRegisteredComponents(),
|
|
46
|
-
...(customComponents
|
|
46
|
+
...(customComponents?.filter(({ models }) => {
|
|
47
|
+
if (!models?.length)
|
|
48
|
+
return true;
|
|
49
|
+
if (!model)
|
|
50
|
+
return true;
|
|
51
|
+
return models.includes(model);
|
|
52
|
+
}) || []),
|
|
47
53
|
].reduce((acc, { component, ...info }) => ({
|
|
48
54
|
...acc,
|
|
49
55
|
[info.name]: {
|
|
@@ -69,7 +75,13 @@ let builderContextSignal = writable({
|
|
|
69
75
|
apiVersion: apiVersion,
|
|
70
76
|
componentInfos: [
|
|
71
77
|
...getDefaultRegisteredComponents(),
|
|
72
|
-
...(customComponents
|
|
78
|
+
...(customComponents?.filter(({ models }) => {
|
|
79
|
+
if (!models?.length)
|
|
80
|
+
return true;
|
|
81
|
+
if (!model)
|
|
82
|
+
return true;
|
|
83
|
+
return models.includes(model);
|
|
84
|
+
}) || []),
|
|
73
85
|
].reduce((acc, { component: _, ...info }) => ({
|
|
74
86
|
...acc,
|
|
75
87
|
[info.name]: serializeComponentInfo(info),
|
|
@@ -4,6 +4,7 @@ declare const __propDef: {
|
|
|
4
4
|
props: {
|
|
5
5
|
content?: ContentProps["content"];
|
|
6
6
|
customComponents?: ContentProps["customComponents"];
|
|
7
|
+
model?: ContentProps["model"];
|
|
7
8
|
data?: ContentProps["data"];
|
|
8
9
|
locale?: ContentProps["locale"];
|
|
9
10
|
context?: ContentProps["context"];
|
|
@@ -13,7 +14,6 @@ declare const __propDef: {
|
|
|
13
14
|
blocksWrapper?: ContentProps["blocksWrapper"];
|
|
14
15
|
blocksWrapperProps?: ContentProps["blocksWrapperProps"];
|
|
15
16
|
nonce?: ContentProps["nonce"];
|
|
16
|
-
model?: ContentProps["model"];
|
|
17
17
|
enrich?: ContentProps["enrich"];
|
|
18
18
|
showContent: ContentProps["showContent"];
|
|
19
19
|
contentWrapper?: ContentProps["contentWrapper"];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script context="module"></script>
|
|
2
2
|
|
|
3
|
-
<script>import {
|
|
3
|
+
<script>import { onMount } from "svelte";
|
|
4
4
|
import { TARGET } from "../../constants/target";
|
|
5
5
|
import { handleABTestingSync } from "../../helpers/ab-tests";
|
|
6
6
|
import { getDefaultCanTrack } from "../../helpers/canTrack";
|
|
@@ -58,7 +58,6 @@ onMount(() => {
|
|
|
58
58
|
*/
|
|
59
59
|
shouldRenderVariants = false;
|
|
60
60
|
});
|
|
61
|
-
afterUpdate(() => { });
|
|
62
61
|
</script>
|
|
63
62
|
|
|
64
63
|
{#if !isNestedRender && TARGET !== "reactNative"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "2.0.
|
|
1
|
+
export declare const SDK_VERSION = "2.0.3";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "2.0.
|
|
1
|
+
export const SDK_VERSION = "2.0.3";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ComponentInfo } from '../types/components';
|
|
2
2
|
export declare const createRegisterComponentMessage: (info: ComponentInfo) => {
|
|
3
3
|
type: string;
|
|
4
|
-
data:
|
|
4
|
+
data: any;
|
|
5
5
|
};
|
|
6
|
-
export declare
|
|
6
|
+
export declare function serializeComponentInfo(info: ComponentInfo): any;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { fastClone } from './fast-clone';
|
|
2
1
|
export const createRegisterComponentMessage = (info) => ({
|
|
3
2
|
type: 'builder.registerComponent',
|
|
4
3
|
data: serializeComponentInfo(info)
|
|
@@ -13,11 +12,11 @@ const serializeFn = (fnValue) => {
|
|
|
13
12
|
const appendFunction = !fnStr.startsWith('function') && !fnStr.startsWith('(');
|
|
14
13
|
return `return (${appendFunction ? 'function ' : ''}${fnStr}).apply(this, arguments)`;
|
|
15
14
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
})
|
|
23
|
-
}
|
|
15
|
+
export function serializeComponentInfo(info) {
|
|
16
|
+
return JSON.parse(JSON.stringify(info, (key, value) => {
|
|
17
|
+
if (typeof value === 'function') {
|
|
18
|
+
return serializeFn(value);
|
|
19
|
+
}
|
|
20
|
+
return value;
|
|
21
|
+
}));
|
|
22
|
+
}
|
package/package.json
CHANGED
|
@@ -117,6 +117,7 @@
|
|
|
117
117
|
return breakpointSizes[size].max;
|
|
118
118
|
}
|
|
119
119
|
function columnsStyles() {
|
|
120
|
+
const childColumnDiv = `.${builderBlock.id}-breakpoints > .builder-column`;
|
|
120
121
|
return `
|
|
121
122
|
@media (max-width: ${getWidthForBreakpointSize("medium")}px) {
|
|
122
123
|
.${builderBlock.id}-breakpoints {
|
|
@@ -124,7 +125,7 @@
|
|
|
124
125
|
align-items: stretch;
|
|
125
126
|
}
|
|
126
127
|
|
|
127
|
-
|
|
128
|
+
${childColumnDiv} {
|
|
128
129
|
width: var(--column-width-tablet) !important;
|
|
129
130
|
margin-left: var(--column-margin-left-tablet) !important;
|
|
130
131
|
}
|
|
@@ -136,7 +137,7 @@
|
|
|
136
137
|
align-items: stretch;
|
|
137
138
|
}
|
|
138
139
|
|
|
139
|
-
|
|
140
|
+
${childColumnDiv} {
|
|
140
141
|
width: var(--column-width-mobile) !important;
|
|
141
142
|
margin-left: var(--column-margin-left-mobile) !important;
|
|
142
143
|
}
|
|
@@ -38,6 +38,9 @@
|
|
|
38
38
|
) {
|
|
39
39
|
return srcset;
|
|
40
40
|
}
|
|
41
|
+
if (noWebp) {
|
|
42
|
+
return undefined; // no need to add srcset to svg images
|
|
43
|
+
}
|
|
41
44
|
if (srcset && image?.includes("builder.io/api/v1/image")) {
|
|
42
45
|
if (!srcset.includes(image.split("?")[0])) {
|
|
43
46
|
console.debug("Removed given srcset");
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
|
|
29
29
|
export let content: ContentProps["content"] = undefined;
|
|
30
30
|
export let customComponents: ContentProps["customComponents"] = undefined;
|
|
31
|
+
export let model: ContentProps["model"] = undefined;
|
|
31
32
|
export let data: ContentProps["data"] = undefined;
|
|
32
33
|
export let locale: ContentProps["locale"] = undefined;
|
|
33
34
|
export let context: ContentProps["context"] = undefined;
|
|
@@ -37,7 +38,6 @@
|
|
|
37
38
|
export let blocksWrapper: ContentProps["blocksWrapper"] = undefined;
|
|
38
39
|
export let blocksWrapperProps: ContentProps["blocksWrapperProps"] = undefined;
|
|
39
40
|
export let nonce: ContentProps["nonce"] = undefined;
|
|
40
|
-
export let model: ContentProps["model"] = undefined;
|
|
41
41
|
export let enrich: ContentProps["enrich"] = undefined;
|
|
42
42
|
export let showContent: ContentProps["showContent"];
|
|
43
43
|
export let contentWrapper: ContentProps["contentWrapper"] = undefined;
|
|
@@ -60,7 +60,11 @@
|
|
|
60
60
|
});
|
|
61
61
|
let registeredComponents = [
|
|
62
62
|
...getDefaultRegisteredComponents(),
|
|
63
|
-
...(customComponents
|
|
63
|
+
...(customComponents?.filter(({ models }) => {
|
|
64
|
+
if (!models?.length) return true;
|
|
65
|
+
if (!model) return true;
|
|
66
|
+
return models.includes(model);
|
|
67
|
+
}) || []),
|
|
64
68
|
].reduce<RegisteredComponents>(
|
|
65
69
|
(acc, { component, ...info }) => ({
|
|
66
70
|
...acc,
|
|
@@ -89,7 +93,11 @@
|
|
|
89
93
|
apiVersion: apiVersion,
|
|
90
94
|
componentInfos: [
|
|
91
95
|
...getDefaultRegisteredComponents(),
|
|
92
|
-
...(customComponents
|
|
96
|
+
...(customComponents?.filter(({ models }) => {
|
|
97
|
+
if (!models?.length) return true;
|
|
98
|
+
if (!model) return true;
|
|
99
|
+
return models.includes(model);
|
|
100
|
+
}) || []),
|
|
93
101
|
].reduce<Dictionary<ComponentInfo>>(
|
|
94
102
|
(acc, { component: _, ...info }) => ({
|
|
95
103
|
...acc,
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
</script>
|
|
9
9
|
|
|
10
10
|
<script lang="ts">
|
|
11
|
-
import {
|
|
11
|
+
import { onMount } from "svelte";
|
|
12
12
|
|
|
13
13
|
import { TARGET } from "../../constants/target";
|
|
14
14
|
import { handleABTestingSync } from "../../helpers/ab-tests";
|
|
@@ -85,8 +85,6 @@
|
|
|
85
85
|
*/
|
|
86
86
|
shouldRenderVariants = false;
|
|
87
87
|
});
|
|
88
|
-
|
|
89
|
-
afterUpdate(() => {});
|
|
90
88
|
</script>
|
|
91
89
|
|
|
92
90
|
{#if !isNestedRender && TARGET !== "reactNative"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "2.0.
|
|
1
|
+
export const SDK_VERSION = "2.0.3"
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import type { ComponentInfo } from '../types/components';
|
|
2
|
-
import type { Input } from '../types/input';
|
|
3
|
-
import { fastClone } from './fast-clone';
|
|
4
2
|
export const createRegisterComponentMessage = (info: ComponentInfo) => ({
|
|
5
3
|
type: 'builder.registerComponent',
|
|
6
4
|
data: serializeComponentInfo(info)
|
|
@@ -17,14 +15,11 @@ const serializeFn = (fnValue: Function) => {
|
|
|
17
15
|
const appendFunction = !fnStr.startsWith('function') && !fnStr.startsWith('(');
|
|
18
16
|
return `return (${appendFunction ? 'function ' : ''}${fnStr}).apply(this, arguments)`;
|
|
19
17
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
[key]: serializeValue(value)
|
|
29
|
-
}), ({} as Input)))
|
|
30
|
-
})
|
|
18
|
+
export function serializeComponentInfo(info: ComponentInfo) {
|
|
19
|
+
return JSON.parse(JSON.stringify(info, (key, value) => {
|
|
20
|
+
if (typeof value === 'function') {
|
|
21
|
+
return serializeFn(value);
|
|
22
|
+
}
|
|
23
|
+
return value;
|
|
24
|
+
}));
|
|
25
|
+
}
|