feat: add potential WPM calculation ignoring adjacent swap errors (@BhavishyaMaheshwari) #7028
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Description
Added a "Potential WPM" feature that calculates an alternate typing speed ignoring minor adjacent character swap errors (transpositions). This provides users insight into what their speed would be if they hadn't made simple typos like typing "teh" instead of "the" or "form" instead of "from".
Key Features:
Implementation Details:
isMinorSwap()utility function to detect adjacent character transpositionsFiles Modified:
frontend/src/ts/typing.ts- Added swap detectionfrontend/src/ts/stats.ts- NEW: Helper functions and state managementfrontend/src/ts/utils/swap-detection.ts- NEW: Swap detection utilityfrontend/src/ts/test/test-stats.ts- Updated WPM calculationfrontend/src/ts/controllers/input-controller.ts- Accuracy treats swaps as correctfrontend/src/ts/test/live-speed.ts- Live WPM display with potential buttonfrontend/src/ts/test/result.ts- Results screen integrationfrontend/src/ts/test/test-logic.ts- Reset counters on test startfrontend/src/ts/test/test-input.ts- Input processingfrontend/src/ts/test/test-timer.ts- Timer integrationfrontend/src/styles/test.scss- Button styling, popup, tooltipsfrontend/src/svelte/Results.svelte- Svelte component updatesfrontend/src/ts/utils/misc.ts- Utility exportfrontend/src/ts/EXAMPLE_USAGE.ts- NEW: DocumentationChecks
Screenshots
Future (potential) changes