tw5-typed 0.3.5 → 0.3.7

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.5",
5
+ "version": "0.3.7",
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/core.d.ts CHANGED
@@ -7,7 +7,6 @@
7
7
  /// <reference path="plugins/index.d.ts" />
8
8
 
9
9
  declare module 'tiddlywiki' {
10
-
11
10
  export interface IPluginInfo {
12
11
  version: string;
13
12
  'plugin-type': string;
@@ -32,7 +31,7 @@ declare module 'tiddlywiki' {
32
31
  * Presents when we have $tw.syncadaptor
33
32
  */
34
33
  syncer?: Syncer;
35
- Syncer: { new(): Syncer };
34
+ Syncer: { new (): Syncer };
36
35
 
37
36
  wiki: Wiki;
38
37
  boot: IBoot;
@@ -139,5 +138,10 @@ declare module 'tiddlywiki' {
139
138
  node: null | Record<string, any>;
140
139
  /** Broswer features, if tw isn't running on a browser environment, the value will be `null` */
141
140
  nodeWebKit: null | Record<string, any>;
141
+ platform: {
142
+ isLinux: boolean;
143
+ isMac: boolean;
144
+ isWindows: boolean;
145
+ };
142
146
  }
143
147
  }
package/src/hooks.d.ts CHANGED
@@ -68,7 +68,7 @@ declare module 'tiddlywiki' {
68
68
  addHook(
69
69
  hookName: 'th-importing-file',
70
70
  callback: (props: {
71
- file: unknown;
71
+ file: { path?: string, name: string };
72
72
  type: string;
73
73
  isBinary: boolean;
74
74
  callback: Function;
@@ -1,3 +1,5 @@
1
+ /// <reference path="./navigator.d.ts" />
2
+
1
3
  declare module 'tiddlywiki' {
2
4
  /**
3
5
  * Parameter of Widget.refresh
@@ -69,7 +71,7 @@ declare module 'tiddlywiki' {
69
71
  export class Widget {
70
72
  parseTreeNode: IParseTreeNode;
71
73
 
72
- wiki: ITiddlyWiki;
74
+ wiki: Wiki;
73
75
 
74
76
  document: IFakeDocument;
75
77
 
@@ -0,0 +1,52 @@
1
+ declare module 'tiddlywiki' {
2
+ export class NavigatorWidget extends Widget {
3
+ getStoryList(): string[] | null;
4
+ saveStoryList(storyList: string[]): void;
5
+ removeTitleFromStory(storyList: string[], title: string): void;
6
+ replaceFirstTitleInStory(
7
+ storyList: string[],
8
+ oldTitle: string,
9
+ newTitle: string,
10
+ ): void;
11
+ addToStory(title: string, fromTitle?: string): void;
12
+ /**
13
+ Add a new record to the top of the history stack
14
+ title: a title string or an array of title strings
15
+ fromPageRect: page coordinates of the origin of the navigation
16
+ */
17
+ addToHistory(title: string, fromPageRect?: DOMRect): void;
18
+ handleNavigateEvent(event: IWidgetEvent): void;
19
+ handleCloseTiddlerEvent(event: IWidgetEvent): void;
20
+ handleCloseAllTiddlersEvent(event: IWidgetEvent): void;
21
+ handleCloseOtherTiddlersEvent(event: IWidgetEvent): void;
22
+ handleEditTiddlerEvent(event: IWidgetEvent): void;
23
+ handleDeleteTiddlerEvent(event: IWidgetEvent): void;
24
+ makeDraftTiddler(targetTitle): void;
25
+ generateDraftTitle(title): void;
26
+ handleSaveTiddlerEvent(event: IWidgetEvent): void;
27
+ handleCancelTiddlerEvent(event: IWidgetEvent): void;
28
+ /**
29
+ * Create a new draft tiddler
30
+ * event.param can either be the title of a template tiddler, or a hashmap of fields.
31
+ * The title of the newly created tiddler follows these rules:
32
+ * * If a hashmap was used and a title field was specified, use that title
33
+ * * If a hashmap was used without a title field, use a default title, if necessary making it unique with a *numeric suffix
34
+ * * If a template tiddler was used, use the title of the template, if necessary making it unique with a *numeric suffix
35
+ * If a draft of the target tiddler already exists then it is reused
36
+ */
37
+ handleNewTiddlerEvent(event: IWidgetEvent): void;
38
+ /**
39
+ * Import JSON tiddlers into a pending import tiddler
40
+ */
41
+ handleImportTiddlersEvent(event: IWidgetEvent): void;
42
+ handlePerformImportEvent(event: IWidgetEvent): void;
43
+ handleFoldTiddlerEvent(event: IWidgetEvent): void;
44
+ handleFoldOtherTiddlersEvent(event: IWidgetEvent): void;
45
+ handleFoldAllTiddlersEvent(event: IWidgetEvent): void;
46
+ handleUnfoldAllTiddlersEvent(event: IWidgetEvent): void;
47
+ }
48
+ }
49
+ declare module '$:/core/modules/widgets/navigator.js' {
50
+ import { NavigatorWidget } from 'tiddlywiki';
51
+ export { NavigatorWidget as navigator };
52
+ }