tw5-typed 0.2.18 → 0.2.20

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.18",
5
+ "version": "0.2.20",
6
6
  "url": "https://github.com/tiddly-gittly/tw5-typed",
7
7
  "homepage": "https://github.com/tiddly-gittly/tw5-typed",
8
8
  "bugs": {
@@ -16,6 +16,9 @@
16
16
  "files": [
17
17
  "src/"
18
18
  ],
19
+ "scripts": {
20
+ "check": "tsc --noEmit && eslint src/**/*.ts"
21
+ },
19
22
  "husky": {
20
23
  "hooks": {
21
24
  "pre-commit": "lint-staged"
@@ -32,16 +35,15 @@
32
35
  "devDependencies": {
33
36
  "@modern-js/eslint-config": "latest",
34
37
  "@modern-js/tsconfig": "latest",
35
- "@types/codemirror": "^5.60.6",
36
- "@types/echarts": "^4.9.16",
37
- "@types/node": "^18.11.9",
38
38
  "husky": "^8.0.2",
39
39
  "lint-staged": "^13.1.0",
40
40
  "rimraf": "^3.0.2",
41
41
  "tiddlywiki": "^5.2.5",
42
42
  "typescript": "^4.9.4"
43
43
  },
44
- "scripts": {
45
- "check": "tsc --noEmit && eslint src/**/*.ts"
44
+ "dependencies": {
45
+ "@types/codemirror": "^5.60.6",
46
+ "@types/echarts": "^4.9.16",
47
+ "@types/node": "^18.11.9"
46
48
  }
47
- }
49
+ }
@@ -1,5 +1,5 @@
1
1
  declare module 'tiddlywiki' {
2
- declare class Story {
2
+ export class Story {
3
3
  wiki: Wiki;
4
4
  storyTitle: string;
5
5
  historyTitle: string;
@@ -14,13 +14,13 @@ declare module 'tiddlywiki' {
14
14
 
15
15
  navigateTiddler(
16
16
  navigateTo: string,
17
- navigateFromTitle: string,
18
- navigateFromClientRect: DOMRect,
17
+ navigateFromTitle?: string,
18
+ navigateFromClientRect?: DOMRect,
19
19
  );
20
20
 
21
21
  addToStory(
22
22
  navigateTo: string,
23
- navigateFromTitle: string,
23
+ navigateFromTitle?: string,
24
24
  options?: {
25
25
  openLinkFromInsideRiver?: 'top' | 'bottom' | 'above' | 'below';
26
26
  },
@@ -28,7 +28,7 @@ declare module 'tiddlywiki' {
28
28
 
29
29
  addToHistory(
30
30
  navigateTo: string | string[],
31
- navigateFromClientRect: DOMRect,
31
+ navigateFromClientRect?: DOMRect,
32
32
  );
33
33
 
34
34
  saveStoryList(storyList: string[] | string);
@@ -9,7 +9,7 @@ declare const addEventListeners: (
9
9
  }[],
10
10
  ) => void;
11
11
 
12
- declare class Notifier {
12
+ export class Notifier {
13
13
  /**
14
14
  * Display a notification
15
15
  * * title: Title of tiddler containing the notification text
@@ -9,6 +9,16 @@ declare module 'tiddlywiki' {
9
9
  deleted?: boolean;
10
10
  modified?: boolean;
11
11
  }
12
+ export interface IWidgetVariableParam {
13
+ name: string;
14
+ default: string;
15
+ }
16
+
17
+ export interface IWidgetVariable {
18
+ value: string;
19
+ params?: IWidgetVariableParam[];
20
+ isMacroDefinition: boolean;
21
+ }
12
22
 
13
23
  export interface IWidgetEvent {
14
24
  [extraKeys: string]: unknown;
@@ -53,7 +63,7 @@ declare module 'tiddlywiki' {
53
63
  * * parentWidget: optional reference to a parent renderer node for the context chain
54
64
  * * document: optional document object to use instead of global document
55
65
  */
56
- export declare class Widget {
66
+ export class Widget {
57
67
  parseTreeNode: IParseTreeNode;
58
68
 
59
69
  wiki: ITiddlyWiki;
@@ -90,14 +100,7 @@ declare module 'tiddlywiki' {
90
100
  * * params: array of {name:, default:} for each parameter
91
101
  * * isMacroDefinition: true if the variable is set via a \define macro pragma (and hence should have variable substitution performed)
92
102
  */
93
- variables: Record<
94
- string,
95
- {
96
- value: string;
97
- params?: { name: string; default: string }[];
98
- isMacroDefinition: boolean;
99
- }
100
- >;
103
+ variables: Record<string, IWidgetVariable>;
101
104
 
102
105
  constructor(
103
106
  parseTreeNode: IParseTreeNode,
@@ -105,17 +108,10 @@ declare module 'tiddlywiki' {
105
108
  );
106
109
 
107
110
  /**
108
- Make child widgets correspondng to specified parseTreeNodes
109
- And push them to `this.children`
110
- @param parseTreeNodes default to `this.parseTreeNode.children`, can be undefined
111
- */
112
- makeChildWidgets(
113
- parseTreeNodes?: IParseTreeNode[],
114
- options?: { variables?: unknown },
115
- ): void;
116
-
117
- /**
111
+ * @en
118
112
  * Initialise widget properties. These steps are pulled out of the constructor so that we can reuse them in subclasses
113
+ * @zh
114
+ * 初始化widget属性。这些步骤被拉出构造函数,以便我们可以在子类中重复使用它们
119
115
  */
120
116
  initialise(
121
117
  parseTreeNode: IParseTreeNode,
@@ -125,146 +121,361 @@ declare module 'tiddlywiki' {
125
121
  wiki?: ITiddlyWiki;
126
122
  },
127
123
  ): void;
124
+
128
125
  /**
129
- * Remove any DOM nodes created by this widget or its children
130
- *
131
- * If this widget has directly created DOM nodes, delete them and exit. This assumes that any child widgets are contained within the created DOM nodes, which would normally be the case.
132
- * Otherwise, ask the child widgets to delete their DOM nodes
126
+ * @en
127
+ * Lifecycle method: Render this widget into the DOM
128
+ * @zh
129
+ * 生命周期方法: 将这个微件渲染到DOM中;
130
+ * 只会在首次渲染、销毁后重新渲染时自动调用,或者通过 refreshSelf 等方法主动调用
133
131
  */
134
- removeChildDomNodes(): void;
132
+ render(parent: Node, nextSibling: Node | null): void;
133
+
135
134
  /**
136
- Construct the widget object for a parse tree node, and return the new widget
137
- options include:
138
- variables: optional hashmap of variables to wrap around the widget
139
- */
140
- makeChildWidget(
141
- parseTreeNode: IParseTreeNode,
142
- options?: { variables?: unknown },
143
- ): Widget;
135
+ * @en
136
+ * Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering.
137
+ * You can do some cleanup or buildup before return true.
138
+ * @zh
139
+ * 如果需要的话,有选择地刷新该微件。如果该微件或其任何子项需要重新渲染,则返回 true。
140
+ * 你可以在返回 true 之前做一些清理或构建工作。
141
+ * @param {IChangedTiddlers} changedTiddlers Object key is tiddler title, value is metadata about the change
142
+ * @link https://tiddlywiki.com/dev/#Selective%20Update
143
+ */
144
+ refresh(changedTiddlers: IChangedTiddlers): boolean;
145
+
144
146
  /**
145
- Add an event listener
146
- */
147
- addEventListener(
148
- type: string,
149
- handler: (event: IWidgetEvent) => void | Promise<void>,
147
+ * Compute the internal state of the widget.
148
+ * This will be automatically called in the `render` method.
149
+ *
150
+ * For example, `getAttribute` and set them to class members.
151
+ */
152
+ execute(): void;
153
+
154
+ /**
155
+ * @en
156
+ * Set the value of a context variable
157
+ * @zh
158
+ * 设置一个上下文变量的值
159
+ *
160
+ * @param {string } name name of the variable
161
+ * @param {string} value value of the variable
162
+ * @param {IWidgetVariableParam[]} [params=[]] array of {name:, default:} for each parameter
163
+ * @param {boolean} [isMacroDefinition=true] true if the variable is set via a \define macro pragma (and hence should have variable substitution performed)
164
+ */
165
+ setVariable(
166
+ name: string,
167
+ value: string,
168
+ parameters?: IWidgetVariableParam[],
169
+ isMacroDefinition?: boolean,
150
170
  ): void;
171
+
172
+ /**
173
+ * Get variable in the context of the widget.
174
+ * Simplified version of getVariableInfo() that just returns the text.
175
+ * @param name variable name, for example, `currentTiddler` in the widget context
176
+ * @param options options for getVariableInfo()
177
+ *
178
+ * Options include
179
+ * * params: array of {name:, value:} for each parameter
180
+ * * defaultValue: default value if the variable is not defined
181
+ *
182
+ * Returns an object with the following fields:
183
+ * * params: array of {name:,value:} of parameters passed to wikitext variables
184
+ * * text: text of variable, with parameters properly substituted
185
+ *
186
+ * @param {string} name
187
+ * @param {{ params?: IWidgetVariableParam[]; defaultValue: string }} [options]
188
+ * @return {*} {{
189
+ * text: string;
190
+ * params?: IWidgetVariableParam[];
191
+ * srcVariable?: IWidgetVariable;
192
+ * isCacheable?: boolean;
193
+ * }}
194
+ * @memberof Widget
195
+ */
196
+ getVariableInfo(
197
+ name: string,
198
+ options?: { params?: IWidgetVariableParam[]; defaultValue: string },
199
+ ): {
200
+ text: string;
201
+ params?: IWidgetVariableParam[];
202
+ srcVariable?: IWidgetVariable;
203
+ isCacheable?: boolean;
204
+ };
205
+
151
206
  /**
152
- Dispatch an event to a widget. If the widget doesn't handle the event then it is also dispatched to the parent widget
207
+ * Simplified version of getVariableInfo() that just returns the text
208
+ *
209
+ * @param {string} name
210
+ * @param {{ params?: IWidgetVariableParam[]; defaultValue: string }} [options]
211
+ * @return {*} {string}
212
+ * @memberof Widget
213
+ */
214
+ getVariable(
215
+ name: string,
216
+ options?: { params?: IWidgetVariableParam[]; defaultValue: string },
217
+ ): string;
218
+
219
+ resolveVariableParameters(
220
+ formalParams?: IWidgetVariableParam[],
221
+ actualParams?: IWidgetVariableParam[],
222
+ ): IWidgetVariableParam[];
223
+
224
+ substituteVariableReferences(
225
+ text: string,
226
+ options: { variables: Record<string, string> },
227
+ ): string;
228
+
229
+ evaluateMacroModule(
230
+ name: string,
231
+ actualParams: IWidgetVariableParam[],
232
+ defaultValue: string,
233
+ ): string;
153
234
 
154
- Events added via `addEventListener`, like `tm-notify`, can be invoked by this.
155
- */
156
- dispatchEvent(typeOrEvent: string | Omit<IWidgetEvent, 'widget'>): void;
157
235
  /**
158
- Add a list of event listeners from an array [{type:,handler:},...]
159
- */
160
- addEventListeners(
161
- listeners: Array<{
162
- handler: (event: IWidgetEvent) => void | Promise<void>;
163
- type: string;
164
- }>,
165
- ): void;
236
+ * @en
237
+ * Check whether a given context variable value exists in the parent chain
238
+ * @zh
239
+ * 检查一个给定的上下文变量值是否存在于父链中
240
+ *
241
+ * @param {string} name
242
+ * @param {string} value
243
+ * @return {*} {boolean}
244
+ * @memberof Widget
245
+ */
246
+ hasVariable(name: string, value: string): boolean;
166
247
 
167
248
  /**
168
- Compute the internal state of the widget.
169
- This will be automatically called in the `render` method.
249
+ * @en
250
+ * Construct a qualifying string based on a hash of concatenating the values of a given variable in the parent chain
251
+ * @zh
252
+ * 在连接父链中给定变量值的哈希基础上构建一个限定字符串
253
+ *
254
+ * @param {string} name
255
+ * @return {*} {string}
256
+ * @memberof Widget
257
+ */
258
+ getStateQualifier(name: string): string;
170
259
 
171
- For example, `getAttribute` and set them to class members.
260
+ /**
261
+ * @en
262
+ * Compute the current values of the attributes of the widget. Returns a hashmap of the names of the attributes that have changed
263
+ * @zh
264
+ * 计算微件的属性的当前值。返回一个已经改变的属性名称的哈希图
265
+ *
266
+ * @return {*} {Record<string, true>}
267
+ * @memberof Widget
268
+ */
269
+ computeAttributes(): Record<string, true>;
270
+
271
+ computeAttribute(attribute: string): string;
172
272
 
173
- */
174
- execute(): void;
175
273
  /**
176
- * Invoke the action widgets that are descendents of the current widget. Will call child widget's invokeAction recursively.
274
+ * @en
275
+ * Check for the presence of an evaluated attribute on the widget. Note that attributes set to a missing variable (ie `attr=<<missing>>`) will be treated as missing
276
+ * @zh
277
+ * 检查微件上是否存在一个已评估的属性。请注意,设置为缺失变量的属性(即`attr=<<missing>>`)将被视为缺失。
177
278
  *
178
- * @param triggeringWidget
179
- * @param event
180
- * @returns handled by any children
279
+ * @param {string} attribute
280
+ * @return {*} {boolean}
281
+ * @memberof Widget
181
282
  */
182
- invokeActions(triggeringWidget: Widget, event: IWidgetEvent): boolean;
283
+ hasAttribute(attribute: string): boolean;
284
+
183
285
  /**
184
- * Invoke the action associated with this widget
286
+ * @en
287
+ * Check for the presence of a raw attribute on the widget parse tree node. Note that attributes set to a missing variable (ie `attr=<<missing>>`) will NOT be treated as missing
288
+ * @zh
289
+ * 检查微件解析树节点上是否存在原始属性。注意,设置为缺失变量的属性(即`ttr=<<missing>>`)不会被视为缺失。
185
290
  *
186
- * No every widget has this method, but some do, like `action-xxx` widget, e.g., `action-sendmessage`
187
- * @param triggeringWidget
188
- * @param event
189
- * @returns handled
291
+ * @param {string} attribute
292
+ * @return {*} {boolean}
293
+ * @memberof Widget
190
294
  */
191
- invokeAction(
192
- triggeringWidget: Widget,
193
- event: IWidgetEvent,
194
- ): boolean | undefined;
295
+ hasParseTreeNodeAttribute(attribute: string): boolean;
195
296
 
196
297
  /**
197
- * Lifecycle method: Render this widget into the DOM
298
+ * @en
299
+ * Get parameters that user set in the widget
300
+ * @zh
301
+ * 获取用户在小组件中设置的参数
302
+ *
303
+ * @param {string} name attribute name, for example, `actions` in the button widget
304
+ * @param {string} [fallbackText] default value if the attribute is not set
305
+ * @return {*} {string}
306
+ * @memberof Widget
198
307
  */
199
- render(parent: Node, nextSibling: Node | null): void;
308
+ getAttribute(name: string, fallbackText?: string): string;
309
+
310
+ /**
311
+ * @en
312
+ * Assign the computed attributes of the widget to a domNode
313
+ * options include:
314
+ * * `excludeEventAttributes`: ignores attributes whose name begins with "on"
315
+ * @zh
316
+ * 将微件的计算属性分配给一个domNode, 选项包括:
317
+ * * `excludeEventAttributes`: 忽略名称以 "on "开头的属性
318
+ * 一些特殊的属性:
319
+ * * `xlink:<xlink-name>`
320
+ * * `style.<css-style-name>`
321
+ *
322
+ * @param {*} domNode
323
+ * @param {*} options
324
+ * @memberof Widget
325
+ */
326
+ assignAttributes(
327
+ domNode: Node,
328
+ options?: { excludeEventAttributes?: boolean },
329
+ );
330
+
331
+ /**
332
+ * @en
333
+ * Get the number of ancestor widgets for this widget
334
+ * @zh
335
+ * 获取这个微件的祖先微件的数量
336
+ *
337
+ * @return {*} {number}
338
+ * @memberof Widget
339
+ */
340
+ getAncestorCount(): number;
341
+
342
+ /**
343
+ * Make child widgets correspondng to specified parseTreeNodes
344
+ * And push them to `this.children`
345
+ * @param parseTreeNodes default to `this.parseTreeNode.children`, can be undefined
346
+ */
347
+ makeChildWidgets(
348
+ parseTreeNodes?: IParseTreeNode[],
349
+ options?: { variables?: unknown },
350
+ ): void;
351
+
352
+ /**
353
+ * Construct the widget object for a parse tree node, and return the new widget
354
+ * options include:
355
+ * variables: optional hashmap of variables to wrap around the widget
356
+ */
357
+ makeChildWidget(
358
+ parseTreeNode: IParseTreeNode,
359
+ options?: { variables?: unknown },
360
+ ): Widget;
361
+
362
+ /**
363
+ * @en
364
+ * Get the next sibling of this widget
365
+ *
366
+ * @return {*} {(Widget | null)}
367
+ * @memberof Widget
368
+ */
369
+ nextSibling(): Widget | null;
370
+
371
+ /**
372
+ * @en
373
+ * Get the previous sibling of this widget
374
+ *
375
+ * @return {*} {(Widget | null)}
376
+ * @memberof Widget
377
+ */
378
+ previousSibling(): Widget | null;
379
+
200
380
  /**
201
381
  * Render the children of this widget into the DOM
202
382
  */
203
383
  renderChildren(parent: Node, nextSibling: Node | null): void;
384
+
204
385
  /**
205
- * Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering.
206
- * You can do some cleanup or buildup before return true.
207
- * @param changedTiddlers Object key is tiddler title, value is metadata about the change
208
- * @link https://tiddlywiki.com/dev/#Selective%20Update
386
+ * Add a list of event listeners from an array [{type:,handler:},...]
209
387
  */
210
- refresh(changedTiddlers: IChangedTiddlers): boolean;
388
+ addEventListeners(
389
+ listeners: {
390
+ handler: (event: IWidgetEvent) => void | Promise<void>;
391
+ type: string;
392
+ }[],
393
+ ): void;
394
+
211
395
  /**
212
- Refresh all the children of a widget
213
- will call `this.render`
396
+ * Add an event listener
397
+ */
398
+ addEventListener(
399
+ type: string,
400
+ handler: (event: IWidgetEvent) => void | Promise<void>,
401
+ ): void;
402
+
403
+ /**
404
+ * Dispatch an event to a widget. If the widget doesn't handle the event then it is also dispatched to the parent widget
405
+ * Events added via `addEventListener`, like `tm-notify`, can be invoked by this.
406
+ */
407
+ dispatchEvent(typeOrEvent: string | Omit<IWidgetEvent, 'widget'>): void;
214
408
 
215
- Need to call this after `setVariable`
216
- */
217
- refreshChildren(changedTiddlers?: IChangedTiddlers): boolean;
218
409
  /**
219
410
  * Rebuild a previously rendered widget
220
411
  */
221
412
  refreshSelf(): boolean | void;
413
+
414
+ /**
415
+ * Refresh all the children of a widget, will call `this.render`.
416
+ * Need to call this after `setVariable`
417
+ */
418
+ refreshChildren(changedTiddlers?: IChangedTiddlers): boolean;
419
+
222
420
  /**
223
421
  * Find the next sibling in the DOM to this widget. This is done by scanning the widget tree through all next siblings and their descendents that share the same parent DOM node
224
422
  * @param startIndex Refer to this widget by its index within its parents children
225
423
  */
226
424
  findNextSiblingDomNode(startIndex?: number): Node | null;
425
+
227
426
  /**
228
427
  * Find the first DOM node generated by a widget or its children
229
428
  */
230
429
  findFirstDomNode(): Node | null;
231
- computeAttributes(): Record<string, IParseTreeAttribute>;
430
+
232
431
  /**
233
- * Get parameters that user set in the widget
234
- * @param name attribute name, for example, `actions` in the button widget
235
- * @param fallbackText default value if the attribute is not set
432
+ * Remove any DOM nodes created by this widget or its children
433
+ *
434
+ * If this widget has directly created DOM nodes, delete them and exit. This assumes that any child widgets are contained within the created DOM nodes, which would normally be the case.
435
+ * Otherwise, ask the child widgets to delete their DOM nodes
236
436
  */
237
- getAttribute(name: string, fallbackText?: string): string;
437
+ removeChildDomNodes(): void;
438
+
238
439
  /**
239
- * Get variable in the context of the widget.
240
- * Simplified version of getVariableInfo() that just returns the text.
241
- * @param name variable name, for example, `currentTiddler` in the widget context
242
- * @param options options for getVariableInfo()
440
+ * Invoke the action associated with this widget
243
441
  *
244
- * Options include
245
- params: array of {name:, value:} for each parameter
246
- defaultValue: default value if the variable is not defined
247
-
248
- Returns an object with the following fields:
249
-
250
- params: array of {name:,value:} of parameters passed to wikitext variables
251
- text: text of variable, with parameters properly substituted
442
+ * No every widget has this method, but some do, like `action-xxx` widget, e.g., `action-sendmessage`
443
+ * @param triggeringWidget
444
+ * @param event
445
+ * @returns handled
252
446
  */
253
- getVariable(name: string, options?: object): string;
447
+ invokeAction?(
448
+ triggeringWidget: Widget,
449
+ event: IWidgetEvent,
450
+ ): boolean | undefined;
451
+
254
452
  /**
255
- Set the value of a context variable
453
+ * @en
454
+ * Invoke the action widgets that are descendents of the current widget.
455
+ *
456
+ * @param {Widget} triggeringWidget
457
+ * @param {IWidgetEvent} event
458
+ * @memberof Widget
459
+ */
460
+ invokeActions(triggeringWidget: Widget, event: IWidgetEvent): boolean;
256
461
 
257
- @param name name of the variable
258
- @param value value of the variable
259
- @param params array of {name:, default:} for each parameter
260
- @param isMacroDefinition true if the variable is set via a \define macro pragma (and hence should have variable substitution performed)
261
- */
262
- setVariable(
263
- name: string,
264
- value: string,
265
- parameters?: object[],
266
- isMacroDefinition?: boolean,
267
- ): void;
462
+ /**
463
+ * @en
464
+ * Invoke the action widgets defined in a string
465
+ *
466
+ * @param {string} actions
467
+ * @param {Widget} triggeringWidget
468
+ * @param {IWidgetEvent} event
469
+ * @param {Record<string, IWidgetVariable>} variables
470
+ * @return {*} {boolean}
471
+ * @memberof Widget
472
+ */
473
+ invokeActionString(
474
+ actions: string,
475
+ triggeringWidget: Widget,
476
+ event: IWidgetEvent,
477
+ variables: Record<string, IWidgetVariable>,
478
+ ): boolean;
268
479
  }
269
480
 
270
481
  export interface IFakeDocument {
@@ -311,7 +522,7 @@ declare module 'tiddlywiki' {
311
522
  };
312
523
  }
313
524
 
314
- export module '$:/core/modules/widgets/widget.js' {
525
+ declare module '$:/core/modules/widgets/widget.js' {
315
526
  import { Widget } from 'tiddlywiki';
316
527
  export { Widget as widget };
317
528
  }
@@ -6,7 +6,7 @@ declare const getModificationFields: () => {
6
6
  declare const getTiddlersWithTag: (tag: string) => string[];
7
7
 
8
8
  declare module 'tiddlywiki' {
9
- class Wiki {
9
+ export interface Wiki {
10
10
  getCreationFields: typeof getCreationFields;
11
11
 
12
12
  getModificationFields: typeof getModificationFields;
@@ -197,13 +197,9 @@ declare module 'tiddlywiki' {
197
197
  * $tw.utils.each([1, 2, 3], element => console.log(element));
198
198
  * $tw.utils.each({ a: 1, b: 2 }, (value, key) => console.log(key, value));
199
199
  */
200
- each: <T>(
200
+ each: <T, K = T extends Array<any> ? number : keyof T>(
201
201
  object: T,
202
- callback: (
203
- element: T[keyof T],
204
- index: keyof T,
205
- object: T,
206
- ) => void | false,
202
+ callback: (element: T[K], index: K, object: T) => void | false,
207
203
  ) => void;
208
204
 
209
205
  /**
@@ -213,10 +209,10 @@ declare module 'tiddlywiki' {
213
209
  * 产生一个 DOM 元素
214
210
  *
215
211
  * @param {string} tag tag name
216
- * @param {IDomMakerOptions} options
212
+ * @param {IDomMakerOptions} [options]
217
213
  * @returns {TWElement}
218
214
  */
219
- domMaker: (tag: string, options: IDomMakerOptions) => TWElement;
215
+ domMaker: (tag: string, options?: IDomMakerOptions) => TWElement;
220
216
 
221
217
  /**
222
218
  * @en
@@ -257,6 +257,6 @@ declare module 'tiddlywiki' {
257
257
  getShadowSource(title: string): string | null;
258
258
  getTiddlerBacklinks(targetTitle: string): string[];
259
259
  getTiddlerLinks(title: string): string[];
260
- getPluginInfo(title: string): { tiddlers: ITiddlerFields[] };
260
+ getPluginInfo(title: string): { tiddlers: Record<string, ITiddlerFields> };
261
261
  }
262
262
  }