@builder.io/sdk-svelte 2.0.1 → 2.0.2
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/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/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/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/package.json +1 -1
- 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
|
@@ -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.2";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "2.0.
|
|
1
|
+
export const SDK_VERSION = "2.0.2";
|
|
@@ -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.2";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "2.0.
|
|
1
|
+
export const SDK_VERSION = "2.0.2";
|
|
@@ -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.2";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "2.0.
|
|
1
|
+
export const SDK_VERSION = "2.0.2";
|
package/package.json
CHANGED
|
@@ -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.2"
|