chrome-devtools-mcp 0.17.1 → 0.17.2
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/README.md +4 -1
- package/package.json +3 -3
- package/build/src/DevToolsConnectionAdapter.js +0 -69
- package/build/src/DevtoolsUtils.js +0 -340
- package/build/src/McpContext.js +0 -603
- package/build/src/McpResponse.js +0 -490
- package/build/src/Mutex.js +0 -37
- package/build/src/PageCollector.js +0 -309
- package/build/src/WaitForHelper.js +0 -139
- package/build/src/browser.js +0 -182
- package/build/src/cli.js +0 -295
- package/build/src/formatters/ConsoleFormatter.js +0 -240
- package/build/src/formatters/IssueFormatter.js +0 -190
- package/build/src/formatters/NetworkFormatter.js +0 -226
- package/build/src/formatters/SnapshotFormatter.js +0 -134
- package/build/src/index.js +0 -21
- package/build/src/issue-descriptions.js +0 -39
- package/build/src/logger.js +0 -36
- package/build/src/main.js +0 -196
- package/build/src/polyfill.js +0 -7
- package/build/src/telemetry/ClearcutLogger.js +0 -102
- package/build/src/telemetry/WatchdogClient.js +0 -60
- package/build/src/telemetry/flagUtils.js +0 -45
- package/build/src/telemetry/metricUtils.js +0 -14
- package/build/src/telemetry/persistence.js +0 -53
- package/build/src/telemetry/types.js +0 -33
- package/build/src/telemetry/watchdog/ClearcutSender.js +0 -201
- package/build/src/telemetry/watchdog/main.js +0 -127
- package/build/src/third_party/THIRD_PARTY_NOTICES +0 -2011
- package/build/src/third_party/bundled-packages.json +0 -8
- package/build/src/third_party/devtools-formatter-worker.js +0 -15449
- package/build/src/third_party/index.js +0 -172791
- package/build/src/third_party/issue-descriptions/CoepCoopSandboxedIframeCannotNavigateToCoopPage.md +0 -4
- package/build/src/third_party/issue-descriptions/CoepCorpNotSameOrigin.md +0 -8
- package/build/src/third_party/issue-descriptions/CoepCorpNotSameOriginAfterDefaultedToSameOriginByCoep.md +0 -18
- package/build/src/third_party/issue-descriptions/CoepCorpNotSameSite.md +0 -7
- package/build/src/third_party/issue-descriptions/CoepFrameResourceNeedsCoepHeader.md +0 -10
- package/build/src/third_party/issue-descriptions/CompatibilityModeQuirks.md +0 -5
- package/build/src/third_party/issue-descriptions/CookieAttributeValueExceedsMaxSize.md +0 -5
- package/build/src/third_party/issue-descriptions/LowTextContrast.md +0 -5
- package/build/src/third_party/issue-descriptions/SameSiteExcludeContextDowngradeRead.md +0 -8
- package/build/src/third_party/issue-descriptions/SameSiteExcludeContextDowngradeSet.md +0 -8
- package/build/src/third_party/issue-descriptions/SameSiteExcludeNavigationContextDowngrade.md +0 -8
- package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorRead.md +0 -8
- package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorSet.md +0 -8
- package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnRead.md +0 -8
- package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnSet.md +0 -8
- package/build/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeRead.md +0 -9
- package/build/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeSet.md +0 -9
- package/build/src/third_party/issue-descriptions/SameSiteWarnCrossDowngradeRead.md +0 -8
- package/build/src/third_party/issue-descriptions/SameSiteWarnCrossDowngradeSet.md +0 -8
- package/build/src/third_party/issue-descriptions/SameSiteWarnStrictLaxDowngradeStrict.md +0 -8
- package/build/src/third_party/issue-descriptions/arInsecureContext.md +0 -7
- package/build/src/third_party/issue-descriptions/arInvalidInfoHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arInvalidRegisterOsSourceHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arInvalidRegisterOsTriggerHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arInvalidRegisterSourceHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arInvalidRegisterTriggerHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arNavigationRegistrationUniqueScopeAlreadySet.md +0 -5
- package/build/src/third_party/issue-descriptions/arNavigationRegistrationWithoutTransientUserActivation.md +0 -6
- package/build/src/third_party/issue-descriptions/arNoRegisterOsSourceHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arNoRegisterOsTriggerHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arNoRegisterSourceHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arNoRegisterTriggerHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arNoWebOrOsSupport.md +0 -4
- package/build/src/third_party/issue-descriptions/arOsSourceIgnored.md +0 -18
- package/build/src/third_party/issue-descriptions/arOsTriggerIgnored.md +0 -19
- package/build/src/third_party/issue-descriptions/arPermissionPolicyDisabled.md +0 -8
- package/build/src/third_party/issue-descriptions/arSourceAndTriggerHeaders.md +0 -9
- package/build/src/third_party/issue-descriptions/arSourceIgnored.md +0 -13
- package/build/src/third_party/issue-descriptions/arTriggerIgnored.md +0 -12
- package/build/src/third_party/issue-descriptions/arUntrustworthyReportingOrigin.md +0 -10
- package/build/src/third_party/issue-descriptions/arWebAndOsHeaders.md +0 -11
- package/build/src/third_party/issue-descriptions/bounceTrackingMitigations.md +0 -3
- package/build/src/third_party/issue-descriptions/clientHintMetaTagAllowListInvalidOrigin.md +0 -4
- package/build/src/third_party/issue-descriptions/clientHintMetaTagModifiedHTML.md +0 -4
- package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidAllowlistItemType.md +0 -12
- package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidHeader.md +0 -12
- package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidUrlPattern.md +0 -8
- package/build/src/third_party/issue-descriptions/connectionAllowlistItemNotInnerList.md +0 -12
- package/build/src/third_party/issue-descriptions/connectionAllowlistMoreThanOneList.md +0 -7
- package/build/src/third_party/issue-descriptions/connectionAllowlistReportingEndpointNotToken.md +0 -10
- package/build/src/third_party/issue-descriptions/cookieCrossSiteRedirectDowngrade.md +0 -12
- package/build/src/third_party/issue-descriptions/cookieExcludeBlockedWithinRelatedWebsiteSet.md +0 -4
- package/build/src/third_party/issue-descriptions/cookieExcludeDomainNonAscii.md +0 -11
- package/build/src/third_party/issue-descriptions/cookieExcludePortMismatch.md +0 -8
- package/build/src/third_party/issue-descriptions/cookieExcludeSchemeMismatch.md +0 -7
- package/build/src/third_party/issue-descriptions/cookieExcludeThirdPartyPhaseoutRead.md +0 -6
- package/build/src/third_party/issue-descriptions/cookieExcludeThirdPartyPhaseoutSet.md +0 -6
- package/build/src/third_party/issue-descriptions/cookieWarnDomainNonAscii.md +0 -11
- package/build/src/third_party/issue-descriptions/cookieWarnMetadataGrantRead.md +0 -4
- package/build/src/third_party/issue-descriptions/cookieWarnMetadataGrantSet.md +0 -4
- package/build/src/third_party/issue-descriptions/cookieWarnThirdPartyPhaseoutRead.md +0 -6
- package/build/src/third_party/issue-descriptions/cookieWarnThirdPartyPhaseoutSet.md +0 -6
- package/build/src/third_party/issue-descriptions/corsAllowCredentialsRequired.md +0 -6
- package/build/src/third_party/issue-descriptions/corsDisabledScheme.md +0 -7
- package/build/src/third_party/issue-descriptions/corsDisallowedByMode.md +0 -7
- package/build/src/third_party/issue-descriptions/corsHeaderDisallowedByPreflightResponse.md +0 -5
- package/build/src/third_party/issue-descriptions/corsInsecurePrivateNetwork.md +0 -10
- package/build/src/third_party/issue-descriptions/corsInvalidHeaderValues.md +0 -7
- package/build/src/third_party/issue-descriptions/corsLocalNetworkAccessPermissionDenied.md +0 -19
- package/build/src/third_party/issue-descriptions/corsMethodDisallowedByPreflightResponse.md +0 -5
- package/build/src/third_party/issue-descriptions/corsNoCorsRedirectModeNotFollow.md +0 -5
- package/build/src/third_party/issue-descriptions/corsOriginMismatch.md +0 -6
- package/build/src/third_party/issue-descriptions/corsPreflightAllowPrivateNetworkError.md +0 -10
- package/build/src/third_party/issue-descriptions/corsPreflightResponseInvalid.md +0 -5
- package/build/src/third_party/issue-descriptions/corsPrivateNetworkPermissionDenied.md +0 -10
- package/build/src/third_party/issue-descriptions/corsRedirectContainsCredentials.md +0 -5
- package/build/src/third_party/issue-descriptions/corsWildcardOriginNotAllowed.md +0 -8
- package/build/src/third_party/issue-descriptions/cspEvalViolation.md +0 -9
- package/build/src/third_party/issue-descriptions/cspInlineViolation.md +0 -10
- package/build/src/third_party/issue-descriptions/cspTrustedTypesPolicyViolation.md +0 -5
- package/build/src/third_party/issue-descriptions/cspTrustedTypesSinkViolation.md +0 -8
- package/build/src/third_party/issue-descriptions/cspURLViolation.md +0 -10
- package/build/src/third_party/issue-descriptions/deprecation.md +0 -3
- package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsHttpNotFound.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsInvalidResponse.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsNoResponse.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestApprovalDeclined.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestCanceled.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestErrorFetchingSignin.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestErrorIdToken.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenHttpNotFound.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidRequest.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidResponse.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenNoResponse.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestInvalidSigninResponse.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestHttpNotFound.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestInvalidResponse.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestNoResponse.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestTooManyRequests.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidAccountsResponse.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidConfigOrWellKnown.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoAccountSharingPermission.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoApiPermission.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoReturningUserFromFetchedAccounts.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotIframe.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotPotentiallyTrustworthy.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSameOrigin.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSignedInWithIdp.md +0 -1
- package/build/src/third_party/issue-descriptions/fetchingPartitionedBlobURL.md +0 -7
- package/build/src/third_party/issue-descriptions/genericFormAriaLabelledByToNonExistingIdError.md +0 -8
- package/build/src/third_party/issue-descriptions/genericFormAutocompleteAttributeEmptyError.md +0 -5
- package/build/src/third_party/issue-descriptions/genericFormDuplicateIdForInputError.md +0 -5
- package/build/src/third_party/issue-descriptions/genericFormEmptyIdAndNameAttributesForInputError.md +0 -5
- package/build/src/third_party/issue-descriptions/genericFormInputAssignedAutocompleteValueToIdOrNameAttributeError.md +0 -5
- package/build/src/third_party/issue-descriptions/genericFormInputHasWrongButWellIntendedAutocompleteValueError.md +0 -5
- package/build/src/third_party/issue-descriptions/genericFormInputWithNoLabelError.md +0 -5
- package/build/src/third_party/issue-descriptions/genericFormLabelForMatchesNonExistingIdError.md +0 -5
- package/build/src/third_party/issue-descriptions/genericFormLabelForNameError.md +0 -5
- package/build/src/third_party/issue-descriptions/genericFormLabelHasNeitherForNorNestedInputError.md +0 -5
- package/build/src/third_party/issue-descriptions/genericNavigationEntryMarkedSkippable.md +0 -7
- package/build/src/third_party/issue-descriptions/genericResponseWasBlockedByORB.md +0 -4
- package/build/src/third_party/issue-descriptions/heavyAd.md +0 -10
- package/build/src/third_party/issue-descriptions/mixedContent.md +0 -5
- package/build/src/third_party/issue-descriptions/navigatingPartitionedBlobURL.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementActivationDisabled.md +0 -7
- package/build/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluder.md +0 -9
- package/build/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluderParent.md +0 -9
- package/build/src/third_party/issue-descriptions/permissionElementCspFrameAncestorsMissing.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementFencedFrameDisallowed.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementFontSizeTooLarge.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementFontSizeTooSmall.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementGeolocationDeprecated.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementInsetBoxShadowUnsupported.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementInvalidDisplayStyle.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementInvalidSizeValue.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementInvalidType.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementInvalidTypeActivation.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementLowContrast.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementNonOpaqueColor.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementPaddingBottomUnsupported.md +0 -6
- package/build/src/third_party/issue-descriptions/permissionElementPaddingRightUnsupported.md +0 -6
- package/build/src/third_party/issue-descriptions/permissionElementPermissionsPolicyBlocked.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementRegistrationFailed.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementRequestInProgress.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementSecurityChecksFailed.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementTypeNotSupported.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementUntrustedEvent.md +0 -7
- package/build/src/third_party/issue-descriptions/placeholderDescriptionForInvisibleIssues.md +0 -3
- package/build/src/third_party/issue-descriptions/propertyRuleInvalidNameIssue.md +0 -3
- package/build/src/third_party/issue-descriptions/propertyRuleIssue.md +0 -7
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedOptGroupChild.md +0 -7
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedSelectChild.md +0 -7
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentAttributesSelectDescendant.md +0 -3
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentLegendChild.md +0 -3
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentOptionChild.md +0 -3
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityNonPhrasingContentOptionChild.md +0 -3
- package/build/src/third_party/issue-descriptions/sharedArrayBuffer.md +0 -7
- package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorCrossOriginNoCorsRequest.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorDictionaryLoadFailure.md +0 -3
- package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorMatchingDictionaryNotUsed.md +0 -3
- package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorUnexpectedContentDictionaryHeader.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorCossOriginNoCorsRequest.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorDisallowedBySettings.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorExpiredResponse.md +0 -3
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorFeatureDisabled.md +0 -3
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInsufficientResources.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidMatchField.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidStructuredHeader.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidTTLField.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNavigationRequest.md +0 -3
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNoMatchField.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonIntegerTTLField.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonListMatchDestField.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonSecureContext.md +0 -3
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringIdField.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringInMatchDestList.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringMatchField.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonTokenTypeField.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorRequestAborted.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorShuttingDown.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorTooLongIdField.md +0 -3
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorUnsupportedType.md +0 -3
- package/build/src/third_party/issue-descriptions/sriInvalidSignatureHeader.md +0 -14
- package/build/src/third_party/issue-descriptions/sriInvalidSignatureInputHeader.md +0 -15
- package/build/src/third_party/issue-descriptions/sriMissingSignatureHeader.md +0 -8
- package/build/src/third_party/issue-descriptions/sriMissingSignatureInputHeader.md +0 -7
- package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsIncorrectLength.md +0 -11
- package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsNotByteSequence.md +0 -14
- package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsParameterized.md +0 -15
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentName.md +0 -8
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentType.md +0 -13
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidDerivedComponentParameter.md +0 -4
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidHeaderComponentParameter.md +0 -5
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidParameter.md +0 -11
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderKeyIdLength.md +0 -12
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingLabel.md +0 -6
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingRequiredParameters.md +0 -8
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderValueMissingComponents.md +0 -11
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderValueNotInnerList.md +0 -11
- package/build/src/third_party/issue-descriptions/sriValidationFailedIntegrityMismatch.md +0 -10
- package/build/src/third_party/issue-descriptions/sriValidationFailedInvalidLength.md +0 -5
- package/build/src/third_party/issue-descriptions/sriValidationFailedSignatureExpired.md +0 -6
- package/build/src/third_party/issue-descriptions/sriValidationFailedSignatureMismatch.md +0 -11
- package/build/src/third_party/issue-descriptions/stylesheetLateImport.md +0 -4
- package/build/src/third_party/issue-descriptions/stylesheetRequestFailed.md +0 -3
- package/build/src/third_party/issue-descriptions/summaryElementAccessibilityInteractiveContentSummaryDescendant.md +0 -3
- package/build/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestLength.md +0 -12
- package/build/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestType.md +0 -17
- package/build/src/third_party/issue-descriptions/unencodedDigestMalformedDictionary.md +0 -14
- package/build/src/third_party/issue-descriptions/unencodedDigestUnknownAlgorithm.md +0 -15
- package/build/src/tools/ToolDefinition.js +0 -20
- package/build/src/tools/categories.js +0 -24
- package/build/src/tools/console.js +0 -85
- package/build/src/tools/emulation.js +0 -169
- package/build/src/tools/extensions.js +0 -79
- package/build/src/tools/input.js +0 -343
- package/build/src/tools/network.js +0 -120
- package/build/src/tools/pages.js +0 -323
- package/build/src/tools/performance.js +0 -188
- package/build/src/tools/screenshot.js +0 -84
- package/build/src/tools/script.js +0 -71
- package/build/src/tools/snapshot.js +0 -52
- package/build/src/tools/tools.js +0 -31
- package/build/src/trace-processing/parse.js +0 -84
- package/build/src/utils/ExtensionRegistry.js +0 -35
- package/build/src/utils/keyboard.js +0 -296
- package/build/src/utils/pagination.js +0 -49
- package/build/src/utils/string.js +0 -36
- package/build/src/utils/types.js +0 -6
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2025 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import { zod } from '../third_party/index.js';
|
|
7
|
-
import { ToolCategory } from './categories.js';
|
|
8
|
-
import { defineTool } from './ToolDefinition.js';
|
|
9
|
-
export const screenshot = defineTool({
|
|
10
|
-
name: 'take_screenshot',
|
|
11
|
-
description: `Take a screenshot of the page or element.`,
|
|
12
|
-
annotations: {
|
|
13
|
-
category: ToolCategory.DEBUGGING,
|
|
14
|
-
// Not read-only due to filePath param.
|
|
15
|
-
readOnlyHint: false,
|
|
16
|
-
},
|
|
17
|
-
schema: {
|
|
18
|
-
format: zod
|
|
19
|
-
.enum(['png', 'jpeg', 'webp'])
|
|
20
|
-
.default('png')
|
|
21
|
-
.describe('Type of format to save the screenshot as. Default is "png"'),
|
|
22
|
-
quality: zod
|
|
23
|
-
.number()
|
|
24
|
-
.min(0)
|
|
25
|
-
.max(100)
|
|
26
|
-
.optional()
|
|
27
|
-
.describe('Compression quality for JPEG and WebP formats (0-100). Higher values mean better quality but larger file sizes. Ignored for PNG format.'),
|
|
28
|
-
uid: zod
|
|
29
|
-
.string()
|
|
30
|
-
.optional()
|
|
31
|
-
.describe('The uid of an element on the page from the page content snapshot. If omitted takes a pages screenshot.'),
|
|
32
|
-
fullPage: zod
|
|
33
|
-
.boolean()
|
|
34
|
-
.optional()
|
|
35
|
-
.describe('If set to true takes a screenshot of the full page instead of the currently visible viewport. Incompatible with uid.'),
|
|
36
|
-
filePath: zod
|
|
37
|
-
.string()
|
|
38
|
-
.optional()
|
|
39
|
-
.describe('The absolute path, or a path relative to the current working directory, to save the screenshot to instead of attaching it to the response.'),
|
|
40
|
-
},
|
|
41
|
-
handler: async (request, response, context) => {
|
|
42
|
-
if (request.params.uid && request.params.fullPage) {
|
|
43
|
-
throw new Error('Providing both "uid" and "fullPage" is not allowed.');
|
|
44
|
-
}
|
|
45
|
-
let pageOrHandle;
|
|
46
|
-
if (request.params.uid) {
|
|
47
|
-
pageOrHandle = await context.getElementByUid(request.params.uid);
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
pageOrHandle = context.getSelectedPage();
|
|
51
|
-
}
|
|
52
|
-
const format = request.params.format;
|
|
53
|
-
const quality = format === 'png' ? undefined : request.params.quality;
|
|
54
|
-
const screenshot = await pageOrHandle.screenshot({
|
|
55
|
-
type: format,
|
|
56
|
-
fullPage: request.params.fullPage,
|
|
57
|
-
quality,
|
|
58
|
-
optimizeForSpeed: true, // Bonus: optimize encoding for speed
|
|
59
|
-
});
|
|
60
|
-
if (request.params.uid) {
|
|
61
|
-
response.appendResponseLine(`Took a screenshot of node with uid "${request.params.uid}".`);
|
|
62
|
-
}
|
|
63
|
-
else if (request.params.fullPage) {
|
|
64
|
-
response.appendResponseLine('Took a screenshot of the full current page.');
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
response.appendResponseLine("Took a screenshot of the current page's viewport.");
|
|
68
|
-
}
|
|
69
|
-
if (request.params.filePath) {
|
|
70
|
-
const file = await context.saveFile(screenshot, request.params.filePath);
|
|
71
|
-
response.appendResponseLine(`Saved screenshot to ${file.filename}.`);
|
|
72
|
-
}
|
|
73
|
-
else if (screenshot.length >= 2_000_000) {
|
|
74
|
-
const { filename } = await context.saveTemporaryFile(screenshot, `image/${request.params.format}`);
|
|
75
|
-
response.appendResponseLine(`Saved screenshot to ${filename}.`);
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
response.attachImage({
|
|
79
|
-
mimeType: `image/${request.params.format}`,
|
|
80
|
-
data: Buffer.from(screenshot).toString('base64'),
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
});
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2025 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import { zod } from '../third_party/index.js';
|
|
7
|
-
import { ToolCategory } from './categories.js';
|
|
8
|
-
import { defineTool } from './ToolDefinition.js';
|
|
9
|
-
export const evaluateScript = defineTool({
|
|
10
|
-
name: 'evaluate_script',
|
|
11
|
-
description: `Evaluate a JavaScript function inside the currently selected page. Returns the response as JSON,
|
|
12
|
-
so returned values have to be JSON-serializable.`,
|
|
13
|
-
annotations: {
|
|
14
|
-
category: ToolCategory.DEBUGGING,
|
|
15
|
-
readOnlyHint: false,
|
|
16
|
-
},
|
|
17
|
-
schema: {
|
|
18
|
-
function: zod.string().describe(`A JavaScript function declaration to be executed by the tool in the currently selected page.
|
|
19
|
-
Example without arguments: \`() => {
|
|
20
|
-
return document.title
|
|
21
|
-
}\` or \`async () => {
|
|
22
|
-
return await fetch("example.com")
|
|
23
|
-
}\`.
|
|
24
|
-
Example with arguments: \`(el) => {
|
|
25
|
-
return el.innerText;
|
|
26
|
-
}\`
|
|
27
|
-
`),
|
|
28
|
-
args: zod
|
|
29
|
-
.array(zod.object({
|
|
30
|
-
uid: zod
|
|
31
|
-
.string()
|
|
32
|
-
.describe('The uid of an element on the page from the page content snapshot'),
|
|
33
|
-
}))
|
|
34
|
-
.optional()
|
|
35
|
-
.describe(`An optional list of arguments to pass to the function.`),
|
|
36
|
-
},
|
|
37
|
-
handler: async (request, response, context) => {
|
|
38
|
-
const args = [];
|
|
39
|
-
try {
|
|
40
|
-
const frames = new Set();
|
|
41
|
-
for (const el of request.params.args ?? []) {
|
|
42
|
-
const handle = await context.getElementByUid(el.uid);
|
|
43
|
-
frames.add(handle.frame);
|
|
44
|
-
args.push(handle);
|
|
45
|
-
}
|
|
46
|
-
let pageOrFrame;
|
|
47
|
-
// We can't evaluate the element handle across frames
|
|
48
|
-
if (frames.size > 1) {
|
|
49
|
-
throw new Error("Elements from different frames can't be evaluated together.");
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
pageOrFrame = [...frames.values()][0] ?? context.getSelectedPage();
|
|
53
|
-
}
|
|
54
|
-
const fn = await pageOrFrame.evaluateHandle(`(${request.params.function})`);
|
|
55
|
-
args.unshift(fn);
|
|
56
|
-
await context.waitForEventsAfterAction(async () => {
|
|
57
|
-
const result = await pageOrFrame.evaluate(async (fn, ...args) => {
|
|
58
|
-
// @ts-expect-error no types.
|
|
59
|
-
return JSON.stringify(await fn(...args));
|
|
60
|
-
}, ...args);
|
|
61
|
-
response.appendResponseLine('Script ran on page and returned:');
|
|
62
|
-
response.appendResponseLine('```json');
|
|
63
|
-
response.appendResponseLine(`${result}`);
|
|
64
|
-
response.appendResponseLine('```');
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
finally {
|
|
68
|
-
void Promise.allSettled(args.map(arg => arg.dispose()));
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
});
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2025 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import { zod } from '../third_party/index.js';
|
|
7
|
-
import { ToolCategory } from './categories.js';
|
|
8
|
-
import { defineTool, timeoutSchema } from './ToolDefinition.js';
|
|
9
|
-
export const takeSnapshot = defineTool({
|
|
10
|
-
name: 'take_snapshot',
|
|
11
|
-
description: `Take a text snapshot of the currently selected page based on the a11y tree. The snapshot lists page elements along with a unique
|
|
12
|
-
identifier (uid). Always use the latest snapshot. Prefer taking a snapshot over taking a screenshot. The snapshot indicates the element selected
|
|
13
|
-
in the DevTools Elements panel (if any).`,
|
|
14
|
-
annotations: {
|
|
15
|
-
category: ToolCategory.DEBUGGING,
|
|
16
|
-
// Not read-only due to filePath param.
|
|
17
|
-
readOnlyHint: false,
|
|
18
|
-
},
|
|
19
|
-
schema: {
|
|
20
|
-
verbose: zod
|
|
21
|
-
.boolean()
|
|
22
|
-
.optional()
|
|
23
|
-
.describe('Whether to include all possible information available in the full a11y tree. Default is false.'),
|
|
24
|
-
filePath: zod
|
|
25
|
-
.string()
|
|
26
|
-
.optional()
|
|
27
|
-
.describe('The absolute path, or a path relative to the current working directory, to save the snapshot to instead of attaching it to the response.'),
|
|
28
|
-
},
|
|
29
|
-
handler: async (request, response) => {
|
|
30
|
-
response.includeSnapshot({
|
|
31
|
-
verbose: request.params.verbose ?? false,
|
|
32
|
-
filePath: request.params.filePath,
|
|
33
|
-
});
|
|
34
|
-
},
|
|
35
|
-
});
|
|
36
|
-
export const waitFor = defineTool({
|
|
37
|
-
name: 'wait_for',
|
|
38
|
-
description: `Wait for the specified text to appear on the selected page.`,
|
|
39
|
-
annotations: {
|
|
40
|
-
category: ToolCategory.NAVIGATION,
|
|
41
|
-
readOnlyHint: true,
|
|
42
|
-
},
|
|
43
|
-
schema: {
|
|
44
|
-
text: zod.string().describe('Text to appear on the page'),
|
|
45
|
-
...timeoutSchema,
|
|
46
|
-
},
|
|
47
|
-
handler: async (request, response, context) => {
|
|
48
|
-
await context.waitForTextOnPage(request.params.text, request.params.timeout);
|
|
49
|
-
response.appendResponseLine(`Element with text "${request.params.text}" found.`);
|
|
50
|
-
response.includeSnapshot();
|
|
51
|
-
},
|
|
52
|
-
});
|
package/build/src/tools/tools.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2025 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import * as consoleTools from './console.js';
|
|
7
|
-
import * as emulationTools from './emulation.js';
|
|
8
|
-
import * as extensionTools from './extensions.js';
|
|
9
|
-
import * as inputTools from './input.js';
|
|
10
|
-
import * as networkTools from './network.js';
|
|
11
|
-
import * as pagesTools from './pages.js';
|
|
12
|
-
import * as performanceTools from './performance.js';
|
|
13
|
-
import * as screenshotTools from './screenshot.js';
|
|
14
|
-
import * as scriptTools from './script.js';
|
|
15
|
-
import * as snapshotTools from './snapshot.js';
|
|
16
|
-
const tools = [
|
|
17
|
-
...Object.values(consoleTools),
|
|
18
|
-
...Object.values(emulationTools),
|
|
19
|
-
...Object.values(extensionTools),
|
|
20
|
-
...Object.values(inputTools),
|
|
21
|
-
...Object.values(networkTools),
|
|
22
|
-
...Object.values(pagesTools),
|
|
23
|
-
...Object.values(performanceTools),
|
|
24
|
-
...Object.values(screenshotTools),
|
|
25
|
-
...Object.values(scriptTools),
|
|
26
|
-
...Object.values(snapshotTools),
|
|
27
|
-
];
|
|
28
|
-
tools.sort((a, b) => {
|
|
29
|
-
return a.name.localeCompare(b.name);
|
|
30
|
-
});
|
|
31
|
-
export { tools };
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2025 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import { logger } from '../logger.js';
|
|
7
|
-
import { DevTools } from '../third_party/index.js';
|
|
8
|
-
const engine = DevTools.TraceEngine.TraceModel.Model.createWithAllHandlers();
|
|
9
|
-
export function traceResultIsSuccess(x) {
|
|
10
|
-
return 'parsedTrace' in x;
|
|
11
|
-
}
|
|
12
|
-
export async function parseRawTraceBuffer(buffer) {
|
|
13
|
-
engine.resetProcessor();
|
|
14
|
-
if (!buffer) {
|
|
15
|
-
return {
|
|
16
|
-
error: 'No buffer was provided.',
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
const asString = new TextDecoder().decode(buffer);
|
|
20
|
-
if (!asString) {
|
|
21
|
-
return {
|
|
22
|
-
error: 'Decoding the trace buffer returned an empty string.',
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
try {
|
|
26
|
-
const data = JSON.parse(asString);
|
|
27
|
-
const events = Array.isArray(data) ? data : data.traceEvents;
|
|
28
|
-
await engine.parse(events);
|
|
29
|
-
const parsedTrace = engine.parsedTrace();
|
|
30
|
-
if (!parsedTrace) {
|
|
31
|
-
return {
|
|
32
|
-
error: 'No parsed trace was returned from the trace engine.',
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
const insights = parsedTrace?.insights ?? null;
|
|
36
|
-
return {
|
|
37
|
-
parsedTrace,
|
|
38
|
-
insights,
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
catch (e) {
|
|
42
|
-
const errorText = e instanceof Error ? e.message : JSON.stringify(e);
|
|
43
|
-
logger(`Unexpected error parsing trace: ${errorText}`);
|
|
44
|
-
return {
|
|
45
|
-
error: errorText,
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
const extraFormatDescriptions = `Information on performance traces may contain main thread activity represented as call frames and network requests.
|
|
50
|
-
|
|
51
|
-
${DevTools.PerformanceTraceFormatter.callFrameDataFormatDescription}
|
|
52
|
-
|
|
53
|
-
${DevTools.PerformanceTraceFormatter.networkDataFormatDescription}`;
|
|
54
|
-
export function getTraceSummary(result) {
|
|
55
|
-
const focus = DevTools.AgentFocus.fromParsedTrace(result.parsedTrace);
|
|
56
|
-
const formatter = new DevTools.PerformanceTraceFormatter(focus);
|
|
57
|
-
const summaryText = formatter.formatTraceSummary();
|
|
58
|
-
return `## Summary of Performance trace findings:
|
|
59
|
-
${summaryText}
|
|
60
|
-
|
|
61
|
-
## Details on call tree & network request formats:
|
|
62
|
-
${extraFormatDescriptions}`;
|
|
63
|
-
}
|
|
64
|
-
export function getInsightOutput(result, insightSetId, insightName) {
|
|
65
|
-
if (!result.insights) {
|
|
66
|
-
return {
|
|
67
|
-
error: 'No Performance insights are available for this trace.',
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
const insightSet = result.insights.get(insightSetId);
|
|
71
|
-
if (!insightSet) {
|
|
72
|
-
return {
|
|
73
|
-
error: 'No Performance Insights for the given insight set id. Only use ids given in the "Available insight sets" list.',
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
const matchingInsight = insightName in insightSet.model ? insightSet.model[insightName] : null;
|
|
77
|
-
if (!matchingInsight) {
|
|
78
|
-
return {
|
|
79
|
-
error: `No Insight with the name ${insightName} found. Double check the name you provided is accurate and try again.`,
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
const formatter = new DevTools.PerformanceInsightFormatter(DevTools.AgentFocus.fromParsedTrace(result.parsedTrace), matchingInsight);
|
|
83
|
-
return { output: formatter.formatInsight() };
|
|
84
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2026 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import fs from 'node:fs/promises';
|
|
7
|
-
import path from 'node:path';
|
|
8
|
-
export class ExtensionRegistry {
|
|
9
|
-
#extensions = new Map();
|
|
10
|
-
async registerExtension(id, extensionPath) {
|
|
11
|
-
const manifestPath = path.join(extensionPath, 'manifest.json');
|
|
12
|
-
const manifestContent = await fs.readFile(manifestPath, 'utf-8');
|
|
13
|
-
const manifest = JSON.parse(manifestContent);
|
|
14
|
-
const name = manifest.name ?? 'Unknown';
|
|
15
|
-
const version = manifest.version ?? 'Unknown';
|
|
16
|
-
const extension = {
|
|
17
|
-
id,
|
|
18
|
-
name,
|
|
19
|
-
version,
|
|
20
|
-
isEnabled: true,
|
|
21
|
-
path: extensionPath,
|
|
22
|
-
};
|
|
23
|
-
this.#extensions.set(extension.id, extension);
|
|
24
|
-
return extension;
|
|
25
|
-
}
|
|
26
|
-
remove(id) {
|
|
27
|
-
this.#extensions.delete(id);
|
|
28
|
-
}
|
|
29
|
-
list() {
|
|
30
|
-
return Array.from(this.#extensions.values());
|
|
31
|
-
}
|
|
32
|
-
getById(id) {
|
|
33
|
-
return this.#extensions.get(id);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1,296 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2025 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
// See the KeyInput type for the list of supported keys.
|
|
7
|
-
const validKeys = new Set([
|
|
8
|
-
'0',
|
|
9
|
-
'1',
|
|
10
|
-
'2',
|
|
11
|
-
'3',
|
|
12
|
-
'4',
|
|
13
|
-
'5',
|
|
14
|
-
'6',
|
|
15
|
-
'7',
|
|
16
|
-
'8',
|
|
17
|
-
'9',
|
|
18
|
-
'Power',
|
|
19
|
-
'Eject',
|
|
20
|
-
'Abort',
|
|
21
|
-
'Help',
|
|
22
|
-
'Backspace',
|
|
23
|
-
'Tab',
|
|
24
|
-
'Numpad5',
|
|
25
|
-
'NumpadEnter',
|
|
26
|
-
'Enter',
|
|
27
|
-
'\r',
|
|
28
|
-
'\n',
|
|
29
|
-
'ShiftLeft',
|
|
30
|
-
'ShiftRight',
|
|
31
|
-
'ControlLeft',
|
|
32
|
-
'ControlRight',
|
|
33
|
-
'AltLeft',
|
|
34
|
-
'AltRight',
|
|
35
|
-
'Pause',
|
|
36
|
-
'CapsLock',
|
|
37
|
-
'Escape',
|
|
38
|
-
'Convert',
|
|
39
|
-
'NonConvert',
|
|
40
|
-
'Space',
|
|
41
|
-
'Numpad9',
|
|
42
|
-
'PageUp',
|
|
43
|
-
'Numpad3',
|
|
44
|
-
'PageDown',
|
|
45
|
-
'End',
|
|
46
|
-
'Numpad1',
|
|
47
|
-
'Home',
|
|
48
|
-
'Numpad7',
|
|
49
|
-
'ArrowLeft',
|
|
50
|
-
'Numpad4',
|
|
51
|
-
'Numpad8',
|
|
52
|
-
'ArrowUp',
|
|
53
|
-
'ArrowRight',
|
|
54
|
-
'Numpad6',
|
|
55
|
-
'Numpad2',
|
|
56
|
-
'ArrowDown',
|
|
57
|
-
'Select',
|
|
58
|
-
'Open',
|
|
59
|
-
'PrintScreen',
|
|
60
|
-
'Insert',
|
|
61
|
-
'Numpad0',
|
|
62
|
-
'Delete',
|
|
63
|
-
'NumpadDecimal',
|
|
64
|
-
'Digit0',
|
|
65
|
-
'Digit1',
|
|
66
|
-
'Digit2',
|
|
67
|
-
'Digit3',
|
|
68
|
-
'Digit4',
|
|
69
|
-
'Digit5',
|
|
70
|
-
'Digit6',
|
|
71
|
-
'Digit7',
|
|
72
|
-
'Digit8',
|
|
73
|
-
'Digit9',
|
|
74
|
-
'KeyA',
|
|
75
|
-
'KeyB',
|
|
76
|
-
'KeyC',
|
|
77
|
-
'KeyD',
|
|
78
|
-
'KeyE',
|
|
79
|
-
'KeyF',
|
|
80
|
-
'KeyG',
|
|
81
|
-
'KeyH',
|
|
82
|
-
'KeyI',
|
|
83
|
-
'KeyJ',
|
|
84
|
-
'KeyK',
|
|
85
|
-
'KeyL',
|
|
86
|
-
'KeyM',
|
|
87
|
-
'KeyN',
|
|
88
|
-
'KeyO',
|
|
89
|
-
'KeyP',
|
|
90
|
-
'KeyQ',
|
|
91
|
-
'KeyR',
|
|
92
|
-
'KeyS',
|
|
93
|
-
'KeyT',
|
|
94
|
-
'KeyU',
|
|
95
|
-
'KeyV',
|
|
96
|
-
'KeyW',
|
|
97
|
-
'KeyX',
|
|
98
|
-
'KeyY',
|
|
99
|
-
'KeyZ',
|
|
100
|
-
'MetaLeft',
|
|
101
|
-
'MetaRight',
|
|
102
|
-
'ContextMenu',
|
|
103
|
-
'NumpadMultiply',
|
|
104
|
-
'NumpadAdd',
|
|
105
|
-
'NumpadSubtract',
|
|
106
|
-
'NumpadDivide',
|
|
107
|
-
'F1',
|
|
108
|
-
'F2',
|
|
109
|
-
'F3',
|
|
110
|
-
'F4',
|
|
111
|
-
'F5',
|
|
112
|
-
'F6',
|
|
113
|
-
'F7',
|
|
114
|
-
'F8',
|
|
115
|
-
'F9',
|
|
116
|
-
'F10',
|
|
117
|
-
'F11',
|
|
118
|
-
'F12',
|
|
119
|
-
'F13',
|
|
120
|
-
'F14',
|
|
121
|
-
'F15',
|
|
122
|
-
'F16',
|
|
123
|
-
'F17',
|
|
124
|
-
'F18',
|
|
125
|
-
'F19',
|
|
126
|
-
'F20',
|
|
127
|
-
'F21',
|
|
128
|
-
'F22',
|
|
129
|
-
'F23',
|
|
130
|
-
'F24',
|
|
131
|
-
'NumLock',
|
|
132
|
-
'ScrollLock',
|
|
133
|
-
'AudioVolumeMute',
|
|
134
|
-
'AudioVolumeDown',
|
|
135
|
-
'AudioVolumeUp',
|
|
136
|
-
'MediaTrackNext',
|
|
137
|
-
'MediaTrackPrevious',
|
|
138
|
-
'MediaStop',
|
|
139
|
-
'MediaPlayPause',
|
|
140
|
-
'Semicolon',
|
|
141
|
-
'Equal',
|
|
142
|
-
'NumpadEqual',
|
|
143
|
-
'Comma',
|
|
144
|
-
'Minus',
|
|
145
|
-
'Period',
|
|
146
|
-
'Slash',
|
|
147
|
-
'Backquote',
|
|
148
|
-
'BracketLeft',
|
|
149
|
-
'Backslash',
|
|
150
|
-
'BracketRight',
|
|
151
|
-
'Quote',
|
|
152
|
-
'AltGraph',
|
|
153
|
-
'Props',
|
|
154
|
-
'Cancel',
|
|
155
|
-
'Clear',
|
|
156
|
-
'Shift',
|
|
157
|
-
'Control',
|
|
158
|
-
'Alt',
|
|
159
|
-
'Accept',
|
|
160
|
-
'ModeChange',
|
|
161
|
-
' ',
|
|
162
|
-
'Print',
|
|
163
|
-
'Execute',
|
|
164
|
-
'\u0000',
|
|
165
|
-
'a',
|
|
166
|
-
'b',
|
|
167
|
-
'c',
|
|
168
|
-
'd',
|
|
169
|
-
'e',
|
|
170
|
-
'f',
|
|
171
|
-
'g',
|
|
172
|
-
'h',
|
|
173
|
-
'i',
|
|
174
|
-
'j',
|
|
175
|
-
'k',
|
|
176
|
-
'l',
|
|
177
|
-
'm',
|
|
178
|
-
'n',
|
|
179
|
-
'o',
|
|
180
|
-
'p',
|
|
181
|
-
'q',
|
|
182
|
-
'r',
|
|
183
|
-
's',
|
|
184
|
-
't',
|
|
185
|
-
'u',
|
|
186
|
-
'v',
|
|
187
|
-
'w',
|
|
188
|
-
'x',
|
|
189
|
-
'y',
|
|
190
|
-
'z',
|
|
191
|
-
'Meta',
|
|
192
|
-
'*',
|
|
193
|
-
'+',
|
|
194
|
-
'-',
|
|
195
|
-
'/',
|
|
196
|
-
';',
|
|
197
|
-
'=',
|
|
198
|
-
',',
|
|
199
|
-
'.',
|
|
200
|
-
'`',
|
|
201
|
-
'[',
|
|
202
|
-
'\\',
|
|
203
|
-
']',
|
|
204
|
-
"'",
|
|
205
|
-
'Attn',
|
|
206
|
-
'CrSel',
|
|
207
|
-
'ExSel',
|
|
208
|
-
'EraseEof',
|
|
209
|
-
'Play',
|
|
210
|
-
'ZoomOut',
|
|
211
|
-
')',
|
|
212
|
-
'!',
|
|
213
|
-
'@',
|
|
214
|
-
'#',
|
|
215
|
-
'$',
|
|
216
|
-
'%',
|
|
217
|
-
'^',
|
|
218
|
-
'&',
|
|
219
|
-
'(',
|
|
220
|
-
'A',
|
|
221
|
-
'B',
|
|
222
|
-
'C',
|
|
223
|
-
'D',
|
|
224
|
-
'E',
|
|
225
|
-
'F',
|
|
226
|
-
'G',
|
|
227
|
-
'H',
|
|
228
|
-
'I',
|
|
229
|
-
'J',
|
|
230
|
-
'K',
|
|
231
|
-
'L',
|
|
232
|
-
'M',
|
|
233
|
-
'N',
|
|
234
|
-
'O',
|
|
235
|
-
'P',
|
|
236
|
-
'Q',
|
|
237
|
-
'R',
|
|
238
|
-
'S',
|
|
239
|
-
'T',
|
|
240
|
-
'U',
|
|
241
|
-
'V',
|
|
242
|
-
'W',
|
|
243
|
-
'X',
|
|
244
|
-
'Y',
|
|
245
|
-
'Z',
|
|
246
|
-
':',
|
|
247
|
-
'<',
|
|
248
|
-
'_',
|
|
249
|
-
'>',
|
|
250
|
-
'?',
|
|
251
|
-
'~',
|
|
252
|
-
'{',
|
|
253
|
-
'|',
|
|
254
|
-
'}',
|
|
255
|
-
'"',
|
|
256
|
-
'SoftLeft',
|
|
257
|
-
'SoftRight',
|
|
258
|
-
'Camera',
|
|
259
|
-
'Call',
|
|
260
|
-
'EndCall',
|
|
261
|
-
'VolumeDown',
|
|
262
|
-
'VolumeUp',
|
|
263
|
-
]);
|
|
264
|
-
function throwIfInvalidKey(key) {
|
|
265
|
-
if (validKeys.has(key)) {
|
|
266
|
-
return key;
|
|
267
|
-
}
|
|
268
|
-
throw new Error(`${key} is invalid. Valid keys are: ${Array.from(validKeys.values()).join(',')}.`);
|
|
269
|
-
}
|
|
270
|
-
/**
|
|
271
|
-
* Returns the primary key, followed by modifiers in original order.
|
|
272
|
-
*/
|
|
273
|
-
export function parseKey(keyInput) {
|
|
274
|
-
let key = '';
|
|
275
|
-
const result = [];
|
|
276
|
-
for (const ch of keyInput) {
|
|
277
|
-
// Handle cases like Shift++.
|
|
278
|
-
if (ch === '+' && key) {
|
|
279
|
-
result.push(throwIfInvalidKey(key));
|
|
280
|
-
key = '';
|
|
281
|
-
}
|
|
282
|
-
else {
|
|
283
|
-
key += ch;
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
if (key) {
|
|
287
|
-
result.push(throwIfInvalidKey(key));
|
|
288
|
-
}
|
|
289
|
-
if (result.length === 0) {
|
|
290
|
-
throw new Error(`Key ${keyInput} could not be parsed.`);
|
|
291
|
-
}
|
|
292
|
-
if (new Set(result).size !== result.length) {
|
|
293
|
-
throw new Error(`Key ${keyInput} contains duplicate keys.`);
|
|
294
|
-
}
|
|
295
|
-
return [result.at(-1), ...result.slice(0, -1)];
|
|
296
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2025 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
const DEFAULT_PAGE_SIZE = 20;
|
|
7
|
-
export function paginate(items, options) {
|
|
8
|
-
const total = items.length;
|
|
9
|
-
if (!options || noPaginationOptions(options)) {
|
|
10
|
-
return {
|
|
11
|
-
items,
|
|
12
|
-
currentPage: 0,
|
|
13
|
-
totalPages: 1,
|
|
14
|
-
hasNextPage: false,
|
|
15
|
-
hasPreviousPage: false,
|
|
16
|
-
startIndex: 0,
|
|
17
|
-
endIndex: total,
|
|
18
|
-
invalidPage: false,
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
const pageSize = options.pageSize ?? DEFAULT_PAGE_SIZE;
|
|
22
|
-
const totalPages = Math.max(1, Math.ceil(total / pageSize));
|
|
23
|
-
const { currentPage, invalidPage } = resolvePageIndex(options.pageIdx, totalPages);
|
|
24
|
-
const startIndex = currentPage * pageSize;
|
|
25
|
-
const pageItems = items.slice(startIndex, startIndex + pageSize);
|
|
26
|
-
const endIndex = startIndex + pageItems.length;
|
|
27
|
-
return {
|
|
28
|
-
items: pageItems,
|
|
29
|
-
currentPage,
|
|
30
|
-
totalPages,
|
|
31
|
-
hasNextPage: currentPage < totalPages - 1,
|
|
32
|
-
hasPreviousPage: currentPage > 0,
|
|
33
|
-
startIndex,
|
|
34
|
-
endIndex,
|
|
35
|
-
invalidPage,
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
function noPaginationOptions(options) {
|
|
39
|
-
return options.pageSize === undefined && options.pageIdx === undefined;
|
|
40
|
-
}
|
|
41
|
-
function resolvePageIndex(pageIdx, totalPages) {
|
|
42
|
-
if (pageIdx === undefined) {
|
|
43
|
-
return { currentPage: 0, invalidPage: false };
|
|
44
|
-
}
|
|
45
|
-
if (pageIdx < 0 || pageIdx >= totalPages) {
|
|
46
|
-
return { currentPage: 0, invalidPage: true };
|
|
47
|
-
}
|
|
48
|
-
return { currentPage: pageIdx, invalidPage: false };
|
|
49
|
-
}
|