motion
Version:
motion - moving development forward
2 lines • 6.51 kB
JavaScript
webpackJsonp([0],{0:function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}var r=n(1),i=o(r),u=n(2),c=o(u),a=n(61),l=o(a),s=(0,l["default"])({});window._DT={emitter:s,data:null,on:function(e,t){s.on(e,t)},timer:{lastMsgInfo:null,timing:{},lastTimes:{},hasLogged:!1,done:function(e){var t=Motion.timer.timing[e],n=+Date.now()-t.start;n&&(t&&(Motion.timer.lastTimes[e]=n,delete Motion.timer.timing[e]),Motion.timer.hasLogged||(setTimeout(function(){return Motion.timer.hasLogged=!1}),Motion.timer.lastTimes[e]=+Date.now()-t.start,on.event("hot:finished",{time:n})),Motion.timer.hasLogged=!0)},time:function(e,t){Motion.timer.timing[e]=t}}};var d={websocketPort:window._MOTION_WEBSOCKET_PORT};(0,i["default"])(window._DT,d),(0,c["default"])(window._DT,d)},1:function(e,t){"use strict";function n(e,t,n,o,r){c({message:e,file:t,line:n,col:o,stack:r&&r.stack}),u.emitter.emit("runtime:error")}function o(e,t){u=e,window.onViewLoaded=function(){return c("success",null)}}function r(e){if(e.loc){var t=e.message,n=e.fileName,o=e.loc,r=e.stack;c({message:t,stack:r,file:n,line:o.line,col:o.column})}else if(e.lineNumber){var t=e.message,r=e.stack,n=e.fileName,i=e.lineNumber,u=e.column;c({message:t,stack:r,file:n,line:i,col:u})}}function i(){c(null)}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o,t.compileError=r,t.compileSuccess=i;var u=void 0,c=function(e){u.data=e};window.motionRuntimeError=n},2:function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){(0,C["default"])(e,t,{"editor:location":function(t){e.editorLocation=t},"view:locations":function(t){e.viewLocations=t},"script:add":function(e){f(e)},"stylesheet:add":function(e){c(e.view)},"stylesheet:remove":function(e){y(e.view)},"compile:error":function(e){(0,b.compileError)(e.error)},"compile:success":function(e){(0,b.compileSuccess)()},"packages:reload":d("__motionExternals"),"internals:reload":d("__motionInternals",{reloadAll:!0}),"file:delete":function(e){var t=e.name;if(Motion){var n=_Motion.getFile(t);n.map(y),T(t),Motion.deleteFile(t)}},"file:outsideChange":function(e){var t=e.name,n=e.changed;_Motion.fileChanged[t]=n},"motion:opts":function(e){window.__motionopts=e},"editor:state":function(t){e.editor=t,e.emitter.emit("editor:state")}})}function i(){var e={},t={},n={};return function(o,r){function i(u){e[o]=u,t[o]=!1,n[o]&&(n[o]=!1,r(e[o],i))}var u=e[o];if(!n[o]){if(t[o])return void(n[o]=!0);t[o]=!0,r(u,i)}}}function u(e){var t=e.replace("/_/","");Date.now();C["default"].send("script:load",{path:t}),D(e,function(n,o){var r=n||document.querySelector(E(e))||_(e);l(r,"src",function(){C["default"].send("script:done",{path:t}),o()})})}function c(e){q(e,function(t,n){l(t||A(e)||w(O(e)),"href",n)})}function a(e){return e.parentNode?e.parentNode:"SCRIPT"==e.nodeName?document.body:document.head}function l(e,t){var n=arguments.length<=2||void 0===arguments[2]?function(){}:arguments[2];if(e){var o=a(e),r=M(e,t),i=!1,u=void 0,c=function(){i||(clearTimeout(u),i=!0,s(e,o,function(){return n(r)}))};r.onerror=c,r.onload=c,o.appendChild(r),u=setTimeout(function(){i||s(e,e.parentNode,c,{leftover:1})},120)}}function s(e,t,n){var o=arguments.length<=3||void 0===arguments[3]?{}:arguments[3],r=o.leftover,i=void 0===r?2:r;try{t.removeChild(e),setTimeout(n)}catch(u){for(var c="SCRIPT"==e.nodeName,a=document.querySelectorAll(c?E(e.src):L(e.href)),l=0;l<a.length-i;l++){var s=a[l];try{s.parentNode.removeChild(s)}catch(u){try{document.body.removeChild(s),document.head.removeChild(s)}catch(u){}}}setTimeout(n,30)}}function d(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return function(n){var o=document.getElementById(e);if(o){var r=t.reloadAll?function(){return m(n)}:v;l(o,"src",r)}}}function f(e,t){var n=e.name,o=(e.timestamp,e.src);u(o||"/_"+n)}function m(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.importers,n=t&&t.length,o=n?j(t):document.querySelectorAll(".__motionScript");if(o.length){o.length;n?t.forEach(_Motion.resetViewsInFile):_Motion.resetViewState();var r=[];[].forEach.call(o,function(e){return r.push(new S["default"](function(t){return l(e,"src",t)}))}),S["default"].all(r).then(function(){Motion.render()})}}function v(){return R>10?void(R=0):void("undefined"!=typeof Motion?(setTimeout(Motion.render),R=0):(R++,setTimeout(v,50)))}function g(e){return e.replace(/^http\:\/\/[^\/]+/,"")}function p(e){return e.replace(/\?[0-9]+$/,"")}function h(e){return p(e)+("?"+Date.now())}function _(e){var t=document.createElement("script");return t.src=e,t}function w(e){var t=document.createElement("link");return t.href=e,t.rel="stylesheet",t}function M(e,t){var n=void 0;if("SCRIPT"!=e.tagName)n=e.cloneNode(!1);else{n=document.createElement("script");for(var o=e.attributes,r=0;r<o.length;r++)"src"!=o[r].name&&n.setAttribute(o[r].name,o[r].value)}return n.setAttribute(t,h(e.getAttribute(t))),n}function y(e){var t=A(e);t&&t.parentNode&&t.parentNode.removeChild(t)}function T(e){var t=P(e.replace(".js",""));t&&t.parentNode&&(t.parentNode.removeChild(t),Motion.removeFile(e))}Object.defineProperty(t,"__esModule",{value:!0});var N=n(3),S=o(N);t["default"]=r;var b=n(1),k=n(58),C=o(k),E=function(e){return'script[src^="'+p(g(e))+'"]'},I=function(e){return"/_/"+e+".js"},P=function(e){return document.querySelector(E(I(e)))},L=function(e){return'link[href^="'+p(g(e))+'"]'},O=function(e){return"/__/styles/"+e+".css"},A=function(e){return document.querySelector(L(O(e)))},D=i(),q=i(),j=function(e){return e.map(function(e){return document.querySelector('.__motionScript[src*="'+e+'"]')})},R=0},58:function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function r(e,t,n){f=t,m=e,v=n,i(),m.messageEditor=function(e){r.send("editor",e)}}function i(){g||(g=!0,h=new WebSocket("ws://localhost:"+f.websocketPort+"/"),h.onopen=u,h.onmessage=c,h.onerror=a,h.onclose=a)}function u(){p=!0,g=!1,w=!1}function c(e){if(e=JSON.parse(e.data),localStorage.getItem("__motionLog")&&console.log("socket","onMessage","message",e&&e._type,e),e){var t=v[e._type];t&&t(e),m.data=e,m.emitter.emit(e._type)}}function a(){g=!1,p=!1,h&&h.close(),w||(w=!0,_=0,l())}function l(){if(!(p||_>50)){i(),_++;var e=1e3*_;setTimeout(l,e)}}Object.defineProperty(t,"__esModule",{value:!0});var s=n(59),d=o(s);t["default"]=r;var f=void 0,m=void 0,v=void 0,g=!1,p=!1,h=null;r.send=function(e,t){t=t||{},t._type=e,h.send((0,d["default"])(t))};var _=void 0,w=!1}});
//# sourceMappingURL=devtools.prod.js.map