tw5-typed 0.2.21 → 0.2.23
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 +5 -5
- package/src/core.d.ts +3 -2
- package/src/modules/parsers/index.d.ts +2 -1
- package/src/modules/utils/fakedom.d.ts +27 -0
- package/src/modules/utils/index.d.ts +2 -1
- package/src/modules/widgets/index.d.ts +1 -23
- package/src/utils/index.d.ts +6 -1
- package/src/wiki/index.d.ts +7 -8
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.2.
|
|
5
|
+
"version": "0.2.23",
|
|
6
6
|
"url": "https://github.com/tiddly-gittly/tw5-typed",
|
|
7
7
|
"homepage": "https://github.com/tiddly-gittly/tw5-typed",
|
|
8
8
|
"bugs": {
|
|
@@ -16,9 +16,6 @@
|
|
|
16
16
|
"files": [
|
|
17
17
|
"src/"
|
|
18
18
|
],
|
|
19
|
-
"scripts": {
|
|
20
|
-
"check": "tsc --noEmit && eslint src/**/*.ts"
|
|
21
|
-
},
|
|
22
19
|
"husky": {
|
|
23
20
|
"hooks": {
|
|
24
21
|
"pre-commit": "lint-staged"
|
|
@@ -45,5 +42,8 @@
|
|
|
45
42
|
"@types/codemirror": "^5.60.6",
|
|
46
43
|
"@types/echarts": "^4.9.16",
|
|
47
44
|
"@types/node": "^18.11.9"
|
|
45
|
+
},
|
|
46
|
+
"scripts": {
|
|
47
|
+
"check": "tsc --noEmit && eslint src/**/*.ts"
|
|
48
48
|
}
|
|
49
|
-
}
|
|
49
|
+
}
|
package/src/core.d.ts
CHANGED
|
@@ -31,14 +31,15 @@ declare module 'tiddlywiki' {
|
|
|
31
31
|
boot: IBoot;
|
|
32
32
|
crypto: Crypto;
|
|
33
33
|
utils: IUtils;
|
|
34
|
+
config: IConfig;
|
|
34
35
|
version: string;
|
|
35
36
|
safeMode: boolean;
|
|
36
|
-
|
|
37
|
+
modules: IModules;
|
|
37
38
|
rootWidget: Widget;
|
|
38
39
|
notifier: Notifier;
|
|
39
40
|
language: ILanguage;
|
|
40
|
-
modules: IModules;
|
|
41
41
|
locationHash: string;
|
|
42
|
+
fakeDocument: IFakeDocument;
|
|
42
43
|
passwordPrompt: PasswordPrompt;
|
|
43
44
|
packageInfo: Record<string, unknown>;
|
|
44
45
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare module 'tiddlywiki' {
|
|
2
|
-
export interface
|
|
2
|
+
export interface IParseOptions {
|
|
3
3
|
/**
|
|
4
4
|
* Optional source uri, used in parseText
|
|
5
5
|
*/
|
|
@@ -8,6 +8,7 @@ declare module 'tiddlywiki' {
|
|
|
8
8
|
* While calling `getCacheForTiddler`, use inlineParseTree or blockParseTree
|
|
9
9
|
*/
|
|
10
10
|
parseAsInline?: boolean;
|
|
11
|
+
defaultType?: string;
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
export class WikiParseRule {
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
declare module 'tiddlywiki' {
|
|
2
|
+
export class TW_Element extends HTMLElement {
|
|
3
|
+
_style: Record<string, unknown>;
|
|
4
|
+
appendChild: <T extends TW_Element | TW_TextNode | Node>(node: T) => T;
|
|
5
|
+
isRaw: boolean;
|
|
6
|
+
isTiddlyWikiFakeDom: boolean;
|
|
7
|
+
namespaceURI: string;
|
|
8
|
+
tag: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export class TW_TextNode extends Node {
|
|
12
|
+
textContent: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface IFakeDocument {
|
|
16
|
+
compatMode: string;
|
|
17
|
+
createElement: (tag: string) => TW_Element;
|
|
18
|
+
createElementNS: (namespace: string, tag: string) => TW_Element;
|
|
19
|
+
createTextNode: (text: string) => TW_TextNode;
|
|
20
|
+
isTiddlyWikiFakeDom: boolean;
|
|
21
|
+
setSequenceNumber: (value: any) => void;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
declare module '$:/core/modules/utils/fakedom.js' {
|
|
26
|
+
export type { TW_Element, TW_TextNode, IFakeDocument } from 'tiddlywiki';
|
|
27
|
+
}
|
|
@@ -21,7 +21,7 @@ declare module 'tiddlywiki' {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export interface IWidgetInitialiseOptions {
|
|
24
|
-
document?:
|
|
24
|
+
document?: TWDocument;
|
|
25
25
|
parentWidget?: Widget;
|
|
26
26
|
wiki?: ITiddlyWiki;
|
|
27
27
|
}
|
|
@@ -477,28 +477,6 @@ declare module 'tiddlywiki' {
|
|
|
477
477
|
): boolean;
|
|
478
478
|
}
|
|
479
479
|
|
|
480
|
-
export interface IFakeDocument {
|
|
481
|
-
compatMode: string;
|
|
482
|
-
createElement: (tag: string) => TW_Element;
|
|
483
|
-
createElementNS: (namespace: string, tag: string) => TW_Element;
|
|
484
|
-
createTextNode: (text: string) => TW_TextNode;
|
|
485
|
-
isTiddlyWikiFakeDom: boolean;
|
|
486
|
-
setSequenceNumber: (value: any) => void;
|
|
487
|
-
}
|
|
488
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
489
|
-
export interface TW_Element extends HTMLElement {
|
|
490
|
-
_style: Record<string, unknown>;
|
|
491
|
-
appendChild: <T extends TW_Element | TW_TextNode | Node>(node: T) => T;
|
|
492
|
-
isRaw: boolean;
|
|
493
|
-
isTiddlyWikiFakeDom: boolean;
|
|
494
|
-
namespaceURI: string;
|
|
495
|
-
tag: string;
|
|
496
|
-
}
|
|
497
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
498
|
-
export interface TW_TextNode extends Node {
|
|
499
|
-
textContent: string;
|
|
500
|
-
}
|
|
501
|
-
|
|
502
480
|
export type ModalWidget = {
|
|
503
481
|
adjustPageClass: () => void;
|
|
504
482
|
/**
|
package/src/utils/index.d.ts
CHANGED
|
@@ -212,7 +212,12 @@ declare module 'tiddlywiki' {
|
|
|
212
212
|
* @param {IDomMakerOptions} options
|
|
213
213
|
* @returns {TWElement}
|
|
214
214
|
*/
|
|
215
|
-
domMaker:
|
|
215
|
+
domMaker: <K extends keyof HTMLElementTagNameMap | string>(
|
|
216
|
+
tag: K,
|
|
217
|
+
options: IDomMakerOptions,
|
|
218
|
+
) => K extends keyof HTMLElementTagNameMap
|
|
219
|
+
? HTMLElementTagNameMap[K]
|
|
220
|
+
: HTMLElement;
|
|
216
221
|
|
|
217
222
|
/**
|
|
218
223
|
* @en
|
package/src/wiki/index.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
/// <reference path="../modules/filters/index.d.ts" />>
|
|
2
2
|
|
|
3
3
|
declare module 'tiddlywiki' {
|
|
4
|
-
export interface IMakeWidgetOptions
|
|
5
|
-
document
|
|
4
|
+
export interface IMakeWidgetOptions {
|
|
5
|
+
document?: TWDocument;
|
|
6
|
+
variables?: Record<string, string>;
|
|
7
|
+
parentWidget?: Widget;
|
|
6
8
|
}
|
|
9
|
+
export type IRenderOptions = IMakeWidgetOptions & IParseOptions;
|
|
7
10
|
|
|
8
11
|
export type OutputMimeTypes =
|
|
9
12
|
| 'text/html'
|
|
@@ -13,10 +16,6 @@ declare module 'tiddlywiki' {
|
|
|
13
16
|
| 'text/html'
|
|
14
17
|
| 'text/vnd.tiddlywiki'
|
|
15
18
|
| 'text/plain';
|
|
16
|
-
export interface IRenderOptions {
|
|
17
|
-
parentWidget?: Widget;
|
|
18
|
-
variables?: Record<string, any>;
|
|
19
|
-
}
|
|
20
19
|
export type ITiddlerFieldsParam = Omit<
|
|
21
20
|
Partial<ITiddlerFields>,
|
|
22
21
|
'created' | 'modified'
|
|
@@ -167,7 +166,7 @@ declare module 'tiddlywiki' {
|
|
|
167
166
|
/**
|
|
168
167
|
Parse a tiddler according to its MIME type
|
|
169
168
|
*/
|
|
170
|
-
parseTiddler(title: string, options?:
|
|
169
|
+
parseTiddler(title: string, options?: IParseOptions): WikiParser;
|
|
171
170
|
/**
|
|
172
171
|
Parse a block of text of a specified MIME type
|
|
173
172
|
@param {string} type: content type of text to be parsed
|
|
@@ -178,7 +177,7 @@ declare module 'tiddlywiki' {
|
|
|
178
177
|
- parseAsInline: if true, the text of the tiddler will be parsed as an inline run
|
|
179
178
|
- _canonical_uri: optional string of the canonical URI of this content
|
|
180
179
|
*/
|
|
181
|
-
parseText(type: string, text: string, options?:
|
|
180
|
+
parseText(type: string, text: string, options?: IParseOptions): WikiParser;
|
|
182
181
|
/**
|
|
183
182
|
Parse text from a tiddler and render it into another format
|
|
184
183
|
outputType: content type for the output
|