devtools-tracing 1.1.1 → 1.2.1

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.
Files changed (527) hide show
  1. package/dist/index.d.ts +4 -0
  2. package/dist/index.js +28854 -0
  3. package/package.json +11 -8
  4. package/generate.ts +0 -649
  5. package/index.ts +0 -17
  6. package/lib/extension-api/ExtensionAPI.d.ts +0 -357
  7. package/lib/front_end/core/common/App.ts +0 -7
  8. package/lib/front_end/core/common/AppProvider.ts +0 -32
  9. package/lib/front_end/core/common/Base64.ts +0 -47
  10. package/lib/front_end/core/common/CharacterIdMap.ts +0 -30
  11. package/lib/front_end/core/common/Color.ts +0 -2506
  12. package/lib/front_end/core/common/ColorConverter.ts +0 -402
  13. package/lib/front_end/core/common/ColorUtils.ts +0 -252
  14. package/lib/front_end/core/common/Console.ts +0 -114
  15. package/lib/front_end/core/common/Debouncer.ts +0 -15
  16. package/lib/front_end/core/common/EventTarget.ts +0 -52
  17. package/lib/front_end/core/common/Gzip.ts +0 -74
  18. package/lib/front_end/core/common/JavaScriptMetaData.ts +0 -29
  19. package/lib/front_end/core/common/Lazy.ts +0 -31
  20. package/lib/front_end/core/common/Linkifier.ts +0 -55
  21. package/lib/front_end/core/common/MapWithDefault.ts +0 -26
  22. package/lib/front_end/core/common/Mutex.ts +0 -55
  23. package/lib/front_end/core/common/Object.ts +0 -145
  24. package/lib/front_end/core/common/ParsedURL.ts +0 -554
  25. package/lib/front_end/core/common/Progress.ts +0 -180
  26. package/lib/front_end/core/common/QueryParamHandler.ts +0 -7
  27. package/lib/front_end/core/common/ResolverBase.ts +0 -85
  28. package/lib/front_end/core/common/ResourceType.ts +0 -588
  29. package/lib/front_end/core/common/ReturnToPanel.ts +0 -17
  30. package/lib/front_end/core/common/Revealer.ts +0 -192
  31. package/lib/front_end/core/common/Runnable.ts +0 -41
  32. package/lib/front_end/core/common/SegmentedRange.ts +0 -87
  33. package/lib/front_end/core/common/SettingRegistration.ts +0 -339
  34. package/lib/front_end/core/common/Settings.ts +0 -1497
  35. package/lib/front_end/core/common/SimpleHistoryManager.ts +0 -124
  36. package/lib/front_end/core/common/StringOutputStream.ts +0 -26
  37. package/lib/front_end/core/common/TextDictionary.ts +0 -48
  38. package/lib/front_end/core/common/Throttler.ts +0 -99
  39. package/lib/front_end/core/common/Trie.ts +0 -152
  40. package/lib/front_end/core/common/Worker.ts +0 -60
  41. package/lib/front_end/core/common/common.ts +0 -81
  42. package/lib/front_end/core/host/AidaClient.ts +0 -733
  43. package/lib/front_end/core/host/GdpClient.ts +0 -316
  44. package/lib/front_end/core/host/InspectorFrontendHost.ts +0 -648
  45. package/lib/front_end/core/host/InspectorFrontendHostAPI.ts +0 -551
  46. package/lib/front_end/core/host/Platform.ts +0 -76
  47. package/lib/front_end/core/host/ResourceLoader.ts +0 -282
  48. package/lib/front_end/core/host/UserMetrics.ts +0 -1230
  49. package/lib/front_end/core/host/host.ts +0 -23
  50. package/lib/front_end/core/i18n/ByteUtilities.ts +0 -82
  51. package/lib/front_end/core/i18n/DevToolsLocale.ts +0 -87
  52. package/lib/front_end/core/i18n/NumberFormatter.ts +0 -82
  53. package/lib/front_end/core/i18n/i18n.ts +0 -17
  54. package/lib/front_end/core/i18n/i18nImpl.ts +0 -204
  55. package/lib/front_end/core/i18n/i18nTypes.ts +0 -10
  56. package/lib/front_end/core/i18n/locales.js +0 -14
  57. package/lib/front_end/core/i18n/time-utilities.ts +0 -174
  58. package/lib/front_end/core/platform/ArrayUtilities.ts +0 -271
  59. package/lib/front_end/core/platform/Brand.ts +0 -23
  60. package/lib/front_end/core/platform/Constructor.ts +0 -10
  61. package/lib/front_end/core/platform/DOMUtilities.ts +0 -138
  62. package/lib/front_end/core/platform/DateUtilities.ts +0 -15
  63. package/lib/front_end/core/platform/DevToolsPath.ts +0 -53
  64. package/lib/front_end/core/platform/KeyboardUtilities.ts +0 -38
  65. package/lib/front_end/core/platform/MapUtilities.ts +0 -95
  66. package/lib/front_end/core/platform/MimeType.ts +0 -175
  67. package/lib/front_end/core/platform/NumberUtilities.ts +0 -80
  68. package/lib/front_end/core/platform/StringUtilities.ts +0 -588
  69. package/lib/front_end/core/platform/Timing.ts +0 -17
  70. package/lib/front_end/core/platform/TypedArrayUtilities.ts +0 -189
  71. package/lib/front_end/core/platform/TypescriptUtilities.ts +0 -86
  72. package/lib/front_end/core/platform/UIString.ts +0 -39
  73. package/lib/front_end/core/platform/UserVisibleError.ts +0 -28
  74. package/lib/front_end/core/platform/platform.ts +0 -45
  75. package/lib/front_end/core/protocol_client/ConnectionTransport.ts +0 -26
  76. package/lib/front_end/core/protocol_client/InspectorBackend.ts +0 -1050
  77. package/lib/front_end/core/protocol_client/NodeURL.ts +0 -42
  78. package/lib/front_end/core/protocol_client/protocol_client.ts +0 -13
  79. package/lib/front_end/core/root/Runtime.ts +0 -609
  80. package/lib/front_end/core/root/root.ts +0 -6
  81. package/lib/front_end/core/sdk/AccessibilityModel.ts +0 -353
  82. package/lib/front_end/core/sdk/AnimationModel.ts +0 -1041
  83. package/lib/front_end/core/sdk/AutofillModel.ts +0 -184
  84. package/lib/front_end/core/sdk/CPUProfilerModel.ts +0 -148
  85. package/lib/front_end/core/sdk/CPUThrottlingManager.ts +0 -282
  86. package/lib/front_end/core/sdk/CSSContainerQuery.ts +0 -139
  87. package/lib/front_end/core/sdk/CSSFontFace.ts +0 -40
  88. package/lib/front_end/core/sdk/CSSLayer.ts +0 -30
  89. package/lib/front_end/core/sdk/CSSMatchedStyles.ts +0 -1646
  90. package/lib/front_end/core/sdk/CSSMedia.ts +0 -121
  91. package/lib/front_end/core/sdk/CSSMetadata.ts +0 -1647
  92. package/lib/front_end/core/sdk/CSSModel.ts +0 -1128
  93. package/lib/front_end/core/sdk/CSSProperty.ts +0 -384
  94. package/lib/front_end/core/sdk/CSSPropertyParser.ts +0 -681
  95. package/lib/front_end/core/sdk/CSSPropertyParserMatchers.ts +0 -1395
  96. package/lib/front_end/core/sdk/CSSQuery.ts +0 -72
  97. package/lib/front_end/core/sdk/CSSRule.ts +0 -465
  98. package/lib/front_end/core/sdk/CSSScope.ts +0 -30
  99. package/lib/front_end/core/sdk/CSSStartingStyle.ts +0 -29
  100. package/lib/front_end/core/sdk/CSSStyleDeclaration.ts +0 -313
  101. package/lib/front_end/core/sdk/CSSStyleSheetHeader.ts +0 -196
  102. package/lib/front_end/core/sdk/CSSSupports.ts +0 -33
  103. package/lib/front_end/core/sdk/CategorizedBreakpoint.ts +0 -64
  104. package/lib/front_end/core/sdk/ChildTargetManager.ts +0 -314
  105. package/lib/front_end/core/sdk/CompilerSourceMappingContentProvider.ts +0 -62
  106. package/lib/front_end/core/sdk/Connections.ts +0 -293
  107. package/lib/front_end/core/sdk/ConsoleModel.ts +0 -808
  108. package/lib/front_end/core/sdk/ConsoleModelTypes.ts +0 -15
  109. package/lib/front_end/core/sdk/Cookie.ts +0 -319
  110. package/lib/front_end/core/sdk/CookieModel.ts +0 -239
  111. package/lib/front_end/core/sdk/CookieParser.ts +0 -185
  112. package/lib/front_end/core/sdk/DOMDebuggerModel.ts +0 -787
  113. package/lib/front_end/core/sdk/DOMModel.ts +0 -1961
  114. package/lib/front_end/core/sdk/DebuggerModel.ts +0 -1605
  115. package/lib/front_end/core/sdk/EmulationModel.ts +0 -648
  116. package/lib/front_end/core/sdk/EnhancedTracesParser.ts +0 -515
  117. package/lib/front_end/core/sdk/EventBreakpointsModel.ts +0 -183
  118. package/lib/front_end/core/sdk/FrameAssociated.ts +0 -11
  119. package/lib/front_end/core/sdk/FrameManager.ts +0 -259
  120. package/lib/front_end/core/sdk/HeapProfilerModel.ts +0 -225
  121. package/lib/front_end/core/sdk/HttpReasonPhraseStrings.ts +0 -77
  122. package/lib/front_end/core/sdk/IOModel.ts +0 -91
  123. package/lib/front_end/core/sdk/IsolateManager.ts +0 -257
  124. package/lib/front_end/core/sdk/IssuesModel.ts +0 -70
  125. package/lib/front_end/core/sdk/LayerTreeBase.ts +0 -169
  126. package/lib/front_end/core/sdk/LogModel.ts +0 -56
  127. package/lib/front_end/core/sdk/NetworkManager.ts +0 -2823
  128. package/lib/front_end/core/sdk/NetworkRequest.ts +0 -2253
  129. package/lib/front_end/core/sdk/OverlayColorGenerator.ts +0 -52
  130. package/lib/front_end/core/sdk/OverlayModel.ts +0 -1011
  131. package/lib/front_end/core/sdk/OverlayPersistentHighlighter.ts +0 -522
  132. package/lib/front_end/core/sdk/PageLoad.ts +0 -35
  133. package/lib/front_end/core/sdk/PageResourceLoader.ts +0 -435
  134. package/lib/front_end/core/sdk/PaintProfiler.ts +0 -110
  135. package/lib/front_end/core/sdk/PerformanceMetricsModel.ts +0 -84
  136. package/lib/front_end/core/sdk/PreloadingModel.ts +0 -863
  137. package/lib/front_end/core/sdk/RehydratingConnection.ts +0 -386
  138. package/lib/front_end/core/sdk/RehydratingObject.ts +0 -66
  139. package/lib/front_end/core/sdk/RemoteObject.ts +0 -1160
  140. package/lib/front_end/core/sdk/Resource.ts +0 -232
  141. package/lib/front_end/core/sdk/ResourceTreeModel.ts +0 -1160
  142. package/lib/front_end/core/sdk/RuntimeModel.ts +0 -732
  143. package/lib/front_end/core/sdk/SDKModel.ts +0 -65
  144. package/lib/front_end/core/sdk/ScopeTreeCache.ts +0 -45
  145. package/lib/front_end/core/sdk/ScreenCaptureModel.ts +0 -255
  146. package/lib/front_end/core/sdk/Script.ts +0 -534
  147. package/lib/front_end/core/sdk/SecurityOriginManager.ts +0 -76
  148. package/lib/front_end/core/sdk/ServerSentEvents.ts +0 -80
  149. package/lib/front_end/core/sdk/ServerSentEventsProtocol.ts +0 -122
  150. package/lib/front_end/core/sdk/ServerTiming.ts +0 -260
  151. package/lib/front_end/core/sdk/ServiceWorkerCacheModel.ts +0 -377
  152. package/lib/front_end/core/sdk/ServiceWorkerManager.ts +0 -605
  153. package/lib/front_end/core/sdk/SourceMap.ts +0 -867
  154. package/lib/front_end/core/sdk/SourceMapCache.ts +0 -54
  155. package/lib/front_end/core/sdk/SourceMapFunctionRanges.ts +0 -156
  156. package/lib/front_end/core/sdk/SourceMapManager.ts +0 -239
  157. package/lib/front_end/core/sdk/SourceMapScopeChainEntry.ts +0 -189
  158. package/lib/front_end/core/sdk/SourceMapScopesInfo.ts +0 -508
  159. package/lib/front_end/core/sdk/StorageBucketsModel.ts +0 -204
  160. package/lib/front_end/core/sdk/StorageKeyManager.ts +0 -98
  161. package/lib/front_end/core/sdk/Target.ts +0 -332
  162. package/lib/front_end/core/sdk/TargetManager.ts +0 -453
  163. package/lib/front_end/core/sdk/TraceObject.ts +0 -61
  164. package/lib/front_end/core/sdk/WebAuthnModel.ts +0 -104
  165. package/lib/front_end/core/sdk/sdk.ts +0 -174
  166. package/lib/front_end/entrypoints/formatter_worker/FormatterActions.ts +0 -59
  167. package/lib/front_end/generated/InspectorBackendCommands.js +0 -1617
  168. package/lib/front_end/generated/SupportedCSSProperties.js +0 -7512
  169. package/lib/front_end/generated/protocol-proxy-api.d.ts +0 -5022
  170. package/lib/front_end/generated/protocol.ts +0 -22014
  171. package/lib/front_end/models/bindings/CSSWorkspaceBinding.ts +0 -318
  172. package/lib/front_end/models/bindings/CompilerScriptMapping.ts +0 -536
  173. package/lib/front_end/models/bindings/ContentProviderBasedProject.ts +0 -187
  174. package/lib/front_end/models/bindings/DebuggerLanguagePlugins.ts +0 -1197
  175. package/lib/front_end/models/bindings/DebuggerWorkspaceBinding.ts +0 -733
  176. package/lib/front_end/models/bindings/DefaultScriptMapping.ts +0 -141
  177. package/lib/front_end/models/bindings/FileUtils.ts +0 -228
  178. package/lib/front_end/models/bindings/LiveLocation.ts +0 -81
  179. package/lib/front_end/models/bindings/NetworkProject.ts +0 -157
  180. package/lib/front_end/models/bindings/PresentationConsoleMessageHelper.ts +0 -312
  181. package/lib/front_end/models/bindings/ResourceMapping.ts +0 -539
  182. package/lib/front_end/models/bindings/ResourceScriptMapping.ts +0 -491
  183. package/lib/front_end/models/bindings/ResourceUtils.ts +0 -103
  184. package/lib/front_end/models/bindings/SASSSourceMapping.ts +0 -222
  185. package/lib/front_end/models/bindings/StylesSourceMapping.ts +0 -316
  186. package/lib/front_end/models/bindings/TempFile.ts +0 -67
  187. package/lib/front_end/models/bindings/bindings.ts +0 -39
  188. package/lib/front_end/models/cpu_profile/CPUProfileDataModel.ts +0 -571
  189. package/lib/front_end/models/cpu_profile/ProfileTreeModel.ts +0 -103
  190. package/lib/front_end/models/cpu_profile/cpu_profile.ts +0 -11
  191. package/lib/front_end/models/formatter/FormatterWorkerPool.ts +0 -219
  192. package/lib/front_end/models/formatter/ScriptFormatter.ts +0 -112
  193. package/lib/front_end/models/formatter/formatter.ts +0 -8
  194. package/lib/front_end/models/source_map_scopes/NamesResolver.ts +0 -765
  195. package/lib/front_end/models/source_map_scopes/ScopeChainModel.ts +0 -84
  196. package/lib/front_end/models/source_map_scopes/source_map_scopes.ts +0 -11
  197. package/lib/front_end/models/stack_trace/StackTrace.ts +0 -53
  198. package/lib/front_end/models/stack_trace/StackTraceImpl.ts +0 -85
  199. package/lib/front_end/models/stack_trace/StackTraceModel.ts +0 -128
  200. package/lib/front_end/models/stack_trace/Trie.ts +0 -163
  201. package/lib/front_end/models/stack_trace/stack_trace.ts +0 -9
  202. package/lib/front_end/models/stack_trace/stack_trace_impl.ts +0 -13
  203. package/lib/front_end/models/text_utils/CodeMirrorUtils.ts +0 -37
  204. package/lib/front_end/models/text_utils/ContentData.ts +0 -199
  205. package/lib/front_end/models/text_utils/ContentProvider.ts +0 -68
  206. package/lib/front_end/models/text_utils/StaticContentProvider.ts +0 -49
  207. package/lib/front_end/models/text_utils/StreamingContentData.ts +0 -108
  208. package/lib/front_end/models/text_utils/Text.ts +0 -90
  209. package/lib/front_end/models/text_utils/TextCursor.ts +0 -44
  210. package/lib/front_end/models/text_utils/TextRange.ts +0 -266
  211. package/lib/front_end/models/text_utils/TextUtils.ts +0 -401
  212. package/lib/front_end/models/text_utils/WasmDisassembly.ts +0 -87
  213. package/lib/front_end/models/text_utils/text_utils.ts +0 -27
  214. package/lib/front_end/models/trace/EntityMapper.ts +0 -141
  215. package/lib/front_end/models/trace/EventsSerializer.ts +0 -101
  216. package/lib/front_end/models/trace/LanternComputationData.ts +0 -438
  217. package/lib/front_end/models/trace/ModelImpl.ts +0 -236
  218. package/lib/front_end/models/trace/Name.ts +0 -136
  219. package/lib/front_end/models/trace/Processor.ts +0 -652
  220. package/lib/front_end/models/trace/Styles.ts +0 -1138
  221. package/lib/front_end/models/trace/extras/FilmStrip.ts +0 -78
  222. package/lib/front_end/models/trace/extras/MainThreadActivity.ts +0 -86
  223. package/lib/front_end/models/trace/extras/ScriptDuplication.ts +0 -236
  224. package/lib/front_end/models/trace/extras/StackTraceForEvent.ts +0 -203
  225. package/lib/front_end/models/trace/extras/ThirdParties.ts +0 -164
  226. package/lib/front_end/models/trace/extras/TraceFilter.ts +0 -62
  227. package/lib/front_end/models/trace/extras/TraceTree.ts +0 -701
  228. package/lib/front_end/models/trace/extras/extras.ts +0 -11
  229. package/lib/front_end/models/trace/handlers/AnimationFramesHandler.ts +0 -128
  230. package/lib/front_end/models/trace/handlers/AnimationHandler.ts +0 -36
  231. package/lib/front_end/models/trace/handlers/AsyncJSCallsHandler.ts +0 -239
  232. package/lib/front_end/models/trace/handlers/AuctionWorkletsHandler.ts +0 -183
  233. package/lib/front_end/models/trace/handlers/DOMStatsHandler.ts +0 -31
  234. package/lib/front_end/models/trace/handlers/ExtensionTraceDataHandler.ts +0 -306
  235. package/lib/front_end/models/trace/handlers/FlowsHandler.ts +0 -175
  236. package/lib/front_end/models/trace/handlers/FramesHandler.ts +0 -571
  237. package/lib/front_end/models/trace/handlers/GPUHandler.ts +0 -50
  238. package/lib/front_end/models/trace/handlers/ImagePaintingHandler.ts +0 -183
  239. package/lib/front_end/models/trace/handlers/InitiatorsHandler.ts +0 -193
  240. package/lib/front_end/models/trace/handlers/InvalidationsHandler.ts +0 -168
  241. package/lib/front_end/models/trace/handlers/LargestImagePaintHandler.ts +0 -109
  242. package/lib/front_end/models/trace/handlers/LargestTextPaintHandler.ts +0 -35
  243. package/lib/front_end/models/trace/handlers/LayerTreeHandler.ts +0 -123
  244. package/lib/front_end/models/trace/handlers/LayoutShiftsHandler.ts +0 -573
  245. package/lib/front_end/models/trace/handlers/MemoryHandler.ts +0 -31
  246. package/lib/front_end/models/trace/handlers/MetaHandler.ts +0 -525
  247. package/lib/front_end/models/trace/handlers/ModelHandlers.ts +0 -34
  248. package/lib/front_end/models/trace/handlers/NetworkRequestsHandler.ts +0 -672
  249. package/lib/front_end/models/trace/handlers/PageFramesHandler.ts +0 -52
  250. package/lib/front_end/models/trace/handlers/PageLoadMetricsHandler.ts +0 -460
  251. package/lib/front_end/models/trace/handlers/RendererHandler.ts +0 -428
  252. package/lib/front_end/models/trace/handlers/SamplesHandler.ts +0 -271
  253. package/lib/front_end/models/trace/handlers/ScreenshotsHandler.ts +0 -122
  254. package/lib/front_end/models/trace/handlers/ScriptsHandler.ts +0 -336
  255. package/lib/front_end/models/trace/handlers/SelectorStatsHandler.ts +0 -110
  256. package/lib/front_end/models/trace/handlers/Threads.ts +0 -139
  257. package/lib/front_end/models/trace/handlers/UserInteractionsHandler.ts +0 -400
  258. package/lib/front_end/models/trace/handlers/UserTimingsHandler.ts +0 -233
  259. package/lib/front_end/models/trace/handlers/WarningsHandler.ts +0 -162
  260. package/lib/front_end/models/trace/handlers/WorkersHandler.ts +0 -45
  261. package/lib/front_end/models/trace/handlers/handlers.ts +0 -8
  262. package/lib/front_end/models/trace/handlers/helpers.ts +0 -196
  263. package/lib/front_end/models/trace/handlers/types.ts +0 -75
  264. package/lib/front_end/models/trace/helpers/Extensions.ts +0 -54
  265. package/lib/front_end/models/trace/helpers/Network.ts +0 -129
  266. package/lib/front_end/models/trace/helpers/SamplesIntegrator.ts +0 -544
  267. package/lib/front_end/models/trace/helpers/SyntheticEvents.ts +0 -87
  268. package/lib/front_end/models/trace/helpers/Timing.ts +0 -248
  269. package/lib/front_end/models/trace/helpers/Trace.ts +0 -928
  270. package/lib/front_end/models/trace/helpers/TreeHelpers.ts +0 -320
  271. package/lib/front_end/models/trace/helpers/helpers.ts +0 -11
  272. package/lib/front_end/models/trace/insights/CLSCulprits.ts +0 -668
  273. package/lib/front_end/models/trace/insights/Cache.ts +0 -269
  274. package/lib/front_end/models/trace/insights/Common.ts +0 -453
  275. package/lib/front_end/models/trace/insights/DOMSize.ts +0 -223
  276. package/lib/front_end/models/trace/insights/DocumentLatency.ts +0 -319
  277. package/lib/front_end/models/trace/insights/DuplicatedJavaScript.ts +0 -126
  278. package/lib/front_end/models/trace/insights/FontDisplay.ts +0 -119
  279. package/lib/front_end/models/trace/insights/ForcedReflow.ts +0 -220
  280. package/lib/front_end/models/trace/insights/INPBreakdown.ts +0 -171
  281. package/lib/front_end/models/trace/insights/ImageDelivery.ts +0 -348
  282. package/lib/front_end/models/trace/insights/LCPBreakdown.ts +0 -268
  283. package/lib/front_end/models/trace/insights/LCPDiscovery.ts +0 -237
  284. package/lib/front_end/models/trace/insights/LegacyJavaScript.ts +0 -138
  285. package/lib/front_end/models/trace/insights/Models.ts +0 -22
  286. package/lib/front_end/models/trace/insights/ModernHTTP.ts +0 -257
  287. package/lib/front_end/models/trace/insights/NetworkDependencyTree.ts +0 -726
  288. package/lib/front_end/models/trace/insights/RenderBlocking.ts +0 -257
  289. package/lib/front_end/models/trace/insights/SlowCSSSelector.ts +0 -175
  290. package/lib/front_end/models/trace/insights/Statistics.ts +0 -101
  291. package/lib/front_end/models/trace/insights/ThirdParties.ts +0 -130
  292. package/lib/front_end/models/trace/insights/Viewport.ts +0 -138
  293. package/lib/front_end/models/trace/insights/insights.ts +0 -10
  294. package/lib/front_end/models/trace/insights/types.ts +0 -157
  295. package/lib/front_end/models/trace/lantern/core/LanternError.ts +0 -7
  296. package/lib/front_end/models/trace/lantern/core/NetworkAnalyzer.ts +0 -619
  297. package/lib/front_end/models/trace/lantern/core/core.ts +0 -6
  298. package/lib/front_end/models/trace/lantern/graph/BaseNode.ts +0 -345
  299. package/lib/front_end/models/trace/lantern/graph/CPUNode.ts +0 -80
  300. package/lib/front_end/models/trace/lantern/graph/NetworkNode.ts +0 -101
  301. package/lib/front_end/models/trace/lantern/graph/PageDependencyGraph.ts +0 -636
  302. package/lib/front_end/models/trace/lantern/graph/graph.ts +0 -8
  303. package/lib/front_end/models/trace/lantern/lantern.ts +0 -17
  304. package/lib/front_end/models/trace/lantern/metrics/FirstContentfulPaint.ts +0 -187
  305. package/lib/front_end/models/trace/lantern/metrics/Interactive.ts +0 -88
  306. package/lib/front_end/models/trace/lantern/metrics/LargestContentfulPaint.ts +0 -92
  307. package/lib/front_end/models/trace/lantern/metrics/MaxPotentialFID.ts +0 -72
  308. package/lib/front_end/models/trace/lantern/metrics/Metric.ts +0 -126
  309. package/lib/front_end/models/trace/lantern/metrics/SpeedIndex.ts +0 -126
  310. package/lib/front_end/models/trace/lantern/metrics/TBTUtils.ts +0 -82
  311. package/lib/front_end/models/trace/lantern/metrics/TotalBlockingTime.ts +0 -112
  312. package/lib/front_end/models/trace/lantern/metrics/metrics.ts +0 -12
  313. package/lib/front_end/models/trace/lantern/simulation/ConnectionPool.ts +0 -150
  314. package/lib/front_end/models/trace/lantern/simulation/Constants.ts +0 -46
  315. package/lib/front_end/models/trace/lantern/simulation/DNSCache.ts +0 -61
  316. package/lib/front_end/models/trace/lantern/simulation/SimulationTimingMap.ts +0 -196
  317. package/lib/front_end/models/trace/lantern/simulation/Simulator.ts +0 -556
  318. package/lib/front_end/models/trace/lantern/simulation/TCPConnection.ts +0 -192
  319. package/lib/front_end/models/trace/lantern/simulation/simulation.ts +0 -10
  320. package/lib/front_end/models/trace/lantern/types/Lantern.ts +0 -220
  321. package/lib/front_end/models/trace/lantern/types/types.ts +0 -5
  322. package/lib/front_end/models/trace/trace.ts +0 -33
  323. package/lib/front_end/models/trace/types/Configuration.ts +0 -110
  324. package/lib/front_end/models/trace/types/Extensions.ts +0 -136
  325. package/lib/front_end/models/trace/types/File.ts +0 -281
  326. package/lib/front_end/models/trace/types/Overlays.ts +0 -138
  327. package/lib/front_end/models/trace/types/Timing.ts +0 -30
  328. package/lib/front_end/models/trace/types/TraceEvents.ts +0 -3277
  329. package/lib/front_end/models/trace/types/types.ts +0 -10
  330. package/lib/front_end/models/trace_source_maps_resolver/SourceMapsResolver.ts +0 -240
  331. package/lib/front_end/models/trace_source_maps_resolver/trace_source_maps_resolver.ts +0 -5
  332. package/lib/front_end/models/workspace/FileManager.ts +0 -97
  333. package/lib/front_end/models/workspace/IgnoreListManager.ts +0 -628
  334. package/lib/front_end/models/workspace/SearchConfig.ts +0 -149
  335. package/lib/front_end/models/workspace/UISourceCode.ts +0 -698
  336. package/lib/front_end/models/workspace/WorkspaceImpl.ts +0 -339
  337. package/lib/front_end/models/workspace/workspace.ts +0 -17
  338. package/lib/front_end/panels/timeline/TimelineUIUtils.ts +0 -1029
  339. package/lib/front_end/panels/timeline/extensions/ExtensionUI.ts +0 -49
  340. package/lib/front_end/panels/timeline/extensions/extensions.ts +0 -9
  341. package/lib/front_end/third_party/codemirror.next/LICENSE +0 -21
  342. package/lib/front_end/third_party/codemirror.next/README.chromium +0 -30
  343. package/lib/front_end/third_party/codemirror.next/bundle-tsconfig.json +0 -24
  344. package/lib/front_end/third_party/codemirror.next/bundle.ts +0 -135
  345. package/lib/front_end/third_party/codemirror.next/chunk/angular.js +0 -2
  346. package/lib/front_end/third_party/codemirror.next/chunk/angular.js.map +0 -1
  347. package/lib/front_end/third_party/codemirror.next/chunk/codemirror.js +0 -2
  348. package/lib/front_end/third_party/codemirror.next/chunk/codemirror.js.map +0 -1
  349. package/lib/front_end/third_party/codemirror.next/chunk/cpp.js +0 -2
  350. package/lib/front_end/third_party/codemirror.next/chunk/cpp.js.map +0 -1
  351. package/lib/front_end/third_party/codemirror.next/chunk/css.js +0 -2
  352. package/lib/front_end/third_party/codemirror.next/chunk/html.js +0 -4
  353. package/lib/front_end/third_party/codemirror.next/chunk/java.js +0 -2
  354. package/lib/front_end/third_party/codemirror.next/chunk/java.js.map +0 -1
  355. package/lib/front_end/third_party/codemirror.next/chunk/javascript.js +0 -2
  356. package/lib/front_end/third_party/codemirror.next/chunk/legacy.js +0 -2
  357. package/lib/front_end/third_party/codemirror.next/chunk/legacy.js.map +0 -1
  358. package/lib/front_end/third_party/codemirror.next/chunk/less.js +0 -2
  359. package/lib/front_end/third_party/codemirror.next/chunk/less.js.map +0 -1
  360. package/lib/front_end/third_party/codemirror.next/chunk/markdown.js +0 -2
  361. package/lib/front_end/third_party/codemirror.next/chunk/markdown.js.map +0 -1
  362. package/lib/front_end/third_party/codemirror.next/chunk/php.js +0 -2
  363. package/lib/front_end/third_party/codemirror.next/chunk/php.js.map +0 -1
  364. package/lib/front_end/third_party/codemirror.next/chunk/python.js +0 -2
  365. package/lib/front_end/third_party/codemirror.next/chunk/python.js.map +0 -1
  366. package/lib/front_end/third_party/codemirror.next/chunk/sass.js +0 -2
  367. package/lib/front_end/third_party/codemirror.next/chunk/sass.js.map +0 -1
  368. package/lib/front_end/third_party/codemirror.next/chunk/svelte.js +0 -2
  369. package/lib/front_end/third_party/codemirror.next/chunk/svelte.js.map +0 -1
  370. package/lib/front_end/third_party/codemirror.next/chunk/vue.js +0 -2
  371. package/lib/front_end/third_party/codemirror.next/chunk/vue.js.map +0 -1
  372. package/lib/front_end/third_party/codemirror.next/chunk/wast.js +0 -2
  373. package/lib/front_end/third_party/codemirror.next/chunk/wast.js.map +0 -1
  374. package/lib/front_end/third_party/codemirror.next/chunk/xml.js +0 -2
  375. package/lib/front_end/third_party/codemirror.next/chunk/xml.js.map +0 -1
  376. package/lib/front_end/third_party/codemirror.next/codemirror.next.d.ts +0 -8057
  377. package/lib/front_end/third_party/codemirror.next/codemirror.next.js +0 -2
  378. package/lib/front_end/third_party/codemirror.next/codemirror.next.js.map +0 -1
  379. package/lib/front_end/third_party/codemirror.next/package.json +0 -43
  380. package/lib/front_end/third_party/codemirror.next/rebuild.sh +0 -6
  381. package/lib/front_end/third_party/codemirror.next/rollup.config.mjs +0 -49
  382. package/lib/front_end/third_party/i18n/LICENSE +0 -202
  383. package/lib/front_end/third_party/i18n/README.chromium +0 -15
  384. package/lib/front_end/third_party/i18n/i18n-impl.ts +0 -61
  385. package/lib/front_end/third_party/i18n/i18n.ts +0 -11
  386. package/lib/front_end/third_party/i18n/localized-string-set.ts +0 -129
  387. package/lib/front_end/third_party/intl-messageformat/LICENSE +0 -33
  388. package/lib/front_end/third_party/intl-messageformat/README.chromium +0 -24
  389. package/lib/front_end/third_party/intl-messageformat/intl-messageformat-tsconfig.json +0 -16
  390. package/lib/front_end/third_party/intl-messageformat/intl-messageformat.ts +0 -6
  391. package/lib/front_end/third_party/intl-messageformat/package/LICENSE.md +0 -33
  392. package/lib/front_end/third_party/intl-messageformat/package/README.md +0 -3
  393. package/lib/front_end/third_party/intl-messageformat/package/index.d.ts +0 -6
  394. package/lib/front_end/third_party/intl-messageformat/package/index.d.ts.map +0 -1
  395. package/lib/front_end/third_party/intl-messageformat/package/index.js +0 -13
  396. package/lib/front_end/third_party/intl-messageformat/package/intl-messageformat.esm.d.ts +0 -5
  397. package/lib/front_end/third_party/intl-messageformat/package/intl-messageformat.esm.js +0 -1710
  398. package/lib/front_end/third_party/intl-messageformat/package/intl-messageformat.iife.js +0 -1815
  399. package/lib/front_end/third_party/intl-messageformat/package/lib/index.d.ts +0 -6
  400. package/lib/front_end/third_party/intl-messageformat/package/lib/index.d.ts.map +0 -1
  401. package/lib/front_end/third_party/intl-messageformat/package/lib/index.js +0 -10
  402. package/lib/front_end/third_party/intl-messageformat/package/lib/src/core.d.ts +0 -34
  403. package/lib/front_end/third_party/intl-messageformat/package/lib/src/core.d.ts.map +0 -1
  404. package/lib/front_end/third_party/intl-messageformat/package/lib/src/core.js +0 -229
  405. package/lib/front_end/third_party/intl-messageformat/package/lib/src/error.d.ts +0 -28
  406. package/lib/front_end/third_party/intl-messageformat/package/lib/src/error.d.ts.map +0 -1
  407. package/lib/front_end/third_party/intl-messageformat/package/lib/src/error.js +0 -48
  408. package/lib/front_end/third_party/intl-messageformat/package/lib/src/formatters.d.ts +0 -34
  409. package/lib/front_end/third_party/intl-messageformat/package/lib/src/formatters.d.ts.map +0 -1
  410. package/lib/front_end/third_party/intl-messageformat/package/lib/src/formatters.js +0 -179
  411. package/lib/front_end/third_party/intl-messageformat/package/package.json +0 -42
  412. package/lib/front_end/third_party/intl-messageformat/package/src/core.d.ts +0 -34
  413. package/lib/front_end/third_party/intl-messageformat/package/src/core.d.ts.map +0 -1
  414. package/lib/front_end/third_party/intl-messageformat/package/src/core.js +0 -230
  415. package/lib/front_end/third_party/intl-messageformat/package/src/error.d.ts +0 -28
  416. package/lib/front_end/third_party/intl-messageformat/package/src/error.d.ts.map +0 -1
  417. package/lib/front_end/third_party/intl-messageformat/package/src/error.js +0 -51
  418. package/lib/front_end/third_party/intl-messageformat/package/src/formatters.d.ts +0 -34
  419. package/lib/front_end/third_party/intl-messageformat/package/src/formatters.d.ts.map +0 -1
  420. package/lib/front_end/third_party/intl-messageformat/package/src/formatters.js +0 -182
  421. package/lib/front_end/third_party/intl-messageformat/package/src/icu-messageformat-parser/error.d.ts +0 -79
  422. package/lib/front_end/third_party/intl-messageformat/package/src/icu-messageformat-parser/index.d.ts +0 -15
  423. package/lib/front_end/third_party/intl-messageformat/package/src/icu-messageformat-parser/parser.d.ts +0 -153
  424. package/lib/front_end/third_party/intl-messageformat/package/src/icu-messageformat-parser/types.d.ts +0 -139
  425. package/lib/front_end/third_party/legacy-javascript/LICENSE +0 -202
  426. package/lib/front_end/third_party/legacy-javascript/README.chromium +0 -13
  427. package/lib/front_end/third_party/legacy-javascript/legacy-javascript-tsconfig.json +0 -8
  428. package/lib/front_end/third_party/legacy-javascript/legacy-javascript.ts +0 -3
  429. package/lib/front_end/third_party/legacy-javascript/lib/legacy-javascript.d.ts +0 -18
  430. package/lib/front_end/third_party/legacy-javascript/lib/legacy-javascript.js +0 -943
  431. package/lib/front_end/third_party/legacy-javascript/package.json +0 -8
  432. package/lib/front_end/third_party/legacy-javascript/rebuild.sh +0 -9
  433. package/lib/front_end/third_party/source-map-scopes-codec/LICENSE +0 -26
  434. package/lib/front_end/third_party/source-map-scopes-codec/README.chromium +0 -31
  435. package/lib/front_end/third_party/source-map-scopes-codec/package/CONTRIBUTING.md +0 -33
  436. package/lib/front_end/third_party/source-map-scopes-codec/package/LICENSE +0 -26
  437. package/lib/front_end/third_party/source-map-scopes-codec/package/README.md +0 -64
  438. package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/builder/builder.d.ts +0 -62
  439. package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/builder/builder.d.ts.map +0 -1
  440. package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/builder/safe_builder.d.ts +0 -37
  441. package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/builder/safe_builder.d.ts.map +0 -1
  442. package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/decode/decode.d.ts +0 -29
  443. package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/decode/decode.d.ts.map +0 -1
  444. package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/encode/encode.d.ts +0 -8
  445. package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/encode/encode.d.ts.map +0 -1
  446. package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/mod.d.ts +0 -6
  447. package/lib/front_end/third_party/source-map-scopes-codec/package/_dist/src/mod.d.ts.map +0 -1
  448. package/lib/front_end/third_party/source-map-scopes-codec/package/deno.json +0 -21
  449. package/lib/front_end/third_party/source-map-scopes-codec/package/package.json +0 -14
  450. package/lib/front_end/third_party/source-map-scopes-codec/package/src/builder/builder.js +0 -196
  451. package/lib/front_end/third_party/source-map-scopes-codec/package/src/builder/builder.js.map +0 -1
  452. package/lib/front_end/third_party/source-map-scopes-codec/package/src/builder/builder.ts +0 -262
  453. package/lib/front_end/third_party/source-map-scopes-codec/package/src/builder/safe_builder.js +0 -235
  454. package/lib/front_end/third_party/source-map-scopes-codec/package/src/builder/safe_builder.js.map +0 -1
  455. package/lib/front_end/third_party/source-map-scopes-codec/package/src/builder/safe_builder.ts +0 -359
  456. package/lib/front_end/third_party/source-map-scopes-codec/package/src/codec.js +0 -39
  457. package/lib/front_end/third_party/source-map-scopes-codec/package/src/codec.js.map +0 -1
  458. package/lib/front_end/third_party/source-map-scopes-codec/package/src/codec.ts +0 -53
  459. package/lib/front_end/third_party/source-map-scopes-codec/package/src/decode/decode.js +0 -438
  460. package/lib/front_end/third_party/source-map-scopes-codec/package/src/decode/decode.js.map +0 -1
  461. package/lib/front_end/third_party/source-map-scopes-codec/package/src/decode/decode.ts +0 -539
  462. package/lib/front_end/third_party/source-map-scopes-codec/package/src/encode/encode.js +0 -23
  463. package/lib/front_end/third_party/source-map-scopes-codec/package/src/encode/encode.js.map +0 -1
  464. package/lib/front_end/third_party/source-map-scopes-codec/package/src/encode/encode.ts +0 -35
  465. package/lib/front_end/third_party/source-map-scopes-codec/package/src/encode/encoder.js +0 -257
  466. package/lib/front_end/third_party/source-map-scopes-codec/package/src/encode/encoder.js.map +0 -1
  467. package/lib/front_end/third_party/source-map-scopes-codec/package/src/encode/encoder.ts +0 -348
  468. package/lib/front_end/third_party/source-map-scopes-codec/package/src/mod.js +0 -8
  469. package/lib/front_end/third_party/source-map-scopes-codec/package/src/mod.js.map +0 -1
  470. package/lib/front_end/third_party/source-map-scopes-codec/package/src/mod.ts +0 -20
  471. package/lib/front_end/third_party/source-map-scopes-codec/package/src/scopes-tsconfig.json +0 -8
  472. package/lib/front_end/third_party/source-map-scopes-codec/package/src/scopes.d.ts +0 -184
  473. package/lib/front_end/third_party/source-map-scopes-codec/package/src/util.js +0 -9
  474. package/lib/front_end/third_party/source-map-scopes-codec/package/src/util.js.map +0 -1
  475. package/lib/front_end/third_party/source-map-scopes-codec/package/src/util.ts +0 -12
  476. package/lib/front_end/third_party/source-map-scopes-codec/package/src/vlq.js +0 -82
  477. package/lib/front_end/third_party/source-map-scopes-codec/package/src/vlq.js.map +0 -1
  478. package/lib/front_end/third_party/source-map-scopes-codec/package/src/vlq.ts +0 -99
  479. package/lib/front_end/third_party/source-map-scopes-codec/source-map-scopes-codec.ts +0 -5
  480. package/lib/front_end/third_party/third-party-web/LICENSE +0 -20
  481. package/lib/front_end/third_party/third-party-web/README.chromium +0 -13
  482. package/lib/front_end/third_party/third-party-web/lib/nostats-subset.d.ts +0 -2
  483. package/lib/front_end/third_party/third-party-web/lib/nostats-subset.js +0 -149
  484. package/lib/front_end/third_party/third-party-web/package/LICENSE +0 -20
  485. package/lib/front_end/third_party/third-party-web/package/README.md +0 -929
  486. package/lib/front_end/third_party/third-party-web/package/dist/entities-httparchive-nostats.json +0 -1
  487. package/lib/front_end/third_party/third-party-web/package/dist/entities-httparchive.json +0 -1
  488. package/lib/front_end/third_party/third-party-web/package/dist/entities-nostats.json +0 -1
  489. package/lib/front_end/third_party/third-party-web/package/dist/entities.json +0 -1
  490. package/lib/front_end/third_party/third-party-web/package/facades.md +0 -46
  491. package/lib/front_end/third_party/third-party-web/package/httparchive-nostats-subset.d.ts +0 -1
  492. package/lib/front_end/third_party/third-party-web/package/httparchive-nostats-subset.js +0 -1
  493. package/lib/front_end/third_party/third-party-web/package/httparchive-subset.d.ts +0 -1
  494. package/lib/front_end/third_party/third-party-web/package/httparchive-subset.js +0 -1
  495. package/lib/front_end/third_party/third-party-web/package/lib/__snapshots__/index.test.js.snap +0 -1006
  496. package/lib/front_end/third_party/third-party-web/package/lib/create-entity-finder-api.js +0 -139
  497. package/lib/front_end/third_party/third-party-web/package/lib/create-entity-finder-api.test.js +0 -44
  498. package/lib/front_end/third_party/third-party-web/package/lib/entities.test.js +0 -27
  499. package/lib/front_end/third_party/third-party-web/package/lib/index.d.ts +0 -34
  500. package/lib/front_end/third_party/third-party-web/package/lib/index.js +0 -3
  501. package/lib/front_end/third_party/third-party-web/package/lib/index.test.js +0 -246
  502. package/lib/front_end/third_party/third-party-web/package/lib/markdown/faqs.partial.md +0 -36
  503. package/lib/front_end/third_party/third-party-web/package/lib/markdown/goals.partial.md +0 -9
  504. package/lib/front_end/third_party/third-party-web/package/lib/markdown/methodology.partial.md +0 -5
  505. package/lib/front_end/third_party/third-party-web/package/lib/markdown/template.md +0 -151
  506. package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2019-02-01.md +0 -1
  507. package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2019-03-01.md +0 -1
  508. package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2019-05-06.md +0 -1
  509. package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2019-05-13.md +0 -14
  510. package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2021-01-01.md +0 -1
  511. package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2024-07-01.md +0 -3
  512. package/lib/front_end/third_party/third-party-web/package/lib/subsets/httparchive-nostats.d.ts +0 -1
  513. package/lib/front_end/third_party/third-party-web/package/lib/subsets/httparchive-nostats.js +0 -3
  514. package/lib/front_end/third_party/third-party-web/package/lib/subsets/httparchive.d.ts +0 -1
  515. package/lib/front_end/third_party/third-party-web/package/lib/subsets/httparchive.js +0 -3
  516. package/lib/front_end/third_party/third-party-web/package/lib/subsets/nostats.d.ts +0 -1
  517. package/lib/front_end/third_party/third-party-web/package/lib/subsets/nostats.js +0 -3
  518. package/lib/front_end/third_party/third-party-web/package/nostats-subset.d.ts +0 -1
  519. package/lib/front_end/third_party/third-party-web/package/nostats-subset.js +0 -1
  520. package/lib/front_end/third_party/third-party-web/package/package.json +0 -46
  521. package/lib/front_end/third_party/third-party-web/package.json +0 -8
  522. package/lib/front_end/third_party/third-party-web/rebuild.sh +0 -13
  523. package/lib/front_end/third_party/third-party-web/third-party-web-tsconfig.json +0 -8
  524. package/lib/front_end/third_party/third-party-web/third-party-web.ts +0 -3
  525. package/lib/front_end/ui/legacy/theme_support/ThemeSupport.ts +0 -222
  526. package/lib/front_end/ui/legacy/theme_support/theme_support.ts +0 -5
  527. package/patches/chrome-devtools-frontend+1.0.1533544.patch +0 -1716
@@ -1,1041 +0,0 @@
1
- // Copyright 2014 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 * as Common from '../../core/common/common.js';
6
- import type * as ProtocolProxyApi from '../../generated/protocol-proxy-api.js';
7
- import * as Protocol from '../../generated/protocol.js';
8
-
9
- import {DeferredDOMNode, type DOMNode} from './DOMModel.js';
10
- import {RemoteObject} from './RemoteObject.js';
11
- import {Events as ResourceTreeModelEvents, ResourceTreeModel} from './ResourceTreeModel.js';
12
- import {Events as RuntimeModelEvents, type EventTypes as RuntimeModelEventTypes, RuntimeModel} from './RuntimeModel.js';
13
- import {SDKModel} from './SDKModel.js';
14
- import {Capability, type Target} from './Target.js';
15
-
16
- const DEVTOOLS_ANIMATIONS_WORLD_NAME = 'devtools_animations';
17
- const REPORT_SCROLL_POSITION_BINDING_NAME = '__devtools_report_scroll_position__';
18
-
19
- const getScrollListenerNameInPage = (id: number): string => `__devtools_scroll_listener_${id}__`;
20
-
21
- type ScrollListener = (param: {scrollLeft: number, scrollTop: number}) => void;
22
- type BindingListener =
23
- (ev: Common.EventTarget.EventTargetEvent<Protocol.Runtime.BindingCalledEvent, RuntimeModelEventTypes>) => void;
24
-
25
- async function resolveToObjectInWorld(domNode: DOMNode, worldName: string): Promise<RemoteObject|null> {
26
- const resourceTreeModel = domNode.domModel().target().model(ResourceTreeModel) as ResourceTreeModel;
27
- const pageAgent = domNode.domModel().target().pageAgent();
28
- for (const frame of resourceTreeModel.frames()) {
29
- // This returns previously created world if it exists for the frame.
30
- const {executionContextId} = await pageAgent.invoke_createIsolatedWorld({frameId: frame.id, worldName});
31
- const object = await domNode.resolveToObject(undefined, executionContextId);
32
- if (object) {
33
- return object;
34
- }
35
- }
36
- return null;
37
- }
38
-
39
- /**
40
- * Provides an extension over `DOMNode` that gives it additional
41
- * capabilities for animation debugging, mainly:
42
- * - getting a node's scroll information (scroll offsets and scroll range).
43
- * - updating a node's scroll offset.
44
- * - tracking the node's scroll offsets with event listeners.
45
- *
46
- * It works by running functions on the target page, see `DOMNode`s `callFunction` method
47
- * for more details on how a function is called on the target page.
48
- *
49
- * For listening to events on the target page and getting notified on the devtools frontend
50
- * side, we're adding a binding to the page `__devtools_report_scroll_position__` in a world `devtools_animation`
51
- * we've created. Then, we're setting scroll listeners of the `node` in the same world which calls the binding
52
- * itself with the scroll offsets.
53
- */
54
- export class AnimationDOMNode {
55
- #domNode: DOMNode;
56
- #scrollListenersById = new Map<number, ScrollListener>();
57
- #scrollBindingListener?: BindingListener;
58
-
59
- static lastAddedListenerId = 0;
60
-
61
- constructor(domNode: DOMNode) {
62
- this.#domNode = domNode;
63
- }
64
-
65
- async #addReportScrollPositionBinding(): Promise<void> {
66
- // The binding is already added so we don't need to add it again.
67
- if (this.#scrollBindingListener) {
68
- return;
69
- }
70
-
71
- this.#scrollBindingListener = ev => {
72
- const {name, payload} = ev.data;
73
- if (name !== REPORT_SCROLL_POSITION_BINDING_NAME) {
74
- return;
75
- }
76
-
77
- const {scrollTop, scrollLeft, id} = JSON.parse(payload) as {scrollTop: number, scrollLeft: number, id: number};
78
- const scrollListener = this.#scrollListenersById.get(id);
79
- if (!scrollListener) {
80
- return;
81
- }
82
-
83
- scrollListener({scrollTop, scrollLeft});
84
- };
85
-
86
- const runtimeModel = this.#domNode.domModel().target().model(RuntimeModel) as RuntimeModel;
87
- await runtimeModel.addBinding({
88
- name: REPORT_SCROLL_POSITION_BINDING_NAME,
89
- executionContextName: DEVTOOLS_ANIMATIONS_WORLD_NAME,
90
- });
91
- runtimeModel.addEventListener(RuntimeModelEvents.BindingCalled, this.#scrollBindingListener);
92
- }
93
-
94
- async #removeReportScrollPositionBinding(): Promise<void> {
95
- // There isn't any binding added yet.
96
- if (!this.#scrollBindingListener) {
97
- return;
98
- }
99
-
100
- const runtimeModel = this.#domNode.domModel().target().model(RuntimeModel) as RuntimeModel;
101
- await runtimeModel.removeBinding({
102
- name: REPORT_SCROLL_POSITION_BINDING_NAME,
103
- });
104
- runtimeModel.removeEventListener(RuntimeModelEvents.BindingCalled, this.#scrollBindingListener);
105
- this.#scrollBindingListener = undefined;
106
- }
107
-
108
- async addScrollEventListener(onScroll: ({scrollLeft, scrollTop}: {scrollLeft: number, scrollTop: number}) => void):
109
- Promise<number|null> {
110
- AnimationDOMNode.lastAddedListenerId++;
111
- const id = AnimationDOMNode.lastAddedListenerId;
112
- this.#scrollListenersById.set(id, onScroll);
113
- // Add the binding for reporting scroll events from the page if it doesn't exist.
114
- if (!this.#scrollBindingListener) {
115
- await this.#addReportScrollPositionBinding();
116
- }
117
-
118
- const object = await resolveToObjectInWorld(this.#domNode, DEVTOOLS_ANIMATIONS_WORLD_NAME);
119
- if (!object) {
120
- return null;
121
- }
122
-
123
- await object.callFunction(scrollListenerInPage, [
124
- id,
125
- REPORT_SCROLL_POSITION_BINDING_NAME,
126
- getScrollListenerNameInPage(id),
127
- ].map(arg => RemoteObject.toCallArgument(arg)));
128
- object.release();
129
- return id;
130
-
131
- function scrollListenerInPage(
132
- this: HTMLElement|Document, id: number, reportScrollPositionBindingName: string,
133
- scrollListenerNameInPage: string): void {
134
- if ('scrollingElement' in this && !this.scrollingElement) {
135
- return;
136
- }
137
-
138
- const scrollingElement = ('scrollingElement' in this ? this.scrollingElement : this) as HTMLElement;
139
- // @ts-expect-error We're setting a custom field on `Element` or `Document` for retaining the function on the page.
140
- this[scrollListenerNameInPage] = () => {
141
- // @ts-expect-error `reportScrollPosition` binding is injected to the page before calling the function.
142
- globalThis[reportScrollPositionBindingName](
143
- JSON.stringify({scrollTop: scrollingElement.scrollTop, scrollLeft: scrollingElement.scrollLeft, id}));
144
- };
145
-
146
- // @ts-expect-error We've already defined the function used below.
147
- this.addEventListener('scroll', this[scrollListenerNameInPage], true);
148
- }
149
- }
150
-
151
- async removeScrollEventListener(id: number): Promise<void> {
152
- const object = await resolveToObjectInWorld(this.#domNode, DEVTOOLS_ANIMATIONS_WORLD_NAME);
153
- if (!object) {
154
- return;
155
- }
156
-
157
- await object.callFunction(
158
- removeScrollListenerInPage, [getScrollListenerNameInPage(id)].map(arg => RemoteObject.toCallArgument(arg)));
159
- object.release();
160
-
161
- this.#scrollListenersById.delete(id);
162
- // There aren't any scroll listeners remained on the page
163
- // so we remove the binding.
164
- if (this.#scrollListenersById.size === 0) {
165
- await this.#removeReportScrollPositionBinding();
166
- }
167
-
168
- function removeScrollListenerInPage(this: HTMLElement|Document, scrollListenerNameInPage: string): void {
169
- // @ts-expect-error We've already set this custom field while adding scroll listener.
170
- this.removeEventListener('scroll', this[scrollListenerNameInPage]);
171
- // @ts-expect-error We've already set this custom field while adding scroll listener.
172
- delete this[scrollListenerNameInPage];
173
- }
174
- }
175
-
176
- async scrollTop(): Promise<number|null> {
177
- return await this.#domNode.callFunction(scrollTopInPage).then(res => res?.value ?? null);
178
-
179
- function scrollTopInPage(this: Element|Document): number {
180
- if ('scrollingElement' in this) {
181
- if (!this.scrollingElement) {
182
- return 0;
183
- }
184
-
185
- return this.scrollingElement.scrollTop;
186
- }
187
- return this.scrollTop;
188
- }
189
- }
190
-
191
- async scrollLeft(): Promise<number|null> {
192
- return await this.#domNode.callFunction(scrollLeftInPage).then(res => res?.value ?? null);
193
-
194
- function scrollLeftInPage(this: Element|Document): number {
195
- if ('scrollingElement' in this) {
196
- if (!this.scrollingElement) {
197
- return 0;
198
- }
199
-
200
- return this.scrollingElement.scrollLeft;
201
- }
202
- return this.scrollLeft;
203
- }
204
- }
205
-
206
- async setScrollTop(offset: number): Promise<void> {
207
- await this.#domNode.callFunction(setScrollTopInPage, [offset]);
208
-
209
- function setScrollTopInPage(this: Element|Document, offsetInPage: number): void {
210
- if ('scrollingElement' in this) {
211
- if (!this.scrollingElement) {
212
- return;
213
- }
214
-
215
- this.scrollingElement.scrollTop = offsetInPage;
216
- } else {
217
- this.scrollTop = offsetInPage;
218
- }
219
- }
220
- }
221
-
222
- async setScrollLeft(offset: number): Promise<void> {
223
- await this.#domNode.callFunction(setScrollLeftInPage, [offset]);
224
-
225
- function setScrollLeftInPage(this: Element|Document, offsetInPage: number): void {
226
- if ('scrollingElement' in this) {
227
- if (!this.scrollingElement) {
228
- return;
229
- }
230
-
231
- this.scrollingElement.scrollLeft = offsetInPage;
232
- } else {
233
- this.scrollLeft = offsetInPage;
234
- }
235
- }
236
- }
237
-
238
- async verticalScrollRange(): Promise<number|null> {
239
- return await this.#domNode.callFunction(verticalScrollRangeInPage).then(res => res?.value ?? null);
240
-
241
- function verticalScrollRangeInPage(this: Element|Document): number {
242
- if ('scrollingElement' in this) {
243
- if (!this.scrollingElement) {
244
- return 0;
245
- }
246
-
247
- return this.scrollingElement.scrollHeight - this.scrollingElement.clientHeight;
248
- }
249
-
250
- return this.scrollHeight - this.clientHeight;
251
- }
252
- }
253
-
254
- async horizontalScrollRange(): Promise<number|null> {
255
- return await this.#domNode.callFunction(horizontalScrollRangeInPage).then(res => res?.value ?? null);
256
-
257
- function horizontalScrollRangeInPage(this: Element|Document): number {
258
- if ('scrollingElement' in this) {
259
- if (!this.scrollingElement) {
260
- return 0;
261
- }
262
-
263
- return this.scrollingElement.scrollWidth - this.scrollingElement.clientWidth;
264
- }
265
-
266
- return this.scrollWidth - this.clientWidth;
267
- }
268
- }
269
- }
270
-
271
- function shouldGroupAnimations(firstAnimation: AnimationImpl, anim: AnimationImpl): boolean {
272
- const firstAnimationTimeline = firstAnimation.viewOrScrollTimeline();
273
- const animationTimeline = anim.viewOrScrollTimeline();
274
- if (firstAnimationTimeline) {
275
- // This is a SDA group so check whether the animation's
276
- // scroll container and scroll axis is the same with the first animation.
277
- return Boolean(
278
- animationTimeline && firstAnimationTimeline.sourceNodeId === animationTimeline.sourceNodeId &&
279
- firstAnimationTimeline.axis === animationTimeline.axis);
280
- }
281
- // This is a non-SDA group so check whether the coming animation
282
- // is a time based one too and if so, compare their start times.
283
- return !animationTimeline && firstAnimation.startTime() === anim.startTime();
284
- }
285
-
286
- export class AnimationModel extends SDKModel<EventTypes> {
287
- readonly runtimeModel: RuntimeModel;
288
- readonly agent: ProtocolProxyApi.AnimationApi;
289
- #animationsById = new Map<string, AnimationImpl>();
290
- readonly animationGroups = new Map<string, AnimationGroup>();
291
- #pendingAnimations = new Set<string>();
292
- playbackRate = 1;
293
- #flushPendingAnimations: () => void;
294
-
295
- constructor(target: Target) {
296
- super(target);
297
- this.runtimeModel = (target.model(RuntimeModel) as RuntimeModel);
298
- this.agent = target.animationAgent();
299
- target.registerAnimationDispatcher(new AnimationDispatcher(this));
300
-
301
- if (!target.suspended()) {
302
- void this.agent.invoke_enable();
303
- }
304
-
305
- const resourceTreeModel = (target.model(ResourceTreeModel) as ResourceTreeModel);
306
- resourceTreeModel.addEventListener(ResourceTreeModelEvents.PrimaryPageChanged, this.reset, this);
307
-
308
- this.#flushPendingAnimations = Common.Debouncer.debounce(() => {
309
- while (this.#pendingAnimations.size) {
310
- this.matchExistingGroups(this.createGroupFromPendingAnimations());
311
- }
312
- }, 100);
313
- }
314
-
315
- private reset(): void {
316
- this.#animationsById.clear();
317
- this.animationGroups.clear();
318
- this.#pendingAnimations.clear();
319
- this.dispatchEventToListeners(Events.ModelReset);
320
- }
321
-
322
- async devicePixelRatio(): Promise<number> {
323
- const evaluateResult = await this.target().runtimeAgent().invoke_evaluate({expression: 'window.devicePixelRatio'});
324
- if (evaluateResult?.result.type === 'number') {
325
- return evaluateResult?.result.value as number ?? 1;
326
- }
327
-
328
- return 1;
329
- }
330
-
331
- async getAnimationGroupForAnimation(name: string, nodeId: Protocol.DOM.NodeId): Promise<AnimationGroup|null> {
332
- for (const animationGroup of this.animationGroups.values()) {
333
- for (const animation of animationGroup.animations()) {
334
- if (animation.name() === name) {
335
- const animationNode = await animation.source().node();
336
- if (animationNode?.id === nodeId) {
337
- return animationGroup;
338
- }
339
- }
340
- }
341
- }
342
-
343
- return null;
344
- }
345
-
346
- animationCanceled(id: string): void {
347
- this.#pendingAnimations.delete(id);
348
- }
349
-
350
- async animationUpdated(payload: Protocol.Animation.Animation): Promise<void> {
351
- let foundAnimationGroup: AnimationGroup|undefined;
352
- let foundAnimation: AnimationImpl|undefined;
353
- for (const animationGroup of this.animationGroups.values()) {
354
- foundAnimation = animationGroup.animations().find(animation => animation.id() === payload.id);
355
- if (foundAnimation) {
356
- foundAnimationGroup = animationGroup;
357
- break;
358
- }
359
- }
360
-
361
- if (!foundAnimation || !foundAnimationGroup) {
362
- return;
363
- }
364
-
365
- await foundAnimation.setPayload(payload);
366
- this.dispatchEventToListeners(Events.AnimationGroupUpdated, foundAnimationGroup);
367
- }
368
-
369
- async animationStarted(payload: Protocol.Animation.Animation): Promise<void> {
370
- // We are not interested in animations without effect or target.
371
- if (!payload.source?.backendNodeId) {
372
- return;
373
- }
374
-
375
- const animation = await AnimationImpl.parsePayload(this, payload);
376
- // Ignore Web Animations custom effects & groups.
377
- const keyframesRule = animation.source().keyframesRule();
378
- if (animation.type() === 'WebAnimation' && keyframesRule && keyframesRule.keyframes().length === 0) {
379
- this.#pendingAnimations.delete(animation.id());
380
- } else {
381
- this.#animationsById.set(animation.id(), animation);
382
- this.#pendingAnimations.add(animation.id());
383
- }
384
-
385
- this.#flushPendingAnimations();
386
- }
387
-
388
- private matchExistingGroups(incomingGroup: AnimationGroup): boolean {
389
- let matchedGroup: AnimationGroup|null = null;
390
- for (const group of this.animationGroups.values()) {
391
- if (group.matches(incomingGroup)) {
392
- matchedGroup = group;
393
- group.rebaseTo(incomingGroup);
394
- break;
395
- }
396
-
397
- if (group.shouldInclude(incomingGroup)) {
398
- matchedGroup = group;
399
- group.appendAnimations(incomingGroup.animations());
400
- break;
401
- }
402
- }
403
-
404
- if (!matchedGroup) {
405
- this.animationGroups.set(incomingGroup.id(), incomingGroup);
406
- this.dispatchEventToListeners(Events.AnimationGroupStarted, incomingGroup);
407
- } else {
408
- this.dispatchEventToListeners(Events.AnimationGroupUpdated, matchedGroup);
409
- }
410
- return Boolean(matchedGroup);
411
- }
412
-
413
- private createGroupFromPendingAnimations(): AnimationGroup {
414
- console.assert(this.#pendingAnimations.size > 0);
415
- const firstAnimationId = this.#pendingAnimations.values().next().value as string;
416
- this.#pendingAnimations.delete(firstAnimationId);
417
-
418
- const firstAnimation = this.#animationsById.get(firstAnimationId);
419
- if (!firstAnimation) {
420
- throw new Error('Unable to locate first animation');
421
- }
422
-
423
- const groupedAnimations = [firstAnimation];
424
- const remainingAnimations = new Set<string>();
425
-
426
- for (const id of this.#pendingAnimations) {
427
- const anim = this.#animationsById.get(id) as AnimationImpl;
428
- if (shouldGroupAnimations(firstAnimation, anim)) {
429
- groupedAnimations.push(anim);
430
- } else {
431
- remainingAnimations.add(id);
432
- }
433
- }
434
-
435
- this.#pendingAnimations = remainingAnimations;
436
- // Show the first starting animation at the top of the animations of the animation group.
437
- groupedAnimations.sort((anim1, anim2) => anim1.startTime() - anim2.startTime());
438
- return new AnimationGroup(this, firstAnimationId, groupedAnimations);
439
- }
440
-
441
- setPlaybackRate(playbackRate: number): void {
442
- this.playbackRate = playbackRate;
443
- void this.agent.invoke_setPlaybackRate({playbackRate});
444
- }
445
-
446
- async releaseAllAnimations(): Promise<void> {
447
- const animationIds = [...this.animationGroups.values()].flatMap(
448
- animationGroup => animationGroup.animations().map(animation => animation.id()));
449
- await this.agent.invoke_releaseAnimations({animations: animationIds});
450
- }
451
-
452
- releaseAnimations(animations: string[]): void {
453
- void this.agent.invoke_releaseAnimations({animations});
454
- }
455
-
456
- override async suspendModel(): Promise<void> {
457
- await this.agent.invoke_disable().then(() => this.reset());
458
- }
459
-
460
- override async resumeModel(): Promise<void> {
461
- await this.agent.invoke_enable();
462
- }
463
- }
464
-
465
- export enum Events {
466
- /* eslint-disable @typescript-eslint/naming-convention -- Used by web_tests. */
467
- AnimationGroupStarted = 'AnimationGroupStarted',
468
- AnimationGroupUpdated = 'AnimationGroupUpdated',
469
- ModelReset = 'ModelReset',
470
- /* eslint-enable @typescript-eslint/naming-convention */
471
- }
472
-
473
- export interface EventTypes {
474
- [Events.AnimationGroupStarted]: AnimationGroup;
475
- [Events.AnimationGroupUpdated]: AnimationGroup;
476
- [Events.ModelReset]: void;
477
- }
478
-
479
- export class AnimationImpl {
480
- readonly #animationModel: AnimationModel;
481
- #payload!: Protocol.Animation
482
- .Animation; // Assertion is safe because only way to create `AnimationImpl` is to use `parsePayload` which calls `setPayload` and sets the value.
483
- #source!:
484
- AnimationEffect; // Assertion is safe because only way to create `AnimationImpl` is to use `parsePayload` which calls `setPayload` and sets the value.
485
- #playState?: string;
486
-
487
- private constructor(animationModel: AnimationModel) {
488
- this.#animationModel = animationModel;
489
- }
490
-
491
- static async parsePayload(animationModel: AnimationModel, payload: Protocol.Animation.Animation):
492
- Promise<AnimationImpl> {
493
- const animation = new AnimationImpl(animationModel);
494
- await animation.setPayload(payload);
495
- return animation;
496
- }
497
-
498
- async setPayload(payload: Protocol.Animation.Animation): Promise<void> {
499
- // TODO(b/40929569): Remove normalizing by devicePixelRatio after the attached bug is resolved.
500
- if (payload.viewOrScrollTimeline) {
501
- const devicePixelRatio = await this.#animationModel.devicePixelRatio();
502
- if (payload.viewOrScrollTimeline.startOffset) {
503
- payload.viewOrScrollTimeline.startOffset /= devicePixelRatio;
504
- }
505
-
506
- if (payload.viewOrScrollTimeline.endOffset) {
507
- payload.viewOrScrollTimeline.endOffset /= devicePixelRatio;
508
- }
509
- }
510
-
511
- this.#payload = payload;
512
- if (this.#source && payload.source) {
513
- this.#source.setPayload(payload.source);
514
- } else if (!this.#source && payload.source) {
515
- this.#source = new AnimationEffect(this.#animationModel, payload.source);
516
- }
517
- }
518
-
519
- // `startTime` and `duration` is represented as the
520
- // percentage of the view timeline range that starts at `startOffset`px
521
- // from the scroll container and ends at `endOffset`px of the scroll container.
522
- // This takes a percentage of the timeline range and returns the absolute
523
- // pixels values as a scroll offset of the scroll container.
524
- private percentageToPixels(percentage: number, viewOrScrollTimeline: Protocol.Animation.ViewOrScrollTimeline):
525
- number {
526
- const {startOffset, endOffset} = viewOrScrollTimeline;
527
- if (startOffset === undefined || endOffset === undefined) {
528
- // We don't expect this situation to occur since after an animation is started
529
- // we expect the scroll offsets to be resolved and provided correctly. If `startOffset`
530
- // or `endOffset` is not provided in a viewOrScrollTimeline; we can assume that there is a bug here
531
- // so it's fine to throw an error.
532
- throw new Error('startOffset or endOffset does not exist in viewOrScrollTimeline');
533
- }
534
-
535
- return (endOffset - startOffset) * (percentage / 100);
536
- }
537
-
538
- viewOrScrollTimeline(): Protocol.Animation.ViewOrScrollTimeline|undefined {
539
- return this.#payload.viewOrScrollTimeline;
540
- }
541
-
542
- id(): string {
543
- return this.#payload.id;
544
- }
545
-
546
- name(): string {
547
- return this.#payload.name;
548
- }
549
-
550
- paused(): boolean {
551
- return this.#payload.pausedState;
552
- }
553
-
554
- playState(): string {
555
- return this.#playState || this.#payload.playState;
556
- }
557
-
558
- playbackRate(): number {
559
- return this.#payload.playbackRate;
560
- }
561
-
562
- // For scroll driven animations, it returns the pixel offset in the scroll container
563
- // For time animations, it returns milliseconds.
564
- startTime(): number {
565
- const viewOrScrollTimeline = this.viewOrScrollTimeline();
566
- if (viewOrScrollTimeline) {
567
- return this.percentageToPixels(
568
- this.playbackRate() > 0 ? this.#payload.startTime : 100 - this.#payload.startTime,
569
- viewOrScrollTimeline) +
570
- (this.viewOrScrollTimeline()?.startOffset ?? 0);
571
- }
572
-
573
- return this.#payload.startTime;
574
- }
575
-
576
- // For scroll driven animations, it returns the duration in pixels (i.e. after how many pixels of scroll the animation is going to end)
577
- // For time animations, it returns milliseconds.
578
- iterationDuration(): number {
579
- const viewOrScrollTimeline = this.viewOrScrollTimeline();
580
- if (viewOrScrollTimeline) {
581
- return this.percentageToPixels(this.source().duration(), viewOrScrollTimeline);
582
- }
583
-
584
- return this.source().duration();
585
- }
586
-
587
- // For scroll driven animations, it returns the duration in pixels (i.e. after how many pixels of scroll the animation is going to end)
588
- // For time animations, it returns milliseconds.
589
- endTime(): number {
590
- if (!this.source().iterations) {
591
- return Infinity;
592
- }
593
-
594
- if (this.viewOrScrollTimeline()) {
595
- return this.startTime() + this.iterationDuration() * this.source().iterations();
596
- }
597
-
598
- return this.startTime() + this.source().delay() + this.source().duration() * this.source().iterations() +
599
- this.source().endDelay();
600
- }
601
-
602
- // For scroll driven animations, it returns the duration in pixels (i.e. after how many pixels of scroll the animation is going to end)
603
- // For time animations, it returns milliseconds.
604
- finiteDuration(): number {
605
- const iterations = Math.min(this.source().iterations(), 3);
606
- if (this.viewOrScrollTimeline()) {
607
- return this.iterationDuration() * iterations;
608
- }
609
-
610
- return this.source().delay() + this.source().duration() * iterations;
611
- }
612
-
613
- // For scroll driven animations, it returns the duration in pixels (i.e. after how many pixels of scroll the animation is going to end)
614
- // For time animations, it returns milliseconds.
615
- currentTime(): number {
616
- const viewOrScrollTimeline = this.viewOrScrollTimeline();
617
- if (viewOrScrollTimeline) {
618
- return this.percentageToPixels(this.#payload.currentTime, viewOrScrollTimeline);
619
- }
620
-
621
- return this.#payload.currentTime;
622
- }
623
-
624
- source(): AnimationEffect {
625
- return this.#source;
626
- }
627
-
628
- type(): Protocol.Animation.AnimationType {
629
- return this.#payload.type;
630
- }
631
-
632
- overlaps(animation: AnimationImpl): boolean {
633
- // Infinite animations
634
- if (!this.source().iterations() || !animation.source().iterations()) {
635
- return true;
636
- }
637
-
638
- const firstAnimation = this.startTime() < animation.startTime() ? this : animation;
639
- const secondAnimation = firstAnimation === this ? animation : this;
640
- return firstAnimation.endTime() >= secondAnimation.startTime();
641
- }
642
-
643
- // Utility method for returning `delay` for time based animations
644
- // and `startTime` in pixels for scroll driven animations. It is used to
645
- // find the exact starting time of the first keyframe for both cases.
646
- delayOrStartTime(): number {
647
- if (this.viewOrScrollTimeline()) {
648
- return this.startTime();
649
- }
650
-
651
- return this.source().delay();
652
- }
653
-
654
- setTiming(duration: number, delay: number): void {
655
- void this.#source.node().then(node => {
656
- if (!node) {
657
- throw new Error('Unable to find node');
658
- }
659
- this.updateNodeStyle(duration, delay, node);
660
- });
661
- this.#source.durationInternal = duration;
662
- this.#source.delayInternal = delay;
663
- void this.#animationModel.agent.invoke_setTiming({animationId: this.id(), duration, delay});
664
- }
665
-
666
- private updateNodeStyle(duration: number, delay: number, node: DOMNode): void {
667
- let animationPrefix;
668
- if (this.type() === Protocol.Animation.AnimationType.CSSTransition) {
669
- animationPrefix = 'transition-';
670
- } else if (this.type() === Protocol.Animation.AnimationType.CSSAnimation) {
671
- animationPrefix = 'animation-';
672
- } else {
673
- return;
674
- }
675
-
676
- if (!node.id) {
677
- throw new Error('Node has no id');
678
- }
679
-
680
- const cssModel = node.domModel().cssModel();
681
- cssModel.setEffectivePropertyValueForNode(node.id, animationPrefix + 'duration', duration + 'ms');
682
- cssModel.setEffectivePropertyValueForNode(node.id, animationPrefix + 'delay', delay + 'ms');
683
- }
684
-
685
- async remoteObjectPromise(): Promise<RemoteObject|null> {
686
- const payload = await this.#animationModel.agent.invoke_resolveAnimation({animationId: this.id()});
687
- if (!payload) {
688
- return null;
689
- }
690
-
691
- return this.#animationModel.runtimeModel.createRemoteObject(payload.remoteObject);
692
- }
693
-
694
- cssId(): string {
695
- return this.#payload.cssId || '';
696
- }
697
- }
698
-
699
- export class AnimationEffect {
700
- #animationModel: AnimationModel;
701
- #payload!: Protocol.Animation
702
- .AnimationEffect; // Assertion is safe because `setPayload` call in `constructor` sets the value.
703
- delayInternal!: number; // Assertion is safe because `setPayload` call in `constructor` sets the value.
704
- durationInternal!: number; // Assertion is safe because `setPayload` call in `constructor` sets the value.
705
- #keyframesRule: KeyframesRule|undefined;
706
- #deferredNode?: DeferredDOMNode;
707
- constructor(animationModel: AnimationModel, payload: Protocol.Animation.AnimationEffect) {
708
- this.#animationModel = animationModel;
709
- this.setPayload(payload);
710
- }
711
-
712
- setPayload(payload: Protocol.Animation.AnimationEffect): void {
713
- this.#payload = payload;
714
- if (!this.#keyframesRule && payload.keyframesRule) {
715
- this.#keyframesRule = new KeyframesRule(payload.keyframesRule);
716
- } else if (this.#keyframesRule && payload.keyframesRule) {
717
- this.#keyframesRule.setPayload(payload.keyframesRule);
718
- }
719
-
720
- this.delayInternal = payload.delay;
721
- this.durationInternal = payload.duration;
722
- }
723
-
724
- delay(): number {
725
- return this.delayInternal;
726
- }
727
-
728
- endDelay(): number {
729
- return this.#payload.endDelay;
730
- }
731
-
732
- iterations(): number {
733
- // Animations with zero duration, zero delays and infinite iterations can't be shown.
734
- if (!this.delay() && !this.endDelay() && !this.duration()) {
735
- return 0;
736
- }
737
- return this.#payload.iterations || Infinity;
738
- }
739
-
740
- duration(): number {
741
- return this.durationInternal;
742
- }
743
-
744
- direction(): string {
745
- return this.#payload.direction;
746
- }
747
-
748
- fill(): string {
749
- return this.#payload.fill;
750
- }
751
-
752
- node(): Promise<DOMNode|null> {
753
- if (!this.#deferredNode) {
754
- this.#deferredNode = new DeferredDOMNode(this.#animationModel.target(), this.backendNodeId());
755
- }
756
- return this.#deferredNode.resolvePromise();
757
- }
758
-
759
- deferredNode(): DeferredDOMNode {
760
- return new DeferredDOMNode(this.#animationModel.target(), this.backendNodeId());
761
- }
762
-
763
- backendNodeId(): Protocol.DOM.BackendNodeId {
764
- return this.#payload.backendNodeId as Protocol.DOM.BackendNodeId;
765
- }
766
-
767
- keyframesRule(): KeyframesRule|null {
768
- return this.#keyframesRule || null;
769
- }
770
-
771
- easing(): string {
772
- return this.#payload.easing;
773
- }
774
- }
775
-
776
- export class KeyframesRule {
777
- #payload!: Protocol.Animation
778
- .KeyframesRule; // Assertion is safe because `setPayload` call in `constructor` sets the value.;
779
- #keyframes!: KeyframeStyle[]; // Assertion is safe because `setPayload` call in `constructor` sets the value.;
780
- constructor(payload: Protocol.Animation.KeyframesRule) {
781
- this.setPayload(payload);
782
- }
783
-
784
- setPayload(payload: Protocol.Animation.KeyframesRule): void {
785
- this.#payload = payload;
786
- if (!this.#keyframes) {
787
- this.#keyframes = this.#payload.keyframes.map(keyframeStyle => new KeyframeStyle(keyframeStyle));
788
- } else {
789
- this.#payload.keyframes.forEach((keyframeStyle, index) => {
790
- this.#keyframes[index]?.setPayload(keyframeStyle);
791
- });
792
- }
793
- }
794
-
795
- name(): string|undefined {
796
- return this.#payload.name;
797
- }
798
-
799
- keyframes(): KeyframeStyle[] {
800
- return this.#keyframes;
801
- }
802
- }
803
-
804
- export class KeyframeStyle {
805
- #payload!:
806
- Protocol.Animation.KeyframeStyle; // Assertion is safe because `setPayload` call in `constructor` sets the value.
807
- #offset!: string; // Assertion is safe because `setPayload` call in `constructor` sets the value.
808
- constructor(payload: Protocol.Animation.KeyframeStyle) {
809
- this.setPayload(payload);
810
- }
811
-
812
- setPayload(payload: Protocol.Animation.KeyframeStyle): void {
813
- this.#payload = payload;
814
- this.#offset = payload.offset;
815
- }
816
-
817
- offset(): string {
818
- return this.#offset;
819
- }
820
-
821
- setOffset(offset: number): void {
822
- this.#offset = offset * 100 + '%';
823
- }
824
-
825
- offsetAsNumber(): number {
826
- return parseFloat(this.#offset) / 100;
827
- }
828
-
829
- easing(): string {
830
- return this.#payload.easing;
831
- }
832
- }
833
-
834
- export class AnimationGroup {
835
- readonly #animationModel: AnimationModel;
836
- readonly #id: string;
837
- #scrollNode: AnimationDOMNode|undefined;
838
- #animations: AnimationImpl[];
839
- #paused: boolean;
840
- constructor(animationModel: AnimationModel, id: string, animations: AnimationImpl[]) {
841
- this.#animationModel = animationModel;
842
- this.#id = id;
843
- this.#animations = animations;
844
- this.#paused = false;
845
- }
846
-
847
- isScrollDriven(): boolean {
848
- return Boolean(this.#animations[0]?.viewOrScrollTimeline());
849
- }
850
-
851
- id(): string {
852
- return this.#id;
853
- }
854
-
855
- animations(): AnimationImpl[] {
856
- return this.#animations;
857
- }
858
-
859
- release(): void {
860
- this.#animationModel.animationGroups.delete(this.id());
861
- this.#animationModel.releaseAnimations(this.animationIds());
862
- }
863
-
864
- private animationIds(): string[] {
865
- function extractId(animation: AnimationImpl): string {
866
- return animation.id();
867
- }
868
-
869
- return this.#animations.map(extractId);
870
- }
871
-
872
- startTime(): number {
873
- return this.#animations[0].startTime();
874
- }
875
-
876
- // For scroll driven animations, it returns the duration in pixels (i.e. after how many pixels of scroll the animation is going to end)
877
- // For time animations, it returns milliseconds.
878
- groupDuration(): number {
879
- let duration = 0;
880
- for (const anim of this.#animations) {
881
- duration = Math.max(duration, anim.delayOrStartTime() + anim.iterationDuration());
882
- }
883
- return duration;
884
- }
885
-
886
- // For scroll driven animations, it returns the duration in pixels (i.e. after how many pixels of scroll the animation is going to end)
887
- // For time animations, it returns milliseconds.
888
- finiteDuration(): number {
889
- let maxDuration = 0;
890
- for (let i = 0; i < this.#animations.length; ++i) {
891
- maxDuration = Math.max(maxDuration, this.#animations[i].finiteDuration());
892
- }
893
- return maxDuration;
894
- }
895
-
896
- scrollOrientation(): Protocol.DOM.ScrollOrientation|null {
897
- const timeline = this.#animations[0]?.viewOrScrollTimeline();
898
- if (!timeline) {
899
- return null;
900
- }
901
-
902
- return timeline.axis;
903
- }
904
-
905
- async scrollNode(): Promise<AnimationDOMNode|null> {
906
- if (this.#scrollNode) {
907
- return this.#scrollNode;
908
- }
909
-
910
- if (!this.isScrollDriven()) {
911
- return null;
912
- }
913
-
914
- const sourceNodeId = this.#animations[0]?.viewOrScrollTimeline()?.sourceNodeId;
915
- if (!sourceNodeId) {
916
- return null;
917
- }
918
-
919
- const deferredScrollNode = new DeferredDOMNode(this.#animationModel.target(), sourceNodeId);
920
- const scrollNode = await deferredScrollNode.resolvePromise();
921
- if (!scrollNode) {
922
- return null;
923
- }
924
-
925
- this.#scrollNode = new AnimationDOMNode(scrollNode);
926
- return this.#scrollNode;
927
- }
928
-
929
- seekTo(currentTime: number): void {
930
- void this.#animationModel.agent.invoke_seekAnimations({animations: this.animationIds(), currentTime});
931
- }
932
-
933
- paused(): boolean {
934
- return this.#paused;
935
- }
936
-
937
- togglePause(paused: boolean): void {
938
- if (paused === this.#paused) {
939
- return;
940
- }
941
- this.#paused = paused;
942
- void this.#animationModel.agent.invoke_setPaused({animations: this.animationIds(), paused});
943
- }
944
-
945
- currentTimePromise(): Promise<number> {
946
- let longestAnim: AnimationImpl|null = null;
947
- for (const anim of this.#animations) {
948
- if (!longestAnim || anim.endTime() > longestAnim.endTime()) {
949
- longestAnim = anim;
950
- }
951
- }
952
- if (!longestAnim) {
953
- throw new Error('No longest animation found');
954
- }
955
-
956
- return this.#animationModel.agent.invoke_getCurrentTime({id: longestAnim.id()})
957
- .then(({currentTime}) => currentTime || 0);
958
- }
959
-
960
- matches(group: AnimationGroup): boolean {
961
- function extractId(anim: AnimationImpl): string {
962
- const timelineId = (anim.viewOrScrollTimeline()?.sourceNodeId ?? '') + (anim.viewOrScrollTimeline()?.axis ?? '');
963
- const regularId =
964
- anim.type() === Protocol.Animation.AnimationType.WebAnimation ? anim.type() + anim.id() : anim.cssId();
965
-
966
- return regularId + timelineId;
967
- }
968
-
969
- if (this.#animations.length !== group.#animations.length) {
970
- return false;
971
- }
972
- const left = this.#animations.map(extractId).sort();
973
- const right = group.#animations.map(extractId).sort();
974
- for (let i = 0; i < left.length; i++) {
975
- if (left[i] !== right[i]) {
976
- return false;
977
- }
978
- }
979
- return true;
980
- }
981
-
982
- shouldInclude(group: AnimationGroup): boolean {
983
- // We want to include the animations coming from the incoming group
984
- // inside this group if they were to be grouped if the events came at the same time.
985
- const [firstIncomingAnimation] = group.#animations;
986
- const [firstAnimation] = this.#animations;
987
- return shouldGroupAnimations(firstAnimation, firstIncomingAnimation);
988
- }
989
-
990
- appendAnimations(animations: AnimationImpl[]): void {
991
- this.#animations.push(...animations);
992
- }
993
-
994
- rebaseTo(group: AnimationGroup): void {
995
- this.#animationModel.releaseAnimations(this.animationIds());
996
- this.#animations = group.#animations;
997
- this.#scrollNode = undefined;
998
- }
999
- }
1000
-
1001
- export class AnimationDispatcher implements ProtocolProxyApi.AnimationDispatcher {
1002
- readonly #animationModel: AnimationModel;
1003
- constructor(animationModel: AnimationModel) {
1004
- this.#animationModel = animationModel;
1005
- }
1006
-
1007
- animationCreated(_event: Protocol.Animation.AnimationCreatedEvent): void {
1008
- // Previously this event was used to batch the animations into groups
1009
- // and we were waiting for animationStarted events to be sent for
1010
- // all the created animations and until then we weren't creating any
1011
- // groups. This was allowing us to not miss any animations that were
1012
- // going to be in the same group. However, now we're not using this event
1013
- // to do batching and instead:
1014
- // * We debounce the flush calls so that if the animationStarted events
1015
- // for the same animation group come in different times; we create one
1016
- // group for them.
1017
- // * Even though an animation group is created and rendered for some animations
1018
- // that have the same startTime (or same timeline & scroll axis for SDAs), now
1019
- // whenever an `animationStarted` event comes we check whether there is a group
1020
- // we can add the related animation. If so, we add it and emit `animationGroupUpdated`
1021
- // event. So that, all the animations that were supposed to be in the same group
1022
- // will be in the same group.
1023
- }
1024
-
1025
- animationCanceled({id}: Protocol.Animation.AnimationCanceledEvent): void {
1026
- this.#animationModel.animationCanceled(id);
1027
- }
1028
-
1029
- animationStarted({animation}: Protocol.Animation.AnimationStartedEvent): void {
1030
- void this.#animationModel.animationStarted(animation);
1031
- }
1032
-
1033
- animationUpdated({animation}: Protocol.Animation.AnimationUpdatedEvent): void {
1034
- void this.#animationModel.animationUpdated(animation);
1035
- }
1036
- }
1037
-
1038
- SDKModel.register(AnimationModel, {capabilities: Capability.DOM, autostart: true});
1039
- export interface Request {
1040
- endTime: number;
1041
- }