[PR #257] Split panel into ES modules #263

Open
opened 2026-10-22 05:08:25 +00:00 by roman · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/safijari/openpuck/pull/257
Author: @nabaxo
Created: 8/27/2026
Status: 🔄 Open

Base: main ← Head: refactor/panel-es-modules


📝 Commits (1)

  • de88a59 Split monolithic panel script into ES modules

📊 Changes

16 files changed (+1798 additions, -1907 deletions)

View changed files

📝 docs/index.html (+1 -1907)
➕ docs/js/app.js (+259 -0)
➕ docs/js/backup.js (+128 -0)
➕ docs/js/capture.js (+72 -0)
➕ docs/js/dongle.js (+52 -0)
➕ docs/js/firmware.js (+405 -0)
➕ docs/js/flight.js (+66 -0)
➕ docs/js/hang.js (+24 -0)
➕ docs/js/lizard.js (+180 -0)
➕ docs/js/protocol.js (+169 -0)
➕ docs/js/slots.js (+42 -0)
➕ docs/js/status.js (+223 -0)
➕ docs/js/trail.js (+17 -0)
➕ docs/js/types.js (+91 -0)
➕ docs/js/util.js (+37 -0)
➕ docs/js/wedge.js (+32 -0)

📄 Description

I needed to use my tokens on something, and the page was a mess, the clanker will explain why this is better and more maintainable.

Summary

  • Split the 1905-line inline <script> block in docs/index.html into 15 browser-native ES modules (docs/js/*)
  • Entry point: <script type="module" src="js/app.js"> — no build step, no bundler
  • Circular dependencies avoided via callback registration patterns (setHandlers, setStatusHandlers, setLizardLoader) instead of direct cross-imports
  • Zero behavior change — every event handler, USB command, and UI update preserved verbatim

Module breakdown

Module Responsibility
util.js $, log, escHtml, fmtDur, fmtSlider, setSlider, betaPopup
trail.js Loop-state trail (localStorage)
hang.js Hang/reset log
wedge.js Live wedge reporter + heartbeat watchdog
slots.js Per-controller slot tabs
types.js Per-type config UI (back paddles, QAM, pad/stick, etc.)
lizard.js Lizard button map transfers + UI
protocol.js WebUSB device state, connect/send/poll
status.js Status blob parser + UI updater
dongle.js ReversePuck paired-pucks UI
capture.js Raw capture drain
flight.js Flight trail loader
backup.js Export/import backup
firmware.js UF2 parsing, firmware update flow, releases, version UI
app.js Entry point — wires cross-module callbacks + all event handlers

Test plan

  • Page loads with no console errors (Chrome/Edge)
  • Connect puck — status blob populates all UI fields
  • Change settings (sliders, chord dropdowns, mode buttons) — confirm they persist
  • Export/import backup round-trips correctly
  • Firmware update tab loads releases
  • WebUSB not supported message shows in Firefox/Safari

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/safijari/openpuck/pull/257 **Author:** [@nabaxo](https://github.com/nabaxo) **Created:** 8/27/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `refactor/panel-es-modules` --- ### 📝 Commits (1) - [`de88a59`](https://github.com/safijari/openpuck/commit/de88a59360116c0b822fecfa9091f56487d4a687) Split monolithic panel script into ES modules ### 📊 Changes **16 files changed** (+1798 additions, -1907 deletions) <details> <summary>View changed files</summary> 📝 `docs/index.html` (+1 -1907) ➕ `docs/js/app.js` (+259 -0) ➕ `docs/js/backup.js` (+128 -0) ➕ `docs/js/capture.js` (+72 -0) ➕ `docs/js/dongle.js` (+52 -0) ➕ `docs/js/firmware.js` (+405 -0) ➕ `docs/js/flight.js` (+66 -0) ➕ `docs/js/hang.js` (+24 -0) ➕ `docs/js/lizard.js` (+180 -0) ➕ `docs/js/protocol.js` (+169 -0) ➕ `docs/js/slots.js` (+42 -0) ➕ `docs/js/status.js` (+223 -0) ➕ `docs/js/trail.js` (+17 -0) ➕ `docs/js/types.js` (+91 -0) ➕ `docs/js/util.js` (+37 -0) ➕ `docs/js/wedge.js` (+32 -0) </details> ### 📄 Description I needed to use my tokens on something, and the page was a mess, the clanker will explain why this is better and more maintainable. ## Summary - Split the 1905-line inline `<script>` block in `docs/index.html` into 15 browser-native ES modules (`docs/js/*`) - Entry point: `<script type="module" src="js/app.js">` — no build step, no bundler - Circular dependencies avoided via callback registration patterns (`setHandlers`, `setStatusHandlers`, `setLizardLoader`) instead of direct cross-imports - Zero behavior change — every event handler, USB command, and UI update preserved verbatim ### Module breakdown | Module | Responsibility | |--------|---------------| | `util.js` | `$`, `log`, `escHtml`, `fmtDur`, `fmtSlider`, `setSlider`, `betaPopup` | | `trail.js` | Loop-state trail (localStorage) | | `hang.js` | Hang/reset log | | `wedge.js` | Live wedge reporter + heartbeat watchdog | | `slots.js` | Per-controller slot tabs | | `types.js` | Per-type config UI (back paddles, QAM, pad/stick, etc.) | | `lizard.js` | Lizard button map transfers + UI | | `protocol.js` | WebUSB device state, connect/send/poll | | `status.js` | Status blob parser + UI updater | | `dongle.js` | ReversePuck paired-pucks UI | | `capture.js` | Raw capture drain | | `flight.js` | Flight trail loader | | `backup.js` | Export/import backup | | `firmware.js` | UF2 parsing, firmware update flow, releases, version UI | | `app.js` | Entry point — wires cross-module callbacks + all event handlers | ## Test plan - [ ] Page loads with no console errors (Chrome/Edge) - [ ] Connect puck — status blob populates all UI fields - [ ] Change settings (sliders, chord dropdowns, mode buttons) — confirm they persist - [ ] Export/import backup round-trips correctly - [ ] Firmware update tab loads releases - [ ] WebUSB not supported message shows in Firefox/Safari 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
pull-request
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
safijari/openpuck#263
No description provided.