@thepassle/app-tools 0.9.1 → 0.9.3

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": "@thepassle/app-tools",
3
- "version": "0.9.1",
3
+ "version": "0.9.3",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -35,7 +35,7 @@
35
35
  "default": "./router.js"
36
36
  },
37
37
  "./router/plugins/*": {
38
- "types": "./types/router/index/*",
38
+ "types": "./types/router/plugins/*",
39
39
  "default": "./router/plugins/*"
40
40
  },
41
41
  "./api/plugins/*": {
package/router/index.js CHANGED
@@ -77,12 +77,17 @@ export class Router extends EventTarget {
77
77
  return new URL('./', document.baseURI);
78
78
  }
79
79
 
80
+ /**
81
+ * @template RenderResult
82
+ * @returns {RenderResult}
83
+ */
80
84
  render() {
81
85
  log(`Rendering route ${this.context.url.pathname}${this.context.url.search}`, { context: this.context, route: this.route });
82
86
  return this.route?.render?.(this.context);
83
87
  }
84
88
 
85
89
  /**
90
+ * @private
86
91
  * @param {URL} url
87
92
  * @returns {Route | null}
88
93
  */
@@ -106,14 +111,23 @@ export class Router extends EventTarget {
106
111
  return null;
107
112
  }
108
113
 
114
+ /**
115
+ * @private
116
+ */
109
117
  _notifyUrlChanged() {
110
118
  this.dispatchEvent(new RouteEvent(this.context));
111
119
  }
112
120
 
121
+ /**
122
+ * @private
123
+ */
113
124
  _onPopState = () => {
114
125
  this.navigate(new URL(window.location.href), { backNav: true });
115
126
  }
116
127
 
128
+ /**
129
+ * @private
130
+ */
117
131
  _onAnchorClick = (e) => {
118
132
  if (
119
133
  e.defaultPrevented ||
@@ -23,15 +23,29 @@ export class Router extends EventTarget {
23
23
  get url(): URL;
24
24
  get fallback(): URL;
25
25
  get baseUrl(): URL;
26
- render(): RenderResult;
27
26
  /**
27
+ * @template RenderResult
28
+ * @returns {RenderResult}
29
+ */
30
+ render<RenderResult>(): RenderResult;
31
+ /**
32
+ * @private
28
33
  * @param {URL} url
29
34
  * @returns {Route | null}
30
35
  */
31
- _matchRoute(url: URL): Route | null;
32
- _notifyUrlChanged(): void;
33
- _onPopState: () => void;
34
- _onAnchorClick: (e: any) => void;
36
+ private _matchRoute;
37
+ /**
38
+ * @private
39
+ */
40
+ private _notifyUrlChanged;
41
+ /**
42
+ * @private
43
+ */
44
+ private _onPopState;
45
+ /**
46
+ * @private
47
+ */
48
+ private _onAnchorClick;
35
49
  /**
36
50
  * @param {string | URL} url The URL to navigate to.
37
51
  * @param {{