@kimesh/router-runtime 0.2.45 → 0.2.46
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.mts +1 -1
- package/dist/index.mjs +8 -49
- package/dist/middleware/index.d.mts +1 -1
- package/dist/middleware/index.mjs +3 -4
- package/dist/middleware/plugin.d.mts +1 -1
- package/dist/middleware/plugin.mjs +2 -3
- package/dist/{middleware-DvCiATAB.mjs → middleware-B4001yQN.mjs} +1 -3
- package/dist/{plugin-ppRzW7AM.mjs → plugin-Boh8olcn.mjs} +2 -5
- package/package.json +2 -2
- /package/dist/{index-B0Xt0G76.d.mts → index-BsEc8r3N.d.mts} +0 -0
package/dist/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as NavigationMiddlewareOptions, $t as BeforeLoadContext, An as RoutePath, At as mergeAllRouteHeads, B as isLayoutRouteMeta, Bn as KimeshRuntimePluginMeta, Bt as defineKimeshRuntimePlugin, C as navigateTo, Cn as RouteHeadFn, Ct as KmLinkProps, D as MiddlewareDefinition, Dn as RouteNames, Dt as applyTitleTemplate, E as MiddlewareContext, En as RouteNamedMap, Et as applyHeadConfigNative, F as LayoutLoaderData, Fn as TypedRedirectStatic, Ft as routerPlugin, G as useRouteQueryBoolean, Gn as RuntimeConfigPublic, Gt as defineContext, H as RouteQueryValueRaw, Hn as NavigationAfterHookContext, Ht as getPluginMeta, I as LayoutRouteMeta, In as KimeshAppContext, It as applyPlugin, J as useLoaderData, Jt as defineRoute, K as useRouteQueryNumber, Kt as useKimeshContext, L as LoaderDataKey, Ln as KimeshRuntimeHooks, Lt as applyPlugins, M as NavigationRedirect, Mn as SearchSchema, Mt as QueryPluginOptions, N as RouteMiddleware, Nn as TypedNavigationRedirect, Nt as getCorePlugins, O as MiddlewareOption, On as RouteParams, Ot as collectRouteHeads, P as TypedRouteMiddleware, Pn as TypedRedirectDynamic, Pt as queryPlugin, Q as NavigationErrorContext, Qt as AugmentedContext, R as UseMatchLoaderDataOptions, Rn as KimeshRuntimePlugin, Rt as applyPluginsWithParallel, S as defineKimeshMiddleware, Sn as RouteHeadContext, St as KmLink, T as KnownMiddleware, Tn as RouteLocationRaw, Tt as HeadPluginOptions, U as UseRouteQueryOptions, Un as NavigationErrorHookContext, Ut as getPluginName, V as RouteQueryTransform, Vn as KimeshRuntimePluginResult, Vt as getPluginHooks, W as useRouteQuery, Wn as NavigationHookContext, Wt as isKimeshRuntimePlugin, X as useRouteLoaderData, Xt as KIMESH_APP_CONTEXT_KEY, Y as useMatchLoaderData, Yt as CreateKimeshAppOptionsExtended, Z as NavigationContext, Zt as createKimeshApp, _ as createMiddlewarePlugin, _n as ParamValueZeroOrOne, _t as useSearch, a as RouteRecordRaw, an as FullContext, at as getKmStateKeys, bn as RouteDefinition, bt as installLoaderGuard, c as onBeforeRouteUpdate, cn as InlineRouteMiddleware, ct as tryUseKimeshApp, d as useRouter, dn as KimeshContext, dt as useRuntimeConfig, en as BeforeLoadContextFull, et as useAfterNavigation, f as createMiddlewareExecutor, fn as LoaderContext, ft as NavigateOptions, g as MiddlewarePluginOptions, gn as ParamValueZeroOrMore, gt as UseSearchReturn, h as createMiddlewareContext, hn as ParamValueOneOrMore, ht as useReactiveParams, i as RouteLocationNormalizedLoaded, in as FileRouteOptions, it as clearKmState, j as MiddlewareResult, jn as RouteRecordInfo, jt as mergeHeadConfigs, kn as RouteParamsRaw, kt as createHeadPlugin, l as useLink, ln as KIMESH_CONTEXT_KEY, lt as useKimeshApp, mn as ParamValue, mt as useParams, n as NavigationHookAfter, nn as CreateKimeshAppOptions, nt as useNavigationMiddleware, o as Router, on as HasParams, ot as hasKmState, pn as LoaderFn, pt as useNavigate, q as useLayoutData, qt as createFileRoute, r as RouteLocationNormalized, rn as ExtractRouteParams, rt as STATE_KEY_PREFIX, s as onBeforeRouteLeave, sn as InlineMiddlewareContext, st as useState, t as NavigationGuard, tn as BeforeLoadFn, tt as useNavigationGuard, u as useRoute, un as KimeshApp, ut as RuntimeConfig, v as middlewarePlugin, vn as PendingConfig, vt as LoaderGuardOptions, w as KimeshMiddlewareNames, wn as RouteInfoByName, wt as KmOutlet, x as abortNavigation, xn as RouteHeadConfig, xt as KmDeferred, y as NavigateToOptions, yn as RouteContext, yt as createLoaderGuard, z as createLoaderDataKey, zn as KimeshRuntimePluginDefinition, zt as KIMESH_PLUGIN_INDICATOR } from "./index-
|
|
1
|
+
import { $ as NavigationMiddlewareOptions, $t as BeforeLoadContext, An as RoutePath, At as mergeAllRouteHeads, B as isLayoutRouteMeta, Bn as KimeshRuntimePluginMeta, Bt as defineKimeshRuntimePlugin, C as navigateTo, Cn as RouteHeadFn, Ct as KmLinkProps, D as MiddlewareDefinition, Dn as RouteNames, Dt as applyTitleTemplate, E as MiddlewareContext, En as RouteNamedMap, Et as applyHeadConfigNative, F as LayoutLoaderData, Fn as TypedRedirectStatic, Ft as routerPlugin, G as useRouteQueryBoolean, Gn as RuntimeConfigPublic, Gt as defineContext, H as RouteQueryValueRaw, Hn as NavigationAfterHookContext, Ht as getPluginMeta, I as LayoutRouteMeta, In as KimeshAppContext, It as applyPlugin, J as useLoaderData, Jt as defineRoute, K as useRouteQueryNumber, Kt as useKimeshContext, L as LoaderDataKey, Ln as KimeshRuntimeHooks, Lt as applyPlugins, M as NavigationRedirect, Mn as SearchSchema, Mt as QueryPluginOptions, N as RouteMiddleware, Nn as TypedNavigationRedirect, Nt as getCorePlugins, O as MiddlewareOption, On as RouteParams, Ot as collectRouteHeads, P as TypedRouteMiddleware, Pn as TypedRedirectDynamic, Pt as queryPlugin, Q as NavigationErrorContext, Qt as AugmentedContext, R as UseMatchLoaderDataOptions, Rn as KimeshRuntimePlugin, Rt as applyPluginsWithParallel, S as defineKimeshMiddleware, Sn as RouteHeadContext, St as KmLink, T as KnownMiddleware, Tn as RouteLocationRaw, Tt as HeadPluginOptions, U as UseRouteQueryOptions, Un as NavigationErrorHookContext, Ut as getPluginName, V as RouteQueryTransform, Vn as KimeshRuntimePluginResult, Vt as getPluginHooks, W as useRouteQuery, Wn as NavigationHookContext, Wt as isKimeshRuntimePlugin, X as useRouteLoaderData, Xt as KIMESH_APP_CONTEXT_KEY, Y as useMatchLoaderData, Yt as CreateKimeshAppOptionsExtended, Z as NavigationContext, Zt as createKimeshApp, _ as createMiddlewarePlugin, _n as ParamValueZeroOrOne, _t as useSearch, a as RouteRecordRaw, an as FullContext, at as getKmStateKeys, bn as RouteDefinition, bt as installLoaderGuard, c as onBeforeRouteUpdate, cn as InlineRouteMiddleware, ct as tryUseKimeshApp, d as useRouter, dn as KimeshContext, dt as useRuntimeConfig, en as BeforeLoadContextFull, et as useAfterNavigation, f as createMiddlewareExecutor, fn as LoaderContext, ft as NavigateOptions, g as MiddlewarePluginOptions, gn as ParamValueZeroOrMore, gt as UseSearchReturn, h as createMiddlewareContext, hn as ParamValueOneOrMore, ht as useReactiveParams, i as RouteLocationNormalizedLoaded, in as FileRouteOptions, it as clearKmState, j as MiddlewareResult, jn as RouteRecordInfo, jt as mergeHeadConfigs, kn as RouteParamsRaw, kt as createHeadPlugin, l as useLink, ln as KIMESH_CONTEXT_KEY, lt as useKimeshApp, mn as ParamValue, mt as useParams, n as NavigationHookAfter, nn as CreateKimeshAppOptions, nt as useNavigationMiddleware, o as Router, on as HasParams, ot as hasKmState, pn as LoaderFn, pt as useNavigate, q as useLayoutData, qt as createFileRoute, r as RouteLocationNormalized, rn as ExtractRouteParams, rt as STATE_KEY_PREFIX, s as onBeforeRouteLeave, sn as InlineMiddlewareContext, st as useState, t as NavigationGuard, tn as BeforeLoadFn, tt as useNavigationGuard, u as useRoute, un as KimeshApp, ut as RuntimeConfig, v as middlewarePlugin, vn as PendingConfig, vt as LoaderGuardOptions, w as KimeshMiddlewareNames, wn as RouteInfoByName, wt as KmOutlet, x as abortNavigation, xn as RouteHeadConfig, xt as KmDeferred, y as NavigateToOptions, yn as RouteContext, yt as createLoaderGuard, z as createLoaderDataKey, zn as KimeshRuntimePluginDefinition, zt as KIMESH_PLUGIN_INDICATOR } from "./index-BsEc8r3N.mjs";
|
|
2
2
|
export { AugmentedContext, BeforeLoadContext, BeforeLoadContextFull, BeforeLoadFn, CreateKimeshAppOptions, CreateKimeshAppOptionsExtended, ExtractRouteParams, FileRouteOptions, FullContext, HasParams, HeadPluginOptions, InlineMiddlewareContext, InlineRouteMiddleware, KIMESH_APP_CONTEXT_KEY, KIMESH_CONTEXT_KEY, KIMESH_PLUGIN_INDICATOR, KimeshApp, KimeshAppContext, KimeshContext, KimeshMiddlewareNames, KimeshRuntimeHooks, KimeshRuntimePlugin, KimeshRuntimePluginDefinition, KimeshRuntimePluginMeta, KimeshRuntimePluginResult, KmDeferred, KmLink, KmLinkProps, KmOutlet, KnownMiddleware, LayoutLoaderData, LayoutRouteMeta, LoaderContext, LoaderDataKey, LoaderFn, LoaderGuardOptions, MiddlewareContext, MiddlewareDefinition, MiddlewareOption, MiddlewarePluginOptions, MiddlewareResult, NavigateOptions, NavigateToOptions, NavigationAfterHookContext, NavigationContext, NavigationErrorContext, NavigationErrorHookContext, NavigationGuard, NavigationHookAfter, NavigationHookContext, NavigationMiddlewareOptions, NavigationRedirect, ParamValue, ParamValueOneOrMore, ParamValueZeroOrMore, ParamValueZeroOrOne, PendingConfig, QueryPluginOptions, RouteContext, RouteDefinition, RouteHeadConfig, RouteHeadContext, RouteHeadFn, RouteInfoByName, RouteLocationNormalized, RouteLocationNormalizedLoaded, RouteLocationRaw, RouteMiddleware, RouteNamedMap, RouteNames, RouteParams, RouteParamsRaw, RoutePath, RouteQueryTransform, RouteQueryValueRaw, RouteRecordInfo, RouteRecordRaw, Router, RuntimeConfig, RuntimeConfigPublic, STATE_KEY_PREFIX, SearchSchema, TypedNavigationRedirect, TypedRedirectDynamic, TypedRedirectStatic, TypedRouteMiddleware, UseMatchLoaderDataOptions, UseRouteQueryOptions, UseSearchReturn, abortNavigation, applyHeadConfigNative, applyPlugin, applyPlugins, applyPluginsWithParallel, applyTitleTemplate, clearKmState, collectRouteHeads, createFileRoute, createHeadPlugin, createKimeshApp, createLoaderDataKey, createLoaderGuard, createMiddlewareContext, createMiddlewareExecutor, createMiddlewarePlugin, defineContext, defineKimeshMiddleware, defineKimeshRuntimePlugin, defineRoute, getCorePlugins, getKmStateKeys, getPluginHooks, getPluginMeta, getPluginName, hasKmState, installLoaderGuard, isKimeshRuntimePlugin, isLayoutRouteMeta, mergeAllRouteHeads, mergeHeadConfigs, middlewarePlugin, navigateTo, onBeforeRouteLeave, onBeforeRouteUpdate, queryPlugin, routerPlugin, tryUseKimeshApp, useAfterNavigation, useKimeshApp, useKimeshContext, useLayoutData, useLink, useLoaderData, useMatchLoaderData, useNavigate, useNavigationGuard, useNavigationMiddleware, useParams, useReactiveParams, useRoute, useRouteLoaderData, useRouteQuery, useRouteQueryBoolean, useRouteQueryNumber, useRouter, useRuntimeConfig, useSearch, useState };
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { a as defineKimeshRuntimePlugin, c as getPluginName, i as KIMESH_PLUGIN_INDICATOR, l as isKimeshRuntimePlugin, n as middlewarePlugin, o as getPluginHooks, r as createMiddlewareContext, s as getPluginMeta, t as createMiddlewarePlugin } from "./plugin-
|
|
2
|
-
import { a as defineKimeshMiddleware, i as abortNavigation, o as navigateTo, t as createMiddlewareExecutor } from "./middleware-
|
|
1
|
+
import { a as defineKimeshRuntimePlugin, c as getPluginName, i as KIMESH_PLUGIN_INDICATOR, l as isKimeshRuntimePlugin, n as middlewarePlugin, o as getPluginHooks, r as createMiddlewareContext, s as getPluginMeta, t as createMiddlewarePlugin } from "./plugin-Boh8olcn.mjs";
|
|
2
|
+
import { a as defineKimeshMiddleware, i as abortNavigation, o as navigateTo, t as createMiddlewareExecutor } from "./middleware-B4001yQN.mjs";
|
|
3
3
|
import { KeepAlive, Suspense, Transition, computed, createApp, customRef, defineComponent, getCurrentInstance, h, inject, isRef, nextTick, onErrorCaptured, onScopeDispose, reactive, ref, toRef, toValue, watch } from "vue";
|
|
4
4
|
import { RouterLink, RouterView, createRouter, createWebHashHistory, createWebHistory, onBeforeRouteLeave, onBeforeRouteUpdate, routeLocationKey, routerKey, useLink, useRoute, useRoute as useRoute$1, useRouter, useRouter as useRouter$1 } from "vue-router";
|
|
5
5
|
import { QueryClient, VueQueryPlugin } from "@tanstack/vue-query";
|
|
6
6
|
import { createHooks } from "hookable";
|
|
7
|
-
|
|
8
7
|
//#region src/types/layout.ts
|
|
9
8
|
/**
|
|
10
9
|
* Create a loader data storage key
|
|
@@ -18,7 +17,6 @@ function createLoaderDataKey(routePath) {
|
|
|
18
17
|
function isLayoutRouteMeta(meta) {
|
|
19
18
|
return typeof meta === "object" && meta !== null && "__isLayout" in meta;
|
|
20
19
|
}
|
|
21
|
-
|
|
22
20
|
//#endregion
|
|
23
21
|
//#region src/composables/use-loader-data.ts
|
|
24
22
|
/**
|
|
@@ -112,7 +110,6 @@ function clearStaleLoaderData(kimeshApp, newMatchedPaths) {
|
|
|
112
110
|
}
|
|
113
111
|
for (const key of keysToDelete) delete kimeshApp._state[key];
|
|
114
112
|
}
|
|
115
|
-
|
|
116
113
|
//#endregion
|
|
117
114
|
//#region src/guards/loader-guard.ts
|
|
118
115
|
/**
|
|
@@ -253,7 +250,6 @@ function installLoaderGuard(router, context, options) {
|
|
|
253
250
|
removeAfterEach();
|
|
254
251
|
};
|
|
255
252
|
}
|
|
256
|
-
|
|
257
253
|
//#endregion
|
|
258
254
|
//#region src/plugin-executor.ts
|
|
259
255
|
const ORDER_MAP = {
|
|
@@ -357,14 +353,12 @@ async function applyPluginsWithParallel(app, plugins) {
|
|
|
357
353
|
for (const group of groups) if (group.parallel) await Promise.all(group.plugins.map((p) => applyPlugin(app, p)));
|
|
358
354
|
else for (const plugin of group.plugins) await applyPlugin(app, plugin);
|
|
359
355
|
}
|
|
360
|
-
|
|
361
356
|
//#endregion
|
|
362
357
|
//#region src/types.ts
|
|
363
358
|
/**
|
|
364
359
|
* Injection key for Kimesh context
|
|
365
360
|
*/
|
|
366
361
|
const KIMESH_CONTEXT_KEY = Symbol("kimesh-context");
|
|
367
|
-
|
|
368
362
|
//#endregion
|
|
369
363
|
//#region src/create-app.ts
|
|
370
364
|
const KIMESH_APP_CONTEXT_KEY = Symbol("kimesh-app-context");
|
|
@@ -447,7 +441,6 @@ async function createKimeshApp(options) {
|
|
|
447
441
|
};
|
|
448
442
|
return kimeshApp;
|
|
449
443
|
}
|
|
450
|
-
|
|
451
444
|
//#endregion
|
|
452
445
|
//#region src/create-file-route.ts
|
|
453
446
|
/**
|
|
@@ -504,7 +497,6 @@ function createFileRoute(path) {
|
|
|
504
497
|
function defineRoute(options) {
|
|
505
498
|
return options;
|
|
506
499
|
}
|
|
507
|
-
|
|
508
500
|
//#endregion
|
|
509
501
|
//#region src/context.ts
|
|
510
502
|
/**
|
|
@@ -540,7 +532,6 @@ function useKimeshContext() {
|
|
|
540
532
|
if (!context) throw new Error("[Kimesh] Context not found. Make sure you are using this inside a Kimesh app.");
|
|
541
533
|
return context;
|
|
542
534
|
}
|
|
543
|
-
|
|
544
535
|
//#endregion
|
|
545
536
|
//#region src/plugins/core.ts
|
|
546
537
|
/**
|
|
@@ -609,7 +600,6 @@ const queryPlugin = defineKimeshRuntimePlugin({
|
|
|
609
600
|
function getCorePlugins() {
|
|
610
601
|
return [routerPlugin, queryPlugin];
|
|
611
602
|
}
|
|
612
|
-
|
|
613
603
|
//#endregion
|
|
614
604
|
//#region src/components/utils.ts
|
|
615
605
|
/**
|
|
@@ -670,25 +660,7 @@ function generateRouteKey(routeProps, override) {
|
|
|
670
660
|
function interpolatePath(route, match) {
|
|
671
661
|
return match.path.replace(ROUTE_KEY_PARENTHESES_RE, "$1").replace(ROUTE_KEY_SYMBOLS_RE, "$1").replace(ROUTE_KEY_NORMAL_RE, (r) => route.params[r.slice(1)]?.toString() || "");
|
|
672
662
|
}
|
|
673
|
-
|
|
674
|
-
//#endregion
|
|
675
|
-
//#region src/plugins/view-transitions.ts
|
|
676
|
-
/**
|
|
677
|
-
* View Transitions API Plugin
|
|
678
|
-
* Enables native browser View Transitions for smooth page navigation
|
|
679
|
-
*
|
|
680
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API
|
|
681
|
-
*
|
|
682
|
-
* @example
|
|
683
|
-
* ```ts
|
|
684
|
-
* import { viewTransitionsPlugin } from '@kimesh/router-runtime/plugins/view-transitions'
|
|
685
|
-
*
|
|
686
|
-
* createKimeshApp({
|
|
687
|
-
* plugins: [viewTransitionsPlugin]
|
|
688
|
-
* })
|
|
689
|
-
* ```
|
|
690
|
-
*/
|
|
691
|
-
const viewTransitionsPlugin = defineKimeshRuntimePlugin({
|
|
663
|
+
defineKimeshRuntimePlugin({
|
|
692
664
|
name: "kimesh:view-transitions",
|
|
693
665
|
enforce: "pre",
|
|
694
666
|
setup(app) {
|
|
@@ -737,7 +709,6 @@ const viewTransitionsPlugin = defineKimeshRuntimePlugin({
|
|
|
737
709
|
});
|
|
738
710
|
}
|
|
739
711
|
});
|
|
740
|
-
|
|
741
712
|
//#endregion
|
|
742
713
|
//#region src/plugins/head.ts
|
|
743
714
|
/**
|
|
@@ -888,7 +859,6 @@ function createHeadPlugin(options = {}) {
|
|
|
888
859
|
});
|
|
889
860
|
} };
|
|
890
861
|
}
|
|
891
|
-
|
|
892
862
|
//#endregion
|
|
893
863
|
//#region src/components/KmOutlet.ts
|
|
894
864
|
function supportsViewTransitions() {
|
|
@@ -1021,7 +991,6 @@ const KmOutlet = defineComponent({
|
|
|
1021
991
|
};
|
|
1022
992
|
}
|
|
1023
993
|
});
|
|
1024
|
-
|
|
1025
994
|
//#endregion
|
|
1026
995
|
//#region src/components/KmLink.ts
|
|
1027
996
|
/**
|
|
@@ -1107,7 +1076,6 @@ const KmLink = defineComponent({
|
|
|
1107
1076
|
};
|
|
1108
1077
|
}
|
|
1109
1078
|
});
|
|
1110
|
-
|
|
1111
1079
|
//#endregion
|
|
1112
1080
|
//#region src/components/KmDeferred.ts
|
|
1113
1081
|
/**
|
|
@@ -1169,7 +1137,6 @@ const KmDeferred = defineComponent({
|
|
|
1169
1137
|
};
|
|
1170
1138
|
}
|
|
1171
1139
|
});
|
|
1172
|
-
|
|
1173
1140
|
//#endregion
|
|
1174
1141
|
//#region src/composables/use-search.ts
|
|
1175
1142
|
/**
|
|
@@ -1236,7 +1203,6 @@ function useSearch(schema) {
|
|
|
1236
1203
|
resetSearch
|
|
1237
1204
|
};
|
|
1238
1205
|
}
|
|
1239
|
-
|
|
1240
1206
|
//#endregion
|
|
1241
1207
|
//#region src/composables/use-params.ts
|
|
1242
1208
|
/**
|
|
@@ -1270,7 +1236,6 @@ function useReactiveParams() {
|
|
|
1270
1236
|
const route = useRoute$1();
|
|
1271
1237
|
return computed(() => route.params);
|
|
1272
1238
|
}
|
|
1273
|
-
|
|
1274
1239
|
//#endregion
|
|
1275
1240
|
//#region src/composables/use-navigate.ts
|
|
1276
1241
|
/**
|
|
@@ -1327,7 +1292,6 @@ function useNavigate() {
|
|
|
1327
1292
|
router
|
|
1328
1293
|
};
|
|
1329
1294
|
}
|
|
1330
|
-
|
|
1331
1295
|
//#endregion
|
|
1332
1296
|
//#region src/composables/use-runtime-config.ts
|
|
1333
1297
|
let _config;
|
|
@@ -1372,7 +1336,6 @@ function useRuntimeConfig() {
|
|
|
1372
1336
|
}
|
|
1373
1337
|
return _config;
|
|
1374
1338
|
}
|
|
1375
|
-
|
|
1376
1339
|
//#endregion
|
|
1377
1340
|
//#region src/composables/use-kimesh-app.ts
|
|
1378
1341
|
/**
|
|
@@ -1402,7 +1365,6 @@ function useKimeshApp() {
|
|
|
1402
1365
|
function tryUseKimeshApp() {
|
|
1403
1366
|
return inject(KIMESH_APP_CONTEXT_KEY);
|
|
1404
1367
|
}
|
|
1405
|
-
|
|
1406
1368
|
//#endregion
|
|
1407
1369
|
//#region src/composables/useState.ts
|
|
1408
1370
|
/**
|
|
@@ -1418,7 +1380,7 @@ const STATE_KEY_PREFIX = "$s_";
|
|
|
1418
1380
|
function getKmStateKeys() {
|
|
1419
1381
|
const app = tryUseKimeshApp();
|
|
1420
1382
|
if (!app?._state) return [];
|
|
1421
|
-
return Object.keys(app._state).filter((k) => k.startsWith(
|
|
1383
|
+
return Object.keys(app._state).filter((k) => k.startsWith("$s_")).map((k) => k.slice(3));
|
|
1422
1384
|
}
|
|
1423
1385
|
/**
|
|
1424
1386
|
* Check if a state exists.
|
|
@@ -1426,7 +1388,7 @@ function getKmStateKeys() {
|
|
|
1426
1388
|
function hasKmState(key) {
|
|
1427
1389
|
const app = tryUseKimeshApp();
|
|
1428
1390
|
if (!app?._state) return false;
|
|
1429
|
-
const prefixedKey =
|
|
1391
|
+
const prefixedKey = "$s_" + key;
|
|
1430
1392
|
return prefixedKey in app._state && app._state[prefixedKey] !== void 0;
|
|
1431
1393
|
}
|
|
1432
1394
|
/**
|
|
@@ -1444,7 +1406,7 @@ function clearKmState(keys) {
|
|
|
1444
1406
|
else if (Array.isArray(keys)) keysToDelete = keys;
|
|
1445
1407
|
else keysToDelete = [keys];
|
|
1446
1408
|
for (const key of keysToDelete) {
|
|
1447
|
-
const prefixedKey =
|
|
1409
|
+
const prefixedKey = "$s_" + key;
|
|
1448
1410
|
if (prefixedKey in app._state) delete app._state[prefixedKey];
|
|
1449
1411
|
}
|
|
1450
1412
|
}
|
|
@@ -1459,7 +1421,7 @@ function useState(key, init) {
|
|
|
1459
1421
|
if (init !== void 0 && typeof init !== "function") throw new TypeError("[Kimesh] [useState] init must be a function");
|
|
1460
1422
|
const app = useKimeshApp();
|
|
1461
1423
|
if (!app._state) throw new Error("[Kimesh] [useState] _state not initialized. Make sure you are using Kimesh v1.0+ with state support.");
|
|
1462
|
-
const prefixedKey =
|
|
1424
|
+
const prefixedKey = "$s_" + key;
|
|
1463
1425
|
const state = toRef(app._state, prefixedKey);
|
|
1464
1426
|
if (state.value === void 0 && init) {
|
|
1465
1427
|
const initialValue = init();
|
|
@@ -1471,7 +1433,6 @@ function useState(key, init) {
|
|
|
1471
1433
|
}
|
|
1472
1434
|
return state;
|
|
1473
1435
|
}
|
|
1474
|
-
|
|
1475
1436
|
//#endregion
|
|
1476
1437
|
//#region src/composables/use-navigation-middleware.ts
|
|
1477
1438
|
/**
|
|
@@ -1541,7 +1502,6 @@ function useAfterNavigation(callback) {
|
|
|
1541
1502
|
const { hooks } = useKimeshApp();
|
|
1542
1503
|
return hooks.hook("navigate:after", callback);
|
|
1543
1504
|
}
|
|
1544
|
-
|
|
1545
1505
|
//#endregion
|
|
1546
1506
|
//#region src/composables/use-route-query.ts
|
|
1547
1507
|
/**
|
|
@@ -1660,6 +1620,5 @@ function useRouteQueryBoolean(name, defaultValue = false, options = {}) {
|
|
|
1660
1620
|
}
|
|
1661
1621
|
});
|
|
1662
1622
|
}
|
|
1663
|
-
|
|
1664
1623
|
//#endregion
|
|
1665
|
-
export { KIMESH_APP_CONTEXT_KEY, KIMESH_CONTEXT_KEY, KIMESH_PLUGIN_INDICATOR, KmDeferred, KmLink, KmOutlet, STATE_KEY_PREFIX, abortNavigation, applyHeadConfigNative, applyPlugin, applyPlugins, applyPluginsWithParallel, applyTitleTemplate, clearKmState, collectRouteHeads, createFileRoute, createHeadPlugin, createKimeshApp, createLoaderDataKey, createLoaderGuard, createMiddlewareContext, createMiddlewareExecutor, createMiddlewarePlugin, defineContext, defineKimeshMiddleware, defineKimeshRuntimePlugin, defineRoute, getCorePlugins, getKmStateKeys, getPluginHooks, getPluginMeta, getPluginName, hasKmState, installLoaderGuard, isKimeshRuntimePlugin, isLayoutRouteMeta, mergeAllRouteHeads, mergeHeadConfigs, middlewarePlugin, navigateTo, onBeforeRouteLeave, onBeforeRouteUpdate, queryPlugin, routerPlugin, tryUseKimeshApp, useAfterNavigation, useKimeshApp, useKimeshContext, useLayoutData, useLink, useLoaderData, useMatchLoaderData, useNavigate, useNavigationGuard, useNavigationMiddleware, useParams, useReactiveParams, useRoute, useRouteLoaderData, useRouteQuery, useRouteQueryBoolean, useRouteQueryNumber, useRouter, useRuntimeConfig, useSearch, useState };
|
|
1624
|
+
export { KIMESH_APP_CONTEXT_KEY, KIMESH_CONTEXT_KEY, KIMESH_PLUGIN_INDICATOR, KmDeferred, KmLink, KmOutlet, STATE_KEY_PREFIX, abortNavigation, applyHeadConfigNative, applyPlugin, applyPlugins, applyPluginsWithParallel, applyTitleTemplate, clearKmState, collectRouteHeads, createFileRoute, createHeadPlugin, createKimeshApp, createLoaderDataKey, createLoaderGuard, createMiddlewareContext, createMiddlewareExecutor, createMiddlewarePlugin, defineContext, defineKimeshMiddleware, defineKimeshRuntimePlugin, defineRoute, getCorePlugins, getKmStateKeys, getPluginHooks, getPluginMeta, getPluginName, hasKmState, installLoaderGuard, isKimeshRuntimePlugin, isLayoutRouteMeta, mergeAllRouteHeads, mergeHeadConfigs, middlewarePlugin, navigateTo, onBeforeRouteLeave, onBeforeRouteUpdate, queryPlugin, routerPlugin, tryUseKimeshApp, useAfterNavigation, useKimeshApp, useKimeshContext, useLayoutData, useLink, useLoaderData, useMatchLoaderData, useNavigate, useNavigationGuard, useNavigationMiddleware, useParams, useReactiveParams, useRoute, useRouteLoaderData, useRouteQuery, useRouteQueryBoolean, useRouteQueryNumber, useRouter, useRuntimeConfig, useSearch, useState };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as MiddlewareRegistryEntry, C as navigateTo, D as MiddlewareDefinition, E as MiddlewareContext, M as NavigationRedirect, N as RouteMiddleware, O as MiddlewareOption, P as TypedRouteMiddleware, S as defineKimeshMiddleware, T as KnownMiddleware, _ as createMiddlewarePlugin, b as TypedNavigateToOptions, f as createMiddlewareExecutor, g as MiddlewarePluginOptions, h as createMiddlewareContext, j as MiddlewareResult, k as MiddlewareRegistry, m as executeMiddlewareChain, p as executeMiddleware, v as middlewarePlugin, w as KimeshMiddlewareNames, x as abortNavigation, y as NavigateToOptions } from "../index-
|
|
1
|
+
import { A as MiddlewareRegistryEntry, C as navigateTo, D as MiddlewareDefinition, E as MiddlewareContext, M as NavigationRedirect, N as RouteMiddleware, O as MiddlewareOption, P as TypedRouteMiddleware, S as defineKimeshMiddleware, T as KnownMiddleware, _ as createMiddlewarePlugin, b as TypedNavigateToOptions, f as createMiddlewareExecutor, g as MiddlewarePluginOptions, h as createMiddlewareContext, j as MiddlewareResult, k as MiddlewareRegistry, m as executeMiddlewareChain, p as executeMiddleware, v as middlewarePlugin, w as KimeshMiddlewareNames, x as abortNavigation, y as NavigateToOptions } from "../index-BsEc8r3N.mjs";
|
|
2
2
|
export { KimeshMiddlewareNames, KnownMiddleware, MiddlewareContext, MiddlewareDefinition, MiddlewareOption, MiddlewarePluginOptions, MiddlewareRegistry, MiddlewareRegistryEntry, MiddlewareResult, NavigateToOptions, NavigationRedirect, RouteMiddleware, TypedNavigateToOptions, TypedRouteMiddleware, abortNavigation, createMiddlewareContext, createMiddlewareExecutor, createMiddlewarePlugin, defineKimeshMiddleware, executeMiddleware, executeMiddlewareChain, middlewarePlugin, navigateTo };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { n as middlewarePlugin, r as createMiddlewareContext, t as createMiddlewarePlugin } from "../plugin-
|
|
2
|
-
import { a as defineKimeshMiddleware, i as abortNavigation, n as executeMiddleware, o as navigateTo, r as executeMiddlewareChain, t as createMiddlewareExecutor } from "../middleware-
|
|
3
|
-
|
|
4
|
-
export { abortNavigation, createMiddlewareContext, createMiddlewareExecutor, createMiddlewarePlugin, defineKimeshMiddleware, executeMiddleware, executeMiddlewareChain, middlewarePlugin, navigateTo };
|
|
1
|
+
import { n as middlewarePlugin, r as createMiddlewareContext, t as createMiddlewarePlugin } from "../plugin-Boh8olcn.mjs";
|
|
2
|
+
import { a as defineKimeshMiddleware, i as abortNavigation, n as executeMiddleware, o as navigateTo, r as executeMiddlewareChain, t as createMiddlewareExecutor } from "../middleware-B4001yQN.mjs";
|
|
3
|
+
export { abortNavigation, createMiddlewareContext, createMiddlewareExecutor, createMiddlewarePlugin, defineKimeshMiddleware, executeMiddleware, executeMiddlewareChain, middlewarePlugin, navigateTo };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as createMiddlewarePlugin, g as MiddlewarePluginOptions, v as middlewarePlugin } from "../index-
|
|
1
|
+
import { _ as createMiddlewarePlugin, g as MiddlewarePluginOptions, v as middlewarePlugin } from "../index-BsEc8r3N.mjs";
|
|
2
2
|
export { MiddlewarePluginOptions, createMiddlewarePlugin, middlewarePlugin as default, middlewarePlugin };
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import { n as middlewarePlugin, t as createMiddlewarePlugin } from "../plugin-
|
|
2
|
-
|
|
3
|
-
export { createMiddlewarePlugin, middlewarePlugin as default, middlewarePlugin };
|
|
1
|
+
import { n as middlewarePlugin, t as createMiddlewarePlugin } from "../plugin-Boh8olcn.mjs";
|
|
2
|
+
export { createMiddlewarePlugin, middlewarePlugin as default, middlewarePlugin };
|
|
@@ -50,7 +50,6 @@ function abortNavigation(reason) {
|
|
|
50
50
|
}
|
|
51
51
|
return false;
|
|
52
52
|
}
|
|
53
|
-
|
|
54
53
|
//#endregion
|
|
55
54
|
//#region src/middleware/executor.ts
|
|
56
55
|
/**
|
|
@@ -93,6 +92,5 @@ function createMiddlewareExecutor(appContext) {
|
|
|
93
92
|
}
|
|
94
93
|
};
|
|
95
94
|
}
|
|
96
|
-
|
|
97
95
|
//#endregion
|
|
98
|
-
export { defineKimeshMiddleware as a, abortNavigation as i, executeMiddleware as n, navigateTo as o, executeMiddlewareChain as r, createMiddlewareExecutor as t };
|
|
96
|
+
export { defineKimeshMiddleware as a, abortNavigation as i, executeMiddleware as n, navigateTo as o, executeMiddlewareChain as r, createMiddlewareExecutor as t };
|
|
@@ -49,7 +49,7 @@ function defineKimeshRuntimePlugin(plugin) {
|
|
|
49
49
|
* Check if a value is a Kimesh runtime plugin
|
|
50
50
|
*/
|
|
51
51
|
function isKimeshRuntimePlugin(value) {
|
|
52
|
-
return typeof value === "function" && value[
|
|
52
|
+
return typeof value === "function" && value["__kimesh_plugin"] === true;
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
55
|
* Get plugin metadata
|
|
@@ -69,7 +69,6 @@ function getPluginName(plugin) {
|
|
|
69
69
|
function getPluginHooks(plugin) {
|
|
70
70
|
return plugin.hooks;
|
|
71
71
|
}
|
|
72
|
-
|
|
73
72
|
//#endregion
|
|
74
73
|
//#region src/middleware/context.ts
|
|
75
74
|
/**
|
|
@@ -84,7 +83,6 @@ function createMiddlewareContext(to, from, appContext) {
|
|
|
84
83
|
data: {}
|
|
85
84
|
};
|
|
86
85
|
}
|
|
87
|
-
|
|
88
86
|
//#endregion
|
|
89
87
|
//#region src/middleware/plugin.ts
|
|
90
88
|
/**
|
|
@@ -199,6 +197,5 @@ async function normalizeMiddleware(middleware, namedMiddleware) {
|
|
|
199
197
|
} else if (typeof item === "function") result.push(item);
|
|
200
198
|
return result;
|
|
201
199
|
}
|
|
202
|
-
|
|
203
200
|
//#endregion
|
|
204
|
-
export { defineKimeshRuntimePlugin as a, getPluginName as c, KIMESH_PLUGIN_INDICATOR as i, isKimeshRuntimePlugin as l, middlewarePlugin as n, getPluginHooks as o, createMiddlewareContext as r, getPluginMeta as s, createMiddlewarePlugin as t };
|
|
201
|
+
export { defineKimeshRuntimePlugin as a, getPluginName as c, KIMESH_PLUGIN_INDICATOR as i, isKimeshRuntimePlugin as l, middlewarePlugin as n, getPluginHooks as o, createMiddlewareContext as r, getPluginMeta as s, createMiddlewarePlugin as t };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kimesh/router-runtime",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.46",
|
|
4
4
|
"description": "Runtime router for Kimesh framework",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@tanstack/vue-query": "^5.92.9",
|
|
46
46
|
"@types/node": "^25.0.8",
|
|
47
|
-
"tsdown": "^0.
|
|
47
|
+
"tsdown": "^0.21.2",
|
|
48
48
|
"typescript": "^5.9.3",
|
|
49
49
|
"vitest": "^4.0.17",
|
|
50
50
|
"vue": "^3.5.29",
|
|
File without changes
|