Skip to content

Commit

Permalink
refactor: colocate type in src/ (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
metonym committed Mar 15, 2024
1 parent dfa5718 commit 2efb1f8
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 6 deletions.
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"author": "Eric Liu (https://github.com/metonym)",
"svelte": "./src/index.js",
"main": "./src/index.js",
"types": "./types/index.d.ts",
"types": "./src/index.d.ts",
"scripts": {
"dev": "rollup -cw",
"test": "svelte-check --workspace=test"
Expand All @@ -33,7 +33,6 @@
"combo"
],
"files": [
"src",
"types"
"src"
]
}
33 changes: 33 additions & 0 deletions src/Keydown.svelte.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import type { SvelteComponentTyped } from "svelte";

export interface KeydownProps {
/**
* Set to `true` to pause the capture of keydown events
* @default false
*/
paused?: boolean;

/**
* Set to `true` to pause keydown events when typing in an input field
* @default false
*/
pauseOnInput?: boolean;

/**
* Specify the separating key between multiple keys
* @default "-"
*/
separator?: string;
}

export default class Keydown extends SvelteComponentTyped<
KeydownProps,
{
combo: CustomEvent<string>;
key: CustomEvent<string>;
keyup: WindowEventMap["keyup"];
keydown: WindowEventMap["keydown"];
[key: string]: CustomEvent<any>;
},
{}
> {}
1 change: 1 addition & 0 deletions src/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import { default as Keydown } from "./Keydown.svelte";
4 changes: 1 addition & 3 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
import Keydown from "./Keydown.svelte";

export default Keydown;
import { default as Keydown } from "./Keydown.svelte";

0 comments on commit 2efb1f8

Please sign in to comment.