Skip to content

Commit 8c45682

Browse files
committed
Refactor type definitions for better readability and consistency
1 parent bcbf8d8 commit 8c45682

File tree

4 files changed

+196
-196
lines changed

4 files changed

+196
-196
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"description": "Command dialog and keyboard shortcuts palette for web apps",
77
"version": "2.1.1",
88
"type": "module",
9-
"module": "dist/cmd-dialog.js",
10-
"main": "dist/cmd-dialog.js",
9+
"module": "./dist/cmd-dialog.js",
10+
"main": "./dist/cmd-dialog.js",
1111
"exports": {
1212
".": "./dist/cmd-dialog.js"
1313
},

types/action.d.ts

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
11
export type Action = {
2-
/**
3-
* Unique id of the action (optional)
4-
*/
5-
id?: string;
6-
/**
7-
* Title of the action
8-
*/
9-
title: string;
10-
/**
11-
* Description of the action (optional)
12-
*/
13-
description?: string;
14-
/**
15-
* Icon of the action (optional)
16-
*/
17-
img?: string;
18-
/**
19-
* Hotkey of the action (optional)
20-
* @see https://github.com/jamiebuilds/tinykeys
21-
*/
22-
hotkey?: string;
23-
/**
24-
* URL of the action (optional)
25-
*/
26-
url?: string;
27-
/**
28-
* Target of the action (optional)
29-
* default is `_self`
30-
*/
31-
target?: string;
32-
/**
33-
* Handler of the action (optional)
34-
*/
35-
onAction?: (event?: KeyboardEvent | CustomEvent) => boolean;
36-
/**
37-
* Tags of the action (optional)
38-
*/
39-
tags?: string[];
2+
/**
3+
* Unique id of the action (optional)
4+
*/
5+
id?: string;
6+
/**
7+
* Title of the action
8+
*/
9+
title: string;
10+
/**
11+
* Description of the action (optional)
12+
*/
13+
description?: string;
14+
/**
15+
* Icon of the action (optional)
16+
*/
17+
img?: string;
18+
/**
19+
* Hotkey of the action (optional)
20+
* @see https://github.com/jamiebuilds/tinykeys
21+
*/
22+
hotkey?: string;
23+
/**
24+
* URL of the action (optional)
25+
*/
26+
url?: string;
27+
/**
28+
* Target of the action (optional)
29+
* default is `_self`
30+
*/
31+
target?: string;
32+
/**
33+
* Handler of the action (optional)
34+
*/
35+
onAction?: (event?: KeyboardEvent | CustomEvent) => boolean;
36+
/**
37+
* Tags of the action (optional)
38+
*/
39+
tags?: string[];
4040
};

types/cmd-action.d.ts

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,55 @@
11
import { LitElement, type TemplateResult } from "lit";
22
import type { Action } from "./action.js";
33
export declare class CmdAction extends LitElement {
4-
/**
5-
* The styles
6-
*/
7-
static styles: import("lit").CSSResult;
8-
/**
9-
* The mode of the dialog (dark/light).
10-
*/
11-
theme: string;
12-
/**
13-
* Action object
14-
*/
15-
action: Action;
16-
/**
17-
* Is the action selected
18-
*/
19-
selected: boolean;
20-
constructor();
21-
/**
22-
* Get hotkeys
23-
* @private
24-
*/
25-
private get hotkeys();
26-
/**
27-
* Get description
28-
* @private
29-
*/
30-
private get description();
31-
/**
32-
* Get icon
33-
* @private
34-
*/
35-
private get img();
36-
/**
37-
* Scroll to show element
38-
*/
39-
ensureInView(): void;
40-
/**
41-
* Click event
42-
*/
43-
click(): void;
44-
/**
45-
* Updated
46-
* @param changedProperties
47-
*/
48-
updated(changedProperties: Map<string, unknown>): void;
49-
render(): TemplateResult<1>;
4+
/**
5+
* The styles
6+
*/
7+
static styles: import("lit").CSSResult;
8+
/**
9+
* The mode of the dialog (dark/light).
10+
*/
11+
theme: string;
12+
/**
13+
* Action object
14+
*/
15+
action: Action;
16+
/**
17+
* Is the action selected
18+
*/
19+
selected: boolean;
20+
constructor();
21+
/**
22+
* Get hotkeys
23+
* @private
24+
*/
25+
private get hotkeys();
26+
/**
27+
* Get description
28+
* @private
29+
*/
30+
private get description();
31+
/**
32+
* Get icon
33+
* @private
34+
*/
35+
private get img();
36+
/**
37+
* Scroll to show element
38+
*/
39+
ensureInView(): void;
40+
/**
41+
* Click event
42+
*/
43+
click(): void;
44+
/**
45+
* Updated
46+
* @param changedProperties
47+
*/
48+
updated(changedProperties: Map<string, unknown>): void;
49+
render(): TemplateResult<1>;
5050
}
5151
declare global {
52-
interface HTMLElementTagNameMap {
53-
"cmd-action": CmdAction;
54-
}
52+
interface HTMLElementTagNameMap {
53+
"cmd-action": CmdAction;
54+
}
5555
}

0 commit comments

Comments
 (0)