tw5-typed 0.2.20 → 0.2.22
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.2.
|
|
5
|
+
"version": "0.2.22",
|
|
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/boot/config.d.ts
CHANGED
|
@@ -13,7 +13,6 @@ declare module 'tiddlywiki' {
|
|
|
13
13
|
export type ITWConfig = IConfig;
|
|
14
14
|
|
|
15
15
|
interface IConfig {
|
|
16
|
-
[configName: string]: unknown;
|
|
17
16
|
/** Map type to file content type */
|
|
18
17
|
contentTypeInfo: Record<string, IContentTypeInfo>;
|
|
19
18
|
/** @default 'TIDDLYWIKI_EDITION_PATH' */
|
|
@@ -51,5 +50,7 @@ declare module 'tiddlywiki' {
|
|
|
51
50
|
wikiThemesSubDir: string;
|
|
52
51
|
/** @default './tiddlers' */
|
|
53
52
|
wikiTiddlersSubDir: string;
|
|
53
|
+
htmlUnsafeElements: string[];
|
|
54
|
+
[configName: string]: any;
|
|
54
55
|
}
|
|
55
56
|
}
|
|
@@ -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 {
|
package/src/modules/story.d.ts
CHANGED
|
@@ -20,6 +20,14 @@ declare module 'tiddlywiki' {
|
|
|
20
20
|
isMacroDefinition: boolean;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
export interface IWidgetInitialiseOptions {
|
|
24
|
+
document?: TWDocument;
|
|
25
|
+
parentWidget?: Widget;
|
|
26
|
+
wiki?: ITiddlyWiki;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type IWidgetInitializeOptions = IWidgetInitialiseOptions;
|
|
30
|
+
|
|
23
31
|
export interface IWidgetEvent {
|
|
24
32
|
[extraKeys: string]: unknown;
|
|
25
33
|
/** maybe a DOM click event, if trigger by button click */
|
|
@@ -46,11 +54,6 @@ declare module 'tiddlywiki' {
|
|
|
46
54
|
widget: Widget;
|
|
47
55
|
}
|
|
48
56
|
|
|
49
|
-
export interface IWidgetInitializeOptions {
|
|
50
|
-
wiki?: ITiddlyWiki;
|
|
51
|
-
parentWidget?: Widget;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
57
|
/**
|
|
55
58
|
* @link https://tiddlywiki.com/dev/#Widgets
|
|
56
59
|
*
|
|
@@ -104,7 +107,7 @@ declare module 'tiddlywiki' {
|
|
|
104
107
|
|
|
105
108
|
constructor(
|
|
106
109
|
parseTreeNode: IParseTreeNode,
|
|
107
|
-
options?:
|
|
110
|
+
options?: IWidgetInitialiseOptions,
|
|
108
111
|
);
|
|
109
112
|
|
|
110
113
|
/**
|
|
@@ -115,11 +118,7 @@ declare module 'tiddlywiki' {
|
|
|
115
118
|
*/
|
|
116
119
|
initialise(
|
|
117
120
|
parseTreeNode: IParseTreeNode,
|
|
118
|
-
options?:
|
|
119
|
-
document?: Document;
|
|
120
|
-
parentWidget?: Widget;
|
|
121
|
-
wiki?: ITiddlyWiki;
|
|
122
|
-
},
|
|
121
|
+
options?: IWidgetInitialiseOptions,
|
|
123
122
|
): void;
|
|
124
123
|
|
|
125
124
|
/**
|
|
@@ -141,7 +140,7 @@ declare module 'tiddlywiki' {
|
|
|
141
140
|
* @param {IChangedTiddlers} changedTiddlers Object key is tiddler title, value is metadata about the change
|
|
142
141
|
* @link https://tiddlywiki.com/dev/#Selective%20Update
|
|
143
142
|
*/
|
|
144
|
-
refresh(changedTiddlers: IChangedTiddlers): boolean;
|
|
143
|
+
refresh(changedTiddlers: IChangedTiddlers): boolean | void;
|
|
145
144
|
|
|
146
145
|
/**
|
|
147
146
|
* Compute the internal state of the widget.
|
package/src/modules/wiki.d.ts
CHANGED
|
@@ -4,6 +4,12 @@ declare const getModificationFields: () => {
|
|
|
4
4
|
modifier?: string;
|
|
5
5
|
};
|
|
6
6
|
declare const getTiddlersWithTag: (tag: string) => string[];
|
|
7
|
+
declare const getTextReferenceParserInfo: (
|
|
8
|
+
title: string,
|
|
9
|
+
field?: string,
|
|
10
|
+
index?: string,
|
|
11
|
+
options: { subTiddler: string },
|
|
12
|
+
) => { sourceText: null | string; parserType: string | null };
|
|
7
13
|
|
|
8
14
|
declare module 'tiddlywiki' {
|
|
9
15
|
export interface Wiki {
|
package/src/utils/index.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ type Spread<A extends readonly [...any]> = A extends [infer L, ...infer R]
|
|
|
23
23
|
: unknown;
|
|
24
24
|
|
|
25
25
|
declare module 'tiddlywiki' {
|
|
26
|
-
export type TWDocument = Document;
|
|
26
|
+
export type TWDocument = Document | IFakeDocument;
|
|
27
27
|
export type TWElement = Element;
|
|
28
28
|
export type TWDOMElement = TWElement;
|
|
29
29
|
export type ITWUtils = IUtils;
|
|
@@ -209,10 +209,15 @@ declare module 'tiddlywiki' {
|
|
|
209
209
|
* 产生一个 DOM 元素
|
|
210
210
|
*
|
|
211
211
|
* @param {string} tag tag name
|
|
212
|
-
* @param {IDomMakerOptions}
|
|
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
|
|
@@ -217,7 +216,10 @@ declare module 'tiddlywiki' {
|
|
|
217
216
|
variables: hashmap of variables to set
|
|
218
217
|
parentWidget: optional parent widget for the root node
|
|
219
218
|
*/
|
|
220
|
-
makeWidget(
|
|
219
|
+
makeWidget(
|
|
220
|
+
parser: { tree: IParseTreeNode[] },
|
|
221
|
+
options?: IMakeWidgetOptions,
|
|
222
|
+
): Widget;
|
|
221
223
|
/**
|
|
222
224
|
Make a widget tree for transclusion
|
|
223
225
|
@params title: target tiddler title
|