$ show doshidak/showdex
Showdex is a browser extension for PokΓ©mon Showdown that provides a real-time damage calculator (Calcdex) and supplementary tools directly within the battle interface. It integrates deeply with Showdown's client, patching internal classes (Battle, Side, Room) to synchronize all PokΓ©mon, field conditions, and player actions as they occur. The architecture follows a dual-host pattern (legacy Backbone and modern Preact clients) with abstract bootstrappers, React/Redux for UI state, and RTK Query for fetching PokΓ©mon presets from Smogon APIs. It also includes a standalone calculator (Honkdex), a note-taking tool (Notedex), a settings dashboard (Hellodex), and a debug panel (Devdex). The codebase demonstrates strong engineering with well-structured utility modules, custom hooks, drag-and-drop layout components, internationalization (English/French), and a complex hydration/dehydration system for data persistence. While primarily an application, it incorporates significant data processing for PokΓ©mon battle mechanics (stat calculations, legacy DV conversion, preset matching).
The LLM identified 5 files worth highlighting for reuse:
Implements a custom grid sorting strategy for @dnd-kit that handles multi-dimensional reordering (row-major) with stable positioning. It can be extracted into any project needing DnD grid sorting without modification.
Provides a typed environment variable parser factory that supports boolean, integer, string, and string-array types with defaults and runtime validation. Demonstrates strong TypeScript patterns (generic type inference, exhaustive checks) and is reusable across any JavaScript/TypeScript project.
A suite of utilities for compact serialization and deserialization of complex state objects (spreads, presets, settings, Calcdex state) with versioned headers and opcode-based encoding. The pattern ensures forward/backward compatibility and can be adapted for any application needing efficient structured data persistence or export.
A fully themeable context menu component built on react-contexify, supporting nested submenus, icons, separators, disabled states, and keyboard navigation. It is decoupled from the application domain and can be reused in any React project with minimal adaptation.
Defines an abstract bootstrappable base class that standardizes the lifecycle of injecting Showdex pages into the Showdown client (classic or Preact). It provides common hooks for initialization, room creation, rendering, event listening, and teardown. This pattern can be reused for any UI overlay system that needs to integrate with a third-party application.