tw5-typed 0.2.20 → 0.2.21

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.20",
5
+ "version": "0.2.21",
6
6
  "url": "https://github.com/tiddly-gittly/tw5-typed",
7
7
  "homepage": "https://github.com/tiddly-gittly/tw5-typed",
8
8
  "bugs": {
@@ -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
  }
@@ -4,7 +4,7 @@ declare module 'tiddlywiki' {
4
4
  storyTitle: string;
5
5
  historyTitle: string;
6
6
 
7
- constructor(options: {
7
+ constructor(options?: {
8
8
  wiki?: Wiki;
9
9
  storyTitle?: string;
10
10
  historyTitle?: string;
@@ -20,6 +20,14 @@ declare module 'tiddlywiki' {
20
20
  isMacroDefinition: boolean;
21
21
  }
22
22
 
23
+ export interface IWidgetInitialiseOptions {
24
+ document?: Document;
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?: IWidgetInitializeOptions,
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.
@@ -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 {
@@ -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,10 @@ declare module 'tiddlywiki' {
209
209
  * 产生一个 DOM 元素
210
210
  *
211
211
  * @param {string} tag tag name
212
- * @param {IDomMakerOptions} [options]
212
+ * @param {IDomMakerOptions} options
213
213
  * @returns {TWElement}
214
214
  */
215
- domMaker: (tag: string, options?: IDomMakerOptions) => TWElement;
215
+ domMaker: (tag: string, options: IDomMakerOptions) => TWElement;
216
216
 
217
217
  /**
218
218
  * @en
@@ -217,7 +217,10 @@ declare module 'tiddlywiki' {
217
217
  variables: hashmap of variables to set
218
218
  parentWidget: optional parent widget for the root node
219
219
  */
220
- makeWidget(parser: WikiParser, options?: IMakeWidgetOptions): Widget;
220
+ makeWidget(
221
+ parser: { tree: IParseTreeNode[] },
222
+ options?: IMakeWidgetOptions,
223
+ ): Widget;
221
224
  /**
222
225
  Make a widget tree for transclusion
223
226
  @params title: target tiddler title