UNPKG

motion

Version:

motion - moving development forward

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