You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nextcloud/dist/theming-personal-theming.js

3 lines
125 KiB
JavaScript

/*! For license information please see theming-personal-theming.js.LICENSE.txt */
(()=>{var e,n,r,o={3220:(e,n,r)=>{"use strict";var o=r(92457),a=r(85471),i=r(63814),l=r(38613),s=r(26287),c=r(32073),u=r(88837),d=r(85168),p=(r(93525),r(17334)),h=r.n(p),f=r(23503),g=r(9518),m=r(64866),v=r.n(m),b=r(85338),y=r(24325);const A={name:"ImageEditIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}};var _=r(14486);const w=(0,_.A)(A,(function(){var t=this,e=t._self._c;return e("span",t._b({staticClass:"material-design-icon image-edit-icon",attrs:{"aria-hidden":!t.title||null,"aria-label":t.title,role:"img"},on:{click:function(e){return t.$emit("click",e)}}},"span",t.$attrs,!1),[e("svg",{staticClass:"material-design-icon__svg",attrs:{fill:t.fillColor,width:t.size,height:t.size,viewBox:"0 0 24 24"}},[e("path",{attrs:{d:"M22.7 14.3L21.7 15.3L19.7 13.3L20.7 12.3C20.8 12.2 20.9 12.1 21.1 12.1C21.2 12.1 21.4 12.2 21.5 12.3L22.8 13.6C22.9 13.8 22.9 14.1 22.7 14.3M13 19.9V22H15.1L21.2 15.9L19.2 13.9L13 19.9M21 5C21 3.9 20.1 3 19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H11V19.1L12.1 18H5L8.5 13.5L11 16.5L14.5 12L16.1 14.1L21 9.1V5Z"}},[t.title?e("title",[t._v(t._s(t.title))]):t._e()])])])}),[],!1,null,null,null).exports;var C=r(96763);const k=(0,l.C)("theming","backgroundImage"),x=(0,l.C)("theming","shippedBackgrounds"),S=(0,l.C)("theming","themingDefaultBackground"),D=(0,l.C)("theming","defaultShippedBackground"),T=t=>(0,i.fg)("theming","","img/background/")+t,O={name:"BackgroundSettings",components:{Check:b.A,Close:y.A,ImageEdit:w,NcButton:g.A,NcColorPicker:f.N},data:()=>({loading:!1,Theming:(0,l.C)("theming","data",{}),backgroundImage:k}),computed:{shippedBackgrounds(){return Object.keys(x).map((t=>({name:t,url:T(t),preview:T("preview/"+t),details:x[t]}))).filter((t=>!(!this.isGlobalBackgroundDeleted&&!this.isGlobalBackgroundDefault)||t.name!==D))},isGlobalBackgroundDefault:()=>!!S,isGlobalBackgroundDeleted:()=>"backgroundColor"===S,isBackgroundDisabled(){return"disabled"===this.backgroundImage||!this.backgroundImage}},methods:{invertTextColor(t){return this.calculateLuma(t)>.6},calculateLuma(t){const[e,n,r]=this.hexToRGB(t);return(.2126*e+.7152*n+.0722*r)/255},hexToRGB(t){const e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return e?[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]:null},async update(t){this.backgroundImage=t.backgroundImage,this.Theming.color=t.backgroundColor,this.$emit("update:background"),this.loading=!1},async setDefault(){this.loading="default";const t=await s.A.post((0,i.Jv)("/apps/theming/background/default"));this.update(t.data)},async setShipped(t){this.loading=t;const e=await s.A.post((0,i.Jv)("/apps/theming/background/shipped"),{value:t});this.update(e.data)},async setFile(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.loading="custom";const n=await s.A.post((0,i.Jv)("/apps/theming/background/custom"),{value:t,color:e});this.update(n.data)},async removeBackground(){this.loading="remove";const t=await s.A.delete((0,i.Jv)("/apps/theming/background/custom"));this.update(t.data)},async pickColor(t){var e,n;this.loading="color";const r=(null==t||null===(e=t.target)||void 0===e||null===(e=e.dataset)||void 0===e?void 0:e.color)||(null===(n=this.Theming)||void 0===n?void 0:n.color)||"#0082c9",o=await s.A.post((0,i.Jv)("/apps/theming/background/color"),{color:r});this.update(o.data)},debouncePickColor:h()((function(){this.pickColor(...arguments)}),200),pickFile(){(0,d.a1)(t("theming","Select a background from your files")).allowDirectories(!1).setMimeTypeFilter(["image/png","image/gif","image/jpeg","image/svg+xml","image/svg"]).setMultiSelect(!1).addButton({id:"select",label:t("theming","Select background"),callback:t=>{var e;this.applyFile(null===(e=t[0])||void 0===e?void 0:e.path)},type:"primary"}).build().pick()},async applyFile(e){if(!e||"string"!=typeof e||0===e.trim().length||"/"===e)return C.error("No valid background have been selected",{path:e}),void(0,d.Qg)(t("theming","No background has been selected"));this.loading="custom";let n=null,r=null;try{var a;const t=(0,i.dC)("da
//# sourceMappingURL=theming-personal-theming.js.map?v=9c0a96836a47be046730