@devite/nuxt-sanity 1.1.3 → 1.2.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
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<NuxtImg
|
|
3
|
-
v-if="
|
|
3
|
+
v-if="imageAsset?._id"
|
|
4
4
|
densities="x1 x2"
|
|
5
|
-
:src="
|
|
6
|
-
:width="
|
|
7
|
-
:height="
|
|
8
|
-
:alt="
|
|
9
|
-
:placeholder="
|
|
5
|
+
:src="imageAsset._id"
|
|
6
|
+
:width="imageAsset.metadata.dimensions.width"
|
|
7
|
+
:height="imageAsset.metadata.dimensions.height"
|
|
8
|
+
:alt="imageAsset.altText"
|
|
9
|
+
:placeholder="imageAsset.metadata.lqip"
|
|
10
10
|
:loading="loading"
|
|
11
|
-
:format="
|
|
11
|
+
:format="imageAsset.mimeType === 'image/svg+xml' ? undefined : 'webp'"
|
|
12
12
|
draggable="false"
|
|
13
13
|
/>
|
|
14
14
|
</template>
|
|
@@ -16,5 +16,6 @@
|
|
|
16
16
|
<script setup lang="ts">
|
|
17
17
|
import type { ImageAsset } from '@sanity/types'
|
|
18
18
|
|
|
19
|
-
const { loading = 'lazy' } = defineProps<{ asset
|
|
19
|
+
const { asset, loading = 'lazy' } = defineProps<{ asset?: ImageAsset, loading?: 'lazy' | 'eager' }>()
|
|
20
|
+
const imageAsset = asset?._ref ? await resolveImageAssetById(asset._ref) : asset
|
|
20
21
|
</script>
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import type { ImageAsset } from '@sanity/types';
|
|
2
|
-
|
|
2
|
+
import type { Ref } from '#imports';
|
|
3
|
+
export declare const resolveImageAssetById: (id: string) => Promise<Ref<ImageAsset | undefined>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useSanityQuery } from "@nuxtjs/sanity/runtime/composables";
|
|
2
2
|
import { IMAGE_ASSET_PROJECTION } from "./projections.js";
|
|
3
3
|
export const resolveImageAssetById = async (id) => {
|
|
4
|
-
return (await useSanityQuery(`*[_type == "sanity.imageAsset" && _id == $assetId][0] ${IMAGE_ASSET_PROJECTION}`, { assetId: id })).data
|
|
4
|
+
return (await useSanityQuery(`*[_type == "sanity.imageAsset" && _id == $assetId][0] ${IMAGE_ASSET_PROJECTION}`, { assetId: id })).data;
|
|
5
5
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devite/nuxt-sanity",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Provides additional helper components and utilities for the Nuxt.js Sanity module",
|
|
5
5
|
"repository": "devite-io/nuxt-sanity",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,20 +22,22 @@
|
|
|
22
22
|
"dist"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
+
"@nuxt/image": "^1.8.0",
|
|
25
26
|
"@nuxt/kit": "^3.13.2",
|
|
26
27
|
"@nuxtjs/sanity": "^1.12.1",
|
|
27
|
-
"@
|
|
28
|
+
"@portabletext/vue": "^1.0.11",
|
|
29
|
+
"@sanity/client": "^6.22.0",
|
|
30
|
+
"@sanity/types": "^3.59.0"
|
|
28
31
|
},
|
|
29
32
|
"devDependencies": {
|
|
30
|
-
"@nuxt/devtools": "^1.
|
|
33
|
+
"@nuxt/devtools": "^1.5.1",
|
|
31
34
|
"@nuxt/eslint-config": "^0.5.7",
|
|
32
35
|
"@nuxt/module-builder": "^0.8.4",
|
|
33
36
|
"@nuxt/schema": "^3.13.2",
|
|
34
37
|
"@nuxt/test-utils": "^3.14.2",
|
|
35
|
-
"@portabletext/vue": "^1.0.11",
|
|
36
38
|
"@types/node": "latest",
|
|
37
|
-
"changelogen": "^0.5.
|
|
38
|
-
"eslint": "^9.
|
|
39
|
+
"changelogen": "^0.5.7",
|
|
40
|
+
"eslint": "^9.11.1",
|
|
39
41
|
"nuxt": "^3.13.2",
|
|
40
42
|
"typescript": "latest",
|
|
41
43
|
"vitest": "^2.1.1",
|