UNPKG

@stories-js/core

Version:

Stories web components to build stories

51 lines (46 loc) 1.48 kB
/*! * (C) StoriesJS https://storiesjs.org - GPL-2.0 License */ import { r as registerInstance, h, c as Host, g as getElement } from './index-49238f69.js'; import { a as api } from './index-aaa78d22.js'; import { m as messages } from './messages-1b750fe6.js'; import './index-f706f0f6.js'; const CONTROL_EVENT = 'CONTROL_EVENT'; const addonControlsCss = ":host{display:block}"; const AddonControls = class { constructor(hostRef) { registerInstance(this, hostRef); this.controls = []; this.onControl = (event) => { // this.store.state.actions.push(actionDisplay) console.log('onControl.event', event); }; } title() { return "Controls"; } async storyContextChanged(story, context) { console.log('AddonControls.storyContextChanged', story, context); } async componentDidLoad() { // Register addon api.registerAddon(this); // Register event listeners messages.on(CONTROL_EVENT, this.onControl); // Create store // this.store = createStore({controls: []}) } async disconnectedCallback() { // Unregister event listener messages.off(CONTROL_EVENT, this.onControl); // Unregster addon api.unregisterAddon(this); } render() { return (h(Host, null, h("div", null, "Addon Controls"))); } get el() { return getElement(this); } }; AddonControls.style = addonControlsCss; export { AddonControls as stories_addon_controls }; //# sourceMappingURL=stories-addon-controls.entry.js.map