-
Notifications
You must be signed in to change notification settings - Fork 331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(js): introduce Component API #505
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:
|
neat |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔥
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super cool, ship it! 🚢
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:
Highlight
Snippet
ReverseHighlight
ReverseSnippet
Provide 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
PreviewPanel
component.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