@tanstack/vue-router
Version:
Modern and scalable routing for Vue applications
33 lines (32 loc) • 912 B
JavaScript
import { batch, createAtom } from "@tanstack/vue-store";
//#region src/routerStores.ts
var getStoreFactory = (_opts) => {
return {
createMutableStore: createAtom,
createReadonlyStore: createAtom,
batch,
init: (stores) => {
stores.childMatchIdByRouteId = createAtom(() => {
const ids = stores.matchesId.get();
const obj = {};
for (let i = 0; i < ids.length - 1; i++) {
const parentStore = stores.matchStores.get(ids[i]);
if (parentStore?.routeId) obj[parentStore.routeId] = ids[i + 1];
}
return obj;
});
stores.pendingRouteIds = createAtom(() => {
const ids = stores.pendingIds.get();
const obj = {};
for (const id of ids) {
const store = stores.pendingMatchStores.get(id);
if (store?.routeId) obj[store.routeId] = true;
}
return obj;
});
}
};
};
//#endregion
export { getStoreFactory };
//# sourceMappingURL=routerStores.js.map