@molecule/app-avatar-stack-angular 0.0.1-stage → 1.2.0
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/README.md +122 -7
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +22 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/user-chip.component.d.ts +27 -4
- package/dist/user-chip.component.d.ts.map +1 -1
- package/dist/user-chip.component.js +146 -30
- package/dist/user-chip.component.js.map +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
|
3
3
|
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
4
|
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
5
|
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
-
Generated: 2026-11-
|
|
6
|
+
Generated: 2026-11-17T00:56:33.937Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-avatar-stack-angular
|
|
@@ -39,6 +39,13 @@ import { AvatarStack, UserChip } from '@molecule/app-avatar-stack-angular'
|
|
|
39
39
|
<div mol-user-chip name="Alice Kim" src="/avatars/alice.jpg">
|
|
40
40
|
<span slot="subtitle">Admin</span>
|
|
41
41
|
</div>
|
|
42
|
+
<div
|
|
43
|
+
mol-user-chip
|
|
44
|
+
name="Alice Kim"
|
|
45
|
+
href="/people/alice"
|
|
46
|
+
data-person="alice"
|
|
47
|
+
[nameLinkProps]="{ className: 'person-name', target: '_blank', rel: 'noreferrer' }"
|
|
48
|
+
></div>
|
|
42
49
|
`,
|
|
43
50
|
})
|
|
44
51
|
export class Assignees {
|
|
@@ -110,6 +117,10 @@ so they are typed `unknown`: pass them in the host template, projected as
|
|
|
110
117
|
interface UserChipProps {
|
|
111
118
|
/** Display name. */
|
|
112
119
|
name: string
|
|
120
|
+
/** Profile destination. Only the displayed name becomes a link. */
|
|
121
|
+
href?: string
|
|
122
|
+
/** Attributes and events for the canonical name link. */
|
|
123
|
+
nameLinkProps?: UserChipNameLinkProps
|
|
113
124
|
/** Optional avatar image URL. */
|
|
114
125
|
src?: string
|
|
115
126
|
/** Optional secondary line (role / email / handle), projected as `[slot=subtitle]` content. */
|
|
@@ -244,21 +255,27 @@ no span at all for an absent or empty subtitle.
|
|
|
244
255
|
selector: 'div[mol-user-chip]',
|
|
245
256
|
standalone: true,
|
|
246
257
|
imports: [Avatar],
|
|
247
|
-
inputs: ['name', 'src', 'subtitle', 'trailing', 'size', 'className'],
|
|
258
|
+
inputs: ['name', 'href', 'nameLinkProps', 'src', 'subtitle', 'trailing', 'size', 'className'],
|
|
248
259
|
host: {
|
|
249
260
|
'[class]': 'classes()',
|
|
250
261
|
},
|
|
251
262
|
// prettier-ignore
|
|
252
|
-
template:
|
|
263
|
+
template: `@if (href === undefined) {<div mol-avatar [src]="src" [alt]="name" [name]="name" [size]="avatarSize()"></div>}
|
|
264
|
+
@else {<div aria-hidden="true"><div mol-avatar [src]="src" [alt]="name" [name]="name" [size]="avatarSize()"></div></div>}
|
|
253
265
|
<div [class]="bodyClasses()">
|
|
254
|
-
<span [class]="nameClasses()">{{ name }}</span>
|
|
266
|
+
@if (href === undefined) {<span [class]="nameClasses()">{{ name }}</span>}
|
|
267
|
+
@else {<a #nameLink data-mol-id="user-chip-profile" [href]="href" [class]="nameClasses(true)" [attr.style]="nameLinkStyle()">{{ name }}</a>}
|
|
255
268
|
@if (showSubtitle()) {<span #subtitleEl [class]="cm().textSize('xs')">@if (hasTextSubtitle()) {<ng-container>{{ subtitle }}</ng-container>}<ng-content select="[slot=subtitle]"></ng-content></span>}
|
|
256
269
|
</div>
|
|
257
270
|
<ng-content select="[slot=trailing]"></ng-content>`,
|
|
258
271
|
})
|
|
259
|
-
export class UserChip implements AfterViewInit {
|
|
272
|
+
export class UserChip implements AfterViewInit, AfterViewChecked, OnDestroy {
|
|
260
273
|
/** Display name. */
|
|
261
274
|
name = ''
|
|
275
|
+
/** Profile destination. The avatar stays outside the single name link. */
|
|
276
|
+
href?: string
|
|
277
|
+
/** Attributes, classes and event handlers for the canonical name link. */
|
|
278
|
+
nameLinkProps?: UserChipProps['nameLinkProps']
|
|
262
279
|
/** Optional avatar image URL. */
|
|
263
280
|
src?: string
|
|
264
281
|
/** Optional secondary line: text, or `[slot=subtitle]` content. */
|
|
@@ -273,6 +290,14 @@ export class UserChip implements AfterViewInit {
|
|
|
273
290
|
/** The optimistic subtitle span (projected content lands here). */
|
|
274
291
|
@ViewChild('subtitleEl') private subtitleEl?: ElementRef<HTMLSpanElement>
|
|
275
292
|
|
|
293
|
+
/** The name anchor, present only while href is defined. */
|
|
294
|
+
@ViewChild('nameLink') private nameLink?: ElementRef<HTMLAnchorElement>
|
|
295
|
+
|
|
296
|
+
private readonly renderer = inject(Renderer2)
|
|
297
|
+
private renderedNameLink?: HTMLAnchorElement
|
|
298
|
+
private appliedNameLinkProps = new Map<string, unknown>()
|
|
299
|
+
private readonly nameLinkListeners = new Map<string, () => void>()
|
|
300
|
+
|
|
276
301
|
/** Whether the subtitle span renders (withdrawn when nothing fills it). */
|
|
277
302
|
private readonly subtitleProjected = signal(true)
|
|
278
303
|
|
|
@@ -331,10 +356,92 @@ export class UserChip implements AfterViewInit {
|
|
|
331
356
|
/**
|
|
332
357
|
* Computes the name span's class list (`cm.textSize('sm')` +
|
|
333
358
|
* `cm.fontWeight('medium')`).
|
|
359
|
+
* @param linked - Whether to include the name-link classes.
|
|
334
360
|
* @returns The class string.
|
|
335
361
|
*/
|
|
336
|
-
nameClasses(): string {
|
|
337
|
-
return this.cm().cn(
|
|
362
|
+
nameClasses(linked = false): string {
|
|
363
|
+
return this.cm().cn(
|
|
364
|
+
this.cm().textSize('sm'),
|
|
365
|
+
this.cm().fontWeight('medium'),
|
|
366
|
+
linked && this.nameLinkProps?.className,
|
|
367
|
+
linked && this.nameLinkProps?.class,
|
|
368
|
+
)
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* Serializes the link's inline style with the shared React-compatible utility.
|
|
373
|
+
* @returns The style attribute, or null when absent.
|
|
374
|
+
*/
|
|
375
|
+
nameLinkStyle(): string | null {
|
|
376
|
+
return styleText(this.nameLinkProps?.style)
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
/** Applies the link attribute input to the anchor, including changes and removals. */
|
|
380
|
+
ngAfterViewChecked(): void {
|
|
381
|
+
const link = this.nameLink?.nativeElement
|
|
382
|
+
if (link !== this.renderedNameLink) {
|
|
383
|
+
this.clearNameLinkListeners()
|
|
384
|
+
this.appliedNameLinkProps.clear()
|
|
385
|
+
this.renderedNameLink = link
|
|
386
|
+
}
|
|
387
|
+
if (!link) return
|
|
388
|
+
|
|
389
|
+
const next = new Map<string, unknown>(
|
|
390
|
+
Object.entries({ 'data-mol-id': 'user-chip-profile', ...this.nameLinkProps }),
|
|
391
|
+
)
|
|
392
|
+
// These are owned by the template: href and children cannot replace the profile/name.
|
|
393
|
+
for (const key of [
|
|
394
|
+
'className',
|
|
395
|
+
'class',
|
|
396
|
+
'href',
|
|
397
|
+
'children',
|
|
398
|
+
'innerHTML',
|
|
399
|
+
'textContent',
|
|
400
|
+
'style',
|
|
401
|
+
])
|
|
402
|
+
next.delete(key)
|
|
403
|
+
for (const key of new Set([...this.appliedNameLinkProps.keys(), ...next.keys()])) {
|
|
404
|
+
const value = next.get(key)
|
|
405
|
+
if (this.appliedNameLinkProps.has(key) && this.appliedNameLinkProps.get(key) === value)
|
|
406
|
+
continue
|
|
407
|
+
this.nameLinkListeners.get(key)?.()
|
|
408
|
+
this.nameLinkListeners.delete(key)
|
|
409
|
+
if (/^on[A-Z]/.test(key)) {
|
|
410
|
+
if (typeof value === 'function') {
|
|
411
|
+
const capture = key.endsWith('Capture')
|
|
412
|
+
const event = key.slice(2, capture ? -7 : undefined).toLowerCase()
|
|
413
|
+
this.nameLinkListeners.set(
|
|
414
|
+
key,
|
|
415
|
+
this.renderer.listen(
|
|
416
|
+
link,
|
|
417
|
+
event === 'doubleclick' ? 'dblclick' : event,
|
|
418
|
+
(event: Event) => {
|
|
419
|
+
value(event)
|
|
420
|
+
},
|
|
421
|
+
{ capture },
|
|
422
|
+
),
|
|
423
|
+
)
|
|
424
|
+
}
|
|
425
|
+
} else if (!key.startsWith('on')) {
|
|
426
|
+
const textBoolean = /^(aria-|data-)|^(contentEditable|draggable|spellCheck)$/.test(key)
|
|
427
|
+
if (value == null || (value === false && !textBoolean))
|
|
428
|
+
this.renderer.removeAttribute(link, key)
|
|
429
|
+
else
|
|
430
|
+
this.renderer.setAttribute(link, key, value === true && !textBoolean ? '' : String(value))
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
this.appliedNameLinkProps = next
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
/** Removes link listeners when the chip unmounts. */
|
|
437
|
+
ngOnDestroy(): void {
|
|
438
|
+
this.clearNameLinkListeners()
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
/** Removes listeners when the anchor is replaced or the chip unmounts. */
|
|
442
|
+
private clearNameLinkListeners(): void {
|
|
443
|
+
for (const remove of this.nameLinkListeners.values()) remove()
|
|
444
|
+
this.nameLinkListeners.clear()
|
|
338
445
|
}
|
|
339
446
|
|
|
340
447
|
/**
|
|
@@ -374,6 +481,14 @@ Peer dependencies:
|
|
|
374
481
|
- `@molecule/app-ui`
|
|
375
482
|
- `@molecule/app-ui-angular`
|
|
376
483
|
|
|
484
|
+
`UserChip` with `href` renders one profile link on the displayed name, with
|
|
485
|
+
a decorative avatar outside it. Subtitle and trailing projections remain outside
|
|
486
|
+
the link. The `nameLinkProps` input forwards anchor attributes and events
|
|
487
|
+
(including `onClick` for app routing); `className` or `class` adds link classes.
|
|
488
|
+
The host div is the root: bind ordinary attributes and events directly on it.
|
|
489
|
+
Without `href`, the plain avatar/name DOM is unchanged and `nameLinkProps`
|
|
490
|
+
is ignored. An empty-string `href` still renders a link.
|
|
491
|
+
|
|
377
492
|
The overflow chip announces "+N more" — this is the only user-visible
|
|
378
493
|
text (currently English-only). Avatar fallbacks (initials, color hash)
|
|
379
494
|
come from `<div mol-avatar>` in `@molecule/app-ui-angular`. The overlap is
|
package/dist/index.d.ts
CHANGED
|
@@ -24,6 +24,9 @@
|
|
|
24
24
|
* <div mol-user-chip name="Alice Kim" src="/avatars/alice.jpg">
|
|
25
25
|
* <span slot="subtitle">Admin</span>
|
|
26
26
|
* </div>
|
|
27
|
+
* <div mol-user-chip name="Alice Kim" href="/people/alice" data-person="alice"
|
|
28
|
+
* [nameLinkProps]="{ className: 'person-name', target: '_blank', rel: 'noreferrer' }">
|
|
29
|
+
* </div>
|
|
27
30
|
* `,
|
|
28
31
|
* })
|
|
29
32
|
* export class Assignees {
|
|
@@ -36,6 +39,14 @@
|
|
|
36
39
|
* ```
|
|
37
40
|
*
|
|
38
41
|
* @remarks
|
|
42
|
+
* `UserChip` with `href` renders one profile link on the displayed name, with
|
|
43
|
+
* a decorative avatar outside it. Subtitle and trailing projections remain outside
|
|
44
|
+
* the link. The `nameLinkProps` input forwards anchor attributes and events
|
|
45
|
+
* (including `onClick` for app routing); `className` or `class` adds link classes.
|
|
46
|
+
* The host div is the root: bind ordinary attributes and events directly on it.
|
|
47
|
+
* Without `href`, the plain avatar/name DOM is unchanged and `nameLinkProps`
|
|
48
|
+
* is ignored. An empty-string `href` still renders a link.
|
|
49
|
+
*
|
|
39
50
|
* The overflow chip announces "+N more" — this is the only user-visible
|
|
40
51
|
* text (currently English-only). Avatar fallbacks (initials, color hash)
|
|
41
52
|
* come from `<div mol-avatar>` in `@molecule/app-ui-angular`. The overlap is
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AAEH,cAAc,6BAA6B,CAAA;AAC3C,cAAc,YAAY,CAAA;AAC1B,cAAc,0BAA0B,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -24,6 +24,9 @@
|
|
|
24
24
|
* <div mol-user-chip name="Alice Kim" src="/avatars/alice.jpg">
|
|
25
25
|
* <span slot="subtitle">Admin</span>
|
|
26
26
|
* </div>
|
|
27
|
+
* <div mol-user-chip name="Alice Kim" href="/people/alice" data-person="alice"
|
|
28
|
+
* [nameLinkProps]="{ className: 'person-name', target: '_blank', rel: 'noreferrer' }">
|
|
29
|
+
* </div>
|
|
27
30
|
* `,
|
|
28
31
|
* })
|
|
29
32
|
* export class Assignees {
|
|
@@ -36,6 +39,14 @@
|
|
|
36
39
|
* ```
|
|
37
40
|
*
|
|
38
41
|
* @remarks
|
|
42
|
+
* `UserChip` with `href` renders one profile link on the displayed name, with
|
|
43
|
+
* a decorative avatar outside it. Subtitle and trailing projections remain outside
|
|
44
|
+
* the link. The `nameLinkProps` input forwards anchor attributes and events
|
|
45
|
+
* (including `onClick` for app routing); `className` or `class` adds link classes.
|
|
46
|
+
* The host div is the root: bind ordinary attributes and events directly on it.
|
|
47
|
+
* Without `href`, the plain avatar/name DOM is unchanged and `nameLinkProps`
|
|
48
|
+
* is ignored. An empty-string `href` still renders a link.
|
|
49
|
+
*
|
|
39
50
|
* The overflow chip announces "+N more" — this is the only user-visible
|
|
40
51
|
* text (currently English-only). Avatar fallbacks (initials, color hash)
|
|
41
52
|
* come from `<div mol-avatar>` in `@molecule/app-ui-angular`. The overlap is
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AAEH,cAAc,6BAA6B,CAAA;AAC3C,cAAc,YAAY,CAAA;AAC1B,cAAc,0BAA0B,CAAA"}
|
package/dist/types.d.ts
CHANGED
|
@@ -28,6 +28,23 @@ export interface AvatarStackProps {
|
|
|
28
28
|
/** Extra classes on the outer stack. */
|
|
29
29
|
className?: string;
|
|
30
30
|
}
|
|
31
|
+
/** Attributes for the canonical UserChip name link; other native attributes are accepted by name. */
|
|
32
|
+
interface UserChipNameLinkProps {
|
|
33
|
+
/** Extra name-link classes. */
|
|
34
|
+
className?: string;
|
|
35
|
+
/** Extra name-link classes (the native HTML spelling). */
|
|
36
|
+
class?: string;
|
|
37
|
+
/** Browsing context for the profile destination. */
|
|
38
|
+
target?: string;
|
|
39
|
+
/** Relationship to the profile destination. */
|
|
40
|
+
rel?: string;
|
|
41
|
+
/** App router or click handler; receives the native link event. */
|
|
42
|
+
onClick?: (event: MouseEvent) => void;
|
|
43
|
+
/** React-style inline style values. */
|
|
44
|
+
style?: Record<string, string | number | undefined | null>;
|
|
45
|
+
/** Additional native attributes and event handlers, using `onClick`-style event names. */
|
|
46
|
+
[attribute: string]: unknown;
|
|
47
|
+
}
|
|
31
48
|
/**
|
|
32
49
|
* Props accepted by {@link UserChip} — the same props
|
|
33
50
|
* `@molecule/app-avatar-stack-react` accepts. Node props (`subtitle`,
|
|
@@ -38,6 +55,10 @@ export interface AvatarStackProps {
|
|
|
38
55
|
export interface UserChipProps {
|
|
39
56
|
/** Display name. */
|
|
40
57
|
name: string;
|
|
58
|
+
/** Profile destination. Only the displayed name becomes a link. */
|
|
59
|
+
href?: string;
|
|
60
|
+
/** Attributes and events for the canonical name link. */
|
|
61
|
+
nameLinkProps?: UserChipNameLinkProps;
|
|
41
62
|
/** Optional avatar image URL. */
|
|
42
63
|
src?: string;
|
|
43
64
|
/** Optional secondary line (role / email / handle), projected as `[slot=subtitle]` content. */
|
|
@@ -49,4 +70,5 @@ export interface UserChipProps {
|
|
|
49
70
|
/** Extra classes on the outer row. */
|
|
50
71
|
className?: string;
|
|
51
72
|
}
|
|
73
|
+
export {};
|
|
52
74
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,uEAAuE;AACvE,MAAM,WAAW,iBAAiB;IAChC,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAA;IACZ,iCAAiC;IACjC,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,8CAA8C;IAC9C,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,wBAAwB;IACxB,MAAM,EAAE,iBAAiB,EAAE,CAAA;IAC3B,+EAA+E;IAC/E,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,0BAA0B;IAC1B,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;IAChC,wCAAwC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,oBAAoB;IACpB,IAAI,EAAE,MAAM,CAAA;IACZ,iCAAiC;IACjC,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,+FAA+F;IAC/F,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,2GAA2G;IAC3G,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,0BAA0B;IAC1B,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;IAChC,sCAAsC;IACtC,SAAS,CAAC,EAAE,MAAM,CAA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,yDAAyD;IACzD,aAAa,CAAC,EAAE,qBAAqB,CAAA;IACrC,iCAAiC;IACjC,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,+FAA+F;IAC/F,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,2GAA2G;IAC3G,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,0BAA0B;IAC1B,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;IAChC,sCAAsC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB"}
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
-
import { type AfterViewInit } from '@angular/core';
|
|
6
|
+
import { type AfterViewChecked, type AfterViewInit, type OnDestroy } from '@angular/core';
|
|
7
7
|
import type { UIClassMap } from '@molecule/app-ui';
|
|
8
|
+
import type { UserChipProps } from './types.js';
|
|
8
9
|
import * as i0 from "@angular/core";
|
|
9
10
|
/**
|
|
10
11
|
* UserChip component.
|
|
@@ -18,9 +19,13 @@ import * as i0 from "@angular/core";
|
|
|
18
19
|
* init when neither a text input nor a projection is present — React renders
|
|
19
20
|
* no span at all for an absent or empty subtitle.
|
|
20
21
|
*/
|
|
21
|
-
export declare class UserChip implements AfterViewInit {
|
|
22
|
+
export declare class UserChip implements AfterViewInit, AfterViewChecked, OnDestroy {
|
|
22
23
|
/** Display name. */
|
|
23
24
|
name: string;
|
|
25
|
+
/** Profile destination. The avatar stays outside the single name link. */
|
|
26
|
+
href?: string;
|
|
27
|
+
/** Attributes, classes and event handlers for the canonical name link. */
|
|
28
|
+
nameLinkProps?: UserChipProps['nameLinkProps'];
|
|
24
29
|
/** Optional avatar image URL. */
|
|
25
30
|
src?: string;
|
|
26
31
|
/** Optional secondary line: text, or `[slot=subtitle]` content. */
|
|
@@ -33,6 +38,12 @@ export declare class UserChip implements AfterViewInit {
|
|
|
33
38
|
className?: string;
|
|
34
39
|
/** The optimistic subtitle span (projected content lands here). */
|
|
35
40
|
private subtitleEl?;
|
|
41
|
+
/** The name anchor, present only while href is defined. */
|
|
42
|
+
private nameLink?;
|
|
43
|
+
private readonly renderer;
|
|
44
|
+
private renderedNameLink?;
|
|
45
|
+
private appliedNameLinkProps;
|
|
46
|
+
private readonly nameLinkListeners;
|
|
36
47
|
/** Whether the subtitle span renders (withdrawn when nothing fills it). */
|
|
37
48
|
private readonly subtitleProjected;
|
|
38
49
|
/**
|
|
@@ -72,9 +83,21 @@ export declare class UserChip implements AfterViewInit {
|
|
|
72
83
|
/**
|
|
73
84
|
* Computes the name span's class list (`cm.textSize('sm')` +
|
|
74
85
|
* `cm.fontWeight('medium')`).
|
|
86
|
+
* @param linked - Whether to include the name-link classes.
|
|
75
87
|
* @returns The class string.
|
|
76
88
|
*/
|
|
77
|
-
nameClasses(): string;
|
|
89
|
+
nameClasses(linked?: boolean): string;
|
|
90
|
+
/**
|
|
91
|
+
* Serializes the link's inline style with the shared React-compatible utility.
|
|
92
|
+
* @returns The style attribute, or null when absent.
|
|
93
|
+
*/
|
|
94
|
+
nameLinkStyle(): string | null;
|
|
95
|
+
/** Applies the link attribute input to the anchor, including changes and removals. */
|
|
96
|
+
ngAfterViewChecked(): void;
|
|
97
|
+
/** Removes link listeners when the chip unmounts. */
|
|
98
|
+
ngOnDestroy(): void;
|
|
99
|
+
/** Removes listeners when the anchor is replaced or the chip unmounts. */
|
|
100
|
+
private clearNameLinkListeners;
|
|
78
101
|
/**
|
|
79
102
|
* Withdraws the optimistic subtitle span when its slot projection did not
|
|
80
103
|
* land: when neither a text input nor projected content is present, React
|
|
@@ -83,6 +106,6 @@ export declare class UserChip implements AfterViewInit {
|
|
|
83
106
|
*/
|
|
84
107
|
ngAfterViewInit(): void;
|
|
85
108
|
static ɵfac: i0.ɵɵFactoryDeclaration<UserChip, never>;
|
|
86
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<UserChip, "div[mol-user-chip]", never, { "name": { "alias": "name"; "required": false; }; "src": { "alias": "src"; "required": false; }; "subtitle": { "alias": "subtitle"; "required": false; }; "trailing": { "alias": "trailing"; "required": false; }; "size": { "alias": "size"; "required": false; }; "className": { "alias": "className"; "required": false; }; }, {}, never, ["[slot=subtitle]", "[slot=trailing]"], true, never>;
|
|
109
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<UserChip, "div[mol-user-chip]", never, { "name": { "alias": "name"; "required": false; }; "href": { "alias": "href"; "required": false; }; "nameLinkProps": { "alias": "nameLinkProps"; "required": false; }; "src": { "alias": "src"; "required": false; }; "subtitle": { "alias": "subtitle"; "required": false; }; "trailing": { "alias": "trailing"; "required": false; }; "size": { "alias": "size"; "required": false; }; "className": { "alias": "className"; "required": false; }; }, {}, never, ["[slot=subtitle]", "[slot=trailing]"], true, never>;
|
|
87
110
|
}
|
|
88
111
|
//# sourceMappingURL=user-chip.component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-chip.component.d.ts","sourceRoot":"","sources":["../src/user-chip.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"user-chip.component.d.ts","sourceRoot":"","sources":["../src/user-chip.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAIlB,KAAK,SAAS,EAIf,MAAM,eAAe,CAAA;AAEtB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAIlD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;;AAE/C;;;;;;;;;;;GAWG;AACH,qBAkBa,QAAS,YAAW,aAAa,EAAE,gBAAgB,EAAE,SAAS;IACzE,oBAAoB;IACpB,IAAI,SAAK;IACT,0EAA0E;IAC1E,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,0EAA0E;IAC1E,aAAa,CAAC,EAAE,aAAa,CAAC,eAAe,CAAC,CA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-3,14 +3,52 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
-
import { Component, signal, ViewChild } from '@angular/core';
|
|
6
|
+
import { Component, inject, Renderer2, signal, ViewChild, } from '@angular/core';
|
|
7
7
|
import { getClassMap } from '@molecule/app-ui';
|
|
8
|
-
import { Avatar, hasNodes } from '@molecule/app-ui-angular';
|
|
8
|
+
import { Avatar, hasNodes, styleText } from '@molecule/app-ui-angular';
|
|
9
9
|
import * as i0 from "@angular/core";
|
|
10
10
|
const _c0 = ["subtitleEl"];
|
|
11
|
-
const _c1 = [
|
|
12
|
-
const _c2 = ["
|
|
13
|
-
|
|
11
|
+
const _c1 = ["nameLink"];
|
|
12
|
+
const _c2 = [[["", "slot", "trailing"]], [["", "slot", "subtitle"]]];
|
|
13
|
+
const _c3 = ["[slot=trailing]", "[slot=subtitle]"];
|
|
14
|
+
function UserChip_Conditional_0_Template(rf, ctx) { if (rf & 1) {
|
|
15
|
+
i0.ɵɵelement(0, "div", 2);
|
|
16
|
+
} if (rf & 2) {
|
|
17
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
18
|
+
i0.ɵɵproperty("src", ctx_r0.src)("alt", ctx_r0.name)("name", ctx_r0.name)("size", ctx_r0.avatarSize());
|
|
19
|
+
} }
|
|
20
|
+
function UserChip_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
21
|
+
i0.ɵɵelementStart(0, "div", 3);
|
|
22
|
+
i0.ɵɵelement(1, "div", 2);
|
|
23
|
+
i0.ɵɵelementEnd();
|
|
24
|
+
} if (rf & 2) {
|
|
25
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
26
|
+
i0.ɵɵadvance();
|
|
27
|
+
i0.ɵɵproperty("src", ctx_r0.src)("alt", ctx_r0.name)("name", ctx_r0.name)("size", ctx_r0.avatarSize());
|
|
28
|
+
} }
|
|
29
|
+
function UserChip_Conditional_3_Template(rf, ctx) { if (rf & 1) {
|
|
30
|
+
i0.ɵɵelementStart(0, "span");
|
|
31
|
+
i0.ɵɵtext(1);
|
|
32
|
+
i0.ɵɵelementEnd();
|
|
33
|
+
} if (rf & 2) {
|
|
34
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
35
|
+
i0.ɵɵclassMap(ctx_r0.nameClasses());
|
|
36
|
+
i0.ɵɵadvance();
|
|
37
|
+
i0.ɵɵtextInterpolate(ctx_r0.name);
|
|
38
|
+
} }
|
|
39
|
+
function UserChip_Conditional_4_Template(rf, ctx) { if (rf & 1) {
|
|
40
|
+
i0.ɵɵelementStart(0, "a", 6, 0);
|
|
41
|
+
i0.ɵɵtext(2);
|
|
42
|
+
i0.ɵɵelementEnd();
|
|
43
|
+
} if (rf & 2) {
|
|
44
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
45
|
+
i0.ɵɵclassMap(ctx_r0.nameClasses(true));
|
|
46
|
+
i0.ɵɵproperty("href", ctx_r0.href, i0.ɵɵsanitizeUrl);
|
|
47
|
+
i0.ɵɵattribute("style", ctx_r0.nameLinkStyle(), i0.ɵɵsanitizeStyle);
|
|
48
|
+
i0.ɵɵadvance(2);
|
|
49
|
+
i0.ɵɵtextInterpolate(ctx_r0.name);
|
|
50
|
+
} }
|
|
51
|
+
function UserChip_Conditional_5_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
14
52
|
i0.ɵɵelementContainerStart(0);
|
|
15
53
|
i0.ɵɵtext(1);
|
|
16
54
|
i0.ɵɵelementContainerEnd();
|
|
@@ -19,9 +57,9 @@ function UserChip_Conditional_4_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
|
19
57
|
i0.ɵɵadvance();
|
|
20
58
|
i0.ɵɵtextInterpolate(ctx_r0.subtitle);
|
|
21
59
|
} }
|
|
22
|
-
function
|
|
23
|
-
i0.ɵɵelementStart(0, "span", null,
|
|
24
|
-
i0.ɵɵconditionalCreate(2,
|
|
60
|
+
function UserChip_Conditional_5_Template(rf, ctx) { if (rf & 1) {
|
|
61
|
+
i0.ɵɵelementStart(0, "span", null, 1);
|
|
62
|
+
i0.ɵɵconditionalCreate(2, UserChip_Conditional_5_Conditional_2_Template, 2, 1, "ng-container");
|
|
25
63
|
i0.ɵɵprojection(3, 1);
|
|
26
64
|
i0.ɵɵelementEnd();
|
|
27
65
|
} if (rf & 2) {
|
|
@@ -45,6 +83,10 @@ function UserChip_Conditional_4_Template(rf, ctx) { if (rf & 1) {
|
|
|
45
83
|
export class UserChip {
|
|
46
84
|
/** Display name. */
|
|
47
85
|
name = '';
|
|
86
|
+
/** Profile destination. The avatar stays outside the single name link. */
|
|
87
|
+
href;
|
|
88
|
+
/** Attributes, classes and event handlers for the canonical name link. */
|
|
89
|
+
nameLinkProps;
|
|
48
90
|
/** Optional avatar image URL. */
|
|
49
91
|
src;
|
|
50
92
|
/** Optional secondary line: text, or `[slot=subtitle]` content. */
|
|
@@ -57,6 +99,12 @@ export class UserChip {
|
|
|
57
99
|
className;
|
|
58
100
|
/** The optimistic subtitle span (projected content lands here). */
|
|
59
101
|
subtitleEl;
|
|
102
|
+
/** The name anchor, present only while href is defined. */
|
|
103
|
+
nameLink;
|
|
104
|
+
renderer = inject(Renderer2);
|
|
105
|
+
renderedNameLink;
|
|
106
|
+
appliedNameLinkProps = new Map();
|
|
107
|
+
nameLinkListeners = new Map();
|
|
60
108
|
/** Whether the subtitle span renders (withdrawn when nothing fills it). */
|
|
61
109
|
subtitleProjected = signal(true, /* @ts-ignore */
|
|
62
110
|
...(ngDevMode ? [{ debugName: "subtitleProjected" }] : /* istanbul ignore next */ []));
|
|
@@ -109,10 +157,75 @@ export class UserChip {
|
|
|
109
157
|
/**
|
|
110
158
|
* Computes the name span's class list (`cm.textSize('sm')` +
|
|
111
159
|
* `cm.fontWeight('medium')`).
|
|
160
|
+
* @param linked - Whether to include the name-link classes.
|
|
112
161
|
* @returns The class string.
|
|
113
162
|
*/
|
|
114
|
-
nameClasses() {
|
|
115
|
-
return this.cm().cn(this.cm().textSize('sm'), this.cm().fontWeight('medium'));
|
|
163
|
+
nameClasses(linked = false) {
|
|
164
|
+
return this.cm().cn(this.cm().textSize('sm'), this.cm().fontWeight('medium'), linked && this.nameLinkProps?.className, linked && this.nameLinkProps?.class);
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Serializes the link's inline style with the shared React-compatible utility.
|
|
168
|
+
* @returns The style attribute, or null when absent.
|
|
169
|
+
*/
|
|
170
|
+
nameLinkStyle() {
|
|
171
|
+
return styleText(this.nameLinkProps?.style);
|
|
172
|
+
}
|
|
173
|
+
/** Applies the link attribute input to the anchor, including changes and removals. */
|
|
174
|
+
ngAfterViewChecked() {
|
|
175
|
+
const link = this.nameLink?.nativeElement;
|
|
176
|
+
if (link !== this.renderedNameLink) {
|
|
177
|
+
this.clearNameLinkListeners();
|
|
178
|
+
this.appliedNameLinkProps.clear();
|
|
179
|
+
this.renderedNameLink = link;
|
|
180
|
+
}
|
|
181
|
+
if (!link)
|
|
182
|
+
return;
|
|
183
|
+
const next = new Map(Object.entries({ 'data-mol-id': 'user-chip-profile', ...this.nameLinkProps }));
|
|
184
|
+
// These are owned by the template: href and children cannot replace the profile/name.
|
|
185
|
+
for (const key of [
|
|
186
|
+
'className',
|
|
187
|
+
'class',
|
|
188
|
+
'href',
|
|
189
|
+
'children',
|
|
190
|
+
'innerHTML',
|
|
191
|
+
'textContent',
|
|
192
|
+
'style',
|
|
193
|
+
])
|
|
194
|
+
next.delete(key);
|
|
195
|
+
for (const key of new Set([...this.appliedNameLinkProps.keys(), ...next.keys()])) {
|
|
196
|
+
const value = next.get(key);
|
|
197
|
+
if (this.appliedNameLinkProps.has(key) && this.appliedNameLinkProps.get(key) === value)
|
|
198
|
+
continue;
|
|
199
|
+
this.nameLinkListeners.get(key)?.();
|
|
200
|
+
this.nameLinkListeners.delete(key);
|
|
201
|
+
if (/^on[A-Z]/.test(key)) {
|
|
202
|
+
if (typeof value === 'function') {
|
|
203
|
+
const capture = key.endsWith('Capture');
|
|
204
|
+
const event = key.slice(2, capture ? -7 : undefined).toLowerCase();
|
|
205
|
+
this.nameLinkListeners.set(key, this.renderer.listen(link, event === 'doubleclick' ? 'dblclick' : event, (event) => {
|
|
206
|
+
value(event);
|
|
207
|
+
}, { capture }));
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
else if (!key.startsWith('on')) {
|
|
211
|
+
const textBoolean = /^(aria-|data-)|^(contentEditable|draggable|spellCheck)$/.test(key);
|
|
212
|
+
if (value == null || (value === false && !textBoolean))
|
|
213
|
+
this.renderer.removeAttribute(link, key);
|
|
214
|
+
else
|
|
215
|
+
this.renderer.setAttribute(link, key, value === true && !textBoolean ? '' : String(value));
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
this.appliedNameLinkProps = next;
|
|
219
|
+
}
|
|
220
|
+
/** Removes link listeners when the chip unmounts. */
|
|
221
|
+
ngOnDestroy() {
|
|
222
|
+
this.clearNameLinkListeners();
|
|
223
|
+
}
|
|
224
|
+
/** Removes listeners when the anchor is replaced or the chip unmounts. */
|
|
225
|
+
clearNameLinkListeners() {
|
|
226
|
+
for (const remove of this.nameLinkListeners.values())
|
|
227
|
+
remove();
|
|
228
|
+
this.nameLinkListeners.clear();
|
|
116
229
|
}
|
|
117
230
|
/**
|
|
118
231
|
* Withdraws the optimistic subtitle span when its slot projection did not
|
|
@@ -128,31 +241,29 @@ export class UserChip {
|
|
|
128
241
|
}
|
|
129
242
|
static ɵfac = function UserChip_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || UserChip)(); };
|
|
130
243
|
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: UserChip, selectors: [["div", "mol-user-chip", ""]], viewQuery: function UserChip_Query(rf, ctx) { if (rf & 1) {
|
|
131
|
-
i0.ɵɵviewQuery(_c0, 5);
|
|
244
|
+
i0.ɵɵviewQuery(_c0, 5)(_c1, 5);
|
|
132
245
|
} if (rf & 2) {
|
|
133
246
|
let _t;
|
|
134
247
|
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.subtitleEl = _t.first);
|
|
248
|
+
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.nameLink = _t.first);
|
|
135
249
|
} }, hostVars: 2, hostBindings: function UserChip_HostBindings(rf, ctx) { if (rf & 2) {
|
|
136
250
|
i0.ɵɵclassMap(ctx.classes());
|
|
137
|
-
} }, inputs: { name: "name", src: "src", subtitle: "subtitle", trailing: "trailing", size: "size", className: "className" }, ngContentSelectors:
|
|
138
|
-
i0.ɵɵprojectionDef(
|
|
139
|
-
i0.ɵɵ
|
|
140
|
-
i0.ɵɵelementStart(
|
|
141
|
-
i0.ɵɵ
|
|
142
|
-
i0.ɵɵ
|
|
143
|
-
i0.ɵɵconditionalCreate(4, UserChip_Conditional_4_Template, 4, 3, "span", 2);
|
|
251
|
+
} }, inputs: { name: "name", href: "href", nameLinkProps: "nameLinkProps", src: "src", subtitle: "subtitle", trailing: "trailing", size: "size", className: "className" }, ngContentSelectors: _c3, decls: 7, vars: 5, consts: [["nameLink", ""], ["subtitleEl", ""], ["mol-avatar", "", 3, "src", "alt", "name", "size"], ["aria-hidden", "true"], [3, "class"], ["data-mol-id", "user-chip-profile", 3, "href", "class"], ["data-mol-id", "user-chip-profile", 3, "href"]], template: function UserChip_Template(rf, ctx) { if (rf & 1) {
|
|
252
|
+
i0.ɵɵprojectionDef(_c2);
|
|
253
|
+
i0.ɵɵconditionalCreate(0, UserChip_Conditional_0_Template, 1, 4, "div", 2)(1, UserChip_Conditional_1_Template, 2, 4, "div", 3);
|
|
254
|
+
i0.ɵɵelementStart(2, "div");
|
|
255
|
+
i0.ɵɵconditionalCreate(3, UserChip_Conditional_3_Template, 2, 3, "span", 4)(4, UserChip_Conditional_4_Template, 3, 5, "a", 5);
|
|
256
|
+
i0.ɵɵconditionalCreate(5, UserChip_Conditional_5_Template, 4, 3, "span", 4);
|
|
144
257
|
i0.ɵɵelementEnd();
|
|
145
|
-
i0.ɵɵprojection(
|
|
258
|
+
i0.ɵɵprojection(6);
|
|
146
259
|
} if (rf & 2) {
|
|
147
|
-
i0.ɵɵ
|
|
148
|
-
i0.ɵɵadvance();
|
|
260
|
+
i0.ɵɵconditional(ctx.href === undefined ? 0 : 1);
|
|
261
|
+
i0.ɵɵadvance(2);
|
|
149
262
|
i0.ɵɵclassMap(ctx.bodyClasses());
|
|
150
263
|
i0.ɵɵadvance();
|
|
151
|
-
i0.ɵɵ
|
|
152
|
-
i0.ɵɵadvance();
|
|
153
|
-
i0.ɵɵ
|
|
154
|
-
i0.ɵɵadvance();
|
|
155
|
-
i0.ɵɵconditional(ctx.showSubtitle() ? 4 : -1);
|
|
264
|
+
i0.ɵɵconditional(ctx.href === undefined ? 3 : 4);
|
|
265
|
+
i0.ɵɵadvance(2);
|
|
266
|
+
i0.ɵɵconditional(ctx.showSubtitle() ? 5 : -1);
|
|
156
267
|
} }, dependencies: [Avatar], encapsulation: 2 });
|
|
157
268
|
}
|
|
158
269
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(UserChip, [{
|
|
@@ -161,14 +272,16 @@ export class UserChip {
|
|
|
161
272
|
selector: 'div[mol-user-chip]',
|
|
162
273
|
standalone: true,
|
|
163
274
|
imports: [Avatar],
|
|
164
|
-
inputs: ['name', 'src', 'subtitle', 'trailing', 'size', 'className'],
|
|
275
|
+
inputs: ['name', 'href', 'nameLinkProps', 'src', 'subtitle', 'trailing', 'size', 'className'],
|
|
165
276
|
host: {
|
|
166
277
|
'[class]': 'classes()',
|
|
167
278
|
},
|
|
168
279
|
// prettier-ignore
|
|
169
|
-
template:
|
|
280
|
+
template: `@if (href === undefined) {<div mol-avatar [src]="src" [alt]="name" [name]="name" [size]="avatarSize()"></div>}
|
|
281
|
+
@else {<div aria-hidden="true"><div mol-avatar [src]="src" [alt]="name" [name]="name" [size]="avatarSize()"></div></div>}
|
|
170
282
|
<div [class]="bodyClasses()">
|
|
171
|
-
<span [class]="nameClasses()">{{ name }}</span>
|
|
283
|
+
@if (href === undefined) {<span [class]="nameClasses()">{{ name }}</span>}
|
|
284
|
+
@else {<a #nameLink data-mol-id="user-chip-profile" [href]="href" [class]="nameClasses(true)" [attr.style]="nameLinkStyle()">{{ name }}</a>}
|
|
172
285
|
@if (showSubtitle()) {<span #subtitleEl [class]="cm().textSize('xs')">@if (hasTextSubtitle()) {<ng-container>{{ subtitle }}</ng-container>}<ng-content select="[slot=subtitle]"></ng-content></span>}
|
|
173
286
|
</div>
|
|
174
287
|
<ng-content select="[slot=trailing]"></ng-content>`,
|
|
@@ -176,6 +289,9 @@ export class UserChip {
|
|
|
176
289
|
}], null, { subtitleEl: [{
|
|
177
290
|
type: ViewChild,
|
|
178
291
|
args: ['subtitleEl']
|
|
292
|
+
}], nameLink: [{
|
|
293
|
+
type: ViewChild,
|
|
294
|
+
args: ['nameLink']
|
|
179
295
|
}] }); })();
|
|
180
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(UserChip, { className: "UserChip", filePath: "user-chip.component.ts", lineNumber:
|
|
296
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(UserChip, { className: "UserChip", filePath: "user-chip.component.ts", lineNumber: 55 }); })();
|
|
181
297
|
//# sourceMappingURL=user-chip.component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-chip.component.js","sourceRoot":"","sources":["../src/user-chip.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"user-chip.component.js","sourceRoot":"","sources":["../src/user-chip.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAGL,SAAS,EAET,MAAM,EAEN,SAAS,EACT,MAAM,EACN,SAAS,GACV,MAAM,eAAe,CAAA;AAGtB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,MAAM,EAAE,QA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|
|
2
2
|
"name": "@molecule/app-avatar-stack-angular",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Angular stacked avatars and user-chip component",
|
|
5
5
|
"homepage": "https://www.molecule.dev/packages/app-avatar-stack-angular",
|
|
6
6
|
"type": "module",
|
|
@@ -55,12 +55,12 @@
|
|
|
55
55
|
"@angular/compiler-cli": "22.2.3",
|
|
56
56
|
"@angular/core": "22.2.3",
|
|
57
57
|
"@angular/platform-browser": "22.2.3",
|
|
58
|
-
"@molecule/app-angular": "3.
|
|
58
|
+
"@molecule/app-angular": "3.7.1",
|
|
59
59
|
"@molecule/app-framework-conformance": "0.0.0",
|
|
60
|
-
"@molecule/app-i18n": "1.2.
|
|
60
|
+
"@molecule/app-i18n": "1.2.2",
|
|
61
61
|
"@molecule/app-icons": "1.0.4",
|
|
62
|
-
"@molecule/app-ui": "1.
|
|
63
|
-
"@molecule/app-ui-angular": "1.
|
|
62
|
+
"@molecule/app-ui": "1.4.0",
|
|
63
|
+
"@molecule/app-ui-angular": "1.2.0",
|
|
64
64
|
"@types/node": "26.6.5",
|
|
65
65
|
"jsdom": "30.1.3",
|
|
66
66
|
"rxjs": "7.8.2",
|