@ape-egg/vibe 4.2.1 → 4.3.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/README.md +5 -5
- package/hot-module-refresh.js +0 -0
- package/llms.txt +1 -1
- package/package.json +1 -1
- package/runtime/affected.js +56 -1
- package/runtime/conditionals.js +12 -0
- package/runtime/constants.js +1 -1
- package/runtime/index.js +21 -46
- package/runtime/iterate.js +76 -7
- package/runtime/manifest.js +42 -0
- package/runtime/parse.js +14 -11
- package/runtime/reconcile.js +488 -289
- package/spa.js +7 -2
package/spa.js
CHANGED
|
@@ -57,9 +57,13 @@ export const navigate = (path) =>
|
|
|
57
57
|
activeRouter ? activeRouter.navigate(path) : location.assign(new URL(path, location.origin));
|
|
58
58
|
|
|
59
59
|
export const setupSpa = ({ routes, onNavigate }) => {
|
|
60
|
-
const
|
|
60
|
+
const swapTitle = (resolved) => {
|
|
61
|
+
if (resolved?.title) document.title = resolved.title;
|
|
62
|
+
};
|
|
63
|
+
const apply = onNavigate ?? ((resolved) => {
|
|
64
|
+
const { path, route, params, src, name } = resolved;
|
|
61
65
|
window.$.page = { path, route, params, src, name };
|
|
62
|
-
|
|
66
|
+
swapTitle(resolved);
|
|
63
67
|
});
|
|
64
68
|
|
|
65
69
|
const claim = (target) => {
|
|
@@ -117,6 +121,7 @@ export const setupSpa = ({ routes, onNavigate }) => {
|
|
|
117
121
|
|
|
118
122
|
document.addEventListener('click', onClick);
|
|
119
123
|
addEventListener('popstate', onPopstate);
|
|
124
|
+
if (!onNavigate) swapTitle(resolve(location, routes));
|
|
120
125
|
|
|
121
126
|
const dispose = () => {
|
|
122
127
|
document.removeEventListener('click', onClick);
|