@molecule/app-leaderboard-row-angular 1.1.2 → 1.1.3
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 +104 -25
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
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-22T16:18:17.519Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-leaderboard-row-angular
|
|
@@ -44,7 +44,11 @@ import { LeaderboardRow } from '@molecule/app-leaderboard-row-angular'
|
|
|
44
44
|
></div>
|
|
45
45
|
`,
|
|
46
46
|
})
|
|
47
|
-
export class LeaderboardPage {
|
|
47
|
+
export class LeaderboardPage {
|
|
48
|
+
readonly openProfile = (id: string): void => {
|
|
49
|
+
console.log('open profile', id)
|
|
50
|
+
}
|
|
51
|
+
}
|
|
48
52
|
```
|
|
49
53
|
|
|
50
54
|
## Type
|
|
@@ -176,27 +180,45 @@ export class LeaderboardRow implements AfterViewInit {
|
|
|
176
180
|
}
|
|
177
181
|
}
|
|
178
182
|
|
|
179
|
-
/**
|
|
183
|
+
/**
|
|
184
|
+
* Whether the row is interactive (`onClick` supplied): React renders the
|
|
185
|
+
* button role, tab stop and pointer cursor only then.
|
|
186
|
+
* @returns True when clickable.
|
|
187
|
+
*/
|
|
180
188
|
interactive(): boolean {
|
|
181
189
|
return typeof this.onClick === 'function'
|
|
182
190
|
}
|
|
183
191
|
|
|
184
|
-
/**
|
|
192
|
+
/**
|
|
193
|
+
* The host element's `role` (a button only when clickable).
|
|
194
|
+
* @returns `'button'` or null for no attribute.
|
|
195
|
+
*/
|
|
185
196
|
role(): string | null {
|
|
186
197
|
return this.interactive() ? 'button' : null
|
|
187
198
|
}
|
|
188
199
|
|
|
189
|
-
/**
|
|
200
|
+
/**
|
|
201
|
+
* The host element's tab stop (only when clickable).
|
|
202
|
+
* @returns 0 or null for no attribute.
|
|
203
|
+
*/
|
|
190
204
|
tabindex(): number | null {
|
|
191
205
|
return this.interactive() ? 0 : null
|
|
192
206
|
}
|
|
193
207
|
|
|
194
|
-
/**
|
|
208
|
+
/**
|
|
209
|
+
* Forwards a native click on the row to the `onClick` input (React calls
|
|
210
|
+
* the handler with the event).
|
|
211
|
+
* @param event - The native click event.
|
|
212
|
+
*/
|
|
195
213
|
rowClick(event: MouseEvent): void {
|
|
196
214
|
this.onClick?.(event)
|
|
197
215
|
}
|
|
198
216
|
|
|
199
|
-
/**
|
|
217
|
+
/**
|
|
218
|
+
* Activates the row on Enter / Space (React's `handleKeyDown`):
|
|
219
|
+
* preventDefault, then the click handler with no event.
|
|
220
|
+
* @param event - The keydown.
|
|
221
|
+
*/
|
|
200
222
|
handleKeyDown(event: KeyboardEvent): void {
|
|
201
223
|
const onClick = this.onClick
|
|
202
224
|
if (!onClick) return
|
|
@@ -206,12 +228,19 @@ export class LeaderboardRow implements AfterViewInit {
|
|
|
206
228
|
}
|
|
207
229
|
}
|
|
208
230
|
|
|
209
|
-
/**
|
|
231
|
+
/**
|
|
232
|
+
* The current class map.
|
|
233
|
+
* @returns The UIClassMap.
|
|
234
|
+
*/
|
|
210
235
|
cm(): UIClassMap {
|
|
211
236
|
return getClassMap()
|
|
212
237
|
}
|
|
213
238
|
|
|
214
|
-
/**
|
|
239
|
+
/**
|
|
240
|
+
* Computes the row's root class list, with the pointer cursor only when an
|
|
241
|
+
* `onClick` handler is set (React's conditional `cm.cursorPointer`).
|
|
242
|
+
* @returns The class string.
|
|
243
|
+
*/
|
|
215
244
|
classes(): string {
|
|
216
245
|
return this.cm().cn(
|
|
217
246
|
this.cm().flex({ align: 'center', gap: 'sm' }),
|
|
@@ -223,62 +252,103 @@ export class LeaderboardRow implements AfterViewInit {
|
|
|
223
252
|
)
|
|
224
253
|
}
|
|
225
254
|
|
|
226
|
-
/**
|
|
255
|
+
/**
|
|
256
|
+
* The rank cell's class.
|
|
257
|
+
* @returns The class string.
|
|
258
|
+
*/
|
|
227
259
|
rankClass(): string {
|
|
228
260
|
return this.cm().cn(this.cm().shrink0, this.cm().fontWeight('bold'), this.cm().textCenter)
|
|
229
261
|
}
|
|
230
262
|
|
|
231
|
-
/**
|
|
263
|
+
/**
|
|
264
|
+
* The rank cell's text: a medal for the top three, `#n` otherwise (React's
|
|
265
|
+
* `MEDAL[rank] ?? '#' + rank`).
|
|
266
|
+
* @returns The rank display.
|
|
267
|
+
*/
|
|
232
268
|
rankText(): string {
|
|
233
269
|
return MEDAL[this.rank as number] ?? `#${this.rank}`
|
|
234
270
|
}
|
|
235
271
|
|
|
236
|
-
/**
|
|
272
|
+
/**
|
|
273
|
+
* The Avatar's alt/name (React's `typeof name === 'string' ? name :
|
|
274
|
+
* 'Player'`).
|
|
275
|
+
* @returns The display name.
|
|
276
|
+
*/
|
|
237
277
|
displayName(): string {
|
|
238
278
|
return typeof this.name === 'string' ? this.name : 'Player'
|
|
239
279
|
}
|
|
240
280
|
|
|
241
|
-
/**
|
|
281
|
+
/**
|
|
282
|
+
* The name column's class.
|
|
283
|
+
* @returns The class string.
|
|
284
|
+
*/
|
|
242
285
|
nameColumnClass(): string {
|
|
243
286
|
return this.cm().cn(this.cm().flex1, this.cm().stack(0 as const))
|
|
244
287
|
}
|
|
245
288
|
|
|
246
|
-
/**
|
|
289
|
+
/**
|
|
290
|
+
* The name span's class.
|
|
291
|
+
* @returns The class string.
|
|
292
|
+
*/
|
|
247
293
|
nameClass(): string {
|
|
248
294
|
return this.cm().cn(this.cm().textSize('sm'), this.cm().fontWeight('semibold'))
|
|
249
295
|
}
|
|
250
296
|
|
|
251
|
-
/**
|
|
297
|
+
/**
|
|
298
|
+
* The subtitle span's class.
|
|
299
|
+
* @returns The class string.
|
|
300
|
+
*/
|
|
252
301
|
subtitleClass(): string {
|
|
253
302
|
return this.cm().textSize('xs')
|
|
254
303
|
}
|
|
255
304
|
|
|
256
|
-
/**
|
|
305
|
+
/**
|
|
306
|
+
* Whether a text name input is present (a projected name is not).
|
|
307
|
+
* @returns True when the name renders as text.
|
|
308
|
+
*/
|
|
257
309
|
get hasName(): boolean {
|
|
258
310
|
return this.name !== undefined && this.name !== null
|
|
259
311
|
}
|
|
260
312
|
|
|
261
|
-
/**
|
|
313
|
+
/**
|
|
314
|
+
* Whether a text score input is present (a projected score is not).
|
|
315
|
+
* @returns True when the score renders as text.
|
|
316
|
+
*/
|
|
262
317
|
get hasScore(): boolean {
|
|
263
318
|
return this.score !== undefined && this.score !== null
|
|
264
319
|
}
|
|
265
320
|
|
|
266
|
-
/**
|
|
321
|
+
/**
|
|
322
|
+
* Whether the subtitle renders as text: React's `subtitle && …` truthiness.
|
|
323
|
+
* @returns True when the subtitle text shows.
|
|
324
|
+
*/
|
|
267
325
|
get hasSubtitle(): boolean {
|
|
268
326
|
return this.subtitle !== undefined && this.subtitle !== null && this.subtitle !== ''
|
|
269
327
|
}
|
|
270
328
|
|
|
271
|
-
/**
|
|
329
|
+
/**
|
|
330
|
+
* Whether the subtitle span renders at all: the text input or projected
|
|
331
|
+
* `[slot=subtitle]` content.
|
|
332
|
+
* @returns True when the subtitle shows.
|
|
333
|
+
*/
|
|
272
334
|
get showSubtitle(): boolean {
|
|
273
335
|
return this.hasSubtitle || this.subtitleProjected()
|
|
274
336
|
}
|
|
275
337
|
|
|
276
|
-
/**
|
|
338
|
+
/**
|
|
339
|
+
* Whether a delta indicator renders: React's `rankDelta !== undefined &&
|
|
340
|
+
* rankDelta !== 0` (a zero delta renders nothing).
|
|
341
|
+
* @returns True when the ▲/▼ chip shows.
|
|
342
|
+
*/
|
|
277
343
|
get hasDelta(): boolean {
|
|
278
344
|
return this.rankDelta !== undefined && this.rankDelta !== 0
|
|
279
345
|
}
|
|
280
346
|
|
|
281
|
-
/**
|
|
347
|
+
/**
|
|
348
|
+
* The delta chip's class: the text size and weight, plus the semantic tone
|
|
349
|
+
* (React's `cm.textTone(rankDelta > 0 ? 'success' : 'error')`).
|
|
350
|
+
* @returns The class string.
|
|
351
|
+
*/
|
|
282
352
|
deltaClass(): string {
|
|
283
353
|
return this.cm().cn(
|
|
284
354
|
this.cm().textSize('xs'),
|
|
@@ -287,24 +357,33 @@ export class LeaderboardRow implements AfterViewInit {
|
|
|
287
357
|
)
|
|
288
358
|
}
|
|
289
359
|
|
|
290
|
-
/**
|
|
360
|
+
/**
|
|
361
|
+
* The delta's arrow (React's `rankDelta > 0 ? '▲' : '▼'`).
|
|
362
|
+
* @returns The arrow character.
|
|
363
|
+
*/
|
|
291
364
|
deltaArrow(): string {
|
|
292
365
|
return (this.rankDelta as number) > 0 ? '▲' : '▼'
|
|
293
366
|
}
|
|
294
367
|
|
|
295
|
-
/**
|
|
368
|
+
/**
|
|
369
|
+
* The delta's magnitude (React's `Math.abs(rankDelta)`).
|
|
370
|
+
* @returns The number of ranks climbed or dropped.
|
|
371
|
+
*/
|
|
296
372
|
deltaText(): number {
|
|
297
373
|
return Math.abs(this.rankDelta as number)
|
|
298
374
|
}
|
|
299
375
|
|
|
300
|
-
/**
|
|
376
|
+
/**
|
|
377
|
+
* The score span's class.
|
|
378
|
+
* @returns The class string.
|
|
379
|
+
*/
|
|
301
380
|
scoreClass(): string {
|
|
302
381
|
return this.cm().cn(this.cm().textSize('sm'), this.cm().fontWeight('bold'))
|
|
303
382
|
}
|
|
304
383
|
}
|
|
305
384
|
```
|
|
306
385
|
|
|
307
|
-
_(
|
|
386
|
+
_(The longest member comment is shortened to its first sentence to fit; the full declaration is in `node_modules/@molecule/app-leaderboard-row-angular/dist/leaderboard-row.component.d.ts`.)_
|
|
308
387
|
|
|
309
388
|
## Injection Notes
|
|
310
389
|
|
package/dist/index.d.ts
CHANGED
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AAEH,cAAc,gCAAgC,CAAA;AAC9C,cAAc,YAAY,CAAA"}
|
package/dist/index.js
CHANGED
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AAEH,cAAc,gCAAgC,CAAA;AAC9C,cAAc,YAAY,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-leaderboard-row-angular",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "Leaderboard row — rank, avatar, name, score, optional change indicator",
|
|
5
5
|
"homepage": "https://www.molecule.dev/packages/app-leaderboard-row-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.11.0",
|
|
59
59
|
"@molecule/app-framework-conformance": "0.0.0",
|
|
60
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.5.0",
|
|
63
|
+
"@molecule/app-ui-angular": "1.4.0",
|
|
64
64
|
"@types/node": "26.6.5",
|
|
65
65
|
"jsdom": "30.1.3",
|
|
66
66
|
"rxjs": "7.8.2",
|