edsger 0.33.3 → 0.33.4

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.
@@ -88,12 +88,10 @@ function createCompositionHtml(framedScreenshotDataUrl, spec, targetWidth, targe
88
88
  align-items: flex-start;
89
89
  justify-content: center;
90
90
  overflow: hidden;
91
- padding: 0 ${Math.round(targetWidth * 0.05)}px;
91
+ padding: 0 ${Math.round(targetWidth * 0.02)}px;
92
92
  }
93
93
  .device-area img {
94
- max-width: 100%;
95
- max-height: 100%;
96
- object-fit: contain;
94
+ width: 92%;
97
95
  }
98
96
  </style>
99
97
  </head>
@@ -151,11 +149,11 @@ function createCompositionHtml(framedScreenshotDataUrl, spec, targetWidth, targe
151
149
  align-items: center;
152
150
  justify-content: center;
153
151
  overflow: hidden;
154
- padding: ${Math.round(targetHeight * 0.05)}px;
152
+ padding: ${Math.round(targetHeight * 0.03)}px;
155
153
  }
156
154
  .device-area img {
157
155
  max-width: 100%;
158
- max-height: 100%;
156
+ max-height: 95%;
159
157
  object-fit: contain;
160
158
  }
161
159
  </style>
@@ -236,13 +234,17 @@ export async function generateStoreScreenshots(specs, options) {
236
234
  continue;
237
235
  }
238
236
  // Step 2: Wrap in device frame
237
+ // Use tight canvas dimensions so the device fills most of the frame image.
238
+ // This prevents excess padding that would make the device appear small in composition.
239
239
  const rawDataUrl = `data:image/png;base64,${rawScreenshotBuffer.toString('base64')}`;
240
+ const frameWidth = deviceFrame === 'iphone' ? 500 : 1600;
241
+ const frameHeight = deviceFrame === 'iphone' ? 1050 : 1000;
240
242
  const frameHtml = generateDeviceFrameHtml(rawDataUrl, deviceFrame, {
241
243
  background: 'transparent',
242
244
  shadow: true,
245
+ canvasWidth: frameWidth,
246
+ canvasHeight: frameHeight,
243
247
  });
244
- const frameWidth = deviceFrame === 'iphone' ? 800 : 1600;
245
- const frameHeight = deviceFrame === 'iphone' ? 1200 : 1000;
246
248
  let framedBuffer;
247
249
  try {
248
250
  const frameContext = await browser.newContext({
@@ -255,6 +257,7 @@ export async function generateStoreScreenshots(specs, options) {
255
257
  framedBuffer = await framePage.screenshot({
256
258
  type: 'png',
257
259
  fullPage: false,
260
+ omitBackground: true,
258
261
  });
259
262
  await frameContext.close();
260
263
  }
@@ -27,4 +27,8 @@ export declare function generateDeviceFrameHtml(screenshotDataUrl: string, devic
27
27
  browserTitle?: string;
28
28
  /** URL to show in the browser address bar (browser frame only) */
29
29
  browserUrl?: string;
30
+ /** Custom canvas width (defaults vary by device type) */
31
+ canvasWidth?: number;
32
+ /** Custom canvas height (defaults vary by device type) */
33
+ canvasHeight?: number;
30
34
  }): string;
@@ -17,27 +17,27 @@ export const DEVICE_PRESETS = {
17
17
  * @param options - additional customization options
18
18
  */
19
19
  export function generateDeviceFrameHtml(screenshotDataUrl, deviceType, options) {
20
- const { background = 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)', shadow = true, browserTitle = 'Edsger', browserUrl = 'app.edsger.ai', } = options || {};
20
+ const { background = 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)', shadow = true, browserTitle = 'Edsger', browserUrl = 'app.edsger.ai', canvasWidth, canvasHeight, } = options || {};
21
21
  switch (deviceType) {
22
22
  case 'macbook':
23
- return generateMacBookFrame(screenshotDataUrl, background, shadow);
23
+ return generateMacBookFrame(screenshotDataUrl, background, shadow, canvasWidth ?? 1600, canvasHeight ?? 1000);
24
24
  case 'iphone':
25
- return generateIPhoneFrame(screenshotDataUrl, background, shadow);
25
+ return generateIPhoneFrame(screenshotDataUrl, background, shadow, canvasWidth ?? 800, canvasHeight ?? 1200);
26
26
  case 'browser':
27
- return generateBrowserFrame(screenshotDataUrl, background, shadow, browserTitle, browserUrl);
27
+ return generateBrowserFrame(screenshotDataUrl, background, shadow, browserTitle, browserUrl, canvasWidth ?? 1600, canvasHeight ?? 1000);
28
28
  case 'none':
29
29
  return generatePlainFrame(screenshotDataUrl, background);
30
30
  }
31
31
  }
32
- function generateMacBookFrame(screenshotDataUrl, background, shadow) {
32
+ function generateMacBookFrame(screenshotDataUrl, background, shadow, canvasWidth, canvasHeight) {
33
33
  return `<!DOCTYPE html>
34
34
  <html>
35
35
  <head>
36
36
  <style>
37
37
  * { margin: 0; padding: 0; box-sizing: border-box; }
38
38
  body {
39
- width: 1600px;
40
- height: 1000px;
39
+ width: ${canvasWidth}px;
40
+ height: ${canvasHeight}px;
41
41
  display: flex;
42
42
  align-items: center;
43
43
  justify-content: center;
@@ -118,15 +118,15 @@ function generateMacBookFrame(screenshotDataUrl, background, shadow) {
118
118
  </body>
119
119
  </html>`;
120
120
  }
121
- function generateIPhoneFrame(screenshotDataUrl, background, shadow) {
121
+ function generateIPhoneFrame(screenshotDataUrl, background, shadow, canvasWidth, canvasHeight) {
122
122
  return `<!DOCTYPE html>
123
123
  <html>
124
124
  <head>
125
125
  <style>
126
126
  * { margin: 0; padding: 0; box-sizing: border-box; }
127
127
  body {
128
- width: 800px;
129
- height: 1200px;
128
+ width: ${canvasWidth}px;
129
+ height: ${canvasHeight}px;
130
130
  display: flex;
131
131
  align-items: center;
132
132
  justify-content: center;
@@ -234,15 +234,15 @@ function generateIPhoneFrame(screenshotDataUrl, background, shadow) {
234
234
  </body>
235
235
  </html>`;
236
236
  }
237
- function generateBrowserFrame(screenshotDataUrl, background, shadow, title, url) {
237
+ function generateBrowserFrame(screenshotDataUrl, background, shadow, title, url, canvasWidth, canvasHeight) {
238
238
  return `<!DOCTYPE html>
239
239
  <html>
240
240
  <head>
241
241
  <style>
242
242
  * { margin: 0; padding: 0; box-sizing: border-box; }
243
243
  body {
244
- width: 1600px;
245
- height: 1000px;
244
+ width: ${canvasWidth}px;
245
+ height: ${canvasHeight}px;
246
246
  display: flex;
247
247
  align-items: center;
248
248
  justify-content: center;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edsger",
3
- "version": "0.33.3",
3
+ "version": "0.33.4",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "edsger": "dist/index.js"