feat(js): introduce Component API#505
Merged
francoischalifour merged 2 commits intonextfrom Mar 30, 2021
Merged
Conversation
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 68b084c:
|
Contributor
|
neat |
Haroenv
approved these changes
Mar 29, 2021
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This introduces a new Component API that is first used for highlight utils. It will then be leveraged to package our layouts (see #499).
Description
The Component API provides a way to pass components to the Autocomplete rendering lifecycles. This PR leverages this API to pass the highlight components, previously handled by
highlightHit.These components are bound to the provided renderer, meaning that users don't need to worry about using Preact, React or Vue—the integration remains seamless.
Usage
Basic
4 components are provided by default:
HighlightSnippetReverseHighlightReverseSnippetProvide user components
The future layouts will be leveraging this Component API.
Specifying a renderer:
Impact
Autocomplete layouts become just component creators
The layouts introduced in #499 will now just become components bound to a renderer. It will make them easy to package and to distribute.
Plugins could register components
The Autocomplete Plugins API could be extended to allow component registration. This will make a component available in the Autocomplete rendering lifecycles.
Example: a preview panel plugin that registers a
PreviewPanelcomponent.Community can create Autocomplete components for any framework
Since components can remain framework-agnostic, people will be able to create components for Autocomplete experiences, compatible with Preact, React or Vue.
Next steps
highlightHit(and other) exported functions. We'll need to document this Component API in another PR.Related