@loidolt/theme-svelte 0.5.0 → 0.7.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/README.md +11 -0
- package/dist/announcer.svelte.d.ts +36 -0
- package/dist/announcer.svelte.js +73 -0
- package/dist/attachments.d.ts +83 -0
- package/dist/attachments.js +211 -0
- package/dist/components/ActiveFilterChips.svelte +80 -0
- package/dist/components/ActiveFilterChips.svelte.d.ts +41 -0
- package/dist/components/AspectRatio.svelte +32 -0
- package/dist/components/AspectRatio.svelte.d.ts +13 -0
- package/dist/components/AudioPlayer.svelte +94 -0
- package/dist/components/AudioPlayer.svelte.d.ts +24 -0
- package/dist/components/Avatar.svelte +85 -0
- package/dist/components/Avatar.svelte.d.ts +31 -0
- package/dist/components/Badge.svelte +28 -2
- package/dist/components/Badge.svelte.d.ts +13 -1
- package/dist/components/Combobox.svelte +180 -0
- package/dist/components/Combobox.svelte.d.ts +77 -0
- package/dist/components/DataTable.svelte +228 -0
- package/dist/components/DataTable.svelte.d.ts +62 -0
- package/dist/components/DataTableColumnVisibility.svelte +46 -0
- package/dist/components/DataTableColumnVisibility.svelte.d.ts +31 -0
- package/dist/components/DataTableFacetedFilter.svelte +87 -0
- package/dist/components/DataTableFacetedFilter.svelte.d.ts +40 -0
- package/dist/components/DataTablePagination.svelte +68 -0
- package/dist/components/DataTablePagination.svelte.d.ts +42 -0
- package/dist/components/DataTableSearch.svelte +67 -0
- package/dist/components/DataTableSearch.svelte.d.ts +37 -0
- package/dist/components/Dialog.svelte +32 -11
- package/dist/components/Dialog.svelte.d.ts +7 -0
- package/dist/components/DropdownMenu.svelte +95 -28
- package/dist/components/DropdownMenu.svelte.d.ts +12 -3
- package/dist/components/Field.svelte +2 -3
- package/dist/components/Fieldset.svelte +2 -3
- package/dist/components/Filmstrip.svelte +10 -3
- package/dist/components/FilterPanel.svelte +62 -0
- package/dist/components/FilterPanel.svelte.d.ts +22 -0
- package/dist/components/Lightbox.svelte +239 -0
- package/dist/components/Lightbox.svelte.d.ts +40 -0
- package/dist/components/LiveRegion.svelte +48 -0
- package/dist/components/LiveRegion.svelte.d.ts +20 -0
- package/dist/components/MediaCarousel.svelte +177 -0
- package/dist/components/MediaCarousel.svelte.d.ts +32 -0
- package/dist/components/MediaEmbed.svelte +116 -0
- package/dist/components/MediaEmbed.svelte.d.ts +34 -0
- package/dist/components/MediaGrid.svelte +91 -0
- package/dist/components/MediaGrid.svelte.d.ts +24 -0
- package/dist/components/MultiSelect.svelte +232 -0
- package/dist/components/MultiSelect.svelte.d.ts +67 -0
- package/dist/components/NumberField.svelte +53 -25
- package/dist/components/NumberField.svelte.d.ts +47 -18
- package/dist/components/OTPInput.svelte +94 -0
- package/dist/components/OTPInput.svelte.d.ts +26 -0
- package/dist/components/PasswordInput.svelte +93 -0
- package/dist/components/PasswordInput.svelte.d.ts +24 -0
- package/dist/components/Progress.svelte +57 -14
- package/dist/components/Progress.svelte.d.ts +13 -0
- package/dist/components/RadioGroup.svelte +19 -5
- package/dist/components/RadioGroup.svelte.d.ts +3 -2
- package/dist/components/Select.svelte +15 -5
- package/dist/components/Select.svelte.d.ts +3 -2
- package/dist/components/SignaturePad.svelte +317 -0
- package/dist/components/SignaturePad.svelte.d.ts +48 -0
- package/dist/components/Skeleton.svelte +40 -9
- package/dist/components/Skeleton.svelte.d.ts +8 -0
- package/dist/components/SkipLink.svelte +48 -0
- package/dist/components/SkipLink.svelte.d.ts +14 -0
- package/dist/components/Slider.svelte +148 -0
- package/dist/components/Slider.svelte.d.ts +55 -0
- package/dist/components/Spinner.svelte +11 -2
- package/dist/components/Spinner.svelte.d.ts +3 -0
- package/dist/components/Tabs.svelte.d.ts +1 -1
- package/dist/components/Thumbnail.svelte +52 -6
- package/dist/components/Thumbnail.svelte.d.ts +14 -2
- package/dist/components/Toast.svelte +24 -0
- package/dist/components/Toast.svelte.d.ts +10 -0
- package/dist/components/ToastViewport.svelte +9 -1
- package/dist/components/ToastViewport.svelte.d.ts +2 -0
- package/dist/components/Toolbar.svelte +49 -0
- package/dist/components/Toolbar.svelte.d.ts +23 -0
- package/dist/components/Tooltip.svelte +9 -1
- package/dist/components/Tooltip.svelte.d.ts +2 -0
- package/dist/components/VideoPlayer.svelte +136 -0
- package/dist/components/VideoPlayer.svelte.d.ts +38 -0
- package/dist/data-table-utils.d.ts +62 -0
- package/dist/data-table-utils.js +91 -0
- package/dist/data-table.svelte.d.ts +132 -0
- package/dist/data-table.svelte.js +292 -0
- package/dist/hls.d.ts +35 -0
- package/dist/hls.js +37 -0
- package/dist/hls.svelte.d.ts +22 -0
- package/dist/hls.svelte.js +66 -0
- package/dist/index.d.ts +49 -4
- package/dist/index.js +36 -2
- package/dist/internal/EditableCell.svelte +58 -0
- package/dist/internal/EditableCell.svelte.d.ts +8 -0
- package/dist/internal/ListboxEntries.svelte +49 -0
- package/dist/internal/ListboxEntries.svelte.d.ts +35 -0
- package/dist/internal/media/MediaControls.svelte +163 -0
- package/dist/internal/media/MediaControls.svelte.d.ts +12 -0
- package/dist/internal/media/MediaStage.svelte +49 -0
- package/dist/internal/media/MediaStage.svelte.d.ts +11 -0
- package/dist/internal/media/MediaTile.svelte +36 -0
- package/dist/internal/media/MediaTile.svelte.d.ts +11 -0
- package/dist/internal/media/keys.d.ts +7 -0
- package/dist/internal/media/keys.js +51 -0
- package/dist/internal/media/labels.d.ts +19 -0
- package/dist/internal/media/labels.js +15 -0
- package/dist/internal/options.d.ts +9 -0
- package/dist/internal/options.js +20 -0
- package/dist/media-player.svelte.d.ts +61 -0
- package/dist/media-player.svelte.js +246 -0
- package/dist/media-utils.d.ts +112 -0
- package/dist/media-utils.js +205 -0
- package/dist/media-zoom.svelte.d.ts +33 -0
- package/dist/media-zoom.svelte.js +126 -0
- package/dist/signature.d.ts +55 -0
- package/dist/signature.js +52 -0
- package/dist/toaster.svelte.d.ts +24 -0
- package/dist/toaster.svelte.js +23 -0
- package/dist/token-colors.svelte.d.ts +49 -0
- package/dist/token-colors.svelte.js +165 -0
- package/dist/types.d.ts +62 -3
- package/dist/utils.d.ts +9 -0
- package/dist/utils.js +11 -0
- package/package.json +10 -4
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { canPlayHlsNatively, loadHls } from './hls.js';
|
|
2
|
+
/**
|
|
3
|
+
* Plays an HLS playlist in a media element — natively where the browser can, through hls.js
|
|
4
|
+
* where it cannot. Fatal network errors retry and media errors attempt recovery before the
|
|
5
|
+
* status turns to `error`.
|
|
6
|
+
*/
|
|
7
|
+
export function createHlsSource(options = {}) {
|
|
8
|
+
let status = $state('idle');
|
|
9
|
+
let error = $state(null);
|
|
10
|
+
const fail = (next, message) => {
|
|
11
|
+
status = next;
|
|
12
|
+
error = new Error(message);
|
|
13
|
+
options.onError?.(error);
|
|
14
|
+
};
|
|
15
|
+
const source = (src) => (media) => {
|
|
16
|
+
error = null;
|
|
17
|
+
if (canPlayHlsNatively(media)) {
|
|
18
|
+
media.src = src;
|
|
19
|
+
status = 'native';
|
|
20
|
+
return () => {
|
|
21
|
+
media.removeAttribute('src');
|
|
22
|
+
media.load();
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
status = 'loading';
|
|
26
|
+
let cancelled = false;
|
|
27
|
+
let destroy;
|
|
28
|
+
void loadHls(options.loader).then((Hls) => {
|
|
29
|
+
if (cancelled)
|
|
30
|
+
return;
|
|
31
|
+
if (!Hls?.isSupported()) {
|
|
32
|
+
fail('unsupported', 'This browser needs hls.js to play the stream. Register it once: setHlsLoader(() => import("hls.js").then((module) => module.default)).');
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const instance = new Hls(options.config);
|
|
36
|
+
instance.on(Hls.Events.ERROR, (_event, data) => {
|
|
37
|
+
if (!data?.fatal)
|
|
38
|
+
return;
|
|
39
|
+
if (data.type === Hls.ErrorTypes.NETWORK_ERROR)
|
|
40
|
+
instance.startLoad();
|
|
41
|
+
else if (data.type === Hls.ErrorTypes.MEDIA_ERROR)
|
|
42
|
+
instance.recoverMediaError();
|
|
43
|
+
else
|
|
44
|
+
fail('error', `HLS playback failed: ${data.details ?? 'unknown error'}`);
|
|
45
|
+
});
|
|
46
|
+
instance.loadSource(src);
|
|
47
|
+
instance.attachMedia(media);
|
|
48
|
+
destroy = () => instance.destroy();
|
|
49
|
+
status = 'attached';
|
|
50
|
+
});
|
|
51
|
+
return () => {
|
|
52
|
+
cancelled = true;
|
|
53
|
+
destroy?.();
|
|
54
|
+
status = 'idle';
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
return {
|
|
58
|
+
source,
|
|
59
|
+
get status() {
|
|
60
|
+
return status;
|
|
61
|
+
},
|
|
62
|
+
get error() {
|
|
63
|
+
return error;
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
export { default as Accordion } from './components/Accordion.svelte';
|
|
2
|
+
export { default as ActiveFilterChips } from './components/ActiveFilterChips.svelte';
|
|
2
3
|
export { default as Alert } from './components/Alert.svelte';
|
|
3
4
|
export { default as AlertDialog } from './components/AlertDialog.svelte';
|
|
4
5
|
export { default as AppShell } from './components/AppShell.svelte';
|
|
6
|
+
export { default as AspectRatio } from './components/AspectRatio.svelte';
|
|
7
|
+
export { default as AudioPlayer } from './components/AudioPlayer.svelte';
|
|
8
|
+
export { default as Avatar } from './components/Avatar.svelte';
|
|
5
9
|
export { default as Badge } from './components/Badge.svelte';
|
|
6
10
|
export { default as Brand } from './components/Brand.svelte';
|
|
7
11
|
export { default as Breadcrumbs } from './components/Breadcrumbs.svelte';
|
|
@@ -9,8 +13,14 @@ export { default as Button } from './components/Button.svelte';
|
|
|
9
13
|
export { default as Card } from './components/Card.svelte';
|
|
10
14
|
export { default as Checkbox } from './components/Checkbox.svelte';
|
|
11
15
|
export { default as CodeBlock } from './components/CodeBlock.svelte';
|
|
16
|
+
export { default as Combobox } from './components/Combobox.svelte';
|
|
12
17
|
export { default as CommentList } from './components/CommentList.svelte';
|
|
13
18
|
export { default as ContextBar } from './components/ContextBar.svelte';
|
|
19
|
+
export { default as DataTable } from './components/DataTable.svelte';
|
|
20
|
+
export { default as DataTableColumnVisibility } from './components/DataTableColumnVisibility.svelte';
|
|
21
|
+
export { default as DataTableFacetedFilter } from './components/DataTableFacetedFilter.svelte';
|
|
22
|
+
export { default as DataTablePagination } from './components/DataTablePagination.svelte';
|
|
23
|
+
export { default as DataTableSearch } from './components/DataTableSearch.svelte';
|
|
14
24
|
export { default as Dialog } from './components/Dialog.svelte';
|
|
15
25
|
export { default as Drawer } from './components/Drawer.svelte';
|
|
16
26
|
export { default as DropdownMenu } from './components/DropdownMenu.svelte';
|
|
@@ -19,17 +29,26 @@ export { default as Field } from './components/Field.svelte';
|
|
|
19
29
|
export { default as Fieldset } from './components/Fieldset.svelte';
|
|
20
30
|
export { default as FileInput } from './components/FileInput.svelte';
|
|
21
31
|
export { default as Filmstrip } from './components/Filmstrip.svelte';
|
|
32
|
+
export { default as FilterPanel } from './components/FilterPanel.svelte';
|
|
22
33
|
export { default as FloatingBar } from './components/FloatingBar.svelte';
|
|
23
34
|
export { default as IconButton } from './components/IconButton.svelte';
|
|
24
35
|
export { default as Input } from './components/Input.svelte';
|
|
25
36
|
export { default as Label } from './components/Label.svelte';
|
|
37
|
+
export { default as Lightbox } from './components/Lightbox.svelte';
|
|
26
38
|
export { default as ListRow } from './components/ListRow.svelte';
|
|
39
|
+
export { default as LiveRegion } from './components/LiveRegion.svelte';
|
|
27
40
|
export { default as Marker } from './components/Marker.svelte';
|
|
41
|
+
export { default as MediaCarousel } from './components/MediaCarousel.svelte';
|
|
42
|
+
export { default as MediaEmbed } from './components/MediaEmbed.svelte';
|
|
43
|
+
export { default as MediaGrid } from './components/MediaGrid.svelte';
|
|
44
|
+
export { default as MultiSelect } from './components/MultiSelect.svelte';
|
|
28
45
|
export { default as NavMenu } from './components/NavMenu.svelte';
|
|
29
46
|
export { default as NumberField } from './components/NumberField.svelte';
|
|
47
|
+
export { default as OTPInput } from './components/OTPInput.svelte';
|
|
30
48
|
export { default as PageHeader } from './components/PageHeader.svelte';
|
|
31
49
|
export { default as Pagination } from './components/Pagination.svelte';
|
|
32
50
|
export { default as Panel } from './components/Panel.svelte';
|
|
51
|
+
export { default as PasswordInput } from './components/PasswordInput.svelte';
|
|
33
52
|
export { default as Popover } from './components/Popover.svelte';
|
|
34
53
|
export { default as Progress } from './components/Progress.svelte';
|
|
35
54
|
export { default as RadioGroup } from './components/RadioGroup.svelte';
|
|
@@ -39,7 +58,10 @@ export { default as SegmentedNav } from './components/SegmentedNav.svelte';
|
|
|
39
58
|
export { default as Select } from './components/Select.svelte';
|
|
40
59
|
export { default as Separator } from './components/Separator.svelte';
|
|
41
60
|
export { default as Sidebar } from './components/Sidebar.svelte';
|
|
61
|
+
export { default as SignaturePad } from './components/SignaturePad.svelte';
|
|
42
62
|
export { default as Skeleton } from './components/Skeleton.svelte';
|
|
63
|
+
export { default as SkipLink } from './components/SkipLink.svelte';
|
|
64
|
+
export { default as Slider } from './components/Slider.svelte';
|
|
43
65
|
export { default as Spinner } from './components/Spinner.svelte';
|
|
44
66
|
export { default as Stat } from './components/Stat.svelte';
|
|
45
67
|
export { default as StatusDot } from './components/StatusDot.svelte';
|
|
@@ -54,20 +76,43 @@ export { default as Thumbnail } from './components/Thumbnail.svelte';
|
|
|
54
76
|
export { default as Toast } from './components/Toast.svelte';
|
|
55
77
|
export { default as ToastViewport } from './components/ToastViewport.svelte';
|
|
56
78
|
export { default as ToggleGroup } from './components/ToggleGroup.svelte';
|
|
79
|
+
export { default as Toolbar } from './components/Toolbar.svelte';
|
|
57
80
|
export { default as Tooltip } from './components/Tooltip.svelte';
|
|
58
81
|
export { default as TooltipProvider } from './components/TooltipProvider.svelte';
|
|
59
82
|
export { default as Topbar } from './components/Topbar.svelte';
|
|
83
|
+
export { default as VideoPlayer } from './components/VideoPlayer.svelte';
|
|
60
84
|
export { default as Workspace } from './components/Workspace.svelte';
|
|
61
85
|
/**
|
|
62
86
|
* Bits UI primitives behind the wrappers, for menus and overlays this package does not
|
|
63
87
|
* model declaratively (checkbox/radio items, submenus, custom overlay composition).
|
|
64
88
|
*/
|
|
65
|
-
export { Accordion as AccordionPrimitive, AlertDialog as AlertDialogPrimitive, Dialog as DialogPrimitive, DropdownMenu as DropdownMenuPrimitive, Pagination as PaginationPrimitive, Popover as PopoverPrimitive, Tabs as TabsPrimitive, ToggleGroup as ToggleGroupPrimitive, Tooltip as TooltipPrimitive, } from 'bits-ui';
|
|
66
|
-
export { cx } from './utils.js';
|
|
89
|
+
export { Accordion as AccordionPrimitive, AlertDialog as AlertDialogPrimitive, Avatar as AvatarPrimitive, Combobox as ComboboxPrimitive, Dialog as DialogPrimitive, DropdownMenu as DropdownMenuPrimitive, Pagination as PaginationPrimitive, PinInput as PinInputPrimitive, Popover as PopoverPrimitive, Slider as SliderPrimitive, Tabs as TabsPrimitive, ToggleGroup as ToggleGroupPrimitive, Tooltip as TooltipPrimitive, } from 'bits-ui';
|
|
90
|
+
export { cx, describedBy } from './utils.js';
|
|
91
|
+
export { autofocus, clickOutside, escapeKey, focusTrap, rovingFocus } from './attachments.js';
|
|
92
|
+
export type { AutofocusOptions, ClickOutsideOptions, EscapeKeyOptions, FocusTrapOptions, RovingFocusOptions, } from './attachments.js';
|
|
93
|
+
export { buildEmbedSrc, embedThumbnail, formatDuration, formatDurationSpoken, inferMediaKind, isHlsSource, mediaLabel, mediaThumbnail, parseEmbedUrl, resolveAspectRatio, toMediaSources, } from './media-utils.js';
|
|
94
|
+
export type { AspectRatioName, AudioMediaItem, EmbedMediaItem, EmbedProvider, EmbedSrcOptions, ImageMediaItem, MediaItem, MediaKind, MediaSourceEntry, MediaTextTrack, ParsedEmbed, VideoMediaItem, } from './media-utils.js';
|
|
95
|
+
export { createMediaPlayer } from './media-player.svelte.js';
|
|
96
|
+
export type { MediaPlayer, MediaPlayerOptions, MediaTrackInfo } from './media-player.svelte.js';
|
|
97
|
+
export { createMediaZoom } from './media-zoom.svelte.js';
|
|
98
|
+
export type { MediaZoom, MediaZoomOptions } from './media-zoom.svelte.js';
|
|
99
|
+
export { canPlayHlsNatively, loadHls, setHlsLoader } from './hls.js';
|
|
100
|
+
export type { HlsConstructor, HlsErrorData, HlsInstance, HlsLoader } from './hls.js';
|
|
101
|
+
export { createHlsSource } from './hls.svelte.js';
|
|
102
|
+
export type { HlsSource, HlsSourceOptions, HlsStatus } from './hls.svelte.js';
|
|
103
|
+
export type { MediaPlayerLabels } from './internal/media/labels.js';
|
|
104
|
+
export { strokeLength, strokePath, strokesToSvg, validateSignature } from './signature.js';
|
|
105
|
+
export type { SignatureError, SignaturePoint, SignatureStroke, SignatureValue, } from './signature.js';
|
|
106
|
+
export { createDataTable } from './data-table.svelte.js';
|
|
107
|
+
export type { DataTableColumn, DataTableFilterValue, DataTableOptions, DataTableRow, DataTableSort, DataTableState, } from './data-table.svelte.js';
|
|
108
|
+
export { colorSchemeOf, createTokenColors, normalizeColor, observeColorScheme, readRoleColor, } from './token-colors.svelte.js';
|
|
109
|
+
export type { TokenColors, TokenColorsOptions } from './token-colors.svelte.js';
|
|
110
|
+
export { createAnnouncer } from './announcer.svelte.js';
|
|
111
|
+
export type { Announcer, AnnouncerOptions, Politeness } from './announcer.svelte.js';
|
|
67
112
|
export { createToaster } from './toaster.svelte.js';
|
|
68
|
-
export type { Toaster, ToasterOptions, ToastOptions, ToastRecord } from './toaster.svelte.js';
|
|
113
|
+
export type { Toaster, ToasterOptions, ToastAction, ToastOptions, ToastRecord, ToastShortcutOptions, } from './toaster.svelte.js';
|
|
69
114
|
export { createTheme, themeScript } from './theme.svelte.js';
|
|
70
115
|
export type { ColorScheme, Theme, ThemeOptions, ThemePreference, ThemeScriptOptions, } from './theme.svelte.js';
|
|
71
116
|
export { breakpointQuery, createMediaQuery } from './media.svelte.js';
|
|
72
117
|
export type { BreakpointName, MediaQuery, MediaQueryOptions } from './media.svelte.js';
|
|
73
|
-
export type { ActionVariant, Alignment, BadgeSize, BadgeVariant, ColumnAlign, Crumb, Disclosure, ControlSize, DialogSize, HeadingLevel, MenuItem, NavItem, Option, Orientation, Placement, SortDirection, StatusVariant, TriggerChildProps, } from './types.js';
|
|
118
|
+
export type { ActionVariant, Alignment, BadgeSize, BadgeVariant, ChoiceOption, ColumnAlign, Crumb, Disclosure, ControlSize, DialogSize, HeadingLevel, MenuCheckboxItem, MenuEntry, MenuGroup, MenuItem, MenuRadioGroup, MenuSub, NavItem, Option, OptionGroup, Orientation, Placement, SortDirection, StatusVariant, TriggerChildProps, } from './types.js';
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
export { default as Accordion } from './components/Accordion.svelte';
|
|
2
|
+
export { default as ActiveFilterChips } from './components/ActiveFilterChips.svelte';
|
|
2
3
|
export { default as Alert } from './components/Alert.svelte';
|
|
3
4
|
export { default as AlertDialog } from './components/AlertDialog.svelte';
|
|
4
5
|
export { default as AppShell } from './components/AppShell.svelte';
|
|
6
|
+
export { default as AspectRatio } from './components/AspectRatio.svelte';
|
|
7
|
+
export { default as AudioPlayer } from './components/AudioPlayer.svelte';
|
|
8
|
+
export { default as Avatar } from './components/Avatar.svelte';
|
|
5
9
|
export { default as Badge } from './components/Badge.svelte';
|
|
6
10
|
export { default as Brand } from './components/Brand.svelte';
|
|
7
11
|
export { default as Breadcrumbs } from './components/Breadcrumbs.svelte';
|
|
@@ -9,8 +13,14 @@ export { default as Button } from './components/Button.svelte';
|
|
|
9
13
|
export { default as Card } from './components/Card.svelte';
|
|
10
14
|
export { default as Checkbox } from './components/Checkbox.svelte';
|
|
11
15
|
export { default as CodeBlock } from './components/CodeBlock.svelte';
|
|
16
|
+
export { default as Combobox } from './components/Combobox.svelte';
|
|
12
17
|
export { default as CommentList } from './components/CommentList.svelte';
|
|
13
18
|
export { default as ContextBar } from './components/ContextBar.svelte';
|
|
19
|
+
export { default as DataTable } from './components/DataTable.svelte';
|
|
20
|
+
export { default as DataTableColumnVisibility } from './components/DataTableColumnVisibility.svelte';
|
|
21
|
+
export { default as DataTableFacetedFilter } from './components/DataTableFacetedFilter.svelte';
|
|
22
|
+
export { default as DataTablePagination } from './components/DataTablePagination.svelte';
|
|
23
|
+
export { default as DataTableSearch } from './components/DataTableSearch.svelte';
|
|
14
24
|
export { default as Dialog } from './components/Dialog.svelte';
|
|
15
25
|
export { default as Drawer } from './components/Drawer.svelte';
|
|
16
26
|
export { default as DropdownMenu } from './components/DropdownMenu.svelte';
|
|
@@ -19,17 +29,26 @@ export { default as Field } from './components/Field.svelte';
|
|
|
19
29
|
export { default as Fieldset } from './components/Fieldset.svelte';
|
|
20
30
|
export { default as FileInput } from './components/FileInput.svelte';
|
|
21
31
|
export { default as Filmstrip } from './components/Filmstrip.svelte';
|
|
32
|
+
export { default as FilterPanel } from './components/FilterPanel.svelte';
|
|
22
33
|
export { default as FloatingBar } from './components/FloatingBar.svelte';
|
|
23
34
|
export { default as IconButton } from './components/IconButton.svelte';
|
|
24
35
|
export { default as Input } from './components/Input.svelte';
|
|
25
36
|
export { default as Label } from './components/Label.svelte';
|
|
37
|
+
export { default as Lightbox } from './components/Lightbox.svelte';
|
|
26
38
|
export { default as ListRow } from './components/ListRow.svelte';
|
|
39
|
+
export { default as LiveRegion } from './components/LiveRegion.svelte';
|
|
27
40
|
export { default as Marker } from './components/Marker.svelte';
|
|
41
|
+
export { default as MediaCarousel } from './components/MediaCarousel.svelte';
|
|
42
|
+
export { default as MediaEmbed } from './components/MediaEmbed.svelte';
|
|
43
|
+
export { default as MediaGrid } from './components/MediaGrid.svelte';
|
|
44
|
+
export { default as MultiSelect } from './components/MultiSelect.svelte';
|
|
28
45
|
export { default as NavMenu } from './components/NavMenu.svelte';
|
|
29
46
|
export { default as NumberField } from './components/NumberField.svelte';
|
|
47
|
+
export { default as OTPInput } from './components/OTPInput.svelte';
|
|
30
48
|
export { default as PageHeader } from './components/PageHeader.svelte';
|
|
31
49
|
export { default as Pagination } from './components/Pagination.svelte';
|
|
32
50
|
export { default as Panel } from './components/Panel.svelte';
|
|
51
|
+
export { default as PasswordInput } from './components/PasswordInput.svelte';
|
|
33
52
|
export { default as Popover } from './components/Popover.svelte';
|
|
34
53
|
export { default as Progress } from './components/Progress.svelte';
|
|
35
54
|
export { default as RadioGroup } from './components/RadioGroup.svelte';
|
|
@@ -39,7 +58,10 @@ export { default as SegmentedNav } from './components/SegmentedNav.svelte';
|
|
|
39
58
|
export { default as Select } from './components/Select.svelte';
|
|
40
59
|
export { default as Separator } from './components/Separator.svelte';
|
|
41
60
|
export { default as Sidebar } from './components/Sidebar.svelte';
|
|
61
|
+
export { default as SignaturePad } from './components/SignaturePad.svelte';
|
|
42
62
|
export { default as Skeleton } from './components/Skeleton.svelte';
|
|
63
|
+
export { default as SkipLink } from './components/SkipLink.svelte';
|
|
64
|
+
export { default as Slider } from './components/Slider.svelte';
|
|
43
65
|
export { default as Spinner } from './components/Spinner.svelte';
|
|
44
66
|
export { default as Stat } from './components/Stat.svelte';
|
|
45
67
|
export { default as StatusDot } from './components/StatusDot.svelte';
|
|
@@ -54,16 +76,28 @@ export { default as Thumbnail } from './components/Thumbnail.svelte';
|
|
|
54
76
|
export { default as Toast } from './components/Toast.svelte';
|
|
55
77
|
export { default as ToastViewport } from './components/ToastViewport.svelte';
|
|
56
78
|
export { default as ToggleGroup } from './components/ToggleGroup.svelte';
|
|
79
|
+
export { default as Toolbar } from './components/Toolbar.svelte';
|
|
57
80
|
export { default as Tooltip } from './components/Tooltip.svelte';
|
|
58
81
|
export { default as TooltipProvider } from './components/TooltipProvider.svelte';
|
|
59
82
|
export { default as Topbar } from './components/Topbar.svelte';
|
|
83
|
+
export { default as VideoPlayer } from './components/VideoPlayer.svelte';
|
|
60
84
|
export { default as Workspace } from './components/Workspace.svelte';
|
|
61
85
|
/**
|
|
62
86
|
* Bits UI primitives behind the wrappers, for menus and overlays this package does not
|
|
63
87
|
* model declaratively (checkbox/radio items, submenus, custom overlay composition).
|
|
64
88
|
*/
|
|
65
|
-
export { Accordion as AccordionPrimitive, AlertDialog as AlertDialogPrimitive, Dialog as DialogPrimitive, DropdownMenu as DropdownMenuPrimitive, Pagination as PaginationPrimitive, Popover as PopoverPrimitive, Tabs as TabsPrimitive, ToggleGroup as ToggleGroupPrimitive, Tooltip as TooltipPrimitive, } from 'bits-ui';
|
|
66
|
-
export { cx } from './utils.js';
|
|
89
|
+
export { Accordion as AccordionPrimitive, AlertDialog as AlertDialogPrimitive, Avatar as AvatarPrimitive, Combobox as ComboboxPrimitive, Dialog as DialogPrimitive, DropdownMenu as DropdownMenuPrimitive, Pagination as PaginationPrimitive, PinInput as PinInputPrimitive, Popover as PopoverPrimitive, Slider as SliderPrimitive, Tabs as TabsPrimitive, ToggleGroup as ToggleGroupPrimitive, Tooltip as TooltipPrimitive, } from 'bits-ui';
|
|
90
|
+
export { cx, describedBy } from './utils.js';
|
|
91
|
+
export { autofocus, clickOutside, escapeKey, focusTrap, rovingFocus } from './attachments.js';
|
|
92
|
+
export { buildEmbedSrc, embedThumbnail, formatDuration, formatDurationSpoken, inferMediaKind, isHlsSource, mediaLabel, mediaThumbnail, parseEmbedUrl, resolveAspectRatio, toMediaSources, } from './media-utils.js';
|
|
93
|
+
export { createMediaPlayer } from './media-player.svelte.js';
|
|
94
|
+
export { createMediaZoom } from './media-zoom.svelte.js';
|
|
95
|
+
export { canPlayHlsNatively, loadHls, setHlsLoader } from './hls.js';
|
|
96
|
+
export { createHlsSource } from './hls.svelte.js';
|
|
97
|
+
export { strokeLength, strokePath, strokesToSvg, validateSignature } from './signature.js';
|
|
98
|
+
export { createDataTable } from './data-table.svelte.js';
|
|
99
|
+
export { colorSchemeOf, createTokenColors, normalizeColor, observeColorScheme, readRoleColor, } from './token-colors.svelte.js';
|
|
100
|
+
export { createAnnouncer } from './announcer.svelte.js';
|
|
67
101
|
export { createToaster } from './toaster.svelte.js';
|
|
68
102
|
export { createTheme, themeScript } from './theme.svelte.js';
|
|
69
103
|
export { breakpointQuery, createMediaQuery } from './media.svelte.js';
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { autofocus } from '../attachments.js';
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
* A cell that turns into a text field on demand. Enter or leaving the field saves; Escape puts
|
|
6
|
+
* the old value back. The resting state is a real button, so the cell is reachable and
|
|
7
|
+
* announced as editable without making the whole row a click target.
|
|
8
|
+
*/
|
|
9
|
+
interface Props {
|
|
10
|
+
value: string;
|
|
11
|
+
label: string;
|
|
12
|
+
onCommit: (value: string) => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
let { value, label, onCommit }: Props = $props();
|
|
16
|
+
|
|
17
|
+
let editing = $state(false);
|
|
18
|
+
let draft = $state('');
|
|
19
|
+
let button = $state<HTMLButtonElement | null>(null);
|
|
20
|
+
|
|
21
|
+
function start() {
|
|
22
|
+
draft = value;
|
|
23
|
+
editing = true;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function finish(save: boolean) {
|
|
27
|
+
if (!editing) return;
|
|
28
|
+
editing = false;
|
|
29
|
+
if (save && draft !== value) onCommit(draft);
|
|
30
|
+
// Hand focus back to the cell once it is a button again.
|
|
31
|
+
queueMicrotask(() => button?.focus());
|
|
32
|
+
}
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
{#if editing}
|
|
36
|
+
<input
|
|
37
|
+
class="ldt-data-table__edit-input"
|
|
38
|
+
aria-label={label}
|
|
39
|
+
bind:value={draft}
|
|
40
|
+
{@attach autofocus({ select: true, delay: 0 })}
|
|
41
|
+
onkeydown={(event) => {
|
|
42
|
+
if (event.key === 'Enter') finish(true);
|
|
43
|
+
else if (event.key === 'Escape') {
|
|
44
|
+
event.stopPropagation();
|
|
45
|
+
finish(false);
|
|
46
|
+
}
|
|
47
|
+
}}
|
|
48
|
+
onblur={() => finish(true)}
|
|
49
|
+
/>
|
|
50
|
+
{:else}
|
|
51
|
+
<button
|
|
52
|
+
bind:this={button}
|
|
53
|
+
type="button"
|
|
54
|
+
class="ldt-data-table__edit"
|
|
55
|
+
aria-label={`${label}: ${value}`}
|
|
56
|
+
onclick={start}>{value}</button
|
|
57
|
+
>
|
|
58
|
+
{/if}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<script lang="ts" generics="T extends string">
|
|
2
|
+
import { Combobox as ComboboxPrimitive } from 'bits-ui';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
import type { Option } from '../types.js';
|
|
5
|
+
import { isOptionGroup, type OptionEntry } from './options.js';
|
|
6
|
+
|
|
7
|
+
/*
|
|
8
|
+
* The option rows shared by `Combobox` and `MultiSelect`. Rendered inside a Bits combobox
|
|
9
|
+
* Content, whose context the Item and Group parts pick up.
|
|
10
|
+
*/
|
|
11
|
+
interface Props {
|
|
12
|
+
entries: OptionEntry<T>[];
|
|
13
|
+
item?: Snippet<[Option<T>, { selected: boolean; highlighted: boolean }]>;
|
|
14
|
+
/** Extra reason to disable a row — `MultiSelect` uses it once `max` is reached. */
|
|
15
|
+
blocked?: (option: Option<T>) => boolean;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
let { entries, item, blocked }: Props = $props();
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
{#snippet row(option: Option<T>, groupDisabled: boolean)}
|
|
22
|
+
<ComboboxPrimitive.Item
|
|
23
|
+
class="ldt-listbox__item"
|
|
24
|
+
value={option.value}
|
|
25
|
+
label={option.label}
|
|
26
|
+
disabled={groupDisabled || option.disabled || blocked?.(option)}
|
|
27
|
+
>
|
|
28
|
+
{#snippet children({ selected, highlighted })}
|
|
29
|
+
{#if item}{@render item(option, { selected, highlighted })}{:else}<span>{option.label}</span
|
|
30
|
+
>{/if}<span class="ldt-listbox__check" aria-hidden="true"></span>
|
|
31
|
+
{/snippet}
|
|
32
|
+
</ComboboxPrimitive.Item>
|
|
33
|
+
{/snippet}
|
|
34
|
+
|
|
35
|
+
{#each entries as entry (isOptionGroup(entry) ? `group:${entry.label}` : entry.value)}
|
|
36
|
+
{#if isOptionGroup(entry)}
|
|
37
|
+
<ComboboxPrimitive.Group class="ldt-listbox__group">
|
|
38
|
+
<ComboboxPrimitive.GroupHeading class="ldt-listbox__heading"
|
|
39
|
+
>{entry.label}</ComboboxPrimitive.GroupHeading
|
|
40
|
+
>
|
|
41
|
+
{#each entry.options as option (option.value)}{@render row(
|
|
42
|
+
option,
|
|
43
|
+
Boolean(entry.disabled)
|
|
44
|
+
)}{/each}
|
|
45
|
+
</ComboboxPrimitive.Group>
|
|
46
|
+
{:else}
|
|
47
|
+
{@render row(entry, false)}
|
|
48
|
+
{/if}
|
|
49
|
+
{/each}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { Option } from '../types.js';
|
|
3
|
+
import { type OptionEntry } from './options.js';
|
|
4
|
+
declare function $$render<T extends string>(): {
|
|
5
|
+
props: {
|
|
6
|
+
entries: OptionEntry<T>[];
|
|
7
|
+
item?: Snippet<[Option<T>, {
|
|
8
|
+
selected: boolean;
|
|
9
|
+
highlighted: boolean;
|
|
10
|
+
}]>;
|
|
11
|
+
/** Extra reason to disable a row — `MultiSelect` uses it once `max` is reached. */
|
|
12
|
+
blocked?: (option: Option<T>) => boolean;
|
|
13
|
+
};
|
|
14
|
+
exports: {};
|
|
15
|
+
bindings: "";
|
|
16
|
+
slots: {};
|
|
17
|
+
events: {};
|
|
18
|
+
};
|
|
19
|
+
declare class __sveltets_Render<T extends string> {
|
|
20
|
+
props(): ReturnType<typeof $$render<T>>['props'];
|
|
21
|
+
events(): ReturnType<typeof $$render<T>>['events'];
|
|
22
|
+
slots(): ReturnType<typeof $$render<T>>['slots'];
|
|
23
|
+
bindings(): "";
|
|
24
|
+
exports(): {};
|
|
25
|
+
}
|
|
26
|
+
interface $$IsomorphicComponent {
|
|
27
|
+
new <T extends string>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T>['props']>, ReturnType<__sveltets_Render<T>['events']>, ReturnType<__sveltets_Render<T>['slots']>> & {
|
|
28
|
+
$$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
|
|
29
|
+
} & ReturnType<__sveltets_Render<T>['exports']>;
|
|
30
|
+
<T extends string>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
|
|
31
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
32
|
+
}
|
|
33
|
+
declare const ListboxEntries: $$IsomorphicComponent;
|
|
34
|
+
type ListboxEntries<T extends string> = InstanceType<typeof ListboxEntries<T>>;
|
|
35
|
+
export default ListboxEntries;
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { MediaPlayer } from '../../media-player.svelte.js';
|
|
3
|
+
import { formatDuration, formatDurationSpoken } from '../../media-utils.js';
|
|
4
|
+
import type { MediaPlayerLabels } from './labels.js';
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* The control bar shared by VideoPlayer and AudioPlayer. Every control is a native element —
|
|
8
|
+
* buttons, a range input, a select — so keyboard and screen-reader behaviour come from the
|
|
9
|
+
* platform rather than being re-implemented.
|
|
10
|
+
*/
|
|
11
|
+
interface Props {
|
|
12
|
+
player: MediaPlayer;
|
|
13
|
+
labels: MediaPlayerLabels;
|
|
14
|
+
video?: boolean;
|
|
15
|
+
/** What fullscreen should cover, so the controls come along. */
|
|
16
|
+
container?: HTMLElement | null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
let { player, labels, video = false, container = null }: Props = $props();
|
|
20
|
+
|
|
21
|
+
const rates = [0.5, 0.75, 1, 1.25, 1.5, 2];
|
|
22
|
+
const live = $derived(player.duration === Infinity);
|
|
23
|
+
const known = $derived(Number.isFinite(player.duration));
|
|
24
|
+
const bufferedEnd = $derived(
|
|
25
|
+
known && player.duration > 0
|
|
26
|
+
? Math.max(0, ...player.buffered.map(([, end]) => end)) / player.duration
|
|
27
|
+
: 0
|
|
28
|
+
);
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<div class="ldt-media-controls">
|
|
32
|
+
<button
|
|
33
|
+
type="button"
|
|
34
|
+
class="ldt-media-controls__button"
|
|
35
|
+
aria-label={player.playing ? labels.pause : labels.play}
|
|
36
|
+
onclick={() => player.toggle()}
|
|
37
|
+
>
|
|
38
|
+
<svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true" focusable="false">
|
|
39
|
+
{#if player.playing}<path d="M4 3h3v10H4zM9 3h3v10H9z" fill="currentColor" />{:else}<path
|
|
40
|
+
d="M4 2.5v11l9-5.5z"
|
|
41
|
+
fill="currentColor"
|
|
42
|
+
/>{/if}
|
|
43
|
+
</svg>
|
|
44
|
+
</button>
|
|
45
|
+
|
|
46
|
+
{#if !live}
|
|
47
|
+
<div class="ldt-media-controls__scrubber" style:--ldt-media-buffered={bufferedEnd}>
|
|
48
|
+
<input
|
|
49
|
+
type="range"
|
|
50
|
+
class="ldt-media-controls__range"
|
|
51
|
+
min="0"
|
|
52
|
+
max={known ? player.duration : 0}
|
|
53
|
+
step="0.1"
|
|
54
|
+
value={player.currentTime}
|
|
55
|
+
disabled={!known}
|
|
56
|
+
aria-label={labels.seek}
|
|
57
|
+
aria-valuetext={labels.position(
|
|
58
|
+
formatDurationSpoken(player.currentTime),
|
|
59
|
+
formatDurationSpoken(known ? player.duration : 0)
|
|
60
|
+
)}
|
|
61
|
+
oninput={(event) => player.seek(Number(event.currentTarget.value))}
|
|
62
|
+
/>
|
|
63
|
+
</div>
|
|
64
|
+
{/if}
|
|
65
|
+
<span class="ldt-media-controls__time" aria-hidden="true">
|
|
66
|
+
{formatDuration(player.currentTime)}{#if known} / {formatDuration(player.duration)}{/if}
|
|
67
|
+
</span>
|
|
68
|
+
|
|
69
|
+
<button
|
|
70
|
+
type="button"
|
|
71
|
+
class="ldt-media-controls__button"
|
|
72
|
+
aria-label={player.muted ? labels.unmute : labels.mute}
|
|
73
|
+
onclick={() => player.toggleMute()}
|
|
74
|
+
>
|
|
75
|
+
<svg
|
|
76
|
+
viewBox="0 0 16 16"
|
|
77
|
+
width="16"
|
|
78
|
+
height="16"
|
|
79
|
+
aria-hidden="true"
|
|
80
|
+
focusable="false"
|
|
81
|
+
fill="none"
|
|
82
|
+
stroke="currentColor"
|
|
83
|
+
stroke-width="1.4"
|
|
84
|
+
><path
|
|
85
|
+
d="M2 6h3l4-3v10L5 10H2z"
|
|
86
|
+
fill="currentColor"
|
|
87
|
+
stroke="none"
|
|
88
|
+
/>{#if player.muted || player.volume === 0}<path d="m11 6 4 4m0-4-4 4" />{:else}<path
|
|
89
|
+
d="M11 5.5a3.5 3.5 0 0 1 0 5M12.8 3.5a6 6 0 0 1 0 9"
|
|
90
|
+
/>{/if}</svg
|
|
91
|
+
>
|
|
92
|
+
</button>
|
|
93
|
+
<input
|
|
94
|
+
type="range"
|
|
95
|
+
class="ldt-media-controls__range ldt-media-controls__volume"
|
|
96
|
+
min="0"
|
|
97
|
+
max="1"
|
|
98
|
+
step="0.05"
|
|
99
|
+
value={player.muted ? 0 : player.volume}
|
|
100
|
+
aria-label={labels.volume}
|
|
101
|
+
aria-valuetext={`${Math.round((player.muted ? 0 : player.volume) * 100)}%`}
|
|
102
|
+
oninput={(event) => player.setVolume(Number(event.currentTarget.value))}
|
|
103
|
+
/>
|
|
104
|
+
|
|
105
|
+
<select
|
|
106
|
+
class="ldt-media-controls__speed"
|
|
107
|
+
aria-label={labels.speed}
|
|
108
|
+
value={String(player.rate)}
|
|
109
|
+
onchange={(event) => player.setRate(Number(event.currentTarget.value))}
|
|
110
|
+
>
|
|
111
|
+
{#each rates as rate (rate)}<option value={String(rate)}>{rate}×</option>{/each}
|
|
112
|
+
</select>
|
|
113
|
+
|
|
114
|
+
{#if player.tracks.length}
|
|
115
|
+
<button
|
|
116
|
+
type="button"
|
|
117
|
+
class="ldt-media-controls__button ldt-media-controls__text"
|
|
118
|
+
aria-label={labels.captions}
|
|
119
|
+
aria-pressed={player.activeTrack !== null}
|
|
120
|
+
onclick={() => player.selectTrack(player.activeTrack === null ? 0 : null)}>CC</button
|
|
121
|
+
>
|
|
122
|
+
{/if}
|
|
123
|
+
|
|
124
|
+
{#if video && player.canPictureInPicture}
|
|
125
|
+
<button
|
|
126
|
+
type="button"
|
|
127
|
+
class="ldt-media-controls__button"
|
|
128
|
+
aria-label={labels.pictureInPicture}
|
|
129
|
+
aria-pressed={player.pictureInPicture}
|
|
130
|
+
onclick={() => player.togglePictureInPicture()}
|
|
131
|
+
>
|
|
132
|
+
<svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true" focusable="false"
|
|
133
|
+
><path d="M1.5 3h13v10h-13z" fill="none" stroke="currentColor" stroke-width="1.3" /><path
|
|
134
|
+
d="M8 8h5v4H8z"
|
|
135
|
+
fill="currentColor"
|
|
136
|
+
/></svg
|
|
137
|
+
>
|
|
138
|
+
</button>
|
|
139
|
+
{/if}
|
|
140
|
+
|
|
141
|
+
{#if video}
|
|
142
|
+
<button
|
|
143
|
+
type="button"
|
|
144
|
+
class="ldt-media-controls__button"
|
|
145
|
+
aria-label={player.fullscreen ? labels.exitFullscreen : labels.fullscreen}
|
|
146
|
+
onclick={() => player.toggleFullscreen(container)}
|
|
147
|
+
>
|
|
148
|
+
<svg
|
|
149
|
+
viewBox="0 0 16 16"
|
|
150
|
+
width="16"
|
|
151
|
+
height="16"
|
|
152
|
+
aria-hidden="true"
|
|
153
|
+
focusable="false"
|
|
154
|
+
fill="none"
|
|
155
|
+
stroke="currentColor"
|
|
156
|
+
stroke-width="1.5"
|
|
157
|
+
>{#if player.fullscreen}<path d="M6 2v4H2M10 2v4h4M6 14v-4H2M10 14v-4h4" />{:else}<path
|
|
158
|
+
d="M2 6V2h4M14 6V2h-4M2 10v4h4M14 10v4h-4"
|
|
159
|
+
/>{/if}</svg
|
|
160
|
+
>
|
|
161
|
+
</button>
|
|
162
|
+
{/if}
|
|
163
|
+
</div>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { MediaPlayer } from '../../media-player.svelte.js';
|
|
2
|
+
import type { MediaPlayerLabels } from './labels.js';
|
|
3
|
+
interface Props {
|
|
4
|
+
player: MediaPlayer;
|
|
5
|
+
labels: MediaPlayerLabels;
|
|
6
|
+
video?: boolean;
|
|
7
|
+
/** What fullscreen should cover, so the controls come along. */
|
|
8
|
+
container?: HTMLElement | null;
|
|
9
|
+
}
|
|
10
|
+
declare const MediaControls: import("svelte").Component<Props, {}, "">;
|
|
11
|
+
type MediaControls = ReturnType<typeof MediaControls>;
|
|
12
|
+
export default MediaControls;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import AudioPlayer from '../../components/AudioPlayer.svelte';
|
|
3
|
+
import MediaEmbed from '../../components/MediaEmbed.svelte';
|
|
4
|
+
import VideoPlayer from '../../components/VideoPlayer.svelte';
|
|
5
|
+
import type { MediaZoom } from '../../media-zoom.svelte.js';
|
|
6
|
+
import type { MediaItem } from '../../media-utils.js';
|
|
7
|
+
|
|
8
|
+
/* One item shown at full size — the body of a Lightbox or a carousel slide. */
|
|
9
|
+
interface Props {
|
|
10
|
+
item: MediaItem;
|
|
11
|
+
zoom?: MediaZoom;
|
|
12
|
+
/** Images fill the frame (`cover`) in a carousel, and fit whole (`contain`) in a lightbox. */
|
|
13
|
+
fit?: 'contain' | 'cover';
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
let { item, zoom, fit = 'contain' }: Props = $props();
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
{#if item.kind === 'image'}
|
|
20
|
+
<div class="ldt-media-stage ldt-media-stage--image" {@attach zoom?.attach}>
|
|
21
|
+
<img
|
|
22
|
+
class="ldt-media-stage__image"
|
|
23
|
+
src={item.src}
|
|
24
|
+
srcset={item.srcset}
|
|
25
|
+
alt={item.alt}
|
|
26
|
+
style:object-fit={fit}
|
|
27
|
+
style:transform={zoom?.transform}
|
|
28
|
+
draggable="false"
|
|
29
|
+
/>
|
|
30
|
+
</div>
|
|
31
|
+
{:else if item.kind === 'video'}
|
|
32
|
+
<VideoPlayer
|
|
33
|
+
class="ldt-media-stage"
|
|
34
|
+
src={item.src}
|
|
35
|
+
label={item.title}
|
|
36
|
+
poster={item.poster}
|
|
37
|
+
tracks={item.tracks}
|
|
38
|
+
/>
|
|
39
|
+
{:else if item.kind === 'audio'}
|
|
40
|
+
<AudioPlayer
|
|
41
|
+
class="ldt-media-stage"
|
|
42
|
+
src={item.src}
|
|
43
|
+
title={item.title}
|
|
44
|
+
artist={item.artist}
|
|
45
|
+
artwork={item.artwork}
|
|
46
|
+
/>
|
|
47
|
+
{:else}
|
|
48
|
+
<MediaEmbed class="ldt-media-stage" url={item.url} title={item.title} poster={item.poster} />
|
|
49
|
+
{/if}
|