@molecule/app-leaderboard-row-angular 0.0.0-stage → 0.0.1-stage
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/LICENSE +202 -0
- package/README.md +384 -2
- package/dist/index.d.ts +58 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +58 -0
- package/dist/index.js.map +1 -0
- package/dist/leaderboard-row.component.d.ts +160 -0
- package/dist/leaderboard-row.component.d.ts.map +1 -0
- package/dist/leaderboard-row.component.js +351 -0
- package/dist/leaderboard-row.component.js.map +1 -0
- package/dist/types.d.ts +31 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +7 -0
- package/dist/types.js.map +1 -0
- package/package.json +69 -4
package/dist/index.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Angular leaderboard row.
|
|
3
|
+
*
|
|
4
|
+
* Exports `<LeaderboardRow>` — rank + avatar + name + score with optional
|
|
5
|
+
* rank-delta indicator, subtitle, and current-user highlight. Props: `rank`,
|
|
6
|
+
* `name`, `score`, `avatarSrc?`, `rankDelta?`, `subtitle?`, `isMe?`,
|
|
7
|
+
* `onClick?`, `className?`. It is the Angular counterpart of
|
|
8
|
+
* `@molecule/app-leaderboard-row-react`: same props and the same DOM for the
|
|
9
|
+
* same input.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { Component } from '@angular/core'
|
|
14
|
+
* import { LeaderboardRow } from '@molecule/app-leaderboard-row-angular'
|
|
15
|
+
*
|
|
16
|
+
* @Component({
|
|
17
|
+
* selector: 'leaderboard-page',
|
|
18
|
+
* standalone: true,
|
|
19
|
+
* imports: [LeaderboardRow],
|
|
20
|
+
* template: `
|
|
21
|
+
* <div mol-leaderboard-row
|
|
22
|
+
* [rank]="1"
|
|
23
|
+
* name="Alice Chen"
|
|
24
|
+
* avatarSrc="/avatars/alice.png"
|
|
25
|
+
* [score]="4820"
|
|
26
|
+
* [rankDelta]="2"
|
|
27
|
+
* subtitle="Team Phoenix"
|
|
28
|
+
* (click)="openProfile('alice')">
|
|
29
|
+
* </div>
|
|
30
|
+
* `,
|
|
31
|
+
* })
|
|
32
|
+
* export class LeaderboardPage {}
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @remarks
|
|
36
|
+
* - Ranks 1–3 render medal emoji (gold/silver/bronze) INSTEAD of the rank
|
|
37
|
+
* number; rank 4+ renders `#n`. There is no prop to disable the medals.
|
|
38
|
+
* - `rankDelta` arrows use hardcoded green/red hex colors and `isMe` uses a
|
|
39
|
+
* fixed light-blue translucent background — neither follows the app theme,
|
|
40
|
+
* and the `isMe` tint is tuned for light backgrounds. Override via
|
|
41
|
+
* `className` where that clashes with a dark theme.
|
|
42
|
+
* - When `name` is not a plain string the avatar's accessible name falls back
|
|
43
|
+
* to the hardcoded English string 'Player' — pass a string `name` in
|
|
44
|
+
* localized apps.
|
|
45
|
+
* - `onClick` gives the row a pointer cursor but no keyboard/role semantics
|
|
46
|
+
* (a documented gap of the React package the DOM must match); it is called
|
|
47
|
+
* with the native click event. The host IS the row's root `<div>`, so a
|
|
48
|
+
* click anywhere on the row fires it.
|
|
49
|
+
* - Requires a wired ClassMap bond; `<Avatar>` comes from
|
|
50
|
+
* `@molecule/app-ui-angular`. Node props are projected content: `name`,
|
|
51
|
+
* `score` and `subtitle` are selected by `[slot=<name>]`, everything else
|
|
52
|
+
* binds as inputs.
|
|
53
|
+
*
|
|
54
|
+
* @module
|
|
55
|
+
*/
|
|
56
|
+
export * from './leaderboard-row.component.js';
|
|
57
|
+
export * from './types.js';
|
|
58
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AAEH,cAAc,gCAAgC,CAAA;AAC9C,cAAc,YAAY,CAAA"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LeaderboardRow component (React parity).
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { type AfterViewInit } from '@angular/core';
|
|
7
|
+
import type { UIClassMap } from '@molecule/app-ui';
|
|
8
|
+
import * as i0 from "@angular/core";
|
|
9
|
+
/**
|
|
10
|
+
* LeaderboardRow component.
|
|
11
|
+
*
|
|
12
|
+
* Leaderboard row — rank + avatar + name + score + optional rank-delta
|
|
13
|
+
* arrow. Top 3 ranks render a medal in place of the numeric rank. The host IS
|
|
14
|
+
* the row's root `<div>` (`div[mol-leaderboard-row]`), matching React's root
|
|
15
|
+
* exactly; `onClick` is a native click on the host with no keyboard handler
|
|
16
|
+
* or role — a documented gap of the React package the DOM must match. When
|
|
17
|
+
* `name` is not a plain string the Avatar alt falls back to hardcoded
|
|
18
|
+
* 'Player'. Same props, same DOM as
|
|
19
|
+
* `@molecule/app-leaderboard-row-react`'s `LeaderboardRow`. Node-valued
|
|
20
|
+
* `name`, `score` and `subtitle` content is projected (`[slot=<name>]`); a
|
|
21
|
+
* string or number input renders as text. The optional subtitle span renders
|
|
22
|
+
* optimistically so a projection can land, then withdraws at view init when
|
|
23
|
+
* neither a text input nor a projection is present — React renders no span at
|
|
24
|
+
* all for an absent or empty subtitle.
|
|
25
|
+
*/
|
|
26
|
+
export declare class LeaderboardRow implements AfterViewInit {
|
|
27
|
+
/** 1-based rank. */
|
|
28
|
+
rank?: number;
|
|
29
|
+
/** Display name: text, or `[slot=name]` content. */
|
|
30
|
+
name?: unknown;
|
|
31
|
+
/** Optional avatar URL. */
|
|
32
|
+
avatarSrc?: string;
|
|
33
|
+
/** Score / metric: text, or `[slot=score]` content. */
|
|
34
|
+
score?: unknown;
|
|
35
|
+
/** Optional change indicator (positive = climbed). */
|
|
36
|
+
rankDelta?: number;
|
|
37
|
+
/** Optional secondary line: text, or `[slot=subtitle]` content. */
|
|
38
|
+
subtitle?: unknown;
|
|
39
|
+
/** Whether this row represents the current user (highlighted). */
|
|
40
|
+
isMe?: boolean;
|
|
41
|
+
/** Click handler, called with the native click event. */
|
|
42
|
+
onClick?: (event: MouseEvent) => void;
|
|
43
|
+
/** Extra classes. */
|
|
44
|
+
className?: string;
|
|
45
|
+
/** The optional subtitle span (projected content lands here). */
|
|
46
|
+
private subtitleEl?;
|
|
47
|
+
/** Whether a `[slot=subtitle]` projection landed (true until proven otherwise). */
|
|
48
|
+
private readonly subtitleProjected;
|
|
49
|
+
/**
|
|
50
|
+
* Withdraws the optimistic subtitle span when its slot projection did not
|
|
51
|
+
* land: when neither a text input nor projected content is present, React
|
|
52
|
+
* renders no span at all. View queries resolve at view init, and a
|
|
53
|
+
* projected slot's content is in place by then.
|
|
54
|
+
*/
|
|
55
|
+
ngAfterViewInit(): void;
|
|
56
|
+
/**
|
|
57
|
+
* Forwards a native click on the row to the `onClick` input (React calls
|
|
58
|
+
* the handler with the event).
|
|
59
|
+
* @param event - The native click event.
|
|
60
|
+
*/
|
|
61
|
+
rowClick(event: MouseEvent): void;
|
|
62
|
+
/**
|
|
63
|
+
* The current class map.
|
|
64
|
+
* @returns The UIClassMap.
|
|
65
|
+
*/
|
|
66
|
+
cm(): UIClassMap;
|
|
67
|
+
/**
|
|
68
|
+
* Computes the row's root class list, with the pointer cursor only when an
|
|
69
|
+
* `onClick` handler is set (React's conditional `cm.cursorPointer`).
|
|
70
|
+
* @returns The class string.
|
|
71
|
+
*/
|
|
72
|
+
classes(): string;
|
|
73
|
+
/**
|
|
74
|
+
* The rank cell's class.
|
|
75
|
+
* @returns The class string.
|
|
76
|
+
*/
|
|
77
|
+
rankClass(): string;
|
|
78
|
+
/**
|
|
79
|
+
* The rank cell's text: a medal for the top three, `#n` otherwise (React's
|
|
80
|
+
* `MEDAL[rank] ?? '#' + rank`).
|
|
81
|
+
* @returns The rank display.
|
|
82
|
+
*/
|
|
83
|
+
rankText(): string;
|
|
84
|
+
/**
|
|
85
|
+
* The Avatar's alt/name (React's `typeof name === 'string' ? name :
|
|
86
|
+
* 'Player'`).
|
|
87
|
+
* @returns The display name.
|
|
88
|
+
*/
|
|
89
|
+
displayName(): string;
|
|
90
|
+
/**
|
|
91
|
+
* The name column's class.
|
|
92
|
+
* @returns The class string.
|
|
93
|
+
*/
|
|
94
|
+
nameColumnClass(): string;
|
|
95
|
+
/**
|
|
96
|
+
* The name span's class.
|
|
97
|
+
* @returns The class string.
|
|
98
|
+
*/
|
|
99
|
+
nameClass(): string;
|
|
100
|
+
/**
|
|
101
|
+
* The subtitle span's class.
|
|
102
|
+
* @returns The class string.
|
|
103
|
+
*/
|
|
104
|
+
subtitleClass(): string;
|
|
105
|
+
/**
|
|
106
|
+
* Whether a text name input is present (a projected name is not).
|
|
107
|
+
* @returns True when the name renders as text.
|
|
108
|
+
*/
|
|
109
|
+
get hasName(): boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Whether a text score input is present (a projected score is not).
|
|
112
|
+
* @returns True when the score renders as text.
|
|
113
|
+
*/
|
|
114
|
+
get hasScore(): boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Whether the subtitle renders as text: React's `subtitle && …` truthiness.
|
|
117
|
+
* @returns True when the subtitle text shows.
|
|
118
|
+
*/
|
|
119
|
+
get hasSubtitle(): boolean;
|
|
120
|
+
/**
|
|
121
|
+
* Whether the subtitle span renders at all: the text input or projected
|
|
122
|
+
* `[slot=subtitle]` content.
|
|
123
|
+
* @returns True when the subtitle shows.
|
|
124
|
+
*/
|
|
125
|
+
get showSubtitle(): boolean;
|
|
126
|
+
/**
|
|
127
|
+
* Whether a delta indicator renders: React's `rankDelta !== undefined &&
|
|
128
|
+
* rankDelta !== 0` (a zero delta renders nothing).
|
|
129
|
+
* @returns True when the ▲/▼ chip shows.
|
|
130
|
+
*/
|
|
131
|
+
get hasDelta(): boolean;
|
|
132
|
+
/**
|
|
133
|
+
* The delta chip's class.
|
|
134
|
+
* @returns The class string.
|
|
135
|
+
*/
|
|
136
|
+
deltaClass(): string;
|
|
137
|
+
/**
|
|
138
|
+
* The delta arrow's color (React's hardcoded green/red hex).
|
|
139
|
+
* @returns The CSS color.
|
|
140
|
+
*/
|
|
141
|
+
deltaColor(): string;
|
|
142
|
+
/**
|
|
143
|
+
* The delta's arrow (React's `rankDelta > 0 ? '▲' : '▼'`).
|
|
144
|
+
* @returns The arrow character.
|
|
145
|
+
*/
|
|
146
|
+
deltaArrow(): string;
|
|
147
|
+
/**
|
|
148
|
+
* The delta's magnitude (React's `Math.abs(rankDelta)`).
|
|
149
|
+
* @returns The number of ranks climbed or dropped.
|
|
150
|
+
*/
|
|
151
|
+
deltaText(): number;
|
|
152
|
+
/**
|
|
153
|
+
* The score span's class.
|
|
154
|
+
* @returns The class string.
|
|
155
|
+
*/
|
|
156
|
+
scoreClass(): string;
|
|
157
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LeaderboardRow, never>;
|
|
158
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<LeaderboardRow, "div[mol-leaderboard-row]", never, { "rank": { "alias": "rank"; "required": false; }; "name": { "alias": "name"; "required": false; }; "avatarSrc": { "alias": "avatarSrc"; "required": false; }; "score": { "alias": "score"; "required": false; }; "rankDelta": { "alias": "rankDelta"; "required": false; }; "subtitle": { "alias": "subtitle"; "required": false; }; "isMe": { "alias": "isMe"; "required": false; }; "onClick": { "alias": "onClick"; "required": false; }; "className": { "alias": "className"; "required": false; }; }, {}, never, ["[slot=name]", "[slot=subtitle]", "[slot=score]"], true, never>;
|
|
159
|
+
}
|
|
160
|
+
//# sourceMappingURL=leaderboard-row.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"leaderboard-row.component.d.ts","sourceRoot":"","sources":["../src/leaderboard-row.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,aAAa,EAAiD,MAAM,eA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I,OAAO,CAEtB;IAED;;;OAGG;IACH,IAAI,WAAW,IAAI,OAAO,CAEzB;IAED;;;;OAIG;IACH,IAAI,YAAY,IAAI,OAAO,CAE1B;IAED;;;;OAIG;IACH,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAED;;;OAGG;IACH,UAAU,IAAI,MAAM;IAIpB;;;OAGG;IACH,UAAU,IAAI,MAAM;IAIpB;;;OAGG;IACH,UAAU,IAAI,MAAM;IAIpB;;;OAGG;IACH,SAAS,IAAI,MAAM;IAInB;;;OAGG;IACH,UAAU,IAAI,MAAM;yCAvMT,cAAc;2CAAd,cAAc;CA0M1B"}
|
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LeaderboardRow component (React parity).
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { Component, signal, ViewChild } from '@angular/core';
|
|
7
|
+
import { getClassMap } from '@molecule/app-ui';
|
|
8
|
+
import { Avatar } from '@molecule/app-ui-angular';
|
|
9
|
+
import * as i0 from "@angular/core";
|
|
10
|
+
const _c0 = ["subtitleEl"];
|
|
11
|
+
const _c1 = [[["", "slot", "name"]], [["", "slot", "score"]], [["", "slot", "subtitle"]]];
|
|
12
|
+
const _c2 = ["[slot=name]", "[slot=score]", "[slot=subtitle]"];
|
|
13
|
+
function LeaderboardRow_Conditional_5_Template(rf, ctx) { if (rf & 1) {
|
|
14
|
+
i0.ɵɵelementContainerStart(0);
|
|
15
|
+
i0.ɵɵtext(1);
|
|
16
|
+
i0.ɵɵelementContainerEnd();
|
|
17
|
+
} if (rf & 2) {
|
|
18
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
19
|
+
i0.ɵɵadvance();
|
|
20
|
+
i0.ɵɵtextInterpolate(ctx_r0.name);
|
|
21
|
+
} }
|
|
22
|
+
function LeaderboardRow_Conditional_7_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
23
|
+
i0.ɵɵelementContainerStart(0);
|
|
24
|
+
i0.ɵɵtext(1);
|
|
25
|
+
i0.ɵɵelementContainerEnd();
|
|
26
|
+
} if (rf & 2) {
|
|
27
|
+
const ctx_r0 = i0.ɵɵnextContext(2);
|
|
28
|
+
i0.ɵɵadvance();
|
|
29
|
+
i0.ɵɵtextInterpolate(ctx_r0.subtitle);
|
|
30
|
+
} }
|
|
31
|
+
function LeaderboardRow_Conditional_7_Template(rf, ctx) { if (rf & 1) {
|
|
32
|
+
i0.ɵɵelementStart(0, "span", null, 0);
|
|
33
|
+
i0.ɵɵconditionalCreate(2, LeaderboardRow_Conditional_7_Conditional_2_Template, 2, 1, "ng-container");
|
|
34
|
+
i0.ɵɵprojection(3, 2);
|
|
35
|
+
i0.ɵɵelementEnd();
|
|
36
|
+
} if (rf & 2) {
|
|
37
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
38
|
+
i0.ɵɵclassMap(ctx_r0.subtitleClass());
|
|
39
|
+
i0.ɵɵadvance(2);
|
|
40
|
+
i0.ɵɵconditional(ctx_r0.hasSubtitle ? 2 : -1);
|
|
41
|
+
} }
|
|
42
|
+
function LeaderboardRow_Conditional_8_Template(rf, ctx) { if (rf & 1) {
|
|
43
|
+
i0.ɵɵelementStart(0, "span");
|
|
44
|
+
i0.ɵɵtext(1);
|
|
45
|
+
i0.ɵɵelementEnd();
|
|
46
|
+
} if (rf & 2) {
|
|
47
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
48
|
+
i0.ɵɵclassMap(ctx_r0.deltaClass());
|
|
49
|
+
i0.ɵɵstyleProp("color", ctx_r0.deltaColor());
|
|
50
|
+
i0.ɵɵadvance();
|
|
51
|
+
i0.ɵɵtextInterpolate(ctx_r0.deltaArrow() + " " + ctx_r0.deltaText());
|
|
52
|
+
} }
|
|
53
|
+
function LeaderboardRow_Conditional_10_Template(rf, ctx) { if (rf & 1) {
|
|
54
|
+
i0.ɵɵelementContainerStart(0);
|
|
55
|
+
i0.ɵɵtext(1);
|
|
56
|
+
i0.ɵɵelementContainerEnd();
|
|
57
|
+
} if (rf & 2) {
|
|
58
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
59
|
+
i0.ɵɵadvance();
|
|
60
|
+
i0.ɵɵtextInterpolate(ctx_r0.score);
|
|
61
|
+
} }
|
|
62
|
+
/**
|
|
63
|
+
* Whether a wrapper element renders anything besides its static content: an
|
|
64
|
+
* element child (a projected `[slot=<name>]` landed — the projection moves
|
|
65
|
+
* into the view at render time) or non-empty text.
|
|
66
|
+
*
|
|
67
|
+
* @param el - The wrapper element.
|
|
68
|
+
* @returns True when its children render anything.
|
|
69
|
+
*/
|
|
70
|
+
const hasRenderableContent = (el) => Array.from(el.childNodes).some((node) => node.nodeType === Node.ELEMENT_NODE ||
|
|
71
|
+
(node.nodeType === Node.TEXT_NODE && (node.textContent ?? '').trim().length > 0));
|
|
72
|
+
/** The medal emoji rendered in place of the rank for the top three. */
|
|
73
|
+
const MEDAL = { 1: '🥇', 2: '🥈', 3: '🥉' };
|
|
74
|
+
/**
|
|
75
|
+
* LeaderboardRow component.
|
|
76
|
+
*
|
|
77
|
+
* Leaderboard row — rank + avatar + name + score + optional rank-delta
|
|
78
|
+
* arrow. Top 3 ranks render a medal in place of the numeric rank. The host IS
|
|
79
|
+
* the row's root `<div>` (`div[mol-leaderboard-row]`), matching React's root
|
|
80
|
+
* exactly; `onClick` is a native click on the host with no keyboard handler
|
|
81
|
+
* or role — a documented gap of the React package the DOM must match. When
|
|
82
|
+
* `name` is not a plain string the Avatar alt falls back to hardcoded
|
|
83
|
+
* 'Player'. Same props, same DOM as
|
|
84
|
+
* `@molecule/app-leaderboard-row-react`'s `LeaderboardRow`. Node-valued
|
|
85
|
+
* `name`, `score` and `subtitle` content is projected (`[slot=<name>]`); a
|
|
86
|
+
* string or number input renders as text. The optional subtitle span renders
|
|
87
|
+
* optimistically so a projection can land, then withdraws at view init when
|
|
88
|
+
* neither a text input nor a projection is present — React renders no span at
|
|
89
|
+
* all for an absent or empty subtitle.
|
|
90
|
+
*/
|
|
91
|
+
export class LeaderboardRow {
|
|
92
|
+
/** 1-based rank. */
|
|
93
|
+
rank;
|
|
94
|
+
/** Display name: text, or `[slot=name]` content. */
|
|
95
|
+
name;
|
|
96
|
+
/** Optional avatar URL. */
|
|
97
|
+
avatarSrc;
|
|
98
|
+
/** Score / metric: text, or `[slot=score]` content. */
|
|
99
|
+
score;
|
|
100
|
+
/** Optional change indicator (positive = climbed). */
|
|
101
|
+
rankDelta;
|
|
102
|
+
/** Optional secondary line: text, or `[slot=subtitle]` content. */
|
|
103
|
+
subtitle;
|
|
104
|
+
/** Whether this row represents the current user (highlighted). */
|
|
105
|
+
isMe;
|
|
106
|
+
/** Click handler, called with the native click event. */
|
|
107
|
+
onClick;
|
|
108
|
+
/** Extra classes. */
|
|
109
|
+
className;
|
|
110
|
+
/** The optional subtitle span (projected content lands here). */
|
|
111
|
+
subtitleEl;
|
|
112
|
+
/** Whether a `[slot=subtitle]` projection landed (true until proven otherwise). */
|
|
113
|
+
subtitleProjected = signal(true, /* @ts-ignore */
|
|
114
|
+
...(ngDevMode ? [{ debugName: "subtitleProjected" }] : /* istanbul ignore next */ []));
|
|
115
|
+
/**
|
|
116
|
+
* Withdraws the optimistic subtitle span when its slot projection did not
|
|
117
|
+
* land: when neither a text input nor projected content is present, React
|
|
118
|
+
* renders no span at all. View queries resolve at view init, and a
|
|
119
|
+
* projected slot's content is in place by then.
|
|
120
|
+
*/
|
|
121
|
+
ngAfterViewInit() {
|
|
122
|
+
const subtitle = this.subtitleEl?.nativeElement;
|
|
123
|
+
if (subtitle && !this.hasSubtitle && !hasRenderableContent(subtitle)) {
|
|
124
|
+
this.subtitleProjected.set(false);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Forwards a native click on the row to the `onClick` input (React calls
|
|
129
|
+
* the handler with the event).
|
|
130
|
+
* @param event - The native click event.
|
|
131
|
+
*/
|
|
132
|
+
rowClick(event) {
|
|
133
|
+
this.onClick?.(event);
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* The current class map.
|
|
137
|
+
* @returns The UIClassMap.
|
|
138
|
+
*/
|
|
139
|
+
cm() {
|
|
140
|
+
return getClassMap();
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Computes the row's root class list, with the pointer cursor only when an
|
|
144
|
+
* `onClick` handler is set (React's conditional `cm.cursorPointer`).
|
|
145
|
+
* @returns The class string.
|
|
146
|
+
*/
|
|
147
|
+
classes() {
|
|
148
|
+
return this.cm().cn(this.cm().flex({ align: 'center', gap: 'sm' }), this.cm().sp('px', 3), this.cm().sp('py', 2), this.onClick ? this.cm().cursorPointer : undefined, this.className);
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* The rank cell's class.
|
|
152
|
+
* @returns The class string.
|
|
153
|
+
*/
|
|
154
|
+
rankClass() {
|
|
155
|
+
return this.cm().cn(this.cm().shrink0, this.cm().fontWeight('bold'), this.cm().textCenter);
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* The rank cell's text: a medal for the top three, `#n` otherwise (React's
|
|
159
|
+
* `MEDAL[rank] ?? '#' + rank`).
|
|
160
|
+
* @returns The rank display.
|
|
161
|
+
*/
|
|
162
|
+
rankText() {
|
|
163
|
+
return MEDAL[this.rank] ?? `#${this.rank}`;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* The Avatar's alt/name (React's `typeof name === 'string' ? name :
|
|
167
|
+
* 'Player'`).
|
|
168
|
+
* @returns The display name.
|
|
169
|
+
*/
|
|
170
|
+
displayName() {
|
|
171
|
+
return typeof this.name === 'string' ? this.name : 'Player';
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* The name column's class.
|
|
175
|
+
* @returns The class string.
|
|
176
|
+
*/
|
|
177
|
+
nameColumnClass() {
|
|
178
|
+
return this.cm().cn(this.cm().flex1, this.cm().stack(0));
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* The name span's class.
|
|
182
|
+
* @returns The class string.
|
|
183
|
+
*/
|
|
184
|
+
nameClass() {
|
|
185
|
+
return this.cm().cn(this.cm().textSize('sm'), this.cm().fontWeight('semibold'));
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* The subtitle span's class.
|
|
189
|
+
* @returns The class string.
|
|
190
|
+
*/
|
|
191
|
+
subtitleClass() {
|
|
192
|
+
return this.cm().textSize('xs');
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Whether a text name input is present (a projected name is not).
|
|
196
|
+
* @returns True when the name renders as text.
|
|
197
|
+
*/
|
|
198
|
+
get hasName() {
|
|
199
|
+
return this.name !== undefined && this.name !== null;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Whether a text score input is present (a projected score is not).
|
|
203
|
+
* @returns True when the score renders as text.
|
|
204
|
+
*/
|
|
205
|
+
get hasScore() {
|
|
206
|
+
return this.score !== undefined && this.score !== null;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Whether the subtitle renders as text: React's `subtitle && …` truthiness.
|
|
210
|
+
* @returns True when the subtitle text shows.
|
|
211
|
+
*/
|
|
212
|
+
get hasSubtitle() {
|
|
213
|
+
return this.subtitle !== undefined && this.subtitle !== null && this.subtitle !== '';
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Whether the subtitle span renders at all: the text input or projected
|
|
217
|
+
* `[slot=subtitle]` content.
|
|
218
|
+
* @returns True when the subtitle shows.
|
|
219
|
+
*/
|
|
220
|
+
get showSubtitle() {
|
|
221
|
+
return this.hasSubtitle || this.subtitleProjected();
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Whether a delta indicator renders: React's `rankDelta !== undefined &&
|
|
225
|
+
* rankDelta !== 0` (a zero delta renders nothing).
|
|
226
|
+
* @returns True when the ▲/▼ chip shows.
|
|
227
|
+
*/
|
|
228
|
+
get hasDelta() {
|
|
229
|
+
return this.rankDelta !== undefined && this.rankDelta !== 0;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* The delta chip's class.
|
|
233
|
+
* @returns The class string.
|
|
234
|
+
*/
|
|
235
|
+
deltaClass() {
|
|
236
|
+
return this.cm().cn(this.cm().textSize('xs'), this.cm().fontWeight('semibold'));
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* The delta arrow's color (React's hardcoded green/red hex).
|
|
240
|
+
* @returns The CSS color.
|
|
241
|
+
*/
|
|
242
|
+
deltaColor() {
|
|
243
|
+
return this.rankDelta > 0 ? '#22c55e' : '#ef4444';
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* The delta's arrow (React's `rankDelta > 0 ? '▲' : '▼'`).
|
|
247
|
+
* @returns The arrow character.
|
|
248
|
+
*/
|
|
249
|
+
deltaArrow() {
|
|
250
|
+
return this.rankDelta > 0 ? '▲' : '▼';
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* The delta's magnitude (React's `Math.abs(rankDelta)`).
|
|
254
|
+
* @returns The number of ranks climbed or dropped.
|
|
255
|
+
*/
|
|
256
|
+
deltaText() {
|
|
257
|
+
return Math.abs(this.rankDelta);
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* The score span's class.
|
|
261
|
+
* @returns The class string.
|
|
262
|
+
*/
|
|
263
|
+
scoreClass() {
|
|
264
|
+
return this.cm().cn(this.cm().textSize('sm'), this.cm().fontWeight('bold'));
|
|
265
|
+
}
|
|
266
|
+
static ɵfac = function LeaderboardRow_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || LeaderboardRow)(); };
|
|
267
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: LeaderboardRow, selectors: [["div", "mol-leaderboard-row", ""]], viewQuery: function LeaderboardRow_Query(rf, ctx) { if (rf & 1) {
|
|
268
|
+
i0.ɵɵviewQuery(_c0, 5);
|
|
269
|
+
} if (rf & 2) {
|
|
270
|
+
let _t;
|
|
271
|
+
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.subtitleEl = _t.first);
|
|
272
|
+
} }, hostVars: 6, hostBindings: function LeaderboardRow_HostBindings(rf, ctx) { if (rf & 1) {
|
|
273
|
+
i0.ɵɵlistener("click", function LeaderboardRow_click_HostBindingHandler($event) { return ctx.rowClick($event); });
|
|
274
|
+
} if (rf & 2) {
|
|
275
|
+
i0.ɵɵclassMap(ctx.classes());
|
|
276
|
+
i0.ɵɵstyleProp("background", ctx.isMe ? "rgba(96,165,250,0.1)" : "")("border-radius", ctx.isMe ? "8px" : "");
|
|
277
|
+
} }, inputs: { rank: "rank", name: "name", avatarSrc: "avatarSrc", score: "score", rankDelta: "rankDelta", subtitle: "subtitle", isMe: "isMe", onClick: "onClick", className: "className" }, ngContentSelectors: _c2, decls: 12, vars: 17, consts: [["subtitleEl", ""], [2, "min-width", "32px"], ["mol-avatar", "", 3, "src", "alt", "name", "size"], [3, "class"], [3, "class", "color"]], template: function LeaderboardRow_Template(rf, ctx) { if (rf & 1) {
|
|
278
|
+
i0.ɵɵprojectionDef(_c1);
|
|
279
|
+
i0.ɵɵelementStart(0, "span", 1);
|
|
280
|
+
i0.ɵɵtext(1);
|
|
281
|
+
i0.ɵɵelementEnd();
|
|
282
|
+
i0.ɵɵelement(2, "div", 2);
|
|
283
|
+
i0.ɵɵelementStart(3, "div")(4, "span");
|
|
284
|
+
i0.ɵɵconditionalCreate(5, LeaderboardRow_Conditional_5_Template, 2, 1, "ng-container");
|
|
285
|
+
i0.ɵɵprojection(6);
|
|
286
|
+
i0.ɵɵelementEnd();
|
|
287
|
+
i0.ɵɵconditionalCreate(7, LeaderboardRow_Conditional_7_Template, 4, 3, "span", 3);
|
|
288
|
+
i0.ɵɵelementEnd();
|
|
289
|
+
i0.ɵɵconditionalCreate(8, LeaderboardRow_Conditional_8_Template, 2, 5, "span", 4);
|
|
290
|
+
i0.ɵɵelementStart(9, "span");
|
|
291
|
+
i0.ɵɵconditionalCreate(10, LeaderboardRow_Conditional_10_Template, 2, 1, "ng-container");
|
|
292
|
+
i0.ɵɵprojection(11, 1);
|
|
293
|
+
i0.ɵɵelementEnd();
|
|
294
|
+
} if (rf & 2) {
|
|
295
|
+
i0.ɵɵclassMap(ctx.rankClass());
|
|
296
|
+
i0.ɵɵadvance();
|
|
297
|
+
i0.ɵɵtextInterpolate(ctx.rankText());
|
|
298
|
+
i0.ɵɵadvance();
|
|
299
|
+
i0.ɵɵproperty("src", ctx.avatarSrc)("alt", ctx.displayName())("name", ctx.displayName())("size", "sm");
|
|
300
|
+
i0.ɵɵadvance();
|
|
301
|
+
i0.ɵɵclassMap(ctx.nameColumnClass());
|
|
302
|
+
i0.ɵɵadvance();
|
|
303
|
+
i0.ɵɵclassMap(ctx.nameClass());
|
|
304
|
+
i0.ɵɵadvance();
|
|
305
|
+
i0.ɵɵconditional(ctx.hasName ? 5 : -1);
|
|
306
|
+
i0.ɵɵadvance(2);
|
|
307
|
+
i0.ɵɵconditional(ctx.showSubtitle ? 7 : -1);
|
|
308
|
+
i0.ɵɵadvance();
|
|
309
|
+
i0.ɵɵconditional(ctx.hasDelta ? 8 : -1);
|
|
310
|
+
i0.ɵɵadvance();
|
|
311
|
+
i0.ɵɵclassMap(ctx.scoreClass());
|
|
312
|
+
i0.ɵɵadvance();
|
|
313
|
+
i0.ɵɵconditional(ctx.hasScore ? 10 : -1);
|
|
314
|
+
} }, dependencies: [Avatar], encapsulation: 2 });
|
|
315
|
+
}
|
|
316
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(LeaderboardRow, [{
|
|
317
|
+
type: Component,
|
|
318
|
+
args: [{
|
|
319
|
+
selector: 'div[mol-leaderboard-row]',
|
|
320
|
+
standalone: true,
|
|
321
|
+
imports: [Avatar],
|
|
322
|
+
inputs: [
|
|
323
|
+
'rank',
|
|
324
|
+
'name',
|
|
325
|
+
'avatarSrc',
|
|
326
|
+
'score',
|
|
327
|
+
'rankDelta',
|
|
328
|
+
'subtitle',
|
|
329
|
+
'isMe',
|
|
330
|
+
'onClick',
|
|
331
|
+
'className',
|
|
332
|
+
],
|
|
333
|
+
host: {
|
|
334
|
+
'[class]': 'classes()',
|
|
335
|
+
'[style.background]': "isMe ? 'rgba(96,165,250,0.1)' : ''",
|
|
336
|
+
'[style.borderRadius]': "isMe ? '8px' : ''",
|
|
337
|
+
'(click)': 'rowClick($event)',
|
|
338
|
+
},
|
|
339
|
+
// prettier-ignore
|
|
340
|
+
template: `<span [class]="rankClass()" style="min-width: 32px">{{ rankText() }}</span>
|
|
341
|
+
<div mol-avatar [src]="avatarSrc" [alt]="displayName()" [name]="displayName()" [size]="'sm'"></div>
|
|
342
|
+
<div [class]="nameColumnClass()"><span [class]="nameClass()">@if (hasName) {<ng-container>{{ name }}</ng-container>}<ng-content select="[slot=name]" /></span>@if (showSubtitle) {<span #subtitleEl [class]="subtitleClass()">@if (hasSubtitle) {<ng-container>{{ subtitle }}</ng-container>}<ng-content select="[slot=subtitle]" /></span>}</div>
|
|
343
|
+
@if (hasDelta) {<span [class]="deltaClass()" [style.color]="deltaColor()">{{ deltaArrow() + ' ' + deltaText() }}</span>}
|
|
344
|
+
<span [class]="scoreClass()">@if (hasScore) {<ng-container>{{ score }}</ng-container>}<ng-content select="[slot=score]" /></span>`,
|
|
345
|
+
}]
|
|
346
|
+
}], null, { subtitleEl: [{
|
|
347
|
+
type: ViewChild,
|
|
348
|
+
args: ['subtitleEl']
|
|
349
|
+
}] }); })();
|
|
350
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(LeaderboardRow, { className: "LeaderboardRow", filePath: "leaderboard-row.component.ts", lineNumber: 76 }); })();
|
|
351
|
+
//# sourceMappingURL=leaderboard-row.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"leaderboard-row.component.js","sourceRoot":"","sources":["../src/leaderboard-row.component.ts"],"names":[],"mappings":"AAAA;;;;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BAAC,YAAY;;kFArBZ,cAAc"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for the Angular leaderboard row.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Props accepted by the {@link LeaderboardRow} component — the same props
|
|
8
|
+
* `@molecule/app-leaderboard-row-react` accepts. Node-valued props render as
|
|
9
|
+
* text or as projected `[slot=<name>]` content.
|
|
10
|
+
*/
|
|
11
|
+
export interface LeaderboardRowProps {
|
|
12
|
+
/** 1-based rank. */
|
|
13
|
+
rank: number;
|
|
14
|
+
/** Display name: text, or `[slot=name]` content. */
|
|
15
|
+
name: unknown;
|
|
16
|
+
/** Optional avatar URL. */
|
|
17
|
+
avatarSrc?: string;
|
|
18
|
+
/** Score / metric: text, or `[slot=score]` content. */
|
|
19
|
+
score: unknown;
|
|
20
|
+
/** Optional change indicator (positive = climbed). */
|
|
21
|
+
rankDelta?: number;
|
|
22
|
+
/** Optional secondary line (team, level, country): text, or `[slot=subtitle]` content. */
|
|
23
|
+
subtitle?: unknown;
|
|
24
|
+
/** Whether this row represents the current user (highlighted). */
|
|
25
|
+
isMe?: boolean;
|
|
26
|
+
/** Click handler (a native click on the row, with the DOM event). */
|
|
27
|
+
onClick?: (event: MouseEvent) => void;
|
|
28
|
+
/** Extra classes. */
|
|
29
|
+
className?: string;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,oBAAoB;IACpB,IAAI,EAAE,MAAM,CAAA;IACZ,oDAAoD;IACpD,IAAI,EAAE,OAAO,CAAA;IACb,2BAA2B;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,uDAAuD;IACvD,KAAK,EAAE,OAAO,CAAA;IACd,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,0FAA0F;IAC1F,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,kEAAkE;IAClE,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,qEAAqE;IACrE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAA;IACrC,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|