@openrails/contentkit-ui 0.0.0-placeholder → 0.68.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 +424 -1
- package/dist/appearance.d.ts +38 -0
- package/dist/appearance.js +15 -0
- package/dist/appearance.js.map +1 -0
- package/dist/assets/hash.worker-BYfo-7MQ.js.map +1 -0
- package/dist/client/aspect.d.ts +6 -0
- package/dist/client/aspect.js +17 -0
- package/dist/client/aspect.js.map +1 -0
- package/dist/client/client.d.ts +51 -0
- package/dist/client/client.js +35 -0
- package/dist/client/client.js.map +1 -0
- package/dist/client/codes.d.ts +12 -0
- package/dist/client/codes.js +19 -0
- package/dist/client/codes.js.map +1 -0
- package/dist/client/content/bans.d.ts +15 -0
- package/dist/client/content/bans.js +40 -0
- package/dist/client/content/bans.js.map +1 -0
- package/dist/client/content/comments.d.ts +36 -0
- package/dist/client/content/comments.js +93 -0
- package/dist/client/content/comments.js.map +1 -0
- package/dist/client/content/favorites.d.ts +14 -0
- package/dist/client/content/favorites.js +42 -0
- package/dist/client/content/favorites.js.map +1 -0
- package/dist/client/content/moderation.d.ts +18 -0
- package/dist/client/content/moderation.js +37 -0
- package/dist/client/content/moderation.js.map +1 -0
- package/dist/client/content/polls.d.ts +47 -0
- package/dist/client/content/polls.js +148 -0
- package/dist/client/content/polls.js.map +1 -0
- package/dist/client/content/posts.d.ts +44 -0
- package/dist/client/content/posts.js +91 -0
- package/dist/client/content/posts.js.map +1 -0
- package/dist/client/content/reactions.d.ts +12 -0
- package/dist/client/content/reactions.js +36 -0
- package/dist/client/content/reactions.js.map +1 -0
- package/dist/client/content/types.d.ts +91 -0
- package/dist/client/content/types.js +8 -0
- package/dist/client/content/types.js.map +1 -0
- package/dist/client/crop.d.ts +32 -0
- package/dist/client/crop.js +103 -0
- package/dist/client/crop.js.map +1 -0
- package/dist/client/errors.d.ts +54 -0
- package/dist/client/errors.js +80 -0
- package/dist/client/errors.js.map +1 -0
- package/dist/client/gallery.d.ts +43 -0
- package/dist/client/gallery.js +86 -0
- package/dist/client/gallery.js.map +1 -0
- package/dist/client/generated/error-codes.d.ts +5 -0
- package/dist/client/generated/error-codes.js +131 -0
- package/dist/client/generated/error-codes.js.map +1 -0
- package/dist/client/generated/routes.d.ts +1086 -0
- package/dist/client/generated/routes.js +1400 -0
- package/dist/client/generated/routes.js.map +1 -0
- package/dist/client/generated/wire.d.ts +630 -0
- package/dist/client/generated/wire.js +6 -0
- package/dist/client/generated/wire.js.map +1 -0
- package/dist/client/http.d.ts +79 -0
- package/dist/client/http.js +74 -0
- package/dist/client/http.js.map +1 -0
- package/dist/client/image.d.ts +24 -0
- package/dist/client/image.js +65 -0
- package/dist/client/image.js.map +1 -0
- package/dist/client/index.d.ts +33 -0
- package/dist/client/media/api.d.ts +36 -0
- package/dist/client/media/api.js +61 -0
- package/dist/client/media/api.js.map +1 -0
- package/dist/client/media/client.d.ts +247 -0
- package/dist/client/media/client.js +407 -0
- package/dist/client/media/client.js.map +1 -0
- package/dist/client/media/encode.d.ts +3 -0
- package/dist/client/media/encode.js +8 -0
- package/dist/client/media/encode.js.map +1 -0
- package/dist/client/media/hash-stream.d.ts +6 -0
- package/dist/client/media/hash-stream.js +16 -0
- package/dist/client/media/hash-stream.js.map +1 -0
- package/dist/client/media/hash.d.ts +12 -0
- package/dist/client/media/hash.js +48 -0
- package/dist/client/media/hash.js.map +1 -0
- package/dist/client/media/hash.worker-inline.js +18 -0
- package/dist/client/media/hash.worker-inline.js.map +1 -0
- package/dist/client/media/pacer.d.ts +21 -0
- package/dist/client/media/pacer.js +25 -0
- package/dist/client/media/pacer.js.map +1 -0
- package/dist/client/media/queue.d.ts +112 -0
- package/dist/client/media/queue.js +274 -0
- package/dist/client/media/queue.js.map +1 -0
- package/dist/client/media/ref.d.ts +6 -0
- package/dist/client/media/ref.js +10 -0
- package/dist/client/media/ref.js.map +1 -0
- package/dist/client/media/rules.d.ts +52 -0
- package/dist/client/media/rules.js +139 -0
- package/dist/client/media/rules.js.map +1 -0
- package/dist/client/media/transport.d.ts +13 -0
- package/dist/client/media/transport.js +33 -0
- package/dist/client/media/transport.js.map +1 -0
- package/dist/client/media/windows.d.ts +15 -0
- package/dist/client/media/windows.js +39 -0
- package/dist/client/media/windows.js.map +1 -0
- package/dist/client/playback.d.ts +200 -0
- package/dist/client/playback.js +142 -0
- package/dist/client/playback.js.map +1 -0
- package/dist/client/player.d.ts +102 -0
- package/dist/client/player.js +155 -0
- package/dist/client/player.js.map +1 -0
- package/dist/client/public.d.ts +25 -0
- package/dist/client/public.js +18 -0
- package/dist/client/public.js.map +1 -0
- package/dist/client/rendition.d.ts +19 -0
- package/dist/client/rendition.js +16 -0
- package/dist/client/rendition.js.map +1 -0
- package/dist/client/route.d.ts +39 -0
- package/dist/client/route.js +31 -0
- package/dist/client/route.js.map +1 -0
- package/dist/client/taxonomy.d.ts +30 -0
- package/dist/client/taxonomy.js +77 -0
- package/dist/client/taxonomy.js.map +1 -0
- package/dist/client.js +33 -0
- package/dist/components/encode-progress.d.ts +15 -0
- package/dist/components/encode-progress.js +49 -0
- package/dist/components/encode-progress.js.map +1 -0
- package/dist/components/hover-preview.d.ts +29 -0
- package/dist/components/hover-preview.js +49 -0
- package/dist/components/hover-preview.js.map +1 -0
- package/dist/components/image-crop-dialog.d.ts +48 -0
- package/dist/components/image-crop-dialog.js +359 -0
- package/dist/components/image-crop-dialog.js.map +1 -0
- package/dist/components/lazy-mount.d.ts +10 -0
- package/dist/components/lazy-mount.js +22 -0
- package/dist/components/lazy-mount.js.map +1 -0
- package/dist/components/media-folder-editor.d.ts +45 -0
- package/dist/components/media-folder-editor.js +564 -0
- package/dist/components/media-folder-editor.js.map +1 -0
- package/dist/components/media-gallery.d.ts +54 -0
- package/dist/components/media-gallery.js +597 -0
- package/dist/components/media-gallery.js.map +1 -0
- package/dist/components/media-readiness-notice.d.ts +24 -0
- package/dist/components/media-readiness-notice.js +61 -0
- package/dist/components/media-readiness-notice.js.map +1 -0
- package/dist/components/player-controls.d.ts +71 -0
- package/dist/components/player-controls.js +264 -0
- package/dist/components/player-controls.js.map +1 -0
- package/dist/components/progress.d.ts +5 -0
- package/dist/components/progress.js +14 -0
- package/dist/components/progress.js.map +1 -0
- package/dist/components/rendition-img.d.ts +34 -0
- package/dist/components/rendition-img.js +78 -0
- package/dist/components/rendition-img.js.map +1 -0
- package/dist/components/slot-editor.d.ts +95 -0
- package/dist/components/slot-editor.js +182 -0
- package/dist/components/slot-editor.js.map +1 -0
- package/dist/components/slot-image.d.ts +23 -0
- package/dist/components/slot-image.js +48 -0
- package/dist/components/slot-image.js.map +1 -0
- package/dist/components/slot-upload.d.ts +41 -0
- package/dist/components/slot-upload.js +213 -0
- package/dist/components/slot-upload.js.map +1 -0
- package/dist/components/social/bans.d.ts +42 -0
- package/dist/components/social/bans.js +300 -0
- package/dist/components/social/bans.js.map +1 -0
- package/dist/components/social/comments.d.ts +42 -0
- package/dist/components/social/comments.js +517 -0
- package/dist/components/social/comments.js.map +1 -0
- package/dist/components/social/engagement.d.ts +45 -0
- package/dist/components/social/engagement.js +129 -0
- package/dist/components/social/engagement.js.map +1 -0
- package/dist/components/social/index.d.ts +6 -0
- package/dist/components/social/moderation.d.ts +32 -0
- package/dist/components/social/moderation.js +383 -0
- package/dist/components/social/moderation.js.map +1 -0
- package/dist/components/social/parts.d.ts +50 -0
- package/dist/components/social/parts.js +106 -0
- package/dist/components/social/parts.js.map +1 -0
- package/dist/components/social/poll-editor.d.ts +34 -0
- package/dist/components/social/poll-editor.js +567 -0
- package/dist/components/social/poll-editor.js.map +1 -0
- package/dist/components/social/poll.d.ts +30 -0
- package/dist/components/social/poll.js +252 -0
- package/dist/components/social/poll.js.map +1 -0
- package/dist/components/sortable-list.d.ts +29 -0
- package/dist/components/sortable-list.js +121 -0
- package/dist/components/sortable-list.js.map +1 -0
- package/dist/components/video-mini-player.d.ts +35 -0
- package/dist/components/video-mini-player.js +236 -0
- package/dist/components/video-mini-player.js.map +1 -0
- package/dist/components/video-player.d.ts +146 -0
- package/dist/components/video-player.js +630 -0
- package/dist/components/video-player.js.map +1 -0
- package/dist/components/video-poster-picker.d.ts +59 -0
- package/dist/components/video-poster-picker.js +335 -0
- package/dist/components/video-poster-picker.js.map +1 -0
- package/dist/components/video-poster.d.ts +24 -0
- package/dist/components/video-poster.js +46 -0
- package/dist/components/video-poster.js.map +1 -0
- package/dist/i18n/context.d.ts +4 -0
- package/dist/i18n/context.js +11 -0
- package/dist/i18n/context.js.map +1 -0
- package/dist/i18n/messages.d.ts +40 -0
- package/dist/i18n/messages.js +94 -0
- package/dist/i18n/messages.js.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +41 -0
- package/dist/locales/de.d.ts +2 -0
- package/dist/locales/de.js +271 -0
- package/dist/locales/de.js.map +1 -0
- package/dist/locales/en.d.ts +457 -0
- package/dist/locales/en.js +271 -0
- package/dist/locales/en.js.map +1 -0
- package/dist/locales/es.d.ts +2 -0
- package/dist/locales/es.js +271 -0
- package/dist/locales/es.js.map +1 -0
- package/dist/locales/ja.d.ts +2 -0
- package/dist/locales/ja.js +271 -0
- package/dist/locales/ja.js.map +1 -0
- package/dist/locales/ko.d.ts +2 -0
- package/dist/locales/ko.js +271 -0
- package/dist/locales/ko.js.map +1 -0
- package/dist/locales/social/de.d.ts +2 -0
- package/dist/locales/social/de.js +198 -0
- package/dist/locales/social/de.js.map +1 -0
- package/dist/locales/social/en.d.ts +195 -0
- package/dist/locales/social/en.js +198 -0
- package/dist/locales/social/en.js.map +1 -0
- package/dist/locales/social/es.d.ts +2 -0
- package/dist/locales/social/es.js +198 -0
- package/dist/locales/social/es.js.map +1 -0
- package/dist/locales/social/ja.d.ts +2 -0
- package/dist/locales/social/ja.js +198 -0
- package/dist/locales/social/ja.js.map +1 -0
- package/dist/locales/social/ko.d.ts +2 -0
- package/dist/locales/social/ko.js +198 -0
- package/dist/locales/social/ko.js.map +1 -0
- package/dist/locales/social/zh.d.ts +2 -0
- package/dist/locales/social/zh.js +198 -0
- package/dist/locales/social/zh.js.map +1 -0
- package/dist/locales/zh.d.ts +2 -0
- package/dist/locales/zh.js +271 -0
- package/dist/locales/zh.js.map +1 -0
- package/dist/provider.d.ts +22 -0
- package/dist/provider.js +59 -0
- package/dist/provider.js.map +1 -0
- package/dist/react/canonical.d.ts +33 -0
- package/dist/react/canonical.js +88 -0
- package/dist/react/canonical.js.map +1 -0
- package/dist/react/comments.d.ts +82 -0
- package/dist/react/comments.js +147 -0
- package/dist/react/comments.js.map +1 -0
- package/dist/react/config.d.ts +13 -0
- package/dist/react/config.js +14 -0
- package/dist/react/config.js.map +1 -0
- package/dist/react/context.d.ts +48 -0
- package/dist/react/context.js +37 -0
- package/dist/react/context.js.map +1 -0
- package/dist/react/crop.d.ts +49 -0
- package/dist/react/crop.js +107 -0
- package/dist/react/crop.js.map +1 -0
- package/dist/react/engagement.d.ts +38 -0
- package/dist/react/engagement.js +88 -0
- package/dist/react/engagement.js.map +1 -0
- package/dist/react/folder.d.ts +83 -0
- package/dist/react/folder.js +183 -0
- package/dist/react/folder.js.map +1 -0
- package/dist/react/gallery.d.ts +140 -0
- package/dist/react/gallery.js +477 -0
- package/dist/react/gallery.js.map +1 -0
- package/dist/react/index.d.ts +21 -0
- package/dist/react/inline-preview.d.ts +24 -0
- package/dist/react/inline-preview.js +76 -0
- package/dist/react/inline-preview.js.map +1 -0
- package/dist/react/player.d.ts +70 -0
- package/dist/react/player.js +214 -0
- package/dist/react/player.js.map +1 -0
- package/dist/react/polls.d.ts +74 -0
- package/dist/react/polls.js +176 -0
- package/dist/react/polls.js.map +1 -0
- package/dist/react/posts.d.ts +59 -0
- package/dist/react/posts.js +149 -0
- package/dist/react/posts.js.map +1 -0
- package/dist/react/provider.d.ts +23 -0
- package/dist/react/provider.js +35 -0
- package/dist/react/provider.js.map +1 -0
- package/dist/react/public.d.ts +39 -0
- package/dist/react/public.js +70 -0
- package/dist/react/public.js.map +1 -0
- package/dist/react/read.d.ts +52 -0
- package/dist/react/read.js +143 -0
- package/dist/react/read.js.map +1 -0
- package/dist/react/resources.d.ts +70 -0
- package/dist/react/resources.js +247 -0
- package/dist/react/resources.js.map +1 -0
- package/dist/react/slot.d.ts +102 -0
- package/dist/react/slot.js +181 -0
- package/dist/react/slot.js.map +1 -0
- package/dist/react/store.d.ts +51 -0
- package/dist/react/store.js +164 -0
- package/dist/react/store.js.map +1 -0
- package/dist/react/upload.d.ts +85 -0
- package/dist/react/upload.js +150 -0
- package/dist/react/upload.js.map +1 -0
- package/dist/react/use-resource.d.ts +43 -0
- package/dist/react/use-resource.js +66 -0
- package/dist/react/use-resource.js.map +1 -0
- package/dist/react/video.d.ts +118 -0
- package/dist/react/video.js +184 -0
- package/dist/react/video.js.map +1 -0
- package/dist/react/viewport.d.ts +19 -0
- package/dist/react/viewport.js +30 -0
- package/dist/react/viewport.js.map +1 -0
- package/dist/react.js +21 -0
- package/dist/scope.d.ts +14 -0
- package/dist/scope.js +30 -0
- package/dist/scope.js.map +1 -0
- package/dist/styles.css +3 -0
- package/dist/ui/alert-dialog.d.ts +18 -0
- package/dist/ui/alert-dialog.js +86 -0
- package/dist/ui/alert-dialog.js.map +1 -0
- package/dist/ui/alert.d.ts +10 -0
- package/dist/ui/alert.js +38 -0
- package/dist/ui/alert.js.map +1 -0
- package/dist/ui/avatar.d.ts +11 -0
- package/dist/ui/avatar.js +31 -0
- package/dist/ui/avatar.js.map +1 -0
- package/dist/ui/badge.d.ts +7 -0
- package/dist/ui/badge.js +31 -0
- package/dist/ui/badge.js.map +1 -0
- package/dist/ui/button.d.ts +8 -0
- package/dist/ui/button.js +46 -0
- package/dist/ui/button.js.map +1 -0
- package/dist/ui/dialog.d.ts +17 -0
- package/dist/ui/dialog.js +91 -0
- package/dist/ui/dialog.js.map +1 -0
- package/dist/ui/dropdown-menu.d.ts +15 -0
- package/dist/ui/dropdown-menu.js +105 -0
- package/dist/ui/dropdown-menu.js.map +1 -0
- package/dist/ui/input.d.ts +3 -0
- package/dist/ui/input.js +17 -0
- package/dist/ui/input.js.map +1 -0
- package/dist/ui/label.d.ts +3 -0
- package/dist/ui/label.js +15 -0
- package/dist/ui/label.js.map +1 -0
- package/dist/ui/progress.d.ts +7 -0
- package/dist/ui/progress.js +31 -0
- package/dist/ui/progress.js.map +1 -0
- package/dist/ui/select.d.ts +15 -0
- package/dist/ui/select.js +98 -0
- package/dist/ui/select.js.map +1 -0
- package/dist/ui/skeleton.d.ts +2 -0
- package/dist/ui/skeleton.js +14 -0
- package/dist/ui/skeleton.js.map +1 -0
- package/dist/ui/slider.d.ts +3 -0
- package/dist/ui/slider.js +35 -0
- package/dist/ui/slider.js.map +1 -0
- package/dist/ui/switch.d.ts +5 -0
- package/dist/ui/switch.js +20 -0
- package/dist/ui/switch.js.map +1 -0
- package/dist/ui/tabs.d.ts +10 -0
- package/dist/ui/tabs.js +47 -0
- package/dist/ui/tabs.js.map +1 -0
- package/dist/ui/textarea.d.ts +3 -0
- package/dist/ui/textarea.js +15 -0
- package/dist/ui/textarea.js.map +1 -0
- package/dist/ui/toggle-group.d.ts +5 -0
- package/dist/ui/toggle-group.js +23 -0
- package/dist/ui/toggle-group.js.map +1 -0
- package/dist/urls/index.d.ts +100 -0
- package/dist/urls.js +118 -0
- package/dist/urls.js.map +1 -0
- package/package.json +113 -3
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ContentKitUiAppearance } from '../appearance.js';
|
|
3
|
+
import { GalleryItem } from '../client/gallery.js';
|
|
4
|
+
import { GalleryViewOptions, HlsPlayerOptions } from '../react/gallery.js';
|
|
5
|
+
import { PublicPreset } from '../client/public.js';
|
|
6
|
+
import { ContentKitClient } from '../client/client.js';
|
|
7
|
+
import { ReadResult, RefBody } from '../client/generated/wire.js';
|
|
8
|
+
export interface MediaGalleryProps extends GalleryViewOptions, Pick<HlsPlayerOptions, "xhrSetup" | "refresh" | "abr"> {
|
|
9
|
+
/**
|
|
10
|
+
* The item to show, read through the client: its read (refreshed before
|
|
11
|
+
* the URLs expire, after commits), HLS bases, playlist auth and grant
|
|
12
|
+
* refresh. Or pass `read` (and hlsBase, xhrSetup, refresh) yourself.
|
|
13
|
+
*/
|
|
14
|
+
item?: RefBody;
|
|
15
|
+
/** With item: only files under this path prefix. */
|
|
16
|
+
prefix?: string;
|
|
17
|
+
/** With item: each audio file's download name signed into its URL. */
|
|
18
|
+
download?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* The read API result: files in manifest order with this viewer's access
|
|
21
|
+
* (scope it with a prefix). A download read adds each audio file's download.
|
|
22
|
+
* With `refresh`, the gallery reads again shortly before `read.expires`.
|
|
23
|
+
*/
|
|
24
|
+
read?: ReadResult | null;
|
|
25
|
+
/** A ladder's HLS folder from the read's `hls` dir: client.media.hlsBase(ref, dir). */
|
|
26
|
+
hlsBase?: (dir: string) => string;
|
|
27
|
+
/** The item's poster (its public preset, or a URL), drawn on the first video. */
|
|
28
|
+
poster?: PublicPreset | string | null;
|
|
29
|
+
/** Where the first video's preview starts, seconds (e.g. the poster's frame); default 10% in. */
|
|
30
|
+
previewStart?: number;
|
|
31
|
+
/** Playable videos preview muted inline (hover, or in view on touch); default the provider's. */
|
|
32
|
+
inlinePreview?: boolean;
|
|
33
|
+
/** The host's unlock call to action, drawn over the locked item. */
|
|
34
|
+
renderLocked?: (locked: {
|
|
35
|
+
count: number;
|
|
36
|
+
videos: number;
|
|
37
|
+
}) => ReactNode;
|
|
38
|
+
/** Below the carousel, for its current item (e.g. downloads). */
|
|
39
|
+
renderDetails?: (item: GalleryItem) => ReactNode;
|
|
40
|
+
/** `sizes` for carousel images. Default "(min-width: 768px) 720px, 100vw". */
|
|
41
|
+
sizes?: string;
|
|
42
|
+
/** Tallest the carousel gets; taller media letterboxes. Default "80svh": every slide at its native aspect, full width, never taller than the screen; "none" lifts it. */
|
|
43
|
+
maxHeight?: string;
|
|
44
|
+
label?: string;
|
|
45
|
+
className?: string;
|
|
46
|
+
appearance?: ContentKitUiAppearance;
|
|
47
|
+
/** Overrides the provider's client (item). */
|
|
48
|
+
client?: ContentKitClient;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* A post's images and videos as a swipeable carousel or a tile grid that opens
|
|
52
|
+
* a lightbox, with a view toggle. One item renders alone.
|
|
53
|
+
*/
|
|
54
|
+
export declare function MediaGallery(given: MediaGalleryProps): import('react').JSX.Element | null;
|
|
@@ -0,0 +1,597 @@
|
|
|
1
|
+
import { useInlinePreview as e } from "../react/inline-preview.js";
|
|
2
|
+
import { RenditionImg as t } from "./rendition-img.js";
|
|
3
|
+
import { publicRenditions as n } from "../client/public.js";
|
|
4
|
+
import { useMessages as r } from "../i18n/context.js";
|
|
5
|
+
import { ContentKitUiRoot as i, useScopeProps as a } from "../scope.js";
|
|
6
|
+
import { useOptionalContentKitClient as o } from "../react/context.js";
|
|
7
|
+
import { useMediaRead as s } from "../react/read.js";
|
|
8
|
+
import { Button as c } from "../ui/button.js";
|
|
9
|
+
import { formatDuration as l, galleryItems as u, stageAspect as d } from "../client/gallery.js";
|
|
10
|
+
import { useCarousel as f, useGalleryView as p, useHlsPlayer as m, useRefreshBeforeExpiry as h } from "../react/gallery.js";
|
|
11
|
+
import { SpriteFrame as g, VideoPlayer as _, previewStartAt as v } from "./video-player.js";
|
|
12
|
+
import { ToggleGroup as y, ToggleGroupItem as b } from "../ui/toggle-group.js";
|
|
13
|
+
import { useCallback as x, useMemo as S, useState as C } from "react";
|
|
14
|
+
import { Fragment as w, jsx as T, jsxs as E } from "react/jsx-runtime";
|
|
15
|
+
import { cn as D } from "cn";
|
|
16
|
+
import { AlertCircleIcon as O, ArrowLeft01Icon as k, ArrowRight01Icon as A, Cancel01Icon as j, CarouselHorizontalIcon as M, Download01Icon as N, GridViewIcon as P, MusicNote01Icon as F, PlayIcon as I, SquareLock02Icon as L } from "@hugeicons/core-free-icons";
|
|
17
|
+
import { HugeiconsIcon as R } from "@hugeicons/react";
|
|
18
|
+
import { Dialog as z } from "@base-ui/react/dialog";
|
|
19
|
+
//#region src/components/media-gallery.tsx
|
|
20
|
+
function B(e, t) {
|
|
21
|
+
let n = e.items.find((e) => e.kind === "video") === t;
|
|
22
|
+
return {
|
|
23
|
+
poster: n ? e.poster ?? void 0 : void 0,
|
|
24
|
+
start: v(n ? e.previewStart : void 0, t.file.dur)
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
var V = (e, t) => t.dir && e.hlsBase ? e.hlsBase(t.dir) : null;
|
|
28
|
+
function H(e) {
|
|
29
|
+
let t = W(e), { read: n, label: a, className: o, appearance: s, view: c, defaultView: l, onViewChange: d, storageKey: f } = t, { t: m } = r(), g = S(() => u(n), [n]);
|
|
30
|
+
h(n?.expires, t.refresh);
|
|
31
|
+
let [_, v] = p({
|
|
32
|
+
view: c,
|
|
33
|
+
defaultView: l,
|
|
34
|
+
onViewChange: d,
|
|
35
|
+
storageKey: f
|
|
36
|
+
}), [x, O] = C(0), [k, A] = C(null);
|
|
37
|
+
if (g.length === 0) return null;
|
|
38
|
+
let j = {
|
|
39
|
+
...t,
|
|
40
|
+
items: g
|
|
41
|
+
}, N = g.length > 1, F = Math.min(x, g.length - 1), I = N ? _ : "carousel";
|
|
42
|
+
return /* @__PURE__ */ E(i, {
|
|
43
|
+
appearance: s,
|
|
44
|
+
className: D("@container grid gap-2", o),
|
|
45
|
+
"data-ckui": "media-gallery",
|
|
46
|
+
"data-view": I,
|
|
47
|
+
role: "region",
|
|
48
|
+
"aria-label": a ?? m("gallery.label"),
|
|
49
|
+
children: [
|
|
50
|
+
N && /* @__PURE__ */ E("div", {
|
|
51
|
+
className: "flex items-center justify-between gap-2",
|
|
52
|
+
"data-ckui": "gallery-header",
|
|
53
|
+
children: [/* @__PURE__ */ T("span", {
|
|
54
|
+
className: "text-sm text-muted-foreground tabular-nums",
|
|
55
|
+
"data-ckui": "gallery-count",
|
|
56
|
+
children: I === "carousel" ? m("gallery.counter", {
|
|
57
|
+
current: F + 1,
|
|
58
|
+
total: g.length
|
|
59
|
+
}) : null
|
|
60
|
+
}), /* @__PURE__ */ E(y, {
|
|
61
|
+
"aria-label": m("gallery.view"),
|
|
62
|
+
value: [I],
|
|
63
|
+
onValueChange: (e) => e[0] && v(e[0]),
|
|
64
|
+
children: [/* @__PURE__ */ T(b, {
|
|
65
|
+
value: "carousel",
|
|
66
|
+
"aria-label": m("gallery.carousel"),
|
|
67
|
+
title: m("gallery.carousel"),
|
|
68
|
+
children: /* @__PURE__ */ T(R, {
|
|
69
|
+
icon: M,
|
|
70
|
+
strokeWidth: 2
|
|
71
|
+
})
|
|
72
|
+
}), /* @__PURE__ */ T(b, {
|
|
73
|
+
value: "grid",
|
|
74
|
+
"aria-label": m("gallery.grid"),
|
|
75
|
+
title: m("gallery.grid"),
|
|
76
|
+
children: /* @__PURE__ */ T(R, {
|
|
77
|
+
icon: P,
|
|
78
|
+
strokeWidth: 2
|
|
79
|
+
})
|
|
80
|
+
})]
|
|
81
|
+
})]
|
|
82
|
+
}),
|
|
83
|
+
I === "carousel" ? /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T(G, {
|
|
84
|
+
ctx: j,
|
|
85
|
+
index: F,
|
|
86
|
+
onIndex: O
|
|
87
|
+
}), t.renderDetails?.(g[F])] }) : /* @__PURE__ */ T(ee, {
|
|
88
|
+
ctx: j,
|
|
89
|
+
onOpen: A
|
|
90
|
+
}),
|
|
91
|
+
/* @__PURE__ */ T(re, {
|
|
92
|
+
ctx: j,
|
|
93
|
+
index: k,
|
|
94
|
+
onIndex: A
|
|
95
|
+
})
|
|
96
|
+
]
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
var U = {
|
|
100
|
+
kind: "",
|
|
101
|
+
id: ""
|
|
102
|
+
};
|
|
103
|
+
function W(e) {
|
|
104
|
+
let t = o(e.client);
|
|
105
|
+
if (e.item && !t) throw Error("contentkit-ui: MediaGallery item needs `client` or a <ContentKitProvider>");
|
|
106
|
+
let n = s(e.item ?? U, {
|
|
107
|
+
prefix: e.prefix,
|
|
108
|
+
download: e.download,
|
|
109
|
+
read: e.item ? e.read : null,
|
|
110
|
+
refresh: !1,
|
|
111
|
+
client: t
|
|
112
|
+
}), r = e.item, i = x((e) => t.media.hlsBase(r, e), [t, r]);
|
|
113
|
+
return !r || !t ? e : {
|
|
114
|
+
...e,
|
|
115
|
+
read: n.read,
|
|
116
|
+
hlsBase: e.hlsBase ?? i,
|
|
117
|
+
xhrSetup: e.xhrSetup ?? t.media.xhrSetup,
|
|
118
|
+
refresh: e.refresh ?? n.refresh
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
function G({ ctx: e, index: t, onIndex: n, lightbox: i }) {
|
|
122
|
+
let { t: a } = r(), { items: o } = e, s = f({
|
|
123
|
+
count: o.length,
|
|
124
|
+
index: t,
|
|
125
|
+
onIndexChange: n
|
|
126
|
+
}), { index: c } = s, l = o.length > 1, u = i ? {} : {
|
|
127
|
+
aspectRatio: String(d(o, c)),
|
|
128
|
+
maxHeight: e.maxHeight ?? "80svh"
|
|
129
|
+
};
|
|
130
|
+
return /* @__PURE__ */ E("div", {
|
|
131
|
+
className: D("group/carousel relative outline-none", i ? "size-full" : "grid gap-2"),
|
|
132
|
+
role: l ? "group" : void 0,
|
|
133
|
+
"aria-roledescription": l ? "carousel" : void 0,
|
|
134
|
+
"aria-label": l ? e.label ?? a("gallery.label") : void 0,
|
|
135
|
+
tabIndex: l && !i ? 0 : void 0,
|
|
136
|
+
onKeyDown: l && !i ? s.onKeyDown : void 0,
|
|
137
|
+
"data-ckui": "carousel",
|
|
138
|
+
children: [/* @__PURE__ */ E("div", {
|
|
139
|
+
className: D("relative w-full touch-pan-y overflow-hidden select-none", i ? "h-full" : "rounded-lg bg-muted transition-[aspect-ratio] duration-300 ease-out motion-reduce:transition-none"),
|
|
140
|
+
style: u,
|
|
141
|
+
"data-ckui": "stage",
|
|
142
|
+
...l ? s.swipe : {},
|
|
143
|
+
children: [/* @__PURE__ */ T("div", {
|
|
144
|
+
className: D("flex h-full", s.dragging ? "transition-none" : "transition-transform duration-300 ease-out motion-reduce:transition-none"),
|
|
145
|
+
style: { transform: `translateX(calc(${-c * 100}% + ${s.offset}px))` },
|
|
146
|
+
children: o.map((t, n) => {
|
|
147
|
+
let r = Math.abs(n - c) <= 1;
|
|
148
|
+
return /* @__PURE__ */ T("div", {
|
|
149
|
+
className: "relative h-full w-full shrink-0 overflow-hidden",
|
|
150
|
+
role: l ? "group" : void 0,
|
|
151
|
+
"aria-roledescription": l ? "slide" : void 0,
|
|
152
|
+
"aria-label": l ? a("gallery.slide", {
|
|
153
|
+
current: n + 1,
|
|
154
|
+
total: o.length
|
|
155
|
+
}) : void 0,
|
|
156
|
+
"aria-hidden": n !== c || void 0,
|
|
157
|
+
inert: n !== c,
|
|
158
|
+
"data-ckui": "slide",
|
|
159
|
+
"data-current": n === c ? "" : void 0,
|
|
160
|
+
children: r && /* @__PURE__ */ T(q, {
|
|
161
|
+
ctx: e,
|
|
162
|
+
item: t,
|
|
163
|
+
position: n,
|
|
164
|
+
active: n === c,
|
|
165
|
+
lightbox: i
|
|
166
|
+
})
|
|
167
|
+
}, t.key);
|
|
168
|
+
})
|
|
169
|
+
}), l && /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T(K, {
|
|
170
|
+
side: "prev",
|
|
171
|
+
hidden: c === 0,
|
|
172
|
+
last: c === 1,
|
|
173
|
+
onClick: s.prev,
|
|
174
|
+
label: a("gallery.previous"),
|
|
175
|
+
lightbox: i
|
|
176
|
+
}), /* @__PURE__ */ T(K, {
|
|
177
|
+
side: "next",
|
|
178
|
+
hidden: c === o.length - 1,
|
|
179
|
+
last: c === o.length - 2,
|
|
180
|
+
onClick: s.next,
|
|
181
|
+
label: a("gallery.next"),
|
|
182
|
+
lightbox: i
|
|
183
|
+
})] })]
|
|
184
|
+
}), l && !i && o.length <= 12 && /* @__PURE__ */ T("div", {
|
|
185
|
+
className: "flex justify-center gap-0.5",
|
|
186
|
+
"data-ckui": "dots",
|
|
187
|
+
children: o.map((e, t) => /* @__PURE__ */ T("button", {
|
|
188
|
+
type: "button",
|
|
189
|
+
className: "group/dot flex size-4 items-center justify-center rounded-full outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
190
|
+
"aria-label": a("gallery.goTo", { index: t + 1 }),
|
|
191
|
+
"aria-current": t === c || void 0,
|
|
192
|
+
onClick: () => s.go(t),
|
|
193
|
+
children: /* @__PURE__ */ T("span", { className: D("size-1.5 rounded-full transition-colors", t === c ? "bg-foreground" : "bg-foreground/25 group-hover/dot:bg-foreground/50") })
|
|
194
|
+
}, e.key))
|
|
195
|
+
})]
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
function K({ side: e, hidden: t, last: n, onClick: r, label: i, lightbox: a }) {
|
|
199
|
+
return t ? null : /* @__PURE__ */ T("button", {
|
|
200
|
+
type: "button",
|
|
201
|
+
"aria-label": i,
|
|
202
|
+
"data-ckui": "gallery-nav",
|
|
203
|
+
"data-side": e,
|
|
204
|
+
onClick: (e) => {
|
|
205
|
+
let t = e.currentTarget.closest("[data-ckui=lightbox], [data-ckui=carousel][tabindex]");
|
|
206
|
+
r(), n && document.activeElement === e.currentTarget && t?.focus({ preventScroll: !0 });
|
|
207
|
+
},
|
|
208
|
+
className: D("group/nav absolute top-0 bottom-14 z-10 flex items-center outline-none", a ? "w-16 sm:w-20" : "w-12", e === "prev" ? a ? "left-0 justify-start pl-3 sm:pl-5" : "left-0 justify-start pl-2" : a ? "right-0 justify-end pr-3 sm:pr-5" : "right-0 justify-end pr-2"),
|
|
209
|
+
children: /* @__PURE__ */ T("span", {
|
|
210
|
+
className: D("flex items-center justify-center rounded-full backdrop-blur-sm transition-colors group-focus-visible/nav:ring-3 group-focus-visible/nav:ring-ring/60", a ? "size-10 bg-white/10 text-white group-hover/nav:bg-white/20" : "size-8 bg-white/85 text-zinc-900 shadow-md group-hover/nav:bg-white"),
|
|
211
|
+
children: /* @__PURE__ */ T(R, {
|
|
212
|
+
icon: e === "prev" ? k : A,
|
|
213
|
+
strokeWidth: 2,
|
|
214
|
+
className: "size-4"
|
|
215
|
+
})
|
|
216
|
+
})
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
function q({ ctx: e, item: t, position: n, active: i, lightbox: a }) {
|
|
220
|
+
let { t: o } = r();
|
|
221
|
+
if (t.kind === "locked") return /* @__PURE__ */ T(Q, {
|
|
222
|
+
ctx: e,
|
|
223
|
+
item: t
|
|
224
|
+
});
|
|
225
|
+
let s = t.file;
|
|
226
|
+
if (t.kind === "audio") return /* @__PURE__ */ T(J, {
|
|
227
|
+
item: t,
|
|
228
|
+
position: n
|
|
229
|
+
});
|
|
230
|
+
if (t.kind === "image") {
|
|
231
|
+
if (!s.url) return s.failed ? /* @__PURE__ */ T(Y, { file: s }) : /* @__PURE__ */ T(X, { children: o("gallery.processingImage") });
|
|
232
|
+
let r = t.key.startsWith("preview/") && !a ? e.items.find((e) => e.kind === "locked") : void 0;
|
|
233
|
+
return /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T("img", {
|
|
234
|
+
src: s.url,
|
|
235
|
+
alt: o("gallery.image", { index: n + 1 }),
|
|
236
|
+
width: s.w,
|
|
237
|
+
height: s.h,
|
|
238
|
+
sizes: a ? "100vw" : e.sizes ?? "(min-width: 768px) 720px, 100vw",
|
|
239
|
+
loading: i ? "eager" : "lazy",
|
|
240
|
+
decoding: "async",
|
|
241
|
+
draggable: !1,
|
|
242
|
+
className: "absolute inset-0 size-full object-contain"
|
|
243
|
+
}), r && /* @__PURE__ */ T($, {
|
|
244
|
+
ctx: e,
|
|
245
|
+
item: r
|
|
246
|
+
})] });
|
|
247
|
+
}
|
|
248
|
+
let { poster: c, start: l } = B(e, t);
|
|
249
|
+
return /* @__PURE__ */ T(_, {
|
|
250
|
+
inlinePreview: !a && e.inlinePreview,
|
|
251
|
+
previewStart: l,
|
|
252
|
+
layout: "fill",
|
|
253
|
+
base: V(e, t),
|
|
254
|
+
poster: c,
|
|
255
|
+
width: s.w,
|
|
256
|
+
height: s.h,
|
|
257
|
+
duration: s.dur,
|
|
258
|
+
active: i,
|
|
259
|
+
xhrSetup: e.xhrSetup,
|
|
260
|
+
refresh: e.refresh,
|
|
261
|
+
expires: e.read?.expires,
|
|
262
|
+
abr: e.abr,
|
|
263
|
+
label: o("gallery.video", { index: n + 1 }),
|
|
264
|
+
className: a ? "bg-transparent" : void 0
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
function J({ item: e, position: t }) {
|
|
268
|
+
let { t: n } = r(), i = e.file, a = (e.dir ?? i.path).replace(/\/$/, "").split("/").pop(), o = n("gallery.audio", { index: t + 1 });
|
|
269
|
+
return /* @__PURE__ */ E("div", {
|
|
270
|
+
className: "absolute inset-0 flex flex-col items-center justify-center gap-3 bg-muted p-4",
|
|
271
|
+
"data-ckui": "audio",
|
|
272
|
+
children: [
|
|
273
|
+
/* @__PURE__ */ E("div", {
|
|
274
|
+
className: "flex min-w-0 items-center gap-2 text-sm text-muted-foreground",
|
|
275
|
+
children: [
|
|
276
|
+
/* @__PURE__ */ T(R, {
|
|
277
|
+
icon: F,
|
|
278
|
+
className: "size-5 shrink-0",
|
|
279
|
+
strokeWidth: 1.75
|
|
280
|
+
}),
|
|
281
|
+
a && /* @__PURE__ */ T("span", {
|
|
282
|
+
className: "truncate",
|
|
283
|
+
children: a
|
|
284
|
+
}),
|
|
285
|
+
i.dur ? /* @__PURE__ */ T("span", {
|
|
286
|
+
className: "tabular-nums",
|
|
287
|
+
children: l(i.dur)
|
|
288
|
+
}) : null
|
|
289
|
+
]
|
|
290
|
+
}),
|
|
291
|
+
i.failed ? /* @__PURE__ */ T("p", {
|
|
292
|
+
className: "text-sm text-destructive",
|
|
293
|
+
role: "alert",
|
|
294
|
+
children: n("gallery.failedAudio")
|
|
295
|
+
}) : i.url ? /* @__PURE__ */ T("audio", {
|
|
296
|
+
src: i.url,
|
|
297
|
+
controls: !0,
|
|
298
|
+
preload: "metadata",
|
|
299
|
+
"aria-label": o,
|
|
300
|
+
className: "w-full max-w-md",
|
|
301
|
+
"data-ckui-noswipe": ""
|
|
302
|
+
}) : /* @__PURE__ */ T("p", {
|
|
303
|
+
className: "text-sm text-muted-foreground",
|
|
304
|
+
children: n("gallery.processingAudio")
|
|
305
|
+
}),
|
|
306
|
+
i.download && i.url && /* @__PURE__ */ E("a", {
|
|
307
|
+
href: i.url,
|
|
308
|
+
download: i.download,
|
|
309
|
+
className: "inline-flex items-center gap-1.5 text-sm underline-offset-4 hover:underline",
|
|
310
|
+
"data-ckui-noswipe": "",
|
|
311
|
+
children: [/* @__PURE__ */ T(R, {
|
|
312
|
+
icon: N,
|
|
313
|
+
className: "size-4",
|
|
314
|
+
strokeWidth: 2
|
|
315
|
+
}), n("gallery.download")]
|
|
316
|
+
})
|
|
317
|
+
]
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
function Y({ file: e }) {
|
|
321
|
+
let { t, error: n } = r(), i = e.failed, a = i?.code ? n({
|
|
322
|
+
code: i.code,
|
|
323
|
+
message: i.message,
|
|
324
|
+
details: i.details,
|
|
325
|
+
refusal: !0
|
|
326
|
+
}) : t("gallery.failedImage");
|
|
327
|
+
return /* @__PURE__ */ E("div", {
|
|
328
|
+
className: "absolute inset-0 flex flex-col items-center justify-center gap-2 bg-muted p-4 text-center text-sm text-destructive",
|
|
329
|
+
role: "alert",
|
|
330
|
+
"data-ckui": "image-failed",
|
|
331
|
+
children: [/* @__PURE__ */ T(R, {
|
|
332
|
+
icon: O,
|
|
333
|
+
className: "size-6"
|
|
334
|
+
}), /* @__PURE__ */ T("p", {
|
|
335
|
+
className: "max-w-sm text-balance",
|
|
336
|
+
children: a
|
|
337
|
+
})]
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
function X({ children: e }) {
|
|
341
|
+
return /* @__PURE__ */ E("div", {
|
|
342
|
+
className: "absolute inset-0 flex items-center justify-center gap-2 bg-muted text-sm text-muted-foreground",
|
|
343
|
+
children: [/* @__PURE__ */ T("span", {
|
|
344
|
+
"aria-hidden": !0,
|
|
345
|
+
className: "size-4 rounded-full border-2 border-current/30 border-t-current motion-safe:animate-spin"
|
|
346
|
+
}), e]
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
function Z(e, t) {
|
|
350
|
+
return t === 1 ? e("gallery.lockedOne") : e("gallery.lockedMany", { count: t });
|
|
351
|
+
}
|
|
352
|
+
function Q({ ctx: e, item: t, tile: n }) {
|
|
353
|
+
let { t: i } = r();
|
|
354
|
+
return /* @__PURE__ */ E("div", {
|
|
355
|
+
className: "absolute inset-0 overflow-hidden bg-muted",
|
|
356
|
+
"data-ckui": "locked",
|
|
357
|
+
children: [t.backdrop && /* @__PURE__ */ T("img", {
|
|
358
|
+
src: t.backdrop,
|
|
359
|
+
alt: "",
|
|
360
|
+
draggable: !1,
|
|
361
|
+
className: "absolute inset-0 size-full scale-110 object-cover blur-xl"
|
|
362
|
+
}), /* @__PURE__ */ E("div", {
|
|
363
|
+
className: D("absolute inset-0 flex flex-col items-center justify-center gap-3 p-4 text-center", t.backdrop ? "bg-black/45 text-white" : "text-foreground"),
|
|
364
|
+
children: [/* @__PURE__ */ T(R, {
|
|
365
|
+
icon: L,
|
|
366
|
+
className: n ? "size-6" : "size-8",
|
|
367
|
+
strokeWidth: 1.75
|
|
368
|
+
}), n ? /* @__PURE__ */ E("span", {
|
|
369
|
+
className: "text-lg font-semibold tabular-nums",
|
|
370
|
+
children: ["+", t.count]
|
|
371
|
+
}) : /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T("p", {
|
|
372
|
+
className: "text-sm font-medium text-balance",
|
|
373
|
+
children: Z(i, t.count)
|
|
374
|
+
}), e.renderLocked && /* @__PURE__ */ T("div", {
|
|
375
|
+
"data-ckui-noswipe": "",
|
|
376
|
+
children: e.renderLocked({
|
|
377
|
+
count: t.count,
|
|
378
|
+
videos: t.videos
|
|
379
|
+
})
|
|
380
|
+
})] })]
|
|
381
|
+
})]
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
function $({ ctx: e, item: t }) {
|
|
385
|
+
let { t: n } = r();
|
|
386
|
+
return /* @__PURE__ */ E("div", {
|
|
387
|
+
className: "absolute inset-x-0 bottom-0 flex flex-wrap items-center justify-between gap-x-3 gap-y-2 bg-linear-to-t from-black/75 via-black/45 to-transparent px-4 pt-10 pb-4 text-white",
|
|
388
|
+
"data-ckui": "locked-bar",
|
|
389
|
+
children: [/* @__PURE__ */ E("span", {
|
|
390
|
+
className: "flex items-center gap-2 text-sm font-medium",
|
|
391
|
+
children: [/* @__PURE__ */ T(R, {
|
|
392
|
+
icon: L,
|
|
393
|
+
className: "size-5 shrink-0",
|
|
394
|
+
strokeWidth: 1.75
|
|
395
|
+
}), Z(n, t.count)]
|
|
396
|
+
}), e.renderLocked && /* @__PURE__ */ T("div", {
|
|
397
|
+
"data-ckui-noswipe": "",
|
|
398
|
+
children: e.renderLocked({
|
|
399
|
+
count: t.count,
|
|
400
|
+
videos: t.videos
|
|
401
|
+
})
|
|
402
|
+
})]
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
function ee({ ctx: e, onOpen: t }) {
|
|
406
|
+
let { t: n } = r(), i = e.items.length;
|
|
407
|
+
return /* @__PURE__ */ T("ul", {
|
|
408
|
+
className: D("grid gap-1", i === 2 || i === 4 ? "grid-cols-2" : "grid-cols-2 @md:grid-cols-3"),
|
|
409
|
+
"data-ckui": "grid",
|
|
410
|
+
children: e.items.map((r, a) => /* @__PURE__ */ T("li", { children: /* @__PURE__ */ T(te, {
|
|
411
|
+
ctx: e,
|
|
412
|
+
item: r,
|
|
413
|
+
label: n("gallery.open", {
|
|
414
|
+
index: a + 1,
|
|
415
|
+
total: i
|
|
416
|
+
}),
|
|
417
|
+
onOpen: () => t(a)
|
|
418
|
+
}) }, r.key))
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
function te({ ctx: e, item: r, label: i, onOpen: a }) {
|
|
422
|
+
let [o, s] = C(null), c;
|
|
423
|
+
if (r.kind === "locked") c = /* @__PURE__ */ T(Q, {
|
|
424
|
+
ctx: e,
|
|
425
|
+
item: r,
|
|
426
|
+
tile: !0
|
|
427
|
+
});
|
|
428
|
+
else if (r.kind === "audio") c = /* @__PURE__ */ E("span", {
|
|
429
|
+
className: "absolute inset-0 flex flex-col items-center justify-center gap-1 bg-muted text-muted-foreground",
|
|
430
|
+
children: [/* @__PURE__ */ T(R, {
|
|
431
|
+
icon: r.file.failed ? O : F,
|
|
432
|
+
className: D("size-7", r.file.failed && "text-destructive"),
|
|
433
|
+
strokeWidth: 1.75
|
|
434
|
+
}), r.file.dur ? /* @__PURE__ */ T("span", {
|
|
435
|
+
className: "text-[11px] font-medium tabular-nums",
|
|
436
|
+
children: l(r.file.dur)
|
|
437
|
+
}) : null]
|
|
438
|
+
});
|
|
439
|
+
else if (r.kind === "image") c = r.file.url ? /* @__PURE__ */ T("img", {
|
|
440
|
+
src: r.file.url,
|
|
441
|
+
alt: "",
|
|
442
|
+
loading: "lazy",
|
|
443
|
+
decoding: "async",
|
|
444
|
+
draggable: !1,
|
|
445
|
+
className: "absolute inset-0 size-full object-cover transition-transform duration-300 motion-safe:group-hover:scale-[1.03]"
|
|
446
|
+
}) : r.file.failed ? /* @__PURE__ */ T("span", {
|
|
447
|
+
className: "absolute inset-0 flex items-center justify-center bg-muted text-destructive",
|
|
448
|
+
children: /* @__PURE__ */ T(R, {
|
|
449
|
+
icon: O,
|
|
450
|
+
className: "size-6"
|
|
451
|
+
})
|
|
452
|
+
}) : /* @__PURE__ */ T(X, { children: "" });
|
|
453
|
+
else {
|
|
454
|
+
let i = r.file, { poster: a, start: s } = B(e, r), u = typeof a == "string" ? [] : n(a), d = V(e, r);
|
|
455
|
+
c = /* @__PURE__ */ E(w, { children: [
|
|
456
|
+
typeof a == "string" ? /* @__PURE__ */ T("img", {
|
|
457
|
+
src: a,
|
|
458
|
+
alt: "",
|
|
459
|
+
loading: "lazy",
|
|
460
|
+
decoding: "async",
|
|
461
|
+
className: "absolute inset-0 size-full object-cover"
|
|
462
|
+
}) : u.length ? /* @__PURE__ */ T(t, {
|
|
463
|
+
outputs: u,
|
|
464
|
+
loading: "lazy",
|
|
465
|
+
className: "absolute inset-0 size-full object-cover"
|
|
466
|
+
}) : d ? /* @__PURE__ */ T(g, {
|
|
467
|
+
vtt: `${d}sprite.vtt`,
|
|
468
|
+
xhrSetup: e.xhrSetup,
|
|
469
|
+
fit: "cover"
|
|
470
|
+
}) : null,
|
|
471
|
+
d && /* @__PURE__ */ T(ne, {
|
|
472
|
+
ctx: e,
|
|
473
|
+
base: d,
|
|
474
|
+
start: s,
|
|
475
|
+
target: o
|
|
476
|
+
}),
|
|
477
|
+
i.failed ? /* @__PURE__ */ T("span", {
|
|
478
|
+
className: "absolute inset-0 flex items-center justify-center bg-muted text-destructive",
|
|
479
|
+
children: /* @__PURE__ */ T(R, {
|
|
480
|
+
icon: O,
|
|
481
|
+
className: "size-6"
|
|
482
|
+
})
|
|
483
|
+
}) : d ? /* @__PURE__ */ T("span", {
|
|
484
|
+
className: "pointer-events-none absolute top-1/2 left-1/2 flex size-10 -translate-1/2 items-center justify-center rounded-full bg-black/55 text-white backdrop-blur-sm transition-opacity group-hover:opacity-0",
|
|
485
|
+
children: /* @__PURE__ */ T(R, {
|
|
486
|
+
icon: I,
|
|
487
|
+
className: "ml-0.5 size-5 fill-current",
|
|
488
|
+
strokeWidth: 1.5
|
|
489
|
+
})
|
|
490
|
+
}) : /* @__PURE__ */ T(X, { children: "" }),
|
|
491
|
+
i.dur ? /* @__PURE__ */ T("span", {
|
|
492
|
+
className: "pointer-events-none absolute right-1.5 bottom-1.5 rounded bg-black/65 px-1.5 py-0.5 text-[11px] font-medium text-white tabular-nums",
|
|
493
|
+
children: l(i.dur)
|
|
494
|
+
}) : null
|
|
495
|
+
] });
|
|
496
|
+
}
|
|
497
|
+
return /* @__PURE__ */ T("button", {
|
|
498
|
+
type: "button",
|
|
499
|
+
"aria-label": i,
|
|
500
|
+
onClick: a,
|
|
501
|
+
ref: s,
|
|
502
|
+
className: "group relative block aspect-square w-full overflow-hidden rounded-md bg-muted outline-none focus-visible:ring-3 focus-visible:ring-ring/60",
|
|
503
|
+
"data-ckui": "tile",
|
|
504
|
+
"data-kind": r.kind,
|
|
505
|
+
children: c
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
function ne({ ctx: t, base: n, start: r, target: i }) {
|
|
509
|
+
let a = m({
|
|
510
|
+
src: `${n}master.m3u8`,
|
|
511
|
+
xhrSetup: t.xhrSetup,
|
|
512
|
+
refresh: t.refresh,
|
|
513
|
+
expires: t.read?.expires,
|
|
514
|
+
abr: t.abr,
|
|
515
|
+
qualityKey: null
|
|
516
|
+
});
|
|
517
|
+
return e({
|
|
518
|
+
setting: t.inlinePreview,
|
|
519
|
+
available: !0,
|
|
520
|
+
target: i,
|
|
521
|
+
start: () => a.preview(r),
|
|
522
|
+
stop: a.unload
|
|
523
|
+
}), /* @__PURE__ */ T("video", {
|
|
524
|
+
ref: a.ref,
|
|
525
|
+
muted: !0,
|
|
526
|
+
playsInline: !0,
|
|
527
|
+
preload: "none",
|
|
528
|
+
"aria-hidden": !0,
|
|
529
|
+
tabIndex: -1,
|
|
530
|
+
className: D("pointer-events-none absolute inset-0 size-full object-cover opacity-0 transition-opacity duration-300 motion-reduce:transition-none", a.previewing && a.status === "playing" && "opacity-100"),
|
|
531
|
+
"data-ckui": "tile-preview"
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
function re({ ctx: e, index: t, onIndex: n }) {
|
|
535
|
+
let { t: i } = r(), o = a(e.appearance), [s, l] = C(t ?? 0), [u, d] = C(t);
|
|
536
|
+
t !== u && (d(t), t !== null && l(t));
|
|
537
|
+
let p = t !== null, m = f({
|
|
538
|
+
count: e.items.length,
|
|
539
|
+
index: s,
|
|
540
|
+
onIndexChange: l
|
|
541
|
+
});
|
|
542
|
+
return /* @__PURE__ */ T(z.Root, {
|
|
543
|
+
open: p,
|
|
544
|
+
onOpenChange: (e) => !e && n(null),
|
|
545
|
+
children: /* @__PURE__ */ E(z.Portal, {
|
|
546
|
+
...o,
|
|
547
|
+
"data-ckui-theme": "dark",
|
|
548
|
+
children: [/* @__PURE__ */ T(z.Backdrop, { className: "fixed inset-0 z-50 bg-black duration-150 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0 motion-reduce:animate-none" }), /* @__PURE__ */ E(z.Popup, {
|
|
549
|
+
className: "fixed inset-0 z-50 flex flex-col bg-black text-white outline-none duration-150 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0 motion-reduce:animate-none",
|
|
550
|
+
"data-ckui": "lightbox",
|
|
551
|
+
onKeyDown: m.onKeyDown,
|
|
552
|
+
children: [
|
|
553
|
+
/* @__PURE__ */ T(z.Title, {
|
|
554
|
+
className: "sr-only",
|
|
555
|
+
children: e.label ?? i("gallery.lightbox")
|
|
556
|
+
}),
|
|
557
|
+
/* @__PURE__ */ E("div", {
|
|
558
|
+
className: "flex h-14 shrink-0 items-center justify-between px-4",
|
|
559
|
+
children: [/* @__PURE__ */ T("span", {
|
|
560
|
+
className: "text-sm text-white/80 tabular-nums",
|
|
561
|
+
children: e.items.length > 1 ? i("gallery.counter", {
|
|
562
|
+
current: s + 1,
|
|
563
|
+
total: e.items.length
|
|
564
|
+
}) : null
|
|
565
|
+
}), /* @__PURE__ */ E(z.Close, {
|
|
566
|
+
render: /* @__PURE__ */ T(c, {
|
|
567
|
+
variant: "ghost",
|
|
568
|
+
size: "icon",
|
|
569
|
+
className: "rounded-full text-white hover:bg-white/10 hover:text-white"
|
|
570
|
+
}),
|
|
571
|
+
children: [/* @__PURE__ */ T(R, {
|
|
572
|
+
icon: j,
|
|
573
|
+
strokeWidth: 2
|
|
574
|
+
}), /* @__PURE__ */ T("span", {
|
|
575
|
+
className: "sr-only",
|
|
576
|
+
children: i("common.close")
|
|
577
|
+
})]
|
|
578
|
+
})]
|
|
579
|
+
}),
|
|
580
|
+
/* @__PURE__ */ T("div", {
|
|
581
|
+
className: "min-h-0 flex-1 pb-4 sm:px-4 sm:pb-6",
|
|
582
|
+
children: p && /* @__PURE__ */ T(G, {
|
|
583
|
+
ctx: e,
|
|
584
|
+
index: s,
|
|
585
|
+
onIndex: l,
|
|
586
|
+
lightbox: !0
|
|
587
|
+
})
|
|
588
|
+
})
|
|
589
|
+
]
|
|
590
|
+
})]
|
|
591
|
+
})
|
|
592
|
+
});
|
|
593
|
+
}
|
|
594
|
+
//#endregion
|
|
595
|
+
export { H as MediaGallery };
|
|
596
|
+
|
|
597
|
+
//# sourceMappingURL=media-gallery.js.map
|