storybook-chromatic
Version:
Visual Testing for Storybook
2 lines • 2.72 kB
JavaScript
module.exports=function(e){var r={};function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(r){return e[r]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="",t(t.s=3)}([function(e,r){e.exports=require("@babel/runtime/helpers/toConsumableArray")},function(e,r){e.exports=require("@babel/runtime/helpers/objectSpread")},function(e,r){e.exports=require("@babel/runtime/helpers/objectWithoutProperties")},function(e,r,t){"use strict";t.r(r);var n=t(2),o=t.n(n),i=t(0),u=t.n(i),a=t(1),c=t.n(a);var s=!1;r.default=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(s)throw new Error("Chromatic already configured.");if(s=!0,e===[])throw new Error("Chromatic must be configured with at least one runtime. http://docs.chromaticqa.com/runtime-api");var r=document.location.hash.match("__chromatic_isolator__");!function(e){var r=e.runtimes,t={};function n(e){var r=c()({},e,{input:"string"==typeof e.input?JSON.parse(e.input):e.input});if(e.runtime){var n=t[e.runtime];if(!n)throw new Error("Didn't find a renderer for runtime '".concat(e.runtime,"' -- are you sure you added it in your client configuration?"));return n(r)}throw new Error("No runtime passed for spec",e)}r.forEach(function(e){t[e.runtime]=e.renderSpec}),window.__chromaticRuntimeSpecs__=function(){return r.map(function(e){var r=e.runtime;return(0,e.specs)().map(function(e){return c()({runtime:r},e)})}).reduce(function(e,r){return[].concat(u()(e),u()(r))},[])},window.__renderChromaticSpec__=n,window.addEventListener("message",function(e){var r=e.data,t=e.source,i=e.origin,u=r.message,a=o()(r,["message"]);if("requestCapabilities"===u)t.postMessage({message:"capabilities",service:"chromatic-isolator",version:0},i);else if("renderSpec"===u)try{n(a.spec),t.postMessage({message:"renderedSpec"},i)}catch(e){throw t.postMessage({message:"renderSpecError",error:e.toString()},i),e}},!1)}({runtimes:[].concat(e),clearScreen:r})}}]);
//# sourceMappingURL=client.js.map