Migrates internal refs of ui/ to esm
Please note: ESLint and Closure have different opinions on the
necessity of imports, thus // eslint-disable-line no-unused-vars
was added to imports used only for Closure types.
Bug: 1006759
Change-Id: Idd32e12d23a636f1e0fdcb90742e4b706e3cef77
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1967134
Commit-Queue: Paul Lewis <[email protected]>
Reviewed-by: Tim van der Lippe <[email protected]>
diff --git a/front_end/ui/SearchableView.js b/front_end/ui/SearchableView.js
index e809a44..85df409 100644
--- a/front_end/ui/SearchableView.js
+++ b/front_end/ui/SearchableView.js
@@ -29,10 +29,15 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import {HistoryInput} from './HistoryInput.js';
+import {Toolbar, ToolbarButton, ToolbarToggle} from './Toolbar.js';
+import {createTextButton} from './UIUtils.js';
+import {VBox} from './Widget.js';
+
/**
* @unrestricted
*/
-export default class SearchableView extends UI.VBox {
+export class SearchableView extends VBox {
/**
* @param {!Searchable} searchable
* @param {string=} settingName
@@ -51,15 +56,15 @@
this._footerElementContainer.style.order = 100;
this._footerElement = this._footerElementContainer.createChild('div', 'toolbar-search');
- const replaceToggleToolbar = new UI.Toolbar('replace-toggle-toolbar', this._footerElement);
- this._replaceToggleButton = new UI.ToolbarToggle(Common.UIString('Replace'), 'mediumicon-replace');
- this._replaceToggleButton.addEventListener(UI.ToolbarButton.Events.Click, this._toggleReplace, this);
+ const replaceToggleToolbar = new Toolbar('replace-toggle-toolbar', this._footerElement);
+ this._replaceToggleButton = new ToolbarToggle(Common.UIString('Replace'), 'mediumicon-replace');
+ this._replaceToggleButton.addEventListener(ToolbarButton.Events.Click, this._toggleReplace, this);
replaceToggleToolbar.appendToolbarItem(this._replaceToggleButton);
const searchInputElements = this._footerElement.createChild('div', 'toolbar-search-inputs');
const searchControlElement = searchInputElements.createChild('div', 'toolbar-search-control');
- this._searchInputElement = UI.HistoryInput.create();
+ this._searchInputElement = HistoryInput.create();
this._searchInputElement.classList.add('search-replace');
this._searchInputElement.id = 'search-input-field';
this._searchInputElement.placeholder = Common.UIString('Find');
@@ -91,35 +96,35 @@
this._buttonsContainer = this._footerElement.createChild('div', 'toolbar-search-buttons');
const firstRowButtons = this._buttonsContainer.createChild('div', 'first-row-buttons');
- const toolbar = new UI.Toolbar('toolbar-search-options', firstRowButtons);
+ const toolbar = new Toolbar('toolbar-search-options', firstRowButtons);
if (this._searchProvider.supportsCaseSensitiveSearch()) {
- this._caseSensitiveButton = new UI.ToolbarToggle(Common.UIString('Match Case'));
+ this._caseSensitiveButton = new ToolbarToggle(Common.UIString('Match Case'));
this._caseSensitiveButton.setText('Aa');
- this._caseSensitiveButton.addEventListener(UI.ToolbarButton.Events.Click, this._toggleCaseSensitiveSearch, this);
+ this._caseSensitiveButton.addEventListener(ToolbarButton.Events.Click, this._toggleCaseSensitiveSearch, this);
toolbar.appendToolbarItem(this._caseSensitiveButton);
}
if (this._searchProvider.supportsRegexSearch()) {
- this._regexButton = new UI.ToolbarToggle(Common.UIString('Use Regular Expression'));
+ this._regexButton = new ToolbarToggle(Common.UIString('Use Regular Expression'));
this._regexButton.setText('.*');
- this._regexButton.addEventListener(UI.ToolbarButton.Events.Click, this._toggleRegexSearch, this);
+ this._regexButton.addEventListener(ToolbarButton.Events.Click, this._toggleRegexSearch, this);
toolbar.appendToolbarItem(this._regexButton);
}
const cancelButtonElement =
- UI.createTextButton(Common.UIString('Cancel'), this.closeSearch.bind(this), 'search-action-button');
+ createTextButton(Common.UIString('Cancel'), this.closeSearch.bind(this), 'search-action-button');
firstRowButtons.appendChild(cancelButtonElement);
this._secondRowButtons = this._buttonsContainer.createChild('div', 'second-row-buttons hidden');
this._replaceButtonElement =
- UI.createTextButton(Common.UIString('Replace'), this._replace.bind(this), 'search-action-button');
+ createTextButton(Common.UIString('Replace'), this._replace.bind(this), 'search-action-button');
this._replaceButtonElement.disabled = true;
this._secondRowButtons.appendChild(this._replaceButtonElement);
this._replaceAllButtonElement =
- UI.createTextButton(Common.UIString('Replace all'), this._replaceAll.bind(this), 'search-action-button');
+ createTextButton(Common.UIString('Replace all'), this._replaceAll.bind(this), 'search-action-button');
this._secondRowButtons.appendChild(this._replaceAllButtonElement);
this._replaceAllButtonElement.disabled = true;
@@ -494,7 +499,7 @@
_replace() {
const searchConfig = this._currentSearchConfig();
- /** @type {!UI.Replaceable} */ (this._searchProvider)
+ /** @type {!Replaceable} */ (this._searchProvider)
.replaceSelectionWith(searchConfig, this._replaceInputElement.value);
delete this._currentQuery;
this._performSearch(true, true);
@@ -502,7 +507,7 @@
_replaceAll() {
const searchConfig = this._currentSearchConfig();
- /** @type {!UI.Replaceable} */ (this._searchProvider).replaceAllWith(searchConfig, this._replaceInputElement.value);
+ /** @type {!Replaceable} */ (this._searchProvider).replaceAllWith(searchConfig, this._replaceInputElement.value);
}
/**
@@ -625,23 +630,3 @@
return regex;
}
}
-
-/* Legacy exported object*/
-self.UI = self.UI || {};
-
-/* Legacy exported object*/
-UI = UI || {};
-
-/** @constructor */
-UI.SearchableView = SearchableView;
-
-/**
- * @constructor
- */
-UI.SearchableView.SearchConfig = SearchConfig;
-
-/** @interface */
-UI.Searchable = Searchable;
-
-/** @interface */
-UI.Replaceable = Replaceable;