@rajeev02/camera 0.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/lib/capture/index.d.ts +180 -0
- package/lib/capture/index.d.ts.map +1 -0
- package/lib/capture/index.js +190 -0
- package/lib/capture/index.js.map +1 -0
- package/lib/filters/index.d.ts +40 -0
- package/lib/filters/index.d.ts.map +1 -0
- package/lib/filters/index.js +281 -0
- package/lib/filters/index.js.map +1 -0
- package/lib/index.d.ts +15 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +24 -0
- package/lib/index.js.map +1 -0
- package/lib/photo-editor/index.d.ts +185 -0
- package/lib/photo-editor/index.d.ts.map +1 -0
- package/lib/photo-editor/index.js +279 -0
- package/lib/photo-editor/index.js.map +1 -0
- package/package.json +51 -0
- package/src/capture/index.ts +334 -0
- package/src/filters/index.ts +327 -0
- package/src/index.ts +47 -0
- package/src/photo-editor/index.ts +451 -0
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @rajeev02/camera — Photo Filters
|
|
3
|
+
* Preset filters (Instagram/Snapchat style) with adjustable intensity
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export interface PhotoFilter {
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
category: FilterCategory;
|
|
10
|
+
/** Thumbnail preview URI */
|
|
11
|
+
thumbnail?: string;
|
|
12
|
+
/** Adjustment values this filter applies */
|
|
13
|
+
adjustments: Partial<FilterAdjustments>;
|
|
14
|
+
/** Whether this is a premium filter */
|
|
15
|
+
premium: boolean;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type FilterCategory =
|
|
19
|
+
| "natural"
|
|
20
|
+
| "warm"
|
|
21
|
+
| "cool"
|
|
22
|
+
| "vintage"
|
|
23
|
+
| "dramatic"
|
|
24
|
+
| "bw"
|
|
25
|
+
| "film"
|
|
26
|
+
| "portrait"
|
|
27
|
+
| "food"
|
|
28
|
+
| "landscape"
|
|
29
|
+
| "night"
|
|
30
|
+
| "artistic";
|
|
31
|
+
|
|
32
|
+
export interface FilterAdjustments {
|
|
33
|
+
brightness: number;
|
|
34
|
+
contrast: number;
|
|
35
|
+
saturation: number;
|
|
36
|
+
warmth: number;
|
|
37
|
+
tint: number;
|
|
38
|
+
highlights: number;
|
|
39
|
+
shadows: number;
|
|
40
|
+
sharpness: number;
|
|
41
|
+
grain: number;
|
|
42
|
+
vignette: number;
|
|
43
|
+
fadeAmount: number;
|
|
44
|
+
hue: number;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Built-in filter presets */
|
|
48
|
+
export function getBuiltInFilters(): PhotoFilter[] {
|
|
49
|
+
return [
|
|
50
|
+
// Natural
|
|
51
|
+
{
|
|
52
|
+
id: "original",
|
|
53
|
+
name: "Original",
|
|
54
|
+
category: "natural",
|
|
55
|
+
premium: false,
|
|
56
|
+
adjustments: {},
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
id: "vivid",
|
|
60
|
+
name: "Vivid",
|
|
61
|
+
category: "natural",
|
|
62
|
+
premium: false,
|
|
63
|
+
adjustments: { saturation: 30, contrast: 15, sharpness: 10 },
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
id: "natural_boost",
|
|
67
|
+
name: "Natural+",
|
|
68
|
+
category: "natural",
|
|
69
|
+
premium: false,
|
|
70
|
+
adjustments: { brightness: 5, saturation: 15, shadows: 10, sharpness: 8 },
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
// Warm
|
|
74
|
+
{
|
|
75
|
+
id: "golden_hour",
|
|
76
|
+
name: "Golden Hour",
|
|
77
|
+
category: "warm",
|
|
78
|
+
premium: false,
|
|
79
|
+
adjustments: {
|
|
80
|
+
warmth: 35,
|
|
81
|
+
brightness: 10,
|
|
82
|
+
saturation: 20,
|
|
83
|
+
highlights: 15,
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
id: "sunset",
|
|
88
|
+
name: "Sunset",
|
|
89
|
+
category: "warm",
|
|
90
|
+
premium: false,
|
|
91
|
+
adjustments: { warmth: 50, saturation: 25, contrast: 10, vignette: 15 },
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
id: "honey",
|
|
95
|
+
name: "Honey",
|
|
96
|
+
category: "warm",
|
|
97
|
+
premium: false,
|
|
98
|
+
adjustments: { warmth: 40, brightness: 8, fadeAmount: 10 },
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
// Cool
|
|
102
|
+
{
|
|
103
|
+
id: "arctic",
|
|
104
|
+
name: "Arctic",
|
|
105
|
+
category: "cool",
|
|
106
|
+
premium: false,
|
|
107
|
+
adjustments: {
|
|
108
|
+
warmth: -30,
|
|
109
|
+
brightness: 10,
|
|
110
|
+
contrast: 15,
|
|
111
|
+
saturation: -10,
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
id: "ocean",
|
|
116
|
+
name: "Ocean",
|
|
117
|
+
category: "cool",
|
|
118
|
+
premium: false,
|
|
119
|
+
adjustments: { warmth: -20, tint: -10, saturation: 15, shadows: -10 },
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
id: "moonlight",
|
|
123
|
+
name: "Moonlight",
|
|
124
|
+
category: "cool",
|
|
125
|
+
premium: false,
|
|
126
|
+
adjustments: { warmth: -25, brightness: -5, contrast: 20, vignette: 20 },
|
|
127
|
+
},
|
|
128
|
+
|
|
129
|
+
// Vintage
|
|
130
|
+
{
|
|
131
|
+
id: "retro",
|
|
132
|
+
name: "Retro",
|
|
133
|
+
category: "vintage",
|
|
134
|
+
premium: false,
|
|
135
|
+
adjustments: {
|
|
136
|
+
warmth: 20,
|
|
137
|
+
fadeAmount: 25,
|
|
138
|
+
grain: 20,
|
|
139
|
+
saturation: -15,
|
|
140
|
+
contrast: 15,
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
id: "polaroid",
|
|
145
|
+
name: "Polaroid",
|
|
146
|
+
category: "vintage",
|
|
147
|
+
premium: false,
|
|
148
|
+
adjustments: { warmth: 15, fadeAmount: 20, brightness: 10, vignette: 10 },
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
id: "sepia",
|
|
152
|
+
name: "Sepia",
|
|
153
|
+
category: "vintage",
|
|
154
|
+
premium: false,
|
|
155
|
+
adjustments: {
|
|
156
|
+
warmth: 40,
|
|
157
|
+
saturation: -60,
|
|
158
|
+
fadeAmount: 15,
|
|
159
|
+
contrast: 10,
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
id: "film_70s",
|
|
164
|
+
name: "70s Film",
|
|
165
|
+
category: "vintage",
|
|
166
|
+
premium: false,
|
|
167
|
+
adjustments: {
|
|
168
|
+
warmth: 25,
|
|
169
|
+
grain: 30,
|
|
170
|
+
fadeAmount: 20,
|
|
171
|
+
saturation: -10,
|
|
172
|
+
vignette: 25,
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
|
|
176
|
+
// Black & White
|
|
177
|
+
{
|
|
178
|
+
id: "bw_classic",
|
|
179
|
+
name: "B&W Classic",
|
|
180
|
+
category: "bw",
|
|
181
|
+
premium: false,
|
|
182
|
+
adjustments: { saturation: -100, contrast: 20, sharpness: 15 },
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
id: "bw_high_contrast",
|
|
186
|
+
name: "B&W Drama",
|
|
187
|
+
category: "bw",
|
|
188
|
+
premium: false,
|
|
189
|
+
adjustments: {
|
|
190
|
+
saturation: -100,
|
|
191
|
+
contrast: 50,
|
|
192
|
+
shadows: -20,
|
|
193
|
+
highlights: 20,
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
id: "bw_film_noir",
|
|
198
|
+
name: "Film Noir",
|
|
199
|
+
category: "bw",
|
|
200
|
+
premium: false,
|
|
201
|
+
adjustments: { saturation: -100, contrast: 40, vignette: 40, grain: 15 },
|
|
202
|
+
},
|
|
203
|
+
|
|
204
|
+
// Dramatic
|
|
205
|
+
{
|
|
206
|
+
id: "hdr",
|
|
207
|
+
name: "HDR",
|
|
208
|
+
category: "dramatic",
|
|
209
|
+
premium: false,
|
|
210
|
+
adjustments: {
|
|
211
|
+
contrast: 30,
|
|
212
|
+
highlights: -20,
|
|
213
|
+
shadows: 30,
|
|
214
|
+
sharpness: 25,
|
|
215
|
+
saturation: 15,
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
id: "moody",
|
|
220
|
+
name: "Moody",
|
|
221
|
+
category: "dramatic",
|
|
222
|
+
premium: false,
|
|
223
|
+
adjustments: {
|
|
224
|
+
contrast: 20,
|
|
225
|
+
brightness: -10,
|
|
226
|
+
saturation: -10,
|
|
227
|
+
vignette: 30,
|
|
228
|
+
tint: 5,
|
|
229
|
+
},
|
|
230
|
+
},
|
|
231
|
+
|
|
232
|
+
// Food
|
|
233
|
+
{
|
|
234
|
+
id: "foodie",
|
|
235
|
+
name: "Foodie",
|
|
236
|
+
category: "food",
|
|
237
|
+
premium: false,
|
|
238
|
+
adjustments: {
|
|
239
|
+
warmth: 15,
|
|
240
|
+
saturation: 25,
|
|
241
|
+
brightness: 10,
|
|
242
|
+
sharpness: 10,
|
|
243
|
+
vignette: 5,
|
|
244
|
+
},
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
id: "fresh",
|
|
248
|
+
name: "Fresh",
|
|
249
|
+
category: "food",
|
|
250
|
+
premium: false,
|
|
251
|
+
adjustments: {
|
|
252
|
+
saturation: 20,
|
|
253
|
+
brightness: 15,
|
|
254
|
+
warmth: 5,
|
|
255
|
+
contrast: 10,
|
|
256
|
+
sharpness: 12,
|
|
257
|
+
},
|
|
258
|
+
},
|
|
259
|
+
|
|
260
|
+
// Portrait
|
|
261
|
+
{
|
|
262
|
+
id: "glow",
|
|
263
|
+
name: "Glow",
|
|
264
|
+
category: "portrait",
|
|
265
|
+
premium: false,
|
|
266
|
+
adjustments: {
|
|
267
|
+
brightness: 10,
|
|
268
|
+
warmth: 10,
|
|
269
|
+
highlights: 15,
|
|
270
|
+
sharpness: -5,
|
|
271
|
+
fadeAmount: 8,
|
|
272
|
+
},
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
id: "soft_skin",
|
|
276
|
+
name: "Soft Skin",
|
|
277
|
+
category: "portrait",
|
|
278
|
+
premium: false,
|
|
279
|
+
adjustments: { brightness: 5, warmth: 8, sharpness: -10, contrast: -5 },
|
|
280
|
+
},
|
|
281
|
+
|
|
282
|
+
// Night
|
|
283
|
+
{
|
|
284
|
+
id: "neon",
|
|
285
|
+
name: "Neon",
|
|
286
|
+
category: "night",
|
|
287
|
+
premium: true,
|
|
288
|
+
adjustments: {
|
|
289
|
+
contrast: 30,
|
|
290
|
+
saturation: 40,
|
|
291
|
+
brightness: -10,
|
|
292
|
+
vignette: 20,
|
|
293
|
+
tint: 15,
|
|
294
|
+
},
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
id: "city_lights",
|
|
298
|
+
name: "City Lights",
|
|
299
|
+
category: "night",
|
|
300
|
+
premium: true,
|
|
301
|
+
adjustments: { contrast: 25, warmth: -10, highlights: 20, vignette: 15 },
|
|
302
|
+
},
|
|
303
|
+
];
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/** Get filters by category */
|
|
307
|
+
export function getFiltersByCategory(category: FilterCategory): PhotoFilter[] {
|
|
308
|
+
return getBuiltInFilters().filter((f) => f.category === category);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/** Get all filter categories */
|
|
312
|
+
export function getFilterCategories(): { id: FilterCategory; label: string }[] {
|
|
313
|
+
return [
|
|
314
|
+
{ id: "natural", label: "Natural" },
|
|
315
|
+
{ id: "warm", label: "Warm" },
|
|
316
|
+
{ id: "cool", label: "Cool" },
|
|
317
|
+
{ id: "vintage", label: "Vintage" },
|
|
318
|
+
{ id: "dramatic", label: "Dramatic" },
|
|
319
|
+
{ id: "bw", label: "B&W" },
|
|
320
|
+
{ id: "film", label: "Film" },
|
|
321
|
+
{ id: "portrait", label: "Portrait" },
|
|
322
|
+
{ id: "food", label: "Food" },
|
|
323
|
+
{ id: "landscape", label: "Landscape" },
|
|
324
|
+
{ id: "night", label: "Night" },
|
|
325
|
+
{ id: "artistic", label: "Artistic" },
|
|
326
|
+
];
|
|
327
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @rajeev02/camera
|
|
3
|
+
* Advanced Camera & Photo Editor
|
|
4
|
+
* Capture, filters, crop, adjust, draw, text, stickers, blur, frames, beauty mode
|
|
5
|
+
*
|
|
6
|
+
* @author Rajeev Kumar Joshi
|
|
7
|
+
* @license MIT
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
// Camera Capture
|
|
11
|
+
export { CameraController } from "./capture";
|
|
12
|
+
export type {
|
|
13
|
+
CameraConfig,
|
|
14
|
+
CameraFacing,
|
|
15
|
+
FlashMode,
|
|
16
|
+
CaptureMode,
|
|
17
|
+
AspectRatio,
|
|
18
|
+
GridType,
|
|
19
|
+
VideoResolution,
|
|
20
|
+
CapturedMedia,
|
|
21
|
+
ExifData,
|
|
22
|
+
FocusPoint,
|
|
23
|
+
CameraCapabilities,
|
|
24
|
+
CameraEvent,
|
|
25
|
+
} from "./capture";
|
|
26
|
+
|
|
27
|
+
// Photo Editor
|
|
28
|
+
export { PhotoEditorController, getCropPresets } from "./photo-editor";
|
|
29
|
+
export type {
|
|
30
|
+
EditTool,
|
|
31
|
+
CropPreset,
|
|
32
|
+
AdjustmentValues,
|
|
33
|
+
DrawConfig,
|
|
34
|
+
TextOverlay,
|
|
35
|
+
StickerOverlay,
|
|
36
|
+
BlurRegion,
|
|
37
|
+
FrameConfig,
|
|
38
|
+
EditAction,
|
|
39
|
+
} from "./photo-editor";
|
|
40
|
+
|
|
41
|
+
// Filters
|
|
42
|
+
export {
|
|
43
|
+
getBuiltInFilters,
|
|
44
|
+
getFiltersByCategory,
|
|
45
|
+
getFilterCategories,
|
|
46
|
+
} from "./filters";
|
|
47
|
+
export type { PhotoFilter, FilterCategory, FilterAdjustments } from "./filters";
|