tabwright 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/bin.js +4 -0
- package/dist/a11y-client.js +204 -0
- package/dist/agent-skills/tabwright/SKILL.md +119 -0
- package/dist/aria-snapshot.d.ts +262 -0
- package/dist/aria-snapshot.d.ts.map +1 -0
- package/dist/aria-snapshot.js +1256 -0
- package/dist/aria-snapshot.js.map +1 -0
- package/dist/aria-snapshot.test.d.ts +2 -0
- package/dist/aria-snapshot.test.d.ts.map +1 -0
- package/dist/aria-snapshot.test.js +270 -0
- package/dist/aria-snapshot.test.js.map +1 -0
- package/dist/aria-snapshot.unit.test.d.ts +2 -0
- package/dist/aria-snapshot.unit.test.d.ts.map +1 -0
- package/dist/aria-snapshot.unit.test.js +542 -0
- package/dist/aria-snapshot.unit.test.js.map +1 -0
- package/dist/assets/cursors/screen-studio/pointer-macos-tahoe-data-url.d.ts +5 -0
- package/dist/assets/cursors/screen-studio/pointer-macos-tahoe-data-url.d.ts.map +1 -0
- package/dist/assets/cursors/screen-studio/pointer-macos-tahoe-data-url.js +5 -0
- package/dist/assets/cursors/screen-studio/pointer-macos-tahoe-data-url.js.map +1 -0
- package/dist/bippy.js +894 -0
- package/dist/browser-config.d.ts +13 -0
- package/dist/browser-config.d.ts.map +1 -0
- package/dist/browser-config.js +126 -0
- package/dist/browser-config.js.map +1 -0
- package/dist/browser-install.d.ts +16 -0
- package/dist/browser-install.d.ts.map +1 -0
- package/dist/browser-install.js +238 -0
- package/dist/browser-install.js.map +1 -0
- package/dist/browser-launch.d.ts +17 -0
- package/dist/browser-launch.d.ts.map +1 -0
- package/dist/browser-launch.js +44 -0
- package/dist/browser-launch.js.map +1 -0
- package/dist/builtin-capabilities.d.ts +28 -0
- package/dist/builtin-capabilities.d.ts.map +1 -0
- package/dist/builtin-capabilities.js +2673 -0
- package/dist/builtin-capabilities.js.map +1 -0
- package/dist/capability-agent-skill.d.ts +60 -0
- package/dist/capability-agent-skill.d.ts.map +1 -0
- package/dist/capability-agent-skill.js +225 -0
- package/dist/capability-agent-skill.js.map +1 -0
- package/dist/capability-auth-state.d.ts +34 -0
- package/dist/capability-auth-state.d.ts.map +1 -0
- package/dist/capability-auth-state.js +157 -0
- package/dist/capability-auth-state.js.map +1 -0
- package/dist/capability-auth.d.ts +36 -0
- package/dist/capability-auth.d.ts.map +1 -0
- package/dist/capability-auth.js +198 -0
- package/dist/capability-auth.js.map +1 -0
- package/dist/capability-cli-confirmation.test.d.ts +2 -0
- package/dist/capability-cli-confirmation.test.d.ts.map +1 -0
- package/dist/capability-cli-confirmation.test.js +79 -0
- package/dist/capability-cli-confirmation.test.js.map +1 -0
- package/dist/capability-options.d.ts +20 -0
- package/dist/capability-options.d.ts.map +1 -0
- package/dist/capability-options.js +31 -0
- package/dist/capability-options.js.map +1 -0
- package/dist/capability-options.test.d.ts +2 -0
- package/dist/capability-options.test.d.ts.map +1 -0
- package/dist/capability-options.test.js +81 -0
- package/dist/capability-options.test.js.map +1 -0
- package/dist/capability-package.d.ts +27 -0
- package/dist/capability-package.d.ts.map +1 -0
- package/dist/capability-package.js +444 -0
- package/dist/capability-package.js.map +1 -0
- package/dist/capability-package.test.d.ts +2 -0
- package/dist/capability-package.test.d.ts.map +1 -0
- package/dist/capability-package.test.js +179 -0
- package/dist/capability-package.test.js.map +1 -0
- package/dist/capability-registry.d.ts +262 -0
- package/dist/capability-registry.d.ts.map +1 -0
- package/dist/capability-registry.js +931 -0
- package/dist/capability-registry.js.map +1 -0
- package/dist/capability-registry.test.d.ts +2 -0
- package/dist/capability-registry.test.d.ts.map +1 -0
- package/dist/capability-registry.test.js +1683 -0
- package/dist/capability-registry.test.js.map +1 -0
- package/dist/capability-runner.d.ts +99 -0
- package/dist/capability-runner.d.ts.map +1 -0
- package/dist/capability-runner.js +608 -0
- package/dist/capability-runner.js.map +1 -0
- package/dist/capability-search-relevance.test.d.ts +2 -0
- package/dist/capability-search-relevance.test.d.ts.map +1 -0
- package/dist/capability-search-relevance.test.js +67 -0
- package/dist/capability-search-relevance.test.js.map +1 -0
- package/dist/capability-studio.d.ts +11 -0
- package/dist/capability-studio.d.ts.map +1 -0
- package/dist/capability-studio.js +593 -0
- package/dist/capability-studio.js.map +1 -0
- package/dist/capability-studio.test.d.ts +2 -0
- package/dist/capability-studio.test.d.ts.map +1 -0
- package/dist/capability-studio.test.js +41 -0
- package/dist/capability-studio.test.js.map +1 -0
- package/dist/cdp-log.d.ts +19 -0
- package/dist/cdp-log.d.ts.map +1 -0
- package/dist/cdp-log.js +83 -0
- package/dist/cdp-log.js.map +1 -0
- package/dist/cdp-log.test.d.ts +2 -0
- package/dist/cdp-log.test.d.ts.map +1 -0
- package/dist/cdp-log.test.js +109 -0
- package/dist/cdp-log.test.js.map +1 -0
- package/dist/cdp-relay.d.ts +19 -0
- package/dist/cdp-relay.d.ts.map +1 -0
- package/dist/cdp-relay.js +2375 -0
- package/dist/cdp-relay.js.map +1 -0
- package/dist/cdp-session.d.ts +37 -0
- package/dist/cdp-session.d.ts.map +1 -0
- package/dist/cdp-session.js +36 -0
- package/dist/cdp-session.js.map +1 -0
- package/dist/cdp-types.d.ts +65 -0
- package/dist/cdp-types.d.ts.map +1 -0
- package/dist/cdp-types.js +91 -0
- package/dist/cdp-types.js.map +1 -0
- package/dist/channel-owner-inspect.test.d.ts +2 -0
- package/dist/channel-owner-inspect.test.d.ts.map +1 -0
- package/dist/channel-owner-inspect.test.js +75 -0
- package/dist/channel-owner-inspect.test.js.map +1 -0
- package/dist/chrome-discovery.d.ts +65 -0
- package/dist/chrome-discovery.d.ts.map +1 -0
- package/dist/chrome-discovery.js +173 -0
- package/dist/chrome-discovery.js.map +1 -0
- package/dist/chrome-discovery.test.d.ts +2 -0
- package/dist/chrome-discovery.test.d.ts.map +1 -0
- package/dist/chrome-discovery.test.js +41 -0
- package/dist/chrome-discovery.test.js.map +1 -0
- package/dist/clean-html.d.ts +11 -0
- package/dist/clean-html.d.ts.map +1 -0
- package/dist/clean-html.js +106 -0
- package/dist/clean-html.js.map +1 -0
- package/dist/cli-help.test.d.ts +2 -0
- package/dist/cli-help.test.d.ts.map +1 -0
- package/dist/cli-help.test.js +98 -0
- package/dist/cli-help.test.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +2709 -0
- package/dist/cli.js.map +1 -0
- package/dist/cloud-client.d.ts +56 -0
- package/dist/cloud-client.d.ts.map +1 -0
- package/dist/cloud-client.js +127 -0
- package/dist/cloud-client.js.map +1 -0
- package/dist/create-logger.d.ts +9 -0
- package/dist/create-logger.d.ts.map +1 -0
- package/dist/create-logger.js +27 -0
- package/dist/create-logger.js.map +1 -0
- package/dist/debugger-api.md +458 -0
- package/dist/debugger-examples-types.d.ts +24 -0
- package/dist/debugger-examples-types.d.ts.map +1 -0
- package/dist/debugger-examples-types.js +2 -0
- package/dist/debugger-examples-types.js.map +1 -0
- package/dist/debugger-examples.d.ts +6 -0
- package/dist/debugger-examples.d.ts.map +1 -0
- package/dist/debugger-examples.js +53 -0
- package/dist/debugger-examples.js.map +1 -0
- package/dist/debugger.d.ts +381 -0
- package/dist/debugger.d.ts.map +1 -0
- package/dist/debugger.js +630 -0
- package/dist/debugger.js.map +1 -0
- package/dist/diff-utils.d.ts +20 -0
- package/dist/diff-utils.d.ts.map +1 -0
- package/dist/diff-utils.js +50 -0
- package/dist/diff-utils.js.map +1 -0
- package/dist/diff-utils.test.d.ts +2 -0
- package/dist/diff-utils.test.d.ts.map +1 -0
- package/dist/diff-utils.test.js +137 -0
- package/dist/diff-utils.test.js.map +1 -0
- package/dist/doctor.d.ts +44 -0
- package/dist/doctor.d.ts.map +1 -0
- package/dist/doctor.js +246 -0
- package/dist/doctor.js.map +1 -0
- package/dist/doctor.test.d.ts +2 -0
- package/dist/doctor.test.d.ts.map +1 -0
- package/dist/doctor.test.js +208 -0
- package/dist/doctor.test.js.map +1 -0
- package/dist/editor-api.md +374 -0
- package/dist/editor-examples.d.ts +11 -0
- package/dist/editor-examples.d.ts.map +1 -0
- package/dist/editor-examples.js +124 -0
- package/dist/editor-examples.js.map +1 -0
- package/dist/editor.d.ts +203 -0
- package/dist/editor.d.ts.map +1 -0
- package/dist/editor.js +363 -0
- package/dist/editor.js.map +1 -0
- package/dist/env-compat.d.ts +2 -0
- package/dist/env-compat.d.ts.map +1 -0
- package/dist/env-compat.js +27 -0
- package/dist/env-compat.js.map +1 -0
- package/dist/executor.d.ts +229 -0
- package/dist/executor.d.ts.map +1 -0
- package/dist/executor.js +1465 -0
- package/dist/executor.js.map +1 -0
- package/dist/executor.unit.test.d.ts +2 -0
- package/dist/executor.unit.test.d.ts.map +1 -0
- package/dist/executor.unit.test.js +143 -0
- package/dist/executor.unit.test.js.map +1 -0
- package/dist/extension/_locales/en/messages.json +278 -0
- package/dist/extension/_locales/zh_CN/messages.json +256 -0
- package/dist/extension/assets/options-CYH96Lcx.css +1349 -0
- package/dist/extension/background.js +3994 -0
- package/dist/extension/icons/SolarCursorSquareBold.png +0 -0
- package/dist/extension/icons/icon-black-128.png +0 -0
- package/dist/extension/icons/icon-black-16.png +0 -0
- package/dist/extension/icons/icon-black-32.png +0 -0
- package/dist/extension/icons/icon-black-48.png +0 -0
- package/dist/extension/icons/icon-gray-128.png +0 -0
- package/dist/extension/icons/icon-gray-16.png +0 -0
- package/dist/extension/icons/icon-gray-32.png +0 -0
- package/dist/extension/icons/icon-gray-48.png +0 -0
- package/dist/extension/icons/icon-green-128.png +0 -0
- package/dist/extension/icons/icon-green-16.png +0 -0
- package/dist/extension/icons/icon-green-32.png +0 -0
- package/dist/extension/icons/icon-green-48.png +0 -0
- package/dist/extension/icons/tabwright-icon-black.png +0 -0
- package/dist/extension/icons/tabwright-icon-gray-disabled.png +0 -0
- package/dist/extension/icons/tabwright-icon-gray-disabled.svg +1 -0
- package/dist/extension/manifest.json +54 -0
- package/dist/extension/options.js +16145 -0
- package/dist/extension/rrweb-recorder.js +12952 -0
- package/dist/extension/src/options.html +165 -0
- package/dist/extension/src/prism-bash.min.js +1 -0
- package/dist/extension/src/prism.min.js +1 -0
- package/dist/extension/src/welcome.html +396 -0
- package/dist/extension-connection.test.d.ts +2 -0
- package/dist/extension-connection.test.d.ts.map +1 -0
- package/dist/extension-connection.test.js +708 -0
- package/dist/extension-connection.test.js.map +1 -0
- package/dist/extension-icon-warning.test.d.ts +2 -0
- package/dist/extension-icon-warning.test.d.ts.map +1 -0
- package/dist/extension-icon-warning.test.js +33 -0
- package/dist/extension-icon-warning.test.js.map +1 -0
- package/dist/ghost-browser.d.ts +62 -0
- package/dist/ghost-browser.d.ts.map +1 -0
- package/dist/ghost-browser.js +107 -0
- package/dist/ghost-browser.js.map +1 -0
- package/dist/ghost-cursor-client.js +374 -0
- package/dist/ghost-cursor-controller.d.ts +46 -0
- package/dist/ghost-cursor-controller.d.ts.map +1 -0
- package/dist/ghost-cursor-controller.js +98 -0
- package/dist/ghost-cursor-controller.js.map +1 -0
- package/dist/ghost-cursor.d.ts +27 -0
- package/dist/ghost-cursor.d.ts.map +1 -0
- package/dist/ghost-cursor.js +79 -0
- package/dist/ghost-cursor.js.map +1 -0
- package/dist/htmlrewrite.d.ts +8 -0
- package/dist/htmlrewrite.d.ts.map +1 -0
- package/dist/htmlrewrite.js +339 -0
- package/dist/htmlrewrite.js.map +1 -0
- package/dist/htmlrewrite.test.d.ts +2 -0
- package/dist/htmlrewrite.test.d.ts.map +1 -0
- package/dist/htmlrewrite.test.js +7975 -0
- package/dist/htmlrewrite.test.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/kill-port.d.ts +29 -0
- package/dist/kill-port.d.ts.map +1 -0
- package/dist/kill-port.js +190 -0
- package/dist/kill-port.js.map +1 -0
- package/dist/kitty-graphics.d.ts +22 -0
- package/dist/kitty-graphics.d.ts.map +1 -0
- package/dist/kitty-graphics.js +71 -0
- package/dist/kitty-graphics.js.map +1 -0
- package/dist/kitty-graphics.test.d.ts +2 -0
- package/dist/kitty-graphics.test.d.ts.map +1 -0
- package/dist/kitty-graphics.test.js +125 -0
- package/dist/kitty-graphics.test.js.map +1 -0
- package/dist/locator-selector.test.d.ts +2 -0
- package/dist/locator-selector.test.d.ts.map +1 -0
- package/dist/locator-selector.test.js +98 -0
- package/dist/locator-selector.test.js.map +1 -0
- package/dist/mcp-client.d.ts +20 -0
- package/dist/mcp-client.d.ts.map +1 -0
- package/dist/mcp-client.js +56 -0
- package/dist/mcp-client.js.map +1 -0
- package/dist/mcp.d.ts +6 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +511 -0
- package/dist/mcp.js.map +1 -0
- package/dist/on-mouse-action.test.d.ts +2 -0
- package/dist/on-mouse-action.test.d.ts.map +1 -0
- package/dist/on-mouse-action.test.js +180 -0
- package/dist/on-mouse-action.test.js.map +1 -0
- package/dist/options-page.test.d.ts +2 -0
- package/dist/options-page.test.d.ts.map +1 -0
- package/dist/options-page.test.js +773 -0
- package/dist/options-page.test.js.map +1 -0
- package/dist/package-paths.d.ts +4 -0
- package/dist/package-paths.d.ts.map +1 -0
- package/dist/package-paths.js +30 -0
- package/dist/package-paths.js.map +1 -0
- package/dist/page-markdown.d.ts +40 -0
- package/dist/page-markdown.d.ts.map +1 -0
- package/dist/page-markdown.js +181 -0
- package/dist/page-markdown.js.map +1 -0
- package/dist/performance-examples.d.ts +5 -0
- package/dist/performance-examples.d.ts.map +1 -0
- package/dist/performance-examples.js +112 -0
- package/dist/performance-examples.js.map +1 -0
- package/dist/performance-profiling.md +417 -0
- package/dist/playwright-import.d.ts +19 -0
- package/dist/playwright-import.d.ts.map +1 -0
- package/dist/playwright-import.js +40 -0
- package/dist/playwright-import.js.map +1 -0
- package/dist/popup-relocation.test.d.ts +7 -0
- package/dist/popup-relocation.test.d.ts.map +1 -0
- package/dist/popup-relocation.test.js +139 -0
- package/dist/popup-relocation.test.js.map +1 -0
- package/dist/product-paths.d.ts +9 -0
- package/dist/product-paths.d.ts.map +1 -0
- package/dist/product-paths.js +24 -0
- package/dist/product-paths.js.map +1 -0
- package/dist/product-paths.test.d.ts +2 -0
- package/dist/product-paths.test.d.ts.map +1 -0
- package/dist/product-paths.test.js +39 -0
- package/dist/product-paths.test.js.map +1 -0
- package/dist/prompt.md +1004 -0
- package/dist/protocol.d.ts +248 -0
- package/dist/protocol.d.ts.map +1 -0
- package/dist/protocol.js +59 -0
- package/dist/protocol.js.map +1 -0
- package/dist/protocol.test.d.ts +2 -0
- package/dist/protocol.test.d.ts.map +1 -0
- package/dist/protocol.test.js +31 -0
- package/dist/protocol.test.js.map +1 -0
- package/dist/react-source.d.ts +57 -0
- package/dist/react-source.d.ts.map +1 -0
- package/dist/react-source.js +254 -0
- package/dist/react-source.js.map +1 -0
- package/dist/readability.js +1674 -0
- package/dist/relay-client.d.ts +104 -0
- package/dist/relay-client.d.ts.map +1 -0
- package/dist/relay-client.js +426 -0
- package/dist/relay-client.js.map +1 -0
- package/dist/relay-client.test.d.ts +2 -0
- package/dist/relay-client.test.d.ts.map +1 -0
- package/dist/relay-client.test.js +305 -0
- package/dist/relay-client.test.js.map +1 -0
- package/dist/relay-core.test.d.ts +2 -0
- package/dist/relay-core.test.d.ts.map +1 -0
- package/dist/relay-core.test.js +1427 -0
- package/dist/relay-core.test.js.map +1 -0
- package/dist/relay-navigation.test.d.ts +2 -0
- package/dist/relay-navigation.test.d.ts.map +1 -0
- package/dist/relay-navigation.test.js +661 -0
- package/dist/relay-navigation.test.js.map +1 -0
- package/dist/relay-session.test.d.ts +2 -0
- package/dist/relay-session.test.d.ts.map +1 -0
- package/dist/relay-session.test.js +1121 -0
- package/dist/relay-session.test.js.map +1 -0
- package/dist/relay-state.d.ts +178 -0
- package/dist/relay-state.d.ts.map +1 -0
- package/dist/relay-state.js +346 -0
- package/dist/relay-state.js.map +1 -0
- package/dist/relay-state.test.d.ts +2 -0
- package/dist/relay-state.test.d.ts.map +1 -0
- package/dist/relay-state.test.js +594 -0
- package/dist/relay-state.test.js.map +1 -0
- package/dist/replay-ai-index.d.ts +99 -0
- package/dist/replay-ai-index.d.ts.map +1 -0
- package/dist/replay-ai-index.js +677 -0
- package/dist/replay-ai-index.js.map +1 -0
- package/dist/replay-ai-index.test.d.ts +2 -0
- package/dist/replay-ai-index.test.d.ts.map +1 -0
- package/dist/replay-ai-index.test.js +255 -0
- package/dist/replay-ai-index.test.js.map +1 -0
- package/dist/replay-cli.test.d.ts +2 -0
- package/dist/replay-cli.test.d.ts.map +1 -0
- package/dist/replay-cli.test.js +275 -0
- package/dist/replay-cli.test.js.map +1 -0
- package/dist/replay-eval.d.ts +44 -0
- package/dist/replay-eval.d.ts.map +1 -0
- package/dist/replay-eval.js +902 -0
- package/dist/replay-eval.js.map +1 -0
- package/dist/replay-handoff.d.ts +29 -0
- package/dist/replay-handoff.d.ts.map +1 -0
- package/dist/replay-handoff.js +83 -0
- package/dist/replay-handoff.js.map +1 -0
- package/dist/replay-handoff.test.d.ts +2 -0
- package/dist/replay-handoff.test.d.ts.map +1 -0
- package/dist/replay-handoff.test.js +123 -0
- package/dist/replay-handoff.test.js.map +1 -0
- package/dist/replay-workflow-compiler.d.ts +44 -0
- package/dist/replay-workflow-compiler.d.ts.map +1 -0
- package/dist/replay-workflow-compiler.js +601 -0
- package/dist/replay-workflow-compiler.js.map +1 -0
- package/dist/replay-workflow-compiler.test.d.ts +2 -0
- package/dist/replay-workflow-compiler.test.d.ts.map +1 -0
- package/dist/replay-workflow-compiler.test.js +223 -0
- package/dist/replay-workflow-compiler.test.js.map +1 -0
- package/dist/rrweb-recording-relay.d.ts +56 -0
- package/dist/rrweb-recording-relay.d.ts.map +1 -0
- package/dist/rrweb-recording-relay.js +299 -0
- package/dist/rrweb-recording-relay.js.map +1 -0
- package/dist/rrweb-recording-relay.test.d.ts +2 -0
- package/dist/rrweb-recording-relay.test.d.ts.map +1 -0
- package/dist/rrweb-recording-relay.test.js +85 -0
- package/dist/rrweb-recording-relay.test.js.map +1 -0
- package/dist/rrweb-recording.d.ts +104 -0
- package/dist/rrweb-recording.d.ts.map +1 -0
- package/dist/rrweb-recording.js +180 -0
- package/dist/rrweb-recording.js.map +1 -0
- package/dist/scoped-fs.d.ts +95 -0
- package/dist/scoped-fs.d.ts.map +1 -0
- package/dist/scoped-fs.js +358 -0
- package/dist/scoped-fs.js.map +1 -0
- package/dist/scoped-fs.test.d.ts +5 -0
- package/dist/scoped-fs.test.d.ts.map +1 -0
- package/dist/scoped-fs.test.js +73 -0
- package/dist/scoped-fs.test.js.map +1 -0
- package/dist/selector-generator.js +7378 -0
- package/dist/skill-stub.test.d.ts +2 -0
- package/dist/skill-stub.test.d.ts.map +1 -0
- package/dist/skill-stub.test.js +22 -0
- package/dist/skill-stub.test.js.map +1 -0
- package/dist/snapshot-tools.test.d.ts +2 -0
- package/dist/snapshot-tools.test.d.ts.map +1 -0
- package/dist/snapshot-tools.test.js +856 -0
- package/dist/snapshot-tools.test.js.map +1 -0
- package/dist/start-relay-server.d.ts +6 -0
- package/dist/start-relay-server.d.ts.map +1 -0
- package/dist/start-relay-server.js +57 -0
- package/dist/start-relay-server.js.map +1 -0
- package/dist/styles-api.md +124 -0
- package/dist/styles-examples.d.ts +8 -0
- package/dist/styles-examples.d.ts.map +1 -0
- package/dist/styles-examples.js +64 -0
- package/dist/styles-examples.js.map +1 -0
- package/dist/styles.d.ts +27 -0
- package/dist/styles.d.ts.map +1 -0
- package/dist/styles.js +231 -0
- package/dist/styles.js.map +1 -0
- package/dist/tabwright-agent-skill.d.ts +30 -0
- package/dist/tabwright-agent-skill.d.ts.map +1 -0
- package/dist/tabwright-agent-skill.js +74 -0
- package/dist/tabwright-agent-skill.js.map +1 -0
- package/dist/tabwright-agent-skill.test.d.ts +2 -0
- package/dist/tabwright-agent-skill.test.d.ts.map +1 -0
- package/dist/tabwright-agent-skill.test.js +51 -0
- package/dist/tabwright-agent-skill.test.js.map +1 -0
- package/dist/test-declarations.d.ts +13 -0
- package/dist/test-declarations.d.ts.map +1 -0
- package/dist/test-declarations.js +2 -0
- package/dist/test-declarations.js.map +1 -0
- package/dist/test-utils.d.ts +69 -0
- package/dist/test-utils.d.ts.map +1 -0
- package/dist/test-utils.js +448 -0
- package/dist/test-utils.js.map +1 -0
- package/dist/test-utils.test.d.ts +2 -0
- package/dist/test-utils.test.d.ts.map +1 -0
- package/dist/test-utils.test.js +55 -0
- package/dist/test-utils.test.js.map +1 -0
- package/dist/utils.d.ts +26 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +60 -0
- package/dist/utils.js.map +1 -0
- package/dist/wait-for-page-load.d.ts +16 -0
- package/dist/wait-for-page-load.d.ts.map +1 -0
- package/dist/wait-for-page-load.js +146 -0
- package/dist/wait-for-page-load.js.map +1 -0
- package/dist/workflow-capability.d.ts +72 -0
- package/dist/workflow-capability.d.ts.map +1 -0
- package/dist/workflow-capability.js +316 -0
- package/dist/workflow-capability.js.map +1 -0
- package/dist/workflow-script-flow.test.d.ts +2 -0
- package/dist/workflow-script-flow.test.d.ts.map +1 -0
- package/dist/workflow-script-flow.test.js +285 -0
- package/dist/workflow-script-flow.test.js.map +1 -0
- package/package.json +80 -0
- package/src/__snapshots__/x.com.processed.html +1003 -0
- package/src/__snapshots__/x.com.processed.withStyles.html +2720 -0
- package/src/a11y-client.ts +241 -0
- package/src/agent-skills/conan-config/SKILL.md +141 -0
- package/src/agent-skills/conan-config/agents/openai.yaml +4 -0
- package/src/aria-snapshot.test.ts +311 -0
- package/src/aria-snapshot.ts +1681 -0
- package/src/aria-snapshot.unit.test.ts +615 -0
- package/src/aria-snapshots/github-interactive.txt +193 -0
- package/src/aria-snapshots/github-raw.txt +309 -0
- package/src/aria-snapshots/hackernews-interactive.txt +477 -0
- package/src/aria-snapshots/hackernews-raw.txt +428 -0
- package/src/aria-snapshots/prosemirror-interactive.txt +66 -0
- package/src/aria-snapshots/prosemirror-raw.txt +145 -0
- package/src/assets/aria-labels-hacker-news.png +0 -0
- package/src/assets/aria-labels-old-reddit.png +0 -0
- package/src/assets/cursors/screen-studio/pointer-macos-tahoe-data-url.ts +5 -0
- package/src/assets/cursors/screen-studio/pointer-macos-tahoe.svg +18 -0
- package/src/assets/x.com.html +32946 -0
- package/src/browser-config.ts +179 -0
- package/src/browser-install.ts +284 -0
- package/src/browser-launch.ts +75 -0
- package/src/builtin-capabilities.ts +2765 -0
- package/src/capability-agent-skill.ts +305 -0
- package/src/capability-auth-state.ts +197 -0
- package/src/capability-auth.ts +249 -0
- package/src/capability-cli-confirmation.test.ts +90 -0
- package/src/capability-options.test.ts +89 -0
- package/src/capability-options.ts +57 -0
- package/src/capability-package.test.ts +204 -0
- package/src/capability-package.ts +555 -0
- package/src/capability-registry.test.ts +1905 -0
- package/src/capability-registry.ts +1234 -0
- package/src/capability-runner.ts +801 -0
- package/src/capability-search-relevance.test.ts +73 -0
- package/src/capability-studio.test.ts +45 -0
- package/src/capability-studio.ts +641 -0
- package/src/cdp-log.test.ts +131 -0
- package/src/cdp-log.ts +112 -0
- package/src/cdp-relay.ts +2944 -0
- package/src/cdp-session.ts +77 -0
- package/src/cdp-types.ts +158 -0
- package/src/channel-owner-inspect.test.ts +94 -0
- package/src/chrome-discovery.test.ts +50 -0
- package/src/chrome-discovery.ts +220 -0
- package/src/clean-html.ts +141 -0
- package/src/cli-help.test.ts +123 -0
- package/src/cli.ts +3181 -0
- package/src/cloud-client.ts +179 -0
- package/src/create-logger.ts +38 -0
- package/src/debugger-examples-types.ts +16 -0
- package/src/debugger-examples.ts +66 -0
- package/src/debugger.ts +708 -0
- package/src/diff-utils.test.ts +152 -0
- package/src/diff-utils.ts +70 -0
- package/src/doctor.test.ts +244 -0
- package/src/doctor.ts +321 -0
- package/src/editor-examples.ts +158 -0
- package/src/editor.ts +426 -0
- package/src/env-compat.ts +28 -0
- package/src/executor.ts +1824 -0
- package/src/executor.unit.test.ts +168 -0
- package/src/extension-connection.test.ts +855 -0
- package/src/extension-icon-warning.test.ts +45 -0
- package/src/ghost-browser.ts +149 -0
- package/src/ghost-cursor-client.ts +494 -0
- package/src/ghost-cursor-controller.ts +129 -0
- package/src/ghost-cursor.ts +123 -0
- package/src/htmlrewrite.test.ts +8008 -0
- package/src/htmlrewrite.ts +390 -0
- package/src/index.ts +53 -0
- package/src/kill-port.ts +219 -0
- package/src/kitty-graphics.test.ts +139 -0
- package/src/kitty-graphics.ts +79 -0
- package/src/locator-selector.test.ts +119 -0
- package/src/mcp-client.ts +78 -0
- package/src/mcp.ts +629 -0
- package/src/on-mouse-action.test.ts +226 -0
- package/src/options-page.test.ts +839 -0
- package/src/package-paths.ts +38 -0
- package/src/page-markdown.ts +240 -0
- package/src/performance-examples.ts +186 -0
- package/src/playwright-import.ts +59 -0
- package/src/popup-relocation.test.ts +163 -0
- package/src/product-paths.test.ts +47 -0
- package/src/product-paths.ts +28 -0
- package/src/protocol.test.ts +52 -0
- package/src/protocol.ts +351 -0
- package/src/react-source.ts +379 -0
- package/src/relay-client.test.ts +375 -0
- package/src/relay-client.ts +572 -0
- package/src/relay-core.test.ts +1603 -0
- package/src/relay-navigation.test.ts +790 -0
- package/src/relay-session.test.ts +1375 -0
- package/src/relay-state.test.ts +729 -0
- package/src/relay-state.ts +561 -0
- package/src/replay-ai-index.test.ts +278 -0
- package/src/replay-ai-index.ts +872 -0
- package/src/replay-cli.test.ts +325 -0
- package/src/replay-eval.ts +1039 -0
- package/src/replay-handoff.test.ts +163 -0
- package/src/replay-handoff.ts +109 -0
- package/src/replay-workflow-compiler.test.ts +250 -0
- package/src/replay-workflow-compiler.ts +700 -0
- package/src/resource.md +409 -0
- package/src/rrweb-recording-relay.test.ts +99 -0
- package/src/rrweb-recording-relay.ts +400 -0
- package/src/rrweb-recording.ts +322 -0
- package/src/scoped-fs.test.ts +80 -0
- package/src/scoped-fs.ts +420 -0
- package/src/skill-stub.test.ts +24 -0
- package/src/skill.md +1413 -0
- package/src/snapshot-tools.test.ts +1017 -0
- package/src/snapshots/hacker-news-accessibility-full.md +81 -0
- package/src/snapshots/hacker-news-accessibility-interactive.md +43 -0
- package/src/snapshots/page-markdown-output.txt +16 -0
- package/src/snapshots/shadcn-ui-accessibility-full.md +201 -0
- package/src/snapshots/shadcn-ui-accessibility-interactive.md +109 -0
- package/src/start-relay-server.ts +69 -0
- package/src/styles-examples.ts +84 -0
- package/src/styles.ts +343 -0
- package/src/tabwright-agent-skill.test.ts +61 -0
- package/src/tabwright-agent-skill.ts +105 -0
- package/src/test-declarations.ts +13 -0
- package/src/test-utils.test.ts +70 -0
- package/src/test-utils.ts +566 -0
- package/src/utils.ts +78 -0
- package/src/wait-for-page-load.ts +198 -0
- package/src/workflow-capability.ts +417 -0
- package/src/workflow-script-flow.test.ts +388 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest'
|
|
2
|
+
import {
|
|
3
|
+
getRelayReviewIssue,
|
|
4
|
+
RELAY_RECOVERY_COMMAND,
|
|
5
|
+
RelayConnectionProblemError,
|
|
6
|
+
relayIssueText,
|
|
7
|
+
relayReviewIssueText,
|
|
8
|
+
} from 'mcp-extension/src/relay-warning.js'
|
|
9
|
+
|
|
10
|
+
describe('extension relay warning copy', () => {
|
|
11
|
+
it('tells users how to recover when the relay is outdated', () => {
|
|
12
|
+
const text = relayIssueText({ issue: 'outdated' })
|
|
13
|
+
|
|
14
|
+
expect(text).toContain('Tabwright local service is outdated')
|
|
15
|
+
expect(text).toContain('Restart or update the Tabwright CLI')
|
|
16
|
+
expect(text).toContain(RELAY_RECOVERY_COMMAND)
|
|
17
|
+
expect(text).toContain('npm install -g tabwright@latest')
|
|
18
|
+
expect(text).toContain('tabwright session list')
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
it('distinguishes offline and unhealthy relay states', () => {
|
|
22
|
+
expect(relayIssueText({ issue: 'offline' })).toContain('is not running')
|
|
23
|
+
expect(relayIssueText({ issue: 'unavailable' })).toContain('is not responding correctly')
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
it('keeps the issue type on the thrown error', () => {
|
|
27
|
+
const cause = new Error('connect failed')
|
|
28
|
+
const error = new RelayConnectionProblemError({ issue: 'offline', cause })
|
|
29
|
+
|
|
30
|
+
expect(error.issue).toBe('offline')
|
|
31
|
+
expect(error.message).toContain('Tabwright local service is not running')
|
|
32
|
+
expect(error.cause).toBe(cause)
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
it('keeps browser control available while review endpoints are degraded', () => {
|
|
36
|
+
expect(getRelayReviewIssue({ statuses: [404, 404] })).toBe('outdated')
|
|
37
|
+
expect(getRelayReviewIssue({ statuses: [200, 503] })).toBe('unavailable')
|
|
38
|
+
expect(getRelayReviewIssue({ statuses: [200, 204] })).toBeUndefined()
|
|
39
|
+
|
|
40
|
+
const text = relayReviewIssueText({ issue: 'outdated' })
|
|
41
|
+
expect(text).toContain('Browser control is connected')
|
|
42
|
+
expect(text).toContain('Your files were not deleted')
|
|
43
|
+
expect(text).toContain(RELAY_RECOVERY_COMMAND)
|
|
44
|
+
})
|
|
45
|
+
})
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ghost Browser API integration for Tabwright
|
|
3
|
+
*
|
|
4
|
+
* Shared code for both executor (Node.js) and extension (Chrome) environments.
|
|
5
|
+
* See extension/src/ghost-browser-api.d.ts for full API documentation.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// =============================================================================
|
|
9
|
+
// Constants - same values as in Ghost Browser
|
|
10
|
+
// =============================================================================
|
|
11
|
+
|
|
12
|
+
export const GHOST_PUBLIC_API_CONSTANTS = {
|
|
13
|
+
NEW_TEMPORARY_IDENTITY: 'OpenInNewSession',
|
|
14
|
+
DEFAULT_IDENTITY: '',
|
|
15
|
+
MAX_TEMPORARY_IDENTITIES: 25,
|
|
16
|
+
} as const
|
|
17
|
+
|
|
18
|
+
export const GHOST_PROXIES_CONSTANTS = {
|
|
19
|
+
DIRECT_PROXY: '8f513494-8cf5-41c7-b318-936392222104',
|
|
20
|
+
SYSTEM_PROXY: '2485b989-7ffb-4442-a45a-d7f9a10c6171',
|
|
21
|
+
} as const
|
|
22
|
+
|
|
23
|
+
export const GHOST_PROJECTS_CONSTANTS = {
|
|
24
|
+
PROJECT_ID_HOME: 'f0673216-13b9-48be-aa41-90763e229e78',
|
|
25
|
+
PROJECT_ID_UNSAVED: 'fe061488-8a8e-40f0-9e5e-93a1a5e2c273',
|
|
26
|
+
SESSIONS_MAX: 25,
|
|
27
|
+
NEW_SESSION: 'OpenInNewSession',
|
|
28
|
+
GLOBAL_SESSION: '',
|
|
29
|
+
} as const
|
|
30
|
+
|
|
31
|
+
// =============================================================================
|
|
32
|
+
// Types
|
|
33
|
+
// =============================================================================
|
|
34
|
+
|
|
35
|
+
export type GhostBrowserNamespace = 'ghostPublicAPI' | 'ghostProxies' | 'projects'
|
|
36
|
+
|
|
37
|
+
export type GhostBrowserCommandParams = {
|
|
38
|
+
namespace: GhostBrowserNamespace
|
|
39
|
+
method: string
|
|
40
|
+
args: unknown[]
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export type GhostBrowserCommandResult = { success: true; result: unknown } | { success: false; error: string }
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Function signature for sending ghost-browser commands.
|
|
47
|
+
* In executor: sends via CDP session
|
|
48
|
+
* In extension: calls chrome.* APIs directly
|
|
49
|
+
*/
|
|
50
|
+
export type SendGhostBrowserCommand = (
|
|
51
|
+
namespace: GhostBrowserNamespace,
|
|
52
|
+
method: string,
|
|
53
|
+
args: unknown[],
|
|
54
|
+
) => Promise<unknown>
|
|
55
|
+
|
|
56
|
+
// =============================================================================
|
|
57
|
+
// Executor: Chrome object factory
|
|
58
|
+
// =============================================================================
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Creates a proxy object for a Ghost Browser API namespace.
|
|
62
|
+
* Constants are returned directly, methods are forwarded via sendCommand.
|
|
63
|
+
*/
|
|
64
|
+
function createGhostBrowserProxy(
|
|
65
|
+
namespace: GhostBrowserNamespace,
|
|
66
|
+
constants: Record<string, unknown>,
|
|
67
|
+
sendCommand: SendGhostBrowserCommand,
|
|
68
|
+
) {
|
|
69
|
+
return new Proxy(constants, {
|
|
70
|
+
get(target, prop: string) {
|
|
71
|
+
// Return constants directly (no await needed)
|
|
72
|
+
if (prop in target) {
|
|
73
|
+
return target[prop]
|
|
74
|
+
}
|
|
75
|
+
// Return function that sends ghost-browser command
|
|
76
|
+
return (...args: unknown[]) => sendCommand(namespace, prop, args)
|
|
77
|
+
},
|
|
78
|
+
})
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Creates the chrome object with Ghost Browser API namespaces for the executor sandbox.
|
|
83
|
+
* Mirrors the exact shape of chrome.ghostPublicAPI, chrome.ghostProxies, chrome.projects.
|
|
84
|
+
*
|
|
85
|
+
* @param sendCommand - Function to send commands to the extension
|
|
86
|
+
*/
|
|
87
|
+
export function createGhostBrowserChrome(sendCommand: SendGhostBrowserCommand) {
|
|
88
|
+
return {
|
|
89
|
+
ghostPublicAPI: createGhostBrowserProxy('ghostPublicAPI', GHOST_PUBLIC_API_CONSTANTS, sendCommand),
|
|
90
|
+
ghostProxies: createGhostBrowserProxy('ghostProxies', GHOST_PROXIES_CONSTANTS, sendCommand),
|
|
91
|
+
projects: createGhostBrowserProxy('projects', GHOST_PROJECTS_CONSTANTS, sendCommand),
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// =============================================================================
|
|
96
|
+
// Extension: Command handler
|
|
97
|
+
// =============================================================================
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Handles ghost-browser commands in the extension.
|
|
101
|
+
* Calls the appropriate chrome.* API and returns the result.
|
|
102
|
+
*
|
|
103
|
+
* @param params - Command parameters (namespace, method, args)
|
|
104
|
+
* @param chromeApi - The chrome object (passed to avoid global dependency)
|
|
105
|
+
* @returns Result object with success/error status
|
|
106
|
+
*/
|
|
107
|
+
export async function handleGhostBrowserCommand(
|
|
108
|
+
params: GhostBrowserCommandParams,
|
|
109
|
+
chromeApi: typeof chrome,
|
|
110
|
+
): Promise<GhostBrowserCommandResult> {
|
|
111
|
+
const { namespace, method, args } = params
|
|
112
|
+
|
|
113
|
+
try {
|
|
114
|
+
const api = (chromeApi as any)[namespace]
|
|
115
|
+
if (!api) {
|
|
116
|
+
return {
|
|
117
|
+
success: false,
|
|
118
|
+
error: `chrome.${namespace} not available (not running in Ghost Browser?)`,
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const fn = api[method]
|
|
123
|
+
if (typeof fn !== 'function') {
|
|
124
|
+
// Check if it's a constant/property
|
|
125
|
+
if (method in api) {
|
|
126
|
+
return { success: true, result: api[method] }
|
|
127
|
+
}
|
|
128
|
+
return {
|
|
129
|
+
success: false,
|
|
130
|
+
error: `chrome.${namespace}.${method} is not a function or property`,
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Ghost Browser APIs use callback pattern, wrap in Promise
|
|
135
|
+
const result = await new Promise((resolve, reject) => {
|
|
136
|
+
fn.call(api, ...args, (result: unknown) => {
|
|
137
|
+
if (chromeApi.runtime.lastError) {
|
|
138
|
+
reject(new Error(chromeApi.runtime.lastError.message))
|
|
139
|
+
} else {
|
|
140
|
+
resolve(result)
|
|
141
|
+
}
|
|
142
|
+
})
|
|
143
|
+
})
|
|
144
|
+
|
|
145
|
+
return { success: true, result }
|
|
146
|
+
} catch (error: any) {
|
|
147
|
+
return { success: false, error: error.message }
|
|
148
|
+
}
|
|
149
|
+
}
|
|
@@ -0,0 +1,494 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser-side ghost cursor renderer, injected into every Tabwright-attached tab.
|
|
3
|
+
* Auto-enables on load (top frame only). Idles out after 5s of no activity.
|
|
4
|
+
*
|
|
5
|
+
* Two-element DOM structure so move and press have independent CSS transitions:
|
|
6
|
+
* outer (#__playwriter_ghost_cursor__) → translate3d, move easing/duration
|
|
7
|
+
* inner (first child) → scale + opacity, press easing/duration
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { SCREENSTUDIO_POINTER_MACOS_TAHOE_DATA_URL } from './assets/cursors/screen-studio/pointer-macos-tahoe-data-url.js'
|
|
11
|
+
|
|
12
|
+
// Top-frame only — skip iframes. try/catch for sandboxed iframes that throw.
|
|
13
|
+
const isTopFrame = (() => {
|
|
14
|
+
try {
|
|
15
|
+
return window === window.top
|
|
16
|
+
} catch {
|
|
17
|
+
return false
|
|
18
|
+
}
|
|
19
|
+
})()
|
|
20
|
+
|
|
21
|
+
type GhostCursorActionType = 'move' | 'down' | 'up' | 'wheel'
|
|
22
|
+
type GhostCursorButton = 'left' | 'right' | 'middle' | 'none'
|
|
23
|
+
type GhostCursorStyle = 'minimal' | 'dot' | 'screenstudio'
|
|
24
|
+
|
|
25
|
+
interface GhostCursorAction {
|
|
26
|
+
type: GhostCursorActionType
|
|
27
|
+
x: number
|
|
28
|
+
y: number
|
|
29
|
+
button: GhostCursorButton
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface GhostCursorClientOptions {
|
|
33
|
+
style?: GhostCursorStyle
|
|
34
|
+
color?: string
|
|
35
|
+
size?: number
|
|
36
|
+
zIndex?: number
|
|
37
|
+
easing?: string
|
|
38
|
+
minDurationMs?: number
|
|
39
|
+
maxDurationMs?: number
|
|
40
|
+
speedPxPerMs?: number
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
interface GhostCursorRuntimeOptions {
|
|
44
|
+
style: GhostCursorStyle
|
|
45
|
+
color: string
|
|
46
|
+
size: number
|
|
47
|
+
zIndex: number
|
|
48
|
+
easing: string
|
|
49
|
+
minDurationMs: number
|
|
50
|
+
maxDurationMs: number
|
|
51
|
+
speedPxPerMs: number
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
interface GhostCursorRuntimeState {
|
|
55
|
+
outerElement: HTMLDivElement | null
|
|
56
|
+
innerElement: HTMLDivElement | null
|
|
57
|
+
options: GhostCursorRuntimeOptions
|
|
58
|
+
x: number
|
|
59
|
+
y: number
|
|
60
|
+
scale: number
|
|
61
|
+
hasPosition: boolean
|
|
62
|
+
enabled: boolean
|
|
63
|
+
idleHidden: boolean
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
interface GhostCursorApi {
|
|
67
|
+
enable: (options?: GhostCursorClientOptions) => void
|
|
68
|
+
disable: () => void
|
|
69
|
+
applyMouseAction: (action: GhostCursorAction) => void
|
|
70
|
+
isEnabled: () => boolean
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
declare global {
|
|
74
|
+
var __playwriterGhostCursor: GhostCursorApi | undefined
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const CURSOR_ID = '__playwriter_ghost_cursor__'
|
|
78
|
+
const SCREENSTUDIO_POINTER_ASPECT_RATIO = 618 / 958
|
|
79
|
+
const SCREENSTUDIO_HOTSPOT_X_RATIO = 0.14
|
|
80
|
+
const SCREENSTUDIO_HOTSPOT_Y_RATIO = 0.06
|
|
81
|
+
const MINIMAL_TRIANGLE_HOTSPOT_X_RATIO = 0.07
|
|
82
|
+
const MINIMAL_TRIANGLE_HOTSPOT_Y_RATIO = 0.06
|
|
83
|
+
|
|
84
|
+
// Animation curves from Emil Kowalski's guidelines (https://animations.dev):
|
|
85
|
+
// moves use ease-in-out (accel/decel), presses use strong ease-out (100-160ms).
|
|
86
|
+
const MOVE_EASING = 'cubic-bezier(0.65, 0, 0.35, 1)' // easeInOutCubic
|
|
87
|
+
const PRESS_EASING = 'cubic-bezier(0.23, 1, 0.32, 1)' // strong ease-out
|
|
88
|
+
const PRESS_DURATION_MS = 140
|
|
89
|
+
|
|
90
|
+
// Cursor fades out after 5s of no activity, wakes on next action.
|
|
91
|
+
const IDLE_HIDE_DELAY_MS = 5000
|
|
92
|
+
const IDLE_FADE_OUT_MS = 600
|
|
93
|
+
|
|
94
|
+
const DEFAULT_OPTIONS: GhostCursorRuntimeOptions = {
|
|
95
|
+
style: 'minimal',
|
|
96
|
+
color: '#111827',
|
|
97
|
+
size: 22,
|
|
98
|
+
zIndex: 2147483647,
|
|
99
|
+
easing: MOVE_EASING,
|
|
100
|
+
// Slow enough to track with the eye. Override per-call via ghostCursor.show().
|
|
101
|
+
minDurationMs: 220,
|
|
102
|
+
maxDurationMs: 1500,
|
|
103
|
+
speedPxPerMs: 1.2,
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const runtime: GhostCursorRuntimeState = {
|
|
107
|
+
outerElement: null,
|
|
108
|
+
innerElement: null,
|
|
109
|
+
options: DEFAULT_OPTIONS,
|
|
110
|
+
x: 0,
|
|
111
|
+
y: 0,
|
|
112
|
+
scale: 1,
|
|
113
|
+
hasPosition: false,
|
|
114
|
+
enabled: false,
|
|
115
|
+
idleHidden: false,
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
let idleHideTimer: ReturnType<typeof setTimeout> | null = null
|
|
119
|
+
|
|
120
|
+
function clamp(options: { value: number; min: number; max: number }): number {
|
|
121
|
+
const { value, min, max } = options
|
|
122
|
+
return Math.min(max, Math.max(min, value))
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function mergeOptions(options?: GhostCursorClientOptions): GhostCursorRuntimeOptions {
|
|
126
|
+
if (!options) {
|
|
127
|
+
return DEFAULT_OPTIONS
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return {
|
|
131
|
+
style: options.style ?? DEFAULT_OPTIONS.style,
|
|
132
|
+
color: options.color ?? DEFAULT_OPTIONS.color,
|
|
133
|
+
size: options.size ?? DEFAULT_OPTIONS.size,
|
|
134
|
+
zIndex: options.zIndex ?? DEFAULT_OPTIONS.zIndex,
|
|
135
|
+
easing: options.easing ?? DEFAULT_OPTIONS.easing,
|
|
136
|
+
minDurationMs: options.minDurationMs ?? DEFAULT_OPTIONS.minDurationMs,
|
|
137
|
+
maxDurationMs: options.maxDurationMs ?? DEFAULT_OPTIONS.maxDurationMs,
|
|
138
|
+
speedPxPerMs: options.speedPxPerMs ?? DEFAULT_OPTIONS.speedPxPerMs,
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function getCursorDimensions(): { width: number; height: number } {
|
|
143
|
+
if (runtime.options.style === 'screenstudio') {
|
|
144
|
+
const height = runtime.options.size
|
|
145
|
+
const width = Math.max(10, Math.round(height * SCREENSTUDIO_POINTER_ASPECT_RATIO))
|
|
146
|
+
return { width, height }
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (runtime.options.style === 'minimal') {
|
|
150
|
+
const size = Math.max(12, runtime.options.size)
|
|
151
|
+
return { width: size, height: size }
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
return { width: runtime.options.size, height: runtime.options.size }
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function getHotspotOffsetPx(): { x: number; y: number } {
|
|
158
|
+
const dimensions = getCursorDimensions()
|
|
159
|
+
|
|
160
|
+
if (runtime.options.style === 'screenstudio') {
|
|
161
|
+
return {
|
|
162
|
+
x: Math.round(dimensions.width * SCREENSTUDIO_HOTSPOT_X_RATIO),
|
|
163
|
+
y: Math.round(dimensions.height * SCREENSTUDIO_HOTSPOT_Y_RATIO),
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if (runtime.options.style === 'minimal') {
|
|
168
|
+
return {
|
|
169
|
+
x: Math.round(dimensions.width * MINIMAL_TRIANGLE_HOTSPOT_X_RATIO),
|
|
170
|
+
y: Math.round(dimensions.height * MINIMAL_TRIANGLE_HOTSPOT_Y_RATIO),
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return {
|
|
175
|
+
x: Math.round(dimensions.width / 2),
|
|
176
|
+
y: Math.round(dimensions.height / 2),
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function getBaseOpacity(): string {
|
|
181
|
+
if (runtime.options.style === 'screenstudio') {
|
|
182
|
+
return '0.95'
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if (runtime.options.style === 'minimal') {
|
|
186
|
+
return '1'
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
return '0.72'
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// Outer element: translate only (move timing).
|
|
193
|
+
function applyTranslate(): void {
|
|
194
|
+
if (!runtime.outerElement) {
|
|
195
|
+
return
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
const hotspot = getHotspotOffsetPx()
|
|
199
|
+
runtime.outerElement.style.transform = `translate3d(${runtime.x - hotspot.x}px, ${runtime.y - hotspot.y}px, 0)`
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// Inner element: scale only (press timing).
|
|
203
|
+
function applyScale(): void {
|
|
204
|
+
if (!runtime.innerElement) {
|
|
205
|
+
return
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
runtime.innerElement.style.transform = `scale(${runtime.scale})`
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
function computeDurationMs(options: { targetX: number; targetY: number }): number {
|
|
212
|
+
if (!runtime.hasPosition) {
|
|
213
|
+
return 0
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
const dx = options.targetX - runtime.x
|
|
217
|
+
const dy = options.targetY - runtime.y
|
|
218
|
+
const distance = Math.hypot(dx, dy)
|
|
219
|
+
const rawDurationMs = distance / runtime.options.speedPxPerMs
|
|
220
|
+
|
|
221
|
+
return clamp({
|
|
222
|
+
value: rawDurationMs,
|
|
223
|
+
min: runtime.options.minDurationMs,
|
|
224
|
+
max: runtime.options.maxDurationMs,
|
|
225
|
+
})
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
function createCursorElement(): HTMLDivElement {
|
|
229
|
+
const outer = document.createElement('div')
|
|
230
|
+
outer.id = CURSOR_ID
|
|
231
|
+
outer.setAttribute('aria-hidden', 'true')
|
|
232
|
+
outer.style.position = 'fixed'
|
|
233
|
+
outer.style.left = '0'
|
|
234
|
+
outer.style.top = '0'
|
|
235
|
+
outer.style.pointerEvents = 'none'
|
|
236
|
+
outer.style.zIndex = `${runtime.options.zIndex}`
|
|
237
|
+
outer.style.transitionProperty = 'transform'
|
|
238
|
+
outer.style.transitionTimingFunction = runtime.options.easing
|
|
239
|
+
outer.style.transitionDuration = '0ms'
|
|
240
|
+
outer.style.willChange = 'transform'
|
|
241
|
+
|
|
242
|
+
const inner = document.createElement('div')
|
|
243
|
+
inner.style.transitionProperty = 'transform, opacity'
|
|
244
|
+
inner.style.transitionTimingFunction = PRESS_EASING
|
|
245
|
+
inner.style.transitionDuration = `${PRESS_DURATION_MS}ms`
|
|
246
|
+
inner.style.opacity = getBaseOpacity()
|
|
247
|
+
outer.appendChild(inner)
|
|
248
|
+
|
|
249
|
+
runtime.outerElement = outer
|
|
250
|
+
runtime.innerElement = inner
|
|
251
|
+
applyRuntimeVisualOptions()
|
|
252
|
+
|
|
253
|
+
return outer
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
function ensureCursorElement(): HTMLDivElement {
|
|
257
|
+
const existing = document.getElementById(CURSOR_ID) as HTMLDivElement | null
|
|
258
|
+
if (existing) {
|
|
259
|
+
runtime.outerElement = existing
|
|
260
|
+
runtime.innerElement = (existing.firstElementChild as HTMLDivElement) || null
|
|
261
|
+
return existing
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
const outer = createCursorElement()
|
|
265
|
+
const root = document.documentElement || document.body
|
|
266
|
+
root.appendChild(outer)
|
|
267
|
+
return outer
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
function applyRuntimeVisualOptions(): void {
|
|
271
|
+
if (!runtime.innerElement) {
|
|
272
|
+
return
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
const dimensions = getCursorDimensions()
|
|
276
|
+
runtime.innerElement.style.width = `${dimensions.width}px`
|
|
277
|
+
runtime.innerElement.style.height = `${dimensions.height}px`
|
|
278
|
+
|
|
279
|
+
if (runtime.outerElement) {
|
|
280
|
+
runtime.outerElement.style.zIndex = `${runtime.options.zIndex}`
|
|
281
|
+
runtime.outerElement.style.transitionTimingFunction = runtime.options.easing
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
// Scale around the hotspot so press doesn't shift the arrow tip.
|
|
285
|
+
const hotspot = getHotspotOffsetPx()
|
|
286
|
+
runtime.innerElement.style.transformOrigin = `${hotspot.x}px ${hotspot.y}px`
|
|
287
|
+
|
|
288
|
+
if (runtime.options.style === 'screenstudio') {
|
|
289
|
+
runtime.innerElement.style.borderRadius = '0'
|
|
290
|
+
runtime.innerElement.style.border = 'none'
|
|
291
|
+
runtime.innerElement.style.backgroundColor = 'transparent'
|
|
292
|
+
runtime.innerElement.style.backgroundImage = `url("${SCREENSTUDIO_POINTER_MACOS_TAHOE_DATA_URL}")`
|
|
293
|
+
runtime.innerElement.style.backgroundRepeat = 'no-repeat'
|
|
294
|
+
runtime.innerElement.style.backgroundPosition = 'left top'
|
|
295
|
+
runtime.innerElement.style.backgroundSize = 'contain'
|
|
296
|
+
runtime.innerElement.style.backdropFilter = 'none'
|
|
297
|
+
runtime.innerElement.style.filter = 'none'
|
|
298
|
+
runtime.innerElement.style.boxShadow = 'none'
|
|
299
|
+
runtime.innerElement.style.opacity = getBaseOpacity()
|
|
300
|
+
return
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
if (runtime.options.style === 'minimal') {
|
|
304
|
+
const triangleSvg = `<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="-1 -1 26 26"><path fill="white" stroke="${runtime.options.color}" stroke-width="1.5" stroke-linejoin="round" d="m23.284 19.124l-6.866-6.895a.4.4 0 0 1-.118-.296a.43.43 0 0 1 .163-.282l4.439-3.077a1.48 1.48 0 0 0 .621-1.48a1.48 1.48 0 0 0-1.036-1.198L1.623.302a1.14 1.14 0 0 0-1.11.282A1.13 1.13 0 0 0 .29 1.649L5.928 20.44a1.48 1.48 0 0 0 1.183 1.035a1.48 1.48 0 0 0 1.48-.621l3.078-4.44a.37.37 0 0 1 .31-.118a.43.43 0 0 1 .296.104l6.91 6.91a1.48 1.48 0 0 0 2.087 0l2.086-2.086a1.48 1.48 0 0 0-.074-2.101"/></svg>`
|
|
305
|
+
const triangleDataUrl = `url("data:image/svg+xml,${encodeURIComponent(triangleSvg)}")`
|
|
306
|
+
runtime.innerElement.style.borderRadius = '0'
|
|
307
|
+
runtime.innerElement.style.border = 'none'
|
|
308
|
+
runtime.innerElement.style.backgroundColor = 'transparent'
|
|
309
|
+
runtime.innerElement.style.backgroundImage = triangleDataUrl
|
|
310
|
+
runtime.innerElement.style.backgroundRepeat = 'no-repeat'
|
|
311
|
+
runtime.innerElement.style.backgroundSize = 'contain'
|
|
312
|
+
runtime.innerElement.style.backgroundPosition = 'left top'
|
|
313
|
+
runtime.innerElement.style.backdropFilter = 'none'
|
|
314
|
+
runtime.innerElement.style.boxShadow = 'none'
|
|
315
|
+
runtime.innerElement.style.filter = 'drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4))'
|
|
316
|
+
runtime.innerElement.style.opacity = getBaseOpacity()
|
|
317
|
+
return
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
runtime.innerElement.style.borderRadius = '999px'
|
|
321
|
+
runtime.innerElement.style.border = 'none'
|
|
322
|
+
runtime.innerElement.style.backgroundColor = runtime.options.color
|
|
323
|
+
runtime.innerElement.style.backgroundImage = 'none'
|
|
324
|
+
runtime.innerElement.style.backdropFilter = 'none'
|
|
325
|
+
runtime.innerElement.style.filter = 'none'
|
|
326
|
+
runtime.innerElement.style.boxShadow = '0 2px 10px rgba(0, 0, 0, 0.18), inset 0 0 0 2px rgba(255, 255, 255, 0.55)'
|
|
327
|
+
runtime.innerElement.style.opacity = getBaseOpacity()
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
function clearIdleHideTimer(): void {
|
|
331
|
+
if (idleHideTimer !== null) {
|
|
332
|
+
clearTimeout(idleHideTimer)
|
|
333
|
+
idleHideTimer = null
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
function scheduleIdleHide(): void {
|
|
338
|
+
clearIdleHideTimer()
|
|
339
|
+
idleHideTimer = setTimeout(() => {
|
|
340
|
+
idleHideTimer = null
|
|
341
|
+
if (!runtime.enabled || !runtime.innerElement) {
|
|
342
|
+
return
|
|
343
|
+
}
|
|
344
|
+
runtime.idleHidden = true
|
|
345
|
+
runtime.innerElement.style.transitionDuration = `${IDLE_FADE_OUT_MS}ms`
|
|
346
|
+
runtime.innerElement.style.transitionTimingFunction = PRESS_EASING
|
|
347
|
+
runtime.innerElement.style.opacity = '0'
|
|
348
|
+
}, IDLE_HIDE_DELAY_MS)
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
function wakeFromIdle(options: { x: number; y: number }): void {
|
|
352
|
+
// Teleport so moveCursor sees zero distance.
|
|
353
|
+
runtime.x = options.x
|
|
354
|
+
runtime.y = options.y
|
|
355
|
+
runtime.hasPosition = true
|
|
356
|
+
if (runtime.innerElement) {
|
|
357
|
+
runtime.innerElement.style.transitionDuration = `${PRESS_DURATION_MS}ms`
|
|
358
|
+
runtime.innerElement.style.transitionTimingFunction = PRESS_EASING
|
|
359
|
+
runtime.innerElement.style.opacity = getBaseOpacity()
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
function moveCursor(options: { x: number; y: number }): void {
|
|
364
|
+
if (!runtime.enabled) {
|
|
365
|
+
return
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
ensureCursorElement()
|
|
369
|
+
const durationMs = computeDurationMs({ targetX: options.x, targetY: options.y })
|
|
370
|
+
if (runtime.outerElement) {
|
|
371
|
+
runtime.outerElement.style.transitionDuration = `${Math.round(durationMs)}ms`
|
|
372
|
+
runtime.outerElement.style.transitionTimingFunction = runtime.options.easing
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
runtime.x = options.x
|
|
376
|
+
runtime.y = options.y
|
|
377
|
+
runtime.hasPosition = true
|
|
378
|
+
applyTranslate()
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
function setPressed(options: { pressed: boolean }): void {
|
|
382
|
+
if (!runtime.enabled || !runtime.innerElement) {
|
|
383
|
+
return
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
// Subtle press feedback (0.95). Dot style uses 0.92 — needs a bigger pulse.
|
|
387
|
+
runtime.scale = options.pressed
|
|
388
|
+
? runtime.options.style === 'dot'
|
|
389
|
+
? 0.92
|
|
390
|
+
: 0.95
|
|
391
|
+
: 1
|
|
392
|
+
runtime.innerElement.style.transitionDuration = `${PRESS_DURATION_MS}ms`
|
|
393
|
+
runtime.innerElement.style.transitionTimingFunction = PRESS_EASING
|
|
394
|
+
runtime.innerElement.style.opacity = options.pressed ? '1' : getBaseOpacity()
|
|
395
|
+
applyScale()
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
function enable(options?: GhostCursorClientOptions): void {
|
|
399
|
+
runtime.options = mergeOptions(options)
|
|
400
|
+
runtime.enabled = true
|
|
401
|
+
ensureCursorElement()
|
|
402
|
+
applyRuntimeVisualOptions()
|
|
403
|
+
|
|
404
|
+
if (!runtime.hasPosition) {
|
|
405
|
+
runtime.x = Math.round(window.innerWidth / 2)
|
|
406
|
+
runtime.y = Math.round(window.innerHeight / 2)
|
|
407
|
+
runtime.scale = 1
|
|
408
|
+
runtime.hasPosition = true
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
runtime.idleHidden = false
|
|
412
|
+
if (runtime.innerElement) {
|
|
413
|
+
runtime.innerElement.style.opacity = getBaseOpacity()
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
applyTranslate()
|
|
417
|
+
applyScale()
|
|
418
|
+
scheduleIdleHide()
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
function disable(): void {
|
|
422
|
+
runtime.enabled = false
|
|
423
|
+
runtime.scale = 1
|
|
424
|
+
runtime.hasPosition = false
|
|
425
|
+
runtime.idleHidden = false
|
|
426
|
+
clearIdleHideTimer()
|
|
427
|
+
|
|
428
|
+
if (runtime.outerElement) {
|
|
429
|
+
runtime.outerElement.remove()
|
|
430
|
+
runtime.outerElement = null
|
|
431
|
+
runtime.innerElement = null
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
function applyMouseAction(action: GhostCursorAction): void {
|
|
436
|
+
if (!runtime.enabled) {
|
|
437
|
+
return
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
if (runtime.idleHidden) {
|
|
441
|
+
runtime.idleHidden = false
|
|
442
|
+
wakeFromIdle({ x: action.x, y: action.y })
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
if (action.type === 'move' || action.type === 'wheel') {
|
|
446
|
+
moveCursor({ x: action.x, y: action.y })
|
|
447
|
+
} else if (action.type === 'down') {
|
|
448
|
+
moveCursor({ x: action.x, y: action.y })
|
|
449
|
+
setPressed({ pressed: true })
|
|
450
|
+
} else if (action.type === 'up') {
|
|
451
|
+
moveCursor({ x: action.x, y: action.y })
|
|
452
|
+
setPressed({ pressed: false })
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
scheduleIdleHide()
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
const api: GhostCursorApi = {
|
|
459
|
+
enable,
|
|
460
|
+
disable,
|
|
461
|
+
applyMouseAction,
|
|
462
|
+
isEnabled: () => {
|
|
463
|
+
return runtime.enabled
|
|
464
|
+
},
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
if (isTopFrame) {
|
|
468
|
+
globalThis.__playwriterGhostCursor = api
|
|
469
|
+
|
|
470
|
+
// Auto-enable. Defer for early injection (addScriptToEvaluateOnNewDocument)
|
|
471
|
+
// when DOM isn't ready yet. After hard navigations the cursor re-centers
|
|
472
|
+
// until the next mouse action arrives.
|
|
473
|
+
try {
|
|
474
|
+
if (document.readyState === 'loading') {
|
|
475
|
+
document.addEventListener(
|
|
476
|
+
'DOMContentLoaded',
|
|
477
|
+
() => {
|
|
478
|
+
try {
|
|
479
|
+
api.enable()
|
|
480
|
+
} catch {
|
|
481
|
+
// Non-fatal — DOM may be in an unexpected state.
|
|
482
|
+
}
|
|
483
|
+
},
|
|
484
|
+
{ once: true },
|
|
485
|
+
)
|
|
486
|
+
} else {
|
|
487
|
+
api.enable()
|
|
488
|
+
}
|
|
489
|
+
} catch {
|
|
490
|
+
// Restricted contexts (chrome://, devtools://) — silently skip.
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
export {}
|