@ngstarter-ui/components 21.0.56 → 21.0.58

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.
@@ -1,29 +1,342 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, inject, ElementRef, input, booleanAttribute, forwardRef, Component } from '@angular/core';
3
- import { createAvatar } from '@dicebear/core';
4
- import { initials, identicon } from '@dicebear/collection';
5
- import { v7 } from 'uuid';
6
- import { SafeHtmlPipe } from '@ngstarter-ui/components/core';
2
+ import { InjectionToken, makeEnvironmentProviders, inject, ElementRef, input, booleanAttribute, computed, forwardRef, Component } from '@angular/core';
7
3
 
8
4
  const AVATAR_ACCESSOR = new InjectionToken('AVATAR_ACCESSOR');
9
5
 
10
- const alreadyLoadedImages$1 = [];
6
+ const AVATAR_CONFIG = new InjectionToken('AVATAR_CONFIG');
7
+ function provideAvatar(config) {
8
+ return makeEnvironmentProviders([
9
+ { provide: AVATAR_CONFIG, useValue: config }
10
+ ]);
11
+ }
12
+
13
+ const GENERATED_AVATAR_RANDOM_MIN = -2147483648;
14
+ const GENERATED_AVATAR_RANDOM_MAX = 2147483647;
15
+ const GENERATED_AVATAR_MAX_SEED_LENGTH = 1024;
16
+ const GENERATED_AVATAR_PATTERN_COLORS = [
17
+ '3ead46',
18
+ 'c65abd',
19
+ '2697d4',
20
+ 'f59e0b',
21
+ 'ef4444',
22
+ '14b8a6',
23
+ '8b5cf6',
24
+ '64748b',
25
+ '22c55e',
26
+ 'e11d48',
27
+ '0ea5e9',
28
+ 'a855f7'
29
+ ];
30
+ const GENERATED_AVATAR_BACKGROUND_COLORS = [
31
+ 'bbf7d0',
32
+ 'f0abfc',
33
+ 'bae6fd',
34
+ 'fed7aa',
35
+ 'fecaca',
36
+ '99f6e4',
37
+ 'ddd6fe',
38
+ 'cbd5e1',
39
+ '86efac',
40
+ 'fecdd3',
41
+ '7dd3fc',
42
+ 'e9d5ff'
43
+ ];
44
+ const GENERATED_INITIALS_BACKGROUND_COLORS = [
45
+ 'e53935',
46
+ '3949ab',
47
+ '43a047',
48
+ 'ffb300',
49
+ '8e24aa',
50
+ '039be5',
51
+ 'fb8c00',
52
+ '00897b',
53
+ 'd81b60',
54
+ 'fbc02d',
55
+ '5e35b1',
56
+ '00acc1',
57
+ 'f4511e',
58
+ '7cb342',
59
+ '1e88e5',
60
+ 'c0ca33'
61
+ ];
62
+ const GENERATED_AVATAR_PATTERNS = [
63
+ [
64
+ '0x0x0',
65
+ '0x0x0',
66
+ 'x0x0x',
67
+ 'x000x',
68
+ '0xxx0'
69
+ ],
70
+ [
71
+ 'xxxxx',
72
+ 'xx0xx',
73
+ 'xx0xx',
74
+ '0x0x0',
75
+ 'xx0xx'
76
+ ],
77
+ [
78
+ '0xxx0',
79
+ 'x000x',
80
+ 'x0x0x',
81
+ 'x000x',
82
+ '0xxx0'
83
+ ],
84
+ [
85
+ 'xx0xx',
86
+ '0x0x0',
87
+ '00x00',
88
+ '0x0x0',
89
+ 'xx0xx'
90
+ ],
91
+ [
92
+ 'x000x',
93
+ 'xx0xx',
94
+ '0xxx0',
95
+ '00x00',
96
+ '00x00'
97
+ ],
98
+ [
99
+ '00x00',
100
+ '0xxx0',
101
+ 'xx0xx',
102
+ '0xxx0',
103
+ 'x000x'
104
+ ],
105
+ [
106
+ 'xxx00',
107
+ 'x0x00',
108
+ 'xxxxx',
109
+ '00x0x',
110
+ '00xxx'
111
+ ],
112
+ [
113
+ '00xxx',
114
+ '00x0x',
115
+ 'xxxxx',
116
+ 'x0x00',
117
+ 'xxx00'
118
+ ],
119
+ [
120
+ '0x0x0',
121
+ 'xxxxx',
122
+ '00x00',
123
+ 'xxxxx',
124
+ '0x0x0'
125
+ ],
126
+ [
127
+ 'x0x0x',
128
+ '0xxx0',
129
+ 'xx0xx',
130
+ '0xxx0',
131
+ 'x0x0x'
132
+ ],
133
+ [
134
+ '0xxx0',
135
+ '0x0x0',
136
+ 'xxxxx',
137
+ '0x0x0',
138
+ '0xxx0'
139
+ ],
140
+ [
141
+ 'xx0xx',
142
+ 'x000x',
143
+ '0xxx0',
144
+ 'x000x',
145
+ 'xx0xx'
146
+ ]
147
+ ];
148
+ class AvatarGenerator {
149
+ generate(options) {
150
+ const seed = String(options.seed || '');
151
+ if (options.appearance === 'initials') {
152
+ return this._initialsAvatar(seed, options.label, options.backgroundColors, options.foregroundColors);
153
+ }
154
+ if (options.appearance === 'identicon') {
155
+ return this._identiconAvatar(seed, options.backgroundColors, options.foregroundColors);
156
+ }
157
+ return null;
158
+ }
159
+ _identiconAvatar(seed, backgroundColorValues, foregroundColorValues) {
160
+ const random = this._createGeneratedAvatarRandom(seed || 'avatar');
161
+ const pattern = random.pick(GENERATED_AVATAR_PATTERNS, GENERATED_AVATAR_PATTERNS[0]);
162
+ const foregroundColors = this._colorPalette(foregroundColorValues, GENERATED_AVATAR_PATTERN_COLORS);
163
+ const backgroundColors = this._colorPalette(backgroundColorValues, GENERATED_AVATAR_BACKGROUND_COLORS);
164
+ const foreground = random.pick(foregroundColors, foregroundColors[0]);
165
+ const rotation = random.integer(0, 3);
166
+ const background = this._generatedAvatarBackground(random, backgroundColors);
167
+ return {
168
+ kind: 'identicon',
169
+ background,
170
+ foreground,
171
+ label: '',
172
+ cells: this._transformIdenticonCells(this._identiconCells(pattern), rotation)
173
+ };
174
+ }
175
+ _initialsAvatar(seed, label, backgroundColorValues, foregroundColorValues) {
176
+ const random = this._createGeneratedAvatarRandom(seed || 'avatar');
177
+ const backgroundColors = this._colorPalette(backgroundColorValues, GENERATED_INITIALS_BACKGROUND_COLORS);
178
+ const foregroundColors = this._colorPalette(foregroundColorValues, ['ffffff']);
179
+ const foreground = random.pick(foregroundColors, foregroundColors[0]);
180
+ const background = this._pickColorBySeed(seed || 'avatar', backgroundColors);
181
+ return {
182
+ kind: 'initials',
183
+ background,
184
+ foreground,
185
+ label: this._initials(seed, label),
186
+ cells: []
187
+ };
188
+ }
189
+ _initials(seed, label) {
190
+ const source = (label || seed).trim();
191
+ if (!source) {
192
+ return '?';
193
+ }
194
+ const parts = source.split(/\s+/).filter(Boolean);
195
+ if (parts.length > 1) {
196
+ return parts.slice(0, 2).map(part => part.charAt(0)).join('').toUpperCase();
197
+ }
198
+ return source.slice(0, 2).toUpperCase();
199
+ }
200
+ _identiconCells(rowPatterns) {
201
+ const cells = [];
202
+ rowPatterns.forEach((pattern, row) => {
203
+ for (let column = 0; column < pattern.length; column++) {
204
+ if (pattern[column] === 'x') {
205
+ cells.push({
206
+ id: `${column}-${row}`,
207
+ x: column,
208
+ y: row
209
+ });
210
+ }
211
+ }
212
+ });
213
+ return cells;
214
+ }
215
+ _transformIdenticonCells(cells, rotation) {
216
+ return cells.map(cell => {
217
+ if (rotation === 1) {
218
+ return {
219
+ id: `${cell.y}-${4 - cell.x}`,
220
+ x: cell.y,
221
+ y: 4 - cell.x
222
+ };
223
+ }
224
+ if (rotation === 2) {
225
+ return {
226
+ id: `${4 - cell.x}-${4 - cell.y}`,
227
+ x: 4 - cell.x,
228
+ y: 4 - cell.y
229
+ };
230
+ }
231
+ if (rotation === 3) {
232
+ return {
233
+ id: `${4 - cell.y}-${cell.x}`,
234
+ x: 4 - cell.y,
235
+ y: cell.x
236
+ };
237
+ }
238
+ return cell;
239
+ });
240
+ }
241
+ _colorPalette(colors, fallbackColors) {
242
+ return (colors.length ? colors : fallbackColors).map(color => {
243
+ return color === 'transparent' ? color : `#${color.replace('#', '')}`;
244
+ });
245
+ }
246
+ _pickColorBySeed(seed, colors) {
247
+ return colors[Math.abs(this._hashGeneratedAvatarSeed(seed)) % colors.length] ?? 'transparent';
248
+ }
249
+ _generatedAvatarBackground(random, backgroundColors) {
250
+ let shuffledBackgroundColors = random.shuffle(backgroundColors);
251
+ if (shuffledBackgroundColors.length <= 1) {
252
+ shuffledBackgroundColors = backgroundColors;
253
+ random.next();
254
+ }
255
+ else {
256
+ shuffledBackgroundColors = random.shuffle(backgroundColors);
257
+ }
258
+ return shuffledBackgroundColors[0] ?? 'transparent';
259
+ }
260
+ _createGeneratedAvatarRandom(seedValue) {
261
+ const seed = String(seedValue ?? '').slice(0, GENERATED_AVATAR_MAX_SEED_LENGTH);
262
+ let value = this._hashGeneratedAvatarSeed(seed) || 1;
263
+ const next = () => {
264
+ value = this._generatedAvatarXorshift(value);
265
+ return value;
266
+ };
267
+ const integer = (min, max) => {
268
+ return Math.floor(((next() - GENERATED_AVATAR_RANDOM_MIN) / (GENERATED_AVATAR_RANDOM_MAX - GENERATED_AVATAR_RANDOM_MIN)) * (max + 1 - min) + min);
269
+ };
270
+ return {
271
+ seed,
272
+ next,
273
+ integer,
274
+ pick: (values, fallback) => {
275
+ if (values.length === 0) {
276
+ next();
277
+ return fallback;
278
+ }
279
+ return values[integer(0, values.length - 1)] ?? fallback;
280
+ },
281
+ shuffle: (values) => {
282
+ const internalRandom = this._createGeneratedAvatarRandom(next().toString());
283
+ const workingValues = [...values];
284
+ for (let index = workingValues.length - 1; index > 0; index--) {
285
+ const randomIndex = internalRandom.integer(0, index);
286
+ [workingValues[index], workingValues[randomIndex]] = [workingValues[randomIndex], workingValues[index]];
287
+ }
288
+ return workingValues;
289
+ }
290
+ };
291
+ }
292
+ _hashGeneratedAvatarSeed(seed) {
293
+ let hash = 0;
294
+ for (let index = 0; index < seed.length; index++) {
295
+ hash = ((hash << 5) - hash + seed.charCodeAt(index)) | 0;
296
+ hash = this._generatedAvatarXorshift(hash);
297
+ }
298
+ return hash;
299
+ }
300
+ _generatedAvatarXorshift(value) {
301
+ value ^= value << 13;
302
+ value ^= value >> 17;
303
+ value ^= value << 5;
304
+ return value;
305
+ }
306
+ }
307
+
308
+ const alreadyLoadedImages = [];
11
309
  class Avatar {
12
310
  _elementRef = inject(ElementRef);
311
+ _config = inject(AVATAR_CONFIG, { optional: true });
312
+ _avatarGenerator = new AvatarGenerator();
13
313
  image = input('', ...(ngDevMode ? [{ debugName: "image" }] : /* istanbul ignore next */ []));
14
314
  variant = input('', ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
15
315
  clickable = input(false, { ...(ngDevMode ? { debugName: "clickable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
16
316
  label = input('', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
317
+ key = input('', ...(ngDevMode ? [{ debugName: "key" }] : /* istanbul ignore next */ []));
318
+ appearance = input(...(ngDevMode ? [undefined, { debugName: "appearance" }] : /* istanbul ignore next */ []));
319
+ backgroundColors = input([], ...(ngDevMode ? [{ debugName: "backgroundColors" }] : /* istanbul ignore next */ []));
320
+ foregroundColors = input([], ...(ngDevMode ? [{ debugName: "foregroundColors" }] : /* istanbul ignore next */ []));
17
321
  alt = input('', ...(ngDevMode ? [{ debugName: "alt" }] : /* istanbul ignore next */ []));
18
322
  automaticColor = input(...(ngDevMode ? [undefined, { debugName: "automaticColor" }] : /* istanbul ignore next */ []));
19
323
  presenceIndicator = input(null, ...(ngDevMode ? [{ debugName: "presenceIndicator" }] : /* istanbul ignore next */ []));
20
324
  imageLoaded;
21
325
  showLabel = false;
326
+ generatedAvatar = computed(() => {
327
+ return this._avatarGenerator.generate({
328
+ appearance: this.appearance() || this._config?.appearance || 'default',
329
+ seed: this._seed(),
330
+ label: this.label(),
331
+ backgroundColors: this.backgroundColors(),
332
+ foregroundColors: this.foregroundColors()
333
+ });
334
+ }, ...(ngDevMode ? [{ debugName: "generatedAvatar" }] : /* istanbul ignore next */ []));
22
335
  ngOnInit() {
23
336
  if (!this.image()) {
24
337
  return;
25
338
  }
26
- this.imageLoaded = alreadyLoadedImages$1.includes(this.image());
339
+ this.imageLoaded = alreadyLoadedImages.includes(this.image());
27
340
  }
28
341
  ngAfterViewInit() {
29
342
  setTimeout(() => {
@@ -31,6 +344,9 @@ class Avatar {
31
344
  }, 0);
32
345
  }
33
346
  ngOnChanges(changes) {
347
+ if (changes['image']) {
348
+ this.imageLoaded = alreadyLoadedImages.includes(this.image());
349
+ }
34
350
  if (changes['automaticColor'] && changes['automaticColor'].currentValue) {
35
351
  this._setAutomaticColor(changes['automaticColor'].currentValue);
36
352
  }
@@ -39,7 +355,7 @@ class Avatar {
39
355
  if (this.imageLoaded) {
40
356
  return;
41
357
  }
42
- alreadyLoadedImages$1.push(this.image());
358
+ alreadyLoadedImages.push(this.image());
43
359
  this.imageLoaded = true;
44
360
  }
45
361
  _setAutomaticColor(color) {
@@ -71,6 +387,9 @@ class Avatar {
71
387
  }
72
388
  }
73
389
  ;
390
+ _seed() {
391
+ return String(this.key() || this.label() || this.alt() || '');
392
+ }
74
393
  isValidHex(color) {
75
394
  if (!color || typeof color !== 'string') {
76
395
  return false;
@@ -95,13 +414,13 @@ class Avatar {
95
414
  }
96
415
  }
97
416
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: Avatar, deps: [], target: i0.ɵɵFactoryTarget.Component });
98
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: Avatar, isStandalone: true, selector: "ngs-avatar,[ngs-avatar]", inputs: { image: { classPropertyName: "image", publicName: "image", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, clickable: { classPropertyName: "clickable", publicName: "clickable", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, alt: { classPropertyName: "alt", publicName: "alt", isSignal: true, isRequired: false, transformFunction: null }, automaticColor: { classPropertyName: "automaticColor", publicName: "automaticColor", isSignal: true, isRequired: false, transformFunction: null }, presenceIndicator: { classPropertyName: "presenceIndicator", publicName: "presenceIndicator", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.is-clickable": "clickable()", "class.has-automatic-color": "!!automaticColor()", "class.has-loaded-image": "image() && imageLoaded", "class.is-solid": "variant() === \"solid\"", "class.is-tonal": "variant() === \"tonal\"", "class.is-outlined": "variant() === \"outlined\"", "class.is-plain": "variant() === \"plain\"" }, classAttribute: "ngs-avatar" }, providers: [
417
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: Avatar, isStandalone: true, selector: "ngs-avatar,[ngs-avatar]", inputs: { image: { classPropertyName: "image", publicName: "image", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, clickable: { classPropertyName: "clickable", publicName: "clickable", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, key: { classPropertyName: "key", publicName: "key", isSignal: true, isRequired: false, transformFunction: null }, appearance: { classPropertyName: "appearance", publicName: "appearance", isSignal: true, isRequired: false, transformFunction: null }, backgroundColors: { classPropertyName: "backgroundColors", publicName: "backgroundColors", isSignal: true, isRequired: false, transformFunction: null }, foregroundColors: { classPropertyName: "foregroundColors", publicName: "foregroundColors", isSignal: true, isRequired: false, transformFunction: null }, alt: { classPropertyName: "alt", publicName: "alt", isSignal: true, isRequired: false, transformFunction: null }, automaticColor: { classPropertyName: "automaticColor", publicName: "automaticColor", isSignal: true, isRequired: false, transformFunction: null }, presenceIndicator: { classPropertyName: "presenceIndicator", publicName: "presenceIndicator", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.is-clickable": "clickable()", "class.has-automatic-color": "!!automaticColor()", "class.has-generated-avatar": "!!generatedAvatar()", "class.has-loaded-image": "image() && imageLoaded", "class.is-solid": "variant() === \"solid\"", "class.is-tonal": "variant() === \"tonal\"", "class.is-outlined": "variant() === \"outlined\"", "class.is-plain": "variant() === \"plain\"" }, classAttribute: "ngs-avatar" }, providers: [
99
418
  {
100
419
  provide: AVATAR_ACCESSOR,
101
420
  useExisting: forwardRef(() => Avatar),
102
421
  multi: true
103
422
  }
104
- ], exportAs: ["ngsAvatar"], usesOnChanges: true, ngImport: i0, template: "@if (image()) {\n <img class=\"image\" loading=\"lazy\" [src]=\"image()\" [alt]=\"alt()\" (load)=\"onImageLoaded()\">\n}\n\n@if (presenceIndicator()) {\n <div class=\"presence-indicator\"\n [class.is-online]=\"presenceIndicator() === 'online'\"\n [class.is-offline]=\"presenceIndicator() === 'offline'\"\n [class.is-away]=\"presenceIndicator() === 'away'\"></div>\n}\n\n@if (label() && showLabel) {\n <svg viewBox=\"0 0 50 50\" class=\"text\">\n <text\n x=\"50%\"\n y=\"50%\"\n alignment-baseline=\"central\"\n text-anchor=\"middle\"\n font-weight=\"inherit\"\n font-size=\"20\"\n fill=\"currentColor\">{{ label() }}</text>\n </svg>\n}\n\n<ng-content select=\"mat-icon,ngs-icon\"/>\n", styles: [":host{--ngs-avatar-font-weight: 500;--ngs-avatar-size: calc(var(--spacing, .25rem) * 10);--ngs-avatar-border-radius: calc(infinity * 1px);--ngs-avatar-bg: var(--ngs-color-surface-container-highest);--ngs-avatar-color: var(--ngs-color-on-surface);--ngs-avatar-presence-indicator-size: 20%;--ngs-avatar-presence-indicator-position-top: 5%;--ngs-avatar-presence-indicator-position-end: 5%;--ngs-avatar-presence-indicator-online-bg: var(--ngs-color-success);--ngs-avatar-presence-indicator-offline-bg: var(--ngs-color-on-surface-variant);--ngs-avatar-presence-indicator-away-bg: var(--ngs-color-warning);--ngs-avatar-presence-indicator-outline: var(--ngs-color-surface) solid 2px;--ngs-avatar-inner-border: inset 0 0 1px var(--ngs-color-outline-variant);--ngs-avatar-border-color: transparent;--ngs-avatar-border-width: 1px;display:inline-flex;align-items:center;justify-content:center;-webkit-user-select:none;user-select:none;flex:none;text-transform:uppercase;position:relative;font-weight:var(--ngs-avatar-font-weight)}:host:not([class*=text-]){color:var(--ngs-avatar-color)}:host:not([class*=rounded]){border-radius:var(--ngs-avatar-border-radius)}:host:not([class*=w-]):not([class*=size-]){width:var(--ngs-avatar-size)}:host:not([class*=h-]):not([class*=size-]){height:var(--ngs-avatar-size)}:host:not([class*=bg-]):not(.has-loaded-image){background:var(--ngs-avatar-bg)}:host.is-solid{--ngs-avatar-bg: var(--ngs-color-primary);--ngs-avatar-color: var(--ngs-color-on-primary)}:host.is-tonal{--ngs-avatar-bg: var(--ngs-color-surface-container-highest);--ngs-avatar-color: var(--ngs-color-on-surface)}:host.is-outlined{--ngs-avatar-bg: transparent;--ngs-avatar-color: var(--ngs-color-on-surface);box-shadow:var(--ngs-avatar-inner-border)}:host.is-plain{--ngs-avatar-bg: transparent;--ngs-avatar-color: var(--ngs-color-on-surface)}:host .text{z-index:0;width:100%;height:100%}:host.has-loaded-image .text{display:none}:host.is-clickable{cursor:pointer}:host.is-hidden{display:none}:host.is-clickable:active{scale:.97}:host .image{display:inline;object-fit:cover;position:absolute;width:100%;height:100%;border-radius:inherit;z-index:1}:host .presence-indicator{position:absolute;z-index:1;outline:var(--ngs-avatar-presence-indicator-outline);border-radius:6.1875rem;width:var(--ngs-avatar-presence-indicator-size);height:var(--ngs-avatar-presence-indicator-size);top:var(--ngs-avatar-presence-indicator-position-top);inset-inline-end:var(--ngs-avatar-presence-indicator-position-end)}:host .presence-indicator.is-online{background:var(--ngs-avatar-presence-indicator-online-bg)}:host .presence-indicator.is-offline{background:var(--ngs-avatar-presence-indicator-offline-bg)}:host .presence-indicator.is-away{background:var(--ngs-avatar-presence-indicator-away-bg)}:host ::ng-deep .ngs-icon{display:flex;align-items:center;justify-content:center}:host.has-automatic-color{--ngs-avatar-border-color: var(--ngs-avatar-border-color-auto, transparent)}\n/*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */\n"] });
423
+ ], exportAs: ["ngsAvatar"], usesOnChanges: true, ngImport: i0, template: "@if (image()) {\n <img class=\"image\" loading=\"lazy\" [src]=\"image()\" [alt]=\"alt()\" (load)=\"onImageLoaded()\">\n}\n\n@if (!image() && generatedAvatar(); as avatar) {\n @if (avatar.kind === 'identicon') {\n <svg class=\"generated-avatar\" viewBox=\"0 0 9 9\" fill=\"none\" shape-rendering=\"crispEdges\" aria-hidden=\"true\">\n <rect width=\"9\" height=\"9\" x=\"0\" y=\"0\" [attr.fill]=\"avatar.background\"></rect>\n <g>\n @for (cell of avatar.cells; track cell.id) {\n <rect\n [attr.x]=\"cell.x + 2\"\n [attr.y]=\"cell.y + 2\"\n width=\"1\"\n height=\"1\"\n [attr.fill]=\"avatar.foreground\"></rect>\n }\n </g>\n </svg>\n } @else {\n <svg class=\"generated-avatar\" viewBox=\"0 0 100 100\" aria-hidden=\"true\">\n <rect width=\"100\" height=\"100\" x=\"0\" y=\"0\" [attr.fill]=\"avatar.background\"></rect>\n <g transform=\"translate(12.5 12.5) scale(0.75)\">\n <text\n x=\"50%\"\n y=\"50%\"\n font-family=\"Arial, sans-serif\"\n font-weight=\"500\"\n font-size=\"50\"\n dy=\"17.800\"\n text-anchor=\"middle\"\n [attr.fill]=\"avatar.foreground\">{{ avatar.label }}</text>\n </g>\n </svg>\n }\n}\n\n@if (presenceIndicator()) {\n <div class=\"presence-indicator\"\n [class.is-online]=\"presenceIndicator() === 'online'\"\n [class.is-offline]=\"presenceIndicator() === 'offline'\"\n [class.is-away]=\"presenceIndicator() === 'away'\"></div>\n}\n\n@if (label() && showLabel && !generatedAvatar()) {\n <svg viewBox=\"0 0 50 50\" class=\"text\">\n <text\n x=\"50%\"\n y=\"50%\"\n alignment-baseline=\"central\"\n text-anchor=\"middle\"\n font-weight=\"inherit\"\n font-size=\"20\"\n fill=\"currentColor\">{{ label() }}</text>\n </svg>\n}\n\n<ng-content select=\"mat-icon,ngs-icon\"/>\n", styles: [":host{--ngs-avatar-font-weight: 500;--ngs-avatar-size: calc(var(--spacing, .25rem) * 10);--ngs-avatar-border-radius: calc(infinity * 1px);--ngs-avatar-bg: var(--ngs-color-surface-container-highest);--ngs-avatar-color: var(--ngs-color-on-surface);--ngs-avatar-presence-indicator-size: 20%;--ngs-avatar-presence-indicator-position-top: 5%;--ngs-avatar-presence-indicator-position-end: 5%;--ngs-avatar-presence-indicator-online-bg: var(--ngs-color-success);--ngs-avatar-presence-indicator-offline-bg: var(--ngs-color-on-surface-variant);--ngs-avatar-presence-indicator-away-bg: var(--ngs-color-warning);--ngs-avatar-presence-indicator-outline: var(--ngs-color-surface) solid 2px;--ngs-avatar-inner-border: inset 0 0 1px var(--ngs-color-outline-variant);--ngs-avatar-border-color: transparent;--ngs-avatar-border-width: 1px;display:inline-flex;align-items:center;justify-content:center;-webkit-user-select:none;user-select:none;flex:none;text-transform:uppercase;position:relative;font-weight:var(--ngs-avatar-font-weight)}:host:not([class*=text-]){color:var(--ngs-avatar-color)}:host:not([class*=rounded]){border-radius:var(--ngs-avatar-border-radius)}:host:not([class*=w-]):not([class*=size-]){width:var(--ngs-avatar-size)}:host:not([class*=h-]):not([class*=size-]){height:var(--ngs-avatar-size)}:host:not([class*=bg-]):not(.has-loaded-image){background:var(--ngs-avatar-bg)}:host.is-solid{--ngs-avatar-bg: var(--ngs-color-primary);--ngs-avatar-color: var(--ngs-color-on-primary)}:host.is-tonal{--ngs-avatar-bg: var(--ngs-color-surface-container-highest);--ngs-avatar-color: var(--ngs-color-on-surface)}:host.is-outlined{--ngs-avatar-bg: transparent;--ngs-avatar-color: var(--ngs-color-on-surface);box-shadow:var(--ngs-avatar-inner-border)}:host.is-plain{--ngs-avatar-bg: transparent;--ngs-avatar-color: var(--ngs-color-on-surface)}:host .text{z-index:0;width:100%;height:100%}:host .generated-avatar{position:absolute;inset:0;z-index:0;width:100%;height:100%;overflow:hidden;border-radius:inherit}:host.has-loaded-image .text{display:none}:host.is-clickable{cursor:pointer}:host.is-hidden{display:none}:host.is-clickable:active{scale:.97}:host .image{display:inline;object-fit:cover;position:absolute;width:100%;height:100%;border-radius:inherit;z-index:1}:host .presence-indicator{position:absolute;z-index:1;outline:var(--ngs-avatar-presence-indicator-outline);border-radius:6.1875rem;width:var(--ngs-avatar-presence-indicator-size);height:var(--ngs-avatar-presence-indicator-size);top:var(--ngs-avatar-presence-indicator-position-top);inset-inline-end:var(--ngs-avatar-presence-indicator-position-end)}:host .presence-indicator.is-online{background:var(--ngs-avatar-presence-indicator-online-bg)}:host .presence-indicator.is-offline{background:var(--ngs-avatar-presence-indicator-offline-bg)}:host .presence-indicator.is-away{background:var(--ngs-avatar-presence-indicator-away-bg)}:host ::ng-deep .ngs-icon{display:flex;align-items:center;justify-content:center}:host.has-automatic-color{--ngs-avatar-border-color: var(--ngs-avatar-border-color-auto, transparent)}:host.has-generated-avatar{--ngs-avatar-bg: transparent}:host.has-generated-avatar:not([class*=shadow-]){box-shadow:var(--ngs-avatar-inner-border)}\n/*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */\n"] });
105
424
  }
106
425
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: Avatar, decorators: [{
107
426
  type: Component,
@@ -115,13 +434,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
115
434
  'class': 'ngs-avatar',
116
435
  '[class.is-clickable]': 'clickable()',
117
436
  '[class.has-automatic-color]': '!!automaticColor()',
437
+ '[class.has-generated-avatar]': '!!generatedAvatar()',
118
438
  '[class.has-loaded-image]': 'image() && imageLoaded',
119
439
  '[class.is-solid]': 'variant() === "solid"',
120
440
  '[class.is-tonal]': 'variant() === "tonal"',
121
441
  '[class.is-outlined]': 'variant() === "outlined"',
122
442
  '[class.is-plain]': 'variant() === "plain"',
123
- }, template: "@if (image()) {\n <img class=\"image\" loading=\"lazy\" [src]=\"image()\" [alt]=\"alt()\" (load)=\"onImageLoaded()\">\n}\n\n@if (presenceIndicator()) {\n <div class=\"presence-indicator\"\n [class.is-online]=\"presenceIndicator() === 'online'\"\n [class.is-offline]=\"presenceIndicator() === 'offline'\"\n [class.is-away]=\"presenceIndicator() === 'away'\"></div>\n}\n\n@if (label() && showLabel) {\n <svg viewBox=\"0 0 50 50\" class=\"text\">\n <text\n x=\"50%\"\n y=\"50%\"\n alignment-baseline=\"central\"\n text-anchor=\"middle\"\n font-weight=\"inherit\"\n font-size=\"20\"\n fill=\"currentColor\">{{ label() }}</text>\n </svg>\n}\n\n<ng-content select=\"mat-icon,ngs-icon\"/>\n", styles: [":host{--ngs-avatar-font-weight: 500;--ngs-avatar-size: calc(var(--spacing, .25rem) * 10);--ngs-avatar-border-radius: calc(infinity * 1px);--ngs-avatar-bg: var(--ngs-color-surface-container-highest);--ngs-avatar-color: var(--ngs-color-on-surface);--ngs-avatar-presence-indicator-size: 20%;--ngs-avatar-presence-indicator-position-top: 5%;--ngs-avatar-presence-indicator-position-end: 5%;--ngs-avatar-presence-indicator-online-bg: var(--ngs-color-success);--ngs-avatar-presence-indicator-offline-bg: var(--ngs-color-on-surface-variant);--ngs-avatar-presence-indicator-away-bg: var(--ngs-color-warning);--ngs-avatar-presence-indicator-outline: var(--ngs-color-surface) solid 2px;--ngs-avatar-inner-border: inset 0 0 1px var(--ngs-color-outline-variant);--ngs-avatar-border-color: transparent;--ngs-avatar-border-width: 1px;display:inline-flex;align-items:center;justify-content:center;-webkit-user-select:none;user-select:none;flex:none;text-transform:uppercase;position:relative;font-weight:var(--ngs-avatar-font-weight)}:host:not([class*=text-]){color:var(--ngs-avatar-color)}:host:not([class*=rounded]){border-radius:var(--ngs-avatar-border-radius)}:host:not([class*=w-]):not([class*=size-]){width:var(--ngs-avatar-size)}:host:not([class*=h-]):not([class*=size-]){height:var(--ngs-avatar-size)}:host:not([class*=bg-]):not(.has-loaded-image){background:var(--ngs-avatar-bg)}:host.is-solid{--ngs-avatar-bg: var(--ngs-color-primary);--ngs-avatar-color: var(--ngs-color-on-primary)}:host.is-tonal{--ngs-avatar-bg: var(--ngs-color-surface-container-highest);--ngs-avatar-color: var(--ngs-color-on-surface)}:host.is-outlined{--ngs-avatar-bg: transparent;--ngs-avatar-color: var(--ngs-color-on-surface);box-shadow:var(--ngs-avatar-inner-border)}:host.is-plain{--ngs-avatar-bg: transparent;--ngs-avatar-color: var(--ngs-color-on-surface)}:host .text{z-index:0;width:100%;height:100%}:host.has-loaded-image .text{display:none}:host.is-clickable{cursor:pointer}:host.is-hidden{display:none}:host.is-clickable:active{scale:.97}:host .image{display:inline;object-fit:cover;position:absolute;width:100%;height:100%;border-radius:inherit;z-index:1}:host .presence-indicator{position:absolute;z-index:1;outline:var(--ngs-avatar-presence-indicator-outline);border-radius:6.1875rem;width:var(--ngs-avatar-presence-indicator-size);height:var(--ngs-avatar-presence-indicator-size);top:var(--ngs-avatar-presence-indicator-position-top);inset-inline-end:var(--ngs-avatar-presence-indicator-position-end)}:host .presence-indicator.is-online{background:var(--ngs-avatar-presence-indicator-online-bg)}:host .presence-indicator.is-offline{background:var(--ngs-avatar-presence-indicator-offline-bg)}:host .presence-indicator.is-away{background:var(--ngs-avatar-presence-indicator-away-bg)}:host ::ng-deep .ngs-icon{display:flex;align-items:center;justify-content:center}:host.has-automatic-color{--ngs-avatar-border-color: var(--ngs-avatar-border-color-auto, transparent)}\n/*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */\n"] }]
124
- }], propDecorators: { image: [{ type: i0.Input, args: [{ isSignal: true, alias: "image", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], clickable: [{ type: i0.Input, args: [{ isSignal: true, alias: "clickable", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], alt: [{ type: i0.Input, args: [{ isSignal: true, alias: "alt", required: false }] }], automaticColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "automaticColor", required: false }] }], presenceIndicator: [{ type: i0.Input, args: [{ isSignal: true, alias: "presenceIndicator", required: false }] }] } });
443
+ }, template: "@if (image()) {\n <img class=\"image\" loading=\"lazy\" [src]=\"image()\" [alt]=\"alt()\" (load)=\"onImageLoaded()\">\n}\n\n@if (!image() && generatedAvatar(); as avatar) {\n @if (avatar.kind === 'identicon') {\n <svg class=\"generated-avatar\" viewBox=\"0 0 9 9\" fill=\"none\" shape-rendering=\"crispEdges\" aria-hidden=\"true\">\n <rect width=\"9\" height=\"9\" x=\"0\" y=\"0\" [attr.fill]=\"avatar.background\"></rect>\n <g>\n @for (cell of avatar.cells; track cell.id) {\n <rect\n [attr.x]=\"cell.x + 2\"\n [attr.y]=\"cell.y + 2\"\n width=\"1\"\n height=\"1\"\n [attr.fill]=\"avatar.foreground\"></rect>\n }\n </g>\n </svg>\n } @else {\n <svg class=\"generated-avatar\" viewBox=\"0 0 100 100\" aria-hidden=\"true\">\n <rect width=\"100\" height=\"100\" x=\"0\" y=\"0\" [attr.fill]=\"avatar.background\"></rect>\n <g transform=\"translate(12.5 12.5) scale(0.75)\">\n <text\n x=\"50%\"\n y=\"50%\"\n font-family=\"Arial, sans-serif\"\n font-weight=\"500\"\n font-size=\"50\"\n dy=\"17.800\"\n text-anchor=\"middle\"\n [attr.fill]=\"avatar.foreground\">{{ avatar.label }}</text>\n </g>\n </svg>\n }\n}\n\n@if (presenceIndicator()) {\n <div class=\"presence-indicator\"\n [class.is-online]=\"presenceIndicator() === 'online'\"\n [class.is-offline]=\"presenceIndicator() === 'offline'\"\n [class.is-away]=\"presenceIndicator() === 'away'\"></div>\n}\n\n@if (label() && showLabel && !generatedAvatar()) {\n <svg viewBox=\"0 0 50 50\" class=\"text\">\n <text\n x=\"50%\"\n y=\"50%\"\n alignment-baseline=\"central\"\n text-anchor=\"middle\"\n font-weight=\"inherit\"\n font-size=\"20\"\n fill=\"currentColor\">{{ label() }}</text>\n </svg>\n}\n\n<ng-content select=\"mat-icon,ngs-icon\"/>\n", styles: [":host{--ngs-avatar-font-weight: 500;--ngs-avatar-size: calc(var(--spacing, .25rem) * 10);--ngs-avatar-border-radius: calc(infinity * 1px);--ngs-avatar-bg: var(--ngs-color-surface-container-highest);--ngs-avatar-color: var(--ngs-color-on-surface);--ngs-avatar-presence-indicator-size: 20%;--ngs-avatar-presence-indicator-position-top: 5%;--ngs-avatar-presence-indicator-position-end: 5%;--ngs-avatar-presence-indicator-online-bg: var(--ngs-color-success);--ngs-avatar-presence-indicator-offline-bg: var(--ngs-color-on-surface-variant);--ngs-avatar-presence-indicator-away-bg: var(--ngs-color-warning);--ngs-avatar-presence-indicator-outline: var(--ngs-color-surface) solid 2px;--ngs-avatar-inner-border: inset 0 0 1px var(--ngs-color-outline-variant);--ngs-avatar-border-color: transparent;--ngs-avatar-border-width: 1px;display:inline-flex;align-items:center;justify-content:center;-webkit-user-select:none;user-select:none;flex:none;text-transform:uppercase;position:relative;font-weight:var(--ngs-avatar-font-weight)}:host:not([class*=text-]){color:var(--ngs-avatar-color)}:host:not([class*=rounded]){border-radius:var(--ngs-avatar-border-radius)}:host:not([class*=w-]):not([class*=size-]){width:var(--ngs-avatar-size)}:host:not([class*=h-]):not([class*=size-]){height:var(--ngs-avatar-size)}:host:not([class*=bg-]):not(.has-loaded-image){background:var(--ngs-avatar-bg)}:host.is-solid{--ngs-avatar-bg: var(--ngs-color-primary);--ngs-avatar-color: var(--ngs-color-on-primary)}:host.is-tonal{--ngs-avatar-bg: var(--ngs-color-surface-container-highest);--ngs-avatar-color: var(--ngs-color-on-surface)}:host.is-outlined{--ngs-avatar-bg: transparent;--ngs-avatar-color: var(--ngs-color-on-surface);box-shadow:var(--ngs-avatar-inner-border)}:host.is-plain{--ngs-avatar-bg: transparent;--ngs-avatar-color: var(--ngs-color-on-surface)}:host .text{z-index:0;width:100%;height:100%}:host .generated-avatar{position:absolute;inset:0;z-index:0;width:100%;height:100%;overflow:hidden;border-radius:inherit}:host.has-loaded-image .text{display:none}:host.is-clickable{cursor:pointer}:host.is-hidden{display:none}:host.is-clickable:active{scale:.97}:host .image{display:inline;object-fit:cover;position:absolute;width:100%;height:100%;border-radius:inherit;z-index:1}:host .presence-indicator{position:absolute;z-index:1;outline:var(--ngs-avatar-presence-indicator-outline);border-radius:6.1875rem;width:var(--ngs-avatar-presence-indicator-size);height:var(--ngs-avatar-presence-indicator-size);top:var(--ngs-avatar-presence-indicator-position-top);inset-inline-end:var(--ngs-avatar-presence-indicator-position-end)}:host .presence-indicator.is-online{background:var(--ngs-avatar-presence-indicator-online-bg)}:host .presence-indicator.is-offline{background:var(--ngs-avatar-presence-indicator-offline-bg)}:host .presence-indicator.is-away{background:var(--ngs-avatar-presence-indicator-away-bg)}:host ::ng-deep .ngs-icon{display:flex;align-items:center;justify-content:center}:host.has-automatic-color{--ngs-avatar-border-color: var(--ngs-avatar-border-color-auto, transparent)}:host.has-generated-avatar{--ngs-avatar-bg: transparent}:host.has-generated-avatar:not([class*=shadow-]){box-shadow:var(--ngs-avatar-inner-border)}\n/*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */\n"] }]
444
+ }], propDecorators: { image: [{ type: i0.Input, args: [{ isSignal: true, alias: "image", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], clickable: [{ type: i0.Input, args: [{ isSignal: true, alias: "clickable", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], key: [{ type: i0.Input, args: [{ isSignal: true, alias: "key", required: false }] }], appearance: [{ type: i0.Input, args: [{ isSignal: true, alias: "appearance", required: false }] }], backgroundColors: [{ type: i0.Input, args: [{ isSignal: true, alias: "backgroundColors", required: false }] }], foregroundColors: [{ type: i0.Input, args: [{ isSignal: true, alias: "foregroundColors", required: false }] }], alt: [{ type: i0.Input, args: [{ isSignal: true, alias: "alt", required: false }] }], automaticColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "automaticColor", required: false }] }], presenceIndicator: [{ type: i0.Input, args: [{ isSignal: true, alias: "presenceIndicator", required: false }] }] } });
125
445
 
126
446
  class AvatarGroup {
127
447
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: AvatarGroup, deps: [], target: i0.ɵɵFactoryTarget.Component });
@@ -157,79 +477,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
157
477
  }, template: "<ng-content />\n", styles: [":host{--ngs-avatar-font-weight: 500;--ngs-avatar-size: calc(var(--spacing, .25rem) * 10);--ngs-avatar-border-radius: calc(infinity * 1px);--ngs-avatar-bg: var(--ngs-color-success);--ngs-avatar-color: white;--ngs-avatar-inner-border: inset 0 0 2px var(--ngs-color-border);--ngs-avatar-total-font-size: var(--ngs-font-size-xs);--ngs-avatar-total-font-weight: 500;--ngs-avatar-total-color: white;--ngs-avatar-total-bg: var(--ngs-color-neutral-700);--ngs-avatar-total-hover-bg: var(--ngs-color-neutral-600);background:var(--ngs-avatar-total-bg);font-size:var(--ngs-avatar-total-font-size);font-weight:var(--ngs-avatar-total-font-weight);color:var(--ngs-avatar-total-color);border-radius:var(--ngs-avatar-border-radius);flex:none;display:flex;align-items:center;justify-content:center}:host:hover{background:var(--ngs-avatar-total-hover-bg)}:host:not([class*=w-]):not([class*=size-]){width:var(--ngs-avatar-size)}:host:not([class*=h-]):not([class*=size-]){height:var(--ngs-avatar-size)}:host-context(html.dark){--ngs-avatar-group-item-border: .125rem solid var(--ngs-color-neutral-950);--ngs-avatar-presence-indicator-outline: var(--ngs-color-neutral-950) solid 2px}\n/*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */\n"] }]
158
478
  }] });
159
479
 
160
- const alreadyLoadedImages = [];
161
- const presets = {
162
- 'identicon': {
163
- style: identicon,
164
- options: {
165
- scale: 55,
166
- backgroundColor: ['cbebf7', 'ebe1fc', 'd1f9db', 'f7e4e7', 'fce8d4', 'dcfcf9']
167
- }
168
- },
169
- 'initials': {
170
- style: initials,
171
- options: {
172
- scale: 75,
173
- fontWeight: 500
174
- }
175
- }
176
- };
177
- class Dicebear {
178
- image = input('', ...(ngDevMode ? [{ debugName: "image" }] : /* istanbul ignore next */ []));
179
- clickable = input(false, { ...(ngDevMode ? { debugName: "clickable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
180
- key = input(...(ngDevMode ? [undefined, { debugName: "key" }] : /* istanbul ignore next */ []));
181
- preset = input('identicon', ...(ngDevMode ? [{ debugName: "preset" }] : /* istanbul ignore next */ []));
182
- alt = input(...(ngDevMode ? [undefined, { debugName: "alt" }] : /* istanbul ignore next */ []));
183
- presenceIndicator = input(null, ...(ngDevMode ? [{ debugName: "presenceIndicator" }] : /* istanbul ignore next */ []));
184
- imageLoaded;
185
- svg = '';
186
- ngOnInit() {
187
- if (this.image()) {
188
- this.imageLoaded = alreadyLoadedImages.includes(this.image());
189
- }
190
- const preset = presets[this.preset()];
191
- const avatar = createAvatar(preset.style, {
192
- seed: this.key() || '',
193
- ...preset.options
194
- });
195
- this.svg = avatar.toString().replace('viewboxMask', v7());
196
- }
197
- onImageLoaded() {
198
- if (this.imageLoaded) {
199
- return;
200
- }
201
- alreadyLoadedImages.push(this.image());
202
- this.imageLoaded = true;
203
- }
204
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: Dicebear, deps: [], target: i0.ɵɵFactoryTarget.Component });
205
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: Dicebear, isStandalone: true, selector: "ngs-dicebear,[ngs-dicebear]", inputs: { image: { classPropertyName: "image", publicName: "image", isSignal: true, isRequired: false, transformFunction: null }, clickable: { classPropertyName: "clickable", publicName: "clickable", isSignal: true, isRequired: false, transformFunction: null }, key: { classPropertyName: "key", publicName: "key", isSignal: true, isRequired: false, transformFunction: null }, preset: { classPropertyName: "preset", publicName: "preset", isSignal: true, isRequired: false, transformFunction: null }, alt: { classPropertyName: "alt", publicName: "alt", isSignal: true, isRequired: false, transformFunction: null }, presenceIndicator: { classPropertyName: "presenceIndicator", publicName: "presenceIndicator", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.is-clickable": "clickable()", "class.has-loaded-image": "image() && imageLoaded" }, classAttribute: "ngs-avatar ngs-dicebear" }, providers: [
206
- {
207
- provide: AVATAR_ACCESSOR,
208
- useExisting: forwardRef(() => Dicebear),
209
- multi: true
210
- }
211
- ], exportAs: ["ngsDicebear"], ngImport: i0, template: "@if (image()) {\n <img class=\"image\" loading=\"lazy\" [src]=\"image()\"\n [alt]=\"alt() || ''\" (load)=\"onImageLoaded()\">\n}\n\n@if (presenceIndicator()) {\n <div class=\"presence-indicator\"\n [class.is-online]=\"presenceIndicator() === 'online'\"\n [class.is-offline]=\"presenceIndicator() === 'offline'\"\n [class.is-away]=\"presenceIndicator() === 'away'\"></div>\n}\n\n@if (!image() && svg) {\n <div class=\"svg\" [innerHTML]=\"svg | safeHtml\"></div>\n}\n", styles: [":host{--ngs-avatar-font-weight: 500;--ngs-avatar-size: calc(var(--spacing, .25rem) * 10);--ngs-avatar-border-radius: calc(infinity * 1px);--ngs-avatar-bg: var(--ngs-color-surface-container-high);--ngs-avatar-color: var(--ngs-color-on-surface);--ngs-avatar-presence-indicator-size: 20%;--ngs-avatar-presence-indicator-position-top: 5%;--ngs-avatar-presence-indicator-position-end: 5%;--ngs-avatar-presence-indicator-online-bg: var(--ngs-color-success);--ngs-avatar-presence-indicator-offline-bg: var(--ngs-color-on-surface-variant);--ngs-avatar-presence-indicator-away-bg: var(--ngs-color-warning);--ngs-avatar-presence-indicator-outline: var(--ngs-color-surface) solid 2px;--ngs-avatar-inner-border: inset 0 0 2px var(--ngs-color-outline-variant);display:inline-flex;align-items:center;justify-content:center;-webkit-user-select:none;user-select:none;flex:none;text-transform:uppercase;position:relative;font-weight:var(--ngs-avatar-font-weight)}:host:not([class*=shadow-]){box-shadow:var(--ngs-avatar-inner-border)}:host .svg{overflow:hidden;border-radius:inherit;position:absolute;inset:0;z-index:0}:host:not([class*=rounded]),:host:not([class*=rounded]) .svg{border-radius:var(--ngs-avatar-border-radius)}:host:not([class*=w-]):not([class*=size-]){width:var(--ngs-avatar-size)}:host:not([class*=h-]):not([class*=size-]){height:var(--ngs-avatar-size)}:host.is-clickable{cursor:pointer}:host.is-hidden{display:none}:host.is-clickable:active{scale:.97}:host .image{display:inline;object-fit:cover;position:absolute;width:100%;height:100%;border-radius:inherit;z-index:1}:host .presence-indicator{position:absolute;z-index:1;outline:var(--ngs-avatar-presence-indicator-outline);border-radius:6.1875rem;width:var(--ngs-avatar-presence-indicator-size);height:var(--ngs-avatar-presence-indicator-size);top:var(--ngs-avatar-presence-indicator-position-top);inset-inline-end:var(--ngs-avatar-presence-indicator-position-end)}:host .presence-indicator.is-online{background:var(--ngs-avatar-presence-indicator-online-bg)}:host .presence-indicator.is-offline{background:var(--ngs-avatar-presence-indicator-offline-bg)}:host .presence-indicator.is-away{background:var(--ngs-avatar-presence-indicator-away-bg)}\n/*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ kind: "pipe", type: SafeHtmlPipe, name: "safeHtml" }] });
212
- }
213
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: Dicebear, decorators: [{
214
- type: Component,
215
- args: [{ selector: 'ngs-dicebear,[ngs-dicebear]', exportAs: 'ngsDicebear', providers: [
216
- {
217
- provide: AVATAR_ACCESSOR,
218
- useExisting: forwardRef(() => Dicebear),
219
- multi: true
220
- }
221
- ], imports: [
222
- SafeHtmlPipe,
223
- ], host: {
224
- 'class': 'ngs-avatar ngs-dicebear',
225
- '[class.is-clickable]': 'clickable()',
226
- '[class.has-loaded-image]': 'image() && imageLoaded',
227
- }, template: "@if (image()) {\n <img class=\"image\" loading=\"lazy\" [src]=\"image()\"\n [alt]=\"alt() || ''\" (load)=\"onImageLoaded()\">\n}\n\n@if (presenceIndicator()) {\n <div class=\"presence-indicator\"\n [class.is-online]=\"presenceIndicator() === 'online'\"\n [class.is-offline]=\"presenceIndicator() === 'offline'\"\n [class.is-away]=\"presenceIndicator() === 'away'\"></div>\n}\n\n@if (!image() && svg) {\n <div class=\"svg\" [innerHTML]=\"svg | safeHtml\"></div>\n}\n", styles: [":host{--ngs-avatar-font-weight: 500;--ngs-avatar-size: calc(var(--spacing, .25rem) * 10);--ngs-avatar-border-radius: calc(infinity * 1px);--ngs-avatar-bg: var(--ngs-color-surface-container-high);--ngs-avatar-color: var(--ngs-color-on-surface);--ngs-avatar-presence-indicator-size: 20%;--ngs-avatar-presence-indicator-position-top: 5%;--ngs-avatar-presence-indicator-position-end: 5%;--ngs-avatar-presence-indicator-online-bg: var(--ngs-color-success);--ngs-avatar-presence-indicator-offline-bg: var(--ngs-color-on-surface-variant);--ngs-avatar-presence-indicator-away-bg: var(--ngs-color-warning);--ngs-avatar-presence-indicator-outline: var(--ngs-color-surface) solid 2px;--ngs-avatar-inner-border: inset 0 0 2px var(--ngs-color-outline-variant);display:inline-flex;align-items:center;justify-content:center;-webkit-user-select:none;user-select:none;flex:none;text-transform:uppercase;position:relative;font-weight:var(--ngs-avatar-font-weight)}:host:not([class*=shadow-]){box-shadow:var(--ngs-avatar-inner-border)}:host .svg{overflow:hidden;border-radius:inherit;position:absolute;inset:0;z-index:0}:host:not([class*=rounded]),:host:not([class*=rounded]) .svg{border-radius:var(--ngs-avatar-border-radius)}:host:not([class*=w-]):not([class*=size-]){width:var(--ngs-avatar-size)}:host:not([class*=h-]):not([class*=size-]){height:var(--ngs-avatar-size)}:host.is-clickable{cursor:pointer}:host.is-hidden{display:none}:host.is-clickable:active{scale:.97}:host .image{display:inline;object-fit:cover;position:absolute;width:100%;height:100%;border-radius:inherit;z-index:1}:host .presence-indicator{position:absolute;z-index:1;outline:var(--ngs-avatar-presence-indicator-outline);border-radius:6.1875rem;width:var(--ngs-avatar-presence-indicator-size);height:var(--ngs-avatar-presence-indicator-size);top:var(--ngs-avatar-presence-indicator-position-top);inset-inline-end:var(--ngs-avatar-presence-indicator-position-end)}:host .presence-indicator.is-online{background:var(--ngs-avatar-presence-indicator-online-bg)}:host .presence-indicator.is-offline{background:var(--ngs-avatar-presence-indicator-offline-bg)}:host .presence-indicator.is-away{background:var(--ngs-avatar-presence-indicator-away-bg)}\n/*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */\n"] }]
228
- }], propDecorators: { image: [{ type: i0.Input, args: [{ isSignal: true, alias: "image", required: false }] }], clickable: [{ type: i0.Input, args: [{ isSignal: true, alias: "clickable", required: false }] }], key: [{ type: i0.Input, args: [{ isSignal: true, alias: "key", required: false }] }], preset: [{ type: i0.Input, args: [{ isSignal: true, alias: "preset", required: false }] }], alt: [{ type: i0.Input, args: [{ isSignal: true, alias: "alt", required: false }] }], presenceIndicator: [{ type: i0.Input, args: [{ isSignal: true, alias: "presenceIndicator", required: false }] }] } });
229
-
230
480
  /**
231
481
  * Generated bundle index. Do not edit.
232
482
  */
233
483
 
234
- export { AVATAR_ACCESSOR, Avatar, AvatarGroup, AvatarMore, AvatarTotal, Dicebear };
484
+ export { AVATAR_ACCESSOR, AVATAR_CONFIG, Avatar, AvatarGroup, AvatarMore, AvatarTotal, provideAvatar };
235
485
  //# sourceMappingURL=ngstarter-ui-components-avatar.mjs.map