@devite/nuxt-sanity 1.0.3 → 1.1.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,2 +1,3 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
export declare const
|
|
1
|
+
export declare const IMAGE_ASSET_PROJECTION: any;
|
|
2
|
+
export declare const IMAGE_WITHOUT_PREVIEW_PROJECTION: any;
|
|
3
|
+
export declare const IMAGE_WITH_PREVIEW_PROJECTION: any;
|
|
@@ -1,23 +1,17 @@
|
|
|
1
1
|
import { groq } from "@nuxtjs/sanity/runtime/groq";
|
|
2
|
-
export const
|
|
2
|
+
export const IMAGE_ASSET_PROJECTION = groq`{
|
|
3
3
|
_type,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
mimeType,
|
|
10
|
-
metadata { dimensions }
|
|
11
|
-
}
|
|
4
|
+
_id,
|
|
5
|
+
url,
|
|
6
|
+
altText,
|
|
7
|
+
mimeType,
|
|
8
|
+
metadata { lqip, dimensions }
|
|
12
9
|
}`;
|
|
13
|
-
export const
|
|
10
|
+
export const IMAGE_WITHOUT_PREVIEW_PROJECTION = groq`{
|
|
14
11
|
_type,
|
|
15
|
-
asset-> {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
mimeType,
|
|
21
|
-
metadata { lqip, dimensions }
|
|
22
|
-
}
|
|
12
|
+
asset-> ${IMAGE_ASSET_PROJECTION.replace("lqip, ", "")},
|
|
13
|
+
}`;
|
|
14
|
+
export const IMAGE_WITH_PREVIEW_PROJECTION = groq`{
|
|
15
|
+
_type,
|
|
16
|
+
asset-> ${IMAGE_ASSET_PROJECTION}
|
|
23
17
|
}`;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { useSanityQuery } from "@nuxtjs/sanity/runtime/composables";
|
|
2
|
+
import { IMAGE_ASSET_PROJECTION } from "./projections.js";
|
|
3
|
+
export const resolveImageAssetById = async (id) => {
|
|
4
|
+
return await useSanityQuery(`*[_type == "sanity.imageAsset" && _id == $assetId][0] ${IMAGE_ASSET_PROJECTION}`, { assetId: id });
|
|
5
|
+
};
|
package/package.json
CHANGED