local.min.js 16.1 KB
Newer Older
jutatip's avatar
jutatip committed
1 2
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.localDOM=t():e.localDOM=t()}(this,function(){return function(e){function t(o){if(n[o])return n[o].exports;var i=n[o]={i:o,l:!1,exports:{}};return e[o].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=1)}([function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r={ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12,DOCUMENT_POSITION_DISCONNECTED:1,DOCUMENT_POSITION_PRECEDING:2,DOCUMENT_POSITION_FOLLOWING:4,DOCUMENT_POSITION_CONTAINS:8,DOCUMENT_POSITION_CONTAINED_BY:16,DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:32},a={createContainer:"createContainer",createElement:"createElement",createTextNode:"createTextNode",createComment:"createComment",createDocumentFragment:"createDocumentFragment",appendChild:"appendChild",insertBefore:"insertBefore",removeChild:"removeChild",replaceChild:"replaceChild",setAttribute:"setAttribute",removeAttribute:"removeAttribute",setStyles:"setStyles",setStyle:"setStyle",innerHTML:"innerHTML",innerText:"innerText",textContent:"textContent",setValue:"setValue",addEventListener:"addEventListener",removeEventListener:"removeEventListener",dispatchEvent:"dispatchEvent",invokeNative:"invokeNative",updateProperties:"updateProperties",initiated:"initiated",pause:"pause",play:"play",src:"src",focus:"focus",setSelectionRange:"setSelectionRange"},s={REMOTE_DOM:"REMOTE_DOM",DOCUMENT:"DOCUMENT",WINDOW:"WINDOW",DEFAULT_NAME:"DEFAULT_NAME",QUEUE_INDEX:"QUEUE_INDEX",NODE_INDEX:"NODE_INDEX",INIT:"INIT",EVENT:"EVENT"},u=0,l=function(){function e(t,n){o(this,e),this.channel=t,this.channel.addEventListener("message",function(e){var t=null;try{t=JSON.parse(e.data)}catch(e){return}t[s.REMOTE_DOM]&&n(t[s.REMOTE_DOM])})}return i(e,[{key:"postMessage",value:function(e){this.channel.postMessage(JSON.stringify({REMOTE_DOM:e}))}}]),e}(),c=function(){function e(){o(this,e),this.queue=[],u--,this.index=u,this.pipe=null,this.timer=null}return i(e,[{key:"push",value:function(e){this.queue.push(e),this.schedule()}},{key:"setPipe",value:function(e,t,n){this.pipe=new l(e,t),this.timerFunction=n||function(e){setTimeout(e,0)},this.schedule()}},{key:"schedule",value:function(){!this.timer&&this.pipe&&(this.timer=this.timerFunction(this.flushQueue.bind(this)))}},{key:"flushQueue",value:function(){this.timer=null,this.pipe&&this.queue.length&&(this.pipe.postMessage(this.queue),this.queue.length=0)}}]),e}(),d=["currentTarget","originalTarget","srcElement","target","toElement","path","view"],m=["alignContent","alignItems","alignSelf","alignmentBaseline","all","animation","animationDelay","animationDirection","animationDuration","animationFillMode","animationIterationCount","animationName","animationPlayState","animationTimingFunction","backfaceVisibility","background","backgroundAttachment","backgroundBlendMode","backgroundClip","backgroundColor","backgroundImage","backgroundOrigin","backgroundPosition","backgroundPositionX","backgroundPositionY","backgroundRepeat","backgroundRepeatX","backgroundRepeatY","backgroundSize","baselineShift","border","borderBottom","borderBottomColor","borderBottomLeftRadius","borderBottomRightRadius","borderBottomStyle","borderBottomWidth","borderCollapse","borderColor","borderImage","borderImageOutset","borderImageRepeat","borderImageSlice","borderImageSource","borderImageWidth","borderLeft","borderLeftColor","borderLeftStyle","borderLeftWidth","borderRadius","borderRight","borderRightColor","borderRightStyle","borderRightWidth","borderSpacing","borderStyle","borderTop","borderTopColor","borderTopLeftRadius","borderTopRightRadius","borderTopStyle","borderTopWidth","borderWidth","bottom","boxShadow","boxSizing","breakAfter","breakBefore","breakInside","bufferedRendering","captionSide","clear","clip","clipPath","clipRule","color","colorInterpolation","colorInterpolationFilters","colorRendering","columnCount","columnFill","columnGap","columnRule","columnRuleColor","columnRuleStyle","columnRuleWidth","columnSpan","columnWidth","columns","contain","content","counterIncrement","counterReset","cursor","cx","cy","d","direction","display","dominantBaseline","emptyCells","fill","fillOpacity","fillRule","filter","flex","flexBasis","flexDirection","flexFlow","flexGrow","flexShrink","flexWrap","float","floodColor","floodOpacity","font","fontFamily","fontFeatureSettings","fontKerning","fontSize","fontStretch","fontStyle","fontVariant","fontVariantCaps","fontVariantLigatures","fontVariantNumeric","fontWeight","height","imageRendering","isolation","justifyContent","left","letterSpacing","lightingColor","lineHeight","listStyle","listStyleImage","listStylePosition","listStyleType","margin","marginBottom","marginLeft","marginRight","marginTop","marker","markerEnd","markerMid","markerStart","mask","maskType","maxHeight","maxWidth","maxZoom","minHeight","minWidth","minZoom","mixBlendMode","motion","motionOffset","motionPath","motionRotation","objectFit","objectPosition","opacity","order","orientation","orphans","outline","outlineColor","outlineOffset","outlineStyle","outlineWidth","overflow","overflowWrap","overflowX","overflowY","padding","paddingBottom","paddingLeft","paddingRight","paddingTop","page","pageBreakAfter","pageBreakBefore","pageBreakInside","paintOrder","perspective","perspectiveOrigin","pointerEvents","position","quotes","r","resize","right","rx","ry","shapeImageThreshold","shapeMargin","shapeOutside","shapeRendering","size","speak","src","stopColor","stopOpacity","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","tabSize","tableLayout","textAlign","textAlignLast","textAnchor","textCombineUpright","textDecoration","textIndent","textOrientation","textOverflow","textRendering","textShadow","textSizeAdjust","textTransform","top","touchAction","transform","transformOrigin","transformStyle","transition","transitionDelay","transitionDuration","transitionProperty","transitionTimingFunction","unicodeBidi","unicodeRange","userSelect","userZoom","vectorEffect","verticalAlign","visibility","webkitAppRegion","webkitAppearance","webkitBackgroundClip","webkitBackgroundOrigin","webkitBorderAfter","webkitBorderAfterColor","webkitBorderAfterStyle","webkitBorderAfterWidth","webkitBorderBefore","webkitBorderBeforeColor","webkitBorderBeforeStyle","webkitBorderBeforeWidth","webkitBorderEnd","webkitBorderEndColor","webkitBorderEndStyle","webkitBorderEndWidth","webkitBorderHorizontalSpacing","webkitBorderImage","webkitBorderStart","webkitBorderStartColor","webkitBorderStartStyle","webkitBorderStartWidth","webkitBorderVerticalSpacing","webkitBoxAlign","webkitBoxDecorationBreak","webkitBoxDirection","webkitBoxFlex","webkitBoxFlexGroup","webkitBoxLines","webkitBoxOrdinalGroup","webkitBoxOrient","webkitBoxPack","webkitBoxReflect","webkitClipPath","webkitColumnBreakAfter","webkitColumnBreakBefore","webkitColumnBreakInside","webkitFontSizeDelta","webkitFontSmoothing","webkitHighlight","webkitHyphenateCharacter","webkitLineBreak","webkitLineClamp","webkitLocale","webkitLogicalHeight","webkitLogicalWidth","webkitMarginAfter","webkitMarginAfterCollapse","webkitMarginBefore","webkitMarginBeforeCollapse","webkitMarginBottomCollapse","webkitMarginCollapse","webkitMarginEnd","webkitMarginStart","webkitMarginTopCollapse","webkitMask","webkitMaskBoxImage","webkitMaskBoxImageOutset","webkitMaskBoxImageRepeat","webkitMaskBoxImageSlice","webkitMaskBoxImageSource","webkitMaskBoxImageWidth","webkitMaskClip","webkitMaskComposite","webkitMaskImage","webkitMaskOrigin","webkitMaskPosition","webkitMaskPositionX","webkitMaskPositionY","webkitMaskRepeat","webkitMaskRepeatX","webkitMaskRepeatY","webkitMaskSize","webkitMaxLogicalHeight","webkitMaxLogicalWidth","webkitMinLogicalHeight","webkitMinLogicalWidth","webkitPaddingAfter","webkitPaddingBefore","webkitPaddingEnd","webkitPaddingStart","webkitPerspectiveOriginX","webkitPerspectiveOriginY","webkitPrintColorAdjust","webkitRtlOrdering","webkitRubyPosition","webkitTapHighlightColor","webkitTextCombine","webkitTextDecorationsInEffect","webkitTextEmphasis","webkitTextEmphasisColor","webkitTextEmphasisPosition","webkitTextEmphasisStyle","webkitTextFillColor","webkitTextOrientation","webkitTextSecurity","webkitTextStroke","webkitTextStrokeColor","webkitTextStrokeWidth","webkitTransformOriginX","webkitTransformOriginY","webkitTransformOriginZ","webkitUserDrag","webkitUserModify","webkitWritingMode","whiteSpace","widows","width","willChange","wordBreak","wordSpacing","wordWrap","writingMode","x","y","zIndex","zoom"],f=["onreadystatechange","onpointerlockchange","onpointerlockerror","onbeforecopy","onbeforecut","onbeforepaste","oncopy","oncut","onpaste","onsearch","onselectionchange","onselectstart","onwheel","onwebkitfullscreenchange","onwebkitfullscreenerror","onabort","onblur","oncancel","oncanplay","oncanplaythrough","onchange","onclick","onclose","oncontextmenu","oncuechange","ondblclick","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onended","onerror","onfocus","oninput","oninvalid","onkeydown","onkeypress","onkeyup","onload","onloadeddata","onloadedmetadata","onloadstart","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onmousewheel","onpause","onplay","onplaying","onprogress","onratechange","onreset","onresize","onscroll","onseeked","onseeking","onselect","onshow","onstalled","onsubmit","onsuspend","ontimeupdate","ontoggle","onvolumechange","onwaiting"];t.Commands=a,t.Node=r,t.MessagesQueue=c,t.Pipe=l,t.Constants=s,t.StyleAttributes=m,t.SupportedEvents=f,t.EventDOMNodeAttributes=d},function(e,t,n){"use strict";function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e){N=e,x=e.document}function a(e,t,n,o){n=n||g.Constants.DEFAULT_NAME;var i=new k(e,t,n);h[e][n]=i,T[e][n]=o;var r=O[e];return O[e]=[],c(e,r),i}function s(e,t){return t===N?g.Constants.WINDOW:t&&t.window===t?null:t===x?g.Constants.DOCUMENT:t instanceof N.Node?t[g.Constants.QUEUE_INDEX]===e?t[g.Constants.NODE_INDEX]:null:t instanceof Array?t.map(function(t){return s(e,t)}):"number"==typeof t||"string"==typeof t||"boolean"==typeof t?t:"function"==typeof t?null:t}function u(e,t,n,o){var i={extraData:{}};(o.path||g.EventDOMNodeAttributes.map(function(e){return o[e]}).filter(function(e){return e})).forEach(function(t){i.extraData[s(e,t)]={$value:t.value,type:t.type,checked:t.checked}});for(var r in o)i[r]=s(e,o[r]);w[e].push([g.Constants.EVENT,t,n,i]),"submit"===n&&o.preventDefault()}function l(e){return function(t,n){e(t,n)||O[t].push(n)}}function c(e,t){var n={};t.forEach(function(t){var o=t[0];D[o](e,t);var i=t[t.length-1];if(i){var r=y[e][i];r&&(n[r]=!0)}}),Object.keys(n).forEach(function(t){var n=T[e][t];n&&n()})}function d(e){m(e),f(function(){return m(e)})}function m(e){w[e].push([g.Constants.INIT,{WINDOW:{screen:{width:N.screen.width,height:N.screen.height,deviceXDPI:N.screen.deviceXDPI,logicalXDPI:N.screen.logicalXDPI,orientation:{angle:N.screen.orientation&&N.screen.orientation.angle,type:N.screen.orientation&&N.screen.orientation.type}},devicePixelRatio:N.devicePixelRatio,innerWidth:N.innerWidth,innerHeight:N.innerHeight},DOCUMENT:{body:{clientWidth:x.body.clientWidth}}}])}function f(e){N.addEventListener("orientationchange",e),N.addEventListener("resize",e)}function b(e,t,n){if(!N)throw new Error("Please setWindow before create message queues");var o=new g.MessagesQueue,i=o.index;return w[i]=o,h[i]={},T[i]={},y[i]={},E[i]={},v[i]=n||{},O[i]=[],E[i][g.Constants.DOCUMENT]=x,E[i][g.Constants.WINDOW]=N,C[i]={},o.setPipe(e,c.bind(null,i),t),i}Object.defineProperty(t,"__esModule",{value:!0}),t.setWindow=t.createMessageQueue=t.createContainer=void 0;var p,g=n(0),k=function e(t,n,o){i(this,e),this.domElement=n,this.name=o,this.queueIndex=t,this.index=null},h={},w={},E={},C={},v={},O={},T={},y={},N=null,x=null;"undefined"!=typeof window&&r(window);var D=function(e,t){return Object.keys(e).reduce(function(n,o){return n[o]=t(e[o]),n},{})}((p={},o(p,g.Commands.createContainer,function(e,t){var n=E[e],o=h[e],i=y[e],r=t[2],a=t[1];return i[a]=r,!!o[r]&&(n[a]=o[r].domElement,!0)}),o(p,g.Commands.createElement,function(e,t){var n=E[e];return n[t[1]]=x.createElement(t[2].toLowerCase()),n[t[1]][g.Constants.QUEUE_INDEX]=e,n[t[1]][g.Constants.NODE_INDEX]=t[1],!0}),o(p,g.Commands.createTextNode,function(e,t){var n=E[e];return n[t[1]]=x.createTextNode(t[2]),n[t[1]][g.Constants.QUEUE_INDEX]=e,n[t[1]][g.Constants.NODE_INDEX]=t[1],!0}),o(p,g.Commands.createComment,function(e,t){var n=E[e];return n[t[1]]=x.createComment(t[2]),n[t[1]][g.Constants.QUEUE_INDEX]=e,n[t[1]][g.Constants.NODE_INDEX]=t[1],!0}),o(p,g.Commands.createDocumentFragment,function(e,t){return E[e][t[1]]=x.createDocumentFragment(t[2]),!0}),o(p,g.Commands.appendChild,function(e,t){var n=E[e],o=t[1],i=t[2];return!!n[o]&&(n[o].appendChild(n[i]),!0)}),o(p,g.Commands.insertBefore,function(e,t){var n=E[e],o=t[1],i=t[2],r=t[3];return!!n[o]&&(n[o].insertBefore(n[i],r?n[r]:null),!0)}),o(p,g.Commands.removeChild,function(e,t){var n=E[e],o=t[1],i=t[2];return!(!n[o]||!n[i])&&(n[o].removeChild(n[i]),!0)}),o(p,g.Commands.replaceChild,function(e,t){var n=E[e],o=t[1],i=t[2],r=t[3];return!!(n[o]&&n[i]&&n[r])&&(n[o].replaceChild(n[i],n[r]),!0)}),o(p,g.Commands.setAttribute,function(e,t){var n=E[e];return!!n[t[1]]&&(n[t[1]].setAttribute(t[2],t[3]),!0)}),o(p,g.Commands.removeAttribute,function(e,t){var n=E[e];return!!n[t[1]]&&(n[t[1]].removeAttribute(t[2]),!0)}),o(p,g.Commands.setStyles,function(e,t){var n=E[e];return!!n[t[1]]&&(n[t[1]].style=t[2],!0)}),o(p,g.Commands.setStyle,function(e,t){var n=E[e];return!!n[t[1]]&&(n[t[1]].style[t[2]]=t[3],!0)}),o(p,g.Commands.innerHTML,function(e,t){var n=E[e];return!!n[t[1]]&&(n[t[1]].innerHTML=t[2],!0)}),o(p,g.Commands.innerText,function(e,t){var n=E[e];return!!n[t[1]]&&(n[t[1]].innerText=t[2],!0)}),o(p,g.Commands.textContent,function(e,t){var n=E[e];return!!n[t[1]]&&(n[t[1]].textContent=t[2],t[3]&&(n[t[3]]=n[t[1]].firstChild),!0)}),o(p,g.Commands.setValue,function(e,t){var n=E[e];return!!n[t[1]]&&(n[t[1]].value=t[2],!0)}),o(p,g.Commands.pause,function(e,t){var n=E[e];return!!n[t[1]]&&(n[t[1]].pause(),!0)}),o(p,g.Commands.play,function(e,t){var n=E[e];return!!n[t[1]]&&(n[t[1]].play(),!0)}),o(p,g.Commands.src,function(e,t){var n=E[e];return!!n[t[1]]&&(n[t[1]].src=t[2],!0)}),o(p,g.Commands.focus,function(e,t){var n=E[e];return!!n[t[1]]&&(n[t[1]].focus(),!0)}),o(p,g.Commands.setSelectionRange,function(e,t){var n=E[e];return!!n[t[1]]&&(n[t[1]].setSelectionRange(t[2],t[3],t[4]),!0)}),o(p,g.Commands.addEventListener,function(e,t){var n=E[e],o=C[e];if(n[t[1]]){var i=u.bind(null,e,t[1],t[2]);return o[t[2]]=o[t[2]]||{},o[t[2]][t[3]]=i,n[t[1]].addEventListener(t[2],i,t[4]),!0}return!1}),o(p,g.Commands.removeEventListener,function(e,t){var n=E[e],o=C[e];if(n[t[1]]){o[t[2]]=o[t[2]]||{};var i=o[t[2]][t[3]];return n[t[1]].removeEventListener(t[2],i),!0}return!1}),o(p,g.Commands.dispatchEvent,function(e,t){var n=E[e];if(n[t[1]]){var o=t[4]?new N.CustomEvent(t[2],t[3]):new N.Event(t[2],t[3]);return n[t[1]].dispatchEvent(o),!0}return!1}),o(p,g.Commands.initiated,function(e){d(e)}),o(p,g.Commands.invokeNative,function(e,t){var n=E[e],o=v[e];return!!n[t[1]]&&(o[t[2]]&&o[t[2]](n[t[1]],t[3]),!0)}),p),l);t.createContainer=a,t.createMessageQueue=b,t.setWindow=r}])});
//# sourceMappingURL=local.min.js.map