tw5-typed 0.3.9 → 0.3.11
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 +1 -1
- package/src/modules/parsers/index.d.ts +2 -0
- package/src/modules/server/index.d.ts +6 -0
- package/src/modules/utils/crypto.d.ts +32 -0
- package/src/modules/utils/csv.d.ts +38 -0
- package/src/modules/utils/dom.d.ts +32 -47
- package/src/modules/utils/edition-info.d.ts +11 -0
- package/src/modules/utils/escapecss.d.ts +8 -0
- package/src/modules/utils/fakedom.d.ts +2 -1
- package/src/modules/utils/filesystem.d.ts +116 -48
- package/src/modules/utils/index.d.ts +31 -1
- package/src/modules/utils/linked-list.d.ts +91 -0
- package/src/modules/utils/logger.d.ts +74 -13
- package/src/modules/utils/parsetree.d.ts +81 -0
- package/src/modules/utils/performance.d.ts +51 -0
- package/src/modules/utils/pluginmaker.d.ts +15 -0
- package/src/modules/utils/transliterate.d.ts +23 -0
- package/src/modules/utils/utils.d.ts +599 -22
- package/src/modules/widgets/index.d.ts +1 -0
- package/src/modules/wiki.d.ts +11 -3
- package/src/tiddler/index.d.ts +1 -1
- package/src/utils/index.d.ts +6 -4
- package/src/wiki/index.d.ts +32 -13
package/package.json
CHANGED
|
@@ -106,6 +106,12 @@ declare module 'tiddlywiki' {
|
|
|
106
106
|
data: string;
|
|
107
107
|
server: Server;
|
|
108
108
|
wiki: Wiki;
|
|
109
|
+
/**
|
|
110
|
+
* With `exports.path = /^\/recipes\/default\/tiddlers\/(.+)$/;` you can use:
|
|
111
|
+
*
|
|
112
|
+
* `title = $tw.utils.decodeURIComponentSafe(state.params[0])`
|
|
113
|
+
*/
|
|
114
|
+
params: string[];
|
|
109
115
|
}
|
|
110
116
|
/**
|
|
111
117
|
* @link https://talk.tiddlywiki.org/t/what-is-the-state-in-server-route-handler/2877
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
declare module '$:/core/modules/utils/crypto.js' {
|
|
2
|
+
/**
|
|
3
|
+
* Extracts an encrypted store area from a TiddlyWiki file.
|
|
4
|
+
* @param text - The text of the TiddlyWiki file.
|
|
5
|
+
* @returns The extracted encrypted store area, or null if not found.
|
|
6
|
+
*/
|
|
7
|
+
export function extractEncryptedStoreArea(text: string): string | null;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Attempts to decrypt an encrypted store area using the provided password.
|
|
11
|
+
* @param encryptedStoreArea - The encrypted store area to decrypt.
|
|
12
|
+
* @param password - The password to use for decryption.
|
|
13
|
+
* @returns An array of decrypted tiddlers, or null if decryption fails.
|
|
14
|
+
*/
|
|
15
|
+
export function decryptStoreArea(
|
|
16
|
+
encryptedStoreArea: string,
|
|
17
|
+
password?: string,
|
|
18
|
+
): any[] | null;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Prompts the user for a password and attempts to decrypt an encrypted store area using the provided password.
|
|
22
|
+
* @param encryptedStoreArea - The encrypted store area to decrypt.
|
|
23
|
+
* @param callback - The function to call with the decrypted tiddlers.
|
|
24
|
+
* @param options - Configuration options.
|
|
25
|
+
* @param options.usePasswordVault - Whether to store the password in the system password vault.
|
|
26
|
+
*/
|
|
27
|
+
export function decryptStoreAreaInteractive(
|
|
28
|
+
encryptedStoreArea: string,
|
|
29
|
+
callback: (tiddlers: any[]) => void,
|
|
30
|
+
options?: { usePasswordVault?: boolean },
|
|
31
|
+
): void;
|
|
32
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
declare module '$:/core/modules/utils/csv.js' {
|
|
2
|
+
/**
|
|
3
|
+
* Information about a CSV cell.
|
|
4
|
+
* @property {number} start - The start index of the cell in the CSV string.
|
|
5
|
+
* @property {number} end - The end index of the cell in the CSV string.
|
|
6
|
+
* @property {boolean} isQuoted - Whether the cell is quoted.
|
|
7
|
+
* @description CSV 单元格的信息。
|
|
8
|
+
*/
|
|
9
|
+
interface CellInfo {
|
|
10
|
+
start: number;
|
|
11
|
+
end: number;
|
|
12
|
+
isQuoted: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Parse a CSV string into an array of arrays.
|
|
17
|
+
* @param text - The CSV string to parse.
|
|
18
|
+
* @param options - The options for parsing the CSV string.
|
|
19
|
+
* @returns An array of arrays representing the CSV data.
|
|
20
|
+
* @description 将 CSV 字符串解析为数组的数组。
|
|
21
|
+
*/
|
|
22
|
+
export function parseCsvString(
|
|
23
|
+
text: string,
|
|
24
|
+
options?: { separator?: string },
|
|
25
|
+
): any[][];
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Parse a CSV string with a header row and return an array of objects.
|
|
29
|
+
* @param text - The CSV string to parse.
|
|
30
|
+
* @param options - The options for parsing the CSV string.
|
|
31
|
+
* @returns An array of objects representing the CSV data.
|
|
32
|
+
* @description 解析具有标题行的 CSV 字符串并返回对象数组。
|
|
33
|
+
*/
|
|
34
|
+
export function parseCsvStringWithHeader(
|
|
35
|
+
text: string,
|
|
36
|
+
options?: { separator?: string },
|
|
37
|
+
): object[];
|
|
38
|
+
}
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
declare module '
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
1
|
+
declare module '$:/core/modules/utils/dom.js' {
|
|
2
|
+
/**
|
|
3
|
+
* Alternative to `element.classList.add`, add a css class name to an element, see issue for detail.
|
|
4
|
+
* @link https://github.com/Jermolene/TiddlyWiki5/issues/6475
|
|
5
|
+
* @param element
|
|
6
|
+
* @param className
|
|
7
|
+
*/
|
|
8
|
+
export function addClass(element: Element, className: string): void;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Attach specified event handlers to a DOM node
|
|
12
|
+
* @param domNode: where to attach the event handlers
|
|
13
|
+
* @param events: array of event handlers to be added (see below)
|
|
14
|
+
* Each entry in the events array is an object with these properties:
|
|
15
|
+
* * name: event name of `addEventListener`
|
|
16
|
+
* * handlerFunction: optional event handler function
|
|
17
|
+
* * handlerObject: optional event handler object
|
|
18
|
+
* * handlerMethod: optionally specifies object handler method name (defaults to `handleEvent`)
|
|
19
|
+
*/
|
|
20
|
+
export function addEventListeners(
|
|
21
|
+
domNode: Element,
|
|
22
|
+
events: {
|
|
23
|
+
handlerFunction?: (event: MouseEvent) => void;
|
|
24
|
+
handlerMethod?: string;
|
|
25
|
+
handlerObject?: Widget;
|
|
26
|
+
name: string;
|
|
27
|
+
}[],
|
|
28
|
+
): void;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Notifier mechanism
|
|
32
|
+
*/
|
|
33
33
|
export class Notifier {
|
|
34
34
|
/**
|
|
35
35
|
* Display a notification
|
|
@@ -40,18 +40,3 @@ declare module 'tiddlywiki' {
|
|
|
40
40
|
display(title: string, options?: Record<string, unknown>): void;
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
|
|
44
|
-
declare module '$:/core/modules/utils/dom.js' {
|
|
45
|
-
import { Widget, Notifier } from 'tiddlywiki';
|
|
46
|
-
export const addClass: (element: Element, className: string) => void;
|
|
47
|
-
export const addEventListeners: (
|
|
48
|
-
domNode: Element,
|
|
49
|
-
events: {
|
|
50
|
-
handlerFunction?: (event: MouseEvent) => void;
|
|
51
|
-
handlerMethod?: string;
|
|
52
|
-
handlerObject?: Widget;
|
|
53
|
-
name: string;
|
|
54
|
-
}[],
|
|
55
|
-
) => void;
|
|
56
|
-
export { Notifier }
|
|
57
|
-
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare module '$:/core/modules/utils/edition-info.js' {
|
|
2
|
+
/**
|
|
3
|
+
* Get the edition information.
|
|
4
|
+
* @description 获取版本信息。
|
|
5
|
+
* @returns An object containing the edition information.
|
|
6
|
+
* @returns 包含版本信息的对象。
|
|
7
|
+
*/
|
|
8
|
+
export function getEditionInfo(): {
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
@@ -23,5 +23,6 @@ declare module 'tiddlywiki' {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
declare module '$:/core/modules/utils/fakedom.js' {
|
|
26
|
-
|
|
26
|
+
import type { IFakeDocument } from 'tiddlywiki';
|
|
27
|
+
export const fakeDocument: IFakeDocument;
|
|
27
28
|
}
|
|
@@ -1,48 +1,126 @@
|
|
|
1
1
|
declare module '$:/core/modules/utils/utils.js' {
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Return the subdirectories of a path
|
|
4
|
+
* @param dirPath - The path to the directory
|
|
5
|
+
* @returns An array of subdirectories
|
|
6
|
+
* @description 返回路径的子目录
|
|
7
|
+
*/
|
|
8
|
+
export function getSubdirectories(dirPath: string): string[];
|
|
3
9
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Recursively (and synchronously) copy a directory and all its content
|
|
12
|
+
* @param srcPath - The source path of the directory to copy
|
|
13
|
+
* @param dstPath - The destination path of the directory to copy
|
|
14
|
+
* @returns An error message if there is an error, otherwise null
|
|
15
|
+
* @description 递归地(同步地)复制目录及其所有内容
|
|
16
|
+
*/
|
|
17
|
+
export function copyDirectory(srcPath: string, dstPath: string): string;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Copy a file
|
|
21
|
+
* @param srcPath - The source path of the file to copy
|
|
22
|
+
* @param dstPath - The destination path of the file to copy
|
|
23
|
+
* @returns An error message if there is an error, otherwise null
|
|
24
|
+
* @description 复制文件
|
|
25
|
+
*/
|
|
26
|
+
export function copyFile(srcPath: string, dstPath: string): string;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Remove trailing path separator
|
|
30
|
+
* @param dirPath - The directory path to remove the trailing separator from
|
|
31
|
+
* @returns The directory path without the trailing separator
|
|
32
|
+
* @description 移除路径末尾的分隔符
|
|
33
|
+
*/
|
|
34
|
+
export function removeTrailingSeparator(dirPath: string): string;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Recursively create a directory
|
|
38
|
+
* @param dirPath - The path of the directory to create
|
|
39
|
+
* @returns An error message if there is an error, otherwise null
|
|
40
|
+
* @description 递归地创建目录
|
|
41
|
+
*/
|
|
42
|
+
export function createDirectory(dirPath: string): string;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Recursively create directories needed to contain a specified file
|
|
46
|
+
* @param filePath - The path of the file to create directories for
|
|
47
|
+
* @returns An error message if there is an error, otherwise null
|
|
48
|
+
* @description 递归地创建包含指定文件的目录
|
|
49
|
+
*/
|
|
50
|
+
export function createFileDirectories(filePath: string): string;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Recursively delete a directory
|
|
54
|
+
* @param dirPath - The path of the directory to delete
|
|
55
|
+
* @returns An error message if there is an error, otherwise null
|
|
56
|
+
* @description 递归地删除目录
|
|
57
|
+
*/
|
|
58
|
+
export function deleteDirectory(dirPath: string): string;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Check if a path identifies a directory
|
|
62
|
+
* @param dirPath - The path to check
|
|
63
|
+
* @returns True if the path identifies a directory, false otherwise
|
|
64
|
+
* @description 检查路径是否标识目录
|
|
65
|
+
*/
|
|
66
|
+
export function isDirectory(dirPath: string): boolean;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Check if a path identifies a directory that is empty
|
|
70
|
+
* @param dirPath - The path to check
|
|
71
|
+
* @returns True if the path identifies an empty directory, false otherwise
|
|
72
|
+
* @description 检查路径是否标识空目录
|
|
73
|
+
*/
|
|
74
|
+
export function isDirectoryEmpty(dirPath: string): boolean;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Recursively delete a tree of empty directories
|
|
78
|
+
* @param dirpath - The path of the directory to delete
|
|
79
|
+
* @param callback - A callback function to call when the operation is complete
|
|
80
|
+
* @description 递归地删除空目录树
|
|
81
|
+
*/
|
|
82
|
+
export function deleteEmptyDirs(
|
|
83
|
+
dirpath: string,
|
|
84
|
+
callback: (err: Error | null) => void,
|
|
85
|
+
): void;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Generate a fileInfo object for saving a tiddler
|
|
89
|
+
* @param tiddler - The tiddler to generate the fileInfo for
|
|
90
|
+
* @param options - Options for generating the fileInfo
|
|
91
|
+
* @returns A fileInfo object
|
|
92
|
+
* @description 生成用于保存 tiddler 的 fileInfo 对象
|
|
93
|
+
*/
|
|
18
94
|
export function generateTiddlerFileInfo(
|
|
19
95
|
tiddler: Tiddler,
|
|
20
96
|
options: {
|
|
21
|
-
directory
|
|
97
|
+
directory: string;
|
|
22
98
|
pathFilters?: string[];
|
|
23
99
|
extFilters?: string[];
|
|
24
100
|
wiki?: Wiki;
|
|
25
|
-
fileInfo?:
|
|
101
|
+
fileInfo?: FileInfo;
|
|
26
102
|
},
|
|
27
|
-
):
|
|
28
|
-
|
|
103
|
+
): FileInfo;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Generate the file extension for saving a tiddler
|
|
107
|
+
* @param title - The title of the tiddler
|
|
108
|
+
* @param options - Options for generating the file extension
|
|
109
|
+
* @returns The file extension
|
|
110
|
+
* @description 生成用于保存 tiddler 的文件扩展名
|
|
111
|
+
* 可选项包括:
|
|
112
|
+
* extFilters:用于生成扩展名的可选过滤器数组
|
|
113
|
+
* wiki:用于评估 extFilters 的可选 wiki
|
|
114
|
+
*/
|
|
115
|
+
export function generateTiddlerExtension(
|
|
116
|
+
title: string,
|
|
117
|
+
options: {
|
|
118
|
+
extFilters?: string[];
|
|
119
|
+
wiki?: Wiki;
|
|
120
|
+
},
|
|
121
|
+
): string;
|
|
29
122
|
|
|
30
123
|
declare module 'tiddlywiki' {
|
|
31
|
-
import { generateTiddlerFileInfo, generateTiddlerFilepath } from '$:/core/modules/utils/utils.js';
|
|
32
|
-
export interface IFileInfo {
|
|
33
|
-
isEditableFile: boolean;
|
|
34
|
-
originalpath: string;
|
|
35
|
-
type: string;
|
|
36
|
-
hasMetaFile: boolean;
|
|
37
|
-
encoding: string;
|
|
38
|
-
filepath: string;
|
|
39
|
-
}
|
|
40
|
-
export interface ITiddlersInFile {
|
|
41
|
-
filepath: string;
|
|
42
|
-
type: string;
|
|
43
|
-
tiddlers: ITiddlerFields[];
|
|
44
|
-
hasMetaFile: boolean;
|
|
45
|
-
}
|
|
46
124
|
interface IUtils {
|
|
47
125
|
/**
|
|
48
126
|
* Generate the filepath for saving a tiddler
|
|
@@ -54,19 +132,9 @@ declare module 'tiddlywiki' {
|
|
|
54
132
|
* * fileInfo: an existing fileInfo object to check against
|
|
55
133
|
*/
|
|
56
134
|
generateTiddlerFilepath: typeof generateTiddlerFilepath;
|
|
57
|
-
/**
|
|
58
|
-
Create a fileInfo object for saving a tiddler:
|
|
59
|
-
filepath: the absolute path to the file containing the tiddler
|
|
60
|
-
type: the type of the tiddler file on disk (NOT the type of the tiddler)
|
|
61
|
-
hasMetaFile: true if the file also has a companion .meta file
|
|
62
|
-
isEditableFile: true if the tiddler was loaded via non-standard options & marked editable
|
|
63
|
-
Options include:
|
|
64
|
-
directory: absolute path of root directory to which we are saving
|
|
65
|
-
pathFilters: optional array of filters to be used to generate the base path
|
|
66
|
-
extFilters: optional array of filters to be used to generate the base path
|
|
67
|
-
wiki: optional wiki for evaluating the pathFilters,
|
|
68
|
-
fileInfo: an existing fileInfo to check against
|
|
69
|
-
*/
|
|
70
|
-
generateTiddlerFileInfo: typeof generateTiddlerFileInfo;
|
|
71
135
|
}
|
|
72
136
|
}
|
|
137
|
+
|
|
138
|
+
declare module '$:/core/modules/utils/utils.js' {
|
|
139
|
+
export { generateTiddlerFilepath };
|
|
140
|
+
}
|
|
@@ -2,4 +2,34 @@
|
|
|
2
2
|
/// <reference path="utils.d.ts" />
|
|
3
3
|
/// <reference path="fakedom.d.ts" />
|
|
4
4
|
/// <reference path="filesystem.d.ts" />
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
declare module 'tiddlywiki' {
|
|
7
|
+
// Thanks for GitHub Copilot, you has helped me a lot!
|
|
8
|
+
import * as dom from '$:/core/modules/utils/dom.js';
|
|
9
|
+
import * as utils from '$:/core/modules/utils/utils.js';
|
|
10
|
+
import * as filesystem from '$:/core/modules/utils/filesystem.js';
|
|
11
|
+
import * as LinkedList from '$:/core/modules/utils/linked-list.js';
|
|
12
|
+
import * as performance from '$:/core/modules/utils/performance.js';
|
|
13
|
+
import * as logger from '$:/core/modules/utils/logger.js';
|
|
14
|
+
import * as parsetree from '$:/core/modules/utils/parsetree.js';
|
|
15
|
+
import * as pluginMaker from '$:/core/modules/utils/pluginmaker.js';
|
|
16
|
+
import * as transliterate from '$:/core/modules/utils/transliterate.js';
|
|
17
|
+
import * as crypto from '$:/core/modules/utils/crypto.js';
|
|
18
|
+
import * as csv from '$:/core/modules/utils/csv.js';
|
|
19
|
+
import * as editionInfo from '$:/core/modules/utils/edition-info.js';
|
|
20
|
+
import * as escapecss from '$:/core/modules/utils/escapecss.js';
|
|
21
|
+
|
|
22
|
+
type IUtilsModules = Pick<typeof dom, keyof typeof dom> &
|
|
23
|
+
Partial<Pick<typeof filesystem, keyof typeof filesystem>> &
|
|
24
|
+
Pick<typeof utils, keyof typeof utils> &
|
|
25
|
+
Pick<typeof LinkedList, keyof typeof LinkedList> &
|
|
26
|
+
Pick<typeof performance, keyof typeof performance> &
|
|
27
|
+
Pick<typeof logger, keyof typeof logger> &
|
|
28
|
+
Pick<typeof parsetree, keyof typeof parsetree> &
|
|
29
|
+
Pick<typeof pluginMaker, keyof typeof pluginMaker> &
|
|
30
|
+
Pick<typeof transliterate, keyof typeof transliterate> &
|
|
31
|
+
Pick<typeof crypto, keyof typeof crypto> &
|
|
32
|
+
Pick<typeof csv, keyof typeof csv> &
|
|
33
|
+
Pick<typeof editionInfo, keyof typeof editionInfo> &
|
|
34
|
+
Pick<typeof escapecss, keyof typeof escapecss>;
|
|
35
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
declare module '$:/core/modules/utils/linked-list.js' {
|
|
2
|
+
/**
|
|
3
|
+
* A linked list implementation.
|
|
4
|
+
* @description 链表实现。
|
|
5
|
+
*/
|
|
6
|
+
export class LinkedList {
|
|
7
|
+
/**
|
|
8
|
+
* The next node in the linked list.
|
|
9
|
+
*/
|
|
10
|
+
next: LLMap;
|
|
11
|
+
/**
|
|
12
|
+
* The previous node in the linked list.
|
|
13
|
+
*/
|
|
14
|
+
prev: LLMap;
|
|
15
|
+
/**
|
|
16
|
+
* The length of the linked list.
|
|
17
|
+
*/
|
|
18
|
+
length: number;
|
|
19
|
+
constructor();
|
|
20
|
+
/**
|
|
21
|
+
* Clear the linked list.
|
|
22
|
+
* @description 清空链表。
|
|
23
|
+
*/
|
|
24
|
+
clear(): void;
|
|
25
|
+
/**
|
|
26
|
+
* Remove a value from the linked list.
|
|
27
|
+
* @param value - The value to remove.
|
|
28
|
+
* @description 从链表中删除值。
|
|
29
|
+
*/
|
|
30
|
+
remove(value: string | string[]): void;
|
|
31
|
+
/**
|
|
32
|
+
* Push a value to the end of the linked list.
|
|
33
|
+
* @param values - The values to push.
|
|
34
|
+
* @returns The length of the linked list.
|
|
35
|
+
* @description 将值推送到链表的末尾。
|
|
36
|
+
*/
|
|
37
|
+
push(...values: string[] | string[][]): number;
|
|
38
|
+
/**
|
|
39
|
+
* Push a value to the top of the linked list.
|
|
40
|
+
* @param value - The value to push.
|
|
41
|
+
* @description 将值推送到链表的顶部。
|
|
42
|
+
*/
|
|
43
|
+
pushTop(value: string | string[]): void;
|
|
44
|
+
/**
|
|
45
|
+
* Iterate over each value in the linked list.
|
|
46
|
+
* @param callback - The callback function to call for each value.
|
|
47
|
+
* @description 迭代链表中的每个值。
|
|
48
|
+
*/
|
|
49
|
+
each(callback: (value: string) => void): void;
|
|
50
|
+
/**
|
|
51
|
+
* Convert the linked list to an array.
|
|
52
|
+
* @returns The array representation of the linked list.
|
|
53
|
+
* @description 将链表转换为数组。
|
|
54
|
+
*/
|
|
55
|
+
toArray(): string[];
|
|
56
|
+
/**
|
|
57
|
+
* Create an iterator for the linked list.
|
|
58
|
+
* @param wiki - The wiki to use for the iterator.
|
|
59
|
+
* @returns The iterator function.
|
|
60
|
+
* @description 创建链表的迭代器。
|
|
61
|
+
*/
|
|
62
|
+
makeTiddlerIterator(
|
|
63
|
+
wiki: any,
|
|
64
|
+
): (callback: (tiddler: any, title: string) => void) => void;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
class LLMap {
|
|
68
|
+
/**
|
|
69
|
+
* The map object.
|
|
70
|
+
*/
|
|
71
|
+
map: { [key: string]: any };
|
|
72
|
+
/**
|
|
73
|
+
* The null value of the map.
|
|
74
|
+
*/
|
|
75
|
+
null: any;
|
|
76
|
+
/**
|
|
77
|
+
* Set a value in the map.
|
|
78
|
+
* @param key - The key to set.
|
|
79
|
+
* @param val - The value to set.
|
|
80
|
+
* @description 在映射中设置值。
|
|
81
|
+
*/
|
|
82
|
+
set(key: string | null, val: any): void;
|
|
83
|
+
/**
|
|
84
|
+
* Get a value from the map.
|
|
85
|
+
* @param key - The key to get.
|
|
86
|
+
* @returns The value of the key.
|
|
87
|
+
* @description 从映射中获取值。
|
|
88
|
+
*/
|
|
89
|
+
get(key: string | null): any;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -1,23 +1,84 @@
|
|
|
1
|
-
declare module '
|
|
1
|
+
declare module '$:/core/modules/utils/logger.js' {
|
|
2
|
+
/**
|
|
3
|
+
* A logger utility.
|
|
4
|
+
* @description 日志记录实用程序。
|
|
5
|
+
*/
|
|
2
6
|
export class Logger {
|
|
3
|
-
|
|
7
|
+
/**
|
|
8
|
+
* The name of the component.
|
|
9
|
+
*/
|
|
10
|
+
componentName: string;
|
|
11
|
+
/**
|
|
12
|
+
* The color of the logger.
|
|
13
|
+
*/
|
|
14
|
+
colour: string;
|
|
15
|
+
/**
|
|
16
|
+
* Whether the logger is enabled.
|
|
17
|
+
*/
|
|
18
|
+
enable: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Whether to save the log.
|
|
21
|
+
*/
|
|
22
|
+
save: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* The save limit of the logger.
|
|
25
|
+
*/
|
|
26
|
+
saveLimit: number;
|
|
27
|
+
/**
|
|
28
|
+
* The logger to save the buffer.
|
|
29
|
+
*/
|
|
30
|
+
saveBufferLogger: Logger;
|
|
31
|
+
/**
|
|
32
|
+
* The buffer of the logger.
|
|
33
|
+
*/
|
|
34
|
+
buffer: string;
|
|
35
|
+
/**
|
|
36
|
+
* The alert count of the logger.
|
|
37
|
+
*/
|
|
38
|
+
alertCount: number;
|
|
39
|
+
constructor(
|
|
40
|
+
componentName?: string,
|
|
41
|
+
options?: {
|
|
42
|
+
colour?: string;
|
|
43
|
+
enable?: boolean;
|
|
44
|
+
save?: boolean;
|
|
45
|
+
saveLimit?: number;
|
|
46
|
+
},
|
|
47
|
+
);
|
|
48
|
+
/**
|
|
49
|
+
* Set the logger to save the buffer.
|
|
50
|
+
* @param logger - The logger to save the buffer.
|
|
51
|
+
* @description 设置记录器以保存缓冲区。
|
|
52
|
+
*/
|
|
4
53
|
setSaveBuffer(logger: Logger): void;
|
|
5
54
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
55
|
+
* Log a message.
|
|
56
|
+
* @param args - The arguments to log.
|
|
57
|
+
* @description 记录消息。
|
|
58
|
+
*/
|
|
59
|
+
log(...args: any[]): void;
|
|
60
|
+
/**
|
|
61
|
+
* Get the message buffer.
|
|
62
|
+
* @returns The message buffer.
|
|
63
|
+
* @description 获取消息缓冲区。
|
|
64
|
+
*/
|
|
10
65
|
getBuffer(): string;
|
|
11
|
-
table: typeof console.table;
|
|
12
66
|
/**
|
|
13
|
-
|
|
14
|
-
|
|
67
|
+
* Log a structure as a table.
|
|
68
|
+
* @param value - The value to log.
|
|
69
|
+
* @description 将结构记录为表格。
|
|
70
|
+
*/
|
|
71
|
+
table(value: any): void;
|
|
72
|
+
/**
|
|
73
|
+
* Alert a message.
|
|
74
|
+
* @param args - The arguments to alert.
|
|
75
|
+
* @description 警报消息。
|
|
76
|
+
*/
|
|
15
77
|
alert(...args: any[]): void;
|
|
16
|
-
}
|
|
17
|
-
interface IUtils {
|
|
18
78
|
/**
|
|
19
|
-
*
|
|
79
|
+
* Clear outstanding alerts.
|
|
80
|
+
* @description 清除未处理的警报。
|
|
20
81
|
*/
|
|
21
|
-
|
|
82
|
+
clearAlerts(): void;
|
|
22
83
|
}
|
|
23
84
|
}
|