@devite/nuxt-sanity 1.5.1 → 1.5.2

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,7 +1,7 @@
1
1
  {
2
2
  "name": "@devite/nuxt-sanity",
3
3
  "configKey": "@devite/nuxt-sanity",
4
- "version": "1.5.1",
4
+ "version": "1.5.2",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "0.8.4",
7
7
  "unbuild": "unknown"
@@ -14,8 +14,11 @@
14
14
  </template>
15
15
 
16
16
  <script setup lang="ts">
17
- import type { ImageAsset } from '@sanity/types'
17
+ import type { ImageAsset, Reference } from '@sanity/types'
18
+ import { type Ref, resolveImageAssetById } from '#imports'
18
19
 
19
- const { asset, loading = 'lazy' } = defineProps<{ asset?: ImageAsset, loading?: 'lazy' | 'eager' }>()
20
- const imageAsset = asset?._ref ? await resolveImageAssetById(asset._ref) : asset
20
+ const { asset, loading = 'lazy' } = defineProps<{ asset?: ImageAsset | Reference, loading?: 'lazy' | 'eager' }>()
21
+ const imageAsset: Ref<ImageAsset | undefined> | ImageAsset | undefined = asset?._ref
22
+ ? await resolveImageAssetById((asset as Reference)._ref)
23
+ : asset as (ImageAsset | undefined)
21
24
  </script>
@@ -9,8 +9,11 @@
9
9
 
10
10
  <script setup lang="ts">
11
11
  import type { LinkInternal } from '@devite/nuxt-sanity'
12
- import type { Ref } from '#imports'
12
+ import type { Reference } from '@sanity/types'
13
+ import { type Ref, resolveInternalLink } from '#imports'
13
14
 
14
- const { data } = defineProps<{ data: LinkInternal }>()
15
- const resolvedLink: Ref<LinkInternal | undefined> | undefined = 'reference' in data ? await resolveInternalLink(data.reference) : data
15
+ const { data } = defineProps<{ data: LinkInternal | { reference: Reference } }>()
16
+ const resolvedLink: Ref<LinkInternal | undefined> | LinkInternal = 'reference' in data
17
+ ? await resolveInternalLink(data.reference)
18
+ : data as LinkInternal
16
19
  </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devite/nuxt-sanity",
3
- "version": "1.5.1",
3
+ "version": "1.5.2",
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",