tw5-typed 0.4.3 → 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "description": "Types for tiddlywiki",
3
3
  "license": "MIT",
4
4
  "name": "tw5-typed",
5
- "version": "0.4.3",
5
+ "version": "0.4.4",
6
6
  "url": "https://github.com/tiddly-gittly/tw5-typed",
7
7
  "homepage": "https://github.com/tiddly-gittly/tw5-typed",
8
8
  "bugs": {
package/src/core.d.ts CHANGED
@@ -21,6 +21,12 @@ declare module 'tiddlywiki' {
21
21
  getString(key: string, options: { variables: { title: string } }): string;
22
22
  }
23
23
 
24
+ export interface IMacro {
25
+ name: string;
26
+ params: Array[];
27
+ run: Function;
28
+ }
29
+
24
30
  export type IWikiInfo = Record<string, unknown>;
25
31
 
26
32
  export interface ITiddlyWiki {
@@ -50,6 +56,8 @@ declare module 'tiddlywiki' {
50
56
  passwordPrompt: PasswordPrompt;
51
57
  packageInfo: Record<string, unknown>;
52
58
  modal: IModal;
59
+ keyboardManager: KeyboardManager;
60
+ macros: Record<string, IMacro>;
53
61
 
54
62
  /**
55
63
  * Check for this window being the source of the drag. If true, some drop target widget will stop responding to the drop event, so you can handle drop event in your own widget.
@@ -7,6 +7,7 @@
7
7
  /// <reference path="parsers/index.d.ts" />
8
8
  /// <reference path="syncer/syncAdaptor.d.ts" />
9
9
  /// <reference path="syncer/syncer.d.ts" />
10
+ /// <reference path="keyboard.d.ts" />
10
11
 
11
12
  declare module 'tiddlywiki' {
12
13
  export interface ITWModuleExports {
@@ -0,0 +1,49 @@
1
+ declare module 'tiddlywiki' {
2
+ // 定义键盘事件信息的接口
3
+ export interface KeyInfo {
4
+ keyCode: number;
5
+ shiftKey: boolean;
6
+ altKey: boolean;
7
+ ctrlKey: boolean;
8
+ metaKey: boolean;
9
+ }
10
+
11
+ // 定义键盘管理器类的接口
12
+ export interface KeyboardManager {
13
+ namedKeys: Record<string, number>;
14
+ keyNames: string[];
15
+ metaKeyName: string;
16
+ shortcutKeysList: string[];
17
+ shortcutActionList: string[];
18
+ shortcutParsedList: (KeyInfo[] | undefined)[];
19
+ shortcutPriorityList: boolean[];
20
+ lookupNames: string[];
21
+ getModifierKeys: () => number[];
22
+ parseKeyDescriptor: (
23
+ keyDescriptor: string,
24
+ options?: { keyDescriptor?: string },
25
+ ) => KeyInfo | null;
26
+ parseKeyDescriptors: (
27
+ keyDescriptors: string[] | string,
28
+ options?: { stack?: string[]; wiki?: any },
29
+ ) => KeyInfo[];
30
+ getPrintableShortcuts: (keyInfoArray: KeyInfo[]) => string[];
31
+ checkKeyDescriptor: (event: any, keyInfo: KeyInfo) => boolean;
32
+ checkKeyDescriptors: (event: any, keyInfoArray: KeyInfo[]) => boolean;
33
+ getMatchingKeyDescriptor: (
34
+ event: any,
35
+ keyInfoArray: KeyInfo[],
36
+ ) => KeyInfo | null;
37
+ getEventModifierKeyDescriptor: (event: any) => string;
38
+ getShortcutTiddlerList: () => string[];
39
+ updateShortcutLists: (tiddlerList: string[]) => void;
40
+ handleKeydownEvent: (
41
+ event: any,
42
+ options?: { onlyPriority?: boolean },
43
+ ) => boolean;
44
+ detectNewShortcuts: (
45
+ changedTiddlers: Record<string, any>,
46
+ ) => boolean | string[];
47
+ handleShortcutChanges: (changedTiddlers: Record<string, any>) => void;
48
+ }
49
+ }
@@ -0,0 +1,16 @@
1
+ declare module 'tiddlywiki' {
2
+ export class EditWidget extends Widget {
3
+ editTitle: string;
4
+ editField: string;
5
+ editIndex: string;
6
+ editClass: string;
7
+ editPlaceholder: string;
8
+ editTabIndex: string;
9
+ editFocus: string;
10
+ editCancelPopups: string;
11
+ editInputActions: string;
12
+ editRefreshTitle: string;
13
+ editAutoComplete: string;
14
+ editorType: string;
15
+ }
16
+ }
@@ -1,4 +1,5 @@
1
1
  /// <reference path="./navigator.d.ts" />
2
+ /// <reference path="./edit.d.ts" />
2
3
 
3
4
  declare module 'tiddlywiki' {
4
5
  /**
@@ -11,6 +11,7 @@ declare module 'tiddlywiki' {
11
11
  readonly text: string;
12
12
  readonly title: string;
13
13
  readonly type: string;
14
+ readonly 'color-scheme': 'dark' | 'light';
14
15
  }
15
16
 
16
17
  export class Tiddler {