devtools-tracing 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/generate.ts +643 -0
- package/index.ts +16 -0
- package/lib/front_end/core/common/App.ts +7 -0
- package/lib/front_end/core/common/AppProvider.ts +32 -0
- package/lib/front_end/core/common/Base64.ts +47 -0
- package/lib/front_end/core/common/CharacterIdMap.ts +30 -0
- package/lib/front_end/core/common/Color.ts +2506 -0
- package/lib/front_end/core/common/ColorConverter.ts +402 -0
- package/lib/front_end/core/common/ColorUtils.ts +252 -0
- package/lib/front_end/core/common/Console.ts +114 -0
- package/lib/front_end/core/common/Debouncer.ts +15 -0
- package/lib/front_end/core/common/EventTarget.ts +52 -0
- package/lib/front_end/core/common/Gzip.ts +74 -0
- package/lib/front_end/core/common/JavaScriptMetaData.ts +29 -0
- package/lib/front_end/core/common/Lazy.ts +31 -0
- package/lib/front_end/core/common/Linkifier.ts +55 -0
- package/lib/front_end/core/common/MapWithDefault.ts +26 -0
- package/lib/front_end/core/common/Mutex.ts +55 -0
- package/lib/front_end/core/common/Object.ts +145 -0
- package/lib/front_end/core/common/ParsedURL.ts +554 -0
- package/lib/front_end/core/common/Progress.ts +180 -0
- package/lib/front_end/core/common/QueryParamHandler.ts +7 -0
- package/lib/front_end/core/common/ResolverBase.ts +85 -0
- package/lib/front_end/core/common/ResourceType.ts +588 -0
- package/lib/front_end/core/common/ReturnToPanel.ts +17 -0
- package/lib/front_end/core/common/Revealer.ts +192 -0
- package/lib/front_end/core/common/Runnable.ts +41 -0
- package/lib/front_end/core/common/SegmentedRange.ts +87 -0
- package/lib/front_end/core/common/SettingRegistration.ts +339 -0
- package/lib/front_end/core/common/Settings.ts +1497 -0
- package/lib/front_end/core/common/SimpleHistoryManager.ts +124 -0
- package/lib/front_end/core/common/StringOutputStream.ts +26 -0
- package/lib/front_end/core/common/TextDictionary.ts +48 -0
- package/lib/front_end/core/common/Throttler.ts +99 -0
- package/lib/front_end/core/common/Trie.ts +152 -0
- package/lib/front_end/core/common/Worker.ts +60 -0
- package/lib/front_end/core/common/common.ts +81 -0
- package/lib/front_end/core/host/AidaClient.ts +733 -0
- package/lib/front_end/core/host/GdpClient.ts +316 -0
- package/lib/front_end/core/host/InspectorFrontendHost.ts +648 -0
- package/lib/front_end/core/host/InspectorFrontendHostAPI.ts +551 -0
- package/lib/front_end/core/host/Platform.ts +76 -0
- package/lib/front_end/core/host/ResourceLoader.ts +282 -0
- package/lib/front_end/core/host/UserMetrics.ts +1230 -0
- package/lib/front_end/core/host/host.ts +23 -0
- package/lib/front_end/core/i18n/ByteUtilities.ts +82 -0
- package/lib/front_end/core/i18n/DevToolsLocale.ts +87 -0
- package/lib/front_end/core/i18n/NumberFormatter.ts +82 -0
- package/lib/front_end/core/i18n/i18n.ts +17 -0
- package/lib/front_end/core/i18n/i18nImpl.ts +204 -0
- package/lib/front_end/core/i18n/i18nTypes.ts +10 -0
- package/lib/front_end/core/i18n/locales.js +14 -0
- package/lib/front_end/core/i18n/time-utilities.ts +174 -0
- package/lib/front_end/core/platform/ArrayUtilities.ts +271 -0
- package/lib/front_end/core/platform/Brand.ts +23 -0
- package/lib/front_end/core/platform/Constructor.ts +10 -0
- package/lib/front_end/core/platform/DOMUtilities.ts +138 -0
- package/lib/front_end/core/platform/DateUtilities.ts +15 -0
- package/lib/front_end/core/platform/DevToolsPath.ts +53 -0
- package/lib/front_end/core/platform/KeyboardUtilities.ts +38 -0
- package/lib/front_end/core/platform/MapUtilities.ts +95 -0
- package/lib/front_end/core/platform/MimeType.ts +175 -0
- package/lib/front_end/core/platform/NumberUtilities.ts +80 -0
- package/lib/front_end/core/platform/StringUtilities.ts +588 -0
- package/lib/front_end/core/platform/Timing.ts +17 -0
- package/lib/front_end/core/platform/TypedArrayUtilities.ts +189 -0
- package/lib/front_end/core/platform/TypescriptUtilities.ts +86 -0
- package/lib/front_end/core/platform/UIString.ts +39 -0
- package/lib/front_end/core/platform/UserVisibleError.ts +28 -0
- package/lib/front_end/core/platform/platform.ts +45 -0
- package/lib/front_end/core/protocol_client/ConnectionTransport.ts +26 -0
- package/lib/front_end/core/protocol_client/InspectorBackend.ts +1050 -0
- package/lib/front_end/core/protocol_client/NodeURL.ts +42 -0
- package/lib/front_end/core/protocol_client/protocol_client.ts +13 -0
- package/lib/front_end/core/root/Runtime.ts +609 -0
- package/lib/front_end/core/root/root.ts +6 -0
- package/lib/front_end/core/sdk/AccessibilityModel.ts +353 -0
- package/lib/front_end/core/sdk/AnimationModel.ts +1041 -0
- package/lib/front_end/core/sdk/AutofillModel.ts +184 -0
- package/lib/front_end/core/sdk/CPUProfilerModel.ts +148 -0
- package/lib/front_end/core/sdk/CPUThrottlingManager.ts +282 -0
- package/lib/front_end/core/sdk/CSSContainerQuery.ts +139 -0
- package/lib/front_end/core/sdk/CSSFontFace.ts +40 -0
- package/lib/front_end/core/sdk/CSSLayer.ts +30 -0
- package/lib/front_end/core/sdk/CSSMatchedStyles.ts +1646 -0
- package/lib/front_end/core/sdk/CSSMedia.ts +121 -0
- package/lib/front_end/core/sdk/CSSMetadata.ts +1647 -0
- package/lib/front_end/core/sdk/CSSModel.ts +1128 -0
- package/lib/front_end/core/sdk/CSSProperty.ts +384 -0
- package/lib/front_end/core/sdk/CSSPropertyParser.ts +681 -0
- package/lib/front_end/core/sdk/CSSPropertyParserMatchers.ts +1395 -0
- package/lib/front_end/core/sdk/CSSQuery.ts +72 -0
- package/lib/front_end/core/sdk/CSSRule.ts +465 -0
- package/lib/front_end/core/sdk/CSSScope.ts +30 -0
- package/lib/front_end/core/sdk/CSSStartingStyle.ts +29 -0
- package/lib/front_end/core/sdk/CSSStyleDeclaration.ts +313 -0
- package/lib/front_end/core/sdk/CSSStyleSheetHeader.ts +196 -0
- package/lib/front_end/core/sdk/CSSSupports.ts +33 -0
- package/lib/front_end/core/sdk/CategorizedBreakpoint.ts +64 -0
- package/lib/front_end/core/sdk/ChildTargetManager.ts +314 -0
- package/lib/front_end/core/sdk/CompilerSourceMappingContentProvider.ts +62 -0
- package/lib/front_end/core/sdk/Connections.ts +293 -0
- package/lib/front_end/core/sdk/ConsoleModel.ts +808 -0
- package/lib/front_end/core/sdk/ConsoleModelTypes.ts +15 -0
- package/lib/front_end/core/sdk/Cookie.ts +319 -0
- package/lib/front_end/core/sdk/CookieModel.ts +239 -0
- package/lib/front_end/core/sdk/CookieParser.ts +185 -0
- package/lib/front_end/core/sdk/DOMDebuggerModel.ts +787 -0
- package/lib/front_end/core/sdk/DOMModel.ts +1961 -0
- package/lib/front_end/core/sdk/DebuggerModel.ts +1605 -0
- package/lib/front_end/core/sdk/EmulationModel.ts +648 -0
- package/lib/front_end/core/sdk/EnhancedTracesParser.ts +515 -0
- package/lib/front_end/core/sdk/EventBreakpointsModel.ts +183 -0
- package/lib/front_end/core/sdk/FrameAssociated.ts +11 -0
- package/lib/front_end/core/sdk/FrameManager.ts +259 -0
- package/lib/front_end/core/sdk/HeapProfilerModel.ts +225 -0
- package/lib/front_end/core/sdk/HttpReasonPhraseStrings.ts +77 -0
- package/lib/front_end/core/sdk/IOModel.ts +91 -0
- package/lib/front_end/core/sdk/IsolateManager.ts +257 -0
- package/lib/front_end/core/sdk/IssuesModel.ts +70 -0
- package/lib/front_end/core/sdk/LayerTreeBase.ts +169 -0
- package/lib/front_end/core/sdk/LogModel.ts +56 -0
- package/lib/front_end/core/sdk/NetworkManager.ts +2823 -0
- package/lib/front_end/core/sdk/NetworkRequest.ts +2253 -0
- package/lib/front_end/core/sdk/OverlayColorGenerator.ts +52 -0
- package/lib/front_end/core/sdk/OverlayModel.ts +1011 -0
- package/lib/front_end/core/sdk/OverlayPersistentHighlighter.ts +522 -0
- package/lib/front_end/core/sdk/PageLoad.ts +35 -0
- package/lib/front_end/core/sdk/PageResourceLoader.ts +435 -0
- package/lib/front_end/core/sdk/PaintProfiler.ts +110 -0
- package/lib/front_end/core/sdk/PerformanceMetricsModel.ts +84 -0
- package/lib/front_end/core/sdk/PreloadingModel.ts +863 -0
- package/lib/front_end/core/sdk/RehydratingConnection.ts +386 -0
- package/lib/front_end/core/sdk/RehydratingObject.ts +66 -0
- package/lib/front_end/core/sdk/RemoteObject.ts +1160 -0
- package/lib/front_end/core/sdk/Resource.ts +232 -0
- package/lib/front_end/core/sdk/ResourceTreeModel.ts +1160 -0
- package/lib/front_end/core/sdk/RuntimeModel.ts +732 -0
- package/lib/front_end/core/sdk/SDKModel.ts +65 -0
- package/lib/front_end/core/sdk/ScopeTreeCache.ts +45 -0
- package/lib/front_end/core/sdk/ScreenCaptureModel.ts +255 -0
- package/lib/front_end/core/sdk/Script.ts +534 -0
- package/lib/front_end/core/sdk/SecurityOriginManager.ts +76 -0
- package/lib/front_end/core/sdk/ServerSentEvents.ts +80 -0
- package/lib/front_end/core/sdk/ServerSentEventsProtocol.ts +122 -0
- package/lib/front_end/core/sdk/ServerTiming.ts +260 -0
- package/lib/front_end/core/sdk/ServiceWorkerCacheModel.ts +377 -0
- package/lib/front_end/core/sdk/ServiceWorkerManager.ts +605 -0
- package/lib/front_end/core/sdk/SourceMap.ts +867 -0
- package/lib/front_end/core/sdk/SourceMapCache.ts +54 -0
- package/lib/front_end/core/sdk/SourceMapFunctionRanges.ts +156 -0
- package/lib/front_end/core/sdk/SourceMapManager.ts +239 -0
- package/lib/front_end/core/sdk/SourceMapScopeChainEntry.ts +189 -0
- package/lib/front_end/core/sdk/SourceMapScopesInfo.ts +508 -0
- package/lib/front_end/core/sdk/StorageBucketsModel.ts +204 -0
- package/lib/front_end/core/sdk/StorageKeyManager.ts +98 -0
- package/lib/front_end/core/sdk/Target.ts +332 -0
- package/lib/front_end/core/sdk/TargetManager.ts +453 -0
- package/lib/front_end/core/sdk/TraceObject.ts +61 -0
- package/lib/front_end/core/sdk/WebAuthnModel.ts +104 -0
- package/lib/front_end/core/sdk/sdk.ts +174 -0
- package/lib/front_end/entrypoints/formatter_worker/FormatterActions.ts +59 -0
- package/lib/front_end/generated/InspectorBackendCommands.js +1617 -0
- package/lib/front_end/generated/SupportedCSSProperties.js +7512 -0
- package/lib/front_end/generated/protocol-proxy-api.d.ts +5022 -0
- package/lib/front_end/generated/protocol.ts +22014 -0
- package/lib/front_end/models/cpu_profile/CPUProfileDataModel.ts +571 -0
- package/lib/front_end/models/cpu_profile/ProfileTreeModel.ts +103 -0
- package/lib/front_end/models/cpu_profile/cpu_profile.ts +11 -0
- package/lib/front_end/models/formatter/FormatterWorkerPool.ts +219 -0
- package/lib/front_end/models/formatter/ScriptFormatter.ts +112 -0
- package/lib/front_end/models/formatter/formatter.ts +8 -0
- package/lib/front_end/models/text_utils/CodeMirrorUtils.ts +37 -0
- package/lib/front_end/models/text_utils/ContentData.ts +199 -0
- package/lib/front_end/models/text_utils/ContentProvider.ts +68 -0
- package/lib/front_end/models/text_utils/StaticContentProvider.ts +49 -0
- package/lib/front_end/models/text_utils/StreamingContentData.ts +108 -0
- package/lib/front_end/models/text_utils/Text.ts +90 -0
- package/lib/front_end/models/text_utils/TextCursor.ts +44 -0
- package/lib/front_end/models/text_utils/TextRange.ts +266 -0
- package/lib/front_end/models/text_utils/TextUtils.ts +401 -0
- package/lib/front_end/models/text_utils/WasmDisassembly.ts +87 -0
- package/lib/front_end/models/text_utils/text_utils.ts +27 -0
- package/lib/front_end/models/trace/EntityMapper.ts +141 -0
- package/lib/front_end/models/trace/EventsSerializer.ts +101 -0
- package/lib/front_end/models/trace/LanternComputationData.ts +438 -0
- package/lib/front_end/models/trace/ModelImpl.ts +236 -0
- package/lib/front_end/models/trace/Name.ts +136 -0
- package/lib/front_end/models/trace/Processor.ts +652 -0
- package/lib/front_end/models/trace/Styles.ts +1138 -0
- package/lib/front_end/models/trace/extras/FilmStrip.ts +78 -0
- package/lib/front_end/models/trace/extras/MainThreadActivity.ts +86 -0
- package/lib/front_end/models/trace/extras/ScriptDuplication.ts +236 -0
- package/lib/front_end/models/trace/extras/StackTraceForEvent.ts +203 -0
- package/lib/front_end/models/trace/extras/ThirdParties.ts +164 -0
- package/lib/front_end/models/trace/extras/TraceFilter.ts +62 -0
- package/lib/front_end/models/trace/extras/TraceTree.ts +701 -0
- package/lib/front_end/models/trace/extras/extras.ts +11 -0
- package/lib/front_end/models/trace/handlers/AnimationFramesHandler.ts +128 -0
- package/lib/front_end/models/trace/handlers/AnimationHandler.ts +36 -0
- package/lib/front_end/models/trace/handlers/AsyncJSCallsHandler.ts +239 -0
- package/lib/front_end/models/trace/handlers/AuctionWorkletsHandler.ts +183 -0
- package/lib/front_end/models/trace/handlers/DOMStatsHandler.ts +31 -0
- package/lib/front_end/models/trace/handlers/ExtensionTraceDataHandler.ts +306 -0
- package/lib/front_end/models/trace/handlers/FlowsHandler.ts +175 -0
- package/lib/front_end/models/trace/handlers/FramesHandler.ts +571 -0
- package/lib/front_end/models/trace/handlers/GPUHandler.ts +50 -0
- package/lib/front_end/models/trace/handlers/ImagePaintingHandler.ts +183 -0
- package/lib/front_end/models/trace/handlers/InitiatorsHandler.ts +193 -0
- package/lib/front_end/models/trace/handlers/InvalidationsHandler.ts +168 -0
- package/lib/front_end/models/trace/handlers/LargestImagePaintHandler.ts +109 -0
- package/lib/front_end/models/trace/handlers/LargestTextPaintHandler.ts +35 -0
- package/lib/front_end/models/trace/handlers/LayerTreeHandler.ts +123 -0
- package/lib/front_end/models/trace/handlers/LayoutShiftsHandler.ts +573 -0
- package/lib/front_end/models/trace/handlers/MemoryHandler.ts +31 -0
- package/lib/front_end/models/trace/handlers/MetaHandler.ts +525 -0
- package/lib/front_end/models/trace/handlers/ModelHandlers.ts +34 -0
- package/lib/front_end/models/trace/handlers/NetworkRequestsHandler.ts +672 -0
- package/lib/front_end/models/trace/handlers/PageFramesHandler.ts +52 -0
- package/lib/front_end/models/trace/handlers/PageLoadMetricsHandler.ts +460 -0
- package/lib/front_end/models/trace/handlers/RendererHandler.ts +428 -0
- package/lib/front_end/models/trace/handlers/SamplesHandler.ts +271 -0
- package/lib/front_end/models/trace/handlers/ScreenshotsHandler.ts +122 -0
- package/lib/front_end/models/trace/handlers/ScriptsHandler.ts +336 -0
- package/lib/front_end/models/trace/handlers/SelectorStatsHandler.ts +110 -0
- package/lib/front_end/models/trace/handlers/Threads.ts +139 -0
- package/lib/front_end/models/trace/handlers/UserInteractionsHandler.ts +400 -0
- package/lib/front_end/models/trace/handlers/UserTimingsHandler.ts +233 -0
- package/lib/front_end/models/trace/handlers/WarningsHandler.ts +162 -0
- package/lib/front_end/models/trace/handlers/WorkersHandler.ts +45 -0
- package/lib/front_end/models/trace/handlers/handlers.ts +8 -0
- package/lib/front_end/models/trace/handlers/helpers.ts +196 -0
- package/lib/front_end/models/trace/handlers/types.ts +75 -0
- package/lib/front_end/models/trace/helpers/Extensions.ts +54 -0
- package/lib/front_end/models/trace/helpers/Network.ts +129 -0
- package/lib/front_end/models/trace/helpers/SamplesIntegrator.ts +544 -0
- package/lib/front_end/models/trace/helpers/SyntheticEvents.ts +87 -0
- package/lib/front_end/models/trace/helpers/Timing.ts +248 -0
- package/lib/front_end/models/trace/helpers/Trace.ts +928 -0
- package/lib/front_end/models/trace/helpers/TreeHelpers.ts +320 -0
- package/lib/front_end/models/trace/helpers/helpers.ts +11 -0
- package/lib/front_end/models/trace/insights/CLSCulprits.ts +668 -0
- package/lib/front_end/models/trace/insights/Cache.ts +269 -0
- package/lib/front_end/models/trace/insights/Common.ts +453 -0
- package/lib/front_end/models/trace/insights/DOMSize.ts +223 -0
- package/lib/front_end/models/trace/insights/DocumentLatency.ts +319 -0
- package/lib/front_end/models/trace/insights/DuplicatedJavaScript.ts +126 -0
- package/lib/front_end/models/trace/insights/FontDisplay.ts +119 -0
- package/lib/front_end/models/trace/insights/ForcedReflow.ts +220 -0
- package/lib/front_end/models/trace/insights/INPBreakdown.ts +171 -0
- package/lib/front_end/models/trace/insights/ImageDelivery.ts +348 -0
- package/lib/front_end/models/trace/insights/LCPBreakdown.ts +268 -0
- package/lib/front_end/models/trace/insights/LCPDiscovery.ts +237 -0
- package/lib/front_end/models/trace/insights/LegacyJavaScript.ts +138 -0
- package/lib/front_end/models/trace/insights/Models.ts +22 -0
- package/lib/front_end/models/trace/insights/ModernHTTP.ts +257 -0
- package/lib/front_end/models/trace/insights/NetworkDependencyTree.ts +726 -0
- package/lib/front_end/models/trace/insights/RenderBlocking.ts +257 -0
- package/lib/front_end/models/trace/insights/SlowCSSSelector.ts +175 -0
- package/lib/front_end/models/trace/insights/Statistics.ts +101 -0
- package/lib/front_end/models/trace/insights/ThirdParties.ts +130 -0
- package/lib/front_end/models/trace/insights/Viewport.ts +138 -0
- package/lib/front_end/models/trace/insights/insights.ts +10 -0
- package/lib/front_end/models/trace/insights/types.ts +157 -0
- package/lib/front_end/models/trace/lantern/core/LanternError.ts +7 -0
- package/lib/front_end/models/trace/lantern/core/NetworkAnalyzer.ts +619 -0
- package/lib/front_end/models/trace/lantern/core/core.ts +6 -0
- package/lib/front_end/models/trace/lantern/graph/BaseNode.ts +345 -0
- package/lib/front_end/models/trace/lantern/graph/CPUNode.ts +80 -0
- package/lib/front_end/models/trace/lantern/graph/NetworkNode.ts +101 -0
- package/lib/front_end/models/trace/lantern/graph/PageDependencyGraph.ts +636 -0
- package/lib/front_end/models/trace/lantern/graph/graph.ts +8 -0
- package/lib/front_end/models/trace/lantern/lantern.ts +17 -0
- package/lib/front_end/models/trace/lantern/metrics/FirstContentfulPaint.ts +187 -0
- package/lib/front_end/models/trace/lantern/metrics/Interactive.ts +88 -0
- package/lib/front_end/models/trace/lantern/metrics/LargestContentfulPaint.ts +92 -0
- package/lib/front_end/models/trace/lantern/metrics/MaxPotentialFID.ts +72 -0
- package/lib/front_end/models/trace/lantern/metrics/Metric.ts +126 -0
- package/lib/front_end/models/trace/lantern/metrics/SpeedIndex.ts +126 -0
- package/lib/front_end/models/trace/lantern/metrics/TBTUtils.ts +82 -0
- package/lib/front_end/models/trace/lantern/metrics/TotalBlockingTime.ts +112 -0
- package/lib/front_end/models/trace/lantern/metrics/metrics.ts +12 -0
- package/lib/front_end/models/trace/lantern/simulation/ConnectionPool.ts +150 -0
- package/lib/front_end/models/trace/lantern/simulation/Constants.ts +46 -0
- package/lib/front_end/models/trace/lantern/simulation/DNSCache.ts +61 -0
- package/lib/front_end/models/trace/lantern/simulation/SimulationTimingMap.ts +196 -0
- package/lib/front_end/models/trace/lantern/simulation/Simulator.ts +556 -0
- package/lib/front_end/models/trace/lantern/simulation/TCPConnection.ts +192 -0
- package/lib/front_end/models/trace/lantern/simulation/simulation.ts +10 -0
- package/lib/front_end/models/trace/lantern/types/Lantern.ts +220 -0
- package/lib/front_end/models/trace/lantern/types/types.ts +5 -0
- package/lib/front_end/models/trace/trace.ts +33 -0
- package/lib/front_end/models/trace/types/Configuration.ts +110 -0
- package/lib/front_end/models/trace/types/Extensions.ts +136 -0
- package/lib/front_end/models/trace/types/File.ts +281 -0
- package/lib/front_end/models/trace/types/Overlays.ts +138 -0
- package/lib/front_end/models/trace/types/Timing.ts +30 -0
- package/lib/front_end/models/trace/types/TraceEvents.ts +3277 -0
- package/lib/front_end/models/trace/types/types.ts +10 -0
- package/lib/front_end/third_party/i18n/LICENSE +202 -0
- package/lib/front_end/third_party/i18n/README.chromium +15 -0
- package/lib/front_end/third_party/i18n/i18n-impl.ts +61 -0
- package/lib/front_end/third_party/i18n/i18n.ts +11 -0
- package/lib/front_end/third_party/i18n/localized-string-set.ts +129 -0
- package/lib/front_end/third_party/intl-messageformat/LICENSE +33 -0
- package/lib/front_end/third_party/intl-messageformat/README.chromium +24 -0
- package/lib/front_end/third_party/intl-messageformat/intl-messageformat-tsconfig.json +16 -0
- package/lib/front_end/third_party/intl-messageformat/intl-messageformat.ts +6 -0
- package/lib/front_end/third_party/intl-messageformat/package/LICENSE.md +33 -0
- package/lib/front_end/third_party/intl-messageformat/package/README.md +3 -0
- package/lib/front_end/third_party/intl-messageformat/package/index.d.ts +6 -0
- package/lib/front_end/third_party/intl-messageformat/package/index.d.ts.map +1 -0
- package/lib/front_end/third_party/intl-messageformat/package/index.js +13 -0
- package/lib/front_end/third_party/intl-messageformat/package/intl-messageformat.esm.d.ts +5 -0
- package/lib/front_end/third_party/intl-messageformat/package/intl-messageformat.esm.js +1710 -0
- package/lib/front_end/third_party/intl-messageformat/package/intl-messageformat.iife.js +1815 -0
- package/lib/front_end/third_party/intl-messageformat/package/lib/index.d.ts +6 -0
- package/lib/front_end/third_party/intl-messageformat/package/lib/index.d.ts.map +1 -0
- package/lib/front_end/third_party/intl-messageformat/package/lib/index.js +10 -0
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/core.d.ts +34 -0
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/core.d.ts.map +1 -0
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/core.js +229 -0
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/error.d.ts +28 -0
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/error.d.ts.map +1 -0
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/error.js +48 -0
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/formatters.d.ts +34 -0
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/formatters.d.ts.map +1 -0
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/formatters.js +179 -0
- package/lib/front_end/third_party/intl-messageformat/package/package.json +42 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/core.d.ts +34 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/core.d.ts.map +1 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/core.js +230 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/error.d.ts +28 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/error.d.ts.map +1 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/error.js +51 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/formatters.d.ts +34 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/formatters.d.ts.map +1 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/formatters.js +182 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/icu-messageformat-parser/error.d.ts +79 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/icu-messageformat-parser/index.d.ts +15 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/icu-messageformat-parser/parser.d.ts +153 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/icu-messageformat-parser/types.d.ts +139 -0
- package/lib/front_end/third_party/legacy-javascript/LICENSE +202 -0
- package/lib/front_end/third_party/legacy-javascript/README.chromium +13 -0
- package/lib/front_end/third_party/legacy-javascript/legacy-javascript-tsconfig.json +8 -0
- package/lib/front_end/third_party/legacy-javascript/legacy-javascript.ts +3 -0
- package/lib/front_end/third_party/legacy-javascript/lib/legacy-javascript.d.ts +18 -0
- package/lib/front_end/third_party/legacy-javascript/lib/legacy-javascript.js +943 -0
- package/lib/front_end/third_party/legacy-javascript/package.json +8 -0
- package/lib/front_end/third_party/legacy-javascript/rebuild.sh +9 -0
- package/lib/front_end/third_party/third-party-web/LICENSE +20 -0
- package/lib/front_end/third_party/third-party-web/README.chromium +13 -0
- package/lib/front_end/third_party/third-party-web/lib/nostats-subset.d.ts +2 -0
- package/lib/front_end/third_party/third-party-web/lib/nostats-subset.js +149 -0
- package/lib/front_end/third_party/third-party-web/package/LICENSE +20 -0
- package/lib/front_end/third_party/third-party-web/package/README.md +929 -0
- package/lib/front_end/third_party/third-party-web/package/dist/entities-httparchive-nostats.json +1 -0
- package/lib/front_end/third_party/third-party-web/package/dist/entities-httparchive.json +1 -0
- package/lib/front_end/third_party/third-party-web/package/dist/entities-nostats.json +1 -0
- package/lib/front_end/third_party/third-party-web/package/dist/entities.json +1 -0
- package/lib/front_end/third_party/third-party-web/package/facades.md +46 -0
- package/lib/front_end/third_party/third-party-web/package/httparchive-nostats-subset.d.ts +1 -0
- package/lib/front_end/third_party/third-party-web/package/httparchive-nostats-subset.js +1 -0
- package/lib/front_end/third_party/third-party-web/package/httparchive-subset.d.ts +1 -0
- package/lib/front_end/third_party/third-party-web/package/httparchive-subset.js +1 -0
- package/lib/front_end/third_party/third-party-web/package/lib/__snapshots__/index.test.js.snap +1006 -0
- package/lib/front_end/third_party/third-party-web/package/lib/create-entity-finder-api.js +139 -0
- package/lib/front_end/third_party/third-party-web/package/lib/create-entity-finder-api.test.js +44 -0
- package/lib/front_end/third_party/third-party-web/package/lib/entities.test.js +27 -0
- package/lib/front_end/third_party/third-party-web/package/lib/index.d.ts +34 -0
- package/lib/front_end/third_party/third-party-web/package/lib/index.js +3 -0
- package/lib/front_end/third_party/third-party-web/package/lib/index.test.js +246 -0
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/faqs.partial.md +36 -0
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/goals.partial.md +9 -0
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/methodology.partial.md +5 -0
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/template.md +151 -0
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2019-02-01.md +1 -0
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2019-03-01.md +1 -0
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2019-05-06.md +1 -0
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2019-05-13.md +14 -0
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2021-01-01.md +1 -0
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2024-07-01.md +3 -0
- package/lib/front_end/third_party/third-party-web/package/lib/subsets/httparchive-nostats.d.ts +1 -0
- package/lib/front_end/third_party/third-party-web/package/lib/subsets/httparchive-nostats.js +3 -0
- package/lib/front_end/third_party/third-party-web/package/lib/subsets/httparchive.d.ts +1 -0
- package/lib/front_end/third_party/third-party-web/package/lib/subsets/httparchive.js +3 -0
- package/lib/front_end/third_party/third-party-web/package/lib/subsets/nostats.d.ts +1 -0
- package/lib/front_end/third_party/third-party-web/package/lib/subsets/nostats.js +3 -0
- package/lib/front_end/third_party/third-party-web/package/nostats-subset.d.ts +1 -0
- package/lib/front_end/third_party/third-party-web/package/nostats-subset.js +1 -0
- package/lib/front_end/third_party/third-party-web/package/package.json +46 -0
- package/lib/front_end/third_party/third-party-web/package.json +8 -0
- package/lib/front_end/third_party/third-party-web/rebuild.sh +13 -0
- package/lib/front_end/third_party/third-party-web/third-party-web-tsconfig.json +8 -0
- package/lib/front_end/third_party/third-party-web/third-party-web.ts +3 -0
- package/package.json +24 -0
- package/patches/chrome-devtools-frontend+1.0.1533544.patch +187 -0
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
// Copyright 2016 The Chromium Authors
|
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
import type * as Protocol from '../../generated/protocol.js';
|
|
6
|
+
import * as TextUtils from '../../models/text_utils/text_utils.js';
|
|
7
|
+
|
|
8
|
+
import {cssMetadata} from './CSSMetadata.js';
|
|
9
|
+
import type {CSSModel, Edit} from './CSSModel.js';
|
|
10
|
+
import {CSSProperty} from './CSSProperty.js';
|
|
11
|
+
import type {CSSRule} from './CSSRule.js';
|
|
12
|
+
import type {Target} from './Target.js';
|
|
13
|
+
|
|
14
|
+
export class CSSStyleDeclaration {
|
|
15
|
+
readonly #cssModel: CSSModel;
|
|
16
|
+
parentRule: CSSRule|null;
|
|
17
|
+
#allProperties!: CSSProperty[];
|
|
18
|
+
styleSheetId?: Protocol.CSS.StyleSheetId;
|
|
19
|
+
range!: TextUtils.TextRange.TextRange|null;
|
|
20
|
+
cssText?: string;
|
|
21
|
+
#shorthandValues = new Map<string, string>();
|
|
22
|
+
#shorthandIsImportant = new Set<string>();
|
|
23
|
+
#activePropertyMap = new Map<string, CSSProperty>();
|
|
24
|
+
#leadingProperties!: CSSProperty[]|null;
|
|
25
|
+
type: Type;
|
|
26
|
+
// For CSSStyles coming from animations,
|
|
27
|
+
// This holds the name of the animation.
|
|
28
|
+
#animationName?: string;
|
|
29
|
+
constructor(
|
|
30
|
+
cssModel: CSSModel, parentRule: CSSRule|null, payload: Protocol.CSS.CSSStyle, type: Type,
|
|
31
|
+
animationName?: string) {
|
|
32
|
+
this.#cssModel = cssModel;
|
|
33
|
+
this.parentRule = parentRule;
|
|
34
|
+
this.#reinitialize(payload);
|
|
35
|
+
this.type = type;
|
|
36
|
+
this.#animationName = animationName;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
rebase(edit: Edit): void {
|
|
40
|
+
if (this.styleSheetId !== edit.styleSheetId || !this.range) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
if (edit.oldRange.equal(this.range)) {
|
|
44
|
+
this.#reinitialize((edit.payload as Protocol.CSS.CSSStyle));
|
|
45
|
+
} else {
|
|
46
|
+
this.range = this.range.rebaseAfterTextEdit(edit.oldRange, edit.newRange);
|
|
47
|
+
for (let i = 0; i < this.#allProperties.length; ++i) {
|
|
48
|
+
this.#allProperties[i].rebase(edit);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
animationName(): string|undefined {
|
|
54
|
+
return this.#animationName;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
#reinitialize(payload: Protocol.CSS.CSSStyle): void {
|
|
58
|
+
this.styleSheetId = payload.styleSheetId;
|
|
59
|
+
this.range = payload.range ? TextUtils.TextRange.TextRange.fromObject(payload.range) : null;
|
|
60
|
+
|
|
61
|
+
const shorthandEntries = payload.shorthandEntries;
|
|
62
|
+
this.#shorthandValues = new Map();
|
|
63
|
+
this.#shorthandIsImportant = new Set();
|
|
64
|
+
for (let i = 0; i < shorthandEntries.length; ++i) {
|
|
65
|
+
this.#shorthandValues.set(shorthandEntries[i].name, shorthandEntries[i].value);
|
|
66
|
+
if (shorthandEntries[i].important) {
|
|
67
|
+
this.#shorthandIsImportant.add(shorthandEntries[i].name);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
this.#allProperties = [];
|
|
72
|
+
|
|
73
|
+
if (payload.cssText && this.range) {
|
|
74
|
+
const longhands = [];
|
|
75
|
+
for (const cssProperty of payload.cssProperties) {
|
|
76
|
+
const range = cssProperty.range;
|
|
77
|
+
if (!range) {
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
const parsedProperty = CSSProperty.parsePayload(this, this.#allProperties.length, cssProperty);
|
|
81
|
+
this.#allProperties.push(parsedProperty);
|
|
82
|
+
for (const longhand of parsedProperty.getLonghandProperties()) {
|
|
83
|
+
longhands.push(longhand);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
for (const longhand of longhands) {
|
|
87
|
+
longhand.index = this.#allProperties.length;
|
|
88
|
+
this.#allProperties.push(longhand);
|
|
89
|
+
}
|
|
90
|
+
} else {
|
|
91
|
+
for (const cssProperty of payload.cssProperties) {
|
|
92
|
+
this.#allProperties.push(CSSProperty.parsePayload(this, this.#allProperties.length, cssProperty));
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
this.#generateSyntheticPropertiesIfNeeded();
|
|
97
|
+
this.#computeInactiveProperties();
|
|
98
|
+
|
|
99
|
+
// TODO(changhaohan): verify if this #activePropertyMap is still necessary, or if it is
|
|
100
|
+
// providing different information against the activeness in allPropertiesInternal.
|
|
101
|
+
this.#activePropertyMap = new Map();
|
|
102
|
+
for (const property of this.#allProperties) {
|
|
103
|
+
if (!property.activeInStyle()) {
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
this.#activePropertyMap.set(property.name, property);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
this.cssText = payload.cssText;
|
|
110
|
+
this.#leadingProperties = null;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
#generateSyntheticPropertiesIfNeeded(): void {
|
|
114
|
+
if (this.range) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (!this.#shorthandValues.size) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const propertiesSet = new Set<string>();
|
|
123
|
+
for (const property of this.#allProperties) {
|
|
124
|
+
propertiesSet.add(property.name);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const generatedProperties = [];
|
|
128
|
+
// For style-based properties, generate #shorthands with values when possible.
|
|
129
|
+
for (const property of this.#allProperties) {
|
|
130
|
+
// For style-based properties, try generating #shorthands.
|
|
131
|
+
const shorthands = cssMetadata().getShorthands(property.name) || [];
|
|
132
|
+
for (const shorthand of shorthands) {
|
|
133
|
+
if (propertiesSet.has(shorthand)) {
|
|
134
|
+
continue;
|
|
135
|
+
} // There already is a shorthand this #longhand falls under.
|
|
136
|
+
const shorthandValue = this.#shorthandValues.get(shorthand);
|
|
137
|
+
if (!shorthandValue) {
|
|
138
|
+
continue;
|
|
139
|
+
} // Never generate synthetic #shorthands when no value is available.
|
|
140
|
+
|
|
141
|
+
// Generate synthetic shorthand we have a value for.
|
|
142
|
+
const shorthandImportance = Boolean(this.#shorthandIsImportant.has(shorthand));
|
|
143
|
+
const shorthandProperty = new CSSProperty(
|
|
144
|
+
this, this.allProperties().length, shorthand, shorthandValue, shorthandImportance, false, true, false);
|
|
145
|
+
generatedProperties.push(shorthandProperty);
|
|
146
|
+
propertiesSet.add(shorthand);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
this.#allProperties = this.#allProperties.concat(generatedProperties);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
#computeLeadingProperties(): CSSProperty[] {
|
|
153
|
+
function propertyHasRange(property: CSSProperty): boolean {
|
|
154
|
+
return Boolean(property.range);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (this.range) {
|
|
158
|
+
return this.#allProperties.filter(propertyHasRange);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const leadingProperties = [];
|
|
162
|
+
for (const property of this.#allProperties) {
|
|
163
|
+
const shorthands = cssMetadata().getShorthands(property.name) || [];
|
|
164
|
+
let belongToAnyShorthand = false;
|
|
165
|
+
for (const shorthand of shorthands) {
|
|
166
|
+
if (this.#shorthandValues.get(shorthand)) {
|
|
167
|
+
belongToAnyShorthand = true;
|
|
168
|
+
break;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
if (!belongToAnyShorthand) {
|
|
172
|
+
leadingProperties.push(property);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return leadingProperties;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
leadingProperties(): CSSProperty[] {
|
|
180
|
+
if (!this.#leadingProperties) {
|
|
181
|
+
this.#leadingProperties = this.#computeLeadingProperties();
|
|
182
|
+
}
|
|
183
|
+
return this.#leadingProperties;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
target(): Target {
|
|
187
|
+
return this.#cssModel.target();
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
cssModel(): CSSModel {
|
|
191
|
+
return this.#cssModel;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
#computeInactiveProperties(): void {
|
|
195
|
+
const activeProperties = new Map<string, CSSProperty>();
|
|
196
|
+
// The order of the properties are:
|
|
197
|
+
// 1. regular property, including shorthands
|
|
198
|
+
// 2. longhand components from shorthands, in the order of their shorthands.
|
|
199
|
+
const processedLonghands = new Set();
|
|
200
|
+
for (const property of this.#allProperties) {
|
|
201
|
+
const metadata = cssMetadata();
|
|
202
|
+
const canonicalName = metadata.canonicalPropertyName(property.name);
|
|
203
|
+
if (property.disabled || !property.parsedOk) {
|
|
204
|
+
if (!property.disabled && metadata.isCustomProperty(property.name)) {
|
|
205
|
+
// Variable declarations that aren't parsedOk still "overload" other previous active declarations.
|
|
206
|
+
activeProperties.get(canonicalName)?.setActive(false);
|
|
207
|
+
activeProperties.delete(canonicalName);
|
|
208
|
+
}
|
|
209
|
+
property.setActive(false);
|
|
210
|
+
continue;
|
|
211
|
+
}
|
|
212
|
+
if (processedLonghands.has(property)) {
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
for (const longhand of property.getLonghandProperties()) {
|
|
216
|
+
const activeLonghand = activeProperties.get(longhand.name);
|
|
217
|
+
if (!activeLonghand) {
|
|
218
|
+
activeProperties.set(longhand.name, longhand);
|
|
219
|
+
} else if (!activeLonghand.important || longhand.important) {
|
|
220
|
+
activeLonghand.setActive(false);
|
|
221
|
+
activeProperties.set(longhand.name, longhand);
|
|
222
|
+
} else {
|
|
223
|
+
longhand.setActive(false);
|
|
224
|
+
}
|
|
225
|
+
processedLonghands.add(longhand);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
const activeProperty = activeProperties.get(canonicalName);
|
|
229
|
+
if (!activeProperty) {
|
|
230
|
+
activeProperties.set(canonicalName, property);
|
|
231
|
+
} else if (!activeProperty.important || property.important) {
|
|
232
|
+
activeProperty.setActive(false);
|
|
233
|
+
activeProperties.set(canonicalName, property);
|
|
234
|
+
} else {
|
|
235
|
+
property.setActive(false);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
allProperties(): CSSProperty[] {
|
|
241
|
+
return this.#allProperties;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
hasActiveProperty(name: string): boolean {
|
|
245
|
+
return this.#activePropertyMap.has(name);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
getPropertyValue(name: string): string {
|
|
249
|
+
const property = this.#activePropertyMap.get(name);
|
|
250
|
+
return property ? property.value : '';
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
isPropertyImplicit(name: string): boolean {
|
|
254
|
+
const property = this.#activePropertyMap.get(name);
|
|
255
|
+
return property ? property.implicit : false;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
propertyAt(index: number): CSSProperty|null {
|
|
259
|
+
return (index < this.allProperties().length) ? this.allProperties()[index] : null;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
pastLastSourcePropertyIndex(): number {
|
|
263
|
+
for (let i = this.allProperties().length - 1; i >= 0; --i) {
|
|
264
|
+
if (this.allProperties()[i].range) {
|
|
265
|
+
return i + 1;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
return 0;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
#insertionRange(index: number): TextUtils.TextRange.TextRange {
|
|
272
|
+
const property = this.propertyAt(index);
|
|
273
|
+
if (property?.range) {
|
|
274
|
+
return property.range.collapseToStart();
|
|
275
|
+
}
|
|
276
|
+
if (!this.range) {
|
|
277
|
+
throw new Error('CSSStyleDeclaration.range is null');
|
|
278
|
+
}
|
|
279
|
+
return this.range.collapseToEnd();
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
newBlankProperty(index?: number): CSSProperty {
|
|
283
|
+
index = (typeof index === 'undefined') ? this.pastLastSourcePropertyIndex() : index;
|
|
284
|
+
const property = new CSSProperty(this, index, '', '', false, false, true, false, '', this.#insertionRange(index));
|
|
285
|
+
return property;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
setText(text: string, majorChange: boolean): Promise<boolean> {
|
|
289
|
+
if (!this.range || !this.styleSheetId) {
|
|
290
|
+
return Promise.resolve(false);
|
|
291
|
+
}
|
|
292
|
+
return this.#cssModel.setStyleText(this.styleSheetId, this.range, text, majorChange);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
insertPropertyAt(index: number, name: string, value: string, userCallback?: ((arg0: boolean) => void)): void {
|
|
296
|
+
void this.newBlankProperty(index).setText(name + ': ' + value + ';', false, true).then(userCallback);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
appendProperty(name: string, value: string, userCallback?: ((arg0: boolean) => void)): void {
|
|
300
|
+
this.insertPropertyAt(this.allProperties().length, name, value, userCallback);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
export enum Type {
|
|
305
|
+
/* eslint-disable @typescript-eslint/naming-convention -- Used by web_tests. */
|
|
306
|
+
Regular = 'Regular',
|
|
307
|
+
Inline = 'Inline',
|
|
308
|
+
Attributes = 'Attributes',
|
|
309
|
+
Pseudo = 'Pseudo', // This type is for style declarations generated by devtools
|
|
310
|
+
Transition = 'Transition',
|
|
311
|
+
Animation = 'Animation',
|
|
312
|
+
/* eslint-enable @typescript-eslint/naming-convention */
|
|
313
|
+
}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
// Copyright 2016 The Chromium Authors
|
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
import type * as Protocol from '../../generated/protocol.js';
|
|
6
|
+
import * as TextUtils from '../../models/text_utils/text_utils.js';
|
|
7
|
+
import * as Common from '../common/common.js';
|
|
8
|
+
import * as i18n from '../i18n/i18n.js';
|
|
9
|
+
import * as Platform from '../platform/platform.js';
|
|
10
|
+
|
|
11
|
+
import type {CSSModel} from './CSSModel.js';
|
|
12
|
+
import {DeferredDOMNode} from './DOMModel.js';
|
|
13
|
+
import type {FrameAssociated} from './FrameAssociated.js';
|
|
14
|
+
import type {PageResourceLoadInitiator} from './PageResourceLoader.js';
|
|
15
|
+
import {ResourceTreeModel} from './ResourceTreeModel.js';
|
|
16
|
+
import type {DebugId} from './SourceMap.js';
|
|
17
|
+
|
|
18
|
+
const UIStrings = {
|
|
19
|
+
/**
|
|
20
|
+
* @description Error message for when a CSS file can't be loaded
|
|
21
|
+
*/
|
|
22
|
+
couldNotFindTheOriginalStyle: 'Could not find the original style sheet.',
|
|
23
|
+
/**
|
|
24
|
+
* @description Error message to display when a source CSS file could not be retrieved.
|
|
25
|
+
*/
|
|
26
|
+
thereWasAnErrorRetrievingThe: 'There was an error retrieving the source styles.',
|
|
27
|
+
} as const;
|
|
28
|
+
const str_ = i18n.i18n.registerUIStrings('core/sdk/CSSStyleSheetHeader.ts', UIStrings);
|
|
29
|
+
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
30
|
+
|
|
31
|
+
export class CSSStyleSheetHeader implements TextUtils.ContentProvider.ContentProvider, FrameAssociated {
|
|
32
|
+
#cssModel: CSSModel;
|
|
33
|
+
id: Protocol.CSS.StyleSheetId;
|
|
34
|
+
frameId: Protocol.Page.FrameId;
|
|
35
|
+
sourceURL: Platform.DevToolsPath.UrlString;
|
|
36
|
+
hasSourceURL: boolean;
|
|
37
|
+
origin: Protocol.CSS.StyleSheetOrigin;
|
|
38
|
+
title: string;
|
|
39
|
+
disabled: boolean;
|
|
40
|
+
isInline: boolean;
|
|
41
|
+
isMutable: boolean;
|
|
42
|
+
isConstructed: boolean;
|
|
43
|
+
startLine: number;
|
|
44
|
+
startColumn: number;
|
|
45
|
+
endLine: number;
|
|
46
|
+
endColumn: number;
|
|
47
|
+
contentLength: number;
|
|
48
|
+
ownerNode: DeferredDOMNode|undefined;
|
|
49
|
+
sourceMapURL: Platform.DevToolsPath.UrlString|undefined;
|
|
50
|
+
readonly loadingFailed: boolean;
|
|
51
|
+
#originalContentProvider: TextUtils.StaticContentProvider.StaticContentProvider|null;
|
|
52
|
+
|
|
53
|
+
constructor(cssModel: CSSModel, payload: Protocol.CSS.CSSStyleSheetHeader) {
|
|
54
|
+
this.#cssModel = cssModel;
|
|
55
|
+
this.id = payload.styleSheetId;
|
|
56
|
+
this.frameId = payload.frameId;
|
|
57
|
+
this.sourceURL = payload.sourceURL as Platform.DevToolsPath.UrlString;
|
|
58
|
+
this.hasSourceURL = Boolean(payload.hasSourceURL);
|
|
59
|
+
this.origin = payload.origin;
|
|
60
|
+
this.title = payload.title;
|
|
61
|
+
this.disabled = payload.disabled;
|
|
62
|
+
this.isInline = payload.isInline;
|
|
63
|
+
this.isMutable = payload.isMutable;
|
|
64
|
+
this.isConstructed = payload.isConstructed;
|
|
65
|
+
this.startLine = payload.startLine;
|
|
66
|
+
this.startColumn = payload.startColumn;
|
|
67
|
+
this.endLine = payload.endLine;
|
|
68
|
+
this.endColumn = payload.endColumn;
|
|
69
|
+
this.contentLength = payload.length;
|
|
70
|
+
if (payload.ownerNode) {
|
|
71
|
+
this.ownerNode = new DeferredDOMNode(cssModel.target(), payload.ownerNode);
|
|
72
|
+
}
|
|
73
|
+
this.sourceMapURL = payload.sourceMapURL as Platform.DevToolsPath.UrlString;
|
|
74
|
+
this.loadingFailed = payload.loadingFailed ?? false;
|
|
75
|
+
this.#originalContentProvider = null;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
originalContentProvider(): TextUtils.ContentProvider.ContentProvider {
|
|
79
|
+
if (!this.#originalContentProvider) {
|
|
80
|
+
const lazyContent = (async(): Promise<TextUtils.ContentData.ContentDataOrError> => {
|
|
81
|
+
const originalText = await this.#cssModel.originalStyleSheetText(this);
|
|
82
|
+
if (originalText === null) {
|
|
83
|
+
return {error: i18nString(UIStrings.couldNotFindTheOriginalStyle)};
|
|
84
|
+
}
|
|
85
|
+
return new TextUtils.ContentData.ContentData(originalText, /* isBase64=*/ false, 'text/css');
|
|
86
|
+
});
|
|
87
|
+
this.#originalContentProvider =
|
|
88
|
+
new TextUtils.StaticContentProvider.StaticContentProvider(this.contentURL(), this.contentType(), lazyContent);
|
|
89
|
+
}
|
|
90
|
+
return this.#originalContentProvider;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
setSourceMapURL(sourceMapURL?: Platform.DevToolsPath.UrlString): void {
|
|
94
|
+
this.sourceMapURL = sourceMapURL;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
cssModel(): CSSModel {
|
|
98
|
+
return this.#cssModel;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
isAnonymousInlineStyleSheet(): boolean {
|
|
102
|
+
return !this.resourceURL() && !this.#cssModel.sourceMapManager().sourceMapForClient(this);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
isConstructedByNew(): boolean {
|
|
106
|
+
return this.isConstructed && this.sourceURL.length === 0;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
resourceURL(): Platform.DevToolsPath.UrlString {
|
|
110
|
+
return this.isViaInspector() ? this.viaInspectorResourceURL() : this.sourceURL;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
private getFrameURLPath(): string {
|
|
114
|
+
const model = this.#cssModel.target().model(ResourceTreeModel);
|
|
115
|
+
console.assert(Boolean(model));
|
|
116
|
+
if (!model) {
|
|
117
|
+
return '';
|
|
118
|
+
}
|
|
119
|
+
const frame = model.frameForId(this.frameId);
|
|
120
|
+
if (!frame) {
|
|
121
|
+
return '';
|
|
122
|
+
}
|
|
123
|
+
console.assert(Boolean(frame));
|
|
124
|
+
const parsedURL = new Common.ParsedURL.ParsedURL(frame.url);
|
|
125
|
+
let urlPath = parsedURL.host;
|
|
126
|
+
if (parsedURL.port) {
|
|
127
|
+
urlPath += ':' + parsedURL.port;
|
|
128
|
+
}
|
|
129
|
+
urlPath += parsedURL.folderPathComponents;
|
|
130
|
+
if (!urlPath.endsWith('/')) {
|
|
131
|
+
urlPath += '/';
|
|
132
|
+
}
|
|
133
|
+
return urlPath;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
private viaInspectorResourceURL(): Platform.DevToolsPath.UrlString {
|
|
137
|
+
return `inspector://${this.getFrameURLPath()}inspector-stylesheet#${this.id}` as Platform.DevToolsPath.UrlString;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
lineNumberInSource(lineNumberInStyleSheet: number): number {
|
|
141
|
+
return this.startLine + lineNumberInStyleSheet;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
columnNumberInSource(lineNumberInStyleSheet: number, columnNumberInStyleSheet: number): number|undefined {
|
|
145
|
+
return (lineNumberInStyleSheet ? 0 : this.startColumn) + columnNumberInStyleSheet;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Checks whether the position is in this style sheet. Assumes that the
|
|
150
|
+
* position's columnNumber is consistent with line endings.
|
|
151
|
+
*/
|
|
152
|
+
containsLocation(lineNumber: number, columnNumber: number): boolean {
|
|
153
|
+
const afterStart =
|
|
154
|
+
(lineNumber === this.startLine && columnNumber >= this.startColumn) || lineNumber > this.startLine;
|
|
155
|
+
const beforeEnd = lineNumber < this.endLine || (lineNumber === this.endLine && columnNumber <= this.endColumn);
|
|
156
|
+
return afterStart && beforeEnd;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
contentURL(): Platform.DevToolsPath.UrlString {
|
|
160
|
+
return this.resourceURL();
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
contentType(): Common.ResourceType.ResourceType {
|
|
164
|
+
return Common.ResourceType.resourceTypes.Stylesheet;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
async requestContentData(): Promise<TextUtils.ContentData.ContentDataOrError> {
|
|
168
|
+
const cssText = await this.#cssModel.getStyleSheetText(this.id);
|
|
169
|
+
if (cssText === null) {
|
|
170
|
+
return {error: i18nString(UIStrings.thereWasAnErrorRetrievingThe)};
|
|
171
|
+
}
|
|
172
|
+
return new TextUtils.ContentData.ContentData(cssText, /* isBase64=*/ false, 'text/css');
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
async searchInContent(query: string, caseSensitive: boolean, isRegex: boolean):
|
|
176
|
+
Promise<TextUtils.ContentProvider.SearchMatch[]> {
|
|
177
|
+
const contentData = await this.requestContentData();
|
|
178
|
+
return TextUtils.TextUtils.performSearchInContentData(contentData, query, caseSensitive, isRegex);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
isViaInspector(): boolean {
|
|
182
|
+
return this.origin === 'inspector';
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
createPageResourceLoadInitiator(): PageResourceLoadInitiator {
|
|
186
|
+
return {
|
|
187
|
+
target: this.#cssModel.target(),
|
|
188
|
+
frameId: this.frameId,
|
|
189
|
+
initiatorUrl: this.hasSourceURL ? Platform.DevToolsPath.EmptyUrlString : this.sourceURL,
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
debugId(): DebugId|null {
|
|
194
|
+
return null;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Copyright 2022 The Chromium Authors
|
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
import type * as Protocol from '../../generated/protocol.js';
|
|
6
|
+
import * as TextUtils from '../../models/text_utils/text_utils.js';
|
|
7
|
+
|
|
8
|
+
import type {CSSModel} from './CSSModel.js';
|
|
9
|
+
import {CSSQuery} from './CSSQuery.js';
|
|
10
|
+
|
|
11
|
+
export class CSSSupports extends CSSQuery {
|
|
12
|
+
static parseSupportsPayload(cssModel: CSSModel, payload: Protocol.CSS.CSSSupports[]): CSSSupports[] {
|
|
13
|
+
return payload.map(supports => new CSSSupports(cssModel, supports));
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
#active = true;
|
|
17
|
+
|
|
18
|
+
constructor(cssModel: CSSModel, payload: Protocol.CSS.CSSSupports) {
|
|
19
|
+
super(cssModel);
|
|
20
|
+
this.reinitialize(payload);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
reinitialize(payload: Protocol.CSS.CSSSupports): void {
|
|
24
|
+
this.text = payload.text;
|
|
25
|
+
this.range = payload.range ? TextUtils.TextRange.TextRange.fromObject(payload.range) : null;
|
|
26
|
+
this.styleSheetId = payload.styleSheetId;
|
|
27
|
+
this.#active = payload.active;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
active(): boolean {
|
|
31
|
+
return this.#active;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// Copyright 2021 The Chromium Authors
|
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
export const enum Category {
|
|
6
|
+
ANIMATION = 'animation',
|
|
7
|
+
AUCTION_WORKLET = 'auction-worklet',
|
|
8
|
+
CANVAS = 'canvas',
|
|
9
|
+
CLIPBOARD = 'clipboard',
|
|
10
|
+
CONTROL = 'control',
|
|
11
|
+
DEVICE = 'device',
|
|
12
|
+
DOM_MUTATION = 'dom-mutation',
|
|
13
|
+
DRAG_DROP = 'drag-drop',
|
|
14
|
+
GEOLOCATION = 'geolocation',
|
|
15
|
+
KEYBOARD = 'keyboard',
|
|
16
|
+
LOAD = 'load',
|
|
17
|
+
MEDIA = 'media',
|
|
18
|
+
MOUSE = 'mouse',
|
|
19
|
+
NOTIFICATION = 'notification',
|
|
20
|
+
PARSE = 'parse',
|
|
21
|
+
PICTURE_IN_PICTURE = 'picture-in-picture',
|
|
22
|
+
POINTER = 'pointer',
|
|
23
|
+
SCRIPT = 'script',
|
|
24
|
+
SHARED_STORAGE_WORKLET = 'shared-storage-worklet',
|
|
25
|
+
TIMER = 'timer',
|
|
26
|
+
TOUCH = 'touch',
|
|
27
|
+
TRUSTED_TYPE_VIOLATION = 'trusted-type-violation',
|
|
28
|
+
WEB_AUDIO = 'web-audio',
|
|
29
|
+
WINDOW = 'window',
|
|
30
|
+
WORKER = 'worker',
|
|
31
|
+
XHR = 'xhr',
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export class CategorizedBreakpoint {
|
|
35
|
+
/**
|
|
36
|
+
* The name of this breakpoint as passed to 'setInstrumentationBreakpoint',
|
|
37
|
+
* 'setEventListenerBreakpoint' and 'setBreakOnCSPViolation'.
|
|
38
|
+
*
|
|
39
|
+
* Note that the backend adds a 'listener:' and 'instrumentation:' prefix
|
|
40
|
+
* to this name in the 'Debugger.paused' CDP event.
|
|
41
|
+
*/
|
|
42
|
+
readonly name: string;
|
|
43
|
+
|
|
44
|
+
readonly #category: Category;
|
|
45
|
+
#enabled: boolean;
|
|
46
|
+
|
|
47
|
+
constructor(category: Category, name: string) {
|
|
48
|
+
this.#category = category;
|
|
49
|
+
this.name = name;
|
|
50
|
+
this.#enabled = false;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
category(): Category {
|
|
54
|
+
return this.#category;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
enabled(): boolean {
|
|
58
|
+
return this.#enabled;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
setEnabled(enabled: boolean): void {
|
|
62
|
+
this.#enabled = enabled;
|
|
63
|
+
}
|
|
64
|
+
}
|