tw5-typed 0.4.8 → 0.5.0

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/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  TypeScript type definitions for TiddlyWiki5.
4
4
 
5
+ [Doc Site - tiddly-gittly.github.io/TW5-Typed](https://tiddly-gittly.github.io/TW5-Typed/)
6
+
5
7
  ## Usage
6
8
 
7
9
  First, install it as dev-dependency:
@@ -59,3 +61,10 @@ You can add new `*.d.ts` file to contain your types:
59
61
  ### Test in your node_modules
60
62
 
61
63
  To rapid prototype the type, just right click a type to open `.d.ts` file in the `node_modules`, and try create new file there, and copy to this repo after a success.
64
+
65
+ ### Before publish
66
+
67
+ Make sure doc build and test are passed.
68
+
69
+ 1. Doc: `pnpm run docs:generate && pnpm run docs:dev`, see `.github\workflows\deploy-docs-to-github-pages.yml`
70
+ 1. Tests: `pnpm run check`, see `.github\workflows\test.yml`
package/package.json CHANGED
@@ -1,8 +1,18 @@
1
1
  {
2
+ "name": "tw5-typed",
3
+ "version": "0.5.0",
4
+ "scripts": {
5
+ "check": "tsc --noEmit && eslint src/**/*.ts",
6
+ "docs": "docs-ts",
7
+ "docs:build": "docusaurus build",
8
+ "docs:dev": "docusaurus start",
9
+ "docs:generate": "npm run docs:generate:api && npm run docs:generate:copy",
10
+ "docs:generate:api": "rimraf docs/api && typedoc --options typedoc.json",
11
+ "docs:generate:copy": "zx scripts/copy-readme.mjs",
12
+ "prepublishOnly": "tsc --noEmit"
13
+ },
2
14
  "description": "Types for tiddlywiki",
3
15
  "license": "MIT",
4
- "name": "tw5-typed",
5
- "version": "0.4.8",
6
16
  "url": "https://github.com/tiddly-gittly/tw5-typed",
7
17
  "homepage": "https://github.com/tiddly-gittly/tw5-typed",
8
18
  "bugs": {
@@ -16,10 +26,6 @@
16
26
  "files": [
17
27
  "src/"
18
28
  ],
19
- "scripts": {
20
- "check": "tsc --noEmit && eslint src/**/*.ts",
21
- "prepublishOnly": "tsc --noEmit"
22
- },
23
29
  "husky": {
24
30
  "hooks": {
25
31
  "pre-commit": "lint-staged"
@@ -33,20 +39,31 @@
33
39
  "node --max_old_space_size=8192 ./node_modules/eslint/bin/eslint.js --fix --color --cache --quiet"
34
40
  ]
35
41
  },
42
+ "dependencies": {
43
+ "@types/codemirror": "^5.60.15",
44
+ "@types/echarts": "^4.9.22",
45
+ "@types/node": "^20.11.24"
46
+ },
36
47
  "devDependencies": {
48
+ "@docusaurus/core": "^3.1.1",
49
+ "@docusaurus/preset-classic": "^3.1.1",
50
+ "@docusaurus/types": "^3.1.1",
51
+ "@mdx-js/react": "^3.0.1",
37
52
  "@modern-js/eslint-config": "latest",
38
53
  "@modern-js/tsconfig": "latest",
54
+ "docs-ts": "^0.8.0",
39
55
  "dprint": "^0.45.0",
40
- "eslint-config-tidgi": "^1.1.5",
41
- "husky": "^8.0.2",
42
- "lint-staged": "^13.1.0",
43
- "rimraf": "^3.0.2",
44
- "tiddlywiki": "^5.2.5",
45
- "typescript": "^4.9.4"
46
- },
47
- "dependencies": {
48
- "@types/codemirror": "^5.60.6",
49
- "@types/echarts": "^4.9.16",
50
- "@types/node": "^18.11.9"
56
+ "eslint-config-tidgi": "^1.2.2",
57
+ "husky": "^9.0.11",
58
+ "lint-staged": "^15.2.2",
59
+ "prism-react-renderer": "^2.3.1",
60
+ "react": "^18.2.0",
61
+ "rimraf": "^5.0.5",
62
+ "tiddlywiki": "^5.3.3",
63
+ "type-fest": "^4.10.3",
64
+ "typedoc": "^0.25.9",
65
+ "typedoc-plugin-markdown": "^3.17.1",
66
+ "typescript": "^5.3.3",
67
+ "zx": "^7.2.3"
51
68
  }
52
69
  }
@@ -13,6 +13,7 @@ declare module 'tiddlywiki' {
13
13
  export type ITWConfig = IConfig;
14
14
 
15
15
  interface IConfig {
16
+ [configName: string]: any;
16
17
  /** Map type to file content type */
17
18
  contentTypeInfo: Record<string, IContentTypeInfo>;
18
19
  /** @default 'TIDDLYWIKI_EDITION_PATH' */
@@ -21,6 +22,7 @@ declare module 'tiddlywiki' {
21
22
  editionsPath: string;
22
23
  /** Map file extension */
23
24
  fileExtensionInfo: Record<string, IFileExtensionInfo>;
25
+ htmlUnsafeElements: string[];
24
26
  /**
25
27
  * @default '^\\/\\*\\\\(?:\\r?\\n)((?:^[^\\r\\n]*(?:\\r?\\n))+?)(^\\\\\\*\\/$(?:\\r?\\n)?)
26
28
  */
@@ -50,32 +52,29 @@ declare module 'tiddlywiki' {
50
52
  wikiThemesSubDir: string;
51
53
  /** @default './tiddlers' */
52
54
  wikiTiddlersSubDir: string;
53
- htmlUnsafeElements: string[];
54
- [configName: string]: any;
55
55
  }
56
56
 
57
57
  export interface ITiddlyWikiInfoJSON {
58
- description: string
59
- plugins: string[]
60
- themes: string[]
61
- languages: any[]
62
- build: ITiddlyWikiInfoJSONBuild
63
- config: ITiddlyWikiInfoJSONConfig
58
+ build: ITiddlyWikiInfoJSONBuild;
59
+ config: ITiddlyWikiInfoJSONConfig;
60
+ description: string;
61
+ languages: any[];
62
+ plugins: string[];
63
+ themes: string[];
64
64
  }
65
-
65
+
66
66
  export interface ITiddlyWikiInfoJSONBuild {
67
- index: string[]
68
- empty: string[]
69
- encrypted: string[]
70
- favicon: string[]
71
- readmes: string[]
72
- tw2: string[]
73
- static: string[]
74
- "external-js": string[]
67
+ empty: string[];
68
+ encrypted: string[];
69
+ 'external-js': string[];
70
+ favicon: string[];
71
+ index: string[];
72
+ readmes: string[];
73
+ static: string[];
74
+ tw2: string[];
75
75
  }
76
-
76
+
77
77
  export interface ITiddlyWikiInfoJSONConfig {
78
- "retain-original-tiddler-path": boolean
78
+ 'retain-original-tiddler-path': boolean;
79
79
  }
80
-
81
80
  }
@@ -20,11 +20,12 @@ declare module 'tiddlywiki' {
20
20
 
21
21
  export interface IBoot {
22
22
  argv: string[];
23
+ boot: (callback?: () => void) => void;
24
+ excludeRegExp: RegExp;
23
25
  /**
24
26
  * Parse any extra plugin references from `$tw.boot.argv[0]` that with `+` prefix.
25
27
  */
26
28
  extraPlugins: string[];
27
- boot: (callback?: () => void) => void;
28
29
  files: IBootFilesIndex;
29
30
  log: (logString: string) => void;
30
31
  logMessages: string[];
@@ -34,7 +35,6 @@ declare module 'tiddlywiki' {
34
35
  readBrowserTiddlers: boolean;
35
36
  trapErrors: boolean;
36
37
  };
37
- excludeRegExp: RegExp;
38
38
  /** Exist in nodejs wiki, Load the tiddlers from the wiki directory */
39
39
  wikiInfo?: ITiddlyWikiInfoJSON;
40
40
  /** Exist in nodejs wiki, absolute path of wiki root folder */
package/src/core.d.ts CHANGED
@@ -9,12 +9,12 @@
9
9
 
10
10
  declare module 'tiddlywiki' {
11
11
  export interface IPluginInfo {
12
- version: string;
13
- 'plugin-type': string;
12
+ [pluginProperty: string]: string;
14
13
  dependents: string;
15
- type: 'application/json';
14
+ 'plugin-type': string;
16
15
  text: string;
17
- [pluginProperty: string]: string;
16
+ type: 'application/json';
17
+ version: string;
18
18
  }
19
19
 
20
20
  export interface ILanguage {
@@ -23,99 +23,20 @@ declare module 'tiddlywiki' {
23
23
 
24
24
  export interface IMacro {
25
25
  name: string;
26
- params: Array[];
26
+ params: any[][];
27
+ // eslint-disable-next-line @typescript-eslint/ban-types
27
28
  run: Function;
28
29
  }
29
30
 
30
31
  export type IWikiInfo = Record<string, unknown>;
31
32
 
32
33
  export interface ITiddlyWiki {
33
- Wiki: typeof Wiki;
34
34
  Story: typeof Story;
35
+ Syncer: new() => Syncer;
35
36
  Tiddler: typeof Tiddler;
36
- syncadaptor?: SyncAdaptor;
37
- /**
38
- * Presents when we have $tw.syncadaptor
39
- */
40
- syncer?: Syncer;
41
- Syncer: { new (): Syncer };
42
-
43
- wiki: Wiki;
44
- boot: IBoot;
45
- crypto: Crypto;
46
- utils: IUtils;
47
- config: IConfig;
48
- version: string;
49
- safeMode: boolean;
50
- modules: IModules;
51
- rootWidget: Widget;
52
- notifier: Notifier;
53
- language: ILanguage;
54
- locationHash: string;
55
- fakeDocument: IFakeDocument;
56
- passwordPrompt: PasswordPrompt;
57
- packageInfo: Record<string, unknown>;
58
- modal: IModal;
59
- keyboardManager: KeyboardManager;
60
- macros: Record<string, IMacro>;
61
-
62
- /**
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.
64
- * Used by `DropZoneWidget.prototype.handleDropEvent`
65
- */
66
- dragInProgress?: boolean;
67
-
68
- /**
69
- * Global Hooks mechanism which allows plugins to modify default functionality
70
- */
71
- hooks: IHooks;
72
-
37
+ Wiki: typeof Wiki;
73
38
  addUnloadTask(task: any);
74
-
75
- /**
76
- * Convenience function for pushing a tiddler onto the preloading array.
77
- * @param fields - The fields of the tiddler to push.
78
- * @description 方便地将一个 tiddler 推入预加载数组中。
79
- */
80
- preloadTiddler(fields: Record<string, unknown>): void;
81
-
82
- /**
83
- * Convenience function for pushing an array of tiddlers onto the preloading array.
84
- * @param fieldsArray - The array of tiddlers to push.
85
- * @description 方便地将若干 tiddler 数组推入预加载数组中。
86
- */
87
- preloadTiddlerArray(fieldsArray: Array<Record<string, unknown>>): void;
88
-
89
- /** External JavaScript can populate this array before calling boot.js in order to preload tiddlers */
90
- preloadTiddlers: Record<string, Record<string, unknown>>;
91
-
92
- getLibraryItemSearchPaths(libraryPath: string, envVar?: string): string;
93
- findLibraryItem(name: string, paths: string[]): string | null;
94
- loadPluginFolder(
95
- filepath: string,
96
- excludeRegExp?: RegExp,
97
- ): IPluginInfo | null;
98
- loadPlugin(name: string, paths: string[]): void;
99
- loadPlugins(plugins: string[], libraryPath: string, envVar?: string): void;
100
- loadWikiTiddlers(
101
- wikiPath: string,
102
- options?: { parentPaths?: string; readOnly?: boolean },
103
- ): IWikiInfo;
104
- loadTiddlersNode(): void;
105
- loadTiddlersBrowser(): void;
106
- loadTiddlersFromFile(
107
- filepath: string,
108
- defaultFields?: Record<string, unknown>,
109
- ): ITiddlersInFile;
110
- loadMetadataForFile(filepath: string): ITiddlerFields | null;
111
- loadTiddlersFromPath(
112
- filepath: string,
113
- excludeRegExp?: RegExp,
114
- ): ITiddlerFields[];
115
- loadTiddlersFromSpecification(
116
- filepath: string,
117
- excludeRegExp?: RegExp,
118
- ): ITiddlerFields[];
39
+ boot: IBoot;
119
40
 
120
41
  browser: null | {
121
42
  is?: {
@@ -154,14 +75,94 @@ declare module 'tiddlywiki' {
154
75
  */
155
76
  isIE: boolean;
156
77
  };
78
+ config: IConfig;
79
+ crypto: Crypto;
80
+ /**
81
+ * 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.
82
+ * Used by `DropZoneWidget.prototype.handleDropEvent`
83
+ */
84
+ dragInProgress?: boolean;
85
+ fakeDocument: IFakeDocument;
86
+ findLibraryItem(name: string, paths: string[]): string | null;
87
+ getLibraryItemSearchPaths(libraryPath: string, environmentVariable?: string): string;
88
+ /**
89
+ * Global Hooks mechanism which allows plugins to modify default functionality
90
+ */
91
+ hooks: IHooks;
92
+ keyboardManager: KeyboardManager;
93
+ language: ILanguage;
94
+ loadMetadataForFile(filepath: string): ITiddlerFields | null;
95
+ loadPlugin(name: string, paths: string[]): void;
96
+ loadPluginFolder(
97
+ filepath: string,
98
+ excludeRegExp?: RegExp,
99
+ ): IPluginInfo | null;
100
+ loadPlugins(plugins: string[], libraryPath: string, environmentVariable?: string): void;
101
+ loadTiddlersBrowser(): void;
102
+ loadTiddlersFromFile(
103
+ filepath: string,
104
+ defaultFields?: Record<string, unknown>,
105
+ ): ITiddlersInFile;
106
+ loadTiddlersFromPath(
107
+ filepath: string,
108
+ excludeRegExp?: RegExp,
109
+ ): ITiddlerFields[];
110
+ loadTiddlersFromSpecification(
111
+ filepath: string,
112
+ excludeRegExp?: RegExp,
113
+ ): ITiddlerFields[];
114
+
115
+ loadTiddlersNode(): void;
116
+
117
+ loadWikiTiddlers(
118
+ wikiPath: string,
119
+ options?: { parentPaths?: string; readOnly?: boolean },
120
+ ): IWikiInfo;
121
+
122
+ locationHash: string;
123
+
124
+ macros: Record<string, IMacro>;
125
+
126
+ modal: IModal;
127
+
128
+ modules: IModules;
129
+
157
130
  /** NodeJS features, if tw isn't running on a NodeJS environment, the value will be `null` */
158
131
  node: null | Record<string, any>;
159
132
  /** Broswer features, if tw isn't running on a browser environment, the value will be `null` */
160
133
  nodeWebKit: null | Record<string, any>;
134
+ notifier: Notifier;
135
+ packageInfo: Record<string, unknown>;
136
+ passwordPrompt: PasswordPrompt;
161
137
  platform: {
162
138
  isLinux: boolean;
163
139
  isMac: boolean;
164
140
  isWindows: boolean;
165
141
  };
142
+ /**
143
+ * Convenience function for pushing a tiddler onto the preloading array.
144
+ * @param fields - The fields of the tiddler to push.
145
+ * @description 方便地将一个 tiddler 推入预加载数组中。
146
+ */
147
+ preloadTiddler(fields: Record<string, unknown>): void;
148
+ /**
149
+ * Convenience function for pushing an array of tiddlers onto the preloading array.
150
+ * @param fieldsArray - The array of tiddlers to push.
151
+ * @description 方便地将若干 tiddler 数组推入预加载数组中。
152
+ */
153
+ preloadTiddlerArray(fieldsArray: Array<Record<string, unknown>>): void;
154
+ /** External JavaScript can populate this array before calling boot.js in order to preload tiddlers */
155
+ preloadTiddlers: Record<string, Record<string, unknown>>;
156
+ rootWidget: Widget;
157
+ safeMode: boolean;
158
+ syncadaptor?: SyncAdaptor;
159
+
160
+ /**
161
+ * Presents when we have $tw.syncadaptor
162
+ */
163
+ syncer?: Syncer;
164
+ utils: IUtils;
165
+ version: string;
166
+ wiki: Wiki;
166
167
  }
167
168
  }
package/src/hooks.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  declare module 'tiddlywiki' {
2
2
  interface IHooks {
3
- names: Record<string, Function[]>;
4
3
  /** Add hooks to the hashmap */
5
4
  addHook(
6
5
  hookName: 'th-server-command-post-start',
@@ -12,23 +11,23 @@ declare module 'tiddlywiki' {
12
11
  );
13
12
  addHook(
14
13
  hookName: 'th-saving-tiddler',
15
- callback: (toTiddler: Tiddler, fromTiddler: Tiddler) => Tiddler | void,
14
+ callback: (toTiddler: Tiddler, fromTiddler: Tiddler) => Tiddler | undefined,
16
15
  );
17
16
  addHook(
18
17
  hookName: 'th-renaming-tiddler',
19
- callback: (toTiddler: Tiddler, fromTiddler: Tiddler) => Tiddler | void,
18
+ callback: (toTiddler: Tiddler, fromTiddler: Tiddler) => Tiddler | undefined,
20
19
  );
21
20
  addHook(
22
21
  hookName: 'th-relinking-tiddler',
23
- callback: (toTiddler: Tiddler, fromTiddler: Tiddler) => Tiddler | void,
22
+ callback: (toTiddler: Tiddler, fromTiddler: Tiddler) => Tiddler | undefined,
24
23
  );
25
24
  addHook(
26
25
  hookName: 'th-importing-tiddler',
27
- callback: (tiddler: Tiddler) => Tiddler | void,
26
+ callback: (tiddler: Tiddler) => Tiddler | undefined,
28
27
  );
29
28
  addHook(
30
29
  hookName: 'th-before-importing',
31
- callback: (tiddler: Tiddler) => Tiddler | void,
30
+ callback: (tiddler: Tiddler) => Tiddler | undefined,
32
31
  );
33
32
  addHook(
34
33
  hookName: 'th-opening-default-tiddlers-list',
@@ -68,16 +67,19 @@ declare module 'tiddlywiki' {
68
67
  addHook(
69
68
  hookName: 'th-importing-file',
70
69
  callback: (props: {
71
- file: { path?: string, name: string };
72
- type: string;
73
- isBinary: boolean;
70
+ // eslint-disable-next-line @typescript-eslint/ban-types
74
71
  callback: Function;
75
- }) => boolean | void,
72
+ file: { name: string; path?: string };
73
+ isBinary: boolean;
74
+ type: string;
75
+ }) => boolean | undefined,
76
76
  );
77
77
  addHook(hookName: string, callback: (...arguments_: unknown[]) => unknown);
78
78
  /**
79
79
  * Invoke the hook by key
80
80
  */
81
81
  invokeHook(hookName: string, event: IWidgetEvent): undefined | IWidgetEvent;
82
+ // eslint-disable-next-line @typescript-eslint/ban-types
83
+ names: Record<string, Function[]>;
82
84
  }
83
85
  }
package/src/index.d.ts CHANGED
@@ -5,7 +5,7 @@ import { ITiddlyWiki } from 'tiddlywiki';
5
5
  export * from 'tiddlywiki';
6
6
 
7
7
  declare module 'tiddlywiki' {
8
- export type TW5InitFunction = (baseObject?: Record<string, unknown>) => ITiddlyWiki
8
+ export type TW5InitFunction = (baseObject?: Record<string, unknown>) => ITiddlyWiki;
9
9
  export const TiddlyWiki: TW5InitFunction;
10
10
  }
11
11
 
@@ -114,7 +114,7 @@ As with [JavaScript Macros](#JavaScript%20Macros), filter operators should not m
114
114
 
115
115
  Construct the iterator using $tw.wiki.makeTiddlerIterator
116
116
  */
117
- export type SourceIterator = (tiddler: Tiddler, title: string) => void;
117
+ export type SourceIterator = (tiddler: Tiddler | undefined, title: string) => void;
118
118
  export interface ISearchOptions {
119
119
  /** If true, forces all but regexp searches to be anchored to the start of text */
120
120
  anchored?: boolean;
@@ -141,6 +141,8 @@ As with [JavaScript Macros](#JavaScript%20Macros), filter operators should not m
141
141
  export interface IFilterOperatorParameterOperator {
142
142
  /** the operand for the filter step (as a string; if the filter specified it in angle brackets or braces, the text reference or letiable name will have already been resolved); */
143
143
  operand: string;
144
+ /** Filter can have one or more operands, like `charcode[13],[10]`. */
145
+ operands: string[];
144
146
  /** the name of the filter operator specified in the WikiText; */
145
147
  operator: string;
146
148
  /** (optional) a string containing a single exclamation mark if the filter operator is to be negated; */
@@ -26,7 +26,6 @@ declare module 'tiddlywiki' {
26
26
  }
27
27
  export interface IEvalContent {
28
28
  $tw: ITiddlyWiki;
29
- // eslint-disable-next-line node/prefer-global/buffer
30
29
  Buffer?: Buffer;
31
30
  clearInterval: typeof clearInterval;
32
31
  clearTimeout: typeof clearTimeout;
@@ -70,13 +69,13 @@ declare module 'tiddlywiki' {
70
69
  /** Return a class created from a modules. The module should export the properties to be added to those of the optional base class */
71
70
  createClassFromModule: (
72
71
  moduleExports: ITWModuleExports,
73
- baseClass: new () => unknown,
72
+ baseClass: new() => unknown,
74
73
  ) => ITWModuleExports;
75
74
  /** Return an array of classes created from the modules of a specified type. Each module should export the properties to be added to those of the optional base class */
76
75
  createClassesFromModules: (
77
76
  moduleType: string,
78
77
  subType: string | null | undefined,
79
- baseClass: new () => unknown,
78
+ baseClass: new() => unknown,
80
79
  ) => Record<string, ITWModuleExports>;
81
80
  /**
82
81
  * Define a JavaScript tiddler module for later execution
@@ -1,49 +1,49 @@
1
1
  declare module 'tiddlywiki' {
2
2
  // 定义键盘事件信息的接口
3
3
  export interface KeyInfo {
4
- keyCode: number;
5
- shiftKey: boolean;
6
4
  altKey: boolean;
7
5
  ctrlKey: boolean;
6
+ keyCode: number;
8
7
  metaKey: boolean;
8
+ shiftKey: boolean;
9
9
  }
10
10
 
11
11
  // 定义键盘管理器类的接口
12
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
13
  checkKeyDescriptor: (event: any, keyInfo: KeyInfo) => boolean;
32
14
  checkKeyDescriptors: (event: any, keyInfoArray: KeyInfo[]) => boolean;
15
+ detectNewShortcuts: (
16
+ changedTiddlers: Record<string, any>,
17
+ ) => boolean | string[];
18
+ getEventModifierKeyDescriptor: (event: any) => string;
33
19
  getMatchingKeyDescriptor: (
34
20
  event: any,
35
21
  keyInfoArray: KeyInfo[],
36
22
  ) => KeyInfo | null;
37
- getEventModifierKeyDescriptor: (event: any) => string;
23
+ getModifierKeys: () => number[];
24
+ getPrintableShortcuts: (keyInfoArray: KeyInfo[]) => string[];
38
25
  getShortcutTiddlerList: () => string[];
39
- updateShortcutLists: (tiddlerList: string[]) => void;
40
26
  handleKeydownEvent: (
41
27
  event: any,
42
28
  options?: { onlyPriority?: boolean },
43
29
  ) => boolean;
44
- detectNewShortcuts: (
45
- changedTiddlers: Record<string, any>,
46
- ) => boolean | string[];
47
30
  handleShortcutChanges: (changedTiddlers: Record<string, any>) => void;
31
+ keyNames: string[];
32
+ lookupNames: string[];
33
+ metaKeyName: string;
34
+ namedKeys: Record<string, number>;
35
+ parseKeyDescriptor: (
36
+ keyDescriptor: string,
37
+ options?: { keyDescriptor?: string },
38
+ ) => KeyInfo | null;
39
+ parseKeyDescriptors: (
40
+ keyDescriptors: string[] | string,
41
+ options?: { stack?: string[]; wiki?: any },
42
+ ) => KeyInfo[];
43
+ shortcutActionList: string[];
44
+ shortcutKeysList: string[];
45
+ shortcutParsedList: Array<KeyInfo[] | undefined>;
46
+ shortcutPriorityList: boolean[];
47
+ updateShortcutLists: (tiddlerList: string[]) => void;
48
48
  }
49
49
  }
@@ -4,13 +4,13 @@ declare module 'tiddlywiki' {
4
4
  * Optional source uri, used in parseText
5
5
  */
6
6
  _canonical_uri?: string;
7
+ defaultType?: string;
8
+ document?: TWDocument;
9
+ parentWidget?: Widget;
7
10
  /**
8
11
  * While calling `getCacheForTiddler`, use inlineParseTree or blockParseTree
9
12
  */
10
13
  parseAsInline?: boolean;
11
- defaultType?: string;
12
- parentWidget?: Widget;
13
- document?: TWDocument;
14
14
  }
15
15
 
16
16
  export class WikiParseRule {
@@ -35,11 +35,11 @@ declare module 'tiddlywiki' {
35
35
  };
36
36
  }
37
37
  export class WikiParser {
38
- blockRules: { matchIndex?: number; rule: WikiParseRule }[];
38
+ blockRules: Array<{ matchIndex?: number; rule: WikiParseRule }>;
39
39
 
40
- inlineRules: { matchIndex?: number; rule: WikiParseRule }[];
40
+ inlineRules: Array<{ matchIndex?: number; rule: WikiParseRule }>;
41
41
 
42
- pragmaRules: { matchIndex?: number; rule: WikiParseRule }[];
42
+ pragmaRules: Array<{ matchIndex?: number; rule: WikiParseRule }>;
43
43
 
44
44
  configTrimWhiteSpace: boolean;
45
45
 
@@ -19,7 +19,7 @@ declare module 'tiddlywiki' {
19
19
 
20
20
  export interface IServerOptions {
21
21
  routes: IRoute[];
22
- variables?: { [key: string]: string };
22
+ variables?: Record<string, string>;
23
23
  wiki: Wiki;
24
24
  }
25
25
 
@@ -104,14 +104,14 @@ declare module 'tiddlywiki' {
104
104
  export interface ServerEndpointContext {
105
105
  authenticatedUsername: string | undefined;
106
106
  data: string;
107
- server: Server;
108
- wiki: Wiki;
109
107
  /**
110
108
  * With `exports.path = /^\/recipes\/default\/tiddlers\/(.+)$/;` you can use:
111
- *
109
+ *
112
110
  * `title = $tw.utils.decodeURIComponentSafe(state.params[0])`
113
111
  */
114
112
  params: string[];
113
+ server: Server;
114
+ wiki: Wiki;
115
115
  }
116
116
  /**
117
117
  * @link https://talk.tiddlywiki.org/t/what-is-the-state-in-server-route-handler/2877
@@ -5,9 +5,9 @@ declare module 'tiddlywiki' {
5
5
  historyTitle: string;
6
6
 
7
7
  constructor(options?: {
8
- wiki?: Wiki;
9
- storyTitle?: string;
10
8
  historyTitle?: string;
9
+ storyTitle?: string;
10
+ wiki?: Wiki;
11
11
  });
12
12
 
13
13
  getStoryList(): string[];