chrome-devtools-frontend 1.0.1539728 → 1.0.1539972

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/front_end/core/common/Debouncer.ts +2 -2
  2. package/front_end/core/common/Gzip.ts +1 -1
  3. package/front_end/core/common/Throttler.ts +3 -3
  4. package/front_end/core/host/GdpClient.ts +4 -0
  5. package/front_end/core/protocol_client/DevToolsCDPConnection.ts +181 -0
  6. package/front_end/core/protocol_client/InspectorBackend.ts +36 -203
  7. package/front_end/core/protocol_client/protocol_client.ts +2 -2
  8. package/front_end/core/sdk/DebuggerModel.ts +3 -16
  9. package/front_end/core/sdk/RemoteObject.ts +4 -0
  10. package/front_end/core/sdk/Target.ts +3 -6
  11. package/front_end/core/sdk/TargetManager.ts +1 -2
  12. package/front_end/entrypoints/lighthouse_worker/LighthouseWorkerService.ts +1 -3
  13. package/front_end/entrypoints/node_app/app/NodeMain.ts +3 -2
  14. package/front_end/generated/Deprecation.ts +8 -0
  15. package/front_end/generated/InspectorBackendCommands.ts +2 -2
  16. package/front_end/generated/SupportedCSSProperties.js +50 -9
  17. package/front_end/generated/protocol.ts +2 -2
  18. package/front_end/models/ai_assistance/EvaluateAction.ts +88 -5
  19. package/front_end/models/ai_assistance/injected.ts +15 -2
  20. package/front_end/models/live-metrics/web-vitals-injected/README.md +1 -1
  21. package/front_end/models/trace/Styles.ts +1 -1
  22. package/front_end/panels/ai_assistance/PatchWidget.ts +22 -12
  23. package/front_end/panels/ai_assistance/components/ChatView.ts +1 -1
  24. package/front_end/panels/common/AiCodeCompletionDisclaimer.ts +4 -4
  25. package/front_end/panels/common/AiCodeCompletionSummaryToolbar.ts +2 -2
  26. package/front_end/panels/elements/PropertiesWidget.ts +3 -2
  27. package/front_end/panels/event_listeners/EventListenersView.ts +9 -5
  28. package/front_end/panels/explain/components/ConsoleInsight.ts +2 -2
  29. package/front_end/panels/lighthouse/LighthouseProtocolService.ts +3 -3
  30. package/front_end/panels/linear_memory_inspector/LinearMemoryInspectorController.ts +2 -2
  31. package/front_end/panels/network/RequestPayloadView.ts +2 -1
  32. package/front_end/panels/network/RequestTimingView.ts +4 -2
  33. package/front_end/panels/network/components/RequestHeadersView.ts +24 -17
  34. package/front_end/panels/protocol_monitor/JSONEditor.ts +2 -2
  35. package/front_end/panels/recorder/RecorderController.ts +6 -7
  36. package/front_end/panels/recorder/models/RecordingPlayer.ts +3 -3
  37. package/front_end/panels/settings/components/SyncSection.ts +1 -1
  38. package/front_end/panels/sources/BreakpointsView.ts +3 -3
  39. package/front_end/panels/sources/ScopeChainSidebarPane.ts +4 -3
  40. package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +3 -2
  41. package/front_end/panels/timeline/components/FieldSettingsDialog.ts +9 -5
  42. package/front_end/panels/timeline/components/LiveMetricsView.ts +20 -9
  43. package/front_end/panels/timeline/components/MetricCard.ts +4 -2
  44. package/front_end/services/puppeteer/PuppeteerConnection.ts +2 -1
  45. package/front_end/third_party/chromium/README.chromium +1 -1
  46. package/front_end/third_party/puppeteer/README.chromium +2 -2
  47. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.d.ts +5 -0
  48. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.d.ts.map +1 -1
  49. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.js.map +1 -1
  50. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.d.ts +1 -0
  51. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.d.ts.map +1 -1
  52. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.js +3 -0
  53. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.js.map +1 -1
  54. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.d.ts +1 -0
  55. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.d.ts.map +1 -1
  56. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.js +21 -0
  57. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.js.map +1 -1
  58. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/ExtensionTransport.d.ts.map +1 -1
  59. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/ExtensionTransport.js +5 -1
  60. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/ExtensionTransport.js.map +1 -1
  61. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.d.ts +1 -0
  62. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.d.ts.map +1 -1
  63. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.js +6 -0
  64. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.js.map +1 -1
  65. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/TargetManager.d.ts +1 -1
  66. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/TargetManager.d.ts.map +1 -1
  67. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/TargetManager.js +29 -27
  68. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/TargetManager.js.map +1 -1
  69. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/injected/injected.d.ts +1 -1
  70. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Mutex.d.ts +2 -2
  71. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.d.ts +1 -1
  72. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.js +1 -1
  73. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +5 -0
  74. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +61 -26
  75. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.d.ts +5 -0
  76. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.d.ts.map +1 -1
  77. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.js.map +1 -1
  78. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.d.ts +1 -0
  79. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.d.ts.map +1 -1
  80. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.js +3 -0
  81. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.js.map +1 -1
  82. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.d.ts +1 -0
  83. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.d.ts.map +1 -1
  84. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.js +21 -0
  85. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.js.map +1 -1
  86. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/ExtensionTransport.d.ts.map +1 -1
  87. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/ExtensionTransport.js +5 -1
  88. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/ExtensionTransport.js.map +1 -1
  89. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.d.ts +1 -0
  90. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.d.ts.map +1 -1
  91. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.js +6 -0
  92. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.js.map +1 -1
  93. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/TargetManager.d.ts +1 -1
  94. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/TargetManager.d.ts.map +1 -1
  95. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/TargetManager.js +30 -28
  96. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/TargetManager.js.map +1 -1
  97. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.d.ts +1 -1
  98. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.js +1 -1
  99. package/front_end/third_party/puppeteer/package/lib/types.d.ts +5 -0
  100. package/front_end/third_party/puppeteer/package/package.json +1 -1
  101. package/front_end/third_party/puppeteer/package/src/api/Page.ts +6 -0
  102. package/front_end/third_party/puppeteer/package/src/bidi/Page.ts +4 -0
  103. package/front_end/third_party/puppeteer/package/src/cdp/Browser.ts +32 -0
  104. package/front_end/third_party/puppeteer/package/src/cdp/ExtensionTransport.ts +5 -1
  105. package/front_end/third_party/puppeteer/package/src/cdp/Page.ts +8 -0
  106. package/front_end/third_party/puppeteer/package/src/cdp/TargetManager.ts +36 -43
  107. package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
  108. package/front_end/ui/components/dialogs/ButtonDialog.ts +15 -5
  109. package/front_end/ui/components/expandable_list/ExpandableList.ts +1 -1
  110. package/front_end/ui/components/helpers/helpers.ts +0 -2
  111. package/front_end/ui/components/menus/Menu.ts +5 -3
  112. package/front_end/ui/components/survey_link/SurveyLink.docs.ts +22 -0
  113. package/front_end/ui/components/tree_outline/TreeOutline.ts +1 -2
  114. package/front_end/ui/legacy/SelectMenu.docs.ts +14 -0
  115. package/front_end/ui/legacy/components/object_ui/CustomPreviewComponent.ts +3 -1
  116. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +453 -347
  117. package/package.json +1 -1
  118. package/front_end/core/protocol_client/NodeURL.ts +0 -40
  119. package/front_end/ui/components/docs/combo_box/basic.html +0 -20
  120. package/front_end/ui/components/docs/combo_box/basic.ts +0 -49
  121. package/front_end/ui/components/docs/legacy_color_invert/basic.html +0 -77
  122. package/front_end/ui/components/docs/legacy_color_invert/basic.ts +0 -98
  123. package/front_end/ui/components/docs/survey_link/basic.html +0 -20
  124. package/front_end/ui/components/docs/survey_link/basic.ts +0 -28
  125. package/front_end/ui/components/docs/tree_outline/basic.html +0 -33
  126. package/front_end/ui/components/docs/tree_outline/basic.ts +0 -38
  127. package/front_end/ui/components/docs/tree_outline/custom-renderers.html +0 -32
  128. package/front_end/ui/components/docs/tree_outline/custom-renderers.ts +0 -61
  129. package/front_end/ui/components/docs/tree_outline/lazy-children.html +0 -32
  130. package/front_end/ui/components/docs/tree_outline/lazy-children.ts +0 -91
  131. package/front_end/ui/components/docs/tree_outline/sample-data.ts +0 -67
  132. package/front_end/ui/components/helpers/directives.ts +0 -38
package/package.json CHANGED
@@ -102,5 +102,5 @@
102
102
  "flat-cache": "6.1.12"
103
103
  }
104
104
  },
105
- "version": "1.0.1539728"
105
+ "version": "1.0.1539972"
106
106
  }
@@ -1,40 +0,0 @@
1
- // Copyright 2018 The Chromium Authors
2
- // Use of this source code is governed by a BSD-style license that can be
3
- // found in the LICENSE file.
4
-
5
- import * as Common from '../common/common.js';
6
- import * as Host from '../host/host.js';
7
- import type * as Platform from '../platform/platform.js';
8
-
9
- export class NodeURL {
10
- static patch(object: object): void {
11
- process(object, '');
12
-
13
- function process(object: {url?: string}, path: string): void {
14
- if (object.url && NodeURL.isPlatformPath(object.url, Host.Platform.isWin())) {
15
- // object.url can be of both types: RawPathString and UrlString
16
- object.url = Common.ParsedURL.ParsedURL.rawPathToUrlString(object.url as Platform.DevToolsPath.RawPathString);
17
- }
18
- for (const entry of Object.entries(object)) {
19
- const key = entry[0];
20
- const value = entry[1];
21
- const entryPath = path + '.' + key;
22
- if (entryPath !== '.result.result.value' && value !== null && typeof value === 'object') {
23
- process(
24
- (value as {
25
- url: string,
26
- }),
27
- entryPath);
28
- }
29
- }
30
- }
31
- }
32
-
33
- static isPlatformPath(fileSystemPath: string, isWindows: boolean): boolean {
34
- if (isWindows) {
35
- const re = /^([a-z]:[\/\\]|\\\\)/i;
36
- return re.test(fileSystemPath);
37
- }
38
- return fileSystemPath.length ? fileSystemPath[0] === '/' : false;
39
- }
40
- }
@@ -1,20 +0,0 @@
1
- <!--
2
- Copyright 2025 The Chromium Authors
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 ComboBox example</title>
12
- </head>
13
- <body>
14
-
15
- <div id="container">
16
- </div>
17
-
18
- <script type="module" src="./basic.js"></script>
19
- </body>
20
- </html>
@@ -1,49 +0,0 @@
1
- // Copyright 2024 The Chromium Authors
2
- // Use of this source code is governed by a BSD-style license that can be
3
- // found in the LICENSE file.
4
-
5
- import * as UI from '../../../legacy/legacy.js';
6
- import * as ComponentHelpers from '../../helpers/helpers.js';
7
-
8
- await ComponentHelpers.ComponentServerSetup.setup();
9
- function comboBoxExample({tabIndex, disabled}: {
10
- tabIndex: number,
11
- disabled: boolean,
12
- }): HTMLElement {
13
- const example = document.createElement('div');
14
- example.style.marginTop = '20px';
15
- const disabledExplanation = document.createElement('div');
16
- const tabbableExplanation = document.createElement('div');
17
- const component = UI.UIUtils.createSelect('Select an option', ['Hamster', 'Mouse', 'Cat']);
18
- component.disabled = disabled;
19
- component.tabIndex = tabIndex;
20
- disabledExplanation.textContent = `is disabled? ${component.disabled}`;
21
- tabbableExplanation.textContent = `is tabbable? ${component.tabIndex >= 0}`;
22
-
23
- example.appendChild(component);
24
- example.appendChild(disabledExplanation);
25
- example.appendChild(tabbableExplanation);
26
- return example;
27
- }
28
-
29
- function init(): void {
30
- const container = document.getElementById('container');
31
- if (!container) {
32
- return;
33
- }
34
-
35
- container.style.padding = '42px 42px';
36
- container.style.margin = '42px 42px';
37
- container.style.border = '1px solid rgb(0 0 0 / 20%)';
38
-
39
- // Basic
40
- container.appendChild(comboBoxExample({tabIndex: 0, disabled: false}));
41
-
42
- // Not tab reachable
43
- container.appendChild(comboBoxExample({tabIndex: -1, disabled: false}));
44
-
45
- // Disabled
46
- container.appendChild(comboBoxExample({tabIndex: 0, disabled: true}));
47
- }
48
-
49
- init();
@@ -1,77 +0,0 @@
1
- <!--
2
- Copyright 2020 The Chromium Authors
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>Legacy color input</title>
12
- <style>
13
- #container {
14
- margin: 20px;
15
- padding: 0;
16
- }
17
-
18
- form {
19
- display: flex;
20
- align-items: flex-end;
21
- margin-bottom: 20px;
22
- }
23
-
24
- form input[type="submit"] {
25
- margin-left: 20px;
26
- padding: 10px;
27
- font-size: 20px;
28
- background: var(--sys-color-primary);
29
- color: #fff;
30
- border: 1px solid var(--sys-color-divider);
31
- cursor: pointer;
32
- }
33
-
34
- form input[type="submit"]:hover {
35
- background: var(--color-primary-variant);
36
- }
37
-
38
- .text-input, span, pre {
39
- display: block;
40
- font-size: 16px;
41
- }
42
-
43
- .text-input input {
44
- display: block;
45
- margin: 10px 0 0 0;
46
- padding: 10px;
47
- border: 1px solid #ccc;
48
- }
49
-
50
- pre {
51
- margin: 10px 0;
52
- padding: 10px;
53
- border: 1px solid #ccc;
54
- user-select: all !important;
55
- }
56
- </style>
57
- </head>
58
- <body>
59
- <script type="module" src="./basic.js"></script>
60
- <div id="container">
61
- <form>
62
- <label class="text-input">
63
- CSS property:
64
- <input type="text" id="css-property" placeholder="background-color"/>
65
- </label>
66
- <label class="text-input">
67
- CSS value:
68
- <input type="text" id="css-value" placeholder="rgb(10 10 10)"/>
69
- </label>
70
- <input type="submit" value="Go!" />
71
- </form>
72
-
73
- <span>Dark mode legacy value:</span>
74
- <pre><code id="output"></code></pre>
75
- </div>
76
- </body>
77
- </html>
@@ -1,98 +0,0 @@
1
- // Copyright 2020 The Chromium Authors
2
- // Use of this source code is governed by a BSD-style license that can be
3
- // found in the LICENSE file.
4
-
5
- import * as Common from '../../../../core/common/common.js';
6
- import * as Platform from '../../../../core/platform/platform.js';
7
- import * as FrontendHelpers from '../../../../testing/EnvironmentHelpers.js';
8
- import * as ComponentHelpers from '../../helpers/helpers.js';
9
-
10
- await ComponentHelpers.ComponentServerSetup.setup();
11
- await FrontendHelpers.initializeGlobalVars();
12
-
13
- const form = document.querySelector<HTMLFormElement>('form');
14
- if (!form) {
15
- throw new Error('could not find form');
16
- }
17
-
18
- form.addEventListener('submit', event => {
19
- event.preventDefault();
20
- const property = form.querySelector<HTMLInputElement>('#css-property')?.value;
21
- const value = form.querySelector<HTMLInputElement>('#css-value')?.value;
22
- if (!property || !value) {
23
- return;
24
- }
25
- const output = legacyInvertVariableForDarkMode(property, value);
26
- const outputElem = document.querySelector<HTMLElement>('#output');
27
- if (outputElem) {
28
- outputElem.innerText = output;
29
- }
30
- });
31
-
32
- /**
33
- * This code is largely copy and pasted from the legacy ThemeSupport
34
- * around color patching. This is because we are working towards removing the
35
- * legacy color patching, but still may need to be able to generate legacy dark
36
- * mode values for light colors during the migration. This doc exists for that
37
- * reason.
38
- */
39
-
40
- type ColorUsage = 'unknown'|'foreground'|'background';
41
-
42
- function patchHSLA(hsla: number[], colorUsage: ColorUsage): void {
43
- const hue = hsla[0];
44
- const sat = hsla[1];
45
- let lit: number = hsla[2];
46
- const alpha = hsla[3];
47
-
48
- const minCap = colorUsage === 'background' ? 0.14 : 0;
49
- const maxCap = colorUsage === 'foreground' ? 0.9 : 1;
50
- lit = 1 - lit;
51
- if (lit < minCap * 2) {
52
- lit = minCap + lit / 2;
53
- } else if (lit > 2 * maxCap - 1) {
54
- lit = maxCap - 1 / 2 + lit / 2;
55
- }
56
- hsla[0] = Platform.NumberUtilities.clamp(hue, 0, 1);
57
- hsla[1] = Platform.NumberUtilities.clamp(sat, 0, 1);
58
- hsla[2] = Platform.NumberUtilities.clamp(lit, 0, 1);
59
- hsla[3] = Platform.NumberUtilities.clamp(alpha, 0, 1);
60
- }
61
-
62
- function patchColor(colorAsText: string, colorUsage: ColorUsage): string {
63
- const color = Common.Color.parse(colorAsText)?.as(Common.Color.Format.HSL);
64
- if (!color) {
65
- return colorAsText;
66
- }
67
- const hsla: Common.ColorUtils.Color4D = [color.h, color.s, color.l, color.alpha ?? 1];
68
- patchHSLA(hsla, colorUsage);
69
-
70
- const rgba = Common.Color.hsl2rgb(hsla);
71
- const outColor = new Common.Color.Legacy(rgba, Common.Color.Format.RGBA);
72
- let outText = outColor.asString();
73
- if (!outText) {
74
- outText = outColor.asString(outColor.hasAlpha() ? Common.Color.Format.RGBA : Common.Color.Format.RGB);
75
- }
76
- return outText || colorAsText;
77
- }
78
-
79
- function legacyInvertVariableForDarkMode(cssProperty: string, cssValue: string): string {
80
- let colorUsage: ColorUsage = 'unknown';
81
- if (cssProperty.indexOf('background') === 0 || cssProperty.indexOf('border') === 0) {
82
- colorUsage = 'background';
83
- }
84
- if (cssProperty.indexOf('background') === -1) {
85
- colorUsage = 'foreground';
86
- }
87
-
88
- const items = cssValue.replace(Common.Color.Regex, '\0$1\0').split('\0');
89
- const output = [];
90
- for (const item of items) {
91
- if (!item) {
92
- continue;
93
- }
94
- const newColor = patchColor(item, colorUsage);
95
- output.push(newColor);
96
- }
97
- return output.join(' ');
98
- }
@@ -1,20 +0,0 @@
1
- <!--
2
- Copyright 2020 The Chromium Authors
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 SurveyLink example</title>
12
- </head>
13
- <body>
14
-
15
- <div id="container">
16
- </div>
17
-
18
- <script type="module" src="./basic.js"></script>
19
- </body>
20
- </html>
@@ -1,28 +0,0 @@
1
- // Copyright 2020 The Chromium Authors
2
- // Use of this source code is governed by a BSD-style license that can be
3
- // found in the LICENSE file.
4
-
5
- import * as Common from '../../../../core/common/common.js';
6
- import * as FrontendHelpers from '../../../../testing/EnvironmentHelpers.js';
7
- import * as ComponentHelpers from '../../helpers/helpers.js';
8
- import * as SurveyLink from '../../survey_link/survey_link.js';
9
-
10
- await ComponentHelpers.ComponentServerSetup.setup();
11
- await FrontendHelpers.initializeGlobalVars();
12
-
13
- const link = new SurveyLink.SurveyLink.SurveyLink();
14
- document.getElementById('container')?.appendChild(link);
15
-
16
- // TODO(petermarshall): The icon doesn't render because importing sub-components cross-module
17
- // is tricky. Add some more interesting examples once it does.
18
-
19
- link.data = {
20
- trigger: 'test trigger',
21
- promptText: Common.UIString.LocalizedEmptyString,
22
- canShowSurvey: (_trigger, callback) => {
23
- setTimeout(callback.bind(undefined, {canShowSurvey: true}), 500);
24
- },
25
- showSurvey: (_trigger, callback) => {
26
- setTimeout(callback.bind(undefined, {surveyShown: true}), 1500);
27
- },
28
- };
@@ -1,33 +0,0 @@
1
- <!--
2
- Copyright 2020 The Chromium Authors
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 TreeOutline example</title>
12
- <style>
13
- #container {
14
- width: 80%;
15
- border: 1px solid black;
16
- padding: 20px;
17
- height: 300px;
18
- }
19
- </style>
20
- </head>
21
-
22
- <body>
23
-
24
- <div id="container">
25
- </div>
26
-
27
- <button id="recursively-expand">Recursively expand</button>
28
- <button id="expand-to-belgrave-house">Expand to show BEL node</button>
29
-
30
-
31
- <script type="module" src="./basic.js"></script>
32
- </body>
33
- </html>
@@ -1,38 +0,0 @@
1
- // Copyright 2020 The Chromium Authors
2
- // Use of this source code is governed by a BSD-style license that can be
3
- // found in the LICENSE file.
4
-
5
- import * as FrontendHelpers from '../../../../testing/EnvironmentHelpers.js';
6
- import * as ComponentHelpers from '../../helpers/helpers.js';
7
- import * as TreeOutline from '../../tree_outline/tree_outline.js';
8
-
9
- import {belgraveHouse, officesAndProductsData} from './sample-data.js';
10
-
11
- await ComponentHelpers.ComponentServerSetup.setup();
12
- await FrontendHelpers.initializeGlobalVars();
13
-
14
- const component = new TreeOutline.TreeOutline.TreeOutline<string>();
15
- component.data = {
16
- defaultRenderer: TreeOutline.TreeOutline.defaultRenderer,
17
- tree: officesAndProductsData,
18
- };
19
- component.setAttribute('animated', 'animated');
20
-
21
- component.addEventListener('treenodemouseover', (event: Event) => {
22
- const evt = event as TreeOutline.TreeOutline.ItemMouseOverEvent<string>;
23
- // eslint-disable-next-line no-console
24
- console.log('Node', evt.data.node, 'mouseover');
25
- });
26
- component.addEventListener('treenodemouseout', (event: Event) => {
27
- const evt = event as TreeOutline.TreeOutline.ItemMouseOutEvent<string>;
28
- // eslint-disable-next-line no-console
29
- console.log('Node', evt.data.node, 'mouseout');
30
- });
31
-
32
- document.getElementById('container')?.appendChild(component);
33
- document.getElementById('recursively-expand')?.addEventListener('click', () => {
34
- void component.expandRecursively();
35
- });
36
- document.getElementById('expand-to-belgrave-house')?.addEventListener('click', () => {
37
- void component.expandToAndSelectTreeNode(belgraveHouse);
38
- });
@@ -1,32 +0,0 @@
1
- <!--
2
- Copyright 2020 The Chromium Authors
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>TreeOutline with custom renderers</title>
12
- <style>
13
- #container {
14
- width: 80%;
15
- border: 1px solid black;
16
- padding: 20px;
17
- height: 300px;
18
- }
19
- </style>
20
- </head>
21
-
22
- <body>
23
-
24
- <div id="container">
25
- </div>
26
-
27
- <button id="recursively-expand">Recursively expand</button>
28
-
29
-
30
- <script type="module" src="./custom-renderers.js"></script>
31
- </body>
32
- </html>
@@ -1,61 +0,0 @@
1
- // Copyright 2020 The Chromium Authors
2
- // Use of this source code is governed by a BSD-style license that can be
3
- // found in the LICENSE file.
4
-
5
- import * as FrontendHelpers from '../../../../testing/EnvironmentHelpers.js';
6
- import * as Lit from '../../../lit/lit.js';
7
- import * as ComponentHelpers from '../../helpers/helpers.js';
8
- import * as TreeOutline from '../../tree_outline/tree_outline.js';
9
-
10
- const {html} = Lit;
11
-
12
- await ComponentHelpers.ComponentServerSetup.setup();
13
- await FrontendHelpers.initializeGlobalVars();
14
-
15
- interface TreeNodeData {
16
- cssProperty: string;
17
- cssValue: string;
18
- }
19
-
20
- const data: TreeOutline.TreeOutline.TreeOutlineData<TreeNodeData> = {
21
- defaultRenderer: (node, state) => {
22
- const {cssProperty, cssValue} = node.treeNodeData;
23
- const valueStyles = Lit.Directives.styleMap({
24
- paddingLeft: '10px',
25
- fontStyle: 'italic',
26
- color: 'var(--sys-color-token-property-special)',
27
- });
28
- return html`<code>${cssProperty}</code>:${
29
- state.isExpanded ? Lit.nothing : html`<code style=${valueStyles}>${cssValue}</code>`}`;
30
- },
31
- tree: [
32
- {
33
- treeNodeData: {cssProperty: 'border', cssValue: '1px solid red'},
34
- id: '1',
35
- },
36
- {
37
- treeNodeData: {cssProperty: 'font-size', cssValue: '20px'},
38
- id: '2',
39
- },
40
- {
41
- treeNodeData: {cssProperty: 'margin', cssValue: '10px 5px'},
42
- id: '3',
43
- async children(): Promise<Array<TreeOutline.TreeOutlineUtils.TreeNode<TreeNodeData>>> {
44
- return [
45
- {treeNodeData: {cssProperty: 'margin-left', cssValue: '5px'}, id: '4'},
46
- {treeNodeData: {cssProperty: 'margin-right', cssValue: '5px'}, id: '5'},
47
- {treeNodeData: {cssProperty: 'margin-top', cssValue: '10px'}, id: '6'},
48
- {treeNodeData: {cssProperty: 'margin-bottom', cssValue: '10px'}, id: '7'},
49
- ];
50
- },
51
- },
52
- ],
53
- };
54
-
55
- const component = new TreeOutline.TreeOutline.TreeOutline<TreeNodeData>();
56
- component.data = data;
57
-
58
- document.getElementById('container')?.appendChild(component);
59
- document.getElementById('recursively-expand')?.addEventListener('click', () => {
60
- void component.expandRecursively();
61
- });
@@ -1,32 +0,0 @@
1
- <!--
2
- Copyright 2020 The Chromium Authors
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>Tree Outline with Lazy Children</title>
12
- <style>
13
- #container {
14
- width: 80%;
15
- border: 1px solid black;
16
- padding: 20px;
17
- height: 300px;
18
- }
19
- </style>
20
- </head>
21
-
22
- <body>
23
-
24
- <div id="container">
25
- </div>
26
-
27
- <button id="recursively-expand">Recursively expand</button>
28
-
29
-
30
- <script type="module" src="./lazy-children.js"></script>
31
- </body>
32
- </html>
@@ -1,91 +0,0 @@
1
- // Copyright 2020 The Chromium Authors
2
- // Use of this source code is governed by a BSD-style license that can be
3
- // found in the LICENSE file.
4
-
5
- import * as FrontendHelpers from '../../../../testing/EnvironmentHelpers.js';
6
- import * as ComponentHelpers from '../../helpers/helpers.js';
7
- import * as TreeOutline from '../../tree_outline/tree_outline.js';
8
-
9
- await ComponentHelpers.ComponentServerSetup.setup();
10
- await FrontendHelpers.initializeGlobalVars();
11
-
12
- async function loadInSomeNodes(): Promise<Array<TreeOutline.TreeOutlineUtils.TreeNode<string>>> {
13
- const europeanOffices: Array<TreeOutline.TreeOutlineUtils.TreeNode<string>> = [
14
- {
15
- treeNodeData: 'UK',
16
- id: 'UK',
17
- children: () => Promise.resolve([
18
- {
19
- treeNodeData: 'LON',
20
- id: 'LON',
21
- children: () => Promise.resolve(
22
- [{treeNodeData: '6PS', id: '6PS'}, {treeNodeData: 'CSG', id: 'CSG'}, {treeNodeData: 'BEL', id: 'BEL'}]),
23
- },
24
- ]),
25
- },
26
- {
27
- treeNodeData: 'Germany',
28
- id: 'Germany',
29
- children: () => Promise.resolve([
30
- {treeNodeData: 'MUC', id: 'MUC'},
31
- {treeNodeData: 'BER', id: 'MUC'},
32
- ]),
33
- },
34
- ];
35
-
36
- return await new Promise(resolve => {
37
- setTimeout(() => resolve(europeanOffices), 250);
38
- });
39
- }
40
-
41
- const data: TreeOutline.TreeOutline.TreeOutlineData<string> = {
42
- defaultRenderer: TreeOutline.TreeOutline.defaultRenderer,
43
- tree: [
44
- {
45
- treeNodeData: 'Offices',
46
- id: 'Offices',
47
- children: () => Promise.resolve([
48
- {
49
- treeNodeData: 'Europe',
50
- id: 'Europe',
51
- async children() {
52
- const children = await loadInSomeNodes();
53
- return children;
54
- },
55
- },
56
- ]),
57
- },
58
- {
59
- treeNodeData: 'Products',
60
- id: 'Products',
61
- children: () => Promise.resolve([
62
- {
63
- treeNodeData: 'Chrome',
64
- id: 'Chrome',
65
- },
66
- {
67
- treeNodeData: 'YouTube',
68
- id: 'YouTube',
69
- },
70
- {
71
- treeNodeData: 'Drive',
72
- id: 'Drive',
73
- },
74
- {
75
- treeNodeData: 'Calendar',
76
- id: 'Calendar',
77
- },
78
- ]),
79
-
80
- },
81
- ],
82
-
83
- };
84
- const component = new TreeOutline.TreeOutline.TreeOutline<string>();
85
- component.setAttribute('toplevelbordercolor', 'var(--sys-color-token-property-special)');
86
- component.data = data;
87
-
88
- document.getElementById('container')?.appendChild(component);
89
- document.getElementById('recursively-expand')?.addEventListener('click', () => {
90
- void component.expandRecursively();
91
- });