autokap 1.0.6 → 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/chrome/ios-statusbar-comparison-reference.jpg +0 -0
- package/assets/chrome/ios-statusbar-dark-reference.jpg +0 -0
- package/assets/chrome/ios-statusbar-light-reference.jpg +0 -0
- package/assets/cursors/macos.svg +4 -0
- package/assets/cursors/windows.svg +15 -0
- package/assets/devices/ipad-pro-11-m4.json +52 -0
- package/assets/devices/iphone-16-pro.json +53 -0
- package/assets/devices/macbook-air-13.json +45 -0
- package/assets/frames/MacBook Air 13.svg +242 -0
- package/assets/frames/Status bar - iPhone.png +0 -0
- Menu bar- iPad.png +0 -0
- package/assets/frames/iPad Pro M4 11_.png +0 -0
- package/assets/frames/iPhone 16 Pro.png +0 -0
- package/assets/icons/Cellular Connection.svg +3 -0
- package/assets/icons/Union.svg +6 -0
- package/assets/icons/Wifi.svg +3 -0
- package/assets/icons/battery.svg +5 -0
- package/assets/icons/battery_charging.svg +8 -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/abort.d.ts +5 -0
- package/dist/abort.js +44 -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 +226 -0
- package/dist/agent.js +6666 -0
- 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/billing-operation-logging.d.ts +38 -0
- package/dist/billing-operation-logging.js +248 -0
- package/dist/browser-bar.d.ts +48 -0
- package/dist/browser-bar.js +284 -0
- 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 +76 -1
- package/dist/browser.js +1657 -39
- package/dist/capture-alt-text.d.ts +12 -0
- package/dist/capture-alt-text.js +52 -0
- package/dist/capture-encryption.d.ts +10 -0
- package/dist/capture-encryption.js +41 -0
- package/dist/capture-language-preflight.d.ts +41 -0
- package/dist/capture-language-preflight.js +300 -0
- package/dist/capture-llm-page-identity.d.ts +15 -0
- package/dist/capture-llm-page-identity.js +128 -0
- package/dist/capture-model-resolution.d.ts +9 -0
- package/dist/capture-model-resolution.js +21 -0
- package/dist/capture-page-identity.d.ts +7 -0
- package/dist/capture-page-identity.js +352 -0
- package/dist/capture-preset-credentials.d.ts +62 -0
- package/dist/capture-preset-credentials.js +184 -0
- package/dist/capture-request-plan.d.ts +58 -0
- package/dist/capture-request-plan.js +264 -0
- package/dist/capture-run-optimizer.d.ts +139 -0
- package/dist/capture-run-optimizer.js +863 -0
- package/dist/capture-selector-memory.d.ts +31 -0
- package/dist/capture-selector-memory.js +345 -0
- package/dist/capture-session-profile-encryption.d.ts +2 -0
- package/dist/capture-session-profile-encryption.js +22 -0
- package/dist/capture-step-timeout.d.ts +10 -0
- package/dist/capture-step-timeout.js +30 -0
- package/dist/capture-strategy.d.ts +36 -0
- package/dist/capture-strategy.js +95 -0
- package/dist/capture-studio-sync.d.ts +23 -0
- package/dist/capture-studio-sync.js +172 -0
- 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 +56 -0
- package/dist/capture-variant-state.js +182 -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 -252
- package/dist/clip-orchestrator.d.ts +148 -0
- package/dist/clip-orchestrator.js +957 -0
- package/dist/clip-postprocess.d.ts +42 -0
- package/dist/clip-postprocess.js +201 -0
- package/dist/cookie-dismiss.d.ts +2 -0
- package/dist/cookie-dismiss.js +48 -13
- package/dist/cost-logging.d.ts +35 -0
- package/dist/cost-logging.js +242 -0
- package/dist/cost-resolution-monitor.d.ts +16 -0
- package/dist/cost-resolution-monitor.js +34 -0
- package/dist/credential-templates.d.ts +5 -0
- package/dist/credential-templates.js +60 -0
- 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 +13 -0
- package/dist/element-capture.js +522 -0
- 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.d.ts +138 -0
- package/dist/hybrid-navigator.js +468 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +17 -0
- 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/llm-usage.d.ts +17 -0
- package/dist/llm-usage.js +45 -0
- package/dist/logger.d.ts +6 -2
- package/dist/logger.js +15 -1
- package/dist/mockup-html.d.ts +119 -0
- package/dist/mockup-html.js +263 -0
- package/dist/mockup.d.ts +187 -0
- package/dist/mockup.js +869 -0
- package/dist/mouse-animation.d.ts +46 -0
- package/dist/mouse-animation.js +114 -0
- 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/overlay-utils.d.ts +14 -0
- package/dist/overlay-utils.js +13 -0
- package/dist/postcondition.d.ts +16 -0
- package/dist/postcondition.js +269 -0
- package/dist/posthog.d.ts +4 -0
- package/dist/posthog.js +26 -0
- package/dist/program-patcher.d.ts +25 -0
- package/dist/program-patcher.js +44 -0
- package/dist/prompt-cache.d.ts +10 -0
- package/dist/prompt-cache.js +24 -0
- package/dist/prompts.d.ts +175 -0
- package/dist/prompts.js +1038 -0
- 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 +215 -0
- package/dist/remote-browser.js +360 -0
- 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 +21 -0
- package/dist/security.js +608 -0
- 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 +125 -0
- package/dist/server-capture-runtime.js +585 -0
- package/dist/server-credit-usage.d.ts +12 -0
- package/dist/server-credit-usage.js +41 -0
- package/dist/server-posthog.d.ts +2 -0
- package/dist/server-posthog.js +16 -0
- package/dist/server-project-webhooks.d.ts +59 -0
- package/dist/server-project-webhooks.js +123 -0
- package/dist/server-screenshot-watermark.d.ts +7 -0
- package/dist/server-screenshot-watermark.js +60 -0
- package/dist/session-profile.d.ts +86 -0
- package/dist/session-profile.js +1536 -0
- package/dist/sf-pro-fonts.d.ts +4 -0
- package/dist/sf-pro-fonts.js +7 -0
- 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-l10n.d.ts +14 -0
- package/dist/status-bar-l10n.js +177 -0
- package/dist/status-bar-render.d.ts +20 -0
- package/dist/status-bar-render.js +410 -0
- package/dist/status-bar.d.ts +53 -0
- package/dist/status-bar.js +620 -0
- 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.d.ts +4 -0
- package/dist/tools.js +216 -0
- 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.d.ts +143 -0
- package/dist/video-agent.js +4788 -0
- package/dist/video-observation.d.ts +36 -0
- package/dist/video-observation.js +192 -0
- package/dist/video-planner.d.ts +12 -0
- package/dist/video-planner.js +501 -0
- package/dist/video-prompts.d.ts +37 -0
- package/dist/video-prompts.js +554 -0
- package/dist/video-tools.d.ts +3 -0
- package/dist/video-tools.js +59 -0
- package/dist/video-variant-state.d.ts +29 -0
- package/dist/video-variant-state.js +80 -0
- package/dist/vision-model.d.ts +17 -0
- package/dist/vision-model.js +74 -0
- package/dist/web-playwright-local.d.ts +126 -0
- package/dist/web-playwright-local.js +819 -0
- package/dist/ws-auth.d.ts +20 -0
- package/dist/ws-auth.js +70 -0
- 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.d.ts +10 -0
- package/dist/ws-handler.js +1793 -0
- package/dist/ws-metrics-server.d.ts +9 -0
- package/dist/ws-metrics-server.js +31 -0
- package/dist/ws-server.d.ts +9 -0
- package/dist/ws-server.js +92 -0
- package/package.json +142 -71
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser bar — dispatches between coded browser chrome styles (Chrome, Safari, …).
|
|
3
|
+
*
|
|
4
|
+
* Chrome: pixel-perfect from toolbar4.svg (ref 2160×129, two-row layout).
|
|
5
|
+
* Safari: ref 1500×52, single-row toolbar with SF Pro Symbols icons.
|
|
6
|
+
*
|
|
7
|
+
* Dynamic content (page title, URL, favicon) overlaid as HTML.
|
|
8
|
+
* SF Pro embedded fonts for cross-OS rendering.
|
|
9
|
+
*/
|
|
10
|
+
import { SF_PRO_TEXT_REGULAR, SF_PRO_TEXT_SEMIBOLD, } from './sf-pro-fonts.js';
|
|
11
|
+
import { generateSafariBrowserBarHtml, generateSafariBrowserBarSvg, } from './safari-browser-bar.js';
|
|
12
|
+
// ── Dispatcher ───────────────────────────────────────────────────────────
|
|
13
|
+
export function generateBrowserBarHtml(options) {
|
|
14
|
+
return options.config.style === 'safari'
|
|
15
|
+
? generateSafariBrowserBarHtml(options)
|
|
16
|
+
: generateChromeBrowserBarHtml(options);
|
|
17
|
+
}
|
|
18
|
+
export function generateBrowserBarSvg(options) {
|
|
19
|
+
return options.config.style === 'safari'
|
|
20
|
+
? generateSafariBrowserBarSvg(options)
|
|
21
|
+
: generateChromeBrowserBarSvg(options);
|
|
22
|
+
}
|
|
23
|
+
// ── SF Pro ───────────────────────────────────────────────────────────────
|
|
24
|
+
const SF = `<style>
|
|
25
|
+
@font-face{font-family:'SF Pro Text';src:local('SF Pro Text'),local('.SFNSText'),url('${SF_PRO_TEXT_REGULAR}') format('woff2');font-weight:400;font-style:normal}
|
|
26
|
+
@font-face{font-family:'SF Pro Text';src:local('SF Pro Text Semibold'),local('.SFNSText-Semibold'),url('${SF_PRO_TEXT_SEMIBOLD}') format('woff2');font-weight:600;font-style:normal}
|
|
27
|
+
</style>`;
|
|
28
|
+
const FF = "'SF Pro Text',-apple-system,BlinkMacSystemFont,system-ui,sans-serif";
|
|
29
|
+
// ── Reference ────────────────────────────────────────────────────────────
|
|
30
|
+
const REF_W = 2160;
|
|
31
|
+
const REF_H = 129; // SVG viewBox height (includes 1.5px bottom border)
|
|
32
|
+
// Right margins (distance from right edge at ref width 2160)
|
|
33
|
+
const TAB_OVERFLOW_MR = 51; // tab overflow rect x=2109 → margin 51
|
|
34
|
+
const ADDR_BAR_ML = 174; // address bar left x (was 234 with home icon)
|
|
35
|
+
const ADDR_BAR_MR = 126; // address bar right margin (2160-2034)
|
|
36
|
+
const PROFILE_MR = 102; // profile rect x=2058 → margin 102
|
|
37
|
+
const EAR_R_MR = 16.5; // right ear margin
|
|
38
|
+
// ── Chrome generator (HTML) ──────────────────────────────────────────────
|
|
39
|
+
export function generateChromeBrowserBarHtml(options) {
|
|
40
|
+
const { config, width, height, pixelScale = 1 } = options;
|
|
41
|
+
const title = esc(config.pageTitle || 'New Tab');
|
|
42
|
+
const rawUrl = config.url || 'example.com';
|
|
43
|
+
const url = esc(rawUrl.replace(/^https?:\/\//, '').replace(/\/$/, ''));
|
|
44
|
+
const icon = config.tabIconUrl;
|
|
45
|
+
const isDark = config.colorScheme === 'dark';
|
|
46
|
+
// Scale: fit reference height into target height
|
|
47
|
+
const s = height / REF_H;
|
|
48
|
+
const iw = Math.round(width / s); // internal width at reference scale
|
|
49
|
+
const ts = s * pixelScale;
|
|
50
|
+
// Dynamic right-anchored positions
|
|
51
|
+
const dx = iw - REF_W; // offset for right-anchored elements
|
|
52
|
+
const tabOverflowX = iw - TAB_OVERFLOW_MR;
|
|
53
|
+
const addrBarW = iw - ADDR_BAR_ML - ADDR_BAR_MR;
|
|
54
|
+
const profileX = iw - PROFILE_MR;
|
|
55
|
+
const earRX = iw - EAR_R_MR;
|
|
56
|
+
// Color tokens: light ↔ dark
|
|
57
|
+
const tabStripBg = isDark ? '#1F2020' : '#DEDEDE';
|
|
58
|
+
const tabBg = isDark ? '#3C3C3C' : '#FFFFFF';
|
|
59
|
+
const toolbarBg = isDark ? '#3C3C3C' : '#FFFFFF';
|
|
60
|
+
const addrBarBg = isDark ? '#282828' : '#F1F1F1';
|
|
61
|
+
const addrIconBg = isDark ? '#3C3C3C' : '#FFFFFF';
|
|
62
|
+
const borderColor = isDark ? '#454746' : '#CFCFCF';
|
|
63
|
+
const textColor = isDark ? '#E3E3E3' : '#1D1D1D';
|
|
64
|
+
const textSec = isDark ? '#C7C7C7' : '#5F6368';
|
|
65
|
+
const iconActive = isDark ? '#C7C7C7' : '#5F6368';
|
|
66
|
+
const iconDis = isDark ? '#7B7B7B' : '#BBBFC4';
|
|
67
|
+
// Tab favicon overlay — aligned with close X center (y=30, icon 24px → top=18)
|
|
68
|
+
const tabFaviconOverlay = icon
|
|
69
|
+
? `<div style="position:absolute;left:152px;top:18px;width:24px;height:24px;display:flex;align-items:center;justify-content:center"><img src="${attr(icon)}" style="width:21px;height:21px;border-radius:4px;object-fit:contain" alt=""></div>`
|
|
70
|
+
: `<div style="position:absolute;left:152px;top:18px;width:24px;height:24px;display:flex;align-items:center;justify-content:center"><svg width="21" height="21" viewBox="0 0 16 16" fill="none"><circle cx="8" cy="8" r="6.5" stroke="${iconActive}" stroke-width="1.2"/><ellipse cx="8" cy="8" rx="3" ry="6.5" stroke="${iconActive}" stroke-width="1.2"/><line x1="1.5" y1="8" x2="14.5" y2="8" stroke="${iconActive}" stroke-width="1.2"/></svg></div>`;
|
|
71
|
+
return `${SF}<div style="width:${iw}px;height:${REF_H}px;position:relative;transform:scale(${ts});transform-origin:top left;font-family:${FF};overflow:hidden">
|
|
72
|
+
<svg width="${iw}" height="${REF_H}" viewBox="0 0 ${iw} ${REF_H}" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
73
|
+
<!-- TAB STRIP -->
|
|
74
|
+
<g>
|
|
75
|
+
<rect width="${iw}" height="60" fill="${tabStripBg}"/>
|
|
76
|
+
<!-- Traffic lights -->
|
|
77
|
+
<circle cx="40.5" cy="30.75" r="9" fill="#EC6A5E"/>
|
|
78
|
+
<circle cx="40.5" cy="30.75" r="8.25" stroke="#1F1F1F" stroke-opacity="0.06" stroke-width="1.5"/>
|
|
79
|
+
<circle cx="70.5" cy="30.75" r="9" fill="#F4BF4F"/>
|
|
80
|
+
<circle cx="70.5" cy="30.75" r="8.25" stroke="#1F1F1F" stroke-opacity="0.06" stroke-width="1.5"/>
|
|
81
|
+
<circle cx="100.5" cy="30.75" r="9" fill="#61C554"/>
|
|
82
|
+
<circle cx="100.5" cy="30.75" r="8.25" stroke="#1F1F1F" stroke-opacity="0.06" stroke-width="1.5"/>
|
|
83
|
+
<!-- Left ear -->
|
|
84
|
+
<path d="M120 60C129.941 60 138 51.9411 138 42V60H120Z" fill="${tabBg}"/>
|
|
85
|
+
<!-- Active tab -->
|
|
86
|
+
<path d="M138 24C138 15.7157 144.716 9 153 9H471C479.284 9 486 15.7157 486 24V60H138V24Z" fill="${tabBg}"/>
|
|
87
|
+
<!-- Close X -->
|
|
88
|
+
<path d="M457.668 35.5689L456.431 34.3314L460.762 30.0001L456.431 25.6689L457.668 24.4314L461.999 28.7626L466.331 24.4314L467.568 25.6689L463.237 30.0001L467.568 34.3314L466.331 35.5689L461.999 31.2376L457.668 35.5689Z" fill="${textColor}"/>
|
|
89
|
+
<!-- Right ear -->
|
|
90
|
+
<path d="M504 60C494.059 60 486 51.9411 486 42V60H504Z" fill="${tabBg}"/>
|
|
91
|
+
<!-- New tab + -->
|
|
92
|
+
<path d="M513.327 31.1749H506.877V28.8249H513.327V22.3499H515.677V28.8249H522.152V31.1749H515.677V37.6249H513.327V31.1749Z" fill="${iconActive}"/>
|
|
93
|
+
<!-- Tab overflow (right-anchored) -->
|
|
94
|
+
<rect x="${tabOverflowX}" y="9" width="42" height="42" rx="15" fill="${tabBg}"/>
|
|
95
|
+
<path d="M${tabOverflowX + 21} 33.95L${tabOverflowX + 14.4} 27.35L${tabOverflowX + 16.07} 25.675L${tabOverflowX + 21} 30.625L${tabOverflowX + 25.92} 25.7L${tabOverflowX + 27.6} 27.375L${tabOverflowX + 21} 33.95Z" fill="${textColor}"/>
|
|
96
|
+
</g>
|
|
97
|
+
<!-- BOTTOM EARS -->
|
|
98
|
+
<path d="M16.5 60C7.3873 60 0 67.3873 0 76.5V60H16.5Z" fill="${tabStripBg}"/>
|
|
99
|
+
<path d="M${earRX} 60C${earRX + 9.11} 60 ${iw} 67.3873 ${iw} 76.5V60H${earRX}Z" fill="${tabStripBg}"/>
|
|
100
|
+
<!-- TOOLBAR -->
|
|
101
|
+
<g clip-path="url(#bb_clip_toolbar)">
|
|
102
|
+
<path d="M0 76C0 67.1634 7.16344 60 16 60H${iw - 16}C${iw - 7.16} 60 ${iw} 67.1634 ${iw} 76V129H0V76Z" fill="${toolbarBg}"/>
|
|
103
|
+
<!-- Back arrow -->
|
|
104
|
+
<path d="M28.3125 95.625L34.5938 101.906L33 103.5L24 94.5L33 85.5L34.5938 87.0938L28.3125 93.375H42V95.625H28.3125Z" fill="${iconDis}"/>
|
|
105
|
+
<!-- Forward arrow -->
|
|
106
|
+
<path d="M91.6875 95.625L85.4062 101.906L87 103.5L96 94.5L87 85.5L85.4062 87.0938L91.6875 93.375H78V95.625H91.6875Z" fill="${iconDis}"/>
|
|
107
|
+
<!-- Reload -->
|
|
108
|
+
<path d="M141 103.5C138.5 103.5 136.375 102.625 134.625 100.875C132.875 99.125 132 97 132 94.5C132 92 132.875 89.875 134.625 88.125C136.375 86.375 138.5 85.5 141 85.5C142.354 85.5 143.609 85.7812 144.766 86.3438C145.922 86.9062 146.917 87.6562 147.75 88.5938V85.5H150V93H142.5V90.75H146.594C145.99 89.8333 145.198 89.1042 144.219 88.5625C143.24 88.0208 142.167 87.75 141 87.75C139.125 87.75 137.531 88.4062 136.219 89.7188C134.906 91.0312 134.25 92.625 134.25 94.5C134.25 96.375 134.906 97.9688 136.219 99.2812C137.531 100.594 139.125 101.25 141 101.25C142.75 101.25 144.25 100.672 145.5 99.5156C146.75 98.3594 147.469 96.9375 147.656 95.25H149.969C149.781 97.5833 148.833 99.5417 147.125 101.125C145.417 102.708 143.375 103.5 141 103.5Z" fill="${iconActive}"/>
|
|
109
|
+
<!-- Address bar pill (dynamic width) -->
|
|
110
|
+
<rect x="${ADDR_BAR_ML}" y="69" width="${addrBarW}" height="51" rx="25.5" fill="${addrBarBg}"/>
|
|
111
|
+
<!-- Site icon circle -->
|
|
112
|
+
<rect x="${ADDR_BAR_ML + 7.5}" y="76.5" width="36" height="36" rx="18" fill="${addrIconBg}"/>
|
|
113
|
+
<!-- Control center / sliders icon (from Union.svg, scaled to 18×18 and centered in the 36×36 circle) -->
|
|
114
|
+
<g transform="translate(${ADDR_BAR_ML + 16.5},${76.5 + 9}) scale(1.5)">
|
|
115
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.5 6.70898C10.8806 6.70898 11.9998 7.82848 12 9.20898C12 10.5897 10.8807 11.709 9.5 11.709C8.11929 11.709 7 10.5897 7 9.20898C7.00024 7.82848 8.11944 6.70898 9.5 6.70898ZM9.5 8.20898C8.94786 8.20898 8.50024 8.6569 8.5 9.20898C8.5 9.76127 8.94772 10.209 9.5 10.209C10.0523 10.209 10.5 9.76127 10.5 9.20898C10.4998 8.6569 10.0521 8.20898 9.5 8.20898Z" fill="${iconActive}"/>
|
|
116
|
+
<path d="M6 10H0V8.5H6V10Z" fill="${iconActive}"/>
|
|
117
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M2.5 0C3.88071 0 5 1.11929 5 2.5C5 3.88071 3.88071 5 2.5 5C1.11929 5 0 3.88071 0 2.5C0 1.11929 1.11929 0 2.5 0ZM2.5 1.5C1.94772 1.5 1.5 1.94772 1.5 2.5C1.5 3.05228 1.94772 3.5 2.5 3.5C3.05228 3.5 3.5 3.05228 3.5 2.5C3.5 1.94772 3.05228 1.5 2.5 1.5Z" fill="${iconActive}"/>
|
|
118
|
+
<path d="M12 3.20898H6V1.70898H12V3.20898Z" fill="${iconActive}"/>
|
|
119
|
+
</g>
|
|
120
|
+
<!-- Star (right-anchored) -->
|
|
121
|
+
<path transform="translate(${dx},0)" d="M1994 100.344L1998 97.9688L2002.03 100.344L2000.97 95.8438L2004.44 92.875L1999.84 92.4688L1998 88.1875L1996.16 92.4688L1991.56 92.875L1995.06 95.8438L1994 100.344ZM1990.59 105L1992.56 96.6875L1986 91.0938L1994.62 90.3438L1998 82.5L2001.38 90.375L2010 91.0938L2003.44 96.6875L2005.41 105L1998 100.594L1990.59 105Z" fill="${iconActive}"/>
|
|
122
|
+
<!-- Profile avatar (right-anchored) -->
|
|
123
|
+
<rect x="${profileX}" y="79.5" width="30" height="30" rx="15" fill="url(#bb_profile_grad)"/>
|
|
124
|
+
<rect x="${profileX + 0.75}" y="80.25" width="28.5" height="28.5" rx="14.25" stroke="#1F1F1F" stroke-opacity="0.06" stroke-width="1.5"/>
|
|
125
|
+
<!-- Extensions dots (right-anchored) -->
|
|
126
|
+
<path transform="translate(${dx},0)" d="M2127 105.404C2126.38 105.404 2125.85 105.183 2125.41 104.743C2124.97 104.302 2124.75 103.773 2124.75 103.154C2124.75 102.535 2124.97 102.005 2125.41 101.565C2125.85 101.124 2126.38 100.904 2127 100.904C2127.62 100.904 2128.15 101.124 2128.59 101.565C2129.03 102.005 2129.25 102.535 2129.25 103.154C2129.25 103.773 2129.03 104.302 2128.59 104.743C2128.15 105.183 2127.62 105.404 2127 105.404ZM2127 96.7499C2126.38 96.7499 2125.85 96.5296 2125.41 96.089C2124.97 95.6484 2124.75 95.1187 2124.75 94.5C2124.75 93.8812 2124.97 93.3516 2125.41 92.9109C2125.85 92.4703 2126.38 92.25 2127 92.25C2127.62 92.25 2128.15 92.4703 2128.59 92.9109C2129.03 93.3516 2129.25 93.8812 2129.25 94.5C2129.25 95.1187 2129.03 95.6484 2128.59 96.089C2128.15 96.5296 2127.62 96.7499 2127 96.7499ZM2127 88.0961C2126.38 88.0961 2125.85 87.8758 2125.41 87.4351C2124.97 86.9945 2124.75 86.4649 2124.75 85.8461C2124.75 85.2274 2124.97 84.6977 2125.41 84.2571C2125.85 83.8165 2126.38 83.5962 2127 83.5962C2127.62 83.5962 2128.15 83.8165 2128.59 84.2571C2129.03 84.6977 2129.25 85.2274 2129.25 85.8461C2129.25 86.4649 2129.03 86.9945 2128.59 87.4351C2128.15 87.8758 2127.62 88.0961 2127 88.0961Z" fill="${iconActive}"/>
|
|
127
|
+
</g>
|
|
128
|
+
<!-- TOOLBAR BORDER -->
|
|
129
|
+
<path d="M0 60H${iw}H0M${iw} 130.5H0V127.5H${iw}V130.5ZM${iw} 127.5M0 129V60V129M0 129M${iw} 60V129V60" fill="${borderColor}" mask="url(#bb_mask_toolbar)"/>
|
|
130
|
+
<!-- DEFS -->
|
|
131
|
+
<defs>
|
|
132
|
+
<linearGradient id="bb_profile_grad" x1="${profileX + 15}" y1="109.5" x2="${profileX + 15}" y2="79.5" gradientUnits="userSpaceOnUse">
|
|
133
|
+
<stop stop-color="#D5D8E4"/><stop offset="0.45" stop-color="#D1CAD6"/><stop offset="1" stop-color="#B7BAD1"/>
|
|
134
|
+
</linearGradient>
|
|
135
|
+
<mask id="bb_mask_toolbar" fill="white">
|
|
136
|
+
<path d="M0 76C0 67.1634 7.16344 60 16 60H${iw - 16}C${iw - 7.16} 60 ${iw} 67.1634 ${iw} 76V129H0V76Z"/>
|
|
137
|
+
</mask>
|
|
138
|
+
<clipPath id="bb_clip_toolbar">
|
|
139
|
+
<path d="M0 76C0 67.1634 7.16344 60 16 60H${iw - 16}C${iw - 7.16} 60 ${iw} 67.1634 ${iw} 76V129H0V76Z"/>
|
|
140
|
+
</clipPath>
|
|
141
|
+
</defs>
|
|
142
|
+
</svg>
|
|
143
|
+
<!-- DYNAMIC OVERLAYS -->
|
|
144
|
+
${tabFaviconOverlay}
|
|
145
|
+
<div style="position:absolute;left:187px;top:15px;width:260px;height:30px;display:flex;align-items:center;overflow:hidden;-webkit-mask-image:linear-gradient(to right,#000 85%,transparent 100%);mask-image:linear-gradient(to right,#000 85%,transparent 100%)"><span style="font-size:18px;font-weight:400;color:${textColor};white-space:nowrap;line-height:30px">${title}</span></div>
|
|
146
|
+
<div style="position:absolute;left:${ADDR_BAR_ML + 58}px;top:69px;right:${iw - (ADDR_BAR_ML + addrBarW - 18)}px;height:51px;display:flex;align-items:center;overflow:hidden"><span style="font-size:19.5px;font-weight:400;color:${textSec};white-space:nowrap;overflow:hidden;text-overflow:ellipsis;line-height:30px">${url}</span></div>
|
|
147
|
+
</div>`;
|
|
148
|
+
}
|
|
149
|
+
// ── Helpers ───────────────────────────────────────────────────────────────
|
|
150
|
+
function esc(s) {
|
|
151
|
+
return s.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
|
|
152
|
+
}
|
|
153
|
+
function attr(s) {
|
|
154
|
+
return s.replace(/&/g, '&').replace(/"/g, '"');
|
|
155
|
+
}
|
|
156
|
+
// ── Chrome generator (SVG, for sharp compositing — no Playwright) ──────
|
|
157
|
+
// Produces a self-contained SVG string rasterizable by @resvg/resvg-js.
|
|
158
|
+
/** SF Pro font CSS for embedding inside SVG <defs><style>. No local() — resvg only supports url(). */
|
|
159
|
+
const SVG_BB_FONT_CSS = `
|
|
160
|
+
@font-face{font-family:'SF Pro Text';src:url('${SF_PRO_TEXT_REGULAR}') format('woff2');font-weight:400;font-style:normal}
|
|
161
|
+
@font-face{font-family:'SF Pro Text';src:url('${SF_PRO_TEXT_SEMIBOLD}') format('woff2');font-weight:600;font-style:normal}
|
|
162
|
+
`;
|
|
163
|
+
const SVG_BB_FF = "'SF Pro Text',system-ui,sans-serif";
|
|
164
|
+
/**
|
|
165
|
+
* Generate a self-contained SVG string for the Chrome browser bar.
|
|
166
|
+
* Used by the sharp compositing pipeline (no Playwright).
|
|
167
|
+
* Returns an SVG at the target width×height with embedded fonts.
|
|
168
|
+
*/
|
|
169
|
+
export function generateChromeBrowserBarSvg(options) {
|
|
170
|
+
const { config, width, height } = options;
|
|
171
|
+
const title = esc(config.pageTitle || 'New Tab');
|
|
172
|
+
const rawUrl = config.url || 'example.com';
|
|
173
|
+
const url = esc(rawUrl.replace(/^https?:\/\//, '').replace(/\/$/, ''));
|
|
174
|
+
const icon = config.tabIconUrl;
|
|
175
|
+
const isDark = config.colorScheme === 'dark';
|
|
176
|
+
// Scale: fit reference height into target height
|
|
177
|
+
const s = height / REF_H;
|
|
178
|
+
const iw = Math.round(width / s);
|
|
179
|
+
// Dynamic right-anchored positions
|
|
180
|
+
const dx = iw - REF_W;
|
|
181
|
+
const tabOverflowX = iw - TAB_OVERFLOW_MR;
|
|
182
|
+
const addrBarW = iw - ADDR_BAR_ML - ADDR_BAR_MR;
|
|
183
|
+
const profileX = iw - PROFILE_MR;
|
|
184
|
+
const earRX = iw - EAR_R_MR;
|
|
185
|
+
// Color tokens
|
|
186
|
+
const tabStripBg = isDark ? '#1F2020' : '#DEDEDE';
|
|
187
|
+
const tabBg = isDark ? '#3C3C3C' : '#FFFFFF';
|
|
188
|
+
const toolbarBg = isDark ? '#3C3C3C' : '#FFFFFF';
|
|
189
|
+
const addrBarBg = isDark ? '#282828' : '#F1F1F1';
|
|
190
|
+
const addrIconBg = isDark ? '#3C3C3C' : '#FFFFFF';
|
|
191
|
+
const borderColor = isDark ? '#454746' : '#CFCFCF';
|
|
192
|
+
const textColor = isDark ? '#E3E3E3' : '#1D1D1D';
|
|
193
|
+
const textSec = isDark ? '#C7C7C7' : '#5F6368';
|
|
194
|
+
const iconActive = isDark ? '#C7C7C7' : '#5F6368';
|
|
195
|
+
const iconDis = isDark ? '#7B7B7B' : '#BBBFC4';
|
|
196
|
+
// Tab favicon — inline SVG globe fallback (no <img> in pure SVG)
|
|
197
|
+
const tabFavicon = icon
|
|
198
|
+
? `<image href="${attr(icon)}" x="153.5" y="19.5" width="21" height="21" preserveAspectRatio="xMidYMid meet"/>`
|
|
199
|
+
: `<g transform="translate(152,18)"><svg width="24" height="24" viewBox="0 0 16 16" fill="none"><circle cx="8" cy="8" r="6.5" stroke="${iconActive}" stroke-width="1.2"/><ellipse cx="8" cy="8" rx="3" ry="6.5" stroke="${iconActive}" stroke-width="1.2"/><line x1="1.5" y1="8" x2="14.5" y2="8" stroke="${iconActive}" stroke-width="1.2"/></svg></g>`;
|
|
200
|
+
// Page title — clipPath with gradient mask for fade-out
|
|
201
|
+
const titleClipId = 'bb_svg_title_clip';
|
|
202
|
+
const titleMaskId = 'bb_svg_title_mask';
|
|
203
|
+
const titleGradId = 'bb_svg_title_grad';
|
|
204
|
+
const titleX = 187;
|
|
205
|
+
const titleY = 15;
|
|
206
|
+
const titleW = 260;
|
|
207
|
+
const titleH = 30;
|
|
208
|
+
// URL in address bar
|
|
209
|
+
const urlX = ADDR_BAR_ML + 58;
|
|
210
|
+
const urlW = addrBarW - 58 - 18;
|
|
211
|
+
const urlClipId = 'bb_svg_url_clip';
|
|
212
|
+
// Build the full SVG at reference dimensions, then use viewBox to scale.
|
|
213
|
+
// fill="none" is critical — without it, elements that only define stroke
|
|
214
|
+
// (e.g. traffic light border circles) inherit the default fill="black"
|
|
215
|
+
// and hide the colored circles underneath.
|
|
216
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="${width}" height="${height}" viewBox="0 0 ${iw} ${REF_H}" fill="none">
|
|
217
|
+
<defs>
|
|
218
|
+
<style>${SVG_BB_FONT_CSS}</style>
|
|
219
|
+
<linearGradient id="bb_profile_grad" x1="${profileX + 15}" y1="109.5" x2="${profileX + 15}" y2="79.5" gradientUnits="userSpaceOnUse">
|
|
220
|
+
<stop stop-color="#D5D8E4"/><stop offset="0.45" stop-color="#D1CAD6"/><stop offset="1" stop-color="#B7BAD1"/>
|
|
221
|
+
</linearGradient>
|
|
222
|
+
<mask id="bb_mask_toolbar" fill="white">
|
|
223
|
+
<path d="M0 76C0 67.1634 7.16344 60 16 60H${iw - 16}C${iw - 7.16} 60 ${iw} 67.1634 ${iw} 76V129H0V76Z"/>
|
|
224
|
+
</mask>
|
|
225
|
+
<clipPath id="bb_clip_toolbar">
|
|
226
|
+
<path d="M0 76C0 67.1634 7.16344 60 16 60H${iw - 16}C${iw - 7.16} 60 ${iw} 67.1634 ${iw} 76V129H0V76Z"/>
|
|
227
|
+
</clipPath>
|
|
228
|
+
<clipPath id="${titleClipId}"><rect x="${titleX}" y="${titleY}" width="${titleW}" height="${titleH}"/></clipPath>
|
|
229
|
+
<linearGradient id="${titleGradId}" x1="${titleX}" y1="0" x2="${titleX + titleW}" y2="0" gradientUnits="userSpaceOnUse">
|
|
230
|
+
<stop offset="0.85" stop-color="white"/><stop offset="1" stop-color="white" stop-opacity="0"/>
|
|
231
|
+
</linearGradient>
|
|
232
|
+
<mask id="${titleMaskId}"><rect x="${titleX}" y="${titleY}" width="${titleW}" height="${titleH}" fill="url(#${titleGradId})"/></mask>
|
|
233
|
+
<clipPath id="${urlClipId}"><rect x="${urlX}" y="69" width="${urlW}" height="51"/></clipPath>
|
|
234
|
+
</defs>
|
|
235
|
+
<!-- TAB STRIP -->
|
|
236
|
+
<g>
|
|
237
|
+
<rect width="${iw}" height="60" fill="${tabStripBg}"/>
|
|
238
|
+
<circle cx="40.5" cy="30.75" r="9" fill="#EC6A5E"/>
|
|
239
|
+
<circle cx="40.5" cy="30.75" r="8.25" stroke="#1F1F1F" stroke-opacity="0.06" stroke-width="1.5"/>
|
|
240
|
+
<circle cx="70.5" cy="30.75" r="9" fill="#F4BF4F"/>
|
|
241
|
+
<circle cx="70.5" cy="30.75" r="8.25" stroke="#1F1F1F" stroke-opacity="0.06" stroke-width="1.5"/>
|
|
242
|
+
<circle cx="100.5" cy="30.75" r="9" fill="#61C554"/>
|
|
243
|
+
<circle cx="100.5" cy="30.75" r="8.25" stroke="#1F1F1F" stroke-opacity="0.06" stroke-width="1.5"/>
|
|
244
|
+
<path d="M120 60C129.941 60 138 51.9411 138 42V60H120Z" fill="${tabBg}"/>
|
|
245
|
+
<path d="M138 24C138 15.7157 144.716 9 153 9H471C479.284 9 486 15.7157 486 24V60H138V24Z" fill="${tabBg}"/>
|
|
246
|
+
<path d="M457.668 35.5689L456.431 34.3314L460.762 30.0001L456.431 25.6689L457.668 24.4314L461.999 28.7626L466.331 24.4314L467.568 25.6689L463.237 30.0001L467.568 34.3314L466.331 35.5689L461.999 31.2376L457.668 35.5689Z" fill="${textColor}"/>
|
|
247
|
+
<path d="M504 60C494.059 60 486 51.9411 486 42V60H504Z" fill="${tabBg}"/>
|
|
248
|
+
<path d="M513.327 31.1749H506.877V28.8249H513.327V22.3499H515.677V28.8249H522.152V31.1749H515.677V37.6249H513.327V31.1749Z" fill="${iconActive}"/>
|
|
249
|
+
<rect x="${tabOverflowX}" y="9" width="42" height="42" rx="15" fill="${tabBg}"/>
|
|
250
|
+
<path d="M${tabOverflowX + 21} 33.95L${tabOverflowX + 14.4} 27.35L${tabOverflowX + 16.07} 25.675L${tabOverflowX + 21} 30.625L${tabOverflowX + 25.92} 25.7L${tabOverflowX + 27.6} 27.375L${tabOverflowX + 21} 33.95Z" fill="${textColor}"/>
|
|
251
|
+
</g>
|
|
252
|
+
<!-- BOTTOM EARS -->
|
|
253
|
+
<path d="M16.5 60C7.3873 60 0 67.3873 0 76.5V60H16.5Z" fill="${tabStripBg}"/>
|
|
254
|
+
<path d="M${earRX} 60C${earRX + 9.11} 60 ${iw} 67.3873 ${iw} 76.5V60H${earRX}Z" fill="${tabStripBg}"/>
|
|
255
|
+
<!-- TOOLBAR -->
|
|
256
|
+
<g clip-path="url(#bb_clip_toolbar)">
|
|
257
|
+
<path d="M0 76C0 67.1634 7.16344 60 16 60H${iw - 16}C${iw - 7.16} 60 ${iw} 67.1634 ${iw} 76V129H0V76Z" fill="${toolbarBg}"/>
|
|
258
|
+
<path d="M28.3125 95.625L34.5938 101.906L33 103.5L24 94.5L33 85.5L34.5938 87.0938L28.3125 93.375H42V95.625H28.3125Z" fill="${iconDis}"/>
|
|
259
|
+
<path d="M91.6875 95.625L85.4062 101.906L87 103.5L96 94.5L87 85.5L85.4062 87.0938L91.6875 93.375H78V95.625H91.6875Z" fill="${iconDis}"/>
|
|
260
|
+
<path d="M141 103.5C138.5 103.5 136.375 102.625 134.625 100.875C132.875 99.125 132 97 132 94.5C132 92 132.875 89.875 134.625 88.125C136.375 86.375 138.5 85.5 141 85.5C142.354 85.5 143.609 85.7812 144.766 86.3438C145.922 86.9062 146.917 87.6562 147.75 88.5938V85.5H150V93H142.5V90.75H146.594C145.99 89.8333 145.198 89.1042 144.219 88.5625C143.24 88.0208 142.167 87.75 141 87.75C139.125 87.75 137.531 88.4062 136.219 89.7188C134.906 91.0312 134.25 92.625 134.25 94.5C134.25 96.375 134.906 97.9688 136.219 99.2812C137.531 100.594 139.125 101.25 141 101.25C142.75 101.25 144.25 100.672 145.5 99.5156C146.75 98.3594 147.469 96.9375 147.656 95.25H149.969C149.781 97.5833 148.833 99.5417 147.125 101.125C145.417 102.708 143.375 103.5 141 103.5Z" fill="${iconActive}"/>
|
|
261
|
+
<rect x="${ADDR_BAR_ML}" y="69" width="${addrBarW}" height="51" rx="25.5" fill="${addrBarBg}"/>
|
|
262
|
+
<rect x="${ADDR_BAR_ML + 7.5}" y="76.5" width="36" height="36" rx="18" fill="${addrIconBg}"/>
|
|
263
|
+
<g transform="translate(${ADDR_BAR_ML + 16.5},${76.5 + 9}) scale(1.5)">
|
|
264
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.5 6.70898C10.8806 6.70898 11.9998 7.82848 12 9.20898C12 10.5897 10.8807 11.709 9.5 11.709C8.11929 11.709 7 10.5897 7 9.20898C7.00024 7.82848 8.11944 6.70898 9.5 6.70898ZM9.5 8.20898C8.94786 8.20898 8.50024 8.6569 8.5 9.20898C8.5 9.76127 8.94772 10.209 9.5 10.209C10.0523 10.209 10.5 9.76127 10.5 9.20898C10.4998 8.6569 10.0521 8.20898 9.5 8.20898Z" fill="${iconActive}"/>
|
|
265
|
+
<path d="M6 10H0V8.5H6V10Z" fill="${iconActive}"/>
|
|
266
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M2.5 0C3.88071 0 5 1.11929 5 2.5C5 3.88071 3.88071 5 2.5 5C1.11929 5 0 3.88071 0 2.5C0 1.11929 1.11929 0 2.5 0ZM2.5 1.5C1.94772 1.5 1.5 1.94772 1.5 2.5C1.5 3.05228 1.94772 3.5 2.5 3.5C3.05228 3.5 3.5 3.05228 3.5 2.5C3.5 1.94772 3.05228 1.5 2.5 1.5Z" fill="${iconActive}"/>
|
|
267
|
+
<path d="M12 3.20898H6V1.70898H12V3.20898Z" fill="${iconActive}"/>
|
|
268
|
+
</g>
|
|
269
|
+
<path transform="translate(${dx},0)" d="M1994 100.344L1998 97.9688L2002.03 100.344L2000.97 95.8438L2004.44 92.875L1999.84 92.4688L1998 88.1875L1996.16 92.4688L1991.56 92.875L1995.06 95.8438L1994 100.344ZM1990.59 105L1992.56 96.6875L1986 91.0938L1994.62 90.3438L1998 82.5L2001.38 90.375L2010 91.0938L2003.44 96.6875L2005.41 105L1998 100.594L1990.59 105Z" fill="${iconActive}"/>
|
|
270
|
+
<rect x="${profileX}" y="79.5" width="30" height="30" rx="15" fill="url(#bb_profile_grad)"/>
|
|
271
|
+
<rect x="${profileX + 0.75}" y="80.25" width="28.5" height="28.5" rx="14.25" stroke="#1F1F1F" stroke-opacity="0.06" stroke-width="1.5"/>
|
|
272
|
+
<path transform="translate(${dx},0)" d="M2127 105.404C2126.38 105.404 2125.85 105.183 2125.41 104.743C2124.97 104.302 2124.75 103.773 2124.75 103.154C2124.75 102.535 2124.97 102.005 2125.41 101.565C2125.85 101.124 2126.38 100.904 2127 100.904C2127.62 100.904 2128.15 101.124 2128.59 101.565C2129.03 102.005 2129.25 102.535 2129.25 103.154C2129.25 103.773 2129.03 104.302 2128.59 104.743C2128.15 105.183 2127.62 105.404 2127 105.404ZM2127 96.7499C2126.38 96.7499 2125.85 96.5296 2125.41 96.089C2124.97 95.6484 2124.75 95.1187 2124.75 94.5C2124.75 93.8812 2124.97 93.3516 2125.41 92.9109C2125.85 92.4703 2126.38 92.25 2127 92.25C2127.62 92.25 2128.15 92.4703 2128.59 92.9109C2129.03 93.3516 2129.25 93.8812 2129.25 94.5C2129.25 95.1187 2129.03 95.6484 2128.59 96.089C2128.15 96.5296 2127.62 96.7499 2127 96.7499ZM2127 88.0961C2126.38 88.0961 2125.85 87.8758 2125.41 87.4351C2124.97 86.9945 2124.75 86.4649 2124.75 85.8461C2124.75 85.2274 2124.97 84.6977 2125.41 84.2571C2125.85 83.8165 2126.38 83.5962 2127 83.5962C2127.62 83.5962 2128.15 83.8165 2128.59 84.2571C2129.03 84.6977 2129.25 85.2274 2129.25 85.8461C2129.25 86.4649 2129.03 86.9945 2128.59 87.4351C2128.15 87.8758 2127.62 88.0961 2127 88.0961Z" fill="${iconActive}"/>
|
|
273
|
+
</g>
|
|
274
|
+
<!-- TOOLBAR BORDER -->
|
|
275
|
+
<path d="M0 60H${iw}H0M${iw} 130.5H0V127.5H${iw}V130.5ZM${iw} 127.5M0 129V60V129M0 129M${iw} 60V129V60" fill="${borderColor}" mask="url(#bb_mask_toolbar)"/>
|
|
276
|
+
<!-- DYNAMIC TEXT OVERLAYS -->
|
|
277
|
+
${tabFavicon}
|
|
278
|
+
<text mask="url(#${titleMaskId})" x="${titleX}" y="${titleY + titleH / 2 + 1}" font-family="${SVG_BB_FF}" font-size="18" font-weight="400" fill="${textColor}" dominant-baseline="central">${title}</text>
|
|
279
|
+
<g clip-path="url(#${urlClipId})">
|
|
280
|
+
<text x="${urlX}" y="${69 + 51 / 2 + 1}" font-family="${SVG_BB_FF}" font-size="19.5" font-weight="400" fill="${textSec}" dominant-baseline="central">${url}</text>
|
|
281
|
+
</g>
|
|
282
|
+
</svg>`;
|
|
283
|
+
}
|
|
284
|
+
//# sourceMappingURL=browser-bar.js.map
|
package/dist/browser-pool.d.ts
CHANGED
|
@@ -27,6 +27,13 @@ declare class BrowserPool {
|
|
|
27
27
|
releaseContext(context: BrowserContext): Promise<void>;
|
|
28
28
|
private ensureBrowser;
|
|
29
29
|
private launchBrowser;
|
|
30
|
+
/** Read-only snapshot of pool state for monitoring. */
|
|
31
|
+
getStats(): {
|
|
32
|
+
activeContexts: number;
|
|
33
|
+
queueLength: number;
|
|
34
|
+
captureCount: number;
|
|
35
|
+
maxConcurrent: number;
|
|
36
|
+
};
|
|
30
37
|
private restartBrowser;
|
|
31
38
|
}
|
|
32
39
|
/** Shared browser pool for server-side (web API) captures. */
|
package/dist/browser-pool.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { chromium } from 'playwright';
|
|
2
2
|
/** Chromium flags for server-side headless operation (used by pool and standalone launches). */
|
|
3
3
|
export const CHROMIUM_ARGS = [
|
|
4
|
-
//
|
|
5
|
-
'
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
// Linux/Docker-only: required when running Chromium as root or with limited /dev/shm
|
|
5
|
+
...(process.platform === 'linux' ? [
|
|
6
|
+
'--no-sandbox',
|
|
7
|
+
'--disable-setuid-sandbox',
|
|
8
|
+
'--disable-dev-shm-usage',
|
|
9
|
+
] : []),
|
|
9
10
|
// No GPU on headless servers
|
|
10
11
|
'--disable-gpu',
|
|
11
12
|
'--disable-gpu-sandbox',
|
|
@@ -107,6 +108,15 @@ class BrowserPool {
|
|
|
107
108
|
this.browser = null;
|
|
108
109
|
});
|
|
109
110
|
}
|
|
111
|
+
/** Read-only snapshot of pool state for monitoring. */
|
|
112
|
+
getStats() {
|
|
113
|
+
return {
|
|
114
|
+
activeContexts: this.activeContexts,
|
|
115
|
+
queueLength: this.queue.length,
|
|
116
|
+
captureCount: this.captureCount,
|
|
117
|
+
maxConcurrent: MAX_CONCURRENT,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
110
120
|
async restartBrowser() {
|
|
111
121
|
const old = this.browser;
|
|
112
122
|
this.browser = null;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standalone utility functions extracted from browser.ts.
|
|
3
|
+
* These have no class dependencies and can be safely imported anywhere.
|
|
4
|
+
*/
|
|
5
|
+
import type { OutscaleConfig } from './types.js';
|
|
6
|
+
export declare function normalizeViewportDimension(value: number): number;
|
|
7
|
+
export declare function normalizeDeviceScaleFactor(value?: number): number;
|
|
8
|
+
export declare function resolveRecordedVideoSize(viewport: {
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
}): {
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Map a BCP-47 language tag to a Playwright-compatible locale string.
|
|
17
|
+
*/
|
|
18
|
+
export declare function langToLocale(lang: string): string;
|
|
19
|
+
export declare function escapeCssAttributeValue(value: string): string;
|
|
20
|
+
export declare function escapeCssIdentifier(value: string): string;
|
|
21
|
+
export declare function withHelperTimeout<T>(label: string, timeoutMs: number | undefined, work: () => Promise<T>): Promise<T>;
|
|
22
|
+
export declare function formatUrlForSummary(rawUrl: string): string;
|
|
23
|
+
export declare function resolveEffectivePadding(config: OutscaleConfig, bbox: {
|
|
24
|
+
width: number;
|
|
25
|
+
height: number;
|
|
26
|
+
}): {
|
|
27
|
+
top: number;
|
|
28
|
+
right: number;
|
|
29
|
+
bottom: number;
|
|
30
|
+
left: number;
|
|
31
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standalone utility functions extracted from browser.ts.
|
|
3
|
+
* These have no class dependencies and can be safely imported anywhere.
|
|
4
|
+
*/
|
|
5
|
+
// -- Viewport & device utilities --
|
|
6
|
+
export function normalizeViewportDimension(value) {
|
|
7
|
+
if (!Number.isFinite(value))
|
|
8
|
+
return 1;
|
|
9
|
+
return Math.max(1, Math.round(value));
|
|
10
|
+
}
|
|
11
|
+
export function normalizeDeviceScaleFactor(value) {
|
|
12
|
+
if (!Number.isFinite(value))
|
|
13
|
+
return 2;
|
|
14
|
+
return Math.max(0.5, Math.min(4, Number(value)));
|
|
15
|
+
}
|
|
16
|
+
export function resolveRecordedVideoSize(viewport) {
|
|
17
|
+
const width = Math.max(2, Math.round(viewport.width)) & ~1;
|
|
18
|
+
const height = Math.max(2, Math.round(viewport.height)) & ~1;
|
|
19
|
+
return { width, height };
|
|
20
|
+
}
|
|
21
|
+
// -- Locale --
|
|
22
|
+
/**
|
|
23
|
+
* Map a BCP-47 language tag to a Playwright-compatible locale string.
|
|
24
|
+
*/
|
|
25
|
+
export function langToLocale(lang) {
|
|
26
|
+
if (!lang)
|
|
27
|
+
return 'en-US';
|
|
28
|
+
if (lang.includes('-') || lang.includes('_'))
|
|
29
|
+
return lang;
|
|
30
|
+
const map = {
|
|
31
|
+
en: 'en-US', fr: 'fr-FR', de: 'de-DE', es: 'es-ES',
|
|
32
|
+
it: 'it-IT', pt: 'pt-PT', nl: 'nl-NL', ja: 'ja-JP',
|
|
33
|
+
zh: 'zh-CN', ko: 'ko-KR', ar: 'ar-SA', ru: 'ru-RU',
|
|
34
|
+
pl: 'pl-PL', sv: 'sv-SE', da: 'da-DK', fi: 'fi-FI',
|
|
35
|
+
no: 'nb-NO', tr: 'tr-TR', cs: 'cs-CZ', hu: 'hu-HU',
|
|
36
|
+
};
|
|
37
|
+
return map[lang] ?? lang;
|
|
38
|
+
}
|
|
39
|
+
// -- CSS utilities --
|
|
40
|
+
export function escapeCssAttributeValue(value) {
|
|
41
|
+
return value
|
|
42
|
+
.replace(/\\/g, '\\\\')
|
|
43
|
+
.replace(/"/g, '\\"');
|
|
44
|
+
}
|
|
45
|
+
export function escapeCssIdentifier(value) {
|
|
46
|
+
return value.replace(/(^-?\d)|[^a-zA-Z0-9_-]/g, (match) => `\\${match}`);
|
|
47
|
+
}
|
|
48
|
+
// -- Timeout utility --
|
|
49
|
+
export async function withHelperTimeout(label, timeoutMs, work) {
|
|
50
|
+
if (!timeoutMs || timeoutMs <= 0) {
|
|
51
|
+
return work();
|
|
52
|
+
}
|
|
53
|
+
let timer = null;
|
|
54
|
+
try {
|
|
55
|
+
return await Promise.race([
|
|
56
|
+
work(),
|
|
57
|
+
new Promise((_, reject) => {
|
|
58
|
+
timer = setTimeout(() => reject(new Error(`${label} timed out after ${timeoutMs}ms`)), timeoutMs);
|
|
59
|
+
}),
|
|
60
|
+
]);
|
|
61
|
+
}
|
|
62
|
+
finally {
|
|
63
|
+
if (timer)
|
|
64
|
+
clearTimeout(timer);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
// -- URL formatting --
|
|
68
|
+
export function formatUrlForSummary(rawUrl) {
|
|
69
|
+
try {
|
|
70
|
+
const url = new URL(rawUrl);
|
|
71
|
+
return `${url.pathname || '/'}${url.search}${url.hash}` || rawUrl;
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
return rawUrl;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
// -- Padding resolution --
|
|
78
|
+
export function resolveEffectivePadding(config, bbox) {
|
|
79
|
+
let top = 0, right = 0, bottom = 0, left = 0;
|
|
80
|
+
if (config.paddingPercent != null) {
|
|
81
|
+
top = bottom = (config.paddingPercent / 100) * bbox.height;
|
|
82
|
+
left = right = (config.paddingPercent / 100) * bbox.width;
|
|
83
|
+
}
|
|
84
|
+
if (config.padding != null) {
|
|
85
|
+
top = right = bottom = left = config.padding;
|
|
86
|
+
}
|
|
87
|
+
if (config.paddingTop != null)
|
|
88
|
+
top = config.paddingTop;
|
|
89
|
+
if (config.paddingRight != null)
|
|
90
|
+
right = config.paddingRight;
|
|
91
|
+
if (config.paddingBottom != null)
|
|
92
|
+
bottom = config.paddingBottom;
|
|
93
|
+
if (config.paddingLeft != null)
|
|
94
|
+
left = config.paddingLeft;
|
|
95
|
+
return { top, right, bottom, left };
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=browser-utils.js.map
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type BrowserContext, type Page } from 'playwright';
|
|
2
|
-
import type { BrowserOptions, BrowserSessionStorageState, BrowserStorageState, InteractiveElement, ObservedRequest, OutscaleConfig, PageState, PageStateLite, ResolvedMock, SelectorValidationResult, VideoPageSignals } from './types.js';
|
|
2
|
+
import type { AKNode, AKNodeRuntimeIndexEntry, AKTree, BrowserOptions, BrowserSessionStorageState, BrowserStorageState, InteractiveElement, ObservedRequest, OutscaleConfig, PageState, PageStateLite, ResolvedMock, SelectorValidationResult, VideoPageSignals } from './types.js';
|
|
3
3
|
export interface SelectorCaptureError {
|
|
4
4
|
error: 'no_match' | 'ambiguous' | 'invisible' | 'zero_size';
|
|
5
5
|
errorMessage: string;
|
|
@@ -46,6 +46,13 @@ export interface BrowserObservation {
|
|
|
46
46
|
expandedCount: number;
|
|
47
47
|
loadingIndicatorCount: number;
|
|
48
48
|
textSample: string;
|
|
49
|
+
surfaceSignature: string;
|
|
50
|
+
primarySurface: string;
|
|
51
|
+
overlaySurface: string | null;
|
|
52
|
+
navigationSurface: string;
|
|
53
|
+
configurationSurface: string | null;
|
|
54
|
+
hasBlockingOverlay: boolean;
|
|
55
|
+
strongSurfaceSignature: string;
|
|
49
56
|
}
|
|
50
57
|
export interface BrowserReaction {
|
|
51
58
|
before: BrowserObservation;
|
|
@@ -67,6 +74,22 @@ export interface BrowserVideoVerificationBundle extends BrowserVerificationBundl
|
|
|
67
74
|
interactiveElements: InteractiveElement[];
|
|
68
75
|
scrollInfo: PageState['scrollInfo'];
|
|
69
76
|
}
|
|
77
|
+
export interface BrowserSelectorProbe {
|
|
78
|
+
tag: string;
|
|
79
|
+
role: string;
|
|
80
|
+
href: string | null;
|
|
81
|
+
label: string;
|
|
82
|
+
inputType: string | null;
|
|
83
|
+
ariaExpanded?: string | null;
|
|
84
|
+
ariaControls?: string | null;
|
|
85
|
+
ariaHasPopup?: string | null;
|
|
86
|
+
}
|
|
87
|
+
export interface BrowserStorageHintWriteParams {
|
|
88
|
+
storageName: 'localStorage' | 'sessionStorage';
|
|
89
|
+
key: string;
|
|
90
|
+
candidate: string;
|
|
91
|
+
kind: 'locale' | 'theme';
|
|
92
|
+
}
|
|
70
93
|
export declare function describeObservationChange(before: BrowserObservation, after: BrowserObservation): BrowserReaction;
|
|
71
94
|
export declare class Browser {
|
|
72
95
|
private options;
|
|
@@ -74,6 +97,7 @@ export declare class Browser {
|
|
|
74
97
|
private context;
|
|
75
98
|
private page;
|
|
76
99
|
private elementMap;
|
|
100
|
+
private akNodeIndex;
|
|
77
101
|
private poolContext;
|
|
78
102
|
constructor(options: BrowserOptions);
|
|
79
103
|
/**
|
|
@@ -101,6 +125,12 @@ export declare class Browser {
|
|
|
101
125
|
*/
|
|
102
126
|
closeContext(): Promise<void>;
|
|
103
127
|
launch(): Promise<void>;
|
|
128
|
+
/** Wires debug-only lifecycle listeners on the page/context/browser to surface
|
|
129
|
+
* navigations, console errors, page crashes, and unexpected closures.
|
|
130
|
+
* No-op when debug logging is disabled. */
|
|
131
|
+
private attachDebugLifecycleListeners;
|
|
132
|
+
recreateContext(options?: Partial<Pick<BrowserOptions, 'viewport' | 'deviceScaleFactor' | 'lang' | 'colorScheme' | 'storageState'>>): Promise<void>;
|
|
133
|
+
setDeviceScaleFactor(deviceScaleFactor: number): Promise<void>;
|
|
104
134
|
addCookies(cookies: Array<{
|
|
105
135
|
name: string;
|
|
106
136
|
value: string;
|
|
@@ -133,6 +163,19 @@ export declare class Browser {
|
|
|
133
163
|
* Returns clean indented HTML-like text, budget-capped at ~4000 chars.
|
|
134
164
|
*/
|
|
135
165
|
getSimplifiedDOM(): Promise<string>;
|
|
166
|
+
private mapRawNodeType;
|
|
167
|
+
private convertRawNode;
|
|
168
|
+
private shouldCollapseNode;
|
|
169
|
+
private collapseNode;
|
|
170
|
+
private collectFingerprintEntries;
|
|
171
|
+
private assignFingerprints;
|
|
172
|
+
private applyTraitAnnotations;
|
|
173
|
+
private findFirstPattern;
|
|
174
|
+
private flattenNodes;
|
|
175
|
+
private annotateSemanticPatterns;
|
|
176
|
+
private computeOverlays;
|
|
177
|
+
private normalizeRawSnapshot;
|
|
178
|
+
getAKTree(): Promise<AKTree>;
|
|
136
179
|
getPageState(opts?: {
|
|
137
180
|
skipAnnotation?: boolean;
|
|
138
181
|
}): Promise<PageState>;
|
|
@@ -140,6 +183,12 @@ export declare class Browser {
|
|
|
140
183
|
getPageStateLite(): Promise<PageStateLite>;
|
|
141
184
|
exportStorageState(): Promise<BrowserStorageState>;
|
|
142
185
|
exportSessionStorage(): Promise<BrowserSessionStorageState>;
|
|
186
|
+
reloadCurrentPage(options?: {
|
|
187
|
+
waitUntil?: 'load' | 'domcontentloaded' | 'networkidle' | 'commit';
|
|
188
|
+
timeout?: number;
|
|
189
|
+
}): Promise<void>;
|
|
190
|
+
writeStorageHintCandidate(params: BrowserStorageHintWriteParams): Promise<boolean>;
|
|
191
|
+
probeSelector(selector: string): Promise<BrowserSelectorProbe | null>;
|
|
143
192
|
prepareSessionStorage(bundle: BrowserSessionStorageState | undefined, options?: {
|
|
144
193
|
replace?: boolean;
|
|
145
194
|
}): Promise<void>;
|
|
@@ -164,6 +213,7 @@ export declare class Browser {
|
|
|
164
213
|
}): Promise<BrowserReaction>;
|
|
165
214
|
private computeVisibilityState;
|
|
166
215
|
private getVisiblePoint;
|
|
216
|
+
private runClickHitTest;
|
|
167
217
|
private withResolvedLocator;
|
|
168
218
|
private measureElement;
|
|
169
219
|
private ensureElementInView;
|
|
@@ -189,7 +239,12 @@ export declare class Browser {
|
|
|
189
239
|
clickBySelector(selector: string, options?: {
|
|
190
240
|
force?: boolean;
|
|
191
241
|
}): Promise<void>;
|
|
242
|
+
private resolveActivationTarget;
|
|
243
|
+
private activateSelectorTarget;
|
|
192
244
|
clickByCoordinates(x: number, y: number): Promise<void>;
|
|
245
|
+
private buildElementSnapshotFromAKEntry;
|
|
246
|
+
private activateAKNodeEntry;
|
|
247
|
+
private clickAKNodeEntryByBounds;
|
|
193
248
|
typeText(text: string, options?: {
|
|
194
249
|
index?: number;
|
|
195
250
|
selector?: string;
|
|
@@ -203,6 +258,10 @@ export declare class Browser {
|
|
|
203
258
|
optionIndex?: number;
|
|
204
259
|
}): Promise<void>;
|
|
205
260
|
scroll(direction: string, amount?: number, selector?: string): Promise<void>;
|
|
261
|
+
centerNodeInView(centerNodeId: string, options?: {
|
|
262
|
+
containerNodeId?: string;
|
|
263
|
+
offset?: number;
|
|
264
|
+
}): Promise<void>;
|
|
206
265
|
pressKey(key: string): Promise<void>;
|
|
207
266
|
searchText(query: string): Promise<Array<{
|
|
208
267
|
tag: string;
|
|
@@ -241,6 +300,21 @@ export declare class Browser {
|
|
|
241
300
|
width: number;
|
|
242
301
|
height: number;
|
|
243
302
|
}, outscale?: OutscaleConfig | number): Promise<Buffer>;
|
|
303
|
+
resolveAKNode(nodeId: string, options?: {
|
|
304
|
+
reparse?: boolean;
|
|
305
|
+
}): Promise<AKNodeRuntimeIndexEntry | null>;
|
|
306
|
+
tapNode(nodeId: string, options?: {
|
|
307
|
+
force?: boolean;
|
|
308
|
+
}): Promise<void>;
|
|
309
|
+
typeIntoNode(nodeId: string, text: string, options?: {
|
|
310
|
+
clearFirst?: boolean;
|
|
311
|
+
}): Promise<void>;
|
|
312
|
+
captureNode(nodeId?: string): Promise<Buffer>;
|
|
313
|
+
focusTree(query: import('./types.js').FocusQuery): Promise<{
|
|
314
|
+
tree: AKTree;
|
|
315
|
+
serialized: string;
|
|
316
|
+
matches: AKNode[];
|
|
317
|
+
}>;
|
|
244
318
|
wait(ms: number): Promise<void>;
|
|
245
319
|
/**
|
|
246
320
|
* Force-load all lazy-loaded images on the page before element capture.
|
|
@@ -275,5 +349,6 @@ export declare class Browser {
|
|
|
275
349
|
clearRouteInterception(): Promise<void>;
|
|
276
350
|
private ensurePage;
|
|
277
351
|
private ensureContext;
|
|
352
|
+
private buildContextOptions;
|
|
278
353
|
}
|
|
279
354
|
export {};
|