@grasco/profile-picture 0.1.0 → 0.1.2
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/angular.cjs +49 -31
- package/dist/angular.cjs.map +1 -1
- package/dist/angular.d.cts +34 -1
- package/dist/angular.d.ts +34 -1
- package/dist/angular.js +49 -31
- package/dist/angular.js.map +1 -1
- package/dist/index.cjs +112 -93
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +59 -4
- package/dist/index.d.ts +59 -4
- package/dist/index.js +112 -93
- package/dist/index.js.map +1 -1
- package/dist/standalone.d.ts +37 -3
- package/dist/standalone.standalone.js +81 -62
- package/dist/standalone.standalone.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/svelte.cjs +49 -31
- package/dist/svelte.cjs.map +1 -1
- package/dist/svelte.d.cts +34 -1
- package/dist/svelte.d.ts +34 -1
- package/dist/svelte.js +49 -31
- package/dist/svelte.js.map +1 -1
- package/dist/vue.cjs +49 -31
- package/dist/vue.cjs.map +1 -1
- package/dist/vue.d.cts +34 -1
- package/dist/vue.d.ts +34 -1
- package/dist/vue.js +49 -31
- package/dist/vue.js.map +1 -1
- package/package.json +1 -1
package/dist/vue.d.ts
CHANGED
|
@@ -46,6 +46,8 @@ interface BadgeConfig {
|
|
|
46
46
|
glow?: boolean;
|
|
47
47
|
/** Max value to display (shows 99+ if exceeded) */
|
|
48
48
|
max?: number;
|
|
49
|
+
/** Icon to display before content (emoji, Unicode symbol, or text) */
|
|
50
|
+
icon?: string;
|
|
49
51
|
}
|
|
50
52
|
interface GlowConfig {
|
|
51
53
|
/** Glow color (defaults to border or bg color) */
|
|
@@ -68,6 +70,10 @@ interface RingConfig {
|
|
|
68
70
|
gap?: number;
|
|
69
71
|
/** Animate (rotate for gradient) */
|
|
70
72
|
animate?: boolean;
|
|
73
|
+
/** Progress percentage (0-100) for partial fill ring */
|
|
74
|
+
progress?: number;
|
|
75
|
+
/** Color for unfilled portion when progress is set (defaults to gray) */
|
|
76
|
+
emptyColor?: string;
|
|
71
77
|
}
|
|
72
78
|
interface InteractionConfig {
|
|
73
79
|
/** Enable hover effects */
|
|
@@ -83,16 +89,29 @@ type ShadowPreset = "none" | "sm" | "md" | "lg" | "glow";
|
|
|
83
89
|
|
|
84
90
|
declare class ProfilePicture extends LitElement {
|
|
85
91
|
private static stylesInjected;
|
|
92
|
+
private static cdnBaseUrl;
|
|
93
|
+
private static instances;
|
|
94
|
+
/**
|
|
95
|
+
* Set global CDN base URL for all ProfilePicture instances
|
|
96
|
+
* @example ProfilePicture.setCdnBaseUrl('https://api.example.com')
|
|
97
|
+
*/
|
|
98
|
+
static setCdnBaseUrl(url: string): void;
|
|
99
|
+
/**
|
|
100
|
+
* Get current CDN base URL
|
|
101
|
+
*/
|
|
102
|
+
static getCdnBaseUrl(): string;
|
|
86
103
|
protected createRenderRoot(): this;
|
|
87
104
|
private static injectStylesOnce;
|
|
88
105
|
src: string;
|
|
89
106
|
alt: string;
|
|
107
|
+
extCustomerId?: string;
|
|
90
108
|
size: Size | string;
|
|
91
109
|
variant: Variant;
|
|
92
110
|
shadow: ShadowPreset;
|
|
93
111
|
border: boolean;
|
|
94
|
-
borderWidth: 1 | 2 | 3 | 4;
|
|
112
|
+
borderWidth: 1 | 2 | 3 | 4 | 5 | 6 | 8;
|
|
95
113
|
borderColor: string;
|
|
114
|
+
rotation: number;
|
|
96
115
|
bgColor?: string;
|
|
97
116
|
bgGradient?: string;
|
|
98
117
|
ring?: RingConfig;
|
|
@@ -107,11 +126,25 @@ declare class ProfilePicture extends LitElement {
|
|
|
107
126
|
interactive?: InteractionConfig;
|
|
108
127
|
private isLoaded;
|
|
109
128
|
private hasError;
|
|
129
|
+
private cdnImageUrl?;
|
|
130
|
+
private cdnLoadFailed;
|
|
110
131
|
private previousSrc;
|
|
132
|
+
private previousExtCustomerId?;
|
|
133
|
+
private retryTimeoutId?;
|
|
134
|
+
private readonly RETRY_DELAY_MS;
|
|
111
135
|
private get pixelSize();
|
|
136
|
+
connectedCallback(): void;
|
|
137
|
+
disconnectedCallback(): void;
|
|
138
|
+
protected firstUpdated(): void;
|
|
139
|
+
protected updated(changedProperties: Map<string, unknown>): void;
|
|
112
140
|
protected willUpdate(changedProperties: Map<string, unknown>): void;
|
|
113
141
|
private handleLoad;
|
|
114
142
|
private handleError;
|
|
143
|
+
/**
|
|
144
|
+
* Construct CDN URL for profile picture using ext-customer-id
|
|
145
|
+
* Uses direct image src binding - browser handles redirects automatically
|
|
146
|
+
*/
|
|
147
|
+
private loadCdnImage;
|
|
115
148
|
private getContainerStyles;
|
|
116
149
|
private renderPlaceholder;
|
|
117
150
|
private renderFallback;
|
package/dist/vue.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {LitElement,nothing,html}from'lit';import {property,state,customElement}from'lit/decorators.js';import {styleMap}from'lit/directives/style-map.js';var
|
|
1
|
+
import {LitElement,nothing,html}from'lit';import {property,state,customElement}from'lit/decorators.js';import {styleMap}from'lit/directives/style-map.js';var Q=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var s=(t,r,e,n)=>{for(var i=n>1?void 0:n?_(r,e):r,a=t.length-1,d;a>=0;a--)(d=t[a])&&(i=(n?d(r,e,i):d(i))||i);return n&&i&&Q(r,e,i),i};var I="grasco-profile-picture-styles",w=false;function $(){if(w||typeof document>"u")return;if(document.getElementById(I)){w=true;return}if(document.querySelector('link[href*="profile-picture"][href$="styles.css"]')){w=true;return}let r=P();if(!r)return;let e=document.createElement("link");e.id=I,e.rel="stylesheet",e.href=r,document.head.appendChild(e),w=true;}function P(){if(typeof window<"u"&&window.__GRASCO_PROFILE_PICTURE_CSS__)return window.__GRASCO_PROFILE_PICTURE_CSS__;try{let r=import.meta.url;if(r)return `${r.substring(0,r.lastIndexOf("/")+1)}dist/styles.css`}catch{}let t=document.currentScript;if(t?.src){let r=new URL(t.src);return `${r.href.substring(0,r.href.lastIndexOf("/")+1)}dist/styles.css`}return null}var v={"2xs":20,xs:24,sm:32,md:40,lg:48,xl:64,"2xl":80,"3xl":120},R={online:"#30D158",away:"#FFD60A",busy:"#FF453A",offline:"#8E8E93",dnd:"#FF453A"},z={none:"none",sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)",glow:"0 0 20px 0 rgba(99, 102, 241, 0.3)"},u={size:"md",variant:"circle",loading:"lazy",placeholder:"shimmer",borderWidth:2,borderColor:"#ffffff",placeholderColor:"#f3f4f6",shadow:"sm"};var x={circle:"9999px",rounded:"12px",squircle:"30%",square:"0px"};function b(...t){return t.filter(Boolean).join(" ")}function y(t){return /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/.test(t)}function E(t){return {"top-left":"np:top-0 np:left-0","top-right":"np:top-0 np:right-0","bottom-left":"np:bottom-0 np:left-0","bottom-right":"np:bottom-0 np:right-0"}[t]}function A(t){return {"top-left":"np:-rotate-45 np:-translate-x-1/4 np:-translate-y-1/2","top-right":"np:rotate-45 np:translate-x-1/4 np:-translate-y-1/2","bottom-left":"np:rotate-45 np:-translate-x-1/4 np:translate-y-1/2","bottom-right":"np:-rotate-45 np:translate-x-1/4 np:translate-y-1/2"}[t]}function T(t){let e=t.trim().replace(/[^\w\s]/g,"").split(/\s+/).filter(Boolean);return e.length===0?"?":e.length===1?e[0].slice(0,1).toUpperCase():(e[0][0]+e[e.length-1][0]).toUpperCase()}function S(t){return Math.round(t*.38)}function L(t,r){let n=Math.max(r?18:10,Math.round(t*(r?.32:.22))),i=Math.round(n*.6);return {size:n,fontSize:i}}function B(t,r){return Math.max(8,Math.round(t*.25))+(r-1)*2}function U(t,r){return typeof t=="string"?t:r&&t>r?`${r}+`:t.toString()}function F(t){return t.length===0?"transparent":t.length===1?t[0]:`conic-gradient(${t.map((e,n)=>{let i=n/t.length*360,a=(n+1)/t.length*360;return `${e} ${i}deg ${a}deg`}).join(", ")})`}function ee(t){let r=0;for(let e=0;e<t.length;e++){let n=t.charCodeAt(e);r=(r<<5)-r+n,r&=r;}return Math.abs(r)}function M(t,r,e){let i=Math.max(0,Math.min(100,t))/100*360;return `conic-gradient(from 270deg, ${r} 0deg ${i}deg, ${e} ${i}deg 360deg)`}function D(t){let r=["linear-gradient(135deg, #667eea 0%, #764ba2 100%)","linear-gradient(135deg, #f093fb 0%, #f5576c 100%)","linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)","linear-gradient(135deg, #43e97b 0%, #38f9d7 100%)","linear-gradient(135deg, #fa709a 0%, #fee140 100%)","linear-gradient(135deg, #a8edea 0%, #fed6e3 100%)","linear-gradient(135deg, #d299c2 0%, #fef9d7 100%)","linear-gradient(135deg, #89f7fe 0%, #66a6ff 100%)","linear-gradient(135deg, #cd9cf2 0%, #f6f3ff 100%)","linear-gradient(135deg, #fddb92 0%, #d1fdff 100%)"],e=ee(t)%r.length;return r[e]}function N(t){return t<=80?"80":t<=120?"120":t<=240?"240":t<=480?"480":"960"}function O(t){if(!(t&&y(t)))return "light";let r=t.replace("#","");r.length===3&&(r=r.split("").map(d=>d+d).join(""));let e=Number.parseInt(r.slice(0,2),16),n=Number.parseInt(r.slice(2,4),16),i=Number.parseInt(r.slice(4,6),16);return (.299*e+.587*n+.114*i)/255>.5?"light":"dark"}function G(t,r,e,n,i){let a=t.endsWith("/")?t.slice(0,-1):t,d=`${r}_${e}_${n}.webp`;return `${a}/api/profile-picture/cdn/${d}?hostname=${i}`}function j(t){return {circle:"np:rounded-full",rounded:"np:rounded-xl",squircle:"np:rounded-[30%]",square:"np:rounded-none"}[t]}function V(t,r){return {className:{1:"np:border",2:"np:border-2",3:"np:border-[3px]",4:"np:border-4",5:"np:border-[5px]",6:"np:border-[6px]",8:"np:border-8"}[t],style:{borderColor:r,borderStyle:"solid"}}}function Y(t,r){return r?{className:"",style:{background:r}}:t?t.includes("gradient")?{className:"",style:{background:t}}:{className:"",style:{backgroundColor:t}}:{className:"",style:{backgroundColor:"#e7e7e7"}}}function H(t){return {boxShadow:z[t]}}var te={shimmer:`
|
|
2
2
|
@keyframes pp-shimmer {
|
|
3
3
|
0% { transform: translateX(-100%); }
|
|
4
4
|
100% { transform: translateX(100%); }
|
|
@@ -36,8 +36,8 @@ import {LitElement,nothing,html}from'lit';import {property,state,customElement}f
|
|
|
36
36
|
0% { transform: scale(0.8); opacity: 0; }
|
|
37
37
|
50% { transform: scale(1.05); }
|
|
38
38
|
100% { transform: scale(1); opacity: 1; }
|
|
39
|
-
}`},
|
|
40
|
-
`),
|
|
39
|
+
}`},ne=Object.values(te).join(`
|
|
40
|
+
`),re=`
|
|
41
41
|
/* Profile Picture Component Styles */
|
|
42
42
|
.pp-container {
|
|
43
43
|
--pp-transition-duration: 200ms;
|
|
@@ -160,7 +160,18 @@ import {LitElement,nothing,html}from'lit';import {property,state,customElement}f
|
|
|
160
160
|
line-height: 1;
|
|
161
161
|
animation: pp-badge-bounce 0.4s var(--pp-spring-timing);
|
|
162
162
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
|
|
163
|
-
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.pp-badge-with-icon {
|
|
166
|
+
gap: 4px;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.pp-badge-icon {
|
|
170
|
+
display: inline-flex;
|
|
171
|
+
align-items: center;
|
|
172
|
+
justify-content: center;
|
|
173
|
+
line-height: 1;
|
|
174
|
+
flex-shrink: 0;
|
|
164
175
|
}
|
|
165
176
|
|
|
166
177
|
.pp-badge-pulse {
|
|
@@ -201,12 +212,18 @@ import {LitElement,nothing,html}from'lit';import {property,state,customElement}f
|
|
|
201
212
|
mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
|
|
202
213
|
-webkit-mask-composite: xor;
|
|
203
214
|
mask-composite: exclude;
|
|
215
|
+
transition: background 0.3s ease;
|
|
204
216
|
}
|
|
205
217
|
|
|
206
218
|
.pp-ring-animated {
|
|
207
219
|
animation: pp-ring-rotate 3s linear infinite;
|
|
208
220
|
}
|
|
209
221
|
|
|
222
|
+
.pp-ring-progress {
|
|
223
|
+
/* Progress rings should not animate rotation */
|
|
224
|
+
animation: none;
|
|
225
|
+
}
|
|
226
|
+
|
|
210
227
|
/* Presence indicator */
|
|
211
228
|
.pp-presence {
|
|
212
229
|
position: absolute;
|
|
@@ -242,8 +259,8 @@ import {LitElement,nothing,html}from'lit';import {property,state,customElement}f
|
|
|
242
259
|
transition: none !important;
|
|
243
260
|
}
|
|
244
261
|
}
|
|
245
|
-
`,
|
|
246
|
-
${
|
|
262
|
+
`,W=`${ne}
|
|
263
|
+
${re}`,J=`
|
|
247
264
|
@keyframes np-shimmer {
|
|
248
265
|
0% { background-position: -200% 0; }
|
|
249
266
|
100% { background-position: 200% 0; }
|
|
@@ -253,10 +270,10 @@ ${K}`,j=`
|
|
|
253
270
|
background-size: 200% 100%;
|
|
254
271
|
animation: np-shimmer 1.5s infinite;
|
|
255
272
|
}
|
|
256
|
-
`;function
|
|
257
|
-
${this.placeholder==="shimmer"?html`<style>${
|
|
273
|
+
`;function q(t,r=.3){if(y(t)){let e=Number.parseInt(t.slice(1,3),16),n=Number.parseInt(t.slice(3,5),16),i=Number.parseInt(t.slice(5,7),16);return `0 0 20px 0 rgba(${e}, ${n}, ${i}, ${r})`}return `0 0 20px 0 ${t}`}var o=class extends LitElement{constructor(){super(...arguments);this.src="";this.alt="";this.size=u.size;this.variant=u.variant;this.shadow=u.shadow;this.border=false;this.borderWidth=u.borderWidth;this.borderColor=u.borderColor;this.rotation=0;this.loading=u.loading;this.placeholder=u.placeholder;this.placeholderColor=u.placeholderColor;this.isLoaded=false;this.hasError=false;this.cdnLoadFailed=false;this.previousSrc="";this.RETRY_DELAY_MS=3e4;}static setCdnBaseUrl(e){o.cdnBaseUrl=e,o.instances.forEach(n=>{n.extCustomerId&&!n.cdnImageUrl&&(n.cdnLoadFailed=false,n.retryTimeoutId&&(clearTimeout(n.retryTimeoutId),n.retryTimeoutId=void 0),n.previousExtCustomerId||(n.previousExtCustomerId=n.extCustomerId),n.loadCdnImage());});}static getCdnBaseUrl(){return o.cdnBaseUrl}createRenderRoot(){return o.injectStylesOnce(),this}static injectStylesOnce(){if(o.stylesInjected||typeof document>"u")return;let e=document.createElement("style");e.textContent=W,document.head.appendChild(e),o.stylesInjected=true;}get pixelSize(){let e=this.size;return typeof e=="number"?e:v[e]??v[u.size]}connectedCallback(){super.connectedCallback(),o.instances.add(this);}disconnectedCallback(){super.disconnectedCallback(),o.instances.delete(this),this.retryTimeoutId&&(clearTimeout(this.retryTimeoutId),this.retryTimeoutId=void 0);}firstUpdated(){this.extCustomerId&&o.cdnBaseUrl&&(this.previousExtCustomerId=this.extCustomerId,this.loadCdnImage());}updated(e){super.updated(e),this.extCustomerId&&o.cdnBaseUrl&&!this.cdnImageUrl&&(this.cdnLoadFailed||!this.previousExtCustomerId)&&(this.previousExtCustomerId||(this.previousExtCustomerId=this.extCustomerId),this.cdnLoadFailed=false,this.loadCdnImage());}willUpdate(e){e.has("src")&&this.src!==this.previousSrc&&(this.isLoaded=false,this.hasError=false,this.previousSrc=this.src),(e.has("extCustomerId")||e.has("size")||e.has("bgColor"))&&this.extCustomerId!==this.previousExtCustomerId&&(this.previousExtCustomerId=this.extCustomerId,this.cdnImageUrl=void 0,this.cdnLoadFailed=false,this.isLoaded=false,this.hasError=false,this.retryTimeoutId&&(clearTimeout(this.retryTimeoutId),this.retryTimeoutId=void 0),this.loadCdnImage());}handleLoad(){this.isLoaded=true,this.dispatchEvent(new CustomEvent("load",{bubbles:true,composed:true}));}handleError(){if(this.cdnImageUrl&&!this.cdnLoadFailed){this.cdnLoadFailed=true,this.cdnImageUrl=void 0,this.dispatchEvent(new CustomEvent("cdn-error",{bubbles:true,composed:true,detail:{error:"Image load failed"}})),this.retryTimeoutId&&clearTimeout(this.retryTimeoutId),this.retryTimeoutId=setTimeout(()=>{this.retryTimeoutId=void 0,this.extCustomerId&&o.cdnBaseUrl&&(this.cdnLoadFailed=false,this.hasError=false,this.isLoaded=false,this.loadCdnImage());},this.RETRY_DELAY_MS);return}this.hasError=true,this.isLoaded=true,this.dispatchEvent(new CustomEvent("error",{bubbles:true,composed:true}));}loadCdnImage(){if(!(this.extCustomerId&&o.cdnBaseUrl)){this.cdnLoadFailed=true;return}let e=N(this.pixelSize),n=O(this.bgColor),i=typeof window<"u"?window.location.hostname:"localhost";this.cdnImageUrl=G(o.cdnBaseUrl,this.extCustomerId,e,n,i);}getContainerStyles(){let e=Y(this.bgColor,this.bgGradient),n=this.border?V(this.borderWidth,this.borderColor):null,i=H(this.shadow),a={};if(this.glow){let f=this.glow.color??this.borderColor??"#6366f1";a={"--pp-glow-color":f,boxShadow:q(f,this.glow.intensity??.3)};}let d=this.interactive?.hoverable||this.interactive?.pressable;return {classes:b("pp-container",j(this.variant),e.className,n?.className,d&&"pp-interactive",this.glow?.animate&&"pp-glow"),styles:{width:`${this.pixelSize}px`,height:`${this.pixelSize}px`,borderRadius:x[this.variant],...e.style,...n?.style,...i,...a,cursor:this.interactive?.cursor??(d?"pointer":"default"),transform:this.rotation?`rotate(${this.rotation}deg)`:void 0}}}renderPlaceholder(){if(this.isLoaded||this.placeholder==="none")return nothing;let e={shimmer:"pp-shimmer",pulse:"pp-pulse",skeleton:"pp-skeleton",blur:"",none:""}[this.placeholder];return html`
|
|
274
|
+
${this.placeholder==="shimmer"?html`<style>${J}</style>`:nothing}
|
|
258
275
|
<div
|
|
259
|
-
class=${
|
|
276
|
+
class=${b("np:absolute np:inset-0",e)}
|
|
260
277
|
style=${styleMap({backgroundColor:this.placeholderColor,borderRadius:"inherit"})}>
|
|
261
278
|
</div>
|
|
262
279
|
`}renderFallback(){if(this.fallback)return html`
|
|
@@ -265,11 +282,11 @@ ${K}`,j=`
|
|
|
265
282
|
style=${styleMap({fontSize:`${S(this.pixelSize)}px`})}>
|
|
266
283
|
${this.fallback}
|
|
267
284
|
</span>
|
|
268
|
-
`;if(this.alt){let n=
|
|
285
|
+
`;if(this.alt){let n=D(this.alt);return html`
|
|
269
286
|
<div
|
|
270
287
|
class="pp-fallback np:absolute np:inset-0"
|
|
271
288
|
style=${styleMap({background:this.bgColor??n,fontSize:`${S(this.pixelSize)}px`})}>
|
|
272
|
-
${
|
|
289
|
+
${T(this.alt)}
|
|
273
290
|
</div>
|
|
274
291
|
`}let e=this.pixelSize*.5;return html`
|
|
275
292
|
<svg
|
|
@@ -279,40 +296,41 @@ ${K}`,j=`
|
|
|
279
296
|
viewBox="0 0 24 24">
|
|
280
297
|
<path d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z" />
|
|
281
298
|
</svg>
|
|
282
|
-
`}renderImage(){return this.
|
|
299
|
+
`}renderImage(){let e=!!(this.extCustomerId&&o.cdnBaseUrl),n;return this.cdnImageUrl?n=this.cdnImageUrl:(!e||this.cdnLoadFailed)&&(n=this.src),this.hasError||!n?this.renderFallback():html`
|
|
283
300
|
<img
|
|
284
|
-
src=${
|
|
301
|
+
src=${n}
|
|
285
302
|
alt=${this.alt}
|
|
286
303
|
loading=${this.loading}
|
|
287
304
|
decoding="async"
|
|
288
305
|
@load=${this.handleLoad}
|
|
289
306
|
@error=${this.handleError}
|
|
290
|
-
class=${
|
|
307
|
+
class=${b("pp-image",this.isLoaded?"pp-image-loaded":"pp-image-loading")}
|
|
291
308
|
draggable="false" />
|
|
292
|
-
`}renderRing(){if(!this.ring?.show)return nothing;let e=this.ring.width??3,n=this.ring.gap??3,i=e+n,
|
|
309
|
+
`}renderRing(){if(!this.ring?.show)return nothing;let e=this.ring.width??3,n=this.ring.gap??3,i=e+n,a,d=this.ring.progress!==void 0;if(d){let f=this.ring.progress??0,m=this.ring.color??"#30D158",h=this.ring.emptyColor??"#8E8E93";a=M(f,m,h);}else this.ring.gradient&&this.ring.gradient.length>0?a=F(this.ring.gradient):a=this.ring.color??"linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888)";return html`
|
|
293
310
|
<div
|
|
294
|
-
class=${
|
|
295
|
-
style=${styleMap({inset:`-${i}px`,padding:`${e}px`,background:
|
|
311
|
+
class=${b("pp-ring",this.ring.animate&&!d&&"pp-ring-animated",d&&"pp-ring-progress")}
|
|
312
|
+
style=${styleMap({inset:`-${i}px`,padding:`${e}px`,background:a,borderRadius:x[this.variant]})}>
|
|
296
313
|
</div>
|
|
297
|
-
`}renderPresence(){if(!this.presence)return nothing;let e=this.presence.thickness??2,n=
|
|
314
|
+
`}renderPresence(){if(!this.presence)return nothing;let e=this.presence.thickness??2,n=B(this.pixelSize,e),i=R[this.presence.status],a=Math.max(0,this.pixelSize*.02);return html`
|
|
298
315
|
<div
|
|
299
|
-
class=${
|
|
300
|
-
style=${styleMap({width:`${n}px`,height:`${n}px`,backgroundColor:i,bottom:`${
|
|
316
|
+
class=${b("pp-presence",this.presence.animate&&"pp-presence-animated")}
|
|
317
|
+
style=${styleMap({width:`${n}px`,height:`${n}px`,backgroundColor:i,bottom:`${a}px`,right:`${a}px`,color:i})}
|
|
301
318
|
title=${this.presence.status}>
|
|
302
319
|
</div>
|
|
303
|
-
`}renderBadge(){if(!this.badge)return nothing;let e=this.badge.position??"bottom-right",n=this.badge.content!==void 0,{size:
|
|
320
|
+
`}renderBadge(){if(!this.badge)return nothing;let e=this.badge.position??"bottom-right",n=this.badge.content!==void 0,i=this.badge.icon!==void 0,a=n||i,{size:d,fontSize:f}=L(this.pixelSize,a),m=this.badge.bgColor??"#22c55e",h=this.badge.color??"#ffffff",Z=n&&this.badge.content!==void 0?U(this.badge.content,this.badge.max):null,k=i?this.badge.icon:null,K=f*.9,X={"top-left":{top:"-4px",left:"-4px"},"top-right":{top:"-4px",right:"-4px"},"bottom-left":{bottom:"-4px",left:"-4px"},"bottom-right":{bottom:"-4px",right:"-4px"}};return html`
|
|
304
321
|
<div
|
|
305
|
-
class=${
|
|
306
|
-
style=${styleMap({width:
|
|
307
|
-
${
|
|
322
|
+
class=${b("pp-badge",this.badge.pulse&&"pp-badge-pulse",this.badge.glow&&"pp-badge-glow",i&&"pp-badge-with-icon")}
|
|
323
|
+
style=${styleMap({width:a?"auto":`${d}px`,minWidth:`${d}px`,height:`${d}px`,padding:a?"0 6px":"0",fontSize:`${f}px`,backgroundColor:m,color:h,"--pp-badge-glow-color":m,gap:i&&n?"4px":"0",...X[e]})}>
|
|
324
|
+
${k?html`<span class="pp-badge-icon" style=${styleMap({fontSize:`${K}px`})}>${k}</span>`:nothing}
|
|
325
|
+
${Z??nothing}
|
|
308
326
|
</div>
|
|
309
|
-
`}renderRibbon(){if(!this.ribbon)return nothing;let e=this.ribbon.position??"top-right",n=this.ribbon.bgColor??"#ef4444",i=this.ribbon.color??"#ffffff",
|
|
327
|
+
`}renderRibbon(){if(!this.ribbon)return nothing;let e=this.ribbon.position??"top-right",n=this.ribbon.bgColor??"#ef4444",i=this.ribbon.color??"#ffffff",a=y(n)?{backgroundColor:n}:{background:n},d={color:i},f=this.pixelSize*.9,m=this.pixelSize*.4,h=Math.max(8,this.pixelSize*.11);return html`
|
|
310
328
|
<div
|
|
311
|
-
class=${
|
|
312
|
-
style=${styleMap({width:`${
|
|
329
|
+
class=${b("pp-ribbon-container",E(e))}
|
|
330
|
+
style=${styleMap({width:`${f}px`,height:`${m}px`})}>
|
|
313
331
|
<div
|
|
314
|
-
class=${
|
|
315
|
-
style=${styleMap({fontSize:`${h}px`,padding:`${h*.3}px 0`,...
|
|
332
|
+
class=${b("pp-ribbon np:origin-center np:transform",A(e))}
|
|
333
|
+
style=${styleMap({fontSize:`${h}px`,padding:`${h*.3}px 0`,...a,...d})}>
|
|
316
334
|
${this.ribbon.icon?html`<span style="margin-right: 2px">${this.ribbon.icon}</span>`:nothing}
|
|
317
335
|
${this.ribbon.text}
|
|
318
336
|
</div>
|
|
@@ -332,7 +350,7 @@ ${K}`,j=`
|
|
|
332
350
|
<!-- Inner container for image clipping -->
|
|
333
351
|
<div
|
|
334
352
|
class="pp-inner"
|
|
335
|
-
style=${styleMap({borderRadius:
|
|
353
|
+
style=${styleMap({borderRadius:x[this.variant]})}>
|
|
336
354
|
<!-- Placeholder -->
|
|
337
355
|
${this.renderPlaceholder()}
|
|
338
356
|
|
|
@@ -349,5 +367,5 @@ ${K}`,j=`
|
|
|
349
367
|
<!-- Presence Indicator -->
|
|
350
368
|
${this.renderPresence()}
|
|
351
369
|
</div>
|
|
352
|
-
`}};o.stylesInjected=false,
|
|
370
|
+
`}};o.stylesInjected=false,o.cdnBaseUrl="",o.instances=new Set,s([property({type:String})],o.prototype,"src",2),s([property({type:String})],o.prototype,"alt",2),s([property({type:String,attribute:"ext-customer-id"})],o.prototype,"extCustomerId",2),s([property({type:String})],o.prototype,"size",2),s([property({type:String})],o.prototype,"variant",2),s([property({type:String})],o.prototype,"shadow",2),s([property({type:Boolean})],o.prototype,"border",2),s([property({type:Number,attribute:"border-width"})],o.prototype,"borderWidth",2),s([property({type:String,attribute:"border-color"})],o.prototype,"borderColor",2),s([property({type:Number})],o.prototype,"rotation",2),s([property({type:String,attribute:"bg-color"})],o.prototype,"bgColor",2),s([property({type:String,attribute:"bg-gradient"})],o.prototype,"bgGradient",2),s([property({type:Object,attribute:"ring",converter:{fromAttribute:e=>{if(e)try{return JSON.parse(e)}catch{return}},toAttribute:e=>e?JSON.stringify(e):null}})],o.prototype,"ring",2),s([property({type:Object,attribute:"presence",converter:{fromAttribute:e=>{if(e)try{return JSON.parse(e)}catch{return}},toAttribute:e=>e?JSON.stringify(e):null}})],o.prototype,"presence",2),s([property({type:Object,attribute:"glow",converter:{fromAttribute:e=>{if(e)try{return JSON.parse(e)}catch{return}},toAttribute:e=>e?JSON.stringify(e):null}})],o.prototype,"glow",2),s([property({type:Object,attribute:"ribbon",converter:{fromAttribute:e=>{if(e)try{return JSON.parse(e)}catch{return}},toAttribute:e=>e?JSON.stringify(e):null}})],o.prototype,"ribbon",2),s([property({type:Object,attribute:"badge",converter:{fromAttribute:e=>{if(e)try{return JSON.parse(e)}catch{return}},toAttribute:e=>e?JSON.stringify(e):null}})],o.prototype,"badge",2),s([property({type:String})],o.prototype,"loading",2),s([property({type:String})],o.prototype,"placeholder",2),s([property({type:String,attribute:"placeholder-color"})],o.prototype,"placeholderColor",2),s([property({type:String})],o.prototype,"fallback",2),s([property({type:Object,attribute:"interactive",converter:{fromAttribute:e=>{if(e)try{return JSON.parse(e)}catch{return}},toAttribute:e=>e?JSON.stringify(e):null}})],o.prototype,"interactive",2),s([state()],o.prototype,"isLoaded",2),s([state()],o.prototype,"hasError",2),s([state()],o.prototype,"cdnImageUrl",2),s([state()],o.prototype,"cdnLoadFailed",2),o=s([customElement("profile-picture")],o);$();//# sourceMappingURL=vue.js.map
|
|
353
371
|
//# sourceMappingURL=vue.js.map
|