tw5-typed 0.2.3 → 0.2.4

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/Wiki.d.ts +20 -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.3",
5
+ "version": "0.2.4",
6
6
  "url": "https://github.com/tiddly-gittly/tw5-typed",
7
7
  "homepage": "https://github.com/tiddly-gittly/tw5-typed",
8
8
  "bugs": {
package/src/Wiki.d.ts CHANGED
@@ -1,9 +1,15 @@
1
1
  /// <reference path="parser.d.ts" />
2
2
 
3
3
  declare module 'tiddlywiki' {
4
- export interface IMakeWidgetOptions {
4
+ export interface IMakeWidgetOptions extends IRenderOptions {
5
5
  document: typeof document | IFakeDocument;
6
+ }
7
+
8
+ export type OutputMimeTypes = 'text/html' | 'text/plain-formatted' | 'text/plain';
9
+ export type TextMimeTypes = 'text/html' | 'text/vnd.tiddlywiki' | 'text/plain';
10
+ export interface IRenderOptions {
6
11
  parentWidget?: Widget;
12
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
7
13
  variables?: Record<string, any>;
8
14
  }
9
15
  export class Wiki {
@@ -87,7 +93,7 @@ declare module 'tiddlywiki' {
87
93
  * @param {string} value text content to set
88
94
  * @param {object} options options, see tiddlywiki dev doc for details
89
95
  */
90
- setText: (title: string, field?: string, index?: string | undefined, value?: string, options?: any) => void;
96
+ setText: (title: string, field?: string, index?: string | undefined, value?: string, options?: { suppressTimestamp?: boolean }) => void;
91
97
  parseTiddler(title: string, options?: IParserOptions): WikiParser;
92
98
  parseText(type: string, text: string, options?: IParserOptions): WikiParser;
93
99
  /**
@@ -99,11 +105,7 @@ declare module 'tiddlywiki' {
99
105
  variables: hashmap of variables to set
100
106
  parentWidget: optional parent widget for the root node
101
107
  */
102
- renderTiddler(
103
- outputType: 'text/html' | 'text/plain-formatted' | 'text/plain',
104
- title: string,
105
- options?: { parentWidget?: Widget; variables?: Record<string, any> },
106
- ): string;
108
+ renderTiddler(outputType: OutputMimeTypes, title: string, options?: IRenderOptions): string;
107
109
  /**
108
110
  Make a widget tree for a parse tree
109
111
  @params parser: parser object
@@ -113,6 +115,17 @@ declare module 'tiddlywiki' {
113
115
  variables: hashmap of variables to set
114
116
  parentWidget: optional parent widget for the root node
115
117
  */
118
+ /**
119
+ Parse text in a specified format and render it into another format
120
+ outputType: content type for the output
121
+ textType: content type of the input text
122
+ text: input text
123
+ options: see below
124
+ Options include:
125
+ variables: hashmap of variables to set
126
+ parentWidget: optional parent widget for the root node
127
+ */
128
+ renderText(outputType: OutputMimeTypes, textType: TextMimeTypes, text: string, options?: IRenderOptions): string;
116
129
  makeWidget(parser: WikiParser, options?: IMakeWidgetOptions): Widget;
117
130
  /**
118
131
  Make a widget tree for transclusion