@thepassle/app-tools 0.9.8 → 0.9.9

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/api/index.js CHANGED
@@ -149,20 +149,20 @@ export class Api {
149
149
  });
150
150
  }
151
151
 
152
- /** @type {import('./types.js').BodylessMethod<object>} */
152
+ /** @type {import('./types.js').BodylessMethod} */
153
153
  get = (url, opts) => this.fetch(url, 'GET', opts);
154
- /** @type {import('./types.js').BodylessMethod<object>} */
154
+ /** @type {import('./types.js').BodylessMethod} */
155
155
  options = (url, opts) => this.fetch(url, 'OPTIONS', opts);
156
- /** @type {import('./types.js').BodylessMethod<object>} */
156
+ /** @type {import('./types.js').BodylessMethod} */
157
157
  delete = (url, opts) => this.fetch(url, 'DELETE', opts);
158
- /** @type {import('./types.js').BodylessMethod<object>} */
158
+ /** @type {import('./types.js').BodylessMethod} */
159
159
  head = (url, opts) => this.fetch(url, 'HEAD', opts);
160
- /** @type {import('./types.js').BodyMethod<object>} */
160
+ /** @type {import('./types.js').BodyMethod} */
161
161
  post = (url, data, opts) => this.fetch(url, 'POST', opts, data);
162
- /** @type {import('./types.js').BodyMethod<object>} */
162
+ /** @type {import('./types.js').BodyMethod} */
163
163
  put = (url, data, opts) => this.fetch(url, 'PUT', opts, data);
164
- /** @type {import('./types.js').BodyMethod<object>} */
164
+ /** @type {import('./types.js').BodyMethod} */
165
165
  patch = (url, data, opts) => this.fetch(url, 'PATCH', opts, data);
166
166
  }
167
167
 
168
- export const api = new Api();
168
+ export const api = new Api();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thepassle/app-tools",
3
- "version": "0.9.8",
3
+ "version": "0.9.9",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "scripts": {
package/router/index.js CHANGED
@@ -154,6 +154,9 @@ export class Router extends EventTarget {
154
154
  this.navigate(url);
155
155
  }
156
156
 
157
+ /**
158
+ * @private
159
+ */
157
160
  _collectPlugins(route) {
158
161
  return [
159
162
  ...(this.config?.plugins ?? []),
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @param {string|((context:(import('../index.js').Context) => string)} path
2
+ * @param {string|((context: import('../index.js').Context) => string)} path
3
3
  * @returns {import('../index.js').Plugin}
4
4
  */
5
5
  export function redirect(path) {
@@ -33,20 +33,20 @@ export class Api {
33
33
  * @returns
34
34
  */
35
35
  fetch(url: string, method: Method, opts?: RequestOptions, data?: object): Promise<any>;
36
- /** @type {import('./types.js').BodylessMethod<object>} */
37
- get: import('./types.js').BodylessMethod<object>;
38
- /** @type {import('./types.js').BodylessMethod<object>} */
39
- options: import('./types.js').BodylessMethod<object>;
40
- /** @type {import('./types.js').BodylessMethod<object>} */
41
- delete: import('./types.js').BodylessMethod<object>;
42
- /** @type {import('./types.js').BodylessMethod<object>} */
43
- head: import('./types.js').BodylessMethod<object>;
44
- /** @type {import('./types.js').BodyMethod<object>} */
45
- post: import('./types.js').BodyMethod<object>;
46
- /** @type {import('./types.js').BodyMethod<object>} */
47
- put: import('./types.js').BodyMethod<object>;
48
- /** @type {import('./types.js').BodyMethod<object>} */
49
- patch: import('./types.js').BodyMethod<object>;
36
+ /** @type {import('./types.js').BodylessMethod} */
37
+ get: import('./types.js').BodylessMethod;
38
+ /** @type {import('./types.js').BodylessMethod} */
39
+ options: import('./types.js').BodylessMethod;
40
+ /** @type {import('./types.js').BodylessMethod} */
41
+ delete: import('./types.js').BodylessMethod;
42
+ /** @type {import('./types.js').BodylessMethod} */
43
+ head: import('./types.js').BodylessMethod;
44
+ /** @type {import('./types.js').BodyMethod} */
45
+ post: import('./types.js').BodyMethod;
46
+ /** @type {import('./types.js').BodyMethod} */
47
+ put: import('./types.js').BodyMethod;
48
+ /** @type {import('./types.js').BodyMethod} */
49
+ patch: import('./types.js').BodyMethod;
50
50
  }
51
51
  export const api: Api;
52
52
  export type Config = import('./types.js').Config;
@@ -4,8 +4,8 @@ export interface Config {
4
4
  responseType?: ResponseType;
5
5
  baseURL?: string;
6
6
  }
7
- export type BodyMethod<R> = (url: string, data?: object, opts?: RequestOptions) => Promise<R>;
8
- export type BodylessMethod<R> = (url: string, opts?: RequestOptions) => Promise<R>;
7
+ export type BodyMethod = <R>(url: string, data?: object, opts?: RequestOptions) => Promise<R>;
8
+ export type BodylessMethod = <R>(url: string, opts?: RequestOptions) => Promise<R>;
9
9
  export type Method = 'GET' | 'DELETE' | 'HEAD' | 'OPTIONS' | 'POST' | 'PUT' | 'PATCH';
10
10
  export interface Plugin {
11
11
  beforeFetch?: (meta: MetaParams) => MetaParams | Promise<MetaParams> | void;
@@ -45,6 +45,10 @@ export class Router extends EventTarget {
45
45
  * @private
46
46
  */
47
47
  private _onAnchorClick;
48
+ /**
49
+ * @private
50
+ */
51
+ private _collectPlugins;
48
52
  /**
49
53
  * @param {string | URL} url The URL to navigate to.
50
54
  * @param {{
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @param {string} path
2
+ * @param {string|((context: import('../index.js').Context) => string)} path
3
3
  * @returns {import('../index.js').Plugin}
4
4
  */
5
- export function redirect(path: string): import('../index.js').Plugin;
5
+ export function redirect(path: string | ((context: import('../index.js').Context) => string)): import('../index.js').Plugin;