chrome-devtools-frontend 1.0.925655 → 1.0.927419
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/.stylelintignore +1 -0
- package/AUTHORS +1 -0
- package/config/gni/devtools_grd_files.gni +10 -3
- package/front_end/core/common/Color.ts +6 -0
- package/front_end/core/common/SettingRegistration.ts +8 -0
- package/front_end/core/host/InspectorFrontendHost.ts +3 -0
- package/front_end/core/host/InspectorFrontendHostAPI.ts +3 -0
- package/front_end/core/host/UserMetrics.ts +7 -3
- package/front_end/core/i18n/locales/en-US.json +71 -14
- package/front_end/core/i18n/locales/en-XL.json +71 -14
- package/front_end/core/platform/keyboard-utilities.ts +1 -0
- package/front_end/core/root/Runtime.ts +1 -0
- package/front_end/core/sdk/ConsoleModel.ts +3 -0
- package/front_end/core/sdk/DebuggerModel.ts +2 -0
- package/front_end/core/sdk/NetworkManager.ts +12 -2
- package/front_end/core/sdk/NetworkRequest.ts +20 -5
- package/front_end/core/sdk/OverlayModel.ts +21 -0
- package/front_end/core/sdk/OverlayPersistentHighlighter.ts +55 -3
- package/front_end/devtools_compatibility.js +11 -1
- package/front_end/entrypoints/main/MainImpl.ts +4 -2
- package/front_end/entrypoints/main/main-meta.ts +16 -0
- package/front_end/generated/InspectorBackendCommands.js +8 -7
- package/front_end/generated/SupportedCSSProperties.js +7 -1
- package/front_end/generated/protocol-mapping.d.ts +5 -24
- package/front_end/generated/protocol-proxy-api.d.ts +6 -29
- package/front_end/generated/protocol.d.ts +51 -46
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +0 -6
- package/front_end/models/issues_manager/CorsIssue.ts +4 -0
- package/front_end/models/logs/LogManager.ts +1 -0
- package/front_end/models/persistence/WorkspaceSettingsTab.ts +6 -4
- package/front_end/models/persistence/workspaceSettingsTab.css +18 -18
- package/front_end/models/timeline_model/TimelineFrameModel.ts +107 -28
- package/front_end/panels/application/ReportingApiReportsView.ts +89 -0
- package/front_end/panels/application/ReportingApiTreeElement.ts +3 -3
- package/front_end/panels/application/ReportingApiView.ts +27 -0
- package/front_end/panels/application/application.ts +2 -0
- package/front_end/panels/application/components/EndpointsGrid.ts +55 -0
- package/front_end/panels/application/components/ReportsGrid.ts +144 -0
- package/front_end/panels/application/components/components.ts +4 -2
- package/front_end/panels/application/components/reportingApiGrid.css +35 -0
- package/front_end/panels/application/reportingApiReportsView.css +13 -0
- package/front_end/panels/console/ConsoleView.ts +17 -0
- package/front_end/panels/console/console-meta.ts +26 -0
- package/front_end/panels/elements/ElementsTreeElement.ts +19 -0
- package/front_end/panels/elements/PropertiesWidget.ts +1 -2
- package/front_end/panels/elements/StylePropertyTreeElement.ts +28 -0
- package/front_end/panels/elements/StylePropertyUtils.ts +13 -0
- package/front_end/panels/elements/components/nodeText.css +4 -4
- package/front_end/panels/elements/elements.ts +2 -0
- package/front_end/panels/elements/layoutPane.css +1 -1
- package/front_end/panels/issues/CorsIssueDetailsView.ts +4 -2
- package/front_end/panels/network/RequestCookiesView.ts +13 -4
- package/front_end/panels/screencast/screencastView.css +2 -6
- package/front_end/panels/search/SearchResultsPane.ts +1 -1
- package/front_end/panels/settings/SettingsScreen.ts +3 -0
- package/front_end/panels/snippets/SnippetsQuickOpen.ts +8 -3
- package/front_end/panels/sources/CallStackSidebarPane.ts +1 -10
- package/front_end/panels/sources/GoToLineQuickOpen.ts +50 -10
- package/front_end/panels/sources/UISourceCodeFrame.ts +0 -13
- package/front_end/panels/sources/sources-legacy.ts +0 -11
- package/front_end/panels/sources/sources-meta.ts +22 -20
- package/front_end/panels/sources/sources.ts +0 -2
- package/front_end/third_party/codemirror.next/LICENSE +21 -0
- package/front_end/third_party/codemirror.next/README.chromium +18 -0
- package/front_end/third_party/codemirror.next/bundle-tsconfig.json +21 -0
- package/front_end/third_party/codemirror.next/bundle.ts +87 -0
- package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -0
- package/front_end/third_party/codemirror.next/chunk/cpp.js +2 -0
- package/front_end/third_party/codemirror.next/chunk/css.js +2 -0
- package/front_end/third_party/codemirror.next/chunk/html.js +4 -0
- package/front_end/third_party/codemirror.next/chunk/java.js +2 -0
- package/front_end/third_party/codemirror.next/chunk/javascript.js +2 -0
- package/front_end/third_party/codemirror.next/chunk/json.js +2 -0
- package/front_end/third_party/codemirror.next/chunk/legacy.js +1 -0
- package/front_end/third_party/codemirror.next/chunk/markdown.js +6 -0
- package/front_end/third_party/codemirror.next/chunk/php.js +6 -0
- package/front_end/third_party/codemirror.next/chunk/python.js +2 -0
- package/front_end/third_party/codemirror.next/chunk/wast.js +2 -0
- package/front_end/third_party/codemirror.next/chunk/xml.js +2 -0
- package/front_end/third_party/codemirror.next/codemirror.next.d.ts +5467 -0
- package/front_end/third_party/codemirror.next/codemirror.next.js +2 -0
- package/front_end/third_party/codemirror.next/package.json +39 -0
- package/front_end/third_party/codemirror.next/rebuild.sh +6 -0
- package/front_end/third_party/codemirror.next/rollup.config.js +45 -0
- package/front_end/ui/components/buttons/Button.ts +33 -5
- package/front_end/ui/components/buttons/button.css +32 -2
- package/front_end/ui/components/code_highlighter/CodeHighlighter.ts +137 -0
- package/front_end/ui/components/code_highlighter/codeHighlighter.css +51 -0
- package/front_end/ui/components/code_highlighter/code_highlighter.ts +11 -0
- package/front_end/ui/components/docs/button/basic.html +1 -0
- package/front_end/ui/components/docs/button/basic.ts +47 -4
- package/front_end/ui/components/docs/text_editor/basic.html +28 -0
- package/front_end/ui/components/docs/text_editor/basic.ts +14 -0
- package/front_end/ui/components/docs/text_prompt/basic.html +35 -0
- package/front_end/ui/components/docs/text_prompt/basic.ts +19 -0
- package/front_end/ui/components/render_coordinator/RenderCoordinator.ts +17 -0
- package/front_end/ui/components/text_editor/TextEditor.ts +161 -0
- package/front_end/ui/components/text_editor/config.ts +264 -0
- package/front_end/ui/components/text_editor/text_editor.ts +6 -0
- package/front_end/ui/components/text_editor/theme.ts +113 -0
- package/front_end/ui/components/text_prompt/TextPrompt.ts +144 -0
- package/front_end/ui/components/text_prompt/textPrompt.css +33 -0
- package/front_end/ui/components/text_prompt/text_prompt.ts +9 -0
- package/front_end/ui/legacy/UIUtils.ts +9 -1
- package/front_end/ui/legacy/components/quick_open/CommandMenu.ts +8 -3
- package/front_end/ui/legacy/components/quick_open/FilteredListWidget.ts +39 -39
- package/front_end/ui/legacy/components/quick_open/HelpQuickOpen.ts +10 -4
- package/front_end/ui/legacy/components/quick_open/QuickOpen.ts +31 -14
- package/front_end/ui/legacy/components/quick_open/filteredListWidget.css +7 -8
- package/front_end/ui/legacy/components/source_frame/source_frame-legacy.ts +0 -6
- package/front_end/ui/legacy/components/source_frame/source_frame.ts +0 -2
- package/front_end/ui/legacy/components/utils/JSPresentationUtils.ts +11 -9
- package/front_end/ui/legacy/filter.css +1 -0
- package/front_end/ui/legacy/inspectorSyntaxHighlight.css +3 -8
- package/front_end/ui/legacy/inspectorSyntaxHighlightDark.css +11 -16
- package/front_end/ui/legacy/themeColors.css +60 -0
- package/inspector_overlay/debug/tool_persistent_isolated_element.html +75 -0
- package/inspector_overlay/drag_resize_handler.ts +142 -0
- package/inspector_overlay/highlight_isolated_element.ts +62 -0
- package/inspector_overlay/main.ts +4 -1
- package/inspector_overlay/tool_highlight.ts +6 -0
- package/inspector_overlay/tool_paused.ts +2 -0
- package/inspector_overlay/tool_persistent.ts +110 -0
- package/inspector_overlay/tool_screenshot.ts +8 -1
- package/package.json +1 -1
- package/front_end/panels/application/components/ReportingApiView.ts +0 -24
- package/front_end/panels/sources/GutterDiffPlugin.ts +0 -282
- package/front_end/ui/legacy/components/source_frame/SourceCodeDiff.ts +0 -140
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export{$ as cursorMatchingBracket,_ as closeBracketsKeymap,A as clojure,a0 as cursorSubwordBackward,a1 as cursorSubwordForward,a2 as indentLess,a3 as indentMore,a4 as selectMatchingBracket,a5 as selectSubwordBackward,a6 as selectSubwordForward,a7 as standardKeymap,a8 as toggleComment,a9 as codeFolding,aA as Facet,aa as foldGutter,aB as SelectionRange,ab as foldKeymap,aC as StateEffect,ac as gutter,ad as GutterMarker,aD as StateEffectType,aE as StateField,ae as gutters,aF as Transaction,af as lineNumbers,ag as HighlightStyle,aG as StreamLanguage,aH as StringStream,ah as highlightTree,aI as Line,ai as Tag,aJ as Text,aj as history,ak as historyKeymap,aK as showTooltip,al as redo,aL as tooltips,aM as Decoration,am as redoSelection,aN as drawSelection,an as undo,aO as highlightSpecialChars,ao as undoSelection,aP as MatchDecorator,ap as indentOnInput,aq as indentUnit,aQ as placeholder,ar as bracketMatching,aR as scrollPastEnd,as as Range,aS as ViewPlugin,at as RangeSet,aT as ViewUpdate,au as RangeSetBuilder,aU as WidgetType,aV as TreeCursor,av as selectNextOccurrence,aw as Annotation,ax as AnnotationType,ay as Compartment,az as EditorState,B as coffeescript,D as cpp,e as LanguageSupport,F as css,G as html,g as syntaxTree,h as EditorView,H as java,I as javascript,j as EditorSelection,J as json,K as markdown,L as LRParser,m as ifNotIn,M as php,N as NodeProp,o as NodeType,O as python,P as Parser,q as NodeSet,Q as shell,R as wast,S as xml,T as Tree,t as tags,u as Language,U as acceptCompletion,v as Prec,V as autocompletion,W as completeAnyWord,w as keymap,X as CompletionContext,Y as currentCompletions,Z as closeBrackets}from"./chunk/codemirror.js";
|
|
2
|
+
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "Package list used when building/upgrading CodeMirror 6",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"private": true,
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"@codemirror/autocomplete": "0.19.3",
|
|
7
|
+
"@codemirror/closebrackets": "0.19.0",
|
|
8
|
+
"@codemirror/commands": "0.19.4",
|
|
9
|
+
"@codemirror/comment": "0.19.0",
|
|
10
|
+
"@codemirror/fold": "0.19.0",
|
|
11
|
+
"@codemirror/gutter": "0.19.2",
|
|
12
|
+
"@codemirror/highlight": "0.19.6",
|
|
13
|
+
"@codemirror/history": "0.19.0",
|
|
14
|
+
"@codemirror/lang-cpp": "0.19.1",
|
|
15
|
+
"@codemirror/lang-css": "0.19.3",
|
|
16
|
+
"@codemirror/lang-html": "0.19.3",
|
|
17
|
+
"@codemirror/lang-java": "0.19.1",
|
|
18
|
+
"@codemirror/lang-javascript": "0.19.2",
|
|
19
|
+
"@codemirror/lang-json": "0.19.1",
|
|
20
|
+
"@codemirror/lang-markdown": "0.19.1",
|
|
21
|
+
"@codemirror/lang-php": "0.19.1",
|
|
22
|
+
"@codemirror/lang-python": "0.19.2",
|
|
23
|
+
"@codemirror/lang-wast": "0.19.0",
|
|
24
|
+
"@codemirror/lang-xml": "0.19.2",
|
|
25
|
+
"@codemirror/language": "0.19.3",
|
|
26
|
+
"@codemirror/legacy-modes": "0.19.0",
|
|
27
|
+
"@codemirror/matchbrackets": "0.19.3",
|
|
28
|
+
"@codemirror/search": "0.19.2",
|
|
29
|
+
"@codemirror/state": "0.19.2",
|
|
30
|
+
"@codemirror/stream-parser": "0.19.2",
|
|
31
|
+
"@codemirror/text": "0.19.4",
|
|
32
|
+
"@codemirror/tooltip": "0.19.2",
|
|
33
|
+
"@codemirror/view": "0.19.9",
|
|
34
|
+
"@lezer/common": "0.15.6",
|
|
35
|
+
"@rollup/plugin-node-resolve": "^13.0.4",
|
|
36
|
+
"rollup-plugin-dts": "^4.0.0",
|
|
37
|
+
"rollup-plugin-terser": "^7.0.2"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
npm install
|
|
2
|
+
../../../node_modules/.bin/tsc -d -t es2020 -m es2020 --moduleResolution node bundle.ts
|
|
3
|
+
../../../node_modules/.bin/rollup -c
|
|
4
|
+
rm -rf node_modules package-lock.json bundle.js bundle.d.ts
|
|
5
|
+
# Because there's a bug in clang causing it to reformat import lists even where formatting is disabled, run it right away
|
|
6
|
+
git cl format --js
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import {nodeResolve} from '@rollup/plugin-node-resolve';
|
|
2
|
+
import dts from 'rollup-plugin-dts';
|
|
3
|
+
import {terser} from 'rollup-plugin-terser';
|
|
4
|
+
|
|
5
|
+
export default [{
|
|
6
|
+
input: './bundle.js',
|
|
7
|
+
output: {
|
|
8
|
+
format: 'es',
|
|
9
|
+
dir: '.',
|
|
10
|
+
manualChunks(id) {
|
|
11
|
+
if (/legacy-modes/.test(id)) return 'chunk/legacy';
|
|
12
|
+
},
|
|
13
|
+
chunkFileNames(info) {
|
|
14
|
+
for (let mod of Object.keys(info.modules)) {
|
|
15
|
+
let name = (/@codemirror\/([\w-]+)/.exec(mod) || [])[1];
|
|
16
|
+
if (name === 'view') return 'chunk/codemirror.js';
|
|
17
|
+
if (/^lang-/.test(name)) return `chunk/${name.slice(5)}.js`;
|
|
18
|
+
if (name === 'legacy-modes') return 'chunk/legacy.js';
|
|
19
|
+
}
|
|
20
|
+
throw new Error('Failed to determine a chunk name for ' + Object.keys(info.modules));
|
|
21
|
+
},
|
|
22
|
+
entryFileNames: 'codemirror.next.js'
|
|
23
|
+
},
|
|
24
|
+
plugins: [
|
|
25
|
+
nodeResolve(),
|
|
26
|
+
terser()
|
|
27
|
+
]
|
|
28
|
+
}, {
|
|
29
|
+
input: './bundle.d.ts',
|
|
30
|
+
output: {
|
|
31
|
+
file: './codemirror.next.d.ts',
|
|
32
|
+
format: 'es'
|
|
33
|
+
},
|
|
34
|
+
plugins: [
|
|
35
|
+
dts({respectExternal: true}),
|
|
36
|
+
{
|
|
37
|
+
name: 'delete-trailing-whitespace',
|
|
38
|
+
generateBundle(options, bundle) {
|
|
39
|
+
for (let file of Object.values(bundle)) {
|
|
40
|
+
if (file.code) file.code = file.code.replace(/[ \t]+(\n|$)/g, '$1');
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
}];
|
|
@@ -19,9 +19,15 @@ export const enum Variant {
|
|
|
19
19
|
SECONDARY = 'secondary',
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
export
|
|
22
|
+
export const enum Size {
|
|
23
|
+
SMALL = 'SMALL',
|
|
24
|
+
MEDIUM = 'MEDIUM',
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface ButtonData {
|
|
23
28
|
iconUrl?: string;
|
|
24
29
|
variant?: Variant;
|
|
30
|
+
size?: Size;
|
|
25
31
|
}
|
|
26
32
|
|
|
27
33
|
export interface ButtonDataWithVariant extends ButtonData {
|
|
@@ -30,9 +36,12 @@ export interface ButtonDataWithVariant extends ButtonData {
|
|
|
30
36
|
|
|
31
37
|
export class Button extends HTMLElement {
|
|
32
38
|
static readonly litTagName = LitHtml.literal`devtools-button`;
|
|
33
|
-
private readonly shadow = this.attachShadow({mode: 'open'});
|
|
39
|
+
private readonly shadow = this.attachShadow({mode: 'open', delegatesFocus: true});
|
|
34
40
|
private readonly boundRender = this.render.bind(this);
|
|
35
|
-
private readonly props: ButtonData = {
|
|
41
|
+
private readonly props: ButtonData = {
|
|
42
|
+
size: Size.MEDIUM,
|
|
43
|
+
};
|
|
44
|
+
private isEmpty = true;
|
|
36
45
|
|
|
37
46
|
constructor() {
|
|
38
47
|
super();
|
|
@@ -46,6 +55,7 @@ export class Button extends HTMLElement {
|
|
|
46
55
|
set data(data: ButtonDataWithVariant) {
|
|
47
56
|
this.props.variant = data.variant;
|
|
48
57
|
this.props.iconUrl = data.iconUrl;
|
|
58
|
+
this.props.size = data.size || Size.MEDIUM;
|
|
49
59
|
ComponentHelpers.ScheduledRender.scheduleRender(this, this.boundRender);
|
|
50
60
|
}
|
|
51
61
|
|
|
@@ -59,11 +69,27 @@ export class Button extends HTMLElement {
|
|
|
59
69
|
ComponentHelpers.ScheduledRender.scheduleRender(this, this.boundRender);
|
|
60
70
|
}
|
|
61
71
|
|
|
72
|
+
set size(size: Size) {
|
|
73
|
+
this.props.size = size;
|
|
74
|
+
ComponentHelpers.ScheduledRender.scheduleRender(this, this.boundRender);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
focus(): void {
|
|
78
|
+
this.shadow.querySelector('button')?.focus();
|
|
79
|
+
}
|
|
80
|
+
|
|
62
81
|
connectedCallback(): void {
|
|
63
82
|
this.shadow.adoptedStyleSheets = [buttonStyles];
|
|
64
83
|
ComponentHelpers.ScheduledRender.scheduleRender(this, this.boundRender);
|
|
65
84
|
}
|
|
66
85
|
|
|
86
|
+
private onSlotChange(event: Event): void {
|
|
87
|
+
const slot = event.target as HTMLSlotElement | undefined;
|
|
88
|
+
const nodes = slot?.assignedNodes();
|
|
89
|
+
this.isEmpty = !nodes || !Boolean(nodes.length);
|
|
90
|
+
ComponentHelpers.ScheduledRender.scheduleRender(this, this.boundRender);
|
|
91
|
+
}
|
|
92
|
+
|
|
67
93
|
private render(): void {
|
|
68
94
|
if (!this.props.variant) {
|
|
69
95
|
throw new Error('Button requires a variant to be defined');
|
|
@@ -71,7 +97,9 @@ export class Button extends HTMLElement {
|
|
|
71
97
|
const classes = {
|
|
72
98
|
primary: this.props.variant === Variant.PRIMARY,
|
|
73
99
|
secondary: this.props.variant === Variant.SECONDARY,
|
|
74
|
-
'with-icon': Boolean(this.props.iconUrl),
|
|
100
|
+
'text-with-icon': Boolean(this.props.iconUrl) && !this.isEmpty,
|
|
101
|
+
'only-icon': Boolean(this.props.iconUrl) && this.isEmpty,
|
|
102
|
+
small: Boolean(this.props.size === Size.SMALL),
|
|
75
103
|
};
|
|
76
104
|
// clang-format off
|
|
77
105
|
LitHtml.render(
|
|
@@ -84,7 +112,7 @@ export class Button extends HTMLElement {
|
|
|
84
112
|
} as IconButton.Icon.IconData}
|
|
85
113
|
>
|
|
86
114
|
</${IconButton.Icon.Icon.litTagName}>` : ''}
|
|
87
|
-
<slot></slot>
|
|
115
|
+
<slot @slotchange=${this.onSlotChange}></slot>
|
|
88
116
|
</button>
|
|
89
117
|
`, this.shadow, {host: this});
|
|
90
118
|
// clang-format on
|
|
@@ -10,8 +10,14 @@
|
|
|
10
10
|
box-sizing: border-box;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Reset default UA styles for focused elements.
|
|
15
|
+
* The button styles below explicitly implement custom focus styles.
|
|
16
|
+
*/
|
|
13
17
|
*:focus,
|
|
14
|
-
*:focus-visible
|
|
18
|
+
*:focus-visible,
|
|
19
|
+
:host(:focus),
|
|
20
|
+
:host(:focus-visible) {
|
|
15
21
|
outline: none;
|
|
16
22
|
}
|
|
17
23
|
|
|
@@ -24,6 +30,13 @@ button {
|
|
|
24
30
|
height: 25px;
|
|
25
31
|
line-height: 14px;
|
|
26
32
|
padding: 5px 12px;
|
|
33
|
+
justify-content: center;
|
|
34
|
+
width: 100%;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
button.small {
|
|
38
|
+
height: 18px;
|
|
39
|
+
border-radius: 2px;
|
|
27
40
|
}
|
|
28
41
|
|
|
29
42
|
button:focus-visible {
|
|
@@ -69,15 +82,32 @@ button.secondary:focus-visible {
|
|
|
69
82
|
border: 1px solid var(--color-background);
|
|
70
83
|
}
|
|
71
84
|
|
|
72
|
-
button.
|
|
85
|
+
button.secondary:active:focus-visible {
|
|
86
|
+
border: 1px solid var(--color-button-secondary-background-pressed);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
button.text-with-icon {
|
|
73
90
|
padding: 0 12px 0 4px;
|
|
74
91
|
}
|
|
75
92
|
|
|
93
|
+
button.small.text-with-icon {
|
|
94
|
+
padding: 0 9px 0 3px;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
button.only-icon {
|
|
98
|
+
padding: 0;
|
|
99
|
+
}
|
|
100
|
+
|
|
76
101
|
button devtools-icon {
|
|
77
102
|
width: 19px;
|
|
78
103
|
height: 19px;
|
|
79
104
|
}
|
|
80
105
|
|
|
106
|
+
button.small devtools-icon {
|
|
107
|
+
width: 14px;
|
|
108
|
+
height: 14px;
|
|
109
|
+
}
|
|
110
|
+
|
|
81
111
|
button.primary devtools-icon {
|
|
82
112
|
--icon-color: var(--color-background);
|
|
83
113
|
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
// Copyright 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 type * as CodeMirror from '../../../third_party/codemirror.next/codemirror.next.js';
|
|
6
|
+
|
|
7
|
+
let highlightStyle: CodeMirror.HighlightStyle|null = null;
|
|
8
|
+
|
|
9
|
+
function importCM(): Promise<typeof CodeMirror> {
|
|
10
|
+
return import('../../../third_party/codemirror.next/codemirror.next.js');
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function getHighlightStyle(modCM: typeof CodeMirror): CodeMirror.HighlightStyle {
|
|
14
|
+
if (!highlightStyle) {
|
|
15
|
+
const t = modCM.tags;
|
|
16
|
+
highlightStyle = modCM.HighlightStyle.define([
|
|
17
|
+
{tag: t.variableName, class: 'token-variable'},
|
|
18
|
+
{tag: t.propertyName, class: 'token-property'},
|
|
19
|
+
{tag: [t.typeName, t.className, t.namespace, t.macroName], class: 'token-type'},
|
|
20
|
+
{tag: [t.special(t.name), t.constant(t.className)], class: 'token-variable-special'},
|
|
21
|
+
{tag: t.definition(t.name), class: 'token-definition'},
|
|
22
|
+
{tag: t.standard(t.variableName), class: 'token-builtin'},
|
|
23
|
+
|
|
24
|
+
{tag: [t.number, t.literal, t.unit], class: 'token-number'},
|
|
25
|
+
{tag: t.string, class: 'token-string'},
|
|
26
|
+
{tag: [t.special(t.string), t.regexp, t.escape], class: 'token-string-special'},
|
|
27
|
+
{tag: [t.atom, t.labelName, t.bool], class: 'token-atom'},
|
|
28
|
+
|
|
29
|
+
{tag: t.keyword, class: 'token-keyword'},
|
|
30
|
+
{tag: [t.comment, t.quote], class: 'token-comment'},
|
|
31
|
+
{tag: t.meta, class: 'token-meta'},
|
|
32
|
+
{tag: t.invalid, class: 'token-invalid'},
|
|
33
|
+
|
|
34
|
+
{tag: t.tagName, class: 'token-tag'},
|
|
35
|
+
{tag: t.attributeName, class: 'token-attribute'},
|
|
36
|
+
{tag: t.attributeValue, class: 'token-attribute-value'},
|
|
37
|
+
|
|
38
|
+
{tag: t.inserted, class: 'token-inserted'},
|
|
39
|
+
{tag: t.deleted, class: 'token-deleted'},
|
|
40
|
+
{tag: t.heading, class: 'token-variable-special'},
|
|
41
|
+
{tag: t.link, class: 'token-variable-special'},
|
|
42
|
+
{tag: t.strikethrough, class: 'token-strikethrough'},
|
|
43
|
+
{tag: t.strong, class: 'token-strong'},
|
|
44
|
+
{tag: t.emphasis, class: 'token-emphasis'},
|
|
45
|
+
]);
|
|
46
|
+
}
|
|
47
|
+
return highlightStyle;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export async function create(code: string, mimeType: string): Promise<CodeHighlighter> {
|
|
51
|
+
const CM = await importCM();
|
|
52
|
+
const language = await languageFromMIME(mimeType);
|
|
53
|
+
const tree = language ? language.language.parser.parse(code) : new CM.Tree(CM.NodeType.none, [], [], code.length);
|
|
54
|
+
return new CodeHighlighter(code, tree, CM);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export async function languageFromMIME(mimeType: string): Promise<CodeMirror.LanguageSupport|null> {
|
|
58
|
+
const CM = await importCM();
|
|
59
|
+
|
|
60
|
+
switch (mimeType) {
|
|
61
|
+
case 'text/javascript':
|
|
62
|
+
return (await CM.javascript()).javascript();
|
|
63
|
+
case 'text/jsx':
|
|
64
|
+
return (await CM.javascript()).javascript({jsx: true});
|
|
65
|
+
case 'text/typescript':
|
|
66
|
+
return (await CM.javascript()).javascript({typescript: true});
|
|
67
|
+
case 'text/typescript-jsx':
|
|
68
|
+
return (await CM.javascript()).javascript({typescript: true, jsx: true});
|
|
69
|
+
|
|
70
|
+
case 'text/css':
|
|
71
|
+
case 'text/x-scss':
|
|
72
|
+
return (await CM.css()).css();
|
|
73
|
+
|
|
74
|
+
case 'text/html':
|
|
75
|
+
return (await CM.html()).html();
|
|
76
|
+
|
|
77
|
+
case 'application/xml':
|
|
78
|
+
return (await CM.xml()).xml();
|
|
79
|
+
|
|
80
|
+
case 'text/webassembly':
|
|
81
|
+
return (await CM.wast()).wast();
|
|
82
|
+
|
|
83
|
+
case 'text/x-c++src':
|
|
84
|
+
return (await CM.cpp()).cpp();
|
|
85
|
+
|
|
86
|
+
case 'text/x-java':
|
|
87
|
+
return (await CM.java()).java();
|
|
88
|
+
|
|
89
|
+
case 'application/json':
|
|
90
|
+
return (await CM.json()).json();
|
|
91
|
+
|
|
92
|
+
case 'application/x-httpd-php':
|
|
93
|
+
return (await CM.php()).php();
|
|
94
|
+
|
|
95
|
+
case 'text/x-python':
|
|
96
|
+
return (await CM.python()).python();
|
|
97
|
+
|
|
98
|
+
case 'text/markdown':
|
|
99
|
+
return (await CM.markdown()).markdown();
|
|
100
|
+
|
|
101
|
+
case 'text/x-sh':
|
|
102
|
+
return new CM.LanguageSupport(await CM.shell());
|
|
103
|
+
|
|
104
|
+
case 'text/x-coffeescript':
|
|
105
|
+
return new CM.LanguageSupport(await CM.coffeescript());
|
|
106
|
+
|
|
107
|
+
case 'text/x-clojure':
|
|
108
|
+
return new CM.LanguageSupport(await CM.clojure());
|
|
109
|
+
|
|
110
|
+
default:
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export class CodeHighlighter {
|
|
116
|
+
constructor(readonly code: string, readonly tree: CodeMirror.Tree, private readonly modCM: typeof CodeMirror) {
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
highlight(token: (text: string, style: string) => void): void {
|
|
120
|
+
this.highlightRange(0, this.code.length, token);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
highlightRange(from: number, to: number, token: (text: string, style: string) => void): void {
|
|
124
|
+
let pos = from;
|
|
125
|
+
const flush = (to: number, style: string): void => {
|
|
126
|
+
if (to > pos) {
|
|
127
|
+
token(this.code.slice(pos, to), style);
|
|
128
|
+
pos = to;
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
this.modCM.highlightTree(this.tree, getHighlightStyle(this.modCM).match, (from, to, style) => {
|
|
132
|
+
flush(from, '');
|
|
133
|
+
flush(to, style);
|
|
134
|
+
}, from, to);
|
|
135
|
+
flush(to, '');
|
|
136
|
+
}
|
|
137
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
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
|
+
.token-variable { color: var(--color-token-variable); }
|
|
8
|
+
.token-property { color: var(--color-token-property); }
|
|
9
|
+
.token-type { color: var(--color-token-type); }
|
|
10
|
+
.token-variable-special { color: var(--color-token-variable-special); }
|
|
11
|
+
.token-definition { color: var(--color-token-definition); }
|
|
12
|
+
.token-builtin { color: var(--color-token-builtin); }
|
|
13
|
+
|
|
14
|
+
.token-number { color: var(--color-token-number); }
|
|
15
|
+
.token-string { color: var(--color-token-string); }
|
|
16
|
+
.token-string-special { color: var(--color-token-string-special); }
|
|
17
|
+
.token-atom { color: var(--color-token-atom); }
|
|
18
|
+
|
|
19
|
+
.token-keyword { color: var(--color-token-keyword); }
|
|
20
|
+
.token-comment { color: var(--color-token-comment); }
|
|
21
|
+
.token-meta { color: var(--color-token-meta); }
|
|
22
|
+
.token-invalid { color: var(--color-error-text); }
|
|
23
|
+
|
|
24
|
+
.token-tag { color: var(--color-token-tag); }
|
|
25
|
+
.token-attribute { color: var(--color-token-attribute); }
|
|
26
|
+
.token-attribute-value { color: var(--color-token-attribute-value); }
|
|
27
|
+
|
|
28
|
+
.token-inserted { color: var(--color-token-inserted); }
|
|
29
|
+
.token-deleted { color: var(--color-token-deleted); }
|
|
30
|
+
|
|
31
|
+
.token-heading {
|
|
32
|
+
color: var(--color-token-variable-special);
|
|
33
|
+
font-weight: bold;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.token-link {
|
|
37
|
+
color: var(--color-token-variable-special);
|
|
38
|
+
text-decoration: underline;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.token-strikethrough {
|
|
42
|
+
text-decoration: strike-through;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.token-strong {
|
|
46
|
+
font-weight: bold;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.token-emphasis {
|
|
50
|
+
font-style: italic;
|
|
51
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Copyright 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 Style from './codeHighlighter.css.js';
|
|
6
|
+
import * as CodeHighlighter from './CodeHighlighter.js';
|
|
7
|
+
|
|
8
|
+
export {
|
|
9
|
+
CodeHighlighter,
|
|
10
|
+
Style,
|
|
11
|
+
};
|
|
@@ -9,8 +9,7 @@ import * as ComponentHelpers from '../../helpers/helpers.js';
|
|
|
9
9
|
await ComponentHelpers.ComponentServerSetup.setup();
|
|
10
10
|
await FrontendHelpers.initializeGlobalVars();
|
|
11
11
|
|
|
12
|
-
const testIcon =
|
|
13
|
-
'data:text/plain;charset=utf-8;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4NCjxwYXRoIGQ9Ik0xMyA1SDEyVjExSDZWMTJIMTJWMThIMTNWMTJIMTlWMTFIMTNWNVoiIGZpbGw9ImJsYWNrIi8+DQo8L3N2Zz4=';
|
|
12
|
+
const testIcon = '/front_end/Images/ic_file_image.svg';
|
|
14
13
|
|
|
15
14
|
function appendButton(button: Buttons.Button.Button): void {
|
|
16
15
|
document.querySelector('#container')?.appendChild(button);
|
|
@@ -46,10 +45,54 @@ appendButton(primaryIconButton);
|
|
|
46
45
|
|
|
47
46
|
// Secondary Icon
|
|
48
47
|
const secondaryIconButton = new Buttons.Button.Button();
|
|
49
|
-
secondaryIconButton.innerText = '
|
|
50
|
-
secondaryIconButton.onclick = () =>
|
|
48
|
+
secondaryIconButton.innerText = 'Focus the first button';
|
|
49
|
+
secondaryIconButton.onclick = () => {
|
|
50
|
+
primaryButton.focus();
|
|
51
|
+
};
|
|
51
52
|
secondaryIconButton.data = {
|
|
52
53
|
variant: Buttons.Button.Variant.SECONDARY,
|
|
53
54
|
iconUrl: testIcon,
|
|
54
55
|
};
|
|
55
56
|
appendButton(secondaryIconButton);
|
|
57
|
+
|
|
58
|
+
// Primary Icon Only
|
|
59
|
+
const primaryIconOnlyButton = new Buttons.Button.Button();
|
|
60
|
+
primaryIconOnlyButton.data = {
|
|
61
|
+
variant: Buttons.Button.Variant.PRIMARY,
|
|
62
|
+
iconUrl: testIcon,
|
|
63
|
+
};
|
|
64
|
+
primaryIconOnlyButton.onclick = () => alert('clicked');
|
|
65
|
+
primaryIconOnlyButton.style.width = '25px';
|
|
66
|
+
appendButton(primaryIconOnlyButton);
|
|
67
|
+
|
|
68
|
+
// Secondary Icon Only
|
|
69
|
+
const secondaryIconOnlyButton = new Buttons.Button.Button();
|
|
70
|
+
secondaryIconOnlyButton.onclick = () => alert('clicked');
|
|
71
|
+
secondaryIconOnlyButton.style.width = '25px';
|
|
72
|
+
secondaryIconOnlyButton.data = {
|
|
73
|
+
variant: Buttons.Button.Variant.SECONDARY,
|
|
74
|
+
iconUrl: testIcon,
|
|
75
|
+
};
|
|
76
|
+
appendButton(secondaryIconOnlyButton);
|
|
77
|
+
|
|
78
|
+
// Small Primary Icon
|
|
79
|
+
const smallPrimaryIconButton = new Buttons.Button.Button();
|
|
80
|
+
smallPrimaryIconButton.innerText = 'Click me';
|
|
81
|
+
smallPrimaryIconButton.data = {
|
|
82
|
+
variant: Buttons.Button.Variant.PRIMARY,
|
|
83
|
+
iconUrl: testIcon,
|
|
84
|
+
size: Buttons.Button.Size.SMALL,
|
|
85
|
+
};
|
|
86
|
+
smallPrimaryIconButton.onclick = () => alert('clicked');
|
|
87
|
+
appendButton(smallPrimaryIconButton);
|
|
88
|
+
|
|
89
|
+
// Small Secondary Icon Only
|
|
90
|
+
const smallSecondaryIconOnlyButton = new Buttons.Button.Button();
|
|
91
|
+
smallSecondaryIconOnlyButton.onclick = () => alert('clicked');
|
|
92
|
+
smallSecondaryIconOnlyButton.style.width = '18px';
|
|
93
|
+
smallSecondaryIconOnlyButton.data = {
|
|
94
|
+
variant: Buttons.Button.Variant.SECONDARY,
|
|
95
|
+
iconUrl: testIcon,
|
|
96
|
+
size: Buttons.Button.Size.SMALL,
|
|
97
|
+
};
|
|
98
|
+
appendButton(smallSecondaryIconOnlyButton);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Copyright 2020 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
|
+
<!DOCTYPE html>
|
|
7
|
+
<html>
|
|
8
|
+
<head>
|
|
9
|
+
<meta charset="UTF-8" />
|
|
10
|
+
<meta name="viewport" content="width=device-width" />
|
|
11
|
+
<title>Basic Data grid example</title>
|
|
12
|
+
<style>
|
|
13
|
+
#container {
|
|
14
|
+
width: 80%;
|
|
15
|
+
border: 1px solid black;
|
|
16
|
+
margin: 30px;
|
|
17
|
+
}
|
|
18
|
+
</style>
|
|
19
|
+
</head>
|
|
20
|
+
<body>
|
|
21
|
+
|
|
22
|
+
<div id="container">
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
<ul id="events"></ul>
|
|
26
|
+
<script type="module" src="./basic.js"></script>
|
|
27
|
+
</body>
|
|
28
|
+
</html>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Copyright 2020 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 FrontendHelpers from '../../../../../test/unittests/front_end/helpers/EnvironmentHelpers.js';
|
|
6
|
+
import * as ComponentHelpers from '../../helpers/helpers.js';
|
|
7
|
+
import * as TextEditor from '../../text_editor/text_editor.js';
|
|
8
|
+
|
|
9
|
+
await ComponentHelpers.ComponentServerSetup.setup();
|
|
10
|
+
await FrontendHelpers.initializeGlobalVars();
|
|
11
|
+
|
|
12
|
+
const component = new TextEditor.TextEditor.TextEditor();
|
|
13
|
+
|
|
14
|
+
document.getElementById('container')?.appendChild(component);
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
<!DOCTYPE html>
|
|
7
|
+
<html>
|
|
8
|
+
|
|
9
|
+
<head>
|
|
10
|
+
<meta charset="UTF-8" />
|
|
11
|
+
<meta name="viewport" content="width=device-width" />
|
|
12
|
+
<title>Basic Text Prompt example</title>
|
|
13
|
+
<meta charset="UTF-8" />
|
|
14
|
+
<style>
|
|
15
|
+
#container {
|
|
16
|
+
width: 80%;
|
|
17
|
+
border: 1px solid black;
|
|
18
|
+
padding: 20px;
|
|
19
|
+
height: 300px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
#container > devtools-text-prompt {
|
|
23
|
+
vertical-align: middle;
|
|
24
|
+
font-size: 14px;
|
|
25
|
+
border: 1px solid #ccc;
|
|
26
|
+
}
|
|
27
|
+
</style>
|
|
28
|
+
</head>
|
|
29
|
+
|
|
30
|
+
<body>
|
|
31
|
+
<div id="container"></div>
|
|
32
|
+
<script type="module" src="./basic.js"></script>
|
|
33
|
+
</body>
|
|
34
|
+
|
|
35
|
+
</html>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Copyright 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 FrontendHelpers from '../../../../../test/unittests/front_end/helpers/EnvironmentHelpers.js';
|
|
6
|
+
import * as ComponentHelpers from '../../helpers/helpers.js';
|
|
7
|
+
import * as TextPrompt from '../../text_prompt/text_prompt.js';
|
|
8
|
+
|
|
9
|
+
await ComponentHelpers.ComponentServerSetup.setup();
|
|
10
|
+
await FrontendHelpers.initializeGlobalVars();
|
|
11
|
+
|
|
12
|
+
const textPrompt = new TextPrompt.TextPrompt.TextPrompt();
|
|
13
|
+
document.getElementById('container')?.appendChild(textPrompt);
|
|
14
|
+
|
|
15
|
+
textPrompt.data = {
|
|
16
|
+
ariaLabel: 'Quick open prompt',
|
|
17
|
+
prefix: 'Open',
|
|
18
|
+
suggestion: 'File',
|
|
19
|
+
};
|
|
@@ -59,6 +59,11 @@ const UNNAMED_WRITE = 'Unnamed write';
|
|
|
59
59
|
const UNNAMED_SCROLL = 'Unnamed scroll';
|
|
60
60
|
const DEADLOCK_TIMEOUT = 1500;
|
|
61
61
|
|
|
62
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
63
|
+
(globalThis as any).__getRenderCoordinatorPendingFrames = function(): number {
|
|
64
|
+
return RenderCoordinator.pendingFramesCount();
|
|
65
|
+
};
|
|
66
|
+
|
|
62
67
|
export class RenderCoordinator extends EventTarget {
|
|
63
68
|
static instance({forceNew = false} = {}): RenderCoordinator {
|
|
64
69
|
if (!renderCoordinatorInstance || forceNew) {
|
|
@@ -68,6 +73,14 @@ export class RenderCoordinator extends EventTarget {
|
|
|
68
73
|
return renderCoordinatorInstance;
|
|
69
74
|
}
|
|
70
75
|
|
|
76
|
+
static pendingFramesCount(): number {
|
|
77
|
+
if (!renderCoordinatorInstance) {
|
|
78
|
+
throw new Error('No render coordinator instance found.');
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return renderCoordinatorInstance.pendingFramesCount();
|
|
82
|
+
}
|
|
83
|
+
|
|
71
84
|
// Toggle on to start tracking. You must call takeRecords() to
|
|
72
85
|
// obtain the records. Please note: records are limited by maxRecordSize below.
|
|
73
86
|
observe = false;
|
|
@@ -85,6 +98,10 @@ export class RenderCoordinator extends EventTarget {
|
|
|
85
98
|
private readonly labels = new WeakMap<CoordinatorCallback, string>();
|
|
86
99
|
private scheduledWorkId = 0;
|
|
87
100
|
|
|
101
|
+
pendingFramesCount(): number {
|
|
102
|
+
return this.pendingWorkFrames.length;
|
|
103
|
+
}
|
|
104
|
+
|
|
88
105
|
done(): Promise<void> {
|
|
89
106
|
if (this.pendingWorkFrames.length === 0) {
|
|
90
107
|
this.logIfEnabled('[Queue empty]');
|