UNPKG

@stories-js/core

Version:

Stories web components to build stories

5 lines 1.33 kB
/*! * (C) StoriesJS https://storiesjs.org - GPL-2.0 License */ import{r as registerInstance,i as createEvent,h}from"./index-49238f69.js";import{a as api}from"./index-aaa78d22.js";import{s as state}from"./index-f706f0f6.js";var appCss=":host{height:100%;width:100%;background-color:coral}";var App=function(){function t(t){registerInstance(this,t);this.storyChange=createEvent(this,"storyChange",7);this.storyContextChange=createEvent(this,"storyContextChange",7);this.modules=[];this.store=state}t.prototype.createContext=function(t){var e={args:Object.assign({},t.args),argTypes:Object.assign({},t.argTypes),parameters:Object.assign({},t.parameters),initialArgs:Object.assign({},t.args)};return e};t.prototype.onHash=function(){var t=api.getStoryIdFromURL();var e=state.story=t?state.stories[t]:undefined;console.log("onHash",t,e);api.selectStory(t);this.storyChange.emit(e);console.log("storyChange emit",e);var s=e?this.createContext(e):undefined;state.context=s;this.storyContextChange.emit(s);console.log("storyContextChange emit",e)};t.prototype.componentDidLoad=function(){console.log("componentDidLoad",this.modules);api.setStories(this.modules);this.onHash()};t.prototype.render=function(){return h("slot",null)};return t}();App.style=appCss;export{App as stories_app}; //# sourceMappingURL=stories-app.entry.js.map