-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ab44421
commit e9fdd8e
Showing
47 changed files
with
3,248 additions
and
818 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
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
File renamed without changes.
File renamed without changes.
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
3 changes: 1 addition & 2 deletions
3
packages/ethiopic_input_methods/src/ET.ts → packages/ethiopic-input-methods/src/ET.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
3 changes: 1 addition & 2 deletions
3
packages/ethiopic_input_methods/src/am-ET.ts → packages/ethiopic-input-methods/src/am-ET.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
3 changes: 1 addition & 2 deletions
3
...input_methods/src/awn-ET_byn-ER_xan-ET.ts → ...input-methods/src/awn-ET_byn-ER_xan-ET.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
3 changes: 1 addition & 2 deletions
3
...ages/ethiopic_input_methods/src/bcq-ET.ts → ...ages/ethiopic-input-methods/src/bcq-ET.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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
3 changes: 1 addition & 2 deletions
3
...hiopic_input_methods/src/gez-ET_gez-ER.ts → ...hiopic-input-methods/src/gez-ET_gez-ER.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
3 changes: 1 addition & 2 deletions
3
...ages/ethiopic_input_methods/src/har-ET.ts → ...ages/ethiopic-input-methods/src/har-ET.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
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 1 addition & 2 deletions
3
...ethods/src/mym-ET_muz-ET_suq-ET_mdx-ET.ts → ...ethods/src/mym-ET_muz-ET_suq-ET_mdx-ET.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
3 changes: 1 addition & 2 deletions
3
...ages/ethiopic_input_methods/src/sgw-ET.ts → ...ages/ethiopic-input-methods/src/sgw-ET.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
3 changes: 1 addition & 2 deletions
3
packages/ethiopic_input_methods/src/ti-ER.ts → packages/ethiopic-input-methods/src/ti-ER.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
3 changes: 1 addition & 2 deletions
3
packages/ethiopic_input_methods/src/ti-ET.ts → packages/ethiopic-input-methods/src/ti-ET.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
3 changes: 1 addition & 2 deletions
3
...ages/ethiopic_input_methods/src/xst-ET.ts → ...ages/ethiopic-input-methods/src/xst-ET.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
File renamed without changes.
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,10 @@ | ||
# @keywrite/web | ||
|
||
## 0.1.1 | ||
|
||
### Patch Changes | ||
|
||
- [`bc3cc2a`](https://github.com/eyuelberga/keywrite/commit/bc3cc2ac88eae4ed543c31e62a551c7d333f8990) [#1](https://github.com/eyuelberga/keywrite/pull/1) Thanks [@eyuelberga](https://github.com/eyuelberga)! - Initial release | ||
|
||
- Updated dependencies [[`bc3cc2a`](https://github.com/eyuelberga/keywrite/commit/bc3cc2ac88eae4ed543c31e62a551c7d333f8990)]: | ||
- @keywrite/core@0.1.1 |
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,31 @@ | ||
## @keywrite/web | ||
|
||
Keywrite is a Javascript library that allows you to type non-latin scripts in any web based application using a standard keyboard. | ||
|
||
## Installation | ||
|
||
```sh | ||
$ yarn add @keywrite/web | ||
|
||
# or | ||
|
||
$ npm install @keywrite/web | ||
``` | ||
|
||
## Basic usage | ||
|
||
```javascript | ||
import { KeywriteWeb } from '@keywrite/web'; | ||
|
||
// input method definition | ||
import layout from './layout'; | ||
|
||
// add to HTMLInputElement | ||
new KeywriteWeb(document.querySelector('input')); | ||
// add to HTMLTextAreaElement | ||
new KeywriteWeb(document.querySelector('textarea')); | ||
``` | ||
|
||
## License | ||
|
||
MIT © [Eyuel Berga](https://github.com/eyuelberga) |
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,5 @@ | ||
const baseConfig = require('../../jest.config'); | ||
|
||
module.exports = { | ||
...baseConfig, | ||
}; |
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,27 @@ | ||
{ | ||
"name": "@keywrite/react", | ||
"version": "0.1.1", | ||
"private": true, | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"directory": "packages/react", | ||
"url": "https://github.com/eyuelberga/keywrite.git" | ||
}, | ||
"scripts": { | ||
"clean": "rimraf dist && rimraf tsconfig.tsbuildinfo", | ||
"prepack": "yarn build", | ||
"build": "yarn clean && tsc --build && cp \"./package.json\" ./dist/", | ||
"test": "jest --passWithNoTests", | ||
"lint": "eslint \"./src/**/*.{ts,tsx}\" --max-warnings=10" | ||
}, | ||
"dependencies": { | ||
"@keywrite/web": "^0.1.1" | ||
}, | ||
"devDependencies": { | ||
"react": "^17.0.2", | ||
"react-dom": "^17.0.2" | ||
} | ||
} |
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,2 @@ | ||
export * from './useKeywrite'; | ||
export { default } from './useKeywrite'; |
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,33 @@ | ||
import React, { useState, useRef, useEffect } from 'react'; | ||
import KeywriteWeb, { Input, InputMethod } from '@keywrite/web'; | ||
export const useKeywrite = ( | ||
inputRef: React.MutableRefObject<Input | null | undefined>, | ||
inputMethods: Record<string, InputMethod>, | ||
isOn = true, | ||
) => { | ||
const KeywriteRef = useRef<KeywriteWeb | null>(null); | ||
const [on, setOn] = useState(false); | ||
const [inputMethodList, setInputMethodList] = useState<string[]>([]); | ||
const [currentInputMethod, setCurrentInputMethod] = useState(''); | ||
const toggle = () => { | ||
if (KeywriteRef.current) { | ||
KeywriteRef.current.on = !KeywriteRef.current.on; | ||
setOn(!on); | ||
} | ||
}; | ||
const changeLayout = (newInputMethod: string) => { | ||
if (KeywriteRef.current) { | ||
KeywriteRef.current.current = newInputMethod; | ||
setCurrentInputMethod(KeywriteRef.current.current); | ||
} | ||
}; | ||
useEffect(() => { | ||
if (inputRef.current) { | ||
KeywriteRef.current = new KeywriteWeb(inputRef.current, inputMethods, isOn); | ||
setOn(KeywriteRef.current.on); | ||
setCurrentInputMethod(KeywriteRef.current.current); | ||
setInputMethodList(KeywriteRef.current.inputMethods); | ||
} | ||
}, [inputRef]); | ||
return { toggle, currentInputMethod, on, changeLayout, inputMethodList, inputRef }; | ||
}; |
Oops, something went wrong.