@streamscloud/kit 0.27.0 → 0.29.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/styles/_semantic.scss +1 -1
- package/dist/ui/grid-card/cmp.grid-card-media.svelte +3 -0
- package/dist/ui/grid-card/cmp.grid-card-media.svelte.d.ts +3 -0
- package/dist/ui/grid-card/video-player-localization.d.ts +4 -0
- package/dist/ui/grid-card/video-player-localization.js +19 -0
- package/dist/ui/grid-card/video-player.svelte +9 -5
- package/dist/ui/grid-card/video-player.svelte.d.ts +3 -0
- package/dist/ui/play-indicator/cmp.play-indicator.svelte +18 -8
- package/dist/ui/play-indicator/cmp.play-indicator.svelte.d.ts +15 -22
- package/dist/ui/skeleton/cmp.skeleton.svelte +13 -4
- package/dist/ui/skeleton/cmp.skeleton.svelte.d.ts +5 -1
- package/dist/ui/video/cmp.video.svelte +16 -23
- package/dist/ui/video/cmp.video.svelte.d.ts +11 -1
- package/package.json +1 -1
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
--sc-kit--color--bg--hover: light-dark(#f3f5f8, #{$color-dark-700});
|
|
16
16
|
--sc-kit--color--bg--active: light-dark(#eef2f8, #{$color-dark-600});
|
|
17
17
|
--sc-kit--color--bg--menu-active: light-dark(#{$color-blue-50}, #{$color-dark-500});
|
|
18
|
-
--sc-kit--color--bg--images: light-dark(#{$color-neutral-300}, #{$color-
|
|
18
|
+
--sc-kit--color--bg--images: light-dark(#{$color-neutral-300}, #{$color-dark-50});
|
|
19
19
|
|
|
20
20
|
// ============================================================
|
|
21
21
|
// COLOR — TEXT
|
|
@@ -111,6 +111,9 @@ a `Carousel` of mixed image / video items. Seek-bar renders below the media when
|
|
|
111
111
|
(default true); the bar itself is hidden via `visibility: hidden` when the current item isn't
|
|
112
112
|
playable (preserves card height). Optional `duration` overlay renders bottom-right.
|
|
113
113
|
|
|
114
|
+
The play glyph of a playable item is a `PlayIndicator` — size and shadow are tuned with
|
|
115
|
+
`--sc-kit--play-indicator--size` / `--sc-kit--play-indicator--filter`.
|
|
116
|
+
|
|
114
117
|
### CSS Custom Properties
|
|
115
118
|
| Property | Description | Default |
|
|
116
119
|
|---|---|---|
|
|
@@ -22,6 +22,9 @@ type Props = {
|
|
|
22
22
|
* (default true); the bar itself is hidden via `visibility: hidden` when the current item isn't
|
|
23
23
|
* playable (preserves card height). Optional `duration` overlay renders bottom-right.
|
|
24
24
|
*
|
|
25
|
+
* The play glyph of a playable item is a `PlayIndicator` — size and shadow are tuned with
|
|
26
|
+
* `--sc-kit--play-indicator--size` / `--sc-kit--play-indicator--filter`.
|
|
27
|
+
*
|
|
25
28
|
* ### CSS Custom Properties
|
|
26
29
|
* | Property | Description | Default |
|
|
27
30
|
* |---|---|---|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AppLocale } from '../../core/locale';
|
|
2
|
+
const loc = {
|
|
3
|
+
play: {
|
|
4
|
+
en: 'Play',
|
|
5
|
+
no: 'Spill av'
|
|
6
|
+
},
|
|
7
|
+
pause: {
|
|
8
|
+
en: 'Pause',
|
|
9
|
+
no: 'Pause'
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
export class VideoPlayerLocalization {
|
|
13
|
+
get play() {
|
|
14
|
+
return loc.play[AppLocale.current];
|
|
15
|
+
}
|
|
16
|
+
get pause() {
|
|
17
|
+
return loc.pause[AppLocale.current];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<script lang="ts">import { randomNanoid } from '../../core/utils';
|
|
2
|
-
import { Icon } from '../icon';
|
|
3
2
|
import { PlaybackManager } from '../media-playback';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
3
|
+
import { PlayIndicator } from '../play-indicator';
|
|
4
|
+
import { VideoPlayerLocalization } from './video-player-localization';
|
|
6
5
|
import { untrack } from 'svelte';
|
|
7
6
|
const { src, poster, active, on } = $props();
|
|
8
7
|
const id = randomNanoid();
|
|
8
|
+
const localization = new VideoPlayerLocalization();
|
|
9
9
|
let videoEl = $state(null);
|
|
10
10
|
let currentTime = $state(0);
|
|
11
11
|
let duration = $state(NaN);
|
|
@@ -132,12 +132,13 @@ export const seekTo = (time) => {
|
|
|
132
132
|
type="button"
|
|
133
133
|
class="video-player__control-button"
|
|
134
134
|
class:is-playing={isPlaying}
|
|
135
|
+
aria-label={isPlaying ? localization.pause : localization.play}
|
|
135
136
|
onmousedown={(e) => e.preventDefault()}
|
|
136
137
|
onclick={(e) => {
|
|
137
138
|
e.stopPropagation();
|
|
138
139
|
togglePlay();
|
|
139
140
|
}}>
|
|
140
|
-
<
|
|
141
|
+
<PlayIndicator glyph={isPlaying ? 'pause' : 'play'} />
|
|
141
142
|
</button>
|
|
142
143
|
|
|
143
144
|
<div class="video-player__duration">{formatTime(duration - currentTime)}</div>
|
|
@@ -148,10 +149,14 @@ export const seekTo = (time) => {
|
|
|
148
149
|
Internal video player used by `GridCardMedia` for a single playable media item. Integrates
|
|
149
150
|
with the global `PlaybackManager` so only one player can play at a time. Exposes `seekTo(t)`
|
|
150
151
|
via `bind:this` for parent seek-bar sync. Not exported standalone — use `GridCardMedia`.
|
|
152
|
+
|
|
153
|
+
The centred control renders `PlayIndicator`, so its size and shadow are tuned through the
|
|
154
|
+
`--sc-kit--play-indicator--*` variables set anywhere above the card.
|
|
151
155
|
-->
|
|
152
156
|
|
|
153
157
|
<style>.video-player {
|
|
154
158
|
--_video-player--object-fit: var(--sc-kit--grid-card--media--object-fit, contain);
|
|
159
|
+
container-type: inline-size;
|
|
155
160
|
position: relative;
|
|
156
161
|
width: 100%;
|
|
157
162
|
height: 100%;
|
|
@@ -171,7 +176,6 @@ via `bind:this` for parent seek-bar sync. Not exported standalone — use `GridC
|
|
|
171
176
|
border: none;
|
|
172
177
|
background: none;
|
|
173
178
|
cursor: pointer;
|
|
174
|
-
--sc-kit--icon--filter: var(--sc-kit--filter--icon-overlay);
|
|
175
179
|
transition: opacity var(--sc-kit--duration--base) var(--sc-kit--ease--default);
|
|
176
180
|
}
|
|
177
181
|
.video-player__control-button.is-playing {
|
|
@@ -20,6 +20,9 @@ type Props = {
|
|
|
20
20
|
* Internal video player used by `GridCardMedia` for a single playable media item. Integrates
|
|
21
21
|
* with the global `PlaybackManager` so only one player can play at a time. Exposes `seekTo(t)`
|
|
22
22
|
* via `bind:this` for parent seek-bar sync. Not exported standalone — use `GridCardMedia`.
|
|
23
|
+
*
|
|
24
|
+
* The centred control renders `PlayIndicator`, so its size and shadow are tuned through the
|
|
25
|
+
* `--sc-kit--play-indicator--*` variables set anywhere above the card.
|
|
23
26
|
*/
|
|
24
27
|
declare const VideoPlayer: import("svelte").Component<Props, {
|
|
25
28
|
seekTo: (time: number) => void;
|
|
@@ -1,28 +1,38 @@
|
|
|
1
1
|
<script lang="ts">import { Icon } from '../icon';
|
|
2
|
+
import IconPause from '@fluentui/svg-icons/icons/pause_20_regular.svg?raw';
|
|
2
3
|
import IconPlay from '@fluentui/svg-icons/icons/play_20_regular.svg?raw';
|
|
4
|
+
const { glyph = 'play' } = $props();
|
|
3
5
|
</script>
|
|
4
6
|
|
|
5
7
|
<div class="play-indicator">
|
|
6
|
-
<Icon src={IconPlay} color="on-accent" />
|
|
8
|
+
<Icon src={glyph === 'pause' ? IconPause : IconPlay} color="on-accent" />
|
|
7
9
|
</div>
|
|
8
10
|
|
|
9
11
|
<!--
|
|
10
12
|
@component
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
positions it (typically absolute-centered) and must be
|
|
14
|
-
container-query size to scale.
|
|
13
|
+
Playback glyph overlaid on a cover / thumbnail or on a player surface. It plays nothing and is
|
|
14
|
+
`pointer-events: none` — it only depicts the state its parent owns, so an interactive parent wraps it
|
|
15
|
+
in its own `<button>`. The parent positions it (typically absolute-centered) and must be
|
|
16
|
+
`container-type: inline-size` for the default container-query size to scale.
|
|
17
|
+
|
|
18
|
+
Lower the shadow on very light backgrounds: the default `drop-shadow(1px 1px #000)` reads as a harsh
|
|
19
|
+
outline there — pass a softer filter, or `none`.
|
|
15
20
|
|
|
16
21
|
### CSS Custom Properties
|
|
17
22
|
| Property | Description | Default |
|
|
18
23
|
|---|---|---|
|
|
19
|
-
| `--sc-kit--play-indicator--size` | Glyph size; container-query clamp scales it to parent width | `clamp(1.75rem,
|
|
24
|
+
| `--sc-kit--play-indicator--size` | Glyph size; container-query clamp scales it to parent width, reaching the 40px ceiling at 500px | `clamp(1.75rem, 8cqi, 2.5rem)` |
|
|
25
|
+
| `--sc-kit--play-indicator--filter` | Shadow applied to the glyph | `--sc-kit--filter--icon-overlay` |
|
|
20
26
|
-->
|
|
21
27
|
|
|
22
28
|
<style>.play-indicator {
|
|
23
|
-
--_play-indicator--size: var(
|
|
29
|
+
--_play-indicator--size: var(
|
|
30
|
+
--sc-kit--play-indicator--size,
|
|
31
|
+
var(--_--play-indicator--size, clamp(1.75rem, 8cqi, 2.5rem))
|
|
32
|
+
);
|
|
33
|
+
--_play-indicator--filter: var(--sc-kit--play-indicator--filter, var(--sc-kit--filter--icon-overlay));
|
|
24
34
|
display: inline-flex;
|
|
25
35
|
pointer-events: none;
|
|
26
36
|
--sc-kit--icon--size: var(--_play-indicator--size);
|
|
27
|
-
--sc-kit--icon--filter: var(--
|
|
37
|
+
--sc-kit--icon--filter: var(--_play-indicator--filter);
|
|
28
38
|
}</style>
|
|
@@ -1,29 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
(internal: unknown, props: {
|
|
6
|
-
$$events?: Events;
|
|
7
|
-
$$slots?: Slots;
|
|
8
|
-
}): Exports & {
|
|
9
|
-
$set?: any;
|
|
10
|
-
$on?: any;
|
|
11
|
-
};
|
|
12
|
-
z_$$bindings?: Bindings;
|
|
13
|
-
}
|
|
1
|
+
type Props = {
|
|
2
|
+
/** Which playback state to depict. @default 'play' */
|
|
3
|
+
glyph?: 'play' | 'pause';
|
|
4
|
+
};
|
|
14
5
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* positions it (typically absolute-centered) and must be
|
|
18
|
-
* container-query size to scale.
|
|
6
|
+
* Playback glyph overlaid on a cover / thumbnail or on a player surface. It plays nothing and is
|
|
7
|
+
* `pointer-events: none` — it only depicts the state its parent owns, so an interactive parent wraps it
|
|
8
|
+
* in its own `<button>`. The parent positions it (typically absolute-centered) and must be
|
|
9
|
+
* `container-type: inline-size` for the default container-query size to scale.
|
|
10
|
+
*
|
|
11
|
+
* Lower the shadow on very light backgrounds: the default `drop-shadow(1px 1px #000)` reads as a harsh
|
|
12
|
+
* outline there — pass a softer filter, or `none`.
|
|
19
13
|
*
|
|
20
14
|
* ### CSS Custom Properties
|
|
21
15
|
* | Property | Description | Default |
|
|
22
16
|
* |---|---|---|
|
|
23
|
-
* | `--sc-kit--play-indicator--size` | Glyph size; container-query clamp scales it to parent width | `clamp(1.75rem,
|
|
17
|
+
* | `--sc-kit--play-indicator--size` | Glyph size; container-query clamp scales it to parent width, reaching the 40px ceiling at 500px | `clamp(1.75rem, 8cqi, 2.5rem)` |
|
|
18
|
+
* | `--sc-kit--play-indicator--filter` | Shadow applied to the glyph | `--sc-kit--filter--icon-overlay` |
|
|
24
19
|
*/
|
|
25
|
-
declare const Cmp:
|
|
26
|
-
|
|
27
|
-
}, {}, {}, string>;
|
|
28
|
-
type Cmp = InstanceType<typeof Cmp>;
|
|
20
|
+
declare const Cmp: import("svelte").Component<Props, {}, "">;
|
|
21
|
+
type Cmp = ReturnType<typeof Cmp>;
|
|
29
22
|
export default Cmp;
|
|
@@ -1,21 +1,27 @@
|
|
|
1
1
|
<script lang="ts">"use strict";
|
|
2
|
-
let { shape = 'rect', lines = 1, shimmer = false } = $props();
|
|
2
|
+
let { shape = 'rect', placeholder = false, lines = 1, shimmer = false } = $props();
|
|
3
3
|
</script>
|
|
4
4
|
|
|
5
5
|
{#if shape === 'text' && lines > 1}
|
|
6
6
|
<span class="skeleton-stack">
|
|
7
7
|
{#each Array(lines) as _, i (i)}
|
|
8
|
-
<span
|
|
8
|
+
<span
|
|
9
|
+
class="skeleton skeleton--text"
|
|
10
|
+
class:skeleton--placeholder={placeholder}
|
|
11
|
+
class:skeleton--shimmer={shimmer}
|
|
12
|
+
class:skeleton--text-last={i === lines - 1}></span>
|
|
9
13
|
{/each}
|
|
10
14
|
</span>
|
|
11
15
|
{:else}
|
|
12
|
-
<span class="skeleton skeleton--{shape}" class:skeleton--shimmer={shimmer}></span>
|
|
16
|
+
<span class="skeleton skeleton--{shape}" class:skeleton--placeholder={placeholder} class:skeleton--shimmer={shimmer}></span>
|
|
13
17
|
{/if}
|
|
14
18
|
|
|
15
19
|
<!--
|
|
16
20
|
@component
|
|
17
21
|
Skeleton — content placeholder rendered while data is loading. Three shapes: `rect` (default — generic block), `circle` (avatars), `text` (one or more text lines via `lines` — the last line is naturally shorter to suggest a paragraph end). All dimensions are CSS-var driven; sizing is the consumer's concern.
|
|
18
22
|
|
|
23
|
+
`placeholder` swaps the fill for the image-backdrop color, so a media slot reads as an empty image / video frame rather than as loading content.
|
|
24
|
+
|
|
19
25
|
### CSS Custom Properties
|
|
20
26
|
| Property | Description | Default |
|
|
21
27
|
|---|---|---|
|
|
@@ -24,7 +30,7 @@ Skeleton — content placeholder rendered while data is loading. Three shapes: `
|
|
|
24
30
|
| `--sc-kit--skeleton--text-height` | Per-line height in `shape='text'` | `0.75em` |
|
|
25
31
|
| `--sc-kit--skeleton--text-last-width` | Width of the last line in multi-line text | `70%` |
|
|
26
32
|
| `--sc-kit--skeleton--text-gap` | Vertical gap between text lines | `--sc-kit--space--2` |
|
|
27
|
-
| `--sc-kit--skeleton--base-color` | Placeholder fill / shimmer darker stop | `--sc-kit--color--bg--active` |
|
|
33
|
+
| `--sc-kit--skeleton--base-color` | Placeholder fill / shimmer darker stop | `--sc-kit--color--bg--active`, or `--sc-kit--color--bg--images` with `placeholder` |
|
|
28
34
|
| `--sc-kit--skeleton--highlight-color` | Shimmer peak (lighter stop) — `shimmer` only | `--sc-kit--color--bg--hover` |
|
|
29
35
|
| `--sc-kit--skeleton--radius` | Corner radius (rect / text) | `--sc-kit--radius--sm` |
|
|
30
36
|
| `--sc-kit--skeleton--duration` | Shimmer cycle length — `shimmer` only | `2.2s` |
|
|
@@ -43,6 +49,9 @@ Skeleton — content placeholder rendered while data is loading. Three shapes: `
|
|
|
43
49
|
width: var(--_skeleton--width);
|
|
44
50
|
height: var(--_skeleton--height);
|
|
45
51
|
}
|
|
52
|
+
.skeleton--placeholder {
|
|
53
|
+
--_skeleton--base-color: var(--sc-kit--skeleton--base-color, var(--sc-kit--color--bg--images));
|
|
54
|
+
}
|
|
46
55
|
.skeleton--shimmer {
|
|
47
56
|
--_skeleton--highlight-color: var(--sc-kit--skeleton--highlight-color, var(--sc-kit--color--bg--hover));
|
|
48
57
|
--_skeleton--duration: var(--sc-kit--skeleton--duration, 2.2s);
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
type Props = {
|
|
2
2
|
/** Shape variant. @default 'rect' */
|
|
3
3
|
shape?: 'rect' | 'circle' | 'text';
|
|
4
|
+
/** Fill with the image-backdrop color, for a media slot standing in for an image or video rather than for loading content. @default false */
|
|
5
|
+
placeholder?: boolean;
|
|
4
6
|
/** For `shape='text'` only — render N stacked text lines (last one naturally shorter to suggest paragraph end). @default 1 */
|
|
5
7
|
lines?: number;
|
|
6
8
|
/** Animate a shimmer sweep instead of a flat static placeholder. @default false */
|
|
@@ -9,6 +11,8 @@ type Props = {
|
|
|
9
11
|
/**
|
|
10
12
|
* Skeleton — content placeholder rendered while data is loading. Three shapes: `rect` (default — generic block), `circle` (avatars), `text` (one or more text lines via `lines` — the last line is naturally shorter to suggest a paragraph end). All dimensions are CSS-var driven; sizing is the consumer's concern.
|
|
11
13
|
*
|
|
14
|
+
* `placeholder` swaps the fill for the image-backdrop color, so a media slot reads as an empty image / video frame rather than as loading content.
|
|
15
|
+
*
|
|
12
16
|
* ### CSS Custom Properties
|
|
13
17
|
* | Property | Description | Default |
|
|
14
18
|
* |---|---|---|
|
|
@@ -17,7 +21,7 @@ type Props = {
|
|
|
17
21
|
* | `--sc-kit--skeleton--text-height` | Per-line height in `shape='text'` | `0.75em` |
|
|
18
22
|
* | `--sc-kit--skeleton--text-last-width` | Width of the last line in multi-line text | `70%` |
|
|
19
23
|
* | `--sc-kit--skeleton--text-gap` | Vertical gap between text lines | `--sc-kit--space--2` |
|
|
20
|
-
* | `--sc-kit--skeleton--base-color` | Placeholder fill / shimmer darker stop | `--sc-kit--color--bg--active` |
|
|
24
|
+
* | `--sc-kit--skeleton--base-color` | Placeholder fill / shimmer darker stop | `--sc-kit--color--bg--active`, or `--sc-kit--color--bg--images` with `placeholder` |
|
|
21
25
|
* | `--sc-kit--skeleton--highlight-color` | Shimmer peak (lighter stop) — `shimmer` only | `--sc-kit--color--bg--hover` |
|
|
22
26
|
* | `--sc-kit--skeleton--radius` | Corner radius (rect / text) | `--sc-kit--radius--sm` |
|
|
23
27
|
* | `--sc-kit--skeleton--duration` | Shimmer cycle length — `shimmer` only | `2.2s` |
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
<script lang="ts">import { randomNanoid } from '../../core/utils';
|
|
2
2
|
import { Icon } from '../icon';
|
|
3
3
|
import { MediaVolumeManager, PlaybackManager } from '../media-playback';
|
|
4
|
+
import { PlayIndicator } from '../play-indicator';
|
|
4
5
|
import { SeekBar } from '../seek-bar';
|
|
5
6
|
import { VideoLocalization } from './video-localization';
|
|
6
|
-
import IconPause from '@fluentui/svg-icons/icons/pause_20_regular.svg?raw';
|
|
7
|
-
import IconPlay from '@fluentui/svg-icons/icons/play_20_regular.svg?raw';
|
|
8
7
|
import IconSpeaker from '@fluentui/svg-icons/icons/speaker_2_20_regular.svg?raw';
|
|
9
8
|
import IconSpeakerMute from '@fluentui/svg-icons/icons/speaker_mute_20_regular.svg?raw';
|
|
10
9
|
import { untrack } from 'svelte';
|
|
11
10
|
import { fade } from 'svelte/transition';
|
|
12
|
-
let { src, poster, id = randomNanoid(), autoplay = false, loop = false, inert = false, allowPreloading = false, hideSpeaker = false, hidePlayButton = false, intersectionContainer, scrubberPosition = 'bottom', on } = $props();
|
|
11
|
+
let { src, poster, id = randomNanoid(), autoplay = false, loop = false, inert = false, allowPreloading = false, hideSpeaker = false, hidePlayButton = false, intersectionContainer, scrubberPosition = 'bottom', staticControls = false, on } = $props();
|
|
13
12
|
const localization = new VideoLocalization();
|
|
14
13
|
let video = $state(null);
|
|
15
14
|
let videoContainerRef = $state(null);
|
|
@@ -243,7 +242,7 @@ const handleSeek = (percent) => {
|
|
|
243
242
|
};
|
|
244
243
|
</script>
|
|
245
244
|
|
|
246
|
-
<div class="video" role="none" inert={inert} bind:this={videoContainerRef}>
|
|
245
|
+
<div class="video" class:video--static-controls={staticControls} role="none" inert={inert} bind:this={videoContainerRef}>
|
|
247
246
|
<video
|
|
248
247
|
class="video__video"
|
|
249
248
|
class:video__video--not-activated={!everActivated && !!poster}
|
|
@@ -273,16 +272,11 @@ const handleSeek = (percent) => {
|
|
|
273
272
|
role="none">
|
|
274
273
|
{#if isVideoPaused && !hidePlayButton}
|
|
275
274
|
<button type="button" aria-label={localization.play} class="video__playback-button" onclick={togglePlay} onkeydown={() => ({})}>
|
|
276
|
-
<
|
|
275
|
+
<PlayIndicator glyph="play" />
|
|
277
276
|
</button>
|
|
278
277
|
{:else if showControlsOnHover && !hidePlayButton}
|
|
279
|
-
<button
|
|
280
|
-
|
|
281
|
-
aria-label={localization.pause}
|
|
282
|
-
class="video__playback-button video__playback-button--pause"
|
|
283
|
-
onclick={togglePlay}
|
|
284
|
-
onkeydown={() => ({})}>
|
|
285
|
-
<Icon src={IconPause} color="on-accent" />
|
|
278
|
+
<button type="button" aria-label={localization.pause} class="video__playback-button" onclick={togglePlay} onkeydown={() => ({})}>
|
|
279
|
+
<PlayIndicator glyph="pause" />
|
|
286
280
|
</button>
|
|
287
281
|
{/if}
|
|
288
282
|
|
|
@@ -323,13 +317,17 @@ const handleSeek = (percent) => {
|
|
|
323
317
|
@component
|
|
324
318
|
A full-featured video player with custom overlay controls, play/pause, mute, seek bar, poster image, autoplay-on-scroll, and global playback management.
|
|
325
319
|
|
|
320
|
+
The root is a `container-type: inline-size` container, so the play / pause glyph scales with the
|
|
321
|
+
player's own width. Pass `staticControls` to drop the container where size containment would break
|
|
322
|
+
the surrounding layout.
|
|
323
|
+
|
|
326
324
|
### CSS Custom Properties
|
|
327
325
|
| Property | Description | Default |
|
|
328
326
|
|---|---|---|
|
|
329
327
|
| `--sc-kit--video--background-color` | Player background | `black` |
|
|
330
328
|
| `--sc-kit--video--border-radius` | Corner rounding | `0` |
|
|
331
329
|
| `--sc-kit--video--media-fit` | Video object-fit mode | `contain` |
|
|
332
|
-
| `--sc-kit--video--playback-button--size` |
|
|
330
|
+
| `--sc-kit--video--playback-button--size` | Pins the play / pause glyph to a fixed size instead of letting `PlayIndicator` scale it with the player width | unset |
|
|
333
331
|
| `--sc-kit--video--poster--media-fit` | Poster image object-fit mode | `cover` |
|
|
334
332
|
-->
|
|
335
333
|
|
|
@@ -337,8 +335,9 @@ A full-featured video player with custom overlay controls, play/pause, mute, see
|
|
|
337
335
|
--_video--background-color: var(--sc-kit--video--background-color, #000);
|
|
338
336
|
--_video--border-radius: var(--sc-kit--video--border-radius, 0);
|
|
339
337
|
--_video--media-fit: var(--sc-kit--video--media-fit, contain);
|
|
340
|
-
--_video--playback-button--size: var(--sc-kit--video--playback-button--size, 2.5rem);
|
|
341
338
|
--_video--poster--media-fit: var(--sc-kit--video--poster--media-fit, cover);
|
|
339
|
+
--_--play-indicator--size: var(--sc-kit--video--playback-button--size, initial);
|
|
340
|
+
container-type: inline-size;
|
|
342
341
|
height: 100%;
|
|
343
342
|
min-height: 100%;
|
|
344
343
|
max-height: 100%;
|
|
@@ -352,20 +351,14 @@ A full-featured video player with custom overlay controls, play/pause, mute, see
|
|
|
352
351
|
background: var(--_video--background-color);
|
|
353
352
|
}
|
|
354
353
|
.video__playback-button {
|
|
355
|
-
--sc-kit--icon--size: var(--_video--playback-button--size);
|
|
356
|
-
--sc-kit--icon--filter: var(--sc-kit--filter--icon-overlay);
|
|
357
354
|
position: absolute;
|
|
358
355
|
top: 50%;
|
|
359
356
|
left: 50%;
|
|
360
357
|
transform: translate(-50%, -50%);
|
|
361
358
|
}
|
|
362
|
-
.
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
@container (width < 576px) {
|
|
366
|
-
.video__playback-button--pause {
|
|
367
|
-
display: none;
|
|
368
|
-
}
|
|
359
|
+
.video--static-controls {
|
|
360
|
+
--_--play-indicator--size: var(--sc-kit--video--playback-button--size, 2.5rem);
|
|
361
|
+
container-type: normal;
|
|
369
362
|
}
|
|
370
363
|
.video__mute-button {
|
|
371
364
|
--sc-kit--icon--size: 1.25rem;
|
|
@@ -21,6 +21,12 @@ type Props = {
|
|
|
21
21
|
hidePlayButton?: boolean;
|
|
22
22
|
/** Position the seek bar at the top or bottom of the overlay @default 'bottom' */
|
|
23
23
|
scrubberPosition?: ScrubberPosition;
|
|
24
|
+
/**
|
|
25
|
+
* Removes `container-type: inline-size` from the root so the play glyph stays a fixed 40px.
|
|
26
|
+
* Use this when size containment would collapse a shrink-to-fit parent to zero width.
|
|
27
|
+
* @default false
|
|
28
|
+
*/
|
|
29
|
+
staticControls?: boolean;
|
|
24
30
|
on?: {
|
|
25
31
|
started?: (data: {
|
|
26
32
|
id: string;
|
|
@@ -41,13 +47,17 @@ type Props = {
|
|
|
41
47
|
/**
|
|
42
48
|
* A full-featured video player with custom overlay controls, play/pause, mute, seek bar, poster image, autoplay-on-scroll, and global playback management.
|
|
43
49
|
*
|
|
50
|
+
* The root is a `container-type: inline-size` container, so the play / pause glyph scales with the
|
|
51
|
+
* player's own width. Pass `staticControls` to drop the container where size containment would break
|
|
52
|
+
* the surrounding layout.
|
|
53
|
+
*
|
|
44
54
|
* ### CSS Custom Properties
|
|
45
55
|
* | Property | Description | Default |
|
|
46
56
|
* |---|---|---|
|
|
47
57
|
* | `--sc-kit--video--background-color` | Player background | `black` |
|
|
48
58
|
* | `--sc-kit--video--border-radius` | Corner rounding | `0` |
|
|
49
59
|
* | `--sc-kit--video--media-fit` | Video object-fit mode | `contain` |
|
|
50
|
-
* | `--sc-kit--video--playback-button--size` |
|
|
60
|
+
* | `--sc-kit--video--playback-button--size` | Pins the play / pause glyph to a fixed size instead of letting `PlayIndicator` scale it with the player width | unset |
|
|
51
61
|
* | `--sc-kit--video--poster--media-fit` | Poster image object-fit mode | `cover` |
|
|
52
62
|
*/
|
|
53
63
|
declare const Cmp: import("svelte").Component<Props, {}, "">;
|