image-beautifier 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.
Files changed (56) hide show
  1. package/.eslintrc.cjs +25 -0
  2. package/LICENSE +21 -0
  3. package/README.md +28 -0
  4. package/favicon.svg +20 -0
  5. package/index.html +13 -0
  6. package/jsconfig.json +12 -0
  7. package/package.json +53 -0
  8. package/postcss.config.mjs +6 -0
  9. package/preview.png +0 -0
  10. package/public/vite.svg +1 -0
  11. package/src/App.jsx +29 -0
  12. package/src/assets/blur.svg +8 -0
  13. package/src/assets/color.svg +1 -0
  14. package/src/assets/demo.png +0 -0
  15. package/src/assets/pencil.png +0 -0
  16. package/src/assets/rotate.png +0 -0
  17. package/src/components/ColorPicker.jsx +27 -0
  18. package/src/components/Icon.jsx +81 -0
  19. package/src/components/editor/Editor.jsx +19 -0
  20. package/src/components/editor/HotKeys.jsx +48 -0
  21. package/src/components/editor/View.jsx +167 -0
  22. package/src/components/editor/Zoom.jsx +54 -0
  23. package/src/components/editor/layers/FrameBox.jsx +51 -0
  24. package/src/components/editor/layers/Screenshot.jsx +89 -0
  25. package/src/components/editor/layers/ShapeLine.jsx +97 -0
  26. package/src/components/editor/layers/Watermark.jsx +41 -0
  27. package/src/components/header/EmojiSelect.jsx +35 -0
  28. package/src/components/header/Header.jsx +134 -0
  29. package/src/components/header/Logo.jsx +29 -0
  30. package/src/components/header/MediaLogo.jsx +10 -0
  31. package/src/components/header/WidthDropdown.jsx +74 -0
  32. package/src/components/init/Init.jsx +77 -0
  33. package/src/components/sideBar/BackgroundSelect.jsx +49 -0
  34. package/src/components/sideBar/CropperImage.jsx +73 -0
  35. package/src/components/sideBar/CustomSize.jsx +60 -0
  36. package/src/components/sideBar/DownloadBar.jsx +179 -0
  37. package/src/components/sideBar/DrawerBar.jsx +64 -0
  38. package/src/components/sideBar/Position.jsx +45 -0
  39. package/src/components/sideBar/SideBar.jsx +131 -0
  40. package/src/components/sideBar/SizeBar.jsx +114 -0
  41. package/src/components/sideBar/Watermark.jsx +59 -0
  42. package/src/hooks/useKeyboardShortcuts.js +28 -0
  43. package/src/hooks/usePaste.js +21 -0
  44. package/src/index.js +1 -0
  45. package/src/main.jsx +9 -0
  46. package/src/stores/editor.js +106 -0
  47. package/src/stores/index.js +7 -0
  48. package/src/stores/option.js +96 -0
  49. package/src/style/main.css +132 -0
  50. package/src/utils/UndoRedoManager.js +83 -0
  51. package/src/utils/backgroundConfig.js +387 -0
  52. package/src/utils/captureScreen.js +28 -0
  53. package/src/utils/sizeConfig.js +163 -0
  54. package/src/utils/utils.js +154 -0
  55. package/tailwind.config.mjs +15 -0
  56. package/vite.config.js +21 -0
@@ -0,0 +1,387 @@
1
+ export default {
2
+ default_1: {
3
+ class: 'bg-gradient-to-r from-indigo-500 via-purple-500 to-pink-500',
4
+ fill: {
5
+ type: 'linear',
6
+ from: 'left',
7
+ to: 'right',
8
+ stops: ['#6366f1', '#a855f7', '#ec4899'],
9
+ },
10
+ },
11
+ default_2: {
12
+ class: 'bg-gradient-to-r from-red-500 via-pink-500 to-violet-500',
13
+ fill: {
14
+ type: 'linear',
15
+ from: 'left',
16
+ to: 'right',
17
+ stops: ['#ef4444', '#ec4899', '#8b5cf6'],
18
+ },
19
+ },
20
+ default_3: {
21
+ class: 'bg-gradient-to-r from-violet-800 via-pink-600 to-orange-500',
22
+ fill: {
23
+ type: 'linear',
24
+ from: 'left',
25
+ to: 'right',
26
+ stops: ['#5b21b6', '#db2777', '#f97316'],
27
+ },
28
+ },
29
+ default_4: {
30
+ class: 'bg-gradient-to-r from-orange-400 to-rose-400',
31
+ fill: {
32
+ type: 'linear',
33
+ from: 'left',
34
+ to: 'right',
35
+ stops: ['#fb923c', '#fb7185'],
36
+ },
37
+ },
38
+ default_5: {
39
+ class: 'bg-gradient-to-r from-[#4284DB] to-[#29EAC4]',
40
+ fill: {
41
+ type: 'linear',
42
+ from: 'left',
43
+ to: 'right',
44
+ stops: ['#4284DB', '#29EAC4'],
45
+ },
46
+ },
47
+ default_6: {
48
+ class: 'bg-gradient-to-r from-[#fc00ff] to-[#00dbde]',
49
+ fill: {
50
+ type: 'linear',
51
+ from: 'left',
52
+ to: 'right',
53
+ stops: ['#fc00ff', '#00dbde'],
54
+ },
55
+ },
56
+ default_7: {
57
+ class: 'bg-gradient-to-br from-[#eeddf3] via-[#ee92b1] to-[#6330b4]',
58
+ fill: {
59
+ type: 'linear',
60
+ from: 'left',
61
+ to: 'right',
62
+ stops: ['#eeddf3', '#ee92b1', '#6330b4'],
63
+ },
64
+ },
65
+ solid_1: {
66
+ class: 'bg-transparent',
67
+ fill: {
68
+ type: 'solid',
69
+ color: '#ffffff00',
70
+ },
71
+ },
72
+ solid_2: {
73
+ class: 'bg-slate-400',
74
+ fill: {
75
+ type: 'solid',
76
+ color: '#94a3b8',
77
+ },
78
+ },
79
+ solid_3: {
80
+ class: 'bg-gray-400',
81
+ fill: {
82
+ type: 'solid',
83
+ color: '#9ca3af',
84
+ },
85
+ },
86
+ solid_4: {
87
+ class: 'bg-stone-400',
88
+ fill: {
89
+ type: 'solid',
90
+ color: '#a8a29e',
91
+ },
92
+ },
93
+ solid_5: {
94
+ class: 'bg-red-400',
95
+ fill: {
96
+ type: 'solid',
97
+ color: '#f87171',
98
+ },
99
+ },
100
+ solid_6: {
101
+ class: 'bg-orange-400',
102
+ fill: {
103
+ type: 'solid',
104
+ color: '#fb923c',
105
+ },
106
+ },
107
+ solid_7: {
108
+ class: 'bg-amber-400',
109
+ fill: {
110
+ type: 'solid',
111
+ color: '#facc15',
112
+ },
113
+ },
114
+ solid_8: {
115
+ class: 'bg-yellow-400',
116
+ fill: {
117
+ type: 'solid',
118
+ color: '#fbbf24',
119
+ },
120
+ },
121
+ solid_9: {
122
+ class: 'bg-lime-400',
123
+ fill: {
124
+ type: 'solid',
125
+ color: '#a3e635',
126
+ },
127
+ },
128
+ solid_10: {
129
+ class: 'bg-green-400',
130
+ fill: {
131
+ type: 'solid',
132
+ color: '#4ade80',
133
+ },
134
+ },
135
+ solid_11: {
136
+ class: 'bg-emerald-400',
137
+ fill: {
138
+ type: 'solid',
139
+ color: '#34d399',
140
+ },
141
+ },
142
+ solid_12: {
143
+ class: 'bg-teal-400',
144
+ fill: {
145
+ type: 'solid',
146
+ color: '#2dd4bf',
147
+ },
148
+ },
149
+ solid_13: {
150
+ class: 'bg-cyan-400',
151
+ fill: {
152
+ type: 'solid',
153
+ color: '#22d3ee',
154
+ },
155
+ },
156
+ solid_14: {
157
+ class: 'bg-sky-400',
158
+ fill: {
159
+ type: 'solid',
160
+ color: '#38bdf8',
161
+ },
162
+ },
163
+ solid_15: {
164
+ class: 'bg-blue-400',
165
+ fill: {
166
+ type: 'solid',
167
+ color: '#60a5fa',
168
+ },
169
+ },
170
+ solid_16: {
171
+ class: 'bg-indigo-400',
172
+ fill: {
173
+ type: 'solid',
174
+ color: '#818cf8',
175
+ },
176
+ },
177
+ solid_17: {
178
+ class: 'bg-violet-400',
179
+ fill: {
180
+ type: 'solid',
181
+ color: '#a78bfa',
182
+ },
183
+ },
184
+ solid_18: {
185
+ class: 'bg-purple-400',
186
+ fill: {
187
+ type: 'solid',
188
+ color: '#c084fc',
189
+ },
190
+ },
191
+ solid_19: {
192
+ class: 'bg-fuchsia-400',
193
+ fill: {
194
+ type: 'solid',
195
+ color: '#e879f9',
196
+ },
197
+ },
198
+ solid_20: {
199
+ class: 'bg-pink-400',
200
+ fill: {
201
+ type: 'solid',
202
+ color: '#f472b6',
203
+ },
204
+ },
205
+ solid_21: {
206
+ class: 'bg-rose-400',
207
+ fill: {
208
+ type: 'solid',
209
+ color: '#fb7185',
210
+ },
211
+ },
212
+ gradient_1: {
213
+ class: 'bg-gradient-to-br from-[#ff6432] from-12.8% via-[#ff0065] via-43.52% to-[#7b2eff] to-84.34%',
214
+ fill: {
215
+ type: 'linear',
216
+ from: 'top-left',
217
+ to: 'bottom-right',
218
+ stops: [
219
+ { offset: 0.12, color: '#ff6432' },
220
+ { offset: 0.44, color: '#ff0065' },
221
+ { offset: 0.84, color: '#7b2eff' },
222
+ ],
223
+ },
224
+ },
225
+ gradient_2: {
226
+ class: 'bg-gradient-to-br from-[#69eacb] from-0% via-[#eaccf8] via-48% to-[#6654f1] to-100%',
227
+ fill: {
228
+ type: 'linear',
229
+ from: 'top-left',
230
+ to: 'bottom-right',
231
+ stops: [
232
+ { offset: 0, color: '#69eacb' },
233
+ { offset: 0.48, color: '#eaccf8' },
234
+ { offset: 1, color: '#6654f1' },
235
+ ],
236
+ },
237
+ },
238
+ gradient_3: {
239
+ class: 'bg-gradient-to-br from-[#f9f047] to-[#0fd850]',
240
+ fill: {
241
+ type: 'linear',
242
+ from: 'top-left',
243
+ to: 'bottom-right',
244
+ stops: ['#f9f047', '#0fd850'],
245
+ },
246
+ },
247
+ cosmic_img_1: {
248
+ class: 'https://images.unsplash.com/photo-1579546929518-9e396f3cc809?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTY5OTZ8MHwxfHNlYXJjaHwxfHxncmFkaWVudHxlbnwwfHx8fDE3MDMwNjAzNjh8MA&ixlib=rb-4.0.3&q=80',
249
+ fill: {
250
+ type: 'image',
251
+ url: 'https://images.unsplash.com/photo-1579546929518-9e396f3cc809?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTY5OTZ8MHwxfHNlYXJjaHwxfHxncmFkaWVudHxlbnwwfHx8fDE3MDMwNjAzNjh8MA&ixlib=rb-4.0.3&q=80'
252
+ }
253
+ },
254
+ cosmic_img_2: {
255
+ class: 'https://images.unsplash.com/photo-1604076913837-52ab5629fba9?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTY5OTZ8MHwxfHNlYXJjaHwzfHxncmFkaWVudHxlbnwwfHx8fDE3MDMwNjAzNjh8MA&ixlib=rb-4.0.3&q=80',
256
+ fill: {
257
+ type: 'image',
258
+ url: 'https://images.unsplash.com/photo-1604076913837-52ab5629fba9?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTY5OTZ8MHwxfHNlYXJjaHwzfHxncmFkaWVudHxlbnwwfHx8fDE3MDMwNjAzNjh8MA&ixlib=rb-4.0.3&q=80'
259
+ }
260
+ },
261
+ cosmic_img_3: {
262
+ class: 'https://images.unsplash.com/photo-1553356084-58ef4a67b2a7?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTY5OTZ8MHwxfHNlYXJjaHwxN3x8Z3JhZGllbnR8ZW58MHx8fHwxNzAzMDYwMzY4fDA&ixlib=rb-4.0.3&q=80',
263
+ fill: {
264
+ type: 'image',
265
+ url: 'https://images.unsplash.com/photo-1553356084-58ef4a67b2a7?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTY5OTZ8MHwxfHNlYXJjaHwxN3x8Z3JhZGllbnR8ZW58MHx8fHwxNzAzMDYwMzY4fDA&ixlib=rb-4.0.3&q=80'
266
+ }
267
+ },
268
+ cosmic_img_4: {
269
+ class: 'https://images.unsplash.com/photo-1618397746666-63405ce5d015?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTY5OTZ8MHwxfHNlYXJjaHwyN3x8Z3JhZGllbnR8ZW58MHx8fHwxNzAzMDM3NjcwfDA&ixlib=rb-4.0.3&q=80',
270
+ fill: {
271
+ type: 'image',
272
+ url: 'https://images.unsplash.com/photo-1618397746666-63405ce5d015?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTY5OTZ8MHwxfHNlYXJjaHwyN3x8Z3JhZGllbnR8ZW58MHx8fHwxNzAzMDM3NjcwfDA&ixlib=rb-4.0.3&q=80'
273
+ }
274
+ },
275
+ cosmic_img_5: {
276
+ class: 'https://images.unsplash.com/photo-1579548122080-c35fd6820ecb?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTY5OTZ8MHwxfHNlYXJjaHwzNnx8Z3JhZGllbnR8ZW58MHx8fHwxNzAzMDM3NjcwfDA&ixlib=rb-4.0.3&q=80',
277
+ fill: {
278
+ type: 'image',
279
+ url: 'https://images.unsplash.com/photo-1579548122080-c35fd6820ecb?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTY5OTZ8MHwxfHNlYXJjaHwzNnx8Z3JhZGllbnR8ZW58MHx8fHwxNzAzMDM3NjcwfDA&ixlib=rb-4.0.3&q=80'
280
+ }
281
+ },
282
+ cosmic_img_6: {
283
+ class: 'https://images.unsplash.com/photo-1564951434112-64d74cc2a2d7?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTY5OTZ8MHwxfHNlYXJjaHw0Nnx8Z3JhZGllbnR8ZW58MHx8fHwxNzAzMDMyNzM1fDA&ixlib=rb-4.0.3&q=80',
284
+ fill: {
285
+ type: 'image',
286
+ url: 'https://images.unsplash.com/photo-1564951434112-64d74cc2a2d7?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTY5OTZ8MHwxfHNlYXJjaHw0Nnx8Z3JhZGllbnR8ZW58MHx8fHwxNzAzMDMyNzM1fDA&ixlib=rb-4.0.3&q=80'
287
+ }
288
+ },
289
+ cosmic_img_7: {
290
+ class: 'https://images.unsplash.com/photo-1636990649778-fd699d27c875?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTY5OTZ8MHwxfHNlYXJjaHw1Mnx8Z3JhZGllbnR8ZW58MHx8fHwxNzAzMDMyNzM1fDA&ixlib=rb-4.0.3&q=80',
291
+ fill: {
292
+ type: 'image',
293
+ url: 'https://images.unsplash.com/photo-1636990649778-fd699d27c875?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTY5OTZ8MHwxfHNlYXJjaHw1Mnx8Z3JhZGllbnR8ZW58MHx8fHwxNzAzMDMyNzM1fDA&ixlib=rb-4.0.3&q=80'
294
+ }
295
+ },
296
+ cosmic_img_8: {
297
+ class: 'https://images.unsplash.com/photo-1640177155742-835de7b2a9a0?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTY5OTZ8MHwxfHNlYXJjaHw5MHx8Z3JhZGllbnR8ZW58MHx8fHwxNzAzMDU0Njg3fDA&ixlib=rb-4.0.3&q=80',
298
+ fill: {
299
+ type: 'image',
300
+ url: 'https://images.unsplash.com/photo-1640177155742-835de7b2a9a0?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTY5OTZ8MHwxfHNlYXJjaHw5MHx8Z3JhZGllbnR8ZW58MHx8fHwxNzAzMDU0Njg3fDA&ixlib=rb-4.0.3&q=80'
301
+ }
302
+ },
303
+ cosmic_img_9: {
304
+ class: 'https://images.unsplash.com/photo-1523396206913-a003efa7861b?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTY5OTZ8MHwxfHNlYXJjaHwxMTh8fGdyYWRpZW50fGVufDB8fHx8MTcwMzEyMDMzOHww&ixlib=rb-4.0.3&q=80',
305
+ fill: {
306
+ type: 'image',
307
+ url: 'https://images.unsplash.com/photo-1523396206913-a003efa7861b?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTY5OTZ8MHwxfHNlYXJjaHwxMTh8fGdyYWRpZW50fGVufDB8fHx8MTcwMzEyMDMzOHww&ixlib=rb-4.0.3&q=80'
308
+ }
309
+ },
310
+ cosmic_img_10: {
311
+ class: 'https://images.unsplash.com/photo-1552152370-fb05b25ff17d?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTY5OTZ8MHwxfHNlYXJjaHwxNjJ8fGdyYWRpZW50fGVufDB8fHx8MTcwMzA3ODE5Mnww&ixlib=rb-4.0.3&q=80',
312
+ fill: {
313
+ type: 'image',
314
+ url: 'https://images.unsplash.com/photo-1552152370-fb05b25ff17d?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTY5OTZ8MHwxfHNlYXJjaHwxNjJ8fGdyYWRpZW50fGVufDB8fHx8MTcwMzA3ODE5Mnww&ixlib=rb-4.0.3&q=80'
315
+ }
316
+ },
317
+ cosmic_img_11: {
318
+ class: 'https://images.unsplash.com/photo-1635776063043-ab23b4c226f6?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTY5OTZ8MHwxfHNlYXJjaHwyMjZ8fGdyYWRpZW50fGVufDB8fHx8MTcwMzA4MjI2NHww&ixlib=rb-4.0.3&q=80',
319
+ fill: {
320
+ type: 'image',
321
+ url: 'https://images.unsplash.com/photo-1635776063043-ab23b4c226f6?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTY5OTZ8MHwxfHNlYXJjaHwyMjZ8fGdyYWRpZW50fGVufDB8fHx8MTcwMzA4MjI2NHww&ixlib=rb-4.0.3&q=80'
322
+ }
323
+ },
324
+ cosmic_img_12: {
325
+ class: 'https://images.unsplash.com/photo-1640963269654-3fe248c5fba6?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTY5OTZ8MHwxfHNlYXJjaHwyNTZ8fGdyYWRpZW50fGVufDB8fHx8MTcwMzA4NDU3Nnww&ixlib=rb-4.0.3&q=80',
326
+ fill: {
327
+ type: 'image',
328
+ url: 'https://images.unsplash.com/photo-1640963269654-3fe248c5fba6?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTY5OTZ8MHwxfHNlYXJjaHwyNTZ8fGdyYWRpZW50fGVufDB8fHx8MTcwMzA4NDU3Nnww&ixlib=rb-4.0.3&q=80'
329
+ }
330
+ },
331
+ cosmic_img_13: {
332
+ class: 'https://images.unsplash.com/photo-1595131264179-84bb2f9e17b9?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTY5OTZ8MHwxfHNlYXJjaHwyNjh8fGdyYWRpZW50fGVufDB8fHx8MTcwMzA2NzI3OXww&ixlib=rb-4.0.3&q=80',
333
+ fill: {
334
+ type: 'image',
335
+ url: 'https://images.unsplash.com/photo-1595131264179-84bb2f9e17b9?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTY5OTZ8MHwxfHNlYXJjaHwyNjh8fGdyYWRpZW50fGVufDB8fHx8MTcwMzA2NzI3OXww&ixlib=rb-4.0.3&q=80'
336
+ }
337
+ },
338
+ cosmic_img_14: {
339
+ class: 'https://images.unsplash.com/photo-1642116876554-b17f937ee90b?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTY5OTZ8MHwxfHNlYXJjaHwxNzV8fGdyYWRpZW50fGVufDB8fHx8MTcwMzA3ODE5Mnww&ixlib=rb-4.0.3&q=80',
340
+ fill: {
341
+ type: 'image',
342
+ url: 'https://images.unsplash.com/photo-1642116876554-b17f937ee90b?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTY5OTZ8MHwxfHNlYXJjaHwxNzV8fGdyYWRpZW50fGVufDB8fHx8MTcwMzA3ODE5Mnww&ixlib=rb-4.0.3&q=80'
343
+ }
344
+ },
345
+ cosmic_img_15: {
346
+ class: 'https://images.unsplash.com/photo-1586455122341-927f2dec0691?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTY5OTZ8MHwxfHNlYXJjaHw3MHx8Z3JhZGllbnR8ZW58MHx8fHwxNzAzMDQ3MjE1fDA&ixlib=rb-4.0.3&q=80',
347
+ fill: {
348
+ type: 'image',
349
+ url: 'https://images.unsplash.com/photo-1586455122341-927f2dec0691?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTY5OTZ8MHwxfHNlYXJjaHw3MHx8Z3JhZGllbnR8ZW58MHx8fHwxNzAzMDQ3MjE1fDA&ixlib=rb-4.0.3&q=80'
350
+ }
351
+ },
352
+ desktop_img_1: {
353
+ class: 'https://images.unsplash.com/photo-1511860810434-a92f84c6f01e?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&q=80',
354
+ fill: {
355
+ type: 'image',
356
+ url: 'https://images.unsplash.com/photo-1511860810434-a92f84c6f01e?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&q=80'
357
+ }
358
+ },
359
+ desktop_img_2: {
360
+ class: 'https://images.unsplash.com/photo-1554110397-9bac083977c6?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&q=80',
361
+ fill: {
362
+ type: 'image',
363
+ url: 'https://images.unsplash.com/photo-1554110397-9bac083977c6?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&q=80'
364
+ }
365
+ },
366
+ desktop_img_3: {
367
+ class: 'https://images.unsplash.com/photo-1671180881490-8af6e9c3eaf1?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&q=80',
368
+ fill: {
369
+ type: 'image',
370
+ url: 'https://images.unsplash.com/photo-1671180881490-8af6e9c3eaf1?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&q=80'
371
+ }
372
+ },
373
+ desktop_img_4: {
374
+ class: 'https://images.unsplash.com/photo-1671549296089-88b3a6eb347e?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&q=80',
375
+ fill: {
376
+ type: 'image',
377
+ url: 'https://images.unsplash.com/photo-1671549296089-88b3a6eb347e?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&q=80'
378
+ }
379
+ },
380
+ desktop_img_5: {
381
+ class: 'https://images.unsplash.com/photo-1668718031554-9c05b5d03750?&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&q=80',
382
+ fill: {
383
+ type: 'image',
384
+ url: 'https://images.unsplash.com/photo-1668718031554-9c05b5d03750?&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&q=80'
385
+ }
386
+ },
387
+ };
@@ -0,0 +1,28 @@
1
+ export const captureScreen = async () => {
2
+ try {
3
+ const mediaStream = await navigator.mediaDevices.getDisplayMedia();
4
+ const video = document.createElement('video');
5
+ video.srcObject = mediaStream;
6
+ video.play();
7
+
8
+ // 等待视频帧稳定
9
+ await new Promise((resolve) => (video.onplaying = resolve));
10
+
11
+ // 创建canvas并绘制当前视频帧
12
+ const canvas = document.createElement('canvas');
13
+ canvas.width = video.videoWidth;
14
+ canvas.height = video.videoHeight;
15
+ const ctx = canvas.getContext('2d');
16
+ ctx.drawImage(video, 0, 0);
17
+
18
+ // 获取屏幕截图
19
+ const screenshot = canvas.toDataURL('image/png');
20
+
21
+ // 停止媒体流
22
+ video.srcObject.getTracks().forEach((track) => track.stop());
23
+
24
+ return screenshot;
25
+ } catch (err) {
26
+ console.log('Error capturing screen:', err);
27
+ }
28
+ };
@@ -0,0 +1,163 @@
1
+ export default [
2
+ {
3
+ key: 'default',
4
+ title: 'Default',
5
+ lists: [
6
+ {
7
+ width: 1920,
8
+ height: 1080,
9
+ w: 16,
10
+ h: 9,
11
+ },
12
+ {
13
+ width: 1920,
14
+ height: 1280,
15
+ w: 3,
16
+ h: 2,
17
+ },
18
+ {
19
+ width: 1920,
20
+ height: 1440,
21
+ w: 4,
22
+ h: 3,
23
+ },
24
+ {
25
+ width: 1920,
26
+ height: 1536,
27
+ w: 5,
28
+ h: 4,
29
+ },
30
+ {
31
+ width: 1920,
32
+ height: 1920,
33
+ w: 1,
34
+ h: 1,
35
+ },
36
+ {
37
+ width: 1080,
38
+ height: 1350,
39
+ w: 4,
40
+ h: 5,
41
+ },
42
+ {
43
+ width: 1080,
44
+ height: 1440,
45
+ w: 3,
46
+ h: 4,
47
+ },
48
+ {
49
+ width: 1080,
50
+ height: 1620,
51
+ w: 2,
52
+ h: 3,
53
+ },
54
+ {
55
+ width: 1080,
56
+ height: 1920,
57
+ w: 9,
58
+ h: 16,
59
+ },
60
+ ],
61
+ },
62
+ {
63
+ key: 'instagram',
64
+ title: 'Instagram',
65
+ lists: [
66
+ {
67
+ title: 'Post',
68
+ width: 1080,
69
+ height: 1080,
70
+ w: 1,
71
+ h: 1,
72
+ },
73
+ {
74
+ title: 'Portrait',
75
+ width: 1080,
76
+ height: 1350,
77
+ w: 4,
78
+ h: 5,
79
+ },
80
+ {
81
+ title: 'Stroy',
82
+ width: 1080,
83
+ height: 1920,
84
+ w: 9,
85
+ h: 16,
86
+ },
87
+ ],
88
+ },
89
+ {
90
+ key: 'x',
91
+ title: 'X',
92
+ lists: [
93
+ {
94
+ title: 'Tweet',
95
+ width: 1200,
96
+ height: 675,
97
+ w: 16,
98
+ h: 9,
99
+ },
100
+ {
101
+ title: 'Cover',
102
+ width: 1500,
103
+ height: 500,
104
+ w: 3,
105
+ h: 1,
106
+ },
107
+ ],
108
+ },
109
+ {
110
+ key: 'youtube',
111
+ title: 'YouTube',
112
+ lists: [
113
+ {
114
+ title: 'Banner',
115
+ width: 2560,
116
+ height: 1440,
117
+ w: 16,
118
+ h: 9,
119
+ },
120
+ {
121
+ title: 'Thumbnail',
122
+ width: 1280,
123
+ height: 720,
124
+ w: 16,
125
+ h: 9,
126
+ },
127
+ {
128
+ title: 'Video',
129
+ width: 1920,
130
+ height: 1080,
131
+ w: 16,
132
+ h: 9,
133
+ },
134
+ ],
135
+ },
136
+ {
137
+ key: 'pinterest',
138
+ title: 'Pinterest',
139
+ lists: [
140
+ {
141
+ title: 'Long',
142
+ width: 1000,
143
+ height: 2100,
144
+ w: 10,
145
+ h: 21,
146
+ },
147
+ {
148
+ title: 'Optimal',
149
+ width: 1000,
150
+ height: 1500,
151
+ w: 2,
152
+ h: 3,
153
+ },
154
+ {
155
+ title: 'Square',
156
+ width: 1000,
157
+ height: 1000,
158
+ w: 1,
159
+ h: 1,
160
+ },
161
+ ],
162
+ },
163
+ ];