@grasco/profile-picture 0.1.7 → 0.1.8

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.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import * as lit_html from 'lit-html';
1
+ import * as lit from 'lit';
2
2
  import { LitElement } from 'lit';
3
3
 
4
4
  /**
@@ -201,84 +201,6 @@ interface ProfilePictureGroupProps {
201
201
  animated?: boolean;
202
202
  }
203
203
 
204
- declare class ProfilePicture extends LitElement {
205
- private static stylesInjected;
206
- private static cdnBaseUrl;
207
- private static instances;
208
- /**
209
- * Set global CDN base URL for all ProfilePicture instances
210
- * @example ProfilePicture.setCdnBaseUrl('https://api.example.com')
211
- */
212
- static setCdnBaseUrl(url: string): void;
213
- /**
214
- * Get current CDN base URL
215
- */
216
- static getCdnBaseUrl(): string;
217
- protected createRenderRoot(): this;
218
- private static injectStylesOnce;
219
- src: string;
220
- alt: string;
221
- extCustomerId?: string;
222
- size: Size | string;
223
- variant: Variant;
224
- shadow: ShadowPreset;
225
- border: boolean;
226
- borderWidth: 1 | 2 | 3 | 4 | 5 | 6 | 8;
227
- borderColor: string;
228
- rotation: number;
229
- bgColor?: string;
230
- bgGradient?: string;
231
- ring?: RingConfig;
232
- presence?: PresenceConfig;
233
- glow?: GlowConfig;
234
- badge?: BadgeConfig;
235
- loading: LoadingStrategy;
236
- placeholder: PlaceholderType;
237
- placeholderColor: string;
238
- fallback?: string;
239
- interactive?: InteractionConfig;
240
- private isLoaded;
241
- private hasError;
242
- private cdnImageUrl?;
243
- private cdnLoadFailed;
244
- private previousSrc;
245
- private previousExtCustomerId?;
246
- private retryTimeoutId?;
247
- private readonly RETRY_DELAY_MS;
248
- private get pixelSize();
249
- connectedCallback(): void;
250
- disconnectedCallback(): void;
251
- protected firstUpdated(): void;
252
- protected updated(changedProperties: Map<string, unknown>): void;
253
- protected willUpdate(changedProperties: Map<string, unknown>): void;
254
- private handleLoad;
255
- private handleError;
256
- /**
257
- * Construct CDN URL for profile picture using ext-customer-id
258
- * Uses direct image src binding - browser handles redirects automatically
259
- */
260
- private loadCdnImage;
261
- private getContainerStyles;
262
- private renderPlaceholder;
263
- private renderFallback;
264
- private renderImage;
265
- private renderRing;
266
- /**
267
- * Calculate corner offset based on variant
268
- * Returns the inset from container edge where badges/presence should be positioned
269
- */
270
- private getCornerOffset;
271
- private renderPresence;
272
- private renderBadge;
273
- render(): lit_html.TemplateResult<1>;
274
- }
275
-
276
- declare global {
277
- interface HTMLElementTagNameMap {
278
- "profile-picture": ProfilePicture;
279
- }
280
- }
281
-
282
204
  declare class ProfilePictureGroup extends LitElement {
283
205
  protected createRenderRoot(): this;
284
206
  max: 4;
@@ -330,7 +252,7 @@ declare class ProfilePictureGroup extends LitElement {
330
252
  private renderDropdownItem;
331
253
  private formatStatus;
332
254
  protected updated(changedProperties: Map<PropertyKey, unknown>): void;
333
- render(): lit_html.TemplateResult<1>;
255
+ render(): lit.TemplateResult<1>;
334
256
  }
335
257
 
336
258
  declare global {
@@ -339,4 +261,72 @@ declare global {
339
261
  }
340
262
  }
341
263
 
342
- export type { BadgeConfig, DropdownConfig, GlowConfig, GroupUserData, InteractionConfig, LoadingStrategy, PlaceholderType, Position, PresenceConfig, PresenceStatus, ProfilePictureGroupProps, ProfilePictureProps, RingConfig, ShadowPreset, Size, StackDirection, TooltipConfig, TooltipPosition, Variant };
264
+ /**
265
+ * Angular wrapper for ProfilePicture Web Component
266
+ *
267
+ * The component is a standard Web Component and works natively with Angular.
268
+ * No wrapper needed - just import to register the custom element.
269
+ *
270
+ * @example
271
+ * ```typescript
272
+ * import '@grasco/profile-picture/angular';
273
+ * import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
274
+ * import type { RingConfig, BadgeConfig } from '@grasco/profile-picture/angular';
275
+ *
276
+ * @Component({
277
+ * selector: 'app-example',
278
+ * template: `
279
+ * <profile-picture
280
+ * [attr.src]="avatarUrl"
281
+ * size="lg"
282
+ * variant="circle"
283
+ * border
284
+ * border-color="white"
285
+ * bg-color="#f3f4f6"
286
+ * [attr.ring]="ringJson"
287
+ * [attr.badge]="badgeJson"
288
+ * (load)="onImageLoad()"
289
+ * (error)="onImageError()">
290
+ * </profile-picture>
291
+ * `,
292
+ * standalone: true,
293
+ * schemas: [CUSTOM_ELEMENTS_SCHEMA] // Required for custom elements
294
+ * })
295
+ * export class ExampleComponent {
296
+ * avatarUrl = 'https://example.com/avatar.png';
297
+ *
298
+ * ring: RingConfig = { show: true, color: '#ff5722' };
299
+ * badge: BadgeConfig = { content: 3, position: 'bottom-right', pulse: true };
300
+ *
301
+ * get ringJson() { return JSON.stringify(this.ring); }
302
+ * get badgeJson() { return JSON.stringify(this.badge); }
303
+ *
304
+ * onImageLoad() {
305
+ * console.log('Image loaded');
306
+ * }
307
+ *
308
+ * onImageError() {
309
+ * console.error('Image failed to load');
310
+ * }
311
+ * }
312
+ * ```
313
+ *
314
+ * Note: Add CUSTOM_ELEMENTS_SCHEMA to your component's schemas array.
315
+ *
316
+ * For property binding:
317
+ * - Use [attr.property]="value" for object/array properties (ring, badge, etc.)
318
+ * - Use property="value" for string/primitive properties
319
+ * - Use (event)="handler()" for events (load, error, cdn-error)
320
+ */
321
+
322
+ /**
323
+ * Set global CDN base URL for all ProfilePicture instances
324
+ * @example setCdnBaseUrl('https://api.example.com')
325
+ */
326
+ declare function setCdnBaseUrl(url: string): void;
327
+ /**
328
+ * Get current CDN base URL
329
+ */
330
+ declare function getCdnBaseUrl(): string;
331
+
332
+ export { type BadgeConfig, type DropdownConfig, type GlowConfig, type GroupUserData, type InteractionConfig, type LoadingStrategy, type PlaceholderType, type Position, type PresenceConfig, type PresenceStatus, type ProfilePictureGroupProps, type ProfilePictureProps, type RingConfig, type ShadowPreset, type Size, type StackDirection, type TooltipConfig, type TooltipPosition, type Variant, getCdnBaseUrl, setCdnBaseUrl };