@streamscloud/kit 0.73.0 → 0.75.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/utils/image-preloader.d.ts +0 -2
- package/dist/core/utils/image-preloader.js +0 -9
- package/dist/ui/grid-card/cmp.grid-card-media.svelte +3 -3
- package/dist/ui/grid-card/cmp.grid-card-media.svelte.d.ts +0 -2
- package/dist/ui/image/cmp.image.svelte +3 -7
- package/dist/ui/image/cmp.image.svelte.d.ts +0 -2
- package/dist/ui/tile-card/cmp.tile-card.svelte +6 -10
- package/dist/ui/tile-card/cmp.tile-card.svelte.d.ts +0 -2
- package/package.json +1 -1
|
@@ -1,3 +1 @@
|
|
|
1
1
|
export declare const preloadImage: (src: string, throwOnError?: boolean) => Promise<void>;
|
|
2
|
-
/** Decodes a loaded `<img>` once, so a drag ghost snapshotted right after includes the picture. A broken image is ignored. */
|
|
3
|
-
export declare const predecodeImage: (img: HTMLImageElement) => Promise<void>;
|
|
@@ -8,12 +8,3 @@ export const preloadImage = (src, throwOnError = false) => {
|
|
|
8
8
|
img.src = src;
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
/** Decodes a loaded `<img>` once, so a drag ghost snapshotted right after includes the picture. A broken image is ignored. */
|
|
12
|
-
export const predecodeImage = async (img) => {
|
|
13
|
-
try {
|
|
14
|
-
await img.decode();
|
|
15
|
-
}
|
|
16
|
-
catch {
|
|
17
|
-
// a broken image has nothing to decode
|
|
18
|
-
}
|
|
19
|
-
};
|
|
@@ -8,7 +8,7 @@ import { ProportionalContainer } from '../proportional-container';
|
|
|
8
8
|
import { SeekBar } from '../seek-bar';
|
|
9
9
|
import VideoPlayer from './video-player.svelte';
|
|
10
10
|
import IconImageOff from '@fluentui/svg-icons/icons/image_off_20_regular.svg?raw';
|
|
11
|
-
const { items, aspectRatio = 'vertical', objectFit = 'contain', showSeekBar = true, duration
|
|
11
|
+
const { items, aspectRatio = 'vertical', objectFit = 'contain', showSeekBar = true, duration } = $props();
|
|
12
12
|
let currentIndex = $state(0);
|
|
13
13
|
let currentTime = $state(0);
|
|
14
14
|
let mediaDuration = $state(NaN);
|
|
@@ -63,7 +63,7 @@ const onCarouselIndexChanged = (index) => {
|
|
|
63
63
|
active={true}
|
|
64
64
|
on={{ timeUpdate: onPlayerTimeUpdate, durationChange: onPlayerDurationChange, activate: onPlayerActivate }} />
|
|
65
65
|
{:else}
|
|
66
|
-
<Image src={items[0].url} showStubOnError={true}
|
|
66
|
+
<Image src={items[0].url} showStubOnError={true} />
|
|
67
67
|
{/if}
|
|
68
68
|
</div>
|
|
69
69
|
{:else}
|
|
@@ -78,7 +78,7 @@ const onCarouselIndexChanged = (index) => {
|
|
|
78
78
|
active={item === items[currentIndex]}
|
|
79
79
|
on={{ timeUpdate: onPlayerTimeUpdate, durationChange: onPlayerDurationChange, activate: onPlayerActivate }} />
|
|
80
80
|
{:else}
|
|
81
|
-
<Image src={item.url} showStubOnError={true}
|
|
81
|
+
<Image src={item.url} showStubOnError={true} />
|
|
82
82
|
{/if}
|
|
83
83
|
</div>
|
|
84
84
|
{/snippet}
|
|
@@ -15,8 +15,6 @@ type Props = {
|
|
|
15
15
|
showSeekBar?: boolean;
|
|
16
16
|
/** Duration in seconds; rendered as a badge overlay at the bottom-right of the media. `≤ 0` / `undefined` renders nothing. */
|
|
17
17
|
duration?: number;
|
|
18
|
-
/** Forwarded to each `Image`. Set it when the card sits in a `DragSource`, or the first drag ghost comes out without the picture. @default false */
|
|
19
|
-
predecode?: boolean;
|
|
20
18
|
};
|
|
21
19
|
/**
|
|
22
20
|
* Media slot for `GridCard`. Renders an empty placeholder, a single `Image` / `VideoPlayer`, or
|
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
<script lang="ts">import {
|
|
2
|
-
import { Icon } from '../icon';
|
|
1
|
+
<script lang="ts">import { Icon } from '../icon';
|
|
3
2
|
import { calculateImageState } from './image-state';
|
|
4
3
|
import IconImageOff from '@fluentui/svg-icons/icons/image_off_20_regular.svg?raw';
|
|
5
|
-
let { src, alt = '', showStubOnError = false,
|
|
4
|
+
let { src, alt = '', showStubOnError = false, on, stub } = $props();
|
|
6
5
|
let hasError = $state(false);
|
|
7
6
|
const imageState = $derived(calculateImageState(src, hasError, showStubOnError));
|
|
8
7
|
// A 0.01x density makes the intrinsic size 100× the natural one, so `contain` sizing always scales the picture
|
|
9
8
|
// down to fit — small pictures upscale too — and the box hugs the picture, rounding its own corners.
|
|
10
9
|
// `src` must stay unset: it would join srcset as the 1x candidate and win.
|
|
11
10
|
const srcset = $derived(src ? `${src.replace(/\s/g, (char) => encodeURIComponent(char))} 0.01x` : undefined);
|
|
12
|
-
const onLoad = (
|
|
13
|
-
if (predecode && event.currentTarget instanceof HTMLImageElement) {
|
|
14
|
-
void predecodeImage(event.currentTarget);
|
|
15
|
-
}
|
|
11
|
+
const onLoad = () => {
|
|
16
12
|
hasError = false;
|
|
17
13
|
on?.load?.(true);
|
|
18
14
|
};
|
|
@@ -5,8 +5,6 @@ type Props = {
|
|
|
5
5
|
alt?: string;
|
|
6
6
|
/** Show a placeholder stub instead of an error icon when image fails to load */
|
|
7
7
|
showStubOnError?: boolean;
|
|
8
|
-
/** Decodes the picture once right after it loads. Set it when the element can be dragged, or the first drag ghost comes out empty. @default false */
|
|
9
|
-
predecode?: boolean;
|
|
10
8
|
on?: {
|
|
11
9
|
/** Fires after load attempt; `true` if successful, `false` on error */
|
|
12
10
|
load?: (loadedSuccessfully: boolean) => void;
|
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
<script lang="ts">import {
|
|
2
|
-
import { Checkbox } from '../checkbox';
|
|
1
|
+
<script lang="ts">import { Checkbox } from '../checkbox';
|
|
3
2
|
import { ToolbarIconButton } from '../page-toolbar';
|
|
4
3
|
import { PlayIndicator } from '../play-indicator';
|
|
5
4
|
import { Popover } from '../popover';
|
|
6
5
|
import { TileCardLocalization } from './tile-card-localization';
|
|
7
6
|
import IconMore from '@fluentui/svg-icons/icons/more_vertical_20_regular.svg?raw';
|
|
8
|
-
const { title, meta, preview,
|
|
7
|
+
const { title, meta, preview, menu, menuLabel, selected = false, checkboxVisibility = 'hover', on } = $props();
|
|
9
8
|
const localization = new TileCardLocalization();
|
|
10
|
-
const onPictureLoad = (event) => {
|
|
11
|
-
if (predecode && event.currentTarget instanceof HTMLImageElement) {
|
|
12
|
-
void predecodeImage(event.currentTarget);
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
9
|
// Safari paints no frame for preload="metadata" until a seek target is given.
|
|
16
10
|
const withFirstFrame = (src) => (src.includes('#') ? src : `${src}#t=0.001`);
|
|
17
11
|
</script>
|
|
@@ -25,7 +19,7 @@ const withFirstFrame = (src) => (src.includes('#') ? src : `${src}#t=0.001`);
|
|
|
25
19
|
{#if typeof preview === 'function'}
|
|
26
20
|
{@render preview()}
|
|
27
21
|
{:else if 'image' in preview}
|
|
28
|
-
<img class="tile-card__picture" src={preview.image} alt=""
|
|
22
|
+
<img class="tile-card__picture" src={preview.image} alt="" />
|
|
29
23
|
{:else}
|
|
30
24
|
<video class="tile-card__picture" src={withFirstFrame(preview.video)} poster={preview.poster} preload="metadata" muted playsinline></video>
|
|
31
25
|
<span class="tile-card__play"><PlayIndicator /></span>
|
|
@@ -142,10 +136,12 @@ checkbox via `on.select`, whole-card activation via `on.activate`. For a drop-ta
|
|
|
142
136
|
pointer-events: none;
|
|
143
137
|
}
|
|
144
138
|
.tile-card__picture {
|
|
139
|
+
position: absolute;
|
|
140
|
+
inset: 0;
|
|
145
141
|
display: block;
|
|
146
142
|
max-inline-size: 100%;
|
|
147
143
|
max-block-size: 100%;
|
|
148
|
-
|
|
144
|
+
margin: auto;
|
|
149
145
|
}
|
|
150
146
|
.tile-card__play {
|
|
151
147
|
position: absolute;
|
|
@@ -6,8 +6,6 @@ type Props = {
|
|
|
6
6
|
meta?: string;
|
|
7
7
|
/** Top area: `image` / `video` render a drag-safe picture or frame (contain, never upscaled; a video gets a play glyph); a snippet renders custom content. The area is `pointer-events: none` — interactive content belongs in `menu` or `on.activate`. */
|
|
8
8
|
preview?: TileCardPreview;
|
|
9
|
-
/** Decodes the `image` preview once right after it loads. Set it when the tile sits in a `DragSource`, or the first drag ghost comes out without the picture — an `<img>` in a preview snippet needs `predecodeImage` from its owner. @default false */
|
|
10
|
-
predecode?: boolean;
|
|
11
9
|
/** `PopoverItem`s of the kebab menu at the end of the footer. */
|
|
12
10
|
menu?: Snippet;
|
|
13
11
|
/** Accessible name of the kebab menu. @default localized "Actions" */
|