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.
Files changed (397) hide show
  1. package/generate.ts +643 -0
  2. package/index.ts +16 -0
  3. package/lib/front_end/core/common/App.ts +7 -0
  4. package/lib/front_end/core/common/AppProvider.ts +32 -0
  5. package/lib/front_end/core/common/Base64.ts +47 -0
  6. package/lib/front_end/core/common/CharacterIdMap.ts +30 -0
  7. package/lib/front_end/core/common/Color.ts +2506 -0
  8. package/lib/front_end/core/common/ColorConverter.ts +402 -0
  9. package/lib/front_end/core/common/ColorUtils.ts +252 -0
  10. package/lib/front_end/core/common/Console.ts +114 -0
  11. package/lib/front_end/core/common/Debouncer.ts +15 -0
  12. package/lib/front_end/core/common/EventTarget.ts +52 -0
  13. package/lib/front_end/core/common/Gzip.ts +74 -0
  14. package/lib/front_end/core/common/JavaScriptMetaData.ts +29 -0
  15. package/lib/front_end/core/common/Lazy.ts +31 -0
  16. package/lib/front_end/core/common/Linkifier.ts +55 -0
  17. package/lib/front_end/core/common/MapWithDefault.ts +26 -0
  18. package/lib/front_end/core/common/Mutex.ts +55 -0
  19. package/lib/front_end/core/common/Object.ts +145 -0
  20. package/lib/front_end/core/common/ParsedURL.ts +554 -0
  21. package/lib/front_end/core/common/Progress.ts +180 -0
  22. package/lib/front_end/core/common/QueryParamHandler.ts +7 -0
  23. package/lib/front_end/core/common/ResolverBase.ts +85 -0
  24. package/lib/front_end/core/common/ResourceType.ts +588 -0
  25. package/lib/front_end/core/common/ReturnToPanel.ts +17 -0
  26. package/lib/front_end/core/common/Revealer.ts +192 -0
  27. package/lib/front_end/core/common/Runnable.ts +41 -0
  28. package/lib/front_end/core/common/SegmentedRange.ts +87 -0
  29. package/lib/front_end/core/common/SettingRegistration.ts +339 -0
  30. package/lib/front_end/core/common/Settings.ts +1497 -0
  31. package/lib/front_end/core/common/SimpleHistoryManager.ts +124 -0
  32. package/lib/front_end/core/common/StringOutputStream.ts +26 -0
  33. package/lib/front_end/core/common/TextDictionary.ts +48 -0
  34. package/lib/front_end/core/common/Throttler.ts +99 -0
  35. package/lib/front_end/core/common/Trie.ts +152 -0
  36. package/lib/front_end/core/common/Worker.ts +60 -0
  37. package/lib/front_end/core/common/common.ts +81 -0
  38. package/lib/front_end/core/host/AidaClient.ts +733 -0
  39. package/lib/front_end/core/host/GdpClient.ts +316 -0
  40. package/lib/front_end/core/host/InspectorFrontendHost.ts +648 -0
  41. package/lib/front_end/core/host/InspectorFrontendHostAPI.ts +551 -0
  42. package/lib/front_end/core/host/Platform.ts +76 -0
  43. package/lib/front_end/core/host/ResourceLoader.ts +282 -0
  44. package/lib/front_end/core/host/UserMetrics.ts +1230 -0
  45. package/lib/front_end/core/host/host.ts +23 -0
  46. package/lib/front_end/core/i18n/ByteUtilities.ts +82 -0
  47. package/lib/front_end/core/i18n/DevToolsLocale.ts +87 -0
  48. package/lib/front_end/core/i18n/NumberFormatter.ts +82 -0
  49. package/lib/front_end/core/i18n/i18n.ts +17 -0
  50. package/lib/front_end/core/i18n/i18nImpl.ts +204 -0
  51. package/lib/front_end/core/i18n/i18nTypes.ts +10 -0
  52. package/lib/front_end/core/i18n/locales.js +14 -0
  53. package/lib/front_end/core/i18n/time-utilities.ts +174 -0
  54. package/lib/front_end/core/platform/ArrayUtilities.ts +271 -0
  55. package/lib/front_end/core/platform/Brand.ts +23 -0
  56. package/lib/front_end/core/platform/Constructor.ts +10 -0
  57. package/lib/front_end/core/platform/DOMUtilities.ts +138 -0
  58. package/lib/front_end/core/platform/DateUtilities.ts +15 -0
  59. package/lib/front_end/core/platform/DevToolsPath.ts +53 -0
  60. package/lib/front_end/core/platform/KeyboardUtilities.ts +38 -0
  61. package/lib/front_end/core/platform/MapUtilities.ts +95 -0
  62. package/lib/front_end/core/platform/MimeType.ts +175 -0
  63. package/lib/front_end/core/platform/NumberUtilities.ts +80 -0
  64. package/lib/front_end/core/platform/StringUtilities.ts +588 -0
  65. package/lib/front_end/core/platform/Timing.ts +17 -0
  66. package/lib/front_end/core/platform/TypedArrayUtilities.ts +189 -0
  67. package/lib/front_end/core/platform/TypescriptUtilities.ts +86 -0
  68. package/lib/front_end/core/platform/UIString.ts +39 -0
  69. package/lib/front_end/core/platform/UserVisibleError.ts +28 -0
  70. package/lib/front_end/core/platform/platform.ts +45 -0
  71. package/lib/front_end/core/protocol_client/ConnectionTransport.ts +26 -0
  72. package/lib/front_end/core/protocol_client/InspectorBackend.ts +1050 -0
  73. package/lib/front_end/core/protocol_client/NodeURL.ts +42 -0
  74. package/lib/front_end/core/protocol_client/protocol_client.ts +13 -0
  75. package/lib/front_end/core/root/Runtime.ts +609 -0
  76. package/lib/front_end/core/root/root.ts +6 -0
  77. package/lib/front_end/core/sdk/AccessibilityModel.ts +353 -0
  78. package/lib/front_end/core/sdk/AnimationModel.ts +1041 -0
  79. package/lib/front_end/core/sdk/AutofillModel.ts +184 -0
  80. package/lib/front_end/core/sdk/CPUProfilerModel.ts +148 -0
  81. package/lib/front_end/core/sdk/CPUThrottlingManager.ts +282 -0
  82. package/lib/front_end/core/sdk/CSSContainerQuery.ts +139 -0
  83. package/lib/front_end/core/sdk/CSSFontFace.ts +40 -0
  84. package/lib/front_end/core/sdk/CSSLayer.ts +30 -0
  85. package/lib/front_end/core/sdk/CSSMatchedStyles.ts +1646 -0
  86. package/lib/front_end/core/sdk/CSSMedia.ts +121 -0
  87. package/lib/front_end/core/sdk/CSSMetadata.ts +1647 -0
  88. package/lib/front_end/core/sdk/CSSModel.ts +1128 -0
  89. package/lib/front_end/core/sdk/CSSProperty.ts +384 -0
  90. package/lib/front_end/core/sdk/CSSPropertyParser.ts +681 -0
  91. package/lib/front_end/core/sdk/CSSPropertyParserMatchers.ts +1395 -0
  92. package/lib/front_end/core/sdk/CSSQuery.ts +72 -0
  93. package/lib/front_end/core/sdk/CSSRule.ts +465 -0
  94. package/lib/front_end/core/sdk/CSSScope.ts +30 -0
  95. package/lib/front_end/core/sdk/CSSStartingStyle.ts +29 -0
  96. package/lib/front_end/core/sdk/CSSStyleDeclaration.ts +313 -0
  97. package/lib/front_end/core/sdk/CSSStyleSheetHeader.ts +196 -0
  98. package/lib/front_end/core/sdk/CSSSupports.ts +33 -0
  99. package/lib/front_end/core/sdk/CategorizedBreakpoint.ts +64 -0
  100. package/lib/front_end/core/sdk/ChildTargetManager.ts +314 -0
  101. package/lib/front_end/core/sdk/CompilerSourceMappingContentProvider.ts +62 -0
  102. package/lib/front_end/core/sdk/Connections.ts +293 -0
  103. package/lib/front_end/core/sdk/ConsoleModel.ts +808 -0
  104. package/lib/front_end/core/sdk/ConsoleModelTypes.ts +15 -0
  105. package/lib/front_end/core/sdk/Cookie.ts +319 -0
  106. package/lib/front_end/core/sdk/CookieModel.ts +239 -0
  107. package/lib/front_end/core/sdk/CookieParser.ts +185 -0
  108. package/lib/front_end/core/sdk/DOMDebuggerModel.ts +787 -0
  109. package/lib/front_end/core/sdk/DOMModel.ts +1961 -0
  110. package/lib/front_end/core/sdk/DebuggerModel.ts +1605 -0
  111. package/lib/front_end/core/sdk/EmulationModel.ts +648 -0
  112. package/lib/front_end/core/sdk/EnhancedTracesParser.ts +515 -0
  113. package/lib/front_end/core/sdk/EventBreakpointsModel.ts +183 -0
  114. package/lib/front_end/core/sdk/FrameAssociated.ts +11 -0
  115. package/lib/front_end/core/sdk/FrameManager.ts +259 -0
  116. package/lib/front_end/core/sdk/HeapProfilerModel.ts +225 -0
  117. package/lib/front_end/core/sdk/HttpReasonPhraseStrings.ts +77 -0
  118. package/lib/front_end/core/sdk/IOModel.ts +91 -0
  119. package/lib/front_end/core/sdk/IsolateManager.ts +257 -0
  120. package/lib/front_end/core/sdk/IssuesModel.ts +70 -0
  121. package/lib/front_end/core/sdk/LayerTreeBase.ts +169 -0
  122. package/lib/front_end/core/sdk/LogModel.ts +56 -0
  123. package/lib/front_end/core/sdk/NetworkManager.ts +2823 -0
  124. package/lib/front_end/core/sdk/NetworkRequest.ts +2253 -0
  125. package/lib/front_end/core/sdk/OverlayColorGenerator.ts +52 -0
  126. package/lib/front_end/core/sdk/OverlayModel.ts +1011 -0
  127. package/lib/front_end/core/sdk/OverlayPersistentHighlighter.ts +522 -0
  128. package/lib/front_end/core/sdk/PageLoad.ts +35 -0
  129. package/lib/front_end/core/sdk/PageResourceLoader.ts +435 -0
  130. package/lib/front_end/core/sdk/PaintProfiler.ts +110 -0
  131. package/lib/front_end/core/sdk/PerformanceMetricsModel.ts +84 -0
  132. package/lib/front_end/core/sdk/PreloadingModel.ts +863 -0
  133. package/lib/front_end/core/sdk/RehydratingConnection.ts +386 -0
  134. package/lib/front_end/core/sdk/RehydratingObject.ts +66 -0
  135. package/lib/front_end/core/sdk/RemoteObject.ts +1160 -0
  136. package/lib/front_end/core/sdk/Resource.ts +232 -0
  137. package/lib/front_end/core/sdk/ResourceTreeModel.ts +1160 -0
  138. package/lib/front_end/core/sdk/RuntimeModel.ts +732 -0
  139. package/lib/front_end/core/sdk/SDKModel.ts +65 -0
  140. package/lib/front_end/core/sdk/ScopeTreeCache.ts +45 -0
  141. package/lib/front_end/core/sdk/ScreenCaptureModel.ts +255 -0
  142. package/lib/front_end/core/sdk/Script.ts +534 -0
  143. package/lib/front_end/core/sdk/SecurityOriginManager.ts +76 -0
  144. package/lib/front_end/core/sdk/ServerSentEvents.ts +80 -0
  145. package/lib/front_end/core/sdk/ServerSentEventsProtocol.ts +122 -0
  146. package/lib/front_end/core/sdk/ServerTiming.ts +260 -0
  147. package/lib/front_end/core/sdk/ServiceWorkerCacheModel.ts +377 -0
  148. package/lib/front_end/core/sdk/ServiceWorkerManager.ts +605 -0
  149. package/lib/front_end/core/sdk/SourceMap.ts +867 -0
  150. package/lib/front_end/core/sdk/SourceMapCache.ts +54 -0
  151. package/lib/front_end/core/sdk/SourceMapFunctionRanges.ts +156 -0
  152. package/lib/front_end/core/sdk/SourceMapManager.ts +239 -0
  153. package/lib/front_end/core/sdk/SourceMapScopeChainEntry.ts +189 -0
  154. package/lib/front_end/core/sdk/SourceMapScopesInfo.ts +508 -0
  155. package/lib/front_end/core/sdk/StorageBucketsModel.ts +204 -0
  156. package/lib/front_end/core/sdk/StorageKeyManager.ts +98 -0
  157. package/lib/front_end/core/sdk/Target.ts +332 -0
  158. package/lib/front_end/core/sdk/TargetManager.ts +453 -0
  159. package/lib/front_end/core/sdk/TraceObject.ts +61 -0
  160. package/lib/front_end/core/sdk/WebAuthnModel.ts +104 -0
  161. package/lib/front_end/core/sdk/sdk.ts +174 -0
  162. package/lib/front_end/entrypoints/formatter_worker/FormatterActions.ts +59 -0
  163. package/lib/front_end/generated/InspectorBackendCommands.js +1617 -0
  164. package/lib/front_end/generated/SupportedCSSProperties.js +7512 -0
  165. package/lib/front_end/generated/protocol-proxy-api.d.ts +5022 -0
  166. package/lib/front_end/generated/protocol.ts +22014 -0
  167. package/lib/front_end/models/cpu_profile/CPUProfileDataModel.ts +571 -0
  168. package/lib/front_end/models/cpu_profile/ProfileTreeModel.ts +103 -0
  169. package/lib/front_end/models/cpu_profile/cpu_profile.ts +11 -0
  170. package/lib/front_end/models/formatter/FormatterWorkerPool.ts +219 -0
  171. package/lib/front_end/models/formatter/ScriptFormatter.ts +112 -0
  172. package/lib/front_end/models/formatter/formatter.ts +8 -0
  173. package/lib/front_end/models/text_utils/CodeMirrorUtils.ts +37 -0
  174. package/lib/front_end/models/text_utils/ContentData.ts +199 -0
  175. package/lib/front_end/models/text_utils/ContentProvider.ts +68 -0
  176. package/lib/front_end/models/text_utils/StaticContentProvider.ts +49 -0
  177. package/lib/front_end/models/text_utils/StreamingContentData.ts +108 -0
  178. package/lib/front_end/models/text_utils/Text.ts +90 -0
  179. package/lib/front_end/models/text_utils/TextCursor.ts +44 -0
  180. package/lib/front_end/models/text_utils/TextRange.ts +266 -0
  181. package/lib/front_end/models/text_utils/TextUtils.ts +401 -0
  182. package/lib/front_end/models/text_utils/WasmDisassembly.ts +87 -0
  183. package/lib/front_end/models/text_utils/text_utils.ts +27 -0
  184. package/lib/front_end/models/trace/EntityMapper.ts +141 -0
  185. package/lib/front_end/models/trace/EventsSerializer.ts +101 -0
  186. package/lib/front_end/models/trace/LanternComputationData.ts +438 -0
  187. package/lib/front_end/models/trace/ModelImpl.ts +236 -0
  188. package/lib/front_end/models/trace/Name.ts +136 -0
  189. package/lib/front_end/models/trace/Processor.ts +652 -0
  190. package/lib/front_end/models/trace/Styles.ts +1138 -0
  191. package/lib/front_end/models/trace/extras/FilmStrip.ts +78 -0
  192. package/lib/front_end/models/trace/extras/MainThreadActivity.ts +86 -0
  193. package/lib/front_end/models/trace/extras/ScriptDuplication.ts +236 -0
  194. package/lib/front_end/models/trace/extras/StackTraceForEvent.ts +203 -0
  195. package/lib/front_end/models/trace/extras/ThirdParties.ts +164 -0
  196. package/lib/front_end/models/trace/extras/TraceFilter.ts +62 -0
  197. package/lib/front_end/models/trace/extras/TraceTree.ts +701 -0
  198. package/lib/front_end/models/trace/extras/extras.ts +11 -0
  199. package/lib/front_end/models/trace/handlers/AnimationFramesHandler.ts +128 -0
  200. package/lib/front_end/models/trace/handlers/AnimationHandler.ts +36 -0
  201. package/lib/front_end/models/trace/handlers/AsyncJSCallsHandler.ts +239 -0
  202. package/lib/front_end/models/trace/handlers/AuctionWorkletsHandler.ts +183 -0
  203. package/lib/front_end/models/trace/handlers/DOMStatsHandler.ts +31 -0
  204. package/lib/front_end/models/trace/handlers/ExtensionTraceDataHandler.ts +306 -0
  205. package/lib/front_end/models/trace/handlers/FlowsHandler.ts +175 -0
  206. package/lib/front_end/models/trace/handlers/FramesHandler.ts +571 -0
  207. package/lib/front_end/models/trace/handlers/GPUHandler.ts +50 -0
  208. package/lib/front_end/models/trace/handlers/ImagePaintingHandler.ts +183 -0
  209. package/lib/front_end/models/trace/handlers/InitiatorsHandler.ts +193 -0
  210. package/lib/front_end/models/trace/handlers/InvalidationsHandler.ts +168 -0
  211. package/lib/front_end/models/trace/handlers/LargestImagePaintHandler.ts +109 -0
  212. package/lib/front_end/models/trace/handlers/LargestTextPaintHandler.ts +35 -0
  213. package/lib/front_end/models/trace/handlers/LayerTreeHandler.ts +123 -0
  214. package/lib/front_end/models/trace/handlers/LayoutShiftsHandler.ts +573 -0
  215. package/lib/front_end/models/trace/handlers/MemoryHandler.ts +31 -0
  216. package/lib/front_end/models/trace/handlers/MetaHandler.ts +525 -0
  217. package/lib/front_end/models/trace/handlers/ModelHandlers.ts +34 -0
  218. package/lib/front_end/models/trace/handlers/NetworkRequestsHandler.ts +672 -0
  219. package/lib/front_end/models/trace/handlers/PageFramesHandler.ts +52 -0
  220. package/lib/front_end/models/trace/handlers/PageLoadMetricsHandler.ts +460 -0
  221. package/lib/front_end/models/trace/handlers/RendererHandler.ts +428 -0
  222. package/lib/front_end/models/trace/handlers/SamplesHandler.ts +271 -0
  223. package/lib/front_end/models/trace/handlers/ScreenshotsHandler.ts +122 -0
  224. package/lib/front_end/models/trace/handlers/ScriptsHandler.ts +336 -0
  225. package/lib/front_end/models/trace/handlers/SelectorStatsHandler.ts +110 -0
  226. package/lib/front_end/models/trace/handlers/Threads.ts +139 -0
  227. package/lib/front_end/models/trace/handlers/UserInteractionsHandler.ts +400 -0
  228. package/lib/front_end/models/trace/handlers/UserTimingsHandler.ts +233 -0
  229. package/lib/front_end/models/trace/handlers/WarningsHandler.ts +162 -0
  230. package/lib/front_end/models/trace/handlers/WorkersHandler.ts +45 -0
  231. package/lib/front_end/models/trace/handlers/handlers.ts +8 -0
  232. package/lib/front_end/models/trace/handlers/helpers.ts +196 -0
  233. package/lib/front_end/models/trace/handlers/types.ts +75 -0
  234. package/lib/front_end/models/trace/helpers/Extensions.ts +54 -0
  235. package/lib/front_end/models/trace/helpers/Network.ts +129 -0
  236. package/lib/front_end/models/trace/helpers/SamplesIntegrator.ts +544 -0
  237. package/lib/front_end/models/trace/helpers/SyntheticEvents.ts +87 -0
  238. package/lib/front_end/models/trace/helpers/Timing.ts +248 -0
  239. package/lib/front_end/models/trace/helpers/Trace.ts +928 -0
  240. package/lib/front_end/models/trace/helpers/TreeHelpers.ts +320 -0
  241. package/lib/front_end/models/trace/helpers/helpers.ts +11 -0
  242. package/lib/front_end/models/trace/insights/CLSCulprits.ts +668 -0
  243. package/lib/front_end/models/trace/insights/Cache.ts +269 -0
  244. package/lib/front_end/models/trace/insights/Common.ts +453 -0
  245. package/lib/front_end/models/trace/insights/DOMSize.ts +223 -0
  246. package/lib/front_end/models/trace/insights/DocumentLatency.ts +319 -0
  247. package/lib/front_end/models/trace/insights/DuplicatedJavaScript.ts +126 -0
  248. package/lib/front_end/models/trace/insights/FontDisplay.ts +119 -0
  249. package/lib/front_end/models/trace/insights/ForcedReflow.ts +220 -0
  250. package/lib/front_end/models/trace/insights/INPBreakdown.ts +171 -0
  251. package/lib/front_end/models/trace/insights/ImageDelivery.ts +348 -0
  252. package/lib/front_end/models/trace/insights/LCPBreakdown.ts +268 -0
  253. package/lib/front_end/models/trace/insights/LCPDiscovery.ts +237 -0
  254. package/lib/front_end/models/trace/insights/LegacyJavaScript.ts +138 -0
  255. package/lib/front_end/models/trace/insights/Models.ts +22 -0
  256. package/lib/front_end/models/trace/insights/ModernHTTP.ts +257 -0
  257. package/lib/front_end/models/trace/insights/NetworkDependencyTree.ts +726 -0
  258. package/lib/front_end/models/trace/insights/RenderBlocking.ts +257 -0
  259. package/lib/front_end/models/trace/insights/SlowCSSSelector.ts +175 -0
  260. package/lib/front_end/models/trace/insights/Statistics.ts +101 -0
  261. package/lib/front_end/models/trace/insights/ThirdParties.ts +130 -0
  262. package/lib/front_end/models/trace/insights/Viewport.ts +138 -0
  263. package/lib/front_end/models/trace/insights/insights.ts +10 -0
  264. package/lib/front_end/models/trace/insights/types.ts +157 -0
  265. package/lib/front_end/models/trace/lantern/core/LanternError.ts +7 -0
  266. package/lib/front_end/models/trace/lantern/core/NetworkAnalyzer.ts +619 -0
  267. package/lib/front_end/models/trace/lantern/core/core.ts +6 -0
  268. package/lib/front_end/models/trace/lantern/graph/BaseNode.ts +345 -0
  269. package/lib/front_end/models/trace/lantern/graph/CPUNode.ts +80 -0
  270. package/lib/front_end/models/trace/lantern/graph/NetworkNode.ts +101 -0
  271. package/lib/front_end/models/trace/lantern/graph/PageDependencyGraph.ts +636 -0
  272. package/lib/front_end/models/trace/lantern/graph/graph.ts +8 -0
  273. package/lib/front_end/models/trace/lantern/lantern.ts +17 -0
  274. package/lib/front_end/models/trace/lantern/metrics/FirstContentfulPaint.ts +187 -0
  275. package/lib/front_end/models/trace/lantern/metrics/Interactive.ts +88 -0
  276. package/lib/front_end/models/trace/lantern/metrics/LargestContentfulPaint.ts +92 -0
  277. package/lib/front_end/models/trace/lantern/metrics/MaxPotentialFID.ts +72 -0
  278. package/lib/front_end/models/trace/lantern/metrics/Metric.ts +126 -0
  279. package/lib/front_end/models/trace/lantern/metrics/SpeedIndex.ts +126 -0
  280. package/lib/front_end/models/trace/lantern/metrics/TBTUtils.ts +82 -0
  281. package/lib/front_end/models/trace/lantern/metrics/TotalBlockingTime.ts +112 -0
  282. package/lib/front_end/models/trace/lantern/metrics/metrics.ts +12 -0
  283. package/lib/front_end/models/trace/lantern/simulation/ConnectionPool.ts +150 -0
  284. package/lib/front_end/models/trace/lantern/simulation/Constants.ts +46 -0
  285. package/lib/front_end/models/trace/lantern/simulation/DNSCache.ts +61 -0
  286. package/lib/front_end/models/trace/lantern/simulation/SimulationTimingMap.ts +196 -0
  287. package/lib/front_end/models/trace/lantern/simulation/Simulator.ts +556 -0
  288. package/lib/front_end/models/trace/lantern/simulation/TCPConnection.ts +192 -0
  289. package/lib/front_end/models/trace/lantern/simulation/simulation.ts +10 -0
  290. package/lib/front_end/models/trace/lantern/types/Lantern.ts +220 -0
  291. package/lib/front_end/models/trace/lantern/types/types.ts +5 -0
  292. package/lib/front_end/models/trace/trace.ts +33 -0
  293. package/lib/front_end/models/trace/types/Configuration.ts +110 -0
  294. package/lib/front_end/models/trace/types/Extensions.ts +136 -0
  295. package/lib/front_end/models/trace/types/File.ts +281 -0
  296. package/lib/front_end/models/trace/types/Overlays.ts +138 -0
  297. package/lib/front_end/models/trace/types/Timing.ts +30 -0
  298. package/lib/front_end/models/trace/types/TraceEvents.ts +3277 -0
  299. package/lib/front_end/models/trace/types/types.ts +10 -0
  300. package/lib/front_end/third_party/i18n/LICENSE +202 -0
  301. package/lib/front_end/third_party/i18n/README.chromium +15 -0
  302. package/lib/front_end/third_party/i18n/i18n-impl.ts +61 -0
  303. package/lib/front_end/third_party/i18n/i18n.ts +11 -0
  304. package/lib/front_end/third_party/i18n/localized-string-set.ts +129 -0
  305. package/lib/front_end/third_party/intl-messageformat/LICENSE +33 -0
  306. package/lib/front_end/third_party/intl-messageformat/README.chromium +24 -0
  307. package/lib/front_end/third_party/intl-messageformat/intl-messageformat-tsconfig.json +16 -0
  308. package/lib/front_end/third_party/intl-messageformat/intl-messageformat.ts +6 -0
  309. package/lib/front_end/third_party/intl-messageformat/package/LICENSE.md +33 -0
  310. package/lib/front_end/third_party/intl-messageformat/package/README.md +3 -0
  311. package/lib/front_end/third_party/intl-messageformat/package/index.d.ts +6 -0
  312. package/lib/front_end/third_party/intl-messageformat/package/index.d.ts.map +1 -0
  313. package/lib/front_end/third_party/intl-messageformat/package/index.js +13 -0
  314. package/lib/front_end/third_party/intl-messageformat/package/intl-messageformat.esm.d.ts +5 -0
  315. package/lib/front_end/third_party/intl-messageformat/package/intl-messageformat.esm.js +1710 -0
  316. package/lib/front_end/third_party/intl-messageformat/package/intl-messageformat.iife.js +1815 -0
  317. package/lib/front_end/third_party/intl-messageformat/package/lib/index.d.ts +6 -0
  318. package/lib/front_end/third_party/intl-messageformat/package/lib/index.d.ts.map +1 -0
  319. package/lib/front_end/third_party/intl-messageformat/package/lib/index.js +10 -0
  320. package/lib/front_end/third_party/intl-messageformat/package/lib/src/core.d.ts +34 -0
  321. package/lib/front_end/third_party/intl-messageformat/package/lib/src/core.d.ts.map +1 -0
  322. package/lib/front_end/third_party/intl-messageformat/package/lib/src/core.js +229 -0
  323. package/lib/front_end/third_party/intl-messageformat/package/lib/src/error.d.ts +28 -0
  324. package/lib/front_end/third_party/intl-messageformat/package/lib/src/error.d.ts.map +1 -0
  325. package/lib/front_end/third_party/intl-messageformat/package/lib/src/error.js +48 -0
  326. package/lib/front_end/third_party/intl-messageformat/package/lib/src/formatters.d.ts +34 -0
  327. package/lib/front_end/third_party/intl-messageformat/package/lib/src/formatters.d.ts.map +1 -0
  328. package/lib/front_end/third_party/intl-messageformat/package/lib/src/formatters.js +179 -0
  329. package/lib/front_end/third_party/intl-messageformat/package/package.json +42 -0
  330. package/lib/front_end/third_party/intl-messageformat/package/src/core.d.ts +34 -0
  331. package/lib/front_end/third_party/intl-messageformat/package/src/core.d.ts.map +1 -0
  332. package/lib/front_end/third_party/intl-messageformat/package/src/core.js +230 -0
  333. package/lib/front_end/third_party/intl-messageformat/package/src/error.d.ts +28 -0
  334. package/lib/front_end/third_party/intl-messageformat/package/src/error.d.ts.map +1 -0
  335. package/lib/front_end/third_party/intl-messageformat/package/src/error.js +51 -0
  336. package/lib/front_end/third_party/intl-messageformat/package/src/formatters.d.ts +34 -0
  337. package/lib/front_end/third_party/intl-messageformat/package/src/formatters.d.ts.map +1 -0
  338. package/lib/front_end/third_party/intl-messageformat/package/src/formatters.js +182 -0
  339. package/lib/front_end/third_party/intl-messageformat/package/src/icu-messageformat-parser/error.d.ts +79 -0
  340. package/lib/front_end/third_party/intl-messageformat/package/src/icu-messageformat-parser/index.d.ts +15 -0
  341. package/lib/front_end/third_party/intl-messageformat/package/src/icu-messageformat-parser/parser.d.ts +153 -0
  342. package/lib/front_end/third_party/intl-messageformat/package/src/icu-messageformat-parser/types.d.ts +139 -0
  343. package/lib/front_end/third_party/legacy-javascript/LICENSE +202 -0
  344. package/lib/front_end/third_party/legacy-javascript/README.chromium +13 -0
  345. package/lib/front_end/third_party/legacy-javascript/legacy-javascript-tsconfig.json +8 -0
  346. package/lib/front_end/third_party/legacy-javascript/legacy-javascript.ts +3 -0
  347. package/lib/front_end/third_party/legacy-javascript/lib/legacy-javascript.d.ts +18 -0
  348. package/lib/front_end/third_party/legacy-javascript/lib/legacy-javascript.js +943 -0
  349. package/lib/front_end/third_party/legacy-javascript/package.json +8 -0
  350. package/lib/front_end/third_party/legacy-javascript/rebuild.sh +9 -0
  351. package/lib/front_end/third_party/third-party-web/LICENSE +20 -0
  352. package/lib/front_end/third_party/third-party-web/README.chromium +13 -0
  353. package/lib/front_end/third_party/third-party-web/lib/nostats-subset.d.ts +2 -0
  354. package/lib/front_end/third_party/third-party-web/lib/nostats-subset.js +149 -0
  355. package/lib/front_end/third_party/third-party-web/package/LICENSE +20 -0
  356. package/lib/front_end/third_party/third-party-web/package/README.md +929 -0
  357. package/lib/front_end/third_party/third-party-web/package/dist/entities-httparchive-nostats.json +1 -0
  358. package/lib/front_end/third_party/third-party-web/package/dist/entities-httparchive.json +1 -0
  359. package/lib/front_end/third_party/third-party-web/package/dist/entities-nostats.json +1 -0
  360. package/lib/front_end/third_party/third-party-web/package/dist/entities.json +1 -0
  361. package/lib/front_end/third_party/third-party-web/package/facades.md +46 -0
  362. package/lib/front_end/third_party/third-party-web/package/httparchive-nostats-subset.d.ts +1 -0
  363. package/lib/front_end/third_party/third-party-web/package/httparchive-nostats-subset.js +1 -0
  364. package/lib/front_end/third_party/third-party-web/package/httparchive-subset.d.ts +1 -0
  365. package/lib/front_end/third_party/third-party-web/package/httparchive-subset.js +1 -0
  366. package/lib/front_end/third_party/third-party-web/package/lib/__snapshots__/index.test.js.snap +1006 -0
  367. package/lib/front_end/third_party/third-party-web/package/lib/create-entity-finder-api.js +139 -0
  368. package/lib/front_end/third_party/third-party-web/package/lib/create-entity-finder-api.test.js +44 -0
  369. package/lib/front_end/third_party/third-party-web/package/lib/entities.test.js +27 -0
  370. package/lib/front_end/third_party/third-party-web/package/lib/index.d.ts +34 -0
  371. package/lib/front_end/third_party/third-party-web/package/lib/index.js +3 -0
  372. package/lib/front_end/third_party/third-party-web/package/lib/index.test.js +246 -0
  373. package/lib/front_end/third_party/third-party-web/package/lib/markdown/faqs.partial.md +36 -0
  374. package/lib/front_end/third_party/third-party-web/package/lib/markdown/goals.partial.md +9 -0
  375. package/lib/front_end/third_party/third-party-web/package/lib/markdown/methodology.partial.md +5 -0
  376. package/lib/front_end/third_party/third-party-web/package/lib/markdown/template.md +151 -0
  377. package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2019-02-01.md +1 -0
  378. package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2019-03-01.md +1 -0
  379. package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2019-05-06.md +1 -0
  380. package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2019-05-13.md +14 -0
  381. package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2021-01-01.md +1 -0
  382. package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2024-07-01.md +3 -0
  383. package/lib/front_end/third_party/third-party-web/package/lib/subsets/httparchive-nostats.d.ts +1 -0
  384. package/lib/front_end/third_party/third-party-web/package/lib/subsets/httparchive-nostats.js +3 -0
  385. package/lib/front_end/third_party/third-party-web/package/lib/subsets/httparchive.d.ts +1 -0
  386. package/lib/front_end/third_party/third-party-web/package/lib/subsets/httparchive.js +3 -0
  387. package/lib/front_end/third_party/third-party-web/package/lib/subsets/nostats.d.ts +1 -0
  388. package/lib/front_end/third_party/third-party-web/package/lib/subsets/nostats.js +3 -0
  389. package/lib/front_end/third_party/third-party-web/package/nostats-subset.d.ts +1 -0
  390. package/lib/front_end/third_party/third-party-web/package/nostats-subset.js +1 -0
  391. package/lib/front_end/third_party/third-party-web/package/package.json +46 -0
  392. package/lib/front_end/third_party/third-party-web/package.json +8 -0
  393. package/lib/front_end/third_party/third-party-web/rebuild.sh +13 -0
  394. package/lib/front_end/third_party/third-party-web/third-party-web-tsconfig.json +8 -0
  395. package/lib/front_end/third_party/third-party-web/third-party-web.ts +3 -0
  396. package/package.json +24 -0
  397. package/patches/chrome-devtools-frontend+1.0.1533544.patch +187 -0
@@ -0,0 +1,192 @@
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 i18n from '../i18n/i18n.js';
6
+ import type * as Platform from '../platform/platform.js';
7
+
8
+ const UIStrings = {
9
+ /**
10
+ * @description The UI destination when right clicking an item that can be revealed
11
+ */
12
+ elementsPanel: 'Elements panel',
13
+ /**
14
+ * @description The UI destination when right clicking an item that can be revealed
15
+ */
16
+ stylesSidebar: 'styles sidebar',
17
+ /**
18
+ * @description The UI destination when right clicking an item that can be revealed
19
+ */
20
+ changesDrawer: 'Changes drawer',
21
+ /**
22
+ * @description The UI destination when right clicking an item that can be revealed
23
+ */
24
+ issuesView: 'Issues view',
25
+ /**
26
+ * @description The UI destination when right clicking an item that can be revealed
27
+ */
28
+ networkPanel: 'Network panel',
29
+ /**
30
+ * @description The UI destination when right clicking an item that can be revealed
31
+ */
32
+ applicationPanel: 'Application panel',
33
+ /**
34
+ * @description The UI destination when right clicking an item that can be revealed
35
+ */
36
+ securityPanel: 'Security panel',
37
+ /**
38
+ * @description The UI destination when right clicking an item that can be revealed
39
+ */
40
+ sourcesPanel: 'Sources panel',
41
+ /**
42
+ * @description The UI destination when right clicking an item that can be revealed
43
+ */
44
+ timelinePanel: 'Performance panel',
45
+ /**
46
+ * @description The UI destination when right clicking an item that can be revealed
47
+ */
48
+ memoryInspectorPanel: 'Memory inspector panel',
49
+ /**
50
+ * @description The UI destination when revealing loaded resources through the Developer Resources Panel
51
+ */
52
+ developerResourcesPanel: 'Developer Resources panel',
53
+ /**
54
+ * @description The UI destination when revealing loaded resources through the Animations panel
55
+ */
56
+ animationsPanel: 'Animations panel',
57
+ } as const;
58
+ const str_ = i18n.i18n.registerUIStrings('core/common/Revealer.ts', UIStrings);
59
+ const i18nLazyString = i18n.i18n.getLazilyComputedLocalizedString.bind(undefined, str_);
60
+
61
+ /**
62
+ * Interface for global revealers, which are entities responsible for
63
+ * dealing with revealing certain types of objects. For example, the
64
+ * Sources panel will register a revealer for `UISourceCode` objects,
65
+ * which will ensure that its visible in an editor tab.
66
+ */
67
+ export interface Revealer<T> {
68
+ reveal(revealable: T, omitFocus?: boolean): Promise<void>;
69
+ }
70
+
71
+ let revealerRegistry: RevealerRegistry|undefined;
72
+
73
+ /**
74
+ * Registration for revealers, which deals with keeping a list of all possible
75
+ * revealers, lazily instantiating them as necessary and invoking their `reveal`
76
+ * methods depending on the _context types_ they were registered for.
77
+ *
78
+ * @see Revealer
79
+ */
80
+ export class RevealerRegistry {
81
+ private readonly registeredRevealers: Array<RevealerRegistration<unknown>> = [];
82
+
83
+ /**
84
+ * Yields the singleton instance, creating it on-demand when necessary.
85
+ *
86
+ * @returns the singleton instance.
87
+ */
88
+ static instance(): RevealerRegistry {
89
+ if (revealerRegistry === undefined) {
90
+ revealerRegistry = new RevealerRegistry();
91
+ }
92
+ return revealerRegistry;
93
+ }
94
+
95
+ /**
96
+ * Clears the singleton instance (if any).
97
+ */
98
+ static removeInstance(): void {
99
+ revealerRegistry = undefined;
100
+ }
101
+
102
+ /**
103
+ * Register a new `Revealer` as described by the `registration`.
104
+ *
105
+ * @param registration the description.
106
+ */
107
+ register(registration: RevealerRegistration<unknown>): void {
108
+ this.registeredRevealers.push(registration);
109
+ }
110
+
111
+ /**
112
+ * Reveals the `revealable`.
113
+ *
114
+ * @param revealable the object to reveal.
115
+ * @param omitFocus whether to omit focusing on the presentation of `revealable` afterwards.
116
+ */
117
+ async reveal(revealable: unknown, omitFocus: boolean): Promise<void> {
118
+ const revealers = await Promise.all(
119
+ this.getApplicableRegisteredRevealers(revealable).map(registration => registration.loadRevealer()));
120
+ if (revealers.length < 1) {
121
+ throw new Error(`No revealers found for ${revealable}`);
122
+ }
123
+ if (revealers.length > 1) {
124
+ throw new Error(`Conflicting reveals found for ${revealable}`);
125
+ }
126
+ return await revealers[0].reveal(revealable, omitFocus);
127
+ }
128
+
129
+ getApplicableRegisteredRevealers(revealable: unknown): Array<RevealerRegistration<unknown>> {
130
+ return this.registeredRevealers.filter(registration => {
131
+ for (const contextType of registration.contextTypes()) {
132
+ if (revealable instanceof contextType) {
133
+ return true;
134
+ }
135
+ }
136
+ return false;
137
+ });
138
+ }
139
+ }
140
+
141
+ export function revealDestination(revealable: unknown): string|null {
142
+ const revealers = RevealerRegistry.instance().getApplicableRegisteredRevealers(revealable);
143
+ for (const {destination} of revealers) {
144
+ if (destination) {
145
+ return destination();
146
+ }
147
+ }
148
+ return null;
149
+ }
150
+
151
+ /**
152
+ * Register a new `Revealer` as described by the `registration` on the singleton
153
+ * {@link RevealerRegistry} instance.
154
+ *
155
+ * @param registration the description.
156
+ */
157
+ export function registerRevealer<T>(registration: RevealerRegistration<T>): void {
158
+ RevealerRegistry.instance().register(registration);
159
+ }
160
+
161
+ /**
162
+ * Reveals the `revealable` via the singleton {@link RevealerRegistry} instance.
163
+ *
164
+ * @param revealable the object to reveal.
165
+ * @param omitFocus whether to omit focusing on the presentation of `revealable` afterwards.
166
+ */
167
+ export async function reveal(revealable: unknown, omitFocus = false): Promise<void> {
168
+ await RevealerRegistry.instance().reveal(revealable, omitFocus);
169
+ }
170
+
171
+ export interface RevealerRegistration<T> {
172
+ contextTypes: () => Array<abstract new(...any: any[]) => T>;
173
+ loadRevealer: () => Promise<Revealer<T>>;
174
+ destination?: RevealerDestination;
175
+ }
176
+
177
+ export const RevealerDestination = {
178
+ DEVELOPER_RESOURCES_PANEL: i18nLazyString(UIStrings.developerResourcesPanel),
179
+ ELEMENTS_PANEL: i18nLazyString(UIStrings.elementsPanel),
180
+ STYLES_SIDEBAR: i18nLazyString(UIStrings.stylesSidebar),
181
+ CHANGES_DRAWER: i18nLazyString(UIStrings.changesDrawer),
182
+ ISSUES_VIEW: i18nLazyString(UIStrings.issuesView),
183
+ NETWORK_PANEL: i18nLazyString(UIStrings.networkPanel),
184
+ TIMELINE_PANEL: i18nLazyString(UIStrings.timelinePanel),
185
+ APPLICATION_PANEL: i18nLazyString(UIStrings.applicationPanel),
186
+ SOURCES_PANEL: i18nLazyString(UIStrings.sourcesPanel),
187
+ SECURITY_PANEL: i18nLazyString(UIStrings.securityPanel),
188
+ MEMORY_INSPECTOR_PANEL: i18nLazyString(UIStrings.memoryInspectorPanel),
189
+ ANIMATIONS_PANEL: i18nLazyString(UIStrings.animationsPanel),
190
+ };
191
+
192
+ export type RevealerDestination = () => Platform.UIString.LocalizedString;
@@ -0,0 +1,41 @@
1
+ // Copyright 2019 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 interface Runnable {
6
+ run(): Promise<void>;
7
+ }
8
+
9
+ type LateInitializationLoader = () => Promise<Runnable>;
10
+ export interface LateInitializableRunnableSetting {
11
+ id: string;
12
+ loadRunnable: LateInitializationLoader;
13
+ }
14
+
15
+ const registeredLateInitializationRunnables = new Map<string, LateInitializationLoader>();
16
+
17
+ export function registerLateInitializationRunnable(setting: LateInitializableRunnableSetting): void {
18
+ const {id, loadRunnable} = setting;
19
+ if (registeredLateInitializationRunnables.has(id)) {
20
+ throw new Error(`Duplicate late Initializable runnable id '${id}'`);
21
+ }
22
+ registeredLateInitializationRunnables.set(id, loadRunnable);
23
+ }
24
+
25
+ export function maybeRemoveLateInitializationRunnable(runnableId: string): boolean {
26
+ return registeredLateInitializationRunnables.delete(runnableId);
27
+ }
28
+
29
+ export function lateInitializationRunnables(): LateInitializationLoader[] {
30
+ return [...registeredLateInitializationRunnables.values()];
31
+ }
32
+
33
+ const registeredEarlyInitializationRunnables: Array<() => Runnable> = [];
34
+
35
+ export function registerEarlyInitializationRunnable(runnable: () => Runnable): void {
36
+ registeredEarlyInitializationRunnables.push(runnable);
37
+ }
38
+
39
+ export function earlyInitializationRunnables(): Array<() => Runnable> {
40
+ return registeredEarlyInitializationRunnables;
41
+ }
@@ -0,0 +1,87 @@
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 * as Platform from '../platform/platform.js';
6
+
7
+ export class Segment<T> {
8
+ begin: number;
9
+ end: number;
10
+ data: T;
11
+
12
+ constructor(begin: number, end: number, data: T) {
13
+ if (begin > end) {
14
+ throw new Error('Invalid segment');
15
+ }
16
+ this.begin = begin;
17
+ this.end = end;
18
+ this.data = data;
19
+ }
20
+
21
+ intersects(that: Segment<T>): boolean {
22
+ return this.begin < that.end && that.begin < this.end;
23
+ }
24
+ }
25
+
26
+ export class SegmentedRange<T> {
27
+ #segments: Array<Segment<T>>;
28
+ readonly #mergeCallback: ((arg0: Segment<T>, arg1: Segment<T>) => Segment<T>| null)|undefined;
29
+
30
+ constructor(mergeCallback?: ((arg0: Segment<T>, arg1: Segment<T>) => Segment<T>| null)) {
31
+ this.#segments = [];
32
+ this.#mergeCallback = mergeCallback;
33
+ }
34
+
35
+ append(newSegment: Segment<T>): void {
36
+ // 1. Find the proper insertion point for new segment
37
+ let startIndex = Platform.ArrayUtilities.lowerBound(this.#segments, newSegment, (a, b) => a.begin - b.begin);
38
+ let endIndex = startIndex;
39
+ let merged: (Segment<T>|null)|null = null;
40
+ if (startIndex > 0) {
41
+ // 2. Try mering the preceding segment
42
+ const precedingSegment = this.#segments[startIndex - 1];
43
+ merged = this.tryMerge(precedingSegment, newSegment);
44
+ if (merged) {
45
+ --startIndex;
46
+ newSegment = merged;
47
+ } else if (this.#segments[startIndex - 1].end >= newSegment.begin) {
48
+ // 2a. If merge failed and segments overlap, adjust preceding segment.
49
+ // If an old segment entirely contains new one, split it in two.
50
+ if (newSegment.end < precedingSegment.end) {
51
+ this.#segments.splice(
52
+ startIndex, 0, new Segment<T>(newSegment.end, precedingSegment.end, precedingSegment.data));
53
+ }
54
+ precedingSegment.end = newSegment.begin;
55
+ }
56
+ }
57
+ // 3. Consume all segments that are entirely covered by the new one.
58
+ while (endIndex < this.#segments.length && this.#segments[endIndex].end <= newSegment.end) {
59
+ ++endIndex;
60
+ }
61
+ // 4. Merge or adjust the succeeding segment if it overlaps.
62
+ if (endIndex < this.#segments.length) {
63
+ merged = this.tryMerge(newSegment, this.#segments[endIndex]);
64
+ if (merged) {
65
+ endIndex++;
66
+ newSegment = merged;
67
+ } else if (newSegment.intersects(this.#segments[endIndex])) {
68
+ this.#segments[endIndex].begin = newSegment.end;
69
+ }
70
+ }
71
+ this.#segments.splice(startIndex, endIndex - startIndex, newSegment);
72
+ }
73
+
74
+ segments(): Array<Segment<T>> {
75
+ return this.#segments;
76
+ }
77
+
78
+ private tryMerge(first: Segment<T>, second: Segment<T>): Segment<T>|null {
79
+ const merged = this.#mergeCallback && this.#mergeCallback(first, second);
80
+ if (!merged) {
81
+ return null;
82
+ }
83
+ merged.begin = first.begin;
84
+ merged.end = Math.max(first.end, second.end);
85
+ return merged;
86
+ }
87
+ }
@@ -0,0 +1,339 @@
1
+ // Copyright 2020 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 i18n from '../i18n/i18n.js';
6
+ import type * as Platform from '../platform/platform.js';
7
+ import * as Root from '../root/root.js';
8
+
9
+ import type {SettingStorageType} from './Settings.js';
10
+
11
+ const UIStrings = {
12
+ /**
13
+ * @description Title of the Elements Panel
14
+ */
15
+ elements: 'Elements',
16
+ /**
17
+ * @description Text for DevTools AI
18
+ */
19
+ ai: 'AI',
20
+ /**
21
+ * @description Text for DevTools appearance
22
+ */
23
+ appearance: 'Appearance',
24
+ /**
25
+ * @description Name of the Sources panel
26
+ */
27
+ sources: 'Sources',
28
+ /**
29
+ * @description Title of the Network tool
30
+ */
31
+ network: 'Network',
32
+ /**
33
+ * @description Text for the performance of something
34
+ */
35
+ performance: 'Performance',
36
+ /**
37
+ * @description Title of the Console tool
38
+ */
39
+ console: 'Console',
40
+ /**
41
+ * @description A title of the 'Persistence' setting category
42
+ */
43
+ persistence: 'Persistence',
44
+ /**
45
+ * @description Text that refers to the debugger
46
+ */
47
+ debugger: 'Debugger',
48
+ /**
49
+ * @description Text describing global shortcuts and settings that are available throughout the DevTools
50
+ */
51
+ global: 'Global',
52
+ /**
53
+ * @description Title of the Rendering tool
54
+ */
55
+ rendering: 'Rendering',
56
+ /**
57
+ * @description Title of a section on CSS Grid tooling
58
+ */
59
+ grid: 'Grid',
60
+ /**
61
+ * @description Text for the mobile platform, as opposed to desktop
62
+ */
63
+ mobile: 'Mobile',
64
+ /**
65
+ * @description Text for the memory of the page
66
+ */
67
+ memory: 'Memory',
68
+ /**
69
+ * @description Text for the extension of the page
70
+ */
71
+ extension: 'Extension',
72
+ /**
73
+ * @description Text for the adorner of the page
74
+ */
75
+ adorner: 'Adorner',
76
+ /**
77
+ * @description Header for the "Account" section in the settings UI. The "Account"
78
+ * section allows users see their signed in account and configure which DevTools data is synced via Chrome Sync.
79
+ */
80
+ account: 'Account',
81
+ /**
82
+ * @description Text for the privacy section of the page.
83
+ */
84
+ privacy: 'Privacy',
85
+ } as const;
86
+ const str_ = i18n.i18n.registerUIStrings('core/common/SettingRegistration.ts', UIStrings);
87
+ const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
88
+ let registeredSettings: SettingRegistration[] = [];
89
+ const settingNameSet = new Set<string>();
90
+
91
+ export function registerSettingExtension(registration: SettingRegistration): void {
92
+ const settingName = registration.settingName;
93
+ if (settingNameSet.has(settingName)) {
94
+ throw new Error(`Duplicate setting name '${settingName}'`);
95
+ }
96
+ settingNameSet.add(settingName);
97
+ registeredSettings.push(registration);
98
+ }
99
+
100
+ export function getRegisteredSettings(): SettingRegistration[] {
101
+ return registeredSettings.filter(setting => Root.Runtime.Runtime.isDescriptorEnabled(setting));
102
+ }
103
+
104
+ export function registerSettingsForTest(settings: SettingRegistration[], forceReset = false): void {
105
+ if (registeredSettings.length === 0 || forceReset) {
106
+ registeredSettings = settings;
107
+ settingNameSet.clear();
108
+ for (const setting of settings) {
109
+ const settingName = setting.settingName;
110
+ if (settingNameSet.has(settingName)) {
111
+ throw new Error(`Duplicate setting name '${settingName}'`);
112
+ }
113
+ settingNameSet.add(settingName);
114
+ }
115
+ }
116
+ }
117
+
118
+ export function resetSettings(): void {
119
+ registeredSettings = [];
120
+ settingNameSet.clear();
121
+ }
122
+
123
+ export function maybeRemoveSettingExtension(settingName: string): boolean {
124
+ const settingIndex = registeredSettings.findIndex(setting => setting.settingName === settingName);
125
+ if (settingIndex < 0 || !settingNameSet.delete(settingName)) {
126
+ return false;
127
+ }
128
+ registeredSettings.splice(settingIndex, 1);
129
+ return true;
130
+ }
131
+
132
+ export const enum SettingCategory {
133
+ NONE = '', // `NONE` must be a falsy value. Legacy code uses if-checks for the category.
134
+ ELEMENTS = 'ELEMENTS',
135
+ AI = 'AI',
136
+ APPEARANCE = 'APPEARANCE',
137
+ SOURCES = 'SOURCES',
138
+ NETWORK = 'NETWORK',
139
+ PERFORMANCE = 'PERFORMANCE',
140
+ CONSOLE = 'CONSOLE',
141
+ PERSISTENCE = 'PERSISTENCE',
142
+ DEBUGGER = 'DEBUGGER',
143
+ GLOBAL = 'GLOBAL',
144
+ RENDERING = 'RENDERING',
145
+ GRID = 'GRID',
146
+ MOBILE = 'MOBILE',
147
+ EMULATION = 'EMULATION',
148
+ MEMORY = 'MEMORY',
149
+ EXTENSIONS = 'EXTENSIONS',
150
+ ADORNER = 'ADORNER',
151
+ ACCOUNT = 'ACCOUNT',
152
+ PRIVACY = 'PRIVACY',
153
+ }
154
+
155
+ export function getLocalizedSettingsCategory(category: SettingCategory): Platform.UIString.LocalizedString {
156
+ switch (category) {
157
+ case SettingCategory.ELEMENTS:
158
+ return i18nString(UIStrings.elements);
159
+ case SettingCategory.AI:
160
+ return i18nString(UIStrings.ai);
161
+ case SettingCategory.APPEARANCE:
162
+ return i18nString(UIStrings.appearance);
163
+ case SettingCategory.SOURCES:
164
+ return i18nString(UIStrings.sources);
165
+ case SettingCategory.NETWORK:
166
+ return i18nString(UIStrings.network);
167
+ case SettingCategory.PERFORMANCE:
168
+ return i18nString(UIStrings.performance);
169
+ case SettingCategory.CONSOLE:
170
+ return i18nString(UIStrings.console);
171
+ case SettingCategory.PERSISTENCE:
172
+ return i18nString(UIStrings.persistence);
173
+ case SettingCategory.DEBUGGER:
174
+ return i18nString(UIStrings.debugger);
175
+ case SettingCategory.GLOBAL:
176
+ return i18nString(UIStrings.global);
177
+ case SettingCategory.RENDERING:
178
+ return i18nString(UIStrings.rendering);
179
+ case SettingCategory.GRID:
180
+ return i18nString(UIStrings.grid);
181
+ case SettingCategory.MOBILE:
182
+ return i18nString(UIStrings.mobile);
183
+ case SettingCategory.EMULATION:
184
+ return i18nString(UIStrings.console);
185
+ case SettingCategory.MEMORY:
186
+ return i18nString(UIStrings.memory);
187
+ case SettingCategory.EXTENSIONS:
188
+ return i18nString(UIStrings.extension);
189
+ case SettingCategory.ADORNER:
190
+ return i18nString(UIStrings.adorner);
191
+ case SettingCategory.NONE:
192
+ return i18n.i18n.lockedString('');
193
+ case SettingCategory.ACCOUNT:
194
+ return i18nString(UIStrings.account);
195
+ case SettingCategory.PRIVACY:
196
+ return i18nString(UIStrings.privacy);
197
+ }
198
+ }
199
+
200
+ export const enum SettingType {
201
+ ARRAY = 'array',
202
+ REGEX = 'regex',
203
+ ENUM = 'enum',
204
+ BOOLEAN = 'boolean',
205
+ }
206
+
207
+ export interface RegExpSettingItem {
208
+ /**
209
+ * A regular expression matched against URLs for ignore listing.
210
+ */
211
+ pattern: string;
212
+ /**
213
+ * If true, ignore this rule.
214
+ */
215
+ disabled?: boolean;
216
+ /**
217
+ * When a rule is disabled due to requesting through a script's context menu
218
+ * that it no longer be ignore listed, this field is set to the URL of that
219
+ * script, so that if the user requests through the same context menu to
220
+ * enable ignore listing, the rule can be reenabled.
221
+ */
222
+ disabledForUrl?: Platform.DevToolsPath.UrlString;
223
+ }
224
+
225
+ export interface SettingRegistration {
226
+ /**
227
+ * The category with which the setting is displayed in the UI.
228
+ */
229
+ category?: SettingCategory;
230
+ /**
231
+ * Used to sort on screen the settings that belong to the same category.
232
+ */
233
+ order?: number;
234
+ /**
235
+ * The title with which the setting is shown on screen.
236
+ */
237
+ title?: () => Platform.UIString.LocalizedString;
238
+ /**
239
+ * The identifier of the setting.
240
+ */
241
+ settingName: string;
242
+ /**
243
+ * Determines how the possible values of the setting are expressed.
244
+ *
245
+ * - If the setting can only be enabled and disabled use BOOLEAN
246
+ * - If the setting has a list of possible values use ENUM
247
+ * - If each setting value is a set of objects use ARRAY
248
+ * - If the setting value is a regular expression use REGEX
249
+ */
250
+ settingType: SettingType;
251
+ /**
252
+ * The value set by default to the setting.
253
+ */
254
+ defaultValue: unknown;
255
+ /**
256
+ * Words used to find a setting in the Command Menu.
257
+ */
258
+ tags?: Array<() => Platform.UIString.LocalizedString>;
259
+ /**
260
+ * The possible values the setting can have, each with a description composed of a title and an optional text.
261
+ */
262
+ options?: SettingExtensionOption[];
263
+ /**
264
+ * Whether DevTools must be reloaded for a change in the setting to take effect.
265
+ */
266
+ reloadRequired?: boolean;
267
+ /**
268
+ * Determines if the setting value is stored in the global, local or session storage.
269
+ */
270
+ storageType?: SettingStorageType;
271
+ /**
272
+ * A condition that, when present in the queryParamsObject of Runtime, constraints the value
273
+ * of the setting to be changed only if the user set it.
274
+ */
275
+ userActionCondition?: string;
276
+ /**
277
+ * The name of the experiment a setting is associated with. Enabling and disabling the declared
278
+ * experiment will enable and disable the setting respectively.
279
+ */
280
+ experiment?: Root.Runtime.ExperimentName;
281
+ /**
282
+ * A condition is a function that will make the setting available if it
283
+ * returns true, and not available, otherwise. Make sure that objects you
284
+ * access from inside the condition function are ready at the time when the
285
+ * setting conditions are checked.
286
+ */
287
+ condition?: Root.Runtime.Condition;
288
+
289
+ /**
290
+ * A function that returns true if the setting should be disabled, along with
291
+ * the reason why.
292
+ */
293
+ disabledCondition?: (config?: Root.Runtime.HostConfig) => DisabledConditionResult;
294
+
295
+ /**
296
+ * If a setting is deprecated, define this notice to show an appropriate warning according to the `warning` property.
297
+ * If `disabled` is set, the setting will be disabled in the settings UI. In that case, `experiment` optionally can be
298
+ * set to link to an experiment (by experiment name). The information icon in the settings UI can then be clicked to
299
+ * jump to the experiment. If a setting is not disabled, the experiment entry will be ignored.
300
+ */
301
+ deprecationNotice?: {disabled: boolean, warning: () => Platform.UIString.LocalizedString, experiment?: string};
302
+
303
+ /**
304
+ * Optional information to learn more about the setting. If provided, a `(?)` icon will show next to the setting
305
+ * in the Settings panel with a link to learn more, and the `tooltip` will be presented to the user when hovering
306
+ * the `(?)` icon.
307
+ */
308
+ learnMore?: LearnMore;
309
+ }
310
+
311
+ /**
312
+ * Metadata to learn more about a setting. The `url` will be used to construct
313
+ * a `(?)` icon link and the `tooltip` will be shown when hovering the icon.
314
+ */
315
+ export interface LearnMore {
316
+ tooltip: () => Platform.UIString.LocalizedString;
317
+ url?: Platform.DevToolsPath.UrlString;
318
+ }
319
+
320
+ interface LocalizedSettingExtensionOption {
321
+ value: boolean|string;
322
+ title: () => Platform.UIString.LocalizedString;
323
+ text?: () => Platform.UIString.LocalizedString;
324
+ raw?: false;
325
+ }
326
+ interface RawSettingExtensionOption {
327
+ value: boolean|string;
328
+ title: () => Platform.UIString.LocalizedString;
329
+ /**
330
+ * Text used to describe the option. Must be localized if 'raw' is false.
331
+ */
332
+ text?: string;
333
+ raw: true;
334
+ }
335
+ export type SettingExtensionOption = LocalizedSettingExtensionOption|RawSettingExtensionOption;
336
+ export type DisabledConditionResult = {
337
+ disabled: true,
338
+ reasons: Platform.UIString.LocalizedString[],
339
+ }|{disabled: false};