@builder.io/sdk-svelte 0.0.1-26 → 0.0.1-29
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.json
CHANGED
|
@@ -1,23 +1,54 @@
|
|
|
1
1
|
<script>
|
|
2
|
+
export let autoPlay;
|
|
3
|
+
export let muted;
|
|
4
|
+
export let controls;
|
|
5
|
+
export let loop;
|
|
6
|
+
export let playsInline;
|
|
2
7
|
export let attributes;
|
|
3
8
|
export let fit;
|
|
4
9
|
export let position;
|
|
5
10
|
export let video;
|
|
6
11
|
export let posterImage;
|
|
7
|
-
export let autoPlay;
|
|
8
|
-
export let muted;
|
|
9
|
-
export let controls;
|
|
10
|
-
export let loop;
|
|
11
12
|
|
|
12
13
|
function mitosis_styling(node, vars) {
|
|
13
14
|
Object.entries(vars).forEach(([p, v]) => {
|
|
14
15
|
node.style[p] = v;
|
|
15
16
|
});
|
|
16
17
|
}
|
|
18
|
+
|
|
19
|
+
$: videoProps = () => {
|
|
20
|
+
return {
|
|
21
|
+
...(autoPlay === true
|
|
22
|
+
? {
|
|
23
|
+
autoPlay: true,
|
|
24
|
+
}
|
|
25
|
+
: {}),
|
|
26
|
+
...(muted === true
|
|
27
|
+
? {
|
|
28
|
+
muted: true,
|
|
29
|
+
}
|
|
30
|
+
: {}),
|
|
31
|
+
...(controls === true
|
|
32
|
+
? {
|
|
33
|
+
controls: true,
|
|
34
|
+
}
|
|
35
|
+
: {}),
|
|
36
|
+
...(loop === true
|
|
37
|
+
? {
|
|
38
|
+
loop: true,
|
|
39
|
+
}
|
|
40
|
+
: {}),
|
|
41
|
+
...(playsInline === true
|
|
42
|
+
? {
|
|
43
|
+
playsInline: true,
|
|
44
|
+
}
|
|
45
|
+
: {}),
|
|
46
|
+
};
|
|
47
|
+
};
|
|
17
48
|
</script>
|
|
18
49
|
|
|
19
50
|
<video
|
|
20
|
-
{...
|
|
51
|
+
{...videoProps()}
|
|
21
52
|
use:mitosis_styling={{
|
|
22
53
|
width: "100%",
|
|
23
54
|
height: "100%",
|
|
@@ -28,11 +59,6 @@
|
|
|
28
59
|
// not have the video overflow
|
|
29
60
|
borderRadius: 1,
|
|
30
61
|
}}
|
|
31
|
-
preload="none"
|
|
32
62
|
src={video || "no-src"}
|
|
33
63
|
poster={posterImage}
|
|
34
|
-
{autoPlay}
|
|
35
|
-
{muted}
|
|
36
|
-
{controls}
|
|
37
|
-
{loop}
|
|
38
64
|
/>
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
export let context;
|
|
28
28
|
export let customComponents;
|
|
29
29
|
export let model;
|
|
30
|
+
export let canTrack;
|
|
30
31
|
export let apiKey;
|
|
31
32
|
|
|
32
33
|
const processMessage = function processMessage(event) {
|
|
@@ -71,6 +72,14 @@
|
|
|
71
72
|
}
|
|
72
73
|
};
|
|
73
74
|
|
|
75
|
+
const onClick = function onClick(_event) {
|
|
76
|
+
if (useContent() && canTrack !== false) {
|
|
77
|
+
track("click", {
|
|
78
|
+
contentId: useContent().id,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
|
|
74
83
|
const evalExpression = function evalExpression(expression) {
|
|
75
84
|
return expression.replace(/{{([^}]+)}}/g, (_match, group) =>
|
|
76
85
|
evaluate({
|
|
@@ -203,7 +212,7 @@
|
|
|
203
212
|
);
|
|
204
213
|
}
|
|
205
214
|
|
|
206
|
-
if (useContent()) {
|
|
215
|
+
if (useContent() && canTrack !== false) {
|
|
207
216
|
track("impression", {
|
|
208
217
|
contentId: useContent().id,
|
|
209
218
|
});
|
|
@@ -262,11 +271,9 @@
|
|
|
262
271
|
{#if useContent()}
|
|
263
272
|
<div
|
|
264
273
|
on:click={(event) => {
|
|
265
|
-
|
|
266
|
-
contentId: useContent().id,
|
|
267
|
-
});
|
|
274
|
+
onClick(event);
|
|
268
275
|
}}
|
|
269
|
-
|
|
276
|
+
builder-content-id={useContent?.()?.id}
|
|
270
277
|
>
|
|
271
278
|
{#if shouldRenderContentStyles()}
|
|
272
279
|
<RenderContentStyles
|