nuxt-media-library 0.0.44

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.
Files changed (164) hide show
  1. package/README.md +243 -0
  2. package/dist/module.d.mts +31 -0
  3. package/dist/module.d.ts +31 -0
  4. package/dist/module.json +9 -0
  5. package/dist/module.mjs +118 -0
  6. package/dist/runtime/components/MLAssetManager/AssetActivity.d.vue.ts +6 -0
  7. package/dist/runtime/components/MLAssetManager/AssetActivity.vue +13 -0
  8. package/dist/runtime/components/MLAssetManager/AssetActivity.vue.d.ts +6 -0
  9. package/dist/runtime/components/MLAssetManager/AssetCard.d.vue.ts +14 -0
  10. package/dist/runtime/components/MLAssetManager/AssetCard.vue +100 -0
  11. package/dist/runtime/components/MLAssetManager/AssetCard.vue.d.ts +14 -0
  12. package/dist/runtime/components/MLAssetManager/AssetDetail.d.vue.ts +14 -0
  13. package/dist/runtime/components/MLAssetManager/AssetDetail.vue +156 -0
  14. package/dist/runtime/components/MLAssetManager/AssetDetail.vue.d.ts +14 -0
  15. package/dist/runtime/components/MLAssetManager/AssetList.d.vue.ts +15 -0
  16. package/dist/runtime/components/MLAssetManager/AssetList.vue +41 -0
  17. package/dist/runtime/components/MLAssetManager/AssetList.vue.d.ts +15 -0
  18. package/dist/runtime/components/MLAssetManager/AssetOverview.d.vue.ts +8 -0
  19. package/dist/runtime/components/MLAssetManager/AssetOverview.vue +321 -0
  20. package/dist/runtime/components/MLAssetManager/AssetOverview.vue.d.ts +8 -0
  21. package/dist/runtime/components/MLAssetManager/AssetPreview.d.vue.ts +10 -0
  22. package/dist/runtime/components/MLAssetManager/AssetPreview.vue +18 -0
  23. package/dist/runtime/components/MLAssetManager/AssetPreview.vue.d.ts +10 -0
  24. package/dist/runtime/components/MLAssetManager/AssetPreviewAudio.d.vue.ts +9 -0
  25. package/dist/runtime/components/MLAssetManager/AssetPreviewAudio.vue +21 -0
  26. package/dist/runtime/components/MLAssetManager/AssetPreviewAudio.vue.d.ts +9 -0
  27. package/dist/runtime/components/MLAssetManager/AssetPreviewDocument.d.vue.ts +9 -0
  28. package/dist/runtime/components/MLAssetManager/AssetPreviewDocument.vue +39 -0
  29. package/dist/runtime/components/MLAssetManager/AssetPreviewDocument.vue.d.ts +9 -0
  30. package/dist/runtime/components/MLAssetManager/AssetPreviewFallback.d.vue.ts +7 -0
  31. package/dist/runtime/components/MLAssetManager/AssetPreviewFallback.vue +41 -0
  32. package/dist/runtime/components/MLAssetManager/AssetPreviewFallback.vue.d.ts +7 -0
  33. package/dist/runtime/components/MLAssetManager/AssetPreviewImage.d.vue.ts +9 -0
  34. package/dist/runtime/components/MLAssetManager/AssetPreviewImage.vue +30 -0
  35. package/dist/runtime/components/MLAssetManager/AssetPreviewImage.vue.d.ts +9 -0
  36. package/dist/runtime/components/MLAssetManager/AssetPreviewSidebar.d.vue.ts +15 -0
  37. package/dist/runtime/components/MLAssetManager/AssetPreviewSidebar.vue +69 -0
  38. package/dist/runtime/components/MLAssetManager/AssetPreviewSidebar.vue.d.ts +15 -0
  39. package/dist/runtime/components/MLAssetManager/AssetPreviewVideo.d.vue.ts +9 -0
  40. package/dist/runtime/components/MLAssetManager/AssetPreviewVideo.vue +148 -0
  41. package/dist/runtime/components/MLAssetManager/AssetPreviewVideo.vue.d.ts +9 -0
  42. package/dist/runtime/components/MLAssetManager/AssetRenditions.d.vue.ts +8 -0
  43. package/dist/runtime/components/MLAssetManager/AssetRenditions.vue +148 -0
  44. package/dist/runtime/components/MLAssetManager/AssetRenditions.vue.d.ts +8 -0
  45. package/dist/runtime/components/MLAssetManager/Processing.d.vue.ts +8 -0
  46. package/dist/runtime/components/MLAssetManager/Processing.vue +84 -0
  47. package/dist/runtime/components/MLAssetManager/Processing.vue.d.ts +8 -0
  48. package/dist/runtime/components/MLAssetManager/SlotCard.d.vue.ts +17 -0
  49. package/dist/runtime/components/MLAssetManager/SlotCard.vue +94 -0
  50. package/dist/runtime/components/MLAssetManager/SlotCard.vue.d.ts +17 -0
  51. package/dist/runtime/components/MLAssetManager/Widget.d.vue.ts +14 -0
  52. package/dist/runtime/components/MLAssetManager/Widget.vue +328 -0
  53. package/dist/runtime/components/MLAssetManager/Widget.vue.d.ts +14 -0
  54. package/dist/runtime/components/MLPreviewProvider.d.vue.ts +31 -0
  55. package/dist/runtime/components/MLPreviewProvider.vue +51 -0
  56. package/dist/runtime/components/MLPreviewProvider.vue.d.ts +31 -0
  57. package/dist/runtime/components/MLProcessing/Forms/ConfigureStepModal.d.vue.ts +13 -0
  58. package/dist/runtime/components/MLProcessing/Forms/ConfigureStepModal.vue +47 -0
  59. package/dist/runtime/components/MLProcessing/Forms/ConfigureStepModal.vue.d.ts +13 -0
  60. package/dist/runtime/components/MLProcessing/Forms/FramePicker.d.vue.ts +11 -0
  61. package/dist/runtime/components/MLProcessing/Forms/FramePicker.vue +162 -0
  62. package/dist/runtime/components/MLProcessing/Forms/FramePicker.vue.d.ts +11 -0
  63. package/dist/runtime/components/MLProcessing/Forms/StepOptionsForm.d.vue.ts +14 -0
  64. package/dist/runtime/components/MLProcessing/Forms/StepOptionsForm.vue +113 -0
  65. package/dist/runtime/components/MLProcessing/Forms/StepOptionsForm.vue.d.ts +14 -0
  66. package/dist/runtime/components/MLProcessing/Pipeline.d.vue.ts +15 -0
  67. package/dist/runtime/components/MLProcessing/Pipeline.vue +178 -0
  68. package/dist/runtime/components/MLProcessing/Pipeline.vue.d.ts +15 -0
  69. package/dist/runtime/components/MLProcessing/PipelineStepItem.d.vue.ts +20 -0
  70. package/dist/runtime/components/MLProcessing/PipelineStepItem.vue +309 -0
  71. package/dist/runtime/components/MLProcessing/PipelineStepItem.vue.d.ts +20 -0
  72. package/dist/runtime/components/MLProcessing/ProgressBar.d.vue.ts +9 -0
  73. package/dist/runtime/components/MLProcessing/ProgressBar.vue +27 -0
  74. package/dist/runtime/components/MLProcessing/ProgressBar.vue.d.ts +9 -0
  75. package/dist/runtime/components/MLProcessing/StepLayout.d.vue.ts +31 -0
  76. package/dist/runtime/components/MLProcessing/StepLayout.vue +36 -0
  77. package/dist/runtime/components/MLProcessing/StepLayout.vue.d.ts +31 -0
  78. package/dist/runtime/components/MLProcessing/Stepper.d.vue.ts +16 -0
  79. package/dist/runtime/components/MLProcessing/Stepper.vue +87 -0
  80. package/dist/runtime/components/MLProcessing/Stepper.vue.d.ts +16 -0
  81. package/dist/runtime/components/MLProcessing/StepperItem.d.vue.ts +16 -0
  82. package/dist/runtime/components/MLProcessing/StepperItem.vue +150 -0
  83. package/dist/runtime/components/MLProcessing/StepperItem.vue.d.ts +16 -0
  84. package/dist/runtime/components/MLProcessing/TopBar.d.vue.ts +21 -0
  85. package/dist/runtime/components/MLProcessing/TopBar.vue +46 -0
  86. package/dist/runtime/components/MLProcessing/TopBar.vue.d.ts +21 -0
  87. package/dist/runtime/components/MLUploader/ButtonUploader.d.vue.ts +55 -0
  88. package/dist/runtime/components/MLUploader/ButtonUploader.vue +211 -0
  89. package/dist/runtime/components/MLUploader/ButtonUploader.vue.d.ts +55 -0
  90. package/dist/runtime/components/MLUploader/Item.d.vue.ts +34 -0
  91. package/dist/runtime/components/MLUploader/Item.vue +242 -0
  92. package/dist/runtime/components/MLUploader/Item.vue.d.ts +34 -0
  93. package/dist/runtime/components/MLUploader/PolicyPopover.d.vue.ts +7 -0
  94. package/dist/runtime/components/MLUploader/PolicyPopover.vue +160 -0
  95. package/dist/runtime/components/MLUploader/PolicyPopover.vue.d.ts +7 -0
  96. package/dist/runtime/components/MLUploader/Widget.d.vue.ts +44 -0
  97. package/dist/runtime/components/MLUploader/Widget.vue +251 -0
  98. package/dist/runtime/components/MLUploader/Widget.vue.d.ts +44 -0
  99. package/dist/runtime/composables/resourcePolicy/mimeUtils.d.ts +4 -0
  100. package/dist/runtime/composables/resourcePolicy/mimeUtils.js +71 -0
  101. package/dist/runtime/composables/resourcePolicy/useMLResourcePolicy.d.ts +17 -0
  102. package/dist/runtime/composables/resourcePolicy/useMLResourcePolicy.js +150 -0
  103. package/dist/runtime/composables/useElapsedTimer.d.ts +13 -0
  104. package/dist/runtime/composables/useElapsedTimer.js +46 -0
  105. package/dist/runtime/composables/useMLAssetLibrary.d.ts +31 -0
  106. package/dist/runtime/composables/useMLAssetLibrary.js +53 -0
  107. package/dist/runtime/composables/useMLAssetManager.d.ts +30 -0
  108. package/dist/runtime/composables/useMLAssetManager.js +229 -0
  109. package/dist/runtime/composables/useMLAssetManagerPreview.d.ts +28 -0
  110. package/dist/runtime/composables/useMLAssetManagerPreview.js +232 -0
  111. package/dist/runtime/composables/useMLAssetPreview.d.ts +23 -0
  112. package/dist/runtime/composables/useMLAssetPreview.js +153 -0
  113. package/dist/runtime/composables/useMLChunkUploader.d.ts +9 -0
  114. package/dist/runtime/composables/useMLChunkUploader.js +22 -0
  115. package/dist/runtime/composables/useMLProcessingPipeline.d.ts +38 -0
  116. package/dist/runtime/composables/useMLProcessingPipeline.js +258 -0
  117. package/dist/runtime/composables/useMLProcessingStatus.d.ts +34 -0
  118. package/dist/runtime/composables/useMLProcessingStatus.js +100 -0
  119. package/dist/runtime/composables/useMLProcessingStepper.d.ts +32 -0
  120. package/dist/runtime/composables/useMLProcessingStepper.js +280 -0
  121. package/dist/runtime/composables/useMLProcessingStrategies.d.ts +7 -0
  122. package/dist/runtime/composables/useMLProcessingStrategies.js +47 -0
  123. package/dist/runtime/composables/useMLRepeater.d.ts +5 -0
  124. package/dist/runtime/composables/useMLRepeater.js +11 -0
  125. package/dist/runtime/css/index.css +1 -0
  126. package/dist/runtime/index.d.ts +13 -0
  127. package/dist/runtime/index.js +13 -0
  128. package/dist/runtime/plugins/asset-direcetive-client.d.ts +2 -0
  129. package/dist/runtime/plugins/asset-direcetive-client.js +64 -0
  130. package/dist/runtime/plugins/config.d.ts +13 -0
  131. package/dist/runtime/plugins/config.js +23 -0
  132. package/dist/runtime/schemas/resource-policy.schema.d.ts +607 -0
  133. package/dist/runtime/schemas/resource-policy.schema.js +117 -0
  134. package/dist/runtime/server/assets-proxy.d.ts +2 -0
  135. package/dist/runtime/server/assets-proxy.js +81 -0
  136. package/dist/runtime/server/create-ml-proxy.d.ts +47 -0
  137. package/dist/runtime/server/create-ml-proxy.js +232 -0
  138. package/dist/runtime/server/delivery-proxy.d.ts +2 -0
  139. package/dist/runtime/server/delivery-proxy.js +74 -0
  140. package/dist/runtime/server/index.d.ts +2 -0
  141. package/dist/runtime/server/index.js +1 -0
  142. package/dist/runtime/server/processing-proxy.d.ts +2 -0
  143. package/dist/runtime/server/processing-proxy.js +55 -0
  144. package/dist/runtime/server/resource-policy-proxy.d.ts +2 -0
  145. package/dist/runtime/server/resource-policy-proxy.js +80 -0
  146. package/dist/runtime/server/tsconfig.json +0 -0
  147. package/dist/runtime/server/uploads-proxy.d.ts +2 -0
  148. package/dist/runtime/server/uploads-proxy.js +99 -0
  149. package/dist/runtime/types/asset.d.ts +174 -0
  150. package/dist/runtime/types/asset.js +7 -0
  151. package/dist/runtime/types/preview.d.ts +20 -0
  152. package/dist/runtime/types/preview.js +0 -0
  153. package/dist/runtime/types/resourcePolicy.d.ts +77 -0
  154. package/dist/runtime/types/resourcePolicy.js +25 -0
  155. package/dist/runtime/types/uploader.d.ts +71 -0
  156. package/dist/runtime/types/uploader.js +0 -0
  157. package/dist/runtime/utils/uploader/checksum.d.ts +21 -0
  158. package/dist/runtime/utils/uploader/checksum.js +23 -0
  159. package/dist/runtime/utils/uploader/chunking.d.ts +8 -0
  160. package/dist/runtime/utils/uploader/chunking.js +21 -0
  161. package/dist/runtime/utils/uploader/uploader.d.ts +20 -0
  162. package/dist/runtime/utils/uploader/uploader.js +206 -0
  163. package/dist/types.d.mts +11 -0
  164. package/package.json +81 -0
@@ -0,0 +1,156 @@
1
+ <script setup>
2
+ import { computed, ref, toRef } from "vue";
3
+ import { useMLAssetManagerPreview } from "../../composables/useMLAssetManagerPreview";
4
+ const props = defineProps({
5
+ asset: { type: Object, required: true },
6
+ manager: { type: Object, required: true },
7
+ allowReupload: { type: Boolean, required: false }
8
+ });
9
+ const emit = defineEmits(["deleted"]);
10
+ const activeTab = ref("preview");
11
+ const confirmOpen = ref(false);
12
+ const deleting = ref(false);
13
+ const isProcessing = computed(
14
+ () => props.asset.status === "processing"
15
+ );
16
+ const preview = useMLAssetManagerPreview(toRef(props, "asset"));
17
+ const tabItems = computed(() => [
18
+ {
19
+ label: "Preview",
20
+ value: "preview",
21
+ slot: "preview",
22
+ icon: "i-lucide-play"
23
+ },
24
+ { label: "Overview", value: "overview", slot: "overview" },
25
+ {
26
+ label: "Processing",
27
+ value: "processing",
28
+ slot: "processing",
29
+ badge: isProcessing.value ? { color: "warning", label: "\u25CF" } : void 0
30
+ }
31
+ ]);
32
+ async function handleDelete() {
33
+ deleting.value = true;
34
+ try {
35
+ await props.manager.deleteAsset(props.asset.id);
36
+ confirmOpen.value = false;
37
+ emit("deleted", props.asset.id);
38
+ } catch (err) {
39
+ console.error("Failed to delete asset", err);
40
+ } finally {
41
+ deleting.value = false;
42
+ }
43
+ }
44
+ </script>
45
+
46
+ <template>
47
+ <div class="h-full flex flex-col">
48
+ <!-- Navbar -->
49
+ <div
50
+ class="flex items-center justify-between px-4 py-2 border-b border-default shrink-0"
51
+ >
52
+ <span class="text-xs text-muted truncate">{{
53
+ asset.original_filename || asset.id.slice(0, 12)
54
+ }}</span>
55
+ <UButton
56
+ icon="i-lucide-trash-2"
57
+ label="Delete & Reupload"
58
+ variant="ghost"
59
+ color="error"
60
+ size="xs"
61
+ @click="confirmOpen = true"
62
+ />
63
+ </div>
64
+
65
+ <!-- Tabs (tab bar fixed, content scrollable) -->
66
+ <UTabs
67
+ v-model="activeTab"
68
+ :items="tabItems"
69
+ :unmount-on-hide="false"
70
+ variant="link"
71
+ size="sm"
72
+ class="w-full flex-1 flex flex-col"
73
+ :ui="{
74
+ list: 'px-6 border-b border-default shrink-0',
75
+ content: 'flex-1 '
76
+ }"
77
+ >
78
+ <template #preview>
79
+ <div class="p-4 h-127.5 max-h-127.5 overflow-hidden">
80
+ <div class="w-full h-full min-h-0 flex gap-3 overflow-hidden">
81
+ <div class="flex-1 min-w-0 h-full min-h-0">
82
+ <MLAssetManagerAssetPreview
83
+ :asset="asset"
84
+ :source="preview.selected.value"
85
+ />
86
+ </div>
87
+ <aside
88
+ v-if="preview.sources.value.length > 1"
89
+ class="w-56 shrink-0 h-full min-h-0 rounded-lg border border-default bg-elevated/40 overflow-hidden flex"
90
+ >
91
+ <MLAssetManagerAssetPreviewSidebar
92
+ :groups="preview.groups.value"
93
+ :selected-id="preview.selectedId.value"
94
+ @select="preview.select"
95
+ />
96
+ </aside>
97
+ </div>
98
+ </div>
99
+ </template>
100
+ <template #overview>
101
+ <div class="p-6">
102
+ <MLAssetManagerAssetOverview :asset="asset" :manager="manager" />
103
+ </div>
104
+ </template>
105
+ <template #processing>
106
+ <div class="p-6">
107
+ <MLAssetManagerProcessing :asset-id="asset.id" :manager="manager" />
108
+ </div>
109
+ </template>
110
+ </UTabs>
111
+
112
+ <!-- Delete confirmation modal -->
113
+ <UModal v-model:open="confirmOpen">
114
+ <template #content>
115
+ <div class="p-6 space-y-4">
116
+ <div class="flex items-center gap-3">
117
+ <div
118
+ class="w-10 h-10 rounded-full bg-error/10 flex items-center justify-center"
119
+ >
120
+ <UIcon name="i-lucide-trash-2" class="text-error text-lg" />
121
+ </div>
122
+ <div>
123
+ <h3 class="text-sm font-semibold text-default">
124
+ Delete this asset?
125
+ </h3>
126
+ <p class="text-xs text-muted mt-0.5">
127
+ This will permanently delete
128
+ <strong>{{
129
+ asset.original_filename || asset.id.slice(0, 12)
130
+ }}</strong>
131
+ and all its renditions. You can then upload a new file.
132
+ </p>
133
+ </div>
134
+ </div>
135
+ <div class="flex justify-end gap-2">
136
+ <UButton
137
+ label="Cancel"
138
+ variant="ghost"
139
+ color="neutral"
140
+ size="sm"
141
+ @click="confirmOpen = false"
142
+ />
143
+ <UButton
144
+ label="Delete & Reupload"
145
+ color="error"
146
+ size="sm"
147
+ icon="i-lucide-trash-2"
148
+ :loading="deleting"
149
+ @click="handleDelete"
150
+ />
151
+ </div>
152
+ </div>
153
+ </template>
154
+ </UModal>
155
+ </div>
156
+ </template>
@@ -0,0 +1,14 @@
1
+ import type { AssetDetail, UseMLAssetManagerReturn } from "../../index.js";
2
+ type __VLS_Props = {
3
+ asset: AssetDetail;
4
+ manager: UseMLAssetManagerReturn;
5
+ /** Show delete & reupload action (slot mode) */
6
+ allowReupload?: boolean;
7
+ };
8
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
9
+ deleted: (assetId: string) => any;
10
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
11
+ onDeleted?: ((assetId: string) => any) | undefined;
12
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
+ declare const _default: typeof __VLS_export;
14
+ export default _default;
@@ -0,0 +1,15 @@
1
+ import type { AssetDetail } from "../../index.js";
2
+ import type { ProcessingStream } from "../../composables/useMLProcessingStatus.js";
3
+ type __VLS_Props = {
4
+ assets: AssetDetail[];
5
+ selectedAssetId: string | null;
6
+ loading: boolean;
7
+ processingStreams: Map<string, ProcessingStream>;
8
+ };
9
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
10
+ select: (id: string) => any;
11
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
12
+ onSelect?: ((id: string) => any) | undefined;
13
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
14
+ declare const _default: typeof __VLS_export;
15
+ export default _default;
@@ -0,0 +1,41 @@
1
+ <script setup>
2
+ defineProps({
3
+ assets: { type: Array, required: true },
4
+ selectedAssetId: { type: [String, null], required: true },
5
+ loading: { type: Boolean, required: true },
6
+ processingStreams: { type: Map, required: true }
7
+ });
8
+ const emit = defineEmits(["select"]);
9
+ </script>
10
+
11
+ <template>
12
+ <div class="flex flex-col h-full">
13
+ <!-- Loading skeleton -->
14
+ <template v-if="loading">
15
+ <div v-for="i in 5" :key="i" class="h-16 flex items-center px-3 gap-3">
16
+ <USkeleton class="w-10 h-10 rounded-lg shrink-0" />
17
+ <div class="flex-1 space-y-1.5">
18
+ <USkeleton class="h-3.5 w-3/4" />
19
+ <USkeleton class="h-3 w-1/2" />
20
+ </div>
21
+ </div>
22
+ </template>
23
+
24
+ <!-- Asset cards -->
25
+ <template v-else-if="assets.length">
26
+ <MLAssetManagerAssetCard
27
+ v-for="asset in assets"
28
+ :key="asset.id"
29
+ :asset="asset"
30
+ :selected="asset.id === selectedAssetId"
31
+ :processing-stream="processingStreams.get(asset.id)"
32
+ @click="emit('select', asset.id)"
33
+ />
34
+ </template>
35
+
36
+ <!-- Empty -->
37
+ <div v-else class="flex-1 flex items-center justify-center p-4">
38
+ <span class="text-sm text-muted">No assets found</span>
39
+ </div>
40
+ </div>
41
+ </template>
@@ -0,0 +1,15 @@
1
+ import type { AssetDetail } from "../../index.js";
2
+ import type { ProcessingStream } from "../../composables/useMLProcessingStatus.js";
3
+ type __VLS_Props = {
4
+ assets: AssetDetail[];
5
+ selectedAssetId: string | null;
6
+ loading: boolean;
7
+ processingStreams: Map<string, ProcessingStream>;
8
+ };
9
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
10
+ select: (id: string) => any;
11
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
12
+ onSelect?: ((id: string) => any) | undefined;
13
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
14
+ declare const _default: typeof __VLS_export;
15
+ export default _default;
@@ -0,0 +1,8 @@
1
+ import type { AssetDetail, UseMLAssetManagerReturn } from "../../index.js";
2
+ type __VLS_Props = {
3
+ asset: AssetDetail;
4
+ manager?: UseMLAssetManagerReturn;
5
+ };
6
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
7
+ declare const _default: typeof __VLS_export;
8
+ export default _default;
@@ -0,0 +1,321 @@
1
+ <script setup>
2
+ import { computed, ref, watch } from "vue";
3
+ import { useMLResourcePolicy, Visibility } from "../../index";
4
+ const props = defineProps({
5
+ asset: { type: Object, required: true },
6
+ manager: { type: Object, required: false }
7
+ });
8
+ const policyApi = useMLResourcePolicy();
9
+ const formattedSize = computed(() => {
10
+ const bytes = props.asset.sizeBytes ?? props.asset.size_bytes;
11
+ if (!bytes) return "0 B";
12
+ const units = ["B", "KB", "MB", "GB", "TB"];
13
+ const i = Math.floor(Math.log(bytes) / Math.log(1024));
14
+ return `${(bytes / Math.pow(1024, i)).toFixed(i > 0 ? 1 : 0)} ${units[i]}`;
15
+ });
16
+ const timeAgo = (dateStr) => {
17
+ if (!dateStr) return "\u2014";
18
+ const diff = Date.now() - new Date(dateStr).getTime();
19
+ const mins = Math.floor(diff / 6e4);
20
+ if (mins < 1) return "just now";
21
+ if (mins < 60) return `${mins}m ago`;
22
+ const hours = Math.floor(mins / 60);
23
+ if (hours < 24) return `${hours}h ago`;
24
+ const days = Math.floor(hours / 24);
25
+ return `${days}d ago`;
26
+ };
27
+ const hash = computed(
28
+ () => props.asset.hashSha256 ?? props.asset.hash_sha256 ?? null
29
+ );
30
+ const truncatedHash = computed(() => {
31
+ if (!hash.value) return "\u2014";
32
+ return hash.value.slice(0, 12) + "\u2026";
33
+ });
34
+ const copyHash = async () => {
35
+ if (hash.value) {
36
+ await navigator.clipboard.writeText(hash.value);
37
+ }
38
+ };
39
+ const VISIBILITY_ICONS = {
40
+ PUBLIC: "i-lucide-globe",
41
+ PRIVATE: "i-lucide-lock",
42
+ RESTRICTED: "i-lucide-key-round"
43
+ };
44
+ const visibilityIcon = computed(() => {
45
+ return VISIBILITY_ICONS[props.asset.visibility?.toUpperCase()] ?? "i-lucide-eye";
46
+ });
47
+ const visibilityUpdating = ref(false);
48
+ const visibilityError = ref(null);
49
+ const visibilityOptions = [
50
+ { value: Visibility.Public, label: "Public", icon: VISIBILITY_ICONS.PUBLIC },
51
+ { value: Visibility.Private, label: "Private", icon: VISIBILITY_ICONS.PRIVATE },
52
+ { value: Visibility.RESTRICTED, label: "Restricted", icon: VISIBILITY_ICONS.RESTRICTED }
53
+ ];
54
+ const visibilityMenuItems = computed(() => [
55
+ visibilityOptions.map((opt) => ({
56
+ label: opt.label,
57
+ icon: opt.icon,
58
+ checked: props.asset.visibility?.toLowerCase() === opt.value,
59
+ type: "checkbox",
60
+ onSelect: (e) => {
61
+ e.preventDefault();
62
+ void changeVisibility(opt.value);
63
+ }
64
+ }))
65
+ ]);
66
+ async function changeVisibility(next) {
67
+ if (!props.manager) return;
68
+ if (props.asset.visibility?.toLowerCase() === next) return;
69
+ visibilityUpdating.value = true;
70
+ visibilityError.value = null;
71
+ try {
72
+ await props.manager.updateAsset(props.asset.id, { visibility: next });
73
+ } catch (err) {
74
+ visibilityError.value = err instanceof Error ? err.message : "Failed to update visibility";
75
+ } finally {
76
+ visibilityUpdating.value = false;
77
+ }
78
+ }
79
+ const statusColor = computed(() => {
80
+ const map = {
81
+ ready: "success",
82
+ processing: "warning",
83
+ failed: "error",
84
+ uploaded: "info",
85
+ pending: "neutral"
86
+ };
87
+ return map[props.asset.status] ?? "neutral";
88
+ });
89
+ const metaRows = computed(() => [
90
+ { label: "Status", key: "status" },
91
+ { label: "Kind", value: props.asset.kind },
92
+ { label: "Visibility", key: "visibility" },
93
+ { label: "Title", value: props.asset.title || "\u2014" },
94
+ { label: "Filename", value: props.asset.originalFilename || props.asset.original_filename || "\u2014" },
95
+ { label: "MIME Type", value: props.asset.mimeType || props.asset.mime_type || "\u2014" },
96
+ { label: "File Size", value: formattedSize.value },
97
+ { label: "Content Hash", key: "hash" },
98
+ { label: "Created", value: timeAgo(props.asset.createdAt ?? props.asset.created_at) }
99
+ ]);
100
+ const accordionItems = computed(() => [
101
+ {
102
+ label: "Storage",
103
+ icon: "i-lucide-hard-drive",
104
+ value: "storage",
105
+ slot: "storage"
106
+ },
107
+ {
108
+ label: "Resource Policy",
109
+ icon: "i-lucide-shield",
110
+ value: "resource-policy",
111
+ slot: "resource-policy"
112
+ }
113
+ ]);
114
+ const blobId = computed(
115
+ () => props.asset.blobId ?? props.asset.blob_id ?? props.asset.primary_blob_id ?? null
116
+ );
117
+ const resourcePolicyId = computed(
118
+ () => props.asset.resourcePolicyId ?? props.asset.resource_policy_id ?? null
119
+ );
120
+ const previewUrl = computed(() => props.asset.previewUrl ?? null);
121
+ const previewUrlType = computed(() => props.asset.previewUrlType ?? null);
122
+ const previewExpiresIn = computed(() => {
123
+ const sec = props.asset.previewUrlExpiresIn;
124
+ if (sec == null) return "\u2014";
125
+ if (sec < 60) return `${sec}s`;
126
+ if (sec < 3600) return `${Math.round(sec / 60)}m`;
127
+ return `${Math.round(sec / 3600)}h`;
128
+ });
129
+ const renditionsCount = computed(() => props.asset.renditions?.length ?? 0);
130
+ const policy = ref(null);
131
+ const policyLoading = ref(false);
132
+ const policyError = ref(null);
133
+ async function loadPolicy() {
134
+ const id = resourcePolicyId.value;
135
+ if (!id) return;
136
+ policyLoading.value = true;
137
+ policyError.value = null;
138
+ try {
139
+ policy.value = await policyApi.get(id);
140
+ } catch (err) {
141
+ policyError.value = err instanceof Error ? err.message : "Failed to load policy";
142
+ policy.value = null;
143
+ } finally {
144
+ policyLoading.value = false;
145
+ }
146
+ }
147
+ watch(resourcePolicyId, (id) => {
148
+ policy.value = null;
149
+ if (id) loadPolicy();
150
+ }, { immediate: true });
151
+ const policyMaxSize = computed(() => {
152
+ const max = policy.value?.file_constraints?.max_size_bytes;
153
+ if (!max) return "\u2014";
154
+ const units = ["B", "KB", "MB", "GB"];
155
+ const i = Math.floor(Math.log(max) / Math.log(1024));
156
+ return `${(max / Math.pow(1024, i)).toFixed(i > 0 ? 1 : 0)} ${units[i]}`;
157
+ });
158
+ </script>
159
+
160
+ <template>
161
+ <div class="space-y-4">
162
+ <p v-if="visibilityError" class="text-xs text-error">{{ visibilityError }}</p>
163
+ <!-- Metadata grid -->
164
+ <div class="divide-y divide-default">
165
+ <div
166
+ v-for="row in metaRows"
167
+ :key="row.label"
168
+ class="flex items-center justify-between py-2 px-1"
169
+ >
170
+ <span class="text-xs text-muted uppercase tracking-wide">{{ row.label }}</span>
171
+ <template v-if="row.key === 'status'">
172
+ <UBadge :color="statusColor" variant="subtle" size="xs">{{ asset.status }}</UBadge>
173
+ </template>
174
+ <template v-else-if="row.key === 'visibility'">
175
+ <UDropdownMenu
176
+ v-if="manager"
177
+ :items="visibilityMenuItems"
178
+ :popper="{ placement: 'bottom-end' }"
179
+ >
180
+ <UButton
181
+ :icon="visibilityUpdating ? 'i-lucide-loader-circle' : visibilityIcon"
182
+ :label="asset.visibility"
183
+ :loading="visibilityUpdating"
184
+ variant="ghost"
185
+ color="neutral"
186
+ size="xs"
187
+ trailing-icon="i-lucide-chevron-down"
188
+ :ui="{ leadingIcon: visibilityUpdating ? 'animate-spin' : '' }"
189
+ />
190
+ </UDropdownMenu>
191
+ <span v-else class="flex items-center gap-1 text-xs text-default">
192
+ <UIcon :name="visibilityIcon" class="text-sm" />
193
+ {{ asset.visibility }}
194
+ </span>
195
+ </template>
196
+ <template v-else-if="row.key === 'hash'">
197
+ <UTooltip :text="hash || 'No hash'">
198
+ <span class="flex items-center gap-1 text-xs font-mono text-default cursor-pointer" @click="copyHash">
199
+ {{ truncatedHash }}
200
+ <UIcon name="i-lucide-copy" class="text-muted text-sm" />
201
+ </span>
202
+ </UTooltip>
203
+ </template>
204
+ <template v-else>
205
+ <span class="text-xs text-default">{{ row.value }}</span>
206
+ </template>
207
+ </div>
208
+ </div>
209
+
210
+ <!-- Collapsible sections -->
211
+ <UAccordion :items="accordionItems" type="multiple">
212
+ <template #storage>
213
+ <div class="p-3 space-y-3 text-xs">
214
+ <div>
215
+ <span class="text-muted block mb-0.5">Blob ID</span>
216
+ <span class="font-mono break-all">{{ blobId || "\u2014" }}</span>
217
+ </div>
218
+ <div class="grid grid-cols-2 gap-3">
219
+ <div>
220
+ <span class="text-muted block mb-0.5">Preview URL Type</span>
221
+ <span>{{ previewUrlType || "\u2014" }}</span>
222
+ </div>
223
+ <div>
224
+ <span class="text-muted block mb-0.5">Preview Expires In</span>
225
+ <span>{{ previewExpiresIn }}</span>
226
+ </div>
227
+ <div>
228
+ <span class="text-muted block mb-0.5">Renditions</span>
229
+ <span>{{ renditionsCount }}</span>
230
+ </div>
231
+ <div>
232
+ <span class="text-muted block mb-0.5">File Size</span>
233
+ <span>{{ formattedSize }}</span>
234
+ </div>
235
+ </div>
236
+ <div v-if="previewUrl">
237
+ <span class="text-muted block mb-0.5">Preview URL</span>
238
+ <a
239
+ :href="previewUrl"
240
+ target="_blank"
241
+ rel="noopener"
242
+ class="font-mono break-all text-primary hover:underline"
243
+ >
244
+ {{ previewUrl }}
245
+ </a>
246
+ </div>
247
+ </div>
248
+ </template>
249
+ <template #resource-policy>
250
+ <div class="p-3 text-xs">
251
+ <div v-if="!resourcePolicyId" class="text-muted">No policy attached.</div>
252
+ <div v-else-if="policyLoading" class="text-muted flex items-center gap-2">
253
+ <UIcon name="i-lucide-loader-circle" class="animate-spin" />
254
+ Loading policy\u2026
255
+ </div>
256
+ <div v-else-if="policyError" class="text-error">{{ policyError }}</div>
257
+ <div v-else-if="policy" class="space-y-3">
258
+ <div class="grid grid-cols-2 gap-3">
259
+ <div>
260
+ <span class="text-muted block mb-0.5">Resource Type</span>
261
+ <span>{{ policy.resource_type }}</span>
262
+ </div>
263
+ <div>
264
+ <span class="text-muted block mb-0.5">Collection</span>
265
+ <span>{{ policy.collection_name || "\u2014" }}</span>
266
+ </div>
267
+ <div>
268
+ <span class="text-muted block mb-0.5">Kind</span>
269
+ <span>{{ policy.kind }}</span>
270
+ </div>
271
+ <div>
272
+ <span class="text-muted block mb-0.5">Visibility</span>
273
+ <span>{{ policy.visibility }}</span>
274
+ </div>
275
+ <div>
276
+ <span class="text-muted block mb-0.5">Active</span>
277
+ <UBadge
278
+ :color="policy.is_active ? 'success' : 'neutral'"
279
+ variant="subtle"
280
+ size="xs"
281
+ >
282
+ {{ policy.is_active ? "Yes" : "No" }}
283
+ </UBadge>
284
+ </div>
285
+ <div>
286
+ <span class="text-muted block mb-0.5">Version</span>
287
+ <span>v{{ policy.version }}</span>
288
+ </div>
289
+ <div>
290
+ <span class="text-muted block mb-0.5">Max Size</span>
291
+ <span>{{ policyMaxSize }}</span>
292
+ </div>
293
+ <div>
294
+ <span class="text-muted block mb-0.5">Auto Process</span>
295
+ <span>{{ policy.processing_config?.auto_process ? "Yes" : "No" }}</span>
296
+ </div>
297
+ </div>
298
+ <div v-if="policy.file_constraints?.allowed_mime_types?.length">
299
+ <span class="text-muted block mb-1">Allowed MIME Types</span>
300
+ <div class="flex flex-wrap gap-1">
301
+ <UBadge
302
+ v-for="mime in policy.file_constraints.allowed_mime_types"
303
+ :key="mime"
304
+ variant="soft"
305
+ color="neutral"
306
+ size="xs"
307
+ >
308
+ {{ mime }}
309
+ </UBadge>
310
+ </div>
311
+ </div>
312
+ <div>
313
+ <span class="text-muted block mb-0.5">Policy ID</span>
314
+ <span class="font-mono break-all text-muted">{{ policy.id }}</span>
315
+ </div>
316
+ </div>
317
+ </div>
318
+ </template>
319
+ </UAccordion>
320
+ </div>
321
+ </template>
@@ -0,0 +1,8 @@
1
+ import type { AssetDetail, UseMLAssetManagerReturn } from "../../index.js";
2
+ type __VLS_Props = {
3
+ asset: AssetDetail;
4
+ manager?: UseMLAssetManagerReturn;
5
+ };
6
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
7
+ declare const _default: typeof __VLS_export;
8
+ export default _default;
@@ -0,0 +1,10 @@
1
+ import type { AssetDetail } from "../../index.js";
2
+ import { type PreviewSource } from "../../composables/useMLAssetManagerPreview.js";
3
+ type __VLS_Props = {
4
+ asset: AssetDetail;
5
+ /** When provided, drives which source is rendered. Otherwise an internal default is picked. */
6
+ source?: PreviewSource | null;
7
+ };
8
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
+ declare const _default: typeof __VLS_export;
10
+ export default _default;
@@ -0,0 +1,18 @@
1
+ <script setup>
2
+ import { computed, toRef } from "vue";
3
+ import { useMLAssetManagerPreview } from "../../composables/useMLAssetManagerPreview";
4
+ const props = defineProps({
5
+ asset: { type: Object, required: true },
6
+ source: { type: [Object, null], required: false }
7
+ });
8
+ const internal = useMLAssetManagerPreview(toRef(props, "asset"));
9
+ const current = computed(() => props.source ?? internal.selected.value);
10
+ </script>
11
+
12
+ <template>
13
+ <MLAssetManagerAssetPreviewImage v-if="current?.kind === 'image'" :asset="asset" :source="current" />
14
+ <MLAssetManagerAssetPreviewVideo v-else-if="current?.kind === 'video'" :asset="asset" :source="current" />
15
+ <MLAssetManagerAssetPreviewAudio v-else-if="current?.kind === 'audio'" :asset="asset" :source="current" />
16
+ <MLAssetManagerAssetPreviewDocument v-else-if="current?.kind === 'document'" :asset="asset" :source="current" />
17
+ <MLAssetManagerAssetPreviewFallback v-else :asset="asset" />
18
+ </template>
@@ -0,0 +1,10 @@
1
+ import type { AssetDetail } from "../../index.js";
2
+ import { type PreviewSource } from "../../composables/useMLAssetManagerPreview.js";
3
+ type __VLS_Props = {
4
+ asset: AssetDetail;
5
+ /** When provided, drives which source is rendered. Otherwise an internal default is picked. */
6
+ source?: PreviewSource | null;
7
+ };
8
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
+ declare const _default: typeof __VLS_export;
10
+ export default _default;
@@ -0,0 +1,9 @@
1
+ import type { AssetDetail } from "../../index.js";
2
+ import type { PreviewSource } from "../../composables/useMLAssetManagerPreview.js";
3
+ type __VLS_Props = {
4
+ asset: AssetDetail;
5
+ source?: PreviewSource | null;
6
+ };
7
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
8
+ declare const _default: typeof __VLS_export;
9
+ export default _default;
@@ -0,0 +1,21 @@
1
+ <script setup>
2
+ import { computed } from "vue";
3
+ const props = defineProps({
4
+ asset: { type: Object, required: true },
5
+ source: { type: [Object, null], required: false }
6
+ });
7
+ const src = computed(() => props.source?.src ?? props.asset.previewUrl ?? null);
8
+ </script>
9
+
10
+ <template>
11
+ <div class="w-full h-full bg-muted rounded-lg border border-default flex flex-col items-center justify-center gap-3 p-4">
12
+ <div class="w-12 h-12 rounded-full bg-primary/10 border border-primary/30 flex items-center justify-center">
13
+ <UIcon name="i-lucide-music" class="text-primary text-2xl" />
14
+ </div>
15
+ <span class="text-xs font-bold text-default truncate max-w-full">
16
+ {{ asset.original_filename || asset.title || asset.id.slice(0, 12) }}
17
+ </span>
18
+ <MLAssetManagerAssetPreviewFallback v-if="!src" :asset="asset" class="hidden" />
19
+ <audio v-else :key="src" :src="src" controls preload="metadata" class="w-full max-w-md" />
20
+ </div>
21
+ </template>