tw5-typed 0.1.11 → 0.1.12
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 +12 -12
- package/src/ast.d.ts +23 -4
- package/src/parser.d.ts +4 -9
- package/src/utils.d.ts +7 -0
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.1.
|
|
5
|
+
"version": "0.1.12",
|
|
6
6
|
"url": "https://github.com/tiddly-gittly/tw5-typed",
|
|
7
7
|
"homepage": "https://github.com/tiddly-gittly/tw5-typed",
|
|
8
8
|
"bugs": {
|
|
@@ -20,28 +20,28 @@
|
|
|
20
20
|
"prepublishOnly": "npx tsc --noEmit"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@types/node": "^17.0.
|
|
24
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
25
|
-
"@typescript-eslint/parser": "5.
|
|
26
|
-
"eslint": "8.
|
|
27
|
-
"eslint-config-prettier": "8.
|
|
28
|
-
"eslint-config-standard": "
|
|
23
|
+
"@types/node": "^17.0.22",
|
|
24
|
+
"@typescript-eslint/eslint-plugin": "5.16.0",
|
|
25
|
+
"@typescript-eslint/parser": "5.16.0",
|
|
26
|
+
"eslint": "8.11.0",
|
|
27
|
+
"eslint-config-prettier": "8.5.0",
|
|
28
|
+
"eslint-config-standard": "16.0.3",
|
|
29
29
|
"eslint-config-standard-with-typescript": "21.0.1",
|
|
30
30
|
"eslint-import-resolver-alias": "1.1.2",
|
|
31
31
|
"eslint-import-resolver-typescript": "2.5.0",
|
|
32
32
|
"eslint-plugin-html": "6.2.0",
|
|
33
33
|
"eslint-plugin-import": "2.25.4",
|
|
34
|
-
"eslint-plugin-n": "
|
|
34
|
+
"eslint-plugin-n": "15.0.1",
|
|
35
35
|
"eslint-plugin-node": "11.1.0",
|
|
36
36
|
"eslint-plugin-prettier": "4.0.0",
|
|
37
37
|
"eslint-plugin-promise": "6.0.0",
|
|
38
|
-
"eslint-plugin-react": "7.
|
|
38
|
+
"eslint-plugin-react": "7.29.4",
|
|
39
39
|
"eslint-plugin-react-hooks": "4.3.0",
|
|
40
40
|
"eslint-plugin-security": "1.4.0",
|
|
41
41
|
"eslint-plugin-security-node": "1.1.1",
|
|
42
42
|
"eslint-plugin-typescript-sort-keys": "2.1.0",
|
|
43
|
-
"eslint-plugin-unicorn": "
|
|
44
|
-
"prettier": "2.
|
|
45
|
-
"typescript": "4.
|
|
43
|
+
"eslint-plugin-unicorn": "41.0.1",
|
|
44
|
+
"prettier": "2.6.0",
|
|
45
|
+
"typescript": "4.6.2"
|
|
46
46
|
}
|
|
47
47
|
}
|
package/src/ast.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
declare module 'tiddlywiki' {
|
|
2
2
|
export interface IParseTreeAttribute {
|
|
3
|
-
start
|
|
4
|
-
name
|
|
3
|
+
start?: number;
|
|
4
|
+
name?: string;
|
|
5
5
|
type: 'string' | 'number';
|
|
6
6
|
value: string;
|
|
7
|
-
end
|
|
7
|
+
end?: number;
|
|
8
8
|
}
|
|
9
|
+
|
|
9
10
|
export interface IWikiASTNode {
|
|
10
11
|
type: string;
|
|
11
12
|
children?: IParseTreeNode[];
|
|
@@ -24,11 +25,29 @@ declare module 'tiddlywiki' {
|
|
|
24
25
|
type: 'link';
|
|
25
26
|
text: string;
|
|
26
27
|
}
|
|
27
|
-
export type HTMLTags = keyof HTMLElementTagNameMap
|
|
28
|
+
export type HTMLTags = keyof HTMLElementTagNameMap | 'strike';
|
|
29
|
+
|
|
28
30
|
export interface IDomParseTreeNode extends IWikiASTNode {
|
|
29
31
|
type: 'element';
|
|
30
32
|
tag: HTMLTags;
|
|
31
33
|
}
|
|
34
|
+
export interface ICodeBlockParseTreeNode extends IWikiASTNode {
|
|
35
|
+
type: 'codeblock';
|
|
36
|
+
attributes: {
|
|
37
|
+
code?:
|
|
38
|
+
| {
|
|
39
|
+
type: 'string';
|
|
40
|
+
value: string;
|
|
41
|
+
}
|
|
42
|
+
| undefined;
|
|
43
|
+
language?:
|
|
44
|
+
| {
|
|
45
|
+
type: 'string';
|
|
46
|
+
value: string;
|
|
47
|
+
}
|
|
48
|
+
| undefined;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
32
51
|
export interface IMacroParamCallParseTreeNode extends IWikiASTNode {
|
|
33
52
|
type: 'macro-parameter';
|
|
34
53
|
value: string;
|
package/src/parser.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/// <reference path="ast.d.ts" />
|
|
2
|
+
|
|
1
3
|
declare module 'tiddlywiki' {
|
|
2
4
|
export interface IParserOptions {
|
|
3
5
|
/**
|
|
@@ -10,7 +12,7 @@ declare module 'tiddlywiki' {
|
|
|
10
12
|
_canonical_uri?: string;
|
|
11
13
|
}
|
|
12
14
|
|
|
13
|
-
export
|
|
15
|
+
export class WikiParseRule {
|
|
14
16
|
is: { block?: boolean; inline?: boolean };
|
|
15
17
|
match?: null;
|
|
16
18
|
matchRegExp?: RegExp;
|
|
@@ -26,14 +28,7 @@ declare module 'tiddlywiki' {
|
|
|
26
28
|
name: string;
|
|
27
29
|
};
|
|
28
30
|
}
|
|
29
|
-
export
|
|
30
|
-
start: number;
|
|
31
|
-
name: string;
|
|
32
|
-
type: 'string' | 'number';
|
|
33
|
-
value: string;
|
|
34
|
-
end: number;
|
|
35
|
-
}
|
|
36
|
-
export declare class WikiParser {
|
|
31
|
+
export class WikiParser {
|
|
37
32
|
blockRules: { rule: WikiParseRule; matchIndex?: number }[];
|
|
38
33
|
inlineRules: { rule: WikiParseRule; matchIndex?: number }[];
|
|
39
34
|
pragmaRules: { rule: WikiParseRule; matchIndex?: number }[];
|
package/src/utils.d.ts
CHANGED
|
@@ -6,6 +6,13 @@ declare module 'tiddlywiki' {
|
|
|
6
6
|
export type TWDOMElement = Element;
|
|
7
7
|
export type TWEachCallback<T> = (element?: unknown, index?: string | number, object?: T) => boolean | undefined;
|
|
8
8
|
export interface ITWUtils {
|
|
9
|
+
/**
|
|
10
|
+
* Alternative to `element.classList.add`, add a css class name to an element, see issue for detail.
|
|
11
|
+
* @link https://github.com/Jermolene/TiddlyWiki5/issues/6475
|
|
12
|
+
* @param element
|
|
13
|
+
* @param className
|
|
14
|
+
*/
|
|
15
|
+
addClass(element: Element, className: string): void;
|
|
9
16
|
Crypto: typeof Crypto;
|
|
10
17
|
PasswordPrompt: typeof PasswordPrompt;
|
|
11
18
|
/** Returns true if the version string A is greater than the version string B. Returns true if the versions are the same */
|