server/dist/theming-personal-theming.js

3 lines
30 KiB
JavaScript
Raw Normal View History

/*! For license information please see theming-personal-theming.js.LICENSE.txt */
!function(){"use strict";var n,e={10106:function(n,e,r){var a=r(20144),o=r(79753),i=r(16453),c=r(4820),s=r(20571),l=r.n(s),u=r(13299),d=r.n(u),g=r(14625),m=r(31894),p=r(20296),h=r.n(p),f=r(69867),A=r.n(f),b=r(15168),v=r.n(b),k=r(1082),C=r.n(k),_=(r(97248),r(26932)),y=r(22200);function w(n,e,t,r,a,o,i){try{var c=n[o](i),s=c.value}catch(n){return void t(n)}c.done?e(s):Promise.resolve(s).then(r,a)}function x(n){return function(){var e=this,t=arguments;return new Promise((function(r,a){var o=n.apply(e,t);function i(n){w(o,r,a,i,c,"next",n)}function c(n){w(o,r,a,i,c,"throw",n)}i(void 0)}))}}function S(n,e){(null==e||e>n.length)&&(e=n.length);for(var t=0,r=new Array(e);t<e;t++)r[t]=n[t];return r}var T=(0,i.loadState)("theming","backgroundColor"),I=(0,i.loadState)("theming","backgroundImage"),B=(0,i.loadState)("theming","shippedBackgrounds"),D=(0,i.loadState)("theming","themingDefaultBackground"),E=(0,i.loadState)("theming","defaultShippedBackground"),P=function(n){return(0,o.generateFilePath)("theming","","img/background/")+n},R=(0,_.fn)(t("theming","Select a background from your files")).setMultiSelect(!1).setModal(!0).setType(1).setMimeTypeFilter(["image/png","image/gif","image/jpeg","image/svg+xml","image/svg"]).build(),U={name:"BackgroundSettings",directives:{Tooltip:v()},components:{Check:g.default,Close:m.default,NcColorPicker:A()},data:function(){return{loading:!1,Theming:(0,i.loadState)("theming","data",{}),backgroundImage:I,backgroundColor:T}},computed:{shippedBackgrounds:function(){var n=this;return Object.keys(B).map((function(n){return{name:n,url:P(n),preview:P("preview/"+n),details:B[n]}})).filter((function(e){return!(!n.isGlobalBackgroundDeleted&&!n.isGlobalBackgroundDefault)||e.name!==E}))},isGlobalBackgroundDefault:function(){return!!D},isGlobalBackgroundDeleted:function(){return"backgroundColor"===D}},methods:{invertTextColor:function(n){return this.calculateLuma(n)>.6},calculateLuma:function(n){var e,t,r=(e=this.hexToRGB(n),t=3,function(n){if(Array.isArray(n))return n}(e)||function(n,e){var t=null==n?null:"undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(null!=t){var r,a,o=[],i=!0,c=!1;try{for(t=t.call(n);!(i=(r=t.next()).done)&&(o.push(r.value),!e||o.length!==e);i=!0);}catch(n){c=!0,a=n}finally{try{i||null==t.return||t.return()}finally{if(c)throw a}}return o}}(e,t)||function(n,e){if(n){if("string"==typeof n)return S(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);return"Object"===t&&n.constructor&&(t=n.constructor.name),"Map"===t||"Set"===t?Array.from(n):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?S(n,e):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}());return(.2126*r[0]+.7152*r[1]+.0722*r[2])/255},hexToRGB:function(n){var e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(n);return e?[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]:null},update:function(n){var e=this;return x(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.backgroundImage=n.backgroundImage,e.backgroundColor=n.backgroundColor,e.Theming.color=n.backgroundColor,e.$emit("update:background"),e.loading=!1;case 5:case"end":return t.stop()}}),t)})))()},setDefault:function(){var n=this;return x(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.loading="default",e.next=3,c.default.post((0,o.generateUrl)("/apps/theming/background/default"));case 3:t=e.sent,n.update(t.data);case 5:case"end":return e.stop()}}),e)})))()},setShipped:function(n){var e=this;return x(regeneratorRuntime.mark((function t(){var r;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e.loading=n,t.next=3,c.default.post((0,o.generateUrl)("/apps/theming/background/shipped"),{value:n});case 3:r=t.sent,e.update(r.data);case 5:case"end":return t.stop()}}),t)})))()},setFile:function(n){var e=arguments,t=t
//# sourceMappingURL=theming-personal-theming.js.map?v=b24868c29b8f93386bf7