@streamscloud/kit 0.0.1-1770896468307 → 0.0.1-1770977492103
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/ui/card-actions/card-action-container.d.ts +2 -0
- package/dist/ui/card-actions/card-action-container.js +17 -0
- package/dist/ui/card-actions/cmp.card-action.svelte +28 -0
- package/dist/ui/card-actions/cmp.card-action.svelte.d.ts +10 -0
- package/dist/ui/card-actions/cmp.card-actions.svelte +65 -0
- package/dist/ui/card-actions/cmp.card-actions.svelte.d.ts +9 -0
- package/dist/ui/card-actions/index.d.ts +4 -0
- package/dist/ui/card-actions/index.js +3 -0
- package/dist/ui/card-actions/types.d.ts +9 -0
- package/dist/ui/card-actions/types.js +1 -0
- package/dist/ui/dropdown/cmp.dropdown.svelte +171 -0
- package/dist/ui/dropdown/cmp.dropdown.svelte.d.ts +24 -0
- package/dist/ui/dropdown/dropdown-ignore.d.ts +4 -0
- package/dist/ui/dropdown/dropdown-ignore.js +8 -0
- package/dist/ui/dropdown/index.d.ts +3 -0
- package/dist/ui/dropdown/index.js +2 -0
- package/dist/ui/dynamic-component/cmp.dynamic-component.svelte +5 -0
- package/dist/ui/dynamic-component/cmp.dynamic-component.svelte.d.ts +7 -0
- package/dist/ui/dynamic-component/index.d.ts +2 -0
- package/dist/ui/dynamic-component/index.js +2 -0
- package/dist/ui/dynamic-component/types.svelte.d.ts +11 -0
- package/dist/ui/dynamic-component/types.svelte.js +12 -0
- package/dist/ui/media-playback/index.d.ts +2 -0
- package/dist/ui/media-playback/index.js +2 -0
- package/dist/ui/media-playback/playback-manager.svelte.d.ts +25 -0
- package/dist/ui/media-playback/playback-manager.svelte.js +62 -0
- package/dist/ui/media-playback/volume-manager.svelte.d.ts +10 -0
- package/dist/ui/media-playback/volume-manager.svelte.js +25 -0
- package/dist/ui/swipe-indicator/cmp.swipe-indicator.svelte +113 -0
- package/dist/ui/swipe-indicator/cmp.swipe-indicator.svelte.d.ts +6 -0
- package/dist/ui/swipe-indicator/index.d.ts +1 -0
- package/dist/ui/swipe-indicator/index.js +1 -0
- package/dist/ui/swipe-indicator/swipe-indicator-localization.d.ts +3 -0
- package/dist/ui/swipe-indicator/swipe-indicator-localization.js +12 -0
- package/dist/ui/video/cmp.video.svelte +371 -0
- package/dist/ui/video/cmp.video.svelte.d.ts +33 -0
- package/dist/ui/video/index.d.ts +2 -0
- package/dist/ui/video/index.js +1 -0
- package/dist/ui/video/types.d.ts +1 -0
- package/dist/ui/video/types.js +1 -0
- package/package.json +25 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const cardActionContainer = (node) => {
|
|
2
|
+
const handleHover = () => {
|
|
3
|
+
node.style.setProperty('--card-actions--opacity', '1');
|
|
4
|
+
};
|
|
5
|
+
const handleHoverOut = () => {
|
|
6
|
+
node.style.setProperty('--card-actions--opacity', '');
|
|
7
|
+
};
|
|
8
|
+
node.addEventListener('mouseenter', handleHover);
|
|
9
|
+
node.addEventListener('mouseleave', handleHoverOut);
|
|
10
|
+
node.style.position = 'relative';
|
|
11
|
+
return {
|
|
12
|
+
destroy() {
|
|
13
|
+
node.removeEventListener('mouseenter', handleHover);
|
|
14
|
+
node.removeEventListener('mouseleave', handleHoverOut);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<script lang="ts">import { Icon } from '../icon';
|
|
2
|
+
let { action, on } = $props();
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<button
|
|
6
|
+
type="button"
|
|
7
|
+
class="card-action"
|
|
8
|
+
title={action.title ?? ''}
|
|
9
|
+
onclick={(e) => {
|
|
10
|
+
if (!action.propagateClickEvent) {
|
|
11
|
+
e.stopPropagation();
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
action.callback?.();
|
|
15
|
+
on?.click?.();
|
|
16
|
+
}}>
|
|
17
|
+
<Icon src={action.icon} color={action.iconColor ?? 'text'} />
|
|
18
|
+
</button>
|
|
19
|
+
|
|
20
|
+
<style>.card-action {
|
|
21
|
+
--_card-action--padding: var(--card-action--padding, 0.3125em);
|
|
22
|
+
padding: var(--_card-action--padding);
|
|
23
|
+
transition: transform 0.3s;
|
|
24
|
+
line-height: 0;
|
|
25
|
+
}
|
|
26
|
+
.card-action:hover {
|
|
27
|
+
transform: scale(1.2);
|
|
28
|
+
}</style>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<script lang="ts">import { Dropdown } from '../dropdown';
|
|
2
|
+
import CardAction from './cmp.card-action.svelte';
|
|
3
|
+
import IconMoreVertical from '@fluentui/svg-icons/icons/more_vertical_20_regular.svg?raw';
|
|
4
|
+
let { actions, dropdownPosition = 'bottom-start' } = $props();
|
|
5
|
+
let toggleDropdown = $state.raw(null);
|
|
6
|
+
let closeDropdown = () => {
|
|
7
|
+
if (toggleDropdown) {
|
|
8
|
+
toggleDropdown(false);
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
{#if actions.length}
|
|
14
|
+
<div class="card-actions">
|
|
15
|
+
<Dropdown position={dropdownPosition} on={{ mounted: (v) => (toggleDropdown = v.toggleOpen) }}>
|
|
16
|
+
{#snippet trigger()}
|
|
17
|
+
<CardAction action={{ icon: IconMoreVertical, propagateClickEvent: true }} />
|
|
18
|
+
{/snippet}
|
|
19
|
+
|
|
20
|
+
<div class="card-actions__dropdown-content">
|
|
21
|
+
{#each actions as action (action)}
|
|
22
|
+
<CardAction action={action} on={{ click: closeDropdown }} />
|
|
23
|
+
{/each}
|
|
24
|
+
</div>
|
|
25
|
+
</Dropdown>
|
|
26
|
+
</div>
|
|
27
|
+
{/if}
|
|
28
|
+
|
|
29
|
+
<style>.card-actions {
|
|
30
|
+
--_card-actions--background: var(--card-actions--background, light-dark(#f9fafb, #111827));
|
|
31
|
+
--_card-actions--border-radius: var(--card-actions--border-radius, 0.1875em);
|
|
32
|
+
--_card-actions--dropdown-background: var(--card-actions--dropdown-background, var(--_card-actions--background));
|
|
33
|
+
--_card-actions--font-size: var(--card-actions--font-size, 1rem);
|
|
34
|
+
--_card-actions--left-offset: var(--card-actions--left-offset, 0.3125em);
|
|
35
|
+
--_card-actions--opacity: var(--card-actions--opacity, 0);
|
|
36
|
+
--_card-actions--right-offset: var(--card-actions--right-offset, auto);
|
|
37
|
+
--_card-actions--top-offset: var(--card-actions--top-offset, 0.3125em);
|
|
38
|
+
position: absolute;
|
|
39
|
+
top: var(--_card-actions--top-offset);
|
|
40
|
+
right: var(--_card-actions--right-offset);
|
|
41
|
+
left: var(--_card-actions--left-offset);
|
|
42
|
+
--icon--stroke-width: 0.3;
|
|
43
|
+
font-size: var(--_card-actions--font-size);
|
|
44
|
+
opacity: var(--_card-actions--opacity);
|
|
45
|
+
transition: opacity ease-in-out 0.4s;
|
|
46
|
+
display: flex;
|
|
47
|
+
background: var(--_card-actions--background);
|
|
48
|
+
border-radius: var(--_card-actions--border-radius);
|
|
49
|
+
}
|
|
50
|
+
.card-actions__dropdown-content {
|
|
51
|
+
padding: 0 0.3125em;
|
|
52
|
+
background: var(--_card-actions--dropdown-background);
|
|
53
|
+
}
|
|
54
|
+
@media (any-hover: none) {
|
|
55
|
+
.card-actions {
|
|
56
|
+
opacity: 1;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
:global(.card-actions-container) {
|
|
61
|
+
position: relative;
|
|
62
|
+
}
|
|
63
|
+
:global(.card-actions-container):hover .card-actions {
|
|
64
|
+
opacity: 1;
|
|
65
|
+
}</style>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type DropdownPosition } from '../dropdown';
|
|
2
|
+
import type { CardActionModel } from './types';
|
|
3
|
+
type Props = {
|
|
4
|
+
actions: CardActionModel[];
|
|
5
|
+
dropdownPosition?: DropdownPosition;
|
|
6
|
+
};
|
|
7
|
+
declare const Cmp: import("svelte").Component<Props, {}, "">;
|
|
8
|
+
type Cmp = ReturnType<typeof Cmp>;
|
|
9
|
+
export default Cmp;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
<script lang="ts">import { Icon } from '../icon';
|
|
2
|
+
import { isIgnored } from './dropdown-ignore';
|
|
3
|
+
import IconChevronDown from '@fluentui/svg-icons/icons/chevron_down_20_regular.svg?raw';
|
|
4
|
+
import { createPopper } from '@popperjs/core';
|
|
5
|
+
import { untrack } from 'svelte';
|
|
6
|
+
let { position = 'bottom-start', disabled = false, keepDropdownOpen = false, fixedPosition = false, offset = 8, boundaryMargin = 8, backdrop = false, isOpenRequested, on, children, trigger } = $props();
|
|
7
|
+
let opened = $state(false);
|
|
8
|
+
$effect(() => untrack(() => {
|
|
9
|
+
on?.mounted?.({
|
|
10
|
+
toggleOpen: (value) => {
|
|
11
|
+
if (value === undefined) {
|
|
12
|
+
if (opened) {
|
|
13
|
+
close();
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
open();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
else if (value) {
|
|
20
|
+
open();
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
close();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}));
|
|
28
|
+
$effect(() => {
|
|
29
|
+
if (opened) {
|
|
30
|
+
on?.opened?.();
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
on?.closed?.();
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
$effect(() => untrack(() => {
|
|
37
|
+
if (isOpenRequested) {
|
|
38
|
+
open();
|
|
39
|
+
}
|
|
40
|
+
}));
|
|
41
|
+
$effect(() => {
|
|
42
|
+
return () => {
|
|
43
|
+
window.removeEventListener('click', close);
|
|
44
|
+
};
|
|
45
|
+
});
|
|
46
|
+
const open = () => {
|
|
47
|
+
opened = true;
|
|
48
|
+
window.addEventListener('click', close);
|
|
49
|
+
};
|
|
50
|
+
const close = () => {
|
|
51
|
+
opened = false;
|
|
52
|
+
window.removeEventListener('click', close);
|
|
53
|
+
};
|
|
54
|
+
const handleClick = (event) => {
|
|
55
|
+
event.stopPropagation();
|
|
56
|
+
if (disabled) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (!opened) {
|
|
60
|
+
open();
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (canClose(event.target, event.currentTarget)) {
|
|
64
|
+
close();
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
const canClose = (target, container) => {
|
|
68
|
+
if (keepDropdownOpen) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
let node = target;
|
|
72
|
+
while (node && node !== container) {
|
|
73
|
+
if (isIgnored(node)) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
node = node.parentElement;
|
|
77
|
+
}
|
|
78
|
+
return true;
|
|
79
|
+
};
|
|
80
|
+
const initPopper = (node) => {
|
|
81
|
+
const triggerEl = node.previousElementSibling;
|
|
82
|
+
const popper = createPopper(triggerEl, node, {
|
|
83
|
+
placement: position,
|
|
84
|
+
strategy: fixedPosition ? 'fixed' : 'absolute',
|
|
85
|
+
modifiers: [
|
|
86
|
+
{
|
|
87
|
+
name: 'offset',
|
|
88
|
+
options: {
|
|
89
|
+
offset: () => [0, offset]
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
{ name: 'eventListeners', enabled: true },
|
|
93
|
+
{ name: 'flip' },
|
|
94
|
+
{
|
|
95
|
+
name: 'preventOverflow',
|
|
96
|
+
options: {
|
|
97
|
+
boundary: document.body,
|
|
98
|
+
padding: boundaryMargin
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
]
|
|
102
|
+
});
|
|
103
|
+
return {
|
|
104
|
+
destroy() {
|
|
105
|
+
popper.destroy();
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
</script>
|
|
110
|
+
|
|
111
|
+
{#if opened && backdrop}
|
|
112
|
+
<div
|
|
113
|
+
class="dropdown-backdrop"
|
|
114
|
+
onclick={(e) => {
|
|
115
|
+
e.stopPropagation();
|
|
116
|
+
close();
|
|
117
|
+
}}
|
|
118
|
+
onkeydown={() => ({})}
|
|
119
|
+
role="none">
|
|
120
|
+
</div>
|
|
121
|
+
{/if}
|
|
122
|
+
<div class="dropdown" class:dropdown--disabled={disabled} onclick={handleClick} onkeydown={() => ({})} role="none">
|
|
123
|
+
<button type="button" class="dropdown__trigger">
|
|
124
|
+
{#if trigger}
|
|
125
|
+
{@render trigger()}
|
|
126
|
+
{:else}
|
|
127
|
+
<Icon src={IconChevronDown} />
|
|
128
|
+
{/if}
|
|
129
|
+
</button>
|
|
130
|
+
{#if opened}
|
|
131
|
+
<div use:initPopper class="dropdown__content" role="tooltip" tabindex="-1">
|
|
132
|
+
{@render children()}
|
|
133
|
+
</div>
|
|
134
|
+
{/if}
|
|
135
|
+
</div>
|
|
136
|
+
|
|
137
|
+
<style>.dropdown-backdrop {
|
|
138
|
+
position: fixed;
|
|
139
|
+
inset: 0;
|
|
140
|
+
background: light-dark(rgba(0, 0, 0, 0.2), rgba(255, 255, 255, 0.1));
|
|
141
|
+
z-index: 998;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.dropdown {
|
|
145
|
+
--_dropdown--width: var(--dropdown--width, auto);
|
|
146
|
+
height: 100%;
|
|
147
|
+
width: var(--_dropdown--width);
|
|
148
|
+
-webkit-user-drag: none;
|
|
149
|
+
user-select: none;
|
|
150
|
+
}
|
|
151
|
+
.dropdown :global([contenteditable]) {
|
|
152
|
+
user-select: text;
|
|
153
|
+
}
|
|
154
|
+
.dropdown__trigger {
|
|
155
|
+
height: 100%;
|
|
156
|
+
width: 100%;
|
|
157
|
+
display: flex;
|
|
158
|
+
align-items: center;
|
|
159
|
+
line-height: 1;
|
|
160
|
+
}
|
|
161
|
+
.dropdown--disabled {
|
|
162
|
+
opacity: 0.5;
|
|
163
|
+
pointer-events: none;
|
|
164
|
+
}
|
|
165
|
+
.dropdown__content {
|
|
166
|
+
width: max-content;
|
|
167
|
+
z-index: 999;
|
|
168
|
+
}
|
|
169
|
+
.dropdown :global([data-popper-escaped]) {
|
|
170
|
+
visibility: hidden !important;
|
|
171
|
+
}</style>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type Placement } from '@popperjs/core';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
type Props = {
|
|
4
|
+
position?: Placement;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
keepDropdownOpen?: boolean;
|
|
7
|
+
fixedPosition?: boolean;
|
|
8
|
+
offset?: number;
|
|
9
|
+
boundaryMargin?: number;
|
|
10
|
+
backdrop?: boolean;
|
|
11
|
+
isOpenRequested?: boolean;
|
|
12
|
+
on?: {
|
|
13
|
+
opened?: () => void;
|
|
14
|
+
closed?: () => void;
|
|
15
|
+
mounted?: (callbacks: {
|
|
16
|
+
toggleOpen: (value?: boolean) => void;
|
|
17
|
+
}) => void;
|
|
18
|
+
};
|
|
19
|
+
children: Snippet;
|
|
20
|
+
trigger?: Snippet;
|
|
21
|
+
};
|
|
22
|
+
declare const Cmp: import("svelte").Component<Props, {}, "">;
|
|
23
|
+
type Cmp = ReturnType<typeof Cmp>;
|
|
24
|
+
export default Cmp;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const IGNORE_ATTRIBUTE = 'dropdownIgnore';
|
|
2
|
+
export const dropdownIgnore = (node, value = true) => {
|
|
3
|
+
node.dataset[IGNORE_ATTRIBUTE] = value.toString();
|
|
4
|
+
return {
|
|
5
|
+
destroy() { }
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
export const isIgnored = (node) => node.dataset[IGNORE_ATTRIBUTE] === 'true';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Component } from 'svelte';
|
|
2
|
+
export type DynamicComponentProps<TComponent extends Component> = TComponent extends Component<infer Props> ? Props : never;
|
|
3
|
+
export declare class DynamicComponentModel<TComponent extends Component<any> = Component<any>> {
|
|
4
|
+
component: TComponent;
|
|
5
|
+
props: DynamicComponentProps<TComponent>;
|
|
6
|
+
constructor(init: {
|
|
7
|
+
component: TComponent;
|
|
8
|
+
props: DynamicComponentProps<TComponent>;
|
|
9
|
+
});
|
|
10
|
+
updateProps(props: Partial<DynamicComponentProps<TComponent>>): void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
2
|
+
export class DynamicComponentModel {
|
|
3
|
+
component;
|
|
4
|
+
props = $state(null);
|
|
5
|
+
constructor(init) {
|
|
6
|
+
this.component = init.component;
|
|
7
|
+
this.props = init.props;
|
|
8
|
+
}
|
|
9
|
+
updateProps(props) {
|
|
10
|
+
this.props = { ...this.props, ...props };
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
type MediaCallbacks = {
|
|
2
|
+
onPlay: () => void;
|
|
3
|
+
onPause: () => void;
|
|
4
|
+
onStop: (inRespectToNewlyActivatedVideo: boolean) => void;
|
|
5
|
+
onToggle?: () => void;
|
|
6
|
+
onVolumeChange?: (volume: number) => void;
|
|
7
|
+
onMute?: () => void;
|
|
8
|
+
onUnmute?: () => void;
|
|
9
|
+
};
|
|
10
|
+
declare class PlaybackManagerInstance {
|
|
11
|
+
private _mountedPlayableComponents;
|
|
12
|
+
private _playingComponentId;
|
|
13
|
+
registerMountedPlayer: (componentId: string, callbacks: MediaCallbacks) => void;
|
|
14
|
+
unregisterPlayer: (componentId: string) => void;
|
|
15
|
+
setPlayingComponent: (componentId: string | null) => void;
|
|
16
|
+
play: (componentId: string | null) => void;
|
|
17
|
+
pause: (componentId?: string) => void;
|
|
18
|
+
stop: (componentId: string) => void;
|
|
19
|
+
toggle: (componentId: string) => void;
|
|
20
|
+
setVolume: (componentId: string, volume: number) => void;
|
|
21
|
+
mute: (componentId: string) => void;
|
|
22
|
+
unmute: (componentId: string) => void;
|
|
23
|
+
}
|
|
24
|
+
export declare const PlaybackManager: PlaybackManagerInstance;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
class PlaybackManagerInstance {
|
|
2
|
+
_mountedPlayableComponents = new Map();
|
|
3
|
+
_playingComponentId = null;
|
|
4
|
+
registerMountedPlayer = (componentId, callbacks) => {
|
|
5
|
+
this._mountedPlayableComponents.set(componentId, callbacks);
|
|
6
|
+
};
|
|
7
|
+
unregisterPlayer = (componentId) => {
|
|
8
|
+
this._mountedPlayableComponents.delete(componentId);
|
|
9
|
+
if (this._playingComponentId === componentId) {
|
|
10
|
+
this._playingComponentId = null;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
setPlayingComponent = (componentId) => {
|
|
14
|
+
if (this._playingComponentId === componentId) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
if (this._playingComponentId) {
|
|
18
|
+
const callbacks = this._mountedPlayableComponents.get(this._playingComponentId);
|
|
19
|
+
callbacks?.onStop(true);
|
|
20
|
+
}
|
|
21
|
+
this._playingComponentId = componentId;
|
|
22
|
+
};
|
|
23
|
+
play = (componentId) => {
|
|
24
|
+
this.setPlayingComponent(componentId);
|
|
25
|
+
if (componentId) {
|
|
26
|
+
const callbacks = this._mountedPlayableComponents.get(componentId);
|
|
27
|
+
callbacks?.onPlay();
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
pause = (componentId) => {
|
|
31
|
+
const id = componentId || this._playingComponentId;
|
|
32
|
+
if (!id) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const callbacks = this._mountedPlayableComponents.get(id);
|
|
36
|
+
callbacks?.onPause();
|
|
37
|
+
};
|
|
38
|
+
stop = (componentId) => {
|
|
39
|
+
const callbacks = this._mountedPlayableComponents.get(componentId);
|
|
40
|
+
callbacks?.onStop(false);
|
|
41
|
+
if (this._playingComponentId === componentId) {
|
|
42
|
+
this._playingComponentId = null;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
toggle = (componentId) => {
|
|
46
|
+
const callbacks = this._mountedPlayableComponents.get(componentId);
|
|
47
|
+
callbacks?.onToggle?.();
|
|
48
|
+
};
|
|
49
|
+
setVolume = (componentId, volume) => {
|
|
50
|
+
const callbacks = this._mountedPlayableComponents.get(componentId);
|
|
51
|
+
callbacks?.onVolumeChange?.(volume);
|
|
52
|
+
};
|
|
53
|
+
mute = (componentId) => {
|
|
54
|
+
const callbacks = this._mountedPlayableComponents.get(componentId);
|
|
55
|
+
callbacks?.onMute?.();
|
|
56
|
+
};
|
|
57
|
+
unmute = (componentId) => {
|
|
58
|
+
const callbacks = this._mountedPlayableComponents.get(componentId);
|
|
59
|
+
callbacks?.onUnmute?.();
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
export const PlaybackManager = new PlaybackManagerInstance();
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare class VolumeManagerInstance {
|
|
2
|
+
private _volumeLevel;
|
|
3
|
+
private _isMuted;
|
|
4
|
+
get volumeLevel(): number;
|
|
5
|
+
get isMuted(): boolean;
|
|
6
|
+
set volumeLevel(level: number);
|
|
7
|
+
set isMuted(state: boolean);
|
|
8
|
+
}
|
|
9
|
+
export declare const MediaVolumeManager: VolumeManagerInstance;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
class VolumeManagerInstance {
|
|
2
|
+
_volumeLevel = $state(1);
|
|
3
|
+
_isMuted = $state(false);
|
|
4
|
+
get volumeLevel() {
|
|
5
|
+
return this._volumeLevel;
|
|
6
|
+
}
|
|
7
|
+
get isMuted() {
|
|
8
|
+
return this._isMuted;
|
|
9
|
+
}
|
|
10
|
+
set volumeLevel(level) {
|
|
11
|
+
if (level < 0) {
|
|
12
|
+
this._volumeLevel = 0;
|
|
13
|
+
}
|
|
14
|
+
else if (level > 1) {
|
|
15
|
+
this._volumeLevel = 1;
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
this._volumeLevel = level;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
set isMuted(state) {
|
|
22
|
+
this._isMuted = state;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export const MediaVolumeManager = new VolumeManagerInstance();
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
<script lang="ts">import { Icon } from '../icon';
|
|
2
|
+
import { SwipeIndicatorLocalization } from './swipe-indicator-localization';
|
|
3
|
+
import IconArrowUp from '@fluentui/svg-icons/icons/arrow_up_20_regular.svg?raw';
|
|
4
|
+
let { fadeTimeout = 2000 } = $props();
|
|
5
|
+
const localization = new SwipeIndicatorLocalization();
|
|
6
|
+
let isFaded = $state(false);
|
|
7
|
+
const indicatorMounted = (_) => {
|
|
8
|
+
if (fadeTimeout) {
|
|
9
|
+
const timeout = setTimeout(() => {
|
|
10
|
+
isFaded = true;
|
|
11
|
+
}, fadeTimeout);
|
|
12
|
+
return {
|
|
13
|
+
destroy() {
|
|
14
|
+
clearTimeout(timeout);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<div class="swipe-indicator" class:swipe-indicator--faded={isFaded} use:indicatorMounted>
|
|
22
|
+
<div class="swipe-indicator__icon">
|
|
23
|
+
<Icon src={IconArrowUp} />
|
|
24
|
+
</div>
|
|
25
|
+
<div class="swipe-indicator__text">
|
|
26
|
+
{localization.swipe}
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
<style>.swipe-indicator {
|
|
31
|
+
--_swipe-indicator--color: var(--swipe-indicator--color, #ffffff);
|
|
32
|
+
--_swipe-indicator--font-size: var(--swipe-indicator--font-size, 1rem);
|
|
33
|
+
--_swipe-indicator--icon-size: var(--swipe-indicator--icon-size, var(--_swipe-indicator--font-size));
|
|
34
|
+
display: flex;
|
|
35
|
+
flex-direction: column;
|
|
36
|
+
align-items: center;
|
|
37
|
+
justify-content: center;
|
|
38
|
+
position: absolute;
|
|
39
|
+
top: 80%;
|
|
40
|
+
left: 50%;
|
|
41
|
+
transform: translate(-50%, -50%);
|
|
42
|
+
z-index: 10;
|
|
43
|
+
color: var(--_swipe-indicator--color);
|
|
44
|
+
opacity: 1;
|
|
45
|
+
transition: opacity 2s cubic-bezier(0.4, 0, 0.2, 1);
|
|
46
|
+
}
|
|
47
|
+
.swipe-indicator--faded {
|
|
48
|
+
opacity: 0;
|
|
49
|
+
pointer-events: none;
|
|
50
|
+
}
|
|
51
|
+
.swipe-indicator:before {
|
|
52
|
+
content: "";
|
|
53
|
+
position: absolute;
|
|
54
|
+
inset: 0;
|
|
55
|
+
z-index: 0;
|
|
56
|
+
pointer-events: none;
|
|
57
|
+
border-radius: 50%;
|
|
58
|
+
background: #000000;
|
|
59
|
+
filter: blur(12px);
|
|
60
|
+
transform: scale(3);
|
|
61
|
+
}
|
|
62
|
+
.swipe-indicator__icon {
|
|
63
|
+
font-size: var(--_swipe-indicator--icon-size);
|
|
64
|
+
animation: bounce 2.7s cubic-bezier(0.22, 0.61, 0.36, 1) infinite;
|
|
65
|
+
will-change: transform;
|
|
66
|
+
z-index: 1;
|
|
67
|
+
}
|
|
68
|
+
.swipe-indicator__text {
|
|
69
|
+
font-size: var(--_swipe-indicator--font-size);
|
|
70
|
+
z-index: 1;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@keyframes bounce {
|
|
74
|
+
0%, 100% {
|
|
75
|
+
transform: translateY(0);
|
|
76
|
+
}
|
|
77
|
+
10% {
|
|
78
|
+
transform: translateY(-24px);
|
|
79
|
+
}
|
|
80
|
+
18% {
|
|
81
|
+
transform: translateY(0);
|
|
82
|
+
}
|
|
83
|
+
26% {
|
|
84
|
+
transform: translateY(-12px);
|
|
85
|
+
}
|
|
86
|
+
34% {
|
|
87
|
+
transform: translateY(0);
|
|
88
|
+
}
|
|
89
|
+
41% {
|
|
90
|
+
transform: translateY(-8px);
|
|
91
|
+
}
|
|
92
|
+
48% {
|
|
93
|
+
transform: translateY(0);
|
|
94
|
+
}
|
|
95
|
+
54% {
|
|
96
|
+
transform: translateY(-4px);
|
|
97
|
+
}
|
|
98
|
+
60% {
|
|
99
|
+
transform: translateY(0);
|
|
100
|
+
}
|
|
101
|
+
65% {
|
|
102
|
+
transform: translateY(-2px);
|
|
103
|
+
}
|
|
104
|
+
70% {
|
|
105
|
+
transform: translateY(0);
|
|
106
|
+
}
|
|
107
|
+
75% {
|
|
108
|
+
transform: translateY(-1px);
|
|
109
|
+
}
|
|
110
|
+
80% {
|
|
111
|
+
transform: translateY(0);
|
|
112
|
+
}
|
|
113
|
+
}</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as SwipeIndicator } from './cmp.swipe-indicator.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as SwipeIndicator } from './cmp.swipe-indicator.svelte';
|
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
<script lang="ts">import { randomNanoid } from '../../core/utils';
|
|
2
|
+
import { Icon } from '../icon';
|
|
3
|
+
import { MediaVolumeManager, PlaybackManager } from '../media-playback';
|
|
4
|
+
import { SeekBar } from '../seek-bar';
|
|
5
|
+
import IconPause from '@fluentui/svg-icons/icons/pause_20_regular.svg?raw';
|
|
6
|
+
import IconPlay from '@fluentui/svg-icons/icons/play_20_regular.svg?raw';
|
|
7
|
+
import IconSpeaker from '@fluentui/svg-icons/icons/speaker_2_20_regular.svg?raw';
|
|
8
|
+
import IconSpeakerMute from '@fluentui/svg-icons/icons/speaker_mute_20_regular.svg?raw';
|
|
9
|
+
import { untrack } from 'svelte';
|
|
10
|
+
import { fade } from 'svelte/transition';
|
|
11
|
+
let { src, poster, id = randomNanoid(), controls = true, autoplay = false, loop = false, inert = false, allowPreloading = false, hideSpeaker = false, hidePlayButton = false, intersectionContainer, scrubberPosition = 'bottom', on } = $props();
|
|
12
|
+
let video = $state(null);
|
|
13
|
+
let videoContainerRef = $state(null);
|
|
14
|
+
let showControlsOnHover = $state(false);
|
|
15
|
+
let isVideoPaused = $state(true);
|
|
16
|
+
let percentageCompleted = $state(0);
|
|
17
|
+
let everActivated = $state(false);
|
|
18
|
+
let autoplayState = $state(untrack(() => autoplay));
|
|
19
|
+
$effect(() => {
|
|
20
|
+
void src;
|
|
21
|
+
untrack(() => {
|
|
22
|
+
if (video?.src) {
|
|
23
|
+
video.src = src;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
// Register player instance in global playback manager
|
|
28
|
+
$effect(() => untrack(() => {
|
|
29
|
+
PlaybackManager.registerMountedPlayer(id, {
|
|
30
|
+
onPlay: () => {
|
|
31
|
+
void play();
|
|
32
|
+
},
|
|
33
|
+
onPause: () => {
|
|
34
|
+
pause();
|
|
35
|
+
},
|
|
36
|
+
onStop: (inRespectToNewlyActivatedVideo) => {
|
|
37
|
+
if (autoplayState === 'on-appearance' && inRespectToNewlyActivatedVideo) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
stop();
|
|
41
|
+
},
|
|
42
|
+
onToggle: () => {
|
|
43
|
+
togglePlay();
|
|
44
|
+
},
|
|
45
|
+
onVolumeChange: (volume) => {
|
|
46
|
+
setVolume(volume);
|
|
47
|
+
},
|
|
48
|
+
onMute: () => {
|
|
49
|
+
setMuted(true);
|
|
50
|
+
},
|
|
51
|
+
onUnmute: () => {
|
|
52
|
+
setMuted(false);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
on?.loaded?.({ id, src });
|
|
56
|
+
return () => {
|
|
57
|
+
PlaybackManager.unregisterPlayer(id);
|
|
58
|
+
};
|
|
59
|
+
}));
|
|
60
|
+
// Intersection observer for lazy loading and autoplay-on-appearance
|
|
61
|
+
$effect(() => {
|
|
62
|
+
if (!videoContainerRef) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
const container = videoContainerRef;
|
|
66
|
+
return untrack(() => {
|
|
67
|
+
const observer = new IntersectionObserver((entries) => {
|
|
68
|
+
if (!video) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const [entry] = entries;
|
|
72
|
+
if ((entry.isIntersecting || allowPreloading) && !video.src) {
|
|
73
|
+
video.src = src;
|
|
74
|
+
video.load();
|
|
75
|
+
if (autoplayState === true) {
|
|
76
|
+
const handleCanPlay = () => {
|
|
77
|
+
if (entry.isIntersecting) {
|
|
78
|
+
void play();
|
|
79
|
+
autoplayState = false;
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
video.addEventListener('canplay', handleCanPlay, { once: true });
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (autoplayState !== 'on-appearance') {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (!entry.isIntersecting) {
|
|
90
|
+
stop();
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
if (entry.intersectionRatio < 0.4) {
|
|
94
|
+
pause();
|
|
95
|
+
}
|
|
96
|
+
if (entry.intersectionRatio >= 0.6) {
|
|
97
|
+
const handleCanPlay = () => {
|
|
98
|
+
if (entry.intersectionRatio >= 0.6) {
|
|
99
|
+
void play();
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
if (video.readyState >= 3) {
|
|
103
|
+
void play();
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
video.addEventListener('canplay', handleCanPlay, { once: true });
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}, {
|
|
110
|
+
root: intersectionContainer,
|
|
111
|
+
rootMargin: '0px',
|
|
112
|
+
threshold: [0.1, 0.4, 0.6]
|
|
113
|
+
});
|
|
114
|
+
observer.observe(container);
|
|
115
|
+
return () => {
|
|
116
|
+
observer.disconnect();
|
|
117
|
+
};
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
const play = async () => {
|
|
121
|
+
if (!video) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
try {
|
|
125
|
+
await video.play();
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
// can't play video without interaction with document, just ignoring the error
|
|
129
|
+
}
|
|
130
|
+
finally {
|
|
131
|
+
if (video.paused) {
|
|
132
|
+
video.muted = true;
|
|
133
|
+
void video.play();
|
|
134
|
+
}
|
|
135
|
+
everActivated = true;
|
|
136
|
+
}
|
|
137
|
+
on?.started?.({ id, src });
|
|
138
|
+
};
|
|
139
|
+
const pause = () => {
|
|
140
|
+
video?.pause();
|
|
141
|
+
};
|
|
142
|
+
const stop = () => {
|
|
143
|
+
if (!video) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
video.pause();
|
|
147
|
+
video.currentTime = 0;
|
|
148
|
+
video.load();
|
|
149
|
+
onPause();
|
|
150
|
+
};
|
|
151
|
+
const togglePlay = (e) => {
|
|
152
|
+
e?.stopPropagation();
|
|
153
|
+
if (!video) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
if (video.paused) {
|
|
157
|
+
void play();
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
pause();
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
const toggleMute = (e) => {
|
|
164
|
+
e?.stopPropagation();
|
|
165
|
+
setMuted(!video?.muted);
|
|
166
|
+
};
|
|
167
|
+
const onVolumeChange = () => {
|
|
168
|
+
if (!video) {
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
MediaVolumeManager.volumeLevel = video.volume;
|
|
172
|
+
MediaVolumeManager.isMuted = video.muted;
|
|
173
|
+
};
|
|
174
|
+
const onTimeUpdate = () => {
|
|
175
|
+
if (!video) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
percentageCompleted = video.currentTime / video.duration || 0;
|
|
179
|
+
notifyProgress();
|
|
180
|
+
};
|
|
181
|
+
const onLoaded = () => {
|
|
182
|
+
setVolume(MediaVolumeManager.volumeLevel);
|
|
183
|
+
setMuted(MediaVolumeManager.isMuted);
|
|
184
|
+
};
|
|
185
|
+
const onEnded = () => {
|
|
186
|
+
percentageCompleted = 1;
|
|
187
|
+
notifyProgress();
|
|
188
|
+
on?.ended?.({ id, src });
|
|
189
|
+
if (!loop) {
|
|
190
|
+
everActivated = false;
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
const onPlay = () => {
|
|
194
|
+
isVideoPaused = false;
|
|
195
|
+
PlaybackManager.setPlayingComponent(id);
|
|
196
|
+
};
|
|
197
|
+
const onPause = () => {
|
|
198
|
+
isVideoPaused = true;
|
|
199
|
+
};
|
|
200
|
+
const setVolume = (level) => {
|
|
201
|
+
MediaVolumeManager.volumeLevel = level;
|
|
202
|
+
if (video) {
|
|
203
|
+
video.volume = level;
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
const setMuted = (state) => {
|
|
207
|
+
MediaVolumeManager.isMuted = state;
|
|
208
|
+
};
|
|
209
|
+
$effect(() => {
|
|
210
|
+
if (video) {
|
|
211
|
+
video.muted = MediaVolumeManager.isMuted;
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
const notifyProgress = () => {
|
|
215
|
+
on?.progress?.(percentageCompleted);
|
|
216
|
+
};
|
|
217
|
+
const handleSeek = (percent) => {
|
|
218
|
+
if (video) {
|
|
219
|
+
video.currentTime = video.duration * percent;
|
|
220
|
+
percentageCompleted = percent;
|
|
221
|
+
notifyProgress();
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
</script>
|
|
225
|
+
|
|
226
|
+
<div class="video" role="none" inert={inert} bind:this={videoContainerRef}>
|
|
227
|
+
<video
|
|
228
|
+
class="video__video"
|
|
229
|
+
class:video__video--not-activated={!everActivated}
|
|
230
|
+
width="100%"
|
|
231
|
+
controls={controls && everActivated}
|
|
232
|
+
poster={poster}
|
|
233
|
+
loop={loop}
|
|
234
|
+
preload="metadata"
|
|
235
|
+
onvolumechange={onVolumeChange}
|
|
236
|
+
ontimeupdate={onTimeUpdate}
|
|
237
|
+
onloadeddata={onLoaded}
|
|
238
|
+
onended={onEnded}
|
|
239
|
+
onplay={onPlay}
|
|
240
|
+
onpause={onPause}
|
|
241
|
+
playsinline
|
|
242
|
+
bind:this={video}>
|
|
243
|
+
<track src="" kind="captions" />
|
|
244
|
+
</video>
|
|
245
|
+
{#if !everActivated && poster}
|
|
246
|
+
<img class="video__poster" src={poster} alt="" />
|
|
247
|
+
{/if}
|
|
248
|
+
{#if !controls || !everActivated}
|
|
249
|
+
<div class="video__overlay" onclick={togglePlay} onkeydown={() => ({})} role="none">
|
|
250
|
+
{#if isVideoPaused && !hidePlayButton}
|
|
251
|
+
<button type="button" aria-label="play" class="video__playback-button" onclick={togglePlay} onkeydown={() => ({})}>
|
|
252
|
+
<Icon src={IconPlay} color="white" />
|
|
253
|
+
</button>
|
|
254
|
+
{:else if showControlsOnHover && !hidePlayButton}
|
|
255
|
+
<button type="button" aria-label="pause" class="video__playback-button video__playback-button--pause" onclick={togglePlay} onkeydown={() => ({})}>
|
|
256
|
+
<Icon src={IconPause} color="white" />
|
|
257
|
+
</button>
|
|
258
|
+
{/if}
|
|
259
|
+
{#if (showControlsOnHover || MediaVolumeManager.isMuted) && !hideSpeaker}
|
|
260
|
+
<button type="button" aria-label={MediaVolumeManager.isMuted ? 'mute' : 'unmute'} class="video__mute-button" onclick={toggleMute}>
|
|
261
|
+
{#if MediaVolumeManager.isMuted}
|
|
262
|
+
<Icon src={IconSpeakerMute} color="white" />
|
|
263
|
+
{:else}
|
|
264
|
+
<Icon src={IconSpeaker} color="white" />
|
|
265
|
+
{/if}
|
|
266
|
+
</button>
|
|
267
|
+
{/if}
|
|
268
|
+
|
|
269
|
+
{#if everActivated}
|
|
270
|
+
<div
|
|
271
|
+
class="video__progress-container"
|
|
272
|
+
class:video__progress-container--top={scrubberPosition === 'top'}
|
|
273
|
+
class:video__progress-container--bottom={scrubberPosition === 'bottom'}
|
|
274
|
+
onmouseenter={() => (showControlsOnHover = true)}
|
|
275
|
+
onmouseleave={() => (showControlsOnHover = false)}
|
|
276
|
+
role="none">
|
|
277
|
+
{#if showControlsOnHover || (!showControlsOnHover && isVideoPaused)}
|
|
278
|
+
<div
|
|
279
|
+
class="video__seek-bar"
|
|
280
|
+
transition:fade={{ duration: isVideoPaused ? 0 : 300 }}
|
|
281
|
+
onclick={(e) => e.stopPropagation()}
|
|
282
|
+
onkeydown={() => ({})}
|
|
283
|
+
role="none">
|
|
284
|
+
<SeekBar value={percentageCompleted} on={{ seek: handleSeek }} />
|
|
285
|
+
</div>
|
|
286
|
+
{/if}
|
|
287
|
+
</div>
|
|
288
|
+
{/if}
|
|
289
|
+
</div>
|
|
290
|
+
{/if}
|
|
291
|
+
</div>
|
|
292
|
+
|
|
293
|
+
<style>.video {
|
|
294
|
+
--_video--background-color: var(--video--background-color, #000000);
|
|
295
|
+
--_video--border-radius: var(--video--border-radius, 0);
|
|
296
|
+
--_video--media-fit: var(--video--media-fit, contain);
|
|
297
|
+
--_video--poster--media-fit: var(--video--poster--media-fit, cover);
|
|
298
|
+
height: 100%;
|
|
299
|
+
min-height: 100%;
|
|
300
|
+
max-height: 100%;
|
|
301
|
+
width: 100%;
|
|
302
|
+
min-width: 100%;
|
|
303
|
+
max-width: 100%;
|
|
304
|
+
cursor: pointer;
|
|
305
|
+
position: relative;
|
|
306
|
+
overflow: hidden;
|
|
307
|
+
border-radius: var(--_video--border-radius);
|
|
308
|
+
background: var(--_video--background-color);
|
|
309
|
+
}
|
|
310
|
+
.video__playback-button {
|
|
311
|
+
--icon--filter: drop-shadow(1px 1px #000000);
|
|
312
|
+
position: absolute;
|
|
313
|
+
top: 50%;
|
|
314
|
+
left: 50%;
|
|
315
|
+
transform: translate(-50%, -50%);
|
|
316
|
+
font-size: 2em;
|
|
317
|
+
}
|
|
318
|
+
.video__playback-button--pause {
|
|
319
|
+
/* Set 'container-type: inline-size;' to reference container*/
|
|
320
|
+
}
|
|
321
|
+
@container (width < 576px) {
|
|
322
|
+
.video__playback-button--pause {
|
|
323
|
+
display: none;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
.video__mute-button {
|
|
327
|
+
position: absolute;
|
|
328
|
+
top: 0.625em;
|
|
329
|
+
right: 0.625em;
|
|
330
|
+
font-size: 1em;
|
|
331
|
+
z-index: 1;
|
|
332
|
+
}
|
|
333
|
+
.video__poster {
|
|
334
|
+
object-fit: var(--_video--poster--media-fit);
|
|
335
|
+
min-width: 100%;
|
|
336
|
+
min-height: 100%;
|
|
337
|
+
max-width: 100%;
|
|
338
|
+
max-height: 100%;
|
|
339
|
+
}
|
|
340
|
+
.video__video {
|
|
341
|
+
object-fit: var(--_video--media-fit);
|
|
342
|
+
min-width: 100%;
|
|
343
|
+
min-height: 100%;
|
|
344
|
+
max-width: 100%;
|
|
345
|
+
max-height: 100%;
|
|
346
|
+
}
|
|
347
|
+
.video__video--not-activated {
|
|
348
|
+
visibility: hidden;
|
|
349
|
+
height: 0;
|
|
350
|
+
min-height: 0;
|
|
351
|
+
}
|
|
352
|
+
.video__overlay {
|
|
353
|
+
position: absolute;
|
|
354
|
+
inset: 0;
|
|
355
|
+
background-color: transparent;
|
|
356
|
+
}
|
|
357
|
+
.video__progress-container {
|
|
358
|
+
position: absolute;
|
|
359
|
+
left: 0;
|
|
360
|
+
right: 0;
|
|
361
|
+
z-index: 1;
|
|
362
|
+
padding-inline: 0.25rem;
|
|
363
|
+
}
|
|
364
|
+
.video__progress-container--top {
|
|
365
|
+
top: 0;
|
|
366
|
+
padding-bottom: 0.9375rem;
|
|
367
|
+
}
|
|
368
|
+
.video__progress-container--bottom {
|
|
369
|
+
bottom: 0;
|
|
370
|
+
padding-top: 0.9375rem;
|
|
371
|
+
}</style>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ScrubberPosition } from './types';
|
|
2
|
+
type Props = {
|
|
3
|
+
src: string;
|
|
4
|
+
poster: string | null | undefined;
|
|
5
|
+
id?: string;
|
|
6
|
+
controls?: boolean;
|
|
7
|
+
autoplay?: true | false | 'on-appearance';
|
|
8
|
+
loop?: boolean;
|
|
9
|
+
intersectionContainer?: HTMLElement;
|
|
10
|
+
inert?: boolean;
|
|
11
|
+
allowPreloading?: boolean;
|
|
12
|
+
hideSpeaker?: boolean;
|
|
13
|
+
hidePlayButton?: boolean;
|
|
14
|
+
scrubberPosition?: ScrubberPosition;
|
|
15
|
+
on?: {
|
|
16
|
+
started?: (data: {
|
|
17
|
+
id: string;
|
|
18
|
+
src: string;
|
|
19
|
+
}) => void;
|
|
20
|
+
loaded?: (data: {
|
|
21
|
+
id: string;
|
|
22
|
+
src: string;
|
|
23
|
+
}) => void;
|
|
24
|
+
progress?: (value: number) => void;
|
|
25
|
+
ended?: (data: {
|
|
26
|
+
id: string;
|
|
27
|
+
src: string;
|
|
28
|
+
}) => void;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
declare const Cmp: import("svelte").Component<Props, {}, "">;
|
|
32
|
+
type Cmp = ReturnType<typeof Cmp>;
|
|
33
|
+
export default Cmp;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Video } from './cmp.video.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ScrubberPosition = 'top' | 'bottom';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamscloud/kit",
|
|
3
|
-
"version": "0.0.1-
|
|
3
|
+
"version": "0.0.1-1770977492103",
|
|
4
4
|
"author": "StreamsCloud",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -88,10 +88,22 @@
|
|
|
88
88
|
"types": "./dist/ui/button/index.d.ts",
|
|
89
89
|
"svelte": "./dist/ui/button/index.js"
|
|
90
90
|
},
|
|
91
|
+
"./ui/card-actions": {
|
|
92
|
+
"types": "./dist/ui/card-actions/index.d.ts",
|
|
93
|
+
"svelte": "./dist/ui/card-actions/index.js"
|
|
94
|
+
},
|
|
91
95
|
"./ui/dialog": {
|
|
92
96
|
"types": "./dist/ui/dialog/index.d.ts",
|
|
93
97
|
"svelte": "./dist/ui/dialog/index.js"
|
|
94
98
|
},
|
|
99
|
+
"./ui/dynamic-component": {
|
|
100
|
+
"types": "./dist/ui/dynamic-component/index.d.ts",
|
|
101
|
+
"svelte": "./dist/ui/dynamic-component/index.js"
|
|
102
|
+
},
|
|
103
|
+
"./ui/dropdown": {
|
|
104
|
+
"types": "./dist/ui/dropdown/index.d.ts",
|
|
105
|
+
"svelte": "./dist/ui/dropdown/index.js"
|
|
106
|
+
},
|
|
95
107
|
"./ui/icon": {
|
|
96
108
|
"types": "./dist/ui/icon/index.d.ts",
|
|
97
109
|
"svelte": "./dist/ui/icon/index.js"
|
|
@@ -112,6 +124,10 @@
|
|
|
112
124
|
"types": "./dist/ui/loading/index.d.ts",
|
|
113
125
|
"svelte": "./dist/ui/loading/index.js"
|
|
114
126
|
},
|
|
127
|
+
"./ui/media-playback": {
|
|
128
|
+
"types": "./dist/ui/media-playback/index.d.ts",
|
|
129
|
+
"svelte": "./dist/ui/media-playback/index.js"
|
|
130
|
+
},
|
|
115
131
|
"./ui/progress": {
|
|
116
132
|
"types": "./dist/ui/progress/index.d.ts",
|
|
117
133
|
"svelte": "./dist/ui/progress/index.js"
|
|
@@ -124,10 +140,18 @@
|
|
|
124
140
|
"types": "./dist/ui/seek-bar/index.d.ts",
|
|
125
141
|
"svelte": "./dist/ui/seek-bar/index.js"
|
|
126
142
|
},
|
|
143
|
+
"./ui/swipe-indicator": {
|
|
144
|
+
"types": "./dist/ui/swipe-indicator/index.d.ts",
|
|
145
|
+
"svelte": "./dist/ui/swipe-indicator/index.js"
|
|
146
|
+
},
|
|
127
147
|
"./ui/time-ago": {
|
|
128
148
|
"types": "./dist/ui/time-ago/index.d.ts",
|
|
129
149
|
"svelte": "./dist/ui/time-ago/index.js"
|
|
130
150
|
},
|
|
151
|
+
"./ui/video": {
|
|
152
|
+
"types": "./dist/ui/video/index.d.ts",
|
|
153
|
+
"svelte": "./dist/ui/video/index.js"
|
|
154
|
+
},
|
|
131
155
|
"./styles/base": {
|
|
132
156
|
"sass": "./dist/styles/_index.scss"
|
|
133
157
|
},
|