@codebakery/origami
Version:
Angular + Polymer
16 lines (14 loc) • 6.11 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@codebakery/origami/util"),require("@polymer/polymer/lib/utils/case-map"),require("@codebakery/origami/polyfills")):"function"==typeof define&&define.amd?define("@codebakery/origami/templates",["exports","@angular/core","@codebakery/origami/util","@polymer/polymer/lib/utils/case-map","@codebakery/origami/polyfills"],t):t(((e=e||self).codebakery=e.codebakery||{},e.codebakery.origami=e.codebakery.origami||{},e.codebakery.origami.templates={}),e.ng.core,e.codebakery.origami.util,e.Polymer.CaseMap,e.codebakery.origami.polyfills)}(this,(function(e,t,n,r,o){"use strict";
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */function i(e,t,n,r){var o,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var l=e.length-1;l>=0;l--)(o=e[l])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}function a(e,t){return function(n,r){t(n,r,e)}}function l(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function l(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,l)}c((r=r.apply(e,t||[])).next())}))}function c(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}var s,u=new t.InjectionToken("polymerHost");function p(e){return e._addEventListenerToNode||(e._addEventListenerToNode=function(e,t,n){e.addEventListener(t,n)}),e}function f(){var e=this;if(!s){s=new Promise((function(t){return l(e,void 0,void 0,(function(){return c(this,(function(e){switch(e.label){case 0:return[4,n.whenSet(window,"HTMLTemplateElement")];case 1:return e.sent(),r=HTMLTemplateElement.prototype.appendChild,HTMLTemplateElement.prototype.appendChild=function(e){return this.content?this.content.appendChild(e):r.apply(this,[e])},t(),[2]}var r}))}))}))}return s}var d=function(){function e(e,t,n){var r=this;this.elementRef=e,this.polymerHost=t,this.zone=n,this.ready=l(r,void 0,void 0,(function(){return c(this,(function(t){switch(t.label){case 0:return this.polymerHost?(this.enableEventBindings(e.nativeElement),[4,this.enablePropertyBindings(e.nativeElement)]):[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}}))}))}return e.prototype.enableEventBindings=function(e){e.__dataHost=this.polymerHost},e.prototype.enablePropertyBindings=function(e){return l(this,void 0,void 0,(function(){var t,o,i,a,l=this;return c(this,(function(c){switch(c.label){case 0:return[4,this.getTemplateInfo(e)];case 1:if(t=c.sent().hostProps)for(a in o=function(t){var o=i.polymerHost[t];n.wrapAndDefineDescriptor(i.polymerHost,t,{afterSet:function(n,r){n&&(e["_host_"+t]=r)}}),i.polymerHost[t]=o;var a="_host_"+r.camelToDashCase(t)+"-changed";e.addEventListener(a,(function(e){l.isSplicesChange(e)||l.isPathChange(e)||l.zone.run((function(){l.polymerHost[t]=e.detail.value}))}))},i=this,t)o(a);return[2]}}))}))},e.prototype.getTemplateInfo=function(e){return l(this,void 0,void 0,(function(){return c(this,(function(t){switch(t.label){case 0:return e._templateInfo?[2,e._templateInfo]:[3,1];case 1:return[4,n.whenSet(e,"_templateInfo")];case 2:return[2,t.sent()]}}))}))},e.prototype.isSplicesChange=function(e){var t=e.detail.value;return t&&Array.isArray(t.indexSplices)},e.prototype.isPathChange=function(e){return"string"==typeof e.detail.path},e.ctorParameters=function(){return[{type:t.ElementRef},{type:void 0,decorators:[{type:t.Inject,args:[u]},{type:t.Optional}]},{type:t.NgZone}]},e=i([t.Directive({selector:"template"}),a(1,t.Inject(u)),a(1,t.Optional())],e)}();f();var y=f,h={provide:t.APP_INITIALIZER,multi:!0,useValue:y},m=function(){function e(){}return e=i([t.NgModule({imports:[o.WebComponentsReadyModule],declarations:[d],providers:[h],exports:[d]})],e)}();e.POLYMER_HOST=u,e.TEMPLATES_READY_PROVIDER=h,e.TemplateDirective=d,e.TemplateModule=m,e.patchPolymerHost=p,e.polymerHost=function(e){return{provide:u,useFactory:p,deps:[e]}},e.resetShimHTMLTemplateAppend=function(){s=void 0},e.shimHTMLTemplateAppend=f,e.ɵ0=y,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=origami-templates.umd.min.js.map