@stories-js/core
Version:
Stories web components to build stories
5 lines • 1.19 kB
JavaScript
/*!
* (C) StoriesJS https://storiesjs.org - GPL-2.0 License
*/
import{r as registerInstance,h,c as Host}from"./index-49238f69.js";function browserSupportsCssZoom(){try{return document.implementation.createHTMLDocument("").body.style.zoom!==undefined}catch(t){return false}}function computeZoomStyle(t){return{zoom:t.toPrecision(2)}}function computeTransformStyle(t,o){return{height:(t+50).toFixed(),transformOrigin:"top left",transform:"scale(".concat(o,")")}}var zoomCss=":host{display:block}";var zoomStyle=browserSupportsCssZoom();var Zoom=function(){function t(t){registerInstance(this,t);this.height=0;this.zoom=1}t.prototype.watchStateHandler=function(t){this.height=t.getBoundingClientRect().height};t.prototype.render=function(){var t=this;var o=zoomStyle?computeZoomStyle(this.zoom):computeTransformStyle(this.height,this.zoom);return h(Host,{style:o},h("div",{ref:function(o){return t.div=o},class:"innerZoomElementWrapper"},h("slot",null)))};Object.defineProperty(t,"watchers",{get:function(){return{div:["watchStateHandler"]}},enumerable:false,configurable:true});return t}();Zoom.style=zoomCss;export{Zoom as stories_zoom};
//# sourceMappingURL=stories-zoom.entry.js.map