UNPKG

@tanstack/vue-router

Version:

Modern and scalable routing for Vue applications

33 lines (32 loc) 937 B
import { batch, createStore } from "@tanstack/vue-store"; //#region src/routerStores.ts var getStoreFactory = (_opts) => { return { createMutableStore: createStore, createReadonlyStore: createStore, batch, init: (stores) => { stores.childMatchIdByRouteId = createStore(() => { const ids = stores.matchesId.state; const obj = {}; for (let i = 0; i < ids.length - 1; i++) { const parentStore = stores.activeMatchStoresById.get(ids[i]); if (parentStore?.routeId) obj[parentStore.routeId] = ids[i + 1]; } return obj; }); stores.pendingRouteIds = createStore(() => { const ids = stores.pendingMatchesId.state; const obj = {}; for (const id of ids) { const store = stores.pendingMatchStoresById.get(id); if (store?.routeId) obj[store.routeId] = true; } return obj; }); } }; }; //#endregion export { getStoreFactory }; //# sourceMappingURL=routerStores.js.map