@blueprint-platform/components 0.2.1 → 0.2.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.
|
@@ -1,28 +1,32 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Directive, input } from '@angular/core';
|
|
2
2
|
import { BrnAvatar } from '@spartan-ng/brain/avatar';
|
|
3
3
|
import { classes } from '@blueprint-platform/ui/utils';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
/**
|
|
6
|
+
* A plain `@Directive` composing `BrnAvatar` via `hostDirectives`, not
|
|
7
|
+
* `extends` — `@spartan-ng/brain@1.9.0` moved `BrnAvatarImage`/`BrnAvatarFallback`
|
|
8
|
+
* to `inject(BrnAvatar)` for shared load-status state, which only resolves if
|
|
9
|
+
* `BrnAvatar` is actually registered as a directive on this host (what
|
|
10
|
+
* `hostDirectives` does); plain class inheritance never provided it, causing
|
|
11
|
+
* a real runtime NG0201 even though it type-checked and built cleanly. No
|
|
12
|
+
* template here either — upstream dropped the old `@if (status() ===
|
|
13
|
+
* 'loaded')`-conditional `<ng-content>` switch; image/fallback are always
|
|
14
|
+
* both present in the caller's markup now and self-hide via their own
|
|
15
|
+
* `[style.visibility]` host bindings, so this directive has nothing to render.
|
|
16
|
+
*/
|
|
17
|
+
@Directive({
|
|
18
|
+
selector: '[hlmAvatar],hlm-avatar',
|
|
19
|
+
exportAs: 'hlmAvatar',
|
|
20
|
+
hostDirectives: [BrnAvatar],
|
|
8
21
|
host: {
|
|
9
22
|
'data-slot': 'avatar',
|
|
10
23
|
'[attr.data-size]': 'size()',
|
|
11
24
|
},
|
|
12
|
-
template: `
|
|
13
|
-
@if (status() === 'loaded') {
|
|
14
|
-
<ng-content select="[hlmAvatarImage],[brnAvatarImage]" />
|
|
15
|
-
} @else {
|
|
16
|
-
<ng-content select="[hlmAvatarFallback],[brnAvatarFallback]" />
|
|
17
|
-
}
|
|
18
|
-
<ng-content />
|
|
19
|
-
`,
|
|
20
25
|
})
|
|
21
|
-
export class HlmAvatar
|
|
26
|
+
export class HlmAvatar {
|
|
22
27
|
public readonly size = input<'default' | 'sm' | 'lg'>('default');
|
|
23
28
|
|
|
24
29
|
constructor() {
|
|
25
|
-
super();
|
|
26
30
|
classes(
|
|
27
31
|
() =>
|
|
28
32
|
'size-8 rounded-full after:rounded-full data-[size=lg]:size-10 data-[size=sm]:size-6 group/avatar after:border-border relative flex shrink-0 select-none after:absolute after:inset-0 after:border after:mix-blend-darken dark:after:mix-blend-lighten',
|