feat: add path_geometry data
All checks were successful
Deploy to GitHub Pages / build_site (push) Successful in 2m21s

This commit is contained in:
2024-04-24 19:11:00 +02:00
parent 1df62e25e7
commit 4db1cc7d4f
75 changed files with 56957 additions and 3939 deletions

View File

@@ -0,0 +1,44 @@
import { i as defineStore, r as ref, c as computed } from "./vendor-BCKkA27H.js";
import { r as router } from "./GenericMountStory.vue2-BX48YWx2.js";
const useStoryStore = defineStore("story", () => {
const stories = ref([]);
function setStories(value) {
stories.value = value;
}
const currentStory = computed(() => stories.value.find((s) => s.id === router.currentRoute.value.params.storyId));
const currentVariant = computed(() => {
var _a;
return (_a = currentStory.value) == null ? void 0 : _a.variants.find((v) => v.id === router.currentRoute.value.query.variantId);
});
const maps = computed(() => {
const storyMap = /* @__PURE__ */ new Map();
const variantMap = /* @__PURE__ */ new Map();
for (const story of stories.value) {
storyMap.set(story.id, story);
for (const variant of story.variants) {
variantMap.set(`${story.id}:${variant.id}`, variant);
}
}
return {
stories: storyMap,
variants: variantMap
};
});
function getStoryById(id) {
return maps.value.stories.get(id);
}
function getVariantById(idWithStoryId) {
return maps.value.variants.get(idWithStoryId);
}
return {
stories,
setStories,
currentStory,
currentVariant,
getStoryById,
getVariantById
};
});
export {
useStoryStore as u
};