tw5-typed 0.3.7 → 0.3.8
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 +1 -1
- package/src/modules/widgets/index.d.ts +14 -22
- package/src/wiki/index.d.ts +6 -0
package/package.json
CHANGED
|
@@ -56,6 +56,13 @@ declare module 'tiddlywiki' {
|
|
|
56
56
|
widget: Widget;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
export interface IGetWidgetVariableOptions {
|
|
60
|
+
params?: IWidgetVariableParam[];
|
|
61
|
+
defaultValue?: string;
|
|
62
|
+
allowSelfAssigned?: boolean;
|
|
63
|
+
source?: (iter: SourceIterator) => void;
|
|
64
|
+
}
|
|
65
|
+
|
|
59
66
|
/**
|
|
60
67
|
* @link https://tiddlywiki.com/dev/#Widgets
|
|
61
68
|
*
|
|
@@ -171,32 +178,25 @@ declare module 'tiddlywiki' {
|
|
|
171
178
|
): void;
|
|
172
179
|
|
|
173
180
|
/**
|
|
174
|
-
* Get
|
|
175
|
-
* Simplified version of getVariableInfo() that just returns the text.
|
|
181
|
+
* Get the prevailing value of a context variable
|
|
176
182
|
* @param name variable name, for example, `currentTiddler` in the widget context
|
|
177
183
|
* @param options options for getVariableInfo()
|
|
178
184
|
*
|
|
179
185
|
* Options include
|
|
180
186
|
* * params: array of {name:, value:} for each parameter
|
|
181
187
|
* * defaultValue: default value if the variable is not defined
|
|
188
|
+
* * source: optional source iterator for evaluating function invocations
|
|
189
|
+
* * allowSelfAssigned: if true, includes the current widget in the context chain instead of just the parent
|
|
182
190
|
*
|
|
183
191
|
* Returns an object with the following fields:
|
|
184
192
|
* * params: array of {name:,value:} of parameters passed to wikitext variables
|
|
185
193
|
* * text: text of variable, with parameters properly substituted
|
|
186
|
-
*
|
|
187
|
-
*
|
|
188
|
-
* @param {{ params?: IWidgetVariableParam[]; defaultValue: string }} [options]
|
|
189
|
-
* @return {*} {{
|
|
190
|
-
* text: string;
|
|
191
|
-
* params?: IWidgetVariableParam[];
|
|
192
|
-
* srcVariable?: IWidgetVariable;
|
|
193
|
-
* isCacheable?: boolean;
|
|
194
|
-
* }}
|
|
195
|
-
* @memberof Widget
|
|
194
|
+
* * resultList: result of variable evaluation as an array
|
|
195
|
+
* * srcVariable: reference to the object defining the variable
|
|
196
196
|
*/
|
|
197
197
|
getVariableInfo(
|
|
198
198
|
name: string,
|
|
199
|
-
options?:
|
|
199
|
+
options?: IGetWidgetVariableOptions,
|
|
200
200
|
): {
|
|
201
201
|
text: string;
|
|
202
202
|
params?: IWidgetVariableParam[];
|
|
@@ -206,16 +206,8 @@ declare module 'tiddlywiki' {
|
|
|
206
206
|
|
|
207
207
|
/**
|
|
208
208
|
* Simplified version of getVariableInfo() that just returns the text
|
|
209
|
-
*
|
|
210
|
-
* @param {string} name
|
|
211
|
-
* @param {{ params?: IWidgetVariableParam[]; defaultValue: string }} [options]
|
|
212
|
-
* @return {*} {string}
|
|
213
|
-
* @memberof Widget
|
|
214
209
|
*/
|
|
215
|
-
getVariable(
|
|
216
|
-
name: string,
|
|
217
|
-
options?: { params?: IWidgetVariableParam[]; defaultValue: string },
|
|
218
|
-
): string;
|
|
210
|
+
getVariable(name: string, options?: IGetWidgetVariableOptions): string;
|
|
219
211
|
|
|
220
212
|
resolveVariableParameters(
|
|
221
213
|
formalParams?: IWidgetVariableParam[],
|
package/src/wiki/index.d.ts
CHANGED
|
@@ -34,6 +34,12 @@ declare module 'tiddlywiki' {
|
|
|
34
34
|
* Get full list of tiddler titles in the wiki
|
|
35
35
|
*/
|
|
36
36
|
getTiddlers(): string[];
|
|
37
|
+
/**
|
|
38
|
+
* Get JSON string of tiddlers. Note that this will make lists like tags/list to be string, instead of array.
|
|
39
|
+
* @param filter Filter string
|
|
40
|
+
* @param spaces Last arg of `JSON.stringify`, default is `' '`
|
|
41
|
+
*/
|
|
42
|
+
getTiddlersAsJson(filter: string, spaces?: string): string;
|
|
37
43
|
deleteTiddler(title: string): void;
|
|
38
44
|
each(callback: (tiddler: Tiddler, title: string) => void): void;
|
|
39
45
|
/**
|