@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/vue.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,84 @@ 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
+ * Vue wrapper for ProfilePicture Web Component
266
+ *
267
+ * The component is a standard Web Component and works natively with Vue 3.
268
+ * Just import to register, then use in templates.
269
+ *
270
+ * @example
271
+ * ```vue
272
+ * <script setup lang="ts">
273
+ * import '@grasco/profile-picture/vue';
274
+ * import type { ProfilePictureProps, RingConfig, BadgeConfig } from '@grasco/profile-picture/vue';
275
+ *
276
+ * const avatarUrl = 'https://example.com/avatar.png';
277
+ *
278
+ * const ring: RingConfig = { show: true, color: '#ff5722' };
279
+ * const badge: BadgeConfig = { content: 3, position: 'bottom-right', pulse: true };
280
+ *
281
+ * function handleLoad() {
282
+ * console.log('Image loaded');
283
+ * }
284
+ *
285
+ * function handleError() {
286
+ * console.error('Image failed to load');
287
+ * }
288
+ * </script>
289
+ *
290
+ * <template>
291
+ * <profile-picture
292
+ * :src="avatarUrl"
293
+ * alt="John Doe"
294
+ * size="lg"
295
+ * variant="circle"
296
+ * :border="true"
297
+ * border-color="white"
298
+ * bg-color="#f3f4f6"
299
+ * :ring="JSON.stringify(ring)"
300
+ * :badge="JSON.stringify(badge)"
301
+ * @load="handleLoad"
302
+ * @error="handleError"
303
+ * />
304
+ * </template>
305
+ * ```
306
+ *
307
+ * Note: You may need to add the custom element to Vue's config:
308
+ *
309
+ * ```typescript
310
+ * // vite.config.ts or main.ts
311
+ * app.config.compilerOptions.isCustomElement = (tag) =>
312
+ * tag === 'profile-picture' || tag === 'profile-picture-group';
313
+ * ```
314
+ *
315
+ * Or in Vite:
316
+ *
317
+ * ```typescript
318
+ * // vite.config.ts
319
+ * export default {
320
+ * plugins: [
321
+ * vue({
322
+ * template: {
323
+ * compilerOptions: {
324
+ * isCustomElement: (tag) =>
325
+ * tag === 'profile-picture' || tag === 'profile-picture-group'
326
+ * }
327
+ * }
328
+ * })
329
+ * ]
330
+ * }
331
+ * ```
332
+ */
333
+
334
+ /**
335
+ * Set global CDN base URL for all ProfilePicture instances
336
+ * @example setCdnBaseUrl('https://api.example.com')
337
+ */
338
+ declare function setCdnBaseUrl(url: string): void;
339
+ /**
340
+ * Get current CDN base URL
341
+ */
342
+ declare function getCdnBaseUrl(): string;
343
+
344
+ 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 };