@thepassle/app-tools 0.8.0 → 0.8.2

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
@@ -111,7 +111,10 @@ export class Api {
111
111
  .then(async res => {
112
112
  for(const plugin of plugins) {
113
113
  try {
114
- res = await plugin?.afterFetch?.(res) ?? res;
114
+ const afterFetchResult = await plugin?.afterFetch?.(res) ?? res;
115
+ if(afterFetchResult) {
116
+ res = afterFetchResult;
117
+ }
115
118
  } catch(e) {
116
119
  log(`Plugin "${plugin.name}" error on afterFetch hook`)
117
120
  throw e;
@@ -4,7 +4,7 @@
4
4
  */
5
5
  export const delayPlugin = (ms) => ({
6
6
  name: 'delay',
7
- afterFetch: () => new Promise(r => setTimeout(r,ms))
7
+ afterFetch: () => {new Promise(r => setTimeout(r,ms))}
8
8
  });
9
9
 
10
10
  export const delay = delayPlugin(1000);
package/api/types.d.ts CHANGED
@@ -13,7 +13,7 @@ export type Method = 'GET'|'DELETE'|'HEAD'|'OPTIONS'|'POST'|'PUT'|'PATCH';
13
13
 
14
14
  export interface Plugin {
15
15
  beforeFetch?: (meta: MetaParams) => MetaParams | Promise<MetaParams> | void;
16
- afterFetch?: (res: Response) => Response | Promise<Response>;
16
+ afterFetch?: (res: Response) => void | Promise<void> | Response | Promise<Response>;
17
17
  transform?: (data: any) => any;
18
18
  name: string;
19
19
  handleError?: (e: Error) => boolean;
package/dialog/index.js CHANGED
@@ -136,7 +136,7 @@ export class Dialog extends EventTarget {
136
136
  parameters,
137
137
  }
138
138
  document.body.appendChild(this.__dialog);
139
-
139
+
140
140
  log(`Openening dialog "${id}"`, this.context);
141
141
  this.__dialog.setAttribute('opening', '');
142
142
  this.dispatchEvent(new DialogStateEvent('opening', this.context));
package/dialog/types.d.ts CHANGED
@@ -15,7 +15,7 @@ export interface OpenDialogOptions {
15
15
  }
16
16
 
17
17
  export interface Context {
18
- dialog: DialogNode,
18
+ dialog: DialogNode | undefined,
19
19
  id: string,
20
20
  parameters: Record<string, any>
21
21
  }
package/dialog/utils.js CHANGED
@@ -14,6 +14,11 @@ export function setupGlobalDialogStyles() {
14
14
  overflow: hidden;
15
15
  }
16
16
 
17
+ dialog[${APP_TOOLS}][version="${VERSION}"]:modal {
18
+ max-width: 100%;
19
+ max-height: 100%;
20
+ }
21
+
17
22
  dialog[${APP_TOOLS}][version="${VERSION}"] {
18
23
  pointer-events: none;
19
24
  inset: 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thepassle/app-tools",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",