sanity-plugin-cloudinary 1.0.1 → 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.
@@ -0,0 +1,21 @@
1
+ import {defineType} from 'sanity'
2
+
3
+ export type CloudinaryAssetContextCustom = {
4
+ alt: string
5
+ caption: string
6
+ }
7
+
8
+ export const cloudinaryAssetContextCustom = defineType({
9
+ type: 'object',
10
+ name: 'cloudinary.assetContextCustom',
11
+ fields: [
12
+ {
13
+ type: 'string',
14
+ name: 'alt',
15
+ },
16
+ {
17
+ type: 'string',
18
+ name: 'caption',
19
+ },
20
+ ],
21
+ })
@@ -1,11 +1,5 @@
1
- import {CSSProperties} from 'react'
2
1
  import {CloudinaryAssetDerived} from './schema/cloudinaryAssetDerived'
3
2
 
4
- declare module '*.css' {
5
- const content: {[className: string]: CSSProperties}
6
- export default content
7
- }
8
-
9
3
  export type CloudinaryDerivative = {
10
4
  url: string
11
5
  secure_url: string
package/src/utils.ts CHANGED
@@ -1,14 +1,14 @@
1
- /* eslint-disable camelcase */
1
+ /* eslint-disable camelcase,@typescript-eslint/explicit-module-boundary-types */
2
2
  import {
3
3
  CloudinaryAsset,
4
4
  CloudinaryAssetResponse,
5
5
  CloudinaryMediaLibrary,
6
6
  InsertHandlerParams,
7
- } from './typings'
7
+ } from './types'
8
8
 
9
9
  const widgetSrc = 'https://media-library.cloudinary.com/global/all.js'
10
10
 
11
- export function assetUrl(asset: CloudinaryAsset) {
11
+ export function assetUrl(asset: Partial<Pick<CloudinaryAsset, 'url' | 'secure_url' | 'derived'>>) {
12
12
  if (asset.derived && asset.derived.length > 0) {
13
13
  const [derived] = asset.derived
14
14
  if (derived.secure_url) {
@@ -1,35 +0,0 @@
1
- import {AssetSource} from 'sanity'
2
- import {ObjectDefinition} from 'sanity'
3
- import {Plugin as Plugin_2} from 'sanity'
4
- import {PreviewConfig} from 'sanity'
5
-
6
- export declare const cloudinaryAssetDerivedSchema: {
7
- type: 'object'
8
- name: 'cloudinary.assetDerived'
9
- } & Omit<ObjectDefinition, 'preview'> & {
10
- preview?: PreviewConfig<Record<string, string>, Record<never, any>> | undefined
11
- }
12
-
13
- export declare const cloudinaryAssetSchema: {
14
- type: 'object'
15
- name: 'cloudinary.asset'
16
- } & Omit<ObjectDefinition, 'preview'> & {
17
- preview?:
18
- | PreviewConfig<
19
- {
20
- url: string
21
- resource_type: string
22
- derived: string
23
- },
24
- Record<'url' | 'derived' | 'resource_type', any>
25
- >
26
- | undefined
27
- }
28
-
29
- export declare const cloudinaryAssetSourcePlugin: Plugin_2<void>
30
-
31
- export declare const cloudinaryImageSource: AssetSource
32
-
33
- export declare const cloudinarySchemaPlugin: Plugin_2<void>
34
-
35
- export {}