@rubixstudios/payload-media 1.0.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 +22 -0
- package/README.md +73 -0
- package/dist/components/media-search/index.d.ts +4 -0
- package/dist/components/media-search/index.d.ts.map +1 -0
- package/dist/components/media-search/index.js +31 -0
- package/dist/components/search-drawer/filters/pexels.d.ts +11 -0
- package/dist/components/search-drawer/filters/pexels.d.ts.map +1 -0
- package/dist/components/search-drawer/filters/pexels.js +48 -0
- package/dist/components/search-drawer/filters/pixabay.d.ts +11 -0
- package/dist/components/search-drawer/filters/pixabay.d.ts.map +1 -0
- package/dist/components/search-drawer/filters/pixabay.js +74 -0
- package/dist/components/search-drawer/filters/unsplash.d.ts +10 -0
- package/dist/components/search-drawer/filters/unsplash.d.ts.map +1 -0
- package/dist/components/search-drawer/filters/unsplash.js +35 -0
- package/dist/components/search-drawer/index.d.ts +9 -0
- package/dist/components/search-drawer/index.d.ts.map +1 -0
- package/dist/components/search-drawer/index.js +306 -0
- package/dist/components/search-drawer/media/heart.d.ts +3 -0
- package/dist/components/search-drawer/media/heart.d.ts.map +1 -0
- package/dist/components/search-drawer/media/heart.js +12 -0
- package/dist/components/search-drawer/media/image.d.ts +10 -0
- package/dist/components/search-drawer/media/image.d.ts.map +1 -0
- package/dist/components/search-drawer/media/image.js +58 -0
- package/dist/components/search-drawer/media/video.d.ts +9 -0
- package/dist/components/search-drawer/media/video.d.ts.map +1 -0
- package/dist/components/search-drawer/media/video.js +55 -0
- package/dist/components/search-drawer/style.css +1 -0
- package/dist/defaults.d.ts +3 -0
- package/dist/defaults.d.ts.map +1 -0
- package/dist/defaults.js +8 -0
- package/dist/endpoints/handler/pexels.d.ts +12 -0
- package/dist/endpoints/handler/pexels.d.ts.map +1 -0
- package/dist/endpoints/handler/pexels.js +105 -0
- package/dist/endpoints/handler/pixabay.d.ts +12 -0
- package/dist/endpoints/handler/pixabay.d.ts.map +1 -0
- package/dist/endpoints/handler/pixabay.js +112 -0
- package/dist/endpoints/handler/provider.d.ts +20 -0
- package/dist/endpoints/handler/provider.d.ts.map +1 -0
- package/dist/endpoints/handler/provider.js +53 -0
- package/dist/endpoints/handler/unsplash.d.ts +12 -0
- package/dist/endpoints/handler/unsplash.d.ts.map +1 -0
- package/dist/endpoints/handler/unsplash.js +82 -0
- package/dist/endpoints/index.d.ts +3 -0
- package/dist/endpoints/index.d.ts.map +1 -0
- package/dist/endpoints/index.js +131 -0
- package/dist/exports/client.d.ts +2 -0
- package/dist/exports/client.d.ts.map +1 -0
- package/dist/exports/client.js +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +48 -0
- package/dist/lib/cache.d.ts +7 -0
- package/dist/lib/cache.d.ts.map +1 -0
- package/dist/lib/cache.js +34 -0
- package/dist/types.d.ts +262 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +336 -0
- package/dist/utils/fetchCache.d.ts +2 -0
- package/dist/utils/fetchCache.d.ts.map +1 -0
- package/dist/utils/fetchCache.js +20 -0
- package/dist/utils/getMediaType.d.ts +2 -0
- package/dist/utils/getMediaType.d.ts.map +1 -0
- package/dist/utils/getMediaType.js +4 -0
- package/dist/utils/getProvider.d.ts +6 -0
- package/dist/utils/getProvider.d.ts.map +1 -0
- package/dist/utils/getProvider.js +16 -0
- package/dist/utils/getProviders.d.ts +6 -0
- package/dist/utils/getProviders.d.ts.map +1 -0
- package/dist/utils/getProviders.js +10 -0
- package/dist/utils/requireAccess.d.ts +3 -0
- package/dist/utils/requireAccess.d.ts.map +1 -0
- package/dist/utils/requireAccess.js +13 -0
- package/dist/utils/resolveProvider.d.ts +6 -0
- package/dist/utils/resolveProvider.d.ts.map +1 -0
- package/dist/utils/resolveProvider.js +5 -0
- package/package.json +96 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { getMediaType } from '../utils/getMediaType.js';
|
|
2
|
+
import { getProviders } from '../utils/getProviders.js';
|
|
3
|
+
import { requireAccess } from '../utils/requireAccess.js';
|
|
4
|
+
import { resolveProvider } from '../utils/resolveProvider.js';
|
|
5
|
+
export const providers = [
|
|
6
|
+
{
|
|
7
|
+
path: '/providers',
|
|
8
|
+
method: 'get',
|
|
9
|
+
handler: async (req)=>{
|
|
10
|
+
const denied = await requireAccess(req);
|
|
11
|
+
if (denied) return denied;
|
|
12
|
+
const providerKeys = req.payload?.config?.custom?.providerKeys;
|
|
13
|
+
const providers = getProviders(providerKeys).map((p)=>({
|
|
14
|
+
name: p.name,
|
|
15
|
+
key: p.key
|
|
16
|
+
}));
|
|
17
|
+
return Response.json({
|
|
18
|
+
data: providers,
|
|
19
|
+
error: null
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
path: '/providers/:provider/featured',
|
|
25
|
+
method: 'get',
|
|
26
|
+
handler: async (req)=>{
|
|
27
|
+
const denied = await requireAccess(req);
|
|
28
|
+
if (denied) return denied;
|
|
29
|
+
const provider = resolveProvider(req);
|
|
30
|
+
if (!provider) {
|
|
31
|
+
return Response.json({
|
|
32
|
+
data: null,
|
|
33
|
+
error: 'Provider not supported.'
|
|
34
|
+
}, {
|
|
35
|
+
status: 404
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
if (!provider.isConfigured) {
|
|
39
|
+
return Response.json({
|
|
40
|
+
data: null,
|
|
41
|
+
error: 'Provider not configured.'
|
|
42
|
+
}, {
|
|
43
|
+
status: 500
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
const data = await provider.getFeatured({
|
|
47
|
+
category: req.query.category,
|
|
48
|
+
color: req.query.color,
|
|
49
|
+
colors: req.query.colors,
|
|
50
|
+
image_type: req.query.image_type,
|
|
51
|
+
order: req.query.order,
|
|
52
|
+
orientation: req.query.orientation,
|
|
53
|
+
size: req.query.size,
|
|
54
|
+
media: getMediaType(req.query.media)
|
|
55
|
+
});
|
|
56
|
+
return Response.json({
|
|
57
|
+
data,
|
|
58
|
+
error: null
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
path: '/providers/:provider/search',
|
|
64
|
+
method: 'get',
|
|
65
|
+
handler: async (req)=>{
|
|
66
|
+
const denied = await requireAccess(req);
|
|
67
|
+
if (denied) return denied;
|
|
68
|
+
const provider = resolveProvider(req);
|
|
69
|
+
if (!provider) {
|
|
70
|
+
return Response.json({
|
|
71
|
+
data: null,
|
|
72
|
+
error: 'Provider not supported.'
|
|
73
|
+
}, {
|
|
74
|
+
status: 404
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
if (!provider.isConfigured) {
|
|
78
|
+
return Response.json({
|
|
79
|
+
data: null,
|
|
80
|
+
error: 'Provider not configured.'
|
|
81
|
+
}, {
|
|
82
|
+
status: 500
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
const data = await provider.getSearch(req.query.query, Number(req.query.page ?? 1), {
|
|
86
|
+
category: req.query.category,
|
|
87
|
+
color: req.query.color,
|
|
88
|
+
colors: req.query.colors,
|
|
89
|
+
image_type: req.query.image_type,
|
|
90
|
+
order: req.query.order,
|
|
91
|
+
orientation: req.query.orientation,
|
|
92
|
+
size: req.query.size,
|
|
93
|
+
media: getMediaType(req.query.media)
|
|
94
|
+
});
|
|
95
|
+
return Response.json({
|
|
96
|
+
data,
|
|
97
|
+
error: null
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
path: '/providers/:provider/track-download',
|
|
103
|
+
method: 'get',
|
|
104
|
+
handler: async (req)=>{
|
|
105
|
+
const denied = await requireAccess(req);
|
|
106
|
+
if (denied) return denied;
|
|
107
|
+
const provider = resolveProvider(req);
|
|
108
|
+
if (!provider) {
|
|
109
|
+
return Response.json({
|
|
110
|
+
data: null,
|
|
111
|
+
error: 'Provider not supported.'
|
|
112
|
+
}, {
|
|
113
|
+
status: 404
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
if (!provider.isConfigured) {
|
|
117
|
+
return Response.json({
|
|
118
|
+
data: null,
|
|
119
|
+
error: 'Provider not configured.'
|
|
120
|
+
}, {
|
|
121
|
+
status: 500
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
const data = provider.trackDownload(req.query.url);
|
|
125
|
+
return Response.json({
|
|
126
|
+
data,
|
|
127
|
+
error: null
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/exports/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MediaSearch } from '../components/media-search/index.js';
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,SAAS,CAAA;AAIrC,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,YAAY,CAAA;AAEhD,eAAO,MAAM,WAAW,GACrB,eAAc,cAAmB,MACjC,gBAAgB,MAAM,KAAG,MAiDzB,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { defaultPluginOptions } from './defaults.js';
|
|
2
|
+
import { providers } from './endpoints/index.js';
|
|
3
|
+
export const imagePlugin = (pluginConfig = {})=>(incomingConfig)=>{
|
|
4
|
+
if (pluginConfig.disabled) return incomingConfig;
|
|
5
|
+
const mergedOptions = {
|
|
6
|
+
...defaultPluginOptions,
|
|
7
|
+
...pluginConfig
|
|
8
|
+
};
|
|
9
|
+
const settings = {
|
|
10
|
+
...incomingConfig
|
|
11
|
+
};
|
|
12
|
+
settings.custom = {
|
|
13
|
+
...settings.custom || {},
|
|
14
|
+
providerAccess: mergedOptions.access,
|
|
15
|
+
providerKeys: {
|
|
16
|
+
pexels: mergedOptions.pexels,
|
|
17
|
+
unsplash: mergedOptions.unsplash,
|
|
18
|
+
pixabay: mergedOptions.pixabay
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
settings.collections = (settings.collections || []).map((collection)=>{
|
|
22
|
+
const upload = collection.upload;
|
|
23
|
+
if (!upload) return collection;
|
|
24
|
+
const uploadObj = upload === true ? {} : typeof upload === 'object' ? upload : undefined;
|
|
25
|
+
const modifiedCollection = {
|
|
26
|
+
...collection,
|
|
27
|
+
upload: {
|
|
28
|
+
...uploadObj || {},
|
|
29
|
+
admin: {
|
|
30
|
+
...uploadObj?.admin || {},
|
|
31
|
+
components: {
|
|
32
|
+
...uploadObj?.admin?.components || {},
|
|
33
|
+
controls: [
|
|
34
|
+
...uploadObj?.admin?.components?.controls || [],
|
|
35
|
+
'@rubixstudios/payload-images/client#MediaSearch'
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
return modifiedCollection;
|
|
42
|
+
});
|
|
43
|
+
settings.endpoints = [
|
|
44
|
+
...settings.endpoints || [],
|
|
45
|
+
...providers
|
|
46
|
+
];
|
|
47
|
+
return settings;
|
|
48
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/lib/cache.ts"],"names":[],"mappings":"AAEA,qBAAa,YAAY;IACvB,OAAO,CAAC,eAAe;IAIvB,MAAM,CAAC,KAAK,EAAE,MAAM;IAKpB,GAAG,CAAC,KAAK,EAAE,MAAM;IAsBjB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI;CAWtD"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const VERSION = '2';
|
|
2
|
+
export class CacheManager {
|
|
3
|
+
getVersionedKey(query) {
|
|
4
|
+
return `${VERSION}${query}`;
|
|
5
|
+
}
|
|
6
|
+
exists(query) {
|
|
7
|
+
const key = this.getVersionedKey(query);
|
|
8
|
+
return localStorage.getItem(key) !== null;
|
|
9
|
+
}
|
|
10
|
+
get(query) {
|
|
11
|
+
const key = this.getVersionedKey(query);
|
|
12
|
+
const itemStr = localStorage.getItem(key);
|
|
13
|
+
if (!itemStr) return null;
|
|
14
|
+
let item;
|
|
15
|
+
try {
|
|
16
|
+
item = JSON.parse(itemStr);
|
|
17
|
+
} catch {
|
|
18
|
+
localStorage.removeItem(key);
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
if (item.expiry && Date.now() > item.expiry) {
|
|
22
|
+
localStorage.removeItem(key);
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
return item.value;
|
|
26
|
+
}
|
|
27
|
+
set(query, data, ttl) {
|
|
28
|
+
const key = this.getVersionedKey(query);
|
|
29
|
+
localStorage.setItem(key, JSON.stringify({
|
|
30
|
+
value: data,
|
|
31
|
+
expiry: ttl ? Date.now() + ttl : undefined
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import { type Access } from 'payload';
|
|
2
|
+
export type MediaOption = {
|
|
3
|
+
label: string;
|
|
4
|
+
value: 'image' | 'video';
|
|
5
|
+
};
|
|
6
|
+
export declare const MediaOptions: MediaOption[];
|
|
7
|
+
export interface OpenverseResponse {
|
|
8
|
+
result_count: number;
|
|
9
|
+
page_count: number;
|
|
10
|
+
page_size: number;
|
|
11
|
+
page: number;
|
|
12
|
+
results: OpenverseResult[];
|
|
13
|
+
}
|
|
14
|
+
export interface OpenverseResult {
|
|
15
|
+
id: string;
|
|
16
|
+
title: string | null;
|
|
17
|
+
width: number;
|
|
18
|
+
height: number;
|
|
19
|
+
thumbnail: string;
|
|
20
|
+
url: string;
|
|
21
|
+
background_color?: string | null;
|
|
22
|
+
creator: string | null;
|
|
23
|
+
creator_url: string | null;
|
|
24
|
+
foreign_landing_url: string | null;
|
|
25
|
+
source: string;
|
|
26
|
+
}
|
|
27
|
+
export declare const PexelsColours: {
|
|
28
|
+
label: string;
|
|
29
|
+
value: string;
|
|
30
|
+
}[];
|
|
31
|
+
export type PexelsFilters = {
|
|
32
|
+
orientation?: string;
|
|
33
|
+
size?: string;
|
|
34
|
+
media?: 'image' | 'video';
|
|
35
|
+
color?: string;
|
|
36
|
+
};
|
|
37
|
+
export declare const PexelsOrientation: {
|
|
38
|
+
label: string;
|
|
39
|
+
value: string;
|
|
40
|
+
}[];
|
|
41
|
+
export declare const PexelsSize: {
|
|
42
|
+
label: string;
|
|
43
|
+
value: string;
|
|
44
|
+
}[];
|
|
45
|
+
interface PexelsVideoUser {
|
|
46
|
+
id: number;
|
|
47
|
+
name: string;
|
|
48
|
+
url: string;
|
|
49
|
+
}
|
|
50
|
+
interface PexelsVideoFile {
|
|
51
|
+
id: number;
|
|
52
|
+
quality: 'hd' | 'sd';
|
|
53
|
+
file_type: string;
|
|
54
|
+
width: number;
|
|
55
|
+
height: number;
|
|
56
|
+
fps: number;
|
|
57
|
+
link: string;
|
|
58
|
+
}
|
|
59
|
+
interface PexelsVideoPicture {
|
|
60
|
+
id: number;
|
|
61
|
+
picture: string;
|
|
62
|
+
nr: number;
|
|
63
|
+
}
|
|
64
|
+
export interface PexelsVideo {
|
|
65
|
+
id: number;
|
|
66
|
+
width: number;
|
|
67
|
+
height: number;
|
|
68
|
+
url: string;
|
|
69
|
+
image: string;
|
|
70
|
+
duration: number;
|
|
71
|
+
user: PexelsVideoUser;
|
|
72
|
+
video_files: PexelsVideoFile[];
|
|
73
|
+
video_pictures: PexelsVideoPicture[];
|
|
74
|
+
}
|
|
75
|
+
export interface PexelsVideoResponse {
|
|
76
|
+
page: number;
|
|
77
|
+
per_page: number;
|
|
78
|
+
total_results: number;
|
|
79
|
+
url: string;
|
|
80
|
+
videos: PexelsVideo[];
|
|
81
|
+
}
|
|
82
|
+
export declare const PexelsVideoSize: {
|
|
83
|
+
label: string;
|
|
84
|
+
value: string;
|
|
85
|
+
}[];
|
|
86
|
+
export interface PexelsResult {
|
|
87
|
+
id: string;
|
|
88
|
+
alt: string;
|
|
89
|
+
width: number;
|
|
90
|
+
height: number;
|
|
91
|
+
avg_color: string;
|
|
92
|
+
url: string;
|
|
93
|
+
src: {
|
|
94
|
+
medium: string;
|
|
95
|
+
original: string;
|
|
96
|
+
};
|
|
97
|
+
photographer: string;
|
|
98
|
+
photographer_url: string;
|
|
99
|
+
}
|
|
100
|
+
export declare const PixabayCategories: {
|
|
101
|
+
label: string;
|
|
102
|
+
value: string;
|
|
103
|
+
}[];
|
|
104
|
+
export declare const PixabayColours: {
|
|
105
|
+
label: string;
|
|
106
|
+
value: string;
|
|
107
|
+
}[];
|
|
108
|
+
export type PixabayFilters = {
|
|
109
|
+
image_type?: string;
|
|
110
|
+
orientation?: string;
|
|
111
|
+
category?: string;
|
|
112
|
+
colors?: string;
|
|
113
|
+
order?: string;
|
|
114
|
+
media?: 'image' | 'video';
|
|
115
|
+
};
|
|
116
|
+
export declare const PixabayImageType: {
|
|
117
|
+
label: string;
|
|
118
|
+
value: string;
|
|
119
|
+
}[];
|
|
120
|
+
export declare const PixabayOrder: {
|
|
121
|
+
label: string;
|
|
122
|
+
value: string;
|
|
123
|
+
}[];
|
|
124
|
+
export declare const PixabayOrientation: {
|
|
125
|
+
label: string;
|
|
126
|
+
value: string;
|
|
127
|
+
}[];
|
|
128
|
+
export interface PixabayResult {
|
|
129
|
+
id: string;
|
|
130
|
+
imageWidth: number;
|
|
131
|
+
imageHeight: number;
|
|
132
|
+
webformatURL: string;
|
|
133
|
+
largeImageURL: string;
|
|
134
|
+
likes: number;
|
|
135
|
+
imageURL: string;
|
|
136
|
+
user: string;
|
|
137
|
+
user_id: number;
|
|
138
|
+
userImageURL: string;
|
|
139
|
+
}
|
|
140
|
+
interface PixabayVideoFormat {
|
|
141
|
+
url: string;
|
|
142
|
+
width: number;
|
|
143
|
+
height: number;
|
|
144
|
+
size: number;
|
|
145
|
+
thumbnail: string;
|
|
146
|
+
}
|
|
147
|
+
interface PixabayVideoFormats {
|
|
148
|
+
large: PixabayVideoFormat;
|
|
149
|
+
medium: PixabayVideoFormat;
|
|
150
|
+
small: PixabayVideoFormat;
|
|
151
|
+
tiny: PixabayVideoFormat;
|
|
152
|
+
}
|
|
153
|
+
export interface PixabayVideo {
|
|
154
|
+
id: number;
|
|
155
|
+
pageURL: string;
|
|
156
|
+
type?: string;
|
|
157
|
+
tags?: string;
|
|
158
|
+
duration?: number;
|
|
159
|
+
videos: PixabayVideoFormats;
|
|
160
|
+
views: number;
|
|
161
|
+
downloads: number;
|
|
162
|
+
likes: number;
|
|
163
|
+
comments: number;
|
|
164
|
+
user_id: number;
|
|
165
|
+
user: string;
|
|
166
|
+
userImageURL: string;
|
|
167
|
+
}
|
|
168
|
+
export interface PixabayVideoResponse {
|
|
169
|
+
total: number;
|
|
170
|
+
totalHits: number;
|
|
171
|
+
hits: PixabayVideo[];
|
|
172
|
+
}
|
|
173
|
+
export type ProviderConfig = {
|
|
174
|
+
access?: Access;
|
|
175
|
+
disabled?: boolean;
|
|
176
|
+
openverse?: string;
|
|
177
|
+
pexels?: string;
|
|
178
|
+
pixabay?: string;
|
|
179
|
+
unsplash?: string;
|
|
180
|
+
};
|
|
181
|
+
export type ProviderFilters = {
|
|
182
|
+
provider: 'unsplash';
|
|
183
|
+
options: UnsplashFilters;
|
|
184
|
+
} | {
|
|
185
|
+
provider: 'pexels';
|
|
186
|
+
options: PexelsFilters;
|
|
187
|
+
} | {
|
|
188
|
+
provider: 'pixabay';
|
|
189
|
+
options: PixabayFilters;
|
|
190
|
+
};
|
|
191
|
+
export type ProviderKeys = {
|
|
192
|
+
unsplash?: string;
|
|
193
|
+
openverse?: string;
|
|
194
|
+
pexels?: string;
|
|
195
|
+
pixabay?: string;
|
|
196
|
+
};
|
|
197
|
+
type ProviderKey = 'unsplash' | 'pexels' | 'pixabay';
|
|
198
|
+
export type ProviderOption = {
|
|
199
|
+
label: string;
|
|
200
|
+
value: ProviderKey;
|
|
201
|
+
};
|
|
202
|
+
export interface ProviderResult {
|
|
203
|
+
id: string;
|
|
204
|
+
alt: string;
|
|
205
|
+
width: number;
|
|
206
|
+
height: number;
|
|
207
|
+
color: string;
|
|
208
|
+
likes?: number;
|
|
209
|
+
urls: {
|
|
210
|
+
view: string;
|
|
211
|
+
original: string;
|
|
212
|
+
download: string;
|
|
213
|
+
downloadLocation?: string;
|
|
214
|
+
};
|
|
215
|
+
avatar?: string;
|
|
216
|
+
attribution: {
|
|
217
|
+
name: string;
|
|
218
|
+
link: string;
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
export declare const UnsplashColours: {
|
|
222
|
+
label: string;
|
|
223
|
+
value: string;
|
|
224
|
+
}[];
|
|
225
|
+
export type UnsplashFilters = {
|
|
226
|
+
color?: string;
|
|
227
|
+
orientation?: string;
|
|
228
|
+
media?: 'image' | 'video';
|
|
229
|
+
};
|
|
230
|
+
export declare const UnsplashOrientation: {
|
|
231
|
+
label: string;
|
|
232
|
+
value: string;
|
|
233
|
+
}[];
|
|
234
|
+
export interface UnsplashResult {
|
|
235
|
+
id: string;
|
|
236
|
+
alt_description: string;
|
|
237
|
+
width: number;
|
|
238
|
+
height: number;
|
|
239
|
+
color: string;
|
|
240
|
+
likes?: number;
|
|
241
|
+
urls: {
|
|
242
|
+
thumb: string;
|
|
243
|
+
full: string;
|
|
244
|
+
};
|
|
245
|
+
links: {
|
|
246
|
+
download: string;
|
|
247
|
+
download_location: string;
|
|
248
|
+
};
|
|
249
|
+
user: {
|
|
250
|
+
name: string;
|
|
251
|
+
profile_image?: {
|
|
252
|
+
small: string;
|
|
253
|
+
medium: string;
|
|
254
|
+
large: string;
|
|
255
|
+
};
|
|
256
|
+
links: {
|
|
257
|
+
html: string;
|
|
258
|
+
};
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
export {};
|
|
262
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,SAAS,CAAA;AAErC,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,OAAO,GAAG,OAAO,CAAA;CACzB,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,WAAW,EAGrC,CAAA;AAED,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,MAAM,CAAA;IACpB,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,eAAe,EAAE,CAAA;CAC3B;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,GAAG,EAAE,MAAM,CAAA;IACX,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAEhC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAA;IAElC,MAAM,EAAE,MAAM,CAAA;CACf;AAED,eAAO,MAAM,aAAa;;;GAazB,CAAA;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,OAAO,GAAG,OAAO,CAAA;IACzB,KAAK,CAAC,EAA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