@ktjs/router 0.14.3 → 0.14.4
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/dist/index.d.ts +2 -0
- package/dist/index.iife.js +6 -5
- package/dist/index.legacy.js +6 -5
- package/dist/index.mjs +6 -5
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.iife.js
CHANGED
|
@@ -201,7 +201,7 @@ var __ktjs_router__ = (function (exports) {
|
|
|
201
201
|
const initCurrentRoute = () => {
|
|
202
202
|
const hash = window.location.hash.slice(1); // Remove '#'
|
|
203
203
|
if (!hash) {
|
|
204
|
-
return null;
|
|
204
|
+
return (current = null);
|
|
205
205
|
}
|
|
206
206
|
// Parse path and query
|
|
207
207
|
const [path, queryString] = hash.split('?');
|
|
@@ -209,19 +209,19 @@ var __ktjs_router__ = (function (exports) {
|
|
|
209
209
|
// Match route
|
|
210
210
|
const matched = match(normalizedPath);
|
|
211
211
|
if (!matched) {
|
|
212
|
-
return null;
|
|
212
|
+
return (current = null);
|
|
213
213
|
}
|
|
214
214
|
// Build route context
|
|
215
|
-
return {
|
|
215
|
+
return (current = {
|
|
216
216
|
path: normalizedPath,
|
|
217
217
|
name: matched.route.name,
|
|
218
218
|
params: matched.params,
|
|
219
219
|
query: queryString ? parseQuery(queryString) : {},
|
|
220
220
|
meta: matched.route.meta ?? {},
|
|
221
221
|
matched: matched.result,
|
|
222
|
-
};
|
|
222
|
+
});
|
|
223
223
|
};
|
|
224
|
-
let current =
|
|
224
|
+
let current = null;
|
|
225
225
|
const history = current ? [current] : [];
|
|
226
226
|
// # methods
|
|
227
227
|
const executeGuardsSync = (to, from, guardLevel) => {
|
|
@@ -510,6 +510,7 @@ var __ktjs_router__ = (function (exports) {
|
|
|
510
510
|
forward() {
|
|
511
511
|
window.history.forward();
|
|
512
512
|
},
|
|
513
|
+
initCurrentRoute,
|
|
513
514
|
};
|
|
514
515
|
};
|
|
515
516
|
|
package/dist/index.legacy.js
CHANGED
|
@@ -296,7 +296,7 @@ var __ktjs_router__ = (function (exports) {
|
|
|
296
296
|
var _a;
|
|
297
297
|
var hash = window.location.hash.slice(1); // Remove '#'
|
|
298
298
|
if (!hash) {
|
|
299
|
-
return null;
|
|
299
|
+
return (current = null);
|
|
300
300
|
}
|
|
301
301
|
// Parse path and query
|
|
302
302
|
var _b = hash.split('?'), path = _b[0], queryString = _b[1];
|
|
@@ -304,19 +304,19 @@ var __ktjs_router__ = (function (exports) {
|
|
|
304
304
|
// Match route
|
|
305
305
|
var matched = match(normalizedPath);
|
|
306
306
|
if (!matched) {
|
|
307
|
-
return null;
|
|
307
|
+
return (current = null);
|
|
308
308
|
}
|
|
309
309
|
// Build route context
|
|
310
|
-
return {
|
|
310
|
+
return (current = {
|
|
311
311
|
path: normalizedPath,
|
|
312
312
|
name: matched.route.name,
|
|
313
313
|
params: matched.params,
|
|
314
314
|
query: queryString ? parseQuery(queryString) : {},
|
|
315
315
|
meta: (_a = matched.route.meta) !== null && _a !== void 0 ? _a : {},
|
|
316
316
|
matched: matched.result,
|
|
317
|
-
};
|
|
317
|
+
});
|
|
318
318
|
};
|
|
319
|
-
var current =
|
|
319
|
+
var current = null;
|
|
320
320
|
var history = current ? [current] : [];
|
|
321
321
|
// # methods
|
|
322
322
|
var executeGuardsSync = function (to, from, guardLevel) {
|
|
@@ -647,6 +647,7 @@ var __ktjs_router__ = (function (exports) {
|
|
|
647
647
|
forward: function () {
|
|
648
648
|
window.history.forward();
|
|
649
649
|
},
|
|
650
|
+
initCurrentRoute: initCurrentRoute,
|
|
650
651
|
};
|
|
651
652
|
};
|
|
652
653
|
|
package/dist/index.mjs
CHANGED
|
@@ -198,7 +198,7 @@ const createRouter = (config) => {
|
|
|
198
198
|
const initCurrentRoute = () => {
|
|
199
199
|
const hash = window.location.hash.slice(1); // Remove '#'
|
|
200
200
|
if (!hash) {
|
|
201
|
-
return null;
|
|
201
|
+
return (current = null);
|
|
202
202
|
}
|
|
203
203
|
// Parse path and query
|
|
204
204
|
const [path, queryString] = hash.split('?');
|
|
@@ -206,19 +206,19 @@ const createRouter = (config) => {
|
|
|
206
206
|
// Match route
|
|
207
207
|
const matched = match(normalizedPath);
|
|
208
208
|
if (!matched) {
|
|
209
|
-
return null;
|
|
209
|
+
return (current = null);
|
|
210
210
|
}
|
|
211
211
|
// Build route context
|
|
212
|
-
return {
|
|
212
|
+
return (current = {
|
|
213
213
|
path: normalizedPath,
|
|
214
214
|
name: matched.route.name,
|
|
215
215
|
params: matched.params,
|
|
216
216
|
query: queryString ? parseQuery(queryString) : {},
|
|
217
217
|
meta: matched.route.meta ?? {},
|
|
218
218
|
matched: matched.result,
|
|
219
|
-
};
|
|
219
|
+
});
|
|
220
220
|
};
|
|
221
|
-
let current =
|
|
221
|
+
let current = null;
|
|
222
222
|
const history = current ? [current] : [];
|
|
223
223
|
// # methods
|
|
224
224
|
const executeGuardsSync = (to, from, guardLevel) => {
|
|
@@ -507,6 +507,7 @@ const createRouter = (config) => {
|
|
|
507
507
|
forward() {
|
|
508
508
|
window.history.forward();
|
|
509
509
|
},
|
|
510
|
+
initCurrentRoute,
|
|
510
511
|
};
|
|
511
512
|
};
|
|
512
513
|
|