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,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,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,39 @@
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 mime = computed(() => (props.asset.mime_type || props.asset.mimeType || "").toLowerCase());
8
+ const isPdf = computed(() => mime.value === "application/pdf");
9
+ const isText = computed(() => mime.value.startsWith("text/") || mime.value === "application/json");
10
+ const src = computed(() => props.source?.src ?? props.asset.previewUrl ?? null);
11
+ </script>
12
+
13
+ <template>
14
+ <div class="w-full h-full bg-muted rounded-lg border border-default overflow-hidden relative">
15
+ <MLAssetManagerAssetPreviewFallback v-if="!src" :asset="asset" />
16
+ <iframe
17
+ v-else-if="isPdf || isText"
18
+ :key="src"
19
+ :src="src"
20
+ class="w-full h-full bg-white"
21
+ :title="asset.title || asset.original_filename || asset.id"
22
+ />
23
+ <div v-else class="w-full h-full flex flex-col items-center justify-center gap-3 p-4 text-center">
24
+ <UIcon name="i-lucide-file-text" class="text-primary text-3xl" />
25
+ <span class="text-xs font-bold text-default truncate max-w-full">
26
+ {{ asset.original_filename || asset.title }}
27
+ </span>
28
+ <span class="text-[10px] text-muted">{{ mime }}</span>
29
+ <UButton
30
+ :to="src"
31
+ target="_blank"
32
+ label="Open document"
33
+ icon="i-lucide-external-link"
34
+ size="xs"
35
+ variant="soft"
36
+ />
37
+ </div>
38
+ </div>
39
+ </template>
@@ -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,7 @@
1
+ import type { AssetDetail } from "../../index.js";
2
+ type __VLS_Props = {
3
+ asset: AssetDetail;
4
+ };
5
+ 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>;
6
+ declare const _default: typeof __VLS_export;
7
+ export default _default;
@@ -0,0 +1,41 @@
1
+ <script setup>
2
+ import { computed } from "vue";
3
+ const props = defineProps({
4
+ asset: { type: Object, required: true }
5
+ });
6
+ const icon = computed(() => {
7
+ const map = {
8
+ image: "i-lucide-image",
9
+ video: "i-lucide-play",
10
+ audio: "i-lucide-music",
11
+ document: "i-lucide-file-text",
12
+ archive: "i-lucide-archive",
13
+ font: "i-lucide-type",
14
+ model_3d: "i-lucide-box",
15
+ web_app: "i-lucide-globe",
16
+ image_batch: "i-lucide-images"
17
+ };
18
+ return map[(props.asset.kind || "").toLowerCase()] ?? "i-lucide-file";
19
+ });
20
+ const formattedSize = computed(() => {
21
+ const bytes = props.asset.bytes ?? props.asset.sizeBytes ?? props.asset.size_bytes;
22
+ if (!bytes) return "";
23
+ const units = ["B", "KB", "MB", "GB", "TB"];
24
+ const i = Math.floor(Math.log(bytes) / Math.log(1024));
25
+ return `${(bytes / Math.pow(1024, i)).toFixed(i > 0 ? 1 : 0)} ${units[i]}`;
26
+ });
27
+ </script>
28
+
29
+ <template>
30
+ <div class="w-full h-full bg-muted rounded-lg border border-default flex flex-col items-center justify-center relative overflow-hidden">
31
+ <div class="w-12 h-12 rounded-full bg-primary/10 border border-primary/30 flex items-center justify-center mb-3">
32
+ <UIcon :name="icon" class="text-primary text-2xl" />
33
+ </div>
34
+ <span class="text-sm font-bold text-default">
35
+ {{ asset.original_filename || asset.title || asset.id.slice(0, 12) }}
36
+ </span>
37
+ <span class="text-[10px] text-muted mt-0.5 tracking-wider">
38
+ {{ asset.mime_type || asset.mimeType }}{{ formattedSize ? ` \xB7 ${formattedSize}` : "" }}
39
+ </span>
40
+ </div>
41
+ </template>
@@ -0,0 +1,7 @@
1
+ import type { AssetDetail } from "../../index.js";
2
+ type __VLS_Props = {
3
+ asset: AssetDetail;
4
+ };
5
+ 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>;
6
+ declare const _default: typeof __VLS_export;
7
+ 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,30 @@
1
+ <script setup>
2
+ import { computed, ref, watch } from "vue";
3
+ const props = defineProps({
4
+ asset: { type: Object, required: true },
5
+ source: { type: [Object, null], required: false }
6
+ });
7
+ const errored = ref(false);
8
+ const src = computed(() => {
9
+ if (props.source?.src) return props.source.src;
10
+ const thumb = props.asset.renditions?.find((r) => r.renditionType === "thumbnail" && r.status === "ready");
11
+ const variant = thumb?.variants?.find((v) => v.previewUrl) ?? null;
12
+ return variant?.previewUrl ?? thumb?.previewUrl ?? props.asset.previewUrl ?? null;
13
+ });
14
+ watch(src, () => {
15
+ errored.value = false;
16
+ });
17
+ </script>
18
+
19
+ <template>
20
+ <div class="w-full h-full flex items-center justify-center relative">
21
+ <MLAssetManagerAssetPreviewFallback v-if="!src || errored" :asset="asset" />
22
+ <img
23
+ v-else
24
+ :src="src"
25
+ :alt="asset.title || asset.original_filename || asset.id"
26
+ class="h-full w-auto max-w-full max-h-full object-contain bg-muted rounded-lg border border-default"
27
+ @error="errored = true"
28
+ >
29
+ </div>
30
+ </template>
@@ -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,15 @@
1
+ import type { PreviewSource } from "../../composables/useMLAssetManagerPreview.js";
2
+ type __VLS_Props = {
3
+ groups: Array<{
4
+ label: string;
5
+ items: PreviewSource[];
6
+ }>;
7
+ selectedId: string | null;
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,69 @@
1
+ <script setup>
2
+ defineProps({
3
+ groups: { type: Array, required: true },
4
+ selectedId: { type: [String, null], required: true }
5
+ });
6
+ const emit = defineEmits(["select"]);
7
+ function kindIcon(kind) {
8
+ const map = {
9
+ image: "i-lucide-image",
10
+ video: "i-lucide-play",
11
+ audio: "i-lucide-music",
12
+ document: "i-lucide-file-text",
13
+ fallback: "i-lucide-file"
14
+ };
15
+ return map[kind] ?? "i-lucide-file";
16
+ }
17
+ </script>
18
+
19
+ <template>
20
+ <div class="flex-1 min-h-0 overflow-y-auto p-2 space-y-3">
21
+ <div v-for="g in groups" :key="g.label" class="space-y-1">
22
+ <div
23
+ class="text-[10px] uppercase tracking-wider font-semibold text-muted px-1"
24
+ >
25
+ {{ g.label }}
26
+ </div>
27
+ <button
28
+ v-for="item in g.items"
29
+ :key="item.id"
30
+ type="button"
31
+ class="w-full flex items-center gap-2 p-1.5 rounded-md border text-left transition-colors"
32
+ :class="
33
+ item.id === selectedId ? 'bg-primary/10 border-primary/40' : 'bg-default border-default hover:bg-elevated'
34
+ "
35
+ @click="emit('select', item.id)"
36
+ >
37
+ <div
38
+ class="w-12 h-12 shrink-0 rounded bg-muted border border-default flex items-center justify-center overflow-hidden relative"
39
+ >
40
+ <img
41
+ v-if="item.thumb"
42
+ :src="item.thumb"
43
+ :alt="item.label"
44
+ class="w-full h-full object-cover"
45
+ />
46
+ <UIcon
47
+ v-else
48
+ :name="kindIcon(item.kind)"
49
+ class="text-muted text-lg"
50
+ />
51
+ <div
52
+ v-if="item.kind === 'video'"
53
+ class="absolute inset-0 flex items-center justify-center bg-black/30"
54
+ >
55
+ <UIcon name="i-lucide-play" class="text-white text-base" />
56
+ </div>
57
+ </div>
58
+ <div class="min-w-0 flex-1">
59
+ <div class="text-xs font-medium text-default truncate">
60
+ {{ item.label }}
61
+ </div>
62
+ <div v-if="item.sublabel" class="text-[10px] text-muted truncate">
63
+ {{ item.sublabel }}
64
+ </div>
65
+ </div>
66
+ </button>
67
+ </div>
68
+ </div>
69
+ </template>
@@ -0,0 +1,15 @@
1
+ import type { PreviewSource } from "../../composables/useMLAssetManagerPreview.js";
2
+ type __VLS_Props = {
3
+ groups: Array<{
4
+ label: string;
5
+ items: PreviewSource[];
6
+ }>;
7
+ selectedId: string | null;
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,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;
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,148 @@
1
+ <script setup>
2
+ import {
3
+ computed,
4
+ onBeforeUnmount,
5
+ onMounted,
6
+ ref,
7
+ shallowRef,
8
+ watch
9
+ } from "vue";
10
+ const props = defineProps({
11
+ asset: { type: Object, required: true },
12
+ source: { type: Object, required: true }
13
+ });
14
+ const videoEl = ref(null);
15
+ const errored = ref(false);
16
+ const hlsInstance = shallowRef(null);
17
+ const dashInstance = shallowRef(null);
18
+ const poster = computed(() => props.source.thumb ?? null);
19
+ const mime = computed(
20
+ () => props.asset.mime_type || props.asset.mimeType || ""
21
+ );
22
+ function destroyEngines() {
23
+ if (hlsInstance.value) {
24
+ try {
25
+ hlsInstance.value.destroy();
26
+ } catch {
27
+ }
28
+ hlsInstance.value = null;
29
+ }
30
+ if (dashInstance.value) {
31
+ try {
32
+ dashInstance.value.reset();
33
+ } catch {
34
+ }
35
+ dashInstance.value = null;
36
+ }
37
+ }
38
+ function isSafari() {
39
+ if (typeof navigator === "undefined") return false;
40
+ return /^(?:(?!chrome|android|crios|fxios|edg).)*safari/i.test(
41
+ navigator.userAgent
42
+ );
43
+ }
44
+ async function attachHls(src) {
45
+ const el = videoEl.value;
46
+ if (!el) return false;
47
+ try {
48
+ const mod = await import("hls.js");
49
+ const Hls = mod.default ?? mod;
50
+ if (Hls?.isSupported?.()) {
51
+ const hls = new Hls({ enableWorker: true, lowLatencyMode: false });
52
+ hls.loadSource(src);
53
+ hls.attachMedia(el);
54
+ hls.on(Hls.Events.ERROR, (_e, data) => {
55
+ if (data?.fatal) {
56
+ console.warn("[ML] HLS fatal error:", data?.details);
57
+ errored.value = true;
58
+ }
59
+ });
60
+ hlsInstance.value = hls;
61
+ return true;
62
+ }
63
+ } catch (e) {
64
+ console.warn("[ML] hls.js unavailable:", e?.message ?? e);
65
+ }
66
+ if (isSafari() && el.canPlayType("application/vnd.apple.mpegurl")) {
67
+ el.src = src;
68
+ return true;
69
+ }
70
+ return false;
71
+ }
72
+ async function attachDash(src) {
73
+ const el = videoEl.value;
74
+ if (!el) return false;
75
+ try {
76
+ const mod = await import("dashjs");
77
+ const dashjs = mod.default ?? mod;
78
+ const player = dashjs.MediaPlayer().create();
79
+ player.initialize(el, src, false);
80
+ player.on("error", (ev) => {
81
+ console.warn("[ML] DASH error:", ev?.error?.message);
82
+ errored.value = true;
83
+ });
84
+ dashInstance.value = player;
85
+ return true;
86
+ } catch (e) {
87
+ console.warn("[ML] dashjs unavailable:", e?.message ?? e);
88
+ return false;
89
+ }
90
+ }
91
+ async function setup() {
92
+ destroyEngines();
93
+ errored.value = false;
94
+ const el = videoEl.value;
95
+ const s = props.source;
96
+ if (!el || !s?.src) return;
97
+ el.removeAttribute("src");
98
+ el.load();
99
+ if (s.type === "hls") {
100
+ const ok = await attachHls(s.src);
101
+ if (!ok) errored.value = true;
102
+ return;
103
+ }
104
+ if (s.type === "dash") {
105
+ const ok = await attachDash(s.src);
106
+ if (!ok) errored.value = true;
107
+ return;
108
+ }
109
+ el.load();
110
+ }
111
+ watch(
112
+ () => [props.source?.id, props.source?.src, props.source?.type],
113
+ () => setup(),
114
+ { flush: "post" }
115
+ );
116
+ onMounted(setup);
117
+ onBeforeUnmount(destroyEngines);
118
+ function handleNativeError() {
119
+ console.warn("[ML] <video> error on source", props.source?.src);
120
+ errored.value = true;
121
+ }
122
+ </script>
123
+
124
+ <template>
125
+ <div class="h-full w-fullve">
126
+ <MLAssetManagerAssetPreviewFallback
127
+ v-if="!source?.src || errored"
128
+ :asset="asset"
129
+ />
130
+ <video
131
+ v-else
132
+ :key="source.id"
133
+ ref="videoEl"
134
+ class="h-full w-auto max-w-full max-h-full object-contain bg-black rounded-lg border border-default"
135
+ controls
136
+ playsinline
137
+ preload="metadata"
138
+ :poster="poster || void 0"
139
+ @error="handleNativeError"
140
+ >
141
+ <source
142
+ v-if="source.type === 'progressive'"
143
+ :src="source.src"
144
+ :type="mime"
145
+ />
146
+ </video>
147
+ </div>
148
+ </template>
@@ -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;
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,8 @@
1
+ import type { UseMLAssetManagerReturn } from "../../index.js";
2
+ type __VLS_Props = {
3
+ assetId: string;
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,148 @@
1
+ <script setup>
2
+ import { computed, onMounted, watch } from "vue";
3
+ const props = defineProps({
4
+ assetId: { type: String, required: true },
5
+ manager: { type: Object, required: true }
6
+ });
7
+ const renditions = computed(() => props.manager.renditions.value);
8
+ const loading = computed(() => props.manager.renditionsLoading.value);
9
+ const grouped = computed(() => {
10
+ const groups = /* @__PURE__ */ new Map();
11
+ for (const r of renditions.value) {
12
+ const type = r.renditionType;
13
+ if (!groups.has(type)) groups.set(type, []);
14
+ groups.get(type).push(r);
15
+ }
16
+ return groups;
17
+ });
18
+ const typeIcon = (type) => {
19
+ const map = {
20
+ original: "i-lucide-file",
21
+ mp4: "i-lucide-film",
22
+ thumbnail: "i-lucide-images",
23
+ hls: "i-lucide-radio",
24
+ dash: "i-lucide-radio",
25
+ backup: "i-lucide-archive",
26
+ subtitle: "i-lucide-captions",
27
+ transcript: "i-lucide-text",
28
+ key_moments: "i-lucide-bookmark"
29
+ };
30
+ return map[type] ?? "i-lucide-file";
31
+ };
32
+ const statusColor = (status) => {
33
+ const map = {
34
+ ready: "success",
35
+ processing: "warning",
36
+ failed: "error",
37
+ pending: "neutral"
38
+ };
39
+ return map[status] ?? "neutral";
40
+ };
41
+ const accordionItems = computed(() => {
42
+ return Array.from(grouped.value.entries()).map(([type]) => ({
43
+ label: type.toUpperCase(),
44
+ icon: typeIcon(type),
45
+ value: type,
46
+ slot: type
47
+ }));
48
+ });
49
+ onMounted(() => {
50
+ props.manager.fetchRenditions(props.assetId);
51
+ });
52
+ watch(() => props.assetId, (id) => {
53
+ props.manager.fetchRenditions(id);
54
+ });
55
+ </script>
56
+
57
+ <template>
58
+ <div>
59
+ <!-- Loading -->
60
+ <div v-if="loading" class="space-y-3">
61
+ <USkeleton v-for="i in 3" :key="i" class="h-12 w-full" />
62
+ </div>
63
+
64
+ <!-- Renditions accordion -->
65
+ <UAccordion v-else-if="accordionItems.length" :items="accordionItems" type="multiple">
66
+ <template v-for="[type, items] in grouped" :key="type" #[type]>
67
+ <!-- Thumbnail grid -->
68
+ <div v-if="type === 'thumbnail'" class="flex flex-wrap gap-3 p-3">
69
+ <div v-for="r in items" :key="r.id">
70
+ <div v-if="r.variants?.length" class="flex flex-wrap gap-2">
71
+ <div v-for="v in r.variants" :key="v.name" class="text-center">
72
+ <div class="w-16 h-16 rounded bg-muted flex items-center justify-center">
73
+ <UIcon name="i-lucide-image" class="text-muted" />
74
+ </div>
75
+ <div class="text-[10px] text-muted mt-1">
76
+ {{ v.width && v.height ? `${v.width}x${v.height}` : v.name }}
77
+ </div>
78
+ </div>
79
+ </div>
80
+ </div>
81
+ </div>
82
+
83
+ <!-- HLS/DASH variants table -->
84
+ <div v-else-if="type === 'hls' || type === 'dash'" class="p-3 space-y-2">
85
+ <div v-for="r in items" :key="r.id">
86
+ <div class="flex items-center gap-2 text-xs mb-2">
87
+ <UBadge :color="statusColor(r.status)" variant="subtle" size="xs">{{ r.status }}</UBadge>
88
+ <span class="text-muted">{{ r.entrypoint }}</span>
89
+ <span class="text-muted">{{ r.blobIds?.length ?? 0 }} blobs</span>
90
+ </div>
91
+ <div v-if="r.variants?.length" class="divide-y divide-default">
92
+ <div v-for="v in r.variants" :key="v.name" class="flex items-center justify-between py-1.5 text-xs">
93
+ <span class="font-medium text-default">{{ v.name }}</span>
94
+ <span class="text-muted">{{ v.width && v.height ? `${v.width}x${v.height}` : "" }}</span>
95
+ <span v-if="v.bitrateKbps" class="text-muted">{{ v.bitrateKbps }} kbps</span>
96
+ <span class="text-muted font-mono">{{ v.entrypoint }}</span>
97
+ </div>
98
+ </div>
99
+ </div>
100
+ </div>
101
+
102
+ <!-- MP4 detail -->
103
+ <div v-else-if="type === 'mp4'" class="p-3 space-y-2">
104
+ <div v-for="r in items" :key="r.id" class="flex items-center justify-between py-1.5">
105
+ <div class="flex items-center gap-2 min-w-0">
106
+ <UBadge :color="statusColor(r.status)" variant="subtle" size="xs">{{ r.status }}</UBadge>
107
+ <span class="text-xs text-default truncate">{{ r.entrypoint }}</span>
108
+ </div>
109
+ <div class="flex items-center gap-3 text-xs text-muted shrink-0">
110
+ <span v-if="r.extras?.width && r.extras?.height">{{ r.extras.width }}x{{ r.extras.height }}</span>
111
+ <span v-if="r.extras?.codec_video">{{ r.extras.codec_video }}</span>
112
+ <span v-if="r.extras?.bitrate_kbps">{{ r.extras.bitrate_kbps }} kbps</span>
113
+ <span v-if="r.durationSeconds">{{ Math.round(r.durationSeconds) }}s</span>
114
+ </div>
115
+ </div>
116
+ </div>
117
+
118
+ <!-- Default list for other types -->
119
+ <div v-else class="p-3 space-y-2">
120
+ <div
121
+ v-for="r in items"
122
+ :key="r.id"
123
+ class="flex items-center justify-between py-1.5"
124
+ >
125
+ <div class="flex items-center gap-2 min-w-0">
126
+ <UBadge :color="statusColor(r.status)" variant="subtle" size="xs">{{ r.status }}</UBadge>
127
+ <span class="text-xs text-default truncate">{{ r.entrypoint || r.id.slice(0, 8) }}</span>
128
+ </div>
129
+ <div class="flex items-center gap-3 text-xs text-muted shrink-0">
130
+ <span v-if="r.durationSeconds">{{ Math.round(r.durationSeconds) }}s</span>
131
+ <span v-if="r.pages">{{ r.pages }} pages</span>
132
+ <span>{{ r.blobIds?.length ?? 0 }} files</span>
133
+ </div>
134
+ </div>
135
+ </div>
136
+ </template>
137
+ </UAccordion>
138
+
139
+ <!-- Empty state -->
140
+ <UEmpty
141
+ v-else
142
+ icon="i-lucide-images"
143
+ title="No renditions"
144
+ description="Renditions will appear here after processing completes."
145
+ size="sm"
146
+ />
147
+ </div>
148
+ </template>
@@ -0,0 +1,8 @@
1
+ import type { UseMLAssetManagerReturn } from "../../index.js";
2
+ type __VLS_Props = {
3
+ assetId: string;
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,8 @@
1
+ import type { UseMLAssetManagerReturn } from "../../index.js";
2
+ type __VLS_Props = {
3
+ assetId: string;
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;