@oneb/ui-vue 0.1.18 → 0.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/index.cjs +1 -1
- package/dist/common/index.js +7 -7
- package/package.json +1 -1
package/dist/common/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),p={size:{type:[String,Number],default:"50"},rounded:{type:Boolean,default:!1},text:{type:String,required:!1},src:{type:[String,null],required:!1}},m=["src"],y=e.defineComponent({__name:"OneAvatar",props:p,setup(s){const t=s,o=e.computed(()=>{if(t.text==null||t.text==="")return"";const r=t.text.trim().split(" ");return r.length<2?t.text.slice(0,2).toUpperCase():r.map(n=>n.slice(0,1)).slice(0,2).join("").toUpperCase()}),i=e.computed(()=>({fill:"rgba(255, 255, 255, .75)",fontSize:`${Number(t.size)*.4}px`})),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),p={size:{type:[String,Number],default:"50"},rounded:{type:Boolean,default:!1},text:{type:String,required:!1},src:{type:[String,null],required:!1}},m=["src"],y=e.defineComponent({__name:"OneAvatar",props:p,setup(s){const t=s,o=e.computed(()=>{if(t.text==null||t.text==="")return"";const r=t.text.trim().split(" ");return r.length<2?t.text.slice(0,2).toUpperCase():r.map(n=>n.slice(0,1)).slice(0,2).join("").toUpperCase()}),i=e.computed(()=>({fill:"rgba(255, 255, 255, .75)",fontSize:`${Number(t.size)*.4}px`})),c=e.computed(()=>{if(t.text==null)return{width:`${t.size}px`,height:`${t.size}px`,borderRadius:t.rounded?"100%":"9%"};const r=t.text.split("").map(l=>l.charCodeAt(0)).reduce((l,d)=>l+d,0),u=`hsl(${360/26*r}, 68%, 48%)`;return{width:`${t.size}px`,height:`${t.size}px`,borderRadius:t.rounded?"100%":"9%",background:u}}),a=e.computed(()=>({width:`${t.size}px`,height:`${t.size}px`,borderRadius:t.rounded?"100%":"9%"}));return(r,n)=>(e.openBlock(),e.createElementBlock("div",{style:e.normalizeStyle(a.value),class:"overflow-hidden items-center flex"},[r.src?(e.openBlock(),e.createElementBlock("img",{key:0,src:r.src,alt:"",class:"w-full"},null,8,m)):(e.openBlock(),e.createElementBlock("svg",{key:1,style:e.normalizeStyle(c.value),class:"block"},[o.value?(e.openBlock(),e.createElementBlock("text",{key:0,x:"50%",y:"50%","text-anchor":"middle","dominant-baseline":"central",class:"font-light",style:e.normalizeStyle(i.value)},e.toDisplayString(o.value),5)):e.createCommentVNode("",!0)],4))],4))}});exports.OneAvatar=y;
|
package/dist/common/index.js
CHANGED
|
@@ -19,13 +19,13 @@ const y = {
|
|
|
19
19
|
}, v = ["src"], z = /* @__PURE__ */ m({
|
|
20
20
|
__name: "OneAvatar",
|
|
21
21
|
props: y,
|
|
22
|
-
setup(
|
|
23
|
-
const e =
|
|
22
|
+
setup(c) {
|
|
23
|
+
const e = c, a = r(() => {
|
|
24
24
|
if (e.text == null || e.text === "")
|
|
25
25
|
return "";
|
|
26
26
|
const t = e.text.trim().split(" ");
|
|
27
27
|
return t.length < 2 ? e.text.slice(0, 2).toUpperCase() : t.map((l) => l.slice(0, 1)).slice(0, 2).join("").toUpperCase();
|
|
28
|
-
}),
|
|
28
|
+
}), u = r(() => ({
|
|
29
29
|
fill: "rgba(255, 255, 255, .75)",
|
|
30
30
|
fontSize: `${Number(e.size) * 0.4}px`
|
|
31
31
|
})), d = r(() => {
|
|
@@ -35,12 +35,12 @@ const y = {
|
|
|
35
35
|
height: `${e.size}px`,
|
|
36
36
|
borderRadius: e.rounded ? "100%" : "9%"
|
|
37
37
|
};
|
|
38
|
-
const t = e.text.split("").map((o) => o.charCodeAt(0)).reduce((o,
|
|
38
|
+
const t = e.text.split("").map((o) => o.charCodeAt(0)).reduce((o, h) => o + h, 0), x = `hsl(${360 / 26 * t}, 68%, 48%)`;
|
|
39
39
|
return {
|
|
40
40
|
width: `${e.size}px`,
|
|
41
41
|
height: `${e.size}px`,
|
|
42
42
|
borderRadius: e.rounded ? "100%" : "9%",
|
|
43
|
-
background:
|
|
43
|
+
background: x
|
|
44
44
|
};
|
|
45
45
|
}), p = r(() => ({
|
|
46
46
|
width: `${e.size}px`,
|
|
@@ -49,7 +49,7 @@ const y = {
|
|
|
49
49
|
}));
|
|
50
50
|
return (t, l) => (s(), n("div", {
|
|
51
51
|
style: i(p.value),
|
|
52
|
-
class: "overflow-hidden"
|
|
52
|
+
class: "overflow-hidden items-center flex"
|
|
53
53
|
}, [
|
|
54
54
|
t.src ? (s(), n("img", {
|
|
55
55
|
key: 0,
|
|
@@ -68,7 +68,7 @@ const y = {
|
|
|
68
68
|
"text-anchor": "middle",
|
|
69
69
|
"dominant-baseline": "central",
|
|
70
70
|
class: "font-light",
|
|
71
|
-
style: i(
|
|
71
|
+
style: i(u.value)
|
|
72
72
|
}, f(a.value), 5)) : g("", !0)
|
|
73
73
|
], 4))
|
|
74
74
|
], 4));
|