mockm
Version:
Analog interface server, painless parallel development of front and back ends.
8 lines • 7.36 kB
JavaScript
/**
* Minified by jsDelivr using UglifyJS v3.1.10.
* Original file: /npm/jinkela@1.2.18/umd.js
*
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
*/
!function(e){"object"==typeof module&&module.exports?e(function(e,t,n){"string"!=typeof e&&(n=t,t=e,e=null),t instanceof Array||(n=t,t=[]);var r;r=[],module.exports=n.apply(module.exports,r)||module.exports}):"function"===String(typeof define)&&define.amd?e(define):e(function(e,t,n){"string"!=typeof e&&(n=t,t=e,e=null),t instanceof Array||(n=t,t=[]);for(var r={},o=[],i=0;i<t.length;i++)o[i]=window[t[i]];if(r=n.apply(r,o)||r,e){try{"object"==typeof execScript&&execScript("var "+e)}catch(e){}window[e]=r}})}(function(e){e(function(){"use strict";!function(){var e={td:"tr",th:"tr",tr:"tbody",tbody:"table",thead:"table",tfoot:"table",caption:"table"},t={2:"value",3:"data"},n=1,r=function(e,t,n){for(var r=[],o=e;o;o=Object.getPrototypeOf(o)){var i=Object.getOwnPropertyDescriptor(o,t);i&&r.push(i.get?i.get.call(e):i.value)}if(r.reverse(),"function"==typeof n)for(var a=0;a<r.length;a++)r[a]=n(r[a]);return r},o=function(e,t,n){return Object.defineProperty(e,t,Object.create(n,{configurable:{value:!0}}))},i=function(e,t,n){o(e,t,{get:function(){return o(this,t,{value:n.call(this)})[t]}})},a=function(e,t){for(var n=0;n<e.length;n++)e[n].call(t)},c=["tagName","template","styleSheet"],l=function(){var e={};this.extends.apply(e,arguments),"function"==typeof this.beforeParse&&this.beforeParse(e),function(e,t){for(var n,r=0;n=c[r];r++)n in t&&(Object.defineProperty(e,n,{configurable:!0,value:t[n]}),delete t[n])}(this,e),function(e){var n=Object.create(null);o(e,"@@watches",{value:n}),function r(o,i){var a,c,l,f,u,p=o.firstChild;if(1===o.nodeType)for(;p;)c=p.nextSibling,r(p),p=c;if(s.type[o.nodeName])l=s.type[o.nodeName](e,o,i);else for(u=0;u<s.regexp.length;u++)if(s.regexp[u].regexp.test(o.nodeName)){l=s.regexp[u].factory(e,o,i);break}if(/^\{([$_a-zA-Z][$\w]*)\}$/.test(o[t[o.nodeType]])&&(RegExp.$1 in n?n[RegExp.$1]:n[RegExp.$1]=[]).push(l||o),a=o.attributes)for(u=0;f=a[u];u++)r(f,o)}(e.element);for(var r in n)!function(r){var i,a=n[r],c=e[r];o(e,r,{enumerable:!0,get:function(){return i},set:function(n){i=n;for(var r=0;r<a.length;r++)"function"==typeof a[r]?a[r].call(e,n):a[r][t[a[r].nodeType]]=n}}),e[r]=c}(r)}(this),"function"==typeof this.beforeExtends&&this.beforeExtends(),this.extends(e);var n=[this,arguments];r(this,"init",function(e){e.apply.apply(e,n)})};i(l.prototype,"element",function(){var t=this.constructor,i="@@domCache";if(!t.hasOwnProperty(i)){var a,c=this.template;if(c){var f=String(c.replace(/<!--[\s\S]*?-->/g,"").match(/<([a-z][\w-]*)|$/i)[1]).toLowerCase();if(a=document.createElement(e[f]||"div"),a.innerHTML=c,1!==a.children.length)throw new Error("Jinkela: Template require 1 root element");a=a.firstElementChild}else a=document.createElement(this.tagName||"div");var s=r(this,"styleSheet");if(s.length){var u=n++;a.setAttribute("jinkela-class",u);var p=s.join("\n").replace(/:scope\b/g,'[jinkela-class="'+u+'"]');"function"==typeof l.cssPreprocessor&&(p=l.cssPreprocessor(p)),l.style.insertAdjacentHTML("beforeend",p)}o(t,i,{value:a})}return t[i].cloneNode(!0)}),i(l,"style",function(){return document.head.appendChild(document.createElement("style"))}),i(l.prototype,"@@didMountHandlers",function(){return[function(){a(r(this,"didMount"),this)}.bind(this)]}),o(l.prototype,"extends",{value:function(){for(var e=0;e<arguments.length;e++){var t=arguments[e];if(t instanceof Object)for(var n in t)this[n]=t[n]}}});var f=function(e,t){o(l.prototype,e,{value:function(e){return this.hasOwnProperty("parent")||o(this,"parent",{value:e}),e instanceof l&&(e=e.element),t.call(this,e),a(this["@@didMountHandlers"],this),this}})};f("to",function(e){e.appendChild(this.element)}),f("renderTo",function(e){e.appendChild(this.element)}),f("renderWith",function(e){e.parentNode.replaceChild(this.element,e)});var s={type:Object.create(null),regexp:[]};l.register=function(e,t){e instanceof RegExp?s.regexp.push({regexp:e,factory:t}):s.type[e]=t},window.Jinkela=l}(),Object.defineProperty(Jinkela,"from",{configurable:!0,value:function(e){if(e instanceof Array){for(var t=[],n=0;n<e.length;n++)t.push(new this(e[n]));var r=function(n){for(var r=0;r<e.length;r++)t[r].to(n);return this};return Object.defineProperty(t,"renderTo",{configurable:!0,value:r}),Object.defineProperty(t,"to",{configurable:!0,value:r}),t}return new this(e)}}),Jinkela.cssPreprocessor=function(e){var t=[],n=[];e=(e=e.replace(/\/\*[\s\S]*?\*\//g,"")).replace(/(["'])([\s\S]*?)(\1)/g,function(e){return"<string>"+t.push(e)+"</string>"}).replace(/@[^{}]+\{([^{}]+\{[^{}]*\})*\s*\}/g,function(e){return"<atBlock>"+n.push(e)+"</atBlock>"});for(var r,o=/(([^{};]+)\{[^{}]*?)([^{};]+)(\{[^{}]*?\})/;r!==e;)e=(r=e).replace(o,function(e,t,n,r,o){for(var i=n.split(/,/g),a=r.split(/,/g),c=[],l=0;l<i.length;l++)for(var f=0;f<a.length;f++)c.push(i[l]+" "+a[f]+o);return c.join("")+t});return e=e.replace(/\s+&/g,""),e=e.replace(/<atBlock>(\d+)<\/atBlock>/g,function(e,t){return n[t-1]}).replace(/<string>(\d+)<\/string>/g,function(e,n){return t[n-1]})},Jinkela.register(/^if(-not)?$/,function(e,t,n){n.component&&(n=n.component.element);var r=!!RegExp.$1,o=new Comment(" "+t.name+'="'+t.value+'" '),i=!0,a=/^\{(.*)\}$|$/.exec(t.value)[1];return e["@@didMountHandlers"].push(function(){this[a]=this[a]}),function(e){i!==(e=!!e^r)&&(e?o.parentNode&&(o.parentNode.replaceChild(n,o),i=e):n.parentNode&&(n.parentNode.replaceChild(o,n),i=e))}}),Jinkela.register(/^JKL(?:-[A-Z0-9]+)+$/,function(e,t){var n=t.tagName.slice(4).replace(/(?!^)-?./g,function(e){return e.length>1?e[1]:e.toLowerCase()}),r=e[n]||new Function("return typeof "+n+" === 'function' && "+n+";")();if(!r)throw new Error("No component can be matched with "+t.tagName);for(var o={},i=t.attributes,a=e["@@watches"],c=0;c<i.length;c++){var l=i[c].nodeName,f=i[c].value,s=/^\{([$_a-zA-Z][$\w]*)\}$/.exec(f);if(s){var u=s[1];(u in a?a[u]:a[u]=[]).push(function(e,t){p&&(p[e]=t)}.bind(null,l)),o[l]=e[u]}else o[l]=f}var p=r&&new r(o,{children:[].slice.call(t.childNodes,0)});t.component=p,p.renderWith(t)}),Jinkela.register(/^on-/,function(e,t,n){n.component&&(n=n.component.element);var r=t.nodeName.match(/^on-(.*)|$/)[1];return function(t){"function"==typeof t&&n.addEventListener(r,t.bind(e))}}),Jinkela.register("ref",function(e,t,n){var r=function(e){return null==e&&(e=new Comment(" "+e+" ")),e instanceof Jinkela&&(e=e.element),e instanceof Node||(e=new Text(e)),e};Object.defineProperty(e,t.value,{configurable:!0,enumerable:!0,get:function(){return n instanceof DocumentFragment?n.originalList:n.component||n},set:function(e){if((e instanceof HTMLCollection||e instanceof NodeList)&&(e=[].slice.call(e)),e instanceof DocumentFragment&&(e=[].slice.call(e.childNodes)),e instanceof Array)if(e.length){var t=new DocumentFragment;e.forEach(function(e){t.appendChild(r(e))}),t.originalList=e,e=t}else e=new Comment(" empty list ");else e=r(e);var o;if(n instanceof DocumentFragment){var i=n.originalList[0];(o=i.parentNode)&&(o.insertBefore(e,i),n.originalList.forEach(function(e){e.remove()})),n=e}else e!==n&&((o=n.parentNode)&&(o.insertBefore(e,n),n.remove()),n=e)}})})})});
//# sourceMappingURL=/sm/045cd90baba7b704b2a2951bd1c7ed36cdf9f3af77f332a55e9483f4e52080a4.map