@streamscloud/kit 0.1.12-1772041668184 → 0.2.0
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/dist/core/transitions/slide-horizontally.js +1 -1
- package/dist/styles/_transitions.scss +24 -0
- package/dist/ui/button/resources/button-base.svelte +1 -1
- package/dist/ui/dropdown/cmp.dropdown.svelte +20 -3
- package/dist/ui/html-block/cmp.html-block.svelte +1 -1
- package/dist/ui/media-viewer-dialog/media-viewer-item.svelte +1 -1
- package/dist/ui/player/carousel/cmp.carousel.svelte +2 -3
- package/dist/ui/seek-bar/cmp.seek-bar.svelte +1 -1
- package/dist/ui/video/cmp.video.svelte +4 -2
- package/package.json +4 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { sineInOut } from 'svelte/easing';
|
|
2
|
-
export const slideHorizontally = (node, { delay = 0, duration =
|
|
2
|
+
export const slideHorizontally = (node, { delay = 0, duration = 250, easing = sineInOut } = {}) => {
|
|
3
3
|
const style = getComputedStyle(node);
|
|
4
4
|
const isHtmlElement = (n) => n.nodeType === Node.ELEMENT_NODE;
|
|
5
5
|
const children = Array.from(node.children).filter(isHtmlElement);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
@use 'sass:list';
|
|
2
|
+
|
|
3
|
+
$transition-duration-fast: 150ms;
|
|
4
|
+
$transition-duration-base: 250ms;
|
|
5
|
+
$transition-duration-slow: 350ms;
|
|
6
|
+
|
|
7
|
+
$transition-easing-default: cubic-bezier(0.4, 0, 0.2, 1);
|
|
8
|
+
$transition-easing-in: cubic-bezier(0.4, 0, 1, 1);
|
|
9
|
+
$transition-easing-out: cubic-bezier(0, 0, 0.2, 1);
|
|
10
|
+
|
|
11
|
+
// Transition mixin
|
|
12
|
+
// Usage:
|
|
13
|
+
// @include transition(opacity);
|
|
14
|
+
// @include transition(background-color color, $transition-duration-fast);
|
|
15
|
+
// @include transition(width, $transition-duration-slow, linear);
|
|
16
|
+
@mixin transition($properties: all, $duration: $transition-duration-base, $easing: $transition-easing-default) {
|
|
17
|
+
$result: ();
|
|
18
|
+
|
|
19
|
+
@each $property in $properties {
|
|
20
|
+
$result: list.append($result, $property $duration $easing, comma);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
transition: $result;
|
|
24
|
+
}
|
|
@@ -53,7 +53,7 @@ export {};
|
|
|
53
53
|
justify-content: var(--_button--justify-content);
|
|
54
54
|
align-items: center;
|
|
55
55
|
vertical-align: middle;
|
|
56
|
-
transition: background-color
|
|
56
|
+
transition: background-color 250ms cubic-bezier(0.4, 0, 0.2, 1), color 250ms cubic-bezier(0.4, 0, 0.2, 1), border-color 250ms cubic-bezier(0.4, 0, 0.2, 1), filter 250ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
57
57
|
white-space: nowrap;
|
|
58
58
|
cursor: pointer;
|
|
59
59
|
}
|
|
@@ -135,8 +135,10 @@ const initPopper = (node) => {
|
|
|
135
135
|
{/if}
|
|
136
136
|
</button>
|
|
137
137
|
{#if opened}
|
|
138
|
-
<div use:initPopper class="
|
|
139
|
-
|
|
138
|
+
<div use:initPopper class="dropdown__popper" role="tooltip" tabindex="-1">
|
|
139
|
+
<div class="dropdown__content">
|
|
140
|
+
{@render children()}
|
|
141
|
+
</div>
|
|
140
142
|
</div>
|
|
141
143
|
{/if}
|
|
142
144
|
</div>
|
|
@@ -179,10 +181,25 @@ A Popper.js-powered dropdown that positions content relative to a trigger elemen
|
|
|
179
181
|
opacity: 0.5;
|
|
180
182
|
pointer-events: none;
|
|
181
183
|
}
|
|
184
|
+
.dropdown__popper {
|
|
185
|
+
z-index: 999;
|
|
186
|
+
}
|
|
182
187
|
.dropdown__content {
|
|
183
188
|
width: max-content;
|
|
184
|
-
|
|
189
|
+
transform-origin: top left;
|
|
190
|
+
animation: dropdown-appear 150ms cubic-bezier(0, 0, 0.2, 1) both;
|
|
185
191
|
}
|
|
186
192
|
.dropdown :global([data-popper-escaped]) {
|
|
187
193
|
visibility: hidden !important;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
@keyframes dropdown-appear {
|
|
197
|
+
from {
|
|
198
|
+
opacity: 0;
|
|
199
|
+
transform: scale(0.95) translateY(-4px);
|
|
200
|
+
}
|
|
201
|
+
to {
|
|
202
|
+
opacity: 1;
|
|
203
|
+
transform: scale(1) translateY(0);
|
|
204
|
+
}
|
|
188
205
|
}</style>
|
|
@@ -4,7 +4,7 @@ const { item } = $props();
|
|
|
4
4
|
let containerWidth = $state(0);
|
|
5
5
|
let containerHeight = $state(0);
|
|
6
6
|
const fittedSize = $derived.by(() => {
|
|
7
|
-
if (containerWidth === 0 || containerHeight === 0) {
|
|
7
|
+
if (containerWidth === 0 || containerHeight === 0 || item.width === 0 || item.height === 0) {
|
|
8
8
|
return { width: 0, height: 0 };
|
|
9
9
|
}
|
|
10
10
|
const aspectRatio = item.width / item.height;
|
|
@@ -176,7 +176,6 @@ const onKeyPress = Utils.throttle((e) => {
|
|
|
176
176
|
const notifyIndexChanged = () => {
|
|
177
177
|
on?.indexChanged?.(selectedIndex);
|
|
178
178
|
};
|
|
179
|
-
notifyIndexChanged();
|
|
180
179
|
const setIndex = (index) => {
|
|
181
180
|
if (index < 0) {
|
|
182
181
|
animationIndex = 0;
|
|
@@ -195,10 +194,10 @@ const setIndex = (index) => {
|
|
|
195
194
|
}, 600);
|
|
196
195
|
};
|
|
197
196
|
const loadPrevious = Utils.throttle(() => {
|
|
198
|
-
setIndex(
|
|
197
|
+
setIndex(selectedIndex - 1);
|
|
199
198
|
}, animationDuration);
|
|
200
199
|
const loadNext = Utils.throttle(() => {
|
|
201
|
-
setIndex(
|
|
200
|
+
setIndex(selectedIndex + 1);
|
|
202
201
|
}, animationDuration);
|
|
203
202
|
$effect(() => {
|
|
204
203
|
if (previousItems && items !== previousItems) {
|
|
@@ -158,7 +158,7 @@ A draggable media seek bar with a track, filled portion, and scrubber handle. Su
|
|
|
158
158
|
transform: translate(-50%, -50%);
|
|
159
159
|
z-index: 1;
|
|
160
160
|
opacity: var(--_seek-bar--scrubber-opacity);
|
|
161
|
-
transition: opacity 0.
|
|
161
|
+
transition: opacity 150ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
162
162
|
}
|
|
163
163
|
.seek-bar__scrubber.is-dragging, .seek-bar__scrubber:focus {
|
|
164
164
|
--_seek-bar--scrubber-opacity: 1;
|
|
@@ -58,6 +58,7 @@ $effect(() => untrack(() => {
|
|
|
58
58
|
PlaybackManager.unregisterPlayer(id);
|
|
59
59
|
};
|
|
60
60
|
}));
|
|
61
|
+
let latestEntry = null;
|
|
61
62
|
// Intersection observer for lazy loading and autoplay-on-appearance
|
|
62
63
|
$effect(() => {
|
|
63
64
|
if (!videoContainerRef) {
|
|
@@ -70,12 +71,13 @@ $effect(() => {
|
|
|
70
71
|
return;
|
|
71
72
|
}
|
|
72
73
|
const [entry] = entries;
|
|
74
|
+
latestEntry = entry;
|
|
73
75
|
if ((entry.isIntersecting || allowPreloading) && !video.src) {
|
|
74
76
|
video.src = src;
|
|
75
77
|
video.load();
|
|
76
78
|
if (autoplayState === true) {
|
|
77
79
|
const handleCanPlay = () => {
|
|
78
|
-
if (
|
|
80
|
+
if (latestEntry?.isIntersecting) {
|
|
79
81
|
void play();
|
|
80
82
|
autoplayState = false;
|
|
81
83
|
}
|
|
@@ -96,7 +98,7 @@ $effect(() => {
|
|
|
96
98
|
}
|
|
97
99
|
if (entry.intersectionRatio >= 0.6) {
|
|
98
100
|
const handleCanPlay = () => {
|
|
99
|
-
if (
|
|
101
|
+
if (latestEntry && latestEntry.intersectionRatio >= 0.6) {
|
|
100
102
|
void play();
|
|
101
103
|
}
|
|
102
104
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamscloud/kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"author": "StreamsCloud",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -216,6 +216,9 @@
|
|
|
216
216
|
},
|
|
217
217
|
"./styles/theme": {
|
|
218
218
|
"sass": "./dist/styles/_theme.scss"
|
|
219
|
+
},
|
|
220
|
+
"./styles/transitions": {
|
|
221
|
+
"sass": "./dist/styles/_transitions.scss"
|
|
219
222
|
}
|
|
220
223
|
},
|
|
221
224
|
"dependencies": {
|