hotlightorg / hotlight Goto Github PK
View Code? Open in Web Editor NEWA search engine and hot key thingy for saas products
License: MIT License
A search engine and hot key thingy for saas products
License: MIT License
Wrap any part of a view in a hotlight-keyzone
and it will assign keys to elements. There's only one event listener listening to keydown which is global and the assignment of keys to elements happens when keydown happens.
When a key is pressed keyzone finds all element with the [data-hotkey]
and maps those with the values that attribute has.
Additionally if mode="auto" then it finds all inputs,buttons,anchors,content editable and assigns a key incrementally. One zone at a time.
Each action can provide an optional property named aliases, an array of strings, that is used for matching and sorting.
It the value should be displayed in parenthesis if the query matches any of the aliases. Perhaps just the first matching alias.
Boost actions to make them appear at the top of the result list.
This can be done using a "follow" property on the action, that is an array of strings referring to other actions ID. Hotlight needs to sort the results based on actions that are "followed" by other actions.
- Queries: no result, hits (never on external sources, only those specified as actions)
- Boost suggestions based on usage
It does not make sense to host/index private data, such as contacts in a crm, however can we add something that can be self hosted or at least small examples on how to search?
Currently, there are some outdated info residing in the package.json(s).
Much like vim, while in Hotlight, you can press a special key that narrows down the search to a subset of all actions.
In a CRM, a mode can be @
to only search contacts, or #
to search to search deals.
It would be good if the key was a natural prefix to the entities/actions it targets.
The modes can be configured as well as their keys.
Besides URL's and callback functions, a trigger can take a user from anywhere in an app to somewhere where the user will continue its journey, with support of focus().
A trigger would return something like { url: "/", focus: "new-comment" } which would focus an input field marked with 'data-hotlight-focus' at /.
Should focus points be centralized, into constants perhaps? Some kind of registry, but then again the actions themselves are centralized.
We can always send the us through cookies/local storage/query string or hash, but we don't want to interfere with frameworks.
This is mainly a placeholder for the scope of v0.0.3 of Hotlight.
Offer a way to optionally show a preview of an action to the right, similar to spotlight preview.
It should render html, perhaps through a template? Need to figure out how that would work through a react wrapper. Perhaps it could take a render function, that's specific for each wrapper?
Any action can have the hotkeys
attribute. If present, the action indicates the hot keys right next to the title
or at least in the result list. The end user can they press those hot keys to trigger that action.
Need I say more? ๐
If an action has a trigger and a sub action (under the subActions
property, or a separate action refering to the action through the parentAction
property), you can choose to trigger with enter, or tab into to use the sub actions.
The UI should clearly state this, both by ... if there are sub actions and through text helpers below the input.
Each action can be tagged with a category, making the result list grouped by categories.
Example:
In a crm, there's contacts, organisations and deals. Actions returned from one or multiple sources are individually or per source tagged with a category.
Improves the UX in terms of easier logical differentiation of results.
Make the modal behave nicely in all screen sizes.
Try utilizing a11y linters?
A way to easily hook into a local router, lets take react router as an example.
When that is configured, hotlight looks at what the trigger is returning and passes it to this function that then determines if it should route or use something like location.href.
It takes a url as the first and only argument.
const onBeforeRoute ? = (url) => url.includes("hotlight.dev") ? Router.push(url) : location.href= url;
hotlight.configure({ onBeforeRoute });
Need better naming...
(Typing on a phone)
Enable an action to "request" arguments from the users.
const name = await arg("Your name");
// with options
const orgType = arg("Type of Organisation", { options: [{ label: "Large", value: "lg" }, { label: "small", value: "indie" }], strict: false, prefilled: "small" })
// disabling strict enables user to type anything
Since state and rendering is kind of messy, I'd like to see how fast you could port the core package to svelte.
https://www.thisdot.co/blog/web-components-with-svelte
Compare bundle size and make sure you're able to use the built web component like a normal one.
Public data should be included in the cloud offering, such as site search or documentation search.
However, for private data we can offer an easy to setup search engine that can take care of indexing and search to offload applications.
Add keyboard listener so that if "F" is pressed while not in an input element and this is configured, all elements with data-hl-shortcut="x" will be displayed like the vim browser extension.
Map those keys to commands in hotlight.
The user can type F - look at the screen and type the command that it displays "e" for edit for instance. On the contact view it's the same as "edit contact" action, except we already know what contact to edit, since that's in the context or provided through data attributes.
Currently, actions are depending on an argument list.
What if an action would "fetch" arguments in a sequence instead, enabling you to "stay" in an action and enter multiple arguments in a row. Maybe even specify a tiny argument api?
const name = await arg("Your Name", { type: "string" });
const email = await arg("Email");
const user = await createUser(name, email);
if(user) {
route("/users/${user.id}");
}
For each feature, do a cypress test and try to automatically generate a gif from it. Voila self documented end to end tests.
Separate product?
Offer built-in custom elements for preview.
<hotlight-row>
<hotlight-label>
Name:
</hotlight-label>
</hotlight-row>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.