chrome-devtools-frontend 1.0.1690116 → 1.0.1695017

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 (421) hide show
  1. package/.agents/skills/devtools-model-management/SKILL.md +3 -3
  2. package/.agents/skills/foundation-test-migration/SKILL.md +2 -2
  3. package/.agents/skills/merging-devtools-module/SKILL.md +5 -5
  4. package/AUTHORS +3 -0
  5. package/config/typescript/tsconfig.base.json +1 -0
  6. package/docs/get_the_code.md +4 -9
  7. package/front_end/Images/src/comment-mode-cursor.svg +23 -0
  8. package/front_end/Tests.js +1 -1
  9. package/front_end/application_tokens.css +5 -0
  10. package/front_end/core/common/ColorConverter.ts +3 -3
  11. package/front_end/core/host/UserMetrics.ts +27 -0
  12. package/front_end/core/protocol_client/DevToolsCDPConnection.ts +0 -46
  13. package/front_end/core/protocol_client/InspectorBackend.ts +6 -6
  14. package/front_end/core/root/Runtime.ts +1 -0
  15. package/front_end/core/sdk/CSSLocation.ts +32 -0
  16. package/front_end/core/sdk/CSSModel.ts +2 -22
  17. package/front_end/core/sdk/CSSQuery.ts +2 -1
  18. package/front_end/core/sdk/CSSRule.ts +29 -0
  19. package/front_end/core/sdk/DebuggerModel.ts +5 -1
  20. package/front_end/core/sdk/NetworkManager.ts +2 -0
  21. package/front_end/core/sdk/NetworkRequest.ts +63 -4
  22. package/front_end/core/sdk/NetworkRequestAccess.ts +191 -0
  23. package/front_end/core/sdk/ResourceTreeModel.ts +72 -23
  24. package/front_end/core/sdk/SecurityOrigin.ts +97 -12
  25. package/front_end/core/sdk/Target.ts +18 -0
  26. package/front_end/core/sdk/sdk.ts +4 -0
  27. package/front_end/entrypoints/main/MainImpl.ts +8 -1
  28. package/front_end/foundation/Universe.ts +14 -11
  29. package/front_end/generated/Deprecation.ts +8 -0
  30. package/front_end/generated/InspectorBackendCommands.ts +9 -8
  31. package/front_end/generated/SupportedCSSProperties.ts +14 -4
  32. package/front_end/generated/protocol.ts +24 -0
  33. package/front_end/models/ai_assistance/AiAgent2.ts +46 -10
  34. package/front_end/models/ai_assistance/AiConversation.ts +35 -24
  35. package/front_end/models/ai_assistance/README.md +5 -3
  36. package/front_end/models/ai_assistance/agents/AccessibilityAgent.ts +1 -0
  37. package/front_end/models/ai_assistance/agents/AiAgent.ts +28 -34
  38. package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +13 -17
  39. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +5 -3
  40. package/front_end/models/ai_assistance/agents/StorageAgent.ts +16 -10
  41. package/front_end/models/ai_assistance/agents/StylingAgent.ts +3 -4
  42. package/front_end/models/ai_assistance/ai_assistance.ts +0 -2
  43. package/front_end/models/ai_assistance/contexts/AccessibilityContext.ts +11 -2
  44. package/front_end/models/ai_assistance/contexts/DOMNodeContext.ts +17 -5
  45. package/front_end/models/ai_assistance/contexts/FileContext.ts +13 -6
  46. package/front_end/models/ai_assistance/contexts/PerformanceTraceContext.ts +52 -25
  47. package/front_end/models/ai_assistance/contexts/RequestContext.ts +18 -34
  48. package/front_end/models/ai_assistance/contexts/StorageContext.ts +14 -3
  49. package/front_end/models/ai_assistance/data_formatters/FileFormatter.ts +2 -5
  50. package/front_end/models/ai_assistance/data_formatters/NetworkRequestFormatter.ts +135 -58
  51. package/front_end/models/ai_assistance/tools/CookieUtils.ts +25 -35
  52. package/front_end/models/ai_assistance/tools/DOMStorageUtils.ts +6 -3
  53. package/front_end/models/ai_assistance/tools/ExecuteJavaScript.ts +9 -2
  54. package/front_end/models/ai_assistance/tools/GetCookieValues.ts +1 -1
  55. package/front_end/models/ai_assistance/tools/GetElementAccessibilityDetails.ts +3 -2
  56. package/front_end/models/ai_assistance/tools/GetFunctionCode.ts +3 -5
  57. package/front_end/models/ai_assistance/tools/GetInsightDetails.ts +1 -1
  58. package/front_end/models/ai_assistance/tools/GetNetworkRequestDetails.ts +8 -11
  59. package/front_end/models/ai_assistance/tools/GetResourceContent.ts +2 -4
  60. package/front_end/models/ai_assistance/tools/GetSourceContent.ts +6 -13
  61. package/front_end/models/ai_assistance/tools/GetStorageBreakdown.ts +1 -1
  62. package/front_end/models/ai_assistance/tools/GetStorageValues.ts +9 -9
  63. package/front_end/models/ai_assistance/tools/GetStyles.ts +3 -2
  64. package/front_end/models/ai_assistance/tools/ListCookies.ts +1 -1
  65. package/front_end/models/ai_assistance/tools/ListNetworkRequests.ts +6 -14
  66. package/front_end/models/ai_assistance/tools/ListPageOrigins.ts +10 -15
  67. package/front_end/models/ai_assistance/tools/ListSources.ts +5 -7
  68. package/front_end/models/ai_assistance/tools/ListStorageKeys.ts +9 -9
  69. package/front_end/models/ai_assistance/tools/README.md +4 -2
  70. package/front_end/models/ai_assistance/tools/ResolveDevtoolsNodePath.ts +3 -2
  71. package/front_end/models/ai_assistance/tools/Tool.ts +27 -3
  72. package/front_end/models/comment_manager/CD4ABridge.ts +128 -0
  73. package/front_end/models/comment_manager/CommentManager.ts +50 -8
  74. package/front_end/models/comment_manager/comment_manager.ts +2 -0
  75. package/front_end/models/emulation/DeviceModeModel.ts +37 -47
  76. package/front_end/models/javascript_metadata/NativeFunctions.ts +9 -1
  77. package/front_end/models/live-metrics/web-vitals-injected/README.md +1 -1
  78. package/front_end/models/source_map_scopes/NamesResolver.ts +9 -7
  79. package/front_end/models/trace/ModelImpl.ts +2 -0
  80. package/front_end/models/trace/Processor.ts +6 -4
  81. package/front_end/models/trace/handlers/LayerTreeHandler.ts +3 -3
  82. package/front_end/models/trace/handlers/LayoutShiftsHandler.ts +1 -1
  83. package/front_end/models/trace/helpers/SyntheticEvents.ts +23 -1
  84. package/front_end/models/trace/types/Configuration.ts +7 -0
  85. package/front_end/models/trace/types/TraceEvents.ts +20 -4
  86. package/front_end/panels/accessibility/ARIAAttributesView.ts +3 -0
  87. package/front_end/panels/accessibility/AccessibilityAnnouncementRecordingListView.ts +177 -0
  88. package/front_end/panels/accessibility/accessibility.ts +2 -0
  89. package/front_end/panels/accessibility/accessibilityAnnouncementRecordingListView.css +33 -0
  90. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +25 -15
  91. package/front_end/panels/ai_assistance/components/ChatMessage.ts +6 -35
  92. package/front_end/panels/ai_assistance/components/DisabledWidget.ts +4 -3
  93. package/front_end/panels/ai_assistance/components/chatMessage.css +3 -1
  94. package/front_end/panels/animation/AnimationTimeline.ts +1 -0
  95. package/front_end/panels/application/CrashReportContextView.ts +0 -1
  96. package/front_end/panels/application/FrameDetailsView.ts +5 -4
  97. package/front_end/panels/application/IndexedDBViews.ts +4 -4
  98. package/front_end/panels/application/components/BackForwardCacheView.ts +1 -1
  99. package/front_end/panels/application/components/EndpointsGrid.ts +2 -1
  100. package/front_end/panels/application/components/PermissionsPolicySection.ts +1 -1
  101. package/front_end/panels/application/components/ServiceWorkerRouterView.ts +1 -1
  102. package/front_end/panels/application/components/TrustTokensView.ts +1 -1
  103. package/front_end/panels/application/indexedDBViews.css +0 -14
  104. package/front_end/panels/application/preloading/components/PreloadingDetailsReportView.ts +2 -1
  105. package/front_end/panels/application/preloading/components/RuleSetDetailsView.ts +2 -1
  106. package/front_end/panels/application/preloading/components/UsedPreloadingView.ts +1 -1
  107. package/front_end/panels/common/CPUThrottlingOption.ts +12 -6
  108. package/front_end/panels/common/DOMLinkifier.ts +1 -1
  109. package/front_end/panels/common/ExtensionView.ts +2 -1
  110. package/front_end/panels/console/ConsoleContextSelector.ts +12 -5
  111. package/front_end/panels/console/ConsolePinPane.ts +4 -2
  112. package/front_end/panels/console/ConsoleSidebar.ts +6 -2
  113. package/front_end/panels/console/ConsoleViewMessage.ts +12 -8
  114. package/front_end/panels/console/PromptBuilder.ts +1 -1
  115. package/front_end/panels/coverage/CoverageListView.ts +1 -1
  116. package/front_end/panels/coverage/CoverageModel.ts +6 -4
  117. package/front_end/panels/coverage/coverageView.css +8 -8
  118. package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +13 -14
  119. package/front_end/panels/css_overview/CSSOverviewPanel.ts +3 -3
  120. package/front_end/panels/css_overview/CSSOverviewProcessingView.ts +2 -2
  121. package/front_end/panels/css_overview/CSSOverviewSidebarPanel.ts +3 -3
  122. package/front_end/panels/css_overview/CSSOverviewStartView.ts +3 -3
  123. package/front_end/panels/developer_resources/DeveloperResourcesListView.ts +1 -1
  124. package/front_end/panels/developer_resources/developerResourcesView.css +3 -3
  125. package/front_end/panels/elements/ComputedStyleWidget.ts +1 -1
  126. package/front_end/panels/elements/ElementsTreeElement.ts +43 -15
  127. package/front_end/panels/elements/ElementsTreeOutline.ts +185 -109
  128. package/front_end/panels/elements/MetricsSidebarPane.ts +1 -1
  129. package/front_end/panels/elements/PropertyNameCategories.ts +1 -1
  130. package/front_end/panels/elements/ShortcutTreeElement.ts +6 -1
  131. package/front_end/panels/elements/StandaloneStylesContainer.ts +1 -1
  132. package/front_end/panels/elements/StylePropertiesSection.ts +2 -35
  133. package/front_end/panels/elements/StylesSidebarPane.ts +3 -2
  134. package/front_end/panels/elements/components/CSSPropertyIconResolver.ts +5 -4
  135. package/front_end/panels/elements/components/StylePropertyEditor.ts +161 -148
  136. package/front_end/panels/elements/components/computedStyleProperty.css +5 -5
  137. package/front_end/panels/elements/components/computedStyleTrace.css +5 -5
  138. package/front_end/panels/elements/components/cssHintDetailsView.css +1 -1
  139. package/front_end/panels/elements/components/cssPropertyDocsView.css +3 -3
  140. package/front_end/panels/elements/components/cssVariableValueView.css +4 -4
  141. package/front_end/panels/elements/components/elementsBreadcrumbs.css +3 -3
  142. package/front_end/panels/elements/components/elementsTreeExpandButton.css +5 -5
  143. package/front_end/panels/elements/components/queryContainer.css +2 -2
  144. package/front_end/panels/elements/elementsTreeOutline.css +20 -4
  145. package/front_end/panels/emulation/MediaQueryInspector.ts +2 -1
  146. package/front_end/panels/event_listeners/eventListenersView.css +1 -1
  147. package/front_end/panels/issues/AffectedElementsView.ts +3 -0
  148. package/front_end/panels/issues/AffectedLazyLoadImagesView.ts +1 -1
  149. package/front_end/panels/issues/issues.ts +2 -0
  150. package/front_end/panels/layer_viewer/LayerDetailsView.ts +12 -10
  151. package/front_end/panels/layer_viewer/LayerTreeOutline.ts +1 -0
  152. package/front_end/panels/layer_viewer/Layers3DView.ts +13 -11
  153. package/front_end/panels/linear_memory_inspector/components/LinearMemoryHighlightChipList.ts +1 -1
  154. package/front_end/panels/linear_memory_inspector/components/LinearMemoryInspectorUtils.ts +2 -2
  155. package/front_end/panels/linear_memory_inspector/components/ValueInterpreterDisplayUtils.ts +1 -1
  156. package/front_end/panels/linear_memory_inspector/components/ValueInterpreterSettings.ts +1 -1
  157. package/front_end/panels/linear_memory_inspector/components/linearMemoryHighlightChipList.css +11 -11
  158. package/front_end/panels/linear_memory_inspector/components/linearMemoryInspector.css +2 -2
  159. package/front_end/panels/linear_memory_inspector/components/linearMemoryNavigator.css +1 -1
  160. package/front_end/panels/linear_memory_inspector/components/linearMemoryValueInterpreter.css +5 -5
  161. package/front_end/panels/linear_memory_inspector/components/linearMemoryViewer.css +6 -6
  162. package/front_end/panels/linear_memory_inspector/components/valueInterpreterDisplay.css +6 -6
  163. package/front_end/panels/linear_memory_inspector/components/valueInterpreterSettings.css +2 -2
  164. package/front_end/panels/media/PlayerPropertiesView.ts +1 -1
  165. package/front_end/panels/media/TickingFlameChart.ts +3 -2
  166. package/front_end/panels/mobile_throttling/NetworkThrottlingSelector.ts +2 -1
  167. package/front_end/panels/mobile_throttling/ThrottlingManager.ts +1 -1
  168. package/front_end/panels/mobile_throttling/ThrottlingPresets.ts +2 -1
  169. package/front_end/panels/network/NetworkDataGridNode.ts +11 -9
  170. package/front_end/panels/network/NetworkLogView.ts +4 -1
  171. package/front_end/panels/network/NetworkLogViewColumns.ts +5 -2
  172. package/front_end/panels/network/RequestConditionsDrawer.ts +2 -2
  173. package/front_end/panels/network/RequestHeadersView.ts +47 -11
  174. package/front_end/panels/network/RequestPayloadView.ts +1 -1
  175. package/front_end/panels/network/RequestResponseView.ts +1 -1
  176. package/front_end/panels/network/RequestTimingView.ts +1 -1
  177. package/front_end/panels/network/ShowMoreDetailsWidget.ts +1 -1
  178. package/front_end/panels/network/components/RequestHeadersView.css +12 -0
  179. package/front_end/panels/network/components/ResponseHeaderSection.ts +1 -1
  180. package/front_end/panels/performance_monitor/PerformanceMonitor.ts +3 -3
  181. package/front_end/panels/profiler/HeapProfileView.ts +1 -1
  182. package/front_end/panels/profiler/HeapSnapshotGridNodes.ts +1 -1
  183. package/front_end/panels/protocol_monitor/JSONEditor.ts +1 -1
  184. package/front_end/panels/protocol_monitor/ProtocolMonitor.ts +3 -3
  185. package/front_end/panels/recorder/RecordingListView.ts +0 -6
  186. package/front_end/panels/recorder/RecordingView.ts +0 -6
  187. package/front_end/panels/recorder/controlButton.css +10 -10
  188. package/front_end/panels/recorder/startView.css +1 -1
  189. package/front_end/panels/screencast/ScreencastView.ts +4 -2
  190. package/front_end/panels/search/SearchView.ts +1 -1
  191. package/front_end/panels/security/SecurityPanel.ts +46 -35
  192. package/front_end/panels/sources/BreakpointEditDialog.ts +1 -1
  193. package/front_end/panels/sources/CallStackSidebarPane.ts +1 -1
  194. package/front_end/panels/sources/DebuggerPausedMessage.ts +8 -6
  195. package/front_end/panels/sources/ProfilePlugin.ts +2 -1
  196. package/front_end/panels/sources/ScopeChainSidebarPane.ts +1 -1
  197. package/front_end/panels/timeline/IsolateSelector.ts +1 -1
  198. package/front_end/panels/timeline/LayoutShiftsTrackAppender.ts +1 -1
  199. package/front_end/panels/timeline/NetworkTrackAppender.ts +1 -1
  200. package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +1 -1
  201. package/front_end/panels/timeline/TimelineFlameChartView.ts +0 -32
  202. package/front_end/panels/timeline/TimelineHistoryManager.ts +1 -1
  203. package/front_end/panels/timeline/TimelinePaintProfilerView.ts +7 -3
  204. package/front_end/panels/timeline/TimelinePanel.ts +3 -20
  205. package/front_end/panels/timeline/TimelineTreeView.ts +1 -1
  206. package/front_end/panels/timeline/TimelineUIUtils.ts +4 -4
  207. package/front_end/panels/timeline/components/LayoutShiftDetails.ts +4 -3
  208. package/front_end/panels/timeline/components/LiveMetricsView.ts +1 -1
  209. package/front_end/panels/timeline/components/NetworkRequestDetails.ts +25 -24
  210. package/front_end/panels/timeline/components/RelatedInsightChips.ts +4 -3
  211. package/front_end/panels/timeline/components/Sidebar.ts +1 -1
  212. package/front_end/panels/timeline/components/SidebarAnnotationsTab.ts +4 -3
  213. package/front_end/panels/timeline/components/cwvMetrics.css +2 -2
  214. package/front_end/panels/timeline/components/insights/checklist.css +1 -1
  215. package/front_end/panels/timeline/components/insights/table.css +3 -3
  216. package/front_end/panels/timeline/overlays/components/entriesLinkOverlay.css +4 -4
  217. package/front_end/panels/timeline/overlays/components/entryLabelOverlay.css +4 -4
  218. package/front_end/panels/timeline/overlays/components/timeRangeOverlay.css +2 -2
  219. package/front_end/panels/timeline/overlays/components/timespanBreakdownOverlay.css +4 -4
  220. package/front_end/panels/timeline/timelinePanel.css +0 -74
  221. package/front_end/panels/timeline/utils/Helpers.ts +1 -1
  222. package/front_end/panels/timeline/utils/ImageCache.ts +5 -3
  223. package/front_end/panels/web_audio/WebAudioView.ts +3 -3
  224. package/front_end/panels/web_audio/webAudio.css +5 -5
  225. package/front_end/panels/webauthn/WebauthnPane.ts +5 -11
  226. package/front_end/third_party/acorn/acorn.ts +3 -3
  227. package/front_end/third_party/chromium/README.chromium +1 -1
  228. package/front_end/third_party/chromium/ahem/ahem.d.ts +1 -0
  229. package/front_end/third_party/csp_evaluator/package/csp.ts +4 -4
  230. package/front_end/third_party/csp_evaluator/package/parser.ts +3 -1
  231. package/front_end/third_party/csp_evaluator/package/tsconfig.json +1 -0
  232. package/front_end/third_party/csp_evaluator/package/utils.ts +1 -1
  233. package/front_end/third_party/diff/DiffWrapper.ts +1 -8
  234. package/front_end/third_party/diff/diff_match_patch.d.ts +10 -0
  235. package/front_end/third_party/json5/json5.ts +2 -2
  236. package/front_end/third_party/puppeteer/README.chromium +2 -2
  237. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +183 -4
  238. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +708 -122
  239. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.d.ts +85 -3
  240. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.d.ts.map +1 -1
  241. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.js +84 -11
  242. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.js.map +1 -1
  243. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/ScreenRecording.d.ts +75 -0
  244. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/ScreenRecording.d.ts.map +1 -0
  245. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/ScreenRecording.js +102 -0
  246. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/ScreenRecording.js.map +1 -0
  247. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/api.d.ts +1 -0
  248. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/api.d.ts.map +1 -1
  249. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/api.js +1 -0
  250. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/api.js.map +1 -1
  251. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Page.d.ts +6 -1
  252. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Page.d.ts.map +1 -1
  253. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Page.js +7 -0
  254. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Page.js.map +1 -1
  255. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/ScreenRecording.d.ts +31 -0
  256. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/ScreenRecording.d.ts.map +1 -0
  257. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/ScreenRecording.js +138 -0
  258. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/ScreenRecording.js.map +1 -0
  259. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/bidi.d.ts +1 -0
  260. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/bidi.d.ts.map +1 -1
  261. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/bidi.js +1 -0
  262. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/bidi.js.map +1 -1
  263. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/BrowsingContext.d.ts +6 -0
  264. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/BrowsingContext.d.ts.map +1 -1
  265. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/BrowsingContext.js +23 -0
  266. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/BrowsingContext.js.map +1 -1
  267. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Page.d.ts +6 -1
  268. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Page.d.ts.map +1 -1
  269. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Page.js +7 -0
  270. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Page.js.map +1 -1
  271. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/ScreenRecording.d.ts +31 -0
  272. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/ScreenRecording.d.ts.map +1 -0
  273. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/ScreenRecording.js +131 -0
  274. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/ScreenRecording.js.map +1 -0
  275. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/cdp.d.ts +1 -0
  276. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/cdp.d.ts.map +1 -1
  277. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/cdp.js +1 -0
  278. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/cdp.js.map +1 -1
  279. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/BrowserConnector.js +7 -4
  280. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/BrowserConnector.js.map +1 -1
  281. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/BrowserWebSocketTransport.d.ts +4 -1
  282. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/BrowserWebSocketTransport.d.ts.map +1 -1
  283. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/BrowserWebSocketTransport.js +5 -1
  284. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/BrowserWebSocketTransport.js.map +1 -1
  285. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/ConnectOptions.d.ts +42 -0
  286. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/ConnectOptions.d.ts.map +1 -1
  287. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/Device.d.ts +2 -2
  288. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/Device.d.ts.map +1 -1
  289. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/Device.js +265 -1
  290. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/Device.js.map +1 -1
  291. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.d.ts +4 -0
  292. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.d.ts.map +1 -1
  293. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.js +24 -3
  294. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.js.map +1 -1
  295. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/NodeWebSocketTransport.d.ts +23 -2
  296. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/NodeWebSocketTransport.d.ts.map +1 -1
  297. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/NodeWebSocketTransport.js +49 -3
  298. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/NodeWebSocketTransport.js.map +1 -1
  299. package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.d.ts +3 -3
  300. package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.js +3 -3
  301. package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.d.ts +1 -1
  302. package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.d.ts.map +1 -1
  303. package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.js +1 -1
  304. package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.js.map +1 -1
  305. package/front_end/third_party/puppeteer/package/lib/types.d.ts +183 -4
  306. package/front_end/third_party/puppeteer/package/package.json +4 -4
  307. package/front_end/third_party/puppeteer/package/src/api/Page.ts +143 -11
  308. package/front_end/third_party/puppeteer/package/src/api/ScreenRecording.ts +145 -0
  309. package/front_end/third_party/puppeteer/package/src/api/api.ts +1 -0
  310. package/front_end/third_party/puppeteer/package/src/bidi/Page.ts +11 -0
  311. package/front_end/third_party/puppeteer/package/src/bidi/ScreenRecording.ts +106 -0
  312. package/front_end/third_party/puppeteer/package/src/bidi/bidi.ts +1 -0
  313. package/front_end/third_party/puppeteer/package/src/bidi/core/BrowsingContext.ts +41 -0
  314. package/front_end/third_party/puppeteer/package/src/cdp/Page.ts +11 -0
  315. package/front_end/third_party/puppeteer/package/src/cdp/ScreenRecording.ts +101 -0
  316. package/front_end/third_party/puppeteer/package/src/cdp/cdp.ts +1 -0
  317. package/front_end/third_party/puppeteer/package/src/common/BrowserConnector.ts +17 -9
  318. package/front_end/third_party/puppeteer/package/src/common/BrowserWebSocketTransport.ts +4 -0
  319. package/front_end/third_party/puppeteer/package/src/common/ConnectOptions.ts +46 -0
  320. package/front_end/third_party/puppeteer/package/src/common/Device.ts +287 -1
  321. package/front_end/third_party/puppeteer/package/src/node/BrowserLauncher.ts +30 -1
  322. package/front_end/third_party/puppeteer/package/src/node/NodeWebSocketTransport.ts +73 -2
  323. package/front_end/third_party/puppeteer/package/src/revisions.ts +3 -3
  324. package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
  325. package/front_end/third_party/puppeteer/puppeteer-tsconfig.json +3 -0
  326. package/front_end/tsconfig.json +1 -2
  327. package/front_end/ui/comments/CommentAnchorResolver.ts +8 -3
  328. package/front_end/ui/comments/CommentOverlayManager.ts +53 -12
  329. package/front_end/ui/comments/CommentsOverlayWidget.ts +3 -3
  330. package/front_end/ui/comments/CommentsStatusBarPill.ts +96 -0
  331. package/front_end/ui/comments/comments-meta.ts +21 -0
  332. package/front_end/ui/comments/comments.ts +2 -0
  333. package/front_end/ui/comments/commentsOverlay.css +22 -3
  334. package/front_end/ui/components/buttons/floatingButton.css +25 -0
  335. package/front_end/ui/components/markdown_view/MarkdownView.ts +31 -1
  336. package/front_end/ui/components/srgb_overlay/SrgbOverlay.ts +1 -1
  337. package/front_end/ui/components/suggestion_input/SuggestionInput.ts +45 -25
  338. package/front_end/ui/kit/icons/Icon.ts +0 -1
  339. package/front_end/ui/kit/link/Link.ts +8 -1
  340. package/front_end/ui/legacy/ContextMenu.ts +2 -2
  341. package/front_end/ui/legacy/DropTarget.ts +6 -1
  342. package/front_end/ui/legacy/EmptyWidget.ts +1 -1
  343. package/front_end/ui/legacy/GlassPane.ts +1 -1
  344. package/front_end/ui/legacy/InspectorView.ts +17 -1
  345. package/front_end/ui/legacy/ShortcutRegistry.ts +2 -2
  346. package/front_end/ui/legacy/SplitWidget.ts +18 -3
  347. package/front_end/ui/legacy/StackedPane.ts +1 -1
  348. package/front_end/ui/legacy/StatusBar.ts +78 -0
  349. package/front_end/ui/legacy/TargetCrashedScreen.ts +1 -1
  350. package/front_end/ui/legacy/TextPrompt.ts +2 -1
  351. package/front_end/ui/legacy/Toolbar.ts +5 -1
  352. package/front_end/ui/legacy/Treeoutline.ts +91 -48
  353. package/front_end/ui/legacy/UIUtils.ts +8 -4
  354. package/front_end/ui/legacy/ViewManager.ts +1 -1
  355. package/front_end/ui/legacy/ViewRegistration.ts +1 -0
  356. package/front_end/ui/legacy/Widget.ts +1 -1
  357. package/front_end/ui/legacy/components/color_picker/Spectrum.ts +7 -1
  358. package/front_end/ui/legacy/components/data_grid/DataGrid.ts +1 -1
  359. package/front_end/ui/legacy/components/data_grid/DataGridElement.ts +3 -2
  360. package/front_end/ui/legacy/components/data_grid/dataGrid.css +23 -23
  361. package/front_end/ui/legacy/components/inline_editor/AnimationTimingModel.ts +1 -1
  362. package/front_end/ui/legacy/components/inline_editor/BezierEditor.ts +48 -44
  363. package/front_end/ui/legacy/components/inline_editor/CSSAngleUtils.ts +1 -1
  364. package/front_end/ui/legacy/components/inline_editor/PositionAreaEditor.docs.ts +83 -0
  365. package/front_end/ui/legacy/components/inline_editor/PositionAreaEditor.ts +600 -0
  366. package/front_end/ui/legacy/components/inline_editor/animationNameSwatch.css +1 -1
  367. package/front_end/ui/legacy/components/inline_editor/colorMixSwatch.css +4 -4
  368. package/front_end/ui/legacy/components/inline_editor/cssAngleSwatch.css +3 -3
  369. package/front_end/ui/legacy/components/inline_editor/inline_editor.ts +2 -0
  370. package/front_end/ui/legacy/components/inline_editor/linkSwatch.css +1 -1
  371. package/front_end/ui/legacy/components/inline_editor/positionAreaEditor.css +154 -0
  372. package/front_end/ui/legacy/components/object_ui/CustomPreviewComponent.ts +224 -127
  373. package/front_end/ui/legacy/components/object_ui/ObjectPopoverHelper.ts +10 -7
  374. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +25 -106
  375. package/front_end/ui/legacy/components/object_ui/customPreviewComponent.css +7 -3
  376. package/front_end/ui/legacy/components/object_ui/objectPropertiesSection.css +1 -1
  377. package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +0 -66
  378. package/front_end/ui/legacy/components/perf_ui/perf_ui.ts +0 -2
  379. package/front_end/ui/legacy/components/perf_ui/pieChart.css +7 -5
  380. package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +8 -5
  381. package/front_end/ui/legacy/components/utils/JSPresentationUtils.ts +1 -1
  382. package/front_end/ui/legacy/components/utils/Linkifier.ts +5 -5
  383. package/front_end/ui/legacy/inspectorCommon.css +41 -6
  384. package/front_end/ui/legacy/legacy.ts +2 -0
  385. package/front_end/ui/legacy/statusBar.css +18 -0
  386. package/front_end/ui/visual_logging/Debugging.ts +2 -1
  387. package/front_end/ui/visual_logging/KnownContextValues.ts +3 -1
  388. package/front_end/ui/visual_logging/LoggingDriver.ts +3 -3
  389. package/front_end/ui/visual_logging/LoggingEvents.ts +5 -5
  390. package/front_end/ui/visual_logging/LoggingState.ts +1 -1
  391. package/front_end/ui/visual_logging/visual_logging.ts +67 -56
  392. package/inspector_overlay/main.ts +8 -8
  393. package/mcp/mcp.ts +5 -0
  394. package/package.json +2 -8
  395. package/front_end/Images/generate-css-vars.js +0 -52
  396. package/front_end/Images/rollup.config.mjs +0 -36
  397. package/front_end/models/ai_assistance/AiOrigins.ts +0 -107
  398. package/front_end/models/live-metrics/web-vitals-injected/rollup.config.mjs +0 -20
  399. package/front_end/panels/recorder/injected/rollup.config.mjs +0 -20
  400. package/front_end/panels/timeline/EasterEgg.d.ts +0 -6
  401. package/front_end/panels/timeline/easter-egg-tsconfig.json +0 -8
  402. package/front_end/panels/timeline/enable-easter-egg.js +0 -20
  403. package/front_end/third_party/acorn/acorn-tsconfig.json +0 -12
  404. package/front_end/third_party/acorn/estree-tsconfig.json +0 -8
  405. package/front_end/third_party/chromium/client-variations/client-variations-tsconfig.json +0 -8
  406. package/front_end/third_party/codemirror/codemirror-legacy-types-tsconfig.json +0 -8
  407. package/front_end/third_party/codemirror/codemirror-tsconfig.json +0 -15
  408. package/front_end/third_party/codemirror.next/bundle-tsconfig.json +0 -24
  409. package/front_end/third_party/intl-messageformat/intl-messageformat-tsconfig.json +0 -16
  410. package/front_end/third_party/json5/json5-tsconfig.json +0 -8
  411. package/front_end/third_party/legacy-javascript/legacy-javascript-tsconfig.json +0 -8
  412. package/front_end/third_party/lighthouse/lighthouse-tsconfig.json +0 -11
  413. package/front_end/third_party/lighthouse/report/bundle-tsconfig.json +0 -8
  414. package/front_end/third_party/lit/lit-tsconfig.json +0 -15
  415. package/front_end/third_party/marked/marked-tsconfig.json +0 -8
  416. package/front_end/third_party/puppeteer-replay/puppeteer-replay-tsconfig.json +0 -8
  417. package/front_end/third_party/third-party-web/third-party-web-tsconfig.json +0 -8
  418. package/front_end/third_party/wasmparser/wasmparser-tsconfig.json +0 -9
  419. package/front_end/third_party/web-vitals/web-vitals-tsconfig.json +0 -47
  420. package/front_end/ui/legacy/components/perf_ui/BrickBreaker.ts +0 -606
  421. package/inspector_overlay/loadCSS.rollup.js +0 -29
@@ -1,606 +0,0 @@
1
- // Copyright 2024 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
- /* eslint-disable @devtools/no-imperative-dom-api */
5
-
6
- import * as i18n from '../../../../core/i18n/i18n.js';
7
- import * as UI from '../../legacy.js';
8
- import * as ThemeSupport from '../../theme_support/theme_support.js';
9
-
10
- import type {FlameChart} from './FlameChart.js';
11
-
12
- const UIStrings = {
13
- /**
14
- * @description Message congratulating the user for winning the brick breaker game.
15
- */
16
- congrats: 'Congrats, you win!',
17
- /**
18
- * @description Postscript message explaining how to open the brick breaker game using a keyboard shortcut.
19
- */
20
- ps: 'PS: You can also open the game by typing `fixme`',
21
- } as const;
22
-
23
- const str_ = i18n.i18n.registerUIStrings('ui/legacy/components/perf_ui/BrickBreaker.ts', UIStrings);
24
- const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
25
-
26
- interface Brick {
27
- x: number;
28
- y: number;
29
- width: number;
30
- }
31
-
32
- const MAX_DELTA = 16;
33
- const MIN_DELTA = 10;
34
- const MAX_PADDLE_LENGTH = 150;
35
- const MIN_PADDLE_LENGTH = 85;
36
- const PADDLE_HEIGHT = 15;
37
- const BALL_RADIUS = 10;
38
-
39
- interface ColorPalette {
40
- light: string;
41
- mediumLighter: string;
42
- mediumDarker: string;
43
- dark: string;
44
- }
45
-
46
- const colorPallettes: ColorPalette[] = [
47
- // blues
48
- {
49
- light: 'rgb(224,240,255)',
50
- mediumLighter: 'rgb(176,208,255)',
51
- mediumDarker: 'rgb(112,160,221)',
52
- dark: 'rgb(0,92,153)',
53
- },
54
- // pinks
55
- {
56
- light: 'rgb(253, 216, 229)',
57
- mediumLighter: 'rgb(250, 157, 188)',
58
- mediumDarker: 'rgb(249, 98, 154)',
59
- dark: 'rgb(254, 5, 105)',
60
- },
61
- // pastel pinks
62
- {
63
- light: 'rgb(254, 234, 234)',
64
- mediumLighter: 'rgb(255, 216, 216)',
65
- mediumDarker: 'rgb(255, 195, 195)',
66
- dark: 'rgb(235, 125, 138)',
67
- },
68
- // purples
69
- {
70
- light: 'rgb(226,183,206)',
71
- mediumLighter: 'rgb(219,124,165)',
72
- mediumDarker: 'rgb(146,60,129)',
73
- dark: 'rgb(186, 85, 255)',
74
- },
75
- // greens
76
- {
77
- light: 'rgb(206,255,206)',
78
- mediumLighter: 'rgb(128,255,128)',
79
- mediumDarker: 'rgb(0,246,0)',
80
- dark: 'rgb(0,187,0)',
81
- },
82
- // reds
83
- {
84
- light: 'rgb(255, 188, 181)',
85
- mediumLighter: 'rgb(254, 170, 170)',
86
- mediumDarker: 'rgb(215, 59, 43)',
87
- dark: 'rgb(187, 37, 23)',
88
- },
89
- // aqua
90
- {
91
- light: 'rgb(236, 254, 250)',
92
- mediumLighter: 'rgb(204, 255, 245)',
93
- mediumDarker: 'rgb(164, 240, 233)',
94
- dark: 'rgb(72,189,144)',
95
- },
96
- // yellow/pink
97
- {
98
- light: 'rgb(255, 225, 185)',
99
- mediumLighter: 'rgb(255, 204, 141)',
100
- mediumDarker: 'rgb(240, 140, 115)',
101
- dark: 'rgb(211, 96, 117)',
102
- },
103
- // ocean breeze
104
- {
105
- light: 'rgb(218, 255, 248)',
106
- mediumLighter: 'rgb(177, 235, 236)',
107
- mediumDarker: 'rgb(112, 214, 214)',
108
- dark: 'rgb(34, 205, 181)',
109
- },
110
- ];
111
-
112
- export class BrickBreaker extends HTMLElement {
113
- #canvas: HTMLCanvasElement;
114
- #ctx: CanvasRenderingContext2D;
115
-
116
- #helperCanvas: HTMLCanvasElement;
117
- #helperCanvasCtx: CanvasRenderingContext2D;
118
- #scorePanel: HTMLElement;
119
- #trackTimelineOffset = 0;
120
- #visibleEntries = new Set<number>();
121
- #brokenBricks = new Map<number, Brick>();
122
- #keyDownHandlerBound = this.#keyDownHandler.bind(this);
123
- #keyUpHandlerBound = this.#keyUpHandler.bind(this);
124
- #keyPressHandlerBound = this.#keyPressHandler.bind(this);
125
- #closeGameBound = this.#closeGame.bind(this);
126
- #mouseMoveHandlerBound = this.#mouseMoveHandler.bind(this);
127
- #boundingElement = UI.UIUtils.getDevToolsBoundingElement();
128
- // Value by which we moved the game up relative to the viewport
129
- #gameViewportOffset = 0;
130
- #running = false;
131
- #initialDPR = devicePixelRatio;
132
- #ballX = 0;
133
- #ballY = 0;
134
- #ballDx = 0;
135
- #ballDy = 0;
136
- #paddleX = 0;
137
- #rightPressed = false;
138
- #leftPressed = false;
139
- #brickHeight = 0;
140
- #lives = 0;
141
- #blockCount = 0;
142
- #paddleLength = MAX_PADDLE_LENGTH;
143
- #minScreenHeight = 150;
144
- #maxScreenHeight = 1500;
145
- #screenHeightDiff = this.#maxScreenHeight - this.#minScreenHeight;
146
- // Value from 0.1 to 1 that multiplies speed depending on the screen height
147
- #deltaMultiplier = 0;
148
- #deltaVectorLength = 0;
149
- #currentPalette: ColorPalette;
150
- constructor(private timelineFlameChart: FlameChart) {
151
- super();
152
- this.#canvas = this.createChild('canvas', 'fill');
153
- this.#ctx = this.#canvas.getContext('2d') as CanvasRenderingContext2D;
154
- this.#helperCanvas = document.createElement('canvas');
155
- this.#helperCanvasCtx = this.#helperCanvas.getContext('2d') as CanvasRenderingContext2D;
156
- const randomPaletteIndex = Math.floor(Math.random() * colorPallettes.length);
157
- this.#currentPalette = colorPallettes[randomPaletteIndex];
158
- this.#scorePanel = this.createChild('div');
159
- this.#scorePanel.classList.add('scorePanel');
160
- this.#scorePanel.style.borderImage =
161
- 'linear-gradient(' + this.#currentPalette.mediumDarker + ',' + this.#currentPalette.dark + ') 1';
162
- this.initButton();
163
- }
164
-
165
- initButton(): void {
166
- const button = this.createChild('div');
167
- button.classList.add('game-close-button');
168
- button.innerHTML = '<b><span style=\'font-size: 1.2em; color: white\'>x</span></b>';
169
- button.style.background = this.#currentPalette.dark;
170
- button.style.boxShadow = this.#currentPalette.dark + ' 1px 1px, ' + this.#currentPalette.mediumDarker +
171
- ' 3px 3px, ' + this.#currentPalette.mediumLighter + ' 5px 5px';
172
- button.addEventListener('click', this.#closeGame.bind(this));
173
- this.appendChild(button);
174
- }
175
-
176
- connectedCallback(): void {
177
- this.#running = true;
178
- this.#setUpNewGame();
179
- this.#boundingElement.addEventListener('keydown', this.#keyDownHandlerBound);
180
- document.addEventListener('keydown', this.#keyDownHandlerBound, false);
181
- document.addEventListener('keyup', this.#keyUpHandlerBound, false);
182
- document.addEventListener('keypress', this.#keyPressHandlerBound, false);
183
- window.addEventListener('resize', this.#closeGameBound);
184
- document.addEventListener('mousemove', this.#mouseMoveHandlerBound, false);
185
- this.tabIndex = 1;
186
- this.focus();
187
- }
188
-
189
- disconnectedCallback(): void {
190
- this.#boundingElement.removeEventListener('keydown', this.#keyDownHandlerBound);
191
- window.removeEventListener('resize', this.#closeGameBound);
192
- document.removeEventListener('keydown', this.#keyDownHandlerBound, false);
193
- document.removeEventListener('keyup', this.#keyUpHandlerBound, false);
194
- window.removeEventListener('resize', this.#closeGameBound);
195
- document.removeEventListener('keypress', this.#keyPressHandlerBound, false);
196
- document.removeEventListener('mousemove', this.#mouseMoveHandlerBound, false);
197
- }
198
-
199
- #resetCanvas(): void {
200
- const dPR = window.devicePixelRatio;
201
- const height = Math.round(this.offsetHeight * dPR);
202
- const width = Math.round(this.offsetWidth * dPR);
203
- this.#canvas.height = height;
204
- this.#canvas.width = width;
205
- this.#canvas.style.height = (height / dPR) + 'px';
206
- this.#canvas.style.width = (width / dPR) + 'px';
207
- }
208
-
209
- #closeGame(): void {
210
- this.#running = false;
211
- this.remove();
212
- }
213
-
214
- #setUpNewGame(): void {
215
- this.#resetCanvas();
216
- this.#deltaMultiplier = Math.max(0.1, (this.offsetHeight - this.#minScreenHeight) / this.#screenHeightDiff);
217
- this.#deltaVectorLength = MIN_DELTA * this.#deltaMultiplier;
218
- const trackData = this.timelineFlameChart.drawTrackOnCanvas('Main', this.#ctx, BALL_RADIUS);
219
- if (trackData === null || trackData.visibleEntries.size === 0) {
220
- console.error('Could not draw game');
221
- this.#closeGame();
222
- return;
223
- }
224
- this.#trackTimelineOffset = trackData.top;
225
- this.#visibleEntries = trackData.visibleEntries;
226
- this.#gameViewportOffset = this.#trackTimelineOffset +
227
- this.timelineFlameChart.getCanvas().getBoundingClientRect().top - this.timelineFlameChart.getScrollOffset();
228
-
229
- requestAnimationFrame(() => this.#animateFlameChartTopPositioning(trackData.top, trackData.height));
230
- }
231
-
232
- #animateFlameChartTopPositioning(currentOffset: number, flameChartHeight: number): void {
233
- if (currentOffset === 0) {
234
- this.#createGame();
235
- return;
236
- }
237
- const dPR = window.devicePixelRatio;
238
- const currentOffsetOnDPR = Math.round(currentOffset * dPR);
239
- const newOffset = Math.max(currentOffset - 4, 0);
240
- const newOffsetOnDPR = Math.round(newOffset * dPR);
241
- const baseCanvas = this.#canvas;
242
- this.#helperCanvas.height = baseCanvas.height;
243
- this.#helperCanvas.width = baseCanvas.width;
244
- this.#helperCanvas.style.height = baseCanvas.style.height;
245
- this.#helperCanvas.style.width = baseCanvas.style.width;
246
-
247
- this.#helperCanvasCtx.drawImage(
248
- baseCanvas, 0, currentOffsetOnDPR, baseCanvas.width, flameChartHeight * dPR, 0, newOffsetOnDPR,
249
- baseCanvas.width, flameChartHeight * dPR);
250
- this.#resetCanvas();
251
- this.#ctx.drawImage(this.#helperCanvas, 0, 0);
252
- requestAnimationFrame(() => this.#animateFlameChartTopPositioning(newOffset, flameChartHeight));
253
- }
254
-
255
- #keyUpHandler(event: KeyboardEvent): void {
256
- if (event.key === 'Right' || event.key === 'ArrowRight' || event.key === 'd') {
257
- this.#rightPressed = false;
258
- event.preventDefault();
259
- } else if (event.key === 'Left' || event.key === 'ArrowLeft' || event.key === 'a') {
260
- this.#leftPressed = false;
261
- event.preventDefault();
262
- } else {
263
- event.stopImmediatePropagation();
264
- }
265
- }
266
-
267
- #keyPressHandler(e: Event): void {
268
- e.stopImmediatePropagation();
269
- e.preventDefault();
270
- }
271
-
272
- #keyDownHandler(event: KeyboardEvent): void {
273
- if (event.key === 'Escape') {
274
- this.#closeGame();
275
- event.stopImmediatePropagation();
276
- } else if (event.key === 'Right' || event.key === 'ArrowRight' || event.key === 'd') {
277
- this.#rightPressed = true;
278
- event.preventDefault();
279
- } else if (event.key === 'Left' || event.key === 'ArrowLeft' || event.key === 'a') {
280
- this.#leftPressed = true;
281
- event.preventDefault();
282
- } else {
283
- event.preventDefault();
284
- event.stopImmediatePropagation();
285
- }
286
- }
287
-
288
- #mouseMoveHandler(e: MouseEvent): void {
289
- this.#paddleX = Math.max(e.offsetX - this.#paddleLength / 2, 0);
290
- this.#paddleX = Math.min(this.#paddleX, this.offsetWidth - this.#paddleLength);
291
- }
292
-
293
- #createGame(): void {
294
- this.#ballX = this.offsetWidth / 2;
295
- this.#ballY = this.offsetHeight - PADDLE_HEIGHT - BALL_RADIUS;
296
- this.#ballDx = 0;
297
- this.#ballDy = -Math.SQRT2 * this.#deltaVectorLength;
298
- this.#paddleX = (this.#canvas.width - this.#paddleLength) / 2;
299
- this.#rightPressed = false;
300
- this.#leftPressed = false;
301
- this.#brickHeight = this.timelineFlameChart.getBarHeight();
302
- this.#blockCount = this.#visibleEntries.size;
303
- this.#lives = Math.max(Math.round(this.#blockCount / 17), 2);
304
- this.#draw();
305
- }
306
-
307
- #restartBall(): void {
308
- this.#ballX = this.offsetWidth / 2;
309
- this.#ballY = this.offsetHeight - PADDLE_HEIGHT - BALL_RADIUS;
310
- this.#ballDx = 0;
311
- this.#ballDy = -Math.SQRT2 * this.#deltaVectorLength;
312
- }
313
-
314
- #drawBall(): void {
315
- if (!this.#ctx) {
316
- return;
317
- }
318
- const gradient = this.#ctx.createRadialGradient(
319
- this.#ballX + BALL_RADIUS / 4, // Offset towards the left
320
- this.#ballY - BALL_RADIUS / 4, // Offset downwards
321
- 0,
322
- this.#ballX + BALL_RADIUS / 4,
323
- this.#ballY - BALL_RADIUS / 4,
324
- BALL_RADIUS,
325
- );
326
-
327
- // stops for gradient
328
- gradient.addColorStop(0.3, this.#currentPalette.mediumLighter);
329
- gradient.addColorStop(0.6, this.#currentPalette.mediumDarker);
330
- gradient.addColorStop(1, this.#currentPalette.dark);
331
-
332
- this.#ctx.beginPath();
333
- this.#ctx.arc(this.#ballX, this.#ballY, BALL_RADIUS, 0, Math.PI * 2);
334
- this.#ctx.fillStyle = gradient;
335
- this.#ctx.fill();
336
- this.#ctx.closePath();
337
- }
338
-
339
- #drawPaddle(): void {
340
- if (!this.#ctx) {
341
- return;
342
- }
343
-
344
- const gradient = this.#ctx.createRadialGradient(
345
- this.#paddleX + this.#paddleLength / 3,
346
- this.offsetHeight - PADDLE_HEIGHT - PADDLE_HEIGHT / 4,
347
- 0,
348
- this.#paddleX + this.#paddleLength / 3,
349
- this.offsetHeight - PADDLE_HEIGHT - PADDLE_HEIGHT / 4,
350
- this.#paddleLength / 2,
351
- );
352
-
353
- gradient.addColorStop(0.3, this.#currentPalette.dark); // Paddle color
354
- gradient.addColorStop(1, this.#currentPalette.mediumDarker); // Lighter color
355
-
356
- this.#ctx.beginPath();
357
- this.#ctx.rect(this.#paddleX, this.offsetHeight - PADDLE_HEIGHT, this.#paddleLength, PADDLE_HEIGHT);
358
- this.#ctx.fillStyle = gradient;
359
- this.#ctx.fill();
360
- this.#ctx.closePath();
361
- }
362
-
363
- #patchBrokenBricks(): void {
364
- if (!this.#ctx) {
365
- return;
366
- }
367
- for (const brick of this.#brokenBricks.values()) {
368
- this.#ctx.beginPath();
369
- // Extend the patch width an extra 0.5 px to ensure the
370
- // entry is completely covered.
371
- this.#ctx.rect(brick.x, brick.y, brick.width + 0.5, this.#brickHeight + 0.5);
372
- this.#ctx.fillStyle =
373
- ThemeSupport.ThemeSupport.instance().getComputedValue('--sys-color-neutral-container', this);
374
- this.#ctx.fill();
375
- this.#ctx.closePath();
376
- }
377
- }
378
-
379
- #draw(): void {
380
- if (this.#initialDPR !== devicePixelRatio) {
381
- this.#running = false;
382
- }
383
- if (this.#lives === 0) {
384
- window.alert('GAME OVER');
385
- this.#closeGame();
386
- return;
387
- }
388
- if (this.#blockCount === 0) {
389
- this.#party();
390
- return;
391
- }
392
- this.#ctx.clearRect(0, 0, this.#canvas.width, this.#canvas.height);
393
- this.#ctx.drawImage(this.#helperCanvas, 0, 0);
394
- this.#ctx.save();
395
- this.#ctx.scale(devicePixelRatio, devicePixelRatio);
396
- this.#helperCanvasCtx.save();
397
- this.#helperCanvasCtx.scale(devicePixelRatio, devicePixelRatio);
398
- this.#patchBrokenBricks();
399
- this.#drawBall();
400
- this.#drawPaddle();
401
- this.#brickCollisionDetection();
402
-
403
- const lives = `<div><b><span style='font-size: 1.3em; color: ${this.#currentPalette.dark}'>&#x2764;&#xfe0f; ${
404
- this.#lives}</span></b></div>`;
405
- const blocks = `<div><b><span style='font-size: 1.3em; color: ${this.#currentPalette.dark}'> 🧱 ${
406
- this.#blockCount}</span></b></div>`;
407
- this.#scorePanel.innerHTML = lives + blocks;
408
-
409
- this.#blockCount = this.#visibleEntries.size - this.#brokenBricks.size;
410
- this.#deltaVectorLength =
411
- (MIN_DELTA + (MAX_DELTA - MIN_DELTA) * this.#brokenBricks.size / this.#visibleEntries.size) *
412
- this.#deltaMultiplier;
413
-
414
- this.#paddleLength = MAX_PADDLE_LENGTH -
415
- (MAX_PADDLE_LENGTH - MIN_PADDLE_LENGTH) * this.#brokenBricks.size / this.#visibleEntries.size;
416
-
417
- if (this.#ballX + this.#ballDx > this.offsetWidth - BALL_RADIUS || this.#ballX + this.#ballDx < BALL_RADIUS) {
418
- // Ball bounces on a side wall.
419
- this.#ballDx = -this.#ballDx;
420
- }
421
- if (this.#ballY + this.#ballDy < BALL_RADIUS) {
422
- // Ball bounces on the top.
423
- this.#ballDy = -this.#ballDy;
424
- } else if (this.#ballY + this.#ballDy > this.offsetHeight - BALL_RADIUS && this.#ballDy > 0) {
425
- // Ball is at the bottom, either on the paddle or in the
426
- // void.
427
- if (this.#ballX > (this.#paddleX - BALL_RADIUS) &&
428
- this.#ballX < this.#paddleX + this.#paddleLength + BALL_RADIUS) {
429
- // Ball bounces on the paddle, calculate this.ballDx and this.ballDy so that
430
- // the speed remains constant.
431
- // speed^2 = dx^2 + dy^2 = MAX_DELTA^2 + MAX_DELTA^2
432
- // -> speed = MAX_DELTA * sqrt(2)
433
- // (speed is measured in pixels / frame)
434
-
435
- // The bouncing angle is determined by the portion of the
436
- // paddle's length on which it falls and by the restriction
437
- // -MAX_DELTA < this.ballDx < MAX_DELTA
438
-
439
- // Since we allow for some margin of error (BALL_RADIUS), we need to
440
- // round the ball x to be within the paddle.
441
- let roundedBallX = Math.min(this.#ballX, this.#paddleX + this.#paddleLength);
442
- roundedBallX = Math.max(roundedBallX, this.#paddleX);
443
- const paddleLenghtPortion = (roundedBallX - this.#paddleX) * this.#deltaVectorLength * 2 / this.#paddleLength;
444
- this.#ballDx = -this.#deltaVectorLength + paddleLenghtPortion;
445
- // Solve for this.ballDy given the above equation and bounce up.
446
- this.#ballDy = -Math.sqrt(2 * Math.pow(this.#deltaVectorLength, 2) - Math.pow(this.#ballDx, 2));
447
- } else {
448
- // Ball fell into oblivion, restart.
449
- this.#restartBall();
450
- this.#paddleX = (this.offsetWidth - this.#paddleLength) / 2;
451
- this.#lives--;
452
- }
453
- }
454
- const keyDelta = Math.round(this.clientWidth / 60);
455
- if (this.#rightPressed && this.#paddleX < this.offsetWidth - this.#paddleLength) {
456
- this.#paddleX += keyDelta;
457
- } else if (this.#leftPressed && this.#paddleX > 0) {
458
- this.#paddleX -= keyDelta;
459
- }
460
-
461
- this.#ballX += Math.round(this.#ballDx);
462
- this.#ballY += Math.round(this.#ballDy);
463
- this.#ctx.restore();
464
- this.#helperCanvasCtx.restore();
465
- if (this.#running) {
466
- requestAnimationFrame(this.#draw.bind(this));
467
- }
468
- }
469
- #brickCollisionDetection(): void {
470
- // coordinatesToEntryIndex expects coordinates relative to the timeline canvas.
471
- const timelineCanvasOffset = this.timelineFlameChart.getCanvas().getBoundingClientRect();
472
-
473
- // Check collision if there is an entry on the top, bottom, left and right of the ball
474
- const ballYRelativeToGame = this.#ballY + this.#gameViewportOffset - timelineCanvasOffset.top;
475
- const entryIndexTop =
476
- this.timelineFlameChart.coordinatesToEntryIndex(this.#ballX, ballYRelativeToGame + BALL_RADIUS);
477
- const entryIndexBottom =
478
- this.timelineFlameChart.coordinatesToEntryIndex(this.#ballX, ballYRelativeToGame - BALL_RADIUS);
479
- const entryIndexRight =
480
- this.timelineFlameChart.coordinatesToEntryIndex(this.#ballX + BALL_RADIUS, ballYRelativeToGame);
481
- const entryIndexLeft =
482
- this.timelineFlameChart.coordinatesToEntryIndex(this.#ballX - BALL_RADIUS, ballYRelativeToGame);
483
-
484
- // Points on the 45 degree corners
485
- const diffBetweenCornerandCircle = BALL_RADIUS / Math.SQRT2;
486
- const entryIndexRightTop = this.timelineFlameChart.coordinatesToEntryIndex(
487
- this.#ballX + diffBetweenCornerandCircle, ballYRelativeToGame + diffBetweenCornerandCircle);
488
- const entryIndexLeftTop = this.timelineFlameChart.coordinatesToEntryIndex(
489
- this.#ballX - diffBetweenCornerandCircle, ballYRelativeToGame + diffBetweenCornerandCircle);
490
- const entryIndexRightBottom = this.timelineFlameChart.coordinatesToEntryIndex(
491
- this.#ballX + diffBetweenCornerandCircle, ballYRelativeToGame - diffBetweenCornerandCircle);
492
- const entryIndexLeftBottom = this.timelineFlameChart.coordinatesToEntryIndex(
493
- this.#ballX - diffBetweenCornerandCircle, ballYRelativeToGame - diffBetweenCornerandCircle);
494
-
495
- const breakBrick = (entryIndex: number): void => {
496
- const entryCoordinates = this.timelineFlameChart.entryIndexToCoordinates(entryIndex);
497
- if (entryCoordinates) {
498
- // Cap entries starting before the visible window in the game.
499
- const entryBegin = Math.max(entryCoordinates.x - timelineCanvasOffset.left, 0);
500
- // Extend the patch width and height an extra 0.5 px to ensure the
501
- // entry is completely covered.
502
- this.#brokenBricks.set(entryIndex, {
503
- x: entryBegin - 0.5,
504
- y: entryCoordinates.y - this.#gameViewportOffset - 0.5,
505
- width: this.timelineFlameChart.entryWidth(entryIndex),
506
- });
507
- }
508
- };
509
-
510
- if (entryIndexTop > -1 && !this.#brokenBricks.has(entryIndexTop) && this.#visibleEntries.has(entryIndexTop)) {
511
- this.#ballDy = -this.#ballDy;
512
- breakBrick(entryIndexTop);
513
- return;
514
- }
515
-
516
- if (entryIndexBottom > -1 && !this.#brokenBricks.has(entryIndexBottom) &&
517
- this.#visibleEntries.has(entryIndexBottom)) {
518
- this.#ballDy = -this.#ballDy;
519
- breakBrick(entryIndexBottom);
520
- return;
521
- }
522
-
523
- if (entryIndexRight > -1 && !this.#brokenBricks.has(entryIndexRight) && this.#visibleEntries.has(entryIndexRight)) {
524
- this.#ballDx = -this.#ballDx;
525
- breakBrick(entryIndexRight);
526
- return;
527
- }
528
-
529
- if (entryIndexLeft > -1 && !this.#brokenBricks.has(entryIndexLeft) && this.#visibleEntries.has(entryIndexLeft)) {
530
- this.#ballDx = -this.#ballDx;
531
- breakBrick(entryIndexLeft);
532
- return;
533
- }
534
-
535
- // if the brick hits on 45 degrees, reverse both directions
536
- const diagonalIndexes = [entryIndexRightTop, entryIndexLeftTop, entryIndexRightBottom, entryIndexLeftBottom];
537
- for (const index of diagonalIndexes) {
538
- if (index > -1 && !this.#brokenBricks.has(index) && this.#visibleEntries.has(index)) {
539
- this.#ballDx = -this.#ballDx;
540
- this.#ballDy = -this.#ballDy;
541
- breakBrick(index);
542
- return;
543
- }
544
- }
545
- }
546
-
547
- #random(min: number, max: number): number {
548
- return Math.floor(Math.random() * (max - min) + min);
549
- }
550
- #party(): void {
551
- this.#resetCanvas();
552
- let count = 0;
553
- const columnCount = 15;
554
- const rowCount = 5;
555
- const xSpacing = this.offsetWidth / columnCount;
556
- const ySpacing = this.offsetHeight * 0.7 / columnCount;
557
- const timeoutIDs: number[] = [];
558
- const randomOffset = (): number => -20 + Math.random() * 40;
559
- const drawConfetti = (): void => {
560
- for (let i = 0; i < columnCount * rowCount; i++) {
561
- const confettiContainerElement = document.createElement('span');
562
- confettiContainerElement.className = 'confetti-100';
563
- confettiContainerElement.append(this.#createConfettiElement(
564
- (i % columnCount) * xSpacing + randomOffset(), (i % rowCount) * ySpacing + randomOffset()));
565
- timeoutIDs.push(window.setTimeout(() => this.append(confettiContainerElement), Math.random() * 100));
566
- timeoutIDs.push(window.setTimeout(() => {
567
- confettiContainerElement.remove();
568
- }, 1000));
569
- }
570
- if (++count < 6) {
571
- setTimeout(drawConfetti, Math.random() * 100 + 400);
572
- return;
573
- }
574
- window.alert(`${i18nString(UIStrings.congrats)}\n${i18nString(UIStrings.ps)}`);
575
-
576
- timeoutIDs.forEach(id => clearTimeout(id));
577
- this.#closeGame();
578
- };
579
- drawConfetti();
580
- }
581
-
582
- #createConfettiElement(x: number, y: number): HTMLElement {
583
- const maxDistance = 400;
584
- const maxRotation = 3;
585
- const emojies = ['💯', '🎉', '🎊'];
586
- const confettiElement = document.createElement('span');
587
- confettiElement.textContent = emojies[this.#random(0, emojies.length)];
588
- confettiElement.className = 'confetti-100-particle';
589
- confettiElement.style.setProperty('--rotation', this.#random(-maxRotation * 360, maxRotation * 360) + 'deg');
590
- confettiElement.style.setProperty('--to-X', this.#random(-maxDistance, maxDistance) + 'px');
591
- confettiElement.style.setProperty('--to-Y', this.#random(-maxDistance, maxDistance) + 'px');
592
- confettiElement.style.left = x + 'px';
593
- confettiElement.style.top = y + 'px';
594
-
595
- return confettiElement;
596
- }
597
- }
598
-
599
- declare global {
600
- interface HTMLElementTagNameMap {
601
- 'brick-breaker': BrickBreaker;
602
- }
603
- }
604
-
605
- // eslint-disable-next-line @devtools/enforce-custom-element-prefix
606
- customElements.define('brick-breaker', BrickBreaker);
@@ -1,29 +0,0 @@
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
- // WARNING: don't use this rollup plugin outside of inspector_overlay.
6
- // See README for special constraints the overlay has.
7
-
8
- export default function loadCSS() {
9
- return {
10
- name: 'loadCSS',
11
- /**
12
- * @param code {string}
13
- * @param id {string}
14
- */
15
- transform(code, id) {
16
- if (id.endsWith('.css')) {
17
- return {
18
- code: `
19
- const style = new CSSStyleSheet();
20
- style.replaceSync(${JSON.stringify(code)});
21
- export default style;
22
- `,
23
- map: null,
24
- };
25
- }
26
- return;
27
- },
28
- };
29
- }