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 CHANGED
@@ -2,7 +2,7 @@
2
2
  "description": "Types for tiddlywiki",
3
3
  "license": "MIT",
4
4
  "name": "tw5-typed",
5
- "version": "0.3.7",
5
+ "version": "0.3.8",
6
6
  "url": "https://github.com/tiddly-gittly/tw5-typed",
7
7
  "homepage": "https://github.com/tiddly-gittly/tw5-typed",
8
8
  "bugs": {
@@ -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 variable in the context of the widget.
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
- * @param {string} name
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?: { params?: IWidgetVariableParam[]; defaultValue: string },
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[],
@@ -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
  /**