@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/index.d.cts
CHANGED
|
@@ -47,6 +47,8 @@ interface BadgeConfig {
|
|
|
47
47
|
glow?: boolean;
|
|
48
48
|
/** Max value to display (shows 99+ if exceeded) */
|
|
49
49
|
max?: number;
|
|
50
|
+
/** Icon to display before content (emoji, Unicode symbol, or text) */
|
|
51
|
+
icon?: string;
|
|
50
52
|
}
|
|
51
53
|
interface GlowConfig {
|
|
52
54
|
/** Glow color (defaults to border or bg color) */
|
|
@@ -69,6 +71,10 @@ interface RingConfig {
|
|
|
69
71
|
gap?: number;
|
|
70
72
|
/** Animate (rotate for gradient) */
|
|
71
73
|
animate?: boolean;
|
|
74
|
+
/** Progress percentage (0-100) for partial fill ring */
|
|
75
|
+
progress?: number;
|
|
76
|
+
/** Color for unfilled portion when progress is set (defaults to gray) */
|
|
77
|
+
emptyColor?: string;
|
|
72
78
|
}
|
|
73
79
|
interface InteractionConfig {
|
|
74
80
|
/** Enable hover effects */
|
|
@@ -114,8 +120,8 @@ interface GroupUserData {
|
|
|
114
120
|
shadow?: ShadowPreset;
|
|
115
121
|
/** Show border */
|
|
116
122
|
border?: boolean;
|
|
117
|
-
/** Border width (1-
|
|
118
|
-
borderWidth?: 1 | 2 | 3 | 4;
|
|
123
|
+
/** Border width (1-8) */
|
|
124
|
+
borderWidth?: 1 | 2 | 3 | 4 | 5 | 6 | 8;
|
|
119
125
|
/** Border color */
|
|
120
126
|
borderColor?: string;
|
|
121
127
|
/** Background color */
|
|
@@ -158,16 +164,29 @@ interface ProfilePictureGroupProps$1 {
|
|
|
158
164
|
|
|
159
165
|
declare class ProfilePicture$1 extends LitElement {
|
|
160
166
|
private static stylesInjected;
|
|
167
|
+
private static cdnBaseUrl;
|
|
168
|
+
private static instances;
|
|
169
|
+
/**
|
|
170
|
+
* Set global CDN base URL for all ProfilePicture instances
|
|
171
|
+
* @example ProfilePicture.setCdnBaseUrl('https://api.example.com')
|
|
172
|
+
*/
|
|
173
|
+
static setCdnBaseUrl(url: string): void;
|
|
174
|
+
/**
|
|
175
|
+
* Get current CDN base URL
|
|
176
|
+
*/
|
|
177
|
+
static getCdnBaseUrl(): string;
|
|
161
178
|
protected createRenderRoot(): this;
|
|
162
179
|
private static injectStylesOnce;
|
|
163
180
|
src: string;
|
|
164
181
|
alt: string;
|
|
182
|
+
extCustomerId?: string;
|
|
165
183
|
size: Size | string;
|
|
166
184
|
variant: Variant;
|
|
167
185
|
shadow: ShadowPreset;
|
|
168
186
|
border: boolean;
|
|
169
|
-
borderWidth: 1 | 2 | 3 | 4;
|
|
187
|
+
borderWidth: 1 | 2 | 3 | 4 | 5 | 6 | 8;
|
|
170
188
|
borderColor: string;
|
|
189
|
+
rotation: number;
|
|
171
190
|
bgColor?: string;
|
|
172
191
|
bgGradient?: string;
|
|
173
192
|
ring?: RingConfig;
|
|
@@ -182,11 +201,25 @@ declare class ProfilePicture$1 extends LitElement {
|
|
|
182
201
|
interactive?: InteractionConfig;
|
|
183
202
|
private isLoaded;
|
|
184
203
|
private hasError;
|
|
204
|
+
private cdnImageUrl?;
|
|
205
|
+
private cdnLoadFailed;
|
|
185
206
|
private previousSrc;
|
|
207
|
+
private previousExtCustomerId?;
|
|
208
|
+
private retryTimeoutId?;
|
|
209
|
+
private readonly RETRY_DELAY_MS;
|
|
186
210
|
private get pixelSize();
|
|
211
|
+
connectedCallback(): void;
|
|
212
|
+
disconnectedCallback(): void;
|
|
213
|
+
protected firstUpdated(): void;
|
|
214
|
+
protected updated(changedProperties: Map<string, unknown>): void;
|
|
187
215
|
protected willUpdate(changedProperties: Map<string, unknown>): void;
|
|
188
216
|
private handleLoad;
|
|
189
217
|
private handleError;
|
|
218
|
+
/**
|
|
219
|
+
* Construct CDN URL for profile picture using ext-customer-id
|
|
220
|
+
* Uses direct image src binding - browser handles redirects automatically
|
|
221
|
+
*/
|
|
222
|
+
private loadCdnImage;
|
|
190
223
|
private getContainerStyles;
|
|
191
224
|
private renderPlaceholder;
|
|
192
225
|
private renderFallback;
|
|
@@ -204,6 +237,27 @@ declare global {
|
|
|
204
237
|
}
|
|
205
238
|
}
|
|
206
239
|
|
|
240
|
+
/**
|
|
241
|
+
* Profile Picture Component - Utility Functions
|
|
242
|
+
* Apple-inspired design system utilities
|
|
243
|
+
*/
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Get CDN size label from pixel size (rounds up to next available size)
|
|
247
|
+
* CDN sizes: 80, 120, 240, 480, 960
|
|
248
|
+
*/
|
|
249
|
+
declare function getCdnSizeLabel(pixelSize: number): "80" | "120" | "240" | "480" | "960";
|
|
250
|
+
/**
|
|
251
|
+
* Detect theme (dark/light) from background color using luminance calculation
|
|
252
|
+
* Returns 'light' for non-hex colors or when luminance > 0.5
|
|
253
|
+
*/
|
|
254
|
+
declare function detectThemeFromColor(bgColor?: string): "dark" | "light";
|
|
255
|
+
/**
|
|
256
|
+
* Construct CDN URL for profile picture
|
|
257
|
+
* Format: {baseUrl}/api/profile-picture/cdn/{extId}_{size}_{theme}.webp?hostname={hostname}
|
|
258
|
+
*/
|
|
259
|
+
declare function constructCdnUrl(baseUrl: string, extCustomerId: string, sizeLabel: "80" | "120" | "240" | "480" | "960", theme: "dark" | "light", hostname: string): string;
|
|
260
|
+
|
|
207
261
|
declare class ProfilePictureGroup$1 extends LitElement {
|
|
208
262
|
protected createRenderRoot(): this;
|
|
209
263
|
max: 4;
|
|
@@ -216,6 +270,7 @@ declare class ProfilePictureGroup$1 extends LitElement {
|
|
|
216
270
|
showAddButton: boolean;
|
|
217
271
|
addButtonLabel: string;
|
|
218
272
|
animated: true;
|
|
273
|
+
rotationAmount: number;
|
|
219
274
|
private users;
|
|
220
275
|
private dropdownOpen;
|
|
221
276
|
private tooltipData;
|
|
@@ -386,4 +441,4 @@ interface ProfilePictureProps {
|
|
|
386
441
|
*/
|
|
387
442
|
declare const ProfilePicture: React.ForwardRefExoticComponent<ProfilePictureProps & React.RefAttributes<HTMLElement>>;
|
|
388
443
|
|
|
389
|
-
export { type BadgeConfig, type DropdownConfig, type GroupUserData, type LoadingStrategy, type PlaceholderType, type Position, ProfilePicture, ProfilePictureGroup, type ProfilePictureGroupProps$1 as ProfilePictureGroupProps, type ProfilePictureProps, type RibbonConfig, type Size, type StackDirection, type TooltipConfig, type TooltipPosition, type Variant };
|
|
444
|
+
export { type BadgeConfig, type DropdownConfig, type GroupUserData, type LoadingStrategy, type PlaceholderType, type Position, ProfilePicture, ProfilePictureGroup, type ProfilePictureGroupProps$1 as ProfilePictureGroupProps, type ProfilePictureProps, type RibbonConfig, type Size, type StackDirection, type TooltipConfig, type TooltipPosition, type Variant, constructCdnUrl, detectThemeFromColor, getCdnSizeLabel };
|
package/dist/index.d.ts
CHANGED
|
@@ -47,6 +47,8 @@ interface BadgeConfig {
|
|
|
47
47
|
glow?: boolean;
|
|
48
48
|
/** Max value to display (shows 99+ if exceeded) */
|
|
49
49
|
max?: number;
|
|
50
|
+
/** Icon to display before content (emoji, Unicode symbol, or text) */
|
|
51
|
+
icon?: string;
|
|
50
52
|
}
|
|
51
53
|
interface GlowConfig {
|
|
52
54
|
/** Glow color (defaults to border or bg color) */
|
|
@@ -69,6 +71,10 @@ interface RingConfig {
|
|
|
69
71
|
gap?: number;
|
|
70
72
|
/** Animate (rotate for gradient) */
|
|
71
73
|
animate?: boolean;
|
|
74
|
+
/** Progress percentage (0-100) for partial fill ring */
|
|
75
|
+
progress?: number;
|
|
76
|
+
/** Color for unfilled portion when progress is set (defaults to gray) */
|
|
77
|
+
emptyColor?: string;
|
|
72
78
|
}
|
|
73
79
|
interface InteractionConfig {
|
|
74
80
|
/** Enable hover effects */
|
|
@@ -114,8 +120,8 @@ interface GroupUserData {
|
|
|
114
120
|
shadow?: ShadowPreset;
|
|
115
121
|
/** Show border */
|
|
116
122
|
border?: boolean;
|
|
117
|
-
/** Border width (1-
|
|
118
|
-
borderWidth?: 1 | 2 | 3 | 4;
|
|
123
|
+
/** Border width (1-8) */
|
|
124
|
+
borderWidth?: 1 | 2 | 3 | 4 | 5 | 6 | 8;
|
|
119
125
|
/** Border color */
|
|
120
126
|
borderColor?: string;
|
|
121
127
|
/** Background color */
|
|
@@ -158,16 +164,29 @@ interface ProfilePictureGroupProps$1 {
|
|
|
158
164
|
|
|
159
165
|
declare class ProfilePicture$1 extends LitElement {
|
|
160
166
|
private static stylesInjected;
|
|
167
|
+
private static cdnBaseUrl;
|
|
168
|
+
private static instances;
|
|
169
|
+
/**
|
|
170
|
+
* Set global CDN base URL for all ProfilePicture instances
|
|
171
|
+
* @example ProfilePicture.setCdnBaseUrl('https://api.example.com')
|
|
172
|
+
*/
|
|
173
|
+
static setCdnBaseUrl(url: string): void;
|
|
174
|
+
/**
|
|
175
|
+
* Get current CDN base URL
|
|
176
|
+
*/
|
|
177
|
+
static getCdnBaseUrl(): string;
|
|
161
178
|
protected createRenderRoot(): this;
|
|
162
179
|
private static injectStylesOnce;
|
|
163
180
|
src: string;
|
|
164
181
|
alt: string;
|
|
182
|
+
extCustomerId?: string;
|
|
165
183
|
size: Size | string;
|
|
166
184
|
variant: Variant;
|
|
167
185
|
shadow: ShadowPreset;
|
|
168
186
|
border: boolean;
|
|
169
|
-
borderWidth: 1 | 2 | 3 | 4;
|
|
187
|
+
borderWidth: 1 | 2 | 3 | 4 | 5 | 6 | 8;
|
|
170
188
|
borderColor: string;
|
|
189
|
+
rotation: number;
|
|
171
190
|
bgColor?: string;
|
|
172
191
|
bgGradient?: string;
|
|
173
192
|
ring?: RingConfig;
|
|
@@ -182,11 +201,25 @@ declare class ProfilePicture$1 extends LitElement {
|
|
|
182
201
|
interactive?: InteractionConfig;
|
|
183
202
|
private isLoaded;
|
|
184
203
|
private hasError;
|
|
204
|
+
private cdnImageUrl?;
|
|
205
|
+
private cdnLoadFailed;
|
|
185
206
|
private previousSrc;
|
|
207
|
+
private previousExtCustomerId?;
|
|
208
|
+
private retryTimeoutId?;
|
|
209
|
+
private readonly RETRY_DELAY_MS;
|
|
186
210
|
private get pixelSize();
|
|
211
|
+
connectedCallback(): void;
|
|
212
|
+
disconnectedCallback(): void;
|
|
213
|
+
protected firstUpdated(): void;
|
|
214
|
+
protected updated(changedProperties: Map<string, unknown>): void;
|
|
187
215
|
protected willUpdate(changedProperties: Map<string, unknown>): void;
|
|
188
216
|
private handleLoad;
|
|
189
217
|
private handleError;
|
|
218
|
+
/**
|
|
219
|
+
* Construct CDN URL for profile picture using ext-customer-id
|
|
220
|
+
* Uses direct image src binding - browser handles redirects automatically
|
|
221
|
+
*/
|
|
222
|
+
private loadCdnImage;
|
|
190
223
|
private getContainerStyles;
|
|
191
224
|
private renderPlaceholder;
|
|
192
225
|
private renderFallback;
|
|
@@ -204,6 +237,27 @@ declare global {
|
|
|
204
237
|
}
|
|
205
238
|
}
|
|
206
239
|
|
|
240
|
+
/**
|
|
241
|
+
* Profile Picture Component - Utility Functions
|
|
242
|
+
* Apple-inspired design system utilities
|
|
243
|
+
*/
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Get CDN size label from pixel size (rounds up to next available size)
|
|
247
|
+
* CDN sizes: 80, 120, 240, 480, 960
|
|
248
|
+
*/
|
|
249
|
+
declare function getCdnSizeLabel(pixelSize: number): "80" | "120" | "240" | "480" | "960";
|
|
250
|
+
/**
|
|
251
|
+
* Detect theme (dark/light) from background color using luminance calculation
|
|
252
|
+
* Returns 'light' for non-hex colors or when luminance > 0.5
|
|
253
|
+
*/
|
|
254
|
+
declare function detectThemeFromColor(bgColor?: string): "dark" | "light";
|
|
255
|
+
/**
|
|
256
|
+
* Construct CDN URL for profile picture
|
|
257
|
+
* Format: {baseUrl}/api/profile-picture/cdn/{extId}_{size}_{theme}.webp?hostname={hostname}
|
|
258
|
+
*/
|
|
259
|
+
declare function constructCdnUrl(baseUrl: string, extCustomerId: string, sizeLabel: "80" | "120" | "240" | "480" | "960", theme: "dark" | "light", hostname: string): string;
|
|
260
|
+
|
|
207
261
|
declare class ProfilePictureGroup$1 extends LitElement {
|
|
208
262
|
protected createRenderRoot(): this;
|
|
209
263
|
max: 4;
|
|
@@ -216,6 +270,7 @@ declare class ProfilePictureGroup$1 extends LitElement {
|
|
|
216
270
|
showAddButton: boolean;
|
|
217
271
|
addButtonLabel: string;
|
|
218
272
|
animated: true;
|
|
273
|
+
rotationAmount: number;
|
|
219
274
|
private users;
|
|
220
275
|
private dropdownOpen;
|
|
221
276
|
private tooltipData;
|
|
@@ -386,4 +441,4 @@ interface ProfilePictureProps {
|
|
|
386
441
|
*/
|
|
387
442
|
declare const ProfilePicture: React.ForwardRefExoticComponent<ProfilePictureProps & React.RefAttributes<HTMLElement>>;
|
|
388
443
|
|
|
389
|
-
export { type BadgeConfig, type DropdownConfig, type GroupUserData, type LoadingStrategy, type PlaceholderType, type Position, ProfilePicture, ProfilePictureGroup, type ProfilePictureGroupProps$1 as ProfilePictureGroupProps, type ProfilePictureProps, type RibbonConfig, type Size, type StackDirection, type TooltipConfig, type TooltipPosition, type Variant };
|
|
444
|
+
export { type BadgeConfig, type DropdownConfig, type GroupUserData, type LoadingStrategy, type PlaceholderType, type Position, ProfilePicture, ProfilePictureGroup, type ProfilePictureGroupProps$1 as ProfilePictureGroupProps, type ProfilePictureProps, type RibbonConfig, type Size, type StackDirection, type TooltipConfig, type TooltipPosition, type Variant, constructCdnUrl, detectThemeFromColor, getCdnSizeLabel };
|