Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.1.0 #207

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .babelrc

This file was deleted.

19 changes: 0 additions & 19 deletions .circleci/config.yml

This file was deleted.

1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/.parcel-cache
14 changes: 0 additions & 14 deletions .flowconfig

This file was deleted.

24 changes: 10 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,10 @@

name: Node.js CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
on: [push]

jobs:
build:

runs-on: ubuntu-latest

strategy:
Expand All @@ -20,11 +15,12 @@ jobs:
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm run build --if-present
- run: npm test:ci
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- run: npm install
- run: npm run build --if-present
- run: npm test:ci --if-present
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
index.js
index.js.flow
!src/index.js
!src/index.tsx
!src/index.test.tsx
node_modules
9 changes: 7 additions & 2 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
src/
.circleci/
.setup.js
.parcel-cache/
node_modules/
src/
.gitignore
.parcelrc
.swcrc
tsconfig.json
Binary file added .parcel-cache/0a5d2efaab39efb7
Binary file not shown.
Binary file added .parcel-cache/2578d21b8f037202
Binary file not shown.
2 changes: 2 additions & 0 deletions .parcel-cache/5c05939945b41730.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
14558653
1698252843455622000
Binary file added .parcel-cache/6d8dafd0bfdcb4a7
Binary file not shown.
Binary file added .parcel-cache/ca07049f067fbcc9
Binary file not shown.
Binary file added .parcel-cache/data.mdb
Binary file not shown.
Binary file added .parcel-cache/lock.mdb
Binary file not shown.
6 changes: 6 additions & 0 deletions .parcelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "@parcel/config-default",
"validators": {
"*.{ts,tsx}": ["@parcel/validator-typescript"]
}
}
1 change: 0 additions & 1 deletion .setup.js

This file was deleted.

8 changes: 8 additions & 0 deletions .swcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"jsc": {
"parser": {
"syntax": "typescript",
"tsx": true
}
}
}
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ Trigger a callback function on anything with a sequence of key presses.

```bash
# requires react@>=16
yarn add react-konamikey
pnpm install react-konamikey
```

## Usage

```jsx
import * as React from 'react'
import Konami from 'react-konamikey'
// const Konami = require('react-konamikey').default
import * as React from 'react';
import { Konami } from 'react-konamikey';
// const Konami = require('react-konamikey');
```

### attach to an element (using `refFn`)
Expand Down Expand Up @@ -64,7 +65,6 @@ Type: _Array [required]_

An array of strings representing key names.


## License

MIT
52 changes: 52 additions & 0 deletions dist/main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/main.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions dist/module.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/module.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions dist/types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export default function Konami({ payload, sequence, element, children, }: {
payload?: (() => void) | undefined;
sequence: any;
element: any;
children?: null | undefined;
}): any;
export default Konami;

//# sourceMappingURL=types.d.ts.map
1 change: 1 addition & 0 deletions dist/types.d.ts.map
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"mappings":"AAEA,wBAAgB,MAAM,CAAC,EACrB,OAAkB,EAClB,QAAQ,EACR,OAAO,EACP,QAAe,GAChB;;;;;CAAA,OA8CA;AAED,eAAe,MAAM,CAAC","sources":["src/src/index.ts","src/index.ts"],"sourcesContent":[null,"import React, { useEffect, useRef } from \"react\";\n\nexport function Konami({\n payload = () => {},\n sequence,\n element,\n children = null,\n}) {\n const pressed = useRef(0);\n\n const onkeydown = (evt) => {\n evt.key === sequence[pressed.current] ||\n evt.key.substr(5).toLowerCase() === sequence[pressed.current] // ArrowXXXX\n ? (pressed.current += 1)\n : (pressed.current = 0);\n if (pressed.current === sequence.length) {\n payload();\n pressed.current = 0;\n }\n };\n\n const listen = () => {\n if (element && element.addEventListener) {\n element.addEventListener(\"keydown\", onkeydown);\n }\n };\n\n const unlisten = () => {\n if (element && element.removeEventListener) {\n element.removeEventListener(\"keydown\", onkeydown);\n }\n };\n\n useEffect(() => {\n if (!(element instanceof Function)) {\n element = element;\n }\n listen();\n\n return () => {\n unlisten();\n };\n }, [element]);\n\n if (element instanceof Function) {\n return element({\n refFn: (ref) => {\n element = ref;\n },\n });\n }\n\n return children;\n}\n\nexport default Konami;\n"],"names":[],"version":3,"file":"types.d.ts.map"}
90 changes: 0 additions & 90 deletions flow-typed/npm/@babel/cli_vx.x.x.js

This file was deleted.

Loading
Loading