-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: show bigrams on the virtual keyboard
- Loading branch information
Showing
11 changed files
with
463 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+137 Bytes
(120%)
packages/keybr-keyboard-ui/lib/HeatmapLayer.test.tsx.snap
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
packages/keybr-keyboard-ui/lib/TransitionsLayer.module.less
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#marker { | ||
/* Name only. */ | ||
} | ||
|
||
.arrowPath { | ||
fill: none; | ||
stroke: #333; | ||
stroke-width: 1px; | ||
} | ||
|
||
.arrowMarker { | ||
fill: #333; | ||
stroke: none; | ||
} |
3 changes: 3 additions & 0 deletions
3
packages/keybr-keyboard-ui/lib/TransitionsLayer.module.less.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const marker: string; | ||
export const arrowPath: string; | ||
export const arrowMarker: string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { KeyboardContext, Layout, loadKeyboard, Ngram2 } from "@keybr/keyboard"; | ||
import test from "ava"; | ||
import TestRenderer from "react-test-renderer"; | ||
import { TransitionsLayer } from "./TransitionsLayer.tsx"; | ||
|
||
test("empty", (t) => { | ||
const keyboard = loadKeyboard(Layout.EN_US); | ||
const ngram = new Ngram2([/* a */ 0x0061, /* b */ 0x0062, /* c */ 0x0063]); | ||
|
||
const renderer = TestRenderer.create( | ||
<KeyboardContext.Provider value={keyboard}> | ||
<TransitionsLayer ngram={ngram} /> | ||
</KeyboardContext.Provider>, | ||
); | ||
|
||
t.snapshot(renderer.toJSON()); | ||
}); | ||
|
||
test("equal counts", (t) => { | ||
const keyboard = loadKeyboard(Layout.EN_US); | ||
const ngram = new Ngram2([/* a */ 0x0061, /* b */ 0x0062, /* c */ 0x0063]); | ||
ngram.set(/* a */ 0x0061, /* b */ 0x0062, 1); | ||
ngram.set(/* b */ 0x0062, /* c */ 0x0063, 1); | ||
|
||
const renderer = TestRenderer.create( | ||
<KeyboardContext.Provider value={keyboard}> | ||
<TransitionsLayer ngram={ngram} /> | ||
</KeyboardContext.Provider>, | ||
); | ||
|
||
t.snapshot(renderer.toJSON()); | ||
}); | ||
|
||
test("different counts", (t) => { | ||
const keyboard = loadKeyboard(Layout.EN_US); | ||
const ngram = new Ngram2([/* a */ 0x0061, /* b */ 0x0062, /* c */ 0x0063]); | ||
ngram.set(/* a */ 0x0061, /* b */ 0x0062, 1); | ||
ngram.set(/* b */ 0x0062, /* c */ 0x0063, 2); | ||
|
||
const renderer = TestRenderer.create( | ||
<KeyboardContext.Provider value={keyboard}> | ||
<TransitionsLayer ngram={ngram} /> | ||
</KeyboardContext.Provider>, | ||
); | ||
|
||
t.snapshot(renderer.toJSON()); | ||
}); | ||
|
||
test("self arrow", (t) => { | ||
const keyboard = loadKeyboard(Layout.EN_US); | ||
const ngram = new Ngram2([/* a */ 0x0061, /* b */ 0x0062, /* c */ 0x0063]); | ||
ngram.set(/* a */ 0x0061, /* a */ 0x0061, 1); | ||
|
||
const renderer = TestRenderer.create( | ||
<KeyboardContext.Provider value={keyboard}> | ||
<TransitionsLayer ngram={ngram} /> | ||
</KeyboardContext.Provider>, | ||
); | ||
|
||
t.snapshot(renderer.toJSON()); | ||
}); |
Oops, something went wrong.