Create new OOUI widget called `TemplateSearchWidget` for searching templates, with the same functionality as the merger of the existing template search fields in VisualEditor and TemplateWizard (i.e. CirrusSearch if available, prefix search if not). VE also handles the case of TemplateData not being installed, but as this is being implemented in TemplateData we don't have to in the new widget.
The outcome of this will be a wrapper widget for an InputWidget that's functionally equivalent to `ve.ui.MWTemplateTitleInputWidget` or `mw.TemplateWizard.SearchField`. Note that although we could be creating a single-input widget like these are, we don't want to do that because we'll be adding more functionality to the TemplateSearchWidget (such as a tab bar under the search input) that'll mean it's probably easier to have a general Widget.
This task does not include actually using this new widget anywhere. We will want to add it somewhere for testing though (so please update this description when that's figured out).
The new widget will be added in two subsequent tasks:
* {T377416}
* {T377417}
##Search logic
The new widget will follow the existing search logic of the two systems (they should be referred to for actual details), and their behaviour is the same. The general approach is as follows (in both the below cases, the search is limited to the Template namespace, ID 10; this can be changed in config but it doesn't look like it ever is):
* Without CirrusSearch installed:
* A [[https://www.mediawiki.org/wiki/API:Prefixsearch | prefixsearch]].
* Followed by a [[https://www.mediawiki.org/wiki/Extension:TemplateData#API | templatedata]] request to get the template metadata (i.e. the descriptions).
* With CirrusSearch installed:
* If the search term ends in an alphanumeric character, a [[https://www.mediawiki.org/wiki/Help:CirrusSearch#Words,_phrases,_and_modifiers | wildcard suffix]] search if run; otherwise it's a normal [[https://www.mediawiki.org/wiki/API:Search | search]].
* A [[https://www.mediawiki.org/wiki/API:Prefixsearch | prefixsearch]] is also run, to make sure it finds any exact prefix matches.
* The results of these are combined.
Both are followed by a [[https://www.mediawiki.org/wiki/Extension:TemplateData#API | templatedata]] request to get the template metadata (i.e. the descriptions).
Note that TemplateWizard does combine parts of this as a generator, but we'll follow the VisualEditor approach here in order to keep the latter templatedata-fetching step simpler and separate.
##Widget design
This task doesn't include any special design for the autocomplete field, it'll be a standard OOUI LookupElement displaying a title and description (and no image).
Neither search input debounces, but rather send API requests on every keystroke. TemplateWizard aborts on subsequent ones; VisualEditor doesn't. Aborting would