Skip to content

Commit df873aa

Browse files
committed
seeboard v0.0.1
1 parent 2e52347 commit df873aa

30 files changed

+15589
-0
lines changed

.babelrc

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"presets": [
3+
["env", {
4+
"targets": {
5+
"node": "current"
6+
}
7+
}]
8+
]
9+
}

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
build
3+
data/words.json
4+
.DS_Store
5+
.gh-pages

README.md

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# seeboard
2+
3+
A visual tool to practise touch typing.
4+
5+
![Seeboard 0.0.1](doc/seeboard_001.gif)
6+
7+
Given a random text for you to type, highlights the current target key and the keys you type, so that if you miss the target you can see how far you are and adjust without looking at the keyboard.
8+
9+
It doesn't show symbols on keys intentionally, to help you remember their position.
10+
11+
Colors suggest the finger to use:
12+
13+
- green -> index
14+
- cyan -> middle
15+
- gold -> ring
16+
- pink -> pinky (obviously :)
17+
- brown -> thumb
18+
19+
## Usage
20+
21+
- Press `Enter` when you have completed the text,
22+
- Press `PageUp` or `PageDown` to update the text and restart,
23+
24+
It currently shows the [Keyboard.io](https://shop.keyboard.io/) with QWERTY layout.
25+
26+
27+
## Personalization
28+
29+
To configure your own layout:
30+
31+
- run `npm run dev`
32+
- open [localhost:3000](http://localhost:3000)
33+
- modify `src/app/components/Keyboardio/keyToChar.json`
34+
- the page will refresh automatically after a new build.
35+
36+
37+
## Contribute!
38+
39+
At the moment only meta keys and letters are working, no punctuation or other symbols.
40+
You can help by opening issues or PRs to help completing this layout, sending new layouts (PRs, gists, pastebins, whatever it works is OK) or even just pointing me to new keyboards drawings, I can take care of turning them into Svelte components if you don't know how to do so.
41+
We'll add some keyboard and/or layout selector in that case :)
42+
43+
Thanks!

assets/drawings/keyboardio-blank.svg

+1,290
Loading

assets/drawings/keyboardio-vector-new.svg

+1,531
Loading

assets/drawings/keyboardio-vector-old.svg

+716
Loading

assets/drawings/sources.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
- https://community.keyboard.io/t/blank-svg-template/226
2+
- keyboardio-blank.svg
3+
4+
- https://community.keyboard.io/t/runic-keycap-layout/14/9
5+
- http://arleym.com/keyboardio/
6+
- keyboardio-vector-old.svg
7+
- keyboardio-vector-new.svg

doc/seeboard_001.gif

1.37 MB
Loading

doc/seeboard_001.png

750 KB
Loading

gulp/build.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import gulp from "gulp";
2+
3+
gulp.task("build", gulp.parallel(
4+
"copy.html",
5+
gulp.series(
6+
"data.words",
7+
"rollup"
8+
)
9+
));

gulp/data.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import fs from "fs";
2+
3+
import gulp from "gulp";
4+
5+
import {DATA_PATH} from "./index";
6+
7+
gulp.task("data.words", done => {
8+
const wordsTxt = fs.readFileSync("node_modules/word-list/words.txt", "utf-8");
9+
const wordsJson = wordsTxt.split("\n");
10+
fs.writeFileSync(`${DATA_PATH}/words.json`, JSON.stringify(wordsJson, null, 2));
11+
12+
done();
13+
});

gulp/default.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import gulp from "gulp";
2+
3+
gulp.task("default", gulp.series(
4+
"build",
5+
"serve",
6+
gulp.parallel(
7+
"watch.html",
8+
"watch.src"
9+
)
10+
));

gulp/deploy.js

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import gulp from "gulp";
2+
import ghPages from "gh-pages";
3+
4+
import options from "./options";
5+
6+
gulp.task("publish", done => {
7+
let opts = {
8+
clone: ".gh-pages",
9+
push: options.push
10+
};
11+
12+
if (options.m) {
13+
opts.message = options.m
14+
};
15+
16+
ghPages.publish("build", opts, done);
17+
});
18+
19+
gulp.task("deploy", gulp.series(
20+
"build",
21+
"publish"
22+
));

gulp/html.js

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import gulp from "gulp";
2+
3+
import {BUILD_PATH} from "./index";
4+
5+
const INDEX_HTML_PATH = "src/app/index.html";
6+
7+
gulp.task("copy.html", done => {
8+
gulp.src(INDEX_HTML_PATH)
9+
.pipe(gulp.dest(BUILD_PATH));
10+
11+
done();
12+
});
13+
14+
gulp.task("watch.html", done => {
15+
gulp.watch(INDEX_HTML_PATH, gulp.task("copy.html"));
16+
17+
done();
18+
});

gulp/index.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import "./data";
2+
import "./html";
3+
import "./rollup";
4+
import "./build";
5+
import "./serve";
6+
import "./default";
7+
import "./deploy";
8+
9+
export const SRC_PATH = "src";
10+
export const BUILD_PATH = "build";
11+
export const DATA_PATH = "data";

gulp/options.js

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import parseArgs from "minimist";
2+
3+
/*
4+
npm run dev -- --option1 --option2
5+
npm run deploy -- -m "deploy message"
6+
*/
7+
8+
const options = parseArgs(process.argv.slice(2), {
9+
string: [
10+
"m", // npm run deploy -- -m "deploy message"
11+
],
12+
boolean: [
13+
"production", // build
14+
"push", // deploy
15+
],
16+
default: {
17+
production: false,
18+
push: false
19+
}
20+
});
21+
22+
console.log("options", options);
23+
24+
export default options;

gulp/rollup.js

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import path from "path";
2+
3+
import gulp from "gulp";
4+
import {rollup} from 'rollup';
5+
import alias from "rollup-plugin-alias";
6+
import json from "rollup-plugin-json";
7+
import svelte from "rollup-plugin-svelte";
8+
import resolve from "rollup-plugin-node-resolve";
9+
import commonjs from "rollup-plugin-commonjs";
10+
import buble from "rollup-plugin-buble";
11+
import {terser} from "rollup-plugin-terser";
12+
13+
import pkg from "../package.json";
14+
15+
import {makeResolveAliases} from "../src/utils/buildUtils";
16+
17+
import {SRC_PATH, BUILD_PATH} from "./index";
18+
import options from "./options";
19+
20+
const isProductionBuild = options.production;
21+
const resolveAliases = makeResolveAliases(path.resolve(__dirname, "../"));
22+
23+
const bundleOpts = {
24+
input: "src/app/main.js",
25+
plugins: [
26+
alias(resolveAliases({
27+
"@utils": "src/utils",
28+
"@data": "data"
29+
})),
30+
resolve(),
31+
commonjs(),
32+
json(),
33+
svelte({
34+
skipIntroByDefault: true,
35+
nestedTransitions: true,
36+
dev: !isProductionBuild,
37+
38+
// bundle all components CSS into a single file
39+
css: css => {
40+
css.write(`${BUILD_PATH}/bundle.css`, !isProductionBuild);
41+
}
42+
}),
43+
44+
isProductionBuild && buble(),
45+
isProductionBuild && terser()
46+
],
47+
cache: true
48+
};
49+
50+
const outputOpts = {
51+
file: "build/bundle.js",
52+
format: "iife",
53+
name: pkg.name,
54+
sourcemap: !isProductionBuild,
55+
};
56+
57+
gulp.task("rollup", async function (done) {
58+
const bundle = await rollup(bundleOpts);
59+
await bundle.write(outputOpts);
60+
61+
done();
62+
});
63+
64+
gulp.task("watch.src", done => {
65+
gulp.watch(SRC_PATH, gulp.task("rollup"));
66+
67+
done();
68+
});

gulp/serve.js

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import gulp from "gulp";
2+
import BrowserSync from "browser-sync";
3+
4+
import pkg from "../package.json";
5+
6+
const browserSync = BrowserSync.create();
7+
8+
gulp.task("serve", done => {
9+
browserSync.init({
10+
server: {
11+
baseDir: "./build",
12+
},
13+
port: 3000,
14+
open: false,
15+
reloadOnRestart: true,
16+
notify: false,
17+
ghostMode: false,
18+
19+
// watch & inject
20+
watch: true,
21+
files: [
22+
"build/bundle.css",
23+
"build/bundle.js",
24+
"build/index.html",
25+
],
26+
ignore: [
27+
"build/bundle.css.map",
28+
"build/bundle.js.map",
29+
],
30+
31+
logPrefix: `${pkg.name}`
32+
});
33+
34+
done();
35+
});

gulpfile.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
require("babel-core/register", { ignore: false });
2+
require("babel-polyfill");
3+
require("./gulp");

0 commit comments

Comments
 (0)