UNPKG

toloframework

Version:

Javascript/HTML/CSS compiler for Firefox OS or nodewebkit apps using modules in the nodejs style.

2 lines 4.39 kB
require("tfw.view.button",function(e,t,n){function s(){var e=[];if(this.flat)if(this.pressed)switch(this.type){case"default":e.push("thm-bg3");break;case"primary":e.push("thm-bgP");break;case"secondary":e.push("thm-bgS")}else switch(this.type){case"primary":e.push("thm-fgP");break;case"secondary":e.push("thm-fgS")}else{switch(this.type){case"default":e.push("thm-bg3");break;case"primary":e.push("thm-bgP");break;case"secondary":e.push("thm-bgS")}this.pressed?e.push("thm-ele4"):e.push("thm-ele2")}return e}function a(e){this.$elements.icon.size=e?20:28}var i=function(){function t(){return s(n,arguments)}var n={en:{cancel:"Cancel",close:"Close",delete:"Delete",edit:"Edit",gotit:"Got it",no:"No",ok:"OK",save:"Save",yes:"Yes"},fr:{cancel:"Annuler",close:"Fermer",delete:"Supprimer",edit:"Editer",gotit:"J'ai compris",no:"Non",ok:"Valider",save:"Sauver",yes:"Oui"}},s=e("$").intl;return t.all=n,t}(),o={getClasses:s,onSmallChanged:a};try{t.exports=function(){function t(e,t,n){return void 0===e[t]?n:e[t]}function n(e,t,n){n?i.addClass(e,t):i.removeClass(e,t)}function s(e,t,n){n?i.removeClass(e,t):i.addClass(e,t)}function a(e,t,n){n?i.removeAtt(e,t):i.att(e,t)}var i=e("dom"),c=e("tfw.binding.property-manager"),r=e("tfw.view").Tag,l=e("tfw.binding.link"),d=e("tfw.view"),u=e("tfw.binding.converters"),h=e("tfw.view.icon");d.ensureCodeBehind(o,"onSmallChanged");var f=u.get("string"),m=u.get("boolean"),p=u.get("enum"),w=u.get("unit"),b=u.get("isEmpty");return function(e){try{void 0===e&&(e={}),this.$elements={};var d=this,u=c(this);u.createAction("action"),u.create("tag",{cast:f}),u.create("icon"),u.create("content",{cast:f}),u.create("pressed",{cast:m}),u.create("flat",{cast:m}),u.create("type",{cast:p(["default","primary","secondary"])}),u.create("enabled",{cast:m}),u.create("inverted",{cast:m}),u.create("visible",{cast:m}),u.create("width",{cast:w}),u.create("wide",{cast:m}),u.create("responsive",{cast:m}),u.create("small",{cast:m});var v=new r("BUTTON",["class"]),g=new r("DIV",["class"]),y=new h;this.$elements.icon=y,i.add(g,y);var C=new r("DIV",["class"]);this.$elements.text=C,i.add(v,g,C),Object.defineProperty(this,"$",{value:v.$,writable:!1,enumerable:!1,configurable:!1}),i.on(v,"tap",function(e){d.action=d.tag}),i.on(v,"keyup",function(e){d.action=d.tag,d.pressed=!1}),i.on(v,"down",function(e){d.pressed=!0}),i.on(v,"up",function(e){d.pressed=!1}),new l({A:{obj:d,name:"flat"},B:{action:function(e){n(v,"flat",e)}}}),new l({A:{obj:d,name:"flat"},B:{action:function(e){v.applyClass(o.getClasses.call(d,e,"flat"),0)}}}),new l({A:{obj:d,name:"type"},B:{action:function(e){v.applyClass(o.getClasses.call(d,e,"type"),0)}}}),new l({A:{obj:d,name:"pressed"},B:{action:function(e){v.applyClass(o.getClasses.call(d,e,"pressed"),0)}}}),new l({A:{obj:d,name:"inverted"},B:{action:function(e){n(v,"inverted",e)}}}),new l({A:{obj:d,name:"visible"},B:{action:function(e){s(v,"hide",e)}}}),new l({A:{obj:d,name:"wide"},B:{action:function(e){n(v,"wide",e)}}}),new l({A:{obj:d,name:"responsive"},B:{action:function(e){n(v,"responsive",e)}}}),new l({A:{obj:d,name:"small"},B:{action:function(e){n(v,"small",e)}}}),new l({A:{obj:d,name:"enabled"},B:{action:function(e){a(v,"disabled",e)}}}),new l({A:{obj:d,name:"icon"},B:{obj:y,name:"content"}}),new l({A:{obj:d,name:"content"},B:{action:function(e){n(C,"hide",e)},converter:b}}),u.on("small",function(e){try{o.onSmallChanged.call(d,e)}catch(e){console.error('Exception in function behind "onSmallChanged" of module "mod/tfw.view.button.js" for attribute "small"! '),console.error(e)}}),u.on("width",function(e){v.$.style.width=e}),u.on("content",function(e){i.clear(C,e)}),v.class="tfw-view-button",g.class="icon",C.class="text",this.tag=t(e,"tag","ACTION"),this.icon=t(e,"icon",""),this.content=t(e,"content","Click me!"),this.pressed=t(e,"pressed",!1),this.flat=t(e,"flat",!1),this.type=t(e,"type","primary"),this.enabled=t(e,"enabled",!0),this.inverted=t(e,"inverted",!1),this.visible=t(e,"visible",!0),this.width=t(e,"width","auto"),this.wide=t(e,"wide",!1),this.responsive=t(e,"responsive",!1),this.small=t(e,"small",!1),i.addClass(this,"view","custom")}catch(e){throw console.error("mod/tfw.view.button.js",e),Error('Instantiation error in XJS of "mod/tfw.view.button.js":\n'+e)}}}()}catch(e){throw Error('Definition error in XJS of "mod/tfw.view.button.js"\n'+e)}t.exports._=i}); //# sourceMappingURL=tfw.view.button.js.map