@bannerstudio/svelte 0.1.0 → 0.1.1
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 +2 -2
- package/src/BannerStudioEmbed.svelte +25 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bannerstudio/svelte",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Svelte component for embedding Banner Studio banners.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@bannerstudio/core": "^0.1.
|
|
25
|
+
"@bannerstudio/core": "^0.1.4"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"svelte": ">=4.0.0"
|
|
@@ -27,6 +27,9 @@
|
|
|
27
27
|
|
|
28
28
|
$: src = buildEmbedUrl({ apiBase, affiliate, type, placement: placement || undefined, segment: segment || undefined })
|
|
29
29
|
$: active = meta === undefined || meta?.active === true
|
|
30
|
+
// Top/bottom banners stack above host content so a section that pulls itself
|
|
31
|
+
// up with a negative margin (e.g. a hero with `-mt-20`) can't paint over them.
|
|
32
|
+
$: stacked = type === 'top' || type === 'bottom'
|
|
30
33
|
|
|
31
34
|
onMount(() => {
|
|
32
35
|
if (!iframeEl) return
|
|
@@ -39,7 +42,11 @@
|
|
|
39
42
|
</script>
|
|
40
43
|
|
|
41
44
|
{#if !closed && active}
|
|
42
|
-
<div
|
|
45
|
+
<div
|
|
46
|
+
class="bs-banner-box"
|
|
47
|
+
class:bs-stacked={stacked}
|
|
48
|
+
style="height:{currentHeight}px;overflow:hidden"
|
|
49
|
+
>
|
|
43
50
|
<iframe
|
|
44
51
|
bind:this={iframeEl}
|
|
45
52
|
{src}
|
|
@@ -51,3 +58,20 @@
|
|
|
51
58
|
></iframe>
|
|
52
59
|
</div>
|
|
53
60
|
{/if}
|
|
61
|
+
|
|
62
|
+
<style>
|
|
63
|
+
/* Animate height changes so a client-resolved banner pushes content down
|
|
64
|
+
smoothly instead of snapping. Honors prefers-reduced-motion. */
|
|
65
|
+
.bs-banner-box {
|
|
66
|
+
transition: height 0.35s ease;
|
|
67
|
+
}
|
|
68
|
+
.bs-stacked {
|
|
69
|
+
position: relative;
|
|
70
|
+
z-index: 2147483646;
|
|
71
|
+
}
|
|
72
|
+
@media (prefers-reduced-motion: reduce) {
|
|
73
|
+
.bs-banner-box {
|
|
74
|
+
transition: none;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
</style>
|