feat: add path_geometry data
All checks were successful
Deploy to GitHub Pages / build_site (push) Successful in 2m21s
All checks were successful
Deploy to GitHub Pages / build_site (push) Successful in 2m21s
This commit is contained in:
44
packages/ui/.histoire/dist/assets/story--eZPzd9h.js
vendored
Normal file
44
packages/ui/.histoire/dist/assets/story--eZPzd9h.js
vendored
Normal 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
|
||||
};
|
||||
Reference in New Issue
Block a user