@molecule/app-author-bio-card-angular 0.0.1-stage → 1.1.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 +41 -119
- package/package.json +3 -3
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-18T19:47:00.455Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-author-bio-card-angular
|
|
@@ -145,144 +145,58 @@ This is the Angular counterpart of `@molecule/app-author-bio-card-react`.
|
|
|
145
145
|
'[class]': 'classes()',
|
|
146
146
|
'[attr.data-mol-id]': 'containerId()',
|
|
147
147
|
},
|
|
148
|
+
// prettier-ignore
|
|
148
149
|
template: `@if (layout === 'full') {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
></div>
|
|
158
|
-
</div>
|
|
159
|
-
<div [class]="bodyFullClasses()">
|
|
160
|
-
<header [class]="baselineClasses()">
|
|
161
|
-
@if (author && author.href) {
|
|
162
|
-
<a [href]="author.href" [attr.data-mol-id]="id('name')" [class]="nameClasses()">{{
|
|
163
|
-
author.name
|
|
164
|
-
}}</a>
|
|
165
|
-
} @else {
|
|
166
|
-
<span [attr.data-mol-id]="id('name')" [class]="nameClasses()">{{
|
|
167
|
-
author?.name
|
|
168
|
-
}}</span>
|
|
169
|
-
}
|
|
170
|
-
</header>
|
|
171
|
-
@if (author && author.bio) {
|
|
172
|
-
<p [attr.data-mol-id]="id('bio')" [class]="bioClasses()">{{ author.bio }}</p>
|
|
173
|
-
}
|
|
174
|
-
<div [class]="betweenClasses()">
|
|
175
|
-
@if (socialEntries().length > 0) {
|
|
176
|
-
<div [attr.data-mol-id]="id('socials')" [class]="socialRowClasses()">
|
|
177
|
-
@for (entry of socialEntries(); track entry[0]) {
|
|
178
|
-
<a
|
|
179
|
-
[href]="hrefOf(entry)"
|
|
180
|
-
[attr.data-mol-id]="socialId(entry[0])"
|
|
181
|
-
[attr.aria-label]="socialAriaLabel(entry[0])"
|
|
182
|
-
rel="noopener noreferrer"
|
|
183
|
-
target="_blank"
|
|
184
|
-
[class]="socialLinkClasses()"
|
|
185
|
-
>{{ socialText(entry[0]) }}</a
|
|
186
|
-
>
|
|
187
|
-
}
|
|
188
|
-
</div>
|
|
189
|
-
} @else {
|
|
190
|
-
<span></span>
|
|
191
|
-
}
|
|
192
|
-
@if (onFollow) {
|
|
193
|
-
<button
|
|
194
|
-
mol-button
|
|
195
|
-
[variant]="following ? 'outline' : 'solid'"
|
|
196
|
-
[color]="'primary'"
|
|
197
|
-
[size]="'sm'"
|
|
198
|
-
(click)="toggleFollow()"
|
|
199
|
-
[attr.data-mol-id]="id('follow')"
|
|
200
|
-
[attr.aria-pressed]="following ? 'true' : 'false'"
|
|
201
|
-
>
|
|
202
|
-
{{ followLabel() }}
|
|
203
|
-
</button>
|
|
204
|
-
}
|
|
205
|
-
</div>
|
|
206
|
-
</div>
|
|
150
|
+
<div [class]="rowFullClasses()">
|
|
151
|
+
<div [class]="shrink0Classes()"><div mol-avatar [src]="author?.avatar" [alt]="author?.name" [name]="author?.name" [size]="'lg'"></div></div>
|
|
152
|
+
<div [class]="bodyFullClasses()">
|
|
153
|
+
<header [class]="baselineClasses()">@if (author && author.href) {<a [href]="author.href" [attr.data-mol-id]="id('name')" [class]="nameClasses()">{{ author.name }}</a>} @else {<span [attr.data-mol-id]="id('name')" [class]="nameClasses()">{{ author?.name }}</span>}</header>
|
|
154
|
+
@if (author && author.bio) {<p [attr.data-mol-id]="id('bio')" [class]="bioClasses()">{{ author.bio }}</p>}
|
|
155
|
+
<div [class]="betweenClasses()">
|
|
156
|
+
@if (socialEntries().length > 0) {<div [attr.data-mol-id]="id('socials')" [class]="socialRowClasses()">@for (entry of socialEntries(); track entry[0]) {<a [href]="hrefOf(entry)" [attr.data-mol-id]="socialId(entry[0])" [attr.aria-label]="socialAriaLabel(entry[0])" rel="noopener noreferrer" target="_blank" [class]="socialLinkClasses()">{{ socialText(entry[0]) }}</a>}</div>} @else {<span></span>}
|
|
157
|
+
@if (onFollow) {<button mol-button [variant]="following ? 'outline' : 'solid'" [color]="'primary'" [size]="'sm'" (click)="toggleFollow()" [attr.data-mol-id]="id('follow')" [attr.aria-pressed]="following ? 'true' : 'false'">{{ followLabel() }}</button>}
|
|
207
158
|
</div>
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
@if (author && author.href) {
|
|
222
|
-
<a [href]="author.href" [attr.data-mol-id]="id('name')" [class]="nameClasses()">{{
|
|
223
|
-
author.name
|
|
224
|
-
}}</a>
|
|
225
|
-
} @else {
|
|
226
|
-
<span [attr.data-mol-id]="id('name')" [class]="nameClasses()">{{
|
|
227
|
-
author?.name
|
|
228
|
-
}}</span>
|
|
229
|
-
}
|
|
230
|
-
</div>
|
|
231
|
-
@if (author && author.bio) {
|
|
232
|
-
<p [attr.data-mol-id]="id('bio')" [class]="bioClasses()">{{ author.bio }}</p>
|
|
233
|
-
}
|
|
234
|
-
@if (socialEntries().length > 0) {
|
|
235
|
-
<div [attr.data-mol-id]="id('socials')" [class]="socialRowClasses()">
|
|
236
|
-
@for (entry of socialEntries(); track entry[0]) {
|
|
237
|
-
<a
|
|
238
|
-
[href]="hrefOf(entry)"
|
|
239
|
-
[attr.data-mol-id]="socialId(entry[0])"
|
|
240
|
-
[attr.aria-label]="socialAriaLabel(entry[0])"
|
|
241
|
-
rel="noopener noreferrer"
|
|
242
|
-
target="_blank"
|
|
243
|
-
[class]="socialLinkClasses()"
|
|
244
|
-
>{{ socialText(entry[0]) }}</a
|
|
245
|
-
>
|
|
246
|
-
}
|
|
247
|
-
</div>
|
|
248
|
-
}
|
|
249
|
-
</div>
|
|
250
|
-
@if (onFollow) {
|
|
251
|
-
<div [class]="shrink0Classes()">
|
|
252
|
-
<button
|
|
253
|
-
mol-button
|
|
254
|
-
[variant]="following ? 'outline' : 'solid'"
|
|
255
|
-
[color]="'primary'"
|
|
256
|
-
[size]="'sm'"
|
|
257
|
-
(click)="toggleFollow()"
|
|
258
|
-
[attr.data-mol-id]="id('follow')"
|
|
259
|
-
[attr.aria-pressed]="following ? 'true' : 'false'"
|
|
260
|
-
>
|
|
261
|
-
{{ followLabel() }}
|
|
262
|
-
</button>
|
|
263
|
-
</div>
|
|
264
|
-
}
|
|
265
|
-
</div>
|
|
266
|
-
}`,
|
|
159
|
+
</div>
|
|
160
|
+
</div>
|
|
161
|
+
} @else {
|
|
162
|
+
<div [class]="rowCompactClasses()">
|
|
163
|
+
<div [class]="shrink0Classes()"><div mol-avatar [src]="author?.avatar" [alt]="author?.name" [name]="author?.name" [size]="'md'"></div></div>
|
|
164
|
+
<div [class]="bodyCompactClasses()">
|
|
165
|
+
<div [class]="baselineClasses()">@if (author && author.href) {<a [href]="author.href" [attr.data-mol-id]="id('name')" [class]="nameClasses()">{{ author.name }}</a>} @else {<span [attr.data-mol-id]="id('name')" [class]="nameClasses()">{{ author?.name }}</span>}</div>
|
|
166
|
+
@if (author && author.bio) {<p [attr.data-mol-id]="id('bio')" [class]="bioClasses()">{{ author.bio }}</p>}
|
|
167
|
+
@if (socialEntries().length > 0) {<div [attr.data-mol-id]="id('socials')" [class]="socialRowClasses()">@for (entry of socialEntries(); track entry[0]) {<a [href]="hrefOf(entry)" [attr.data-mol-id]="socialId(entry[0])" [attr.aria-label]="socialAriaLabel(entry[0])" rel="noopener noreferrer" target="_blank" [class]="socialLinkClasses()">{{ socialText(entry[0]) }}</a>}</div>}
|
|
168
|
+
</div>
|
|
169
|
+
@if (onFollow) {<div [class]="shrink0Classes()"><button mol-button [variant]="following ? 'outline' : 'solid'" [color]="'primary'" [size]="'sm'" (click)="toggleFollow()" [attr.data-mol-id]="id('follow')" [attr.aria-pressed]="following ? 'true' : 'false'">{{ followLabel() }}</button></div>}
|
|
170
|
+
</div>
|
|
171
|
+
}`,
|
|
267
172
|
})
|
|
268
173
|
export class AuthorBioCard {
|
|
174
|
+
/** Author identity + bio + socials. */
|
|
269
175
|
author?: AuthorBioCardAuthor
|
|
176
|
+
/** Layout preset: `compact` (default) or `full`. */
|
|
270
177
|
layout?: 'compact' | 'full'
|
|
178
|
+
/** Whether the viewer currently follows this author. */
|
|
271
179
|
following?: boolean
|
|
180
|
+
/** Toggle handler for the follow button. */
|
|
272
181
|
onFollow?: (following: boolean) => void
|
|
182
|
+
/** Extra classes on the outer card. */
|
|
273
183
|
className?: string
|
|
184
|
+
/** `data-mol-id` for AI-agent selectors. */
|
|
274
185
|
dataMolId?: string
|
|
275
186
|
|
|
276
187
|
private readonly i18n = useTranslation()
|
|
277
188
|
|
|
189
|
+
/** The current class map. */
|
|
278
190
|
cm(): UIClassMap {
|
|
279
191
|
return getClassMap()
|
|
280
192
|
}
|
|
281
193
|
|
|
194
|
+
/** The `data-mol-id` on the card (React's default parameter). */
|
|
282
195
|
containerId(): string {
|
|
283
196
|
return this.dataMolId ?? 'author-bio-card'
|
|
284
197
|
}
|
|
285
198
|
|
|
199
|
+
/** A child `data-mol-id` (React's `${dataMolId}-<suffix>`). */
|
|
286
200
|
id(suffix: string): string {
|
|
287
201
|
return `${this.containerId()}-${suffix}`
|
|
288
202
|
}
|
|
@@ -292,6 +206,7 @@ export class AuthorBioCard {
|
|
|
292
206
|
return cm.cn(cm.card({ variant: 'elevated' }), cm.cardPadding('md'), this.className)
|
|
293
207
|
}
|
|
294
208
|
|
|
209
|
+
/** A fixed-width wrapper (React's `cm.shrink0`). */
|
|
295
210
|
shrink0Classes(): string {
|
|
296
211
|
return this.cm().cn(this.cm().shrink0)
|
|
297
212
|
}
|
|
@@ -332,10 +247,12 @@ export class AuthorBioCard {
|
|
|
332
247
|
return this.cm().cn(this.cm().fontWeight('semibold'), this.cm().textSize('base'))
|
|
333
248
|
}
|
|
334
249
|
|
|
250
|
+
/** The bio paragraph (React's `cm.textSize('sm')`). */
|
|
335
251
|
bioClasses(): string {
|
|
336
252
|
return this.cm().textSize('sm')
|
|
337
253
|
}
|
|
338
254
|
|
|
255
|
+
/** The translated follow-button label. */
|
|
339
256
|
followLabel(): string {
|
|
340
257
|
return this.following
|
|
341
258
|
? this.i18n.t('authorBioCard.following', {}, { defaultValue: 'Following' })
|
|
@@ -350,14 +267,17 @@ export class AuthorBioCard {
|
|
|
350
267
|
})
|
|
351
268
|
}
|
|
352
269
|
|
|
270
|
+
/** One social entry's `href`. */
|
|
353
271
|
hrefOf(entry: [SocialKey, string]): string {
|
|
354
272
|
return resolveSocialHref(entry[0], entry[1])
|
|
355
273
|
}
|
|
356
274
|
|
|
275
|
+
/** One social link's `data-mol-id`. */
|
|
357
276
|
socialId(key: SocialKey): string {
|
|
358
277
|
return this.id(`social-${key}`)
|
|
359
278
|
}
|
|
360
279
|
|
|
280
|
+
/** The translated accessible label of a social link. */
|
|
361
281
|
socialAriaLabel(key: SocialKey): string {
|
|
362
282
|
const name = this.author?.name ?? ''
|
|
363
283
|
switch (key) {
|
|
@@ -394,6 +314,7 @@ export class AuthorBioCard {
|
|
|
394
314
|
}
|
|
395
315
|
}
|
|
396
316
|
|
|
317
|
+
/** The translated visible label of a social link. */
|
|
397
318
|
socialText(key: SocialKey): string {
|
|
398
319
|
switch (key) {
|
|
399
320
|
case 'twitter':
|
|
@@ -409,13 +330,14 @@ export class AuthorBioCard {
|
|
|
409
330
|
}
|
|
410
331
|
}
|
|
411
332
|
|
|
333
|
+
/** Reports the toggled follow state through the caller's handler. */
|
|
412
334
|
toggleFollow(): void {
|
|
413
335
|
this.onFollow?.(!this.following)
|
|
414
336
|
}
|
|
415
337
|
}
|
|
416
338
|
```
|
|
417
339
|
|
|
418
|
-
_(Member comments are left out to fit; the full declaration is in `node_modules/@molecule/app-author-bio-card-angular/dist/author-bio-card.component.d.ts`.)_
|
|
340
|
+
_(Member comments are shortened to their first sentence, and the 12 longest are left out to fit; the full declaration is in `node_modules/@molecule/app-author-bio-card-angular/dist/author-bio-card.component.d.ts`.)_
|
|
419
341
|
|
|
420
342
|
### Functions
|
|
421
343
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-author-bio-card-angular",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Author bio card with avatar, name, bio, social links, and follow button",
|
|
5
5
|
"homepage": "https://www.molecule.dev/packages/app-author-bio-card-angular",
|
|
6
6
|
"type": "module",
|
|
@@ -57,12 +57,12 @@
|
|
|
57
57
|
"@angular/compiler-cli": "22.2.3",
|
|
58
58
|
"@angular/core": "22.2.3",
|
|
59
59
|
"@angular/platform-browser": "22.2.3",
|
|
60
|
-
"@molecule/app-angular": "3.7.
|
|
60
|
+
"@molecule/app-angular": "3.7.2",
|
|
61
61
|
"@molecule/app-framework-conformance": "0.0.0",
|
|
62
62
|
"@molecule/app-i18n": "1.2.2",
|
|
63
63
|
"@molecule/app-icons": "1.0.4",
|
|
64
64
|
"@molecule/app-ui": "1.4.0",
|
|
65
|
-
"@molecule/app-ui-angular": "1.2.
|
|
65
|
+
"@molecule/app-ui-angular": "1.2.1",
|
|
66
66
|
"@types/node": "26.6.5",
|
|
67
67
|
"jsdom": "30.1.3",
|
|
68
68
|
"rxjs": "7.8.2",
|