Welcome to the uSEQ Perform codebase! This document provides an extensive tour of the codebase structure and functionality to help you understand how the application works and how to extend it.
uSEQ Perform is a web-based code editor specifically designed for live coding and interacting with hardware and virtual uSEQs. It is written in JavaScript and is based on the CodeMirror 6 editor framework, but it also leverages the ClojureScript-based clojure-mode
extension (by NextJournal) for CodeMirror, since ModuLisp is designed to be very similar to Clojure syntactically. Its functionality includes interactive code evaluation, serial communication with hardware devices, a set of key bindings for ease of use while performing, a built-in help mode and others.
clojure-mode
)The CodeMirror editor is the heart of the application, customized for Clojure-like syntax and live evaluation:
This module provides:
The main module initializes the application, sets up event listeners, and coordinates between components:
This module handles:
Manages communication with the uSEQ hardware device:
This module provides:
Handles saving and loading user configurations.
Manages the visibility and state of UI panels.
The UI is composed of several panels:
#lceditor
) - The main code editing area#console
) - Shows output and error messages#serialvis
) - Visualizes serial data#helppanel
) - Shows keyboard shortcuts and helpThe editor supports multiple ways to evaluate code.
These are implemented through CodeMirror’s keymap system in editorConfig.mjs.
Themes can be switched through the UI or programmatically.
Add your theme to the themes array in editorConfig.mjs.
Extend the serial communication protocol in serialComms.mjs.
createEditorExtensions()
in editorConfig.mjsThe editor is built on CodeMirror’s extension system. Extensions are objects that add or modify editor behavior.
CodeMirror uses view plugins to modify the editor behavior.
The application supports URL parameters for configuration:
nosave
: Disables local storage savinggist=<id>
: Loads code from a GitHub Gistnpm run watch
to automatically rebuild on changesnpm run dev
to start the server and watch for changesModify the editorBaseTheme
in editorConfig.mjs to change base styling.
Use the serial visualization panel to monitor data exchange with the device.
This codebase follows a modular structure with clear separation of concerns. The main components interact through exported functions and events. To understand more about a specific part, start with the corresponding module and follow the imports/exports to see how it integrates with the rest of the application.
For more information on the libraries used, refer to their documentation:
Happy coding!