chrome-devtools-frontend 1.0.1516909 → 1.0.1518653
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/checklist/README.md +2 -2
- package/docs/checklist/javascript.md +1 -1
- package/docs/contributing/README.md +1 -1
- package/docs/contributing/settings-experiments-features.md +9 -8
- package/docs/cookbook/devtools_on_devtools.md +2 -2
- package/docs/cookbook/localization.md +10 -10
- package/docs/devtools-protocol.md +9 -8
- package/docs/ecosystem/automatic_workspace_folders.md +3 -3
- package/docs/get_the_code.md +0 -2
- package/docs/styleguide/ux/components.md +166 -85
- package/docs/styleguide/ux/numbers.md +3 -4
- package/front_end/core/common/README.md +13 -12
- package/front_end/core/host/GdpClient.ts +16 -1
- package/front_end/core/host/UserMetrics.ts +4 -2
- package/front_end/core/root/Runtime.ts +13 -0
- package/front_end/core/sdk/CSSMatchedStyles.ts +5 -1
- package/front_end/entrypoints/main/MainImpl.ts +6 -3
- package/front_end/generated/InspectorBackendCommands.js +10 -7
- package/front_end/generated/SupportedCSSProperties.js +21 -7
- package/front_end/generated/protocol-mapping.d.ts +16 -1
- package/front_end/generated/protocol-proxy-api.d.ts +13 -1
- package/front_end/generated/protocol.ts +95 -0
- package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +166 -49
- package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.snapshot.txt +14 -181
- package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.ts +13 -315
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +224 -50
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +310 -11
- package/front_end/models/ai_assistance/performance/AIContext.ts +15 -2
- package/front_end/models/ai_code_completion/AiCodeCompletion.ts +17 -11
- package/front_end/models/badges/Badge.ts +8 -3
- package/front_end/models/badges/CodeWhispererBadge.ts +2 -4
- package/front_end/models/badges/StarterBadge.ts +2 -2
- package/front_end/models/badges/UserBadges.ts +21 -3
- package/front_end/models/javascript_metadata/NativeFunctions.js +1 -1
- package/front_end/models/trace/README.md +28 -1
- package/front_end/models/trace/handlers/UserTimingsHandler.ts +1 -1
- package/front_end/models/trace/helpers/Trace.ts +99 -43
- package/front_end/models/trace/types/TraceEvents.ts +9 -0
- package/front_end/panels/accessibility/ARIAAttributesView.ts +113 -191
- package/front_end/panels/accessibility/AccessibilityNodeView.ts +9 -9
- package/front_end/panels/accessibility/AccessibilitySubPane.ts +6 -4
- package/front_end/panels/accessibility/accessibilityProperties.css +2 -0
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +16 -2
- package/front_end/panels/ai_assistance/components/ChatView.ts +9 -10
- package/front_end/panels/ai_assistance/components/PerformanceAgentMarkdownRenderer.ts +42 -0
- package/front_end/panels/common/AiCodeCompletionDisclaimer.ts +32 -9
- package/front_end/panels/common/AiCodeCompletionSummaryToolbar.ts +7 -1
- package/front_end/panels/common/BadgeNotification.ts +21 -5
- package/front_end/panels/common/GdpSignUpDialog.ts +18 -9
- package/front_end/panels/console/ConsolePrompt.ts +1 -1
- package/front_end/panels/console/ConsoleView.ts +6 -2
- package/front_end/panels/elements/ElementsPanel.ts +4 -0
- package/front_end/panels/elements/ElementsTreeElement.ts +18 -0
- package/front_end/panels/elements/ElementsTreeOutline.ts +13 -0
- package/front_end/panels/elements/StylePropertyTreeElement.ts +21 -6
- package/front_end/panels/media/TickingFlameChart.ts +1 -1
- package/front_end/panels/profiler/HeapSnapshotView.ts +34 -19
- package/front_end/panels/search/SearchResultsPane.ts +124 -128
- package/front_end/panels/search/SearchView.ts +24 -17
- package/front_end/panels/settings/components/SyncSection.ts +16 -8
- package/front_end/panels/sources/AiCodeCompletionPlugin.ts +6 -1
- package/front_end/panels/sources/SourcesPanel.ts +3 -0
- package/front_end/panels/timeline/AppenderUtils.ts +2 -2
- package/front_end/panels/timeline/ExtensionTrackAppender.ts +13 -4
- package/front_end/panels/timeline/GPUTrackAppender.ts +2 -1
- package/front_end/panels/timeline/InteractionsTrackAppender.ts +5 -1
- package/front_end/panels/timeline/LayoutShiftsTrackAppender.ts +2 -1
- package/front_end/panels/timeline/ThreadAppender.ts +12 -3
- package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +9 -4
- package/front_end/panels/timeline/TimelinePanel.ts +3 -2
- package/front_end/panels/timeline/TimelineUIUtils.ts +5 -4
- package/front_end/panels/timeline/TimingsTrackAppender.ts +6 -1
- package/front_end/panels/timeline/components/CPUThrottlingSelector.ts +95 -82
- package/front_end/panels/timeline/components/LiveMetricsView.ts +2 -2
- package/front_end/panels/timeline/components/cpuThrottlingSelector.css +17 -15
- package/front_end/panels/timeline/components/insights/BaseInsightComponent.ts +3 -0
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/codemirror.js.map +1 -1
- package/front_end/third_party/codemirror.next/codemirror.next.d.ts +6 -9
- package/front_end/third_party/codemirror.next/package.json +2 -1
- package/front_end/third_party/diff/README.chromium +1 -0
- package/front_end/ui/components/text_editor/config.ts +6 -7
- package/front_end/ui/components/tooltips/Tooltip.ts +70 -31
- package/front_end/ui/legacy/README.md +33 -24
- package/front_end/ui/legacy/SearchableView.ts +19 -26
- package/front_end/ui/legacy/TextPrompt.ts +166 -1
- package/front_end/ui/legacy/Treeoutline.ts +16 -2
- package/front_end/ui/legacy/UIUtils.ts +15 -2
- package/front_end/ui/legacy/XElement.ts +0 -43
- package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +20 -4
- package/front_end/ui/visual_logging/KnownContextValues.ts +19 -6
- package/front_end/ui/visual_logging/README.md +43 -27
- package/package.json +1 -1
@@ -55,6 +55,7 @@ import {
|
|
55
55
|
deepElementFromPoint,
|
56
56
|
enclosingNodeOrSelfWithNodeNameInArray,
|
57
57
|
HTMLElementWithLightDOMTemplate,
|
58
|
+
InterceptBindingDirective,
|
58
59
|
isEditing,
|
59
60
|
} from './UIUtils.js';
|
60
61
|
|
@@ -1549,6 +1550,7 @@ class ActiveHighlights {
|
|
1549
1550
|
class TreeViewTreeElement extends TreeElement {
|
1550
1551
|
#activeHighlights = new ActiveHighlights();
|
1551
1552
|
#clonedAttributes = new Set<string>();
|
1553
|
+
#clonedClasses = new Set<string>();
|
1552
1554
|
|
1553
1555
|
static #elementToTreeElement = new WeakMap<Node, TreeViewTreeElement>();
|
1554
1556
|
readonly configElement: HTMLLIElement;
|
@@ -1569,7 +1571,9 @@ class TreeViewTreeElement extends TreeElement {
|
|
1569
1571
|
refresh(): void {
|
1570
1572
|
this.titleElement.textContent = '';
|
1571
1573
|
this.#clonedAttributes.forEach(attr => this.listItemElement.attributes.removeNamedItem(attr));
|
1574
|
+
this.#clonedClasses.forEach(className => this.listItemElement.classList.remove(className));
|
1572
1575
|
this.#clonedAttributes.clear();
|
1576
|
+
this.#clonedClasses.clear();
|
1573
1577
|
for (let i = 0; i < this.configElement.attributes.length; ++i) {
|
1574
1578
|
const attribute = this.configElement.attributes.item(i);
|
1575
1579
|
if (attribute && attribute.name !== 'role' && SDK.DOMModel.ARIA_ATTRIBUTES.has(attribute.name)) {
|
@@ -1577,6 +1581,11 @@ class TreeViewTreeElement extends TreeElement {
|
|
1577
1581
|
this.#clonedAttributes.add(attribute.name);
|
1578
1582
|
}
|
1579
1583
|
}
|
1584
|
+
for (const className of this.configElement.classList) {
|
1585
|
+
this.listItemElement.classList.add(className);
|
1586
|
+
this.#clonedClasses.add(className);
|
1587
|
+
}
|
1588
|
+
InterceptBindingDirective.attachEventListeners(this.configElement, this.listItemElement);
|
1580
1589
|
|
1581
1590
|
for (const child of this.configElement.childNodes) {
|
1582
1591
|
if (child instanceof HTMLUListElement && child.role === 'group') {
|
@@ -1753,7 +1762,7 @@ export class TreeViewElement extends HTMLElementWithLightDOMTemplate {
|
|
1753
1762
|
}
|
1754
1763
|
}
|
1755
1764
|
|
1756
|
-
protected override addNodes(nodes: NodeList|Node[]): void {
|
1765
|
+
protected override addNodes(nodes: NodeList|Node[], nextSibling?: Node|null): void {
|
1757
1766
|
for (const node of getTreeNodes(nodes)) {
|
1758
1767
|
if (TreeViewTreeElement.get(node)) {
|
1759
1768
|
continue; // Not sure this can happen
|
@@ -1762,8 +1771,13 @@ export class TreeViewElement extends HTMLElementWithLightDOMTemplate {
|
|
1762
1771
|
if (!parent) {
|
1763
1772
|
continue;
|
1764
1773
|
}
|
1774
|
+
while (nextSibling && nextSibling.nodeType !== Node.ELEMENT_NODE) {
|
1775
|
+
nextSibling = nextSibling.nextSibling;
|
1776
|
+
}
|
1777
|
+
const nextElement = nextSibling ? TreeViewTreeElement.get(nextSibling) : null;
|
1778
|
+
const index = nextElement ? parent.treeElement.indexOfChild(nextElement) : parent.treeElement.children().length;
|
1765
1779
|
const treeElement = new TreeViewTreeElement(this.#treeOutline, node);
|
1766
|
-
parent.treeElement.
|
1780
|
+
parent.treeElement.insertChild(treeElement, index);
|
1767
1781
|
if (hasBooleanAttribute(node, 'selected')) {
|
1768
1782
|
treeElement.revealAndSelect(true);
|
1769
1783
|
}
|
@@ -2216,6 +2216,19 @@ export class InterceptBindingDirective extends Lit.Directive.Directive {
|
|
2216
2216
|
}
|
2217
2217
|
}
|
2218
2218
|
|
2219
|
+
export const cloneCustomElement = <T extends HTMLElement>(element: T, deep?: boolean): T => {
|
2220
|
+
const clone = document.createElement(element.localName) as T;
|
2221
|
+
for (const attribute of element.attributes) {
|
2222
|
+
clone.setAttribute(attribute.name, attribute.value);
|
2223
|
+
}
|
2224
|
+
if (deep) {
|
2225
|
+
for (const child of element.childNodes) {
|
2226
|
+
clone.appendChild(child.cloneNode(deep));
|
2227
|
+
}
|
2228
|
+
}
|
2229
|
+
return clone;
|
2230
|
+
};
|
2231
|
+
|
2219
2232
|
export class HTMLElementWithLightDOMTemplate extends HTMLElement {
|
2220
2233
|
readonly #mutationObserver = new MutationObserver(this.#onChange.bind(this));
|
2221
2234
|
#contentTemplate: HTMLTemplateElement|null = null;
|
@@ -2286,7 +2299,7 @@ export class HTMLElementWithLightDOMTemplate extends HTMLElement {
|
|
2286
2299
|
this.onChange(mutationList);
|
2287
2300
|
for (const mutation of mutationList) {
|
2288
2301
|
this.removeNodes(mutation.removedNodes);
|
2289
|
-
this.addNodes(mutation.addedNodes);
|
2302
|
+
this.addNodes(mutation.addedNodes, mutation.nextSibling);
|
2290
2303
|
this.updateNode(mutation.target, mutation.attributeName);
|
2291
2304
|
}
|
2292
2305
|
}
|
@@ -2297,7 +2310,7 @@ export class HTMLElementWithLightDOMTemplate extends HTMLElement {
|
|
2297
2310
|
protected updateNode(_node: Node, _attributeName: string|null): void {
|
2298
2311
|
}
|
2299
2312
|
|
2300
|
-
protected addNodes(_nodes: NodeList|Node[]): void {
|
2313
|
+
protected addNodes(_nodes: NodeList|Node[], _nextSibling?: Node|null): void {
|
2301
2314
|
}
|
2302
2315
|
|
2303
2316
|
protected removeNodes(_nodes: NodeList): void {
|
@@ -65,53 +65,10 @@ class XBox extends XElement {
|
|
65
65
|
}
|
66
66
|
}
|
67
67
|
|
68
|
-
class XVBox extends XBox {
|
69
|
-
constructor() {
|
70
|
-
super('column');
|
71
|
-
}
|
72
|
-
}
|
73
|
-
|
74
68
|
class XHBox extends XBox {
|
75
69
|
constructor() {
|
76
70
|
super('row');
|
77
71
|
}
|
78
72
|
}
|
79
73
|
|
80
|
-
class XCBox extends XElement {
|
81
|
-
constructor() {
|
82
|
-
super();
|
83
|
-
this.style.setProperty('display', 'flex');
|
84
|
-
this.style.setProperty('flex-direction', 'column');
|
85
|
-
this.style.setProperty('justify-content', 'center');
|
86
|
-
this.style.setProperty('align-items', 'center');
|
87
|
-
}
|
88
|
-
}
|
89
|
-
|
90
|
-
class XDiv extends XElement {
|
91
|
-
constructor() {
|
92
|
-
super();
|
93
|
-
this.style.setProperty('display', 'block');
|
94
|
-
}
|
95
|
-
}
|
96
|
-
|
97
|
-
class XSpan extends XElement {
|
98
|
-
constructor() {
|
99
|
-
super();
|
100
|
-
this.style.setProperty('display', 'inline');
|
101
|
-
}
|
102
|
-
}
|
103
|
-
|
104
|
-
class XText extends XElement {
|
105
|
-
constructor() {
|
106
|
-
super();
|
107
|
-
this.style.setProperty('display', 'inline');
|
108
|
-
this.style.setProperty('white-space', 'pre');
|
109
|
-
}
|
110
|
-
}
|
111
|
-
|
112
|
-
customElements.define('x-vbox', XVBox);
|
113
74
|
customElements.define('x-hbox', XHBox);
|
114
|
-
customElements.define('x-cbox', XCBox);
|
115
|
-
customElements.define('x-div', XDiv);
|
116
|
-
customElements.define('x-span', XSpan);
|
117
|
-
customElements.define('x-text', XText);
|
@@ -148,6 +148,12 @@ export const enum HoverType {
|
|
148
148
|
ERROR = 'ERROR',
|
149
149
|
}
|
150
150
|
|
151
|
+
export const enum GroupCollapsibleState {
|
152
|
+
ALWAYS = 0,
|
153
|
+
NEVER = 1,
|
154
|
+
IF_MULTI_ROW = 2
|
155
|
+
}
|
156
|
+
|
151
157
|
export interface FlameChartDelegate {
|
152
158
|
windowChanged(_startTime: number, _endTime: number, _animate: boolean): void;
|
153
159
|
updateRangeSelection(_startTime: number, _endTime: number): void;
|
@@ -3793,10 +3799,21 @@ export class FlameChart extends Common.ObjectWrapper.eventMixin<EventTypes, type
|
|
3793
3799
|
|
3794
3800
|
const groups = this.rawTimelineData.groups || [];
|
3795
3801
|
const style = groups[index].style;
|
3796
|
-
if (
|
3797
|
-
return
|
3802
|
+
if (style.collapsible === GroupCollapsibleState.NEVER) {
|
3803
|
+
return false;
|
3804
|
+
}
|
3805
|
+
if (!style.shareHeaderLine) {
|
3806
|
+
return style.collapsible === GroupCollapsibleState.ALWAYS;
|
3798
3807
|
}
|
3799
3808
|
const isLastGroup = index + 1 >= groups.length;
|
3809
|
+
if (style.collapsible === GroupCollapsibleState.IF_MULTI_ROW) {
|
3810
|
+
const nextRowStartLevel = isLastGroup ? this.dataProvider.maxStackDepth() : groups[index + 1].startLevel;
|
3811
|
+
const rowsInCurrentGroup = nextRowStartLevel - groups[index].startLevel;
|
3812
|
+
// If everything fits in one line, there's no need to offer the expand capability.
|
3813
|
+
if (rowsInCurrentGroup < 2) {
|
3814
|
+
return false;
|
3815
|
+
}
|
3816
|
+
}
|
3800
3817
|
if (!isLastGroup && groups[index + 1].style.nestingLevel > style.nestingLevel) {
|
3801
3818
|
return true;
|
3802
3819
|
}
|
@@ -4421,8 +4438,7 @@ export interface Group {
|
|
4421
4438
|
export interface GroupStyle {
|
4422
4439
|
height: number;
|
4423
4440
|
padding: number;
|
4424
|
-
|
4425
|
-
collapsible: boolean;
|
4441
|
+
collapsible: GroupCollapsibleState;
|
4426
4442
|
/** The color of the group title text. */
|
4427
4443
|
color: string;
|
4428
4444
|
/**
|
@@ -540,6 +540,7 @@ export const knownContextValues = new Set([
|
|
540
540
|
'background-services',
|
541
541
|
'background-size',
|
542
542
|
'background-sync',
|
543
|
+
'badge-notification',
|
543
544
|
'badge-notification.dismiss',
|
544
545
|
'badproperty',
|
545
546
|
'bars',
|
@@ -884,6 +885,7 @@ export const knownContextValues = new Set([
|
|
884
885
|
'content',
|
885
886
|
'content-encoding',
|
886
887
|
'content-length',
|
888
|
+
'content-policy',
|
887
889
|
'content-type',
|
888
890
|
'content-visibility',
|
889
891
|
'context',
|
@@ -1028,6 +1030,7 @@ export const knownContextValues = new Set([
|
|
1028
1030
|
'cpu-throttling-selector',
|
1029
1031
|
'cpu-throttling-selector-calibrate',
|
1030
1032
|
'create-new-snippet',
|
1033
|
+
'create-profile',
|
1031
1034
|
'create-recording',
|
1032
1035
|
'create-recording-view',
|
1033
1036
|
'creator-ad-script-ancestry',
|
@@ -1692,12 +1695,8 @@ export const knownContextValues = new Set([
|
|
1692
1695
|
'gap-rule-overlap',
|
1693
1696
|
'gap-rule-paint-order',
|
1694
1697
|
'garamond',
|
1695
|
-
'gdp
|
1696
|
-
'gdp
|
1697
|
-
'gdp.sign-up',
|
1698
|
-
'gdp.sign-up-dialog-open',
|
1699
|
-
'gdp.signup.keep-me-updated',
|
1700
|
-
'gdp.terms-of-service',
|
1698
|
+
'gdp-profile',
|
1699
|
+
'gdp-sign-up-dialog',
|
1701
1700
|
'gen-ai-settings-panel',
|
1702
1701
|
'general',
|
1703
1702
|
'generative-ai-terms-of-service',
|
@@ -1985,6 +1984,7 @@ export const knownContextValues = new Set([
|
|
1985
1984
|
'justify-self',
|
1986
1985
|
'ka',
|
1987
1986
|
'keep-alive',
|
1987
|
+
'keep-me-updated',
|
1988
1988
|
'key',
|
1989
1989
|
'keybinds',
|
1990
1990
|
'keyboard',
|
@@ -2403,6 +2403,7 @@ export const knownContextValues = new Set([
|
|
2403
2403
|
'main.zoom-reset',
|
2404
2404
|
'make-a-copy',
|
2405
2405
|
'manage-header-columns',
|
2406
|
+
'manage-settings',
|
2406
2407
|
'manager-custom-headers',
|
2407
2408
|
'manifest',
|
2408
2409
|
'manifest.copy-id',
|
@@ -2691,6 +2692,7 @@ export const knownContextValues = new Set([
|
|
2691
2692
|
'open-memory-inspector',
|
2692
2693
|
'open-network-panel',
|
2693
2694
|
'open-performance-panel',
|
2695
|
+
'open-sign-up-dialog',
|
2694
2696
|
'open-sources-panel',
|
2695
2697
|
'open-using',
|
2696
2698
|
'opened-windows',
|
@@ -2888,6 +2890,7 @@ export const knownContextValues = new Set([
|
|
2888
2890
|
'priority',
|
2889
2891
|
'privacy',
|
2890
2892
|
'privacy-notice',
|
2893
|
+
'privacy-policy',
|
2891
2894
|
'privacy-policy.console-insights',
|
2892
2895
|
'private-state-tokens',
|
2893
2896
|
'production-origin',
|
@@ -2911,6 +2914,12 @@ export const knownContextValues = new Set([
|
|
2911
2914
|
'profiler.profile-type',
|
2912
2915
|
'profiler.save-to-file',
|
2913
2916
|
'profiles-sidebar',
|
2917
|
+
'profiles/me/awards/developers.google.com%2Fprofile%2Fbadges%2Factivity%2Fchrome-devtools%2Fai-explorer',
|
2918
|
+
'profiles/me/awards/developers.google.com%2Fprofile%2Fbadges%2Factivity%2Fchrome-devtools%2Fchrome-devtools-user',
|
2919
|
+
'profiles/me/awards/developers.google.com%2Fprofile%2Fbadges%2Factivity%2Fchrome-devtools%2Fcode-whisperer',
|
2920
|
+
'profiles/me/awards/developers.google.com%2Fprofile%2Fbadges%2Factivity%2Fchrome-devtools%2Fdom-detective',
|
2921
|
+
'profiles/me/awards/developers.google.com%2Fprofile%2Fbadges%2Factivity%2Fchrome-devtools%2Fspeedster',
|
2922
|
+
'program-link',
|
2914
2923
|
'progress',
|
2915
2924
|
'prop',
|
2916
2925
|
'prop1',
|
@@ -2963,6 +2972,7 @@ export const knownContextValues = new Set([
|
|
2963
2972
|
'rec-2020',
|
2964
2973
|
'recalc-style-count',
|
2965
2974
|
'receive',
|
2975
|
+
'receive-badges',
|
2966
2976
|
'receive-gdp-badges',
|
2967
2977
|
'recommendation',
|
2968
2978
|
'reconnect',
|
@@ -2996,6 +3006,7 @@ export const knownContextValues = new Set([
|
|
2996
3006
|
'release-notes',
|
2997
3007
|
'reload-required',
|
2998
3008
|
'rem',
|
3009
|
+
'remind-me-later',
|
2999
3010
|
'remote-address',
|
3000
3011
|
'remote-address-space',
|
3001
3012
|
'remote-debnugging-terminated',
|
@@ -3436,6 +3447,7 @@ export const knownContextValues = new Set([
|
|
3436
3447
|
'sidebar-position-right',
|
3437
3448
|
'sidebar-test-replace-page-with-object',
|
3438
3449
|
'sign-count',
|
3450
|
+
'sign-up',
|
3439
3451
|
'signCount',
|
3440
3452
|
'simulate',
|
3441
3453
|
'simulate-custom-quota',
|
@@ -4042,6 +4054,7 @@ export const knownContextValues = new Set([
|
|
4042
4054
|
'view-computed-value',
|
4043
4055
|
'view-details',
|
4044
4056
|
'view-parsed',
|
4057
|
+
'view-profile',
|
4045
4058
|
'view-source',
|
4046
4059
|
'view-timeline',
|
4047
4060
|
'view-timeline-axis',
|
@@ -60,20 +60,22 @@ element. There’s a number of fluent builder functions exported
|
|
60
60
|
the attribute value. These are all bound versions of
|
61
61
|
`LoggingConfig.makeConfigStringBuilder` and are used in the legacy UI as:
|
62
62
|
|
63
|
-
```
|
63
|
+
```ts
|
64
64
|
this.element.setAttribute('jslog', `${VisualLogging.panel(context)}`);
|
65
65
|
```
|
66
66
|
|
67
67
|
or
|
68
68
|
|
69
|
-
```
|
70
|
-
button.element.setAttribute(
|
71
|
-
|
69
|
+
```ts
|
70
|
+
button.element.setAttribute(
|
71
|
+
'jslog',
|
72
|
+
`${VisualLogging.dropDown('rendering-emulations').track({ click: true })}`,
|
73
|
+
);
|
72
74
|
```
|
73
75
|
|
74
76
|
In LitHTML, the usage is:
|
75
77
|
|
76
|
-
```
|
78
|
+
```ts
|
77
79
|
Lit.html`<td jslog=${VisualLogging.tableCell(/* context */ col.id)
|
78
80
|
.track({click: true})}>
|
79
81
|
```
|
@@ -121,27 +123,37 @@ First argument is a provider name that is later used as an argument in the
|
|
121
123
|
`jslog` builder `context()` method. Second is a function that takes an Element or Event
|
122
124
|
and returns a number. For a disclosure triangle, this is as follows:
|
123
125
|
|
124
|
-
```
|
126
|
+
```ts
|
125
127
|
function disclosureTriangleLoggingContextProvider(
|
126
|
-
|
128
|
+
e: VisualLogging.Loggable | Event,
|
129
|
+
): Promise<number | undefined> {
|
127
130
|
if (e instanceof Element) {
|
128
131
|
return Promise.resolve(e.classList.contains('parent') ? 1 : 0);
|
129
132
|
}
|
130
133
|
if (e instanceof MouseEvent && e.currentTarget instanceof Node) {
|
131
|
-
const treeElement = TreeElement.getTreeElementBylistItemNode(
|
134
|
+
const treeElement = TreeElement.getTreeElementBylistItemNode(
|
135
|
+
e.currentTarget,
|
136
|
+
);
|
132
137
|
if (treeElement) {
|
133
|
-
return Promise.resolve(
|
138
|
+
return Promise.resolve(
|
139
|
+
treeElement.isEventWithinDisclosureTriangle(e) ? 1 : 0,
|
140
|
+
);
|
134
141
|
}
|
135
142
|
}
|
136
143
|
return Promise.resolve(undefined);
|
137
144
|
}
|
138
145
|
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
146
|
+
VisualLogging.registerContextProvider(
|
147
|
+
'disclosureTriangle',
|
148
|
+
disclosureTriangleLoggingContextProvider,
|
149
|
+
);
|
150
|
+
|
151
|
+
listItemNode.setAttribute(
|
152
|
+
'jslog',
|
153
|
+
`${VisualLogging.treeItem()
|
154
|
+
.track({ click: true })
|
155
|
+
.context('disclosureTriangle')}`,
|
156
|
+
);
|
145
157
|
```
|
146
158
|
|
147
159
|
Similarly parent provides are used to specify parent visual elements in
|
@@ -150,18 +162,18 @@ to identify the parent. However, sometimes, markup doesn’t reflect the logical
|
|
150
162
|
structure, for example, when a legacy tree outline has children in an `<ol>` element, which is a
|
151
163
|
sibling of `<li>` that specifies the parent. In this case, you can do the following:
|
152
164
|
|
153
|
-
```
|
154
|
-
function loggingParentProvider(e: Element): Element|undefined {
|
165
|
+
```ts
|
166
|
+
function loggingParentProvider(e: Element): Element | undefined {
|
155
167
|
const treeElement = TreeElement.getTreeElementBylistItemNode(e);
|
156
168
|
return treeElement?.parent?.listItemElement;
|
157
169
|
}
|
158
170
|
|
159
|
-
VisualLogging.registerParentProvider('parentTreeItem',
|
160
|
-
loggingParentProvider);
|
171
|
+
VisualLogging.registerParentProvider('parentTreeItem', loggingParentProvider);
|
161
172
|
|
162
173
|
this.listItemNode.setAttribute(
|
163
|
-
|
164
|
-
|
174
|
+
'jslog',
|
175
|
+
`${VisualLogging.treeItem().track({ click: true }).parent('parentTreeItem')}`,
|
176
|
+
);
|
165
177
|
```
|
166
178
|
|
167
179
|
### Logging beyond DOM
|
@@ -182,11 +194,15 @@ Then call `registerLoggable` with the corresponding JavaScript
|
|
182
194
|
object, config string in the same format as the `jslog` attribute would have,
|
183
195
|
and an optional parent JavaScript object. For a native menu item, this is:
|
184
196
|
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
197
|
+
```ts
|
198
|
+
VisualLogging.registerLoggable(
|
199
|
+
descriptor,
|
200
|
+
`${VisualLogging.action()
|
201
|
+
.track({ click: true })
|
202
|
+
.context(descriptor.jslogContext)}`,
|
203
|
+
parent || descriptors,
|
204
|
+
size,
|
205
|
+
);
|
190
206
|
```
|
191
207
|
|
192
208
|
This only registers the element and doesn’t log anything yet. To log
|
@@ -198,7 +214,7 @@ Similarly to log click, call `VisualLogging.logClick`.
|
|
198
214
|
You may find it useful to see which UI elements are annotated and how the tree
|
199
215
|
structure look like. To do that, run
|
200
216
|
|
201
|
-
```
|
217
|
+
```ts
|
202
218
|
setVeDebuggingEnabled(true);
|
203
219
|
```
|
204
220
|
|
package/package.json
CHANGED