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.
- package/LICENSE +1 -1
- package/README.md +51 -43
- package/lib/index.d.ts +92 -0
- package/lib/index.esm.js +626 -1
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +643 -1
- package/lib/index.js.map +1 -1
- package/package.json +35 -29
- package/src/arrayFunctions.tsx +1 -1
- package/src/components/AssetDiff.tsx +2 -2
- package/src/components/AssetPreview.tsx +12 -7
- package/src/components/CloudinaryInput.tsx +2 -2
- package/src/components/VideoPlayer.tsx +16 -54
- package/src/components/WidgetInput.tsx +2 -2
- package/src/components/asset-source/CloudinaryAssetSource.tsx +1 -1
- package/src/index.ts +20 -2
- package/src/schema/cloudinaryAsset.ts +9 -3
- package/src/schema/cloudinaryAssetContext.ts +16 -0
- package/src/schema/cloudinaryAssetContextCustom.ts +21 -0
- package/src/{typings.d.ts → types.ts} +0 -6
- package/src/utils.ts +3 -3
- package/lib/src/index.d.ts +0 -35
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -124,24 +124,28 @@ Here is an example of which data is stored on your document after selecting an a
|
|
|
124
124
|
|
|
125
125
|
```json
|
|
126
126
|
{
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
127
|
+
"public_id": "29b4a88182b4cb50330011d23a29bcb371bd5886-2400x1344_lzcx7x",
|
|
128
|
+
"resource_type": "image",
|
|
129
|
+
"type": "upload",
|
|
130
|
+
"format": "jpg",
|
|
131
|
+
"version": 1616474653,
|
|
132
|
+
"url": "http://res.cloudinary.com/dzwiku20l/image/upload/v1616474653/29b4a88182b4cb50330011d23a29bcb371bd5886-2400x1344_lzcx7x.jpg",
|
|
133
|
+
"secure_url": "https://res.cloudinary.com/dzwiku20l/image/upload/v1616474653/29b4a88182b4cb50330011d23a29bcb371bd5886-2400x1344_lzcx7x.jpg",
|
|
134
|
+
"width": 2400,
|
|
135
|
+
"height": 1344,
|
|
136
|
+
"bytes": 547710,
|
|
137
|
+
"duration": null,
|
|
138
|
+
"tags": [],
|
|
139
|
+
"context": {
|
|
140
|
+
"custom": {
|
|
141
|
+
"alt": "alternative text for image"
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
"created_at": "2021-03-23T04:44:13Z",
|
|
145
|
+
"access_mode": "public",
|
|
146
|
+
"_version": 1,
|
|
147
|
+
"_type": "cloudinary.asset"
|
|
148
|
+
}
|
|
145
149
|
```
|
|
146
150
|
|
|
147
151
|
Note: The `_version` in the data here refers to the schema version of this plugin, should the way it stores the data from Cloudinary change in the future.
|
|
@@ -154,31 +158,35 @@ You can create a transformation when selecting the asset, and this information i
|
|
|
154
158
|
|
|
155
159
|
```json
|
|
156
160
|
{
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
161
|
+
"public_id": "29b4a88182b4cb50330011d23a29bcb371bd5886-2400x1344_lzcx7x",
|
|
162
|
+
"resource_type": "image",
|
|
163
|
+
"type": "upload",
|
|
164
|
+
"format": "jpg",
|
|
165
|
+
"version": 1616474653,
|
|
166
|
+
"url": "http://res.cloudinary.com/dzwiku20l/image/upload/v1616474653/29b4a88182b4cb50330011d23a29bcb371bd5886-2400x1344_lzcx7x.jpg",
|
|
167
|
+
"secure_url": "https://res.cloudinary.com/dzwiku20l/image/upload/v1616474653/29b4a88182b4cb50330011d23a29bcb371bd5886-2400x1344_lzcx7x.jpg",
|
|
168
|
+
"width": 2400,
|
|
169
|
+
"height": 1344,
|
|
170
|
+
"bytes": 547710,
|
|
171
|
+
"duration": null,
|
|
172
|
+
"tags": null,
|
|
173
|
+
"context": {
|
|
174
|
+
"custom": {
|
|
175
|
+
"alt": "alternative text for image"
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
"created_at": "2021-03-23T04:44:13Z",
|
|
179
|
+
"derived": [
|
|
180
|
+
{
|
|
181
|
+
"url": "http://res.cloudinary.com/dzwiku20l/image/upload/a_45/v1616474653/29b4a88182b4cb50330011d23a29bcb371bd5886-2400x1344_lzcx7x.jpg",
|
|
182
|
+
"secure_url": "https://res.cloudinary.com/dzwiku20l/image/upload/a_45/v1616474653/29b4a88182b4cb50330011d23a29bcb371bd5886-2400x1344_lzcx7x.jpg",
|
|
183
|
+
"raw_transformation": "a_45"
|
|
184
|
+
}
|
|
185
|
+
],
|
|
186
|
+
"access_mode": "public",
|
|
187
|
+
"_version": 1,
|
|
188
|
+
"_type": "cloudinary.asset"
|
|
189
|
+
}
|
|
182
190
|
```
|
|
183
191
|
|
|
184
192
|
## Video
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
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 type AssetDocument = {
|
|
7
|
+
_id: string
|
|
8
|
+
label?: string
|
|
9
|
+
title?: string
|
|
10
|
+
description?: string
|
|
11
|
+
source?: {
|
|
12
|
+
id: string
|
|
13
|
+
name: string
|
|
14
|
+
url?: string
|
|
15
|
+
}
|
|
16
|
+
creditLine?: string
|
|
17
|
+
originalFilename?: string
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export declare type CloudinaryAsset = {
|
|
21
|
+
_type: string
|
|
22
|
+
_key?: string
|
|
23
|
+
_version: number
|
|
24
|
+
public_id: string
|
|
25
|
+
resource_type: string
|
|
26
|
+
type: string
|
|
27
|
+
format: string
|
|
28
|
+
version: number
|
|
29
|
+
url: string
|
|
30
|
+
secure_url: string
|
|
31
|
+
derived?: CloudinaryAssetDerived[]
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export declare interface CloudinaryAssetContext {
|
|
35
|
+
custom: object
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export declare const cloudinaryAssetContext: {
|
|
39
|
+
type: 'object'
|
|
40
|
+
name: 'cloudinary.assetContext'
|
|
41
|
+
} & Omit<ObjectDefinition, 'preview'> & {
|
|
42
|
+
preview?: PreviewConfig<Record<string, string>, Record<never, any>> | undefined
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export declare type CloudinaryAssetContextCustom = {
|
|
46
|
+
alt: string
|
|
47
|
+
caption: string
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export declare const cloudinaryAssetContextCustom: {
|
|
51
|
+
type: 'object'
|
|
52
|
+
name: 'cloudinary.assetContextCustom'
|
|
53
|
+
} & Omit<ObjectDefinition, 'preview'> & {
|
|
54
|
+
preview?: PreviewConfig<Record<string, string>, Record<never, any>> | undefined
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export declare type CloudinaryAssetDerived = {
|
|
58
|
+
raw_transformation: string
|
|
59
|
+
url: string
|
|
60
|
+
secure_url: string
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export declare const cloudinaryAssetDerivedSchema: {
|
|
64
|
+
type: 'object'
|
|
65
|
+
name: 'cloudinary.assetDerived'
|
|
66
|
+
} & Omit<ObjectDefinition, 'preview'> & {
|
|
67
|
+
preview?: PreviewConfig<Record<string, string>, Record<never, any>> | undefined
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export declare const cloudinaryAssetSchema: {
|
|
71
|
+
type: 'object'
|
|
72
|
+
name: 'cloudinary.asset'
|
|
73
|
+
} & Omit<ObjectDefinition, 'preview'> & {
|
|
74
|
+
preview?:
|
|
75
|
+
| PreviewConfig<
|
|
76
|
+
{
|
|
77
|
+
url: string
|
|
78
|
+
resource_type: string
|
|
79
|
+
derived: string
|
|
80
|
+
},
|
|
81
|
+
Record<'url' | 'derived' | 'resource_type', any>
|
|
82
|
+
>
|
|
83
|
+
| undefined
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export declare const cloudinaryAssetSourcePlugin: Plugin_2<void>
|
|
87
|
+
|
|
88
|
+
export declare const cloudinaryImageSource: AssetSource
|
|
89
|
+
|
|
90
|
+
export declare const cloudinarySchemaPlugin: Plugin_2<void>
|
|
91
|
+
|
|
92
|
+
export {}
|