tw5-typed 0.5.14 → 0.6.1

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tw5-typed",
3
- "version": "0.5.14",
3
+ "version": "0.6.1",
4
4
  "scripts": {
5
5
  "check": "tsc --noEmit && eslint src/**/*.ts",
6
6
  "docs": "docs-ts",
@@ -23,6 +23,13 @@
23
23
  "url": "git+https://github.com/tiddly-gittly/tw5-typed.git"
24
24
  },
25
25
  "types": "src/index.d.ts",
26
+ "exports": {
27
+ ".": {
28
+ "import": "./src/index.d.ts",
29
+ "require": "./src/index.d.ts",
30
+ "types": "./src/index.d.ts"
31
+ }
32
+ },
26
33
  "files": [
27
34
  "src/"
28
35
  ],
package/src/hooks.d.ts CHANGED
@@ -1,4 +1,12 @@
1
1
  declare module 'tiddlywiki' {
2
+ interface ImportFileInfo {
3
+ // eslint-disable-next-line @typescript-eslint/ban-types
4
+ callback: Function;
5
+ file: { lastModified?: number; lastModifiedDate?: Date; name: string; path?: string; size: number; type: string; webkitRelativePath?: string };
6
+ isBinary: boolean;
7
+ type: string;
8
+ }
9
+
2
10
  interface IHooks {
3
11
  /** Add hooks to the hashmap */
4
12
  addHook(
@@ -66,19 +74,13 @@ declare module 'tiddlywiki' {
66
74
  addHook(hookName: 'th-page-refreshed', callback: () => void);
67
75
  addHook(
68
76
  hookName: 'th-importing-file',
69
- callback: (props: {
70
- // eslint-disable-next-line @typescript-eslint/ban-types
71
- callback: Function;
72
- file: { name: string; path?: string };
73
- isBinary: boolean;
74
- type: string;
75
- }) => boolean | undefined,
77
+ callback: (props: ImportFileInfo) => boolean | undefined,
76
78
  );
77
79
  addHook(hookName: string, callback: (...arguments_: unknown[]) => unknown);
78
80
  /**
79
81
  * Invoke the hook by key
80
82
  */
81
- invokeHook(hookName: string, event: IWidgetEvent): undefined | IWidgetEvent | undefined;
83
+ invokeHook(hookName: string, event: IWidgetEvent): undefined | IWidgetEvent;
82
84
  // eslint-disable-next-line @typescript-eslint/ban-types
83
85
  names: Record<string, Function[]>;
84
86
  }
@@ -1,5 +1,18 @@
1
1
  declare module 'tiddlywiki' {
2
2
  /**
3
+ * # Usage
4
+ *
5
+ * ```ts
6
+ * const yourFilter: IFilterOperator = (source,operator) => {
7
+ * var results = [];
8
+ * source(function(tiddler,title) {
9
+ * if (!tiddler.fields['xxx']) return;
10
+ * results.push(title);
11
+ * });
12
+ * return results;
13
+ * }
14
+ * ```
15
+ *
3
16
  * # Overview
4
17
 
5
18
  Filter operators are modules (tiddlers of type `application/javascript`) with their `module-type` field set to `filteroperator`, exporting one or more functions implementing a filter.
@@ -41,7 +41,7 @@ declare module '$:/core/modules/utils/parseutils.js' {
41
41
  export function parseStringLiteral(source: string, pos: number): { end: number; start: number; type: 'string'; value: string } | null;
42
42
 
43
43
  /**
44
- * Returns an array of {name:} with an optional "default" property. Options include `requireParenthesis`.
44
+ * Returns an array of `{name:}` with an optional "default" property. Options include `requireParenthesis`.
45
45
  */
46
46
  export function parseParameterDefinition(parameterString: string, options?: { requireParenthesis?: boolean }): Array<{ default?: string; name: string }>;
47
47