tw5-typed 0.2.9 → 0.2.10
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 +16 -16
- package/src/Wiki.d.ts +13 -5
- package/src/ast.d.ts +1 -0
- package/src/utils.d.ts +4 -0
- package/src/widget.d.ts +9 -7
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.10",
|
|
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": "^
|
|
24
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
25
|
-
"@typescript-eslint/parser": "5.
|
|
26
|
-
"eslint": "8.
|
|
23
|
+
"@types/node": "^18.11.9",
|
|
24
|
+
"@typescript-eslint/eslint-plugin": "5.44.0",
|
|
25
|
+
"@typescript-eslint/parser": "5.44.0",
|
|
26
|
+
"eslint": "8.28.0",
|
|
27
27
|
"eslint-config-prettier": "8.5.0",
|
|
28
28
|
"eslint-config-standard": "17.0.0",
|
|
29
|
-
"eslint-config-standard-with-typescript": "
|
|
29
|
+
"eslint-config-standard-with-typescript": "23.0.0",
|
|
30
30
|
"eslint-import-resolver-alias": "1.1.2",
|
|
31
|
-
"eslint-import-resolver-typescript": "
|
|
32
|
-
"eslint-plugin-html": "
|
|
31
|
+
"eslint-import-resolver-typescript": "3.5.2",
|
|
32
|
+
"eslint-plugin-html": "7.1.0",
|
|
33
33
|
"eslint-plugin-import": "2.26.0",
|
|
34
|
-
"eslint-plugin-n": "15.
|
|
34
|
+
"eslint-plugin-n": "15.5.1",
|
|
35
35
|
"eslint-plugin-node": "11.1.0",
|
|
36
|
-
"eslint-plugin-prettier": "4.
|
|
37
|
-
"eslint-plugin-promise": "6.
|
|
38
|
-
"eslint-plugin-react": "7.
|
|
39
|
-
"eslint-plugin-react-hooks": "4.
|
|
36
|
+
"eslint-plugin-prettier": "4.2.1",
|
|
37
|
+
"eslint-plugin-promise": "6.1.1",
|
|
38
|
+
"eslint-plugin-react": "7.31.11",
|
|
39
|
+
"eslint-plugin-react-hooks": "4.6.0",
|
|
40
40
|
"eslint-plugin-security": "1.5.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": "45.0.0",
|
|
44
|
+
"prettier": "2.8.0",
|
|
45
|
+
"typescript": "4.9.3"
|
|
46
46
|
}
|
|
47
47
|
}
|
package/src/Wiki.d.ts
CHANGED
|
@@ -95,10 +95,12 @@ declare module 'tiddlywiki' {
|
|
|
95
95
|
|
|
96
96
|
Alternative, uncached version of getTiddlerDataCached(). The return value can be mutated freely and reused
|
|
97
97
|
*/
|
|
98
|
-
getTiddlerData<D extends Record<
|
|
99
|
-
getTiddlerData<D extends Record<
|
|
98
|
+
getTiddlerData<D extends Record<any, unknown> | any[] | undefined>(titleOrTiddler: string, fallbackData?: D): D;
|
|
99
|
+
getTiddlerData<D extends Record<any, unknown> | any[] | undefined>(titleOrTiddler: Tiddler, fallbackData?: D): D;
|
|
100
100
|
/**
|
|
101
|
-
|
|
101
|
+
* D is any JSON, like JSON object or JSON array
|
|
102
|
+
*
|
|
103
|
+
* Get the content of a tiddler as a JavaScript object. How this is done depends on the type of the tiddler:
|
|
102
104
|
|
|
103
105
|
application/json: the tiddler JSON is parsed into an object
|
|
104
106
|
application/x-tiddler-dictionary: the tiddler is parsed as sequence of name:value pairs
|
|
@@ -110,8 +112,8 @@ declare module 'tiddlywiki' {
|
|
|
110
112
|
|
|
111
113
|
Note that the same value is returned for repeated calls for the same tiddler data. The value is frozen to prevent modification; otherwise modifications would be visible to all callers
|
|
112
114
|
*/
|
|
113
|
-
getTiddlerDataCached<D
|
|
114
|
-
getTiddlerDataCached<D
|
|
115
|
+
getTiddlerDataCached<D>(titleOrTiddler: string, fallbackData?: D): D;
|
|
116
|
+
getTiddlerDataCached<D>(titleOrTiddler: Tiddler, fallbackData?: D): D;
|
|
115
117
|
/**
|
|
116
118
|
* Set tiddler text of any field.
|
|
117
119
|
*
|
|
@@ -196,5 +198,11 @@ declare module 'tiddlywiki' {
|
|
|
196
198
|
recursionMarker?: 'yes' | 'no';
|
|
197
199
|
} & IMakeWidgetOptions,
|
|
198
200
|
): Widget;
|
|
201
|
+
/** Test for the existence of a tiddler (excludes shadow tiddlers) */
|
|
202
|
+
tiddlerExists(title: string): boolean;
|
|
203
|
+
/** Determines if a tiddler is a shadow tiddler, regardless of whether it has been overridden by a real tiddler */
|
|
204
|
+
isShadowTiddler(title: string): boolean;
|
|
205
|
+
/** return shadowTiddlers[title].source; */
|
|
206
|
+
getShadowSource(title: string): string | null;
|
|
199
207
|
}
|
|
200
208
|
}
|
package/src/ast.d.ts
CHANGED
package/src/utils.d.ts
CHANGED
|
@@ -39,6 +39,10 @@ declare module 'tiddlywiki' {
|
|
|
39
39
|
* Missing or malformed version strings are parsed as 0.0.0
|
|
40
40
|
*/
|
|
41
41
|
compareVersions(versionStringA: string, versionStringB: string): -1 | 0 | 1;
|
|
42
|
+
/*
|
|
43
|
+
Return the number of keys in an object
|
|
44
|
+
*/
|
|
45
|
+
count(object: Record<string, any>): number;
|
|
42
46
|
/** Convert a URIComponent encoded string to a string safely */
|
|
43
47
|
decodeURIComponentSafe(uri: string): string;
|
|
44
48
|
/** Convert a URI encoded string to a string safely */
|
package/src/widget.d.ts
CHANGED
|
@@ -45,6 +45,7 @@ declare module 'tiddlywiki' {
|
|
|
45
45
|
initialize(parseTreeNode: IParseTreeNode, options?: unknown): void;
|
|
46
46
|
parseTreeNode: IParseTreeNode;
|
|
47
47
|
wiki: ITiddlyWiki;
|
|
48
|
+
document: IFakeDocument;
|
|
48
49
|
parentWidget?: Widget;
|
|
49
50
|
/** we can use $tw.rootWidget.widgetClasses.widget to new a widget
|
|
50
51
|
*
|
|
@@ -85,6 +86,8 @@ declare module 'tiddlywiki' {
|
|
|
85
86
|
addEventListener(type: string, handler: (event: IWidgetEvent) => void | Promise<void>): void;
|
|
86
87
|
/**
|
|
87
88
|
Dispatch an event to a widget. If the widget doesn't handle the event then it is also dispatched to the parent widget
|
|
89
|
+
|
|
90
|
+
Events added via `addEventListener`, like `tm-notify`, can be invoked by this.
|
|
88
91
|
*/
|
|
89
92
|
dispatchEvent(typeOrEvent: string | Omit<IWidgetEvent, 'widget'>): void;
|
|
90
93
|
/**
|
|
@@ -185,16 +188,15 @@ declare module 'tiddlywiki' {
|
|
|
185
188
|
isTiddlyWikiFakeDom: boolean;
|
|
186
189
|
setSequenceNumber: (value: any) => void;
|
|
187
190
|
}
|
|
188
|
-
export
|
|
189
|
-
isTiddlyWikiFakeDom: boolean;
|
|
190
|
-
tag: string;
|
|
191
|
-
attributes: Record<string, unknown>;
|
|
192
|
-
isRaw: boolean;
|
|
193
|
-
children: Array<TW_Element | TW_TextNode>;
|
|
191
|
+
export interface TW_Element extends HTMLElement {
|
|
194
192
|
_style: Record<string, unknown>;
|
|
193
|
+
appendChild: <T extends TW_Element | TW_TextNode | Node>(node: T) => T;
|
|
194
|
+
isRaw: boolean;
|
|
195
|
+
isTiddlyWikiFakeDom: boolean;
|
|
195
196
|
namespaceURI: string;
|
|
197
|
+
tag: string;
|
|
196
198
|
}
|
|
197
|
-
export
|
|
199
|
+
export interface TW_TextNode extends Node {
|
|
198
200
|
textContent: string;
|
|
199
201
|
}
|
|
200
202
|
}
|