All Projects → oskarhane → actus

oskarhane / actus

Licence: MIT License
A monorepo for a self learning command palette driven by a final state machine implemented in XState.

Programming Languages

typescript
32286 projects
Svelte
593 projects
javascript
184084 projects - #8 most used programming language
CSS
56736 projects
Nearley
35 projects
HTML
75241 projects

Projects that are alternatives of or similar to actus

svelte-previous
A Svelte store that remembers previous values
Stars: ✭ 46 (+6.98%)
Mutual labels:  svelte
sapper-postcss-template
A template that includes Sapper for Svelte and PostCSS preprocessing with Tailwind CSS
Stars: ✭ 84 (+95.35%)
Mutual labels:  svelte
rollup-plugin-svelte-hot
Fork of official rollup-plugin-svelte with added HMR support (for both Nollup or Rollup)
Stars: ✭ 49 (+13.95%)
Mutual labels:  svelte
svelte-typescript-rollup
Svelte + Typescript + Rollup
Stars: ✭ 79 (+83.72%)
Mutual labels:  svelte
template
Elder.js template project. It is part template, part tutorial. Dive in!
Stars: ✭ 101 (+134.88%)
Mutual labels:  svelte
trembita
Model complex data transformation pipelines easily
Stars: ✭ 44 (+2.33%)
Mutual labels:  finite-state-machine
microzord
Simple and powerful Micro Frontends framework
Stars: ✭ 81 (+88.37%)
Mutual labels:  svelte
svelte-webcomponents
A ready-to-use project template to build custom elements (web components) with Svelte 3 with support and examples for web components, jest, sass, nested components with props, eslinting, stylelinting, Github actions, propagating custom events from shadow-DOM to real-DOM etc.
Stars: ✭ 22 (-48.84%)
Mutual labels:  svelte
SimpleStateMachineLibrary
📚 A simple library for realization state machines in C# code
Stars: ✭ 30 (-30.23%)
Mutual labels:  finite-state-machine
svelte-credit-card
A svelte component to render a credit card 💳
Stars: ✭ 30 (-30.23%)
Mutual labels:  svelte
svelte-google-analytics
Google Analytics component for Svelte
Stars: ✭ 41 (-4.65%)
Mutual labels:  svelte
markushatvan.com
Personal website and blog written from scratch with SvelteKit and TailwindCSS.
Stars: ✭ 82 (+90.7%)
Mutual labels:  svelte
104-ignore-not-interesting
過濾 104人力銀行 搜尋結果中你不感興趣的職缺 | Ignore jobs you are not interested in on 104
Stars: ✭ 25 (-41.86%)
Mutual labels:  svelte
citycatch
CityCatch is a variation of "Word chain" game, made on Svelte+Effector+Tailwind
Stars: ✭ 29 (-32.56%)
Mutual labels:  svelte
svelte-search
Accessible, customizable Svelte search component
Stars: ✭ 17 (-60.47%)
Mutual labels:  svelte
temporal-electronic-signature
Electronic signature demonstration built with Temporal and XState
Stars: ✭ 36 (-16.28%)
Mutual labels:  xstate
svelte-electron-boilerplate
🧬 Create a desktop app with this user-friendly Svelte boilerplate for electron
Stars: ✭ 70 (+62.79%)
Mutual labels:  svelte
svelte-interview-questions
Concepts and Questions related to Svelte - Part of official Svelte resources list
Stars: ✭ 18 (-58.14%)
Mutual labels:  svelte
svelte-algolia
Svelte plugin for keeping Algolia indices in sync with custom data fetching functions.
Stars: ✭ 17 (-60.47%)
Mutual labels:  svelte
react-gizmo
🦎 React Gizmo - UI Finite State Machine for React
Stars: ✭ 39 (-9.3%)
Mutual labels:  xstate

@actus

bar This repo holds a command palette with robust interactions and predictable behavior backed by a finite state machine. A command palette (or command bar) is a user interface that receives user input and presents the user with a list of matching commands and executes the command the user chooses.

You see this kind of UI in many application nowadays. Ctrl/cmd + k in Slack and Discord, Ctrl/cmd + p in VS Code, cmd + Space in MacOS etc.

I wanted to have as much as possible handled in a UI framework / library agnostic way, so gluing it to a React or Svelte component should be trivial.

Self learning

It's self learning in the sense that it ranks items higher the more you pick them for a certain input. To follow trends and have new commands have achance to get to the top fairly quick, it doesn't keep the execution history forever but normalizes it from time to time. See packages/core/src/exec-graph.ts for the implementation of this.

Demo

Here's a demo of the Svelte implementation of the core: https://ti99l.csb.app

States and transitions

Open / Close

The command palette behaves as most palettes do. It's able to become visible by using a hot-key, and closed with the escape key.

Command matching and ranking

While open and on user input, it waits for relevant commands and rank the matching ones in a natural order (the ranking algo can be overridden) with the best match on top.

Command list selection

With the matching command results listed, the top one is selected automatically (called auto selection). If the user would continue typing, the top one should always stay selected until the user selects one manually (with arrow keys or hover with the mouse).

If the user selects one manually (called id selection), and then continues typing, as long as the selected command is in the list it should stay selected, no matter if its position changes. When the selected result isn't available in the result list anymore (due to not matching anymore), the top result should be selected again (by position, not by id).

The user is able to step over the selection boundaries (pressing arrow down on the last result should roll over to select the top result and vice versa).

Dynamic list of commands

Commands might be added and removed at any time, and the palette should be able to handle that when opened. If a new command becomes available and it matches the current user input, it should be shown in the correct position in the result listing and should not interfere with any user selection.

Execution

The user can execute a command in two ways: Click on it or press Enter. When a command is executed, the palette should close and the user input should be emptied.

Remember non executed input

If the user types something in the command palette input but closes it without executing, the palette should remember it and populate the input once the user opens it again.

The Finite State Machine

Have a look at packages/core/src/selection-machine.ts to see the machine and its services / actions / guards implementations.

Here's a visualization of the machine: vis

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].