@openrails/contentkit-ui 0.0.0-stage → 0.68.1
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 +470 -2
- 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 +53 -0
- package/dist/client/client.js +36 -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 +95 -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 +151 -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 +92 -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 +83 -0
- package/dist/client/http.js +82 -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 +54 -0
- package/dist/client/media/rules.js +143 -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 +59 -0
- package/dist/components/media-folder-editor.js +611 -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 +215 -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 +78 -0
- package/dist/react/canonical.js.map +1 -0
- package/dist/react/comments.d.ts +82 -0
- package/dist/react/comments.js +155 -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 +55 -0
- package/dist/react/context.js +42 -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 +103 -0
- package/dist/react/folder.js +240 -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 +27 -0
- package/dist/react/provider.js +49 -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 +144 -0
- package/dist/react/read.js.map +1 -0
- package/dist/react/resources.d.ts +73 -0
- package/dist/react/resources.js +247 -0
- package/dist/react/resources.js.map +1 -0
- package/dist/react/slot.d.ts +104 -0
- package/dist/react/slot.js +185 -0
- package/dist/react/slot.js.map +1 -0
- package/dist/react/store.d.ts +51 -0
- package/dist/react/store.js +165 -0
- package/dist/react/store.js.map +1 -0
- package/dist/react/upload.d.ts +86 -0
- package/dist/react/upload.js +155 -0
- package/dist/react/upload.js.map +1 -0
- package/dist/react/use-resource.d.ts +44 -0
- package/dist/react/use-resource.js +74 -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 +120 -3
|
@@ -0,0 +1,611 @@
|
|
|
1
|
+
import { failureError as e } from "../client/errors.js";
|
|
2
|
+
import { stem as t } from "../client/media/client.js";
|
|
3
|
+
import { acceptOf as n, ratioLabel as r } from "../client/media/rules.js";
|
|
4
|
+
import { megabytes as i } from "../i18n/messages.js";
|
|
5
|
+
import { useMessages as a } from "../i18n/context.js";
|
|
6
|
+
import { ContentKitUiRoot as o } from "../scope.js";
|
|
7
|
+
import { Progress as s } from "../ui/progress.js";
|
|
8
|
+
import { EncodeProgress as c } from "./encode-progress.js";
|
|
9
|
+
import { isProcessing as l } from "../client/media/windows.js";
|
|
10
|
+
import { Alert as u, AlertDescription as d, AlertTitle as f } from "../ui/alert.js";
|
|
11
|
+
import { Button as p } from "../ui/button.js";
|
|
12
|
+
import { progressLabel as m, progressValue as h } from "./progress.js";
|
|
13
|
+
import { ImageCropDialog as ee } from "./image-crop-dialog.js";
|
|
14
|
+
import { isAudioType as g, isImageType as _, isSubtitleType as v, isVideoType as y } from "../client/gallery.js";
|
|
15
|
+
import { useEditorCrop as b } from "../react/crop.js";
|
|
16
|
+
import { nameIn as x, thumbnailOf as S, useMediaFolder as C } from "../react/folder.js";
|
|
17
|
+
import { SortableList as w } from "./sortable-list.js";
|
|
18
|
+
import { useEffect as T, useImperativeHandle as E, useMemo as D, useRef as te, useState as O } from "react";
|
|
19
|
+
import { Fragment as k, jsx as A, jsxs as j } from "react/jsx-runtime";
|
|
20
|
+
import { cn as M } from "cn";
|
|
21
|
+
import { Alert02Icon as N, CropIcon as P, Delete02Icon as F, Edit02Icon as I, File01Icon as L, Image01Icon as R, ImageAdd01Icon as ne, Loading03Icon as re, MusicNote01Icon as z, Refresh01Icon as B, RepeatIcon as V, Video01Icon as H } from "@hugeicons/core-free-icons";
|
|
22
|
+
import { HugeiconsIcon as U } from "@hugeicons/react";
|
|
23
|
+
//#region src/components/media-folder-editor.tsx
|
|
24
|
+
var ie = [
|
|
25
|
+
"",
|
|
26
|
+
"1:1",
|
|
27
|
+
"4:5",
|
|
28
|
+
"16:9"
|
|
29
|
+
];
|
|
30
|
+
function W(e) {
|
|
31
|
+
return _(e) ? "image" : y(e) ? "video" : g(e) ? "audio" : v(e) ? "subtitle" : "file";
|
|
32
|
+
}
|
|
33
|
+
var G = {
|
|
34
|
+
image: R,
|
|
35
|
+
video: H,
|
|
36
|
+
audio: z,
|
|
37
|
+
subtitle: L,
|
|
38
|
+
file: L
|
|
39
|
+
};
|
|
40
|
+
function K(e) {
|
|
41
|
+
let t = new Set((e?.types ?? []).map(W));
|
|
42
|
+
return t.size === 1 ? [...t][0] : "file";
|
|
43
|
+
}
|
|
44
|
+
function ae(e, t) {
|
|
45
|
+
let n = [];
|
|
46
|
+
for (let a of t) {
|
|
47
|
+
if (!a.types.length) continue;
|
|
48
|
+
let t = e(`folder.kinds.${K(a)}`), o = a.max_bytes > 0 ? e("folder.limitSize", {
|
|
49
|
+
what: t,
|
|
50
|
+
size: i(a.max_bytes)
|
|
51
|
+
}) : t;
|
|
52
|
+
n.push(a.max ? `${o}, ${e("folder.limitMax", { max: a.max })}` : o), a.min_aspect && a.max_aspect && n.push(e("folder.limitAspect", {
|
|
53
|
+
min: r(a.min_aspect),
|
|
54
|
+
max: r(a.max_aspect)
|
|
55
|
+
}));
|
|
56
|
+
}
|
|
57
|
+
return n.join(" · ");
|
|
58
|
+
}
|
|
59
|
+
function q(e) {
|
|
60
|
+
if (e.folder) {
|
|
61
|
+
let { folder: t, ...n } = e;
|
|
62
|
+
return /* @__PURE__ */ A(J, {
|
|
63
|
+
folder: t,
|
|
64
|
+
...n
|
|
65
|
+
}, t.ref ? `${t.ref.kind}/${t.ref.id}` : "");
|
|
66
|
+
}
|
|
67
|
+
return /* @__PURE__ */ A(oe, { ...e }, `${e.item.kind}/${e.item.id}`);
|
|
68
|
+
}
|
|
69
|
+
function oe(e) {
|
|
70
|
+
let { item: t, ref: n, label: r, toolbar: i, rowActions: a, footer: o, aspects: s, confirmRemove: c, disabled: l, className: u, appearance: d, ...f } = e, p = C(t, f);
|
|
71
|
+
return /* @__PURE__ */ A(J, {
|
|
72
|
+
folder: p,
|
|
73
|
+
ref: n,
|
|
74
|
+
label: r,
|
|
75
|
+
toolbar: i,
|
|
76
|
+
rowActions: a,
|
|
77
|
+
footer: o,
|
|
78
|
+
aspects: s,
|
|
79
|
+
confirmRemove: c,
|
|
80
|
+
disabled: l,
|
|
81
|
+
className: u,
|
|
82
|
+
appearance: d
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
var se = {
|
|
86
|
+
kind: "",
|
|
87
|
+
id: ""
|
|
88
|
+
};
|
|
89
|
+
function J(e) {
|
|
90
|
+
let { folder: t, ref: r, label: i, toolbar: s, rowActions: c, footer: l, aspects: m = ie, confirmRemove: h, disabled: g, className: _, appearance: v } = e, { t: y, error: x } = a(), { groups: S, queue: C, read: D, options: k } = t;
|
|
91
|
+
E(r, () => ({
|
|
92
|
+
discard: t.discard,
|
|
93
|
+
commit: t.commit,
|
|
94
|
+
folder: t
|
|
95
|
+
}), [t]);
|
|
96
|
+
let P = k.commit === "auto", I = S.flatMap((e) => e.rule ? [e.rule] : []), L = n(I), R = t.uploads.length + C.items.length + t.waiting.length === 0, z = !!g, [B, V] = O(/* @__PURE__ */ new Set());
|
|
97
|
+
T(() => {
|
|
98
|
+
let e = new Set(t.uploads.map((e) => e.path));
|
|
99
|
+
V((t) => [...t].every((t) => e.has(t)) ? t : new Set([...t].filter((t) => e.has(t))));
|
|
100
|
+
}, [t.uploads]);
|
|
101
|
+
let [H, G] = O(null), K = b(t.ref ?? se, H, {
|
|
102
|
+
client: k.client,
|
|
103
|
+
onError: k.onError,
|
|
104
|
+
onSaved: () => G(null)
|
|
105
|
+
}), q = H ? S.find((e) => e.files.some((e) => e.path === H))?.rule : void 0, [oe, J] = O(null), X = te(null), [Z, Q] = O(null), [ue, $] = O(!1), de = {
|
|
106
|
+
onDragOver: (e) => {
|
|
107
|
+
!z && e.dataTransfer.types.includes("Files") && (e.preventDefault(), $(!0));
|
|
108
|
+
},
|
|
109
|
+
onDragLeave: (e) => {
|
|
110
|
+
e.currentTarget.contains(e.relatedTarget) || $(!1);
|
|
111
|
+
},
|
|
112
|
+
onDrop: (e) => {
|
|
113
|
+
!z && e.dataTransfer.files.length && (e.preventDefault(), $(!1), t.add(e.dataTransfer.files));
|
|
114
|
+
}
|
|
115
|
+
}, fe = async () => {
|
|
116
|
+
let e = [...B];
|
|
117
|
+
(h === !1 || (h ? await h(e.length) : globalThis.confirm?.(y("folder.confirmRemove", { count: e.length })) ?? !0)) && await t.remove(e).then(() => V(/* @__PURE__ */ new Set()), () => {});
|
|
118
|
+
}, pe = C.items.filter((e) => e.status === "uploaded").length, me = (e) => /* @__PURE__ */ j("label", {
|
|
119
|
+
className: M(e ? "flex cursor-pointer flex-col items-center justify-center gap-2 rounded-lg border border-dashed border-border px-4 py-8 text-center text-sm text-muted-foreground transition-colors hover:border-primary hover:bg-primary/5" : "inline-flex h-8 cursor-pointer items-center gap-1.5 rounded-md border border-border bg-background px-2.5 text-sm font-medium transition-colors hover:bg-muted focus-within:ring-3 focus-within:ring-ring/50", e && ue && "border-primary bg-primary/5", z && "pointer-events-none opacity-50"),
|
|
120
|
+
"data-ckui": e ? "folder-drop" : "folder-add",
|
|
121
|
+
children: [
|
|
122
|
+
/* @__PURE__ */ A(U, {
|
|
123
|
+
icon: ne,
|
|
124
|
+
strokeWidth: 1.75,
|
|
125
|
+
className: e ? "size-7" : "size-4"
|
|
126
|
+
}),
|
|
127
|
+
e ? /* @__PURE__ */ A("strong", {
|
|
128
|
+
className: "font-medium text-foreground",
|
|
129
|
+
children: y("folder.drop")
|
|
130
|
+
}) : y("folder.add"),
|
|
131
|
+
e && I.length > 0 && /* @__PURE__ */ A("span", {
|
|
132
|
+
className: "text-xs",
|
|
133
|
+
children: ae(y, I)
|
|
134
|
+
}),
|
|
135
|
+
/* @__PURE__ */ A("input", {
|
|
136
|
+
type: "file",
|
|
137
|
+
multiple: !0,
|
|
138
|
+
accept: L,
|
|
139
|
+
className: "sr-only",
|
|
140
|
+
disabled: z,
|
|
141
|
+
"data-ckui": "file",
|
|
142
|
+
onChange: (e) => {
|
|
143
|
+
t.add([...e.target.files ?? []]), e.target.value = "";
|
|
144
|
+
}
|
|
145
|
+
})
|
|
146
|
+
]
|
|
147
|
+
});
|
|
148
|
+
return /* @__PURE__ */ j(o, {
|
|
149
|
+
appearance: v,
|
|
150
|
+
className: M("grid gap-3", _),
|
|
151
|
+
"data-ckui": "media-folder",
|
|
152
|
+
"data-over": ue ? "" : void 0,
|
|
153
|
+
...de,
|
|
154
|
+
children: [
|
|
155
|
+
/* @__PURE__ */ j("div", {
|
|
156
|
+
className: "flex flex-wrap items-center justify-between gap-2",
|
|
157
|
+
"data-ckui": "folder-header",
|
|
158
|
+
children: [/* @__PURE__ */ A("h3", {
|
|
159
|
+
className: "text-sm font-semibold",
|
|
160
|
+
children: i ?? y("folder.label")
|
|
161
|
+
}), /* @__PURE__ */ j("div", {
|
|
162
|
+
className: "flex flex-wrap items-center gap-2",
|
|
163
|
+
children: [s, !R && me(!1)]
|
|
164
|
+
})]
|
|
165
|
+
}),
|
|
166
|
+
R && (D.read || !t.ref) && me(!0),
|
|
167
|
+
R && !D.read && D.loading && /* @__PURE__ */ A("div", {
|
|
168
|
+
className: "flex justify-center py-6 text-muted-foreground",
|
|
169
|
+
"data-ckui": "folder-loading",
|
|
170
|
+
children: /* @__PURE__ */ A(U, {
|
|
171
|
+
icon: re,
|
|
172
|
+
strokeWidth: 2,
|
|
173
|
+
className: "size-5 motion-safe:animate-spin"
|
|
174
|
+
})
|
|
175
|
+
}),
|
|
176
|
+
t.refused.length > 0 && /* @__PURE__ */ j(u, {
|
|
177
|
+
variant: "destructive",
|
|
178
|
+
role: "alert",
|
|
179
|
+
"data-ckui": "folder-refused",
|
|
180
|
+
children: [/* @__PURE__ */ A(U, {
|
|
181
|
+
icon: N,
|
|
182
|
+
strokeWidth: 2
|
|
183
|
+
}), /* @__PURE__ */ j(d, { children: [/* @__PURE__ */ A("ul", {
|
|
184
|
+
className: "grid gap-0.5",
|
|
185
|
+
children: t.refused.map((e, t) => /* @__PURE__ */ j("li", { children: [
|
|
186
|
+
/* @__PURE__ */ A("span", {
|
|
187
|
+
className: "font-medium",
|
|
188
|
+
children: e.file.name
|
|
189
|
+
}),
|
|
190
|
+
": ",
|
|
191
|
+
x(e.error)
|
|
192
|
+
] }, t))
|
|
193
|
+
}), /* @__PURE__ */ A(p, {
|
|
194
|
+
variant: "outline",
|
|
195
|
+
size: "xs",
|
|
196
|
+
className: "mt-1 w-fit",
|
|
197
|
+
onClick: t.dismiss,
|
|
198
|
+
children: y("folder.dismiss")
|
|
199
|
+
})] })]
|
|
200
|
+
}),
|
|
201
|
+
C.blocked && /* @__PURE__ */ j(u, {
|
|
202
|
+
variant: "destructive",
|
|
203
|
+
role: "alert",
|
|
204
|
+
"data-ckui": "folder-paused",
|
|
205
|
+
children: [
|
|
206
|
+
/* @__PURE__ */ A(U, {
|
|
207
|
+
icon: N,
|
|
208
|
+
strokeWidth: 2
|
|
209
|
+
}),
|
|
210
|
+
/* @__PURE__ */ A(f, { children: y("folder.paused") }),
|
|
211
|
+
/* @__PURE__ */ j(d, { children: [x(C.blocked), /* @__PURE__ */ A(p, {
|
|
212
|
+
variant: "outline",
|
|
213
|
+
size: "xs",
|
|
214
|
+
className: "mt-1 w-fit",
|
|
215
|
+
onClick: () => C.start(),
|
|
216
|
+
children: y("folder.resume")
|
|
217
|
+
})] })
|
|
218
|
+
]
|
|
219
|
+
}),
|
|
220
|
+
t.error && /* @__PURE__ */ j(u, {
|
|
221
|
+
variant: "destructive",
|
|
222
|
+
role: "alert",
|
|
223
|
+
"data-ckui": "folder-error",
|
|
224
|
+
children: [/* @__PURE__ */ A(U, {
|
|
225
|
+
icon: N,
|
|
226
|
+
strokeWidth: 2
|
|
227
|
+
}), /* @__PURE__ */ A(d, { children: x(t.error) })]
|
|
228
|
+
}),
|
|
229
|
+
B.size > 0 && /* @__PURE__ */ j("div", {
|
|
230
|
+
className: "flex flex-wrap items-center gap-2 rounded-md bg-muted px-3 py-1.5 text-sm",
|
|
231
|
+
"data-ckui": "folder-selection",
|
|
232
|
+
children: [
|
|
233
|
+
/* @__PURE__ */ A("span", {
|
|
234
|
+
className: "tabular-nums",
|
|
235
|
+
children: y("folder.selected", { count: B.size })
|
|
236
|
+
}),
|
|
237
|
+
/* @__PURE__ */ j(p, {
|
|
238
|
+
variant: "destructive",
|
|
239
|
+
size: "xs",
|
|
240
|
+
disabled: z || t.updating,
|
|
241
|
+
onClick: () => void fe(),
|
|
242
|
+
children: [/* @__PURE__ */ A(U, {
|
|
243
|
+
icon: F,
|
|
244
|
+
strokeWidth: 2
|
|
245
|
+
}), y("folder.removeSelected")]
|
|
246
|
+
}),
|
|
247
|
+
/* @__PURE__ */ A(p, {
|
|
248
|
+
variant: "ghost",
|
|
249
|
+
size: "xs",
|
|
250
|
+
onClick: () => V(/* @__PURE__ */ new Set()),
|
|
251
|
+
children: y("folder.clearSelection")
|
|
252
|
+
})
|
|
253
|
+
]
|
|
254
|
+
}),
|
|
255
|
+
S.map((e) => e.files.length ? /* @__PURE__ */ A(ce, {
|
|
256
|
+
group: e,
|
|
257
|
+
titled: S.length > 1,
|
|
258
|
+
folder: t,
|
|
259
|
+
disabled: z,
|
|
260
|
+
selected: B,
|
|
261
|
+
onSelect: (e, t) => V((n) => t ? /* @__PURE__ */ new Set([...n, e]) : new Set([...n].filter((t) => t !== e))),
|
|
262
|
+
renaming: oe,
|
|
263
|
+
onRename: J,
|
|
264
|
+
onCrop: G,
|
|
265
|
+
onReplace: (e) => {
|
|
266
|
+
Q(e), X.current?.click();
|
|
267
|
+
},
|
|
268
|
+
rowActions: c
|
|
269
|
+
}, e.path) : null),
|
|
270
|
+
t.waiting.length > 0 && /* @__PURE__ */ A("ul", {
|
|
271
|
+
className: "grid",
|
|
272
|
+
"aria-label": y("folder.label"),
|
|
273
|
+
children: t.waiting.map((e, t) => /* @__PURE__ */ j("li", {
|
|
274
|
+
className: "flex min-h-11 items-center gap-2 px-1",
|
|
275
|
+
"data-ckui": "queue-row",
|
|
276
|
+
"data-status": "waiting",
|
|
277
|
+
children: [/* @__PURE__ */ A(Y, { kind: W(e.type) }), /* @__PURE__ */ j("div", {
|
|
278
|
+
className: "grid min-w-0 flex-1 gap-1",
|
|
279
|
+
children: [/* @__PURE__ */ A("span", {
|
|
280
|
+
className: "truncate text-sm",
|
|
281
|
+
children: e.name
|
|
282
|
+
}), /* @__PURE__ */ A("span", {
|
|
283
|
+
className: "text-xs text-muted-foreground",
|
|
284
|
+
"data-ckui": "queue-status",
|
|
285
|
+
children: y("folder.queued")
|
|
286
|
+
})]
|
|
287
|
+
})]
|
|
288
|
+
}, t))
|
|
289
|
+
}),
|
|
290
|
+
C.items.length > 0 && /* @__PURE__ */ A(w, {
|
|
291
|
+
items: C.items,
|
|
292
|
+
id: (e) => e.id,
|
|
293
|
+
name: (e) => e.file.name,
|
|
294
|
+
disabled: P || z,
|
|
295
|
+
label: y("folder.label"),
|
|
296
|
+
onMove: (e, t) => C.move(C.items[e].id, t),
|
|
297
|
+
row: (e) => ({
|
|
298
|
+
className: "flex min-h-11 items-center gap-2 px-1",
|
|
299
|
+
"data-ckui": "queue-row",
|
|
300
|
+
"data-status": e.status
|
|
301
|
+
}),
|
|
302
|
+
children: (e, n) => /* @__PURE__ */ A(le, {
|
|
303
|
+
item: e,
|
|
304
|
+
handle: P ? null : n,
|
|
305
|
+
auto: P,
|
|
306
|
+
folder: t
|
|
307
|
+
})
|
|
308
|
+
}),
|
|
309
|
+
(!P && pe > 0 || P && t.error && pe > 0) && /* @__PURE__ */ j(p, {
|
|
310
|
+
className: "w-fit",
|
|
311
|
+
disabled: z || !C.ready || t.committing,
|
|
312
|
+
onClick: () => void t.commit().catch(() => {}),
|
|
313
|
+
"data-ckui": "folder-commit",
|
|
314
|
+
children: [t.committing && /* @__PURE__ */ A(U, {
|
|
315
|
+
icon: re,
|
|
316
|
+
strokeWidth: 2,
|
|
317
|
+
className: "motion-safe:animate-spin"
|
|
318
|
+
}), P ? y("folder.commitAgain") : y("folder.commit", { count: C.items.filter((e) => e.status !== "committed").length })]
|
|
319
|
+
}),
|
|
320
|
+
l,
|
|
321
|
+
/* @__PURE__ */ A("input", {
|
|
322
|
+
ref: X,
|
|
323
|
+
type: "file",
|
|
324
|
+
accept: L,
|
|
325
|
+
className: "sr-only",
|
|
326
|
+
tabIndex: -1,
|
|
327
|
+
"aria-hidden": !0,
|
|
328
|
+
onChange: (e) => {
|
|
329
|
+
let n = e.target.files?.[0];
|
|
330
|
+
e.target.value = "", n && Z && t.replace(Z, n).catch(() => {}), Q(null);
|
|
331
|
+
}
|
|
332
|
+
}),
|
|
333
|
+
/* @__PURE__ */ A(ee, {
|
|
334
|
+
open: !!H,
|
|
335
|
+
onOpenChange: (e) => !e && K.status !== "saving" && G(null),
|
|
336
|
+
source: "source" in K ? K.source ?? null : null,
|
|
337
|
+
aspect: q?.aspect ?? "",
|
|
338
|
+
aspects: q?.aspect ? void 0 : m,
|
|
339
|
+
initialEdit: "edit" in K ? K.edit : null,
|
|
340
|
+
minWidth: q?.min_width,
|
|
341
|
+
title: y("folder.crop"),
|
|
342
|
+
busy: K.status === "saving",
|
|
343
|
+
error: K.status === "error" ? x(K.error) : void 0,
|
|
344
|
+
onConfirm: (e) => void K.save(e)
|
|
345
|
+
})
|
|
346
|
+
]
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
function ce({ group: e, titled: t, folder: n, disabled: r, selected: i, onSelect: o, renaming: s, onRename: c, onCrop: l, onReplace: u, rowActions: d }) {
|
|
350
|
+
let { t: f } = a(), p = f(`folder.kinds.${K(e.rule)}`), m = e.rule?.max;
|
|
351
|
+
return /* @__PURE__ */ j("section", {
|
|
352
|
+
className: "grid gap-1",
|
|
353
|
+
"data-ckui": "folder-group",
|
|
354
|
+
"data-path": e.path,
|
|
355
|
+
children: [t && /* @__PURE__ */ j("h4", {
|
|
356
|
+
className: "px-1 text-xs font-medium text-muted-foreground tabular-nums",
|
|
357
|
+
children: [
|
|
358
|
+
p,
|
|
359
|
+
" · ",
|
|
360
|
+
m ? `${e.files.length} / ${m}` : e.files.length
|
|
361
|
+
]
|
|
362
|
+
}), /* @__PURE__ */ A(w, {
|
|
363
|
+
items: e.files,
|
|
364
|
+
id: (e) => e.path,
|
|
365
|
+
name: (t) => x(e, t.path),
|
|
366
|
+
disabled: r || n.updating,
|
|
367
|
+
label: p,
|
|
368
|
+
onMove: (t, r) => void n.move(e.files[t].path, r).catch(() => {}),
|
|
369
|
+
row: (e) => ({
|
|
370
|
+
className: "flex min-h-12 items-center gap-2 px-1",
|
|
371
|
+
"data-ckui": "upload-row",
|
|
372
|
+
"data-path": e.path
|
|
373
|
+
}),
|
|
374
|
+
children: (t, a) => /* @__PURE__ */ A(X, {
|
|
375
|
+
file: t,
|
|
376
|
+
group: e,
|
|
377
|
+
handle: a,
|
|
378
|
+
folder: n,
|
|
379
|
+
disabled: r,
|
|
380
|
+
selected: i.has(t.path),
|
|
381
|
+
onSelect: (e) => o(t.path, e),
|
|
382
|
+
renaming: s === t.path,
|
|
383
|
+
onRename: c,
|
|
384
|
+
onCrop: l,
|
|
385
|
+
onReplace: u,
|
|
386
|
+
actions: d?.(t)
|
|
387
|
+
})
|
|
388
|
+
})]
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
function Y({ kind: e, url: t, busy: n }) {
|
|
392
|
+
return /* @__PURE__ */ j("span", {
|
|
393
|
+
className: "relative flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-md bg-muted text-muted-foreground",
|
|
394
|
+
"data-ckui": "thumb",
|
|
395
|
+
children: [t ? /* @__PURE__ */ A("img", {
|
|
396
|
+
src: t,
|
|
397
|
+
alt: "",
|
|
398
|
+
loading: "lazy",
|
|
399
|
+
decoding: "async",
|
|
400
|
+
className: "size-full object-cover"
|
|
401
|
+
}) : /* @__PURE__ */ A(U, {
|
|
402
|
+
icon: G[e],
|
|
403
|
+
strokeWidth: 1.75,
|
|
404
|
+
className: "size-4.5"
|
|
405
|
+
}), n && !t && /* @__PURE__ */ A("span", {
|
|
406
|
+
"aria-hidden": !0,
|
|
407
|
+
className: "absolute inset-1.5 rounded-full border-2 border-current/25 border-t-current motion-safe:animate-spin"
|
|
408
|
+
})]
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
function X({ file: n, group: r, handle: i, folder: o, disabled: s, selected: u, onSelect: d, renaming: f, onRename: m, onCrop: h, onReplace: ee, actions: g }) {
|
|
412
|
+
let { t: _, error: v } = a(), y = W(n.type), b = x(r, n.path), C = l(n), w = D(() => S(o.read.read, n), [o.read.read, n]), T = s || o.updating, E = n.failed ? v(e(n.failed)) : void 0;
|
|
413
|
+
return /* @__PURE__ */ j(k, { children: [
|
|
414
|
+
i,
|
|
415
|
+
/* @__PURE__ */ A("input", {
|
|
416
|
+
type: "checkbox",
|
|
417
|
+
className: "size-4 shrink-0 accent-primary",
|
|
418
|
+
checked: u,
|
|
419
|
+
disabled: s,
|
|
420
|
+
"aria-label": _("folder.select", { name: b }),
|
|
421
|
+
onChange: (e) => d(e.target.checked)
|
|
422
|
+
}),
|
|
423
|
+
/* @__PURE__ */ A(Y, {
|
|
424
|
+
kind: y,
|
|
425
|
+
url: w?.url,
|
|
426
|
+
busy: C
|
|
427
|
+
}),
|
|
428
|
+
/* @__PURE__ */ j("div", {
|
|
429
|
+
className: "grid min-w-0 flex-1 gap-1",
|
|
430
|
+
children: [
|
|
431
|
+
/* @__PURE__ */ j("div", {
|
|
432
|
+
className: "flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5",
|
|
433
|
+
children: [
|
|
434
|
+
f ? /* @__PURE__ */ A(Z, {
|
|
435
|
+
name: t(b),
|
|
436
|
+
label: _("folder.renameLabel", { name: b }),
|
|
437
|
+
onDone: (e) => e === null ? m(null) : o.rename(n.path, e).then(() => m(null))
|
|
438
|
+
}) : /* @__PURE__ */ A("span", {
|
|
439
|
+
className: "max-w-full truncate text-sm",
|
|
440
|
+
title: n.path,
|
|
441
|
+
"data-ckui": "upload-name",
|
|
442
|
+
children: b
|
|
443
|
+
}),
|
|
444
|
+
n.edit && /* @__PURE__ */ A("span", {
|
|
445
|
+
className: "shrink-0 rounded-sm border border-border px-1.5 text-[11px] text-muted-foreground",
|
|
446
|
+
"data-ckui": "edited",
|
|
447
|
+
children: _("folder.edited")
|
|
448
|
+
}),
|
|
449
|
+
E && /* @__PURE__ */ A("span", {
|
|
450
|
+
className: "shrink-0 rounded-sm bg-destructive/10 px-1.5 text-[11px] font-medium text-destructive",
|
|
451
|
+
title: E,
|
|
452
|
+
"data-ckui": "failed",
|
|
453
|
+
children: _(y === "video" ? "folder.failedVideo" : "folder.failed")
|
|
454
|
+
})
|
|
455
|
+
]
|
|
456
|
+
}),
|
|
457
|
+
E && /* @__PURE__ */ A("p", {
|
|
458
|
+
className: "text-xs text-destructive",
|
|
459
|
+
children: E
|
|
460
|
+
}),
|
|
461
|
+
C && y === "video" && /* @__PURE__ */ A(c, {
|
|
462
|
+
progress: n.progress,
|
|
463
|
+
className: "max-w-sm text-xs"
|
|
464
|
+
}),
|
|
465
|
+
C && y !== "video" && /* @__PURE__ */ A("span", {
|
|
466
|
+
className: "text-xs text-muted-foreground",
|
|
467
|
+
children: _("folder.processing")
|
|
468
|
+
})
|
|
469
|
+
]
|
|
470
|
+
}),
|
|
471
|
+
/* @__PURE__ */ j("span", {
|
|
472
|
+
className: "flex shrink-0 items-center gap-0.5",
|
|
473
|
+
"data-ckui": "upload-actions",
|
|
474
|
+
children: [
|
|
475
|
+
g,
|
|
476
|
+
y === "image" && /* @__PURE__ */ A(p, {
|
|
477
|
+
variant: "ghost",
|
|
478
|
+
size: "icon-sm",
|
|
479
|
+
"aria-label": _("folder.crop"),
|
|
480
|
+
title: _("folder.crop"),
|
|
481
|
+
disabled: T || !!n.staged || !n.size,
|
|
482
|
+
onClick: () => h(n.path),
|
|
483
|
+
children: /* @__PURE__ */ A(U, {
|
|
484
|
+
icon: P,
|
|
485
|
+
strokeWidth: 2
|
|
486
|
+
})
|
|
487
|
+
}),
|
|
488
|
+
!r.rule?.named && /* @__PURE__ */ A(p, {
|
|
489
|
+
variant: "ghost",
|
|
490
|
+
size: "icon-sm",
|
|
491
|
+
"aria-label": _("common.rename"),
|
|
492
|
+
title: _("common.rename"),
|
|
493
|
+
disabled: T,
|
|
494
|
+
onClick: () => m(n.path),
|
|
495
|
+
children: /* @__PURE__ */ A(U, {
|
|
496
|
+
icon: I,
|
|
497
|
+
strokeWidth: 2
|
|
498
|
+
})
|
|
499
|
+
}),
|
|
500
|
+
/* @__PURE__ */ A(p, {
|
|
501
|
+
variant: "ghost",
|
|
502
|
+
size: "icon-sm",
|
|
503
|
+
"aria-label": _("common.replace"),
|
|
504
|
+
title: _("common.replace"),
|
|
505
|
+
disabled: T,
|
|
506
|
+
onClick: () => ee(n.path),
|
|
507
|
+
children: /* @__PURE__ */ A(U, {
|
|
508
|
+
icon: V,
|
|
509
|
+
strokeWidth: 2
|
|
510
|
+
})
|
|
511
|
+
}),
|
|
512
|
+
/* @__PURE__ */ A(p, {
|
|
513
|
+
variant: "ghost",
|
|
514
|
+
size: "icon-sm",
|
|
515
|
+
"aria-label": _("common.remove"),
|
|
516
|
+
title: _("common.remove"),
|
|
517
|
+
disabled: T,
|
|
518
|
+
onClick: () => void o.remove([n.path]).catch(() => {}),
|
|
519
|
+
children: /* @__PURE__ */ A(U, {
|
|
520
|
+
icon: F,
|
|
521
|
+
strokeWidth: 2
|
|
522
|
+
})
|
|
523
|
+
})
|
|
524
|
+
]
|
|
525
|
+
})
|
|
526
|
+
] });
|
|
527
|
+
}
|
|
528
|
+
function Z({ name: e, label: t, onDone: n }) {
|
|
529
|
+
let [r, i] = O(e), a = te(!1), o = (t) => {
|
|
530
|
+
a.current || (a.current = !0, Promise.resolve(n(t && t.trim() && t.trim() !== e ? t.trim() : null)).catch(() => a.current = !1));
|
|
531
|
+
};
|
|
532
|
+
return /* @__PURE__ */ A("input", {
|
|
533
|
+
autoFocus: !0,
|
|
534
|
+
"aria-label": t,
|
|
535
|
+
value: r,
|
|
536
|
+
className: "h-7 min-w-0 flex-1 rounded-md border border-input bg-background px-2 text-sm outline-none focus-visible:ring-3 focus-visible:ring-ring/50",
|
|
537
|
+
onChange: (e) => i(e.target.value),
|
|
538
|
+
onKeyDown: (e) => {
|
|
539
|
+
e.key === "Enter" ? (e.preventDefault(), o(r)) : e.key === "Escape" && (e.preventDefault(), o(null));
|
|
540
|
+
},
|
|
541
|
+
onBlur: () => o(r),
|
|
542
|
+
"data-ckui": "rename"
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
function Q(t, n, r, i) {
|
|
546
|
+
if (r.status === "failed") return n(r.error);
|
|
547
|
+
if (r.status === "uploading") return m(t, r.progress);
|
|
548
|
+
if (r.status === "uploaded") {
|
|
549
|
+
let a = r.processing;
|
|
550
|
+
return a?.failed ? n(e(a.failed)) : r.unattached && !r.processed ? a?.progress && a.progress.phase !== "queued" ? t("folder.processingPercent", { percent: Math.round(a.progress.percent) }) : t("folder.processing") : t(i ? "folder.adding" : "folder.uploaded");
|
|
551
|
+
}
|
|
552
|
+
return r.status === "committed" ? t("folder.adding") : t("folder.queued");
|
|
553
|
+
}
|
|
554
|
+
function le({ item: e, handle: t, auto: n, folder: r }) {
|
|
555
|
+
let { t: i, error: o } = a(), { queue: c } = r, l = W(e.file.type), u = Q(i, o, e, n), d = e.status === "uploading" ? h(e.progress) : e.unattached && !e.processed && e.processing?.progress ? e.processing.progress.percent : null;
|
|
556
|
+
return /* @__PURE__ */ j(k, { children: [
|
|
557
|
+
t,
|
|
558
|
+
/* @__PURE__ */ A(Y, {
|
|
559
|
+
kind: l,
|
|
560
|
+
busy: e.status === "uploading" || !!e.unattached && !e.processed
|
|
561
|
+
}),
|
|
562
|
+
/* @__PURE__ */ j("div", {
|
|
563
|
+
className: "grid min-w-0 flex-1 gap-1",
|
|
564
|
+
children: [
|
|
565
|
+
/* @__PURE__ */ A("span", {
|
|
566
|
+
className: "truncate text-sm",
|
|
567
|
+
title: e.path,
|
|
568
|
+
children: e.file.name
|
|
569
|
+
}),
|
|
570
|
+
d !== null && /* @__PURE__ */ A(s, {
|
|
571
|
+
value: d,
|
|
572
|
+
"aria-label": u,
|
|
573
|
+
className: "max-w-sm"
|
|
574
|
+
}),
|
|
575
|
+
/* @__PURE__ */ A("span", {
|
|
576
|
+
className: M("text-xs", e.status === "failed" ? "text-destructive" : "text-muted-foreground"),
|
|
577
|
+
"data-ckui": "queue-status",
|
|
578
|
+
children: u
|
|
579
|
+
})
|
|
580
|
+
]
|
|
581
|
+
}),
|
|
582
|
+
/* @__PURE__ */ j("span", {
|
|
583
|
+
className: "flex shrink-0 items-center gap-0.5",
|
|
584
|
+
children: [e.status === "failed" && /* @__PURE__ */ A(p, {
|
|
585
|
+
variant: "ghost",
|
|
586
|
+
size: "icon-sm",
|
|
587
|
+
"aria-label": i("common.retry"),
|
|
588
|
+
title: i("common.retry"),
|
|
589
|
+
onClick: () => c.retry(e.id),
|
|
590
|
+
children: /* @__PURE__ */ A(U, {
|
|
591
|
+
icon: B,
|
|
592
|
+
strokeWidth: 2
|
|
593
|
+
})
|
|
594
|
+
}), /* @__PURE__ */ A(p, {
|
|
595
|
+
variant: "ghost",
|
|
596
|
+
size: "icon-sm",
|
|
597
|
+
"aria-label": i("common.remove"),
|
|
598
|
+
title: i("common.remove"),
|
|
599
|
+
onClick: () => c.remove(e.id),
|
|
600
|
+
children: /* @__PURE__ */ A(U, {
|
|
601
|
+
icon: F,
|
|
602
|
+
strokeWidth: 2
|
|
603
|
+
})
|
|
604
|
+
})]
|
|
605
|
+
})
|
|
606
|
+
] });
|
|
607
|
+
}
|
|
608
|
+
//#endregion
|
|
609
|
+
export { q as MediaFolderEditor, ae as describeRules };
|
|
610
|
+
|
|
611
|
+
//# sourceMappingURL=media-folder-editor.js.map
|