@devite/nuxt-sanity 2.6.0 → 2.8.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.d.mts CHANGED
@@ -74,11 +74,15 @@ interface LinkExternal {
74
74
  _type: 'linkExternal';
75
75
  url: string;
76
76
  newWindow: boolean;
77
+ linkTitle?: string;
78
+ relationship?: string;
77
79
  }
78
80
 
79
81
  interface LinkInternal {
80
82
  _type: 'linkInternal';
81
83
  slug: string;
84
+ linkTitle?: string;
85
+ relationship?: string;
82
86
  }
83
87
 
84
88
  interface SEO {
package/dist/module.d.ts CHANGED
@@ -74,11 +74,15 @@ interface LinkExternal {
74
74
  _type: 'linkExternal';
75
75
  url: string;
76
76
  newWindow: boolean;
77
+ linkTitle?: string;
78
+ relationship?: string;
77
79
  }
78
80
 
79
81
  interface LinkInternal {
80
82
  _type: 'linkInternal';
81
83
  slug: string;
84
+ linkTitle?: string;
85
+ relationship?: string;
82
86
  }
83
87
 
84
88
  interface SEO {
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devite/nuxt-sanity",
3
- "version": "2.6.0",
3
+ "version": "2.8.0",
4
4
  "configKey": "sanity",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "0.8.4",
package/dist/module.mjs CHANGED
@@ -3,7 +3,7 @@ import { defineNuxtModule, createResolver, addPlugin, addServerHandler, addImpor
3
3
  import defu from 'defu';
4
4
 
5
5
  const name = "@devite/nuxt-sanity";
6
- const version = "2.6.0";
6
+ const version = "2.8.0";
7
7
 
8
8
  const CONFIG_KEY = "sanity";
9
9
  const module = defineNuxtModule({
@@ -6,7 +6,7 @@
6
6
  :width="imageAsset.metadata.dimensions.width"
7
7
  :height="imageAsset.metadata.dimensions.height"
8
8
  :alt="imageAsset.altText as (string | undefined)"
9
- :placeholder="loading === 'eager' ? undefined : imageAsset.metadata.lqip"
9
+ :placeholder="loading === 'eager' || !lqip ? undefined : imageAsset.metadata.lqip"
10
10
  :loading="loading || 'lazy'"
11
11
  :format="imageAsset.mimeType === 'image/svg+xml' ? undefined : 'webp'"
12
12
  draggable="false"
@@ -22,13 +22,14 @@ import { resolveImageAssetById } from '../utils/resolveImageAssetById'
22
22
  const props = defineProps<{
23
23
  asset?: ImageAsset | Reference | null
24
24
  loading?: 'eager' | 'lazy'
25
+ lqip?: boolean
25
26
  }>()
26
27
  const imageAsset = ref<ImageAsset | null>(null)
27
28
  let unwatchFunc = undefined as (() => void) | undefined
28
29
 
29
30
  async function resolveImageAsset() {
30
31
  if (props.asset?._ref) {
31
- const assetRef = await resolveImageAssetById((props.asset as Reference)._ref)
32
+ const assetRef = await resolveImageAssetById((props.asset as Reference)._ref, props.lqip || false)
32
33
 
33
34
  imageAsset.value = assetRef.value
34
35
 
@@ -2,6 +2,8 @@
2
2
  <NuxtLink
3
3
  :to="data.url"
4
4
  :target="data.newWindow ? '_blank' : '_self'"
5
+ :title="data.linkTitle"
6
+ :rel="data.relationship"
5
7
  external
6
8
  >
7
9
  <slot />
@@ -1,5 +1,9 @@
1
1
  <template>
2
- <NuxtLink :to="resolvedLink?.slug">
2
+ <NuxtLink
3
+ :to="resolvedLink?.slug"
4
+ :title="data.linkTitle"
5
+ :rel="data.relationship"
6
+ >
3
7
  <slot />
4
8
  </NuxtLink>
5
9
  </template>
@@ -1,3 +1,3 @@
1
1
  import type { ImageAsset } from '@sanity/types';
2
2
  import type { Ref } from 'vue';
3
- export declare const resolveImageAssetById: (id: string) => Promise<Ref<ImageAsset | null>>;
3
+ export declare const resolveImageAssetById: (id: string, lqip?: boolean) => Promise<Ref<ImageAsset | null>>;
@@ -1,8 +1,9 @@
1
1
  import { IMAGE_ASSET_PROJECTION } from "./projections.js";
2
2
  import { useSanityQuery } from "#imports";
3
- export const resolveImageAssetById = async (id) => {
3
+ export const resolveImageAssetById = async (id, lqip) => {
4
+ const projection = lqip ? IMAGE_ASSET_PROJECTION : IMAGE_ASSET_PROJECTION.replace("lqip, ", "");
4
5
  return (await useSanityQuery(
5
- `*[_type == "sanity.imageAsset" && _id == $assetId][0] ${IMAGE_ASSET_PROJECTION}`,
6
+ `*[_type == "sanity.imageAsset" && _id == $assetId][0] ${projection}`,
6
7
  { assetId: id }
7
8
  )).data;
8
9
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devite/nuxt-sanity",
3
- "version": "2.6.0",
3
+ "version": "2.8.0",
4
4
  "description": "Advanced Sanity integration for Nuxt.js.",
5
5
  "repository": "devite-io/nuxt-sanity",
6
6
  "license": "MIT",
@@ -23,34 +23,34 @@
23
23
  ],
24
24
  "dependencies": {
25
25
  "@nuxt/image": "^1.8.1",
26
- "@nuxt/kit": "^3.14.1592",
27
26
  "@portabletext/vue": "^1.0.11",
28
27
  "@sanity/client": "^6.24.1",
29
- "@sanity/core-loader": "^1.7.21",
28
+ "@sanity/core-loader": "^1.7.22",
30
29
  "@sanity/preview-url-secret": "^2.0.5",
31
30
  "@sanity/types": "^3.68.3",
32
- "@sanity/visual-editing": "^2.11.0",
31
+ "@sanity/visual-editing": "^2.11.3",
33
32
  "defu": "^6.1.4",
34
33
  "ofetch": "^1.4.1",
35
34
  "ohash": "^1.1.4",
36
- "unstorage": "^1.14.1"
35
+ "unstorage": "^1.14.4"
37
36
  },
38
37
  "devDependencies": {
39
38
  "@nuxt/eslint-config": "^0.7.4",
39
+ "@nuxt/kit": "^3.15.1",
40
40
  "@nuxt/module-builder": "^0.8.4",
41
- "@nuxt/schema": "^3.14.1592",
41
+ "@nuxt/schema": "^3.15.1",
42
42
  "@nuxt/test-utils": "^3.15.1",
43
43
  "@types/node": "latest",
44
44
  "changelogen": "^0.5.7",
45
45
  "eslint": "^9.17.0",
46
46
  "h3": "^1.13.0",
47
- "nuxt": "^3.14.1592",
47
+ "nuxt": "^3.15.1",
48
48
  "typescript": "~5.6.3",
49
49
  "vitest": "^2.1.8",
50
50
  "vitest-environment-nuxt": "1.0.1",
51
51
  "vue": "3.5.13",
52
52
  "vue-router": "^4.5.0",
53
- "vue-tsc": "^2.1.10"
53
+ "vue-tsc": "^2.1.6"
54
54
  },
55
55
  "overrides": {
56
56
  "react": "18.3.1"