@oddsmith/ui 0.0.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/.eleventy.cjs +14 -0
- package/LICENSE +28 -0
- package/README.md +118 -0
- package/custom-elements.json +1539 -0
- package/docs/_README/index.html +4 -0
- package/docs/api/index.html +2100 -0
- package/docs/components.bundle.js +1669 -0
- package/docs/components.bundle.js.map +1 -0
- package/docs/docs.css +162 -0
- package/docs/examples/index.html +56 -0
- package/docs/index.html +53 -0
- package/docs/install/index.html +45 -0
- package/docs/prism-okaidia.css +123 -0
- package/docs-src/.nojekyll +0 -0
- package/docs-src/_README.md +7 -0
- package/docs-src/_data/api.11tydata.js +8 -0
- package/docs-src/_includes/example.11ty.js +35 -0
- package/docs-src/_includes/footer.11ty.js +6 -0
- package/docs-src/_includes/header.11ty.js +7 -0
- package/docs-src/_includes/nav.11ty.js +11 -0
- package/docs-src/_includes/page.11ty.js +32 -0
- package/docs-src/_includes/relative-path.cjs +9 -0
- package/docs-src/api.11ty.js +85 -0
- package/docs-src/bundle.ts +9 -0
- package/docs-src/docs.css +162 -0
- package/docs-src/examples/index.md +15 -0
- package/docs-src/index.md +39 -0
- package/docs-src/install.md +28 -0
- package/docs-src/package.json +3 -0
- package/index.html +19 -0
- package/karma.conf.cjs +24 -0
- package/main.css +210 -0
- package/main.ts +124 -0
- package/package.json +86 -0
- package/previews/casino.ts +12 -0
- package/previews/catalog.ts +94 -0
- package/previews/leaderboard-v1.ts +12 -0
- package/previews/leaderboard-v2.ts +17 -0
- package/previews/sample-data.ts +101 -0
- package/previews/sf-leaderboard.ts +100 -0
- package/previews/sf-live-feed.ts +15 -0
- package/previews/streaks.ts +40 -0
- package/previews/types.ts +18 -0
- package/src/components/README.md +16 -0
- package/src/components/casino-leaderboard/casino-leaderboard.html +80 -0
- package/src/components/casino-leaderboard/casino-leaderboard.scss +585 -0
- package/src/components/casino-leaderboard/casino-leaderboard.ts +136 -0
- package/src/components/casino-leaderboard/data.ts +111 -0
- package/src/components/casino-leaderboard/index.ts +5 -0
- package/src/components/casino-leaderboard/todo.txt +2 -0
- package/src/components/casino-leaderboard/types.ts +19 -0
- package/src/components/leaderboard/components/leaderboard.ts +373 -0
- package/src/components/leaderboard/components/player-card.ts +342 -0
- package/src/components/leaderboard/components/ui.ts +452 -0
- package/src/components/leaderboard/data.ts +152 -0
- package/src/components/leaderboard/index.ts +2 -0
- package/src/components/leaderboard/main.ts +42 -0
- package/src/components/leaderboard/styles.ts +67 -0
- package/src/components/leaderboard/types.ts +28 -0
- package/src/components/leaderboard-v2/components/sf-leaderboard-player.ts +451 -0
- package/src/components/leaderboard-v2/components/sf-leaderboard-ui.ts +512 -0
- package/src/components/leaderboard-v2/components/sf-leaderboard.ts +205 -0
- package/src/components/leaderboard-v2/constants.ts +16 -0
- package/src/components/leaderboard-v2/demo/sample-data.ts +152 -0
- package/src/components/leaderboard-v2/events.ts +13 -0
- package/src/components/leaderboard-v2/icons.ts +22 -0
- package/src/components/leaderboard-v2/index.ts +23 -0
- package/src/components/leaderboard-v2/sf-leaderboard.html +1 -0
- package/src/components/leaderboard-v2/sf-leaderboard.scss +382 -0
- package/src/components/leaderboard-v2/tokens.ts +35 -0
- package/src/components/leaderboard-v2/types.ts +30 -0
- package/src/components/sf-leaderboard/index.ts +77 -0
- package/src/components/sf-leaderboard/sections/footer-section/footer-section.host.ts +3 -0
- package/src/components/sf-leaderboard/sections/footer-section/footer-section.html +3 -0
- package/src/components/sf-leaderboard/sections/footer-section/footer-section.scss +18 -0
- package/src/components/sf-leaderboard/sections/footer-section/footer-section.ts +22 -0
- package/src/components/sf-leaderboard/sections/header-section/header-section.host.ts +14 -0
- package/src/components/sf-leaderboard/sections/header-section/header-section.html +27 -0
- package/src/components/sf-leaderboard/sections/header-section/header-section.scss +189 -0
- package/src/components/sf-leaderboard/sections/header-section/header-section.ts +70 -0
- package/src/components/sf-leaderboard/sections/ranking-section/ranking-section.host.ts +22 -0
- package/src/components/sf-leaderboard/sections/ranking-section/ranking-section.html +38 -0
- package/src/components/sf-leaderboard/sections/ranking-section/ranking-section.scss +99 -0
- package/src/components/sf-leaderboard/sections/ranking-section/ranking-section.ts +121 -0
- package/src/components/sf-leaderboard/sections/stats-section/stats-section.host.ts +8 -0
- package/src/components/sf-leaderboard/sections/stats-section/stats-section.html +6 -0
- package/src/components/sf-leaderboard/sections/stats-section/stats-section.scss +44 -0
- package/src/components/sf-leaderboard/sections/stats-section/stats-section.ts +41 -0
- package/src/components/sf-leaderboard/sections/table-section/table-section.host.ts +17 -0
- package/src/components/sf-leaderboard/sections/table-section/table-section.html +19 -0
- package/src/components/sf-leaderboard/sections/table-section/table-section.scss +37 -0
- package/src/components/sf-leaderboard/sections/table-section/table-section.ts +108 -0
- package/src/components/sf-leaderboard/services/index.ts +22 -0
- package/src/components/sf-leaderboard/services/sf-leaderboard-data.service.ts +54 -0
- package/src/components/sf-leaderboard/services/sf-leaderboard.state.ts +160 -0
- package/src/components/sf-leaderboard/shared/components/activity-feed/activity-feed.host.ts +7 -0
- package/src/components/sf-leaderboard/shared/components/activity-feed/activity-feed.html +10 -0
- package/src/components/sf-leaderboard/shared/components/activity-feed/activity-feed.scss +180 -0
- package/src/components/sf-leaderboard/shared/components/activity-feed/activity-feed.ts +88 -0
- package/src/components/sf-leaderboard/shared/components/filters/filters.host.ts +12 -0
- package/src/components/sf-leaderboard/shared/components/filters/filters.html +22 -0
- package/src/components/sf-leaderboard/shared/components/filters/filters.scss +122 -0
- package/src/components/sf-leaderboard/shared/components/filters/filters.ts +75 -0
- package/src/components/sf-leaderboard/shared/components/player-avatar/player-avatar.host.ts +9 -0
- package/src/components/sf-leaderboard/shared/components/player-avatar/player-avatar.html +5 -0
- package/src/components/sf-leaderboard/shared/components/player-avatar/player-avatar.scss +81 -0
- package/src/components/sf-leaderboard/shared/components/player-avatar/player-avatar.ts +34 -0
- package/src/components/sf-leaderboard/shared/components/podium/map-players.ts +24 -0
- package/src/components/sf-leaderboard/shared/components/podium/podium.host.ts +10 -0
- package/src/components/sf-leaderboard/shared/components/podium/podium.html +53 -0
- package/src/components/sf-leaderboard/shared/components/podium/podium.scss +580 -0
- package/src/components/sf-leaderboard/shared/components/podium/podium.ts +49 -0
- package/src/components/sf-leaderboard/shared/components/podium/podium.types.ts +9 -0
- package/src/components/sf-leaderboard/shared/components/rank-badge/rank-badge.host.ts +11 -0
- package/src/components/sf-leaderboard/shared/components/rank-badge/rank-badge.html +9 -0
- package/src/components/sf-leaderboard/shared/components/rank-badge/rank-badge.scss +98 -0
- package/src/components/sf-leaderboard/shared/components/rank-badge/rank-badge.ts +63 -0
- package/src/components/sf-leaderboard/shared/components/stat-card/stat-card.host.ts +9 -0
- package/src/components/sf-leaderboard/shared/components/stat-card/stat-card.html +15 -0
- package/src/components/sf-leaderboard/shared/components/stat-card/stat-card.scss +210 -0
- package/src/components/sf-leaderboard/shared/components/stat-card/stat-card.ts +36 -0
- package/src/components/sf-leaderboard/shared/components/table/table.host.ts +5 -0
- package/src/components/sf-leaderboard/shared/components/table/table.html +11 -0
- package/src/components/sf-leaderboard/shared/components/table/table.scss +212 -0
- package/src/components/sf-leaderboard/shared/components/table/table.ts +111 -0
- package/src/components/sf-leaderboard/shared/constants/defaults.ts +7 -0
- package/src/components/sf-leaderboard/shared/constants/filters.ts +16 -0
- package/src/components/sf-leaderboard/shared/constants/index.ts +5 -0
- package/src/components/sf-leaderboard/shared/constants/player-stats.ts +3 -0
- package/src/components/sf-leaderboard/shared/constants/stats-overview.ts +38 -0
- package/src/components/sf-leaderboard/shared/constants/tags.ts +16 -0
- package/src/components/sf-leaderboard/shared/styles/_section.scss +35 -0
- package/src/components/sf-leaderboard/shared/types/data.ts +29 -0
- package/src/components/sf-leaderboard/shared/types/events.ts +30 -0
- package/src/components/sf-leaderboard/shared/types/player-stats.ts +3 -0
- package/src/components/sf-leaderboard/shared/types/sections.ts +100 -0
- package/src/components/sf-leaderboard/shared/utils/utils.ts +17 -0
- package/src/components/sf-leaderboard/theme/THEMING.md +54 -0
- package/src/components/sf-leaderboard/theme/context.ts +16 -0
- package/src/components/sf-leaderboard/theme/default-theme.ts +4 -0
- package/src/components/sf-leaderboard/theme/hex-to-rgb.ts +25 -0
- package/src/components/sf-leaderboard/theme/index.ts +18 -0
- package/src/components/sf-leaderboard/theme/inject-theme.ts +39 -0
- package/src/components/sf-leaderboard/theme/load-theme.ts +26 -0
- package/src/components/sf-leaderboard/theme/merge-theme.ts +59 -0
- package/src/components/sf-leaderboard/theme/scss/_colors.scss +101 -0
- package/src/components/sf-leaderboard/theme/scss/shared.scss +123 -0
- package/src/components/sf-leaderboard/theme/styles.ts +6 -0
- package/src/components/sf-leaderboard/theme/theme-to-css-vars.ts +99 -0
- package/src/components/sf-leaderboard/theme/themes/fallback.json +62 -0
- package/src/components/sf-leaderboard/theme/themes/red.json +62 -0
- package/src/components/sf-leaderboard/theme/types.ts +71 -0
- package/src/components/sf-live-feed/components/avatar/avatar.host.ts +5 -0
- package/src/components/sf-live-feed/components/avatar/avatar.html +3 -0
- package/src/components/sf-live-feed/components/avatar/avatar.scss +24 -0
- package/src/components/sf-live-feed/components/avatar/avatar.ts +27 -0
- package/src/components/sf-live-feed/components/sf-live-feed/sf-live-feed.host.ts +8 -0
- package/src/components/sf-live-feed/components/sf-live-feed/sf-live-feed.html +10 -0
- package/src/components/sf-live-feed/components/sf-live-feed/sf-live-feed.scss +177 -0
- package/src/components/sf-live-feed/components/sf-live-feed/sf-live-feed.ts +65 -0
- package/src/components/sf-live-feed/constants.ts +4 -0
- package/src/components/sf-live-feed/demo/sample-data.ts +34 -0
- package/src/components/sf-live-feed/index.ts +19 -0
- package/src/components/sf-live-feed/styles/theme.scss +19 -0
- package/src/components/sf-live-feed/styles/theme.ts +5 -0
- package/src/components/sf-live-feed/types.ts +19 -0
- package/src/components/sf-live-feed/utils.ts +17 -0
- package/src/components/streaks/constants.ts +17 -0
- package/src/components/streaks/demo/sample-steps.ts +10 -0
- package/src/components/streaks/events.ts +8 -0
- package/src/components/streaks/index.ts +16 -0
- package/src/components/streaks/sf-streaks.html +26 -0
- package/src/components/streaks/sf-streaks.scss +351 -0
- package/src/components/streaks/sf-streaks.ts +235 -0
- package/src/components/streaks/types.ts +7 -0
- package/src/lib/lit/component.ts +10 -0
- package/src/lib/lit/safe-custom-element.ts +12 -0
- package/src/lib/lit/scss.ts +6 -0
- package/src/vite-env.d.ts +18 -0
- package/styles/global.css +125 -0
- package/todo.txt +54 -0
- package/tsconfig.json +31 -0
- package/vite.config.ts +56 -0
- package/vite.docs.config.ts +33 -0
- package/vite.lit-html-plugin.ts +43 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
@use '../../../theme/scss/colors' as color;
|
|
2
|
+
|
|
3
|
+
:host {
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
gap: 0.5rem;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.badge {
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
align-items: center;
|
|
13
|
+
justify-content: center;
|
|
14
|
+
border-radius: var(--inset-radius);
|
|
15
|
+
border: 2px solid;
|
|
16
|
+
font-family: var(--font-mono);
|
|
17
|
+
font-weight: 700;
|
|
18
|
+
transition: all 0.3s ease;
|
|
19
|
+
|
|
20
|
+
&.sm {
|
|
21
|
+
width: 32px;
|
|
22
|
+
height: 32px;
|
|
23
|
+
font-size: 0.75rem;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&.md {
|
|
27
|
+
width: 48px;
|
|
28
|
+
height: 48px;
|
|
29
|
+
font-size: 1rem;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&.lg {
|
|
33
|
+
width: 64px;
|
|
34
|
+
height: 64px;
|
|
35
|
+
font-size: 1.25rem;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&.rank-1 {
|
|
39
|
+
background: color-mix(in srgb, #{color.place-first-icon()} 22%, transparent);
|
|
40
|
+
border-color: #{color.place-first-icon()};
|
|
41
|
+
color: #{color.place-first-icon()};
|
|
42
|
+
box-shadow: 0 0 20px color-mix(in srgb, #{color.place-first-icon()} 35%, transparent);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&.rank-2 {
|
|
46
|
+
background: color-mix(in srgb, #{color.place-second-icon()} 18%, transparent);
|
|
47
|
+
border-color: #{color.place-second-icon()};
|
|
48
|
+
color: #{color.place-second-icon()};
|
|
49
|
+
box-shadow: 0 0 20px color-mix(in srgb, #{color.place-second-icon()} 30%, transparent);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&.rank-3 {
|
|
53
|
+
background: color-mix(in srgb, #{color.place-third-icon()} 18%, transparent);
|
|
54
|
+
border-color: #{color.place-third-icon()};
|
|
55
|
+
color: #{color.place-third-icon()};
|
|
56
|
+
box-shadow: 0 0 20px color-mix(in srgb, #{color.place-third-icon()} 30%, transparent);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&.rank-other {
|
|
60
|
+
background: #{color.base(2)};
|
|
61
|
+
border-color: #{color.base(2)};
|
|
62
|
+
color: #{color.surface(muted)};
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.icon {
|
|
67
|
+
font-size: 1em;
|
|
68
|
+
line-height: 1;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.rank-number {
|
|
72
|
+
font-size: 0.65em;
|
|
73
|
+
margin-top: 2px;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.trend {
|
|
77
|
+
display: flex;
|
|
78
|
+
align-items: center;
|
|
79
|
+
gap: 2px;
|
|
80
|
+
font-size: 0.75rem;
|
|
81
|
+
font-weight: 500;
|
|
82
|
+
|
|
83
|
+
&.up {
|
|
84
|
+
color: #{color.semantic(success)};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
&.down {
|
|
88
|
+
color: #{color.semantic(error)};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
&.same {
|
|
92
|
+
color: #{color.surface(muted)};
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.trend-icon {
|
|
97
|
+
font-size: 0.75rem;
|
|
98
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import { property } from 'lit/decorators.js';
|
|
3
|
+
import { Component } from '../../../../../../lib/lit/component.js';
|
|
4
|
+
import { scss } from '../../../../../../lib/lit/scss.js';
|
|
5
|
+
import { SF_LEADERBOARD_RANK_BADGE } from '../../constants/tags.js';
|
|
6
|
+
import { sfLeaderboardTheme } from '../../../theme/styles.js';
|
|
7
|
+
import type { RankBadgeHost } from './rank-badge.host.js';
|
|
8
|
+
import renderTemplate from './rank-badge.html?lit-html';
|
|
9
|
+
import styles from './rank-badge.scss?inline';
|
|
10
|
+
|
|
11
|
+
@Component({ selector: SF_LEADERBOARD_RANK_BADGE })
|
|
12
|
+
export class SfLeaderboardRankBadge extends LitElement
|
|
13
|
+
implements RankBadgeHost {
|
|
14
|
+
static styles = [sfLeaderboardTheme, scss(styles)];
|
|
15
|
+
|
|
16
|
+
@property({ type: Number }) rank = 1;
|
|
17
|
+
@property({ type: Number }) previousRank?: number;
|
|
18
|
+
@property({ type: String }) size: 'sm' | 'md' | 'lg' = 'md';
|
|
19
|
+
@property({ type: Boolean }) showTrend = true;
|
|
20
|
+
|
|
21
|
+
get rankClass(): string {
|
|
22
|
+
return this.rank <= 3 ? `rank-${this.rank}` : 'rank-other';
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
get isTop3(): boolean {
|
|
26
|
+
return this.rank <= 3;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
get rankIcon(): string {
|
|
30
|
+
if (this.rank === 1) return '👑';
|
|
31
|
+
if (this.rank === 2) return '🥈';
|
|
32
|
+
if (this.rank === 3) return '🥉';
|
|
33
|
+
return '';
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
get hasTrend(): boolean {
|
|
37
|
+
return this.getTrend() != null;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
get trendClass(): string {
|
|
41
|
+
return this.getTrend()?.class ?? '';
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
get trendIcon(): string {
|
|
45
|
+
return this.getTrend()?.icon ?? '';
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
get trendDiff(): string {
|
|
49
|
+
return this.getTrend()?.diff ?? '';
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
private getTrend() {
|
|
53
|
+
if (!this.previousRank || !this.showTrend) return null;
|
|
54
|
+
const diff = this.previousRank - this.rank;
|
|
55
|
+
if (diff > 0) return { icon: '↑', class: 'up', diff: `+${diff}` };
|
|
56
|
+
if (diff < 0) return { icon: '↓', class: 'down', diff: `${diff}` };
|
|
57
|
+
return { icon: '–', class: 'same', diff: '0' };
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
render() {
|
|
61
|
+
return renderTemplate(this);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<div class="card">
|
|
2
|
+
<div class="glow"></div>
|
|
3
|
+
<div class="content">
|
|
4
|
+
<div class="header">
|
|
5
|
+
<span class="label">${host.label}</span>
|
|
6
|
+
<div class="icon-wrapper">${host.icon}</div>
|
|
7
|
+
</div>
|
|
8
|
+
<div class="body">
|
|
9
|
+
<p class="value">${host.value}</p>
|
|
10
|
+
<p class="trend ${host.trendClass}" ?hidden="${!host.hasTrend}">
|
|
11
|
+
${host.trendPrefix}${host.trendValue}% from last week
|
|
12
|
+
</p>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: block;
|
|
3
|
+
min-width: 0;
|
|
4
|
+
max-width: 100%;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.card {
|
|
8
|
+
padding: clamp(0.75rem, 2.5vw, 1rem);
|
|
9
|
+
min-width: 0;
|
|
10
|
+
max-width: 100%;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.glow {
|
|
14
|
+
position: absolute;
|
|
15
|
+
top: 0;
|
|
16
|
+
right: 0;
|
|
17
|
+
width: 96px;
|
|
18
|
+
height: 96px;
|
|
19
|
+
background: radial-gradient(circle, var(--accent-soft) 0%, transparent 70%);
|
|
20
|
+
transform: translate(50%, -50%);
|
|
21
|
+
pointer-events: none;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.content {
|
|
25
|
+
position: relative;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.header {
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
justify-content: space-between;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.label {
|
|
35
|
+
font-size: 0.875rem;
|
|
36
|
+
color: var(--muted-foreground);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.icon-wrapper {
|
|
40
|
+
width: 32px;
|
|
41
|
+
height: 32px;
|
|
42
|
+
border-radius: var(--inset-radius);
|
|
43
|
+
background: var(--accent-soft);
|
|
44
|
+
display: flex;
|
|
45
|
+
align-items: center;
|
|
46
|
+
justify-content: center;
|
|
47
|
+
font-size: 1rem;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.body {
|
|
51
|
+
margin-top: 0.5rem;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.value {
|
|
55
|
+
font-size: 1.5rem;
|
|
56
|
+
font-weight: 700;
|
|
57
|
+
font-family: var(--font-mono);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.trend {
|
|
61
|
+
font-size: 0.75rem;
|
|
62
|
+
font-weight: 500;
|
|
63
|
+
margin-top: 0.25rem;
|
|
64
|
+
|
|
65
|
+
&.positive {
|
|
66
|
+
color: var(--success);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
&.negative {
|
|
70
|
+
color: var(--destructive);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* Narrow viewports: smaller tiles, fluid shrink (grid stays 2×2 on parent) */
|
|
75
|
+
@media (max-width: 639px) {
|
|
76
|
+
:host {
|
|
77
|
+
display: flex;
|
|
78
|
+
height: 100%;
|
|
79
|
+
min-height: 0;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.card {
|
|
83
|
+
display: flex;
|
|
84
|
+
flex: 1;
|
|
85
|
+
width: 100%;
|
|
86
|
+
min-height: 100%;
|
|
87
|
+
align-items: center;
|
|
88
|
+
justify-content: center;
|
|
89
|
+
padding: clamp(0.45rem, 2.8vw, 0.65rem);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.glow {
|
|
93
|
+
width: clamp(40px, 22vw, 64px);
|
|
94
|
+
height: clamp(40px, 22vw, 64px);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.content {
|
|
98
|
+
display: flex;
|
|
99
|
+
flex-direction: column;
|
|
100
|
+
align-items: center;
|
|
101
|
+
justify-content: center;
|
|
102
|
+
width: 100%;
|
|
103
|
+
gap: clamp(0.2rem, 1.2vw, 0.35rem);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.header {
|
|
107
|
+
flex-direction: column;
|
|
108
|
+
align-items: center;
|
|
109
|
+
justify-content: center;
|
|
110
|
+
gap: 0.25rem;
|
|
111
|
+
text-align: center;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.label {
|
|
115
|
+
font-size: clamp(0.6rem, 2.6vw, 0.7rem);
|
|
116
|
+
line-height: 1.2;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.icon-wrapper {
|
|
120
|
+
width: clamp(22px, 7.5vw, 28px);
|
|
121
|
+
height: clamp(22px, 7.5vw, 28px);
|
|
122
|
+
font-size: clamp(0.7rem, 3.2vw, 0.85rem);
|
|
123
|
+
flex-shrink: 0;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.body {
|
|
127
|
+
margin-top: 0;
|
|
128
|
+
display: flex;
|
|
129
|
+
flex-direction: column;
|
|
130
|
+
align-items: center;
|
|
131
|
+
justify-content: center;
|
|
132
|
+
text-align: center;
|
|
133
|
+
width: 100%;
|
|
134
|
+
gap: 0.1rem;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.value {
|
|
138
|
+
margin: 0;
|
|
139
|
+
font-size: clamp(0.9rem, 5.5vw, 1.15rem);
|
|
140
|
+
line-height: 1.15;
|
|
141
|
+
word-break: break-word;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.trend {
|
|
145
|
+
font-size: clamp(0.58rem, 2.4vw, 0.65rem);
|
|
146
|
+
margin-top: 0;
|
|
147
|
+
margin-bottom: 0;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/* ≤576px: readable tiles — do not shrink further than 577–639 layout */
|
|
152
|
+
@media (max-width: 576px) {
|
|
153
|
+
.card {
|
|
154
|
+
padding: clamp(0.65rem, 3.2vw, 0.85rem);
|
|
155
|
+
min-height: clamp(5.5rem, 26vw, 6.75rem);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.glow {
|
|
159
|
+
width: clamp(48px, 20vw, 72px);
|
|
160
|
+
height: clamp(48px, 20vw, 72px);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.content {
|
|
164
|
+
gap: clamp(0.35rem, 2vw, 0.5rem);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.header {
|
|
168
|
+
gap: clamp(0.3rem, 1.6vw, 0.4rem);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.icon-wrapper {
|
|
172
|
+
order: -1;
|
|
173
|
+
width: clamp(30px, 8.5vw, 36px);
|
|
174
|
+
height: clamp(30px, 8.5vw, 36px);
|
|
175
|
+
font-size: clamp(0.95rem, 4vw, 1.1rem);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.label {
|
|
179
|
+
order: 0;
|
|
180
|
+
font-size: clamp(0.65rem, 2.8vw, 0.75rem);
|
|
181
|
+
line-height: 1.25;
|
|
182
|
+
letter-spacing: 0.02em;
|
|
183
|
+
max-width: 100%;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.body {
|
|
187
|
+
gap: clamp(0.15rem, 1.2vw, 0.25rem);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.value {
|
|
191
|
+
font-size: clamp(1rem, 5.2vw, 1.2rem);
|
|
192
|
+
line-height: 1.2;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.trend {
|
|
196
|
+
font-size: clamp(0.625rem, 2.6vw, 0.7rem);
|
|
197
|
+
line-height: 1.3;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
@media (max-width: 380px) {
|
|
202
|
+
.card {
|
|
203
|
+
padding: clamp(0.55rem, 2.8vw, 0.7rem);
|
|
204
|
+
min-height: 5rem;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.value {
|
|
208
|
+
font-size: clamp(0.9rem, 4.8vw, 1.05rem);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import { property } from 'lit/decorators.js';
|
|
3
|
+
import { Component } from '../../../../../../lib/lit/component.js';
|
|
4
|
+
import { scss } from '../../../../../../lib/lit/scss.js';
|
|
5
|
+
import { SF_LEADERBOARD_STAT_CARD } from '../../constants/tags.js';
|
|
6
|
+
import { sfLeaderboardTheme } from '../../../theme/styles.js';
|
|
7
|
+
import type { StatCardHost } from './stat-card.host.js';
|
|
8
|
+
import renderTemplate from './stat-card.html?lit-html';
|
|
9
|
+
import styles from './stat-card.scss?inline';
|
|
10
|
+
|
|
11
|
+
@Component({ selector: SF_LEADERBOARD_STAT_CARD })
|
|
12
|
+
export class SfLeaderboardStatCard extends LitElement implements StatCardHost {
|
|
13
|
+
static styles = [sfLeaderboardTheme, scss(styles)];
|
|
14
|
+
|
|
15
|
+
@property({ type: String }) label = '';
|
|
16
|
+
@property({ type: String }) value = '';
|
|
17
|
+
@property({ type: String }) icon = '';
|
|
18
|
+
@property({ type: Number }) trendValue?: number;
|
|
19
|
+
@property({ type: Boolean }) trendPositive = true;
|
|
20
|
+
|
|
21
|
+
get hasTrend(): boolean {
|
|
22
|
+
return this.trendValue !== undefined;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
get trendClass(): string {
|
|
26
|
+
return this.trendPositive ? 'positive' : 'negative';
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
get trendPrefix(): string {
|
|
30
|
+
return this.trendPositive ? '+' : '';
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
render() {
|
|
34
|
+
return renderTemplate(this);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<div class="table-container">
|
|
2
|
+
<div class="table-header">
|
|
3
|
+
<div class="col-rank">Rank</div>
|
|
4
|
+
<div class="col-player">Player</div>
|
|
5
|
+
<div class="col-games text-center hide-mobile">Games</div>
|
|
6
|
+
<div class="col-win-rate text-center hide-mobile">Win Rate</div>
|
|
7
|
+
<div class="col-streak text-center hide-mobile">Streak</div>
|
|
8
|
+
<div class="col-winnings text-right">Winnings</div>
|
|
9
|
+
</div>
|
|
10
|
+
<div class="table-body">${host.renderRows()}</div>
|
|
11
|
+
</div>
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
@use '../../../theme/scss/colors' as color;
|
|
2
|
+
|
|
3
|
+
:host {
|
|
4
|
+
display: block;
|
|
5
|
+
width: 100%;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
@mixin col-theme($name) {
|
|
9
|
+
.col-#{$name} {
|
|
10
|
+
color: var(--table-col-#{$name}-color, inherit);
|
|
11
|
+
font-size: var(--table-col-#{$name}-font-size, inherit);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@include col-theme('rank');
|
|
16
|
+
@include col-theme('player');
|
|
17
|
+
@include col-theme('games');
|
|
18
|
+
@include col-theme('win-rate');
|
|
19
|
+
@include col-theme('streak');
|
|
20
|
+
@include col-theme('winnings');
|
|
21
|
+
|
|
22
|
+
.table-container {
|
|
23
|
+
width: 100%;
|
|
24
|
+
max-width: 100%;
|
|
25
|
+
border-radius: var(--surface-radius);
|
|
26
|
+
border: 1px solid var(--surface-border-color);
|
|
27
|
+
background: var(--surface-gradient);
|
|
28
|
+
box-shadow: var(--surface-shadow);
|
|
29
|
+
overflow-x: auto;
|
|
30
|
+
overflow-y: hidden;
|
|
31
|
+
-webkit-overflow-scrolling: touch;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.table-header {
|
|
35
|
+
display: grid;
|
|
36
|
+
grid-template-columns: 80px 1fr 100px 100px 100px 120px;
|
|
37
|
+
gap: 1rem;
|
|
38
|
+
padding: 0.75rem 1rem;
|
|
39
|
+
background: var(--muted);
|
|
40
|
+
border-bottom: 1px solid var(--border);
|
|
41
|
+
font-size: 0.7rem;
|
|
42
|
+
font-weight: 600;
|
|
43
|
+
text-transform: uppercase;
|
|
44
|
+
letter-spacing: 0.05em;
|
|
45
|
+
color: var(--muted-foreground);
|
|
46
|
+
|
|
47
|
+
@media (max-width: 768px) {
|
|
48
|
+
grid-template-columns: 52px minmax(120px, 1fr) minmax(72px, 88px);
|
|
49
|
+
gap: 0.5rem;
|
|
50
|
+
padding: 0.625rem 0.75rem;
|
|
51
|
+
font-size: 0.625rem;
|
|
52
|
+
|
|
53
|
+
.hide-mobile {
|
|
54
|
+
display: none;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@media (max-width: 380px) {
|
|
59
|
+
grid-template-columns: 44px minmax(100px, 1fr) 72px;
|
|
60
|
+
padding: 0.5rem;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.table-body {
|
|
65
|
+
display: flex;
|
|
66
|
+
flex-direction: column;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.table-row {
|
|
70
|
+
display: grid;
|
|
71
|
+
grid-template-columns: 80px 1fr 100px 100px 100px 120px;
|
|
72
|
+
gap: 1rem;
|
|
73
|
+
padding: 0.75rem 1rem;
|
|
74
|
+
align-items: center;
|
|
75
|
+
border-bottom: 1px solid var(--border-subtle);
|
|
76
|
+
cursor: pointer;
|
|
77
|
+
transition: background 0.2s ease;
|
|
78
|
+
animation: fade-in 0.3s ease-out forwards;
|
|
79
|
+
opacity: 0;
|
|
80
|
+
|
|
81
|
+
@media (max-width: 768px) {
|
|
82
|
+
grid-template-columns: 52px minmax(120px, 1fr) minmax(72px, 88px);
|
|
83
|
+
gap: 0.5rem;
|
|
84
|
+
padding: 0.625rem 0.75rem;
|
|
85
|
+
|
|
86
|
+
.hide-mobile {
|
|
87
|
+
display: none;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@media (max-width: 380px) {
|
|
92
|
+
grid-template-columns: 44px minmax(100px, 1fr) 72px;
|
|
93
|
+
padding: 0.5rem;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
&:hover {
|
|
97
|
+
background: var(--inset-hover-bg);
|
|
98
|
+
|
|
99
|
+
.chevron {
|
|
100
|
+
opacity: 1;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
&:last-child {
|
|
105
|
+
border-bottom: none;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
&.top-3 {
|
|
109
|
+
background: var(--accent-soft);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
@keyframes fade-in {
|
|
114
|
+
from {
|
|
115
|
+
opacity: 0;
|
|
116
|
+
transform: translateY(5px);
|
|
117
|
+
}
|
|
118
|
+
to {
|
|
119
|
+
opacity: 1;
|
|
120
|
+
transform: translateY(0);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.player-cell {
|
|
125
|
+
display: flex;
|
|
126
|
+
align-items: center;
|
|
127
|
+
gap: 0.75rem;
|
|
128
|
+
min-width: 0;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.player-details {
|
|
132
|
+
min-width: 0;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.player-name {
|
|
136
|
+
font-weight: 600;
|
|
137
|
+
white-space: nowrap;
|
|
138
|
+
overflow: hidden;
|
|
139
|
+
text-overflow: ellipsis;
|
|
140
|
+
|
|
141
|
+
&.highlight {
|
|
142
|
+
color: var(--primary);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.player-level {
|
|
147
|
+
display: inline-block;
|
|
148
|
+
font-size: 0.6rem;
|
|
149
|
+
padding: 2px 6px;
|
|
150
|
+
border-radius: 4px;
|
|
151
|
+
border: 1px solid var(--border);
|
|
152
|
+
color: var(--muted-foreground);
|
|
153
|
+
margin-top: 2px;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.stat-cell {
|
|
157
|
+
display: flex;
|
|
158
|
+
align-items: center;
|
|
159
|
+
justify-content: center;
|
|
160
|
+
gap: 0.25rem;
|
|
161
|
+
font-size: 0.875rem;
|
|
162
|
+
color: var(--muted-foreground);
|
|
163
|
+
|
|
164
|
+
.icon {
|
|
165
|
+
font-size: 0.875rem;
|
|
166
|
+
opacity: 0.5;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
&.win-rate {
|
|
170
|
+
.icon {
|
|
171
|
+
color: var(--success);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
&.high {
|
|
175
|
+
color: var(--success);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
&.streak {
|
|
180
|
+
color: var(--gold);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.winnings-cell {
|
|
185
|
+
display: flex;
|
|
186
|
+
align-items: center;
|
|
187
|
+
justify-content: flex-end;
|
|
188
|
+
gap: 0.5rem;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.winnings {
|
|
192
|
+
font-family: var(--font-mono);
|
|
193
|
+
font-weight: 700;
|
|
194
|
+
|
|
195
|
+
&.highlight {
|
|
196
|
+
color: var(--primary);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.chevron {
|
|
201
|
+
color: var(--muted-foreground);
|
|
202
|
+
opacity: 0;
|
|
203
|
+
transition: opacity 0.2s ease;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.text-right {
|
|
207
|
+
text-align: right;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.text-center {
|
|
211
|
+
text-align: center;
|
|
212
|
+
}
|