Skip to content

Commit

Permalink
Expose sequence tools
Browse files Browse the repository at this point in the history
  • Loading branch information
iansan5653 authored Oct 9, 2023
1 parent 425fa88 commit b293e46
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import SequenceTracker from './sequence'
import {eventToHotkey} from './hotkey'

export * from './hotkey'
export * from './sequence'

const hotkeyRadixTrie = new RadixTrie<HTMLElement>()
const elementsLeaves = new WeakMap<HTMLElement, Array<Leaf<HTMLElement>>>()
Expand Down
6 changes: 3 additions & 3 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {normalizeHotkey} from './hotkey'
import {NormalizedHotkeyString, normalizeHotkey} from './hotkey'
import {SEQUENCE_DELIMITER} from './sequence'

export function isFormField(element: Node): boolean {
Expand All @@ -21,7 +21,7 @@ export function isFormField(element: Node): boolean {
)
}

export function fireDeterminedAction(el: HTMLElement, path: readonly string[]): void {
export function fireDeterminedAction(el: HTMLElement, path: readonly NormalizedHotkeyString[]): void {
const delegateEvent = new CustomEvent('hotkey-fire', {cancelable: true, detail: {path}})
const cancelled = !el.dispatchEvent(delegateEvent)
if (cancelled) return
Expand All @@ -32,7 +32,7 @@ export function fireDeterminedAction(el: HTMLElement, path: readonly string[]):
}
}

export function expandHotkeyToEdges(hotkey: string): string[][] {
export function expandHotkeyToEdges(hotkey: string): NormalizedHotkeyString[][] {
// NOTE: we can't just split by comma, since comma is a valid hotkey character!
const output = []
let acc = ['']
Expand Down

0 comments on commit b293e46

Please sign in to comment.