@abraca/nuxt 2.72.0 → 2.73.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module.json +1 -1
- package/dist/runtime/components/renderers/AGalleryCoverImage.d.vue.ts +9 -1
- package/dist/runtime/components/renderers/AGalleryCoverImage.vue +12 -3
- package/dist/runtime/components/renderers/AGalleryCoverImage.vue.d.ts +9 -1
- package/dist/runtime/components/renderers/AGalleryRenderer.vue +1 -0
- package/dist/runtime/composables/useFileBlobStore.d.ts +16 -0
- package/dist/runtime/composables/useFileBlobStore.js +8 -1
- package/dist/runtime/extensions/views/FileNodeView.vue +8 -2
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -2,7 +2,15 @@ type __VLS_Props = {
|
|
|
2
2
|
uploadId: string;
|
|
3
3
|
docId: string;
|
|
4
4
|
mimeType?: string;
|
|
5
|
+
/** Max-edge px for image covers (retina ~2× CSS); falls back to full blob. */
|
|
6
|
+
size?: number;
|
|
7
|
+
/** Skip the thumbnail and load the full-resolution original — for the
|
|
8
|
+
* lightbox / zoom view where a downscaled thumbnail would look soft. */
|
|
9
|
+
full?: boolean;
|
|
5
10
|
};
|
|
6
|
-
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
11
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
12
|
+
size: number;
|
|
13
|
+
full: boolean;
|
|
14
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
15
|
declare const _default: typeof __VLS_export;
|
|
8
16
|
export default _default;
|
|
@@ -4,9 +4,11 @@ import { useFileBlobStore } from "../../composables/useFileBlobStore";
|
|
|
4
4
|
const props = defineProps({
|
|
5
5
|
uploadId: { type: String, required: true },
|
|
6
6
|
docId: { type: String, required: true },
|
|
7
|
-
mimeType: { type: String, required: false }
|
|
7
|
+
mimeType: { type: String, required: false },
|
|
8
|
+
size: { type: Number, required: false, default: 512 },
|
|
9
|
+
full: { type: Boolean, required: false, default: false }
|
|
8
10
|
});
|
|
9
|
-
const { getBlobUrl } = useFileBlobStore();
|
|
11
|
+
const { getBlobUrl, getThumbUrl } = useFileBlobStore();
|
|
10
12
|
const blobUrl = ref("");
|
|
11
13
|
const loading = ref(true);
|
|
12
14
|
const errored = ref(false);
|
|
@@ -15,7 +17,14 @@ watchEffect(async () => {
|
|
|
15
17
|
loading.value = true;
|
|
16
18
|
errored.value = false;
|
|
17
19
|
try {
|
|
18
|
-
const
|
|
20
|
+
const tryThumb = !props.full && (!props.mimeType || props.mimeType.startsWith("image/"));
|
|
21
|
+
let url = null;
|
|
22
|
+
if (tryThumb) {
|
|
23
|
+
url = await getThumbUrl(props.docId, props.uploadId, { w: props.size });
|
|
24
|
+
}
|
|
25
|
+
if (!url) {
|
|
26
|
+
url = await getBlobUrl(props.docId, props.uploadId);
|
|
27
|
+
}
|
|
19
28
|
if (url) {
|
|
20
29
|
blobUrl.value = url;
|
|
21
30
|
} else {
|
|
@@ -2,7 +2,15 @@ type __VLS_Props = {
|
|
|
2
2
|
uploadId: string;
|
|
3
3
|
docId: string;
|
|
4
4
|
mimeType?: string;
|
|
5
|
+
/** Max-edge px for image covers (retina ~2× CSS); falls back to full blob. */
|
|
6
|
+
size?: number;
|
|
7
|
+
/** Skip the thumbnail and load the full-resolution original — for the
|
|
8
|
+
* lightbox / zoom view where a downscaled thumbnail would look soft. */
|
|
9
|
+
full?: boolean;
|
|
5
10
|
};
|
|
6
|
-
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
11
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
12
|
+
size: number;
|
|
13
|
+
full: boolean;
|
|
14
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
15
|
declare const _default: typeof __VLS_export;
|
|
8
16
|
export default _default;
|
|
@@ -9,7 +9,23 @@
|
|
|
9
9
|
export declare function _initFileBlobStore(store: any): void;
|
|
10
10
|
export declare function _getFileBlobStore(): any;
|
|
11
11
|
export declare function _destroyFileBlobStore(): void;
|
|
12
|
+
/**
|
|
13
|
+
* Thumbnail request options — the box (`w`/`h`), `fit`, `format`, JPEG
|
|
14
|
+
* quality. Declared locally (not imported from @abraca/dabra) so this
|
|
15
|
+
* composable type-checks regardless of the installed SDK version; the store
|
|
16
|
+
* is `any`, and the `?.()` call below degrades gracefully when the SDK
|
|
17
|
+
* predates `getThumbUrl`.
|
|
18
|
+
*/
|
|
19
|
+
export interface ThumbOptions {
|
|
20
|
+
w?: number;
|
|
21
|
+
h?: number;
|
|
22
|
+
fit?: 'cover' | 'contain' | 'inside';
|
|
23
|
+
format?: 'auto' | 'jpeg' | 'png';
|
|
24
|
+
q?: number;
|
|
25
|
+
}
|
|
12
26
|
export declare function useFileBlobStore(): {
|
|
13
27
|
getBlobUrl: (docId: string, uploadId: string) => Promise<string | null>;
|
|
28
|
+
getThumbUrl: (docId: string, uploadId: string, opts?: ThumbOptions) => Promise<string | null>;
|
|
29
|
+
invalidateThumbUrl: (docId: string, uploadId: string, opts?: ThumbOptions) => void;
|
|
14
30
|
putBlob: (docId: string, id: string, file: File, filename: string) => Promise<void>;
|
|
15
31
|
};
|
|
@@ -14,9 +14,16 @@ export function useFileBlobStore() {
|
|
|
14
14
|
if (!_store) return null;
|
|
15
15
|
return _store.getBlobUrl(docId, uploadId);
|
|
16
16
|
}
|
|
17
|
+
async function getThumbUrl(docId, uploadId, opts = {}) {
|
|
18
|
+
if (!_store) return null;
|
|
19
|
+
return await _store.getThumbUrl?.(docId, uploadId, opts) ?? null;
|
|
20
|
+
}
|
|
21
|
+
function invalidateThumbUrl(docId, uploadId, opts = {}) {
|
|
22
|
+
_store?.invalidateThumbUrl?.(docId, uploadId, opts);
|
|
23
|
+
}
|
|
17
24
|
async function putBlob(docId, id, file, filename) {
|
|
18
25
|
if (!_store) return;
|
|
19
26
|
return _store.putBlob(docId, id, file, filename);
|
|
20
27
|
}
|
|
21
|
-
return { getBlobUrl, putBlob };
|
|
28
|
+
return { getBlobUrl, getThumbUrl, invalidateThumbUrl, putBlob };
|
|
22
29
|
}
|
|
@@ -20,7 +20,7 @@ const props = defineProps({
|
|
|
20
20
|
extension: { type: Object, required: true },
|
|
21
21
|
HTMLAttributes: { type: Object, required: true }
|
|
22
22
|
});
|
|
23
|
-
const { getBlobUrl } = useFileBlobStore();
|
|
23
|
+
const { getBlobUrl, getThumbUrl } = useFileBlobStore();
|
|
24
24
|
const { client } = useAbracadabra();
|
|
25
25
|
const uploadId = computed(() => props.node.attrs.uploadId);
|
|
26
26
|
const docId = computed(() => props.node.attrs.docId);
|
|
@@ -55,7 +55,13 @@ async function loadBlob() {
|
|
|
55
55
|
loading.value = true;
|
|
56
56
|
error.value = null;
|
|
57
57
|
try {
|
|
58
|
-
|
|
58
|
+
let url = null;
|
|
59
|
+
if (fileCategory.value === "image") {
|
|
60
|
+
url = await getThumbUrl(docId.value, uploadId.value, { w: 1024 });
|
|
61
|
+
}
|
|
62
|
+
if (!url) {
|
|
63
|
+
url = await getBlobUrl(docId.value, uploadId.value);
|
|
64
|
+
}
|
|
59
65
|
if (url) {
|
|
60
66
|
blobUrl.value = url;
|
|
61
67
|
} else {
|