afterbefore 0.2.26 → 0.2.27
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/dist/overlay/index.js +628 -437
- package/dist/overlay/index.js.map +1 -1
- package/package.json +1 -1
package/dist/overlay/index.js
CHANGED
|
@@ -46,12 +46,13 @@ var DEFAULT_FRAME_SETTINGS = {
|
|
|
46
46
|
bgColor: "#F5F5F5",
|
|
47
47
|
bgGradient: GRADIENT_PRESETS[0],
|
|
48
48
|
bgImage: null,
|
|
49
|
-
padding:
|
|
49
|
+
padding: 192,
|
|
50
50
|
browserChrome: false,
|
|
51
51
|
browserTheme: "dark",
|
|
52
52
|
browserUrl: "localhost",
|
|
53
53
|
browserShadow: 50,
|
|
54
|
-
browserRadius: 8
|
|
54
|
+
browserRadius: 8,
|
|
55
|
+
afterbefore: false
|
|
55
56
|
};
|
|
56
57
|
var FRAME_SIZE_PRESETS = [
|
|
57
58
|
{ label: "1920 x 1080", hint: "Desktop / HD", w: 1920, h: 1080 },
|
|
@@ -70,6 +71,10 @@ var DEV_UI_SELECTORS = [
|
|
|
70
71
|
"[data-next-badge]",
|
|
71
72
|
"[data-next-mark]"
|
|
72
73
|
];
|
|
74
|
+
var MIN_DPR = 2;
|
|
75
|
+
function getDpr() {
|
|
76
|
+
return Math.max(window.devicePixelRatio || 1, MIN_DPR);
|
|
77
|
+
}
|
|
73
78
|
var SNAPDOM_BASE = {
|
|
74
79
|
exclude: DEV_UI_SELECTORS,
|
|
75
80
|
excludeMode: "remove"
|
|
@@ -94,17 +99,32 @@ async function capture(options) {
|
|
|
94
99
|
}
|
|
95
100
|
throw new Error(`Invalid capture mode: ${mode}`);
|
|
96
101
|
}
|
|
102
|
+
function getContentBottom() {
|
|
103
|
+
let maxBottom = 0;
|
|
104
|
+
for (const child of document.body.children) {
|
|
105
|
+
if (child.dataset?.afterbefore != null) continue;
|
|
106
|
+
if (child.id === "afterbefore-root") continue;
|
|
107
|
+
const rect = child.getBoundingClientRect();
|
|
108
|
+
if (rect.height > 0) {
|
|
109
|
+
maxBottom = Math.max(maxBottom, rect.bottom);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return maxBottom + window.scrollY;
|
|
113
|
+
}
|
|
97
114
|
async function captureRawViewport() {
|
|
98
115
|
const dpr = window.devicePixelRatio || 1;
|
|
99
116
|
const vw = window.innerWidth;
|
|
100
|
-
const vh = window.innerHeight;
|
|
101
117
|
const scrollY = window.scrollY;
|
|
118
|
+
const contentBottom = getContentBottom();
|
|
119
|
+
const vh = Math.min(window.innerHeight, Math.ceil(contentBottom - scrollY));
|
|
102
120
|
const fullDataUrl = await captureFullPage();
|
|
103
121
|
const fullImg = await loadImage(fullDataUrl);
|
|
104
122
|
const canvas = document.createElement("canvas");
|
|
105
123
|
canvas.width = vw * dpr;
|
|
106
124
|
canvas.height = vh * dpr;
|
|
107
125
|
const ctx = canvas.getContext("2d");
|
|
126
|
+
ctx.fillStyle = "#ffffff";
|
|
127
|
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
108
128
|
ctx.drawImage(
|
|
109
129
|
fullImg,
|
|
110
130
|
0,
|
|
@@ -119,11 +139,14 @@ async function captureRawViewport() {
|
|
|
119
139
|
return canvas.toDataURL("image/png");
|
|
120
140
|
}
|
|
121
141
|
function drawBrowserChrome(img, theme, dpr, url = "localhost") {
|
|
122
|
-
const
|
|
123
|
-
const
|
|
124
|
-
const
|
|
125
|
-
const
|
|
126
|
-
const
|
|
142
|
+
const CHROME_H = 28;
|
|
143
|
+
const BAR_PAD_X = 10;
|
|
144
|
+
const DOT_R = 3.5;
|
|
145
|
+
const DOT_START_X = 12;
|
|
146
|
+
const DOT_GAP = 12;
|
|
147
|
+
const DOTS_END = DOT_START_X + DOT_GAP * 2 + DOT_R + 6;
|
|
148
|
+
const URL_BAR_H = 16;
|
|
149
|
+
const URL_BAR_R = 4;
|
|
127
150
|
const imgW = img.width;
|
|
128
151
|
const imgH = img.height;
|
|
129
152
|
const canvas = document.createElement("canvas");
|
|
@@ -135,37 +158,32 @@ function drawBrowserChrome(img, theme, dpr, url = "localhost") {
|
|
|
135
158
|
ctx.fillRect(0, 0, canvas.width, CHROME_H * dpr);
|
|
136
159
|
ctx.fillStyle = colors.border;
|
|
137
160
|
ctx.fillRect(0, (CHROME_H - 1) * dpr, canvas.width, dpr);
|
|
138
|
-
const dotY =
|
|
139
|
-
const dotR = 6 * dpr;
|
|
140
|
-
const dotStartX = 18 * dpr;
|
|
141
|
-
const dotGap = 20 * dpr;
|
|
161
|
+
const dotY = CHROME_H / 2 * dpr;
|
|
142
162
|
const dotColors = ["#FF5F57", "#FEBC2E", "#28C840"];
|
|
143
163
|
for (let i = 0; i < 3; i++) {
|
|
144
164
|
ctx.beginPath();
|
|
145
|
-
ctx.arc(
|
|
165
|
+
ctx.arc((DOT_START_X + i * DOT_GAP) * dpr, dotY, DOT_R * dpr, 0, Math.PI * 2);
|
|
146
166
|
ctx.fillStyle = dotColors[i];
|
|
147
167
|
ctx.fill();
|
|
148
168
|
}
|
|
149
|
-
const
|
|
150
|
-
const
|
|
151
|
-
const
|
|
152
|
-
const urlBarW = canvas.width - urlBarPadX * 2;
|
|
169
|
+
const urlBarX = DOTS_END * dpr;
|
|
170
|
+
const urlBarY = (CHROME_H - URL_BAR_H) / 2 * dpr;
|
|
171
|
+
const urlBarW = canvas.width - urlBarX - BAR_PAD_X * dpr;
|
|
153
172
|
const urlBarH = URL_BAR_H * dpr;
|
|
154
|
-
const urlBarR = 6 * dpr;
|
|
155
173
|
ctx.fillStyle = colors.urlBar;
|
|
156
|
-
roundRect(ctx, urlBarX, urlBarY, urlBarW, urlBarH,
|
|
174
|
+
roundRect(ctx, urlBarX, urlBarY, urlBarW, urlBarH, URL_BAR_R * dpr);
|
|
157
175
|
ctx.fill();
|
|
158
176
|
if (theme === "light") {
|
|
159
177
|
ctx.strokeStyle = colors.border;
|
|
160
178
|
ctx.lineWidth = dpr;
|
|
161
|
-
roundRect(ctx, urlBarX, urlBarY, urlBarW, urlBarH,
|
|
179
|
+
roundRect(ctx, urlBarX, urlBarY, urlBarW, urlBarH, URL_BAR_R * dpr);
|
|
162
180
|
ctx.stroke();
|
|
163
181
|
}
|
|
164
182
|
ctx.fillStyle = colors.text;
|
|
165
|
-
ctx.font = `${
|
|
166
|
-
ctx.textAlign = "
|
|
183
|
+
ctx.font = `${9 * dpr}px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif`;
|
|
184
|
+
ctx.textAlign = "left";
|
|
167
185
|
ctx.textBaseline = "middle";
|
|
168
|
-
ctx.fillText(url,
|
|
186
|
+
ctx.fillText(url, urlBarX + 8 * dpr, urlBarY + urlBarH / 2);
|
|
169
187
|
ctx.drawImage(img, 0, CHROME_H * dpr);
|
|
170
188
|
return canvas.toDataURL("image/png");
|
|
171
189
|
}
|
|
@@ -213,7 +231,7 @@ async function renderFrame(imageDataUrl, frameSettings) {
|
|
|
213
231
|
return imageDataUrl;
|
|
214
232
|
}
|
|
215
233
|
const img = await loadImage(imageDataUrl);
|
|
216
|
-
const dpr =
|
|
234
|
+
const dpr = getDpr();
|
|
217
235
|
const FRAME_W = frameSettings.size.w;
|
|
218
236
|
const FRAME_H = frameSettings.size.h;
|
|
219
237
|
const pad = frameSettings.padding ?? 40;
|
|
@@ -233,34 +251,93 @@ async function renderFrame(imageDataUrl, frameSettings) {
|
|
|
233
251
|
canvas.width = FRAME_W * dpr;
|
|
234
252
|
canvas.height = FRAME_H * dpr;
|
|
235
253
|
const ctx = canvas.getContext("2d");
|
|
254
|
+
await drawBackground(ctx, frameSettings, canvas.width, canvas.height);
|
|
255
|
+
const dx = (canvas.width - drawW) / 2;
|
|
256
|
+
const shadowShift = frameSettings.browserChrome ? (frameSettings.browserShadow ?? 50) / 100 * 12 * dpr : 0;
|
|
257
|
+
const dy = (canvas.height - drawH) / 2 - shadowShift;
|
|
258
|
+
if (frameSettings.browserChrome) {
|
|
259
|
+
const radius = (frameSettings.browserRadius ?? 8) * scale * dpr;
|
|
260
|
+
const shadowVal = frameSettings.browserShadow ?? 50;
|
|
261
|
+
if (shadowVal > 0) {
|
|
262
|
+
ctx.save();
|
|
263
|
+
ctx.shadowColor = `rgba(0, 0, 0, ${shadowVal / 100 * 0.6})`;
|
|
264
|
+
ctx.shadowBlur = shadowVal / 100 * 40 * dpr;
|
|
265
|
+
ctx.shadowOffsetY = shadowVal / 100 * 8 * dpr;
|
|
266
|
+
ctx.shadowOffsetX = 0;
|
|
267
|
+
ctx.fillStyle = "rgba(0,0,0,1)";
|
|
268
|
+
roundRect(ctx, dx, dy, drawW, drawH, radius);
|
|
269
|
+
ctx.fill();
|
|
270
|
+
ctx.restore();
|
|
271
|
+
}
|
|
272
|
+
ctx.save();
|
|
273
|
+
roundRect(ctx, dx, dy, drawW, drawH, radius);
|
|
274
|
+
ctx.clip();
|
|
275
|
+
ctx.fillStyle = "#ffffff";
|
|
276
|
+
ctx.fillRect(dx, dy, drawW, drawH);
|
|
277
|
+
ctx.drawImage(contentImg, dx, dy, drawW, drawH);
|
|
278
|
+
ctx.restore();
|
|
279
|
+
} else {
|
|
280
|
+
ctx.drawImage(contentImg, dx, dy, drawW, drawH);
|
|
281
|
+
}
|
|
282
|
+
return canvas.toDataURL("image/png");
|
|
283
|
+
}
|
|
284
|
+
async function drawBackground(ctx, frameSettings, w, h) {
|
|
236
285
|
if (frameSettings.bgType === "image" && frameSettings.bgImage) {
|
|
237
286
|
try {
|
|
238
287
|
const bgImg = await loadImage(frameSettings.bgImage);
|
|
239
|
-
drawCover(ctx, bgImg,
|
|
288
|
+
drawCover(ctx, bgImg, w, h);
|
|
240
289
|
} catch {
|
|
241
290
|
ctx.fillStyle = frameSettings.bgColor;
|
|
242
|
-
ctx.fillRect(0, 0,
|
|
291
|
+
ctx.fillRect(0, 0, w, h);
|
|
243
292
|
}
|
|
244
293
|
} else if (frameSettings.bgType === "gradient") {
|
|
245
|
-
fillCssGradient(ctx, frameSettings.bgGradient,
|
|
294
|
+
fillCssGradient(ctx, frameSettings.bgGradient, w, h);
|
|
246
295
|
} else if (frameSettings.bgColor !== "transparent") {
|
|
247
296
|
ctx.fillStyle = frameSettings.bgColor;
|
|
248
|
-
ctx.fillRect(0, 0,
|
|
297
|
+
ctx.fillRect(0, 0, w, h);
|
|
249
298
|
}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
const
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
299
|
+
}
|
|
300
|
+
async function renderAfterbeforeFrame(beforeDataUrl, afterDataUrl, frameSettings) {
|
|
301
|
+
const dpr = getDpr();
|
|
302
|
+
const FRAME_W = 1920;
|
|
303
|
+
const FRAME_H = 1080;
|
|
304
|
+
const pad = frameSettings.padding ?? 192;
|
|
305
|
+
const gap = 40;
|
|
306
|
+
const labelSpace = 48;
|
|
307
|
+
const canvas = document.createElement("canvas");
|
|
308
|
+
canvas.width = FRAME_W * dpr;
|
|
309
|
+
canvas.height = FRAME_H * dpr;
|
|
310
|
+
const ctx = canvas.getContext("2d");
|
|
311
|
+
await drawBackground(ctx, frameSettings, canvas.width, canvas.height);
|
|
312
|
+
const beforeImg = await loadImage(beforeDataUrl);
|
|
313
|
+
const afterImg = await loadImage(afterDataUrl);
|
|
314
|
+
const availW = FRAME_W - pad * 2;
|
|
315
|
+
const availH = FRAME_H - pad * 2 - labelSpace;
|
|
316
|
+
const slotW = (availW - gap) / 2;
|
|
317
|
+
for (const [i, img] of [beforeImg, afterImg].entries()) {
|
|
318
|
+
const imgW = img.width / dpr;
|
|
319
|
+
const imgH = img.height / dpr;
|
|
320
|
+
const s = Math.min(slotW / imgW, availH / imgH, 1);
|
|
321
|
+
const drawW = imgW * s * dpr;
|
|
322
|
+
const drawH = imgH * s * dpr;
|
|
323
|
+
const slotX = (pad + i * (slotW + gap)) * dpr;
|
|
324
|
+
const dx = slotX + (slotW * dpr - drawW) / 2;
|
|
325
|
+
const dy = pad * dpr + (availH * dpr - drawH) / 2;
|
|
326
|
+
ctx.fillStyle = "#ffffff";
|
|
327
|
+
ctx.fillRect(dx, dy, drawW, drawH);
|
|
328
|
+
ctx.drawImage(img, dx, dy, drawW, drawH);
|
|
329
|
+
}
|
|
330
|
+
ctx.fillStyle = frameSettings.bgColor === "#FFFFFF" || frameSettings.bgColor === "#F5F5F5" || frameSettings.bgColor === "#F8F4ED" ? "#666666" : "#ffffff";
|
|
331
|
+
ctx.font = `500 ${14 * dpr}px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif`;
|
|
332
|
+
ctx.textAlign = "center";
|
|
333
|
+
ctx.textBaseline = "top";
|
|
334
|
+
const labelY = (FRAME_H - pad - labelSpace + 16) * dpr;
|
|
335
|
+
const labels = ["Before", "After"];
|
|
336
|
+
for (let i = 0; i < 2; i++) {
|
|
337
|
+
const slotX = (pad + i * (slotW + gap)) * dpr;
|
|
338
|
+
const centerX = slotX + slotW * dpr / 2;
|
|
339
|
+
ctx.fillText(labels[i], centerX, labelY);
|
|
259
340
|
}
|
|
260
|
-
ctx.drawImage(contentImg, dx, dy, drawW, drawH);
|
|
261
|
-
ctx.shadowColor = "transparent";
|
|
262
|
-
ctx.shadowBlur = 0;
|
|
263
|
-
ctx.shadowOffsetY = 0;
|
|
264
341
|
return canvas.toDataURL("image/png");
|
|
265
342
|
}
|
|
266
343
|
function drawCover(ctx, img, cw, ch) {
|
|
@@ -374,63 +451,7 @@ import {
|
|
|
374
451
|
FileText,
|
|
375
452
|
Monitor
|
|
376
453
|
} from "lucide-react";
|
|
377
|
-
|
|
378
|
-
// src/overlay/ui/icons.tsx
|
|
379
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
380
|
-
function CameraIcon({ size = 32, color }) {
|
|
381
|
-
return /* @__PURE__ */ jsx("svg", { width: size, height: size, viewBox: "0 0 32 32", fill: "none", style: { color }, children: /* @__PURE__ */ jsx(
|
|
382
|
-
"path",
|
|
383
|
-
{
|
|
384
|
-
d: "M23.2119 13.8662C23.8759 13.8662 24.4228 13.3193 24.4228 12.6553C24.4228 11.9814 23.8759 11.4443 23.2119 11.4443C22.538 11.4443 22.0009 11.9814 22.0009 12.6553C22.0009 13.3193 22.538 13.8662 23.2119 13.8662ZM6.89356 24.999H24.7451C26.7763 24.999 27.8115 23.9834 27.8115 21.9717V11.7471C27.8115 9.73536 26.7763 8.7295 24.7451 8.7295H21.9521C21.1806 8.7295 20.9462 8.57325 20.5068 8.08496L19.7255 7.20605C19.2373 6.66895 18.7392 6.37598 17.7333 6.37598H13.8369C12.8311 6.37598 12.333 6.66895 11.8447 7.20605L11.0635 8.08496C10.624 8.56348 10.3799 8.7295 9.61817 8.7295H6.89356C4.85254 8.7295 3.82715 9.73536 3.82715 11.7471V21.9717C3.82715 23.9834 4.85254 24.999 6.89356 24.999ZM6.91309 23.4268C5.95606 23.4268 5.39942 22.9092 5.39942 21.8936V11.835C5.39942 10.8193 5.95606 10.3018 6.91309 10.3018H10.0088C10.8877 10.3018 11.3662 10.1357 11.8545 9.58887L12.6162 8.7295C13.1728 8.1045 13.4658 7.94825 14.3251 7.94825H17.2451C18.1044 7.94825 18.3974 8.1045 18.9541 8.7295L19.7158 9.58887C20.2041 10.1357 20.6826 10.3018 21.5615 10.3018H24.7158C25.6826 10.3018 26.2392 10.8193 26.2392 11.835V21.8936C26.2392 22.9092 25.6826 23.4268 24.7158 23.4268H6.91309ZM15.8193 22.0205C18.7685 22.0205 21.1416 19.6572 21.1416 16.6787C21.1416 13.71 18.7783 11.3467 15.8193 11.3467C12.8603 11.3467 10.4873 13.71 10.4873 16.6787C10.4873 19.6572 12.8603 22.0205 15.8193 22.0205ZM15.8193 20.5362C13.7002 20.5362 11.9619 18.8272 11.9619 16.6787C11.9619 14.54 13.6904 12.8213 15.8193 12.8213C17.9482 12.8213 19.6669 14.54 19.6669 16.6787C19.6669 18.8272 17.9482 20.5362 15.8193 20.5362Z",
|
|
385
|
-
fill: "currentColor"
|
|
386
|
-
}
|
|
387
|
-
) });
|
|
388
|
-
}
|
|
389
|
-
function ImageIcon({ size = 32, color }) {
|
|
390
|
-
return /* @__PURE__ */ jsxs("svg", { width: size, height: size, viewBox: "0 0 32 32", fill: "none", style: { color }, children: [
|
|
391
|
-
/* @__PURE__ */ jsx(
|
|
392
|
-
"path",
|
|
393
|
-
{
|
|
394
|
-
d: "M7.30371 24.3056H23.6709C25.4385 24.3056 26.3272 23.3193 26.3272 21.4443L20.5264 15.9951C20.0967 15.5947 19.5791 15.3897 19.0518 15.3897C18.5147 15.3897 18.0362 15.5752 17.5869 15.9756L13.1729 19.9209L11.3662 18.29C10.9561 17.9189 10.5068 17.7334 10.0479 17.7334C9.60839 17.7334 9.18847 17.9091 8.78808 18.2802L5.06738 21.6396C5.12598 23.4072 5.84863 24.3056 7.30371 24.3056ZM7.37207 24.9892H24.2666C26.3174 24.9892 27.333 23.9834 27.333 21.9716V10.0381C27.333 8.02636 26.3174 7.01074 24.2666 7.01074H7.37207C5.33105 7.01074 4.30566 8.02636 4.30566 10.0381V21.9716C4.30566 23.9834 5.33105 24.9892 7.37207 24.9892ZM7.3916 23.4169C6.41504 23.4169 5.87793 22.8994 5.87793 21.8837V10.126C5.87793 9.11035 6.41504 8.58301 7.3916 8.58301H24.2471C25.2139 8.58301 25.7608 9.11035 25.7608 10.126V21.8837C25.7608 22.8994 25.2139 23.4169 24.2471 23.4169H7.3916Z",
|
|
395
|
-
fill: "currentColor"
|
|
396
|
-
}
|
|
397
|
-
),
|
|
398
|
-
/* @__PURE__ */ jsx(
|
|
399
|
-
"path",
|
|
400
|
-
{
|
|
401
|
-
d: "M11.5811 16.0928C12.8408 16.0928 13.876 15.0576 13.876 13.7881C13.876 12.5283 12.8408 11.4834 11.5811 11.4834C10.3115 11.4834 9.27637 12.5283 9.27637 13.7881C9.27637 15.0576 10.3115 16.0928 11.5811 16.0928Z",
|
|
402
|
-
fill: "currentColor"
|
|
403
|
-
}
|
|
404
|
-
)
|
|
405
|
-
] });
|
|
406
|
-
}
|
|
407
|
-
function CheckmarkIcon({ size = 32, color }) {
|
|
408
|
-
return /* @__PURE__ */ jsxs("svg", { width: size, height: size, viewBox: "0 0 32 32", fill: "none", style: { color }, children: [
|
|
409
|
-
/* @__PURE__ */ jsx(
|
|
410
|
-
"path",
|
|
411
|
-
{
|
|
412
|
-
d: "M15.8193 25.9561C21.3174 25.9561 25.7803 21.4932 25.7803 15.9951C25.7803 10.4971 21.3174 6.03418 15.8193 6.03418C10.3213 6.03418 5.8584 10.4971 5.8584 15.9951C5.8584 21.4932 10.3213 25.9561 15.8193 25.9561ZM15.8193 24.2959C11.2295 24.2959 7.51856 20.585 7.51856 15.9951C7.51856 11.4053 11.2295 7.69434 15.8193 7.69434C20.4092 7.69434 24.1201 11.4053 24.1201 15.9951C24.1201 20.585 20.4092 24.2959 15.8193 24.2959Z",
|
|
413
|
-
fill: "currentColor"
|
|
414
|
-
}
|
|
415
|
-
),
|
|
416
|
-
/* @__PURE__ */ jsx(
|
|
417
|
-
"path",
|
|
418
|
-
{
|
|
419
|
-
d: "M14.7451 20.6338C15.0674 20.6338 15.3408 20.4776 15.5361 20.1748L19.999 13.1533C20.1064 12.958 20.2334 12.7432 20.2334 12.5283C20.2334 12.0889 19.8428 11.8057 19.4326 11.8057C19.1885 11.8057 18.9443 11.9619 18.7588 12.2451L14.7061 18.749L12.7822 16.2588C12.5478 15.9463 12.333 15.8682 12.0596 15.8682C11.6396 15.8682 11.3076 16.21 11.3076 16.6397C11.3076 16.8545 11.3955 17.0596 11.5322 17.2451L13.915 20.1748C14.1592 20.4971 14.4228 20.6338 14.7451 20.6338Z",
|
|
420
|
-
fill: "currentColor"
|
|
421
|
-
}
|
|
422
|
-
)
|
|
423
|
-
] });
|
|
424
|
-
}
|
|
425
|
-
function CloseIcon({ size = 32, color }) {
|
|
426
|
-
return /* @__PURE__ */ jsx("svg", { width: size, height: size, viewBox: "0 0 32 32", fill: "none", style: { color }, children: /* @__PURE__ */ jsx(
|
|
427
|
-
"path",
|
|
428
|
-
{
|
|
429
|
-
d: "M22.0693 8.52467L8.32911 22.2649C7.99708 22.5969 7.98732 23.1633 8.32911 23.4953C8.67091 23.8274 9.23732 23.8274 9.56935 23.4953L23.3096 9.75514C23.6416 9.42311 23.6514 8.8567 23.3096 8.52467C22.9678 8.18287 22.4111 8.17311 22.0693 8.52467ZM23.3096 22.2649L9.56935 8.52467C9.23732 8.18287 8.66115 8.17311 8.32911 8.52467C7.99708 8.86647 7.99708 9.42311 8.32911 9.75514L22.0693 23.4953C22.4014 23.8274 22.9775 23.8371 23.3096 23.4953C23.6416 23.1535 23.6416 22.5969 23.3096 22.2649Z",
|
|
430
|
-
fill: "currentColor"
|
|
431
|
-
}
|
|
432
|
-
) });
|
|
433
|
-
}
|
|
454
|
+
import { Camera, Check as Check2, X as X2 } from "lucide-react";
|
|
434
455
|
|
|
435
456
|
// src/overlay/color.ts
|
|
436
457
|
var gray = {
|
|
@@ -507,19 +528,18 @@ import {
|
|
|
507
528
|
Trash2 as Trash22,
|
|
508
529
|
X
|
|
509
530
|
} from "lucide-react";
|
|
531
|
+
import { Image as ImageIcon } from "lucide-react";
|
|
510
532
|
|
|
511
533
|
// src/overlay/ui/settings-panel.tsx
|
|
512
534
|
import { useEffect, useRef, useState as useState2 } from "react";
|
|
513
535
|
import {
|
|
514
|
-
AppWindow,
|
|
515
536
|
Check,
|
|
516
537
|
ChevronDown,
|
|
517
|
-
LayoutGrid,
|
|
518
538
|
Pipette,
|
|
519
539
|
Trash2,
|
|
520
540
|
Upload
|
|
521
541
|
} from "lucide-react";
|
|
522
|
-
import { Fragment, jsx
|
|
542
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
523
543
|
function SettingsContent({
|
|
524
544
|
frameSettings,
|
|
525
545
|
onFrameSettingsChange,
|
|
@@ -527,16 +547,23 @@ function SettingsContent({
|
|
|
527
547
|
picking,
|
|
528
548
|
onPickFolder
|
|
529
549
|
}) {
|
|
530
|
-
|
|
531
|
-
|
|
550
|
+
const [autoOpenPanel, setAutoOpenPanel] = useState2(() => {
|
|
551
|
+
try {
|
|
552
|
+
return localStorage.getItem("ab-auto-open-panel") !== "false";
|
|
553
|
+
} catch {
|
|
554
|
+
return true;
|
|
555
|
+
}
|
|
556
|
+
});
|
|
557
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
558
|
+
/* @__PURE__ */ jsx(
|
|
532
559
|
BackgroundSetting,
|
|
533
560
|
{
|
|
534
561
|
frameSettings,
|
|
535
562
|
onFrameSettingsChange
|
|
536
563
|
}
|
|
537
564
|
),
|
|
538
|
-
/* @__PURE__ */
|
|
539
|
-
/* @__PURE__ */
|
|
565
|
+
/* @__PURE__ */ jsx(SettingsDivider, {}),
|
|
566
|
+
/* @__PURE__ */ jsx(
|
|
540
567
|
BrowserFrameSetting,
|
|
541
568
|
{
|
|
542
569
|
enabled: frameSettings.browserChrome,
|
|
@@ -551,12 +578,53 @@ function SettingsContent({
|
|
|
551
578
|
onUrlChange: (v) => onFrameSettingsChange({ ...frameSettings, browserUrl: v })
|
|
552
579
|
}
|
|
553
580
|
),
|
|
554
|
-
/* @__PURE__ */
|
|
555
|
-
|
|
581
|
+
/* @__PURE__ */ jsx(SettingsDivider, {}),
|
|
582
|
+
/* @__PURE__ */ jsx(
|
|
556
583
|
SettingsRow,
|
|
557
584
|
{
|
|
558
|
-
title: "
|
|
559
|
-
description:
|
|
585
|
+
title: "Comparison",
|
|
586
|
+
description: "Side-by-side before & after",
|
|
587
|
+
control: /* @__PURE__ */ jsx(
|
|
588
|
+
ToggleSwitch,
|
|
589
|
+
{
|
|
590
|
+
enabled: frameSettings.afterbefore,
|
|
591
|
+
onChange: () => onFrameSettingsChange({
|
|
592
|
+
...frameSettings,
|
|
593
|
+
afterbefore: !frameSettings.afterbefore,
|
|
594
|
+
...!frameSettings.afterbefore ? { size: { w: 1920, h: 1080 } } : {}
|
|
595
|
+
})
|
|
596
|
+
}
|
|
597
|
+
)
|
|
598
|
+
}
|
|
599
|
+
),
|
|
600
|
+
/* @__PURE__ */ jsx(SettingsDivider, {}),
|
|
601
|
+
/* @__PURE__ */ jsx(
|
|
602
|
+
SettingsRow,
|
|
603
|
+
{
|
|
604
|
+
title: "Open after capture",
|
|
605
|
+
description: "Show screenshots panel after taking a screenshot",
|
|
606
|
+
control: /* @__PURE__ */ jsx(
|
|
607
|
+
ToggleSwitch,
|
|
608
|
+
{
|
|
609
|
+
enabled: autoOpenPanel,
|
|
610
|
+
onChange: () => {
|
|
611
|
+
const next = !autoOpenPanel;
|
|
612
|
+
setAutoOpenPanel(next);
|
|
613
|
+
try {
|
|
614
|
+
localStorage.setItem("ab-auto-open-panel", String(next));
|
|
615
|
+
} catch {
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
)
|
|
620
|
+
}
|
|
621
|
+
),
|
|
622
|
+
/* @__PURE__ */ jsx(SettingsDivider, {}),
|
|
623
|
+
saveDir !== void 0 && onPickFolder && /* @__PURE__ */ jsx(
|
|
624
|
+
SettingsRow,
|
|
625
|
+
{
|
|
626
|
+
title: "Save location",
|
|
627
|
+
description: /* @__PURE__ */ jsx(
|
|
560
628
|
"span",
|
|
561
629
|
{
|
|
562
630
|
style: {
|
|
@@ -569,7 +637,7 @@ function SettingsContent({
|
|
|
569
637
|
children: saveDir
|
|
570
638
|
}
|
|
571
639
|
),
|
|
572
|
-
control: /* @__PURE__ */
|
|
640
|
+
control: /* @__PURE__ */ jsx(SmallButton, { onClick: onPickFolder, children: picking ? "..." : "Change" })
|
|
573
641
|
}
|
|
574
642
|
)
|
|
575
643
|
] });
|
|
@@ -579,16 +647,16 @@ function SettingsRow({
|
|
|
579
647
|
description,
|
|
580
648
|
control
|
|
581
649
|
}) {
|
|
582
|
-
return /* @__PURE__ */
|
|
583
|
-
/* @__PURE__ */
|
|
584
|
-
/* @__PURE__ */
|
|
585
|
-
description && /* @__PURE__ */
|
|
650
|
+
return /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 16, padding: "14px 0" }, children: [
|
|
651
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 2, flex: 1, minWidth: 0 }, children: [
|
|
652
|
+
/* @__PURE__ */ jsx("span", { style: { ...text.label.xs, color: fg.strong }, children: title }),
|
|
653
|
+
description && /* @__PURE__ */ jsx("span", { style: { ...text.paragraph.xs, color: fg.sub }, children: description })
|
|
586
654
|
] }),
|
|
587
|
-
/* @__PURE__ */
|
|
655
|
+
/* @__PURE__ */ jsx("div", { style: { flexShrink: 0 }, children: control })
|
|
588
656
|
] });
|
|
589
657
|
}
|
|
590
658
|
function SettingsDivider() {
|
|
591
|
-
return /* @__PURE__ */
|
|
659
|
+
return /* @__PURE__ */ jsx(
|
|
592
660
|
"div",
|
|
593
661
|
{
|
|
594
662
|
style: {
|
|
@@ -602,7 +670,7 @@ function ToggleSwitch({
|
|
|
602
670
|
enabled,
|
|
603
671
|
onChange
|
|
604
672
|
}) {
|
|
605
|
-
return /* @__PURE__ */
|
|
673
|
+
return /* @__PURE__ */ jsx(
|
|
606
674
|
"button",
|
|
607
675
|
{
|
|
608
676
|
type: "button",
|
|
@@ -619,7 +687,7 @@ function ToggleSwitch({
|
|
|
619
687
|
flexShrink: 0,
|
|
620
688
|
transition: "background 0.12s ease"
|
|
621
689
|
},
|
|
622
|
-
children: /* @__PURE__ */
|
|
690
|
+
children: /* @__PURE__ */ jsx(
|
|
623
691
|
"span",
|
|
624
692
|
{
|
|
625
693
|
style: {
|
|
@@ -662,9 +730,9 @@ function FrameSizeControl({
|
|
|
662
730
|
outline: "none",
|
|
663
731
|
padding: "0 2px 0 6px"
|
|
664
732
|
};
|
|
665
|
-
return /* @__PURE__ */
|
|
666
|
-
/* @__PURE__ */
|
|
667
|
-
/* @__PURE__ */
|
|
733
|
+
return /* @__PURE__ */ jsxs("div", { style: { marginTop: 16, paddingBottom: 14 }, children: [
|
|
734
|
+
/* @__PURE__ */ jsx("span", { style: { ...text.label.xs, color: fg.strong }, children: "Size" }),
|
|
735
|
+
/* @__PURE__ */ jsx("div", { style: { display: "flex", gap: 6, marginTop: 8 }, children: ["w", "h"].map((field) => /* @__PURE__ */ jsxs(
|
|
668
736
|
"div",
|
|
669
737
|
{
|
|
670
738
|
style: {
|
|
@@ -678,8 +746,8 @@ function FrameSizeControl({
|
|
|
678
746
|
borderRadius: 7
|
|
679
747
|
},
|
|
680
748
|
children: [
|
|
681
|
-
/* @__PURE__ */
|
|
682
|
-
/* @__PURE__ */
|
|
749
|
+
/* @__PURE__ */ jsx("span", { style: { ...text.label.xs, color: fg.sub, flexShrink: 0, userSelect: "none" }, children: field.toUpperCase() }),
|
|
750
|
+
/* @__PURE__ */ jsx(
|
|
683
751
|
"input",
|
|
684
752
|
{
|
|
685
753
|
type: "text",
|
|
@@ -703,10 +771,10 @@ function FrameSizeControl({
|
|
|
703
771
|
},
|
|
704
772
|
field
|
|
705
773
|
)) }),
|
|
706
|
-
/* @__PURE__ */
|
|
707
|
-
/* @__PURE__ */
|
|
708
|
-
/* @__PURE__ */
|
|
709
|
-
/* @__PURE__ */
|
|
774
|
+
/* @__PURE__ */ jsxs("div", { style: { marginTop: 16 }, children: [
|
|
775
|
+
/* @__PURE__ */ jsx("span", { style: { ...text.label.xs, color: fg.strong, display: "block", marginBottom: 8 }, children: "Presets" }),
|
|
776
|
+
/* @__PURE__ */ jsxs("div", { style: { position: "relative" }, children: [
|
|
777
|
+
/* @__PURE__ */ jsxs(
|
|
710
778
|
"button",
|
|
711
779
|
{
|
|
712
780
|
onClick: () => setSizeOpen((prev) => !prev),
|
|
@@ -729,11 +797,11 @@ function FrameSizeControl({
|
|
|
729
797
|
},
|
|
730
798
|
children: [
|
|
731
799
|
currentPreset ? currentPreset.label : "Custom",
|
|
732
|
-
/* @__PURE__ */
|
|
800
|
+
/* @__PURE__ */ jsx(ChevronDown, { size: 12, strokeWidth: 2 })
|
|
733
801
|
]
|
|
734
802
|
}
|
|
735
803
|
),
|
|
736
|
-
sizeOpen && /* @__PURE__ */
|
|
804
|
+
sizeOpen && /* @__PURE__ */ jsx(
|
|
737
805
|
"div",
|
|
738
806
|
{
|
|
739
807
|
style: {
|
|
@@ -748,7 +816,7 @@ function FrameSizeControl({
|
|
|
748
816
|
boxShadow: shadow.dropdown,
|
|
749
817
|
zIndex: 1
|
|
750
818
|
},
|
|
751
|
-
children: FRAME_SIZE_PRESETS.map((preset) => /* @__PURE__ */
|
|
819
|
+
children: FRAME_SIZE_PRESETS.map((preset) => /* @__PURE__ */ jsxs(
|
|
752
820
|
DropItem,
|
|
753
821
|
{
|
|
754
822
|
active: !isCustom && preset.w === size.w && preset.h === size.h,
|
|
@@ -757,8 +825,8 @@ function FrameSizeControl({
|
|
|
757
825
|
setSizeOpen(false);
|
|
758
826
|
},
|
|
759
827
|
children: [
|
|
760
|
-
/* @__PURE__ */
|
|
761
|
-
/* @__PURE__ */
|
|
828
|
+
/* @__PURE__ */ jsx("span", { children: preset.label }),
|
|
829
|
+
/* @__PURE__ */ jsx("span", { style: { marginLeft: 6, fontSize: 10, color: fg.muted }, children: preset.hint })
|
|
762
830
|
]
|
|
763
831
|
},
|
|
764
832
|
preset.label
|
|
@@ -802,13 +870,10 @@ function BackgroundSetting({
|
|
|
802
870
|
onFrameSettingsChange({ ...frameSettings, bgType: "color", bgColor: c });
|
|
803
871
|
};
|
|
804
872
|
const currentBg = frameSettings.bgType === "gradient" ? frameSettings.bgGradient : frameSettings.bgColor;
|
|
805
|
-
return /* @__PURE__ */
|
|
806
|
-
/* @__PURE__ */
|
|
807
|
-
/* @__PURE__ */
|
|
808
|
-
|
|
809
|
-
/* @__PURE__ */ jsx2("span", { style: { ...text.label.sm, color: fg.strong }, children: "Background" })
|
|
810
|
-
] }),
|
|
811
|
-
/* @__PURE__ */ jsx2(
|
|
873
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
874
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 16 }, children: [
|
|
875
|
+
/* @__PURE__ */ jsx("span", { style: { ...text.label.xs, color: fg.strong }, children: "Background" }),
|
|
876
|
+
/* @__PURE__ */ jsx(
|
|
812
877
|
ToggleSwitch,
|
|
813
878
|
{
|
|
814
879
|
enabled: frameSettings.enabled,
|
|
@@ -816,7 +881,7 @@ function BackgroundSetting({
|
|
|
816
881
|
}
|
|
817
882
|
)
|
|
818
883
|
] }),
|
|
819
|
-
/* @__PURE__ */
|
|
884
|
+
/* @__PURE__ */ jsx("div", { style: { display: "flex", gap: 2, marginTop: 12, background: state.subtle, borderRadius: 8, padding: 2 }, children: ["solid", "gradient", "image"].map((t) => /* @__PURE__ */ jsx(
|
|
820
885
|
"button",
|
|
821
886
|
{
|
|
822
887
|
onClick: () => setTab(t),
|
|
@@ -837,9 +902,9 @@ function BackgroundSetting({
|
|
|
837
902
|
},
|
|
838
903
|
t
|
|
839
904
|
)) }),
|
|
840
|
-
tab === "gradient" && /* @__PURE__ */
|
|
905
|
+
tab === "gradient" && /* @__PURE__ */ jsx("div", { style: { display: "flex", gap: 8, marginTop: 12, padding: "4px 4px 14px", flexWrap: "wrap" }, children: GRADIENT_PRESETS.map((g) => {
|
|
841
906
|
const selected = frameSettings.bgType === "gradient" && frameSettings.bgGradient === g;
|
|
842
|
-
return /* @__PURE__ */
|
|
907
|
+
return /* @__PURE__ */ jsx(
|
|
843
908
|
PresetSwatch,
|
|
844
909
|
{
|
|
845
910
|
background: g,
|
|
@@ -849,11 +914,11 @@ function BackgroundSetting({
|
|
|
849
914
|
g
|
|
850
915
|
);
|
|
851
916
|
}) }),
|
|
852
|
-
tab === "solid" && /* @__PURE__ */
|
|
853
|
-
/* @__PURE__ */
|
|
917
|
+
tab === "solid" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
918
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: 8, marginTop: 12, padding: "4px 4px 14px", flexWrap: "wrap" }, children: [
|
|
854
919
|
COLOR_PRESETS.map((c) => {
|
|
855
920
|
const selected = frameSettings.bgType === "color" && frameSettings.bgColor === c;
|
|
856
|
-
return /* @__PURE__ */
|
|
921
|
+
return /* @__PURE__ */ jsx(
|
|
857
922
|
PresetSwatch,
|
|
858
923
|
{
|
|
859
924
|
background: c,
|
|
@@ -868,7 +933,7 @@ function BackgroundSetting({
|
|
|
868
933
|
const isCustom = !COLOR_PRESETS.includes(customColor.toUpperCase());
|
|
869
934
|
const bg2 = isCustom ? customColor : "transparent";
|
|
870
935
|
const iconColor = isCustom ? hexLuminance(customColor) > 0.4 ? "rgba(0,0,0,0.5)" : "rgba(255,255,255,0.7)" : fg.sub;
|
|
871
|
-
return /* @__PURE__ */
|
|
936
|
+
return /* @__PURE__ */ jsx(
|
|
872
937
|
"button",
|
|
873
938
|
{
|
|
874
939
|
onClick: async () => {
|
|
@@ -893,15 +958,15 @@ function BackgroundSetting({
|
|
|
893
958
|
justifyContent: "center",
|
|
894
959
|
color: iconColor
|
|
895
960
|
},
|
|
896
|
-
children: /* @__PURE__ */
|
|
961
|
+
children: /* @__PURE__ */ jsx(Pipette, { size: 14, strokeWidth: 2 })
|
|
897
962
|
}
|
|
898
963
|
);
|
|
899
964
|
})()
|
|
900
965
|
] }),
|
|
901
|
-
/* @__PURE__ */
|
|
966
|
+
/* @__PURE__ */ jsx("div", { style: { paddingBottom: 4 }, children: /* @__PURE__ */ jsx(ColorHexInput, { value: frameSettings.bgColor, onChange: selectColor }) })
|
|
902
967
|
] }),
|
|
903
|
-
tab === "image" && /* @__PURE__ */
|
|
904
|
-
/* @__PURE__ */
|
|
968
|
+
tab === "image" && /* @__PURE__ */ jsxs("div", { style: { marginTop: 12 }, children: [
|
|
969
|
+
/* @__PURE__ */ jsx(
|
|
905
970
|
"input",
|
|
906
971
|
{
|
|
907
972
|
ref: fileInputRef,
|
|
@@ -911,8 +976,8 @@ function BackgroundSetting({
|
|
|
911
976
|
style: { display: "none" }
|
|
912
977
|
}
|
|
913
978
|
),
|
|
914
|
-
frameSettings.bgImage ? /* @__PURE__ */
|
|
915
|
-
/* @__PURE__ */
|
|
979
|
+
frameSettings.bgImage ? /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
|
|
980
|
+
/* @__PURE__ */ jsx(
|
|
916
981
|
"img",
|
|
917
982
|
{
|
|
918
983
|
src: frameSettings.bgImage,
|
|
@@ -926,17 +991,17 @@ function BackgroundSetting({
|
|
|
926
991
|
}
|
|
927
992
|
}
|
|
928
993
|
),
|
|
929
|
-
/* @__PURE__ */
|
|
930
|
-
/* @__PURE__ */
|
|
994
|
+
/* @__PURE__ */ jsxs(SmallButton, { onClick: () => fileInputRef.current?.click(), children: [
|
|
995
|
+
/* @__PURE__ */ jsx(Upload, { size: 11, strokeWidth: 2 }),
|
|
931
996
|
"Replace"
|
|
932
997
|
] }),
|
|
933
|
-
/* @__PURE__ */
|
|
934
|
-
] }) : /* @__PURE__ */
|
|
935
|
-
/* @__PURE__ */
|
|
998
|
+
/* @__PURE__ */ jsx(SmallButton, { onClick: () => onFrameSettingsChange({ ...frameSettings, bgImage: null }), children: /* @__PURE__ */ jsx(Trash2, { size: 11, strokeWidth: 2 }) })
|
|
999
|
+
] }) : /* @__PURE__ */ jsxs(SmallButton, { onClick: () => fileInputRef.current?.click(), children: [
|
|
1000
|
+
/* @__PURE__ */ jsx(Upload, { size: 11, strokeWidth: 2 }),
|
|
936
1001
|
"Upload image"
|
|
937
1002
|
] })
|
|
938
1003
|
] }),
|
|
939
|
-
/* @__PURE__ */
|
|
1004
|
+
/* @__PURE__ */ jsxs(
|
|
940
1005
|
"button",
|
|
941
1006
|
{
|
|
942
1007
|
onClick: () => setMoreOpen(!moreOpen),
|
|
@@ -955,7 +1020,7 @@ function BackgroundSetting({
|
|
|
955
1020
|
padding: 0
|
|
956
1021
|
},
|
|
957
1022
|
children: [
|
|
958
|
-
/* @__PURE__ */
|
|
1023
|
+
/* @__PURE__ */ jsx(
|
|
959
1024
|
ChevronDown,
|
|
960
1025
|
{
|
|
961
1026
|
size: 12,
|
|
@@ -970,30 +1035,39 @@ function BackgroundSetting({
|
|
|
970
1035
|
]
|
|
971
1036
|
}
|
|
972
1037
|
),
|
|
973
|
-
moreOpen && /* @__PURE__ */
|
|
974
|
-
/* @__PURE__ */
|
|
975
|
-
/* @__PURE__ */
|
|
976
|
-
/* @__PURE__ */
|
|
977
|
-
/* @__PURE__ */
|
|
1038
|
+
moreOpen && /* @__PURE__ */ jsxs("div", { style: { marginTop: 8 }, children: [
|
|
1039
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
1040
|
+
/* @__PURE__ */ jsx("span", { style: { ...text.label.xs, color: fg.strong }, children: "Size" }),
|
|
1041
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8, marginTop: 8, paddingLeft: 4 }, children: [
|
|
1042
|
+
/* @__PURE__ */ jsx(
|
|
978
1043
|
SlimSlider,
|
|
979
1044
|
{
|
|
980
|
-
min:
|
|
981
|
-
max:
|
|
982
|
-
step:
|
|
983
|
-
value: frameSettings.padding,
|
|
984
|
-
onChange: (v) =>
|
|
1045
|
+
min: 30,
|
|
1046
|
+
max: 100,
|
|
1047
|
+
step: 1,
|
|
1048
|
+
value: Math.round((frameSettings.size.w - frameSettings.padding * 2) / frameSettings.size.w * 100),
|
|
1049
|
+
onChange: (v) => {
|
|
1050
|
+
const pad = Math.round(frameSettings.size.w * (1 - v / 100) / 2);
|
|
1051
|
+
onFrameSettingsChange({ ...frameSettings, padding: pad });
|
|
1052
|
+
}
|
|
985
1053
|
}
|
|
986
1054
|
),
|
|
987
|
-
/* @__PURE__ */
|
|
1055
|
+
/* @__PURE__ */ jsx(
|
|
988
1056
|
SliderInput,
|
|
989
1057
|
{
|
|
990
|
-
|
|
991
|
-
|
|
1058
|
+
min: 30,
|
|
1059
|
+
max: 100,
|
|
1060
|
+
suffix: "%",
|
|
1061
|
+
value: Math.round((frameSettings.size.w - frameSettings.padding * 2) / frameSettings.size.w * 100),
|
|
1062
|
+
onChange: (n) => {
|
|
1063
|
+
const pad = Math.round(frameSettings.size.w * (1 - n / 100) / 2);
|
|
1064
|
+
onFrameSettingsChange({ ...frameSettings, padding: pad });
|
|
1065
|
+
}
|
|
992
1066
|
}
|
|
993
1067
|
)
|
|
994
1068
|
] })
|
|
995
1069
|
] }),
|
|
996
|
-
/* @__PURE__ */
|
|
1070
|
+
/* @__PURE__ */ jsx(
|
|
997
1071
|
FrameSizeControl,
|
|
998
1072
|
{
|
|
999
1073
|
size: frameSettings.size,
|
|
@@ -1028,7 +1102,7 @@ function SlimSlider({
|
|
|
1028
1102
|
if (e.buttons === 0) return;
|
|
1029
1103
|
update(e.clientX);
|
|
1030
1104
|
};
|
|
1031
|
-
return /* @__PURE__ */
|
|
1105
|
+
return /* @__PURE__ */ jsx(
|
|
1032
1106
|
"div",
|
|
1033
1107
|
{
|
|
1034
1108
|
ref: trackRef,
|
|
@@ -1043,9 +1117,9 @@ function SlimSlider({
|
|
|
1043
1117
|
cursor: "pointer",
|
|
1044
1118
|
touchAction: "none"
|
|
1045
1119
|
},
|
|
1046
|
-
children: /* @__PURE__ */
|
|
1047
|
-
/* @__PURE__ */
|
|
1048
|
-
/* @__PURE__ */
|
|
1120
|
+
children: /* @__PURE__ */ jsxs("div", { style: { position: "relative", width: "100%", height: 3, borderRadius: 2, background: stroke.default }, children: [
|
|
1121
|
+
/* @__PURE__ */ jsx("div", { style: { position: "absolute", left: 0, top: 0, height: "100%", width: `${pct}%`, borderRadius: 2, background: fg.sub } }),
|
|
1122
|
+
/* @__PURE__ */ jsx(
|
|
1049
1123
|
"div",
|
|
1050
1124
|
{
|
|
1051
1125
|
style: {
|
|
@@ -1069,7 +1143,7 @@ function PresetSwatch({
|
|
|
1069
1143
|
selected,
|
|
1070
1144
|
onClick
|
|
1071
1145
|
}) {
|
|
1072
|
-
return /* @__PURE__ */
|
|
1146
|
+
return /* @__PURE__ */ jsx(
|
|
1073
1147
|
"div",
|
|
1074
1148
|
{
|
|
1075
1149
|
onClick,
|
|
@@ -1086,7 +1160,7 @@ function PresetSwatch({
|
|
|
1086
1160
|
transition: "outline-color 0.12s ease",
|
|
1087
1161
|
flexShrink: 0
|
|
1088
1162
|
},
|
|
1089
|
-
children: selected && /* @__PURE__ */
|
|
1163
|
+
children: selected && /* @__PURE__ */ jsx(
|
|
1090
1164
|
"div",
|
|
1091
1165
|
{
|
|
1092
1166
|
style: {
|
|
@@ -1098,7 +1172,7 @@ function PresetSwatch({
|
|
|
1098
1172
|
justifyContent: "center",
|
|
1099
1173
|
background: "rgba(0,0,0,0.2)"
|
|
1100
1174
|
},
|
|
1101
|
-
children: /* @__PURE__ */
|
|
1175
|
+
children: /* @__PURE__ */ jsx(Check, { size: 16, strokeWidth: 3, color: "#fff" })
|
|
1102
1176
|
}
|
|
1103
1177
|
)
|
|
1104
1178
|
}
|
|
@@ -1124,22 +1198,19 @@ function BrowserFrameSetting({
|
|
|
1124
1198
|
onUrlChange
|
|
1125
1199
|
}) {
|
|
1126
1200
|
const [moreOpen, setMoreOpen] = useState2(false);
|
|
1127
|
-
const trafficLights = /* @__PURE__ */
|
|
1201
|
+
const trafficLights = /* @__PURE__ */ jsx("div", { style: { display: "flex", gap: 4 }, children: ["#FF5F57", "#FEBC2E", "#28C840"].map((c) => /* @__PURE__ */ jsx("div", { style: { width: 5, height: 5, borderRadius: "50%", background: c } }, c)) });
|
|
1128
1202
|
const themes = [
|
|
1129
1203
|
{ value: "dark", label: "macOS Dark", titleBar: "#1C1C1C", urlBar: "#262626", border: "#333333" },
|
|
1130
1204
|
{ value: "light", label: "macOS Light", titleBar: "#F5F5F5", urlBar: "#FFFFFF", border: "#EBEBEB" }
|
|
1131
1205
|
];
|
|
1132
|
-
return /* @__PURE__ */
|
|
1133
|
-
/* @__PURE__ */
|
|
1134
|
-
/* @__PURE__ */
|
|
1135
|
-
|
|
1136
|
-
/* @__PURE__ */ jsx2("span", { style: { ...text.label.sm, color: fg.strong }, children: "Browser Frame" })
|
|
1137
|
-
] }),
|
|
1138
|
-
/* @__PURE__ */ jsx2(ToggleSwitch, { enabled, onChange: onToggle })
|
|
1206
|
+
return /* @__PURE__ */ jsxs("div", { style: { padding: "14px 0" }, children: [
|
|
1207
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 16 }, children: [
|
|
1208
|
+
/* @__PURE__ */ jsx("span", { style: { ...text.label.xs, color: fg.strong }, children: "Browser frame" }),
|
|
1209
|
+
/* @__PURE__ */ jsx(ToggleSwitch, { enabled, onChange: onToggle })
|
|
1139
1210
|
] }),
|
|
1140
|
-
/* @__PURE__ */
|
|
1211
|
+
/* @__PURE__ */ jsx("div", { style: { display: "flex", gap: 10, marginTop: 12 }, children: themes.map((t) => {
|
|
1141
1212
|
const selected = enabled && theme === t.value;
|
|
1142
|
-
return /* @__PURE__ */
|
|
1213
|
+
return /* @__PURE__ */ jsxs(
|
|
1143
1214
|
"div",
|
|
1144
1215
|
{
|
|
1145
1216
|
onClick: () => onSelect(t.value),
|
|
@@ -1154,7 +1225,7 @@ function BrowserFrameSetting({
|
|
|
1154
1225
|
transition: "border-color 0.12s ease"
|
|
1155
1226
|
},
|
|
1156
1227
|
children: [
|
|
1157
|
-
/* @__PURE__ */
|
|
1228
|
+
/* @__PURE__ */ jsxs(
|
|
1158
1229
|
"div",
|
|
1159
1230
|
{
|
|
1160
1231
|
style: {
|
|
@@ -1169,7 +1240,7 @@ function BrowserFrameSetting({
|
|
|
1169
1240
|
},
|
|
1170
1241
|
children: [
|
|
1171
1242
|
trafficLights,
|
|
1172
|
-
/* @__PURE__ */
|
|
1243
|
+
/* @__PURE__ */ jsx(
|
|
1173
1244
|
"div",
|
|
1174
1245
|
{
|
|
1175
1246
|
style: {
|
|
@@ -1184,8 +1255,8 @@ function BrowserFrameSetting({
|
|
|
1184
1255
|
]
|
|
1185
1256
|
}
|
|
1186
1257
|
),
|
|
1187
|
-
/* @__PURE__ */
|
|
1188
|
-
selected && /* @__PURE__ */
|
|
1258
|
+
/* @__PURE__ */ jsx("div", { style: { textAlign: "center", marginTop: 8, ...text.label.xs, color: fg.default }, children: t.label }),
|
|
1259
|
+
selected && /* @__PURE__ */ jsx(
|
|
1189
1260
|
"div",
|
|
1190
1261
|
{
|
|
1191
1262
|
style: {
|
|
@@ -1200,7 +1271,7 @@ function BrowserFrameSetting({
|
|
|
1200
1271
|
alignItems: "center",
|
|
1201
1272
|
justifyContent: "center"
|
|
1202
1273
|
},
|
|
1203
|
-
children: /* @__PURE__ */
|
|
1274
|
+
children: /* @__PURE__ */ jsx(Check, { size: 10, strokeWidth: 3, color: "#fff" })
|
|
1204
1275
|
}
|
|
1205
1276
|
)
|
|
1206
1277
|
]
|
|
@@ -1208,7 +1279,7 @@ function BrowserFrameSetting({
|
|
|
1208
1279
|
t.value
|
|
1209
1280
|
);
|
|
1210
1281
|
}) }),
|
|
1211
|
-
/* @__PURE__ */
|
|
1282
|
+
/* @__PURE__ */ jsxs(
|
|
1212
1283
|
"button",
|
|
1213
1284
|
{
|
|
1214
1285
|
onClick: () => setMoreOpen(!moreOpen),
|
|
@@ -1226,7 +1297,7 @@ function BrowserFrameSetting({
|
|
|
1226
1297
|
padding: 0
|
|
1227
1298
|
},
|
|
1228
1299
|
children: [
|
|
1229
|
-
/* @__PURE__ */
|
|
1300
|
+
/* @__PURE__ */ jsx(
|
|
1230
1301
|
ChevronDown,
|
|
1231
1302
|
{
|
|
1232
1303
|
size: 12,
|
|
@@ -1241,10 +1312,10 @@ function BrowserFrameSetting({
|
|
|
1241
1312
|
]
|
|
1242
1313
|
}
|
|
1243
1314
|
),
|
|
1244
|
-
moreOpen && /* @__PURE__ */
|
|
1245
|
-
/* @__PURE__ */
|
|
1246
|
-
/* @__PURE__ */
|
|
1247
|
-
/* @__PURE__ */
|
|
1315
|
+
moreOpen && /* @__PURE__ */ jsxs("div", { style: { marginTop: 8 }, children: [
|
|
1316
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
1317
|
+
/* @__PURE__ */ jsx("span", { style: { ...text.label.xs, color: fg.strong }, children: "URL" }),
|
|
1318
|
+
/* @__PURE__ */ jsx(
|
|
1248
1319
|
"div",
|
|
1249
1320
|
{
|
|
1250
1321
|
style: {
|
|
@@ -1256,7 +1327,7 @@ function BrowserFrameSetting({
|
|
|
1256
1327
|
borderRadius: 7,
|
|
1257
1328
|
marginTop: 8
|
|
1258
1329
|
},
|
|
1259
|
-
children: /* @__PURE__ */
|
|
1330
|
+
children: /* @__PURE__ */ jsx(
|
|
1260
1331
|
"input",
|
|
1261
1332
|
{
|
|
1262
1333
|
type: "text",
|
|
@@ -1279,10 +1350,10 @@ function BrowserFrameSetting({
|
|
|
1279
1350
|
}
|
|
1280
1351
|
)
|
|
1281
1352
|
] }),
|
|
1282
|
-
/* @__PURE__ */
|
|
1283
|
-
/* @__PURE__ */
|
|
1284
|
-
/* @__PURE__ */
|
|
1285
|
-
/* @__PURE__ */
|
|
1353
|
+
/* @__PURE__ */ jsxs("div", { style: { marginTop: 12 }, children: [
|
|
1354
|
+
/* @__PURE__ */ jsx("span", { style: { ...text.label.xs, color: fg.strong }, children: "Shadow" }),
|
|
1355
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8, marginTop: 8, paddingLeft: 4 }, children: [
|
|
1356
|
+
/* @__PURE__ */ jsx(
|
|
1286
1357
|
SlimSlider,
|
|
1287
1358
|
{
|
|
1288
1359
|
min: 0,
|
|
@@ -1292,7 +1363,7 @@ function BrowserFrameSetting({
|
|
|
1292
1363
|
onChange: onShadowChange
|
|
1293
1364
|
}
|
|
1294
1365
|
),
|
|
1295
|
-
/* @__PURE__ */
|
|
1366
|
+
/* @__PURE__ */ jsx(
|
|
1296
1367
|
SliderInput,
|
|
1297
1368
|
{
|
|
1298
1369
|
value: shadow2,
|
|
@@ -1304,10 +1375,10 @@ function BrowserFrameSetting({
|
|
|
1304
1375
|
)
|
|
1305
1376
|
] })
|
|
1306
1377
|
] }),
|
|
1307
|
-
/* @__PURE__ */
|
|
1308
|
-
/* @__PURE__ */
|
|
1309
|
-
/* @__PURE__ */
|
|
1310
|
-
/* @__PURE__ */
|
|
1378
|
+
/* @__PURE__ */ jsxs("div", { style: { marginTop: 12 }, children: [
|
|
1379
|
+
/* @__PURE__ */ jsx("span", { style: { ...text.label.xs, color: fg.strong }, children: "Rounding" }),
|
|
1380
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8, marginTop: 8, paddingLeft: 4 }, children: [
|
|
1381
|
+
/* @__PURE__ */ jsx(
|
|
1311
1382
|
SlimSlider,
|
|
1312
1383
|
{
|
|
1313
1384
|
min: 0,
|
|
@@ -1317,7 +1388,7 @@ function BrowserFrameSetting({
|
|
|
1317
1388
|
onChange: onRadiusChange
|
|
1318
1389
|
}
|
|
1319
1390
|
),
|
|
1320
|
-
/* @__PURE__ */
|
|
1391
|
+
/* @__PURE__ */ jsx(
|
|
1321
1392
|
SliderInput,
|
|
1322
1393
|
{
|
|
1323
1394
|
value: radius,
|
|
@@ -1337,7 +1408,7 @@ function SmallButton({
|
|
|
1337
1408
|
onClick
|
|
1338
1409
|
}) {
|
|
1339
1410
|
const [hovered, setHovered] = useState2(false);
|
|
1340
|
-
return /* @__PURE__ */
|
|
1411
|
+
return /* @__PURE__ */ jsx(
|
|
1341
1412
|
"button",
|
|
1342
1413
|
{
|
|
1343
1414
|
onClick,
|
|
@@ -1373,7 +1444,7 @@ function SliderInput({
|
|
|
1373
1444
|
useEffect(() => {
|
|
1374
1445
|
if (!editing) setText(String(value));
|
|
1375
1446
|
}, [editing, value]);
|
|
1376
|
-
return /* @__PURE__ */
|
|
1447
|
+
return /* @__PURE__ */ jsxs(
|
|
1377
1448
|
"div",
|
|
1378
1449
|
{
|
|
1379
1450
|
style: {
|
|
@@ -1387,7 +1458,7 @@ function SliderInput({
|
|
|
1387
1458
|
width: 68
|
|
1388
1459
|
},
|
|
1389
1460
|
children: [
|
|
1390
|
-
/* @__PURE__ */
|
|
1461
|
+
/* @__PURE__ */ jsx(
|
|
1391
1462
|
"input",
|
|
1392
1463
|
{
|
|
1393
1464
|
type: "text",
|
|
@@ -1419,7 +1490,7 @@ function SliderInput({
|
|
|
1419
1490
|
}
|
|
1420
1491
|
}
|
|
1421
1492
|
),
|
|
1422
|
-
suffix && /* @__PURE__ */
|
|
1493
|
+
suffix && /* @__PURE__ */ jsx("span", { style: { ...text.label.xs, color: fg.sub, flexShrink: 0, userSelect: "none", marginLeft: 4 }, children: suffix })
|
|
1423
1494
|
]
|
|
1424
1495
|
}
|
|
1425
1496
|
);
|
|
@@ -1437,7 +1508,7 @@ function ColorHexInput({
|
|
|
1437
1508
|
const hex = raw.startsWith("#") ? raw : `#${raw}`;
|
|
1438
1509
|
if (/^#[0-9a-fA-F]{6}$/.test(hex)) onChange(hex);
|
|
1439
1510
|
};
|
|
1440
|
-
return /* @__PURE__ */
|
|
1511
|
+
return /* @__PURE__ */ jsxs(
|
|
1441
1512
|
"div",
|
|
1442
1513
|
{
|
|
1443
1514
|
style: {
|
|
@@ -1452,8 +1523,8 @@ function ColorHexInput({
|
|
|
1452
1523
|
gap: 6
|
|
1453
1524
|
},
|
|
1454
1525
|
children: [
|
|
1455
|
-
/* @__PURE__ */
|
|
1456
|
-
/* @__PURE__ */
|
|
1526
|
+
/* @__PURE__ */ jsx("span", { style: { ...text.label.xs, color: fg.sub, flexShrink: 0, userSelect: "none" }, children: "#" }),
|
|
1527
|
+
/* @__PURE__ */ jsx(
|
|
1457
1528
|
"input",
|
|
1458
1529
|
{
|
|
1459
1530
|
type: "text",
|
|
@@ -1493,7 +1564,7 @@ function DropItem({
|
|
|
1493
1564
|
onClick,
|
|
1494
1565
|
active
|
|
1495
1566
|
}) {
|
|
1496
|
-
return /* @__PURE__ */
|
|
1567
|
+
return /* @__PURE__ */ jsx(
|
|
1497
1568
|
"button",
|
|
1498
1569
|
{
|
|
1499
1570
|
onClick,
|
|
@@ -1531,30 +1602,31 @@ async function downscaleImage(dataUrl, maxW, maxH) {
|
|
|
1531
1602
|
}
|
|
1532
1603
|
|
|
1533
1604
|
// src/overlay/ui/screenshots-panel.tsx
|
|
1534
|
-
import { Fragment as Fragment2, jsx as
|
|
1535
|
-
function BrowserChromeBar({ theme, url = "localhost" }) {
|
|
1605
|
+
import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1606
|
+
function BrowserChromeBar({ theme, url = "localhost", scale = 1 }) {
|
|
1607
|
+
const s = scale;
|
|
1536
1608
|
const colors = theme === "dark" ? { titleBar: "#1C1C1C", urlBar: "#262626", text: "#7B7B7B", border: "#333333" } : { titleBar: "#F5F5F5", urlBar: "#FFFFFF", text: "#999999", border: "#EBEBEB" };
|
|
1537
|
-
return /* @__PURE__ */
|
|
1538
|
-
/* @__PURE__ */
|
|
1539
|
-
/* @__PURE__ */
|
|
1609
|
+
return /* @__PURE__ */ jsx2("div", { style: { background: colors.titleBar, flexShrink: 0, padding: `${4 * s}px ${6 * s}px` }, children: /* @__PURE__ */ jsxs2("div", { style: { display: "flex", alignItems: "center", gap: 6 * s, height: 14 * s }, children: [
|
|
1610
|
+
/* @__PURE__ */ jsx2("div", { style: { display: "flex", gap: 5 * s, flexShrink: 0 }, children: ["#FF5F57", "#FEBC2E", "#28C840"].map((c) => /* @__PURE__ */ jsx2("div", { style: { width: 6 * s, height: 6 * s, borderRadius: "50%", background: c } }, c)) }),
|
|
1611
|
+
/* @__PURE__ */ jsx2(
|
|
1540
1612
|
"div",
|
|
1541
1613
|
{
|
|
1542
1614
|
style: {
|
|
1543
1615
|
flex: 1,
|
|
1544
|
-
height: 14,
|
|
1616
|
+
height: 14 * s,
|
|
1545
1617
|
background: colors.urlBar,
|
|
1546
|
-
borderRadius: 3,
|
|
1618
|
+
borderRadius: 3 * s,
|
|
1547
1619
|
display: "flex",
|
|
1548
1620
|
alignItems: "center",
|
|
1549
|
-
paddingLeft: 6,
|
|
1621
|
+
paddingLeft: 6 * s,
|
|
1550
1622
|
...theme === "light" ? { border: `1px solid ${colors.border}` } : {},
|
|
1551
1623
|
boxSizing: "border-box"
|
|
1552
1624
|
},
|
|
1553
|
-
children: /* @__PURE__ */
|
|
1625
|
+
children: /* @__PURE__ */ jsx2(
|
|
1554
1626
|
"span",
|
|
1555
1627
|
{
|
|
1556
1628
|
style: {
|
|
1557
|
-
fontSize: 7,
|
|
1629
|
+
fontSize: 7 * s,
|
|
1558
1630
|
lineHeight: 1,
|
|
1559
1631
|
color: colors.text,
|
|
1560
1632
|
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif'
|
|
@@ -1570,7 +1642,12 @@ function FramePreview({
|
|
|
1570
1642
|
componentUrl,
|
|
1571
1643
|
viewportUrl,
|
|
1572
1644
|
frameSettings,
|
|
1573
|
-
loading
|
|
1645
|
+
loading,
|
|
1646
|
+
afterbeforeMode,
|
|
1647
|
+
beforeUrl,
|
|
1648
|
+
afterUrl,
|
|
1649
|
+
activeSlot: activeSlotProp,
|
|
1650
|
+
onSlotClick
|
|
1574
1651
|
}) {
|
|
1575
1652
|
const { enabled: frameEnabled, browserChrome, browserTheme, browserUrl, browserShadow = 50, browserRadius = 8, size, bgType, bgColor, bgGradient, bgImage, padding } = frameSettings;
|
|
1576
1653
|
const [viewportAvailable, setViewportAvailable] = useState3(true);
|
|
@@ -1580,8 +1657,9 @@ function FramePreview({
|
|
|
1580
1657
|
const previewUrl = browserChrome && viewportUrl && viewportAvailable ? viewportUrl : componentUrl;
|
|
1581
1658
|
const aspectRatio = frameEnabled ? `${size.w} / ${size.h}` : "16 / 10";
|
|
1582
1659
|
const outerBg = frameEnabled ? bgType === "image" && bgImage ? { backgroundImage: `url(${bgImage})`, backgroundSize: "cover", backgroundPosition: "center" } : bgType === "gradient" ? { background: bgGradient } : { background: bgColor } : { background: bg.elevated };
|
|
1583
|
-
const emptyState = /* @__PURE__ */
|
|
1584
|
-
const
|
|
1660
|
+
const emptyState = /* @__PURE__ */ jsx2("span", { style: { ...text.paragraph.xs, color: fg.sub }, children: loading ? "Loading..." : "No screenshots yet" });
|
|
1661
|
+
const imageStyle = { maxWidth: "100%", maxHeight: "100%", objectFit: "contain", display: "block" };
|
|
1662
|
+
const imageEl = previewUrl ? /* @__PURE__ */ jsx2(
|
|
1585
1663
|
"img",
|
|
1586
1664
|
{
|
|
1587
1665
|
src: previewUrl,
|
|
@@ -1591,20 +1669,79 @@ function FramePreview({
|
|
|
1591
1669
|
setViewportAvailable(false);
|
|
1592
1670
|
}
|
|
1593
1671
|
},
|
|
1594
|
-
style:
|
|
1595
|
-
maxWidth: "100%",
|
|
1596
|
-
maxHeight: "100%",
|
|
1597
|
-
objectFit: "contain",
|
|
1598
|
-
display: "block"
|
|
1599
|
-
}
|
|
1672
|
+
style: imageStyle
|
|
1600
1673
|
}
|
|
1601
1674
|
) : null;
|
|
1602
|
-
const
|
|
1675
|
+
const padStyle = frameEnabled && !browserChrome ? `${padding / size.h * 100}%` : void 0;
|
|
1676
|
+
const chromeScale = frameEnabled ? Math.max(0.3, (size.w - padding * 2) / size.w) : 1;
|
|
1677
|
+
const chromeWidthPct = frameEnabled ? `${chromeScale * 100}%` : "100%";
|
|
1678
|
+
const chromePadY = frameEnabled ? `${padding / size.w * 100}%` : void 0;
|
|
1603
1679
|
const shadowAlpha = browserShadow / 100 * 0.6;
|
|
1604
1680
|
const shadowBlur = browserShadow / 100 * 40;
|
|
1605
1681
|
const shadowY = browserShadow / 100 * 8;
|
|
1606
1682
|
const browserBoxShadow = browserChrome && browserShadow > 0 ? `0 ${shadowY}px ${shadowBlur}px rgba(0, 0, 0, ${shadowAlpha})` : "none";
|
|
1607
|
-
|
|
1683
|
+
if (afterbeforeMode) {
|
|
1684
|
+
return /* @__PURE__ */ jsx2(
|
|
1685
|
+
"div",
|
|
1686
|
+
{
|
|
1687
|
+
style: {
|
|
1688
|
+
width: "100%",
|
|
1689
|
+
aspectRatio: "1920 / 1080",
|
|
1690
|
+
borderRadius: 10,
|
|
1691
|
+
overflow: "hidden",
|
|
1692
|
+
border: `1px solid ${stroke.soft}`,
|
|
1693
|
+
marginBottom: 10,
|
|
1694
|
+
display: "flex",
|
|
1695
|
+
alignItems: "center",
|
|
1696
|
+
justifyContent: "center",
|
|
1697
|
+
gap: "2%",
|
|
1698
|
+
padding: "5%",
|
|
1699
|
+
...outerBg
|
|
1700
|
+
},
|
|
1701
|
+
children: ["before", "after"].map((slot) => {
|
|
1702
|
+
const url = slot === "before" ? beforeUrl : afterUrl;
|
|
1703
|
+
const isActive = activeSlotProp === slot;
|
|
1704
|
+
return /* @__PURE__ */ jsxs2(
|
|
1705
|
+
"div",
|
|
1706
|
+
{
|
|
1707
|
+
onClick: () => onSlotClick?.(slot),
|
|
1708
|
+
style: {
|
|
1709
|
+
flex: 1,
|
|
1710
|
+
display: "flex",
|
|
1711
|
+
flexDirection: "column",
|
|
1712
|
+
alignItems: "center",
|
|
1713
|
+
gap: 8,
|
|
1714
|
+
cursor: "pointer"
|
|
1715
|
+
},
|
|
1716
|
+
children: [
|
|
1717
|
+
/* @__PURE__ */ jsx2(
|
|
1718
|
+
"div",
|
|
1719
|
+
{
|
|
1720
|
+
style: {
|
|
1721
|
+
width: "100%",
|
|
1722
|
+
aspectRatio: "16 / 10",
|
|
1723
|
+
borderRadius: 6,
|
|
1724
|
+
border: isActive ? `2px solid ${accent.highlight}` : url ? `1px solid ${stroke.soft}` : `2px dashed ${stroke.interactive}`,
|
|
1725
|
+
overflow: "hidden",
|
|
1726
|
+
display: "flex",
|
|
1727
|
+
alignItems: "center",
|
|
1728
|
+
justifyContent: "center",
|
|
1729
|
+
background: "rgba(0, 0, 0, 0.1)",
|
|
1730
|
+
transition: "border-color 0.12s ease"
|
|
1731
|
+
},
|
|
1732
|
+
children: url ? /* @__PURE__ */ jsx2("img", { src: url, alt: "", style: { width: "100%", height: "100%", objectFit: "cover", display: "block" } }) : /* @__PURE__ */ jsx2("span", { style: { ...text.paragraph.xs, color: fg.muted }, children: "Click to assign" })
|
|
1733
|
+
}
|
|
1734
|
+
),
|
|
1735
|
+
/* @__PURE__ */ jsx2("span", { style: { ...text.label.xs, color: fg.sub }, children: slot === "before" ? "Before" : "After" })
|
|
1736
|
+
]
|
|
1737
|
+
},
|
|
1738
|
+
slot
|
|
1739
|
+
);
|
|
1740
|
+
})
|
|
1741
|
+
}
|
|
1742
|
+
);
|
|
1743
|
+
}
|
|
1744
|
+
return /* @__PURE__ */ jsx2(
|
|
1608
1745
|
"div",
|
|
1609
1746
|
{
|
|
1610
1747
|
style: {
|
|
@@ -1617,24 +1754,25 @@ function FramePreview({
|
|
|
1617
1754
|
display: "flex",
|
|
1618
1755
|
flexDirection: "column",
|
|
1619
1756
|
...outerBg,
|
|
1620
|
-
...
|
|
1757
|
+
...padStyle ? { padding: padStyle } : {}
|
|
1621
1758
|
},
|
|
1622
|
-
children: browserChrome ? /* @__PURE__ */
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1759
|
+
children: browserChrome ? /* @__PURE__ */ jsx2(
|
|
1760
|
+
"div",
|
|
1761
|
+
{
|
|
1762
|
+
style: {
|
|
1763
|
+
display: "flex",
|
|
1764
|
+
flexDirection: "column",
|
|
1765
|
+
alignItems: "center",
|
|
1766
|
+
justifyContent: "center",
|
|
1767
|
+
flex: 1,
|
|
1768
|
+
minHeight: 0
|
|
1769
|
+
},
|
|
1770
|
+
children: /* @__PURE__ */ jsxs2("div", { style: { width: chromeWidthPct, display: "flex", flexDirection: "column", borderRadius: browserRadius * chromeScale, overflow: "hidden", boxShadow: browserBoxShadow }, children: [
|
|
1771
|
+
/* @__PURE__ */ jsx2(BrowserChromeBar, { theme: browserTheme, url: browserUrl, scale: chromeScale }),
|
|
1772
|
+
/* @__PURE__ */ jsx2("div", { style: { display: "flex", alignItems: "center", justifyContent: "center" }, children: imageEl || emptyState })
|
|
1773
|
+
] })
|
|
1774
|
+
}
|
|
1775
|
+
) : /* @__PURE__ */ jsx2(
|
|
1638
1776
|
"div",
|
|
1639
1777
|
{
|
|
1640
1778
|
style: {
|
|
@@ -1685,6 +1823,16 @@ function ScreenshotsPanel({
|
|
|
1685
1823
|
const [editingFile, setEditingFile] = useState3(null);
|
|
1686
1824
|
const [editValue, setEditValue] = useState3("");
|
|
1687
1825
|
const [selectedFile, setSelectedFile] = useState3(null);
|
|
1826
|
+
const [beforeFile, setBeforeFile] = useState3(null);
|
|
1827
|
+
const [afterFile, setAfterFile] = useState3(null);
|
|
1828
|
+
const [activeSlot, setActiveSlot] = useState3("before");
|
|
1829
|
+
useEffect2(() => {
|
|
1830
|
+
if (!frameSettings.afterbefore) {
|
|
1831
|
+
setBeforeFile(null);
|
|
1832
|
+
setAfterFile(null);
|
|
1833
|
+
setActiveSlot("before");
|
|
1834
|
+
}
|
|
1835
|
+
}, [frameSettings.afterbefore]);
|
|
1688
1836
|
useEffect2(() => {
|
|
1689
1837
|
if (!open) return;
|
|
1690
1838
|
fetch("/__afterbefore/config").then((r) => r.json()).then((data) => setSaveDir(data.saveDir)).catch(() => {
|
|
@@ -1792,12 +1940,73 @@ function ScreenshotsPanel({
|
|
|
1792
1940
|
showToast("Delete failed", "error");
|
|
1793
1941
|
}
|
|
1794
1942
|
};
|
|
1943
|
+
const [saving, setSaving] = useState3(false);
|
|
1944
|
+
const toDataUrl = async (url) => {
|
|
1945
|
+
const r = await fetch(url);
|
|
1946
|
+
if (!r.ok) throw new Error("Failed to load image");
|
|
1947
|
+
const b = await r.blob();
|
|
1948
|
+
return new Promise((resolve) => {
|
|
1949
|
+
const reader = new FileReader();
|
|
1950
|
+
reader.onloadend = () => resolve(reader.result);
|
|
1951
|
+
reader.readAsDataURL(b);
|
|
1952
|
+
});
|
|
1953
|
+
};
|
|
1954
|
+
const makeImageUrl = (file) => `/__afterbefore/history/image?repo=${encodeURIComponent(selectedRepo || "")}&branch=${encodeURIComponent(selectedBranch || "")}&file=${encodeURIComponent(file)}`;
|
|
1955
|
+
const handleSave = async () => {
|
|
1956
|
+
if (saving) return;
|
|
1957
|
+
if (frameSettings.afterbefore) {
|
|
1958
|
+
if (!beforeFile || !afterFile) return;
|
|
1959
|
+
setSaving(true);
|
|
1960
|
+
try {
|
|
1961
|
+
const beforeDataUrl = await toDataUrl(makeImageUrl(beforeFile));
|
|
1962
|
+
const afterDataUrl = await toDataUrl(makeImageUrl(afterFile));
|
|
1963
|
+
const renderedDataUrl = await renderAfterbeforeFrame(beforeDataUrl, afterDataUrl, frameSettings);
|
|
1964
|
+
const saveRes = await fetch("/__afterbefore/save", {
|
|
1965
|
+
method: "POST",
|
|
1966
|
+
headers: { "Content-Type": "application/json" },
|
|
1967
|
+
body: JSON.stringify({ mode: "resave", image: renderedDataUrl, rawImage: beforeDataUrl })
|
|
1968
|
+
});
|
|
1969
|
+
if (!saveRes.ok) throw new Error("Save failed");
|
|
1970
|
+
showToast("Saved to desktop", "success");
|
|
1971
|
+
} catch {
|
|
1972
|
+
showToast("Save failed", "error");
|
|
1973
|
+
} finally {
|
|
1974
|
+
setSaving(false);
|
|
1975
|
+
}
|
|
1976
|
+
return;
|
|
1977
|
+
}
|
|
1978
|
+
if (!selectedFile) return;
|
|
1979
|
+
setSaving(true);
|
|
1980
|
+
try {
|
|
1981
|
+
const baseUrl = makeImageUrl(selectedFile);
|
|
1982
|
+
const rawDataUrl = await toDataUrl(baseUrl);
|
|
1983
|
+
let primaryDataUrl = rawDataUrl;
|
|
1984
|
+
if (frameSettings.browserChrome) {
|
|
1985
|
+
try {
|
|
1986
|
+
primaryDataUrl = await toDataUrl(`${baseUrl}&variant=viewport`);
|
|
1987
|
+
} catch {
|
|
1988
|
+
}
|
|
1989
|
+
}
|
|
1990
|
+
const renderedDataUrl = await renderFrame(primaryDataUrl, frameSettings);
|
|
1991
|
+
const saveRes = await fetch("/__afterbefore/save", {
|
|
1992
|
+
method: "POST",
|
|
1993
|
+
headers: { "Content-Type": "application/json" },
|
|
1994
|
+
body: JSON.stringify({ mode: "resave", image: renderedDataUrl, rawImage: rawDataUrl })
|
|
1995
|
+
});
|
|
1996
|
+
if (!saveRes.ok) throw new Error("Save failed");
|
|
1997
|
+
showToast("Saved to desktop", "success");
|
|
1998
|
+
} catch {
|
|
1999
|
+
showToast("Save failed", "error");
|
|
2000
|
+
} finally {
|
|
2001
|
+
setSaving(false);
|
|
2002
|
+
}
|
|
2003
|
+
};
|
|
1795
2004
|
const baseImageUrl = selectedFile ? `/__afterbefore/history/image?repo=${encodeURIComponent(selectedRepo || "")}&branch=${encodeURIComponent(selectedBranch || "")}&file=${encodeURIComponent(selectedFile)}` : null;
|
|
1796
2005
|
const viewportUrl = baseImageUrl ? `${baseImageUrl}&variant=viewport` : null;
|
|
1797
|
-
return /* @__PURE__ */
|
|
1798
|
-
/* @__PURE__ */
|
|
2006
|
+
return /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
2007
|
+
/* @__PURE__ */ jsx2(IconButton, { active: open, tooltipSide, tooltip: !open ? "Screenshots" : void 0, onClick, children: /* @__PURE__ */ jsx2(ImageIcon, { size: 18, strokeWidth: 1.7 }) }),
|
|
1799
2008
|
open && createPortal(
|
|
1800
|
-
/* @__PURE__ */
|
|
2009
|
+
/* @__PURE__ */ jsxs2(
|
|
1801
2010
|
"div",
|
|
1802
2011
|
{
|
|
1803
2012
|
"data-afterbefore": "true",
|
|
@@ -1813,7 +2022,7 @@ function ScreenshotsPanel({
|
|
|
1813
2022
|
...fontBase
|
|
1814
2023
|
},
|
|
1815
2024
|
children: [
|
|
1816
|
-
/* @__PURE__ */
|
|
2025
|
+
/* @__PURE__ */ jsx2(
|
|
1817
2026
|
"style",
|
|
1818
2027
|
{
|
|
1819
2028
|
dangerouslySetInnerHTML: {
|
|
@@ -1826,13 +2035,13 @@ function ScreenshotsPanel({
|
|
|
1826
2035
|
}
|
|
1827
2036
|
}
|
|
1828
2037
|
),
|
|
1829
|
-
/* @__PURE__ */
|
|
2038
|
+
/* @__PURE__ */ jsxs2(
|
|
1830
2039
|
"div",
|
|
1831
2040
|
{
|
|
1832
2041
|
onClick: (e) => e.stopPropagation(),
|
|
1833
2042
|
style: {
|
|
1834
2043
|
width: 900,
|
|
1835
|
-
height: "
|
|
2044
|
+
height: "60vh",
|
|
1836
2045
|
borderRadius: 14,
|
|
1837
2046
|
background: bg.base,
|
|
1838
2047
|
border: `1px solid ${stroke.default}`,
|
|
@@ -1843,18 +2052,18 @@ function ScreenshotsPanel({
|
|
|
1843
2052
|
animation: "ab-panel-in 150ms cubic-bezier(0.23, 1, 0.32, 1)"
|
|
1844
2053
|
},
|
|
1845
2054
|
children: [
|
|
1846
|
-
/* @__PURE__ */
|
|
2055
|
+
/* @__PURE__ */ jsxs2("div", { style: {
|
|
1847
2056
|
display: "flex",
|
|
1848
2057
|
alignItems: "center",
|
|
1849
2058
|
justifyContent: "space-between",
|
|
1850
2059
|
padding: "16px 20px",
|
|
1851
2060
|
borderBottom: `1px solid ${stroke.soft}`
|
|
1852
2061
|
}, children: [
|
|
1853
|
-
/* @__PURE__ */
|
|
1854
|
-
/* @__PURE__ */
|
|
1855
|
-
/* @__PURE__ */
|
|
2062
|
+
/* @__PURE__ */ jsxs2("div", { children: [
|
|
2063
|
+
/* @__PURE__ */ jsx2("div", { style: { ...text.label.sm, color: fg.strong }, children: "Screenshots" }),
|
|
2064
|
+
/* @__PURE__ */ jsx2("div", { style: { ...text.paragraph.xs, color: fg.sub, marginTop: 2 }, children: "Capture history & settings" })
|
|
1856
2065
|
] }),
|
|
1857
|
-
/* @__PURE__ */
|
|
2066
|
+
/* @__PURE__ */ jsx2(
|
|
1858
2067
|
"button",
|
|
1859
2068
|
{
|
|
1860
2069
|
onClick,
|
|
@@ -1880,28 +2089,33 @@ function ScreenshotsPanel({
|
|
|
1880
2089
|
e.currentTarget.style.background = "transparent";
|
|
1881
2090
|
e.currentTarget.style.color = fg.sub;
|
|
1882
2091
|
},
|
|
1883
|
-
children: /* @__PURE__ */
|
|
2092
|
+
children: /* @__PURE__ */ jsx2(X, { size: 14, strokeWidth: 2 })
|
|
1884
2093
|
}
|
|
1885
2094
|
)
|
|
1886
2095
|
] }),
|
|
1887
|
-
/* @__PURE__ */
|
|
1888
|
-
/* @__PURE__ */
|
|
1889
|
-
/* @__PURE__ */
|
|
2096
|
+
/* @__PURE__ */ jsxs2("div", { style: { display: "flex", flex: 1, overflow: "hidden", minHeight: 0, position: "relative" }, children: [
|
|
2097
|
+
/* @__PURE__ */ jsxs2("div", { style: { flex: 1, overflowY: "auto", padding: "16px 20px 20px", minHeight: 0, marginRight: 301 }, children: [
|
|
2098
|
+
/* @__PURE__ */ jsx2(
|
|
1890
2099
|
FramePreview,
|
|
1891
2100
|
{
|
|
1892
2101
|
componentUrl: baseImageUrl,
|
|
1893
2102
|
viewportUrl,
|
|
1894
2103
|
frameSettings,
|
|
1895
|
-
loading
|
|
2104
|
+
loading,
|
|
2105
|
+
afterbeforeMode: frameSettings.afterbefore,
|
|
2106
|
+
beforeUrl: beforeFile ? `/__afterbefore/history/image?repo=${encodeURIComponent(selectedRepo || "")}&branch=${encodeURIComponent(selectedBranch || "")}&file=${encodeURIComponent(beforeFile)}` : null,
|
|
2107
|
+
afterUrl: afterFile ? `/__afterbefore/history/image?repo=${encodeURIComponent(selectedRepo || "")}&branch=${encodeURIComponent(selectedBranch || "")}&file=${encodeURIComponent(afterFile)}` : null,
|
|
2108
|
+
activeSlot,
|
|
2109
|
+
onSlotClick: setActiveSlot
|
|
1896
2110
|
}
|
|
1897
2111
|
),
|
|
1898
|
-
selectedFile && !loading && /* @__PURE__ */
|
|
2112
|
+
!frameSettings.afterbefore && selectedFile && !loading && /* @__PURE__ */ jsxs2("div", { style: {
|
|
1899
2113
|
display: "flex",
|
|
1900
2114
|
alignItems: "center",
|
|
1901
2115
|
gap: 8,
|
|
1902
2116
|
marginBottom: 12
|
|
1903
2117
|
}, children: [
|
|
1904
|
-
/* @__PURE__ */
|
|
2118
|
+
/* @__PURE__ */ jsx2("div", { style: { flex: 1, minWidth: 0 }, children: editingFile === selectedFile ? /* @__PURE__ */ jsx2(
|
|
1905
2119
|
"input",
|
|
1906
2120
|
{
|
|
1907
2121
|
autoFocus: true,
|
|
@@ -1924,7 +2138,7 @@ function ScreenshotsPanel({
|
|
|
1924
2138
|
fontFamily: "inherit"
|
|
1925
2139
|
}
|
|
1926
2140
|
}
|
|
1927
|
-
) : /* @__PURE__ */
|
|
2141
|
+
) : /* @__PURE__ */ jsx2(
|
|
1928
2142
|
"div",
|
|
1929
2143
|
{
|
|
1930
2144
|
onClick: () => {
|
|
@@ -1943,7 +2157,7 @@ function ScreenshotsPanel({
|
|
|
1943
2157
|
children: formatTimestamp(selectedFile)
|
|
1944
2158
|
}
|
|
1945
2159
|
) }),
|
|
1946
|
-
/* @__PURE__ */
|
|
2160
|
+
/* @__PURE__ */ jsx2(
|
|
1947
2161
|
"button",
|
|
1948
2162
|
{
|
|
1949
2163
|
onClick: () => handleDelete(selectedFile),
|
|
@@ -1970,12 +2184,12 @@ function ScreenshotsPanel({
|
|
|
1970
2184
|
e.currentTarget.style.color = fg.muted;
|
|
1971
2185
|
e.currentTarget.style.background = "transparent";
|
|
1972
2186
|
},
|
|
1973
|
-
children: /* @__PURE__ */
|
|
2187
|
+
children: /* @__PURE__ */ jsx2(Trash22, { size: 14, strokeWidth: 1.8 })
|
|
1974
2188
|
}
|
|
1975
2189
|
)
|
|
1976
2190
|
] }),
|
|
1977
|
-
/* @__PURE__ */
|
|
1978
|
-
/* @__PURE__ */
|
|
2191
|
+
/* @__PURE__ */ jsxs2("div", { style: { display: "flex", gap: 10, marginBottom: 10 }, children: [
|
|
2192
|
+
/* @__PURE__ */ jsx2("div", { style: { flex: 1, position: "relative" }, children: /* @__PURE__ */ jsx2(
|
|
1979
2193
|
FilterDropdown,
|
|
1980
2194
|
{
|
|
1981
2195
|
label: "Project",
|
|
@@ -1993,7 +2207,7 @@ function ScreenshotsPanel({
|
|
|
1993
2207
|
}
|
|
1994
2208
|
}
|
|
1995
2209
|
) }),
|
|
1996
|
-
/* @__PURE__ */
|
|
2210
|
+
/* @__PURE__ */ jsx2("div", { style: { flex: 1, position: "relative" }, children: /* @__PURE__ */ jsx2(
|
|
1997
2211
|
FilterDropdown,
|
|
1998
2212
|
{
|
|
1999
2213
|
label: "Branch",
|
|
@@ -2011,7 +2225,7 @@ function ScreenshotsPanel({
|
|
|
2011
2225
|
}
|
|
2012
2226
|
) })
|
|
2013
2227
|
] }),
|
|
2014
|
-
screenshots.length > 0 && /* @__PURE__ */
|
|
2228
|
+
screenshots.length > 0 && /* @__PURE__ */ jsx2(
|
|
2015
2229
|
"div",
|
|
2016
2230
|
{
|
|
2017
2231
|
style: {
|
|
@@ -2023,12 +2237,25 @@ function ScreenshotsPanel({
|
|
|
2023
2237
|
},
|
|
2024
2238
|
children: screenshots.map((shot) => {
|
|
2025
2239
|
const thumbUrl = `/__afterbefore/history/image?repo=${encodeURIComponent(selectedRepo || "")}&branch=${encodeURIComponent(selectedBranch || "")}&file=${encodeURIComponent(shot.filename)}`;
|
|
2026
|
-
const isSelected = selectedFile === shot.filename;
|
|
2027
|
-
|
|
2240
|
+
const isSelected = frameSettings.afterbefore ? shot.filename === beforeFile || shot.filename === afterFile : selectedFile === shot.filename;
|
|
2241
|
+
const slotBadge = frameSettings.afterbefore ? shot.filename === beforeFile ? "B" : shot.filename === afterFile ? "A" : null : null;
|
|
2242
|
+
return /* @__PURE__ */ jsxs2(
|
|
2028
2243
|
"div",
|
|
2029
2244
|
{
|
|
2030
|
-
onClick: () =>
|
|
2245
|
+
onClick: () => {
|
|
2246
|
+
if (frameSettings.afterbefore) {
|
|
2247
|
+
if (activeSlot === "before") {
|
|
2248
|
+
setBeforeFile(shot.filename);
|
|
2249
|
+
setActiveSlot("after");
|
|
2250
|
+
} else {
|
|
2251
|
+
setAfterFile(shot.filename);
|
|
2252
|
+
}
|
|
2253
|
+
} else {
|
|
2254
|
+
setSelectedFile(shot.filename);
|
|
2255
|
+
}
|
|
2256
|
+
},
|
|
2031
2257
|
style: {
|
|
2258
|
+
position: "relative",
|
|
2032
2259
|
width: 64,
|
|
2033
2260
|
height: 44,
|
|
2034
2261
|
flexShrink: 0,
|
|
@@ -2039,19 +2266,36 @@ function ScreenshotsPanel({
|
|
|
2039
2266
|
opacity: isSelected ? 1 : 0.7,
|
|
2040
2267
|
transition: "opacity 0.12s ease, border-color 0.12s ease"
|
|
2041
2268
|
},
|
|
2042
|
-
children:
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2269
|
+
children: [
|
|
2270
|
+
/* @__PURE__ */ jsx2(
|
|
2271
|
+
"img",
|
|
2272
|
+
{
|
|
2273
|
+
src: thumbUrl,
|
|
2274
|
+
alt: "",
|
|
2275
|
+
style: {
|
|
2276
|
+
width: "100%",
|
|
2277
|
+
height: "100%",
|
|
2278
|
+
objectFit: "cover",
|
|
2279
|
+
display: "block"
|
|
2280
|
+
}
|
|
2052
2281
|
}
|
|
2053
|
-
|
|
2054
|
-
|
|
2282
|
+
),
|
|
2283
|
+
slotBadge && /* @__PURE__ */ jsx2("div", { style: {
|
|
2284
|
+
position: "absolute",
|
|
2285
|
+
top: 2,
|
|
2286
|
+
left: 2,
|
|
2287
|
+
width: 16,
|
|
2288
|
+
height: 16,
|
|
2289
|
+
borderRadius: 4,
|
|
2290
|
+
background: accent.highlight,
|
|
2291
|
+
color: "#fff",
|
|
2292
|
+
fontSize: 9,
|
|
2293
|
+
fontWeight: 600,
|
|
2294
|
+
display: "flex",
|
|
2295
|
+
alignItems: "center",
|
|
2296
|
+
justifyContent: "center"
|
|
2297
|
+
}, children: slotBadge })
|
|
2298
|
+
]
|
|
2055
2299
|
},
|
|
2056
2300
|
shot.filename
|
|
2057
2301
|
);
|
|
@@ -2059,59 +2303,46 @@ function ScreenshotsPanel({
|
|
|
2059
2303
|
}
|
|
2060
2304
|
)
|
|
2061
2305
|
] }),
|
|
2062
|
-
/* @__PURE__ */
|
|
2063
|
-
|
|
2064
|
-
/* @__PURE__ */
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
frameSettings,
|
|
2068
|
-
onFrameSettingsChange,
|
|
2069
|
-
saveDir: shortDir,
|
|
2070
|
-
picking,
|
|
2071
|
-
onPickFolder: handlePickFolder
|
|
2072
|
-
}
|
|
2073
|
-
) }),
|
|
2074
|
-
/* @__PURE__ */ jsxs3("div", { style: { display: "flex", alignItems: "center", gap: 8, paddingTop: 12, paddingBottom: 2, marginTop: 12, borderTop: `1px solid ${stroke.soft}`, marginLeft: -16, marginRight: -16, paddingLeft: 16 }, children: [
|
|
2075
|
-
/* @__PURE__ */ jsx3("span", { style: { ...text.paragraph.xs, color: fg.muted }, children: "made by Paulius Kairevicius" }),
|
|
2076
|
-
/* @__PURE__ */ jsx3(
|
|
2077
|
-
"a",
|
|
2306
|
+
/* @__PURE__ */ jsxs2("div", { style: { position: "absolute", top: 0, right: 0, bottom: 0, width: 301, display: "flex", overflow: "hidden" }, children: [
|
|
2307
|
+
/* @__PURE__ */ jsx2("div", { style: { width: 1, flexShrink: 0, background: stroke.soft } }),
|
|
2308
|
+
/* @__PURE__ */ jsxs2("div", { style: { flex: 1, display: "flex", flexDirection: "column", overflow: "hidden" }, children: [
|
|
2309
|
+
/* @__PURE__ */ jsx2("div", { style: { flex: 1, overflowY: "auto", padding: "16px 16px 12px", minHeight: 0 }, children: /* @__PURE__ */ jsx2(
|
|
2310
|
+
SettingsContent,
|
|
2078
2311
|
{
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
e.currentTarget.style.color = fg.strong;
|
|
2085
|
-
},
|
|
2086
|
-
onMouseLeave: (e) => {
|
|
2087
|
-
e.currentTarget.style.color = fg.muted;
|
|
2088
|
-
},
|
|
2089
|
-
children: /* @__PURE__ */ jsx3("svg", { width: "13", height: "13", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx3("path", { d: "M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12z" }) })
|
|
2312
|
+
frameSettings,
|
|
2313
|
+
onFrameSettingsChange,
|
|
2314
|
+
saveDir: shortDir,
|
|
2315
|
+
picking,
|
|
2316
|
+
onPickFolder: handlePickFolder
|
|
2090
2317
|
}
|
|
2091
|
-
),
|
|
2092
|
-
/* @__PURE__ */
|
|
2093
|
-
"
|
|
2318
|
+
) }),
|
|
2319
|
+
(frameSettings.afterbefore ? beforeFile && afterFile : selectedFile) && /* @__PURE__ */ jsx2("div", { style: { flexShrink: 0, padding: "12px 16px", borderTop: `1px solid ${stroke.soft}` }, children: /* @__PURE__ */ jsx2(
|
|
2320
|
+
"button",
|
|
2094
2321
|
{
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2322
|
+
onClick: handleSave,
|
|
2323
|
+
disabled: saving,
|
|
2324
|
+
style: {
|
|
2325
|
+
width: "100%",
|
|
2326
|
+
padding: "8px 0",
|
|
2327
|
+
borderRadius: 8,
|
|
2328
|
+
border: "none",
|
|
2329
|
+
background: accent.toggle,
|
|
2330
|
+
color: "#fff",
|
|
2331
|
+
...text.label.xs,
|
|
2332
|
+
cursor: saving ? "default" : "pointer",
|
|
2333
|
+
opacity: saving ? 0.6 : 1,
|
|
2334
|
+
transition: "opacity 0.12s ease"
|
|
2104
2335
|
},
|
|
2105
|
-
children:
|
|
2336
|
+
children: saving ? "Saving..." : "Save"
|
|
2106
2337
|
}
|
|
2107
|
-
)
|
|
2338
|
+
) })
|
|
2108
2339
|
] })
|
|
2109
2340
|
] })
|
|
2110
2341
|
] })
|
|
2111
2342
|
]
|
|
2112
2343
|
}
|
|
2113
2344
|
),
|
|
2114
|
-
toast && /* @__PURE__ */
|
|
2345
|
+
toast && /* @__PURE__ */ jsx2(
|
|
2115
2346
|
"div",
|
|
2116
2347
|
{
|
|
2117
2348
|
onClick: (e) => e.stopPropagation(),
|
|
@@ -2140,7 +2371,7 @@ function ScreenshotsPanel({
|
|
|
2140
2371
|
}
|
|
2141
2372
|
|
|
2142
2373
|
// src/overlay/ui/toolbar.tsx
|
|
2143
|
-
import { Fragment as Fragment3, jsx as
|
|
2374
|
+
import { Fragment as Fragment3, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
2144
2375
|
var TOOLTIP_DELAY = 500;
|
|
2145
2376
|
var TOOLTIP_COOLDOWN = 300;
|
|
2146
2377
|
var tooltipWarm = false;
|
|
@@ -2224,11 +2455,6 @@ function getCornerPosition(corner, w, h) {
|
|
|
2224
2455
|
return { x: EDGE_MARGIN, y: EDGE_MARGIN };
|
|
2225
2456
|
}
|
|
2226
2457
|
}
|
|
2227
|
-
var MODES = [
|
|
2228
|
-
{ mode: "component", label: "Component", icon: CameraIcon },
|
|
2229
|
-
{ mode: "viewport", label: "Viewport", icon: Monitor },
|
|
2230
|
-
{ mode: "fullpage", label: "Full Page", icon: FileText }
|
|
2231
|
-
];
|
|
2232
2458
|
function Toolbar({
|
|
2233
2459
|
expanded,
|
|
2234
2460
|
onToggle,
|
|
@@ -2243,6 +2469,16 @@ function Toolbar({
|
|
|
2243
2469
|
}) {
|
|
2244
2470
|
const [historyOpen, setHistoryOpen] = useState4(false);
|
|
2245
2471
|
const [modesExpanded, setModesExpanded] = useState4(false);
|
|
2472
|
+
useEffect3(() => {
|
|
2473
|
+
if (phase === "ready") {
|
|
2474
|
+
try {
|
|
2475
|
+
if (localStorage.getItem("ab-auto-open-panel") !== "false") {
|
|
2476
|
+
setHistoryOpen(true);
|
|
2477
|
+
}
|
|
2478
|
+
} catch {
|
|
2479
|
+
}
|
|
2480
|
+
}
|
|
2481
|
+
}, [phase]);
|
|
2246
2482
|
const [buttonsVisible, setButtonsVisible] = useState4(expanded);
|
|
2247
2483
|
const [animIn, setAnimIn] = useState4(expanded);
|
|
2248
2484
|
const [animDone, setAnimDone] = useState4(expanded);
|
|
@@ -2388,8 +2624,8 @@ function Toolbar({
|
|
|
2388
2624
|
} : getCornerStyle(corner);
|
|
2389
2625
|
const cameraTooltipLabel = expanded ? "Close" : void 0;
|
|
2390
2626
|
const cameraTooltipStyle = cameraTooltipLabel ? tooltipSide === "left" ? { right: "calc(100% + 10px)", top: "50%", transform: "translateY(-50%)" } : { left: "calc(100% + 10px)", top: "50%", transform: "translateY(-50%)" } : void 0;
|
|
2391
|
-
const cameraButton = /* @__PURE__ */
|
|
2392
|
-
cameraTooltipLabel && cameraTooltipVisible && !dragging && /* @__PURE__ */
|
|
2627
|
+
const cameraButton = /* @__PURE__ */ jsxs3("div", { style: { position: "relative" }, children: [
|
|
2628
|
+
cameraTooltipLabel && cameraTooltipVisible && !dragging && /* @__PURE__ */ jsx3(
|
|
2393
2629
|
"div",
|
|
2394
2630
|
{
|
|
2395
2631
|
style: {
|
|
@@ -2411,7 +2647,7 @@ function Toolbar({
|
|
|
2411
2647
|
children: cameraTooltipLabel
|
|
2412
2648
|
}
|
|
2413
2649
|
),
|
|
2414
|
-
/* @__PURE__ */
|
|
2650
|
+
/* @__PURE__ */ jsxs3(
|
|
2415
2651
|
"div",
|
|
2416
2652
|
{
|
|
2417
2653
|
onMouseDown: handleMouseDown,
|
|
@@ -2430,7 +2666,7 @@ function Toolbar({
|
|
|
2430
2666
|
transition: "background 0.12s ease"
|
|
2431
2667
|
},
|
|
2432
2668
|
children: [
|
|
2433
|
-
/* @__PURE__ */
|
|
2669
|
+
/* @__PURE__ */ jsx3(
|
|
2434
2670
|
"style",
|
|
2435
2671
|
{
|
|
2436
2672
|
dangerouslySetInnerHTML: {
|
|
@@ -2447,23 +2683,25 @@ function Toolbar({
|
|
|
2447
2683
|
}
|
|
2448
2684
|
}
|
|
2449
2685
|
),
|
|
2450
|
-
loading ? /* @__PURE__ */
|
|
2686
|
+
loading ? /* @__PURE__ */ jsx3(
|
|
2451
2687
|
LoaderCircle,
|
|
2452
2688
|
{
|
|
2453
2689
|
size: 16,
|
|
2454
2690
|
strokeWidth: 2,
|
|
2455
2691
|
style: { animation: "ab-spin 0.8s linear infinite", color: "white" }
|
|
2456
2692
|
}
|
|
2457
|
-
) : phase === "ready" ? /* @__PURE__ */
|
|
2458
|
-
|
|
2693
|
+
) : phase === "ready" ? /* @__PURE__ */ jsx3(Check2, { size: 18, strokeWidth: 1.7, color: fg.default }) : expanded ? /* @__PURE__ */ jsx3(
|
|
2694
|
+
X2,
|
|
2459
2695
|
{
|
|
2460
|
-
size:
|
|
2696
|
+
size: 18,
|
|
2697
|
+
strokeWidth: 1.7,
|
|
2461
2698
|
color: cameraHovered ? fg.strong : fg.default
|
|
2462
2699
|
}
|
|
2463
|
-
) : /* @__PURE__ */
|
|
2464
|
-
|
|
2700
|
+
) : /* @__PURE__ */ jsx3(
|
|
2701
|
+
Camera,
|
|
2465
2702
|
{
|
|
2466
|
-
size:
|
|
2703
|
+
size: 18,
|
|
2704
|
+
strokeWidth: 1.7,
|
|
2467
2705
|
color: cameraHovered ? fg.strong : fg.default
|
|
2468
2706
|
}
|
|
2469
2707
|
)
|
|
@@ -2471,7 +2709,7 @@ function Toolbar({
|
|
|
2471
2709
|
}
|
|
2472
2710
|
)
|
|
2473
2711
|
] });
|
|
2474
|
-
const toolbarButtons = buttonsVisible ? /* @__PURE__ */
|
|
2712
|
+
const toolbarButtons = buttonsVisible ? /* @__PURE__ */ jsx3(
|
|
2475
2713
|
"div",
|
|
2476
2714
|
{
|
|
2477
2715
|
style: {
|
|
@@ -2479,7 +2717,7 @@ function Toolbar({
|
|
|
2479
2717
|
maxHeight: animIn ? 195 : 0,
|
|
2480
2718
|
transition: animIn ? "max-height 250ms cubic-bezier(0.23, 1, 0.32, 1)" : "max-height 150ms cubic-bezier(0.23, 1, 0.32, 1)"
|
|
2481
2719
|
},
|
|
2482
|
-
children: /* @__PURE__ */
|
|
2720
|
+
children: /* @__PURE__ */ jsxs3(
|
|
2483
2721
|
"div",
|
|
2484
2722
|
{
|
|
2485
2723
|
style: {
|
|
@@ -2492,7 +2730,7 @@ function Toolbar({
|
|
|
2492
2730
|
willChange: "transform, opacity"
|
|
2493
2731
|
},
|
|
2494
2732
|
children: [
|
|
2495
|
-
/* @__PURE__ */
|
|
2733
|
+
/* @__PURE__ */ jsx3("div", { style: { paddingBottom: 2 }, children: /* @__PURE__ */ jsx3(
|
|
2496
2734
|
IconButton,
|
|
2497
2735
|
{
|
|
2498
2736
|
active: selectedMode === "component" && !historyOpen,
|
|
@@ -2502,42 +2740,10 @@ function Toolbar({
|
|
|
2502
2740
|
setHistoryOpen(false);
|
|
2503
2741
|
onModeChange("component");
|
|
2504
2742
|
},
|
|
2505
|
-
children: /* @__PURE__ */
|
|
2743
|
+
children: /* @__PURE__ */ jsx3(Camera, { size: 18, strokeWidth: 1.7 })
|
|
2506
2744
|
}
|
|
2507
2745
|
) }),
|
|
2508
|
-
|
|
2509
|
-
"div",
|
|
2510
|
-
{
|
|
2511
|
-
style: {
|
|
2512
|
-
maxHeight: modesExpanded ? 34 : 0,
|
|
2513
|
-
opacity: modesExpanded ? 1 : 0,
|
|
2514
|
-
transition: "max-height 200ms cubic-bezier(0.23, 1, 0.32, 1), opacity 150ms cubic-bezier(0.23, 1, 0.32, 1)"
|
|
2515
|
-
},
|
|
2516
|
-
children: /* @__PURE__ */ jsx4(
|
|
2517
|
-
IconButton,
|
|
2518
|
-
{
|
|
2519
|
-
active: selectedMode === mode && !historyOpen,
|
|
2520
|
-
tooltipSide,
|
|
2521
|
-
tooltip: label,
|
|
2522
|
-
onClick: () => {
|
|
2523
|
-
setHistoryOpen(false);
|
|
2524
|
-
onModeChange(mode);
|
|
2525
|
-
onCapture(mode);
|
|
2526
|
-
},
|
|
2527
|
-
children: /* @__PURE__ */ jsx4(ModeIcon, { size: 16, strokeWidth: 1.7 })
|
|
2528
|
-
}
|
|
2529
|
-
)
|
|
2530
|
-
},
|
|
2531
|
-
mode
|
|
2532
|
-
)),
|
|
2533
|
-
/* @__PURE__ */ jsx4(
|
|
2534
|
-
Separator,
|
|
2535
|
-
{
|
|
2536
|
-
vertical: false,
|
|
2537
|
-
onClick: () => setModesExpanded((p) => !p)
|
|
2538
|
-
}
|
|
2539
|
-
),
|
|
2540
|
-
/* @__PURE__ */ jsx4(
|
|
2746
|
+
/* @__PURE__ */ jsx3(
|
|
2541
2747
|
ScreenshotsPanel,
|
|
2542
2748
|
{
|
|
2543
2749
|
open: historyOpen,
|
|
@@ -2555,7 +2761,7 @@ function Toolbar({
|
|
|
2555
2761
|
)
|
|
2556
2762
|
}
|
|
2557
2763
|
) : null;
|
|
2558
|
-
return /* @__PURE__ */
|
|
2764
|
+
return /* @__PURE__ */ jsx3(
|
|
2559
2765
|
"div",
|
|
2560
2766
|
{
|
|
2561
2767
|
ref: toolbarRef,
|
|
@@ -2574,10 +2780,10 @@ function Toolbar({
|
|
|
2574
2780
|
...fontBase,
|
|
2575
2781
|
userSelect: "none"
|
|
2576
2782
|
},
|
|
2577
|
-
children: bottom ? /* @__PURE__ */
|
|
2783
|
+
children: bottom ? /* @__PURE__ */ jsxs3(Fragment3, { children: [
|
|
2578
2784
|
toolbarButtons,
|
|
2579
2785
|
cameraButton
|
|
2580
|
-
] }) : /* @__PURE__ */
|
|
2786
|
+
] }) : /* @__PURE__ */ jsxs3(Fragment3, { children: [
|
|
2581
2787
|
cameraButton,
|
|
2582
2788
|
toolbarButtons
|
|
2583
2789
|
] })
|
|
@@ -2602,8 +2808,8 @@ function IconButton({
|
|
|
2602
2808
|
top: "50%",
|
|
2603
2809
|
transform: "translateY(-50%)"
|
|
2604
2810
|
};
|
|
2605
|
-
return /* @__PURE__ */
|
|
2606
|
-
tooltip && tooltipVisible && /* @__PURE__ */
|
|
2811
|
+
return /* @__PURE__ */ jsxs3("div", { style: { position: "relative" }, children: [
|
|
2812
|
+
tooltip && tooltipVisible && /* @__PURE__ */ jsx3(
|
|
2607
2813
|
"div",
|
|
2608
2814
|
{
|
|
2609
2815
|
style: {
|
|
@@ -2625,7 +2831,7 @@ function IconButton({
|
|
|
2625
2831
|
children: tooltip
|
|
2626
2832
|
}
|
|
2627
2833
|
),
|
|
2628
|
-
/* @__PURE__ */
|
|
2834
|
+
/* @__PURE__ */ jsx3(
|
|
2629
2835
|
"button",
|
|
2630
2836
|
{
|
|
2631
2837
|
onClick,
|
|
@@ -2656,7 +2862,7 @@ function DropItem2({
|
|
|
2656
2862
|
active,
|
|
2657
2863
|
accent: accent2
|
|
2658
2864
|
}) {
|
|
2659
|
-
return /* @__PURE__ */
|
|
2865
|
+
return /* @__PURE__ */ jsx3(
|
|
2660
2866
|
"button",
|
|
2661
2867
|
{
|
|
2662
2868
|
onClick,
|
|
@@ -2676,27 +2882,6 @@ function DropItem2({
|
|
|
2676
2882
|
}
|
|
2677
2883
|
);
|
|
2678
2884
|
}
|
|
2679
|
-
function Separator({
|
|
2680
|
-
vertical = true,
|
|
2681
|
-
onClick
|
|
2682
|
-
}) {
|
|
2683
|
-
return /* @__PURE__ */ jsx4(
|
|
2684
|
-
"div",
|
|
2685
|
-
{
|
|
2686
|
-
onClick,
|
|
2687
|
-
style: {
|
|
2688
|
-
position: "relative",
|
|
2689
|
-
width: vertical ? 1 : 24,
|
|
2690
|
-
height: vertical ? 18 : 1,
|
|
2691
|
-
background: stroke.strong,
|
|
2692
|
-
flexShrink: 0,
|
|
2693
|
-
margin: vertical ? "0 6px" : "6px 0",
|
|
2694
|
-
cursor: onClick ? "pointer" : void 0
|
|
2695
|
-
},
|
|
2696
|
-
children: onClick && /* @__PURE__ */ jsx4("div", { style: { position: "absolute", inset: vertical ? "0 -8px" : "-8px 0" } })
|
|
2697
|
-
}
|
|
2698
|
-
);
|
|
2699
|
-
}
|
|
2700
2885
|
function FilterDropdown({
|
|
2701
2886
|
label,
|
|
2702
2887
|
value,
|
|
@@ -2705,20 +2890,20 @@ function FilterDropdown({
|
|
|
2705
2890
|
onToggle,
|
|
2706
2891
|
onSelect
|
|
2707
2892
|
}) {
|
|
2708
|
-
return /* @__PURE__ */
|
|
2709
|
-
/* @__PURE__ */
|
|
2893
|
+
return /* @__PURE__ */ jsxs3("div", { children: [
|
|
2894
|
+
/* @__PURE__ */ jsx3(
|
|
2710
2895
|
"div",
|
|
2711
2896
|
{
|
|
2712
2897
|
style: {
|
|
2713
|
-
...text.
|
|
2898
|
+
...text.label.xs,
|
|
2714
2899
|
color: fg.sub,
|
|
2715
2900
|
marginBottom: 3
|
|
2716
2901
|
},
|
|
2717
2902
|
children: label
|
|
2718
2903
|
}
|
|
2719
2904
|
),
|
|
2720
|
-
/* @__PURE__ */
|
|
2721
|
-
/* @__PURE__ */
|
|
2905
|
+
/* @__PURE__ */ jsxs3("div", { style: { position: "relative" }, children: [
|
|
2906
|
+
/* @__PURE__ */ jsxs3(
|
|
2722
2907
|
"button",
|
|
2723
2908
|
{
|
|
2724
2909
|
onClick: onToggle,
|
|
@@ -2739,7 +2924,7 @@ function FilterDropdown({
|
|
|
2739
2924
|
fontFamily: "inherit"
|
|
2740
2925
|
},
|
|
2741
2926
|
children: [
|
|
2742
|
-
/* @__PURE__ */
|
|
2927
|
+
/* @__PURE__ */ jsx3(
|
|
2743
2928
|
"span",
|
|
2744
2929
|
{
|
|
2745
2930
|
style: {
|
|
@@ -2750,11 +2935,11 @@ function FilterDropdown({
|
|
|
2750
2935
|
children: value || "\u2014"
|
|
2751
2936
|
}
|
|
2752
2937
|
),
|
|
2753
|
-
/* @__PURE__ */
|
|
2938
|
+
/* @__PURE__ */ jsx3(ChevronDown2, { size: 12, strokeWidth: 2 })
|
|
2754
2939
|
]
|
|
2755
2940
|
}
|
|
2756
2941
|
),
|
|
2757
|
-
isOpen && options.length > 0 && /* @__PURE__ */
|
|
2942
|
+
isOpen && options.length > 0 && /* @__PURE__ */ jsx3(
|
|
2758
2943
|
"div",
|
|
2759
2944
|
{
|
|
2760
2945
|
style: {
|
|
@@ -2771,7 +2956,7 @@ function FilterDropdown({
|
|
|
2771
2956
|
boxShadow: shadow.dropdown,
|
|
2772
2957
|
zIndex: 1
|
|
2773
2958
|
},
|
|
2774
|
-
children: options.map((opt) => /* @__PURE__ */
|
|
2959
|
+
children: options.map((opt) => /* @__PURE__ */ jsx3(
|
|
2775
2960
|
DropItem2,
|
|
2776
2961
|
{
|
|
2777
2962
|
active: opt === value,
|
|
@@ -2788,7 +2973,7 @@ function FilterDropdown({
|
|
|
2788
2973
|
|
|
2789
2974
|
// src/overlay/ui/inspector.tsx
|
|
2790
2975
|
import { useEffect as useEffect4, useRef as useRef3, useCallback as useCallback4, useState as useState5 } from "react";
|
|
2791
|
-
import { jsx as
|
|
2976
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
2792
2977
|
function Inspector({ onSelect, onCancel }) {
|
|
2793
2978
|
const [highlight, setHighlight] = useState5(null);
|
|
2794
2979
|
const hoveredEl = useRef3(null);
|
|
@@ -2865,7 +3050,7 @@ function Inspector({ onSelect, onCancel }) {
|
|
|
2865
3050
|
document.removeEventListener("keydown", handleKeyDown);
|
|
2866
3051
|
};
|
|
2867
3052
|
}, [handleMouseMove, handleClick, handleKeyDown]);
|
|
2868
|
-
return /* @__PURE__ */
|
|
3053
|
+
return /* @__PURE__ */ jsx4("div", { "data-afterbefore": "true", style: { position: "fixed", inset: 0, zIndex: 2147483646, pointerEvents: "none" }, children: highlight && /* @__PURE__ */ jsx4(
|
|
2869
3054
|
"div",
|
|
2870
3055
|
{
|
|
2871
3056
|
style: {
|
|
@@ -2885,7 +3070,7 @@ function Inspector({ onSelect, onCancel }) {
|
|
|
2885
3070
|
}
|
|
2886
3071
|
|
|
2887
3072
|
// src/overlay/index.tsx
|
|
2888
|
-
import { jsx as
|
|
3073
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
2889
3074
|
async function saveCapture(mode, renderedDataUrl, rawDataUrl, viewportDataUrl) {
|
|
2890
3075
|
try {
|
|
2891
3076
|
const res = await fetch("/__afterbefore/save", {
|
|
@@ -2970,6 +3155,12 @@ function AfterBefore() {
|
|
|
2970
3155
|
mode,
|
|
2971
3156
|
timestamp: Date.now()
|
|
2972
3157
|
});
|
|
3158
|
+
try {
|
|
3159
|
+
if (localStorage.getItem("ab-auto-open-panel") !== "false") {
|
|
3160
|
+
setToolbarActive(true);
|
|
3161
|
+
}
|
|
3162
|
+
} catch {
|
|
3163
|
+
}
|
|
2973
3164
|
} catch (err) {
|
|
2974
3165
|
console.error("[afterbefore] Capture failed:", err);
|
|
2975
3166
|
} finally {
|
|
@@ -3019,8 +3210,8 @@ function AfterBefore() {
|
|
|
3019
3210
|
setSelectedMode(mode);
|
|
3020
3211
|
setInspectorActive(mode === "component");
|
|
3021
3212
|
}, []);
|
|
3022
|
-
return /* @__PURE__ */
|
|
3023
|
-
/* @__PURE__ */
|
|
3213
|
+
return /* @__PURE__ */ jsxs4("div", { "data-afterbefore": "true", children: [
|
|
3214
|
+
/* @__PURE__ */ jsx5(
|
|
3024
3215
|
Toolbar,
|
|
3025
3216
|
{
|
|
3026
3217
|
expanded: toolbarActive,
|
|
@@ -3035,7 +3226,7 @@ function AfterBefore() {
|
|
|
3035
3226
|
onFrameSettingsChange: handleFrameSettingsChange
|
|
3036
3227
|
}
|
|
3037
3228
|
),
|
|
3038
|
-
inspectorActive && /* @__PURE__ */
|
|
3229
|
+
inspectorActive && /* @__PURE__ */ jsx5(Inspector, { onSelect: handleComponentSelect, onCancel: handleComponentCancel })
|
|
3039
3230
|
] });
|
|
3040
3231
|
}
|
|
3041
3232
|
export {
|