chrome-devtools-frontend 1.0.1515446 → 1.0.1515988
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/contributing/infrastructure.md +131 -82
- package/front_end/Tests.js +3 -29
- package/front_end/core/common/Progress.ts +73 -55
- package/front_end/core/host/UserMetrics.ts +0 -1
- package/front_end/core/protocol_client/InspectorBackend.ts +2 -0
- package/front_end/core/root/Runtime.ts +0 -1
- package/front_end/core/sdk/CSSMatchedStyles.ts +12 -10
- package/front_end/core/sdk/CSSModel.ts +1 -31
- package/front_end/core/sdk/CSSPropertyParserMatchers.ts +27 -7
- package/front_end/core/sdk/DebuggerModel.ts +1 -31
- package/front_end/core/sdk/EnhancedTracesParser.ts +81 -50
- package/front_end/core/sdk/NetworkManager.ts +1 -31
- package/front_end/core/sdk/NetworkRequest.ts +1 -31
- package/front_end/core/sdk/RehydratingConnection.snapshot.txt +1003 -0
- package/front_end/core/sdk/RehydratingConnection.ts +13 -18
- package/front_end/core/sdk/RehydratingObject.ts +8 -31
- package/front_end/core/sdk/RemoteObject.ts +1 -31
- package/front_end/core/sdk/ResourceTreeModel.ts +1 -31
- package/front_end/core/sdk/RuntimeModel.ts +1 -31
- package/front_end/core/sdk/ServiceWorkerManager.ts +1 -31
- package/front_end/core/sdk/SourceMap.ts +1 -31
- package/front_end/core/sdk/TraceObject.ts +8 -3
- package/front_end/entrypoints/main/MainImpl.ts +0 -2
- package/front_end/entrypoints/main/main-meta.ts +2 -2
- package/front_end/generated/InspectorBackendCommands.js +4 -4
- package/front_end/generated/SupportedCSSProperties.js +12 -0
- package/front_end/generated/protocol.ts +10 -1
- package/front_end/models/ai_assistance/AiHistoryStorage.ts +1 -3
- package/front_end/models/ai_assistance/ConversationHandler.ts +4 -6
- package/front_end/models/ai_assistance/agents/AiAgent.ts +4 -1
- package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +107 -72
- package/front_end/models/ai_assistance/agents/PerformanceAnnotationsAgent.ts +2 -2
- package/front_end/models/ai_assistance/agents/StylingAgent.ts +2 -2
- package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.snapshot.txt +178 -85
- package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.ts +308 -218
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +161 -97
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +78 -58
- package/front_end/models/ai_assistance/data_formatters/UnitFormatters.ts +10 -1
- package/front_end/models/ai_assistance/performance/AIContext.ts +19 -21
- package/front_end/models/ai_code_completion/AiCodeCompletion.ts +123 -55
- package/front_end/models/bindings/ContentProviderBasedProject.ts +6 -4
- package/front_end/models/breakpoints/BreakpointManager.ts +3 -3
- package/front_end/models/har/Writer.ts +11 -11
- package/front_end/models/javascript_metadata/NativeFunctions.js +7 -7
- package/front_end/models/persistence/FileSystemWorkspaceBinding.ts +3 -3
- package/front_end/models/persistence/IsolatedFileSystem.ts +4 -4
- package/front_end/models/persistence/IsolatedFileSystemManager.ts +7 -7
- package/front_end/models/persistence/PersistenceImpl.ts +8 -8
- package/front_end/models/persistence/PlatformFileSystem.ts +1 -1
- package/front_end/models/text_utils/TextUtils.ts +26 -0
- package/front_end/models/trace/ModelImpl.ts +2 -16
- package/front_end/models/trace/Processor.ts +14 -8
- package/front_end/models/trace/handlers/AuctionWorkletsHandler.ts +4 -4
- package/front_end/models/trace/handlers/FramesHandler.ts +2 -2
- package/front_end/models/trace/handlers/LayoutShiftsHandler.ts +7 -10
- package/front_end/models/trace/handlers/MetaHandler.ts +11 -9
- package/front_end/models/trace/handlers/ScreenshotsHandler.ts +1 -1
- package/front_end/models/trace/handlers/ScriptsHandler.ts +5 -5
- package/front_end/models/trace/handlers/UserInteractionsHandler.ts +2 -14
- package/front_end/models/trace/handlers/UserTimingsHandler.ts +3 -4
- package/front_end/models/trace/insights/CLSCulprits.ts +1 -1
- package/front_end/models/trace/insights/DocumentLatency.ts +8 -7
- package/front_end/models/trace/insights/DuplicatedJavaScript.ts +1 -1
- package/front_end/models/trace/insights/INPBreakdown.ts +1 -1
- package/front_end/models/trace/insights/ImageDelivery.ts +1 -1
- package/front_end/models/trace/insights/LCPBreakdown.ts +1 -1
- package/front_end/models/trace/insights/LCPDiscovery.ts +1 -1
- package/front_end/models/trace/insights/ModernHTTP.ts +1 -1
- package/front_end/models/trace/insights/NetworkDependencyTree.ts +1 -1
- package/front_end/models/trace/insights/RenderBlocking.ts +1 -1
- package/front_end/models/trace/insights/types.ts +2 -0
- package/front_end/models/trace/types/Configuration.ts +12 -0
- package/front_end/models/trace/types/TraceEvents.ts +41 -64
- package/front_end/models/trace_source_maps_resolver/trace_source_maps_resolver.ts +1 -1
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +21 -99
- package/front_end/panels/application/ServiceWorkersView.ts +0 -1
- package/front_end/panels/application/components/BackForwardCacheStrings.ts +8 -2
- package/front_end/panels/browser_debugger/CategorizedBreakpointsSidebarPane.ts +2 -3
- package/front_end/panels/common/BadgeNotification.ts +10 -8
- package/front_end/panels/common/GdpSignUpDialog.ts +30 -14
- package/front_end/panels/common/gdpSignUpDialog.css +4 -0
- package/front_end/panels/console/ConsoleView.ts +23 -28
- package/front_end/panels/console/ConsoleViewport.ts +2 -2
- package/front_end/panels/console/consoleView.css +11 -1
- package/front_end/panels/coverage/CoverageView.ts +2 -2
- package/front_end/panels/elements/ElementsTreeOutline.ts +2 -2
- package/front_end/panels/elements/StyleEditorWidget.ts +8 -19
- package/front_end/panels/elements/StylePropertyTreeElement.ts +39 -25
- package/front_end/panels/elements/StylesSidebarPane.ts +2 -2
- package/front_end/panels/elements/stylePropertiesTreeOutline.css +4 -3
- package/front_end/panels/layer_viewer/Layers3DView.ts +2 -2
- package/front_end/panels/layers/LayerTreeModel.ts +3 -3
- package/front_end/panels/mobile_throttling/ThrottlingSettingsTab.ts +4 -4
- package/front_end/panels/network/NetworkLogView.ts +1 -1
- package/front_end/panels/network/NetworkLogViewColumns.ts +3 -3
- package/front_end/panels/network/NetworkSearchScope.ts +6 -6
- package/front_end/panels/search/SearchView.ts +220 -159
- package/front_end/panels/settings/components/SyncSection.ts +64 -10
- package/front_end/panels/settings/components/syncSection.css +6 -0
- package/front_end/panels/sources/AiCodeCompletionPlugin.ts +1 -4
- package/front_end/panels/sources/SourcesSearchScope.ts +4 -4
- package/front_end/panels/sources/TabbedEditorContainer.ts +5 -5
- package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +10 -5
- package/front_end/panels/timeline/TimelineFlameChartView.ts +18 -15
- package/front_end/panels/timeline/TimelinePanel.ts +41 -22
- package/front_end/panels/timeline/TracingLayerTree.ts +4 -5
- package/front_end/panels/timeline/components/ExportTraceOptions.ts +37 -22
- package/front_end/panels/timeline/components/insights/BaseInsightComponent.ts +17 -7
- package/front_end/panels/webauthn/WebauthnPane.ts +1 -1
- package/front_end/third_party/axe-core/README.chromium +1 -0
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/codemirror/README.chromium +1 -0
- package/front_end/third_party/codemirror.next/README.chromium +1 -0
- package/front_end/third_party/csp_evaluator/README.chromium +1 -0
- package/front_end/third_party/diff/README.chromium +1 -0
- package/front_end/third_party/i18n/README.chromium +1 -0
- package/front_end/third_party/intl-messageformat/README.chromium +1 -0
- package/front_end/third_party/json5/README.chromium +1 -0
- package/front_end/third_party/legacy-javascript/README.chromium +1 -0
- package/front_end/third_party/lighthouse/README.chromium +1 -0
- package/front_end/third_party/lit/README.chromium +1 -0
- package/front_end/third_party/marked/README.chromium +1 -0
- package/front_end/third_party/puppeteer/README.chromium +2 -2
- package/front_end/third_party/puppeteer/package/README.md +6 -3
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Browser.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.d.ts +11 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.d.ts +5 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.js +30 -8
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/BrowsingContext.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/BrowsingContext.js +1 -3
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/BrowsingContext.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/Realm.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/NetworkManager.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/NetworkManager.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/NetworkManager.js +8 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/NetworkManager.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.d.ts +5 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.js +8 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/version.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/version.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/injected/injected.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserLauncher.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserLauncher.js +5 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserLauncher.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Mutex.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +12 -2
- package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +22 -8
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Browser.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.d.ts +11 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.d.ts +5 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.js +30 -8
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/BrowsingContext.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/BrowsingContext.js +1 -3
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/BrowsingContext.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/NetworkManager.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/NetworkManager.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/NetworkManager.js +8 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/NetworkManager.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.d.ts +5 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.js +8 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/version.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/version.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserLauncher.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserLauncher.js +5 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserLauncher.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/types.d.ts +12 -2
- package/front_end/third_party/puppeteer/package/package.json +4 -4
- package/front_end/third_party/puppeteer/package/src/api/Browser.ts +1 -1
- package/front_end/third_party/puppeteer/package/src/api/Page.ts +13 -2
- package/front_end/third_party/puppeteer/package/src/bidi/Page.ts +50 -8
- package/front_end/third_party/puppeteer/package/src/bidi/core/BrowsingContext.ts +0 -1
- package/front_end/third_party/puppeteer/package/src/cdp/NetworkManager.ts +8 -1
- package/front_end/third_party/puppeteer/package/src/cdp/Page.ts +21 -5
- package/front_end/third_party/puppeteer/package/src/generated/version.ts +1 -1
- package/front_end/third_party/puppeteer/package/src/node/BrowserLauncher.ts +12 -0
- package/front_end/third_party/puppeteer-replay/README.chromium +1 -0
- package/front_end/third_party/third-party-web/README.chromium +1 -0
- package/front_end/third_party/vscode.web-custom-data/README.chromium +1 -0
- package/front_end/third_party/wasmparser/README.chromium +1 -0
- package/front_end/third_party/web-vitals/README.chromium +1 -0
- package/front_end/ui/components/text_editor/config.ts +66 -16
- package/front_end/ui/components/tooltips/Tooltip.ts +17 -1
- package/front_end/ui/legacy/ContextMenu.ts +2 -2
- package/front_end/ui/legacy/GlassPane.ts +7 -3
- package/front_end/ui/legacy/ProgressIndicator.ts +33 -21
- package/front_end/ui/legacy/TabbedPane.ts +2 -2
- package/front_end/ui/legacy/Treeoutline.ts +10 -5
- package/front_end/ui/legacy/UIUtils.ts +42 -10
- package/front_end/ui/legacy/components/color_picker/Spectrum.ts +14 -14
- package/front_end/ui/legacy/components/data_grid/DataGrid.ts +6 -6
- package/front_end/ui/legacy/components/data_grid/DataGridElement.ts +4 -2
- package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +3 -29
- package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +14 -14
- package/front_end/ui/visual_logging/Debugging.ts +24 -12
- package/front_end/ui/visual_logging/KnownContextValues.ts +3 -0
- package/inspector_overlay/highlight_common.ts +1 -27
- package/inspector_overlay/highlight_grid_common.ts +1 -27
- package/inspector_overlay/tool_highlight.ts +1 -27
- package/inspector_overlay/tool_persistent.ts +1 -27
- package/inspector_overlay/tool_source_order.ts +1 -27
- package/package.json +3 -3
@@ -132,7 +132,6 @@ function moveCompletionSelectionIfNotConservative(
|
|
132
132
|
if (CM.completionStatus(view.state) !== 'active') {
|
133
133
|
return false;
|
134
134
|
}
|
135
|
-
view.dispatch({effects: setAiAutoCompleteSuggestion.of(null)});
|
136
135
|
if (view.state.field(conservativeCompletion, false)) {
|
137
136
|
view.dispatch({effects: disableConservativeCompletion.of(null)});
|
138
137
|
announceSelectedCompletionInfo(view);
|
@@ -149,7 +148,6 @@ function moveCompletionSelectionBackwardWrapper(): ((view: CM.EditorView) => boo
|
|
149
148
|
if (CM.completionStatus(view.state) !== 'active') {
|
150
149
|
return false;
|
151
150
|
}
|
152
|
-
view.dispatch({effects: setAiAutoCompleteSuggestion.of(null)});
|
153
151
|
CM.moveCompletionSelection(false)(view);
|
154
152
|
announceSelectedCompletionInfo(view);
|
155
153
|
return true;
|
@@ -523,11 +521,11 @@ export const aiAutoCompleteSuggestionState = CM.StateField.define<ActiveSuggesti
|
|
523
521
|
const {head} = tr.state.selection.main;
|
524
522
|
|
525
523
|
// If a change happened before the position from which suggestion was generated, set to null.
|
526
|
-
if (
|
524
|
+
if (head < from) {
|
527
525
|
return null;
|
528
526
|
}
|
529
527
|
|
530
|
-
// Check if what's typed is a prefix of the suggestion.
|
528
|
+
// Check if what's typed after the AI suggestion is a prefix of the AI suggestion.
|
531
529
|
const typedText = tr.state.doc.sliceString(from, head);
|
532
530
|
return value.text.startsWith(typedText) ? value : null;
|
533
531
|
},
|
@@ -539,6 +537,11 @@ export function hasActiveAiSuggestion(state: CM.EditorState): boolean {
|
|
539
537
|
|
540
538
|
export function acceptAiAutoCompleteSuggestion(view: CM.EditorView):
|
541
539
|
{accepted: boolean, suggestion?: ActiveSuggestion} {
|
540
|
+
const selectedCompletion = CM.selectedCompletion(view.state);
|
541
|
+
if (selectedCompletion) {
|
542
|
+
return {accepted: false};
|
543
|
+
}
|
544
|
+
|
542
545
|
const suggestion = view.state.field(aiAutoCompleteSuggestionState);
|
543
546
|
if (!suggestion) {
|
544
547
|
return {accepted: false};
|
@@ -568,23 +571,70 @@ export const aiAutoCompleteSuggestion: CM.Extension = [
|
|
568
571
|
decorations: CM.DecorationSet = CM.Decoration.none;
|
569
572
|
|
570
573
|
update(update: CM.ViewUpdate): void {
|
574
|
+
// Hide decorations if there is no active AI suggestion.
|
571
575
|
const activeSuggestion = update.state.field(aiAutoCompleteSuggestionState);
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
const {text, from} = activeSuggestion;
|
576
|
-
const typedText = update.state.doc.sliceString(from, head);
|
577
|
-
if (text.startsWith(typedText)) {
|
578
|
-
hint = text.slice(typedText.length);
|
579
|
-
}
|
576
|
+
if (!activeSuggestion) {
|
577
|
+
this.decorations = CM.Decoration.none;
|
578
|
+
return;
|
580
579
|
}
|
581
580
|
|
582
|
-
|
581
|
+
// Hide AI suggestion while the user is interacting with the traditional
|
582
|
+
// autocomplete menu to avoid conflicting suggestions.
|
583
|
+
if (CM.completionStatus(update.view.state) === 'pending') {
|
583
584
|
this.decorations = CM.Decoration.none;
|
584
|
-
|
585
|
-
this.decorations =
|
586
|
-
CM.Decoration.set([CM.Decoration.widget({widget: new CompletionHint(hint), side: 1}).range(head)]);
|
585
|
+
return;
|
587
586
|
}
|
587
|
+
|
588
|
+
// Hide AI suggestion if the user has selected an item from the
|
589
|
+
// traditional autocomplete menu that is not the first one.
|
590
|
+
const selectedCompletionIndex = CM.selectedCompletionIndex(update.state);
|
591
|
+
if (selectedCompletionIndex && selectedCompletionIndex > 0) {
|
592
|
+
this.decorations = CM.Decoration.none;
|
593
|
+
return;
|
594
|
+
}
|
595
|
+
|
596
|
+
const {head} = update.state.selection.main;
|
597
|
+
const selectedCompletion = CM.selectedCompletion(update.state);
|
598
|
+
const additionallyTypedText = update.state.doc.sliceString(activeSuggestion.from, head);
|
599
|
+
// The user might have typed text after the suggestion is triggered.
|
600
|
+
// If the suggestion no longer starts with the typed text, hide it.
|
601
|
+
if (!activeSuggestion.text.startsWith(additionallyTypedText)) {
|
602
|
+
this.decorations = CM.Decoration.none;
|
603
|
+
return;
|
604
|
+
}
|
605
|
+
|
606
|
+
let ghostText = activeSuggestion.text.slice(additionallyTypedText.length);
|
607
|
+
if (selectedCompletion) {
|
608
|
+
// If the user typed the full selected completion, then we don't check for overlap.
|
609
|
+
// (e.g. the user wrote `flex`, traditional suggestion is `flex` and the AI autocompletion is
|
610
|
+
// `;\njustify-content: center`. Then, we want to show the AI completion)
|
611
|
+
const endsWithCompleteSelectedCompletion =
|
612
|
+
update.state.doc.sliceString(head - selectedCompletion.label.length, head) === selectedCompletion.label;
|
613
|
+
// If a traditional autocomplete menu is shown, the AI suggestion is only
|
614
|
+
// shown if it builds upon the currently selected item. If there is no
|
615
|
+
// overlap, we hide the AI suggestion. For example, for the text `console`
|
616
|
+
// if the traditional autocomplete suggests `log` and the AI
|
617
|
+
// suggests `warn`, there is no overlap and the AI suggestion is hidden.
|
618
|
+
if (!endsWithCompleteSelectedCompletion &&
|
619
|
+
!TextUtils.TextUtils.getOverlap(selectedCompletion.label, ghostText)) {
|
620
|
+
this.decorations = CM.Decoration.none;
|
621
|
+
return;
|
622
|
+
}
|
623
|
+
}
|
624
|
+
|
625
|
+
// When `conservativeCompletion` is disabled in Console, the editor shows a ghost
|
626
|
+
// text for the first item in the traditional autocomplete menu and this ghost text
|
627
|
+
// is reflected in `currentHint`. In this case, we need to remove
|
628
|
+
// the overlapping part from our AI suggestion's ghost text to avoid
|
629
|
+
// showing a double suggestion.
|
630
|
+
const currentMenuHint = update.view.plugin(showCompletionHint)?.currentHint;
|
631
|
+
const conservativeCompletionEnabled = update.state.field(conservativeCompletion, false);
|
632
|
+
if (!conservativeCompletionEnabled && currentMenuHint) {
|
633
|
+
ghostText = ghostText.slice(currentMenuHint.length);
|
634
|
+
}
|
635
|
+
|
636
|
+
this.decorations =
|
637
|
+
CM.Decoration.set([CM.Decoration.widget({widget: new CompletionHint(ghostText), side: 1}).range(head)]);
|
588
638
|
}
|
589
639
|
},
|
590
640
|
{decorations: p => p.decorations}),
|
@@ -162,12 +162,14 @@ export interface TooltipProperties {
|
|
162
162
|
* @property variant - reflects the `"variant"` attribute.
|
163
163
|
* @property padding - reflects the `"padding"` attribute.
|
164
164
|
* @property useClick - reflects the `"click"` attribute.
|
165
|
+
* @property verticalDistanceIncrease - reflexts the `"vertical-distance-increase"` attribute.
|
165
166
|
* @attribute id - Id of the tooltip. Used for searching an anchor element with aria-describedby.
|
166
167
|
* @attribute hover-delay - Hover length in ms before the tooltip is shown and hidden.
|
167
168
|
* @attribute variant - Variant of the tooltip, `"simple"` for strings only, inverted background,
|
168
169
|
* `"rich"` for interactive content, background according to theme's surface.
|
169
170
|
* @attribute padding - Which padding to use, defaults to `"small"`. Use `"large"` for richer content.
|
170
171
|
* @attribute use-click - If present, the tooltip will be shown on click instead of on hover.
|
172
|
+
* @attribute vertical-distance-increase - The tooltip is moved vertically this many pixels further away from its anchor.
|
171
173
|
* @attribute use-hotkey - If present, the tooltip will be shown on hover but not when receiving focus.
|
172
174
|
* Requires a hotkey to open when fosed (Alt-down). When `"use-click"` is present
|
173
175
|
* as well, use-click takes precedence.
|
@@ -244,6 +246,14 @@ export class Tooltip extends HTMLElement {
|
|
244
246
|
this.#updateJslog();
|
245
247
|
}
|
246
248
|
|
249
|
+
get verticalDistanceIncrease(): number {
|
250
|
+
return this.hasAttribute('vertical-distance-increase') ? Number(this.getAttribute('vertical-distance-increase')) :
|
251
|
+
0;
|
252
|
+
}
|
253
|
+
set verticalDistanceIncrease(increase: number) {
|
254
|
+
this.setAttribute('vertical-distance-increase', increase.toString());
|
255
|
+
}
|
256
|
+
|
247
257
|
get anchor(): HTMLElement|null {
|
248
258
|
return this.#anchor;
|
249
259
|
}
|
@@ -387,7 +397,13 @@ export class Tooltip extends HTMLElement {
|
|
387
397
|
proposedRectForRichTooltip({inspectorViewRect, anchorRect, currentPopoverRect}) :
|
388
398
|
proposedRectForSimpleTooltip({inspectorViewRect, anchorRect, currentPopoverRect});
|
389
399
|
this.style.left = `${proposedPopoverRect.left}px`;
|
390
|
-
|
400
|
+
|
401
|
+
// If the tooltip is above its anchor, we need to decrease the tooltip's
|
402
|
+
// y-coordinate to increase the distance between tooltip and anchor.
|
403
|
+
// If the tooltip is below its anchor, we add to the tooltip's y-coord.
|
404
|
+
const actualVerticalOffset =
|
405
|
+
anchorRect.top < proposedPopoverRect.top ? this.verticalDistanceIncrease : -this.verticalDistanceIncrease;
|
406
|
+
this.style.top = `${proposedPopoverRect.top + actualVerticalOffset}px`;
|
391
407
|
this.style.visibility = 'visible';
|
392
408
|
requestAnimationFrame(this.#positionPopover);
|
393
409
|
};
|
@@ -743,7 +743,7 @@ export class ContextMenu extends SubMenu {
|
|
743
743
|
|
744
744
|
this.pendingTargets = [];
|
745
745
|
|
746
|
-
this
|
746
|
+
this.#show();
|
747
747
|
}
|
748
748
|
|
749
749
|
/**
|
@@ -780,7 +780,7 @@ export class ContextMenu extends SubMenu {
|
|
780
780
|
}
|
781
781
|
}
|
782
782
|
|
783
|
-
|
783
|
+
#show(): void {
|
784
784
|
if (!this.eventTarget) {
|
785
785
|
return;
|
786
786
|
}
|
@@ -28,6 +28,7 @@ export class GlassPane {
|
|
28
28
|
constructor(jslog?: string) {
|
29
29
|
this.#widget = new Widget({jslog, useShadowDom: true});
|
30
30
|
this.#widget.markAsRoot();
|
31
|
+
this.#widget.onDetach = this.#onDetach.bind(this);
|
31
32
|
this.element = this.#widget.element;
|
32
33
|
this.contentElement = this.#widget.contentElement;
|
33
34
|
|
@@ -124,15 +125,18 @@ export class GlassPane {
|
|
124
125
|
if (!this.isShowing()) {
|
125
126
|
return;
|
126
127
|
}
|
127
|
-
panes.delete(this);
|
128
|
-
this.element.ownerDocument.body.removeEventListener('mousedown', this.onMouseDownBound, true);
|
129
|
-
this.element.ownerDocument.body.removeEventListener('pointerdown', this.onMouseDownBound, true);
|
130
128
|
this.#widget.detach();
|
131
129
|
if (this.#onHideCallback) {
|
132
130
|
this.#onHideCallback();
|
133
131
|
}
|
134
132
|
}
|
135
133
|
|
134
|
+
#onDetach(): void {
|
135
|
+
panes.delete(this);
|
136
|
+
this.element.ownerDocument.body.removeEventListener('mousedown', this.onMouseDownBound, true);
|
137
|
+
this.element.ownerDocument.body.removeEventListener('pointerdown', this.onMouseDownBound, true);
|
138
|
+
}
|
139
|
+
|
136
140
|
private onMouseDown(event: Event): void {
|
137
141
|
if (!this.onClickOutsideCallback) {
|
138
142
|
return;
|
@@ -12,7 +12,7 @@ export class ProgressIndicator extends HTMLElement implements Common.Progress.Pr
|
|
12
12
|
readonly #contentElement: Element;
|
13
13
|
#labelElement: Element;
|
14
14
|
#progressElement: HTMLProgressElement;
|
15
|
-
|
15
|
+
#stopButton?: Element;
|
16
16
|
#isCanceled = false;
|
17
17
|
#worked = 0;
|
18
18
|
#isDone = false;
|
@@ -25,53 +25,65 @@ export class ProgressIndicator extends HTMLElement implements Common.Progress.Pr
|
|
25
25
|
this.#labelElement = this.#contentElement.createChild('div', 'title');
|
26
26
|
this.#progressElement = this.#contentElement.createChild('progress');
|
27
27
|
this.#progressElement.value = 0;
|
28
|
+
}
|
28
29
|
|
30
|
+
connectedCallback(): void {
|
31
|
+
this.classList.add('progress-indicator');
|
29
32
|
// By default we show the stop button, but this can be controlled by
|
30
33
|
// using the 'no-stop-button' attribute on the element.
|
31
34
|
if (!this.hasAttribute('no-stop-button')) {
|
32
35
|
this.#stopButton = this.#contentElement.createChild('button', 'progress-indicator-shadow-stop-button');
|
33
|
-
this.#stopButton.addEventListener('click',
|
36
|
+
this.#stopButton.addEventListener('click', () => {
|
37
|
+
this.canceled = true;
|
38
|
+
});
|
34
39
|
}
|
35
40
|
}
|
36
41
|
|
37
|
-
|
38
|
-
this
|
39
|
-
}
|
40
|
-
|
41
|
-
done(): void {
|
42
|
-
if (this.#isDone) {
|
42
|
+
set done(done: boolean) {
|
43
|
+
if (this.#isDone === done) {
|
43
44
|
return;
|
44
45
|
}
|
45
|
-
this.#isDone =
|
46
|
-
|
46
|
+
this.#isDone = done;
|
47
|
+
if (done) {
|
48
|
+
this.remove();
|
49
|
+
}
|
47
50
|
}
|
48
51
|
|
49
|
-
|
50
|
-
this.#
|
52
|
+
get done(): boolean {
|
53
|
+
return this.#isDone;
|
51
54
|
}
|
52
55
|
|
53
|
-
|
56
|
+
set canceled(value: boolean) {
|
57
|
+
this.#isCanceled = value;
|
58
|
+
}
|
59
|
+
|
60
|
+
get canceled(): boolean {
|
54
61
|
return this.#isCanceled;
|
55
62
|
}
|
56
63
|
|
57
|
-
|
64
|
+
override set title(title: string) {
|
58
65
|
this.#labelElement.textContent = title;
|
59
66
|
}
|
60
67
|
|
61
|
-
|
68
|
+
override get title(): string {
|
69
|
+
return this.#labelElement.textContent ?? '';
|
70
|
+
}
|
71
|
+
|
72
|
+
set totalWork(totalWork: number) {
|
62
73
|
this.#progressElement.max = totalWork;
|
63
74
|
}
|
64
75
|
|
65
|
-
|
76
|
+
get totalWork(): number {
|
77
|
+
return this.#progressElement.max;
|
78
|
+
}
|
79
|
+
|
80
|
+
set worked(worked: number) {
|
66
81
|
this.#worked = worked;
|
67
82
|
this.#progressElement.value = worked;
|
68
|
-
if (title) {
|
69
|
-
this.setTitle(title);
|
70
|
-
}
|
71
83
|
}
|
72
84
|
|
73
|
-
|
74
|
-
this
|
85
|
+
get worked(): number {
|
86
|
+
return this.#worked;
|
75
87
|
}
|
76
88
|
}
|
77
89
|
|
@@ -242,7 +242,7 @@ export class TabbedPane extends Common.ObjectWrapper.eventMixin<EventTypes, type
|
|
242
242
|
|
243
243
|
const focused = this.hasFocus();
|
244
244
|
for (let i = 0; i < ids.length; ++i) {
|
245
|
-
this
|
245
|
+
this.#closeTab(ids[i], userGesture);
|
246
246
|
}
|
247
247
|
this.requestUpdate();
|
248
248
|
if (this.tabsHistory.length) {
|
@@ -253,7 +253,7 @@ export class TabbedPane extends Common.ObjectWrapper.eventMixin<EventTypes, type
|
|
253
253
|
}
|
254
254
|
}
|
255
255
|
|
256
|
-
|
256
|
+
#closeTab(id: string, userGesture?: boolean): true|undefined {
|
257
257
|
const tab = this.tabsById.get(id);
|
258
258
|
if (!tab) {
|
259
259
|
return;
|
@@ -1618,8 +1618,8 @@ function getTreeNodes(nodeList: NodeList|Node[]): HTMLLIElement[] {
|
|
1618
1618
|
|
1619
1619
|
/**
|
1620
1620
|
* A tree element that can be used as progressive enhancement over a <ul> element. A `template` IDL attribute allows
|
1621
|
-
* additionally to insert the <ul> into a <template>, avoiding rendering anything into light DOM
|
1622
|
-
* be cloned into shadow DOM and rendered there.
|
1621
|
+
* additionally to insert the <ul> into a <template>, avoiding rendering anything into light DOM, which is recommended.
|
1622
|
+
* The <ul> itself will be cloned into shadow DOM and rendered there.
|
1623
1623
|
*
|
1624
1624
|
* ## Usage ##
|
1625
1625
|
*
|
@@ -1663,12 +1663,17 @@ function getTreeNodes(nodeList: NodeList|Node[]): HTMLLIElement[] {
|
|
1663
1663
|
*
|
1664
1664
|
* ## Event Handling ##
|
1665
1665
|
*
|
1666
|
+
* This section is only relevant if NOT using the `template`.
|
1667
|
+
*
|
1666
1668
|
* Since config elements are cloned into the shadow DOM, it's not possible to directly attach event listeners to the
|
1667
|
-
* children of config elements. Instead, the `
|
1669
|
+
* children of config elements. Instead, the `UI.UIUtils.InterceptBindingDirective` directive needs to be used as a
|
1670
|
+
* wrapper:
|
1668
1671
|
* ```
|
1669
|
-
*
|
1672
|
+
* const on = Lit.Directive.directive(UI.UIUtils.InterceptBindingDirective);
|
1673
|
+
*
|
1674
|
+
* html`<li role="treeitem">
|
1670
1675
|
* <button @click=${on(clickHandler)}>click me</button>
|
1671
|
-
* </li
|
1676
|
+
* </li>`
|
1672
1677
|
* ```
|
1673
1678
|
*
|
1674
1679
|
* @property template Define the tree contents
|
@@ -2181,17 +2181,15 @@ export function bindToAction(actionName: string): ReturnType<typeof Directives.r
|
|
2181
2181
|
});
|
2182
2182
|
}
|
2183
2183
|
|
2184
|
-
|
2185
|
-
|
2184
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
2185
|
+
type BindingEventListener = (arg: any) => any;
|
2186
|
+
export class InterceptBindingDirective extends Lit.Directive.Directive {
|
2187
|
+
static readonly #interceptedBindings = new WeakMap<Element, Map<string, BindingEventListener>>();
|
2186
2188
|
|
2187
|
-
|
2188
|
-
super(part);
|
2189
|
+
override update(part: Lit.Directive.Part, [listener]: [BindingEventListener]): unknown {
|
2189
2190
|
if (part.type !== Lit.Directive.PartType.EVENT) {
|
2190
|
-
|
2191
|
+
return listener;
|
2191
2192
|
}
|
2192
|
-
}
|
2193
|
-
|
2194
|
-
override update(part: Lit.Directive.EventPart, [listener]: [(e: Event) => void]): undefined {
|
2195
2193
|
let eventListeners = InterceptBindingDirective.#interceptedBindings.get(part.element);
|
2196
2194
|
if (!eventListeners) {
|
2197
2195
|
eventListeners = new Map();
|
@@ -2202,7 +2200,8 @@ class InterceptBindingDirective extends Lit.Directive.Directive {
|
|
2202
2200
|
return this.render(listener);
|
2203
2201
|
}
|
2204
2202
|
|
2205
|
-
|
2203
|
+
/* eslint-disable-next-line @typescript-eslint/no-unsafe-function-type */
|
2204
|
+
render(_listener: Function): undefined {
|
2206
2205
|
return undefined;
|
2207
2206
|
}
|
2208
2207
|
|
@@ -2218,7 +2217,6 @@ class InterceptBindingDirective extends Lit.Directive.Directive {
|
|
2218
2217
|
}
|
2219
2218
|
|
2220
2219
|
export class HTMLElementWithLightDOMTemplate extends HTMLElement {
|
2221
|
-
static readonly on = Lit.Directive.directive(InterceptBindingDirective);
|
2222
2220
|
readonly #mutationObserver = new MutationObserver(this.#onChange.bind(this));
|
2223
2221
|
#contentTemplate: HTMLTemplateElement|null = null;
|
2224
2222
|
|
@@ -2238,6 +2236,39 @@ export class HTMLElementWithLightDOMTemplate extends HTMLElement {
|
|
2238
2236
|
return clone;
|
2239
2237
|
}
|
2240
2238
|
|
2239
|
+
private static patchLitTemplate(template: Lit.LitTemplate): void {
|
2240
|
+
const wrapper = Lit.Directive.directive(InterceptBindingDirective);
|
2241
|
+
if (template === Lit.nothing) {
|
2242
|
+
return;
|
2243
|
+
}
|
2244
|
+
template.values = template.values.map(patchValue);
|
2245
|
+
|
2246
|
+
function isLitTemplate(value: unknown): value is Lit.TemplateResult<1> {
|
2247
|
+
return Boolean(
|
2248
|
+
typeof value === 'object' && value && '_$litType$' in value && 'strings' in value && 'values' in value &&
|
2249
|
+
value['_$litType$'] === 1);
|
2250
|
+
}
|
2251
|
+
|
2252
|
+
function patchValue(value: unknown): unknown {
|
2253
|
+
if (typeof value === 'function') {
|
2254
|
+
try {
|
2255
|
+
return wrapper(value);
|
2256
|
+
} catch {
|
2257
|
+
return value;
|
2258
|
+
}
|
2259
|
+
}
|
2260
|
+
if (isLitTemplate(value)) {
|
2261
|
+
HTMLElementWithLightDOMTemplate.patchLitTemplate(value);
|
2262
|
+
return value;
|
2263
|
+
}
|
2264
|
+
if (Array.isArray(value)) {
|
2265
|
+
return value.map(patchValue);
|
2266
|
+
}
|
2267
|
+
|
2268
|
+
return value;
|
2269
|
+
}
|
2270
|
+
}
|
2271
|
+
|
2241
2272
|
set template(template: Lit.LitTemplate) {
|
2242
2273
|
if (!this.#contentTemplate) {
|
2243
2274
|
this.removeChildren();
|
@@ -2246,6 +2277,7 @@ export class HTMLElementWithLightDOMTemplate extends HTMLElement {
|
|
2246
2277
|
this.#mutationObserver.observe(
|
2247
2278
|
this.#contentTemplate.content, {childList: true, attributes: true, subtree: true, characterData: true});
|
2248
2279
|
}
|
2280
|
+
HTMLElementWithLightDOMTemplate.patchLitTemplate(template);
|
2249
2281
|
// eslint-disable-next-line rulesdir/no-lit-render-outside-of-view
|
2250
2282
|
render(template, this.#contentTemplate.content);
|
2251
2283
|
}
|
@@ -493,7 +493,7 @@ export class Spectrum extends Common.ObjectWrapper.eventMixin<EventTypes, typeof
|
|
493
493
|
const positionFraction = (sliderPosition - hueAlphaLeft) / this.hueAlphaWidth;
|
494
494
|
const newHue = 1 - positionFraction;
|
495
495
|
hsva[0] = Platform.NumberUtilities.clamp(newHue, 0, 1);
|
496
|
-
this
|
496
|
+
this.#setColor(hsva, '', undefined /* colorName */, undefined, ChangeSource.Other);
|
497
497
|
const color = getColorFromHsva(this.gamut, hsva);
|
498
498
|
const colorValues = color.as(Common.Color.Format.HSL).canonicalHSLA();
|
499
499
|
UI.ARIAUtils.setValueNow(this.hueElement, colorValues[0]);
|
@@ -506,7 +506,7 @@ export class Spectrum extends Common.ObjectWrapper.eventMixin<EventTypes, typeof
|
|
506
506
|
const positionFraction = (sliderPosition - hueAlphaLeft) / this.hueAlphaWidth;
|
507
507
|
const newAlpha = Math.round(positionFraction * 100) / 100;
|
508
508
|
hsva[3] = Platform.NumberUtilities.clamp(newAlpha, 0, 1);
|
509
|
-
this
|
509
|
+
this.#setColor(hsva, '', undefined /* colorName */, undefined, ChangeSource.Other);
|
510
510
|
const color = getColorFromHsva(this.gamut, hsva);
|
511
511
|
const colorValues = color.as(Common.Color.Format.HSL).canonicalHSLA();
|
512
512
|
UI.ARIAUtils.setValueText(this.alphaElement, colorValues[3]);
|
@@ -518,7 +518,7 @@ export class Spectrum extends Common.ObjectWrapper.eventMixin<EventTypes, typeof
|
|
518
518
|
this.colorOffset = this.colorElement.getBoundingClientRect();
|
519
519
|
hsva[1] = Platform.NumberUtilities.clamp((colorPosition.x - this.colorOffset.left) / this.dragWidth, 0, 1);
|
520
520
|
hsva[2] = Platform.NumberUtilities.clamp(1 - (colorPosition.y - this.colorOffset.top) / this.dragHeight, 0, 1);
|
521
|
-
this
|
521
|
+
this.#setColor(hsva, '', undefined /* colorName */, undefined, ChangeSource.Other);
|
522
522
|
}
|
523
523
|
|
524
524
|
function getUpdatedColorPosition(dragElement: Element, event: Event): {
|
@@ -959,7 +959,7 @@ export class Spectrum extends Common.ObjectWrapper.eventMixin<EventTypes, typeof
|
|
959
959
|
const colorName = palette.colorNames[colorIndex];
|
960
960
|
const color = Common.Color.parse(colorText);
|
961
961
|
if (color) {
|
962
|
-
this
|
962
|
+
this.#setColor(
|
963
963
|
color, colorText, colorName, palette.matchUserFormat ? this.colorFormat : color.format(),
|
964
964
|
ChangeSource.Other);
|
965
965
|
}
|
@@ -991,7 +991,7 @@ export class Spectrum extends Common.ObjectWrapper.eventMixin<EventTypes, typeof
|
|
991
991
|
if (event instanceof MouseEvent || Platform.KeyboardUtilities.isEnterOrSpaceKey(event)) {
|
992
992
|
const color = Common.Color.parse(shade);
|
993
993
|
if (color) {
|
994
|
-
this
|
994
|
+
this.#setColor(color, shade, shade, color.format(), ChangeSource.Other);
|
995
995
|
}
|
996
996
|
// Continue bubbling so that the color picker will close and submit the selected color.
|
997
997
|
return;
|
@@ -1063,14 +1063,14 @@ export class Spectrum extends Common.ObjectWrapper.eventMixin<EventTypes, typeof
|
|
1063
1063
|
}
|
1064
1064
|
|
1065
1065
|
setColor(color: Common.Color.Color): void {
|
1066
|
-
this
|
1066
|
+
this.#setColor(color, '', undefined /* colorName */, color.format(), ChangeSource.Model);
|
1067
1067
|
const colorValues = color.as(Common.Color.Format.HSL).canonicalHSLA();
|
1068
1068
|
UI.ARIAUtils.setValueNow(this.hueElement, colorValues[0]);
|
1069
1069
|
UI.ARIAUtils.setValueText(this.alphaElement, colorValues[3]);
|
1070
1070
|
}
|
1071
1071
|
|
1072
1072
|
private colorSelected(color: Common.Color.Legacy): void {
|
1073
|
-
this
|
1073
|
+
this.#setColor(color, '', undefined /* colorName */, undefined /* colorFormat */, ChangeSource.Other);
|
1074
1074
|
}
|
1075
1075
|
|
1076
1076
|
get color(): Common.Color.Color {
|
@@ -1081,7 +1081,7 @@ export class Spectrum extends Common.ObjectWrapper.eventMixin<EventTypes, typeof
|
|
1081
1081
|
return getColorFromHsva(this.gamut, this.hsv);
|
1082
1082
|
}
|
1083
1083
|
|
1084
|
-
|
1084
|
+
#setColor(
|
1085
1085
|
colorOrHsv: Common.Color.Color|Common.ColorUtils.Color4D|undefined, colorString: string|undefined,
|
1086
1086
|
colorName: string|undefined, colorFormat: Common.Color.Format|undefined, changeSource: string): void {
|
1087
1087
|
// It is important to do `undefined` check here since we want to update the
|
@@ -1289,7 +1289,7 @@ export class Spectrum extends Common.ObjectWrapper.eventMixin<EventTypes, typeof
|
|
1289
1289
|
const contextMenu = new FormatPickerContextMenu(this.color);
|
1290
1290
|
this.isFormatPickerShown = true;
|
1291
1291
|
await contextMenu.show(event, newColor => {
|
1292
|
-
this
|
1292
|
+
this.#setColor(newColor, undefined, undefined, newColor.format(), ChangeSource.Other);
|
1293
1293
|
});
|
1294
1294
|
this.isFormatPickerShown = false;
|
1295
1295
|
}
|
@@ -1306,7 +1306,7 @@ export class Spectrum extends Common.ObjectWrapper.eventMixin<EventTypes, typeof
|
|
1306
1306
|
if (!color) {
|
1307
1307
|
return;
|
1308
1308
|
}
|
1309
|
-
this
|
1309
|
+
this.#setColor(color, text, undefined /* colorName */, undefined /* colorFormat */, ChangeSource.Other);
|
1310
1310
|
event.preventDefault();
|
1311
1311
|
}
|
1312
1312
|
|
@@ -1360,7 +1360,7 @@ export class Spectrum extends Common.ObjectWrapper.eventMixin<EventTypes, typeof
|
|
1360
1360
|
return;
|
1361
1361
|
}
|
1362
1362
|
|
1363
|
-
this
|
1363
|
+
this.#setColor(color, undefined, undefined /* colorName */, colorFormat, ChangeSource.Input);
|
1364
1364
|
}
|
1365
1365
|
|
1366
1366
|
override wasShown(): void {
|
@@ -1369,7 +1369,7 @@ export class Spectrum extends Common.ObjectWrapper.eventMixin<EventTypes, typeof
|
|
1369
1369
|
this.dragWidth = this.colorElement.offsetWidth;
|
1370
1370
|
this.dragHeight = this.colorElement.offsetHeight;
|
1371
1371
|
this.colorDragElementHeight = this.colorDragElement.offsetHeight / 2;
|
1372
|
-
this
|
1372
|
+
this.#setColor(undefined, undefined, undefined /* colorName */, undefined, ChangeSource.Model);
|
1373
1373
|
// When flag is turned on, eye dropper is not turned on by default.
|
1374
1374
|
// This is because the global change of the cursor into a dropper will disturb the user.
|
1375
1375
|
if (!IS_NATIVE_EYE_DROPPER_AVAILABLE) {
|
@@ -1426,7 +1426,7 @@ export class Spectrum extends Common.ObjectWrapper.eventMixin<EventTypes, typeof
|
|
1426
1426
|
const hexColor = await eyeDropper.open({signal: this.eyeDropperAbortController.signal});
|
1427
1427
|
const color = Common.Color.parse(hexColor.sRGBHex);
|
1428
1428
|
|
1429
|
-
this
|
1429
|
+
this.#setColor(color ?? undefined, '', undefined /* colorName */, undefined, ChangeSource.Other);
|
1430
1430
|
} catch (error) {
|
1431
1431
|
if (error.name !== 'AbortError') {
|
1432
1432
|
console.error(error);
|
@@ -1445,7 +1445,7 @@ export class Spectrum extends Common.ObjectWrapper.eventMixin<EventTypes, typeof
|
|
1445
1445
|
}: Common.EventTarget.EventTargetEvent<Host.InspectorFrontendHostAPI.EyeDropperPickedColorEvent>): void {
|
1446
1446
|
const rgba = [rgbColor.r, rgbColor.g, rgbColor.b, (rgbColor.a / 2.55 | 0) / 100];
|
1447
1447
|
const color = Common.Color.Legacy.fromRGBA(rgba);
|
1448
|
-
this
|
1448
|
+
this.#setColor(color, '', undefined /* colorName */, undefined, ChangeSource.Other);
|
1449
1449
|
Host.InspectorFrontendHost.InspectorFrontendHostInstance.bringToFront();
|
1450
1450
|
}
|
1451
1451
|
}
|
@@ -212,7 +212,7 @@ export class DataGridImpl<T> extends Common.ObjectWrapper.ObjectWrapper<EventTyp
|
|
212
212
|
this.columns = {};
|
213
213
|
this.visibleColumnsArray = columnsArray;
|
214
214
|
|
215
|
-
columnsArray.forEach(column => this
|
215
|
+
columnsArray.forEach(column => this.#addColumn(column));
|
216
216
|
|
217
217
|
this.cellClass = null;
|
218
218
|
|
@@ -409,12 +409,12 @@ export class DataGridImpl<T> extends Common.ObjectWrapper.ObjectWrapper<EventTyp
|
|
409
409
|
UI.ARIAUtils.LiveAnnouncer.alert(accessibleText);
|
410
410
|
}
|
411
411
|
|
412
|
-
|
412
|
+
#addColumn(column: ColumnDescriptor, position?: number): void {
|
413
413
|
column.defaultWeight = column.weight;
|
414
414
|
|
415
415
|
const columnId = column.id;
|
416
416
|
if (columnId in this.columns) {
|
417
|
-
this
|
417
|
+
this.#removeColumn(columnId);
|
418
418
|
}
|
419
419
|
|
420
420
|
if (position === undefined) {
|
@@ -472,10 +472,10 @@ export class DataGridImpl<T> extends Common.ObjectWrapper.ObjectWrapper<EventTyp
|
|
472
472
|
}
|
473
473
|
|
474
474
|
addColumn(column: ColumnDescriptor, position?: number): void {
|
475
|
-
this
|
475
|
+
this.#addColumn(column, position);
|
476
476
|
}
|
477
477
|
|
478
|
-
|
478
|
+
#removeColumn(columnId: string): void {
|
479
479
|
const column = this.columns[columnId];
|
480
480
|
if (!column) {
|
481
481
|
return;
|
@@ -491,7 +491,7 @@ export class DataGridImpl<T> extends Common.ObjectWrapper.ObjectWrapper<EventTyp
|
|
491
491
|
}
|
492
492
|
|
493
493
|
removeColumn(columnId: string): void {
|
494
|
-
this
|
494
|
+
this.#removeColumn(columnId);
|
495
495
|
}
|
496
496
|
|
497
497
|
setCellClass(cellClass: string): void {
|