autokap 1.0.7 → 1.0.8
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/assets/cursors/macos.svg +4 -0
- package/assets/cursors/windows.svg +15 -0
- package/assets/skill/OPCODE-REFERENCE.md +607 -0
- package/assets/skill/README.md +39 -0
- package/assets/skill/SKILL.md +453 -468
- package/assets/skill/STUDIO-SKILL.md +476 -0
- package/assets/skill/references/examples.md +104 -0
- package/assets/skill/references/interactive-demo.md +225 -0
- package/assets/skill/references/mock-data.md +178 -0
- package/dist/action-verifier.d.ts +29 -0
- package/dist/action-verifier.js +133 -0
- package/dist/agent-action-recovery.d.ts +45 -0
- package/dist/agent-action-recovery.js +370 -0
- package/dist/agent-message-utils.d.ts +21 -0
- package/dist/agent-message-utils.js +77 -0
- package/dist/agent-url-utils.d.ts +30 -0
- package/dist/agent-url-utils.js +138 -0
- package/dist/agent.d.ts +92 -8
- package/dist/agent.js +2936 -781
- package/dist/ak-tree.d.ts +39 -0
- package/dist/ak-tree.js +368 -0
- package/dist/alt-text.d.ts +26 -0
- package/dist/alt-text.js +55 -0
- package/dist/auth-capture.d.ts +17 -0
- package/dist/auth-capture.js +164 -0
- package/dist/benchmark.d.ts +59 -0
- package/dist/benchmark.js +135 -0
- package/dist/browser-bar.d.ts +14 -6
- package/dist/browser-bar.js +145 -8
- package/dist/browser-pool.d.ts +7 -0
- package/dist/browser-pool.js +15 -5
- package/dist/browser-utils.d.ts +31 -0
- package/dist/browser-utils.js +97 -0
- package/dist/browser.d.ts +51 -1
- package/dist/browser.js +1481 -31
- package/dist/capture-alt-text.js +2 -1
- package/dist/capture-language-preflight.js +14 -0
- package/dist/capture-llm-page-identity.js +22 -10
- package/dist/capture-page-identity.d.ts +5 -7
- package/dist/capture-page-identity.js +211 -78
- package/dist/capture-preset-credentials.d.ts +50 -0
- package/dist/capture-preset-credentials.js +127 -0
- package/dist/capture-request-plan.d.ts +2 -2
- package/dist/capture-request-plan.js +64 -16
- package/dist/capture-run-optimizer.js +48 -33
- package/dist/capture-selector-memory.d.ts +5 -0
- package/dist/capture-selector-memory.js +18 -0
- package/dist/capture-strategy.d.ts +36 -0
- package/dist/capture-strategy.js +95 -0
- package/dist/capture-studio-sync.d.ts +1 -0
- package/dist/capture-studio-sync.js +9 -3
- package/dist/capture-surface-contract.d.ts +36 -0
- package/dist/capture-surface-contract.js +299 -0
- package/dist/capture-transition-engine.d.ts +28 -0
- package/dist/capture-transition-engine.js +292 -0
- package/dist/capture-variant-state.d.ts +2 -0
- package/dist/capture-variant-state.js +26 -0
- package/dist/capture-verification.d.ts +35 -0
- package/dist/capture-verification.js +95 -0
- package/dist/capture-viewport-lock.d.ts +48 -0
- package/dist/capture-viewport-lock.js +74 -0
- package/dist/circuit-breaker.d.ts +42 -0
- package/dist/circuit-breaker.js +119 -0
- package/dist/cli-config.d.ts +8 -1
- package/dist/cli-config.js +62 -6
- package/dist/cli-contract.d.ts +15 -0
- package/dist/cli-contract.js +167 -0
- package/dist/cli-runner-local.d.ts +12 -0
- package/dist/cli-runner-local.js +102 -0
- package/dist/cli-runner.d.ts +34 -0
- package/dist/cli-runner.js +433 -0
- package/dist/cli-utils.d.ts +0 -1
- package/dist/cli-utils.js +2 -5
- package/dist/cli.js +1005 -267
- package/dist/clip-orchestrator.js +9 -2
- package/dist/clip-postprocess.js +25 -16
- package/dist/cookie-dismiss.d.ts +2 -0
- package/dist/cookie-dismiss.js +48 -13
- package/dist/cost-logging.d.ts +8 -0
- package/dist/cost-logging.js +160 -46
- package/dist/cost-resolution-monitor.d.ts +16 -0
- package/dist/cost-resolution-monitor.js +34 -0
- package/dist/credential-templates.js +2 -2
- package/dist/cursor-overlay-script.d.ts +6 -0
- package/dist/cursor-overlay-script.js +169 -0
- package/dist/dom-css-purger.d.ts +65 -0
- package/dist/dom-css-purger.js +333 -0
- package/dist/dom-font-inliner.d.ts +45 -0
- package/dist/dom-font-inliner.js +148 -0
- package/dist/dom-patch-resolver.d.ts +52 -0
- package/dist/dom-patch-resolver.js +242 -0
- package/dist/dom-serializer.d.ts +82 -0
- package/dist/dom-serializer.js +378 -0
- package/dist/element-capture.d.ts +1 -41
- package/dist/element-capture.js +202 -446
- package/dist/env-validation.d.ts +5 -0
- package/dist/env-validation.js +29 -0
- package/dist/execution-schema.d.ts +4423 -0
- package/dist/execution-schema.js +507 -0
- package/dist/execution-types.d.ts +886 -0
- package/dist/execution-types.js +65 -0
- package/dist/fonts-loader.d.ts +14 -0
- package/dist/fonts-loader.js +55 -0
- package/dist/hybrid-navigator.js +12 -12
- package/dist/index.d.ts +9 -6
- package/dist/index.js +10 -4
- package/dist/legacy/agent-action-recovery.d.ts +45 -0
- package/dist/legacy/agent-action-recovery.js +370 -0
- package/dist/legacy/agent-message-utils.d.ts +21 -0
- package/dist/legacy/agent-message-utils.js +77 -0
- package/dist/legacy/agent-url-utils.d.ts +30 -0
- package/dist/legacy/agent-url-utils.js +138 -0
- package/dist/legacy/agent.d.ts +226 -0
- package/dist/legacy/agent.js +6666 -0
- package/dist/legacy/clip-orchestrator.d.ts +148 -0
- package/dist/legacy/clip-orchestrator.js +957 -0
- package/dist/legacy/credential-templates.d.ts +5 -0
- package/dist/legacy/credential-templates.js +60 -0
- package/dist/legacy/hybrid-navigator.d.ts +138 -0
- package/dist/legacy/hybrid-navigator.js +468 -0
- package/dist/legacy/llm-usage.d.ts +17 -0
- package/dist/legacy/llm-usage.js +45 -0
- package/dist/legacy/prompt-cache.d.ts +10 -0
- package/dist/legacy/prompt-cache.js +24 -0
- package/dist/legacy/prompts.d.ts +175 -0
- package/dist/legacy/prompts.js +1038 -0
- package/dist/legacy/tools.d.ts +4 -0
- package/dist/legacy/tools.js +216 -0
- package/dist/legacy/video-agent.d.ts +143 -0
- package/dist/legacy/video-agent.js +4788 -0
- package/dist/legacy/video-observation.d.ts +36 -0
- package/dist/legacy/video-observation.js +192 -0
- package/dist/legacy/video-planner.d.ts +12 -0
- package/dist/legacy/video-planner.js +501 -0
- package/dist/legacy/video-prompts.d.ts +37 -0
- package/dist/legacy/video-prompts.js +569 -0
- package/dist/legacy/video-tools.d.ts +3 -0
- package/dist/legacy/video-tools.js +59 -0
- package/dist/legacy/video-variant-state.d.ts +29 -0
- package/dist/legacy/video-variant-state.js +80 -0
- package/dist/legacy/vision-model.d.ts +17 -0
- package/dist/legacy/vision-model.js +74 -0
- package/dist/llm-healer.d.ts +63 -0
- package/dist/llm-healer.js +166 -0
- package/dist/llm-provider.d.ts +29 -0
- package/dist/llm-provider.js +80 -0
- package/dist/logger.d.ts +6 -2
- package/dist/logger.js +15 -1
- package/dist/mockup-html.js +35 -25
- package/dist/mockup.d.ts +95 -2
- package/dist/mockup.js +427 -166
- package/dist/mouse-animation.d.ts +2 -2
- package/dist/mouse-animation.js +34 -20
- package/dist/opcode-actions.d.ts +42 -0
- package/dist/opcode-actions.js +511 -0
- package/dist/opcode-runner.d.ts +51 -0
- package/dist/opcode-runner.js +770 -0
- package/dist/openrouter-client.d.ts +40 -0
- package/dist/openrouter-client.js +16 -0
- package/dist/overlay-engine.d.ts +24 -0
- package/dist/overlay-engine.js +176 -0
- package/dist/postcondition.d.ts +16 -0
- package/dist/postcondition.js +269 -0
- package/dist/program-patcher.d.ts +25 -0
- package/dist/program-patcher.js +44 -0
- package/dist/prompts.d.ts +13 -5
- package/dist/prompts.js +224 -351
- package/dist/provider-config.d.ts +12 -0
- package/dist/provider-config.js +15 -0
- package/dist/recovery-chain.d.ts +37 -0
- package/dist/recovery-chain.js +350 -0
- package/dist/remote-browser.d.ts +28 -4
- package/dist/remote-browser.js +60 -5
- package/dist/safari-browser-bar.d.ts +15 -0
- package/dist/safari-browser-bar.js +95 -0
- package/dist/safari-toolbar-asset.d.ts +15 -0
- package/dist/safari-toolbar-asset.js +12 -0
- package/dist/security.d.ts +2 -1
- package/dist/security.js +49 -10
- package/dist/selector-resolver.d.ts +34 -0
- package/dist/selector-resolver.js +181 -0
- package/dist/semantic-resolver.d.ts +35 -0
- package/dist/semantic-resolver.js +161 -0
- package/dist/server-capture-runtime.d.ts +5 -3
- package/dist/server-capture-runtime.js +42 -95
- package/dist/server-credit-usage.d.ts +2 -2
- package/dist/server-project-webhooks.d.ts +15 -1
- package/dist/server-project-webhooks.js +34 -8
- package/dist/server-screenshot-watermark.js +27 -5
- package/dist/session-profile.js +164 -1
- package/dist/sf-pro-symbols.d.ts +1 -0
- package/dist/sf-pro-symbols.js +55 -0
- package/dist/skill-packaging.d.ts +28 -0
- package/dist/skill-packaging.js +169 -0
- package/dist/smart-wait.d.ts +27 -0
- package/dist/smart-wait.js +81 -0
- package/dist/status-bar-render.d.ts +20 -0
- package/dist/status-bar-render.js +410 -0
- package/dist/status-bar.d.ts +9 -0
- package/dist/status-bar.js +298 -14
- package/dist/svg-browser-bar.d.ts +33 -0
- package/dist/svg-browser-bar.js +206 -0
- package/dist/svg-status-bar.d.ts +36 -0
- package/dist/svg-status-bar.js +597 -0
- package/dist/svg-text.d.ts +61 -0
- package/dist/svg-text.js +118 -0
- package/dist/tools.js +89 -451
- package/dist/types.d.ts +240 -5
- package/dist/types.js +23 -1
- package/dist/v2/action-verifier.d.ts +29 -0
- package/dist/v2/action-verifier.js +133 -0
- package/dist/v2/alt-text.d.ts +26 -0
- package/dist/v2/alt-text.js +55 -0
- package/dist/v2/benchmark.d.ts +59 -0
- package/dist/v2/benchmark.js +135 -0
- package/dist/v2/capture-strategy.d.ts +30 -0
- package/dist/v2/capture-strategy.js +67 -0
- package/dist/v2/capture-verification.d.ts +35 -0
- package/dist/v2/capture-verification.js +95 -0
- package/dist/v2/circuit-breaker.d.ts +42 -0
- package/dist/v2/circuit-breaker.js +119 -0
- package/dist/v2/cli-runner-local.d.ts +11 -0
- package/dist/v2/cli-runner-local.js +91 -0
- package/dist/v2/cli-runner.d.ts +34 -0
- package/dist/v2/cli-runner.js +300 -0
- package/dist/v2/compiler-prompts.d.ts +27 -0
- package/dist/v2/compiler-prompts.js +123 -0
- package/dist/v2/compiler.d.ts +37 -0
- package/dist/v2/compiler.js +147 -0
- package/dist/v2/explorer.d.ts +41 -0
- package/dist/v2/explorer.js +56 -0
- package/dist/v2/index.d.ts +37 -0
- package/dist/v2/index.js +31 -0
- package/dist/v2/llm-healer.d.ts +62 -0
- package/dist/v2/llm-healer.js +166 -0
- package/dist/v2/llm-provider.d.ts +29 -0
- package/dist/v2/llm-provider.js +80 -0
- package/dist/v2/opcode-runner.d.ts +47 -0
- package/dist/v2/opcode-runner.js +634 -0
- package/dist/v2/overlay-engine.d.ts +24 -0
- package/dist/v2/overlay-engine.js +150 -0
- package/dist/v2/postcondition.d.ts +16 -0
- package/dist/v2/postcondition.js +249 -0
- package/dist/v2/program-patcher.d.ts +25 -0
- package/dist/v2/program-patcher.js +44 -0
- package/dist/v2/recovery-chain.d.ts +30 -0
- package/dist/v2/recovery-chain.js +368 -0
- package/dist/v2/schema.d.ts +2580 -0
- package/dist/v2/schema.js +295 -0
- package/dist/v2/selector-resolver.d.ts +34 -0
- package/dist/v2/selector-resolver.js +181 -0
- package/dist/v2/semantic-resolver.d.ts +35 -0
- package/dist/v2/semantic-resolver.js +161 -0
- package/dist/v2/smart-wait.d.ts +27 -0
- package/dist/v2/smart-wait.js +81 -0
- package/dist/v2/types.d.ts +444 -0
- package/dist/v2/types.js +19 -0
- package/dist/v2/web-playwright-local.d.ts +69 -0
- package/dist/v2/web-playwright-local.js +392 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +5 -0
- package/dist/video-agent.js +18 -13
- package/dist/video-planner.js +2 -1
- package/dist/video-prompts.js +3 -3
- package/dist/web-playwright-local.d.ts +126 -0
- package/dist/web-playwright-local.js +819 -0
- package/dist/ws-auth.js +4 -1
- package/dist/ws-broadcast.d.ts +34 -0
- package/dist/ws-broadcast.js +85 -0
- package/dist/ws-connection-limits.d.ts +12 -0
- package/dist/ws-connection-limits.js +44 -0
- package/dist/ws-handler-utils.d.ts +32 -0
- package/dist/ws-handler-utils.js +139 -0
- package/dist/ws-handler.js +294 -164
- package/dist/ws-metrics-server.d.ts +9 -0
- package/dist/ws-metrics-server.js +31 -0
- package/dist/ws-server.js +41 -1
- package/package.json +51 -34
package/dist/mockup-html.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* 6 — overlay slot (dock on client)
|
|
15
15
|
* 8 — frame image (when !frameBehindContent)
|
|
16
16
|
*/
|
|
17
|
-
import { generateStatusBarHtml } from './status-bar.js';
|
|
17
|
+
import { generateStatusBarHtml, STATUS_BAR_FONT_CSS } from './status-bar.js';
|
|
18
18
|
import { generateBrowserBarHtml } from './browser-bar.js';
|
|
19
19
|
// ── Layout Computation ──────────────────────────────────────────────────
|
|
20
20
|
/**
|
|
@@ -41,21 +41,18 @@ export function computeMockupLayout(params) {
|
|
|
41
41
|
const screenBorderRadius = isLaptop
|
|
42
42
|
? `${screenCornerRadius}px ${screenCornerRadius}px 0 0`
|
|
43
43
|
: `${screenCornerRadius}px`;
|
|
44
|
-
// Expand container for window border (browser frameless mockups)
|
|
45
|
-
const finalContainerWidth = containerWidth + borderW * 2;
|
|
46
|
-
const finalContainerHeight = containerHeight + borderW * 2;
|
|
47
44
|
return {
|
|
48
|
-
containerWidth
|
|
49
|
-
containerHeight
|
|
45
|
+
containerWidth,
|
|
46
|
+
containerHeight,
|
|
50
47
|
contentArea: {
|
|
51
|
-
x: screenRect.x + leftPx
|
|
52
|
-
y: screenRect.y + topPx
|
|
48
|
+
x: screenRect.x + leftPx,
|
|
49
|
+
y: screenRect.y + topPx,
|
|
53
50
|
width: contentW,
|
|
54
51
|
height: contentH,
|
|
55
52
|
},
|
|
56
53
|
screenArea: {
|
|
57
|
-
x: screenRect.x
|
|
58
|
-
y: screenRect.y
|
|
54
|
+
x: screenRect.x,
|
|
55
|
+
y: screenRect.y,
|
|
59
56
|
width: screenRect.width,
|
|
60
57
|
height: screenRect.height,
|
|
61
58
|
},
|
|
@@ -74,12 +71,14 @@ export function computeMockupLayout(params) {
|
|
|
74
71
|
* inside a position:relative container of the correct dimensions.
|
|
75
72
|
*/
|
|
76
73
|
export function generateMockupHtml(params) {
|
|
74
|
+
return generateMockupHtmlInternal(params, { includeInlineStatusBarFontStyles: true });
|
|
75
|
+
}
|
|
76
|
+
function generateMockupHtmlInternal(params, options) {
|
|
77
77
|
const { frameSrc, frameWidth, frameHeight, frameRotation = 0, frameBehindContent = false, screenRect, cornerRadius, screenBackground = 'transparent', isLaptop = false, safeArea, scale, showSafeAreaTop = true, showSafeAreaBottom = true, showSafeAreaLeft = true, showSafeAreaRight = true, safeAreaColors, statusBar, showStatusBar = true, statusBarConfig, colorScheme = 'light', showBrowserBar = false, browserBarConfig, homeIndicator, showHomeIndicator = true, homeIndicatorColor, windowBorder, contentHtml = '', overlayHtml = '', pixelScale = 1, } = params;
|
|
78
78
|
const px = (v) => Math.round(v * pixelScale);
|
|
79
79
|
const layout = computeMockupLayout(params);
|
|
80
80
|
const borderW = windowBorder?.width ?? 0;
|
|
81
|
-
|
|
82
|
-
const sr = { x: screenRect.x + borderW, y: screenRect.y + borderW, width: screenRect.width, height: screenRect.height };
|
|
81
|
+
const sr = { x: screenRect.x, y: screenRect.y, width: screenRect.width, height: screenRect.height };
|
|
83
82
|
const ca = layout.contentArea;
|
|
84
83
|
// Safe area visibility
|
|
85
84
|
const showTop = showSafeAreaTop && safeArea.top > 0;
|
|
@@ -118,9 +117,15 @@ export function generateMockupHtml(params) {
|
|
|
118
117
|
// ── Content (z:2) ──
|
|
119
118
|
let contentSlotHtml = '';
|
|
120
119
|
if (contentHtml) {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
120
|
+
// Content area border-radius: only round corners where the content
|
|
121
|
+
// touches the screen edge (no safe area on that side).
|
|
122
|
+
const contentBorderRadius = topPx > 0 && bottomPx > 0
|
|
123
|
+
? '0' // Content doesn't touch any rounded edge
|
|
124
|
+
: topPx > 0
|
|
125
|
+
? (isLaptop ? '0' : `0 0 ${px(cornerPx)}px ${px(cornerPx)}px`)
|
|
126
|
+
: bottomPx > 0
|
|
127
|
+
? `${px(cornerPx)}px ${px(cornerPx)}px 0 0`
|
|
128
|
+
: screenBorderRadiusCss;
|
|
124
129
|
contentSlotHtml = `<div style="position:absolute;left:${px(ca.x)}px;top:${px(ca.y)}px;width:${px(ca.width)}px;height:${px(ca.height)}px;z-index:2;overflow:hidden;border-radius:${contentBorderRadius}">${contentHtml}</div>`;
|
|
125
130
|
}
|
|
126
131
|
// ── Home indicator (z:4) ──
|
|
@@ -158,19 +163,22 @@ export function generateMockupHtml(params) {
|
|
|
158
163
|
scale,
|
|
159
164
|
deviceType: statusBar.type,
|
|
160
165
|
layout: statusBar.layout,
|
|
166
|
+
includeFontStyles: options.includeInlineStatusBarFontStyles,
|
|
161
167
|
});
|
|
162
|
-
// Status bar needs its own border-radius clipping (top corners only)
|
|
163
|
-
const sbBorderRadius = `${px(cornerPx)}px ${px(cornerPx)}px 0 0`;
|
|
164
168
|
if (pixelScale === 1) {
|
|
165
169
|
// Client: render at 1× (status bar HTML handles its own internal scaling)
|
|
166
|
-
|
|
170
|
+
const sbBR = `${px(cornerPx)}px ${px(cornerPx)}px 0 0`;
|
|
171
|
+
statusBarHtml = `<div style="position:absolute;left:${px(sr.x)}px;top:${px(sr.y)}px;width:${px(sr.width)}px;height:${px(safeArea.top * scale)}px;overflow:hidden;border-radius:${sbBR};z-index:5;pointer-events:none">${sbInnerHtml}</div>`;
|
|
167
172
|
}
|
|
168
173
|
else {
|
|
169
|
-
// Server:
|
|
170
|
-
|
|
174
|
+
// Server: inner content is at 1× dimensions → use raw (unscaled) container
|
|
175
|
+
// and let transform:scale(pixelScale) bring it to final pixel size.
|
|
176
|
+
// Position (left/top) stays px-scaled since it's in the already-scaled page.
|
|
177
|
+
const sbBR = `${cornerPx}px ${cornerPx}px 0 0`;
|
|
178
|
+
statusBarHtml = `<div style="position:absolute;left:${px(sr.x)}px;top:${px(sr.y)}px;width:${sr.width}px;height:${sbH}px;overflow:hidden;border-radius:${sbBR};z-index:5;transform:scale(${pixelScale});transform-origin:top left">${sbInnerHtml}</div>`;
|
|
171
179
|
}
|
|
172
180
|
}
|
|
173
|
-
// ── Browser bar (z:5) —
|
|
181
|
+
// ── Browser bar (z:5) — coded Chrome/Safari toolbar, same pattern as status bar ──
|
|
174
182
|
let browserBarHtml = '';
|
|
175
183
|
if (showBrowserBar && safeArea.top > 0) {
|
|
176
184
|
const bbH = safeArea.top * scale;
|
|
@@ -218,15 +226,14 @@ export function generateMockupHtml(params) {
|
|
|
218
226
|
}
|
|
219
227
|
}
|
|
220
228
|
const frameHtml = frameSrc
|
|
221
|
-
? `<img src="${frameSrc}" alt="Device frame" style="position:absolute;top
|
|
229
|
+
? `<img src="${frameSrc}" alt="Device frame" style="position:absolute;top:0;left:0;width:${px(frameWidth)}px;height:${px(frameHeight)}px;max-width:none;pointer-events:none;z-index:${frameZ};${frameTransform}${frameMargins}" draggable="false">`
|
|
222
230
|
: '';
|
|
223
231
|
// ── Window border (z:9, outside the screen rect) ──
|
|
224
232
|
let windowBorderHtml = '';
|
|
225
233
|
if (windowBorder && windowBorder.width > 0) {
|
|
226
234
|
const bw = px(windowBorder.width);
|
|
227
235
|
const br = px(windowBorder.radius);
|
|
228
|
-
|
|
229
|
-
windowBorderHtml = `<div style="position:absolute;left:0;top:0;width:${px(sr.width + borderW * 2)}px;height:${px(sr.height + borderW * 2)}px;border:${bw}px solid ${windowBorder.color};border-radius:${br}px;pointer-events:none;z-index:9;box-sizing:border-box"></div>`;
|
|
236
|
+
windowBorderHtml = `<div style="position:absolute;left:0;top:0;width:${px(sr.width)}px;height:${px(sr.height)}px;border:${bw}px solid ${windowBorder.color};border-radius:${br}px;pointer-events:none;z-index:9;box-sizing:border-box"></div>`;
|
|
230
237
|
}
|
|
231
238
|
// ── Assemble ──
|
|
232
239
|
return [screenBgHtml, contentSlotHtml, homeIndicatorHtml, statusBarHtml, browserBarHtml, overlaySlotHtml, frameHtml, windowBorderHtml].join('\n');
|
|
@@ -239,10 +246,13 @@ export function generateMockupPage(params) {
|
|
|
239
246
|
const ps = params.pixelScale ?? 1;
|
|
240
247
|
const w = Math.round(layout.containerWidth * ps);
|
|
241
248
|
const h = Math.round(layout.containerHeight * ps);
|
|
242
|
-
const
|
|
249
|
+
const shouldInjectStatusBarFonts = params.showStatusBar !== false && !!params.statusBar && params.safeArea.top > 0;
|
|
250
|
+
const inner = generateMockupHtmlInternal(params, { includeInlineStatusBarFontStyles: !shouldInjectStatusBarFonts });
|
|
251
|
+
const fontCss = shouldInjectStatusBarFonts ? `${STATUS_BAR_FONT_CSS}\n` : '';
|
|
243
252
|
return `<!DOCTYPE html>
|
|
244
253
|
<html><head><meta charset="utf-8"><style>
|
|
245
254
|
*{margin:0;padding:0;box-sizing:border-box}
|
|
255
|
+
${fontCss}
|
|
246
256
|
body{width:${w}px;height:${h}px;overflow:hidden;background:transparent}
|
|
247
257
|
</style></head><body>
|
|
248
258
|
<div style="position:relative;width:${w}px;height:${h}px">
|
package/dist/mockup.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { BrowserContext } from 'playwright';
|
|
2
1
|
import type { StatusBarConfig, StatusBarLayout, StatusBarDeviceType } from './status-bar.js';
|
|
3
2
|
import type { BrowserBarConfig } from './browser-bar.js';
|
|
4
3
|
export type DeviceCategory = 'phone' | 'tablet' | 'laptop' | 'browser';
|
|
@@ -12,6 +11,91 @@ export interface DeviceFrameDefinition {
|
|
|
12
11
|
height: number;
|
|
13
12
|
};
|
|
14
13
|
}
|
|
14
|
+
interface OrientationConfigData {
|
|
15
|
+
screen: {
|
|
16
|
+
logicalWidth: number;
|
|
17
|
+
logicalHeight: number;
|
|
18
|
+
scale: number;
|
|
19
|
+
cornerRadius: number;
|
|
20
|
+
};
|
|
21
|
+
viewport: {
|
|
22
|
+
width: number;
|
|
23
|
+
height: number;
|
|
24
|
+
};
|
|
25
|
+
safeArea?: {
|
|
26
|
+
top: number;
|
|
27
|
+
bottom: number;
|
|
28
|
+
left?: number;
|
|
29
|
+
right?: number;
|
|
30
|
+
};
|
|
31
|
+
statusBar?: {
|
|
32
|
+
asset?: string;
|
|
33
|
+
height: number;
|
|
34
|
+
width: number;
|
|
35
|
+
type?: StatusBarDeviceType;
|
|
36
|
+
layout?: StatusBarLayout;
|
|
37
|
+
};
|
|
38
|
+
homeIndicator?: {
|
|
39
|
+
width: number;
|
|
40
|
+
height: number;
|
|
41
|
+
cornerRadius: number;
|
|
42
|
+
bottomOffset: number;
|
|
43
|
+
};
|
|
44
|
+
frame: {
|
|
45
|
+
type: 'png' | 'svg';
|
|
46
|
+
asset: string;
|
|
47
|
+
width: number;
|
|
48
|
+
height: number;
|
|
49
|
+
screenRect: {
|
|
50
|
+
x: number;
|
|
51
|
+
y: number;
|
|
52
|
+
width: number;
|
|
53
|
+
height: number;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
/** Rotation angle (degrees CW) applied to the frame image */
|
|
57
|
+
frameRotation?: number;
|
|
58
|
+
/** When true, the frame is rendered behind the screen content */
|
|
59
|
+
frameBehindContent?: boolean;
|
|
60
|
+
frameUrl?: string;
|
|
61
|
+
/** Window border for frameless browser mockups */
|
|
62
|
+
windowBorder?: {
|
|
63
|
+
color: string;
|
|
64
|
+
width: number;
|
|
65
|
+
radius: number;
|
|
66
|
+
};
|
|
67
|
+
/** Dark-mode frame URL (browser category) */
|
|
68
|
+
frameDarkUrl?: string;
|
|
69
|
+
/** Configurable zones for browser bar dynamic content */
|
|
70
|
+
browserBarZones?: {
|
|
71
|
+
favicon?: {
|
|
72
|
+
x: number;
|
|
73
|
+
y: number;
|
|
74
|
+
width: number;
|
|
75
|
+
height: number;
|
|
76
|
+
};
|
|
77
|
+
pageTitle?: {
|
|
78
|
+
x: number;
|
|
79
|
+
y: number;
|
|
80
|
+
width: number;
|
|
81
|
+
height: number;
|
|
82
|
+
fontSize?: number;
|
|
83
|
+
fontWeight?: number | string;
|
|
84
|
+
textAlign?: 'left' | 'center' | 'right';
|
|
85
|
+
};
|
|
86
|
+
url?: {
|
|
87
|
+
x: number;
|
|
88
|
+
y: number;
|
|
89
|
+
width: number;
|
|
90
|
+
height: number;
|
|
91
|
+
fontSize?: number;
|
|
92
|
+
fontWeight?: number | string;
|
|
93
|
+
textAlign?: 'left' | 'center' | 'right';
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
/** Which coded browser chrome style to render. Defaults to 'chrome'. */
|
|
97
|
+
browserStyle?: 'chrome' | 'safari';
|
|
98
|
+
}
|
|
15
99
|
export type MockupOrientation = 'portrait' | 'landscape';
|
|
16
100
|
export interface MockupOptions {
|
|
17
101
|
orientation?: MockupOrientation;
|
|
@@ -34,12 +118,19 @@ export interface MockupOptions {
|
|
|
34
118
|
width: number;
|
|
35
119
|
radius: number;
|
|
36
120
|
};
|
|
121
|
+
/** Explicit color scheme override — bypasses auto-detection from edge colors */
|
|
122
|
+
colorScheme?: 'light' | 'dark';
|
|
37
123
|
}
|
|
38
124
|
export interface ResolvedDeviceFrameDescriptor {
|
|
39
125
|
id: string;
|
|
40
126
|
name: string;
|
|
41
127
|
category: DeviceCategory;
|
|
42
128
|
orientation: MockupOrientation;
|
|
129
|
+
/** Pre-computed viewport from the device config (content area) */
|
|
130
|
+
viewport?: {
|
|
131
|
+
width: number;
|
|
132
|
+
height: number;
|
|
133
|
+
};
|
|
43
134
|
screen: {
|
|
44
135
|
logicalWidth: number;
|
|
45
136
|
logicalHeight: number;
|
|
@@ -82,6 +173,7 @@ export interface ResolvedDeviceFrameDescriptor {
|
|
|
82
173
|
};
|
|
83
174
|
frameRotation: number;
|
|
84
175
|
frameBehindContent: boolean;
|
|
176
|
+
browserStyle?: OrientationConfigData['browserStyle'];
|
|
85
177
|
disableOverlays: boolean;
|
|
86
178
|
}
|
|
87
179
|
export declare function invalidateDeviceConfigCache(): void;
|
|
@@ -91,4 +183,5 @@ export declare function resolveDeviceFrameDescriptor(id: DeviceFrameId, options?
|
|
|
91
183
|
export declare function rasterizeDeviceFrame(descriptor: ResolvedDeviceFrameDescriptor, outputScale: number): Promise<Buffer>;
|
|
92
184
|
export declare function getDeviceFrames(): Promise<DeviceFrameDefinition[]>;
|
|
93
185
|
export declare function getDeviceFrame(id: DeviceFrameId): Promise<DeviceFrameDefinition | undefined>;
|
|
94
|
-
export declare function applyDeviceFrame(screenshot: Buffer, deviceId: DeviceFrameId,
|
|
186
|
+
export declare function applyDeviceFrame(screenshot: Buffer, deviceId: DeviceFrameId, options?: MockupOptions): Promise<Buffer>;
|
|
187
|
+
export {};
|