chrome-devtools-frontend 1.0.945884 → 1.0.948295
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/.eslintrc.js +1 -0
- package/config/gni/all_devtools_files.gni +1 -20
- package/config/gni/devtools_grd_files.gni +9 -48
- package/config/gni/devtools_image_files.gni +1 -0
- package/front_end/.eslintrc.js +6 -1
- package/front_end/Images/src/circled_backslash_icon.svg +3 -0
- package/front_end/core/host/InspectorFrontendHost.ts +0 -3
- package/front_end/core/host/InspectorFrontendHostAPI.ts +0 -1
- package/front_end/core/host/UserMetrics.ts +1 -23
- package/front_end/core/i18n/locales/en-US.json +41 -41
- package/front_end/core/i18n/locales/en-XL.json +41 -41
- package/front_end/core/platform/platform.ts +0 -2
- package/front_end/core/platform/string-utilities.ts +14 -1
- package/front_end/core/platform/utilities.ts +0 -29
- package/front_end/core/root/Runtime.ts +4 -212
- package/front_end/core/sdk/AccessibilityModel.ts +0 -2
- package/front_end/core/sdk/CSSProperty.ts +16 -11
- package/front_end/core/sdk/CSSRule.ts +0 -2
- package/front_end/core/sdk/Cookie.ts +0 -25
- package/front_end/core/sdk/EmulationModel.ts +0 -2
- package/front_end/core/sdk/HeapProfilerModel.ts +0 -2
- package/front_end/core/sdk/NetworkManager.ts +0 -3
- package/front_end/core/sdk/Resource.ts +0 -3
- package/front_end/core/sdk/ResourceTreeModel.ts +0 -3
- package/front_end/core/sdk/ServiceWorkerManager.ts +0 -2
- package/front_end/core/sdk/sdk-legacy.ts +0 -3
- package/front_end/devtools_compatibility.js +1 -8
- package/front_end/entrypoints/devtools_app/{devtools_app-meta-files.ts → devtools_app.ts} +9 -2
- package/front_end/entrypoints/formatter_worker/CSSFormatter.ts +1 -3
- package/front_end/entrypoints/formatter_worker/FormatterActions.ts +0 -2
- package/front_end/entrypoints/formatter_worker/FormatterWorker.ts +0 -120
- package/front_end/entrypoints/formatter_worker/formatter_worker-entrypoint.ts +1 -11
- package/front_end/entrypoints/formatter_worker/formatter_worker.ts +5 -0
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +2 -1
- package/front_end/entrypoints/inspector/{inspector.js → inspector.ts} +0 -3
- package/front_end/entrypoints/js_app/{JsMain.ts → js_app.ts} +5 -1
- package/front_end/entrypoints/main/MainImpl.ts +0 -7
- package/front_end/entrypoints/ndb_app/{ndb_app.js → ndb_app.ts} +3 -2
- package/front_end/entrypoints/{node_main → node_app}/NodeConnectionsPanel.ts +1 -1
- package/front_end/entrypoints/{node_main → node_app}/NodeMain.ts +2 -4
- package/front_end/entrypoints/{node_main → node_app}/nodeConnectionsPanel.css +0 -0
- package/front_end/entrypoints/node_app/node_app.ts +79 -0
- package/front_end/entrypoints/shell/{shell-meta-files.ts → shell.ts} +7 -1
- package/front_end/entrypoints/worker_app/{worker_app.js → worker_app.ts} +6 -2
- package/front_end/generated/InspectorBackendCommands.js +5 -1
- package/front_end/generated/protocol.d.ts +12 -0
- package/front_end/legacy/legacy-defs.d.ts +0 -4
- package/front_end/legacy_test_runner/sources_test_runner/sources_test_runner.js +0 -1
- package/front_end/legacy_test_runner/test_runner/TestRunner.js +35 -59
- package/front_end/models/bindings/CompilerScriptMapping.ts +0 -1
- package/front_end/models/bindings/DebuggerLanguagePlugins.ts +4 -11
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +1 -1
- package/front_end/models/bindings/ResourceMapping.ts +1 -1
- package/front_end/models/bindings/SASSSourceMapping.ts +0 -1
- package/front_end/models/emulation/DeviceModeModel.ts +0 -2
- package/front_end/models/formatter/FormatterWorkerPool.ts +0 -18
- package/front_end/models/issues_manager/CorsIssue.ts +17 -9
- package/front_end/models/issues_manager/descriptions/{corsInsecurePrivateNetworkPreflight.md → corsPreflightAllowPrivateNetworkError.md} +1 -1
- package/front_end/models/text_utils/CodeMirrorUtils.ts +6 -51
- package/front_end/models/text_utils/TextUtils.ts +1 -2
- package/front_end/models/text_utils/text_utils-legacy.ts +0 -5
- package/front_end/panels/accessibility/AccessibilitySidebarView.ts +3 -1
- package/front_end/panels/animation/AnimationTimeline.ts +0 -2
- package/front_end/panels/animation/AnimationUI.ts +0 -2
- package/front_end/panels/application/ApplicationPanelSidebar.ts +2 -4
- package/front_end/panels/application/BackForwardCacheStrings.ts +2 -5
- package/front_end/panels/application/BackForwardCacheView.ts +150 -58
- package/front_end/panels/application/ResourcesPanel.ts +0 -42
- package/front_end/panels/application/application-legacy.ts +0 -3
- package/front_end/panels/application/application-meta.ts +0 -13
- package/front_end/panels/application/backForwardCacheView.css +44 -6
- package/front_end/panels/application/components/FrameDetailsView.ts +3 -3
- package/front_end/panels/application/components/OriginTrialTreeView.ts +3 -3
- package/front_end/panels/application/components/StackTrace.ts +1 -1
- package/front_end/panels/coverage/CoverageView.ts +1 -1
- package/front_end/panels/css_overview/CSSOverviewModel.ts +0 -2
- package/front_end/panels/css_overview/CSSOverviewPanel.ts +0 -7
- package/front_end/panels/css_overview/CSSOverviewProcessingView.ts +0 -2
- package/front_end/panels/css_overview/components/cssOverviewStartView.css +1 -0
- package/front_end/panels/css_overview/cssOverviewCompletedView.css +1 -1
- package/front_end/panels/developer_resources/DeveloperResourcesView.ts +2 -1
- package/front_end/panels/elements/ColorSwatchPopoverIcon.ts +0 -11
- package/front_end/panels/elements/ElementsPanel.ts +9 -1
- package/front_end/panels/elements/ElementsTreeElement.ts +1 -1
- package/front_end/panels/elements/StylesSidebarPane.ts +0 -1
- package/front_end/panels/elements/components/ElementsBreadcrumbs.ts +1 -1
- package/front_end/panels/elements/elementsTreeOutline.css +0 -13
- package/front_end/panels/emulation/DeviceModeToolbar.ts +0 -16
- package/front_end/panels/issues/CorsIssueDetailsView.ts +18 -2
- package/front_end/panels/lighthouse/lighthouse-meta.ts +0 -3
- package/front_end/panels/network/NetworkConfigView.ts +10 -0
- package/front_end/panels/network/NetworkItemView.ts +3 -0
- package/front_end/panels/network/NetworkWaterfallColumn.ts +2 -0
- package/front_end/panels/network/networkConfigView.css +5 -0
- package/front_end/panels/profiler/CPUProfileFlameChart.ts +3 -1
- package/front_end/panels/profiler/ProfileDataGrid.ts +2 -1
- package/front_end/panels/profiler/profilesPanel.css +1 -1
- package/front_end/panels/search/SearchView.ts +24 -4
- package/front_end/panels/settings/components/SyncSection.ts +2 -2
- package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +52 -50
- package/front_end/panels/settings/emulation/components/userAgentClientHintsForm.css +0 -12
- package/front_end/panels/sources/CSSPlugin.ts +3 -0
- package/front_end/panels/sources/CoveragePlugin.ts +2 -0
- package/front_end/panels/sources/DebuggerPlugin.ts +35 -7
- package/front_end/panels/sources/JavaScriptCompilerPlugin.ts +3 -0
- package/front_end/panels/sources/ProfilePlugin.ts +3 -0
- package/front_end/panels/sources/UISourceCodeFrame.ts +11 -2
- package/front_end/panels/sources/sourcesView.css +0 -130
- package/front_end/panels/timeline/TimelineTreeView.ts +3 -1
- package/front_end/third_party/codemirror/codemirror-tsconfig.json +1 -25
- package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/cpp.js +1 -2
- package/front_end/third_party/codemirror.next/chunk/java.js +1 -2
- package/front_end/third_party/codemirror.next/chunk/json.js +1 -2
- package/front_end/third_party/codemirror.next/chunk/markdown.js +1 -2
- package/front_end/third_party/codemirror.next/chunk/php.js +1 -2
- package/front_end/third_party/codemirror.next/chunk/python.js +1 -2
- package/front_end/third_party/codemirror.next/chunk/wast.js +1 -2
- package/front_end/third_party/codemirror.next/chunk/xml.js +1 -2
- package/front_end/third_party/codemirror.next/codemirror.next.d.ts +1486 -1423
- package/front_end/third_party/codemirror.next/codemirror.next.js +1 -2
- package/front_end/third_party/codemirror.next/package.json +10 -9
- package/front_end/third_party/lighthouse/lighthouse-dt-bundle.js +168 -164
- package/front_end/third_party/lighthouse/locales/ar-XB.json +0 -3
- package/front_end/third_party/lighthouse/locales/ar.json +0 -3
- package/front_end/third_party/lighthouse/locales/bg.json +17 -20
- package/front_end/third_party/lighthouse/locales/ca.json +0 -3
- package/front_end/third_party/lighthouse/locales/cs.json +0 -3
- package/front_end/third_party/lighthouse/locales/da.json +16 -19
- package/front_end/third_party/lighthouse/locales/de.json +0 -3
- package/front_end/third_party/lighthouse/locales/el.json +0 -3
- package/front_end/third_party/lighthouse/locales/en-GB.json +19 -22
- package/front_end/third_party/lighthouse/locales/en-US.json +33 -3
- package/front_end/third_party/lighthouse/locales/en-XA.json +0 -3
- package/front_end/third_party/lighthouse/locales/en-XL.json +33 -3
- package/front_end/third_party/lighthouse/locales/es-419.json +17 -20
- package/front_end/third_party/lighthouse/locales/es.json +0 -3
- package/front_end/third_party/lighthouse/locales/fi.json +16 -19
- package/front_end/third_party/lighthouse/locales/fil.json +33 -36
- package/front_end/third_party/lighthouse/locales/fr.json +16 -19
- package/front_end/third_party/lighthouse/locales/he.json +16 -19
- package/front_end/third_party/lighthouse/locales/hi.json +0 -3
- package/front_end/third_party/lighthouse/locales/hr.json +16 -19
- package/front_end/third_party/lighthouse/locales/hu.json +16 -19
- package/front_end/third_party/lighthouse/locales/id.json +16 -19
- package/front_end/third_party/lighthouse/locales/it.json +37 -40
- package/front_end/third_party/lighthouse/locales/ja.json +16 -19
- package/front_end/third_party/lighthouse/locales/ko.json +16 -19
- package/front_end/third_party/lighthouse/locales/lt.json +17 -20
- package/front_end/third_party/lighthouse/locales/lv.json +0 -3
- package/front_end/third_party/lighthouse/locales/nl.json +16 -19
- package/front_end/third_party/lighthouse/locales/no.json +17 -20
- package/front_end/third_party/lighthouse/locales/pl.json +16 -19
- package/front_end/third_party/lighthouse/locales/pt-PT.json +37 -40
- package/front_end/third_party/lighthouse/locales/pt.json +16 -19
- package/front_end/third_party/lighthouse/locales/ro.json +0 -3
- package/front_end/third_party/lighthouse/locales/ru.json +16 -19
- package/front_end/third_party/lighthouse/locales/sk.json +0 -3
- package/front_end/third_party/lighthouse/locales/sl.json +0 -3
- package/front_end/third_party/lighthouse/locales/sr-Latn.json +16 -19
- package/front_end/third_party/lighthouse/locales/sr.json +16 -19
- package/front_end/third_party/lighthouse/locales/sv.json +17 -20
- package/front_end/third_party/lighthouse/locales/ta.json +0 -3
- package/front_end/third_party/lighthouse/locales/te.json +0 -3
- package/front_end/third_party/lighthouse/locales/th.json +0 -3
- package/front_end/third_party/lighthouse/locales/tr.json +0 -3
- package/front_end/third_party/lighthouse/locales/uk.json +17 -20
- package/front_end/third_party/lighthouse/locales/vi.json +0 -3
- package/front_end/third_party/lighthouse/locales/zh-HK.json +0 -3
- package/front_end/third_party/lighthouse/locales/zh-TW.json +0 -3
- package/front_end/third_party/lighthouse/locales/zh.json +0 -3
- package/front_end/third_party/lighthouse/report/bundle.d.ts +63 -61
- package/front_end/third_party/lighthouse/report/bundle.js +36 -7
- package/front_end/third_party/lighthouse/report-assets/report-generator.js +205 -192
- package/front_end/ui/components/diff_view/DiffView.ts +4 -4
- package/front_end/ui/components/helpers/component-server-setup.ts +1 -12
- package/front_end/ui/components/helpers/helpers.ts +0 -2
- package/front_end/ui/components/icon_button/IconButton.ts +1 -1
- package/front_end/ui/components/issue_counter/IssueCounter.ts +2 -2
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryViewer.ts +3 -3
- package/front_end/ui/components/markdown_view/MarkdownView.ts +4 -4
- package/front_end/ui/components/panel_feedback/PreviewToggle.ts +98 -0
- package/front_end/ui/components/panel_feedback/panel_feedback.ts +1 -0
- package/front_end/ui/components/panel_feedback/previewToggle.css +24 -0
- package/front_end/ui/components/report_view/ReportView.ts +22 -0
- package/front_end/ui/components/report_view/reportSection.css +20 -0
- package/front_end/ui/components/request_link_icon/RequestLinkIcon.ts +1 -1
- package/front_end/ui/components/settings/SettingCheckbox.ts +2 -2
- package/front_end/ui/components/text_editor/config.ts +11 -9
- package/front_end/ui/components/text_editor/javascript.ts +34 -12
- package/front_end/ui/components/text_editor/theme.ts +1 -0
- package/front_end/ui/components/text_prompt/TextPrompt.ts +2 -2
- package/front_end/ui/legacy/GlassPane.ts +1 -1
- package/front_end/ui/legacy/InspectorView.ts +10 -0
- package/front_end/ui/legacy/SearchableView.ts +2 -1
- package/front_end/ui/legacy/Treeoutline.ts +1 -1
- package/front_end/ui/legacy/Widget.ts +1 -1
- package/front_end/ui/legacy/XWidget.ts +0 -5
- package/front_end/ui/legacy/components/inline_editor/CSSVarSwatch.ts +2 -2
- package/front_end/ui/legacy/components/inline_editor/ColorSwatch.ts +1 -1
- package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +2 -3
- package/front_end/ui/legacy/components/object_ui/objectPropertiesSection.css +0 -1
- package/front_end/ui/legacy/components/object_ui/object_ui-legacy.ts +0 -8
- package/front_end/ui/legacy/components/object_ui/object_ui.ts +0 -4
- package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +40 -29
- package/front_end/ui/legacy/inspectorSyntaxHighlight.css +0 -211
- package/front_end/ui/legacy/legacy-legacy.ts +0 -6
- package/front_end/ui/legacy/legacy.ts +0 -2
- package/front_end/ui/legacy/tabbedPane.css +1 -1
- package/front_end/ui/legacy/themeColors.css +1 -1
- package/front_end/ui/legacy/utils/append-style.ts +2 -13
- package/front_end/ui/legacy/utils/create-shadow-root-with-core-styles.ts +7 -5
- package/package.json +2 -4
- package/scripts/build/build_inspector_overlay.py +15 -1
- package/scripts/build/rjsmin.py +84 -115
- package/scripts/eslint_rules/lib/l10n_filename_matches.js +4 -4
- package/scripts/eslint_rules/lib/lit_html_no_attribute_quotes.js +101 -0
- package/scripts/eslint_rules/lib/no_only_eslint_tests.js +53 -0
- package/scripts/eslint_rules/tests/.eslintrc.js +14 -0
- package/scripts/eslint_rules/tests/l10n_filename_matches_test.js +4 -0
- package/scripts/eslint_rules/tests/lit_html_no_attribute_quotes_test.js +45 -0
- package/scripts/eslint_rules/tests/no_only_eslint_tests_test.js +94 -0
- package/scripts/hosted_mode/server.js +17 -2
- package/front_end/entrypoints/devtools_app/devtools_app.js +0 -8
- package/front_end/entrypoints/devtools_app/devtools_app.json +0 -6
- package/front_end/entrypoints/inspector/inspector.json +0 -4
- package/front_end/entrypoints/js_app/js_app.js +0 -9
- package/front_end/entrypoints/js_app/js_app.json +0 -4
- package/front_end/entrypoints/ndb_app/ndb_app.json +0 -5
- package/front_end/entrypoints/node_app/node_app-meta.ts +0 -43
- package/front_end/entrypoints/node_app/node_app.js +0 -13
- package/front_end/entrypoints/node_app/node_app.json +0 -4
- package/front_end/entrypoints/node_main/node_main-meta.ts +0 -48
- package/front_end/entrypoints/node_main/node_main.ts +0 -11
- package/front_end/entrypoints/shell/shell.js +0 -13
- package/front_end/entrypoints/shell/shell.json +0 -5
- package/front_end/entrypoints/startup/RuntimeInstantiator.ts +0 -95
- package/front_end/entrypoints/startup/startup.ts +0 -9
- package/front_end/entrypoints/worker_app/worker_app.json +0 -4
- package/front_end/panels/lighthouse/module.json +0 -6
- package/front_end/third_party/lighthouse/report-assets/report.d.ts +0 -1
- package/front_end/third_party/lighthouse/report-assets/report.js +0 -233
- package/front_end/third_party/lighthouse/report-assets/standalone-template.html +0 -38
- package/front_end/ui/components/helpers/get-stylesheet.ts +0 -45
- package/front_end/ui/legacy/TextEditor.ts +0 -82
- package/front_end/ui/legacy/components/object_ui/JavaScriptAutocomplete.ts +0 -836
- package/front_end/ui/legacy/components/text_editor/CodeMirrorTextEditor.ts +0 -1676
- package/front_end/ui/legacy/components/text_editor/TextEditorAutocompleteController.ts +0 -586
- package/front_end/ui/legacy/components/text_editor/autocompleteTooltip.css +0 -20
- package/front_end/ui/legacy/components/text_editor/cm_modes.ts +0 -23
- package/front_end/ui/legacy/components/text_editor/cmdevtools.css +0 -995
- package/front_end/ui/legacy/components/text_editor/module.json +0 -7
- package/front_end/ui/legacy/components/text_editor/text_editor-legacy.ts +0 -33
- package/front_end/ui/legacy/components/text_editor/text_editor.ts +0 -13
- package/scripts/build/build_release_applications.py +0 -216
- package/scripts/build/modular_build.py +0 -184
- package/scripts/check_gn.js +0 -119
- package/scripts/json_validator/module.schema.json +0 -19
- package/scripts/json_validator/validate_module_json.js +0 -44
|
@@ -191,7 +191,7 @@ class DiffRenderer {
|
|
|
191
191
|
|
|
192
192
|
private render(rows: readonly Row[]): LitHtml.TemplateResult {
|
|
193
193
|
return LitHtml.html`
|
|
194
|
-
<div class="diff-listing" aria-label
|
|
194
|
+
<div class="diff-listing" aria-label=${i18nString(UIStrings.changesDiffViewer)}>
|
|
195
195
|
${rows.map(row => this.renderRow(row))}
|
|
196
196
|
</div>`;
|
|
197
197
|
}
|
|
@@ -213,7 +213,7 @@ class DiffRenderer {
|
|
|
213
213
|
return LitHtml.html`
|
|
214
214
|
<div class="diff-line-number" aria-hidden="true">${baseNumber}</div>
|
|
215
215
|
<div class="diff-line-number" aria-hidden="true">${curNumber}</div>
|
|
216
|
-
<div class
|
|
216
|
+
<div class=${markerClass} aria-hidden="true">${marker}</div>
|
|
217
217
|
<div class="diff-line-content diff-line-${row.type}" data-line-number=${curNumber}>${screenReaderText}${
|
|
218
218
|
this.renderRowContent(row)}</div>`;
|
|
219
219
|
}
|
|
@@ -230,10 +230,10 @@ class DiffRenderer {
|
|
|
230
230
|
for (const token of row.tokens) {
|
|
231
231
|
const tokenContent: (LitHtml.TemplateResult|string)[] = [];
|
|
232
232
|
doc.highlightRange(pos, pos + token.text.length, (text, style) => {
|
|
233
|
-
tokenContent.push(style ? LitHtml.html`<span class
|
|
233
|
+
tokenContent.push(style ? LitHtml.html`<span class=${style}>${text}</span>` : text);
|
|
234
234
|
});
|
|
235
235
|
content.push(
|
|
236
|
-
token.className ? LitHtml.html`<span class
|
|
236
|
+
token.className ? LitHtml.html`<span class=${token.className}>${tokenContent}</span>` :
|
|
237
237
|
LitHtml.html`${tokenContent}`);
|
|
238
238
|
pos += token.text.length;
|
|
239
239
|
}
|
|
@@ -3,28 +3,17 @@
|
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
|
|
5
5
|
import type * as Common from '../../../core/common/common.js';
|
|
6
|
-
import * as Root from '../../../core/root/root.js';
|
|
7
6
|
import * as ThemeSupport from '../../legacy/theme_support/theme_support.js';
|
|
8
7
|
|
|
9
|
-
import {CSS_RESOURCES_TO_LOAD_INTO_RUNTIME} from './get-stylesheet.js';
|
|
10
|
-
|
|
11
8
|
/**
|
|
12
9
|
* Houses any setup required to run the component docs server. Currently this is
|
|
13
10
|
* only populating the runtime CSS cache but may be extended in the future.
|
|
14
11
|
*/
|
|
15
|
-
export async function setup(
|
|
12
|
+
export async function setup(): Promise<void> {
|
|
16
13
|
const setting = {
|
|
17
14
|
get() {
|
|
18
15
|
return 'default';
|
|
19
16
|
},
|
|
20
17
|
} as Common.Settings.Setting<string>;
|
|
21
18
|
ThemeSupport.ThemeSupport.instance({forceNew: true, setting});
|
|
22
|
-
|
|
23
|
-
const allPromises = CSS_RESOURCES_TO_LOAD_INTO_RUNTIME.map(resourcePath => {
|
|
24
|
-
return fetch(resourcesPrefix + '/front_end/' + resourcePath).then(response => response.text()).then(cssText => {
|
|
25
|
-
Root.Runtime.cachedResources.set(resourcePath, cssText);
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
await Promise.all(allPromises);
|
|
30
19
|
}
|
|
@@ -6,7 +6,6 @@ import * as ComponentServerSetup from './component-server-setup.js';
|
|
|
6
6
|
import * as CustomElements from './custom-elements.js';
|
|
7
7
|
import * as Directives from './directives.js';
|
|
8
8
|
import * as GetRootNode from './get-root-node.js';
|
|
9
|
-
import * as LegacyGetStylesheet from './get-stylesheet.js';
|
|
10
9
|
import * as ScheduledRender from './scheduled-render.js';
|
|
11
10
|
import * as SetCSSProperty from './set-css-property.js';
|
|
12
11
|
|
|
@@ -15,7 +14,6 @@ export {
|
|
|
15
14
|
CustomElements,
|
|
16
15
|
Directives,
|
|
17
16
|
GetRootNode,
|
|
18
|
-
LegacyGetStylesheet,
|
|
19
17
|
ScheduledRender,
|
|
20
18
|
SetCSSProperty,
|
|
21
19
|
};
|
|
@@ -80,7 +80,7 @@ export class IconButton extends HTMLElement {
|
|
|
80
80
|
// Disabled until https://crbug.com/1079231 is fixed.
|
|
81
81
|
// clang-format off
|
|
82
82
|
LitHtml.render(LitHtml.html`
|
|
83
|
-
<button class
|
|
83
|
+
<button class=${buttonClasses} @click=${this.onClickHandler} aria-label=${LitHtml.Directives.ifDefined(this.#accessibleName)}>
|
|
84
84
|
${(!this.#compact && this.#leadingText) ? LitHtml.html`<span class="icon-button-title">${this.#leadingText}</span>` : LitHtml.nothing}
|
|
85
85
|
${filteredGroups.map(counter =>
|
|
86
86
|
LitHtml.html`
|
|
@@ -192,8 +192,8 @@ export class IssueCounter extends HTMLElement {
|
|
|
192
192
|
};
|
|
193
193
|
LitHtml.render(
|
|
194
194
|
LitHtml.html`
|
|
195
|
-
<icon-button .data=${data as IconButton.IconButton.IconButtonData} .accessibleName
|
|
196
|
-
this.#accessibleName}
|
|
195
|
+
<icon-button .data=${data as IconButton.IconButton.IconButtonData} .accessibleName=${
|
|
196
|
+
this.#accessibleName}></icon-button>
|
|
197
197
|
`,
|
|
198
198
|
this.#shadow, {host: this});
|
|
199
199
|
this.#tooltipCallback?.();
|
|
@@ -212,7 +212,7 @@ export class LinearMemoryViewer extends HTMLElement {
|
|
|
212
212
|
};
|
|
213
213
|
return html`
|
|
214
214
|
<div class="row">
|
|
215
|
-
<span class
|
|
215
|
+
<span class=${LitHtml.Directives.classMap(classMap)}>${toHexString({number: startIndex + this.#memoryOffset, pad: 8, prefix: false})}</span>
|
|
216
216
|
<span class="divider"></span>
|
|
217
217
|
${this.renderByteValues(startIndex, endIndex)}
|
|
218
218
|
<span class="divider"></span>
|
|
@@ -237,7 +237,7 @@ export class LinearMemoryViewer extends HTMLElement {
|
|
|
237
237
|
const byteValue = isSelectableCell ? html`${toHexString({number: this.#memory[i], pad: 2, prefix: false})}` : '';
|
|
238
238
|
const actualIndex = i + this.#memoryOffset;
|
|
239
239
|
const onSelectedByte = isSelectableCell ? this.onSelectedByte.bind(this, actualIndex) : '';
|
|
240
|
-
cells.push(html`<span class
|
|
240
|
+
cells.push(html`<span class=${LitHtml.Directives.classMap(classMap)} @click=${onSelectedByte}>${byteValue}</span>`);
|
|
241
241
|
}
|
|
242
242
|
return html`${cells}`;
|
|
243
243
|
}
|
|
@@ -253,7 +253,7 @@ export class LinearMemoryViewer extends HTMLElement {
|
|
|
253
253
|
const isSelectableCell = i < this.#memory.length;
|
|
254
254
|
const value = isSelectableCell ? html`${this.toAscii(this.#memory[i])}` : '';
|
|
255
255
|
const onSelectedByte = isSelectableCell ? this.onSelectedByte.bind(this, i + this.#memoryOffset) : '';
|
|
256
|
-
cells.push(html`<span class
|
|
256
|
+
cells.push(html`<span class=${LitHtml.Directives.classMap(classMap)} @click=${onSelectedByte}>${value}</span>`);
|
|
257
257
|
}
|
|
258
258
|
return html`${cells}`;
|
|
259
259
|
}
|
|
@@ -105,13 +105,13 @@ const tokenRenderers = new Map<string, (token: any) => LitHtml.TemplateResult>([
|
|
|
105
105
|
['space', (): LitHtml.TemplateResult => html``],
|
|
106
106
|
[
|
|
107
107
|
'link',
|
|
108
|
-
(token): LitHtml.TemplateResult => html`<${MarkdownLink.litTagName} .data
|
|
109
|
-
{key: token.href, title: token.text} as MarkdownLinkData}
|
|
108
|
+
(token): LitHtml.TemplateResult => html`<${MarkdownLink.litTagName} .data=${
|
|
109
|
+
{key: token.href, title: token.text} as MarkdownLinkData}></${MarkdownLink.litTagName}>`,
|
|
110
110
|
],
|
|
111
111
|
[
|
|
112
112
|
'image',
|
|
113
|
-
(token): LitHtml.TemplateResult => html`<${MarkdownImage.litTagName} .data
|
|
114
|
-
{key: token.href, title: token.text} as MarkdownImageData}
|
|
113
|
+
(token): LitHtml.TemplateResult => html`<${MarkdownImage.litTagName} .data=${
|
|
114
|
+
{key: token.href, title: token.text} as MarkdownImageData}></${MarkdownImage.litTagName}>`,
|
|
115
115
|
],
|
|
116
116
|
]);
|
|
117
117
|
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// Copyright (c) 2021 The Chromium Authors. All rights reserved.
|
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
import * as i18n from '../../../core/i18n/i18n.js';
|
|
6
|
+
import * as Root from '../../../core/root/root.js';
|
|
7
|
+
import * as LitHtml from '../../../ui/lit-html/lit-html.js';
|
|
8
|
+
import * as ComponentHelpers from '../helpers/helpers.js';
|
|
9
|
+
import * as IconButton from '../icon_button/icon_button.js';
|
|
10
|
+
|
|
11
|
+
import previewToggleStyles from './previewToggle.css.js';
|
|
12
|
+
|
|
13
|
+
const {render, html, nothing} = LitHtml;
|
|
14
|
+
|
|
15
|
+
export interface PreviewToggleData {
|
|
16
|
+
name: string;
|
|
17
|
+
helperText: string|null;
|
|
18
|
+
feedbackURL: string|null;
|
|
19
|
+
experiment: Root.Runtime.ExperimentName;
|
|
20
|
+
onChangeCallback?: (checked: boolean) => void;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const UIStrings = {
|
|
24
|
+
/**
|
|
25
|
+
*@description Link text the user can click to provide feedback to the team.
|
|
26
|
+
*/
|
|
27
|
+
previewTextFeedbackLink: 'Send us your feedback.',
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const str_ = i18n.i18n.registerUIStrings('ui/components/panel_feedback/PreviewToggle.ts', UIStrings);
|
|
31
|
+
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
32
|
+
|
|
33
|
+
export class PreviewToggle extends HTMLElement {
|
|
34
|
+
static readonly litTagName = LitHtml.literal`devtools-preview-toggle`;
|
|
35
|
+
readonly #shadow = this.attachShadow({mode: 'open'});
|
|
36
|
+
|
|
37
|
+
#name = '';
|
|
38
|
+
#helperText: string|null = null;
|
|
39
|
+
#feedbackURL: string|null = null;
|
|
40
|
+
#experiment: string = '';
|
|
41
|
+
#onChangeCallback?: (checked: boolean) => void;
|
|
42
|
+
|
|
43
|
+
connectedCallback(): void {
|
|
44
|
+
this.#shadow.adoptedStyleSheets = [previewToggleStyles];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
set data(data: PreviewToggleData) {
|
|
48
|
+
this.#name = data.name;
|
|
49
|
+
this.#helperText = data.helperText;
|
|
50
|
+
this.#feedbackURL = data.feedbackURL;
|
|
51
|
+
this.#experiment = data.experiment;
|
|
52
|
+
this.#onChangeCallback = data.onChangeCallback;
|
|
53
|
+
this.render();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
private render(): void {
|
|
57
|
+
const checked = Root.Runtime.experiments.isEnabled(this.#experiment);
|
|
58
|
+
// Disabled until https://crbug.com/1079231 is fixed.
|
|
59
|
+
// clang-format off
|
|
60
|
+
render(
|
|
61
|
+
html`
|
|
62
|
+
<div class="experiment-preview">
|
|
63
|
+
<input type="checkbox" ?checked=${checked} @change=${this.checkboxChanged} aria-label=${this.#name}/>
|
|
64
|
+
<${IconButton.Icon.Icon.litTagName} .data=${{
|
|
65
|
+
iconName: 'ic_preview_feature',
|
|
66
|
+
width: '16px',
|
|
67
|
+
height: '16px',
|
|
68
|
+
color: 'var(--color-text-secondary)',
|
|
69
|
+
} as IconButton.Icon.IconData}>
|
|
70
|
+
</${IconButton.Icon.Icon.litTagName}>${this.#name}
|
|
71
|
+
</div>
|
|
72
|
+
<div class="helper">
|
|
73
|
+
${this.#helperText && this.#feedbackURL
|
|
74
|
+
? html`<p>${this.#helperText} <x-link href=${this.#feedbackURL}>${i18nString(UIStrings.previewTextFeedbackLink)}</x-link></p>`
|
|
75
|
+
: nothing}
|
|
76
|
+
</div>`,
|
|
77
|
+
this.#shadow,
|
|
78
|
+
{
|
|
79
|
+
host: this,
|
|
80
|
+
});
|
|
81
|
+
// clang-format on
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
private checkboxChanged(event: Event): void {
|
|
85
|
+
const checked = (event.target as HTMLInputElement).checked;
|
|
86
|
+
Root.Runtime.experiments.setEnabled(this.#experiment, checked);
|
|
87
|
+
this.#onChangeCallback?.(checked);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
ComponentHelpers.CustomElements.defineComponent('devtools-preview-toggle', PreviewToggle);
|
|
92
|
+
|
|
93
|
+
declare global {
|
|
94
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
95
|
+
interface HTMLElementTagNameMap {
|
|
96
|
+
'devtools-preview-toggle': PreviewToggle;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2021 The Chromium Authors. All rights reserved.
|
|
3
|
+
* Use of this source code is governed by a BSD-style license that can be
|
|
4
|
+
* found in the LICENSE file.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
:host {
|
|
8
|
+
display: block;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.experiment-preview {
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.helper {
|
|
17
|
+
text-align: center;
|
|
18
|
+
font-style: italic;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
x-link { /* stylelint-disable-line selector-type-no-unknown */
|
|
22
|
+
color: var(--color-primary);
|
|
23
|
+
text-decoration-line: underline;
|
|
24
|
+
}
|
|
@@ -7,6 +7,7 @@ import * as LitHtml from '../../lit-html/lit-html.js';
|
|
|
7
7
|
|
|
8
8
|
import reportStyles from './report.css.js';
|
|
9
9
|
import reportKeyStyles from './reportKey.css.js';
|
|
10
|
+
import reportSectionStyles from './reportSection.css.js';
|
|
10
11
|
import reportSectionDividerStyles from './reportSectionDivider.css.js';
|
|
11
12
|
import reportSectionHeaderStyles from './reportSectionHeader.css.js';
|
|
12
13
|
import reportValueStyles from './reportValue.css.js';
|
|
@@ -66,6 +67,25 @@ export interface ReportSectionData {
|
|
|
66
67
|
sectionTitle: string;
|
|
67
68
|
}
|
|
68
69
|
|
|
70
|
+
export class ReportSection extends HTMLElement {
|
|
71
|
+
static readonly litTagName = LitHtml.literal`devtools-report-section`;
|
|
72
|
+
private readonly shadow = this.attachShadow({mode: 'open'});
|
|
73
|
+
connectedCallback(): void {
|
|
74
|
+
this.shadow.adoptedStyleSheets = [reportSectionStyles];
|
|
75
|
+
this.render();
|
|
76
|
+
}
|
|
77
|
+
private render(): void {
|
|
78
|
+
// Disabled until https://crbug.com/1079231 is fixed.
|
|
79
|
+
// clang-format off
|
|
80
|
+
LitHtml.render(LitHtml.html`
|
|
81
|
+
<div class="section">
|
|
82
|
+
<slot></slot>
|
|
83
|
+
</div>
|
|
84
|
+
`, this.shadow, {host: this});
|
|
85
|
+
// clang-format on
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
69
89
|
export class ReportSectionHeader extends HTMLElement {
|
|
70
90
|
static readonly litTagName = LitHtml.literal`devtools-report-section-header`;
|
|
71
91
|
|
|
@@ -146,6 +166,7 @@ export class ReportValue extends HTMLElement {
|
|
|
146
166
|
}
|
|
147
167
|
|
|
148
168
|
ComponentHelpers.CustomElements.defineComponent('devtools-report', Report);
|
|
169
|
+
ComponentHelpers.CustomElements.defineComponent('devtools-report-section', ReportSection);
|
|
149
170
|
ComponentHelpers.CustomElements.defineComponent('devtools-report-section-header', ReportSectionHeader);
|
|
150
171
|
ComponentHelpers.CustomElements.defineComponent('devtools-report-key', ReportKey);
|
|
151
172
|
ComponentHelpers.CustomElements.defineComponent('devtools-report-value', ReportValue);
|
|
@@ -155,6 +176,7 @@ declare global {
|
|
|
155
176
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
156
177
|
interface HTMLElementTagNameMap {
|
|
157
178
|
'devtools-report': Report;
|
|
179
|
+
'devtools-report-section': ReportSection;
|
|
158
180
|
'devtools-report-section-header': ReportSectionHeader;
|
|
159
181
|
'devtools-report-key': ReportKey;
|
|
160
182
|
'devtools-report-value': ReportValue;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2021 The Chromium Authors. All rights reserved.
|
|
3
|
+
* Use of this source code is governed by a BSD-style license that can be
|
|
4
|
+
* found in the LICENSE file.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
:host {
|
|
8
|
+
grid-column-start: span 2;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.section {
|
|
12
|
+
padding: 12px;
|
|
13
|
+
margin-left: 18px;
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: row;
|
|
16
|
+
align-items: center;
|
|
17
|
+
flex: auto;
|
|
18
|
+
overflow-wrap: break-word;
|
|
19
|
+
overflow: hidden;
|
|
20
|
+
}
|
|
@@ -179,7 +179,7 @@ export class RequestLinkIcon extends HTMLElement {
|
|
|
179
179
|
return LitHtml.nothing;
|
|
180
180
|
}
|
|
181
181
|
const filename = extractShortPath(url);
|
|
182
|
-
return LitHtml.html`<span aria-label
|
|
182
|
+
return LitHtml.html`<span aria-label=${i18nString(UIStrings.shortenedURL)} title=${url}>${filename}</span>`;
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
private render(): Promise<void> {
|
|
@@ -55,8 +55,8 @@ export class SettingCheckbox extends HTMLElement {
|
|
|
55
55
|
LitHtml.html`
|
|
56
56
|
<p>
|
|
57
57
|
<label>
|
|
58
|
-
<input type="checkbox" ?checked=${this.#setting.get()} ?disabled=${this.#disabled} @change
|
|
59
|
-
this.checkboxChanged}
|
|
58
|
+
<input type="checkbox" ?checked=${this.#setting.get()} ?disabled=${this.#disabled} @change=${
|
|
59
|
+
this.checkboxChanged} aria-label=${this.#setting.title()} /> ${this.#setting.title()}
|
|
60
60
|
</label>
|
|
61
61
|
</p>`,
|
|
62
62
|
this.#shadow, {host: this});
|
|
@@ -26,9 +26,10 @@ const empty: CM.Extension = [];
|
|
|
26
26
|
export const dynamicSetting = CM.Facet.define<DynamicSetting<unknown>>();
|
|
27
27
|
|
|
28
28
|
// The code below is used to wire up dynamic settings to editors. When
|
|
29
|
-
// you include
|
|
30
|
-
// TextEditor class will take care of listening to
|
|
31
|
-
// setting, and updating the configuration as
|
|
29
|
+
// you include the result of calling `instance()` in an editor
|
|
30
|
+
// configuration, the TextEditor class will take care of listening to
|
|
31
|
+
// changes in the setting, and updating the configuration as
|
|
32
|
+
// appropriate.
|
|
32
33
|
|
|
33
34
|
export class DynamicSetting<T> {
|
|
34
35
|
compartment = new CM.Compartment();
|
|
@@ -63,7 +64,7 @@ export class DynamicSetting<T> {
|
|
|
63
64
|
static none: readonly DynamicSetting<unknown>[] = [];
|
|
64
65
|
}
|
|
65
66
|
|
|
66
|
-
export const tabMovesFocus = DynamicSetting.bool('textEditorTabMovesFocus', CM.keymap.of([{
|
|
67
|
+
export const tabMovesFocus = DynamicSetting.bool('textEditorTabMovesFocus', [], CM.keymap.of([{
|
|
67
68
|
key: 'Tab',
|
|
68
69
|
run: (view: CM.EditorView): boolean => view.state.doc.length ? CM.indentMore(view) : false,
|
|
69
70
|
shift: (view: CM.EditorView): boolean => view.state.doc.length ? CM.indentLess(view) : false,
|
|
@@ -85,7 +86,7 @@ export function guessIndent(doc: CM.Text): string {
|
|
|
85
86
|
let scanned = 0;
|
|
86
87
|
for (let cur = doc.iterLines(1, Math.min(doc.lines + 1, LINES_TO_SCAN_FOR_INDENTATION_GUESSING)); !cur.next().done;) {
|
|
87
88
|
let space = (/^\s*/.exec(cur.value) as string[])[0];
|
|
88
|
-
if (space.length === cur.value.length || !space.length) {
|
|
89
|
+
if (space.length === cur.value.length || !space.length || cur.value[space.length] === '*') {
|
|
89
90
|
continue;
|
|
90
91
|
}
|
|
91
92
|
if (space[0] === '\t') {
|
|
@@ -246,7 +247,7 @@ export const closeBrackets: CM.Extension = [
|
|
|
246
247
|
// element with the editor styles mounted in it for them. This is
|
|
247
248
|
// annoying, but necessary because a scrollable parent node clips them
|
|
248
249
|
// otherwise, `position: fixed` doesn't work due to `contain` styles,
|
|
249
|
-
// and appending them
|
|
250
|
+
// and appending them directly to `document.body` doesn't work because
|
|
250
251
|
// the necessary style sheets aren't available there.
|
|
251
252
|
let tooltipHost: ShadowRoot|null = null;
|
|
252
253
|
|
|
@@ -324,11 +325,12 @@ export const showCompletionHint = CM.ViewPlugin.fromClass(class {
|
|
|
324
325
|
if (pos !== lineBefore.to) {
|
|
325
326
|
return null;
|
|
326
327
|
}
|
|
327
|
-
const
|
|
328
|
-
|
|
328
|
+
const partBefore = (label[0] === '\'' ? /'(\\.|[^'\\])*$/ : label[0] === '"' ? /"(\\.|[^"\\])*$/ : /#?[\w$]+$/)
|
|
329
|
+
.exec(lineBefore.text);
|
|
330
|
+
if (partBefore && !label.startsWith(partBefore[0])) {
|
|
329
331
|
return null;
|
|
330
332
|
}
|
|
331
|
-
return label.slice(
|
|
333
|
+
return label.slice(partBefore ? partBefore[0].length : 0);
|
|
332
334
|
}
|
|
333
335
|
}, {decorations: p => p.decorations});
|
|
334
336
|
|
|
@@ -15,6 +15,23 @@ export function completion(): CodeMirror.Extension {
|
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
export async function completeInContext(
|
|
19
|
+
textBefore: string, query: string, force: boolean = false): Promise<UI.SuggestBox.Suggestions> {
|
|
20
|
+
const state = CodeMirror.EditorState.create({
|
|
21
|
+
doc: textBefore,
|
|
22
|
+
selection: {anchor: textBefore.length},
|
|
23
|
+
extensions: CodeMirror.javascript.javascriptLanguage,
|
|
24
|
+
});
|
|
25
|
+
const result = await javascriptCompletionSource(new CodeMirror.CompletionContext(state, textBefore.length, force));
|
|
26
|
+
return result ?
|
|
27
|
+
result.options.filter((o): boolean => o.label.startsWith(query)).map((o): UI.SuggestBox.Suggestion => ({
|
|
28
|
+
text: o.label,
|
|
29
|
+
priority: 100 + (o.boost || 0),
|
|
30
|
+
isSecondary: o.type === 'secondary',
|
|
31
|
+
})) :
|
|
32
|
+
[];
|
|
33
|
+
}
|
|
34
|
+
|
|
18
35
|
class CompletionSet {
|
|
19
36
|
constructor(
|
|
20
37
|
readonly completions: CodeMirror.Completion[] = [],
|
|
@@ -35,10 +52,10 @@ class CompletionSet {
|
|
|
35
52
|
}
|
|
36
53
|
|
|
37
54
|
const javascriptKeywords = [
|
|
38
|
-
'async',
|
|
39
|
-
'
|
|
40
|
-
'
|
|
41
|
-
'
|
|
55
|
+
'async', 'await', 'break', 'case', 'catch', 'class', 'const', 'continue', 'debugger', 'default', 'delete',
|
|
56
|
+
'do', 'else', 'export', 'extends', 'false', 'finally', 'for', 'function', 'if', 'import', 'in',
|
|
57
|
+
'instanceof', 'let', 'new', 'null', 'of', 'return', 'static', 'super', 'switch', 'this', 'throw',
|
|
58
|
+
'true', 'try', 'typeof', 'var', 'void', 'while', 'with', 'yield',
|
|
42
59
|
];
|
|
43
60
|
const consoleBuiltinFunctions = [
|
|
44
61
|
'clear',
|
|
@@ -101,7 +118,7 @@ export function getQueryType(tree: CodeMirror.Tree, pos: number, doc: CodeMirror
|
|
|
101
118
|
return null;
|
|
102
119
|
}
|
|
103
120
|
|
|
104
|
-
if (node.name === 'PropertyName') {
|
|
121
|
+
if (node.name === 'PropertyName' || node.name === 'PrivatePropertyName') {
|
|
105
122
|
return parent?.name !== 'MemberExpression' ? null :
|
|
106
123
|
{type: QueryType.PropertyName, from: node.from, relatedNode: parent};
|
|
107
124
|
}
|
|
@@ -142,6 +159,7 @@ export async function javascriptCompletionSource(cx: CodeMirror.CompletionContex
|
|
|
142
159
|
}
|
|
143
160
|
|
|
144
161
|
let result: CompletionSet;
|
|
162
|
+
let quote: string|undefined = undefined;
|
|
145
163
|
if (query.type === QueryType.Expression) {
|
|
146
164
|
const [scope, global] = await Promise.all([
|
|
147
165
|
completeExpressionInScope(),
|
|
@@ -157,7 +175,6 @@ export async function javascriptCompletionSource(cx: CodeMirror.CompletionContex
|
|
|
157
175
|
}
|
|
158
176
|
} else if (query.type === QueryType.PropertyName || query.type === QueryType.PropertyExpression) {
|
|
159
177
|
const objectExpr = (query.relatedNode as CodeMirror.SyntaxNode).getChild('Expression');
|
|
160
|
-
let quote = undefined;
|
|
161
178
|
if (query.type === QueryType.PropertyExpression) {
|
|
162
179
|
quote = query.from === undefined ? '\'' : cx.state.sliceDoc(query.from, query.from + 1);
|
|
163
180
|
}
|
|
@@ -172,10 +189,13 @@ export async function javascriptCompletionSource(cx: CodeMirror.CompletionContex
|
|
|
172
189
|
return {
|
|
173
190
|
from: query.from ?? cx.pos,
|
|
174
191
|
options: result.completions,
|
|
175
|
-
span:
|
|
192
|
+
span: !quote ? SPAN_IDENT : quote === '\'' ? SPAN_SINGLE_QUOTE : SPAN_DOUBLE_QUOTE,
|
|
176
193
|
};
|
|
177
194
|
}
|
|
178
195
|
|
|
196
|
+
const SPAN_IDENT = /^#?[\w\P{ASCII}]*$/u, SPAN_SINGLE_QUOTE = /^\'(\\.|[^\\'\n])*'?$/,
|
|
197
|
+
SPAN_DOUBLE_QUOTE = /^"(\\.|[^\\"\n])*"?$/;
|
|
198
|
+
|
|
179
199
|
function getExecutionContext(): SDK.RuntimeModel.ExecutionContext|null {
|
|
180
200
|
return UI.Context.Context.instance().flavor(SDK.RuntimeModel.ExecutionContext);
|
|
181
201
|
}
|
|
@@ -306,14 +326,16 @@ async function completePropertiesInner(
|
|
|
306
326
|
object = await evaluateExpression(context, toPrototype + '.prototype', 'completion');
|
|
307
327
|
}
|
|
308
328
|
|
|
309
|
-
const functionType = expression === '
|
|
310
|
-
const otherType = expression === '
|
|
329
|
+
const functionType = expression === 'globalThis' ? 'function' : 'method';
|
|
330
|
+
const otherType = expression === 'globalThis' ? 'variable' : 'property';
|
|
311
331
|
if (object && (object.type === 'object' || object.type === 'function')) {
|
|
312
332
|
const properties = await object.getAllProperties(false, false);
|
|
313
333
|
const isFunction = object.type === 'function';
|
|
314
334
|
for (const prop of properties.properties || []) {
|
|
315
|
-
if (!prop.symbol && !(isFunction && (prop.name === 'arguments' || prop.name === 'caller'))
|
|
316
|
-
|
|
335
|
+
if (!prop.symbol && !(isFunction && (prop.name === 'arguments' || prop.name === 'caller')) &&
|
|
336
|
+
(!prop.private || expression === 'this') && (quoted || SPAN_IDENT.test(prop.name))) {
|
|
337
|
+
const label =
|
|
338
|
+
quoted ? quoted + prop.name.replaceAll('\\', '\\\\').replaceAll(quoted, '\\' + quoted) + quoted : prop.name;
|
|
317
339
|
const completion: CodeMirror.Completion = {
|
|
318
340
|
label,
|
|
319
341
|
type: prop.value?.type === 'function' ? functionType : otherType,
|
|
@@ -365,7 +387,7 @@ async function completeExpressionGlobal(): Promise<CompletionSet> {
|
|
|
365
387
|
}
|
|
366
388
|
const result = baseCompletions.copy();
|
|
367
389
|
|
|
368
|
-
const fetchNames = completePropertiesInner('
|
|
390
|
+
const fetchNames = completePropertiesInner('globalThis', context).then(fromWindow => {
|
|
369
391
|
return context.globalLexicalScopeNames().then(globals => {
|
|
370
392
|
for (const option of fromWindow.completions) {
|
|
371
393
|
result.add(option);
|
|
@@ -127,8 +127,8 @@ export class TextPrompt extends HTMLElement {
|
|
|
127
127
|
const output = LitHtml.html`
|
|
128
128
|
<span class="prefix">${this.#prefixText} </span>
|
|
129
129
|
<span class="text-prompt-input"><input aria-label=${this.#ariaLabelText} spellcheck="false" @input=${
|
|
130
|
-
this.onInput} @keydown=${this.onKeyDown}/><span class='suggestion' suggestion
|
|
131
|
-
this.#suggestionText}
|
|
130
|
+
this.onInput} @keydown=${this.onKeyDown}/><span class='suggestion' suggestion=${
|
|
131
|
+
this.#suggestionText}></span></span>`;
|
|
132
132
|
LitHtml.render(output, this.#shadow, {host: this});
|
|
133
133
|
}
|
|
134
134
|
}
|
|
@@ -55,7 +55,7 @@ export class GlassPane {
|
|
|
55
55
|
return this.widgetInternal.isShowing();
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
registerRequiredCSS(cssFile:
|
|
58
|
+
registerRequiredCSS(cssFile: {cssContent: string}): void {
|
|
59
59
|
// eslint-disable-next-line no-restricted-syntax -- Should import styles https://crbug.com/1106746
|
|
60
60
|
this.widgetInternal.registerRequiredCSS(cssFile);
|
|
61
61
|
}
|
|
@@ -107,6 +107,14 @@ const UIStrings = {
|
|
|
107
107
|
*@description The aria label for the drawer.
|
|
108
108
|
*/
|
|
109
109
|
drawer: 'Tool drawer',
|
|
110
|
+
/**
|
|
111
|
+
*@description The aria label for the drawer shown.
|
|
112
|
+
*/
|
|
113
|
+
drawerShown: 'Drawer shown',
|
|
114
|
+
/**
|
|
115
|
+
*@description The aria label for the drawer hidden.
|
|
116
|
+
*/
|
|
117
|
+
drawerHidden: 'Drawer hidden',
|
|
110
118
|
};
|
|
111
119
|
const str_ = i18n.i18n.registerUIStrings('ui/legacy/InspectorView.ts', UIStrings);
|
|
112
120
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
@@ -312,6 +320,7 @@ export class InspectorView extends VBox implements ViewLocationResolver {
|
|
|
312
320
|
this.focusRestorer = null;
|
|
313
321
|
}
|
|
314
322
|
this.emitDrawerChangeEvent(true);
|
|
323
|
+
ARIAUtils.alert(i18nString(UIStrings.drawerShown));
|
|
315
324
|
}
|
|
316
325
|
|
|
317
326
|
drawerVisible(): boolean {
|
|
@@ -328,6 +337,7 @@ export class InspectorView extends VBox implements ViewLocationResolver {
|
|
|
328
337
|
this.drawerSplitWidget.hideSidebar(true);
|
|
329
338
|
|
|
330
339
|
this.emitDrawerChangeEvent(false);
|
|
340
|
+
ARIAUtils.alert(i18nString(UIStrings.drawerHidden));
|
|
331
341
|
}
|
|
332
342
|
|
|
333
343
|
setDrawerMinimized(minimized: boolean): void {
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
|
|
36
36
|
import * as Common from '../../core/common/common.js';
|
|
37
37
|
import * as i18n from '../../core/i18n/i18n.js';
|
|
38
|
+
import * as Platform from '../../core/platform/platform.js';
|
|
38
39
|
|
|
39
40
|
import * as ARIAUtils from './ARIAUtils.js';
|
|
40
41
|
import {HistoryInput} from './HistoryInput.js';
|
|
@@ -629,7 +630,7 @@ export class SearchConfig {
|
|
|
629
630
|
|
|
630
631
|
// Otherwise just do a plain text search.
|
|
631
632
|
if (!regex) {
|
|
632
|
-
regex = createPlainTextSearchRegex(query, modifiers);
|
|
633
|
+
regex = Platform.StringUtilities.createPlainTextSearchRegex(query, modifiers);
|
|
633
634
|
}
|
|
634
635
|
|
|
635
636
|
return regex;
|
|
@@ -399,7 +399,7 @@ export class TreeOutlineInShadow extends TreeOutline {
|
|
|
399
399
|
this.renderSelection = true;
|
|
400
400
|
}
|
|
401
401
|
|
|
402
|
-
registerRequiredCSS(cssFile:
|
|
402
|
+
registerRequiredCSS(cssFile: {cssContent: string}): void {
|
|
403
403
|
Utils.appendStyle(this.shadowRoot, cssFile);
|
|
404
404
|
}
|
|
405
405
|
|
|
@@ -458,7 +458,7 @@ export class Widget {
|
|
|
458
458
|
this.doResize();
|
|
459
459
|
}
|
|
460
460
|
|
|
461
|
-
registerRequiredCSS(cssFile:
|
|
461
|
+
registerRequiredCSS(cssFile: {cssContent: string}): void {
|
|
462
462
|
if (this.isWebComponent) {
|
|
463
463
|
Utils.appendStyle((this.shadowRoot as DocumentFragment), cssFile);
|
|
464
464
|
} else {
|